From dd23f627436b191b61304ea1be0dc79ab0c7e3ac Mon Sep 17 00:00:00 2001 From: Audun Arnesen Nyhus Date: Wed, 11 Nov 2026 20:57:17 +0100 Subject: [PATCH 01/15] Rename the solver and results packages and preserve historical archive identities --- .github/workflows/ci.yml | 24 +- CHANGELOG.md | 7 + MANIFEST.in | 5 +- MIGRATION.md | 14 + README.md | 51 +- dependency-licenses.json | 10 +- docs/ARCHITECTURE.md | 10 +- docs/ARC_LENGTH.md | 4 +- docs/BEAM_SHELL_CONNECTION.md | 10 +- docs/E4_PL_MIGRATION.md | 6 +- docs/FLOATING_RESPONSE.md | 10 +- docs/GENERAL_CONTACT_C0.md | 4 +- docs/GENERAL_CONTACT_CAPABILITIES.md | 4 +- docs/GENERAL_CONTACT_STATIC_CANDIDATE.md | 10 +- docs/INERTIA_RELIEF.md | 4 +- docs/NATIVE_SOURCE_AUTHORITY.md | 5 +- docs/NONLINEAR_PERFORMANCE.md | 10 +- docs/QUALITY_CONTROL.md | 10 +- docs/STATUS.md | 2 +- docs/THEORY.md | 6 +- examples/beam_shell_coupling.py | 8 +- .../elastic_sphere_panel_contact_skins.py | 12 +- examples/elastic_sphere_panel_contact_work.py | 4 +- examples/elastic_sphere_panel_continuation.py | 10 +- examples/elastic_sphere_panel_state_bridge.py | 2 +- examples/elastic_sphere_stiffened_panel.py | 14 +- examples/general_contact_arc_length.py | 2 +- examples/general_contact_arc_length_affine.py | 2 +- .../general_contact_arc_results_archive.py | 2 +- examples/general_contact_automatic_domain.py | 8 +- examples/general_contact_automatic_q4_pair.py | 6 +- examples/general_contact_automatic_s3_pair.py | 6 +- examples/general_contact_automatic_s3_q4.py | 6 +- examples/general_contact_beam_chain_ends.py | 6 +- examples/general_contact_beam_curve_ends.py | 6 +- ...eneral_contact_beam_end_capped_cylinder.py | 6 +- examples/general_contact_beam_pair_ends.py | 6 +- examples/general_contact_beam_plane_impact.py | 10 +- examples/general_contact_beam_s3_transient.py | 10 +- ...l_contact_beam_s3_transient_directional.py | 4 +- ..._s3_transient_directional_loaded_impact.py | 4 +- ...ct_beam_s3_transient_directional_tilted.py | 26 +- ...al_contact_beam_s3_transient_rotational.py | 6 +- examples/general_contact_cylinder.py | 6 +- ...eneral_contact_d1_interior_controls_dev.py | 10 +- ...eneral_contact_deformable_round_beam_s3.py | 6 +- .../general_contact_deformable_s3_caps.py | 6 +- ...general_contact_deforming_q4_planes_dev.py | 2 +- ...general_contact_deforming_s3_impact_dev.py | 4 +- ...general_contact_distributed_q4_s3_cycle.py | 8 +- examples/general_contact_enriched_d1_path.py | 6 +- examples/general_contact_enriched_matched.py | 10 +- examples/general_contact_enriched_patch.py | 8 +- .../general_contact_finite_automatic_shell.py | 2 +- examples/general_contact_finite_q4_v2d.py | 6 +- ...eral_contact_finite_rotation_shell_work.py | 6 +- examples/general_contact_finite_v2d_pair.py | 6 +- .../general_contact_finite_v2d_rigid_patch.py | 6 +- .../general_contact_fixed_projection_skew.py | 4 +- ...eneral_contact_free_shell_sphere_impact.py | 6 +- .../general_contact_free_sphere_impact.py | 10 +- .../general_contact_free_target_cycle_dev.py | 10 +- examples/general_contact_guided_pair.py | 4 +- ...al_contact_guided_shell_pair_impact_dev.py | 2 +- .../general_contact_hemisphere_cylinder.py | 6 +- ...eral_contact_hemisphere_cylinder_motion.py | 6 +- examples/general_contact_hemisphere_plane.py | 6 +- examples/general_contact_hemisphere_sphere.py | 6 +- ...eneral_contact_initial_contact_seed_dev.py | 6 +- .../general_contact_mixed_patch_sliding.py | 4 +- examples/general_contact_mixed_path.py | 4 +- examples/general_contact_moving_plane.py | 6 +- ...neral_contact_moving_plane_displacement.py | 6 +- examples/general_contact_moving_sphere.py | 6 +- .../general_contact_multiple_beam_ends.py | 6 +- .../general_contact_multiple_beam_s3_caps.py | 4 +- ...eral_contact_multiple_beam_s3_transient.py | 10 +- ...al_contact_multiple_hemisphere_analytic.py | 6 +- ...eral_contact_multiple_hemisphere_planes.py | 6 +- .../general_contact_multiple_q4_planes_dev.py | 2 +- ...neral_contact_multiple_round_beam_tools.py | 6 +- ...neral_contact_native_checkpoint_results.py | 4 +- ...al_contact_native_curved_material_plane.py | 26 +- ...neral_contact_native_curved_material_s3.py | 36 +- .../general_contact_native_material_plane.py | 24 +- .../general_contact_native_material_s3.py | 32 +- ...l_contact_native_multi_shell_impact_dev.py | 16 +- ...neral_contact_native_multiple_s3_static.py | 32 +- .../general_contact_native_pair_impact_dev.py | 6 +- ...neral_contact_native_retained_body_pair.py | 18 +- .../general_contact_native_retained_pair.py | 20 +- .../general_contact_native_retained_plane.py | 22 +- ...eral_contact_native_retained_whole_pair.py | 24 +- examples/general_contact_native_s3_static.py | 32 +- ...general_contact_native_shell_impact_dev.py | 14 +- ...eneral_contact_nonuniform_s3_impact_dev.py | 2 +- ...neral_contact_ordinary_displacement_dev.py | 10 +- .../general_contact_partial_shell_cycle.py | 4 +- examples/general_contact_patch_sliding.py | 4 +- examples/general_contact_planar_plate.py | 4 +- ...l_contact_q4_oblique_plastic_impact_dev.py | 8 +- examples/general_contact_q4_pair_bending.py | 6 +- .../general_contact_q4_pair_monolithic.py | 4 +- ...eneral_contact_q4_pair_monolithic_cycle.py | 6 +- ...general_contact_q4_physical_orientation.py | 6 +- examples/general_contact_q4_plane_impact.py | 4 +- .../general_contact_q4_plastic_impact_dev.py | 16 +- .../general_contact_q4_q4_augmented_path.py | 4 +- examples/general_contact_q4_q4_path.py | 4 +- .../general_contact_q4_q4_projected_gap.py | 4 +- .../general_contact_q4_s3_augmented_path.py | 4 +- examples/general_contact_q4_s3_patch_path.py | 4 +- examples/general_contact_q4_s3_tight_path.py | 4 +- ...al_contact_refined_q4_s3_eight_q4_press.py | 4 +- .../general_contact_refined_q4_s3_force.py | 4 +- ...eneral_contact_refined_q4_s3_mixed_path.py | 4 +- .../general_contact_refined_q4_s3_path.py | 4 +- ...eneral_contact_refined_q4_s3_tight_path.py | 4 +- examples/general_contact_refined_s3_patch.py | 4 +- .../general_contact_restricted_sliding.py | 4 +- examples/general_contact_round_b2_b3_pair.py | 6 +- examples/general_contact_round_b3_pair.py | 6 +- ...eral_contact_round_beam_capped_cylinder.py | 6 +- .../general_contact_round_beam_chain_pair.py | 8 +- ...eral_contact_round_beam_moving_cylinder.py | 8 +- examples/general_contact_round_beam_pair.py | 8 +- examples/general_contact_round_beam_plane.py | 8 +- examples/general_contact_round_beam_shell.py | 8 +- .../general_contact_round_beam_shell_patch.py | 8 +- examples/general_contact_round_beam_sphere.py | 8 +- ...neral_contact_s3_friction_physical_path.py | 4 +- .../general_contact_s3_friction_static.py | 16 +- .../general_contact_s3_mesh_history_events.py | 8 +- ...general_contact_s3_mesh_moving_friction.py | 6 +- examples/general_contact_s3_mesh_swept_gap.py | 2 +- ..._contact_s3_mesh_weak_pressure_friction.py | 2 +- ...neral_contact_s3_moving_normal_friction.py | 6 +- examples/general_contact_s3_nodal_pair.py | 4 +- .../general_contact_s3_partial_friction.py | 12 +- ...general_contact_s3_patch_augmented_path.py | 4 +- examples/general_contact_s3_patch_path.py | 4 +- ...general_contact_s3_physical_orientation.py | 2 +- examples/general_contact_s3_plane.py | 4 +- examples/general_contact_s3_plane_impact.py | 4 +- ...eral_contact_s3_q4_patch_augmented_path.py | 4 +- examples/general_contact_s3_q4_patch_path.py | 4 +- examples/general_contact_s3_rim_replay.py | 10 +- examples/general_contact_sphere.py | 6 +- examples/general_contact_sphere_tight_gap.py | 6 +- .../general_contact_static_results_archive.py | 4 +- .../general_contact_tilted_relative_output.py | 6 +- ...general_contact_tilted_relative_sliding.py | 6 +- ...neral_contact_transient_results_archive.py | 4 +- .../general_contact_triangulated_rigid.py | 6 +- ...eneral_contact_triangulated_rigid_patch.py | 2 +- examples/general_contact_warped_q4_patch.py | 4 +- examples/general_contact_warped_q4_plane.py | 4 +- examples/inertia_relief.py | 2 +- .../native_connected_balance_reference.py | 2 +- examples/native_connected_bending_dev.py | 10 +- examples/native_connected_deformation_dev.py | 8 +- examples/native_connected_dynamic_dev.py | 6 +- examples/native_connected_transient_dev.py | 4 +- ...native_contact_free_finite_velocity_dev.py | 4 +- examples/native_contact_free_transient_dev.py | 8 +- .../native_full_amplitude_vibration_dev.py | 18 +- ...native_manufactured_dynamic_loading_dev.py | 6 +- .../native_manufactured_loading_reference.py | 2 +- examples/native_nonprincipal_dev.py | 8 +- .../r8_ge_paired_adaptive_public_example.py | 2 +- examples/static_batch_free_free.py | 6 +- examples/static_batch_supported.py | 6 +- .../stiffened_shell_b2_body_acceleration.py | 2 +- ...ened_shell_b2_footprint_reference_modes.py | 2 +- examples/stiffened_shell_b2_loaded_points.py | 2 +- examples/stiffened_shell_b2_mixed_panel.py | 2 +- ...tiffened_shell_b2_mixed_reference_modes.py | 2 +- ...tiffened_shell_b2_nodal_rigid_footprint.py | 2 +- ...fened_shell_b2_physical_rigid_footprint.py | 2 +- .../stiffened_shell_b2_reference_buckling.py | 2 +- examples/stiffened_shell_bl5_staged.py | 6 +- ...stiffened_shell_coupled_plastic_history.py | 2 +- ...fened_shell_coupled_s3_adaptive_history.py | 6 +- ...stiffened_shell_footprint_chart_restart.py | 4 +- .../stiffened_shell_ge_distributed_load.py | 2 +- ...tiffened_shell_ge_distributed_programme.py | 4 +- ...ened_shell_ge_distributing_displacement.py | 2 +- .../stiffened_shell_ge_distributing_finite.py | 2 +- ...tiffened_shell_ge_distributing_material.py | 2 +- ...iffened_shell_ge_distributing_reference.py | 2 +- .../stiffened_shell_ge_footprint_gravity.py | 4 +- ...stiffened_shell_ge_free_reference_modes.py | 2 +- examples/stiffened_shell_ge_gravity.py | 2 +- examples/stiffened_shell_ge_mixed_buckling.py | 4 +- ...tiffened_shell_ge_mixed_reference_modes.py | 2 +- .../stiffened_shell_ge_point_displacement.py | 2 +- .../stiffened_shell_ge_point_zero_unload.py | 2 +- examples/stiffened_shell_ge_pressure.py | 2 +- .../stiffened_shell_ge_reference_modes.py | 2 +- examples/stiffened_shell_native_arc.py | 2 +- examples/stiffened_shell_native_capacity.py | 4 +- ...fened_shell_native_coupled_displacement.py | 2 +- ...ffened_shell_native_director_arc_metric.py | 2 +- examples/stiffened_shell_native_fibre_bl5.py | 2 +- ...ned_shell_native_fibre_bl5_displacement.py | 2 +- ...iffened_shell_native_fibre_bl5_material.py | 2 +- ..._native_fibre_bl5_mixed_j2_displacement.py | 2 +- ...ened_shell_native_fibre_s3_displacement.py | 2 +- .../stiffened_shell_native_fold_assessment.py | 14 +- ...ened_shell_native_fold_local_diagnostic.py | 12 +- ...stiffened_shell_native_material_bl5_arc.py | 2 +- ...ed_shell_native_plastic_s3_displacement.py | 4 +- .../stiffened_shell_native_s3_displacement.py | 2 +- .../stiffened_shell_nodal_rigid_footprint.py | 4 +- packages/results/README.md | 16 +- packages/results/pyproject.toml | 19 +- .../src/anyfesolver_results}/__init__.py | 6 +- .../src/anyfesolver_results}/capsule.py | 0 .../src/anyfesolver_results}/errors.py | 4 +- .../src/anyfesolver_results}/formulas.py | 10 +- .../src/anyfesolver_results}/principals.py | 0 .../src/anyfesolver_results}/registry.py | 2 +- .../storage_validation.py | 0 pyproject.toml | 22 +- run_qc.py | 4 +- ..._b3_e4_f03_coupled_point_work_candidate.py | 4 +- scripts/_b3_e4_f03_e4_trial_panel.py | 8 +- ..._e4_f03_local_scientific_child_identity.py | 18 +- ..._b3_e4_f03_local_scientific_coordinator.py | 16 +- ...b3_e4_f03_local_scientific_registration.py | 2 +- scripts/_b3_e4_f03_native_fixture.py | 22 +- scripts/_b3_e4_f03_native_spatial_port.py | 4 +- .../_b3_e4_f03_shell_chord_pose_candidate.py | 4 +- .../_b3_e4_f03_shell_finite_pose_candidate.py | 4 +- .../_b3_e4_f03_shell_spatial_linear_port.py | 4 +- .../_b3_e4_f03_shell_strip_pose_candidate.py | 2 +- scripts/_b3_e4_f03_shell_trace.py | 4 +- scripts/_b3_e4_f03_weak_line_candidate.py | 4 +- ...e_b3_ge_e4_pl_g0_f03_shell_port_lift_v1.py | 6 +- ..._e4_pl_g0_f03_variational_refinement_v2.py | 4 +- scripts/adjudicate_b3_ge_e4_pl_g0_f06_v4.py | 44 +- ...e_general_contact_d1_affine_pressure_v1.py | 8 +- ...ontact_d1_distributed_cycle_response_v1.py | 10 +- ...tact_d1_distributed_restart_identity_v2.py | 4 +- ...act_d1_distributed_restart_identity_v2a.py | 4 +- ...l_contact_d1_mixed_interior_response_v1.py | 10 +- .../adjudicate_nonlinear_representative.py | 2 +- scripts/audit_beam_parity_matrix.py | 10 +- scripts/audit_ge_beam3_g3_contract.py | 28 +- scripts/audit_ge_beam3_g3c_contract.py | 2 +- scripts/audit_ge_beam3_g3c_matrix_shell.py | 16 +- scripts/audit_ge_beam3_g3c_mixed_owner.py | 32 +- .../audit_ge_beam3_g3c_mo16_obstruction.py | 6 +- scripts/audit_ge_beam3_g3c_objective_frame.py | 4 +- scripts/audit_ge_beam3_static_contract.py | 26 +- scripts/b2_e01_finite_point_native.py | 2 +- scripts/b2_e01_opensees_finite_point.py | 2 +- .../b2_f09_canonical_energy_admission_dev.py | 4 +- scripts/b2_f09_local_energy_admission_dev.py | 4 +- .../b2_f09_physical_homothety_state_dev.py | 12 +- scripts/b2_f09_thin_section_dev.py | 4 +- scripts/b2_large_scale_development.py | 48 +- scripts/b3_e4_bl5_coherent_aggregation_dev.py | 8 +- .../b3_e4_bl5_completion_sensitivity_dev.py | 10 +- scripts/b3_e4_bl5_distributed_couple_dev.py | 8 +- scripts/b3_e4_bl5_endpoint_response_dev.py | 14 +- scripts/b3_e4_bl5_local_kernel_dev.py | 12 +- scripts/b3_e4_bl5_matched_mz_native_dev.py | 12 +- scripts/b3_e4_bl5_matched_mz_reference_dev.py | 2 +- ...e4_bl5_matched_p0_native_refinement_dev.py | 16 +- scripts/b3_e4_bl5_mechanical_kernel_dev.py | 8 +- scripts/b3_e4_bl5_native_stability_dev.py | 6 +- scripts/b3_e4_bl5_reference_actions_dev.py | 6 +- scripts/b3_e4_bl5_retained_port_decision.py | 16 +- scripts/b3_e4_e01_beam_only_control.py | 2 +- scripts/b3_e4_e01_beam_port_compliance_dev.py | 2 +- ...3_e4_e01_native_point_refinement_screen.py | 10 +- scripts/b3_e4_e01_native_torque_action_dev.py | 6 +- scripts/b3_e4_e01_native_torque_dev.py | 4 +- .../b3_e4_e01_run_matching_point_canary.py | 2 +- scripts/b3_e4_e01_shell_only_native.py | 6 +- scripts/b3_e4_e01_torque_reciprocity_dev.py | 4 +- scripts/b3_e4_f03_bl5_common_field_dev.py | 10 +- .../b3_e4_f03_bl5_common_shell_action_dev.py | 6 +- scripts/b3_e4_f03_bl5_flat_web_load_screen.py | 6 +- scripts/b3_e4_f03_bl5_interface_action_dev.py | 6 +- scripts/b3_e4_f03_bl5_joint_growth_dev.py | 8 +- scripts/b3_e4_f03_bl5_n16_followup_dev.py | 6 +- ..._e4_f03_bl5_native_nodal_comparator_dev.py | 10 +- scripts/b3_e4_f03_bl5_p1_offgrid_dev.py | 26 +- scripts/b3_e4_f03_bl5_p1_space_dev.py | 12 +- scripts/b3_e4_f03_bl5_retained_work_dev.py | 10 +- scripts/b3_e4_f03_bl5_saved_mode_screen.py | 8 +- scripts/b3_e4_f03_bl5_trace_kernel_dev.py | 18 +- scripts/b3_e4_f03_c1_director_compensation.py | 2 +- scripts/b3_e4_f03_c1_fy_l1_mode_bridge.py | 4 +- ...3_e4_f03_c1_fy_rotation_mode_diagnostic.py | 8 +- scripts/b3_e4_f03_c1_fy_supported_native.py | 8 +- ..._c1_material_line_loaded_drill_quotient.py | 10 +- ...b3_e4_f03_c1_material_line_mixed_metric.py | 10 +- ...b3_e4_f03_c1_material_line_ratio_screen.py | 22 +- scripts/b3_e4_f03_ccx_saved_stress_replay.py | 2 +- scripts/b3_e4_f03_ccx_solid_bond_screen.py | 2 +- scripts/b3_e4_f03_common_trace_finite_work.py | 2 +- .../b3_e4_f03_distributed_surface_finite.py | 6 +- scripts/b3_e4_f03_finite_patch_line_work.py | 2 +- scripts/b3_e4_f03_finite_patch_pose.py | 4 +- scripts/b3_e4_f03_l1_candidate_compare.py | 8 +- scripts/b3_e4_f03_l1_matched_flat_web.py | 8 +- .../b3_e4_f03_l1_native_connection_probe.py | 6 +- scripts/b3_e4_f03_l1_physical_rail.py | 6 +- .../b3_e4_f03_l1_uncoupled_flat_controls.py | 4 +- scripts/b3_e4_f03_local_footprint_work.py | 4 +- .../b3_e4_f03_material_line_channel_screen.py | 34 +- scripts/b3_e4_f03_material_line_loaded.py | 10 +- .../b3_e4_f03_material_line_ratio_screen.py | 10 +- .../b3_e4_f03_material_line_space_screen.py | 10 +- scripts/b3_e4_f03_paired_refinement_screen.py | 10 +- ...3_e4_f03_paired_six_channel_work_screen.py | 10 +- scripts/b3_e4_f03_paired_yaw_upper_screen.py | 10 +- scripts/b3_e4_f03_patch_vs_rail_loaded.py | 8 +- .../b3_e4_f03_physical_rail_loaded_screen.py | 10 +- scripts/b3_e4_f03_plate_patch_work.py | 6 +- scripts/b3_e4_f03_saved_mode_patch_work.py | 8 +- .../b3_e4_f03_weak_line_resolution_screen.py | 2 +- scripts/b3_e4_f05_45n_trial_diagnostic.py | 10 +- scripts/b3_e4_f05_low_yield_step_path.py | 14 +- .../b3_e4_f06_loaded_chart_transport_dev.py | 6 +- .../b3_e4_f06_staged_chart_transport_dev.py | 10 +- scripts/b3_e4_l1_sparse_owner_reference.py | 8 +- scripts/b3_e4_v06_centered_cantilever_dev.py | 6 +- .../b3_e4_v06_transformed_energy_patch_dev.py | 4 +- scripts/benchmark_advanced_s4_batches.py | 6 +- .../benchmark_arc_length_predictor_reuse.py | 8 +- scripts/benchmark_contact_work_buffer.py | 8 +- scripts/benchmark_damage_matrix_updates.py | 8 +- scripts/benchmark_e4_pl_s3_reference_batch.py | 14 +- .../benchmark_impact_coupled_convergence.py | 18 +- ...benchmark_impact_elastic_baseline_cache.py | 8 +- scripts/benchmark_impact_reduced_assembly.py | 16 +- scripts/benchmark_impact_tangent_reuse.py | 4 +- scripts/benchmark_load_vector_guards.py | 12 +- scripts/benchmark_nonlinear_assembly.py | 8 +- scripts/benchmark_nonlinear_speed_sweep.py | 14 +- ...benchmark_nonlinear_static_improvements.py | 18 +- scripts/benchmark_plate_edge_shear.py | 4 +- scripts/benchmark_plate_stability.py | 18 +- scripts/benchmark_prepared_envelopes.py | 14 +- scripts/benchmark_prepared_static.py | 18 +- scripts/benchmark_recovery_batches.py | 4 +- scripts/benchmark_s4_improved.py | 4 +- scripts/benchmark_sol_ultra_performance.py | 40 +- scripts/benchmark_sol_ultra_thread_scaling.py | 16 +- scripts/benchmark_spectral_authority.py | 4 +- scripts/benchmark_spectral_medium_fine.py | 12 +- scripts/benchmark_static_batches.py | 42 +- scripts/benchmark_static_native_study.py | 12 +- scripts/benchmark_stiff_plate_precision.py | 16 +- scripts/build_accuracy_report.py | 28 +- scripts/build_beam_shell_candidate.py | 8 +- scripts/check_license_compliance.py | 75 +- scripts/check_s4_geometry_handoff.py | 10 +- scripts/check_u1_canary_trace_work.py | 2 +- scripts/common_main_check_20261008.py | 16 +- scripts/compare_fe_baselines.py | 2 +- scripts/compare_s4_improved.py | 4 +- scripts/compare_sol_ultra_performance.py | 10 +- scripts/confirm_ge_beam3_g1.py | 4 +- scripts/confirm_ge_beam3_g2.py | 4 +- scripts/confirm_ge_beam3_g3a.py | 4 +- scripts/confirm_ge_beam3_g3b.py | 2 +- scripts/development_test_runtime.py | 4 +- .../b2_f09_output_certificate_dev.py | 2 +- .../b3_e4_f06_noncommuting_history_dev.py | 4 +- .../experimental_stiffened_ge_bl5_history.py | 6 +- ...mental_stiffened_ge_bl5_reference_panel.py | 8 +- ...experimental_stiffened_ge_fibre_history.py | 10 +- .../experimental_stiffened_ge_finite_panel.py | 2 +- ...imental_stiffened_ge_multi_member_panel.py | 2 +- scripts/experimental_stiffened_ge_panel.py | 10 +- scripts/explore_nonlinear_abuse.py | 12 +- scripts/fetch_calculix_shell_reference.py | 2 +- .../ge_beam3_g3b_confirmation_authority.py | 2 +- scripts/ge_beam3_g3c_history_owner.py | 6 +- .../ge_beam3_g3c_physical_history_owner.py | 6 +- ...ge_beam3_g3c_physical_restart_preflight.py | 8 +- .../ge_beam3_g3c_rehearsal_bridge_contract.py | 2 +- scripts/ge_beam3_g3c_restart_preflight.py | 6 +- scripts/ge_beam3_g3c_stable_map.py | 8 +- .../general_contact_c4_search_owner_probe.py | 6 +- scripts/general_contact_c6_s3_dae_probe.py | 12 +- ...neral_contact_d1_16q4_alternative_trial.py | 6 +- scripts/general_contact_d1_2d_gap_pair_dev.py | 10 +- ...neral_contact_d1_2d_overlap_profile_dev.py | 6 +- ...contact_d1_2d_target_open_predictor_dev.py | 10 +- .../general_contact_d1_2d_target_press_dev.py | 6 +- ...eneral_contact_d1_active_set_diagnostic.py | 4 +- ...general_contact_d1_actual_swept_gap_dev.py | 2 +- scripts/general_contact_d1_capture_branch.py | 2 +- ...ral_contact_d1_capture_distributed_pair.py | 2 +- ...tact_d1_captured_wedge_derivative_probe.py | 4 +- ..._contact_d1_central_frozen_pose_compare.py | 10 +- ...eral_contact_d1_contact_free_anisotropy.py | 2 +- ...contact_d1_continuum_obstacle_reference.py | 2 +- ...l_contact_d1_coupled_front_pose_compare.py | 4 +- .../general_contact_d1_coupled_refinement.py | 4 +- ..._contact_d1_cycle_tangent_discriminator.py | 16 +- ...neral_contact_d1_diagonal_overlap_probe.py | 2 +- ...neral_contact_d1_displacement_cycle_dev.py | 6 +- ...ct_d1_distributed_coupled_tangent_probe.py | 8 +- ...al_contact_d1_distributed_tangent_probe.py | 4 +- ...act_d1_distributed_target_tangent_probe.py | 2 +- ...al_contact_d1_eccentric_source_director.py | 6 +- .../general_contact_d1_exact_restart_check.py | 2 +- .../general_contact_d1_exact_tie_limits.py | 6 +- .../general_contact_d1_finite_area_load.py | 8 +- ...1_free_target_equilibrium_tangent_probe.py | 8 +- ...l_contact_d1_free_target_identity_probe.py | 2 +- ...eral_contact_d1_free_target_press_probe.py | 2 +- ...al_contact_d1_free_target_restart_probe.py | 2 +- ...act_d1_free_target_schur_fraction_probe.py | 6 +- ...contact_d1_free_target_secant_min_probe.py | 4 +- ...al_contact_d1_free_target_tangent_probe.py | 10 +- ...eneral_contact_d1_gap_certificate_probe.py | 2 +- ...eneral_contact_d1_gap_failure_reuse_dev.py | 2 +- ...ral_contact_d1_guided_scalar_work_check.py | 6 +- ...al_contact_d1_installed_24q4_adjudicate.py | 2 +- ..._contact_d1_interior_analytic_strip_dev.py | 4 +- .../general_contact_d1_interior_press_dev.py | 64 +- ...contact_d1_interior_two_body_oracle_dev.py | 50 +- ...l_contact_d1_interior_work_spectrum_dev.py | 8 +- ...l_contact_d1_linearized_front_reference.py | 8 +- ...neral_contact_d1_mixed_jet2_schur_probe.py | 6 +- ...ntact_d1_mixed_jet2_schur_restart_probe.py | 2 +- ..._contact_d1_mixed_mesh_jet2_schur_press.py | 10 +- ...ral_contact_d1_mixed_mesh_restart_probe.py | 2 +- ..._contact_d1_mixed_mesh_restart_probe_v2.py | 6 +- .../general_contact_d1_mixed_wedge_capture.py | 2 +- ...ral_contact_d1_near_rim_axis_refinement.py | 2 +- ...l_contact_d1_open_ring_displacement_dev.py | 12 +- ...eneral_contact_d1_open_ring_restart_dev.py | 2 +- .../general_contact_d1_overlap_capture_dev.py | 12 +- ...eneral_contact_d1_overlap_gap_bound_dev.py | 6 +- .../general_contact_d1_overlap_shape_bench.py | 2 +- .../general_contact_d1_overlay_gap_rank.py | 8 +- scripts/general_contact_d1_overlay_probe.py | 8 +- ...al_contact_d1_pair_search_preflight_dev.py | 2 +- ...ontact_d1_pressure_family_preflight_dev.py | 10 +- ...neral_contact_d1_pressure_field_compare.py | 2 +- ...ral_contact_d1_pressure_gate_screen_dev.py | 8 +- ...general_contact_d1_pressure_space_probe.py | 2 +- ...act_d1_pressure_transport_preflight_dev.py | 8 +- scripts/general_contact_d1_profile_coupled.py | 14 +- ..._contact_d1_projected_certificate_probe.py | 4 +- ...neral_contact_d1_proportional_plate_dev.py | 4 +- ...neral_contact_d1_schur_response_capture.py | 2 +- ...general_contact_d1_schur_scaling_screen.py | 8 +- ...ral_contact_d1_selected_knots_press_dev.py | 2 +- ...contact_d1_selected_vs_fine_coupled_dev.py | 4 +- ...eral_contact_d1_sliver_derivative_probe.py | 4 +- .../general_contact_d1_source_y_resolution.py | 8 +- .../general_contact_d1_tangent_pairs_dev.py | 8 +- ...eral_contact_d1_target_displacement_dev.py | 6 +- ...contact_d1_target_pressure_margin_probe.py | 2 +- ...ct_d1_tilted_target_local_tangent_probe.py | 2 +- ...eneral_contact_d1_tiny_wedge_crosscheck.py | 4 +- .../general_contact_enriched_path_geometry.py | 4 +- ...general_contact_enriched_path_reference.py | 8 +- scripts/general_contact_enriched_path_run.py | 6 +- scripts/general_contact_enriched_reference.py | 6 +- ...ral_contact_enriched_reference_geometry.py | 4 +- .../general_contact_enriched_reference_run.py | 2 +- ...neral_contact_restart_discrepancy_probe.py | 2 +- scripts/general_contact_seed_gap_reference.py | 2 +- scripts/generate_fe_baselines.py | 2 +- scripts/generate_sestra_verification_fem.py | 2 +- scripts/inspect_sestra_flatbar.py | 8 +- scripts/investigate_plate_edge_shear.py | 10 +- scripts/marine_linear_demo.py | 8 +- scripts/measure_e4_pl_q1m_baseline.py | 4 +- ...be_b3_ge_e4_pl_g0_b2_linear_flexibility.py | 4 +- .../probe_b3_ge_e4_pl_g0_b2_scalar_floor.py | 4 +- scripts/probe_b3_ge_e4_pl_g0_baseline.py | 14 +- scripts/probe_b3_ge_e4_pl_g0_calculix.py | 2 +- scripts/probe_b3_ge_e4_pl_g0_drill.py | 4 +- .../probe_b3_ge_e4_pl_g0_f02_refinement.py | 4 +- ...robe_b3_ge_e4_pl_g0_f03_broken_trace_v1.py | 4 +- ...b3_ge_e4_pl_g0_f03_independent_membrane.py | 4 +- .../probe_b3_ge_e4_pl_g0_f03_local_dual_v1.py | 4 +- .../probe_b3_ge_e4_pl_g0_f03_macro_yaw_v1.py | 4 +- ...probe_b3_ge_e4_pl_g0_f03_signed_norm_v1.py | 4 +- .../probe_b3_ge_e4_pl_g0_f03_trace_dual_v1.py | 4 +- .../probe_b3_ge_e4_pl_g0_f03_weak_mode_v1.py | 6 +- ...b3_ge_e4_pl_g0_f05_pose_pullback_dev_v2.py | 18 +- ...probe_b3_ge_e4_pl_g0_f05_q4_pullback_v1.py | 18 +- ...3_ge_e4_pl_g0_f05_s3_branch_path_dev_v1.py | 12 +- ...ge_e4_pl_g0_f05_s3_pose_pullback_dev_v1.py | 12 +- ...be_b3_ge_e4_pl_g0_f06_beam_chart_dev_v1.py | 10 +- .../probe_b3_ge_e4_pl_g0_f06_beam_chart_v5.py | 4 +- ...obe_b3_ge_e4_pl_g0_f06_loaded_rebase_v1.py | 20 +- ...obe_b3_ge_e4_pl_g0_f06_loaded_rebase_v2.py | 46 +- ...obe_b3_ge_e4_pl_g0_f06_loaded_rebase_v3.py | 46 +- ...robe_b3_ge_e4_pl_g0_f06_owned_rebase_v4.py | 60 +- ...e_b3_ge_e4_pl_g0_f06_q4_owned_rebase_v1.py | 12 +- scripts/probe_b3_ge_e4_pl_g0_f09_graph.py | 2 +- ...probe_b3_ge_e4_pl_g0_f09_graph_reversal.py | 16 +- ...e_e4_pl_g0_f09_mixed_elbow_conditioning.py | 4 +- .../probe_b3_ge_e4_pl_g0_f09_mixed_graph.py | 4 +- ...probe_b3_ge_e4_pl_g0_f09_physical_range.py | 12 +- .../probe_b3_ge_e4_pl_g0_f09_scaled_sparse.py | 2 +- ...robe_b3_ge_e4_pl_g0_f12_b2_dynamic_mass.py | 8 +- ...e_b3_ge_e4_pl_g0_f12_b2_dynamic_mass_v2.py | 4 +- ...e_b3_ge_e4_pl_g0_f12_b2_dynamic_mass_v3.py | 4 +- ...e_b3_ge_e4_pl_g0_f12_b2_dynamic_mass_v4.py | 4 +- ...obe_b3_ge_e4_pl_g0_f12_b2_mass_metadata.py | 6 +- .../probe_b3_ge_e4_pl_g0_f12_b2_rigid_mass.py | 4 +- scripts/probe_b3_ge_e4_pl_g0_footprint.py | 4 +- ...be_b3_ge_e4_pl_g0_footprint_distinction.py | 4 +- scripts/probe_b3_ge_e4_pl_g0_lifted_trace.py | 2 +- .../probe_b3_ge_e4_pl_g0_lifted_trace_v2.py | 2 +- ...be_b3_ge_e4_pl_g0_local_sparse_deformed.py | 6 +- .../probe_b3_ge_e4_pl_g0_local_sparse_seam.py | 12 +- ...obe_b3_ge_e4_pl_g0_local_sparse_seam_v2.py | 2 +- scripts/probe_b3_ge_e4_pl_g0_physical_line.py | 8 +- ...be_b3_ge_e4_pl_g0_physical_line_offgrid.py | 4 +- .../probe_b3_ge_e4_pl_g0_plastic_pullback.py | 10 +- .../probe_b3_ge_e4_pl_g0_pose_footprint.py | 4 +- .../probe_b3_ge_e4_pl_g0_pose_footprint_v2.py | 2 +- .../probe_b3_ge_e4_pl_g0_rigid_footprint.py | 2 +- scripts/probe_b3_ge_e4_pl_g0_scalar_mortar.py | 2 +- .../probe_b3_ge_e4_pl_g0_vector_station.py | 8 +- scripts/profile_nonlinear_representative.py | 12 +- ...lify_general_contact_d1_clipped_coupled.py | 10 +- ...alify_general_contact_d1_linear_coupled.py | 10 +- scripts/qualify_nonlinear_representative.py | 34 +- scripts/qualify_nonlinear_static_revisions.py | 16 +- scripts/qualify_s3_angles.py | 44 +- scripts/r8_b2_assembly_metrics_dev.py | 10 +- scripts/r8_b2_assembly_series_dev.py | 8 +- scripts/r8_b2_assembly_series_v2_dev.py | 14 +- scripts/r8_b2_assembly_series_v3_dev.py | 16 +- scripts/r8_b2_assembly_series_v4_dev.py | 16 +- scripts/r8_b2_assembly_series_v5_dev.py | 16 +- scripts/r8_b2_assembly_series_v6_dev.py | 16 +- scripts/r8_b2_assembly_series_v7_dev.py | 10 +- scripts/r8_b2_assembly_series_v8_dev.py | 10 +- scripts/r8_b2_assembly_series_v9_dev.py | 10 +- scripts/r8_b2_attachment_elimination_dev.py | 36 +- scripts/r8_b2_coo_scratch_cleanup_dev.py | 10 +- scripts/r8_b2_g5_readiness_dev.py | 10 +- .../r8_b2_installed_batch_persistence_dev.py | 16 +- .../r8_b2_installed_original_target_dev.py | 20 +- scripts/r8_b2_original_operator_dev.py | 12 +- scripts/r8_b2_physical_work_unblock_dev.py | 18 +- scripts/r8_b2_q4_lifetime_dev.py | 10 +- scripts/r8_b2_remaining_scale_dev.py | 6 +- scripts/r8_b2_s3_physical_footprint_dev.py | 6 +- scripts/r8_bl5_affine_flexible_native_dev.py | 16 +- scripts/r8_bl5_affine_support_screen_dev.py | 6 +- scripts/r8_bl5_body_port_probe.py | 4 +- scripts/r8_bl5_c1_common_end_load_work_dev.py | 8 +- scripts/r8_bl5_c1_interval_transfer_dev.py | 6 +- .../r8_bl5_c1_native_solid_common_work_dev.py | 12 +- scripts/r8_bl5_c1_offratio_native_dev.py | 10 +- .../r8_bl5_c1_solid_p0_counterfactual_dev.py | 8 +- scripts/r8_bl5_c2_signed_kkt_dev.py | 10 +- .../r8_bl5_ccx_native_fy_mx_compare_dev.py | 8 +- scripts/r8_bl5_ccx_weak_p0_run_dev.py | 2 +- scripts/r8_bl5_density_reference_dev.py | 2 +- scripts/r8_bl5_envelope_gram_dev.py | 2 +- .../r8_bl5_external_affine_reference_dev.py | 2 +- scripts/r8_bl5_matched_native_reference.py | 10 +- scripts/r8_bl5_mx_beam_body_dev.py | 6 +- scripts/r8_bl5_mx_beam_interface_dev.py | 6 +- .../r8_bl5_mx_coupled_body_refinement_dev.py | 6 +- .../r8_bl5_mx_coupled_shell_refinement_dev.py | 6 +- .../r8_bl5_mx_interface_aggregation_dev.py | 6 +- scripts/r8_bl5_mx_local_transfer_dev.py | 6 +- scripts/r8_bl5_mx_matched_refinement_dev.py | 8 +- scripts/r8_bl5_mx_section_port_dev.py | 6 +- scripts/r8_bl5_mx_shell_axial_dev.py | 6 +- scripts/r8_bl5_mx_shell_thickness_dev.py | 6 +- scripts/r8_bl5_mx_shell_transverse_dev.py | 6 +- scripts/r8_bl5_mx_torsion_refinement_dev.py | 6 +- scripts/r8_bl5_mz_common_beam_action_dev.py | 4 +- scripts/r8_bl5_mz_work_matched_dev.py | 4 +- scripts/r8_bl5_native_p1_contrast_dev.py | 8 +- .../r8_bl5_nested_projected_external_dev.py | 2 +- scripts/r8_bl5_nested_projected_kernel_dev.py | 8 +- scripts/r8_bl5_nested_projected_owner_dev.py | 14 +- scripts/r8_bl5_nodal_port_and_warping_dev.py | 8 +- scripts/r8_bl5_projected_density_patch_dev.py | 8 +- scripts/r8_bl5_projected_envelope_norm_dev.py | 2 +- .../r8_bl5_projected_envelope_owner_dev.py | 8 +- .../r8_bl5_projected_joint_external_dev.py | 2 +- scripts/r8_bl5_projected_joint_kernel_dev.py | 10 +- scripts/r8_bl5_projected_joint_norm_dev.py | 4 +- scripts/r8_bl5_projected_joint_owner_dev.py | 20 +- scripts/r8_bl5_projected_mixed_system_dev.py | 6 +- scripts/r8_bl5_projected_native_beta_dev.py | 14 +- scripts/r8_bl5_projected_physical_dual_dev.py | 8 +- .../r8_bl5_projected_ratio_external_dev.py | 2 +- scripts/r8_bl5_projected_ratio_kernel_dev.py | 22 +- scripts/r8_bl5_projected_ratio_norm_dev.py | 10 +- scripts/r8_bl5_projected_ratio_owner_dev.py | 20 +- scripts/r8_bl5_rigid_carrier_dev.py | 10 +- scripts/r8_bl5_saved_local_transfer_dev.py | 8 +- scripts/r8_bl5_sparse_envelope_kernel_dev.py | 2 +- .../r8_bl5_stabilization_sensitivity_dev.py | 12 +- scripts/r8_bl5_strong_hinge_pair_dev.py | 6 +- scripts/r8_bl5_two_sided_port_response_dev.py | 4 +- .../r8_bl5_v11_cut_warping_response_dev.py | 8 +- .../r8_bl5_v12_retained_load_response_dev.py | 8 +- scripts/r8_bl5_weak_continuum_reference.py | 2 +- scripts/r8_e01_native_polar_work.py | 20 +- scripts/r8_e01_objective_polar_trace.py | 2 +- scripts/r8_e02_distributing_feasibility.py | 2 +- scripts/r8_e02_native_rigid_tip.py | 10 +- scripts/r8_e02_rigid_principal_current.py | 10 +- scripts/r8_e02_rigid_tip_thickness_run_dev.py | 2 +- scripts/r8_e02_rigid_torque_fields.py | 12 +- scripts/r8_e02_rigid_torque_refinement.py | 8 +- scripts/r8_e03_coarse_screen.py | 12 +- scripts/r8_e03_ge_distributing_work_bridge.py | 6 +- scripts/r8_e03_native_reference.py | 6 +- scripts/r8_e04_material_consumer.py | 10 +- scripts/r8_e04_native_roof.py | 6 +- scripts/r8_e04_restricted_membrane.py | 8 +- scripts/r8_f03_c2_current_owner_bridge_dev.py | 8 +- scripts/r8_f03_c2_signed_family_step_dev.py | 14 +- scripts/r8_f03_common_density_runner_dev.py | 2 +- ..._f03_current_family_physical_bridge_dev.py | 2 +- scripts/r8_f03_current_owner_parity_dev.py | 10 +- scripts/r8_f03_finite_runner_dev.py | 12 +- scripts/r8_f03_growing_dev.py | 4 +- scripts/r8_f03_growing_halfpoint_dev.py | 2 +- scripts/r8_f03_growing_runner_dev.py | 14 +- scripts/r8_f03_halfpoint_dev.py | 2 +- scripts/r8_f03_halfpoint_runner_dev.py | 14 +- .../r8_f03_physical_contract_controls_dev.py | 8 +- scripts/r8_f03_physical_contract_dev.py | 12 +- scripts/r8_f03_physical_interval_dev.py | 8 +- .../r8_f03_physical_interval_runner_dev.py | 14 +- scripts/r8_f03_sparse_signed_family_dev.py | 10 +- scripts/r8_f03_supported_work_dev.py | 6 +- .../r8_f03_supported_work_supervise_dev.py | 4 +- scripts/r8_f06_active_chart_dev.py | 14 +- scripts/r8_f06_adaptive_material_dev.py | 6 +- scripts/r8_f06_cell_moment_check_dev.py | 2 +- scripts/r8_f06_compensated_state_check_dev.py | 10 +- ...sated_state_checkpoint_repair_check_dev.py | 12 +- scripts/r8_f06_compensated_state_route_dev.py | 10 +- scripts/r8_f06_coupled_direction_dev.py | 2 +- scripts/r8_f06_coupled_history_unblock_dev.py | 2 +- scripts/r8_f06_coupled_resume_dev.py | 2 +- scripts/r8_f06_coupled_staged_dev.py | 2 +- scripts/r8_f06_cyclic_material_dev.py | 4 +- scripts/r8_f06_direction_fallback_dev.py | 2 +- scripts/r8_f06_fibre_log_domain_dev.py | 20 +- scripts/r8_f06_log_domain_check_dev.py | 12 +- scripts/r8_f06_log_domain_route_dev.py | 34 +- scripts/r8_f06_mixed_adaptive_dev.py | 2 +- scripts/r8_f06_native_material_breadth_dev.py | 20 +- scripts/r8_f06_paired_active_tangent_dev.py | 18 +- .../r8_f06_paired_branch_assessment_dev.py | 2 +- .../r8_f06_paired_branch_assessment_v2_dev.py | 2 +- scripts/r8_f06_paired_branch_domain_dev.py | 10 +- scripts/r8_f06_paired_displacement_dev.py | 2 +- scripts/r8_f06_paired_role_assessment_dev.py | 4 +- scripts/r8_f06_pending_direction_dev.py | 2 +- scripts/r8_f06_pending_resume_dev.py | 2 +- scripts/r8_f07_block_descriptor_dev.py | 8 +- scripts/r8_f07_public_descriptor_dev.py | 10 +- scripts/r8_f13_dependency_repair_dev.py | 10 +- scripts/r8_f13_static_feasibility.py | 10 +- scripts/r8_ge_coupled_cycle_dev.py | 8 +- scripts/r8_ge_line_buckling_dev.py | 10 +- ...r8_ge_merit_interpolation_candidate_dev.py | 4 +- ...r8_ge_merit_interpolation_execution_dev.py | 4 +- scripts/r8_ge_mixed_buckling_dev.py | 8 +- scripts/r8_ge_paired_adaptive_dev.py | 10 +- scripts/r8_ge_paired_fixed_diagnostic_dev.py | 4 +- scripts/r8_ge_paired_trial_derivative_dev.py | 4 +- scripts/r8_ge_point_buckling_dev.py | 10 +- scripts/r8_ge_saved_compliance_dev.py | 2 +- scripts/r8_q4_us3_modal_compare_dev.py | 22 +- scripts/run_b3_e4_ccx_3d_knot_mx_dev.py | 2 +- ...run_b3_ge_e4_pl_g0_f03_banded_moment_v1.py | 8 +- ...run_b3_ge_e4_pl_g0_f03_banded_moment_v2.py | 8 +- ...run_b3_ge_e4_pl_g0_f03_banded_moment_v3.py | 8 +- scripts/run_b3_ge_e4_pl_g0_f03_k0.py | 32 +- ..._b3_ge_e4_pl_g0_f03_local_trace_norm_v1.py | 4 +- ...n_b3_ge_e4_pl_g0_f03_resolved_sparse_v5.py | 2 +- ...n_b3_ge_e4_pl_g0_f03_shell_port_lift_v1.py | 8 +- .../run_b3_ge_e4_pl_g0_f03_signed_graph_v1.py | 12 +- ..._b3_ge_e4_pl_g0_f03_variational_line_v1.py | 4 +- ..._e4_pl_g0_f03_variational_refinement_v2.py | 6 +- scripts/run_beam_shell_verification.py | 2 +- scripts/run_beam_validity.py | 2 +- scripts/run_buckling_validity.py | 2 +- scripts/run_capacity_workflow.py | 8 +- scripts/run_cylinder_benchmark.py | 2 +- scripts/run_e4_pl_burnin_gate.py | 40 +- scripts/run_element_qualification.py | 2 +- scripts/run_external_references.py | 2 +- scripts/run_fe_benchmarks.py | 2 +- scripts/run_fe_verification.py | 4 +- scripts/run_ge_beam3_g1.py | 2 +- scripts/run_ge_beam3_g2.py | 2 +- scripts/run_ge_beam3_g3a.py | 2 +- scripts/run_ge_beam3_g3b.py | 2 +- scripts/run_ge_beam3_g3c_history.py | 4 +- scripts/run_ge_beam3_g3c_local.py | 2 +- scripts/run_ge_beam3_g3c_local_shell.py | 2 +- scripts/run_ge_beam3_g3c_owner_bridge.py | 2 +- scripts/run_ge_beam3_g3c_rehearsal.py | 4 +- .../run_ge_beam3_g3c_rehearsal_consumer.py | 4 +- scripts/run_ge_beam3_g3c_so3_numerics.py | 2 +- scripts/run_ge_beam3_g3c_stable.py | 8 +- scripts/run_ge_beam3_g5_package.py | 28 +- scripts/run_ge_beam3_g6_confirmation.py | 2 +- scripts/run_ge_beam3_g6_package.py | 12 +- scripts/run_ge_beam3_qualification.py | 78 +- .../run_general_contact_c1_patch_candidate.py | 6 +- scripts/run_internal_shell_benchmark.py | 2 +- scripts/run_mass_modal_validity.py | 4 +- scripts/run_mesh_load_bc_verification.py | 2 +- scripts/run_plasticity_qualification.py | 2 +- scripts/run_portable_ci.py | 4 +- scripts/run_recovery_policy.py | 2 +- scripts/run_s4_improved_qualification.py | 6 +- scripts/run_s4_validity.py | 2 +- scripts/run_sestra_deep_diagnostics.py | 4 +- scripts/run_sestra_structure_benchmarks.py | 2 +- scripts/run_sestra_three_cases.py | 4 +- scripts/run_sestra_verification.py | 2 +- scripts/supervise_b3_ge_e4_pl_g0_f06_v4.py | 52 +- scripts/verify_release_050.py | 637 + scripts/verify_release_runtime.py | 16 +- scripts/verify_sol_ultra_numerics.py | 132 +- scripts/write_production_readiness.py | 2 +- setup.py | 14 +- src/{anysolver => anyfesolver}/__init__.py | 4 +- .../_b2_attachment_elimination_dev.py | 0 .../_b2_f10_f11_point_attachment.py | 0 .../_b2_loaded_point_trace_dev.py | 0 .../_b2_physical_flexibility_linear.py | 0 .../_b2_physical_linear_batch_dev.py | 0 .../_b2_physical_linear_definition.py | 0 .../_b2_physical_load_bubbles.py | 0 .../_compensated_contractions.py | 994 +- .../_compensated_native.py | 0 .../_corotational_batch.py | 0 .../_director_trace.py | 0 .../_dyadic_bilinear.py | 0 .../_dyadic_factor_chain.py | 0 .../_ge_beam3_adaptive_arc_program.py | 18 +- .../_ge_beam3_analysis_combined.py | 0 .../_ge_beam3_analysis_fibre_translation.py | 0 .../_ge_beam3_analysis_modal_snapshot.py | 0 .../_ge_beam3_analysis_nodal_program.py | 0 .../_ge_beam3_analysis_translation.py | 0 .../_ge_beam3_analysis_translation_modal.py | 0 .../_ge_beam3_arc_geometry.py | 2 +- .../_ge_beam3_arc_program.py | 28 +- .../_ge_beam3_authoritative_cell_seed.py | 0 .../_ge_beam3_cell_identity.py | 0 ...e_beam3_centered_batched_finite_inertia.py | 0 .../_ge_beam3_centered_finite_inertia.py | 0 .../_ge_beam3_centered_mixed.py | 18 +- .../_ge_beam3_centered_reference.py | 4 +- .../_ge_beam3_centered_so3_strain.py | 0 .../_ge_beam3_complementary_section.py | 10 +- .../_ge_beam3_compliance_snapshot_guard.py | 0 .../_ge_beam3_connected_dynamic.py | 0 .../_ge_beam3_connected_trajectory.py | 0 .../_ge_beam3_conservative_backtrack.py | 0 .../_ge_beam3_controlled_fibre_modes.py | 0 .../_ge_beam3_coupled_beam_subdomain.py | 0 .../_ge_beam3_coupled_modes.py | 0 .../_ge_beam3_deterministic_reduction.py | 0 .../_ge_beam3_displacement_program.py | 22 +- .../_ge_beam3_durable_coupled.py | 0 .../_ge_beam3_dynamic_elastic_state.py | 796 +- .../_ge_beam3_effective_deadline.py | 0 .../_ge_beam3_elastic_seed_continuation.py | 0 .../_ge_beam3_elastic_seed_modal.py | 0 .../_ge_beam3_equilibrium_line_program.py | 0 .../_ge_beam3_equilibrium_schur_solver.py | 0 .../_ge_beam3_factor_chain_modes.py | 0 .../_ge_beam3_fibre_cell.py | 492 +- .../_ge_beam3_fibre_distributed_couples.py | 0 .../_ge_beam3_fibre_kinematic_cell.py | 0 .../_ge_beam3_fibre_line_program.py | 0 .../_ge_beam3_fibre_line_work.py | 0 .../_ge_beam3_fibre_reference_modal.py | 0 .../_ge_beam3_fibre_schur_solver.py | 2 +- .../_ge_beam3_fibre_section.py | 0 .../_ge_beam3_fibre_static_boundary.py | 0 .../_ge_beam3_g1_analysis.py | 0 .../_ge_beam3_g1_elastic.py | 0 .../_ge_beam3_g1_element.py | 0 .../_ge_beam3_g1_operator.py | 0 .../_ge_beam3_g2_analysis.py | 0 .../_ge_beam3_g2_constraints.py | 0 .../_ge_beam3_g3_analysis.py | 0 .../_ge_beam3_g3_constraints.py | 0 .../_ge_beam3_g3b_owner.py | 0 .../_ge_beam3_g3b_q4_reference.py | 0 .../_ge_beam3_g3b_reference.py | 0 .../_ge_beam3_g3b_result_schema.py | 0 .../_ge_beam3_g3b_s3_reference.py | 0 .../_ge_beam3_g3b_weighted_reference.py | 0 .../_ge_beam3_g3c_affine_q4_chart.py | 0 ..._ge_beam3_g3c_affine_q4_increment_chart.py | 0 .../_ge_beam3_g3c_affine_q4_recovery.py | 0 .../_ge_beam3_g3c_affine_q4_registry.py | 0 .../_ge_beam3_g3c_b2_physical.py | 0 .../_ge_beam3_g3c_b2_physical_adapter.py | 0 .../_ge_beam3_g3c_definition.py | 0 .../_ge_beam3_g3c_local_beam.py | 0 .../_ge_beam3_g3c_local_shell.py | 0 .../_ge_beam3_g3c_owner.py | 0 .../_ge_beam3_g3c_physical_authority.py | 36 +- .../_ge_beam3_g3c_physical_owner.py | 64 +- .../_ge_beam3_g3c_recovery.py | 0 .../_ge_beam3_g3c_so3_numerics.py | 0 .../_ge_beam3_g3c_stable/__init__.py | 0 .../_ge_beam3_g3c_stable/authority.py | 14 +- .../_ge_beam3_g3c_stable/beam.py | 28 +- .../_ge_beam3_g3c_stable/boundary.py | 8 +- .../_ge_beam3_g3c_stable/chart.py | 6 +- .../_ge_beam3_g3c_stable/compensated.py | 6 +- .../_ge_beam3_g3c_stable/element.py | 20 +- .../_ge_beam3_g3c_stable/fit.py | 2 +- .../_ge_beam3_g3c_stable/joint.py | 22 +- .../_ge_beam3_g3c_stable/line_work.py | 22 +- .../_ge_beam3_g3c_stable/operator.py | 40 +- .../_ge_beam3_g3c_stable/owner.py | 58 +- .../_ge_beam3_g3c_stable/shell.py | 26 +- .../_ge_beam3_g4_completion.py | 0 .../_ge_beam3_g4a_station_transaction.py | 0 .../_ge_beam3_g5_completion.py | 0 .../_ge_beam3_g6_domain.py | 0 .../_ge_beam3_generalized_cell.py | 0 ..._ge_beam3_generalized_ellipsoid_section.py | 0 .../_ge_beam3_generalized_static_boundary.py | 0 .../_ge_beam3_lifted_kinetic_factor.py | 0 .../_ge_beam3_line_fibre_modes.py | 0 .../_ge_beam3_load_program.py | 22 +- .../_ge_beam3_loaded_modal.py | 22 +- .../_ge_beam3_mixed_ad.py | 0 .../_ge_beam3_native_analysis.py | 0 .../_ge_beam3_native_arc.py | 0 .../_ge_beam3_native_arc_adaptive.py | 0 .../_ge_beam3_native_arc_restart.py | 0 .../_ge_beam3_native_arc_source.py | 0 .../_ge_beam3_native_buckling.py | 0 .../_ge_beam3_native_combined_couples.py | 0 .../_ge_beam3_native_combined_restart.py | 0 .../_ge_beam3_native_definition.py | 0 .../_ge_beam3_native_distributed_element.py | 0 .../_ge_beam3_native_distributed_loading.py | 0 .../_ge_beam3_native_distributed_program.py | 0 .../_ge_beam3_native_distributed_recovery.py | 0 .../_ge_beam3_native_distributed_restart.py | 0 .../_ge_beam3_native_dynamic_analysis.py | 0 .../_ge_beam3_native_dynamic_restart.py | 6 +- .../_ge_beam3_native_fibre_current_modal.py | 0 .../_ge_beam3_native_fibre_recovery.py | 0 .../_ge_beam3_native_fibre_restart.py | 0 .../_ge_beam3_native_fibre_static_element.py | 382 +- .../_ge_beam3_native_force_adaptation.py | 0 ...am3_native_generalized_combined_couples.py | 0 ...am3_native_generalized_combined_restart.py | 0 .../_ge_beam3_native_generalized_element.py | 0 ...e_beam3_native_generalized_factor_modal.py | 0 .../_ge_beam3_native_generalized_loading.py | 0 .../_ge_beam3_native_generalized_modal.py | 0 ...e_beam3_native_generalized_paired_modal.py | 0 .../_ge_beam3_native_generalized_parameter.py | 0 .../_ge_beam3_native_generalized_program.py | 0 .../_ge_beam3_native_generalized_recovery.py | 0 .../_ge_beam3_native_generalized_restart.py | 0 .../_ge_beam3_native_history_profile.py | 0 .../_ge_beam3_native_line_loading.py | 0 .../_ge_beam3_native_line_program.py | 0 .../_ge_beam3_native_line_recovery.py | 0 .../_ge_beam3_native_line_restart.py | 0 .../_ge_beam3_native_line_static_element.py | 0 .../_ge_beam3_native_load_admission.py | 0 .../_ge_beam3_native_midpoint.py | 842 +- .../_ge_beam3_native_multi_shell_contact.py | 0 .../_ge_beam3_native_pair_contact.py | 0 .../_ge_beam3_native_shell_contact.py | 0 .../_ge_beam3_native_spatial_couples.py | 0 .../_ge_beam3_native_spatial_restart.py | 0 .../_ge_beam3_native_transient.py | 0 .../_ge_beam3_native_translation.py | 0 .../_ge_beam3_native_translation_restart.py | 0 .../_ge_beam3_operator_validation_scope.py | 0 .../_ge_beam3_p5/__init__.py | 0 .../_ge_beam3_p5/algebra.py | 0 .../_ge_beam3_p5/arrays.py | 0 .../_ge_beam3_p5/chart.py | 2 +- .../_ge_beam3_p5/codec.py | 4 +- .../_ge_beam3_p5/committed_modal.py | 18 +- .../_ge_beam3_p5/compensated.py | 10 +- .../_ge_beam3_p5/compensated_coordinates.py | 0 .../_ge_beam3_p5/core.py | 4 +- .../_ge_beam3_p5/element.py | 12 +- .../_ge_beam3_p5/factors.py | 0 .../_ge_beam3_p5/inertia.py | 4 +- .../_ge_beam3_p5/mass.py | 0 .../_ge_beam3_p5/mixed.py | 12 +- .../_ge_beam3_p5/reference_modal.py | 12 +- .../_ge_beam3_p5/section.py | 0 .../_ge_beam3_p5/typed_schema.py | 0 .../_ge_beam3_p5_centered/__init__.py | 2 +- .../_ge_beam3_p5_centered/codec.py | 4 +- .../_ge_beam3_p5_centered/committed_modal.py | 16 +- .../_ge_beam3_p5_centered/core.py | 14 +- .../_ge_beam3_p5_centered/element.py | 12 +- .../_ge_beam3_p5_centered/mass.py | 10 +- .../_ge_beam3_p5_centered/positions.py | 6 +- .../_ge_beam3_p5_centered/reference_modal.py | 10 +- .../_ge_beam3_p5_coordinates/__init__.py | 2 +- .../_ge_beam3_p5_coordinates/codec.py | 4 +- .../committed_modal.py | 16 +- .../_ge_beam3_p5_coordinates/core.py | 12 +- .../_ge_beam3_p5_coordinates/element.py | 12 +- .../_ge_beam3_p5_coordinates/positions.py | 6 +- .../reference_modal.py | 12 +- .../_ge_beam3_p5_loads/__init__.py | 2 +- .../_ge_beam3_p5_loads/codec.py | 4 +- .../_ge_beam3_p5_loads/core.py | 16 +- .../_ge_beam3_p5_loads/element.py | 16 +- .../_ge_beam3_p5_loads/state.py | 2 +- .../_ge_beam3_p5_loads/work.py | 8 +- .../_ge_beam3_p5_seeded/__init__.py | 2 +- .../_ge_beam3_p5_seeded/codec.py | 4 +- .../_ge_beam3_p5_seeded/core.py | 18 +- .../_ge_beam3_p5_seeded/element.py | 16 +- .../_ge_beam3_p5_seeded/state.py | 2 +- .../_ge_beam3_p5_seeded/work.py | 8 +- .../_ge_beam3_pose_joint.py | 0 .../_ge_beam3_precise_geometric_work.py | 0 .../_ge_beam3_reassembled_signed_modes.py | 0 .../_ge_beam3_reference_identity.py | 0 .../_ge_beam3_refined_fibre_schur_solver.py | 0 .../_ge_beam3_refinement_capacity.py | 0 ...e_beam3_relative_virgin_reference_modes.py | 0 .../_ge_beam3_retained_arc.py | 0 .../_ge_beam3_retained_arc_geometry.py | 0 .../_ge_beam3_retained_arc_modal.py | 0 .../_ge_beam3_retained_elastic.py | 12 +- .../_ge_beam3_retained_fibre.py | 274 +- .../_ge_beam3_retained_fibre_control.py | 0 .../_ge_beam3_retained_fibre_element.py | 0 .../_ge_beam3_retained_fibre_modal.py | 0 .../_ge_beam3_retained_fibre_modes.py | 0 .../_ge_beam3_retained_fibre_program.py | 0 .../_ge_beam3_retained_fibre_state.py | 0 .../_ge_beam3_retained_force_program.py | 6 +- .../_ge_beam3_retained_generalized.py | 0 .../_ge_beam3_retained_generalized_modal.py | 0 .../_ge_beam3_retained_generalized_program.py | 0 .../_ge_beam3_retained_generalized_state.py | 0 .../_ge_beam3_retained_nodal_loading.py | 0 .../_ge_beam3_retained_plastic.py | 20 +- .../_ge_beam3_retained_plastic_modes.py | 14 +- .../_ge_beam3_retained_plastic_program.py | 6 +- .../_ge_beam3_retained_plastic_state.py | 12 +- .../_ge_beam3_retained_state.py | 16 +- .../_ge_beam3_retained_translation_control.py | 0 .../_ge_beam3_retained_translation_modal.py | 0 .../_ge_beam3_schur_line_program.py | 0 .../_ge_beam3_seeded_fibre_control.py | 0 .../_ge_beam3_seeded_load_program.py | 24 +- .../_ge_beam3_seeded_loaded_modal.py | 22 +- .../_ge_beam3_seeded_signed_modes.py | 8 +- .../_ge_beam3_shared_kinematic_split.py | 8 +- .../_ge_beam3_shell_joint_state.py | 0 .../_ge_beam3_shell_joint_trial.py | 0 .../_ge_beam3_signed_loaded_modes.py | 8 +- .../_ge_beam3_spatial_fibre_program.py | 0 .../_ge_beam3_spatial_nodal_moments.py | 0 .../_ge_beam3_station_resultant_cell.py | 0 .../_ge_beam3_variational_shell.py | 356 +- .../_ge_beam3_virgin_reference_modes.py | 0 .../_impact_coupling.py | 0 .../_native_authority_dag.py | 0 .../_native_dyadic_interval_inertia.py | 0 .../_native_exact_shift_chain_modes.py | 0 .../_native_exact_shift_inertia.py | 0 .../_native_factor_chain_modes.py | 8 +- .../_native_guard.cpp | 21 +- .../_native_guard_dispatch.py | 8 +- .../_native_large_factor_chain.py | 0 .../_native_material_protocol.py | 0 .../_native_midpoint_controller.py | 0 .../_native_modal_capacity.py | 0 .../_native_paired_factor_chain_modes.py | 8 +- .../_native_reassembled_factor_modes.py | 8 +- .../_native_reference_factor_spectrum.py | 0 .../_native_reference_modal.py | 0 .../_native_relative_factor_chain_modes.py | 8 +- ...tive_relative_reference_factor_spectrum.py | 0 .../_native_retained_step.py | 0 .../_native_rotation_state.py | 2 +- .../_native_signed_factor_modes.py | 0 .../_native_signed_kinetic_factor_modes.py | 0 .../_native_stationary_spectrum.py | 0 .../_nonlinear_events.py | 0 .../_nonlinear_seed.py | 0 .../_paired_modal_arithmetic.py | 0 .../_plate_stability_continuation.py | 0 .../_q4_assumed_strain_plasticity.py | 0 .../_qualified_authority_epoch.py | 0 .../_relative_reference_svd.py | 0 .../_stiffened_shell_affine_endpoint.py | 0 .../_stiffened_shell_algorithmic_pullback.py | 60 +- .../_stiffened_shell_arc_checkpoint.py | 336 +- .../_stiffened_shell_arc_control.py | 180 +- .../_stiffened_shell_arc_metric.py | 0 .../_stiffened_shell_arc_publication.py | 188 +- .../_stiffened_shell_arc_trial.py | 510 +- .../_stiffened_shell_b2_affine_resolution.py | 0 ...stiffened_shell_b2_assembly_diagnostics.py | 30 +- ...stiffened_shell_b2_definition_ownership.py | 0 .../_stiffened_shell_b2_experimental.py | 0 .../_stiffened_shell_b2_nodal_footprint.py | 0 ...fened_shell_b2_physical_rigid_footprint.py | 392 +- ...tiffened_shell_b2_q4_panel_experimental.py | 4516 +++--- ...tiffened_shell_b2_q4_point_experimental.py | 0 .../_stiffened_shell_b2_reference_buckling.py | 824 +- .../_stiffened_shell_b3_chart.py | 0 .../_stiffened_shell_b3_local_adapter.py | 0 .../_stiffened_shell_beam_history.py | 178 +- ..._stiffened_shell_bl5_local_experimental.py | 0 .../_stiffened_shell_bl5_native_elastic.py | 0 .../_stiffened_shell_branch_event_trial.py | 0 .../_stiffened_shell_consumer_capabilities.py | 0 .../_stiffened_shell_coordinate_support.py | 0 .../_stiffened_shell_displacement_adaptive.py | 0 ...stiffened_shell_displacement_checkpoint.py | 0 .../_stiffened_shell_displacement_control.py | 0 ..._stiffened_shell_displacement_corrector.py | 0 ..._stiffened_shell_displacement_increment.py | 0 ..._stiffened_shell_distributing_footprint.py | 0 .../_stiffened_shell_distributing_pose.py | 0 ...tiffened_shell_f06_increment_arithmetic.py | 410 +- .../_stiffened_shell_ge_body_load.py | 0 .../_stiffened_shell_ge_checkpoint_binary.py | 14 +- .../_stiffened_shell_ge_distributed_load.py | 414 +- ...tiffened_shell_ge_distributed_programme.py | 0 ..._stiffened_shell_ge_distributing_finite.py | 464 +- ...iffened_shell_ge_distributing_reference.py | 0 .../_stiffened_shell_ge_experimental.py | 0 ..._stiffened_shell_ge_finite_experimental.py | 0 .../_stiffened_shell_ge_mixed_modal_mass.py | 0 .../_stiffened_shell_ge_point_buckling.py | 0 .../_stiffened_shell_ge_pressure_load.py | 270 +- .../_stiffened_shell_ge_reference_modal.py | 950 +- .../_stiffened_shell_generalized_recovery.py | 0 .../_stiffened_shell_increment_control.py | 374 +- ...tiffened_shell_l1_assembly_experimental.py | 0 .../_stiffened_shell_l1_local_experimental.py | 0 ...ed_shell_l1_supported_work_experimental.py | 0 ...stiffened_shell_native_distributed_load.py | 0 .../_stiffened_shell_native_gravity.py | 0 .../_stiffened_shell_nodal_footprint.py | 0 .../_stiffened_shell_physical_q4_mass.py | 0 .../_stiffened_shell_physical_s3_mass.py | 0 .../_stiffened_shell_point_recovery.py | 0 ...stiffened_shell_q4_algorithmic_pullback.py | 176 +- .../_stiffened_shell_q4_material_event.py | 228 +- .../_stiffened_shell_q4_reference.py | 0 .../_stiffened_shell_rotation_charts.py | 0 ...stiffened_shell_s3_algorithmic_pullback.py | 96 +- ...tiffened_shell_s3_conservative_buckling.py | 0 ..._stiffened_shell_s3_dead_work_candidate.py | 0 .../_stiffened_shell_s3_material_event.py | 0 .../_stiffened_shell_same_parent_trial.py | 2 +- .../_stiffened_shell_selected_recovery.py | 0 ...tiffened_shell_staged_load_experimental.py | 624 +- .../_stiffened_shell_stress_free_reference.py | 0 src/anyfesolver/_wire_types.py | 17 + src/{anysolver => anyfesolver}/activity.py | 0 .../algebraic_dynamics.py | 0 .../analysis_session.py | 2 +- .../anystructure_fem_mode.py | 8 +- src/{anysolver => anyfesolver}/arc_length.py | 6 +- src/{anysolver => anyfesolver}/assembly.py | 4 +- src/{anysolver => anyfesolver}/b3_ge.py | 0 src/{anysolver => anyfesolver}/baselines.py | 0 .../beam_sections.py | 0 .../beam_shell_verification.py | 14 +- .../beam_validity.py | 0 src/{anysolver => anyfesolver}/benchmarks.py | 0 src/{anysolver => anyfesolver}/boundary.py | 8 +- src/{anysolver => anyfesolver}/buckling.py | 4 +- .../buckling_validity.py | 0 .../capacity_workflow.py | 0 .../capsule_runtime_guard.py | 10 +- src/{anysolver => anyfesolver}/cases.py | 0 .../composite_strip_verification.py | 0 .../concentrated_mass.py | 0 .../constraint_audit.py | 4 +- src/{anysolver => anyfesolver}/contact.py | 0 .../contact_performance.py | 2 +- src/{anysolver => anyfesolver}/control.py | 2 +- .../corotational.py | 0 .../corotational_performance.py | 0 .../current_state_tangent.py | 0 .../cylinder_benchmarks.py | 0 .../damage_matrix_performance.py | 0 src/{anysolver => anyfesolver}/dynamics.py | 0 .../e4_pl_element.py | 4 +- .../e4_pl_enriched.py | 0 .../e4_pl_enriched_nonlinear.py | 0 .../e4_pl_s3_element.py | 2 +- .../e4_pl_s3_initial_fields.py | 2 +- .../e4_pl_s3_state.py | 0 .../e4_pl_s3_v2_element.py | 0 .../e4_pl_s3_v2b_element.py | 0 .../e4_pl_s3_v2c_element.py | 0 .../e4_pl_s3_v2d_element.py | 0 .../e4_pl_s3_v2d_state.py | 0 .../element_capabilities.py | 0 .../element_qualification.py | 0 src/{anysolver => anyfesolver}/elements.py | 12454 ++++++++-------- .../experimental_csr_assembly.py | 2 +- .../external_references.py | 0 src/{anysolver => anyfesolver}/fe_core.py | 0 .../floating_pressure_regions.py | 0 .../floating_response.py | 0 .../floating_transient.py | 0 src/{anysolver => anyfesolver}/fracture.py | 0 .../ge_beam3_curved_reference.py | 2 +- .../ge_beam3_element.py | 2 +- .../ge_beam3_mixed_element.py | 0 .../ge_beam3_mixed_state.py | 0 .../ge_beam3_native.py | 0 .../ge_beam3_native_connected_dynamics.py | 0 .../ge_beam3_native_dynamics.py | 0 .../ge_beam3_state.py | 0 .../general_contact/__init__.py | 0 .../_enriched_multitarget_empty.py | 0 .../_enriched_multitarget_trial.py | 18 +- .../_results_archive_common.py | 2 +- .../general_contact/algebraic_path.py | 0 .../general_contact/arc_contact.py | 0 .../general_contact/arc_results_archive.py | 11 +- .../general_contact/augmentation.py | 0 .../general_contact/automatic_domain.py | 8 +- .../general_contact/beam_chain_consistent.py | 0 .../beam_chain_end_geometry.py | 0 .../general_contact/beam_chain_ends.py | 0 .../general_contact/beam_chain_pair.py | 2 +- .../beam_curve_end_geometry.py | 0 .../general_contact/beam_curve_ends.py | 0 .../general_contact/beam_curve_pair.py | 2 +- .../general_contact/beam_curve_pair_static.py | 2 +- .../beam_end_radial_geometry.py | 0 .../general_contact/beam_end_topology.py | 0 .../beam_hemisphere_coupled_tool.py | 0 .../beam_hemisphere_cylinder.py | 0 .../beam_hemisphere_cylinder_motion.py | 0 .../beam_hemisphere_cylinder_work.py | 2 +- .../general_contact/beam_hemisphere_plane.py | 0 .../beam_hemisphere_s3_support.py | 2 +- .../general_contact/beam_hemisphere_sphere.py | 0 .../beam_hemisphere_sphere_work.py | 2 +- .../beam_hemisphere_support.py | 2 +- .../general_contact/beam_pair.py | 4 +- .../general_contact/beam_pair_end_geometry.py | 0 .../general_contact/beam_pair_ends.py | 4 +- .../general_contact/beam_plane.py | 2 +- .../general_contact/beam_radial.py | 0 .../general_contact/beam_radial_ends.py | 0 .../beam_s3_directional_rates.py | 0 .../beam_s3_rotational_transient.py | 0 .../general_contact/beam_s3_transient.py | 0 .../general_contact/beam_shell.py | 10 +- .../general_contact/beam_shell_patch.py | 6 +- .../general_contact/beam_temporal_bounds.py | 0 .../general_contact/capability.py | 0 .../general_contact/capped_cylinder.py | 0 .../general_contact/contact_search.py | 2 +- .../general_contact/core.py | 38 +- .../general_contact/curved_s3_q4_work.py | 0 .../general_contact/curved_shell_skin.py | 4 +- .../general_contact/d1_interior_profile.py | 2 +- .../deformable_beam_s3_caps.py | 0 .../deformable_beam_s3_line.py | 2 +- .../deformable_beam_s3_static.py | 0 .../general_contact/descriptor_rates.py | 0 .../enriched_cold_predictor.py | 2 +- .../general_contact/enriched_moment_batch.py | 0 .../general_contact/enriched_multitarget.py | 4 +- .../enriched_multitarget_gap.py | 2 +- .../enriched_multitarget_moments.py | 0 .../enriched_multitarget_topology.py | 0 .../general_contact/enriched_nonlinear.py | 20 +- .../general_contact/enriched_overlap.py | 6 +- .../general_contact/enriched_path.py | 8 +- .../general_contact/enriched_small_cut.py | 0 .../general_contact/enriched_static.py | 16 +- .../general_contact/enriched_union.py | 0 .../equilibrated_pressure_pivot.py | 4 +- .../general_contact/event_subdivision.py | 0 .../general_contact/finite_mixed_state.py | 10 +- .../general_contact/finite_rigid_patch.py | 2 +- .../general_contact/finite_rigid_support.py | 0 .../general_contact/finite_rigid_sweep.py | 0 .../finite_rotation_predictor.py | 2 +- .../general_contact/finite_rotation_skin.py | 0 .../general_contact/finite_rotation_state.py | 4 +- .../general_contact/finite_rotation_sweep.py | 0 .../general_contact/finite_v2d_state.py | 2 +- .../general_contact/fixed_projection_graph.py | 0 .../fixed_projection_s3_events.py | 0 .../general_contact/free_rigid.py | 0 .../general_contact/friction_point.py | 0 .../general_contact/gap_extrema.py | 0 .../guided_pair_transient_geometry.py | 0 .../general_contact/initial_contact_seed.py | 2 +- .../general_contact/linearized_pivot.py | 2 +- .../material_work_diagnostics.py | 0 .../general_contact/moment_batch_ad.py | 2 +- .../general_contact/moment_batch_points.py | 2 +- .../general_contact/moving.py | 0 .../general_contact/multiple_beam_rigid.py | 0 .../general_contact/multiple_beam_s3_caps.py | 0 .../multiple_beam_s3_transient.py | 6 +- .../multiple_projected_pairs.py | 0 .../general_contact/multiple_shell_planes.py | 2 +- .../native_activation_static.py | 4 +- .../native_checkpoint_results.py | 0 .../general_contact/native_curve_union.py | 2 +- .../general_contact/native_curved_geometry.py | 6 +- .../native_curved_pair_partition.py | 0 .../native_curved_plane_work.py | 6 +- .../general_contact/native_curved_s3_work.py | 10 +- .../native_event_polynomial.py | 0 .../general_contact/native_fibre_context.py | 26 +- .../general_contact/native_fibre_results.py | 6 +- .../general_contact/native_initial_guess.py | 4 +- .../native_material_activation.py | 2 +- .../general_contact/native_material_plane.py | 4 +- .../general_contact/native_material_s3.py | 2 +- .../general_contact/native_multi_s3_static.py | 20 +- .../general_contact/native_normal_angles.py | 0 .../native_pair_error_budget.py | 0 .../native_replay_arithmetic.py | 0 .../native_replay_diagnostics.py | 0 .../native_retained_body_junction.py | 0 .../native_retained_body_pair.py | 2 +- .../native_retained_body_projection.py | 0 .../native_retained_body_static.py | 4 +- .../native_retained_cell_pair.py | 4 +- .../native_retained_curve_cell.py | 8 +- .../native_retained_line_plane.py | 6 +- .../native_retained_line_s3.py | 4 +- .../native_retained_line_s3_work.py | 2 +- .../native_retained_pair_static.py | 16 +- .../native_retained_s3_static.py | 20 +- .../general_contact/native_retained_static.py | 18 +- .../native_retained_station.py | 8 +- .../native_retained_whole_pair.py | 6 +- .../general_contact/native_s3_swept.py | 0 .../native_shell_static_driver.py | 4 +- .../native_surface_activation.py | 4 +- .../general_contact/native_surface_bounds.py | 4 +- .../native_surface_contributor.py | 4 +- .../native_surface_crossing.py | 0 .../native_surface_event_sequence.py | 2 +- .../general_contact/native_surface_extrema.py | 0 .../native_surface_friction_integral.py | 2 +- .../general_contact/native_surface_front.py | 2 +- .../native_surface_front_boundary.py | 2 +- .../native_surface_front_precision.py | 0 .../native_surface_front_work.py | 0 .../general_contact/native_surface_history.py | 2 +- .../general_contact/native_surface_normal.py | 4 +- .../general_contact/native_surface_patch.py | 2 +- .../general_contact/native_surface_path.py | 6 +- .../native_surface_quadrature.py | 4 +- .../native_surface_s3_friction.py | 8 +- .../general_contact/native_surface_support.py | 2 +- .../native_surface_transaction.py | 6 +- .../native_transient_multi_shell.py | 10 +- .../general_contact/native_transient_pair.py | 6 +- .../general_contact/native_transient_shell.py | 6 +- .../general_contact/normal_s3_skin_path.py | 0 .../general_contact/overlap.py | 6 +- .../general_contact/pair.py | 8 +- .../general_contact/patch_broadphase.py | 0 .../general_contact/patch_mortar.py | 0 .../general_contact/patch_sliding.py | 2 +- .../general_contact/plane_newmark_events.py | 0 .../general_contact/pointwise_patch.py | 0 .../general_contact/polynomial_roots.py | 0 .../general_contact/pressure_basis.py | 0 .../general_contact/pressure_diagnostics.py | 2 +- .../general_contact/pressure_overlay.py | 0 .../general_contact/pressure_space.py | 0 .../general_contact/q4_material_checkpoint.py | 6 +- .../general_contact/q4_overlap_local_bound.py | 0 .../q4_q4_overlap_derivatives.py | 2 +- .../general_contact/q4_q4_swept_bound.py | 0 .../q4_s3_overlap_derivatives.py | 4 +- .../general_contact/q4_s3_tiny_wedge.py | 0 .../general_contact/q4_skin_work.py | 2 +- .../q4_source_mortar_energy.py | 0 .../general_contact/q4_source_overlap.py | 0 .../general_contact/q4_target_overlap.py | 0 .../general_contact/request_identity.py | 6 +- .../general_contact/rigid_translation.py | 0 .../general_contact/runtime.py | 2 +- .../s3_friction_chart_interval.py | 0 .../general_contact/s3_friction_coverage.py | 0 .../s3_friction_dyadic_interval.py | 0 .../s3_friction_history_path.py | 0 .../s3_friction_mesh_coverage.py | 0 .../general_contact/s3_friction_mesh_gap.py | 0 .../s3_friction_mesh_monolithic.py | 0 .../general_contact/s3_friction_monolithic.py | 0 .../s3_friction_moving_coverage.py | 0 .../general_contact/s3_friction_pair.py | 0 .../general_contact/s3_friction_point.py | 0 .../s3_friction_prepared_path.py | 0 .../general_contact/s3_friction_replay.py | 0 .../general_contact/s3_friction_rim_path.py | 0 .../s3_friction_rim_transaction.py | 0 .../general_contact/s3_friction_static.py | 0 .../general_contact/s3_friction_swept_gap.py | 0 .../general_contact/s3_friction_touch.py | 0 .../s3_friction_weak_pressure.py | 0 .../general_contact/s3_overlap_derivatives.py | 2 +- .../general_contact/s3_overlap_hermite_gap.py | 0 .../general_contact/s3_pair_static.py | 2 +- .../general_contact/s3_patch_augmented.py | 2 +- .../general_contact/s3_patch_mortar_energy.py | 0 .../general_contact/s3_patch_static.py | 10 +- .../s3_pressure_hermite_bounds.py | 0 .../s3_pressure_polygon_bounds.py | 0 .../general_contact/s3_q4_gap_resolution.py | 0 .../s3_q4_overlap_derivatives.py | 2 +- .../general_contact/s3_q4_swept.py | 0 .../general_contact/s3_skin_work.py | 2 +- .../general_contact/s3_sliding_friction.py | 0 .../general_contact/s3_stable_plane_gap.py | 4 +- .../seed_path_vertex_interval.py | 0 .../general_contact/semismooth.py | 0 .../general_contact/semismooth_block.py | 2 +- .../general_contact/semismooth_path.py | 8 +- .../shell_pair_hermite_sweep.py | 0 .../shell_sphere_temporal_bounds.py | 0 .../general_contact/skin_geometry.py | 0 .../general_contact/sliding.py | 2 +- .../general_contact/sphere.py | 6 +- .../general_contact/sphere_temporal_bounds.py | 0 .../general_contact/static_path.py | 20 +- .../general_contact/static_results_archive.py | 9 +- .../structural_state_bridge.py | 6 +- .../general_contact/supported_schur.py | 0 .../general_contact/swept_patch_broadphase.py | 0 .../general_contact/transient.py | 24 +- .../transient_results_archive.py | 9 +- .../general_contact/triangle_mortar_energy.py | 0 .../general_contact/triangle_pair_energy.py | 0 .../general_contact/triangulated_rigid.py | 0 .../triangulated_rigid_static.py | 2 +- .../general_contact/warped_q4_plane.py | 0 .../general_contact/warped_q4_skin.py | 2 +- .../general_contact/warped_q4_static.py | 4 +- .../impact_performance.py | 0 .../impact_reduced_assembly.py | 0 .../imperfections.py | 0 .../inertia_relief.py | 0 .../initial_field_state.py | 0 .../jit_compiler.py | 0 .../kernel_warmup.py | 0 src/{anysolver => anyfesolver}/linalg.py | 0 .../marine_contributions.py | 10 +- .../marine_coupled_equilibrium.py | 0 .../marine_equilibrium.py | 0 .../marine_hydro_coordinates.py | 2 +- .../marine_linear.py | 4 +- src/{anysolver => anyfesolver}/marine_link.py | 2 +- .../marine_mechanical.py | 22 +- .../marine_mooring.py | 0 .../marine_morison.py | 0 .../marine_potential_flow.py | 6 +- .../marine_rigid.py | 0 .../marine_seabed.py | 0 .../mass_properties.py | 0 .../material_curves.py | 0 src/{anysolver => anyfesolver}/materials.py | 4 +- .../matrix_assembly.py | 2 +- src/{anysolver => anyfesolver}/mesh_gen.py | 2 +- .../mesh_load_bc_verification.py | 2 +- src/{anysolver => anyfesolver}/modal.py | 0 src/{anysolver => anyfesolver}/nonlinear.py | 0 .../nonlinear_analysis_diagnostics.py | 2 +- .../nonlinear_element_evaluation.py | 0 .../nonlinear_performance.py | 4 +- .../nonlinear_performance_batch_b.py | 0 .../nonlinear_performance_batch_c.py | 4 +- .../nonlinear_performance_bootstrap.py | 0 .../nonlinear_reduced_assembly.py | 0 .../nonlinear_restart.py | 4 +- .../nonlinear_state.py | 4 +- .../nonlinear_static.py | 30 +- src/{anysolver => anyfesolver}/outcomes.py | 4 +- src/{anysolver => anyfesolver}/plasticity.py | 4 +- .../plasticity_qualification.py | 0 .../prepared_static.py | 0 .../prepared_static_envelopes.py | 0 .../prepared_static_loads.py | 2 +- .../prepared_static_measures.py | 4 +- .../prepared_static_numeric.py | 0 .../prepared_static_q4.py | 0 .../prepared_static_recovery.py | 21 +- .../prepared_static_response.py | 4 +- .../prepared_static_shared.py | 0 .../prepared_static_snapshot.py | 0 .../prepared_static_vectorized.py | 2 +- .../pressure_regions.py | 0 .../production_readiness.py | 4 +- .../quality_control.py | 0 src/{anysolver => anyfesolver}/quantities.py | 2 +- src/{anysolver => anyfesolver}/recovery.py | 4 +- .../recovery_batches.py | 0 .../recovery_policy.py | 0 src/{anysolver => anyfesolver}/recovery_s4.py | 2 +- .../recovery_shell_frames.py | 0 .../reference_cases.py | 0 .../result_capsule.py | 10 +- src/{anysolver => anyfesolver}/results.py | 0 src/{anysolver => anyfesolver}/runtime.py | 59 +- .../s3_reference_batch.py | 0 .../s3_v2c_fast_assembly.py | 0 .../s3_v2d_fast_assembly.py | 0 src/{anysolver => anyfesolver}/s4_validity.py | 0 src/{anysolver => anyfesolver}/sections.py | 2 +- .../sesam_fem/__init__.py | 2 +- .../sesam_fem/__main__.py | 2 +- .../sesam_fem/diagnostics.py | 0 .../sesam_fem/document.py | 0 .../sesam_fem/exporter.py | 0 .../sesam_fem/importer.py | 2 +- .../sesam_fem/records.py | 0 .../sesam_fem/schema.py | 0 .../sesam_fem/sif_importer.py | 0 .../sesam_fem/validation.py | 0 .../sestra_deep_diagnostics.py | 0 .../sestra_mixed_verification.py | 0 .../sestra_structure_benchmarks.py | 0 .../sestra_three_case.py | 0 .../sestra_verification.py | 2 +- .../shell_benchmarks.py | 0 .../shell_formulations/director_field.py | 0 .../shell_formulations/geometry_provenance.py | 4 +- .../mitc4_plus_d_quality.py | 2 +- .../mitc4_plus_d_reference.py | 0 .../shell_formulations/mitc4_plus_d_scalar.py | 0 .../shell_formulations/protocol.py | 0 .../shell_formulations/q4_common.py | 0 .../s4_restricted_policy.py | 0 .../shell_sections.py | 4 +- .../solid_submodel.py | 0 .../static_batch.py | 2 +- .../static_envelopes.py | 0 .../stiffened_shell.py | 0 .../submodel_transfer.py | 2 +- src/{anysolver => anyfesolver}/test_cases.py | 0 .../threading_policy.py | 8 +- src/{anysolver => anyfesolver}/validation.py | 0 .../vectorized_beam.py | 0 .../vectorized_generalized_shell.py | 2 +- .../vectorized_hill48.py | 0 .../vectorized_nonlinear.py | 720 +- .../vectorized_stiffness.py | 0 tests/_e4_pl_s3_native_trial.py | 2 +- tests/_s3_angle_fixtures.py | 4 +- tests/b3_e4_l1_installed_probe.py | 8 +- tests/b3_ge_g7_installed_probe.py | 12 +- tests/benchmark_general_contact_q4_s3_jet2.py | 2 +- tests/data/confirmed_f2_replay.npz | Bin 0 -> 214100 bytes tests/data/namespace_migration/arc.json | 1 + tests/data/namespace_migration/manifest.json | 11 + tests/data/namespace_migration/restart.json | 1 + tests/data/namespace_migration/static.json | 1 + tests/data/namespace_migration/transient.json | 1 + ...se_general_contact_post_switch_response.py | 4 +- .../diagnose_general_contact_schur_branch.py | 4 +- tests/diagnose_general_contact_schur_clip.py | 6 +- ...iagnose_general_contact_schur_jet2_path.py | 2 +- tests/fixtures/d1_control_reaction.py | 157 + tests/fixtures/d1_current_skin.py | 227 + tests/fixtures/d1_nonlinear_kkt.py | 300 + tests/prepared_static_qualification_cases.py | 6 +- ...prepared_static_response_m10_diagnostic.py | 2 +- ...prepared_static_response_m11_diagnostic.py | 2 +- ...prepared_static_response_m11_gate_tests.py | 2 +- ...prepared_static_response_m12_diagnostic.py | 2 +- ...prepared_static_response_m13_diagnostic.py | 2 +- ...prepared_static_response_m14_diagnostic.py | 2 +- ...prepared_static_response_m16_assessment.py | 18 +- .../prepared_static_response_m9_diagnostic.py | 14 +- tests/prepared_static_roundoff_diagnostic.py | 10 +- tests/test_abc_annotation_authority.py | 22 +- tests/test_advanced_s4_batches.py | 6 +- tests/test_analysis_session.py | 8 +- tests/test_arc_length.py | 12 +- tests/test_arc_length_predictor_reuse.py | 14 +- ...est_authority_signature_immutable_cache.py | 4 +- tests/test_b2_equilibrated_body_sections.py | 8 +- tests/test_b2_f09_fixed_aspect_wrench.py | 6 +- tests/test_b2_f09_graph_reversal_probe.py | 2 +- tests/test_b2_f09_physical_off_axis_elbow.py | 4 +- tests/test_b2_f09_public_shear_threshold.py | 6 +- tests/test_b2_f10_f11_point_attachment.py | 12 +- tests/test_b2_f10_f11_s3_point_attachment.py | 12 +- tests/test_b2_f12_coupled_mass_descriptor.py | 4 +- tests/test_b2_f12_geometric_prestress_dev.py | 6 +- tests/test_b2_f13_affine_batch_dev.py | 18 +- .../test_b2_large_scale_development_runner.py | 34 +- tests/test_b2_loaded_point_owner.py | 6 +- tests/test_b2_output_representation.py | 4 +- tests/test_b2_physical_fixed_wrench.py | 4 +- tests/test_b2_physical_flexibility_linear.py | 2 +- tests/test_b2_physical_linear_definition.py | 6 +- .../test_b2_physical_linear_oriented_graph.py | 4 +- tests/test_b2_physical_linear_trace.py | 4 +- tests/test_b2_physical_load_bubbles.py | 4 +- tests/test_b2_point_foundation.py | 8 +- tests/test_b3_e4_e01_matching_point_canary.py | 2 +- tests/test_b3_e4_f03_ccx_solid_bond_screen.py | 2 +- ..._b3_e4_f03_coupled_point_work_candidate.py | 2 +- ...st_b3_e4_f03_distributed_surface_finite.py | 2 +- tests/test_b3_e4_f03_finite_patch_pose.py | 2 +- tests/test_b3_e4_f03_l1_matched_flat_web.py | 4 +- ...st_b3_e4_f03_l1_native_connection_probe.py | 2 +- tests/test_b3_e4_f03_l1_physical_rail.py | 6 +- ..._e4_f03_local_scientific_child_identity.py | 16 +- ..._b3_e4_f03_local_scientific_coordinator.py | 12 +- ...b3_e4_f03_local_scientific_registration.py | 2 +- tests/test_b3_e4_f03_native_spatial_port.py | 16 +- .../test_b3_e4_f03_native_trace_kinematics.py | 4 +- ...t_b3_e4_f03_shell_finite_pose_candidate.py | 2 +- tests/test_b3_e4_f03_weak_line_candidate.py | 2 +- tests/test_b3_e4_f06_beam_chart_v5.py | 4 +- tests/test_b3_e4_f06_owned_rebase_v4.py | 18 +- tests/test_b3_e4_f06_q4_owned_rebase_v1.py | 8 +- tests/test_b3_e4_f06_v4_adjudicator.py | 4 +- tests/test_b3_e4_f06_v4_supervisor.py | 12 +- .../test_b3_e4_g0_f05_mixed_rejection_dev.py | 12 +- ..._b3_e4_g0_f06_native_chart_pullback_dev.py | 20 +- ...t_b3_e4_g0_f07_free_free_descriptor_dev.py | 6 +- .../test_b3_e4_g0_f07_massless_descriptor.py | 4 +- ...b3_e4_g0_f07_native_physical_descriptor.py | 2 +- tests/test_b3_e4_g0_f08_adapter_contract.py | 18 +- .../test_b3_e4_g0_f08_local_operator_seam.py | 14 +- tests/test_b3_ge_production_optin.py | 10 +- tests/test_batch_b_activation.py | 6 +- tests/test_beam_axis_conventions.py | 10 +- tests/test_beam_shell_checkpoint_workflow.py | 6 +- tests/test_beam_shell_connection_options.py | 6 +- tests/test_beam_shell_verification.py | 10 +- tests/test_beam_shell_workflow.py | 4 +- tests/test_benchmark_driver.py | 4 +- .../test_checkpoint_inert_node_observation.py | 4 +- tests/test_ci5_v2d_binding_refusal.py | 2 +- tests/test_common_main_import_admission.py | 18 +- ...est_compensated_contractions_vectorized.py | 4 +- tests/test_compensated_fused_kernels.py | 6 +- tests/test_compensated_native_stress.py | 2 +- tests/test_concentrated_mass.py | 24 +- tests/test_constraint_audit.py | 12 +- tests/test_contact_nonfinite_refusal.py | 2 +- tests/test_contact_work_buffer.py | 4 +- tests/test_corotational.py | 18 +- tests/test_corotational_performance.py | 12 +- tests/test_corotational_shell_precision.py | 8 +- tests/test_corotational_speed_guards.py | 14 +- tests/test_corotational_work_conjugate.py | 6 +- tests/test_damage_matrix_performance.py | 8 +- tests/test_development_test_runner.py | 2 +- tests/test_director_integrated_trace.py | 22 +- tests/test_displacement_event_metadata.py | 6 +- tests/test_dyadic_bilinear.py | 2 +- tests/test_dyadic_factor_chain.py | 2 +- tests/test_e3_baseline.py | 10 +- tests/test_e3_closeout.py | 6 +- tests/test_e4_closeout.py | 2 +- tests/test_e4_pl_burnin.py | 36 +- ...test_e4_pl_component_snapshot_integrity.py | 6 +- ...est_e4_pl_current_state_input_ownership.py | 8 +- tests/test_e4_pl_default_activation.py | 8 +- tests/test_e4_pl_dormant_element.py | 16 +- tests/test_e4_pl_enriched_skin.py | 8 +- ...est_e4_pl_functional_constructor_policy.py | 6 +- tests/test_e4_pl_guarded_observations.py | 20 +- tests/test_e4_pl_mixed_current_state_route.py | 40 +- ...test_e4_pl_orchestrator_operation_lease.py | 16 +- tests/test_e4_pl_parity_matrix.py | 12 +- tests/test_e4_pl_planar_physical_recovery.py | 10 +- tests/test_e4_pl_q1h_domain_coercivity.py | 2 +- tests/test_e4_pl_q4_current_tangent.py | 20 +- tests/test_e4_pl_q4_state_lifecycle.py | 38 +- .../test_e4_pl_q4_stationary_conditioning.py | 4 +- tests/test_e4_pl_s3_assembly_fast_total.py | 10 +- tests/test_e4_pl_s3_bubble_policy.py | 6 +- tests/test_e4_pl_s3_committed_state.py | 4 +- tests/test_e4_pl_s3_contact_virtual_work.py | 16 +- .../test_e4_pl_s3_current_tangent_buckling.py | 20 +- tests/test_e4_pl_s3_descriptor_hardening.py | 10 +- tests/test_e4_pl_s3_descriptor_spectrum.py | 2 +- ...test_e4_pl_s3_direct_nonlinear_response.py | 10 +- tests/test_e4_pl_s3_domain_coercivity.py | 2 +- tests/test_e4_pl_s3_dynamic_guard.py | 4 +- tests/test_e4_pl_s3_exact_oracle.py | 10 +- tests/test_e4_pl_s3_fast_total.py | 10 +- tests/test_e4_pl_s3_formulation_contract.py | 18 +- ...est_e4_pl_s3_generalized_initial_fields.py | 20 +- tests/test_e4_pl_s3_generalized_nonlinear.py | 18 +- tests/test_e4_pl_s3_geometric_stiffness.py | 16 +- tests/test_e4_pl_s3_guard_persistence.py | 16 +- ...t_e4_pl_s3_independent_linear_reference.py | 12 +- tests/test_e4_pl_s3_mass.py | 6 +- .../test_e4_pl_s3_mixed_eigen_performance.py | 10 +- tests/test_e4_pl_s3_mixed_mesh_manifest.py | 12 +- ...4_pl_s3_mixed_mesh_qualification_runner.py | 6 +- ...e4_pl_s3_mixed_structural_qualification.py | 2 +- tests/test_e4_pl_s3_modal.py | 10 +- tests/test_e4_pl_s3_modal_provenance.py | 10 +- ...est_e4_pl_s3_model_bound_nonlinear_hook.py | 22 +- tests/test_e4_pl_s3_native_tl_covariance.py | 4 +- tests/test_e4_pl_s3_native_tl_full_d3.py | 4 +- tests/test_e4_pl_s3_native_tl_kernel.py | 6 +- tests/test_e4_pl_s3_native_tl_response.py | 4 +- tests/test_e4_pl_s3_nonlinear_workflows.py | 12 +- tests/test_e4_pl_s3_objective_pl.py | 4 +- tests/test_e4_pl_s3_opt_in.py | 10 +- tests/test_e4_pl_s3_patch_recovery.py | 20 +- ...est_e4_pl_s3_physical_director_reversal.py | 14 +- tests/test_e4_pl_s3_physical_recovery.py | 12 +- ...est_e4_pl_s3_prestressed_modal_buckling.py | 40 +- tests/test_e4_pl_s3_q4_burnin_authority.py | 96 +- tests/test_e4_pl_s3_qv9_v1_nogo_closeout.py | 2 +- tests/test_e4_pl_s3_reference_batch.py | 32 +- .../test_e4_pl_s3_reference_surface_offset.py | 12 +- tests/test_e4_pl_s3_restart_history.py | 16 +- ...est_e4_pl_s3_shared_rotation_kinematics.py | 6 +- tests/test_e4_pl_s3_state_lifecycle.py | 20 +- tests/test_e4_pl_s3_state_schema_closure.py | 6 +- tests/test_e4_pl_s3_transient_algebraic.py | 22 +- tests/test_e4_pl_s3_v2_authority.py | 6 +- tests/test_e4_pl_s3_v2_candidate_binding.py | 4 +- tests/test_e4_pl_s3_v2_component_cache.py | 16 +- tests/test_e4_pl_s3_v2_flat_funnel.py | 4 +- tests/test_e4_pl_s3_v2_flat_funnel_checker.py | 4 +- .../test_e4_pl_s3_v2_flat_funnel_producer.py | 16 +- .../test_e4_pl_s3_v2_independent_reference.py | 4 +- tests/test_e4_pl_s3_v2_mixed_scope.py | 10 +- tests/test_e4_pl_s3_v2_production.py | 30 +- .../test_e4_pl_s3_v2_production_reference.py | 4 +- tests/test_e4_pl_s3_v2_stage4a_authority.py | 22 +- tests/test_e4_pl_s3_v2_stage4a_coordinator.py | 18 +- tests/test_e4_pl_s3_v2b_interface_funnel.py | 2 +- tests/test_e4_pl_s3_v2b_production.py | 20 +- tests/test_e4_pl_s3_v2c_production.py | 16 +- .../test_e4_pl_s3_v2d_linear_native_parity.py | 20 +- ..._e4_pl_s3_v2d_native_state_corotational.py | 14 +- tests/test_e4_pl_s3_v2d_von_karman.py | 42 +- ...test_e4_pl_s3_v3a_implementation_screen.py | 6 +- tests/test_e4_pl_s3_v4a_q4_subcell_screen.py | 6 +- .../test_e4_pl_s3_v4b_drill_release_screen.py | 6 +- tests/test_e4_pl_s3_v4b_preregistration.py | 4 +- ...test_e4_pl_s3_v4c_physical_first_screen.py | 6 +- tests/test_e4_pl_s3_v4c_preregistration.py | 4 +- .../test_e4_pl_s3_v4d_hermite_edge_screen.py | 6 +- tests/test_e4_pl_s3_v4d_preregistration.py | 4 +- tests/test_e4_pl_s3_v4e_preregistration.py | 4 +- tests/test_e4_pl_s3_v4e_shear_diagnosis.py | 6 +- tests/test_e4_pl_s3_v5a_min3_screen.py | 6 +- tests/test_e4_pl_s3_v5a_preregistration.py | 2 +- .../test_e4_pl_s3_v5b_relaxation_authority.py | 2 +- tests/test_e4_pl_s3_v5b_relaxed_screen.py | 6 +- tests/test_e4_pl_s3_v5d_response_metric.py | 2 +- tests/test_e4_pl_s3_v5e_stage4a_spatial.py | 2 +- tests/test_e4_pl_s3_v5f_production_parity.py | 4 +- ...4_pl_s3_v5g_stage4b_extension_authority.py | 2 +- tests/test_e4_pl_s3_v5h_closeout.py | 4 +- tests/test_e4_pl_s3_v5h_local_parity.py | 4 +- tests/test_e4_pl_s3_v5i_r1_closeout.py | 2 +- tests/test_e4_pl_s3_v5i_r1_diagnosis.py | 4 +- tests/test_e4_pl_s3_v5i_stage4b.py | 2 +- tests/test_e4_pl_s3_v5i_stage4b_closeout.py | 2 +- tests/test_e4_pl_s3_v5k_closeout.py | 2 +- tests/test_e4_pl_s3_v5k_protocol.py | 2 +- tests/test_e4_pl_s3_v5k_repair.py | 10 +- tests/test_e4_pl_s3_v5l_closeout.py | 2 +- tests/test_e4_pl_s3_v5l_protocol.py | 2 +- tests/test_e4_pl_s3_v5l_stage4b.py | 2 +- tests/test_e4_pl_s3_v5m_parity.py | 8 +- tests/test_e4_pl_s3_v5m_protocol.py | 2 +- tests/test_e4_pl_s3_v5n_activation_audit.py | 2 +- ...pl_s3_v6_native_parity_source_authority.py | 2 +- ...pl_s3_v6a_linear_native_parity_closeout.py | 6 +- ...pl_s3_v6a_linear_native_parity_contract.py | 8 +- ..._v6b_native_state_corotational_closeout.py | 6 +- ..._v6b_native_state_corotational_contract.py | 22 +- .../test_e4_pl_s3_v6c_offset_load_restart.py | 18 +- ..._pl_s3_v6c_offset_load_restart_closeout.py | 6 +- ..._pl_s3_v6c_offset_load_restart_contract.py | 12 +- ...est_e4_pl_s3_v6d_activity_contact_batch.py | 22 +- ..._s3_v6d_activity_contact_batch_closeout.py | 6 +- ..._s3_v6d_activity_contact_batch_contract.py | 12 +- tests/test_e4_pl_s3_v6e_final_parity.py | 16 +- ...test_e4_pl_s3_v6e_final_parity_closeout.py | 2 +- tests/test_e4_pl_s3_v6f_final_parity_audit.py | 4 +- tests/test_e4_pl_s3_v6g_closeout.py | 2 +- ...est_e4_pl_s3_v6g_recovery_current_eigen.py | 22 +- tests/test_e4_pl_s3_v6h_closeout.py | 2 +- tests/test_e4_pl_s3_v6h_stage4a_authority.py | 6 +- ...4_pl_s3_v6i_stage4a_execution_authority.py | 6 +- ...e4_pl_s3_v6i_stage4a_execution_closeout.py | 2 +- ...4_pl_s3_v6j_stage4a_execution_authority.py | 2 +- ...e4_pl_s3_v6j_stage4a_execution_closeout.py | 2 +- ...4_pl_s3_v6k_stage4a_execution_authority.py | 2 +- ...e4_pl_s3_v6k_stage4a_execution_closeout.py | 2 +- ..._e4_pl_s3_v6k_stage4a_request_authority.py | 2 +- ...4_pl_s3_v6l_stage4a_execution_authority.py | 2 +- ...e4_pl_s3_v6l_stage4a_execution_closeout.py | 2 +- tests/test_e4_pl_s3_v6n_stage4a_profile.py | 2 +- tests/test_e4_pl_s3_v6r_gate_decision.py | 4 +- tests/test_e4_pl_s3_v6s_stage4b.py | 4 +- tests/test_e4_pl_s3_v6s_stage4b_closeout.py | 2 +- tests/test_e4_pl_s3_v6t_global_cache.py | 10 +- ...est_e4_pl_s3_v6t_global_cache_authority.py | 12 +- ...test_e4_pl_s3_v6t_global_cache_closeout.py | 2 +- tests/test_e4_pl_s3_v6u_performance.py | 4 +- .../test_e4_pl_s3_v6u_performance_closeout.py | 2 +- .../test_e4_pl_s3_v6v_activation_gap_audit.py | 4 +- ...st_e4_pl_s3_v6v_activation_gap_closeout.py | 4 +- .../test_e4_pl_s3_v6w_final_qualification.py | 2 +- tests/test_e4_pl_transient_authority.py | 14 +- tests/test_e4_pl_warped_qualification.py | 12 +- tests/test_e4_pl_workflow_parity.py | 12 +- tests/test_e4_route.py | 2 +- tests/test_element_activity.py | 2 +- tests/test_element_activity_integration.py | 2 +- tests/test_experimental_csr_assembly.py | 6 +- tests/test_external_references.py | 8 +- tests/test_f06_replay_arithmetic.py | 4 +- tests/test_fe_solver_anystructure_fem_mode.py | 14 +- tests/test_fe_solver_architecture.py | 2 +- tests/test_fe_solver_buckling.py | 20 +- tests/test_fe_solver_capacity_workflow.py | 8 +- tests/test_fe_solver_contact.py | 16 +- tests/test_fe_solver_corotational_beam.py | 6 +- tests/test_fe_solver_cylinder_benchmarks.py | 4 +- tests/test_fe_solver_dynamics.py | 10 +- tests/test_fe_solver_element_qualification.py | 6 +- tests/test_fe_solver_element_quality.py | 14 +- tests/test_fe_solver_fracture.py | 18 +- tests/test_fe_solver_infrastructure.py | 32 +- tests/test_fe_solver_mass_modal.py | 14 +- tests/test_fe_solver_nonlinear_dnv.py | 16 +- tests/test_fe_solver_nonlinear_limit_point.py | 10 +- tests/test_fe_solver_nonlinear_static.py | 18 +- ...test_fe_solver_plasticity_qualification.py | 8 +- tests/test_fe_solver_recovery_policy.py | 8 +- tests/test_fe_solver_reference_cases.py | 8 +- tests/test_fe_solver_s4_validity.py | 2 +- tests/test_fe_solver_shell_verification.py | 2 +- tests/test_fe_solver_theory.py | 10 +- tests/test_fe_solver_triangular_shell.py | 2 +- ...test_fe_solver_triangular_shell_backend.py | 4 +- tests/test_floating_pressure_regions.py | 12 +- tests/test_floating_response.py | 2 +- tests/test_floating_transient.py | 22 +- ...est_floating_transient_native_admission.py | 2 +- tests/test_follower_pressure.py | 20 +- .../test_ge_beam3_adaptive_arc_checkpoint.py | 2 +- tests/test_ge_beam3_adaptive_arc_program.py | 8 +- tests/test_ge_beam3_adaptive_continuation.py | 24 +- .../test_ge_beam3_adaptive_modal_installed.py | 2 +- tests/test_ge_beam3_analysis_combined.py | 22 +- ...est_ge_beam3_analysis_fibre_translation.py | 12 +- tests/test_ge_beam3_analysis_nodal_program.py | 6 +- tests/test_ge_beam3_analysis_translation.py | 14 +- ...est_ge_beam3_analysis_translation_modal.py | 10 +- tests/test_ge_beam3_arc_geometry.py | 8 +- .../test_ge_beam3_arc_geometry_checkpoint.py | 2 +- tests/test_ge_beam3_arc_program.py | 16 +- tests/test_ge_beam3_arc_program_checkpoint.py | 6 +- tests/test_ge_beam3_arch_seeded_crossing.py | 10 +- tests/test_ge_beam3_arch_source_cost.py | 10 +- .../test_ge_beam3_authoritative_cell_seed.py | 20 +- tests/test_ge_beam3_branch_direction.py | 8 +- tests/test_ge_beam3_cell_identity.py | 8 +- tests/test_ge_beam3_centered_line_load.py | 14 +- ...st_ge_beam3_centered_line_load_evidence.py | 2 +- tests/test_ge_beam3_centered_mixed.py | 14 +- tests/test_ge_beam3_centered_native.py | 34 +- ...est_ge_beam3_centered_native_checkpoint.py | 2 +- ...test_ge_beam3_centered_native_installed.py | 14 +- tests/test_ge_beam3_centered_reference.py | 8 +- tests/test_ge_beam3_closed_ring.py | 18 +- ...beam3_common_kinematic_chain_checkpoint.py | 10 +- ..._ge_beam3_common_kinematic_factor_probe.py | 8 +- tests/test_ge_beam3_complementary_section.py | 6 +- ...test_ge_beam3_compliance_snapshot_guard.py | 8 +- ...est_ge_beam3_control_programs_installed.py | 2 +- tests/test_ge_beam3_controlled_fibre_modes.py | 12 +- ...ge_beam3_controlled_history_objectivity.py | 8 +- tests/test_ge_beam3_coupled_free_beam.py | 14 +- tests/test_ge_beam3_coupled_modes.py | 32 +- tests/test_ge_beam3_curved_contrast_probe.py | 12 +- tests/test_ge_beam3_curved_p4_closeout.py | 10 +- .../test_ge_beam3_curved_p4_formal_runner.py | 10 +- ...e_beam3_curved_p4_implementation_review.py | 12 +- ...test_ge_beam3_curved_p4_preregistration.py | 10 +- tests/test_ge_beam3_curved_p4_reference.py | 2 +- ..._ge_beam3_curved_p4_scientific_executor.py | 4 +- .../test_ge_beam3_curved_p5_algebra_probe.py | 6 +- ..._beam3_curved_p5_assembly_history_probe.py | 2 +- .../test_ge_beam3_curved_p5_centered_chord.py | 4 +- tests/test_ge_beam3_curved_p5_chain_probe.py | 2 +- ...ge_beam3_curved_p5_coordinate_installed.py | 8 +- ...est_ge_beam3_curved_p5_coordinate_state.py | 32 +- ...m3_curved_p5_displacement_control_probe.py | 2 +- ..._beam3_curved_p5_dynamic_assembly_probe.py | 2 +- tests/test_ge_beam3_curved_p5_finite_probe.py | 2 +- ..._ge_beam3_curved_p5_installed_candidate.py | 4 +- ...am3_curved_p5_local_residual_diagnostic.py | 2 +- ...t_ge_beam3_curved_p5_native_chart_probe.py | 4 +- ..._beam3_curved_p5_native_committed_modal.py | 10 +- ...test_ge_beam3_curved_p5_native_controls.py | 10 +- ..._ge_beam3_curved_p5_native_driver_probe.py | 14 +- ...e_beam3_curved_p5_native_material_probe.py | 8 +- tests/test_ge_beam3_curved_p5_native_modal.py | 10 +- ...beam3_curved_p5_native_restart_recovery.py | 6 +- ...e_beam3_curved_p5_nonlinear_mixed_probe.py | 2 +- ...st_ge_beam3_curved_p5_package_candidate.py | 16 +- ...beam3_curved_p5_retained_response_probe.py | 2 +- ...t_ge_beam3_curved_reference_modes_probe.py | 2 +- tests/test_ge_beam3_dead_line_saved.py | 2 +- .../test_ge_beam3_decimal_cell_force_audit.py | 2 +- .../test_ge_beam3_deterministic_reduction.py | 4 +- tests/test_ge_beam3_displacement_program.py | 16 +- ...e_beam3_displacement_program_checkpoint.py | 4 +- tests/test_ge_beam3_durable_coupled.py | 20 +- ...test_ge_beam3_elastic_seed_continuation.py | 8 +- .../test_ge_beam3_equilibrium_line_program.py | 8 +- .../test_ge_beam3_equilibrium_multielement.py | 16 +- .../test_ge_beam3_equilibrium_schur_solver.py | 16 +- ...t_ge_beam3_factor_chain_modes_installed.py | 2 +- ...test_ge_beam3_factor_chain_native_modes.py | 18 +- tests/test_ge_beam3_fibre_arch_comparison.py | 2 +- tests/test_ge_beam3_fibre_cell.py | 6 +- tests/test_ge_beam3_fibre_cell_checkpoint.py | 2 +- tests/test_ge_beam3_fibre_dense_admission.py | 8 +- ...test_ge_beam3_fibre_distributed_couples.py | 10 +- ...st_ge_beam3_fibre_force_modal_connected.py | 8 +- tests/test_ge_beam3_fibre_kinematic_cell.py | 6 +- tests/test_ge_beam3_fibre_line_program.py | 26 +- tests/test_ge_beam3_fibre_modes_checkpoint.py | 2 +- tests/test_ge_beam3_fibre_schur_solver.py | 8 +- tests/test_ge_beam3_fibre_section.py | 2 +- .../test_ge_beam3_fibre_section_checkpoint.py | 2 +- tests/test_ge_beam3_fibre_static_boundary.py | 6 +- tests/test_ge_beam3_first_force_step_audit.py | 8 +- .../test_ge_beam3_force_program_checkpoint.py | 8 +- .../test_ge_beam3_force_program_installed.py | 2 +- ...est_ge_beam3_full_resultant_force_probe.py | 4 +- ..._ge_beam3_full_resultant_legendre_probe.py | 6 +- tests/test_ge_beam3_g1_elastic.py | 10 +- tests/test_ge_beam3_g1_elastic_admission.py | 2 +- tests/test_ge_beam3_g1_integration.py | 12 +- tests/test_ge_beam3_g2_confirmation.py | 2 +- tests/test_ge_beam3_g2_constraints.py | 14 +- tests/test_ge_beam3_g2_corrections.py | 12 +- tests/test_ge_beam3_g3_contract.py | 4 +- tests/test_ge_beam3_g3a_boundary.py | 12 +- tests/test_ge_beam3_g3a_confirmation.py | 4 +- tests/test_ge_beam3_g3a_graph.py | 22 +- ...est_ge_beam3_g3b_confirmation_authority.py | 2 +- tests/test_ge_beam3_g3b_mb2.py | 28 +- tests/test_ge_beam3_g3b_mb3.py | 32 +- tests/test_ge_beam3_g3b_mq4.py | 26 +- tests/test_ge_beam3_g3b_ms3.py | 30 +- tests/test_ge_beam3_g3b_owner.py | 8 +- tests/test_ge_beam3_g3b_owner_corrections.py | 6 +- tests/test_ge_beam3_g3b_transport.py | 16 +- tests/test_ge_beam3_g3b_weighted.py | 22 +- .../test_ge_beam3_g3c_b2_physical_adapter.py | 2 +- tests/test_ge_beam3_g3c_b2_physical_core.py | 2 +- ...test_ge_beam3_g3c_elementary_diagnostic.py | 2 +- tests/test_ge_beam3_g3c_finite_local.py | 2 +- tests/test_ge_beam3_g3c_history_contract.py | 2 +- ...test_ge_beam3_g3c_history_runner_static.py | 2 +- ...est_ge_beam3_g3c_history_wrapper_static.py | 2 +- tests/test_ge_beam3_g3c_local_beam.py | 14 +- tests/test_ge_beam3_g3c_local_shell.py | 4 +- tests/test_ge_beam3_g3c_mo16_obstruction.py | 2 +- tests/test_ge_beam3_g3c_owner_bridge.py | 16 +- tests/test_ge_beam3_g3c_owner_diagnostic.py | 4 +- tests/test_ge_beam3_g3c_physical_owner.py | 16 +- tests/test_ge_beam3_g3c_proof_compressed.py | 4 +- ..._ge_beam3_g3c_rehearsal_bridge_contract.py | 4 +- ..._ge_beam3_g3c_rehearsal_consumer_static.py | 6 +- tests/test_ge_beam3_g3c_rehearsal_contract.py | 2 +- ...ge_beam3_g3c_rehearsal_mutations_static.py | 2 +- ...st_ge_beam3_g3c_rehearsal_runner_static.py | 2 +- tests/test_ge_beam3_g3c_restart_preflight.py | 2 +- tests/test_ge_beam3_g3c_so3_numerics.py | 8 +- tests/test_ge_beam3_g3c_stable_bridge.py | 20 +- tests/test_ge_beam3_g3c_stable_diagnostic.py | 4 +- tests/test_ge_beam3_g3c_stable_guards.py | 16 +- ...test_ge_beam3_g3c_stable_implementation.py | 4 +- tests/test_ge_beam3_g3c_stable_source_map.py | 12 +- tests/test_ge_beam3_g4_completion.py | 18 +- tests/test_ge_beam3_g4_completion_closeout.py | 6 +- tests/test_ge_beam3_g4_completion_contract.py | 2 +- .../test_ge_beam3_g4a_station_transaction.py | 8 +- ..._beam3_g4a_station_transaction_closeout.py | 2 +- tests/test_ge_beam3_g5_completion.py | 22 +- tests/test_ge_beam3_g6_completion.py | 16 +- tests/test_ge_beam3_g6_domain.py | 16 +- tests/test_ge_beam3_generalized_cell.py | 16 +- ..._ge_beam3_generalized_ellipsoid_section.py | 6 +- ...ge_beam3_generalized_energy_slenderness.py | 8 +- .../test_ge_beam3_generalized_factor_modal.py | 8 +- ...ge_beam3_generalized_force_conditioning.py | 14 +- ...e_beam3_generalized_owned_current_modes.py | 12 +- .../test_ge_beam3_generalized_paired_modal.py | 14 +- ...eam3_generalized_slenderness_diagnostic.py | 18 +- ...ge_beam3_high_contrast_force_diagnostic.py | 6 +- ...est_ge_beam3_integration_boundary_audit.py | 2 +- .../test_ge_beam3_internal_residual_secant.py | 4 +- tests/test_ge_beam3_large_modal_ownership.py | 10 +- tests/test_ge_beam3_line_fibre_modes.py | 16 +- tests/test_ge_beam3_line_modal_comparison.py | 4 +- tests/test_ge_beam3_line_modal_reference.py | 2 +- tests/test_ge_beam3_load_program.py | 6 +- tests/test_ge_beam3_loaded_arch_refinement.py | 8 +- ...test_ge_beam3_loaded_factor_split_probe.py | 4 +- tests/test_ge_beam3_loaded_modal.py | 26 +- .../test_ge_beam3_loaded_modal_checkpoint.py | 2 +- tests/test_ge_beam3_loaded_six_saved.py | 2 +- ...test_ge_beam3_loaded_twelve_preparation.py | 4 +- tests/test_ge_beam3_loaded_twelve_saved.py | 2 +- .../test_ge_beam3_local_force_linear_audit.py | 2 +- tests/test_ge_beam3_mixed_ad_scalars.py | 2 +- tests/test_ge_beam3_mixed_authority_runner.py | 6 +- tests/test_ge_beam3_mixed_core.py | 18 +- tests/test_ge_beam3_mixed_exact_reference.py | 2 +- tests/test_ge_beam3_mixed_finite_gate.py | 6 +- tests/test_ge_beam3_mixed_formal_closeout.py | 4 +- tests/test_ge_beam3_mixed_formal_runner.py | 22 +- ...test_ge_beam3_mixed_independent_checker.py | 2 +- .../test_ge_beam3_mixed_p2_formal_checker.py | 2 +- .../test_ge_beam3_mixed_p2_formal_closeout.py | 4 +- tests/test_ge_beam3_mixed_p2_formal_runner.py | 12 +- ...st_ge_beam3_mixed_p2_load_mass_recovery.py | 8 +- .../test_ge_beam3_mixed_p2_modal_buckling.py | 6 +- .../test_ge_beam3_mixed_p2_preregistration.py | 4 +- ...t_ge_beam3_mixed_p2_recovery_correction.py | 2 +- tests/test_ge_beam3_mixed_p2_solver_chart.py | 12 +- tests/test_ge_beam3_mixed_p2_state_restart.py | 8 +- tests/test_ge_beam3_mixed_p3_optin.py | 48 +- tests/test_ge_beam3_mixed_p3_package.py | 2 +- .../test_ge_beam3_mixed_p3_preregistration.py | 4 +- tests/test_ge_beam3_modal_work_diagnostic.py | 2 +- tests/test_ge_beam3_moment_recovery_audit.py | 2 +- .../test_ge_beam3_n32_refinement_capacity.py | 16 +- tests/test_ge_beam3_n32_spectrum.py | 2 +- tests/test_ge_beam3_native_analysis.py | 18 +- tests/test_ge_beam3_native_arc.py | 28 +- tests/test_ge_beam3_native_arc_adaptive.py | 42 +- tests/test_ge_beam3_native_arc_safety.py | 14 +- tests/test_ge_beam3_native_arc_source.py | 30 +- tests/test_ge_beam3_native_buckling.py | 20 +- .../test_ge_beam3_native_combined_couples.py | 20 +- .../test_ge_beam3_native_combined_restart.py | 26 +- .../test_ge_beam3_native_connected_bending.py | 16 +- .../test_ge_beam3_native_connected_dynamic.py | 6 +- ...est_ge_beam3_native_connected_transient.py | 22 +- ...t_ge_beam3_native_continuum_frequencies.py | 4 +- tests/test_ge_beam3_native_definition.py | 10 +- .../test_ge_beam3_native_directional_work.py | 2 +- tests/test_ge_beam3_native_distributed.py | 26 +- ...est_ge_beam3_native_distributed_restart.py | 20 +- tests/test_ge_beam3_native_dynamic_restart.py | 16 +- ...ge_beam3_native_fibre_connected_restart.py | 14 +- ...est_ge_beam3_native_fibre_current_modal.py | 18 +- tests/test_ge_beam3_native_fibre_restart.py | 16 +- ...st_ge_beam3_native_fibre_static_element.py | 14 +- .../test_ge_beam3_native_force_adaptation.py | 30 +- ...e_beam3_native_full_amplitude_vibration.py | 2 +- tests/test_ge_beam3_native_generalized.py | 24 +- ...am3_native_generalized_combined_couples.py | 26 +- ...am3_native_generalized_combined_restart.py | 26 +- .../test_ge_beam3_native_generalized_modal.py | 26 +- ...t_ge_beam3_native_generalized_parameter.py | 16 +- ...est_ge_beam3_native_generalized_restart.py | 32 +- tests/test_ge_beam3_native_history_profile.py | 16 +- tests/test_ge_beam3_native_line_loading.py | 18 +- tests/test_ge_beam3_native_line_program.py | 12 +- tests/test_ge_beam3_native_line_restart.py | 18 +- tests/test_ge_beam3_native_linear_route.py | 10 +- tests/test_ge_beam3_native_load_admission.py | 6 +- tests/test_ge_beam3_native_load_checkpoint.py | 6 +- tests/test_ge_beam3_native_load_state.py | 14 +- ...st_ge_beam3_native_manufactured_loading.py | 2 +- tests/test_ge_beam3_native_modal_groups.py | 4 +- tests/test_ge_beam3_native_nonprincipal.py | 4 +- ...test_ge_beam3_native_plastic_checkpoint.py | 2 +- ...t_ge_beam3_native_prestress_engineering.py | 14 +- tests/test_ge_beam3_native_spatial_couples.py | 22 +- tests/test_ge_beam3_native_spatial_restart.py | 26 +- ...test_ge_beam3_native_spectral_prestress.py | 20 +- tests/test_ge_beam3_native_transient.py | 18 +- tests/test_ge_beam3_native_translation.py | 18 +- ...test_ge_beam3_native_translation_safety.py | 14 +- tests/test_ge_beam3_native_uniform_arch.py | 18 +- tests/test_ge_beam3_next_spatial_native.py | 6 +- ...test_ge_beam3_operator_validation_scope.py | 8 +- .../test_ge_beam3_owned_force_cancellation.py | 8 +- ...t_ge_beam3_owned_reference_factor_modes.py | 6 +- tests/test_ge_beam3_paired_modal_consumers.py | 6 +- ...est_ge_beam3_paired_plastic_modal_probe.py | 12 +- ...t_ge_beam3_plastic_cell_conjugate_probe.py | 6 +- .../test_ge_beam3_plastic_modal_checkpoint.py | 2 +- .../test_ge_beam3_plastic_state_checkpoint.py | 2 +- tests/test_ge_beam3_pose_joint.py | 6 +- tests/test_ge_beam3_precise_continuation.py | 6 +- tests/test_ge_beam3_precise_geometric_work.py | 10 +- .../test_ge_beam3_precise_work_enrollment.py | 8 +- .../test_ge_beam3_preserved_adaptive_arch.py | 10 +- tests/test_ge_beam3_public_workflows.py | 14 +- ...t_ge_beam3_q4_affine_numerical_recovery.py | 40 +- tests/test_ge_beam3_q4_affine_recovery.py | 8 +- ..._ge_beam3_q4_recovery_coefficient_audit.py | 6 +- tests/test_ge_beam3_qualification_runner.py | 8 +- ...t_ge_beam3_reassembled_modes_checkpoint.py | 6 +- ...st_ge_beam3_reassembled_modes_installed.py | 2 +- .../test_ge_beam3_reassembled_native_modes.py | 14 +- ...est_ge_beam3_reassembled_spectrum_probe.py | 4 +- ...m3_reference_factor_spectrum_checkpoint.py | 2 +- tests/test_ge_beam3_reference_identity.py | 4 +- ..._ge_beam3_relative_spectrum_engineering.py | 12 +- ...st_ge_beam3_relative_spectrum_installed.py | 2 +- tests/test_ge_beam3_relative_svd_probe.py | 2 +- ...e_beam3_relative_virgin_reference_modes.py | 16 +- tests/test_ge_beam3_retained_arc.py | 10 +- tests/test_ge_beam3_retained_arc_modal.py | 8 +- tests/test_ge_beam3_retained_arch.py | 2 +- tests/test_ge_beam3_retained_fibre.py | 12 +- ...test_ge_beam3_retained_fibre_checkpoint.py | 2 +- tests/test_ge_beam3_retained_fibre_control.py | 24 +- tests/test_ge_beam3_retained_fibre_modal.py | 18 +- tests/test_ge_beam3_retained_fibre_modes.py | 18 +- tests/test_ge_beam3_retained_fibre_state.py | 10 +- tests/test_ge_beam3_retained_force_state.py | 10 +- ..._beam3_retained_generalized_force_probe.py | 4 +- ...est_ge_beam3_retained_generalized_modal.py | 18 +- ...ge_beam3_retained_generalized_ownership.py | 8 +- ...est_ge_beam3_retained_generalized_state.py | 12 +- tests/test_ge_beam3_retained_guard_cost.py | 10 +- tests/test_ge_beam3_retained_nodal_loading.py | 12 +- tests/test_ge_beam3_retained_plastic.py | 16 +- ...t_ge_beam3_retained_plastic_force_probe.py | 8 +- tests/test_ge_beam3_retained_plastic_modes.py | 8 +- tests/test_ge_beam3_retained_plastic_state.py | 12 +- ...st_ge_beam3_retained_post_plastic_modal.py | 12 +- tests/test_ge_beam3_retained_prestress.py | 10 +- ..._ge_beam3_retained_recovery_objectivity.py | 10 +- ...t_ge_beam3_retained_refinement_capacity.py | 14 +- ...t_ge_beam3_retained_translation_control.py | 12 +- ...est_ge_beam3_retained_translation_modal.py | 10 +- tests/test_ge_beam3_returned_mode_capture.py | 4 +- ...eam3_saved_continuum_lateral_comparison.py | 4 +- tests/test_ge_beam3_schur_line_program.py | 12 +- ..._ge_beam3_seeded_development_checkpoint.py | 6 +- tests/test_ge_beam3_seeded_fibre_control.py | 10 +- tests/test_ge_beam3_seeded_load_program.py | 8 +- tests/test_ge_beam3_seeded_numerics.py | 12 +- ...st_ge_beam3_seeded_reduction_diagnostic.py | 12 +- tests/test_ge_beam3_shell_joint_state.py | 10 +- tests/test_ge_beam3_shell_joint_trial.py | 16 +- tests/test_ge_beam3_signed_lifecycle.py | 2 +- tests/test_ge_beam3_signed_loaded_modes.py | 14 +- tests/test_ge_beam3_signed_loaded_spectrum.py | 14 +- tests/test_ge_beam3_signed_mode_shapes.py | 8 +- .../test_ge_beam3_signed_modes_checkpoint.py | 8 +- tests/test_ge_beam3_signed_modes_installed.py | 2 +- tests/test_ge_beam3_slender_spectrum_probe.py | 2 +- tests/test_ge_beam3_spatial_continuum.py | 4 +- ...test_ge_beam3_spatial_equilibrium_probe.py | 4 +- tests/test_ge_beam3_spatial_next_reference.py | 4 +- tests/test_ge_beam3_spatial_nodal_moments.py | 28 +- ...test_ge_beam3_spatial_stability_factors.py | 6 +- tests/test_ge_beam3_spectral_allocation.py | 8 +- tests/test_ge_beam3_station_resultant_cell.py | 2 +- tests/test_ge_beam3_uniform_arch_eight.py | 20 +- tests/test_ge_beam3_uniform_arch_peak.py | 8 +- .../test_ge_beam3_uniform_arch_refinement.py | 20 +- tests/test_ge_beam3_uniform_arch_sixteen.py | 22 +- tests/test_ge_beam3_variational_shell.py | 10 +- tests/test_ge_beam3_virgin_reference_modes.py | 16 +- ...al_contact_adaptive_overlap_certificate.py | 2 +- ..._contact_admission_globalization_driver.py | 12 +- ...ission_globalization_driver_small_patch.py | 14 +- ...lobalization_driver_small_patch_partial.py | 2 +- ..._globalization_driver_small_patch_probe.py | 4 +- ...ntact_admission_globalization_remaining.py | 2 +- ..._admission_globalization_restart_reader.py | 2 +- ..._admission_globalization_witness_public.py | 14 +- tests/test_general_contact_algebraic_path.py | 12 +- tests/test_general_contact_arc_length.py | 26 +- .../test_general_contact_arc_length_affine.py | 30 +- ...test_general_contact_arc_length_release.py | 12 +- ...est_general_contact_arc_results_archive.py | 14 +- ...est_general_contact_augmentation_secant.py | 6 +- .../test_general_contact_automatic_domain.py | 34 +- .../test_general_contact_automatic_q4_pair.py | 42 +- .../test_general_contact_automatic_s3_pair.py | 26 +- tests/test_general_contact_automatic_s3_q4.py | 34 +- .../test_general_contact_automatic_sliding.py | 18 +- ...neral_contact_automatic_swept_lifecycle.py | 28 +- .../test_general_contact_b2_b3_pair_static.py | 8 +- ...est_general_contact_b3_pair_chord_bound.py | 2 +- ..._general_contact_b3_pair_curved_measure.py | 2 +- .../test_general_contact_b3_pair_potential.py | 2 +- ...test_general_contact_b3_pair_projection.py | 2 +- tests/test_general_contact_b3_pair_static.py | 8 +- ...t_general_contact_beam_chain_consistent.py | 14 +- tests/test_general_contact_beam_chain_ends.py | 12 +- tests/test_general_contact_beam_chain_pair.py | 8 +- ...t_general_contact_beam_chain_refinement.py | 6 +- tests/test_general_contact_beam_curve_ends.py | 18 +- ...est_general_contact_beam_foundation_dev.py | 6 +- tests/test_general_contact_beam_pair.py | 8 +- tests/test_general_contact_beam_pair_ends.py | 20 +- tests/test_general_contact_beam_plane.py | 8 +- tests/test_general_contact_beam_radial.py | 8 +- ...test_general_contact_beam_radial_moving.py | 8 +- ...al_contact_beam_s3_directional_coupling.py | 20 +- ...eral_contact_beam_s3_directional_impact.py | 24 +- ...ntact_beam_s3_directional_loaded_impact.py | 30 +- ...neral_contact_beam_s3_directional_rates.py | 10 +- ...eral_contact_beam_s3_directional_tilted.py | 56 +- .../test_general_contact_beam_s3_transient.py | 36 +- ...eral_contact_beam_s3_transient_flexural.py | 8 +- ...al_contact_beam_s3_transient_rotational.py | 42 +- tests/test_general_contact_beam_shell.py | 12 +- .../test_general_contact_beam_shell_patch.py | 12 +- ...st_general_contact_beam_temporal_bounds.py | 2 +- ...st_general_contact_c5_elastic_increment.py | 14 +- ...l_contact_c5_numpy_coordinate_admission.py | 8 +- .../test_general_contact_capability_report.py | 2 +- tests/test_general_contact_capped_cylinder.py | 30 +- ...general_contact_capped_cylinder_endcaps.py | 32 +- ...eneral_contact_compensated_contractions.py | 8 +- ...eral_contact_constrained_gap_joint_dual.py | 2 +- ...test_general_contact_coupled_refinement.py | 2 +- ...st_general_contact_coupled_tool_staging.py | 12 +- ..._general_contact_cross_side_broad_phase.py | 2 +- ...eneral_contact_curved_cylinder_response.py | 8 +- .../test_general_contact_curved_s3_q4_work.py | 14 +- .../test_general_contact_curved_shell_skin.py | 8 +- tests/test_general_contact_cylinder.py | 6 +- ...neral_contact_cylinder_bending_response.py | 6 +- ...st_general_contact_cylinder_convergence.py | 6 +- ...test_general_contact_d1_current_handoff.py | 2 +- ...eneral_contact_d1_development_recording.py | 4 +- ...est_general_contact_d1_interior_profile.py | 16 +- ...eneral_contact_d1_overlap_gap_bound_dev.py | 8 +- ...eneral_contact_d1_path_normal_admission.py | 2 +- ...eneral_contact_d1_projected_refined_gap.py | 6 +- ...neral_contact_d1_radial_source_bin_work.py | 2 +- .../test_general_contact_d1_swept_coverage.py | 4 +- ...al_contact_d1_two_body_nonlinear_oracle.py | 30 +- ...general_contact_deformable_b3_s3_static.py | 8 +- ...test_general_contact_deformable_beam_s3.py | 2 +- ...general_contact_deformable_beam_s3_caps.py | 12 +- ...neral_contact_deformable_beam_s3_static.py | 10 +- ...al_contact_descriptor_directional_rates.py | 8 +- ..._general_contact_displacement_augmented.py | 2 +- ...neral_contact_eccentric_source_director.py | 10 +- ...general_contact_enriched_cold_predictor.py | 16 +- ...t_general_contact_enriched_moment_batch.py | 18 +- ...st_general_contact_enriched_multitarget.py | 20 +- ...neral_contact_enriched_multitarget_cost.py | 30 +- ...test_general_contact_enriched_nonlinear.py | 22 +- tests/test_general_contact_enriched_path.py | 4 +- ...test_general_contact_enriched_reference.py | 2 +- ...l_contact_enriched_reference_polynomial.py | 2 +- tests/test_general_contact_enriched_skin.py | 6 +- ...test_general_contact_enriched_small_cut.py | 22 +- .../test_general_contact_event_subdivision.py | 22 +- .../test_general_contact_exact_seam_schur.py | 6 +- ...act_finite_automatic_selection_variants.py | 2 +- ..._general_contact_finite_automatic_shell.py | 24 +- tests/test_general_contact_finite_q4_v2d.py | 34 +- ...eral_contact_finite_rotation_shell_work.py | 58 +- tests/test_general_contact_finite_v2d_pair.py | 40 +- ..._general_contact_finite_v2d_rigid_patch.py | 26 +- ...al_contact_fixed_projection_active_path.py | 4 +- ..._general_contact_fixed_projection_graph.py | 2 +- ..._general_contact_fixed_projection_route.py | 6 +- ...eral_contact_fixed_projection_s3_events.py | 10 +- tests/test_general_contact_force_augmented.py | 2 +- tests/test_general_contact_friction_point.py | 4 +- ..._contact_guided_pair_transient_geometry.py | 10 +- ...eral_contact_hemisphere_cylinder_motion.py | 6 +- ...eral_contact_hemisphere_cylinder_static.py | 10 +- ...eneral_contact_hemisphere_cylinder_work.py | 4 +- .../test_general_contact_hemisphere_plane.py | 12 +- .../test_general_contact_hemisphere_sphere.py | 14 +- ...est_general_contact_hermite_exact_split.py | 8 +- ..._contact_initial_seed_admission_capture.py | 6 +- ...ral_contact_initial_seed_coupled_prefix.py | 2 +- ...eneral_contact_initial_seed_eligibility.py | 8 +- ...l_contact_initial_seed_example_contract.py | 4 +- ...ontact_initial_seed_gap_witness_capture.py | 6 +- ...est_general_contact_initial_seed_oracle.py | 2 +- ...ral_contact_initial_seed_origin_capture.py | 6 +- ...ral_contact_initial_seed_public_example.py | 2 +- ...t_general_contact_initial_seed_settings.py | 6 +- ...t_general_contact_jet2_candidate_budget.py | 4 +- tests/test_general_contact_lazy_import.py | 20 +- ...est_general_contact_linear_patch_oracle.py | 6 +- ..._general_contact_linearized_pivot_patch.py | 4 +- ...eneral_contact_linearized_pivot_support.py | 2 +- ...st_general_contact_macro_pressure_state.py | 12 +- ..._contact_mixed_assembly_cache_lifecycle.py | 6 +- ...eneral_contact_mixed_ordinary_augmented.py | 2 +- tests/test_general_contact_mixed_path.py | 4 +- ...eral_contact_monolithic_block_direction.py | 4 +- ...eneral_contact_monolithic_cycle_restart.py | 10 +- ...t_general_contact_monolithic_exact_seam.py | 12 +- ...ontact_monolithic_ordinary_displacement.py | 18 +- ...neral_contact_monolithic_ordinary_force.py | 4 +- ...test_general_contact_monolithic_restart.py | 10 +- tests/test_general_contact_monolithic_work.py | 10 +- tests/test_general_contact_moving.py | 4 +- ...test_general_contact_multiple_beam_ends.py | 8 +- ...est_general_contact_multiple_beam_rigid.py | 8 +- ...t_general_contact_multiple_beam_s3_caps.py | 14 +- ...eral_contact_multiple_beam_s3_transient.py | 26 +- ..._contact_multiple_beam_sphere_lifecycle.py | 6 +- ...al_contact_multiple_hemisphere_analytic.py | 12 +- ...l_contact_multiple_hemisphere_cylinders.py | 6 +- ...eral_contact_multiple_hemisphere_planes.py | 14 +- ...eneral_contact_multiple_projected_pairs.py | 8 +- ...t_general_contact_multiple_shell_planes.py | 6 +- ...st_general_contact_native_active_budget.py | 4 +- ...neral_contact_native_anchored_enclosure.py | 2 +- ..._general_contact_native_candidate_reuse.py | 2 +- ...neral_contact_native_checkpoint_results.py | 22 +- ...eral_contact_native_component_enclosure.py | 2 +- ...neral_contact_native_construction_reuse.py | 2 +- ...test_general_contact_native_curve_union.py | 8 +- ...contact_native_curved_fibre_pair_static.py | 8 +- .../test_general_contact_native_curved_gap.py | 4 +- ...al_contact_native_curved_pair_lifecycle.py | 8 +- ...al_contact_native_curved_pair_ownership.py | 12 +- ...l_contact_native_curved_pair_trial_seed.py | 10 +- ...test_general_contact_native_curved_path.py | 28 +- ...tact_native_curved_path_work_separation.py | 4 +- ...eneral_contact_native_curved_plane_work.py | 34 +- ...eneral_contact_native_curved_s3_restart.py | 2 +- ...general_contact_native_curved_s3_static.py | 12 +- ...t_general_contact_native_curved_s3_work.py | 42 +- ...st_general_contact_native_curved_static.py | 4 +- ...t_general_contact_native_deadline_scale.py | 10 +- ...test_general_contact_native_enforcement.py | 6 +- ...general_contact_native_event_polynomial.py | 6 +- ...eneral_contact_native_fibre_pair_static.py | 12 +- ...al_contact_native_fibre_plastic_restart.py | 4 +- ...st_general_contact_native_fibre_results.py | 8 +- tests/test_general_contact_native_fibre_s3.py | 12 +- ...t_general_contact_native_fine_lifecycle.py | 2 +- ...al_contact_native_front_work_refinement.py | 12 +- ...eral_contact_native_gap_jet_preparation.py | 4 +- ...st_general_contact_native_initial_guess.py | 4 +- ...eral_contact_native_material_activation.py | 16 +- ...t_general_contact_native_material_plane.py | 26 +- ...contact_native_material_plane_diagnosis.py | 2 +- ...t_native_material_plane_front_diagnosis.py | 4 +- ...test_general_contact_native_material_s3.py | 58 +- ...neral_contact_native_multiple_s3_static.py | 28 +- ...st_general_contact_native_normal_angles.py | 6 +- ...ral_contact_native_normal_angles_kernel.py | 4 +- ...eneral_contact_native_pair_gap_geometry.py | 6 +- ...st_general_contact_native_pooled_budget.py | 14 +- ...eneral_contact_native_replay_arithmetic.py | 6 +- ...neral_contact_native_replay_diagnostics.py | 4 +- ...l_contact_native_retained_body_junction.py | 18 +- ...neral_contact_native_retained_body_pair.py | 12 +- ...contact_native_retained_body_projection.py | 10 +- ...neral_contact_native_retained_cell_pair.py | 4 +- ...eral_contact_native_retained_curve_cell.py | 2 +- ...eral_contact_native_retained_line_plane.py | 2 +- ...general_contact_native_retained_line_s3.py | 6 +- ...al_contact_native_retained_line_s3_work.py | 14 +- ...ral_contact_native_retained_pair_static.py | 22 +- ...neral_contact_native_retained_s3_static.py | 26 +- ..._general_contact_native_retained_static.py | 14 +- ...general_contact_native_retained_station.py | 8 +- ...eral_contact_native_retained_whole_pair.py | 6 +- ...ntact_native_retained_whole_pair_static.py | 20 +- ...neral_contact_native_surface_activation.py | 10 +- ...t_general_contact_native_surface_bounds.py | 18 +- ..._contact_native_surface_closed_sequence.py | 14 +- ...eral_contact_native_surface_contributor.py | 10 +- ...general_contact_native_surface_crossing.py | 26 +- ...l_contact_native_surface_event_sequence.py | 44 +- ..._general_contact_native_surface_extrema.py | 10 +- ...ontact_native_surface_friction_integral.py | 12 +- ...st_general_contact_native_surface_front.py | 22 +- ..._contact_native_surface_front_precision.py | 18 +- ..._general_contact_native_surface_history.py | 28 +- ...ral_contact_native_surface_local_fronts.py | 82 +- ...t_general_contact_native_surface_normal.py | 12 +- ...st_general_contact_native_surface_patch.py | 10 +- ...est_general_contact_native_surface_path.py | 4 +- ..._contact_native_surface_prepared_fronts.py | 12 +- ...neral_contact_native_surface_quadrature.py | 14 +- ...neral_contact_native_surface_refinement.py | 2 +- ..._general_contact_native_surface_release.py | 12 +- ...ral_contact_native_surface_replay_owner.py | 64 +- ...eral_contact_native_surface_s3_friction.py | 22 +- ...ontact_native_surface_sequence_integral.py | 26 +- ...contact_native_surface_sequence_routing.py | 18 +- ..._general_contact_native_surface_support.py | 30 +- ..._contact_native_surface_temporal_fronts.py | 28 +- ...eral_contact_native_surface_transaction.py | 10 +- ...neral_contact_native_surface_variations.py | 4 +- ..._general_contact_native_swept_curvature.py | 8 +- ...general_contact_native_transient_legacy.py | 4 +- ...al_contact_native_transient_multi_shell.py | 37 +- ...t_general_contact_native_transient_pair.py | 18 +- ..._general_contact_native_transient_shell.py | 12 +- ...est_general_contact_native_two_fibre_s3.py | 4 +- ...neral_contact_nodal_force_linearization.py | 4 +- ...eneral_contact_ordinary_supported_schur.py | 12 +- ...ntact_original_workflow_first_increment.py | 4 +- ..._contact_original_workflow_qp_mechanism.py | 6 +- ...contact_original_workflow_seed_decision.py | 12 +- tests/test_general_contact_overlap.py | 6 +- ...eneral_contact_overlap_dual_certificate.py | 2 +- ...eneral_contact_overlap_dual_integration.py | 8 +- ...al_contact_overlap_local_swept_roundoff.py | 4 +- tests/test_general_contact_pair.py | 12 +- ...eneral_contact_paired_pressure_response.py | 22 +- ...general_contact_partial_swept_enclosure.py | 2 +- .../test_general_contact_patch_broadphase.py | 6 +- tests/test_general_contact_patch_mortar.py | 6 +- ...neral_contact_patch_pressure_resolution.py | 4 +- .../test_general_contact_patch_refinement.py | 8 +- tests/test_general_contact_patch_sliding.py | 8 +- ...test_general_contact_planar_overlap_gap.py | 2 +- tests/test_general_contact_plane.py | 6 +- ...est_general_contact_plane_end_ownership.py | 4 +- ...eral_contact_plane_event_front_controls.py | 14 +- tests/test_general_contact_plane_motion.py | 6 +- ...st_general_contact_plane_newmark_events.py | 4 +- ...t_general_contact_point_budget_decision.py | 2 +- tests/test_general_contact_pointwise_patch.py | 6 +- .../test_general_contact_polynomial_roots.py | 6 +- ..._general_contact_polynomial_roots_reuse.py | 2 +- ...general_contact_predictor_compatibility.py | 14 +- .../test_general_contact_preparation_reuse.py | 8 +- tests/test_general_contact_pressure_basis.py | 2 +- .../test_general_contact_pressure_overlay.py | 8 +- tests/test_general_contact_pressure_space.py | 2 +- .../test_general_contact_projected_penalty.py | 10 +- ...eneral_contact_public_friction_settings.py | 18 +- ..._general_contact_q4_material_checkpoint.py | 20 +- tests/test_general_contact_q4_pair_bending.py | 16 +- ...t_general_contact_q4_pair_measured_cost.py | 16 +- ...test_general_contact_q4_pair_monolithic.py | 30 +- ...eneral_contact_q4_pair_monolithic_cycle.py | 20 +- ...est_general_contact_q4_partial_pressure.py | 4 +- ...general_contact_q4_physical_orientation.py | 24 +- ...st_general_contact_q4_projected_profile.py | 4 +- tests/test_general_contact_q4_q4_augmented.py | 6 +- tests/test_general_contact_q4_q4_static.py | 6 +- ...t_general_contact_q4_q4_swept_enclosure.py | 16 +- ...general_contact_q4_s3_compiled_bjet_mul.py | 2 +- ...t_general_contact_q4_s3_corner_pressure.py | 4 +- ...general_contact_q4_s3_first_derivatives.py | 4 +- ...eral_contact_q4_s3_high_precision_wedge.py | 2 +- ...general_contact_q4_s3_jet2_static_owner.py | 4 +- ...neral_contact_q4_s3_overlap_derivatives.py | 6 +- ...t_general_contact_q4_s3_pair_resolution.py | 14 +- ...l_contact_q4_s3_partial_pressure_oracle.py | 4 +- ...test_general_contact_q4_s3_patch_static.py | 8 +- ...general_contact_q4_s3_projected_profile.py | 4 +- ...est_general_contact_q4_s3_refined_force.py | 4 +- ...est_general_contact_q4_s3_refined_patch.py | 6 +- ..._general_contact_q4_s3_refined_pressure.py | 2 +- ...eneral_contact_q4_s3_sliver_derivatives.py | 4 +- .../test_general_contact_q4_s3_tight_path.py | 2 +- tests/test_general_contact_q4_skin_work.py | 12 +- ...est_general_contact_q4_source_augmented.py | 6 +- .../test_general_contact_q4_source_overlap.py | 4 +- .../test_general_contact_radial_beam_ends.py | 12 +- ...t_general_contact_radial_representation.py | 16 +- ...est_general_contact_radial_scalar_trace.py | 4 +- ...eneral_contact_refined_q4_s3_tight_path.py | 2 +- .../test_general_contact_request_identity.py | 10 +- tests/test_general_contact_rigid_motion.py | 6 +- .../test_general_contact_rim_energy_trace.py | 6 +- ..._general_contact_s3_friction_activation.py | 4 +- tests/test_general_contact_s3_friction_cli.py | 2 +- ...general_contact_s3_friction_integration.py | 4 +- .../test_general_contact_s3_friction_pair.py | 10 +- ...neral_contact_s3_friction_physical_path.py | 30 +- ...test_general_contact_s3_friction_replay.py | 26 +- ...test_general_contact_s3_friction_static.py | 28 +- ...test_general_contact_s3_jet2_patch_work.py | 6 +- ...st_general_contact_s3_jet2_static_owner.py | 4 +- ...st_general_contact_s3_mesh_control_lift.py | 46 +- ..._general_contact_s3_mesh_history_events.py | 30 +- ...general_contact_s3_mesh_moving_friction.py | 62 +- ...general_contact_s3_mesh_nontrivial_work.py | 22 +- ...t_general_contact_s3_mesh_pressure_work.py | 6 +- .../test_general_contact_s3_mesh_swept_gap.py | 10 +- ..._contact_s3_mesh_weak_pressure_friction.py | 22 +- ...neral_contact_s3_moving_normal_friction.py | 46 +- ..._general_contact_s3_overlap_derivatives.py | 6 +- tests/test_general_contact_s3_pair_static.py | 8 +- ...t_general_contact_s3_partial_rim_replay.py | 20 +- ...test_general_contact_s3_patch_augmented.py | 4 +- ..._general_contact_s3_patch_mortar_energy.py | 2 +- .../test_general_contact_s3_patch_refined.py | 10 +- tests/test_general_contact_s3_patch_static.py | 6 +- ...general_contact_s3_physical_orientation.py | 32 +- tests/test_general_contact_s3_plane.py | 6 +- ...ontact_s3_pressure_refinement_ownership.py | 4 +- ...st_general_contact_s3_projected_penalty.py | 20 +- ...st_general_contact_s3_q4_gap_resolution.py | 8 +- ...neral_contact_s3_q4_overlap_derivatives.py | 8 +- ...t_general_contact_s3_q4_patch_augmented.py | 4 +- ...test_general_contact_s3_q4_patch_static.py | 6 +- tests/test_general_contact_s3_q4_seam_work.py | 10 +- .../test_general_contact_s3_q4_static_dev.py | 18 +- ...eral_contact_s3_replay_ordinary_refusal.py | 4 +- tests/test_general_contact_s3_skin_work.py | 14 +- ...est_general_contact_s3_sliding_friction.py | 8 +- tests/test_general_contact_s3_vk_path.py | 4 +- .../test_general_contact_s3_vk_path_guards.py | 6 +- ...t_general_contact_same_side_broad_phase.py | 6 +- ...test_general_contact_schur_active_epoch.py | 2 +- ...eneral_contact_schur_backtrack_settings.py | 4 +- ...est_general_contact_schur_jet2_response.py | 4 +- tests/test_general_contact_search_adapter.py | 2 +- ...eneral_contact_search_start_certificate.py | 4 +- ...test_general_contact_seed_gap_reference.py | 2 +- ...eral_contact_seed_path_record_diagnosis.py | 4 +- ...eral_contact_semismooth_merit_direction.py | 4 +- ...eneral_contact_shell_pair_hermite_sweep.py | 2 +- ...al_contact_shell_sphere_temporal_bounds.py | 12 +- .../test_general_contact_skew_partial_work.py | 6 +- tests/test_general_contact_skin_geometry.py | 6 +- tests/test_general_contact_sliding_map.py | 6 +- tests/test_general_contact_sliding_static.py | 30 +- tests/test_general_contact_sphere.py | 6 +- ..._general_contact_sphere_temporal_bounds.py | 6 +- ..._general_contact_static_results_archive.py | 15 +- ...general_contact_structural_state_bridge.py | 2 +- tests/test_general_contact_supported_schur.py | 4 +- ...neral_contact_supported_schur_backtrack.py | 2 +- ...st_general_contact_supported_schur_path.py | 6 +- ..._general_contact_swept_patch_broadphase.py | 8 +- ...test_general_contact_swept_search_owner.py | 8 +- ...general_contact_tilted_relative_sliding.py | 28 +- tests/test_general_contact_touching_bounds.py | 6 +- ...st_general_contact_transient_beam_plane.py | 14 +- ..._general_contact_transient_cancellation.py | 8 +- ...st_general_contact_transient_clipped_s3.py | 16 +- ..._contact_transient_constraint_reactions.py | 2 +- ...l_contact_transient_deforming_q4_planes.py | 10 +- ..._general_contact_transient_deforming_s3.py | 32 +- ...ral_contact_transient_free_shell_sphere.py | 24 +- ...t_general_contact_transient_free_sphere.py | 22 +- ...ral_contact_transient_guided_shell_pair.py | 16 +- ..._contact_transient_multiple_beam_planes.py | 22 +- ...contact_transient_multiple_shell_planes.py | 8 +- ...general_contact_transient_nonuniform_s3.py | 20 +- ...al_contact_transient_oblique_q4_plastic.py | 6 +- tests/test_general_contact_transient_plane.py | 16 +- ..._general_contact_transient_plane_events.py | 18 +- ...st_general_contact_transient_q4_plastic.py | 34 +- ...neral_contact_transient_results_archive.py | 19 +- ...ral_contact_transient_rigid_translation.py | 20 +- ...st_general_contact_transient_s3_history.py | 12 +- ...st_general_contact_transient_s3_polygon.py | 10 +- ..._general_contact_triangle_mortar_energy.py | 2 +- ...st_general_contact_triangle_pair_energy.py | 2 +- ...test_general_contact_triangulated_rigid.py | 16 +- ...l_contact_triangulated_rigid_invariance.py | 12 +- ...eneral_contact_triangulated_rigid_patch.py | 8 +- ...neral_contact_two_body_mortar_reference.py | 8 +- tests/test_general_contact_warped_q4_patch.py | 6 +- tests/test_general_contact_warped_q4_plane.py | 8 +- tests/test_general_contact_warped_q4_skin.py | 6 +- .../test_general_contact_warped_q4_static.py | 6 +- ...general_contact_zero_weight_derivatives.py | 4 +- tests/test_generalized_beam_sections.py | 6 +- .../test_generalized_section_api_workflows.py | 12 +- ...est_generalized_section_mass_properties.py | 2 +- tests/test_generalized_shell_sections.py | 4 +- tests/test_generalized_state_recovery.py | 2 +- tests/test_generic_beam_lazy_public_export.py | 36 +- tests/test_generic_beam_python_scatter.py | 12 +- tests/test_geometry_panel.py | 2 +- tests/test_hht_alpha.py | 14 +- tests/test_hill48_plane_stress_plasticity.py | 6 +- tests/test_impact_coupled_convergence.py | 20 +- tests/test_impact_elastic_baseline_cache.py | 4 +- tests/test_impact_reduced_assembly.py | 16 +- tests/test_impact_tangent_reuse.py | 14 +- tests/test_inertia_relief.py | 4 +- tests/test_inertia_relief_integration.py | 20 +- .../test_initial_fields_and_staged_history.py | 28 +- tests/test_instance_dict_descriptor_layout.py | 2 +- tests/test_load_vector_guard_amortization.py | 38 +- tests/test_local_patch_transition.py | 10 +- tests/test_marine_clock.py | 6 +- tests/test_marine_continuous_contact.py | 8 +- tests/test_marine_contributions.py | 6 +- tests/test_marine_coupled_equilibrium.py | 24 +- tests/test_marine_dry_blocks.py | 2 +- tests/test_marine_equilibrium.py | 10 +- tests/test_marine_excitation_series.py | 12 +- tests/test_marine_hydro_coordinates.py | 4 +- tests/test_marine_line_hydrodynamics.py | 8 +- tests/test_marine_linear.py | 6 +- tests/test_marine_link.py | 4 +- tests/test_marine_mechanical.py | 8 +- tests/test_marine_mooring.py | 4 +- tests/test_marine_mooring_contact.py | 10 +- tests/test_marine_mooring_driver.py | 10 +- tests/test_marine_morison.py | 20 +- tests/test_marine_potential_flow.py | 10 +- tests/test_marine_potential_flow_serde.py | 4 +- tests/test_marine_protocol_failures.py | 6 +- tests/test_marine_rigid.py | 4 +- tests/test_marine_seabed.py | 2 +- tests/test_material_history_recovery.py | 2 +- tests/test_mesh_load_bc_verification.py | 2 +- tests/test_mesher_improvements.py | 6 +- tests/test_mixed_shell_quadrature_grouping.py | 14 +- tests/test_modal_rigid_classification.py | 6 +- tests/test_namespace_migration.py | 46 + tests/test_namespace_neutral_deepcopy.py | 12 +- tests/test_native_affinity_fallback.py | 38 +- tests/test_native_authority_dag.py | 22 +- ...test_native_boundary_backtrack_schedule.py | 4 +- tests/test_native_dyadic_interval_inertia.py | 4 +- tests/test_native_dynamic_main_example.py | 12 +- tests/test_native_exact_shift_inertia.py | 4 +- tests/test_native_factor_chain_modes.py | 4 +- tests/test_native_fibre_bl5_displacement.py | 14 +- ..._native_fibre_bl5_mixed_j2_displacement.py | 16 +- tests/test_native_fibre_boundary_proposal.py | 12 +- tests/test_native_fraction_free_inertia.py | 2 +- tests/test_native_guard_code_grammar.py | 4 +- tests/test_native_guard_cpp.py | 34 +- tests/test_native_large_factor_modal.py | 14 +- ...e_material_bl5_arc_same_origin_jacobian.py | 14 +- tests/test_native_reassembled_factor_modes.py | 4 +- .../test_native_reference_factor_spectrum.py | 6 +- tests/test_native_rotation_state.py | 12 +- tests/test_native_signed_factor_modes.py | 12 +- tests/test_nodal_stress_recovery.py | 10 +- tests/test_nonlinear_analysis_diagnostics.py | 6 +- tests/test_nonlinear_beam_shell_coupling.py | 18 +- tests/test_nonlinear_beam_shell_slice3.py | 76 +- .../test_nonlinear_beam_shell_slice3_batch.py | 4 +- ...onlinear_beam_shell_slice3_continuation.py | 34 +- ...beam_shell_slice3_director_continuation.py | 12 +- ...t_nonlinear_beam_shell_slice3_precision.py | 6 +- ...linear_checkpoint_guarded_normalization.py | 14 +- tests/test_nonlinear_default_globalization.py | 6 +- tests/test_nonlinear_impact_plasticity.py | 40 +- tests/test_nonlinear_performance.py | 26 +- tests/test_nonlinear_performance_batch_b.py | 26 +- tests/test_nonlinear_performance_batch_c.py | 26 +- tests/test_nonlinear_restart_checkpoint.py | 18 +- tests/test_nonlinear_speed_sweep.py | 2 +- tests/test_nonlinear_state_batches.py | 8 +- tests/test_nonlinear_state_cleanup.py | 2 +- tests/test_nonlinear_state_lifecycle.py | 14 +- tests/test_nonlinear_static_armijo.py | 14 +- .../test_nonlinear_static_state_lifecycle.py | 18 +- tests/test_nonlinear_trusted_v2d_and_token.py | 32 +- tests/test_orthotropic_elements.py | 6 +- tests/test_orthotropic_material_contract.py | 2 +- .../test_orthotropic_workflow_integration.py | 20 +- tests/test_performance_improvements.py | 22 +- tests/test_phase2.py | 10 +- tests/test_plane_stress_analytical_tangent.py | 8 +- .../test_plane_stress_stopping_consistency.py | 4 +- tests/test_plate_edge_shear.py | 6 +- tests/test_plate_stability_continuation.py | 14 +- tests/test_prepared_recovery_staging.py | 26 +- .../test_prepared_static_accounting_cache.py | 2 +- tests/test_prepared_static_contracts.py | 64 +- tests/test_prepared_static_envelopes.py | 26 +- tests/test_prepared_static_evaluator.py | 14 +- tests/test_prepared_static_independent.py | 8 +- tests/test_prepared_static_mass_capture.py | 10 +- ...t_prepared_static_pressure_verification.py | 8 +- tests/test_prepared_static_q4.py | 12 +- ...t_prepared_static_q4_compensated_policy.py | 16 +- tests/test_prepared_static_response.py | 22 +- .../test_prepared_static_response_accuracy.py | 8 +- ...repared_static_response_m11_independent.py | 2 +- tests/test_prepared_static_response_m16.py | 12 +- ...t_prepared_static_response_m16_controls.py | 2 +- tests/test_prepared_static_response_m17.py | 8 +- tests/test_prepared_static_response_m20.py | 10 +- tests/test_prepared_static_response_m21.py | 6 +- tests/test_prepared_static_response_m22.py | 10 +- tests/test_prepared_static_response_m24.py | 2 +- tests/test_prepared_static_response_m25.py | 56 +- tests/test_prepared_static_response_m26.py | 10 +- tests/test_prepared_static_response_m30.py | 24 +- tests/test_prepared_static_response_m31.py | 10 +- ...st_prepared_static_response_preparation.py | 24 +- tests/test_prepared_static_schema_scope.py | 10 +- tests/test_prepared_static_shared.py | 12 +- tests/test_production_readiness.py | 8 +- tests/test_production_validation.py | 2 +- tests/test_q4_assumed_strain_plasticity.py | 28 +- tests/test_q4_native_material_event.py | 12 +- tests/test_q4_nodal_stress_order.py | 6 +- tests/test_q4_projected_gap_lower.py | 2 +- tests/test_quadratic_beam_nonlinear.py | 10 +- ...qualified_assembly_exception_precedence.py | 6 +- tests/test_qualified_mutation_epoch.py | 16 +- tests/test_qualified_q4_assembly_authority.py | 12 +- tests/test_qualified_vector_identity.py | 10 +- tests/test_r8_b2_assembly_metrics_dev.py | 8 +- tests/test_r8_b2_assembly_series_dev.py | 2 +- tests/test_r8_b2_assembly_series_v2_dev.py | 2 +- tests/test_r8_b2_assembly_series_v3_dev.py | 2 +- tests/test_r8_b2_assembly_series_v4_dev.py | 2 +- tests/test_r8_b2_assembly_series_v5_dev.py | 2 +- tests/test_r8_b2_assembly_series_v6_dev.py | 2 +- tests/test_r8_b2_assembly_series_v7_dev.py | 2 +- tests/test_r8_b2_assembly_series_v8_dev.py | 2 +- tests/test_r8_b2_assembly_series_v9_dev.py | 4 +- .../test_r8_b2_attachment_elimination_dev.py | 8 +- tests/test_r8_b2_coo_scratch_cleanup_dev.py | 6 +- .../test_r8_b2_original_operator_20261010.py | 6 +- ...hysical_footprint_static_foundation_dev.py | 2 +- tests/test_r8_b2_q4_lifetime_dev.py | 10 +- tests/test_r8_b2_remaining_scale_dev.py | 20 +- tests/test_r8_b2_s3_physical_footprint_dev.py | 10 +- tests/test_r8_bl5_actual_mref_dev.py | 2 +- tests/test_r8_bl5_actual_primal_work_dev.py | 2 +- tests/test_r8_bl5_density_reference_dev.py | 2 +- tests/test_r8_bl5_matched_native_reference.py | 18 +- tests/test_r8_bl5_mixed_shell_h1_dev.py | 2 +- .../test_r8_bl5_projected_native_beta_dev.py | 6 +- tests/test_r8_bl5_weak_continuum_reference.py | 2 +- tests/test_r8_e01_native_polar_work.py | 12 +- tests/test_r8_e01_objective_polar_trace.py | 2 +- .../test_r8_f03_c2_signed_family_step_dev.py | 4 +- ..._f03_current_family_physical_bridge_dev.py | 2 +- tests/test_r8_f03_current_owner_parity_dev.py | 8 +- tests/test_r8_f03_finite_certificate_dev.py | 22 +- tests/test_r8_f03_sparse_signed_family_dev.py | 4 +- tests/test_r8_f03_supported_work_20261010.py | 4 +- tests/test_r8_f06_adaptive_material_dev.py | 42 +- ...compensated_state_checkpoint_repair_dev.py | 16 +- tests/test_r8_f06_compensated_state_dev.py | 26 +- tests/test_r8_f06_coupled_direction_dev.py | 8 +- ...test_r8_f06_coupled_history_unblock_dev.py | 18 +- tests/test_r8_f06_coupled_resume_dev.py | 20 +- tests/test_r8_f06_coupled_staged_dev.py | 10 +- tests/test_r8_f06_cyclic_material_dev.py | 30 +- tests/test_r8_f06_direction_fallback_dev.py | 14 +- tests/test_r8_f06_fibre_log_domain_dev.py | 24 +- tests/test_r8_f06_log_domain_dev.py | 28 +- tests/test_r8_f06_mixed_adaptive_dev.py | 28 +- ...test_r8_f06_native_material_breadth_dev.py | 28 +- tests/test_r8_f06_paired_displacement_dev.py | 20 +- tests/test_r8_f06_paired_loaded_x_dev.py | 8 +- .../test_r8_f06_paired_role_assessment_dev.py | 2 +- tests/test_r8_f06_pending_direction_dev.py | 8 +- tests/test_r8_f06_pending_resume_dev.py | 20 +- tests/test_r8_f06_reversal_dev.py | 4 +- tests/test_r8_f13_dependency_repair_dev.py | 4 +- ...test_r8_ge_merit_history_entrypoint_dev.py | 4 +- ...r8_ge_merit_interpolation_candidate_dev.py | 24 +- tests/test_r8_ge_paired_adaptive_dev.py | 24 +- .../test_r8_ge_paired_fixed_diagnostic_dev.py | 2 +- tests/test_r8_ge_saved_merit_remainder_dev.py | 2 +- tests/test_recovery_batches.py | 6 +- tests/test_recovery_qualification.py | 4 +- tests/test_recovery_shell_frames.py | 6 +- tests/test_reference_oblique_q4_plateau.py | 2 +- tests/test_relative_reference_svd.py | 4 +- tests/test_release_046_bounded.py | 7 +- tests/test_result_capsule_export.py | 22 +- tests/test_result_capsule_metadata.py | 16 +- tests/test_result_capsule_numeric.py | 28 +- tests/test_result_capsule_replay.py | 46 +- tests/test_result_capsule_runtime.py | 22 +- tests/test_result_capsule_scaling.py | 4 +- tests/test_result_quantity_first_use.py | 8 +- tests/test_result_reporting_cleanup.py | 8 +- tests/test_results_parallel_principal.py | 8 +- tests/test_results_principal_axes.py | 12 +- tests/test_results_principal_output.py | 10 +- tests/test_results_principal_validation.py | 12 +- tests/test_results_surface_component.py | 2 +- tests/test_runtime_api.py | 24 +- tests/test_s3_angle_element.py | 10 +- tests/test_s3_angle_models.py | 12 +- tests/test_s3_overlap_hermite_gap.py | 6 +- tests/test_s3_prepared_overlap.py | 8 +- tests/test_s3_pressure_hermite_bounds.py | 6 +- tests/test_s3_pressure_partition.py | 2 +- tests/test_s3_pressure_polygon_bounds.py | 4 +- tests/test_s3_r1_qualification_regression.py | 12 +- tests/test_s3_v2d_default_activation.py | 10 +- tests/test_s3_vk_element_oracle.py | 4 +- .../test_s4_candidate_a_open_qualification.py | 2 +- ...t_s4_candidate_c_quotient_qualification.py | 2 +- tests/test_s4_candidate_e0_source_gate.py | 4 +- tests/test_s4_candidate_e1_closeout.py | 14 +- tests/test_s4_director_field.py | 6 +- tests/test_s4_drill_constraint_derivation.py | 8 +- tests/test_s4_e2_a_closeout.py | 6 +- tests/test_s4_eq21_eq25_reference.py | 12 +- tests/test_s4_geometry_handoff.py | 4 +- ...test_s4_improved_qualification_closeout.py | 12 +- tests/test_s4_nullspace_semantics_proof.py | 14 +- tests/test_s4_restricted_activity.py | 4 +- tests/test_s4_restricted_integration.py | 20 +- ...t_s4_stage_m_candidate_a_discretization.py | 2 +- tests/test_sesam_fem.py | 8 +- tests/test_sestra_deep_diagnostics.py | 10 +- tests/test_sestra_mixed_mechanics.py | 14 +- tests/test_sestra_structure_benchmarks.py | 6 +- tests/test_sestra_three_case.py | 6 +- tests/test_sestra_verification.py | 11 +- tests/test_sol_ultra_comparison_script.py | 2 +- .../test_sol_ultra_numerical_verification.py | 2 +- tests/test_solid_submodel.py | 12 +- tests/test_solver_control_contracts.py | 22 +- tests/test_source_field_observer.py | 28 +- tests/test_spectral_medium_fine_benchmark.py | 2 +- tests/test_spectral_noop_checkpoints.py | 12 +- tests/test_spectral_validation_preparation.py | 10 +- ...ndard_edge_beam_shell_nonlinear_contact.py | 28 +- .../test_standard_edge_beam_shell_transfer.py | 18 +- tests/test_static_batch.py | 52 +- tests/test_static_batch_activity.py | 12 +- tests/test_static_batch_backend_counts.py | 2 +- ...tatic_batch_coupled_acceleration_guards.py | 16 +- tests/test_static_batch_inertia_relief.py | 36 +- .../test_static_batch_recovery_lease_scope.py | 26 +- tests/test_static_envelopes.py | 2 +- ...ed_shell_accepted_observer_experimental.py | 10 +- ...fened_shell_admissible_polish_candidate.py | 8 +- tests/test_stiffened_shell_arc_chart.py | 12 +- tests/test_stiffened_shell_arc_selection.py | 8 +- tests/test_stiffened_shell_arc_trial.py | 22 +- ...st_stiffened_shell_b2_affine_resolution.py | 8 +- ...st_stiffened_shell_b2_body_acceleration.py | 8 +- ...fened_shell_b2_definition_copy_protocol.py | 4 +- ...stiffened_shell_b2_definition_ownership.py | 2 +- tests/test_stiffened_shell_b2_experimental.py | 6 +- ...ened_shell_b2_footprint_reference_modes.py | 10 +- ...stiffened_shell_b2_free_reference_modes.py | 8 +- ...fened_shell_b2_mixed_panel_experimental.py | 16 +- ...tiffened_shell_b2_mixed_reference_modes.py | 14 +- ...tiffened_shell_b2_nodal_rigid_footprint.py | 14 +- ...hell_b2_physical_equilibrium_refinement.py | 2 +- ...fened_shell_b2_physical_footprint_batch.py | 10 +- ...ll_b2_physical_footprint_compile_sparse.py | 2 +- ...fened_shell_b2_physical_rigid_footprint.py | 28 +- ...iffened_shell_b2_physical_work_identity.py | 4 +- ...tiffened_shell_b2_q4_panel_experimental.py | 18 +- ...tiffened_shell_b2_q4_point_experimental.py | 4 +- ...t_stiffened_shell_b2_reference_buckling.py | 12 +- ...test_stiffened_shell_b2_reference_modes.py | 10 +- ...iffened_shell_b2_resolution_certificate.py | 6 +- ...est_stiffened_shell_bl5_affine_supports.py | 8 +- tests/test_stiffened_shell_bl5_aggregation.py | 4 +- ...st_stiffened_shell_bl5_coupled_material.py | 8 +- tests/test_stiffened_shell_bl5_distributed.py | 6 +- tests/test_stiffened_shell_bl5_finite.py | 18 +- ..._stiffened_shell_bl5_local_experimental.py | 4 +- tests/test_stiffened_shell_bl5_material.py | 6 +- ...t_stiffened_shell_bl5_projected_density.py | 8 +- .../test_stiffened_shell_bl5_staged_loads.py | 4 +- ...t_stiffened_shell_consumer_capabilities.py | 12 +- ...ed_shell_coordinate_support_work_oracle.py | 2 +- ...ffened_shell_coupled_convergence_repair.py | 10 +- ...ened_shell_coupled_predictor_accounting.py | 6 +- ...st_stiffened_shell_coupled_probe_window.py | 6 +- tests/test_stiffened_shell_curved_arc.py | 6 +- tests/test_stiffened_shell_curved_material.py | 18 +- ...est_stiffened_shell_curved_material_arc.py | 10 +- ...ffened_shell_curved_material_checkpoint.py | 6 +- ...ened_shell_curved_material_displacement.py | 10 +- ...stiffened_shell_curved_material_scaling.py | 2 +- ..._stiffened_shell_curved_material_staged.py | 10 +- ...d_shell_curved_material_staged_reversal.py | 2 +- ...t_stiffened_shell_curved_reference_seam.py | 18 +- tests/test_stiffened_shell_curved_s3_point.py | 10 +- ...t_stiffened_shell_displacement_adaptive.py | 6 +- ...stiffened_shell_displacement_checkpoint.py | 6 +- ..._stiffened_shell_displacement_corrector.py | 16 +- ..._stiffened_shell_displacement_increment.py | 4 +- ...est_stiffened_shell_displacement_public.py | 8 +- ...est_stiffened_shell_displacement_rebase.py | 10 +- ...shell_displacement_s3_checkpoint_binary.py | 6 +- ...ened_shell_distributed_material_history.py | 6 +- ..._distributed_programme_material_history.py | 4 +- ...t_stiffened_shell_distributing_adaptive.py | 8 +- ...est_stiffened_shell_distributing_cyclic.py | 10 +- ..._stiffened_shell_distributing_footprint.py | 4 +- ...ened_shell_distributing_native_material.py | 8 +- ..._shell_distributing_native_reverse_flow.py | 2 +- ...fened_shell_distributing_native_tangent.py | 4 +- .../test_stiffened_shell_distributing_pose.py | 14 +- .../test_stiffened_shell_e03_coarse_screen.py | 10 +- tests/test_stiffened_shell_e03_reference.py | 2 +- tests/test_stiffened_shell_e04_geometry.py | 4 +- tests/test_stiffened_shell_e04_material.py | 2 +- ...tiffened_shell_event_material_excursion.py | 2 +- ...t_stiffened_shell_f05_assembled_plastic.py | 6 +- ...d_shell_fibre_chart_boundary_comparison.py | 10 +- tests/test_stiffened_shell_fit_precision.py | 4 +- ...ffened_shell_footprint_increment_charts.py | 10 +- tests/test_stiffened_shell_ge_body_load.py | 2 +- ...t_stiffened_shell_ge_coordinate_support.py | 14 +- ...tiffened_shell_ge_dense_assembly_oracle.py | 12 +- ...st_stiffened_shell_ge_director_pressure.py | 10 +- ...t_stiffened_shell_ge_distributed_curved.py | 6 +- ...est_stiffened_shell_ge_distributed_load.py | 16 +- ...tiffened_shell_ge_distributed_programme.py | 10 +- ...ened_shell_ge_distributing_displacement.py | 16 +- ...ell_ge_distributing_displacement_cyclic.py | 4 +- ..._stiffened_shell_ge_distributing_finite.py | 10 +- ...ned_shell_ge_distributing_finite_public.py | 12 +- ...tiffened_shell_ge_distributing_material.py | 12 +- ...t_stiffened_shell_ge_distributing_owner.py | 16 +- ...iffened_shell_ge_distributing_reference.py | 16 +- tests/test_stiffened_shell_ge_experimental.py | 20 +- ..._stiffened_shell_ge_finite_experimental.py | 16 +- ...st_stiffened_shell_ge_footprint_gravity.py | 14 +- ...ed_shell_ge_free_reference_modal_oracle.py | 2 +- ...stiffened_shell_ge_free_reference_modes.py | 6 +- .../test_stiffened_shell_ge_gravity_owner.py | 10 +- .../test_stiffened_shell_ge_line_buckling.py | 18 +- .../test_stiffened_shell_ge_mixed_buckling.py | 22 +- ...tiffened_shell_ge_mixed_reference_modal.py | 14 +- ...est_stiffened_shell_ge_one_shell_parity.py | 4 +- tests/test_stiffened_shell_ge_owned_rebase.py | 12 +- ...tiffened_shell_ge_physical_fibre_finite.py | 38 +- ...tiffened_shell_ge_physical_fibre_linear.py | 30 +- .../test_stiffened_shell_ge_point_buckling.py | 16 +- ...est_stiffened_shell_ge_pressure_context.py | 8 +- .../test_stiffened_shell_ge_pressure_owner.py | 18 +- ...ed_shell_ge_pressure_vector_equilibrium.py | 8 +- ...test_stiffened_shell_ge_reference_modal.py | 6 +- ...iffened_shell_ge_reference_modal_oracle.py | 4 +- tests/test_stiffened_shell_ge_rigid_motion.py | 4 +- ...stiffened_shell_ge_s3_checkpoint_binary.py | 2 +- ...est_stiffened_shell_ge_selective_rebase.py | 14 +- ...ened_shell_generalized_recovery_records.py | 8 +- .../test_stiffened_shell_increment_control.py | 40 +- ...tiffened_shell_l1_assembly_experimental.py | 12 +- ...t_stiffened_shell_l1_local_experimental.py | 2 +- ...test_stiffened_shell_material_reference.py | 4 +- ...ffened_shell_material_rotation_numerics.py | 10 +- tests/test_stiffened_shell_native_arc.py | 18 +- ...est_stiffened_shell_native_arc_progress.py | 10 +- ...ed_shell_native_beam_rebase_predecessor.py | 4 +- tests/test_stiffened_shell_native_capacity.py | 4 +- ...fened_shell_native_coupled_displacement.py | 8 +- ...stiffened_shell_native_coupled_material.py | 22 +- ...ffened_shell_native_director_arc_metric.py | 32 +- ...ened_shell_native_displacement_adaptive.py | 16 +- ...iffened_shell_native_displacement_chart.py | 10 +- ...stiffened_shell_native_distributed_load.py | 20 +- .../test_stiffened_shell_native_fibre_bl5.py | 12 +- ...iffened_shell_native_fibre_bl5_material.py | 24 +- ...est_stiffened_shell_native_fibre_bl5_s3.py | 4 +- ...hell_native_fibre_chart_transport_exact.py | 2 +- ...est_stiffened_shell_native_fibre_energy.py | 10 +- ...ened_shell_native_fibre_s3_displacement.py | 14 +- ...l_native_fibre_s3_displacement_identity.py | 14 +- ...ened_shell_native_fold_local_diagnostic.py | 4 +- ...ell_native_generalized_adaptive_history.py | 4 +- ..._shell_native_generalized_q4_j2_history.py | 6 +- tests/test_stiffened_shell_native_gravity.py | 12 +- ...stiffened_shell_native_material_bl5_arc.py | 24 +- ...l_native_mixed_j2_displacement_snapshot.py | 4 +- ...st_stiffened_shell_native_plastic_chart.py | 4 +- ...ed_shell_native_plastic_s3_displacement.py | 12 +- ...iffened_shell_native_point_displacement.py | 14 +- ...ned_shell_native_point_precision_policy.py | 6 +- ...ened_shell_native_proportional_capacity.py | 4 +- ..._stiffened_shell_native_s3_displacement.py | 8 +- ..._shell_native_s3_displacement_admission.py | 2 +- ...t_stiffened_shell_native_s3_fibre_chart.py | 12 +- ...tiffened_shell_native_s3_fibre_reversal.py | 8 +- ...iffened_shell_native_s3_replay_rounding.py | 4 +- ...t_stiffened_shell_nodal_rigid_footprint.py | 30 +- ...iffened_shell_physical_fibre_j2_history.py | 8 +- .../test_stiffened_shell_physical_q4_mass.py | 2 +- .../test_stiffened_shell_physical_s3_mass.py | 2 +- tests/test_stiffened_shell_point_recovery.py | 10 +- ...stiffened_shell_q4_algorithmic_pullback.py | 10 +- ...est_stiffened_shell_q4_correction_reuse.py | 10 +- .../test_stiffened_shell_q4_pullback_owner.py | 6 +- ...test_stiffened_shell_q4_reference_reuse.py | 14 +- ..._stiffened_shell_q4_rotation_arithmetic.py | 10 +- ...stiffened_shell_s3_algorithmic_pullback.py | 10 +- ..._stiffened_shell_s3_dead_work_candidate.py | 6 +- ...hell_s3_displacement_arc_policy_binding.py | 10 +- ...ened_shell_s3_generalized_stable_policy.py | 18 +- .../test_stiffened_shell_s3_stable_elastic.py | 6 +- .../test_stiffened_shell_same_parent_trial.py | 16 +- .../test_stiffened_shell_selected_recovery.py | 4 +- ...ell_staged_load_definition_experimental.py | 4 +- ...ed_shell_staged_load_owner_experimental.py | 10 +- ...stiffened_shell_staged_material_history.py | 8 +- ...t_stiffened_shell_staged_zero_reference.py | 16 +- ...t_stiffened_shell_stress_free_reference.py | 10 +- tests/test_stiffened_shell_yield_limits.py | 14 +- tests/test_storage_prediction_source.py | 16 +- tests/test_submodel_transfer.py | 22 +- tests/test_supported_rigid_mode_memory.py | 12 +- tests/test_threading_policy.py | 18 +- tests/test_transient_reduced_output.py | 10 +- tests/test_vectorized_hill48.py | 22 +- tests/test_wave_surface_regions.py | 20 +- tools/marine_w6/runner.py | 28 +- 2960 files changed, 27698 insertions(+), 26144 deletions(-) rename {src/anysolver_results => packages/results/src/anyfesolver_results}/__init__.py (84%) rename {src/anysolver_results => packages/results/src/anyfesolver_results}/capsule.py (100%) rename {src/anysolver_results => packages/results/src/anyfesolver_results}/errors.py (75%) rename {src/anysolver_results => packages/results/src/anyfesolver_results}/formulas.py (95%) rename {src/anysolver_results => packages/results/src/anyfesolver_results}/principals.py (100%) rename {src/anysolver_results => packages/results/src/anyfesolver_results}/registry.py (98%) rename {src/anysolver_results => packages/results/src/anyfesolver_results}/storage_validation.py (100%) create mode 100644 scripts/verify_release_050.py rename src/{anysolver => anyfesolver}/__init__.py (99%) rename src/{anysolver => anyfesolver}/_b2_attachment_elimination_dev.py (100%) rename src/{anysolver => anyfesolver}/_b2_f10_f11_point_attachment.py (100%) rename src/{anysolver => anyfesolver}/_b2_loaded_point_trace_dev.py (100%) rename src/{anysolver => anyfesolver}/_b2_physical_flexibility_linear.py (100%) rename src/{anysolver => anyfesolver}/_b2_physical_linear_batch_dev.py (100%) rename src/{anysolver => anyfesolver}/_b2_physical_linear_definition.py (100%) rename src/{anysolver => anyfesolver}/_b2_physical_load_bubbles.py (100%) rename src/{anysolver => anyfesolver}/_compensated_contractions.py (97%) rename src/{anysolver => anyfesolver}/_compensated_native.py (100%) rename src/{anysolver => anyfesolver}/_corotational_batch.py (100%) rename src/{anysolver => anyfesolver}/_director_trace.py (100%) rename src/{anysolver => anyfesolver}/_dyadic_bilinear.py (100%) rename src/{anysolver => anyfesolver}/_dyadic_factor_chain.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_adaptive_arc_program.py (96%) rename src/{anysolver => anyfesolver}/_ge_beam3_analysis_combined.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_analysis_fibre_translation.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_analysis_modal_snapshot.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_analysis_nodal_program.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_analysis_translation.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_analysis_translation_modal.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_arc_geometry.py (98%) rename src/{anysolver => anyfesolver}/_ge_beam3_arc_program.py (94%) rename src/{anysolver => anyfesolver}/_ge_beam3_authoritative_cell_seed.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_cell_identity.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_centered_batched_finite_inertia.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_centered_finite_inertia.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_centered_mixed.py (90%) rename src/{anysolver => anyfesolver}/_ge_beam3_centered_reference.py (98%) rename src/{anysolver => anyfesolver}/_ge_beam3_centered_so3_strain.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_complementary_section.py (94%) rename src/{anysolver => anyfesolver}/_ge_beam3_compliance_snapshot_guard.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_connected_dynamic.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_connected_trajectory.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_conservative_backtrack.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_controlled_fibre_modes.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_coupled_beam_subdomain.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_coupled_modes.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_deterministic_reduction.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_displacement_program.py (95%) rename src/{anysolver => anyfesolver}/_ge_beam3_durable_coupled.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_dynamic_elastic_state.py (98%) rename src/{anysolver => anyfesolver}/_ge_beam3_effective_deadline.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_elastic_seed_continuation.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_elastic_seed_modal.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_equilibrium_line_program.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_equilibrium_schur_solver.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_factor_chain_modes.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_fibre_cell.py (98%) rename src/{anysolver => anyfesolver}/_ge_beam3_fibre_distributed_couples.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_fibre_kinematic_cell.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_fibre_line_program.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_fibre_line_work.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_fibre_reference_modal.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_fibre_schur_solver.py (98%) rename src/{anysolver => anyfesolver}/_ge_beam3_fibre_section.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_fibre_static_boundary.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g1_analysis.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g1_elastic.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g1_element.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g1_operator.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g2_analysis.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g2_constraints.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3_analysis.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3_constraints.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3b_owner.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3b_q4_reference.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3b_reference.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3b_result_schema.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3b_s3_reference.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3b_weighted_reference.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3c_affine_q4_chart.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3c_affine_q4_increment_chart.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3c_affine_q4_recovery.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3c_affine_q4_registry.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3c_b2_physical.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3c_b2_physical_adapter.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3c_definition.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3c_local_beam.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3c_local_shell.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3c_owner.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3c_physical_authority.py (88%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3c_physical_owner.py (94%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3c_recovery.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3c_so3_numerics.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3c_stable/__init__.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3c_stable/authority.py (93%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3c_stable/beam.py (92%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3c_stable/boundary.py (87%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3c_stable/chart.py (84%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3c_stable/compensated.py (92%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3c_stable/element.py (94%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3c_stable/fit.py (98%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3c_stable/joint.py (95%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3c_stable/line_work.py (85%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3c_stable/operator.py (84%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3c_stable/owner.py (93%) rename src/{anysolver => anyfesolver}/_ge_beam3_g3c_stable/shell.py (96%) rename src/{anysolver => anyfesolver}/_ge_beam3_g4_completion.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g4a_station_transaction.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g5_completion.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_g6_domain.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_generalized_cell.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_generalized_ellipsoid_section.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_generalized_static_boundary.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_lifted_kinetic_factor.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_line_fibre_modes.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_load_program.py (95%) rename src/{anysolver => anyfesolver}/_ge_beam3_loaded_modal.py (93%) rename src/{anysolver => anyfesolver}/_ge_beam3_mixed_ad.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_analysis.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_arc.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_arc_adaptive.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_arc_restart.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_arc_source.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_buckling.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_combined_couples.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_combined_restart.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_definition.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_distributed_element.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_distributed_loading.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_distributed_program.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_distributed_recovery.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_distributed_restart.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_dynamic_analysis.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_dynamic_restart.py (98%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_fibre_current_modal.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_fibre_recovery.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_fibre_restart.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_fibre_static_element.py (98%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_force_adaptation.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_generalized_combined_couples.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_generalized_combined_restart.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_generalized_element.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_generalized_factor_modal.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_generalized_loading.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_generalized_modal.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_generalized_paired_modal.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_generalized_parameter.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_generalized_program.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_generalized_recovery.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_generalized_restart.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_history_profile.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_line_loading.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_line_program.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_line_recovery.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_line_restart.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_line_static_element.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_load_admission.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_midpoint.py (99%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_multi_shell_contact.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_pair_contact.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_shell_contact.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_spatial_couples.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_spatial_restart.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_transient.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_translation.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_native_translation_restart.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_operator_validation_scope.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5/__init__.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5/algebra.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5/arrays.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5/chart.py (97%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5/codec.py (96%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5/committed_modal.py (94%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5/compensated.py (95%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5/compensated_coordinates.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5/core.py (98%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5/element.py (97%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5/factors.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5/inertia.py (97%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5/mass.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5/mixed.py (97%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5/reference_modal.py (90%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5/section.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5/typed_schema.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5_centered/__init__.py (72%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5_centered/codec.py (96%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5_centered/committed_modal.py (94%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5_centered/core.py (94%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5_centered/element.py (97%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5_centered/mass.py (92%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5_centered/positions.py (88%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5_centered/reference_modal.py (91%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5_coordinates/__init__.py (72%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5_coordinates/codec.py (96%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5_coordinates/committed_modal.py (94%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5_coordinates/core.py (95%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5_coordinates/element.py (97%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5_coordinates/positions.py (95%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5_coordinates/reference_modal.py (89%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5_loads/__init__.py (77%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5_loads/codec.py (96%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5_loads/core.py (94%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5_loads/element.py (96%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5_loads/state.py (98%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5_loads/work.py (88%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5_seeded/__init__.py (84%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5_seeded/codec.py (96%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5_seeded/core.py (93%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5_seeded/element.py (96%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5_seeded/state.py (98%) rename src/{anysolver => anyfesolver}/_ge_beam3_p5_seeded/work.py (88%) rename src/{anysolver => anyfesolver}/_ge_beam3_pose_joint.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_precise_geometric_work.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_reassembled_signed_modes.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_reference_identity.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_refined_fibre_schur_solver.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_refinement_capacity.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_relative_virgin_reference_modes.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_retained_arc.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_retained_arc_geometry.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_retained_arc_modal.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_retained_elastic.py (95%) rename src/{anysolver => anyfesolver}/_ge_beam3_retained_fibre.py (98%) rename src/{anysolver => anyfesolver}/_ge_beam3_retained_fibre_control.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_retained_fibre_element.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_retained_fibre_modal.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_retained_fibre_modes.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_retained_fibre_program.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_retained_fibre_state.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_retained_force_program.py (94%) rename src/{anysolver => anyfesolver}/_ge_beam3_retained_generalized.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_retained_generalized_modal.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_retained_generalized_program.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_retained_generalized_state.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_retained_nodal_loading.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_retained_plastic.py (90%) rename src/{anysolver => anyfesolver}/_ge_beam3_retained_plastic_modes.py (94%) rename src/{anysolver => anyfesolver}/_ge_beam3_retained_plastic_program.py (95%) rename src/{anysolver => anyfesolver}/_ge_beam3_retained_plastic_state.py (95%) rename src/{anysolver => anyfesolver}/_ge_beam3_retained_state.py (95%) rename src/{anysolver => anyfesolver}/_ge_beam3_retained_translation_control.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_retained_translation_modal.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_schur_line_program.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_seeded_fibre_control.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_seeded_load_program.py (95%) rename src/{anysolver => anyfesolver}/_ge_beam3_seeded_loaded_modal.py (93%) rename src/{anysolver => anyfesolver}/_ge_beam3_seeded_signed_modes.py (96%) rename src/{anysolver => anyfesolver}/_ge_beam3_shared_kinematic_split.py (91%) rename src/{anysolver => anyfesolver}/_ge_beam3_shell_joint_state.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_shell_joint_trial.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_signed_loaded_modes.py (96%) rename src/{anysolver => anyfesolver}/_ge_beam3_spatial_fibre_program.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_spatial_nodal_moments.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_station_resultant_cell.py (100%) rename src/{anysolver => anyfesolver}/_ge_beam3_variational_shell.py (98%) rename src/{anysolver => anyfesolver}/_ge_beam3_virgin_reference_modes.py (100%) rename src/{anysolver => anyfesolver}/_impact_coupling.py (100%) rename src/{anysolver => anyfesolver}/_native_authority_dag.py (100%) rename src/{anysolver => anyfesolver}/_native_dyadic_interval_inertia.py (100%) rename src/{anysolver => anyfesolver}/_native_exact_shift_chain_modes.py (100%) rename src/{anysolver => anyfesolver}/_native_exact_shift_inertia.py (100%) rename src/{anysolver => anyfesolver}/_native_factor_chain_modes.py (97%) rename src/{anysolver => anyfesolver}/_native_guard.cpp (97%) rename src/{anysolver => anyfesolver}/_native_guard_dispatch.py (96%) rename src/{anysolver => anyfesolver}/_native_large_factor_chain.py (100%) rename src/{anysolver => anyfesolver}/_native_material_protocol.py (100%) rename src/{anysolver => anyfesolver}/_native_midpoint_controller.py (100%) rename src/{anysolver => anyfesolver}/_native_modal_capacity.py (100%) rename src/{anysolver => anyfesolver}/_native_paired_factor_chain_modes.py (97%) rename src/{anysolver => anyfesolver}/_native_reassembled_factor_modes.py (97%) rename src/{anysolver => anyfesolver}/_native_reference_factor_spectrum.py (100%) rename src/{anysolver => anyfesolver}/_native_reference_modal.py (100%) rename src/{anysolver => anyfesolver}/_native_relative_factor_chain_modes.py (97%) rename src/{anysolver => anyfesolver}/_native_relative_reference_factor_spectrum.py (100%) rename src/{anysolver => anyfesolver}/_native_retained_step.py (100%) rename src/{anysolver => anyfesolver}/_native_rotation_state.py (99%) rename src/{anysolver => anyfesolver}/_native_signed_factor_modes.py (100%) rename src/{anysolver => anyfesolver}/_native_signed_kinetic_factor_modes.py (100%) rename src/{anysolver => anyfesolver}/_native_stationary_spectrum.py (100%) rename src/{anysolver => anyfesolver}/_nonlinear_events.py (100%) rename src/{anysolver => anyfesolver}/_nonlinear_seed.py (100%) rename src/{anysolver => anyfesolver}/_paired_modal_arithmetic.py (100%) rename src/{anysolver => anyfesolver}/_plate_stability_continuation.py (100%) rename src/{anysolver => anyfesolver}/_q4_assumed_strain_plasticity.py (100%) rename src/{anysolver => anyfesolver}/_qualified_authority_epoch.py (100%) rename src/{anysolver => anyfesolver}/_relative_reference_svd.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_affine_endpoint.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_algorithmic_pullback.py (98%) rename src/{anysolver => anyfesolver}/_stiffened_shell_arc_checkpoint.py (99%) rename src/{anysolver => anyfesolver}/_stiffened_shell_arc_control.py (98%) rename src/{anysolver => anyfesolver}/_stiffened_shell_arc_metric.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_arc_publication.py (98%) rename src/{anysolver => anyfesolver}/_stiffened_shell_arc_trial.py (98%) rename src/{anysolver => anyfesolver}/_stiffened_shell_b2_affine_resolution.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_b2_assembly_diagnostics.py (80%) rename src/{anysolver => anyfesolver}/_stiffened_shell_b2_definition_ownership.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_b2_experimental.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_b2_nodal_footprint.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_b2_physical_rigid_footprint.py (98%) rename src/{anysolver => anyfesolver}/_stiffened_shell_b2_q4_panel_experimental.py (98%) rename src/{anysolver => anyfesolver}/_stiffened_shell_b2_q4_point_experimental.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_b2_reference_buckling.py (98%) rename src/{anysolver => anyfesolver}/_stiffened_shell_b3_chart.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_b3_local_adapter.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_beam_history.py (98%) rename src/{anysolver => anyfesolver}/_stiffened_shell_bl5_local_experimental.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_bl5_native_elastic.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_branch_event_trial.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_consumer_capabilities.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_coordinate_support.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_displacement_adaptive.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_displacement_checkpoint.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_displacement_control.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_displacement_corrector.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_displacement_increment.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_distributing_footprint.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_distributing_pose.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_f06_increment_arithmetic.py (98%) rename src/{anysolver => anyfesolver}/_stiffened_shell_ge_body_load.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_ge_checkpoint_binary.py (99%) rename src/{anysolver => anyfesolver}/_stiffened_shell_ge_distributed_load.py (98%) rename src/{anysolver => anyfesolver}/_stiffened_shell_ge_distributed_programme.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_ge_distributing_finite.py (98%) rename src/{anysolver => anyfesolver}/_stiffened_shell_ge_distributing_reference.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_ge_experimental.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_ge_finite_experimental.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_ge_mixed_modal_mass.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_ge_point_buckling.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_ge_pressure_load.py (99%) rename src/{anysolver => anyfesolver}/_stiffened_shell_ge_reference_modal.py (98%) rename src/{anysolver => anyfesolver}/_stiffened_shell_generalized_recovery.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_increment_control.py (98%) rename src/{anysolver => anyfesolver}/_stiffened_shell_l1_assembly_experimental.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_l1_local_experimental.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_l1_supported_work_experimental.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_native_distributed_load.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_native_gravity.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_nodal_footprint.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_physical_q4_mass.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_physical_s3_mass.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_point_recovery.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_q4_algorithmic_pullback.py (98%) rename src/{anysolver => anyfesolver}/_stiffened_shell_q4_material_event.py (98%) rename src/{anysolver => anyfesolver}/_stiffened_shell_q4_reference.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_rotation_charts.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_s3_algorithmic_pullback.py (98%) rename src/{anysolver => anyfesolver}/_stiffened_shell_s3_conservative_buckling.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_s3_dead_work_candidate.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_s3_material_event.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_same_parent_trial.py (99%) rename src/{anysolver => anyfesolver}/_stiffened_shell_selected_recovery.py (100%) rename src/{anysolver => anyfesolver}/_stiffened_shell_staged_load_experimental.py (98%) rename src/{anysolver => anyfesolver}/_stiffened_shell_stress_free_reference.py (100%) create mode 100644 src/anyfesolver/_wire_types.py rename src/{anysolver => anyfesolver}/activity.py (100%) rename src/{anysolver => anyfesolver}/algebraic_dynamics.py (100%) rename src/{anysolver => anyfesolver}/analysis_session.py (99%) rename src/{anysolver => anyfesolver}/anystructure_fem_mode.py (99%) rename src/{anysolver => anyfesolver}/arc_length.py (99%) rename src/{anysolver => anyfesolver}/assembly.py (99%) rename src/{anysolver => anyfesolver}/b3_ge.py (100%) rename src/{anysolver => anyfesolver}/baselines.py (100%) rename src/{anysolver => anyfesolver}/beam_sections.py (100%) rename src/{anysolver => anyfesolver}/beam_shell_verification.py (99%) rename src/{anysolver => anyfesolver}/beam_validity.py (100%) rename src/{anysolver => anyfesolver}/benchmarks.py (100%) rename src/{anysolver => anyfesolver}/boundary.py (99%) rename src/{anysolver => anyfesolver}/buckling.py (99%) rename src/{anysolver => anyfesolver}/buckling_validity.py (100%) rename src/{anysolver => anyfesolver}/capacity_workflow.py (100%) rename src/{anysolver => anyfesolver}/capsule_runtime_guard.py (95%) rename src/{anysolver => anyfesolver}/cases.py (100%) rename src/{anysolver => anyfesolver}/composite_strip_verification.py (100%) rename src/{anysolver => anyfesolver}/concentrated_mass.py (100%) rename src/{anysolver => anyfesolver}/constraint_audit.py (99%) rename src/{anysolver => anyfesolver}/contact.py (100%) rename src/{anysolver => anyfesolver}/contact_performance.py (99%) rename src/{anysolver => anyfesolver}/control.py (98%) rename src/{anysolver => anyfesolver}/corotational.py (100%) rename src/{anysolver => anyfesolver}/corotational_performance.py (100%) rename src/{anysolver => anyfesolver}/current_state_tangent.py (100%) rename src/{anysolver => anyfesolver}/cylinder_benchmarks.py (100%) rename src/{anysolver => anyfesolver}/damage_matrix_performance.py (100%) rename src/{anysolver => anyfesolver}/dynamics.py (100%) rename src/{anysolver => anyfesolver}/e4_pl_element.py (99%) rename src/{anysolver => anyfesolver}/e4_pl_enriched.py (100%) rename src/{anysolver => anyfesolver}/e4_pl_enriched_nonlinear.py (100%) rename src/{anysolver => anyfesolver}/e4_pl_s3_element.py (99%) rename src/{anysolver => anyfesolver}/e4_pl_s3_initial_fields.py (97%) rename src/{anysolver => anyfesolver}/e4_pl_s3_state.py (100%) rename src/{anysolver => anyfesolver}/e4_pl_s3_v2_element.py (100%) rename src/{anysolver => anyfesolver}/e4_pl_s3_v2b_element.py (100%) rename src/{anysolver => anyfesolver}/e4_pl_s3_v2c_element.py (100%) rename src/{anysolver => anyfesolver}/e4_pl_s3_v2d_element.py (100%) rename src/{anysolver => anyfesolver}/e4_pl_s3_v2d_state.py (100%) rename src/{anysolver => anyfesolver}/element_capabilities.py (100%) rename src/{anysolver => anyfesolver}/element_qualification.py (100%) rename src/{anysolver => anyfesolver}/elements.py (97%) rename src/{anysolver => anyfesolver}/experimental_csr_assembly.py (99%) rename src/{anysolver => anyfesolver}/external_references.py (100%) rename src/{anysolver => anyfesolver}/fe_core.py (100%) rename src/{anysolver => anyfesolver}/floating_pressure_regions.py (100%) rename src/{anysolver => anyfesolver}/floating_response.py (100%) rename src/{anysolver => anyfesolver}/floating_transient.py (100%) rename src/{anysolver => anyfesolver}/fracture.py (100%) rename src/{anysolver => anyfesolver}/ge_beam3_curved_reference.py (99%) rename src/{anysolver => anyfesolver}/ge_beam3_element.py (99%) rename src/{anysolver => anyfesolver}/ge_beam3_mixed_element.py (100%) rename src/{anysolver => anyfesolver}/ge_beam3_mixed_state.py (100%) rename src/{anysolver => anyfesolver}/ge_beam3_native.py (100%) rename src/{anysolver => anyfesolver}/ge_beam3_native_connected_dynamics.py (100%) rename src/{anysolver => anyfesolver}/ge_beam3_native_dynamics.py (100%) rename src/{anysolver => anyfesolver}/ge_beam3_state.py (100%) rename src/{anysolver => anyfesolver}/general_contact/__init__.py (100%) rename src/{anysolver => anyfesolver}/general_contact/_enriched_multitarget_empty.py (100%) rename src/{anysolver => anyfesolver}/general_contact/_enriched_multitarget_trial.py (93%) rename src/{anysolver => anyfesolver}/general_contact/_results_archive_common.py (97%) rename src/{anysolver => anyfesolver}/general_contact/algebraic_path.py (100%) rename src/{anysolver => anyfesolver}/general_contact/arc_contact.py (100%) rename src/{anysolver => anyfesolver}/general_contact/arc_results_archive.py (95%) rename src/{anysolver => anyfesolver}/general_contact/augmentation.py (100%) rename src/{anysolver => anyfesolver}/general_contact/automatic_domain.py (99%) rename src/{anysolver => anyfesolver}/general_contact/beam_chain_consistent.py (100%) rename src/{anysolver => anyfesolver}/general_contact/beam_chain_end_geometry.py (100%) rename src/{anysolver => anyfesolver}/general_contact/beam_chain_ends.py (100%) rename src/{anysolver => anyfesolver}/general_contact/beam_chain_pair.py (99%) rename src/{anysolver => anyfesolver}/general_contact/beam_curve_end_geometry.py (100%) rename src/{anysolver => anyfesolver}/general_contact/beam_curve_ends.py (100%) rename src/{anysolver => anyfesolver}/general_contact/beam_curve_pair.py (99%) rename src/{anysolver => anyfesolver}/general_contact/beam_curve_pair_static.py (99%) rename src/{anysolver => anyfesolver}/general_contact/beam_end_radial_geometry.py (100%) rename src/{anysolver => anyfesolver}/general_contact/beam_end_topology.py (100%) rename src/{anysolver => anyfesolver}/general_contact/beam_hemisphere_coupled_tool.py (100%) rename src/{anysolver => anyfesolver}/general_contact/beam_hemisphere_cylinder.py (100%) rename src/{anysolver => anyfesolver}/general_contact/beam_hemisphere_cylinder_motion.py (100%) rename src/{anysolver => anyfesolver}/general_contact/beam_hemisphere_cylinder_work.py (99%) rename src/{anysolver => anyfesolver}/general_contact/beam_hemisphere_plane.py (100%) rename src/{anysolver => anyfesolver}/general_contact/beam_hemisphere_s3_support.py (99%) rename src/{anysolver => anyfesolver}/general_contact/beam_hemisphere_sphere.py (100%) rename src/{anysolver => anyfesolver}/general_contact/beam_hemisphere_sphere_work.py (99%) rename src/{anysolver => anyfesolver}/general_contact/beam_hemisphere_support.py (99%) rename src/{anysolver => anyfesolver}/general_contact/beam_pair.py (99%) rename src/{anysolver => anyfesolver}/general_contact/beam_pair_end_geometry.py (100%) rename src/{anysolver => anyfesolver}/general_contact/beam_pair_ends.py (99%) rename src/{anysolver => anyfesolver}/general_contact/beam_plane.py (99%) rename src/{anysolver => anyfesolver}/general_contact/beam_radial.py (100%) rename src/{anysolver => anyfesolver}/general_contact/beam_radial_ends.py (100%) rename src/{anysolver => anyfesolver}/general_contact/beam_s3_directional_rates.py (100%) rename src/{anysolver => anyfesolver}/general_contact/beam_s3_rotational_transient.py (100%) rename src/{anysolver => anyfesolver}/general_contact/beam_s3_transient.py (100%) rename src/{anysolver => anyfesolver}/general_contact/beam_shell.py (98%) rename src/{anysolver => anyfesolver}/general_contact/beam_shell_patch.py (98%) rename src/{anysolver => anyfesolver}/general_contact/beam_temporal_bounds.py (100%) rename src/{anysolver => anyfesolver}/general_contact/capability.py (100%) rename src/{anysolver => anyfesolver}/general_contact/capped_cylinder.py (100%) rename src/{anysolver => anyfesolver}/general_contact/contact_search.py (98%) rename src/{anysolver => anyfesolver}/general_contact/core.py (98%) rename src/{anysolver => anyfesolver}/general_contact/curved_s3_q4_work.py (100%) rename src/{anysolver => anyfesolver}/general_contact/curved_shell_skin.py (99%) rename src/{anysolver => anyfesolver}/general_contact/d1_interior_profile.py (99%) rename src/{anysolver => anyfesolver}/general_contact/deformable_beam_s3_caps.py (100%) rename src/{anysolver => anyfesolver}/general_contact/deformable_beam_s3_line.py (99%) rename src/{anysolver => anyfesolver}/general_contact/deformable_beam_s3_static.py (100%) rename src/{anysolver => anyfesolver}/general_contact/descriptor_rates.py (100%) rename src/{anysolver => anyfesolver}/general_contact/enriched_cold_predictor.py (99%) rename src/{anysolver => anyfesolver}/general_contact/enriched_moment_batch.py (100%) rename src/{anysolver => anyfesolver}/general_contact/enriched_multitarget.py (99%) rename src/{anysolver => anyfesolver}/general_contact/enriched_multitarget_gap.py (99%) rename src/{anysolver => anyfesolver}/general_contact/enriched_multitarget_moments.py (100%) rename src/{anysolver => anyfesolver}/general_contact/enriched_multitarget_topology.py (100%) rename src/{anysolver => anyfesolver}/general_contact/enriched_nonlinear.py (97%) rename src/{anysolver => anyfesolver}/general_contact/enriched_overlap.py (98%) rename src/{anysolver => anyfesolver}/general_contact/enriched_path.py (98%) rename src/{anysolver => anyfesolver}/general_contact/enriched_small_cut.py (100%) rename src/{anysolver => anyfesolver}/general_contact/enriched_static.py (97%) rename src/{anysolver => anyfesolver}/general_contact/enriched_union.py (100%) rename src/{anysolver => anyfesolver}/general_contact/equilibrated_pressure_pivot.py (98%) rename src/{anysolver => anyfesolver}/general_contact/event_subdivision.py (100%) rename src/{anysolver => anyfesolver}/general_contact/finite_mixed_state.py (95%) rename src/{anysolver => anyfesolver}/general_contact/finite_rigid_patch.py (99%) rename src/{anysolver => anyfesolver}/general_contact/finite_rigid_support.py (100%) rename src/{anysolver => anyfesolver}/general_contact/finite_rigid_sweep.py (100%) rename src/{anysolver => anyfesolver}/general_contact/finite_rotation_predictor.py (99%) rename src/{anysolver => anyfesolver}/general_contact/finite_rotation_skin.py (100%) rename src/{anysolver => anyfesolver}/general_contact/finite_rotation_state.py (97%) rename src/{anysolver => anyfesolver}/general_contact/finite_rotation_sweep.py (100%) rename src/{anysolver => anyfesolver}/general_contact/finite_v2d_state.py (98%) rename src/{anysolver => anyfesolver}/general_contact/fixed_projection_graph.py (100%) rename src/{anysolver => anyfesolver}/general_contact/fixed_projection_s3_events.py (100%) rename src/{anysolver => anyfesolver}/general_contact/free_rigid.py (100%) rename src/{anysolver => anyfesolver}/general_contact/friction_point.py (100%) rename src/{anysolver => anyfesolver}/general_contact/gap_extrema.py (100%) rename src/{anysolver => anyfesolver}/general_contact/guided_pair_transient_geometry.py (100%) rename src/{anysolver => anyfesolver}/general_contact/initial_contact_seed.py (99%) rename src/{anysolver => anyfesolver}/general_contact/linearized_pivot.py (99%) rename src/{anysolver => anyfesolver}/general_contact/material_work_diagnostics.py (100%) rename src/{anysolver => anyfesolver}/general_contact/moment_batch_ad.py (99%) rename src/{anysolver => anyfesolver}/general_contact/moment_batch_points.py (98%) rename src/{anysolver => anyfesolver}/general_contact/moving.py (100%) rename src/{anysolver => anyfesolver}/general_contact/multiple_beam_rigid.py (100%) rename src/{anysolver => anyfesolver}/general_contact/multiple_beam_s3_caps.py (100%) rename src/{anysolver => anyfesolver}/general_contact/multiple_beam_s3_transient.py (98%) rename src/{anysolver => anyfesolver}/general_contact/multiple_projected_pairs.py (100%) rename src/{anysolver => anyfesolver}/general_contact/multiple_shell_planes.py (99%) rename src/{anysolver => anyfesolver}/general_contact/native_activation_static.py (98%) rename src/{anysolver => anyfesolver}/general_contact/native_checkpoint_results.py (100%) rename src/{anysolver => anyfesolver}/general_contact/native_curve_union.py (99%) rename src/{anysolver => anyfesolver}/general_contact/native_curved_geometry.py (99%) rename src/{anysolver => anyfesolver}/general_contact/native_curved_pair_partition.py (100%) rename src/{anysolver => anyfesolver}/general_contact/native_curved_plane_work.py (99%) rename src/{anysolver => anyfesolver}/general_contact/native_curved_s3_work.py (98%) rename src/{anysolver => anyfesolver}/general_contact/native_event_polynomial.py (100%) rename src/{anysolver => anyfesolver}/general_contact/native_fibre_context.py (90%) rename src/{anysolver => anyfesolver}/general_contact/native_fibre_results.py (96%) rename src/{anysolver => anyfesolver}/general_contact/native_initial_guess.py (98%) rename src/{anysolver => anyfesolver}/general_contact/native_material_activation.py (98%) rename src/{anysolver => anyfesolver}/general_contact/native_material_plane.py (98%) rename src/{anysolver => anyfesolver}/general_contact/native_material_s3.py (99%) rename src/{anysolver => anyfesolver}/general_contact/native_multi_s3_static.py (98%) rename src/{anysolver => anyfesolver}/general_contact/native_normal_angles.py (100%) rename src/{anysolver => anyfesolver}/general_contact/native_pair_error_budget.py (100%) rename src/{anysolver => anyfesolver}/general_contact/native_replay_arithmetic.py (100%) rename src/{anysolver => anyfesolver}/general_contact/native_replay_diagnostics.py (100%) rename src/{anysolver => anyfesolver}/general_contact/native_retained_body_junction.py (100%) rename src/{anysolver => anyfesolver}/general_contact/native_retained_body_pair.py (99%) rename src/{anysolver => anyfesolver}/general_contact/native_retained_body_projection.py (100%) rename src/{anysolver => anyfesolver}/general_contact/native_retained_body_static.py (97%) rename src/{anysolver => anyfesolver}/general_contact/native_retained_cell_pair.py (98%) rename src/{anysolver => anyfesolver}/general_contact/native_retained_curve_cell.py (94%) rename src/{anysolver => anyfesolver}/general_contact/native_retained_line_plane.py (97%) rename src/{anysolver => anyfesolver}/general_contact/native_retained_line_s3.py (99%) rename src/{anysolver => anyfesolver}/general_contact/native_retained_line_s3_work.py (98%) rename src/{anysolver => anyfesolver}/general_contact/native_retained_pair_static.py (98%) rename src/{anysolver => anyfesolver}/general_contact/native_retained_s3_static.py (97%) rename src/{anysolver => anyfesolver}/general_contact/native_retained_static.py (97%) rename src/{anysolver => anyfesolver}/general_contact/native_retained_station.py (97%) rename src/{anysolver => anyfesolver}/general_contact/native_retained_whole_pair.py (99%) rename src/{anysolver => anyfesolver}/general_contact/native_s3_swept.py (100%) rename src/{anysolver => anyfesolver}/general_contact/native_shell_static_driver.py (98%) rename src/{anysolver => anyfesolver}/general_contact/native_surface_activation.py (99%) rename src/{anysolver => anyfesolver}/general_contact/native_surface_bounds.py (98%) rename src/{anysolver => anyfesolver}/general_contact/native_surface_contributor.py (98%) rename src/{anysolver => anyfesolver}/general_contact/native_surface_crossing.py (100%) rename src/{anysolver => anyfesolver}/general_contact/native_surface_event_sequence.py (99%) rename src/{anysolver => anyfesolver}/general_contact/native_surface_extrema.py (100%) rename src/{anysolver => anyfesolver}/general_contact/native_surface_friction_integral.py (99%) rename src/{anysolver => anyfesolver}/general_contact/native_surface_front.py (99%) rename src/{anysolver => anyfesolver}/general_contact/native_surface_front_boundary.py (99%) rename src/{anysolver => anyfesolver}/general_contact/native_surface_front_precision.py (100%) rename src/{anysolver => anyfesolver}/general_contact/native_surface_front_work.py (100%) rename src/{anysolver => anyfesolver}/general_contact/native_surface_history.py (99%) rename src/{anysolver => anyfesolver}/general_contact/native_surface_normal.py (99%) rename src/{anysolver => anyfesolver}/general_contact/native_surface_patch.py (99%) rename src/{anysolver => anyfesolver}/general_contact/native_surface_path.py (99%) rename src/{anysolver => anyfesolver}/general_contact/native_surface_quadrature.py (98%) rename src/{anysolver => anyfesolver}/general_contact/native_surface_s3_friction.py (98%) rename src/{anysolver => anyfesolver}/general_contact/native_surface_support.py (99%) rename src/{anysolver => anyfesolver}/general_contact/native_surface_transaction.py (98%) rename src/{anysolver => anyfesolver}/general_contact/native_transient_multi_shell.py (95%) rename src/{anysolver => anyfesolver}/general_contact/native_transient_pair.py (94%) rename src/{anysolver => anyfesolver}/general_contact/native_transient_shell.py (92%) rename src/{anysolver => anyfesolver}/general_contact/normal_s3_skin_path.py (100%) rename src/{anysolver => anyfesolver}/general_contact/overlap.py (98%) rename src/{anysolver => anyfesolver}/general_contact/pair.py (98%) rename src/{anysolver => anyfesolver}/general_contact/patch_broadphase.py (100%) rename src/{anysolver => anyfesolver}/general_contact/patch_mortar.py (100%) rename src/{anysolver => anyfesolver}/general_contact/patch_sliding.py (99%) rename src/{anysolver => anyfesolver}/general_contact/plane_newmark_events.py (100%) rename src/{anysolver => anyfesolver}/general_contact/pointwise_patch.py (100%) rename src/{anysolver => anyfesolver}/general_contact/polynomial_roots.py (100%) rename src/{anysolver => anyfesolver}/general_contact/pressure_basis.py (100%) rename src/{anysolver => anyfesolver}/general_contact/pressure_diagnostics.py (98%) rename src/{anysolver => anyfesolver}/general_contact/pressure_overlay.py (100%) rename src/{anysolver => anyfesolver}/general_contact/pressure_space.py (100%) rename src/{anysolver => anyfesolver}/general_contact/q4_material_checkpoint.py (98%) rename src/{anysolver => anyfesolver}/general_contact/q4_overlap_local_bound.py (100%) rename src/{anysolver => anyfesolver}/general_contact/q4_q4_overlap_derivatives.py (99%) rename src/{anysolver => anyfesolver}/general_contact/q4_q4_swept_bound.py (100%) rename src/{anysolver => anyfesolver}/general_contact/q4_s3_overlap_derivatives.py (99%) rename src/{anysolver => anyfesolver}/general_contact/q4_s3_tiny_wedge.py (100%) rename src/{anysolver => anyfesolver}/general_contact/q4_skin_work.py (98%) rename src/{anysolver => anyfesolver}/general_contact/q4_source_mortar_energy.py (100%) rename src/{anysolver => anyfesolver}/general_contact/q4_source_overlap.py (100%) rename src/{anysolver => anyfesolver}/general_contact/q4_target_overlap.py (100%) rename src/{anysolver => anyfesolver}/general_contact/request_identity.py (98%) rename src/{anysolver => anyfesolver}/general_contact/rigid_translation.py (100%) rename src/{anysolver => anyfesolver}/general_contact/runtime.py (92%) rename src/{anysolver => anyfesolver}/general_contact/s3_friction_chart_interval.py (100%) rename src/{anysolver => anyfesolver}/general_contact/s3_friction_coverage.py (100%) rename src/{anysolver => anyfesolver}/general_contact/s3_friction_dyadic_interval.py (100%) rename src/{anysolver => anyfesolver}/general_contact/s3_friction_history_path.py (100%) rename src/{anysolver => anyfesolver}/general_contact/s3_friction_mesh_coverage.py (100%) rename src/{anysolver => anyfesolver}/general_contact/s3_friction_mesh_gap.py (100%) rename src/{anysolver => anyfesolver}/general_contact/s3_friction_mesh_monolithic.py (100%) rename src/{anysolver => anyfesolver}/general_contact/s3_friction_monolithic.py (100%) rename src/{anysolver => anyfesolver}/general_contact/s3_friction_moving_coverage.py (100%) rename src/{anysolver => anyfesolver}/general_contact/s3_friction_pair.py (100%) rename src/{anysolver => anyfesolver}/general_contact/s3_friction_point.py (100%) rename src/{anysolver => anyfesolver}/general_contact/s3_friction_prepared_path.py (100%) rename src/{anysolver => anyfesolver}/general_contact/s3_friction_replay.py (100%) rename src/{anysolver => anyfesolver}/general_contact/s3_friction_rim_path.py (100%) rename src/{anysolver => anyfesolver}/general_contact/s3_friction_rim_transaction.py (100%) rename src/{anysolver => anyfesolver}/general_contact/s3_friction_static.py (100%) rename src/{anysolver => anyfesolver}/general_contact/s3_friction_swept_gap.py (100%) rename src/{anysolver => anyfesolver}/general_contact/s3_friction_touch.py (100%) rename src/{anysolver => anyfesolver}/general_contact/s3_friction_weak_pressure.py (100%) rename src/{anysolver => anyfesolver}/general_contact/s3_overlap_derivatives.py (99%) rename src/{anysolver => anyfesolver}/general_contact/s3_overlap_hermite_gap.py (100%) rename src/{anysolver => anyfesolver}/general_contact/s3_pair_static.py (99%) rename src/{anysolver => anyfesolver}/general_contact/s3_patch_augmented.py (99%) rename src/{anysolver => anyfesolver}/general_contact/s3_patch_mortar_energy.py (100%) rename src/{anysolver => anyfesolver}/general_contact/s3_patch_static.py (99%) rename src/{anysolver => anyfesolver}/general_contact/s3_pressure_hermite_bounds.py (100%) rename src/{anysolver => anyfesolver}/general_contact/s3_pressure_polygon_bounds.py (100%) rename src/{anysolver => anyfesolver}/general_contact/s3_q4_gap_resolution.py (100%) rename src/{anysolver => anyfesolver}/general_contact/s3_q4_overlap_derivatives.py (99%) rename src/{anysolver => anyfesolver}/general_contact/s3_q4_swept.py (100%) rename src/{anysolver => anyfesolver}/general_contact/s3_skin_work.py (98%) rename src/{anysolver => anyfesolver}/general_contact/s3_sliding_friction.py (100%) rename src/{anysolver => anyfesolver}/general_contact/s3_stable_plane_gap.py (95%) rename src/{anysolver => anyfesolver}/general_contact/seed_path_vertex_interval.py (100%) rename src/{anysolver => anyfesolver}/general_contact/semismooth.py (100%) rename src/{anysolver => anyfesolver}/general_contact/semismooth_block.py (99%) rename src/{anysolver => anyfesolver}/general_contact/semismooth_path.py (99%) rename src/{anysolver => anyfesolver}/general_contact/shell_pair_hermite_sweep.py (100%) rename src/{anysolver => anyfesolver}/general_contact/shell_sphere_temporal_bounds.py (100%) rename src/{anysolver => anyfesolver}/general_contact/skin_geometry.py (100%) rename src/{anysolver => anyfesolver}/general_contact/sliding.py (99%) rename src/{anysolver => anyfesolver}/general_contact/sphere.py (99%) rename src/{anysolver => anyfesolver}/general_contact/sphere_temporal_bounds.py (100%) rename src/{anysolver => anyfesolver}/general_contact/static_path.py (99%) rename src/{anysolver => anyfesolver}/general_contact/static_results_archive.py (95%) rename src/{anysolver => anyfesolver}/general_contact/structural_state_bridge.py (97%) rename src/{anysolver => anyfesolver}/general_contact/supported_schur.py (100%) rename src/{anysolver => anyfesolver}/general_contact/swept_patch_broadphase.py (100%) rename src/{anysolver => anyfesolver}/general_contact/transient.py (99%) rename src/{anysolver => anyfesolver}/general_contact/transient_results_archive.py (98%) rename src/{anysolver => anyfesolver}/general_contact/triangle_mortar_energy.py (100%) rename src/{anysolver => anyfesolver}/general_contact/triangle_pair_energy.py (100%) rename src/{anysolver => anyfesolver}/general_contact/triangulated_rigid.py (100%) rename src/{anysolver => anyfesolver}/general_contact/triangulated_rigid_static.py (99%) rename src/{anysolver => anyfesolver}/general_contact/warped_q4_plane.py (100%) rename src/{anysolver => anyfesolver}/general_contact/warped_q4_skin.py (99%) rename src/{anysolver => anyfesolver}/general_contact/warped_q4_static.py (99%) rename src/{anysolver => anyfesolver}/impact_performance.py (100%) rename src/{anysolver => anyfesolver}/impact_reduced_assembly.py (100%) rename src/{anysolver => anyfesolver}/imperfections.py (100%) rename src/{anysolver => anyfesolver}/inertia_relief.py (100%) rename src/{anysolver => anyfesolver}/initial_field_state.py (100%) rename src/{anysolver => anyfesolver}/jit_compiler.py (100%) rename src/{anysolver => anyfesolver}/kernel_warmup.py (100%) rename src/{anysolver => anyfesolver}/linalg.py (100%) rename src/{anysolver => anyfesolver}/marine_contributions.py (98%) rename src/{anysolver => anyfesolver}/marine_coupled_equilibrium.py (100%) rename src/{anysolver => anyfesolver}/marine_equilibrium.py (100%) rename src/{anysolver => anyfesolver}/marine_hydro_coordinates.py (99%) rename src/{anysolver => anyfesolver}/marine_linear.py (99%) rename src/{anysolver => anyfesolver}/marine_link.py (99%) rename src/{anysolver => anyfesolver}/marine_mechanical.py (98%) rename src/{anysolver => anyfesolver}/marine_mooring.py (100%) rename src/{anysolver => anyfesolver}/marine_morison.py (100%) rename src/{anysolver => anyfesolver}/marine_potential_flow.py (98%) rename src/{anysolver => anyfesolver}/marine_rigid.py (100%) rename src/{anysolver => anyfesolver}/marine_seabed.py (100%) rename src/{anysolver => anyfesolver}/mass_properties.py (100%) rename src/{anysolver => anyfesolver}/material_curves.py (100%) rename src/{anysolver => anyfesolver}/materials.py (87%) rename src/{anysolver => anyfesolver}/matrix_assembly.py (99%) rename src/{anysolver => anyfesolver}/mesh_gen.py (99%) rename src/{anysolver => anyfesolver}/mesh_load_bc_verification.py (99%) rename src/{anysolver => anyfesolver}/modal.py (100%) rename src/{anysolver => anyfesolver}/nonlinear.py (100%) rename src/{anysolver => anyfesolver}/nonlinear_analysis_diagnostics.py (99%) rename src/{anysolver => anyfesolver}/nonlinear_element_evaluation.py (100%) rename src/{anysolver => anyfesolver}/nonlinear_performance.py (99%) rename src/{anysolver => anyfesolver}/nonlinear_performance_batch_b.py (100%) rename src/{anysolver => anyfesolver}/nonlinear_performance_batch_c.py (99%) rename src/{anysolver => anyfesolver}/nonlinear_performance_bootstrap.py (100%) rename src/{anysolver => anyfesolver}/nonlinear_reduced_assembly.py (100%) rename src/{anysolver => anyfesolver}/nonlinear_restart.py (99%) rename src/{anysolver => anyfesolver}/nonlinear_state.py (99%) rename src/{anysolver => anyfesolver}/nonlinear_static.py (99%) rename src/{anysolver => anyfesolver}/outcomes.py (99%) rename src/{anysolver => anyfesolver}/plasticity.py (99%) rename src/{anysolver => anyfesolver}/plasticity_qualification.py (100%) rename src/{anysolver => anyfesolver}/prepared_static.py (100%) rename src/{anysolver => anyfesolver}/prepared_static_envelopes.py (100%) rename src/{anysolver => anyfesolver}/prepared_static_loads.py (99%) rename src/{anysolver => anyfesolver}/prepared_static_measures.py (82%) rename src/{anysolver => anyfesolver}/prepared_static_numeric.py (100%) rename src/{anysolver => anyfesolver}/prepared_static_q4.py (100%) rename src/{anysolver => anyfesolver}/prepared_static_recovery.py (99%) rename src/{anysolver => anyfesolver}/prepared_static_response.py (99%) rename src/{anysolver => anyfesolver}/prepared_static_shared.py (100%) rename src/{anysolver => anyfesolver}/prepared_static_snapshot.py (100%) rename src/{anysolver => anyfesolver}/prepared_static_vectorized.py (99%) rename src/{anysolver => anyfesolver}/pressure_regions.py (100%) rename src/{anysolver => anyfesolver}/production_readiness.py (99%) rename src/{anysolver => anyfesolver}/quality_control.py (100%) rename src/{anysolver => anyfesolver}/quantities.py (99%) rename src/{anysolver => anyfesolver}/recovery.py (99%) rename src/{anysolver => anyfesolver}/recovery_batches.py (100%) rename src/{anysolver => anyfesolver}/recovery_policy.py (100%) rename src/{anysolver => anyfesolver}/recovery_s4.py (99%) rename src/{anysolver => anyfesolver}/recovery_shell_frames.py (100%) rename src/{anysolver => anyfesolver}/reference_cases.py (100%) rename src/{anysolver => anyfesolver}/result_capsule.py (99%) rename src/{anysolver => anyfesolver}/results.py (100%) rename src/{anysolver => anyfesolver}/runtime.py (99%) rename src/{anysolver => anyfesolver}/s3_reference_batch.py (100%) rename src/{anysolver => anyfesolver}/s3_v2c_fast_assembly.py (100%) rename src/{anysolver => anyfesolver}/s3_v2d_fast_assembly.py (100%) rename src/{anysolver => anyfesolver}/s4_validity.py (100%) rename src/{anysolver => anyfesolver}/sections.py (96%) rename src/{anysolver => anyfesolver}/sesam_fem/__init__.py (94%) rename src/{anysolver => anyfesolver}/sesam_fem/__main__.py (97%) rename src/{anysolver => anyfesolver}/sesam_fem/diagnostics.py (100%) rename src/{anysolver => anyfesolver}/sesam_fem/document.py (100%) rename src/{anysolver => anyfesolver}/sesam_fem/exporter.py (100%) rename src/{anysolver => anyfesolver}/sesam_fem/importer.py (99%) rename src/{anysolver => anyfesolver}/sesam_fem/records.py (100%) rename src/{anysolver => anyfesolver}/sesam_fem/schema.py (100%) rename src/{anysolver => anyfesolver}/sesam_fem/sif_importer.py (100%) rename src/{anysolver => anyfesolver}/sesam_fem/validation.py (100%) rename src/{anysolver => anyfesolver}/sestra_deep_diagnostics.py (100%) rename src/{anysolver => anyfesolver}/sestra_mixed_verification.py (100%) rename src/{anysolver => anyfesolver}/sestra_structure_benchmarks.py (100%) rename src/{anysolver => anyfesolver}/sestra_three_case.py (100%) rename src/{anysolver => anyfesolver}/sestra_verification.py (99%) rename src/{anysolver => anyfesolver}/shell_benchmarks.py (100%) rename src/{anysolver => anyfesolver}/shell_formulations/director_field.py (100%) rename src/{anysolver => anyfesolver}/shell_formulations/geometry_provenance.py (99%) rename src/{anysolver => anyfesolver}/shell_formulations/mitc4_plus_d_quality.py (99%) rename src/{anysolver => anyfesolver}/shell_formulations/mitc4_plus_d_reference.py (100%) rename src/{anysolver => anyfesolver}/shell_formulations/mitc4_plus_d_scalar.py (100%) rename src/{anysolver => anyfesolver}/shell_formulations/protocol.py (100%) rename src/{anysolver => anyfesolver}/shell_formulations/q4_common.py (100%) rename src/{anysolver => anyfesolver}/shell_formulations/s4_restricted_policy.py (100%) rename src/{anysolver => anyfesolver}/shell_sections.py (98%) rename src/{anysolver => anyfesolver}/solid_submodel.py (100%) rename src/{anysolver => anyfesolver}/static_batch.py (99%) rename src/{anysolver => anyfesolver}/static_envelopes.py (100%) rename src/{anysolver => anyfesolver}/stiffened_shell.py (100%) rename src/{anysolver => anyfesolver}/submodel_transfer.py (99%) rename src/{anysolver => anyfesolver}/test_cases.py (100%) rename src/{anysolver => anyfesolver}/threading_policy.py (98%) rename src/{anysolver => anyfesolver}/validation.py (100%) rename src/{anysolver => anyfesolver}/vectorized_beam.py (100%) rename src/{anysolver => anyfesolver}/vectorized_generalized_shell.py (99%) rename src/{anysolver => anyfesolver}/vectorized_hill48.py (100%) rename src/{anysolver => anyfesolver}/vectorized_nonlinear.py (97%) rename src/{anysolver => anyfesolver}/vectorized_stiffness.py (100%) create mode 100644 tests/data/confirmed_f2_replay.npz create mode 100644 tests/data/namespace_migration/arc.json create mode 100644 tests/data/namespace_migration/manifest.json create mode 100644 tests/data/namespace_migration/restart.json create mode 100644 tests/data/namespace_migration/static.json create mode 100644 tests/data/namespace_migration/transient.json create mode 100644 tests/fixtures/d1_control_reaction.py create mode 100644 tests/fixtures/d1_current_skin.py create mode 100644 tests/fixtures/d1_nonlinear_kkt.py create mode 100644 tests/test_namespace_migration.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 73b6a412b..047e1c701 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -142,7 +142,7 @@ jobs: if: runner.os == 'Windows' run: python -c "import win32job" - run: python -m pip check - - run: python -c "import anysolver; print(anysolver.__version__)" + - run: python -c "import anyfesolver; print(anyfesolver.__version__)" # The accepted S3/Q4 burn-in runner is immutable, machine-bound evidence. # Ordinary CI uses the current portable inventory and does not reopen it. - run: >- @@ -206,7 +206,7 @@ jobs: with: python-version: "3.13" cache: pip - - name: Build the ANYsolver wheel + - name: Build the ANYfeSolver wheel shell: pwsh run: | python -m pip install --upgrade pip build @@ -218,14 +218,14 @@ jobs: - name: Probe the installed endpoint outside the checkout shell: pwsh env: - EXPECTED_ANYSOLVER_VERSION: "0.4.7" + EXPECTED_ANYSOLVER_VERSION: "0.5.0" EXPECTED_ANYMATERIAL_VERSION: "0.2.0" EXPECTED_ANYMESHER_VERSION: ${{ matrix.anymesher-version }} EXPECTED_ANYGEOMETRY_VERSION: ${{ matrix.anygeometry-version }} EXPECTED_ANYFILEIO_VERSION: ${{ matrix.anyfileio-version }} run: | $wheel = @(Get-ChildItem -LiteralPath dist -Filter '*.whl' -File) - if ($wheel.Count -ne 1) { throw "Expected one ANYsolver wheel, found $($wheel.Count)" } + if ($wheel.Count -ne 1) { throw "Expected one ANYfeSolver wheel, found $($wheel.Count)" } python -m pip install $wheel[0].FullName python -m pip check Push-Location $env:RUNNER_TEMP @@ -282,7 +282,7 @@ jobs: with: python-version: "3.13" cache: pip - - name: Build the ANYsolver wheel + - name: Build the ANYfeSolver wheel shell: pwsh run: | python -m pip install --upgrade pip build @@ -294,14 +294,14 @@ jobs: - name: Probe the installed endpoint outside the checkout shell: pwsh env: - EXPECTED_ANYSOLVER_VERSION: "0.4.7" + EXPECTED_ANYSOLVER_VERSION: "0.5.0" EXPECTED_ANYMATERIAL_VERSION: "0.2.0" EXPECTED_ANYFILEIO_VERSION: ${{ matrix.anyfileio-version }} EXPECTED_ANYMESHER_VERSION: ${{ matrix.anymesher-version }} EXPECTED_ANYGEOMETRY_VERSION: ${{ matrix.anygeometry-version }} run: | $wheel = @(Get-ChildItem -LiteralPath dist -Filter '*.whl' -File) - if ($wheel.Count -ne 1) { throw "Expected one ANYsolver wheel, found $($wheel.Count)" } + if ($wheel.Count -ne 1) { throw "Expected one ANYfeSolver wheel, found $($wheel.Count)" } python -m pip install $wheel[0].FullName python -m pip check Push-Location $env:RUNNER_TEMP @@ -371,14 +371,14 @@ jobs: run: >- python -S -c "import sys; from importlib.metadata import version; from pathlib import Path; sys.path.insert(0, - str(Path('.wheel-smoke').resolve())); import anysolver; - from anysolver import Material, StiffenerCrossSection; - from anysolver.sesam_fem import SesamFemDocument; - assert anysolver.__version__ == version('ANYsolver'); + str(Path('.wheel-smoke').resolve())); import anyfesolver; + from anyfesolver import Material, StiffenerCrossSection; + from anyfesolver.sesam_fem import SesamFemDocument; + assert anyfesolver.__version__ == version('ANYfeSolver'); assert Material.__module__.startswith('anymaterial.'); assert StiffenerCrossSection.__module__.startswith('anymesher.'); assert SesamFemDocument.__module__.startswith('anyfileio.'); - print('wheel import OK', anysolver.__version__)" + print('wheel import OK', anyfesolver.__version__)" numba: runs-on: ${{ matrix.os }} diff --git a/CHANGELOG.md b/CHANGELOG.md index d8e0cbf4c..e07d08d9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ ## Unreleased +## 0.5.0 - release candidate + +- Rename the solver distribution and import to `ANYfeSolver` and `anyfesolver`. + The separately installable results runtime is `ANYfeSolver-results` 2.2.0, + imported as `anyfesolver_results`. See [the migration guide](MIGRATION.md) + for consumer upgrades, supported historical archives and restart files. + - Remove 22,552 historical development/qualification files from the checkout after verified external archival; retain regression inputs, authority records, source, tests and tools. See `docs/DEVELOPMENT_ARCHIVE.md` for recovery. diff --git a/MANIFEST.in b/MANIFEST.in index 7723b67d4..b2345c5b0 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -5,7 +5,7 @@ include THIRD_PARTY_NOTICES.md include dependency-licenses.json include README.md include setup.py -include src/anysolver/_native_guard.cpp +include src/anyfesolver/_native_guard.cpp include CHANGELOG.md include MIGRATION.md prune docs @@ -21,6 +21,9 @@ include docs/QUALITY_CONTROL.md include docs/THEORY.md include docs/releases/ANYsolver_0.4.6.md include docs/releases/ANYsolver_0.4.7.md +include docs/releases/ANYfeSolver_0.5.0.md prune reports prune scripts prune tests +prune packages +prune artifacts diff --git a/MIGRATION.md b/MIGRATION.md index bb5f295ef..ec4b481b3 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -1,3 +1,17 @@ +# Move to ANYfeSolver 0.5 + +Install the solver with `python -m pip install ANYfeSolver==0.5.0`. This installs the separate `ANYfeSolver-results` runtime. For offline recovery alone, install `ANYfeSolver-results==2.2.0`. + +| Previous Python name | Current Python name | +| --- | --- | +| `anysolver` | `anyfesolver` | +| `anysolver_results` | `anyfesolver_results` | +| `python -m anysolver.sesam_fem` | `python -m anyfesolver.sesam_fem` | + +Update application imports and dependency declarations together. For existing environments, upgrade the solver consumers first (ANYfem 0.4.2 and ANYstructure 6.4.2 for the released lines). Run `python -m pip check`, confirm your applications use the new imports, and remove the old distributions when no installed consumer needs them. A fresh environment installs just the new names. + +Existing recovery capsules and detached result archives retain their format identifiers. Supported nonlinear restart files retain their original model fingerprints. Exact-build and unsupported-state refusals still apply. + # Migration to ANYsolver ANYsolver is a curated snapshot, not a filtered-history import. diff --git a/README.md b/README.md index 319afa85d..ea3b13e40 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# ANYsolver finite-element solver +# ANYfeSolver finite-element solver -`anysolver` is a headless structural FE solver for beam, +`anyfesolver` is a headless structural FE solver for beam, shell, stiffened-panel, and cylindrical-shell analysis. It is an engineering solver with an explicit qualification scope, not a general-purpose CAD, contact, or fracture platform. @@ -12,7 +12,7 @@ recent integrations, open limits and the historical evidence map. Install the released package with: ```powershell -python -m pip install ANYsolver +python -m pip install ANYfeSolver ``` For coordinated local development across sibling repositories, install the @@ -22,46 +22,37 @@ checkouts first: python -m pip install -e C:\Github\ANYmaterial python -m pip install -e C:\Github\ANYmesh python -m pip install -e C:\Github\ANYfileIO -python -m pip install C:\Github\ANYsolver\packages\results -python -m pip install -e C:\Github\ANYsolver +python -m pip install C:\Github\ANYfeSolver\packages\results +python -m pip install -e C:\Github\ANYfeSolver ``` -### Release order for the 0.4 line +### Installation and migration -ANYsolver 0.4 depends on compatible extracted packages. Publish them to the -same target index in this order: +`ANYfeSolver` 0.5 uses the independent `ANYfeSolver-results` 2.2 runtime, `ANYmaterial` 0.2, `ANYmesher` 0.4–0.5 and `ANYfileio` 0.3.2 or later in the 0.3 line. Install the results distribution alone for NumPy-only offline recovery. The [migration guide](MIGRATION.md) covers renamed Python imports and upgrades from `ANYsolver`. -1. `ANYmaterial` and `ANYmesher` (either order). -2. `ANYfileio`, which depends on both. -3. `ANYsolver` 0.4.x, which depends on all three. +For the marine-excitation or marine-morison extra, install the corresponding ecosystem sibling checkout before requesting the extra: -Apply that order separately to TestPyPI and PyPI. The compatible sibling -releases are available on PyPI. The publish workflow checks the selected -target index and refuses to build or upload ANYsolver unless -`ANYmaterial>=0.1,<0.2`, `ANYmesher>=0.1,<0.4`, and -`ANYfileio>=0.1,<0.3` can already be resolved there. CI also uses pinned sibling -source checkouts to exercise the exact compatibility graph. +```powershell +python -m pip install -e C:\Github\ANYhydro +python -m pip install 'ANYfeSolver[marine-excitation]' -ANYsolver uses the neutral mesh, panel-generation, quality, and section APIs -available in ANYmesher 0.1 and retains compatibility through the additive 0.3 -line. The strict `<0.4` cap prevents an unqualified major contract change. -The endpoint compatibility job exercises pinned 0.1.0 and 0.2.1 installed -wheels on Windows AMD64 CPython 3.13; that focused job is not a wider platform -or interpreter qualification claim. +python -m pip install -e C:\Github\ANYloads +python -m pip install 'ANYfeSolver[marine-morison]' +``` Core analyses and the solver-owned generated-geometry workflow are available -directly from `anysolver`; the lightweight normalized flat-panel and cylinder -facade is exposed through `anysolver.runtime`: +directly from `anyfesolver`; the lightweight normalized flat-panel and cylinder +facade is exposed through `anyfesolver.runtime`: ```python -from anysolver import ( +from anyfesolver import ( FEModel, GeneratedGeometryFEMConfig, LoadCase, run_generated_geometry_fem, solve_linear, ) -from anysolver.runtime import ( +from anyfesolver.runtime import ( LightweightFEMConfig, resolve_runtime_analysis, run_production_fem, @@ -113,7 +104,7 @@ and release gates. | Area | Implemented functionality | | --- | --- | | Model | Six DOFs per node; SI units; materials, density, nodal mass, shell/beam topology, supports, and MPC constraints. `audit_constraints()` reports equation provenance, feasibility, structural rank, dependency depth, and independent DOFs before assembly. | -| Materials | Constitutive objects, elastic reductions, Hill-48 yield data, and DNV curves come from `ANYmaterial`; ANYsolver owns their use in element integration and nonlinear solution. Orthotropic shells support material direction/angle and Hill-48 plasticity; orthotropic beams use local material axes and an explicit section torsional rigidity. | +| Materials | Constitutive objects, elastic reductions, Hill-48 yield data, and DNV curves come from `ANYmaterial`; ANYfeSolver owns their use in element integration and nonlinear solution. Orthotropic shells support material direction/angle and Hill-48 plasticity; orthotropic beams use local material axes and an explicit section torsional rigidity. | | Shells | 3- and 6-node triangles; 4-node MITC-style and 8-node Mindlin-Reissner quadrilaterals; isotropic, rotated orthotropic, or pre-integrated generalized `A/B/D/As` section stiffness. Generalized sections retain membrane-bending coupling and recover exact strains/resultants without inventing ply stresses. | | Beams | 2-node and straight-sided 3-node Timoshenko beams with axial, biaxial bending, direction-dependent shear, torsion, consistent/lumped mass options, geometric stiffness, optional fiber-section plasticity, or a fully coupled local 6x6 generalized section law. | | Coupling | Coincident or eccentric beam-shell MPCs, with explicit `rotating_eccentricity` selection; see [connection options and limits](docs/BEAM_SHELL_CONNECTION.md). | @@ -131,7 +122,7 @@ and release gates. | Imperfections | Stress-free eigenmode, member-bow, plate-wave, flange-twist, explicit, and composite imperfection fields. | | Initial fields | Element-local shell membrane/bending stress or membrane/curvature prestrain, arbitrary configured beam-fiber stress/prestrain distributions, zero-external-load equilibration, admissibility checks, and provenance kept separate from geometric imperfections. | | Workflows | Normalized generated geometry to static/prestress/buckling; traceable static-to-buckling-to-imperfect nonlinear-capacity workflow. | -| Interchange | `ANYfileio` owns SESAM/CalculiX parsing, validation, neutral semantics, and guarded writing. ANYsolver retains only neutral-record-to-`FEModel` adapters and the legacy compatibility imports introduced for the 0.2 line. | +| Interchange | `ANYfileio` owns SESAM/CalculiX parsing, validation, neutral semantics, and guarded writing. ANYfeSolver retains only neutral-record-to-`FEModel` adapters and the legacy compatibility imports introduced for the 0.2 line. | | Results | Result provenance; unified elastic or committed shell-layer/beam-fiber stress recovery; Gauss-point membrane-force and bending-moment resultants for generated-geometry prestress; guarded Zienkiewicz-Zhu-style patch recovery for qualified shell neighborhoods; selected recovery; reaction filtering; validation diagnostics; deterministic baselines; benchmarks; and generated qualification reports. | | External verification | Reproducible CalculiX model flattening, opt-in isolated execution, solver provenance, and tolerance-controlled analytical comparison, using `ANYfileio` for deck writing and FRD/DAT parsing. Deck-only reports remain explicitly `not_executed` and make no numerical-agreement claim. | @@ -165,7 +156,7 @@ Applications that expect a large qualified-Q4 nonlinear analysis can move the first-use JIT cost out of the interactive solve path with an explicit warm-up: ```python -from anysolver import warm_fe_solver_kernels +from anyfesolver import warm_fe_solver_kernels warm_fe_solver_kernels(include_nonlinear_static=True) ``` diff --git a/dependency-licenses.json b/dependency-licenses.json index b8c145d9c..6f41ec223 100644 --- a/dependency-licenses.json +++ b/dependency-licenses.json @@ -43,9 +43,9 @@ "status": "not-bundled" }, { - "distribution": "ANYsolver-results", + "distribution": "ANYfeSolver-results", "licence": "MPL-2.0", - "requirement": "ANYsolver-results>=2.1,<3", + "requirement": "ANYfeSolver-results>=2.2,<3", "scope": "runtime", "status": "not-bundled" }, @@ -120,8 +120,8 @@ "status": "not-bundled" } ], - "project": "ANYsolver", + "project": "ANYfeSolver", "project_licence": "MPL-2.0", - "release": "0.4.7", - "schema": "anysolver.dependency-licences-v1" + "release": "0.5.0", + "schema": "anyfesolver.dependency-licences-v1" } diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 7492a64a5..099fbfe71 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -1,6 +1,6 @@ # FE solver architecture -This document describes the current `anysolver` package architecture. See +This document describes the current `anyfesolver` package architecture. See [`README.md`](../README.md) for the capability index and production limits, and [`THEORY.md`](THEORY.md) for the formulations. @@ -115,7 +115,7 @@ into each shell frame. A `GeneralizedBeamSectionContract` supplies a local 6x6 section stiffness from generalized strains `[eps_x,gamma_xy,gamma_xz,kappa_x,kappa_y,kappa_z]` to resultants `[N,V_y,V_z,T,M_y,M_z]`. These solver-owned section protocols are structural, -so material objects need no ANYsolver base class. Optional shell mass/rotary inertia per +so material objects need no ANYfeSolver base class. Optional shell mass/rotary inertia per area and beam 6x6 mass per length override legacy mass; omitted values retain the attached material/geometry mass path. @@ -169,7 +169,7 @@ The nonlinear paths are intentionally distinct: pressure contributes both external force and its generally nonsymmetric tangent. - `solve_static_arc_length()` follows a bounded equilibrium path and is called - from `anysolver.arc_length`; the same follower-pressure residual/tangent is + from `anyfesolver.arc_length`; the same follower-pressure residual/tangent is available in continuation. - `solve_transient_sphere_impact()` chooses the linear structural path unless `NonlinearTransientConfig(enabled=True)` is supplied. @@ -295,7 +295,7 @@ generated-geometry names `GeneratedGeometryFEMConfig`, `AnyStructureFEM*` names are compatibility aliases, not the preferred solver-owned vocabulary. -`anysolver.runtime` defines an explicit `__all__` and typed +`anyfesolver.runtime` defines an explicit `__all__` and typed `NormalizedGeometry`, `GeneratedGeometry`, `StatusCallback`, and `RuntimeAnalysisSelection` contracts. Downstream applications own state extraction, option mapping, UI, and plotting; they pass normalized data into @@ -319,7 +319,7 @@ thickness rules from diverging between integration paths. | `external_references.py` | Reproducible CalculiX decks plus optional isolated execution, executable/version/hash provenance, ASCII FRD/DAT parsing, tolerance-controlled comparisons, and JSON/Markdown evidence. | | `jit_compiler.py`, `vectorized_stiffness.py`, `vectorized_nonlinear.py`, `nonlinear_performance*.py` | Optional Numba kernels, persistent nonlinear plans, direct reduced assembly, and runtime activation/fallback. | -Optional nonlinear acceleration is lazy. Importing `anysolver` does not install +Optional nonlinear acceleration is lazy. Importing `anyfesolver` does not install the nonlinear performance patches or import the PyPardiso implementation. `solve_static_nonlinear()` performs the one-time acceleration check immediately before the first nonlinear solve, after honoring diff --git a/docs/ARC_LENGTH.md b/docs/ARC_LENGTH.md index 7d41e27ad..1063ca675 100644 --- a/docs/ARC_LENGTH.md +++ b/docs/ARC_LENGTH.md @@ -1,6 +1,6 @@ # Arc-length continuation -`anysolver.arc_length` provides bounded Crisfield-style spherical arc-length +`anyfesolver.arc_length` provides bounded Crisfield-style spherical arc-length continuation for nonlinear static capacity checks. The four public continuation symbols are also exported at the package root. @@ -36,7 +36,7 @@ residual-stress/prestrain provenance. ## Example ```python -from anysolver import ArcLengthControl, solve_static_arc_length +from anyfesolver import ArcLengthControl, solve_static_arc_length control = ArcLengthControl( initial_load_increment=0.025, diff --git a/docs/BEAM_SHELL_CONNECTION.md b/docs/BEAM_SHELL_CONNECTION.md index 9db95f418..8031b948f 100644 --- a/docs/BEAM_SHELL_CONNECTION.md +++ b/docs/BEAM_SHELL_CONNECTION.md @@ -25,9 +25,9 @@ would also contain its shell elements. ```python import numpy as np -from anysolver import (FEModel, BoundaryCondition, LoadCase, +from anyfesolver import (FEModel, BoundaryCondition, LoadCase, CoupledBeamShellElement, solve_static_nonlinear) -from anysolver.elements import BeamElement +from anyfesolver.elements import BeamElement model = FEModel("connected_beam") model.add_material("steel", 210e9, 0.3) @@ -58,7 +58,7 @@ node must lie at the weighted reference master position plus the declared offset. For example, for a beam node at that position: ```python -from anysolver import InterpolatedBeamShellMPCElement +from anyfesolver import InterpolatedBeamShellMPCElement connection = InterpolatedBeamShellMPCElement( 20, beam_node_id=3, shell_node_ids=[1, 2], shape_weights=np.array([0.5, 0.5]), eccentricity=np.array([0., 0., 0.1]), @@ -77,7 +77,7 @@ rotations are refused; this option does not widen that domain. ## Generated panels ```python -from anysolver import MeshConfig, PanelGeometry, generate_stiffened_panel_mesh +from anyfesolver import MeshConfig, PanelGeometry, generate_stiffened_panel_mesh panel = PanelGeometry(length=1., width=0.5, plate_thickness=0.01, stiffener_type="T-bar", stiffener_height=0.1, stiffener_web_thickness=0.005, stiffener_flange_width=0.05, @@ -233,7 +233,7 @@ physical shell/beam elements, supports and loads must then be added as usual: ```python import numpy as np -from anysolver import FEModel, InterpolatedBeamShellMPCElement +from anyfesolver import FEModel, InterpolatedBeamShellMPCElement trace_model = FEModel("experimental_edge") trace_model.add_material("steel", 210e9, 0.3) trace_model.add_node(1, 0., 0., 0.) diff --git a/docs/E4_PL_MIGRATION.md b/docs/E4_PL_MIGRATION.md index 661456f67..76b8bce4f 100644 --- a/docs/E4_PL_MIGRATION.md +++ b/docs/E4_PL_MIGRATION.md @@ -5,14 +5,14 @@ E4-PL is the production default for four-node shells. Existing callers using meshes, runtime geometry, cylinder Q4 meshes, or SESAM Q4 imports select it without an API change. -ANYfem integrations must construct solver shells through ANYsolver's public +ANYfem integrations must construct solver shells through ANYfeSolver's public `create_element("shell", ...)` selector. Direct `ShellElement(...)` construction bypasses the Q4 default and is deprecated for four-node shells. ## Identify the selected formulation ```python -from anysolver import shell_formulation_diagnostics +from anyfesolver import shell_formulation_diagnostics print(shell_formulation_diagnostics(node_count=4)) ``` @@ -29,7 +29,7 @@ interchange records; do not down-cast the record to `ShellElement`. For a diagnosed compatibility incident only: ```python -from anysolver import create_shell_element +from anyfesolver import create_shell_element element = create_shell_element( 1, diff --git a/docs/FLOATING_RESPONSE.md b/docs/FLOATING_RESPONSE.md index 9e21a10eb..cba1f946c 100644 --- a/docs/FLOATING_RESPONSE.md +++ b/docs/FLOATING_RESPONSE.md @@ -1,12 +1,12 @@ # Floating-body response The floating response modules accept neutral numerical inputs and keep solver -mechanics in ANYsolver. They were integrated on local main on 2026-10-28. Their +mechanics in ANYfeSolver. They were integrated on local main on 2026-10-28. Their tests are development evidence; they do not confer broad marine qualification. ## Frequency response -[`anysolver.floating_response`](../src/anysolver/floating_response.py) provides +[`anyfesolver.floating_response`](../src/anyfesolver/floating_response.py) provides `solve_floating_response`, mean-frame operator/force transformations, restoring audits, rigid-motion reconstruction and waterline/rotation-envelope checks. The model is a linear six-DOF floating body at zero forward speed. Coordinates @@ -19,7 +19,7 @@ module itself does not import ANYmarine, ANYhydro or Capytaine. ## Transient wind feedback -[`anysolver.floating_transient`](../src/anysolver/floating_transient.py) exposes +[`anyfesolver.floating_transient`](../src/anyfesolver/floating_transient.py) exposes `FloatingTransientSpec`, `FloatingTransientResourceConfig`, `FloatingTransientResult`, and `solve_floating_transient`. It uses fixed-step Newmark average acceleration with causal radiation memory @@ -34,8 +34,8 @@ this route. Nonsymmetric external operators retain their skew parts. ## Structural pressure and mass -[`pressure_regions`](../src/anysolver/pressure_regions.py) and -[`floating_pressure_regions`](../src/anysolver/floating_pressure_regions.py) +[`pressure_regions`](../src/anyfesolver/pressure_regions.py) and +[`floating_pressure_regions`](../src/anyfesolver/floating_pressure_regions.py) integrate shell pressure over supplied overlap regions using the element's own virtual-work density. Physical quadrature points are inverted through the actual element mapping; native S3 rotational work is retained. Geometry ownership stays diff --git a/docs/GENERAL_CONTACT_C0.md b/docs/GENERAL_CONTACT_C0.md index 3e4958616..7c6d1476f 100644 --- a/docs/GENERAL_CONTACT_C0.md +++ b/docs/GENERAL_CONTACT_C0.md @@ -71,7 +71,7 @@ scalar reaction is 0.4 N and its predicted gap is -0.4 micrometres. The example stops if the solver does not finish or the gap budget is exceeded. ```python -from anysolver import ( +from anyfesolver import ( ContactDefinition, ContactInteraction, ContactSurface, RigidContactBody, solve_static_nonlinear, ) @@ -89,7 +89,7 @@ result = solve_static_nonlinear(model, load_case, contact=contact, contact_summary = result.info["general_contact"] ``` -`model` and `load_case` are ordinary ANYsolver objects. Check `result.status`, +`model` and `load_case` are ordinary ANYfeSolver objects. Check `result.status`, `result.failure_reason`, `result.load_factor` and `contact_summary["gap_tolerance_met"]` before using the result. A stopped analysis retains its last accepted structural state. diff --git a/docs/GENERAL_CONTACT_CAPABILITIES.md b/docs/GENERAL_CONTACT_CAPABILITIES.md index acf99d333..8a1eb5aa9 100644 --- a/docs/GENERAL_CONTACT_CAPABILITIES.md +++ b/docs/GENERAL_CONTACT_CAPABILITIES.md @@ -916,7 +916,7 @@ not turn `validation.valid` or `implemented` into user-facing admission. | One retained native B3-GE beam against one elastic S3 V2D physical interior | Restricted coupled static force-control owner; one beam and one shell element, zero shell supports, retained native internals, deformable S3 work, conservative path checks and versioned split restart | Implemented and locally tested development profile; C3 open | Coupled curved/straight solves, cross tangent, rollback, interference/material/mechanism rejection, byte-identical split restart, wrong-model/tamper checks and runnable example; no independent acceptance; see [native/S3 static limits](GENERAL_CONTACT_C3_NATIVE_S3_STATIC.md) | | One/two retained native B3-GE beams against multiple elastic physical S3 interiors (`NATIVE_B3_GE_MULTIPLE_ELASTIC_S3_INTERIORS_STATIC_DEV_V1`) | Separate explicit native analysis factory; full retained/internal/global-shell cross blocks, per-pair conservative paths/gaps, exact consumed-map binding and atomic state/restart; at most8pairs/256coordinates | Implemented and installed tested development profile; C3 scientific acceptance open | Installed29pass60.473s/332218368B; independent direct curve work, two deforming skins/shared target,1e-5 spatial tangent, physical wrenches/reactions, hidden second-beam path, cancellation/later-child failure and deterministic restart. Stronger penalty requires4load increments in the tested fixture; historical gap/merit failures retained. Development1mm gap is not qualification tolerance; two-setting sensitivity is not enforcement convergence. No rims/patch union/native caps/friction/dynamics or section/material admission; see [native multiple-S3 evidence](GENERAL_CONTACT_NATIVE_MULTIPLE_S3_DEV.md). | | Straight/curved native B3-GE contact with retained internal coordinates | General native static owner | Open | C3 | -| Stable-key three-dimensional contact broad-phase adapter over public ANYgeometry AABBTree | Internal exact-box query and refit; caller must supply conservative physical bounds; no automatic pair owner | Implemented and locally tested infrastructure; C4 open | Small-scene exhaustive/refit checks and near-1k/10k/100k search-only comparisons; installed ANYsolver wheel with locally available ANYgeometry queried successfully. The existing restricted planar tree remains in use after a measured large-scene memory/build regression of the owner tree. See [search owner development](GENERAL_CONTACT_C4_SEARCH_OWNER_DEV.md). | +| Stable-key three-dimensional contact broad-phase adapter over public ANYgeometry AABBTree | Internal exact-box query and refit; caller must supply conservative physical bounds; no automatic pair owner | Implemented and locally tested infrastructure; C4 open | Small-scene exhaustive/refit checks and near-1k/10k/100k search-only comparisons; installed ANYfeSolver wheel with locally available ANYgeometry queried successfully. The existing restricted planar tree remains in use after a measured large-scene memory/build regression of the owner tree. See [search owner development](GENERAL_CONTACT_C4_SEARCH_OWNER_DEV.md). | | Automatic pairing, triangulated obstacles, boundaries and self-contact | Static | Open | C4 | | Internal material-frame Coulomb and fixed-material S3 V2D quadrature | Shared mortar pressure coupling through ordinary static path; full-facet support, objective retained elastic work, accepted-step history and bound restart; numerical pressure/geometric development derivatives | Implemented and tested development slice; C5 scientific acceptance, moving partners/facet transfer, beam/native friction and arc length remain open | Independent uniform pressure/traction and cross derivative, smooth directional work, reproduced/corrected retained-history rigid-spin defect, coupled stick/slip/reversal/open/recontact, split restart, incompatible identity, cancellation and cut-face rejection; see [C5 scope](GENERAL_CONTACT_C5_FRICTION_POINT.md) | | Planar conforming convex S3 target patch and S3 source material quadrature (`S3_PLANAR_MATERIAL_ANCHOR_STATIC_DEV_V1`) | Shared finite-penalty mortar pressure; actual target material-anchor convection/return across facets; both-body static response, fixed-facet internal-seam generalized tangent and transactional history/restart; explicit fixed reference-cell quadrature refinement | Implemented and development tested with early Mistral scrutiny; C5 acceptance and application admission remain open | Affine strain, nonproportional work, both-body force/normal work, scalar cap/pressure derivatives, force/moment directional and one-sided seam tangents, solved deformable-target crossing/reversal/open/recontact and solved seam/split restart. Independent target-force integration error8.47446% at level0 falls to0.0487955% at level3 with unchanged normal pressure space; cached/full work and constrained reactions checked. Full source coverage/fixed quadrature only; physical-rim tangent, partial-overlap history and event/step refinement open. Bounded numerical return derivatives and endpoint/chord dissipation. See [C5 equations and limits](GENERAL_CONTACT_C5_FRICTION_POINT.md), [anchor evidence](d1_review_support/contact_c5_s3_material_anchor_20261002/results.md), [seam evidence](d1_review_support/contact_c5_s3_seam_tangent_20261002/results.md), [integration evidence](d1_review_support/contact_c5_s3_quadrature_20261002/results.md). | @@ -1054,7 +1054,7 @@ The same saved sequence's maximum cumulative-reaction difference increased from 1.02% (16→24 Q4) to 1.50% (24→32 Q4), so an integrated spatial-pressure measure cannot currently close that gate either. -The working branch is `codex/general-contact-core`, started from ANYsolver +The working branch is `codex/general-contact-core`, started from ANYfeSolver `be41a77a62e1cd7e1767bda6e955253af0819f91`. C0 was committed as `31e60277`. A disposable C0 candidate wheel built from that commit as `anysolver-0.4.7-py3-none-any.whl` (SHA-256 diff --git a/docs/GENERAL_CONTACT_STATIC_CANDIDATE.md b/docs/GENERAL_CONTACT_STATIC_CANDIDATE.md index 3654be155..ce115949c 100644 --- a/docs/GENERAL_CONTACT_STATIC_CANDIDATE.md +++ b/docs/GENERAL_CONTACT_STATIC_CANDIDATE.md @@ -30,11 +30,11 @@ line is a distinct route and remains frictionless. ## Public entrypoints -All entrypoints live in the `anysolver.general_contact` package and load +All entrypoints live in the `anyfesolver.general_contact` package and load lazily; ordinary no-contact solves never import the contact kernel. ```python -from anysolver.general_contact import ( +from anyfesolver.general_contact import ( ContactDefinition, ContactInteraction, ContactSurface, ContactSolverSettings, ContactPathControl, ContactPathProgram, S3SlidingFrictionSettings, @@ -66,16 +66,16 @@ settings. Two supported routes: 1. **Current candidate bundle** (recommended for evaluation): - `C:/ANYworkspaceWork/contact-incremental-delivery-20261020/slice5/ANYsolver-contact-candidate-20261020-s5.zip` + `C:/ANYworkspaceWork/contact-incremental-delivery-20261020/slice5/ANYfeSolver-contact-candidate-20261020-s5.zip` (expected slice-5 bundle; its paired-host CI and final artifact identity are recorded in the slice-5 delivery receipt once published). The extracted bundle ROOT contains `examples/` and a `wheelhouse/` with - the six pure-Python private wheels (ANYsolver, ANYresults, ANYmaterial, + the six pure-Python private wheels (ANYfeSolver, ANYresults, ANYmaterial, ANYgeometry, ANYmesher, ANYfileio). From the bundle ROOT, in a fresh virtual environment: ```text - python -m pip install --find-links wheelhouse -r requirements-tested.txt "ANYsolver[general-contact]==0.4.7+contact.candidate.20261020.s5" "ANYsolver-results==2.1.1" "ANYmaterial==0.2.0" "ANYgeometry[planar]==0.4.3" "ANYmesher==0.5.0" "ANYfileio==0.3.2" + python -m pip install --find-links wheelhouse -r requirements-tested.txt "ANYfeSolver[general-contact]==0.4.7+contact.candidate.20261020.s5" "ANYfeSolver-results==2.1.1" "ANYmaterial==0.2.0" "ANYgeometry[planar]==0.4.3" "ANYmesher==0.5.0" "ANYfileio==0.3.2" ``` Numeric and Shapely dependencies resolve normally from their usual diff --git a/docs/INERTIA_RELIEF.md b/docs/INERTIA_RELIEF.md index 225795991..5262b0194 100644 --- a/docs/INERTIA_RELIEF.md +++ b/docs/INERTIA_RELIEF.md @@ -6,7 +6,7 @@ elastic deformation in the accelerating frame. It supports one connected free-free linear beam/shell assembly, including homogeneous internal MPCs. ```python -from anysolver import solve_inertia_relief +from anyfesolver import solve_inertia_relief result = solve_inertia_relief(model, load_case) if result.converged: @@ -163,7 +163,7 @@ See `examples/inertia_relief.py` for a complete free bar example. Both static batch interfaces accept explicit inertia relief: ```python -from anysolver import AnalysisSession, StaticCase, iter_linear_batches, solve_linear_many +from anyfesolver import AnalysisSession, StaticCase, iter_linear_batches, solve_linear_many with AnalysisSession(model) as session: for block in iter_linear_batches( diff --git a/docs/NATIVE_SOURCE_AUTHORITY.md b/docs/NATIVE_SOURCE_AUTHORITY.md index c2ddb7c40..5adf47fc2 100644 --- a/docs/NATIVE_SOURCE_AUTHORITY.md +++ b/docs/NATIVE_SOURCE_AUTHORITY.md @@ -9,8 +9,9 @@ unsupported Python/platform combinations retain the complete Python guard. `ANYSOLVER_NATIVE_GUARD=python` selects the literal guard at process startup. The native plan owns only original expected facts. Every existing native safe -point still checks all 18 class records and 1274 helper records plus the matcher -bootstrap. Class/MRO namespace order, callable metadata, globals, closures, +point checks all 18 class records and, in the CPython 3.11 Windows inventory, +1,304 helper records plus the matcher bootstrap. MRO order, class members in +name order, callable metadata, globals, closures, empty cells and the exact integer generation-counter exception retain their literal meaning. Comparison memos and current grammar inspection are discarded after each guard. Unknown grammar or any predicate mismatch runs the complete diff --git a/docs/NONLINEAR_PERFORMANCE.md b/docs/NONLINEAR_PERFORMANCE.md index 9d1403abe..1aa596dde 100644 --- a/docs/NONLINEAR_PERFORMANCE.md +++ b/docs/NONLINEAR_PERFORMANCE.md @@ -461,7 +461,7 @@ one live `FEModel`. Passing `session=` is optional on `solve_linear()`, workflow. Omitting it preserves one-shot behavior. ```python -from anysolver import AnalysisSession, solve_linear, solve_free_vibration +from anyfesolver import AnalysisSession, solve_linear, solve_free_vibration with AnalysisSession(model) as session: displacement, static_info = solve_linear( @@ -552,7 +552,7 @@ versioned Sol Ultra reports. ## Activation and A/B testing -Importing `anysolver` does not install the nonlinear performance layer. +Importing `anyfesolver` does not install the nonlinear performance layer. `solve_static_nonlinear()` performs a one-time lazy activation immediately before a nonlinear solve. Existing public solver calls are unchanged, and an optional acceleration import/initialization failure leaves the scalar path @@ -568,8 +568,8 @@ FE_SOLVER_DISABLE_FAST_NL=1 Runtime diagnostics are available from: ```python -from anysolver.jit_compiler import jit_diagnostics -from anysolver.nonlinear_performance_bootstrap import nonlinear_performance_status +from anyfesolver.jit_compiler import jit_diagnostics +from anyfesolver.nonlinear_performance_bootstrap import nonlinear_performance_status print(jit_diagnostics()) print(nonlinear_performance_status()) @@ -631,7 +631,7 @@ layer. The plan can be cleared explicitly after non-standard in-place model changes: ```python -from anysolver.nonlinear_performance_bootstrap import clear_nonlinear_assembly_cache +from anyfesolver.nonlinear_performance_bootstrap import clear_nonlinear_assembly_cache clear_nonlinear_assembly_cache(model) ``` diff --git a/docs/QUALITY_CONTROL.md b/docs/QUALITY_CONTROL.md index 6f86fb800..d27762f6f 100644 --- a/docs/QUALITY_CONTROL.md +++ b/docs/QUALITY_CONTROL.md @@ -1,6 +1,6 @@ # FE solver verification and quality control -This is the maintained verification guide for `anysolver`. Source code and +This is the maintained verification guide for `anyfesolver`. Source code and tests are authoritative; generated reports are evidence for the commit and environment recorded in them. @@ -23,12 +23,12 @@ reproducible handoff artifacts, not numerical validation. ## Current verification policy -Since version 0.2, ANYsolver delegates material behavior, neutral meshing, +Since version 0.2, ANYfeSolver delegates material behavior, neutral meshing, and interchange syntax to ANYmaterial, ANYmesher, and ANYfileio. A qualifying ecosystem run therefore installs those sibling packages, runs their own tests, and then runs -the ANYsolver suite and ecosystem-wiring tests. Compatibility tests must cover -both the historical ANYsolver imports and the canonical package imports. +the ANYfeSolver suite and ecosystem-wiring tests. Compatibility tests must cover +both the historical ANYfeSolver imports and the canonical package imports. Pass counts and timings are deliberately not embedded here: they become stale as tests move to their owning repositories. The generated report under @@ -62,7 +62,7 @@ qualification package is required for routine development. Default focused settings are one numerical thread, JIT off, plugin autoload off, and a 600-second timeout. Use `--jit on` for changed compiled execution; JIT-off -checks cannot replace required compiled parity. Imported ANYsolver modules must +checks cannot replace required compiled parity. Imported ANYfeSolver modules must come from this checkout. Observed pools/Numba settings are recorded once after the run, checked when loaded, and otherwise reported unavailable. The optional memory ceiling requires `psutil` and samples the owned child process tree; diff --git a/docs/STATUS.md b/docs/STATUS.md index 070f2e442..451ac3c2f 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -25,7 +25,7 @@ forward to a new candidate. ## Open limits and follow-ups - On October 29, the older V6 source-authority check reported a mismatch for - `src/anysolver/e4_pl_s3_v2c_element.py`. The same failure occurred before and + `src/anyfesolver/e4_pl_s3_v2c_element.py`. The same failure occurred before and after development-file removal. Its historical binding was not rewritten; see the [cleanup evidence](CLEANUP_20261029.md). - The [Q4 changelog entry](../CHANGELOG.md#unreleased) records the unresolved diff --git a/docs/THEORY.md b/docs/THEORY.md index c6b7e6f18..05eec66b8 100644 --- a/docs/THEORY.md +++ b/docs/THEORY.md @@ -1,8 +1,8 @@ # FE Solver Theory Notes This note records the theoretical basis, equation audit, and validity limits -for the production `anysolver` package. The implementation target is an -ANYsolver beam-shell solver, not a general-purpose nonlinear FE code. A cited +for the production `anyfesolver` package. The implementation target is an +ANYfeSolver beam-shell solver, not a general-purpose nonlinear FE code. A cited formulation is a design anchor; qualification still comes from the executable tests and comparison evidence described in [`QUALITY_CONTROL.md`](QUALITY_CONTROL.md). @@ -735,7 +735,7 @@ Implemented interfaces: ### Arc-length continuation -`anysolver.arc_length.solve_static_arc_length()` adds a bounded +`anyfesolver.arc_length.solve_static_arc_length()` adds a bounded [Crisfield-style](https://doi.org/10.1016/0045-7949(81)90108-5) spherical constraint to the same nonlinear element, material-state, load, and constraint machinery: diff --git a/examples/beam_shell_coupling.py b/examples/beam_shell_coupling.py index da0bc885e..6da23a284 100644 --- a/examples/beam_shell_coupling.py +++ b/examples/beam_shell_coupling.py @@ -1,7 +1,7 @@ """Standalone public beam-shell coupling example: registered pre-yield case. This example builds the registered eccentric beam-shell coupling case with -public ``anysolver`` APIs only and solves it with the registered pre-yield +public ``anyfesolver`` APIs only and solves it with the registered pre-yield force-controlled controls. It reports a truthful JSON summary: ``completed`` is true only when the solver actually reached the requested load factor within 1e-8 and the existing constraint postcheck passed; anything else @@ -56,7 +56,7 @@ import numpy as np -from anysolver import ( +from anyfesolver import ( BoundaryCondition, CoupledBeamShellElement, CancellationToken, @@ -68,8 +68,8 @@ solve_static_nonlinear, SolveCancelled, ) -from anysolver.elements import BeamElement -from anysolver.material_curves import DNVC208MaterialCurve, dnv_c208_steel_curve +from anyfesolver.elements import BeamElement +from anyfesolver.material_curves import DNVC208MaterialCurve, dnv_c208_steel_curve L = 1.0 W = 0.24 diff --git a/examples/elastic_sphere_panel_contact_skins.py b/examples/elastic_sphere_panel_contact_skins.py index b84213d09..0f387423b 100644 --- a/examples/elastic_sphere_panel_contact_skins.py +++ b/examples/elastic_sphere_panel_contact_skins.py @@ -39,10 +39,10 @@ import numpy as np -from anysolver import BeamElement -from anysolver.corotational import rotation_matrix_from_vector -from anysolver.general_contact.curved_shell_skin import CurvedShellSkinMap -from anysolver.mesh_gen import InterpolatedBeamShellMPCElement +from anyfesolver import BeamElement +from anyfesolver.corotational import rotation_matrix_from_vector +from anyfesolver.general_contact.curved_shell_skin import CurvedShellSkinMap +from anyfesolver.mesh_gen import InterpolatedBeamShellMPCElement from examples.elastic_sphere_stiffened_panel import ( DROP_CLEARANCE, @@ -60,7 +60,7 @@ prepare_case_models, ) -SCHEMA = "anysolver.elastic-sphere-panel-contact-skins-v1" +SCHEMA = "anyfesolver.elastic-sphere-panel-contact-skins-v1" STATUS = "skin_geometry_prepared" CONTACT_RESPONSE_STATUS = "unsupported" IMPACT_STATUS = "unsupported" @@ -298,7 +298,7 @@ def prepare_skin_geometry() -> dict: "gravity_solve_status": str(result.status), "skin_service": ( "development-only face-local curved shell skin map " - "(anysolver.general_contact.curved_shell_skin); not an " + "(anyfesolver.general_contact.curved_shell_skin); not an " "admitted contact solve" ), "sphere_skin": { diff --git a/examples/elastic_sphere_panel_contact_work.py b/examples/elastic_sphere_panel_contact_work.py index dea2fb81b..0615e22f2 100644 --- a/examples/elastic_sphere_panel_contact_work.py +++ b/examples/elastic_sphere_panel_contact_work.py @@ -14,7 +14,7 @@ import numpy as np -from anysolver.general_contact.curved_s3_q4_work import ( +from anyfesolver.general_contact.curved_s3_q4_work import ( CurvedS3Q4WorkProbe, INTEGRATION_CONTROLS, PROBE_PRESSURE_PA, ) from examples.elastic_sphere_panel_contact_skins import ( @@ -174,7 +174,7 @@ def report_contact_work(case=None): or not _states_equal(states_before, case.result.element_states)): raise RuntimeError("contact geometry probe mutated model/preload/material state") payload = dict( - schema="anysolver.elastic-sphere-panel-contact-work-v1", status=STATUS, + schema="anyfesolver.elastic-sphere-panel-contact-work-v1", status=STATUS, contact_response="unsupported", impact="unsupported", is_checkpoint=False, numerical_acceptance="local_windows_only; paired_host_pending", interpretation="1 Pa derivative of reference-area integrated gap; no contact reaction or pressure law", diff --git a/examples/elastic_sphere_panel_continuation.py b/examples/elastic_sphere_panel_continuation.py index 317041191..6a5ed990d 100644 --- a/examples/elastic_sphere_panel_continuation.py +++ b/examples/elastic_sphere_panel_continuation.py @@ -44,10 +44,10 @@ import numpy as np -from anysolver import LoadCase, solve_static_nonlinear -from anysolver.corotational import rotation_matrix_from_vector -from anysolver.nonlinear_static import NonlinearLoadProgram, NonlinearLoadStage -from anysolver.nonlinear_restart import model_configuration_fingerprint +from anyfesolver import LoadCase, solve_static_nonlinear +from anyfesolver.corotational import rotation_matrix_from_vector +from anyfesolver.nonlinear_static import NonlinearLoadProgram, NonlinearLoadStage +from anyfesolver.nonlinear_restart import model_configuration_fingerprint from examples.elastic_sphere_stiffened_panel import ( FORCE_BALANCE_TOLERANCE, @@ -67,7 +67,7 @@ ) from examples.elastic_sphere_panel_contact_skins import build_skin_maps -SCHEMA = "anysolver.elastic-sphere-panel-continuation-v1" +SCHEMA = "anyfesolver.elastic-sphere-panel-continuation-v1" STATUS = "gravity_probe_completed" CONTACT_RESPONSE_STATUS = "unsupported" IMPACT_STATUS = "unsupported" diff --git a/examples/elastic_sphere_panel_state_bridge.py b/examples/elastic_sphere_panel_state_bridge.py index 103ed8def..e54c838cf 100644 --- a/examples/elastic_sphere_panel_state_bridge.py +++ b/examples/elastic_sphere_panel_state_bridge.py @@ -9,7 +9,7 @@ import numpy as np -from anysolver.general_contact.structural_state_bridge import TwoBodyStateBridge +from anyfesolver.general_contact.structural_state_bridge import TwoBodyStateBridge from examples.elastic_sphere_panel_contact_work import prepare_work_case, evaluate_case from examples.elastic_sphere_panel_continuation import _model_snapshot, _states_equal from examples.elastic_sphere_stiffened_panel import _runtime_identity diff --git a/examples/elastic_sphere_stiffened_panel.py b/examples/elastic_sphere_stiffened_panel.py index cc18f664a..cfde52267 100644 --- a/examples/elastic_sphere_stiffened_panel.py +++ b/examples/elastic_sphere_stiffened_panel.py @@ -38,7 +38,7 @@ import numpy as np -from anysolver import ( +from anyfesolver import ( FEModel, BeamElement, LoadCase, @@ -53,11 +53,11 @@ generate_stiffened_panel_mesh, solve_static_nonlinear, ) -from anysolver.corotational import ( +from anyfesolver.corotational import ( build_nonlinear_rotating_mpc_map, corotational_element_response, ) -from anysolver.mesh_gen import InterpolatedBeamShellMPCElement +from anyfesolver.mesh_gen import InterpolatedBeamShellMPCElement from examples.elastic_sphere_stiffened_panel_mesh import ( SPHERE_MIDSURFACE_RADIUS, @@ -66,7 +66,7 @@ SPHERE_TRIANGLES, ) -SCHEMA = "anysolver.elastic-sphere-stiffened-panel-initial-state-v1" +SCHEMA = "anyfesolver.elastic-sphere-stiffened-panel-initial-state-v1" STATUS = "initial_state_prepared" IMPACT_STATUS = "unsupported" @@ -534,15 +534,15 @@ def _global_balance(model: FEModel, recovery: dict) -> dict: def _runtime_identity() -> dict: - import anysolver + import anyfesolver import scipy return { "python": sys.version.split()[0], "executable": sys.executable, "platform": platform.platform(), - "anysolver_version": str(anysolver.__version__), - "anysolver_module": str(Path(anysolver.__file__).resolve()), + "anyfesolver_version": str(anyfesolver.__version__), + "anyfesolver_module": str(Path(anyfesolver.__file__).resolve()), "numpy_version": str(np.__version__), "scipy_version": str(scipy.__version__), "command": list(sys.argv), diff --git a/examples/general_contact_arc_length.py b/examples/general_contact_arc_length.py index 2978bb5e9..24c0d71f5 100644 --- a/examples/general_contact_arc_length.py +++ b/examples/general_contact_arc_length.py @@ -1,6 +1,6 @@ """Contact-aware spherical continuation of a connected physical S3 patch.""" from examples.general_contact_triangulated_rigid_patch import case -from anysolver import LoadCase, solve_static_arc_length, ArcLengthControl +from anyfesolver import LoadCase, solve_static_arc_length, ArcLengthControl def analysis(steps=4, restart_checkpoint=None): diff --git a/examples/general_contact_arc_length_affine.py b/examples/general_contact_arc_length_affine.py index a7abf492b..486fa5808 100644 --- a/examples/general_contact_arc_length_affine.py +++ b/examples/general_contact_arc_length_affine.py @@ -1,6 +1,6 @@ """Affine support plus optional equilibrium preload, using the public arc route.""" from examples.general_contact_triangulated_rigid_patch import case -from anysolver import BoundaryCondition, LoadCase, ArcLengthControl, solve_static_arc_length +from anyfesolver import BoundaryCondition, LoadCase, ArcLengthControl, solve_static_arc_length def build(preload=False,preload_force=.001): diff --git a/examples/general_contact_arc_results_archive.py b/examples/general_contact_arc_results_archive.py index a460d1879..74b92d148 100644 --- a/examples/general_contact_arc_results_archive.py +++ b/examples/general_contact_arc_results_archive.py @@ -1,6 +1,6 @@ """Public affine/preload arc producer and bounded inert data consumer.""" from examples.general_contact_arc_length_affine import analysis as solve -from anysolver.general_contact import read_arc_contact_results +from anyfesolver.general_contact import read_arc_contact_results def analysis(): diff --git a/examples/general_contact_automatic_domain.py b/examples/general_contact_automatic_domain.py index 6b327df07..6731bc483 100644 --- a/examples/general_contact_automatic_domain.py +++ b/examples/general_contact_automatic_domain.py @@ -1,6 +1,6 @@ """Declared Q4 skin and two fixed tools compiled once for ordinary static solve.""" -from anysolver import BoundaryCondition,FEModel,LoadCase,create_shell_element,solve_static_nonlinear -from anysolver.general_contact import (ContactSurface,RigidContactBody,ContactSolverSettings, +from anyfesolver import BoundaryCondition,FEModel,LoadCase,create_shell_element,solve_static_nonlinear +from anyfesolver.general_contact import (ContactSurface,RigidContactBody,ContactSolverSettings, AutomaticContactParticipant,AutomaticContactDefaults,AutomaticContactDomain, resolve_automatic_contact_domain,verify_automatic_contact_resolution) @@ -37,7 +37,7 @@ def build_shell_pair(*,deformable_target=True): The geometry, material, 50 um gap and penalty stiffness follow the admitted Q4/S3 path example. One target translation is free by default. """ - from anysolver import ContactPathControl,ContactPathProgram + from anyfesolver import ContactPathControl,ContactPathProgram model=FEModel('declared-automatic-q4-s3-path') model.add_material('elastic',1e5,.3,density=1.) points=((.1,.1,.055),(1.1,.1,.055),(1.1,1.1,.055),(.1,1.1,.055), @@ -86,7 +86,7 @@ def build_projected_shell_pair(*,lifecycle=False,path_predictor='none',sliding=F press, then separates and recontacts at that lateral position. It requires the explicit development predictor; other source ux remain unknowns. """ - from anysolver import ContactPathControl,ContactPathProgram + from anyfesolver import ContactPathControl,ContactPathProgram if sliding and path_predictor!='control_projection_dev': raise ValueError('sliding example requires explicit control_projection_dev') model=FEModel('declared-automatic-refined-projected-q4-s3') diff --git a/examples/general_contact_automatic_q4_pair.py b/examples/general_contact_automatic_q4_pair.py index b02d06a3a..5f91b06e6 100644 --- a/examples/general_contact_automatic_q4_pair.py +++ b/examples/general_contact_automatic_q4_pair.py @@ -1,6 +1,6 @@ """Automatic Q4/Q4 press, 20mm actuator slide, open and recontact.""" -from anysolver import BoundaryCondition,FEModel,create_shell_element,solve_static_nonlinear -from anysolver.general_contact import (ContactSurface,ContactSolverSettings, +from anyfesolver import BoundaryCondition,FEModel,create_shell_element,solve_static_nonlinear +from anyfesolver.general_contact import (ContactSurface,ContactSolverSettings, AutomaticContactParticipant,AutomaticContactDefaults,AutomaticContactDomain, resolve_automatic_contact_domain,verify_automatic_contact_resolution) @@ -23,7 +23,7 @@ def build(*,lifecycle=True,path_predictor='control_projection_dev',sliding=True) press, then separates and recontacts at that lateral position. It requires the explicit development predictor; other source ux remain unknowns. """ - from anysolver import ContactPathControl,ContactPathProgram + from anyfesolver import ContactPathControl,ContactPathProgram if sliding and path_predictor!='control_projection_dev': raise ValueError('sliding example requires explicit control_projection_dev') model=FEModel('declared-automatic-refined-projected-q4-q4') diff --git a/examples/general_contact_automatic_s3_pair.py b/examples/general_contact_automatic_s3_pair.py index c100edbca..0e0f5e97f 100644 --- a/examples/general_contact_automatic_s3_pair.py +++ b/examples/general_contact_automatic_s3_pair.py @@ -1,6 +1,6 @@ """Automatic coarse-lower S3 pair with explicit physical skins and four path phases.""" -from anysolver import BoundaryCondition,FEModel,create_shell_element,solve_static_nonlinear -from anysolver.general_contact import (ContactSurface,ContactSolverSettings, +from anyfesolver import BoundaryCondition,FEModel,create_shell_element,solve_static_nonlinear +from anyfesolver.general_contact import (ContactSurface,ContactSolverSettings, AutomaticContactParticipant,AutomaticContactDefaults,AutomaticContactDomain, resolve_automatic_contact_domain,verify_automatic_contact_resolution) @@ -14,7 +14,7 @@ def solve_shell_pair(model,domain,settings,resolution,path,**controls): def build_s3_pair(*,director_z=-1,resolve_domain=True): """Explicit downward directors preserve physical skins; lower coarse side integrates.""" - from anysolver import ContactPathControl,ContactPathProgram + from anyfesolver import ContactPathControl,ContactPathProgram model=FEModel('declared-automatic-s3-pair') model.add_material('elastic',1e5,.3,density=1.) source=((.1,.1,.055),(.6,.1,.055),(1.1,.1,.055), diff --git a/examples/general_contact_automatic_s3_q4.py b/examples/general_contact_automatic_s3_q4.py index f7cef37ee..8f00c038c 100644 --- a/examples/general_contact_automatic_s3_q4.py +++ b/examples/general_contact_automatic_s3_q4.py @@ -1,6 +1,6 @@ """Automatic coarser S3/deformable Q4 press, 20mm actuator slide, open and recontact.""" -from anysolver import BoundaryCondition,FEModel,create_shell_element,solve_static_nonlinear -from anysolver.general_contact import (ContactSurface,ContactSolverSettings, +from anyfesolver import BoundaryCondition,FEModel,create_shell_element,solve_static_nonlinear +from anyfesolver.general_contact import (ContactSurface,ContactSolverSettings, AutomaticContactParticipant,AutomaticContactDefaults,AutomaticContactDomain, resolve_automatic_contact_domain,verify_automatic_contact_resolution) @@ -23,7 +23,7 @@ def build(*,lifecycle=True,path_predictor='control_projection_dev',sliding=True) press, then separates and recontacts at that lateral position. It requires the explicit development predictor; other three source ux remain unknowns. """ - from anysolver import ContactPathControl,ContactPathProgram + from anyfesolver import ContactPathControl,ContactPathProgram if sliding and path_predictor!='control_projection_dev': raise ValueError('sliding example requires explicit control_projection_dev') model=FEModel('declared-automatic-coarser-s3-deformable-q4') diff --git a/examples/general_contact_beam_chain_ends.py b/examples/general_contact_beam_chain_ends.py index 3b0c40b11..319efcce8 100644 --- a/examples/general_contact_beam_chain_ends.py +++ b/examples/general_contact_beam_chain_ends.py @@ -1,9 +1,9 @@ """Development-only physical-end contact between nonmatching elastic B2 chains.""" import numpy as np -from anysolver import (BoundaryCondition,ContactDefinition,ContactInteraction,ContactSolverSettings, +from anyfesolver import (BoundaryCondition,ContactDefinition,ContactInteraction,ContactSolverSettings, ContactSurface,LoadCase,solve_static_nonlinear) -from anysolver.fe_core import FEModel -from anysolver.elements import BeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.elements import BeamElement def run(cells=4,target_cells=3): diff --git a/examples/general_contact_beam_curve_ends.py b/examples/general_contact_beam_curve_ends.py index b806ee3c9..ccb76d022 100644 --- a/examples/general_contact_beam_curve_ends.py +++ b/examples/general_contact_beam_curve_ends.py @@ -3,10 +3,10 @@ Each genuine cap/cap contributes one point spring; the distributed line penalty uses its own N/m² setting. This is a code example, not engineering qualification. """ -from anysolver import (BoundaryCondition, ContactDefinition, ContactInteraction, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, LoadCase, solve_static_nonlinear) -from anysolver.elements import QuadraticBeamElement -from anysolver.fe_core import FEModel +from anyfesolver.elements import QuadraticBeamElement +from anyfesolver.fe_core import FEModel def run(): diff --git a/examples/general_contact_beam_end_capped_cylinder.py b/examples/general_contact_beam_end_capped_cylinder.py index af1cd8906..06b4925aa 100644 --- a/examples/general_contact_beam_end_capped_cylinder.py +++ b/examples/general_contact_beam_end_capped_cylinder.py @@ -1,9 +1,9 @@ """Opt-in axial B2 with separate line and hemispherical endpoint penalties.""" -from anysolver import (BoundaryCondition, ContactDefinition, ContactInteraction, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, RigidCappedCylinder, RigidContactBody, LoadCase, solve_static_nonlinear) -from anysolver.fe_core import FEModel -from anysolver.elements import BeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.elements import BeamElement def run(*,plane=False,radial=None): diff --git a/examples/general_contact_beam_pair_ends.py b/examples/general_contact_beam_pair_ends.py index f7b40d746..c78964a3e 100644 --- a/examples/general_contact_beam_pair_ends.py +++ b/examples/general_contact_beam_pair_ends.py @@ -1,8 +1,8 @@ """Development-only physical-end contact between two guided elastic B2 bars.""" -from anysolver import (BoundaryCondition, ContactDefinition, ContactInteraction, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, LoadCase, solve_static_nonlinear) -from anysolver.fe_core import FEModel -from anysolver.elements import BeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.elements import BeamElement def run(): diff --git a/examples/general_contact_beam_plane_impact.py b/examples/general_contact_beam_plane_impact.py index ce5f2be5d..b8cc7ca98 100644 --- a/examples/general_contact_beam_plane_impact.py +++ b/examples/general_contact_beam_plane_impact.py @@ -3,14 +3,14 @@ import numpy as np -from anysolver import ( +from anyfesolver import ( BoundaryCondition,ContactDefinition,ContactInteraction,ContactSolverSettings, ContactSurface,RigidContactBody, ) -from anysolver.dynamics import TransientConfig -from anysolver.elements import BeamElement,QuadraticBeamElement -from anysolver.fe_core import FEModel -from anysolver.general_contact.transient import ContactRigidTranslationHistory,ContactTransientSolverControls,solve_transient_contact +from anyfesolver.dynamics import TransientConfig +from anyfesolver.elements import BeamElement,QuadraticBeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.transient import ContactRigidTranslationHistory,ContactTransientSolverControls,solve_transient_contact def main(): diff --git a/examples/general_contact_beam_s3_transient.py b/examples/general_contact_beam_s3_transient.py index fbe21c466..67877e561 100644 --- a/examples/general_contact_beam_s3_transient.py +++ b/examples/general_contact_beam_s3_transient.py @@ -1,10 +1,10 @@ """Elastic moving beam/deformable-skin impact, explicit development profile.""" import numpy as np -from anysolver import BoundaryCondition, ContactDefinition, ContactSurface, ContactInteraction, ContactSolverSettings, create_shell_element -from anysolver.fe_core import FEModel -from anysolver.elements import BeamElement, QuadraticBeamElement -from anysolver.dynamics import TransientConfig -from anysolver.general_contact.transient import solve_transient_contact, ContactTransientSolverControls +from anyfesolver import BoundaryCondition, ContactDefinition, ContactSurface, ContactInteraction, ContactSolverSettings, create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.elements import BeamElement, QuadraticBeamElement +from anyfesolver.dynamics import TransientConfig +from anyfesolver.general_contact.transient import solve_transient_contact, ContactTransientSolverControls def build(*,quadratic=False,unequal=False,line_stiffness=1.e5,flexural=False): diff --git a/examples/general_contact_beam_s3_transient_directional.py b/examples/general_contact_beam_s3_transient_directional.py index 8f488475e..38c878d83 100644 --- a/examples/general_contact_beam_s3_transient_directional.py +++ b/examples/general_contact_beam_s3_transient_directional.py @@ -1,7 +1,7 @@ """Exact binary axis-aligned full-line first touch; explicit V19 development profile.""" from examples.general_contact_beam_s3_transient_rotational import build as rotational_build -from anysolver.general_contact.transient import solve_transient_contact,ContactTransientSolverControls -from anysolver.dynamics import TransientConfig +from anyfesolver.general_contact.transient import solve_transient_contact,ContactTransientSolverControls +from anyfesolver.dynamics import TransientConfig def build(): diff --git a/examples/general_contact_beam_s3_transient_directional_loaded_impact.py b/examples/general_contact_beam_s3_transient_directional_loaded_impact.py index 37d88afbd..a3732f3cc 100644 --- a/examples/general_contact_beam_s3_transient_directional_loaded_impact.py +++ b/examples/general_contact_beam_s3_transient_directional_loaded_impact.py @@ -91,8 +91,8 @@ def independent_reference(model,u,v): return dict(independent_min_gap=minimum,energy=float(beam+shell+membrane+contact+kinetic),beam=float(beam),shell=float(shell),membrane=membrane,contact=float(contact),kinetic=float(kinetic),details=details),force,mass def run(*,dt=DT,end=END,restart=None,acceleration_unknown=True): - from anysolver.general_contact.transient import solve_transient_contact,ContactTransientSolverControls - from anysolver.dynamics import TransientConfig + from anyfesolver.general_contact.transient import solve_transient_contact,ContactTransientSolverControls + from anyfesolver.dynamics import TransientConfig m,d,s,u,v,load,initial=prepare() result=solve_transient_contact(m,d,TransientConfig(dt,end,initial_displacement=u,initial_velocity=v),base_load_case=load,contact_settings=s, solver_controls=ContactTransientSolverControls(allow_equilibrated_directional_beam_s3_dev=True,save_constraint_reactions_dev=True, diff --git a/examples/general_contact_beam_s3_transient_directional_tilted.py b/examples/general_contact_beam_s3_transient_directional_tilted.py index f39e4ad1c..61e0d3e92 100644 --- a/examples/general_contact_beam_s3_transient_directional_tilted.py +++ b/examples/general_contact_beam_s3_transient_directional_tilted.py @@ -11,11 +11,11 @@ def _exact_float(x): return value def build_pose(): - from anysolver import (BoundaryCondition, ContactDefinition, ContactSurface, + from anyfesolver import (BoundaryCondition, ContactDefinition, ContactSurface, ContactInteraction, ContactSolverSettings, create_shell_element) - from anysolver.elements import QuadraticBeamElement - from anysolver.fe_core import FEModel + from anyfesolver.elements import QuadraticBeamElement + from anyfesolver.fe_core import FEModel m, delta, height, radius = 256, Q(1, 16384), Q(1, 128), Q(1, 128) X, Y, rise = (m*m-1)*delta, Q(4), 2*m*delta stations = (Q(1, 4), Q(5, 16), Q(3, 8)) @@ -64,14 +64,14 @@ def build_pose(): def prepare(): - from anysolver import LoadCase - from anysolver.assembly import assemble_mass_matrix,build_constraint_transformation - from anysolver.matrix_assembly import assemble_stiffness_matrix - from anysolver.algebraic_dynamics import build_declared_algebraic_basis - from anysolver.nonlinear_static import _assemble_nonlinear_system - from anysolver.nonlinear_state import discard_active_state_candidate - from anysolver.general_contact.runtime import suspend_contact - from anysolver.general_contact.beam_s3_directional_rates import DirectionalBeamS3Manager,directional_coefficients,solve_directional_velocity,exact_gap_polynomial + from anyfesolver import LoadCase + from anyfesolver.assembly import assemble_mass_matrix,build_constraint_transformation + from anyfesolver.matrix_assembly import assemble_stiffness_matrix + from anyfesolver.algebraic_dynamics import build_declared_algebraic_basis + from anyfesolver.nonlinear_static import _assemble_nonlinear_system + from anyfesolver.nonlinear_state import discard_active_state_candidate + from anyfesolver.general_contact.runtime import suspend_contact + from anyfesolver.general_contact.beam_s3_directional_rates import DirectionalBeamS3Manager,directional_coefficients,solve_directional_velocity,exact_gap_polynomial m,d,s,u,refs,dofs,h,rho,X,Y,rise=build_pose();m.apply_boundary_conditions() K0,_=assemble_stiffness_matrix(m);M,_=assemble_mass_matrix(m) _,_,T,offset,independent,_=build_constraint_transformation(K0,np.zeros(len(u)),m) @@ -97,8 +97,8 @@ def prepare(): def run(*,dt=1.e-5,end=3.e-5,restart=None): - from anysolver.general_contact.transient import solve_transient_contact,ContactTransientSolverControls - from anysolver.dynamics import TransientConfig + from anyfesolver.general_contact.transient import solve_transient_contact,ContactTransientSolverControls + from anyfesolver.dynamics import TransientConfig m,d,s,u,v,load,initial=prepare() result=solve_transient_contact(m,d,TransientConfig(dt,end,initial_displacement=u,initial_velocity=v),base_load_case=load,contact_settings=s, solver_controls=ContactTransientSolverControls(allow_equilibrated_directional_beam_s3_dev=True,save_constraint_reactions_dev=True), diff --git a/examples/general_contact_beam_s3_transient_rotational.py b/examples/general_contact_beam_s3_transient_rotational.py index 1601f8676..5d1d551a8 100644 --- a/examples/general_contact_beam_s3_transient_rotational.py +++ b/examples/general_contact_beam_s3_transient_rotational.py @@ -1,8 +1,8 @@ """Numerical descriptor impact with actual affine eccentric target rotations.""" import numpy as np -from anysolver import BoundaryCondition -from anysolver.dynamics import TransientConfig -from anysolver.general_contact.transient import solve_transient_contact,ContactTransientSolverControls +from anyfesolver import BoundaryCondition +from anyfesolver.dynamics import TransientConfig +from anyfesolver.general_contact.transient import solve_transient_contact,ContactTransientSolverControls from examples.general_contact_beam_s3_transient import build as base_build diff --git a/examples/general_contact_cylinder.py b/examples/general_contact_cylinder.py index 6682806cf..df5c129bd 100644 --- a/examples/general_contact_cylinder.py +++ b/examples/general_contact_cylinder.py @@ -1,17 +1,17 @@ """Force-controlled Q4 shell contact with a fixed infinite cylinder. -Run with ANYsolver installed: python examples/general_contact_cylinder.py +Run with ANYfeSolver installed: python examples/general_contact_cylinder.py The declared 4 mm gap budget is for development smoke, not qualification. """ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, LoadCase, RigidContactBody, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_d1_interior_controls_dev.py b/examples/general_contact_d1_interior_controls_dev.py index a72724ef9..b3b84e4ec 100644 --- a/examples/general_contact_d1_interior_controls_dev.py +++ b/examples/general_contact_d1_interior_controls_dev.py @@ -1,6 +1,6 @@ """Development example: bounded nonmatching Q4/S3 contact under both controls. -Run against an installed ANYsolver package. This example is implemented and +Run against an installed ANYfeSolver package. This example is implemented and locally tested; D1 scientific acceptance and release remain open. """ @@ -13,14 +13,14 @@ import numpy as np -import anysolver -from anysolver import ( +import anyfesolver +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathNodalForce, ContactPathProgram, ContactSolverSettings, ContactSurface, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def build_model(): @@ -356,7 +356,7 @@ def run(): "split_restart_verified": True, "restart_maximum_displacement_difference_m": displacement_error, "restart_maximum_contact_force_difference_n": force_error, - "anysolver_module": str(Path(anysolver.__file__).resolve()), + "anyfesolver_module": str(Path(anyfesolver.__file__).resolve()), "steps": records, } diff --git a/examples/general_contact_deformable_round_beam_s3.py b/examples/general_contact_deformable_round_beam_s3.py index cdd4b1c00..a940a99b8 100644 --- a/examples/general_contact_deformable_round_beam_s3.py +++ b/examples/general_contact_deformable_round_beam_s3.py @@ -4,10 +4,10 @@ All dimensions SI; the explicit finite line penalty is not hard contact. """ import json -from anysolver import (BoundaryCondition, ContactDefinition, ContactSurface, ContactInteraction, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactSurface, ContactInteraction, ContactSolverSettings, LoadCase, create_shell_element, solve_static_nonlinear) -from anysolver.fe_core import FEModel -from anysolver.elements import BeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.elements import BeamElement def fixture(): model=FEModel('deformable_line_skin_dev') diff --git a/examples/general_contact_deformable_s3_caps.py b/examples/general_contact_deformable_s3_caps.py index a4d53e1dc..dea1aa609 100644 --- a/examples/general_contact_deformable_s3_caps.py +++ b/examples/general_contact_deformable_s3_caps.py @@ -3,11 +3,11 @@ Development profile: fixed shell directors, frictionless elastic materials, explicit radius-covering face clearance and distinct line/endpoint stiffness. """ -from anysolver import (BoundaryCondition, ContactDefinition, ContactSurface, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactSurface, ContactInteraction, ContactSolverSettings, LoadCase, create_shell_element, solve_static_nonlinear) -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel def build(): diff --git a/examples/general_contact_deforming_q4_planes_dev.py b/examples/general_contact_deforming_q4_planes_dev.py index e2a8ed6ca..1df695f72 100644 --- a/examples/general_contact_deforming_q4_planes_dev.py +++ b/examples/general_contact_deforming_q4_planes_dev.py @@ -8,7 +8,7 @@ import json from pathlib import Path import numpy as np -from anysolver import (BoundaryCondition,ContactDefinition,ContactInteraction, +from anyfesolver import (BoundaryCondition,ContactDefinition,ContactInteraction, ContactSurface,ContactTransientSolverControls,FEModel,RigidContactBody, TransientConfig,create_shell_element,solve_transient_contact) diff --git a/examples/general_contact_deforming_s3_impact_dev.py b/examples/general_contact_deforming_s3_impact_dev.py index 166941496..beeb454bc 100644 --- a/examples/general_contact_deforming_s3_impact_dev.py +++ b/examples/general_contact_deforming_s3_impact_dev.py @@ -9,8 +9,8 @@ from pathlib import Path import runpy import numpy as np -from anysolver import ContactTransientSolverControls, TransientConfig, solve_transient_contact -from anysolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver import ContactTransientSolverControls, TransientConfig, solve_transient_contact +from anyfesolver.matrix_assembly import assemble_stiffness_matrix _fixture = runpy.run_path(str(Path(__file__).with_name('general_contact_nonuniform_s3_impact_dev.py'))) SUPPORT, KN, GAP = (_fixture[key] for key in ('SUPPORT','KN','GAP')) diff --git a/examples/general_contact_distributed_q4_s3_cycle.py b/examples/general_contact_distributed_q4_s3_cycle.py index 28491cd54..b7a333221 100644 --- a/examples/general_contact_distributed_q4_s3_cycle.py +++ b/examples/general_contact_distributed_q4_s3_cycle.py @@ -1,6 +1,6 @@ """Planar Q4/S3 press, slide, open and recontact under distributed force. -Run from the ANYsolver checkout with ``python -m +Run from the ANYfeSolver checkout with ``python -m examples.general_contact_distributed_q4_s3_cycle``. The default eight-Q4 mesh is a short demonstration. The independently reviewed response uses 24 Q4s; general C1 acceptance remains open. @@ -13,8 +13,8 @@ import json from pathlib import Path -import anysolver -from anysolver import solve_static_nonlinear, validate_general_contact +import anyfesolver +from anyfesolver import solve_static_nonlinear, validate_general_contact from scripts.general_contact_d1_mixed_mesh_jet2_schur_press import build_case @@ -66,7 +66,7 @@ def run(columns: int) -> dict: "status": result.status, "gap_tolerance_m": definition.interactions[0].gap_tolerance, "has_restart_checkpoint": result.restart_checkpoint is not None, - "anysolver_module": str(Path(anysolver.__file__).resolve()), + "anyfesolver_module": str(Path(anyfesolver.__file__).resolve()), "steps": records, } diff --git a/examples/general_contact_enriched_d1_path.py b/examples/general_contact_enriched_d1_path.py index 30512d0a2..5dce66728 100644 --- a/examples/general_contact_enriched_d1_path.py +++ b/examples/general_contact_enriched_d1_path.py @@ -10,9 +10,9 @@ import os from pathlib import Path import numpy as np -from anysolver.e4_pl_enriched import EnrichedProfileError -from anysolver.general_contact.enriched_overlap import QuadraturePolicy -from anysolver.general_contact.enriched_path import EnrichedPathOwner +from anyfesolver.e4_pl_enriched import EnrichedProfileError +from anyfesolver.general_contact.enriched_overlap import QuadraturePolicy +from anyfesolver.general_contact.enriched_path import EnrichedPathOwner INPUT=Path(__file__).resolve().parents[1]/'docs/reference_cases/enriched_d1_registered_inputs_20261019.json' diff --git a/examples/general_contact_enriched_matched.py b/examples/general_contact_enriched_matched.py index 2add4815d..48e8761ff 100644 --- a/examples/general_contact_enriched_matched.py +++ b/examples/general_contact_enriched_matched.py @@ -10,9 +10,9 @@ from pathlib import Path import numpy as np -from anysolver.e4_pl_enriched import EnrichedProfileError -from anysolver.general_contact.enriched_overlap import QuadraturePolicy -from anysolver.general_contact.enriched_nonlinear import ( +from anyfesolver.e4_pl_enriched import EnrichedProfileError +from anyfesolver.general_contact.enriched_overlap import QuadraturePolicy +from anyfesolver.general_contact.enriched_nonlinear import ( NonlinearEnrichedSystem,PairDefinition,MixedCriteria,IterationControl, ) @@ -99,8 +99,8 @@ def sampled_physical_gap(model,system,coordinates): quantities are explicitly labelled, rather than replacing them by target plane distance. The old target-plane sample is separate diagnostic data. """ - from anysolver.general_contact.q4_skin_work import Q4SkinWorkAdapter - from anysolver.general_contact.s3_skin_work import S3SkinWorkAdapter + from anyfesolver.general_contact.q4_skin_work import Q4SkinWorkAdapter + from anyfesolver.general_contact.s3_skin_work import S3SkinWorkAdapter u=np.asarray(coordinates,dtype=float) if u.shape!=system.offset.shape or not np.all(np.isfinite(u)): raise EnrichedProfileError('finite complete sampled physical pose required') diff --git a/examples/general_contact_enriched_patch.py b/examples/general_contact_enriched_patch.py index 50302ae25..dbc8ae4cd 100644 --- a/examples/general_contact_enriched_patch.py +++ b/examples/general_contact_enriched_patch.py @@ -4,9 +4,9 @@ registered 174/300-coordinate cases. Original nodal coordinates are first, followed by four physical transverse bubble coordinates per source Q4. """ -from anysolver import FEModel, BoundaryCondition, create_shell_element -from anysolver.general_contact.enriched_overlap import QuadraturePolicy -from anysolver.general_contact.enriched_static import EnrichedStaticSystem, PairDefinition +from anyfesolver import FEModel, BoundaryCondition, create_shell_element +from anyfesolver.general_contact.enriched_overlap import QuadraturePolicy +from anyfesolver.general_contact.enriched_static import EnrichedStaticSystem, PairDefinition def build(*, target_z=0., target_shift=0., source_offset=0., target_offset=0., rotation=None, @@ -46,7 +46,7 @@ def build(*, target_z=0., target_shift=0., source_offset=0., target_offset=0., r if __name__ == "__main__": import json import numpy as np - from anysolver.general_contact.enriched_static import MixedCriteria, IterationControl + from anyfesolver.general_contact.enriched_static import MixedCriteria, IterationControl _, system = build(target_z=-.01) result = system.solve(np.zeros(system.offset.size), criteria=MixedCriteria(.04, 1e-6, 1e-8), diff --git a/examples/general_contact_finite_automatic_shell.py b/examples/general_contact_finite_automatic_shell.py index 700dc6a72..1488cdc33 100644 --- a/examples/general_contact_finite_automatic_shell.py +++ b/examples/general_contact_finite_automatic_shell.py @@ -6,7 +6,7 @@ from examples.general_contact_finite_v2d_pair import ( build as paired_build,solve as paired_solve,report_result as paired_report,json_value,rigid_pose, ) -from anysolver.general_contact import ( +from anyfesolver.general_contact import ( AutomaticContactDomain,AutomaticContactDefaults,AutomaticContactParticipant, AutomaticContactResolution,resolve_automatic_contact_domain,verify_automatic_contact_resolution, ) diff --git a/examples/general_contact_finite_q4_v2d.py b/examples/general_contact_finite_q4_v2d.py index 2725c0ad7..0d01af61b 100644 --- a/examples/general_contact_finite_q4_v2d.py +++ b/examples/general_contact_finite_q4_v2d.py @@ -10,9 +10,9 @@ import math from pathlib import Path import numpy as np -from anysolver import FEModel, BoundaryCondition, create_shell_element, solve_static_nonlinear -from anysolver.general_contact import ContactSurface, ContactDefinition, ContactInteraction, ContactSolverSettings -from anysolver.general_contact.static_path import ContactPathControl, ContactPathNodalForce, ContactPathProgram +from anyfesolver import FEModel, BoundaryCondition, create_shell_element, solve_static_nonlinear +from anyfesolver.general_contact import ContactSurface, ContactDefinition, ContactInteraction, ContactSolverSettings +from anyfesolver.general_contact.static_path import ContactPathControl, ContactPathNodalForce, ContactPathProgram from examples.general_contact_finite_rotation_shell_work import rigid_pose, rotation SCHEMA = 'ANYSOLVER_FINITE_Q4_V2D_EXAMPLE_V1' diff --git a/examples/general_contact_finite_rotation_shell_work.py b/examples/general_contact_finite_rotation_shell_work.py index fe357ec31..e0a58be3e 100644 --- a/examples/general_contact_finite_rotation_shell_work.py +++ b/examples/general_contact_finite_rotation_shell_work.py @@ -7,9 +7,9 @@ from dataclasses import replace import math import numpy as np -from anysolver import BoundaryCondition, solve_static_nonlinear -from anysolver.general_contact import resolve_automatic_contact_domain -from anysolver.general_contact.static_path import ( +from anyfesolver import BoundaryCondition, solve_static_nonlinear +from anyfesolver.general_contact import resolve_automatic_contact_domain +from anyfesolver.general_contact.static_path import ( ContactPathControl, ContactPathNodalForce, ContactPathProgram, ) from examples.general_contact_q4_pair_monolithic_cycle import build as base diff --git a/examples/general_contact_finite_v2d_pair.py b/examples/general_contact_finite_v2d_pair.py index f57534732..a8f4349e0 100644 --- a/examples/general_contact_finite_v2d_pair.py +++ b/examples/general_contact_finite_v2d_pair.py @@ -10,9 +10,9 @@ import math from pathlib import Path import numpy as np -from anysolver import FEModel, BoundaryCondition, create_shell_element, solve_static_nonlinear -from anysolver.general_contact import ContactSurface, ContactDefinition, ContactInteraction, ContactSolverSettings -from anysolver.general_contact.static_path import ContactPathControl, ContactPathNodalForce, ContactPathProgram +from anyfesolver import FEModel, BoundaryCondition, create_shell_element, solve_static_nonlinear +from anyfesolver.general_contact import ContactSurface, ContactDefinition, ContactInteraction, ContactSolverSettings +from anyfesolver.general_contact.static_path import ContactPathControl, ContactPathNodalForce, ContactPathProgram from examples.general_contact_finite_rotation_shell_work import rigid_pose, rotation SCHEMA = 'ANYSOLVER_FINITE_V2D_PAIR_EXAMPLE_V1' diff --git a/examples/general_contact_finite_v2d_rigid_patch.py b/examples/general_contact_finite_v2d_rigid_patch.py index a827f6153..c32511e40 100644 --- a/examples/general_contact_finite_v2d_rigid_patch.py +++ b/examples/general_contact_finite_v2d_rigid_patch.py @@ -4,10 +4,10 @@ import json from pathlib import Path import numpy as np -from anysolver import (FEModel, BoundaryCondition, ContactDefinition, ContactSurface, +from anyfesolver import (FEModel, BoundaryCondition, ContactDefinition, ContactSurface, ContactInteraction, ContactSolverSettings, LoadCase, create_shell_element, NonlinearLoadProgram, NonlinearLoadStage, solve_static_nonlinear) -from anysolver.general_contact.triangulated_rigid import TriangulatedRigidContactBody +from anyfesolver.general_contact.triangulated_rigid import TriangulatedRigidContactBody SCHEMA='ANYSOLVER_FINITE_V2D_FIXED_RIGID_EXAMPLE_V1' @@ -70,7 +70,7 @@ def json_value(value): def fixture(model,definition,settings,program,seed): - from anysolver.nonlinear_restart import load_case_descriptor + from anyfesolver.nonlinear_restart import load_case_descriptor return dict(nodes=4,elements=2,dofs=model.mesh.dof_manager.total_dofs, contact=asdict(definition),settings=asdict(settings),initial_displacements=seed.tolist(), initial_rotation_rad=.5,force_scale_N=1e-4,moment_scale_Nm=1e-4, diff --git a/examples/general_contact_fixed_projection_skew.py b/examples/general_contact_fixed_projection_skew.py index 71d14dbb8..0ce050b23 100644 --- a/examples/general_contact_fixed_projection_skew.py +++ b/examples/general_contact_fixed_projection_skew.py @@ -8,13 +8,13 @@ import numpy as np -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathProgram, ContactSolverSettings, ContactSurface, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel GAP_BUDGET_M = 5.e-5 diff --git a/examples/general_contact_free_shell_sphere_impact.py b/examples/general_contact_free_shell_sphere_impact.py index defa13edd..f9e08f0ea 100644 --- a/examples/general_contact_free_shell_sphere_impact.py +++ b/examples/general_contact_free_shell_sphere_impact.py @@ -4,10 +4,10 @@ import numpy as np -from anysolver import (BoundaryCondition, ContactDefinition, ContactInteraction, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, FEModel, LoadCase, RigidContactBody, create_shell_element) -from anysolver.dynamics import TransientConfig -from anysolver.general_contact.transient import ( +from anyfesolver.dynamics import TransientConfig +from anyfesolver.general_contact.transient import ( ContactFreeRigidBody, ContactNodalLoadHistory, ContactTransientSolverControls, solve_transient_contact) diff --git a/examples/general_contact_free_sphere_impact.py b/examples/general_contact_free_sphere_impact.py index 84fa96ede..1f762a628 100644 --- a/examples/general_contact_free_sphere_impact.py +++ b/examples/general_contact_free_sphere_impact.py @@ -3,12 +3,12 @@ import numpy as np -from anysolver import (BoundaryCondition, ContactDefinition, ContactInteraction, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, RigidContactBody) -from anysolver.dynamics import TransientConfig -from anysolver.elements import BeamElement, QuadraticBeamElement -from anysolver.fe_core import FEModel -from anysolver.general_contact.transient import ( +from anyfesolver.dynamics import TransientConfig +from anyfesolver.elements import BeamElement, QuadraticBeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.transient import ( ContactFreeRigidBody, ContactTransientSolverControls, solve_transient_contact) diff --git a/examples/general_contact_free_target_cycle_dev.py b/examples/general_contact_free_target_cycle_dev.py index f0d3d7ae0..c69e11883 100644 --- a/examples/general_contact_free_target_cycle_dev.py +++ b/examples/general_contact_free_target_cycle_dev.py @@ -1,7 +1,7 @@ """Development example: deformable Q4/S3 press, slide, open and recontact. Run with ``python general_contact_free_target_cycle_dev.py`` against an -installed ANYsolver package. The contact route is implemented and locally +installed ANYfeSolver package. The contact route is implemented and locally tested; the complete D1 capability is not independently accepted or released. """ @@ -13,14 +13,14 @@ import numpy as np -import anysolver -from anysolver import ( +import anyfesolver +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathNodalForce, ContactPathProgram, ContactSolverSettings, ContactSurface, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def build_case(): @@ -322,7 +322,7 @@ def run() -> dict: "split_restart_verified": True, "restart_maximum_displacement_difference": displacement_error, "restart_maximum_contact_force_difference_n": force_error, - "anysolver_module": str(Path(anysolver.__file__).resolve()), + "anyfesolver_module": str(Path(anyfesolver.__file__).resolve()), "steps": records, } diff --git a/examples/general_contact_guided_pair.py b/examples/general_contact_guided_pair.py index 1f027bc85..c4ebd0ced 100644 --- a/examples/general_contact_guided_pair.py +++ b/examples/general_contact_guided_pair.py @@ -12,7 +12,7 @@ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, @@ -22,7 +22,7 @@ solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_guided_shell_pair_impact_dev.py b/examples/general_contact_guided_shell_pair_impact_dev.py index f70f18f16..b42dea436 100644 --- a/examples/general_contact_guided_shell_pair_impact_dev.py +++ b/examples/general_contact_guided_shell_pair_impact_dev.py @@ -8,7 +8,7 @@ import json from pathlib import Path import numpy as np -from anysolver import (BoundaryCondition,ContactDefinition,ContactInteraction, +from anyfesolver import (BoundaryCondition,ContactDefinition,ContactInteraction, ContactSurface,ContactTransientSolverControls,FEModel,TransientConfig, create_shell_element,solve_transient_contact) diff --git a/examples/general_contact_hemisphere_cylinder.py b/examples/general_contact_hemisphere_cylinder.py index 19aa57203..a06ee40fe 100644 --- a/examples/general_contact_hemisphere_cylinder.py +++ b/examples/general_contact_hemisphere_cylinder.py @@ -1,9 +1,9 @@ """Elastic B3 bar with declared actual hemisphere support on a fixed infinite cylinder.""" -from anysolver import (BoundaryCondition, ContactDefinition, ContactSurface, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactSurface, ContactInteraction, ContactSolverSettings, RigidContactBody, LoadCase, solve_static_nonlinear) -from anysolver.elements import QuadraticBeamElement -from anysolver.fe_core import FEModel +from anyfesolver.elements import QuadraticBeamElement +from anyfesolver.fe_core import FEModel def run(): diff --git a/examples/general_contact_hemisphere_cylinder_motion.py b/examples/general_contact_hemisphere_cylinder_motion.py index 65ca7a157..1eea3e818 100644 --- a/examples/general_contact_hemisphere_cylinder_motion.py +++ b/examples/general_contact_hemisphere_cylinder_motion.py @@ -1,9 +1,9 @@ """Elastic B3 bar with declared actual hemisphere support on a prescribed translating infinite cylinder.""" -from anysolver import (BoundaryCondition, ContactDefinition, ContactSurface, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactSurface, ContactInteraction, ContactSolverSettings, RigidContactBody, LoadCase, solve_static_nonlinear) -from anysolver.elements import QuadraticBeamElement -from anysolver.fe_core import FEModel +from anyfesolver.elements import QuadraticBeamElement +from anyfesolver.fe_core import FEModel def run(*, coupled_load_seed=False): diff --git a/examples/general_contact_hemisphere_plane.py b/examples/general_contact_hemisphere_plane.py index 3ace59038..803d6dae6 100644 --- a/examples/general_contact_hemisphere_plane.py +++ b/examples/general_contact_hemisphere_plane.py @@ -1,9 +1,9 @@ """Opt-in static hemisphere/rim seam; a development example, not qualification.""" -from anysolver import (BoundaryCondition, ContactDefinition, ContactSurface, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactSurface, ContactInteraction, ContactSolverSettings, RigidContactBody, LoadCase, solve_static_nonlinear) -from anysolver.fe_core import FEModel -from anysolver.elements import BeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.elements import BeamElement def run(): diff --git a/examples/general_contact_hemisphere_sphere.py b/examples/general_contact_hemisphere_sphere.py index df299c7bb..f286119c0 100644 --- a/examples/general_contact_hemisphere_sphere.py +++ b/examples/general_contact_hemisphere_sphere.py @@ -1,9 +1,9 @@ """Elastic B3 bar with declared actual hemisphere support on a fixed sphere.""" -from anysolver import (BoundaryCondition, ContactDefinition, ContactSurface, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactSurface, ContactInteraction, ContactSolverSettings, RigidContactBody, LoadCase, solve_static_nonlinear) -from anysolver.elements import QuadraticBeamElement -from anysolver.fe_core import FEModel +from anyfesolver.elements import QuadraticBeamElement +from anyfesolver.fe_core import FEModel def run(): diff --git a/examples/general_contact_initial_contact_seed_dev.py b/examples/general_contact_initial_contact_seed_dev.py index 168f96ae2..f1b280177 100644 --- a/examples/general_contact_initial_contact_seed_dev.py +++ b/examples/general_contact_initial_contact_seed_dev.py @@ -1,6 +1,6 @@ """Development example: coupled 4x4 Q4/S3 contact with the initial-contact seed. -Run against an installed ANYsolver package. The opt-in +Run against an installed ANYfeSolver package. The opt-in ``initial_contact_seed='linearized_kkt_dev'`` selector adds one origin-linearized KKT pressure proposal at the cold start of the explicit contact path; every acceptance, derivative, integration and physical @@ -39,13 +39,13 @@ import numpy as np -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathNodalForce, ContactPathProgram, ContactSolverSettings, ContactSurface, create_shell_element, solve_static_nonlinear, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def build_model(): diff --git a/examples/general_contact_mixed_patch_sliding.py b/examples/general_contact_mixed_patch_sliding.py index a24d79cc0..ac31adfe0 100644 --- a/examples/general_contact_mixed_patch_sliding.py +++ b/examples/general_contact_mixed_patch_sliding.py @@ -8,12 +8,12 @@ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, DisplacementControl, LoadCase, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_mixed_path.py b/examples/general_contact_mixed_path.py index 149b7e449..631490fbe 100644 --- a/examples/general_contact_mixed_path.py +++ b/examples/general_contact_mixed_path.py @@ -12,13 +12,13 @@ import json import argparse -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathProgram, ContactSolverSettings, ContactSurface, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def main(*, augmented: bool = False, augmented_cycle: bool = False, diff --git a/examples/general_contact_moving_plane.py b/examples/general_contact_moving_plane.py index f289c7ead..db6261610 100644 --- a/examples/general_contact_moving_plane.py +++ b/examples/general_contact_moving_plane.py @@ -1,18 +1,18 @@ """A prescribed plane presses a Q4 shell through force-controlled static steps. -Run with ANYsolver installed: python examples/general_contact_moving_plane.py +Run with ANYfeSolver installed: python examples/general_contact_moving_plane.py The 20 µm gap budget is 10^-3 of shell thickness; this is development smoke. """ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, LoadCase, NonlinearConvergenceSettings, RigidContactBody, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_moving_plane_displacement.py b/examples/general_contact_moving_plane_displacement.py index 4a83157b7..d66ac8e83 100644 --- a/examples/general_contact_moving_plane_displacement.py +++ b/examples/general_contact_moving_plane_displacement.py @@ -1,18 +1,18 @@ """A translating plane and prescribed shell displacement share one static path. -Run with ANYsolver installed: python examples/general_contact_moving_plane_displacement.py +Run with ANYfeSolver installed: python examples/general_contact_moving_plane_displacement.py The 20 µm gap budget is 10^-3 of shell thickness; this is development smoke. """ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, DisplacementControl, LoadCase, RigidContactBody, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_moving_sphere.py b/examples/general_contact_moving_sphere.py index 006c1b39b..dc3d5e26b 100644 --- a/examples/general_contact_moving_sphere.py +++ b/examples/general_contact_moving_sphere.py @@ -1,18 +1,18 @@ """A prescribed large-radius sphere presses a Q4 shell through static steps. -Run with ANYsolver installed: python examples/general_contact_moving_sphere.py +Run with ANYfeSolver installed: python examples/general_contact_moving_sphere.py The 20 µm gap budget is 10^-3 of shell thickness; this is development smoke. """ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, LoadCase, NonlinearConvergenceSettings, RigidContactBody, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_multiple_beam_ends.py b/examples/general_contact_multiple_beam_ends.py index 8b14b0faf..332142f6d 100644 --- a/examples/general_contact_multiple_beam_ends.py +++ b/examples/general_contact_multiple_beam_ends.py @@ -1,8 +1,8 @@ """Development-only guided B3 pressed outward against two physical-end obstacles.""" -from anysolver import (BoundaryCondition,ContactDefinition,ContactInteraction,ContactSolverSettings, +from anyfesolver import (BoundaryCondition,ContactDefinition,ContactInteraction,ContactSolverSettings, ContactSurface,RigidContactBody,RigidCappedCylinder,LoadCase,solve_static_nonlinear) -from anysolver.fe_core import FEModel -from anysolver.elements import QuadraticBeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.elements import QuadraticBeamElement def run(right_obstacle='sphere'): diff --git a/examples/general_contact_multiple_beam_s3_caps.py b/examples/general_contact_multiple_beam_s3_caps.py index 6a3f72263..fe579f410 100644 --- a/examples/general_contact_multiple_beam_s3_caps.py +++ b/examples/general_contact_multiple_beam_s3_caps.py @@ -2,10 +2,10 @@ Installed-tested development example; not an engineering qualification. """ -from anysolver import (FEModel, BoundaryCondition, LoadCase, ContactDefinition, +from anyfesolver import (FEModel, BoundaryCondition, LoadCase, ContactDefinition, ContactSurface, ContactInteraction, ContactSolverSettings, solve_static_nonlinear, create_shell_element) -from anysolver.elements import BeamElement +from anyfesolver.elements import BeamElement def build(): diff --git a/examples/general_contact_multiple_beam_s3_transient.py b/examples/general_contact_multiple_beam_s3_transient.py index ebc61cbf9..3194fdcc6 100644 --- a/examples/general_contact_multiple_beam_s3_transient.py +++ b/examples/general_contact_multiple_beam_s3_transient.py @@ -5,12 +5,12 @@ beam/shell mass, without contact-supplied inertia or hidden constraints. """ import numpy as np -from anysolver import (BoundaryCondition, ContactDefinition, ContactSurface, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactSurface, ContactInteraction, ContactSolverSettings, create_shell_element) -from anysolver.fe_core import FEModel -from anysolver.elements import BeamElement, QuadraticBeamElement -from anysolver.dynamics import TransientConfig -from anysolver.general_contact.transient import (solve_transient_contact, +from anyfesolver.fe_core import FEModel +from anyfesolver.elements import BeamElement, QuadraticBeamElement +from anyfesolver.dynamics import TransientConfig +from anyfesolver.general_contact.transient import (solve_transient_contact, ContactTransientSolverControls) diff --git a/examples/general_contact_multiple_hemisphere_analytic.py b/examples/general_contact_multiple_hemisphere_analytic.py index ab6bd975b..4bbdee5c5 100644 --- a/examples/general_contact_multiple_hemisphere_analytic.py +++ b/examples/general_contact_multiple_hemisphere_analytic.py @@ -1,9 +1,9 @@ """B3 physical ends against a fixed plane and sphere; developmental static workflow.""" -from anysolver import (BoundaryCondition, ContactDefinition, ContactSurface, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactSurface, ContactInteraction, ContactSolverSettings, RigidContactBody, LoadCase, solve_static_nonlinear) -from anysolver.elements import QuadraticBeamElement -from anysolver.fe_core import FEModel +from anyfesolver.elements import QuadraticBeamElement +from anyfesolver.fe_core import FEModel def run(): diff --git a/examples/general_contact_multiple_hemisphere_planes.py b/examples/general_contact_multiple_hemisphere_planes.py index 0be52f2fe..1b2c1b6c8 100644 --- a/examples/general_contact_multiple_hemisphere_planes.py +++ b/examples/general_contact_multiple_hemisphere_planes.py @@ -1,9 +1,9 @@ """B3 physical ends against two fixed planes; developmental static workflow.""" -from anysolver import (BoundaryCondition, ContactDefinition, ContactSurface, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactSurface, ContactInteraction, ContactSolverSettings, RigidContactBody, LoadCase, solve_static_nonlinear) -from anysolver.elements import QuadraticBeamElement -from anysolver.fe_core import FEModel +from anyfesolver.elements import QuadraticBeamElement +from anyfesolver.fe_core import FEModel def run(): diff --git a/examples/general_contact_multiple_q4_planes_dev.py b/examples/general_contact_multiple_q4_planes_dev.py index 04697bc89..136fd8937 100644 --- a/examples/general_contact_multiple_q4_planes_dev.py +++ b/examples/general_contact_multiple_q4_planes_dev.py @@ -7,7 +7,7 @@ import json from pathlib import Path import numpy as np -from anysolver import (BoundaryCondition, ContactDefinition, ContactInteraction, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactInteraction, ContactSurface, ContactTransientSolverControls, FEModel, RigidContactBody, TransientConfig, create_shell_element, solve_transient_contact) diff --git a/examples/general_contact_multiple_round_beam_tools.py b/examples/general_contact_multiple_round_beam_tools.py index 58c352475..1fd5b00f0 100644 --- a/examples/general_contact_multiple_round_beam_tools.py +++ b/examples/general_contact_multiple_round_beam_tools.py @@ -5,11 +5,11 @@ """ import json -from anysolver import (BoundaryCondition, ContactDefinition, ContactInteraction, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, LoadCase, RigidContactBody, solve_static_nonlinear, validate_general_contact) -from anysolver.elements import QuadraticBeamElement -from anysolver.fe_core import FEModel +from anyfesolver.elements import QuadraticBeamElement +from anyfesolver.fe_core import FEModel def main(): diff --git a/examples/general_contact_native_checkpoint_results.py b/examples/general_contact_native_checkpoint_results.py index 20ca191d4..ac2cb4e1d 100644 --- a/examples/general_contact_native_checkpoint_results.py +++ b/examples/general_contact_native_checkpoint_results.py @@ -1,7 +1,7 @@ """Public DATA-only consumer of a portable native accepted-prefix capsule.""" from pathlib import Path -from anysolver.general_contact import read_native_contact_checkpoint_results -from anysolver.general_contact.native_checkpoint_results import MAX_BYTES +from anyfesolver.general_contact import read_native_contact_checkpoint_results +from anyfesolver.general_contact.native_checkpoint_results import MAX_BYTES def read_portable(path): diff --git a/examples/general_contact_native_curved_material_plane.py b/examples/general_contact_native_curved_material_plane.py index c151b1139..cf8f06e2d 100644 --- a/examples/general_contact_native_curved_material_plane.py +++ b/examples/general_contact_native_curved_material_plane.py @@ -2,24 +2,24 @@ One elastic B3-GE beam and one fixed plane; selected interior skin only. No caps, friction, dynamics, unselected collisions or engineering admission. -Run with an installed ANYsolver package on PYTHONPATH. +Run with an installed ANYfeSolver package on PYTHONPATH. """ import json from math import hypot,pi import numpy as np -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry -from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_retained_nodal_loading import NodalDeadForces,Program -from anysolver.boundary import BoundaryCondition -from anysolver.general_contact.native_curved_plane_work import NativeCurvedMaterialPlaneWork -from anysolver.general_contact.native_retained_static import NativeRetainedRoundPlaneAnalysis -from anysolver.general_contact.native_surface_normal import StraightNormalIntegrationSettings -from anysolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry +from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_retained_nodal_loading import NodalDeadForces,Program +from anyfesolver.boundary import BoundaryCondition +from anyfesolver.general_contact.native_curved_plane_work import NativeCurvedMaterialPlaneWork +from anyfesolver.general_contact.native_retained_static import NativeRetainedRoundPlaneAnalysis +from anyfesolver.general_contact.native_surface_normal import StraightNormalIntegrationSettings +from anyfesolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule def analysis(targets=(1.,0.,1.),*,normal_stiffness_Pa_per_m=1e7,max_iterations=24): diff --git a/examples/general_contact_native_curved_material_s3.py b/examples/general_contact_native_curved_material_s3.py index 1b74f61e8..74be51f8c 100644 --- a/examples/general_contact_native_curved_material_s3.py +++ b/examples/general_contact_native_curved_material_s3.py @@ -5,22 +5,22 @@ from pathlib import Path from math import hypot,pi import numpy as np -from anysolver import create_shell_element -from anysolver.fe_core import FEModel -from anysolver.boundary import BoundaryCondition,FixedSupport -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry -from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_retained_nodal_loading import NodalDeadForces,Program -from anysolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule -from anysolver.general_contact.native_surface_normal import StraightNormalIntegrationSettings -from anysolver.general_contact.native_material_s3 import NativeMaterialS3Patch -from anysolver.general_contact.native_curved_s3_work import NativeCurvedMaterialS3Work -from anysolver.general_contact.s3_skin_work import S3SkinWorkAdapter -from anysolver.general_contact import NativeS3ContactPair,create_native_contact_analysis +from anyfesolver import create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.boundary import BoundaryCondition,FixedSupport +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry +from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_retained_nodal_loading import NodalDeadForces,Program +from anyfesolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule +from anyfesolver.general_contact.native_surface_normal import StraightNormalIntegrationSettings +from anyfesolver.general_contact.native_material_s3 import NativeMaterialS3Patch +from anyfesolver.general_contact.native_curved_s3_work import NativeCurvedMaterialS3Work +from anyfesolver.general_contact.s3_skin_work import S3SkinWorkAdapter +from anyfesolver.general_contact import NativeS3ContactPair,create_native_contact_analysis def analysis(targets=(1.,0.,1.),*,normal_stiffness_Pa_per_m=1e7,two_facets=False,two_beams=False,physical_fibres=False,plastic_fibres=False, @@ -34,8 +34,8 @@ def analysis(targets=(1.,0.,1.),*,normal_stiffness_Pa_per_m=1e7,two_facets=False second=np.array((0.,0.,1.));frames.append(np.column_stack((tangent,second,np.cross(tangent,second)))) reference=CenteredCurvedBeam3ReferenceGeometry(np.array(points),np.array(frames)) if physical_fibres: - from anysolver._ge_beam3_fibre_section import Fibre,FlowCurve,PhysicalFibreSection - from anysolver._ge_beam3_native_fibre_static_element import NativeFibreStaticElement + from anyfesolver._ge_beam3_fibre_section import Fibre,FlowCurve,PhysicalFibreSection + from anyfesolver._ge_beam3_native_fibre_static_element import NativeFibreStaticElement curve=FlowCurve.linear(2.,1e5) if plastic_fibres else FlowCurve((0.,),(1e6,),1.) fibres=tuple(Fibre(str(i),y,z,.00025,1e6,curve) for i,(y,z) in enumerate( ((.03,0.),(-.03,0.),(0.,.03),(0.,-.03)))) diff --git a/examples/general_contact_native_material_plane.py b/examples/general_contact_native_material_plane.py index 572d078ce..67dda2aef 100644 --- a/examples/general_contact_native_material_plane.py +++ b/examples/general_contact_native_material_plane.py @@ -8,18 +8,18 @@ import numpy as np -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry -from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_retained_nodal_loading import NodalDeadForces,Program -from anysolver.boundary import BoundaryCondition -from anysolver.general_contact.native_material_plane import NativeRoundMaterialPlane -from anysolver.general_contact.native_retained_static import NativeRetainedRoundPlaneAnalysis -from anysolver.general_contact.native_surface_normal import StraightNormalIntegrationSettings -from anysolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry +from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_retained_nodal_loading import NodalDeadForces,Program +from anyfesolver.boundary import BoundaryCondition +from anyfesolver.general_contact.native_material_plane import NativeRoundMaterialPlane +from anyfesolver.general_contact.native_retained_static import NativeRetainedRoundPlaneAnalysis +from anyfesolver.general_contact.native_surface_normal import StraightNormalIntegrationSettings +from anyfesolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule def analysis(): diff --git a/examples/general_contact_native_material_s3.py b/examples/general_contact_native_material_s3.py index 077ee280a..b1b61639b 100644 --- a/examples/general_contact_native_material_s3.py +++ b/examples/general_contact_native_material_s3.py @@ -10,21 +10,21 @@ import numpy as np -from anysolver import create_shell_element -from anysolver.boundary import BoundaryCondition, FixedSupport -from anysolver.fe_core import FEModel -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry -from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_retained_nodal_loading import NodalDeadForces, Program -from anysolver.general_contact.native_material_s3 import NativeMaterialS3Patch, NativeRetainedMaterialS3Work -from anysolver.general_contact.native_retained_s3_static import NativeRetainedRoundS3Analysis -from anysolver.general_contact.native_surface_normal import StraightNormalIntegrationSettings -from anysolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule -from anysolver.general_contact.s3_skin_work import S3SkinWorkAdapter +from anyfesolver import create_shell_element +from anyfesolver.boundary import BoundaryCondition, FixedSupport +from anyfesolver.fe_core import FEModel +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry +from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_retained_nodal_loading import NodalDeadForces, Program +from anyfesolver.general_contact.native_material_s3 import NativeMaterialS3Patch, NativeRetainedMaterialS3Work +from anyfesolver.general_contact.native_retained_s3_static import NativeRetainedRoundS3Analysis +from anyfesolver.general_contact.native_surface_normal import StraightNormalIntegrationSettings +from anyfesolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule +from anyfesolver.general_contact.s3_skin_work import S3SkinWorkAdapter def analysis(*, beams=1, targets=None, facets=1): @@ -87,7 +87,7 @@ def analysis(*, beams=1, targets=None, facets=1): geometry_tolerance_m=1e-10,rim_clearance_m=1e-6) works.append(NativeRetainedMaterialS3Work(vertical_patch,vertical_skin)) if beams==2 or facets==2: - from anysolver.general_contact import NativeS3ContactPair, create_native_contact_analysis + from anyfesolver.general_contact import NativeS3ContactPair, create_native_contact_analysis pairs=tuple(NativeS3ContactPair('beam'+str(work.contact.beam_element_id-1)+ ('-skin'+str(work.shell.element_id) if facets==2 else ''),work,5e-5,128) for work in works) return create_native_contact_analysis(tuple(definitions),tuple(roots),program,shell,pairs, diff --git a/examples/general_contact_native_multi_shell_impact_dev.py b/examples/general_contact_native_multi_shell_impact_dev.py index 80b604997..5fe8d04a6 100644 --- a/examples/general_contact_native_multi_shell_impact_dev.py +++ b/examples/general_contact_native_multi_shell_impact_dev.py @@ -3,14 +3,14 @@ from hashlib import sha256 import json import numpy as np -from anysolver import create_shell_element, TransientConfig -from anysolver.fe_core import FEModel -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry -from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection -from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver.general_contact.native_transient_multi_shell import SELECTOR -from anysolver.general_contact import (NativeContactBody,S3ContactBody, +from anyfesolver import create_shell_element, TransientConfig +from anyfesolver.fe_core import FEModel +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry +from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection +from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver.general_contact.native_transient_multi_shell import SELECTOR +from anyfesolver.general_contact import (NativeContactBody,S3ContactBody, NativeTransientS3ContactPair,create_native_transient_multi_shell_analysis,solve_native_transient_multi_shell) diff --git a/examples/general_contact_native_multiple_s3_static.py b/examples/general_contact_native_multiple_s3_static.py index c0a11eef6..5171ec902 100644 --- a/examples/general_contact_native_multiple_s3_static.py +++ b/examples/general_contact_native_multiple_s3_static.py @@ -4,21 +4,21 @@ """ import json import numpy as np -from anysolver import create_shell_element -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry -from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_retained_nodal_loading import NodalDeadForces, Program -from anysolver.boundary import BoundaryCondition, FixedSupport -from anysolver.fe_core import FEModel -from anysolver.general_contact import NativeS3ContactPair, create_native_contact_analysis -from anysolver.general_contact.native_retained_line_s3 import NativeRetainedRoundLineS3Interior -from anysolver.general_contact.native_retained_line_s3_work import NativeRetainedLineS3Work -from anysolver.general_contact.overlap import reference_shell_face -from anysolver.general_contact.s3_skin_work import S3SkinWorkAdapter +from anyfesolver import create_shell_element +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry +from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_retained_nodal_loading import NodalDeadForces, Program +from anyfesolver.boundary import BoundaryCondition, FixedSupport +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact import NativeS3ContactPair, create_native_contact_analysis +from anyfesolver.general_contact.native_retained_line_s3 import NativeRetainedRoundLineS3Interior +from anyfesolver.general_contact.native_retained_line_s3_work import NativeRetainedLineS3Work +from anyfesolver.general_contact.overlap import reference_shell_face +from anyfesolver.general_contact.s3_skin_work import S3SkinWorkAdapter def analysis(*, beams=1, iterations=24, targets=(.5, 1.), line_stiffness_n_per_m2=10000., @@ -74,7 +74,7 @@ def analysis(*, beams=1, iterations=24, targets=(.5, 1.), line_stiffness_n_per_m def tight_gap_analysis(*, beams=1): """Explicit stronger line law and activation controls; development only.""" - from anysolver.general_contact import NativeContactActivationSettings + from anyfesolver.general_contact import NativeContactActivationSettings return analysis(beams=beams, targets=(.25,.5,.75,1.), line_stiffness_n_per_m2=1.2e6, gap_tolerance_m=5e-5, activation_settings=NativeContactActivationSettings(1e-7 if beams==1 else 1e-6,64)) diff --git a/examples/general_contact_native_pair_impact_dev.py b/examples/general_contact_native_pair_impact_dev.py index 1a219dbcd..db11164b3 100644 --- a/examples/general_contact_native_pair_impact_dev.py +++ b/examples/general_contact_native_pair_impact_dev.py @@ -7,9 +7,9 @@ from hashlib import sha256 import json import numpy as np -from anysolver.dynamics import TransientConfig -from anysolver.ge_beam3_native import define_beam, SELECTOR as BEAM, EllipsoidalGeneralizedSection -from anysolver.general_contact.native_transient_pair import ( +from anyfesolver.dynamics import TransientConfig +from anyfesolver.ge_beam3_native import define_beam, SELECTOR as BEAM, EllipsoidalGeneralizedSection +from anyfesolver.general_contact.native_transient_pair import ( SELECTOR, ENDPOINT_POLICY, create_native_transient_pair_analysis, solve_native_transient_pair, ) diff --git a/examples/general_contact_native_retained_body_pair.py b/examples/general_contact_native_retained_body_pair.py index ffb25808d..eafde7931 100644 --- a/examples/general_contact_native_retained_body_pair.py +++ b/examples/general_contact_native_retained_body_pair.py @@ -1,14 +1,14 @@ """Development example: two connected two-element physical-fibre bodies.""" import numpy as np -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference -from anysolver._ge_beam3_fibre_section import Fibre, FlowCurve, PhysicalFibreSection -from anysolver._ge_beam3_native_fibre_static_element import NativeFibreStaticElement -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_retained_nodal_loading import NodalDeadForces, Program -from anysolver.boundary import BoundaryCondition -from anysolver.general_contact.native_retained_body_static import NativeRetainedBodyPairAnalysis +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference +from anyfesolver._ge_beam3_fibre_section import Fibre, FlowCurve, PhysicalFibreSection +from anyfesolver._ge_beam3_native_fibre_static_element import NativeFibreStaticElement +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_retained_nodal_loading import NodalDeadForces, Program +from anyfesolver.boundary import BoundaryCondition +from anyfesolver.general_contact.native_retained_body_static import NativeRetainedBodyPairAnalysis def analysis(*,elements_per_body=2,separation=.100001,force=-.001,targets=(.05,),max_coordinates=256,reference_rise_m=0.): diff --git a/examples/general_contact_native_retained_pair.py b/examples/general_contact_native_retained_pair.py index f3cb99087..b9d7fa7e8 100644 --- a/examples/general_contact_native_retained_pair.py +++ b/examples/general_contact_native_retained_pair.py @@ -10,24 +10,24 @@ import numpy as np -from anysolver._ge_beam3_centered_reference import ( +from anyfesolver._ge_beam3_centered_reference import ( CenteredCurvedBeam3ReferenceGeometry, ) -from anysolver._ge_beam3_generalized_ellipsoid_section import ( +from anyfesolver._ge_beam3_generalized_ellipsoid_section import ( EllipsoidalGeneralizedSection, ) -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_native_generalized_element import ( +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_native_generalized_element import ( NativeGeneralizedStaticElement, ) -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_retained_nodal_loading import NodalDeadForces, Program -from anysolver.boundary import BoundaryCondition -from anysolver.general_contact.native_retained_cell_pair import ( +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_retained_nodal_loading import NodalDeadForces, Program +from anyfesolver.boundary import BoundaryCondition +from anyfesolver.general_contact.native_retained_cell_pair import ( NativeRetainedSelectedCellPair, ) -from anysolver.general_contact.native_retained_pair_static import ( +from anyfesolver.general_contact.native_retained_pair_static import ( NativeRetainedRoundPairAnalysis, ) diff --git a/examples/general_contact_native_retained_plane.py b/examples/general_contact_native_retained_plane.py index fcbc0ce88..7ffd5a847 100644 --- a/examples/general_contact_native_retained_plane.py +++ b/examples/general_contact_native_retained_plane.py @@ -1,6 +1,6 @@ """Internal C3 development example: curved native beam against a fixed plane. -Run from an ANYsolver source checkout with ``python -m pip install -e .`` or +Run from an ANYfeSolver source checkout with ``python -m pip install -e .`` or with a built wheel installed. This example is not a public C3 admission. """ @@ -10,24 +10,24 @@ import numpy as np -from anysolver._ge_beam3_centered_reference import ( +from anyfesolver._ge_beam3_centered_reference import ( CenteredCurvedBeam3ReferenceGeometry, ) -from anysolver._ge_beam3_generalized_ellipsoid_section import ( +from anyfesolver._ge_beam3_generalized_ellipsoid_section import ( EllipsoidalGeneralizedSection, ) -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_native_generalized_element import ( +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_native_generalized_element import ( NativeGeneralizedStaticElement, ) -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_retained_nodal_loading import NodalDeadForces, Program -from anysolver.boundary import BoundaryCondition -from anysolver.general_contact.native_retained_line_plane import ( +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_retained_nodal_loading import NodalDeadForces, Program +from anyfesolver.boundary import BoundaryCondition +from anyfesolver.general_contact.native_retained_line_plane import ( NativeRetainedRoundLinePlane, ) -from anysolver.general_contact.native_retained_static import ( +from anyfesolver.general_contact.native_retained_static import ( NativeRetainedRoundPlaneAnalysis, ) diff --git a/examples/general_contact_native_retained_whole_pair.py b/examples/general_contact_native_retained_whole_pair.py index da5c7e626..1c16ae32d 100644 --- a/examples/general_contact_native_retained_whole_pair.py +++ b/examples/general_contact_native_retained_whole_pair.py @@ -12,24 +12,24 @@ import numpy as np -from anysolver._ge_beam3_centered_reference import ( +from anyfesolver._ge_beam3_centered_reference import ( CenteredCurvedBeam3ReferenceGeometry, ) -from anysolver._ge_beam3_generalized_ellipsoid_section import ( +from anyfesolver._ge_beam3_generalized_ellipsoid_section import ( EllipsoidalGeneralizedSection, ) -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_native_generalized_element import ( +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_native_generalized_element import ( NativeGeneralizedStaticElement, ) -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_retained_nodal_loading import NodalDeadForces, Program -from anysolver.boundary import BoundaryCondition -from anysolver.general_contact.native_retained_pair_static import ( +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_retained_nodal_loading import NodalDeadForces, Program +from anyfesolver.boundary import BoundaryCondition +from anyfesolver.general_contact.native_retained_pair_static import ( NativeRetainedRoundPairAnalysis, ) -from anysolver.general_contact.native_retained_whole_pair import ( +from anyfesolver.general_contact.native_retained_whole_pair import ( NativeRetainedWholeCurvePair, ) @@ -65,8 +65,8 @@ def reference(y: float) -> CenteredCurvedBeam3ReferenceGeometry: a, b = reference(0.0), reference(separation) if physical_fibres: - from anysolver._ge_beam3_fibre_section import Fibre,FlowCurve,PhysicalFibreSection - from anysolver._ge_beam3_native_fibre_static_element import NativeFibreStaticElement + from anyfesolver._ge_beam3_fibre_section import Fibre,FlowCurve,PhysicalFibreSection + from anyfesolver._ge_beam3_native_fibre_static_element import NativeFibreStaticElement curve=FlowCurve.linear(2.,1e5) if plastic_fibres else FlowCurve((0.,),(1e6,),1.) fibres=tuple(Fibre(str(i),y,z,.00025,1e6,curve) for i,(y,z) in enumerate( ((.03,0.),(-.03,0.),(0.,.03),(0.,-.03)))) diff --git a/examples/general_contact_native_s3_static.py b/examples/general_contact_native_s3_static.py index 935c40fd8..0477c6080 100644 --- a/examples/general_contact_native_s3_static.py +++ b/examples/general_contact_native_s3_static.py @@ -1,6 +1,6 @@ """Internal C3 development example: retained native beam on elastic S3 skin. -Run with ANYsolver installed or from an editable checkout. This restricted +Run with ANYfeSolver installed or from an editable checkout. This restricted analysis is not a public native beam–shell capability admission. """ @@ -10,33 +10,33 @@ import numpy as np -from anysolver import create_shell_element -from anysolver._ge_beam3_centered_reference import ( +from anyfesolver import create_shell_element +from anyfesolver._ge_beam3_centered_reference import ( CenteredCurvedBeam3ReferenceGeometry, ) -from anysolver._ge_beam3_generalized_ellipsoid_section import ( +from anyfesolver._ge_beam3_generalized_ellipsoid_section import ( EllipsoidalGeneralizedSection, ) -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_native_generalized_element import ( +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_native_generalized_element import ( NativeGeneralizedStaticElement, ) -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_retained_nodal_loading import NodalDeadForces, Program -from anysolver.boundary import BoundaryCondition, FixedSupport -from anysolver.fe_core import FEModel -from anysolver.general_contact.native_retained_line_s3 import ( +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_retained_nodal_loading import NodalDeadForces, Program +from anyfesolver.boundary import BoundaryCondition, FixedSupport +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.native_retained_line_s3 import ( NativeRetainedRoundLineS3Interior, ) -from anysolver.general_contact.native_retained_line_s3_work import ( +from anyfesolver.general_contact.native_retained_line_s3_work import ( NativeRetainedLineS3Work, ) -from anysolver.general_contact.native_retained_s3_static import ( +from anyfesolver.general_contact.native_retained_s3_static import ( NativeRetainedRoundS3Analysis, ) -from anysolver.general_contact.overlap import reference_shell_face -from anysolver.general_contact.s3_skin_work import S3SkinWorkAdapter +from anyfesolver.general_contact.overlap import reference_shell_face +from anyfesolver.general_contact.s3_skin_work import S3SkinWorkAdapter def analysis() -> NativeRetainedRoundS3Analysis: diff --git a/examples/general_contact_native_shell_impact_dev.py b/examples/general_contact_native_shell_impact_dev.py index e200e0e82..ce674bcf6 100644 --- a/examples/general_contact_native_shell_impact_dev.py +++ b/examples/general_contact_native_shell_impact_dev.py @@ -7,14 +7,14 @@ from hashlib import sha256 import json import numpy as np -from anysolver import (create_shell_element, TransientConfig, +from anyfesolver import (create_shell_element, TransientConfig, create_native_transient_shell_analysis, solve_native_transient_shell) -from anysolver.fe_core import FEModel -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry -from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection -from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver.general_contact.native_transient_shell import SELECTOR +from anyfesolver.fe_core import FEModel +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry +from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection +from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver.general_contact.native_transient_shell import SELECTOR def build(*,maximum_penetration_m=.003,maximum_swept_intervals=128,separation=.0505, diff --git a/examples/general_contact_nonuniform_s3_impact_dev.py b/examples/general_contact_nonuniform_s3_impact_dev.py index 7d2b0a6c0..bca9be5ae 100644 --- a/examples/general_contact_nonuniform_s3_impact_dev.py +++ b/examples/general_contact_nonuniform_s3_impact_dev.py @@ -8,7 +8,7 @@ import json from pathlib import Path import numpy as np -from anysolver import (BoundaryCondition, ContactDefinition, ContactInteraction, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactInteraction, ContactSurface, ContactSolverSettings, ContactTransientSolverControls, FEModel, TransientConfig, create_shell_element, solve_transient_contact) diff --git a/examples/general_contact_ordinary_displacement_dev.py b/examples/general_contact_ordinary_displacement_dev.py index 3c65e7d4c..3c1362c74 100644 --- a/examples/general_contact_ordinary_displacement_dev.py +++ b/examples/general_contact_ordinary_displacement_dev.py @@ -9,8 +9,8 @@ import json -import anysolver -from anysolver import ( +import anyfesolver +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, @@ -20,8 +20,8 @@ solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel -from anysolver.nonlinear_static import DisplacementControl +from anyfesolver.fe_core import FEModel +from anyfesolver.nonlinear_static import DisplacementControl def build_model(): @@ -128,7 +128,7 @@ def main() -> None: "contact_free_elastic_force_predictor_n": float( result.info["contact_free_elastic_force_predictor_n"]), "has_restart_checkpoint": result.restart_checkpoint is not None, - "anysolver_module": str(anysolver.__file__), + "anyfesolver_module": str(anyfesolver.__file__), }, indent=2)) diff --git a/examples/general_contact_partial_shell_cycle.py b/examples/general_contact_partial_shell_cycle.py index df6d70244..86b11ee24 100644 --- a/examples/general_contact_partial_shell_cycle.py +++ b/examples/general_contact_partial_shell_cycle.py @@ -9,12 +9,12 @@ from pathlib import Path import numpy as np -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathProgram, ContactSolverSettings, ContactSurface, FEModel, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.nonlinear_restart import ( +from anyfesolver.nonlinear_restart import ( canonical_checkpoint_json_bytes, load_nonlinear_checkpoint, ) diff --git a/examples/general_contact_patch_sliding.py b/examples/general_contact_patch_sliding.py index 134bc7f3a..bd489b9f7 100644 --- a/examples/general_contact_patch_sliding.py +++ b/examples/general_contact_patch_sliding.py @@ -8,12 +8,12 @@ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, DisplacementControl, LoadCase, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_planar_plate.py b/examples/general_contact_planar_plate.py index 531bffa47..829983276 100644 --- a/examples/general_contact_planar_plate.py +++ b/examples/general_contact_planar_plate.py @@ -12,7 +12,7 @@ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, @@ -22,7 +22,7 @@ create_shell_element, solve_static_nonlinear, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_q4_oblique_plastic_impact_dev.py b/examples/general_contact_q4_oblique_plastic_impact_dev.py index 41d2a0413..eb2a8f451 100644 --- a/examples/general_contact_q4_oblique_plastic_impact_dev.py +++ b/examples/general_contact_q4_oblique_plastic_impact_dev.py @@ -11,10 +11,10 @@ import numpy as np -from anysolver import (BoundaryCondition,ContactDefinition,ContactInteraction, +from anyfesolver import (BoundaryCondition,ContactDefinition,ContactInteraction, ContactSurface,DNVC208MaterialCurve,FEModel,RigidContactBody,create_shell_element) -from anysolver.dynamics import TransientConfig -from anysolver.general_contact.transient import ContactTransientSolverControls,solve_transient_contact +from anyfesolver.dynamics import TransientConfig +from anyfesolver.general_contact.transient import ContactTransientSolverControls,solve_transient_contact E,NU,H,RHO=1.e9,.3,.05,1.e4 YIELD,KN,GAP,ANGLE=.2,4.e11,.0008,2.e-5 @@ -81,7 +81,7 @@ def run(*,dt=3.e-5,end=.003): imports={} for name,module in tuple(sys.modules.items()): value=getattr(module,'__file__',None) - if (name=='anysolver' or name.startswith('anysolver.')) and value: + if (name=='anyfesolver' or name.startswith('anyfesolver.')) and value: path=Path(value).resolve() imports[name]=dict(path=str(path),sha256=hashlib.sha256(path.read_bytes()).hexdigest()) return dict(status='manufactured development; not engineering acceptance', diff --git a/examples/general_contact_q4_pair_bending.py b/examples/general_contact_q4_pair_bending.py index 6fb548c72..ed097d237 100644 --- a/examples/general_contact_q4_pair_bending.py +++ b/examples/general_contact_q4_pair_bending.py @@ -1,13 +1,13 @@ """Force-loaded two-body Q4 bending with admitted linearized director skins.""" from dataclasses import replace -from anysolver import BoundaryCondition,LoadCase,NonlinearConvergenceSettings,solve_static_nonlinear -from anysolver.general_contact import resolve_automatic_contact_domain +from anyfesolver import BoundaryCondition,LoadCase,NonlinearConvergenceSettings,solve_static_nonlinear +from anyfesolver.general_contact import resolve_automatic_contact_domain from examples.general_contact_automatic_q4_pair import build as guided_build def build(): # Reuse declarations/settings only; rebuild geometry/supports in a newmodel. - from anysolver import FEModel,create_shell_element + from anyfesolver import FEModel,create_shell_element _,domain,oldsettings,_,_=guided_build(sliding=False,path_predictor='none') model=FEModel('q4-pair-free-bending-force');model.add_material('elastic',1e5,.3,density=1.) source=tuple((x,y,.04) for y in (.1,1.1) for x in (.1,.6,1.1)) diff --git a/examples/general_contact_q4_pair_monolithic.py b/examples/general_contact_q4_pair_monolithic.py index 0538b9d02..a419df26d 100644 --- a/examples/general_contact_q4_pair_monolithic.py +++ b/examples/general_contact_q4_pair_monolithic.py @@ -1,7 +1,7 @@ """Opt-in fine-Q1 Q4/Q4 supported-force bending through ordinary force control.""" from dataclasses import replace -from anysolver import solve_static_nonlinear -from anysolver.general_contact.automatic_domain import resolve_automatic_contact_domain +from anyfesolver import solve_static_nonlinear +from anyfesolver.general_contact.automatic_domain import resolve_automatic_contact_domain from examples.general_contact_q4_pair_bending import build as bending_build diff --git a/examples/general_contact_q4_pair_monolithic_cycle.py b/examples/general_contact_q4_pair_monolithic_cycle.py index 351d03cb4..65abea72f 100644 --- a/examples/general_contact_q4_pair_monolithic_cycle.py +++ b/examples/general_contact_q4_pair_monolithic_cycle.py @@ -1,8 +1,8 @@ """New positive-clearance Q4/Q4 force cycle, with free two-body bending.""" from dataclasses import replace -from anysolver import FEModel,create_shell_element,BoundaryCondition,solve_static_nonlinear -from anysolver.general_contact import resolve_automatic_contact_domain -from anysolver.general_contact.static_path import ContactPathProgram,ContactPathNodalForce +from anyfesolver import FEModel,create_shell_element,BoundaryCondition,solve_static_nonlinear +from anyfesolver.general_contact import resolve_automatic_contact_domain +from anyfesolver.general_contact.static_path import ContactPathProgram,ContactPathNodalForce from examples.general_contact_automatic_q4_pair import build as declarations diff --git a/examples/general_contact_q4_physical_orientation.py b/examples/general_contact_q4_physical_orientation.py index 58d795adc..ff11ccc07 100644 --- a/examples/general_contact_q4_physical_orientation.py +++ b/examples/general_contact_q4_physical_orientation.py @@ -1,8 +1,8 @@ """Physical-side Q4/Q4 director declarations with free two-body bending.""" from dataclasses import replace -from anysolver import FEModel,create_shell_element,BoundaryCondition,solve_static_nonlinear -from anysolver.general_contact import resolve_automatic_contact_domain -from anysolver.general_contact.static_path import ContactPathProgram,ContactPathNodalForce +from anyfesolver import FEModel,create_shell_element,BoundaryCondition,solve_static_nonlinear +from anyfesolver.general_contact import resolve_automatic_contact_domain +from anyfesolver.general_contact.static_path import ContactPathProgram,ContactPathNodalForce from examples.general_contact_automatic_q4_pair import build as declarations diff --git a/examples/general_contact_q4_plane_impact.py b/examples/general_contact_q4_plane_impact.py index b70bd79fd..908fca2ce 100644 --- a/examples/general_contact_q4_plane_impact.py +++ b/examples/general_contact_q4_plane_impact.py @@ -3,7 +3,7 @@ import argparse import numpy as np -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, @@ -15,7 +15,7 @@ create_shell_element, solve_transient_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_q4_plastic_impact_dev.py b/examples/general_contact_q4_plastic_impact_dev.py index c6fd3c71a..a41327530 100644 --- a/examples/general_contact_q4_plastic_impact_dev.py +++ b/examples/general_contact_q4_plastic_impact_dev.py @@ -13,12 +13,12 @@ import numpy as np -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSurface, DNVC208MaterialCurve, FEModel, RigidContactBody, create_shell_element, ) -from anysolver.dynamics import TransientConfig -from anysolver.general_contact.transient import ( +from anyfesolver.dynamics import TransientConfig +from anyfesolver.general_contact.transient import ( ContactTransientSolverControls, solve_transient_contact, ) @@ -69,11 +69,11 @@ def build_model(): def source_provenance(): """Record actual imported source paths and content hashes.""" - names = ('anysolver', 'anysolver.fe_core', 'anysolver.dynamics', - 'anysolver.general_contact.transient', - 'anysolver.general_contact.core', - 'anysolver.general_contact.q4_material_checkpoint', - 'anysolver.e4_pl_element', 'anysolver.plasticity', + names = ('anyfesolver', 'anyfesolver.fe_core', 'anyfesolver.dynamics', + 'anyfesolver.general_contact.transient', + 'anyfesolver.general_contact.core', + 'anyfesolver.general_contact.q4_material_checkpoint', + 'anyfesolver.e4_pl_element', 'anyfesolver.plasticity', DNVC208MaterialCurve.__module__) sources = {} for name in dict.fromkeys(names): diff --git a/examples/general_contact_q4_q4_augmented_path.py b/examples/general_contact_q4_q4_augmented_path.py index 32070f476..dfc573bdb 100644 --- a/examples/general_contact_q4_q4_augmented_path.py +++ b/examples/general_contact_q4_q4_augmented_path.py @@ -4,13 +4,13 @@ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathProgram, ContactSolverSettings, ContactSurface, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_q4_q4_path.py b/examples/general_contact_q4_q4_path.py index b6ea2d318..a95a183ca 100644 --- a/examples/general_contact_q4_q4_path.py +++ b/examples/general_contact_q4_q4_path.py @@ -4,13 +4,13 @@ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathProgram, ContactSolverSettings, ContactSurface, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_q4_q4_projected_gap.py b/examples/general_contact_q4_q4_projected_gap.py index 9f64f021b..883ae4c58 100644 --- a/examples/general_contact_q4_q4_projected_gap.py +++ b/examples/general_contact_q4_q4_projected_gap.py @@ -5,13 +5,13 @@ import argparse import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathProgram, ContactSolverSettings, ContactSurface, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_q4_s3_augmented_path.py b/examples/general_contact_q4_s3_augmented_path.py index ffbb886b6..d2df2704b 100644 --- a/examples/general_contact_q4_s3_augmented_path.py +++ b/examples/general_contact_q4_s3_augmented_path.py @@ -5,13 +5,13 @@ import argparse import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathProgram, ContactSolverSettings, ContactSurface, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_q4_s3_patch_path.py b/examples/general_contact_q4_s3_patch_path.py index d12f0a334..ec51e31eb 100644 --- a/examples/general_contact_q4_s3_patch_path.py +++ b/examples/general_contact_q4_s3_patch_path.py @@ -4,13 +4,13 @@ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathProgram, ContactSolverSettings, ContactSurface, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_q4_s3_tight_path.py b/examples/general_contact_q4_s3_tight_path.py index 50a5c8dfd..78f50313c 100644 --- a/examples/general_contact_q4_s3_tight_path.py +++ b/examples/general_contact_q4_s3_tight_path.py @@ -9,13 +9,13 @@ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathProgram, ContactSolverSettings, ContactSurface, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel THICKNESS_M = 0.05 diff --git a/examples/general_contact_refined_q4_s3_eight_q4_press.py b/examples/general_contact_refined_q4_s3_eight_q4_press.py index 5dce8c855..739e225cf 100644 --- a/examples/general_contact_refined_q4_s3_eight_q4_press.py +++ b/examples/general_contact_refined_q4_s3_eight_q4_press.py @@ -11,13 +11,13 @@ from pathlib import Path import time -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathNodalForce, ContactPathProgram, ContactSolverSettings, ContactSurface, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel count = 8 diff --git a/examples/general_contact_refined_q4_s3_force.py b/examples/general_contact_refined_q4_s3_force.py index 5d083fb87..b2728dc90 100644 --- a/examples/general_contact_refined_q4_s3_force.py +++ b/examples/general_contact_refined_q4_s3_force.py @@ -4,13 +4,13 @@ import numpy as np -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, LoadCase, NonlinearConvergenceSettings, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel GAP_BUDGET_M = 5.0e-5 diff --git a/examples/general_contact_refined_q4_s3_mixed_path.py b/examples/general_contact_refined_q4_s3_mixed_path.py index d1b6ccd7e..a0e4384aa 100644 --- a/examples/general_contact_refined_q4_s3_mixed_path.py +++ b/examples/general_contact_refined_q4_s3_mixed_path.py @@ -11,13 +11,13 @@ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathNodalForce, ContactPathProgram, ContactSolverSettings, ContactSurface, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel THICKNESS_M = 0.05 diff --git a/examples/general_contact_refined_q4_s3_path.py b/examples/general_contact_refined_q4_s3_path.py index 5b35ae0ea..5e7e4b3ce 100644 --- a/examples/general_contact_refined_q4_s3_path.py +++ b/examples/general_contact_refined_q4_s3_path.py @@ -2,12 +2,12 @@ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathProgram, ContactSolverSettings, ContactSurface, create_shell_element, solve_static_nonlinear, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel model = FEModel("refined_q4_s3_contact_example") diff --git a/examples/general_contact_refined_q4_s3_tight_path.py b/examples/general_contact_refined_q4_s3_tight_path.py index 62d2c3d19..2be51891f 100644 --- a/examples/general_contact_refined_q4_s3_tight_path.py +++ b/examples/general_contact_refined_q4_s3_tight_path.py @@ -9,13 +9,13 @@ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathProgram, ContactSolverSettings, ContactSurface, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel THICKNESS_M = 0.05 diff --git a/examples/general_contact_refined_s3_patch.py b/examples/general_contact_refined_s3_patch.py index 93115549f..7829039f7 100644 --- a/examples/general_contact_refined_s3_patch.py +++ b/examples/general_contact_refined_s3_patch.py @@ -4,13 +4,13 @@ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathProgram, ContactSolverSettings, ContactSurface, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_restricted_sliding.py b/examples/general_contact_restricted_sliding.py index c2eeaeda6..e0524ed14 100644 --- a/examples/general_contact_restricted_sliding.py +++ b/examples/general_contact_restricted_sliding.py @@ -11,12 +11,12 @@ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, DisplacementControl, LoadCase, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_round_b2_b3_pair.py b/examples/general_contact_round_b2_b3_pair.py index 8dc9c6616..627ce73d1 100644 --- a/examples/general_contact_round_b2_b3_pair.py +++ b/examples/general_contact_round_b2_b3_pair.py @@ -2,13 +2,13 @@ import argparse -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, DisplacementControl, LoadCase, solve_static_nonlinear, ) -from anysolver.elements import BeamElement, QuadraticBeamElement -from anysolver.fe_core import FEModel +from anyfesolver.elements import BeamElement, QuadraticBeamElement +from anyfesolver.fe_core import FEModel parser = argparse.ArgumentParser(description=__doc__) diff --git a/examples/general_contact_round_b3_pair.py b/examples/general_contact_round_b3_pair.py index 5c8182beb..6f8972475 100644 --- a/examples/general_contact_round_b3_pair.py +++ b/examples/general_contact_round_b3_pair.py @@ -1,12 +1,12 @@ """Opt-in distributed static contact between two classical round B3 beams.""" -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, DisplacementControl, LoadCase, solve_static_nonlinear, ) -from anysolver.elements import QuadraticBeamElement -from anysolver.fe_core import FEModel +from anyfesolver.elements import QuadraticBeamElement +from anyfesolver.fe_core import FEModel model = FEModel("round_b3_pair_example") diff --git a/examples/general_contact_round_beam_capped_cylinder.py b/examples/general_contact_round_beam_capped_cylinder.py index ce473dd3b..5e01043b9 100644 --- a/examples/general_contact_round_beam_capped_cylinder.py +++ b/examples/general_contact_round_beam_capped_cylinder.py @@ -1,9 +1,9 @@ """Explicit exterior round B3/capped-cylinder static development example.""" -from anysolver import (BoundaryCondition, ContactDefinition, ContactInteraction, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, RigidCappedCylinder, LoadCase, solve_static_nonlinear) -from anysolver.fe_core import FEModel -from anysolver.elements import QuadraticBeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.elements import QuadraticBeamElement def run(): diff --git a/examples/general_contact_round_beam_chain_pair.py b/examples/general_contact_round_beam_chain_pair.py index 114d29139..7c19ab0b2 100644 --- a/examples/general_contact_round_beam_chain_pair.py +++ b/examples/general_contact_round_beam_chain_pair.py @@ -1,17 +1,17 @@ """Two connected B2 chains in distributed round-centreline contact. -Run after installing ANYsolver: python examples/general_contact_round_beam_chain_pair.py +Run after installing ANYfeSolver: python examples/general_contact_round_beam_chain_pair.py Use --consistent for the opt-in development tangent with moving-owner terms. SI units are used throughout. This is a development example, not qualification. """ -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, DisplacementControl, LoadCase, solve_static_nonlinear, validate_general_contact, ) -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel def main(*, beam_chain_tangent: str = "finite_difference") -> None: diff --git a/examples/general_contact_round_beam_moving_cylinder.py b/examples/general_contact_round_beam_moving_cylinder.py index 3a4e77d65..bd9560a69 100644 --- a/examples/general_contact_round_beam_moving_cylinder.py +++ b/examples/general_contact_round_beam_moving_cylinder.py @@ -1,17 +1,17 @@ """A prescribed infinite cylinder presses a declared round B2 centreline. -Run after installing ANYsolver: +Run after installing ANYfeSolver: python examples/general_contact_round_beam_moving_cylinder.py All values use SI units. This is a development example, not qualification. """ -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, LoadCase, RigidContactBody, solve_static_nonlinear, validate_general_contact, ) -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_round_beam_pair.py b/examples/general_contact_round_beam_pair.py index f0500ccb5..8356a8154 100644 --- a/examples/general_contact_round_beam_pair.py +++ b/examples/general_contact_round_beam_pair.py @@ -1,18 +1,18 @@ """Two declared round B2 beams meet under prescribed displacement. -Run with ANYsolver installed: python examples/general_contact_round_beam_pair.py +Run with ANYfeSolver installed: python examples/general_contact_round_beam_pair.py This is a distributed line-contact development example, not C2 acceptance. """ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, DisplacementControl, LoadCase, solve_static_nonlinear, validate_general_contact, ) -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_round_beam_plane.py b/examples/general_contact_round_beam_plane.py index 384f94d4a..82be5d0a6 100644 --- a/examples/general_contact_round_beam_plane.py +++ b/examples/general_contact_round_beam_plane.py @@ -1,18 +1,18 @@ """A declared round B3 centreline contacts a fixed rigid plane. -Run with ANYsolver installed: python examples/general_contact_round_beam_plane.py +Run with ANYfeSolver installed: python examples/general_contact_round_beam_plane.py This demonstrates the classical line-penalty development profile, not C2 acceptance. """ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, DisplacementControl, LoadCase, RigidContactBody, solve_static_nonlinear, validate_general_contact, ) -from anysolver.elements import QuadraticBeamElement -from anysolver.fe_core import FEModel +from anyfesolver.elements import QuadraticBeamElement +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_round_beam_shell.py b/examples/general_contact_round_beam_shell.py index 139009137..e1011e722 100644 --- a/examples/general_contact_round_beam_shell.py +++ b/examples/general_contact_round_beam_shell.py @@ -1,19 +1,19 @@ """One round B2 centreline contacting a physical S3 or planar Q4 shell skin. Run with ``python examples/general_contact_round_beam_shell.py`` after installing -ANYsolver and its normal dependencies. Pass ``--q4`` for the planar Q4 route. +ANYfeSolver and its normal dependencies. Pass ``--q4`` for the planar Q4 route. Lengths are metres and forces newtons. """ import argparse -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, LoadCase, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel def main(*, line_stiffness: float = 1.0e4, diff --git a/examples/general_contact_round_beam_shell_patch.py b/examples/general_contact_round_beam_shell_patch.py index 251e182cd..ccb4a7237 100644 --- a/examples/general_contact_round_beam_shell_patch.py +++ b/examples/general_contact_round_beam_shell_patch.py @@ -1,19 +1,19 @@ """B2 or B3 round beam pressing across an internal planar Q4 seam. -Run after installing ANYsolver: python examples/general_contact_round_beam_shell_patch.py +Run after installing ANYfeSolver: python examples/general_contact_round_beam_shell_patch.py Pass --b3 for the quadratic beam route. All dimensions use SI units. This is a development example, not qualification. """ import argparse -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, LoadCase, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.elements import BeamElement, QuadraticBeamElement -from anysolver.fe_core import FEModel +from anyfesolver.elements import BeamElement, QuadraticBeamElement +from anyfesolver.fe_core import FEModel def main(*, b3: bool = False) -> None: diff --git a/examples/general_contact_round_beam_sphere.py b/examples/general_contact_round_beam_sphere.py index cbaa2bcc0..17ceae87b 100644 --- a/examples/general_contact_round_beam_sphere.py +++ b/examples/general_contact_round_beam_sphere.py @@ -1,18 +1,18 @@ """Fixed sphere against a declared round classical B3 centreline. -Run with ANYsolver installed: python examples/general_contact_round_beam_sphere.py +Run with ANYfeSolver installed: python examples/general_contact_round_beam_sphere.py This is a static development example, not C2 engineering acceptance. """ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, DisplacementControl, LoadCase, RigidContactBody, solve_static_nonlinear, validate_general_contact, ) -from anysolver.elements import QuadraticBeamElement -from anysolver.fe_core import FEModel +from anyfesolver.elements import QuadraticBeamElement +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_s3_friction_physical_path.py b/examples/general_contact_s3_friction_physical_path.py index 7e068f489..11a29fe1d 100644 --- a/examples/general_contact_s3_friction_physical_path.py +++ b/examples/general_contact_s3_friction_physical_path.py @@ -10,8 +10,8 @@ import tempfile from pathlib import Path -from anysolver import BoundaryCondition, FEModel, create_shell_element, solve_static_nonlinear -from anysolver.general_contact import (ContactDefinition, ContactInteraction, +from anyfesolver import BoundaryCondition, FEModel, create_shell_element, solve_static_nonlinear +from anyfesolver.general_contact import (ContactDefinition, ContactInteraction, ContactSurface, ContactSolverSettings, ContactPathControl, ContactPathProgram, S3SlidingFrictionSettings) diff --git a/examples/general_contact_s3_friction_static.py b/examples/general_contact_s3_friction_static.py index f0f055a81..a85880024 100644 --- a/examples/general_contact_s3_friction_static.py +++ b/examples/general_contact_s3_friction_static.py @@ -1,21 +1,21 @@ """Development-only S3 mortar pressure/Coulomb press, slide, reverse and open. -Run with an installed ANYsolver package. Fixed reference material quadrature, +Run with an installed ANYfeSolver package. Fixed reference material quadrature, elastic shells and explicit regularization; this is not C5 qualification. """ import json import numpy as np -from anysolver import BoundaryCondition, create_shell_element, solve_static_nonlinear -from anysolver.fe_core import FEModel -from anysolver.general_contact import ( +from anyfesolver import BoundaryCondition, create_shell_element, solve_static_nonlinear +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact import ( ContactDefinition, ContactInteraction, ContactSurface, ContactSolverSettings, ContactPathControl, ContactPathProgram, ) -from anysolver.general_contact.s3_friction_point import S3SkinMaterialPoint -from anysolver.general_contact.s3_friction_pair import S3FrictionPointPair -from anysolver.general_contact.s3_friction_static import S3MaterialFrictionSettings +from anyfesolver.general_contact.s3_friction_point import S3SkinMaterialPoint +from anyfesolver.general_contact.s3_friction_pair import S3FrictionPointPair +from anyfesolver.general_contact.s3_friction_static import S3MaterialFrictionSettings def run_example(*, material_anchor=False): @@ -54,7 +54,7 @@ def run_example(*, material_anchor=False): friction = S3MaterialFrictionSettings(tuple(quadrature), (2e-7,)*model.mesh.dof_manager.total_dofs,maximum_candidate_evaluations=100) if material_anchor: - from anysolver.general_contact.s3_sliding_friction import S3SlidingFrictionSettings + from anyfesolver.general_contact.s3_sliding_friction import S3SlidingFrictionSettings friction = S3SlidingFrictionSettings(.3,1000., (2e-7,)*model.mesh.dof_manager.total_dofs,maximum_candidate_evaluations=100, source_quadrature_refinement=3,activation_history="linear_constant_normal_touch_dev") diff --git a/examples/general_contact_s3_mesh_history_events.py b/examples/general_contact_s3_mesh_history_events.py index 5a9fe6225..13515be9e 100644 --- a/examples/general_contact_s3_mesh_history_events.py +++ b/examples/general_contact_s3_mesh_history_events.py @@ -4,8 +4,8 @@ from pathlib import Path import numpy as np from examples.general_contact_s3_mesh_moving_friction import build_case as original -from anysolver import BoundaryCondition,solve_static_nonlinear -from anysolver.general_contact import S3MeshHistoryPathFrictionSettings,ContactPathControl,ContactPathNodalForce,ContactPathProgram +from anyfesolver import BoundaryCondition,solve_static_nonlinear +from anyfesolver.general_contact import S3MeshHistoryPathFrictionSettings,ContactPathControl,ContactPathNodalForce,ContactPathProgram A=2.**-14;D=2.**-3 @@ -18,7 +18,7 @@ def build_case(ratio=2,workflow="pressure_event"): if workflow != "pressure_event":raise ValueError("unknown material history workflow") m,definition,s,_f,_p,_r=original() m.add_boundary_condition(BoundaryCondition('declared-target-slope-anchor',(7,10),{'uz':0.})) - from anysolver.matrix_assembly import assemble_stiffness_matrix + from anyfesolver.matrix_assembly import assemble_stiffness_matrix K=assemble_stiffness_matrix(m)[0].toarray() # Literal BC/path selector plus existing MPC reduction, reused qualified K. # Independently build the exact fixture selector/MPC nullspace. @@ -76,7 +76,7 @@ def main(): a=p.parse_args() if a.diagnose_material_work: if a.restart or a.through_step is not None or a.ratio is not None or a.workflow is not None:raise ValueError('saved work diagnosis cannot request solver controls or continuation') - from anysolver.general_contact.material_work_diagnostics import diagnose_work_bundle + from anyfesolver.general_contact.material_work_diagnostics import diagnose_work_bundle a.output.write_text(json.dumps(diagnose_work_bundle(json.loads(a.diagnose_material_work.read_text())),indent=2)) return incoming=json.loads(a.restart.read_text()) if a.restart else None diff --git a/examples/general_contact_s3_mesh_moving_friction.py b/examples/general_contact_s3_mesh_moving_friction.py index eadb93d8c..b20a6d1f8 100644 --- a/examples/general_contact_s3_mesh_moving_friction.py +++ b/examples/general_contact_s3_mesh_moving_friction.py @@ -8,8 +8,8 @@ import argparse,json from pathlib import Path import numpy as np -from anysolver import FEModel,BoundaryCondition,create_shell_element,solve_static_nonlinear -from anysolver.general_contact import (ContactDefinition,ContactSurface,ContactInteraction, +from anyfesolver import FEModel,BoundaryCondition,create_shell_element,solve_static_nonlinear +from anyfesolver.general_contact import (ContactDefinition,ContactSurface,ContactInteraction, ContactSolverSettings,ContactPathControl,ContactPathProgram,ContactPathNodalForce, S3MeshMovingNormalFrictionSettings) @@ -50,7 +50,7 @@ def build_case(): friction=S3MeshMovingNormalFrictionSettings(.3,1000.,(2e-8,)*60,201, pressure_step_n=1e-8,closed_point_gap_tolerance_m=1e-10) # Manufactured code-verification load, independent of production contact. - from anysolver.matrix_assembly import assemble_stiffness_matrix + from anyfesolver.matrix_assembly import assemble_stiffness_matrix K=assemble_stiffness_matrix(model)[0] assert K.shape==(60,60) pose=np.zeros(60);opened=np.zeros(60) diff --git a/examples/general_contact_s3_mesh_swept_gap.py b/examples/general_contact_s3_mesh_swept_gap.py index 1a3f893b7..d9f65ccfe 100644 --- a/examples/general_contact_s3_mesh_swept_gap.py +++ b/examples/general_contact_s3_mesh_swept_gap.py @@ -4,7 +4,7 @@ from pathlib import Path from examples.general_contact_s3_mesh_weak_pressure_friction import build_case as _endpoint_case from examples.general_contact_s3_mesh_moving_friction import solve_case -from anysolver.general_contact import S3MeshWholeChordGapFrictionSettings +from anyfesolver.general_contact import S3MeshWholeChordGapFrictionSettings def build_case(): case=list(_endpoint_case());case[3]=S3MeshWholeChordGapFrictionSettings(**asdict(case[3])) diff --git a/examples/general_contact_s3_mesh_weak_pressure_friction.py b/examples/general_contact_s3_mesh_weak_pressure_friction.py index 0fe967a73..1203d0e83 100644 --- a/examples/general_contact_s3_mesh_weak_pressure_friction.py +++ b/examples/general_contact_s3_mesh_weak_pressure_friction.py @@ -8,7 +8,7 @@ from pathlib import Path from examples.general_contact_s3_mesh_control_lift import build_case as _original_case from examples.general_contact_s3_mesh_moving_friction import solve_case -from anysolver.general_contact import S3MeshWeakPressureFrictionSettings +from anyfesolver.general_contact import S3MeshWeakPressureFrictionSettings def build_case(): diff --git a/examples/general_contact_s3_moving_normal_friction.py b/examples/general_contact_s3_moving_normal_friction.py index bed4be5d0..5b79e24de 100644 --- a/examples/general_contact_s3_moving_normal_friction.py +++ b/examples/general_contact_s3_moving_normal_friction.py @@ -7,8 +7,8 @@ import argparse,json from pathlib import Path import numpy as np -from anysolver import FEModel,BoundaryCondition,create_shell_element,solve_static_nonlinear -from anysolver.general_contact import (ContactDefinition,ContactSurface,ContactInteraction, +from anyfesolver import FEModel,BoundaryCondition,create_shell_element,solve_static_nonlinear +from anyfesolver.general_contact import (ContactDefinition,ContactSurface,ContactInteraction, ContactSolverSettings,ContactPathControl,ContactPathProgram,ContactPathNodalForce, S3MovingNormalFrictionSettings) @@ -48,7 +48,7 @@ def build_case(): friction=S3MovingNormalFrictionSettings(.3,1000.,(2e-8,)*48,145, pressure_step_n=1e-8,closed_point_gap_tolerance_m=1e-10) # Manufactured code-verification load, independent of production contact. - from anysolver.matrix_assembly import assemble_stiffness_matrix + from anyfesolver.matrix_assembly import assemble_stiffness_matrix K=assemble_stiffness_matrix(model)[0] assert K.shape==(48,48) pose=np.zeros(48);opened=np.zeros(48) diff --git a/examples/general_contact_s3_nodal_pair.py b/examples/general_contact_s3_nodal_pair.py index 2d10eb8a7..67c95606f 100644 --- a/examples/general_contact_s3_nodal_pair.py +++ b/examples/general_contact_s3_nodal_pair.py @@ -4,12 +4,12 @@ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, DisplacementControl, LoadCase, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def main(): diff --git a/examples/general_contact_s3_partial_friction.py b/examples/general_contact_s3_partial_friction.py index f214d9549..32e5bcd55 100644 --- a/examples/general_contact_s3_partial_friction.py +++ b/examples/general_contact_s3_partial_friction.py @@ -1,6 +1,6 @@ """Development-only partial S3 press/slide/reverse/open/recontact workflow. -Run against an installed ANYsolver package. The target has free in-plane degrees +Run against an installed ANYfeSolver package. The target has free in-plane degrees of freedom; source normal deformation is solved, not tied to the controlled node. The default five-increment run can take several minutes. This is not C5 acceptance. Use --max-load-factor 0.2 for the first press and --checkpoint-output to save it; @@ -10,14 +10,14 @@ import json from pathlib import Path -from anysolver import BoundaryCondition, create_shell_element, solve_static_nonlinear -from anysolver.fe_core import FEModel -from anysolver.general_contact import ( +from anyfesolver import BoundaryCondition, create_shell_element, solve_static_nonlinear +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact import ( ContactDefinition, ContactInteraction, ContactSurface, ContactSolverSettings, ContactPathControl, ContactPathProgram, ) -from anysolver.general_contact.s3_sliding_friction import S3SlidingFrictionSettings -from anysolver.general_contact.s3_friction_replay import S3ReplayFrictionSettings +from anyfesolver.general_contact.s3_sliding_friction import S3SlidingFrictionSettings +from anyfesolver.general_contact.s3_friction_replay import S3ReplayFrictionSettings def run_example(*, max_load_factor=1.0, restart_checkpoint=None): diff --git a/examples/general_contact_s3_patch_augmented_path.py b/examples/general_contact_s3_patch_augmented_path.py index 97130f52a..1452e72be 100644 --- a/examples/general_contact_s3_patch_augmented_path.py +++ b/examples/general_contact_s3_patch_augmented_path.py @@ -4,13 +4,13 @@ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathProgram, ContactSolverSettings, ContactSurface, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_s3_patch_path.py b/examples/general_contact_s3_patch_path.py index 654843d59..419b3047a 100644 --- a/examples/general_contact_s3_patch_path.py +++ b/examples/general_contact_s3_patch_path.py @@ -4,13 +4,13 @@ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathProgram, ContactSolverSettings, ContactSurface, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_s3_physical_orientation.py b/examples/general_contact_s3_physical_orientation.py index c9d1873fc..54fd7922d 100644 --- a/examples/general_contact_s3_physical_orientation.py +++ b/examples/general_contact_s3_physical_orientation.py @@ -1,7 +1,7 @@ """Bounded physical-side oriented automatic S3 pair static lifecycle.""" from dataclasses import replace from examples.general_contact_automatic_s3_pair import build_s3_pair,solve_shell_pair -from anysolver.general_contact import resolve_automatic_contact_domain +from anyfesolver.general_contact import resolve_automatic_contact_domain def build_orientation_pair(*,director_z=1,orientation='physical_sides_dev',resolve_domain=True): diff --git a/examples/general_contact_s3_plane.py b/examples/general_contact_s3_plane.py index 6c28ea49d..b581d9363 100644 --- a/examples/general_contact_s3_plane.py +++ b/examples/general_contact_s3_plane.py @@ -8,7 +8,7 @@ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, @@ -18,7 +18,7 @@ create_shell_element, solve_static_nonlinear, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_s3_plane_impact.py b/examples/general_contact_s3_plane_impact.py index edef74c37..8e856f5f4 100644 --- a/examples/general_contact_s3_plane_impact.py +++ b/examples/general_contact_s3_plane_impact.py @@ -3,7 +3,7 @@ import argparse import numpy as np -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, @@ -16,7 +16,7 @@ create_shell_element, solve_transient_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_s3_q4_patch_augmented_path.py b/examples/general_contact_s3_q4_patch_augmented_path.py index b78167978..a54ea0313 100644 --- a/examples/general_contact_s3_q4_patch_augmented_path.py +++ b/examples/general_contact_s3_q4_patch_augmented_path.py @@ -4,13 +4,13 @@ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathProgram, ContactSolverSettings, ContactSurface, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_s3_q4_patch_path.py b/examples/general_contact_s3_q4_patch_path.py index dbc8d4394..f7de4f169 100644 --- a/examples/general_contact_s3_q4_patch_path.py +++ b/examples/general_contact_s3_q4_patch_path.py @@ -4,13 +4,13 @@ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathProgram, ContactSolverSettings, ContactSurface, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_s3_rim_replay.py b/examples/general_contact_s3_rim_replay.py index adeda24f3..646f30a2f 100644 --- a/examples/general_contact_s3_rim_replay.py +++ b/examples/general_contact_s3_rim_replay.py @@ -1,11 +1,11 @@ """Bounded fixed-plane S3 physical-rim replay; no C5 engineering acceptance.""" import argparse,json from pathlib import Path -from anysolver import BoundaryCondition,create_shell_element,solve_static_nonlinear -from anysolver.fe_core import FEModel -from anysolver.general_contact import ContactDefinition,ContactInteraction,ContactSurface,ContactSolverSettings,ContactPathControl,ContactPathProgram -from anysolver.general_contact.s3_sliding_friction import S3SlidingFrictionSettings -from anysolver.general_contact.s3_friction_replay import S3RimReplayFrictionSettings +from anyfesolver import BoundaryCondition,create_shell_element,solve_static_nonlinear +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact import ContactDefinition,ContactInteraction,ContactSurface,ContactSolverSettings,ContactPathControl,ContactPathProgram +from anyfesolver.general_contact.s3_sliding_friction import S3SlidingFrictionSettings +from anyfesolver.general_contact.s3_friction_replay import S3RimReplayFrictionSettings def build_case(): m=FEModel('S3 fixed-plane physical-rim replay development') diff --git a/examples/general_contact_sphere.py b/examples/general_contact_sphere.py index edbe67aa0..b6947d52e 100644 --- a/examples/general_contact_sphere.py +++ b/examples/general_contact_sphere.py @@ -1,18 +1,18 @@ """Press a Q4 shell's physical top skin against a fixed analytic sphere. -Run from the repository root with ANYsolver installed: +Run from the repository root with ANYfeSolver installed: python examples/general_contact_sphere.py """ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, DisplacementControl, LoadCase, RigidContactBody, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_sphere_tight_gap.py b/examples/general_contact_sphere_tight_gap.py index dea62e4ea..a0b2ea779 100644 --- a/examples/general_contact_sphere_tight_gap.py +++ b/examples/general_contact_sphere_tight_gap.py @@ -1,17 +1,17 @@ """Force-controlled shell contact with a dimensional gap budget. -Run with ANYsolver installed: python examples/general_contact_sphere_tight_gap.py +Run with ANYfeSolver installed: python examples/general_contact_sphere_tight_gap.py The large sphere radius makes this a well-resolved, nearly flat benchmark. """ import json -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, LoadCase, RigidContactBody, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def main() -> None: diff --git a/examples/general_contact_static_results_archive.py b/examples/general_contact_static_results_archive.py index 329d645d3..2172c6b92 100644 --- a/examples/general_contact_static_results_archive.py +++ b/examples/general_contact_static_results_archive.py @@ -1,7 +1,7 @@ """Actual ordinary S3 finite-tool contact result export and detached read.""" from examples.general_contact_triangulated_rigid import case -from anysolver import LoadCase, solve_static_nonlinear -from anysolver.general_contact import read_static_contact_results +from anyfesolver import LoadCase, solve_static_nonlinear +from anyfesolver.general_contact import read_static_contact_results def analysis(): diff --git a/examples/general_contact_tilted_relative_output.py b/examples/general_contact_tilted_relative_output.py index 5427cbd36..6fee42b38 100644 --- a/examples/general_contact_tilted_relative_output.py +++ b/examples/general_contact_tilted_relative_output.py @@ -8,8 +8,8 @@ from decimal import Decimal,localcontext from pathlib import Path import numpy as np -from anysolver.nonlinear_restart import load_nonlinear_checkpoint,_state_records,model_configuration_fingerprint -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.nonlinear_restart import load_nonlinear_checkpoint,_state_records,model_configuration_fingerprint +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from docs.d1_review_support.contact_finite_rotation_shell_work_20261008.oracle import posed_bounds SCHEMA='TILTED_RELATIVE_Q4_PUBLIC_OUTPUT_V1' @@ -32,7 +32,7 @@ def finite_tree(value): def terminal_states(snapshot_records,checkpoint_records,model,u,coordinates): # static_path snapshots are copied before final owner sealing. Compare ALL # mechanical fields; only the two documented final seal fields are separate. - from anysolver.general_contact.finite_rotation_state import owner_local_coordinates,COORDINATES + from anyfesolver.general_contact.finite_rotation_state import owner_local_coordinates,COORDINATES require(coordinates==COORDINATES,'exact finite owner state coordinates') require([r['element_id'] for r in checkpoint_records]==sorted(model.mesh.elements),'complete terminal checkpoint state inventory') seals={'qualified_q4_committed_binding','state_integrity_sha256'} diff --git a/examples/general_contact_tilted_relative_sliding.py b/examples/general_contact_tilted_relative_sliding.py index 6e64d3f7a..6b33024d2 100644 --- a/examples/general_contact_tilted_relative_sliding.py +++ b/examples/general_contact_tilted_relative_sliding.py @@ -7,9 +7,9 @@ import math,os,json from pathlib import Path import numpy as np -from anysolver import BoundaryCondition,solve_static_nonlinear -from anysolver.general_contact import resolve_automatic_contact_domain -from anysolver.general_contact.static_path import ContactPathControl,ContactPathNodalForce,ContactPathProgram +from anyfesolver import BoundaryCondition,solve_static_nonlinear +from anyfesolver.general_contact import resolve_automatic_contact_domain +from anyfesolver.general_contact.static_path import ContactPathControl,ContactPathNodalForce,ContactPathProgram from examples.general_contact_q4_pair_monolithic_cycle import build as base from examples.general_contact_finite_rotation_shell_work import rotation,rigid_pose diff --git a/examples/general_contact_transient_results_archive.py b/examples/general_contact_transient_results_archive.py index 510fb3781..a39a37a1a 100644 --- a/examples/general_contact_transient_results_archive.py +++ b/examples/general_contact_transient_results_archive.py @@ -1,9 +1,9 @@ """Small producer/export/reader workflow; no new transient mechanical profile.""" import numpy as np -from anysolver import (FEModel,BoundaryCondition,ContactDefinition,ContactSurface, +from anyfesolver import (FEModel,BoundaryCondition,ContactDefinition,ContactSurface, RigidContactBody,ContactInteraction,TransientConfig,ContactTransientSolverControls, LoadCase,create_shell_element,solve_transient_contact) -from anysolver.general_contact import read_transient_contact_results +from anyfesolver.general_contact import read_transient_contact_results def impact_archive(): diff --git a/examples/general_contact_triangulated_rigid.py b/examples/general_contact_triangulated_rigid.py index 30dd6cae5..56704ae61 100644 --- a/examples/general_contact_triangulated_rigid.py +++ b/examples/general_contact_triangulated_rigid.py @@ -1,9 +1,9 @@ """Finite planar tool, formulation-owned S3 skin, ordinary static driver.""" -from anysolver import (BoundaryCondition, ContactDefinition, ContactInteraction, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactInteraction, ContactSurface, ContactSolverSettings, create_shell_element, LoadCase, solve_static_nonlinear) -from anysolver.fe_core import FEModel -from anysolver.general_contact import TriangulatedRigidContactBody +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact import TriangulatedRigidContactBody def case(diagonal=0): diff --git a/examples/general_contact_triangulated_rigid_patch.py b/examples/general_contact_triangulated_rigid_patch.py index aa028fc92..02fa139e1 100644 --- a/examples/general_contact_triangulated_rigid_patch.py +++ b/examples/general_contact_triangulated_rigid_patch.py @@ -1,5 +1,5 @@ """Connected two-S3 physical patch against a nonmatching finite rigid tool.""" -from anysolver import (BoundaryCondition,ContactDefinition,ContactSurface,ContactInteraction, +from anyfesolver import (BoundaryCondition,ContactDefinition,ContactSurface,ContactInteraction, LoadCase,create_shell_element,solve_static_nonlinear) from examples.general_contact_triangulated_rigid import case as single_case diff --git a/examples/general_contact_warped_q4_patch.py b/examples/general_contact_warped_q4_patch.py index 1c2d921e3..1370a5f68 100644 --- a/examples/general_contact_warped_q4_patch.py +++ b/examples/general_contact_warped_q4_patch.py @@ -1,11 +1,11 @@ """Two edge-sharing warped Q4 faces against an analytic rigid plane.""" -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, LoadCase, RigidContactBody, create_shell_element, solve_static_nonlinear, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel model = FEModel("two_warped_q4_plane_example") diff --git a/examples/general_contact_warped_q4_plane.py b/examples/general_contact_warped_q4_plane.py index eb373ebfb..b6796136b 100644 --- a/examples/general_contact_warped_q4_plane.py +++ b/examples/general_contact_warped_q4_plane.py @@ -1,11 +1,11 @@ """Opt-in small-rotation warped Q4/plane contact development example.""" -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, LoadCase, RigidContactBody, create_shell_element, solve_static_nonlinear, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel model = FEModel("warped_q4_plane_example") diff --git a/examples/inertia_relief.py b/examples/inertia_relief.py index 5a68720e6..db21758a2 100644 --- a/examples/inertia_relief.py +++ b/examples/inertia_relief.py @@ -1,5 +1,5 @@ """A free bar accelerates under an end force while developing elastic strain.""" -from anysolver import (AnalysisSession, BeamElement, FEModel, LoadCase, StaticCase, +from anyfesolver import (AnalysisSession, BeamElement, FEModel, LoadCase, StaticCase, iter_linear_batches, solve_inertia_relief) diff --git a/examples/native_connected_balance_reference.py b/examples/native_connected_balance_reference.py index 4bc19c470..3bbdbc5d2 100644 --- a/examples/native_connected_balance_reference.py +++ b/examples/native_connected_balance_reference.py @@ -1,6 +1,6 @@ """Independent straight-reference connected elastic physical balances. -No anysolver import, cached station data or reported owner accounting is used. +No anyfesolver import, cached station data or reported owner accounting is used. This reference is deliberately bounded to the registered two straight elements, identity reference triads and diagonal centered section tensors. No C7 claim. """ diff --git a/examples/native_connected_bending_dev.py b/examples/native_connected_bending_dev.py index 30f4df3c1..b652c6992 100644 --- a/examples/native_connected_bending_dev.py +++ b/examples/native_connected_bending_dev.py @@ -2,11 +2,11 @@ import argparse import json import numpy as np -from anysolver.dynamics import TransientConfig -from anysolver.ge_beam3_native import define_beam,SELECTOR as BEAM,EllipsoidalGeneralizedSection -from anysolver.ge_beam3_native_connected_dynamics import create_analysis,solve_transient,SELECTOR -from anysolver.boundary import BoundaryCondition -from anysolver._ge_beam3_centered_so3_strain import POLICY as STABLE_SO3_POLICY +from anyfesolver.dynamics import TransientConfig +from anyfesolver.ge_beam3_native import define_beam,SELECTOR as BEAM,EllipsoidalGeneralizedSection +from anyfesolver.ge_beam3_native_connected_dynamics import create_analysis,solve_transient,SELECTOR +from anyfesolver.boundary import BoundaryCondition +from anyfesolver._ge_beam3_centered_so3_strain import POLICY as STABLE_SO3_POLICY from examples import native_connected_bending_reference as reference diff --git a/examples/native_connected_deformation_dev.py b/examples/native_connected_deformation_dev.py index 68ebc3d3d..caa426999 100644 --- a/examples/native_connected_deformation_dev.py +++ b/examples/native_connected_deformation_dev.py @@ -2,10 +2,10 @@ import argparse import json import numpy as np -from anysolver.dynamics import TransientConfig -from anysolver.ge_beam3_native import define_beam,SELECTOR as BEAM,EllipsoidalGeneralizedSection -from anysolver.ge_beam3_native_connected_dynamics import create_analysis,solve_transient,SELECTOR -from anysolver.boundary import BoundaryCondition +from anyfesolver.dynamics import TransientConfig +from anyfesolver.ge_beam3_native import define_beam,SELECTOR as BEAM,EllipsoidalGeneralizedSection +from anyfesolver.ge_beam3_native_connected_dynamics import create_analysis,solve_transient,SELECTOR +from anyfesolver.boundary import BoundaryCondition from examples import native_connected_deformation_reference as reference diff --git a/examples/native_connected_dynamic_dev.py b/examples/native_connected_dynamic_dev.py index d7278e465..679103e15 100644 --- a/examples/native_connected_dynamic_dev.py +++ b/examples/native_connected_dynamic_dev.py @@ -2,8 +2,8 @@ import argparse import json import numpy as np -from anysolver.ge_beam3_native import define_beam, SELECTOR as BEAM, EllipsoidalGeneralizedSection -from anysolver.ge_beam3_native_connected_dynamics import create_analysis, SELECTOR +from anyfesolver.ge_beam3_native import define_beam, SELECTOR as BEAM, EllipsoidalGeneralizedSection +from anyfesolver.ge_beam3_native_connected_dynamics import create_analysis, SELECTOR def build(clamped=False): @@ -15,7 +15,7 @@ def build(clamped=False): (2,(30,40,50),((0.,0.,0.),(.5,0.,0.),(1.,0.,0.))))) boundaries=() if clamped: - from anysolver.boundary import BoundaryCondition + from anyfesolver.boundary import BoundaryCondition boundaries=(BoundaryCondition('root',[10],dict.fromkeys(('ux','uy','uz','rx','ry','rz'),0.)),) return create_analysis(SELECTOR,definitions,boundaries) diff --git a/examples/native_connected_transient_dev.py b/examples/native_connected_transient_dev.py index 4d0422131..f6b248d79 100644 --- a/examples/native_connected_transient_dev.py +++ b/examples/native_connected_transient_dev.py @@ -4,8 +4,8 @@ import json from pathlib import Path import numpy as np -from anysolver.dynamics import TransientConfig -from anysolver.ge_beam3_native_connected_dynamics import solve_transient +from anyfesolver.dynamics import TransientConfig +from anyfesolver.ge_beam3_native_connected_dynamics import solve_transient from examples.native_connected_dynamic_dev import build,velocity diff --git a/examples/native_contact_free_finite_velocity_dev.py b/examples/native_contact_free_finite_velocity_dev.py index e29af89b8..0044e3754 100644 --- a/examples/native_contact_free_finite_velocity_dev.py +++ b/examples/native_contact_free_finite_velocity_dev.py @@ -4,9 +4,9 @@ """ import json import numpy as np -from anysolver.ge_beam3_native import ( +from anyfesolver.ge_beam3_native import ( define_beam, SELECTOR as DEFINITION_SELECTOR, EllipsoidalGeneralizedSection) -from anysolver.ge_beam3_native_dynamics import create_analysis, SELECTOR, workflow_provenance +from anyfesolver.ge_beam3_native_dynamics import create_analysis, SELECTOR, workflow_provenance def build_definition(): diff --git a/examples/native_contact_free_transient_dev.py b/examples/native_contact_free_transient_dev.py index f586e0d68..d6ca9c109 100644 --- a/examples/native_contact_free_transient_dev.py +++ b/examples/native_contact_free_transient_dev.py @@ -8,10 +8,10 @@ import json import numpy as np -from anysolver.boundary import BoundaryCondition -from anysolver.dynamics import TransientConfig -from anysolver.ge_beam3_native import LinePattern, DistributedPattern -from anysolver.ge_beam3_native_dynamics import create_analysis, SELECTOR, solve_transient +from anyfesolver.boundary import BoundaryCondition +from anyfesolver.dynamics import TransientConfig +from anyfesolver.ge_beam3_native import LinePattern, DistributedPattern +from anyfesolver.ge_beam3_native_dynamics import create_analysis, SELECTOR, solve_transient from examples.native_contact_free_finite_velocity_dev import build_definition, initial_velocity diff --git a/examples/native_full_amplitude_vibration_dev.py b/examples/native_full_amplitude_vibration_dev.py index 7c2682060..73704d279 100644 --- a/examples/native_full_amplitude_vibration_dev.py +++ b/examples/native_full_amplitude_vibration_dev.py @@ -9,9 +9,9 @@ from hashlib import sha256 from fractions import Fraction import numpy as np -from anysolver.ge_beam3_native import define_beam, SELECTOR as STATIC_SELECTOR -from anysolver.ge_beam3_native_dynamics import create_analysis, SELECTOR, PROFILE_BYTES -from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection +from anyfesolver.ge_beam3_native import define_beam, SELECTOR as STATIC_SELECTOR +from anyfesolver.ge_beam3_native_dynamics import create_analysis, SELECTOR, PROFILE_BYTES +from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection from examples import native_vibration_physical_reference as physical def fixture(): @@ -83,14 +83,14 @@ def pool_rows(rows):return sorted(rows,key=lambda row:row['filepath']) def _measured_acceptance_scope(record): """Measure actual package and runtime; no historical workspace file is needed.""" - import anysolver + import anyfesolver import numba import scipy import threadpoolctl parallel=sys.modules.get('numba.np.ufunc.parallel') active=parallel is not None and vars(parallel).get('_is_initialized')is True - package=Path(anysolver.__file__).resolve().parent - files={'anysolver/'+p.relative_to(package).as_posix():sha256(p.read_bytes()).hexdigest() + package=Path(anyfesolver.__file__).resolve().parent + files={'anyfesolver/'+p.relative_to(package).as_posix():sha256(p.read_bytes()).hexdigest() for p in package.rglob('*.py')if '__pycache__'not in p.parts} digest=sha256(json.dumps(files,sort_keys=True,separators=(',',':')).encode()).hexdigest() actual=dict(platform=sys.platform, @@ -260,9 +260,9 @@ def _envelope_case_binding(facts,record): def _measure_envelope_source(): - import anysolver - package=Path(anysolver.__file__).resolve().parent - files={'anysolver/'+p.relative_to(package).as_posix():sha256(p.read_bytes()).hexdigest() + import anyfesolver + package=Path(anyfesolver.__file__).resolve().parent + files={'anyfesolver/'+p.relative_to(package).as_posix():sha256(p.read_bytes()).hexdigest() for p in package.rglob('*.py')if '__pycache__'not in p.parts} return dict(product_python_count=len(files), product_python_manifest_sha256=sha256(json.dumps(files,sort_keys=True,separators=(',',':')).encode()).hexdigest(), diff --git a/examples/native_manufactured_dynamic_loading_dev.py b/examples/native_manufactured_dynamic_loading_dev.py index 138028f33..e10c8a677 100644 --- a/examples/native_manufactured_dynamic_loading_dev.py +++ b/examples/native_manufactured_dynamic_loading_dev.py @@ -7,10 +7,10 @@ import json from dataclasses import asdict, replace import numpy as np -from anysolver.dynamics import TransientConfig -from anysolver.ge_beam3_native import (define_beam, SELECTOR as DEFINITION_SELECTOR, +from anyfesolver.dynamics import TransientConfig +from anyfesolver.ge_beam3_native import (define_beam, SELECTOR as DEFINITION_SELECTOR, EllipsoidalGeneralizedSection, LinePattern, DistributedPattern) -from anysolver.ge_beam3_native_dynamics import create_analysis, SELECTOR, solve_transient +from anyfesolver.ge_beam3_native_dynamics import create_analysis, SELECTOR, solve_transient from examples.native_manufactured_loading_reference import LoadingInputs, endpoint, interval, scales diff --git a/examples/native_manufactured_loading_reference.py b/examples/native_manufactured_loading_reference.py index 425e1ee2b..304e04d48 100644 --- a/examples/native_manufactured_loading_reference.py +++ b/examples/native_manufactured_loading_reference.py @@ -1,6 +1,6 @@ """Independent straight centered principal-axis loading reference (SI). -No anysolver import or production inertia/work/contact kernel is used here. +No anyfesolver import or production inertia/work/contact kernel is used here. The ellipse primitives are independently declared geometry, not inferred from EllipsoidalGeneralizedSection (a generalized yield-law class). Prepared source only; this reference grants no execution or qualification. diff --git a/examples/native_nonprincipal_dev.py b/examples/native_nonprincipal_dev.py index 2ca55e636..47d074486 100644 --- a/examples/native_nonprincipal_dev.py +++ b/examples/native_nonprincipal_dev.py @@ -3,10 +3,10 @@ import json import math import numpy as np -from anysolver.dynamics import TransientConfig -from anysolver.ge_beam3_native import define_beam,SELECTOR as BEAM,EllipsoidalGeneralizedSection -from anysolver.ge_beam3_native_dynamics import create_analysis,SELECTOR,solve_transient -from anysolver._ge_beam3_centered_so3_strain import POLICY +from anyfesolver.dynamics import TransientConfig +from anyfesolver.ge_beam3_native import define_beam,SELECTOR as BEAM,EllipsoidalGeneralizedSection +from anyfesolver.ge_beam3_native_dynamics import create_analysis,SELECTOR,solve_transient +from anyfesolver._ge_beam3_centered_so3_strain import POLICY from examples import native_nonprincipal_reference as ref diff --git a/examples/r8_ge_paired_adaptive_public_example.py b/examples/r8_ge_paired_adaptive_public_example.py index 2a27df04a..1bfcf4023 100644 --- a/examples/r8_ge_paired_adaptive_public_example.py +++ b/examples/r8_ge_paired_adaptive_public_example.py @@ -1,6 +1,6 @@ """Public paired signed load/unload/reload example; caller supplies limits.""" def continue_cycle(owner,loads,*,force_seed_sha256,increment_control,cancellation_token=None,on_accepted=None): - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss if type(increment_control) is not ss.AdaptiveIncrementControl or increment_control!=ss.AdaptiveIncrementControl(4,96): raise ValueError('this prepared programme requires root-adopted4cutbacks/96total attempts') target=0.028578804694929322 diff --git a/examples/static_batch_free_free.py b/examples/static_batch_free_free.py index 070296d67..b683581a9 100644 --- a/examples/static_batch_free_free.py +++ b/examples/static_batch_free_free.py @@ -7,10 +7,10 @@ import argparse from contextlib import closing -from anysolver import (AnalysisSession, EnvelopeReducer, LoadCase, RecoveryConfig, +from anyfesolver import (AnalysisSession, EnvelopeReducer, LoadCase, RecoveryConfig, ResourceConfig, StaticBatchError, StaticCase, iter_linear_batches) -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel def build_model(disconnected=False): diff --git a/examples/static_batch_supported.py b/examples/static_batch_supported.py index 6a96b1b0e..1da98a72c 100644 --- a/examples/static_batch_supported.py +++ b/examples/static_batch_supported.py @@ -4,10 +4,10 @@ """ from contextlib import closing -from anysolver import (AnalysisSession, EnvelopeReducer, FixedSupport, LoadCase, +from anyfesolver import (AnalysisSession, EnvelopeReducer, FixedSupport, LoadCase, RecoveryConfig, ResourceConfig, StaticCase, iter_linear_batches) -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel def build_model(): diff --git a/examples/stiffened_shell_b2_body_acceleration.py b/examples/stiffened_shell_b2_body_acceleration.py index 1e767c3ca..3abd0b494 100644 --- a/examples/stiffened_shell_b2_body_acceleration.py +++ b/examples/stiffened_shell_b2_body_acceleration.py @@ -12,7 +12,7 @@ import numpy as np from scipy import sparse -from anysolver import stiffened_shell as api +from anyfesolver import stiffened_shell as api def definition(mesh="mixed"): diff --git a/examples/stiffened_shell_b2_footprint_reference_modes.py b/examples/stiffened_shell_b2_footprint_reference_modes.py index fbefff7f7..2b615fab2 100644 --- a/examples/stiffened_shell_b2_footprint_reference_modes.py +++ b/examples/stiffened_shell_b2_footprint_reference_modes.py @@ -10,7 +10,7 @@ import numpy as np from scipy import sparse -from anysolver import stiffened_shell as api +from anyfesolver import stiffened_shell as api def main(): diff --git a/examples/stiffened_shell_b2_loaded_points.py b/examples/stiffened_shell_b2_loaded_points.py index 2e1de759d..32217c4b5 100644 --- a/examples/stiffened_shell_b2_loaded_points.py +++ b/examples/stiffened_shell_b2_loaded_points.py @@ -8,7 +8,7 @@ import argparse import json from pathlib import Path -from anysolver import stiffened_shell as api +from anyfesolver import stiffened_shell as api from stiffened_shell_b2_body_acceleration import definition diff --git a/examples/stiffened_shell_b2_mixed_panel.py b/examples/stiffened_shell_b2_mixed_panel.py index 2e8350d25..411fd00a7 100644 --- a/examples/stiffened_shell_b2_mixed_panel.py +++ b/examples/stiffened_shell_b2_mixed_panel.py @@ -10,7 +10,7 @@ import numpy as np from scipy import sparse -from anysolver import stiffened_shell as api +from anyfesolver import stiffened_shell as api def definition(mesh="mixed"): diff --git a/examples/stiffened_shell_b2_mixed_reference_modes.py b/examples/stiffened_shell_b2_mixed_reference_modes.py index e175b92c1..cbd2e529a 100644 --- a/examples/stiffened_shell_b2_mixed_reference_modes.py +++ b/examples/stiffened_shell_b2_mixed_reference_modes.py @@ -9,7 +9,7 @@ import json import numpy as np -from anysolver import stiffened_shell as api +from anyfesolver import stiffened_shell as api from stiffened_shell_b2_mixed_panel import definition as static_definition diff --git a/examples/stiffened_shell_b2_nodal_rigid_footprint.py b/examples/stiffened_shell_b2_nodal_rigid_footprint.py index 7d4ad770c..93aadeaed 100644 --- a/examples/stiffened_shell_b2_nodal_rigid_footprint.py +++ b/examples/stiffened_shell_b2_nodal_rigid_footprint.py @@ -8,7 +8,7 @@ import numpy as np from scipy import sparse -from anysolver import stiffened_shell as api +from anyfesolver import stiffened_shell as api def main(): diff --git a/examples/stiffened_shell_b2_physical_rigid_footprint.py b/examples/stiffened_shell_b2_physical_rigid_footprint.py index 5dd4db8dd..b969cfc3d 100644 --- a/examples/stiffened_shell_b2_physical_rigid_footprint.py +++ b/examples/stiffened_shell_b2_physical_rigid_footprint.py @@ -2,7 +2,7 @@ import json import numpy as np from scipy import sparse -from anysolver import stiffened_shell as api +from anyfesolver import stiffened_shell as api from examples.stiffened_shell_b2_reference_buckling import traction_sources def definition(): diff --git a/examples/stiffened_shell_b2_reference_buckling.py b/examples/stiffened_shell_b2_reference_buckling.py index 7e35e2ab6..cd6051cb7 100644 --- a/examples/stiffened_shell_b2_reference_buckling.py +++ b/examples/stiffened_shell_b2_reference_buckling.py @@ -2,7 +2,7 @@ import json import numpy as np from scipy import sparse -from anysolver import stiffened_shell as api +from anyfesolver import stiffened_shell as api def traction_source(member_id="beam", source_id="explicit-square-gauss-traction-v1"): a=.1/np.sqrt(3.) diff --git a/examples/stiffened_shell_bl5_staged.py b/examples/stiffened_shell_bl5_staged.py index 2f27b4aa5..0452b9fd5 100644 --- a/examples/stiffened_shell_bl5_staged.py +++ b/examples/stiffened_shell_bl5_staged.py @@ -5,15 +5,15 @@ it is not a six-channel welded bond or a qualified physical reference. The objective Q4 policy is explicit. Only elastic static use is demonstrated; the generalized section's inertia metadata is not a qualified spectral model. -Run this file with an installed ANYsolver or the repository source environment. +Run this file with an installed ANYfeSolver or the repository source environment. """ from contextlib import ExitStack import json import numpy as np -from anysolver import b3_ge, stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver import b3_ge, stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled def definition(): diff --git a/examples/stiffened_shell_coupled_plastic_history.py b/examples/stiffened_shell_coupled_plastic_history.py index 288d0455c..342617d35 100644 --- a/examples/stiffened_shell_coupled_plastic_history.py +++ b/examples/stiffened_shell_coupled_plastic_history.py @@ -10,7 +10,7 @@ import numpy as np from anymaterial import DNVC208MaterialCurve -from anysolver import b3_ge, stiffened_shell as ss +from anyfesolver import b3_ge, stiffened_shell as ss OPTIONS = dict(max_iterations=20, max_backtracks=12) diff --git a/examples/stiffened_shell_coupled_s3_adaptive_history.py b/examples/stiffened_shell_coupled_s3_adaptive_history.py index 1c743554e..75c379617 100644 --- a/examples/stiffened_shell_coupled_s3_adaptive_history.py +++ b/examples/stiffened_shell_coupled_s3_adaptive_history.py @@ -10,9 +10,9 @@ from pathlib import Path import argparse,json,math import numpy as np -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken,SolveCancelled -from anysolver._stiffened_shell_q4_algorithmic_pullback import HISTORICAL_POLICY +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken,SolveCancelled +from anyfesolver._stiffened_shell_q4_algorithmic_pullback import HISTORICAL_POLICY if __package__: from .stiffened_shell_coupled_plastic_history import definition as base_definition,_shell_activity else: diff --git a/examples/stiffened_shell_footprint_chart_restart.py b/examples/stiffened_shell_footprint_chart_restart.py index 0d9f20918..3fa87a37d 100644 --- a/examples/stiffened_shell_footprint_chart_restart.py +++ b/examples/stiffened_shell_footprint_chart_restart.py @@ -1,6 +1,6 @@ """Opt-in elastic footprint chart reset and four-path restart comparison. -Run with an installed ANYsolver. This selected-node rigid connection locks all +Run with an installed ANYfeSolver. This selected-node rigid connection locks all six pose channels; it is not a distributing footprint, area weld or qualified physical connection. The existing unrebased example and default remain intact. """ @@ -9,7 +9,7 @@ import json import numpy as np -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from stiffened_shell_nodal_rigid_footprint import definition diff --git a/examples/stiffened_shell_ge_distributed_load.py b/examples/stiffened_shell_ge_distributed_load.py index 57a7c087d..b978ed3d6 100644 --- a/examples/stiffened_shell_ge_distributed_load.py +++ b/examples/stiffened_shell_ge_distributed_load.py @@ -6,7 +6,7 @@ """ from contextlib import ExitStack import json -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from stiffened_shell_ge_gravity import definition diff --git a/examples/stiffened_shell_ge_distributed_programme.py b/examples/stiffened_shell_ge_distributed_programme.py index 06b186bdd..96aa4ec91 100644 --- a/examples/stiffened_shell_ge_distributed_programme.py +++ b/examples/stiffened_shell_ge_distributed_programme.py @@ -8,8 +8,8 @@ from contextlib import ExitStack import json -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled from stiffened_shell_ge_gravity import definition diff --git a/examples/stiffened_shell_ge_distributing_displacement.py b/examples/stiffened_shell_ge_distributing_displacement.py index 0afb3e602..55f811c14 100644 --- a/examples/stiffened_shell_ge_distributing_displacement.py +++ b/examples/stiffened_shell_ge_distributing_displacement.py @@ -1,7 +1,7 @@ """Experimental fixed physical displacement, restart and physical pad recovery.""" import json import numpy as np -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from stiffened_shell_ge_distributing_finite import definition diff --git a/examples/stiffened_shell_ge_distributing_finite.py b/examples/stiffened_shell_ge_distributing_finite.py index e503264d6..92fbb245c 100644 --- a/examples/stiffened_shell_ge_distributing_finite.py +++ b/examples/stiffened_shell_ge_distributing_finite.py @@ -7,7 +7,7 @@ from dataclasses import replace import json import numpy as np -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from stiffened_shell_ge_distributing_reference import definition as reference_definition diff --git a/examples/stiffened_shell_ge_distributing_material.py b/examples/stiffened_shell_ge_distributing_material.py index 85666734e..8046adad0 100644 --- a/examples/stiffened_shell_ge_distributing_material.py +++ b/examples/stiffened_shell_ge_distributing_material.py @@ -8,7 +8,7 @@ import json import numpy as np from anymaterial import DNVC208MaterialCurve -from anysolver import b3_ge, stiffened_shell as ss +from anyfesolver import b3_ge, stiffened_shell as ss from stiffened_shell_ge_distributing_finite import definition as elastic_definition diff --git a/examples/stiffened_shell_ge_distributing_reference.py b/examples/stiffened_shell_ge_distributing_reference.py index 5d7a81a00..792285f25 100644 --- a/examples/stiffened_shell_ge_distributing_reference.py +++ b/examples/stiffened_shell_ge_distributing_reference.py @@ -9,7 +9,7 @@ import json import numpy as np -from anysolver import b3_ge, stiffened_shell as ss +from anyfesolver import b3_ge, stiffened_shell as ss def definition(): diff --git a/examples/stiffened_shell_ge_footprint_gravity.py b/examples/stiffened_shell_ge_footprint_gravity.py index 1d3db1553..6e3e33938 100644 --- a/examples/stiffened_shell_ge_footprint_gravity.py +++ b/examples/stiffened_shell_ge_footprint_gravity.py @@ -3,14 +3,14 @@ The two-shell/two-beam mass definition is shared with the gravity example. The beam attaches only through the right shell patch. This intentionally rigid, six-channel selected-node connection is not an area weld or distributing pad. -Run through an installed ANYsolver; this example is not G4 qualification. +Run through an installed ANYfeSolver; this example is not G4 qualification. """ from contextlib import ExitStack from dataclasses import replace import json import numpy as np -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from stiffened_shell_ge_gravity import definition as point_definition diff --git a/examples/stiffened_shell_ge_free_reference_modes.py b/examples/stiffened_shell_ge_free_reference_modes.py index 94aba4a5c..b4164a2ce 100644 --- a/examples/stiffened_shell_ge_free_reference_modes.py +++ b/examples/stiffened_shell_ge_free_reference_modes.py @@ -6,7 +6,7 @@ """ import json import numpy as np -from anysolver import b3_ge, stiffened_shell as api +from anyfesolver import b3_ge, stiffened_shell as api def main(): diff --git a/examples/stiffened_shell_ge_gravity.py b/examples/stiffened_shell_ge_gravity.py index e02468aa9..c0bba8664 100644 --- a/examples/stiffened_shell_ge_gravity.py +++ b/examples/stiffened_shell_ge_gravity.py @@ -7,7 +7,7 @@ from contextlib import ExitStack import json import numpy as np -from anysolver import b3_ge, stiffened_shell as ss +from anyfesolver import b3_ge, stiffened_shell as ss def definition(): diff --git a/examples/stiffened_shell_ge_mixed_buckling.py b/examples/stiffened_shell_ge_mixed_buckling.py index 88b095316..8b383eabd 100644 --- a/examples/stiffened_shell_ge_mixed_buckling.py +++ b/examples/stiffened_shell_ge_mixed_buckling.py @@ -7,7 +7,7 @@ def definition(shell='mixed', beams='mixed'): """Small eccentric panel; fibre branches are intentionally elastic interior.""" import numpy as np - from anysolver import b3_ge, stiffened_shell as ss + from anyfesolver import b3_ge, stiffened_shell as ss if shell not in ('q4', 's3', 'mixed') or beams not in ('generalized', 'fibre', 'mixed'): raise ValueError('q4/s3/mixed shells and generalized/fibre/mixed beams required') e, nu = 210e9, .3 @@ -41,7 +41,7 @@ def definition(shell='mixed', beams='mixed'): def workflow(shell='mixed', beams='mixed', count=2): - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss owner = ss.create_analysis(definition=definition(shell, beams)) try: accepted = owner.solve((ss.NodalAction('beam',105,(-1000.,0.,100.,0.,0.,0.)),), diff --git a/examples/stiffened_shell_ge_mixed_reference_modes.py b/examples/stiffened_shell_ge_mixed_reference_modes.py index e0bf6f89e..db9401a9d 100644 --- a/examples/stiffened_shell_ge_mixed_reference_modes.py +++ b/examples/stiffened_shell_ge_mixed_reference_modes.py @@ -2,7 +2,7 @@ from dataclasses import replace import json import numpy as np -from anysolver import b3_ge, stiffened_shell as ss +from anyfesolver import b3_ge, stiffened_shell as ss from examples.stiffened_shell_native_fibre_bl5 import definition as native_definition diff --git a/examples/stiffened_shell_ge_point_displacement.py b/examples/stiffened_shell_ge_point_displacement.py index 66c27fc5b..76653be66 100644 --- a/examples/stiffened_shell_ge_point_displacement.py +++ b/examples/stiffened_shell_ge_point_displacement.py @@ -7,7 +7,7 @@ from math import fsum import argparse import json -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from stiffened_shell_ge_point_zero_unload import definition diff --git a/examples/stiffened_shell_ge_point_zero_unload.py b/examples/stiffened_shell_ge_point_zero_unload.py index aef4875b1..4cf00bc6d 100644 --- a/examples/stiffened_shell_ge_point_zero_unload.py +++ b/examples/stiffened_shell_ge_point_zero_unload.py @@ -8,7 +8,7 @@ import argparse import json import numpy as np -from anysolver import b3_ge, stiffened_shell as ss +from anyfesolver import b3_ge, stiffened_shell as ss def definition(): diff --git a/examples/stiffened_shell_ge_pressure.py b/examples/stiffened_shell_ge_pressure.py index 30c57fb9e..3b6301c0d 100644 --- a/examples/stiffened_shell_ge_pressure.py +++ b/examples/stiffened_shell_ge_pressure.py @@ -6,7 +6,7 @@ """ from contextlib import ExitStack import json -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from stiffened_shell_ge_gravity import definition diff --git a/examples/stiffened_shell_ge_reference_modes.py b/examples/stiffened_shell_ge_reference_modes.py index 0a397e072..46aefab87 100644 --- a/examples/stiffened_shell_ge_reference_modes.py +++ b/examples/stiffened_shell_ge_reference_modes.py @@ -6,7 +6,7 @@ """ import json import numpy as np -from anysolver import b3_ge, stiffened_shell as api +from anyfesolver import b3_ge, stiffened_shell as api def main(): diff --git a/examples/stiffened_shell_native_arc.py b/examples/stiffened_shell_native_arc.py index b621c286f..99c6d9e7f 100644 --- a/examples/stiffened_shell_native_arc.py +++ b/examples/stiffened_shell_native_arc.py @@ -7,7 +7,7 @@ from hashlib import sha256 import argparse,json import numpy as np -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss if __package__: from .stiffened_shell_coupled_s3_adaptive_history import definition else: diff --git a/examples/stiffened_shell_native_capacity.py b/examples/stiffened_shell_native_capacity.py index 1f997a62a..93dddfdb6 100644 --- a/examples/stiffened_shell_native_capacity.py +++ b/examples/stiffened_shell_native_capacity.py @@ -12,8 +12,8 @@ import numpy as np from scipy.spatial.transform import Rotation -from anysolver import b3_ge, stiffened_shell as ss -from anysolver.control import SolveCancelled +from anyfesolver import b3_ge, stiffened_shell as ss +from anyfesolver.control import SolveCancelled @dataclass(frozen=True) diff --git a/examples/stiffened_shell_native_coupled_displacement.py b/examples/stiffened_shell_native_coupled_displacement.py index b4a7de3e8..4cd3ecd51 100644 --- a/examples/stiffened_shell_native_coupled_displacement.py +++ b/examples/stiffened_shell_native_coupled_displacement.py @@ -6,7 +6,7 @@ from pathlib import Path from math import fsum import argparse,json -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from stiffened_shell_coupled_plastic_history import definition,OPTIONS diff --git a/examples/stiffened_shell_native_director_arc_metric.py b/examples/stiffened_shell_native_director_arc_metric.py index 2c6734e4b..c6ea80ac9 100644 --- a/examples/stiffened_shell_native_director_arc_metric.py +++ b/examples/stiffened_shell_native_director_arc_metric.py @@ -6,7 +6,7 @@ """ import json import numpy as np -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from examples.stiffened_shell_native_fibre_bl5_mixed_j2_displacement import definition from examples.stiffened_shell_native_fibre_bl5_displacement import ACTIONS,OPTIONS diff --git a/examples/stiffened_shell_native_fibre_bl5.py b/examples/stiffened_shell_native_fibre_bl5.py index 313dedbb8..073c6c6eb 100644 --- a/examples/stiffened_shell_native_fibre_bl5.py +++ b/examples/stiffened_shell_native_fibre_bl5.py @@ -3,7 +3,7 @@ import argparse import json import numpy as np -from anysolver import b3_ge, stiffened_shell as ss +from anyfesolver import b3_ge, stiffened_shell as ss def definition(family='biaxial', beams='mixed', basis='p0', yield_stress=1e20, shell='q4'): diff --git a/examples/stiffened_shell_native_fibre_bl5_displacement.py b/examples/stiffened_shell_native_fibre_bl5_displacement.py index 718adddd3..e98c6c2f5 100644 --- a/examples/stiffened_shell_native_fibre_bl5_displacement.py +++ b/examples/stiffened_shell_native_fibre_bl5_displacement.py @@ -1,6 +1,6 @@ """Experimental fixed axial translation control, native BL5 history and restart.""" import json -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from examples.stiffened_shell_native_fibre_bl5_material import definition ACTIONS = (ss.NodalAction('beam', 105, (500., 0., 0., 0., 0., 0.)),) diff --git a/examples/stiffened_shell_native_fibre_bl5_material.py b/examples/stiffened_shell_native_fibre_bl5_material.py index cd5c7ebe1..720211d70 100644 --- a/examples/stiffened_shell_native_fibre_bl5_material.py +++ b/examples/stiffened_shell_native_fibre_bl5_material.py @@ -2,7 +2,7 @@ from dataclasses import replace import json from anymaterial import DNVC208MaterialCurve -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from examples.stiffened_shell_native_fibre_bl5 import definition as elastic_definition diff --git a/examples/stiffened_shell_native_fibre_bl5_mixed_j2_displacement.py b/examples/stiffened_shell_native_fibre_bl5_mixed_j2_displacement.py index 738b52487..2e2234faa 100644 --- a/examples/stiffened_shell_native_fibre_bl5_mixed_j2_displacement.py +++ b/examples/stiffened_shell_native_fibre_bl5_mixed_j2_displacement.py @@ -1,7 +1,7 @@ """Native fibre BL5 all-S3/mixed isotropic J2 fixed translation development route.""" from dataclasses import replace import json -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from anymaterial import DNVC208MaterialCurve from examples.stiffened_shell_native_fibre_bl5 import definition as elastic_definition from examples.stiffened_shell_native_fibre_bl5_displacement import ACTIONS, CONTROL, OPTIONS, TARGETS diff --git a/examples/stiffened_shell_native_fibre_s3_displacement.py b/examples/stiffened_shell_native_fibre_s3_displacement.py index beb136bf2..4cfb896a1 100644 --- a/examples/stiffened_shell_native_fibre_s3_displacement.py +++ b/examples/stiffened_shell_native_fibre_s3_displacement.py @@ -3,7 +3,7 @@ from pathlib import Path import argparse import json -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from stiffened_shell_ge_point_zero_unload import definition as reference_definition from math import fsum diff --git a/examples/stiffened_shell_native_fold_assessment.py b/examples/stiffened_shell_native_fold_assessment.py index d5702f006..b4bfd68f9 100644 --- a/examples/stiffened_shell_native_fold_assessment.py +++ b/examples/stiffened_shell_native_fold_assessment.py @@ -10,14 +10,14 @@ import numpy as np from scipy import sparse -from anysolver import stiffened_shell as ss -from anysolver import _stiffened_shell_displacement_corrector as corrector -from anysolver._stiffened_shell_arc_metric import ( +from anyfesolver import stiffened_shell as ss +from anyfesolver import _stiffened_shell_displacement_corrector as corrector +from anyfesolver._stiffened_shell_arc_metric import ( ChordDomainError, require_director_chart, require_metric_owner) -from anysolver._stiffened_shell_rotation_charts import physical_frames -from anysolver._stiffened_shell_bl5_local_experimental import BL5TrialDomainError -from anysolver._ge_beam3_pose_joint import _exp_terms -from anysolver._stiffened_shell_ge_finite_experimental import ( +from anyfesolver._stiffened_shell_rotation_charts import physical_frames +from anyfesolver._stiffened_shell_bl5_local_experimental import BL5TrialDomainError +from anyfesolver._ge_beam3_pose_joint import _exp_terms +from anyfesolver._stiffened_shell_ge_finite_experimental import ( _material_observables, _RotationStepTooLarge) from examples import stiffened_shell_native_capacity as case diff --git a/examples/stiffened_shell_native_fold_local_diagnostic.py b/examples/stiffened_shell_native_fold_local_diagnostic.py index 25b0dfeff..88e4609c7 100644 --- a/examples/stiffened_shell_native_fold_local_diagnostic.py +++ b/examples/stiffened_shell_native_fold_local_diagnostic.py @@ -8,12 +8,12 @@ from types import FunctionType import numpy as np -from anysolver import stiffened_shell as ss -from anysolver import _stiffened_shell_ge_finite_experimental as finite -from anysolver import _stiffened_shell_q4_algorithmic_pullback as q4 -from anysolver import _ge_beam3_variational_shell as shell_map -from anysolver import _ge_beam3_g3c_so3_numerics as stable_log -from anysolver.control import cancellation_safe_point +from anyfesolver import stiffened_shell as ss +from anyfesolver import _stiffened_shell_ge_finite_experimental as finite +from anyfesolver import _stiffened_shell_q4_algorithmic_pullback as q4 +from anyfesolver import _ge_beam3_variational_shell as shell_map +from anyfesolver import _ge_beam3_g3c_so3_numerics as stable_log +from anyfesolver.control import cancellation_safe_point from examples import stiffened_shell_native_capacity as case from examples import stiffened_shell_native_fold_assessment as fold diff --git a/examples/stiffened_shell_native_material_bl5_arc.py b/examples/stiffened_shell_native_material_bl5_arc.py index 613fb39d6..9e02035c9 100644 --- a/examples/stiffened_shell_native_material_bl5_arc.py +++ b/examples/stiffened_shell_native_material_bl5_arc.py @@ -5,7 +5,7 @@ """ import json import numpy as np -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from examples.stiffened_shell_native_fibre_bl5_mixed_j2_displacement import definition from examples.stiffened_shell_native_fibre_bl5_displacement import ACTIONS,CONTROL,OPTIONS,TARGETS diff --git a/examples/stiffened_shell_native_plastic_s3_displacement.py b/examples/stiffened_shell_native_plastic_s3_displacement.py index 628f74d9a..bc1a9c6f9 100644 --- a/examples/stiffened_shell_native_plastic_s3_displacement.py +++ b/examples/stiffened_shell_native_plastic_s3_displacement.py @@ -10,8 +10,8 @@ import json import numpy as np from anymaterial import DNVC208MaterialCurve -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken,SolveCancelled +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken,SolveCancelled from stiffened_shell_ge_point_zero_unload import definition as reference_definition diff --git a/examples/stiffened_shell_native_s3_displacement.py b/examples/stiffened_shell_native_s3_displacement.py index f92887665..7f8c450dd 100644 --- a/examples/stiffened_shell_native_s3_displacement.py +++ b/examples/stiffened_shell_native_s3_displacement.py @@ -3,7 +3,7 @@ from pathlib import Path import argparse import json -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from stiffened_shell_ge_gravity import definition as reference_definition diff --git a/examples/stiffened_shell_nodal_rigid_footprint.py b/examples/stiffened_shell_nodal_rigid_footprint.py index c06cd5906..57c28f289 100644 --- a/examples/stiffened_shell_nodal_rigid_footprint.py +++ b/examples/stiffened_shell_nodal_rigid_footprint.py @@ -1,13 +1,13 @@ """Headless experimental selected-node footprint; no weld qualification. -Run against an installed ANYsolver with optional --finite. The selected right +Run against an installed ANYfeSolver with optional --finite. The selected right Q4 cell's four vertices share a rigid pose at beam105. The left cell transfers load to the clamped shell root. All native B3 retained coordinates remain. """ import argparse import json import numpy as np -from anysolver import b3_ge, stiffened_shell as ss +from anyfesolver import b3_ge, stiffened_shell as ss def definition(): diff --git a/packages/results/README.md b/packages/results/README.md index 26c5835f7..7c868d07c 100644 --- a/packages/results/README.md +++ b/packages/results/README.md @@ -1,12 +1,12 @@ -# anysolver-results +# anyfesolver-results -NumPy-only offline runtime for ANYsolver recovery capsules +NumPy-only offline runtime for ANYfeSolver recovery capsules (`RUNTIME_ID = "anysolver-results/2"`, also supporting the legacy runtime1 contract). The package reconstructs solver response fields from the plain-data -recovery capsules exported by ANYsolver's `export_recovery_capsule` +recovery capsules exported by ANYfeSolver's `export_recovery_capsule` (contract `anysolver.recovery_capsule`, versions 1 and 2) without importing -anysolver, scipy, ANYfem or ANYpost: +anyfesolver, scipy, ANYfem or ANYpost: - `shell_surface_component(record, surface, component)` returns the requested local `xx`, `yy` or `xy` top/bottom stress using only its membrane/bending @@ -40,12 +40,12 @@ anysolver, scipy, ANYfem or ANYpost: - `OPERATIONS` is the closed operation registry; errors are typed (`CapsuleValidationError`, `ReconstructionError`, `DerivationError`). -The only runtime dependency is NumPy. The full ANYsolver distribution +The only runtime dependency is NumPy. The full ANYfeSolver distribution delegates its shared beam/shell/principal formulas to this package and -depends on it as `ANYsolver-results>=2,<3`; this standalone wheel -carries no ANYsolver payload. +depends on it as `ANYfeSolver-results>=2,<3`; this standalone wheel +carries no ANYfeSolver payload. -The capsule format and exporter are documented in the ANYsolver +The capsule format and exporter are documented in the ANYfeSolver repository (`docs/RESULT_CAPSULE.md`). Public reconstruction/preparation defaults retain `combination='legacy_blas/1'`. diff --git a/packages/results/pyproject.toml b/packages/results/pyproject.toml index e094949a5..84bae436a 100644 --- a/packages/results/pyproject.toml +++ b/packages/results/pyproject.toml @@ -1,11 +1,11 @@ [build-system] -requires = ["setuptools>=68", "wheel"] +requires = ["setuptools>=77", "wheel"] build-backend = "setuptools.build_meta" [project] -name = "anysolver-results" -version = "2.1.1" -description = "NumPy-only offline runtime for ANYsolver recovery capsules" +name = "ANYfeSolver-results" +version = "2.2.0" +description = "NumPy-only offline runtime for ANYfeSolver recovery capsules" readme = "README.md" requires-python = ">=3.11" license = "MPL-2.0" @@ -24,12 +24,13 @@ dependencies = [ ] [project.urls] -Homepage = "https://github.com/audunarn/ANYsolver" -Repository = "https://github.com/audunarn/ANYsolver" +Homepage = "https://github.com/audunarn/ANYfeSolver" +Repository = "https://github.com/audunarn/ANYfeSolver" +Issues = "https://github.com/audunarn/ANYfeSolver/issues" [tool.setuptools] -package-dir = { "" = "../../src" } +package-dir = { "" = "src" } [tool.setuptools.packages.find] -where = ["../../src"] -include = ["anysolver_results*"] +where = ["src"] +include = ["anyfesolver_results", "anyfesolver_results.*"] diff --git a/src/anysolver_results/__init__.py b/packages/results/src/anyfesolver_results/__init__.py similarity index 84% rename from src/anysolver_results/__init__.py rename to packages/results/src/anyfesolver_results/__init__.py index db439e933..f27e07a81 100644 --- a/src/anysolver_results/__init__.py +++ b/packages/results/src/anyfesolver_results/__init__.py @@ -1,8 +1,8 @@ -"""NumPy-only runtime for ANYsolver recovery capsules (contracts v1 and v2). +"""NumPy-only runtime for ANYfeSolver recovery capsules (contracts v1 and v2). -This package reconstructs ANYsolver response fields offline. It is plain +This package reconstructs ANYfeSolver response fields offline. It is plain data in, arrays out: no executable or pickle payloads, and no imports from -``anysolver``, scipy, ANYfem or ANYpost. ANYpost resolves dependencies and +``anyfesolver``, scipy, ANYfem or ANYpost. ANYpost resolves dependencies and calls this runtime; the closed derived-operation registry and the physics live here. """ diff --git a/src/anysolver_results/capsule.py b/packages/results/src/anyfesolver_results/capsule.py similarity index 100% rename from src/anysolver_results/capsule.py rename to packages/results/src/anyfesolver_results/capsule.py diff --git a/src/anysolver_results/errors.py b/packages/results/src/anyfesolver_results/errors.py similarity index 75% rename from src/anysolver_results/errors.py rename to packages/results/src/anyfesolver_results/errors.py index 015aa817a..88c8e8b08 100644 --- a/src/anysolver_results/errors.py +++ b/packages/results/src/anyfesolver_results/errors.py @@ -1,9 +1,9 @@ -"""Typed runtime errors for the anysolver-results capsule runtime.""" +"""Typed runtime errors for the anyfesolver-results capsule runtime.""" from __future__ import annotations class CapsuleError(Exception): - """Base class of every anysolver-results runtime error.""" + """Base class of every anyfesolver-results runtime error.""" class CapsuleValidationError(CapsuleError): diff --git a/src/anysolver_results/formulas.py b/packages/results/src/anyfesolver_results/formulas.py similarity index 95% rename from src/anysolver_results/formulas.py rename to packages/results/src/anyfesolver_results/formulas.py index 7aad5d3ee..2aaaa3042 100644 --- a/src/anysolver_results/formulas.py +++ b/packages/results/src/anyfesolver_results/formulas.py @@ -1,12 +1,12 @@ -"""Shared derived-measure formulas for ANYsolver recovery capsules. +"""Shared derived-measure formulas for ANYfeSolver recovery capsules. This module is the single source of the derived stress measures that -ANYsolver's prepared response routes export and that the offline -``anysolver_results`` runtime recomputes. The solver delegates to these +ANYfeSolver's prepared response routes export and that the offline +``anyfesolver_results`` runtime recomputes. The solver delegates to these functions; the runtime imports them directly, so capsule reconstruction and in-solver recovery share one formula set. -NumPy only: this package must not import ``anysolver``, scipy or any sibling +NumPy only: this package must not import ``anyfesolver``, scipy or any sibling application package. """ from __future__ import annotations @@ -99,7 +99,7 @@ def principal_stresses(tensor: Any, *, workers: int = 1, execution=None) -> np.n from concurrent.futures import ThreadPoolExecutor flat = symmetric.reshape(rows, 3, 3) midpoint = rows // 2 - with ThreadPoolExecutor(max_workers=2, thread_name_prefix='anysolver-principal') as pool: + with ThreadPoolExecutor(max_workers=2, thread_name_prefix='anyfesolver-principal') as pool: parts = tuple(pool.map(np.linalg.eigvalsh, (flat[:midpoint], flat[midpoint:]))) eigenvalues = np.concatenate(parts, axis=0).reshape(symmetric.shape[:-1]) if not np.all(np.isfinite(eigenvalues)): diff --git a/src/anysolver_results/principals.py b/packages/results/src/anyfesolver_results/principals.py similarity index 100% rename from src/anysolver_results/principals.py rename to packages/results/src/anyfesolver_results/principals.py diff --git a/src/anysolver_results/registry.py b/packages/results/src/anyfesolver_results/registry.py similarity index 98% rename from src/anysolver_results/registry.py rename to packages/results/src/anyfesolver_results/registry.py index 05c12d620..d81ec3f89 100644 --- a/src/anysolver_results/registry.py +++ b/packages/results/src/anyfesolver_results/registry.py @@ -1,4 +1,4 @@ -"""Closed derived-operation registry owned by the anysolver-results runtime. +"""Closed derived-operation registry owned by the anyfesolver-results runtime. ANYpost resolves dependencies and calls :func:`derive_field`; the physics and the complete set of admitted operations live here. No operation may be added diff --git a/src/anysolver_results/storage_validation.py b/packages/results/src/anyfesolver_results/storage_validation.py similarity index 100% rename from src/anysolver_results/storage_validation.py rename to packages/results/src/anyfesolver_results/storage_validation.py diff --git a/pyproject.toml b/pyproject.toml index fe8925519..7ca7d558c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,10 @@ [build-system] -requires = ["setuptools>=68", "wheel"] +requires = ["setuptools>=77", "wheel"] build-backend = "setuptools.build_meta" [project] -name = "ANYsolver" -version = "0.4.7" +name = "ANYfeSolver" +version = "0.5.0" description = "Qualified beam and shell finite-element solver" readme = "README.md" requires-python = ">=3.11" @@ -30,7 +30,7 @@ dependencies = [ "ANYmaterial>=0.2,<0.3", "ANYmesher>=0.4,<0.6", "ANYfileio>=0.3.2,<0.4", - "ANYsolver-results>=2.1,<3", + "ANYfeSolver-results>=2.2,<3", ] [project.optional-dependencies] @@ -49,24 +49,26 @@ dev = [ ] [project.urls] -Homepage = "https://github.com/audunarn/ANYsolver" -Repository = "https://github.com/audunarn/ANYsolver" -Issues = "https://github.com/audunarn/ANYsolver/issues" +Homepage = "https://github.com/audunarn/ANYfeSolver" +Repository = "https://github.com/audunarn/ANYfeSolver" +Issues = "https://github.com/audunarn/ANYfeSolver/issues" [tool.setuptools] package-dir = { "" = "src" } [tool.setuptools.packages.find] where = ["src"] -include = ["anysolver", "anysolver.*"] +include = ["anyfesolver", "anyfesolver.*"] [tool.setuptools.package-data] -anysolver = ["_native_guard.cpp"] +anyfesolver = ["_native_guard.cpp"] [tool.pytest.ini_options] testpaths = ["tests"] python_files = ["test_*.py"] -pythonpath = ["src"] +# The results runtime is a separately packaged distribution; its source tree is +# on the path so a checkout test run needs no editable install of either wheel. +pythonpath = ["src", "packages/results/src"] addopts = ["-ra", "-p", "no:cacheprovider"] filterwarnings = [ "ignore:Legacy four-node ShellElement is a temporary rollback path:DeprecationWarning", diff --git a/run_qc.py b/run_qc.py index 1aca4708a..1524cc3d8 100644 --- a/run_qc.py +++ b/run_qc.py @@ -24,8 +24,8 @@ # editable install first. sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "src")) -from anysolver.quality_control import run_quality_control, run_quick_qc, run_full_qc, QCConfig -from anysolver.test_cases import run_all_demo_test_cases, TestCaseRunner +from anyfesolver.quality_control import run_quality_control, run_quick_qc, run_full_qc, QCConfig +from anyfesolver.test_cases import run_all_demo_test_cases, TestCaseRunner def parse_args(): diff --git a/scripts/_b3_e4_f03_coupled_point_work_candidate.py b/scripts/_b3_e4_f03_coupled_point_work_candidate.py index 8968e4ded..15dd5296e 100644 --- a/scripts/_b3_e4_f03_coupled_point_work_candidate.py +++ b/scripts/_b3_e4_f03_coupled_point_work_candidate.py @@ -11,8 +11,8 @@ import numpy as np -from anysolver._ge_beam3_pose_joint import RigidPoseJoint -from anysolver._ge_beam3_retained_generalized_state import Mechanical +from anyfesolver._ge_beam3_pose_joint import RigidPoseJoint +from anyfesolver._ge_beam3_retained_generalized_state import Mechanical from scripts._b3_e4_f03_native_spatial_port import ( NativeHalfCellSpatialPort, NativeNodalSpatialPort) diff --git a/scripts/_b3_e4_f03_e4_trial_panel.py b/scripts/_b3_e4_f03_e4_trial_panel.py index 4fa93f191..2f0da2559 100644 --- a/scripts/_b3_e4_f03_e4_trial_panel.py +++ b/scripts/_b3_e4_f03_e4_trial_panel.py @@ -12,10 +12,10 @@ import numpy as np -from anysolver.corotational import corotational_element_response -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEModel -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.corotational import corotational_element_response +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver._ge_beam3_p5_seeded.core import canonical from scripts._b3_e4_f03_shell_finite_pose_candidate import ( pose_from_e4_total, reference_nodes) diff --git a/scripts/_b3_e4_f03_local_scientific_child_identity.py b/scripts/_b3_e4_f03_local_scientific_child_identity.py index 2c2187aae..aa2421d2a 100644 --- a/scripts/_b3_e4_f03_local_scientific_child_identity.py +++ b/scripts/_b3_e4_f03_local_scientific_child_identity.py @@ -35,24 +35,24 @@ def observed_hardware() -> registration.HardwareIdentity: def observed_package(name: str) -> tuple[str, str]: if name not in registration.PACKAGE_NAMES: raise ValueError("unregistered F03 package name") - import_name = "anysolver" if name == "ANYsolver" else name + import_name = "anyfesolver" if name == "ANYfeSolver" else name spec = importlib.util.find_spec(import_name) if spec is None or not spec.origin: raise ValueError(f"F03 package {name} has no import origin") return importlib.metadata.version(name), str(Path(spec.origin).resolve()) -def candidate_anysolver_origin(repository_root: str) -> Path: +def candidate_anyfesolver_origin(repository_root: str) -> Path: """The source-backed F03 route must import the registered candidate.""" - return Path(repository_root).resolve() / "src" / "anysolver" / "__init__.py" + return Path(repository_root).resolve() / "src" / "anyfesolver" / "__init__.py" -def candidate_anysolver_version(repository_root: str) -> str: +def candidate_anyfesolver_version(repository_root: str) -> str: with (Path(repository_root).resolve() / "pyproject.toml").open("rb") as stream: project = tomllib.load(stream)["project"] version = project["version"] if type(version) is not str or not version: - raise ValueError("F03 candidate ANYsolver version is invalid") + raise ValueError("F03 candidate ANYfeSolver version is invalid") return version @@ -126,10 +126,10 @@ def verify_child_context( version, origin = observed_package(package.name) if version != package.version or Path(origin).resolve() != Path(package.origin).resolve(): raise ValueError(f"F03 child package identity mismatch: {package.name}") - if (package.name == "ANYsolver" - and (Path(origin).resolve() != candidate_anysolver_origin(value.repository_root) - or version != candidate_anysolver_version(value.repository_root))): - raise ValueError("F03 child ANYsolver origin/version disagrees with candidate") + if (package.name == "ANYfeSolver" + and (Path(origin).resolve() != candidate_anyfesolver_origin(value.repository_root) + or version != candidate_anyfesolver_version(value.repository_root))): + raise ValueError("F03 child ANYfeSolver origin/version disagrees with candidate") if observed_hardware() != value.hardware: raise ValueError("F03 child hardware identity mismatch") commit, clean = observed_git(value.repository_root) diff --git a/scripts/_b3_e4_f03_local_scientific_coordinator.py b/scripts/_b3_e4_f03_local_scientific_coordinator.py index 31cfc59b6..b746cc55d 100644 --- a/scripts/_b3_e4_f03_local_scientific_coordinator.py +++ b/scripts/_b3_e4_f03_local_scientific_coordinator.py @@ -118,10 +118,10 @@ def prepare_registration( packages.append(registration.PackageIdentity( name, version, str(path), count, digest, )) - solver_package = next(item for item in packages if item.name == "ANYsolver") - if (solver_package.origin != str(child_identity.candidate_anysolver_origin(str(source))) - or solver_package.version != child_identity.candidate_anysolver_version(str(source))): - raise ValueError("F03 registration requires candidate ANYsolver origin/version") + solver_package = next(item for item in packages if item.name == "ANYfeSolver") + if (solver_package.origin != str(child_identity.candidate_anyfesolver_origin(str(source))) + or solver_package.version != child_identity.candidate_anyfesolver_version(str(source))): + raise ValueError("F03 registration requires candidate ANYfeSolver origin/version") hardware = child_identity.observed_hardware() records = cases.preflight_inventory() run_root.mkdir() @@ -203,12 +203,12 @@ def _preflight( version, origin = child_identity.observed_package(package.name) if version != package.version or Path(origin).resolve() != Path(package.origin).resolve(): raise ValueError(f"F03 coordinator package identity changed: {package.name}") - if (package.name == "ANYsolver" + if (package.name == "ANYfeSolver" and (Path(origin).resolve() - != child_identity.candidate_anysolver_origin(registered.repository_root) - or version != child_identity.candidate_anysolver_version( + != child_identity.candidate_anyfesolver_origin(registered.repository_root) + or version != child_identity.candidate_anyfesolver_version( registered.repository_root))): - raise ValueError("F03 coordinator ANYsolver origin/version disagrees with candidate") + raise ValueError("F03 coordinator ANYfeSolver origin/version disagrees with candidate") if child_identity.observed_hardware() != registered.hardware: raise ValueError("F03 coordinator hardware identity changed") if ( diff --git a/scripts/_b3_e4_f03_local_scientific_registration.py b/scripts/_b3_e4_f03_local_scientific_registration.py index d24d49cd3..3c1bcd018 100644 --- a/scripts/_b3_e4_f03_local_scientific_registration.py +++ b/scripts/_b3_e4_f03_local_scientific_registration.py @@ -51,7 +51,7 @@ ("cases", "scripts/_b3_e4_f03_local_scientific_cases.py"), ("budgets", "scripts/_b3_e4_f03_local_scientific_budgets.py"), ) -PACKAGE_NAMES = ("ANYsolver", "numpy", "psutil", "scipy", "threadpoolctl") +PACKAGE_NAMES = ("ANYfeSolver", "numpy", "psutil", "scipy", "threadpoolctl") TERMINAL_PRECEDENCE = ( "FAILED_EVIDENCE", "FAILED_EXECUTION", diff --git a/scripts/_b3_e4_f03_native_fixture.py b/scripts/_b3_e4_f03_native_fixture.py index 6463487a1..07679baed 100644 --- a/scripts/_b3_e4_f03_native_fixture.py +++ b/scripts/_b3_e4_f03_native_fixture.py @@ -24,17 +24,17 @@ from scipy import sparse from scipy.spatial.transform import Rotation -from anysolver.boundary import BoundaryCondition -from anysolver.fe_core import FEModel -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry -from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection -from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_retained_generalized_state import Context, Program -from anysolver._ge_beam3_fibre_line_work import evaluate as line_work -from anysolver._ge_beam3_generalized_static_boundary import cell_couple_load, spatial_jacobian -from anysolver._ge_beam3_operator_validation_scope import operator_call +from anyfesolver.boundary import BoundaryCondition +from anyfesolver.fe_core import FEModel +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry +from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection +from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_retained_generalized_state import Context, Program +from anyfesolver._ge_beam3_fibre_line_work import evaluate as line_work +from anyfesolver._ge_beam3_generalized_static_boundary import cell_couple_load, spatial_jacobian +from anyfesolver._ge_beam3_operator_validation_scope import operator_call E = 210e9 diff --git a/scripts/_b3_e4_f03_native_spatial_port.py b/scripts/_b3_e4_f03_native_spatial_port.py index 13772b01b..4eea7b396 100644 --- a/scripts/_b3_e4_f03_native_spatial_port.py +++ b/scripts/_b3_e4_f03_native_spatial_port.py @@ -13,8 +13,8 @@ import numpy as np -from anysolver._ge_beam3_retained_generalized_state import Context, Mechanical -from anysolver._ge_beam3_p5.compensated_coordinates import split_sum +from anyfesolver._ge_beam3_retained_generalized_state import Context, Mechanical +from anyfesolver._ge_beam3_p5.compensated_coordinates import split_sum def _skew(vector: np.ndarray) -> np.ndarray: diff --git a/scripts/_b3_e4_f03_shell_chord_pose_candidate.py b/scripts/_b3_e4_f03_shell_chord_pose_candidate.py index d7a16885d..c85dcdc95 100644 --- a/scripts/_b3_e4_f03_shell_chord_pose_candidate.py +++ b/scripts/_b3_e4_f03_shell_chord_pose_candidate.py @@ -10,8 +10,8 @@ import numpy as np -from anysolver import _ge_beam3_mixed_ad as ad -from anysolver.corotational import rotation_matrix_from_vector +from anyfesolver import _ge_beam3_mixed_ad as ad +from anyfesolver.corotational import rotation_matrix_from_vector from scripts._b3_e4_f03_shell_finite_pose_candidate import ( DirectionalPose, reference_nodes, diff --git a/scripts/_b3_e4_f03_shell_finite_pose_candidate.py b/scripts/_b3_e4_f03_shell_finite_pose_candidate.py index c198c0c54..bbc05a2fc 100644 --- a/scripts/_b3_e4_f03_shell_finite_pose_candidate.py +++ b/scripts/_b3_e4_f03_shell_finite_pose_candidate.py @@ -12,8 +12,8 @@ import numpy as np -from anysolver import _ge_beam3_mixed_ad as ad -from anysolver.corotational import rotation_matrix_from_vector +from anyfesolver import _ge_beam3_mixed_ad as ad +from anyfesolver.corotational import rotation_matrix_from_vector from scripts._b3_e4_f03_shell_spatial_linear_port import reference_spatial_trace from scripts._b3_e4_f03_shell_trace import ShellPanel, _SAMPLE_OFFSETS diff --git a/scripts/_b3_e4_f03_shell_spatial_linear_port.py b/scripts/_b3_e4_f03_shell_spatial_linear_port.py index 4286a9d6e..4a8368ee1 100644 --- a/scripts/_b3_e4_f03_shell_spatial_linear_port.py +++ b/scripts/_b3_e4_f03_shell_spatial_linear_port.py @@ -11,8 +11,8 @@ import numpy as np from scipy import sparse -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEMesh, Material +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEMesh, Material from scripts._b3_e4_f03_shell_trace import ShellPanel diff --git a/scripts/_b3_e4_f03_shell_strip_pose_candidate.py b/scripts/_b3_e4_f03_shell_strip_pose_candidate.py index ccae0447e..3a88ef26b 100644 --- a/scripts/_b3_e4_f03_shell_strip_pose_candidate.py +++ b/scripts/_b3_e4_f03_shell_strip_pose_candidate.py @@ -14,7 +14,7 @@ DirectionalPose, directional_pose_from_e4_total, pose_from_e4_total, pose, reference_nodes, ) -from anysolver.corotational import rotation_matrix_from_vector +from anyfesolver.corotational import rotation_matrix_from_vector from scripts._b3_e4_f03_shell_trace import ShellPanel diff --git a/scripts/_b3_e4_f03_shell_trace.py b/scripts/_b3_e4_f03_shell_trace.py index 26088a0bb..b1e74fadd 100644 --- a/scripts/_b3_e4_f03_shell_trace.py +++ b/scripts/_b3_e4_f03_shell_trace.py @@ -13,8 +13,8 @@ import numpy as np from scipy import sparse -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEMesh, Material +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEMesh, Material _HALF_WINDOW = 0.2 diff --git a/scripts/_b3_e4_f03_weak_line_candidate.py b/scripts/_b3_e4_f03_weak_line_candidate.py index db747dbb0..c9d8e79a9 100644 --- a/scripts/_b3_e4_f03_weak_line_candidate.py +++ b/scripts/_b3_e4_f03_weak_line_candidate.py @@ -12,8 +12,8 @@ import numpy as np -from anysolver._ge_beam3_pose_joint import RigidPoseJoint -from anysolver._ge_beam3_retained_generalized_state import Mechanical +from anyfesolver._ge_beam3_pose_joint import RigidPoseJoint +from anyfesolver._ge_beam3_retained_generalized_state import Mechanical from scripts._b3_e4_f03_coupled_point_work_candidate import ( directional_point_work) diff --git a/scripts/adjudicate_b3_ge_e4_pl_g0_f03_shell_port_lift_v1.py b/scripts/adjudicate_b3_ge_e4_pl_g0_f03_shell_port_lift_v1.py index 9d88e1128..4cd328c69 100644 --- a/scripts/adjudicate_b3_ge_e4_pl_g0_f03_shell_port_lift_v1.py +++ b/scripts/adjudicate_b3_ge_e4_pl_g0_f03_shell_port_lift_v1.py @@ -7,8 +7,8 @@ from pathlib import Path -ROOT = Path('C:/Github/ANYsolver/.qualification/b3-ge-e4-pl/f03-shell-port-lift-v1') -PREVIOUS = Path('C:/Github/ANYsolver/.qualification/b3-ge-e4-pl/f03-local-trace-norm-v1') +ROOT = Path('C:/Github/ANYfeSolver/.qualification/b3-ge-e4-pl/f03-shell-port-lift-v1') +PREVIOUS = Path('C:/Github/ANYfeSolver/.qualification/b3-ge-e4-pl/f03-local-trace-norm-v1') FROZEN = '424e9148527e440930dc17662455445f78ccd91f' PREVIOUS_HASHES = { 'manifest.json':'b7a93390ecb2fb3e45a29f8f4ebc5a0f495d58297d09f42591a42252d5c8e71b', @@ -43,7 +43,7 @@ def main(): for name in manifest['source_sha256']) and all(manifest['source_sha256'].get(name) == digest for name,digest in prior['source_sha256'].items()) - and Path(manifest['anysolver_import']).resolve().is_relative_to( + and Path(manifest['anyfesolver_import']).resolve().is_relative_to( (SCRIPTS.parent/'src').resolve())) values = {} for i,(record,case) in enumerate(zip(rows,CASES)): diff --git a/scripts/adjudicate_b3_ge_e4_pl_g0_f03_variational_refinement_v2.py b/scripts/adjudicate_b3_ge_e4_pl_g0_f03_variational_refinement_v2.py index 2da64660f..942ce8acc 100644 --- a/scripts/adjudicate_b3_ge_e4_pl_g0_f03_variational_refinement_v2.py +++ b/scripts/adjudicate_b3_ge_e4_pl_g0_f03_variational_refinement_v2.py @@ -6,7 +6,7 @@ import json from pathlib import Path -ROOT = Path('C:/Github/ANYsolver/.qualification/b3-ge-e4-pl/f03-variational-refinement-v2') +ROOT = Path('C:/Github/ANYfeSolver/.qualification/b3-ge-e4-pl/f03-variational-refinement-v2') FROZEN = '1f123848af8f8c6527d186d4f334040ef33cc2e0' U = 1e6 / (210e9 * .07) PARENT = Path(__file__).resolve().parent @@ -30,7 +30,7 @@ 'preflight.json':'8a6dc936d517a2fb060208d086d51a36c71d3efb93fc6989e2075491e8904d78', 'records.jsonl':'e4925757567209706512f0aeec5ce234871eafdd1b669822b4b049bdf6511204', } -V1_ROOT = Path('C:/Github/ANYsolver/.qualification/b3-ge-e4-pl/f03-variational-line-v1') +V1_ROOT = Path('C:/Github/ANYfeSolver/.qualification/b3-ge-e4-pl/f03-variational-line-v1') def sha(path): diff --git a/scripts/adjudicate_b3_ge_e4_pl_g0_f06_v4.py b/scripts/adjudicate_b3_ge_e4_pl_g0_f06_v4.py index a0de93ed6..cf360a3c9 100644 --- a/scripts/adjudicate_b3_ge_e4_pl_g0_f06_v4.py +++ b/scripts/adjudicate_b3_ge_e4_pl_g0_f06_v4.py @@ -55,27 +55,27 @@ RUNNER_SOURCES = ( REQUIRED_ROLES[0], REQUIRED_ROLES[1], REQUIRED_ROLES[2], "scripts/probe_b3_ge_e4_pl_g0_f06_loaded_rebase_v3.py", - "src/anysolver/_ge_beam3_shell_joint_state.py", - "src/anysolver/_ge_beam3_shell_joint_trial.py", - "src/anysolver/_ge_beam3_g3c_local_shell.py", - "src/anysolver/_ge_beam3_coupled_beam_subdomain.py", - "src/anysolver/_ge_beam3_pose_joint.py", - "src/anysolver/_ge_beam3_retained_generalized.py", - "src/anysolver/_ge_beam3_retained_generalized_state.py", - "src/anysolver/_ge_beam3_retained_generalized_program.py", - "src/anysolver/_ge_beam3_native_generalized_element.py", - "src/anysolver/_ge_beam3_generalized_ellipsoid_section.py", - "src/anysolver/_ge_beam3_generalized_cell.py", - "src/anysolver/_ge_beam3_generalized_static_boundary.py", - "src/anysolver/_ge_beam3_p5/algebra.py", - "src/anysolver/_ge_beam3_p5_seeded/core.py", - "src/anysolver/e4_pl_s3_v2d_element.py", - "src/anysolver/control.py", - "src/anysolver/_native_reference_modal.py", - "src/anysolver/_ge_beam3_native_generalized_loading.py", - "src/anysolver/_ge_beam3_native_line_loading.py", - "src/anysolver/_ge_beam3_centered_reference.py", - "src/anysolver/fe_core.py", + "src/anyfesolver/_ge_beam3_shell_joint_state.py", + "src/anyfesolver/_ge_beam3_shell_joint_trial.py", + "src/anyfesolver/_ge_beam3_g3c_local_shell.py", + "src/anyfesolver/_ge_beam3_coupled_beam_subdomain.py", + "src/anyfesolver/_ge_beam3_pose_joint.py", + "src/anyfesolver/_ge_beam3_retained_generalized.py", + "src/anyfesolver/_ge_beam3_retained_generalized_state.py", + "src/anyfesolver/_ge_beam3_retained_generalized_program.py", + "src/anyfesolver/_ge_beam3_native_generalized_element.py", + "src/anyfesolver/_ge_beam3_generalized_ellipsoid_section.py", + "src/anyfesolver/_ge_beam3_generalized_cell.py", + "src/anyfesolver/_ge_beam3_generalized_static_boundary.py", + "src/anyfesolver/_ge_beam3_p5/algebra.py", + "src/anyfesolver/_ge_beam3_p5_seeded/core.py", + "src/anyfesolver/e4_pl_s3_v2d_element.py", + "src/anyfesolver/control.py", + "src/anyfesolver/_native_reference_modal.py", + "src/anyfesolver/_ge_beam3_native_generalized_loading.py", + "src/anyfesolver/_ge_beam3_native_line_loading.py", + "src/anyfesolver/_ge_beam3_centered_reference.py", + "src/anyfesolver/fe_core.py", ) @@ -217,7 +217,7 @@ def _identity(registration_path, evidence_dir, attestation_path, screen): _require(type(env) is dict and att.get("observed_environment") == env, "ENVIRONMENT_ATTESTATION", "environment differs") _require(set(("python_executable", "python_version", "numpy_version", - "scipy_version", "anysolver_import", "psutil_version", + "scipy_version", "anyfesolver_import", "psutil_version", "threadpoolctl_version", "pywin32_version", "win32job_import", "numba_version", "llvmlite_version", "platform", "numba_cache_dir", diff --git a/scripts/adjudicate_general_contact_d1_affine_pressure_v1.py b/scripts/adjudicate_general_contact_d1_affine_pressure_v1.py index 434d0f2df..20e91a744 100644 --- a/scripts/adjudicate_general_contact_d1_affine_pressure_v1.py +++ b/scripts/adjudicate_general_contact_d1_affine_pressure_v1.py @@ -12,7 +12,7 @@ import scipy import anymaterial -import anysolver +import anyfesolver ROOT = Path(__file__).resolve().parents[1] @@ -26,7 +26,7 @@ def _git_blob(path: str) -> str: def _source_clean() -> bool: - paths = ["src/anysolver", "scripts/general_contact_d1_finite_area_load.py", + paths = ["src/anyfesolver", "scripts/general_contact_d1_finite_area_load.py", "scripts/general_contact_d1_pressure_space_probe.py"] return not subprocess.run( ["git", "status", "--porcelain", "--", *paths], cwd=ROOT, @@ -61,8 +61,8 @@ def adjudicate(contract: dict, result: dict) -> dict: sys.version.split()[0] == environment["python"] and np.__version__ == environment["numpy"] and scipy.__version__ == environment["scipy"] - and Path(anysolver.__file__).resolve().parents[1] - == Path(environment["anysolver_source_root"]).resolve() + and Path(anyfesolver.__file__).resolve().parents[1] + == Path(environment["anyfesolver_source_root"]).resolve() and Path(anymaterial.__file__).resolve().parents[1] == Path(environment["anymaterial_source_root"]).resolve() ) diff --git a/scripts/adjudicate_general_contact_d1_distributed_cycle_response_v1.py b/scripts/adjudicate_general_contact_d1_distributed_cycle_response_v1.py index 31b53c6f0..e30172d58 100644 --- a/scripts/adjudicate_general_contact_d1_distributed_cycle_response_v1.py +++ b/scripts/adjudicate_general_contact_d1_distributed_cycle_response_v1.py @@ -9,7 +9,7 @@ import sys import anymaterial -import anysolver +import anyfesolver import numpy as np import scipy @@ -58,8 +58,8 @@ def check(name: str, condition) -> None: check("python_version", sys.version.split()[0] == environment["python"]) check("numpy_version", np.__version__ == environment["numpy"]) check("scipy_version", scipy.__version__ == environment["scipy"]) - check("solver_import", Path(anysolver.__file__).resolve() - == Path(environment["anysolver_source_root"]) / "anysolver/__init__.py") + check("solver_import", Path(anyfesolver.__file__).resolve() + == Path(environment["anyfesolver_source_root"]) / "anyfesolver/__init__.py") check("material_import", Path(anymaterial.__file__).resolve() == Path(environment["anymaterial_source_root"]) / "anymaterial/__init__.py") @@ -111,8 +111,8 @@ def check(name: str, condition) -> None: and evidence["supported_pressure_mode_cap"] == 50 and evidence["has_checkpoint"] is True) check("runtime_solver_import", Path( - evidence["runtime_identity"]["anysolver_module"] - ).resolve() == Path(anysolver.__file__).resolve()) + evidence["runtime_identity"]["anyfesolver_module"] + ).resolve() == Path(anyfesolver.__file__).resolve()) verdict = { "case_id": registration["case_id"], diff --git a/scripts/adjudicate_general_contact_d1_distributed_restart_identity_v2.py b/scripts/adjudicate_general_contact_d1_distributed_restart_identity_v2.py index 595278abd..725ca0c44 100644 --- a/scripts/adjudicate_general_contact_d1_distributed_restart_identity_v2.py +++ b/scripts/adjudicate_general_contact_d1_distributed_restart_identity_v2.py @@ -57,8 +57,8 @@ def main(registration_path: Path, report_path: Path, output_path: Path) -> None: for key in ("python", "numpy", "scipy") ), "runtime_source_roots": ( - Path(runtime.get("anysolver_module", "")).resolve().parents[1] - == Path(environment["anysolver_source_root"]).resolve() + Path(runtime.get("anyfesolver_module", "")).resolve().parents[1] + == Path(environment["anyfesolver_source_root"]).resolve() and Path(runtime.get("anymaterial_module", "")).resolve().parents[1] == Path(environment["anymaterial_source_root"]).resolve()), "wall_time": _bounded( diff --git a/scripts/adjudicate_general_contact_d1_distributed_restart_identity_v2a.py b/scripts/adjudicate_general_contact_d1_distributed_restart_identity_v2a.py index 58635ea31..362e19d27 100644 --- a/scripts/adjudicate_general_contact_d1_distributed_restart_identity_v2a.py +++ b/scripts/adjudicate_general_contact_d1_distributed_restart_identity_v2a.py @@ -60,8 +60,8 @@ def main(registration_path: Path, report_path: Path, output_path: Path) -> None: for key in ("python", "numpy", "scipy") ), "runtime_source_roots": ( - Path(runtime.get("anysolver_module", "")).resolve().parents[1] - == Path(environment["anysolver_source_root"]).resolve() + Path(runtime.get("anyfesolver_module", "")).resolve().parents[1] + == Path(environment["anyfesolver_source_root"]).resolve() and Path(runtime.get("anymaterial_module", "")).resolve().parents[1] == Path(environment["anymaterial_source_root"]).resolve()), "wall_time": _bounded( diff --git a/scripts/adjudicate_general_contact_d1_mixed_interior_response_v1.py b/scripts/adjudicate_general_contact_d1_mixed_interior_response_v1.py index 1e74a3bbd..f38205871 100644 --- a/scripts/adjudicate_general_contact_d1_mixed_interior_response_v1.py +++ b/scripts/adjudicate_general_contact_d1_mixed_interior_response_v1.py @@ -10,7 +10,7 @@ import numpy as np import scipy -import anysolver +import anyfesolver import anymaterial @@ -59,8 +59,8 @@ def check(name: str, condition) -> None: check("python_version", sys.version.split()[0] == environment["python"]) check("numpy_version", np.__version__ == environment["numpy"]) check("scipy_version", scipy.__version__ == environment["scipy"]) - check("solver_import", Path(anysolver.__file__).resolve() - == Path(environment["anysolver_source_root"]) / "anysolver/__init__.py") + check("solver_import", Path(anyfesolver.__file__).resolve() + == Path(environment["anyfesolver_source_root"]) / "anyfesolver/__init__.py") check("material_import", Path(anymaterial.__file__).resolve() == Path(environment["anymaterial_source_root"]) / "anymaterial/__init__.py") @@ -103,8 +103,8 @@ def check(name: str, condition) -> None: and evidence["supported_pressure_mode_cap"] == 66 and evidence["has_checkpoint"] is True) check("runtime_solver_import", Path( - evidence["runtime_identity"]["anysolver_module"] - ).resolve() == Path(anysolver.__file__).resolve()) + evidence["runtime_identity"]["anyfesolver_module"] + ).resolve() == Path(anyfesolver.__file__).resolve()) if len(evidence["history"]) < 2: verdict = { diff --git a/scripts/adjudicate_nonlinear_representative.py b/scripts/adjudicate_nonlinear_representative.py index b0dd54aa0..d97996c84 100644 --- a/scripts/adjudicate_nonlinear_representative.py +++ b/scripts/adjudicate_nonlinear_representative.py @@ -212,7 +212,7 @@ def adjudicate(raw: Mapping[str, Any], runner: Any) -> dict[str, Any]: and not normalized.get("failures") ) return { - "schema": "anysolver.nonlinear_static.representative_adjudication", + "schema": "anyfesolver.nonlinear_static.representative_adjudication", "version": 1, "created_utc": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()), "source_identity": normalized["identity"], diff --git a/scripts/audit_beam_parity_matrix.py b/scripts/audit_beam_parity_matrix.py index 85aa54574..5dbaa47d6 100644 --- a/scripts/audit_beam_parity_matrix.py +++ b/scripts/audit_beam_parity_matrix.py @@ -36,9 +36,9 @@ 'compute_stresses': ['P19', 'U05'], 'compute_internal_forces': ['U07'], 'to_dict': ['P18', 'U09'], } -EXTRA = ['src/anysolver/ge_beam3_element.py', 'src/anysolver/ge_beam3_native.py', - 'src/anysolver/_ge_beam3_native_analysis.py', - 'src/anysolver/_ge_beam3_durable_coupled.py', +EXTRA = ['src/anyfesolver/ge_beam3_element.py', 'src/anyfesolver/ge_beam3_native.py', + 'src/anyfesolver/_ge_beam3_native_analysis.py', + 'src/anyfesolver/_ge_beam3_durable_coupled.py', 'docs/GE_BEAM3_NATIVE_WORKFLOWS.md', 'docs/GE_BEAM3_DELIVERY_STATUS.md', 'docs/reference_cases/ge_beam3_final_delivery_independent_review.json'] @@ -125,7 +125,7 @@ def build_inventory(data): for ref in refs: if ref.startswith(path+'::') and ref.split('::')[1] not in definitions(raw): raise ValueError('missing test definition: '+ref) - elements = ast.parse(git('show', BASE+':src/anysolver/elements.py')) + elements = ast.parse(git('show', BASE+':src/anyfesolver/elements.py')) public = {} for node in elements.body: if isinstance(node, ast.ClassDef) and node.name in {'Element', 'BeamElement', 'QuadraticBeamElement'}: @@ -151,7 +151,7 @@ def build_inventory(data): def render(data, inventory): lines = ['# GE-B3 legacy parity matrix — frozen step 1', '', - 'Baseline: ANYsolver 0.4.3, commit `'+BASE+'`, tree `'+TREE+'`.', '', + 'Baseline: ANYfeSolver 0.4.3, commit `'+BASE+'`, tree `'+TREE+'`.', '', 'Status: **planning inventory frozen; no new mechanics qualification**. ' 'This step changes no runtime, default, dependency, source equation or historical evidence. ' 'No scientific test was executed. Test links identify source definitions, not fresh passes.', '', diff --git a/scripts/audit_ge_beam3_g3_contract.py b/scripts/audit_ge_beam3_g3_contract.py index fce84fb2f..4cd25a2c7 100644 --- a/scripts/audit_ge_beam3_g3_contract.py +++ b/scripts/audit_ge_beam3_g3_contract.py @@ -27,20 +27,20 @@ "docs/reference_cases/ge_beam3_g2_implementation_review_v2.json", "docs/reference_cases/ge_beam3_g2_confirmation_review_v1.json", "docs/reference_cases/ge_beam3_g2_confirmation_aggregate_v1.json", - "src/anysolver/_ge_beam3_g1_analysis.py", - "src/anysolver/_ge_beam3_g1_element.py", - "src/anysolver/_ge_beam3_g1_operator.py", - "src/anysolver/_ge_beam3_g2_analysis.py", - "src/anysolver/_ge_beam3_g2_constraints.py", - "src/anysolver/_ge_beam3_pose_joint.py", - "src/anysolver/_ge_beam3_shell_joint_trial.py", - "src/anysolver/_ge_beam3_shell_joint_state.py", - "src/anysolver/elements.py", - "src/anysolver/e4_pl_element.py", - "src/anysolver/e4_pl_s3_v2d_element.py", - "src/anysolver/assembly.py", - "src/anysolver/constraint_audit.py", - "src/anysolver/nonlinear_state.py", + "src/anyfesolver/_ge_beam3_g1_analysis.py", + "src/anyfesolver/_ge_beam3_g1_element.py", + "src/anyfesolver/_ge_beam3_g1_operator.py", + "src/anyfesolver/_ge_beam3_g2_analysis.py", + "src/anyfesolver/_ge_beam3_g2_constraints.py", + "src/anyfesolver/_ge_beam3_pose_joint.py", + "src/anyfesolver/_ge_beam3_shell_joint_trial.py", + "src/anyfesolver/_ge_beam3_shell_joint_state.py", + "src/anyfesolver/elements.py", + "src/anyfesolver/e4_pl_element.py", + "src/anyfesolver/e4_pl_s3_v2d_element.py", + "src/anyfesolver/assembly.py", + "src/anyfesolver/constraint_audit.py", + "src/anyfesolver/nonlinear_state.py", "tests/test_ge_beam3_g1_elastic.py", "tests/test_ge_beam3_g2_constraints.py", "tests/test_ge_beam3_g2_corrections.py", diff --git a/scripts/audit_ge_beam3_g3c_contract.py b/scripts/audit_ge_beam3_g3c_contract.py index c7c7de539..944a1dd6c 100644 --- a/scripts/audit_ge_beam3_g3c_contract.py +++ b/scripts/audit_ge_beam3_g3c_contract.py @@ -15,7 +15,7 @@ EXTENT=('docs/GE_BEAM3_G3_COMPLETION_PLAN.md', CONTRACT, FIXTURES, 'scripts/audit_ge_beam3_g3c_contract.py','tests/test_ge_beam3_g3c_contract.py') FAMILIES=('B2','B3','Q4','S3') -SOURCE_PATHS=["docs/GE_BEAM3_GENERAL_STATIC_INTEGRATION_CONTRACT.md","docs/GE_BEAM3_G3_GRAPH_JUNCTION_CONTRACT.md","docs/reference_cases/ge_beam3_g3_graph_fixtures_v1.json","docs/reference_cases/ge_beam3_g3a_confirmation_v1.json","docs/reference_cases/ge_beam3_g3a_confirmation_review_v1.json","docs/reference_cases/ge_beam3_g3b_confirmation_v1.json","docs/reference_cases/ge_beam3_g3b_confirmation_review_v1.json","src/anysolver/_ge_beam3_g1_elastic.py","src/anysolver/_ge_beam3_g1_element.py","src/anysolver/_ge_beam3_g1_operator.py","src/anysolver/_ge_beam3_g3_analysis.py","src/anysolver/_ge_beam3_g3_constraints.py","src/anysolver/_ge_beam3_g3b_owner.py","src/anysolver/_ge_beam3_g3b_result_schema.py","src/anysolver/_ge_beam3_pose_joint.py","src/anysolver/_ge_beam3_shell_joint_trial.py","src/anysolver/_ge_beam3_shell_joint_state.py","src/anysolver/_ge_beam3_variational_shell.py","src/anysolver/_ge_beam3_mixed_ad.py","src/anysolver/corotational.py","src/anysolver/elements.py","src/anysolver/e4_pl_element.py","src/anysolver/e4_pl_s3_v2d_element.py","src/anysolver/nonlinear_state.py","docs/agent_plans/GE_BEAM3_VARIATIONAL_SHELL_MAP.md","tests/test_ge_beam3_pose_joint.py","tests/test_ge_beam3_shell_joint_trial.py","tests/test_ge_beam3_shell_joint_state.py","docs/reference_cases/e4_pl_s3_v2_bounded_process.py"] +SOURCE_PATHS=["docs/GE_BEAM3_GENERAL_STATIC_INTEGRATION_CONTRACT.md","docs/GE_BEAM3_G3_GRAPH_JUNCTION_CONTRACT.md","docs/reference_cases/ge_beam3_g3_graph_fixtures_v1.json","docs/reference_cases/ge_beam3_g3a_confirmation_v1.json","docs/reference_cases/ge_beam3_g3a_confirmation_review_v1.json","docs/reference_cases/ge_beam3_g3b_confirmation_v1.json","docs/reference_cases/ge_beam3_g3b_confirmation_review_v1.json","src/anyfesolver/_ge_beam3_g1_elastic.py","src/anyfesolver/_ge_beam3_g1_element.py","src/anyfesolver/_ge_beam3_g1_operator.py","src/anyfesolver/_ge_beam3_g3_analysis.py","src/anyfesolver/_ge_beam3_g3_constraints.py","src/anyfesolver/_ge_beam3_g3b_owner.py","src/anyfesolver/_ge_beam3_g3b_result_schema.py","src/anyfesolver/_ge_beam3_pose_joint.py","src/anyfesolver/_ge_beam3_shell_joint_trial.py","src/anyfesolver/_ge_beam3_shell_joint_state.py","src/anyfesolver/_ge_beam3_variational_shell.py","src/anyfesolver/_ge_beam3_mixed_ad.py","src/anyfesolver/corotational.py","src/anyfesolver/elements.py","src/anyfesolver/e4_pl_element.py","src/anyfesolver/e4_pl_s3_v2d_element.py","src/anyfesolver/nonlinear_state.py","docs/agent_plans/GE_BEAM3_VARIATIONAL_SHELL_MAP.md","tests/test_ge_beam3_pose_joint.py","tests/test_ge_beam3_shell_joint_trial.py","tests/test_ge_beam3_shell_joint_state.py","docs/reference_cases/e4_pl_s3_v2_bounded_process.py"] REQUIRED_CHECKS=["INHERITED_ROUTE_ADMISSIBILITY","EXPLICIT_POSE_AND_MATERIAL_FRAMES","ANALYTIC_CHART_FIRST_SECOND_DERIVATIVES","COMMON_RIGID_MOTION_AND_REBASE","JOINT_WORK_ACTION_REACTION","REAL_FINITE_FAMILY_RESPONSE","NATIVE_FULL_STATIONARY_SCHUR","PHYSICAL_RECOVERY","CONSERVATIVE_SYMMETRY_WHERE_APPLICABLE","ALL_DIRECTIONAL_STEPS","ALL_FIVE_GRAPHS_AND_VARIANTS","NONCOMMUTING_ROOTS_AND_LOAD_HISTORY","ATOMIC_PREPARE_ALL_COMMIT","ROLLBACK_CANCELLATION_AND_TOKEN_REJECTION","CACHE_AND_DEFINITION_IDENTITY","AUTHENTICATED_PREFIX_REPLAY","RESOURCE_BOUNDS_AND_FAILURES","TWO_DETERMINISTIC_FORMAL_CYCLES","INDEPENDENT_IMPLEMENTATION_AND_EVIDENCE_REVIEW"] DEFINITIONS={"legacy":{"E":100,"Iy":0.2,"Iz":0.3,"J":0.1,"area":1,"fiber_plasticity":False,"generalized_section":False,"nu":0.25,"orientation":[0,0,1],"shear_factor_y":0.8,"shear_factor_z":0.7,"geometric_nonlinearity":"von_karman","wrapper":"corotational.corotational_element_response","tangent_mode":"consistent"},"native":{"E":100,"G":40,"Iy":0.2,"Iz":0.3,"J":0.1,"area":1,"shear_y":0.8,"shear_z":0.7},"shell":{"E":100,"generalized_section":False,"layers":3,"nu":0.25,"reference_normal":[0,0,1],"thickness":0.1,"yield_stress":0}} PROGRAMS={"common_rotation_vectors":[[0,0,0],[0.4,-0.3,0.2],[3.141592653589793,0,0],[0,4.39822971502571,0]],"directional_steps":[0.0001,0.00001,0.000001],"force":[0.1,0.2,-0.3],"force_scales":[0.01,1,10],"joint_multipliers":[0.3,-0.2,0.4,-0.1,0.25,-0.15],"load_factors":[0,0.5,1,0.25,0],"root_increment_vectors":[[0.12,0,0],[0,-0.09,0.04]]} diff --git a/scripts/audit_ge_beam3_g3c_matrix_shell.py b/scripts/audit_ge_beam3_g3c_matrix_shell.py index 8c3d94691..302f27c81 100644 --- a/scripts/audit_ge_beam3_g3c_matrix_shell.py +++ b/scripts/audit_ge_beam3_g3c_matrix_shell.py @@ -22,14 +22,14 @@ 'docs/reference_cases/ge_beam3_g3c_fixtures_v1.json', 'docs/GE_BEAM3_G3C_MATRIX_POSE_SHELL_ASSESSMENT.md', 'docs/reference_cases/ge_beam3_g3c_finite_local_review_v1.json', - 'src/anysolver/_ge_beam3_variational_shell.py', - 'src/anysolver/_ge_beam3_mixed_ad.py', - 'src/anysolver/_ge_beam3_pose_joint.py', - 'src/anysolver/elements.py', 'src/anysolver/e4_pl_element.py', - 'src/anysolver/e4_pl_s3_v2c_element.py', - 'src/anysolver/e4_pl_s3_v2d_element.py', - 'src/anysolver/e4_pl_s3_state.py', 'src/anysolver/e4_pl_s3_v2d_state.py', - 'src/anysolver/nonlinear_state.py', 'src/anysolver/fe_core.py', + 'src/anyfesolver/_ge_beam3_variational_shell.py', + 'src/anyfesolver/_ge_beam3_mixed_ad.py', + 'src/anyfesolver/_ge_beam3_pose_joint.py', + 'src/anyfesolver/elements.py', 'src/anyfesolver/e4_pl_element.py', + 'src/anyfesolver/e4_pl_s3_v2c_element.py', + 'src/anyfesolver/e4_pl_s3_v2d_element.py', + 'src/anyfesolver/e4_pl_s3_state.py', 'src/anyfesolver/e4_pl_s3_v2d_state.py', + 'src/anyfesolver/nonlinear_state.py', 'src/anyfesolver/fe_core.py', 'docs/reference_cases/e4_pl_s3_v2_bounded_process.py', 'scripts/ge_beam3_g3b_environment.py'] LIMITS = dict(child_seconds=600, wave_seconds=1800, inactivity_seconds=120, diff --git a/scripts/audit_ge_beam3_g3c_mixed_owner.py b/scripts/audit_ge_beam3_g3c_mixed_owner.py index 7d723d950..469d07705 100644 --- a/scripts/audit_ge_beam3_g3c_mixed_owner.py +++ b/scripts/audit_ge_beam3_g3c_mixed_owner.py @@ -22,22 +22,22 @@ 'docs/reference_cases/ge_beam3_g3c_matrix_shell_equation_review_v1.json', 'docs/reference_cases/ge_beam3_g3c_local_shell_implementation_review_v1.json', 'docs/GE_BEAM3_G3C_LOCAL_SHELL_ACCEPTANCE.md', - 'src/anysolver/_ge_beam3_g3c_local_beam.py', - 'src/anysolver/_ge_beam3_g3c_recovery.py', - 'src/anysolver/_ge_beam3_g3c_local_shell.py', - 'src/anysolver/_ge_beam3_g1_element.py', - 'src/anysolver/_ge_beam3_g1_operator.py', - 'src/anysolver/_ge_beam3_g1_elastic.py', - 'src/anysolver/_ge_beam3_g1_analysis.py', - 'src/anysolver/_ge_beam3_g3_analysis.py', - 'src/anysolver/_ge_beam3_g3_constraints.py', - 'src/anysolver/_ge_beam3_generalized_static_boundary.py', - 'src/anysolver/_ge_beam3_pose_joint.py', - 'src/anysolver/_native_material_protocol.py', - 'src/anysolver/_native_rotation_state.py', - 'src/anysolver/nonlinear_state.py', - 'src/anysolver/elements.py', 'src/anysolver/e4_pl_element.py', - 'src/anysolver/e4_pl_s3_v2d_element.py', + 'src/anyfesolver/_ge_beam3_g3c_local_beam.py', + 'src/anyfesolver/_ge_beam3_g3c_recovery.py', + 'src/anyfesolver/_ge_beam3_g3c_local_shell.py', + 'src/anyfesolver/_ge_beam3_g1_element.py', + 'src/anyfesolver/_ge_beam3_g1_operator.py', + 'src/anyfesolver/_ge_beam3_g1_elastic.py', + 'src/anyfesolver/_ge_beam3_g1_analysis.py', + 'src/anyfesolver/_ge_beam3_g3_analysis.py', + 'src/anyfesolver/_ge_beam3_g3_constraints.py', + 'src/anyfesolver/_ge_beam3_generalized_static_boundary.py', + 'src/anyfesolver/_ge_beam3_pose_joint.py', + 'src/anyfesolver/_native_material_protocol.py', + 'src/anyfesolver/_native_rotation_state.py', + 'src/anyfesolver/nonlinear_state.py', + 'src/anyfesolver/elements.py', 'src/anyfesolver/e4_pl_element.py', + 'src/anyfesolver/e4_pl_s3_v2d_element.py', 'docs/reference_cases/e4_pl_s3_v2_bounded_process.py', 'scripts/ge_beam3_g3b_environment.py'] ENVIRONMENT = '2ce154b866565e1d03019651b1ae7fdd070e5554f38d72adf21d8080558b6756' diff --git a/scripts/audit_ge_beam3_g3c_mo16_obstruction.py b/scripts/audit_ge_beam3_g3c_mo16_obstruction.py index 7256c577b..1c521bec1 100644 --- a/scripts/audit_ge_beam3_g3c_mo16_obstruction.py +++ b/scripts/audit_ge_beam3_g3c_mo16_obstruction.py @@ -7,8 +7,8 @@ ROOT = Path(__file__).resolve().parents[1] BINDINGS = { - 'src/anysolver/elements.py': 'f8c59792947a3c9b84416c61a4d9db98e42926d1bf21e74e736afbf6a9a88b37', - 'src/anysolver/_ge_beam3_g3c_recovery.py': 'a2100556f3ed682d6880b0387d5f7c2131ac6a869aa2d8b60a2844fa22d6691a', + 'src/anyfesolver/elements.py': 'f8c59792947a3c9b84416c61a4d9db98e42926d1bf21e74e736afbf6a9a88b37', + 'src/anyfesolver/_ge_beam3_g3c_recovery.py': 'a2100556f3ed682d6880b0387d5f7c2131ac6a869aa2d8b60a2844fa22d6691a', 'docs/GE_BEAM3_G3C_LOCAL_RECOVERY_EQUATIONS.md': '0f81a43804b4874402d7ff09dc158de95888bc4f7e3c734e76548688f7235e67', 'docs/GE_BEAM3_G3C_MATRIX_SHELL_CONTRACT.md': '59a09dc7db6256a145520ae7b4f2d325dee1abca5d5b5c381a7ada57a2ad92fd', } @@ -96,7 +96,7 @@ def witness(source, area=F('1e-14'), axis='v'): def audit(): bound = sources() - source = bound['src/anysolver/elements.py'] + source = bound['src/anyfesolver/elements.py'] clamped = [witness(source, axis=axis) for axis in ('v', 'w')] controls = [witness(source, area=area, axis=axis) for area in (F('2e-12'), F('1e-10')) for axis in ('v', 'w')] diff --git a/scripts/audit_ge_beam3_g3c_objective_frame.py b/scripts/audit_ge_beam3_g3c_objective_frame.py index c0fe25035..563c4c9c4 100644 --- a/scripts/audit_ge_beam3_g3c_objective_frame.py +++ b/scripts/audit_ge_beam3_g3c_objective_frame.py @@ -18,8 +18,8 @@ 'docs/GE_BEAM3_G3_COMPLETION_PLAN.md', 'docs/reference_cases/ge_beam3_g3c_contract_v1.json', 'docs/reference_cases/ge_beam3_g3c_fixtures_v1.json', - 'src/anysolver/elements.py','src/anysolver/corotational.py', - 'src/anysolver/_ge_beam3_mixed_ad.py','src/anysolver/_ge_beam3_pose_joint.py'] + 'src/anyfesolver/elements.py','src/anyfesolver/corotational.py', + 'src/anyfesolver/_ge_beam3_mixed_ad.py','src/anyfesolver/_ge_beam3_pose_joint.py'] ANCHORS=[['J_B2_PAIR',11,101],['J_B3_PAIR',11,102], ['J_MULTIFAMILY_LOOP',11,101],['J_MULTIFAMILY_LOOP',12,202]] LIMITS=dict(child_seconds=600,wave_seconds=1800,inactivity_seconds=120, diff --git a/scripts/audit_ge_beam3_static_contract.py b/scripts/audit_ge_beam3_static_contract.py index 436276155..ffd1e9206 100644 --- a/scripts/audit_ge_beam3_static_contract.py +++ b/scripts/audit_ge_beam3_static_contract.py @@ -2,7 +2,7 @@ --render emits the proposed binding to stdout; it never creates authority files. --check checks the canonical binding, source identities and planning-only extent. -Neither mode imports ANYsolver or executes mechanics. +Neither mode imports ANYfeSolver or executes mechanics. """ import argparse @@ -29,18 +29,18 @@ "docs/reference_cases/ge_beam3_legacy_parity_inventory_v1.json", "docs/GE_BEAM3_NATIVE_WORKFLOWS.md", "docs/GE_BEAM3_DELIVERY_STATUS.md", - "src/anysolver/elements.py", - "src/anysolver/assembly.py", - "src/anysolver/constraint_audit.py", - "src/anysolver/beam_sections.py", - "src/anysolver/_native_rotation_state.py", - "src/anysolver/_native_material_protocol.py", - "src/anysolver/_ge_beam3_native_definition.py", - "src/anysolver/_ge_beam3_native_analysis.py", - "src/anysolver/_ge_beam3_native_generalized_element.py", - "src/anysolver/_ge_beam3_native_fibre_static_element.py", - "src/anysolver/_ge_beam3_native_generalized_restart.py", - "src/anysolver/_ge_beam3_native_fibre_restart.py", + "src/anyfesolver/elements.py", + "src/anyfesolver/assembly.py", + "src/anyfesolver/constraint_audit.py", + "src/anyfesolver/beam_sections.py", + "src/anyfesolver/_native_rotation_state.py", + "src/anyfesolver/_native_material_protocol.py", + "src/anyfesolver/_ge_beam3_native_definition.py", + "src/anyfesolver/_ge_beam3_native_analysis.py", + "src/anyfesolver/_ge_beam3_native_generalized_element.py", + "src/anyfesolver/_ge_beam3_native_fibre_static_element.py", + "src/anyfesolver/_ge_beam3_native_generalized_restart.py", + "src/anyfesolver/_ge_beam3_native_fibre_restart.py", "scripts/release_043_runtime.json", ) diff --git a/scripts/b2_e01_finite_point_native.py b/scripts/b2_e01_finite_point_native.py index 49eae24e5..643850399 100644 --- a/scripts/b2_e01_finite_point_native.py +++ b/scripts/b2_e01_finite_point_native.py @@ -17,7 +17,7 @@ from scipy import sparse import numba import threadpoolctl -from anysolver import stiffened_shell +from anyfesolver import stiffened_shell import b2_e01_opensees_finite_point as reference diff --git a/scripts/b2_e01_opensees_finite_point.py b/scripts/b2_e01_opensees_finite_point.py index 68018df28..01e567cf2 100644 --- a/scripts/b2_e01_opensees_finite_point.py +++ b/scripts/b2_e01_opensees_finite_point.py @@ -1,7 +1,7 @@ """Fixed E01 diagnostic: physical finite-vertex B2 point law in OpenSees. Run only after the caller freezes this source, runtime and inputs. Requires the -verified Python 3.12/OpenSees 3.8 runtime. No ANYsolver or NumPy dependency. +verified Python 3.12/OpenSees 3.8 runtime. No ANYfeSolver or NumPy dependency. Run exactly one named case per fresh process; repeated-domain execution failed in the retained diagnostic despite a successful identical fresh-process case. This is a reference-linear, scalar elastic, two-Q4/two-B2 comparison, not GE diff --git a/scripts/b2_f09_canonical_energy_admission_dev.py b/scripts/b2_f09_canonical_energy_admission_dev.py index 9799bc7c0..31010ddb8 100644 --- a/scripts/b2_f09_canonical_energy_admission_dev.py +++ b/scripts/b2_f09_canonical_energy_admission_dev.py @@ -25,7 +25,7 @@ import psutil from threadpoolctl import threadpool_info, threadpool_limits -from anysolver._b2_physical_flexibility_linear import ( +from anyfesolver._b2_physical_flexibility_linear import ( LinearSection, RepresentabilityError, ) @@ -34,7 +34,7 @@ PREDECESSOR = (ROOT / "docs" / "agent_plans" / "B3_GE_E4_PL_G0_F09_LOCAL_ENERGY_ADMISSION_DEV_V1.json") V1_PATH = ROOT / "scripts" / "b2_f09_local_energy_admission_dev.py" -SOURCE = ROOT / "src" / "anysolver" / "_b2_physical_flexibility_linear.py" +SOURCE = ROOT / "src" / "anyfesolver" / "_b2_physical_flexibility_linear.py" OUTPUT = (ROOT / "docs" / "agent_plans" / "B3_GE_E4_PL_G0_F09_CANONICAL_ENERGY_ADMISSION_DEV_V1.json") V1 = runpy.run_path(str(V1_PATH)) diff --git a/scripts/b2_f09_local_energy_admission_dev.py b/scripts/b2_f09_local_energy_admission_dev.py index 4d8972130..7f6360e3e 100644 --- a/scripts/b2_f09_local_energy_admission_dev.py +++ b/scripts/b2_f09_local_energy_admission_dev.py @@ -31,7 +31,7 @@ import psutil from threadpoolctl import threadpool_info, threadpool_limits -from anysolver._b2_physical_flexibility_linear import ( +from anyfesolver._b2_physical_flexibility_linear import ( ConditioningAdmissionError, LinearOperator, LinearSection, RepresentabilityError, ) @@ -40,7 +40,7 @@ ROOT = Path(__file__).resolve().parents[1] OUTPUT = (ROOT / "docs" / "agent_plans" / "B3_GE_E4_PL_G0_F09_LOCAL_ENERGY_ADMISSION_DEV_V1.json") -SOURCE = ROOT / "src" / "anysolver" / "_b2_physical_flexibility_linear.py" +SOURCE = ROOT / "src" / "anyfesolver" / "_b2_physical_flexibility_linear.py" EPSILON = F(1, 10**8) UNIT = F(1000) SECONDS_LIMIT = 120. diff --git a/scripts/b2_f09_physical_homothety_state_dev.py b/scripts/b2_f09_physical_homothety_state_dev.py index 291043461..6da5caacc 100644 --- a/scripts/b2_f09_physical_homothety_state_dev.py +++ b/scripts/b2_f09_physical_homothety_state_dev.py @@ -59,12 +59,12 @@ def _source_graph(): Path(__file__).resolve(), THIN_PATH, PROBE_PATH, - ROOT / "src" / "anysolver" / "_b2_physical_flexibility_linear.py", - ROOT / "src" / "anysolver" / "_b2_physical_linear_definition.py", - ROOT / "src" / "anysolver" / "_b2_physical_linear_batch_dev.py", - ROOT / "src" / "anysolver" / "control.py", - ROOT / "src" / "anysolver" / "linalg.py", - ROOT / "src" / "anysolver" / "threading_policy.py", + ROOT / "src" / "anyfesolver" / "_b2_physical_flexibility_linear.py", + ROOT / "src" / "anyfesolver" / "_b2_physical_linear_definition.py", + ROOT / "src" / "anyfesolver" / "_b2_physical_linear_batch_dev.py", + ROOT / "src" / "anyfesolver" / "control.py", + ROOT / "src" / "anyfesolver" / "linalg.py", + ROOT / "src" / "anyfesolver" / "threading_policy.py", ] return [{"path": str(path.resolve()), "sha256": sha256(path.read_bytes()).hexdigest()} diff --git a/scripts/b2_f09_thin_section_dev.py b/scripts/b2_f09_thin_section_dev.py index 31b09db62..9c0cc6414 100644 --- a/scripts/b2_f09_thin_section_dev.py +++ b/scripts/b2_f09_thin_section_dev.py @@ -34,8 +34,8 @@ ROOT = Path(__file__).resolve().parents[1] PROBE = runpy.run_path(str(ROOT / "scripts" / "probe_b3_ge_e4_pl_g0_f09_graph_reversal.py")) -from anysolver._b2_physical_flexibility_linear import LinearSection -from anysolver._b2_physical_linear_batch_dev import CompiledB2AffineBatch +from anyfesolver._b2_physical_flexibility_linear import LinearSection +from anyfesolver._b2_physical_linear_batch_dev import CompiledB2AffineBatch F = Fraction diff --git a/scripts/b2_large_scale_development.py b/scripts/b2_large_scale_development.py index 71b4d87bd..1359def39 100644 --- a/scripts/b2_large_scale_development.py +++ b/scripts/b2_large_scale_development.py @@ -115,8 +115,8 @@ def resolve_run(args): raise ValueError(f"{name} requires a separate --budget") # Windows sandboxes can deny strict realpath on an accessible directory. site = Path(installed_site).resolve(strict=False) - if not site.is_dir() or not (site / "anysolver/__init__.py").is_file(): - raise ValueError("installed site must contain an anysolver package") + if not site.is_dir() or not (site / "anyfesolver/__init__.py").is_file(): + raise ValueError("installed site must contain an anyfesolver package") budget = Path(budget_arg).resolve() if budget == DEFAULT_BUDGET.resolve(): raise ValueError(f"{name} cannot use the source development budget") @@ -144,10 +144,10 @@ def resolve_run(args): def verify_installed_import_origin(module_file, site): """Check the actual child import after Python resolves its module search path.""" site = Path(site).resolve(strict=False) - expected = site / "anysolver" + expected = site / "anyfesolver" origin = Path(module_file).resolve(strict=False) if not (expected / "__init__.py").is_file() or not origin.is_file() or origin.parent != expected: - raise RuntimeError(f"anysolver imported outside installed site: {origin}") + raise RuntimeError(f"anyfesolver imported outside installed site: {origin}") return origin @@ -164,15 +164,15 @@ def installed_site_identity(site, *, run_profile="installed_large_dev"): wheel_sha = digest(wheel) if wheel_sha != expected_sha: raise ValueError(f"{run_profile} wheel differs from frozen SHA256") - records = sorted(site.glob("anysolver-*.dist-info/RECORD")) + records = sorted(site.glob("anyfesolver-*.dist-info/RECORD")) if len(records) != 1: - raise ValueError("installed site must contain exactly one anysolver wheel RECORD") + raise ValueError("installed site must contain exactly one anyfesolver wheel RECORD") record_name = f"{records[0].parent.name}/RECORD" module_hashes = {} product_file_count = 0 with ZipFile(wheel) as archive: for member in archive.namelist(): - if not member.startswith("anysolver/") or member.endswith("/"): + if not member.startswith("anyfesolver/") or member.endswith("/"): continue wheel_bytes = archive.read(member) try: @@ -182,7 +182,7 @@ def installed_site_identity(site, *, run_profile="installed_large_dev"): if site_bytes != wheel_bytes: raise ValueError(f"installed site differs from frozen wheel: {member}") product_file_count += 1 - name = member.removeprefix("anysolver/") + name = member.removeprefix("anyfesolver/") if name in INSTALLED_PRODUCT_MODULES: module_hashes[name] = hashlib.sha256(site_bytes).hexdigest() wheel_record = archive.read(record_name) @@ -371,9 +371,9 @@ def verify_installed_child_record(outdir, config, site, identity, *, runtime = record["runtime"] verify_python_optimization(runtime["python_optimize"]) verify_installed_runtime(runtime) - verify_installed_import_origin(runtime["anysolver_file"], site) - if runtime["anysolver_sha256"] != identity["installed_module_sha256"]["__init__.py"]: - raise ValueError("installed child imported a different anysolver package") + verify_installed_import_origin(runtime["anyfesolver_file"], site) + if runtime["anyfesolver_sha256"] != identity["installed_module_sha256"]["__init__.py"]: + raise ValueError("installed child imported a different anyfesolver package") if run_profile in ("installed_large_refinement_dev", "installed_beam_rich_dev"): if record["run_profile"] != run_profile: raise ValueError("refinement child used a different run profile") @@ -564,7 +564,7 @@ def settings(size, cases): def model(config): import numpy as np from scipy import sparse - from anysolver import stiffened_shell as api + from anyfesolver import stiffened_shell as api nx, ny = config["nx"], config["ny"] shell_id = lambda x, y: 1 + y * (nx + 1) + x @@ -745,7 +745,7 @@ def failed_solve_diagnostic(owner, expected_case_id, captured, *, accurate_resid unchanged_tolerance=float(equilibrium_tolerance[eq_index])) try: if accurate_residual is None: - from anysolver._stiffened_shell_b2_q4_panel_experimental import ( + from anyfesolver._stiffened_shell_b2_q4_panel_experimental import ( _bounded_accurate_residual as accurate_residual) # Recompute the original unscaled production RHS rather than undoing # binary64 factor scaling on the captured solver input. @@ -795,24 +795,24 @@ def child(config, out, *, profile=False, run_profile="source_dev", installed_sit import psutil import scipy import threadpoolctl - import anysolver + import anyfesolver if run_profile in INSTALLED_PROFILES: try: - origin = verify_installed_import_origin(anysolver.__file__, installed_site) + origin = verify_installed_import_origin(anyfesolver.__file__, installed_site) except (OSError, RuntimeError, TypeError, ValueError) as exc: write_json(out, dict(config=config, status="installed_import_origin_refused", - anysolver_file=str(anysolver.__file__), + anyfesolver_file=str(anyfesolver.__file__), runtime=dict(python_optimize=sys.flags.optimize), failure_reason=f"{type(exc).__name__}: {exc}")) return 1 - from anysolver import stiffened_shell as api - from anysolver import _stiffened_shell_b2_q4_panel_experimental as panel_module + from anyfesolver import stiffened_shell as api + from anyfesolver import _stiffened_shell_b2_q4_panel_experimental as panel_module started = time.perf_counter() record = dict(config=config, status="started", phases={}, runtime=dict(python=sys.version, python_optimize=sys.flags.optimize, numpy=np.__version__, - scipy=scipy.__version__, anysolver_file=str(Path(anysolver.__file__).resolve()), - anysolver_sha256=digest(anysolver.__file__), + scipy=scipy.__version__, anyfesolver_file=str(Path(anyfesolver.__file__).resolve()), + anyfesolver_sha256=digest(anyfesolver.__file__), thread_env={k: os.environ.get(k) for k in THREAD_ENV}, NUMBA_DISABLE_JIT=os.environ.get("NUMBA_DISABLE_JIT"), affinity=psutil.Process().cpu_affinity(), @@ -820,7 +820,7 @@ def child(config, out, *, profile=False, run_profile="source_dev", installed_sit if run_profile in INSTALLED_PROFILES: record["run_profile"] = run_profile record["installed_site"] = str(Path(installed_site).resolve()) - record["runtime"]["anysolver_file"] = str(origin) + record["runtime"]["anyfesolver_file"] = str(origin) try: verify_installed_runtime(record["runtime"]) except RuntimeError as exc: @@ -966,9 +966,9 @@ def run_parent(args): env["NUMBA_DISABLE_JIT"] = "1" env["PYTHONOPTIMIZE"] = "0" env["PYTHONPATH"] = str(installed_site) if installed_site else str(ROOT / "src") + os.pathsep + str(ROOT) - source_paths = [Path(__file__), ROOT / "src/anysolver/stiffened_shell.py", - ROOT / "src/anysolver/_stiffened_shell_b2_q4_panel_experimental.py", - ROOT / "src/anysolver/_stiffened_shell_b2_physical_rigid_footprint.py"] + source_paths = [Path(__file__), ROOT / "src/anyfesolver/stiffened_shell.py", + ROOT / "src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py", + ROOT / "src/anyfesolver/_stiffened_shell_b2_physical_rigid_footprint.py"] command = [sys.executable, str(Path(__file__).resolve()), "--child", "--size", args.size, "--cases", str(args.cases), "--out", str(outdir / "child.json")] diff --git a/scripts/b3_e4_bl5_coherent_aggregation_dev.py b/scripts/b3_e4_bl5_coherent_aggregation_dev.py index 6e14733b6..7fbc3a033 100644 --- a/scripts/b3_e4_bl5_coherent_aggregation_dev.py +++ b/scripts/b3_e4_bl5_coherent_aggregation_dev.py @@ -9,10 +9,10 @@ import argparse, hashlib, json, math, time import numpy as np import numba -import anysolver +import anyfesolver from threadpoolctl import threadpool_info -from anysolver import stiffened_shell -from anysolver._ge_beam3_retained_generalized_state import Mechanical +from anyfesolver import stiffened_shell +from anyfesolver._ge_beam3_retained_generalized_state import Mechanical from test_stiffened_shell_l1_assembly_experimental import _bl5_joint_mesh_definition LOADS={"fy":(0.,100.,0.,0.,0.,0.),"mx":(0.,0.,0.,10.,0.,0.),"mz":(0.,0.,0.,0.,0.,10.)} @@ -113,7 +113,7 @@ def analyze(output, refine_from=None): assert pools and all(p['num_threads']==1 for p in pools) and numba.config.DISABLE_JIT result={'classification':'development only; no physical inf-sup or F03 acceptance', 'source_sha256':hashlib.sha256(Path(__file__).read_bytes()).hexdigest(), - 'imported_anysolver':anysolver.__file__,'threads':pools,'jit_disabled':True, + 'imported_anyfesolver':anyfesolver.__file__,'threads':pools,'jit_disabled':True, 'decision':'Check coherent support representability/work and transfer sensitivity before extending ratio/refinement envelope', 'outcomes':'Work/map failure: repair. Nonfinite/singular actual KKT: investigate physical mode. Valid but different transfer: assess convergence under common fixed regions, no basis tuning.', 'loads':LOADS,'cases':[],'operator_constructions':0} diff --git a/scripts/b3_e4_bl5_completion_sensitivity_dev.py b/scripts/b3_e4_bl5_completion_sensitivity_dev.py index 216ddba63..c011f3020 100644 --- a/scripts/b3_e4_bl5_completion_sensitivity_dev.py +++ b/scripts/b3_e4_bl5_completion_sensitivity_dev.py @@ -42,7 +42,7 @@ def main(site, saved, output, reuse=None, refined=None): 'limits': 'No finite-removal, drilling independence, causation of external discrepancy, or coefficient tuning'} started = time.perf_counter() try: - require(not any(n.split('.')[0] == 'anysolver' for n in sys.modules), 'fresh product process required') + require(not any(n.split('.')[0] == 'anyfesolver' for n in sys.modules), 'fresh product process required') identity = json.loads((saved/'identity.json').read_text()) wheel = Path(identity['wheel_path']) require(sha(wheel) == identity['wheel_sha256'], 'saved wheel byte identity required') @@ -65,10 +65,10 @@ def main(site, saved, output, reuse=None, refined=None): from scipy import sparse from scipy.sparse.linalg import splu from threadpoolctl import threadpool_info - from anysolver import stiffened_shell as ss, corotational as cr - from anysolver._stiffened_shell_ge_experimental import ( + from anyfesolver import stiffened_shell as ss, corotational as cr + from anyfesolver._stiffened_shell_ge_experimental import ( _shell_reference, _linear_equilibrium, _scaled_constraint_gap) - from anysolver._b2_physical_linear_batch_dev import _accurate_sparse_residual + from anyfesolver._b2_physical_linear_batch_dev import _accurate_sparse_residual pools = threadpool_info() require(pools and all(p['num_threads'] == 1 for p in pools) and numba.get_num_threads() == 1 and numba.config.DISABLE_JIT, 'effective thread1/JIT-off required') @@ -251,7 +251,7 @@ def transfer(multiplier): finally: report['elapsed_seconds'] = time.perf_counter()-started report['imports'] = {n: str(Path(m.__file__).resolve()) for n, m in sys.modules.copy().items() - if n.split('.')[0] == 'anysolver' and getattr(m, '__file__', None)} + if n.split('.')[0] == 'anyfesolver' and getattr(m, '__file__', None)} require(all(Path(p).is_relative_to(site) for p in report['imports'].values()), 'all product imports must be onsite') (output/'result.json').write_text(json.dumps(report, indent=2, allow_nan=False)+'\n', encoding='utf-8') print(json.dumps({k: report[k] for k in ('status', 'elapsed_seconds')})) diff --git a/scripts/b3_e4_bl5_distributed_couple_dev.py b/scripts/b3_e4_bl5_distributed_couple_dev.py index d73baa751..5b16dab6c 100644 --- a/scripts/b3_e4_bl5_distributed_couple_dev.py +++ b/scripts/b3_e4_bl5_distributed_couple_dev.py @@ -8,9 +8,9 @@ import numpy as np from threadpoolctl import threadpool_info import numba -import anysolver -from anysolver import stiffened_shell -from anysolver._ge_beam3_retained_generalized_state import Mechanical +import anyfesolver +from anyfesolver import stiffened_shell +from anyfesolver._ge_beam3_retained_generalized_state import Mechanical from test_stiffened_shell_l1_assembly_experimental import _bl5_joint_mesh_definition @@ -119,7 +119,7 @@ def main(output, case="mz"): root_normal_reaction = float(result.reactions[shell_count+5]) assert root_normal_reaction == 0. output.write_text(json.dumps(dict(status="PASSED_DEVELOPMENT_ONLY", source_sha256=sha256( - Path(__file__).read_bytes()).hexdigest(), imported_anysolver=anysolver.__file__, threads=pools, + Path(__file__).read_bytes()).hexdigest(), imported_anyfesolver=anyfesolver.__file__, threads=pools, jit_disabled=bool(numba.config.DISABLE_JIT), case=case, load=LOADS[case], shell_edges=16, beam_halfcells=16, multiplier_rows=owner._C.shape[0], model_identity=owner.preflight()["identity"], diff --git a/scripts/b3_e4_bl5_endpoint_response_dev.py b/scripts/b3_e4_bl5_endpoint_response_dev.py index 31e7c110f..f92c681c5 100644 --- a/scripts/b3_e4_bl5_endpoint_response_dev.py +++ b/scripts/b3_e4_bl5_endpoint_response_dev.py @@ -13,7 +13,7 @@ import traceback import zipfile -REPO = Path("C:/Github/ANYsolver/.perf2-worktrees/stiffened-main-reconcile-20261001") +REPO = Path("C:/Github/ANYfeSolver/.perf2-worktrees/stiffened-main-reconcile-20261001") WHEEL_SHA = "d99c59ac0464613b15461dcd23c0b8fe158a67fe3b27192a886b6daf6aa981ea" LOADS = {"fy": (0., 100., 0., 0., 0., 0.), "mx": (0., 0., 0., 10., 0., 0.), "mz": (0., 0., 0., 0., 0., 10.)} @@ -40,13 +40,13 @@ def finite(value): def installed_identity(site, manifest): expected = json.loads(manifest.read_text()) - source = {p.relative_to(REPO).as_posix() for p in (REPO/"src/anysolver").rglob("*.py")} - installed = {"src/"+p.relative_to(site).as_posix() for p in (site/"anysolver").rglob("*.py")} + source = {p.relative_to(REPO).as_posix() for p in (REPO/"src/anyfesolver").rglob("*.py")} + installed = {"src/"+p.relative_to(site).as_posix() for p in (site/"anyfesolver").rglob("*.py")} require(len(expected) == 391 and source == installed == set(expected), "exact 391-module sets required") wheels = list((manifest.parent/"wheels").glob("*.whl")) require(len(wheels) == 1 and sha(wheels[0]) == WHEEL_SHA, "pinned wheel required") with zipfile.ZipFile(wheels[0]) as wheel: - names = {n for n in wheel.namelist() if n.startswith("anysolver/") and n.endswith(".py")} + names = {n for n in wheel.namelist() if n.startswith("anyfesolver/") and n.endswith(".py")} require(names == {n.removeprefix("src/") for n in expected}, "wheel module set differs") for name, digest in expected.items(): key = name.removeprefix("src/") @@ -69,7 +69,7 @@ def settings(): def imports(site): loaded = {n: str(Path(m.__file__).resolve()) for n, m in sys.modules.copy().items() - if n.split(".")[0] == "anysolver" and getattr(m, "__file__", None)} + if n.split(".")[0] == "anyfesolver" and getattr(m, "__file__", None)} require(loaded and all(Path(p).is_relative_to(site) for p in loaded.values()), "source product import forbidden") return loaded @@ -82,14 +82,14 @@ def run(args): "ny": args.nx//4, "halfcells": 16*args.nx, "whole_element_ratio": "8:1", "cases": {}} owner = None try: - require(not any(n.split(".")[0] == "anysolver" for n in sys.modules), "fresh process required") + require(not any(n.split(".")[0] == "anyfesolver" for n in sys.modules), "fresh process required") site, manifest, fixtures = (p.resolve(strict=True) for p in (args.site, args.manifest, args.fixtures)) paths = (fixtures/"scripts", fixtures/"tests") if (fixtures/"scripts").is_dir() else (fixtures,) sys.path[:0] = [str(site)]+[str(p) for p in paths] import numpy as np import numba from threadpoolctl import threadpool_info - from anysolver import stiffened_shell as api + from anyfesolver import stiffened_shell as api import b3_e4_bl5_coherent_aggregation_dev as coherent import b3_e4_bl5_matched_mz_native_dev as matched import b3_e4_bl5_matched_p0_native_refinement_dev as inventory diff --git a/scripts/b3_e4_bl5_local_kernel_dev.py b/scripts/b3_e4_bl5_local_kernel_dev.py index 066b7c7da..ca061b26d 100644 --- a/scripts/b3_e4_bl5_local_kernel_dev.py +++ b/scripts/b3_e4_bl5_local_kernel_dev.py @@ -16,16 +16,16 @@ from pathlib import Path import time -import anysolver +import anyfesolver import numba import numpy as np from scipy import linalg from threadpoolctl import threadpool_info -from anysolver import stiffened_shell -from anysolver._stiffened_shell_ge_experimental import _shell_reference -from anysolver._ge_beam3_generalized_static_boundary import spatial_jacobian -from anysolver.corotational import corotational_element_response +from anyfesolver import stiffened_shell +from anyfesolver._stiffened_shell_ge_experimental import _shell_reference +from anyfesolver._ge_beam3_generalized_static_boundary import spatial_jacobian +from anyfesolver.corotational import corotational_element_response from scripts.b3_e4_bl5_coherent_aggregation_dev import model @@ -478,7 +478,7 @@ def evaluate(output): paths = [Path(__file__), Path(inspect.getsourcefile(model)), Path(inspect.getsourcefile(_shell_reference)), Path(inspect.getsourcefile(spatial_jacobian)), Path(inspect.getsourcefile(corotational_element_response))] result.update(source_sha256={str(p): hashlib.sha256(p.read_bytes()).hexdigest() for p in paths}, - imported_anysolver=anysolver.__file__, threads=pools, jit_disabled=True) + imported_anyfesolver=anyfesolver.__file__, threads=pools, jit_disabled=True) args.output.write_text(json.dumps(result, indent=2, allow_nan=False)) print(json.dumps({"status": result["status"], "local_checks": len(result["local_checks"]), "family_cases": len(result["cases"]), "elapsed_seconds": result["elapsed_seconds"]})) diff --git a/scripts/b3_e4_bl5_matched_mz_native_dev.py b/scripts/b3_e4_bl5_matched_mz_native_dev.py index f61632e90..4b0e22e1c 100644 --- a/scripts/b3_e4_bl5_matched_mz_native_dev.py +++ b/scripts/b3_e4_bl5_matched_mz_native_dev.py @@ -21,8 +21,8 @@ import numpy as np import numba from threadpoolctl import threadpool_info -import anysolver -from anysolver import stiffened_shell +import anyfesolver +from anyfesolver import stiffened_shell from b3_e4_bl5_coherent_aggregation_dev import model, physical_transfer @@ -271,7 +271,7 @@ def main(output, directory, site, case): try: site = site.resolve(strict=True) imports = {n: str(Path(m.__file__).resolve()) for n, m in sys.modules.copy().items() - if n.split('.')[0] == "anysolver" and getattr(m, "__file__", None)} + if n.split('.')[0] == "anyfesolver" and getattr(m, "__file__", None)} require(all(Path(p).is_relative_to(site) for p in imports.values()), "installed product imports required") identity_path = site.parent/"identity.json" installed = json.loads(identity_path.read_text()) @@ -280,7 +280,7 @@ def main(output, directory, site, case): wheel = next((site.parent/"wheels").glob("*.whl")) require(sha(wheel) == WHEEL_SHA, "installed wheel bytes changed") with zipfile.ZipFile(wheel) as archive: - modules = [name for name in archive.namelist() if name.startswith("anysolver/") and name.endswith(".py")] + modules = [name for name in archive.namelist() if name.startswith("anyfesolver/") and name.endswith(".py")] require(len(modules) == 388 and all(archive.read(name) == (site/name).read_bytes() for name in modules), "complete installed module/wheel byte binding required") fixture = Path(sys.modules["test_stiffened_shell_l1_assembly_experimental"].__file__).resolve() @@ -355,7 +355,7 @@ def main(output, directory, site, case): summary.update(status="completed", work_relative_signed=compared["work_relative_signed"], field_errors=compared["nodal_field_errors"], checks=checks) final_imports = {n: Path(m.__file__).resolve() for n, m in sys.modules.copy().items() - if n.split('.')[0] == "anysolver" and getattr(m, "__file__", None)} + if n.split('.')[0] == "anyfesolver" and getattr(m, "__file__", None)} require(all(path.is_relative_to(site) for path in final_imports.values()), "all final product imports must remain on the canonical installed site") except BaseException as error: @@ -365,7 +365,7 @@ def main(output, directory, site, case): raise finally: imports = {n: str(Path(m.__file__).resolve()) for n, m in sys.modules.copy().items() - if n.split('.')[0] == "anysolver" and getattr(m, "__file__", None)} + if n.split('.')[0] == "anyfesolver" and getattr(m, "__file__", None)} cleanup_error = None actions = [("retain_imports", lambda: write("imports", imports))] if owner is not None: diff --git a/scripts/b3_e4_bl5_matched_mz_reference_dev.py b/scripts/b3_e4_bl5_matched_mz_reference_dev.py index dd53f5d61..f5629ead2 100644 --- a/scripts/b3_e4_bl5_matched_mz_reference_dev.py +++ b/scripts/b3_e4_bl5_matched_mz_reference_dev.py @@ -3,7 +3,7 @@ Independent ASDShellQ4/ElasticTimoshenkoBeam discretization of the flat BL5 target, not an equal native discrete operator or a converged accuracy oracle. Shell edge interpolation is work conjugate. Beam root DOFs 1..5 are grounded; -normal spin is free. One case per fresh Python 3.12 process; no ANYsolver/NumPy. +normal spin is free. One case per fresh Python 3.12 process; no ANYfeSolver/NumPy. Existing recorder, atomic output and small recovery services are reused. """ from __future__ import annotations diff --git a/scripts/b3_e4_bl5_matched_p0_native_refinement_dev.py b/scripts/b3_e4_bl5_matched_p0_native_refinement_dev.py index e2e9308cd..8b2e12c88 100644 --- a/scripts/b3_e4_bl5_matched_p0_native_refinement_dev.py +++ b/scripts/b3_e4_bl5_matched_p0_native_refinement_dev.py @@ -26,7 +26,7 @@ COHERENT_SHA = "9bd47696851110764486016f7d91f3de786818e87e4da88829dd76d5931f1fce" MATCHED_SHA = "92fa4515f1c61008f24bafe932e8fa2c50ea298903f2a1e5499e5be6c7dfaefb" EXTERNAL_REFINEMENT_SHA = "0e5435e0d38952642662eb1aad7dd374c341c866c9d099c87d2e66ce135a21c0" -SOURCE_ROOT = Path("C:/Github/ANYsolver/.perf2-worktrees/b3-ge-e4-pl-coupling") +SOURCE_ROOT = Path("C:/Github/ANYfeSolver/.perf2-worktrees/b3-ge-e4-pl-coupling") BALANCE_LIMIT, GAP_LIMIT = 1e-8, 1e-9 @@ -52,14 +52,14 @@ def runtime(site): global np, numba, stiffened_shell, coherent, matched, threadpool_info site = site.resolve(strict=True) fixtures = (site.parent/"fixtures").resolve(strict=True) - require(not any(n.split('.')[0] == "anysolver" for n in sys.modules), + require(not any(n.split('.')[0] == "anyfesolver" for n in sys.modules), "fresh process without preimported product required") sys.path.insert(0, str(fixtures)) sys.path.insert(0, str(site)) import numpy as np import numba from threadpoolctl import threadpool_info - from anysolver import stiffened_shell + from anyfesolver import stiffened_shell import b3_e4_bl5_coherent_aggregation_dev as coherent import b3_e4_bl5_matched_mz_native_dev as matched require(sha(coherent.__file__) == COHERENT_SHA and sha(matched.__file__) == MATCHED_SHA, @@ -74,7 +74,7 @@ def runtime(site): def canonical_imports(site): imports = {name: str(Path(module.__file__).resolve()) for name, module in sys.modules.copy().items() - if name.split('.')[0] == "anysolver" and getattr(module, "__file__", None)} + if name.split('.')[0] == "anyfesolver" and getattr(module, "__file__", None)} require(imports and all(Path(path).is_relative_to(site) for path in imports.values()), "all product imports must resolve to the canonical installed site") return imports @@ -87,11 +87,11 @@ def installed_identity(site, fixtures): "unchanged declared 388-module installed wheel required") wheels = list((site.parent/"wheels").glob("*.whl")) require(len(wheels) == 1 and sha(wheels[0]) == WHEEL_SHA, "exact installed wheel bytes required") - source_files = {"anysolver/"+p.relative_to(SOURCE_ROOT/"src/anysolver").as_posix(): p - for p in (SOURCE_ROOT/"src/anysolver").rglob("*.py")} + source_files = {"anyfesolver/"+p.relative_to(SOURCE_ROOT/"src/anyfesolver").as_posix(): p + for p in (SOURCE_ROOT/"src/anyfesolver").rglob("*.py")} modules = {} with zipfile.ZipFile(wheels[0]) as archive: - names = {n for n in archive.namelist() if n.startswith("anysolver/") and n.endswith(".py")} + names = {n for n in archive.namelist() if n.startswith("anyfesolver/") and n.endswith(".py")} require(len(names) == 388 and names == set(source_files), "complete source/wheel module set required") for name in sorted(names): data = archive.read(name) @@ -426,7 +426,7 @@ def main(site, output, nx, external_level, old16): finally: cleanup_error = None actions = [("retain_imports", lambda: write("imports", {name: str(Path(m.__file__).resolve()) - for name, m in sys.modules.copy().items() if name.split('.')[0] == "anysolver" and getattr(m, "__file__", None)}))] + for name, m in sys.modules.copy().items() if name.split('.')[0] == "anyfesolver" and getattr(m, "__file__", None)}))] if owner is not None: actions.append(("close", owner.close)) for name, action in actions: diff --git a/scripts/b3_e4_bl5_mechanical_kernel_dev.py b/scripts/b3_e4_bl5_mechanical_kernel_dev.py index a26e980e5..0efbbc7f0 100644 --- a/scripts/b3_e4_bl5_mechanical_kernel_dev.py +++ b/scripts/b3_e4_bl5_mechanical_kernel_dev.py @@ -13,14 +13,14 @@ from pathlib import Path import time -import anysolver +import anyfesolver import numba import numpy as np from scipy import linalg, sparse from threadpoolctl import threadpool_info -from anysolver import stiffened_shell -from anysolver._stiffened_shell_ge_experimental import _linear_equilibrium, _scaled_constraint_gap +from anyfesolver import stiffened_shell +from anyfesolver._stiffened_shell_ge_experimental import _linear_equilibrium, _scaled_constraint_gap from scripts.b3_e4_bl5_coherent_aggregation_dev import model, LOADS, physical_transfer @@ -237,7 +237,7 @@ def evaluate(output, *, basis="p0"): pools = threadpool_info() assert pools and all(p['num_threads']==1 for p in pools) and numba.config.DISABLE_JIT result = evaluate(args.output, basis=args.basis) - result.update(threads=pools, jit_disabled=True, imported_anysolver=anysolver.__file__) + result.update(threads=pools, jit_disabled=True, imported_anyfesolver=anyfesolver.__file__) args.output.write_text(json.dumps(result, indent=2, allow_nan=False)) print(json.dumps({key:result[key] for key in ('status','physical_order','kernel_positive_resolved','elapsed_seconds')})) raise SystemExit(0 if all(result['predicates'].values()) else 1) diff --git a/scripts/b3_e4_bl5_native_stability_dev.py b/scripts/b3_e4_bl5_native_stability_dev.py index 06a668e96..e7ca4bb13 100644 --- a/scripts/b3_e4_bl5_native_stability_dev.py +++ b/scripts/b3_e4_bl5_native_stability_dev.py @@ -11,7 +11,7 @@ from pathlib import Path import time -import anysolver +import anyfesolver import numba import numpy as np from scipy import linalg, sparse @@ -42,7 +42,7 @@ def evaluate(nx, ny, cells, frozen, reference_start=8, preparation_path=None): raise ValueError('case outside frozen c2 finite family') scalar_case = entry[0] definition, policy = model(nx, ny, cells, 2) - owner = anysolver.stiffened_shell.create_analysis(definition=definition) + owner = anyfesolver.stiffened_shell.create_analysis(definition=definition) try: local = owner._line_samples[0][0] frame = local.port.frame @@ -143,7 +143,7 @@ def evaluate(nx, ny, cells, frozen, reference_start=8, preparation_path=None): reference_subdivision_schedule=schedule, all_generalized_eigenvalues=values.tolist(), beta=beta, safe_case_floor=float(safe_floor), frozen_scalar_sha256=hashlib.sha256(frozen.read_bytes()).hexdigest(), - imported_anysolver=anysolver.__file__, elapsed_seconds=time.monotonic()-start, + imported_anyfesolver=anyfesolver.__file__, elapsed_seconds=time.monotonic()-start, limitation='finite reference inf-sup development only; actual indefinite KKT, locking, physical accuracy and F03/M2 acceptance remain open') finally: owner.close() diff --git a/scripts/b3_e4_bl5_reference_actions_dev.py b/scripts/b3_e4_bl5_reference_actions_dev.py index 045bba1da..18836859d 100644 --- a/scripts/b3_e4_bl5_reference_actions_dev.py +++ b/scripts/b3_e4_bl5_reference_actions_dev.py @@ -12,7 +12,7 @@ from pathlib import Path import time -import anysolver +import anyfesolver import numba import numpy as np from scipy import sparse @@ -102,7 +102,7 @@ def evaluate(): raise RuntimeError('effective one-thread/JIT-off settings required') started = time.perf_counter() definition, policy = model(NS, NT, NB, C_LAMBDA) - owner = anysolver.stiffened_shell.create_analysis(definition=definition) + owner = anyfesolver.stiffened_shell.create_analysis(definition=definition) line = definition.lines[0] if line.basis != 'p0' or len(definition.lines) != 1 or definition.points: raise ValueError('bounded P0 physical correspondence required') @@ -185,7 +185,7 @@ def evaluate(): for older, newer in zip(levels[:-1], levels[1:]): assert np.all(np.array(newer['total_dual']) >= np.array(older['total_dual'])*(1-1e-12)) owner.close() - return dict(status='COMPLETED_DEVELOPMENT_ONLY', imported_anysolver=anysolver.__file__, threads=pools, + return dict(status='COMPLETED_DEVELOPMENT_ONLY', imported_anyfesolver=anyfesolver.__file__, threads=pools, elapsed_seconds=time.perf_counter()-started, policy=policy, ell_m=ELL, beam_norm_width_m=BEAM_WIDTH, shell_width_m=WIDTH, action_names=names, density_units=labels, force_equivalent_mu=[m.tolist() for m in mu], diff --git a/scripts/b3_e4_bl5_retained_port_decision.py b/scripts/b3_e4_bl5_retained_port_decision.py index 6a04e47c0..6c751a21c 100644 --- a/scripts/b3_e4_bl5_retained_port_decision.py +++ b/scripts/b3_e4_bl5_retained_port_decision.py @@ -13,10 +13,10 @@ import sys from math import fsum, fma -import anysolver -from anysolver import stiffened_shell -from anysolver._stiffened_shell_ge_experimental import _linear_equilibrium, _scaled_constraint_gap -from anysolver._stiffened_shell_ge_experimental import _require_independent_supported_rows +import anyfesolver +from anyfesolver import stiffened_shell +from anyfesolver._stiffened_shell_ge_experimental import _linear_equilibrium, _scaled_constraint_gap +from anyfesolver._stiffened_shell_ge_experimental import _require_independent_supported_rows import numpy as np import numba from scipy import sparse @@ -189,14 +189,14 @@ def _parity(a, b, n, *, require=True): def main(destination): if destination.exists(): raise FileExistsError("preserve previous decision output") destination.mkdir() - expected = (ROOT/'src/anysolver/__init__.py').resolve() - if Path(anysolver.__file__).resolve() != expected: + expected = (ROOT/'src/anyfesolver/__init__.py').resolve() + if Path(anyfesolver.__file__).resolve() != expected: raise ValueError("decision imported another solver checkout") definition = _bl5_joint_mesh_definition(INTERVALS, INTERVALS, 1) report = {"status":"IN_PROGRESS", "source_git":subprocess.check_output( ['git','-c',f'safe.directory={ROOT.as_posix()}','rev-parse','HEAD'],cwd=ROOT,text=True).strip(), "runner_sha256":hashlib.sha256(Path(__file__).read_bytes()).hexdigest(), - "imported_anysolver":str(expected), "physical_shell":asdict(definition.shell), + "imported_anyfesolver":str(expected), "physical_shell":asdict(definition.shell), "runtime":{"python":sys.version,"numba_jit_disabled":bool(numba.config.DISABLE_JIT), "numba_threads":numba.config.NUMBA_NUM_THREADS}, "beam_definition_hashes":[b.sha256 for b in definition.beams], @@ -353,7 +353,7 @@ def boundary_control(destination, previous): try: with threadpool_limits(limits=1): report['threadpools']=threadpool_info() - if (Path(anysolver.__file__).resolve()!=(ROOT/'src/anysolver/__init__.py').resolve() + if (Path(anyfesolver.__file__).resolve()!=(ROOT/'src/anyfesolver/__init__.py').resolve() or any(p['num_threads']!=1 for p in report['threadpools']) or not report['threadpools'] or not numba.config.DISABLE_JIT or numba.config.NUMBA_NUM_THREADS!=1): diff --git a/scripts/b3_e4_e01_beam_only_control.py b/scripts/b3_e4_e01_beam_only_control.py index c13602fc7..7eb00c3c0 100644 --- a/scripts/b3_e4_e01_beam_only_control.py +++ b/scripts/b3_e4_e01_beam_only_control.py @@ -40,7 +40,7 @@ def _balance(root, applied, root_xyz, tip_xyz): def native_cases(): import numpy as np from scipy.sparse.linalg import splu - from anysolver import _stiffened_shell_ge_experimental as ge + from anyfesolver import _stiffened_shell_ge_experimental as ge from b3_e4_e01_native_point_refinement_screen import definition panel, _tip = definition(INTERVALS, 1, 4) diff --git a/scripts/b3_e4_e01_beam_port_compliance_dev.py b/scripts/b3_e4_e01_beam_port_compliance_dev.py index e91b5689f..2430c25aa 100644 --- a/scripts/b3_e4_e01_beam_port_compliance_dev.py +++ b/scripts/b3_e4_e01_beam_port_compliance_dev.py @@ -22,7 +22,7 @@ def native_ports(): import numpy as np from scipy.sparse.linalg import splu - from anysolver import _stiffened_shell_ge_experimental as ge + from anyfesolver import _stiffened_shell_ge_experimental as ge from b3_e4_e01_native_point_refinement_screen import definition panel, _ = definition(INTERVALS, 1, 4) diff --git a/scripts/b3_e4_e01_native_point_refinement_screen.py b/scripts/b3_e4_e01_native_point_refinement_screen.py index 1cd2d3bca..f98ac356f 100644 --- a/scripts/b3_e4_e01_native_point_refinement_screen.py +++ b/scripts/b3_e4_e01_native_point_refinement_screen.py @@ -13,13 +13,13 @@ import numpy as np -import anysolver -from anysolver import b3_ge -from anysolver._stiffened_shell_ge_experimental import ( +import anyfesolver +from anyfesolver import b3_ge +from anyfesolver._stiffened_shell_ge_experimental import ( PROFILE, FixedCoordinate, LinearDefinition, NodalAction, PointConnection, ShellPanel, ) -from anysolver.stiffened_shell import create_analysis +from anyfesolver.stiffened_shell import create_analysis E = 210e9 @@ -143,7 +143,7 @@ def main(external_dir: Path, output: Path, two_d_refinement: bool = False): record = { "classification": "E01 source-development comparison; not accepted", "source_sha256": sha256(Path(__file__).read_bytes()).hexdigest(), - "solver_import": str(Path(anysolver.__file__).resolve()), + "solver_import": str(Path(anyfesolver.__file__).resolve()), "two_d_refinement": two_d_refinement, "external_files": {}, "cases": [], "failure": None, } diff --git a/scripts/b3_e4_e01_native_torque_action_dev.py b/scripts/b3_e4_e01_native_torque_action_dev.py index 9019ebbc2..18dd08087 100644 --- a/scripts/b3_e4_e01_native_torque_action_dev.py +++ b/scripts/b3_e4_e01_native_torque_action_dev.py @@ -10,9 +10,9 @@ import numpy as np from scripts.b3_e4_e01_native_point_refinement_screen import definition -from anysolver import _stiffened_shell_ge_experimental as ge -from anysolver._stiffened_shell_ge_experimental import NodalAction -from anysolver.stiffened_shell import create_analysis +from anyfesolver import _stiffened_shell_ge_experimental as ge +from anyfesolver._stiffened_shell_ge_experimental import NodalAction +from anyfesolver.stiffened_shell import create_analysis def main(output: Path): diff --git a/scripts/b3_e4_e01_native_torque_dev.py b/scripts/b3_e4_e01_native_torque_dev.py index 580bc3918..894f8c6e0 100644 --- a/scripts/b3_e4_e01_native_torque_dev.py +++ b/scripts/b3_e4_e01_native_torque_dev.py @@ -10,8 +10,8 @@ import numpy as np from scripts.b3_e4_e01_native_point_refinement_screen import definition -from anysolver._stiffened_shell_ge_experimental import NodalAction -from anysolver.stiffened_shell import create_analysis +from anyfesolver._stiffened_shell_ge_experimental import NodalAction +from anyfesolver.stiffened_shell import create_analysis TORQUE_NM = 100. diff --git a/scripts/b3_e4_e01_run_matching_point_canary.py b/scripts/b3_e4_e01_run_matching_point_canary.py index 953d32ec3..5f9a61cf6 100644 --- a/scripts/b3_e4_e01_run_matching_point_canary.py +++ b/scripts/b3_e4_e01_run_matching_point_canary.py @@ -21,7 +21,7 @@ from _b3_e4_ccx_3d_canary_parser import _HEADER, _NODE, _STEP -EXE = Path("C:/Github/ANYsolver/.qualification/b3-ge-e4-pl/" +EXE = Path("C:/Github/ANYfeSolver/.qualification/b3-ge-e4-pl/" "calculix-223/CalculiX-2.23.0-win-x64/bin/ccx.exe") EXE_SHA256 = "27a9426a1ee2f72c38fbe892e0ffaf38e14867628ffd0235770261b6f3ec9c5f" MAX_SECONDS = 120. diff --git a/scripts/b3_e4_e01_shell_only_native.py b/scripts/b3_e4_e01_shell_only_native.py index 99f4262eb..ce847376c 100644 --- a/scripts/b3_e4_e01_shell_only_native.py +++ b/scripts/b3_e4_e01_shell_only_native.py @@ -14,9 +14,9 @@ import numpy as np from scipy.sparse.linalg import spsolve -from anysolver import _stiffened_shell_ge_experimental as ge -from anysolver.stiffened_shell import create_analysis -from anysolver._stiffened_shell_ge_experimental import NodalAction +from anyfesolver import _stiffened_shell_ge_experimental as ge +from anyfesolver.stiffened_shell import create_analysis +from anyfesolver._stiffened_shell_ge_experimental import NodalAction from b3_e4_e01_native_point_refinement_screen import definition diff --git a/scripts/b3_e4_e01_torque_reciprocity_dev.py b/scripts/b3_e4_e01_torque_reciprocity_dev.py index 71c9bbd3b..e69e17cc5 100644 --- a/scripts/b3_e4_e01_torque_reciprocity_dev.py +++ b/scripts/b3_e4_e01_torque_reciprocity_dev.py @@ -10,8 +10,8 @@ import numpy as np from scripts.b3_e4_e01_native_point_refinement_screen import definition -from anysolver._stiffened_shell_ge_experimental import NodalAction -from anysolver.stiffened_shell import create_analysis +from anyfesolver._stiffened_shell_ge_experimental import NodalAction +from anyfesolver.stiffened_shell import create_analysis def main(output: Path): diff --git a/scripts/b3_e4_f03_bl5_common_field_dev.py b/scripts/b3_e4_f03_bl5_common_field_dev.py index 2482f9a6d..0d893f93f 100644 --- a/scripts/b3_e4_f03_bl5_common_field_dev.py +++ b/scripts/b3_e4_f03_bl5_common_field_dev.py @@ -13,8 +13,8 @@ from pathlib import Path import subprocess -import anysolver -from anysolver import stiffened_shell +import anyfesolver +from anyfesolver import stiffened_shell import numpy as np from scipy.sparse.linalg import spsolve from threadpoolctl import threadpool_info, threadpool_limits @@ -112,15 +112,15 @@ def _run(owner, intervals: int, span: int, kind: str, def main(output: Path) -> None: if output.exists(): raise FileExistsError("preserve prior common-field evidence") - expected = (ROOT / "src" / "anysolver" / "__init__.py").resolve() - if Path(anysolver.__file__).resolve() != expected: + expected = (ROOT / "src" / "anyfesolver" / "__init__.py").resolve() + if Path(anyfesolver.__file__).resolve() != expected: raise RuntimeError("common-field diagnostic imported another checkout") result = { "status": "BL5_COMMON_FIELD_DEVELOPMENT_ONLY", "source_git": subprocess.check_output( ("git", "rev-parse", "HEAD"), cwd=ROOT, text=True).strip(), "runner_sha256": sha256(Path(__file__).read_bytes()).hexdigest(), - "imported_anysolver": str(expected), + "imported_anyfesolver": str(expected), "cases": [], "limitations": ("Strong nodal and weak native work are compared only " "on imposed common nodal fields with either zero or " diff --git a/scripts/b3_e4_f03_bl5_common_shell_action_dev.py b/scripts/b3_e4_f03_bl5_common_shell_action_dev.py index 339710845..3335ac2d9 100644 --- a/scripts/b3_e4_f03_bl5_common_shell_action_dev.py +++ b/scripts/b3_e4_f03_bl5_common_shell_action_dev.py @@ -13,8 +13,8 @@ from pathlib import Path import subprocess -import anysolver -from anysolver import stiffened_shell +import anyfesolver +from anyfesolver import stiffened_shell import numpy as np from scipy.sparse.linalg import splu from threadpoolctl import threadpool_info, threadpool_limits @@ -117,7 +117,7 @@ def main(reference: Path, output: Path) -> None: ("git", "rev-parse", "HEAD"), text=True).strip(), "runner_sha256": sha256(Path(__file__).read_bytes()).hexdigest(), "reference_sha256": sha256(raw).hexdigest(), - "imported_anysolver": str(Path(anysolver.__file__).resolve()), + "imported_anyfesolver": str(Path(anyfesolver.__file__).resolve()), "results": [], "failure": None, "limitations": ("Same recovered nodal shell action with identical " "root supports; different shell formulations. " diff --git a/scripts/b3_e4_f03_bl5_flat_web_load_screen.py b/scripts/b3_e4_f03_bl5_flat_web_load_screen.py index ea2e04d75..670766255 100644 --- a/scripts/b3_e4_f03_bl5_flat_web_load_screen.py +++ b/scripts/b3_e4_f03_bl5_flat_web_load_screen.py @@ -13,8 +13,8 @@ from pathlib import Path import subprocess -import anysolver -from anysolver import stiffened_shell +import anyfesolver +from anyfesolver import stiffened_shell import numpy as np from threadpoolctl import threadpool_info, threadpool_limits @@ -127,7 +127,7 @@ def analyze(): "status": "BL5_FLAT_WEB_SAME_GEOMETRY_DEVELOPMENT_ONLY", "source_git": subprocess.check_output( ("git", "rev-parse", "HEAD"), text=True).strip(), - "imported_anysolver": str(Path(anysolver.__file__).resolve()), + "imported_anyfesolver": str(Path(anyfesolver.__file__).resolve()), "geometry": {"plate_length_m": 1., "plate_width_m": .2, "plate_thickness_m": base.shell.thickness_m, "beam_axis_offset_m": base.shell.thickness_m/2+WEB_H_M/2, diff --git a/scripts/b3_e4_f03_bl5_interface_action_dev.py b/scripts/b3_e4_f03_bl5_interface_action_dev.py index 09f6c8aef..b14643e81 100644 --- a/scripts/b3_e4_f03_bl5_interface_action_dev.py +++ b/scripts/b3_e4_f03_bl5_interface_action_dev.py @@ -14,8 +14,8 @@ from pathlib import Path import subprocess -import anysolver -from anysolver import stiffened_shell +import anyfesolver +from anyfesolver import stiffened_shell import numpy as np from scipy.sparse.linalg import splu from threadpoolctl import threadpool_info, threadpool_limits @@ -120,7 +120,7 @@ def main(external_path: Path, common_path: Path, output: Path): "runner_sha256": sha256(Path(__file__).read_bytes()).hexdigest(), "external_sha256": sha256(external_bytes).hexdigest(), "common_sha256": sha256(common_bytes).hexdigest(), - "imported_anysolver": str(Path(anysolver.__file__).resolve()), + "imported_anyfesolver": str(Path(anyfesolver.__file__).resolve()), "cases": [], "failure": None, "limitations": ("Nonroot supported edge actions on one native " "shell; strong external versus weak native " diff --git a/scripts/b3_e4_f03_bl5_joint_growth_dev.py b/scripts/b3_e4_f03_bl5_joint_growth_dev.py index 3222b75d7..0da5f92d4 100644 --- a/scripts/b3_e4_f03_bl5_joint_growth_dev.py +++ b/scripts/b3_e4_f03_bl5_joint_growth_dev.py @@ -7,9 +7,9 @@ from pathlib import Path import subprocess -import anysolver -from anysolver import stiffened_shell -from anysolver._ge_beam3_retained_generalized_state import Mechanical +import anyfesolver +from anyfesolver import stiffened_shell +from anyfesolver._ge_beam3_retained_generalized_state import Mechanical import numpy as np from threadpoolctl import threadpool_info, threadpool_limits @@ -131,7 +131,7 @@ def analyze(): return {"status": "BL5_JOINT_GROWTH_DEVELOPMENT_ONLY", "source_git": subprocess.check_output( ("git", "rev-parse", "HEAD"), text=True).strip(), - "imported_anysolver": str(Path(anysolver.__file__).resolve()), + "imported_anyfesolver": str(Path(anyfesolver.__file__).resolve()), "threadpools": threadpool_info(), "geometry_m": {"length": 1., "width": .2, "shell_thickness": .035, diff --git a/scripts/b3_e4_f03_bl5_n16_followup_dev.py b/scripts/b3_e4_f03_bl5_n16_followup_dev.py index 2e66a5514..33c98a1de 100644 --- a/scripts/b3_e4_f03_bl5_n16_followup_dev.py +++ b/scripts/b3_e4_f03_bl5_n16_followup_dev.py @@ -12,8 +12,8 @@ from pathlib import Path import subprocess -import anysolver -from anysolver import stiffened_shell +import anyfesolver +from anyfesolver import stiffened_shell from threadpoolctl import threadpool_info, threadpool_limits from b3_e4_f03_bl5_joint_growth_dev import _case @@ -30,7 +30,7 @@ def main(output: Path) -> None: "source_git": subprocess.check_output( ("git", "rev-parse", "HEAD"), text=True).strip(), "runner_sha256": sha256(Path(__file__).read_bytes()).hexdigest(), - "imported_anysolver": str(Path(anysolver.__file__).resolve()), + "imported_anyfesolver": str(Path(anyfesolver.__file__).resolve()), "geometry_m": {"length": 1., "width": .2, "shell_thickness": .035, "beam_axis_height": .0675}, diff --git a/scripts/b3_e4_f03_bl5_native_nodal_comparator_dev.py b/scripts/b3_e4_f03_bl5_native_nodal_comparator_dev.py index 21858e90d..370934e61 100644 --- a/scripts/b3_e4_f03_bl5_native_nodal_comparator_dev.py +++ b/scripts/b3_e4_f03_bl5_native_nodal_comparator_dev.py @@ -12,8 +12,8 @@ from pathlib import Path import subprocess -import anysolver -from anysolver import stiffened_shell +import anyfesolver +from anyfesolver import stiffened_shell import numpy as np from scipy import sparse from scipy.sparse.linalg import splu @@ -202,8 +202,8 @@ def _same_shell_action(owner, rows, q, lam, external): def main(external_path: Path, output: Path): if output.exists(): raise FileExistsError("preserve prior nodal comparator evidence") - expected = (ROOT / "src" / "anysolver" / "__init__.py").resolve() - if Path(anysolver.__file__).resolve() != expected: + expected = (ROOT / "src" / "anyfesolver" / "__init__.py").resolve() + if Path(anyfesolver.__file__).resolve() != expected: raise RuntimeError("native nodal comparator imported another checkout") external_bytes = external_path.read_bytes() external = json.loads(external_bytes) @@ -219,7 +219,7 @@ def main(external_path: Path, output: Path): ("git", "rev-parse", "HEAD"), cwd=ROOT, text=True).strip(), "runner_sha256": sha256(Path(__file__).read_bytes()).hexdigest(), "external_sha256": sha256(external_bytes).hexdigest(), - "imported_anysolver": str(expected), + "imported_anyfesolver": str(expected), "cases": [], "limitations": ("Reference-linear same-native-K comparison. The five-row " "nodal comparator omits native retained-port work, " diff --git a/scripts/b3_e4_f03_bl5_p1_offgrid_dev.py b/scripts/b3_e4_f03_bl5_p1_offgrid_dev.py index 5c48d57c8..c56e08842 100644 --- a/scripts/b3_e4_f03_bl5_p1_offgrid_dev.py +++ b/scripts/b3_e4_f03_bl5_p1_offgrid_dev.py @@ -15,14 +15,14 @@ from pathlib import Path import subprocess -import anysolver -from anysolver import stiffened_shell +import anyfesolver +from anyfesolver import stiffened_shell import numpy as np from scipy import linalg, sparse from scipy.sparse.linalg import splu from threadpoolctl import threadpool_info, threadpool_limits -from anysolver._stiffened_shell_l1_assembly_experimental import compile_lines -from anysolver._ge_beam3_retained_generalized_state import Mechanical +from anyfesolver._stiffened_shell_l1_assembly_experimental import compile_lines +from anyfesolver._ge_beam3_retained_generalized_state import Mechanical from b3_e4_f03_bl5_joint_growth_dev import _case from test_stiffened_shell_l1_assembly_experimental import ( @@ -38,18 +38,18 @@ def analyze(*, ratio_probe: bool = False): - expected = (ROOT / "src" / "anysolver" / "__init__.py").resolve() - if Path(anysolver.__file__).resolve() != expected: - raise RuntimeError("off-grid screen imported another ANYsolver") + expected = (ROOT / "src" / "anyfesolver" / "__init__.py").resolve() + if Path(anyfesolver.__file__).resolve() != expected: + raise RuntimeError("off-grid screen imported another ANYfeSolver") report = { "status": ("BL5_P1_SEVEN_RATIO_FEASIBILITY_ONLY" if ratio_probe else "BL5_P1_OFFGRID_DEVELOPMENT_ONLY"), "source_git": subprocess.check_output( ("git", "rev-parse", "HEAD"), cwd=ROOT, text=True).strip(), "runner_sha256": sha256(Path(__file__).read_bytes()).hexdigest(), - "product_sha256": sha256((ROOT / "src" / "anysolver" / + "product_sha256": sha256((ROOT / "src" / "anyfesolver" / "_stiffened_shell_l1_assembly_experimental.py").read_bytes()).hexdigest(), - "imported_anysolver": str(expected), + "imported_anyfesolver": str(expected), "geometry_m": {"length": 1., "width": .2, "shell_thickness": .035, "beam_axis_height": .0675}, @@ -184,15 +184,15 @@ def probe_rank(): def probe_coarse_trace(): """One reference-abscissa P1 rule on the coarser of two uniform traces.""" - expected = (ROOT / "src" / "anysolver" / "__init__.py").resolve() - if Path(anysolver.__file__).resolve() != expected: - raise RuntimeError("coarse-trace probe imported another ANYsolver") + expected = (ROOT / "src" / "anyfesolver" / "__init__.py").resolve() + if Path(anyfesolver.__file__).resolve() != expected: + raise RuntimeError("coarse-trace probe imported another ANYfeSolver") report = {"status": "BL5_P1_COARSE_TRACE_DEVELOPMENT_ONLY", "source_git": subprocess.check_output( ("git", "rev-parse", "HEAD"), cwd=ROOT, text=True).strip(), "runner_sha256": sha256(Path(__file__).read_bytes()).hexdigest(), - "imported_anysolver": str(expected), "cases": [], + "imported_anyfesolver": str(expected), "cases": [], "limitations": ("Uniform straight flat-Q4 traces only; the " "coarse reference knots are a diagnostic, not " "a derived general attachment, stability norm, " diff --git a/scripts/b3_e4_f03_bl5_p1_space_dev.py b/scripts/b3_e4_f03_bl5_p1_space_dev.py index 039f1e7a7..4f01e3aab 100644 --- a/scripts/b3_e4_f03_bl5_p1_space_dev.py +++ b/scripts/b3_e4_f03_bl5_p1_space_dev.py @@ -13,9 +13,9 @@ from pathlib import Path import subprocess -import anysolver -from anysolver import stiffened_shell -from anysolver._ge_beam3_retained_generalized_state import Mechanical +import anyfesolver +from anyfesolver import stiffened_shell +from anyfesolver._ge_beam3_retained_generalized_state import Mechanical import numpy as np from scipy import sparse from threadpoolctl import threadpool_info, threadpool_limits @@ -64,8 +64,8 @@ def _continuous_p1(owner) -> sparse.csr_matrix: def main(external_path: Path, prior_path: Path, output: Path): if output.exists(): raise FileExistsError("preserve prior P1 evidence") - expected = (ROOT / "src" / "anysolver" / "__init__.py").resolve() - if Path(anysolver.__file__).resolve() != expected: + expected = (ROOT / "src" / "anyfesolver" / "__init__.py").resolve() + if Path(anyfesolver.__file__).resolve() != expected: raise RuntimeError("P1 diagnostic imported another checkout") external_bytes, prior_bytes = external_path.read_bytes(), prior_path.read_bytes() external, prior = json.loads(external_bytes), json.loads(prior_bytes) @@ -85,7 +85,7 @@ def main(external_path: Path, prior_path: Path, output: Path): "b3_e4_f03_bl5_native_nodal_comparator_dev.py").read_bytes()).hexdigest(), "external_sha256": sha256(external_bytes).hexdigest(), "prior_sha256": sha256(prior_bytes).hexdigest(), - "imported_anysolver": str(expected), "cases": [], + "imported_anyfesolver": str(expected), "cases": [], "limitations": ("One 16-interval five-channel P1 space only. " "Reference-linear work/transfer, without the registered " "seven ratios, growing-space stability, locking, " diff --git a/scripts/b3_e4_f03_bl5_retained_work_dev.py b/scripts/b3_e4_f03_bl5_retained_work_dev.py index f77c5bd9b..f9c3884a4 100644 --- a/scripts/b3_e4_f03_bl5_retained_work_dev.py +++ b/scripts/b3_e4_f03_bl5_retained_work_dev.py @@ -12,8 +12,8 @@ from pathlib import Path import subprocess -import anysolver -from anysolver import stiffened_shell +import anyfesolver +from anyfesolver import stiffened_shell import numpy as np from scipy.sparse.linalg import splu from threadpoolctl import threadpool_info, threadpool_limits @@ -91,15 +91,15 @@ def _solve(owner, rows, case, *, owner_rows=False): def main(output: Path): if output.exists(): raise FileExistsError("preserve prior retained-work evidence") - expected = (ROOT / "src" / "anysolver" / "__init__.py").resolve() - if Path(anysolver.__file__).resolve() != expected: + expected = (ROOT / "src" / "anyfesolver" / "__init__.py").resolve() + if Path(anyfesolver.__file__).resolve() != expected: raise RuntimeError("retained-work diagnostic imported another checkout") report = { "status": "BL5_LOADED_RETAINED_WORK_DEVELOPMENT_ONLY", "source_git": subprocess.check_output( ("git", "rev-parse", "HEAD"), cwd=ROOT, text=True).strip(), "runner_sha256": sha256(Path(__file__).read_bytes()).hexdigest(), - "imported_anysolver": str(expected), "cases": [], + "imported_anyfesolver": str(expected), "cases": [], "limitations": ("Work-conjugate algebraic split at one 16-interval " "linear model. Raw retained coordinate/equation norms " "have mixed units and are not physical stability " diff --git a/scripts/b3_e4_f03_bl5_saved_mode_screen.py b/scripts/b3_e4_f03_bl5_saved_mode_screen.py index 0376d7a1a..210671f19 100644 --- a/scripts/b3_e4_f03_bl5_saved_mode_screen.py +++ b/scripts/b3_e4_f03_bl5_saved_mode_screen.py @@ -11,14 +11,14 @@ from pathlib import Path import subprocess -import anysolver +import anyfesolver import numpy as np from threadpoolctl import threadpool_info, threadpool_limits -from anysolver._stiffened_shell_bl5_local_experimental import ( +from anyfesolver._stiffened_shell_bl5_local_experimental import ( BL5LocalOperator, LAW_ID, ) -from anysolver._stiffened_shell_l1_local_experimental import NativeHalfCellPort +from anyfesolver._stiffened_shell_l1_local_experimental import NativeHalfCellPort from scripts.b3_e4_f03_c1_fy_l1_mode_bridge import _recover, _l1_station @@ -182,7 +182,7 @@ def analyze(saved): "saved_source_git": saved["source_git"], "current_source_git": subprocess.check_output( ("git", "rev-parse", "HEAD"), text=True).strip(), - "imported_anysolver": str(Path(anysolver.__file__).resolve()), + "imported_anyfesolver": str(Path(anyfesolver.__file__).resolve()), "station_x_m": stations.tolist(), "station_weights_m": weights.tolist(), "native_bond_halfcell_cuts_m": beam_cuts.tolist(), diff --git a/scripts/b3_e4_f03_bl5_trace_kernel_dev.py b/scripts/b3_e4_f03_bl5_trace_kernel_dev.py index b8270da66..70792713f 100644 --- a/scripts/b3_e4_f03_bl5_trace_kernel_dev.py +++ b/scripts/b3_e4_f03_bl5_trace_kernel_dev.py @@ -15,10 +15,10 @@ from pathlib import Path import subprocess -import anysolver -from anysolver import stiffened_shell -from anysolver._stiffened_shell_l1_local_experimental import NativeHalfCellPort -from anysolver._ge_beam3_retained_generalized_state import Mechanical +import anyfesolver +from anyfesolver import stiffened_shell +from anyfesolver._stiffened_shell_l1_local_experimental import NativeHalfCellPort +from anyfesolver._ge_beam3_retained_generalized_state import Mechanical from scripts._b3_e4_f03_p1_dual_norm import p1_nonuniform_dual_gram import numpy as np from scipy import linalg @@ -178,9 +178,9 @@ def _multiplier_contract_probe(owner): def analyze(): - expected = (ROOT/"src"/"anysolver"/"__init__.py").resolve() - if Path(anysolver.__file__).resolve() != expected: - raise RuntimeError("trace-kernel diagnostic imported another ANYsolver") + expected = (ROOT/"src"/"anyfesolver"/"__init__.py").resolve() + if Path(anyfesolver.__file__).resolve() != expected: + raise RuntimeError("trace-kernel diagnostic imported another ANYfeSolver") base = _bl5_joint_mesh_definition(4, 8, 1) coordinates = tuple((KNOTS[i % 5], xyz[1], xyz[2]) for i, xyz in enumerate(base.shell.coordinates_m)) @@ -229,9 +229,9 @@ def analyze(): "source_git": subprocess.check_output( ("git", "rev-parse", "HEAD"), cwd=ROOT, text=True).strip(), "runner_sha256": sha256(Path(__file__).read_bytes()).hexdigest(), - "product_sha256": sha256((ROOT/"src"/"anysolver"/ + "product_sha256": sha256((ROOT/"src"/"anyfesolver"/ "_stiffened_shell_l1_assembly_experimental.py").read_bytes()).hexdigest(), - "imported_anysolver": str(expected), + "imported_anyfesolver": str(expected), "threadpools": pools, "fixture": {"shell_knots_m": KNOTS, "beam_halfcells": 8, "surface_width_m": WIDTH_M, diff --git a/scripts/b3_e4_f03_c1_director_compensation.py b/scripts/b3_e4_f03_c1_director_compensation.py index 38a05f482..71f22766e 100644 --- a/scripts/b3_e4_f03_c1_director_compensation.py +++ b/scripts/b3_e4_f03_c1_director_compensation.py @@ -14,7 +14,7 @@ import numpy as np -from anysolver.corotational import rotation_matrix_from_vector +from anyfesolver.corotational import rotation_matrix_from_vector from scripts._b3_e4_f03_native_fixture import build from scripts.b3_e4_f03_distributed_surface_finite import FiniteSurfaceLineHybrid from scripts.b3_e4_f03_plate_patch_work import local_grid, raw_e4_tangent diff --git a/scripts/b3_e4_f03_c1_fy_l1_mode_bridge.py b/scripts/b3_e4_f03_c1_fy_l1_mode_bridge.py index 4eb553843..c9ab785a7 100644 --- a/scripts/b3_e4_f03_c1_fy_l1_mode_bridge.py +++ b/scripts/b3_e4_f03_c1_fy_l1_mode_bridge.py @@ -11,7 +11,7 @@ from pathlib import Path import subprocess -import anysolver +import anyfesolver import numpy as np from scipy import linalg from threadpoolctl import threadpool_info, threadpool_limits @@ -190,7 +190,7 @@ def analyze(saved: dict) -> dict: "source_git_of_mode": saved["source_git"], "current_source_git": subprocess.check_output( ("git", "rev-parse", "HEAD"), text=True).strip(), - "imported_anysolver": str(Path(anysolver.__file__).resolve()), + "imported_anyfesolver": str(Path(anyfesolver.__file__).resolve()), "mode_action_work_shell": saved["shell_work_sq"], "mode_action_work_beam": saved["beam_work_sq"], "physical_core_shell_quadratic_j": shell_energy, diff --git a/scripts/b3_e4_f03_c1_fy_rotation_mode_diagnostic.py b/scripts/b3_e4_f03_c1_fy_rotation_mode_diagnostic.py index 50ef3d2f7..163daccf8 100644 --- a/scripts/b3_e4_f03_c1_fy_rotation_mode_diagnostic.py +++ b/scripts/b3_e4_f03_c1_fy_rotation_mode_diagnostic.py @@ -9,7 +9,7 @@ import subprocess from time import monotonic -import anysolver +import anyfesolver import numpy as np from scipy import linalg from threadpoolctl import threadpool_info, threadpool_limits @@ -31,8 +31,8 @@ def evaluate() -> dict: started = monotonic() deadline = started + 120. source = Path(__file__).resolve().parents[1] - if Path(anysolver.__file__).resolve().parent != (source / "src" / "anysolver").resolve(): - raise RuntimeError("wrong ANYsolver checkout") + if Path(anyfesolver.__file__).resolve().parent != (source / "src" / "anyfesolver").resolve(): + raise RuntimeError("wrong ANYfeSolver checkout") xs, ys = local_grid(8, transverse_cells=4) shell, _ = raw_e4_tangent(xs, ys, thickness=.035) beam = build(14, z_offset=.0675, @@ -122,7 +122,7 @@ def block(metric, axis, count): return { "status": "DEVELOPMENT_DIAGNOSTIC_COMPLETE", "source_git": subprocess.check_output(["git", "rev-parse", "HEAD"], text=True).strip(), "runner_sha256": _digest(Path(__file__)), "base_runner_sha256": _digest(source / "scripts" / "b3_e4_f03_c1_material_line_mixed_metric.py"), - "imported_anysolver": str(Path(anysolver.__file__).resolve()), + "imported_anyfesolver": str(Path(anyfesolver.__file__).resolve()), "rows": total_rows, "constraint_rows": len(C), "beam_bond_halves": bonded, "beam_layout": beam_layout, "beta": float(singular[-1]), "dual_norm_sq": dual_norm, "shell_work_sq": shell_work, "beam_work_sq": beam_work, diff --git a/scripts/b3_e4_f03_c1_fy_supported_native.py b/scripts/b3_e4_f03_c1_fy_supported_native.py index c46e477e1..07f560dc7 100644 --- a/scripts/b3_e4_f03_c1_fy_supported_native.py +++ b/scripts/b3_e4_f03_c1_fy_supported_native.py @@ -13,7 +13,7 @@ import subprocess from time import monotonic -import anysolver +import anyfesolver import numpy as np from scipy import sparse from threadpoolctl import threadpool_info, threadpool_limits @@ -117,8 +117,8 @@ def one_case(xs, ys, shell_k, beam_halves: int) -> dict: def evaluate() -> dict: source = Path(__file__).resolve().parents[1] - if Path(anysolver.__file__).resolve().parent != (source / "src" / "anysolver").resolve(): - raise RuntimeError("bounded Fy runner imported another ANYsolver checkout") + if Path(anyfesolver.__file__).resolve().parent != (source / "src" / "anyfesolver").resolve(): + raise RuntimeError("bounded Fy runner imported another ANYfeSolver checkout") xs, ys = local_grid(8, transverse_cells=4) shell_k, _ = raw_e4_tangent(xs, ys, thickness=.035) return { @@ -126,7 +126,7 @@ def evaluate() -> dict: "classification": "loaded native selective-fz line, not physical law or multiplier qualification", "source_git": subprocess.check_output(("git", "rev-parse", "HEAD"), text=True).strip(), "source_sha256": digest(Path(__file__)), - "imported_anysolver": str(Path(anysolver.__file__).resolve()), + "imported_anyfesolver": str(Path(anyfesolver.__file__).resolve()), "physical_model": "x8/y4 35 mm Q4 plate, square generalized B3 with C1 2 um reference, left shell and B3 root fixed, x=.9-1 m line", "load": "+100 N Fy at native beam tip reference axis", "cases": [one_case(xs, ys, shell_k, halves) for halves in (18, 14)], diff --git a/scripts/b3_e4_f03_c1_material_line_loaded_drill_quotient.py b/scripts/b3_e4_f03_c1_material_line_loaded_drill_quotient.py index 9b947cbf3..254c82678 100644 --- a/scripts/b3_e4_f03_c1_material_line_loaded_drill_quotient.py +++ b/scripts/b3_e4_f03_c1_material_line_loaded_drill_quotient.py @@ -16,7 +16,7 @@ from time import monotonic import warnings -import anysolver +import anyfesolver import numpy as np import scipy from scipy import linalg, sparse @@ -82,9 +82,9 @@ def evaluate(*, shell_cells: int = 16, raise ValueError("bounded x16/B3-14/m8 Mx space comparison required") if mode_resolved_mx_only and (beam_half_cells, p0_intervals) not in ((14, 4), (14, 8)): raise ValueError("bounded fixed-4:1 x16/B3-14 P0 mode required") - expected = (Path(__file__).resolve().parents[1]/"src"/"anysolver").resolve() - if Path(anysolver.__file__).resolve().parent != expected: - raise RuntimeError("bounded quotient imported another ANYsolver checkout") + expected = (Path(__file__).resolve().parents[1]/"src"/"anyfesolver").resolve() + if Path(anyfesolver.__file__).resolve().parent != expected: + raise RuntimeError("bounded quotient imported another ANYfeSolver checkout") started = monotonic() xs, ys = local_grid(shell_cells, transverse_cells=4) shell, shell_physical_operator = raw_e4_tangent(xs, ys, thickness=.035) @@ -307,7 +307,7 @@ def evaluate(*, shell_cells: int = 16, "no physical connection accuracy or multiplier-space selection"], "provenance": { "python": sys.version.split()[0], "numpy": np.__version__, - "scipy": scipy.__version__, "anysolver_import": str(Path(anysolver.__file__).resolve()), + "scipy": scipy.__version__, "anyfesolver_import": str(Path(anyfesolver.__file__).resolve()), "threadpools": threadpool_info(), "env": {key: os.environ.get(key) for key in ("NUMBA_DISABLE_JIT", "OPENBLAS_NUM_THREADS", "OMP_NUM_THREADS", "MKL_NUM_THREADS")}, diff --git a/scripts/b3_e4_f03_c1_material_line_mixed_metric.py b/scripts/b3_e4_f03_c1_material_line_mixed_metric.py index 56e562171..2983ec38f 100644 --- a/scripts/b3_e4_f03_c1_material_line_mixed_metric.py +++ b/scripts/b3_e4_f03_c1_material_line_mixed_metric.py @@ -15,7 +15,7 @@ import subprocess from time import monotonic -import anysolver +import anyfesolver import numpy as np from scipy import linalg from threadpoolctl import threadpool_info, threadpool_limits @@ -100,9 +100,9 @@ def evaluate(shell_cells: int, kind: str, *, exact_drill_quotient: bool = False, if fz_riesz_audit and not (trace_only and exact_drill_quotient and kind == "piecewise_constant"): raise ValueError("fz audit requires exact-quotient P0 trace metric") - expected = (Path(__file__).resolve().parents[1]/"src"/"anysolver").resolve() - if Path(anysolver.__file__).resolve().parent != expected: - raise RuntimeError("mixed metric imported another ANYsolver checkout") + expected = (Path(__file__).resolve().parents[1]/"src"/"anyfesolver").resolve() + if Path(anyfesolver.__file__).resolve().parent != expected: + raise RuntimeError("mixed metric imported another ANYfeSolver checkout") start = monotonic() deadline = start+120. xs, ys = local_grid(shell_cells, transverse_cells=4) @@ -352,7 +352,7 @@ def evaluate(shell_cells: int, kind: str, *, exact_drill_quotient: bool = False, "runner_sha256": _hash(Path(__file__)), "source_git": subprocess.check_output( ["git", "rev-parse", "HEAD"], text=True).strip(), - "imported_anysolver": str(Path(anysolver.__file__).resolve()), + "imported_anyfesolver": str(Path(anyfesolver.__file__).resolve()), "effective_threadpools": threadpool_info(), "env": {name: os.environ.get(name) for name in ( "NUMBA_DISABLE_JIT", "OPENBLAS_NUM_THREADS", "OMP_NUM_THREADS")}, diff --git a/scripts/b3_e4_f03_c1_material_line_ratio_screen.py b/scripts/b3_e4_f03_c1_material_line_ratio_screen.py index bff185071..86b7b6261 100644 --- a/scripts/b3_e4_f03_c1_material_line_ratio_screen.py +++ b/scripts/b3_e4_f03_c1_material_line_ratio_screen.py @@ -15,7 +15,7 @@ import sys from time import monotonic -import anysolver +import anyfesolver import numpy as np import scipy from threadpoolctl import threadpool_info, threadpool_limits @@ -46,9 +46,9 @@ def evaluate(*, selective_yaw: bool = False) -> dict: - expected = (Path(__file__).resolve().parents[1]/"src"/"anysolver").resolve() - if Path(anysolver.__file__).resolve().parent != expected: - raise RuntimeError("ratio screen imported another ANYsolver checkout") + expected = (Path(__file__).resolve().parents[1]/"src"/"anyfesolver").resolve() + if Path(anyfesolver.__file__).resolve().parent != expected: + raise RuntimeError("ratio screen imported another ANYfeSolver checkout") started = monotonic() deadline = started+120. cases = {} @@ -136,8 +136,8 @@ def evaluate(*, selective_yaw: bool = False) -> dict: "source_git": subprocess.check_output( ("git", "rev-parse", "HEAD"), text=True).strip(), "python": sys.version.split()[0], "numpy": np.__version__, - "scipy": scipy.__version__, "anysolver_import_path": str( - Path(anysolver.__file__).resolve()), + "scipy": scipy.__version__, "anyfesolver_import_path": str( + Path(anyfesolver.__file__).resolve()), "effective_threadpools": threadpool_info(), "env": {k: os.environ.get(k) for k in ("NUMBA_DISABLE_JIT", "OPENBLAS_NUM_THREADS", "OMP_NUM_THREADS")}, @@ -146,9 +146,9 @@ def evaluate(*, selective_yaw: bool = False) -> dict: def evaluate_yaw_resolution(*, four_to_one: bool = False) -> dict: """Fixed-primal yaw row/work screen, including the 4:1 missing mode.""" - expected = (Path(__file__).resolve().parents[1]/"src"/"anysolver").resolve() - if Path(anysolver.__file__).resolve().parent != expected: - raise RuntimeError("yaw screen imported another ANYsolver checkout") + expected = (Path(__file__).resolve().parents[1]/"src"/"anyfesolver").resolve() + if Path(anyfesolver.__file__).resolve().parent != expected: + raise RuntimeError("yaw screen imported another ANYfeSolver checkout") started = monotonic() shell_cells = 16 if four_to_one else 8 beam_half_cells = 14 if four_to_one else 18 @@ -280,8 +280,8 @@ def defect(rows, row_basis): "source_git": subprocess.check_output(("git", "rev-parse", "HEAD"), text=True).strip(), "python": sys.version.split()[0], "numpy": np.__version__, - "scipy": scipy.__version__, "anysolver_import_path": str( - Path(anysolver.__file__).resolve()), + "scipy": scipy.__version__, "anyfesolver_import_path": str( + Path(anyfesolver.__file__).resolve()), "effective_threadpools": threadpool_info(), "env": {k: os.environ.get(k) for k in ("NUMBA_DISABLE_JIT", "OPENBLAS_NUM_THREADS", "OMP_NUM_THREADS")}, diff --git a/scripts/b3_e4_f03_ccx_saved_stress_replay.py b/scripts/b3_e4_f03_ccx_saved_stress_replay.py index 388897b36..584b5f382 100644 --- a/scripts/b3_e4_f03_ccx_saved_stress_replay.py +++ b/scripts/b3_e4_f03_ccx_saved_stress_replay.py @@ -25,7 +25,7 @@ BASE=ROOT/'.qualification/b3-ge-e4-pl' SOURCE=BASE/'f03-ccx-c1-preopen-combined-factor5-dev-20260926-v1' GAP=BASE/'f03-c1-factor5-admissible-torque-direction-dev-20260926-v1/result.json' -EXE=Path('C:/Github/ANYsolver/.qualification/b3-ge-e4-pl/calculix-223/CalculiX-2.23.0-win-x64/bin/ccx.exe') +EXE=Path('C:/Github/ANYfeSolver/.qualification/b3-ge-e4-pl/calculix-223/CalculiX-2.23.0-win-x64/bin/ccx.exe') EXPECTED_EXE='27a9426a1ee2f72c38fbe892e0ffaf38e14867628ffd0235770261b6f3ec9c5f' TARGET=BASE/'f03-c1-factor5-stiffener-ip-stress-dev-20260926-v1' STEM='solid-5-tip_mx' diff --git a/scripts/b3_e4_f03_ccx_solid_bond_screen.py b/scripts/b3_e4_f03_ccx_solid_bond_screen.py index 01718e028..789add9b9 100644 --- a/scripts/b3_e4_f03_ccx_solid_bond_screen.py +++ b/scripts/b3_e4_f03_ccx_solid_bond_screen.py @@ -23,7 +23,7 @@ WORKTREE = Path(__file__).resolve().parents[1] -EXE = Path("C:/Github/ANYsolver/.qualification/b3-ge-e4-pl/" +EXE = Path("C:/Github/ANYfeSolver/.qualification/b3-ge-e4-pl/" "calculix-223/CalculiX-2.23.0-win-x64/bin/ccx.exe") EXE_SHA = "27a9426a1ee2f72c38fbe892e0ffaf38e14867628ffd0235770261b6f3ec9c5f" TIMEOUT_SECONDS = 120 diff --git a/scripts/b3_e4_f03_common_trace_finite_work.py b/scripts/b3_e4_f03_common_trace_finite_work.py index b99f4bb7f..9df4601cf 100644 --- a/scripts/b3_e4_f03_common_trace_finite_work.py +++ b/scripts/b3_e4_f03_common_trace_finite_work.py @@ -14,7 +14,7 @@ import numpy as np from threadpoolctl import threadpool_info -from anysolver._ge_beam3_mixed_ad import rotation_exponential +from anyfesolver._ge_beam3_mixed_ad import rotation_exponential from scripts._b3_e4_f03_native_fixture import build from scripts._b3_e4_f03_weak_line_candidate import LineMultiplierSpace from scripts.b3_e4_f03_distributed_surface_finite import FiniteSurfaceMomentPatch diff --git a/scripts/b3_e4_f03_distributed_surface_finite.py b/scripts/b3_e4_f03_distributed_surface_finite.py index 0bad3f96a..9ee5b39b6 100644 --- a/scripts/b3_e4_f03_distributed_surface_finite.py +++ b/scripts/b3_e4_f03_distributed_surface_finite.py @@ -14,9 +14,9 @@ import numpy as np -from anysolver import _ge_beam3_mixed_ad as ad -from anysolver._ge_beam3_mixed_ad import rotation_exponential -from anysolver.corotational import rotation_matrix_from_vector +from anyfesolver import _ge_beam3_mixed_ad as ad +from anyfesolver._ge_beam3_mixed_ad import rotation_exponential +from anyfesolver.corotational import rotation_matrix_from_vector from scripts._b3_e4_f03_native_spatial_port import NativeHalfCellSpatialPort from scripts.b3_e4_f03_local_footprint_work import ( bond_x_segments, distributed_surface_patch_trace, skew, diff --git a/scripts/b3_e4_f03_finite_patch_line_work.py b/scripts/b3_e4_f03_finite_patch_line_work.py index a5a6a8013..fefab1672 100644 --- a/scripts/b3_e4_f03_finite_patch_line_work.py +++ b/scripts/b3_e4_f03_finite_patch_line_work.py @@ -11,7 +11,7 @@ import numpy as np -from anysolver._ge_beam3_pose_joint import RigidPoseJoint +from anyfesolver._ge_beam3_pose_joint import RigidPoseJoint from scripts._b3_e4_f03_native_spatial_port import NativeHalfCellSpatialPort from scripts.b3_e4_f03_finite_patch_pose import FlatQ4FiniteSupportPose from scripts.b3_e4_f03_l1_physical_rail import _owned diff --git a/scripts/b3_e4_f03_finite_patch_pose.py b/scripts/b3_e4_f03_finite_patch_pose.py index 4b96a7a9e..d9f1437ec 100644 --- a/scripts/b3_e4_f03_finite_patch_pose.py +++ b/scripts/b3_e4_f03_finite_patch_pose.py @@ -11,8 +11,8 @@ import numpy as np -from anysolver import _ge_beam3_mixed_ad as ad -from anysolver.corotational import rotation_matrix_from_vector +from anyfesolver import _ge_beam3_mixed_ad as ad +from anyfesolver.corotational import rotation_matrix_from_vector from scripts.b3_e4_f03_l1_physical_rail import ( _owned, _unit, transverse_shape_integrals, ) diff --git a/scripts/b3_e4_f03_l1_candidate_compare.py b/scripts/b3_e4_f03_l1_candidate_compare.py index 424d3ea01..e31a501df 100644 --- a/scripts/b3_e4_f03_l1_candidate_compare.py +++ b/scripts/b3_e4_f03_l1_candidate_compare.py @@ -348,7 +348,7 @@ def run_provenance() -> dict: import subprocess import sys - import anysolver + import anyfesolver import scipy from threadpoolctl import threadpool_info @@ -359,8 +359,8 @@ def run_provenance() -> dict: "scripts/b3_e4_f03_l1_native_connection_probe.py", "scripts/_b3_e4_f03_native_fixture.py", "scripts/b3_e4_f03_plate_patch_work.py", - "src/anysolver/e4_pl_element.py", - "src/anysolver/_ge_beam3_pose_joint.py", + "src/anyfesolver/e4_pl_element.py", + "src/anyfesolver/_ge_beam3_pose_joint.py", ) hashes = {name: hashlib.sha256((root/name).read_bytes()).hexdigest() for name in relevant} @@ -371,7 +371,7 @@ def run_provenance() -> dict: "python": platform.python_version(), "python_executable": sys.executable, "numpy": np.__version__, "scipy": scipy.__version__, - "anysolver_import": str(Path(anysolver.__file__).resolve()), + "anyfesolver_import": str(Path(anyfesolver.__file__).resolve()), "thread_environment": {key: os.getenv(key) for key in ( "OPENBLAS_NUM_THREADS", "OMP_NUM_THREADS", "MKL_NUM_THREADS", "NUMBA_DISABLE_JIT")}, diff --git a/scripts/b3_e4_f03_l1_matched_flat_web.py b/scripts/b3_e4_f03_l1_matched_flat_web.py index 5fb81d2e9..623fc0c05 100644 --- a/scripts/b3_e4_f03_l1_matched_flat_web.py +++ b/scripts/b3_e4_f03_l1_matched_flat_web.py @@ -17,9 +17,9 @@ import scipy from threadpoolctl import threadpool_info -import anysolver -from anysolver import b3_ge, stiffened_shell -from anysolver._stiffened_shell_l1_assembly_experimental import SPACE_A, SPACE_B +import anyfesolver +from anyfesolver import b3_ge, stiffened_shell +from anyfesolver._stiffened_shell_l1_assembly_experimental import SPACE_A, SPACE_B from scripts.b3_e4_f03_ccx_matched_t_reference import ( E_PA, NU, PLATE_T_M, WEB_H_M, WEB_T_M, _section, ) @@ -162,7 +162,7 @@ def evaluate() -> dict: "source_sha256": sha256(Path(__file__).read_bytes()).hexdigest(), "runtime": {"python": sys.version.split()[0], "numpy": np.__version__, "scipy": scipy.__version__, - "anysolver_import": str(Path(anysolver.__file__).resolve()), + "anyfesolver_import": str(Path(anyfesolver.__file__).resolve()), "effective_threadpools": [ {"internal_api": pool.get("internal_api"), "num_threads": pool.get("num_threads")} diff --git a/scripts/b3_e4_f03_l1_native_connection_probe.py b/scripts/b3_e4_f03_l1_native_connection_probe.py index 1347b03dd..6f4b9375c 100644 --- a/scripts/b3_e4_f03_l1_native_connection_probe.py +++ b/scripts/b3_e4_f03_l1_native_connection_probe.py @@ -13,9 +13,9 @@ from dataclasses import dataclass import numpy as np -from anysolver import _ge_beam3_mixed_ad as ad -from anysolver._ge_beam3_pose_joint import RigidPoseJoint -from anysolver.corotational import rotation_matrix_from_vector +from anyfesolver import _ge_beam3_mixed_ad as ad +from anyfesolver._ge_beam3_pose_joint import RigidPoseJoint +from anyfesolver.corotational import rotation_matrix_from_vector from scripts._b3_e4_f03_native_spatial_port import NativeHalfCellSpatialPort diff --git a/scripts/b3_e4_f03_l1_physical_rail.py b/scripts/b3_e4_f03_l1_physical_rail.py index 3630de567..97f8841b4 100644 --- a/scripts/b3_e4_f03_l1_physical_rail.py +++ b/scripts/b3_e4_f03_l1_physical_rail.py @@ -13,9 +13,9 @@ import numpy as np -from anysolver import _ge_beam3_mixed_ad as ad -from anysolver._ge_beam3_pose_joint import RigidPoseJoint -from anysolver.corotational import rotation_matrix_from_vector +from anyfesolver import _ge_beam3_mixed_ad as ad +from anyfesolver._ge_beam3_pose_joint import RigidPoseJoint +from anyfesolver.corotational import rotation_matrix_from_vector from scripts._b3_e4_f03_native_spatial_port import NativeHalfCellSpatialPort from scripts.b3_e4_f03_l1_native_connection_probe import _jet_cross, _jet_unit diff --git a/scripts/b3_e4_f03_l1_uncoupled_flat_controls.py b/scripts/b3_e4_f03_l1_uncoupled_flat_controls.py index f0c90a32b..6d95a2ed5 100644 --- a/scripts/b3_e4_f03_l1_uncoupled_flat_controls.py +++ b/scripts/b3_e4_f03_l1_uncoupled_flat_controls.py @@ -15,8 +15,8 @@ from scipy.sparse import linalg as spla from threadpoolctl import threadpool_info -from anysolver import stiffened_shell -from anysolver._stiffened_shell_l1_assembly_experimental import SPACE_B +from anyfesolver import stiffened_shell +from anyfesolver._stiffened_shell_l1_assembly_experimental import SPACE_B from scripts.b3_e4_f03_l1_matched_flat_web import build from scripts.b3_e4_f03_ccx_matched_t_reference import PLATE_T_M diff --git a/scripts/b3_e4_f03_local_footprint_work.py b/scripts/b3_e4_f03_local_footprint_work.py index 410de3efa..68c8f970a 100644 --- a/scripts/b3_e4_f03_local_footprint_work.py +++ b/scripts/b3_e4_f03_local_footprint_work.py @@ -17,8 +17,8 @@ from scipy.sparse.linalg import spsolve from threadpoolctl import threadpool_info, threadpool_limits -from anysolver._ge_beam3_mixed_ad import Jet2, matvec, so3_exp, transpose -from anysolver._ge_beam3_pose_joint import RigidPoseJoint +from anyfesolver._ge_beam3_mixed_ad import Jet2, matvec, so3_exp, transpose +from anyfesolver._ge_beam3_pose_joint import RigidPoseJoint from scripts._b3_e4_f03_coupled_point_work_candidate import directional_point_work from scripts._b3_e4_f03_e4_trial_panel import FlatE4TrialPanel from scripts._b3_e4_f03_native_fixture import SECTION_DIAGONAL, build diff --git a/scripts/b3_e4_f03_material_line_channel_screen.py b/scripts/b3_e4_f03_material_line_channel_screen.py index 3d4bdb041..0df90fbaf 100644 --- a/scripts/b3_e4_f03_material_line_channel_screen.py +++ b/scripts/b3_e4_f03_material_line_channel_screen.py @@ -14,7 +14,7 @@ import subprocess import sys -import anysolver +import anyfesolver import numpy as np import scipy from scipy import sparse @@ -329,10 +329,10 @@ def _one_topology(xs, ys, beam, *, mixed_s3: bool, def run(*, off_edge: bool = False) -> dict: - expected = (Path(__file__).resolve().parents[1]/"src"/"anysolver").resolve() - actual = Path(anysolver.__file__).resolve().parent + expected = (Path(__file__).resolve().parents[1]/"src"/"anyfesolver").resolve() + actual = Path(anyfesolver.__file__).resolve().parent if actual != expected: - raise RuntimeError("channel screen imported another ANYsolver checkout") + raise RuntimeError("channel screen imported another ANYfeSolver checkout") xs, ys = local_grid(2, transverse_cells=4) if off_edge: ys = ys.copy() @@ -354,7 +354,7 @@ def run(*, off_edge: bool = False) -> dict: return { "classification": "private channel-compatible material-line loaded screen", "qualification": "development only; no multiplier selection or G0B pass", - "anysolver_import_path": str(Path(anysolver.__file__).resolve()), + "anyfesolver_import_path": str(Path(anyfesolver.__file__).resolve()), "python_version": sys.version.split()[0], "numpy_version": np.__version__, "scipy_version": scipy.__version__, @@ -371,9 +371,9 @@ def run(*, off_edge: bool = False) -> dict: def run_beam_trace() -> dict: - expected = (Path(__file__).resolve().parents[1]/"src"/"anysolver").resolve() - if Path(anysolver.__file__).resolve().parent != expected: - raise RuntimeError("beam-trace screen imported another ANYsolver checkout") + expected = (Path(__file__).resolve().parents[1]/"src"/"anyfesolver").resolve() + if Path(anyfesolver.__file__).resolve().parent != expected: + raise RuntimeError("beam-trace screen imported another ANYfeSolver checkout") xs, ys = local_grid(8, transverse_cells=4) beam = build(12, z_offset=.0675, torsion_constant=square_torsion_constant(), @@ -381,7 +381,7 @@ def run_beam_trace() -> dict: return { "classification": "private fixed-primal joint native-trace image screen", "qualification": "development only; no multiplier selection or G0B pass", - "anysolver_import_path": str(Path(anysolver.__file__).resolve()), + "anyfesolver_import_path": str(Path(anyfesolver.__file__).resolve()), "python_version": sys.version.split()[0], "numpy_version": np.__version__, "scipy_version": scipy.__version__, @@ -399,9 +399,9 @@ def run_beam_trace() -> dict: def run_shell_trace() -> dict: root = Path(__file__).resolve().parents[1] - expected = (root/"src"/"anysolver").resolve() - if Path(anysolver.__file__).resolve().parent != expected: - raise RuntimeError("shell-trace screen imported another ANYsolver checkout") + expected = (root/"src"/"anyfesolver").resolve() + if Path(anyfesolver.__file__).resolve().parent != expected: + raise RuntimeError("shell-trace screen imported another ANYfeSolver checkout") source_paths = ( "scripts/b3_e4_f03_material_line_channel_screen.py", "scripts/b3_e4_f03_material_line_loaded.py", @@ -417,7 +417,7 @@ def run_shell_trace() -> dict: return { "classification": "private fixed-primal shell-side trace image screen", "qualification": "development only; no multiplier selection or G0B pass", - "anysolver_import_path": str(Path(anysolver.__file__).resolve()), + "anyfesolver_import_path": str(Path(anyfesolver.__file__).resolve()), "python_version": sys.version.split()[0], "numpy_version": np.__version__, "scipy_version": scipy.__version__, @@ -439,9 +439,9 @@ def run_shell_trace() -> dict: def run_complete_trace() -> dict: root = Path(__file__).resolve().parents[1] - expected = (root/"src"/"anysolver").resolve() - if Path(anysolver.__file__).resolve().parent != expected: - raise RuntimeError("complete-trace screen imported another ANYsolver checkout") + expected = (root/"src"/"anyfesolver").resolve() + if Path(anyfesolver.__file__).resolve().parent != expected: + raise RuntimeError("complete-trace screen imported another ANYfeSolver checkout") source_paths = ( "scripts/b3_e4_f03_material_line_channel_screen.py", "scripts/b3_e4_f03_material_line_loaded.py", @@ -459,7 +459,7 @@ def run_complete_trace() -> dict: return { "classification": "private fixed-primal maximal two-sided trace image screen", "qualification": "development only; no multiplier selection or G0B pass", - "anysolver_import_path": str(Path(anysolver.__file__).resolve()), + "anyfesolver_import_path": str(Path(anyfesolver.__file__).resolve()), "python_version": sys.version.split()[0], "numpy_version": np.__version__, "scipy_version": scipy.__version__, diff --git a/scripts/b3_e4_f03_material_line_loaded.py b/scripts/b3_e4_f03_material_line_loaded.py index 140a86908..26e6f07f9 100644 --- a/scripts/b3_e4_f03_material_line_loaded.py +++ b/scripts/b3_e4_f03_material_line_loaded.py @@ -13,7 +13,7 @@ import sys import warnings -import anysolver +import anyfesolver import numpy as np import scipy from scipy import sparse @@ -113,10 +113,10 @@ def _solve(primal: sparse.csr_matrix, residual: np.ndarray, def run() -> dict: expected_package = (Path(__file__).resolve().parents[1] - /"src"/"anysolver").resolve() - actual_package = Path(anysolver.__file__).resolve().parent + /"src"/"anyfesolver").resolve() + actual_package = Path(anyfesolver.__file__).resolve().parent if actual_package != expected_package: - raise RuntimeError("bounded loaded screen imported another ANYsolver checkout") + raise RuntimeError("bounded loaded screen imported another ANYfeSolver checkout") xs, ys = local_grid(2, transverse_cells=4) beam = build(12, z_offset=.0675, torsion_constant=square_torsion_constant(), @@ -210,7 +210,7 @@ def run() -> dict: "classification": "private same-primal provisional-P0 loaded discriminator", "scope": "Q4 35 mm C1 E4/native retained generalized B3, two loads", "qualification": "development only; F03 and G0B remain open", - "anysolver_import_path": str(Path(anysolver.__file__).resolve()), + "anyfesolver_import_path": str(Path(anyfesolver.__file__).resolve()), "python_version": sys.version.split()[0], "numpy_version": np.__version__, "scipy_version": scipy.__version__, diff --git a/scripts/b3_e4_f03_material_line_ratio_screen.py b/scripts/b3_e4_f03_material_line_ratio_screen.py index 649dddb46..486598cc0 100644 --- a/scripts/b3_e4_f03_material_line_ratio_screen.py +++ b/scripts/b3_e4_f03_material_line_ratio_screen.py @@ -12,7 +12,7 @@ from pathlib import Path import sys -import anysolver +import anyfesolver import numpy as np import scipy @@ -23,10 +23,10 @@ def run() -> dict: - expected = (Path(__file__).resolve().parents[1]/"src"/"anysolver").resolve() - actual = Path(anysolver.__file__).resolve().parent + expected = (Path(__file__).resolve().parents[1]/"src"/"anyfesolver").resolve() + actual = Path(anyfesolver.__file__).resolve().parent if actual != expected: - raise RuntimeError("ratio screen imported another ANYsolver checkout") + raise RuntimeError("ratio screen imported another ANYfeSolver checkout") knots = (0., .25, .5, .75, 1.) results = {} for label, shell_cells, beam_half_cells in ( @@ -63,7 +63,7 @@ def run() -> dict: return { "classification": "private first reciprocal material-line ratio screen", "qualification": "development only; not mesh-uniform stability or G0B pass", - "anysolver_import_path": str(Path(anysolver.__file__).resolve()), + "anyfesolver_import_path": str(Path(anyfesolver.__file__).resolve()), "python_version": sys.version.split()[0], "numpy_version": np.__version__, "scipy_version": scipy.__version__, diff --git a/scripts/b3_e4_f03_material_line_space_screen.py b/scripts/b3_e4_f03_material_line_space_screen.py index 508d58c66..700b1d083 100644 --- a/scripts/b3_e4_f03_material_line_space_screen.py +++ b/scripts/b3_e4_f03_material_line_space_screen.py @@ -15,7 +15,7 @@ import subprocess import sys -import anysolver +import anyfesolver import numpy as np import scipy from scipy import sparse @@ -142,10 +142,10 @@ def run(*, shell_cells: int = 2, beam_half_cells: int = 12, if mode_resolved_mx_only and (not policy_p0_only or (shell_cells, beam_half_cells) != (8, 12)): raise ValueError("bounded fixed-4:1 x8/B3-12 P0 mode required") - expected = (Path(__file__).resolve().parents[1]/"src"/"anysolver").resolve() - actual = Path(anysolver.__file__).resolve().parent + expected = (Path(__file__).resolve().parents[1]/"src"/"anyfesolver").resolve() + actual = Path(anyfesolver.__file__).resolve().parent if actual != expected: - raise RuntimeError("line-space screen imported another ANYsolver checkout") + raise RuntimeError("line-space screen imported another ANYfeSolver checkout") xs, ys = local_grid(shell_cells, transverse_cells=4) beam = build(beam_half_cells, z_offset=.0675, torsion_constant=square_torsion_constant(), @@ -314,7 +314,7 @@ def run(*, shell_cells: int = 2, beam_half_cells: int = 12, "runner_sha256": hashlib.sha256(Path(__file__).read_bytes()).hexdigest(), "source_git": subprocess.check_output( ("git", "rev-parse", "HEAD"), text=True).strip(), - "anysolver_import_path": str(Path(anysolver.__file__).resolve()), + "anyfesolver_import_path": str(Path(anyfesolver.__file__).resolve()), "python_version": sys.version.split()[0], "numpy_version": np.__version__, "scipy_version": scipy.__version__, diff --git a/scripts/b3_e4_f03_paired_refinement_screen.py b/scripts/b3_e4_f03_paired_refinement_screen.py index 5cab2b6d5..675aa0e4d 100644 --- a/scripts/b3_e4_f03_paired_refinement_screen.py +++ b/scripts/b3_e4_f03_paired_refinement_screen.py @@ -10,7 +10,7 @@ import numpy as np from threadpoolctl import threadpool_info -import anysolver +import anyfesolver from scripts.b3_e4_f03_l1_physical_rail import transverse_shape_integrals from scripts.b3_e4_f03_plate_patch_work import raw_e4_tangent @@ -70,12 +70,12 @@ def screen(full_x_cells: int, transverse_cells: int) -> dict: if __name__ == "__main__": - expected = (Path(__file__).resolve().parents[1]/"src"/"anysolver").resolve() - actual = Path(anysolver.__file__).resolve().parent + expected = (Path(__file__).resolve().parents[1]/"src"/"anyfesolver").resolve() + actual = Path(anyfesolver.__file__).resolve().parent if actual != expected: - raise RuntimeError("paired screen imported another ANYsolver checkout") + raise RuntimeError("paired screen imported another ANYfeSolver checkout") print(json.dumps({"kind": "environment", "threadpools": threadpool_info(), - "imported_anysolver": str(actual)}), + "imported_anyfesolver": str(actual)}), flush=True) for nx, ny in ((8, 2), (16, 4), (32, 8)): print(json.dumps({"kind": "screen", **screen(nx, ny)}), flush=True) diff --git a/scripts/b3_e4_f03_paired_six_channel_work_screen.py b/scripts/b3_e4_f03_paired_six_channel_work_screen.py index 0855c4442..0f5a18139 100644 --- a/scripts/b3_e4_f03_paired_six_channel_work_screen.py +++ b/scripts/b3_e4_f03_paired_six_channel_work_screen.py @@ -10,7 +10,7 @@ import time from pathlib import Path -import anysolver +import anyfesolver import numpy as np from scipy import linalg from threadpoolctl import threadpool_info @@ -115,12 +115,12 @@ def screen(full_x_cells: int, transverse_cells: int) -> dict: if __name__ == "__main__": - expected = (Path(__file__).resolve().parents[1] / "src" / "anysolver").resolve() - actual = Path(anysolver.__file__).resolve().parent + expected = (Path(__file__).resolve().parents[1] / "src" / "anyfesolver").resolve() + actual = Path(anyfesolver.__file__).resolve().parent if actual != expected: - raise RuntimeError("six-channel screen imported another ANYsolver checkout") + raise RuntimeError("six-channel screen imported another ANYfeSolver checkout") print(json.dumps({"kind": "environment", "threadpools": threadpool_info(), - "imported_anysolver": str(actual)}), flush=True) + "imported_anyfesolver": str(actual)}), flush=True) for nx, ny in ((8, 2), (16, 4)): print(json.dumps({"kind": "six_channel_work_screen", **screen(nx, ny)}), flush=True) diff --git a/scripts/b3_e4_f03_paired_yaw_upper_screen.py b/scripts/b3_e4_f03_paired_yaw_upper_screen.py index 484c02890..f53449714 100644 --- a/scripts/b3_e4_f03_paired_yaw_upper_screen.py +++ b/scripts/b3_e4_f03_paired_yaw_upper_screen.py @@ -11,7 +11,7 @@ import numpy as np from scipy import linalg from threadpoolctl import threadpool_info -import anysolver +import anyfesolver from scripts.b3_e4_f03_l1_physical_rail import transverse_shape_integrals from scripts.b3_e4_f03_plate_patch_work import raw_e4_tangent @@ -87,12 +87,12 @@ def screen(full_x_cells: int, transverse_cells: int) -> dict: if __name__ == "__main__": - expected = (Path(__file__).resolve().parents[1]/"src"/"anysolver").resolve() - actual = Path(anysolver.__file__).resolve().parent + expected = (Path(__file__).resolve().parents[1]/"src"/"anyfesolver").resolve() + actual = Path(anyfesolver.__file__).resolve().parent if actual != expected: - raise RuntimeError("yaw screen imported another ANYsolver checkout") + raise RuntimeError("yaw screen imported another ANYfeSolver checkout") print(json.dumps({"kind": "environment", "threadpools": threadpool_info(), - "imported_anysolver": str(actual)}), + "imported_anyfesolver": str(actual)}), flush=True) for nx, ny in ((8, 2), (16, 4)): print(json.dumps({"kind": "yaw_upper_screen", **screen(nx, ny)}), diff --git a/scripts/b3_e4_f03_patch_vs_rail_loaded.py b/scripts/b3_e4_f03_patch_vs_rail_loaded.py index e8580afbe..0360df1de 100644 --- a/scripts/b3_e4_f03_patch_vs_rail_loaded.py +++ b/scripts/b3_e4_f03_patch_vs_rail_loaded.py @@ -12,7 +12,7 @@ import os from pathlib import Path -import anysolver +import anyfesolver import numpy as np from scipy import sparse from threadpoolctl import threadpool_info @@ -68,8 +68,8 @@ def _patch_rows(line: FinitePatchLineFirstVariation) -> np.ndarray: def evaluate() -> dict: expected_package = (Path(__file__).resolve().parents[1] / - "src" / "anysolver").resolve() - actual_package = Path(anysolver.__file__).resolve().parent + "src" / "anyfesolver").resolve() + actual_package = Path(anyfesolver.__file__).resolve().parent if actual_package != expected_package: raise RuntimeError("loaded comparison imported another checkout") @@ -220,7 +220,7 @@ def port_at(station): } return { "classification": "bounded same-model development comparison; no F03 acceptance", - "imported_anysolver": str(actual_package), + "imported_anyfesolver": str(actual_package), "numerical_thread_environment": { name: os.getenv(name) for name in ( "OPENBLAS_NUM_THREADS", "OMP_NUM_THREADS", "MKL_NUM_THREADS")}, diff --git a/scripts/b3_e4_f03_physical_rail_loaded_screen.py b/scripts/b3_e4_f03_physical_rail_loaded_screen.py index f7afc7dbf..5acf851a4 100644 --- a/scripts/b3_e4_f03_physical_rail_loaded_screen.py +++ b/scripts/b3_e4_f03_physical_rail_loaded_screen.py @@ -13,7 +13,7 @@ import numpy as np from scipy import sparse -import anysolver +import anyfesolver from scripts._b3_e4_f03_native_fixture import build from scripts._b3_e4_f03_native_spatial_port import NativeHalfCellSpatialPort @@ -58,10 +58,10 @@ def fixture_identity(xs, ys, bond_start, thickness, beam_offset, beam, def evaluate() -> dict: expected_package = (Path(__file__).resolve().parents[1] - / "src" / "anysolver").resolve() - actual_package = Path(anysolver.__file__).resolve().parent + / "src" / "anyfesolver").resolve() + actual_package = Path(anyfesolver.__file__).resolve().parent if actual_package != expected_package: - raise RuntimeError("loaded screen imported another ANYsolver checkout") + raise RuntimeError("loaded screen imported another ANYfeSolver checkout") xs = np.linspace(0., 1., 9) ys = np.array((-.1, 0., .1)) bond_start = 4 @@ -200,7 +200,7 @@ def port_at(station): "beam_axis_z_m": .0675, "native_beam_root": "free", "shell_x0_edge": "fixed", - "imported_anysolver": str(actual_package), + "imported_anyfesolver": str(actual_package), "integrated_reference_map_error": map_error, "cases": cases, "limitations": [ diff --git a/scripts/b3_e4_f03_plate_patch_work.py b/scripts/b3_e4_f03_plate_patch_work.py index f993ea80b..ac6b5aa72 100644 --- a/scripts/b3_e4_f03_plate_patch_work.py +++ b/scripts/b3_e4_f03_plate_patch_work.py @@ -19,9 +19,9 @@ import numpy as np from threadpoolctl import threadpool_info, threadpool_limits -from anysolver.corotational import corotational_element_response -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEModel +from anyfesolver.corotational import corotational_element_response +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEModel from scripts._b3_e4_f03_e4_trial_panel import FlatE4TrialPanel from scripts._b3_e4_f03_shell_finite_pose_candidate import reference_nodes from scripts._b3_e4_f03_shell_spatial_linear_port import physical_shell_stiffness diff --git a/scripts/b3_e4_f03_saved_mode_patch_work.py b/scripts/b3_e4_f03_saved_mode_patch_work.py index 9d6da13e2..de3a026d5 100644 --- a/scripts/b3_e4_f03_saved_mode_patch_work.py +++ b/scripts/b3_e4_f03_saved_mode_patch_work.py @@ -12,7 +12,7 @@ from math import fsum from pathlib import Path -import anysolver +import anyfesolver import numpy as np from threadpoolctl import threadpool_info, threadpool_limits @@ -42,8 +42,8 @@ def _density(saved: dict, segment: int) -> np.ndarray: def evaluate(saved: dict, source_path: Path) -> dict: - expected = (Path(__file__).resolve().parents[1] / "src" / "anysolver").resolve() - actual = Path(anysolver.__file__).resolve().parent + expected = (Path(__file__).resolve().parents[1] / "src" / "anyfesolver").resolve() + actual = Path(anyfesolver.__file__).resolve().parent if actual != expected: raise RuntimeError("saved-mode screen imported another checkout") xs, ys, _shell, _physical, beam, _line, qs, qb = _recover(saved) @@ -147,7 +147,7 @@ def port_at(station: float) -> NativeHalfCellSpatialPort: "saved_mode_sha256": sha256(source_path.read_bytes()).hexdigest(), "saved_mode_source_git": saved["source_git"], "historical_mean_row_action_work": historical_work, - "imported_anysolver": str(actual), + "imported_anyfesolver": str(actual), "shell_grid_nodes": len(xs)*len(ys), "native_beam_halfcells": len(beam.context.elements)*2, "bond_segments": patch.segment_count, diff --git a/scripts/b3_e4_f03_weak_line_resolution_screen.py b/scripts/b3_e4_f03_weak_line_resolution_screen.py index eab3db81a..c729aeeee 100644 --- a/scripts/b3_e4_f03_weak_line_resolution_screen.py +++ b/scripts/b3_e4_f03_weak_line_resolution_screen.py @@ -13,7 +13,7 @@ import numpy as np from scipy import linalg -from anysolver._ge_beam3_pose_joint import RigidPoseJoint +from anyfesolver._ge_beam3_pose_joint import RigidPoseJoint from scripts._b3_e4_f03_e4_trial_panel import FlatE4TrialPanel from scripts._b3_e4_f03_native_fixture import build diff --git a/scripts/b3_e4_f05_45n_trial_diagnostic.py b/scripts/b3_e4_f05_45n_trial_diagnostic.py index 3587ddcb2..6fd206b5c 100644 --- a/scripts/b3_e4_f05_45n_trial_diagnostic.py +++ b/scripts/b3_e4_f05_45n_trial_diagnostic.py @@ -22,10 +22,10 @@ ROOT = Path(__file__).resolve().parents[1] sys.path[:0] = [str(ROOT / "src"), str(ROOT / "tests")] -import anysolver -from anysolver import corotational +import anyfesolver +from anyfesolver import corotational from anymaterial import DNVC208MaterialCurve -from anysolver._stiffened_shell_ge_experimental import ExperimentalGEAnalysis +from anyfesolver._stiffened_shell_ge_experimental import ExperimentalGEAnalysis from test_stiffened_shell_ge_finite_experimental import _actions, _panel @@ -83,8 +83,8 @@ def stable(reference, element, u_element): def run(checkpoint: Path, intermediate: float | None = None, *, stable_pullback: bool = False): - expected = (ROOT / "src" / "anysolver" / "__init__.py").resolve() - if Path(anysolver.__file__).resolve() != expected: + expected = (ROOT / "src" / "anyfesolver" / "__init__.py").resolve() + if Path(anyfesolver.__file__).resolve() != expected: raise RuntimeError("diagnostic imported another checkout") if stable_pullback: _install_stable_shell_pullback() diff --git a/scripts/b3_e4_f05_low_yield_step_path.py b/scripts/b3_e4_f05_low_yield_step_path.py index fed5f72c6..9f7effd3e 100644 --- a/scripts/b3_e4_f05_low_yield_step_path.py +++ b/scripts/b3_e4_f05_low_yield_step_path.py @@ -23,13 +23,13 @@ sys.path.insert(0, str(ROOT / "src")) sys.path.insert(0, str(ROOT / "tests")) -import anysolver -from anysolver import corotational +import anyfesolver +from anyfesolver import corotational from anymaterial import DNVC208MaterialCurve -from anysolver._stiffened_shell_ge_experimental import ( +from anyfesolver._stiffened_shell_ge_experimental import ( ExperimentalGEAnalysis, ) -from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver +from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver from test_stiffened_shell_ge_finite_experimental import _actions, _panel @@ -70,8 +70,8 @@ def stable(reference, element, u_element): return local.reshape(-1), rigid, deformed corotational._corotational_deformation_state = stable - expected = (ROOT / "src" / "anysolver" / "__init__.py").resolve() - if Path(anysolver.__file__).resolve() != expected: + expected = (ROOT / "src" / "anyfesolver" / "__init__.py").resolve() + if Path(anyfesolver.__file__).resolve() != expected: raise RuntimeError("step-path probe imported another checkout") base = _panel() pressure = 20_000. @@ -186,7 +186,7 @@ def observed(*args, **kwargs): "classification": "development load-path discriminator; no F05/G3 acceptance", "source_git": subprocess.check_output( ("git", "rev-parse", "HEAD"), cwd=ROOT, text=True).strip(), - "imported_anysolver": str(expected), + "imported_anyfesolver": str(expected), "threadpools": threadpool_info(), "targets": list(targets), "step_n": step_n, diff --git a/scripts/b3_e4_f06_loaded_chart_transport_dev.py b/scripts/b3_e4_f06_loaded_chart_transport_dev.py index ac9a2e8df..13751f37e 100644 --- a/scripts/b3_e4_f06_loaded_chart_transport_dev.py +++ b/scripts/b3_e4_f06_loaded_chart_transport_dev.py @@ -14,9 +14,9 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver import stiffened_shell -from anysolver._stiffened_shell_ge_checkpoint_binary import CHART_MAGIC -from anysolver.e4_pl_s3_state import canonical_json_bytes +from anyfesolver import stiffened_shell +from anyfesolver._stiffened_shell_ge_checkpoint_binary import CHART_MAGIC +from anyfesolver.e4_pl_s3_state import canonical_json_bytes from test_stiffened_shell_ge_experimental import _panel diff --git a/scripts/b3_e4_f06_staged_chart_transport_dev.py b/scripts/b3_e4_f06_staged_chart_transport_dev.py index f9baaa0c3..6165e7c53 100644 --- a/scripts/b3_e4_f06_staged_chart_transport_dev.py +++ b/scripts/b3_e4_f06_staged_chart_transport_dev.py @@ -16,13 +16,13 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver import stiffened_shell -from anysolver._stiffened_shell_ge_checkpoint_binary import CHART_MAGIC -from anysolver._stiffened_shell_increment_control import decode_control -from anysolver._stiffened_shell_staged_load_experimental import ( +from anyfesolver import stiffened_shell +from anyfesolver._stiffened_shell_ge_checkpoint_binary import CHART_MAGIC +from anyfesolver._stiffened_shell_increment_control import decode_control +from anyfesolver._stiffened_shell_staged_load_experimental import ( MAGIC as STAGED_MAGIC, decode_checkpoint, ) -from anysolver.e4_pl_s3_state import canonical_json_bytes +from anyfesolver.e4_pl_s3_state import canonical_json_bytes import b3_e4_f06_loaded_chart_transport_dev as oracle diff --git a/scripts/b3_e4_l1_sparse_owner_reference.py b/scripts/b3_e4_l1_sparse_owner_reference.py index 7c0ad7e39..aa9daafdd 100644 --- a/scripts/b3_e4_l1_sparse_owner_reference.py +++ b/scripts/b3_e4_l1_sparse_owner_reference.py @@ -20,9 +20,9 @@ import scipy from threadpoolctl import threadpool_info -import anysolver -from anysolver import b3_ge, stiffened_shell -from anysolver._stiffened_shell_l1_assembly_experimental import SPACE_A, SPACE_B +import anyfesolver +from anyfesolver import b3_ge, stiffened_shell +from anyfesolver._stiffened_shell_l1_assembly_experimental import SPACE_A, SPACE_B ROOT = Path(__file__).resolve().parents[1] @@ -154,7 +154,7 @@ def main(): "python": __import__("sys").version.split()[0], "numpy": np.__version__, "scipy": scipy.__version__, - "imported_package": str(Path(anysolver.__file__).resolve()), + "imported_package": str(Path(anyfesolver.__file__).resolve()), "thread_environment": {key: os.environ.get(key) for key in ( "NUMBA_DISABLE_JIT", "OPENBLAS_NUM_THREADS", "OMP_NUM_THREADS")}, "effective_threadpools": [ diff --git a/scripts/b3_e4_v06_centered_cantilever_dev.py b/scripts/b3_e4_v06_centered_cantilever_dev.py index 3173a09dd..91a418b11 100644 --- a/scripts/b3_e4_v06_centered_cantilever_dev.py +++ b/scripts/b3_e4_v06_centered_cantilever_dev.py @@ -13,12 +13,12 @@ import numpy as np -from anysolver import b3_ge -from anysolver._stiffened_shell_ge_experimental import ( +from anyfesolver import b3_ge +from anyfesolver._stiffened_shell_ge_experimental import ( PROFILE, FixedCoordinate, LinearDefinition, NodalAction, PointConnection, ShellPanel, ) -from anysolver.stiffened_shell import create_analysis +from anyfesolver.stiffened_shell import create_analysis E = 210e9 diff --git a/scripts/b3_e4_v06_transformed_energy_patch_dev.py b/scripts/b3_e4_v06_transformed_energy_patch_dev.py index c8ab81dcc..62e6c0af0 100644 --- a/scripts/b3_e4_v06_transformed_energy_patch_dev.py +++ b/scripts/b3_e4_v06_transformed_energy_patch_dev.py @@ -16,8 +16,8 @@ from scipy.sparse.linalg import lsqr, spsolve from scripts.b3_e4_e01_native_point_refinement_screen import E, NU, definition -from anysolver.stiffened_shell import create_analysis -from anysolver._stiffened_shell_ge_experimental import NodalAction +from anyfesolver.stiffened_shell import create_analysis +from anyfesolver._stiffened_shell_ge_experimental import NodalAction LENGTH_M = 2.0 diff --git a/scripts/benchmark_advanced_s4_batches.py b/scripts/benchmark_advanced_s4_batches.py index d712cad36..524b4296e 100644 --- a/scripts/benchmark_advanced_s4_batches.py +++ b/scripts/benchmark_advanced_s4_batches.py @@ -17,7 +17,7 @@ if str(SRC) not in sys.path: sys.path.insert(0, str(SRC)) -from anysolver import ( # noqa: E402 +from anyfesolver import ( # noqa: E402 FEModel, GeneralizedShellSection, Material, @@ -25,7 +25,7 @@ assemble_stiffness_matrix, create_element, ) -from anysolver.nonlinear_performance_bootstrap import ( # noqa: E402 +from anyfesolver.nonlinear_performance_bootstrap import ( # noqa: E402 clear_nonlinear_assembly_cache, get_nonlinear_assembly_plan, install_nonlinear_performance_optimizations, @@ -225,7 +225,7 @@ def main() -> None: parser.add_argument("--repeats", type=int, default=5) args = parser.parse_args() result = { - "schema": "anysolver.advanced_s4_batch_benchmark", + "schema": "anyfesolver.advanced_s4_batch_benchmark", "nx": int(args.nx), "ny": int(args.ny), "repeats": int(args.repeats), diff --git a/scripts/benchmark_arc_length_predictor_reuse.py b/scripts/benchmark_arc_length_predictor_reuse.py index 7ba5f5adb..7cb2605e0 100644 --- a/scripts/benchmark_arc_length_predictor_reuse.py +++ b/scripts/benchmark_arc_length_predictor_reuse.py @@ -17,12 +17,12 @@ ROOT = Path(__file__).resolve().parents[1] sys.path.insert(0, str(ROOT / "src")) -import anysolver +import anyfesolver import numpy as np import pytest import scipy from threadpoolctl import threadpool_info -from anysolver.jit_compiler import JIT_ENABLED +from anyfesolver.jit_compiler import JIT_ENABLED def runtime(): @@ -32,7 +32,7 @@ def runtime(): numba_version, numba_threads = numba.__version__, numba.get_num_threads() return dict(threadpools=threadpool_info(), numba_threads=numba_threads, versions=dict(numpy=np.__version__, scipy=scipy.__version__, numba=numba_version), - anysolver_module=str(Path(anysolver.__file__).resolve())) + anyfesolver_module=str(Path(anyfesolver.__file__).resolve())) def digest(result): @@ -70,7 +70,7 @@ def main(): "OMP_NUM_THREADS", "OPENBLAS_NUM_THREADS", "MKL_NUM_THREADS", "NUMBA_NUM_THREADS", "FE_SOLVER_DISABLE_NONLINEAR_ACCELERATION")}, source_sha256={str(path.relative_to(ROOT)): hashlib.sha256(path.read_bytes()).hexdigest() - for path in (ROOT / "src/anysolver/arc_length.py", fixture, Path(__file__))}, cases=[]) + for path in (ROOT / "src/anyfesolver/arc_length.py", fixture, Path(__file__))}, cases=[]) def save(): args.output.parent.mkdir(parents=True, exist_ok=True) args.output.write_text(json.dumps(output, indent=2), encoding="utf-8") diff --git a/scripts/benchmark_contact_work_buffer.py b/scripts/benchmark_contact_work_buffer.py index 649a286b7..bb74aa73b 100644 --- a/scripts/benchmark_contact_work_buffer.py +++ b/scripts/benchmark_contact_work_buffer.py @@ -11,7 +11,7 @@ import numpy as np -from anysolver.contact import ( +from anyfesolver.contact import ( RigidSphereImpact, SphereContactConfig, SphereContactRecord, @@ -21,9 +21,9 @@ _verification_contact_panel, assemble_sphere_contact_load_vector, ) -from anysolver.contact_performance import ContactWorkBuffer, ContactWorkCounters -from anysolver.elements import create_element -from anysolver.fe_core import FEModel +from anyfesolver.contact_performance import ContactWorkBuffer, ContactWorkCounters +from anyfesolver.elements import create_element +from anyfesolver.fe_core import FEModel def _case_inputs(name: str): diff --git a/scripts/benchmark_damage_matrix_updates.py b/scripts/benchmark_damage_matrix_updates.py index aae66d3c6..8025ece0a 100644 --- a/scripts/benchmark_damage_matrix_updates.py +++ b/scripts/benchmark_damage_matrix_updates.py @@ -12,10 +12,10 @@ import numpy as np -from anysolver.contact import _assemble_damaged_linear_matrices, _linear_element_matrix_terms -from anysolver.damage_matrix_performance import DamageMatrixPlan -from anysolver.elements import create_element -from anysolver.fe_core import FEModel +from anyfesolver.contact import _assemble_damaged_linear_matrices, _linear_element_matrix_terms +from anyfesolver.damage_matrix_performance import DamageMatrixPlan +from anyfesolver.elements import create_element +from anyfesolver.fe_core import FEModel def _panel(nx: int, ny: int) -> FEModel: diff --git a/scripts/benchmark_e4_pl_s3_reference_batch.py b/scripts/benchmark_e4_pl_s3_reference_batch.py index 56f6f0406..f28dd81fc 100644 --- a/scripts/benchmark_e4_pl_s3_reference_batch.py +++ b/scripts/benchmark_e4_pl_s3_reference_batch.py @@ -29,15 +29,15 @@ if str(SRC) not in sys.path: sys.path.insert(0, str(SRC)) -import anysolver.recovery_batches as recovery_batches # noqa: E402 -import anysolver.s3_reference_batch as s3_batch # noqa: E402 -from anysolver.e4_pl_s3_element import ( # noqa: E402 +import anyfesolver.recovery_batches as recovery_batches # noqa: E402 +import anyfesolver.s3_reference_batch as s3_batch # noqa: E402 +from anyfesolver.e4_pl_s3_element import ( # noqa: E402 QualifiedE4PLS3ShellElement, ) -from anysolver.e4_pl_element import QualifiedE4PLShellElement # noqa: E402 -from anysolver.fe_core import FEModel # noqa: E402 -from anysolver.matrix_assembly import assemble_stiffness_matrix # noqa: E402 -from anysolver.recovery import ( # noqa: E402 +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement # noqa: E402 +from anyfesolver.fe_core import FEModel # noqa: E402 +from anyfesolver.matrix_assembly import assemble_stiffness_matrix # noqa: E402 +from anyfesolver.recovery import ( # noqa: E402 RecoveryConfig, ResourceConfig, clear_recovery_batch_plan, diff --git a/scripts/benchmark_impact_coupled_convergence.py b/scripts/benchmark_impact_coupled_convergence.py index 8f30f7e0b..d460b1b19 100644 --- a/scripts/benchmark_impact_coupled_convergence.py +++ b/scripts/benchmark_impact_coupled_convergence.py @@ -10,9 +10,9 @@ import time import numpy as np from threadpoolctl import threadpool_info -import anysolver as fs -import anysolver.contact as current_contact -import anysolver._impact_coupling as current_coupling +import anyfesolver as fs +import anyfesolver.contact as current_contact +import anyfesolver._impact_coupling as current_coupling def load_snapshot(name, path): @@ -27,12 +27,12 @@ def run(method, cutbacks, *, stiffness=40000., damping=0., baseline=None, deform solver=current_contact if method=='baseline-anderson': solver,helper=baseline - sys.modules['anysolver._impact_coupling']=helper + sys.modules['anyfesolver._impact_coupling']=helper start=time.perf_counter() try: model=solver._verification_contact_panel() if deform: - from anysolver.boundary import BoundaryCondition + from anyfesolver.boundary import BoundaryCondition model.add_boundary_condition(BoundaryCondition('pin-one-z',[1],{'uz':0.})) result=solver.solve_transient_sphere_impact( model,fs.TransientConfig(dt=.01,t_end=.03), @@ -41,7 +41,7 @@ def run(method, cutbacks, *, stiffness=40000., damping=0., baseline=None, deform nonlinear_config=solver.NonlinearTransientConfig(enabled=True,max_iterations=25,max_cutbacks=cutbacks, coupled_contact_acceleration='anderson' if method=='baseline-anderson' else method)) finally: - sys.modules['anysolver._impact_coupling']=current_coupling + sys.modules['anyfesolver._impact_coupling']=current_coupling return {'method':method,'deform':deform,'k':stiffness,'damping':damping,'max_cutbacks':cutbacks, 'wall_seconds':time.perf_counter()-start,'status':result.status,'times':result.times.tolist(), 'x':result.sphere_positions.tolist(),'v':result.sphere_velocities.tolist(), @@ -68,14 +68,14 @@ def main(): if a.baseline_dir: old_contact=a.baseline_dir/'contact_before.py';old_helper=a.baseline_dir/'coupling_before.py' paths.extend([old_contact,old_helper]) - baseline=(load_snapshot('anysolver._benchmark_prior_contact',old_contact), - load_snapshot('anysolver._benchmark_prior_coupling',old_helper)) + baseline=(load_snapshot('anyfesolver._benchmark_prior_contact',old_contact), + load_snapshot('anyfesolver._benchmark_prior_coupling',old_helper)) methods=['baseline-anderson' if baseline else 'none',a.candidate_method] import numba data={'source_hashes':{str(path):hashlib.sha256(path.read_bytes()).hexdigest() for path in paths}, 'environment':{k:os.environ.get(k) for k in ['OMP_NUM_THREADS','OPENBLAS_NUM_THREADS','MKL_NUM_THREADS','NUMBA_NUM_THREADS']}, 'runtime':{'threadpools':threadpool_info(),'numba_threads':numba.get_num_threads(), - 'versions':{name:importlib.metadata.version(name) for name in ['numpy','scipy','numba']},'anysolver_module':fs.__file__}, + 'versions':{name:importlib.metadata.version(name) for name in ['numpy','scipy','numba']},'anyfesolver_module':fs.__file__}, 'warmup':[],'runs':[],'validation':[]} output=Path(a.output) def save():output.write_text(json.dumps(data,indent=2)) diff --git a/scripts/benchmark_impact_elastic_baseline_cache.py b/scripts/benchmark_impact_elastic_baseline_cache.py index 1ac4cc3d9..c09b4d34f 100644 --- a/scripts/benchmark_impact_elastic_baseline_cache.py +++ b/scripts/benchmark_impact_elastic_baseline_cache.py @@ -3,9 +3,9 @@ from contextlib import nullcontext import numpy as np from threadpoolctl import threadpool_info -from anysolver import FEModel,e4_pl_element -from anysolver.elements import create_shell_element -from anysolver.nonlinear_static import _assemble_nonlinear_system +from anyfesolver import FEModel,e4_pl_element +from anyfesolver.elements import create_shell_element +from anyfesolver.nonlinear_static import _assemble_nonlinear_system def model(): m=FEModel('impact-baseline-reuse-assembly');m.add_material('soft',1e5,.3,density=20.) @@ -19,7 +19,7 @@ def model(): def run(out): root=pathlib.Path(__file__).resolve().parents[1] - sources=[pathlib.Path(__file__),root/'src/anysolver/e4_pl_element.py',root/'src/anysolver/contact.py',root/'src/anysolver/elements.py'] + sources=[pathlib.Path(__file__),root/'src/anyfesolver/e4_pl_element.py',root/'src/anyfesolver/contact.py',root/'src/anyfesolver/elements.py'] result={'scope':'assembly only, 2x2 Q4, three hot assemblies per sample; identical current code with vs without solve-local scope','python':platform.python_version(),'numpy':np.__version__,'module':e4_pl_element.__file__,'environment':{k:os.environ.get(k) for k in ['OMP_NUM_THREADS','OPENBLAS_NUM_THREADS','MKL_NUM_THREADS','NUMBA_NUM_THREADS']},'source_hashes':{str(p):hashlib.sha256(p.read_bytes()).hexdigest() for p in sources},'samples':[]} def save():out.write_text(json.dumps(result,indent=2)) m=model();u=np.zeros(m.mesh.dof_manager.total_dofs);u[2::6]=.003*np.sin(np.arange(9)) diff --git a/scripts/benchmark_impact_reduced_assembly.py b/scripts/benchmark_impact_reduced_assembly.py index baef732f5..5642e9620 100644 --- a/scripts/benchmark_impact_reduced_assembly.py +++ b/scripts/benchmark_impact_reduced_assembly.py @@ -12,14 +12,14 @@ import numpy as np -import anysolver as fs -from anysolver.assembly import build_constraint_transformation -from anysolver.boundary import BoundaryCondition -from anysolver.elements import create_element -from anysolver.fe_core import FEModel -from anysolver.matrix_assembly import assemble_stiffness_matrix -from anysolver.nonlinear_performance_bootstrap import get_nonlinear_assembly_plan -from anysolver.nonlinear_reduced_assembly import ( +import anyfesolver as fs +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.boundary import BoundaryCondition +from anyfesolver.elements import create_element +from anyfesolver.fe_core import FEModel +from anyfesolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.nonlinear_performance_bootstrap import get_nonlinear_assembly_plan +from anyfesolver.nonlinear_reduced_assembly import ( assemble_reduced_system, build_reduced_assembly_plan, ) diff --git a/scripts/benchmark_impact_tangent_reuse.py b/scripts/benchmark_impact_tangent_reuse.py index 9d59c6300..322d26c70 100644 --- a/scripts/benchmark_impact_tangent_reuse.py +++ b/scripts/benchmark_impact_tangent_reuse.py @@ -10,8 +10,8 @@ import numpy as np -import anysolver as fs -from anysolver.contact import _verification_contact_panel +import anyfesolver as fs +from anyfesolver.contact import _verification_contact_panel def _float_list(value: str) -> tuple[float, ...]: diff --git a/scripts/benchmark_load_vector_guards.py b/scripts/benchmark_load_vector_guards.py index e8cbf699a..673e03e44 100644 --- a/scripts/benchmark_load_vector_guards.py +++ b/scripts/benchmark_load_vector_guards.py @@ -25,12 +25,12 @@ if str(SRC) not in sys.path: sys.path.insert(0, str(SRC)) -from anysolver.boundary import LoadCase # noqa: E402 -from anysolver.e4_pl_element import QualifiedE4PLShellElement # noqa: E402 -from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement # noqa: E402 -from anysolver.elements import BeamElement # noqa: E402 -from anysolver.fe_core import FEModel # noqa: E402 -from anysolver.matrix_assembly import ( # noqa: E402 +from anyfesolver.boundary import LoadCase # noqa: E402 +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement # noqa: E402 +from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement # noqa: E402 +from anyfesolver.elements import BeamElement # noqa: E402 +from anyfesolver.fe_core import FEModel # noqa: E402 +from anyfesolver.matrix_assembly import ( # noqa: E402 assemble_load_matrix, assemble_load_vector, ) diff --git a/scripts/benchmark_nonlinear_assembly.py b/scripts/benchmark_nonlinear_assembly.py index 151ee52ae..a9c74e682 100644 --- a/scripts/benchmark_nonlinear_assembly.py +++ b/scripts/benchmark_nonlinear_assembly.py @@ -14,13 +14,13 @@ import numpy as np from scipy import sparse -from anysolver import nonlinear_performance -from anysolver.mesh_gen import generate_simple_panel_mesh -from anysolver.nonlinear_performance_batch_c import ( +from anyfesolver import nonlinear_performance +from anyfesolver.mesh_gen import generate_simple_panel_mesh +from anyfesolver.nonlinear_performance_batch_c import ( assemble_reduced_system, build_reduced_assembly_plan, ) -from anysolver.nonlinear_performance_bootstrap import ( +from anyfesolver.nonlinear_performance_bootstrap import ( clear_nonlinear_assembly_cache, get_nonlinear_assembly_plan, install_nonlinear_performance_optimizations, diff --git a/scripts/benchmark_nonlinear_speed_sweep.py b/scripts/benchmark_nonlinear_speed_sweep.py index 49854e1b8..902697f3b 100644 --- a/scripts/benchmark_nonlinear_speed_sweep.py +++ b/scripts/benchmark_nonlinear_speed_sweep.py @@ -18,14 +18,14 @@ ROOT = Path(__file__).resolve().parents[1] sys.path.insert(0, str(ROOT / "src")) from benchmark_nonlinear_static_improvements import _physical_digest -import anysolver +import anyfesolver import numpy as np import scipy from threadpoolctl import threadpool_info -from anysolver import nonlinear_static as ns -from anysolver.boundary import BoundaryCondition, LoadCase -from anysolver.mesh_gen import generate_simple_panel_mesh -from anysolver.jit_compiler import JIT_ENABLED +from anyfesolver import nonlinear_static as ns +from anyfesolver.boundary import BoundaryCondition, LoadCase +from anyfesolver.mesh_gen import generate_simple_panel_mesh +from anyfesolver.jit_compiler import JIT_ENABLED def runtime(): @@ -38,7 +38,7 @@ def runtime(): return dict(threadpools=threadpool_info(), numba_threads=numba_threads, dependencies=dict(numpy=np.__version__, scipy=scipy.__version__, numba=numba_version), - anysolver_module=str(Path(anysolver.__file__).resolve())) + anyfesolver_module=str(Path(anyfesolver.__file__).resolve())) def case(divisions, steps): @@ -95,7 +95,7 @@ def main(): "OMP_NUM_THREADS", "OPENBLAS_NUM_THREADS", "MKL_NUM_THREADS", "NUMBA_NUM_THREADS", "FE_SOLVER_DISABLE_NONLINEAR_ACCELERATION")}, source_sha256=hashlib.sha256( - (ROOT / "src/anysolver/nonlinear_static.py").read_bytes()).hexdigest(), + (ROOT / "src/anyfesolver/nonlinear_static.py").read_bytes()).hexdigest(), command=sys.argv, cases=[]) variants = ("every_conversion_guard", "inert_builtin_guard") for divisions, steps in ((2, 5), (2, 40), (8, 5)): diff --git a/scripts/benchmark_nonlinear_static_improvements.py b/scripts/benchmark_nonlinear_static_improvements.py index 6db3300a7..d73daf0d5 100644 --- a/scripts/benchmark_nonlinear_static_improvements.py +++ b/scripts/benchmark_nonlinear_static_improvements.py @@ -27,13 +27,13 @@ import numpy as np -from anysolver import nonlinear_performance_batch_c -from anysolver.boundary import BoundaryCondition, FixedSupport, LoadCase -from anysolver.elements import Element -from anysolver.fe_core import FEModel -from anysolver.mesh_gen import generate_simple_panel_mesh -from anysolver.nonlinear_performance_bootstrap import nonlinear_performance_status -from anysolver.nonlinear_static import solve_static_nonlinear +from anyfesolver import nonlinear_performance_batch_c +from anyfesolver.boundary import BoundaryCondition, FixedSupport, LoadCase +from anyfesolver.elements import Element +from anyfesolver.fe_core import FEModel +from anyfesolver.mesh_gen import generate_simple_panel_mesh +from anyfesolver.nonlinear_performance_bootstrap import nonlinear_performance_status +from anyfesolver.nonlinear_static import solve_static_nonlinear class _AxialSpring(Element): @@ -269,7 +269,7 @@ def _memory_probe(*, reuse: bool) -> dict[str, Any]: def _dependency_versions() -> dict[str, str | None]: versions: dict[str, str | None] = {} - for name in ("anysolver", "numpy", "scipy", "numba"): + for name in ("anyfesolver", "numpy", "scipy", "numba"): try: versions[name] = importlib.metadata.version(name) except importlib.metadata.PackageNotFoundError: @@ -345,7 +345,7 @@ def _main(args: argparse.Namespace) -> int: "scope": "one warmed solve; Python allocations observed by tracemalloc", } payload = { - "schema": "anysolver.nonlinear_static.performance_convergence", + "schema": "anyfesolver.nonlinear_static.performance_convergence", "version": 1, "created_utc": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()), "environment": { diff --git a/scripts/benchmark_plate_edge_shear.py b/scripts/benchmark_plate_edge_shear.py index ec94704ab..5b1d6ce26 100644 --- a/scripts/benchmark_plate_edge_shear.py +++ b/scripts/benchmark_plate_edge_shear.py @@ -7,7 +7,7 @@ import argparse,hashlib,json,os,pathlib,platform,statistics,time import numpy as np from threadpoolctl import threadpool_info -from anysolver import solve_static_nonlinear +from anyfesolver import solve_static_nonlinear from investigate_plate_edge_shear import plate,jsonable def sample(mode): @@ -21,7 +21,7 @@ def sample(mode): def benchmark(output): repo=pathlib.Path(__file__).resolve().parents[1] - files=[pathlib.Path(__file__),repo/'scripts/investigate_plate_edge_shear.py']+[repo/'src/anysolver'/n for n in ['corotational.py','_corotational_batch.py','nonlinear_static.py','elements.py','e4_pl_element.py']] + files=[pathlib.Path(__file__),repo/'scripts/investigate_plate_edge_shear.py']+[repo/'src/anyfesolver'/n for n in ['corotational.py','_corotational_batch.py','nonlinear_static.py','elements.py','e4_pl_element.py']] result={'comparison':'different force formulations, NOT physics-preserving optimization','fixture':'2x2 square1m,t.01,E210GPa,nu.3,initial1mmsine-bump,leftallfixed,rightuy.01only','controls':{'num_steps':4,'max_iterations':25,'tolerance':1e-6,'min_step_fraction':1/1024,'control':'force'},'source_hashes':{str(p):hashlib.sha256(p.read_bytes()).hexdigest() for p in files},'python':platform.python_version(),'numpy':np.__version__,'environment':{k:os.environ.get(k) for k in ['OMP_NUM_THREADS','OPENBLAS_NUM_THREADS','MKL_NUM_THREADS','NUMBA_NUM_THREADS']},'warmups':[],'samples':[]} def save():output.write_text(json.dumps(result,default=jsonable,indent=2)) modes=['consistent','work_conjugate'] diff --git a/scripts/benchmark_plate_stability.py b/scripts/benchmark_plate_stability.py index 2cc2813cf..ce41588e5 100644 --- a/scripts/benchmark_plate_stability.py +++ b/scripts/benchmark_plate_stability.py @@ -8,8 +8,8 @@ import numpy as np import scipy from threadpoolctl import threadpool_info -from anysolver import solve_static_nonlinear -import anysolver._plate_stability_continuation as current_helper +from anyfesolver import solve_static_nonlinear +import anyfesolver._plate_stability_continuation as current_helper from investigate_plate_edge_shear import plate,jsonable @@ -18,19 +18,19 @@ def digest(path):return hashlib.sha256(path.read_bytes()).hexdigest() def benchmark(output,baseline_dir,pair): repo=pathlib.Path(__file__).resolve().parents[1] - caller=repo/'src/anysolver/nonlinear_static.py' + caller=repo/'src/anyfesolver/nonlinear_static.py' assert digest(caller)==digest(baseline_dir/'nonlinear_static_before.py'),'Caller changed; frozen reference must be reconsidered' - name='anysolver._plate_stability_frozen_reference' + name='anyfesolver._plate_stability_frozen_reference' spec=importlib.util.spec_from_file_location(name,baseline_dir/'helper_before.py') baseline=importlib.util.module_from_spec(spec);sys.modules[name]=baseline;spec.loader.exec_module(baseline) - files=[pathlib.Path(__file__),repo/'scripts/investigate_plate_edge_shear.py',caller,repo/'src/anysolver/_plate_stability_continuation.py',baseline_dir/'helper_before.py',baseline_dir/'nonlinear_static_before.py'] - files += [repo/'src/anysolver'/f for f in ['corotational.py','elements.py','e4_pl_element.py','assembly.py']] + files=[pathlib.Path(__file__),repo/'scripts/investigate_plate_edge_shear.py',caller,repo/'src/anyfesolver/_plate_stability_continuation.py',baseline_dir/'helper_before.py',baseline_dir/'nonlinear_static_before.py'] + files += [repo/'src/anyfesolver'/f for f in ['corotational.py','elements.py','e4_pl_element.py','assembly.py']] result={'comparison':'Same public stable path, exact cubic local-work quadrature reduction3to2','pair':pair,'caller_binding':'Current caller is SHA256-identical to frozen caller; helper loaded separately without changing its seal','controls':{'num_steps':4,'max_iterations':25,'tolerance':1e-6,'min_step_fraction':1/1024,'kinematics':'corotational','corotational_tangent':'work_conjugate','stability_control':'plate_energy'},'fixture':'4x4,1m square,.01thickness,E210GPa,nu.3,1mm sampled sine imperfection,clamp left,uy=.01 right','source_hashes':{str(p):digest(p) for p in files},'python':platform.python_version(),'numpy':np.__version__,'scipy':scipy.__version__,'module_path':str(caller),'environment':{k:os.environ.get(k) for k in ['OMP_NUM_THREADS','OPENBLAS_NUM_THREADS','MKL_NUM_THREADS','NUMBA_NUM_THREADS']},'warmups':[],'samples':[]} def save():output.write_text(json.dumps(result,default=jsonable,indent=2)) def sample(mode): helper=baseline if mode=='baseline' else current_helper - old=sys.modules['anysolver._plate_stability_continuation'] - sys.modules['anysolver._plate_stability_continuation']=helper + old=sys.modules['anyfesolver._plate_stability_continuation'] + sys.modules['anyfesolver._plate_stability_continuation']=helper try: m=plate(.01,True,4);start=time.perf_counter() r=solve_static_nonlinear(m,None,num_steps=4,max_iterations=25,kinematics='corotational',corotational_tangent='work_conjugate',stability_control='plate_energy',record_increment_snapshots=True) @@ -39,7 +39,7 @@ def sample(mode): assert r.converged and r.load_factor==1. key=hashlib.sha256(json.dumps(physical,sort_keys=True).encode()).hexdigest() return {'mode':mode,'wall':wall,'digest':key,'physical_result':physical} - finally:sys.modules['anysolver._plate_stability_continuation']=old + finally:sys.modules['anyfesolver._plate_stability_continuation']=old modes=['baseline','candidate'] for mode in modes: result['warmups'].append(sample(mode));save() diff --git a/scripts/benchmark_prepared_envelopes.py b/scripts/benchmark_prepared_envelopes.py index 77fa5ad69..5d7004d71 100644 --- a/scripts/benchmark_prepared_envelopes.py +++ b/scripts/benchmark_prepared_envelopes.py @@ -69,13 +69,13 @@ def main(): args = parser.parse_args() if not 1 <= args.cases <= 10000: parser.error('cases must be a prefix length between 1 and 10000') - import anysolver + import anyfesolver import psutil import numba from threadpoolctl import threadpool_info - from anysolver import (LoadCase, StaticCase, RecoveryConfig, ResourceConfig, + from anyfesolver import (LoadCase, StaticCase, RecoveryConfig, ResourceConfig, AnalysisSession, EnvelopeReducer) - from anysolver.linalg import backend_operation_counts + from anyfesolver.linalg import backend_operation_counts built = None fixture_digest = None if args.family == 'barge': @@ -103,7 +103,7 @@ def records(): else: model, groups, balancing = mixed_free_model(2 if args.family == 'multiple' else 1) if args.family == 'supported': - from anysolver import FixedSupport + from anyfesolver import FixedSupport model.add_boundary_condition(FixedSupport('screen support', [groups[0][0][0]])) def records(): for i in range(args.cases): @@ -136,7 +136,7 @@ def records(): started = time.perf_counter() if args.route == 'prepared': if built is None: - owner = anysolver.prepare_static_evaluator(model, output_dofs=dofs, + owner = anyfesolver.prepare_static_evaluator(model, output_dofs=dofs, recovery_config=history_config, envelope_recovery_config=envelope_config, resource_config=resources) else: @@ -155,7 +155,7 @@ def consume(suffix): if args.route == 'prepared': stream = owner.iter_batches(records(), batch_size=args.block_size) elif built is None: - stream = anysolver.iter_linear_batches(model, records(), session=owner, + stream = anyfesolver.iter_linear_batches(model, records(), session=owner, output_dofs=dofs, recovery_config=envelope_config, resource_config=resources, batch_size=args.block_size) else: @@ -226,7 +226,7 @@ def consume(suffix): fixture_sha256=fixture_digest, model_elements=len(elements), model_nodes=len(nodes), selected_elements=selected_elements, selected_nodes=selected_nodes, operations={k: after[k]-before[k] for k in before}, - runtime=dict(python=sys.executable, solver=anysolver.__file__, + runtime=dict(python=sys.executable, solver=anyfesolver.__file__, numba_disable_jit=numba.config.DISABLE_JIT, numba_threads=numba.get_num_threads(), threadpools=threadpool_info())) args.output.write_text(json.dumps(result, indent=2, default=str)) diff --git a/scripts/benchmark_prepared_static.py b/scripts/benchmark_prepared_static.py index faf092927..87ccde53e 100644 --- a/scripts/benchmark_prepared_static.py +++ b/scripts/benchmark_prepared_static.py @@ -37,12 +37,12 @@ def main(): if not 1 <= args.cases <= len(positions(args.history)): parser.error('cases must fit the selected frozen history') driver_start = time.perf_counter() - import anysolver + import anyfesolver import psutil from threadpoolctl import threadpool_info - from anysolver import AnalysisSession, RecoveryConfig, ResourceConfig, StaticCase - from anysolver.linalg import backend_operation_counts - from anysolver.static_envelopes import EnvelopeReducer + from anyfesolver import AnalysisSession, RecoveryConfig, ResourceConfig, StaticCase + from anyfesolver.linalg import backend_operation_counts + from anyfesolver.static_envelopes import EnvelopeReducer indices = [positions(args.history)[i] for i in np.linspace( 0, len(positions(args.history))-1, args.cases, dtype=int)] built = None @@ -74,7 +74,7 @@ def records(selected): else: model, groups, balancing = mixed_free_model(2 if args.family == 'multiple' else 1) if args.family == 'independent': - from anysolver import FixedSupport, LoadCase + from anyfesolver import FixedSupport, LoadCase model.add_boundary_condition(FixedSupport('prepared benchmark support', groups[0][0][:1])) def records(selected): for position in selected: @@ -117,7 +117,7 @@ def evaluate(selected): owner = prepare_linear_static_evaluator(built=built, output_dofs=dofs, recovery_config=recovery, resource_config=resources, **preparation_options) else: - from anysolver import prepare_static_evaluator + from anyfesolver import prepare_static_evaluator owner = prepare_static_evaluator(model, output_dofs=dofs, recovery_config=recovery, resource_config=resources, **preparation_options) else: @@ -132,7 +132,7 @@ def consume(): batch_size=args.block_size, output_dofs=dofs, recovery_config=recovery, resource_config=resources, session=owner) else: - from anysolver import iter_linear_batches + from anyfesolver import iter_linear_batches stream = iter_linear_batches(model, records(selected), batch_size=args.block_size, output_dofs=dofs, recovery_config=recovery, resource_config=resources, session=owner) try: @@ -196,7 +196,7 @@ def consume(): warmup_seconds = time.perf_counter()-warmed result = evaluate(indices) memory = psutil.Process().memory_info() - from anysolver.jit_compiler import JIT_ENABLED, JIT_DISABLED_REASON + from anyfesolver.jit_compiler import JIT_ENABLED, JIT_DISABLED_REASON import numba result.update(route=args.route, family=args.family, history=args.history, positions=indices, selected_nodes=selected_nodes, selected_elements=selected_elements, output_dofs=dofs.tolist(), @@ -204,7 +204,7 @@ def consume(): fixture_seconds=fixture_seconds, warmup_seconds=warmup_seconds, peak_working_set_bytes=getattr(memory, 'peak_wset', memory.rss), memory_scope='process peak includes fixture and optional warmup; comparison sink retains selected values', - runtime=dict(python=sys.executable, solver=anysolver.__file__, application=application, + runtime=dict(python=sys.executable, solver=anyfesolver.__file__, application=application, jit_enabled=JIT_ENABLED, jit_disabled_reason=JIT_DISABLED_REASON, numba_disable_jit=numba.config.DISABLE_JIT, numba_threads=numba.get_num_threads(), threadpools=threadpool_info()), driver_seconds=time.perf_counter()-driver_start) diff --git a/scripts/benchmark_recovery_batches.py b/scripts/benchmark_recovery_batches.py index d00e61359..7119cffe4 100644 --- a/scripts/benchmark_recovery_batches.py +++ b/scripts/benchmark_recovery_batches.py @@ -10,8 +10,8 @@ import numpy as np -from anysolver import RecoveryConfig, ResourceConfig, generate_simple_panel_mesh -from anysolver.recovery import ( +from anyfesolver import RecoveryConfig, ResourceConfig, generate_simple_panel_mesh +from anyfesolver.recovery import ( _compute_one_element_stress, recover_element_stresses_with_report, ) diff --git a/scripts/benchmark_s4_improved.py b/scripts/benchmark_s4_improved.py index c352366c4..0f4eb2c72 100644 --- a/scripts/benchmark_s4_improved.py +++ b/scripts/benchmark_s4_improved.py @@ -26,7 +26,7 @@ ROOT = Path(__file__).resolve().parents[1] SRC = ROOT / "src" REPORT_ROOT = ROOT / "reports" / "s4_improved" -SCHEMA_NAME = "anysolver.s4_improved.benchmark" +SCHEMA_NAME = "anyfesolver.s4_improved.benchmark" SCHEMA_VERSION = 1 PERF_LEASE_ENV = "ANYSOLVER_PERF_LEASE" @@ -149,7 +149,7 @@ def _load_case_factories() -> tuple[Mapping[str, Callable[[], Any]] | None, str try: module = importlib.import_module( - "anysolver.shell_formulations.mitc4_plus_d_batch" + "anyfesolver.shell_formulations.mitc4_plus_d_batch" ) except Exception as exc: return None, f"batch_module_unavailable: {exc!r}" diff --git a/scripts/benchmark_sol_ultra_performance.py b/scripts/benchmark_sol_ultra_performance.py index 443a391ad..11a5df83d 100644 --- a/scripts/benchmark_sol_ultra_performance.py +++ b/scripts/benchmark_sol_ultra_performance.py @@ -33,39 +33,39 @@ import numpy as np from scipy import sparse -from anysolver import nonlinear_performance, nonlinear_static -from anysolver.arc_length import ArcLengthControl, solve_static_arc_length -from anysolver.benchmarks import BENCHMARK_CASES -from anysolver.boundary import BoundaryCondition, LoadCase -from anysolver.corotational import rotation_matrix_from_vector -from anysolver.dynamics import TransientConfig, solve_transient_newmark -from anysolver.elements import BeamElement, Element, create_element -from anysolver.fe_core import FEModel -from anysolver.materials import Hill48Yield, OrthotropicMaterial -from anysolver.matrix_assembly import ( +from anyfesolver import nonlinear_performance, nonlinear_static +from anyfesolver.arc_length import ArcLengthControl, solve_static_arc_length +from anyfesolver.benchmarks import BENCHMARK_CASES +from anyfesolver.boundary import BoundaryCondition, LoadCase +from anyfesolver.corotational import rotation_matrix_from_vector +from anyfesolver.dynamics import TransientConfig, solve_transient_newmark +from anyfesolver.elements import BeamElement, Element, create_element +from anyfesolver.fe_core import FEModel +from anyfesolver.materials import Hill48Yield, OrthotropicMaterial +from anyfesolver.matrix_assembly import ( assemble_mass_matrix, assemble_stiffness_matrix, ) -from anysolver.mesh_gen import generate_beam_mesh, generate_simple_panel_mesh -from anysolver.nonlinear_performance_batch_c import ( +from anyfesolver.mesh_gen import generate_beam_mesh, generate_simple_panel_mesh +from anyfesolver.nonlinear_performance_batch_c import ( assemble_reduced_system, build_reduced_assembly_plan, ) -from anysolver.nonlinear_performance_bootstrap import ( +from anyfesolver.nonlinear_performance_bootstrap import ( clear_nonlinear_assembly_cache, get_nonlinear_assembly_plan, install_nonlinear_performance_optimizations, nonlinear_performance_status, ) -from anysolver.recovery import ( +from anyfesolver.recovery import ( RecoveryConfig, ResourceConfig, recover_element_stresses_with_report, ) -from anysolver.shell_sections import GeneralizedShellSection +from anyfesolver.shell_sections import GeneralizedShellSection -SCHEMA_NAME = "anysolver.sol_ultra.benchmark" +SCHEMA_NAME = "anyfesolver.sol_ultra.benchmark" SCHEMA_VERSION = 1 DEFAULT_REPORT_DIRECTORY = ROOT / "reports" / "performance" @@ -316,7 +316,7 @@ def collect_environment() -> Dict[str, Any]: except ImportError: native_pools = [] try: - from anysolver.jit_compiler import jit_diagnostics + from anyfesolver.jit_compiler import jit_diagnostics jit = jit_diagnostics() except Exception as exc: # diagnostics should not block benchmark execution @@ -326,7 +326,7 @@ def collect_environment() -> Dict[str, Any]: origin_main = _git("rev-parse", "origin/main") merge_base = _git("merge-base", "HEAD", "origin/main") if origin_main else None return { - "schema_name": "anysolver.sol_ultra.environment", + "schema_name": "anyfesolver.sol_ultra.environment", "schema_version": SCHEMA_VERSION, "generated_at_utc": _utc_now(), "revision": { @@ -358,7 +358,7 @@ def collect_environment() -> Dict[str, Any]: "mkl", "threadpoolctl", "pytest", - "ANYsolver", + "ANYfeSolver", "ANYmaterial", "ANYmesher", "ANYgeometry", @@ -1292,7 +1292,7 @@ def render_markdown(report: Mapping[str, Any]) -> str: summary = report.get("summary", {}) environment = report.get("environment", {}).get("runtime", {}) lines = [ - "# ANYsolver Sol Ultra Performance Report", + "# ANYfeSolver Sol Ultra Performance Report", "", f"- Report kind: `{report.get('report_kind', 'unknown')}`", f"- Generated: {report.get('generated_at_utc', 'unknown')}", diff --git a/scripts/benchmark_sol_ultra_thread_scaling.py b/scripts/benchmark_sol_ultra_thread_scaling.py index 82e88a9e3..83602e1c7 100644 --- a/scripts/benchmark_sol_ultra_thread_scaling.py +++ b/scripts/benchmark_sol_ultra_thread_scaling.py @@ -1,7 +1,7 @@ -"""Measure bounded ANYsolver thread scaling through public solver APIs. +"""Measure bounded ANYfeSolver thread scaling through public solver APIs. The measurements in this script are evidence, not test thresholds. Each -workload uses :class:`anysolver.recovery.ResourceConfig` so that assembly, +workload uses :class:`anyfesolver.recovery.ResourceConfig` so that assembly, native solver, and recovery thread controls are exercised exactly as an application exercises them. A one-thread result is retained as a numerical reference, and every invocation audits restoration of Numba/native limits. @@ -34,7 +34,7 @@ import numpy as np -from anysolver import ( +from anyfesolver import ( AnalysisSession, LoadCase, RecoveryConfig, @@ -43,12 +43,12 @@ solve_linear_many, solve_static_nonlinear, ) -from anysolver.jit_compiler import jit_diagnostics -from anysolver.mesh_gen import generate_beam_mesh, generate_simple_panel_mesh -from anysolver.threading_policy import current_solver_threads +from anyfesolver.jit_compiler import jit_diagnostics +from anyfesolver.mesh_gen import generate_beam_mesh, generate_simple_panel_mesh +from anyfesolver.threading_policy import current_solver_threads -SCHEMA_NAME = "anysolver.sol_ultra.thread_scaling" +SCHEMA_NAME = "anyfesolver.sol_ultra.thread_scaling" SCHEMA_VERSION = 1 DEFAULT_OUTPUT = ROOT / "reports" / "performance" / "sol_ultra_thread_scaling.json" REQUIRED_ASSEMBLY_THREADS = (1, 2, 4, 8, 16) @@ -224,7 +224,7 @@ def collect_environment() -> Dict[str, Any]: "packages": { name: _package_version(name) for name in ( - "ANYsolver", + "ANYfeSolver", "numpy", "scipy", "numba", diff --git a/scripts/benchmark_spectral_authority.py b/scripts/benchmark_spectral_authority.py index 353aa5032..2386bd1a9 100644 --- a/scripts/benchmark_spectral_authority.py +++ b/scripts/benchmark_spectral_authority.py @@ -1,6 +1,6 @@ """Bounded whole-route benchmark for spectral authority optimizations. -Run this script with ANYsolver and ANYstructure selected through ``PYTHONPATH``. +Run this script with ANYfeSolver and ANYstructure selected through ``PYTHONPATH``. It exercises the real ANYstructure runtime adapter, warms one retained analysis context, and records only subsequent complete static-plus-buckling runs. """ @@ -18,7 +18,7 @@ import numpy as np -from anysolver.runtime import RuntimeAnalysisContext +from anyfesolver.runtime import RuntimeAnalysisContext from anystruct import fem_integration diff --git a/scripts/benchmark_spectral_medium_fine.py b/scripts/benchmark_spectral_medium_fine.py index d6cd257b5..6263b54f3 100644 --- a/scripts/benchmark_spectral_medium_fine.py +++ b/scripts/benchmark_spectral_medium_fine.py @@ -213,7 +213,7 @@ def _timed(callable_: Any, route: str, modes: int) -> dict[str, Any]: def _modal_model(config: Any, generated: Any) -> Any: - from anysolver import anystructure_fem_mode as backend # type: ignore + from anyfesolver import anystructure_fem_mode as backend # type: ignore backend_config = backend.AnyStructureFEMConfig( pressure_pa=abs(float(config.pressure_pa)), pressure_sign=-1.0, load_scale=1.0, num_buckling_modes=int(config.num_buckling_modes), solver_type="direct", stress_percentile=95.0, @@ -229,8 +229,8 @@ def _run_actual(args: argparse.Namespace, mode_artifact: Path | None = None, pro adapter_root, solver_root = Path(args.adapter_root), Path(args.solver_root) prepared_started = time.perf_counter() fem, snapshot, options, config, generated, geometry, digest = _fixture_inputs(adapter_root, solver_root, args.fixture, args.fidelity, args.modes) - import anysolver # type: ignore - if not Path(anysolver.__file__).resolve().is_relative_to(solver_root.resolve() / "src"): + import anyfesolver # type: ignore + if not Path(anyfesolver.__file__).resolve().is_relative_to(solver_root.resolve() / "src"): raise RuntimeError("solver import escaped the bound checkout") if not Path(fem.__file__).resolve().is_relative_to(adapter_root.resolve()): raise RuntimeError("adapter import escaped the bound checkout") @@ -240,12 +240,12 @@ def _run_actual(args: argparse.Namespace, mode_artifact: Path | None = None, pro _checkpoint("model.end") preparation_seconds = time.perf_counter() - prepared_started if args.route == "modal": - from anysolver import AnalysisSession, solve_free_vibration # type: ignore + from anyfesolver import AnalysisSession, solve_free_vibration # type: ignore cold = lambda: solve_free_vibration(model, num_modes=args.modes) retained_session = AnalysisSession(model) retained = lambda: solve_free_vibration(model, num_modes=args.modes, session=retained_session) else: - from anysolver.runtime import RuntimeAnalysisContext # type: ignore + from anyfesolver.runtime import RuntimeAnalysisContext # type: ignore original_run = fem.fe_solver.run_production_fem captured = [] def observed_run(*positional, **keywords): @@ -308,7 +308,7 @@ def adapter_run(context=None): "preparation": {"seconds": preparation_seconds, "scope": "real adapter fixture + generated geometry" + (" + modal model build" if args.route == "modal" else "")}, "timed_scope": "solve_free_vibration only; model preparation is reported separately" if args.route == "modal" else "adapter run_runtime_fem with precomputed generated geometry", "mode_vectors_artifact": vector_artifact, - "modules": {"adapter": _module_provenance(fem, "anystructure"), "solver": _module_provenance(anysolver, "anysolver")}, + "modules": {"adapter": _module_provenance(fem, "anystructure"), "solver": _module_provenance(anyfesolver, "anyfesolver")}, "numerical_versions": {name: importlib.metadata.version(name) for name in ("numpy", "scipy", "numba", "psutil")}, "thread_environment": {name: os.environ.get(name) for name in ("OMP_NUM_THREADS", "OPENBLAS_NUM_THREADS", "MKL_NUM_THREADS", "NUMEXPR_NUM_THREADS", "NUMBA_NUM_THREADS")}, } diff --git a/scripts/benchmark_static_batches.py b/scripts/benchmark_static_batches.py index de26db84f..0d5a9600d 100644 --- a/scripts/benchmark_static_batches.py +++ b/scripts/benchmark_static_batches.py @@ -11,7 +11,7 @@ the batch stream and are reported as one documented bucket. Cross-route phase comparison is valid only for the documented buckets and the total. - Backend factorization counts are actual operations. The candidate exposes - ``anysolver.linalg.backend_operation_counts``; on the baseline the driver + ``anyfesolver.linalg.backend_operation_counts``; on the baseline the driver installs counting wrappers around the equivalent linalg call sites (PARDISO phase-12 full factorizations, phase-22 symbolic refreshes, stale handle rebuilds and scipy/superlu factorizations). Wrappers only count; @@ -46,8 +46,8 @@ def positions(history: str): def mixed_free_model(bodies=1): - from anysolver import FEModel, LoadCase, assemble_load_vector - from anysolver.elements import BeamElement, create_shell_element + from anyfesolver import FEModel, LoadCase, assemble_load_vector + from anyfesolver.elements import BeamElement, create_shell_element model = FEModel('balanced mixed static stream') model.add_material('steel', 210e9, .3, density=7850.) groups = [] @@ -97,7 +97,7 @@ def mixed_free_model(bodies=1): def free_cases(model,groups,balancing,indices): - from anysolver import LoadCase + from anyfesolver import LoadCase for position in indices: t=.1*position load=LoadCase(f'case-{position:03}') @@ -171,7 +171,7 @@ def install_backend_counters(linalg): required=('_pardiso_full_factorize','_new_pypardiso_solver','_PardisoFactorization','splu') missing=[name for name in required if not hasattr(linalg,name)] if missing: - raise RuntimeError('baseline anysolver.linalg lacks symbols required ' + raise RuntimeError('baseline anyfesolver.linalg lacks symbols required ' f'for equivalent backend instrumentation: {missing}') lock=threading.Lock() counters={'scipy_factorization_attempts':0, @@ -214,11 +214,11 @@ def wrapped_splu(*args,**kwargs): def counts(): with lock: return dict(counters) return counts,{'mode':'driver-wrapper', - 'wrapped_symbols':['anysolver.linalg._pardiso_full_factorize', - 'anysolver.linalg._new_pypardiso_solver' + 'wrapped_symbols':['anyfesolver.linalg._pardiso_full_factorize', + 'anyfesolver.linalg._new_pypardiso_solver' ' (+ solver-class set_phase(22) counting)', - 'anysolver.linalg._PardisoFactorization._active_solver', - 'anysolver.linalg.splu'], + 'anyfesolver.linalg._PardisoFactorization._active_solver', + 'anyfesolver.linalg.splu'], 'note':'counting wrappers only; no mechanical change'} @@ -227,9 +227,9 @@ def counts(): 'load_evaluation':'constructing each load record (case resolution / LoadCase definition)', 'batch_solve':'one anyfem.solve_linear_static_many call; includes its internal load ' 'assembly and all solves', - 'solve':'one anysolver.solve_linear call per case; includes its internal assembly, ' + 'solve':'one anyfesolver.solve_linear call per case; includes its internal assembly, ' 'factorization and solve work', - 'stress_recovery':'one anysolver.recover_stress_result call per case', + 'stress_recovery':'one anyfesolver.recover_stress_result call per case', 'constraint_diagnostics':'one compute_constraint_force_diagnostics call per case', 'envelope_output':'selected-output extraction and envelope reduction'}, 'candidate':{ @@ -262,10 +262,10 @@ def main(): help='Evenly spaced subset of the frozen history for bounded checks; not a full primary/holdout campaign') args=parser.parse_args() driver_start=time.perf_counter() - import anysolver - import anysolver.linalg as solver_linalg - from anysolver import AnalysisSession,RecoveryConfig,ResourceConfig - from anysolver.assembly import compute_constraint_force_diagnostics + import anyfesolver + import anyfesolver.linalg as solver_linalg + from anyfesolver import AnalysisSession,RecoveryConfig,ResourceConfig + from anyfesolver.assembly import compute_constraint_force_diagnostics from threadpoolctl import threadpool_info import psutil counts,instrumentation=install_backend_counters(solver_linalg) @@ -325,7 +325,7 @@ def records(): return free_cases(model,groups,balancing,indices) return # The identical reducer implementation is used in both measurements. It is # standalone and imports no solver package, so baseline mechanics stay old. - spec=importlib.util.spec_from_file_location('benchmark_envelope',Path(__file__).parents[1]/'src/anysolver/static_envelopes.py') + spec=importlib.util.spec_from_file_location('benchmark_envelope',Path(__file__).parents[1]/'src/anyfesolver/static_envelopes.py') module=importlib.util.module_from_spec(spec);sys.modules[spec.name]=module;spec.loader.exec_module(module) def run(session): reducer=module.EnvelopeReducer() @@ -369,7 +369,7 @@ def consume(index,case_id,instant,u,stresses,forces): batch_size=args.block_size,output_dofs=dofs,recovery_config=config, resource_config=resources,session=session) else: - from anysolver import iter_linear_batches,StaticCase + from anyfesolver import iter_linear_batches,StaticCase stream=iter_linear_batches(model,(StaticCase(name,load,t) for name,t,load in records()), batch_size=args.block_size,output_dofs=dofs,recovery_config=config, resource_config=resources,session=session) @@ -403,7 +403,7 @@ def consume(index,case_id,instant,u,stresses,forces): for i,(name,t,_) in enumerate(cases): shape=solved.shapes[i] recovery_start=time.perf_counter() - stresses=anysolver.recover_stress_result(model,shape.displacements, + stresses=anyfesolver.recover_stress_result(model,shape.displacements, recovery_config=config,resource_config=resources).element_stresses phases['stress_recovery']+=time.perf_counter()-recovery_start diagnostics_start=time.perf_counter() @@ -423,11 +423,11 @@ def consume(index,case_id,instant,u,stresses,forces): if record is None: break name,t,load=record solve_start=time.perf_counter() - u,info=anysolver.solve_linear(model,load,session=session,resource_config=resources) + u,info=anyfesolver.solve_linear(model,load,session=session,resource_config=resources) phases['solve']+=time.perf_counter()-solve_start if info['convergence_info']['status']!='converged': raise RuntimeError(info) recovery_start=time.perf_counter() - stresses=anysolver.recover_stress_result(model,u,recovery_config=config, + stresses=anyfesolver.recover_stress_result(model,u,recovery_config=config, resource_config=resources).element_stresses phases['stress_recovery']+=time.perf_counter()-recovery_start diagnostics_start=time.perf_counter() @@ -500,7 +500,7 @@ def consume(index,case_id,instant,u,stresses,forces): 'sample_cases':args.sample_cases, 'fixture':str(args.fixture) if args.fixture is not None else None, 'resource_config':{'solver_threads':1,'assembly_threads':1,'recovery_threads':1}, - 'runtime':{'python':sys.executable,'solver':anysolver.__file__, + 'runtime':{'python':sys.executable,'solver':anyfesolver.__file__, 'application':getattr(anyfem,'__file__',None) if anyfem is not None else None, 'threadpools':threadpool_info()}, 'model_dofs':model.mesh.dof_manager.total_dofs, diff --git a/scripts/benchmark_static_native_study.py b/scripts/benchmark_static_native_study.py index 75ff20eac..34c17ecc4 100644 --- a/scripts/benchmark_static_native_study.py +++ b/scripts/benchmark_static_native_study.py @@ -4,10 +4,10 @@ import numpy as np import pathlib; WT = str(pathlib.Path(__file__).resolve().parents[1]) sys.path.insert(0, WT + r'\scripts') -import anysolver as fs -from anysolver.elements import create_shell_element -from anysolver.boundary import FixedSupport, LoadCase, BoundaryCondition -from anysolver.material_curves import DNVC208MaterialCurve +import anyfesolver as fs +from anyfesolver.elements import create_shell_element +from anyfesolver.boundary import FixedSupport, LoadCase, BoundaryCondition +from anyfesolver.material_curves import DNVC208MaterialCurve def H(*arrs): h = hashlib.sha256() @@ -52,7 +52,7 @@ def nl_result(r): def case_lin_plate(): m, L = plate(24, .01, 1e4) t0 = time.perf_counter(); u, info = fs.solve_linear(m, L); t1 = time.perf_counter() - from anysolver.assembly import compute_stresses + from anyfesolver.assembly import compute_stresses s = compute_stresses(m, u); t2 = time.perf_counter() arrs = [u] for e in sorted(s): @@ -89,7 +89,7 @@ def case_arc_panel(): def case_prepared_envelope(): from benchmark_static_batches import mixed_free_model, free_cases, positions - from anysolver import prepare_static_evaluator, StaticCase, RecoveryConfig, ResourceConfig + from anyfesolver import prepare_static_evaluator, StaticCase, RecoveryConfig, ResourceConfig model, groups, balancing = mixed_free_model(1) idx = [positions('pilot')[i] for i in np.linspace(0, len(positions('pilot'))-1, 4, dtype=int)] nodes = tuple(model.mesh.nodes); els = tuple(model.mesh.elements) diff --git a/scripts/benchmark_stiff_plate_precision.py b/scripts/benchmark_stiff_plate_precision.py index cb717fa70..a45e4ddc3 100644 --- a/scripts/benchmark_stiff_plate_precision.py +++ b/scripts/benchmark_stiff_plate_precision.py @@ -1,24 +1,24 @@ """Fresh-process warmed source-frozen stiff-plate comparison. -Each invocation loads one complete source overlay before ANYsolver imports, +Each invocation loads one complete source overlay before ANYfeSolver imports, warms it once and measures once. The outer ledger alternates variants by pair. """ from __future__ import annotations import argparse,hashlib,importlib.util,json,os,pathlib,platform,sys,time p=argparse.ArgumentParser();p.add_argument('--variant',choices=['baseline','candidate'],required=True);p.add_argument('--baseline-dir',type=pathlib.Path,required=True);p.add_argument('--output',type=pathlib.Path,required=True);p.add_argument('--pair',type=int,required=True);a=p.parse_args() -repo=pathlib.Path(__file__).resolve().parents[1];source=repo/'src/anysolver' +repo=pathlib.Path(__file__).resolve().parents[1];source=repo/'src/anyfesolver' if a.variant=='baseline': overlay=a.baseline_dir/'overlay';overlay.mkdir(exist_ok=True) for dest,old in [('corotational.py','corotational_before.py'),('_corotational_batch.py','batch_before.py'),('nonlinear_static.py','nonlinear_static_before.py'),('recovery.py','recovery_before.py'),('_plate_stability_continuation.py','stability_before.py')]: (overlay/dest).write_bytes((a.baseline_dir/old).read_bytes()) - spec=importlib.util.spec_from_file_location('anysolver',source/'__init__.py',submodule_search_locations=[str(overlay),str(source)]) - package=importlib.util.module_from_spec(spec);sys.modules['anysolver']=package;spec.loader.exec_module(package) + spec=importlib.util.spec_from_file_location('anyfesolver',source/'__init__.py',submodule_search_locations=[str(overlay),str(source)]) + package=importlib.util.module_from_spec(spec);sys.modules['anyfesolver']=package;spec.loader.exec_module(package) import numpy as np import scipy -import anysolver as fs -import anysolver.nonlinear_static as ns -import anysolver.corotational as cr -import anysolver.recovery as recovery +import anyfesolver as fs +import anyfesolver.nonlinear_static as ns +import anyfesolver.corotational as cr +import anyfesolver.recovery as recovery from threadpoolctl import threadpool_info from explore_nonlinear_abuse import plate_model diff --git a/scripts/build_accuracy_report.py b/scripts/build_accuracy_report.py index 1aef7f856..eb992fdb2 100644 --- a/scripts/build_accuracy_report.py +++ b/scripts/build_accuracy_report.py @@ -73,7 +73,7 @@ def table(headers,rows,widths=None): t.setStyle(TableStyle([('BACKGROUND',(0,0),(-1,0),NAVY),('TEXTCOLOR',(0,0),(-1,0),colors.white),('ROWBACKGROUNDS',(0,1),(-1,-1),[colors.white,PALE]),('VALIGN',(0,0),(-1,-1),'TOP'),('TOPPADDING',(0,0),(-1,-1),7),('BOTTOMPADDING',(0,0),(-1,-1),7),('LEFTPADDING',(0,0),(-1,-1),6),('RIGHTPADDING',(0,0),(-1,-1),6),('LINEBELOW',(0,0),(-1,0),.7,TEAL)])) story.append(t);story.append(Spacer(1,9)) story.append(Spacer(1,22*mm)) - story.append(Paragraph('ANYsolver
Accuracy evidence',styles['TitleAccuracy'])) + story.append(Paragraph('ANYfeSolver
Accuracy evidence',styles['TitleAccuracy'])) p('Linear-static commercial reference comparisons and a synthesis of earlier verification work.') p(f'{DATE} | Evidence report, revision 1') story.append(Spacer(1,12*mm)) @@ -83,7 +83,7 @@ def table(headers,rows,widths=None): p(f'Current repository HEAD: {commit}. Current comparison source includes uncommitted development work; per-file hashes are retained. Earlier reports apply to their own recorded versions.',small=True) page('1 | Conclusions and evidence strength') - p('The existing evidence supports a useful but bounded conclusion: elementary beam response and selected shell controls are accurate within their declared criteria. Matched shell formulations remove most of the earlier apparent ANYsolver/SESTRA discrepancy. Combined models still require quantity-specific convergence and some comparisons retain failed components.') + p('The existing evidence supports a useful but bounded conclusion: elementary beam response and selected shell controls are accurate within their declared criteria. Matched shell formulations remove most of the earlier apparent ANYfeSolver/SESTRA discrepancy. Combined models still require quantity-specific convergence and some comparisons retain failed components.') table(['Finding','Evidence and practical meaning'],[ ['Standalone upright flatbar','Translations and all beam-force/moment stations pass the existing SESTRA criteria; analytical Timoshenko tip displacement agrees.'], ['Plate reference formulation','SESTRA originally used FQUS thin shells. THCK=1 replaces them with THQS thick shells; this substantially reduces displacement and beam-force discrepancies.'], @@ -98,7 +98,7 @@ def table(headers,rows,widths=None): page('2 | Method and reproducibility') sub('One physical input, two execution routes') - p('A parameterised definition sets geometry, materials, sections, local axes, eccentricities, supports and loads. The canonical ANYfileIO writer produces FEM files. SESTRA executes those files directly; ANYsolver imports the same files through its SESAM adapter. This reduces model differences but does not remove the possibility of a shared modelling mistake.') + p('A parameterised definition sets geometry, materials, sections, local axes, eccentricities, supports and loads. The canonical ANYfileIO writer produces FEM files. SESTRA executes those files directly; ANYfeSolver imports the same files through its SESAM adapter. This reduces model differences but does not remove the possibility of a shared modelling mistake.') p('Independent audits check topology, section orientation, centroids, load resultants, clamped DOFs, physical coordinate systems and source/result identity. Analytical controls and refinement are therefore retained alongside cross-solver agreement. The original reference files remain immutable; modified geometry receives a distinct case identity.') sub('Fixed comparison criteria') table(['Observable','Development criterion'],[ @@ -114,10 +114,10 @@ def table(headers,rows,widths=None): page('3 | Original plate, flatbar and combined model') p('The retained GeniE-origin model has a 2 m x 2 m XY plate, 20 mm thickness, 400 quadrilateral shells and an upright 100 mm x 10 mm flatbar along its centreline. The y=0 edge is fully clamped and pressure is -1000 Pa. The section strong-axis inertia is about 8.333333e-7 m4. Its original centroid offset is -50 mm relative to the plate midsurface.') - table(['Original model','ANYsolver peak mm','SESTRA thin mm','SESTRA thick mm'],[ + table(['Original model','ANYfeSolver peak mm','SESTRA thin mm','SESTRA thick mm'],[ ['Plate','13.424466','13.440851','13.423233'],['Combined, -50 mm','4.428891','4.452274','4.429457'],['Isolated beam, 1000 N tip','15.275238','15.275238','Not applicable'] ],[56*mm,39*mm,39*mm,40*mm]) - p('Changing only the SESTRA shell option reduces peak displacement difference from 0.122% to 0.0092% for the plate, and from 0.525% to 0.0128% for the combined model. Original root beam shear changes from SESTRA thin -1404.721 N to thick -665.326 N; ANYsolver gives -669.054 N. Small peak errors do not mean the complete field passes.') + p('Changing only the SESTRA shell option reduces peak displacement difference from 0.122% to 0.0092% for the plate, and from 0.525% to 0.0128% for the combined model. Original root beam shear changes from SESTRA thin -1404.721 N to thick -665.326 N; ANYfeSolver gives -669.054 N. Small peak errors do not mean the complete field passes.') p('The official SESTRA manual places ELOP WCOR in columns 21-25 and THCK in columns 26-30. The original second field is zero. THCK=1 replaces FQUS with THQS; the actual log override is checked, since the input inventory can still display FQUS names.') p('The isolated beam hand check is w_tip = -P L^3/(3 E Iy) - P L/(kz G A), using the actual admitted section shear factor. The result is approximately -15.275238 mm. The flatbar orientation was audited from its actual transformation and inertia, rather than inferred from a schematic drawing.') p('For a bar directly below the underside of a 20 mm plate, the correct centroid is -(plate thickness + bar height)/2, approximately -60 mm. A separate under-plate model was generated; the original -50 mm model was not silently changed.') @@ -208,11 +208,11 @@ def table(headers,rows,widths=None): sub('Literature names are not independent targets') p('The historical twisted-cantilever, Scordelis-Lo roof, pinched-cylinder and hemispherical-shell entries explicitly lack their bundled external literature targets. Their checks are internal refinement or symmetry. They must not be presented as completed literature-accuracy validations, even where the stored disposition is PASS. The hemispherical refinement response ratio is about 1.324, so a passed bookkeeping check does not imply mesh convergence.') if application: - p(f'The separate ANYfem application report is dated {application.get("generated")} and records 21 passing checks. It includes analytical static, modal, buckling and dynamic controls plus meshing/load/project invariants. It belongs to the recorded application version and is supporting ecosystem evidence, not an interchangeable ANYsolver certification.') + p(f'The separate ANYfem application report is dated {application.get("generated")} and records 21 passing checks. It includes analytical static, modal, buckling and dynamic controls plus meshing/load/project invariants. It belongs to the recorded application version and is supporting ecosystem evidence, not an interchangeable ANYfeSolver certification.') page('7 | Earlier external and wider-domain evidence') if external: - p('A retained CalculiX report records actual execution of pressure-plate, beam-column buckling and cylindrical-shell cases. Its observable comparisons are primarily against analytical targets. Those are external-solver versus analytical checks, not automatically direct current ANYsolver versus CalculiX comparisons.') + p('A retained CalculiX report records actual execution of pressure-plate, beam-column buckling and cylindrical-shell cases. Its observable comparisons are primarily against analytical targets. Those are external-solver versus analytical checks, not automatically direct current ANYfeSolver versus CalculiX comparisons.') rows=[] for c in external['cases']: validation=c.get('validation',{}) @@ -248,7 +248,7 @@ def table(headers,rows,widths=None): sub('Claims supported by this evidence') p('For the measured standalone beam and analytical strip controls, the specified linear response agrees closely with independent formulas and the matched reference. For the tested coupled models, most of the earlier discrepancy is attributable to reference formulation and nodal response; remaining component failures and local-force mesh sensitivity are explicit.') sub('What still prevents a general statement') - p('The evidence does not establish a solver-wide error bound. Remaining obligations include converged local beam/shear transfer, pointwise shell bending and membrane resultants in matched frames, broader boundary/load/section orientations, distorted and curved geometry, benchmark targets independent of ANYsolver, and current installed-artifact evidence. New nonlinear/dynamic claims need their own completed studies.') + p('The evidence does not establish a solver-wide error bound. Remaining obligations include converged local beam/shear transfer, pointwise shell bending and membrane resultants in matched frames, broader boundary/load/section orientations, distorted and curved geometry, benchmark targets independent of ANYfeSolver, and current installed-artifact evidence. New nonlinear/dynamic claims need their own completed studies.') table(['Next evidence slice','Acceptance question'],[ ['Local force convergence','Do common physical beam cuts converge with independently controlled beam and shell meshes, under matched reference formulations?'], ['Shell recovery','Do top/bottom bending and membrane resultants agree at matching stations and layers, instead of averaging bending away?'], @@ -258,7 +258,7 @@ def table(headers,rows,widths=None): p('The practical regime is plate alone, isolated beam, then combined structures; analytical controls and whole-field/local-force refinements accompany every stage. Neither a commercial solver name nor a large test count removes the need for these checks.') page('Appendix A | Inputs, software and evidence identities') - p('Machine-readable companion: ANYsolver_Accuracy_Report.evidence.json. It contains full SHA-256 values, file sizes, source commit and the input inventory used to generate this PDF. The PDF table uses hash prefixes for readability. Full raw values, commands, failures and logs remain in the referenced evidence directories.') + p('Machine-readable companion: ANYfeSolver_Accuracy_Report.evidence.json. It contains full SHA-256 values, file sizes, source commit and the input inventory used to generate this PDF. The PDF table uses hash prefixes for readability. Full raw values, commands, failures and logs remain in the referenced evidence directories.') unique={item['path']:item for item in evidence} rows=[] for item in unique.values(): @@ -267,17 +267,17 @@ def table(headers,rows,widths=None): except ValueError:label=path.as_posix() rows.append([label,item['sha256'][:16],str(item['bytes'])]) table(['Evidence path relative to repository','SHA-256 prefix','Bytes'],rows,[117*mm,37*mm,20*mm]) - p('SESTRA runs: C:/DNV/Workspaces/ANYsolver_SESTRA_deep_20261008 and C:/DNV/Workspaces/ANYsolver_SESTRA_structures_20261008. Each executed case has its own hashed input/control/output and execution record. Failed comparisons remain evidence; unexecuted decks remain handoff artifacts.') + p('SESTRA runs: C:/DNV/Workspaces/ANYfeSolver_SESTRA_deep_20261008 and C:/DNV/Workspaces/ANYfeSolver_SESTRA_structures_20261008. Each executed case has its own hashed input/control/output and execution record. Failed comparisons remain evidence; unexecuted decks remain handoff artifacts.') p('References: DNV SESTRA user manual, ELOP control and THQS description; DNV SESAM Input and Results Interface Format for IDs, eccentricities, result cases, stations, frames and physical force conventions.',small=True) for label,url in [('SESTRA user manual','https://sesam.dnv.com/download/userdocumentation/sestra-um.pdf'),('SESAM input interface','https://sesam.dnv.com/download/windows64/sesam_input_interface_format.pdf'),('SESAM results interface','https://sesam.dnv.com/download/windows64/sesam_results_interface_format.pdf')]: p(f'{label}',small=True) manifest={'schema_version':1,'report_date_local':DATE,'report_scope':'linear-static external comparisons plus historical and route-specific evidence synthesis','git_head':commit,'dirty_source':True,'inputs':list(unique.values()),'structure_report':structure_report,'visual_directory':visual_directory,'comparison_loaded_sources':structure.get('loaded_sources') if structure else None,'comparison_runtime':structure.get('runtime') if structure else None,'comparison_harness':structure.get('harness') if structure else None,'report_builder':ident(__file__),'qualification_claim':False} - (OUT/'ANYsolver_Accuracy_Report.evidence.json').write_text(json.dumps(manifest,indent=2),encoding='utf-8') - pdf=OUT/'ANYsolver_Accuracy_Report.pdf' + (OUT/'ANYfeSolver_Accuracy_Report.evidence.json').write_text(json.dumps(manifest,indent=2),encoding='utf-8') + pdf=OUT/'ANYfeSolver_Accuracy_Report.pdf' def footer(canvas,doc): canvas.saveState();canvas.setStrokeColor(TEAL);canvas.setLineWidth(.5);canvas.line(18*mm,17*mm,192*mm,17*mm) - canvas.setFont('Helvetica',7);canvas.setFillColor(INK);canvas.drawString(18*mm,12*mm,'ANYsolver | Accuracy evidence | '+DATE);canvas.drawRightString(192*mm,12*mm,str(doc.page));canvas.restoreState() - doc=SimpleDocTemplate(str(pdf),pagesize=(210*mm,297*mm),rightMargin=18*mm,leftMargin=18*mm,topMargin=20*mm,bottomMargin=23*mm,title='ANYsolver Accuracy Evidence',author='ANYsolver verification',subject='Measured scope, reference comparisons and limitations') + canvas.setFont('Helvetica',7);canvas.setFillColor(INK);canvas.drawString(18*mm,12*mm,'ANYfeSolver | Accuracy evidence | '+DATE);canvas.drawRightString(192*mm,12*mm,str(doc.page));canvas.restoreState() + doc=SimpleDocTemplate(str(pdf),pagesize=(210*mm,297*mm),rightMargin=18*mm,leftMargin=18*mm,topMargin=20*mm,bottomMargin=23*mm,title='ANYfeSolver Accuracy Evidence',author='ANYfeSolver verification',subject='Measured scope, reference comparisons and limitations') doc.build(story,onFirstPage=footer,onLaterPages=footer) print(json.dumps({'pdf':str(pdf),'inputs':len(unique),'structure_report':structure_report})) diff --git a/scripts/build_beam_shell_candidate.py b/scripts/build_beam_shell_candidate.py index 5e9a256ee..84948229c 100644 --- a/scripts/build_beam_shell_candidate.py +++ b/scripts/build_beam_shell_candidate.py @@ -26,7 +26,7 @@ "threadpoolctl==3.7.0", "shapely==2.2.0", "pytest==9.1.1", "psutil==7.2.2"] PRIVATE = ["anyfileio-0.3.2-py3-none-any.whl", "anygeometry-0.4.3-py3-none-any.whl", "anymaterial-0.2.0-py3-none-any.whl", "anymesher-0.5.0-py3-none-any.whl", - "anysolver_results-2.1.1-py3-none-any.whl"] + "anyfesolver_results-2.1.1-py3-none-any.whl"] TESTS = ["test_beam_shell_connection_options.py", "test_director_integrated_trace.py", "test_beam_shell_workflow.py", "test_beam_shell_checkpoint_workflow.py", "test_nonlinear_beam_shell_slice3_continuation.py"] @@ -47,7 +47,7 @@ def main(): output.mkdir(parents=True, exist_ok=False) commit = subprocess.check_output(["git", "rev-parse", args.source_ref + "^{commit}"], cwd=ROOT, text=True).strip() - selected = ["src/anysolver", "pyproject.toml", "README.md", "LICENSE", "COPYRIGHT", + selected = ["src/anyfesolver", "pyproject.toml", "README.md", "LICENSE", "COPYRIGHT", "THIRD_PARTY_NOTICES.md", "examples/beam_shell_coupling.py", "docs/BEAM_SHELL_CONNECTION.md", "CHANGELOG.md", "scripts/build_static_contact_candidate.py", "scripts/contact_candidate_slice2.json"] @@ -90,7 +90,7 @@ def main(): finally: os.chdir(previous) sources = {str(p.relative_to(stage / "src")): sha(p) - for p in sorted((stage / "src" / "anysolver").rglob("*")) + for p in sorted((stage / "src" / "anyfesolver").rglob("*")) if p.is_file() and "__pycache__" not in p.parts and p.suffix != ".pyc"} for directory in ("examples", "docs", "tests"): shutil.copytree(committed / directory, bundle / directory) @@ -175,7 +175,7 @@ def main(): runtime_environment=environment, install_command=recipe) (bundle / "MANIFEST.json").write_text(json.dumps(manifest, indent=2), encoding="utf-8") - zip_path = Path(shutil.make_archive(str(output / ("ANYsolver-beam-shell-"+VERSION)), + zip_path = Path(shutil.make_archive(str(output / ("ANYfeSolver-beam-shell-"+VERSION)), "zip", root_dir=bundle)) (output / "BUILD.json").write_text(json.dumps(dict(source_commit=commit, bundle=str(bundle), zip=str(zip_path), sha256=sha(zip_path)), indent=2)) diff --git a/scripts/check_license_compliance.py b/scripts/check_license_compliance.py index 1a5bfb3bd..1f0a7c8a7 100644 --- a/scripts/check_license_compliance.py +++ b/scripts/check_license_compliance.py @@ -19,7 +19,11 @@ "1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5" ) EXPECTED_PROJECT_LICENSE = "MPL-2.0" -EXPECTED_RELEASE = "0.4.7" +EXPECTED_RELEASE = "0.5.0" +EXPECTED_PROJECT_NAME = "ANYfeSolver" +EXPECTED_RESULTS_NAME = "ANYfeSolver-results" +EXPECTED_RESULTS_RELEASE = "2.2.0" +EXPECTED_RESULTS_REQUIREMENT = "ANYfeSolver-results>=2.2,<3" REQUIRED_NOTICE_FILES = {"LICENSE", "COPYRIGHT", "THIRD_PARTY_NOTICES.md"} REQUIRED_SDIST_FILES = REQUIRED_NOTICE_FILES | { "LICENSING.md", @@ -77,8 +81,33 @@ def validate_repository(root: Path = ROOT) -> None: with (root / "pyproject.toml").open("rb") as stream: project = tomllib.load(stream)["project"] + if project.get("name") != EXPECTED_PROJECT_NAME: + errors.append(f"project name is not {EXPECTED_PROJECT_NAME}") if project.get("version") != EXPECTED_RELEASE: errors.append(f"project version is not {EXPECTED_RELEASE}") + if EXPECTED_RESULTS_REQUIREMENT not in project.get("dependencies", ()): + errors.append(f"project lacks dependency {EXPECTED_RESULTS_REQUIREMENT}") + + results_toml = root / "packages" / "results" / "pyproject.toml" + with results_toml.open("rb") as stream: + results = tomllib.load(stream)["project"] + if results.get("name") != EXPECTED_RESULTS_NAME: + errors.append(f"results name is not {EXPECTED_RESULTS_NAME}") + if results.get("version") != EXPECTED_RESULTS_RELEASE: + errors.append(f"results version is not {EXPECTED_RESULTS_RELEASE}") + if results.get("license") != EXPECTED_PROJECT_LICENSE: + errors.append("results license is not MPL-2.0") + if set(results.get("license-files", ())) != REQUIRED_NOTICE_FILES: + errors.append("results license-files does not bind every required notice") + for notice in sorted(REQUIRED_NOTICE_FILES): + if not (root / "packages" / "results" / notice).is_file(): + errors.append(f"results notice file is missing: {notice}") + # The results package carries its own LICENSE copy; it must be the same text. + results_license = root / "packages" / "results" / "LICENSE" + if results_license.is_file(): + results_hash = hashlib.sha256(_normalized_license_bytes(results_license)).hexdigest() + if results_hash != EXPECTED_LICENSE_SHA256: + errors.append(f"results LICENSE hash mismatch: {results_hash}") if project.get("license") != EXPECTED_PROJECT_LICENSE: errors.append(f"project license is not {EXPECTED_PROJECT_LICENSE}") if set(project.get("license-files", ())) != REQUIRED_NOTICE_FILES: @@ -95,9 +124,9 @@ def validate_repository(root: Path = ROOT) -> None: "schema", }: errors.append("dependency inventory top-level schema is incorrect") - if inventory.get("schema") != "anysolver.dependency-licences-v1": + if inventory.get("schema") != "anyfesolver.dependency-licences-v1": errors.append("dependency inventory schema ID is incorrect") - if inventory.get("project") != "ANYsolver": + if inventory.get("project") != EXPECTED_PROJECT_NAME: errors.append("dependency inventory project is incorrect") if inventory.get("project_licence") != EXPECTED_PROJECT_LICENSE: errors.append("dependency inventory project licence is incorrect") @@ -151,6 +180,8 @@ def validate_repository(root: Path = ROOT) -> None: if "licensed under the Mozilla Public\nLicense 2.0" not in readme: errors.append("README MPL-2.0 statement is missing") changelog = (root / "CHANGELOG.md").read_text(encoding="utf-8") + if "## 0.5.0 - " not in changelog: + errors.append("0.5.0 changelog section is missing") if "## 0.4.7 - 2026-09-21" not in changelog: errors.append("0.4.7 changelog section is missing") if "## 0.4.6 - 2026-09-16" not in changelog: @@ -165,7 +196,7 @@ def validate_repository(root: Path = ROOT) -> None: errors.append("0.4.0 relicensing note is missing") if "GPL-3.0-or-later" in (root / "pyproject.toml").read_text(encoding="utf-8"): errors.append("obsolete GPL project metadata remains") - for filename in (*REQUIRED_SDIST_FILES, "README.md"): + for filename in (*REQUIRED_SDIST_FILES, "README.md", "docs/releases/ANYfeSolver_0.5.0.md"): if not (root / filename).is_file(): errors.append(f"required release file is missing: {filename}") @@ -189,21 +220,30 @@ def _artifact_members(path: Path) -> tuple[set[str], str | None]: raise ComplianceError(f"unsupported release artifact: {path.name}") -def validate_artifact(path: Path) -> None: +def validate_artifact( + path: Path, + *, + name: str = EXPECTED_PROJECT_NAME, + release: str = EXPECTED_RELEASE, + results: bool = False, +) -> None: if not path.is_file() or path.stat().st_size <= 0: raise ComplianceError(f"release artifact is missing or empty: {path}") names, metadata = _artifact_members(path) - basenames = {Path(name).name for name in names} - required = REQUIRED_NOTICE_FILES if path.suffix == ".whl" else REQUIRED_SDIST_FILES + basenames = {Path(member).name for member in names} + if path.suffix == ".whl" or results: + required = REQUIRED_NOTICE_FILES + else: + required = REQUIRED_SDIST_FILES missing = sorted(required - basenames) if missing: raise ComplianceError(f"artifact {path.name} is missing: {', '.join(missing)}") if metadata is not None: - if f"Version: {EXPECTED_RELEASE}\n" not in metadata.replace("\r\n", "\n"): - raise ComplianceError( - f"wheel metadata version is not {EXPECTED_RELEASE}" - ) normalized = metadata.replace("\r\n", "\n") + if f"Version: {release}\n" not in normalized: + raise ComplianceError(f"wheel metadata version is not {release}") + if f"Name: {name}\n" not in normalized: + raise ComplianceError(f"wheel metadata name is not {name}") if not any( marker in normalized for marker in ("License-Expression: MPL-2.0\n", "License: MPL-2.0\n") @@ -214,15 +254,26 @@ def validate_artifact(path: Path) -> None: def main(argv: list[str] | None = None) -> int: parser = argparse.ArgumentParser() parser.add_argument("--artifact", action="append", default=[], type=Path) + parser.add_argument("--results-artifact", action="append", default=[], type=Path) args = parser.parse_args(argv) try: validate_repository() for artifact in args.artifact: validate_artifact(artifact.resolve()) + for artifact in args.results_artifact: + validate_artifact( + artifact.resolve(), + name=EXPECTED_RESULTS_NAME, + release=EXPECTED_RESULTS_RELEASE, + results=True, + ) except (ComplianceError, OSError, KeyError, TypeError, ValueError) as error: print(f"license compliance failed: {error}", file=sys.stderr) return 1 - print(f"license compliance passed for ANYsolver {EXPECTED_RELEASE}") + print( + f"license compliance passed for {EXPECTED_PROJECT_NAME} {EXPECTED_RELEASE} " + f"and {EXPECTED_RESULTS_NAME} {EXPECTED_RESULTS_RELEASE}" + ) return 0 diff --git a/scripts/check_s4_geometry_handoff.py b/scripts/check_s4_geometry_handoff.py index 816b0fd0e..cd138217f 100644 --- a/scripts/check_s4_geometry_handoff.py +++ b/scripts/check_s4_geometry_handoff.py @@ -17,15 +17,15 @@ if str(SRC) not in sys.path: sys.path.insert(0, str(SRC)) -import anysolver.shell_formulations.director_field as director_field_module # noqa: E402 -from anysolver.shell_formulations.director_field import ( # noqa: E402 +import anyfesolver.shell_formulations.director_field as director_field_module # noqa: E402 +from anyfesolver.shell_formulations.director_field import ( # noqa: E402 DirectorValidationLimits, PreparedDirectorField, SourceCornerSamples, prepare_supplied_corner_directors, reconstruct_corner_directors, ) -from anysolver.shell_formulations.geometry_provenance import ( # noqa: E402 +from anyfesolver.shell_formulations.geometry_provenance import ( # noqa: E402 GeometryAuditStatus, GeometryProvenanceHeader, GeometryProvenanceTables, @@ -39,7 +39,7 @@ validate_provenance_snapshot, validate_shell_source_association, ) -from anysolver.shell_formulations.mitc4_plus_d_quality import ( # noqa: E402 +from anyfesolver.shell_formulations.mitc4_plus_d_quality import ( # noqa: E402 numeric_payload_fingerprint, ) @@ -316,7 +316,7 @@ def _linear_preprocessing_structure_check() -> MappingResult: def _no_geometry_import_check() -> MappingResult: imported: set[str] = set() for name in ("geometry_provenance.py", "director_field.py", "mitc4_plus_d_quality.py"): - path = SRC / "anysolver" / "shell_formulations" / name + path = SRC / "anyfesolver" / "shell_formulations" / name tree = ast.parse(path.read_text(encoding="utf-8"), filename=str(path)) for node in ast.walk(tree): if isinstance(node, ast.Import): diff --git a/scripts/check_u1_canary_trace_work.py b/scripts/check_u1_canary_trace_work.py index 9c6db0760..5583e5200 100644 --- a/scripts/check_u1_canary_trace_work.py +++ b/scripts/check_u1_canary_trace_work.py @@ -17,7 +17,7 @@ from numpy.polynomial import Polynomial as P -ARCHIVE = Path("C:/Github/ANYsolver/.qualification/b3-ge-e4-pl/calculix-223/ccx_2.23.src.tar.bz2") +ARCHIVE = Path("C:/Github/ANYfeSolver/.qualification/b3-ge-e4-pl/calculix-223/ccx_2.23.src.tar.bz2") EXPECTED = "9c88385c10fb04f5dc6c4e98027a51bebdd8aee3920e05190d6c1dd08357d6e7" diff --git a/scripts/common_main_check_20261008.py b/scripts/common_main_check_20261008.py index ee684f3d1..0ee375716 100644 --- a/scripts/common_main_check_20261008.py +++ b/scripts/common_main_check_20261008.py @@ -5,7 +5,7 @@ REPO = Path(__file__).resolve().parents[1] RAW = REPO / '.development/common-main-20261008' SITE = RAW / 'site-v5' -DEPS = Path('C:/Github/ANYsolver/.perf2-worktrees/stiffened-main-reconcile-20261001/.qualification/b3-ge-e4-pl/r8-native-s3-restart-binding-dev-20261005-v1/ci-site-network-v2') +DEPS = Path('C:/Github/ANYfeSolver/.perf2-worktrees/stiffened-main-reconcile-20261001/.qualification/b3-ge-e4-pl/r8-native-s3-restart-binding-dev-20261005-v1/ci-site-network-v2') BASE = Path('C:/Python/Python314/Lib/site-packages') SIBLINGS = [Path('C:/Github') / n / 'src' for n in ('ANYmaterial', 'ANYfileIO', 'ANYmesh', 'ANYgeometry')] ENV = dict(NUMBA_DISABLE_JIT='1', NUMBA_NUM_THREADS='1', OMP_NUM_THREADS='1', OPENBLAS_NUM_THREADS='1', MKL_NUM_THREADS='1', NUMEXPR_NUM_THREADS='1', PYTEST_DISABLE_PLUGIN_AUTOLOAD='1', PIP_NO_INDEX='1') @@ -52,15 +52,15 @@ def child(args): subprocess.run([sys.executable, '-m', 'pip', 'install', '--no-index', '--no-deps', '--target', str(SITE), str(wheels[0])], env=env, check=True) write(out / 'artifact.json', {'wheel': str(wheels[0]), 'sha256': sha(wheels[0]), 'site': str(SITE)}) return 0 - import anysolver, psutil, numpy, scipy, numba + import anyfesolver, psutil, numpy, scipy, numba from threadpoolctl import threadpool_info - imported = Path(anysolver.__file__).resolve() + imported = Path(anyfesolver.__file__).resolve() expected = (REPO / 'src' if args.mode == 'source' else SITE).resolve() if not imported.is_relative_to(expected): - raise RuntimeError(f'Wrong ANYsolver import: {imported}') + raise RuntimeError(f'Wrong ANYfeSolver import: {imported}') if numba.get_num_threads() != 1 or not numba.config.DISABLE_JIT: raise RuntimeError('Effective Numba settings mismatch') - runtime = dict(anysolver=str(imported), numpy=numpy.__version__, scipy=scipy.__version__, numba=numba.__version__, affinity=psutil.Process().cpu_affinity(), jit_disabled=bool(numba.config.DISABLE_JIT), numba_threads=numba.get_num_threads(), pools=threadpool_info(), environment=ENV, mode=args.mode) + runtime = dict(anyfesolver=str(imported), numpy=numpy.__version__, scipy=scipy.__version__, numba=numba.__version__, affinity=psutil.Process().cpu_affinity(), jit_disabled=bool(numba.config.DISABLE_JIT), numba_threads=numba.get_num_threads(), pools=threadpool_info(), environment=ENV, mode=args.mode) write(out / 'runtime-before.json', runtime) if runtime['affinity'] != [0] or any(p['num_threads'] != 1 for p in runtime['pools']): raise RuntimeError('Effective CPU/thread settings mismatch') @@ -71,12 +71,12 @@ def child(args): pools = threadpool_info() if any(p['num_threads'] != 1 for p in pools): raise RuntimeError('Example changed thread settings') - write(out / 'runtime-after.json', dict(imports={n: str(m.__file__) for n, m in list(sys.modules.items()) if n.startswith('anysolver') and getattr(m, '__file__', None)}, pools=pools)) + write(out / 'runtime-after.json', dict(imports={n: str(m.__file__) for n, m in list(sys.modules.items()) if n.startswith('anyfesolver') and getattr(m, '__file__', None)}, pools=pools)) return 0 import pytest # Existing runtime plugin also validates imports after callbacks and tests. os.environ['ANYSOLVER_DEVELOPMENT_RECORD'] = str(out / 'runtime-after.json') - os.environ['ANYSOLVER_DEVELOPMENT_SOURCE'] = str(expected / 'anysolver') + os.environ['ANYSOLVER_DEVELOPMENT_SOURCE'] = str(expected / 'anyfesolver') return int(pytest.main(['-q', '-x', '-o', 'pythonpath=', '-p', 'no:cacheprovider', '-p', 'scripts.development_test_runtime', '--junitxml=' + str(out / 'junit.xml'), '--basetemp=' + str(out / 'temp'), *args.targets])) def main(): @@ -101,7 +101,7 @@ def main(): out = RAW / args.phase out.mkdir(exist_ok=False) head = subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=REPO, text=True).strip() - paths = sorted((REPO / 'src/anysolver').rglob('*.py')) + [REPO / 'pyproject.toml', Path(__file__).resolve()] + paths = sorted((REPO / 'src/anyfesolver').rglob('*.py')) + [REPO / 'pyproject.toml', Path(__file__).resolve()] paths += [REPO / p for p in ('dependency-licenses.json', 'THIRD_PARTY_NOTICES.md', 'scripts/ge_beam3_release_test_inventory.json', 'scripts/run_portable_ci.py', 'scripts/check_license_compliance.py', 'scripts/development_test_runtime.py')] paths += [REPO / t.partition('::')[0] for t in args.targets] identities = {str(p.relative_to(REPO)): sha(p) for p in paths} diff --git a/scripts/compare_fe_baselines.py b/scripts/compare_fe_baselines.py index 44362afd5..d9ed25d23 100644 --- a/scripts/compare_fe_baselines.py +++ b/scripts/compare_fe_baselines.py @@ -13,7 +13,7 @@ if str(SRC) not in sys.path: sys.path.insert(0, str(SRC)) -from anysolver.baselines import DEFAULT_BASELINE_PATH, compare_baseline_documents, generate_baseline_document, load_baseline +from anyfesolver.baselines import DEFAULT_BASELINE_PATH, compare_baseline_documents, generate_baseline_document, load_baseline def main() -> int: diff --git a/scripts/compare_s4_improved.py b/scripts/compare_s4_improved.py index d486092ec..c58af5253 100644 --- a/scripts/compare_s4_improved.py +++ b/scripts/compare_s4_improved.py @@ -12,7 +12,7 @@ ROOT = Path(__file__).resolve().parents[1] REPORT_ROOT = ROOT / "reports" / "s4_improved" -SCHEMA_NAME = "anysolver.s4_improved.benchmark" +SCHEMA_NAME = "anyfesolver.s4_improved.benchmark" SCHEMA_VERSION = 1 @@ -98,7 +98,7 @@ def compare_reports( hard_failures = [row["case_id"] for row in rows if row["status"] == "hard_fail"] unavailable = [row["case_id"] for row in rows if row["status"] == "unavailable"] return { - "schema_name": "anysolver.s4_improved.comparison", + "schema_name": "anyfesolver.s4_improved.comparison", "schema_version": 1, "issues": issues, "cases": rows, diff --git a/scripts/compare_sol_ultra_performance.py b/scripts/compare_sol_ultra_performance.py index 9b320acbf..0c0975830 100644 --- a/scripts/compare_sol_ultra_performance.py +++ b/scripts/compare_sol_ultra_performance.py @@ -19,7 +19,7 @@ ROOT = Path(__file__).resolve().parents[1] REPORT_ROOT = ROOT / "reports" / "performance" -BENCHMARK_SCHEMA = "anysolver.sol_ultra.benchmark" +BENCHMARK_SCHEMA = "anyfesolver.sol_ultra.benchmark" BENCHMARK_SCHEMA_VERSION = 1 @@ -221,7 +221,7 @@ def _environment_rows() -> tuple[tuple[str, ...], ...]: ("packages", "pypardiso"), ("packages", "mkl"), ("packages", "threadpoolctl"), - ("packages", "ANYsolver"), + ("packages", "ANYfeSolver"), ("packages", "ANYmaterial"), ("packages", "ANYmesher"), ("packages", "ANYgeometry"), @@ -265,7 +265,7 @@ def render_report( final_sha = _nested(final, "revision", "head_sha") lines = [ - "# ANYsolver Sol Ultra baseline/final comparison", + "# ANYfeSolver Sol Ultra baseline/final comparison", "", f"- Report status: **{'INCOMPLETE' if issues else 'COMPLETE'}**", f"- Immutable initial `performance_2`: `{_markdown(initial_sha)}`", @@ -502,8 +502,8 @@ def render_report( "", "```powershell", "$env:PYPARDISO_MKL_RT = 'C:\\Python\\Python313\\Library\\bin\\mkl_rt.3.dll'", - "$python = 'C:\\Github\\ANYsolver\\.venv\\Scripts\\python.exe'", - "$baselineRoot = 'C:\\Github\\ANYsolver\\.perf2-worktrees\\baseline'", + "$python = 'C:\\Github\\ANYfeSolver\\.venv\\Scripts\\python.exe'", + "$baselineRoot = 'C:\\Github\\ANYfeSolver\\.perf2-worktrees\\baseline'", "$candidateRoot = (Resolve-Path -LiteralPath .).Path", "", "& $python -m pytest tests -q --basetemp=.pytest_tmp_sol_ultra_final", diff --git a/scripts/confirm_ge_beam3_g1.py b/scripts/confirm_ge_beam3_g1.py index 5a387aefe..137dc6a43 100644 --- a/scripts/confirm_ge_beam3_g1.py +++ b/scripts/confirm_ge_beam3_g1.py @@ -110,8 +110,8 @@ def worker(output): import pytest from contextlib import ExitStack from unittest.mock import patch - from anysolver._ge_beam3_g1_analysis import ElasticAnalysis - from anysolver import _ge_beam3_g1_element as element + from anyfesolver._ge_beam3_g1_analysis import ElasticAnalysis + from anyfesolver import _ge_beam3_g1_element as element phases = set() def mark(phase): phases.add(phase) diff --git a/scripts/confirm_ge_beam3_g2.py b/scripts/confirm_ge_beam3_g2.py index 87bc7ae58..5be66f139 100644 --- a/scripts/confirm_ge_beam3_g2.py +++ b/scripts/confirm_ge_beam3_g2.py @@ -117,8 +117,8 @@ def worker(output): import pytest from contextlib import ExitStack from unittest.mock import patch - from anysolver._ge_beam3_g2_analysis import ConstrainedAnalysis - from anysolver import _ge_beam3_g1_element as element + from anyfesolver._ge_beam3_g2_analysis import ConstrainedAnalysis + from anyfesolver import _ge_beam3_g1_element as element phases = set() def mark(phase): phases.add(phase) diff --git a/scripts/confirm_ge_beam3_g3a.py b/scripts/confirm_ge_beam3_g3a.py index d5eb62be8..46efb9bc5 100644 --- a/scripts/confirm_ge_beam3_g3a.py +++ b/scripts/confirm_ge_beam3_g3a.py @@ -120,8 +120,8 @@ def worker(output): import pytest from contextlib import ExitStack from unittest.mock import patch - from anysolver._ge_beam3_g3_analysis import NativeGraphAnalysis - from anysolver import _ge_beam3_g1_element as element + from anyfesolver._ge_beam3_g3_analysis import NativeGraphAnalysis + from anyfesolver import _ge_beam3_g1_element as element phases = set() def mark(phase): phases.add(phase) diff --git a/scripts/confirm_ge_beam3_g3b.py b/scripts/confirm_ge_beam3_g3b.py index 75d6c248f..732b09e8a 100644 --- a/scripts/confirm_ge_beam3_g3b.py +++ b/scripts/confirm_ge_beam3_g3b.py @@ -153,7 +153,7 @@ def worker(lease_path,lease_hash): (output/"corrections").mkdir(exist_ok=False) import pytest from unittest.mock import patch - from anysolver._ge_beam3_g3b_owner import MixedReferenceOwner + from anyfesolver._ge_beam3_g3b_owner import MixedReferenceOwner # Install observation before owners capture dispatch; never change equations, # return values, guard calls or their identities during an accepted history. solve=MixedReferenceOwner.solve diff --git a/scripts/development_test_runtime.py b/scripts/development_test_runtime.py index a004b159c..08bcae24d 100644 --- a/scripts/development_test_runtime.py +++ b/scripts/development_test_runtime.py @@ -10,9 +10,9 @@ def runtime_record(modules, source, pools=None): errors = [] imported = {name: str(Path(module.__file__).resolve()) for name, module in modules.items() - if (name == "anysolver" or name.startswith("anysolver.")) and getattr(module, "__file__", None)} + if (name == "anyfesolver" or name.startswith("anyfesolver.")) and getattr(module, "__file__", None)} if any(not Path(path).is_relative_to(source) for path in imported.values()): - errors.append("ANYsolver imports escaped the selected source checkout") + errors.append("ANYfeSolver imports escaped the selected source checkout") numba = modules.get("numba") actual_jit = bool(numba.config.DISABLE_JIT) if numba is not None else None actual_threads = int(numba.get_num_threads()) if numba is not None else None diff --git a/scripts/diagnostics/b2_f09_output_certificate_dev.py b/scripts/diagnostics/b2_f09_output_certificate_dev.py index 970d7e1ef..d421949d5 100644 --- a/scripts/diagnostics/b2_f09_output_certificate_dev.py +++ b/scripts/diagnostics/b2_f09_output_certificate_dev.py @@ -10,7 +10,7 @@ import numpy as np import pytest -from anysolver._b2_physical_flexibility_linear import LinearOperator, LinearSection +from anyfesolver._b2_physical_flexibility_linear import LinearOperator, LinearSection from test_b2_f09_fixed_aspect_wrench import _section, WIDTH_DEPTH_M, FIRST_M ENERGY_LIMIT = F(1, 10**8) diff --git a/scripts/diagnostics/b3_e4_f06_noncommuting_history_dev.py b/scripts/diagnostics/b3_e4_f06_noncommuting_history_dev.py index 7cf3da8d9..f9934c081 100644 --- a/scripts/diagnostics/b3_e4_f06_noncommuting_history_dev.py +++ b/scripts/diagnostics/b3_e4_f06_noncommuting_history_dev.py @@ -15,8 +15,8 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver import b3_ge, stiffened_shell -from anysolver.e4_pl_s3_state import canonical_json_bytes +from anyfesolver import b3_ge, stiffened_shell +from anyfesolver.e4_pl_s3_state import canonical_json_bytes from test_stiffened_shell_ge_experimental import _panel diff --git a/scripts/experimental_stiffened_ge_bl5_history.py b/scripts/experimental_stiffened_ge_bl5_history.py index aed699de9..ebf65f93a 100644 --- a/scripts/experimental_stiffened_ge_bl5_history.py +++ b/scripts/experimental_stiffened_ge_bl5_history.py @@ -6,8 +6,8 @@ import argparse import json import numpy as np -import anysolver -from anysolver import b3_ge, stiffened_shell as ss +import anyfesolver +from anyfesolver import b3_ge, stiffened_shell as ss def make_definition(basis="p0"): @@ -40,7 +40,7 @@ def run(basis="p0"): assert owner.checkpoint()==restored.checkpoint() np.testing.assert_array_equal(a.beam_positions,b.beam_positions) return {"status":a.status,"qualification":owner.capabilities["status"], - "source":anysolver.__file__,"basis":basis, + "source":anyfesolver.__file__,"basis":basis, "shell_elements":3,"beam_elements":2,"halfcell_count":4, "reference_segments":owner.preflight()["experimental_line_samples"]//2, "accepted_factors":a.accepted_factors,"restart_bytes_equal":True, diff --git a/scripts/experimental_stiffened_ge_bl5_reference_panel.py b/scripts/experimental_stiffened_ge_bl5_reference_panel.py index 90a3f7f88..dd0ebe22d 100644 --- a/scripts/experimental_stiffened_ge_bl5_reference_panel.py +++ b/scripts/experimental_stiffened_ge_bl5_reference_panel.py @@ -3,14 +3,14 @@ The beam nodal root translations and x/y rotations are restrained; normal spin remains free. This is a separate support condition from a shell-only clamp or a physical retained-section endpoint attachment. BL5 is unqualified. -Run through an installed ANYsolver package; no private operators are used. +Run through an installed ANYfeSolver package; no private operators are used. """ import argparse import json import numpy as np -import anysolver -from anysolver import b3_ge, stiffened_shell as ss +import anyfesolver +from anyfesolver import b3_ge, stiffened_shell as ss LOADS={"fy":(0.,100.,0.,0.,0.,0.),"mx":(0.,0.,0.,10.,0.,0.)} @@ -95,7 +95,7 @@ def run(intervals=16): preflight=owner.preflight() if preflight["reference_linear_factorizations"]!=1: raise AssertionError("eligible static operator refactorized") - return {"source":anysolver.__file__,"qualification":owner.capabilities["status"], + return {"source":anyfesolver.__file__,"qualification":owner.capabilities["status"], "shell_elements":intervals,"beam_elements":intervals//2, "support_semantics":"shell-root clamp plus beam nodal root ground components 0..4; normal spin free", "reaction_semantics":"ground reactions, not concentrated beam-to-shell endpoint transfer", diff --git a/scripts/experimental_stiffened_ge_fibre_history.py b/scripts/experimental_stiffened_ge_fibre_history.py index 6319ad5b9..7abc10fbd 100644 --- a/scripts/experimental_stiffened_ge_fibre_history.py +++ b/scripts/experimental_stiffened_ge_fibre_history.py @@ -8,9 +8,9 @@ from dataclasses import replace import json -import anysolver -from anysolver import b3_ge -from anysolver.stiffened_shell import NodalAction +import anyfesolver +from anyfesolver import b3_ge +from anyfesolver.stiffened_shell import NodalAction from experimental_stiffened_ge_panel import make_definition @@ -31,8 +31,8 @@ def run(mixed=False): ref.coordinates,ref.nodal_triads,section,inertia, quadrature=element.operator.order)) definition = replace(base,beams=tuple(beams)) - owner = anysolver.stiffened_shell.create_analysis(definition=definition) - resumed = anysolver.stiffened_shell.create_analysis(definition=definition) + owner = anyfesolver.stiffened_shell.create_analysis(definition=definition) + resumed = anyfesolver.stiffened_shell.create_analysis(definition=definition) try: actions = (NodalAction('beam',105,(0.,0.,1000.,0.,0.,0.)),) first = owner.solve(actions,targets=(.5,1.),max_iterations=18) diff --git a/scripts/experimental_stiffened_ge_finite_panel.py b/scripts/experimental_stiffened_ge_finite_panel.py index b4524613a..7be579267 100644 --- a/scripts/experimental_stiffened_ge_finite_panel.py +++ b/scripts/experimental_stiffened_ge_finite_panel.py @@ -14,7 +14,7 @@ import time import numpy as np -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from scripts.experimental_stiffened_ge_multi_member_panel import make_definition, actions_for diff --git a/scripts/experimental_stiffened_ge_multi_member_panel.py b/scripts/experimental_stiffened_ge_multi_member_panel.py index e52d30cbb..7dd95d55b 100644 --- a/scripts/experimental_stiffened_ge_multi_member_panel.py +++ b/scripts/experimental_stiffened_ge_multi_member_panel.py @@ -11,7 +11,7 @@ import time import numpy as np -from anysolver import b3_ge, stiffened_shell as ss +from anyfesolver import b3_ge, stiffened_shell as ss def make_definition(cells_per_stiffener=8, stiffeners=4, *, diff --git a/scripts/experimental_stiffened_ge_panel.py b/scripts/experimental_stiffened_ge_panel.py index 60fc9583b..0e60b3c1a 100644 --- a/scripts/experimental_stiffened_ge_panel.py +++ b/scripts/experimental_stiffened_ge_panel.py @@ -1,6 +1,6 @@ """Small experimental two-Q4/two-B3 point-connected panel. -Run with an installed development build of ANYsolver. This exercises a +Run with an installed development build of ANYfeSolver. This exercises a reference-linear integration slice; it is not a qualified stiffened-shell example or a nonlinear response prediction. """ @@ -10,9 +10,9 @@ import numpy as np -import anysolver -from anysolver import b3_ge -from anysolver.stiffened_shell import ( +import anyfesolver +from anyfesolver import b3_ge +from anyfesolver.stiffened_shell import ( B3_GE_E4_PL_STIFFENED_SHELL_V1, FixedCoordinate, LinearDefinition, NodalAction, PointConnection, ShellPanel, ) @@ -63,7 +63,7 @@ def make_definition(beam_family="generalized"): def run(beam_family="generalized"): definition = make_definition(beam_family) - analysis = anysolver.stiffened_shell.create_analysis(definition=definition) + analysis = anyfesolver.stiffened_shell.create_analysis(definition=definition) first = analysis.solve_linear((NodalAction( "beam", 105, (0., 0., 100., 0., 0., 0.)),)) saved = analysis.checkpoint() diff --git a/scripts/explore_nonlinear_abuse.py b/scripts/explore_nonlinear_abuse.py index 43f998766..236bca005 100644 --- a/scripts/explore_nonlinear_abuse.py +++ b/scripts/explore_nonlinear_abuse.py @@ -6,11 +6,11 @@ from __future__ import annotations import argparse,json,pathlib,time,traceback,hashlib,os,platform import numpy as np -import anysolver as fs -from anysolver.elements import create_shell_element,BeamElement -from anysolver.boundary import BoundaryCondition,FixedSupport,LoadCase -from anysolver.nonlinear_static import _assemble_nonlinear_system -from anysolver.matrix_assembly import assemble_load_vector +import anyfesolver as fs +from anyfesolver.elements import create_shell_element,BeamElement +from anyfesolver.boundary import BoundaryCondition,FixedSupport,LoadCase +from anyfesolver.nonlinear_static import _assemble_nonlinear_system +from anyfesolver.matrix_assembly import assemble_load_vector from threadpoolctl import threadpool_info @@ -86,7 +86,7 @@ def static(c): def impact(c): - from anysolver.contact import _verification_contact_panel + from anyfesolver.contact import _verification_contact_panel build_start=time.perf_counter();m=_verification_contact_panel() if c.get('deform'):m.add_boundary_condition(BoundaryCondition('pin',[1],{'uz':0.})) k=c.get('stiffness',40000.);damping=c.get('damping',0.);height=c.get('height',.205) diff --git a/scripts/fetch_calculix_shell_reference.py b/scripts/fetch_calculix_shell_reference.py index 6c828d746..b0f9ca80b 100644 --- a/scripts/fetch_calculix_shell_reference.py +++ b/scripts/fetch_calculix_shell_reference.py @@ -21,7 +21,7 @@ from pathlib import Path from urllib.request import urlopen -from anysolver.reference_cases import upstream_calculix_reference_manifest +from anyfesolver.reference_cases import upstream_calculix_reference_manifest DEFAULT_OUTPUT = Path("tests/reference_cases/calculix_shell_convergence") diff --git a/scripts/ge_beam3_g3b_confirmation_authority.py b/scripts/ge_beam3_g3b_confirmation_authority.py index 2fe71c971..1429a82b1 100644 --- a/scripts/ge_beam3_g3b_confirmation_authority.py +++ b/scripts/ge_beam3_g3b_confirmation_authority.py @@ -1,7 +1,7 @@ """Inert G3b confirmation authority checks; never execute mechanics or publish GO. The future coordinator must authenticate all inputs before importing pytest or -ANYsolver. Passing these validators alone is not formal confirmation. +ANYfeSolver. Passing these validators alone is not formal confirmation. """ from hashlib import sha256 import json diff --git a/scripts/ge_beam3_g3c_history_owner.py b/scripts/ge_beam3_g3c_history_owner.py index a4c3e42d4..876339000 100644 --- a/scripts/ge_beam3_g3c_history_owner.py +++ b/scripts/ge_beam3_g3c_history_owner.py @@ -26,7 +26,7 @@ def runtime_identity(): """Inert identity, independently recomputed by the reviewed coordinator.""" rows = [(p.relative_to(ROOT).as_posix(), sha256(p.read_bytes().replace(b'\r\n', b'\n')).hexdigest()) - for p in sorted((ROOT/'src'/'anysolver').rglob('*.py'))] + for p in sorted((ROOT/'src'/'anyfesolver').rglob('*.py'))] rows += [(name, sha256((ROOT/name).read_bytes().replace(b'\r\n', b'\n')).hexdigest()) for name in HISTORY_SOURCES] return packet.digest(dict(environment=ENVIRONMENT, sources=rows)) @@ -71,7 +71,7 @@ def __init__(self, fixture_id='J_B2_PAIR', variant='BASE', common_motion='NONE') # Importing this wrapper alone never captures or manufactures that lease. packet.authorities() frozen = runtime_identity(); code = dispatch() - from anysolver._ge_beam3_g3c_stable.owner import MixedGraphOwner + from anyfesolver._ge_beam3_g3c_stable.owner import MixedGraphOwner owner = MixedGraphOwner(fixture_id, variant, common_motion) lock = threading.Lock() for name,value in dict(_owner=owner,_owned_owner=owner,_lock=lock,_owned_lock=lock, @@ -182,7 +182,7 @@ def accepted_pose_diagnostic_bytes(self): origin = owner._published history = packet.strict(origin.history); state = packet.strict(origin.state) if not history: raise ValueError('accepted stage required for rebase diagnostic') - from anysolver._ge_beam3_g3c_stable import owner as mechanics + from anyfesolver._ge_beam3_g3c_stable import owner as mechanics command = mechanics.command(history[-1]['command'],history[:-1], packet.strict(owner._definition)['common_motion']) if history[-1]['accepted_state_sha256'] != origin.state_sha256: diff --git a/scripts/ge_beam3_g3c_physical_history_owner.py b/scripts/ge_beam3_g3c_physical_history_owner.py index 3c887f125..ab402bd2a 100644 --- a/scripts/ge_beam3_g3c_physical_history_owner.py +++ b/scripts/ge_beam3_g3c_physical_history_owner.py @@ -92,7 +92,7 @@ def mutation_inventory(): def runtime_identity(): """Inert identity, independently recomputed by the reviewed coordinator.""" rows = [(p.relative_to(ROOT).as_posix(), sha256(p.read_bytes().replace(b'\r\n', b'\n')).hexdigest()) - for p in sorted((ROOT/'src'/'anysolver').rglob('*.py'))] + for p in sorted((ROOT/'src'/'anyfesolver').rglob('*.py'))] rows += [(name, sha256((ROOT/name).read_bytes().replace(b'\r\n', b'\n')).hexdigest()) for name in HISTORY_SOURCES] return packet.digest(dict(environment=ENVIRONMENT, sources=rows)) @@ -190,7 +190,7 @@ def __init__(self, fixture_id='J_B2_PAIR', variant='BASE', common_motion='NONE') # Importing this wrapper alone never captures or manufactures that lease. packet.authorities() frozen = runtime_identity(); code = dispatch() - from anysolver._ge_beam3_g3c_physical_owner import MixedGraphOwner + from anyfesolver._ge_beam3_g3c_physical_owner import MixedGraphOwner owner = MixedGraphOwner(fixture_id, variant, common_motion) lock = threading.Lock() for name,value in dict(_owner=owner,_owned_owner=owner,_lock=lock,_owned_lock=lock, @@ -331,7 +331,7 @@ def accepted_pose_diagnostic_bytes(self): origin = owner._published history = packet.strict(origin.history); state = packet.strict(origin.state) if not history: raise ValueError('accepted stage required for rebase diagnostic') - from anysolver import _ge_beam3_g3c_physical_owner as mechanics + from anyfesolver import _ge_beam3_g3c_physical_owner as mechanics command = mechanics.command(history[-1]['command'],history[:-1], packet.strict(owner._definition)['common_motion']) if history[-1]['accepted_state_sha256'] != origin.state_sha256: diff --git a/scripts/ge_beam3_g3c_physical_restart_preflight.py b/scripts/ge_beam3_g3c_physical_restart_preflight.py index 18aaab0c9..8e4641feb 100644 --- a/scripts/ge_beam3_g3c_physical_restart_preflight.py +++ b/scripts/ge_beam3_g3c_physical_restart_preflight.py @@ -1,7 +1,7 @@ """Inert private restart preflight. Passing is NOT proof of a numerical state. The reviewed coordinator must validate its complete source/environment lease -before calling this module. No anysolver package or numerical library is loaded. +before calling this module. No anyfesolver package or numerical library is loaded. Returned bytes remain untrusted commitments until genuine owner replay succeeds. """ from dataclasses import dataclass @@ -20,9 +20,9 @@ REVIEW_SHA = '47829c5c1c896ed2eb28131ffedadd25cc83bc5bed79bc2517cfe308f7dc8988' PHYSICAL_CONTRACT = 'docs/GE_BEAM3_G3C_PHYSICAL_MIXED_OWNER_CONTRACT.md' PHYSICAL_CONTRACT_SHA = 'f6638863e6e222c795e980194c9a71cf42eb83bdcba6af2a8c409164ad4d957b' -PHYSICAL_AUTHORITY = 'src/anysolver/_ge_beam3_g3c_physical_authority.py' +PHYSICAL_AUTHORITY = 'src/anyfesolver/_ge_beam3_g3c_physical_authority.py' PHYSICAL_AUTHORITY_SHA = '5f81cff14bd67857f62bbb1fa8ae61ee2148c00bd745fbfd456ba572835e3896' -DEFINITION = 'src/anysolver/_ge_beam3_g3c_definition.py' +DEFINITION = 'src/anyfesolver/_ge_beam3_g3c_definition.py' DEFINITION_SHA = '4b46b870fec010e3378df83c374d763f858d8f25820c14f9704dc6f0a656f0c2' MAP_SHA = PHYSICAL_CONTRACT_SHA HEX = re.compile('[0-9a-f]{64}') @@ -80,7 +80,7 @@ def authorities(): or review['reviewer'].get('independent') is not True or review['scope'].get('contract_sha256')!=PHYSICAL_CONTRACT_SHA): raise ValueError('unaccepted restart design') # This fixed hash-bound file is itself standard-library-only. Loading it - # directly avoids anysolver.__init__ and all numerical/package imports. + # directly avoids anyfesolver.__init__ and all numerical/package imports. raw = bound(ROOT/DEFINITION, DEFINITION_SHA) module = ModuleType('_g3c_inert_definition') module.__file__ = str(ROOT/DEFINITION) diff --git a/scripts/ge_beam3_g3c_rehearsal_bridge_contract.py b/scripts/ge_beam3_g3c_rehearsal_bridge_contract.py index 04b934723..4dffc3e1f 100644 --- a/scripts/ge_beam3_g3c_rehearsal_bridge_contract.py +++ b/scripts/ge_beam3_g3c_rehearsal_bridge_contract.py @@ -39,7 +39,7 @@ def expected(): correction_modify=['scripts/ge_beam3_g3c_rehearsal_mutations.py','tests/test_ge_beam3_g3c_rehearsal_mutations_static.py'], implementation_add=['scripts/ge_beam3_g3c_rehearsal_bridge.py','scripts/run_ge_beam3_g3c_rehearsal_consumer.py', 'tests/test_ge_beam3_g3c_rehearsal_consumer_static.py','docs/GE_BEAM3_G3C_REHEARSAL_CONSUMER_IMPLEMENTATION.md'], - source_schemas={k:dict(path='src/anysolver/'+v[0],constant=v[1],literal=v[2],fingerprint=dict(bytes=v[3],sha256=v[4])) for k,v in SOURCES.items()}, + source_schemas={k:dict(path='src/anyfesolver/'+v[0],constant=v[1],literal=v[2],fingerprint=dict(bytes=v[3],sha256=v[4])) for k,v in SOURCES.items()}, hypothetical=dict(member='predecessor_G3c',literal='GE_BEAM3_G3C_MIXED_ELASTIC_RESTART_V1', disposition='HYPOTHETICAL_NOT_A_PREVIOUSLY_ACCEPTED_IMPORT_FORMAT'), ri03_assessment_sha256='273b8280600150db176916399f3f0f738d890263455df1cd3382e52b037c62ed', diff --git a/scripts/ge_beam3_g3c_restart_preflight.py b/scripts/ge_beam3_g3c_restart_preflight.py index 34fa15a36..cd42f3502 100644 --- a/scripts/ge_beam3_g3c_restart_preflight.py +++ b/scripts/ge_beam3_g3c_restart_preflight.py @@ -1,7 +1,7 @@ """Inert private restart preflight. Passing is NOT proof of a numerical state. The reviewed coordinator must validate its complete source/environment lease -before calling this module. No anysolver package or numerical library is loaded. +before calling this module. No anyfesolver package or numerical library is loaded. Returned bytes remain untrusted commitments until genuine owner replay succeeds. """ from dataclasses import dataclass @@ -18,7 +18,7 @@ CONTRACT_SHA = '7afe9d79096338c122280c20f83b6e7c5681ea0a382e32cb15e1e9349b9372e6' REVIEW = 'docs/reference_cases/ge_beam3_g3c_history_restart_design_review_v1.json' REVIEW_SHA = '057fbd280d5dc4c00438387860b2e38d25abcccd4d520970606221b2402589fe' -DEFINITION = 'src/anysolver/_ge_beam3_g3c_definition.py' +DEFINITION = 'src/anyfesolver/_ge_beam3_g3c_definition.py' DEFINITION_SHA = '4b46b870fec010e3378df83c374d763f858d8f25820c14f9704dc6f0a656f0c2' MAP_SHA = '30848dea0530f5a49b44cea184f4ff38d73f7e3449131086d9f2c9f312a51ca8' HEX = re.compile('[0-9a-f]{64}') @@ -73,7 +73,7 @@ def authorities(): if review['decision'] != 'ACCEPTED_G3C_HISTORY_RESTART_DESIGN_ONLY' or review['findings']: raise ValueError('unaccepted restart design') # This fixed hash-bound file is itself standard-library-only. Loading it - # directly avoids anysolver.__init__ and all numerical/package imports. + # directly avoids anyfesolver.__init__ and all numerical/package imports. raw = bound(ROOT/DEFINITION, DEFINITION_SHA) module = ModuleType('_g3c_inert_definition') module.__file__ = str(ROOT/DEFINITION) diff --git a/scripts/ge_beam3_g3c_stable_map.py b/scripts/ge_beam3_g3c_stable_map.py index f84049a1a..51ac15117 100644 --- a/scripts/ge_beam3_g3c_stable_map.py +++ b/scripts/ge_beam3_g3c_stable_map.py @@ -58,11 +58,11 @@ def imports(source, original_module, mapping): made.append('import '+mapping.get(whole, whole)+' as '+(alias.asname or alias.name)) else: module = mapping.get(absolute, absolute) - if absolute == 'anysolver._ge_beam3_mixed_ad' and alias.name in ('so3_exp', 'so3_log'): - module = 'anysolver._ge_beam3_g3c_so3_numerics' + if absolute == 'anyfesolver._ge_beam3_mixed_ad' and alias.name in ('so3_exp', 'so3_log'): + module = 'anyfesolver._ge_beam3_g3c_so3_numerics' made.append('from '+module+' import '+alias.name+(' as '+alias.asname if alias.asname else '')) # External absolute imports retain their exact original spelling. - if node.level == 0 and absolute not in mapping and absolute != 'anysolver._ge_beam3_mixed_ad' and not any(absolute+'.'+a.name in mapping for a in node.names): + if node.level == 0 and absolute not in mapping and absolute != 'anyfesolver._ge_beam3_mixed_ad' and not any(absolute+'.'+a.name in mapping for a in node.names): continue start = offsets[node.lineno-1]+node.col_offset end = offsets[node.end_lineno-1]+node.end_col_offset @@ -130,7 +130,7 @@ def git(*args): destinations = set() for row in contract['copies']: destination = row['destination'] - if destination in destinations or not destination.startswith(('src/anysolver/_ge_beam3_g3c_stable/', 'tests/test_ge_beam3_g3c_stable_')) or '..' in Path(destination).parts: + if destination in destinations or not destination.startswith(('src/anyfesolver/_ge_beam3_g3c_stable/', 'tests/test_ge_beam3_g3c_stable_')) or '..' in Path(destination).parts: raise ValueError('duplicate or out-of-scope destination') destinations.add(destination) if tree.get(row['source']) != row['source_blob']: diff --git a/scripts/general_contact_c4_search_owner_probe.py b/scripts/general_contact_c4_search_owner_probe.py index a17a152a5..9d7cbdaa1 100644 --- a/scripts/general_contact_c4_search_owner_probe.py +++ b/scripts/general_contact_c4_search_owner_probe.py @@ -12,13 +12,13 @@ import numpy as np -from anysolver.general_contact import patch_mortar -from anysolver.general_contact.contact_search import ContactAABBIndex +from anyfesolver.general_contact import patch_mortar +from anyfesolver.general_contact.contact_search import ContactAABBIndex from examples.general_contact_patch_sliding import main as sliding_example BASE_COMMIT = "53871171" -BASE_PATH = "src/anysolver/general_contact/patch_broadphase.py" +BASE_PATH = "src/anyfesolver/general_contact/patch_broadphase.py" class OwnerPatchAABBTree: diff --git a/scripts/general_contact_c6_s3_dae_probe.py b/scripts/general_contact_c6_s3_dae_probe.py index f8eb4043a..25428206c 100644 --- a/scripts/general_contact_c6_s3_dae_probe.py +++ b/scripts/general_contact_c6_s3_dae_probe.py @@ -8,12 +8,12 @@ sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "tests")) from test_general_contact_transient_plane import _guided_s3_descriptor_impact -from anysolver import ContactTransientSolverControls, TransientConfig, solve_transient_contact -from anysolver.algebraic_dynamics import build_declared_algebraic_basis -from anysolver.assembly import assemble_mass_matrix, build_constraint_transformation -from anysolver.general_contact.core import contact_scope -from anysolver.matrix_assembly import assemble_stiffness_matrix -from anysolver.nonlinear_static import _assemble_nonlinear_system +from anyfesolver import ContactTransientSolverControls, TransientConfig, solve_transient_contact +from anyfesolver.algebraic_dynamics import build_declared_algebraic_basis +from anyfesolver.assembly import assemble_mass_matrix, build_constraint_transformation +from anyfesolver.general_contact.core import contact_scope +from anyfesolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.nonlinear_static import _assemble_nonlinear_system def run(dt: float) -> dict: diff --git a/scripts/general_contact_d1_16q4_alternative_trial.py b/scripts/general_contact_d1_16q4_alternative_trial.py index 52daacb43..6693cd171 100644 --- a/scripts/general_contact_d1_16q4_alternative_trial.py +++ b/scripts/general_contact_d1_16q4_alternative_trial.py @@ -11,9 +11,9 @@ import numpy as np -import anysolver.general_contact.linearized_pivot as pivot -from anysolver import solve_static_nonlinear -from anysolver.general_contact.supported_schur import SupportedSchurProposal +import anyfesolver.general_contact.linearized_pivot as pivot +from anyfesolver import solve_static_nonlinear +from anyfesolver.general_contact.supported_schur import SupportedSchurProposal from general_contact_d1_coupled_refinement import build_case diff --git a/scripts/general_contact_d1_2d_gap_pair_dev.py b/scripts/general_contact_d1_2d_gap_pair_dev.py index fe300d69e..17db0b506 100644 --- a/scripts/general_contact_d1_2d_gap_pair_dev.py +++ b/scripts/general_contact_d1_2d_gap_pair_dev.py @@ -9,12 +9,12 @@ import numpy as np -import anysolver -from anysolver import solve_static_nonlinear -from anysolver.general_contact.q4_source_overlap import ( +import anyfesolver +from anyfesolver import solve_static_nonlinear +from anyfesolver.general_contact.q4_source_overlap import ( q4_source_projected_gap_lower, ) -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from scripts.general_contact_d1_2d_target_press_dev import build_case @@ -71,7 +71,7 @@ def capture(self, start, end): pair_data.sort(key=lambda item: item["bound_m"]) payload = { "candidate": "d1_2d_target_conservative_gap_pair_discriminator", - "anysolver_module": str(Path(anysolver.__file__).resolve()), + "anyfesolver_module": str(Path(anyfesolver.__file__).resolve()), "status": result.status, "certificate": settings.q4_source_gap_certificate, "failure_reason": result.failure_reason, diff --git a/scripts/general_contact_d1_2d_overlap_profile_dev.py b/scripts/general_contact_d1_2d_overlap_profile_dev.py index 1836eb526..4feb40e5b 100644 --- a/scripts/general_contact_d1_2d_overlap_profile_dev.py +++ b/scripts/general_contact_d1_2d_overlap_profile_dev.py @@ -8,8 +8,8 @@ from pathlib import Path import time -import anysolver -from anysolver import solve_static_nonlinear, validate_general_contact +import anyfesolver +from anyfesolver import solve_static_nonlinear, validate_general_contact from scripts.general_contact_d1_2d_target_press_dev import build_case from scripts.general_contact_d1_mixed_mesh_jet2_schur_press import _json_default @@ -31,7 +31,7 @@ def main(output: Path) -> None: ) payload = { "candidate": "d1_2d_target_overlap_local_profile_development", - "anysolver_module": str(Path(anysolver.__file__).resolve()), + "anyfesolver_module": str(Path(anyfesolver.__file__).resolve()), "profile": report.profile, "certificate": settings.q4_source_gap_certificate, "force_n": 0.04, diff --git a/scripts/general_contact_d1_2d_target_open_predictor_dev.py b/scripts/general_contact_d1_2d_target_open_predictor_dev.py index 1b8af0fd0..32d9ef8be 100644 --- a/scripts/general_contact_d1_2d_target_open_predictor_dev.py +++ b/scripts/general_contact_d1_2d_target_open_predictor_dev.py @@ -10,10 +10,10 @@ from scipy import sparse from scipy.sparse.linalg import spsolve -import anysolver -from anysolver.assembly import build_constraint_transformation -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.matrix_assembly import assemble_stiffness_matrix +import anyfesolver +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.matrix_assembly import assemble_stiffness_matrix from scripts.general_contact_d1_2d_target_press_dev import build_case @@ -62,7 +62,7 @@ def evaluate() -> dict: current = manager._positions(displacement) return { "candidate": "d1_2d_target_contact_free_linear_first_step_discriminator", - "anysolver_module": str(Path(anysolver.__file__).resolve()), + "anyfesolver_module": str(Path(anyfesolver.__file__).resolve()), "structural_model": "linear_reference_stiffness_only", "path_step": 1, "applied_force_n": float(np.sum(program.force_values_at(1))), diff --git a/scripts/general_contact_d1_2d_target_press_dev.py b/scripts/general_contact_d1_2d_target_press_dev.py index eae117742..bc048fd8c 100644 --- a/scripts/general_contact_d1_2d_target_press_dev.py +++ b/scripts/general_contact_d1_2d_target_press_dev.py @@ -7,8 +7,8 @@ from pathlib import Path import time -import anysolver -from anysolver import BoundaryCondition, solve_static_nonlinear, validate_general_contact +import anyfesolver +from anyfesolver import BoundaryCondition, solve_static_nonlinear, validate_general_contact from scripts.general_contact_d1_interior_press_dev import build_interior_press from scripts.general_contact_d1_mixed_mesh_jet2_schur_press import _json_default @@ -51,7 +51,7 @@ def main(output: Path): ) payload = { "candidate": "d1_interior_two_dimensional_target_press_development", - "anysolver_module": str(Path(anysolver.__file__).resolve()), + "anyfesolver_module": str(Path(anyfesolver.__file__).resolve()), "source_q4_faces": 16, "target_s3_faces": 8, "force_n": 0.04, diff --git a/scripts/general_contact_d1_active_set_diagnostic.py b/scripts/general_contact_d1_active_set_diagnostic.py index cfc1811f6..a36150467 100644 --- a/scripts/general_contact_d1_active_set_diagnostic.py +++ b/scripts/general_contact_d1_active_set_diagnostic.py @@ -10,8 +10,8 @@ import numpy as np from scipy.optimize import least_squares -import anysolver.general_contact.linearized_pivot as pivot -from anysolver import solve_static_nonlinear +import anyfesolver.general_contact.linearized_pivot as pivot +from anyfesolver import solve_static_nonlinear from general_contact_d1_coupled_refinement import build_case diff --git a/scripts/general_contact_d1_actual_swept_gap_dev.py b/scripts/general_contact_d1_actual_swept_gap_dev.py index 1903e6c63..2322d64e2 100644 --- a/scripts/general_contact_d1_actual_swept_gap_dev.py +++ b/scripts/general_contact_d1_actual_swept_gap_dev.py @@ -8,7 +8,7 @@ import numpy as np -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from scripts.general_contact_d1_2d_target_press_dev import build_case from scripts.general_contact_d1_overlap_gap_bound_dev import ( overlap_local_swept_lower, diff --git a/scripts/general_contact_d1_capture_branch.py b/scripts/general_contact_d1_capture_branch.py index 08cc56368..8cb3025a0 100644 --- a/scripts/general_contact_d1_capture_branch.py +++ b/scripts/general_contact_d1_capture_branch.py @@ -6,7 +6,7 @@ import numpy as np -from anysolver.general_contact.s3_patch_augmented import MovingS3PatchProjectedNormal +from anyfesolver.general_contact.s3_patch_augmented import MovingS3PatchProjectedNormal from scripts.general_contact_d1_coupled_refinement import main diff --git a/scripts/general_contact_d1_capture_distributed_pair.py b/scripts/general_contact_d1_capture_distributed_pair.py index 8c35ac2e1..1d4de711f 100644 --- a/scripts/general_contact_d1_capture_distributed_pair.py +++ b/scripts/general_contact_d1_capture_distributed_pair.py @@ -7,7 +7,7 @@ import numpy as np -from anysolver.general_contact import s3_patch_augmented as patch +from anyfesolver.general_contact import s3_patch_augmented as patch from scripts.general_contact_d1_mixed_mesh_jet2_schur_press import main diff --git a/scripts/general_contact_d1_captured_wedge_derivative_probe.py b/scripts/general_contact_d1_captured_wedge_derivative_probe.py index d358619df..f6287343d 100644 --- a/scripts/general_contact_d1_captured_wedge_derivative_probe.py +++ b/scripts/general_contact_d1_captured_wedge_derivative_probe.py @@ -8,10 +8,10 @@ import numpy as np -from anysolver.general_contact.q4_s3_overlap_derivatives import ( +from anyfesolver.general_contact.q4_s3_overlap_derivatives import ( q4_s3_overlap_derivatives, ) -from anysolver.general_contact.q4_source_overlap import q4_source_overlap_integrals +from anyfesolver.general_contact.q4_source_overlap import q4_source_overlap_integrals INTEGRATION = dict(area_tolerance=1.0e-9, diff --git a/scripts/general_contact_d1_central_frozen_pose_compare.py b/scripts/general_contact_d1_central_frozen_pose_compare.py index e2006d1b6..06f555d8b 100644 --- a/scripts/general_contact_d1_central_frozen_pose_compare.py +++ b/scripts/general_contact_d1_central_frozen_pose_compare.py @@ -14,11 +14,11 @@ import numpy as np -from anysolver.general_contact.core import contact_scope -from anysolver.general_contact.pressure_overlay import subdivide_q4_pressure_faces -from anysolver.general_contact.pressure_space import supported_pressure_gram -from anysolver.general_contact.s3_patch_augmented import MovingS3PatchProjectedNormal -from anysolver.general_contact.s3_patch_mortar_energy import ( +from anyfesolver.general_contact.core import contact_scope +from anyfesolver.general_contact.pressure_overlay import subdivide_q4_pressure_faces +from anyfesolver.general_contact.pressure_space import supported_pressure_gram +from anyfesolver.general_contact.s3_patch_augmented import MovingS3PatchProjectedNormal +from anyfesolver.general_contact.s3_patch_mortar_energy import ( MovingS3PatchPrimalMortarPenalty, ) from scripts.general_contact_d1_finite_area_load import build_case diff --git a/scripts/general_contact_d1_contact_free_anisotropy.py b/scripts/general_contact_d1_contact_free_anisotropy.py index 7001eaf1f..3843081a0 100644 --- a/scripts/general_contact_d1_contact_free_anisotropy.py +++ b/scripts/general_contact_d1_contact_free_anisotropy.py @@ -5,7 +5,7 @@ from pathlib import Path import time -from anysolver import solve_static_nonlinear +from anyfesolver import solve_static_nonlinear from scripts.general_contact_d1_finite_area_load import build_case diff --git a/scripts/general_contact_d1_continuum_obstacle_reference.py b/scripts/general_contact_d1_continuum_obstacle_reference.py index b605c8fdd..5fa7d908f 100644 --- a/scripts/general_contact_d1_continuum_obstacle_reference.py +++ b/scripts/general_contact_d1_continuum_obstacle_reference.py @@ -1,6 +1,6 @@ """Independent finite-volume continuum obstacle discriminator for D1. -This development tool does not import ANYsolver. Fixed shell rotations reduce +This development tool does not import ANYfeSolver. Fixed shell rotations reduce the guided strip's transverse continuum work to shear energy. Cell-centred finite volumes and a primal active set solve that scalar variational inequality. The full-width obstacle has an exact one-dimensional solution; diff --git a/scripts/general_contact_d1_coupled_front_pose_compare.py b/scripts/general_contact_d1_coupled_front_pose_compare.py index 6dd19309b..062a92cd7 100644 --- a/scripts/general_contact_d1_coupled_front_pose_compare.py +++ b/scripts/general_contact_d1_coupled_front_pose_compare.py @@ -13,8 +13,8 @@ import numpy as np -from anysolver.general_contact.q4_skin_work import Q4SkinWorkAdapter -from anysolver.general_contact.s3_skin_work import S3SkinWorkAdapter +from anyfesolver.general_contact.q4_skin_work import Q4SkinWorkAdapter +from anyfesolver.general_contact.s3_skin_work import S3SkinWorkAdapter from scripts.general_contact_d1_mixed_mesh_jet2_schur_press import build_case diff --git a/scripts/general_contact_d1_coupled_refinement.py b/scripts/general_contact_d1_coupled_refinement.py index 19a11281a..05161e399 100644 --- a/scripts/general_contact_d1_coupled_refinement.py +++ b/scripts/general_contact_d1_coupled_refinement.py @@ -12,13 +12,13 @@ from pathlib import Path import time -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathProgram, ContactSolverSettings, ContactSurface, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def build_case(columns, rows=1, edge_control=False, *, diff --git a/scripts/general_contact_d1_cycle_tangent_discriminator.py b/scripts/general_contact_d1_cycle_tangent_discriminator.py index 9ef316b09..81f289320 100644 --- a/scripts/general_contact_d1_cycle_tangent_discriminator.py +++ b/scripts/general_contact_d1_cycle_tangent_discriminator.py @@ -15,14 +15,14 @@ import numpy as np from scipy import linalg -import anysolver +import anyfesolver -from anysolver import solve_static_nonlinear -from anysolver.assembly import build_constraint_transformation -from anysolver.general_contact.core import contact_scope, suspend_contact -from anysolver.general_contact.semismooth import linearize -from anysolver.matrix_assembly import assemble_stiffness_matrix -from anysolver.nonlinear_static import _prepare_initial_states +from anyfesolver import solve_static_nonlinear +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.general_contact.core import contact_scope, suspend_contact +from anyfesolver.general_contact.semismooth import linearize +from anyfesolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.nonlinear_static import _prepare_initial_states from examples.general_contact_free_target_cycle_dev import build_case from scripts.general_contact_d1_distributed_coupled_tangent_probe import _assemble from scripts.general_contact_d1_distributed_tangent_probe import _branches @@ -169,7 +169,7 @@ def work_rank(work, modes): "scope": "saved guided four-Q4/two-free-S3 slide and recontact only", "source_commit": subprocess.check_output( ("git", "rev-parse", "HEAD"), text=True).strip(), - "anysolver_module": str(Path(anysolver.__file__).resolve()), + "anyfesolver_module": str(Path(anyfesolver.__file__).resolve()), "probe_sha256": hashlib.sha256(Path(__file__).read_bytes()).hexdigest(), "records": records, } diff --git a/scripts/general_contact_d1_diagonal_overlap_probe.py b/scripts/general_contact_d1_diagonal_overlap_probe.py index cc158070e..b5a80e3a8 100644 --- a/scripts/general_contact_d1_diagonal_overlap_probe.py +++ b/scripts/general_contact_d1_diagonal_overlap_probe.py @@ -5,7 +5,7 @@ import numpy as np from general_contact_d1_coupled_refinement import build_case -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager def main(): diff --git a/scripts/general_contact_d1_displacement_cycle_dev.py b/scripts/general_contact_d1_displacement_cycle_dev.py index d8df96543..32e8c58d7 100644 --- a/scripts/general_contact_d1_displacement_cycle_dev.py +++ b/scripts/general_contact_d1_displacement_cycle_dev.py @@ -10,8 +10,8 @@ import hashlib,json,time from pathlib import Path import numpy as np -import anysolver -from anysolver import ContactPathControl,ContactPathProgram,solve_static_nonlinear,validate_general_contact +import anyfesolver +from anyfesolver import ContactPathControl,ContactPathProgram,solve_static_nonlinear,validate_general_contact from scripts.general_contact_d1_interior_press_dev import build_saved_cycle,verify_saved_cycle,validate_restart_poses from scripts.general_contact_d1_mixed_mesh_jet2_schur_press import _json_default @@ -101,7 +101,7 @@ def run(output,fixture,restart=None,max_path_fraction=1.): payload={key:saved[key] for key in ('source_q4_faces','target_s3_faces','force_n','reference_slope','source_columns','source_rows','target_columns','target_rows','target_young_multiplier','target_y0_m','source_reference_downshift_m','source_support','source_y_profile','offline_structural_reference_y16','load_shape','four_phase','steps_per_segment','slide_distance_m','slide_intervals','slide_body','target_reference_full_left_clamp','target_left_edge_motion','shared_edge_tie','q4_gap_certificate')} new_poses=[np.asarray(s.displacements).tolist() for s in result.snapshots] payload.update(candidate='current_d1_registered_weighted_displacement_development',control_provenance='current physical-bump work map; documented endpoint/NCP scale; historical control/preflight source unavailable', - anysolver_module=str(Path(anysolver.__file__).resolve()),fixture_sha256=hashlib.sha256(fixture.read_bytes()).hexdigest(), + anyfesolver_module=str(Path(anyfesolver.__file__).resolve()),fixture_sha256=hashlib.sha256(fixture.read_bytes()).hexdigest(), endpoint_m=ENDPOINT_M,ncp_scale_n=NCP_SCALE_N,control_terms=program.controls[-1].terms, external_nodal_load_count=len(program.nodal_forces),status=result.status,failure_reason=result.failure_reason, accepted_steps=len(result.steps),elapsed_seconds=time.perf_counter()-started,displacements=result.displacements.tolist(), diff --git a/scripts/general_contact_d1_distributed_coupled_tangent_probe.py b/scripts/general_contact_d1_distributed_coupled_tangent_probe.py index a7f4aa67a..0fa0a8274 100644 --- a/scripts/general_contact_d1_distributed_coupled_tangent_probe.py +++ b/scripts/general_contact_d1_distributed_coupled_tangent_probe.py @@ -10,10 +10,10 @@ import numpy as np -from anysolver.assembly import build_constraint_transformation -from anysolver.matrix_assembly import assemble_stiffness_matrix -from anysolver.general_contact.core import contact_scope, suspend_contact -from anysolver.nonlinear_static import ( +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.general_contact.core import contact_scope, suspend_contact +from anyfesolver.nonlinear_static import ( _assemble_nonlinear_system, _discard_nonlinear_state_candidate, _prepare_initial_states, ) diff --git a/scripts/general_contact_d1_distributed_tangent_probe.py b/scripts/general_contact_d1_distributed_tangent_probe.py index 8e21292ae..1001f45f3 100644 --- a/scripts/general_contact_d1_distributed_tangent_probe.py +++ b/scripts/general_contact_d1_distributed_tangent_probe.py @@ -10,8 +10,8 @@ import numpy as np -from anysolver.general_contact.q4_s3_overlap_derivatives import q4_s3_overlap_derivatives -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.q4_s3_overlap_derivatives import q4_s3_overlap_derivatives +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from scripts.general_contact_d1_mixed_mesh_jet2_schur_press import build_case diff --git a/scripts/general_contact_d1_distributed_target_tangent_probe.py b/scripts/general_contact_d1_distributed_target_tangent_probe.py index c8fc0f902..b496b7849 100644 --- a/scripts/general_contact_d1_distributed_target_tangent_probe.py +++ b/scripts/general_contact_d1_distributed_target_tangent_probe.py @@ -10,7 +10,7 @@ import numpy as np -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from scripts.general_contact_d1_distributed_tangent_probe import _branches from scripts.general_contact_d1_mixed_mesh_jet2_schur_press import build_case diff --git a/scripts/general_contact_d1_eccentric_source_director.py b/scripts/general_contact_d1_eccentric_source_director.py index ca92dc0dd..ed8218af3 100644 --- a/scripts/general_contact_d1_eccentric_source_director.py +++ b/scripts/general_contact_d1_eccentric_source_director.py @@ -8,12 +8,12 @@ import numpy as np -from anysolver import ( +from anyfesolver import ( ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, create_shell_element, validate_general_contact, ) -from anysolver.fe_core import FEModel -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from scripts.general_contact_d1_distributed_tangent_probe import _branches diff --git a/scripts/general_contact_d1_exact_restart_check.py b/scripts/general_contact_d1_exact_restart_check.py index b13d4570e..94aa162b5 100644 --- a/scripts/general_contact_d1_exact_restart_check.py +++ b/scripts/general_contact_d1_exact_restart_check.py @@ -10,7 +10,7 @@ import numpy as np -from anysolver import solve_static_nonlinear +from anyfesolver import solve_static_nonlinear from scripts.general_contact_d1_coupled_refinement import build_case diff --git a/scripts/general_contact_d1_exact_tie_limits.py b/scripts/general_contact_d1_exact_tie_limits.py index 1df2a32b1..fb042ff17 100644 --- a/scripts/general_contact_d1_exact_tie_limits.py +++ b/scripts/general_contact_d1_exact_tie_limits.py @@ -7,11 +7,11 @@ import numpy as np -from anysolver.general_contact.overlap import PlanarFace, planar_projected_overlap -from anysolver.general_contact.s3_patch_augmented import ( +from anyfesolver.general_contact.overlap import PlanarFace, planar_projected_overlap +from anyfesolver.general_contact.s3_patch_augmented import ( _touching_projected_boundaries, _touching_shared_target_edge, ) -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from scripts.general_contact_d1_coupled_refinement import build_case diff --git a/scripts/general_contact_d1_finite_area_load.py b/scripts/general_contact_d1_finite_area_load.py index 54c72a9b6..a951dd18d 100644 --- a/scripts/general_contact_d1_finite_area_load.py +++ b/scripts/general_contact_d1_finite_area_load.py @@ -13,14 +13,14 @@ import time import anymaterial -import anysolver +import anyfesolver -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, LoadCase, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def build_case(divisions: int, *, total_load_n: float = 0.4, @@ -204,7 +204,7 @@ def main(): "final_displacements": result.displacements.tolist(), "runtime_identity": { "python": sys.version.split()[0], - "anysolver_module": str(Path(anysolver.__file__).resolve()), + "anyfesolver_module": str(Path(anyfesolver.__file__).resolve()), "anymaterial_module": str(Path(anymaterial.__file__).resolve()), }, } diff --git a/scripts/general_contact_d1_free_target_equilibrium_tangent_probe.py b/scripts/general_contact_d1_free_target_equilibrium_tangent_probe.py index fd6d649ee..01a4531ca 100644 --- a/scripts/general_contact_d1_free_target_equilibrium_tangent_probe.py +++ b/scripts/general_contact_d1_free_target_equilibrium_tangent_probe.py @@ -9,10 +9,10 @@ import numpy as np -from anysolver.assembly import build_constraint_transformation -from anysolver.matrix_assembly import assemble_stiffness_matrix -from anysolver.general_contact.core import contact_scope, suspend_contact -from anysolver.nonlinear_static import _prepare_initial_states +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.general_contact.core import contact_scope, suspend_contact +from anyfesolver.nonlinear_static import _prepare_initial_states from scripts.general_contact_d1_distributed_coupled_tangent_probe import _assemble from scripts.general_contact_d1_distributed_tangent_probe import _branches from scripts.general_contact_d1_free_target_press_probe import ( diff --git a/scripts/general_contact_d1_free_target_identity_probe.py b/scripts/general_contact_d1_free_target_identity_probe.py index 21eb01f2e..7496d30cd 100644 --- a/scripts/general_contact_d1_free_target_identity_probe.py +++ b/scripts/general_contact_d1_free_target_identity_probe.py @@ -10,7 +10,7 @@ import numpy as np -from anysolver import solve_static_nonlinear +from anyfesolver import solve_static_nonlinear from scripts.general_contact_d1_free_target_press_probe import build_free_target_case diff --git a/scripts/general_contact_d1_free_target_press_probe.py b/scripts/general_contact_d1_free_target_press_probe.py index f8c15ae81..b636ddcaf 100644 --- a/scripts/general_contact_d1_free_target_press_probe.py +++ b/scripts/general_contact_d1_free_target_press_probe.py @@ -8,7 +8,7 @@ from pathlib import Path import time -from anysolver import BoundaryCondition, solve_static_nonlinear +from anyfesolver import BoundaryCondition, solve_static_nonlinear from scripts.general_contact_d1_mixed_mesh_jet2_schur_press import ( _json_default, build_case, ) diff --git a/scripts/general_contact_d1_free_target_restart_probe.py b/scripts/general_contact_d1_free_target_restart_probe.py index 282e6d95b..276052fa1 100644 --- a/scripts/general_contact_d1_free_target_restart_probe.py +++ b/scripts/general_contact_d1_free_target_restart_probe.py @@ -10,7 +10,7 @@ import numpy as np -from anysolver import solve_static_nonlinear +from anyfesolver import solve_static_nonlinear from scripts.general_contact_d1_free_target_press_probe import ( build_free_target_case, ) diff --git a/scripts/general_contact_d1_free_target_schur_fraction_probe.py b/scripts/general_contact_d1_free_target_schur_fraction_probe.py index 90cbe6093..a5d9d9c27 100644 --- a/scripts/general_contact_d1_free_target_schur_fraction_probe.py +++ b/scripts/general_contact_d1_free_target_schur_fraction_probe.py @@ -9,9 +9,9 @@ import numpy as np -from anysolver import solve_static_nonlinear -from anysolver.general_contact import linearized_pivot, static_path -from anysolver.general_contact.supported_schur import SupportedSchurProposal +from anyfesolver import solve_static_nonlinear +from anyfesolver.general_contact import linearized_pivot, static_path +from anyfesolver.general_contact.supported_schur import SupportedSchurProposal from scripts.general_contact_d1_free_target_press_probe import build_free_target_case diff --git a/scripts/general_contact_d1_free_target_secant_min_probe.py b/scripts/general_contact_d1_free_target_secant_min_probe.py index 6dfb83504..14c964ca5 100644 --- a/scripts/general_contact_d1_free_target_secant_min_probe.py +++ b/scripts/general_contact_d1_free_target_secant_min_probe.py @@ -7,8 +7,8 @@ import numpy as np -from anysolver.general_contact import static_path -from anysolver.general_contact.supported_schur import SupportedSchurProposal +from anyfesolver.general_contact import static_path +from anyfesolver.general_contact.supported_schur import SupportedSchurProposal from scripts.general_contact_d1_free_target_press_probe import main as press_main diff --git a/scripts/general_contact_d1_free_target_tangent_probe.py b/scripts/general_contact_d1_free_target_tangent_probe.py index 5de2518f7..68a511db9 100644 --- a/scripts/general_contact_d1_free_target_tangent_probe.py +++ b/scripts/general_contact_d1_free_target_tangent_probe.py @@ -10,11 +10,11 @@ import numpy as np -from anysolver import BoundaryCondition -from anysolver.assembly import build_constraint_transformation -from anysolver.matrix_assembly import assemble_stiffness_matrix -from anysolver.general_contact.core import contact_scope, suspend_contact -from anysolver.nonlinear_static import _prepare_initial_states +from anyfesolver import BoundaryCondition +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.general_contact.core import contact_scope, suspend_contact +from anyfesolver.nonlinear_static import _prepare_initial_states from scripts.general_contact_d1_distributed_coupled_tangent_probe import _assemble from scripts.general_contact_d1_distributed_tangent_probe import _branches from scripts.general_contact_d1_mixed_mesh_jet2_schur_press import build_case diff --git a/scripts/general_contact_d1_gap_certificate_probe.py b/scripts/general_contact_d1_gap_certificate_probe.py index a82bd8e87..e4c613b0d 100644 --- a/scripts/general_contact_d1_gap_certificate_probe.py +++ b/scripts/general_contact_d1_gap_certificate_probe.py @@ -13,7 +13,7 @@ import numpy as np from general_contact_d1_coupled_refinement import build_case -from anysolver.general_contact.s3_patch_static import _adapters +from anyfesolver.general_contact.s3_patch_static import _adapters def main(): diff --git a/scripts/general_contact_d1_gap_failure_reuse_dev.py b/scripts/general_contact_d1_gap_failure_reuse_dev.py index 992915a4c..cb4ae10a1 100644 --- a/scripts/general_contact_d1_gap_failure_reuse_dev.py +++ b/scripts/general_contact_d1_gap_failure_reuse_dev.py @@ -10,7 +10,7 @@ import numpy as np -from anysolver import solve_static_nonlinear +from anyfesolver import solve_static_nonlinear from scripts.general_contact_d1_interior_press_dev import build_interior_press diff --git a/scripts/general_contact_d1_guided_scalar_work_check.py b/scripts/general_contact_d1_guided_scalar_work_check.py index 1ac9b11ba..bd571852e 100644 --- a/scripts/general_contact_d1_guided_scalar_work_check.py +++ b/scripts/general_contact_d1_guided_scalar_work_check.py @@ -4,9 +4,9 @@ import numpy as np -from anysolver import create_shell_element -from anysolver.fe_core import FEModel -from anysolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver import create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.matrix_assembly import assemble_stiffness_matrix def scalar_work(dx: float, dy: float, rigidity: float) -> np.ndarray: diff --git a/scripts/general_contact_d1_installed_24q4_adjudicate.py b/scripts/general_contact_d1_installed_24q4_adjudicate.py index 46971e85d..dcfd97acc 100644 --- a/scripts/general_contact_d1_installed_24q4_adjudicate.py +++ b/scripts/general_contact_d1_installed_24q4_adjudicate.py @@ -45,7 +45,7 @@ def main(registration_path: Path, result_path: Path, verdict_path: Path) -> None default=float("inf")) for field in ( "normal_force_difference_n", "minimum_gap_difference_m", "pressure_change_difference_pa")} - module_path = Path(result["anysolver_module"]).resolve() + module_path = Path(result["anyfesolver_module"]).resolve() checks = { "wheel_sha256": _sha256(wheel_path) == registration["wheel_sha256"], diff --git a/scripts/general_contact_d1_interior_analytic_strip_dev.py b/scripts/general_contact_d1_interior_analytic_strip_dev.py index 5e1003afe..db8ac6a43 100644 --- a/scripts/general_contact_d1_interior_analytic_strip_dev.py +++ b/scripts/general_contact_d1_interior_analytic_strip_dev.py @@ -10,11 +10,11 @@ import numpy as np -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactPathControl, ContactPathNodalForce, ContactPathProgram, solve_static_nonlinear, ) -from anysolver.general_contact import validate_general_contact +from anyfesolver.general_contact import validate_general_contact from scripts.general_contact_d1_mixed_mesh_jet2_schur_press import build_case diff --git a/scripts/general_contact_d1_interior_press_dev.py b/scripts/general_contact_d1_interior_press_dev.py index 3c817b8df..8ac47fdc8 100644 --- a/scripts/general_contact_d1_interior_press_dev.py +++ b/scripts/general_contact_d1_interior_press_dev.py @@ -14,9 +14,9 @@ from pathlib import Path import time -import anysolver +import anyfesolver import numpy as np -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactPathControl, ContactPathNodalForce, ContactPathProgram, solve_static_nonlinear, validate_general_contact, ) @@ -271,7 +271,7 @@ def main(output: Path, *, force_n: float, reference_slope: float, if output.exists(): raise FileExistsError(output) started = time.perf_counter() - contact_directory = Path(anysolver.__file__).resolve().parent / "general_contact" + contact_directory = Path(anyfesolver.__file__).resolve().parent / "general_contact" changed_kernel_identity = { name: hashlib.sha256((contact_directory / name).read_bytes()).hexdigest() for name in ("d1_interior_profile.py", "q4_overlap_local_bound.py", @@ -315,7 +315,7 @@ def main(output: Path, *, force_n: float, reference_slope: float, swept_fractions = [] original_admissible_fraction = None if capture_swept_failure or record_swept_fractions: - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager original_admissible_fraction = ( GeneralS3PatchManager.admissible_step_fraction) @@ -366,7 +366,7 @@ def capture_fraction(owner, start, end): }) payload = { "candidate": "d1_interior_free_rotation_press_development", - "anysolver_module": str(Path(anysolver.__file__).resolve()), + "anyfesolver_module": str(Path(anyfesolver.__file__).resolve()), "changed_kernel_sha256": changed_kernel_identity, "capability_profile": report.profile, "source_q4_faces": source_columns * source_rows, @@ -425,10 +425,10 @@ def capture_fraction(owner, start, end): payload["restart_source"] = ( str(restart_checkpoint_path) if restart_checkpoint_path else None) if capture_swept_failure: - from anysolver.general_contact.q4_overlap_local_bound import ( + from anyfesolver.general_contact.q4_overlap_local_bound import ( overlap_local_swept_lower, ) - from anysolver.general_contact.s3_pair_static import _normal_controls + from anyfesolver.general_contact.s3_pair_static import _normal_controls from examples.general_contact_d1_interior_controls_dev import ( _independent_projected_gap_bound, ) @@ -696,8 +696,8 @@ def radial_structure_check(output: Path, linear_record: Path): """Check the actual nonlinear structural owner against the guided operator.""" if output.exists(): raise FileExistsError(output) - from anysolver.matrix_assembly import assemble_stiffness_matrix - from anysolver.nonlinear_static import (_prepare_initial_states, + from anyfesolver.matrix_assembly import assemble_stiffness_matrix + from anyfesolver.nonlinear_static import (_prepare_initial_states, _prepare_qualified_q4_states_for_nonlinear_solve, _activate_nonlinear_state_storage, _assemble_nonlinear_system, _discard_nonlinear_state_candidate) @@ -745,7 +745,7 @@ def radial_preflight(output: Path, *, target_cells=4, target_right_x_m=1.3): report = validate_general_contact(model, definition, settings) if not report.valid: raise ValueError(f"radial fixture rejected: {report.issues}") - record.update(status="development_radial_preflight", anysolver_module=str(Path(anysolver.__file__).resolve()), + record.update(status="development_radial_preflight", anyfesolver_module=str(Path(anyfesolver.__file__).resolve()), total_dofs=model.mesh.dof_manager.total_dofs, source_faces=len(definition.surfaces[0].element_ids), target_faces=len(definition.surfaces[1].element_ids), @@ -765,8 +765,8 @@ def radial_linear_discriminator(output: Path, *, target_cells=4, if output.exists(): raise FileExistsError(output) from scipy import linalg, optimize - from anysolver.assembly import build_constraint_transformation - from anysolver.matrix_assembly import assemble_stiffness_matrix + from anyfesolver.assembly import build_constraint_transformation + from anyfesolver.matrix_assembly import assemble_stiffness_matrix from docs.d1_review_support.d1_two_body_reference_oracle import independent_gap_work started = time.perf_counter() model, definition, settings, program, reference, record = build_radial_guided_case( @@ -833,7 +833,7 @@ def radial_linear_discriminator(output: Path, *, target_cells=4, def radial_swept_profile(output: Path, saved_path: Path): """One saved full-path certificate, with flushed scalar cost traces.""" from functools import wraps - from anysolver.general_contact import s3_patch_static as owner + from anyfesolver.general_contact import s3_patch_static as owner if output.exists(): raise FileExistsError(output) saved = json.loads(saved_path.read_text(encoding="utf-8")) @@ -843,7 +843,7 @@ def radial_swept_profile(output: Path, saved_path: Path): pose = np.asarray(saved["steps"][-1]["displacements"]) counters, originals = {}, [] started = time.perf_counter() - print(json.dumps(dict(event="preparation_begin", imported_source=anysolver.__file__)), flush=True) + print(json.dumps(dict(event="preparation_begin", imported_source=anyfesolver.__file__)), flush=True) manager = owner.GeneralS3PatchManager(model, definition, settings) print(json.dumps(dict(event="preparation_end", elapsed_seconds=time.perf_counter()-started)), flush=True) @@ -885,11 +885,11 @@ def radial_candidate_profile(output: Path, saved_path: Path): import cProfile import pstats from functools import wraps - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager - from anysolver.general_contact.semismooth import linearize - from anysolver.general_contact import s3_patch_augmented as augmented - from anysolver.general_contact.s3_patch_mortar_energy import MovingS3PatchPrimalMortarPenalty - from anysolver.general_contact.q4_source_mortar_energy import MovingQ4PrimalMortarPenalty + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.semismooth import linearize + from anyfesolver.general_contact import s3_patch_augmented as augmented + from anyfesolver.general_contact.s3_patch_mortar_energy import MovingS3PatchPrimalMortarPenalty + from anyfesolver.general_contact.q4_source_mortar_energy import MovingQ4PrimalMortarPenalty if output.exists() or output.with_suffix(".pstats").exists(): raise FileExistsError(output) saved = json.loads(saved_path.read_text()) @@ -944,7 +944,7 @@ def measured(*args, **kwargs): input_sha256=hashlib.sha256(saved_path.read_bytes()).hexdigest(), runner_sha256=hashlib.sha256(Path(__file__).read_bytes()).hexdigest(), changed_kernel_sha256={path.name: hashlib.sha256(path.read_bytes()).hexdigest() - for path in (Path(anysolver.__file__).parent / "general_contact").glob("*.py")}, + for path in (Path(anyfesolver.__file__).parent / "general_contact").glob("*.py")}, scope="one profiled residual at saved independent linear pose; no route speed claim") output.write_text(json.dumps(record, indent=2, default=_json_default), encoding="utf-8") @@ -954,14 +954,14 @@ def radial_wrench_check(output: Path, saved_path: Path): if output.exists(): raise FileExistsError(output) from scipy import linalg - from anysolver.assembly import build_constraint_transformation - from anysolver.matrix_assembly import assemble_stiffness_matrix - from anysolver.nonlinear_static import (_prepare_initial_states, + from anyfesolver.assembly import build_constraint_transformation + from anyfesolver.matrix_assembly import assemble_stiffness_matrix + from anyfesolver.nonlinear_static import (_prepare_initial_states, _prepare_qualified_q4_states_for_nonlinear_solve, _activate_nonlinear_state_storage, _assemble_nonlinear_system, _discard_nonlinear_state_candidate) - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager - from anysolver.general_contact.semismooth import linearize + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.semismooth import linearize from docs.d1_review_support.d1_guided_reaction_wrench import guided_wrench_diagnostics saved = json.loads(saved_path.read_text()) poses, history = saved.get("accepted_pose_displacements", ()), saved.get("history", ()) @@ -1045,7 +1045,7 @@ def radial_source_bin_check(output: Path, saved_path: Path): if output.exists(): raise FileExistsError(output) from dataclasses import asdict - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from docs.d1_review_support.d1_radial_source_bin_work import check_guided_source_bins from docs.d1_review_support.d1_radial_reference_observables import uniform_disk_pressure_observables from docs.d1_review_support.d1_radial_bin_assessment import assess_physical_source_bins @@ -1055,7 +1055,7 @@ def radial_source_bin_check(output: Path, saved_path: Path): or len(saved.get("accepted_pose_displacements", ())) != 2): raise ValueError("physical bins require the completed two-step radial fixture") for name, expected in saved["changed_kernel_sha256"].items(): - path = Path(anysolver.__file__).parent / "general_contact" / name + path = Path(anyfesolver.__file__).parent / "general_contact" / name if hashlib.sha256(path.read_bytes()).hexdigest() != expected: raise ValueError(f"saved-pose contact source changed: {name}") model, definition, settings, _program, reference, record = build_radial_guided_case( @@ -1067,7 +1067,7 @@ def radial_source_bin_check(output: Path, saved_path: Path): * np.asarray(certificate["reference_support_m2"]), strict=True)) record.update(status="development_saved_physical_source_bins", input_sha256=hashlib.sha256(saved_path.read_bytes()).hexdigest(), - anysolver_module=str(Path(anysolver.__file__).resolve()), + anyfesolver_module=str(Path(anyfesolver.__file__).resolve()), quadrature_tolerance_n=reference.force_n*1e-8, maximum_triangles=14144) try: manager = GeneralS3PatchManager(model, definition, settings) @@ -1116,9 +1116,9 @@ def radial_solve(output: Path, *, target_cells=4, target_right_x_m=1.3): started = time.perf_counter() model, definition, settings, program, reference, record = build_radial_guided_case( target_cells=target_cells, target_right_x_m=target_right_x_m) - record.update(anysolver_module=str(Path(anysolver.__file__).resolve()), + record.update(anyfesolver_module=str(Path(anyfesolver.__file__).resolve()), changed_kernel_sha256={path.name: hashlib.sha256(path.read_bytes()).hexdigest() - for path in (Path(anysolver.__file__).parent / "general_contact").glob("*.py")}, + for path in (Path(anyfesolver.__file__).parent / "general_contact").glob("*.py")}, runner_sha256=hashlib.sha256(Path(__file__).read_bytes()).hexdigest()) try: from docs.d1_review_support.d1_radial_scalar_trace import radial_solver_trace @@ -1249,7 +1249,7 @@ def replay_captured_sweep(capture: Path, output: Path): target_left_edge_motion=saved.get("target_left_edge_motion", False), shared_edge_tie=saved["shared_edge_tie"], ) - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from examples.general_contact_d1_interior_controls_dev import ( _independent_projected_gap_bound, ) @@ -1305,7 +1305,7 @@ def saved_rotation_probe(saved_path: Path, output: Path) -> None: """Read-only contact-work probe at a saved accepted development pose.""" if output.exists(): raise FileExistsError(output) - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager saved = json.loads(saved_path.read_text(encoding="utf-8")) if (saved["status"] != "completed" or saved["accepted_steps"] != 2 diff --git a/scripts/general_contact_d1_interior_two_body_oracle_dev.py b/scripts/general_contact_d1_interior_two_body_oracle_dev.py index 3c8d88108..5a83740df 100644 --- a/scripts/general_contact_d1_interior_two_body_oracle_dev.py +++ b/scripts/general_contact_d1_interior_two_body_oracle_dev.py @@ -329,13 +329,13 @@ def offline_target_reference(output: Path) -> None: def _spatial_source32_identity(): - import anysolver + import anyfesolver import hashlib import subprocess root = Path(__file__).resolve().parents[1] - module_path = Path(anysolver.__file__).resolve() - if module_path != (root/"src/anysolver/__init__.py").resolve(): + module_path = Path(anyfesolver.__file__).resolve() + if module_path != (root/"src/anyfesolver/__init__.py").resolve(): raise ValueError("source32 reference must import the intended worktree source") paths = ( "scripts/general_contact_d1_interior_two_body_oracle_dev.py", @@ -343,11 +343,11 @@ def _spatial_source32_identity(): "scripts/general_contact_d1_mixed_mesh_jet2_schur_press.py", "docs/d1_review_support/d1_two_body_reference_oracle.py", "examples/general_contact_d1_interior_controls_dev.py", - "src/anysolver/assembly.py", "src/anysolver/matrix_assembly.py", + "src/anyfesolver/assembly.py", "src/anyfesolver/matrix_assembly.py", "docs/d1_review_support/d1_bounded_single.py", ) return { - "anysolver_module": str(module_path), + "anyfesolver_module": str(module_path), "python_version": sys.version, "numpy_version": np.__version__, "git_head": subprocess.check_output( ["git", "rev-parse", "HEAD"], cwd=root, text=True).strip(), @@ -397,8 +397,8 @@ def spatial_source32_allocation_inventory(output: Path) -> None: This is a resource estimate, never a scientific uncertainty estimator. """ import psutil - from anysolver.assembly import build_constraint_transformation - from anysolver.matrix_assembly import assemble_stiffness_matrix + from anyfesolver.assembly import build_constraint_transformation + from anyfesolver.matrix_assembly import assemble_stiffness_matrix from scripts.general_contact_d1_mixed_mesh_jet2_schur_press import build_case if output.exists(): @@ -806,12 +806,12 @@ def lowload_geometry_decomposition(output: Path, saved_path: Path) -> None: if output.exists(): raise FileExistsError(output) from scipy import sparse - from anysolver.assembly import build_constraint_transformation - from anysolver.general_contact.core import suspend_contact - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager - from anysolver.general_contact.semismooth import linearize - from anysolver.matrix_assembly import assemble_stiffness_matrix - from anysolver.nonlinear_static import _assemble_nonlinear_system + from anyfesolver.assembly import build_constraint_transformation + from anyfesolver.general_contact.core import suspend_contact + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.semismooth import linearize + from anyfesolver.matrix_assembly import assemble_stiffness_matrix + from anyfesolver.nonlinear_static import _assemble_nonlinear_system saved = json.loads(saved_path.read_text(encoding="utf-8")) if (saved["status"] != "completed" or saved["accepted_steps"] != 2 @@ -902,8 +902,8 @@ def lowload_current_skin_check(output: Path, saved_path: Path) -> None: if output.exists(): raise FileExistsError(output) from dataclasses import replace - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager - from anysolver.general_contact.semismooth import linearize + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.semismooth import linearize from docs.d1_review_support.d1_two_body_current_skin_quadrature import ( integrate_current_skin, ) @@ -1001,12 +1001,12 @@ def interior_saved_kkt_check(output: Path, saved_path: Path) -> None: if output.exists(): raise FileExistsError(output) import time - from anysolver.assembly import build_constraint_transformation - from anysolver.general_contact.core import suspend_contact - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager - from anysolver.general_contact.semismooth import linearize - from anysolver.matrix_assembly import assemble_stiffness_matrix - from anysolver.nonlinear_static import _assemble_nonlinear_system + from anyfesolver.assembly import build_constraint_transformation + from anyfesolver.general_contact.core import suspend_contact + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.semismooth import linearize + from anyfesolver.matrix_assembly import assemble_stiffness_matrix + from anyfesolver.nonlinear_static import _assemble_nonlinear_system from docs.d1_review_support.d1_two_body_current_skin_quadrature import ( integrate_current_skin, ) @@ -1158,10 +1158,10 @@ def interior_nonlinear_kkt_compare(output: Path, saved_path: Path) -> None: raise FileExistsError(output) import time from scipy import sparse - from anysolver.assembly import build_constraint_transformation - from anysolver.general_contact.core import suspend_contact - from anysolver.matrix_assembly import assemble_stiffness_matrix - from anysolver.nonlinear_static import _assemble_nonlinear_system + from anyfesolver.assembly import build_constraint_transformation + from anyfesolver.general_contact.core import suspend_contact + from anyfesolver.matrix_assembly import assemble_stiffness_matrix + from anyfesolver.nonlinear_static import _assemble_nonlinear_system from docs.d1_review_support.d1_two_body_current_skin_quadrature import ( integrate_current_skin, ) diff --git a/scripts/general_contact_d1_interior_work_spectrum_dev.py b/scripts/general_contact_d1_interior_work_spectrum_dev.py index fee62067d..59ff30024 100644 --- a/scripts/general_contact_d1_interior_work_spectrum_dev.py +++ b/scripts/general_contact_d1_interior_work_spectrum_dev.py @@ -14,10 +14,10 @@ import numpy as np from scipy import linalg -from anysolver.assembly import build_constraint_transformation -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.general_contact.semismooth import linearize -from anysolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.semismooth import linearize +from anyfesolver.matrix_assembly import assemble_stiffness_matrix from docs.d1_review_support.d1_two_body_reference_oracle import independent_gap_work from scripts.general_contact_d1_interior_press_dev import build_interior_press diff --git a/scripts/general_contact_d1_linearized_front_reference.py b/scripts/general_contact_d1_linearized_front_reference.py index bf106c651..57ada251c 100644 --- a/scripts/general_contact_d1_linearized_front_reference.py +++ b/scripts/general_contact_d1_linearized_front_reference.py @@ -17,10 +17,10 @@ from scipy.optimize import minimize from scipy.sparse.linalg import splu -from anysolver import BoundaryCondition, create_shell_element -from anysolver.assembly import build_constraint_transformation -from anysolver.fe_core import FEModel -from anysolver.nonlinear_static import _assemble_nonlinear_system +from anyfesolver import BoundaryCondition, create_shell_element +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.fe_core import FEModel +from anyfesolver.nonlinear_static import _assemble_nonlinear_system from scripts.general_contact_d1_pressure_field_compare import _squared_norm diff --git a/scripts/general_contact_d1_mixed_jet2_schur_probe.py b/scripts/general_contact_d1_mixed_jet2_schur_probe.py index fe03f1633..772dc01a4 100644 --- a/scripts/general_contact_d1_mixed_jet2_schur_probe.py +++ b/scripts/general_contact_d1_mixed_jet2_schur_probe.py @@ -9,9 +9,9 @@ import time import anymaterial -import anysolver +import anyfesolver -from anysolver import solve_static_nonlinear, validate_general_contact +from anyfesolver import solve_static_nonlinear, validate_general_contact from examples.general_contact_refined_q4_s3_mixed_path import make_case @@ -89,7 +89,7 @@ def main(output: Path) -> None: } for row in history], "runtime_identity": { "python": sys.version.split()[0], - "anysolver_module": str(Path(anysolver.__file__).resolve()), + "anyfesolver_module": str(Path(anyfesolver.__file__).resolve()), "anymaterial_module": str(Path(anymaterial.__file__).resolve()), }, } diff --git a/scripts/general_contact_d1_mixed_jet2_schur_restart_probe.py b/scripts/general_contact_d1_mixed_jet2_schur_restart_probe.py index 72be198bd..9329ac999 100644 --- a/scripts/general_contact_d1_mixed_jet2_schur_restart_probe.py +++ b/scripts/general_contact_d1_mixed_jet2_schur_restart_probe.py @@ -10,7 +10,7 @@ import numpy as np -from anysolver import solve_static_nonlinear +from anyfesolver import solve_static_nonlinear from scripts.general_contact_d1_mixed_jet2_schur_probe import make_candidate diff --git a/scripts/general_contact_d1_mixed_mesh_jet2_schur_press.py b/scripts/general_contact_d1_mixed_mesh_jet2_schur_press.py index 0fe828813..872e35443 100644 --- a/scripts/general_contact_d1_mixed_mesh_jet2_schur_press.py +++ b/scripts/general_contact_d1_mixed_mesh_jet2_schur_press.py @@ -11,16 +11,16 @@ import time import anymaterial -import anysolver +import anyfesolver import numpy as np -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathNodalForce, ContactPathProgram, ContactSolverSettings, ContactSurface, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def _json_default(value): @@ -360,7 +360,7 @@ def main(columns: int, output: Path, pressure_cap_pa: float = 10.0, emit_restart_checkpoint=emit_restart_checkpoint, ) derivative_module = importlib.import_module( - "anysolver.general_contact.q4_s3_overlap_derivatives" + "anyfesolver.general_contact.q4_s3_overlap_derivatives" ) record = { "candidate": ("mixed_bending_refinement_jet2_active_set_dev" @@ -413,7 +413,7 @@ def main(columns: int, output: Path, pressure_cap_pa: float = 10.0, "final_displacements": result.displacements.tolist(), "runtime_identity": { "python": sys.version.split()[0], - "anysolver_module": str(Path(anysolver.__file__).resolve()), + "anyfesolver_module": str(Path(anyfesolver.__file__).resolve()), "anymaterial_module": str(Path(anymaterial.__file__).resolve()), "compiled_bjet_mul_enabled": bool( derivative_module._COMPILED_BJET_MUL_ENABLED diff --git a/scripts/general_contact_d1_mixed_mesh_restart_probe.py b/scripts/general_contact_d1_mixed_mesh_restart_probe.py index 3bd87abac..6ea21d04d 100644 --- a/scripts/general_contact_d1_mixed_mesh_restart_probe.py +++ b/scripts/general_contact_d1_mixed_mesh_restart_probe.py @@ -11,7 +11,7 @@ import numpy as np -from anysolver import solve_static_nonlinear +from anyfesolver import solve_static_nonlinear from scripts.general_contact_d1_mixed_mesh_jet2_schur_press import build_case diff --git a/scripts/general_contact_d1_mixed_mesh_restart_probe_v2.py b/scripts/general_contact_d1_mixed_mesh_restart_probe_v2.py index 401dcc2be..f52ddbce8 100644 --- a/scripts/general_contact_d1_mixed_mesh_restart_probe_v2.py +++ b/scripts/general_contact_d1_mixed_mesh_restart_probe_v2.py @@ -12,9 +12,9 @@ import numpy as np import scipy import anymaterial -import anysolver +import anyfesolver -from anysolver import solve_static_nonlinear +from anyfesolver import solve_static_nonlinear from scripts.general_contact_d1_mixed_mesh_jet2_schur_press import build_case @@ -167,7 +167,7 @@ def candidate(): "python": sys.version.split()[0], "numpy": np.__version__, "scipy": scipy.__version__, - "anysolver_module": str(Path(anysolver.__file__).resolve()), + "anyfesolver_module": str(Path(anyfesolver.__file__).resolve()), "anymaterial_module": str(Path(anymaterial.__file__).resolve()), }, "elapsed_seconds": time.perf_counter()-started, diff --git a/scripts/general_contact_d1_mixed_wedge_capture.py b/scripts/general_contact_d1_mixed_wedge_capture.py index 9f0559b9a..3aeb5c519 100644 --- a/scripts/general_contact_d1_mixed_wedge_capture.py +++ b/scripts/general_contact_d1_mixed_wedge_capture.py @@ -7,7 +7,7 @@ import numpy as np -from anysolver.general_contact.s3_patch_augmented import ( +from anyfesolver.general_contact.s3_patch_augmented import ( MovingS3PatchProjectedNormal, ) from scripts.general_contact_d1_mixed_mesh_jet2_schur_press import main diff --git a/scripts/general_contact_d1_near_rim_axis_refinement.py b/scripts/general_contact_d1_near_rim_axis_refinement.py index b8f7a5bc1..2881e5ee5 100644 --- a/scripts/general_contact_d1_near_rim_axis_refinement.py +++ b/scripts/general_contact_d1_near_rim_axis_refinement.py @@ -1,6 +1,6 @@ """Separate x/front and y/rim refinement of the independent D1 Q1 oracle. -This is a source-only development discriminator. It does not run ANYsolver's +This is a source-only development discriminator. It does not run ANYfeSolver's coupled shell model or establish pressure-space qualification by itself. """ diff --git a/scripts/general_contact_d1_open_ring_displacement_dev.py b/scripts/general_contact_d1_open_ring_displacement_dev.py index 17d1ceb6d..dd10c0a46 100644 --- a/scripts/general_contact_d1_open_ring_displacement_dev.py +++ b/scripts/general_contact_d1_open_ring_displacement_dev.py @@ -10,16 +10,16 @@ import numpy as np -import anysolver -from anysolver import ( +import anyfesolver +from anyfesolver import ( ContactPathControl, ContactPathProgram, solve_static_nonlinear, validate_general_contact, ) -from anysolver.assembly import build_constraint_transformation -from anysolver.general_contact.static_path import ( +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.general_contact.static_path import ( _elastic_displacement_force_predictor, ) -from anysolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.matrix_assembly import assemble_stiffness_matrix from scripts.general_contact_d1_interior_press_dev import build_interior_press from scripts.general_contact_d1_mixed_mesh_jet2_schur_press import _json_default @@ -121,7 +121,7 @@ def main(reference: Path, output: Path, *, full_cycle: bool = False) -> None: active_dof = model.mesh.dof_manager.get_node_dofs(_REFERENCE_ACTIVE_NODE)[2] payload = { "candidate": "d1_open_ring_source_displacement_control_development", - "anysolver_module": str(Path(anysolver.__file__).resolve()), + "anyfesolver_module": str(Path(anyfesolver.__file__).resolve()), "reference_pose": str(reference), "source_control_nodes": list(_OPEN_RING_NODES), "source_control_weights": [0.25]*4, diff --git a/scripts/general_contact_d1_open_ring_restart_dev.py b/scripts/general_contact_d1_open_ring_restart_dev.py index 58b77307a..78f12cc3e 100644 --- a/scripts/general_contact_d1_open_ring_restart_dev.py +++ b/scripts/general_contact_d1_open_ring_restart_dev.py @@ -9,7 +9,7 @@ import numpy as np -from anysolver import solve_static_nonlinear +from anyfesolver import solve_static_nonlinear from scripts.general_contact_d1_open_ring_displacement_dev import build_case diff --git a/scripts/general_contact_d1_overlap_capture_dev.py b/scripts/general_contact_d1_overlap_capture_dev.py index 6a4851ea4..fe57883ef 100644 --- a/scripts/general_contact_d1_overlap_capture_dev.py +++ b/scripts/general_contact_d1_overlap_capture_dev.py @@ -10,10 +10,10 @@ import json from pathlib import Path -import anysolver -from anysolver import solve_static_nonlinear -from anysolver.general_contact import s3_patch_augmented as patch -from anysolver.general_contact.q4_s3_overlap_derivatives import UnsupportedQ4S3Branch +import anyfesolver +from anyfesolver import solve_static_nonlinear +from anyfesolver.general_contact import s3_patch_augmented as patch +from anyfesolver.general_contact.q4_s3_overlap_derivatives import UnsupportedQ4S3Branch from scripts.general_contact_d1_interior_press_dev import build_interior_press @@ -52,7 +52,7 @@ def gate(float_area, jet2_area, resolution): "rejection": str(exc), }) output.write_text(json.dumps({ - "anysolver_module": str(Path(anysolver.__file__).resolve()), + "anyfesolver_module": str(Path(anyfesolver.__file__).resolve()), "source": "corrected_left_edge_first_press_development", "captures": captures, }, indent=2) + "\n", encoding="utf-8") @@ -76,7 +76,7 @@ def gate(float_area, jet2_area, resolution): patch.q4_s3_overlap_derivatives = original_derivative patch._q4_s3_pair_value_rtol = original_gate payload = { - "anysolver_module": str(Path(anysolver.__file__).resolve()), + "anyfesolver_module": str(Path(anyfesolver.__file__).resolve()), "source": "corrected_left_edge_first_press_development", "status": result.status, "failure_reason": result.failure_reason, diff --git a/scripts/general_contact_d1_overlap_gap_bound_dev.py b/scripts/general_contact_d1_overlap_gap_bound_dev.py index 86b5b24b8..5899f26b6 100644 --- a/scripts/general_contact_d1_overlap_gap_bound_dev.py +++ b/scripts/general_contact_d1_overlap_gap_bound_dev.py @@ -8,12 +8,12 @@ import numpy as np -from anysolver.general_contact.q4_source_overlap import q4_source_projected_gap_lower -from anysolver.general_contact.q4_overlap_local_bound import ( +from anyfesolver.general_contact.q4_source_overlap import q4_source_projected_gap_lower +from anyfesolver.general_contact.q4_overlap_local_bound import ( overlap_local_lower, overlap_local_swept_lower, ) -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from scripts.general_contact_d1_2d_target_press_dev import build_case diff --git a/scripts/general_contact_d1_overlap_shape_bench.py b/scripts/general_contact_d1_overlap_shape_bench.py index 7adc6bfa8..2e0e35586 100644 --- a/scripts/general_contact_d1_overlap_shape_bench.py +++ b/scripts/general_contact_d1_overlap_shape_bench.py @@ -10,7 +10,7 @@ import numpy as np -from anysolver.general_contact.overlap import ( +from anyfesolver.general_contact.overlap import ( PlanarFace, _q4_shape, planar_projected_overlap, ) diff --git a/scripts/general_contact_d1_overlay_gap_rank.py b/scripts/general_contact_d1_overlay_gap_rank.py index bf0cd1fa4..d3beea46f 100644 --- a/scripts/general_contact_d1_overlay_gap_rank.py +++ b/scripts/general_contact_d1_overlay_gap_rank.py @@ -8,10 +8,10 @@ import numpy as np from scipy import sparse -from anysolver.general_contact.core import contact_scope -from anysolver.general_contact.pressure_overlay import subdivide_q4_pressure_faces -from anysolver.general_contact.s3_patch_augmented import MovingS3PatchProjectedNormal -from anysolver.general_contact.s3_patch_mortar_energy import ( +from anyfesolver.general_contact.core import contact_scope +from anyfesolver.general_contact.pressure_overlay import subdivide_q4_pressure_faces +from anyfesolver.general_contact.s3_patch_augmented import MovingS3PatchProjectedNormal +from anyfesolver.general_contact.s3_patch_mortar_energy import ( MovingS3PatchPrimalMortarPenalty, ) from scripts.general_contact_d1_finite_area_load import build_case diff --git a/scripts/general_contact_d1_overlay_probe.py b/scripts/general_contact_d1_overlay_probe.py index 7e01c6a67..5039d3241 100644 --- a/scripts/general_contact_d1_overlay_probe.py +++ b/scripts/general_contact_d1_overlay_probe.py @@ -7,10 +7,10 @@ import numpy as np -from anysolver.general_contact.core import contact_scope -from anysolver.general_contact.pressure_overlay import subdivide_q4_pressure_faces -from anysolver.general_contact.s3_patch_augmented import MovingS3PatchProjectedNormal -from anysolver.general_contact.s3_patch_mortar_energy import ( +from anyfesolver.general_contact.core import contact_scope +from anyfesolver.general_contact.pressure_overlay import subdivide_q4_pressure_faces +from anyfesolver.general_contact.s3_patch_augmented import MovingS3PatchProjectedNormal +from anyfesolver.general_contact.s3_patch_mortar_energy import ( MovingS3PatchPrimalMortarPenalty, ) from scripts.general_contact_d1_finite_area_load import build_case diff --git a/scripts/general_contact_d1_pair_search_preflight_dev.py b/scripts/general_contact_d1_pair_search_preflight_dev.py index 031d657ec..8f63161e9 100644 --- a/scripts/general_contact_d1_pair_search_preflight_dev.py +++ b/scripts/general_contact_d1_pair_search_preflight_dev.py @@ -9,7 +9,7 @@ import numpy as np -from anysolver.general_contact.s3_patch_mortar_energy import ( +from anyfesolver.general_contact.s3_patch_mortar_energy import ( MovingS3PatchPrimalMortarPenalty, S3PatchFace, ) diff --git a/scripts/general_contact_d1_pressure_family_preflight_dev.py b/scripts/general_contact_d1_pressure_family_preflight_dev.py index 58f57705a..08a7fd5c4 100644 --- a/scripts/general_contact_d1_pressure_family_preflight_dev.py +++ b/scripts/general_contact_d1_pressure_family_preflight_dev.py @@ -13,11 +13,11 @@ import numpy as np from scipy import linalg -from anysolver import ContactPathNodalForce -from anysolver.assembly import build_constraint_transformation -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.general_contact.semismooth import linearize -from anysolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver import ContactPathNodalForce +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.semismooth import linearize +from anyfesolver.matrix_assembly import assemble_stiffness_matrix from scripts.general_contact_d1_interior_press_dev import build_interior_press from scripts.general_contact_d1_interior_work_spectrum_dev import _reference_mass diff --git a/scripts/general_contact_d1_pressure_field_compare.py b/scripts/general_contact_d1_pressure_field_compare.py index e2b118f28..4feed99e2 100644 --- a/scripts/general_contact_d1_pressure_field_compare.py +++ b/scripts/general_contact_d1_pressure_field_compare.py @@ -2,7 +2,7 @@ This read-only development diagnostic uses exact tensor-product two-point quadrature for the squared difference of piecewise bilinear fields. It does not -call ANYsolver contact geometry, constitutive code, or acceptance machinery. +call ANYfeSolver contact geometry, constitutive code, or acceptance machinery. """ from __future__ import annotations diff --git a/scripts/general_contact_d1_pressure_gate_screen_dev.py b/scripts/general_contact_d1_pressure_gate_screen_dev.py index 88c1a27d9..b1211c09c 100644 --- a/scripts/general_contact_d1_pressure_gate_screen_dev.py +++ b/scripts/general_contact_d1_pressure_gate_screen_dev.py @@ -17,10 +17,10 @@ from scipy import linalg from scipy.sparse.linalg import lsqr -from anysolver.assembly import build_constraint_transformation -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.general_contact.semismooth import linearize -from anysolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.semismooth import linearize +from anyfesolver.matrix_assembly import assemble_stiffness_matrix from scripts.general_contact_d1_interior_press_dev import build_interior_press from scripts.general_contact_d1_interior_work_spectrum_dev import _reference_mass from scripts.general_contact_d1_pressure_transport_preflight_dev import _smooth_pose diff --git a/scripts/general_contact_d1_pressure_space_probe.py b/scripts/general_contact_d1_pressure_space_probe.py index 200a82111..acbea7342 100644 --- a/scripts/general_contact_d1_pressure_space_probe.py +++ b/scripts/general_contact_d1_pressure_space_probe.py @@ -12,7 +12,7 @@ import numpy as np -from anysolver.general_contact.core import contact_scope +from anyfesolver.general_contact.core import contact_scope from scripts.general_contact_d1_finite_area_load import build_case diff --git a/scripts/general_contact_d1_pressure_transport_preflight_dev.py b/scripts/general_contact_d1_pressure_transport_preflight_dev.py index eac8bbd29..a7d2c3177 100644 --- a/scripts/general_contact_d1_pressure_transport_preflight_dev.py +++ b/scripts/general_contact_d1_pressure_transport_preflight_dev.py @@ -14,10 +14,10 @@ import numpy as np from scipy.sparse.linalg import lsqr -from anysolver.assembly import build_constraint_transformation -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.general_contact.semismooth import linearize -from anysolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.semismooth import linearize +from anyfesolver.matrix_assembly import assemble_stiffness_matrix from scripts.general_contact_d1_interior_press_dev import build_interior_press diff --git a/scripts/general_contact_d1_profile_coupled.py b/scripts/general_contact_d1_profile_coupled.py index 21460d63c..ef310c3e5 100644 --- a/scripts/general_contact_d1_profile_coupled.py +++ b/scripts/general_contact_d1_profile_coupled.py @@ -16,13 +16,13 @@ import numpy as np -import anysolver.nonlinear_static as nonlinear_static -import anysolver.general_contact.s3_patch_augmented as augmented -import anysolver.general_contact.s3_patch_mortar_energy as mortar -import anysolver.general_contact.s3_patch_static as patch_static -import anysolver.general_contact.static_path as static_path -import anysolver.general_contact.semismooth_path as semismooth_path -import anysolver.nonlinear_restart as nonlinear_restart +import anyfesolver.nonlinear_static as nonlinear_static +import anyfesolver.general_contact.s3_patch_augmented as augmented +import anyfesolver.general_contact.s3_patch_mortar_energy as mortar +import anyfesolver.general_contact.s3_patch_static as patch_static +import anyfesolver.general_contact.static_path as static_path +import anyfesolver.general_contact.semismooth_path as semismooth_path +import anyfesolver.nonlinear_restart as nonlinear_restart from scripts.general_contact_d1_selected_vs_fine_coupled_dev import _run from scripts.general_contact_d1_mixed_mesh_jet2_schur_press import build_case from scripts.general_contact_d1_pressure_bins import integrate_q1_bins diff --git a/scripts/general_contact_d1_projected_certificate_probe.py b/scripts/general_contact_d1_projected_certificate_probe.py index cb4cdd628..cb7a12163 100644 --- a/scripts/general_contact_d1_projected_certificate_probe.py +++ b/scripts/general_contact_d1_projected_certificate_probe.py @@ -8,8 +8,8 @@ import numpy as np from general_contact_d1_coupled_refinement import build_case -from anysolver import validate_general_contact -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver import validate_general_contact +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager def main(): diff --git a/scripts/general_contact_d1_proportional_plate_dev.py b/scripts/general_contact_d1_proportional_plate_dev.py index f439ca268..2f34ea0c7 100644 --- a/scripts/general_contact_d1_proportional_plate_dev.py +++ b/scripts/general_contact_d1_proportional_plate_dev.py @@ -16,12 +16,12 @@ from pathlib import Path import time -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSurface, ContactSolverSettings, LoadCase, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel from scripts.general_contact_d1_interior_press_dev import ( _physical_bump_axis_weights, ) diff --git a/scripts/general_contact_d1_schur_response_capture.py b/scripts/general_contact_d1_schur_response_capture.py index 5adc8b0e9..9e5331382 100644 --- a/scripts/general_contact_d1_schur_response_capture.py +++ b/scripts/general_contact_d1_schur_response_capture.py @@ -7,7 +7,7 @@ import numpy as np -from anysolver.general_contact import linearized_pivot +from anyfesolver.general_contact import linearized_pivot from scripts.general_contact_d1_mixed_mesh_jet2_schur_press import main diff --git a/scripts/general_contact_d1_schur_scaling_screen.py b/scripts/general_contact_d1_schur_scaling_screen.py index d9b4c8808..25bb6d51d 100644 --- a/scripts/general_contact_d1_schur_scaling_screen.py +++ b/scripts/general_contact_d1_schur_scaling_screen.py @@ -13,12 +13,12 @@ import numpy as np -from anysolver.assembly import build_constraint_transformation -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.general_contact.semismooth import ( +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.semismooth import ( linearize, reference_nodal_support, ) -from anysolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.matrix_assembly import assemble_stiffness_matrix from docs.d1_review_support.d1_cut_front_shell_work import build_patch from docs.d1_review_support.d1_cut_front_two_hat_limit import ( limit_matrix, null_coefficients, diff --git a/scripts/general_contact_d1_selected_knots_press_dev.py b/scripts/general_contact_d1_selected_knots_press_dev.py index 1f0d5721e..dbd952755 100644 --- a/scripts/general_contact_d1_selected_knots_press_dev.py +++ b/scripts/general_contact_d1_selected_knots_press_dev.py @@ -10,7 +10,7 @@ import numpy as np -from anysolver import solve_static_nonlinear, validate_general_contact +from anyfesolver import solve_static_nonlinear, validate_general_contact from scripts.general_contact_d1_mixed_mesh_jet2_schur_press import build_case diff --git a/scripts/general_contact_d1_selected_vs_fine_coupled_dev.py b/scripts/general_contact_d1_selected_vs_fine_coupled_dev.py index 3321da21e..a1e7c86a3 100644 --- a/scripts/general_contact_d1_selected_vs_fine_coupled_dev.py +++ b/scripts/general_contact_d1_selected_vs_fine_coupled_dev.py @@ -11,8 +11,8 @@ import numpy as np -from anysolver import solve_static_nonlinear, validate_general_contact -from anysolver.general_contact.pressure_basis import ( +from anyfesolver import solve_static_nonlinear, validate_general_contact +from anyfesolver.general_contact.pressure_basis import ( build_q4_source_selected_q1_basis, ) from scripts.general_contact_d1_mixed_mesh_jet2_schur_press import build_case diff --git a/scripts/general_contact_d1_sliver_derivative_probe.py b/scripts/general_contact_d1_sliver_derivative_probe.py index fbe9ddb8d..bc2d412aa 100644 --- a/scripts/general_contact_d1_sliver_derivative_probe.py +++ b/scripts/general_contact_d1_sliver_derivative_probe.py @@ -5,10 +5,10 @@ import numpy as np from general_contact_d1_coupled_refinement import build_case -from anysolver.general_contact.q4_s3_overlap_derivatives import ( +from anyfesolver.general_contact.q4_s3_overlap_derivatives import ( UnsupportedQ4S3Branch, q4_s3_overlap_derivatives, ) -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager def main(): diff --git a/scripts/general_contact_d1_source_y_resolution.py b/scripts/general_contact_d1_source_y_resolution.py index 46eab06f7..61bc8cd55 100644 --- a/scripts/general_contact_d1_source_y_resolution.py +++ b/scripts/general_contact_d1_source_y_resolution.py @@ -12,10 +12,10 @@ from scipy import sparse from scipy.sparse.linalg import splu -from anysolver import BoundaryCondition, create_shell_element -from anysolver.assembly import build_constraint_transformation -from anysolver.fe_core import FEModel -from anysolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver import BoundaryCondition, create_shell_element +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.fe_core import FEModel +from anyfesolver.matrix_assembly import assemble_stiffness_matrix from scripts.general_contact_d1_continuum_obstacle_reference import solve from scripts.general_contact_d1_front_cluster_screen import _cluster_knots from scripts.general_contact_d1_linearized_front_reference import _nonnegative_quadratic diff --git a/scripts/general_contact_d1_tangent_pairs_dev.py b/scripts/general_contact_d1_tangent_pairs_dev.py index dfd9808a9..f8f0221e1 100644 --- a/scripts/general_contact_d1_tangent_pairs_dev.py +++ b/scripts/general_contact_d1_tangent_pairs_dev.py @@ -8,12 +8,12 @@ import numpy as np -from anysolver.assembly import build_constraint_transformation -from anysolver.general_contact.q4_s3_overlap_derivatives import ( +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.general_contact.q4_s3_overlap_derivatives import ( UnsupportedQ4S3Branch, q4_s3_overlap_derivatives, ) -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.matrix_assembly import assemble_stiffness_matrix from scripts.general_contact_d1_interior_press_dev import build_interior_press diff --git a/scripts/general_contact_d1_target_displacement_dev.py b/scripts/general_contact_d1_target_displacement_dev.py index 313e7bddb..db65af69c 100644 --- a/scripts/general_contact_d1_target_displacement_dev.py +++ b/scripts/general_contact_d1_target_displacement_dev.py @@ -8,8 +8,8 @@ from pathlib import Path import time -import anysolver -from anysolver import ( +import anyfesolver +from anyfesolver import ( BoundaryCondition, ContactPathControl, ContactPathProgram, solve_static_nonlinear, validate_general_contact, ) @@ -63,7 +63,7 @@ def main(output: Path, normal_motion_m: float, force_reference_n: float): ) payload = { "candidate": "d1_interior_target_normal_displacement_development", - "anysolver_module": str(Path(anysolver.__file__).resolve()), + "anyfesolver_module": str(Path(anyfesolver.__file__).resolve()), "source_q4_faces": 16, "target_s3_faces": 4, "normal_motion_m": normal_motion_m, diff --git a/scripts/general_contact_d1_target_pressure_margin_probe.py b/scripts/general_contact_d1_target_pressure_margin_probe.py index 45d0b9f20..019694caa 100644 --- a/scripts/general_contact_d1_target_pressure_margin_probe.py +++ b/scripts/general_contact_d1_target_pressure_margin_probe.py @@ -9,7 +9,7 @@ import numpy as np -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from scripts.general_contact_d1_mixed_mesh_jet2_schur_press import build_case diff --git a/scripts/general_contact_d1_tilted_target_local_tangent_probe.py b/scripts/general_contact_d1_tilted_target_local_tangent_probe.py index 67230b5fa..17f1e17be 100644 --- a/scripts/general_contact_d1_tilted_target_local_tangent_probe.py +++ b/scripts/general_contact_d1_tilted_target_local_tangent_probe.py @@ -14,7 +14,7 @@ import numpy as np -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from scripts.general_contact_d1_mixed_mesh_jet2_schur_press import build_case diff --git a/scripts/general_contact_d1_tiny_wedge_crosscheck.py b/scripts/general_contact_d1_tiny_wedge_crosscheck.py index c6e9e77e0..873ba40c5 100644 --- a/scripts/general_contact_d1_tiny_wedge_crosscheck.py +++ b/scripts/general_contact_d1_tiny_wedge_crosscheck.py @@ -6,8 +6,8 @@ import numpy as np -from anysolver.general_contact.q4_s3_overlap_derivatives import q4_s3_overlap_derivatives -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.q4_s3_overlap_derivatives import q4_s3_overlap_derivatives +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from scripts.general_contact_d1_coupled_refinement import build_case diff --git a/scripts/general_contact_enriched_path_geometry.py b/scripts/general_contact_enriched_path_geometry.py index 6c6e40d80..9c02ac8e7 100644 --- a/scripts/general_contact_enriched_path_geometry.py +++ b/scripts/general_contact_enriched_path_geometry.py @@ -114,7 +114,7 @@ def inverse_projected(points, corners, beta, normal, frame): def _raw_identity(model): """Read-only model identity, independent of a contact definition's cache.""" - from anysolver.nonlinear_restart import model_configuration_fingerprint + from anyfesolver.nonlinear_restart import model_configuration_fingerprint return model_configuration_fingerprint(model) @@ -204,7 +204,7 @@ def verify(self): def check_cancel(self): if self.cancel(): - from anysolver.control import SolveCancelled + from anyfesolver.control import SolveCancelled raise SolveCancelled('independent reference cancelled') def vertices(self, pose): diff --git a/scripts/general_contact_enriched_path_reference.py b/scripts/general_contact_enriched_path_reference.py index b8db6f124..78fcfe45c 100644 --- a/scripts/general_contact_enriched_path_reference.py +++ b/scripts/general_contact_enriched_path_reference.py @@ -49,7 +49,7 @@ def full_work(model,system,definitions,u,z,force,*,cancel=lambda:False,progress= orders=[] for order in ORDERS: if cancel(): - from anysolver.control import SolveCancelled + from anyfesolver.control import SolveCancelled raise SolveCancelled('independent full path work cancelled') oracle=None if reuse is None else reuse.get((h,order)) if oracle is None:oracle=ContactOracle(model,definitions,u,z,order,cancel=cancel) @@ -62,12 +62,12 @@ def full_work(model,system,definitions,u,z,force,*,cancel=lambda:False,progress= sampled=[] for i in range(n): if cancel(): - from anysolver.control import SolveCancelled + from anyfesolver.control import SolveCancelled raise SolveCancelled('independent path work cancelled') p,m=np.array(u,copy=True),np.array(u,copy=True);p[i]+=h;m[i]-=h plus=oracle.evaluate(p) if cancel(): - from anysolver.control import SolveCancelled + from anyfesolver.control import SolveCancelled raise SolveCancelled('independent path work cancelled') minus=oracle.evaluate(m) central[i]=(plus['work']-minus['work'])/(2*h) @@ -105,7 +105,7 @@ def gap_gradient(oracle,u,h=3e-6,cancel=lambda:False): g=np.empty((len(oracle.z),len(u))) for i in range(len(u)): if cancel(): - from anysolver.control import SolveCancelled + from anyfesolver.control import SolveCancelled raise SolveCancelled('independent path reference cancelled') p,m=np.array(u,copy=True),np.array(u,copy=True);p[i]+=h;m[i]-=h g[:,i]=(oracle.evaluate(p)['gap']-oracle.evaluate(m)['gap'])/(2*h) diff --git a/scripts/general_contact_enriched_path_run.py b/scripts/general_contact_enriched_path_run.py index 21ed7c142..6e9348c04 100644 --- a/scripts/general_contact_enriched_path_run.py +++ b/scripts/general_contact_enriched_path_run.py @@ -8,8 +8,8 @@ from scripts.general_contact_enriched_path_geometry import PhysicalField,union_certificate from scripts.general_contact_enriched_path_bounds import global_gap_certificate from scripts.general_contact_enriched_path_reference import assess_endpoint -from anysolver.e4_pl_enriched import EnrichedProfileError -from anysolver.control import SolveCancelled +from anyfesolver.e4_pl_enriched import EnrichedProfileError +from anyfesolver.control import SolveCancelled def publish(path,value): @@ -147,7 +147,7 @@ def cancel_before_commit(candidate): # Admission must reject BEFORE evaluating or publishing a restored state. from dataclasses import replace from examples.general_contact_enriched_d1_path import build - from anysolver.general_contact.enriched_path import EnrichedPathOwner + from anyfesolver.general_contact.enriched_path import EnrichedPathOwner model,definition,fresh,_=build('displacement') points=list(fresh.program.waypoints);last=list(points[-1]);last[0]+=.001;points[-1]=tuple(last) changed=replace(fresh.program,waypoints=tuple(points)) diff --git a/scripts/general_contact_enriched_reference.py b/scripts/general_contact_enriched_reference.py index 5948507a9..de72f90f2 100644 --- a/scripts/general_contact_enriched_reference.py +++ b/scripts/general_contact_enriched_reference.py @@ -84,7 +84,7 @@ def full_work(model, system, definitions, u, z, production_force, *, progress=No """All238 central AND both one-sided work derivatives, both h/orders.""" def requested_cancel(): if cancel(): - from anysolver.control import SolveCancelled + from anyfesolver.control import SolveCancelled raise SolveCancelled('independent full238 work cancelled') requested_cancel() labels = coordinate_inventory(model, system) @@ -155,8 +155,8 @@ def observe_local_moments(system, u): The independent geometry module never sees these jets or this hook. """ - from anysolver.general_contact import enriched_moment_batch as module - from anysolver.general_contact.enriched_nonlinear import NonlinearEnrichedSystem + from anyfesolver.general_contact import enriched_moment_batch as module + from anyfesolver.general_contact.enriched_nonlinear import NonlinearEnrichedSystem require(type(system) is NonlinearEnrichedSystem, 'exact actual nonlinear profile for production comparator') caller_code = NonlinearEnrichedSystem.linearize.__code__ caller_source = Path(inspect.getsourcefile(NonlinearEnrichedSystem.linearize)).resolve() diff --git a/scripts/general_contact_enriched_reference_geometry.py b/scripts/general_contact_enriched_reference_geometry.py index 972134037..5f57fd878 100644 --- a/scripts/general_contact_enriched_reference_geometry.py +++ b/scripts/general_contact_enriched_reference_geometry.py @@ -114,7 +114,7 @@ def inverse_projected(points, corners, beta, normal, frame): def _raw_identity(model): """Read-only model identity, independent of a contact definition's cache.""" - from anysolver.nonlinear_restart import model_configuration_fingerprint + from anyfesolver.nonlinear_restart import model_configuration_fingerprint return model_configuration_fingerprint(model) @@ -204,7 +204,7 @@ def verify(self): def check_cancel(self): if self.cancel(): - from anysolver.control import SolveCancelled + from anyfesolver.control import SolveCancelled raise SolveCancelled('independent reference cancelled') def vertices(self, pose): diff --git a/scripts/general_contact_enriched_reference_run.py b/scripts/general_contact_enriched_reference_run.py index 99d460f16..840687b1b 100644 --- a/scripts/general_contact_enriched_reference_run.py +++ b/scripts/general_contact_enriched_reference_run.py @@ -5,7 +5,7 @@ from pathlib import Path W = Path('C:/ANYworkspaceWork/contact_trackB_dependency_repair_20261013/d1-polynomial-reference-work-v15') -REPO = Path('C:/Github/ANYsolver/.worktrees/contact-portable-replay') +REPO = Path('C:/Github/ANYfeSolver/.worktrees/contact-portable-replay') OWNED_EXISTING = ('scripts/general_contact_enriched_reference.py', 'scripts/general_contact_enriched_reference_geometry.py', 'scripts/general_contact_enriched_reference_bounds.py', diff --git a/scripts/general_contact_restart_discrepancy_probe.py b/scripts/general_contact_restart_discrepancy_probe.py index 9083b0884..2403b3737 100644 --- a/scripts/general_contact_restart_discrepancy_probe.py +++ b/scripts/general_contact_restart_discrepancy_probe.py @@ -7,7 +7,7 @@ import numpy as np -from anysolver import solve_static_nonlinear +from anyfesolver import solve_static_nonlinear sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "tests")) diff --git a/scripts/general_contact_seed_gap_reference.py b/scripts/general_contact_seed_gap_reference.py index 8d0e2c09c..03f3a1a53 100644 --- a/scripts/general_contact_seed_gap_reference.py +++ b/scripts/general_contact_seed_gap_reference.py @@ -2,7 +2,7 @@ Scope: D1_SEED_GAP_DISCRIMINATOR_DEV420_V1 (Mistral-owned discriminator). -This module is deliberately self-contained: stdlib only, no ``anysolver`` +This module is deliberately self-contained: stdlib only, no ``anyfesolver`` import, and no production gap/witness kernel is called for any oracle value. It re-derives the physical source-normal gap of the captured pair path from the literal endpoint geometry and certifies it with exact diff --git a/scripts/generate_fe_baselines.py b/scripts/generate_fe_baselines.py index fb3a43af9..0f177d339 100644 --- a/scripts/generate_fe_baselines.py +++ b/scripts/generate_fe_baselines.py @@ -11,7 +11,7 @@ if str(SRC) not in sys.path: sys.path.insert(0, str(SRC)) -from anysolver.baselines import DEFAULT_BASELINE_PATH, write_baseline +from anyfesolver.baselines import DEFAULT_BASELINE_PATH, write_baseline def main() -> int: diff --git a/scripts/generate_sestra_verification_fem.py b/scripts/generate_sestra_verification_fem.py index bdaf53cfe..d6490c88c 100644 --- a/scripts/generate_sestra_verification_fem.py +++ b/scripts/generate_sestra_verification_fem.py @@ -3,7 +3,7 @@ from pathlib import Path import sys sys.path.insert(0,str(Path(__file__).resolve().parents[1]/"src")) -from anysolver.sestra_verification import generate_hanging_shell +from anyfesolver.sestra_verification import generate_hanging_shell def main(): diff --git a/scripts/inspect_sestra_flatbar.py b/scripts/inspect_sestra_flatbar.py index 3cfd0b1df..fbc4b5e96 100644 --- a/scripts/inspect_sestra_flatbar.py +++ b/scripts/inspect_sestra_flatbar.py @@ -1,6 +1,6 @@ """Audit and display the actual ANYfem SESAM import; neither solver is run. -Run from any directory with the ANYsolver development Python environment. +Run from any directory with the ANYfeSolver development Python environment. By default this inspects the retained FEM used in the comparison. Pass --fem to inspect another file, including the live GeniE export. Outputs are an interactive, self-contained 3D HTML model and a JSON runtime audit. @@ -24,7 +24,7 @@ def main() -> int: parser.add_argument('--open', action='store_true', help='Open the interactive model in your browser') args = parser.parse_args() # Use the checked-out ecosystem source rather than older installed packages. - for name in ('ANYfem', 'ANYsolver', 'ANYfileIO', 'ANYgeometry', 'ANYmesh', 'ANYmaterial'): + for name in ('ANYfem', 'ANYfeSolver', 'ANYfileIO', 'ANYgeometry', 'ANYmesh', 'ANYmaterial'): source = repo.parent / name / 'src' if source.is_dir(): sys.path.insert(0, str(source)) @@ -32,7 +32,7 @@ def main() -> int: import numpy as np import plotly.graph_objects as go from anyfem.io.sesam import import_sesam - from anysolver.elements import BeamElement + from anyfesolver.elements import BeamElement fem = args.fem.resolve(strict=True) imported = import_sesam(fem, strict=True) @@ -98,7 +98,7 @@ def main() -> int: centers, arms = np.array(centers), np.array(arms) fig.add_trace(go.Scatter3d(x=centers[:,0],y=centers[:,1],z=centers[:,2],mode='lines',line=dict(color='#713d12',width=3),name='Solver beam centroid lines')) fig.add_trace(go.Scatter3d(x=arms[:,0],y=arms[:,1],z=arms[:,2],mode='lines',line=dict(color='#555555',width=2,dash='dash'),name='System-node to centroid offsets')) - modules = {name: str(Path(importlib.import_module(name).__file__).resolve()) for name in ('anyfem.io.sesam','anysolver.sesam_fem.importer','anysolver.elements','anyfileio.sesam.document')} + modules = {name: str(Path(importlib.import_module(name).__file__).resolve()) for name in ('anyfem.io.sesam','anyfesolver.sesam_fem.importer','anyfesolver.elements','anyfileio.sesam.document')} checks_pass = all(a['web_perpendicular_to_plate'] and a['rectangular_flatbar_properties_match'] for a in audit) record = dict(source_fem=str(fem), source_sha256=hashlib.sha256(imported.source_contents).hexdigest(), route='anyfem.io.sesam.import_sesam(strict=True) -> imported.fe_model', loaded_modules=modules, shell_count=len(shells), beam_count=len(beams), diagnostics=[str(d) for d in imported.diagnostics], upright_flatbar_checks_pass=checks_pass, beams=audit, limitation='Import/orientation audit only; no numerical solve or result acceptance. Solid flatbars are a display reconstruction from effective beam axes and section dimensions. Shells displayed at their midsurfaces.') (output/'beam_audit.json').write_text(json.dumps(record,indent=2),encoding='utf-8') diff --git a/scripts/investigate_plate_edge_shear.py b/scripts/investigate_plate_edge_shear.py index e7a7f374d..63b8d3198 100644 --- a/scripts/investigate_plate_edge_shear.py +++ b/scripts/investigate_plate_edge_shear.py @@ -10,9 +10,9 @@ import argparse,hashlib,json,os,pathlib,platform,time,traceback import numpy as np from threadpoolctl import threadpool_info -from anysolver import FEModel,BoundaryCondition,solve_linear,solve_static_nonlinear -from anysolver.elements import create_shell_element -from anysolver.nonlinear_static import _assemble_nonlinear_system +from anyfesolver import FEModel,BoundaryCondition,solve_linear,solve_static_nonlinear +from anyfesolver.elements import create_shell_element +from anyfesolver.nonlinear_static import _assemble_nonlinear_system def plate(target,imperfect=False,divisions=2): nside=divisions+1 @@ -45,7 +45,7 @@ def investigate(mode,output,divisions=2,tangent_request="consistent",stability_c tangent=tangent_request if kinematics=='corotational' else 'auto' result={'mode':mode,'target':target,'kinematics':kinematics,'corotational_tangent':tangent,'fixture':{'mesh':[divisions,divisions],'length':1.,'thickness':.01,'E':210e9,'nu':.3,'left':'all six fixed','right':'uy only prescribed; other DOFs free','other_edges':'free','material':'ideal elastic, no yield limit','imperfection':'.001*sin(pi*x)^2*sin(pi*y)' if imperfect else None},'controls':{'num_steps':4,'max_iterations':25,'tolerance':1e-6,'control':'force','load_case':None,'stability_control':stability_control},'python':platform.python_version(),'numpy':np.__version__,'environment':{k:os.environ.get(k) for k in ['OMP_NUM_THREADS','OPENBLAS_NUM_THREADS','MKL_NUM_THREADS','NUMBA_NUM_THREADS']}} repo=pathlib.Path(__file__).resolve().parents[1] - paths=[pathlib.Path(__file__)]+[repo/'src/anysolver'/n for n in ['nonlinear_static.py','_plate_stability_continuation.py','corotational.py','elements.py','e4_pl_element.py','assembly.py']] + paths=[pathlib.Path(__file__)]+[repo/'src/anyfesolver'/n for n in ['nonlinear_static.py','_plate_stability_continuation.py','corotational.py','elements.py','e4_pl_element.py','assembly.py']] result['source_hashes']={str(p):hashlib.sha256(p.read_bytes()).hexdigest() for p in paths} def save():output.write_text(json.dumps(result,default=jsonable,indent=2)) events=[] @@ -96,7 +96,7 @@ def progress(event): result['full_current_position_moment_resultant']=(forces[:,3:]+np.cross(xyz,forces[:,:3])).sum(axis=0) result['full_moment_definition']='raw rotational force components plus current-position cross translational force' if tangent=='work_conjugate': - from anysolver.corotational import spatial_moment_from_rotation_covector + from anyfesolver.corotational import spatial_moment_from_rotation_covector moments=np.array([spatial_moment_from_rotation_covector(theta,p) for theta,p in zip(r.displacements.reshape(-1,6)[:,3:],forces[:,3:])]) result['full_spatial_moment_resultant']=(moments+np.cross(xyz,forces[:,:3])).sum(axis=0) result['support_moment_definition']='current-position cross support force + constrained rotational reactions; all constrained rotations zero' diff --git a/scripts/marine_linear_demo.py b/scripts/marine_linear_demo.py index 89b1953cf..2c6f022c4 100644 --- a/scripts/marine_linear_demo.py +++ b/scripts/marine_linear_demo.py @@ -1,6 +1,6 @@ """Deterministic two-body 4-DOF synthetic development example (NOT Capytaine). -Runs the experimental ``anysolver.marine_linear`` route on a fixed synthetic +Runs the experimental ``anyfesolver.marine_linear`` route on a fixed synthetic linear two-body model and prints the response summary, the force decomposition and a cancellation demonstration. This is a development example with hand-written synthetic matrices: it uses no Capytaine, ANYhydro @@ -15,8 +15,8 @@ import numpy as np -from anysolver.control import CancellationToken -from anysolver.marine_linear import ( +from anyfesolver.control import CancellationToken +from anyfesolver.marine_linear import ( MarineLinearSpec, exponential_radiation_kernel, solve_marine_linear, @@ -73,7 +73,7 @@ def main() -> int: spec = build_spec(dt, n_steps) result = solve_marine_linear(spec) - print("anysolver.marine_linear synthetic two-body development example") + print("anyfesolver.marine_linear synthetic two-body development example") print("development evidence only - no Capytaine data, no qualification") print(f"labels : {list(result.labels)}") print(f"dt / steps : {result.dt} / {result.n_steps}") diff --git a/scripts/measure_e4_pl_q1m_baseline.py b/scripts/measure_e4_pl_q1m_baseline.py index c704a2509..8a64df1b9 100644 --- a/scripts/measure_e4_pl_q1m_baseline.py +++ b/scripts/measure_e4_pl_q1m_baseline.py @@ -14,8 +14,8 @@ import numpy as np -from anysolver import FEModel, QualifiedE4PLShellElement, assemble_stiffness_matrix -from anysolver.elements import create_element +from anyfesolver import FEModel, QualifiedE4PLShellElement, assemble_stiffness_matrix +from anyfesolver.elements import create_element SCHEMA = "anysolver.s4.e4-pl-q1m-performance-observation-v1" diff --git a/scripts/probe_b3_ge_e4_pl_g0_b2_linear_flexibility.py b/scripts/probe_b3_ge_e4_pl_g0_b2_linear_flexibility.py index ebe239fa4..3b902d323 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_b2_linear_flexibility.py +++ b/scripts/probe_b3_ge_e4_pl_g0_b2_linear_flexibility.py @@ -8,8 +8,8 @@ import numpy as np -from anysolver.elements import BeamElement -from anysolver.fe_core import Material +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import Material def basic(length: float) -> np.ndarray: diff --git a/scripts/probe_b3_ge_e4_pl_g0_b2_scalar_floor.py b/scripts/probe_b3_ge_e4_pl_g0_b2_scalar_floor.py index 439e54139..ac97e031e 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_b2_scalar_floor.py +++ b/scripts/probe_b3_ge_e4_pl_g0_b2_scalar_floor.py @@ -9,8 +9,8 @@ import json import math -from anysolver.elements import BeamElement -from anysolver.fe_core import Material +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import Material def case(area: float, direction: str) -> dict: diff --git a/scripts/probe_b3_ge_e4_pl_g0_baseline.py b/scripts/probe_b3_ge_e4_pl_g0_baseline.py index 098d1e441..b7ff7a6e8 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_baseline.py +++ b/scripts/probe_b3_ge_e4_pl_g0_baseline.py @@ -23,13 +23,13 @@ def main() -> int: raise RuntimeError("installed baseline wheel SHA-256 mismatch") import numpy as np - import anysolver - from anysolver import b3_ge - from anysolver.boundary import BoundaryCondition - from anysolver.elements import ELEMENT_TYPES, QuadraticBeamElement, create_element + import anyfesolver + from anyfesolver import b3_ge + from anyfesolver.boundary import BoundaryCondition + from anyfesolver.elements import ELEMENT_TYPES, QuadraticBeamElement, create_element - origin = Path(anysolver.__file__).resolve(strict=True) - if not origin.is_relative_to(site) or version("ANYsolver") != "0.4.7": + origin = Path(anyfesolver.__file__).resolve(strict=True) + if not origin.is_relative_to(site) or version("ANYfeSolver") != "0.4.7": raise RuntimeError("baseline import must come from the isolated 0.4.7 wheel") if b3_ge.SELECTOR != "b3-ge" or "b3-ge" in ELEMENT_TYPES: raise RuntimeError("native B3-GE selector changed the legacy element registry") @@ -68,7 +68,7 @@ def main() -> int: "native_owner_identity": owner.identity, "admission_sha256": b3_ge.ADMISSION_SHA256, "versions": {name: version(name) for name in ( - "ANYsolver", "ANYmaterial", "ANYgeometry", "ANYmesher", + "ANYfeSolver", "ANYmaterial", "ANYgeometry", "ANYmesher", "ANYfileio", "numpy", "scipy", )}, "checks": ["installed_origin", "legacy_factory", "native_owner", "public_provenance"], diff --git a/scripts/probe_b3_ge_e4_pl_g0_calculix.py b/scripts/probe_b3_ge_e4_pl_g0_calculix.py index 833825494..998c103f2 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_calculix.py +++ b/scripts/probe_b3_ge_e4_pl_g0_calculix.py @@ -11,7 +11,7 @@ import json from pathlib import Path -from anysolver.external_references import ( +from anyfesolver.external_references import ( _pressure_plate_case, calculix_solver_provenance, run_calculix_reference_case, diff --git a/scripts/probe_b3_ge_e4_pl_g0_drill.py b/scripts/probe_b3_ge_e4_pl_g0_drill.py index 52866c578..8bef31b20 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_drill.py +++ b/scripts/probe_b3_ge_e4_pl_g0_drill.py @@ -6,8 +6,8 @@ import numpy as np -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEMesh, Material +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEMesh, Material def specimen(formulation: str, coordinates: tuple[tuple[float, ...], ...]) -> dict: diff --git a/scripts/probe_b3_ge_e4_pl_g0_f02_refinement.py b/scripts/probe_b3_ge_e4_pl_g0_f02_refinement.py index 986a6024a..7cc03c0f2 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f02_refinement.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f02_refinement.py @@ -8,8 +8,8 @@ from scipy import sparse from scipy.sparse.linalg import spsolve -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEMesh, Material +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEMesh, Material def specimen(n: int, topology: str, thickness: float) -> dict: diff --git a/scripts/probe_b3_ge_e4_pl_g0_f03_broken_trace_v1.py b/scripts/probe_b3_ge_e4_pl_g0_f03_broken_trace_v1.py index 94879d257..733f97641 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f03_broken_trace_v1.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f03_broken_trace_v1.py @@ -13,7 +13,7 @@ raise RuntimeError('set a writable NUMBA_CACHE_DIR before source import') sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'src')) -import anysolver +import anyfesolver import numba import numpy as np import scipy @@ -144,7 +144,7 @@ def main(): for name in names} manifest={'purpose':'EXPLORATORY_BROKEN_TRACE_NOT_F03_ACCEPTANCE', 'cases':CASES,'source_sha256':hashes, - 'import':str(Path(anysolver.__file__).resolve()), + 'import':str(Path(anyfesolver.__file__).resolve()), 'python':sys.version,'numpy':np.__version__,'scipy':scipy.__version__, 'numba':numba.__version__,'cache':os.environ['NUMBA_CACHE_DIR'], 'blas_threads':1,'max_dense_primal_rows':1200, diff --git a/scripts/probe_b3_ge_e4_pl_g0_f03_independent_membrane.py b/scripts/probe_b3_ge_e4_pl_g0_f03_independent_membrane.py index 282a0a8c0..2a9de8427 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f03_independent_membrane.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f03_independent_membrane.py @@ -11,8 +11,8 @@ from scipy import sparse from scipy.sparse.linalg import spsolve -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEMesh, Material +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEMesh, Material from _b3_e4_f03_shell_trace import make_shell diff --git a/scripts/probe_b3_ge_e4_pl_g0_f03_local_dual_v1.py b/scripts/probe_b3_ge_e4_pl_g0_f03_local_dual_v1.py index 9f1fc267d..524aed567 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f03_local_dual_v1.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f03_local_dual_v1.py @@ -19,7 +19,7 @@ raise RuntimeError('set an explicit writable NUMBA_CACHE_DIR before import') sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'src')) -import anysolver +import anyfesolver import numpy as np import scipy import numba @@ -183,7 +183,7 @@ def main(): 'probe_b3_ge_e4_pl_g0_f03_k2p.py')} (args.root/'manifest.json').write_text(json.dumps( {'purpose':'UNREGISTERED_LOCAL_DUAL_FALSIFICATION', 'cases':CASES, - 'source_sha256':source, 'anysolver_import':str(Path(anysolver.__file__).resolve()), + 'source_sha256':source, 'anyfesolver_import':str(Path(anyfesolver.__file__).resolve()), 'python':sys.version, 'numpy':np.__version__, 'scipy':scipy.__version__, 'numba':numba.__version__, 'numba_cache_directory':os.environ['NUMBA_CACHE_DIR']}, diff --git a/scripts/probe_b3_ge_e4_pl_g0_f03_macro_yaw_v1.py b/scripts/probe_b3_ge_e4_pl_g0_f03_macro_yaw_v1.py index 19ab197bb..73fc7e809 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f03_macro_yaw_v1.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f03_macro_yaw_v1.py @@ -15,7 +15,7 @@ raise RuntimeError('set an explicit writable NUMBA_CACHE_DIR before import') sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'src')) -import anysolver +import anyfesolver import numba import numpy as np import scipy @@ -280,7 +280,7 @@ def main(): for name in names} manifest={'purpose':'EXPLORATORY_DISTINCT_LOCAL_YAW_SPAN_NOT_F03_ACCEPTANCE', 'cases':CASES,'spaces':('k4','macro-yaw'), - 'source_sha256':hashes,'anysolver_import':str(Path(anysolver.__file__).resolve()), + 'source_sha256':hashes,'anyfesolver_import':str(Path(anyfesolver.__file__).resolve()), 'python':sys.version,'numpy':np.__version__,'scipy':scipy.__version__, 'numba':numba.__version__,'cache':os.environ['NUMBA_CACHE_DIR'], 'blas_threads':1,'max_dense_kkt_rows':1200, diff --git a/scripts/probe_b3_ge_e4_pl_g0_f03_signed_norm_v1.py b/scripts/probe_b3_ge_e4_pl_g0_f03_signed_norm_v1.py index e18432597..c7f8f147e 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f03_signed_norm_v1.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f03_signed_norm_v1.py @@ -17,7 +17,7 @@ raise RuntimeError('set an explicit writable NUMBA_CACHE_DIR before import') sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'src')) -import anysolver +import anyfesolver import numba import numpy as np import scipy @@ -149,7 +149,7 @@ def main(): for name in sources} manifest={'purpose':'EXPLORATORY_SIGNED_RETAINED_NORM_NOT_F03_ACCEPTANCE', 'cases':CASES,'spaces':('k4','local-dual'),'source_sha256':hashes, - 'anysolver_import':str(Path(anysolver.__file__).resolve()), + 'anyfesolver_import':str(Path(anyfesolver.__file__).resolve()), 'python':sys.version,'numpy':np.__version__,'scipy':scipy.__version__, 'numba':numba.__version__,'cache':os.environ['NUMBA_CACHE_DIR'], 'blas_threads':1,'max_dense_kkt_rows':1200, diff --git a/scripts/probe_b3_ge_e4_pl_g0_f03_trace_dual_v1.py b/scripts/probe_b3_ge_e4_pl_g0_f03_trace_dual_v1.py index aeb7d7b79..5e871e10f 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f03_trace_dual_v1.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f03_trace_dual_v1.py @@ -13,7 +13,7 @@ raise RuntimeError('set a writable NUMBA_CACHE_DIR before source import') sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'src')) -import anysolver +import anyfesolver import numba import numpy as np import scipy @@ -157,7 +157,7 @@ def main(): for name in names} manifest={'purpose':'RESTRICTED_TRACE_DUAL_EXPLORATION_NOT_F03_ACCEPTANCE', 'cases':CASES,'spaces':('k4','local-dual'),'cutoffs':CUTOFFS, - 'source_sha256':hashes,'import':str(Path(anysolver.__file__).resolve()), + 'source_sha256':hashes,'import':str(Path(anyfesolver.__file__).resolve()), 'python':sys.version,'numpy':np.__version__,'scipy':scipy.__version__, 'numba':numba.__version__,'cache':os.environ['NUMBA_CACHE_DIR'], 'blas_threads':1,'max_dense_kkt_rows':1200, diff --git a/scripts/probe_b3_ge_e4_pl_g0_f03_weak_mode_v1.py b/scripts/probe_b3_ge_e4_pl_g0_f03_weak_mode_v1.py index 7cd8d3218..a50588626 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f03_weak_mode_v1.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f03_weak_mode_v1.py @@ -13,7 +13,7 @@ raise RuntimeError('set an explicit writable NUMBA_CACHE_DIR before import') sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'src')) -import anysolver +import anyfesolver import numba import numpy as np import scipy @@ -29,7 +29,7 @@ from probe_b3_ge_e4_pl_g0_f03_trace_dual_v1 import dual_gram,primal_factors -PREDECESSOR=Path('C:/Github/ANYsolver/.qualification/b3-ge-e4-pl/f03-trace-dual-v1') +PREDECESSOR=Path('C:/Github/ANYfeSolver/.qualification/b3-ge-e4-pl/f03-trace-dual-v1') PREDECESSOR_SHA={ 'manifest.json':'ea783b9f4df3d89c94d01564c4799fb9e5414f4eb29b2c351381764acd0e59ec', 'results.jsonl':'c2a54018fe6a81e151066610dc0f1ba5a855dfc4c99a4e473c62c65487b784dc', @@ -213,7 +213,7 @@ def main(): for name in names} manifest={'purpose':'EXPLORATORY_SIGNED_WEAK_MODE_NOT_F03_ACCEPTANCE', 'cases':CASES,'spaces':('k4','local-dual'), - 'source_sha256':hashes,'anysolver_import':str(Path(anysolver.__file__).resolve()), + 'source_sha256':hashes,'anyfesolver_import':str(Path(anyfesolver.__file__).resolve()), 'python':sys.version,'numpy':np.__version__,'scipy':scipy.__version__, 'numba':numba.__version__,'cache':os.environ['NUMBA_CACHE_DIR'], 'blas_threads':1,'max_dense_kkt_rows':1200, diff --git a/scripts/probe_b3_ge_e4_pl_g0_f05_pose_pullback_dev_v2.py b/scripts/probe_b3_ge_e4_pl_g0_f05_pose_pullback_dev_v2.py index 984c64dda..bf4a7638d 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f05_pose_pullback_dev_v2.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f05_pose_pullback_dev_v2.py @@ -18,13 +18,13 @@ from scipy.spatial.transform import Rotation from threadpoolctl import threadpool_limits -import anysolver -from anysolver._ge_beam3_pose_joint import RigidPoseJoint -from anysolver._ge_beam3_variational_shell import deformation -from anysolver.e4_pl_s3_state import canonical_json_bytes -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEModel -from anysolver.material_curves import DNVC208MaterialCurve +import anyfesolver +from anyfesolver._ge_beam3_pose_joint import RigidPoseJoint +from anyfesolver._ge_beam3_variational_shell import deformation +from anyfesolver.e4_pl_s3_state import canonical_json_bytes +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.material_curves import DNVC208MaterialCurve REFERENCE = np.array(((0., 0., 0.), (1., 0., 0.), (1., 1., 0.), (0., 1., 0.))) @@ -226,9 +226,9 @@ def main(): 'material_curves.py', 'plasticity.py') manifest = dict(purpose='F05_DEV_Q4_POSE_NOT_G0B_ACCEPTANCE', source_sha256=hashlib.sha256(Path(__file__).read_bytes()).hexdigest(), - modules_sha256={name: hashlib.sha256((REPOSITORY/'src'/'anysolver'/name).read_bytes()).hexdigest() + modules_sha256={name: hashlib.sha256((REPOSITORY/'src'/'anyfesolver'/name).read_bytes()).hexdigest() for name in modules}, python=sys.version, numpy=np.__version__, - anysolver_import=str(Path(anysolver.__file__).resolve()), + anyfesolver_import=str(Path(anyfesolver.__file__).resolve()), numba_jit_disabled=os.environ.get('NUMBA_DISABLE_JIT') == '1', numba_cache=os.environ['NUMBA_CACHE_DIR'], steps=STEPS, tolerance=TOLERANCE, predecessor='Q4 v1 loaded sealed state') diff --git a/scripts/probe_b3_ge_e4_pl_g0_f05_q4_pullback_v1.py b/scripts/probe_b3_ge_e4_pl_g0_f05_q4_pullback_v1.py index 2dcf2459c..0f1e027cc 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f05_q4_pullback_v1.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f05_q4_pullback_v1.py @@ -14,17 +14,17 @@ raise RuntimeError('set an explicit writable NUMBA_CACHE_DIR before import') sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'src')) -import anysolver +import anyfesolver import numba import numpy as np import scipy from threadpoolctl import threadpool_limits -from anysolver._ge_beam3_variational_shell import deformation -from anysolver.e4_pl_s3_state import canonical_json_bytes -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEModel -from anysolver.material_curves import DNVC208MaterialCurve +from anyfesolver._ge_beam3_variational_shell import deformation +from anyfesolver.e4_pl_s3_state import canonical_json_bytes +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.material_curves import DNVC208MaterialCurve REFERENCE=np.array(((0.,0.,0.),(1.,0.,0.),(1.,1.,0.),(0.,1.,0.))) @@ -134,9 +134,9 @@ def main(): modules=('_ge_beam3_variational_shell.py','_ge_beam3_mixed_ad.py', '_ge_beam3_pose_joint.py','e4_pl_element.py','e4_pl_s3_state.py', 'elements.py','fe_core.py','material_curves.py','plasticity.py') - module_hashes={name:hashlib.sha256((repository/'src'/'anysolver'/name).read_bytes()).hexdigest() + module_hashes={name:hashlib.sha256((repository/'src'/'anyfesolver'/name).read_bytes()).hexdigest() for name in modules} - tracked=['scripts/'+Path(__file__).name]+['src/anysolver/'+name for name in modules] + tracked=['scripts/'+Path(__file__).name]+['src/anyfesolver/'+name for name in modules] dirty=subprocess.check_output(['git','status','--porcelain','--',*tracked], cwd=repository,text=True).strip() if dirty: @@ -144,7 +144,7 @@ def main(): manifest={'purpose':'F05_Q4_FIXED_PREDECESSOR_DIAGNOSTIC_NOT_G0B', 'source_sha256':hashlib.sha256(source).hexdigest(), 'source_commit':source_commit,'module_sha256':module_hashes, - 'anysolver_import':str(Path(anysolver.__file__).resolve()), + 'anyfesolver_import':str(Path(anyfesolver.__file__).resolve()), 'python':sys.version,'numpy':np.__version__,'scipy':scipy.__version__, 'numba':numba.__version__,'blas_threads':1, 'numba_cache':os.environ['NUMBA_CACHE_DIR'], diff --git a/scripts/probe_b3_ge_e4_pl_g0_f05_s3_branch_path_dev_v1.py b/scripts/probe_b3_ge_e4_pl_g0_f05_s3_branch_path_dev_v1.py index af377d6c1..047726a0b 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f05_s3_branch_path_dev_v1.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f05_s3_branch_path_dev_v1.py @@ -15,18 +15,18 @@ import scipy from probe_b3_ge_e4_pl_g0_f05_s3_pose_pullback_dev_v1 import _fixture, _material -from anysolver.e4_pl_s3_v2d_state import canonical_json_bytes +from anyfesolver.e4_pl_s3_v2d_state import canonical_json_bytes ROOT = Path(__file__).resolve().parents[1] SOURCE_PATHS = ( "scripts/probe_b3_ge_e4_pl_g0_f05_s3_branch_path_dev_v1.py", "scripts/probe_b3_ge_e4_pl_g0_f05_s3_pose_pullback_dev_v1.py", - "src/anysolver/e4_pl_s3_v2d_element.py", - "src/anysolver/e4_pl_s3_v2d_state.py", - "src/anysolver/plasticity.py", - "src/anysolver/material_curves.py", - "src/anysolver/_ge_beam3_variational_shell.py", + "src/anyfesolver/e4_pl_s3_v2d_element.py", + "src/anyfesolver/e4_pl_s3_v2d_state.py", + "src/anyfesolver/plasticity.py", + "src/anyfesolver/material_curves.py", + "src/anyfesolver/_ge_beam3_variational_shell.py", ) HALF_WIDTH = 2e-6 STEPS = (2e-6, 2e-7) diff --git a/scripts/probe_b3_ge_e4_pl_g0_f05_s3_pose_pullback_dev_v1.py b/scripts/probe_b3_ge_e4_pl_g0_f05_s3_pose_pullback_dev_v1.py index 827ba7d38..6709ea6f1 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f05_s3_pose_pullback_dev_v1.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f05_s3_pose_pullback_dev_v1.py @@ -14,12 +14,12 @@ import numpy as np from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_pose_joint import RigidPoseJoint -from anysolver._ge_beam3_variational_shell import deformation -from anysolver.e4_pl_s3_v2d_state import canonical_json_bytes -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEModel -from anysolver.material_curves import DNVC208MaterialCurve +from anyfesolver._ge_beam3_pose_joint import RigidPoseJoint +from anyfesolver._ge_beam3_variational_shell import deformation +from anyfesolver.e4_pl_s3_v2d_state import canonical_json_bytes +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.material_curves import DNVC208MaterialCurve REFERENCE = np.array(((0., 0., 0.), (1.2, .05, 0.), (.2, .95, 0.))) diff --git a/scripts/probe_b3_ge_e4_pl_g0_f06_beam_chart_dev_v1.py b/scripts/probe_b3_ge_e4_pl_g0_f06_beam_chart_dev_v1.py index 0ba1900af..807499337 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f06_beam_chart_dev_v1.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f06_beam_chart_dev_v1.py @@ -16,13 +16,13 @@ sys.path.insert(0, str(ROOT)) sys.path.insert(0, str(ROOT/'src')) -import anysolver +import anyfesolver import numpy as np from scipy.spatial.transform import Rotation from threadpoolctl import threadpool_limits -from anysolver._ge_beam3_pose_joint import _exp_terms -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_pose_joint import _exp_terms +from anyfesolver._ge_beam3_p5_seeded.core import canonical from scripts.probe_b3_ge_e4_pl_g0_f06_owned_rebase_v4 import OwnedRebasePrototype @@ -224,8 +224,8 @@ def main(): fixture_sha256={name: sha256((ROOT/'scripts'/name).read_bytes()).hexdigest() for name in ('probe_b3_ge_e4_pl_g0_f06_owned_rebase_v4.py', 'probe_b3_ge_e4_pl_g0_f06_loaded_rebase_v3.py')}, - module_sha256={name: sha256((ROOT/'src'/'anysolver'/name).read_bytes()).hexdigest() - for name in modules}, imported_package=str(Path(anysolver.__file__).resolve()), + module_sha256={name: sha256((ROOT/'src'/'anyfesolver'/name).read_bytes()).hexdigest() + for name in modules}, imported_package=str(Path(anyfesolver.__file__).resolve()), python=sys.version, numpy=np.__version__, numba_jit_disabled=os.environ.get('NUMBA_DISABLE_JIT') == '1', tolerance=TOLERANCE, floors=FLOORS) diff --git a/scripts/probe_b3_ge_e4_pl_g0_f06_beam_chart_v5.py b/scripts/probe_b3_ge_e4_pl_g0_f06_beam_chart_v5.py index b638122ab..a025cc831 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f06_beam_chart_v5.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f06_beam_chart_v5.py @@ -20,8 +20,8 @@ sys.path.insert(0, str(ROOT)) sys.path.insert(0, str(ROOT / "src")) -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_shell_joint_state import decode, decoded_array +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_shell_joint_state import decode, decoded_array from scripts.probe_b3_ge_e4_pl_g0_f06_owned_rebase_v4 import ( OwnedRebasePrototype, PrototypeRun, ) diff --git a/scripts/probe_b3_ge_e4_pl_g0_f06_loaded_rebase_v1.py b/scripts/probe_b3_ge_e4_pl_g0_f06_loaded_rebase_v1.py index fd7b85111..9796ea31d 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f06_loaded_rebase_v1.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f06_loaded_rebase_v1.py @@ -17,16 +17,16 @@ sys.path.insert(0,str(ROOT/'src')) sys.path.insert(0,str(ROOT/'tests')) -import anysolver +import anyfesolver import numba import numpy as np import scipy from threadpoolctl import threadpool_limits -from anysolver._ge_beam3_g3c_local_shell import deformation -from anysolver._ge_beam3_pose_joint import _exp_terms -from anysolver._ge_beam3_shell_joint_state import decode -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_g3c_local_shell import deformation +from anyfesolver._ge_beam3_pose_joint import _exp_terms +from anyfesolver._ge_beam3_shell_joint_state import decode +from anyfesolver._ge_beam3_p5_seeded.core import canonical from test_ge_beam3_coupled_modes import fixture @@ -174,10 +174,10 @@ def main(): commit=subprocess.check_output(['git','rev-parse','HEAD'],cwd=ROOT,text=True).strip() source=Path(__file__).read_bytes() tracked=('scripts/'+Path(__file__).name, - 'src/anysolver/_ge_beam3_g3c_local_shell.py', - 'src/anysolver/_ge_beam3_pose_joint.py', - 'src/anysolver/_ge_beam3_shell_joint_state.py', - 'src/anysolver/_ge_beam3_shell_joint_trial.py', + 'src/anyfesolver/_ge_beam3_g3c_local_shell.py', + 'src/anyfesolver/_ge_beam3_pose_joint.py', + 'src/anyfesolver/_ge_beam3_shell_joint_state.py', + 'src/anyfesolver/_ge_beam3_shell_joint_trial.py', 'tests/test_ge_beam3_coupled_modes.py', 'tests/test_ge_beam3_coupled_free_beam.py') dirty=subprocess.check_output(['git','status','--porcelain','--untracked-files=no'], @@ -188,7 +188,7 @@ def main(): 'tracked_sha256':hashes,'cases':CASES,'loaded_cursor':2, 'relative_tolerance':1e-9,'normalization_floor':1., 'numba_cache':os.environ['NUMBA_CACHE_DIR'],'blas_threads':1, - 'anysolver_import':str(Path(anysolver.__file__).resolve()), + 'anyfesolver_import':str(Path(anyfesolver.__file__).resolve()), 'python':sys.version,'numpy':np.__version__,'scipy':scipy.__version__, 'numba':numba.__version__,'scope':'BOUNDED_REPRESENTATION_NOT_CHECKPOINT_REBASE'} args.root.mkdir(parents=True,exist_ok=False) diff --git a/scripts/probe_b3_ge_e4_pl_g0_f06_loaded_rebase_v2.py b/scripts/probe_b3_ge_e4_pl_g0_f06_loaded_rebase_v2.py index 527a325f6..f2ce8e82b 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f06_loaded_rebase_v2.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f06_loaded_rebase_v2.py @@ -16,26 +16,26 @@ ROOT=Path(__file__).resolve().parents[1] sys.path.insert(0,str(ROOT/'src')) -import anysolver +import anyfesolver import numba import numpy as np import scipy from threadpoolctl import threadpool_limits -from anysolver._ge_beam3_g3c_local_shell import deformation -from anysolver._ge_beam3_pose_joint import _exp_terms -from anysolver._ge_beam3_coupled_beam_subdomain import CoupledBeamSubdomain -from anysolver._ge_beam3_shell_joint_trial import ShellBeamTrialAssembly -from anysolver._ge_beam3_shell_joint_state import CoupledShellBeamAnalysis -from anysolver._ge_beam3_retained_generalized_state import Program -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement -from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry -from anysolver._ge_beam3_shell_joint_state import decode -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver.fe_core import FEModel +from anyfesolver._ge_beam3_g3c_local_shell import deformation +from anyfesolver._ge_beam3_pose_joint import _exp_terms +from anyfesolver._ge_beam3_coupled_beam_subdomain import CoupledBeamSubdomain +from anyfesolver._ge_beam3_shell_joint_trial import ShellBeamTrialAssembly +from anyfesolver._ge_beam3_shell_joint_state import CoupledShellBeamAnalysis +from anyfesolver._ge_beam3_retained_generalized_state import Program +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement +from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry +from anyfesolver._ge_beam3_shell_joint_state import decode +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.fe_core import FEModel CASES=(('Q4',False),('Q4',True),('S3-V2D',False),('S3-V2D',True)) @@ -221,13 +221,13 @@ def main(): commit=subprocess.check_output(['git','rev-parse','HEAD'],cwd=ROOT,text=True).strip() source=Path(__file__).read_bytes() tracked=('scripts/'+Path(__file__).name, - 'src/anysolver/_ge_beam3_g3c_local_shell.py', - 'src/anysolver/_ge_beam3_pose_joint.py', - 'src/anysolver/_ge_beam3_shell_joint_state.py', - 'src/anysolver/_ge_beam3_shell_joint_trial.py', - 'src/anysolver/_ge_beam3_coupled_beam_subdomain.py', - 'src/anysolver/_ge_beam3_native_generalized_element.py', - 'src/anysolver/_ge_beam3_generalized_ellipsoid_section.py') + 'src/anyfesolver/_ge_beam3_g3c_local_shell.py', + 'src/anyfesolver/_ge_beam3_pose_joint.py', + 'src/anyfesolver/_ge_beam3_shell_joint_state.py', + 'src/anyfesolver/_ge_beam3_shell_joint_trial.py', + 'src/anyfesolver/_ge_beam3_coupled_beam_subdomain.py', + 'src/anyfesolver/_ge_beam3_native_generalized_element.py', + 'src/anyfesolver/_ge_beam3_generalized_ellipsoid_section.py') dirty=subprocess.check_output(['git','status','--porcelain','--untracked-files=no'], cwd=ROOT,text=True).strip() if dirty:raise RuntimeError('frozen F06 tracked source graph changed') @@ -236,7 +236,7 @@ def main(): 'tracked_sha256':hashes,'cases':CASES,'loaded_cursor':2, 'relative_tolerance':1e-9,'normalization_floor':1., 'numba_cache':os.environ['NUMBA_CACHE_DIR'],'blas_threads':1, - 'anysolver_import':str(Path(anysolver.__file__).resolve()), + 'anyfesolver_import':str(Path(anyfesolver.__file__).resolve()), 'python':sys.version,'numpy':np.__version__,'scipy':scipy.__version__, 'numba':numba.__version__,'scope':'BOUNDED_REPRESENTATION_NOT_CHECKPOINT_REBASE'} args.root.mkdir(parents=True,exist_ok=False) diff --git a/scripts/probe_b3_ge_e4_pl_g0_f06_loaded_rebase_v3.py b/scripts/probe_b3_ge_e4_pl_g0_f06_loaded_rebase_v3.py index 05959bbcb..6ff4f3ef5 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f06_loaded_rebase_v3.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f06_loaded_rebase_v3.py @@ -16,26 +16,26 @@ ROOT=Path(__file__).resolve().parents[1] sys.path.insert(0,str(ROOT/'src')) -import anysolver +import anyfesolver import numba import numpy as np import scipy from threadpoolctl import threadpool_limits -from anysolver._ge_beam3_g3c_local_shell import deformation -from anysolver._ge_beam3_pose_joint import _exp_terms -from anysolver._ge_beam3_coupled_beam_subdomain import CoupledBeamSubdomain -from anysolver._ge_beam3_shell_joint_trial import ShellBeamTrialAssembly -from anysolver._ge_beam3_shell_joint_state import CoupledShellBeamAnalysis -from anysolver._ge_beam3_retained_generalized_state import Program -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement -from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry -from anysolver._ge_beam3_shell_joint_state import decode -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver.fe_core import FEModel +from anyfesolver._ge_beam3_g3c_local_shell import deformation +from anyfesolver._ge_beam3_pose_joint import _exp_terms +from anyfesolver._ge_beam3_coupled_beam_subdomain import CoupledBeamSubdomain +from anyfesolver._ge_beam3_shell_joint_trial import ShellBeamTrialAssembly +from anyfesolver._ge_beam3_shell_joint_state import CoupledShellBeamAnalysis +from anyfesolver._ge_beam3_retained_generalized_state import Program +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement +from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry +from anyfesolver._ge_beam3_shell_joint_state import decode +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.fe_core import FEModel CASES=(('Q4',False),('Q4',True),('S3-V2D',False),('S3-V2D',True)) @@ -234,13 +234,13 @@ def main(): commit=subprocess.check_output(['git','rev-parse','HEAD'],cwd=ROOT,text=True).strip() source=Path(__file__).read_bytes() tracked=('scripts/'+Path(__file__).name, - 'src/anysolver/_ge_beam3_g3c_local_shell.py', - 'src/anysolver/_ge_beam3_pose_joint.py', - 'src/anysolver/_ge_beam3_shell_joint_state.py', - 'src/anysolver/_ge_beam3_shell_joint_trial.py', - 'src/anysolver/_ge_beam3_coupled_beam_subdomain.py', - 'src/anysolver/_ge_beam3_native_generalized_element.py', - 'src/anysolver/_ge_beam3_generalized_ellipsoid_section.py') + 'src/anyfesolver/_ge_beam3_g3c_local_shell.py', + 'src/anyfesolver/_ge_beam3_pose_joint.py', + 'src/anyfesolver/_ge_beam3_shell_joint_state.py', + 'src/anyfesolver/_ge_beam3_shell_joint_trial.py', + 'src/anyfesolver/_ge_beam3_coupled_beam_subdomain.py', + 'src/anyfesolver/_ge_beam3_native_generalized_element.py', + 'src/anyfesolver/_ge_beam3_generalized_ellipsoid_section.py') dirty=subprocess.check_output(['git','status','--porcelain','--untracked-files=no'], cwd=ROOT,text=True).strip() if dirty:raise RuntimeError('frozen F06 tracked source graph changed') @@ -249,7 +249,7 @@ def main(): 'tracked_sha256':hashes,'cases':CASES,'loaded_cursor':2, 'relative_tolerance':1e-9,'normalization_floor':1., 'numba_cache':os.environ['NUMBA_CACHE_DIR'],'blas_threads':1, - 'anysolver_import':str(Path(anysolver.__file__).resolve()), + 'anyfesolver_import':str(Path(anyfesolver.__file__).resolve()), 'python':sys.version,'numpy':np.__version__,'scipy':scipy.__version__, 'numba':numba.__version__,'scope':'BOUNDED_REPRESENTATION_V3_NOT_CHECKPOINT_REBASE'} args.root.mkdir(parents=True,exist_ok=False) diff --git a/scripts/probe_b3_ge_e4_pl_g0_f06_owned_rebase_v4.py b/scripts/probe_b3_ge_e4_pl_g0_f06_owned_rebase_v4.py index 70152c75d..31aba8dfa 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f06_owned_rebase_v4.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f06_owned_rebase_v4.py @@ -27,15 +27,15 @@ sys.path.insert(0, str(ROOT)) sys.path.insert(0, str(ROOT / "src")) -from anysolver.control import CancellationToken, SolveCancelled, cancellation_safe_point -from anysolver._ge_beam3_g3c_local_shell import deformation -from anysolver._ge_beam3_pose_joint import _exp_terms -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_shell_joint_state import ( +from anyfesolver.control import CancellationToken, SolveCancelled, cancellation_safe_point +from anyfesolver._ge_beam3_g3c_local_shell import deformation +from anyfesolver._ge_beam3_pose_joint import _exp_terms +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_shell_joint_state import ( CoupledShellBeamAnalysis, SCHEMA as LEGACY_SCHEMA, decode, decoded_array, ) -from anysolver._ge_beam3_shell_joint_trial import ShellBeamTrial -from anysolver._native_reference_modal import _owned +from anyfesolver._ge_beam3_shell_joint_trial import ShellBeamTrial +from anyfesolver._native_reference_modal import _owned from scripts.probe_b3_ge_e4_pl_g0_f06_loaded_rebase_v3 import fixture, shell_spatial @@ -1064,7 +1064,7 @@ def _fixed_reference_balance(owner, state, loaded, cursor): def _effective_environment(): """Observe the actual child process using the supervisor's field layout.""" import importlib.metadata - import anysolver + import anyfesolver import psutil import scipy import threadpoolctl @@ -1081,7 +1081,7 @@ def _effective_environment(): return dict(python_executable=str(Path(sys.executable).resolve()), python_version=sys.version.split()[0], numpy_version=np.__version__, scipy_version=scipy.__version__, - anysolver_import=str(Path(anysolver.__file__).resolve()), + anyfesolver_import=str(Path(anyfesolver.__file__).resolve()), psutil_version=psutil.__version__, threadpoolctl_version=threadpoolctl.__version__, pywin32_version=pywin32_version, @@ -1101,27 +1101,27 @@ def _pilot_sources(): "tests/test_b3_e4_f06_owned_rebase_v4.py", "docs/agent_plans/B3_GE_E4_PL_G0_F06_V4_SCIENTIFIC_CONTRACT_DRAFT.md", "scripts/probe_b3_ge_e4_pl_g0_f06_loaded_rebase_v3.py", - "src/anysolver/_ge_beam3_shell_joint_state.py", - "src/anysolver/_ge_beam3_shell_joint_trial.py", - "src/anysolver/_ge_beam3_g3c_local_shell.py", - "src/anysolver/_ge_beam3_coupled_beam_subdomain.py", - "src/anysolver/_ge_beam3_pose_joint.py", - "src/anysolver/_ge_beam3_retained_generalized.py", - "src/anysolver/_ge_beam3_retained_generalized_state.py", - "src/anysolver/_ge_beam3_retained_generalized_program.py", - "src/anysolver/_ge_beam3_native_generalized_element.py", - "src/anysolver/_ge_beam3_generalized_ellipsoid_section.py", - "src/anysolver/_ge_beam3_generalized_cell.py", - "src/anysolver/_ge_beam3_generalized_static_boundary.py", - "src/anysolver/_ge_beam3_p5/algebra.py", - "src/anysolver/_ge_beam3_p5_seeded/core.py", - "src/anysolver/e4_pl_s3_v2d_element.py", - "src/anysolver/control.py", - "src/anysolver/_native_reference_modal.py", - "src/anysolver/_ge_beam3_native_generalized_loading.py", - "src/anysolver/_ge_beam3_native_line_loading.py", - "src/anysolver/_ge_beam3_centered_reference.py", - "src/anysolver/fe_core.py") + "src/anyfesolver/_ge_beam3_shell_joint_state.py", + "src/anyfesolver/_ge_beam3_shell_joint_trial.py", + "src/anyfesolver/_ge_beam3_g3c_local_shell.py", + "src/anyfesolver/_ge_beam3_coupled_beam_subdomain.py", + "src/anyfesolver/_ge_beam3_pose_joint.py", + "src/anyfesolver/_ge_beam3_retained_generalized.py", + "src/anyfesolver/_ge_beam3_retained_generalized_state.py", + "src/anyfesolver/_ge_beam3_retained_generalized_program.py", + "src/anyfesolver/_ge_beam3_native_generalized_element.py", + "src/anyfesolver/_ge_beam3_generalized_ellipsoid_section.py", + "src/anyfesolver/_ge_beam3_generalized_cell.py", + "src/anyfesolver/_ge_beam3_generalized_static_boundary.py", + "src/anyfesolver/_ge_beam3_p5/algebra.py", + "src/anyfesolver/_ge_beam3_p5_seeded/core.py", + "src/anyfesolver/e4_pl_s3_v2d_element.py", + "src/anyfesolver/control.py", + "src/anyfesolver/_native_reference_modal.py", + "src/anyfesolver/_ge_beam3_native_generalized_loading.py", + "src/anyfesolver/_ge_beam3_native_line_loading.py", + "src/anyfesolver/_ge_beam3_centered_reference.py", + "src/anyfesolver/fe_core.py") return {name: _hash((ROOT/name).read_bytes()) for name in names} diff --git a/scripts/probe_b3_ge_e4_pl_g0_f06_q4_owned_rebase_v1.py b/scripts/probe_b3_ge_e4_pl_g0_f06_q4_owned_rebase_v1.py index f8f8d41a6..06ceac844 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f06_q4_owned_rebase_v1.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f06_q4_owned_rebase_v1.py @@ -14,12 +14,12 @@ import numpy as np -from anysolver.control import cancellation_safe_point -from anysolver._ge_beam3_g3c_local_shell import deformation -from anysolver._ge_beam3_pose_joint import _exp_terms -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_shell_joint_state import CoupledShellBeamAnalysis, decode -from anysolver._native_reference_modal import _owned +from anyfesolver.control import cancellation_safe_point +from anyfesolver._ge_beam3_g3c_local_shell import deformation +from anyfesolver._ge_beam3_pose_joint import _exp_terms +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_shell_joint_state import CoupledShellBeamAnalysis, decode +from anyfesolver._native_reference_modal import _owned from scripts.probe_b3_ge_e4_pl_g0_f06_loaded_rebase_v3 import ( fixture, numeric_state, shell_spatial, diff --git a/scripts/probe_b3_ge_e4_pl_g0_f09_graph.py b/scripts/probe_b3_ge_e4_pl_g0_f09_graph.py index d15f6bff8..e37b4787b 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f09_graph.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f09_graph.py @@ -10,7 +10,7 @@ from scipy import sparse from scipy.sparse.linalg import splu -from anysolver._b2_physical_flexibility_linear import LinearOperator, LinearSection +from anyfesolver._b2_physical_flexibility_linear import LinearOperator, LinearSection def screen(members: int, area: float) -> dict: diff --git a/scripts/probe_b3_ge_e4_pl_g0_f09_graph_reversal.py b/scripts/probe_b3_ge_e4_pl_g0_f09_graph_reversal.py index e2c70d696..6b64f9afe 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f09_graph_reversal.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f09_graph_reversal.py @@ -19,23 +19,23 @@ ROOT = Path(__file__).resolve().parents[1] -SRC = ROOT / "src" / "anysolver" +SRC = ROOT / "src" / "anyfesolver" if __name__ != "__main__": - import anysolver -if "anysolver" not in sys.modules: - package = types.ModuleType("anysolver") + import anyfesolver +if "anyfesolver" not in sys.modules: + package = types.ModuleType("anyfesolver") package.__path__ = [str(SRC)] - sys.modules["anysolver"] = package + sys.modules["anyfesolver"] = package for name in ("_b2_physical_flexibility_linear", "_b2_physical_linear_definition"): - qualified = f"anysolver.{name}" + qualified = f"anyfesolver.{name}" if qualified not in sys.modules: spec = importlib.util.spec_from_file_location(qualified, SRC / f"{name}.py") module = importlib.util.module_from_spec(spec) sys.modules[qualified] = module spec.loader.exec_module(module) -from anysolver._b2_physical_flexibility_linear import LinearSection -from anysolver._b2_physical_linear_definition import PhysicalB2Member +from anyfesolver._b2_physical_flexibility_linear import LinearSection +from anyfesolver._b2_physical_linear_definition import PhysicalB2Member POINTS = ((0., 0., 0.), (2., 0., 0.), (2., 1.5, 0.)) diff --git a/scripts/probe_b3_ge_e4_pl_g0_f09_mixed_elbow_conditioning.py b/scripts/probe_b3_ge_e4_pl_g0_f09_mixed_elbow_conditioning.py index 296733379..0b9283c85 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f09_mixed_elbow_conditioning.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f09_mixed_elbow_conditioning.py @@ -14,8 +14,8 @@ from scipy import sparse from scipy.sparse.linalg import splu -from anysolver._b2_physical_flexibility_linear import LinearSection -from anysolver._b2_physical_linear_definition import PhysicalB2Member +from anyfesolver._b2_physical_flexibility_linear import LinearSection +from anyfesolver._b2_physical_linear_definition import PhysicalB2Member AREA = 2.0 ** -80 diff --git a/scripts/probe_b3_ge_e4_pl_g0_f09_mixed_graph.py b/scripts/probe_b3_ge_e4_pl_g0_f09_mixed_graph.py index 8da7d3d4d..4613e5074 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f09_mixed_graph.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f09_mixed_graph.py @@ -18,9 +18,9 @@ from scipy import sparse from scipy.sparse.linalg import splu -# The private module is self-contained. Avoid importing the whole ANYsolver +# The private module is self-contained. Avoid importing the whole ANYfeSolver # package merely to run a local conditioning diagnostic. -_module_path = (Path(__file__).resolve().parents[1] / "src" / "anysolver" +_module_path = (Path(__file__).resolve().parents[1] / "src" / "anyfesolver" / "_b2_physical_flexibility_linear.py") _spec = importlib.util.spec_from_file_location("_f09_mixed_graph_local_operator", _module_path) diff --git a/scripts/probe_b3_ge_e4_pl_g0_f09_physical_range.py b/scripts/probe_b3_ge_e4_pl_g0_f09_physical_range.py index a600f83d4..3a0115b9c 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f09_physical_range.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f09_physical_range.py @@ -24,22 +24,22 @@ # Load the two private owner modules without executing the unrelated package # initializer. This probe never substitutes an implementation for either. -_src = Path(__file__).resolve().parents[1] / "src" / "anysolver" +_src = Path(__file__).resolve().parents[1] / "src" / "anyfesolver" if __name__ == "__main__": - _package = types.ModuleType("anysolver") + _package = types.ModuleType("anyfesolver") _package.__path__ = [str(_src)] - sys.modules["anysolver"] = _package + sys.modules["anyfesolver"] = _package for _name in ("_b2_physical_flexibility_linear", "_b2_physical_linear_definition"): - _spec = importlib.util.spec_from_file_location(f"anysolver.{_name}", + _spec = importlib.util.spec_from_file_location(f"anyfesolver.{_name}", _src / f"{_name}.py") assert _spec is not None and _spec.loader is not None _module = importlib.util.module_from_spec(_spec) sys.modules[_spec.name] = _module _spec.loader.exec_module(_module) else: - import anysolver + import anyfesolver -from anysolver._b2_physical_flexibility_linear import LinearSection +from anyfesolver._b2_physical_flexibility_linear import LinearSection _elbow_spec = importlib.util.spec_from_file_location( "_f09_elbow", Path(__file__).with_name( "probe_b3_ge_e4_pl_g0_f09_mixed_elbow_conditioning.py")) diff --git a/scripts/probe_b3_ge_e4_pl_g0_f09_scaled_sparse.py b/scripts/probe_b3_ge_e4_pl_g0_f09_scaled_sparse.py index 036a49abb..401c780ee 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f09_scaled_sparse.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f09_scaled_sparse.py @@ -12,7 +12,7 @@ from scipy import sparse from scipy.sparse.linalg import splu -from anysolver._b2_physical_flexibility_linear import LinearSection +from anyfesolver._b2_physical_flexibility_linear import LinearSection from scripts import probe_b3_ge_e4_pl_g0_f09_mixed_elbow_conditioning as elbow diff --git a/scripts/probe_b3_ge_e4_pl_g0_f12_b2_dynamic_mass.py b/scripts/probe_b3_ge_e4_pl_g0_f12_b2_dynamic_mass.py index a3d5b7cd8..5348168d8 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f12_b2_dynamic_mass.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f12_b2_dynamic_mass.py @@ -20,8 +20,8 @@ from scipy import linalg, sparse from threadpoolctl import threadpool_info, threadpool_limits -from anysolver._b2_physical_flexibility_linear import LinearSection -from anysolver._b2_physical_linear_definition import MassMetadata, PhysicalB2Member +from anyfesolver._b2_physical_flexibility_linear import LinearSection +from anyfesolver._b2_physical_linear_definition import MassMetadata, PhysicalB2Member LENGTH = 2.0 @@ -142,8 +142,8 @@ def evaluate(): c["stiffness_symmetry_relative"] < 1e-12 for c in cases) and cases[-1]["nodal_z_mode_error"] < 1e-3) sources = [Path(__file__), - Path("src/anysolver/_b2_physical_flexibility_linear.py"), - Path("src/anysolver/_b2_physical_linear_definition.py")] + Path("src/anyfesolver/_b2_physical_flexibility_linear.py"), + Path("src/anyfesolver/_b2_physical_linear_definition.py")] return {"classification": "bounded F12 dynamic interpolation screen, not spectral admission", "question": "Does the physical B2 static station trace yield a convergent deformational mass interpolation on a slender cantilever?", "geometry": {"length_m": LENGTH, "width_m": WIDTH, diff --git a/scripts/probe_b3_ge_e4_pl_g0_f12_b2_dynamic_mass_v2.py b/scripts/probe_b3_ge_e4_pl_g0_f12_b2_dynamic_mass_v2.py index 10e91d9a9..b6c3a464a 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f12_b2_dynamic_mass_v2.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f12_b2_dynamic_mass_v2.py @@ -77,8 +77,8 @@ def evaluate(): all(c["scaled_eigen_equation_residual"] < 1e-8 and c["minimum_reduced_mass_eigenvalue"] > 0 for c in cases)) sources = [Path(__file__), Path(previous.__file__), - Path("src/anysolver/_b2_physical_flexibility_linear.py"), - Path("src/anysolver/_b2_physical_linear_definition.py")] + Path("src/anyfesolver/_b2_physical_flexibility_linear.py"), + Path("src/anyfesolver/_b2_physical_linear_definition.py")] return {"classification": "bounded F12 matched-continuum dynamic interpolation screen, not B2 spectral admission", "question": "Does the static-trace B2 mass converge to a separately assembled continuum Timoshenko mode rather than the shear-free EB asymptote?", "ritz": reference, "ritz_order_8_to_10_relative_change": reference_delta, diff --git a/scripts/probe_b3_ge_e4_pl_g0_f12_b2_dynamic_mass_v3.py b/scripts/probe_b3_ge_e4_pl_g0_f12_b2_dynamic_mass_v3.py index 29801b0c7..92ff1c5d7 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f12_b2_dynamic_mass_v3.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f12_b2_dynamic_mass_v3.py @@ -131,8 +131,8 @@ def evaluate(): all(c["scaled_eigen_equation_residual"] < 1e-8 and c["minimum_reduced_mass_eigenvalue"] > 0 for c in cases)) sources = [Path(__file__), Path(previous.__file__), - Path("src/anysolver/_b2_physical_flexibility_linear.py"), - Path("src/anysolver/_b2_physical_linear_definition.py")] + Path("src/anyfesolver/_b2_physical_flexibility_linear.py"), + Path("src/anyfesolver/_b2_physical_linear_definition.py")] return {"classification": "bounded F12 high-precision continuum comparison, not spectral admission", "question": "Does the B2 static-trace mass converge to a separately derived Timoshenko continuum frequency?", "reference_method": "60-digit Decimal conforming monomial w/theta Ritz energies and inverse iteration", diff --git a/scripts/probe_b3_ge_e4_pl_g0_f12_b2_dynamic_mass_v4.py b/scripts/probe_b3_ge_e4_pl_g0_f12_b2_dynamic_mass_v4.py index d835b9fa1..a2fb4254e 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f12_b2_dynamic_mass_v4.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f12_b2_dynamic_mass_v4.py @@ -137,8 +137,8 @@ def evaluate(): all(c["scaled_eigen_equation_residual"] < 1e-8 and c["minimum_reduced_mass_eigenvalue"] > 0 for c in cases)) sources = [Path(__file__), Path(previous.__file__), - Path("src/anysolver/_b2_physical_flexibility_linear.py"), - Path("src/anysolver/_b2_physical_linear_definition.py")] + Path("src/anyfesolver/_b2_physical_flexibility_linear.py"), + Path("src/anyfesolver/_b2_physical_linear_definition.py")] return {"classification": "bounded F12 high-precision continuum comparison, not spectral admission", "question": "Does the B2 static-trace mass converge to a separately derived Timoshenko continuum frequency?", "reference_method": "60-digit Decimal conforming monomial w/theta Ritz energies and inverse iteration", diff --git a/scripts/probe_b3_ge_e4_pl_g0_f12_b2_mass_metadata.py b/scripts/probe_b3_ge_e4_pl_g0_f12_b2_mass_metadata.py index a111e1e3c..fabccab2c 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f12_b2_mass_metadata.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f12_b2_mass_metadata.py @@ -12,8 +12,8 @@ import numpy as np -from anysolver._b2_physical_flexibility_linear import LinearSection -from anysolver._b2_physical_linear_definition import MassMetadata, PhysicalB2Member +from anyfesolver._b2_physical_flexibility_linear import LinearSection +from anyfesolver._b2_physical_linear_definition import MassMetadata, PhysicalB2Member def _skew(x): @@ -96,7 +96,7 @@ def evaluate(): p["translation_rotation_coupling_norm"] > 0 for p in probes) source = Path(__file__) - definition = Path("src/anysolver/_b2_physical_linear_definition.py") + definition = Path("src/anyfesolver/_b2_physical_linear_definition.py") return { "classification": "bounded F12 physical metadata feasibility; not mass or spectral admission", "question": "Can eccentric-section inertia at the beam reference axis retain direct particle kinetic work under frame rotation and reversal?", diff --git a/scripts/probe_b3_ge_e4_pl_g0_f12_b2_rigid_mass.py b/scripts/probe_b3_ge_e4_pl_g0_f12_b2_rigid_mass.py index 0fdcf0511..28ac72c5b 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_f12_b2_rigid_mass.py +++ b/scripts/probe_b3_ge_e4_pl_g0_f12_b2_rigid_mass.py @@ -13,8 +13,8 @@ import numpy as np -from anysolver._b2_physical_flexibility_linear import LinearSection -from anysolver._b2_physical_linear_definition import MassMetadata, PhysicalB2Member +from anyfesolver._b2_physical_flexibility_linear import LinearSection +from anyfesolver._b2_physical_linear_definition import MassMetadata, PhysicalB2Member LENGTH = 2. diff --git a/scripts/probe_b3_ge_e4_pl_g0_footprint.py b/scripts/probe_b3_ge_e4_pl_g0_footprint.py index 0ad0b6189..bc1e424d3 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_footprint.py +++ b/scripts/probe_b3_ge_e4_pl_g0_footprint.py @@ -8,8 +8,8 @@ from scipy import sparse from scipy.sparse.linalg import spsolve -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEMesh, Material +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEMesh, Material def specimen(n: int, topology: str) -> dict: diff --git a/scripts/probe_b3_ge_e4_pl_g0_footprint_distinction.py b/scripts/probe_b3_ge_e4_pl_g0_footprint_distinction.py index c642038a5..ef80019b5 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_footprint_distinction.py +++ b/scripts/probe_b3_ge_e4_pl_g0_footprint_distinction.py @@ -8,8 +8,8 @@ from scipy import sparse from scipy.sparse.linalg import spsolve -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEMesh, Material +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEMesh, Material def case(n: int, topology: str) -> dict: diff --git a/scripts/probe_b3_ge_e4_pl_g0_lifted_trace.py b/scripts/probe_b3_ge_e4_pl_g0_lifted_trace.py index 25e08ac27..6985924ea 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_lifted_trace.py +++ b/scripts/probe_b3_ge_e4_pl_g0_lifted_trace.py @@ -11,7 +11,7 @@ sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "tests")) -from anysolver._ge_beam3_fibre_line_work import evaluate as native_work +from anyfesolver._ge_beam3_fibre_line_work import evaluate as native_work from test_ge_beam3_generalized_slenderness_diagnostic import make diff --git a/scripts/probe_b3_ge_e4_pl_g0_lifted_trace_v2.py b/scripts/probe_b3_ge_e4_pl_g0_lifted_trace_v2.py index ddc34e907..04a87bb61 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_lifted_trace_v2.py +++ b/scripts/probe_b3_ge_e4_pl_g0_lifted_trace_v2.py @@ -7,7 +7,7 @@ import numpy as np import probe_b3_ge_e4_pl_g0_lifted_trace as prior -from anysolver._ge_beam3_p5.compensated_coordinates import split_sum, validate_pair +from anyfesolver._ge_beam3_p5.compensated_coordinates import split_sum, validate_pair original_native = prior.native_work diff --git a/scripts/probe_b3_ge_e4_pl_g0_local_sparse_deformed.py b/scripts/probe_b3_ge_e4_pl_g0_local_sparse_deformed.py index f5c9cfc95..1c6798949 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_local_sparse_deformed.py +++ b/scripts/probe_b3_ge_e4_pl_g0_local_sparse_deformed.py @@ -7,9 +7,9 @@ import numpy as np import probe_b3_ge_e4_pl_g0_local_sparse_seam as seam -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_retained_fibre_program import solve_force_program -from anysolver._ge_beam3_retained_generalized_program import solve +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_retained_fibre_program import solve_force_program +from anyfesolver._ge_beam3_retained_generalized_program import solve def case(kind): diff --git a/scripts/probe_b3_ge_e4_pl_g0_local_sparse_seam.py b/scripts/probe_b3_ge_e4_pl_g0_local_sparse_seam.py index 1416cfb0d..1143e27a1 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_local_sparse_seam.py +++ b/scripts/probe_b3_ge_e4_pl_g0_local_sparse_seam.py @@ -11,12 +11,12 @@ sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "tests")) -from anysolver._ge_beam3_fibre_line_work import evaluate as line_work -from anysolver._ge_beam3_generalized_static_boundary import cell_couple_load, spatial_jacobian -from anysolver._ge_beam3_operator_validation_scope import operator_call -from anysolver._ge_beam3_retained_fibre_state import Context as FibreContext -from anysolver._ge_beam3_retained_generalized_state import Context as GeneralizedContext, Program -from anysolver._ge_beam3_seeded_load_program import ForceProgram +from anyfesolver._ge_beam3_fibre_line_work import evaluate as line_work +from anyfesolver._ge_beam3_generalized_static_boundary import cell_couple_load, spatial_jacobian +from anyfesolver._ge_beam3_operator_validation_scope import operator_call +from anyfesolver._ge_beam3_retained_fibre_state import Context as FibreContext +from anyfesolver._ge_beam3_retained_generalized_state import Context as GeneralizedContext, Program +from anyfesolver._ge_beam3_seeded_load_program import ForceProgram from test_ge_beam3_native_generalized_restart import make as generalized_model, pattern from test_ge_beam3_retained_fibre import make_model as fibre_model diff --git a/scripts/probe_b3_ge_e4_pl_g0_local_sparse_seam_v2.py b/scripts/probe_b3_ge_e4_pl_g0_local_sparse_seam_v2.py index 64909d02e..1a48316ab 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_local_sparse_seam_v2.py +++ b/scripts/probe_b3_ge_e4_pl_g0_local_sparse_seam_v2.py @@ -7,7 +7,7 @@ import numpy as np import probe_b3_ge_e4_pl_g0_local_sparse_seam as v1 -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_p5_seeded.core import canonical original_check = v1.check diff --git a/scripts/probe_b3_ge_e4_pl_g0_physical_line.py b/scripts/probe_b3_ge_e4_pl_g0_physical_line.py index c9b414209..ce71163aa 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_physical_line.py +++ b/scripts/probe_b3_ge_e4_pl_g0_physical_line.py @@ -8,10 +8,10 @@ from scipy import sparse from scipy.sparse.linalg import spsolve -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEMesh, Material -from anysolver._ge_beam3_mixed_ad import so3_log, transpose -from anysolver._ge_beam3_variational_shell import rotation_jets +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEMesh, Material +from anyfesolver._ge_beam3_mixed_ad import so3_log, transpose +from anyfesolver._ge_beam3_variational_shell import rotation_jets def line_samples(): diff --git a/scripts/probe_b3_ge_e4_pl_g0_physical_line_offgrid.py b/scripts/probe_b3_ge_e4_pl_g0_physical_line_offgrid.py index efc586f49..83f7c3f19 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_physical_line_offgrid.py +++ b/scripts/probe_b3_ge_e4_pl_g0_physical_line_offgrid.py @@ -13,8 +13,8 @@ from scipy.sparse.linalg import spsolve import probe_b3_ge_e4_pl_g0_physical_line as prior -from anysolver._ge_beam3_mixed_ad import so3_log, transpose -from anysolver._ge_beam3_variational_shell import rotation_jets +from anyfesolver._ge_beam3_mixed_ad import so3_log, transpose +from anyfesolver._ge_beam3_variational_shell import rotation_jets START, END = -0.4, 0.4 diff --git a/scripts/probe_b3_ge_e4_pl_g0_plastic_pullback.py b/scripts/probe_b3_ge_e4_pl_g0_plastic_pullback.py index ed75db5a0..7762bf914 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_plastic_pullback.py +++ b/scripts/probe_b3_ge_e4_pl_g0_plastic_pullback.py @@ -6,11 +6,11 @@ import numpy as np -from anysolver._ge_beam3_variational_shell import deformation -from anysolver.e4_pl_s3_v2d_state import canonical_json_bytes -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEModel -from anysolver.material_curves import DNVC208MaterialCurve +from anyfesolver._ge_beam3_variational_shell import deformation +from anyfesolver.e4_pl_s3_v2d_state import canonical_json_bytes +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.material_curves import DNVC208MaterialCurve def main() -> int: diff --git a/scripts/probe_b3_ge_e4_pl_g0_pose_footprint.py b/scripts/probe_b3_ge_e4_pl_g0_pose_footprint.py index 60870b913..774004aec 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_pose_footprint.py +++ b/scripts/probe_b3_ge_e4_pl_g0_pose_footprint.py @@ -7,10 +7,10 @@ import numpy as np from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_mixed_ad import ( +from anyfesolver._ge_beam3_mixed_ad import ( Jet2, constant_matrix, matmul, matvec, so3_exp, so3_log, transpose, ) -from anysolver._ge_beam3_variational_shell import rotation_jets +from anyfesolver._ge_beam3_variational_shell import rotation_jets REF = np.array([[-.5, -.5, 0.], [.5, -.5, 0.], [.5, .5, 0.], [-.5, .5, 0.]]) diff --git a/scripts/probe_b3_ge_e4_pl_g0_pose_footprint_v2.py b/scripts/probe_b3_ge_e4_pl_g0_pose_footprint_v2.py index 23d6dec62..1f5ebd05f 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_pose_footprint_v2.py +++ b/scripts/probe_b3_ge_e4_pl_g0_pose_footprint_v2.py @@ -7,7 +7,7 @@ import numpy as np from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_pose_joint import _exp_terms +from anyfesolver._ge_beam3_pose_joint import _exp_terms import probe_b3_ge_e4_pl_g0_pose_footprint as prior diff --git a/scripts/probe_b3_ge_e4_pl_g0_rigid_footprint.py b/scripts/probe_b3_ge_e4_pl_g0_rigid_footprint.py index efb9ad383..ef8e95f5d 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_rigid_footprint.py +++ b/scripts/probe_b3_ge_e4_pl_g0_rigid_footprint.py @@ -7,7 +7,7 @@ import numpy as np from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_mixed_ad import Jet2, matvec, so3_exp, transpose +from anyfesolver._ge_beam3_mixed_ad import Jet2, matvec, so3_exp, transpose REF = np.array([[-.5, -.5, 0.], [.5, -.5, 0.], [.5, .5, 0.], [-.5, .5, 0.]]) diff --git a/scripts/probe_b3_ge_e4_pl_g0_scalar_mortar.py b/scripts/probe_b3_ge_e4_pl_g0_scalar_mortar.py index 0e0e37292..0b8420e0c 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_scalar_mortar.py +++ b/scripts/probe_b3_ge_e4_pl_g0_scalar_mortar.py @@ -9,7 +9,7 @@ import numpy as np from scipy import linalg -from anysolver.ge_beam3_curved_reference import p2_shape_functions +from anyfesolver.ge_beam3_curved_reference import p2_shape_functions def trace(s: float, beam_elements: int, shell_elements: int) -> tuple[np.ndarray, np.ndarray]: diff --git a/scripts/probe_b3_ge_e4_pl_g0_vector_station.py b/scripts/probe_b3_ge_e4_pl_g0_vector_station.py index 47b58d4d9..207d7b3a3 100644 --- a/scripts/probe_b3_ge_e4_pl_g0_vector_station.py +++ b/scripts/probe_b3_ge_e4_pl_g0_vector_station.py @@ -7,10 +7,10 @@ import numpy as np from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry -from anysolver._ge_beam3_mixed_ad import Jet2, constant_matrix, matmul, matvec, so3_exp, so3_log, transpose -from anysolver._ge_beam3_pose_joint import _exp_terms -from anysolver._ge_beam3_variational_shell import rotation_jets +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry +from anyfesolver._ge_beam3_mixed_ad import Jet2, constant_matrix, matmul, matvec, so3_exp, so3_log, transpose +from anyfesolver._ge_beam3_pose_joint import _exp_terms +from anyfesolver._ge_beam3_variational_shell import rotation_jets COUNT = 57 diff --git a/scripts/profile_nonlinear_representative.py b/scripts/profile_nonlinear_representative.py index b2b15b91e..dc2686b36 100644 --- a/scripts/profile_nonlinear_representative.py +++ b/scripts/profile_nonlinear_representative.py @@ -67,10 +67,10 @@ def main() -> int: args = parser.parse_args() sys.path.insert(0, str(args.site.resolve())) - import anysolver - from anysolver import nonlinear_static + import anyfesolver + from anyfesolver import nonlinear_static - imported = Path(anysolver.__file__).resolve() + imported = Path(anyfesolver.__file__).resolve() imported.relative_to(args.site.resolve()) campaign, campaign_runner_sha256, build_case_sha256 = ( _load_campaign_module( @@ -119,7 +119,7 @@ def main() -> int: } ) payload = { - "schema": "anysolver.nonlinear_static.representative_profile", + "schema": "anyfesolver.nonlinear_static.representative_profile", "version": 1, "case": args.case, "status": str(result.status), @@ -131,8 +131,8 @@ def main() -> int: "profile_total_seconds": float(stats.total_tt), "profile": str(args.profile.resolve()), "identity": { - "anysolver_module": str(imported), - "anysolver_version": importlib.metadata.version("anysolver"), + "anyfesolver_module": str(imported), + "anyfesolver_version": importlib.metadata.version("anyfesolver"), "manifest_sha256": campaign._sha256(args.manifest), "candidate_revision": provenance["candidate_revision"], "candidate_wheel_sha256": provenance["candidate_wheel_sha256"], diff --git a/scripts/qualify_general_contact_d1_clipped_coupled.py b/scripts/qualify_general_contact_d1_clipped_coupled.py index ccf326e02..bd5c25851 100644 --- a/scripts/qualify_general_contact_d1_clipped_coupled.py +++ b/scripts/qualify_general_contact_d1_clipped_coupled.py @@ -12,7 +12,7 @@ import time import anymaterial -import anysolver +import anyfesolver import numpy as np import scipy @@ -79,9 +79,9 @@ def main() -> int: identity_checks["scipy"] = ( scipy.__version__ == contract["environment"]["scipy"] ) - identity_checks["anysolver_module"] = ( - Path(anysolver.__file__).resolve() - == (ROOT / "src" / "anysolver" / "__init__.py").resolve() + identity_checks["anyfesolver_module"] = ( + Path(anyfesolver.__file__).resolve() + == (ROOT / "src" / "anyfesolver" / "__init__.py").resolve() ) identity_checks["anymaterial_module"] = ( Path(anymaterial.__file__).resolve() @@ -186,7 +186,7 @@ def main() -> int: "python": sys.version.split()[0], "numpy": np.__version__, "scipy": scipy.__version__, - "anysolver_module": str(Path(anysolver.__file__).resolve()), + "anyfesolver_module": str(Path(anyfesolver.__file__).resolve()), "anymaterial_module": str(Path(anymaterial.__file__).resolve()), }, } diff --git a/scripts/qualify_general_contact_d1_linear_coupled.py b/scripts/qualify_general_contact_d1_linear_coupled.py index 902a26f0b..223eb935f 100644 --- a/scripts/qualify_general_contact_d1_linear_coupled.py +++ b/scripts/qualify_general_contact_d1_linear_coupled.py @@ -12,7 +12,7 @@ import time import anymaterial -import anysolver +import anyfesolver import numpy as np import scipy @@ -69,9 +69,9 @@ def main() -> int: identity_checks["scipy"] = ( scipy.__version__ == contract["environment"]["scipy"] ) - identity_checks["anysolver_module"] = ( - Path(anysolver.__file__).resolve() - == (ROOT / "src" / "anysolver" / "__init__.py").resolve() + identity_checks["anyfesolver_module"] = ( + Path(anyfesolver.__file__).resolve() + == (ROOT / "src" / "anyfesolver" / "__init__.py").resolve() ) identity_checks["anymaterial_module"] = ( Path(anymaterial.__file__).resolve() @@ -147,7 +147,7 @@ def main() -> int: "python": sys.version.split()[0], "numpy": np.__version__, "scipy": scipy.__version__, - "anysolver_module": str(Path(anysolver.__file__).resolve()), + "anyfesolver_module": str(Path(anyfesolver.__file__).resolve()), "anymaterial_module": str(Path(anymaterial.__file__).resolve()), }, } diff --git a/scripts/qualify_nonlinear_representative.py b/scripts/qualify_nonlinear_representative.py index f228f6723..deee1311d 100644 --- a/scripts/qualify_nonlinear_representative.py +++ b/scripts/qualify_nonlinear_representative.py @@ -48,13 +48,13 @@ def _json_digest(value: Any) -> str: def _build_case(spec: Mapping[str, Any], method: str): import numpy as np - from anysolver.boundary import BoundaryCondition, FixedSupport, LoadCase - from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement - from anysolver.elements import BeamElement, create_shell_element - from anysolver.fe_core import FEModel - from anysolver.material_curves import LinearHardeningCurve - from anysolver.mesh_gen import generate_simple_panel_mesh - from anysolver.nonlinear_static import NonlinearLoadProgram, NonlinearLoadStage + from anyfesolver.boundary import BoundaryCondition, FixedSupport, LoadCase + from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement + from anyfesolver.elements import BeamElement, create_shell_element + from anyfesolver.fe_core import FEModel + from anyfesolver.material_curves import LinearHardeningCurve + from anyfesolver.mesh_gen import generate_simple_panel_mesh + from anyfesolver.nonlinear_static import NonlinearLoadProgram, NonlinearLoadStage builder = str(spec["builder"]) options: dict[str, Any] = { @@ -468,9 +468,9 @@ def _worker_sample(site: Path, spec: Mapping[str, Any], method: str) -> dict[str import importlib.metadata import numpy as np - import anysolver - from anysolver import nonlinear_static - from anysolver.nonlinear_performance_bootstrap import nonlinear_performance_status + import anyfesolver + from anyfesolver import nonlinear_static + from anyfesolver.nonlinear_performance_bootstrap import nonlinear_performance_status nonlinear_static._ensure_nonlinear_acceleration() original_assemble = nonlinear_static._assemble_nonlinear_system @@ -590,8 +590,8 @@ def solve_once() -> tuple[Any, Any, Mapping[str, Any], float, float]: "physical_sha256": _json_digest(observables), "dispatch": nonlinear_performance_status(), "identity": { - "anysolver_version": importlib.metadata.version("anysolver"), - "anysolver_module": str(Path(anysolver.__file__).resolve()), + "anyfesolver_version": importlib.metadata.version("anyfesolver"), + "anyfesolver_module": str(Path(anyfesolver.__file__).resolve()), "numpy_version": np.__version__, "python": platform.python_version(), "platform": platform.platform(), @@ -785,7 +785,7 @@ def read_stdout() -> None: "worker_peak_tree_rss_bytes": peak_rss, "stderr_log": str(log_path.resolve()), } - imported_module = Path(sample.get("identity", {}).get("anysolver_module", "")) + imported_module = Path(sample.get("identity", {}).get("anyfesolver_module", "")) try: imported_module.resolve().relative_to(site.resolve()) except (ValueError, OSError): @@ -1076,10 +1076,10 @@ def _run_installed_regressions( identity_test.parent.mkdir(parents=True, exist_ok=True) identity_test.write_text( "from pathlib import Path\n" - "def test_anysolver_imports_from_frozen_site():\n" - " import anysolver\n" + "def test_anyfesolver_imports_from_frozen_site():\n" + " import anyfesolver\n" f" expected = Path({expected_site!r}).resolve()\n" - " imported = Path(anysolver.__file__).resolve()\n" + " imported = Path(anyfesolver.__file__).resolve()\n" " assert imported.is_relative_to(expected), (imported, expected)\n", encoding="utf-8", ) @@ -1423,7 +1423,7 @@ def _coordinator(args: argparse.Namespace) -> int: convergence_repeats = int(manifest["execution"]["convergence_repeats"]) log_dir = args.log_dir.resolve() result: dict[str, Any] = { - "schema": "anysolver.nonlinear_static.representative_evidence", + "schema": "anyfesolver.nonlinear_static.representative_evidence", "version": 1, "started_utc": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()), "identity": { diff --git a/scripts/qualify_nonlinear_static_revisions.py b/scripts/qualify_nonlinear_static_revisions.py index a136843a4..9dc83d62a 100644 --- a/scripts/qualify_nonlinear_static_revisions.py +++ b/scripts/qualify_nonlinear_static_revisions.py @@ -37,13 +37,13 @@ def _worker_main(site: Path) -> int: import numpy as np - import anysolver - from anysolver.boundary import BoundaryCondition, LoadCase - from anysolver.mesh_gen import generate_simple_panel_mesh - from anysolver.nonlinear_performance_bootstrap import ( + import anyfesolver + from anyfesolver.boundary import BoundaryCondition, LoadCase + from anyfesolver.mesh_gen import generate_simple_panel_mesh + from anyfesolver.nonlinear_performance_bootstrap import ( nonlinear_performance_status, ) - from anysolver import nonlinear_static + from anyfesolver import nonlinear_static nonlinear_static._ensure_nonlinear_acceleration() original_assemble = nonlinear_static._assemble_nonlinear_system @@ -213,12 +213,12 @@ def solve(case: str) -> dict[str, Any]: identity = { "event": "ready", - "module_file": str(Path(anysolver.__file__).resolve()), + "module_file": str(Path(anyfesolver.__file__).resolve()), "python": sys.version, "platform": platform.platform(), "dependencies": { name: importlib.metadata.version(name) - for name in ("anysolver", "numpy", "scipy", "numba") + for name in ("anyfesolver", "numpy", "scipy", "numba") }, "performance_status": nonlinear_performance_status(), } @@ -590,7 +590,7 @@ def _main(args: argparse.Namespace) -> int: case["summary"]["physical_match"] for case in cases.values() ) payload = { - "schema": "anysolver.nonlinear_static.revision_qualification", + "schema": "anyfesolver.nonlinear_static.revision_qualification", "version": 1, "started_utc": started_utc, "completed_utc": time.strftime( diff --git a/scripts/qualify_s3_angles.py b/scripts/qualify_s3_angles.py index 52e69e00b..cb637aaa2 100644 --- a/scripts/qualify_s3_angles.py +++ b/scripts/qualify_s3_angles.py @@ -358,7 +358,7 @@ def mesh_statistics(mesh: Mesh2D) -> Dict[str, Any]: def build_model(mesh: Mesh2D, thickness: float): - from anysolver import FEModel, create_shell_element + from anyfesolver import FEModel, create_shell_element model = FEModel("s3-angle") model.add_material("steel", E, NU, density=DENSITY) @@ -392,7 +392,7 @@ def _boundary_nodes(mesh: Mesh2D, tolerance: float = 1.0e-12) -> Dict[str, List[ def element_resultants(model, displacement: np.ndarray, key: str): """Yield (station xy, weight, global 2x2 resultant tensor) for S3 elements.""" - from anysolver.fe_core import FEMesh + from anyfesolver.fe_core import FEMesh material = model.get_material("steel") manager = model.mesh.dof_manager @@ -459,9 +459,9 @@ def membrane_exact_energy(length: float, c: float, thickness: float) -> float: def run_membrane(mesh: Mesh2D, thickness: float = 0.05) -> Dict[str, Any]: - from anysolver import solve_linear - from anysolver.boundary import BoundaryCondition - from anysolver import assemble_stiffness_matrix + from anyfesolver import solve_linear + from anyfesolver.boundary import BoundaryCondition + from anyfesolver import assemble_stiffness_matrix length = mesh.lx c = 0.5 * mesh.ly @@ -579,7 +579,7 @@ def plate_buckling_nx(a: float, b: float, thickness: float) -> float: def _simply_supported(model, mesh: Mesh2D, *, inplane: str) -> None: - from anysolver.boundary import BoundaryCondition + from anyfesolver.boundary import BoundaryCondition sides = _boundary_nodes(mesh) for side in ("x0", "x1"): @@ -618,7 +618,7 @@ def _interpolate_centre(mesh: Mesh2D, values: Dict[int, float]) -> float: def run_plate_static(mesh: Mesh2D, thickness: float, pressure: float = 1.0e3) -> Dict[str, Any]: - from anysolver import LoadCase, solve_linear + from anyfesolver import LoadCase, solve_linear model = build_model(mesh, thickness) _simply_supported(model, mesh, inplane="clamped") @@ -681,7 +681,7 @@ def _private_element_matrix(model, element, method: str, *args: Any) -> Tuple[np tests/test_s3_angle_models.py. """ - from anysolver.fe_core import FEMesh + from anyfesolver.fe_core import FEMesh local = FEMesh() for node_id in element.node_ids: @@ -717,9 +717,9 @@ def run_plate_modal( """ import scipy.sparse.linalg as spla - from anysolver import assemble_stiffness_matrix - from anysolver.assembly import build_constraint_transformation - from anysolver.modal import solve_free_vibration + from anyfesolver import assemble_stiffness_matrix + from anyfesolver.assembly import build_constraint_transformation + from anyfesolver.modal import solve_free_vibration model = build_model(mesh, thickness) _simply_supported(model, mesh, inplane="clamped") @@ -777,10 +777,10 @@ def run_plate_buckling(mesh: Mesh2D, thickness: float, *, public_route: bool = F import scipy.sparse as sp import scipy.sparse.linalg as spla - from anysolver import assemble_stiffness_matrix - from anysolver.assembly import build_constraint_transformation - from anysolver.buckling import solve_eigenvalue_buckling - from anysolver.fe_core import FEMesh + from anyfesolver import assemble_stiffness_matrix + from anyfesolver.assembly import build_constraint_transformation + from anyfesolver.buckling import solve_eigenvalue_buckling + from anyfesolver.fe_core import FEMesh model = build_model(mesh, thickness) _simply_supported(model, mesh, inplane="uniaxial") @@ -857,9 +857,9 @@ def run_nonlinear_end_moment(mesh: Mesh2D, thickness: float = 0.01, turn: float tip (u, w) = (R sin(phi) - L, R (1 - cos(phi))) with phi = M L / EI. """ - from anysolver import FEModel, LoadCase, create_shell_element - from anysolver.boundary import FixedSupport - from anysolver.nonlinear_static import solve_static_nonlinear + from anyfesolver import FEModel, LoadCase, create_shell_element + from anyfesolver.boundary import FixedSupport + from anyfesolver.nonlinear_static import solve_static_nonlinear model = FEModel("s3-angle-nonlinear") model.add_material("steel", E, 0.0, density=DENSITY) @@ -1240,12 +1240,12 @@ def _json_default(value: Any) -> Any: def manifest(args: argparse.Namespace) -> Dict[str, Any]: - import anysolver + import anyfesolver import anymesher import scipy packages = {} - for name in ("anysolver", "anymesher", "anymaterial", "anyfileio", "numpy", "scipy", "numba"): + for name in ("anyfesolver", "anymesher", "anymaterial", "anyfileio", "numpy", "scipy", "numba"): try: module = __import__(name) packages[name] = { @@ -1254,8 +1254,8 @@ def manifest(args: argparse.Namespace) -> Dict[str, Any]: } except ImportError: packages[name] = None - from anysolver.elements import DEFAULT_S3_FORMULATION - from anysolver.e4_pl_s3_v2d_element import FORMULATION_ID, IMPLEMENTATION_ID + from anyfesolver.elements import DEFAULT_S3_FORMULATION + from anyfesolver.e4_pl_s3_v2d_element import FORMULATION_ID, IMPLEMENTATION_ID return { "schema": SCHEMA, diff --git a/scripts/r8_b2_assembly_metrics_dev.py b/scripts/r8_b2_assembly_metrics_dev.py index ae7c82183..d47a0d8cb 100644 --- a/scripts/r8_b2_assembly_metrics_dev.py +++ b/scripts/r8_b2_assembly_metrics_dev.py @@ -17,8 +17,8 @@ ENV={k:'1' for k in ('OMP_NUM_THREADS','OPENBLAS_NUM_THREADS','MKL_NUM_THREADS','NUMEXPR_NUM_THREADS', 'VECLIB_MAXIMUM_THREADS','BLIS_NUM_THREADS','NUMBA_NUM_THREADS','NUMBA_DISABLE_JIT')};ENV['PYTHONOPTIMIZE']='0' TESTS=['tests/test_r8_b2_assembly_metrics_dev.py','tests/test_stiffened_shell_b2_physical_footprint_batch.py'] -OWNED=['src/anysolver/_stiffened_shell_b2_q4_panel_experimental.py', - 'src/anysolver/_stiffened_shell_b2_assembly_diagnostics.py','tests/test_r8_b2_assembly_metrics_dev.py', +OWNED=['src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py', + 'src/anyfesolver/_stiffened_shell_b2_assembly_diagnostics.py','tests/test_r8_b2_assembly_metrics_dev.py', 'scripts/r8_b2_assembly_metrics_dev.py'] def sha(p):return hashlib.sha256(Path(p).read_bytes()).hexdigest() @@ -49,7 +49,7 @@ def freeze(): inputs=OWNED+[TESTS[1],'examples/stiffened_shell_b2_physical_rigid_footprint.py','pyproject.toml', 'scripts/_b3_e4_f03_local_scientific_supervisor.py','scripts/_b3_e4_f03_local_scientific_cases.py'] p=dict(source={n:sha(ROOT/n) for n in inputs},all_solver_source={p.relative_to(ROOT/'src').as_posix():sha(p) - for p in (ROOT/'src/anysolver').rglob('*.py')},tests=TESTS,scope='SMALL_DEVELOPMENT_ONLY',caps=dict(objects=2000000,edges=8000000,buffers=500000,depth=40)) + for p in (ROOT/'src/anyfesolver').rglob('*.py')},tests=TESTS,scope='SMALL_DEVELOPMENT_ONLY',caps=dict(objects=2000000,edges=8000000,buffers=500000,depth=40)) OUT.mkdir(parents=True,exist_ok=True) if (OUT/'PREPARED.json').exists(): version=OUT/'preparations';version.mkdir(exist_ok=True);old=OUT/'PREPARED.json' @@ -69,7 +69,7 @@ def runtime(p,installed=False,scientific=False): base=(OUT/'package/site' if installed else ROOT/'src').resolve() expected=p['package'] if installed else p['all_solver_source'] for n,m in tuple(sys.modules.items()): - if n.split('.')[0]=='anysolver' and getattr(m,'__file__',None): + if n.split('.')[0]=='anyfesolver' and getattr(m,'__file__',None): path=Path(m.__file__).resolve();require(path.is_relative_to(base),'wrong solver import '+n) rel=path.relative_to(base).as_posix();require(rel in expected and sha(path)==expected[rel],'import hash '+n) r['imports'][n]=dict(path=str(path),sha256=sha(path)) @@ -104,7 +104,7 @@ def child(phase,attempt): result=dict(status='PASS_INSTALL',package_files=len(a['package']),reinstalled=(attempt/'install-command.json').exists()) else: installed=phase=='installed';base=OUT/'package/site' if installed else ROOT/'src' - sys.path[:]=[str(base),str(ROOT)]+[x for x in sys.path if Path(x or '.').resolve() not in (ROOT/'src',Path('C:/Github/ANYsolver/src'))] + sys.path[:]=[str(base),str(ROOT)]+[x for x in sys.path if Path(x or '.').resolve() not in (ROOT/'src',Path('C:/Github/ANYfeSolver/src'))] import numpy,scipy,numba,pytest save(attempt/'runtime-before.json',runtime(p,installed,True)) class Counts: diff --git a/scripts/r8_b2_assembly_series_dev.py b/scripts/r8_b2_assembly_series_dev.py index cdb61ac2a..08d8fd78b 100644 --- a/scripts/r8_b2_assembly_series_dev.py +++ b/scripts/r8_b2_assembly_series_dev.py @@ -134,7 +134,7 @@ def prepare(): require(sha(old['consumer_wheel'])==old['consumer_sha256'],'frozen consumer artifact identity') with ZipFile(old['consumer_wheel']) as z: consumer={n:hashlib.sha256(z.read(n)).hexdigest() for n in z.namelist() if n.startswith('anyfem/') and not n.endswith('/')} - solver={n:h for n,h in a['package'].items() if n.startswith('anysolver/')} + solver={n:h for n,h in a['package'].items() if n.startswith('anyfesolver/')} paths=[Path(__file__),ROOT/'tests/test_r8_b2_assembly_series_dev.py',ROOT/'scripts/b2_large_scale_development.py', ROOT/'scripts/r8_b2_g5_readiness_dev.py',ROOT/'scripts/r8_b2_installed_batch_persistence_dev.py', ROOT/'scripts/_b3_e4_f03_local_scientific_supervisor.py',FULL,METRICS/'ARTIFACT.json',METRICS/'TESTED_BINDINGS.json', @@ -168,11 +168,11 @@ def installed_samples(attempt,plan,size,ordinals): require(len(ordinals)>0 and all(type(n) is int and 1<=n<=5 for n in ordinals) and len(set(ordinals))==len(ordinals),'warm sample ordinals') site=Path(plan['package_site']).resolve() sys.path[:]=[str(site)]+[x for x in sys.path if not Path(x or '.').resolve().is_relative_to(ROOT/'src') - and not Path(x or '.').resolve().is_relative_to(Path('C:/Github/ANYsolver/src'))] + and not Path(x or '.').resolve().is_relative_to(Path('C:/Github/ANYfeSolver/src'))] # Imports and persistence are outside all measured owner constructions. import numpy as np - from anysolver import stiffened_shell as api - from anysolver._stiffened_shell_b2_assembly_diagnostics import capture_assembly + from anyfesolver import stiffened_shell as api + from anyfesolver._stiffened_shell_b2_assembly_diagnostics import capture_assembly from anyfem.solve.stiffened_shell_b2 import ExperimentalB2PhysicalRigidFootprintPanel,SCHEMA_PHYSICAL_FOOTPRINT_SPARSE_V2,save_case,load_case from anyfem.model.project import Project from anyfem.model.records import AnalysisDefinition diff --git a/scripts/r8_b2_assembly_series_v2_dev.py b/scripts/r8_b2_assembly_series_v2_dev.py index 3a96df2f6..ef430d6b5 100644 --- a/scripts/r8_b2_assembly_series_v2_dev.py +++ b/scripts/r8_b2_assembly_series_v2_dev.py @@ -120,7 +120,7 @@ def prepare(): require(sha(old['consumer_wheel'])==old['consumer_sha256'],'frozen consumer artifact identity') with ZipFile(old['consumer_wheel']) as z: consumer={n:hashlib.sha256(z.read(n)).hexdigest() for n in z.namelist() if n.startswith('anyfem/') and not n.endswith('/')} - solver={n:h for n,h in a['package'].items() if n.startswith('anysolver/')} + solver={n:h for n,h in a['package'].items() if n.startswith('anyfesolver/')} paths=[Path(__file__),ROOT/'tests/test_r8_b2_assembly_series_dev.py',ROOT/'scripts/b2_large_scale_development.py', ROOT/'scripts/r8_b2_g5_readiness_dev.py',ROOT/'scripts/r8_b2_installed_batch_persistence_dev.py', ROOT/'scripts/_b3_e4_f03_local_scientific_supervisor.py',FULL,METRICS/'ARTIFACT.json',METRICS/'TESTED_BINDINGS.json', @@ -155,11 +155,11 @@ def installed_samples(attempt,plan,size,ordinals): require(len(ordinals)>0 and all(type(n) is int and 1<=n<=5 for n in ordinals) and len(set(ordinals))==len(ordinals),'warm sample ordinals') site=Path(plan['package_site']).resolve() sys.path[:]=[str(site)]+[x for x in sys.path if not Path(x or '.').resolve().is_relative_to(ROOT/'src') - and not Path(x or '.').resolve().is_relative_to(Path('C:/Github/ANYsolver/src'))] + and not Path(x or '.').resolve().is_relative_to(Path('C:/Github/ANYfeSolver/src'))] # Imports and persistence are outside all measured owner constructions. import numpy as np - from anysolver import stiffened_shell as api - from anysolver._stiffened_shell_b2_assembly_diagnostics import capture_assembly + from anyfesolver import stiffened_shell as api + from anyfesolver._stiffened_shell_b2_assembly_diagnostics import capture_assembly from anyfem.solve.stiffened_shell_b2 import ExperimentalB2PhysicalRigidFootprintPanel,SCHEMA_PHYSICAL_FOOTPRINT_SPARSE_V2,save_case,load_case from anyfem.model.project import Project from anyfem.model.records import AnalysisDefinition @@ -384,14 +384,14 @@ def ready(): require(sha(BASE/'SERIES_LEDGER.json')==a['predecessor_failed_ledger']['sha256'],'closed predecessor ledger identity') require(a['predecessor_failed_ledger']['remainder_discarded'] is True and a['predecessor_failed_ledger']['large_models_executed']==0,'predecessor not reusable allowance') (OUT/'PREPARED.json').write_bytes((BASE/'PREPARED.json').read_bytes()) - maker=Path('C:/Github/ANYsolver/.venv/Lib/site-packages/pip/_internal/operations/install/wheel.py');tree=ast.parse(maker.read_text()) + maker=Path('C:/Github/ANYfeSolver/.venv/Lib/site-packages/pip/_internal/operations/install/wheel.py');tree=ast.parse(maker.read_text()) cls=next(n for n in tree.body if isinstance(n,ast.ClassDef) and n.name=='PipScriptMaker') value=next(n.value for n in cls.body if isinstance(n,ast.Assign) and any(isinstance(t,ast.Name) and t.id=='script_template' for t in n.targets)) require(isinstance(value,ast.Call) and len(value.args)==1 and isinstance(value.args[0],ast.Constant) and type(value.args[0].value) is str,'literal PipScriptMaker template') p['launcher_provenance']=dict(interpreter=json.loads((BASE/'attempt-install-01/runtime-before.json').read_text())['executable'], template=textwrap.dedent(value.args[0].value),template_source_path=str(maker),template_source_sha256=sha(maker), - resources={kind:dict(path=str(Path('C:/Github/ANYsolver/.venv/Lib/site-packages/pip/_vendor/distlib')/(kind+'.exe')), - sha256=sha(Path('C:/Github/ANYsolver/.venv/Lib/site-packages/pip/_vendor/distlib')/(kind+'.exe'))) for kind in ('t64','w64')}) + resources={kind:dict(path=str(Path('C:/Github/ANYfeSolver/.venv/Lib/site-packages/pip/_vendor/distlib')/(kind+'.exe')), + sha256=sha(Path('C:/Github/ANYfeSolver/.venv/Lib/site-packages/pip/_vendor/distlib')/(kind+'.exe'))) for kind in ('t64','w64')}) p['source'].update({n:sha(ROOT/n) for n in ('scripts/r8_b2_assembly_series_v2_dev.py','tests/test_r8_b2_assembly_series_v2_dev.py')}) p.update(frozen_grant_sha256=FROZEN_GRANT_SHA,authority_sha256=sha(OUT/'ROOT_DEVELOPMENT_AUTHORITY.json'),execution_authority_name=EXECUTION_AUTHORITY_NAME,authority_contract_sha256=authority_contract_sha(a),predecessor_prepared_sha256=sha(BASE/'PREPARED.json'), reused_install_receipt_sha256=sha(BASE/'attempt-install-01/receipt.json'),expected_controls=20) diff --git a/scripts/r8_b2_assembly_series_v3_dev.py b/scripts/r8_b2_assembly_series_v3_dev.py index 749c4015d..437f2d507 100644 --- a/scripts/r8_b2_assembly_series_v3_dev.py +++ b/scripts/r8_b2_assembly_series_v3_dev.py @@ -121,7 +121,7 @@ def prepare(): require(sha(old['consumer_wheel'])==old['consumer_sha256'],'frozen consumer artifact identity') with ZipFile(old['consumer_wheel']) as z: consumer={n:hashlib.sha256(z.read(n)).hexdigest() for n in z.namelist() if n.startswith('anyfem/') and not n.endswith('/')} - solver={n:h for n,h in a['package'].items() if n.startswith('anysolver/')} + solver={n:h for n,h in a['package'].items() if n.startswith('anyfesolver/')} paths=[Path(__file__),ROOT/'tests/test_r8_b2_assembly_series_dev.py',ROOT/'scripts/b2_large_scale_development.py', ROOT/'scripts/r8_b2_g5_readiness_dev.py',ROOT/'scripts/r8_b2_installed_batch_persistence_dev.py', ROOT/'scripts/_b3_e4_f03_local_scientific_supervisor.py',FULL,METRICS/'ARTIFACT.json',METRICS/'TESTED_BINDINGS.json', @@ -156,11 +156,11 @@ def installed_samples(attempt,plan,size,ordinals): require(len(ordinals)>0 and all(type(n) is int and 1<=n<=5 for n in ordinals) and len(set(ordinals))==len(ordinals),'warm sample ordinals') site=Path(plan['package_site']).resolve() sys.path[:]=[str(site)]+[x for x in sys.path if not Path(x or '.').resolve().is_relative_to(ROOT/'src') - and not Path(x or '.').resolve().is_relative_to(Path('C:/Github/ANYsolver/src'))] + and not Path(x or '.').resolve().is_relative_to(Path('C:/Github/ANYfeSolver/src'))] # Imports and persistence are outside all measured owner constructions. import numpy as np - from anysolver import stiffened_shell as api - from anysolver._stiffened_shell_b2_assembly_diagnostics import capture_assembly + from anyfesolver import stiffened_shell as api + from anyfesolver._stiffened_shell_b2_assembly_diagnostics import capture_assembly from anyfem.solve.stiffened_shell_b2 import ExperimentalB2PhysicalRigidFootprintPanel,SCHEMA_PHYSICAL_FOOTPRINT_SPARSE_V2,save_case,load_case from anyfem.model.project import Project from anyfem.model.records import AnalysisDefinition @@ -390,19 +390,19 @@ def ready(): require(sha(PREVIOUS/'SERIES_LEDGER.json')==a['predecessor_failed_ledger']['sha256'],'closed predecessor ledger identity') require(a['predecessor_failed_ledger']['remainder_discarded'] is True and a['predecessor_failed_ledger']['large_models_executed']==0,'predecessor not reusable allowance') (OUT/'PREPARED.json').write_bytes((BASE/'PREPARED.json').read_bytes()) - maker=Path('C:/Github/ANYsolver/.venv/Lib/site-packages/pip/_internal/operations/install/wheel.py');tree=ast.parse(maker.read_text()) + maker=Path('C:/Github/ANYfeSolver/.venv/Lib/site-packages/pip/_internal/operations/install/wheel.py');tree=ast.parse(maker.read_text()) cls=next(n for n in tree.body if isinstance(n,ast.ClassDef) and n.name=='PipScriptMaker') value=next(n.value for n in cls.body if isinstance(n,ast.Assign) and any(isinstance(t,ast.Name) and t.id=='script_template' for t in n.targets)) require(isinstance(value,ast.Call) and len(value.args)==1 and isinstance(value.args[0],ast.Constant) and type(value.args[0].value) is str,'literal PipScriptMaker template') p['launcher_provenance']=dict(interpreter=json.loads((BASE/'attempt-install-01/runtime-before.json').read_text())['executable'], template=textwrap.dedent(value.args[0].value),template_source_path=str(maker),template_source_sha256=sha(maker), - resources={kind:dict(path=str(Path('C:/Github/ANYsolver/.venv/Lib/site-packages/pip/_vendor/distlib')/(kind+'.exe')), - sha256=sha(Path('C:/Github/ANYsolver/.venv/Lib/site-packages/pip/_vendor/distlib')/(kind+'.exe'))) for kind in ('t64','w64')}) + resources={kind:dict(path=str(Path('C:/Github/ANYfeSolver/.venv/Lib/site-packages/pip/_vendor/distlib')/(kind+'.exe')), + sha256=sha(Path('C:/Github/ANYfeSolver/.venv/Lib/site-packages/pip/_vendor/distlib')/(kind+'.exe'))) for kind in ('t64','w64')}) interpreter=p['launcher_provenance']['interpreter'];require(interpreter.endswith('python.exe'),'recorded console executable') gui_path=interpreter[:-len('python.exe')]+'pythonw.exe';require(Path(gui_path).is_file(),'actual GUI sibling file missing') p['launcher_provenance']['gui_executable']=dict(path=gui_path,sha256=sha(gui_path)) require(p['launcher_provenance']['gui_executable']==a['gui_interpreter'],'root GUI sibling binding') - alternate=Path('C:/Github/ANYsolver/.venv/Lib/site-packages/pip/_vendor/distlib/scripts.py') + alternate=Path('C:/Github/ANYfeSolver/.venv/Lib/site-packages/pip/_vendor/distlib/scripts.py') p['launcher_provenance']['alternate_source']=dict(path=str(alternate),sha256=sha(alternate)) p['historical_v2']=dict(original_grant_sha256=sha(PREVIOUS/'ROOT_DEVELOPMENT_AUTHORITY.json'), preparation_selection_sha256=sha(PREVIOUS/'SELECTED_PATHS.json'),execution_selection_sha256=sha(PREVIOUS/'EXECUTION_SELECTED_PATHS.json'), diff --git a/scripts/r8_b2_assembly_series_v4_dev.py b/scripts/r8_b2_assembly_series_v4_dev.py index f58a28786..bf3ef635c 100644 --- a/scripts/r8_b2_assembly_series_v4_dev.py +++ b/scripts/r8_b2_assembly_series_v4_dev.py @@ -129,7 +129,7 @@ def prepare(): require(sha(old['consumer_wheel'])==old['consumer_sha256'],'frozen consumer artifact identity') with ZipFile(old['consumer_wheel']) as z: consumer={n:hashlib.sha256(z.read(n)).hexdigest() for n in z.namelist() if n.startswith('anyfem/') and not n.endswith('/')} - solver={n:h for n,h in a['package'].items() if n.startswith('anysolver/')} + solver={n:h for n,h in a['package'].items() if n.startswith('anyfesolver/')} paths=[Path(__file__),ROOT/'tests/test_r8_b2_assembly_series_dev.py',ROOT/'scripts/b2_large_scale_development.py', ROOT/'scripts/r8_b2_g5_readiness_dev.py',ROOT/'scripts/r8_b2_installed_batch_persistence_dev.py', ROOT/'scripts/_b3_e4_f03_local_scientific_supervisor.py',FULL,METRICS/'ARTIFACT.json',METRICS/'TESTED_BINDINGS.json', @@ -164,11 +164,11 @@ def installed_samples(attempt,plan,size,ordinals,*,smoke=False): require((smoke is True and size==3 and ordinals==[]) or (smoke is False and len(ordinals)>0 and all(type(n) is int and 1<=n<=5 for n in ordinals) and len(set(ordinals))==len(ordinals)),'smoke or warm sample ordinals') site=Path(plan['package_site']).resolve() sys.path[:]=[str(site)]+[x for x in sys.path if not Path(x or '.').resolve().is_relative_to(ROOT/'src') - and not Path(x or '.').resolve().is_relative_to(Path('C:/Github/ANYsolver/src'))] + and not Path(x or '.').resolve().is_relative_to(Path('C:/Github/ANYfeSolver/src'))] # Imports and persistence are outside all measured owner constructions. import numpy as np - from anysolver import stiffened_shell as api - from anysolver._stiffened_shell_b2_assembly_diagnostics import capture_assembly + from anyfesolver import stiffened_shell as api + from anyfesolver._stiffened_shell_b2_assembly_diagnostics import capture_assembly from anyfem.solve.stiffened_shell_b2 import ExperimentalB2PhysicalRigidFootprintPanel,SCHEMA_PHYSICAL_FOOTPRINT_SPARSE_V2,save_case,load_case from anyfem.model.project import Project from anyfem.model.records import AnalysisDefinition @@ -407,19 +407,19 @@ def ready(): require(sha(PREVIOUS/'SERIES_LEDGER.json')==a['predecessor_failed_ledger']['sha256'],'closed predecessor ledger identity') require(a['predecessor_failed_ledger']['remainder_discarded'] is True and a['predecessor_failed_ledger']['large_owners_executed']==0,'predecessor not reusable allowance') (OUT/'PREPARED.json').write_bytes((BASE/'PREPARED.json').read_bytes()) - maker=Path('C:/Github/ANYsolver/.venv/Lib/site-packages/pip/_internal/operations/install/wheel.py');tree=ast.parse(maker.read_text()) + maker=Path('C:/Github/ANYfeSolver/.venv/Lib/site-packages/pip/_internal/operations/install/wheel.py');tree=ast.parse(maker.read_text()) cls=next(n for n in tree.body if isinstance(n,ast.ClassDef) and n.name=='PipScriptMaker') value=next(n.value for n in cls.body if isinstance(n,ast.Assign) and any(isinstance(t,ast.Name) and t.id=='script_template' for t in n.targets)) require(isinstance(value,ast.Call) and len(value.args)==1 and isinstance(value.args[0],ast.Constant) and type(value.args[0].value) is str,'literal PipScriptMaker template') p['launcher_provenance']=dict(interpreter=json.loads((BASE/'attempt-install-01/runtime-before.json').read_text())['executable'], template=textwrap.dedent(value.args[0].value),template_source_path=str(maker),template_source_sha256=sha(maker), - resources={kind:dict(path=str(Path('C:/Github/ANYsolver/.venv/Lib/site-packages/pip/_vendor/distlib')/(kind+'.exe')), - sha256=sha(Path('C:/Github/ANYsolver/.venv/Lib/site-packages/pip/_vendor/distlib')/(kind+'.exe'))) for kind in ('t64','w64')}) + resources={kind:dict(path=str(Path('C:/Github/ANYfeSolver/.venv/Lib/site-packages/pip/_vendor/distlib')/(kind+'.exe')), + sha256=sha(Path('C:/Github/ANYfeSolver/.venv/Lib/site-packages/pip/_vendor/distlib')/(kind+'.exe'))) for kind in ('t64','w64')}) interpreter=p['launcher_provenance']['interpreter'];require(interpreter.endswith('python.exe'),'recorded console executable') gui_path=interpreter[:-len('python.exe')]+'pythonw.exe';require(Path(gui_path).is_file(),'actual GUI sibling file missing') p['launcher_provenance']['gui_executable']=dict(path=gui_path,sha256=sha(gui_path)) require(p['launcher_provenance']['gui_executable']==a['gui_interpreter'],'root GUI sibling binding') - alternate=Path('C:/Github/ANYsolver/.venv/Lib/site-packages/pip/_vendor/distlib/scripts.py') + alternate=Path('C:/Github/ANYfeSolver/.venv/Lib/site-packages/pip/_vendor/distlib/scripts.py') p['launcher_provenance']['alternate_source']=dict(path=str(alternate),sha256=sha(alternate)) p['historical_v3']=dict(original_grant_sha256=sha(PREVIOUS/'ROOT_DEVELOPMENT_AUTHORITY.json'), preparation_selection_sha256=sha(PREVIOUS/'SELECTED_PATHS.json'),execution_selection_sha256=sha(PREVIOUS/'EXECUTION_SELECTED_PATHS.json'), diff --git a/scripts/r8_b2_assembly_series_v5_dev.py b/scripts/r8_b2_assembly_series_v5_dev.py index c6be9db6f..e4a99b407 100644 --- a/scripts/r8_b2_assembly_series_v5_dev.py +++ b/scripts/r8_b2_assembly_series_v5_dev.py @@ -129,7 +129,7 @@ def prepare(): require(sha(old['consumer_wheel'])==old['consumer_sha256'],'frozen consumer artifact identity') with ZipFile(old['consumer_wheel']) as z: consumer={n:hashlib.sha256(z.read(n)).hexdigest() for n in z.namelist() if n.startswith('anyfem/') and not n.endswith('/')} - solver={n:h for n,h in a['package'].items() if n.startswith('anysolver/')} + solver={n:h for n,h in a['package'].items() if n.startswith('anyfesolver/')} paths=[Path(__file__),ROOT/'tests/test_r8_b2_assembly_series_dev.py',ROOT/'scripts/b2_large_scale_development.py', ROOT/'scripts/r8_b2_g5_readiness_dev.py',ROOT/'scripts/r8_b2_installed_batch_persistence_dev.py', ROOT/'scripts/_b3_e4_f03_local_scientific_supervisor.py',FULL,METRICS/'ARTIFACT.json',METRICS/'TESTED_BINDINGS.json', @@ -164,11 +164,11 @@ def installed_samples(attempt,plan,size,ordinals,*,smoke=False): require((smoke is True and size==3 and ordinals==[]) or (smoke is False and len(ordinals)>0 and all(type(n) is int and 1<=n<=5 for n in ordinals) and len(set(ordinals))==len(ordinals)),'smoke or warm sample ordinals') site=Path(plan['package_site']).resolve() sys.path[:]=[str(site)]+[x for x in sys.path if not Path(x or '.').resolve().is_relative_to(ROOT/'src') - and not Path(x or '.').resolve().is_relative_to(Path('C:/Github/ANYsolver/src'))] + and not Path(x or '.').resolve().is_relative_to(Path('C:/Github/ANYfeSolver/src'))] # Imports and persistence are outside all measured owner constructions. import numpy as np - from anysolver import stiffened_shell as api - from anysolver._stiffened_shell_b2_assembly_diagnostics import capture_assembly + from anyfesolver import stiffened_shell as api + from anyfesolver._stiffened_shell_b2_assembly_diagnostics import capture_assembly from anyfem.solve.stiffened_shell_b2 import ExperimentalB2PhysicalRigidFootprintPanel,SCHEMA_PHYSICAL_FOOTPRINT_SPARSE_V2,save_case,load_case from anyfem.model.project import Project from anyfem.model.records import AnalysisDefinition @@ -441,19 +441,19 @@ def ready(): require(sha(PREVIOUS/'SERIES_LEDGER.json')==a['predecessor_failed_ledger']['sha256'],'closed predecessor ledger identity') require(a['predecessor_failed_ledger']['remainder_discarded'] is True and a['predecessor_failed_ledger']['large_owners_executed']==0,'predecessor not reusable allowance') (OUT/'PREPARED.json').write_bytes((BASE/'PREPARED.json').read_bytes()) - maker=Path('C:/Github/ANYsolver/.venv/Lib/site-packages/pip/_internal/operations/install/wheel.py');tree=ast.parse(maker.read_text()) + maker=Path('C:/Github/ANYfeSolver/.venv/Lib/site-packages/pip/_internal/operations/install/wheel.py');tree=ast.parse(maker.read_text()) cls=next(n for n in tree.body if isinstance(n,ast.ClassDef) and n.name=='PipScriptMaker') value=next(n.value for n in cls.body if isinstance(n,ast.Assign) and any(isinstance(t,ast.Name) and t.id=='script_template' for t in n.targets)) require(isinstance(value,ast.Call) and len(value.args)==1 and isinstance(value.args[0],ast.Constant) and type(value.args[0].value) is str,'literal PipScriptMaker template') p['launcher_provenance']=dict(interpreter=json.loads((BASE/'attempt-install-01/runtime-before.json').read_text())['executable'], template=textwrap.dedent(value.args[0].value),template_source_path=str(maker),template_source_sha256=sha(maker), - resources={kind:dict(path=str(Path('C:/Github/ANYsolver/.venv/Lib/site-packages/pip/_vendor/distlib')/(kind+'.exe')), - sha256=sha(Path('C:/Github/ANYsolver/.venv/Lib/site-packages/pip/_vendor/distlib')/(kind+'.exe'))) for kind in ('t64','w64')}) + resources={kind:dict(path=str(Path('C:/Github/ANYfeSolver/.venv/Lib/site-packages/pip/_vendor/distlib')/(kind+'.exe')), + sha256=sha(Path('C:/Github/ANYfeSolver/.venv/Lib/site-packages/pip/_vendor/distlib')/(kind+'.exe'))) for kind in ('t64','w64')}) interpreter=p['launcher_provenance']['interpreter'];require(interpreter.endswith('python.exe'),'recorded console executable') gui_path=interpreter[:-len('python.exe')]+'pythonw.exe';require(Path(gui_path).is_file(),'actual GUI sibling file missing') p['launcher_provenance']['gui_executable']=dict(path=gui_path,sha256=sha(gui_path)) require(p['launcher_provenance']['gui_executable']==a['gui_interpreter'],'root GUI sibling binding') - alternate=Path('C:/Github/ANYsolver/.venv/Lib/site-packages/pip/_vendor/distlib/scripts.py') + alternate=Path('C:/Github/ANYfeSolver/.venv/Lib/site-packages/pip/_vendor/distlib/scripts.py') p['launcher_provenance']['alternate_source']=dict(path=str(alternate),sha256=sha(alternate)) p['historical_v4']=dict(original_grant_sha256=sha(PREVIOUS/'ROOT_DEVELOPMENT_AUTHORITY.json'), preparation_selection_sha256=sha(PREVIOUS/'SELECTED_PATHS.json'),execution_selection_sha256=sha(PREVIOUS/'EXECUTION_SELECTED_PATHS.json'), diff --git a/scripts/r8_b2_assembly_series_v6_dev.py b/scripts/r8_b2_assembly_series_v6_dev.py index 51f323666..9141386a6 100644 --- a/scripts/r8_b2_assembly_series_v6_dev.py +++ b/scripts/r8_b2_assembly_series_v6_dev.py @@ -132,11 +132,11 @@ def installed_samples(attempt,plan,size,ordinals,*,smoke=False): require((smoke is True and size==3 and ordinals==[]) or (smoke is False and len(ordinals)>0 and all(type(n) is int and 1<=n<=5 for n in ordinals) and len(set(ordinals))==len(ordinals)),'smoke or warm sample ordinals') site=Path(plan['package_site']).resolve() sys.path[:]=[str(site)]+[x for x in sys.path if not Path(x or '.').resolve().is_relative_to(ROOT/'src') - and not Path(x or '.').resolve().is_relative_to(Path('C:/Github/ANYsolver/src'))] + and not Path(x or '.').resolve().is_relative_to(Path('C:/Github/ANYfeSolver/src'))] # Imports and persistence are outside all measured owner constructions. import numpy as np - from anysolver import stiffened_shell as api - from anysolver._stiffened_shell_b2_assembly_diagnostics import capture_assembly + from anyfesolver import stiffened_shell as api + from anyfesolver._stiffened_shell_b2_assembly_diagnostics import capture_assembly from anyfem.solve.stiffened_shell_b2 import ExperimentalB2PhysicalRigidFootprintPanel,SCHEMA_PHYSICAL_FOOTPRINT_SPARSE_V2,save_case,load_case from anyfem.model.project import Project from anyfem.model.records import AnalysisDefinition @@ -402,7 +402,7 @@ def public_caller_contract(plan,runner_source=None): This is static admission, not caller execution or a replacement for smoke. """ with ZipFile(plan['solver_wheel']) as z: - solver=ast.parse(z.read('anysolver/_stiffened_shell_b2_q4_panel_experimental.py').decode()) + solver=ast.parse(z.read('anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py').decode()) with ZipFile(plan['consumer_wheel']) as z: consumer=ast.parse(z.read('anyfem/solve/stiffened_shell_b2.py').decode()) project_io=ast.parse(z.read('anyfem/io/project_file.py').decode()) @@ -454,19 +454,19 @@ def ready(): require(sha(PREVIOUS/'SERIES_LEDGER.json')==a['predecessor_failed_ledger']['sha256'],'closed predecessor ledger identity') require(a['predecessor_failed_ledger']['remainder_discarded'] is True and a['predecessor_failed_ledger']['large_owners_executed']==0,'predecessor not reusable allowance') (OUT/'PREPARED.json').write_bytes((BASE/'PREPARED.json').read_bytes()) - maker=Path('C:/Github/ANYsolver/.venv/Lib/site-packages/pip/_internal/operations/install/wheel.py');tree=ast.parse(maker.read_text()) + maker=Path('C:/Github/ANYfeSolver/.venv/Lib/site-packages/pip/_internal/operations/install/wheel.py');tree=ast.parse(maker.read_text()) cls=next(n for n in tree.body if isinstance(n,ast.ClassDef) and n.name=='PipScriptMaker') value=next(n.value for n in cls.body if isinstance(n,ast.Assign) and any(isinstance(t,ast.Name) and t.id=='script_template' for t in n.targets)) require(isinstance(value,ast.Call) and len(value.args)==1 and isinstance(value.args[0],ast.Constant) and type(value.args[0].value) is str,'literal PipScriptMaker template') p['launcher_provenance']=dict(interpreter=json.loads((BASE/'attempt-install-01/runtime-before.json').read_text())['executable'], template=textwrap.dedent(value.args[0].value),template_source_path=str(maker),template_source_sha256=sha(maker), - resources={kind:dict(path=str(Path('C:/Github/ANYsolver/.venv/Lib/site-packages/pip/_vendor/distlib')/(kind+'.exe')), - sha256=sha(Path('C:/Github/ANYsolver/.venv/Lib/site-packages/pip/_vendor/distlib')/(kind+'.exe'))) for kind in ('t64','w64')}) + resources={kind:dict(path=str(Path('C:/Github/ANYfeSolver/.venv/Lib/site-packages/pip/_vendor/distlib')/(kind+'.exe')), + sha256=sha(Path('C:/Github/ANYfeSolver/.venv/Lib/site-packages/pip/_vendor/distlib')/(kind+'.exe'))) for kind in ('t64','w64')}) interpreter=p['launcher_provenance']['interpreter'];require(interpreter.endswith('python.exe'),'recorded console executable') gui_path=interpreter[:-len('python.exe')]+'pythonw.exe';require(Path(gui_path).is_file(),'actual GUI sibling file missing') p['launcher_provenance']['gui_executable']=dict(path=gui_path,sha256=sha(gui_path)) require(p['launcher_provenance']['gui_executable']==a['gui_interpreter'],'root GUI sibling binding') - alternate=Path('C:/Github/ANYsolver/.venv/Lib/site-packages/pip/_vendor/distlib/scripts.py') + alternate=Path('C:/Github/ANYfeSolver/.venv/Lib/site-packages/pip/_vendor/distlib/scripts.py') p['launcher_provenance']['alternate_source']=dict(path=str(alternate),sha256=sha(alternate)) p['historical_v5']=dict(original_grant_sha256=sha(PREVIOUS/'ROOT_DEVELOPMENT_AUTHORITY.json'), preparation_selection_sha256=sha(PREVIOUS/'SELECTED_PATHS.json'),execution_selection_sha256=sha(PREVIOUS/'EXECUTION_SELECTED_PATHS.json'), diff --git a/scripts/r8_b2_assembly_series_v7_dev.py b/scripts/r8_b2_assembly_series_v7_dev.py index 078019156..0a62b97c2 100644 --- a/scripts/r8_b2_assembly_series_v7_dev.py +++ b/scripts/r8_b2_assembly_series_v7_dev.py @@ -132,11 +132,11 @@ def installed_samples(attempt,plan,size,ordinals,*,smoke=False): require((smoke is True and size==3 and ordinals==[]) or (smoke is False and len(ordinals)>0 and all(type(n) is int and 1<=n<=5 for n in ordinals) and len(set(ordinals))==len(ordinals)),'smoke or warm sample ordinals') site=Path(plan['package_site']).resolve() sys.path[:]=[str(site)]+[x for x in sys.path if not Path(x or '.').resolve().is_relative_to(ROOT/'src') - and not Path(x or '.').resolve().is_relative_to(Path('C:/Github/ANYsolver/src'))] + and not Path(x or '.').resolve().is_relative_to(Path('C:/Github/ANYfeSolver/src'))] # Imports and persistence are outside all measured owner constructions. import numpy as np - from anysolver import stiffened_shell as api - from anysolver._stiffened_shell_b2_assembly_diagnostics import capture_assembly + from anyfesolver import stiffened_shell as api + from anyfesolver._stiffened_shell_b2_assembly_diagnostics import capture_assembly from anyfem.solve.stiffened_shell_b2 import ExperimentalB2PhysicalRigidFootprintPanel,SCHEMA_PHYSICAL_FOOTPRINT_SPARSE_V2,save_case,load_case from anyfem.model.project import Project from anyfem.model.records import AnalysisDefinition @@ -418,7 +418,7 @@ def public_caller_contract(plan,runner_source=None): This is static admission, not caller execution or a replacement for smoke. """ with ZipFile(plan['solver_wheel']) as z: - solver=ast.parse(z.read('anysolver/_stiffened_shell_b2_q4_panel_experimental.py').decode()) + solver=ast.parse(z.read('anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py').decode()) with ZipFile(plan['consumer_wheel']) as z: consumer=ast.parse(z.read('anyfem/solve/stiffened_shell_b2.py').decode()) project_io=ast.parse(z.read('anyfem/io/project_file.py').decode()) @@ -477,7 +477,7 @@ def ready(): p['historical_v6']={n:sha(PREVIOUS/n) for n in ('EXECUTABLE_PREPARED.json','EXECUTION_SELECTED_PATHS.json','SERIES_LEDGER.json','EXECUTION_HANDOFF.json','EXECUTION_TERMINAL_TREE.json')} p['verified_lifetime']={n:sha(LIFETIME/n) for n in ('SELECTED_PATHS.json','HANDOFF.json','ledger.json','ARTIFACT.json','ROOT_ADOPTION.json','ROOT_ORIGINAL_SOURCE_RECONCILIATION.json','REPORT_COUNT_CORRECTION.md')} p['source'].update({n:sha(ROOT/n) for n in ('scripts/r8_b2_assembly_series_v7_dev.py','tests/test_r8_b2_assembly_series_v7_dev.py','scripts/r8_b2_assembly_series_v7_preflight_dev.py', - 'src/anysolver/e4_pl_element.py','src/anysolver/_stiffened_shell_b2_q4_panel_experimental.py','src/anysolver/_stiffened_shell_b2_assembly_diagnostics.py')}) + 'src/anyfesolver/e4_pl_element.py','src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py','src/anyfesolver/_stiffened_shell_b2_assembly_diagnostics.py')}) p['question']='Does real private-owner retirement allow unchanged connected cold+fivewarm2500/5000/10000 under2GiB? Fresh-constructor/backend peak may still fail.' p['caller_contract']=public_caller_contract(p) p['predecessor_prepared_sha256']=sha(BASE/'PREPARED.json') diff --git a/scripts/r8_b2_assembly_series_v8_dev.py b/scripts/r8_b2_assembly_series_v8_dev.py index 485288fd8..f5e8375a2 100644 --- a/scripts/r8_b2_assembly_series_v8_dev.py +++ b/scripts/r8_b2_assembly_series_v8_dev.py @@ -132,11 +132,11 @@ def installed_samples(attempt,plan,size,ordinals,*,smoke=False): require((smoke is True and size==3 and ordinals==[]) or (smoke is False and len(ordinals)>0 and all(type(n) is int and 1<=n<=5 for n in ordinals) and len(set(ordinals))==len(ordinals)),'smoke or warm sample ordinals') site=Path(plan['package_site']).resolve() sys.path[:]=[str(site)]+[x for x in sys.path if not Path(x or '.').resolve().is_relative_to(ROOT/'src') - and not Path(x or '.').resolve().is_relative_to(Path('C:/Github/ANYsolver/src'))] + and not Path(x or '.').resolve().is_relative_to(Path('C:/Github/ANYfeSolver/src'))] # Imports and persistence are outside all measured owner constructions. import numpy as np - from anysolver import stiffened_shell as api - from anysolver._stiffened_shell_b2_assembly_diagnostics import capture_assembly + from anyfesolver import stiffened_shell as api + from anyfesolver._stiffened_shell_b2_assembly_diagnostics import capture_assembly from anyfem.solve.stiffened_shell_b2 import ExperimentalB2PhysicalRigidFootprintPanel,SCHEMA_PHYSICAL_FOOTPRINT_SPARSE_V2,save_case,load_case from anyfem.model.project import Project from anyfem.model.records import AnalysisDefinition @@ -418,7 +418,7 @@ def public_caller_contract(plan,runner_source=None): This is static admission, not caller execution or a replacement for smoke. """ with ZipFile(plan['solver_wheel']) as z: - solver=ast.parse(z.read('anysolver/_stiffened_shell_b2_q4_panel_experimental.py').decode()) + solver=ast.parse(z.read('anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py').decode()) with ZipFile(plan['consumer_wheel']) as z: consumer=ast.parse(z.read('anyfem/solve/stiffened_shell_b2.py').decode()) project_io=ast.parse(z.read('anyfem/io/project_file.py').decode()) @@ -478,7 +478,7 @@ def ready(): p['historical_v7']={n:sha(BASE/'execution-v7'/n) for n in ('EXECUTION_SELECTED_PATHS.json','EXECUTION_HANDOFF.json','SERIES_LEDGER.json','EXECUTION_TERMINAL_TREE.json','PRELAUNCH_SEQUENCE_NOTE.json')} p['verified_lifetime']={n:sha(LIFETIME/n) for n in ('SELECTED_PATHS.json','HANDOFF.json','ledger.json','ARTIFACT.json','ROOT_ADOPTION.json','ROOT_ORIGINAL_SOURCE_RECONCILIATION.json','REPORT_COUNT_CORRECTION.md')} p['source'].update({n:sha(ROOT/n) for n in ('scripts/r8_b2_assembly_series_v8_dev.py','tests/test_r8_b2_assembly_series_v8_dev.py','scripts/r8_b2_assembly_series_v8_preflight_dev.py', - 'src/anysolver/e4_pl_element.py','src/anysolver/_stiffened_shell_b2_q4_panel_experimental.py','src/anysolver/_stiffened_shell_b2_assembly_diagnostics.py')}) + 'src/anyfesolver/e4_pl_element.py','src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py','src/anyfesolver/_stiffened_shell_b2_assembly_diagnostics.py')}) p['question']='Does real private-owner retirement allow unchanged connected cold+fivewarm2500/5000/10000 under2GiB? Fresh-constructor/backend peak may still fail.' p['caller_contract']=public_caller_contract(p) p['predecessor_prepared_sha256']=sha(BASE/'PREPARED.json') diff --git a/scripts/r8_b2_assembly_series_v9_dev.py b/scripts/r8_b2_assembly_series_v9_dev.py index 4aa781adf..90ba78379 100644 --- a/scripts/r8_b2_assembly_series_v9_dev.py +++ b/scripts/r8_b2_assembly_series_v9_dev.py @@ -134,11 +134,11 @@ def installed_samples(attempt,plan,size,ordinals,*,smoke=False): # Validate the actual installed graph before any product/scientific import. installed_before=installed_graph(plan);save(attempt/'installed-before-public.json',installed_before) sys.path[:]=[str(site)]+[x for x in sys.path if not Path(x or '.').resolve().is_relative_to(ROOT/'src') - and not Path(x or '.').resolve().is_relative_to(Path('C:/Github/ANYsolver/src'))] + and not Path(x or '.').resolve().is_relative_to(Path('C:/Github/ANYfeSolver/src'))] # Imports and persistence are outside all measured owner constructions. import numpy as np - from anysolver import stiffened_shell as api - from anysolver._stiffened_shell_b2_assembly_diagnostics import capture_assembly + from anyfesolver import stiffened_shell as api + from anyfesolver._stiffened_shell_b2_assembly_diagnostics import capture_assembly from anyfem.solve.stiffened_shell_b2 import ExperimentalB2PhysicalRigidFootprintPanel,SCHEMA_PHYSICAL_FOOTPRINT_SPARSE_V2,save_case,load_case from anyfem.model.project import Project from anyfem.model.records import AnalysisDefinition @@ -418,7 +418,7 @@ def public_caller_contract(plan,runner_source=None): This is static admission, not caller execution or a replacement for smoke. """ with ZipFile(plan['solver_wheel']) as z: - solver=ast.parse(z.read('anysolver/_stiffened_shell_b2_q4_panel_experimental.py').decode()) + solver=ast.parse(z.read('anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py').decode()) with ZipFile(plan['consumer_wheel']) as z: consumer=ast.parse(z.read('anyfem/solve/stiffened_shell_b2.py').decode()) project_io=ast.parse(z.read('anyfem/io/project_file.py').decode()) @@ -479,7 +479,7 @@ def ready(): p['historical_v7']={n:sha(BASE/'execution-v7'/n) for n in ('EXECUTION_SELECTED_PATHS.json','EXECUTION_HANDOFF.json','SERIES_LEDGER.json','EXECUTION_TERMINAL_TREE.json','PRELAUNCH_SEQUENCE_NOTE.json')} p['verified_lifetime']={n:sha(LIFETIME/n) for n in ('SELECTED_PATHS.json','HANDOFF.json','ledger.json','ARTIFACT.json','ROOT_ADOPTION.json','ROOT_ORIGINAL_SOURCE_RECONCILIATION.json','REPORT_COUNT_CORRECTION.md')} p['source'].update({n:sha(ROOT/n) for n in ('scripts/r8_b2_assembly_series_v9_dev.py','tests/test_r8_b2_assembly_series_v9_dev.py','scripts/r8_b2_assembly_series_v9_preflight_dev.py', - 'src/anysolver/e4_pl_element.py','src/anysolver/_stiffened_shell_b2_q4_panel_experimental.py','src/anysolver/_stiffened_shell_b2_assembly_diagnostics.py')}) + 'src/anyfesolver/e4_pl_element.py','src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py','src/anyfesolver/_stiffened_shell_b2_assembly_diagnostics.py')}) p['question']='Does real private-owner retirement allow unchanged connected cold+fivewarm2500/5000/10000 under2GiB? Fresh-constructor/backend peak may still fail.' p['caller_contract']=public_caller_contract(p) p['predecessor_prepared_sha256']=sha(BASE/'PREPARED.json') diff --git a/scripts/r8_b2_attachment_elimination_dev.py b/scripts/r8_b2_attachment_elimination_dev.py index 06890cd5a..63f2a53ab 100644 --- a/scripts/r8_b2_attachment_elimination_dev.py +++ b/scripts/r8_b2_attachment_elimination_dev.py @@ -23,9 +23,9 @@ RSS_CAP = 2*1024**3 TEST_FILES = [ROOT / "tests/test_r8_b2_attachment_elimination_dev.py", ROOT / "tests/test_r8_b2_original_operator_20261010.py"] TEST_COUNT = 32 -HELPER = ROOT / "src/anysolver/_b2_attachment_elimination_dev.py" +HELPER = ROOT / "src/anyfesolver/_b2_attachment_elimination_dev.py" PACKAGE = OUT / "package" -PRODUCT = ROOT / "src/anysolver/_stiffened_shell_b2_q4_panel_experimental.py" +PRODUCT = ROOT / "src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py" def require(condition, message): @@ -49,14 +49,14 @@ def package_identity(base): def binding(): sources = [Path(__file__).resolve(), PRODUCT, HELPER, *TEST_FILES, - ROOT / "src/anysolver/_b2_physical_linear_batch_dev.py", - ROOT / "src/anysolver/_b2_loaded_point_trace_dev.py", + ROOT / "src/anyfesolver/_b2_physical_linear_batch_dev.py", + ROOT / "src/anyfesolver/_b2_loaded_point_trace_dev.py", ROOT / "tests/test_stiffened_shell_b2_q4_panel_experimental.py", ROOT / "tests/test_b2_loaded_point_owner.py", ROOT / "tests/conftest.py"] for path in sources: ast.parse(path.read_text(), filename=str(path)) return {"sources": {p.relative_to(ROOT).as_posix(): sha(p) for p in sources}, - "package_files": package_identity(ROOT / "src/anysolver"), + "package_files": package_identity(ROOT / "src/anyfesolver"), "build_inputs": {name: sha(ROOT/name) for name in ("pyproject.toml", "README.md", "LICENSE", "COPYRIGHT", "THIRD_PARTY_NOTICES.md")}, "controls": TEST_COUNT, "qualification": False, @@ -71,7 +71,7 @@ def package_job(folder, receipt): require(any(p.get("passed") == TEST_COUNT and p.get("exit_code") == 0 for p in passed), "focused source controls must pass before ONE frozen build") snapshot = PACKAGE / "snapshot" - destination = snapshot / "src/anysolver" + destination = snapshot / "src/anyfesolver" if PACKAGE.exists(): original = json.loads((OUT / "attempt-build1/receipt.json").read_text()) require(original["status"] == "failed" and original["binding"]["package_files"] == identity and @@ -84,7 +84,7 @@ def package_job(folder, receipt): else: destination.mkdir(parents=True) for name, digest in identity.items(): - source, target = ROOT / "src/anysolver" / name, destination / name + source, target = ROOT / "src/anyfesolver" / name, destination / name require(sha(source) == digest, "source changed during snapshot") target.parent.mkdir(parents=True, exist_ok=True) shutil.copyfile(source, target) @@ -102,8 +102,8 @@ def package_job(folder, receipt): wheels = list(wheel_dir.glob("*.whl")) require(len(wheels) == 1, "exactly one wheel required") with zipfile.ZipFile(wheels[0]) as archive: - wheel_identity = {name[len("anysolver/"):]: hashlib.sha256(archive.read(name)).hexdigest() - for name in archive.namelist() if name.startswith("anysolver/") and not name.endswith("/")} + wheel_identity = {name[len("anyfesolver/"):]: hashlib.sha256(archive.read(name)).hexdigest() + for name in archive.namelist() if name.startswith("anyfesolver/") and not name.endswith("/")} require(wheel_identity == identity, "source/snapshot/wheel package byte identity required") save(PACKAGE / "manifest.json", {"package_files": identity, "file_count": len(identity), "wheel": str(wheels[0]), "wheel_sha256": sha(wheels[0]), "binding": receipt["binding"]}) @@ -117,7 +117,7 @@ def package_job(folder, receipt): save(folder / "subcommand.json", {"command": command, "cwd": str(ROOT)}) code = subprocess.call(command, cwd=ROOT) require(code == 0, "cold wheel install failed; preserve evidence") - require(package_identity(site / "anysolver") == identity, "wheel/site byte identity required") + require(package_identity(site / "anyfesolver") == identity, "wheel/site byte identity required") manifest.update(installed_site=str(site), installed_files=len(identity)) save(PACKAGE / "manifest.json", manifest) save(folder / "result.json", {"status": operation+"_passed", "exit_code": 0, @@ -149,22 +149,22 @@ def child(folder, authority_path): import numpy as np import scipy import numba - import anysolver - import anysolver._stiffened_shell_b2_q4_panel_experimental as panel - import anysolver._b2_attachment_elimination_dev as helper - import anysolver._b2_physical_linear_batch_dev as batch - import anysolver._b2_loaded_point_trace_dev as loaded + import anyfesolver + import anyfesolver._stiffened_shell_b2_q4_panel_experimental as panel + import anyfesolver._b2_attachment_elimination_dev as helper + import anyfesolver._b2_physical_linear_batch_dev as batch + import anyfesolver._b2_loaded_point_trace_dev as loaded from threadpoolctl import threadpool_info import pytest expected_root = Path(receipt["installed_site"]).resolve() if receipt["installed_site"] else ROOT / "src" actual = Path(panel.__file__).resolve() require(actual.is_relative_to(expected_root) and sha(actual) == receipt["binding"]["sources"][PRODUCT.relative_to(ROOT).as_posix()], "actual imported panel must match source binding within requested source/installed site") - require(package_identity(expected_root / "anysolver") == receipt["binding"]["package_files"], + require(package_identity(expected_root / "anyfesolver") == receipt["binding"]["package_files"], "all imported package files must match source/immutable wheel binding") for module in (panel, helper, batch, loaded): actual_path = Path(module.__file__).resolve() - name = "src/anysolver/"+actual_path.name + name = "src/anyfesolver/"+actual_path.name require(actual_path.is_relative_to(expected_root) and sha(actual_path) == receipt["binding"]["sources"][name], "actual imported affected module must match requested source/site binding") runtime = {"affinity": psutil.Process().cpu_affinity(), "environment": {k: os.environ.get(k) for k in ENV}, @@ -174,7 +174,7 @@ def child(folder, authority_path): "threads": numba.get_num_threads()}, "installed_site": receipt["installed_site"], "imported": {m.__name__: {"path": str(Path(m.__file__).resolve()), "sha256": sha(m.__file__)} - for m in (anysolver, panel, helper, batch, loaded, np, scipy, numba)}} + for m in (anyfesolver, panel, helper, batch, loaded, np, scipy, numba)}} require(runtime["affinity"] == [0] and runtime["environment"] == ENV and runtime["pools"] and all(p["num_threads"] == 1 for p in runtime["pools"]) and runtime["numba"]["disable_jit"] == 1 and runtime["numba"]["threads"] == 1 and diff --git a/scripts/r8_b2_coo_scratch_cleanup_dev.py b/scripts/r8_b2_coo_scratch_cleanup_dev.py index 1643315d5..fe3a80c15 100644 --- a/scripts/r8_b2_coo_scratch_cleanup_dev.py +++ b/scripts/r8_b2_coo_scratch_cleanup_dev.py @@ -17,8 +17,8 @@ ENV={k:'1' for k in ('OMP_NUM_THREADS','OPENBLAS_NUM_THREADS','MKL_NUM_THREADS','NUMEXPR_NUM_THREADS', 'VECLIB_MAXIMUM_THREADS','BLIS_NUM_THREADS','NUMBA_NUM_THREADS','NUMBA_DISABLE_JIT')};ENV['PYTHONOPTIMIZE']='0' TESTS=['tests/test_r8_b2_coo_scratch_cleanup_dev.py','tests/test_r8_b2_assembly_metrics_dev.py','tests/test_stiffened_shell_b2_physical_footprint_batch.py','tests/test_r8_b2_assembly_series_dev.py'] -OWNED=['src/anysolver/_stiffened_shell_b2_q4_panel_experimental.py', - 'src/anysolver/_stiffened_shell_b2_assembly_diagnostics.py','tests/test_r8_b2_coo_scratch_cleanup_dev.py', +OWNED=['src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py', + 'src/anyfesolver/_stiffened_shell_b2_assembly_diagnostics.py','tests/test_r8_b2_coo_scratch_cleanup_dev.py', 'scripts/r8_b2_coo_scratch_cleanup_dev.py'] def sha(p):return hashlib.sha256(Path(p).read_bytes()).hexdigest() @@ -49,7 +49,7 @@ def freeze(): inputs=OWNED+TESTS[1:]+['scripts/r8_b2_assembly_series_dev.py','examples/stiffened_shell_b2_physical_rigid_footprint.py','pyproject.toml', 'scripts/_b3_e4_f03_local_scientific_supervisor.py','scripts/_b3_e4_f03_local_scientific_cases.py'] p=dict(source={n:sha(ROOT/n) for n in inputs},all_solver_source={p.relative_to(ROOT/'src').as_posix():sha(p) - for p in (ROOT/'src/anysolver').rglob('*.py')},tests=TESTS,scope='SMALL_DEVELOPMENT_ONLY',caps=dict(objects=2000000,edges=8000000,buffers=500000,depth=40)) + for p in (ROOT/'src/anyfesolver').rglob('*.py')},tests=TESTS,scope='SMALL_DEVELOPMENT_ONLY',caps=dict(objects=2000000,edges=8000000,buffers=500000,depth=40)) OUT.mkdir(parents=True,exist_ok=True) if (OUT/'PREPARED.json').exists(): version=OUT/'preparations';version.mkdir(exist_ok=True);old=OUT/'PREPARED.json' @@ -69,7 +69,7 @@ def runtime(p,installed=False,scientific=False): base=(OUT/'package/site' if installed else ROOT/'src').resolve() expected=p['package'] if installed else p['all_solver_source'] for n,m in tuple(sys.modules.items()): - if n.split('.')[0]=='anysolver' and getattr(m,'__file__',None): + if n.split('.')[0]=='anyfesolver' and getattr(m,'__file__',None): path=Path(m.__file__).resolve();require(path.is_relative_to(base),'wrong solver import '+n) rel=path.relative_to(base).as_posix();require(rel in expected and sha(path)==expected[rel],'import hash '+n) r['imports'][n]=dict(path=str(path),sha256=sha(path)) @@ -104,7 +104,7 @@ def child(phase,attempt): result=dict(status='PASS_INSTALL',package_files=len(a['package']),reinstalled=(attempt/'install-command.json').exists()) else: installed=phase=='installed';base=OUT/'package/site' if installed else ROOT/'src' - sys.path[:]=[str(base),str(ROOT)]+[x for x in sys.path if Path(x or '.').resolve() not in (ROOT/'src',Path('C:/Github/ANYsolver/src'))] + sys.path[:]=[str(base),str(ROOT)]+[x for x in sys.path if Path(x or '.').resolve() not in (ROOT/'src',Path('C:/Github/ANYfeSolver/src'))] import numpy,scipy,numba,pytest save(attempt/'runtime-before.json',runtime(p,installed,True)) class Counts: diff --git a/scripts/r8_b2_g5_readiness_dev.py b/scripts/r8_b2_g5_readiness_dev.py index 1a17a87c8..f59c2c509 100644 --- a/scripts/r8_b2_g5_readiness_dev.py +++ b/scripts/r8_b2_g5_readiness_dev.py @@ -21,7 +21,7 @@ OUT=ROOT/'docs/agent_plans/development/r8-b2-g5-readiness-20261010' MODELS=ROOT/'scripts/b2_large_scale_development.py' FUNCTIONAL=ROOT/'docs/agent_plans/development/r8-b2-installed-batch-persistence-20261010' -PANEL=ROOT/'src/anysolver/_stiffened_shell_b2_q4_panel_experimental.py' +PANEL=ROOT/'src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py' CONTRACT=ROOT/'docs/agent_plans/B3_GE_E4_PL_B2_COMPLETE_PROGRAMME.md' CONTROL_FILENAME='test_r8_b2_g5_readiness_dev.py' EXPECTED_CONTROLS=8 @@ -280,12 +280,12 @@ def installed_child(attempt,plan): helper=importlib.util.module_from_spec(spec);spec.loader.exec_module(helper) site=Path(plan['artifact']['site']).resolve() sys.path[:]=[str(site)]+[x for x in sys.path if not Path(x or '.').resolve().is_relative_to(ROOT/'src') - and not Path(x or '.').resolve().is_relative_to(Path('C:/Github/ANYsolver/src'))] + and not Path(x or '.').resolve().is_relative_to(Path('C:/Github/ANYfeSolver/src'))] owner=None;record=dict(status='UNRESOLVED',performance_acceptance=False,qualification=False) accepted=[];start=time.perf_counter() try: import numpy as np - from anysolver import stiffened_shell as api + from anyfesolver import stiffened_shell as api from anyfem.solve.stiffened_shell_b2 import load_case p=dict(site=str(site),package=plan['artifact']['package']) helper.save(attempt/'runtime-before.json',helper.runtime(p));imported=time.perf_counter() @@ -386,7 +386,7 @@ def prepare(): FUNCTIONAL/'v2/attempt-full-01/receipt.json',FUNCTIONAL/'v3-beam/attempt-beam-01/result.json', FUNCTIONAL/'v3-beam/attempt-beam-01/receipt.json',FUNCTIONAL/'v3-beam/PREPARED.json'] ast.parse(Path(__file__).read_text()) - for name,h in artifact['current_b2_sources'].items():require(sha(ROOT/'src/anysolver'/name)==h,'relevant B2 source/artifact drift') + for name,h in artifact['current_b2_sources'].items():require(sha(ROOT/'src/anyfesolver'/name)==h,'relevant B2 source/artifact drift') plan=dict(status='PREPARED_REQUIRED_INPUTS_OPEN',execution_authorized=False,numerical_runs=0, source_bindings={str(p.relative_to(ROOT)):sha(p) for p in refs},artifact=dict(site=artifact['site'], solver_sha256=artifact['solver_sha256'],consumer_sha256=artifact['consumer_sha256'],package=artifact['package']), @@ -421,7 +421,7 @@ def prepare(): canonical_sha256=full['persistence']['canonical_sha256'],transformation=full['matrices']['T']), measurement_components=['cached_sequence_series','cached_rhs_series','fresh_owner_series','constructor_phase_map'], acceptance=False,qualification=False,performance_claim=False,mandatory_mistral_review='PENDING') - plan['source_bindings'].update({str((ROOT/'src/anysolver'/name).relative_to(ROOT)):h + plan['source_bindings'].update({str((ROOT/'src/anyfesolver'/name).relative_to(ROOT)):h for name,h in artifact['current_b2_sources'].items()}) for path in (ROOT/plan['frozen_case']['path'],ROOT/'scripts/_b3_e4_f03_local_scientific_supervisor.py', ROOT/'scripts/_b3_e4_f03_local_scientific_cases.py'): diff --git a/scripts/r8_b2_installed_batch_persistence_dev.py b/scripts/r8_b2_installed_batch_persistence_dev.py index ada867010..04b2a3f30 100644 --- a/scripts/r8_b2_installed_batch_persistence_dev.py +++ b/scripts/r8_b2_installed_batch_persistence_dev.py @@ -108,9 +108,9 @@ def prepare(solver,consumer): require(sha(solver)==SOLVER_SHA and sha(consumer)==CONSUMER_SHA,'adopted wheel identity') require(sha(BUILDER)==json.loads((BUILDER.parent/'preflight.json').read_text())['builder_sha256'], 'original builder drift') - packages=package(solver,'anysolver')|package(consumer,'anyfem') + packages=package(solver,'anyfesolver')|package(consumer,'anyfem') for name in prior.B2_FILES: - require(sha(ROOT/'src/anysolver'/name)==packages['anysolver/'+name],'B2 current-source drift '+name) + require(sha(ROOT/'src/anyfesolver'/name)==packages['anyfesolver/'+name],'B2 current-source drift '+name) closure=json.loads((BASE/'CONSUMER_SOURCE_CLOSURE.json').read_text()) require(closure['wheel_sha256']==CONSUMER_SHA and closure['mismatches']==['anyfem/solve/stiffened_shell.py'], 'consumer closure changed; root artifact decision needed') @@ -123,7 +123,7 @@ def prepare(solver,consumer): p=dict(status='PREPARED_SLOT_HELD',solver_wheel=str(Path(solver).resolve()),consumer_wheel=str(Path(consumer).resolve()), solver_sha256=SOLVER_SHA,consumer_sha256=CONSUMER_SHA,package=packages, site=str(BASE/'package/site'),source={str(p.relative_to(ROOT)):sha(p) for p in paths}, - current_b2_sources={name:sha(ROOT/'src/anysolver'/name) for name in prior.B2_FILES}, + current_b2_sources={name:sha(ROOT/'src/anyfesolver'/name) for name in prior.B2_FILES}, consumer_choice_required='frozen84b738-B2-route-GE-delta-explicit',consumer_source_delta=closure['mismatches'], matrix_sha256=prior.EXPECTED_MATRICES, full=dict(nx=100,ny=100,shells=10000,members=1000,pads=100,incidences=400,rows=2000, @@ -159,7 +159,7 @@ def prepare(solver,consumer): def assert_prepared(p): require(sha(p['solver_wheel'])==p['solver_sha256'] and sha(p['consumer_wheel'])==p['consumer_sha256'],'wheel drift') for name,value in p['source'].items():require(sha(ROOT/name)==value,'prepared source drift '+name) - for name,value in p['current_b2_sources'].items():require(sha(ROOT/'src/anysolver'/name)==value,'B2 source drift '+name) + for name,value in p['current_b2_sources'].items():require(sha(ROOT/'src/anyfesolver'/name)==value,'B2 source drift '+name) if 'reused_install' in p: require(sha(BASE/'attempt-install-01/receipt.json')==p['reused_install']['receipt_sha256'] and sha(BASE/'attempt-install-01/result.json')==p['reused_install']['result_sha256'] @@ -178,7 +178,7 @@ def runtime(p): from threadpoolctl import threadpool_info site=Path(p['site']).resolve();imports={} for name,m in tuple(sys.modules.items()): - if name.split('.')[0] in ('anysolver','anyfem') and getattr(m,'__file__',None): + if name.split('.')[0] in ('anyfesolver','anyfem') and getattr(m,'__file__',None): file=Path(m.__file__).resolve();require(file.is_relative_to(site),'source import '+name) relative=file.relative_to(site).as_posix() require(relative in p['package'] and sha(file)==p['package'][relative],'actual installed hash '+name) @@ -205,12 +205,12 @@ def execute_installed(phase,attempt,p): site=Path(p['site']).resolve() sys.path[:]=[str(site)]+[s for s in sys.path if Path(s or '.').resolve()!=site and not Path(s or '.').resolve().is_relative_to(ROOT/'src') - and not Path(s or '.').resolve().is_relative_to(Path('C:/Github/ANYsolver/src'))] + and not Path(s or '.').resolve().is_relative_to(Path('C:/Github/ANYfeSolver/src'))] for name,h in p['package'].items():require(sha(site/name)==h,'combined site mismatch '+name) import numpy as np import scipy - from anysolver import stiffened_shell as api - from anysolver.linalg import backend_operation_counts + from anyfesolver import stiffened_shell as api + from anyfesolver.linalg import backend_operation_counts from anyfem.solve.stiffened_shell_b2 import (ExperimentalB2PhysicalRigidFootprintPanel, SCHEMA_PHYSICAL_FOOTPRINT_SPARSE_V2,save_case,load_case) from anyfem.solve.stiffened_shell_project import point_panel_from_analysis diff --git a/scripts/r8_b2_installed_original_target_dev.py b/scripts/r8_b2_installed_original_target_dev.py index dc64480d2..bc3ef48ce 100644 --- a/scripts/r8_b2_installed_original_target_dev.py +++ b/scripts/r8_b2_installed_original_target_dev.py @@ -56,17 +56,17 @@ def package_identity(site,wheel): package={} with ZipFile(wheel) as archive: for name in archive.namelist(): - if name.startswith('anysolver/') and not name.endswith('/'): + if name.startswith('anyfesolver/') and not name.endswith('/'): require('..' not in Path(name).parts,'wheel path refusal') expected=hashlib.sha256(archive.read(name)).hexdigest() require(sha(site/name)==expected,'wheel/site mismatch '+name) package[name]=expected - require(package and all('anysolver/'+name in package for name in B2_FILES),'package closure missing') + require(package and all('anyfesolver/'+name in package for name in B2_FILES),'package closure missing') for name in B2_FILES: - require(sha(ROOT/'src/anysolver'/name)==package['anysolver/'+name], + require(sha(ROOT/'src/anyfesolver'/name)==package['anyfesolver/'+name], 'current B2 source/site mismatch '+name) return dict(site=str(site),wheel=str(wheel),wheel_sha256=sha(wheel),package=package, - relevant_current_sources={name:sha(ROOT/'src/anysolver'/name) for name in B2_FILES}) + relevant_current_sources={name:sha(ROOT/'src/anyfesolver'/name) for name in B2_FILES}) def preparation(site,wheel): @@ -104,7 +104,7 @@ def child(attempt): bound=json.loads((attempt/'binding.json').read_text());p=bound['preparation'];artifact=p['artifact'] require(package_identity(artifact['site'],artifact['wheel'])==artifact,'artifact/source drift before import') for relative,expected in p['source'].items():require(sha(ROOT/relative)==expected,'development source drift') - forbidden=(ROOT/'src',Path('C:/Github/ANYsolver/src')) + forbidden=(ROOT/'src',Path('C:/Github/ANYfeSolver/src')) sys.path[:]=[artifact['site']]+[entry for entry in sys.path if Path(entry or '.').resolve()!=Path(artifact['site']).resolve() and not any(Path(entry or '.').resolve().is_relative_to(base) for base in forbidden)] @@ -114,16 +114,16 @@ def child(attempt): import scipy import numba from threadpoolctl import threadpool_info - import anysolver - from anysolver import stiffened_shell as api - import anysolver._stiffened_shell_b2_q4_panel_experimental as panel - from anysolver.linalg import backend_operation_counts + import anyfesolver + from anyfesolver import stiffened_shell as api + import anyfesolver._stiffened_shell_b2_q4_panel_experimental as panel + from anyfesolver.linalg import backend_operation_counts site=Path(artifact['site']).resolve() def runtime(): imports={} for name,module in tuple(sys.modules.items()): - if name=='anysolver' or name.startswith('anysolver.'): + if name=='anyfesolver' or name.startswith('anyfesolver.'): file=getattr(module,'__file__',None) if file: file=Path(file).resolve();require(file.is_relative_to(site),'source product import '+name) diff --git a/scripts/r8_b2_original_operator_dev.py b/scripts/r8_b2_original_operator_dev.py index 5cc231263..fd0aa5c03 100644 --- a/scripts/r8_b2_original_operator_dev.py +++ b/scripts/r8_b2_original_operator_dev.py @@ -20,7 +20,7 @@ "NUMBA_NUM_THREADS", "NUMBA_DISABLE_JIT")} RSS_CAP = 2*1024**3 TEST_FILE = ROOT / "tests/test_r8_b2_original_operator_20261010.py" -PRODUCT = ROOT / "src/anysolver/_stiffened_shell_b2_q4_panel_experimental.py" +PRODUCT = ROOT / "src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py" OLD = ROOT / "docs/agent_plans/development/r8-b2-compensated-refinement-20261009" @@ -40,8 +40,8 @@ def save(path, record): def binding(): sources = [Path(__file__).resolve(), PRODUCT, TEST_FILE, - ROOT / "src/anysolver/_b2_physical_linear_batch_dev.py", - ROOT / "src/anysolver/_b2_loaded_point_trace_dev.py", + ROOT / "src/anyfesolver/_b2_physical_linear_batch_dev.py", + ROOT / "src/anyfesolver/_b2_loaded_point_trace_dev.py", ROOT / "examples/stiffened_shell_b2_physical_rigid_footprint.py", ROOT / "tests/test_stiffened_shell_b2_q4_panel_experimental.py", ROOT / "tests/test_b2_loaded_point_owner.py"] @@ -73,8 +73,8 @@ def child(folder, authority_path): import numpy as np import scipy import numba - import anysolver - import anysolver._stiffened_shell_b2_q4_panel_experimental as panel + import anyfesolver + import anyfesolver._stiffened_shell_b2_q4_panel_experimental as panel from threadpoolctl import threadpool_info import pytest expected_root = Path(receipt["installed_site"]).resolve() if receipt["installed_site"] else ROOT / "src" @@ -88,7 +88,7 @@ def child(folder, authority_path): "threads": numba.get_num_threads()}, "installed_site": receipt["installed_site"], "imported": {m.__name__: {"path": str(Path(m.__file__).resolve()), "sha256": sha(m.__file__)} - for m in (anysolver, panel, np, scipy, numba)}} + for m in (anyfesolver, panel, np, scipy, numba)}} require(runtime["affinity"] == [0] and runtime["environment"] == ENV and runtime["pools"] and all(p["num_threads"] == 1 for p in runtime["pools"]) and runtime["numba"]["disable_jit"] == 1 and runtime["numba"]["threads"] == 1 and diff --git a/scripts/r8_b2_physical_work_unblock_dev.py b/scripts/r8_b2_physical_work_unblock_dev.py index 26b17c9fc..bbfaa3082 100644 --- a/scripts/r8_b2_physical_work_unblock_dev.py +++ b/scripts/r8_b2_physical_work_unblock_dev.py @@ -24,10 +24,10 @@ CAPS = dict(seconds=60., rss_bytes=2*1024**3, operations=50000000, bits=4096, fill=4000000, factor_fill=50000000, row_terms=8192) SOURCES = ('scripts/r8_b2_physical_work_unblock_dev.py', - 'src/anysolver/_stiffened_shell_b2_q4_panel_experimental.py', - 'src/anysolver/_b2_physical_linear_batch_dev.py', - 'src/anysolver/_stiffened_shell_b2_affine_resolution.py', - 'src/anysolver/linalg.py', 'src/anysolver/threading_policy.py', + 'src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py', + 'src/anyfesolver/_b2_physical_linear_batch_dev.py', + 'src/anyfesolver/_stiffened_shell_b2_affine_resolution.py', + 'src/anyfesolver/linalg.py', 'src/anyfesolver/threading_policy.py', 'scripts/_b3_e4_f03_local_scientific_supervisor.py', 'scripts/_b3_e4_f03_local_scientific_cases.py') @@ -49,10 +49,10 @@ def save(path, value): def static_binding(): reg = json.loads((OLD/'registration.json').read_text()) require(sha(ARCHIVE) == reg['saved_state_sha256'], 'original archive drift') - require(sha(ROOT/'src/anysolver/linalg.py') == reg['old_linalg_source_sha256'], + require(sha(ROOT/'src/anyfesolver/linalg.py') == reg['old_linalg_source_sha256'], 'same factor implementation required') - frozen = ROOT/'docs/agent_plans/development/r8-b2-refinement-installed-20261009/site-v2/anysolver' - require(sha(ROOT/'src/anysolver/threading_policy.py') == sha(frozen/'threading_policy.py'), + frozen = ROOT/'docs/agent_plans/development/r8-b2-refinement-installed-20261009/site-v2/anyfesolver' + require(sha(ROOT/'src/anyfesolver/threading_policy.py') == sha(frozen/'threading_policy.py'), 'factor thread policy drift') segments = [] for p in (ROOT/SOURCES[1], frozen/'_stiffened_shell_b2_q4_panel_experimental.py'): @@ -137,8 +137,8 @@ def child(attempt): import scipy import numba from threadpoolctl import threadpool_info - import anysolver._stiffened_shell_b2_q4_panel_experimental as panel - from anysolver.linalg import MatrixClass, factorize_cached + import anyfesolver._stiffened_shell_b2_q4_panel_experimental as panel + from anyfesolver.linalg import MatrixClass, factorize_cached def runtime(): value=dict(affinity=psutil.Process().cpu_affinity(),environment={k:os.environ.get(k) for k in ENV}, diff --git a/scripts/r8_b2_q4_lifetime_dev.py b/scripts/r8_b2_q4_lifetime_dev.py index 72bb40fef..4917c8e8d 100644 --- a/scripts/r8_b2_q4_lifetime_dev.py +++ b/scripts/r8_b2_q4_lifetime_dev.py @@ -17,8 +17,8 @@ ENV={k:'1' for k in ('OMP_NUM_THREADS','OPENBLAS_NUM_THREADS','MKL_NUM_THREADS','NUMEXPR_NUM_THREADS', 'VECLIB_MAXIMUM_THREADS','BLIS_NUM_THREADS','NUMBA_NUM_THREADS','NUMBA_DISABLE_JIT')};ENV['PYTHONOPTIMIZE']='0';ENV['PYTHONDONTWRITEBYTECODE']='1' TESTS=['tests/test_r8_b2_q4_lifetime_dev.py','tests/test_r8_b2_assembly_metrics_dev.py','tests/test_stiffened_shell_b2_physical_footprint_batch.py'] -OWNED=['src/anysolver/_stiffened_shell_b2_q4_panel_experimental.py', - 'src/anysolver/e4_pl_element.py','tests/test_r8_b2_q4_lifetime_dev.py', +OWNED=['src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py', + 'src/anyfesolver/e4_pl_element.py','tests/test_r8_b2_q4_lifetime_dev.py', 'scripts/r8_b2_q4_lifetime_dev.py'] def sha(p):return hashlib.sha256(Path(p).read_bytes()).hexdigest() @@ -49,7 +49,7 @@ def freeze(): inputs=OWNED+TESTS[1:]+['scripts/r8_b2_assembly_series_dev.py','examples/stiffened_shell_b2_physical_rigid_footprint.py','examples/stiffened_shell_b2_mixed_panel.py','pyproject.toml', 'scripts/_b3_e4_f03_local_scientific_supervisor.py','scripts/_b3_e4_f03_local_scientific_cases.py'] p=dict(source={n:sha(ROOT/n) for n in inputs},all_solver_source={p.relative_to(ROOT/'src').as_posix():sha(p) - for p in (ROOT/'src/anysolver').rglob('*.py')},tests=TESTS,scope='SMALL_DEVELOPMENT_ONLY',caps=dict(objects=2000000,edges=8000000,buffers=500000,depth=40)) + for p in (ROOT/'src/anyfesolver').rglob('*.py')},tests=TESTS,scope='SMALL_DEVELOPMENT_ONLY',caps=dict(objects=2000000,edges=8000000,buffers=500000,depth=40)) OUT.mkdir(parents=True,exist_ok=True) if (OUT/'PREPARED.json').exists(): version=OUT/'preparations';version.mkdir(exist_ok=True);old=OUT/'PREPARED.json' @@ -69,7 +69,7 @@ def runtime(p,installed=False,scientific=False): base=(OUT/'package/site-v2' if installed else ROOT/'src').resolve() expected=p['package'] if installed else p['all_solver_source'] for n,m in tuple(sys.modules.items()): - if n.split('.')[0]=='anysolver' and getattr(m,'__file__',None): + if n.split('.')[0]=='anyfesolver' and getattr(m,'__file__',None): path=Path(m.__file__).resolve();require(path.is_relative_to(base),'wrong solver import '+n) rel=path.relative_to(base).as_posix();require(rel in expected and sha(path)==expected[rel],'import hash '+n) r['imports'][n]=dict(path=str(path),sha256=sha(path)) @@ -104,7 +104,7 @@ def child(phase,attempt): result=dict(status='PASS_INSTALL',package_files=len(a['package']),reinstalled=(attempt/'install-command.json').exists()) else: installed=phase=='installed';base=OUT/'package/site-v2' if installed else ROOT/'src' - sys.path[:]=[str(base),str(ROOT)]+[x for x in sys.path if Path(x or '.').resolve() not in (ROOT/'src',Path('C:/Github/ANYsolver/src'))] + sys.path[:]=[str(base),str(ROOT)]+[x for x in sys.path if Path(x or '.').resolve() not in (ROOT/'src',Path('C:/Github/ANYfeSolver/src'))] import numpy,scipy,numba,pytest save(attempt/'runtime-before.json',runtime(p,installed,True)) class Counts: diff --git a/scripts/r8_b2_remaining_scale_dev.py b/scripts/r8_b2_remaining_scale_dev.py index 4c17bba32..db57de7a1 100644 --- a/scripts/r8_b2_remaining_scale_dev.py +++ b/scripts/r8_b2_remaining_scale_dev.py @@ -63,8 +63,8 @@ def save(path,data): def product_package(inventory): - """PRODUCT namespace map (anysolver/anyfem) only; never a raw wheel RECORD.""" - package={n:h for n,h in inventory['files'].items() if n.startswith(('anysolver/','anyfem/'))} + """PRODUCT namespace map (anyfesolver/anyfem) only; never a raw wheel RECORD.""" + package={n:h for n,h in inventory['files'].items() if n.startswith(('anyfesolver/','anyfem/'))} require(package and not any('.dist-info' in n or n.startswith('bin/') for n in package), 'product namespace contamination') return package @@ -150,7 +150,7 @@ def prepare(): require(h.BEAM_BUILDER.is_file(),'registered beam-rich builder missing') package=product_package(inventory) original=h.module('b2_public_static_identity',ORIGINAL) - require(all('anysolver/'+name in package for name in original.B2_FILES), + require(all('anyfesolver/'+name in package for name in original.B2_FILES), 'product package closure missing B2 files') problems=graph_mismatch(plan['package_site'],inventory) require(not problems,'installed site graph drift before preparation: '+', '.join(problems[:8])) diff --git a/scripts/r8_b2_s3_physical_footprint_dev.py b/scripts/r8_b2_s3_physical_footprint_dev.py index 133fe6101..8e2237d52 100644 --- a/scripts/r8_b2_s3_physical_footprint_dev.py +++ b/scripts/r8_b2_s3_physical_footprint_dev.py @@ -12,7 +12,7 @@ PYTHONDONTWRITEBYTECODE='1',PYTEST_DISABLE_PLUGIN_AUTOLOAD='1',PYTEST_ADDOPTS='',PYTHONPATH='') def sha(p):return hashlib.sha256(Path(p).read_bytes()).hexdigest() def write(p,v):Path(p).write_text(json.dumps(v,indent=2,allow_nan=False)+'\n') -def identities():return {str(p.relative_to(ROOT)):sha(p) for p in [NEW,OLD,Path(__file__),*sorted((ROOT/'src/anysolver').rglob('*.py'))]} +def identities():return {str(p.relative_to(ROOT)):sha(p) for p in [NEW,OLD,Path(__file__),*sorted((ROOT/'src/anyfesolver').rglob('*.py'))]} def child(stage,out,focus=None): import psutil psutil.Process().cpu_affinity([0]);selected=ROOT/'src' if stage=='source' else HERE/'site' @@ -43,9 +43,9 @@ def run(stage,focus=None): frozen=json.loads(prior[0].read_text());build=Path(frozen['build_input']) assert all(sha(build/'src'/rel)==v for rel,v in frozen['source'].items()) else: - build=out/'input';build.mkdir();shutil.copytree(ROOT/'src/anysolver',build/'src/anysolver',ignore=shutil.ignore_patterns('__pycache__','*.pyc')) + build=out/'input';build.mkdir();shutil.copytree(ROOT/'src/anyfesolver',build/'src/anyfesolver',ignore=shutil.ignore_patterns('__pycache__','*.pyc')) for n in ('pyproject.toml','README.md','LICENSE','COPYRIGHT','THIRD_PARTY_NOTICES.md'):shutil.copy2(ROOT/n,build/n) - snapshot={str(p.relative_to(build/'src')):sha(p) for p in (build/'src/anysolver').rglob('*.py')} + snapshot={str(p.relative_to(build/'src')):sha(p) for p in (build/'src/anyfesolver').rglob('*.py')} assert all(v==ids[str(Path('src')/rel)] for rel,v in snapshot.items()),'source changed during immutable build snapshot' frozen=dict(source=snapshot,build_input=str(build)) write(out/'frozen-source.json',frozen) diff --git a/scripts/r8_bl5_affine_flexible_native_dev.py b/scripts/r8_bl5_affine_flexible_native_dev.py index 63d2238bf..10e873add 100644 --- a/scripts/r8_bl5_affine_flexible_native_dev.py +++ b/scripts/r8_bl5_affine_flexible_native_dev.py @@ -114,14 +114,14 @@ def run(site, wheel, source, fixtures, external, output, *, nx=16, cases=('fy', require(nx == 16 or support_count == 16 or tuple(cases) == ('mx',), 'the fixed-eight finer discriminator is Mx only') require(basis in ('discontinuous_p1', 'discontinuous_p1_cell_average'), 'explicit tested density basis required') require(basis != 'discontinuous_p1_cell_average' or (nx,support_count)==(16,8), 'projected comparison is bounded to the checked coarse fixture') - require(not any(n.split('.')[0] == 'anysolver' for n in sys.modules), 'fresh installed process required') + require(not any(n.split('.')[0] == 'anyfesolver' for n in sys.modules), 'fresh installed process required') site, fixtures = site.resolve(strict=True), fixtures.resolve(strict=True) sys.path[:0] = [str(site), str(fixtures)] import numpy as np import numba from threadpoolctl import threadpool_info - import anysolver - from anysolver import stiffened_shell + import anyfesolver + from anyfesolver import stiffened_shell import b3_e4_bl5_coherent_aggregation_dev as coherent import b3_e4_bl5_matched_mz_native_dev as matched import b3_e4_bl5_matched_p0_native_refinement_dev as inventory @@ -143,10 +143,10 @@ def run(site, wheel, source, fixtures, external, output, *, nx=16, cases=('fy', require(isinstance(expected_wheel_sha,str) and len(expected_wheel_sha)==64 and sha(wheel) == expected_wheel_sha, 'declared installed wheel required') modules = {} - source_files = {'anysolver/'+p.relative_to(source/'src/anysolver').as_posix(): p - for p in (source/'src/anysolver').rglob('*.py')} + source_files = {'anyfesolver/'+p.relative_to(source/'src/anyfesolver').as_posix(): p + for p in (source/'src/anyfesolver').rglob('*.py')} with zipfile.ZipFile(wheel) as archive: - names = {n for n in archive.namelist() if n.startswith('anysolver/') and n.endswith('.py')} + names = {n for n in archive.namelist() if n.startswith('anyfesolver/') and n.endswith('.py')} require(len(names) == 417 and names == set(source_files), 'complete417module graph required') for name in sorted(names): data = archive.read(name) @@ -156,7 +156,7 @@ def run(site, wheel, source, fixtures, external, output, *, nx=16, cases=('fy', require(pools and all(p['num_threads'] == 1 for p in pools) and numba.get_num_threads() == 1 and numba.config.DISABLE_JIT, 'effective one-thread/JIT-off settings required') write('identity', {'wheel_sha256': expected_wheel_sha, 'wheel': str(wheel), 'module_sha256': modules, - 'anysolver_import': anysolver.__file__, 'pools': pools, 'numba_threads': numba.get_num_threads(), + 'anyfesolver_import': anyfesolver.__file__, 'pools': pools, 'numba_threads': numba.get_num_threads(), 'jit_disabled': bool(numba.config.DISABLE_JIT), 'helpers': {Path(m.__file__).name: sha(m.__file__) for m in (coherent, matched, inventory)}}) definition, policy = support_model(coherent, nx, support_count, basis=basis) @@ -282,7 +282,7 @@ def run(site, wheel, source, fixtures, external, output, *, nx=16, cases=('fy', summary['cases'][case] = {'checks': checks, 'work_J': work, 'raw_state_sha256': sha(folder/'raw-state.npz')} require(owner.preflight()['reference_linear_factorizations'] == 1, 'one eligible factor for selected compatible loads') imports = {n: str(Path(m.__file__).resolve()) for n, m in sys.modules.copy().items() - if n.split('.')[0] == 'anysolver' and getattr(m, '__file__', None)} + if n.split('.')[0] == 'anyfesolver' and getattr(m, '__file__', None)} require(all(Path(p).is_relative_to(site) for p in imports.values()), 'canonical installed imports required') summary.update(status='COMPLETED_DEVELOPMENT_ONLY', imports=imports, preflight=owner.preflight()) except BaseException as error: diff --git a/scripts/r8_bl5_affine_support_screen_dev.py b/scripts/r8_bl5_affine_support_screen_dev.py index 890467f7f..d4f6714c1 100644 --- a/scripts/r8_bl5_affine_support_screen_dev.py +++ b/scripts/r8_bl5_affine_support_screen_dev.py @@ -25,9 +25,9 @@ def affine_force_moment(left, right, a, b, order): def run(output): from scipy.integrate import quad from scipy.sparse import save_npz - import numba, anysolver + import numba, anyfesolver from threadpoolctl import threadpool_info - from anysolver import stiffened_shell as api + from anyfesolver import stiffened_shell as api from b3_e4_bl5_coherent_aggregation_dev import model, physical_transfer from r8_bl5_affine_carrier_reference_dev import solve_affine_carrier from r8_bl5_p0_carrier_reference_dev import solve_p0_carrier @@ -65,7 +65,7 @@ def run(output): p0_vs_strong=(p0.transfer_moments()/strong-1.).tolist(), affine_vs_strong=(p1.transfer_moments()/strong-1.).tolist())) summary = dict(status="IN_PROGRESS", qualification="EXPERIMENTAL_NOT_QUALIFIED", - imports=dict(anysolver=anysolver.__file__), settings=dict(pools=pools, + imports=dict(anyfesolver=anyfesolver.__file__), settings=dict(pools=pools, numba_threads=numba.get_num_threads(), jit_disabled=True), physical=dict(length_m=1., EI_z_Nm2=bending, kGA_y_N=shear, Mz_tip_Nm=moment, shell_width_m=.2, shell_thickness_m=.035, beam_axis_z_m=.0675, diff --git a/scripts/r8_bl5_body_port_probe.py b/scripts/r8_bl5_body_port_probe.py index b437b1590..c132f37a2 100644 --- a/scripts/r8_bl5_body_port_probe.py +++ b/scripts/r8_bl5_body_port_probe.py @@ -13,8 +13,8 @@ import numpy as np from scipy import sparse from scipy.sparse.linalg import splu -from anysolver import stiffened_shell as ss -from anysolver._stiffened_shell_ge_experimental import _linear_equilibrium +from anyfesolver import stiffened_shell as ss +from anyfesolver._stiffened_shell_ge_experimental import _linear_equilibrium from scripts import r8_bl5_matched_native_reference as matched from scripts import r8_bl5_weak_continuum_reference as continuum diff --git a/scripts/r8_bl5_c1_common_end_load_work_dev.py b/scripts/r8_bl5_c1_common_end_load_work_dev.py index fee382bed..e1b8a4bfa 100644 --- a/scripts/r8_bl5_c1_common_end_load_work_dev.py +++ b/scripts/r8_bl5_c1_common_end_load_work_dev.py @@ -9,7 +9,7 @@ import json from pathlib import Path -import anysolver +import anyfesolver import numba import numpy as np import psutil @@ -54,8 +54,8 @@ def _face_loads(lines: list[str], bar: set[int]) -> dict[int, np.ndarray]: def evaluate() -> dict: - if Path(anysolver.__file__).resolve().parent != (ROOT / "src" / "anysolver").resolve(): - raise RuntimeError("wrong ANYsolver checkout") + if Path(anyfesolver.__file__).resolve().parent != (ROOT / "src" / "anyfesolver").resolve(): + raise RuntimeError("wrong ANYfeSolver checkout") meta_path = SOLID / "metadata.json" meta = json.loads(meta_path.read_text(encoding="utf-8")) if meta["identity"] != "R8_BL5_C1_DETACHED_F2_FIVE_CHANNEL_DEV_V7": @@ -142,7 +142,7 @@ def evaluate() -> dict: "numba_disable_jit": int(numba.config.DISABLE_JIT), "numba_threads": numba.get_num_threads(), "threadpools": threadpool_info(), - "anysolver_import": str(Path(anysolver.__file__).resolve()), + "anyfesolver_import": str(Path(anyfesolver.__file__).resolve()), }, "limitation": "eleven hand-selected low-order fields, six support-admissible; no arbitrary face-warping or broken-port equivalence, loaded response, root parity, BL5/F03 acceptance", } diff --git a/scripts/r8_bl5_c1_interval_transfer_dev.py b/scripts/r8_bl5_c1_interval_transfer_dev.py index ec0d31767..b09151ace 100644 --- a/scripts/r8_bl5_c1_interval_transfer_dev.py +++ b/scripts/r8_bl5_c1_interval_transfer_dev.py @@ -11,7 +11,7 @@ import json from pathlib import Path -import anysolver +import anyfesolver import numpy as np from scipy import sparse from scipy.sparse.linalg import splu @@ -213,8 +213,8 @@ def _solid() -> dict: def evaluate() -> dict: - if Path(anysolver.__file__).resolve().parent != (ROOT / "src" / "anysolver").resolve(): - raise RuntimeError("wrong ANYsolver source checkout") + if Path(anyfesolver.__file__).resolve().parent != (ROOT / "src" / "anyfesolver").resolve(): + raise RuntimeError("wrong ANYfeSolver source checkout") native, solid = _native(), _solid() comparison = {} for name in ("fy", "mx"): diff --git a/scripts/r8_bl5_c1_native_solid_common_work_dev.py b/scripts/r8_bl5_c1_native_solid_common_work_dev.py index 0a09ceebd..5ebede61b 100644 --- a/scripts/r8_bl5_c1_native_solid_common_work_dev.py +++ b/scripts/r8_bl5_c1_native_solid_common_work_dev.py @@ -10,14 +10,14 @@ import json from pathlib import Path -import anysolver +import anyfesolver import numba import numpy as np import psutil from threadpoolctl import threadpool_info -from anysolver._stiffened_shell_bl5_local_experimental import BL5LocalOperator, LAW_ID -from anysolver._stiffened_shell_l1_local_experimental import NativeHalfCellPort +from anyfesolver._stiffened_shell_bl5_local_experimental import BL5LocalOperator, LAW_ID +from anyfesolver._stiffened_shell_l1_local_experimental import NativeHalfCellPort from scripts._b3_e4_f03_native_fixture import build from scripts.b3_e4_f03_plate_patch_work import local_grid from scripts.b3_e4_f03_square_section_control import square_torsion_constant @@ -127,8 +127,8 @@ def _solid_displacement(name, p, domain): def evaluate(): - if Path(anysolver.__file__).resolve().parent != (ROOT / "src" / "anysolver").resolve(): - raise RuntimeError("wrong ANYsolver checkout") + if Path(anyfesolver.__file__).resolve().parent != (ROOT / "src" / "anyfesolver").resolve(): + raise RuntimeError("wrong ANYfeSolver checkout") meta = json.loads((SOLID / "metadata.json").read_text(encoding="utf-8")) deck = SOLID / "fy.inp" if (_sha(deck) != meta["cases"]["fy"]["deck_sha256"] or @@ -204,7 +204,7 @@ def evaluate(): "numba_disable_jit": int(numba.config.DISABLE_JIT), "numba_threads": numba.get_num_threads(), "threadpools": threadpool_info(), - "anysolver_import": str(Path(anysolver.__file__).resolve())}, + "anyfesolver_import": str(Path(anyfesolver.__file__).resolve())}, "limitation": "low-order common virtual fields only; no native broken-trace equivalence, load solution, physical accuracy or F03 acceptance"} diff --git a/scripts/r8_bl5_c1_offratio_native_dev.py b/scripts/r8_bl5_c1_offratio_native_dev.py index a6d2d739f..895ae3329 100644 --- a/scripts/r8_bl5_c1_offratio_native_dev.py +++ b/scripts/r8_bl5_c1_offratio_native_dev.py @@ -11,12 +11,12 @@ import json from pathlib import Path -import anysolver +import anyfesolver import numpy as np from scipy import sparse -from anysolver._stiffened_shell_bl5_local_experimental import BL5LocalOperator, LAW_ID -from anysolver._stiffened_shell_l1_local_experimental import NativeHalfCellPort +from anyfesolver._stiffened_shell_bl5_local_experimental import BL5LocalOperator, LAW_ID +from anyfesolver._stiffened_shell_l1_local_experimental import NativeHalfCellPort from scripts._b3_e4_f03_native_fixture import build from scripts.b3_e4_f03_c1_fy_supported_native import _wrench from scripts.b3_e4_f03_material_line_loaded import _scales, _solve @@ -83,8 +83,8 @@ def _rows(samples, size, basis): def evaluate(): - if Path(anysolver.__file__).resolve().parent != (ROOT / "src" / "anysolver").resolve(): - raise RuntimeError("wrong ANYsolver source checkout") + if Path(anyfesolver.__file__).resolve().parent != (ROOT / "src" / "anyfesolver").resolve(): + raise RuntimeError("wrong ANYfeSolver source checkout") xs, ys = local_grid(8, transverse_cells=4) shell, _ = raw_e4_tangent(xs, ys, thickness=.035) beam = build(14, z_offset=.0675, diff --git a/scripts/r8_bl5_c1_solid_p0_counterfactual_dev.py b/scripts/r8_bl5_c1_solid_p0_counterfactual_dev.py index f86c7831e..2322a8bcb 100644 --- a/scripts/r8_bl5_c1_solid_p0_counterfactual_dev.py +++ b/scripts/r8_bl5_c1_solid_p0_counterfactual_dev.py @@ -10,7 +10,7 @@ import json from pathlib import Path -import anysolver +import anyfesolver import numba import numpy as np import psutil @@ -92,8 +92,8 @@ def _interior_max(station: np.ndarray) -> list[float]: def evaluate() -> dict: - if Path(anysolver.__file__).resolve().parent != (ROOT / "src" / "anysolver").resolve(): - raise RuntimeError("wrong ANYsolver checkout") + if Path(anyfesolver.__file__).resolve().parent != (ROOT / "src" / "anyfesolver").resolve(): + raise RuntimeError("wrong ANYfeSolver checkout") meta_path = PREPARED / "metadata.json" metadata = json.loads(meta_path.read_text(encoding="utf-8")) strong_saved = json.loads(STRONG.read_text(encoding="utf-8")) @@ -227,7 +227,7 @@ def evaluate() -> dict: "numba_disable_jit": int(numba.config.DISABLE_JIT), "numba_threads": numba.get_num_threads(), "threadpools": threadpool_info(), - "anysolver_import": str(Path(anysolver.__file__).resolve()), + "anyfesolver_import": str(Path(anyfesolver.__file__).resolve()), }, "limitation": "one saved C1 solid body, exact half-cell P0 source KKT; not external execution, native body equivalence, P0 selection, mesh convergence or formal F03", } diff --git a/scripts/r8_bl5_c2_signed_kkt_dev.py b/scripts/r8_bl5_c2_signed_kkt_dev.py index 04bec099f..cc6b57e35 100644 --- a/scripts/r8_bl5_c2_signed_kkt_dev.py +++ b/scripts/r8_bl5_c2_signed_kkt_dev.py @@ -21,10 +21,10 @@ from scipy.sparse.linalg import splu from threadpoolctl import threadpool_info -import anysolver -from anysolver import stiffened_shell -from anysolver._stiffened_shell_ge_experimental import _linear_equilibrium, _scaled_constraint_gap -from anysolver._b2_physical_linear_batch_dev import _accurate_sparse_residual +import anyfesolver +from anyfesolver import stiffened_shell +from anyfesolver._stiffened_shell_ge_experimental import _linear_equilibrium, _scaled_constraint_gap +from anyfesolver._b2_physical_linear_batch_dev import _accurate_sparse_residual from scripts.b3_e4_bl5_coherent_aggregation_dev import model @@ -212,7 +212,7 @@ def pair_parity(a,b): scope='single matched 16x4/32 native halfcell c2 P0 reference case; no F03 or family acceptance', policy=policy,source_sha256=sha(__file__),model_source_sha256=sha(sys.modules[model.__module__].__file__), owner_source_sha256=sha(sys.modules[type(owner).__module__].__file__), - anysolver_import=anysolver.__file__,effective=dict(cpu_affinity=psutil.Process().cpu_affinity(), + anyfesolver_import=anyfesolver.__file__,effective=dict(cpu_affinity=psutil.Process().cpu_affinity(), numba_threads=numba.get_num_threads(),jit_disabled=bool(numba.config.DISABLE_JIT),pools=pools), dimensions=dict(full_q=k.shape[0],free=len(free),physical=len(x),resultants=len(pp), constraints=c.shape[0],fixed=len(fixed)), diff --git a/scripts/r8_bl5_ccx_native_fy_mx_compare_dev.py b/scripts/r8_bl5_ccx_native_fy_mx_compare_dev.py index 2cf60d645..48e89ceb7 100644 --- a/scripts/r8_bl5_ccx_native_fy_mx_compare_dev.py +++ b/scripts/r8_bl5_ccx_native_fy_mx_compare_dev.py @@ -15,12 +15,12 @@ ROOT=Path(__file__).resolve().parents[1] sys.path[:0]=[str(ROOT),str(ROOT/"src")] -import anysolver +import anyfesolver import numba import numpy as np import psutil from threadpoolctl import threadpool_info -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from scripts import r8_bl5_matched_native_reference as native from scripts import r8_bl5_ccx_weak_p0_dev as deck_source from scripts import r8_bl5_ccx_weak_p0_run_dev as external @@ -123,7 +123,7 @@ def main(): if (psutil.Process().cpu_affinity()!=[0] or numba.config.DISABLE_JIT!=1 or numba.get_num_threads()!=1 or not pools or any(item["num_threads"]!=1 for item in pools) or - not Path(anysolver.__file__).resolve().is_relative_to(ROOT/"src")): + not Path(anyfesolver.__file__).resolve().is_relative_to(ROOT/"src")): raise ValueError("effective native source/runtime identity changed") saved={name:checked_saved(path,name,report) for name,path,report in (("fy",args.fy,args.fy_result),("mx",args.mx,args.mx_result))} @@ -156,7 +156,7 @@ def main(): effective_runtime=dict(affinity=psutil.Process().cpu_affinity(), numba_disable_jit=int(numba.config.DISABLE_JIT), numba_threads=int(numba.get_num_threads()),threadpools=pools, - anysolver_source=str(Path(anysolver.__file__).resolve())), + anyfesolver_source=str(Path(anyfesolver.__file__).resolve())), matched_geometry=dict(shell_thickness_m=model.shell.thickness_m, shell_young_pa=model.shell.young_pa,shell_poisson=model.shell.poisson, beam_section_area_m2=section["area"],beam_iy_m4=section["Iy"], diff --git a/scripts/r8_bl5_ccx_weak_p0_run_dev.py b/scripts/r8_bl5_ccx_weak_p0_run_dev.py index 46ce903b4..6a099d5fa 100644 --- a/scripts/r8_bl5_ccx_weak_p0_run_dev.py +++ b/scripts/r8_bl5_ccx_weak_p0_run_dev.py @@ -27,7 +27,7 @@ from scripts.r8_e02_double_output import read_double_output IDENTITY = "R8_BL5_CCX_WEAK_P0_EXECUTION_DEV_V1" -CCX = Path("C:/Github/ANYsolver/.qualification/b3-ge-e4-pl/calculix-223/CalculiX-2.23.0-win-x64/bin/ccx.exe") +CCX = Path("C:/Github/ANYfeSolver/.qualification/b3-ge-e4-pl/calculix-223/CalculiX-2.23.0-win-x64/bin/ccx.exe") MAX_CCX_SECONDS = 30. MAX_TOTAL_SECONDS = 60. MAX_TREE_RSS_BYTES = 2 * 1024**3 diff --git a/scripts/r8_bl5_density_reference_dev.py b/scripts/r8_bl5_density_reference_dev.py index e1d5ef973..ab4b1ccaa 100644 --- a/scripts/r8_bl5_density_reference_dev.py +++ b/scripts/r8_bl5_density_reference_dev.py @@ -44,7 +44,7 @@ def sha(path): def forbid_product_import(): - if any(name == "anysolver" or name.startswith("anysolver.") for name in sys.modules): + if any(name == "anyfesolver" or name.startswith("anyfesolver.") for name in sys.modules): raise ValueError("independent density reference must not import product modules") diff --git a/scripts/r8_bl5_envelope_gram_dev.py b/scripts/r8_bl5_envelope_gram_dev.py index 6ad8bc875..9e554eab0 100644 --- a/scripts/r8_bl5_envelope_gram_dev.py +++ b/scripts/r8_bl5_envelope_gram_dev.py @@ -36,7 +36,7 @@ def prepare(case,owner,output,*,wheel,site): require(output.parent.is_dir(), 'existing owned output directory required') pools=threadpool_info() require(pools and all(pool['num_threads']==1 for pool in pools), 'effective numerical pools1 required') - require(not any(name.split('.')[0]=='anysolver' for name in sys.modules), 'saved assessment must be product-free') + require(not any(name.split('.')[0]=='anyfesolver' for name in sys.modules), 'saved assessment must be product-free') arrays={};report=dict(identity=IDENTITY,status='STARTED',fixture_case=case.fixture_case, stationary_bound=stationary_bound,decimal_precision=precision, fixture=case.fixture,counts=case.counts,formal_f03_authority_consumed=False, diff --git a/scripts/r8_bl5_external_affine_reference_dev.py b/scripts/r8_bl5_external_affine_reference_dev.py index cb569cadb..05fe7672e 100644 --- a/scripts/r8_bl5_external_affine_reference_dev.py +++ b/scripts/r8_bl5_external_affine_reference_dev.py @@ -574,7 +574,7 @@ def main(site, output, case, *, nx=16, support_count=8, basis=BASIS): "thread_scope": "Environment requests only; effective external OpenSees threads unresolved; no resource-qualified claim."} try: refinement, p0, frozen, service, reference = services() - if any(name == "anysolver" or name.startswith("anysolver.") for name in sys.modules): + if any(name == "anyfesolver" or name.startswith("anyfesolver.") for name in sys.modules): raise ValueError("independent external runner must not import product modules") model = refinement.geometry(nx, reference) model["support_count"] = support_count # Explicit endpoints i/ns; eight remains the default. diff --git a/scripts/r8_bl5_matched_native_reference.py b/scripts/r8_bl5_matched_native_reference.py index 946dfab98..dc3b581d0 100644 --- a/scripts/r8_bl5_matched_native_reference.py +++ b/scripts/r8_bl5_matched_native_reference.py @@ -12,11 +12,11 @@ from pathlib import Path import numpy as np -from anysolver import b3_ge, stiffened_shell as ss -from anysolver._ge_beam3_retained_generalized_state import Mechanical -from anysolver._ge_beam3_p5.algebra import rotation -from anysolver._stiffened_shell_l1_local_experimental import NativeHalfCellPort -from anysolver._stiffened_shell_bl5_local_experimental import BL5LocalOperator +from anyfesolver import b3_ge, stiffened_shell as ss +from anyfesolver._ge_beam3_retained_generalized_state import Mechanical +from anyfesolver._ge_beam3_p5.algebra import rotation +from anyfesolver._stiffened_shell_l1_local_experimental import NativeHalfCellPort +from anyfesolver._stiffened_shell_bl5_local_experimental import BL5LocalOperator from scripts import r8_bl5_released_director_reference as external IDENTITY = 'R8_BL5_MATCHED_NATIVE_REFERENCE_LINEAR_DEV_V1' diff --git a/scripts/r8_bl5_mx_beam_body_dev.py b/scripts/r8_bl5_mx_beam_body_dev.py index c0b10627f..85e556bd6 100644 --- a/scripts/r8_bl5_mx_beam_body_dev.py +++ b/scripts/r8_bl5_mx_beam_body_dev.py @@ -17,14 +17,14 @@ ROOT=Path(__file__).resolve().parents[1] sys.path[:0]=[str(ROOT),str(ROOT/"src")] -import anysolver +import anyfesolver import numba import numpy as np import psutil from scipy import sparse from scipy.sparse.linalg import MatrixRankWarning, spsolve from threadpoolctl import threadpool_info -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from scripts import r8_bl5_ccx_weak_p0_run_dev as previous from scripts import r8_bl5_ccx_weak_p0_dev as deck from scripts import r8_bl5_weak_continuum_reference as continuum @@ -213,7 +213,7 @@ def main(): if (psutil.Process().cpu_affinity()!=[0] or numba.config.DISABLE_JIT!=1 or numba.get_num_threads()!=1 or not pools or any(item["num_threads"]!=1 for item in pools) or - not Path(anysolver.__file__).resolve().is_relative_to(ROOT/"src")): + not Path(anyfesolver.__file__).resolve().is_relative_to(ROOT/"src")): raise ValueError("effective source/runtime differs from bounded development setting") model,load,checked=checked_saved(args.saved_mx,args.comparison) k,_=continuum.assemble_body(model) diff --git a/scripts/r8_bl5_mx_beam_interface_dev.py b/scripts/r8_bl5_mx_beam_interface_dev.py index 36f508c89..ab4965eb6 100644 --- a/scripts/r8_bl5_mx_beam_interface_dev.py +++ b/scripts/r8_bl5_mx_beam_interface_dev.py @@ -7,7 +7,7 @@ from pathlib import Path import time -import anysolver +import anyfesolver import numba import numpy as np import psutil @@ -46,11 +46,11 @@ def main() -> None: "numba_disable_jit": int(numba.config.DISABLE_JIT), "numba_threads": int(numba.get_num_threads()), "threadpools": pools, - "anysolver_import": str(Path(anysolver.__file__).resolve())} + "anyfesolver_import": str(Path(anyfesolver.__file__).resolve())} if (runtime["cpu_affinity"] != [0] or runtime["numba_disable_jit"] != 1 or runtime["numba_threads"] != 1 or not pools or any(item["num_threads"] != 1 for item in pools) or - Path(anysolver.__file__).resolve().parent != ROOT / "src" / "anysolver"): + Path(anyfesolver.__file__).resolve().parent != ROOT / "src" / "anyfesolver"): raise ValueError("effective source/runtime does not match bounded contract") started = time.perf_counter() shell_nodes, shell_elements = shell_ref._shell_mesh(*SHELL_LEVEL) diff --git a/scripts/r8_bl5_mx_coupled_body_refinement_dev.py b/scripts/r8_bl5_mx_coupled_body_refinement_dev.py index 18635a617..e1e58b537 100644 --- a/scripts/r8_bl5_mx_coupled_body_refinement_dev.py +++ b/scripts/r8_bl5_mx_coupled_body_refinement_dev.py @@ -12,7 +12,7 @@ from pathlib import Path import time -import anysolver +import anyfesolver import numba import numpy as np import psutil @@ -149,7 +149,7 @@ def main() -> None: if (psutil.Process().cpu_affinity() != [0] or numba.config.DISABLE_JIT != 1 or numba.get_num_threads() != 1 or not pools or any(p["num_threads"] != 1 for p in pools) or - Path(anysolver.__file__).resolve().parent != ROOT/"src"/"anysolver"): + Path(anyfesolver.__file__).resolve().parent != ROOT/"src"/"anyfesolver"): raise ValueError("effective source/runtime changed") _, old = solid.build_reference() shell = _shell_body(old) @@ -182,7 +182,7 @@ def main() -> None: "numba_disable_jit": int(numba.config.DISABLE_JIT), "numba_threads": int(numba.get_num_threads()), "threadpools": pools, - "anysolver_import": str(Path(anysolver.__file__).resolve())}, + "anyfesolver_import": str(Path(anyfesolver.__file__).resolve())}, "level_wall_seconds": time.perf_counter()-started} name = "x".join(map(str, level))+".json" (args.output_dir/name).write_text(json.dumps(record, indent=2, allow_nan=False)+"\n", diff --git a/scripts/r8_bl5_mx_coupled_shell_refinement_dev.py b/scripts/r8_bl5_mx_coupled_shell_refinement_dev.py index 2bd3b8677..f17dbdb4a 100644 --- a/scripts/r8_bl5_mx_coupled_shell_refinement_dev.py +++ b/scripts/r8_bl5_mx_coupled_shell_refinement_dev.py @@ -13,7 +13,7 @@ from pathlib import Path import time -import anysolver +import anyfesolver import numba import numpy as np import psutil @@ -136,7 +136,7 @@ def main() -> None: if (psutil.Process().cpu_affinity() != [0] or numba.config.DISABLE_JIT != 1 or numba.get_num_threads() != 1 or not pools or any(p["num_threads"] != 1 for p in pools) or - Path(anysolver.__file__).resolve().parent != ROOT/"src"/"anysolver"): + Path(anyfesolver.__file__).resolve().parent != ROOT/"src"/"anyfesolver"): raise ValueError("effective source/runtime changed") _, old = solid.build_reference() beam_nodes, beam_elements = torsion._mesh(*BEAM_LEVEL) @@ -174,7 +174,7 @@ def main() -> None: "numba_disable_jit": int(numba.config.DISABLE_JIT), "numba_threads": int(numba.get_num_threads()), "threadpools": pools, - "anysolver_import": str(Path(anysolver.__file__).resolve())}, + "anyfesolver_import": str(Path(anyfesolver.__file__).resolve())}, "level_wall_seconds": time.perf_counter()-started} name = "x".join(map(str, level))+".json" (args.output_dir/name).write_text(json.dumps(record, indent=2, allow_nan=False)+"\n", diff --git a/scripts/r8_bl5_mx_interface_aggregation_dev.py b/scripts/r8_bl5_mx_interface_aggregation_dev.py index 3c4df5f06..25152ca87 100644 --- a/scripts/r8_bl5_mx_interface_aggregation_dev.py +++ b/scripts/r8_bl5_mx_interface_aggregation_dev.py @@ -7,7 +7,7 @@ from pathlib import Path import time -import anysolver +import anyfesolver import numba import numpy as np import psutil @@ -53,11 +53,11 @@ def main() -> None: "numba_disable_jit": int(numba.config.DISABLE_JIT), "numba_threads": int(numba.get_num_threads()), "threadpools": pools, - "anysolver_import": str(Path(anysolver.__file__).resolve())} + "anyfesolver_import": str(Path(anyfesolver.__file__).resolve())} if (runtime["cpu_affinity"] != [0] or runtime["numba_disable_jit"] != 1 or runtime["numba_threads"] != 1 or not pools or any(item["num_threads"] != 1 for item in pools) or - Path(anysolver.__file__).resolve().parent != ROOT / "src" / "anysolver"): + Path(anyfesolver.__file__).resolve().parent != ROOT / "src" / "anyfesolver"): raise ValueError("effective source/runtime does not match bounded contract") started = time.perf_counter() shell_nodes, shell_elements = shell_ref._shell_mesh(*SHELL_LEVEL) diff --git a/scripts/r8_bl5_mx_local_transfer_dev.py b/scripts/r8_bl5_mx_local_transfer_dev.py index e0e01f4f6..2a8126751 100644 --- a/scripts/r8_bl5_mx_local_transfer_dev.py +++ b/scripts/r8_bl5_mx_local_transfer_dev.py @@ -11,7 +11,7 @@ from pathlib import Path import time -import anysolver +import anyfesolver import numba import numpy as np import psutil @@ -45,11 +45,11 @@ def _check_runtime() -> dict: "numba_disable_jit": int(numba.config.DISABLE_JIT), "numba_threads": int(numba.get_num_threads()), "threadpools": pools, - "anysolver_import": str(Path(anysolver.__file__).resolve())} + "anyfesolver_import": str(Path(anyfesolver.__file__).resolve())} if (result["cpu_affinity"] != [0] or result["numba_disable_jit"] != 1 or result["numba_threads"] != 1 or not pools or any(item["num_threads"] != 1 for item in pools) or - Path(anysolver.__file__).resolve().parent != ROOT / "src" / "anysolver"): + Path(anyfesolver.__file__).resolve().parent != ROOT / "src" / "anyfesolver"): raise ValueError("effective source/runtime changed") return result diff --git a/scripts/r8_bl5_mx_matched_refinement_dev.py b/scripts/r8_bl5_mx_matched_refinement_dev.py index a7da8b0f7..7e3193d89 100644 --- a/scripts/r8_bl5_mx_matched_refinement_dev.py +++ b/scripts/r8_bl5_mx_matched_refinement_dev.py @@ -14,14 +14,14 @@ from pathlib import Path import time -import anysolver +import anyfesolver import numba import numpy as np import psutil from scipy import sparse from threadpoolctl import threadpool_info -from anysolver import b3_ge, stiffened_shell as ss +from anyfesolver import b3_ge, stiffened_shell as ss from scripts import r8_bl5_matched_native_reference as saved_native from scripts import r8_bl5_mx_coupled_body_refinement_dev as coupled from scripts import r8_bl5_mx_coupled_shell_refinement_dev as shell_ref @@ -196,7 +196,7 @@ def main() -> None: psutil.Process().cpu_affinity() != [0] or numba.config.DISABLE_JIT != 1 or numba.get_num_threads() != 1 or not pools or any(p["num_threads"] != 1 for p in pools) or - Path(anysolver.__file__).resolve().parent != ROOT/"src"/"anysolver"): + Path(anyfesolver.__file__).resolve().parent != ROOT/"src"/"anyfesolver"): raise ValueError("saved input or effective source/runtime changed") args.output_dir.mkdir(parents=True) for level in SHELL_LEVELS: @@ -237,7 +237,7 @@ def main() -> None: "numba_disable_jit": int(numba.config.DISABLE_JIT), "numba_threads": int(numba.get_num_threads()), "threadpools": pools, - "anysolver_import": str(Path(anysolver.__file__).resolve())}, + "anyfesolver_import": str(Path(anyfesolver.__file__).resolve())}, "level_wall_seconds": time.perf_counter()-started} name = "x".join(map(str, level))+".json" (args.output_dir/name).write_text(json.dumps(record, indent=2, allow_nan=False)+"\n", diff --git a/scripts/r8_bl5_mx_section_port_dev.py b/scripts/r8_bl5_mx_section_port_dev.py index c14770ecf..41925a9d8 100644 --- a/scripts/r8_bl5_mx_section_port_dev.py +++ b/scripts/r8_bl5_mx_section_port_dev.py @@ -13,7 +13,7 @@ from pathlib import Path import warnings -import anysolver +import anyfesolver import numba import numpy as np import psutil @@ -144,7 +144,7 @@ def evaluate(saved: Path, earlier: Path) -> dict: if (psutil.Process().cpu_affinity() != [0] or numba.config.DISABLE_JIT != 1 or numba.get_num_threads() != 1 or not pools or any(p["num_threads"] != 1 for p in pools) or - Path(anysolver.__file__).resolve().parent != ROOT / "src" / "anysolver"): + Path(anyfesolver.__file__).resolve().parent != ROOT / "src" / "anyfesolver"): raise ValueError("effective CPU/thread/JIT/source route changed") metadata = json.loads((saved / "metadata.json").read_text(encoding="utf-8")) deck_bytes, expected = deck.deck("mx") @@ -199,7 +199,7 @@ def evaluate(saved: Path, earlier: Path) -> dict: "numba_disable_jit": int(numba.config.DISABLE_JIT), "numba_threads": int(numba.get_num_threads()), "threadpools": pools, - "anysolver_import": str(Path(anysolver.__file__).resolve())}, + "anyfesolver_import": str(Path(anyfesolver.__file__).resolve())}, "root_port": root_meta, "tip_port": tip_meta, "saved_traction_wrench": old_wrench.tolist(), "section_dual_wrench": port_wrench.tolist(), diff --git a/scripts/r8_bl5_mx_shell_axial_dev.py b/scripts/r8_bl5_mx_shell_axial_dev.py index c3ac1df9f..dfe52ff2d 100644 --- a/scripts/r8_bl5_mx_shell_axial_dev.py +++ b/scripts/r8_bl5_mx_shell_axial_dev.py @@ -7,7 +7,7 @@ from pathlib import Path import time -import anysolver +import anyfesolver import numba import numpy as np import psutil @@ -46,11 +46,11 @@ def main() -> None: "numba_disable_jit": int(numba.config.DISABLE_JIT), "numba_threads": int(numba.get_num_threads()), "threadpools": pools, - "anysolver_import": str(Path(anysolver.__file__).resolve())} + "anyfesolver_import": str(Path(anyfesolver.__file__).resolve())} if (runtime["cpu_affinity"] != [0] or runtime["numba_disable_jit"] != 1 or runtime["numba_threads"] != 1 or not pools or any(item["num_threads"] != 1 for item in pools) or - Path(anysolver.__file__).resolve().parent != ROOT / "src" / "anysolver"): + Path(anyfesolver.__file__).resolve().parent != ROOT / "src" / "anyfesolver"): raise ValueError("effective source/runtime does not match bounded contract") started = time.perf_counter() beam_nodes, beam_elements = beam_ref._mesh(*BEAM_LEVEL) diff --git a/scripts/r8_bl5_mx_shell_thickness_dev.py b/scripts/r8_bl5_mx_shell_thickness_dev.py index b2d14defd..e2a9643dc 100644 --- a/scripts/r8_bl5_mx_shell_thickness_dev.py +++ b/scripts/r8_bl5_mx_shell_thickness_dev.py @@ -11,7 +11,7 @@ from pathlib import Path import time -import anysolver +import anyfesolver import numba import numpy as np import psutil @@ -113,11 +113,11 @@ def main() -> None: "numba_disable_jit": int(numba.config.DISABLE_JIT), "numba_threads": int(numba.get_num_threads()), "threadpools": pools, - "anysolver_import": str(Path(anysolver.__file__).resolve())} + "anyfesolver_import": str(Path(anyfesolver.__file__).resolve())} if (runtime["cpu_affinity"] != [0] or runtime["numba_disable_jit"] != 1 or runtime["numba_threads"] != 1 or not pools or any(item["num_threads"] != 1 for item in pools) or - Path(anysolver.__file__).resolve().parent != ROOT / "src" / "anysolver"): + Path(anyfesolver.__file__).resolve().parent != ROOT / "src" / "anyfesolver"): raise ValueError("effective source/runtime does not match bounded contract") started = time.perf_counter() beam_nodes, beam_elements = beam_ref._mesh(*BEAM_LEVEL) diff --git a/scripts/r8_bl5_mx_shell_transverse_dev.py b/scripts/r8_bl5_mx_shell_transverse_dev.py index 9ddbd29ff..bf60c0daf 100644 --- a/scripts/r8_bl5_mx_shell_transverse_dev.py +++ b/scripts/r8_bl5_mx_shell_transverse_dev.py @@ -7,7 +7,7 @@ from pathlib import Path import time -import anysolver +import anyfesolver import numba import numpy as np import psutil @@ -46,11 +46,11 @@ def main() -> None: "numba_disable_jit": int(numba.config.DISABLE_JIT), "numba_threads": int(numba.get_num_threads()), "threadpools": pools, - "anysolver_import": str(Path(anysolver.__file__).resolve())} + "anyfesolver_import": str(Path(anyfesolver.__file__).resolve())} if (runtime["cpu_affinity"] != [0] or runtime["numba_disable_jit"] != 1 or runtime["numba_threads"] != 1 or not pools or any(item["num_threads"] != 1 for item in pools) or - Path(anysolver.__file__).resolve().parent != ROOT / "src" / "anysolver"): + Path(anyfesolver.__file__).resolve().parent != ROOT / "src" / "anyfesolver"): raise ValueError("effective source/runtime does not match bounded contract") started = time.perf_counter() beam_nodes, beam_elements = beam_ref._mesh(*BEAM_LEVEL) diff --git a/scripts/r8_bl5_mx_torsion_refinement_dev.py b/scripts/r8_bl5_mx_torsion_refinement_dev.py index ba0eec572..2fa92ba9d 100644 --- a/scripts/r8_bl5_mx_torsion_refinement_dev.py +++ b/scripts/r8_bl5_mx_torsion_refinement_dev.py @@ -14,7 +14,7 @@ import time import warnings -import anysolver +import anyfesolver import numba import numpy as np import psutil @@ -223,7 +223,7 @@ def main() -> None: psutil.Process().cpu_affinity() != [0] or numba.config.DISABLE_JIT != 1 or numba.get_num_threads() != 1 or not pools or any(p["num_threads"] != 1 for p in pools) or - Path(anysolver.__file__).resolve().parent != ROOT / "src" / "anysolver"): + Path(anyfesolver.__file__).resolve().parent != ROOT / "src" / "anyfesolver"): raise ValueError("saved parent or effective source/runtime changed") args.output_dir.mkdir(parents=True) analytical = native.rectangular_section() @@ -253,7 +253,7 @@ def main() -> None: "numba_disable_jit": int(numba.config.DISABLE_JIT), "numba_threads": int(numba.get_num_threads()), "threadpools": pools, - "anysolver_import": str(Path(anysolver.__file__).resolve())}, + "anyfesolver_import": str(Path(anyfesolver.__file__).resolve())}, "level_wall_seconds": time.perf_counter()-started} name = "x".join(map(str, level))+".json" (args.output_dir/name).write_text(json.dumps(record, indent=2, allow_nan=False)+"\n", diff --git a/scripts/r8_bl5_mz_common_beam_action_dev.py b/scripts/r8_bl5_mz_common_beam_action_dev.py index 75608c71d..4b490db4e 100644 --- a/scripts/r8_bl5_mz_common_beam_action_dev.py +++ b/scripts/r8_bl5_mz_common_beam_action_dev.py @@ -22,8 +22,8 @@ from scipy import sparse from threadpoolctl import threadpool_info -from anysolver import stiffened_shell as ss -from anysolver._stiffened_shell_ge_experimental import _linear_equilibrium +from anyfesolver import stiffened_shell as ss +from anyfesolver._stiffened_shell_ge_experimental import _linear_equilibrium from scripts import r8_bl5_body_port_probe as port from scripts import r8_bl5_matched_native_reference as native from scripts import r8_bl5_mz_work_matched_dev as mz diff --git a/scripts/r8_bl5_mz_work_matched_dev.py b/scripts/r8_bl5_mz_work_matched_dev.py index 3e06a1e61..939b08b56 100644 --- a/scripts/r8_bl5_mz_work_matched_dev.py +++ b/scripts/r8_bl5_mz_work_matched_dev.py @@ -25,8 +25,8 @@ from scipy.sparse.linalg import splu from threadpoolctl import threadpool_info -from anysolver import stiffened_shell as ss -from anysolver._stiffened_shell_ge_experimental import ( +from anyfesolver import stiffened_shell as ss +from anyfesolver._stiffened_shell_ge_experimental import ( _linear_equilibrium, _scaled_constraint_gap, ) from scripts import r8_bl5_matched_native_reference as native diff --git a/scripts/r8_bl5_native_p1_contrast_dev.py b/scripts/r8_bl5_native_p1_contrast_dev.py index d9ec40562..c13387093 100644 --- a/scripts/r8_bl5_native_p1_contrast_dev.py +++ b/scripts/r8_bl5_native_p1_contrast_dev.py @@ -12,13 +12,13 @@ import json from pathlib import Path -import anysolver +import anyfesolver import numba import numpy as np import psutil from threadpoolctl import threadpool_info -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from scripts import r8_bl5_matched_native_reference as native from scripts import r8_bl5_saved_local_transfer_dev as transfer @@ -35,7 +35,7 @@ def evaluate(prior_path: Path) -> dict: set(prior.get("cases", {})) != {"fy", "mx"}): raise ValueError("complete saved P0 Fy/Mx cases required") pools = threadpool_info() - if (Path(anysolver.__file__).resolve().parent != ROOT / "src" / "anysolver" or + if (Path(anyfesolver.__file__).resolve().parent != ROOT / "src" / "anyfesolver" or psutil.Process().cpu_affinity() != [0] or numba.config.DISABLE_JIT != 1 or numba.get_num_threads() != 1 or not pools or any(item["num_threads"] != 1 for item in pools)): @@ -82,7 +82,7 @@ def evaluate(prior_path: Path) -> dict: "numba_disable_jit": int(numba.config.DISABLE_JIT), "numba_threads": int(numba.get_num_threads()), "threadpools": pools, - "anysolver_import": str(Path(anysolver.__file__).resolve())}, + "anyfesolver_import": str(Path(anyfesolver.__file__).resolve())}, "limitations": ["One matched 1:1 coarse native body and two loads only.", "A smaller gap under more constraints is not a stability or physical-fidelity proof.", "External P1 matching and all required ratios/refinements remain open."]} diff --git a/scripts/r8_bl5_nested_projected_external_dev.py b/scripts/r8_bl5_nested_projected_external_dev.py index 65c3ad10d..2b8a11fac 100644 --- a/scripts/r8_bl5_nested_projected_external_dev.py +++ b/scripts/r8_bl5_nested_projected_external_dev.py @@ -40,7 +40,7 @@ def sha(path): def forbid_product_import(): - if any(name == "anysolver" or name.startswith("anysolver.") for name in sys.modules): + if any(name == "anyfesolver" or name.startswith("anyfesolver.") for name in sys.modules): raise ValueError("independent external runner must not import product modules") diff --git a/scripts/r8_bl5_nested_projected_kernel_dev.py b/scripts/r8_bl5_nested_projected_kernel_dev.py index 6d0d055bf..d7a89aba8 100644 --- a/scripts/r8_bl5_nested_projected_kernel_dev.py +++ b/scripts/r8_bl5_nested_projected_kernel_dev.py @@ -10,16 +10,16 @@ from pathlib import Path import time -import anysolver +import anyfesolver import numba import numpy as np from scipy import linalg, sparse from scipy.sparse.linalg import splu from threadpoolctl import threadpool_info -from anysolver._stiffened_shell_ge_experimental import ( +from anyfesolver._stiffened_shell_ge_experimental import ( _linear_equilibrium, _scaled_constraint_gap, ) -from anysolver._b2_physical_linear_batch_dev import ( +from anyfesolver._b2_physical_linear_batch_dev import ( B2NumericalSolveFailure, _accurate_sparse_residual, ) @@ -357,7 +357,7 @@ def evaluate(prior, root, output): status="COMPLETED_DEVELOPMENT_ONLY" if all(predicates.values()) else "UNRESOLVED_DEVELOPMENT_CHECK", scope="one nested saved coarse virgin kernel/parity discriminator; no old/new displacement equality, material-history, growing-space, locking, accuracy or F03 acceptance", source_sha256=sha(__file__), source_files=source_files, helpers=helpers, - prior_helper_bindings=previous["helpers"], anysolver_import=anysolver.__file__, + prior_helper_bindings=previous["helpers"], anyfesolver_import=anyfesolver.__file__, numba_threads=numba.get_num_threads(), jit_disabled=bool(numba.config.DISABLE_JIT), pools=pools, physical_order=len(x), native_supported_order=len(free), old_constraint_rows=80, constraint_rows=40, kernel_order=z.shape[1], full_supported_saddle_order=len(free)+40, diff --git a/scripts/r8_bl5_nested_projected_owner_dev.py b/scripts/r8_bl5_nested_projected_owner_dev.py index 7b2f06d45..2afc4149a 100644 --- a/scripts/r8_bl5_nested_projected_owner_dev.py +++ b/scripts/r8_bl5_nested_projected_owner_dev.py @@ -6,8 +6,8 @@ from pathlib import Path import zipfile -import anysolver -from anysolver import stiffened_shell as api +import anyfesolver +from anyfesolver import stiffened_shell as api import numba import numpy as np from scipy import sparse @@ -39,13 +39,13 @@ def plain(value): def evaluate(site,wheel,source,old_root,kernel,output): if output.exists():raise FileExistsError(output) - if not Path(anysolver.__file__).resolve().is_relative_to(site.resolve()): + if not Path(anyfesolver.__file__).resolve().is_relative_to(site.resolve()): raise ValueError('declared installed package required') modules={} - source_files={'anysolver/'+p.relative_to(source/'src/anysolver').as_posix():p - for p in (source/'src/anysolver').rglob('*.py')} + source_files={'anyfesolver/'+p.relative_to(source/'src/anyfesolver').as_posix():p + for p in (source/'src/anyfesolver').rglob('*.py')} with zipfile.ZipFile(wheel) as z: - names={n for n in z.namelist() if n.startswith('anysolver/') and n.endswith('.py')} + names={n for n in z.namelist() if n.startswith('anyfesolver/') and n.endswith('.py')} if len(names)!=417 or names!=set(source_files):raise ValueError('complete417-module graph required') for name in sorted(names): raw=z.read(name) @@ -131,7 +131,7 @@ def evaluate(site,wheel,source,old_root,kernel,output): identity='BL5_P1_discontinuous_cell_average_span_8',policy='four shell intervals, complete five-channel pair, same coarse model', predicates=predicates,cases=cases,operator_parity=dict(K=k_error,C=c_error), factorization_count=owner._linear_factorizations,accurate_refinements=owner._linear_refinements, - imported_anysolver=anysolver.__file__,wheel_sha256=sha(wheel),module_sha256=modules, + imported_anyfesolver=anyfesolver.__file__,wheel_sha256=sha(wheel),module_sha256=modules, source_sha256=sha(__file__),helper_sha256={Path(f.__code__.co_filename).name:sha(f.__code__.co_filename) for f in (model,physical_transfer,saved_csr,exact_transfer_moments,rigid_maps,layout)}, input_sha256=dict(kernel_json=sha(kernel),kernel_npz=sha(kernel.with_suffix('.npz')), diff --git a/scripts/r8_bl5_nodal_port_and_warping_dev.py b/scripts/r8_bl5_nodal_port_and_warping_dev.py index 90c7d3c2e..69a2d8f7e 100644 --- a/scripts/r8_bl5_nodal_port_and_warping_dev.py +++ b/scripts/r8_bl5_nodal_port_and_warping_dev.py @@ -16,7 +16,7 @@ sys.path.insert(0, str(ROOT / "src")) sys.path.insert(0, str(ROOT)) -import anysolver +import anyfesolver import numpy as np from scripts import r8_bl5_two_sided_port_response_dev as v9 @@ -113,7 +113,7 @@ def saved_warping(model, elements, side, saved_v7, saved_q, full_index): def main(output): - import anysolver._stiffened_shell_ge_experimental as ge_source + import anyfesolver._stiffened_shell_ge_experimental as ge_source model = v9.weak.specimen() _, elements = v9.weak.assemble_body(model) response = {} @@ -138,10 +138,10 @@ def main(output): for side in ("left","right")} sources = {name:dict(path=str(Path(module.__file__).resolve()), sha256=sha(module.__file__)) for name,module in ( - ("anysolver",anysolver),("ge_compiler",ge_source), + ("anyfesolver",anyfesolver),("ge_compiler",ge_source), ("v9",v9),("native_fixture",v9.native),("solid_fixture",v9.solid), ("weak_fixture",v9.weak))} - for name in ("anysolver","ge_compiler"): + for name in ("anyfesolver","ge_compiler"): if not Path(sources[name]["path"]).is_relative_to(ROOT / "src"): raise ValueError("solver module imported outside bound worktree") result = dict(identity=IDENTITY, diff --git a/scripts/r8_bl5_projected_density_patch_dev.py b/scripts/r8_bl5_projected_density_patch_dev.py index bc0cd267f..46bf9ef0d 100644 --- a/scripts/r8_bl5_projected_density_patch_dev.py +++ b/scripts/r8_bl5_projected_density_patch_dev.py @@ -12,10 +12,10 @@ from scipy import sparse from scipy.sparse.linalg import spsolve from threadpoolctl import threadpool_info -from anysolver._ge_beam3_retained_generalized_state import Mechanical -from anysolver._stiffened_shell_l1_local_experimental import NativeHalfCellPort -from anysolver._stiffened_shell_bl5_local_experimental import BL5LocalOperator -from anysolver.corotational import rotation_matrix_from_vector +from anyfesolver._ge_beam3_retained_generalized_state import Mechanical +from anyfesolver._stiffened_shell_l1_local_experimental import NativeHalfCellPort +from anyfesolver._stiffened_shell_bl5_local_experimental import BL5LocalOperator +from anyfesolver.corotational import rotation_matrix_from_vector IDENTITY = 'BL5_REFERENCE_HALFCELL_AVERAGED_AFFINE_DENSITY_DEV_V1' sha = lambda p: hashlib.sha256(Path(p).read_bytes()).hexdigest() diff --git a/scripts/r8_bl5_projected_envelope_norm_dev.py b/scripts/r8_bl5_projected_envelope_norm_dev.py index 2a072811c..24add72fa 100644 --- a/scripts/r8_bl5_projected_envelope_norm_dev.py +++ b/scripts/r8_bl5_projected_envelope_norm_dev.py @@ -219,7 +219,7 @@ def register(case, output, *, reference='original'): if reference == 'exact_uniform': from scripts.r8_bl5_projected_uniform_modal_dev import uniform_projected_modal_bracket modal = uniform_projected_modal_bracket - if any(name.split('.')[0] == 'anysolver' for name in sys.modules): + if any(name.split('.')[0] == 'anyfesolver' for name in sys.modules): raise ValueError('scalar registration requires a product-free process') pools = threadpool_info() if not pools or any(pool['num_threads'] != 1 for pool in pools): diff --git a/scripts/r8_bl5_projected_envelope_owner_dev.py b/scripts/r8_bl5_projected_envelope_owner_dev.py index e852814bf..ed7101f2f 100644 --- a/scripts/r8_bl5_projected_envelope_owner_dev.py +++ b/scripts/r8_bl5_projected_envelope_owner_dev.py @@ -75,7 +75,7 @@ def run(case, site, wheel, source, registration, output): owner = None; original_error = False; cleanup_error = None try: site, source = site.resolve(strict=True), source.resolve(strict=True) - common.require(not any(name.split('.')[0]=='anysolver' for name in sys.modules), + common.require(not any(name.split('.')[0]=='anyfesolver' for name in sys.modules), 'fresh process without product preimports required') contract, binding = registration_identity(case, registration, source) modules = common.installed_identity(site, wheel, WHEEL_SHA, source) @@ -83,8 +83,8 @@ def run(case, site, wheel, source, registration, output): import numpy as np import numba from threadpoolctl import threadpool_info - import anysolver - from anysolver import stiffened_shell as api + import anyfesolver + from anyfesolver import stiffened_shell as api import b3_e4_bl5_coherent_aggregation_dev as coherent import b3_e4_bl5_matched_mz_native_dev as matched import b3_e4_bl5_matched_p0_native_refinement_dev as inventory @@ -99,7 +99,7 @@ def run(case, site, wheel, source, registration, output): fixed_criteria=dict(CRITERIA), wheel=str(wheel.resolve()), wheel_sha256=WHEEL_SHA, site=str(site), module_sha256=modules, matching_modules=len(modules), helper_sha256={Path(m.__file__).name:common.sha(m.__file__) for m in source_helpers}, - python=sys.version, imported_anysolver=anysolver.__file__, **settings) + python=sys.version, imported_anyfesolver=anyfesolver.__file__, **settings) owner, definition, policy = construct(case, coherent, api) common.require(owner.capabilities['status']=='EXPERIMENTAL_NOT_QUALIFIED', 'qualification boundary changed') xyz, layout = inventory.layout(owner, definition, policy, case.nx) diff --git a/scripts/r8_bl5_projected_joint_external_dev.py b/scripts/r8_bl5_projected_joint_external_dev.py index d0d7e756a..7c5ad365c 100644 --- a/scripts/r8_bl5_projected_joint_external_dev.py +++ b/scripts/r8_bl5_projected_joint_external_dev.py @@ -42,7 +42,7 @@ def sha(path): def forbid_product_import(): - if any(name == "anysolver" or name.startswith("anysolver.") for name in sys.modules): + if any(name == "anyfesolver" or name.startswith("anyfesolver.") for name in sys.modules): raise ValueError("independent external runner must not import product modules") diff --git a/scripts/r8_bl5_projected_joint_kernel_dev.py b/scripts/r8_bl5_projected_joint_kernel_dev.py index c020e48e4..6c7e45f04 100644 --- a/scripts/r8_bl5_projected_joint_kernel_dev.py +++ b/scripts/r8_bl5_projected_joint_kernel_dev.py @@ -19,14 +19,14 @@ import time import traceback -import anysolver +import anyfesolver import numba import numpy as np from scipy import linalg, sparse from scipy.sparse.linalg import splu from threadpoolctl import threadpool_info -from anysolver._stiffened_shell_ge_experimental import _linear_equilibrium, _scaled_constraint_gap -from anysolver._b2_physical_linear_batch_dev import B2NumericalSolveFailure, _accurate_sparse_residual +from anyfesolver._stiffened_shell_ge_experimental import _linear_equilibrium, _scaled_constraint_gap +from anyfesolver._b2_physical_linear_batch_dev import B2NumericalSolveFailure, _accurate_sparse_residual from scripts.r8_bl5_nested_projected_kernel_dev import saved_csr, relative @@ -211,7 +211,7 @@ def evaluate(root, output): require(len(modules) == 417 and all(sha(site/name) == digest for name, digest in modules.items()), "complete417 saved installed module identities changed") imports = {name: str(Path(module.__file__).resolve()) for name, module in sys.modules.copy().items() - if name.split(".")[0] == "anysolver" and getattr(module, "__file__", None)} + if name.split(".")[0] == "anyfesolver" and getattr(module, "__file__", None)} require(imports and all(Path(p).is_relative_to(site) and sha(p) == modules[Path(p).relative_to(site).as_posix()] for p in imports.values()), "all current product imports must match saved installed graph") @@ -226,7 +226,7 @@ def evaluate(root, output): "eight complete projected supports on fixed native halfcells required") report.update(source_files=source_files, owner_source_sha256=owner_report["source_sha256"], installed_identity=dict(site=str(site), wheel_sha256=owner_report["wheel_sha256"], - module_sha256=modules, anysolver_import=anysolver.__file__, product_imports=imports), + module_sha256=modules, anyfesolver_import=anyfesolver.__file__, product_imports=imports), helpers={Path(f.__code__.co_filename).name: sha(f.__code__.co_filename) for f in (saved_csr, relative, _linear_equilibrium, _scaled_constraint_gap, _accurate_sparse_residual)}) with np.load(native/"operators.npz", allow_pickle=False) as saved: diff --git a/scripts/r8_bl5_projected_joint_norm_dev.py b/scripts/r8_bl5_projected_joint_norm_dev.py index 7f3e9e8fe..ebf079474 100644 --- a/scripts/r8_bl5_projected_joint_norm_dev.py +++ b/scripts/r8_bl5_projected_joint_norm_dev.py @@ -142,7 +142,7 @@ def assess(root,registration,output,wheel): data,_,actual,_,c,_,_,beam_work,fixed,_,records,*_=compile_saved_projection(root) if c.shape!=(80,2940):raise ValueError('declared fine operator dimensions required') for name,module in sys.modules.copy().items(): - if name.split('.')[0]=='anysolver' and getattr(module,'__file__',None): + if name.split('.')[0]=='anyfesolver' and getattr(module,'__file__',None): path=Path(module.__file__).resolve();site=Path(owner['site']).resolve() if not path.is_relative_to(site) or sha(path)!=owner['module_sha256'].get(path.relative_to(site).as_posix()): raise ValueError('changed installed product import: '+name) @@ -219,7 +219,7 @@ def assess(root,registration,output,wheel): registration_sha256=sha(registration),source_sha256=sha(__file__),helper_sha256=helpers()| {Path(compile_saved_projection.__code__.co_filename).name:sha(compile_saved_projection.__code__.co_filename)}, input_sha256={name:sha(root/'native'/name) for name in ('inputs.json','operators.npz')},wheel_sha256=sha(wheel), - imported_anysolver=sys.modules['anysolver'].__file__, + imported_anyfesolver=sys.modules['anyfesolver'].__file__, limitations='ONE joint32 development level; no interlacing/coarseGram reuse, mechanical kernel claim, uniform stability or formalF03') output.write_text(json.dumps(result,indent=2,allow_nan=False)+'\n');return result diff --git a/scripts/r8_bl5_projected_joint_owner_dev.py b/scripts/r8_bl5_projected_joint_owner_dev.py index f47655394..5343aebbe 100644 --- a/scripts/r8_bl5_projected_joint_owner_dev.py +++ b/scripts/r8_bl5_projected_joint_owner_dev.py @@ -89,14 +89,14 @@ def registration_identity(path, source): def installed_identity(site, wheel, wheel_sha, source): require(len(wheel_sha) == 64 and sha(wheel) == wheel_sha, "declared frozen installed wheel SHA required") - source_files = {"anysolver/"+p.relative_to(source/"src/anysolver").as_posix(): p - for p in (source/"src/anysolver").rglob("*.py")} + source_files = {"anyfesolver/"+p.relative_to(source/"src/anyfesolver").as_posix(): p + for p in (source/"src/anyfesolver").rglob("*.py")} modules = {} with zipfile.ZipFile(wheel) as archive: - names = {n for n in archive.namelist() if n.startswith("anysolver/") and n.endswith(".py")} + names = {n for n in archive.namelist() if n.startswith("anyfesolver/") and n.endswith(".py")} require(len(names) == 417 and names == set(source_files), "complete417-module source/wheel graph required") - installed_names = {"anysolver/"+p.relative_to(site/"anysolver").as_posix() - for p in (site/"anysolver").rglob("*.py")} + installed_names = {"anyfesolver/"+p.relative_to(site/"anyfesolver").as_posix() + for p in (site/"anyfesolver").rglob("*.py")} require(installed_names == names, "complete417-module installed graph required") for name in sorted(names): data = archive.read(name) @@ -108,7 +108,7 @@ def installed_identity(site, wheel, wheel_sha, source): def canonical_imports(site): imports = {name: str(Path(module.__file__).resolve()) for name, module in sys.modules.copy().items() - if name.split(".")[0] == "anysolver" and getattr(module, "__file__", None)} + if name.split(".")[0] == "anyfesolver" and getattr(module, "__file__", None)} require(imports and all(Path(p).is_relative_to(site) for p in imports.values()), "every product import must use declared installed site") return imports @@ -132,12 +132,12 @@ def run(site, wheel, wheel_sha, source, registration, output): owner, earlier_error, cleanup_error = None, False, None try: site, source = site.resolve(strict=True), source.resolve(strict=True) - require(not any(n.split(".")[0] == "anysolver" for n in sys.modules), "fresh process without preimported product required") + require(not any(n.split(".")[0] == "anyfesolver" for n in sys.modules), "fresh process without preimported product required") record, registration_bound = registration_identity(registration, source) modules = installed_identity(site, wheel, wheel_sha, source) sys.path[:0] = [str(site), str(source/"scripts"), str(source/"tests")] - import anysolver - from anysolver import stiffened_shell as api + import anyfesolver + from anyfesolver import stiffened_shell as api import numpy as np import numba from threadpoolctl import threadpool_info @@ -161,7 +161,7 @@ def run(site, wheel, wheel_sha, source, registration, output): fixed_criteria=FIXED_CRITERIA, wheel_sha256=wheel_sha, wheel=str(wheel.resolve()), source_root=str(source), site=str(site), module_sha256=modules, matching_modules=len(modules), helper_sha256={Path(m.__file__).name: sha(m.__file__) for m in (coherent, matched, inventory, moments)}, - fixture_sha256=fixtures, imported_anysolver=anysolver.__file__, product_imports=canonical_imports(site), + fixture_sha256=fixtures, imported_anyfesolver=anyfesolver.__file__, product_imports=canonical_imports(site), python=sys.version, **settings) write(output/"identity.json", summary) base, policy = coherent.model(32, 8, 64, 2, basis="discontinuous_p1") diff --git a/scripts/r8_bl5_projected_mixed_system_dev.py b/scripts/r8_bl5_projected_mixed_system_dev.py index 0e9372013..d796c5968 100644 --- a/scripts/r8_bl5_projected_mixed_system_dev.py +++ b/scripts/r8_bl5_projected_mixed_system_dev.py @@ -10,13 +10,13 @@ from pathlib import Path import time -import anysolver +import anyfesolver import numba import numpy as np from scipy import linalg, sparse from scipy.sparse.linalg import splu from threadpoolctl import threadpool_info -from anysolver._stiffened_shell_ge_experimental import _linear_equilibrium, _scaled_constraint_gap +from anyfesolver._stiffened_shell_ge_experimental import _linear_equilibrium, _scaled_constraint_gap from scripts.r8_bl5_projected_density_patch_dev import compile_saved_projection, IDENTITY sha=lambda p:hashlib.sha256(Path(p).read_bytes()).hexdigest() @@ -159,7 +159,7 @@ def evaluate(root, output): scope='one saved coarse virgin native mixed-system discriminator; no material-history parity, growing-space, locking, accuracy or F03 acceptance', candidate=IDENTITY,source_sha256=sha(__file__),source_files=source_files, helpers={name:sha(Path(__file__).parent/name) for name in ('b3_e4_bl5_mechanical_kernel_dev.py','r8_bl5_projected_density_patch_dev.py')}, - anysolver_import=anysolver.__file__,numba_threads=numba.get_num_threads(),jit_disabled=bool(numba.config.DISABLE_JIT), + anyfesolver_import=anyfesolver.__file__,numba_threads=numba.get_num_threads(),jit_disabled=bool(numba.config.DISABLE_JIT), pools=threadpool_info(),physical_order=len(x),native_supported_order=len(free),constraint_rows=c.shape[0], original_constraint_parity=original_parity,local_blocks=local_info, work_pullback_relative=work_parity,constraint_pullback_relative=constraint_parity, diff --git a/scripts/r8_bl5_projected_native_beta_dev.py b/scripts/r8_bl5_projected_native_beta_dev.py index 83bda7c12..2b77d6a24 100644 --- a/scripts/r8_bl5_projected_native_beta_dev.py +++ b/scripts/r8_bl5_projected_native_beta_dev.py @@ -131,8 +131,8 @@ def installed_graph(site, wheel, summary): modules = summary['module_sha256'] require(len(modules) == 417, 'complete 417-module historical graph required') with zipfile.ZipFile(wheel) as archive: - names = {n for n in archive.namelist() if n.startswith('anysolver/') and n.endswith('.py')} - installed_names = {'anysolver/'+p.relative_to(site/'anysolver').as_posix() for p in (site/'anysolver').rglob('*.py')} + names = {n for n in archive.namelist() if n.startswith('anyfesolver/') and n.endswith('.py')} + installed_names = {'anyfesolver/'+p.relative_to(site/'anyfesolver').as_posix() for p in (site/'anyfesolver').rglob('*.py')} require(names == set(modules) == installed_names, 'complete historical wheel/site module names differ') for name in sorted(names): require(hashlib.sha256(archive.read(name)).hexdigest() == modules[name] == envelope.sha(site/name), @@ -175,9 +175,9 @@ def sparse_input(raw, name, shape): def compile_constraints(case, data, c): - from anysolver._ge_beam3_retained_generalized_state import Mechanical - from anysolver._stiffened_shell_l1_local_experimental import NativeHalfCellPort - from anysolver._stiffened_shell_bl5_local_experimental import BL5LocalOperator + from anyfesolver._ge_beam3_retained_generalized_state import Mechanical + from anyfesolver._stiffened_shell_l1_local_experimental import NativeHalfCellPort + from anyfesolver._stiffened_shell_bl5_local_experimental import BL5LocalOperator cells, ns = case.halfcells, case.counts['shell_nodes'] xyz = finite(data['xyz_m'], 'coordinates') state = Mechanical(xyz[ns:], np.zeros_like(xyz[ns:]), np.tile(np.eye(3), (cells+1, 1, 1)), @@ -289,7 +289,7 @@ def save(stage): output.write_text(json.dumps(json_record(report), indent=2, allow_nan=False)+'\n', encoding='utf-8') try: - require(not any(name.split('.')[0] == 'anysolver' for name in sys.modules), 'fresh process without product preimports required') + require(not any(name.split('.')[0] == 'anyfesolver' for name in sys.modules), 'fresh process without product preimports required') pools = threadpool_info() require(pools and all(pool['num_threads'] == 1 for pool in pools), 'effective numerical pools must each be one') summary, binding = frozen_owner(case, root) @@ -340,7 +340,7 @@ def save(stage): np.allclose(frame@op.reference_director, n, rtol=0., atol=1e-13) and op.thickness == local.thickness for op in records), 'nonconstant physical trace/frame/arms') for name, module in sys.modules.copy().items(): - if name.split('.')[0] == 'anysolver' and getattr(module, '__file__', None): + if name.split('.')[0] == 'anyfesolver' and getattr(module, '__file__', None): path = Path(module.__file__).resolve() require(path.is_relative_to(site) and envelope.sha(path) == modules.get(path.relative_to(site).as_posix()), 'changed installed import: '+name) report.setdefault('imported_modules', {})[name] = dict(path=str(path), sha256=envelope.sha(path)) diff --git a/scripts/r8_bl5_projected_physical_dual_dev.py b/scripts/r8_bl5_projected_physical_dual_dev.py index 5ef729180..c8147d517 100644 --- a/scripts/r8_bl5_projected_physical_dual_dev.py +++ b/scripts/r8_bl5_projected_physical_dual_dev.py @@ -176,12 +176,12 @@ def assess(root, registration, output, wheel): helper_sha256={Path(f.__code__.co_filename).name:sha(f.__code__.co_filename) for f in (projection,beam_norm,shell_scalar,beam_bracket, p0_shell_bracket,compile_saved_projection)}, - wheel_sha256=sha(wheel),imported_anysolver=sys.modules['anysolver'].__file__, + wheel_sha256=sha(wheel),imported_anyfesolver=sys.modules['anyfesolver'].__file__, imported_local_operators={name:dict(path=sys.modules[name].__file__, sha256=sha(sys.modules[name].__file__)) for name in ( - 'anysolver._stiffened_shell_bl5_local_experimental', - 'anysolver._stiffened_shell_l1_local_experimental', - 'anysolver._ge_beam3_retained_generalized_state')}, + 'anyfesolver._stiffened_shell_bl5_local_experimental', + 'anyfesolver._stiffened_shell_l1_local_experimental', + 'anyfesolver._ge_beam3_retained_generalized_state')}, input_sha256={name:sha(root/'native'/name) for name in ('inputs.json','operators.npz')}, limitations='coarse positive auxiliary norm only; physical yaw is NOT quotiented out. No structural SPD, growing-policy, locking, converged transfer or F03 acceptance.') np.savez(output.with_suffix('.npz'),native_lower=g,reference_lower=lower, diff --git a/scripts/r8_bl5_projected_ratio_external_dev.py b/scripts/r8_bl5_projected_ratio_external_dev.py index 32ce4dd1f..65f2c4671 100644 --- a/scripts/r8_bl5_projected_ratio_external_dev.py +++ b/scripts/r8_bl5_projected_ratio_external_dev.py @@ -44,7 +44,7 @@ def sha(path): def forbid_product_import(): - if any(name == "anysolver" or name.startswith("anysolver.") for name in sys.modules): + if any(name == "anyfesolver" or name.startswith("anyfesolver.") for name in sys.modules): raise ValueError("independent external runner must not import product modules") diff --git a/scripts/r8_bl5_projected_ratio_kernel_dev.py b/scripts/r8_bl5_projected_ratio_kernel_dev.py index 89a72227b..b33dc7619 100644 --- a/scripts/r8_bl5_projected_ratio_kernel_dev.py +++ b/scripts/r8_bl5_projected_ratio_kernel_dev.py @@ -21,14 +21,14 @@ import traceback import zipfile -import anysolver +import anyfesolver import numba import numpy as np from scipy import linalg, sparse from scipy.sparse.linalg import splu from threadpoolctl import threadpool_info -from anysolver._stiffened_shell_ge_experimental import _linear_equilibrium, _scaled_constraint_gap -from anysolver._b2_physical_linear_batch_dev import B2NumericalSolveFailure, _accurate_sparse_residual +from anyfesolver._stiffened_shell_ge_experimental import _linear_equilibrium, _scaled_constraint_gap +from anyfesolver._b2_physical_linear_batch_dev import B2NumericalSolveFailure, _accurate_sparse_residual from scripts.r8_bl5_nested_projected_kernel_dev import saved_csr, relative @@ -262,24 +262,24 @@ def evaluate(root, output): "actual owner helper source identities changed") report["owner_helper_sha256"] = owner_helpers site = Path(owner_report["site"]).resolve(strict=True) - require(anysolver.__version__ == "0.4.7", "actual installed0.4.7 product identity required") + require(anyfesolver.__version__ == "0.4.7", "actual installed0.4.7 product identity required") modules = owner_report["module_sha256"] - source_names = {"anysolver/"+p.relative_to(source/"src/anysolver").as_posix() - for p in (source/"src/anysolver").rglob("*.py")} - site_names = {"anysolver/"+p.relative_to(site/"anysolver").as_posix() - for p in (site/"anysolver").rglob("*.py")} + source_names = {"anyfesolver/"+p.relative_to(source/"src/anyfesolver").as_posix() + for p in (source/"src/anyfesolver").rglob("*.py")} + site_names = {"anyfesolver/"+p.relative_to(site/"anyfesolver").as_posix() + for p in (site/"anyfesolver").rglob("*.py")} wheel = Path(owner_report["wheel"]) require(len(modules) == 417 and set(modules) == source_names == site_names and sha(wheel) == owner_report["wheel_sha256"], "complete417 source/site and exact wheel graph required") with zipfile.ZipFile(wheel) as archive: - wheel_names = {n for n in archive.namelist() if n.startswith("anysolver/") and n.endswith(".py")} + wheel_names = {n for n in archive.namelist() if n.startswith("anyfesolver/") and n.endswith(".py")} require(wheel_names == set(modules), "complete417 actual wheel module graph required") for name, digest in modules.items(): require(sha(site/name) == sha(source/"src"/name) == digest and hashlib.sha256(archive.read(name)).hexdigest() == digest, "source/wheel/site product module identity changed: "+name) imports = {name: str(Path(module.__file__).resolve()) for name, module in sys.modules.copy().items() - if name.split(".")[0] == "anysolver" and getattr(module, "__file__", None)} + if name.split(".")[0] == "anyfesolver" and getattr(module, "__file__", None)} require(imports and all(Path(p).is_relative_to(site) and sha(p) == modules[Path(p).relative_to(site).as_posix()] for p in imports.values()), "all current product imports must match saved installed graph") @@ -348,7 +348,7 @@ def evaluate(root, output): "actual40 complete independent interface row inventory required") report.update(source_files=source_files, owner_source_sha256=owner_report["source_sha256"], installed_identity=dict(site=str(site), wheel_sha256=owner_report["wheel_sha256"], - module_sha256=modules, anysolver_import=anysolver.__file__, product_imports=imports), + module_sha256=modules, anyfesolver_import=anyfesolver.__file__, product_imports=imports), helpers={Path(f.__code__.co_filename).name: sha(f.__code__.co_filename) for f in (saved_csr, relative, _linear_equilibrium, _scaled_constraint_gap, _accurate_sparse_residual)}) with np.load(native/"operators.npz", allow_pickle=False) as saved: diff --git a/scripts/r8_bl5_projected_ratio_norm_dev.py b/scripts/r8_bl5_projected_ratio_norm_dev.py index 846805ce5..8e8786e45 100644 --- a/scripts/r8_bl5_projected_ratio_norm_dev.py +++ b/scripts/r8_bl5_projected_ratio_norm_dev.py @@ -131,9 +131,9 @@ def register(output): def compile_saved_projection(root): - from anysolver._ge_beam3_retained_generalized_state import Mechanical - from anysolver._stiffened_shell_l1_local_experimental import NativeHalfCellPort - from anysolver._stiffened_shell_bl5_local_experimental import BL5LocalOperator + from anyfesolver._ge_beam3_retained_generalized_state import Mechanical + from anyfesolver._stiffened_shell_l1_local_experimental import NativeHalfCellPort + from anyfesolver._stiffened_shell_bl5_local_experimental import BL5LocalOperator data=json.loads((root/'native/inputs.json').read_text()) if data['fixture']!=FIXTURE or data['fixture_case']!=FIXTURE_CASE: raise ValueError("actual reciprocal fixture differs") @@ -191,7 +191,7 @@ def assess(root,registration,output,wheel): expected_full={"whole_half":804,"whole_double":1668}[FIXTURE_CASE] if c.shape!=(40,expected_full):raise ValueError("declared reciprocal operator dimensions required") for name,module in sys.modules.copy().items(): - if name.split('.')[0]=='anysolver' and getattr(module,'__file__',None): + if name.split('.')[0]=='anyfesolver' and getattr(module,'__file__',None): path=Path(module.__file__).resolve();site=Path(owner['site']).resolve() if not path.is_relative_to(site) or sha(path)!=owner['module_sha256'].get(path.relative_to(site).as_posix()): raise ValueError('changed installed product import: '+name) @@ -268,7 +268,7 @@ def assess(root,registration,output,wheel): registration_sha256=sha(registration),source_sha256=sha(__file__),helper_sha256=helpers()| {Path(compile_saved_projection.__code__.co_filename).name:sha(compile_saved_projection.__code__.co_filename)}, input_sha256={name:sha(root/'native'/name) for name in ('inputs.json','operators.npz')},wheel_sha256=sha(wheel), - imported_anysolver=sys.modules['anysolver'].__file__, + imported_anyfesolver=sys.modules['anyfesolver'].__file__, limitations='ONE reciprocal development level; no interlacing/coarseGram reuse, mechanical kernel claim, uniform stability or formalF03') output.write_text(json.dumps(result,indent=2,allow_nan=False)+'\n');return result diff --git a/scripts/r8_bl5_projected_ratio_owner_dev.py b/scripts/r8_bl5_projected_ratio_owner_dev.py index 8f0a9cd6c..a130c0a7d 100644 --- a/scripts/r8_bl5_projected_ratio_owner_dev.py +++ b/scripts/r8_bl5_projected_ratio_owner_dev.py @@ -99,14 +99,14 @@ def registration_identity(path, source): def installed_identity(site, wheel, wheel_sha, source): require(len(wheel_sha) == 64 and sha(wheel) == wheel_sha, "declared frozen installed wheel SHA required") - source_files = {"anysolver/"+p.relative_to(source/"src/anysolver").as_posix(): p - for p in (source/"src/anysolver").rglob("*.py")} + source_files = {"anyfesolver/"+p.relative_to(source/"src/anyfesolver").as_posix(): p + for p in (source/"src/anyfesolver").rglob("*.py")} modules = {} with zipfile.ZipFile(wheel) as archive: - names = {n for n in archive.namelist() if n.startswith("anysolver/") and n.endswith(".py")} + names = {n for n in archive.namelist() if n.startswith("anyfesolver/") and n.endswith(".py")} require(len(names) == 417 and names == set(source_files), "complete417-module source/wheel graph required") - installed_names = {"anysolver/"+p.relative_to(site/"anysolver").as_posix() - for p in (site/"anysolver").rglob("*.py")} + installed_names = {"anyfesolver/"+p.relative_to(site/"anyfesolver").as_posix() + for p in (site/"anyfesolver").rglob("*.py")} require(installed_names == names, "complete417-module installed graph required") for name in sorted(names): data = archive.read(name) @@ -118,7 +118,7 @@ def installed_identity(site, wheel, wheel_sha, source): def canonical_imports(site): imports = {name: str(Path(module.__file__).resolve()) for name, module in sys.modules.copy().items() - if name.split(".")[0] == "anysolver" and getattr(module, "__file__", None)} + if name.split(".")[0] == "anyfesolver" and getattr(module, "__file__", None)} require(imports and all(Path(p).is_relative_to(site) for p in imports.values()), "every product import must use declared installed site") return imports @@ -142,12 +142,12 @@ def run(site, wheel, wheel_sha, source, registration, output): owner, earlier_error, cleanup_error = None, False, None try: site, source = site.resolve(strict=True), source.resolve(strict=True) - require(not any(n.split(".")[0] == "anysolver" for n in sys.modules), "fresh process without preimported product required") + require(not any(n.split(".")[0] == "anyfesolver" for n in sys.modules), "fresh process without preimported product required") record, registration_bound = registration_identity(registration, source) modules = installed_identity(site, wheel, wheel_sha, source) sys.path[:0] = [str(site), str(source/"scripts"), str(source/"tests")] - import anysolver - from anysolver import stiffened_shell as api + import anyfesolver + from anyfesolver import stiffened_shell as api import numpy as np import numba from threadpoolctl import threadpool_info @@ -171,7 +171,7 @@ def run(site, wheel, wheel_sha, source, registration, output): fixed_criteria=FIXED_CRITERIA, wheel_sha256=wheel_sha, wheel=str(wheel.resolve()), source_root=str(source), site=str(site), module_sha256=modules, matching_modules=len(modules), helper_sha256={Path(m.__file__).name: sha(m.__file__) for m in (coherent, matched, inventory, moments)}, - fixture_sha256=fixtures, imported_anysolver=anysolver.__file__, product_imports=canonical_imports(site), + fixture_sha256=fixtures, imported_anyfesolver=anyfesolver.__file__, product_imports=canonical_imports(site), python=sys.version, **settings) write(output/"identity.json", summary) base, policy = coherent.model(NX, NY, CELLS, 2, basis="discontinuous_p1") diff --git a/scripts/r8_bl5_rigid_carrier_dev.py b/scripts/r8_bl5_rigid_carrier_dev.py index 9d19978c6..05ac8c945 100644 --- a/scripts/r8_bl5_rigid_carrier_dev.py +++ b/scripts/r8_bl5_rigid_carrier_dev.py @@ -34,7 +34,7 @@ def carrier_reference(length, bending, shear, moment, x): def rigid_carrier_definition(nx=16, ny=4, halfcells=32): - from anysolver import stiffened_shell as api + from anyfesolver import stiffened_shell as api from b3_e4_bl5_coherent_aggregation_dev import model definition, policy = model(nx, ny, halfcells, 2) shell_fixed = tuple(api.FixedCoordinate("shell", node, axis) @@ -54,9 +54,9 @@ def write(path, value): def run(output, nx=16, ny=4, halfcells=32): import numba from threadpoolctl import threadpool_info - import anysolver - from anysolver import stiffened_shell as api - from anysolver._ge_beam3_retained_generalized_state import Mechanical + import anyfesolver + from anyfesolver import stiffened_shell as api + from anyfesolver._ge_beam3_retained_generalized_state import Mechanical from b3_e4_bl5_coherent_aggregation_dev import physical_transfer output.mkdir(exist_ok=False) pools = threadpool_info() @@ -71,7 +71,7 @@ def run(output, nx=16, ny=4, halfcells=32): bending, shear = float(section[5, 5]), float(section[1, 1]) reference = carrier_reference(length, bending, shear, moment, length) summary = dict(status="IN_PROGRESS", policy=policy, - source=anysolver.__file__, settings=dict(pools=pools, + source=anyfesolver.__file__, settings=dict(pools=pools, numba_threads=numba.get_num_threads(), jit_disabled=bool(numba.config.DISABLE_JIT)), physical=dict(length_m=length, EI_z_Nm2=bending, kGA_y_N=shear, tip_moment_Nm=moment, beam_axis_z_m=.0675, shell_top_z_m=.0175, diff --git a/scripts/r8_bl5_saved_local_transfer_dev.py b/scripts/r8_bl5_saved_local_transfer_dev.py index e76e0ba20..50e173d23 100644 --- a/scripts/r8_bl5_saved_local_transfer_dev.py +++ b/scripts/r8_bl5_saved_local_transfer_dev.py @@ -11,13 +11,13 @@ import json from pathlib import Path -import anysolver +import anyfesolver import numba import numpy as np import psutil from threadpoolctl import threadpool_info -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from scripts import r8_bl5_ccx_native_fy_mx_compare_dev as compare from scripts import r8_bl5_ccx_weak_p0_dev as deck from scripts import r8_bl5_matched_native_reference as native @@ -131,7 +131,7 @@ def _native(owner, case: str, *, expected_rows: int = 20) -> dict: def evaluate(cases: dict[str, tuple[Path, Path]]) -> dict: pools = threadpool_info() - if (Path(anysolver.__file__).resolve().parent != ROOT / "src" / "anysolver" or + if (Path(anyfesolver.__file__).resolve().parent != ROOT / "src" / "anyfesolver" or psutil.Process().cpu_affinity() != [0] or numba.config.DISABLE_JIT != 1 or numba.get_num_threads() != 1 or not pools or any(item["num_threads"] != 1 for item in pools)): @@ -167,7 +167,7 @@ def evaluate(cases: dict[str, tuple[Path, Path]]) -> dict: "numba_disable_jit": int(numba.config.DISABLE_JIT), "numba_threads": int(numba.get_num_threads()), "threadpools": pools, - "anysolver_import": str(Path(anysolver.__file__).resolve())}, + "anyfesolver_import": str(Path(anyfesolver.__file__).resolve())}, "source_sha256": hashlib.sha256(Path(__file__).read_bytes()).hexdigest(), "limitations": ["One coarse matched geometry and two loads only.", "Continuum face traction and native tip wrench need not do identical warping work.", diff --git a/scripts/r8_bl5_sparse_envelope_kernel_dev.py b/scripts/r8_bl5_sparse_envelope_kernel_dev.py index f0408b758..62a132ba5 100644 --- a/scripts/r8_bl5_sparse_envelope_kernel_dev.py +++ b/scripts/r8_bl5_sparse_envelope_kernel_dev.py @@ -286,7 +286,7 @@ def assess(case,owner,output,*,stationary_bound='sum',precision=50): require(output.parent.is_dir(), 'existing owned output directory required') pools=threadpool_info() require(pools and all(pool['num_threads']==1 for pool in pools), 'effective numerical pools1 required') - require(not any(name.split('.')[0]=='anysolver' for name in sys.modules), 'saved assessment must be product-free') + require(not any(name.split('.')[0]=='anyfesolver' for name in sys.modules), 'saved assessment must be product-free') arrays={};report=dict(identity=IDENTITY,status='STARTED',fixture_case=case.fixture_case, stationary_bound=stationary_bound,decimal_precision=precision, fixture=case.fixture,counts=case.counts,formal_f03_authority_consumed=False, diff --git a/scripts/r8_bl5_stabilization_sensitivity_dev.py b/scripts/r8_bl5_stabilization_sensitivity_dev.py index 8fd0750dd..64ff4dac5 100644 --- a/scripts/r8_bl5_stabilization_sensitivity_dev.py +++ b/scripts/r8_bl5_stabilization_sensitivity_dev.py @@ -52,18 +52,18 @@ def run(saved_root, output, site): if output.exists(): raise FileExistsError(output) output.mkdir() sys.path.insert(0, str(site.resolve())) - import anysolver + import anyfesolver import numba from threadpoolctl import threadpool_info - from anysolver import stiffened_shell as api - from anysolver._stiffened_shell_ge_experimental import _shell_reference - from anysolver._b2_physical_linear_batch_dev import _accurate_sparse_residual - if not Path(anysolver.__file__).resolve().is_relative_to(site.resolve()): + from anyfesolver import stiffened_shell as api + from anyfesolver._stiffened_shell_ge_experimental import _shell_reference + from anyfesolver._b2_physical_linear_batch_dev import _accurate_sparse_residual + if not Path(anyfesolver.__file__).resolve().is_relative_to(site.resolve()): raise ValueError("isolated installed solver required") pools = threadpool_info() if not pools or any(p["num_threads"] != 1 for p in pools) or not numba.config.DISABLE_JIT: raise ValueError("effective one-thread/JIT-off environment required") - report = dict(status="IN_PROGRESS", imported_solver=anysolver.__file__, pools=pools, + report = dict(status="IN_PROGRESS", imported_solver=anyfesolver.__file__, pools=pools, jit_disabled=True, numba_threads=numba.get_num_threads(), checks={}, cases={}, scope="fixed flat Q4/c2 elastic native mixed fixture, development sensitivity only", perturbations=[1e-3, 1e-4], factorization_count=0, linear_solve_count=0) diff --git a/scripts/r8_bl5_strong_hinge_pair_dev.py b/scripts/r8_bl5_strong_hinge_pair_dev.py index 729addac7..efe245ca6 100644 --- a/scripts/r8_bl5_strong_hinge_pair_dev.py +++ b/scripts/r8_bl5_strong_hinge_pair_dev.py @@ -12,7 +12,7 @@ from pathlib import Path import time -import anysolver +import anyfesolver import numba import numpy as np import psutil @@ -44,11 +44,11 @@ def _runtime() -> dict: "numba_disable_jit": int(numba.config.DISABLE_JIT), "numba_threads": int(numba.get_num_threads()), "threadpools": pools, - "anysolver_import": str(Path(anysolver.__file__).resolve())} + "anyfesolver_import": str(Path(anyfesolver.__file__).resolve())} if (result["cpu_affinity"] != [0] or result["numba_disable_jit"] != 1 or result["numba_threads"] != 1 or not pools or any(item["num_threads"] != 1 for item in pools) or - Path(anysolver.__file__).resolve().parent != ROOT / "src" / "anysolver"): + Path(anyfesolver.__file__).resolve().parent != ROOT / "src" / "anyfesolver"): raise ValueError("effective source/runtime changed") return result diff --git a/scripts/r8_bl5_two_sided_port_response_dev.py b/scripts/r8_bl5_two_sided_port_response_dev.py index 035be01b3..78c594e3b 100644 --- a/scripts/r8_bl5_two_sided_port_response_dev.py +++ b/scripts/r8_bl5_two_sided_port_response_dev.py @@ -24,8 +24,8 @@ # namespace from an installed package. sys.path.insert(0, str(Path(__file__).resolve().parents[1])) -from anysolver._ge_beam3_generalized_static_boundary import spatial_jacobian -from anysolver._stiffened_shell_ge_experimental import _beam_reference +from anyfesolver._ge_beam3_generalized_static_boundary import spatial_jacobian +from anyfesolver._stiffened_shell_ge_experimental import _beam_reference from scripts import r8_bl5_matched_native_reference as native from scripts import r8_bl5_released_director_reference as solid from scripts import r8_bl5_weak_continuum_reference as weak diff --git a/scripts/r8_bl5_v11_cut_warping_response_dev.py b/scripts/r8_bl5_v11_cut_warping_response_dev.py index 735a2b0f5..60a2aece8 100644 --- a/scripts/r8_bl5_v11_cut_warping_response_dev.py +++ b/scripts/r8_bl5_v11_cut_warping_response_dev.py @@ -14,7 +14,7 @@ ROOT = Path(__file__).resolve().parents[1] sys.path[:0] = [str(ROOT), str(ROOT / "src")] -import anysolver +import anyfesolver import numba import numpy as np import psutil @@ -79,7 +79,7 @@ def resultant(action): def main(output: Path): pools = threadpool_info() - if not Path(anysolver.__file__).resolve().is_relative_to(ROOT / "src"): + if not Path(anyfesolver.__file__).resolve().is_relative_to(ROOT / "src"): raise ValueError("solver imported outside bound source checkout") if (psutil.Process().cpu_affinity() != [0] or numba.config.DISABLE_JIT != 1 or numba.get_num_threads() != 1 or not pools or @@ -93,9 +93,9 @@ def main(output: Path): six = sum(row["six_resultant_work_J"] for row in sides.values()) result = dict(identity=IDENTITY, status="DEVELOPMENT_DIAGNOSTIC_NOT_QUALIFIED", saved_v7_sha256=digest(SAVED), source_sha256={name:digest(Path(module.__file__)) - for name,module in (("ports",ports),("weak",ports.weak),("anysolver",anysolver))}, + for name,module in (("ports",ports),("weak",ports.weak),("anyfesolver",anyfesolver))}, source_paths={name:str(Path(module.__file__).resolve()) for name,module in - (("ports",ports),("weak",ports.weak),("anysolver",anysolver))}, + (("ports",ports),("weak",ports.weak),("anyfesolver",anyfesolver))}, effective_runtime=dict(affinity=psutil.Process().cpu_affinity(), numba_disable_jit=int(numba.config.DISABLE_JIT), numba_threads=int(numba.get_num_threads()),threadpools=pools), diff --git a/scripts/r8_bl5_v12_retained_load_response_dev.py b/scripts/r8_bl5_v12_retained_load_response_dev.py index 0425ca4ef..02ab41471 100644 --- a/scripts/r8_bl5_v12_retained_load_response_dev.py +++ b/scripts/r8_bl5_v12_retained_load_response_dev.py @@ -15,12 +15,12 @@ ROOT = Path(__file__).resolve().parents[1] sys.path[:0] = [str(ROOT), str(ROOT / "src")] -import anysolver +import anyfesolver import numba import numpy as np import psutil from threadpoolctl import threadpool_info -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from scripts import r8_bl5_body_port_probe as port from scripts import r8_bl5_matched_native_reference as native @@ -38,7 +38,7 @@ def main(output): numba.get_num_threads() != 1 or not pools or any(pool["num_threads"] != 1 for pool in pools)): raise ValueError("effective CPU/thread/JIT settings differ") - if not Path(anysolver.__file__).resolve().is_relative_to(ROOT / "src"): + if not Path(anyfesolver.__file__).resolve().is_relative_to(ROOT / "src"): raise ValueError("solver imported outside bound source checkout") preflight = json.loads((SAVED / "preflight.json").read_text(encoding="utf-8")) saved = json.loads((SAVED / "beam-solved.json").read_text(encoding="utf-8")) @@ -91,7 +91,7 @@ def main(output): abs(float(retained @ q_saved)-w_retained-cross_a)/denom > 1e-8): raise ValueError("native superposition/work reciprocity failed") result = dict(identity=IDENTITY,status="DEVELOPMENT_DIAGNOSTIC_NOT_QUALIFIED", - source_paths={"anysolver":str(Path(anysolver.__file__).resolve()), + source_paths={"anyfesolver":str(Path(anyfesolver.__file__).resolve()), "port":str(Path(port.__file__).resolve()), "native":str(Path(native.__file__).resolve())}, source_sha256={"port":digest(port.__file__),"native":digest(native.__file__)}, diff --git a/scripts/r8_bl5_weak_continuum_reference.py b/scripts/r8_bl5_weak_continuum_reference.py index 4335f9179..fc9e6a0f4 100644 --- a/scripts/r8_bl5_weak_continuum_reference.py +++ b/scripts/r8_bl5_weak_continuum_reference.py @@ -13,7 +13,7 @@ import numpy as np from scipy import sparse from scipy.sparse.linalg import splu -from anysolver._stiffened_shell_ge_experimental import _linear_equilibrium, _scaled_constraint_gap +from anyfesolver._stiffened_shell_ge_experimental import _linear_equilibrium, _scaled_constraint_gap from scripts import r8_bl5_released_director_reference as original from scripts import r8_bl5_matched_native_reference as matched diff --git a/scripts/r8_e01_native_polar_work.py b/scripts/r8_e01_native_polar_work.py index 03356ac11..a78fbd40e 100644 --- a/scripts/r8_e01_native_polar_work.py +++ b/scripts/r8_e01_native_polar_work.py @@ -11,11 +11,11 @@ import numpy as np -from anysolver import _ge_beam3_mixed_ad as ad -from anysolver._ge_beam3_retained_generalized_state import Mechanical -from anysolver._ge_beam3_p5.compensated_coordinates import split_sum -from anysolver._stiffened_shell_l1_local_experimental import NativeHalfCellPort -from anysolver._ge_beam3_p5.algebra import rotation as retained_rotation +from anyfesolver import _ge_beam3_mixed_ad as ad +from anyfesolver._ge_beam3_retained_generalized_state import Mechanical +from anyfesolver._ge_beam3_p5.compensated_coordinates import split_sum +from anyfesolver._stiffened_shell_l1_local_experimental import NativeHalfCellPort +from anyfesolver._ge_beam3_p5.algebra import rotation as retained_rotation from scripts import r8_e01_objective_polar_trace as polar @@ -27,8 +27,8 @@ def native_chord_kinematics(reference, mechanical): Chord entries are length-valued; divide by each reference chord length for the straight-cell engineering strain used in the homogeneous controls. """ - from anysolver._ge_beam3_p5.compensated import compensated_strain - from anysolver._ge_beam3_p5.algebra import HALVES + from anyfesolver._ge_beam3_p5.compensated import compensated_strain + from anyfesolver._ge_beam3_p5.algebra import HALVES variables = [ad.Jet2.constant(0., 1) for _ in range(24)] chord, endpoints = [], [] for cell, (left, right) in enumerate(HALVES): @@ -55,9 +55,9 @@ def homogeneous_frame_comparison(deformation, *, cell=0, weight=.4, section offset is minus eccentricity, so both reference distances match. Resultants and all 42 retained coordinates remain explicit. """ - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry - from anysolver._stiffened_shell_l1_local_experimental import L1LocalOperator - from anysolver._ge_beam3_p5.algebra import log_rotation + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry + from anyfesolver._stiffened_shell_l1_local_experimental import L1LocalOperator + from anyfesolver._ge_beam3_p5.algebra import log_rotation f = polar._owned(deformation, (3, 3), "homogeneous deformation") dr = np.eye(3) if director_rotation is None else polar._rotation(director_rotation) if not np.isfinite(thickness) or thickness <= 0 or not np.isfinite(eccentricity): diff --git a/scripts/r8_e01_objective_polar_trace.py b/scripts/r8_e01_objective_polar_trace.py index a283c1b2d..828872727 100644 --- a/scripts/r8_e01_objective_polar_trace.py +++ b/scripts/r8_e01_objective_polar_trace.py @@ -10,7 +10,7 @@ import numpy as np -from anysolver._ge_beam3_mixed_ad import ( +from anyfesolver._ge_beam3_mixed_ad import ( Jet2, RotationDomainError, constant_matrix, dot, matmul, matvec, rotation_exponential, so3_exp, so3_log, sqrt, transpose, ) diff --git a/scripts/r8_e02_distributing_feasibility.py b/scripts/r8_e02_distributing_feasibility.py index a60e9cdc6..908f5b237 100644 --- a/scripts/r8_e02_distributing_feasibility.py +++ b/scripts/r8_e02_distributing_feasibility.py @@ -160,7 +160,7 @@ def native_cases(nx=10, ny=4): def _native_load_cases(nx, ny, loads, *, geometry_builder=None): """Local fixture seam; each bounded caller owns its explicit load inventory.""" - from anysolver import b3_ge, stiffened_shell as ss + from anyfesolver import b3_ge, stiffened_shell as ss from scipy.spatial.transform import Rotation from scripts.r8_e02_native_rigid_tip import geometry if geometry_builder is not None: diff --git a/scripts/r8_e02_native_rigid_tip.py b/scripts/r8_e02_native_rigid_tip.py index 185d7c3db..13d40c2e2 100644 --- a/scripts/r8_e02_native_rigid_tip.py +++ b/scripts/r8_e02_native_rigid_tip.py @@ -1,6 +1,6 @@ """Restricted E02 development comparison; no scientific acceptance adjudication. -Use an installed ANYsolver. A free unloaded beam stub supplies the public +Use an installed ANYfeSolver. A free unloaded beam stub supplies the public footprint pose port, not a second load path. The rigid patch occupies x>=.8 on a flat isotropic panel. Fz/Mx/My test the out-of-plane physical sector; neither six-channel continuum equivalence nor normal-spin physics is claimed. @@ -56,9 +56,9 @@ def main(): import numpy as np from scipy import sparse from threadpoolctl import threadpool_info - from anysolver import b3_ge, stiffened_shell as api - import anysolver - assert Path(anysolver.__file__).resolve().is_relative_to(args.site.resolve()) + from anyfesolver import b3_ge, stiffened_shell as api + import anyfesolver + assert Path(anyfesolver.__file__).resolve().is_relative_to(args.site.resolve()) pools = threadpool_info() if any(p.get("num_threads") != 1 for p in pools): raise RuntimeError("effective numerical pools must use one thread") @@ -203,7 +203,7 @@ def main(): port_origin_m=origin, young_pa=e, poisson=nu), nodes=nodes, cells=cells, patch_cells=patch, patch_nodes=patch_nodes, root_nodes=root, loads=LOADS, source_runner_sha256=hashlib.sha256(Path(__file__).read_bytes()).hexdigest(), - installed_anysolver=str(anysolver.__file__), numerical_pools=pools, + installed_anyfesolver=str(anyfesolver.__file__), numerical_pools=pools, runtime_seconds=time.monotonic()-started, results=results) with (args.output/'result.json').open('x') as f: json.dump(manifest, f, indent=2); f.write('\n') diff --git a/scripts/r8_e02_rigid_principal_current.py b/scripts/r8_e02_rigid_principal_current.py index 51af625fb..f9b6644f9 100644 --- a/scripts/r8_e02_rigid_principal_current.py +++ b/scripts/r8_e02_rigid_principal_current.py @@ -22,7 +22,7 @@ ROOT=Path(__file__).resolve().parents[1] SITE=ROOT/'docs/agent_plans/development/r8-b2-work-guard-installed-20261009/site' -CCX=Path('C:/Github/ANYsolver/.qualification/b3-ge-e4-pl/calculix-223/CalculiX-2.23.0-win-x64/bin/ccx.exe') +CCX=Path('C:/Github/ANYfeSolver/.qualification/b3-ge-e4-pl/calculix-223/CalculiX-2.23.0-win-x64/bin/ccx.exe') def sha(path):return hashlib.sha256(Path(path).read_bytes()).hexdigest() def save(path,value):Path(path).write_text(json.dumps(value,indent=2,allow_nan=False)) @@ -206,10 +206,10 @@ def parse_current_solid(data,dat,stdout,deck,manifest,*,principal_observation=Fa def native(load,path): c,deck,m,a=staged(load,path);path=Path(path) sys.path.insert(0,str(SITE)) - import anysolver,os,psutil - from anysolver import b3_ge,stiffened_shell as api + import anyfesolver,os,psutil + from anyfesolver import b3_ge,stiffened_shell as api from threadpoolctl import threadpool_info - if not Path(anysolver.__file__).resolve().is_relative_to(SITE):raise RuntimeError('mixed source/site import') + if not Path(anyfesolver.__file__).resolve().is_relative_to(SITE):raise RuntimeError('mixed source/site import') pools=threadpool_info() if psutil.Process().cpu_affinity()!=[0] or os.environ.get('NUMBA_DISABLE_JIT')!='1' or any(p['num_threads']!=1 for p in pools): raise RuntimeError('effective resource configuration differs') @@ -254,7 +254,7 @@ def native(load,path): save(path/'native-observation.json',record) metrics=measure(c,record,c['model'],deck,a);save(path/'native-metrics.json',metrics) imports={name:str(Path(module.__file__).resolve()) for name,module in sys.modules.items() - if name.startswith('anysolver') and getattr(module,'__file__',None)} + if name.startswith('anyfesolver') and getattr(module,'__file__',None)} finalpools=threadpool_info();save(path/'native-runtime-final.json',dict(imports=imports,pools=finalpools,affinity=psutil.Process().cpu_affinity())) if any(not Path(p).is_relative_to(SITE) for p in imports.values()) or any(p['num_threads']!=1 for p in finalpools):raise RuntimeError('mixed imports/effective pools') if (not metrics['diagnostic_limits_satisfied'] or pair<=0 or guards['stub_force_max']>1e-7 or diff --git a/scripts/r8_e02_rigid_tip_thickness_run_dev.py b/scripts/r8_e02_rigid_tip_thickness_run_dev.py index a607bd44e..23708e148 100644 --- a/scripts/r8_e02_rigid_tip_thickness_run_dev.py +++ b/scripts/r8_e02_rigid_tip_thickness_run_dev.py @@ -22,7 +22,7 @@ sys.path.insert(0, str(ROOT)) from scripts.r8_e02_rigid_tip_reference import build_deck, parse_result, CCX_SHA256 -CCX = Path("C:/Github/ANYsolver/.qualification/b3-ge-e4-pl/calculix-223/" +CCX = Path("C:/Github/ANYfeSolver/.qualification/b3-ge-e4-pl/calculix-223/" "CalculiX-2.23.0-win-x64/bin/ccx.exe") ARCHIVE = ROOT / "docs/agent_plans/development/r8-e02-rigid-tip-reference-20261001/raw-v1.zip" ARCHIVE_MEMBER = "r8-e02-rigid-tip-dev-v3/external-ccx-20x8-s1/Mx/" diff --git a/scripts/r8_e02_rigid_torque_fields.py b/scripts/r8_e02_rigid_torque_fields.py index 15b1615a3..d9ae71d79 100644 --- a/scripts/r8_e02_rigid_torque_fields.py +++ b/scripts/r8_e02_rigid_torque_fields.py @@ -141,13 +141,13 @@ def installed_native_field(site,output): if output.exists():raise FileExistsError(output) output.mkdir(parents=True) sys.path.insert(0,str(site)) - from anysolver import b3_ge,stiffened_shell as api - import anysolver + from anyfesolver import b3_ge,stiffened_shell as api + import anyfesolver from threadpoolctl import threadpool_info import os import psutil - if not Path(anysolver.__file__).resolve().is_relative_to(site): - raise RuntimeError('effective ANYsolver import escaped installed artifact') + if not Path(anyfesolver.__file__).resolve().is_relative_to(site): + raise RuntimeError('effective ANYfeSolver import escaped installed artifact') evidence=site.parent binding=json.loads((evidence/'installed-v2/binding.json').read_text()) wheel=evidence/'dist/anysolver-0.4.7-py3-none-any.whl' @@ -160,7 +160,7 @@ def installed_native_field(site,output): pools=threadpool_info() if any(p['num_threads']!=1 for p in pools) or os.environ.get('NUMBA_DISABLE_JIT')!='1' or psutil.Process().cpu_affinity()!=[0]: raise RuntimeError('effective CPU/thread/JIT settings differ') - runtime=dict(python=sys.version,executable=sys.executable,anysolver=str(Path(anysolver.__file__).resolve()), + runtime=dict(python=sys.version,executable=sys.executable,anyfesolver=str(Path(anyfesolver.__file__).resolve()), wheel_sha256=WHEEL_SHA,source_head=binding['source_head'],numerical_pools=pools, affinity=psutil.Process().cpu_affinity(),jit_disabled=os.environ.get('NUMBA_DISABLE_JIT'), source_contract='spatial exponential(jets[i][3:]) in _ge_beam3_variational_shell.deformation; reference-linear zero-anchor theta') @@ -213,7 +213,7 @@ def installed_native_field(site,output): guards['shell_normal_spin_max']>1e-12 or max(abs(x) for x in guards['port_offset_identity_m'])>1e-9): raise RuntimeError('native physical field guards failed; completed fields preserved, no retry') runtime['imported_modules']={name:str(Path(m.__file__).resolve()) for name,m in sys.modules.items() - if name.startswith('anysolver') and getattr(m,'__file__',None)} + if name.startswith('anyfesolver') and getattr(m,'__file__',None)} if any(not Path(p).is_relative_to(site) for p in runtime['imported_modules'].values()): raise RuntimeError('mixed source/installed runtime imports') runtime['final_numerical_pools']=threadpool_info() diff --git a/scripts/r8_e02_rigid_torque_refinement.py b/scripts/r8_e02_rigid_torque_refinement.py index bdcfb956c..9c4243029 100644 --- a/scripts/r8_e02_rigid_torque_refinement.py +++ b/scripts/r8_e02_rigid_torque_refinement.py @@ -136,13 +136,13 @@ def collect80(site,output): site=Path(site).resolve();output=Path(output) if output.exists():raise FileExistsError(output) output.mkdir(parents=True);sys.path.insert(0,str(site)) - from anysolver import b3_ge,stiffened_shell as api - import anysolver,os,psutil + from anyfesolver import b3_ge,stiffened_shell as api + import anyfesolver,os,psutil from scipy import sparse from threadpoolctl import threadpool_info evidence=site.parent;binding=json.loads((evidence/'installed-v2/binding.json').read_text()) wheel=evidence/'dist/anysolver-0.4.7-py3-none-any.whl' - if not Path(anysolver.__file__).resolve().is_relative_to(site) or digest(wheel.read_bytes())!=WHEEL_SHA: + if not Path(anyfesolver.__file__).resolve().is_relative_to(site) or digest(wheel.read_bytes())!=WHEEL_SHA: raise RuntimeError('effective import/guarded wheel identity changed') with zipfile.ZipFile(wheel) as archive: for relative,expected in binding['module_sha256'].items(): @@ -202,7 +202,7 @@ def collect80(site,output): director_contract=DIRECTOR,guards=guards,runtime=runtime,sparse_operators=sparse_inventory) (output/'native80-fields.json').write_text(json.dumps(fields,indent=2)) runtime['imported_modules']={name:str(Path(m.__file__).resolve()) for name,m in sys.modules.items() - if name.startswith('anysolver') and getattr(m,'__file__',None)} + if name.startswith('anyfesolver') and getattr(m,'__file__',None)} if any(not Path(p).is_relative_to(site) for p in runtime['imported_modules'].values()):raise RuntimeError('mixed effective imports') runtime['final_numerical_pools']=threadpool_info() (output/'runtime-final.json').write_text(json.dumps(runtime,indent=2)) diff --git a/scripts/r8_e03_coarse_screen.py b/scripts/r8_e03_coarse_screen.py index b214e8455..d74df6514 100644 --- a/scripts/r8_e03_coarse_screen.py +++ b/scripts/r8_e03_coarse_screen.py @@ -15,7 +15,7 @@ import zipfile -CCX_PATH = Path("C:/Github/ANYsolver/.qualification/b3-ge-e4-pl/calculix-223/CalculiX-2.23.0-win-x64/bin/ccx.exe") +CCX_PATH = Path("C:/Github/ANYfeSolver/.qualification/b3-ge-e4-pl/calculix-223/CalculiX-2.23.0-win-x64/bin/ccx.exe") CCX_SHA256 = "27a9426a1ee2f72c38fbe892e0ffaf38e14867628ffd0235770261b6f3ec9c5f" WHEEL_SHA256 = "fa5507fe14cc09949743adb7d5ae340a2499d9b813d6b80a1b7d4ea414267e82" MODULE_MANIFEST = ".qualification/b3-ge-e4-pl/r8-e03-curved-source-dev-20261007-v1/inputs-manifest-v1.json" @@ -74,12 +74,12 @@ def _bindings(bindings, phase): provider = Path(bindings["installed_provider_root"]).resolve() # Reuse entry-v1.py's source/wheel/site payload parity, without importing a solver. source = {p.relative_to(source_root/"src").as_posix(): _sha(p.read_bytes()) - for p in (source_root/"src/anysolver").rglob("*.py")} + for p in (source_root/"src/anyfesolver").rglob("*.py")} installed = {p.relative_to(provider).as_posix(): _sha(p.read_bytes()) - for p in (provider/"anysolver").rglob("*.py")} + for p in (provider/"anyfesolver").rglob("*.py")} with zipfile.ZipFile(wheel) as archive: payload = {name: _sha(archive.read(name)) for name in archive.namelist() - if name.startswith("anysolver/") and name.endswith(".py")} + if name.startswith("anyfesolver/") and name.endswith(".py")} if source != manifest["source_modules"] or source != payload or source != installed: raise ValueError("source/wheel/installed 431-module payload mismatch") command = bindings.get("command") @@ -183,12 +183,12 @@ def finish_screen(evidence_dir, *, receipt, raw): raise ValueError("CCX version 2.23 must appear in actual execution stdout") result = parse_result(case, metadata, raw["frd"], raw["sta"], raw["stdout"], raw["stderr"], receipt) else: - origin = Path(receipt["anysolver_origin"]).resolve() + origin = Path(receipt["anyfesolver_origin"]).resolve() if not origin.is_relative_to(Path(bindings["installed_provider_root"]).resolve()): raise ValueError("native child must load declared installed provider") origin_name = origin.relative_to(Path(bindings["installed_provider_root"]).resolve()).as_posix() modules = json.loads((Path(bindings["source_root"])/MODULE_MANIFEST).read_bytes())["source_modules"] - if origin_name != "anysolver/__init__.py" or receipt.get("anysolver_origin_sha256") != modules[origin_name] or _sha(origin.read_bytes()) != modules[origin_name]: + if origin_name != "anyfesolver/__init__.py" or receipt.get("anyfesolver_origin_sha256") != modules[origin_name] or _sha(origin.read_bytes()) != modules[origin_name]: raise ValueError("actual native child origin must match installed module manifest hash") result = _detached_receipt(json.loads(raw["native_result"])) for key, value in dict(status="COMPLETED_UNQUALIFIED_B2_CANDIDATE", profile=B2, diff --git a/scripts/r8_e03_ge_distributing_work_bridge.py b/scripts/r8_e03_ge_distributing_work_bridge.py index db2cf3523..5b21c6a17 100644 --- a/scripts/r8_e03_ge_distributing_work_bridge.py +++ b/scripts/r8_e03_ge_distributing_work_bridge.py @@ -167,8 +167,8 @@ def rectangular_bridge(width_m, height_m, thickness_m, *, frame, origin, nx=2, n def _native_reference(bridge, offset_world): """Existing flat-XY local prototype, evaluated at an actual common rigid pose.""" - from anysolver import _stiffened_shell_distributing_footprint as reference - from anysolver._stiffened_shell_distributing_pose import FiniteDistributingPose + from anyfesolver import _stiffened_shell_distributing_footprint as reference + from anyfesolver._stiffened_shell_distributing_pose import FiniteDistributingPose if (type(bridge) is not ReferenceBridge or getattr(bridge, "_factory_seal", None) is not _FACTORY_KEY @@ -190,7 +190,7 @@ def _native_reference(bridge, offset_world): def native_local_evaluation(bridge, offset_world, *, face_delta=None, beam_delta=None): """Deferred local oracle only; calls require later separately authorized checks.""" - from anysolver._ge_beam3_mixed_ad import rotation_exponential + from anyfesolver._ge_beam3_mixed_ad import rotation_exponential pose, offset = _native_reference(bridge, offset_world) face = np.zeros_like(bridge.face_samples) if face_delta is None else _array(face_delta, bridge.face_samples.shape) diff --git a/scripts/r8_e03_native_reference.py b/scripts/r8_e03_native_reference.py index 6e8592612..fb246b6c2 100644 --- a/scripts/r8_e03_native_reference.py +++ b/scripts/r8_e03_native_reference.py @@ -15,7 +15,7 @@ def b2_definition(case): validate_case(case) - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss grid, nx = case["grids"]["b2"], case["nx"] section = ss.LinearSection.isotropic( @@ -63,7 +63,7 @@ def ge_definition(case, *, density_kg_m3): validate_case(case) if type(density_kg_m3) not in (int, float) or not math.isfinite(density_kg_m3) or density_kg_m3 <= 0: raise ValueError("explicit positive physical density required; no spectral claim") - from anysolver import b3_ge, stiffened_shell as ss + from anyfesolver import b3_ge, stiffened_shell as ss p, e, nu = case["section"], case["young_pa"], case["poisson"] shear = e/(2*(1+nu)) @@ -100,7 +100,7 @@ def ge_definition(case, *, density_kg_m3): def execute_b2(case): """Run once only under the caller's separately granted numerical authority.""" - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss definition, load, numbering, positions = b2_definition(case) owner = ss.create_analysis(definition=definition) diff --git a/scripts/r8_e04_material_consumer.py b/scripts/r8_e04_material_consumer.py index a0a0cddf3..9c86b5cb3 100644 --- a/scripts/r8_e04_material_consumer.py +++ b/scripts/r8_e04_material_consumer.py @@ -1,6 +1,6 @@ """Reopen a declared E04 material roof and continue an existing accepted path. -Uses installed ANYsolver/ANYfem public interfaces. Run serially under the task's +Uses installed ANYfeSolver/ANYfem public interfaces. Run serially under the task's resource supervisor. Synthetic strengths do not establish physical capacity. The source checkpoint must match the explicitly reconstructed definition. """ @@ -41,14 +41,14 @@ def main(): # Capture inputs before writing any output; the definition validates all strengths. checkpoint=args.checkpoint.read_bytes() from anymaterial import DNVC208MaterialCurve - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss from anyfem.solve.stiffened_shell import ExperimentalGEPointPanel,save_case,load_case from anyfem.io.project_file import save_project,load_project from anyfem.model.project import Project from anyfem.model.records import AnalysisDefinition from docs.reference_cases.stiffened_shell_e04_roof import ( build,material_definition,crown_reference_perturbations) - import anysolver,anyfem,numba,threadpoolctl + import anyfesolver,anyfem,numba,threadpoolctl pools=threadpoolctl.threadpool_info() assert pools and all(p['num_threads']==1 for p in pools) assert numba.get_num_threads()==1 and numba.config.DISABLE_JIT @@ -70,7 +70,7 @@ def main(): args.output.mkdir(parents=True,exist_ok=False) record=dict(status='IN_PROGRESS',input_checkpoint_sha256=hashlib.sha256(checkpoint).hexdigest(), inputs={key:(str(value) if isinstance(value,Path) else value) for key,value in vars(args).items()}, - imported_solver=str(Path(anysolver.__file__).resolve()), + imported_solver=str(Path(anyfesolver.__file__).resolve()), imported_consumer=str(Path(anyfem.__file__).resolve()),threadpools=pools, reference_transport=(None if reference_change is None else dict( policy=reference_change.policy,source_identity=reference_change.source_identity, @@ -135,7 +135,7 @@ def accepted_consumer(result): record.update(status='COMPLETED_DEVELOPMENT_ONLY',each_checkpoint_equal=True, final_checkpoint_equal=True,detailed_material_equal=True,history_equal=True) imports={name:str(Path(module.__file__).resolve()) for name,module in __import__('sys').modules.items() - if name.startswith(('anysolver','anyfem')) and getattr(module,'__file__',None)} + if name.startswith(('anyfesolver','anyfem')) and getattr(module,'__file__',None)} record['imports']=imports;save() except Exception as error: record['status']='FAILED';record['failure']=dict(type=type(error).__name__,message=str(error)) diff --git a/scripts/r8_e04_native_roof.py b/scripts/r8_e04_native_roof.py index 22d022aa3..a7fc9e12c 100644 --- a/scripts/r8_e04_native_roof.py +++ b/scripts/r8_e04_native_roof.py @@ -64,10 +64,10 @@ def main(): if args.restart_after is not None and not 0 None: @@ -145,9 +145,9 @@ def preflight(level: int) -> dict: require(sha(FAMILY / "family-result.json") == FAMILY_SHA and AUDIT.is_file(), "frozen family/audit identity changed") nx, ny, cells = LEVELS[level] - old_owner = subprocess.run(["git", "show", f"{OLD_PRODUCT}:src/anysolver/_stiffened_shell_ge_experimental.py"], + old_owner = subprocess.run(["git", "show", f"{OLD_PRODUCT}:src/anyfesolver/_stiffened_shell_ge_experimental.py"], cwd=ROOT, check=True, capture_output=True).stdout - current_owner = (ROOT / "src/anysolver/_stiffened_shell_ge_experimental.py").read_bytes() + current_owner = (ROOT / "src/anyfesolver/_stiffened_shell_ge_experimental.py").read_bytes() require(function_ast_hash(old_owner, "_assemble_beam") == function_ast_hash(current_owner, "_assemble_beam"), "native beam assembly changed from frozen product") @@ -199,7 +199,7 @@ def child(level: int, folder: Path, campaign: str) -> None: import numba import psutil from threadpoolctl import threadpool_info - from anysolver import stiffened_shell as api + from anyfesolver import stiffened_shell as api from scripts.b3_e4_bl5_coherent_aggregation_dev import model from scripts.b3_e4_bl5_reference_actions_dev import native_slots, physical_loads from scripts.b3_e4_bl5_riesz_controls_dev import beam_norm, shell_scalar diff --git a/scripts/r8_f03_finite_runner_dev.py b/scripts/r8_f03_finite_runner_dev.py index f26c76660..c8aabb31d 100644 --- a/scripts/r8_f03_finite_runner_dev.py +++ b/scripts/r8_f03_finite_runner_dev.py @@ -20,12 +20,12 @@ ENV['PYTHONOPTIMIZE'] = '0' SOURCES = ('scripts/r8_f03_finite_local_dev.py', 'scripts/r8_f03_finite_inventory_dev.py', 'scripts/r8_f03_finite_sparse_dev.py', 'scripts/r8_f03_finite_runner_dev.py', - 'tests/test_r8_f03_finite_certificate_dev.py', 'src/anysolver/e4_pl_element.py', - 'src/anysolver/_ge_beam3_retained_generalized.py', - 'src/anysolver/_ge_beam3_generalized_cell.py', - 'src/anysolver/_ge_beam3_p5/compensated.py', - 'src/anysolver/_stiffened_shell_bl5_local_experimental.py', - 'src/anysolver/_stiffened_shell_l1_local_experimental.py', + 'tests/test_r8_f03_finite_certificate_dev.py', 'src/anyfesolver/e4_pl_element.py', + 'src/anyfesolver/_ge_beam3_retained_generalized.py', + 'src/anyfesolver/_ge_beam3_generalized_cell.py', + 'src/anyfesolver/_ge_beam3_p5/compensated.py', + 'src/anyfesolver/_stiffened_shell_bl5_local_experimental.py', + 'src/anyfesolver/_stiffened_shell_l1_local_experimental.py', 'scripts/b3_e4_bl5_riesz_controls_dev.py', 'scripts/r8_bl5_mixed_shell_h1_dev.py') diff --git a/scripts/r8_f03_growing_dev.py b/scripts/r8_f03_growing_dev.py index b7f19fc0f..9d6f1a118 100644 --- a/scripts/r8_f03_growing_dev.py +++ b/scripts/r8_f03_growing_dev.py @@ -172,8 +172,8 @@ def source_stored(reference): if reference['level']!=16:raise Unresolved('actual source assessment only level16 until reviewed readiness') import numpy as np from scipy import sparse - from anysolver import _stiffened_shell_ge_experimental as compiler - from anysolver._stiffened_shell_l1_assembly_experimental import compile_lines + from anyfesolver import _stiffened_shell_ge_experimental as compiler + from anyfesolver._stiffened_shell_l1_assembly_experimental import compile_lines from scripts.b3_e4_bl5_coherent_aggregation_dev import model n,ny=reference['n'],reference['ny'];definition,policy=model(n,ny,n,2) sm,sids,xyz,si,sparts=compiler._shell_reference(definition.shell) diff --git a/scripts/r8_f03_growing_halfpoint_dev.py b/scripts/r8_f03_growing_halfpoint_dev.py index c8927490b..178ac78cf 100644 --- a/scripts/r8_f03_growing_halfpoint_dev.py +++ b/scripts/r8_f03_growing_halfpoint_dev.py @@ -152,7 +152,7 @@ def admit_symmetric_target(entries, box, family): def assess(level=16): - from anysolver.linalg import SparseSolverBackend, MatrixClass + from anyfesolver.linalg import SparseSolverBackend, MatrixClass reference = physical.exact_reference(level) stored = physical.source_stored(reference) j = physical.congruence(reference) diff --git a/scripts/r8_f03_growing_runner_dev.py b/scripts/r8_f03_growing_runner_dev.py index 8ef97af0f..3c38438c8 100644 --- a/scripts/r8_f03_growing_runner_dev.py +++ b/scripts/r8_f03_growing_runner_dev.py @@ -23,13 +23,13 @@ 'scripts/r8_f03_physical_interval_dev.py', 'tests/test_r8_f03_growing_dev.py', 'scripts/r8_f03_finite_local_dev.py', 'scripts/r8_f03_finite_inventory_dev.py', 'scripts/r8_f03_finite_sparse_dev.py', - 'src/anysolver/e4_pl_element.py', 'src/anysolver/_stiffened_shell_ge_experimental.py', - 'src/anysolver/_stiffened_shell_q4_reference.py', 'src/anysolver/_ge_beam3_retained_generalized.py', - 'src/anysolver/_ge_beam3_generalized_cell.py', 'src/anysolver/_ge_beam3_generalized_ellipsoid_section.py', - 'src/anysolver/_ge_beam3_centered_reference.py', 'src/anysolver/_ge_beam3_p5/compensated.py', - 'src/anysolver/_ge_beam3_generalized_static_boundary.py', 'src/anysolver/_stiffened_shell_l1_assembly_experimental.py', - 'src/anysolver/_stiffened_shell_bl5_local_experimental.py', 'src/anysolver/_stiffened_shell_l1_local_experimental.py', - 'src/anysolver/linalg.py', 'scripts/_b3_e4_f03_local_scientific_supervisor.py', + 'src/anyfesolver/e4_pl_element.py', 'src/anyfesolver/_stiffened_shell_ge_experimental.py', + 'src/anyfesolver/_stiffened_shell_q4_reference.py', 'src/anyfesolver/_ge_beam3_retained_generalized.py', + 'src/anyfesolver/_ge_beam3_generalized_cell.py', 'src/anyfesolver/_ge_beam3_generalized_ellipsoid_section.py', + 'src/anyfesolver/_ge_beam3_centered_reference.py', 'src/anyfesolver/_ge_beam3_p5/compensated.py', + 'src/anyfesolver/_ge_beam3_generalized_static_boundary.py', 'src/anyfesolver/_stiffened_shell_l1_assembly_experimental.py', + 'src/anyfesolver/_stiffened_shell_bl5_local_experimental.py', 'src/anyfesolver/_stiffened_shell_l1_local_experimental.py', + 'src/anyfesolver/linalg.py', 'scripts/_b3_e4_f03_local_scientific_supervisor.py', 'docs/agent_plans/development/r8-f03-common-density-20261010/REFERENCE_MECHANICS_CONTRACT.md', 'docs/agent_plans/development/r8-f03-common-density-20261010/physical-interval-v1/ROOT_DISPOSITION.md', 'docs/agent_plans/development/r8-f03-common-density-20261010/physical-interval-v1/INDEPENDENT_REVIEW.md') diff --git a/scripts/r8_f03_halfpoint_dev.py b/scripts/r8_f03_halfpoint_dev.py index ffcd4d23b..05fd5ea4e 100644 --- a/scripts/r8_f03_halfpoint_dev.py +++ b/scripts/r8_f03_halfpoint_dev.py @@ -151,7 +151,7 @@ def admit_symmetric_target(entries, box, family): def assess(): - from anysolver.linalg import SparseSolverBackend, MatrixClass + from anyfesolver.linalg import SparseSolverBackend, MatrixClass reference = physical.exact_reference() stored = physical.source_stored(reference) j = physical.congruence(reference) diff --git a/scripts/r8_f03_halfpoint_runner_dev.py b/scripts/r8_f03_halfpoint_runner_dev.py index b0501656b..0dabe6ffe 100644 --- a/scripts/r8_f03_halfpoint_runner_dev.py +++ b/scripts/r8_f03_halfpoint_runner_dev.py @@ -23,13 +23,13 @@ 'scripts/r8_f03_physical_interval_dev.py', 'tests/test_r8_f03_halfpoint_dev.py', 'scripts/r8_f03_finite_local_dev.py', 'scripts/r8_f03_finite_inventory_dev.py', 'scripts/r8_f03_finite_sparse_dev.py', - 'src/anysolver/e4_pl_element.py', 'src/anysolver/_stiffened_shell_ge_experimental.py', - 'src/anysolver/_stiffened_shell_q4_reference.py', 'src/anysolver/_ge_beam3_retained_generalized.py', - 'src/anysolver/_ge_beam3_generalized_cell.py', 'src/anysolver/_ge_beam3_generalized_ellipsoid_section.py', - 'src/anysolver/_ge_beam3_centered_reference.py', 'src/anysolver/_ge_beam3_p5/compensated.py', - 'src/anysolver/_ge_beam3_generalized_static_boundary.py', 'src/anysolver/_stiffened_shell_l1_assembly_experimental.py', - 'src/anysolver/_stiffened_shell_bl5_local_experimental.py', 'src/anysolver/_stiffened_shell_l1_local_experimental.py', - 'src/anysolver/linalg.py', 'scripts/_b3_e4_f03_local_scientific_supervisor.py', + 'src/anyfesolver/e4_pl_element.py', 'src/anyfesolver/_stiffened_shell_ge_experimental.py', + 'src/anyfesolver/_stiffened_shell_q4_reference.py', 'src/anyfesolver/_ge_beam3_retained_generalized.py', + 'src/anyfesolver/_ge_beam3_generalized_cell.py', 'src/anyfesolver/_ge_beam3_generalized_ellipsoid_section.py', + 'src/anyfesolver/_ge_beam3_centered_reference.py', 'src/anyfesolver/_ge_beam3_p5/compensated.py', + 'src/anyfesolver/_ge_beam3_generalized_static_boundary.py', 'src/anyfesolver/_stiffened_shell_l1_assembly_experimental.py', + 'src/anyfesolver/_stiffened_shell_bl5_local_experimental.py', 'src/anyfesolver/_stiffened_shell_l1_local_experimental.py', + 'src/anyfesolver/linalg.py', 'scripts/_b3_e4_f03_local_scientific_supervisor.py', 'docs/agent_plans/development/r8-f03-common-density-20261010/REFERENCE_MECHANICS_CONTRACT.md', 'docs/agent_plans/development/r8-f03-common-density-20261010/physical-interval-v1/ROOT_DISPOSITION.md', 'docs/agent_plans/development/r8-f03-common-density-20261010/physical-interval-v1/INDEPENDENT_REVIEW.md') diff --git a/scripts/r8_f03_physical_contract_controls_dev.py b/scripts/r8_f03_physical_contract_controls_dev.py index 3fb38e938..fd1deff8a 100644 --- a/scripts/r8_f03_physical_contract_controls_dev.py +++ b/scripts/r8_f03_physical_contract_controls_dev.py @@ -32,10 +32,10 @@ def require(test, message): def sources(): return [Path(__file__), ROOT / "scripts/r8_f03_physical_contract_dev.py", ROOT / "tests/test_r8_f03_physical_contract_20261010.py", - ROOT / "src/anysolver/_ge_beam3_retained_generalized.py", - ROOT / "src/anysolver/_stiffened_shell_l1_local_experimental.py", - ROOT / "src/anysolver/_stiffened_shell_bl5_local_experimental.py", - ROOT / "src/anysolver/e4_pl_element.py", + ROOT / "src/anyfesolver/_ge_beam3_retained_generalized.py", + ROOT / "src/anyfesolver/_stiffened_shell_l1_local_experimental.py", + ROOT / "src/anyfesolver/_stiffened_shell_bl5_local_experimental.py", + ROOT / "src/anyfesolver/e4_pl_element.py", ROOT / "scripts/r8_bl5_actual_primal_work_dev.py"] diff --git a/scripts/r8_f03_physical_contract_dev.py b/scripts/r8_f03_physical_contract_dev.py index 2d2be80c6..bc2461680 100644 --- a/scripts/r8_f03_physical_contract_dev.py +++ b/scripts/r8_f03_physical_contract_dev.py @@ -268,12 +268,12 @@ def write_record(output, *, controls=False): output = Path(output) if output.exists(): raise ValueError("unique output path required to preserve evidence") - paths = [Path(__file__), ROOT / "src/anysolver/_ge_beam3_retained_generalized.py", - ROOT / "src/anysolver/_ge_beam3_generalized_static_boundary.py", - ROOT / "src/anysolver/_stiffened_shell_l1_local_experimental.py", - ROOT / "src/anysolver/_stiffened_shell_bl5_local_experimental.py", - ROOT / "src/anysolver/_stiffened_shell_l1_assembly_experimental.py", - ROOT / "src/anysolver/e4_pl_element.py"] + paths = [Path(__file__), ROOT / "src/anyfesolver/_ge_beam3_retained_generalized.py", + ROOT / "src/anyfesolver/_ge_beam3_generalized_static_boundary.py", + ROOT / "src/anyfesolver/_stiffened_shell_l1_local_experimental.py", + ROOT / "src/anyfesolver/_stiffened_shell_bl5_local_experimental.py", + ROOT / "src/anyfesolver/_stiffened_shell_l1_assembly_experimental.py", + ROOT / "src/anyfesolver/e4_pl_element.py"] record = {"contract": prospective_contract(), "head": subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=ROOT, text=True).strip(), "source_sha256": {str(p.relative_to(ROOT)): hashlib.sha256(p.read_bytes()).hexdigest() for p in paths}, diff --git a/scripts/r8_f03_physical_interval_dev.py b/scripts/r8_f03_physical_interval_dev.py index d9f571ca4..7b754ebe4 100644 --- a/scripts/r8_f03_physical_interval_dev.py +++ b/scripts/r8_f03_physical_interval_dev.py @@ -170,9 +170,9 @@ def source_stored(reference): """ import numpy as np from scipy import sparse - from anysolver import b3_ge - from anysolver import _stiffened_shell_ge_experimental as compiler - from anysolver._stiffened_shell_l1_assembly_experimental import ExperimentalBL5Line, compile_lines + from anyfesolver import b3_ge + from anyfesolver import _stiffened_shell_ge_experimental as compiler + from anyfesolver._stiffened_shell_l1_assembly_experimental import ExperimentalBL5Line, compile_lines p = reference['inputs']; ell = float(p.ell) length = float(2*p.a*p.cells) coordinates = tuple((float(2*p.a*column), float(2*p.b*side), 0.) @@ -286,7 +286,7 @@ def endpoint_intervals(reference, stored, j, t, caps): def assess(inputs=Inputs()): - from anysolver.linalg import SparseSolverBackend, MatrixClass + from anyfesolver.linalg import SparseSolverBackend, MatrixClass reference = exact_reference(inputs) stored = source_stored(reference) j = congruence(reference) diff --git a/scripts/r8_f03_physical_interval_runner_dev.py b/scripts/r8_f03_physical_interval_runner_dev.py index ec8fb15ed..ff7311811 100644 --- a/scripts/r8_f03_physical_interval_runner_dev.py +++ b/scripts/r8_f03_physical_interval_runner_dev.py @@ -22,13 +22,13 @@ SOURCES = ('scripts/r8_f03_physical_interval_dev.py', 'scripts/r8_f03_physical_interval_runner_dev.py', 'tests/test_r8_f03_physical_interval_dev.py', 'tests/test_r8_f03_finite_certificate_dev.py', 'scripts/r8_f03_finite_local_dev.py', 'scripts/r8_f03_finite_inventory_dev.py', 'scripts/r8_f03_finite_sparse_dev.py', - 'src/anysolver/e4_pl_element.py', 'src/anysolver/_stiffened_shell_ge_experimental.py', - 'src/anysolver/_stiffened_shell_q4_reference.py', 'src/anysolver/_ge_beam3_retained_generalized.py', - 'src/anysolver/_ge_beam3_generalized_cell.py', 'src/anysolver/_ge_beam3_generalized_ellipsoid_section.py', - 'src/anysolver/_ge_beam3_centered_reference.py', 'src/anysolver/_ge_beam3_p5/compensated.py', - 'src/anysolver/_ge_beam3_generalized_static_boundary.py', 'src/anysolver/_stiffened_shell_l1_assembly_experimental.py', - 'src/anysolver/_stiffened_shell_bl5_local_experimental.py', 'src/anysolver/_stiffened_shell_l1_local_experimental.py', - 'src/anysolver/linalg.py', 'scripts/_b3_e4_f03_local_scientific_supervisor.py') + 'src/anyfesolver/e4_pl_element.py', 'src/anyfesolver/_stiffened_shell_ge_experimental.py', + 'src/anyfesolver/_stiffened_shell_q4_reference.py', 'src/anyfesolver/_ge_beam3_retained_generalized.py', + 'src/anyfesolver/_ge_beam3_generalized_cell.py', 'src/anyfesolver/_ge_beam3_generalized_ellipsoid_section.py', + 'src/anyfesolver/_ge_beam3_centered_reference.py', 'src/anyfesolver/_ge_beam3_p5/compensated.py', + 'src/anyfesolver/_ge_beam3_generalized_static_boundary.py', 'src/anyfesolver/_stiffened_shell_l1_assembly_experimental.py', + 'src/anyfesolver/_stiffened_shell_bl5_local_experimental.py', 'src/anyfesolver/_stiffened_shell_l1_local_experimental.py', + 'src/anyfesolver/linalg.py', 'scripts/_b3_e4_f03_local_scientific_supervisor.py') def save(path, value): diff --git a/scripts/r8_f03_sparse_signed_family_dev.py b/scripts/r8_f03_sparse_signed_family_dev.py index 59832cf06..a4815af9c 100644 --- a/scripts/r8_f03_sparse_signed_family_dev.py +++ b/scripts/r8_f03_sparse_signed_family_dev.py @@ -232,7 +232,7 @@ def stationary_system(prepared): return s,prepared.cx def reduced_state(prepared,load): - from anysolver._b2_physical_linear_batch_dev import _accurate_sparse_residual + from anyfesolver._b2_physical_linear_batch_dev import _accurate_sparse_residual load=np.asarray(load);require(load.shape==(prepared.snapshot.k.shape[0],) and np.isfinite(load).all(),'complete finite applied load required') require(np.max(np.abs(load[prepared.p]),initial=0.)==0.,'loaded resultant coordinates are outside stationary zero-RHS scope') s,c=stationary_system(prepared);a=sparse.bmat([[s,c.T],[c,None]],format='csc') @@ -245,7 +245,7 @@ def reduced_state(prepared,load): return prepared.lift(value[:len(prepared.x)]),value[len(prepared.x):] def state_metrics(snapshot,q,lm,load): - from anysolver._stiffened_shell_ge_experimental import _linear_equilibrium,_scaled_constraint_gap + from anyfesolver._stiffened_shell_ge_experimental import _linear_equilibrium,_scaled_constraint_gap residual=snapshot.k@q+snapshot.c.T@lm-load;work=float(q@load) require(np.isfinite(residual).all() and math.isfinite(work) and work!=0.,'nonzero finite physical work denominator required') reactions=np.zeros_like(q);reactions[snapshot.fixed]=residual[snapshot.fixed] @@ -286,7 +286,7 @@ def family_case(level,output): owner=None record=dict(status='FAILED',qualification=False,family=spec['model_arguments'],requested_case=spec,stage='imports') try: - from anysolver import stiffened_shell + from anyfesolver import stiffened_shell from scripts.b3_e4_bl5_coherent_aggregation_dev import model record['source_producers']=construction_provenance(model) record['stage']='model-construction' @@ -339,9 +339,9 @@ def family_case(level,output): physical=all(v['equilibrium']<=1e-8 and v['weak_gap']<=1e-9 and max(v['energy_work_relative'],v['compatible_work_relative'],v['ground_work_relative'])<=1e-8 for v in (owner_metrics,reduced_metrics)) parity_ok=all(v<=1e-10 for v in parity.values()) - modules={n:str(Path(m.__file__).resolve()) for n,m in sys.modules.items() if n.startswith(('anysolver','scripts.')) and getattr(m,'__file__',None)} + modules={n:str(Path(m.__file__).resolve()) for n,m in sys.modules.items() if n.startswith(('anyfesolver','scripts.')) and getattr(m,'__file__',None)} root=Path(__file__).resolve().parents[1] - require(all(Path(p).is_relative_to(root/'src' if n.startswith('anysolver') else root/'scripts') for n,p in modules.items()),'import escaped assigned source') + require(all(Path(p).is_relative_to(root/'src' if n.startswith('anyfesolver') else root/'scripts') for n,p in modules.items()),'import escaped assigned source') record.update(status=case_disposition(physical,parity_ok,probes),stop_family_progression=True, stage='completed',physical_parity_pass=bool(physical and parity_ok), owner_metrics=owner_metrics,reduced_metrics=reduced_metrics,parity=parity,probes=probes,kernel_positive=None,inertia=None, diff --git a/scripts/r8_f03_supported_work_dev.py b/scripts/r8_f03_supported_work_dev.py index 9b9fea29c..cfe3eebaf 100644 --- a/scripts/r8_f03_supported_work_dev.py +++ b/scripts/r8_f03_supported_work_dev.py @@ -55,8 +55,8 @@ def source_binding(): "saved full retained layout changed") require(inputs["line"]["multiplier_span"] == 4 and len(inputs["line"]["shell_nodes"]) == 17, "native saved integrated P0 support layout changed") - paths = [Path(__file__), ROOT / "src/anysolver/_stiffened_shell_l1_assembly_experimental.py", - ROOT / "src/anysolver/_stiffened_shell_l1_supported_work_experimental.py", + paths = [Path(__file__), ROOT / "src/anyfesolver/_stiffened_shell_l1_assembly_experimental.py", + ROOT / "src/anyfesolver/_stiffened_shell_l1_supported_work_experimental.py", NATIVE / "operators.npz", NATIVE / "inputs.json", NATIVE / "layout.json", EXTERNAL / "raw.json", EXTERNAL / "receipt.json", ADMISSION] return {"claim": CLAIM, "qualification": False, @@ -87,7 +87,7 @@ def evaluate(folder, plan_path): from scipy import sparse import psutil from threadpoolctl import threadpool_info - from anysolver._stiffened_shell_l1_assembly_experimental import compile_supported_shell_work + from anyfesolver._stiffened_shell_l1_assembly_experimental import compile_supported_shell_work pools = threadpool_info() require(psutil.Process().cpu_affinity() == [0] and pools and all(p["num_threads"] == 1 for p in pools), diff --git a/scripts/r8_f03_supported_work_supervise_dev.py b/scripts/r8_f03_supported_work_supervise_dev.py index 509cb3bdc..e2df80d62 100644 --- a/scripts/r8_f03_supported_work_supervise_dev.py +++ b/scripts/r8_f03_supported_work_supervise_dev.py @@ -52,8 +52,8 @@ def main(): command = [sys.executable, "-c", boot, *child_args] sources = [Path(__file__), ROOT / "scripts/r8_f03_supported_work_dev.py", ROOT / "tests/test_r8_f03_supported_work_20261010.py", - ROOT / "src/anysolver/_stiffened_shell_l1_supported_work_experimental.py", - ROOT / "src/anysolver/_stiffened_shell_l1_assembly_experimental.py"] + ROOT / "src/anyfesolver/_stiffened_shell_l1_supported_work_experimental.py", + ROOT / "src/anyfesolver/_stiffened_shell_l1_assembly_experimental.py"] source_hashes = {} for i, path in enumerate(sources): source_hashes[str(path.relative_to(ROOT))] = sha(path) diff --git a/scripts/r8_f06_active_chart_dev.py b/scripts/r8_f06_active_chart_dev.py index 24988d81d..0428f2eb2 100644 --- a/scripts/r8_f06_active_chart_dev.py +++ b/scripts/r8_f06_active_chart_dev.py @@ -9,7 +9,7 @@ def sha(p):return hashlib.sha256(Path(p).read_bytes()).hexdigest() def write(p,v):Path(p).write_text(json.dumps(v,indent=2,allow_nan=False)+'\n') def physical_to_chart(state, physical, shell_count): - from anysolver._ge_beam3_pose_joint import _exp_terms + from anyfesolver._ge_beam3_pose_joint import _exp_terms result=physical.copy() for start in range(3,shell_count,6): result[start:start+3]=__import__('numpy').linalg.solve(_exp_terms(state.q[start:start+3])[1],physical[start:start+3]) @@ -36,10 +36,10 @@ def run_case(family,out): from scipy.sparse.linalg import spsolve from scipy.spatial.transform import Rotation from anymaterial import DNVC208MaterialCurve - from anysolver import stiffened_shell as ss - from anysolver._ge_beam3_pose_joint import _exp_terms - from anysolver._stiffened_shell_rotation_charts import physical_frames - from anysolver.control import CancellationToken,SolveCancelled + from anyfesolver import stiffened_shell as ss + from anyfesolver._ge_beam3_pose_joint import _exp_terms + from anyfesolver._stiffened_shell_rotation_charts import physical_frames + from anyfesolver.control import CancellationToken,SolveCancelled from test_stiffened_shell_q4_pullback_owner import _definition from test_stiffened_shell_ge_finite_experimental import _actions,_q4_shell_j2_panel runtime_before=dict(affinity=psutil.Process().cpu_affinity(),optimize=sys.flags.optimize,numba=dict(disable_jit=bool(numba.config.DISABLE_JIT),num_threads=numba.get_num_threads()),pools=threadpoolctl.threadpool_info()) @@ -138,7 +138,7 @@ def run_case(family,out): except SolveCancelled:pass else:raise AssertionError('pre-cancel rebase unexpectedly accepted') assert owner.checkpoint()==raw_after - imports={n:str(Path(m.__file__).resolve()) for n,m in sys.modules.items() if n.startswith('anysolver') and getattr(m,'__file__',None)} + imports={n:str(Path(m.__file__).resolve()) for n,m in sys.modules.items() if n.startswith('anyfesolver') and getattr(m,'__file__',None)} site=Path(os.environ['F06_SELECTED_SITE']).resolve() assert all(Path(path).is_relative_to(site) for path in imports.values()) for path in imports.values(): @@ -172,7 +172,7 @@ def supervise(family,site,name,cache=None,probe=None): env=os.environ.copy();settings=dict(OMP_NUM_THREADS='1',OPENBLAS_NUM_THREADS='1',MKL_NUM_THREADS='1',NUMBA_NUM_THREADS='1',VECLIB_MAXIMUM_THREADS='1',NUMBA_DISABLE_JIT='1',PYTHONOPTIMIZE='0',PYTHONDONTWRITEBYTECODE='1',PYTHONNOUSERSITE='1',PYTEST_DISABLE_PLUGIN_AUTOLOAD='1',PYTEST_ADDOPTS='',NUMEXPR_NUM_THREADS='1');env.update(settings) if cache:env['F06_PREFIX_CACHE']=str(Path(cache).resolve()) if probe:env['F06_PROBE']=probe - source_hashes={p.relative_to(ROOT/'src').as_posix():sha(p) for p in (ROOT/'src/anysolver').rglob('*.py')} + source_hashes={p.relative_to(ROOT/'src').as_posix():sha(p) for p in (ROOT/'src/anyfesolver').rglob('*.py')} snapshots=out/'source-snapshots';snapshots.mkdir();(snapshots/'runner.py').write_bytes(Path(__file__).read_bytes()) fixtures={} for rel in ('tests/test_r8_f06_active_chart_dev.py','tests/test_stiffened_shell_q4_pullback_owner.py','tests/test_stiffened_shell_ge_finite_experimental.py','tests/test_stiffened_shell_ge_experimental.py'): diff --git a/scripts/r8_f06_adaptive_material_dev.py b/scripts/r8_f06_adaptive_material_dev.py index 4ebffb220..060d3220a 100644 --- a/scripts/r8_f06_adaptive_material_dev.py +++ b/scripts/r8_f06_adaptive_material_dev.py @@ -9,7 +9,7 @@ PREFIX=cyclic.DOC/'attempt-source-bend-z2/failure-state.bin' def bindings(): - paths=[ROOT/'src/anysolver'/name for name in (*infra.PRODUCTS,'_stiffened_shell_increment_control.py','_stiffened_shell_staged_load_experimental.py')] + paths=[ROOT/'src/anyfesolver'/name for name in (*infra.PRODUCTS,'_stiffened_shell_increment_control.py','_stiffened_shell_staged_load_experimental.py')] paths += [Path(__file__),ROOT/'tests/test_r8_f06_adaptive_material_dev.py',PREFIX, ROOT/'scripts/r8_f06_cyclic_material_dev.py',ROOT/'scripts/r8_f06_native_material_breadth_dev.py', ROOT/'scripts/r8_f06_fibre_log_domain_dev.py',ROOT/'scripts/r8_f06_log_domain_check_dev.py'] @@ -18,7 +18,7 @@ def bindings(): return {p.relative_to(ROOT).as_posix():sha(p) for p in paths} def programme(owner): - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss return ss.StagedDeadLoadProgramme(owner.preflight()['identity'],tuple(cyclic.actions('bend-z',a) for a in (.4,.2,-.4,-.41))) def paired_value(row, offset=0): @@ -29,7 +29,7 @@ def persist_accepted(out,owner,result,index): """Durably record a published endpoint before observer checks can fail.""" import numpy as np from dataclasses import asdict - from anysolver._stiffened_shell_beam_history import arrays as history_arrays + from anyfesolver._stiffened_shell_beam_history import arrays as history_arrays d=owner._finite_driver;prefix=out/('accepted-%02d.bin'%index) prefix.write_bytes(owner.checkpoint()) np.savez(out/('histories-%02d.npz'%index),**dict(history_arrays(owner._beam_parts,d._beam_predecessors,'origin')+ diff --git a/scripts/r8_f06_cell_moment_check_dev.py b/scripts/r8_f06_cell_moment_check_dev.py index df31c81e0..3f64cccc6 100644 --- a/scripts/r8_f06_cell_moment_check_dev.py +++ b/scripts/r8_f06_cell_moment_check_dev.py @@ -28,7 +28,7 @@ def child(out,stage): '--basetemp',str(out/'pytest-tmp'),'-k','control' if stage=='controls' else 'complete'])) finally: runtime(out,'runtime-after',ROOT/'src') - assert not any(n=='anysolver' or n.startswith('anysolver.') for n in sys.modules), 'production import outside saved-data-only authority' + assert not any(n=='anyfesolver' or n.startswith('anyfesolver.') for n in sys.modules), 'production import outside saved-data-only authority' def run(stage): import psutil authority=json.loads((DOC/'AUTHORITY.json').read_text());assert authority['status']=='ADOPTED' diff --git a/scripts/r8_f06_compensated_state_check_dev.py b/scripts/r8_f06_compensated_state_check_dev.py index 8fe639100..e70fd52cc 100644 --- a/scripts/r8_f06_compensated_state_check_dev.py +++ b/scripts/r8_f06_compensated_state_check_dev.py @@ -12,7 +12,7 @@ def write(p,v):Path(p).write_text(json.dumps(v,indent=2,allow_nan=False)+'\n') def bindings(): saved=json.loads((ROOT/'docs/agent_plans/development/r8-f06-cell-moment-20261010/saved-input-bindings.json').read_text()) for p,h in saved.items():assert sha(ROOT/p)==h - current={p.relative_to(ROOT).as_posix():sha(p) for p in [*list((ROOT/'src/anysolver').glob('*.py')), + current={p.relative_to(ROOT).as_posix():sha(p) for p in [*list((ROOT/'src/anyfesolver').glob('*.py')), Path(__file__),ROOT/'scripts/r8_f06_compensated_state_route_dev.py',ROOT/'tests/test_r8_f06_compensated_state_dev.py']} frozen=DOC/'package/snapshot-bindings.json' @@ -25,12 +25,12 @@ def runtime(out,name,selected): dependencies={n:importlib.metadata.version(n) for n in ('numpy','scipy','numba','pytest','psutil','threadpoolctl')}, numba=dict(disable_jit=bool(numba.config.DISABLE_JIT),num_threads=numba.get_num_threads()),pools=threadpoolctl.threadpool_info()) imports={n:str(Path(m.__file__).resolve()) for n,m in sys.modules.items() - if (n=='anysolver' or n.startswith('anysolver.')) and getattr(m,'__file__',None)} + if (n=='anyfesolver' or n.startswith('anyfesolver.')) and getattr(m,'__file__',None)} settings.update(imports=imports,import_sha256={n:sha(p) for n,p in imports.items()}) write(out/(name+'.json'),settings) assert settings['affinity']==[0] and settings['optimize']==0 and settings['numba']==dict(disable_jit=True,num_threads=1) assert all(p['num_threads']==1 for p in settings['pools']) - for n,p in imports.items():assert Path(p).is_relative_to(selected/'anysolver'),(n,p) + for n,p in imports.items():assert Path(p).is_relative_to(selected/'anyfesolver'),(n,p) return settings def child(out,stage): @@ -41,7 +41,7 @@ def child(out,stage): frozen=json.loads((package/'snapshot-bindings.json').read_text());site=package/'site' verified={};excluded={} for rel,h in frozen['package'].items(): - if not rel.startswith('src/anysolver/'): + if not rel.startswith('src/anyfesolver/'): excluded[rel]='generated packaging metadata; not an imported package source';continue target=site/Path(rel).relative_to('src') assert sha(target)==h,(str(target),h) @@ -84,7 +84,7 @@ def child(out,stage): frozen=json.loads((package/'snapshot-bindings.json').read_text())['package'] checked={} for name,module in sys.modules.items(): - if name=='anysolver' or name.startswith('anysolver.'): + if name=='anyfesolver' or name.startswith('anyfesolver.'): path=getattr(module,'__file__',None) if path: relative=Path(path).relative_to(selected).as_posix();key='src/'+relative diff --git a/scripts/r8_f06_compensated_state_checkpoint_repair_check_dev.py b/scripts/r8_f06_compensated_state_checkpoint_repair_check_dev.py index aaf96cce4..a577ba4c6 100644 --- a/scripts/r8_f06_compensated_state_checkpoint_repair_check_dev.py +++ b/scripts/r8_f06_compensated_state_checkpoint_repair_check_dev.py @@ -10,7 +10,7 @@ def sha(p):return hashlib.sha256(Path(p).read_bytes()).hexdigest() def write(p,v):Path(p).write_text(json.dumps(v,indent=2,allow_nan=False)+'\n') def bindings(): - current={p.relative_to(ROOT).as_posix():sha(p) for p in [*list((ROOT/'src/anysolver').glob('*.py')), + current={p.relative_to(ROOT).as_posix():sha(p) for p in [*list((ROOT/'src/anyfesolver').glob('*.py')), Path(__file__),ROOT/'tests/test_r8_f06_compensated_state_checkpoint_repair_dev.py']} frozen=DOC/'package-v2/snapshot-bindings.json' return dict(current=current,frozen_package=None if not frozen.exists() else json.loads(frozen.read_text())) @@ -22,12 +22,12 @@ def runtime(out,name,selected): dependencies={n:importlib.metadata.version(n) for n in ('numpy','scipy','numba','pytest','psutil','threadpoolctl')}, numba=dict(disable_jit=bool(numba.config.DISABLE_JIT),num_threads=numba.get_num_threads()),pools=threadpoolctl.threadpool_info()) imports={n:str(Path(m.__file__).resolve()) for n,m in sys.modules.items() - if (n=='anysolver' or n.startswith('anysolver.')) and getattr(m,'__file__',None)} + if (n=='anyfesolver' or n.startswith('anyfesolver.')) and getattr(m,'__file__',None)} settings.update(imports=imports,import_sha256={n:sha(p) for n,p in imports.items()}) write(out/(name+'.json'),settings) assert settings['affinity']==[0] and settings['optimize']==0 and settings['numba']==dict(disable_jit=True,num_threads=1) assert all(p['num_threads']==1 for p in settings['pools']) - for n,p in imports.items():assert Path(p).is_relative_to(selected/'anysolver'),(n,p) + for n,p in imports.items():assert Path(p).is_relative_to(selected/'anyfesolver'),(n,p) return settings def child(out,stage): @@ -38,7 +38,7 @@ def child(out,stage): frozen=json.loads((package/'snapshot-bindings.json').read_text());site=package/'site' verified={};excluded={} for rel,h in frozen['package'].items(): - if not rel.startswith('src/anysolver/'): + if not rel.startswith('src/anyfesolver/'): excluded[rel]='generated packaging metadata; not an imported package source';continue target=site/Path(rel).relative_to('src') assert sha(target)==h,(str(target),h) @@ -61,7 +61,7 @@ def child(out,stage): frozen=json.loads((package/'snapshot-bindings.json').read_text()) verified={} for rel,h in frozen['package'].items(): - if not rel.startswith('src/anysolver/'):continue + if not rel.startswith('src/anyfesolver/'):continue target=site/Path(rel).relative_to('src') assert sha(target)==h,(str(target),h) assert sha(package/'snapshot'/rel)==h,'frozen source changed during build' @@ -83,7 +83,7 @@ def child(out,stage): frozen=json.loads((package/'snapshot-bindings.json').read_text())['package'] checked={} for name,module in sys.modules.items(): - if name=='anysolver' or name.startswith('anysolver.'): + if name=='anyfesolver' or name.startswith('anyfesolver.'): path=getattr(module,'__file__',None) if path: relative=Path(path).relative_to(selected).as_posix();key='src/'+relative diff --git a/scripts/r8_f06_compensated_state_route_dev.py b/scripts/r8_f06_compensated_state_route_dev.py index 0b16a5a5b..cb579e8be 100644 --- a/scripts/r8_f06_compensated_state_route_dev.py +++ b/scripts/r8_f06_compensated_state_route_dev.py @@ -8,9 +8,9 @@ def definition(): from scripts.r8_f06_quiet_caller_repair_dev import definition as original - from anysolver._ge_beam3_native_definition import NativeBeamDefinition - from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement - from anysolver._stiffened_shell_f06_increment_arithmetic import POLICY + from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition + from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement + from anyfesolver._stiffened_shell_f06_increment_arithmetic import POLICY base=original();beams=[] for item in base.beams: e,inertia=item.instantiate();op=e.operator @@ -20,13 +20,13 @@ def definition(): return replace(base,beams=tuple(beams)) def owner(): - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss made=ss.create_analysis(definition=definition()) made.restore((SAVED/'accepted-before.bin').read_bytes(),legacy_compensated_base=True) return made def actual(out): - from anysolver._stiffened_shell_ge_finite_experimental import _State + from anyfesolver._stiffened_shell_ge_finite_experimental import _State out=Path(out);o=owner();d=o._finite_driver;results=[] try: origins=(d._shell_origins,d._beam_origins) diff --git a/scripts/r8_f06_coupled_direction_dev.py b/scripts/r8_f06_coupled_direction_dev.py index f9d28e78e..268c2900a 100644 --- a/scripts/r8_f06_coupled_direction_dev.py +++ b/scripts/r8_f06_coupled_direction_dev.py @@ -11,7 +11,7 @@ INPUT_SHA='0e45fec011a86a0cf80be93d2a311d7eff2604d4dec01b5a3bc846a8b39359ec' def bindings(): - paths=[ROOT/'src/anysolver'/n for n in (*infra.PRODUCTS,'_stiffened_shell_q4_algorithmic_pullback.py', + paths=[ROOT/'src/anyfesolver'/n for n in (*infra.PRODUCTS,'_stiffened_shell_q4_algorithmic_pullback.py', '_stiffened_shell_algorithmic_pullback.py','_stiffened_shell_increment_control.py','_ge_beam3_generalized_static_boundary.py')] paths += [ROOT/'scripts'/n for n in ('r8_f06_coupled_resume_dev.py','r8_f06_cyclic_material_dev.py', 'r8_f06_native_material_breadth_dev.py','r8_f06_fibre_log_domain_dev.py','r8_f06_log_domain_check_dev.py')] diff --git a/scripts/r8_f06_coupled_history_unblock_dev.py b/scripts/r8_f06_coupled_history_unblock_dev.py index ef9eee97c..7364a95d7 100644 --- a/scripts/r8_f06_coupled_history_unblock_dev.py +++ b/scripts/r8_f06_coupled_history_unblock_dev.py @@ -12,7 +12,7 @@ INPUT_SHA='970e0360f22ed348ca2eaa7eee0d2d168d6d686d0a91a750f3ccd31794865f91' def bindings(): - paths=[ROOT/'src/anysolver'/n for n in (*infra.PRODUCTS,'_stiffened_shell_q4_algorithmic_pullback.py', + paths=[ROOT/'src/anyfesolver'/n for n in (*infra.PRODUCTS,'_stiffened_shell_q4_algorithmic_pullback.py', '_stiffened_shell_algorithmic_pullback.py','_stiffened_shell_increment_control.py','_ge_beam3_generalized_static_boundary.py')] paths += [ROOT/'scripts'/n for n in ('r8_f06_coupled_resume_dev.py','r8_f06_cyclic_material_dev.py', 'r8_f06_native_material_breadth_dev.py','r8_f06_fibre_log_domain_dev.py','r8_f06_log_domain_check_dev.py')] diff --git a/scripts/r8_f06_coupled_resume_dev.py b/scripts/r8_f06_coupled_resume_dev.py index a991416e8..5a1f6583f 100644 --- a/scripts/r8_f06_coupled_resume_dev.py +++ b/scripts/r8_f06_coupled_resume_dev.py @@ -25,7 +25,7 @@ def artifact(): return dict(files=len(frozen),wheel_sha256=WHEEL_SHA,manifest_sha256=sha(PACKAGE/'snapshot-bindings.json'),prefix_sha256=PREFIX_SHA) def bindings(): - paths=[ROOT/'src/anysolver'/p for p in (*infra.PRODUCTS,'_stiffened_shell_q4_algorithmic_pullback.py', + paths=[ROOT/'src/anyfesolver'/p for p in (*infra.PRODUCTS,'_stiffened_shell_q4_algorithmic_pullback.py', '_stiffened_shell_algorithmic_pullback.py','_stiffened_shell_increment_control.py')] paths += [Path(__file__),ROOT/'tests/test_r8_f06_coupled_resume_dev.py',PREFIX, PACKAGE/'snapshot-bindings.json',DOC/'AUTHORITY.json',DOC/'CONTROL_AUTHORITY.json',DOC/'SLOT_TRANSFER.json'] diff --git a/scripts/r8_f06_coupled_staged_dev.py b/scripts/r8_f06_coupled_staged_dev.py index fed5e3621..941f49ae6 100644 --- a/scripts/r8_f06_coupled_staged_dev.py +++ b/scripts/r8_f06_coupled_staged_dev.py @@ -11,7 +11,7 @@ INPUT_SHA='0e45fec011a86a0cf80be93d2a311d7eff2604d4dec01b5a3bc846a8b39359ec' def bindings(): - paths=[ROOT/'src/anysolver'/p for p in (*infra.PRODUCTS,'_stiffened_shell_q4_algorithmic_pullback.py', + paths=[ROOT/'src/anyfesolver'/p for p in (*infra.PRODUCTS,'_stiffened_shell_q4_algorithmic_pullback.py', '_stiffened_shell_algorithmic_pullback.py','_stiffened_shell_increment_control.py')] paths += [ROOT/'scripts'/p for p in ('r8_f06_coupled_resume_dev.py','r8_f06_cyclic_material_dev.py', 'r8_f06_native_material_breadth_dev.py','r8_f06_fibre_log_domain_dev.py','r8_f06_log_domain_check_dev.py')] diff --git a/scripts/r8_f06_cyclic_material_dev.py b/scripts/r8_f06_cyclic_material_dev.py index a82d58ab1..391da34c7 100644 --- a/scripts/r8_f06_cyclic_material_dev.py +++ b/scripts/r8_f06_cyclic_material_dev.py @@ -10,7 +10,7 @@ DOC=ROOT/'docs/agent_plans/development/r8-f06-log-domain-20261010/cyclic-material-v1' def bindings(): - paths=[ROOT/'src/anysolver'/p for p in (*infra.PRODUCTS,'_stiffened_shell_q4_algorithmic_pullback.py', + paths=[ROOT/'src/anyfesolver'/p for p in (*infra.PRODUCTS,'_stiffened_shell_q4_algorithmic_pullback.py', '_stiffened_shell_algorithmic_pullback.py','_stiffened_shell_staged_load_experimental.py')] paths += [Path(__file__),ROOT/'scripts/r8_f06_fibre_log_domain_dev.py',ROOT/'scripts/r8_f06_native_material_breadth_dev.py', ROOT/'scripts/r8_f06_log_domain_check_dev.py',ROOT/'tests/test_r8_f06_cyclic_material_dev.py',ROOT/'tests/conftest.py'] @@ -28,7 +28,7 @@ def definition(case): return base def actions(case,scale=1.): - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss vector=(0.,10.,0.,0.,0.,0.) if case=='bend-y' else (0.,0.,10.,0.,0.,0.) if case=='coupled':vector=(50.,0.,10.,0.,0.,0.) nodes=(103,203) if case=='coupled' else (103,) diff --git a/scripts/r8_f06_direction_fallback_dev.py b/scripts/r8_f06_direction_fallback_dev.py index 3677090e5..7835d3d7a 100644 --- a/scripts/r8_f06_direction_fallback_dev.py +++ b/scripts/r8_f06_direction_fallback_dev.py @@ -10,7 +10,7 @@ 'reversed':BASE/'adaptive-material-v1/attempt-installed-lifecycle1/reversed-rebased.bin'} def bindings(): - paths=[ROOT/'src/anysolver'/n for n in (*infra.PRODUCTS,'_stiffened_shell_increment_control.py','_stiffened_shell_staged_load_experimental.py')] + paths=[ROOT/'src/anyfesolver'/n for n in (*infra.PRODUCTS,'_stiffened_shell_increment_control.py','_stiffened_shell_staged_load_experimental.py')] paths += [DOC/'AUTHORITY_DELTA1.json',Path(__file__),ROOT/'tests/test_r8_f06_direction_fallback_dev.py',*INPUTS.values()] paths += [ROOT/'scripts'/n for n in ('r8_f06_adaptive_material_dev.py','r8_f06_cyclic_material_dev.py', 'r8_f06_native_material_breadth_dev.py','r8_f06_fibre_log_domain_dev.py','r8_f06_log_domain_check_dev.py')] diff --git a/scripts/r8_f06_fibre_log_domain_dev.py b/scripts/r8_f06_fibre_log_domain_dev.py index fbb00efe8..dc2f767d5 100644 --- a/scripts/r8_f06_fibre_log_domain_dev.py +++ b/scripts/r8_f06_fibre_log_domain_dev.py @@ -11,17 +11,17 @@ '_stiffened_shell_beam_history.py','_stiffened_shell_f06_increment_arithmetic.py') def bindings(): - paths=[ROOT/'src/anysolver'/p for p in PRODUCTS]+[Path(__file__), + paths=[ROOT/'src/anyfesolver'/p for p in PRODUCTS]+[Path(__file__), ROOT/'tests/test_r8_f06_fibre_log_domain_dev.py',ROOT/'scripts/r8_f06_log_domain_check_dev.py',ROOT/'tests/conftest.py', ROOT/'tests/test_ge_beam3_native_definition.py',ROOT/'tests/test_ge_beam3_native_fibre_static_element.py'] return {p.relative_to(ROOT).as_posix():sha(p) for p in paths} def element(*,paired=True,family='axial'): import numpy as np - from anysolver._ge_beam3_fibre_section import PhysicalFibreSection,Fibre,FlowCurve - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry - from anysolver._ge_beam3_native_fibre_static_element import NativeFibreStaticElement - from anysolver._stiffened_shell_f06_increment_arithmetic import POLICY + from anyfesolver._ge_beam3_fibre_section import PhysicalFibreSection,Fibre,FlowCurve + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry + from anyfesolver._ge_beam3_native_fibre_static_element import NativeFibreStaticElement + from anyfesolver._stiffened_shell_f06_increment_arithmetic import POLICY if family=='axial':fibres=(Fibre('0',0.,0.,.01,1e6,FlowCurve((0.,),(10.,),1e5)),) else:raise ValueError('this development fixture establishes axial fibres only') section=PhysicalFibreSection(fibres,np.diag(np.sqrt((0.,4e3,4e3,100.,100.,100.)))) @@ -30,9 +30,9 @@ def element(*,paired=True,family='axial'): def definition(*,paired=True): import numpy as np - from anysolver import stiffened_shell as ss - from anysolver._ge_beam3_native_definition import NativeBeamDefinition - from anysolver._stiffened_shell_q4_algorithmic_pullback import POLICY + from anyfesolver import stiffened_shell as ss + from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition + from anyfesolver._stiffened_shell_q4_algorithmic_pullback import POLICY shell=ss.ShellPanel((1,2,3,4),((0.,-.5,0.),(1.,-.5,0.),(1.,.5,0.),(0.,.5,0.)), ((1,2,3,4),),.07,1e6,.3,1000.) return ss.LinearDefinition(ss.B3_GE_E4_PL_STIFFENED_SHELL_V1,shell, @@ -41,7 +41,7 @@ def definition(*,paired=True): tuple(ss.FixedCoordinate('shell',n,k) for n in (1,4) for k in range(6)),q4_pullback_policy=POLICY) def actions(): - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss return (ss.NodalAction('beam',103,(50.,0.,10.,0.,0.,0.)),) def child(out,stage): @@ -53,7 +53,7 @@ def child(out,stage): import shutil snapshot=package/'snapshot';snapshot.mkdir(parents=True) source={} - for p in (ROOT/'src/anysolver').rglob('*.py'): + for p in (ROOT/'src/anyfesolver').rglob('*.py'): rel=p.relative_to(ROOT);target=snapshot/rel;target.parent.mkdir(parents=True,exist_ok=True) content=p.read_bytes();target.write_bytes(content);source[rel.as_posix()]=sha(p) assert sha(target)==source[rel.as_posix()] diff --git a/scripts/r8_f06_log_domain_check_dev.py b/scripts/r8_f06_log_domain_check_dev.py index 434d27c68..329327718 100644 --- a/scripts/r8_f06_log_domain_check_dev.py +++ b/scripts/r8_f06_log_domain_check_dev.py @@ -10,7 +10,7 @@ def sha(p):return hashlib.sha256(Path(p).read_bytes()).hexdigest() def write(p,v):Path(p).write_text(json.dumps(v,indent=2,allow_nan=False)+'\n') def bindings(): - current={p.relative_to(ROOT).as_posix():sha(p) for p in [*list((ROOT/'src/anysolver').glob('*.py')), + current={p.relative_to(ROOT).as_posix():sha(p) for p in [*list((ROOT/'src/anyfesolver').glob('*.py')), Path(__file__),ROOT/'scripts/r8_f06_log_domain_route_dev.py',ROOT/'tests/test_r8_f06_log_domain_dev.py']} frozen=DOC/'package/snapshot-bindings.json' new_input=DOC/'evidence/route3/accepted-active.bin' @@ -23,12 +23,12 @@ def runtime(out,name,selected): dependencies={n:importlib.metadata.version(n) for n in ('numpy','scipy','numba','pytest','psutil','threadpoolctl')}, numba=dict(disable_jit=bool(numba.config.DISABLE_JIT),num_threads=numba.get_num_threads()),pools=threadpoolctl.threadpool_info()) imports={n:str(Path(m.__file__).resolve()) for n,m in sys.modules.items() - if (n=='anysolver' or n.startswith('anysolver.')) and getattr(m,'__file__',None)} + if (n=='anyfesolver' or n.startswith('anyfesolver.')) and getattr(m,'__file__',None)} settings.update(imports=imports,import_sha256={n:sha(p) for n,p in imports.items()}) write(out/(name+'.json'),settings) assert settings['affinity']==[0] and settings['optimize']==0 and settings['numba']==dict(disable_jit=True,num_threads=1) assert all(p['num_threads']==1 for p in settings['pools']) - for n,p in imports.items():assert Path(p).is_relative_to(selected/'anysolver'),(n,p) + for n,p in imports.items():assert Path(p).is_relative_to(selected/'anyfesolver'),(n,p) return settings def child(out,stage): @@ -39,7 +39,7 @@ def child(out,stage): frozen=json.loads((package/'snapshot-bindings.json').read_text());site=package/'site' verified={};excluded={} for rel,h in frozen['package'].items(): - if not rel.startswith('src/anysolver/'): + if not rel.startswith('src/anyfesolver/'): excluded[rel]='generated packaging metadata; not an imported package source';continue target=site/Path(rel).relative_to('src') assert sha(target)==h,(str(target),h) @@ -62,7 +62,7 @@ def child(out,stage): frozen=json.loads((package/'snapshot-bindings.json').read_text()) verified={} for rel,h in frozen['package'].items(): - if not rel.startswith('src/anysolver/'):continue + if not rel.startswith('src/anyfesolver/'):continue target=site/Path(rel).relative_to('src') assert sha(target)==h,(str(target),h) assert sha(package/'snapshot'/rel)==h,'frozen source changed during build' @@ -86,7 +86,7 @@ def child(out,stage): frozen=json.loads((package/'snapshot-bindings.json').read_text())['package'] checked={} for name,module in sys.modules.items(): - if name=='anysolver' or name.startswith('anysolver.'): + if name=='anyfesolver' or name.startswith('anyfesolver.'): path=getattr(module,'__file__',None) if path: relative=Path(path).relative_to(selected).as_posix();key='src/'+relative diff --git a/scripts/r8_f06_log_domain_route_dev.py b/scripts/r8_f06_log_domain_route_dev.py index 0a927fcac..bed5bd590 100644 --- a/scripts/r8_f06_log_domain_route_dev.py +++ b/scripts/r8_f06_log_domain_route_dev.py @@ -15,13 +15,13 @@ def coefficient_oracle(high,low=0.,*,decimal=False): return (f,first,second) if decimal else tuple(float(v) for v in (f,first,second)) def definition(): - from anysolver._stiffened_shell_ge_experimental import PROFILE,LinearDefinition,ShellPanel,PointConnection,FixedCoordinate - from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry - from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement - from anysolver._ge_beam3_native_definition import NativeBeamDefinition - from anysolver._stiffened_shell_f06_increment_arithmetic import POLICY - from anysolver._stiffened_shell_q4_algorithmic_pullback import POLICY as Q4_POLICY + from anyfesolver._stiffened_shell_ge_experimental import PROFILE,LinearDefinition,ShellPanel,PointConnection,FixedCoordinate + from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry + from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement + from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition + from anyfesolver._stiffened_shell_f06_increment_arithmetic import POLICY + from anyfesolver._stiffened_shell_q4_algorithmic_pullback import POLICY as Q4_POLICY section=EllipsoidalGeneralizedSection(np.diag((1e4,4e3,4e3,100.,100.,100.)),np.eye(6),2.,1000.) ref=CenteredCurvedBeam3ReferenceGeometry(np.array([[0.,-.5,.1],[.5,-.5,.1],[1.,-.5,.1]]),np.tile(np.eye(3),(3,1,1))) element=NativeGeneralizedStaticElement(1,(101,102,103),ref,section,order=4,arithmetic_policy=POLICY) @@ -32,15 +32,15 @@ def definition(): tuple(FixedCoordinate('shell',n,k) for n in (1,4) for k in range(6)),q4_pullback_policy=Q4_POLICY) def actions(): - from anysolver._stiffened_shell_ge_experimental import NodalAction + from anyfesolver._stiffened_shell_ge_experimental import NodalAction return (NodalAction('beam',103,(0.,0.,10.,0.,0.,0.)),) def public_route(out): - from anysolver import stiffened_shell as ss - from anysolver.control import CancellationToken,SolveCancelled - from anysolver._stiffened_shell_beam_history import arrays - from anysolver._ge_beam3_p5_seeded.core import canonical - import anysolver._stiffened_shell_f06_increment_arithmetic as arithmetic + from anyfesolver import stiffened_shell as ss + from anyfesolver.control import CancellationToken,SolveCancelled + from anyfesolver._stiffened_shell_beam_history import arrays + from anyfesolver._ge_beam3_p5_seeded.core import canonical + import anyfesolver._stiffened_shell_f06_increment_arithmetic as arithmetic out=Path(out);owner=ss.create_analysis(definition=definition());calls=[];original=arithmetic.full_log_coefficients def capture(c): calls.append(c.scalar());return original(c) @@ -61,9 +61,9 @@ def capture(c): assert immediate[2]<=1e-8 and immediate[3]<=1e-9 raw=owner.checkpoint();(out/'accepted-active.bin').write_bytes(raw) # New schema is binary-only; failed fresh restore must not publish state. - from anysolver._stiffened_shell_ge_checkpoint_binary import SCHEMAS,decode_compensated,encode_compensated,decode,encode - from anysolver._stiffened_shell_beam_history import shapes - from anysolver._stiffened_shell_f06_increment_arithmetic import Pair + from anyfesolver._stiffened_shell_ge_checkpoint_binary import SCHEMAS,decode_compensated,encode_compensated,decode,encode + from anyfesolver._stiffened_shell_beam_history import shapes + from anyfesolver._stiffened_shell_f06_increment_arithmetic import Pair corrections_shapes=tuple((n,getattr(state,n).shape) for n in ('q_low','frames_low','cells_low','resultants_low')) inner,corrections=decode_compensated(raw,owner._identity,corrections_shapes) base_shapes=tuple((n,v.shape) for n,v in (('q',state.q),('frames',state.frames),('cells',state.cells), @@ -125,7 +125,7 @@ def raise_if_cancelled(self,stage=''): with __import__('pytest').raises(SolveCancelled):owner.solve(actions(),(.82,),cancellation_token=cancel) assert cancel.visits==2 and owner.checkpoint()==after_update # A deliberately bounded rejected increment preserves the accepted prefix. - from anysolver._stiffened_shell_increment_control import FiniteIncrementFailure + from anyfesolver._stiffened_shell_increment_control import FiniteIncrementFailure with __import__('pytest').raises(FiniteIncrementFailure) as rejected: owner.solve(actions(),(1.2,),max_iterations=1,max_backtracks=0) assert rejected.value.attempt.status=='rejected' and rejected.value.attempt.accepted_from==.81 diff --git a/scripts/r8_f06_mixed_adaptive_dev.py b/scripts/r8_f06_mixed_adaptive_dev.py index c0e2a91fb..624a4d6d5 100644 --- a/scripts/r8_f06_mixed_adaptive_dev.py +++ b/scripts/r8_f06_mixed_adaptive_dev.py @@ -10,7 +10,7 @@ INPUT_SHA='0e45fec011a86a0cf80be93d2a311d7eff2604d4dec01b5a3bc846a8b39359ec' def bindings(): - paths=[ROOT/'src/anysolver'/p for p in (*infra.PRODUCTS,'_stiffened_shell_increment_control.py', + paths=[ROOT/'src/anyfesolver'/p for p in (*infra.PRODUCTS,'_stiffened_shell_increment_control.py', '_stiffened_shell_staged_load_experimental.py','_stiffened_shell_q4_algorithmic_pullback.py','_stiffened_shell_algorithmic_pullback.py')] paths += [ROOT/'scripts'/p for p in ('r8_f06_cyclic_material_dev.py','r8_f06_native_material_breadth_dev.py', 'r8_f06_coupled_resume_dev.py','r8_f06_fibre_log_domain_dev.py','r8_f06_log_domain_check_dev.py')] diff --git a/scripts/r8_f06_native_material_breadth_dev.py b/scripts/r8_f06_native_material_breadth_dev.py index 4afb92da6..db8c1b929 100644 --- a/scripts/r8_f06_native_material_breadth_dev.py +++ b/scripts/r8_f06_native_material_breadth_dev.py @@ -11,7 +11,7 @@ CASES=('axial','biaxial','mixed','mixed-s3') def bindings(): - paths=[ROOT/'src/anysolver'/p for p in (*infra.PRODUCTS,'_stiffened_shell_affine_endpoint.py', + paths=[ROOT/'src/anyfesolver'/p for p in (*infra.PRODUCTS,'_stiffened_shell_affine_endpoint.py', '_ge_beam3_retained_generalized.py','_ge_beam3_native_generalized_element.py')] paths += [Path(__file__),ROOT/'scripts/r8_f06_fibre_log_domain_dev.py',ROOT/'scripts/r8_f06_log_domain_check_dev.py', ROOT/'tests/test_r8_f06_native_material_breadth_dev.py',ROOT/'tests/test_r8_f06_fibre_log_domain_dev.py',ROOT/'tests/conftest.py'] @@ -21,14 +21,14 @@ def bindings(): def definition(case='biaxial', *, partial=False): import numpy as np - from anysolver import stiffened_shell as ss - from anysolver._ge_beam3_native_definition import NativeBeamDefinition - from anysolver._ge_beam3_fibre_section import PhysicalFibreSection,Fibre,FlowCurve - from anysolver._ge_beam3_native_fibre_static_element import NativeFibreStaticElement - from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement - from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry - from anysolver._stiffened_shell_f06_increment_arithmetic import POLICY + from anyfesolver import stiffened_shell as ss + from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition + from anyfesolver._ge_beam3_fibre_section import PhysicalFibreSection,Fibre,FlowCurve + from anyfesolver._ge_beam3_native_fibre_static_element import NativeFibreStaticElement + from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement + from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry + from anyfesolver._stiffened_shell_f06_increment_arithmetic import POLICY base=infra.definition() if case=='axial':return base old=infra.element();ref=old.operator.reference @@ -50,7 +50,7 @@ def definition(case='biaxial', *, partial=False): return model def actions(case): - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss result=infra.actions() return result+(ss.NodalAction('beam',203,(50.,0.,10.,0.,0.,0.)),) if case in ('mixed','mixed-s3') else result diff --git a/scripts/r8_f06_paired_active_tangent_dev.py b/scripts/r8_f06_paired_active_tangent_dev.py index 9f4c31fc7..32e6f851a 100644 --- a/scripts/r8_f06_paired_active_tangent_dev.py +++ b/scripts/r8_f06_paired_active_tangent_dev.py @@ -207,7 +207,7 @@ def __init__(self, owner, out): def evaluate(self, label, state, *, cancellation_token=None): import numpy as np from scipy import sparse - from anysolver.control import cancellation_safe_point + from anyfesolver.control import cancellation_safe_point cancellation_safe_point(cancellation_token, 'paired-tangent.before') self.calls += 1 locals_copy, shell_metadata = [], [] @@ -343,11 +343,11 @@ def branch_smooth(branches, metadata): def assess(out): import numpy as np - from anysolver import stiffened_shell as ss - from anysolver.control import CancellationToken, SolveCancelled - from anysolver._stiffened_shell_displacement_checkpoint import decode_snapshot - from anysolver._stiffened_shell_beam_history import arrays as history_arrays - from anysolver._stiffened_shell_rotation_charts import physical_frames + from anyfesolver import stiffened_shell as ss + from anyfesolver.control import CancellationToken, SolveCancelled + from anyfesolver._stiffened_shell_displacement_checkpoint import decode_snapshot + from anyfesolver._stiffened_shell_beam_history import arrays as history_arrays + from anyfesolver._stiffened_shell_rotation_charts import physical_frames from scripts.r8_f06_cyclic_material_dev import definition assert sha(ACCEPTED) == INPUT_SHA and sha(REBASED) == REBASED_SHA owner, chart_owner = ss.create_analysis(definition=definition('coupled')), None @@ -400,7 +400,7 @@ def assess(out): errors = {name: [] for name in groups} local_errors = {str(i): [] for i in range(len(locals_base))} smooth = branch_smooth(branches, shell_meta) - from anysolver._ge_beam3_generalized_static_boundary import spatial_jacobian + from anyfesolver._ge_beam3_generalized_static_boundary import spatial_jacobian report['local_mapping_exact'] = [] report['metadata_observability'] = dict(shell_convergence=bool(shell_meta) and all('converged' in row for row in shell_meta), shell_analytical_tangent_fallback=bool(shell_meta) and all('fallback_mask' in row for row in shell_meta), @@ -502,11 +502,11 @@ def assess(out): chart_d._state.q[owner._shell_count:])) write(out/'assessment.json',report) checked(representation_flags) - from anysolver._ge_beam3_pose_joint import _exp_terms + from anyfesolver._ge_beam3_pose_joint import _exp_terms # Same production shell selector as spatial_response; no raw K subtraction. exp_terms = _exp_terms if owner._distributing_material: - from anysolver._ge_beam3_g3c_stable.joint import _exp_terms as exp_terms + from anyfesolver._ge_beam3_g3c_stable.joint import _exp_terms as exp_terms mapped_direction = direction.copy() columns = np.eye(owner._shell_count) for j in range(owner._shell_count//6): diff --git a/scripts/r8_f06_paired_branch_assessment_dev.py b/scripts/r8_f06_paired_branch_assessment_dev.py index 010958594..a7311ce34 100644 --- a/scripts/r8_f06_paired_branch_assessment_dev.py +++ b/scripts/r8_f06_paired_branch_assessment_dev.py @@ -207,7 +207,7 @@ def launch(stage): load_candidate();bound=bindings(preparation=True);DOC.mkdir(parents=True,exist_ok=True) original.write(DOC/'BRANCH_PREPARATION.json',dict(status='PREPARED_NOT_LAUNCHED',bindings=bound, unique_basenames=len(bound),uniform_scale=SCALE,stage_caps_s=[20.,60.],budget_s=180.,reserve_s=60., - numerical_imports=[n for n in sys.modules if n.split('.')[0] in ('numpy','scipy','numba','anysolver','pytest')])) + numerical_imports=[n for n in sys.modules if n.split('.')[0] in ('numpy','scipy','numba','anyfesolver','pytest')])) print(json.dumps(dict(bindings=len(bound),missing=[p for p,v in bound.items() if v is None]))) elif args.child: raise SystemExit(child(Path(args.out),args.stage)) diff --git a/scripts/r8_f06_paired_branch_assessment_v2_dev.py b/scripts/r8_f06_paired_branch_assessment_v2_dev.py index e1dbe79df..42770b220 100644 --- a/scripts/r8_f06_paired_branch_assessment_v2_dev.py +++ b/scripts/r8_f06_paired_branch_assessment_v2_dev.py @@ -244,7 +244,7 @@ def launch(stage): load_candidate();bound=bindings(preparation=True);DOC.mkdir(parents=True,exist_ok=True) original.write(DOC/'BRANCH_PREPARATION.json',dict(status='PREPARED_NOT_LAUNCHED',bindings=bound, unique_basenames=len(bound),uniform_scale=SCALE,stage_caps_s=[20.,60.],budget_s=180.,reserve_s=60., - numerical_imports=[n for n in sys.modules if n.split('.')[0] in ('numpy','scipy','numba','anysolver','pytest')])) + numerical_imports=[n for n in sys.modules if n.split('.')[0] in ('numpy','scipy','numba','anyfesolver','pytest')])) print(json.dumps(dict(bindings=len(bound),missing=[p for p,v in bound.items() if v is None]))) elif args.child: raise SystemExit(child(Path(args.out),args.stage)) diff --git a/scripts/r8_f06_paired_branch_domain_dev.py b/scripts/r8_f06_paired_branch_domain_dev.py index 3b917082b..822683ee0 100644 --- a/scripts/r8_f06_paired_branch_domain_dev.py +++ b/scripts/r8_f06_paired_branch_domain_dev.py @@ -203,12 +203,12 @@ def prepare(out): Path(__file__).resolve(),ROOT/'tests/test_r8_f06_paired_branch_domain_dev.py',vector_path, SAVED/'base-locals.json',SAVED/'plus-1e-06-locals.json',SAVED/'minus-1e-06-locals.json',SAVED/'assessment.json', ROOT/law['source'],SAVED/'source-snapshots'/Path(law['source']).name, - ROOT/'src/anysolver/_ge_beam3_fibre_cell.py',ROOT/'src/anysolver/_ge_beam3_fibre_section.py', - ROOT/'src/anysolver/_ge_beam3_retained_fibre.py',ROOT/'scripts/r8_f06_paired_active_tangent_dev.py', + ROOT/'src/anyfesolver/_ge_beam3_fibre_cell.py',ROOT/'src/anyfesolver/_ge_beam3_fibre_section.py', + ROOT/'src/anyfesolver/_ge_beam3_retained_fibre.py',ROOT/'scripts/r8_f06_paired_active_tangent_dev.py', TANGENT/'ROOT_PRELAUNCH_BINDINGS.json',TANGENT/'HANDOFF_SELECTED.json', TANGENT.parent.parent/'package/snapshot-bindings.json',SAVED/'artifact-before.json',SAVED/'bindings.json', - ROOT/'src/anysolver/_ge_beam3_generalized_ellipsoid_section.py',ROOT/'src/anysolver/plasticity.py', - ROOT/'src/anysolver/_stiffened_shell_q4_algorithmic_pullback.py')} + ROOT/'src/anyfesolver/_ge_beam3_generalized_ellipsoid_section.py',ROOT/'src/anyfesolver/plasticity.py', + ROOT/'src/anyfesolver/_stiffened_shell_q4_algorithmic_pullback.py')} source_checks={} manifest_path=TANGENT.parent.parent/'package/snapshot-bindings.json' manifest=json.loads(manifest_path.read_text()) @@ -253,7 +253,7 @@ def prepare(out): parser.add_argument('--out',default=str(DOC)) args=parser.parse_args() result=prepare(args.out) - forbidden=[name for name in sys.modules if name.split('.')[0] in ('numpy','scipy','numba','anysolver','anymaterial','pytest')] + forbidden=[name for name in sys.modules if name.split('.')[0] in ('numpy','scipy','numba','anyfesolver','anymaterial','pytest')] if forbidden: raise AssertionError('preparation imported numerical modules: '+repr(forbidden)) print(json.dumps({k:result[k] for k in ('status','radius','uniform_scale','limiting_fibres','component_count','nonzero_before','nonzero_after')})) diff --git a/scripts/r8_f06_paired_displacement_dev.py b/scripts/r8_f06_paired_displacement_dev.py index 4695be668..c260fb9cb 100644 --- a/scripts/r8_f06_paired_displacement_dev.py +++ b/scripts/r8_f06_paired_displacement_dev.py @@ -12,7 +12,7 @@ '_stiffened_shell_displacement_checkpoint.py','_stiffened_shell_displacement_corrector.py', '_stiffened_shell_affine_endpoint.py','_stiffened_shell_ge_checkpoint_binary.py','_stiffened_shell_ge_experimental.py') def bindings(): - paths=[ROOT/'src/anysolver'/n for n in set((*PRODUCTS,*infra.PRODUCTS))] + paths=[ROOT/'src/anyfesolver'/n for n in set((*PRODUCTS,*infra.PRODUCTS))] paths += [ROOT/'scripts'/n for n in ('r8_f06_cyclic_material_dev.py','r8_f06_native_material_breadth_dev.py','r8_f06_coupled_resume_dev.py','r8_f06_fibre_log_domain_dev.py','r8_f06_log_domain_check_dev.py')] paths += [Path(__file__),ROOT/'tests/test_r8_f06_paired_displacement_dev.py',ROOT/'tests/test_r8_f06_coupled_resume_dev.py',INPUT,DOC/'PHYSICAL_ROUTE.json'] paths += [ROOT/'tests'/n for n in ('test_stiffened_shell_displacement_checkpoint.py','test_stiffened_shell_bl5_coupled_material.py','test_stiffened_shell_bl5_material.py','test_stiffened_shell_bl5_finite.py')] diff --git a/scripts/r8_f06_paired_role_assessment_dev.py b/scripts/r8_f06_paired_role_assessment_dev.py index 33b0cc3cb..7065a5f4c 100644 --- a/scripts/r8_f06_paired_role_assessment_dev.py +++ b/scripts/r8_f06_paired_role_assessment_dev.py @@ -30,7 +30,7 @@ ROLES=dict(physical=list(range(60)),cell_rotation=list(range(60,66))+list(range(84,90)), native_retained=list(range(66,84))+list(range(90,108)),multipliers=list(range(108,132))) MANIFEST_SHA='3288a782763b64c2d12fbf923ff0239abc3017dfcc68c234e0b5cef76480b5d9' -B2_DELTA_PATH='src/anysolver/_stiffened_shell_b2_q4_panel_experimental.py' +B2_DELTA_PATH='src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py' ATOMIC_KEYS=('checkpoint','generation','objects','state_object','state_words','accepted_object','controller', 'driver_object','driver_accepted_object','driver_accepted_words','applied_load_object','applied_load_bytes','snapshot_object', 'shell_accepted_objects','shell_accepted_words','shell_predecessors_objects','shell_predecessors_words', @@ -309,7 +309,7 @@ def launch(stage): original.write(DOC/'BRANCH_ARTIFACT_PREFLIGHT.json',artifact(preparation=True)) original.write(DOC/'BRANCH_PREPARATION.json',dict(status='PREPARED_NOT_LAUNCHED',bindings=bound, unique_basenames=len(bound),scale_by_role=SCALES,source_count=SOURCE_COUNT,stage_caps_s=[20.,60.],budget_s=180.,reserve_s=60., - numerical_imports=[n for n in sys.modules if n.split('.')[0] in ('numpy','scipy','numba','anysolver','pytest')])) + numerical_imports=[n for n in sys.modules if n.split('.')[0] in ('numpy','scipy','numba','anyfesolver','pytest')])) print(json.dumps(dict(bindings=len(bound),missing=[p for p,v in bound.items() if v is None]))) elif args.child: raise SystemExit(child(Path(args.out),args.stage)) diff --git a/scripts/r8_f06_pending_direction_dev.py b/scripts/r8_f06_pending_direction_dev.py index 8613d65e0..f44a9e4cf 100644 --- a/scripts/r8_f06_pending_direction_dev.py +++ b/scripts/r8_f06_pending_direction_dev.py @@ -12,7 +12,7 @@ HISTORY=BASE/'adaptive-material-v1/attempt-primary2/histories-00.npz' def bindings(): - paths=[ROOT/'src/anysolver'/n for n in (*infra.PRODUCTS,'_stiffened_shell_increment_control.py', + paths=[ROOT/'src/anyfesolver'/n for n in (*infra.PRODUCTS,'_stiffened_shell_increment_control.py', '_stiffened_shell_staged_load_experimental.py','_stiffened_shell_rotation_charts.py')] paths += [Path(__file__),ROOT/'tests/test_r8_f06_pending_direction_dev.py',INPUT,PARTIAL,HISTORY, PACKAGE/'artifact.json',PACKAGE/'snapshot-bindings.json'] diff --git a/scripts/r8_f06_pending_resume_dev.py b/scripts/r8_f06_pending_resume_dev.py index af4f4f811..eb8b85cf1 100644 --- a/scripts/r8_f06_pending_resume_dev.py +++ b/scripts/r8_f06_pending_resume_dev.py @@ -11,7 +11,7 @@ ORACLE=BASE/'adaptive-material-v1/attempt-primary2' def bindings(): - paths=[ROOT/'src/anysolver'/n for n in (*infra.PRODUCTS,'_stiffened_shell_increment_control.py','_stiffened_shell_staged_load_experimental.py')] + paths=[ROOT/'src/anyfesolver'/n for n in (*infra.PRODUCTS,'_stiffened_shell_increment_control.py','_stiffened_shell_staged_load_experimental.py')] paths += [Path(__file__),ROOT/'tests/test_r8_f06_pending_resume_dev.py',INPUT, ORACLE/'final-prefix.bin',ORACLE/'histories-00.npz',ORACLE/'histories-01.npz',ORACLE/'accepted.json', PACKAGE/'artifact.json',PACKAGE/'snapshot-bindings.json',DOC/'READINESS.json'] diff --git a/scripts/r8_f07_block_descriptor_dev.py b/scripts/r8_f07_block_descriptor_dev.py index 96aa9ab98..f449fba06 100644 --- a/scripts/r8_f07_block_descriptor_dev.py +++ b/scripts/r8_f07_block_descriptor_dev.py @@ -605,8 +605,8 @@ def structural_binding(): """Stdlib IO/AST only: fresh candidate, never reuse a frozen registration.""" paths=('scripts/r8_f07_block_descriptor_dev.py','tests/test_r8_f07_block_descriptor_dev.py', 'scripts/r8_f07_public_descriptor_dev.py','tests/conftest.py','examples/stiffened_shell_ge_mixed_reference_modes.py', - 'examples/stiffened_shell_native_fibre_bl5.py','src/anysolver/_stiffened_shell_ge_experimental.py', - 'src/anysolver/_ge_beam3_pose_joint.py') + 'examples/stiffened_shell_native_fibre_bl5.py','src/anyfesolver/_stiffened_shell_ge_experimental.py', + 'src/anyfesolver/_ge_beam3_pose_joint.py') for path in paths:ast.parse((ROOT/path).read_text(),filename=path) return dict(sources={path:sha(ROOT/path) for path in paths}, inputs={str(OLD/name):sha(OLD/name) for name in @@ -825,7 +825,7 @@ def run_control(name,out): def run_installed(out): import numpy as np - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss from examples.stiffened_shell_ge_mixed_reference_modes import definition saved=dict(np.load(OLD/'pencil.npz'));physical=dict(np.load(OLD/'original-physical.npz')) proof=json.loads((HERE/'source1/saved-current-public/result.json').read_text()) @@ -890,7 +890,7 @@ def prepare(): candidates={rel:sha(ROOT/rel) for rel in paths} for rel in paths:(DOC/('frozen-'+Path(rel).name)).write_bytes((ROOT/rel).read_bytes()) inputs={str(OLD/name):sha(OLD/name) for name in ('pencil.npz','homogeneous-qz.npz','original-physical.npz','public-status.json','blocks.json')} - source={p.relative_to(ROOT/'src').as_posix():sha(p) for p in (ROOT/'src/anysolver').rglob('*.py')} + source={p.relative_to(ROOT/'src').as_posix():sha(p) for p in (ROOT/'src/anyfesolver').rglob('*.py')} artifact=ROOT/'.development/r8-f13-dependency-repair-20261009/artifact-v2' need(all(sha(artifact/'site'/rel)==h for rel,h in source.items()),'source/site mismatch') manifest=json.loads((artifact/'artifact-binding.json').read_text());wheel=artifact/'dist/anysolver-0.4.7-py3-none-any.whl' diff --git a/scripts/r8_f07_public_descriptor_dev.py b/scripts/r8_f07_public_descriptor_dev.py index 096da6b80..1a2f662d8 100644 --- a/scripts/r8_f07_public_descriptor_dev.py +++ b/scripts/r8_f07_public_descriptor_dev.py @@ -172,7 +172,7 @@ def canonical(owner): def run_fixture(out): import numpy as np from scipy import sparse - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss from examples.stiffened_shell_ge_mixed_reference_modes import definition owner=ss.create_analysis(definition=definition('mixed','biaxial','mixed','point',free=True)) try: @@ -269,13 +269,13 @@ def runtime(out, name, selected): numba=dict(disable_jit=bool(numba.config.DISABLE_JIT),num_threads=numba.get_num_threads()), pools=threadpoolctl.threadpool_info()) imports={n:str(Path(m.__file__).resolve()) for n,m in sys.modules.items() - if (n=='anysolver' or n.startswith('anysolver.')) and getattr(m,'__file__',None)} + if (n=='anyfesolver' or n.startswith('anyfesolver.')) and getattr(m,'__file__',None)} settings.update(imports=imports,import_sha256={n:sha(p) for n,p in imports.items()}) write(out/(name+'.json'),settings) need(settings['affinity']==[0] and settings['optimize']==0 and settings['numba']==dict(disable_jit=True,num_threads=1) and all(p['num_threads']==1 for p in settings['pools']), 'effective runtime mismatch') for n,p in imports.items(): - need(Path(p).is_relative_to(selected/'anysolver'), 'unexpected anysolver import path: '+n) - need(sha(p)==sha(ROOT/'src'/Path(p).relative_to(selected)), 'actual anysolver import hash mismatch: '+n) + need(Path(p).is_relative_to(selected/'anyfesolver'), 'unexpected anyfesolver import path: '+n) + need(sha(p)==sha(ROOT/'src'/Path(p).relative_to(selected)), 'actual anyfesolver import hash mismatch: '+n) return settings @@ -288,7 +288,7 @@ def prepare(): 'examples/stiffened_shell_ge_mixed_reference_modes.py','examples/stiffened_shell_native_fibre_bl5.py', 'tests/test_stiffened_shell_ge_mixed_reference_modal.py'): path=ROOT/rel;bindings[rel]=sha(path);(DOC/('frozen-'+path.name)).write_bytes(path.read_bytes()) - source={p.relative_to(ROOT/'src').as_posix():sha(p) for p in (ROOT/'src/anysolver').rglob('*.py')} + source={p.relative_to(ROOT/'src').as_posix():sha(p) for p in (ROOT/'src/anyfesolver').rglob('*.py')} artifact=ROOT/'.development/r8-f13-dependency-repair-20261009/artifact-v2' saved=json.loads((artifact/'artifact-binding.json').read_text()) need(all(sha(artifact/'site'/rel)==digest for rel,digest in source.items()),'source/site artifact mismatch') diff --git a/scripts/r8_f13_dependency_repair_dev.py b/scripts/r8_f13_dependency_repair_dev.py index 05ffed067..0b1c14882 100644 --- a/scripts/r8_f13_dependency_repair_dev.py +++ b/scripts/r8_f13_dependency_repair_dev.py @@ -14,7 +14,7 @@ ROOT = Path(__file__).resolve().parents[1] DOC = ROOT / 'docs/agent_plans/development/r8-f13-static-feasibility-v5-20261009' EVIDENCE = ROOT / '.development/r8-f13-dependency-repair-20261009' -PRODUCT = 'anysolver/_stiffened_shell_b2_q4_panel_experimental.py' +PRODUCT = 'anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py' def sha(path): return hashlib.sha256(Path(path).read_bytes()).hexdigest() @@ -78,14 +78,14 @@ def capture(site, out): from scipy import sparse from threadpoolctl import threadpool_info from types import SimpleNamespace - from anysolver import stiffened_shell as api - from anysolver import _stiffened_shell_b2_q4_panel_experimental as module - from anysolver.control import CancellationToken + from anyfesolver import stiffened_shell as api + from anyfesolver import _stiffened_shell_b2_q4_panel_experimental as module + from anyfesolver.control import CancellationToken spec=importlib.util.spec_from_file_location('f13_frozen_ownership',ROOT/'.development/r8-f13-static-feasibility-v5-20261009/runner.py') frozen=importlib.util.module_from_spec(spec);spec.loader.exec_module(frozen) inputs=json.loads((DOC/'inputs-v5.json').read_text()) ctx=SimpleNamespace(inputs=inputs,np=np,sparse=sparse,api=api,module=module,Token=CancellationToken) - imports={name:str(Path(m.__file__).resolve()) for name,m in sys.modules.items() if name.startswith('anysolver') and getattr(m,'__file__',None)} + imports={name:str(Path(m.__file__).resolve()) for name,m in sys.modules.items() if name.startswith('anyfesolver') and getattr(m,'__file__',None)} assert all(Path(p).is_relative_to(Path(site).resolve()) for p in imports.values()) runtime=dict(affinity=psutil.Process().cpu_affinity(),optimization=sys.flags.optimize,jit=os.environ.get('NUMBA_DISABLE_JIT'),pools=threadpool_info(),imports=imports,import_sha256={n:sha(p) for n,p in imports.items()},input_sha256=sha(DOC/'inputs-v5.json'),frozen_runner_sha256=sha(frozen.__file__)) assert runtime['affinity']==[0] and runtime['optimization']==0 and runtime['jit']=='1' diff --git a/scripts/r8_f13_static_feasibility.py b/scripts/r8_f13_static_feasibility.py index a8c4e2389..412330cce 100644 --- a/scripts/r8_f13_static_feasibility.py +++ b/scripts/r8_f13_static_feasibility.py @@ -51,9 +51,9 @@ def runtime(registration): sys.path.insert(0,str(SITE)) import numpy as np from scipy import sparse - from anysolver import stiffened_shell as api - import anysolver._stiffened_shell_b2_q4_panel_experimental as module - from anysolver.control import CancellationToken + from anyfesolver import stiffened_shell as api + import anyfesolver._stiffened_shell_b2_q4_panel_experimental as module + from anyfesolver.control import CancellationToken if not Path(api.__file__).resolve().is_relative_to(SITE):raise RuntimeError('source/site mixing') return SimpleNamespace(inputs=inputs,np=np,sparse=sparse,api=api,module=module,Token=CancellationToken) @@ -363,8 +363,8 @@ def callback(_):owner.close();assert weak() is None;raise error def cache_case(ctx,domain): """Existing local cache on actual small registered elastic KKT operators.""" - from anysolver.linalg import FactorizationCache,MatrixClass,factorize_cached - from anysolver._b2_physical_linear_definition import PhysicalB2OperatorCache + from anyfesolver.linalg import FactorizationCache,MatrixClass,factorize_cached + from anyfesolver._b2_physical_linear_definition import PhysicalB2OperatorCache np=ctx.np;owners=[];matrices=[] try: for variant in (None,'section','geometry'): diff --git a/scripts/r8_ge_coupled_cycle_dev.py b/scripts/r8_ge_coupled_cycle_dev.py index 855a90f72..30e0522d6 100644 --- a/scripts/r8_ge_coupled_cycle_dev.py +++ b/scripts/r8_ge_coupled_cycle_dev.py @@ -136,7 +136,7 @@ def artifact(): raise ValueError('exact current source delta adoption required') if decision.get('wheel_sha256')!=sha(wheel) or decision.get('manifest_sha256')!=sha(PACKAGE/'snapshot-bindings.json'): raise ValueError('changed artifact decision identity') - if any(x['path']!='src/anysolver/_stiffened_shell_b2_q4_panel_experimental.py' for x in delta) or not decision.get('independence_justification'): + if any(x['path']!='src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py' for x in delta) or not decision.get('independence_justification'): raise ValueError('GE/current source closure drift') return dict(files=len(frozen),wheel_sha256=sha(wheel),manifest_sha256=sha(PACKAGE/'snapshot-bindings.json'),current_source_deltas=delta) @@ -151,7 +151,7 @@ def bindings(): '_stiffened_shell_point_recovery.py') paths=[Path(__file__),ROOT/'tests/test_r8_ge_coupled_cycle_dev.py',ROOT/'tests/conftest.py',ROOT/'examples/r8_ge_coupled_cycle_public_example.py', *IDENTITIES,LOADED/'TARGET_ADOPTION.json',PACKAGE/'snapshot-bindings.json',DOC/'PREPARATION.md',DOC/'PROSPECTIVE_PLAN.json'] - paths+=[ROOT/'scripts'/x for x in helpers]+[ROOT/'src/anysolver'/x for x in products] + paths+=[ROOT/'scripts'/x for x in helpers]+[ROOT/'src/anyfesolver'/x for x in products] paths += [DOC/x for x in ('CYCLE_ADOPTION.json','CYCLE_ARTIFACT_REUSE_DECISION.json', 'CYCLE_SOURCE_AUTHORITY.json','CYCLE_INSTALLED_AUTHORITY.json','CYCLE_SLOT_TRANSFER.json')] result={p.relative_to(ROOT).as_posix():sha(p) for p in paths} @@ -305,8 +305,8 @@ def connected(out): import numpy as np from scripts import r8_f06_paired_active_tangent_dev as atomic from scripts.r8_f06_cyclic_material_dev import definition,actions - from anysolver import stiffened_shell as ss - from anysolver.control import CancellationToken,SolveCancelled + from anyfesolver import stiffened_shell as ss + from anyfesolver.control import CancellationToken,SolveCancelled adoption=json.loads((DOC/'CYCLE_ADOPTION.json').read_text());require_adoption(adoption) for path,digest in IDENTITIES.items(): if sha(path)!=digest:raise ValueError('changed saved endpoint') diff --git a/scripts/r8_ge_line_buckling_dev.py b/scripts/r8_ge_line_buckling_dev.py index ab181d291..dc05fb937 100644 --- a/scripts/r8_ge_line_buckling_dev.py +++ b/scripts/r8_ge_line_buckling_dev.py @@ -10,7 +10,7 @@ def definition(basis='p0'): import numpy as np - from anysolver import b3_ge, stiffened_shell as public + from anyfesolver import b3_ge, stiffened_shell as public e, nu = 210e9, .3; g = e/(2*(1+nu)) section = b3_ge.EllipsoidalGeneralizedSection(np.diag((e*.01,g*.008,g*.008, g*1.6666666666666667e-5,e*8.333333333333333e-6,e*8.333333333333333e-6)),np.eye(6),1e20,1e9) @@ -49,12 +49,12 @@ def save(name, value): import numpy as np import scipy import numba - import anysolver + import anyfesolver from threadpoolctl import threadpool_info from scipy import sparse - from anysolver import stiffened_shell as public - from anysolver._stiffened_shell_ge_point_buckling import capture - status['imports'] = {module.__name__: module.__file__ for module in (np, scipy, numba, anysolver)} + from anyfesolver import stiffened_shell as public + from anyfesolver._stiffened_shell_ge_point_buckling import capture + status['imports'] = {module.__name__: module.__file__ for module in (np, scipy, numba, anyfesolver)} status['threadpools'] = threadpool_info() status['numba_disable_jit_effective'] = bool(numba.config.DISABLE_JIT) if not status['numba_disable_jit_effective'] or any(row['num_threads'] != 1 for row in status['threadpools']): diff --git a/scripts/r8_ge_merit_interpolation_candidate_dev.py b/scripts/r8_ge_merit_interpolation_candidate_dev.py index c6039cdf0..53f5aa4ce 100644 --- a/scripts/r8_ge_merit_interpolation_candidate_dev.py +++ b/scripts/r8_ge_merit_interpolation_candidate_dev.py @@ -18,7 +18,7 @@ def prepare(): changes={};records=[] for name in ('_stiffened_shell_displacement_corrector.py','_stiffened_shell_displacement_control.py', '_stiffened_shell_displacement_adaptive.py','_stiffened_shell_ge_experimental.py','stiffened_shell.py'): - path=ROOT/'src/anysolver'/name;original=path.read_text();source=original + path=ROOT/'src/anyfesolver'/name;original=path.read_text();source=original if name.endswith('corrector.py'): helper=''' PAIRED_FIXED_WORK_QUADRATIC_V1="PAIRED_FIXED_WORK_QUADRATIC_V1" @@ -150,7 +150,7 @@ def _quadratic_merit_amount(old,trial,gradient,amount): records.append(dict(product=str(path),product_sha256=sha256(path.read_bytes()).hexdigest(), candidate=str(target),candidate_sha256=sha256(target.read_bytes()).hexdigest())) patch=''.join(''.join(difflib.unified_diff(old.splitlines(True),new.splitlines(True), - fromfile='a/src/anysolver/'+name,tofile='b/src/anysolver/'+name)) + fromfile='a/src/anyfesolver/'+name,tofile='b/src/anyfesolver/'+name)) for name,(old,new) in changes.items()) for name in ('CONNECTED_CANDIDATE.patch','CANDIDATE_SOURCE_BINDINGS.json'): path=DOC/name diff --git a/scripts/r8_ge_merit_interpolation_execution_dev.py b/scripts/r8_ge_merit_interpolation_execution_dev.py index 7911af2ef..abc0b7ba6 100644 --- a/scripts/r8_ge_merit_interpolation_execution_dev.py +++ b/scripts/r8_ge_merit_interpolation_execution_dev.py @@ -11,7 +11,7 @@ def sha(path):return sha256(Path(path).read_bytes()).hexdigest() def write(path,value):Path(path).write_text(json.dumps(value,indent=2,allow_nan=False)+'\n') def tree(): - current={p.relative_to(ROOT).as_posix():sha(p) for p in (ROOT/'src/anysolver').rglob('*.py')} + current={p.relative_to(ROOT).as_posix():sha(p) for p in (ROOT/'src/anyfesolver').rglob('*.py')} if current!=json.loads((DOC/'CURRENT_SOURCE_TREE.json').read_text()):raise ValueError('current source drift') return current def bindings(): @@ -69,7 +69,7 @@ def installed_history(out): os.environ.get('GE_MERIT_HISTORY_OUTPUT')!=str(out)): raise ValueError('sole installed-history child and exact output required') tree();artifact();_history_slot() - from anysolver._stiffened_shell_displacement_corrector import PAIRED_FIXED_WORK_QUADRATIC_V1 + from anyfesolver._stiffened_shell_displacement_corrector import PAIRED_FIXED_WORK_QUADRATIC_V1 from scripts import r8_ge_paired_adaptive_dev as adaptive adaptive._connected_program(out,control_kwargs=dict(merit_globalization=PAIRED_FIXED_WORK_QUADRATIC_V1)) def child(out,stage): diff --git a/scripts/r8_ge_mixed_buckling_dev.py b/scripts/r8_ge_mixed_buckling_dev.py index 6fbd115f0..fb34d1ab0 100644 --- a/scripts/r8_ge_mixed_buckling_dev.py +++ b/scripts/r8_ge_mixed_buckling_dev.py @@ -35,12 +35,12 @@ def save(name, value): import numpy as np import scipy import numba - import anysolver + import anyfesolver from threadpoolctl import threadpool_info from scipy import sparse - from anysolver import stiffened_shell as public - from anysolver._stiffened_shell_ge_point_buckling import capture - status['imports'] = {module.__name__: module.__file__ for module in (np, scipy, numba, anysolver)} + from anyfesolver import stiffened_shell as public + from anyfesolver._stiffened_shell_ge_point_buckling import capture + status['imports'] = {module.__name__: module.__file__ for module in (np, scipy, numba, anyfesolver)} status['threadpools'] = threadpool_info() status['numba_disable_jit_effective'] = bool(numba.config.DISABLE_JIT) if not status['numba_disable_jit_effective'] or any(row['num_threads'] != 1 for row in status['threadpools']): diff --git a/scripts/r8_ge_paired_adaptive_dev.py b/scripts/r8_ge_paired_adaptive_dev.py index d43bc0f9d..94ddab0c2 100644 --- a/scripts/r8_ge_paired_adaptive_dev.py +++ b/scripts/r8_ge_paired_adaptive_dev.py @@ -70,7 +70,7 @@ def bindings(): def source_tree(): expected=json.loads((BASE_DOC/'SOURCE_TREE.json').read_text()) - actual={p.relative_to(ROOT).as_posix():sha(p) for p in (ROOT/'src/anysolver').rglob('*.py')} + actual={p.relative_to(ROOT).as_posix():sha(p) for p in (ROOT/'src/anyfesolver').rglob('*.py')} if actual!=expected:raise ValueError('current source tree changed after preparation') return expected @@ -96,7 +96,7 @@ def observe(self,frame,event,arg): self.merit=float(arg) super().observe(frame,event,arg) def __enter__(self): - from anysolver import _stiffened_shell_displacement_control as fixed + from anyfesolver import _stiffened_shell_displacement_control as fixed if self.atomic is None: from scripts import r8_f06_paired_active_tangent_dev as atomic self.atomic=atomic @@ -112,7 +112,7 @@ def observed(owner,*args,**kwargs): exception=dict(type=type(error).__name__,message=str(error),detail=plain(getattr(error,'detail',None))), actual_fixed_dual_work_merit=self.merit, merit_provenance='last executed fixed-corrector merit call; unavailable before first merit call; not reconstructed final failure residual') - from anysolver._stiffened_shell_displacement_corrector import DisplacementCorrectorFailure + from anyfesolver._stiffened_shell_displacement_corrector import DisplacementCorrectorFailure if isinstance(error,DisplacementCorrectorFailure) and owner._generation==before['generation']: prior.check_atomic(row['flags']) raise @@ -133,8 +133,8 @@ def _connected_program(out,*,control_factory=None,control_kwargs=None): """ if control_factory is not None and control_kwargs is not None: raise ValueError('one explicit control injection route required') - from anysolver import stiffened_shell as ss - from anysolver.control import CancellationToken,SolveCancelled + from anyfesolver import stiffened_shell as ss + from anyfesolver.control import CancellationToken,SolveCancelled from scripts.r8_f06_cyclic_material_dev import definition,actions from scripts import r8_f06_paired_active_tangent_dev as atomic import numpy as np diff --git a/scripts/r8_ge_paired_fixed_diagnostic_dev.py b/scripts/r8_ge_paired_fixed_diagnostic_dev.py index 8fbbc5d3b..76913a3d0 100644 --- a/scripts/r8_ge_paired_fixed_diagnostic_dev.py +++ b/scripts/r8_ge_paired_fixed_diagnostic_dev.py @@ -213,10 +213,10 @@ def connected(out): raw,outer,fixed=select_inner(OUTER.read_bytes()) if raw!=INNER.read_bytes():raise ValueError('inner checkpoint is not exact saved mechanical prefix') artifact() - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss from scripts.r8_f06_cyclic_material_dev import definition,actions from scripts import r8_f06_paired_active_tangent_dev as atomic - from anysolver._stiffened_shell_displacement_corrector import DisplacementCorrectorFailure + from anyfesolver._stiffened_shell_displacement_corrector import DisplacementCorrectorFailure owner=ss.create_analysis(definition=definition('coupled')) try: owner.restore(raw) diff --git a/scripts/r8_ge_paired_trial_derivative_dev.py b/scripts/r8_ge_paired_trial_derivative_dev.py index b94b18610..c8a9146a6 100644 --- a/scripts/r8_ge_paired_trial_derivative_dev.py +++ b/scripts/r8_ge_paired_trial_derivative_dev.py @@ -71,8 +71,8 @@ def prepare(): def connected(out): import numpy as np from scipy import sparse - from anysolver import stiffened_shell as ss - from anysolver._stiffened_shell_ge_finite_experimental import _State + from anyfesolver import stiffened_shell as ss + from anyfesolver._stiffened_shell_ge_finite_experimental import _State from scripts.r8_f06_cyclic_material_dev import definition from scripts import r8_f06_paired_active_tangent_dev as original if out!=DOC/'attempt-installed-derivative1':raise ValueError('sole owned installed output required') diff --git a/scripts/r8_ge_point_buckling_dev.py b/scripts/r8_ge_point_buckling_dev.py index d46da6b04..eb2b1744e 100644 --- a/scripts/r8_ge_point_buckling_dev.py +++ b/scripts/r8_ge_point_buckling_dev.py @@ -10,7 +10,7 @@ def definition(): import numpy as np - from anysolver import b3_ge, stiffened_shell as public + from anyfesolver import b3_ge, stiffened_shell as public e, nu = 210e9, .3 g = e/(2*(1+nu)) section = b3_ge.EllipsoidalGeneralizedSection(np.diag((e*.01, g*.008, g*.008, @@ -49,12 +49,12 @@ def save(name, value): import numpy as np import scipy import numba - import anysolver + import anyfesolver from threadpoolctl import threadpool_info from scipy import sparse - from anysolver import stiffened_shell as public - from anysolver._stiffened_shell_ge_point_buckling import capture - status['imports'] = {module.__name__: module.__file__ for module in (np, scipy, numba, anysolver)} + from anyfesolver import stiffened_shell as public + from anyfesolver._stiffened_shell_ge_point_buckling import capture + status['imports'] = {module.__name__: module.__file__ for module in (np, scipy, numba, anyfesolver)} status['threadpools'] = threadpool_info() status['numba_disable_jit_effective'] = bool(numba.config.DISABLE_JIT) if not status['numba_disable_jit_effective'] or any(row['num_threads'] != 1 for row in status['threadpools']): diff --git a/scripts/r8_ge_saved_compliance_dev.py b/scripts/r8_ge_saved_compliance_dev.py index ee021e23a..de26ede21 100644 --- a/scripts/r8_ge_saved_compliance_dev.py +++ b/scripts/r8_ge_saved_compliance_dev.py @@ -108,7 +108,7 @@ def connected(out): import numpy as np from scipy import sparse # The frozen installed corrector's actual general sparse service. - from anysolver._stiffened_shell_displacement_corrector import spla + from anyfesolver._stiffened_shell_displacement_corrector import spla if out!=DOC/'attempt-installed-compliance1':raise ValueError('sole exact saved compliance attempt required') previous.artifact();v=input_data();report=dict(status='STARTED',scientific_acceptance=False,plan=PLAN) try: diff --git a/scripts/r8_q4_us3_modal_compare_dev.py b/scripts/r8_q4_us3_modal_compare_dev.py index 59a67d43e..70a635d6f 100644 --- a/scripts/r8_q4_us3_modal_compare_dev.py +++ b/scripts/r8_q4_us3_modal_compare_dev.py @@ -41,16 +41,16 @@ def normalized(columns): def run(reference: Path, manifest: Path, output: Path, site: Path): - import anysolver, numba, threadpoolctl - from anysolver import stiffened_shell as api - from anysolver._stiffened_shell_ge_experimental import _shell_reference, _assemble_shell - from anysolver._stiffened_shell_b2_q4_panel_experimental import _modal_scaled_residual - from anysolver._stiffened_shell_q4_algorithmic_pullback import POLICY as Q4_ALGORITHM - from anysolver._stiffened_shell_physical_q4_mass import physical_mass - from anysolver.linalg import MatrixClass, factorize_cached - from anysolver.e4_pl_element import FORMULATION_ID, IMPLEMENTATION_ID + import anyfesolver, numba, threadpoolctl + from anyfesolver import stiffened_shell as api + from anyfesolver._stiffened_shell_ge_experimental import _shell_reference, _assemble_shell + from anyfesolver._stiffened_shell_b2_q4_panel_experimental import _modal_scaled_residual + from anyfesolver._stiffened_shell_q4_algorithmic_pullback import POLICY as Q4_ALGORITHM + from anyfesolver._stiffened_shell_physical_q4_mass import physical_mass + from anyfesolver.linalg import MatrixClass, factorize_cached + from anyfesolver.e4_pl_element import FORMULATION_ID, IMPLEMENTATION_ID - if not Path(anysolver.__file__).resolve().is_relative_to(site.resolve()): + if not Path(anyfesolver.__file__).resolve().is_relative_to(site.resolve()): raise ValueError('selected installed solver site required') if not numba.config.DISABLE_JIT or numba.get_num_threads() != 1: raise ValueError('declared one-thread JIT-off settings required') @@ -232,10 +232,10 @@ def run(reference: Path, manifest: Path, output: Path, site: Path): native_equation_residuals=[row[2] for row in recovered], pairs=pairs, counts=counts, reference_eigen_residual='NOT_VERIFIED', refinement_convergence='NOT_ASSESSED', metric='common physical Q4 nodal reconstruction; excludes massless rz; scalar MAC not clustered-subspace acceptance', - runtime=dict(anysolver=anysolver.__file__, pools=pools, jit_disabled=bool(numba.config.DISABLE_JIT), + runtime=dict(anyfesolver=anyfesolver.__file__, pools=pools, jit_disabled=bool(numba.config.DISABLE_JIT), numba_threads=numba.get_num_threads(), installed_modules=len(module_hashes), module_manifest_sha256=sha(module_manifest), - dependencies={name:metadata.version(name) for name in ('ANYsolver','ANYmaterial','numpy','scipy','numba')}), + dependencies={name:metadata.version(name) for name in ('ANYfeSolver','ANYmaterial','numpy','scipy','numba')}), elapsed_seconds=time.perf_counter()-start, runner_sha256=sha(Path(__file__)), protected_reference_inputs={name:inventory[name] for name in inputs}) (output/'result.json').write_text(json.dumps(result, indent=2)+'\n') diff --git a/scripts/run_b3_e4_ccx_3d_knot_mx_dev.py b/scripts/run_b3_e4_ccx_3d_knot_mx_dev.py index 9350eff45..da6108dde 100644 --- a/scripts/run_b3_e4_ccx_3d_knot_mx_dev.py +++ b/scripts/run_b3_e4_ccx_3d_knot_mx_dev.py @@ -21,7 +21,7 @@ WORKTREE = Path(__file__).resolve().parents[1] -EXE = Path("C:/Github/ANYsolver/.qualification/b3-ge-e4-pl/" +EXE = Path("C:/Github/ANYfeSolver/.qualification/b3-ge-e4-pl/" "calculix-223/CalculiX-2.23.0-win-x64/bin/ccx.exe") EXE_SHA = "27a9426a1ee2f72c38fbe892e0ffaf38e14867628ffd0235770261b6f3ec9c5f" TIMEOUT_SECONDS = 120 diff --git a/scripts/run_b3_ge_e4_pl_g0_f03_banded_moment_v1.py b/scripts/run_b3_ge_e4_pl_g0_f03_banded_moment_v1.py index f49aadce0..0acd18d57 100644 --- a/scripts/run_b3_ge_e4_pl_g0_f03_banded_moment_v1.py +++ b/scripts/run_b3_ge_e4_pl_g0_f03_banded_moment_v1.py @@ -26,7 +26,7 @@ MAX_RSS=8*1024**3 MAX_CASE_SECONDS=900 MAX_TOTAL_SECONDS=7200 -PREVIOUS=Path('C:/Github/ANYsolver/.qualification/b3-ge-e4-pl/f03-shell-port-lift-v1') +PREVIOUS=Path('C:/Github/ANYfeSolver/.qualification/b3-ge-e4-pl/f03-shell-port-lift-v1') PREVIOUS_HASHES={ 'manifest.json':'9c85620a018e1c5c6127ba8cb713cba7639e03ac59481d9c51fc9e39b46297ea', 'records.jsonl':'e89ac465f5e94cf7ea22af98ca38666a13a1e55a60faf18da07d812dd35aabde', @@ -139,13 +139,13 @@ def main(): raise ValueError('registered inventory differs') imported=subprocess.check_output( [sys.executable,'-c','import sys;sys.path.insert(0,"src");' - 'import anysolver;print(anysolver.__file__)'],cwd=PARENT.parent,text=True).strip() + 'import anyfesolver;print(anyfesolver.__file__)'],cwd=PARENT.parent,text=True).strip() if not Path(imported).resolve().is_relative_to((PARENT.parent/'src').resolve()): - raise ValueError('ANYsolver import outside frozen integration source') + raise ValueError('ANYfeSolver import outside frozen integration source') args.root.mkdir(parents=True,exist_ok=False) manifest={'purpose':'BANDED_MOMENT_PARITY_NOT_F03_ACCEPTANCE', 'revision':revision,'source_sha256':hashes,'cases':CASES, - 'predecessor_sha256':predecessor,'anysolver_import':imported, + 'predecessor_sha256':predecessor,'anyfesolver_import':imported, 'memory_limit_bytes':MAX_RSS,'case_wall_seconds':MAX_CASE_SECONDS, 'total_wall_seconds':MAX_TOTAL_SECONDS,'rss_sampling_seconds':.5, 'blas_threads':1,'python':platform.python_version(), diff --git a/scripts/run_b3_ge_e4_pl_g0_f03_banded_moment_v2.py b/scripts/run_b3_ge_e4_pl_g0_f03_banded_moment_v2.py index 295f9e625..1ba2fc7ae 100644 --- a/scripts/run_b3_ge_e4_pl_g0_f03_banded_moment_v2.py +++ b/scripts/run_b3_ge_e4_pl_g0_f03_banded_moment_v2.py @@ -26,7 +26,7 @@ MAX_RSS=8*1024**3 MAX_CASE_SECONDS=900 MAX_TOTAL_SECONDS=7200 -PREVIOUS=Path('C:/Github/ANYsolver/.qualification/b3-ge-e4-pl/f03-banded-moment-v1') +PREVIOUS=Path('C:/Github/ANYfeSolver/.qualification/b3-ge-e4-pl/f03-banded-moment-v1') PREVIOUS_HASHES={ 'manifest.json':'422c8d875686988d7df4a5d823c9872fea2f16de378a17483a435d984ec08380', 'records.jsonl':'989a68ef008cca3af46fa1e793dcbb54d085f9fbf1850bb47eb572965d216886', @@ -141,13 +141,13 @@ def main(): raise ValueError('registered inventory differs') imported=subprocess.check_output( [sys.executable,'-c','import sys;sys.path.insert(0,"src");' - 'import anysolver;print(anysolver.__file__)'],cwd=PARENT.parent,text=True).strip() + 'import anyfesolver;print(anyfesolver.__file__)'],cwd=PARENT.parent,text=True).strip() if not Path(imported).resolve().is_relative_to((PARENT.parent/'src').resolve()): - raise ValueError('ANYsolver import outside frozen integration source') + raise ValueError('ANYfeSolver import outside frozen integration source') args.root.mkdir(parents=True,exist_ok=False) manifest={'purpose':'BANDED_MOMENT_V2_PARITY_NOT_F03_ACCEPTANCE', 'revision':revision,'source_sha256':hashes,'cases':CASES, - 'predecessor_sha256':predecessor,'anysolver_import':imported, + 'predecessor_sha256':predecessor,'anyfesolver_import':imported, 'memory_limit_bytes':MAX_RSS,'case_wall_seconds':MAX_CASE_SECONDS, 'total_wall_seconds':MAX_TOTAL_SECONDS,'rss_sampling_seconds':.5, 'blas_threads':1,'python':platform.python_version(), diff --git a/scripts/run_b3_ge_e4_pl_g0_f03_banded_moment_v3.py b/scripts/run_b3_ge_e4_pl_g0_f03_banded_moment_v3.py index e74ac45b7..d8f9af0b6 100644 --- a/scripts/run_b3_ge_e4_pl_g0_f03_banded_moment_v3.py +++ b/scripts/run_b3_ge_e4_pl_g0_f03_banded_moment_v3.py @@ -26,7 +26,7 @@ MAX_RSS=8*1024**3 MAX_CASE_SECONDS=900 MAX_TOTAL_SECONDS=7200 -PREVIOUS=Path('C:/Github/ANYsolver/.qualification/b3-ge-e4-pl/f03-banded-moment-v2') +PREVIOUS=Path('C:/Github/ANYfeSolver/.qualification/b3-ge-e4-pl/f03-banded-moment-v2') PREVIOUS_HASHES={ 'manifest.json':'5c0e7ab6152cf3ef673fbc24f1c47b4edf503f3e7945bc4e76f0efbb35114f0b', 'records.jsonl':'4b94cb3118adc7eb4c0a64e5c6c46914060ea72e7692feb4e4219df281796383', @@ -143,13 +143,13 @@ def main(): raise ValueError('registered inventory differs') imported=subprocess.check_output( [sys.executable,'-c','import sys;sys.path.insert(0,"src");' - 'import anysolver;print(anysolver.__file__)'],cwd=PARENT.parent,text=True).strip() + 'import anyfesolver;print(anyfesolver.__file__)'],cwd=PARENT.parent,text=True).strip() if not Path(imported).resolve().is_relative_to((PARENT.parent/'src').resolve()): - raise ValueError('ANYsolver import outside frozen integration source') + raise ValueError('ANYfeSolver import outside frozen integration source') args.root.mkdir(parents=True,exist_ok=False) manifest={'purpose':'BANDED_MOMENT_V3_PARITY_NOT_F03_ACCEPTANCE', 'revision':revision,'source_sha256':hashes,'cases':CASES, - 'predecessor_sha256':predecessor,'anysolver_import':imported, + 'predecessor_sha256':predecessor,'anyfesolver_import':imported, 'memory_limit_bytes':MAX_RSS,'case_wall_seconds':MAX_CASE_SECONDS, 'total_wall_seconds':MAX_TOTAL_SECONDS,'rss_sampling_seconds':.5, 'blas_threads':1,'python':platform.python_version(), diff --git a/scripts/run_b3_ge_e4_pl_g0_f03_k0.py b/scripts/run_b3_ge_e4_pl_g0_f03_k0.py index d8222d376..ba48c7894 100644 --- a/scripts/run_b3_ge_e4_pl_g0_f03_k0.py +++ b/scripts/run_b3_ge_e4_pl_g0_f03_k0.py @@ -21,7 +21,7 @@ import time import traceback -import anysolver +import anyfesolver import numpy import psutil import scipy @@ -39,15 +39,15 @@ 'scripts/probe_b3_ge_e4_pl_g0_f03_kkt.py', 'scripts/_b3_e4_f03_native_fixture.py', 'scripts/_b3_e4_f03_shell_trace.py', - 'src/anysolver/_ge_beam3_retained_generalized.py', - 'src/anysolver/_ge_beam3_retained_generalized_state.py', - 'src/anysolver/_ge_beam3_generalized_static_boundary.py', - 'src/anysolver/_ge_beam3_native_generalized_element.py', - 'src/anysolver/_ge_beam3_centered_reference.py', - 'src/anysolver/e4_pl_element.py', - 'src/anysolver/e4_pl_s3_element.py', - 'src/anysolver/e4_pl_s3_v2d_element.py', - 'src/anysolver/elements.py', + 'src/anyfesolver/_ge_beam3_retained_generalized.py', + 'src/anyfesolver/_ge_beam3_retained_generalized_state.py', + 'src/anyfesolver/_ge_beam3_generalized_static_boundary.py', + 'src/anyfesolver/_ge_beam3_native_generalized_element.py', + 'src/anyfesolver/_ge_beam3_centered_reference.py', + 'src/anyfesolver/e4_pl_element.py', + 'src/anyfesolver/e4_pl_s3_element.py', + 'src/anyfesolver/e4_pl_s3_v2d_element.py', + 'src/anyfesolver/elements.py', ) THREADS = ('OMP_NUM_THREADS','OPENBLAS_NUM_THREADS','MKL_NUM_THREADS', 'NUMEXPR_NUM_THREADS','BLIS_NUM_THREADS','GOTO_NUM_THREADS', @@ -62,9 +62,9 @@ def actual_identity() -> dict: numpy.linalg.svd(numpy.eye(2)) scipy.linalg.svd(numpy.eye(2)) pools = threadpoolctl.threadpool_info() - imported = Path(anysolver.__file__).resolve() + imported = Path(anyfesolver.__file__).resolve() if not imported.is_relative_to(ROOT / 'src'): - raise RuntimeError('anysolver import is not from the candidate checkout') + raise RuntimeError('anyfesolver import is not from the candidate checkout') head = subprocess.check_output(('git','rev-parse','HEAD'),cwd=ROOT, text=True).strip() dirty = subprocess.check_output( @@ -74,20 +74,20 @@ def actual_identity() -> dict: raise RuntimeError('F03-K0 execution requires a clean source checkout') source_hashes = {name:sha256(ROOT / name) for name in SOURCES} tracked = subprocess.check_output( - ('git','ls-files','-z','--','src/anysolver'),cwd=ROOT).split(b'\0') + ('git','ls-files','-z','--','src/anyfesolver'),cwd=ROOT).split(b'\0') source_tree = hashlib.sha256() for raw_name in filter(None,tracked): name = os.fsdecode(raw_name) source_tree.update(raw_name+b'\0'+bytes.fromhex(sha256(ROOT/name))) return {'candidate_commit':head,'source_sha256':source_hashes, 'tracked_solver_source_tree_sha256':source_tree.hexdigest(), - 'imported_anysolver':str(imported), - 'source_anysolver_version':anysolver.__version__, + 'imported_anyfesolver':str(imported), + 'source_anyfesolver_version':anyfesolver.__version__, 'numba_cache_directory':os.environ.get('NUMBA_CACHE_DIR'), 'pythonpath':os.environ.get('PYTHONPATH'), 'python_executable':str(Path(sys.executable).resolve()), 'python_version':platform.python_version(), - 'packages':{'anysolver':importlib.metadata.version('anysolver'), + 'packages':{'anyfesolver':importlib.metadata.version('anyfesolver'), 'numpy':numpy.__version__, 'scipy':scipy.__version__, 'numba':importlib.metadata.version('numba'), diff --git a/scripts/run_b3_ge_e4_pl_g0_f03_local_trace_norm_v1.py b/scripts/run_b3_ge_e4_pl_g0_f03_local_trace_norm_v1.py index adc941236..96bbdbd20 100644 --- a/scripts/run_b3_ge_e4_pl_g0_f03_local_trace_norm_v1.py +++ b/scripts/run_b3_ge_e4_pl_g0_f03_local_trace_norm_v1.py @@ -113,12 +113,12 @@ def main(): raise ValueError('freeze and commit all integration worktree inputs before execution') imported=subprocess.check_output( [sys.executable,'-c','import sys;sys.path.insert(0,"src");' - 'import anysolver;print(anysolver.__file__)'], + 'import anyfesolver;print(anyfesolver.__file__)'], cwd=PARENT.parent,text=True).strip() args.root.mkdir(parents=True,exist_ok=False) manifest={'purpose':'MESH_LOCAL_DG_TRACE_DIAGNOSTIC_NOT_F03_ACCEPTANCE', 'revision':revision,'source_sha256':source_hashes, - 'anysolver_import':imported,'cases':CASES, + 'anyfesolver_import':imported,'cases':CASES, 'memory_limit_bytes':MAX_RSS,'case_wall_seconds':MAX_CASE_SECONDS, 'total_wall_seconds':MAX_TOTAL_SECONDS, 'rss_sampling_seconds':.5,'blas_threads':1, diff --git a/scripts/run_b3_ge_e4_pl_g0_f03_resolved_sparse_v5.py b/scripts/run_b3_ge_e4_pl_g0_f03_resolved_sparse_v5.py index 6a57e1271..6aea4509f 100644 --- a/scripts/run_b3_ge_e4_pl_g0_f03_resolved_sparse_v5.py +++ b/scripts/run_b3_ge_e4_pl_g0_f03_resolved_sparse_v5.py @@ -28,7 +28,7 @@ (t,'smooth',ns,ny,nb) for t in ('Q4','S3-V2D') for ns,ny,nb in ((128,64,128),(128,128,64))) PARENT=Path(__file__).resolve().parent -V4=Path('C:/Github/ANYsolver/.qualification/b3-ge-e4-pl/f03-resolved-refinement-v4') +V4=Path('C:/Github/ANYfeSolver/.qualification/b3-ge-e4-pl/f03-resolved-refinement-v4') PREDECESSOR_SHA={ 'manifest.json':'8e016729c7e3c863642f3938d375584c249b0368eab0f49d4b2876e1bf03c83b', 'records.jsonl':'82d53a2487db070717113c3dd3a87ddc1ae9b21bfa326739784679b8ef449d83', diff --git a/scripts/run_b3_ge_e4_pl_g0_f03_shell_port_lift_v1.py b/scripts/run_b3_ge_e4_pl_g0_f03_shell_port_lift_v1.py index dfcdefe2a..aaadc2e03 100644 --- a/scripts/run_b3_ge_e4_pl_g0_f03_shell_port_lift_v1.py +++ b/scripts/run_b3_ge_e4_pl_g0_f03_shell_port_lift_v1.py @@ -24,7 +24,7 @@ MAX_RSS = 8*1024**3 MAX_CASE_SECONDS = 900 MAX_TOTAL_SECONDS = 7200 -PREVIOUS = Path('C:/Github/ANYsolver/.qualification/b3-ge-e4-pl/f03-local-trace-norm-v1') +PREVIOUS = Path('C:/Github/ANYfeSolver/.qualification/b3-ge-e4-pl/f03-local-trace-norm-v1') PREVIOUS_HASHES = { 'manifest.json':'b7a93390ecb2fb3e45a29f8f4ebc5a0f495d58297d09f42591a42252d5c8e71b', 'records.jsonl':'bf69b46e865162882c61ea17f398f30661c4d756baf9e17fc88da32d0c683790', @@ -131,13 +131,13 @@ def main(): raise ValueError('registered inventory differs') imported = subprocess.check_output( [sys.executable,'-c','import sys;sys.path.insert(0,"src");' - 'import anysolver;print(anysolver.__file__)'],cwd=PARENT.parent,text=True).strip() + 'import anyfesolver;print(anyfesolver.__file__)'],cwd=PARENT.parent,text=True).strip() if not Path(imported).resolve().is_relative_to((PARENT.parent/'src').resolve()): - raise ValueError('imported ANYsolver is outside frozen integration source') + raise ValueError('imported ANYfeSolver is outside frozen integration source') args.root.mkdir(parents=True,exist_ok=False) manifest = {'purpose':'SUPPORTED_SHELL_PORT_LIFT_NOT_F03_ACCEPTANCE', 'revision':revision,'source_sha256':hashes,'cases':CASES, - 'predecessor_sha256':predecessor,'anysolver_import':imported, + 'predecessor_sha256':predecessor,'anyfesolver_import':imported, 'memory_limit_bytes':MAX_RSS,'case_wall_seconds':MAX_CASE_SECONDS, 'total_wall_seconds':MAX_TOTAL_SECONDS,'rss_sampling_seconds':.5, 'blas_threads':1,'python':platform.python_version(), diff --git a/scripts/run_b3_ge_e4_pl_g0_f03_signed_graph_v1.py b/scripts/run_b3_ge_e4_pl_g0_f03_signed_graph_v1.py index 48a924045..8f71c8862 100644 --- a/scripts/run_b3_ge_e4_pl_g0_f03_signed_graph_v1.py +++ b/scripts/run_b3_ge_e4_pl_g0_f03_signed_graph_v1.py @@ -25,9 +25,9 @@ MAX_RSS=8*1024**3 MAX_CASE_SECONDS=900 MAX_TOTAL_SECONDS=7200 -ROOT=Path('C:/Github/ANYsolver/.qualification/b3-ge-e4-pl/f03-signed-graph-v1') -CACHE=Path('C:/Github/ANYsolver/.qualification/b3-ge-e4-pl/numba-cache') -PREVIOUS=Path('C:/Github/ANYsolver/.qualification/b3-ge-e4-pl/f03-banded-moment-v3') +ROOT=Path('C:/Github/ANYfeSolver/.qualification/b3-ge-e4-pl/f03-signed-graph-v1') +CACHE=Path('C:/Github/ANYfeSolver/.qualification/b3-ge-e4-pl/numba-cache') +PREVIOUS=Path('C:/Github/ANYfeSolver/.qualification/b3-ge-e4-pl/f03-banded-moment-v3') PREVIOUS_HASHES={ 'manifest.json':'38d94e90f1fb3cb5f5e03ca4815154795e50403736f9a376cf1d8dbe2432e0a9', 'records.jsonl':'2604ffc87f9646b65910c523304df5943f2632df125252c2f45b1d99229cf932', @@ -167,13 +167,13 @@ def main(): raise ValueError('registered inventory differs') imported=subprocess.check_output( [sys.executable,'-c','import sys;sys.path.insert(0,"src");' - 'import anysolver;print(anysolver.__file__)'],cwd=PARENT.parent,text=True).strip() + 'import anyfesolver;print(anyfesolver.__file__)'],cwd=PARENT.parent,text=True).strip() if not Path(imported).resolve().is_relative_to((PARENT.parent/'src').resolve()): - raise ValueError('ANYsolver import outside frozen integration source') + raise ValueError('ANYfeSolver import outside frozen integration source') args.root.mkdir(parents=True,exist_ok=False) manifest={'purpose':'SIGNED_GRAPH_V1_EXPLORATORY_NOT_F03_ACCEPTANCE', 'revision':revision,'source_sha256':hashes,'cases':CASES, - 'predecessor_sha256':predecessor,'anysolver_import':imported, + 'predecessor_sha256':predecessor,'anyfesolver_import':imported, 'numba_cache':str(CACHE), 'memory_limit_bytes':MAX_RSS,'case_wall_seconds':MAX_CASE_SECONDS, 'total_wall_seconds':MAX_TOTAL_SECONDS,'rss_sampling_seconds':.5, diff --git a/scripts/run_b3_ge_e4_pl_g0_f03_variational_line_v1.py b/scripts/run_b3_ge_e4_pl_g0_f03_variational_line_v1.py index 6a45ebdb0..b69f8797c 100644 --- a/scripts/run_b3_ge_e4_pl_g0_f03_variational_line_v1.py +++ b/scripts/run_b3_ge_e4_pl_g0_f03_variational_line_v1.py @@ -18,7 +18,7 @@ import numpy as np import psutil import scipy -import anysolver +import anyfesolver import probe_b3_ge_e4_pl_g0_f03_variational_line_v1 as probe @@ -147,7 +147,7 @@ def main(): manifest={'purpose':'EXPLORATORY_CLASSICAL_VARIATIONAL_LINE_NOT_F03_ACCEPTANCE', 'revision':revision,'source_sha256':hashes,'cases':CASES, 'independent_membrane_import':imported, - 'anysolver_import':str(Path(anysolver.__file__).resolve()), + 'anyfesolver_import':str(Path(anyfesolver.__file__).resolve()), 'memory_limit_bytes':MAX_RSS,'case_wall_seconds':MAX_CASE_SECONDS, 'total_wall_seconds':MAX_TOTAL_SECONDS,'rss_sampling_seconds':.5, 'blas_threads':1,'python':platform.python_version(), diff --git a/scripts/run_b3_ge_e4_pl_g0_f03_variational_refinement_v2.py b/scripts/run_b3_ge_e4_pl_g0_f03_variational_refinement_v2.py index e54f45de0..457c62619 100644 --- a/scripts/run_b3_ge_e4_pl_g0_f03_variational_refinement_v2.py +++ b/scripts/run_b3_ge_e4_pl_g0_f03_variational_refinement_v2.py @@ -15,7 +15,7 @@ PARENT=Path(__file__).resolve().parent sys.path.insert(0,str(PARENT.parent/'src')) -import anysolver +import anyfesolver import numpy as np import psutil import scipy @@ -32,7 +32,7 @@ MAX_RSS=8*1024**3 MAX_CASE_SECONDS=900 MAX_TOTAL_SECONDS=7200 -V1_ROOT=Path('C:/Github/ANYsolver/.qualification/b3-ge-e4-pl/f03-variational-line-v1') +V1_ROOT=Path('C:/Github/ANYfeSolver/.qualification/b3-ge-e4-pl/f03-variational-line-v1') V1_HASHES={ 'manifest.json':'3895a90ec6e94dc92b9c3738a8fc880fca20f56c51dd182b58664446660e0483', 'preflight.json':'8a6dc936d517a2fb060208d086d51a36c71d3efb93fc6989e2075491e8904d78', @@ -158,7 +158,7 @@ def main(): manifest={'purpose':'INDEPENDENT_CLASSICAL_VARIATIONAL_REFINEMENT_NOT_F03_ACCEPTANCE', 'revision':revision,'source_sha256':hashes,'cases':CASES, 'predecessor_v1_sha256':predecessor, - 'anysolver_import':str(Path(anysolver.__file__).resolve()), + 'anyfesolver_import':str(Path(anyfesolver.__file__).resolve()), 'independent_membrane_import':str(Path( previous.probe.reference.continuum_stiffness.__code__.co_filename).resolve()), 'memory_limit_bytes':MAX_RSS,'case_wall_seconds':MAX_CASE_SECONDS, diff --git a/scripts/run_beam_shell_verification.py b/scripts/run_beam_shell_verification.py index 74312f0fe..72d15bd55 100644 --- a/scripts/run_beam_shell_verification.py +++ b/scripts/run_beam_shell_verification.py @@ -11,7 +11,7 @@ if str(SRC) not in sys.path: sys.path.insert(0, str(SRC)) -from anysolver.beam_shell_verification import DEFAULT_BEAM_SHELL_VERIFICATION_PATH, write_beam_shell_verification_report +from anyfesolver.beam_shell_verification import DEFAULT_BEAM_SHELL_VERIFICATION_PATH, write_beam_shell_verification_report def main() -> int: diff --git a/scripts/run_beam_validity.py b/scripts/run_beam_validity.py index cc643510c..247f1cb42 100644 --- a/scripts/run_beam_validity.py +++ b/scripts/run_beam_validity.py @@ -12,7 +12,7 @@ if str(SRC) not in sys.path: sys.path.insert(0, str(SRC)) -from anysolver.beam_validity import DEFAULT_BEAM_VALIDITY_PATH, write_beam_validity_report +from anyfesolver.beam_validity import DEFAULT_BEAM_VALIDITY_PATH, write_beam_validity_report def _write_markdown(report: dict, path: Path) -> None: diff --git a/scripts/run_buckling_validity.py b/scripts/run_buckling_validity.py index 1a0b1ad47..9ad26d8fd 100644 --- a/scripts/run_buckling_validity.py +++ b/scripts/run_buckling_validity.py @@ -13,7 +13,7 @@ if str(SRC) not in sys.path: sys.path.insert(0, str(SRC)) -from anysolver.buckling_validity import DEFAULT_BUCKLING_VALIDITY_PATH, write_buckling_validity_report # noqa: E402 +from anyfesolver.buckling_validity import DEFAULT_BUCKLING_VALIDITY_PATH, write_buckling_validity_report # noqa: E402 def _markdown(report: Dict[str, Any]) -> str: diff --git a/scripts/run_capacity_workflow.py b/scripts/run_capacity_workflow.py index 41c1060bd..6637aa0e5 100644 --- a/scripts/run_capacity_workflow.py +++ b/scripts/run_capacity_workflow.py @@ -12,10 +12,10 @@ if str(SRC) not in sys.path: sys.path.insert(0, str(SRC)) -from anysolver.boundary import BoundaryCondition, LoadCase -from anysolver.capacity_workflow import CapacityWorkflowConfig, DEFAULT_CAPACITY_WORKFLOW_PATH, run_nonlinear_capacity_workflow, write_capacity_workflow_report -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel +from anyfesolver.boundary import BoundaryCondition, LoadCase +from anyfesolver.capacity_workflow import CapacityWorkflowConfig, DEFAULT_CAPACITY_WORKFLOW_PATH, run_nonlinear_capacity_workflow, write_capacity_workflow_report +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel def _beam_column_model(num_elements: int = 6) -> FEModel: diff --git a/scripts/run_cylinder_benchmark.py b/scripts/run_cylinder_benchmark.py index 1d84fd8e1..ac6aa0b7c 100644 --- a/scripts/run_cylinder_benchmark.py +++ b/scripts/run_cylinder_benchmark.py @@ -12,7 +12,7 @@ if str(SRC) not in sys.path: sys.path.insert(0, str(SRC)) -from anysolver import CylinderBenchmarkConfig, run_cylindrical_shell_benchmark +from anyfesolver import CylinderBenchmarkConfig, run_cylindrical_shell_benchmark def main() -> int: diff --git a/scripts/run_e4_pl_burnin_gate.py b/scripts/run_e4_pl_burnin_gate.py index 5f9b0f376..06466b866 100644 --- a/scripts/run_e4_pl_burnin_gate.py +++ b/scripts/run_e4_pl_burnin_gate.py @@ -682,7 +682,7 @@ ("ANYmaterial", "ANYmaterial", "anymaterial"), ("ANYmesh", "ANYmesher", "anymesher"), ("ANYfileIO", "ANYfileio", "anyfileio"), - ("ANYsolver", "ANYsolver", "anysolver"), + ("ANYfeSolver", "ANYfeSolver", "anyfesolver"), ) SHA256_RE = re.compile(r"[0-9a-f]{64}\Z") @@ -1213,7 +1213,7 @@ def validate_gate_result( """Validate a prospective Q1M gate result without creating evidence. Passing ``repository_paths`` enables the final clean-tree and Git-object - identity check. Its keys must name ANYsolver and all five siblings. + identity check. Its keys must name ANYfeSolver and all five siblings. """ contract = dict(_load_contract() if contract is None else contract) @@ -1248,8 +1248,8 @@ def validate_gate_result( candidate = _exact_keys( record["candidate"], {"clean", "commit", "repository", "tree"}, "$.candidate" ) - if candidate["repository"] != "ANYsolver": - raise EvidenceError("$.candidate.repository must be ANYsolver") + if candidate["repository"] != "ANYfeSolver": + raise EvidenceError("$.candidate.repository must be ANYfeSolver") if not _require_bool(candidate["clean"], "$.candidate.clean"): raise EvidenceError("the candidate repository must be clean") _require_match(candidate["commit"], GIT_OBJECT_RE, "$.candidate.commit") @@ -1524,7 +1524,7 @@ def validate_gate_result( if file_hash_record(package_path) != record["package_result"]: raise EvidenceError("package result identity mismatch") expected_source_identities = { - "ANYsolver": record["candidate"], + "ANYfeSolver": record["candidate"], "ANYmesh": record["siblings"]["ANYmesh"], "ANYgeometry": record["siblings"]["ANYgeometry"], "ANYmaterial": record["siblings"]["ANYmaterial"], @@ -1534,13 +1534,13 @@ def validate_gate_result( source = package["sources"][name] if source["commit"] != identity["commit"] or source["tree"] != identity["tree"]: raise EvidenceError(f"package source identity mismatch for {name}") - if package["wheels"]["ANYsolver"] != record["wheel"]: - raise EvidenceError("package result ANYsolver wheel mismatch") + if package["wheels"]["ANYfeSolver"] != record["wheel"]: + raise EvidenceError("package result ANYfeSolver wheel mismatch") elif package_result_path is not None: raise EvidenceError("package result path is forbidden when package did not pass") if lanes["package"]["status"] == "PASS" and wheel_path is not None: if wheel_hash_record(Path(wheel_path)) != wheel: - raise EvidenceError("installed ANYsolver wheel identity mismatch") + raise EvidenceError("installed ANYfeSolver wheel identity mismatch") elif wheel_path is not None: raise EvidenceError("wheel path is forbidden when package did not pass") return record @@ -1577,10 +1577,10 @@ def _validate_repository_identities( repository_paths: Mapping[str, Path], contract: Mapping[str, Any], ) -> None: - expected_names = {"ANYsolver", *SIBLING_NAMES} + expected_names = {"ANYfeSolver", *SIBLING_NAMES} if set(repository_paths) != expected_names: raise EvidenceError("repository_paths must name the candidate and all siblings") - identities = {"ANYsolver": record["candidate"], **record["siblings"]} + identities = {"ANYfeSolver": record["candidate"], **record["siblings"]} if "execution" in contract: empty_status = contract["execution"]["clean_status_empty"] repository_order = contract["execution"]["clean_status_scope"] @@ -1796,7 +1796,7 @@ def _local_roots() -> dict[str, Path]: "ANYmaterial": github / "ANYmaterial", "ANYmesh": github / "ANYmesh", "ANYfileIO": github / "ANYfileIO", - "ANYsolver": ROOT, + "ANYfeSolver": ROOT, } for name in tuple(roots): override = os.environ.get(f"Q1M_{name.upper()}_ROOT") @@ -3872,7 +3872,7 @@ def _functional_shard_environment( inner_wave_environment: Mapping[str, str] | None = None, ) -> dict[str, str]: roots = _local_roots() - roots["ANYsolver"] = sandbox + roots["ANYfeSolver"] = sandbox metadata = shard_root / "temp" / "metadata" _write_source_metadata_overlay(roots, metadata) environment = os.environ.copy() @@ -5834,7 +5834,7 @@ def make_writable_and_retry(function, path, _excinfo): if sys.version_info >= (3, 12): shutil.rmtree(temporary_path, onexc=make_writable_and_retry) else: - # ``onexc`` was added in Python 3.12. ANYsolver also supports + # ``onexc`` was added in Python 3.12. ANYfeSolver also supports # Python 3.11, whose equivalent callback is ``onerror``. shutil.rmtree(temporary_path, onerror=make_writable_and_retry) try: @@ -6474,7 +6474,7 @@ def under(path, root): return True origins = {} -for package in ("anysolver", "anygeometry", "anymaterial", "anymesher", "anyfileio"): +for package in ("anyfesolver", "anygeometry", "anymaterial", "anymesher", "anyfileio"): module = importlib.import_module(package) origin = pathlib.Path(module.__file__).resolve() if not under(origin, target): @@ -6490,7 +6490,7 @@ def under(path, root): if any(under(pathlib.Path.cwd().resolve(), root) for root in forbidden): raise AssertionError("smoke process cwd is inside a source repository") -from anysolver import ( +from anyfesolver import ( LegacyQ4DeprecationWarning, QualifiedE4PLShellElement, ShellElement, @@ -6549,7 +6549,7 @@ def run_package_lane( environment.pop("PYTHONHOME", None) environment["PYTHONNOUSERSITE"] = "1" - with tempfile.TemporaryDirectory(prefix="anysolver-q1m-package-") as temporary: + with tempfile.TemporaryDirectory(prefix="anyfesolver-q1m-package-") as temporary: workspace = Path(temporary).resolve() if any( workspace == path.resolve() or workspace.is_relative_to(path.resolve()) @@ -6684,14 +6684,14 @@ def run_package_lane( validate_package_result(result) payload = canonical_json_bytes(result) if wheel_output is not None: - if wheel_output.name != wheels["ANYsolver"].name: + if wheel_output.name != wheels["ANYfeSolver"].name: raise EvidenceError( - "preserved wheel path basename must match the built ANYsolver wheel" + "preserved wheel path basename must match the built ANYfeSolver wheel" ) wheel_output.parent.mkdir(parents=True, exist_ok=True) - with wheels["ANYsolver"].open("rb") as source, wheel_output.open("xb") as target_stream: + with wheels["ANYfeSolver"].open("rb") as source, wheel_output.open("xb") as target_stream: shutil.copyfileobj(source, target_stream) - if wheel_hash_record(wheel_output) != wheel_hash_record(wheels["ANYsolver"]): + if wheel_hash_record(wheel_output) != wheel_hash_record(wheels["ANYfeSolver"]): raise EvidenceError("preserved wheel identity differs from built wheel") if output is not None: output.parent.mkdir(parents=True, exist_ok=True) diff --git a/scripts/run_element_qualification.py b/scripts/run_element_qualification.py index 868983a45..0b6b39f0a 100644 --- a/scripts/run_element_qualification.py +++ b/scripts/run_element_qualification.py @@ -13,7 +13,7 @@ if str(SRC) not in sys.path: sys.path.insert(0, str(SRC)) -from anysolver.element_qualification import DEFAULT_ELEMENT_QUALIFICATION_PATH, write_element_qualification_report # noqa: E402 +from anyfesolver.element_qualification import DEFAULT_ELEMENT_QUALIFICATION_PATH, write_element_qualification_report # noqa: E402 def _markdown(report: Dict[str, Any]) -> str: diff --git a/scripts/run_external_references.py b/scripts/run_external_references.py index dc8b9a844..5a3b369fc 100644 --- a/scripts/run_external_references.py +++ b/scripts/run_external_references.py @@ -11,7 +11,7 @@ if str(SRC) not in sys.path: sys.path.insert(0, str(SRC)) -from anysolver.external_references import ( +from anyfesolver.external_references import ( DEFAULT_CALCULIX_RUN_PATH, DEFAULT_EXTERNAL_REFERENCE_PATH, write_external_reference_report, diff --git a/scripts/run_fe_benchmarks.py b/scripts/run_fe_benchmarks.py index 18bca44b0..35de6bb66 100644 --- a/scripts/run_fe_benchmarks.py +++ b/scripts/run_fe_benchmarks.py @@ -12,7 +12,7 @@ if str(SRC) not in sys.path: sys.path.insert(0, str(SRC)) -from anysolver.benchmarks import DEFAULT_BENCHMARK_PATH, write_benchmark_report +from anyfesolver.benchmarks import DEFAULT_BENCHMARK_PATH, write_benchmark_report def _write_markdown(report: dict, path: Path) -> None: diff --git a/scripts/run_fe_verification.py b/scripts/run_fe_verification.py index 40b1ef5e2..01f7202d5 100644 --- a/scripts/run_fe_verification.py +++ b/scripts/run_fe_verification.py @@ -351,8 +351,8 @@ def _commands( import_check = [ py, "-c", - "import anysolver; missing=[n for n in anysolver.__all__ if not hasattr(anysolver,n)]; " - "assert not missing, missing; print(f'imported {len(anysolver.__all__)} public FE symbols')", + "import anyfesolver; missing=[n for n in anyfesolver.__all__ if not hasattr(anyfesolver,n)]; " + "assert not missing, missing; print(f'imported {len(anyfesolver.__all__)} public FE symbols')", ] commands: List[tuple[str, List[str]]] = [("public_imports", import_check)] if quick: diff --git a/scripts/run_ge_beam3_g1.py b/scripts/run_ge_beam3_g1.py index 9cfc8ea49..61b4b0bd4 100644 --- a/scripts/run_ge_beam3_g1.py +++ b/scripts/run_ge_beam3_g1.py @@ -24,7 +24,7 @@ def main(): spec = importlib.util.spec_from_file_location("g1_bound_process", ROOT / "docs/reference_cases/e4_pl_s3_v2_bounded_process.py") module = importlib.util.module_from_spec(spec); sys.modules[spec.name] = module spec.loader.exec_module(module) - output = Path(tempfile.mkdtemp(prefix="anysolver-g1-development-")) + output = Path(tempfile.mkdtemp(prefix="anyfesolver-g1-development-")) print("DIAGNOSTICS " + str(output), flush=True) env = dict(os.environ) for name in ("OMP_NUM_THREADS", "OPENBLAS_NUM_THREADS", "MKL_NUM_THREADS", "NUMEXPR_NUM_THREADS"): diff --git a/scripts/run_ge_beam3_g2.py b/scripts/run_ge_beam3_g2.py index ee1c5835d..e2d6f24a8 100644 --- a/scripts/run_ge_beam3_g2.py +++ b/scripts/run_ge_beam3_g2.py @@ -19,7 +19,7 @@ def main(): if os.name != "nt" or any(t.split("::")[0] not in allowed for t in a.tests): raise ValueError("registered Windows development lane required") spec = importlib.util.spec_from_file_location("g2_bounds", ROOT/"docs/reference_cases/e4_pl_s3_v2_bounded_process.py") m = importlib.util.module_from_spec(spec); sys.modules[spec.name] = m; spec.loader.exec_module(m) - out = Path(tempfile.mkdtemp(prefix="anysolver-g2-development-")); print("DIAGNOSTICS "+str(out), flush=True) + out = Path(tempfile.mkdtemp(prefix="anyfesolver-g2-development-")); print("DIAGNOSTICS "+str(out), flush=True) env = dict(os.environ) for key in ("OMP_NUM_THREADS", "OPENBLAS_NUM_THREADS", "MKL_NUM_THREADS", "NUMEXPR_NUM_THREADS", "BLIS_NUM_THREADS", "NUMBA_NUM_THREADS", "TBB_NUM_THREADS"): env[key] = "1" env.update(PYTHONPATH=str(ROOT/"src")+os.pathsep+str(ROOT), PYTHONDONTWRITEBYTECODE="1", PYTEST_DISABLE_PLUGIN_AUTOLOAD="1", PYTEST_ADDOPTS="", diff --git a/scripts/run_ge_beam3_g3a.py b/scripts/run_ge_beam3_g3a.py index 6f49018d0..4439a90b4 100644 --- a/scripts/run_ge_beam3_g3a.py +++ b/scripts/run_ge_beam3_g3a.py @@ -19,7 +19,7 @@ def main(): if os.name != "nt" or any(t.split("::")[0] not in allowed for t in a.tests): raise ValueError("registered Windows development lane required") spec = importlib.util.spec_from_file_location("g3a_bounds", ROOT/"docs/reference_cases/e4_pl_s3_v2_bounded_process.py") m = importlib.util.module_from_spec(spec); sys.modules[spec.name] = m; spec.loader.exec_module(m) - out = Path(tempfile.mkdtemp(prefix="anysolver-g3a-development-")); print("DIAGNOSTICS "+str(out), flush=True) + out = Path(tempfile.mkdtemp(prefix="anyfesolver-g3a-development-")); print("DIAGNOSTICS "+str(out), flush=True) env = dict(os.environ) for key in ("OMP_NUM_THREADS", "OPENBLAS_NUM_THREADS", "MKL_NUM_THREADS", "NUMEXPR_NUM_THREADS", "BLIS_NUM_THREADS", "NUMBA_NUM_THREADS", "TBB_NUM_THREADS"): env[key] = "1" env.update(PYTHONPATH=str(ROOT/"src")+os.pathsep+str(ROOT), PYTHONDONTWRITEBYTECODE="1", PYTEST_DISABLE_PLUGIN_AUTOLOAD="1", PYTEST_ADDOPTS="", diff --git a/scripts/run_ge_beam3_g3b.py b/scripts/run_ge_beam3_g3b.py index b94259143..39baefed5 100644 --- a/scripts/run_ge_beam3_g3b.py +++ b/scripts/run_ge_beam3_g3b.py @@ -28,7 +28,7 @@ def main(): if os.name != "nt" or any(t.split("::")[0] not in allowed for t in a.tests): raise ValueError("registered Windows development lane required") spec = importlib.util.spec_from_file_location("g3b_bounds", ROOT/"docs/reference_cases/e4_pl_s3_v2_bounded_process.py") m = importlib.util.module_from_spec(spec); sys.modules[spec.name] = m; spec.loader.exec_module(m) - out = Path(tempfile.mkdtemp(prefix="anysolver-g3b-development-")); print("DIAGNOSTICS "+str(out), flush=True) + out = Path(tempfile.mkdtemp(prefix="anyfesolver-g3b-development-")); print("DIAGNOSTICS "+str(out), flush=True) env = dict(os.environ) for key in ("OMP_NUM_THREADS", "OPENBLAS_NUM_THREADS", "MKL_NUM_THREADS", "NUMEXPR_NUM_THREADS", "BLIS_NUM_THREADS", "NUMBA_NUM_THREADS", "TBB_NUM_THREADS"): env[key] = "1" env.update(PYTHONPATH=str(ROOT/"src")+os.pathsep+str(ROOT), PYTHONDONTWRITEBYTECODE="1", PYTEST_DISABLE_PLUGIN_AUTOLOAD="1", PYTEST_ADDOPTS="", diff --git a/scripts/run_ge_beam3_g3c_history.py b/scripts/run_ge_beam3_g3c_history.py index 45aa2afbd..5c8c03b2f 100644 --- a/scripts/run_ge_beam3_g3c_history.py +++ b/scripts/run_ge_beam3_g3c_history.py @@ -75,7 +75,7 @@ def worker(out, expected): if lane not in INVENTORIES or lease['inventory']!=INVENTORIES[lane]: raise ValueError('unknown lane') print('G3C CHECKPOINT history authority',flush=True) sys.path[:0]=[str(ROOT/'src'),str(ROOT),str(inherited.infrastructure.CAPSULE.parent/'site')] - from anysolver._ge_beam3_g3c_stable import authority as runtime + from anyfesolver._ge_beam3_g3c_stable import authority as runtime runtime.capture(raw) import pytest inventory=inherited.Inventory(1) @@ -227,7 +227,7 @@ def main(): if args.wave=='restart': if args.prior_smoke is None: raise ValueError('five-family smoke prerequisite') verify_prior_smoke(args.prior_smoke,candidate,inputs,args.review_sha256) - out=Path(tempfile.mkdtemp(prefix='anysolver-g3c-history-')) + out=Path(tempfile.mkdtemp(prefix='anyfesolver-g3c-history-')) print('DIAGNOSTICS '+str(out),flush=True) lease=dict(kind='G3C_STABLE_PRIVATE_DEVELOPMENT',scope_id=SCOPE,candidate=candidate,inputs=inputs, source_map_sha256=inherited.MAP_SHA,review_sha256=args.review_sha256,implementation_review=environment.strict(review)) diff --git a/scripts/run_ge_beam3_g3c_local.py b/scripts/run_ge_beam3_g3c_local.py index 51f42a5e6..e606d7038 100644 --- a/scripts/run_ge_beam3_g3c_local.py +++ b/scripts/run_ge_beam3_g3c_local.py @@ -83,7 +83,7 @@ def main(): if not(sys.flags.isolated and sys.flags.no_site and sys.dont_write_bytecode): raise ValueError('launch with -I -S -B') authority() - out=Path(tempfile.mkdtemp(prefix='anysolver-g3c-local-development-')) + out=Path(tempfile.mkdtemp(prefix='anyfesolver-g3c-local-development-')) print('DIAGNOSTICS '+str(out),flush=True) write(out/'lease.json',dict(kind='LOCAL_DEVELOPMENT_NOT_QUALIFICATION',inputs=inputs())) lease_hash=sha256((out/'lease.json').read_bytes()).hexdigest() diff --git a/scripts/run_ge_beam3_g3c_local_shell.py b/scripts/run_ge_beam3_g3c_local_shell.py index 341d0ba6b..eda9d21b0 100644 --- a/scripts/run_ge_beam3_g3c_local_shell.py +++ b/scripts/run_ge_beam3_g3c_local_shell.py @@ -92,7 +92,7 @@ def main(): if not(sys.flags.isolated and sys.flags.no_site and sys.dont_write_bytecode): raise ValueError('launch with -I -S -B') authority() - out=Path(tempfile.mkdtemp(prefix='anysolver-g3c-shell-development-')) + out=Path(tempfile.mkdtemp(prefix='anyfesolver-g3c-shell-development-')) print('DIAGNOSTICS '+str(out),flush=True) write(out/'lease.json',dict(kind='LOCAL_DEVELOPMENT_NOT_QUALIFICATION',lane=lane,candidate=clean_identity(),inputs=inputs())) lease_hash=sha256((out/'lease.json').read_bytes()).hexdigest() diff --git a/scripts/run_ge_beam3_g3c_owner_bridge.py b/scripts/run_ge_beam3_g3c_owner_bridge.py index 971e97a89..d17c56a2d 100644 --- a/scripts/run_ge_beam3_g3c_owner_bridge.py +++ b/scripts/run_ge_beam3_g3c_owner_bridge.py @@ -93,7 +93,7 @@ def main(): if not(sys.flags.isolated and sys.flags.no_site and sys.dont_write_bytecode): raise ValueError('launch with -I -S -B') authority() - out=Path(tempfile.mkdtemp(prefix='anysolver-g3c-owner-development-')) + out=Path(tempfile.mkdtemp(prefix='anyfesolver-g3c-owner-development-')) print('DIAGNOSTICS '+str(out),flush=True) write(out/'lease.json',dict(kind='LOCAL_DEVELOPMENT_NOT_QUALIFICATION',lane=lane,candidate=clean_identity(),inputs=inputs())) lease_hash=sha256((out/'lease.json').read_bytes()).hexdigest() diff --git a/scripts/run_ge_beam3_g3c_rehearsal.py b/scripts/run_ge_beam3_g3c_rehearsal.py index ed0efa586..b3d532698 100644 --- a/scripts/run_ge_beam3_g3c_rehearsal.py +++ b/scripts/run_ge_beam3_g3c_rehearsal.py @@ -259,7 +259,7 @@ def worker(out,expected): origin=None if assignment['kind']=='history' else origin_packet(assignment,collected) print('G3C CHECKPOINT rehearsal authority',flush=True) sys.path[:0]=[str(ROOT/'src'),str(ROOT),str(inherited.infrastructure.CAPSULE.parent/'site')] - from anysolver._ge_beam3_g3c_stable import authority as runtime + from anyfesolver._ge_beam3_g3c_stable import authority as runtime runtime.capture(raw) import pytest class Context: @@ -374,7 +374,7 @@ def main(): previous=dict(path=str(args.previous_wave.absolute()),**packets.fingerprint(raw)) elif args.previous_sha256 is not None: raise ValueError('predecessor path missing') prior_chain(previous,args.wave,candidate,inputs,args.review_sha256,deadline) - out=Path(tempfile.mkdtemp(prefix='anysolver-g3c-rehearsal-')) + out=Path(tempfile.mkdtemp(prefix='anyfesolver-g3c-rehearsal-')) print('DIAGNOSTICS '+str(out),flush=True) lease=dict(kind='G3C_STABLE_PRIVATE_DEVELOPMENT',scope_id=SCOPE,candidate=candidate,inputs=inputs, source_map_sha256=inherited.MAP_SHA,review_sha256=args.review_sha256, diff --git a/scripts/run_ge_beam3_g3c_rehearsal_consumer.py b/scripts/run_ge_beam3_g3c_rehearsal_consumer.py index f4a060e0a..8ffe60176 100644 --- a/scripts/run_ge_beam3_g3c_rehearsal_consumer.py +++ b/scripts/run_ge_beam3_g3c_rehearsal_consumer.py @@ -233,7 +233,7 @@ def worker(out,expected): origin=None if assignment['kind']=='history' else origin_packet(assignment,collected) print('G3C CHECKPOINT rehearsal authority',flush=True) sys.path[:0]=[str(ROOT/'src'),str(ROOT),str(inherited.infrastructure.CAPSULE.parent/'site')] - from anysolver._ge_beam3_g3c_stable import authority as runtime + from anyfesolver._ge_beam3_g3c_stable import authority as runtime runtime.capture(raw) import pytest class Context: @@ -348,7 +348,7 @@ def main(): previous=dict(path=str(args.previous_wave.absolute()),**packets.fingerprint(raw)) elif args.previous_sha256 is not None: raise ValueError('predecessor path missing') prior_chain(previous,args.wave,candidate,inputs,args.review_sha256,deadline) - out=Path(tempfile.mkdtemp(prefix='anysolver-g3c-consumer-')) + out=Path(tempfile.mkdtemp(prefix='anyfesolver-g3c-consumer-')) print('DIAGNOSTICS '+str(out),flush=True) lease=dict(kind='G3C_STABLE_PRIVATE_DEVELOPMENT',scope_id=SCOPE,candidate=candidate,inputs=inputs, source_map_sha256=inherited.MAP_SHA,review_sha256=args.review_sha256, diff --git a/scripts/run_ge_beam3_g3c_so3_numerics.py b/scripts/run_ge_beam3_g3c_so3_numerics.py index aa3837655..b651dba90 100644 --- a/scripts/run_ge_beam3_g3c_so3_numerics.py +++ b/scripts/run_ge_beam3_g3c_so3_numerics.py @@ -117,7 +117,7 @@ def main(): if not(sys.flags.isolated and sys.flags.no_site and sys.dont_write_bytecode): raise ValueError('launch with -I -S -B') authority() - out=Path(tempfile.mkdtemp(prefix='anysolver-g3c-so3-kernel-')) + out=Path(tempfile.mkdtemp(prefix='anyfesolver-g3c-so3-kernel-')) print('DIAGNOSTICS '+str(out),flush=True) write(out/'lease.json',dict(kind='PRIVATE_KERNEL_DEVELOPMENT_NOT_GRAPH_QUALIFICATION',lane=lane,inventory=INVENTORIES[lane],candidate=clean_identity(),inputs=inputs())) lease_hash=sha256((out/'lease.json').read_bytes()).hexdigest() diff --git a/scripts/run_ge_beam3_g3c_stable.py b/scripts/run_ge_beam3_g3c_stable.py index a1053230a..dd2ca01c4 100644 --- a/scripts/run_ge_beam3_g3c_stable.py +++ b/scripts/run_ge_beam3_g3c_stable.py @@ -34,8 +34,8 @@ } EXPECTED_NODES = {'guard': 10, 'diagnostic': 1, 'bridge': 18} EXTRA = [ - 'src/anysolver/_ge_beam3_g3c_stable/__init__.py', - 'src/anysolver/_ge_beam3_g3c_stable/authority.py', + 'src/anyfesolver/_ge_beam3_g3c_stable/__init__.py', + 'src/anyfesolver/_ge_beam3_g3c_stable/authority.py', 'scripts/run_ge_beam3_g3c_stable.py', 'tests/test_ge_beam3_g3c_stable_implementation.py', GUARD, 'docs/GE_BEAM3_G3C_STABLE_IMPLEMENTATION.md', @@ -126,7 +126,7 @@ def worker(out, expected): raise ValueError('unregistered lane') # Full candidate and environment were verified before any numerical import. sys.path[:0] = [str(ROOT/'src'), str(ROOT), str(infrastructure.CAPSULE.parent/'site')] - from anysolver._ge_beam3_g3c_stable import authority as runtime + from anyfesolver._ge_beam3_g3c_stable import authority as runtime runtime.capture(raw) import pytest inventory = Inventory(EXPECTED_NODES[lane]) @@ -177,7 +177,7 @@ def main(): if os.name != 'nt' or not (sys.flags.isolated and sys.flags.no_site and sys.dont_write_bytecode): raise ValueError('Windows -I -S -B runner required') candidate, frozen, review = authority(args.review, args.review_sha256) - out = Path(tempfile.mkdtemp(prefix='anysolver-g3c-stable-')) + out = Path(tempfile.mkdtemp(prefix='anyfesolver-g3c-stable-')) print('DIAGNOSTICS '+str(out), flush=True) with (out/'review.json').open('xb') as stream: stream.write(review) diff --git a/scripts/run_ge_beam3_g5_package.py b/scripts/run_ge_beam3_g5_package.py index d74a0599a..3301c7af1 100644 --- a/scripts/run_ge_beam3_g5_package.py +++ b/scripts/run_ge_beam3_g5_package.py @@ -81,16 +81,16 @@ def probe(target, output): if value and not Path(value).resolve().is_relative_to(root) ]] import numpy as np - import anysolver - from anysolver.beam_sections import GeneralizedBeamSection - from anysolver.elements import BeamElement, QuadraticBeamElement, create_element - from anysolver.ge_beam3_element import GeometricallyExactBeam3D3NElement + import anyfesolver + from anyfesolver.beam_sections import GeneralizedBeamSection + from anyfesolver.elements import BeamElement, QuadraticBeamElement, create_element + from anyfesolver.ge_beam3_element import GeometricallyExactBeam3D3NElement - package = Path(anysolver.__file__).resolve() + package = Path(anyfesolver.__file__).resolve() module = Path(sys.modules[GeometricallyExactBeam3D3NElement.__module__].__file__).resolve() if not package.is_relative_to(target) or not module.is_relative_to(target): raise RuntimeError("installed package origin escaped target") - model = anysolver.FEModel("g5-installed") + model = anyfesolver.FEModel("g5-installed") model.add_material("mat", 2.1e5, .3, density=2.) for node, x in ((1, 0.), (2, 1.), (3, 2.)): model.add_node(node, x, 0., 0.) @@ -100,16 +100,16 @@ def probe(target, output): element = create_element("ge-beam3", 1, [1, 2, 3], "mat", section=section, reference_orientation=(0., 1., 0.), reference_axis_direction=(1., 0., 0.)) model.add_element(1, element) - model.add_boundary_condition(anysolver.FixedSupport("fixed", [1])) - model.add_boundary_condition(anysolver.BoundaryCondition("axial", [2, 3], + model.add_boundary_condition(anyfesolver.FixedSupport("fixed", [1])) + model.add_boundary_condition(anyfesolver.BoundaryCondition("axial", [2, 3], {name: 0. for name in ("uy", "uz", "rx", "ry", "rz")})) - stiffness, _ = anysolver.assemble_stiffness_matrix(model) - mass, _ = anysolver.assemble_mass_matrix(model) - load = anysolver.LoadCase("installed") + stiffness, _ = anyfesolver.assemble_stiffness_matrix(model) + mass, _ = anyfesolver.assemble_mass_matrix(model) + load = anyfesolver.LoadCase("installed") load.add_nodal_load(3, forces=(1., 0., 0.)) - modal = anysolver.solve_free_vibration(model, num_modes=1) - transient = anysolver.solve_transient_newmark(model, - anysolver.TransientConfig(dt=2.e-4, t_end=6.e-4), base_load_case=load) + modal = anyfesolver.solve_free_vibration(model, num_modes=1) + transient = anyfesolver.solve_transient_newmark(model, + anyfesolver.TransientConfig(dt=2.e-4, t_end=6.e-4), base_load_case=load) if (type(element) is not GeometricallyExactBeam3D3NElement or element.formulation_id != "GE_BEAM3_DC_MIXED_K1_MACRO_V2" or type(create_element("beam", 2, [1, 3], "mat")) is not BeamElement diff --git a/scripts/run_ge_beam3_g6_confirmation.py b/scripts/run_ge_beam3_g6_confirmation.py index 1fe3179f0..25a5e467c 100644 --- a/scripts/run_ge_beam3_g6_confirmation.py +++ b/scripts/run_ge_beam3_g6_confirmation.py @@ -79,7 +79,7 @@ def pytest_runtest_logreport(self, report): or code or recorder.bad or recorder.passed != recorder.collected): raise RuntimeError("G6 scientific inventory failed") records=recorder.module.SCIENTIFIC_RECORDS - from anysolver._ge_beam3_g6_domain import PARITY_DISPOSITIONS, adjudicate + from anyfesolver._ge_beam3_g6_domain import PARITY_DISPOSITIONS, adjudicate result=adjudicate(records, parity_rows=dict(PARITY_DISPOSITIONS), installed_artifact=receipt["installed_artifact"]) science={"schema":"GE_BEAM3_G6_CONFIRMATION_V1", "candidate_commit":revision, diff --git a/scripts/run_ge_beam3_g6_package.py b/scripts/run_ge_beam3_g6_package.py index f0cc93f72..ae3ed912d 100644 --- a/scripts/run_ge_beam3_g6_package.py +++ b/scripts/run_ge_beam3_g6_package.py @@ -73,12 +73,12 @@ def _installed(target): def probe(target, output): target = _installed(target) import numpy as np - import anysolver - from anysolver.beam_sections import GeneralizedBeamSection - from anysolver.elements import BeamElement, QuadraticBeamElement, create_element - from anysolver.ge_beam3_element import GeometricallyExactBeam3D3NElement - from anysolver.ge_beam3_native import ConsumerPolicy - if not Path(anysolver.__file__).resolve().is_relative_to(target): + import anyfesolver + from anyfesolver.beam_sections import GeneralizedBeamSection + from anyfesolver.elements import BeamElement, QuadraticBeamElement, create_element + from anyfesolver.ge_beam3_element import GeometricallyExactBeam3D3NElement + from anyfesolver.ge_beam3_native import ConsumerPolicy + if not Path(anyfesolver.__file__).resolve().is_relative_to(target): raise RuntimeError("installed package origin escaped target") section = GeneralizedBeamSection(np.diag((12., 10., 9., 4., 5., 6.)), mass_matrix=np.diag((2., 2., 2., .1, .2, .3)), name="G6_INSTALLED") diff --git a/scripts/run_ge_beam3_qualification.py b/scripts/run_ge_beam3_qualification.py index c5f45a265..2c8a1d12a 100644 --- a/scripts/run_ge_beam3_qualification.py +++ b/scripts/run_ge_beam3_qualification.py @@ -60,7 +60,7 @@ *(G4A_TESTS[1]+'['+str(index)+']' for index in range(3)), *(G4A_TESTS[2]+'['+str(index)+']' for index in range(3)),*G4A_TESTS[3:]) G4A_IMPLEMENTATION_PATHS={ - 'src/anysolver/_ge_beam3_g4a_station_transaction.py', + 'src/anyfesolver/_ge_beam3_g4a_station_transaction.py', 'docs/reference_cases/ge_beam3_g4a_station_transaction_checker.py', 'tests/test_ge_beam3_g4a_station_transaction.py', 'scripts/run_ge_beam3_qualification.py','tests/test_ge_beam3_qualification_runner.py'} @@ -84,7 +84,7 @@ *(G4_TESTS[2]+'['+name+']' for name in ('duplicate','nonfinite','external_hash','cross_family')), *(G4_TESTS[3]+'['+name+']' for name in ('trial','prepare','before_publication')), *G4_TESTS[4:]) -G4_IMPLEMENTATION_PATHS={'src/anysolver/_ge_beam3_g4_completion.py', +G4_IMPLEMENTATION_PATHS={'src/anyfesolver/_ge_beam3_g4_completion.py', 'tests/test_ge_beam3_g4_completion.py','scripts/run_ge_beam3_qualification.py', 'tests/test_ge_beam3_qualification_runner.py'} G5_BASE='0373b8bc0a7c5bbfc4c991cd62d59d718734e24c' @@ -98,8 +98,8 @@ 'test_explicit_native_static_restart_recovery_and_provenance', 'test_unsupported_routes_fail_closed_before_state_mutation', 'test_selector_and_provenance_boundary_remains_additive') -G5_IMPLEMENTATION_PATHS={'src/anysolver/_ge_beam3_g5_completion.py', - 'src/anysolver/ge_beam3_element.py','tests/test_ge_beam3_g5_completion.py', +G5_IMPLEMENTATION_PATHS={'src/anyfesolver/_ge_beam3_g5_completion.py', + 'src/anyfesolver/ge_beam3_element.py','tests/test_ge_beam3_g5_completion.py', 'scripts/run_ge_beam3_g5_package.py','tests/test_ge_beam3_g5_package_gate.py', 'tests/test_ge_beam3_mixed_p3_optin.py', 'scripts/run_ge_beam3_qualification.py','tests/test_ge_beam3_qualification_runner.py'} @@ -192,8 +192,8 @@ PHYSICAL_PROOF_COMPRESSED_SUCCESSOR_REVIEW_SHA='ad2196bdde31b9f8c3519dcd883ca54097fd26b9d1fbac6bba9fc5fe5554b2a2' PHYSICAL_IMPLEMENTATION_PATHS={PHYSICAL_PLAN,PHYSICAL_DESIGN_REVIEW, PHYSICAL_PARTITION_ADDENDUM,PHYSICAL_PARTITION_REVIEW, - 'src/anysolver/_ge_beam3_g3c_physical_owner.py', - 'src/anysolver/_ge_beam3_g3c_physical_authority.py', + 'src/anyfesolver/_ge_beam3_g3c_physical_owner.py', + 'src/anyfesolver/_ge_beam3_g3c_physical_authority.py', 'scripts/ge_beam3_g3c_physical_history_owner.py', 'scripts/ge_beam3_g3c_physical_restart_preflight.py', PHYSICAL_OWNER_TEST,PHYSICAL_HISTORY_TEST, @@ -264,14 +264,14 @@ CHART_REVIEW='docs/reference_cases/ge_beam3_q4_affine_stable_chart_design_review_v1.json' CHART_REVIEW_SHA='ca6de27e79186c9e0b37bf21e765322aa8e46dc323eb858db039951fec7efeab' CHART_SOURCES={ - 'src/anysolver/_ge_beam3_g3c_affine_q4_chart.py':'2a26742ec7680a5e75934fb32ee8601d3877cd0befb250489f991f1b9d198a9f', + 'src/anyfesolver/_ge_beam3_g3c_affine_q4_chart.py':'2a26742ec7680a5e75934fb32ee8601d3877cd0befb250489f991f1b9d198a9f', 'docs/reference_cases/ge_beam3_q4_affine_numerical_chart.py':'b7cc92f70d35e3b8f2ab10202cb2f3ad1116e92775425888e482293b323c23ac', - 'src/anysolver/_ge_beam3_g3c_so3_numerics.py':'588ace39570658f1a83c0110d3a019ebad770d6091b271ff4bbc40b97f96e12e', + 'src/anyfesolver/_ge_beam3_g3c_so3_numerics.py':'588ace39570658f1a83c0110d3a019ebad770d6091b271ff4bbc40b97f96e12e', 'docs/GE_BEAM3_G3C_SO3_NUMERICS_CONTRACT.md':'269bcd4e1fda151e7c22c396a70c43498e8450b222c263dd2655b9ca45998496', 'docs/reference_cases/ge_beam3_g3c_so3_numerics_implementation_review_v1.json':'4debde89b44c990478487dda4852d7734b852ca01dfb2d3626e782c2328756f1', 'docs/reference_cases/ge_beam3_g3c_so3_numerics_confirmation_receipt_v1.json':'aa7225cae347662bf92b3c02f8a1ff541d40e67f13db21900d0ad3269f88b91f', 'docs/reference_cases/ge_beam3_g3c_so3_numerics_result_v1.json':'c8b938bbdbcce329aa83afc00037905d158142d7d2e417acee159bab95aba6fd', - 'src/anysolver/_ge_beam3_g3c_affine_q4_registry.py':'5f208b716d89ba778193d1261fb5975db4ece68c93fa2efce97e5c129c56acf1'} + 'src/anyfesolver/_ge_beam3_g3c_affine_q4_registry.py':'5f208b716d89ba778193d1261fb5975db4ece68c93fa2efce97e5c129c56acf1'} NUMERICAL_TESTS=['test_affine_recovery_'+suffix for suffix in ( 'definition_and_source_identity','zero_and_station_constitutive','independent_material_fields', '64_stationarity_and_schur','actual_chart_work_hessian','directional_derivatives_all_steps', @@ -314,14 +314,14 @@ 'eigen_first_derivative','eigen_second_derivative'], 'eigen_derivatives':['SQUARE::1::amplitude=1e-06']}] NUMERICAL_SOURCE_HASHES={ - 'src/anysolver/e4_pl_element.py':'7fc46a18046e043512a5fb2c3f61ed0b95b834e4dde764f63c500a885e87ea38', - 'src/anysolver/elements.py':'f8c59792947a3c9b84416c61a4d9db98e42926d1bf21e74e736afbf6a9a88b37', - 'src/anysolver/_ge_beam3_g3c_local_shell.py':'69d9f27a96ed7e9a5959a42a081eeafbbe72021de6e4da1f91355c5fb3850f10', - 'src/anysolver/_ge_beam3_variational_shell.py':'b0db7a83633f4a835c06e940a6f0de36ab958f7e816c37a23c6ebc16259a2a60', - 'src/anysolver/_ge_beam3_mixed_ad.py':'b299ff765cd2eaae8b33a2ba1d05069f6fe8c39209e1eac75df356a2afb1fe36', - 'src/anysolver/_ge_beam3_pose_joint.py':'69cfb0a71761ab7cad0d62080d81511949e7c920f7f70162bcaba0497b402657', - 'src/anysolver/_ge_beam3_g3c_definition.py':'4b46b870fec010e3378df83c374d763f858d8f25820c14f9704dc6f0a656f0c2', - 'src/anysolver/_ge_beam3_g3c_owner.py':'18b9565d56192e23f192b1a3fbae3cb12ed7ede958c0e4b3e46279a799d1afc5', + 'src/anyfesolver/e4_pl_element.py':'7fc46a18046e043512a5fb2c3f61ed0b95b834e4dde764f63c500a885e87ea38', + 'src/anyfesolver/elements.py':'f8c59792947a3c9b84416c61a4d9db98e42926d1bf21e74e736afbf6a9a88b37', + 'src/anyfesolver/_ge_beam3_g3c_local_shell.py':'69d9f27a96ed7e9a5959a42a081eeafbbe72021de6e4da1f91355c5fb3850f10', + 'src/anyfesolver/_ge_beam3_variational_shell.py':'b0db7a83633f4a835c06e940a6f0de36ab958f7e816c37a23c6ebc16259a2a60', + 'src/anyfesolver/_ge_beam3_mixed_ad.py':'b299ff765cd2eaae8b33a2ba1d05069f6fe8c39209e1eac75df356a2afb1fe36', + 'src/anyfesolver/_ge_beam3_pose_joint.py':'69cfb0a71761ab7cad0d62080d81511949e7c920f7f70162bcaba0497b402657', + 'src/anyfesolver/_ge_beam3_g3c_definition.py':'4b46b870fec010e3378df83c374d763f858d8f25820c14f9704dc6f0a656f0c2', + 'src/anyfesolver/_ge_beam3_g3c_owner.py':'18b9565d56192e23f192b1a3fbae3cb12ed7ede958c0e4b3e46279a799d1afc5', 'docs/reference_cases/ge_beam3_g3c_fixtures_v1.json':'d5fecc80c3203ac7d191b4031d64bf35c56d2900066cb01fc1dfa4276d24c006'} PHYSICAL_TABLES=frozenset(('work','common_motion','d4','director','passive','rebase','graph','tiny','smoke')) PHYSICAL_SHAPES={'physical_energy':[],'physical_force':[24],'physical_hessian':[24,24], @@ -343,11 +343,11 @@ ALLOWED={ 'scripts/run_ge_beam3_qualification.py','tests/test_ge_beam3_qualification_runner.py', 'docs/GE_BEAM3_QUALIFICATION_COMPLETION_REGISTER.md', - 'src/anysolver/_ge_beam3_g3c_affine_q4_recovery.py', - 'src/anysolver/_ge_beam3_g3c_affine_q4_chart.py',CHART_ADDENDUM,CHART_REVIEW, - 'src/anysolver/_ge_beam3_g3c_affine_q4_increment_chart.py',INCREMENT_ADDENDUM,INCREMENT_REVIEW, + 'src/anyfesolver/_ge_beam3_g3c_affine_q4_recovery.py', + 'src/anyfesolver/_ge_beam3_g3c_affine_q4_chart.py',CHART_ADDENDUM,CHART_REVIEW, + 'src/anyfesolver/_ge_beam3_g3c_affine_q4_increment_chart.py',INCREMENT_ADDENDUM,INCREMENT_REVIEW, 'docs/reference_cases/ge_beam3_q4_affine_increment_chart.py', - 'src/anysolver/_ge_beam3_g3c_affine_q4_registry.py', + 'src/anyfesolver/_ge_beam3_g3c_affine_q4_registry.py', 'docs/reference_cases/ge_beam3_q4_affine_numerical_checker.py', 'docs/reference_cases/ge_beam3_q4_affine_numerical_chart.py', 'docs/GE_BEAM3_Q4_AFFINE_RECOVERY_EXTENSION_LEMMA.md', @@ -419,7 +419,7 @@ def inputs(): 'MO18':'SHARED_RUNNER_TWO_FULL_CYCLE_AND_INDEPENDENT_REVIEW'} def physical_support(): - """Inert inventory module only; it imports no anysolver or numerical package.""" + """Inert inventory module only; it imports no anyfesolver or numerical package.""" import ge_beam3_g3c_physical_history_owner as support return support @@ -857,7 +857,7 @@ def execute_physical_formal_measurement(args,watchdog,expected): partition=physical_formal_measurement_partition();runtime=physical_support().runtime_identity() common_value=physical_formal_common_manifest(expected[0],expected[1],environment.strict(expected[2]), runtime,partition,cycle=0) - root=Path(tempfile.mkdtemp(prefix='anysolver-g3c-physical-formal-measurement-')) + root=Path(tempfile.mkdtemp(prefix='anyfesolver-g3c-physical-formal-measurement-')) print('DIAGNOSTICS '+str(root),flush=True) common_path=root/'common.json';write(common_path,common_value) common=physical_validate_formal_common(environment.strict(read(common_path))) @@ -973,7 +973,7 @@ def execute_physical_proof_compressed(args,watchdog,expected): runtime=physical_support().runtime_identity() common_value=physical_formal_common_manifest(expected[0],expected[1],environment.strict(expected[2]), runtime,partition,cycle=args.proof_cycle) - root=Path(tempfile.mkdtemp(prefix=f'anysolver-g3c-proof-compressed-cycle{args.proof_cycle}-')) + root=Path(tempfile.mkdtemp(prefix=f'anyfesolver-g3c-proof-compressed-cycle{args.proof_cycle}-')) print('DIAGNOSTICS '+str(root),flush=True);common_path=root/'common.json';write(common_path,common_value) common=physical_validate_formal_common(environment.strict(read(common_path))) specs=common['partition']['body']['shards'];results={};passed=True;failure=None @@ -1208,7 +1208,7 @@ def physical_formal_worker(out,lease_sha): if any(os.environ.get(key)!='1' for key in THREADS):raise ValueError('formal numerical thread environment') print('BEAM CHECKPOINT formal authority complete',flush=True) sys.path[:0]=[str(ROOT/'src'),str(ROOT),str(CAPSULE.parent/'site')] - from anysolver import _ge_beam3_g3c_physical_authority as runtime_authority + from anyfesolver import _ge_beam3_g3c_physical_authority as runtime_authority runtime_authority.capture(canonical(common)) import pytest node=PHYSICAL_FORMAL_TEST+'::test_physical_formal_shard_assignment' @@ -1937,7 +1937,7 @@ def physical_authority_probe(lease): elif probe['category']=='R10_NORMAL_SOURCE' and probe['member'] in ('mocked_normal_authority_read','mocked_source_hash'): rows=json.loads(json.dumps(lease['inputs'])) target=('docs/reference_cases/ge_beam3_g3c_fixtures_v1.json' if probe['member']=='mocked_normal_authority_read' - else 'src/anysolver/_ge_beam3_g3c_definition.py') + else 'src/anyfesolver/_ge_beam3_g3c_definition.py') before=rows[target]['sha256'];rows[target]['sha256']='0'*64 if before!='0'*64 else '1'*64 try:verify_review(review,original_review_sha,lease['candidate'],rows,'g3c-physical') except ValueError as exc:error=str(exc) @@ -1964,7 +1964,7 @@ def physical_worker(out,lease_sha): records=physical_authority_probe(lease);passed=[] else: sys.path[:0]=[str(ROOT/'src'),str(ROOT),str(CAPSULE.parent/'site')] - from anysolver import _ge_beam3_g3c_physical_authority as runtime_authority + from anyfesolver import _ge_beam3_g3c_physical_authority as runtime_authority runtime_authority.capture(raw) if correction: import ge_beam3_g3c_correction_lease_binding as correction_binding @@ -2774,7 +2774,7 @@ def execute_physical_partition(args,watchdog,expected): physical_verify_partition_priors(prior_paths,expected,args.partition_id) inventory_rows=physical_inventory('rehearsal');_,spec=physical_partition_spec(args.partition_id,inventory_rows) indices=spec['indices'];runtime=physical_support().runtime_identity() - root=Path(tempfile.mkdtemp(prefix='anysolver-g3c-physical-partition-'));print('DIAGNOSTICS '+str(root),flush=True) + root=Path(tempfile.mkdtemp(prefix='anyfesolver-g3c-physical-partition-'));print('DIAGNOSTICS '+str(root),flush=True) base=dict(lane='rehearsal',candidate=expected[0],inputs=expected[1],review_sha256=args.review_sha256, implementation_review=environment.strict(expected[2]),runtime_sha256=runtime,inventory=inventory_rows) outputs={} if args.partition_id=='R-HISTORY' else physical_history_outputs_from_partition(prior_paths[2]) @@ -2902,7 +2902,7 @@ def execute_physical_union(args,watchdog,expected): for partition_id,path in zip(PHYSICAL_PARTITION_IDS,paths[2:]): partition_values.append(physical_validate_partition(path,expected,partition_id)[0]) if authority(args.review,args.review_sha256,'g3c-physical')!=expected:raise ValueError('physical union final authority') - root=Path(tempfile.mkdtemp(prefix='anysolver-g3c-physical-union-'));print('DIAGNOSTICS '+str(root),flush=True) + root=Path(tempfile.mkdtemp(prefix='anyfesolver-g3c-physical-union-'));print('DIAGNOSTICS '+str(root),flush=True) process=dict(schema='GE_BEAM3_G3C_PHYSICAL_UNION_PROCESS_V1',lane='rehearsal', partition_manifest_sha256=PHYSICAL_PARTITION_MANIFEST_SHA,passed=True,required_partitions=6, terminal_partitions=6,elapsed_seconds=time.monotonic()-started,active_processes=0) @@ -3043,7 +3043,7 @@ def execute_physical_correction_guards(args,watchdog,expected): incident=physical_failed_guards(args.failed_guards_process,predecessor) compatibility=physical_runtime_compatibility(expected,predecessor) inventory_rows=physical_inventory('rehearsal');indices=list(range(90,234));runtime=physical_support().runtime_identity() - root=Path(tempfile.mkdtemp(prefix='anysolver-g3c-physical-correction-guards-'));print('DIAGNOSTICS '+str(root),flush=True) + root=Path(tempfile.mkdtemp(prefix='anyfesolver-g3c-physical-correction-guards-'));print('DIAGNOSTICS '+str(root),flush=True) base=dict(lane='rehearsal',candidate=expected[0],inputs=expected[1],review_sha256=args.review_sha256, implementation_review=environment.strict(expected[2]),runtime_sha256=runtime,inventory=inventory_rows, runtime_compatibility=compatibility) @@ -3236,7 +3236,7 @@ def execute_physical_correction_guard_segment(args,watchdog,expected): physical_validate_correction_guard_segment(prior_path,expected,prior_paths[:7+prior_ordinal],prior_id, args.failed_guards_process,args.interrupted_guards_root,memo=memo) inventory_rows=physical_inventory('rehearsal') - root=Path(tempfile.mkdtemp(prefix='anysolver-g3c-physical-correction-'+segment_id.lower()+'-'));print('DIAGNOSTICS '+str(root),flush=True) + root=Path(tempfile.mkdtemp(prefix='anyfesolver-g3c-physical-correction-'+segment_id.lower()+'-'));print('DIAGNOSTICS '+str(root),flush=True) base=dict(lane='rehearsal',candidate=expected[0],inputs=expected[1],review_sha256=args.review_sha256, implementation_review=environment.strict(expected[2]),runtime_sha256=physical_support().runtime_identity(), inventory=inventory_rows,runtime_compatibility=compatibility,guard_segment_id=segment_id, @@ -3350,7 +3350,7 @@ def execute_physical_correction_guard_union(args,watchdog,expected): records=[row for segment in segments for row in segment['records']] if [row.get('assignment_index') for row in records]!=list(range(90,234)): raise ValueError('correction guard union exact ordering') - root=Path(tempfile.mkdtemp(prefix='anysolver-g3c-physical-correction-guards-union-'));print('DIAGNOSTICS '+str(root),flush=True) + root=Path(tempfile.mkdtemp(prefix='anyfesolver-g3c-physical-correction-guards-union-'));print('DIAGNOSTICS '+str(root),flush=True) stage=root/'staged';stage.mkdir() process=dict(schema='GE_BEAM3_G3C_PHYSICAL_CORRECTION_GUARDS_PROCESS_V2',lane='rehearsal',partition_id='R-GUARDS', guard_segment_manifest_sha256=PHYSICAL_CORRECTION_GUARD_SEGMENT_MANIFEST_SHA,passed=True, @@ -3460,7 +3460,7 @@ def execute_physical_correction_union(args,watchdog,expected): if (any(type(row)is not dict or type(row.get('assignment_index'))is not int for row in records) or [row.get('assignment_index') for row in records]!=list(range(234))): raise ValueError('correction union exact ordering') - root=Path(tempfile.mkdtemp(prefix='anysolver-g3c-physical-correction-union-'));print('DIAGNOSTICS '+str(root),flush=True) + root=Path(tempfile.mkdtemp(prefix='anyfesolver-g3c-physical-correction-union-'));print('DIAGNOSTICS '+str(root),flush=True) stage=root/'staged';stage.mkdir() process=dict(schema='GE_BEAM3_G3C_PHYSICAL_CORRECTION_UNION_PROCESS_V1',lane='rehearsal',passed=True, required_partitions=6,terminal_partitions=6,elapsed_seconds=time.monotonic()-started,active_processes=0) @@ -3530,7 +3530,7 @@ def execute_physical(args,watchdog): raise ValueError('physical partition mode is rehearsal-only') verify_physical_priors(args.prior or [],expected,args.lane) inventory_rows=physical_inventory(args.lane);runtime=physical_support().runtime_identity() - root=Path(tempfile.mkdtemp(prefix='anysolver-g3c-physical-'));print('DIAGNOSTICS '+str(root),flush=True) + root=Path(tempfile.mkdtemp(prefix='anyfesolver-g3c-physical-'));print('DIAGNOSTICS '+str(root),flush=True) base=dict(lane=args.lane,candidate=expected[0],inputs=expected[1],review_sha256=args.review_sha256, implementation_review=environment.strict(expected[2]),runtime_sha256=runtime,inventory=inventory_rows) history=[i for i,a in enumerate(inventory_rows)if a['kind'] in ('owner-static','owner','history')] @@ -3747,7 +3747,7 @@ def validate_numerical_result(raw,completion,lease,index,assignment_sha,observat def registered_observation_state(table,row_id): """Fixture data only. Never construct a facade or evaluate any operator.""" - from anysolver import _ge_beam3_g3c_affine_q4_registry as registry + from anyfesolver import _ge_beam3_g3c_affine_q4_registry as registry c=registry.construction(row_construction(table,row_id)) pose=row_id.rsplit('::',1)[1] if table in ('work','graph','smoke') else 'MIXED' amplitude=float(row_id.split('::amplitude=')[1]) if table=='tiny' else 1. @@ -3771,8 +3771,8 @@ def observation_specs(): def fixture_source_bindings(): - """Whole importable ANYsolver Python graph plus frozen fixture/environment.""" - paths={p.relative_to(ROOT).as_posix() for p in (ROOT/'src/anysolver').rglob('*.py')} + """Whole importable ANYfeSolver Python graph plus frozen fixture/environment.""" + paths={p.relative_to(ROOT).as_posix() for p in (ROOT/'src/anyfesolver').rglob('*.py')} paths.update(('docs/reference_cases/ge_beam3_g3c_fixtures_v1.json', 'scripts/ge_beam3_g3b_environment.py',JOB)) return {path:fingerprint(read(ROOT/path).replace(b'\r\n',b'\n')) for path in sorted(paths)} @@ -4175,7 +4175,7 @@ def drain(entry=e): def execute_numerical(args,watchdog): observations={} expected=authority(args.review,args.review_sha256,args.gate,observation_capture=observations);watchdog.check() - out=Path(tempfile.mkdtemp(prefix='anysolver-beam-qualification-')) + out=Path(tempfile.mkdtemp(prefix='anyfesolver-beam-qualification-')) print('DIAGNOSTICS '+str(out),flush=True) lease=dict(schema=SCOPE,run_id=str(uuid.uuid4()),gate=args.gate,lane=args.lane,candidate=expected[0], inputs=expected[1],review_sha256=args.review_sha256,selected=inventory(args.lane,args.gate), @@ -4243,7 +4243,7 @@ def execute_guarded(args,watchdog): wave_start=time.monotonic() expected=authority(args.review,args.review_sha256,args.gate) watchdog.check() - out=Path(tempfile.mkdtemp(prefix='anysolver-beam-qualification-')) + out=Path(tempfile.mkdtemp(prefix='anyfesolver-beam-qualification-')) print('DIAGNOSTICS '+str(out),flush=True) lease=dict(schema=SCOPE,run_id=str(uuid.uuid4()),gate=args.gate,lane=args.lane, candidate=expected[0],inputs=expected[1],review_sha256=args.review_sha256,selected=inventory(args.lane,args.gate)) diff --git a/scripts/run_general_contact_c1_patch_candidate.py b/scripts/run_general_contact_c1_patch_candidate.py index 15c5b0471..95b062294 100644 --- a/scripts/run_general_contact_c1_patch_candidate.py +++ b/scripts/run_general_contact_c1_patch_candidate.py @@ -13,12 +13,12 @@ import numpy as np import scipy -from anysolver import ( +from anyfesolver import ( ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, create_shell_element, validate_general_contact, ) -from anysolver.fe_core import FEModel -from anysolver.general_contact.patch_sliding import _RestrictedSlidingPatchFEManager +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.patch_sliding import _RestrictedSlidingPatchFEManager CONTRACT = Path(__file__).resolve().parents[1] / "docs" / "reference_cases" / "general_contact_c1_patch_candidate_v0.json" diff --git a/scripts/run_internal_shell_benchmark.py b/scripts/run_internal_shell_benchmark.py index d55c55315..c702d0277 100644 --- a/scripts/run_internal_shell_benchmark.py +++ b/scripts/run_internal_shell_benchmark.py @@ -12,7 +12,7 @@ if str(SRC) not in sys.path: sys.path.insert(0, str(SRC)) -from anysolver import run_simple_supported_shell_convergence, write_internal_shell_convergence_table +from anyfesolver import run_simple_supported_shell_convergence, write_internal_shell_convergence_table def _parse_divisions(value: str) -> Sequence[int]: diff --git a/scripts/run_mass_modal_validity.py b/scripts/run_mass_modal_validity.py index 02e5f0292..bacd07a97 100644 --- a/scripts/run_mass_modal_validity.py +++ b/scripts/run_mass_modal_validity.py @@ -13,7 +13,7 @@ if str(SRC) not in sys.path: sys.path.insert(0, str(SRC)) -from anysolver import ( # noqa: E402 +from anyfesolver import ( # noqa: E402 BoundaryCondition, FEModel, FixedSupport, @@ -22,7 +22,7 @@ generate_simple_panel_mesh, solve_free_vibration, ) -from anysolver.elements import BeamElement # noqa: E402 +from anyfesolver.elements import BeamElement # noqa: E402 DEFAULT_OUTPUT = Path("reports/mass_modal/mass_modal_validity_report.json") diff --git a/scripts/run_mesh_load_bc_verification.py b/scripts/run_mesh_load_bc_verification.py index e709cf11a..80d136db7 100644 --- a/scripts/run_mesh_load_bc_verification.py +++ b/scripts/run_mesh_load_bc_verification.py @@ -11,7 +11,7 @@ if str(SRC) not in sys.path: sys.path.insert(0, str(SRC)) -from anysolver.mesh_load_bc_verification import DEFAULT_MESH_LOAD_BC_VERIFICATION_PATH, write_mesh_load_bc_verification_report +from anyfesolver.mesh_load_bc_verification import DEFAULT_MESH_LOAD_BC_VERIFICATION_PATH, write_mesh_load_bc_verification_report def main() -> int: diff --git a/scripts/run_plasticity_qualification.py b/scripts/run_plasticity_qualification.py index 548d495aa..f76a23687 100644 --- a/scripts/run_plasticity_qualification.py +++ b/scripts/run_plasticity_qualification.py @@ -13,7 +13,7 @@ if str(SRC) not in sys.path: sys.path.insert(0, str(SRC)) -from anysolver.plasticity_qualification import ( # noqa: E402 +from anyfesolver.plasticity_qualification import ( # noqa: E402 DEFAULT_PLASTICITY_QUALIFICATION_PATH, write_plasticity_qualification_report, ) diff --git a/scripts/run_portable_ci.py b/scripts/run_portable_ci.py index 6d16384b8..c95736a29 100644 --- a/scripts/run_portable_ci.py +++ b/scripts/run_portable_ci.py @@ -557,7 +557,7 @@ def run( partitions = (tuple(modules),) if development else execution_partitions(modules, workers) temp_parent = Path(os.environ.get("RUNNER_TEMP", tempfile.gettempdir())).resolve() temp_parent.mkdir(parents=True, exist_ok=True) - run_root = Path(tempfile.mkdtemp(prefix="anysolver-portable-ci-", dir=temp_parent)) + run_root = Path(tempfile.mkdtemp(prefix="anyfesolver-portable-ci-", dir=temp_parent)) launched: list[subprocess.Popen[bytes]] = [] monitor = None peak_bytes = 0 @@ -591,7 +591,7 @@ def run( f"--basetemp={worker_root / 'basetemp'}", *modules_for_worker] environment.update(NUMBA_DISABLE_JIT="0" if jit == "on" else "1", ANYSOLVER_DEVELOPMENT_RECORD=str(worker_root / "runtime.json"), - ANYSOLVER_DEVELOPMENT_SOURCE=str(ROOT / "src" / "anysolver")) + ANYSOLVER_DEVELOPMENT_SOURCE=str(ROOT / "src" / "anyfesolver")) (worker_root / "selection.json").write_text(json.dumps({ "scope": "focused source development, not qualification", "targets": list(modules_for_worker), "command": command, diff --git a/scripts/run_recovery_policy.py b/scripts/run_recovery_policy.py index e01cac580..74a52b1c8 100644 --- a/scripts/run_recovery_policy.py +++ b/scripts/run_recovery_policy.py @@ -11,7 +11,7 @@ if str(SRC) not in sys.path: sys.path.insert(0, str(SRC)) -from anysolver.recovery_policy import DEFAULT_RECOVERY_POLICY_PATH, write_recovery_policy_report +from anyfesolver.recovery_policy import DEFAULT_RECOVERY_POLICY_PATH, write_recovery_policy_report def main() -> int: diff --git a/scripts/run_s4_improved_qualification.py b/scripts/run_s4_improved_qualification.py index 3cb8cd236..4ae8968ab 100644 --- a/scripts/run_s4_improved_qualification.py +++ b/scripts/run_s4_improved_qualification.py @@ -25,7 +25,7 @@ ROOT = Path(__file__).resolve().parents[1] SRC = ROOT / "src" REPORT_ROOT = ROOT / "reports" / "s4_improved" -SCHEMA_NAME = "anysolver.s4_improved.qualification" +SCHEMA_NAME = "anyfesolver.s4_improved.qualification" SCHEMA_VERSION = 1 PERF_LEASE_ENV = "ANYSOLVER_PERF_LEASE" @@ -659,12 +659,12 @@ def _activation_diagnostics() -> dict[str, Any]: "live_geometry_objects_allowed": False, } try: - jit = importlib.import_module("anysolver.jit_compiler") + jit = importlib.import_module("anyfesolver.jit_compiler") result["jit"] = jit.jit_diagnostics() except Exception as exc: # pragma: no cover - environment diagnostic result["jit"] = {"enabled": False, "disabled_reason": repr(exc)} for name in ("mitc4_plus_d_batch", "mitc4_plus_d_recovery"): - module_name = f"anysolver.shell_formulations.{name}" + module_name = f"anyfesolver.shell_formulations.{name}" try: module = importlib.import_module(module_name) diagnostics = getattr(module, "kernel_diagnostics", None) diff --git a/scripts/run_s4_validity.py b/scripts/run_s4_validity.py index b65b41c1d..c52c68c1d 100644 --- a/scripts/run_s4_validity.py +++ b/scripts/run_s4_validity.py @@ -12,7 +12,7 @@ if str(SRC) not in sys.path: sys.path.insert(0, str(SRC)) -from anysolver.s4_validity import DEFAULT_S4_VALIDITY_PATH, write_s4_validity_report +from anyfesolver.s4_validity import DEFAULT_S4_VALIDITY_PATH, write_s4_validity_report def _write_markdown(report: dict, path: Path) -> None: diff --git a/scripts/run_sestra_deep_diagnostics.py b/scripts/run_sestra_deep_diagnostics.py index 0a4e6d744..d214abd63 100644 --- a/scripts/run_sestra_deep_diagnostics.py +++ b/scripts/run_sestra_deep_diagnostics.py @@ -1,14 +1,14 @@ import argparse,json,sys from pathlib import Path sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'src')) -from anysolver.sestra_deep_diagnostics import prepare_stage1,prepare_stage2 +from anyfesolver.sestra_deep_diagnostics import prepare_stage1,prepare_stage2 def main(): p=argparse.ArgumentParser(description='Prepare fixed discriminating SESTRA development models; no external jobs.');p.add_argument('action',choices=['prepare','prepare-stage2','compare','probe']);p.add_argument('input');p.add_argument('--output',required=True);a=p.parse_args() if a.action=='prepare':result=prepare_stage1(a.input,a.output) elif a.action=='prepare-stage2':result=prepare_stage2(a.input,a.output) else: - from anysolver.sestra_deep_diagnostics import run_diagnostics + from anyfesolver.sestra_deep_diagnostics import run_diagnostics result=run_diagnostics(a.input,a.output,mode=a.action) print(json.dumps({'status':result.get('status','not_executed'),'output':a.output}));return 0 if result.get('status','not_executed') in {'passed','not_executed'} else 1 diff --git a/scripts/run_sestra_structure_benchmarks.py b/scripts/run_sestra_structure_benchmarks.py index 6a53fdc8c..e10c871ac 100644 --- a/scripts/run_sestra_structure_benchmarks.py +++ b/scripts/run_sestra_structure_benchmarks.py @@ -1,7 +1,7 @@ import argparse,json,sys from pathlib import Path sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'src')) -from anysolver.sestra_structure_benchmarks import prepare_suite,run_suite +from anyfesolver.sestra_structure_benchmarks import prepare_suite,run_suite def main(): p=argparse.ArgumentParser(description='Prepare/compare bounded combined-structure benchmarks; no external jobs.');p.add_argument('action',choices=['prepare','native','compare']);p.add_argument('input',nargs='?');p.add_argument('--output',required=True);a=p.parse_args() result=prepare_suite(a.output) if a.action=='prepare' else run_suite(a.input,a.output,a.action) diff --git a/scripts/run_sestra_three_cases.py b/scripts/run_sestra_three_cases.py index 6dd26869b..67101a972 100644 --- a/scripts/run_sestra_three_cases.py +++ b/scripts/run_sestra_three_cases.py @@ -2,13 +2,13 @@ import argparse,json,sys from pathlib import Path sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'src')) -from anysolver.sestra_three_case import prepare_three_cases +from anyfesolver.sestra_three_case import prepare_three_cases def main(): p=argparse.ArgumentParser(description=__doc__);p.add_argument('action',choices=['prepare','compare']);p.add_argument('input');p.add_argument('--output',required=True);a=p.parse_args() if a.action=='prepare':result=prepare_three_cases(a.input,a.output) else: - from anysolver.sestra_three_case import compare_suite + from anyfesolver.sestra_three_case import compare_suite result=compare_suite(a.input,a.output) print(json.dumps({'status':result.get('status','not_executed'),'order':result.get('order'),'output':a.output})) return 0 if result.get('status','not_executed') in {'passed','not_executed'} else 1 diff --git a/scripts/run_sestra_verification.py b/scripts/run_sestra_verification.py index bd8a6ca3c..dfa2a7567 100644 --- a/scripts/run_sestra_verification.py +++ b/scripts/run_sestra_verification.py @@ -4,7 +4,7 @@ import sys sys.path.insert(0, str(Path(__file__).resolve().parents[1]/"src")) -from anysolver.sestra_verification import run_verification +from anyfesolver.sestra_verification import run_verification def main(): diff --git a/scripts/supervise_b3_ge_e4_pl_g0_f06_v4.py b/scripts/supervise_b3_ge_e4_pl_g0_f06_v4.py index 43b50c753..f59d77f90 100644 --- a/scripts/supervise_b3_ge_e4_pl_g0_f06_v4.py +++ b/scripts/supervise_b3_ge_e4_pl_g0_f06_v4.py @@ -41,27 +41,27 @@ "tests/test_b3_e4_f06_owned_rebase_v4.py", "docs/agent_plans/B3_GE_E4_PL_G0_F06_V4_SCIENTIFIC_CONTRACT_DRAFT.md", "scripts/probe_b3_ge_e4_pl_g0_f06_loaded_rebase_v3.py", - "src/anysolver/_ge_beam3_shell_joint_state.py", - "src/anysolver/_ge_beam3_shell_joint_trial.py", - "src/anysolver/_ge_beam3_g3c_local_shell.py", - "src/anysolver/_ge_beam3_coupled_beam_subdomain.py", - "src/anysolver/_ge_beam3_pose_joint.py", - "src/anysolver/_ge_beam3_retained_generalized.py", - "src/anysolver/_ge_beam3_retained_generalized_state.py", - "src/anysolver/_ge_beam3_retained_generalized_program.py", - "src/anysolver/_ge_beam3_native_generalized_element.py", - "src/anysolver/_ge_beam3_generalized_ellipsoid_section.py", - "src/anysolver/_ge_beam3_generalized_cell.py", - "src/anysolver/_ge_beam3_generalized_static_boundary.py", - "src/anysolver/_ge_beam3_p5/algebra.py", - "src/anysolver/_ge_beam3_p5_seeded/core.py", - "src/anysolver/e4_pl_s3_v2d_element.py", - "src/anysolver/control.py", - "src/anysolver/_native_reference_modal.py", - "src/anysolver/_ge_beam3_native_generalized_loading.py", - "src/anysolver/_ge_beam3_native_line_loading.py", - "src/anysolver/_ge_beam3_centered_reference.py", - "src/anysolver/fe_core.py", + "src/anyfesolver/_ge_beam3_shell_joint_state.py", + "src/anyfesolver/_ge_beam3_shell_joint_trial.py", + "src/anyfesolver/_ge_beam3_g3c_local_shell.py", + "src/anyfesolver/_ge_beam3_coupled_beam_subdomain.py", + "src/anyfesolver/_ge_beam3_pose_joint.py", + "src/anyfesolver/_ge_beam3_retained_generalized.py", + "src/anyfesolver/_ge_beam3_retained_generalized_state.py", + "src/anyfesolver/_ge_beam3_retained_generalized_program.py", + "src/anyfesolver/_ge_beam3_native_generalized_element.py", + "src/anyfesolver/_ge_beam3_generalized_ellipsoid_section.py", + "src/anyfesolver/_ge_beam3_generalized_cell.py", + "src/anyfesolver/_ge_beam3_generalized_static_boundary.py", + "src/anyfesolver/_ge_beam3_p5/algebra.py", + "src/anyfesolver/_ge_beam3_p5_seeded/core.py", + "src/anyfesolver/e4_pl_s3_v2d_element.py", + "src/anyfesolver/control.py", + "src/anyfesolver/_native_reference_modal.py", + "src/anyfesolver/_ge_beam3_native_generalized_loading.py", + "src/anyfesolver/_ge_beam3_native_line_loading.py", + "src/anyfesolver/_ge_beam3_centered_reference.py", + "src/anyfesolver/fe_core.py", )) REQUIRED_SOURCES = MEASUREMENT_SOURCES | frozenset(( "docs/agent_plans/B3_GE_E4_PL_G0_F06_OWNED_REBASE_V4_PROTOCOL.md", @@ -124,16 +124,16 @@ def _environment() -> dict: sys.path.insert(0, local_src) import numpy import scipy - import anysolver + import anyfesolver import threadpoolctl - expected_anysolver = (ROOT / "src/anysolver/__init__.py").resolve() - if Path(anysolver.__file__).resolve() != expected_anysolver: - raise ValueError("supervisor must import the frozen local ANYsolver") + expected_anyfesolver = (ROOT / "src/anyfesolver/__init__.py").resolve() + if Path(anyfesolver.__file__).resolve() != expected_anyfesolver: + raise ValueError("supervisor must import the frozen local ANYfeSolver") return dict(python_executable=str(Path(sys.executable).resolve()), python_version=sys.version.split()[0], numpy_version=numpy.__version__, scipy_version=scipy.__version__, - anysolver_import=str(Path(anysolver.__file__).resolve()), + anyfesolver_import=str(Path(anyfesolver.__file__).resolve()), psutil_version=psutil.__version__, threadpoolctl_version=threadpoolctl.__version__, pywin32_version=package_version("pywin32"), diff --git a/scripts/verify_release_050.py b/scripts/verify_release_050.py new file mode 100644 index 000000000..008e5b3f9 --- /dev/null +++ b/scripts/verify_release_050.py @@ -0,0 +1,637 @@ +"""Packaging gate for ANYfeSolver 0.5.0 and ANYfeSolver-results 2.2.0. + +This gate verifies, for one candidate commit, that both wheel/sdist pairs were +built from the same clean source, that each sdist independently rebuilds an +installable wheel with identical shipped content, and that a clean install of +the two wheels imports under the new names only. It also re-checks the frozen +0.4.7 evidence files by their recorded hashes; that evidence stays bound to +0.4.7 and is NOT scientific requalification of 0.5.0. + +A passing run is a packaging record. It is not a publication decision and it +does not approve release; it does not rerun any numerical campaign. +""" + +from __future__ import annotations + +import argparse +from email.parser import BytesParser +from hashlib import sha256 +import importlib.util +import json +import os +from pathlib import Path +import re +import subprocess +import sys +import tarfile +import tempfile +import tomllib +from typing import Any +from zipfile import ZipFile + + +ROOT = Path(__file__).resolve().parents[1] +SOLVER_NAME = "anyfesolver" +SOLVER_VERSION = "0.5.0" +RESULTS_NAME = "anyfesolver_results" +RESULTS_VERSION = "2.2.0" +TIMEOUT_SECONDS = 900 +PROBE_TIMEOUT_SECONDS = 180 +LICENSE_FILES = {"LICENSE", "COPYRIGHT", "THIRD_PARTY_NOTICES.md"} +SOLVER_SDIST_EXTRA = {"LICENSING.md", "dependency-licenses.json", "README.md", "setup.py"} +OLD_IMPORT_NAMES = ("anysolver", "anysolver_results") +TERMINAL = "ANYFESOLVER_0_5_0_PACKAGING_GATE_PASSED_NOT_A_PUBLICATION_DECISION" +SCHEMA = "ANYFESOLVER_0_5_0_PACKAGING_GATE_V1" +# Public solver dependency bands that must stay as released in 0.4.7. +EXPECTED_SOLVER_REQUIRES = { + "numpy": frozenset({">=2.0"}), + "scipy": frozenset({">=1.13"}), + "threadpoolctl": frozenset({">=3.5"}), + "anymaterial": frozenset({">=0.2", "<0.3"}), + "anymesher": frozenset({">=0.4", "<0.6"}), + "anyfileio": frozenset({">=0.3.2", "<0.4"}), + "anyfesolver-results": frozenset({">=2.2", "<3"}), +} +EXPECTED_RESULTS_REQUIRES = {"numpy": frozenset({">=2.0"})} +SOLVER_DOCS = { + "docs/ARCHITECTURE.md", + "docs/ARC_LENGTH.md", + "docs/B3_GE_PRODUCTION_OPT_IN.md", + "docs/E4_PL_MIGRATION.md", + "docs/GE_BEAM3_NATIVE_WORKFLOWS.md", + "docs/NATIVE_SOURCE_AUTHORITY.md", + "docs/NONLINEAR_PERFORMANCE.md", + "docs/PERFORMANCE_ARCHITECTURE.md", + "docs/QUALITY_CONTROL.md", + "docs/THEORY.md", + "docs/releases/ANYfeSolver_0.5.0.md", + "docs/releases/ANYsolver_0.4.6.md", + "docs/releases/ANYsolver_0.4.7.md", +} +DEV_ONLY_PREFIXES = ( + "artifacts/", + "docs/agent_plans/", + "docs/reference_cases/", + "packages/", + "reports/", + "scripts/", + "tests/", +) +BINARY_SUFFIXES = (".pyd", ".so", ".dylib") + + +class GateError(ValueError): + """The packaging gate was not satisfied.""" + + +def _record(raw: bytes) -> dict[str, Any]: + return {"bytes": len(raw), "sha256": sha256(raw).hexdigest()} + + +def _skip(path: Path) -> bool: + return ( + "__pycache__" in path.parts + or path.suffix == ".pyc" + or path.suffix in BINARY_SUFFIXES + or any(part.endswith(".egg-info") for part in path.parts) + ) + + +def _tree(directory: Path) -> dict[str, bytes]: + if not directory.is_dir(): + raise GateError(f"source tree is missing: {directory}") + files = { + path.relative_to(directory.parent).as_posix(): path.read_bytes() + for path in sorted(directory.rglob("*")) + if path.is_file() and not _skip(path) + } + if not files: + raise GateError(f"source tree is empty: {directory}") + return files + + +def _normalize(name: str) -> str: + return re.sub(r"[-_.]+", "-", name).lower() + + +def _split_requirement(text: str) -> tuple[str, frozenset[str]]: + body = text.split(";", 1)[0].strip() + match = re.match(r"([A-Za-z0-9][A-Za-z0-9._-]*)\s*(?:\[[^\]]*\])?\s*\(?([^)]*)\)?$", body) + if match is None: + raise GateError(f"unparseable requirement: {text!r}") + specs = frozenset(s.strip().replace(" ", "") for s in match.group(2).split(",") if s.strip()) + return _normalize(match.group(1)), specs + + +def _requires(headers: Any) -> dict[str, frozenset[str]]: + made: dict[str, frozenset[str]] = {} + for item in headers.get_all("Requires-Dist") or []: + if "extra ==" in item: + continue + name, specs = _split_requirement(item) + made[name] = specs + return made + + +def _git_identity(expected_commit: str) -> tuple[str, str]: + if not re.fullmatch(r"[0-9a-f]{40}", expected_commit): + raise GateError("expected commit is not a full lowercase Git object ID") + command = ["git", "-c", f"safe.directory={ROOT}", "-C", str(ROOT)] + + def run(*args: str) -> str: + return subprocess.check_output( + command + list(args), text=True, timeout=PROBE_TIMEOUT_SECONDS + ).strip() + + commit = run("rev-parse", "HEAD") + tree = run("rev-parse", "HEAD^{tree}") + dirty = run("status", "--porcelain=v1", "--untracked-files=no") + if commit != expected_commit: + raise GateError("candidate commit mismatch") + if dirty: + raise GateError("candidate has tracked modifications") + return commit, tree + + +def _pyproject(path: Path) -> dict[str, Any]: + with path.open("rb") as stream: + return tomllib.load(stream)["project"] + + +def _check_project_files() -> dict[str, Any]: + solver = _pyproject(ROOT / "pyproject.toml") + results = _pyproject(ROOT / "packages" / "results" / "pyproject.toml") + if (solver["name"], solver["version"]) != ("ANYfeSolver", SOLVER_VERSION): + raise GateError("solver pyproject identity mismatch") + if (results["name"], results["version"]) != ("ANYfeSolver-results", RESULTS_VERSION): + raise GateError("results pyproject identity mismatch") + if dict(_split_requirement(r) for r in solver["dependencies"]) != EXPECTED_SOLVER_REQUIRES: + raise GateError("solver public dependency bands changed") + if dict(_split_requirement(r) for r in results["dependencies"]) != EXPECTED_RESULTS_REQUIRES: + raise GateError("results dependency bands changed") + return {"solver": f"{solver['name']}=={solver['version']}", + "results": f"{results['name']}=={results['version']}"} + + +def _members(path: Path) -> dict[str, bytes]: + if not path.is_file() or path.stat().st_size <= 0: + raise GateError(f"artifact is missing or empty: {path.name}") + made: dict[str, bytes] = {} + if path.suffix == ".whl": + with ZipFile(path) as archive: + names = archive.namelist() + if len(names) != len(set(names)): + raise GateError(f"{path.name} has duplicate entries") + for name in names: + if not name.endswith("/"): + made[name] = archive.read(name) + else: + with tarfile.open(path, "r:gz") as archive: + seen: set[str] = set() + for member in archive.getmembers(): + if member.name in seen: + raise GateError(f"{path.name} has duplicate entries") + seen.add(member.name) + if member.isfile(): + stream = archive.extractfile(member) + assert stream is not None + made[member.name] = stream.read() + elif not member.isdir(): + raise GateError(f"{path.name} has a non-regular member: {member.name}") + for name in made: + parts = name.split("/") + if name.startswith("/") or ".." in parts: + raise GateError(f"{path.name} has an unsafe member path: {name}") + if parts[0] in OLD_IMPORT_NAMES or "src/anysolver" in name or "src/anysolver_results" in name: + raise GateError(f"{path.name} ships an old import tree: {name}") + return made + + +def _metadata(members: dict[str, bytes], label: str) -> Any: + names = [n for n in members if n.endswith(".dist-info/METADATA")] + if len(names) != 1: + raise GateError(f"{label} must contain exactly one METADATA file") + return BytesParser().parsebytes(members[names[0]]) + + +def _check_metadata(headers: Any, name: str, version: str, expected: dict, label: str) -> dict: + if _normalize(headers["Name"]) != _normalize(name) or headers["Version"] != version: + raise GateError(f"{label} metadata identity mismatch") + if headers.get("License-Expression") != "MPL-2.0": + raise GateError(f"{label} does not declare License-Expression MPL-2.0") + declared = set(headers.get_all("License-File") or []) + declared = {Path(item).name for item in declared} + if not LICENSE_FILES <= declared: + raise GateError(f"{label} metadata omits license files") + if _requires(headers) != expected: + raise GateError(f"{label} Requires-Dist differs from the declared bands") + return {"name": headers["Name"], "version": headers["Version"], + "requires_python": headers["Requires-Python"], + "license_expression": headers["License-Expression"], + "license_files": sorted(declared)} + + +def _runtime(members: dict[str, bytes], package: str) -> dict[str, bytes]: + return {n: b for n, b in members.items() if n.startswith(package + "/")} + + +def _same_runtime(runtime: dict[str, bytes], source: dict[str, bytes], label: str) -> None: + extra = {n for n in runtime if n not in source and not n.endswith(BINARY_SUFFIXES)} + missing = set(source) - set(runtime) + if extra or missing: + raise GateError( + f"{label} path set differs from source: extra={sorted(extra)[:5]} " + f"missing={sorted(missing)[:5]}" + ) + for name, raw in source.items(): + if runtime[name] != raw: + raise GateError(f"{label} differs from source: {name}") + + +def _inventory(members: dict[str, bytes]) -> list[dict[str, Any]]: + return [{"path": n, **_record(b)} for n, b in sorted(members.items())] + + +def _check_sdist(path: Path, name: str, version: str, package: str, source: dict[str, bytes], + expected: dict, solver: bool) -> dict[str, Any]: + if path.name != f"{name}-{version}.tar.gz": + raise GateError(f"{path.name}: sdist filename mismatch") + members = _members(path) + prefix = f"{name}-{version}/" + if any(not n.startswith(prefix) for n in members): + raise GateError(f"{path.name} has an unexpected root") + rel = {n[len(prefix):]: b for n, b in members.items()} + if solver: + if any(n.startswith(DEV_ONLY_PREFIXES) for n in rel): + raise GateError("solver sdist contains development-only material") + docs = {n for n in rel if n.startswith("docs/")} + if docs != SOLVER_DOCS: + raise GateError(f"solver sdist documentation set mismatch: {sorted(docs ^ SOLVER_DOCS)}") + required = LICENSE_FILES | SOLVER_SDIST_EXTRA + else: + required = LICENSE_FILES | {"README.md"} + missing = sorted(f for f in required | {"pyproject.toml"} if f not in rel) + if missing: + raise GateError(f"{path.name} lacks required files: {missing}") + shipped = {n: b for n, b in rel.items() if n.startswith(("src/" + package + "/"))} + prefixed = {"src/" + n: b for n, b in source.items()} + _same_runtime(shipped, prefixed, f"{path.name} source") + others = [n for n in rel if n.startswith("src/") and not n.startswith("src/" + package + "/") + and ".egg-info/" not in n] + if others: + raise GateError(f"{path.name} ships unexpected source: {others[:5]}") + headers = BytesParser().parsebytes(rel["PKG-INFO"]) + if _normalize(headers["Name"]) != _normalize(name) or headers["Version"] != version: + raise GateError(f"{path.name} PKG-INFO identity mismatch") + if _requires(headers) != expected: + raise GateError(f"{path.name} PKG-INFO Requires-Dist differs from the declared bands") + return {"archive": {"name": path.name, **_record(path.read_bytes())}, "files": _inventory(rel)} + + +def _extract(path: Path, destination: Path) -> Path: + """Extract regular files only, refusing any path that leaves destination.""" + destination.mkdir(parents=True) + root = destination.resolve() + with tarfile.open(path, "r:gz") as archive: + for member in archive.getmembers(): + target = (destination / member.name).resolve() + if root != target and root not in target.parents: + raise GateError(f"unsafe sdist member: {member.name}") + if member.isdir(): + target.mkdir(parents=True, exist_ok=True) + elif member.isfile(): + target.parent.mkdir(parents=True, exist_ok=True) + stream = archive.extractfile(member) + assert stream is not None + target.write_bytes(stream.read()) + else: + raise GateError(f"non-regular sdist member: {member.name}") + roots = [p for p in destination.iterdir() if p.is_dir()] + if len(roots) != 1: + raise GateError("sdist must extract to exactly one root") + return roots[0] + + +def _clean_env(**extra: str) -> dict[str, str]: + env = {k: v for k, v in os.environ.items() if k not in {"PYTHONPATH", "PYTHONHOME"}} + env.update(extra) + return env + + +def _run(args: list[str], cwd: Path, env: dict[str, str], timeout: int) -> str: + done = subprocess.run(args, cwd=cwd, env=env, check=False, timeout=timeout, + stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) + if done.returncode != 0: + raise GateError(f"command failed ({' '.join(args[:4])}...): " + f"{(done.stderr.strip() or done.stdout.strip())[-1500:]}") + return done.stdout + + +def _rebuild(sdist: Path, work: Path, tag: str, isolated: bool) -> Path: + root = _extract(sdist, work / f"{tag}-src") + out = work / f"{tag}-wheel" + out.mkdir() + command = [sys.executable, "-m", "build", "--wheel", "--outdir", str(out), str(root)] + if not isolated: + command.insert(4, "--no-isolation") + # Pure rebuild: a native guard binary is host-specific and compared by presence only. + _run(command, work, _clean_env(ANYFESOLVER_BUILD_NATIVE_GUARD="0"), TIMEOUT_SECONDS) + wheels = sorted(out.glob("*.whl")) + if len(wheels) != 1: + raise GateError(f"{tag} sdist did not rebuild exactly one wheel") + return wheels[0] + + +def _compare_wheels(original: Path, rebuilt: Path, label: str) -> dict[str, Any]: + a, b = _members(original), _members(rebuilt) + + def comparable(members: dict[str, bytes]) -> dict[str, bytes]: + return {n: v for n, v in members.items() + if not n.endswith((".dist-info/RECORD", ".dist-info/WHEEL")) and not n.endswith(BINARY_SUFFIXES)} + + ca, cb = comparable(a), comparable(b) + if set(ca) != set(cb): + raise GateError(f"{label}: sdist rebuild changed the file set: {sorted(set(ca) ^ set(cb))[:5]}") + for name in ca: + if ca[name] != cb[name]: + raise GateError(f"{label}: sdist rebuild differs from the published wheel: {name}") + return {"compared_files": len(ca), "identical": True, "rebuilt_wheel": rebuilt.name, + "binary_members_in_original": sorted(n for n in a if n.endswith(BINARY_SUFFIXES))} + + +_IMPORT_PROBE = r'''import json, pathlib, sys +from importlib import metadata +site = pathlib.Path(sys.argv[1]).resolve() +mode = sys.argv[2] +sys.path.insert(0, str(site)) +import anyfesolver, anyfesolver_results +for module in (anyfesolver, anyfesolver_results): + if site not in pathlib.Path(module.__file__).resolve().parents: + raise RuntimeError("installed origin mismatch: " + module.__name__) +if anyfesolver.__version__ != "0.5.0" or metadata.version("ANYfeSolver") != "0.5.0": + raise RuntimeError("solver version mismatch") +if metadata.version("ANYfeSolver-results") != "2.2.0": + raise RuntimeError("results version mismatch") +for old in ("anysolver", "anysolver_results"): + try: + __import__(old) + except ModuleNotFoundError: + pass + else: + raise RuntimeError("old import name resolves: " + old) +out = {"old_imports_absent": True, "installed_origin": True} +if mode == "full": + from anyfesolver import b3_ge + from anyfesolver.elements import ELEMENT_TYPES, QuadraticBeamElement, create_element + from anyfesolver.nonlinear_static import NonlinearConvergenceSettings + if b3_ge.SELECTOR != "b3-ge" or b3_ge.NAME != "B3-GE": raise RuntimeError("B3-GE identity mismatch") + if "b3-ge" in ELEMENT_TYPES: raise RuntimeError("B3-GE entered generic registry") + if type(create_element("quadratic_beam", 1, [1, 2, 3])) is not QuadraticBeamElement: raise RuntimeError("legacy B3 default changed") + if NonlinearConvergenceSettings().line_search == "armijo": raise RuntimeError("Armijo became a default") + if NonlinearConvergenceSettings(line_search="armijo").line_search != "armijo": raise RuntimeError("Armijo opt-in unavailable") + try: create_element("b3-ge", 2, [1, 2, 3]) + except ValueError: pass + else: raise RuntimeError("B3-GE became a generic/default route") + out.update(legacy_b3_default=True, b3_ge_opt_in_only=True, armijo_opt_in_only=True) + bands = {"ANYfileio": ((0, 3, 2), (0, 4)), "ANYmaterial": ((0, 2), (0, 3)), "ANYmesher": ((0, 4), (0, 6))} + found = {} + for name, (low, high) in bands.items(): + v = metadata.version(name); found[name] = v + t = tuple(int(p) for p in v.split(".")[:3] if p.isdigit()) + if not (t >= low and t[:len(high)] < high): raise RuntimeError("dependency outside band: " + name + " " + v) + out["dependencies"] = found +print(json.dumps(out, sort_keys=True, separators=(",", ":"))) +''' + + +def _installed_probe(wheels: list[Path], work: Path, tag: str, full: bool) -> dict[str, Any]: + site = work / f"{tag}-site" + install = [sys.executable, "-m", "pip", "install", "--disable-pip-version-check", + "--target", str(site)] + # Dependencies resolve from the configured index: the solver imports its + # sibling distributions at import time, so a --no-deps install cannot import. + _run(install + [str(w.resolve()) for w in wheels], work, _clean_env(), TIMEOUT_SECONDS) + # Isolated mode keeps the working directory and user site off sys.path. + output = _run([sys.executable, "-I", "-c", _IMPORT_PROBE, str(site), "full" if full else "import"], + work, _clean_env(), PROBE_TIMEOUT_SECONDS) + old = [p.name for p in site.iterdir() if p.name.lower() in OLD_IMPORT_NAMES] + if old: + raise GateError(f"installed tree contains old import directories: {old}") + return json.loads(output) + + +def _load_historical() -> Any: + path = ROOT / "scripts" / "verify_release_047.py" + spec = importlib.util.spec_from_file_location("_historical_verify_release_047", path) + if spec is None or spec.loader is None: + raise GateError("historical verifier cannot be loaded") + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +def _historical_evidence() -> dict[str, Any]: + """Re-hash the frozen 0.4.7 evidence with the untouched historical verifier. + + The result is cited only as evidence bound to the 0.4.7 identities in that + verifier; it says nothing about the 0.5.0 artifacts. + """ + historical = _load_historical() + if historical.VERSION != "0.4.7": + raise GateError("historical verifier identity changed") + return { + "bound_release": "0.4.7", + "bound_terminal_not_reused": historical.TERMINAL, + "g7": historical._validate_g7(), + "performance": historical._validate_performance_evidence(), + "scope": "frozen 0.4.7 evidence hashes only; no 0.5.0 scientific requalification was performed", + } + + +def run(solver_wheel: Path, solver_sdist: Path, results_wheel: Path, results_sdist: Path, + expected_commit: str, isolated: bool = True, work_dir: Path | None = None) -> dict[str, Any]: + commit, tree = _git_identity(expected_commit) + project = _check_project_files() + solver_src = _tree(ROOT / "src" / SOLVER_NAME) + results_src = _tree(ROOT / "packages" / "results" / "src" / RESULTS_NAME) + + if not re.fullmatch(rf"{SOLVER_NAME}-{re.escape(SOLVER_VERSION)}-[A-Za-z0-9_.]+-[A-Za-z0-9_.]+-[A-Za-z0-9_.]+\.whl", + solver_wheel.name): + raise GateError("solver wheel filename mismatch") + if results_wheel.name != f"{RESULTS_NAME}-{RESULTS_VERSION}-py3-none-any.whl": + raise GateError("results wheel filename mismatch") + + members = {"solver": _members(solver_wheel), "results": _members(results_wheel)} + _same_runtime(_runtime(members["solver"], SOLVER_NAME), solver_src, "solver wheel") + _same_runtime(_runtime(members["results"], RESULTS_NAME), results_src, "results wheel") + metadata = { + "solver_wheel": _check_metadata(_metadata(members["solver"], "solver wheel"), "ANYfeSolver", + SOLVER_VERSION, EXPECTED_SOLVER_REQUIRES, "solver wheel"), + "results_wheel": _check_metadata(_metadata(members["results"], "results wheel"), "ANYfeSolver-results", + RESULTS_VERSION, EXPECTED_RESULTS_REQUIRES, "results wheel"), + } + sdists = { + "solver": _check_sdist(solver_sdist, SOLVER_NAME, SOLVER_VERSION, SOLVER_NAME, solver_src, + EXPECTED_SOLVER_REQUIRES, True), + "results": _check_sdist(results_sdist, RESULTS_NAME, RESULTS_VERSION, RESULTS_NAME, results_src, + EXPECTED_RESULTS_REQUIRES, False), + } + historical = _historical_evidence() + + with tempfile.TemporaryDirectory(prefix="anyfesolver-050-gate-", dir=work_dir) as raw: + work = Path(raw) + rebuilt_solver = _rebuild(solver_sdist, work, "solver", isolated) + rebuilt_results = _rebuild(results_sdist, work, "results", isolated) + rebuild = { + "solver": _compare_wheels(solver_wheel, rebuilt_solver, "solver"), + "results": _compare_wheels(results_wheel, rebuilt_results, "results"), + } + # The sdist-rebuilt pair must itself install and import (dependencies resolve from the index). + rebuilt_install = _installed_probe([rebuilt_solver, rebuilt_results], work, "rebuilt", full=False) + installed = _installed_probe([solver_wheel, results_wheel], work, "published", full=True) + + return { + "candidate": {"commit": commit, "tree": tree}, + "checks": { + "both_pairs_built_from_candidate_source": True, + "dependency_bands_unchanged": True, + "historical_verifier_untouched_and_not_reused_as_terminal": True, + "installed_smoke": True, + "no_old_import_trees": True, + "sdist_rebuilds_identical_installable_wheel": True, + }, + "historical_evidence": historical, + "installed": installed, + "metadata": metadata, + "project": project, + "rebuild": rebuild, + "rebuilt_install": rebuilt_install, + "schema": SCHEMA, + "sdists": sdists, + "shipped_source": { + "solver_files": len(solver_src), + "results_files": len(results_src), + "solver_inventory": _inventory(solver_src), + "results_inventory": _inventory(results_src), + }, + "terminal": TERMINAL, + "versions": {"ANYfeSolver": SOLVER_VERSION, "ANYfeSolver-results": RESULTS_VERSION}, + "wheels": { + "solver": {"name": solver_wheel.name, **_record(solver_wheel.read_bytes()), + "files": _inventory(members["solver"])}, + "results": {"name": results_wheel.name, **_record(results_wheel.read_bytes()), + "files": _inventory(members["results"])}, + }, + } + + +ALLOWED_INDEXES = ("https://test.pypi.org", "https://pypi.org") + + +def _fetch_index_files(index: str, name: str, version: str) -> dict[str, str]: + """Return {filename: sha256} the index serves for one release (empty if none).""" + import urllib.error + import urllib.request + + if index not in ALLOWED_INDEXES: + raise GateError(f"index is not an allowed host: {index}") + url = f"{index}/pypi/{name}/{version}/json" + request = urllib.request.Request(url, headers={"User-Agent": "anyfesolver-release-gate"}) + try: + with urllib.request.urlopen(request, timeout=PROBE_TIMEOUT_SECONDS) as response: + payload = json.load(response) + except urllib.error.HTTPError as error: + if error.code == 404: + return {} + raise GateError(f"index query failed with HTTP {error.code}: {url}") from error + files = {} + for item in payload.get("urls", []): + files[item["filename"]] = item["digests"]["sha256"] + return files + + +def plan_upload(remote: dict[str, str], dist_dir: Path, missing_dir: Path | None) -> dict[str, Any]: + """Compare local files with the index by per-file digest; fail closed on any conflict. + + Only candidate files that are absent from the index are scheduled for upload. + A file present with a different digest, or any remote file that is not a + candidate file, is an error: nothing is overwritten and nothing is skipped + on filename alone. + """ + local = {p.name: sha256(p.read_bytes()).hexdigest() for p in sorted(dist_dir.iterdir()) if p.is_file()} + if not local: + raise GateError(f"no candidate files in {dist_dir}") + conflicts = sorted(n for n in local if n in remote and remote[n] != local[n]) + if conflicts: + raise GateError(f"index holds different bytes for: {conflicts}") + unexpected = sorted(set(remote) - set(local)) + if unexpected: + raise GateError(f"index holds files that are not candidate files: {unexpected}") + missing = sorted(set(local) - set(remote)) + if missing_dir is not None: + if missing_dir.exists() and any(missing_dir.iterdir()): + raise GateError("missing-file directory must start empty") + missing_dir.mkdir(parents=True, exist_ok=True) + for name in missing: + (missing_dir / name).write_bytes((dist_dir / name).read_bytes()) + return {"present_matching": sorted(set(local) - set(missing)), "missing": missing} + + +def _index_plan_main(argv: list[str]) -> int: + parser = argparse.ArgumentParser(prog="verify_release_050.py index-plan") + parser.add_argument("--index", required=True, choices=ALLOWED_INDEXES) + parser.add_argument("--name", required=True) + parser.add_argument("--version", required=True) + parser.add_argument("--dist-dir", required=True, type=Path) + parser.add_argument("--missing-dir", type=Path) + parser.add_argument("--require-complete", action="store_true", + help="fail unless the index already serves every candidate file") + parser.add_argument("--github-output", type=Path) + args = parser.parse_args(argv) + try: + plan = plan_upload(_fetch_index_files(args.index, args.name, args.version), + args.dist_dir, args.missing_dir) + except (GateError, OSError, KeyError, ValueError) as error: + print(f"index plan failed: {error}", file=sys.stderr) + return 1 + print(json.dumps(plan, sort_keys=True)) + if args.github_output: + with args.github_output.open("a", encoding="utf-8") as stream: + stream.write(f"missing={len(plan['missing'])}\n") + if args.require_complete and plan["missing"]: + print("index does not yet serve every candidate file", file=sys.stderr) + return 2 + return 0 + + +def main(argv: list[str] | None = None) -> int: + arguments = list(sys.argv[1:] if argv is None else argv) + if arguments[:1] == ["index-plan"]: + return _index_plan_main(arguments[1:]) + argv = arguments + parser = argparse.ArgumentParser(description=__doc__) + for option in ("solver-wheel", "solver-sdist", "results-wheel", "results-sdist"): + parser.add_argument(f"--{option}", required=True, type=Path) + parser.add_argument("--expected-commit", required=True) + parser.add_argument("--output", required=True, type=Path) + parser.add_argument("--no-build-isolation", action="store_true", + help="rebuild sdists with the current environment instead of isolated build deps") + parser.add_argument("--work-dir", type=Path, default=None) + args = parser.parse_args(argv) + try: + result = run(args.solver_wheel.resolve(), args.solver_sdist.resolve(), + args.results_wheel.resolve(), args.results_sdist.resolve(), + args.expected_commit, not args.no_build_isolation, + args.work_dir.resolve() if args.work_dir else None) + raw = (json.dumps(result, sort_keys=True, separators=(",", ":"), allow_nan=False) + "\n").encode("ascii") + with args.output.open("xb") as stream: + stream.write(raw) + except (GateError, OSError, KeyError, ValueError, subprocess.SubprocessError) as error: + print(f"packaging gate failed: {error}", file=sys.stderr) + return 1 + print(sha256(raw).hexdigest()) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/scripts/verify_release_runtime.py b/scripts/verify_release_runtime.py index 81c6237d5..1b4b1df6e 100644 --- a/scripts/verify_release_runtime.py +++ b/scripts/verify_release_runtime.py @@ -23,7 +23,7 @@ def runtime(z): if len(z.namelist()) != len(set(z.namelist())): raise ValueError('duplicate wheel entries') return {n: z.read(n).replace(b'\r\n', b'\n') for n in z.namelist() - if n.startswith('anysolver/') and not n.endswith('/')} + if n.startswith('anyfesolver/') and not n.endswith('/')} before, after = runtime(old), runtime(new) if before.keys() != after.keys(): raise ValueError('runtime path set mismatch') @@ -32,18 +32,18 @@ def runtime(z): a, b = before[name], after[name] if a == b: continue - if name != 'anysolver/__init__.py' or a.count(b'__version__ = "0.4.2"') != 1: + if name != 'anyfesolver/__init__.py' or a.count(b'__version__ = "0.4.2"') != 1: raise ValueError('runtime changed: ' + name) if a.replace(b'__version__ = "0.4.2"', b'__version__ = "0.4.3"') != b: raise ValueError('non-version runtime change') changes.append(name) - if changes != ['anysolver/__init__.py']: + if changes != ['anyfesolver/__init__.py']: raise ValueError('release version change missing') metadata = [n for n in new.namelist() if n.endswith('.dist-info/METADATA')] if len(metadata) != 1: raise ValueError('wheel metadata count') headers = BytesParser().parsebytes(new.read(metadata[0])) - if headers['Version'] != '0.4.3' or headers['Name'].lower() != 'anysolver': + if headers['Version'] != '0.4.3' or headers['Name'].lower() != 'anyfesolver': raise ValueError('release metadata mismatch') return dict(schema='anysolver.release-runtime-bridge.v1', accepted_wheel_sha256=ACCEPTED_SHA256, @@ -64,12 +64,12 @@ def compare_manifest(manifest: Path, release: Path) -> dict: with ZipFile(release) as wheel: if len(wheel.namelist()) != len(set(wheel.namelist())): raise ValueError('duplicate wheel entries') - paths = {n for n in wheel.namelist() if n.startswith('anysolver/') and not n.endswith('/')} + paths = {n for n in wheel.namelist() if n.startswith('anyfesolver/') and not n.endswith('/')} if paths != set(record['runtime']): raise ValueError('runtime path set mismatch') for name in sorted(paths): raw = wheel.read(name).replace(b'\r\n', b'\n') - if name == 'anysolver/__init__.py': + if name == 'anyfesolver/__init__.py': if raw.count(b'__version__ = "0.4.3"') != 1: raise ValueError('release version assignment mismatch') raw = raw.replace(b'__version__ = "0.4.3"', b'__version__ = "0.4.2"') @@ -79,14 +79,14 @@ def compare_manifest(manifest: Path, release: Path) -> dict: if len(names) != 1: raise ValueError('wheel metadata count') headers = BytesParser().parsebytes(wheel.read(names[0])) - if headers['Version'] != '0.4.3' or headers['Name'].lower() != 'anysolver': + if headers['Version'] != '0.4.3' or headers['Name'].lower() != 'anyfesolver': raise ValueError('release metadata mismatch') raw = release.read_bytes() return dict(schema='anysolver.release-runtime-bridge.v1', accepted_wheel_sha256=ACCEPTED_SHA256, release_wheel_sha256=sha256(raw).hexdigest(), release_wheel_bytes=len(raw), runtime_file_count=317, - normalized_changes=['anysolver/__init__.py'], version_only=True, + normalized_changes=['anyfesolver/__init__.py'], version_only=True, qualification_scope_unchanged=True, defaults_unchanged=True) diff --git a/scripts/verify_sol_ultra_numerics.py b/scripts/verify_sol_ultra_numerics.py index 65de41fb6..c791faf08 100644 --- a/scripts/verify_sol_ultra_numerics.py +++ b/scripts/verify_sol_ultra_numerics.py @@ -9,10 +9,10 @@ Typical use from two clean worktrees:: python scripts/verify_sol_ultra_numerics.py capture \ - --solver-root ../ANYsolver-baseline \ + --solver-root ../ANYfeSolver-baseline \ --label baseline --suite full --output baseline.json python scripts/verify_sol_ultra_numerics.py capture \ - --solver-root ../ANYsolver-candidate \ + --solver-root ../ANYfeSolver-candidate \ --label candidate --suite full --output candidate.json python scripts/verify_sol_ultra_numerics.py compare \ --baseline baseline.json --candidate candidate.json @@ -167,13 +167,13 @@ def configure_solver_root(path: Path | str) -> None: global ROOT, SRC target = Path(path).resolve() source = target / "src" - if not (source / "anysolver").is_dir(): - raise ValueError(f"solver root {target} has no src/anysolver package") + if not (source / "anyfesolver").is_dir(): + raise ValueError(f"solver root {target} has no src/anyfesolver package") if any( - name == "anysolver" or name.startswith("anysolver.") + name == "anyfesolver" or name.startswith("anyfesolver.") for name in sys.modules ): - raise RuntimeError("configure_solver_root must run before importing anysolver") + raise RuntimeError("configure_solver_root must run before importing anyfesolver") previous = str(SRC) sys.path[:] = [entry for entry in sys.path if entry != previous] ROOT = target @@ -425,12 +425,12 @@ def _topology(model: Any) -> dict[str, int]: def _case_global_matrices() -> dict[str, Any]: - from anysolver.matrix_assembly import ( + from anyfesolver.matrix_assembly import ( assemble_geometric_stiffness_matrix, assemble_mass_matrix, assemble_stiffness_matrix, ) - from anysolver.mesh_gen import generate_simple_panel_mesh + from anyfesolver.mesh_gen import generate_simple_panel_mesh model = generate_simple_panel_mesh( 1.2, @@ -478,9 +478,9 @@ def _case_global_matrices() -> dict[str, Any]: def _case_linear_static() -> dict[str, Any]: - from anysolver.assembly import solve_linear - from anysolver.boundary import LoadCase - from anysolver.mesh_gen import generate_simple_panel_mesh + from anyfesolver.assembly import solve_linear + from anyfesolver.boundary import LoadCase + from anyfesolver.mesh_gen import generate_simple_panel_mesh model = generate_simple_panel_mesh( 1.0, @@ -513,9 +513,9 @@ def _case_linear_static() -> dict[str, Any]: def _axial_modal_model() -> Any: - from anysolver.boundary import BoundaryCondition, FixedSupport - from anysolver.elements import BeamElement - from anysolver.fe_core import FEModel + from anyfesolver.boundary import BoundaryCondition, FixedSupport + from anyfesolver.elements import BeamElement + from anyfesolver.fe_core import FEModel model = FEModel("verification_axial_modal") model.add_material("steel", elastic_modulus=100.0, poisson_ratio=0.3, density=2.0) @@ -542,7 +542,7 @@ def _axial_modal_model() -> Any: def _case_modal() -> dict[str, Any]: - from anysolver.modal import solve_free_vibration + from anyfesolver.modal import solve_free_vibration model = _axial_modal_model() result = solve_free_vibration(model, num_modes=1) @@ -569,9 +569,9 @@ def _case_modal() -> dict[str, Any]: def _beam_column_model(num_elements: int = 4) -> Any: - from anysolver.boundary import BoundaryCondition - from anysolver.elements import BeamElement - from anysolver.fe_core import FEModel + from anyfesolver.boundary import BoundaryCondition + from anyfesolver.elements import BeamElement + from anyfesolver.fe_core import FEModel length = 4.0 model = FEModel("verification_beam_column") @@ -599,7 +599,7 @@ def _beam_column_model(num_elements: int = 4) -> Any: def _case_buckling() -> dict[str, Any]: - from anysolver.buckling import solve_eigenvalue_buckling + from anyfesolver.buckling import solve_eigenvalue_buckling model = _beam_column_model() states = { @@ -632,11 +632,11 @@ def _case_buckling() -> dict[str, Any]: def _case_nonlinear_internal() -> dict[str, Any]: - from anysolver import nonlinear_performance, nonlinear_static - from anysolver.nonlinear_performance_bootstrap import ( + from anyfesolver import nonlinear_performance, nonlinear_static + from anyfesolver.nonlinear_performance_bootstrap import ( nonlinear_assembly_diagnostics, ) - from anysolver.mesh_gen import generate_simple_panel_mesh + from anyfesolver.mesh_gen import generate_simple_panel_mesh model = generate_simple_panel_mesh( 1.2, @@ -702,7 +702,7 @@ def _case_nonlinear_internal() -> dict[str, Any]: ) else: observations["scalar_oracle_unavailable"] = ( - "anysolver.nonlinear_performance._ORIGINAL_ASSEMBLER is None" + "anyfesolver.nonlinear_performance._ORIGINAL_ASSEMBLER is None" ) observations["campaign_diagnostics"] = _campaign_diagnostics( nonlinear_assembly_diagnostics(model) @@ -738,7 +738,7 @@ def _orthotropic_elastic_matrix() -> np.ndarray: def _hill_model() -> Any: - from anysolver.materials import Hill48Yield + from anyfesolver.materials import Hill48Yield return Hill48Yield( X=300.0e6, @@ -751,7 +751,7 @@ def _hill_model() -> Any: def _case_hill48_material() -> dict[str, Any]: - from anysolver.plasticity import ( + from anyfesolver.plasticity import ( hill48_plane_stress_equivalent_stress, hill48_plane_stress_numerical_tangent, hill48_plane_stress_return_map, @@ -836,11 +836,11 @@ def _case_hill48_material() -> dict[str, Any]: def _orthotropic_hill_shell_model() -> Any: - from anysolver.boundary import BoundaryCondition - from anysolver.elements import create_element - from anysolver.fe_core import FEModel - from anysolver.material_curves import DNVC208MaterialCurve - from anysolver.materials import Hill48Yield + from anyfesolver.boundary import BoundaryCondition + from anyfesolver.elements import create_element + from anyfesolver.fe_core import FEModel + from anyfesolver.material_curves import DNVC208MaterialCurve + from anyfesolver.materials import Hill48Yield model = FEModel("verification_orthotropic_hill_shell") strength = 100.0e6 @@ -918,11 +918,11 @@ def find(value: Any) -> int | None: def _case_hill48_shell_path() -> dict[str, Any]: - from anysolver import nonlinear_static - from anysolver.boundary import LoadCase - from anysolver.matrix_assembly import assemble_stiffness_matrix - from anysolver.nonlinear_static import solve_static_nonlinear - from anysolver.recovery import recover_stress_result + from anyfesolver import nonlinear_static + from anyfesolver.boundary import LoadCase + from anyfesolver.matrix_assembly import assemble_stiffness_matrix + from anyfesolver.nonlinear_static import solve_static_nonlinear + from anyfesolver.recovery import recover_stress_result model = _orthotropic_hill_shell_model() nonlinear_static._ensure_nonlinear_acceleration() @@ -1013,9 +1013,9 @@ def _case_hill48_shell_path() -> dict[str, Any]: def _generalized_shell_model() -> tuple[Any, Any]: - from anysolver.elements import create_element - from anysolver.fe_core import FEModel - from anysolver.shell_sections import GeneralizedShellSection + from anyfesolver.elements import create_element + from anyfesolver.fe_core import FEModel + from anyfesolver.shell_sections import GeneralizedShellSection model = FEModel("verification_generalized_shell") model.add_material("dummy", 70.0e9, 0.25, density=2700.0) @@ -1058,7 +1058,7 @@ def _generalized_shell_model() -> tuple[Any, Any]: def _case_generalized_shell() -> dict[str, Any]: - from anysolver.recovery import recover_stress_result + from anyfesolver.recovery import recover_stress_result model, element = _generalized_shell_model() material = model.get_material("dummy") @@ -1119,7 +1119,7 @@ def _case_generalized_shell() -> dict[str, Any]: def _rigid_rotation_field(model: Any, angle_degrees: float, axis: Sequence[float]) -> np.ndarray: - from anysolver.corotational import rotation_matrix_from_vector + from anyfesolver.corotational import rotation_matrix_from_vector direction = np.asarray(axis, dtype=float) direction /= np.linalg.norm(direction) @@ -1134,8 +1134,8 @@ def _rigid_rotation_field(model: Any, angle_degrees: float, axis: Sequence[float def _corotational_models() -> list[tuple[str, Any, Any]]: - from anysolver.elements import BeamElement, create_element - from anysolver.fe_core import FEModel + from anyfesolver.elements import BeamElement, create_element + from anyfesolver.fe_core import FEModel shell_model = FEModel("verification_corotational_shell") shell_model.add_material("steel", 210.0e9, 0.0, density=7850.0) @@ -1164,9 +1164,9 @@ def _corotational_models() -> list[tuple[str, Any, Any]]: def _case_corotational() -> dict[str, Any]: - from anysolver.corotational import corotational_element_response - from anysolver import nonlinear_static - from anysolver.nonlinear_performance_bootstrap import nonlinear_assembly_diagnostics + from anyfesolver.corotational import corotational_element_response + from anyfesolver import nonlinear_static + from anyfesolver.nonlinear_performance_bootstrap import nonlinear_assembly_diagnostics metrics: dict[str, dict[str, Any]] = {} observations: dict[str, Any] = {} @@ -1244,10 +1244,10 @@ def _case_corotational() -> dict[str, Any]: def _case_arc_length() -> dict[str, Any]: - from anysolver.arc_length import ArcLengthControl, solve_static_arc_length - from anysolver.boundary import BoundaryCondition, LoadCase - from anysolver.elements import Element - from anysolver.fe_core import FEModel + from anyfesolver.arc_length import ArcLengthControl, solve_static_arc_length + from anyfesolver.boundary import BoundaryCondition, LoadCase + from anyfesolver.elements import Element + from anyfesolver.fe_core import FEModel class SofteningSpringElement(Element): def __init__(self, element_id: int, node_id: int) -> None: @@ -1348,9 +1348,9 @@ def compute_nonlinear_response( def _contact_panel() -> Any: - from anysolver.boundary import BoundaryCondition - from anysolver.elements import create_element - from anysolver.fe_core import FEModel + from anyfesolver.boundary import BoundaryCondition + from anyfesolver.elements import create_element + from anyfesolver.fe_core import FEModel model = FEModel("verification_contact_panel") model.add_material("soft", 1.0e5, 0.3, density=20.0) @@ -1377,9 +1377,9 @@ def _contact_panel() -> Any: def _yielding_contact_panel(*, divisions: int = 4) -> Any: """Small clamped panel with enough spatial freedom to yield under impact.""" - from anysolver.boundary import BoundaryCondition - from anysolver.elements import create_element - from anysolver.fe_core import FEModel + from anyfesolver.boundary import BoundaryCondition + from anyfesolver.elements import create_element + from anyfesolver.fe_core import FEModel model = FEModel("verification_yielding_contact_panel") model.add_material("soft", 1.0e5, 0.3, density=20.0) @@ -1426,7 +1426,7 @@ def _yielding_contact_panel(*, divisions: int = 4) -> Any: def _case_contact_load() -> dict[str, Any]: - from anysolver.contact import ( + from anyfesolver.contact import ( RigidSphereImpact, SphereContactConfig, assemble_sphere_contact_load_vector, @@ -1682,15 +1682,15 @@ def _append_plastic_impact_metrics( def _case_nonlinear_impact() -> dict[str, Any]: - from anysolver.contact import ( + from anyfesolver.contact import ( NonlinearTransientConfig, PlasticImpactDamageConfig, RigidSphereImpact, SphereContactConfig, solve_transient_sphere_impact, ) - from anysolver.dynamics import TransientConfig - from anysolver.material_curves import DNVC208MaterialCurve + from anyfesolver.dynamics import TransientConfig + from anyfesolver.material_curves import DNVC208MaterialCurve model = _yielding_contact_panel() model.materials["soft"].hardening_curve = DNVC208MaterialCurve( @@ -1828,13 +1828,13 @@ def _case_nonlinear_impact() -> dict[str, Any]: def _case_nonlinear_impact_direct_reduced() -> dict[str, Any]: """Elastic impact sized to activate candidate direct-reduced assembly.""" - from anysolver.contact import ( + from anyfesolver.contact import ( NonlinearTransientConfig, RigidSphereImpact, SphereContactConfig, solve_transient_sphere_impact, ) - from anysolver.dynamics import TransientConfig + from anyfesolver.dynamics import TransientConfig model = _contact_panel() result = solve_transient_sphere_impact( @@ -2703,10 +2703,10 @@ def render_markdown(report: Mapping[str, Any]) -> str: "", "```powershell", "$env:PYPARDISO_MKL_RT = ''", - "$harness = 'C:\\Github\\ANYsolver-verification\\scripts\\verify_sol_ultra_numerics.py'", - "C:\\Github\\ANYsolver\\.venv\\Scripts\\python.exe $harness capture --solver-root C:\\Github\\ANYsolver-baseline --label baseline --suite full --output baseline.json", - "C:\\Github\\ANYsolver\\.venv\\Scripts\\python.exe $harness capture --solver-root C:\\Github\\ANYsolver-candidate --label candidate --suite full --output candidate.json", - "C:\\Github\\ANYsolver\\.venv\\Scripts\\python.exe $harness compare --baseline baseline.json --candidate candidate.json", + "$harness = 'C:\\Github\\ANYfeSolver-verification\\scripts\\verify_sol_ultra_numerics.py'", + "C:\\Github\\ANYfeSolver\\.venv\\Scripts\\python.exe $harness capture --solver-root C:\\Github\\ANYfeSolver-baseline --label baseline --suite full --output baseline.json", + "C:\\Github\\ANYfeSolver\\.venv\\Scripts\\python.exe $harness capture --solver-root C:\\Github\\ANYfeSolver-candidate --label candidate --suite full --output candidate.json", + "C:\\Github\\ANYfeSolver\\.venv\\Scripts\\python.exe $harness compare --baseline baseline.json --candidate candidate.json", "```", "", ] @@ -2778,7 +2778,7 @@ def build_parser() -> argparse.ArgumentParser: "--solver-root", type=Path, default=None, - help="exact ANYsolver checkout to import and record (defaults to the harness checkout)", + help="exact ANYfeSolver checkout to import and record (defaults to the harness checkout)", ) capture.add_argument("--suite", choices=tuple(SUITE_LEVEL), default="full") capture.add_argument( diff --git a/scripts/write_production_readiness.py b/scripts/write_production_readiness.py index 6c1eb1f1d..2f4be2b84 100644 --- a/scripts/write_production_readiness.py +++ b/scripts/write_production_readiness.py @@ -11,7 +11,7 @@ if str(SRC) not in sys.path: sys.path.insert(0, str(SRC)) -from anysolver.production_readiness import DEFAULT_PRODUCTION_READINESS_DIR, write_production_readiness_artifacts +from anyfesolver.production_readiness import DEFAULT_PRODUCTION_READINESS_DIR, write_production_readiness_artifacts def main() -> int: diff --git a/setup.py b/setup.py index 2277676be..5f3ab2677 100644 --- a/setup.py +++ b/setup.py @@ -6,13 +6,21 @@ import sys from setuptools import Extension,setup +def native_guard_enabled(environ=os.environ): + """New name wins; the pre-rename name is honoured only when it is absent.""" + for name in ('ANYFESOLVER_BUILD_NATIVE_GUARD','ANYSOLVER_BUILD_NATIVE_GUARD'): + if name in environ: + return environ[name]!='0' + return True + extensions=[] if (sys.platform=='win32' and sys.version_info[:2]==(3,11) and platform.machine().upper() in ('AMD64','X86_64') - and os.environ.get('ANYSOLVER_BUILD_NATIVE_GUARD','1')!='0'): - source=Path('src/anysolver/_native_guard.cpp') + and native_guard_enabled()): + source=Path('src/anyfesolver/_native_guard.cpp') digest=hashlib.sha256(source.read_bytes()).hexdigest() - extensions=[Extension('anysolver._native_guard',[str(source)],language='c++',optional=True, + # The unchanged C++ source reads ANYSOLVER_GUARD_SOURCE_SHA; that is its macro name. + extensions=[Extension('anyfesolver._native_guard',[str(source)],language='c++',optional=True, define_macros=[('ANYSOLVER_GUARD_SOURCE_SHA','"'+digest+'"')], extra_compile_args=['/std:c++17','/O2','/EHsc'])] setup(ext_modules=extensions) diff --git a/src/anysolver/__init__.py b/src/anyfesolver/__init__.py similarity index 99% rename from src/anysolver/__init__.py rename to src/anyfesolver/__init__.py index b5a171c5d..9c4850f8f 100644 --- a/src/anysolver/__init__.py +++ b/src/anyfesolver/__init__.py @@ -1,4 +1,4 @@ -"""ANYsolver beam/shell finite-element package. +"""ANYfeSolver beam/shell finite-element package. The package provides native model/element/load objects, separate matrix assembly, constrained and free-free linear solves, mass/modal and eigenvalue @@ -534,7 +534,7 @@ write_sesam_fem_document, ) -__version__ = "0.4.7" +__version__ = "0.5.0" __all__ = [ "RigidCappedCylinder", diff --git a/src/anysolver/_b2_attachment_elimination_dev.py b/src/anyfesolver/_b2_attachment_elimination_dev.py similarity index 100% rename from src/anysolver/_b2_attachment_elimination_dev.py rename to src/anyfesolver/_b2_attachment_elimination_dev.py diff --git a/src/anysolver/_b2_f10_f11_point_attachment.py b/src/anyfesolver/_b2_f10_f11_point_attachment.py similarity index 100% rename from src/anysolver/_b2_f10_f11_point_attachment.py rename to src/anyfesolver/_b2_f10_f11_point_attachment.py diff --git a/src/anysolver/_b2_loaded_point_trace_dev.py b/src/anyfesolver/_b2_loaded_point_trace_dev.py similarity index 100% rename from src/anysolver/_b2_loaded_point_trace_dev.py rename to src/anyfesolver/_b2_loaded_point_trace_dev.py diff --git a/src/anysolver/_b2_physical_flexibility_linear.py b/src/anyfesolver/_b2_physical_flexibility_linear.py similarity index 100% rename from src/anysolver/_b2_physical_flexibility_linear.py rename to src/anyfesolver/_b2_physical_flexibility_linear.py diff --git a/src/anysolver/_b2_physical_linear_batch_dev.py b/src/anyfesolver/_b2_physical_linear_batch_dev.py similarity index 100% rename from src/anysolver/_b2_physical_linear_batch_dev.py rename to src/anyfesolver/_b2_physical_linear_batch_dev.py diff --git a/src/anysolver/_b2_physical_linear_definition.py b/src/anyfesolver/_b2_physical_linear_definition.py similarity index 100% rename from src/anysolver/_b2_physical_linear_definition.py rename to src/anyfesolver/_b2_physical_linear_definition.py diff --git a/src/anysolver/_b2_physical_load_bubbles.py b/src/anyfesolver/_b2_physical_load_bubbles.py similarity index 100% rename from src/anysolver/_b2_physical_load_bubbles.py rename to src/anyfesolver/_b2_physical_load_bubbles.py diff --git a/src/anysolver/_compensated_contractions.py b/src/anyfesolver/_compensated_contractions.py similarity index 97% rename from src/anysolver/_compensated_contractions.py rename to src/anyfesolver/_compensated_contractions.py index e82e10b1f..6f0bce4a3 100644 --- a/src/anysolver/_compensated_contractions.py +++ b/src/anyfesolver/_compensated_contractions.py @@ -1,497 +1,497 @@ -"""Finite, fixed-order element-local contractions (no BLAS dispatch). - -Products are split on normalized binary64 mantissas with Dekker's transform; -both parts are accumulated with ``math.fsum`` in ascending index order. -No exact-rounding claim is made: scaling a residual into the subnormal range -can lose at most one minimum subnormal per product, and fsum has its documented -platform double-rounding limitation. Exact cancellation/empty sums give +0. -Nonfinite inputs and overflowing individual products or sums are refused, -even when a wider exact accumulator could cancel an intermediate overflow. -There is no precision option, persistent result cache or fallback that changes -a value. Optional compiled kernels (``_compensated_native``, Numba) execute the -same arithmetic bit for bit; they are enabled only when Numba is present and a -known-answer self-check at import reproduces the numpy path bitwise (it guards -against fused multiply-add contraction). Any refusal replays the numpy path so -the reference exception is raised. -""" -from math import frexp as _frexp, fsum as _fsum, isfinite as _isfinite, ldexp as _ldexp - -import os -from types import MappingProxyType as _MappingProxyType - -import numpy as np - -from . import _compensated_native as _native - -# Compiled kernels run the identical arithmetic (see _compensated_native); a -# nonzero kernel status replays the vectorised path, which raises the reference -# exception. ANYSOLVER_NATIVE_CONTRACTIONS=0 forces the numpy path. -_USE_NATIVE = _native.AVAILABLE and os.environ.get("ANYSOLVER_NATIVE_CONTRACTIONS", "1") != "0" -# The fused element kernels additionally need their own known-answer match -# (checked at import below); ANYSOLVER_NATIVE_CONTRACTIONS=0 disables both. -_USE_FUSED = _USE_NATIVE - - -def _product_parts(a, b): - if not _isfinite(a) or not _isfinite(b): - raise ValueError("compensated contraction requires finite inputs") - product = a * b - if not _isfinite(product): - raise OverflowError("compensated product overflow") - if a == 0.0 or b == 0.0: - return product, 0.0 - x, ex = _frexp(a) - y, ey = _frexp(b) - split = 134217729.0 - cx, cy = split * x, split * y - xh, yh = cx - (cx - x), cy - (cy - y) - xl, yl = x - xh, y - yh - high = x * y - low = ((xh * yh - high) + xh * yl + xl * yh) + xl * yl - # In the normal range power-of-two scaling is exact. In the subnormal - # range the rounded product need not equal a doubly rounded scaled high; - # the contract allows that lost half-ulp and scaled-low rounding (<= one - # minimum subnormal together), rather than claiming an exact expansion. - return product, _ldexp(low, ex + ey) - - -_SPLIT = 134217729.0 - - -def _vector_parts(a, b): - """Elementwise ``_product_parts`` for finite broadcastable arrays. - - Same IEEE operations in the same order as the scalar routine, so the - (product, residual) pairs are bitwise identical. Refuses nonfinite inputs - and overflowing products with the scalar routine's exceptions. - """ - with np.errstate(all="ignore"): - product = a * b - if not (np.all(np.isfinite(a)) and np.all(np.isfinite(b)) - and np.all(np.isfinite(product))): - # Rare error path: reproduce the scalar first-failure semantics. - for x, y in zip(np.broadcast_to(a, product.shape).ravel().tolist(), - np.broadcast_to(b, product.shape).ravel().tolist()): - _product_parts(x, y) - x, ex = np.frexp(a) - y, ey = np.frexp(b) - cx, cy = _SPLIT * x, _SPLIT * y - xh, yh = cx - (cx - x), cy - (cy - y) - xl, yl = x - xh, y - yh - high = x * y - low = ((xh * yh - high) + xh * yl + xl * yh) + xl * yl - low = np.ldexp(low, ex + ey) - low = np.where((a == 0.0) | (b == 0.0), 0.0, low) - return product, low - - -def _interleave_sum(product, low): - """fsum of ``[p0, l0, p1, l1, ...]`` along the last axis, as the scalar dot.""" - lead = product.shape[:-1] - count = product.shape[-1] - parts = np.empty((product.size // max(count, 1), 2 * count), dtype=float) - parts[:, 0::2] = product.reshape(-1, count) - parts[:, 1::2] = low.reshape(-1, count) - values = np.array(list(map(_fsum, parts.tolist())), dtype=float) - if not np.all(np.isfinite(values)): - raise OverflowError("compensated sum overflow") - return values.reshape(lead) - - -def dot(left, right): - if len(left) != len(right): - raise ValueError("compensated dot shape mismatch") - a = np.array([float(v) for v in left], dtype=float) - b = np.array([float(v) for v in right], dtype=float) - if a.size == 0: - return 0.0 - product, low = _vector_parts(a, b) - return float(_interleave_sum(product, low)) - - -def product(left, right): - """Matrix/matrix or matrix/vector product; each dot uses the same policy.""" - a, b = np.asarray(left, dtype=float), np.asarray(right, dtype=float) - if a.ndim != 2 or b.ndim not in (1, 2) or a.shape[1] != b.shape[0]: - raise ValueError("compensated product shape mismatch") - vector = b.ndim == 1 - columns = b.reshape((-1, 1)) if vector else b - if _USE_NATIVE: - # The kernel refuses nonfinite input itself; any refusal falls through - # to the checks below, which raise the reference exception. - native = np.empty((a.shape[0], columns.shape[1]), dtype=float) - if _native.contract_product(np.ascontiguousarray(a), np.ascontiguousarray(columns), - native, _native.POW2) == 0: - return native[:, 0] if vector else native - if not np.all(np.isfinite(a)) or not np.all(np.isfinite(b)): - raise ValueError("compensated product requires finite inputs") - result = np.zeros((a.shape[0], columns.shape[1]), dtype=float) - # Terms with an all-zero operand slice are exact zeros in every dot and - # cannot change an exactly rounded sum. - keep = np.any(a != 0.0, axis=0) & np.any(columns != 0.0, axis=1) - # Overflow in a pruned term would still be refused by the scalar policy - # only if both factors were nonzero, so pruning never hides an error. - if keep.any(): - a, columns = a[:, keep], columns[keep] - prod, low = _vector_parts(a[:, None, :], columns.T[None, :, :]) - result = _interleave_sum(prod, low) - return result[:, 0] if vector else result - - -def sum_arrays(terms): - """Fixed-order componentwise sum of already represented equal-shape terms.""" - arrays = [np.asarray(term, dtype=float) for term in terms] - if not arrays or any(a.shape != arrays[0].shape for a in arrays): - raise ValueError("compensated array sum requires equal nonempty shapes") - shape = arrays[0].shape - if _USE_NATIVE: - # contract_sum refuses overflow only; nonfinite input is screened here - # on the single stacked array instead of once per term. - stack = np.ascontiguousarray(np.stack(arrays).reshape(len(arrays), -1)) - if np.isfinite(stack).all(): - native = np.empty(stack.shape[1], dtype=float) - if _native.contract_sum(stack, native) == 0: - return native.reshape(shape) - if any(not np.all(np.isfinite(a)) for a in arrays): - raise ValueError("compensated array sum requires finite inputs") - rows = np.stack(arrays).reshape(len(arrays), -1).T.tolist() - result = np.array(list(map(_fsum, rows)), dtype=float).reshape(shape) - if not np.all(np.isfinite(result)): - raise OverflowError("compensated array sum overflow") - return result - - -def weighted_sum(terms, weights): - """Quadrature reduction including compensation of each weight product.""" - arrays = [np.asarray(term, dtype=float) for term in terms] - if not arrays or len(arrays) != len(weights) or any(a.shape != arrays[0].shape for a in arrays): - raise ValueError("compensated weighted sum shape mismatch") - shape = arrays[0].shape - try: - if _USE_NATIVE: - flat = np.ascontiguousarray(np.stack(arrays).reshape(len(arrays), -1)) - w = np.array([float(v) for v in weights], dtype=float) - native = np.empty(flat.shape[1], dtype=float) - if _native.contract_weighted(flat, w, native, _native.POW2) == 0: - return native.reshape(shape) - stacked = np.stack(arrays).reshape(len(arrays), -1).T - w = np.array([float(v) for v in weights], dtype=float) - prod, low = _vector_parts(stacked, w[None, :]) - return _interleave_sum(prod, low).reshape(shape) - except (ValueError, OverflowError): - # Refused input: replay index by index so the first failure (and its - # exception type) is the one the scalar policy reports. - result = np.empty(shape, dtype=float) - for index in np.ndindex(shape): - result[index] = _scalar_dot([a[index] for a in arrays], weights) - return result - - -def _scalar_dot(left, right): - parts = [] - for a, b in zip(left, right): - parts.extend(_product_parts(float(a), float(b))) - result = _fsum(parts) - if not _isfinite(result): - raise OverflowError("compensated sum overflow") - return result - - -def _shell_zero_tangent_reference(geometry, membrane, bending, shear, drill): - """Contract independently supplied elastic coefficients on frozen geometry.""" - terms, weights = [], [] - for bm, bb, bd, weight in zip(geometry["B_m_all"], geometry["B_b_all"], - geometry["B_d_all"], geometry["detw_all"]): - terms.append(sum_arrays((product(product(bm.T, membrane), bm), - product(product(bb.T, bending), bb), - product(bd.T, drill * bd)))) - weights.append(weight) - for bs, weight in zip(geometry["B_s_all"], geometry["detw_shear_all"]): - terms.append(product(product(bs.T, shear), bs)) - weights.append(weight) - local = weighted_sum(terms, weights) - transform = geometry["T0"] - return product(product(transform.T, local), transform) - - -def _increment(u_elem, geometry, constitutive_factory, tangent, use_kernel): - """Elastic von-Karman increment: the reference evaluation order, optionally fused. - - Order (identical for both routes): read ``T0``; the displacement product - (its result ``u`` is computed once and reused); one coefficient evaluation; - only then, at the moment of choosing, the numpy error policy is read and the - compiled kernel is tried with ``u`` and the cached coefficients. A policy - that is not default-or-ignore, non-conforming input or any kernel refusal - falls through to the reference loop below with the same ``u``/coefficients. - """ - transform = geometry["T0"] - u = product(transform, u_elem) - constitutive = constitutive_factory() - if use_kernel and _fused_policy_allows(): - fused = _increment_fused(transform, u, geometry, constitutive, tangent) - if fused is not None: - return fused - force = np.zeros(u.size, dtype=float) - material = np.zeros((u.size, u.size), dtype=float) - geometric = np.zeros((u.size, u.size), dtype=float) - forces, materials, geometrics = [], [], [] - weights = [] - for B, G, weight in zip(geometry["B_m_all"], geometry["Gw_all"], - geometry["detw_all"]): - theta = product(G, u) - eta = np.array((0.5 * theta[0]**2, 0.5 * theta[1]**2, - theta[0] * theta[1]), dtype=float) - H = np.vstack((theta[0] * G[0], theta[1] * G[1], - theta[0] * G[1] + theta[1] * G[0])) - linear_stress = product(constitutive, product(B, u)) - nonlinear_stress = product(constitutive, eta) - forces.append(sum_arrays((product(B.T, nonlinear_stress), - product(H.T, linear_stress), - product(H.T, nonlinear_stress)))) - weights.append(weight) - if tangent: - materials.append(sum_arrays((product(product(B.T, constitutive), H), - product(product(H.T, constitutive), B), - product(product(H.T, constitutive), H)))) - stress = sum_arrays((linear_stress, nonlinear_stress)) - geometrics.append(sum_arrays((stress[0] * np.outer(G[0], G[0]), - stress[1] * np.outer(G[1], G[1]), - stress[2] * np.outer(G[0], G[1]), - stress[2] * np.outer(G[1], G[0])))) - if forces: - force = weighted_sum(forces, weights) - if tangent and materials: - material = weighted_sum(materials, weights) - geometric = weighted_sum(geometrics, weights) - return (product(transform.T, force), product(product(transform.T, material), transform), - product(product(transform.T, geometric), transform)) - - -def elastic_increment_reference(u_elem, geometry, constitutive_factory, tangent): - """Reference (numpy-level) elastic von-Karman increment; see vectorized_nonlinear.""" - return _increment(u_elem, geometry, constitutive_factory, tangent, False) - - -def elastic_increment(u_elem, geometry, constitutive_factory, tangent): - """The same increment with the compiled kernel tried after the coefficient evaluation.""" - return _increment(u_elem, geometry, constitutive_factory, tangent, True) - - -def _fused_array(value, shape_tail): - """Writable C float64 array of exactly ``1 + len(shape_tail)`` dims, or ``None``.""" - if (type(value) is not np.ndarray or value.dtype != np.float64 - or value.ndim != len(shape_tail) + 1 or value.shape[1:] != shape_tail): - return None - if value.flags.c_contiguous and value.flags.writeable: - return value - return np.array(value, dtype=np.float64, order="C") - - -# Exact mapping types the qualified route supplies (frozen geometry is a mappingproxy). -_GEOMETRY_TYPES = (dict, _MappingProxyType) - - -def _fused_matrix(value, shape): - """Writable C float64 copy-or-view of an exact ndarray with exactly ``shape``, or ``None``.""" - if type(value) is not np.ndarray or value.dtype != np.float64 or value.shape != shape: - return None - if value.flags.c_contiguous and value.flags.writeable: - return value - return np.array(value, dtype=np.float64, order="C") - - -def _fused_scalar(value): - if type(value) in (float, np.float64): - return float(value) - return None - - -def _fused_policy_allows(): - """Fused kernels run only under numpy's default-or-ignore floating-point policy. - - The reference performs plain numpy multiplies (e.g. ``drill * bd``) for which - numpy may warn, raise or call back on underflow; the compiled multiplies - cannot. Overflow/invalid always make the kernel refuse (the nonfinite value - reaches a compensated product or sum), so the reference replays and reports - them itself. Any other policy runs the reference. - """ - if not (_USE_NATIVE and _USE_FUSED): - return False - policy = np.geterr() - return (policy["under"] == "ignore" - and all(policy[kind] in ("ignore", "warn") for kind in ("over", "divide", "invalid"))) - - -def _zero_tangent_args(geometry, membrane, bending, shear, drill): - """Kernel arguments for ``shell_zero_tangent``, or ``None`` for any non-conforming input.""" - try: - if type(geometry) not in _GEOMETRY_TYPES: - return None - t0 = geometry["T0"] - n = t0.shape[0] if type(t0) is np.ndarray and t0.ndim == 2 else -1 - if n <= 0: - return None - arrays = (_fused_array(geometry["B_m_all"], (3, n)), _fused_array(geometry["B_b_all"], (3, n)), - _fused_array(geometry["B_d_all"], (1, n)), _fused_array(geometry["detw_all"], ()), - _fused_array(geometry["B_s_all"], (2, n)), _fused_array(geometry["detw_shear_all"], ()), - _fused_matrix(t0, (n, n)), _fused_matrix(membrane, (3, 3)), - _fused_matrix(bending, (3, 3)), _fused_matrix(shear, (2, 2))) - drill_value = _fused_scalar(drill) - if (drill_value is None or any(a is None for a in arrays) - or not len(arrays[0]) == len(arrays[1]) == len(arrays[2]) == len(arrays[3]) - or len(arrays[4]) != len(arrays[5]) or len(arrays[0]) + len(arrays[4]) == 0): - return None - return (arrays[0], arrays[1], arrays[2], arrays[3], arrays[4], arrays[5], - arrays[6], arrays[7], arrays[8], arrays[9], drill_value) - except Exception: # noqa: BLE001 - anything unexpected is the reference's to report - return None - - -def _zero_tangent_fused(geometry, membrane, bending, shear, drill): - """Run the compiled kernel; ``None`` when not applicable or refused.""" - args = _zero_tangent_args(geometry, membrane, bending, shear, drill) - if args is None: - return None - out = np.empty((args[6].shape[0],) * 2, dtype=np.float64) - if _native.fused_shell_zero_tangent(*args, out, _native.POW2) != 0: - return None - return out - - -def shell_zero_tangent(geometry, membrane, bending, shear, drill): - """Contract independently supplied elastic coefficients on frozen geometry. - - One compiled call per element when the inputs have the expected float64 - layout; anything else, or any refusal, runs the reference implementation. - """ - if _fused_policy_allows(): - fused = _zero_tangent_fused(geometry, membrane, bending, shear, drill) - if fused is not None: - return fused - return _shell_zero_tangent_reference(geometry, membrane, bending, shear, drill) - - -def _increment_fused(transform, u, geometry, constitutive, tangent): - """Run the compiled increment kernel on the already computed ``u``; ``None`` if not applicable.""" - try: - if type(geometry) not in _GEOMETRY_TYPES or type(tangent) is not bool: - return None - n = transform.shape[0] if type(transform) is np.ndarray and transform.ndim == 2 else -1 - if n <= 0: - return None - arrays = (_fused_matrix(transform, (n, n)), _fused_matrix(u, (n,)), - _fused_matrix(constitutive, (3, 3)), _fused_array(geometry["B_m_all"], (3, n)), - _fused_array(geometry["Gw_all"], (2, n)), _fused_array(geometry["detw_all"], ())) - if (any(a is None for a in arrays) - or not len(arrays[3]) == len(arrays[4]) == len(arrays[5]) > 0): - return None - except Exception: # noqa: BLE001 - anything unexpected is the reference's to report - return None - force = np.empty(n, dtype=np.float64) - material = np.zeros((n, n), dtype=np.float64) - geometric = np.zeros((n, n), dtype=np.float64) - if _native.fused_elastic_increment( - arrays[0], arrays[1], arrays[2], arrays[3], arrays[4], arrays[5], tangent, - force, material, geometric, _native.POW2, 2.0) != 0: - return None - return force, material, geometric - - -def _native_known_answers_match(): - """Disable the compiled kernels unless they reproduce the numpy path bitwise.""" - global _USE_NATIVE - if not _USE_NATIVE: - return - rng = np.random.default_rng(20261022) - a = rng.standard_normal((7, 9)) * 2.0 ** rng.integers(-40, 40, (7, 9)) - b = rng.standard_normal((9, 6)) * 2.0 ** rng.integers(-40, 40, (9, 6)) - stack = rng.standard_normal((5, 11)) * 2.0 ** rng.integers(-40, 40, (5, 11)) * 1e8 - stack[1] = -stack[0] * (1.0 + 2.0 ** -40) - weights = rng.standard_normal(5) - results = [] - for use in (True, False): - _USE_NATIVE = use - try: - results.append((product(a, b).tobytes(), sum_arrays(list(stack)).tobytes(), - weighted_sum(list(stack), weights).tobytes())) - except Exception: # noqa: BLE001 - any failure disables the kernels - results.append(None) - _USE_NATIVE = results[0] is not None and results[0] == results[1] - - -_native_known_answers_match() - - -def _fused_cases(): - """Deterministic known-answer inputs (also exercised by the tests).""" - rng = np.random.default_rng(20261023) - for case in range(3): - n, ng, ns = 24, 4, 4 - scale = (1.0, 2.0 ** 20, 2.0 ** -30)[case] - - def rnd(*shape): - return rng.standard_normal(shape) * 2.0 ** rng.integers(-3, 4, shape) * scale - - geometry = {"B_m_all": rnd(ng, 3, n), "B_b_all": rnd(ng, 3, n), "B_d_all": rnd(ng, 1, n), - "Gw_all": rnd(ng, 2, n), "B_s_all": rnd(ns, 2, n), "T0": rnd(n, n), - "detw_all": np.abs(rnd(ng)) + 0.1, "detw_shear_all": np.abs(rnd(ns)) + 0.1} - yield (geometry, rnd(3, 3), rnd(3, 3), rnd(2, 2), float(rnd(1)[0]), - rnd(n) * 1e-2, rnd(3, 3) * 1e3) - # Squares where libm pow differs from x * x: for identity-like Gw rows theta - # equals u exactly, so the kernel's scalar square is exercised on them. - hits = [float(v) for v in np.random.default_rng(7).uniform(1.0, 2.0, 60000) - if np.float64(v) ** 2 != v * v][:4] - n = 6 - geometry = {"B_m_all": np.ones((1, 3, n)), "B_b_all": np.ones((1, 3, n)), "B_d_all": np.ones((1, 1, n)), - "Gw_all": np.zeros((1, 2, n)), "B_s_all": np.ones((1, 2, n)), "T0": np.eye(n), - "detw_all": np.ones(1), "detw_shear_all": np.ones(1)} - geometry["Gw_all"][0, 0, 0] = geometry["Gw_all"][0, 1, 1] = 1.0 - for x in hits or [1.5]: - u = np.zeros(n) - u[0], u[1] = x, x - yield geometry, np.eye(3), np.eye(3), np.eye(2), 0.5, u, np.eye(3) * 1e3 - - -def _fused_check(zero_kernel, increment_kernel): - """True iff the given compiled kernels reproduce the reference bitwise *and run*. - - Calls the kernels directly (never the fallback-capable wrappers), so a - kernel that always refuses fails the check. - """ - try: - for geometry, membrane, bending, shear, drill, u_elem, constitutive in _fused_cases(): - args = _zero_tangent_args(geometry, membrane, bending, shear, drill) - if args is None: - return False - out = np.empty((args[6].shape[0],) * 2) - if zero_kernel(*args, out, _native.POW2) != 0: - return False - if out.tobytes() != _shell_zero_tangent_reference( - geometry, membrane, bending, shear, drill).tobytes(): - return False - u = product(geometry["T0"], u_elem) - for tangent in (True, False): - n = geometry["T0"].shape[0] - f, m, g = np.empty(n), np.zeros((n, n)), np.zeros((n, n)) - if increment_kernel(geometry["T0"], u, constitutive, geometry["B_m_all"], - geometry["Gw_all"], geometry["detw_all"], tangent, - f, m, g, _native.POW2, 2.0) != 0: - return False - ref = elastic_increment_reference(u_elem, geometry, lambda: constitutive, tangent) - if any(x.tobytes() != y.tobytes() for x, y in zip((f, m, g), ref)): - return False - return True - except Exception: # noqa: BLE001 - any failure disables the fused kernels - return False - - -def _fused_known_answers_match(): - """Disable the fused element kernels unless they reproduce the reference bitwise.""" - global _USE_FUSED - if not _USE_FUSED: - return - with np.errstate(all="ignore"): - _USE_FUSED = _fused_check(_native.fused_shell_zero_tangent, _native.fused_elastic_increment) - - -_fused_known_answers_match() +"""Finite, fixed-order element-local contractions (no BLAS dispatch). + +Products are split on normalized binary64 mantissas with Dekker's transform; +both parts are accumulated with ``math.fsum`` in ascending index order. +No exact-rounding claim is made: scaling a residual into the subnormal range +can lose at most one minimum subnormal per product, and fsum has its documented +platform double-rounding limitation. Exact cancellation/empty sums give +0. +Nonfinite inputs and overflowing individual products or sums are refused, +even when a wider exact accumulator could cancel an intermediate overflow. +There is no precision option, persistent result cache or fallback that changes +a value. Optional compiled kernels (``_compensated_native``, Numba) execute the +same arithmetic bit for bit; they are enabled only when Numba is present and a +known-answer self-check at import reproduces the numpy path bitwise (it guards +against fused multiply-add contraction). Any refusal replays the numpy path so +the reference exception is raised. +""" +from math import frexp as _frexp, fsum as _fsum, isfinite as _isfinite, ldexp as _ldexp + +import os +from types import MappingProxyType as _MappingProxyType + +import numpy as np + +from . import _compensated_native as _native + +# Compiled kernels run the identical arithmetic (see _compensated_native); a +# nonzero kernel status replays the vectorised path, which raises the reference +# exception. ANYSOLVER_NATIVE_CONTRACTIONS=0 forces the numpy path. +_USE_NATIVE = _native.AVAILABLE and os.environ.get("ANYSOLVER_NATIVE_CONTRACTIONS", "1") != "0" +# The fused element kernels additionally need their own known-answer match +# (checked at import below); ANYSOLVER_NATIVE_CONTRACTIONS=0 disables both. +_USE_FUSED = _USE_NATIVE + + +def _product_parts(a, b): + if not _isfinite(a) or not _isfinite(b): + raise ValueError("compensated contraction requires finite inputs") + product = a * b + if not _isfinite(product): + raise OverflowError("compensated product overflow") + if a == 0.0 or b == 0.0: + return product, 0.0 + x, ex = _frexp(a) + y, ey = _frexp(b) + split = 134217729.0 + cx, cy = split * x, split * y + xh, yh = cx - (cx - x), cy - (cy - y) + xl, yl = x - xh, y - yh + high = x * y + low = ((xh * yh - high) + xh * yl + xl * yh) + xl * yl + # In the normal range power-of-two scaling is exact. In the subnormal + # range the rounded product need not equal a doubly rounded scaled high; + # the contract allows that lost half-ulp and scaled-low rounding (<= one + # minimum subnormal together), rather than claiming an exact expansion. + return product, _ldexp(low, ex + ey) + + +_SPLIT = 134217729.0 + + +def _vector_parts(a, b): + """Elementwise ``_product_parts`` for finite broadcastable arrays. + + Same IEEE operations in the same order as the scalar routine, so the + (product, residual) pairs are bitwise identical. Refuses nonfinite inputs + and overflowing products with the scalar routine's exceptions. + """ + with np.errstate(all="ignore"): + product = a * b + if not (np.all(np.isfinite(a)) and np.all(np.isfinite(b)) + and np.all(np.isfinite(product))): + # Rare error path: reproduce the scalar first-failure semantics. + for x, y in zip(np.broadcast_to(a, product.shape).ravel().tolist(), + np.broadcast_to(b, product.shape).ravel().tolist()): + _product_parts(x, y) + x, ex = np.frexp(a) + y, ey = np.frexp(b) + cx, cy = _SPLIT * x, _SPLIT * y + xh, yh = cx - (cx - x), cy - (cy - y) + xl, yl = x - xh, y - yh + high = x * y + low = ((xh * yh - high) + xh * yl + xl * yh) + xl * yl + low = np.ldexp(low, ex + ey) + low = np.where((a == 0.0) | (b == 0.0), 0.0, low) + return product, low + + +def _interleave_sum(product, low): + """fsum of ``[p0, l0, p1, l1, ...]`` along the last axis, as the scalar dot.""" + lead = product.shape[:-1] + count = product.shape[-1] + parts = np.empty((product.size // max(count, 1), 2 * count), dtype=float) + parts[:, 0::2] = product.reshape(-1, count) + parts[:, 1::2] = low.reshape(-1, count) + values = np.array(list(map(_fsum, parts.tolist())), dtype=float) + if not np.all(np.isfinite(values)): + raise OverflowError("compensated sum overflow") + return values.reshape(lead) + + +def dot(left, right): + if len(left) != len(right): + raise ValueError("compensated dot shape mismatch") + a = np.array([float(v) for v in left], dtype=float) + b = np.array([float(v) for v in right], dtype=float) + if a.size == 0: + return 0.0 + product, low = _vector_parts(a, b) + return float(_interleave_sum(product, low)) + + +def product(left, right): + """Matrix/matrix or matrix/vector product; each dot uses the same policy.""" + a, b = np.asarray(left, dtype=float), np.asarray(right, dtype=float) + if a.ndim != 2 or b.ndim not in (1, 2) or a.shape[1] != b.shape[0]: + raise ValueError("compensated product shape mismatch") + vector = b.ndim == 1 + columns = b.reshape((-1, 1)) if vector else b + if _USE_NATIVE: + # The kernel refuses nonfinite input itself; any refusal falls through + # to the checks below, which raise the reference exception. + native = np.empty((a.shape[0], columns.shape[1]), dtype=float) + if _native.contract_product(np.ascontiguousarray(a), np.ascontiguousarray(columns), + native, _native.POW2) == 0: + return native[:, 0] if vector else native + if not np.all(np.isfinite(a)) or not np.all(np.isfinite(b)): + raise ValueError("compensated product requires finite inputs") + result = np.zeros((a.shape[0], columns.shape[1]), dtype=float) + # Terms with an all-zero operand slice are exact zeros in every dot and + # cannot change an exactly rounded sum. + keep = np.any(a != 0.0, axis=0) & np.any(columns != 0.0, axis=1) + # Overflow in a pruned term would still be refused by the scalar policy + # only if both factors were nonzero, so pruning never hides an error. + if keep.any(): + a, columns = a[:, keep], columns[keep] + prod, low = _vector_parts(a[:, None, :], columns.T[None, :, :]) + result = _interleave_sum(prod, low) + return result[:, 0] if vector else result + + +def sum_arrays(terms): + """Fixed-order componentwise sum of already represented equal-shape terms.""" + arrays = [np.asarray(term, dtype=float) for term in terms] + if not arrays or any(a.shape != arrays[0].shape for a in arrays): + raise ValueError("compensated array sum requires equal nonempty shapes") + shape = arrays[0].shape + if _USE_NATIVE: + # contract_sum refuses overflow only; nonfinite input is screened here + # on the single stacked array instead of once per term. + stack = np.ascontiguousarray(np.stack(arrays).reshape(len(arrays), -1)) + if np.isfinite(stack).all(): + native = np.empty(stack.shape[1], dtype=float) + if _native.contract_sum(stack, native) == 0: + return native.reshape(shape) + if any(not np.all(np.isfinite(a)) for a in arrays): + raise ValueError("compensated array sum requires finite inputs") + rows = np.stack(arrays).reshape(len(arrays), -1).T.tolist() + result = np.array(list(map(_fsum, rows)), dtype=float).reshape(shape) + if not np.all(np.isfinite(result)): + raise OverflowError("compensated array sum overflow") + return result + + +def weighted_sum(terms, weights): + """Quadrature reduction including compensation of each weight product.""" + arrays = [np.asarray(term, dtype=float) for term in terms] + if not arrays or len(arrays) != len(weights) or any(a.shape != arrays[0].shape for a in arrays): + raise ValueError("compensated weighted sum shape mismatch") + shape = arrays[0].shape + try: + if _USE_NATIVE: + flat = np.ascontiguousarray(np.stack(arrays).reshape(len(arrays), -1)) + w = np.array([float(v) for v in weights], dtype=float) + native = np.empty(flat.shape[1], dtype=float) + if _native.contract_weighted(flat, w, native, _native.POW2) == 0: + return native.reshape(shape) + stacked = np.stack(arrays).reshape(len(arrays), -1).T + w = np.array([float(v) for v in weights], dtype=float) + prod, low = _vector_parts(stacked, w[None, :]) + return _interleave_sum(prod, low).reshape(shape) + except (ValueError, OverflowError): + # Refused input: replay index by index so the first failure (and its + # exception type) is the one the scalar policy reports. + result = np.empty(shape, dtype=float) + for index in np.ndindex(shape): + result[index] = _scalar_dot([a[index] for a in arrays], weights) + return result + + +def _scalar_dot(left, right): + parts = [] + for a, b in zip(left, right): + parts.extend(_product_parts(float(a), float(b))) + result = _fsum(parts) + if not _isfinite(result): + raise OverflowError("compensated sum overflow") + return result + + +def _shell_zero_tangent_reference(geometry, membrane, bending, shear, drill): + """Contract independently supplied elastic coefficients on frozen geometry.""" + terms, weights = [], [] + for bm, bb, bd, weight in zip(geometry["B_m_all"], geometry["B_b_all"], + geometry["B_d_all"], geometry["detw_all"]): + terms.append(sum_arrays((product(product(bm.T, membrane), bm), + product(product(bb.T, bending), bb), + product(bd.T, drill * bd)))) + weights.append(weight) + for bs, weight in zip(geometry["B_s_all"], geometry["detw_shear_all"]): + terms.append(product(product(bs.T, shear), bs)) + weights.append(weight) + local = weighted_sum(terms, weights) + transform = geometry["T0"] + return product(product(transform.T, local), transform) + + +def _increment(u_elem, geometry, constitutive_factory, tangent, use_kernel): + """Elastic von-Karman increment: the reference evaluation order, optionally fused. + + Order (identical for both routes): read ``T0``; the displacement product + (its result ``u`` is computed once and reused); one coefficient evaluation; + only then, at the moment of choosing, the numpy error policy is read and the + compiled kernel is tried with ``u`` and the cached coefficients. A policy + that is not default-or-ignore, non-conforming input or any kernel refusal + falls through to the reference loop below with the same ``u``/coefficients. + """ + transform = geometry["T0"] + u = product(transform, u_elem) + constitutive = constitutive_factory() + if use_kernel and _fused_policy_allows(): + fused = _increment_fused(transform, u, geometry, constitutive, tangent) + if fused is not None: + return fused + force = np.zeros(u.size, dtype=float) + material = np.zeros((u.size, u.size), dtype=float) + geometric = np.zeros((u.size, u.size), dtype=float) + forces, materials, geometrics = [], [], [] + weights = [] + for B, G, weight in zip(geometry["B_m_all"], geometry["Gw_all"], + geometry["detw_all"]): + theta = product(G, u) + eta = np.array((0.5 * theta[0]**2, 0.5 * theta[1]**2, + theta[0] * theta[1]), dtype=float) + H = np.vstack((theta[0] * G[0], theta[1] * G[1], + theta[0] * G[1] + theta[1] * G[0])) + linear_stress = product(constitutive, product(B, u)) + nonlinear_stress = product(constitutive, eta) + forces.append(sum_arrays((product(B.T, nonlinear_stress), + product(H.T, linear_stress), + product(H.T, nonlinear_stress)))) + weights.append(weight) + if tangent: + materials.append(sum_arrays((product(product(B.T, constitutive), H), + product(product(H.T, constitutive), B), + product(product(H.T, constitutive), H)))) + stress = sum_arrays((linear_stress, nonlinear_stress)) + geometrics.append(sum_arrays((stress[0] * np.outer(G[0], G[0]), + stress[1] * np.outer(G[1], G[1]), + stress[2] * np.outer(G[0], G[1]), + stress[2] * np.outer(G[1], G[0])))) + if forces: + force = weighted_sum(forces, weights) + if tangent and materials: + material = weighted_sum(materials, weights) + geometric = weighted_sum(geometrics, weights) + return (product(transform.T, force), product(product(transform.T, material), transform), + product(product(transform.T, geometric), transform)) + + +def elastic_increment_reference(u_elem, geometry, constitutive_factory, tangent): + """Reference (numpy-level) elastic von-Karman increment; see vectorized_nonlinear.""" + return _increment(u_elem, geometry, constitutive_factory, tangent, False) + + +def elastic_increment(u_elem, geometry, constitutive_factory, tangent): + """The same increment with the compiled kernel tried after the coefficient evaluation.""" + return _increment(u_elem, geometry, constitutive_factory, tangent, True) + + +def _fused_array(value, shape_tail): + """Writable C float64 array of exactly ``1 + len(shape_tail)`` dims, or ``None``.""" + if (type(value) is not np.ndarray or value.dtype != np.float64 + or value.ndim != len(shape_tail) + 1 or value.shape[1:] != shape_tail): + return None + if value.flags.c_contiguous and value.flags.writeable: + return value + return np.array(value, dtype=np.float64, order="C") + + +# Exact mapping types the qualified route supplies (frozen geometry is a mappingproxy). +_GEOMETRY_TYPES = (dict, _MappingProxyType) + + +def _fused_matrix(value, shape): + """Writable C float64 copy-or-view of an exact ndarray with exactly ``shape``, or ``None``.""" + if type(value) is not np.ndarray or value.dtype != np.float64 or value.shape != shape: + return None + if value.flags.c_contiguous and value.flags.writeable: + return value + return np.array(value, dtype=np.float64, order="C") + + +def _fused_scalar(value): + if type(value) in (float, np.float64): + return float(value) + return None + + +def _fused_policy_allows(): + """Fused kernels run only under numpy's default-or-ignore floating-point policy. + + The reference performs plain numpy multiplies (e.g. ``drill * bd``) for which + numpy may warn, raise or call back on underflow; the compiled multiplies + cannot. Overflow/invalid always make the kernel refuse (the nonfinite value + reaches a compensated product or sum), so the reference replays and reports + them itself. Any other policy runs the reference. + """ + if not (_USE_NATIVE and _USE_FUSED): + return False + policy = np.geterr() + return (policy["under"] == "ignore" + and all(policy[kind] in ("ignore", "warn") for kind in ("over", "divide", "invalid"))) + + +def _zero_tangent_args(geometry, membrane, bending, shear, drill): + """Kernel arguments for ``shell_zero_tangent``, or ``None`` for any non-conforming input.""" + try: + if type(geometry) not in _GEOMETRY_TYPES: + return None + t0 = geometry["T0"] + n = t0.shape[0] if type(t0) is np.ndarray and t0.ndim == 2 else -1 + if n <= 0: + return None + arrays = (_fused_array(geometry["B_m_all"], (3, n)), _fused_array(geometry["B_b_all"], (3, n)), + _fused_array(geometry["B_d_all"], (1, n)), _fused_array(geometry["detw_all"], ()), + _fused_array(geometry["B_s_all"], (2, n)), _fused_array(geometry["detw_shear_all"], ()), + _fused_matrix(t0, (n, n)), _fused_matrix(membrane, (3, 3)), + _fused_matrix(bending, (3, 3)), _fused_matrix(shear, (2, 2))) + drill_value = _fused_scalar(drill) + if (drill_value is None or any(a is None for a in arrays) + or not len(arrays[0]) == len(arrays[1]) == len(arrays[2]) == len(arrays[3]) + or len(arrays[4]) != len(arrays[5]) or len(arrays[0]) + len(arrays[4]) == 0): + return None + return (arrays[0], arrays[1], arrays[2], arrays[3], arrays[4], arrays[5], + arrays[6], arrays[7], arrays[8], arrays[9], drill_value) + except Exception: # noqa: BLE001 - anything unexpected is the reference's to report + return None + + +def _zero_tangent_fused(geometry, membrane, bending, shear, drill): + """Run the compiled kernel; ``None`` when not applicable or refused.""" + args = _zero_tangent_args(geometry, membrane, bending, shear, drill) + if args is None: + return None + out = np.empty((args[6].shape[0],) * 2, dtype=np.float64) + if _native.fused_shell_zero_tangent(*args, out, _native.POW2) != 0: + return None + return out + + +def shell_zero_tangent(geometry, membrane, bending, shear, drill): + """Contract independently supplied elastic coefficients on frozen geometry. + + One compiled call per element when the inputs have the expected float64 + layout; anything else, or any refusal, runs the reference implementation. + """ + if _fused_policy_allows(): + fused = _zero_tangent_fused(geometry, membrane, bending, shear, drill) + if fused is not None: + return fused + return _shell_zero_tangent_reference(geometry, membrane, bending, shear, drill) + + +def _increment_fused(transform, u, geometry, constitutive, tangent): + """Run the compiled increment kernel on the already computed ``u``; ``None`` if not applicable.""" + try: + if type(geometry) not in _GEOMETRY_TYPES or type(tangent) is not bool: + return None + n = transform.shape[0] if type(transform) is np.ndarray and transform.ndim == 2 else -1 + if n <= 0: + return None + arrays = (_fused_matrix(transform, (n, n)), _fused_matrix(u, (n,)), + _fused_matrix(constitutive, (3, 3)), _fused_array(geometry["B_m_all"], (3, n)), + _fused_array(geometry["Gw_all"], (2, n)), _fused_array(geometry["detw_all"], ())) + if (any(a is None for a in arrays) + or not len(arrays[3]) == len(arrays[4]) == len(arrays[5]) > 0): + return None + except Exception: # noqa: BLE001 - anything unexpected is the reference's to report + return None + force = np.empty(n, dtype=np.float64) + material = np.zeros((n, n), dtype=np.float64) + geometric = np.zeros((n, n), dtype=np.float64) + if _native.fused_elastic_increment( + arrays[0], arrays[1], arrays[2], arrays[3], arrays[4], arrays[5], tangent, + force, material, geometric, _native.POW2, 2.0) != 0: + return None + return force, material, geometric + + +def _native_known_answers_match(): + """Disable the compiled kernels unless they reproduce the numpy path bitwise.""" + global _USE_NATIVE + if not _USE_NATIVE: + return + rng = np.random.default_rng(20261022) + a = rng.standard_normal((7, 9)) * 2.0 ** rng.integers(-40, 40, (7, 9)) + b = rng.standard_normal((9, 6)) * 2.0 ** rng.integers(-40, 40, (9, 6)) + stack = rng.standard_normal((5, 11)) * 2.0 ** rng.integers(-40, 40, (5, 11)) * 1e8 + stack[1] = -stack[0] * (1.0 + 2.0 ** -40) + weights = rng.standard_normal(5) + results = [] + for use in (True, False): + _USE_NATIVE = use + try: + results.append((product(a, b).tobytes(), sum_arrays(list(stack)).tobytes(), + weighted_sum(list(stack), weights).tobytes())) + except Exception: # noqa: BLE001 - any failure disables the kernels + results.append(None) + _USE_NATIVE = results[0] is not None and results[0] == results[1] + + +_native_known_answers_match() + + +def _fused_cases(): + """Deterministic known-answer inputs (also exercised by the tests).""" + rng = np.random.default_rng(20261023) + for case in range(3): + n, ng, ns = 24, 4, 4 + scale = (1.0, 2.0 ** 20, 2.0 ** -30)[case] + + def rnd(*shape): + return rng.standard_normal(shape) * 2.0 ** rng.integers(-3, 4, shape) * scale + + geometry = {"B_m_all": rnd(ng, 3, n), "B_b_all": rnd(ng, 3, n), "B_d_all": rnd(ng, 1, n), + "Gw_all": rnd(ng, 2, n), "B_s_all": rnd(ns, 2, n), "T0": rnd(n, n), + "detw_all": np.abs(rnd(ng)) + 0.1, "detw_shear_all": np.abs(rnd(ns)) + 0.1} + yield (geometry, rnd(3, 3), rnd(3, 3), rnd(2, 2), float(rnd(1)[0]), + rnd(n) * 1e-2, rnd(3, 3) * 1e3) + # Squares where libm pow differs from x * x: for identity-like Gw rows theta + # equals u exactly, so the kernel's scalar square is exercised on them. + hits = [float(v) for v in np.random.default_rng(7).uniform(1.0, 2.0, 60000) + if np.float64(v) ** 2 != v * v][:4] + n = 6 + geometry = {"B_m_all": np.ones((1, 3, n)), "B_b_all": np.ones((1, 3, n)), "B_d_all": np.ones((1, 1, n)), + "Gw_all": np.zeros((1, 2, n)), "B_s_all": np.ones((1, 2, n)), "T0": np.eye(n), + "detw_all": np.ones(1), "detw_shear_all": np.ones(1)} + geometry["Gw_all"][0, 0, 0] = geometry["Gw_all"][0, 1, 1] = 1.0 + for x in hits or [1.5]: + u = np.zeros(n) + u[0], u[1] = x, x + yield geometry, np.eye(3), np.eye(3), np.eye(2), 0.5, u, np.eye(3) * 1e3 + + +def _fused_check(zero_kernel, increment_kernel): + """True iff the given compiled kernels reproduce the reference bitwise *and run*. + + Calls the kernels directly (never the fallback-capable wrappers), so a + kernel that always refuses fails the check. + """ + try: + for geometry, membrane, bending, shear, drill, u_elem, constitutive in _fused_cases(): + args = _zero_tangent_args(geometry, membrane, bending, shear, drill) + if args is None: + return False + out = np.empty((args[6].shape[0],) * 2) + if zero_kernel(*args, out, _native.POW2) != 0: + return False + if out.tobytes() != _shell_zero_tangent_reference( + geometry, membrane, bending, shear, drill).tobytes(): + return False + u = product(geometry["T0"], u_elem) + for tangent in (True, False): + n = geometry["T0"].shape[0] + f, m, g = np.empty(n), np.zeros((n, n)), np.zeros((n, n)) + if increment_kernel(geometry["T0"], u, constitutive, geometry["B_m_all"], + geometry["Gw_all"], geometry["detw_all"], tangent, + f, m, g, _native.POW2, 2.0) != 0: + return False + ref = elastic_increment_reference(u_elem, geometry, lambda: constitutive, tangent) + if any(x.tobytes() != y.tobytes() for x, y in zip((f, m, g), ref)): + return False + return True + except Exception: # noqa: BLE001 - any failure disables the fused kernels + return False + + +def _fused_known_answers_match(): + """Disable the fused element kernels unless they reproduce the reference bitwise.""" + global _USE_FUSED + if not _USE_FUSED: + return + with np.errstate(all="ignore"): + _USE_FUSED = _fused_check(_native.fused_shell_zero_tangent, _native.fused_elastic_increment) + + +_fused_known_answers_match() diff --git a/src/anysolver/_compensated_native.py b/src/anyfesolver/_compensated_native.py similarity index 100% rename from src/anysolver/_compensated_native.py rename to src/anyfesolver/_compensated_native.py diff --git a/src/anysolver/_corotational_batch.py b/src/anyfesolver/_corotational_batch.py similarity index 100% rename from src/anysolver/_corotational_batch.py rename to src/anyfesolver/_corotational_batch.py diff --git a/src/anysolver/_director_trace.py b/src/anyfesolver/_director_trace.py similarity index 100% rename from src/anysolver/_director_trace.py rename to src/anyfesolver/_director_trace.py diff --git a/src/anysolver/_dyadic_bilinear.py b/src/anyfesolver/_dyadic_bilinear.py similarity index 100% rename from src/anysolver/_dyadic_bilinear.py rename to src/anyfesolver/_dyadic_bilinear.py diff --git a/src/anysolver/_dyadic_factor_chain.py b/src/anyfesolver/_dyadic_factor_chain.py similarity index 100% rename from src/anysolver/_dyadic_factor_chain.py rename to src/anyfesolver/_dyadic_factor_chain.py diff --git a/src/anysolver/_ge_beam3_adaptive_arc_program.py b/src/anyfesolver/_ge_beam3_adaptive_arc_program.py similarity index 96% rename from src/anysolver/_ge_beam3_adaptive_arc_program.py rename to src/anyfesolver/_ge_beam3_adaptive_arc_program.py index 89a991d21..e80e9e9da 100644 --- a/src/anysolver/_ge_beam3_adaptive_arc_program.py +++ b/src/anyfesolver/_ge_beam3_adaptive_arc_program.py @@ -10,15 +10,15 @@ import numpy as np -from anysolver.control import cancellation_safe_point, SolveCancelled -from anysolver.linalg import factorize, MatrixClass -from anysolver.nonlinear_state import native_trial_full_coordinates -from anysolver._ge_beam3_p5.arrays import _readonly -from anysolver._ge_beam3_p5_loads.core import canonical, sha -from anysolver._ge_beam3_p5_loads.codec import _load -from anysolver._ge_beam3_p5_loads.state import parameter_value -from anysolver._ge_beam3_load_program import ForceProgramResult, TOLERANCE -from anysolver import _ge_beam3_arc_program as arc +from anyfesolver.control import cancellation_safe_point, SolveCancelled +from anyfesolver.linalg import factorize, MatrixClass +from anyfesolver.nonlinear_state import native_trial_full_coordinates +from anyfesolver._ge_beam3_p5.arrays import _readonly +from anyfesolver._ge_beam3_p5_loads.core import canonical, sha +from anyfesolver._ge_beam3_p5_loads.codec import _load +from anyfesolver._ge_beam3_p5_loads.state import parameter_value +from anyfesolver._ge_beam3_load_program import ForceProgramResult, TOLERANCE +from anyfesolver import _ge_beam3_arc_program as arc PROGRAM = 'GE_BEAM3_NATIVE_DYADIC_ARC_PROGRAM_V1' diff --git a/src/anysolver/_ge_beam3_analysis_combined.py b/src/anyfesolver/_ge_beam3_analysis_combined.py similarity index 100% rename from src/anysolver/_ge_beam3_analysis_combined.py rename to src/anyfesolver/_ge_beam3_analysis_combined.py diff --git a/src/anysolver/_ge_beam3_analysis_fibre_translation.py b/src/anyfesolver/_ge_beam3_analysis_fibre_translation.py similarity index 100% rename from src/anysolver/_ge_beam3_analysis_fibre_translation.py rename to src/anyfesolver/_ge_beam3_analysis_fibre_translation.py diff --git a/src/anysolver/_ge_beam3_analysis_modal_snapshot.py b/src/anyfesolver/_ge_beam3_analysis_modal_snapshot.py similarity index 100% rename from src/anysolver/_ge_beam3_analysis_modal_snapshot.py rename to src/anyfesolver/_ge_beam3_analysis_modal_snapshot.py diff --git a/src/anysolver/_ge_beam3_analysis_nodal_program.py b/src/anyfesolver/_ge_beam3_analysis_nodal_program.py similarity index 100% rename from src/anysolver/_ge_beam3_analysis_nodal_program.py rename to src/anyfesolver/_ge_beam3_analysis_nodal_program.py diff --git a/src/anysolver/_ge_beam3_analysis_translation.py b/src/anyfesolver/_ge_beam3_analysis_translation.py similarity index 100% rename from src/anysolver/_ge_beam3_analysis_translation.py rename to src/anyfesolver/_ge_beam3_analysis_translation.py diff --git a/src/anysolver/_ge_beam3_analysis_translation_modal.py b/src/anyfesolver/_ge_beam3_analysis_translation_modal.py similarity index 100% rename from src/anysolver/_ge_beam3_analysis_translation_modal.py rename to src/anyfesolver/_ge_beam3_analysis_translation_modal.py diff --git a/src/anysolver/_ge_beam3_arc_geometry.py b/src/anyfesolver/_ge_beam3_arc_geometry.py similarity index 98% rename from src/anysolver/_ge_beam3_arc_geometry.py rename to src/anyfesolver/_ge_beam3_arc_geometry.py index b39ac6100..2faaa3945 100644 --- a/src/anysolver/_ge_beam3_arc_geometry.py +++ b/src/anyfesolver/_ge_beam3_arc_geometry.py @@ -9,7 +9,7 @@ import numpy as np -from anysolver._ge_beam3_p5.arrays import _array, _readonly +from anyfesolver._ge_beam3_p5.arrays import _array, _readonly POLICY = 'GE_BEAM3_SPATIAL_EXP_FRAME_CHORD_HYPERPLANE_V1' diff --git a/src/anysolver/_ge_beam3_arc_program.py b/src/anyfesolver/_ge_beam3_arc_program.py similarity index 94% rename from src/anysolver/_ge_beam3_arc_program.py rename to src/anyfesolver/_ge_beam3_arc_program.py index 1733cf1b2..77c1e7ef5 100644 --- a/src/anysolver/_ge_beam3_arc_program.py +++ b/src/anyfesolver/_ge_beam3_arc_program.py @@ -12,20 +12,20 @@ import numpy as np from scipy import sparse -from anysolver.control import cancellation_safe_point, SolveCancelled -from anysolver.linalg import factorize, MatrixClass -from anysolver.nonlinear_static import _assemble_nonlinear_system -from anysolver.nonlinear_state import create_model_native_rotation_store, native_trial_full_coordinates -from anysolver._native_rotation_state import rotation_exponential -from anysolver._ge_beam3_load_program import ForceProgram, ForceProgramResult, _capture as force_capture, _physical_force, TOLERANCE -from anysolver._ge_beam3_displacement_program import _parameter_column -from anysolver._ge_beam3_arc_geometry import constraint, POLICY -from anysolver._ge_beam3_p5.arrays import _readonly -from anysolver._ge_beam3_p5.typed_schema import _decode -from anysolver._ge_beam3_p5_loads import LoadStateStore -from anysolver._ge_beam3_p5_loads.core import canonical, sha -from anysolver._ge_beam3_p5_loads.codec import _load -from anysolver._ge_beam3_p5_loads.state import parameter_value, LOAD_POLICY +from anyfesolver.control import cancellation_safe_point, SolveCancelled +from anyfesolver.linalg import factorize, MatrixClass +from anyfesolver.nonlinear_static import _assemble_nonlinear_system +from anyfesolver.nonlinear_state import create_model_native_rotation_store, native_trial_full_coordinates +from anyfesolver._native_rotation_state import rotation_exponential +from anyfesolver._ge_beam3_load_program import ForceProgram, ForceProgramResult, _capture as force_capture, _physical_force, TOLERANCE +from anyfesolver._ge_beam3_displacement_program import _parameter_column +from anyfesolver._ge_beam3_arc_geometry import constraint, POLICY +from anyfesolver._ge_beam3_p5.arrays import _readonly +from anyfesolver._ge_beam3_p5.typed_schema import _decode +from anyfesolver._ge_beam3_p5_loads import LoadStateStore +from anyfesolver._ge_beam3_p5_loads.core import canonical, sha +from anyfesolver._ge_beam3_p5_loads.codec import _load +from anyfesolver._ge_beam3_p5_loads.state import parameter_value, LOAD_POLICY PROGRAM = 'GE_BEAM3_NATIVE_FRAME_CHORD_ARC_PROGRAM_V1' diff --git a/src/anysolver/_ge_beam3_authoritative_cell_seed.py b/src/anyfesolver/_ge_beam3_authoritative_cell_seed.py similarity index 100% rename from src/anysolver/_ge_beam3_authoritative_cell_seed.py rename to src/anyfesolver/_ge_beam3_authoritative_cell_seed.py diff --git a/src/anysolver/_ge_beam3_cell_identity.py b/src/anyfesolver/_ge_beam3_cell_identity.py similarity index 100% rename from src/anysolver/_ge_beam3_cell_identity.py rename to src/anyfesolver/_ge_beam3_cell_identity.py diff --git a/src/anysolver/_ge_beam3_centered_batched_finite_inertia.py b/src/anyfesolver/_ge_beam3_centered_batched_finite_inertia.py similarity index 100% rename from src/anysolver/_ge_beam3_centered_batched_finite_inertia.py rename to src/anyfesolver/_ge_beam3_centered_batched_finite_inertia.py diff --git a/src/anysolver/_ge_beam3_centered_finite_inertia.py b/src/anyfesolver/_ge_beam3_centered_finite_inertia.py similarity index 100% rename from src/anysolver/_ge_beam3_centered_finite_inertia.py rename to src/anyfesolver/_ge_beam3_centered_finite_inertia.py diff --git a/src/anysolver/_ge_beam3_centered_mixed.py b/src/anyfesolver/_ge_beam3_centered_mixed.py similarity index 90% rename from src/anysolver/_ge_beam3_centered_mixed.py rename to src/anyfesolver/_ge_beam3_centered_mixed.py index 892656c03..927e22574 100644 --- a/src/anysolver/_ge_beam3_centered_mixed.py +++ b/src/anyfesolver/_ge_beam3_centered_mixed.py @@ -8,19 +8,19 @@ import numpy as np -from anysolver._ge_beam3_mixed_ad import ( +from anyfesolver._ge_beam3_mixed_ad import ( Jet2, constant_matrix, matmul, matvec, transpose, so3_exp, so3_log, ) -from anysolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry -from anysolver._ge_beam3_p5.compensated import CompensatedStationaryBeam, sum_jets, compensated_strain -from anysolver._ge_beam3_p5.mixed import ( +from anyfesolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry +from anyfesolver._ge_beam3_p5.compensated import CompensatedStationaryBeam, sum_jets, compensated_strain +from anyfesolver._ge_beam3_p5.mixed import ( MixedBeamEvaluation, BeamStationTrial, NonlinearLocalError, compose_density, ) -from anysolver._ge_beam3_p5.section import DirectedHardeningSection, SectionHistory, _history -from anysolver._ge_beam3_p5.algebra import HALVES -from anysolver._ge_beam3_p5.arrays import _array, _frames, _readonly -from anysolver._ge_beam3_p5.compensated_coordinates import split_sum, validate_pair +from anyfesolver._ge_beam3_p5.section import DirectedHardeningSection, SectionHistory, _history +from anyfesolver._ge_beam3_p5.algebra import HALVES +from anyfesolver._ge_beam3_p5.arrays import _array, _frames, _readonly +from anyfesolver._ge_beam3_p5.compensated_coordinates import split_sum, validate_pair SCHEMA = 'GE_BEAM3_CENTERED_COMPENSATED_STATIONARY_DEVELOPMENT_V1' diff --git a/src/anysolver/_ge_beam3_centered_reference.py b/src/anyfesolver/_ge_beam3_centered_reference.py similarity index 98% rename from src/anysolver/_ge_beam3_centered_reference.py rename to src/anyfesolver/_ge_beam3_centered_reference.py index cb2eeb23f..40001fca7 100644 --- a/src/anysolver/_ge_beam3_centered_reference.py +++ b/src/anyfesolver/_ge_beam3_centered_reference.py @@ -12,8 +12,8 @@ import numpy as np -from anysolver import ge_beam3_curved_reference as source -from anysolver._ge_beam3_deterministic_reduction import deterministic_dot, deterministic_norm +from anyfesolver import ge_beam3_curved_reference as source +from anyfesolver._ge_beam3_deterministic_reduction import deterministic_dot, deterministic_norm EVALUATION_ID = 'CENTERED_Q2_TWO_COMPONENT_COEFFICIENT_ANALYTIC_LIFT_V1' diff --git a/src/anysolver/_ge_beam3_centered_so3_strain.py b/src/anyfesolver/_ge_beam3_centered_so3_strain.py similarity index 100% rename from src/anysolver/_ge_beam3_centered_so3_strain.py rename to src/anyfesolver/_ge_beam3_centered_so3_strain.py diff --git a/src/anysolver/_ge_beam3_complementary_section.py b/src/anyfesolver/_ge_beam3_complementary_section.py similarity index 94% rename from src/anysolver/_ge_beam3_complementary_section.py rename to src/anyfesolver/_ge_beam3_complementary_section.py index f8faa11e8..63ca46d86 100644 --- a/src/anysolver/_ge_beam3_complementary_section.py +++ b/src/anyfesolver/_ge_beam3_complementary_section.py @@ -7,11 +7,11 @@ from dataclasses import dataclass from math import fsum import numpy as np -from anysolver._ge_beam3_p5.section import DirectedHardeningSection, SectionHistory, _history -from anysolver._ge_beam3_p5.compensated_coordinates import split_sum -from anysolver._native_reference_modal import _owned -from anysolver._ge_beam3_p5_seeded.core import sha -from anysolver._dyadic_bilinear import _capture, _multiply, _add, _rounded +from anyfesolver._ge_beam3_p5.section import DirectedHardeningSection, SectionHistory, _history +from anyfesolver._ge_beam3_p5.compensated_coordinates import split_sum +from anyfesolver._native_reference_modal import _owned +from anyfesolver._ge_beam3_p5_seeded.core import sha +from anyfesolver._dyadic_bilinear import _capture, _multiply, _add, _rounded POLICY = 'GE_BEAM3_DIRECTED_HARDENING_FULL_SECTION_CONJUGATE_V1' diff --git a/src/anysolver/_ge_beam3_compliance_snapshot_guard.py b/src/anyfesolver/_ge_beam3_compliance_snapshot_guard.py similarity index 100% rename from src/anysolver/_ge_beam3_compliance_snapshot_guard.py rename to src/anyfesolver/_ge_beam3_compliance_snapshot_guard.py diff --git a/src/anysolver/_ge_beam3_connected_dynamic.py b/src/anyfesolver/_ge_beam3_connected_dynamic.py similarity index 100% rename from src/anysolver/_ge_beam3_connected_dynamic.py rename to src/anyfesolver/_ge_beam3_connected_dynamic.py diff --git a/src/anysolver/_ge_beam3_connected_trajectory.py b/src/anyfesolver/_ge_beam3_connected_trajectory.py similarity index 100% rename from src/anysolver/_ge_beam3_connected_trajectory.py rename to src/anyfesolver/_ge_beam3_connected_trajectory.py diff --git a/src/anysolver/_ge_beam3_conservative_backtrack.py b/src/anyfesolver/_ge_beam3_conservative_backtrack.py similarity index 100% rename from src/anysolver/_ge_beam3_conservative_backtrack.py rename to src/anyfesolver/_ge_beam3_conservative_backtrack.py diff --git a/src/anysolver/_ge_beam3_controlled_fibre_modes.py b/src/anyfesolver/_ge_beam3_controlled_fibre_modes.py similarity index 100% rename from src/anysolver/_ge_beam3_controlled_fibre_modes.py rename to src/anyfesolver/_ge_beam3_controlled_fibre_modes.py diff --git a/src/anysolver/_ge_beam3_coupled_beam_subdomain.py b/src/anyfesolver/_ge_beam3_coupled_beam_subdomain.py similarity index 100% rename from src/anysolver/_ge_beam3_coupled_beam_subdomain.py rename to src/anyfesolver/_ge_beam3_coupled_beam_subdomain.py diff --git a/src/anysolver/_ge_beam3_coupled_modes.py b/src/anyfesolver/_ge_beam3_coupled_modes.py similarity index 100% rename from src/anysolver/_ge_beam3_coupled_modes.py rename to src/anyfesolver/_ge_beam3_coupled_modes.py diff --git a/src/anysolver/_ge_beam3_deterministic_reduction.py b/src/anyfesolver/_ge_beam3_deterministic_reduction.py similarity index 100% rename from src/anysolver/_ge_beam3_deterministic_reduction.py rename to src/anyfesolver/_ge_beam3_deterministic_reduction.py diff --git a/src/anysolver/_ge_beam3_displacement_program.py b/src/anyfesolver/_ge_beam3_displacement_program.py similarity index 95% rename from src/anysolver/_ge_beam3_displacement_program.py rename to src/anyfesolver/_ge_beam3_displacement_program.py index a9cb03887..a3623cba8 100644 --- a/src/anysolver/_ge_beam3_displacement_program.py +++ b/src/anyfesolver/_ge_beam3_displacement_program.py @@ -12,17 +12,17 @@ import numpy as np from scipy import sparse -from anysolver.control import cancellation_safe_point, SolveCancelled -from anysolver.linalg import factorize, MatrixClass -from anysolver.nonlinear_static import _assemble_nonlinear_system -from anysolver.nonlinear_state import create_model_native_rotation_store, native_trial_full_coordinates -from anysolver._ge_beam3_load_program import ForceProgram, ForceProgramResult, _capture as force_capture, _physical_force, TOLERANCE -from anysolver._ge_beam3_p5.arrays import _readonly -from anysolver._ge_beam3_p5.typed_schema import _decode -from anysolver._ge_beam3_p5_loads import LoadStateStore -from anysolver._ge_beam3_p5_loads.core import canonical, sha -from anysolver._ge_beam3_p5_loads.codec import _load -from anysolver._ge_beam3_p5_loads.state import parameter_value, LOAD_POLICY +from anyfesolver.control import cancellation_safe_point, SolveCancelled +from anyfesolver.linalg import factorize, MatrixClass +from anyfesolver.nonlinear_static import _assemble_nonlinear_system +from anyfesolver.nonlinear_state import create_model_native_rotation_store, native_trial_full_coordinates +from anyfesolver._ge_beam3_load_program import ForceProgram, ForceProgramResult, _capture as force_capture, _physical_force, TOLERANCE +from anyfesolver._ge_beam3_p5.arrays import _readonly +from anyfesolver._ge_beam3_p5.typed_schema import _decode +from anyfesolver._ge_beam3_p5_loads import LoadStateStore +from anyfesolver._ge_beam3_p5_loads.core import canonical, sha +from anyfesolver._ge_beam3_p5_loads.codec import _load +from anyfesolver._ge_beam3_p5_loads.state import parameter_value, LOAD_POLICY PROGRAM = 'GE_BEAM3_TRANSLATION_CONTROL_PROGRAM_V1' diff --git a/src/anysolver/_ge_beam3_durable_coupled.py b/src/anyfesolver/_ge_beam3_durable_coupled.py similarity index 100% rename from src/anysolver/_ge_beam3_durable_coupled.py rename to src/anyfesolver/_ge_beam3_durable_coupled.py diff --git a/src/anysolver/_ge_beam3_dynamic_elastic_state.py b/src/anyfesolver/_ge_beam3_dynamic_elastic_state.py similarity index 98% rename from src/anysolver/_ge_beam3_dynamic_elastic_state.py rename to src/anyfesolver/_ge_beam3_dynamic_elastic_state.py index 464a45c3d..967a93509 100644 --- a/src/anysolver/_ge_beam3_dynamic_elastic_state.py +++ b/src/anyfesolver/_ge_beam3_dynamic_elastic_state.py @@ -1,37 +1,37 @@ -"""Private single centered generalized elastic structural/material work owner. - -Admits zero supports or the reviewed full clamp without any static equilibrium -genesis inverse. No mass, velocity, time method, static-guard override or contact. -""" -from contextlib import contextmanager -from dataclasses import dataclass -import json -from threading import Lock, get_ident -from time import monotonic -import numpy as np - -from ._ge_beam3_native_analysis import NativeBeamAnalysis -from ._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement -from ._ge_beam3_retained_generalized import RetainedGeneralizedOperator -from ._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry -from ._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection -from ._ge_beam3_retained_generalized_state import Mechanical -from ._ge_beam3_native_generalized_restart import _history -from ._ge_beam3_native_generalized_loading import DistributedPattern -from ._ge_beam3_native_line_loading import LinePattern -from ._ge_beam3_fibre_line_work import evaluate as line_work -from ._ge_beam3_generalized_static_boundary import cell_couple_load, spatial_jacobian +"""Private single centered generalized elastic structural/material work owner. + +Admits zero supports or the reviewed full clamp without any static equilibrium +genesis inverse. No mass, velocity, time method, static-guard override or contact. +""" +from contextlib import contextmanager +from dataclasses import dataclass +import json +from threading import Lock, get_ident +from time import monotonic +import numpy as np + +from ._ge_beam3_native_analysis import NativeBeamAnalysis +from ._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement +from ._ge_beam3_retained_generalized import RetainedGeneralizedOperator +from ._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry +from ._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection +from ._ge_beam3_retained_generalized_state import Mechanical +from ._ge_beam3_native_generalized_restart import _history +from ._ge_beam3_native_generalized_loading import DistributedPattern +from ._ge_beam3_native_line_loading import LinePattern +from ._ge_beam3_fibre_line_work import evaluate as line_work +from ._ge_beam3_generalized_static_boundary import cell_couple_load, spatial_jacobian from ._ge_beam3_operator_validation_scope import operator_call from . import _ge_beam3_operator_validation_scope as _operator_validation -from ._ge_beam3_p5.arrays import _array, _frames -from ._ge_beam3_p5.algebra import rotation -from ._ge_beam3_p5.compensated_coordinates import validate_pair -from ._ge_beam3_p5_seeded.core import canonical, sha -from ._native_reference_modal import _owned -from .control import cancellation_safe_point - -IMPLEMENTATION_ID = 'DEVELOPMENT_C7_SINGLE_CENTERED_DYNAMIC_ELASTIC_STATE_V1' -PHYSICAL_DOFS = (0, 1, 2, 6, 7, 8, 12, 13, 14, 18, 19, 20, 21, 22, 23) +from ._ge_beam3_p5.arrays import _array, _frames +from ._ge_beam3_p5.algebra import rotation +from ._ge_beam3_p5.compensated_coordinates import validate_pair +from ._ge_beam3_p5_seeded.core import canonical, sha +from ._native_reference_modal import _owned +from .control import cancellation_safe_point + +IMPLEMENTATION_ID = 'DEVELOPMENT_C7_SINGLE_CENTERED_DYNAMIC_ELASTIC_STATE_V1' +PHYSICAL_DOFS = (0, 1, 2, 6, 7, 8, 12, 13, 14, 18, 19, 20, 21, 22, 23) ALGEBRAIC_DOFS = (3, 4, 5, 9, 10, 11, 15, 16, 17, *range(24, 42)) @@ -45,156 +45,156 @@ def _admit_runtime_limit(value): if not np.isfinite(duration) or not 0. < duration <= 900.: raise ValueError('positive finite native dynamic runtime limit at most900 seconds required') return duration - - -@dataclass(frozen=True) -class DynamicElasticState: - mechanical: Mechanical - origins: tuple - histories: tuple - context_sha256: str - - -@dataclass(frozen=True) -class ElasticWorkEvaluation: - state: DynamicElasticState - residual: np.ndarray - spatial_jacobian: np.ndarray - conservative_value: float - mixed_potential: float - line_work: float - applied_couple42: np.ndarray + + +@dataclass(frozen=True) +class DynamicElasticState: + mechanical: Mechanical + origins: tuple + histories: tuple + context_sha256: str + + +@dataclass(frozen=True) +class ElasticWorkEvaluation: + state: DynamicElasticState + residual: np.ndarray + spatial_jacobian: np.ndarray + conservative_value: float + mixed_potential: float + line_work: float + applied_couple42: np.ndarray material_sha256: str load_sha256: str external_load42: np.ndarray external_spatial_jacobian42: np.ndarray conservative_potential: bool - production_qualified: bool = False - - -@dataclass(frozen=True) -class AlgebraicConsistency: - state: DynamicElasticState - work: ElasticWorkEvaluation - iterations: int - backtracks: int - residual_norm: float - correction_norm: float - algebraic_rank: int - algebraic_sigma_min: float - algebraic_sigma_max: float - algebraic_condition: float - - -class AlgebraicRankError(ValueError): - def __init__(self, singular, vector42, rank): - super().__init__('fixed-physical algebraic block is singular; no temporal slice admitted') - self.singular_values = _owned(singular) - self.null_vector42 = _owned(vector42) - self.rank = int(rank) - - -class ElasticWorkSession: - """Authenticated same-thread disposable work scope; not state acceptance.""" - def __init__(self, context): - self._context = context - self._thread = get_ident() - self._active = True - self._issued = {} - - def _check(self): - context = self._context - if (not self._active or get_ident() != self._thread - or context._active_session is not self): - raise ValueError('active same-thread owner-bound elastic work session required') - context._guard() - - def make(self, mechanical): - self._check() - return self._context._make(mechanical) - - def trial_state(self, mechanical, *, origins=None): - self._check() - context = self._context - state = context._issue(mechanical, context.origins if origins is None else origins) - context._evaluate(state, None, 0.) - return state - - def evaluate(self, state, *, pattern=None, parameter=0., cancellation_token=None): - self._check() - return self._context._evaluate(state, pattern, parameter, cancellation_token) - - def work(self, mechanical, *, origins=None, pattern=None, parameter=0., cancellation_token=None): - """Issue and validate one transient evaluation without duplicate work.""" - self._check() - context = self._context - state = context._issue(mechanical, context.origins if origins is None else origins) - return context._evaluate(state, pattern, parameter, cancellation_token) - - def consistent(self, state, *, pattern=None, parameter=0., cancellation_token=None): - self._check() - return self._context._consistent(state, pattern, parameter, cancellation_token) - - -class DynamicElasticContext: - """Exact-analysis-bound immutable elastic work and algebraic consistency. - - State issuance is not time/history acceptance. The material origin is the - captured virgin elastic state; all evaluations must preserve it exactly. - """ + production_qualified: bool = False + + +@dataclass(frozen=True) +class AlgebraicConsistency: + state: DynamicElasticState + work: ElasticWorkEvaluation + iterations: int + backtracks: int + residual_norm: float + correction_norm: float + algebraic_rank: int + algebraic_sigma_min: float + algebraic_sigma_max: float + algebraic_condition: float + + +class AlgebraicRankError(ValueError): + def __init__(self, singular, vector42, rank): + super().__init__('fixed-physical algebraic block is singular; no temporal slice admitted') + self.singular_values = _owned(singular) + self.null_vector42 = _owned(vector42) + self.rank = int(rank) + + +class ElasticWorkSession: + """Authenticated same-thread disposable work scope; not state acceptance.""" + def __init__(self, context): + self._context = context + self._thread = get_ident() + self._active = True + self._issued = {} + + def _check(self): + context = self._context + if (not self._active or get_ident() != self._thread + or context._active_session is not self): + raise ValueError('active same-thread owner-bound elastic work session required') + context._guard() + + def make(self, mechanical): + self._check() + return self._context._make(mechanical) + + def trial_state(self, mechanical, *, origins=None): + self._check() + context = self._context + state = context._issue(mechanical, context.origins if origins is None else origins) + context._evaluate(state, None, 0.) + return state + + def evaluate(self, state, *, pattern=None, parameter=0., cancellation_token=None): + self._check() + return self._context._evaluate(state, pattern, parameter, cancellation_token) + + def work(self, mechanical, *, origins=None, pattern=None, parameter=0., cancellation_token=None): + """Issue and validate one transient evaluation without duplicate work.""" + self._check() + context = self._context + state = context._issue(mechanical, context.origins if origins is None else origins) + return context._evaluate(state, pattern, parameter, cancellation_token) + + def consistent(self, state, *, pattern=None, parameter=0., cancellation_token=None): + self._check() + return self._context._consistent(state, pattern, parameter, cancellation_token) + + +class DynamicElasticContext: + """Exact-analysis-bound immutable elastic work and algebraic consistency. + + State issuance is not time/history acceptance. The material origin is the + captured virgin elastic state; all evaluations must preserve it exactly. + """ def __init__(self, analysis, *, max_iterations=12, max_backtracks=8, runtime_limit_seconds=120.): - if type(analysis) is not NativeBeamAnalysis: - raise ValueError('exact standalone native analysis required') - if (type(max_iterations) is not int or not 1 <= max_iterations <= 12 - or type(max_backtracks) is not int or not 0 <= max_backtracks <= 8): - raise ValueError('bounded exact elastic consistency settings') + if type(analysis) is not NativeBeamAnalysis: + raise ValueError('exact standalone native analysis required') + if (type(max_iterations) is not int or not 1 <= max_iterations <= 12 + or type(max_backtracks) is not int or not 0 <= max_backtracks <= 8): + raise ValueError('bounded exact elastic consistency settings') duration = _admit_runtime_limit(runtime_limit_seconds) with analysis._operation(): - elements = analysis._elements - nodes = tuple(sorted(analysis.model.mesh.nodes)) - if (len(elements) != 1 or type(elements[0]) is not NativeGeneralizedStaticElement - or type(elements[0].operator) is not RetainedGeneralizedOperator - or type(elements[0].section) is not EllipsoidalGeneralizedSection - or type(elements[0].operator.reference) is not CenteredCurvedBeam3ReferenceGeometry - or len(nodes) != 3 or analysis.model.mesh.dof_manager.total_dofs != 18 - or elements[0].node_ids != nodes - or tuple(elements[0].get_dof_mapping(analysis.model.mesh)) != tuple(range(18))): - raise ValueError('exact one centered generalized element/canonical full42 order required') - fixed = analysis._admit_boundaries() - if fixed not in ((), tuple(range(6))): - raise ValueError('zero supports or homogeneous first-node full clamp required') - self.analysis = analysis - self.element = elements[0] - self.fixed = fixed - self.free = tuple(i for i in range(42) if i not in fixed) - self.physical_free = tuple(i for i in PHYSICAL_DOFS if i in self.free) - self.algebraic_free = tuple(i for i in ALGEBRAIC_DOFS if i in self.free) - self.reference_positions = _owned(self.element.operator.reference.coordinates) - self.reference_frames = _owned(self.element.operator.reference.nodal_triads) - self.origins = (self.element.operator.cell.virgin(),) - self.max_iterations, self.max_backtracks = max_iterations, max_backtracks + elements = analysis._elements + nodes = tuple(sorted(analysis.model.mesh.nodes)) + if (len(elements) != 1 or type(elements[0]) is not NativeGeneralizedStaticElement + or type(elements[0].operator) is not RetainedGeneralizedOperator + or type(elements[0].section) is not EllipsoidalGeneralizedSection + or type(elements[0].operator.reference) is not CenteredCurvedBeam3ReferenceGeometry + or len(nodes) != 3 or analysis.model.mesh.dof_manager.total_dofs != 18 + or elements[0].node_ids != nodes + or tuple(elements[0].get_dof_mapping(analysis.model.mesh)) != tuple(range(18))): + raise ValueError('exact one centered generalized element/canonical full42 order required') + fixed = analysis._admit_boundaries() + if fixed not in ((), tuple(range(6))): + raise ValueError('zero supports or homogeneous first-node full clamp required') + self.analysis = analysis + self.element = elements[0] + self.fixed = fixed + self.free = tuple(i for i in range(42) if i not in fixed) + self.physical_free = tuple(i for i in PHYSICAL_DOFS if i in self.free) + self.algebraic_free = tuple(i for i in ALGEBRAIC_DOFS if i in self.free) + self.reference_positions = _owned(self.element.operator.reference.coordinates) + self.reference_frames = _owned(self.element.operator.reference.nodal_triads) + self.origins = (self.element.operator.cell.virgin(),) + self.max_iterations, self.max_backtracks = max_iterations, max_backtracks self.started = monotonic() self._captured_started = self.started self.runtime_limit_seconds = duration self._captured_runtime_limit = duration - self._identity = sha(self._definition()) - self._issued = {} - self._lock = Lock() - self._active_session = None - mechanical = self._make(dict(positions=self.reference_positions, - position_low=np.zeros((3, 3)), nodal_frames=self.reference_frames, - cell_rotations=np.tile(np.eye(3), (1, 2, 1, 1)), resultants=np.zeros((1, 18)))) - state = DynamicElasticState(mechanical, self.origins, self.origins, self._identity) - self._reference = state - self._issued[id(state)] = (state, canonical(state)) - - def _definition(self): + self._identity = sha(self._definition()) + self._issued = {} + self._lock = Lock() + self._active_session = None + mechanical = self._make(dict(positions=self.reference_positions, + position_low=np.zeros((3, 3)), nodal_frames=self.reference_frames, + cell_rotations=np.tile(np.eye(3), (1, 2, 1, 1)), resultants=np.zeros((1, 18)))) + state = DynamicElasticState(mechanical, self.origins, self.origins, self._identity) + self._reference = state + self._issued[id(state)] = (state, canonical(state)) + + def _definition(self): data = dict(implementation=IMPLEMENTATION_ID, analysis=self.analysis.identity, - element=self.element.identity, operator=self.element.operator.identity, - fixed=self.fixed, free=self.free, physical=self.physical_free, - algebraic=self.algebraic_free, reference_positions=self.reference_positions, - reference_frames=self.reference_frames, origins=self.origins, + element=self.element.identity, operator=self.element.operator.identity, + fixed=self.fixed, free=self.free, physical=self.physical_free, + algebraic=self.algebraic_free, reference_positions=self.reference_positions, + reference_frames=self.reference_frames, origins=self.origins, iterations=self.max_iterations, backtracks=self.max_backtracks) if self.runtime_limit_seconds != 120.: data['runtime_limit_seconds'] = self.runtime_limit_seconds @@ -207,7 +207,7 @@ def _guard_runtime_limit(self): raise ValueError('dynamic elastic captured runtime/clock changed') if self.runtime_limit_seconds != 120. and _operator_validation._ACTIVE.get() is not None: raise ValueError('extended dynamic runtime excludes optional operator validation scope') - + def _guard_deadline(self): self._guard_runtime_limit() if monotonic()-self._captured_started > self._captured_runtime_limit: @@ -216,141 +216,141 @@ def _guard_deadline(self): def _guard(self, token=None, stage='dynamic-elastic.guard'): cancellation_safe_point(token, stage) self._guard_deadline() - self.analysis._guard() - if (sha(self._definition()) != self._identity - or self.analysis._elements != (self.element,) - or self.analysis._admit_boundaries() != self.fixed): - raise ValueError('dynamic elastic frozen definition/supports changed') - - @contextmanager - def _operation(self): - if not self._lock.acquire(blocking=False): - raise ValueError('dynamic elastic context is already in use') - old = None - try: - try: - with self.analysis._operation(): - old = self._issued.copy() - self._guard() - yield - self._guard() - except BaseException: - if old is not None: - self._issued = old - raise - finally: - self._lock.release() - - @contextmanager - def session(self): - if not self._lock.acquire(blocking=False): - raise ValueError('dynamic elastic context is already in use') - token = None - old = None - try: - try: - with self.analysis._operation(): - old = self._issued.copy() - self._guard() - token = ElasticWorkSession(self) - self._active_session = token - try: - yield token - token._check() - finally: - # No standalone issuance is evicted. Scoped work states - # cease to authenticate before the native exit guard. - token._active = False - token._issued.clear() - self._active_session = None - self._guard() - except BaseException: - if old is not None: - self._issued = old - raise - finally: - if token is not None: - token._active = False - token._issued.clear() - self._active_session = None - self._lock.release() - - def _make(self, data): - if type(data) is Mechanical: - data = data.descriptor() - if type(data) is not dict or set(data) != set(Mechanical.__dataclass_fields__): - raise ValueError('complete exact retained mechanical fields required') - high = _array(data['positions'], (3, 3), 'physical positions') - low = _array(data['position_low'], (3, 3), 'physical low positions') - for h, l in zip(high.flat, low.flat): - validate_pair(float(h), float(l)) - nodal = _frames(data['nodal_frames'], 3, 'algebraic nodal frames') - cells = np.asarray(data['cell_rotations']) - if cells.shape != (1, 2, 3, 3): - raise ValueError('exact one-element physical cell frames') - cells = _frames(cells.reshape(2, 3, 3), 2, 'physical cell frames').reshape(1, 2, 3, 3) - resultants = _array(data['resultants'], (1, 18), 'algebraic resultants') - for dof in self.fixed: - node, axis = divmod(dof, 6) - if axis < 3: - if high[node, axis] != self.reference_positions[node, axis] or low[node, axis] != 0.: - raise ValueError('prescribed physical translation changed') - elif not np.array_equal(nodal[node], self.reference_frames[node]): - raise ValueError('prescribed algebraic frame changed') - return Mechanical(*map(_owned, (high, low, nodal, cells, resultants))) - - def _origins(self, origins): - if type(origins) is not tuple or len(origins) != 1: - raise ValueError('complete one-element material origins required') - validated = (_history(json.loads(canonical(origins[0])), self.element),) - if canonical(validated) != canonical(self.origins): - raise ValueError('first dynamic elastic slice requires captured virgin origins') - return validated - - def _require(self, state): - record = self._issued.get(id(state)) - if record is None and self._active_session is not None: - self._active_session._check() - record = self._active_session._issued.get(id(state)) - if (type(state) is not DynamicElasticState or record is None or record[0] is not state - or state.context_sha256 != self._identity or canonical(state) != record[1]): - raise ValueError('issued immutable analysis-bound elastic state required') - return state - - def _issue(self, mechanical, origins): - registry = self._issued - if self._active_session is not None: - self._active_session._check() - registry = self._active_session._issued - if len(registry) >= 128: - raise ValueError('bounded elastic trial-state capacity') - state = DynamicElasticState(self._make(mechanical), self._origins(origins), - self._origins(origins), self._identity) - registry[id(state)] = (state, canonical(state)) - return state - - def reference_state(self): - with self._operation(): - return self._require(self._reference) - - def trial_state(self, mechanical, *, origins=None): - with self._operation(): - state = self._issue(mechanical, self.origins if origins is None else origins) - self._evaluate(state, None, 0.) - return state - - def _evaluate(self, state, pattern, parameter, token=None): - self._guard(token, 'dynamic-elastic.evaluate') - self._require(state) - if pattern is None: - pattern = DistributedPattern(LinePattern(()), ()) - if type(pattern) is not DistributedPattern or type(parameter) is not float or not np.isfinite(parameter): - raise ValueError('typed finite native distributed load required') - pattern.require(self.analysis.model.mesh) - captured_load = canonical(dict(pattern=pattern, parameter=parameter)) - m = self._make(state.mechanical) - origins = self._origins(state.origins) - op = self.element.operator + self.analysis._guard() + if (sha(self._definition()) != self._identity + or self.analysis._elements != (self.element,) + or self.analysis._admit_boundaries() != self.fixed): + raise ValueError('dynamic elastic frozen definition/supports changed') + + @contextmanager + def _operation(self): + if not self._lock.acquire(blocking=False): + raise ValueError('dynamic elastic context is already in use') + old = None + try: + try: + with self.analysis._operation(): + old = self._issued.copy() + self._guard() + yield + self._guard() + except BaseException: + if old is not None: + self._issued = old + raise + finally: + self._lock.release() + + @contextmanager + def session(self): + if not self._lock.acquire(blocking=False): + raise ValueError('dynamic elastic context is already in use') + token = None + old = None + try: + try: + with self.analysis._operation(): + old = self._issued.copy() + self._guard() + token = ElasticWorkSession(self) + self._active_session = token + try: + yield token + token._check() + finally: + # No standalone issuance is evicted. Scoped work states + # cease to authenticate before the native exit guard. + token._active = False + token._issued.clear() + self._active_session = None + self._guard() + except BaseException: + if old is not None: + self._issued = old + raise + finally: + if token is not None: + token._active = False + token._issued.clear() + self._active_session = None + self._lock.release() + + def _make(self, data): + if type(data) is Mechanical: + data = data.descriptor() + if type(data) is not dict or set(data) != set(Mechanical.__dataclass_fields__): + raise ValueError('complete exact retained mechanical fields required') + high = _array(data['positions'], (3, 3), 'physical positions') + low = _array(data['position_low'], (3, 3), 'physical low positions') + for h, l in zip(high.flat, low.flat): + validate_pair(float(h), float(l)) + nodal = _frames(data['nodal_frames'], 3, 'algebraic nodal frames') + cells = np.asarray(data['cell_rotations']) + if cells.shape != (1, 2, 3, 3): + raise ValueError('exact one-element physical cell frames') + cells = _frames(cells.reshape(2, 3, 3), 2, 'physical cell frames').reshape(1, 2, 3, 3) + resultants = _array(data['resultants'], (1, 18), 'algebraic resultants') + for dof in self.fixed: + node, axis = divmod(dof, 6) + if axis < 3: + if high[node, axis] != self.reference_positions[node, axis] or low[node, axis] != 0.: + raise ValueError('prescribed physical translation changed') + elif not np.array_equal(nodal[node], self.reference_frames[node]): + raise ValueError('prescribed algebraic frame changed') + return Mechanical(*map(_owned, (high, low, nodal, cells, resultants))) + + def _origins(self, origins): + if type(origins) is not tuple or len(origins) != 1: + raise ValueError('complete one-element material origins required') + validated = (_history(json.loads(canonical(origins[0])), self.element),) + if canonical(validated) != canonical(self.origins): + raise ValueError('first dynamic elastic slice requires captured virgin origins') + return validated + + def _require(self, state): + record = self._issued.get(id(state)) + if record is None and self._active_session is not None: + self._active_session._check() + record = self._active_session._issued.get(id(state)) + if (type(state) is not DynamicElasticState or record is None or record[0] is not state + or state.context_sha256 != self._identity or canonical(state) != record[1]): + raise ValueError('issued immutable analysis-bound elastic state required') + return state + + def _issue(self, mechanical, origins): + registry = self._issued + if self._active_session is not None: + self._active_session._check() + registry = self._active_session._issued + if len(registry) >= 128: + raise ValueError('bounded elastic trial-state capacity') + state = DynamicElasticState(self._make(mechanical), self._origins(origins), + self._origins(origins), self._identity) + registry[id(state)] = (state, canonical(state)) + return state + + def reference_state(self): + with self._operation(): + return self._require(self._reference) + + def trial_state(self, mechanical, *, origins=None): + with self._operation(): + state = self._issue(mechanical, self.origins if origins is None else origins) + self._evaluate(state, None, 0.) + return state + + def _evaluate(self, state, pattern, parameter, token=None): + self._guard(token, 'dynamic-elastic.evaluate') + self._require(state) + if pattern is None: + pattern = DistributedPattern(LinePattern(()), ()) + if type(pattern) is not DistributedPattern or type(parameter) is not float or not np.isfinite(parameter): + raise ValueError('typed finite native distributed load required') + pattern.require(self.analysis.model.mesh) + captured_load = canonical(dict(pattern=pattern, parameter=parameter)) + m = self._make(state.mechanical) + origins = self._origins(state.origins) + op = self.element.operator arguments = (m.positions, m.position_low, m.nodal_frames, m.cell_rotations[0], m.resultants[0]) if self.runtime_limit_seconds == 120.: response = operator_call(op, 'evaluate', self._guard, self.started, @@ -360,102 +360,102 @@ def _evaluate(self, state, pattern, parameter, token=None): # contract. Extended owners reject that combination in the guard and # retain the ordinary full-model callback at every operator check. response = op.evaluate(*arguments, check=self._guard, origin=origins[0]) - material = json.loads(response.material) - if (canonical(response.history) != canonical(origins[0]) - or any(row['branch'] != 'ELASTIC' - or any(v != 0. for pair in row['dissipation'] for v in pair) - for row in material['stations'])): - raise ValueError('strict elastic unchanged material histories required') - work = line_work(op.reference, m.positions, m.position_low, m.cell_rotations[0], - parameter*pattern.force(self.element.element_id), order=op.order) - conservative = response.residual-work.gradient - couple = cell_couple_load(op, parameter*pattern.density(self.element.element_id)) - residual = conservative-couple - tangent = spatial_jacobian(conservative, response.hessian+response.hessian_low-work.hessian) - self._guard(token, 'dynamic-elastic.evaluated') - if canonical(dict(pattern=pattern, parameter=parameter)) != captured_load: - raise ValueError('elastic trial load changed') + material = json.loads(response.material) + if (canonical(response.history) != canonical(origins[0]) + or any(row['branch'] != 'ELASTIC' + or any(v != 0. for pair in row['dissipation'] for v in pair) + for row in material['stations'])): + raise ValueError('strict elastic unchanged material histories required') + work = line_work(op.reference, m.positions, m.position_low, m.cell_rotations[0], + parameter*pattern.force(self.element.element_id), order=op.order) + conservative = response.residual-work.gradient + couple = cell_couple_load(op, parameter*pattern.density(self.element.element_id)) + residual = conservative-couple + tangent = spatial_jacobian(conservative, response.hessian+response.hessian_low-work.hessian) + self._guard(token, 'dynamic-elastic.evaluated') + if canonical(dict(pattern=pattern, parameter=parameter)) != captured_load: + raise ValueError('elastic trial load changed') return ElasticWorkEvaluation(state, _owned(residual), tangent, float(response.potential-work.value), float(response.potential), float(work.value), _owned(couple), sha(material), sha(json.loads(captured_load)), _owned(work.gradient+couple), spatial_jacobian(work.gradient, work.hessian), not bool(np.any(couple))) - - def evaluate(self, state, *, pattern=None, parameter=0., cancellation_token=None): - with self._operation(): - return self._evaluate(state, pattern, parameter, cancellation_token) - - def _algebraic_rank(self, tangent): - z = list(self.algebraic_free) - _, singular, vh = np.linalg.svd(tangent[np.ix_(z, z)]) - tolerance = 64*np.finfo(float).eps*len(z)*singular[0] - rank = int(np.count_nonzero(singular > tolerance)) - if rank != len(z): - null = np.zeros(42) - null[z] = vh[-1] - raise AlgebraicRankError(singular, null, rank) - return len(z), float(singular[-1]), float(singular[0]), float(singular[0]/singular[-1]) - - def algebraic_rank(self, state, *, cancellation_token=None): - with self._operation(): - work = self._evaluate(state, None, 0., cancellation_token) - rank, minimum, maximum, condition = self._algebraic_rank(work.spatial_jacobian) - return dict(rank=rank, sigma_min=minimum, sigma_max=maximum, condition=condition) - - def _algebraic_move(self, state, step): - # Physical positions and cell rotations are carried through bit-exactly. - m = state.mechanical - frames = np.array(m.nodal_frames, copy=True) - for node in range(3): - frames[node] = rotation(step[6*node+3:6*node+6])@m.nodal_frames[node] - resultants = m.resultants+step[24:].reshape(1, 18) - return self._issue(dict(positions=m.positions, position_low=m.position_low, - nodal_frames=frames, cell_rotations=m.cell_rotations, resultants=resultants), state.origins) - - def consistent(self, state, *, pattern=None, parameter=0., cancellation_token=None): - with self._operation(): - return self._consistent(state, pattern, parameter, cancellation_token) - - def _consistent(self, state, pattern, parameter, cancellation_token): - self._require(state) - z = list(self.algebraic_free) - source_positions = state.mechanical.positions - source_low = state.mechanical.position_low - source_cells = state.mechanical.cell_rotations - backtracks = 0 - length = float(np.linalg.norm(self.reference_positions[-1]-self.reference_positions[0])) - for iteration in range(self.max_iterations+1): - work = self._evaluate(state, pattern, parameter, cancellation_token) - rank, minimum, maximum, condition = self._algebraic_rank(work.spatial_jacobian) - step = np.zeros(42) - step[z] = np.linalg.solve(work.spatial_jacobian[np.ix_(z, z)], -work.residual[z]) - # Same retained row convention: nodal moment residual / length; - # axial/first-cell compatibility rows / length, remaining rows1. - scales = np.ones(42) - for node in range(3): - scales[6*node+3:6*node+6] = length - scales[18:30] = length - norm = float(np.linalg.norm((work.residual/scales)[z])) - correction = max(float(np.linalg.norm(step[[i for i in z if i < 24]])), - float(np.linalg.norm(step[24:]))/max(1., float(np.linalg.norm(state.mechanical.resultants)))) - if norm <= 1e-11 and correction <= 1e-11: - if (not np.array_equal(state.mechanical.positions, source_positions) - or not np.array_equal(state.mechanical.position_low, source_low) - or not np.array_equal(state.mechanical.cell_rotations, source_cells)): - raise ValueError('algebraic consistency changed physical coordinates') - return AlgebraicConsistency(state, work, iteration, backtracks, norm, correction, - rank, minimum, maximum, condition) - if iteration == self.max_iterations: - raise ValueError('dynamic elastic algebraic iteration limit') - for cut in range(self.max_backtracks+1): - self._guard(cancellation_token, 'dynamic-elastic.algebraic.trial') - proposed = self._algebraic_move(state, step*(2.**(-cut))) - trial = self._evaluate(proposed, pattern, parameter, cancellation_token) - trial_norm = float(np.linalg.norm((trial.residual/scales)[z])) - if trial_norm < norm: - state = proposed - backtracks += cut - break - else: - raise ValueError('dynamic elastic algebraic backtracking failed') - raise AssertionError('bounded algebraic loop') + + def evaluate(self, state, *, pattern=None, parameter=0., cancellation_token=None): + with self._operation(): + return self._evaluate(state, pattern, parameter, cancellation_token) + + def _algebraic_rank(self, tangent): + z = list(self.algebraic_free) + _, singular, vh = np.linalg.svd(tangent[np.ix_(z, z)]) + tolerance = 64*np.finfo(float).eps*len(z)*singular[0] + rank = int(np.count_nonzero(singular > tolerance)) + if rank != len(z): + null = np.zeros(42) + null[z] = vh[-1] + raise AlgebraicRankError(singular, null, rank) + return len(z), float(singular[-1]), float(singular[0]), float(singular[0]/singular[-1]) + + def algebraic_rank(self, state, *, cancellation_token=None): + with self._operation(): + work = self._evaluate(state, None, 0., cancellation_token) + rank, minimum, maximum, condition = self._algebraic_rank(work.spatial_jacobian) + return dict(rank=rank, sigma_min=minimum, sigma_max=maximum, condition=condition) + + def _algebraic_move(self, state, step): + # Physical positions and cell rotations are carried through bit-exactly. + m = state.mechanical + frames = np.array(m.nodal_frames, copy=True) + for node in range(3): + frames[node] = rotation(step[6*node+3:6*node+6])@m.nodal_frames[node] + resultants = m.resultants+step[24:].reshape(1, 18) + return self._issue(dict(positions=m.positions, position_low=m.position_low, + nodal_frames=frames, cell_rotations=m.cell_rotations, resultants=resultants), state.origins) + + def consistent(self, state, *, pattern=None, parameter=0., cancellation_token=None): + with self._operation(): + return self._consistent(state, pattern, parameter, cancellation_token) + + def _consistent(self, state, pattern, parameter, cancellation_token): + self._require(state) + z = list(self.algebraic_free) + source_positions = state.mechanical.positions + source_low = state.mechanical.position_low + source_cells = state.mechanical.cell_rotations + backtracks = 0 + length = float(np.linalg.norm(self.reference_positions[-1]-self.reference_positions[0])) + for iteration in range(self.max_iterations+1): + work = self._evaluate(state, pattern, parameter, cancellation_token) + rank, minimum, maximum, condition = self._algebraic_rank(work.spatial_jacobian) + step = np.zeros(42) + step[z] = np.linalg.solve(work.spatial_jacobian[np.ix_(z, z)], -work.residual[z]) + # Same retained row convention: nodal moment residual / length; + # axial/first-cell compatibility rows / length, remaining rows1. + scales = np.ones(42) + for node in range(3): + scales[6*node+3:6*node+6] = length + scales[18:30] = length + norm = float(np.linalg.norm((work.residual/scales)[z])) + correction = max(float(np.linalg.norm(step[[i for i in z if i < 24]])), + float(np.linalg.norm(step[24:]))/max(1., float(np.linalg.norm(state.mechanical.resultants)))) + if norm <= 1e-11 and correction <= 1e-11: + if (not np.array_equal(state.mechanical.positions, source_positions) + or not np.array_equal(state.mechanical.position_low, source_low) + or not np.array_equal(state.mechanical.cell_rotations, source_cells)): + raise ValueError('algebraic consistency changed physical coordinates') + return AlgebraicConsistency(state, work, iteration, backtracks, norm, correction, + rank, minimum, maximum, condition) + if iteration == self.max_iterations: + raise ValueError('dynamic elastic algebraic iteration limit') + for cut in range(self.max_backtracks+1): + self._guard(cancellation_token, 'dynamic-elastic.algebraic.trial') + proposed = self._algebraic_move(state, step*(2.**(-cut))) + trial = self._evaluate(proposed, pattern, parameter, cancellation_token) + trial_norm = float(np.linalg.norm((trial.residual/scales)[z])) + if trial_norm < norm: + state = proposed + backtracks += cut + break + else: + raise ValueError('dynamic elastic algebraic backtracking failed') + raise AssertionError('bounded algebraic loop') diff --git a/src/anysolver/_ge_beam3_effective_deadline.py b/src/anyfesolver/_ge_beam3_effective_deadline.py similarity index 100% rename from src/anysolver/_ge_beam3_effective_deadline.py rename to src/anyfesolver/_ge_beam3_effective_deadline.py diff --git a/src/anysolver/_ge_beam3_elastic_seed_continuation.py b/src/anyfesolver/_ge_beam3_elastic_seed_continuation.py similarity index 100% rename from src/anysolver/_ge_beam3_elastic_seed_continuation.py rename to src/anyfesolver/_ge_beam3_elastic_seed_continuation.py diff --git a/src/anysolver/_ge_beam3_elastic_seed_modal.py b/src/anyfesolver/_ge_beam3_elastic_seed_modal.py similarity index 100% rename from src/anysolver/_ge_beam3_elastic_seed_modal.py rename to src/anyfesolver/_ge_beam3_elastic_seed_modal.py diff --git a/src/anysolver/_ge_beam3_equilibrium_line_program.py b/src/anyfesolver/_ge_beam3_equilibrium_line_program.py similarity index 100% rename from src/anysolver/_ge_beam3_equilibrium_line_program.py rename to src/anyfesolver/_ge_beam3_equilibrium_line_program.py diff --git a/src/anysolver/_ge_beam3_equilibrium_schur_solver.py b/src/anyfesolver/_ge_beam3_equilibrium_schur_solver.py similarity index 100% rename from src/anysolver/_ge_beam3_equilibrium_schur_solver.py rename to src/anyfesolver/_ge_beam3_equilibrium_schur_solver.py diff --git a/src/anysolver/_ge_beam3_factor_chain_modes.py b/src/anyfesolver/_ge_beam3_factor_chain_modes.py similarity index 100% rename from src/anysolver/_ge_beam3_factor_chain_modes.py rename to src/anyfesolver/_ge_beam3_factor_chain_modes.py diff --git a/src/anysolver/_ge_beam3_fibre_cell.py b/src/anyfesolver/_ge_beam3_fibre_cell.py similarity index 98% rename from src/anysolver/_ge_beam3_fibre_cell.py rename to src/anyfesolver/_ge_beam3_fibre_cell.py index c1761a4ec..3e8914bd7 100644 --- a/src/anysolver/_ge_beam3_fibre_cell.py +++ b/src/anyfesolver/_ge_beam3_fibre_cell.py @@ -1,30 +1,30 @@ -"""Private simultaneous station/fibre Legendre problem for two beam cells. - -Psi*(p) = sup_x [p.L^T.x - sum_j w_j W(S_j.x; origin_j)]. -The full physical-fibre potential, not an elastic tangent substitution, is -reevaluated at fixed origin throughout the coupled solve. Not a public route. -""" -from dataclasses import dataclass -from decimal import Decimal as D, localcontext +"""Private simultaneous station/fibre Legendre problem for two beam cells. + +Psi*(p) = sup_x [p.L^T.x - sum_j w_j W(S_j.x; origin_j)]. +The full physical-fibre potential, not an elastic tangent substitution, is +reevaluated at fixed origin throughout the coupled solve. Not a public route. +""" +from dataclasses import dataclass +from decimal import Decimal as D, localcontext import hashlib from math import isfinite, nextafter, ulp -from time import monotonic - -from ._ge_beam3_fibre_section import ( - PhysicalFibreSection, FibreHistory, FibreRecovery, canonical, _scalar_pair, -) -from ._ge_beam3_station_resultant_cell import ( - zero, tr, mul, mv, dot, dec, pair, solve, cholesky, frozen, -) -from ._ge_beam3_effective_deadline import effective_deadline_seconds - - -POLICY = 'GE_BEAM3_COUPLED_PHYSICAL_FIBRE_CELL_CONJUGATE_V1' - - -@dataclass(frozen=True) +from time import monotonic + +from ._ge_beam3_fibre_section import ( + PhysicalFibreSection, FibreHistory, FibreRecovery, canonical, _scalar_pair, +) +from ._ge_beam3_station_resultant_cell import ( + zero, tr, mul, mv, dot, dec, pair, solve, cholesky, frozen, +) +from ._ge_beam3_effective_deadline import effective_deadline_seconds + + +POLICY = 'GE_BEAM3_COUPLED_PHYSICAL_FIBRE_CELL_CONJUGATE_V1' + + +@dataclass(frozen=True) class CellHistory: - cell_identity: str + cell_identity: str stations: tuple @@ -43,153 +43,153 @@ class PairedFibreTrialState(FibreTrialState): """Actual paired input and smooth current branch; not a global affine law.""" resultants_low: tuple smooth: bool - - -def _section_response(section, strain, origins, check, *, include_energy=False): - """Decimal first/second variations and recovery of the declared potential.""" - stress = mv(section._background, strain) - tangent = [list(row) for row in section._background] - potential = dot(strain, stress)/2 - stored = potential; previous_hardening = D(0); dissipation = D(0) - proposed = []; recovered = [] - for fibre, (z0, p0) in zip(section.fibres, origins): - check(); b = section._map(fibre); area = D.from_float(fibre.area); young = D.from_float(fibre.young) - ef = dot(b, strain); delta, et, branch = fibre.curve._return(young, ef, z0, p0) - z = z0+delta; p = p0+abs(delta); elastic = ef-z; sigma = young*elastic - potential += area*(young*elastic*elastic/2+fibre.curve._integral(p0, p)) - if include_energy: - y0 = D.from_float(fibre.curve.flow_stress[0]) - stored += area*(young*elastic*elastic/2+ - fibre.curve._integral(D(0), p)-y0*p) - previous_hardening += area*(fibre.curve._integral(D(0), p0)-y0*p0) - dissipation += area*y0*abs(delta) - for i in range(6): - stress[i] += area*b[i]*sigma - for j in range(6): tangent[i][j] += area*et*b[i]*b[j] - zh, zl = _scalar_pair(z); ph, pl = _scalar_pair(p) - proposed.append((zh, zl, ph, pl)) - recovered.append(FibreRecovery(fibre.fibre_id, _scalar_pair(ef), _scalar_pair(elastic), - _scalar_pair(sigma), _scalar_pair(et), _scalar_pair(delta), branch)) - fields = potential, stress, tangent, tuple(proposed), tuple(recovered) - return fields + (stored, previous_hardening, dissipation) if include_energy else fields - - -class FibreCellConjugate: - __slots__ = ('section', 'stations', 'identity', 'load_map', 'size', '_elastic', '_sealed') - - def __setattr__(self, name, value): - if getattr(self, '_sealed', False): raise AttributeError('captured fibre cell is immutable') - object.__setattr__(self, name, value) - - def __init__(self, section, stations): - if type(section) is not PhysicalFibreSection or len(section.fibres) > 32: - raise ValueError('explicit bounded physical fibre section required') - if type(stations) not in (list, tuple) or not 4 <= len(stations) <= 32: - raise ValueError('bounded station inventory required') - started = monotonic() - def check(): - if monotonic()-started > effective_deadline_seconds(60.): raise TimeoutError('fibre cell compiler deadline') - self.section = section; self.size = 6+3*len(stations) - rows = []; capture = [] - with localcontext() as context: - context.prec = 80 - load = zero(self.size, 18); elastic = zero(self.size, self.size) - for i in range(6): load[i][i] = D(1) - c = [list(row) for row in section._background] - for fibre in section.fibres: - b = section._map(fibre); weight = dec(fibre.area)*dec(fibre.young) - for i in range(6): - for j in range(6): c[i][j] += weight*b[i]*b[j] - for station, row in enumerate(stations): - check() - if type(row) is not dict or set(row) != {'cell', 't', 'weight', 'v'}: - raise ValueError('exact cell station schema required') - cell = row['cell']; t = dec(row['t']); weight = dec(row['weight']) - if type(cell) is not int or cell not in (0, 1) or weight <= 0 or not 0 < t < 1: - raise ValueError('positive interior half-cell station required') - v = [[dec(x) for x in r] for r in row['v']] - if len(v) != 3 or any(len(r) != 3 for r in v): raise ValueError('three by three station map required') - mapping = zero(6, 6) - for i in range(3): - mapping[i][:3] = v[i] - mapping[3+i][3+i] = D(1) - load[6+3*station+i][6+6*cell+i] = weight*(1-t) - load[6+3*station+i][9+6*cell+i] = weight*t - indices = tuple(range(3*cell, 3*cell+3))+tuple(range(6+3*station, 9+3*station)) - block = mul(mul(tr(mapping), c), mapping) - for i, a in enumerate(indices): - for j, b in enumerate(indices): elastic[a][b] += weight*block[i][j] - rows.append((cell, weight, frozen(mapping), indices)) - capture.append(dict(cell=cell, t=float(t), weight=float(weight), v=[[float(x) for x in r] for r in v])) - if {row[0] for row in rows} != {0, 1}: raise ValueError('both half-cells must be represented') - if any(len({row['t'] for row in capture if row['cell'] == cell}) < 2 for cell in (0, 1)): - raise ValueError('two distinct stations per half-cell required for endpoint moment work') - cholesky(elastic) - self.load_map = frozen(load); self._elastic = frozen(elastic); self.stations = tuple(rows) - self.identity = hashlib.sha256(canonical(dict(policy=POLICY, section=section.identity, - stations=capture))).hexdigest() - check(); self._sealed = True - - def virgin(self): - return CellHistory(self.identity, tuple(self.section.virgin() for _ in self.stations)) - - def _origins(self, origin): - if (type(origin) is not CellHistory or origin.cell_identity != self.identity - or type(origin.stations) is not tuple or len(origin.stations) != len(self.stations)): - raise ValueError('complete immutable cell-bound fibre history required') - return tuple(self.section._origins(h) for h in origin.stations) - - def _evaluate(self, x, load, origins, check): - residual = [-value for value in load]; tangent = zero(self.size, self.size) - material_potential = D(0); fields = [] - for (_, weight, mapping, indices), history in zip(self.stations, origins): - check(); strain = mv(mapping, [x[i] for i in indices]) - potential, stress, modulus, proposed, recovery = _section_response(self.section, strain, history, check) - material_potential += weight*potential - vector = mv(tr(mapping), stress); block = mul(mul(tr(mapping), modulus), mapping) - for i, a in enumerate(indices): - residual[a] += weight*vector[i] - for j, b in enumerate(indices): tangent[a][b] += weight*block[i][j] - fields.append((strain, stress, proposed, recovery)) - return material_potential-dot(x, load), material_potential, residual, tangent, fields - - def _line_minimum(self, x, direction, residual, load, origins, check): - """Minimize the actual convex piecewise-quadratic potential on [0,1]. - - Every yield/table-knot crossing is known from the affine fibre strain. - This prevents geometric backtracking from crawling across narrow - elastic intervals at high material contrast. No constitutive tuning. - """ - cuts = {D(0), D(1)} - for (_, _, mapping, indices), history in zip(self.stations, origins): - strain = mv(mapping, [x[i] for i in indices]) - change = mv(mapping, [direction[i] for i in indices]) - for fibre, (z0, p0) in zip(self.section.fibres, history): - check(); b = self.section._map(fibre); ef = dot(b, strain); de = dot(b, change) - if de == 0: continue - young = dec(fibre.young) - levels = (p0,)+tuple(D.from_float(k) for k in fibre.curve.plastic_strain if D.from_float(k) > p0) - for accumulated in levels: - check() - flow = fibre.curve._at(accumulated)[0] - for sign in (-1, 1): - boundary = z0+sign*(accumulated-p0+flow/young) - alpha = (boundary-ef)/de - if 0 < alpha < 1: cuts.add(alpha) - if len(cuts) > 4096: raise ValueError('coupled fibre line-partition limit') - ordered = sorted(cuts); slope = dot(residual, direction) - evaluations = 0 - for left, right in zip(ordered, ordered[1:]): - check(); midpoint = (left+right)/2 - point = [v+midpoint*d for v, d in zip(x, direction)] - tangent = self._evaluate(point, load, origins, check)[3]; evaluations += 1 - curvature = dot(direction, mv(tangent, direction)) - if curvature <= 0: raise ValueError('nonpositive fibre line curvature; strict conjugate unavailable') - root = left-slope/curvature - if left <= root <= right: return root, evaluations - slope += curvature*(right-left) - return D(1), evaluations - + + +def _section_response(section, strain, origins, check, *, include_energy=False): + """Decimal first/second variations and recovery of the declared potential.""" + stress = mv(section._background, strain) + tangent = [list(row) for row in section._background] + potential = dot(strain, stress)/2 + stored = potential; previous_hardening = D(0); dissipation = D(0) + proposed = []; recovered = [] + for fibre, (z0, p0) in zip(section.fibres, origins): + check(); b = section._map(fibre); area = D.from_float(fibre.area); young = D.from_float(fibre.young) + ef = dot(b, strain); delta, et, branch = fibre.curve._return(young, ef, z0, p0) + z = z0+delta; p = p0+abs(delta); elastic = ef-z; sigma = young*elastic + potential += area*(young*elastic*elastic/2+fibre.curve._integral(p0, p)) + if include_energy: + y0 = D.from_float(fibre.curve.flow_stress[0]) + stored += area*(young*elastic*elastic/2+ + fibre.curve._integral(D(0), p)-y0*p) + previous_hardening += area*(fibre.curve._integral(D(0), p0)-y0*p0) + dissipation += area*y0*abs(delta) + for i in range(6): + stress[i] += area*b[i]*sigma + for j in range(6): tangent[i][j] += area*et*b[i]*b[j] + zh, zl = _scalar_pair(z); ph, pl = _scalar_pair(p) + proposed.append((zh, zl, ph, pl)) + recovered.append(FibreRecovery(fibre.fibre_id, _scalar_pair(ef), _scalar_pair(elastic), + _scalar_pair(sigma), _scalar_pair(et), _scalar_pair(delta), branch)) + fields = potential, stress, tangent, tuple(proposed), tuple(recovered) + return fields + (stored, previous_hardening, dissipation) if include_energy else fields + + +class FibreCellConjugate: + __slots__ = ('section', 'stations', 'identity', 'load_map', 'size', '_elastic', '_sealed') + + def __setattr__(self, name, value): + if getattr(self, '_sealed', False): raise AttributeError('captured fibre cell is immutable') + object.__setattr__(self, name, value) + + def __init__(self, section, stations): + if type(section) is not PhysicalFibreSection or len(section.fibres) > 32: + raise ValueError('explicit bounded physical fibre section required') + if type(stations) not in (list, tuple) or not 4 <= len(stations) <= 32: + raise ValueError('bounded station inventory required') + started = monotonic() + def check(): + if monotonic()-started > effective_deadline_seconds(60.): raise TimeoutError('fibre cell compiler deadline') + self.section = section; self.size = 6+3*len(stations) + rows = []; capture = [] + with localcontext() as context: + context.prec = 80 + load = zero(self.size, 18); elastic = zero(self.size, self.size) + for i in range(6): load[i][i] = D(1) + c = [list(row) for row in section._background] + for fibre in section.fibres: + b = section._map(fibre); weight = dec(fibre.area)*dec(fibre.young) + for i in range(6): + for j in range(6): c[i][j] += weight*b[i]*b[j] + for station, row in enumerate(stations): + check() + if type(row) is not dict or set(row) != {'cell', 't', 'weight', 'v'}: + raise ValueError('exact cell station schema required') + cell = row['cell']; t = dec(row['t']); weight = dec(row['weight']) + if type(cell) is not int or cell not in (0, 1) or weight <= 0 or not 0 < t < 1: + raise ValueError('positive interior half-cell station required') + v = [[dec(x) for x in r] for r in row['v']] + if len(v) != 3 or any(len(r) != 3 for r in v): raise ValueError('three by three station map required') + mapping = zero(6, 6) + for i in range(3): + mapping[i][:3] = v[i] + mapping[3+i][3+i] = D(1) + load[6+3*station+i][6+6*cell+i] = weight*(1-t) + load[6+3*station+i][9+6*cell+i] = weight*t + indices = tuple(range(3*cell, 3*cell+3))+tuple(range(6+3*station, 9+3*station)) + block = mul(mul(tr(mapping), c), mapping) + for i, a in enumerate(indices): + for j, b in enumerate(indices): elastic[a][b] += weight*block[i][j] + rows.append((cell, weight, frozen(mapping), indices)) + capture.append(dict(cell=cell, t=float(t), weight=float(weight), v=[[float(x) for x in r] for r in v])) + if {row[0] for row in rows} != {0, 1}: raise ValueError('both half-cells must be represented') + if any(len({row['t'] for row in capture if row['cell'] == cell}) < 2 for cell in (0, 1)): + raise ValueError('two distinct stations per half-cell required for endpoint moment work') + cholesky(elastic) + self.load_map = frozen(load); self._elastic = frozen(elastic); self.stations = tuple(rows) + self.identity = hashlib.sha256(canonical(dict(policy=POLICY, section=section.identity, + stations=capture))).hexdigest() + check(); self._sealed = True + + def virgin(self): + return CellHistory(self.identity, tuple(self.section.virgin() for _ in self.stations)) + + def _origins(self, origin): + if (type(origin) is not CellHistory or origin.cell_identity != self.identity + or type(origin.stations) is not tuple or len(origin.stations) != len(self.stations)): + raise ValueError('complete immutable cell-bound fibre history required') + return tuple(self.section._origins(h) for h in origin.stations) + + def _evaluate(self, x, load, origins, check): + residual = [-value for value in load]; tangent = zero(self.size, self.size) + material_potential = D(0); fields = [] + for (_, weight, mapping, indices), history in zip(self.stations, origins): + check(); strain = mv(mapping, [x[i] for i in indices]) + potential, stress, modulus, proposed, recovery = _section_response(self.section, strain, history, check) + material_potential += weight*potential + vector = mv(tr(mapping), stress); block = mul(mul(tr(mapping), modulus), mapping) + for i, a in enumerate(indices): + residual[a] += weight*vector[i] + for j, b in enumerate(indices): tangent[a][b] += weight*block[i][j] + fields.append((strain, stress, proposed, recovery)) + return material_potential-dot(x, load), material_potential, residual, tangent, fields + + def _line_minimum(self, x, direction, residual, load, origins, check): + """Minimize the actual convex piecewise-quadratic potential on [0,1]. + + Every yield/table-knot crossing is known from the affine fibre strain. + This prevents geometric backtracking from crawling across narrow + elastic intervals at high material contrast. No constitutive tuning. + """ + cuts = {D(0), D(1)} + for (_, _, mapping, indices), history in zip(self.stations, origins): + strain = mv(mapping, [x[i] for i in indices]) + change = mv(mapping, [direction[i] for i in indices]) + for fibre, (z0, p0) in zip(self.section.fibres, history): + check(); b = self.section._map(fibre); ef = dot(b, strain); de = dot(b, change) + if de == 0: continue + young = dec(fibre.young) + levels = (p0,)+tuple(D.from_float(k) for k in fibre.curve.plastic_strain if D.from_float(k) > p0) + for accumulated in levels: + check() + flow = fibre.curve._at(accumulated)[0] + for sign in (-1, 1): + boundary = z0+sign*(accumulated-p0+flow/young) + alpha = (boundary-ef)/de + if 0 < alpha < 1: cuts.add(alpha) + if len(cuts) > 4096: raise ValueError('coupled fibre line-partition limit') + ordered = sorted(cuts); slope = dot(residual, direction) + evaluations = 0 + for left, right in zip(ordered, ordered[1:]): + check(); midpoint = (left+right)/2 + point = [v+midpoint*d for v, d in zip(x, direction)] + tangent = self._evaluate(point, load, origins, check)[3]; evaluations += 1 + curvature = dot(direction, mv(tangent, direction)) + if curvature <= 0: raise ValueError('nonpositive fibre line curvature; strict conjugate unavailable') + root = left-slope/curvature + if left <= root <= right: return root, evaluations + slope += curvature*(right-left) + return D(1), evaluations + def boundary_amount(self, trial, direction, *, origin, check=None): """First fixed-origin yield/table crossing, guarded for binary64 updates. @@ -308,14 +308,14 @@ def response(self, resultants, origin=None, *, check=None, include_energy=False, raise ValueError('explicit native energy recovery policy required') if type(capture_trial) is not bool: raise ValueError('explicit fibre trial capture policy required') - started = monotonic() - def guard(): - if check is not None: check() - if monotonic()-started > effective_deadline_seconds(60.): raise TimeoutError('coupled fibre cell deadline') - guard() - origin = self.virgin() if origin is None else origin - with localcontext() as context: - context.prec = 80 + started = monotonic() + def guard(): + if check is not None: check() + if monotonic()-started > effective_deadline_seconds(60.): raise TimeoutError('coupled fibre cell deadline') + guard() + origin = self.virgin() if origin is None else origin + with localcontext() as context: + context.prec = 80 p = [dec(x) for x in resultants] if len(p) != 18: raise ValueError('18 retained resultants required') if resultants_low is not None: @@ -326,53 +326,53 @@ def guard(): for high, correction in zip(resultants, resultants_low): validate_pair(high, correction) p = [high+correction for high, correction in zip(p, low)] - origins = self._origins(origin); load = mv(self.load_map, p) - # Virgin tangent is only a predictor. Origin plastic strains enter - # its linear term; all actual trial states use the nonlinear law. - predictor = list(load) - for (_, weight, mapping, indices), history in zip(self.stations, origins): - s = [D(0)]*6 - for fibre, (z0, _) in zip(self.section.fibres, history): - b = self.section._map(fibre); scale = dec(fibre.area)*dec(fibre.young)*z0 - for i in range(6): s[i] += scale*b[i] - for i, value in zip(indices, mv(tr(mapping), s)): predictor[i] += weight*value - x = [row[0] for row in solve([list(row) for row in self._elastic], [[v] for v in predictor], guard)] - threshold = D('1e-28')*max(D(1), *(abs(v) for v in load)) - evaluations = 0; line_trials = 0 - for iteration in range(49): - guard(); objective, material, residual, tangent, fields = self._evaluate(x, load, origins, guard) - evaluations += 1 - if max(abs(v) for v in residual) <= threshold: break - if iteration == 48: raise ValueError('coupled fibre Newton update limit') - # No pseudo-inverse, shift, stiffness floor or invented yield strength. - try: cholesky(tangent) - except ValueError as error: raise ValueError('nonpositive current fibre cell tangent; strict conjugate unavailable') from error - direction = [row[0] for row in solve(tangent, [[-v] for v in residual], guard)] - slope = dot(residual, direction) - if slope >= 0: raise ValueError('nondecreasing coupled fibre Newton direction') - alpha, count = self._line_minimum(x, direction, residual, load, origins, guard) - proposed = [v+alpha*d for v, d in zip(x, direction)] - candidate = self._evaluate(proposed, load, origins, guard)[0] - evaluations += count+1; line_trials += count - if alpha <= 0 or candidate >= objective: - raise ValueError('nondecreasing exact-partition fibre line step') - x = proposed - try: cholesky(tangent) - except ValueError as error: raise ValueError('nonpositive accepted fibre cell tangent; smooth compliance unavailable') from error + origins = self._origins(origin); load = mv(self.load_map, p) + # Virgin tangent is only a predictor. Origin plastic strains enter + # its linear term; all actual trial states use the nonlinear law. + predictor = list(load) + for (_, weight, mapping, indices), history in zip(self.stations, origins): + s = [D(0)]*6 + for fibre, (z0, _) in zip(self.section.fibres, history): + b = self.section._map(fibre); scale = dec(fibre.area)*dec(fibre.young)*z0 + for i in range(6): s[i] += scale*b[i] + for i, value in zip(indices, mv(tr(mapping), s)): predictor[i] += weight*value + x = [row[0] for row in solve([list(row) for row in self._elastic], [[v] for v in predictor], guard)] + threshold = D('1e-28')*max(D(1), *(abs(v) for v in load)) + evaluations = 0; line_trials = 0 + for iteration in range(49): + guard(); objective, material, residual, tangent, fields = self._evaluate(x, load, origins, guard) + evaluations += 1 + if max(abs(v) for v in residual) <= threshold: break + if iteration == 48: raise ValueError('coupled fibre Newton update limit') + # No pseudo-inverse, shift, stiffness floor or invented yield strength. + try: cholesky(tangent) + except ValueError as error: raise ValueError('nonpositive current fibre cell tangent; strict conjugate unavailable') from error + direction = [row[0] for row in solve(tangent, [[-v] for v in residual], guard)] + slope = dot(residual, direction) + if slope >= 0: raise ValueError('nondecreasing coupled fibre Newton direction') + alpha, count = self._line_minimum(x, direction, residual, load, origins, guard) + proposed = [v+alpha*d for v, d in zip(x, direction)] + candidate = self._evaluate(proposed, load, origins, guard)[0] + evaluations += count+1; line_trials += count + if alpha <= 0 or candidate >= objective: + raise ValueError('nondecreasing exact-partition fibre line step') + x = proposed + try: cholesky(tangent) + except ValueError as error: raise ValueError('nonpositive accepted fibre cell tangent; smooth compliance unavailable') from error strain_compliance = solve(tangent, [list(row) for row in self.load_map], guard) compliance = mul(tr(self.load_map), strain_compliance) - gradient = mv(tr(self.load_map), x) - history = CellHistory(self.identity, tuple(FibreHistory(self.section.identity, row[2]) for row in fields)) - self._origins(history) - station_rows = [dict(strain=pair(strain), resultants=pair(stress), fibres=recovery) - for strain, stress, _, recovery in fields] - boundary = any(f.branch in ('YIELD_BOUNDARY', 'HARDENING_KNOT') for row in fields for f in row[3]) - response = dict(policy=POLICY, cell_identity=self.identity, origin=origin, history=history, - potential=pair([-objective]), material_potential=pair([material]), gradient=pair(gradient), - hessian=[pair(row) for row in compliance], stations=station_rows, - iterations=iteration, evaluations=evaluations, line_trials=line_trials, - residual=str(max(abs(v) for v in residual)), - derivative_kind='SEMISMOOTH_BRANCH_SELECTION' if boundary else 'CLASSICAL_SMOOTH_BRANCH', + gradient = mv(tr(self.load_map), x) + history = CellHistory(self.identity, tuple(FibreHistory(self.section.identity, row[2]) for row in fields)) + self._origins(history) + station_rows = [dict(strain=pair(strain), resultants=pair(stress), fibres=recovery) + for strain, stress, _, recovery in fields] + boundary = any(f.branch in ('YIELD_BOUNDARY', 'HARDENING_KNOT') for row in fields for f in row[3]) + response = dict(policy=POLICY, cell_identity=self.identity, origin=origin, history=history, + potential=pair([-objective]), material_potential=pair([material]), gradient=pair(gradient), + hessian=[pair(row) for row in compliance], stations=station_rows, + iterations=iteration, evaluations=evaluations, line_trials=line_trials, + residual=str(max(abs(v) for v in residual)), + derivative_kind='SEMISMOOTH_BRANCH_SELECTION' if boundary else 'CLASSICAL_SMOOTH_BRANCH', production_qualified=False) if capture_trial: response['_trial_state'] = FibreTrialState(self.identity, origin, tuple(float(v) for v in p), @@ -384,25 +384,25 @@ def guard(): response['_trial_state'] = PairedFibreTrialState(self.identity, origin, tuple(float(v) for v in resultants), old.strains, old.strain_compliances, tuple(float(v) for v in resultants_low), not boundary) - if include_energy: - stored = D(0); previous_hardening = D(0); dissipation = D(0) - for (_, weight, _, _), predecessor, fields_row, station in zip( - self.stations, origins, fields, station_rows): - strain, stress, proposed, recovery = fields_row - repeated = _section_response(self.section, strain, predecessor, - guard, include_energy=True) - if (repeated[1] != stress or repeated[3] != proposed or - repeated[4] != recovery): - raise ValueError('native energy recovery changed accepted station response') - stored += weight*repeated[5] - previous_hardening += weight*repeated[6] - dissipation += weight*repeated[7] - station['stored_energy_per_length'] = _scalar_pair(repeated[5]) - station['previous_hardening_per_length'] = _scalar_pair(repeated[6]) - station['incremental_dissipation_per_length'] = _scalar_pair(repeated[7]) - response['stored_energy'] = _scalar_pair(stored) - response['previous_hardening_energy'] = _scalar_pair(previous_hardening) - response['incremental_dissipation'] = _scalar_pair(dissipation) - response['energy_recovery_station_updates'] = len(fields) - guard() - return response + if include_energy: + stored = D(0); previous_hardening = D(0); dissipation = D(0) + for (_, weight, _, _), predecessor, fields_row, station in zip( + self.stations, origins, fields, station_rows): + strain, stress, proposed, recovery = fields_row + repeated = _section_response(self.section, strain, predecessor, + guard, include_energy=True) + if (repeated[1] != stress or repeated[3] != proposed or + repeated[4] != recovery): + raise ValueError('native energy recovery changed accepted station response') + stored += weight*repeated[5] + previous_hardening += weight*repeated[6] + dissipation += weight*repeated[7] + station['stored_energy_per_length'] = _scalar_pair(repeated[5]) + station['previous_hardening_per_length'] = _scalar_pair(repeated[6]) + station['incremental_dissipation_per_length'] = _scalar_pair(repeated[7]) + response['stored_energy'] = _scalar_pair(stored) + response['previous_hardening_energy'] = _scalar_pair(previous_hardening) + response['incremental_dissipation'] = _scalar_pair(dissipation) + response['energy_recovery_station_updates'] = len(fields) + guard() + return response diff --git a/src/anysolver/_ge_beam3_fibre_distributed_couples.py b/src/anyfesolver/_ge_beam3_fibre_distributed_couples.py similarity index 100% rename from src/anysolver/_ge_beam3_fibre_distributed_couples.py rename to src/anyfesolver/_ge_beam3_fibre_distributed_couples.py diff --git a/src/anysolver/_ge_beam3_fibre_kinematic_cell.py b/src/anyfesolver/_ge_beam3_fibre_kinematic_cell.py similarity index 100% rename from src/anysolver/_ge_beam3_fibre_kinematic_cell.py rename to src/anyfesolver/_ge_beam3_fibre_kinematic_cell.py diff --git a/src/anysolver/_ge_beam3_fibre_line_program.py b/src/anyfesolver/_ge_beam3_fibre_line_program.py similarity index 100% rename from src/anysolver/_ge_beam3_fibre_line_program.py rename to src/anyfesolver/_ge_beam3_fibre_line_program.py diff --git a/src/anysolver/_ge_beam3_fibre_line_work.py b/src/anyfesolver/_ge_beam3_fibre_line_work.py similarity index 100% rename from src/anysolver/_ge_beam3_fibre_line_work.py rename to src/anyfesolver/_ge_beam3_fibre_line_work.py diff --git a/src/anysolver/_ge_beam3_fibre_reference_modal.py b/src/anyfesolver/_ge_beam3_fibre_reference_modal.py similarity index 100% rename from src/anysolver/_ge_beam3_fibre_reference_modal.py rename to src/anyfesolver/_ge_beam3_fibre_reference_modal.py diff --git a/src/anysolver/_ge_beam3_fibre_schur_solver.py b/src/anyfesolver/_ge_beam3_fibre_schur_solver.py similarity index 98% rename from src/anysolver/_ge_beam3_fibre_schur_solver.py rename to src/anyfesolver/_ge_beam3_fibre_schur_solver.py index 5adbf5ee8..5a211d272 100644 --- a/src/anysolver/_ge_beam3_fibre_schur_solver.py +++ b/src/anyfesolver/_ge_beam3_fibre_schur_solver.py @@ -108,7 +108,7 @@ def solve(self,rhs): c_inv_b=linalg.cho_solve((chol,True),columns[list(block)],check_finite=True) reduced_rhs+=self.matrix[np.ix_(g,block)]@c_inv_b locals_rhs.append(c_inv_b) - # Reuse the same ordinary ANYsolver factorization for Newton and merit RHS. + # Reuse the same ordinary ANYfeSolver factorization for Newton and merit RHS. xg=self._factor.solve_many(reduced_rhs) x=np.zeros_like(columns); x[list(g)]=xg for block,(_,lift),c_inv_b in zip(self.blocks,self._local,locals_rhs): diff --git a/src/anysolver/_ge_beam3_fibre_section.py b/src/anyfesolver/_ge_beam3_fibre_section.py similarity index 100% rename from src/anysolver/_ge_beam3_fibre_section.py rename to src/anyfesolver/_ge_beam3_fibre_section.py diff --git a/src/anysolver/_ge_beam3_fibre_static_boundary.py b/src/anyfesolver/_ge_beam3_fibre_static_boundary.py similarity index 100% rename from src/anysolver/_ge_beam3_fibre_static_boundary.py rename to src/anyfesolver/_ge_beam3_fibre_static_boundary.py diff --git a/src/anysolver/_ge_beam3_g1_analysis.py b/src/anyfesolver/_ge_beam3_g1_analysis.py similarity index 100% rename from src/anysolver/_ge_beam3_g1_analysis.py rename to src/anyfesolver/_ge_beam3_g1_analysis.py diff --git a/src/anysolver/_ge_beam3_g1_elastic.py b/src/anyfesolver/_ge_beam3_g1_elastic.py similarity index 100% rename from src/anysolver/_ge_beam3_g1_elastic.py rename to src/anyfesolver/_ge_beam3_g1_elastic.py diff --git a/src/anysolver/_ge_beam3_g1_element.py b/src/anyfesolver/_ge_beam3_g1_element.py similarity index 100% rename from src/anysolver/_ge_beam3_g1_element.py rename to src/anyfesolver/_ge_beam3_g1_element.py diff --git a/src/anysolver/_ge_beam3_g1_operator.py b/src/anyfesolver/_ge_beam3_g1_operator.py similarity index 100% rename from src/anysolver/_ge_beam3_g1_operator.py rename to src/anyfesolver/_ge_beam3_g1_operator.py diff --git a/src/anysolver/_ge_beam3_g2_analysis.py b/src/anyfesolver/_ge_beam3_g2_analysis.py similarity index 100% rename from src/anysolver/_ge_beam3_g2_analysis.py rename to src/anyfesolver/_ge_beam3_g2_analysis.py diff --git a/src/anysolver/_ge_beam3_g2_constraints.py b/src/anyfesolver/_ge_beam3_g2_constraints.py similarity index 100% rename from src/anysolver/_ge_beam3_g2_constraints.py rename to src/anyfesolver/_ge_beam3_g2_constraints.py diff --git a/src/anysolver/_ge_beam3_g3_analysis.py b/src/anyfesolver/_ge_beam3_g3_analysis.py similarity index 100% rename from src/anysolver/_ge_beam3_g3_analysis.py rename to src/anyfesolver/_ge_beam3_g3_analysis.py diff --git a/src/anysolver/_ge_beam3_g3_constraints.py b/src/anyfesolver/_ge_beam3_g3_constraints.py similarity index 100% rename from src/anysolver/_ge_beam3_g3_constraints.py rename to src/anyfesolver/_ge_beam3_g3_constraints.py diff --git a/src/anysolver/_ge_beam3_g3b_owner.py b/src/anyfesolver/_ge_beam3_g3b_owner.py similarity index 100% rename from src/anysolver/_ge_beam3_g3b_owner.py rename to src/anyfesolver/_ge_beam3_g3b_owner.py diff --git a/src/anysolver/_ge_beam3_g3b_q4_reference.py b/src/anyfesolver/_ge_beam3_g3b_q4_reference.py similarity index 100% rename from src/anysolver/_ge_beam3_g3b_q4_reference.py rename to src/anyfesolver/_ge_beam3_g3b_q4_reference.py diff --git a/src/anysolver/_ge_beam3_g3b_reference.py b/src/anyfesolver/_ge_beam3_g3b_reference.py similarity index 100% rename from src/anysolver/_ge_beam3_g3b_reference.py rename to src/anyfesolver/_ge_beam3_g3b_reference.py diff --git a/src/anysolver/_ge_beam3_g3b_result_schema.py b/src/anyfesolver/_ge_beam3_g3b_result_schema.py similarity index 100% rename from src/anysolver/_ge_beam3_g3b_result_schema.py rename to src/anyfesolver/_ge_beam3_g3b_result_schema.py diff --git a/src/anysolver/_ge_beam3_g3b_s3_reference.py b/src/anyfesolver/_ge_beam3_g3b_s3_reference.py similarity index 100% rename from src/anysolver/_ge_beam3_g3b_s3_reference.py rename to src/anyfesolver/_ge_beam3_g3b_s3_reference.py diff --git a/src/anysolver/_ge_beam3_g3b_weighted_reference.py b/src/anyfesolver/_ge_beam3_g3b_weighted_reference.py similarity index 100% rename from src/anysolver/_ge_beam3_g3b_weighted_reference.py rename to src/anyfesolver/_ge_beam3_g3b_weighted_reference.py diff --git a/src/anysolver/_ge_beam3_g3c_affine_q4_chart.py b/src/anyfesolver/_ge_beam3_g3c_affine_q4_chart.py similarity index 100% rename from src/anysolver/_ge_beam3_g3c_affine_q4_chart.py rename to src/anyfesolver/_ge_beam3_g3c_affine_q4_chart.py diff --git a/src/anysolver/_ge_beam3_g3c_affine_q4_increment_chart.py b/src/anyfesolver/_ge_beam3_g3c_affine_q4_increment_chart.py similarity index 100% rename from src/anysolver/_ge_beam3_g3c_affine_q4_increment_chart.py rename to src/anyfesolver/_ge_beam3_g3c_affine_q4_increment_chart.py diff --git a/src/anysolver/_ge_beam3_g3c_affine_q4_recovery.py b/src/anyfesolver/_ge_beam3_g3c_affine_q4_recovery.py similarity index 100% rename from src/anysolver/_ge_beam3_g3c_affine_q4_recovery.py rename to src/anyfesolver/_ge_beam3_g3c_affine_q4_recovery.py diff --git a/src/anysolver/_ge_beam3_g3c_affine_q4_registry.py b/src/anyfesolver/_ge_beam3_g3c_affine_q4_registry.py similarity index 100% rename from src/anysolver/_ge_beam3_g3c_affine_q4_registry.py rename to src/anyfesolver/_ge_beam3_g3c_affine_q4_registry.py diff --git a/src/anysolver/_ge_beam3_g3c_b2_physical.py b/src/anyfesolver/_ge_beam3_g3c_b2_physical.py similarity index 100% rename from src/anysolver/_ge_beam3_g3c_b2_physical.py rename to src/anyfesolver/_ge_beam3_g3c_b2_physical.py diff --git a/src/anysolver/_ge_beam3_g3c_b2_physical_adapter.py b/src/anyfesolver/_ge_beam3_g3c_b2_physical_adapter.py similarity index 100% rename from src/anysolver/_ge_beam3_g3c_b2_physical_adapter.py rename to src/anyfesolver/_ge_beam3_g3c_b2_physical_adapter.py diff --git a/src/anysolver/_ge_beam3_g3c_definition.py b/src/anyfesolver/_ge_beam3_g3c_definition.py similarity index 100% rename from src/anysolver/_ge_beam3_g3c_definition.py rename to src/anyfesolver/_ge_beam3_g3c_definition.py diff --git a/src/anysolver/_ge_beam3_g3c_local_beam.py b/src/anyfesolver/_ge_beam3_g3c_local_beam.py similarity index 100% rename from src/anysolver/_ge_beam3_g3c_local_beam.py rename to src/anyfesolver/_ge_beam3_g3c_local_beam.py diff --git a/src/anysolver/_ge_beam3_g3c_local_shell.py b/src/anyfesolver/_ge_beam3_g3c_local_shell.py similarity index 100% rename from src/anysolver/_ge_beam3_g3c_local_shell.py rename to src/anyfesolver/_ge_beam3_g3c_local_shell.py diff --git a/src/anysolver/_ge_beam3_g3c_owner.py b/src/anyfesolver/_ge_beam3_g3c_owner.py similarity index 100% rename from src/anysolver/_ge_beam3_g3c_owner.py rename to src/anyfesolver/_ge_beam3_g3c_owner.py diff --git a/src/anysolver/_ge_beam3_g3c_physical_authority.py b/src/anyfesolver/_ge_beam3_g3c_physical_authority.py similarity index 88% rename from src/anysolver/_ge_beam3_g3c_physical_authority.py rename to src/anyfesolver/_ge_beam3_g3c_physical_authority.py index 57877a3fd..448eecc11 100644 --- a/src/anysolver/_ge_beam3_g3c_physical_authority.py +++ b/src/anyfesolver/_ge_beam3_g3c_physical_authority.py @@ -11,7 +11,7 @@ # hash-bound standard-library definition module injected as _original. Normal # package use imports the same fixed module; no checkpoint selects a module. if '_original' not in globals(): - from anysolver import _ge_beam3_g3c_definition as _original + from anyfesolver import _ge_beam3_g3c_definition as _original original = _original ROOT = Path(__file__).resolve().parents[2] @@ -51,7 +51,7 @@ def capture(lease_bytes): This is private process plumbing, never a public authorization API. The runner independently verifies review, Git blobs and environment BEFORE - importing anysolver; no mechanics are admitted merely by importing us. + importing anyfesolver; no mechanics are admitted merely by importing us. """ global _LEASE if _LEASE is not None: @@ -90,13 +90,13 @@ def capture(lease_bytes): if set(row) != {'bytes', 'sha256'}: raise ValueError('lease source row schema') rows.append((path, row['bytes'], row['sha256'])) - required={'src/anysolver/_ge_beam3_g3c_physical_authority.py', - 'src/anysolver/_ge_beam3_g3c_physical_owner.py', - 'src/anysolver/_ge_beam3_g3c_b2_physical.py', - 'src/anysolver/_ge_beam3_g3c_b2_physical_adapter.py', - 'src/anysolver/_ge_beam3_g3c_affine_q4_recovery.py', - 'src/anysolver/_ge_beam3_g3c_affine_q4_registry.py', - 'src/anysolver/_ge_beam3_g3c_affine_q4_increment_chart.py',MAP,REVIEW} + required={'src/anyfesolver/_ge_beam3_g3c_physical_authority.py', + 'src/anyfesolver/_ge_beam3_g3c_physical_owner.py', + 'src/anyfesolver/_ge_beam3_g3c_b2_physical.py', + 'src/anyfesolver/_ge_beam3_g3c_b2_physical_adapter.py', + 'src/anyfesolver/_ge_beam3_g3c_affine_q4_recovery.py', + 'src/anyfesolver/_ge_beam3_g3c_affine_q4_registry.py', + 'src/anyfesolver/_ge_beam3_g3c_affine_q4_increment_chart.py',MAP,REVIEW} if not required.issubset({r[0] for r in rows}): raise ValueError('missing private source lease') made = (sha256(lease_bytes).hexdigest(), tuple(rows)) @@ -168,14 +168,14 @@ def runtime_identity(): def runtime_modules(): # Fixed imports only, never modules selected by a lease or fixture. from ._ge_beam3_g3c_stable import boundary, chart, compensated, line_work, fit - from anysolver import _ge_beam3_g3c_so3_numerics as kernel - from anysolver import _ge_beam3_mixed_ad as ad - from anysolver import _ge_beam3_g3c_recovery as recovery - from anysolver import _ge_beam3_g3c_b2_physical as physical_core - from anysolver import _ge_beam3_g3c_affine_q4_increment_chart as increment_chart - from anysolver import _ge_beam3_g3c_affine_q4_chart as connection_chart - from anysolver import _ge_beam3_g3c_local_shell as local_shell - from anysolver import e4_pl_element as q4_source + from anyfesolver import _ge_beam3_g3c_so3_numerics as kernel + from anyfesolver import _ge_beam3_mixed_ad as ad + from anyfesolver import _ge_beam3_g3c_recovery as recovery + from anyfesolver import _ge_beam3_g3c_b2_physical as physical_core + from anyfesolver import _ge_beam3_g3c_affine_q4_increment_chart as increment_chart + from anyfesolver import _ge_beam3_g3c_affine_q4_chart as connection_chart + from anyfesolver import _ge_beam3_g3c_local_shell as local_shell + from anyfesolver import e4_pl_element as q4_source return (sys.modules[__name__], original, boundary, chart, compensated, line_work, fit, kernel, ad, recovery,physical_core,increment_chart, connection_chart,local_shell,q4_source) @@ -187,7 +187,7 @@ def runtime_constants(): bound(REVIEW, REVIEW_SHA) if _LEASE is None: raise ValueError('missing private lease') - from anysolver import _ge_beam3_g3c_so3_numerics as kernel + from anyfesolver import _ge_beam3_g3c_so3_numerics as kernel sinc = tuple((-1.0)**n/factorial(2*n+1) for n in range(17)) cosc = tuple((-1.0)**n/factorial(2*n+2) for n in range(17)) log = [1.0] diff --git a/src/anysolver/_ge_beam3_g3c_physical_owner.py b/src/anyfesolver/_ge_beam3_g3c_physical_owner.py similarity index 94% rename from src/anysolver/_ge_beam3_g3c_physical_owner.py rename to src/anyfesolver/_ge_beam3_g3c_physical_owner.py index 59173372a..e914ecdec 100644 --- a/src/anysolver/_ge_beam3_g3c_physical_owner.py +++ b/src/anyfesolver/_ge_beam3_g3c_physical_owner.py @@ -11,37 +11,37 @@ import threading from time import monotonic import numpy as np -import anysolver._ge_beam3_g3c_stable.element as native_module -import anysolver._ge_beam3_g3c_stable.operator as operator_module -import anysolver._ge_beam3_g3c_stable.beam as beam_module -import anysolver._ge_beam3_g3c_stable.shell as shell_module -import anysolver._ge_beam3_g3c_stable.joint as joint_module -import anysolver._ge_beam3_g3c_b2_physical_adapter as physical_b2 -import anysolver._ge_beam3_g3c_affine_q4_recovery as physical_q4 -import anysolver._ge_beam3_g3c_affine_q4_registry as q4_registry -import anysolver.nonlinear_state as state_module -import anysolver.elements as legacy_module -import anysolver._native_rotation_state as rotation_module -import anysolver._ge_beam3_g3c_physical_authority as definition_module -from anysolver._ge_beam3_g3c_physical_authority import expand -from anysolver._ge_beam3_g3c_physical_authority import command -from anysolver._ge_beam3_g3c_physical_authority import CONTRACT_SHA -from anysolver._ge_beam3_g3c_physical_authority import U -from anysolver._ge_beam3_g3c_physical_authority import SHIFT -from anysolver._ge_beam3_g1_analysis import runtime_digest -from anysolver._ge_beam3_g1_elastic import ElasticSection -from anysolver._ge_beam3_g1_elastic import canonical -from anysolver._ge_beam3_g1_elastic import owned -from anysolver._ge_beam3_g1_elastic import sha -from anysolver._ge_beam3_g1_elastic import solve -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference -from anysolver._ge_beam3_mixed_ad import Jet2 -from anysolver._ge_beam3_mixed_ad import constant_matrix -from anysolver._ge_beam3_mixed_ad import matmul -from anysolver._ge_beam3_g3c_so3_numerics import so3_exp -from anysolver._ge_beam3_g3c_so3_numerics import so3_log -from anysolver._ge_beam3_mixed_ad import rotation_log -from anysolver.fe_core import FEModel +import anyfesolver._ge_beam3_g3c_stable.element as native_module +import anyfesolver._ge_beam3_g3c_stable.operator as operator_module +import anyfesolver._ge_beam3_g3c_stable.beam as beam_module +import anyfesolver._ge_beam3_g3c_stable.shell as shell_module +import anyfesolver._ge_beam3_g3c_stable.joint as joint_module +import anyfesolver._ge_beam3_g3c_b2_physical_adapter as physical_b2 +import anyfesolver._ge_beam3_g3c_affine_q4_recovery as physical_q4 +import anyfesolver._ge_beam3_g3c_affine_q4_registry as q4_registry +import anyfesolver.nonlinear_state as state_module +import anyfesolver.elements as legacy_module +import anyfesolver._native_rotation_state as rotation_module +import anyfesolver._ge_beam3_g3c_physical_authority as definition_module +from anyfesolver._ge_beam3_g3c_physical_authority import expand +from anyfesolver._ge_beam3_g3c_physical_authority import command +from anyfesolver._ge_beam3_g3c_physical_authority import CONTRACT_SHA +from anyfesolver._ge_beam3_g3c_physical_authority import U +from anyfesolver._ge_beam3_g3c_physical_authority import SHIFT +from anyfesolver._ge_beam3_g1_analysis import runtime_digest +from anyfesolver._ge_beam3_g1_elastic import ElasticSection +from anyfesolver._ge_beam3_g1_elastic import canonical +from anyfesolver._ge_beam3_g1_elastic import owned +from anyfesolver._ge_beam3_g1_elastic import sha +from anyfesolver._ge_beam3_g1_elastic import solve +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference +from anyfesolver._ge_beam3_mixed_ad import Jet2 +from anyfesolver._ge_beam3_mixed_ad import constant_matrix +from anyfesolver._ge_beam3_mixed_ad import matmul +from anyfesolver._ge_beam3_g3c_so3_numerics import so3_exp +from anyfesolver._ge_beam3_g3c_so3_numerics import so3_log +from anyfesolver._ge_beam3_mixed_ad import rotation_log +from anyfesolver.fe_core import FEModel POLICY='GE_BEAM3_G3C_PHYSICAL_MIXED_ELASTIC_OWNER_V1' SCHEMA='GE_BEAM3_G3C_PHYSICAL_MIXED_ELASTIC_STATE_V1' @@ -282,7 +282,7 @@ def _native_model(self,state): e=native_module.ElasticElement(row['id'],tuple(row['nodes']),Reference(x,np.tile(frame,(3,1,1))), ElasticSection.isotropic(**data['definitions']['native']),order=4) model.add_element(e.element_id,e); model.materials[e.material_name]=e.section; elements.append(e) - from anysolver.matrix_assembly import _get_cached_sparsity_pattern + from anyfesolver.matrix_assembly import _get_cached_sparsity_pattern _get_cached_sparsity_pattern(model.mesh,'tangent_stiffness') if model.mesh.dof_manager.total_dofs!=6*len(ids): raise ValueError('global DOF allocation changed') states=({e.element_id:e.init_model_bound_nonlinear_state(model.mesh,e.section,1) for e in elements} diff --git a/src/anysolver/_ge_beam3_g3c_recovery.py b/src/anyfesolver/_ge_beam3_g3c_recovery.py similarity index 100% rename from src/anysolver/_ge_beam3_g3c_recovery.py rename to src/anyfesolver/_ge_beam3_g3c_recovery.py diff --git a/src/anysolver/_ge_beam3_g3c_so3_numerics.py b/src/anyfesolver/_ge_beam3_g3c_so3_numerics.py similarity index 100% rename from src/anysolver/_ge_beam3_g3c_so3_numerics.py rename to src/anyfesolver/_ge_beam3_g3c_so3_numerics.py diff --git a/src/anysolver/_ge_beam3_g3c_stable/__init__.py b/src/anyfesolver/_ge_beam3_g3c_stable/__init__.py similarity index 100% rename from src/anysolver/_ge_beam3_g3c_stable/__init__.py rename to src/anyfesolver/_ge_beam3_g3c_stable/__init__.py diff --git a/src/anysolver/_ge_beam3_g3c_stable/authority.py b/src/anyfesolver/_ge_beam3_g3c_stable/authority.py similarity index 93% rename from src/anysolver/_ge_beam3_g3c_stable/authority.py rename to src/anyfesolver/_ge_beam3_g3c_stable/authority.py index f0afcbde7..ef3dff899 100644 --- a/src/anysolver/_ge_beam3_g3c_stable/authority.py +++ b/src/anyfesolver/_ge_beam3_g3c_stable/authority.py @@ -7,7 +7,7 @@ import subprocess import sys -from anysolver import _ge_beam3_g3c_definition as original +from anyfesolver import _ge_beam3_g3c_definition as original ROOT = Path(__file__).resolve().parents[3] MAP = 'docs/reference_cases/ge_beam3_g3c_stable_source_map_v1.json' @@ -46,7 +46,7 @@ def capture(lease_bytes): This is private process plumbing, never a public authorization API. The runner independently verifies review, Git blobs and environment BEFORE - importing anysolver; no mechanics are admitted merely by importing us. + importing anyfesolver; no mechanics are admitted merely by importing us. """ global _LEASE if _LEASE is not None: @@ -85,7 +85,7 @@ def capture(lease_bytes): if set(row) != {'bytes', 'sha256'}: raise ValueError('lease source row schema') rows.append((path, row['bytes'], row['sha256'])) - if not rows or 'src/anysolver/_ge_beam3_g3c_stable/authority.py' not in {r[0] for r in rows}: + if not rows or 'src/anyfesolver/_ge_beam3_g3c_stable/authority.py' not in {r[0] for r in rows}: raise ValueError('missing private source lease') made = (sha256(lease_bytes).hexdigest(), tuple(rows)) _verify_rows(made[1]) @@ -123,9 +123,9 @@ def expand(fixture_id, variant='BASE', common_motion='NONE'): def runtime_modules(): # Fixed imports only, never modules selected by a lease or fixture. from . import boundary, chart, compensated, line_work, fit - from anysolver import _ge_beam3_g3c_so3_numerics as kernel - from anysolver import _ge_beam3_mixed_ad as ad - from anysolver import _ge_beam3_g3c_recovery as recovery + from anyfesolver import _ge_beam3_g3c_so3_numerics as kernel + from anyfesolver import _ge_beam3_mixed_ad as ad + from anyfesolver import _ge_beam3_g3c_recovery as recovery return (sys.modules[__name__], original, boundary, chart, compensated, line_work, fit, kernel, ad, recovery) @@ -136,7 +136,7 @@ def runtime_constants(): bound(REVIEW, REVIEW_SHA) if _LEASE is None: raise ValueError('missing private lease') - from anysolver import _ge_beam3_g3c_so3_numerics as kernel + from anyfesolver import _ge_beam3_g3c_so3_numerics as kernel sinc = tuple((-1.0)**n/factorial(2*n+1) for n in range(17)) cosc = tuple((-1.0)**n/factorial(2*n+2) for n in range(17)) log = [1.0] diff --git a/src/anysolver/_ge_beam3_g3c_stable/beam.py b/src/anyfesolver/_ge_beam3_g3c_stable/beam.py similarity index 92% rename from src/anysolver/_ge_beam3_g3c_stable/beam.py rename to src/anyfesolver/_ge_beam3_g3c_stable/beam.py index a80eab6be..2b2ca48d5 100644 --- a/src/anysolver/_ge_beam3_g3c_stable/beam.py +++ b/src/anyfesolver/_ge_beam3_g3c_stable/beam.py @@ -5,15 +5,15 @@ import math import numpy as np -from anysolver._ge_beam3_mixed_ad import Jet2 -from anysolver._ge_beam3_mixed_ad import constant_matrix -from anysolver._ge_beam3_mixed_ad import matmul -from anysolver._ge_beam3_mixed_ad import matvec -from anysolver._ge_beam3_mixed_ad import transpose -from anysolver._ge_beam3_g3c_so3_numerics import so3_exp -from anysolver._ge_beam3_g3c_so3_numerics import so3_log -from anysolver._ge_beam3_mixed_ad import rotation_log -from anysolver._ge_beam3_g3c_stable.joint import _exp_terms +from anyfesolver._ge_beam3_mixed_ad import Jet2 +from anyfesolver._ge_beam3_mixed_ad import constant_matrix +from anyfesolver._ge_beam3_mixed_ad import matmul +from anyfesolver._ge_beam3_mixed_ad import matvec +from anyfesolver._ge_beam3_mixed_ad import transpose +from anyfesolver._ge_beam3_g3c_so3_numerics import so3_exp +from anyfesolver._ge_beam3_g3c_so3_numerics import so3_log +from anyfesolver._ge_beam3_mixed_ad import rotation_log +from anyfesolver._ge_beam3_g3c_stable.joint import _exp_terms POLICY='GE_BEAM3_G3C_ANCHOR_DIRECTOR_LOCAL_POTENTIAL_V1' @@ -149,10 +149,10 @@ def evaluate(self,displacement,accepted_rotations): u=array(displacement,(6*n,)); q=rotations(accepted_rotations,n) kin=deformation(ref,u,q,d['node_ids'].index(d['anchor_node'])) # New objects every call isolate legacy B2's mutable nonlinear cache. - from anysolver.fe_core import FEModel - from anysolver.fe_core import Material - from anysolver.elements import BeamElement - from anysolver.elements import QuadraticBeamElement + from anyfesolver.fe_core import FEModel + from anyfesolver.fe_core import Material + from anyfesolver.elements import BeamElement + from anyfesolver.elements import QuadraticBeamElement model=FEModel('private G3c direct anchor local trial') for node,position in zip(d['node_ids'],ref): model.add_node(node,*position) section=dict(d['section'],geometric_nonlinearity='von_karman') @@ -173,7 +173,7 @@ def evaluate(self,displacement,accepted_rotations): f,k,state=element.compute_nonlinear_response(model.mesh,material,kin.deformation,None,3,True) if state is not None: raise ValueError('unexpected local history') f=array(np.asarray(f),(6*n,)); k=array(np.asarray(k),(6*n,6*n)) - from anysolver._ge_beam3_g3c_recovery import recover + from anyfesolver._ge_beam3_g3c_recovery import recover recovery=recover(d,kin,transform,element,material,entry_seal) recovered_force=owned(np.einsum('s,sij,si->j',recovery.weights, recovery.strain_differential,recovery.resultants)) diff --git a/src/anysolver/_ge_beam3_g3c_stable/boundary.py b/src/anyfesolver/_ge_beam3_g3c_stable/boundary.py similarity index 87% rename from src/anysolver/_ge_beam3_g3c_stable/boundary.py rename to src/anyfesolver/_ge_beam3_g3c_stable/boundary.py index 5164442a5..c680332bc 100644 --- a/src/anysolver/_ge_beam3_g3c_stable/boundary.py +++ b/src/anyfesolver/_ge_beam3_g3c_stable/boundary.py @@ -1,8 +1,8 @@ import numpy as np -from anysolver._ge_beam3_p5.arrays import _array -from anysolver._native_reference_modal import _owned -from anysolver._ge_beam3_p5.algebra import skew -from anysolver._ge_beam3_g3c_stable.chart import exp_chart_terms +from anyfesolver._ge_beam3_p5.arrays import _array +from anyfesolver._native_reference_modal import _owned +from anyfesolver._ge_beam3_p5.algebra import skew +from anyfesolver._ge_beam3_g3c_stable.chart import exp_chart_terms def spatial_jacobian(conservative_residual, conservative_hessian): diff --git a/src/anysolver/_ge_beam3_g3c_stable/chart.py b/src/anyfesolver/_ge_beam3_g3c_stable/chart.py similarity index 84% rename from src/anysolver/_ge_beam3_g3c_stable/chart.py rename to src/anyfesolver/_ge_beam3_g3c_stable/chart.py index acb8dce6d..593f1f5ed 100644 --- a/src/anysolver/_ge_beam3_g3c_stable/chart.py +++ b/src/anyfesolver/_ge_beam3_g3c_stable/chart.py @@ -1,7 +1,7 @@ import numpy as np -from anysolver._ge_beam3_mixed_ad import Jet2 -from anysolver._ge_beam3_g3c_so3_numerics import so3_exp -from anysolver._ge_beam3_p5.arrays import _array +from anyfesolver._ge_beam3_mixed_ad import Jet2 +from anyfesolver._ge_beam3_g3c_so3_numerics import so3_exp +from anyfesolver._ge_beam3_p5.arrays import _array def _axial(matrix): diff --git a/src/anysolver/_ge_beam3_g3c_stable/compensated.py b/src/anyfesolver/_ge_beam3_g3c_stable/compensated.py similarity index 92% rename from src/anysolver/_ge_beam3_g3c_stable/compensated.py rename to src/anyfesolver/_ge_beam3_g3c_stable/compensated.py index 8fad6564a..99a337401 100644 --- a/src/anysolver/_ge_beam3_g3c_stable/compensated.py +++ b/src/anyfesolver/_ge_beam3_g3c_stable/compensated.py @@ -1,8 +1,8 @@ import math import numpy as np -from anysolver._ge_beam3_mixed_ad import Jet2 -from anysolver._ge_beam3_mixed_ad import transpose -from anysolver._ge_beam3_p5.compensated_coordinates import split_sum +from anyfesolver._ge_beam3_mixed_ad import Jet2 +from anyfesolver._ge_beam3_mixed_ad import transpose +from anyfesolver._ge_beam3_p5.compensated_coordinates import split_sum def sum_jets(terms): diff --git a/src/anysolver/_ge_beam3_g3c_stable/element.py b/src/anyfesolver/_ge_beam3_g3c_stable/element.py similarity index 94% rename from src/anysolver/_ge_beam3_g3c_stable/element.py rename to src/anyfesolver/_ge_beam3_g3c_stable/element.py index fa28372b1..b1095ff8f 100644 --- a/src/anysolver/_ge_beam3_g3c_stable/element.py +++ b/src/anyfesolver/_ge_beam3_g3c_stable/element.py @@ -2,16 +2,16 @@ from copy import deepcopy from fractions import Fraction import numpy as np -from anysolver.elements import Element -from anysolver._native_material_protocol import PROTOCOL -from anysolver._native_material_protocol import NativeMaterialValidator -from anysolver._native_material_protocol import NativeMaterialContext -from anysolver._ge_beam3_g3c_stable.boundary import chart_pullback -from anysolver._ge_beam3_g1_elastic import owned -from anysolver._ge_beam3_g1_elastic import sha -from anysolver._ge_beam3_g1_elastic import canonical -from anysolver._ge_beam3_g3c_stable.operator import ElasticOperator -from anysolver._ge_beam3_g3c_stable.operator import local_solve +from anyfesolver.elements import Element +from anyfesolver._native_material_protocol import PROTOCOL +from anyfesolver._native_material_protocol import NativeMaterialValidator +from anyfesolver._native_material_protocol import NativeMaterialContext +from anyfesolver._ge_beam3_g3c_stable.boundary import chart_pullback +from anyfesolver._ge_beam3_g1_elastic import owned +from anyfesolver._ge_beam3_g1_elastic import sha +from anyfesolver._ge_beam3_g1_elastic import canonical +from anyfesolver._ge_beam3_g3c_stable.operator import ElasticOperator +from anyfesolver._ge_beam3_g3c_stable.operator import local_solve FORMULATION = "CANDIDATE_GE_BEAM3_G3C_STABLE_ELASTIC_STATIC_V1" SCHEMA = "GE_BEAM3_G1_ELASTIC_STATE_V1" diff --git a/src/anysolver/_ge_beam3_g3c_stable/fit.py b/src/anyfesolver/_ge_beam3_g3c_stable/fit.py similarity index 98% rename from src/anysolver/_ge_beam3_g3c_stable/fit.py rename to src/anyfesolver/_ge_beam3_g3c_stable/fit.py index 8131bc8d6..1659ade1a 100644 --- a/src/anysolver/_ge_beam3_g3c_stable/fit.py +++ b/src/anyfesolver/_ge_beam3_g3c_stable/fit.py @@ -1,5 +1,5 @@ import numpy as np -from anysolver._ge_beam3_mixed_ad import Jet2 +from anyfesolver._ge_beam3_mixed_ad import Jet2 def _davenport(c): diff --git a/src/anysolver/_ge_beam3_g3c_stable/joint.py b/src/anyfesolver/_ge_beam3_g3c_stable/joint.py similarity index 95% rename from src/anysolver/_ge_beam3_g3c_stable/joint.py rename to src/anyfesolver/_ge_beam3_g3c_stable/joint.py index 55edb93aa..dd8f49762 100644 --- a/src/anysolver/_ge_beam3_g3c_stable/joint.py +++ b/src/anyfesolver/_ge_beam3_g3c_stable/joint.py @@ -12,17 +12,17 @@ from math import fsum, isfinite import numpy as np -from anysolver._ge_beam3_mixed_ad import Jet2 -from anysolver._ge_beam3_mixed_ad import constant_matrix -from anysolver._ge_beam3_mixed_ad import matmul -from anysolver._ge_beam3_mixed_ad import matvec -from anysolver._ge_beam3_mixed_ad import transpose -from anysolver._ge_beam3_g3c_so3_numerics import so3_exp -from anysolver._ge_beam3_g3c_so3_numerics import so3_log -from anysolver._ge_beam3_p5.algebra import skew -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._native_reference_modal import _owned -from anysolver.control import cancellation_safe_point +from anyfesolver._ge_beam3_mixed_ad import Jet2 +from anyfesolver._ge_beam3_mixed_ad import constant_matrix +from anyfesolver._ge_beam3_mixed_ad import matmul +from anyfesolver._ge_beam3_mixed_ad import matvec +from anyfesolver._ge_beam3_mixed_ad import transpose +from anyfesolver._ge_beam3_g3c_so3_numerics import so3_exp +from anyfesolver._ge_beam3_g3c_so3_numerics import so3_log +from anyfesolver._ge_beam3_p5.algebra import skew +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._native_reference_modal import _owned +from anyfesolver.control import cancellation_safe_point POLICY = 'GE_BEAM3_OBJECTIVE_MASTER_FRAME_OFFSET_POSE_JOINT_V1' SCHEMA = 'GE_BEAM3_OFFSET_POSE_JOINT_DEFINITION_V1' diff --git a/src/anysolver/_ge_beam3_g3c_stable/line_work.py b/src/anyfesolver/_ge_beam3_g3c_stable/line_work.py similarity index 85% rename from src/anysolver/_ge_beam3_g3c_stable/line_work.py rename to src/anyfesolver/_ge_beam3_g3c_stable/line_work.py index d08140444..a7cdedc60 100644 --- a/src/anysolver/_ge_beam3_g3c_stable/line_work.py +++ b/src/anyfesolver/_ge_beam3_g3c_stable/line_work.py @@ -9,17 +9,17 @@ from math import isfinite import numpy as np -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference -from anysolver._ge_beam3_p5.arrays import _array -from anysolver._ge_beam3_p5.arrays import _frames -from anysolver._ge_beam3_p5.compensated_coordinates import split_sum -from anysolver._ge_beam3_p5.compensated_coordinates import validate_pair -from anysolver._ge_beam3_g3c_stable.compensated import sum_jets -from anysolver._ge_beam3_mixed_ad import Jet2 -from anysolver._ge_beam3_g3c_so3_numerics import so3_exp -from anysolver._ge_beam3_mixed_ad import matmul -from anysolver._ge_beam3_mixed_ad import constant_matrix -from anysolver._native_reference_modal import _owned +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference +from anyfesolver._ge_beam3_p5.arrays import _array +from anyfesolver._ge_beam3_p5.arrays import _frames +from anyfesolver._ge_beam3_p5.compensated_coordinates import split_sum +from anyfesolver._ge_beam3_p5.compensated_coordinates import validate_pair +from anyfesolver._ge_beam3_g3c_stable.compensated import sum_jets +from anyfesolver._ge_beam3_mixed_ad import Jet2 +from anyfesolver._ge_beam3_g3c_so3_numerics import so3_exp +from anyfesolver._ge_beam3_mixed_ad import matmul +from anyfesolver._ge_beam3_mixed_ad import constant_matrix +from anyfesolver._native_reference_modal import _owned POLICY = 'GE_BEAM3_RETAINED_FIBRE_SPATIAL_DEAD_REFERENCE_LINE_FORCE_V1' diff --git a/src/anysolver/_ge_beam3_g3c_stable/operator.py b/src/anyfesolver/_ge_beam3_g3c_stable/operator.py similarity index 84% rename from src/anysolver/_ge_beam3_g3c_stable/operator.py rename to src/anyfesolver/_ge_beam3_g3c_stable/operator.py index bb9b433c3..5fa55741d 100644 --- a/src/anysolver/_ge_beam3_g3c_stable/operator.py +++ b/src/anyfesolver/_ge_beam3_g3c_stable/operator.py @@ -1,26 +1,26 @@ """Additive elastic 42-variable centered beam, analytic variations only.""" from time import monotonic import numpy as np -from anysolver._ge_beam3_g1_elastic import ElasticSection -from anysolver._ge_beam3_g1_elastic import ElasticCell -from anysolver._ge_beam3_g1_elastic import owned -from anysolver._ge_beam3_g1_elastic import sha -from anysolver._ge_beam3_g1_elastic import solve -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference -from anysolver._ge_beam3_reference_identity import CapturedReferenceIdentity -from anysolver._ge_beam3_mixed_ad import Jet2 -from anysolver._ge_beam3_mixed_ad import constant_matrix -from anysolver._ge_beam3_mixed_ad import matmul -from anysolver._ge_beam3_mixed_ad import transpose -from anysolver._ge_beam3_g3c_so3_numerics import so3_exp -from anysolver._ge_beam3_g3c_so3_numerics import so3_log -from anysolver._ge_beam3_g3c_stable.compensated import compensated_strain -from anysolver._ge_beam3_p5.algebra import HALVES -from anysolver._ge_beam3_p5.algebra import rotation -from anysolver._ge_beam3_p5.arrays import _frames -from anysolver._ge_beam3_p5.compensated_coordinates import validate_pair -from anysolver._ge_beam3_g3c_stable.line_work import evaluate as line_work -from anysolver._ge_beam3_g3c_stable.boundary import spatial_jacobian +from anyfesolver._ge_beam3_g1_elastic import ElasticSection +from anyfesolver._ge_beam3_g1_elastic import ElasticCell +from anyfesolver._ge_beam3_g1_elastic import owned +from anyfesolver._ge_beam3_g1_elastic import sha +from anyfesolver._ge_beam3_g1_elastic import solve +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference +from anyfesolver._ge_beam3_reference_identity import CapturedReferenceIdentity +from anyfesolver._ge_beam3_mixed_ad import Jet2 +from anyfesolver._ge_beam3_mixed_ad import constant_matrix +from anyfesolver._ge_beam3_mixed_ad import matmul +from anyfesolver._ge_beam3_mixed_ad import transpose +from anyfesolver._ge_beam3_g3c_so3_numerics import so3_exp +from anyfesolver._ge_beam3_g3c_so3_numerics import so3_log +from anyfesolver._ge_beam3_g3c_stable.compensated import compensated_strain +from anyfesolver._ge_beam3_p5.algebra import HALVES +from anyfesolver._ge_beam3_p5.algebra import rotation +from anyfesolver._ge_beam3_p5.arrays import _frames +from anyfesolver._ge_beam3_p5.compensated_coordinates import validate_pair +from anyfesolver._ge_beam3_g3c_stable.line_work import evaluate as line_work +from anyfesolver._ge_beam3_g3c_stable.boundary import spatial_jacobian POLICY = "CANDIDATE_GE_BEAM3_G3C_STABLE_ELASTIC_RETAINED_V1" diff --git a/src/anysolver/_ge_beam3_g3c_stable/owner.py b/src/anyfesolver/_ge_beam3_g3c_stable/owner.py similarity index 93% rename from src/anysolver/_ge_beam3_g3c_stable/owner.py rename to src/anyfesolver/_ge_beam3_g3c_stable/owner.py index 1c6154b35..5cf96c239 100644 --- a/src/anysolver/_ge_beam3_g3c_stable/owner.py +++ b/src/anyfesolver/_ge_beam3_g3c_stable/owner.py @@ -11,34 +11,34 @@ import threading from time import monotonic import numpy as np -import anysolver._ge_beam3_g3c_stable.element as native_module -import anysolver._ge_beam3_g3c_stable.operator as operator_module -import anysolver._ge_beam3_g3c_stable.beam as beam_module -import anysolver._ge_beam3_g3c_stable.shell as shell_module -import anysolver._ge_beam3_g3c_stable.joint as joint_module -import anysolver.nonlinear_state as state_module -import anysolver.elements as legacy_module -import anysolver._native_rotation_state as rotation_module -import anysolver._ge_beam3_g3c_stable.authority as definition_module -from anysolver._ge_beam3_g3c_stable.authority import expand -from anysolver._ge_beam3_g3c_stable.authority import command -from anysolver._ge_beam3_g3c_stable.authority import CONTRACT_SHA -from anysolver._ge_beam3_g3c_stable.authority import U -from anysolver._ge_beam3_g3c_stable.authority import SHIFT -from anysolver._ge_beam3_g1_analysis import runtime_digest -from anysolver._ge_beam3_g1_elastic import ElasticSection -from anysolver._ge_beam3_g1_elastic import canonical -from anysolver._ge_beam3_g1_elastic import owned -from anysolver._ge_beam3_g1_elastic import sha -from anysolver._ge_beam3_g1_elastic import solve -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference -from anysolver._ge_beam3_mixed_ad import Jet2 -from anysolver._ge_beam3_mixed_ad import constant_matrix -from anysolver._ge_beam3_mixed_ad import matmul -from anysolver._ge_beam3_g3c_so3_numerics import so3_exp -from anysolver._ge_beam3_g3c_so3_numerics import so3_log -from anysolver._ge_beam3_mixed_ad import rotation_log -from anysolver.fe_core import FEModel +import anyfesolver._ge_beam3_g3c_stable.element as native_module +import anyfesolver._ge_beam3_g3c_stable.operator as operator_module +import anyfesolver._ge_beam3_g3c_stable.beam as beam_module +import anyfesolver._ge_beam3_g3c_stable.shell as shell_module +import anyfesolver._ge_beam3_g3c_stable.joint as joint_module +import anyfesolver.nonlinear_state as state_module +import anyfesolver.elements as legacy_module +import anyfesolver._native_rotation_state as rotation_module +import anyfesolver._ge_beam3_g3c_stable.authority as definition_module +from anyfesolver._ge_beam3_g3c_stable.authority import expand +from anyfesolver._ge_beam3_g3c_stable.authority import command +from anyfesolver._ge_beam3_g3c_stable.authority import CONTRACT_SHA +from anyfesolver._ge_beam3_g3c_stable.authority import U +from anyfesolver._ge_beam3_g3c_stable.authority import SHIFT +from anyfesolver._ge_beam3_g1_analysis import runtime_digest +from anyfesolver._ge_beam3_g1_elastic import ElasticSection +from anyfesolver._ge_beam3_g1_elastic import canonical +from anyfesolver._ge_beam3_g1_elastic import owned +from anyfesolver._ge_beam3_g1_elastic import sha +from anyfesolver._ge_beam3_g1_elastic import solve +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference +from anyfesolver._ge_beam3_mixed_ad import Jet2 +from anyfesolver._ge_beam3_mixed_ad import constant_matrix +from anyfesolver._ge_beam3_mixed_ad import matmul +from anyfesolver._ge_beam3_g3c_so3_numerics import so3_exp +from anyfesolver._ge_beam3_g3c_so3_numerics import so3_log +from anyfesolver._ge_beam3_mixed_ad import rotation_log +from anyfesolver.fe_core import FEModel POLICY='GE_BEAM3_G3C_STABLE_MIXED_ELASTIC_OWNER_V1' SCHEMA='GE_BEAM3_G3C_MIXED_ELASTIC_STATE_V1' @@ -197,7 +197,7 @@ def _native_model(self,state): e=native_module.ElasticElement(row['id'],tuple(row['nodes']),Reference(x,np.tile(frame,(3,1,1))), ElasticSection.isotropic(**data['definitions']['native']),order=4) model.add_element(e.element_id,e); model.materials[e.material_name]=e.section; elements.append(e) - from anysolver.matrix_assembly import _get_cached_sparsity_pattern + from anyfesolver.matrix_assembly import _get_cached_sparsity_pattern _get_cached_sparsity_pattern(model.mesh,'tangent_stiffness') if model.mesh.dof_manager.total_dofs!=6*len(ids): raise ValueError('global DOF allocation changed') states=({e.element_id:e.init_model_bound_nonlinear_state(model.mesh,e.section,1) for e in elements} diff --git a/src/anysolver/_ge_beam3_g3c_stable/shell.py b/src/anyfesolver/_ge_beam3_g3c_stable/shell.py similarity index 96% rename from src/anysolver/_ge_beam3_g3c_stable/shell.py rename to src/anyfesolver/_ge_beam3_g3c_stable/shell.py index 6cce39ea9..34bc36480 100644 --- a/src/anysolver/_ge_beam3_g3c_stable/shell.py +++ b/src/anyfesolver/_ge_beam3_g3c_stable/shell.py @@ -10,15 +10,15 @@ from threading import Lock import numpy as np -from anysolver._ge_beam3_mixed_ad import Jet2 -from anysolver._ge_beam3_mixed_ad import constant_matrix -from anysolver._ge_beam3_mixed_ad import matmul -from anysolver._ge_beam3_mixed_ad import matvec -from anysolver._ge_beam3_mixed_ad import transpose -from anysolver._ge_beam3_g3c_so3_numerics import so3_exp -from anysolver._ge_beam3_g3c_so3_numerics import so3_log -from anysolver._ge_beam3_g3c_stable.joint import _exp_terms -from anysolver._ge_beam3_g3c_stable.fit import rotation_jets +from anyfesolver._ge_beam3_mixed_ad import Jet2 +from anyfesolver._ge_beam3_mixed_ad import constant_matrix +from anyfesolver._ge_beam3_mixed_ad import matmul +from anyfesolver._ge_beam3_mixed_ad import matvec +from anyfesolver._ge_beam3_mixed_ad import transpose +from anyfesolver._ge_beam3_g3c_so3_numerics import so3_exp +from anyfesolver._ge_beam3_g3c_so3_numerics import so3_log +from anyfesolver._ge_beam3_g3c_stable.joint import _exp_terms +from anyfesolver._ge_beam3_g3c_stable.fit import rotation_jets POLICY = 'GE_BEAM3_G3C_MATRIX_POSE_SHELL_PULLBACK_V1' @@ -158,7 +158,7 @@ def membrane_stations(strain, resultant, differential, weights, frame, positions recovery_scope='SEPARATE_SOURCE_WORK_CHANNEL_NOT_COMPOSITE_PHYSICAL_RECOVERY') def q4_channels(element, mesh, material, kin, components): - import anysolver.e4_pl_element as source + import anyfesolver.e4_pl_element as source d, pose = kin.deformation, kin.frame mixed = element._recover_planar_mixed_fields(mesh, d, material, source._GAUSS) frame = mixed['frame']; c = source._coefficients(mixed['local_nodes']) @@ -264,9 +264,9 @@ class LocalShellTrial: state_committed: bool = field(default=False, init=False) def family_objects(description): - from anysolver.fe_core import FEModel - from anysolver.e4_pl_element import QualifiedE4PLShellElement - from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement + from anyfesolver.fe_core import FEModel + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement model = FEModel('owned G3c matrix shell virgin trial') model.add_material('scalar', 100., .25) for node, point in zip(description['node_ids'], description['coordinates']): model.add_node(node, *point) diff --git a/src/anysolver/_ge_beam3_g4_completion.py b/src/anyfesolver/_ge_beam3_g4_completion.py similarity index 100% rename from src/anysolver/_ge_beam3_g4_completion.py rename to src/anyfesolver/_ge_beam3_g4_completion.py diff --git a/src/anysolver/_ge_beam3_g4a_station_transaction.py b/src/anyfesolver/_ge_beam3_g4a_station_transaction.py similarity index 100% rename from src/anysolver/_ge_beam3_g4a_station_transaction.py rename to src/anyfesolver/_ge_beam3_g4a_station_transaction.py diff --git a/src/anysolver/_ge_beam3_g5_completion.py b/src/anyfesolver/_ge_beam3_g5_completion.py similarity index 100% rename from src/anysolver/_ge_beam3_g5_completion.py rename to src/anyfesolver/_ge_beam3_g5_completion.py diff --git a/src/anysolver/_ge_beam3_g6_domain.py b/src/anyfesolver/_ge_beam3_g6_domain.py similarity index 100% rename from src/anysolver/_ge_beam3_g6_domain.py rename to src/anyfesolver/_ge_beam3_g6_domain.py diff --git a/src/anysolver/_ge_beam3_generalized_cell.py b/src/anyfesolver/_ge_beam3_generalized_cell.py similarity index 100% rename from src/anysolver/_ge_beam3_generalized_cell.py rename to src/anyfesolver/_ge_beam3_generalized_cell.py diff --git a/src/anysolver/_ge_beam3_generalized_ellipsoid_section.py b/src/anyfesolver/_ge_beam3_generalized_ellipsoid_section.py similarity index 100% rename from src/anysolver/_ge_beam3_generalized_ellipsoid_section.py rename to src/anyfesolver/_ge_beam3_generalized_ellipsoid_section.py diff --git a/src/anysolver/_ge_beam3_generalized_static_boundary.py b/src/anyfesolver/_ge_beam3_generalized_static_boundary.py similarity index 100% rename from src/anysolver/_ge_beam3_generalized_static_boundary.py rename to src/anyfesolver/_ge_beam3_generalized_static_boundary.py diff --git a/src/anysolver/_ge_beam3_lifted_kinetic_factor.py b/src/anyfesolver/_ge_beam3_lifted_kinetic_factor.py similarity index 100% rename from src/anysolver/_ge_beam3_lifted_kinetic_factor.py rename to src/anyfesolver/_ge_beam3_lifted_kinetic_factor.py diff --git a/src/anysolver/_ge_beam3_line_fibre_modes.py b/src/anyfesolver/_ge_beam3_line_fibre_modes.py similarity index 100% rename from src/anysolver/_ge_beam3_line_fibre_modes.py rename to src/anyfesolver/_ge_beam3_line_fibre_modes.py diff --git a/src/anysolver/_ge_beam3_load_program.py b/src/anyfesolver/_ge_beam3_load_program.py similarity index 95% rename from src/anysolver/_ge_beam3_load_program.py rename to src/anyfesolver/_ge_beam3_load_program.py index 327945a7b..2537532c2 100644 --- a/src/anysolver/_ge_beam3_load_program.py +++ b/src/anyfesolver/_ge_beam3_load_program.py @@ -13,16 +13,16 @@ import numpy as np from scipy import sparse -from anysolver.assembly import build_constraint_transformation -from anysolver.control import cancellation_safe_point, SolveCancelled -from anysolver.linalg import MatrixClass, factorize -from anysolver.nonlinear_static import _assemble_nonlinear_system -from anysolver.nonlinear_state import create_model_native_rotation_store, native_trial_full_coordinates -from anysolver._ge_beam3_p5.arrays import _readonly -from anysolver._ge_beam3_p5_loads import NativeP5BeamElement, LoadStateStore -from anysolver._ge_beam3_p5_loads.core import canonical, sha -from anysolver._ge_beam3_p5_loads.codec import _load -from anysolver._ge_beam3_p5_loads.state import parameter_value, LOAD_POLICY +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.control import cancellation_safe_point, SolveCancelled +from anyfesolver.linalg import MatrixClass, factorize +from anyfesolver.nonlinear_static import _assemble_nonlinear_system +from anyfesolver.nonlinear_state import create_model_native_rotation_store, native_trial_full_coordinates +from anyfesolver._ge_beam3_p5.arrays import _readonly +from anyfesolver._ge_beam3_p5_loads import NativeP5BeamElement, LoadStateStore +from anyfesolver._ge_beam3_p5_loads.core import canonical, sha +from anyfesolver._ge_beam3_p5_loads.codec import _load +from anyfesolver._ge_beam3_p5_loads.state import parameter_value, LOAD_POLICY SCHEMA = 'GE_BEAM3_NATIVE_FORCE_PROGRAM_CHECKPOINT_V1' @@ -154,7 +154,7 @@ def _restore(raw, model, program, identity, elements, n, free, nodal): if type(cursor) is not int or not 0 <= cursor <= len(program.targets): raise ValueError('bounded checkpoint cursor required') parameter = parameter_value(value['accepted_parameter']) if parameter != (0. if cursor == 0 else program.targets[cursor-1]): raise ValueError('checkpoint schedule/parameter mismatch') - from anysolver._ge_beam3_p5.typed_schema import _decode + from anyfesolver._ge_beam3_p5.typed_schema import _decode total = _decode(value['total_displacement'],('array',(n,))) reaction = _decode(value['physical_imbalance'],('array',(n,))) if np.any(total[list(set(range(n))-set(free))]): raise ValueError('checkpoint violates prescribed supports') diff --git a/src/anysolver/_ge_beam3_loaded_modal.py b/src/anyfesolver/_ge_beam3_loaded_modal.py similarity index 93% rename from src/anysolver/_ge_beam3_loaded_modal.py rename to src/anyfesolver/_ge_beam3_loaded_modal.py index ffa9b397f..42c06bdc2 100644 --- a/src/anysolver/_ge_beam3_loaded_modal.py +++ b/src/anyfesolver/_ge_beam3_loaded_modal.py @@ -10,17 +10,17 @@ import numpy as np from scipy import sparse -from anysolver.assembly import build_constraint_transformation -from anysolver.control import cancellation_safe_point -from anysolver.nonlinear_state import create_model_native_rotation_store -from anysolver._native_reference_modal import _owned -from anysolver._native_stationary_spectrum import solve_stationary_spectrum -from anysolver._ge_beam3_centered_mixed import CenteredStationaryBeam -from anysolver._ge_beam3_p5.algebra import validate_section -from anysolver._ge_beam3_p5_centered.positions import validate_total_pair, rest_mass -from anysolver._ge_beam3_p5_loads import NativeP5BeamElement -from anysolver._ge_beam3_p5_loads.core import sha -from anysolver._ge_beam3_p5_loads.state import parameter_value, LOAD_POLICY +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.control import cancellation_safe_point +from anyfesolver.nonlinear_state import create_model_native_rotation_store +from anyfesolver._native_reference_modal import _owned +from anyfesolver._native_stationary_spectrum import solve_stationary_spectrum +from anyfesolver._ge_beam3_centered_mixed import CenteredStationaryBeam +from anyfesolver._ge_beam3_p5.algebra import validate_section +from anyfesolver._ge_beam3_p5_centered.positions import validate_total_pair, rest_mass +from anyfesolver._ge_beam3_p5_loads import NativeP5BeamElement +from anyfesolver._ge_beam3_p5_loads.core import sha +from anyfesolver._ge_beam3_p5_loads.state import parameter_value, LOAD_POLICY POLICY = 'GE_BEAM3_V4_LOADED_HESSIAN_CURRENT_REST_MASS_V1' diff --git a/src/anysolver/_ge_beam3_mixed_ad.py b/src/anyfesolver/_ge_beam3_mixed_ad.py similarity index 100% rename from src/anysolver/_ge_beam3_mixed_ad.py rename to src/anyfesolver/_ge_beam3_mixed_ad.py diff --git a/src/anysolver/_ge_beam3_native_analysis.py b/src/anyfesolver/_ge_beam3_native_analysis.py similarity index 100% rename from src/anysolver/_ge_beam3_native_analysis.py rename to src/anyfesolver/_ge_beam3_native_analysis.py diff --git a/src/anysolver/_ge_beam3_native_arc.py b/src/anyfesolver/_ge_beam3_native_arc.py similarity index 100% rename from src/anysolver/_ge_beam3_native_arc.py rename to src/anyfesolver/_ge_beam3_native_arc.py diff --git a/src/anysolver/_ge_beam3_native_arc_adaptive.py b/src/anyfesolver/_ge_beam3_native_arc_adaptive.py similarity index 100% rename from src/anysolver/_ge_beam3_native_arc_adaptive.py rename to src/anyfesolver/_ge_beam3_native_arc_adaptive.py diff --git a/src/anysolver/_ge_beam3_native_arc_restart.py b/src/anyfesolver/_ge_beam3_native_arc_restart.py similarity index 100% rename from src/anysolver/_ge_beam3_native_arc_restart.py rename to src/anyfesolver/_ge_beam3_native_arc_restart.py diff --git a/src/anysolver/_ge_beam3_native_arc_source.py b/src/anyfesolver/_ge_beam3_native_arc_source.py similarity index 100% rename from src/anysolver/_ge_beam3_native_arc_source.py rename to src/anyfesolver/_ge_beam3_native_arc_source.py diff --git a/src/anysolver/_ge_beam3_native_buckling.py b/src/anyfesolver/_ge_beam3_native_buckling.py similarity index 100% rename from src/anysolver/_ge_beam3_native_buckling.py rename to src/anyfesolver/_ge_beam3_native_buckling.py diff --git a/src/anysolver/_ge_beam3_native_combined_couples.py b/src/anyfesolver/_ge_beam3_native_combined_couples.py similarity index 100% rename from src/anysolver/_ge_beam3_native_combined_couples.py rename to src/anyfesolver/_ge_beam3_native_combined_couples.py diff --git a/src/anysolver/_ge_beam3_native_combined_restart.py b/src/anyfesolver/_ge_beam3_native_combined_restart.py similarity index 100% rename from src/anysolver/_ge_beam3_native_combined_restart.py rename to src/anyfesolver/_ge_beam3_native_combined_restart.py diff --git a/src/anysolver/_ge_beam3_native_definition.py b/src/anyfesolver/_ge_beam3_native_definition.py similarity index 100% rename from src/anysolver/_ge_beam3_native_definition.py rename to src/anyfesolver/_ge_beam3_native_definition.py diff --git a/src/anysolver/_ge_beam3_native_distributed_element.py b/src/anyfesolver/_ge_beam3_native_distributed_element.py similarity index 100% rename from src/anysolver/_ge_beam3_native_distributed_element.py rename to src/anyfesolver/_ge_beam3_native_distributed_element.py diff --git a/src/anysolver/_ge_beam3_native_distributed_loading.py b/src/anyfesolver/_ge_beam3_native_distributed_loading.py similarity index 100% rename from src/anysolver/_ge_beam3_native_distributed_loading.py rename to src/anyfesolver/_ge_beam3_native_distributed_loading.py diff --git a/src/anysolver/_ge_beam3_native_distributed_program.py b/src/anyfesolver/_ge_beam3_native_distributed_program.py similarity index 100% rename from src/anysolver/_ge_beam3_native_distributed_program.py rename to src/anyfesolver/_ge_beam3_native_distributed_program.py diff --git a/src/anysolver/_ge_beam3_native_distributed_recovery.py b/src/anyfesolver/_ge_beam3_native_distributed_recovery.py similarity index 100% rename from src/anysolver/_ge_beam3_native_distributed_recovery.py rename to src/anyfesolver/_ge_beam3_native_distributed_recovery.py diff --git a/src/anysolver/_ge_beam3_native_distributed_restart.py b/src/anyfesolver/_ge_beam3_native_distributed_restart.py similarity index 100% rename from src/anysolver/_ge_beam3_native_distributed_restart.py rename to src/anyfesolver/_ge_beam3_native_distributed_restart.py diff --git a/src/anysolver/_ge_beam3_native_dynamic_analysis.py b/src/anyfesolver/_ge_beam3_native_dynamic_analysis.py similarity index 100% rename from src/anysolver/_ge_beam3_native_dynamic_analysis.py rename to src/anyfesolver/_ge_beam3_native_dynamic_analysis.py diff --git a/src/anysolver/_ge_beam3_native_dynamic_restart.py b/src/anyfesolver/_ge_beam3_native_dynamic_restart.py similarity index 98% rename from src/anysolver/_ge_beam3_native_dynamic_restart.py rename to src/anyfesolver/_ge_beam3_native_dynamic_restart.py index ea4699913..4f492d25f 100644 --- a/src/anysolver/_ge_beam3_native_dynamic_restart.py +++ b/src/anyfesolver/_ge_beam3_native_dynamic_restart.py @@ -45,7 +45,7 @@ def _source_is_link(path): def _package_manifest(): - """Exact anysolver .py bytes; stable relative paths, no installation path. + """Exact anyfesolver .py bytes; stable relative paths, no installation path. SHA256 covers canonical sorted [relative-path, byte-length, file-SHA256] records. Only Python source artifacts are claimed, not external dependencies @@ -95,7 +95,7 @@ def walk_error(error): raise ValueError('native dynamic package source manifest empty') rows.sort(key=lambda row: row[0]) return dict(format='CANONICAL_SORTED_RELATIVE_PATH_LENGTH_SHA256_V1', - source_glob='anysolver/**/*.py', files=len(rows), total_bytes=total, + source_glob='anyfesolver/**/*.py', files=len(rows), total_bytes=total, manifest_sha256=sha(rows), limits=dict(files=MAX_PACKAGE_FILES, file_bytes=MAX_PACKAGE_FILE_BYTES, total_bytes=MAX_PACKAGE_TOTAL_BYTES, directories=MAX_PACKAGE_DIRECTORIES, entries=MAX_PACKAGE_ENTRIES)) @@ -107,7 +107,7 @@ def walk_error(error): def contract(context): - """Existing profile/graph contracts plus all bounded anysolver .py sources. + """Existing profile/graph contracts plus all bounded anyfesolver .py sources. No new generic package importer, signing framework or version migration. Source files are required for this explicitly development-only codec. diff --git a/src/anysolver/_ge_beam3_native_fibre_current_modal.py b/src/anyfesolver/_ge_beam3_native_fibre_current_modal.py similarity index 100% rename from src/anysolver/_ge_beam3_native_fibre_current_modal.py rename to src/anyfesolver/_ge_beam3_native_fibre_current_modal.py diff --git a/src/anysolver/_ge_beam3_native_fibre_recovery.py b/src/anyfesolver/_ge_beam3_native_fibre_recovery.py similarity index 100% rename from src/anysolver/_ge_beam3_native_fibre_recovery.py rename to src/anyfesolver/_ge_beam3_native_fibre_recovery.py diff --git a/src/anysolver/_ge_beam3_native_fibre_restart.py b/src/anyfesolver/_ge_beam3_native_fibre_restart.py similarity index 100% rename from src/anysolver/_ge_beam3_native_fibre_restart.py rename to src/anyfesolver/_ge_beam3_native_fibre_restart.py diff --git a/src/anysolver/_ge_beam3_native_fibre_static_element.py b/src/anyfesolver/_ge_beam3_native_fibre_static_element.py similarity index 98% rename from src/anysolver/_ge_beam3_native_fibre_static_element.py rename to src/anyfesolver/_ge_beam3_native_fibre_static_element.py index 28c7536db..3cc460492 100644 --- a/src/anysolver/_ge_beam3_native_fibre_static_element.py +++ b/src/anyfesolver/_ge_beam3_native_fibre_static_element.py @@ -1,193 +1,193 @@ -"""Private physical-fibre static adapter using actual native state tokens. - -No public selector or dynamic route is registered. Existing beam mechanics -are not inherited. The 24 internal static coordinates remain explicit state. -""" -from copy import deepcopy -from decimal import localcontext -from fractions import Fraction -import numpy as np -from scipy import linalg -from .elements import Element -from ._native_material_protocol import PROTOCOL,NativeMaterialContext,NativeMaterialValidator -from ._ge_beam3_retained_fibre import RetainedFibreOperator -from ._ge_beam3_fibre_static_boundary import solve_static,StaticTrial,POLICY as STATIC_POLICY -from ._ge_beam3_p5.chart import pullback -from ._ge_beam3_p5.arrays import _array,_frames -from ._ge_beam3_p5_seeded.core import canonical,sha -from ._native_reference_modal import _owned - -FORMULATION='CANDIDATE_GE_BEAM3_NATIVE_PHYSICAL_FIBRE_STATIC_V1' -SCHEMA='GE_BEAM3_NATIVE_PHYSICAL_FIBRE_STATIC_STATE_V1' - - -def seal(value): - body={k:v for k,v in value.items() if k!='state_sha256'} - return {**body,'state_sha256':sha(body)} - - -class NativeFibreStaticElement(Element): - num_nodes=3 - dofs_per_node=6 - formulation_id=FORMULATION - formulation_native_total_lagrangian=True - native_material_state_protocol=PROTOCOL - production_qualified=False - +"""Private physical-fibre static adapter using actual native state tokens. + +No public selector or dynamic route is registered. Existing beam mechanics +are not inherited. The 24 internal static coordinates remain explicit state. +""" +from copy import deepcopy +from decimal import localcontext +from fractions import Fraction +import numpy as np +from scipy import linalg +from .elements import Element +from ._native_material_protocol import PROTOCOL,NativeMaterialContext,NativeMaterialValidator +from ._ge_beam3_retained_fibre import RetainedFibreOperator +from ._ge_beam3_fibre_static_boundary import solve_static,StaticTrial,POLICY as STATIC_POLICY +from ._ge_beam3_p5.chart import pullback +from ._ge_beam3_p5.arrays import _array,_frames +from ._ge_beam3_p5_seeded.core import canonical,sha +from ._native_reference_modal import _owned + +FORMULATION='CANDIDATE_GE_BEAM3_NATIVE_PHYSICAL_FIBRE_STATIC_V1' +SCHEMA='GE_BEAM3_NATIVE_PHYSICAL_FIBRE_STATIC_STATE_V1' + + +def seal(value): + body={k:v for k,v in value.items() if k!='state_sha256'} + return {**body,'state_sha256':sha(body)} + + +class NativeFibreStaticElement(Element): + num_nodes=3 + dofs_per_node=6 + formulation_id=FORMULATION + formulation_native_total_lagrangian=True + native_material_state_protocol=PROTOCOL + production_qualified=False + def __init__(self,element_id,node_ids,reference,section,*,order=4,arithmetic_policy=None): - if type(element_id) is not int or element_id<=0 or type(node_ids) is not tuple or len(node_ids)!=3 or len(set(node_ids))!=3 or any(type(i) is not int or i<=0 for i in node_ids): - raise ValueError('explicit native fibre element/node identities') - super().__init__(element_id,node_ids,'private-native-fibre-'+str(element_id)) + if type(element_id) is not int or element_id<=0 or type(node_ids) is not tuple or len(node_ids)!=3 or len(set(node_ids))!=3 or any(type(i) is not int or i<=0 for i in node_ids): + raise ValueError('explicit native fibre element/node identities') + super().__init__(element_id,node_ids,'private-native-fibre-'+str(element_id)) self.operator=RetainedFibreOperator(reference,section,order=order,arithmetic_policy=arithmetic_policy); self.section=section - self.identity=sha(dict(formulation=FORMULATION,element_id=element_id,nodes=node_ids,operator=self.operator.identity)) - self._mapping=None; self._mesh=None; self._validator=None - - def _check(self,mesh): - if type(self) is not NativeFibreStaticElement or mesh.elements.get(self.element_id) is not self: - raise ValueError('exact native fibre element ownership') - if self._mesh is None: self._mesh=mesh - elif self._mesh is not mesh: raise ValueError('native fibre element belongs to another mesh') - if any(type(e) is not NativeFibreStaticElement for e in mesh.elements.values()): raise ValueError('private standalone native fibre adapter only') - self.operator.guard() - if self.section is not self.operator.section or self.formulation_id!=FORMULATION or self.production_qualified is not False or self.num_nodes!=3 or self.dofs_per_node!=6: - raise ValueError('native fibre formulation/section changed') - if sha(dict(formulation=FORMULATION,element_id=self.element_id,nodes=self.node_ids,operator=self.operator.identity))!=self.identity: - raise ValueError('native fibre identity changed') - if not np.array_equal(self.get_node_coordinates(mesh),self.operator.reference.coordinates): raise ValueError('native reference coordinates changed') - mapping=tuple(self.get_dof_mapping(mesh)) - if len(mapping)!=18 or len(set(mapping))!=18: raise ValueError('eighteen native external DOFs required') - if self._mapping is None: self._mapping=mapping - elif mapping!=self._mapping: raise ValueError('native fibre DOF ownership changed') - - def get_node_coordinates(self,mesh): - return np.array([mesh.nodes[i].coords() for i in self.node_ids]) - - def native_reference_directors(self,mesh): - self._check(mesh); return self.operator.reference.nodal_triads[:,:,2].copy() - - def to_dict(self): - return dict(formulation_id=FORMULATION,state_schema=SCHEMA,element_id=self.element_id,node_ids=self.node_ids, - operator=self.operator.identity,reference=self.operator.reference.fingerprint(),section=self.section.identity, - quadrature=self.operator.order,reduction='STATIC_ONLY_24_INTERNAL_COORDINATES',production_qualified=False) - - def _coordinates(self,total): - total=_array(total,(18,),'native total displacement'); reference=self.operator.reference.coordinates - high=reference+total.reshape(3,6)[:,:3]; low=np.empty((3,3)) - for i in range(3): - for j in range(3): low[i,j]=float(Fraction(float(reference[i,j]))+Fraction(float(total[6*i+j]))-Fraction(float(high[i,j]))) - return _owned(high),_owned(low) - - def _state(self,epoch,total,operators,origin,seed_u,seed_p,response,previous): - positions,low=self._coordinates(total) - return seal(dict(schema=SCHEMA,element_identity=self.identity,epoch=epoch,previous_state_sha256=previous, - committed_total_u=_owned(total),committed_nodal_rotation_matrices=_owned(operators),positions=positions,position_low=low, - origins=origin,seed_rotations=_owned(seed_u),seed_resultants=_owned(seed_p),response=response)) - - def _validate(self,mesh,state,expected=None): - self._check(mesh) - keys={'schema','element_identity','epoch','previous_state_sha256','committed_total_u','committed_nodal_rotation_matrices', - 'positions','position_low','origins','seed_rotations','seed_resultants','response','state_sha256'} - if type(state) is not dict or set(state)!=keys or state['schema']!=SCHEMA or state['element_identity']!=self.identity or seal(state)['state_sha256']!=state['state_sha256']: - raise ValueError('native fibre state schema/identity/hash') - epoch=state['epoch'] - if type(epoch) is not int or epoch<0: raise ValueError('native fibre state epoch') - previous_hash=state['previous_state_sha256'] - if epoch and (type(previous_hash) is not str or len(previous_hash)!=64 or any(c not in '0123456789abcdef' for c in previous_hash)): - raise ValueError('native fibre predecessor hash') - total=_array(state['committed_total_u'],(18,),'native fibre state displacement') - if expected is not None and not np.array_equal(total,expected): raise ValueError('native fibre displacement mismatch') - positions,low=self._coordinates(total) - if not np.array_equal(positions,state['positions']) or not np.array_equal(low,state['position_low']): raise ValueError('native compensated position mismatch') - operators=_frames(state['committed_nodal_rotation_matrices'],3,'native fibre operators') - response=state['response'] - if type(response) is not StaticTrial: raise ValueError('exact native fibre static response') - with localcontext() as context: - context.prec=80; self.operator.cell._origins(state['origins']) - if epoch==0 and (state['previous_state_sha256'] is not None or np.any(total) or not np.array_equal(operators,np.tile(np.eye(3),(3,1,1))) or canonical(state['origins'])!=canonical(self.operator.cell.virgin())): - raise ValueError('native fibre virgin state mismatch') - seed_u=_frames(state['seed_rotations'],2,'native seed rotations'); seed_p=_array(state['seed_resultants'],(18,),'native seed resultants') - q=operators@self.operator.reference.nodal_triads - input_id=sha(dict(policy=STATIC_POLICY,operator=self.operator.identity,positions=positions,position_low=low, - nodal_frames=q,origin=state['origins'],line_force=np.zeros(3),initial_rotations=seed_u,initial_resultants=seed_p)) - if response.input_sha256!=input_id or type(response.iterations) is not int or not 0<=response.iterations<=24 or response.production_qualified or response.dynamic_reduction_authorized: - raise ValueError('native fibre response provenance') - replay=self.operator.evaluate(positions,low,q,response.rotations,response.resultants,origin=state['origins']) - h=replay.hessian+replay.hessian_low - condensed=h[:18,:18]-h[:18,18:]@linalg.solve(h[18:,18:],h[18:,:18],assume_a='gen',check_finite=True) - length=float(np.linalg.norm(self.operator.reference.coordinates[-1]-self.operator.reference.coordinates[0])) - error=float(np.linalg.norm(replay.residual[18:]/np.r_[np.full(12,length),np.ones(12)])) - expected_response=StaticTrial(response.rotations,response.resultants,replay.residual[:18],condensed, - replay.residual,h,replay.history,replay.potential,error,response.iterations,input_id) - if error>1e-11 or canonical(expected_response)!=canonical(response): raise ValueError('native fibre static/history replay mismatch') - return state - - def _pose(self,state,view,*,committed): - coordinates=view.committed_coordinates if committed else view.trial_coordinates - operators=view.committed_rotation_matrices if committed else view.trial_rotation_matrices - rotations=view.committed_rotation_coordinates if committed else view.trial_rotation_coordinates - if not np.array_equal(state['positions'],coordinates) or not np.array_equal(state['committed_nodal_rotation_matrices'],operators) or not np.array_equal(state['committed_total_u'].reshape(3,6)[:,3:],rotations): - raise ValueError('native fibre material/pose mismatch') - - def init_model_bound_nonlinear_state(self,mesh,material,num_layers): - self._arguments(mesh,material,num_layers) - total=np.zeros(18); operators=np.tile(np.eye(3),(3,1,1)); seed_u=np.tile(np.eye(3),(2,1,1)); seed_p=np.zeros(18) - positions,low=self._coordinates(total); origin=self.operator.cell.virgin() - response=solve_static(self.operator,positions,low,operators@self.operator.reference.nodal_triads,origin=origin, - initial_rotations=seed_u,initial_resultants=seed_p,spatial_line_force=np.zeros(3)) - return self._state(0,total,operators,origin,seed_u,seed_p,response,None) - - def _arguments(self,mesh,material,num_layers): - self._check(mesh) - if material is not self.section or type(num_layers) is not int or num_layers!=1: raise ValueError('native fibre section/layer authority') - - def validate_model_bound_nonlinear_state(self,mesh,material,state,num_layers,*,expected_committed_total_u=None): - self._arguments(mesh,material,num_layers); self._validate(mesh,state,expected_committed_total_u); return deepcopy(state) - - def create_native_material_validator(self,mesh): - self._check(mesh) - if self._validator is not None: return self._validator - def validate(state,*,previous_state,native_view,displacement,phase): - self._validate(mesh,state,displacement) - if phase=='committed': - if previous_state is not None: raise ValueError('native fibre committed validation phase') - self._pose(state,native_view,committed=True) - elif phase=='trial': - previous=self._validate(mesh,previous_state); self._pose(previous,native_view,committed=True); self._pose(state,native_view,committed=False) - if state['epoch']!=previous['epoch']+1 or state['previous_state_sha256']!=previous['state_sha256'] or canonical(state['origins'])!=canonical(previous['response'].history): raise ValueError('native fibre accepted-origin linkage') - if not np.array_equal(state['seed_rotations'],previous['response'].rotations) or not np.array_equal(state['seed_resultants'],previous['response'].resultants): raise ValueError('native fibre internal seed linkage') - else: raise ValueError('native fibre validation phase') - self._validator=NativeMaterialValidator(validate) - return self._validator - - def _live(self,context,view,state,*,check_state=True): - if type(context) is not NativeMaterialContext or context.element_id!=self.element_id: raise ValueError('live native fibre material context required') - context.require_view(view) - # This private adapter explicitly binds the actual store's validator, - # not only a numerically identical pose from a different model. - binding=context.store._native_element_bindings.get(self.element_id) - if self._validator is None or binding is None or binding.material_validator is not self._validator: - raise ValueError('foreign native fibre material-store binding') - if check_state and canonical(context.store[self.element_id])!=canonical(state): - raise ValueError('native fibre input is not the current store state') - - def compute_nonlinear_response(self,mesh,material,displacement,state=None,num_layers=1,tangent=True,*,native_rotation_trial=None,native_material_context=None): - self._arguments(mesh,material,num_layers); context=native_material_context; view=native_rotation_trial - self._live(context,view,state); previous=self._validate(mesh,state); self._pose(previous,view,committed=True) - total=_array(displacement,(18,),'native fibre trial displacement'); positions,low=self._coordinates(total) - if not np.array_equal(positions,view.trial_coordinates) or not np.array_equal(total.reshape(3,6)[:,3:],view.trial_rotation_coordinates): raise ValueError('native fibre trial pose mismatch') - seed=previous['response']; origin=seed.history - response=solve_static(self.operator,positions,low,view.trial_rotation_matrices@self.operator.reference.nodal_triads, - origin=origin,initial_rotations=seed.rotations,initial_resultants=seed.resultants,spatial_line_force=np.zeros(3),check=lambda: self._live(context,view,state,check_state=False)) - force,matrix,_=pullback(response.residual,response.hessian,view.rotation_coordinate_increment) - self._live(context,view,state) - candidate=self._state(previous['epoch']+1,total,view.trial_rotation_matrices,origin,seed.rotations,seed.resultants,response,previous['state_sha256']) - return force.copy(),matrix.copy() if tangent else None,candidate - - def compute_stiffness_matrix(self,mesh,material): - return self.init_model_bound_nonlinear_state(mesh,material,1)['response'].hessian.copy() - - def _unsupported(self,*args,**kwargs): raise ValueError('private native fibre static adapter: workflow not qualified') - compute_mass_matrix=_unsupported - compute_geometric_stiffness_matrix=_unsupported - compute_internal_forces=_unsupported - compute_stresses=_unsupported + self.identity=sha(dict(formulation=FORMULATION,element_id=element_id,nodes=node_ids,operator=self.operator.identity)) + self._mapping=None; self._mesh=None; self._validator=None + + def _check(self,mesh): + if type(self) is not NativeFibreStaticElement or mesh.elements.get(self.element_id) is not self: + raise ValueError('exact native fibre element ownership') + if self._mesh is None: self._mesh=mesh + elif self._mesh is not mesh: raise ValueError('native fibre element belongs to another mesh') + if any(type(e) is not NativeFibreStaticElement for e in mesh.elements.values()): raise ValueError('private standalone native fibre adapter only') + self.operator.guard() + if self.section is not self.operator.section or self.formulation_id!=FORMULATION or self.production_qualified is not False or self.num_nodes!=3 or self.dofs_per_node!=6: + raise ValueError('native fibre formulation/section changed') + if sha(dict(formulation=FORMULATION,element_id=self.element_id,nodes=self.node_ids,operator=self.operator.identity))!=self.identity: + raise ValueError('native fibre identity changed') + if not np.array_equal(self.get_node_coordinates(mesh),self.operator.reference.coordinates): raise ValueError('native reference coordinates changed') + mapping=tuple(self.get_dof_mapping(mesh)) + if len(mapping)!=18 or len(set(mapping))!=18: raise ValueError('eighteen native external DOFs required') + if self._mapping is None: self._mapping=mapping + elif mapping!=self._mapping: raise ValueError('native fibre DOF ownership changed') + + def get_node_coordinates(self,mesh): + return np.array([mesh.nodes[i].coords() for i in self.node_ids]) + + def native_reference_directors(self,mesh): + self._check(mesh); return self.operator.reference.nodal_triads[:,:,2].copy() + + def to_dict(self): + return dict(formulation_id=FORMULATION,state_schema=SCHEMA,element_id=self.element_id,node_ids=self.node_ids, + operator=self.operator.identity,reference=self.operator.reference.fingerprint(),section=self.section.identity, + quadrature=self.operator.order,reduction='STATIC_ONLY_24_INTERNAL_COORDINATES',production_qualified=False) + + def _coordinates(self,total): + total=_array(total,(18,),'native total displacement'); reference=self.operator.reference.coordinates + high=reference+total.reshape(3,6)[:,:3]; low=np.empty((3,3)) + for i in range(3): + for j in range(3): low[i,j]=float(Fraction(float(reference[i,j]))+Fraction(float(total[6*i+j]))-Fraction(float(high[i,j]))) + return _owned(high),_owned(low) + + def _state(self,epoch,total,operators,origin,seed_u,seed_p,response,previous): + positions,low=self._coordinates(total) + return seal(dict(schema=SCHEMA,element_identity=self.identity,epoch=epoch,previous_state_sha256=previous, + committed_total_u=_owned(total),committed_nodal_rotation_matrices=_owned(operators),positions=positions,position_low=low, + origins=origin,seed_rotations=_owned(seed_u),seed_resultants=_owned(seed_p),response=response)) + + def _validate(self,mesh,state,expected=None): + self._check(mesh) + keys={'schema','element_identity','epoch','previous_state_sha256','committed_total_u','committed_nodal_rotation_matrices', + 'positions','position_low','origins','seed_rotations','seed_resultants','response','state_sha256'} + if type(state) is not dict or set(state)!=keys or state['schema']!=SCHEMA or state['element_identity']!=self.identity or seal(state)['state_sha256']!=state['state_sha256']: + raise ValueError('native fibre state schema/identity/hash') + epoch=state['epoch'] + if type(epoch) is not int or epoch<0: raise ValueError('native fibre state epoch') + previous_hash=state['previous_state_sha256'] + if epoch and (type(previous_hash) is not str or len(previous_hash)!=64 or any(c not in '0123456789abcdef' for c in previous_hash)): + raise ValueError('native fibre predecessor hash') + total=_array(state['committed_total_u'],(18,),'native fibre state displacement') + if expected is not None and not np.array_equal(total,expected): raise ValueError('native fibre displacement mismatch') + positions,low=self._coordinates(total) + if not np.array_equal(positions,state['positions']) or not np.array_equal(low,state['position_low']): raise ValueError('native compensated position mismatch') + operators=_frames(state['committed_nodal_rotation_matrices'],3,'native fibre operators') + response=state['response'] + if type(response) is not StaticTrial: raise ValueError('exact native fibre static response') + with localcontext() as context: + context.prec=80; self.operator.cell._origins(state['origins']) + if epoch==0 and (state['previous_state_sha256'] is not None or np.any(total) or not np.array_equal(operators,np.tile(np.eye(3),(3,1,1))) or canonical(state['origins'])!=canonical(self.operator.cell.virgin())): + raise ValueError('native fibre virgin state mismatch') + seed_u=_frames(state['seed_rotations'],2,'native seed rotations'); seed_p=_array(state['seed_resultants'],(18,),'native seed resultants') + q=operators@self.operator.reference.nodal_triads + input_id=sha(dict(policy=STATIC_POLICY,operator=self.operator.identity,positions=positions,position_low=low, + nodal_frames=q,origin=state['origins'],line_force=np.zeros(3),initial_rotations=seed_u,initial_resultants=seed_p)) + if response.input_sha256!=input_id or type(response.iterations) is not int or not 0<=response.iterations<=24 or response.production_qualified or response.dynamic_reduction_authorized: + raise ValueError('native fibre response provenance') + replay=self.operator.evaluate(positions,low,q,response.rotations,response.resultants,origin=state['origins']) + h=replay.hessian+replay.hessian_low + condensed=h[:18,:18]-h[:18,18:]@linalg.solve(h[18:,18:],h[18:,:18],assume_a='gen',check_finite=True) + length=float(np.linalg.norm(self.operator.reference.coordinates[-1]-self.operator.reference.coordinates[0])) + error=float(np.linalg.norm(replay.residual[18:]/np.r_[np.full(12,length),np.ones(12)])) + expected_response=StaticTrial(response.rotations,response.resultants,replay.residual[:18],condensed, + replay.residual,h,replay.history,replay.potential,error,response.iterations,input_id) + if error>1e-11 or canonical(expected_response)!=canonical(response): raise ValueError('native fibre static/history replay mismatch') + return state + + def _pose(self,state,view,*,committed): + coordinates=view.committed_coordinates if committed else view.trial_coordinates + operators=view.committed_rotation_matrices if committed else view.trial_rotation_matrices + rotations=view.committed_rotation_coordinates if committed else view.trial_rotation_coordinates + if not np.array_equal(state['positions'],coordinates) or not np.array_equal(state['committed_nodal_rotation_matrices'],operators) or not np.array_equal(state['committed_total_u'].reshape(3,6)[:,3:],rotations): + raise ValueError('native fibre material/pose mismatch') + + def init_model_bound_nonlinear_state(self,mesh,material,num_layers): + self._arguments(mesh,material,num_layers) + total=np.zeros(18); operators=np.tile(np.eye(3),(3,1,1)); seed_u=np.tile(np.eye(3),(2,1,1)); seed_p=np.zeros(18) + positions,low=self._coordinates(total); origin=self.operator.cell.virgin() + response=solve_static(self.operator,positions,low,operators@self.operator.reference.nodal_triads,origin=origin, + initial_rotations=seed_u,initial_resultants=seed_p,spatial_line_force=np.zeros(3)) + return self._state(0,total,operators,origin,seed_u,seed_p,response,None) + + def _arguments(self,mesh,material,num_layers): + self._check(mesh) + if material is not self.section or type(num_layers) is not int or num_layers!=1: raise ValueError('native fibre section/layer authority') + + def validate_model_bound_nonlinear_state(self,mesh,material,state,num_layers,*,expected_committed_total_u=None): + self._arguments(mesh,material,num_layers); self._validate(mesh,state,expected_committed_total_u); return deepcopy(state) + + def create_native_material_validator(self,mesh): + self._check(mesh) + if self._validator is not None: return self._validator + def validate(state,*,previous_state,native_view,displacement,phase): + self._validate(mesh,state,displacement) + if phase=='committed': + if previous_state is not None: raise ValueError('native fibre committed validation phase') + self._pose(state,native_view,committed=True) + elif phase=='trial': + previous=self._validate(mesh,previous_state); self._pose(previous,native_view,committed=True); self._pose(state,native_view,committed=False) + if state['epoch']!=previous['epoch']+1 or state['previous_state_sha256']!=previous['state_sha256'] or canonical(state['origins'])!=canonical(previous['response'].history): raise ValueError('native fibre accepted-origin linkage') + if not np.array_equal(state['seed_rotations'],previous['response'].rotations) or not np.array_equal(state['seed_resultants'],previous['response'].resultants): raise ValueError('native fibre internal seed linkage') + else: raise ValueError('native fibre validation phase') + self._validator=NativeMaterialValidator(validate) + return self._validator + + def _live(self,context,view,state,*,check_state=True): + if type(context) is not NativeMaterialContext or context.element_id!=self.element_id: raise ValueError('live native fibre material context required') + context.require_view(view) + # This private adapter explicitly binds the actual store's validator, + # not only a numerically identical pose from a different model. + binding=context.store._native_element_bindings.get(self.element_id) + if self._validator is None or binding is None or binding.material_validator is not self._validator: + raise ValueError('foreign native fibre material-store binding') + if check_state and canonical(context.store[self.element_id])!=canonical(state): + raise ValueError('native fibre input is not the current store state') + + def compute_nonlinear_response(self,mesh,material,displacement,state=None,num_layers=1,tangent=True,*,native_rotation_trial=None,native_material_context=None): + self._arguments(mesh,material,num_layers); context=native_material_context; view=native_rotation_trial + self._live(context,view,state); previous=self._validate(mesh,state); self._pose(previous,view,committed=True) + total=_array(displacement,(18,),'native fibre trial displacement'); positions,low=self._coordinates(total) + if not np.array_equal(positions,view.trial_coordinates) or not np.array_equal(total.reshape(3,6)[:,3:],view.trial_rotation_coordinates): raise ValueError('native fibre trial pose mismatch') + seed=previous['response']; origin=seed.history + response=solve_static(self.operator,positions,low,view.trial_rotation_matrices@self.operator.reference.nodal_triads, + origin=origin,initial_rotations=seed.rotations,initial_resultants=seed.resultants,spatial_line_force=np.zeros(3),check=lambda: self._live(context,view,state,check_state=False)) + force,matrix,_=pullback(response.residual,response.hessian,view.rotation_coordinate_increment) + self._live(context,view,state) + candidate=self._state(previous['epoch']+1,total,view.trial_rotation_matrices,origin,seed.rotations,seed.resultants,response,previous['state_sha256']) + return force.copy(),matrix.copy() if tangent else None,candidate + + def compute_stiffness_matrix(self,mesh,material): + return self.init_model_bound_nonlinear_state(mesh,material,1)['response'].hessian.copy() + + def _unsupported(self,*args,**kwargs): raise ValueError('private native fibre static adapter: workflow not qualified') + compute_mass_matrix=_unsupported + compute_geometric_stiffness_matrix=_unsupported + compute_internal_forces=_unsupported + compute_stresses=_unsupported diff --git a/src/anysolver/_ge_beam3_native_force_adaptation.py b/src/anyfesolver/_ge_beam3_native_force_adaptation.py similarity index 100% rename from src/anysolver/_ge_beam3_native_force_adaptation.py rename to src/anyfesolver/_ge_beam3_native_force_adaptation.py diff --git a/src/anysolver/_ge_beam3_native_generalized_combined_couples.py b/src/anyfesolver/_ge_beam3_native_generalized_combined_couples.py similarity index 100% rename from src/anysolver/_ge_beam3_native_generalized_combined_couples.py rename to src/anyfesolver/_ge_beam3_native_generalized_combined_couples.py diff --git a/src/anysolver/_ge_beam3_native_generalized_combined_restart.py b/src/anyfesolver/_ge_beam3_native_generalized_combined_restart.py similarity index 100% rename from src/anysolver/_ge_beam3_native_generalized_combined_restart.py rename to src/anyfesolver/_ge_beam3_native_generalized_combined_restart.py diff --git a/src/anysolver/_ge_beam3_native_generalized_element.py b/src/anyfesolver/_ge_beam3_native_generalized_element.py similarity index 100% rename from src/anysolver/_ge_beam3_native_generalized_element.py rename to src/anyfesolver/_ge_beam3_native_generalized_element.py diff --git a/src/anysolver/_ge_beam3_native_generalized_factor_modal.py b/src/anyfesolver/_ge_beam3_native_generalized_factor_modal.py similarity index 100% rename from src/anysolver/_ge_beam3_native_generalized_factor_modal.py rename to src/anyfesolver/_ge_beam3_native_generalized_factor_modal.py diff --git a/src/anysolver/_ge_beam3_native_generalized_loading.py b/src/anyfesolver/_ge_beam3_native_generalized_loading.py similarity index 100% rename from src/anysolver/_ge_beam3_native_generalized_loading.py rename to src/anyfesolver/_ge_beam3_native_generalized_loading.py diff --git a/src/anysolver/_ge_beam3_native_generalized_modal.py b/src/anyfesolver/_ge_beam3_native_generalized_modal.py similarity index 100% rename from src/anysolver/_ge_beam3_native_generalized_modal.py rename to src/anyfesolver/_ge_beam3_native_generalized_modal.py diff --git a/src/anysolver/_ge_beam3_native_generalized_paired_modal.py b/src/anyfesolver/_ge_beam3_native_generalized_paired_modal.py similarity index 100% rename from src/anysolver/_ge_beam3_native_generalized_paired_modal.py rename to src/anyfesolver/_ge_beam3_native_generalized_paired_modal.py diff --git a/src/anysolver/_ge_beam3_native_generalized_parameter.py b/src/anyfesolver/_ge_beam3_native_generalized_parameter.py similarity index 100% rename from src/anysolver/_ge_beam3_native_generalized_parameter.py rename to src/anyfesolver/_ge_beam3_native_generalized_parameter.py diff --git a/src/anysolver/_ge_beam3_native_generalized_program.py b/src/anyfesolver/_ge_beam3_native_generalized_program.py similarity index 100% rename from src/anysolver/_ge_beam3_native_generalized_program.py rename to src/anyfesolver/_ge_beam3_native_generalized_program.py diff --git a/src/anysolver/_ge_beam3_native_generalized_recovery.py b/src/anyfesolver/_ge_beam3_native_generalized_recovery.py similarity index 100% rename from src/anysolver/_ge_beam3_native_generalized_recovery.py rename to src/anyfesolver/_ge_beam3_native_generalized_recovery.py diff --git a/src/anysolver/_ge_beam3_native_generalized_restart.py b/src/anyfesolver/_ge_beam3_native_generalized_restart.py similarity index 100% rename from src/anysolver/_ge_beam3_native_generalized_restart.py rename to src/anyfesolver/_ge_beam3_native_generalized_restart.py diff --git a/src/anysolver/_ge_beam3_native_history_profile.py b/src/anyfesolver/_ge_beam3_native_history_profile.py similarity index 100% rename from src/anysolver/_ge_beam3_native_history_profile.py rename to src/anyfesolver/_ge_beam3_native_history_profile.py diff --git a/src/anysolver/_ge_beam3_native_line_loading.py b/src/anyfesolver/_ge_beam3_native_line_loading.py similarity index 100% rename from src/anysolver/_ge_beam3_native_line_loading.py rename to src/anyfesolver/_ge_beam3_native_line_loading.py diff --git a/src/anysolver/_ge_beam3_native_line_program.py b/src/anyfesolver/_ge_beam3_native_line_program.py similarity index 100% rename from src/anysolver/_ge_beam3_native_line_program.py rename to src/anyfesolver/_ge_beam3_native_line_program.py diff --git a/src/anysolver/_ge_beam3_native_line_recovery.py b/src/anyfesolver/_ge_beam3_native_line_recovery.py similarity index 100% rename from src/anysolver/_ge_beam3_native_line_recovery.py rename to src/anyfesolver/_ge_beam3_native_line_recovery.py diff --git a/src/anysolver/_ge_beam3_native_line_restart.py b/src/anyfesolver/_ge_beam3_native_line_restart.py similarity index 100% rename from src/anysolver/_ge_beam3_native_line_restart.py rename to src/anyfesolver/_ge_beam3_native_line_restart.py diff --git a/src/anysolver/_ge_beam3_native_line_static_element.py b/src/anyfesolver/_ge_beam3_native_line_static_element.py similarity index 100% rename from src/anysolver/_ge_beam3_native_line_static_element.py rename to src/anyfesolver/_ge_beam3_native_line_static_element.py diff --git a/src/anysolver/_ge_beam3_native_load_admission.py b/src/anyfesolver/_ge_beam3_native_load_admission.py similarity index 100% rename from src/anysolver/_ge_beam3_native_load_admission.py rename to src/anyfesolver/_ge_beam3_native_load_admission.py diff --git a/src/anysolver/_ge_beam3_native_midpoint.py b/src/anyfesolver/_ge_beam3_native_midpoint.py similarity index 99% rename from src/anysolver/_ge_beam3_native_midpoint.py rename to src/anyfesolver/_ge_beam3_native_midpoint.py index bc3c0f555..f803cdf16 100644 --- a/src/anysolver/_ge_beam3_native_midpoint.py +++ b/src/anyfesolver/_ge_beam3_native_midpoint.py @@ -1,75 +1,75 @@ -"""Private single-element elastic native midpoint development owner. - -No public finite-speed admission, static codec mutation or physical condensation. -Algebraic nodal-frame velocity slots are inertial placeholders only: stage and -endpoint nodal frames are independent solved coordinates and generally move. -""" -from dataclasses import dataclass -from contextlib import contextmanager -import json +"""Private single-element elastic native midpoint development owner. + +No public finite-speed admission, static codec mutation or physical condensation. +Algebraic nodal-frame velocity slots are inertial placeholders only: stage and +endpoint nodal frames are independent solved coordinates and generally move. +""" +from dataclasses import dataclass +from contextlib import contextmanager +import json from threading import Lock, get_ident -import numpy as np - -from ._ge_beam3_native_analysis import NativeBeamAnalysis -from ._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement -from ._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection -from ._ge_beam3_retained_generalized_state import Context, Program, Mechanical +import numpy as np + +from ._ge_beam3_native_analysis import NativeBeamAnalysis +from ._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement +from ._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection +from ._ge_beam3_retained_generalized_state import Context, Program, Mechanical from ._ge_beam3_dynamic_elastic_state import DynamicElasticContext, _admit_runtime_limit -from ._ge_beam3_native_generalized_loading import DistributedPattern -from ._ge_beam3_native_line_loading import LinePattern -from ._ge_beam3_centered_finite_inertia import ( - evaluate_centered_finite_inertia, PHYSICAL_DOFS, ALGEBRAIC_DOFS) -from ._ge_beam3_p5.algebra import rotation -from ._ge_beam3_p5.chart import exp_chart_terms -from ._ge_beam3_p5.compensated_coordinates import split_sum, validate_pair -from ._ge_beam3_p5_seeded.core import canonical, sha -from ._native_reference_modal import _owned -from .control import cancellation_safe_point - -IMPLEMENTATION_ID = 'DEVELOPMENT_C7_SINGLE_CENTERED_NATIVE_MIDPOINT_V1' - - -@dataclass(frozen=True) -class MidpointState: - mechanical: Mechanical - origins: tuple - histories: tuple - physical_velocity24: np.ndarray - physical_acceleration24: np.ndarray - time: float - epoch: int - predecessor_sha256: str - context_sha256: str - - -@dataclass(frozen=True) -class StageEvaluation: - mechanical: Mechanical - residual: np.ndarray - jacobian: np.ndarray - configuration_map: np.ndarray - physical_velocity24: np.ndarray - physical_acceleration24: np.ndarray - structural_residual: np.ndarray - structural_jacobian: np.ndarray - inertia: object - material_sha256: str - - -@dataclass(frozen=True) -class MidpointCandidate: - endpoint: MidpointState - stage: StageEvaluation - unknown42: np.ndarray - dt: float - predecessor_sha256: str - iterations: int - backtracks: int - stage_residual_norm: float - endpoint_algebraic_norm: float - endpoint_reaction42: np.ndarray - - +from ._ge_beam3_native_generalized_loading import DistributedPattern +from ._ge_beam3_native_line_loading import LinePattern +from ._ge_beam3_centered_finite_inertia import ( + evaluate_centered_finite_inertia, PHYSICAL_DOFS, ALGEBRAIC_DOFS) +from ._ge_beam3_p5.algebra import rotation +from ._ge_beam3_p5.chart import exp_chart_terms +from ._ge_beam3_p5.compensated_coordinates import split_sum, validate_pair +from ._ge_beam3_p5_seeded.core import canonical, sha +from ._native_reference_modal import _owned +from .control import cancellation_safe_point + +IMPLEMENTATION_ID = 'DEVELOPMENT_C7_SINGLE_CENTERED_NATIVE_MIDPOINT_V1' + + +@dataclass(frozen=True) +class MidpointState: + mechanical: Mechanical + origins: tuple + histories: tuple + physical_velocity24: np.ndarray + physical_acceleration24: np.ndarray + time: float + epoch: int + predecessor_sha256: str + context_sha256: str + + +@dataclass(frozen=True) +class StageEvaluation: + mechanical: Mechanical + residual: np.ndarray + jacobian: np.ndarray + configuration_map: np.ndarray + physical_velocity24: np.ndarray + physical_acceleration24: np.ndarray + structural_residual: np.ndarray + structural_jacobian: np.ndarray + inertia: object + material_sha256: str + + +@dataclass(frozen=True) +class MidpointCandidate: + endpoint: MidpointState + stage: StageEvaluation + unknown42: np.ndarray + dt: float + predecessor_sha256: str + iterations: int + backtracks: int + stage_residual_norm: float + endpoint_algebraic_norm: float + endpoint_reaction42: np.ndarray + + @dataclass(frozen=True) class CandidateStageAudit: """Immutable evidence snapshot; never a state/session acceptance credential.""" @@ -92,16 +92,16 @@ class CandidateStageAudit: @dataclass(frozen=True) class EndpointAccounting: - state_sha256: str - time: float - epoch: int - linear_momentum: np.ndarray - linear_momentum_low: np.ndarray - angular_momentum: np.ndarray - angular_momentum_low: np.ndarray - kinetic_energy: float - elastic_energy: float - total_energy: float + state_sha256: str + time: float + epoch: int + linear_momentum: np.ndarray + linear_momentum_low: np.ndarray + angular_momentum: np.ndarray + angular_momentum_low: np.ndarray + kinetic_energy: float + elastic_energy: float + total_energy: float elastic_consistency_witness: float resultant_compatibility18: np.ndarray rank_mass_checks: bytes @@ -120,31 +120,31 @@ class PhysicalLoadAccounting: momentum_origin_high: np.ndarray momentum_origin_low: np.ndarray has_nonpotential_couple: bool - - -class MidpointContext: - """Immutable issued states, ephemeral trials, and atomic accepted replacement. - - Every external operation runs under the exact analysis operation lock. One - homogeneous six-component clamp remains the default legacy route. The - explicit dynamic elastic route also admits zero supports, with the same - spatial stage equations and a disposable shared structural work session. + + +class MidpointContext: + """Immutable issued states, ephemeral trials, and atomic accepted replacement. + + Every external operation runs under the exact analysis operation lock. One + homogeneous six-component clamp remains the default legacy route. The + explicit dynamic elastic route also admits zero supports, with the same + spatial stage equations and a disposable shared structural work session. Legacy/default owners retain120s; explicit dynamic owners capture one bounded duration at construction. No operation resets that clock. - """ - def __init__(self, analysis, *, inertia_order=24, max_iterations=12, + """ + def __init__(self, analysis, *, inertia_order=24, max_iterations=12, max_backtracks=8, structural_owner='legacy_clamp', momentum_origin_high=(0., 0., 0.), momentum_origin_low=(0., 0., 0.), load_pattern=None, stage_residual_tolerance=1e-11, stage_coordinates='increment', runtime_limit_seconds=120.): - if type(analysis) is not NativeBeamAnalysis: - raise ValueError('exact standalone native analysis required') - if (type(inertia_order) is not int or inertia_order not in (4, 8, 24) - or type(max_iterations) is not int or not 1 <= max_iterations <= 12 - or type(max_backtracks) is not int or not 0 <= max_backtracks <= 8): - raise ValueError('bounded exact midpoint settings') - if type(structural_owner) is not str or structural_owner not in ('legacy_clamp', 'dynamic_elastic'): - raise ValueError('explicit private midpoint structural owner required') + if type(analysis) is not NativeBeamAnalysis: + raise ValueError('exact standalone native analysis required') + if (type(inertia_order) is not int or inertia_order not in (4, 8, 24) + or type(max_iterations) is not int or not 1 <= max_iterations <= 12 + or type(max_backtracks) is not int or not 0 <= max_backtracks <= 8): + raise ValueError('bounded exact midpoint settings') + if type(structural_owner) is not str or structural_owner not in ('legacy_clamp', 'dynamic_elastic'): + raise ValueError('explicit private midpoint structural owner required') if type(stage_residual_tolerance) not in (int, float): raise ValueError('positive finite midpoint stage residual tolerance required') try: @@ -165,28 +165,28 @@ def __init__(self, analysis, *, inertia_order=24, max_iterations=12, if structural_owner != 'dynamic_elastic' and self.runtime_limit_seconds != 120.: raise ValueError('extended runtime requires the dynamic elastic owner') self.structural_owner = structural_owner - self._selected_owner = structural_owner - self.momentum_origin_high = _owned(momentum_origin_high) - self.momentum_origin_low = _owned(momentum_origin_low) - if self.momentum_origin_high.shape != (3,) or self.momentum_origin_low.shape != (3,): - raise ValueError('complete momentum origin pairs required') - for high, low in zip(self.momentum_origin_high, self.momentum_origin_low): - validate_pair(float(high), float(low)) - if structural_owner == 'legacy_clamp' and (np.any(self.momentum_origin_high) or np.any(self.momentum_origin_low)): - raise ValueError('legacy midpoint retains its zero momentum origin') + self._selected_owner = structural_owner + self.momentum_origin_high = _owned(momentum_origin_high) + self.momentum_origin_low = _owned(momentum_origin_low) + if self.momentum_origin_high.shape != (3,) or self.momentum_origin_low.shape != (3,): + raise ValueError('complete momentum origin pairs required') + for high, low in zip(self.momentum_origin_high, self.momentum_origin_low): + validate_pair(float(high), float(low)) + if structural_owner == 'legacy_clamp' and (np.any(self.momentum_origin_high) or np.any(self.momentum_origin_low)): + raise ValueError('legacy midpoint retains its zero momentum origin') self._dynamic = (DynamicElasticContext(analysis, max_iterations=max_iterations, max_backtracks=max_backtracks, runtime_limit_seconds=self.runtime_limit_seconds) if structural_owner == 'dynamic_elastic' else None) - self._work_session = None - with analysis._operation(): - elements = analysis._elements - if (len(elements) != 1 or type(elements[0]) is not NativeGeneralizedStaticElement - or type(elements[0].section) is not EllipsoidalGeneralizedSection - or len(analysis.model.mesh.nodes) != 3 - or analysis.model.mesh.dof_manager.total_dofs != 18): - raise ValueError('one centered generalized element/full 42 order required') - if structural_owner == 'legacy_clamp' and analysis._admit_boundaries() != tuple(range(6)): - raise ValueError('explicit homogeneous full clamp on first ordered node required') + self._work_session = None + with analysis._operation(): + elements = analysis._elements + if (len(elements) != 1 or type(elements[0]) is not NativeGeneralizedStaticElement + or type(elements[0].section) is not EllipsoidalGeneralizedSection + or len(analysis.model.mesh.nodes) != 3 + or analysis.model.mesh.dof_manager.total_dofs != 18): + raise ValueError('one centered generalized element/full 42 order required') + if structural_owner == 'legacy_clamp' and analysis._admit_boundaries() != tuple(range(6)): + raise ValueError('explicit homogeneous full clamp on first ordered node required') self.analysis = analysis self.element = elements[0] if load_pattern is not None and (structural_owner != 'dynamic_elastic' @@ -204,40 +204,40 @@ def __init__(self, analysis, *, inertia_order=24, max_iterations=12, raise ValueError('supplied constant physical load changed during ownership') self.load_pattern.require(analysis.model.mesh) self._captured_load = canonical(self.load_pattern) - self.inertia_order = inertia_order - self.max_iterations = max_iterations - self.max_backtracks = max_backtracks - self._static = None - if structural_owner == 'legacy_clamp': - self._static = Context(analysis.model, Program((0.,), - DistributedPattern(LinePattern(()), ()))) - if (self._static.count != 42 or self._static.slots != [list(range(42))] - or self._static.nodal_count != 18): - raise ValueError('exact one-element canonical mixed ordering required') - free = self._static.free - self.fixed = self._static.fixed - self._reference_mechanical = self._static.initial.mechanical - self._reference_origins = self._static.initial.histories - self.scale = self._static.scale - self.length = self._static.length + self.inertia_order = inertia_order + self.max_iterations = max_iterations + self.max_backtracks = max_backtracks + self._static = None + if structural_owner == 'legacy_clamp': + self._static = Context(analysis.model, Program((0.,), + DistributedPattern(LinePattern(()), ()))) + if (self._static.count != 42 or self._static.slots != [list(range(42))] + or self._static.nodal_count != 18): + raise ValueError('exact one-element canonical mixed ordering required') + free = self._static.free + self.fixed = self._static.fixed + self._reference_mechanical = self._static.initial.mechanical + self._reference_origins = self._static.initial.histories + self.scale = self._static.scale + self.length = self._static.length else: free = self._dynamic.free self.fixed = self._dynamic.fixed self._reference_mechanical = self._dynamic._reference.mechanical self._reference_origins = self._dynamic.origins self.scale, self.length = self._gate_inputs() - self.free = np.frombuffer(np.asarray(free, dtype=int).tobytes(), dtype=int) - self.physical_free = tuple(i for i in PHYSICAL_DOFS if i in self.free) - self.algebraic_free = tuple(i for i in ALGEBRAIC_DOFS if i in self.free) - expected = (15, 27) if not self.fixed else (12, 24) - if (len(self.physical_free), len(self.algebraic_free)) != expected: - raise ValueError('explicit physical/algebraic supported partition required') - self._identity = sha(self._identity_data()) - self._current = None - self._visible_current = None - self._current_bytes = None - self._issued = {} - self._candidates = {} + self.free = np.frombuffer(np.asarray(free, dtype=int).tobytes(), dtype=int) + self.physical_free = tuple(i for i in PHYSICAL_DOFS if i in self.free) + self.algebraic_free = tuple(i for i in ALGEBRAIC_DOFS if i in self.free) + expected = (15, 27) if not self.fixed else (12, 24) + if (len(self.physical_free), len(self.algebraic_free)) != expected: + raise ValueError('explicit physical/algebraic supported partition required') + self._identity = sha(self._identity_data()) + self._current = None + self._visible_current = None + self._current_bytes = None + self._issued = {} + self._candidates = {} self._initial_checks = None self._transaction_lock = Lock() self._restore_checks = None @@ -246,27 +246,27 @@ def __init__(self, analysis, *, inertia_order=24, max_iterations=12, from ._ge_beam3_native_dynamic_restart import contract self._restart_contract = canonical(contract(self)) self._captured_restart_contract = self._restart_contract - - @property - def initial_checks(self): - return None if self._initial_checks is None else json.loads(self._initial_checks) - - @property + + @property + def initial_checks(self): + return None if self._initial_checks is None else json.loads(self._initial_checks) + + @property def current(self): return self._visible_current @property def restore_checks(self): return None if self._restore_checks is None else json.loads(self._restore_checks) - + def _identity_data(self): - # The default route's payload is unchanged from its frozen V3 owner. - data = dict(implementation=IMPLEMENTATION_ID, - analysis=self.analysis.identity, inertia_order=self.inertia_order, - iterations=self.max_iterations, backtracks=self.max_backtracks, - physical=self.physical_free, algebraic=self.algebraic_free, free=self.free) - if self.structural_owner == 'legacy_clamp': - data['static_context'] = self._static.identity + # The default route's payload is unchanged from its frozen V3 owner. + data = dict(implementation=IMPLEMENTATION_ID, + analysis=self.analysis.identity, inertia_order=self.inertia_order, + iterations=self.max_iterations, backtracks=self.max_backtracks, + physical=self.physical_free, algebraic=self.algebraic_free, free=self.free) + if self.structural_owner == 'legacy_clamp': + data['static_context'] = self._static.identity else: data.update(structural_owner='dynamic_elastic', dynamic_context=self._dynamic._identity, momentum_origin_high=self.momentum_origin_high, momentum_origin_low=self.momentum_origin_low) @@ -296,32 +296,32 @@ def _gate_inputs(self): scales[6*node+3:6*node+6] = length scales[18:30] = length return _owned(scales), length - - @contextmanager - def _work_operation(self): - if self.structural_owner == 'legacy_clamp': - with self.analysis._operation(): - yield - else: - with self._dynamic.session() as session: - self._work_session = session - try: - yield - finally: - self._work_session = None - - @contextmanager - def _atomic_operation(self): - # The analysis exit guard runs after the operation body. Keep tentative - # publication private until that guard succeeds; restore all issuance - # bookkeeping if it fails. A separate nonblocking lock prevents another - # midpoint operation entering between analysis-lock release and rollback. - if not self._transaction_lock.acquire(blocking=False): - raise ValueError('midpoint context is already in use') - snapshot = None - try: - try: - with self._work_operation(): + + @contextmanager + def _work_operation(self): + if self.structural_owner == 'legacy_clamp': + with self.analysis._operation(): + yield + else: + with self._dynamic.session() as session: + self._work_session = session + try: + yield + finally: + self._work_session = None + + @contextmanager + def _atomic_operation(self): + # The analysis exit guard runs after the operation body. Keep tentative + # publication private until that guard succeeds; restore all issuance + # bookkeeping if it fails. A separate nonblocking lock prevents another + # midpoint operation entering between analysis-lock release and rollback. + if not self._transaction_lock.acquire(blocking=False): + raise ValueError('midpoint context is already in use') + snapshot = None + try: + try: + with self._work_operation(): snapshot = (self._current, self._visible_current, self._current_bytes, self._issued.copy(), self._candidates.copy(), self._initial_checks, self._restore_checks) @@ -330,7 +330,7 @@ def _atomic_operation(self): if self._selected_owner == 'dynamic_elastic': from ._ge_beam3_native_dynamic_restart import require_contract require_contract(self) - yield + yield # A setting mutation during native/session exit cannot publish # a state under the former numerical acceptance contract. self._guard_stage_residual_tolerance() @@ -345,15 +345,15 @@ def _atomic_operation(self): self._guard_runtime_limit() self._dynamic._guard_deadline() self._visible_current = self._current - except BaseException: - if snapshot is not None: + except BaseException: + if snapshot is not None: (self._current, self._visible_current, self._current_bytes, self._issued, self._candidates, self._initial_checks, self._restore_checks) = snapshot - raise - finally: - self._transaction_lock.release() - + raise + finally: + self._transaction_lock.release() + def _guard_stage_residual_tolerance(self): if (type(self.stage_residual_tolerance) is not float or not np.isfinite(self.stage_residual_tolerance) or self.stage_residual_tolerance <= 0. @@ -381,9 +381,9 @@ def _guard(self, token=None, stage='midpoint.guard'): self._guard_stage_coordinates() self._guard_runtime_limit() if self.structural_owner != self._selected_owner: - raise ValueError('midpoint structural route changed') - if self.structural_owner == 'legacy_clamp': - self._static.guard() + raise ValueError('midpoint structural route changed') + if self.structural_owner == 'legacy_clamp': + self._static.guard() else: self._dynamic._guard() if self.load_pattern is not None: @@ -395,32 +395,32 @@ def _guard(self, token=None, stage='midpoint.guard'): scale, length = self._gate_inputs() if canonical(dict(scale=self.scale, length=self.length)) != canonical(dict(scale=scale, length=length)): raise ValueError('midpoint acceptance scale/length changed') - expected = sha(self._identity_data()) - if self._identity != expected or self.analysis._elements != (self.element,): - raise ValueError('midpoint context definition/settings changed') - - def _require_current(self, state): - record = self._issued.get(id(state)) - if (type(state) is not MidpointState or state is not self.current - or record is None or record[0] is not state - or canonical(state) != record[1] or record[1] != self._current_bytes - or state.context_sha256 != self._identity): - raise ValueError('current issued immutable midpoint predecessor required') - return sha(state) - + expected = sha(self._identity_data()) + if self._identity != expected or self.analysis._elements != (self.element,): + raise ValueError('midpoint context definition/settings changed') + + def _require_current(self, state): + record = self._issued.get(id(state)) + if (type(state) is not MidpointState or state is not self.current + or record is None or record[0] is not state + or canonical(state) != record[1] or record[1] != self._current_bytes + or state.context_sha256 != self._identity): + raise ValueError('current issued immutable midpoint predecessor required') + return sha(state) + def _structural(self, mechanical, origins): if self.structural_owner == 'dynamic_elastic': work = self._loaded_work(mechanical, origins) return work.residual, work.spatial_jacobian, work.material_sha256 - r, j, _, responses, _ = self._static.assemble(mechanical, 0., origins) - for response, origin in zip(responses, origins): - material = json.loads(response.material) - if canonical(response.history) != canonical(origin): - raise ValueError('midpoint first slice requires unchanged elastic history') - if any(row['branch'] != 'ELASTIC' - or any(value != 0. for pair in row['dissipation'] for value in pair) - for row in material['stations']): - raise ValueError('midpoint first slice requires strictly elastic stations') + r, j, _, responses, _ = self._static.assemble(mechanical, 0., origins) + for response, origin in zip(responses, origins): + material = json.loads(response.material) + if canonical(response.history) != canonical(origin): + raise ValueError('midpoint first slice requires unchanged elastic history') + if any(row['branch'] != 'ELASTIC' + or any(value != 0. for pair in row['dissipation'] for value in pair) + for row in material['stations']): + raise ValueError('midpoint first slice requires strictly elastic stations') return r, j, sha([response.material.decode() for response in responses]) def _loaded_work(self, mechanical, origins): @@ -431,105 +431,105 @@ def _loaded_work(self, mechanical, origins): or np.any(work.external_spatial_jacobian42[:, a])): raise ValueError('physical loading must have exactly zero algebraic work/tangent') return work - - def _inertia(self, mechanical, velocity, acceleration): - kwargs = {} - if self.structural_owner == 'dynamic_elastic': - kwargs = dict(momentum_origin_high=self.momentum_origin_high, - momentum_origin_low=self.momentum_origin_low) - result = evaluate_centered_finite_inertia(self.element.operator.reference, - self.analysis._inertias[self.element.element_id], - mechanical.positions, mechanical.position_low, - mechanical.cell_rotations[0], velocity, acceleration, - order=self.inertia_order, **kwargs) - a = list(ALGEBRAIC_DOFS) - for matrix in (result.mixed_mass, result.mixed_velocity_derivative, - result.mixed_configuration_derivative): - if np.any(matrix[a, :]) or np.any(matrix[:, a]): - raise ValueError('algebraic inertia derivative must be exactly zero') - if np.any(result.mixed_inertia[a]) or np.any(result.mixed_generalized_momentum[a]): - raise ValueError('algebraic inertia must be exactly zero') - return result - - def _block_checks(self, j, inertia): - z = list(self.algebraic_free) - p = list(self.physical_free) - cz = j[np.ix_(z, z)] - singular = np.linalg.svd(cz, compute_uv=False) - tolerance = 64*np.finfo(float).eps*len(z)*singular[0] - if not np.isfinite(singular).all() or singular[-1] <= tolerance: - raise ValueError('endpoint algebraic C_z singular: no time step admitted') - mass = inertia.mixed_mass[np.ix_(p, p)] - if np.linalg.norm(mass-mass.T) > 64*np.finfo(float).eps*np.linalg.norm(mass): - raise ValueError('physical mass symmetry contract failed') - np.linalg.cholesky((mass+mass.T)/2) - eigenvalues = np.linalg.eigvalsh((mass+mass.T)/2) - return dict(algebraic_rank=len(z), algebraic_sigma_min=float(singular[-1]), - algebraic_sigma_max=float(singular[0]), - algebraic_condition=float(singular[0]/singular[-1]), - physical_mass_min_eigenvalue=float(eigenvalues[0]), - physical_mass_max_eigenvalue=float(eigenvalues[-1]), - physical_mass_condition=float(eigenvalues[-1]/eigenvalues[0])) - + + def _inertia(self, mechanical, velocity, acceleration): + kwargs = {} + if self.structural_owner == 'dynamic_elastic': + kwargs = dict(momentum_origin_high=self.momentum_origin_high, + momentum_origin_low=self.momentum_origin_low) + result = evaluate_centered_finite_inertia(self.element.operator.reference, + self.analysis._inertias[self.element.element_id], + mechanical.positions, mechanical.position_low, + mechanical.cell_rotations[0], velocity, acceleration, + order=self.inertia_order, **kwargs) + a = list(ALGEBRAIC_DOFS) + for matrix in (result.mixed_mass, result.mixed_velocity_derivative, + result.mixed_configuration_derivative): + if np.any(matrix[a, :]) or np.any(matrix[:, a]): + raise ValueError('algebraic inertia derivative must be exactly zero') + if np.any(result.mixed_inertia[a]) or np.any(result.mixed_generalized_momentum[a]): + raise ValueError('algebraic inertia must be exactly zero') + return result + + def _block_checks(self, j, inertia): + z = list(self.algebraic_free) + p = list(self.physical_free) + cz = j[np.ix_(z, z)] + singular = np.linalg.svd(cz, compute_uv=False) + tolerance = 64*np.finfo(float).eps*len(z)*singular[0] + if not np.isfinite(singular).all() or singular[-1] <= tolerance: + raise ValueError('endpoint algebraic C_z singular: no time step admitted') + mass = inertia.mixed_mass[np.ix_(p, p)] + if np.linalg.norm(mass-mass.T) > 64*np.finfo(float).eps*np.linalg.norm(mass): + raise ValueError('physical mass symmetry contract failed') + np.linalg.cholesky((mass+mass.T)/2) + eigenvalues = np.linalg.eigvalsh((mass+mass.T)/2) + return dict(algebraic_rank=len(z), algebraic_sigma_min=float(singular[-1]), + algebraic_sigma_max=float(singular[0]), + algebraic_condition=float(singular[0]/singular[-1]), + physical_mass_min_eigenvalue=float(eigenvalues[0]), + physical_mass_max_eigenvalue=float(eigenvalues[-1]), + physical_mass_condition=float(eigenvalues[-1]/eigenvalues[0])) + def _norm(self, residual, indices): scale, _ = self._gate_inputs() return float(np.linalg.norm((residual/scale)[list(indices)])) - + def _correction(self, mechanical, step): _, length = self._gate_inputs() nodal = step[:18].reshape(3, 6) return max(float(np.linalg.norm(nodal[:, :3]))/length, - float(np.linalg.norm(nodal[:, 3:])), float(np.linalg.norm(step[18:24])), - float(np.linalg.norm(step[24:]))/max(1., float(np.linalg.norm(mechanical.resultants)))) - - def _solve_algebraic(self, mechanical, origins, token): - if self.structural_owner == 'dynamic_elastic': + float(np.linalg.norm(nodal[:, 3:])), float(np.linalg.norm(step[18:24])), + float(np.linalg.norm(step[24:]))/max(1., float(np.linalg.norm(mechanical.resultants)))) + + def _solve_algebraic(self, mechanical, origins, token): + if self.structural_owner == 'dynamic_elastic': state = self._work_session.trial_state(mechanical, origins=origins) result = self._work_session.consistent(state, pattern=self.load_pattern, parameter=0. if self.load_pattern is None else 1., cancellation_token=token) - return (result.state.mechanical, result.work.residual, - result.work.spatial_jacobian, result.residual_norm, result.work.material_sha256) - z = list(self.algebraic_free) - for iteration in range(self.max_iterations+1): - self._guard(token, 'midpoint.algebraic') - r, j, material = self._structural(mechanical, origins) - inertia = self._inertia(mechanical, np.zeros(24), np.zeros(24)) - self._block_checks(j, inertia) - step = np.zeros(42) - step[z] = np.linalg.solve(j[np.ix_(z, z)], -r[z]) - norm = self._norm(r, z) - if norm <= 1e-11 and self._correction(mechanical, step) <= 1e-11: - return mechanical, r, j, norm, material - if iteration == self.max_iterations: - raise ValueError('endpoint algebraic iteration limit') - for cut in range(self.max_backtracks+1): - self._guard(token, 'midpoint.algebraic.trial') - proposed = self._static.advance(mechanical, step*(2.**(-cut))) - rt, _, _ = self._structural(proposed, origins) - if self._norm(rt, z) < norm: - mechanical = proposed - break - else: - raise ValueError('endpoint algebraic residual backtracking failed') - raise AssertionError('bounded algebraic loop') - - def _endpoint_acceleration(self, mechanical, origins, velocity): - r, j, _ = self._structural(mechanical, origins) - inertia = self._inertia(mechanical, velocity, np.zeros(24)) - checks = self._block_checks(j, inertia) - p = list(self.physical_free) - acceleration = np.zeros(24) - acceleration[p] = np.linalg.solve(inertia.mixed_mass[np.ix_(p, p)], - -(r+inertia.mixed_inertia)[p]) - dynamic = self._inertia(mechanical, velocity, acceleration) - reaction = r+dynamic.mixed_inertia - if self._norm(reaction, p) > 1e-11: - raise ValueError('endpoint physical acceleration residual failed') - return _owned(acceleration), _owned(reaction), checks - - def initialize(self, mechanical=None, physical_velocity24=None, *, time=0., - cancellation_token=None): - with self._atomic_operation(): + return (result.state.mechanical, result.work.residual, + result.work.spatial_jacobian, result.residual_norm, result.work.material_sha256) + z = list(self.algebraic_free) + for iteration in range(self.max_iterations+1): + self._guard(token, 'midpoint.algebraic') + r, j, material = self._structural(mechanical, origins) + inertia = self._inertia(mechanical, np.zeros(24), np.zeros(24)) + self._block_checks(j, inertia) + step = np.zeros(42) + step[z] = np.linalg.solve(j[np.ix_(z, z)], -r[z]) + norm = self._norm(r, z) + if norm <= 1e-11 and self._correction(mechanical, step) <= 1e-11: + return mechanical, r, j, norm, material + if iteration == self.max_iterations: + raise ValueError('endpoint algebraic iteration limit') + for cut in range(self.max_backtracks+1): + self._guard(token, 'midpoint.algebraic.trial') + proposed = self._static.advance(mechanical, step*(2.**(-cut))) + rt, _, _ = self._structural(proposed, origins) + if self._norm(rt, z) < norm: + mechanical = proposed + break + else: + raise ValueError('endpoint algebraic residual backtracking failed') + raise AssertionError('bounded algebraic loop') + + def _endpoint_acceleration(self, mechanical, origins, velocity): + r, j, _ = self._structural(mechanical, origins) + inertia = self._inertia(mechanical, velocity, np.zeros(24)) + checks = self._block_checks(j, inertia) + p = list(self.physical_free) + acceleration = np.zeros(24) + acceleration[p] = np.linalg.solve(inertia.mixed_mass[np.ix_(p, p)], + -(r+inertia.mixed_inertia)[p]) + dynamic = self._inertia(mechanical, velocity, acceleration) + reaction = r+dynamic.mixed_inertia + if self._norm(reaction, p) > 1e-11: + raise ValueError('endpoint physical acceleration residual failed') + return _owned(acceleration), _owned(reaction), checks + + def initialize(self, mechanical=None, physical_velocity24=None, *, time=0., + cancellation_token=None): + with self._atomic_operation(): return self._initialize_state(mechanical, physical_velocity24, time=time, cancellation_token=cancellation_token) @@ -583,11 +583,11 @@ def _require_prepared_origin(self, state): or canonical(state) != record[1] or record[1] != self._current_bytes or state.context_sha256 != self._identity): raise ValueError('issued immutable prepared native origin required') - + def _stage(self, accepted, u, h, token=None): - self._guard(token, 'midpoint.stage') - self._require_current(accepted) - u = np.asarray(u) + self._guard(token, 'midpoint.stage') + self._require_current(accepted) + u = np.asarray(u) if u.shape != (42,) or u.dtype != np.float64 or not np.isfinite(u).all() or np.any(u[list(self.fixed)]): raise ValueError('supported finite binary64 midpoint unknown42 required') p = list(self.physical_free) @@ -598,10 +598,10 @@ def _stage(self, accepted, u, h, token=None): if acceleration_chart: physical_increment[p] = h*accepted.physical_velocity24[p]+(.5*h*h)*u[p] s = {k: v.copy() for k, v in accepted.mechanical.descriptor().items()} - a = np.eye(42) - for node in range(3): - first = 6*node - for axis in range(3): + a = np.eye(42) + for node in range(3): + first = 6*node + for axis in range(3): terms = (float(s['positions'][node, axis]), float(s['position_low'][node, axis])) if acceleration_chart: terms += (.5*h*float(accepted.physical_velocity24[first+axis]), @@ -609,20 +609,20 @@ def _stage(self, accepted, u, h, token=None): else: terms += (.5*float(u[first+axis]),) s['positions'][node, axis], s['position_low'][node, axis] = split_sum(terms) - a[first:first+3, first:first+3] *= .5 - eta = u[first+3:first+6] - s['nodal_frames'][node] = rotation(eta)@accepted.mechanical.nodal_frames[node] - a[first+3:first+6, first+3:first+6] = exp_chart_terms(eta)[0] - for cell in (0, 1): - first = 18+3*cell + a[first:first+3, first:first+3] *= .5 + eta = u[first+3:first+6] + s['nodal_frames'][node] = rotation(eta)@accepted.mechanical.nodal_frames[node] + a[first+3:first+6, first+3:first+6] = exp_chart_terms(eta)[0] + for cell in (0, 1): + first = 18+3*cell half = .5*physical_increment[first:first+3] - s['cell_rotations'][0, cell] = rotation(half)@accepted.mechanical.cell_rotations[0, cell] + s['cell_rotations'][0, cell] = rotation(half)@accepted.mechanical.cell_rotations[0, cell] a[first:first+3, first:first+3] = .5*exp_chart_terms(half)[0] if acceleration_chart: a[:, p] *= .5*h*h - s['resultants'][0] += u[24:] - mechanical = self._make(s) - velocity = np.zeros(24) + s['resultants'][0] += u[24:] + mechanical = self._make(s) + velocity = np.zeros(24) acceleration = np.zeros(24) if acceleration_chart: velocity[p] = accepted.physical_velocity24[p]+(.5*h)*u[p] @@ -630,46 +630,46 @@ def _stage(self, accepted, u, h, token=None): else: velocity[p] = u[p]/h acceleration[p] = 2*(velocity[p]-accepted.physical_velocity24[p])/h - r, j, material = self._structural(mechanical, accepted.histories) - inertia = self._inertia(mechanical, velocity, acceleration) - vmap = np.zeros((42, 42)) - bmap = np.zeros((42, 42)) + r, j, material = self._structural(mechanical, accepted.histories) + inertia = self._inertia(mechanical, velocity, acceleration) + vmap = np.zeros((42, 42)) + bmap = np.zeros((42, 42)) vmap[p, p] = .5*h if acceleration_chart else 1/h bmap[p, p] = 1. if acceleration_chart else 2/h**2 - jacobian = (j+inertia.mixed_configuration_derivative)@a - jacobian += inertia.mixed_velocity_derivative@vmap+inertia.mixed_mass@bmap - residual = r+inertia.mixed_inertia - if not np.isfinite(jacobian).all() or not np.isfinite(residual).all(): - raise ValueError('nonfinite midpoint stage') - return StageEvaluation(mechanical, _owned(residual), _owned(jacobian), _owned(a), - _owned(velocity), _owned(acceleration), _owned(r), _owned(j), inertia, material) - + jacobian = (j+inertia.mixed_configuration_derivative)@a + jacobian += inertia.mixed_velocity_derivative@vmap+inertia.mixed_mass@bmap + residual = r+inertia.mixed_inertia + if not np.isfinite(jacobian).all() or not np.isfinite(residual).all(): + raise ValueError('nonfinite midpoint stage') + return StageEvaluation(mechanical, _owned(residual), _owned(jacobian), _owned(a), + _owned(velocity), _owned(acceleration), _owned(r), _owned(j), inertia, material) + def evaluate_stage(self, accepted, unknown42, *, dt, cancellation_token=None): """Evaluate the selected chart; physical slots are a_m or increments. Algebraic slots remain frame/resultant increments in both charts. The returned Jacobian differentiates the actual selected unknown42. """ - with self._atomic_operation(): - self._time_step(dt) - return self._stage(accepted, unknown42, dt, cancellation_token) - - @staticmethod - def _time_step(h): - if (type(h) is not float or not np.isfinite(h) or h <= 0. - or h*h == 0. or not np.isfinite(2/(h*h))): - raise ValueError('positive finite typed midpoint dt required') - + with self._atomic_operation(): + self._time_step(dt) + return self._stage(accepted, unknown42, dt, cancellation_token) + + @staticmethod + def _time_step(h): + if (type(h) is not float or not np.isfinite(h) or h <= 0. + or h*h == 0. or not np.isfinite(2/(h*h))): + raise ValueError('positive finite typed midpoint dt required') + def trial(self, accepted, *, dt, cancellation_token=None): with self._atomic_operation(): return self._trial_state(accepted, dt, cancellation_token) def _trial_state(self, accepted, dt, cancellation_token): - self._time_step(dt) - self._guard(cancellation_token, 'midpoint.trial') - predecessor = self._require_current(accepted) - free = list(map(int, self.free)) - p = list(self.physical_free) + self._time_step(dt) + self._guard(cancellation_token, 'midpoint.trial') + predecessor = self._require_current(accepted) + free = list(map(int, self.free)) + p = list(self.physical_free) u = np.zeros(42) acceleration_chart = self.stage_coordinates == 'acceleration' u[p] = (accepted.physical_acceleration24[p] if acceleration_chart @@ -684,37 +684,37 @@ def _trial_state(self, accepted, dt, cancellation_token): # including iterations which reuse that disposable stage. self._guard(cancellation_token, 'midpoint.stage') self._require_current(accepted) - step = np.zeros(42) - step[free] = np.linalg.solve(stage.jacobian[np.ix_(free, free)], -stage.residual[free]) - norm = self._norm(stage.residual, free) + step = np.zeros(42) + step[free] = np.linalg.solve(stage.jacobian[np.ix_(free, free)], -stage.residual[free]) + norm = self._norm(stage.residual, free) correction_step = np.array(step, copy=True) if acceleration_chart: correction_step[p] *= .5*dt*dt if norm <= self.stage_residual_tolerance and self._correction(stage.mechanical, correction_step) <= 1e-11: - break - if iteration == self.max_iterations: - raise ValueError('midpoint stage iteration limit') - for cut in range(self.max_backtracks+1): - self._guard(cancellation_token, 'midpoint.stage.trial') - proposed = u+2.**(-cut)*step - next_stage = self._stage(accepted, proposed, dt, cancellation_token) - backtracks += int(cut > 0) + break + if iteration == self.max_iterations: + raise ValueError('midpoint stage iteration limit') + for cut in range(self.max_backtracks+1): + self._guard(cancellation_token, 'midpoint.stage.trial') + proposed = u+2.**(-cut)*step + next_stage = self._stage(accepted, proposed, dt, cancellation_token) + backtracks += int(cut > 0) if self._norm(next_stage.residual, free) < norm: u = proposed stage = next_stage break - else: - raise ValueError('midpoint stage residual backtracking failed') + else: + raise ValueError('midpoint stage residual backtracking failed') endpoint_step = np.zeros(42) endpoint_step[p] = (dt*accepted.physical_velocity24[p]+(.5*dt*dt)*u[p] if acceleration_chart else u[p]) - if self.structural_owner == 'legacy_clamp': - endpoint_mechanical = self._static.advance(accepted.mechanical, endpoint_step) - else: - high = np.array(accepted.mechanical.positions, copy=True) - low = np.array(accepted.mechanical.position_low, copy=True) - for node in range(3): - for axis in range(3): + if self.structural_owner == 'legacy_clamp': + endpoint_mechanical = self._static.advance(accepted.mechanical, endpoint_step) + else: + high = np.array(accepted.mechanical.positions, copy=True) + low = np.array(accepted.mechanical.position_low, copy=True) + for node in range(3): + for axis in range(3): terms = (float(high[node, axis]), float(low[node, axis])) if acceleration_chart: terms += (dt*float(accepted.physical_velocity24[6*node+axis]), @@ -723,35 +723,35 @@ def _trial_state(self, accepted, dt, cancellation_token): terms += (float(u[6*node+axis]),) high[node, axis], low[node, axis] = split_sum(terms) cells = np.array([rotation(endpoint_step[18+3*c:21+3*c])@accepted.mechanical.cell_rotations[0, c] - for c in (0, 1)]).reshape(1, 2, 3, 3) - endpoint_mechanical = self._make(dict(positions=high, position_low=low, - nodal_frames=accepted.mechanical.nodal_frames, cell_rotations=cells, - resultants=accepted.mechanical.resultants)) - # Stage algebraics are a starting guess, not accepted endpoint data. - endpoint_mechanical = self._make(dict( - positions=endpoint_mechanical.positions, position_low=endpoint_mechanical.position_low, - nodal_frames=stage.mechanical.nodal_frames, - cell_rotations=endpoint_mechanical.cell_rotations, - resultants=stage.mechanical.resultants)) - endpoint_mechanical, _, _, alg_norm, _ = self._solve_algebraic( - endpoint_mechanical, accepted.histories, cancellation_token) - velocity = np.zeros(24) + for c in (0, 1)]).reshape(1, 2, 3, 3) + endpoint_mechanical = self._make(dict(positions=high, position_low=low, + nodal_frames=accepted.mechanical.nodal_frames, cell_rotations=cells, + resultants=accepted.mechanical.resultants)) + # Stage algebraics are a starting guess, not accepted endpoint data. + endpoint_mechanical = self._make(dict( + positions=endpoint_mechanical.positions, position_low=endpoint_mechanical.position_low, + nodal_frames=stage.mechanical.nodal_frames, + cell_rotations=endpoint_mechanical.cell_rotations, + resultants=stage.mechanical.resultants)) + endpoint_mechanical, _, _, alg_norm, _ = self._solve_algebraic( + endpoint_mechanical, accepted.histories, cancellation_token) + velocity = np.zeros(24) velocity[p] = (accepted.physical_velocity24[p]+dt*u[p] if acceleration_chart else 2*stage.physical_velocity24[p]-accepted.physical_velocity24[p]) - acceleration, reaction, _ = self._endpoint_acceleration( - endpoint_mechanical, accepted.histories, velocity) - if not np.isfinite(accepted.time+dt) or accepted.time+dt <= accepted.time: - raise ValueError('midpoint time increment is not representable') - endpoint = MidpointState(endpoint_mechanical, accepted.histories, accepted.histories, - _owned(velocity), acceleration, accepted.time+dt, accepted.epoch+1, - predecessor, self._identity) - candidate = MidpointCandidate(endpoint, stage, _owned(u), dt, predecessor, - iteration, backtracks, norm, alg_norm, reaction) - self._guard(cancellation_token, 'midpoint.trial.ready') - self._require_current(accepted) - self._candidates[id(candidate)] = (candidate, canonical(candidate)) - return candidate - + acceleration, reaction, _ = self._endpoint_acceleration( + endpoint_mechanical, accepted.histories, velocity) + if not np.isfinite(accepted.time+dt) or accepted.time+dt <= accepted.time: + raise ValueError('midpoint time increment is not representable') + endpoint = MidpointState(endpoint_mechanical, accepted.histories, accepted.histories, + _owned(velocity), acceleration, accepted.time+dt, accepted.epoch+1, + predecessor, self._identity) + candidate = MidpointCandidate(endpoint, stage, _owned(u), dt, predecessor, + iteration, backtracks, norm, alg_norm, reaction) + self._guard(cancellation_token, 'midpoint.trial.ready') + self._require_current(accepted) + self._candidates[id(candidate)] = (candidate, canonical(candidate)) + return candidate + def _prepare_trial(self, accepted, *, dt, cancellation_token=None, prepare): """Trusted internal receipt; not a user callback or candidate commit.""" with self._atomic_operation(): @@ -822,18 +822,18 @@ def commit(self, candidate, *, cancellation_token=None): self._guard(cancellation_token, 'midpoint.before_commit') self._require_candidate(candidate) state = candidate.endpoint - self._issued[id(state)] = (state, canonical(state)) - self._current = state - self._current_bytes = canonical(state) - self._candidates.clear() - return state - + self._issued[id(state)] = (state, canonical(state)) + self._current = state + self._current_bytes = canonical(state) + self._candidates.clear() + return state + def discard(self, candidate): - with self._atomic_operation(): - self._guard() - record = self._candidates.get(id(candidate)) - if record is None or record[0] is not candidate or canonical(candidate) != record[1]: - raise ValueError('issued immutable midpoint candidate required') + with self._atomic_operation(): + self._guard() + record = self._candidates.get(id(candidate)) + if record is None or record[0] is not candidate or canonical(candidate) != record[1]: + raise ValueError('issued immutable midpoint candidate required') del self._candidates[id(candidate)] def create_checkpoint(self, *, cancellation_token=None): @@ -908,17 +908,17 @@ def _prepare_restore(self, raw, *, expected_sha256, cancellation_token, prepare) self._guard(cancellation_token, 'midpoint.trajectory_restore.ready') self._require_prepared_origin(state) return state, prepared - - def _make(self, data): - if self.structural_owner == 'legacy_clamp': - return self._static.make(data) - return self._work_session.make(data) - - def endpoint_accounting(self, state): - """Actual endpoint invariants, not instantaneous derivative surrogates.""" - with self._atomic_operation(): - self._guard() - self._require_current(state) + + def _make(self, data): + if self.structural_owner == 'legacy_clamp': + return self._static.make(data) + return self._work_session.make(data) + + def endpoint_accounting(self, state): + """Actual endpoint invariants, not instantaneous derivative surrogates.""" + with self._atomic_operation(): + self._guard() + self._require_current(state) return self._endpoint_accounting(state) def _endpoint_accounting(self, state): diff --git a/src/anysolver/_ge_beam3_native_multi_shell_contact.py b/src/anyfesolver/_ge_beam3_native_multi_shell_contact.py similarity index 100% rename from src/anysolver/_ge_beam3_native_multi_shell_contact.py rename to src/anyfesolver/_ge_beam3_native_multi_shell_contact.py diff --git a/src/anysolver/_ge_beam3_native_pair_contact.py b/src/anyfesolver/_ge_beam3_native_pair_contact.py similarity index 100% rename from src/anysolver/_ge_beam3_native_pair_contact.py rename to src/anyfesolver/_ge_beam3_native_pair_contact.py diff --git a/src/anysolver/_ge_beam3_native_shell_contact.py b/src/anyfesolver/_ge_beam3_native_shell_contact.py similarity index 100% rename from src/anysolver/_ge_beam3_native_shell_contact.py rename to src/anyfesolver/_ge_beam3_native_shell_contact.py diff --git a/src/anysolver/_ge_beam3_native_spatial_couples.py b/src/anyfesolver/_ge_beam3_native_spatial_couples.py similarity index 100% rename from src/anysolver/_ge_beam3_native_spatial_couples.py rename to src/anyfesolver/_ge_beam3_native_spatial_couples.py diff --git a/src/anysolver/_ge_beam3_native_spatial_restart.py b/src/anyfesolver/_ge_beam3_native_spatial_restart.py similarity index 100% rename from src/anysolver/_ge_beam3_native_spatial_restart.py rename to src/anyfesolver/_ge_beam3_native_spatial_restart.py diff --git a/src/anysolver/_ge_beam3_native_transient.py b/src/anyfesolver/_ge_beam3_native_transient.py similarity index 100% rename from src/anysolver/_ge_beam3_native_transient.py rename to src/anyfesolver/_ge_beam3_native_transient.py diff --git a/src/anysolver/_ge_beam3_native_translation.py b/src/anyfesolver/_ge_beam3_native_translation.py similarity index 100% rename from src/anysolver/_ge_beam3_native_translation.py rename to src/anyfesolver/_ge_beam3_native_translation.py diff --git a/src/anysolver/_ge_beam3_native_translation_restart.py b/src/anyfesolver/_ge_beam3_native_translation_restart.py similarity index 100% rename from src/anysolver/_ge_beam3_native_translation_restart.py rename to src/anyfesolver/_ge_beam3_native_translation_restart.py diff --git a/src/anysolver/_ge_beam3_operator_validation_scope.py b/src/anyfesolver/_ge_beam3_operator_validation_scope.py similarity index 100% rename from src/anysolver/_ge_beam3_operator_validation_scope.py rename to src/anyfesolver/_ge_beam3_operator_validation_scope.py diff --git a/src/anysolver/_ge_beam3_p5/__init__.py b/src/anyfesolver/_ge_beam3_p5/__init__.py similarity index 100% rename from src/anysolver/_ge_beam3_p5/__init__.py rename to src/anyfesolver/_ge_beam3_p5/__init__.py diff --git a/src/anysolver/_ge_beam3_p5/algebra.py b/src/anyfesolver/_ge_beam3_p5/algebra.py similarity index 100% rename from src/anysolver/_ge_beam3_p5/algebra.py rename to src/anyfesolver/_ge_beam3_p5/algebra.py diff --git a/src/anysolver/_ge_beam3_p5/arrays.py b/src/anyfesolver/_ge_beam3_p5/arrays.py similarity index 100% rename from src/anysolver/_ge_beam3_p5/arrays.py rename to src/anyfesolver/_ge_beam3_p5/arrays.py diff --git a/src/anysolver/_ge_beam3_p5/chart.py b/src/anyfesolver/_ge_beam3_p5/chart.py similarity index 97% rename from src/anysolver/_ge_beam3_p5/chart.py rename to src/anyfesolver/_ge_beam3_p5/chart.py index c94e6f8bc..a690984ea 100644 --- a/src/anysolver/_ge_beam3_p5/chart.py +++ b/src/anyfesolver/_ge_beam3_p5/chart.py @@ -5,7 +5,7 @@ """ import numpy as np -from anysolver._ge_beam3_mixed_ad import Jet2, so3_exp +from anyfesolver._ge_beam3_mixed_ad import Jet2, so3_exp from .algebra import skew from .arrays import _array, _readonly diff --git a/src/anysolver/_ge_beam3_p5/codec.py b/src/anyfesolver/_ge_beam3_p5/codec.py similarity index 96% rename from src/anysolver/_ge_beam3_p5/codec.py rename to src/anyfesolver/_ge_beam3_p5/codec.py index dcb98c16d..06e859fcb 100644 --- a/src/anysolver/_ge_beam3_p5/codec.py +++ b/src/anyfesolver/_ge_beam3_p5/codec.py @@ -6,8 +6,8 @@ import json -from anysolver._ge_beam3_p5.core import canonical, NativeMaterialError -from anysolver._ge_beam3_p5 import typed_schema as schema_source +from anyfesolver._ge_beam3_p5.core import canonical, NativeMaterialError +from anyfesolver._ge_beam3_p5 import typed_schema as schema_source SCHEMA='GE_BEAM3_P5_PACKAGE_TYPED_STATE_JSON_V1' diff --git a/src/anysolver/_ge_beam3_p5/committed_modal.py b/src/anyfesolver/_ge_beam3_p5/committed_modal.py similarity index 94% rename from src/anysolver/_ge_beam3_p5/committed_modal.py rename to src/anyfesolver/_ge_beam3_p5/committed_modal.py index e5f7effa7..a3186e86b 100644 --- a/src/anysolver/_ge_beam3_p5/committed_modal.py +++ b/src/anyfesolver/_ge_beam3_p5/committed_modal.py @@ -10,15 +10,15 @@ import numpy as np from scipy import sparse -from anysolver._native_reference_modal import _owned -from anysolver._native_stationary_spectrum import solve_stationary_spectrum -from anysolver.assembly import build_constraint_transformation -from anysolver.control import cancellation_safe_point -from anysolver.nonlinear_state import create_model_native_rotation_store -from anysolver._ge_beam3_p5.reference_modal import prepare as prepare_reference -from anysolver._ge_beam3_p5.core import sha -from anysolver._ge_beam3_p5.compensated import CompensatedStationaryBeam -from anysolver._ge_beam3_p5.inertia import LiftedInertia +from anyfesolver._native_reference_modal import _owned +from anyfesolver._native_stationary_spectrum import solve_stationary_spectrum +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.control import cancellation_safe_point +from anyfesolver.nonlinear_state import create_model_native_rotation_store +from anyfesolver._ge_beam3_p5.reference_modal import prepare as prepare_reference +from anyfesolver._ge_beam3_p5.core import sha +from anyfesolver._ge_beam3_p5.compensated import CompensatedStationaryBeam +from anyfesolver._ge_beam3_p5.inertia import LiftedInertia POLICY = 'P5_ACCEPTED_INCREMENT_AUGMENTED_HESSIAN_CURRENT_REST_MASS_V1' diff --git a/src/anysolver/_ge_beam3_p5/compensated.py b/src/anyfesolver/_ge_beam3_p5/compensated.py similarity index 95% rename from src/anysolver/_ge_beam3_p5/compensated.py rename to src/anyfesolver/_ge_beam3_p5/compensated.py index 26b8a2c5a..4f8cf2873 100644 --- a/src/anysolver/_ge_beam3_p5/compensated.py +++ b/src/anyfesolver/_ge_beam3_p5/compensated.py @@ -7,16 +7,16 @@ import math import numpy as np -from anysolver._ge_beam3_mixed_ad import ( +from anyfesolver._ge_beam3_mixed_ad import ( Jet2, constant_matrix, matmul, matvec, transpose, so3_exp, so3_log, ) -from anysolver._ge_beam3_p5.mixed import ( +from anyfesolver._ge_beam3_p5.mixed import ( StationaryMixedBeam, MixedBeamEvaluation, BeamStationTrial, NonlinearLocalError, compose_density, ) -from anysolver._ge_beam3_p5.algebra import HALVES -from anysolver._ge_beam3_p5.arrays import _array, _frames, _readonly -from anysolver._ge_beam3_p5.compensated_coordinates import split_sum, validate_pair +from anyfesolver._ge_beam3_p5.algebra import HALVES +from anyfesolver._ge_beam3_p5.arrays import _array, _frames, _readonly +from anyfesolver._ge_beam3_p5.compensated_coordinates import split_sum, validate_pair SCHEMA = 'GE_BEAM3_P5_COMPENSATED_MIXED_EVALUATION_V1' diff --git a/src/anysolver/_ge_beam3_p5/compensated_coordinates.py b/src/anyfesolver/_ge_beam3_p5/compensated_coordinates.py similarity index 100% rename from src/anysolver/_ge_beam3_p5/compensated_coordinates.py rename to src/anyfesolver/_ge_beam3_p5/compensated_coordinates.py diff --git a/src/anysolver/_ge_beam3_p5/core.py b/src/anyfesolver/_ge_beam3_p5/core.py similarity index 98% rename from src/anysolver/_ge_beam3_p5/core.py rename to src/anyfesolver/_ge_beam3_p5/core.py index 8066284ac..82b322205 100644 --- a/src/anysolver/_ge_beam3_p5/core.py +++ b/src/anyfesolver/_ge_beam3_p5/core.py @@ -9,8 +9,8 @@ import hashlib import json import numpy as np -from anysolver.elements import Element -from anysolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry +from anyfesolver.elements import Element +from anyfesolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry from .compensated import CompensatedStationaryBeam from .arrays import _array, _frames from .mixed import LocalForceAccuracy diff --git a/src/anysolver/_ge_beam3_p5/element.py b/src/anyfesolver/_ge_beam3_p5/element.py similarity index 97% rename from src/anysolver/_ge_beam3_p5/element.py rename to src/anyfesolver/_ge_beam3_p5/element.py index bcbb16a7b..12e7167d0 100644 --- a/src/anysolver/_ge_beam3_p5/element.py +++ b/src/anyfesolver/_ge_beam3_p5/element.py @@ -8,14 +8,14 @@ import numpy as np -from anysolver.elements import Element -from anysolver._native_material_protocol import PROTOCOL, NativeMaterialContext, NativeMaterialValidator -from anysolver._ge_beam3_p5.core import ( +from anyfesolver.elements import Element +from anyfesolver._native_material_protocol import PROTOCOL, NativeMaterialContext, NativeMaterialValidator +from anyfesolver._ge_beam3_p5.core import ( StationaryCore, NativeMaterialError, sha, seal, ) -from anysolver._ge_beam3_p5.chart import pullback -from anysolver._ge_beam3_p5.arrays import _array, _readonly -from anysolver._ge_beam3_p5 import codec as codec +from anyfesolver._ge_beam3_p5.chart import pullback +from anyfesolver._ge_beam3_p5.arrays import _array, _readonly +from anyfesolver._ge_beam3_p5 import codec as codec SCHEMA='GE_BEAM3_P5_PACKAGE_DRIVER_STATE_V1' diff --git a/src/anysolver/_ge_beam3_p5/factors.py b/src/anyfesolver/_ge_beam3_p5/factors.py similarity index 100% rename from src/anysolver/_ge_beam3_p5/factors.py rename to src/anyfesolver/_ge_beam3_p5/factors.py diff --git a/src/anysolver/_ge_beam3_p5/inertia.py b/src/anyfesolver/_ge_beam3_p5/inertia.py similarity index 97% rename from src/anysolver/_ge_beam3_p5/inertia.py rename to src/anyfesolver/_ge_beam3_p5/inertia.py index e2e4b20ff..6cf429e72 100644 --- a/src/anysolver/_ge_beam3_p5/inertia.py +++ b/src/anyfesolver/_ge_beam3_p5/inertia.py @@ -8,8 +8,8 @@ import numpy as np -from anysolver._ge_beam3_p5.algebra import HALVES, skew, validate_section -from anysolver._ge_beam3_p5.arrays import _array, _frames, _readonly +from anyfesolver._ge_beam3_p5.algebra import HALVES, skew, validate_section +from anyfesolver._ge_beam3_p5.arrays import _array, _frames, _readonly SCHEMA = 'GE_BEAM3_P5_FINITE_RETAINED_INERTIA_DEVELOPMENT_V1' diff --git a/src/anysolver/_ge_beam3_p5/mass.py b/src/anyfesolver/_ge_beam3_p5/mass.py similarity index 100% rename from src/anysolver/_ge_beam3_p5/mass.py rename to src/anyfesolver/_ge_beam3_p5/mass.py diff --git a/src/anysolver/_ge_beam3_p5/mixed.py b/src/anyfesolver/_ge_beam3_p5/mixed.py similarity index 97% rename from src/anysolver/_ge_beam3_p5/mixed.py rename to src/anyfesolver/_ge_beam3_p5/mixed.py index 65931b540..19201e5d1 100644 --- a/src/anysolver/_ge_beam3_p5/mixed.py +++ b/src/anyfesolver/_ge_beam3_p5/mixed.py @@ -8,13 +8,13 @@ import numpy as np -from anysolver._ge_beam3_mixed_ad import ( +from anyfesolver._ge_beam3_mixed_ad import ( Jet2, constant_matrix, matmul, matvec, transpose, so3_exp, so3_log, ) -from anysolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry -from anysolver._ge_beam3_p5.algebra import HALVES, rotation -from anysolver._ge_beam3_p5.arrays import _array, _frames, _readonly -from anysolver._ge_beam3_p5.section import ( +from anyfesolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry +from anyfesolver._ge_beam3_p5.algebra import HALVES, rotation +from anyfesolver._ge_beam3_p5.arrays import _array, _frames, _readonly +from anyfesolver._ge_beam3_p5.section import ( DirectedHardeningSection, SectionHistory, SectionResponse, _history, ) @@ -193,7 +193,7 @@ def solve(self, positions, vertex_frames, *, initial_rotations=None, initial_mom x = _array(positions, (3, 3), "positions") q = _frames(vertex_frames, 3, "vertex frames") # Midpoint rotations are only initial guesses; no trial history update. - from anysolver._ge_beam3_p5.algebra import log_rotation + from anyfesolver._ge_beam3_p5.algebra import log_rotation relatives = q @ self.reference.nodal_triads.transpose(0, 2, 1) default = np.array([relatives[left] @ rotation(log_rotation(relatives[left].T @ relatives[right])/2) for left, right in HALVES]) diff --git a/src/anysolver/_ge_beam3_p5/reference_modal.py b/src/anyfesolver/_ge_beam3_p5/reference_modal.py similarity index 90% rename from src/anysolver/_ge_beam3_p5/reference_modal.py rename to src/anyfesolver/_ge_beam3_p5/reference_modal.py index 46342949d..2b725b9fa 100644 --- a/src/anysolver/_ge_beam3_p5/reference_modal.py +++ b/src/anyfesolver/_ge_beam3_p5/reference_modal.py @@ -6,12 +6,12 @@ import numpy as np -from anysolver._native_reference_modal import ReferenceModalBlock, solve_reference_modal -from anysolver.control import cancellation_safe_point -from anysolver._ge_beam3_p5.element import NativeP5BeamElement -from anysolver._ge_beam3_p5.core import sha -from anysolver._ge_beam3_p5.mass import reference_kinetic_factors -from anysolver._ge_beam3_p5.algebra import validate_section +from anyfesolver._native_reference_modal import ReferenceModalBlock, solve_reference_modal +from anyfesolver.control import cancellation_safe_point +from anyfesolver._ge_beam3_p5.element import NativeP5BeamElement +from anyfesolver._ge_beam3_p5.core import sha +from anyfesolver._ge_beam3_p5.mass import reference_kinetic_factors +from anyfesolver._ge_beam3_p5.algebra import validate_section def prepare(model, section_inertias, *, cancellation_token=None): diff --git a/src/anysolver/_ge_beam3_p5/section.py b/src/anyfesolver/_ge_beam3_p5/section.py similarity index 100% rename from src/anysolver/_ge_beam3_p5/section.py rename to src/anyfesolver/_ge_beam3_p5/section.py diff --git a/src/anysolver/_ge_beam3_p5/typed_schema.py b/src/anyfesolver/_ge_beam3_p5/typed_schema.py similarity index 100% rename from src/anysolver/_ge_beam3_p5/typed_schema.py rename to src/anyfesolver/_ge_beam3_p5/typed_schema.py diff --git a/src/anysolver/_ge_beam3_p5_centered/__init__.py b/src/anyfesolver/_ge_beam3_p5_centered/__init__.py similarity index 72% rename from src/anysolver/_ge_beam3_p5_centered/__init__.py rename to src/anyfesolver/_ge_beam3_p5_centered/__init__.py index adb80ac1b..d459a28a8 100644 --- a/src/anysolver/_ge_beam3_p5_centered/__init__.py +++ b/src/anyfesolver/_ge_beam3_p5_centered/__init__.py @@ -1,6 +1,6 @@ """Private centered-reference P5 successor; not a public element selector.""" -from anysolver._ge_beam3_p5.section import DirectedHardeningSection +from anyfesolver._ge_beam3_p5.section import DirectedHardeningSection from .element import NativeP5BeamElement __all__ = ['NativeP5BeamElement', 'DirectedHardeningSection'] diff --git a/src/anysolver/_ge_beam3_p5_centered/codec.py b/src/anyfesolver/_ge_beam3_p5_centered/codec.py similarity index 96% rename from src/anysolver/_ge_beam3_p5_centered/codec.py rename to src/anyfesolver/_ge_beam3_p5_centered/codec.py index 1dd1ded29..5436d3022 100644 --- a/src/anysolver/_ge_beam3_p5_centered/codec.py +++ b/src/anyfesolver/_ge_beam3_p5_centered/codec.py @@ -6,8 +6,8 @@ import json -from anysolver._ge_beam3_p5_centered.core import canonical, NativeMaterialError -from anysolver._ge_beam3_p5 import typed_schema as schema_source +from anyfesolver._ge_beam3_p5_centered.core import canonical, NativeMaterialError +from anyfesolver._ge_beam3_p5 import typed_schema as schema_source SCHEMA='GE_BEAM3_P5_CENTERED_TYPED_STATE_JSON_V3' diff --git a/src/anysolver/_ge_beam3_p5_centered/committed_modal.py b/src/anyfesolver/_ge_beam3_p5_centered/committed_modal.py similarity index 94% rename from src/anysolver/_ge_beam3_p5_centered/committed_modal.py rename to src/anyfesolver/_ge_beam3_p5_centered/committed_modal.py index ece1b5b06..8560ae9e4 100644 --- a/src/anysolver/_ge_beam3_p5_centered/committed_modal.py +++ b/src/anyfesolver/_ge_beam3_p5_centered/committed_modal.py @@ -10,14 +10,14 @@ import numpy as np from scipy import sparse -from anysolver._native_reference_modal import _owned -from anysolver._native_stationary_spectrum import solve_stationary_spectrum -from anysolver.assembly import build_constraint_transformation -from anysolver.control import cancellation_safe_point -from anysolver.nonlinear_state import create_model_native_rotation_store -from anysolver._ge_beam3_p5_centered.reference_modal import prepare as prepare_reference -from anysolver._ge_beam3_p5_centered.core import sha -from anysolver._ge_beam3_centered_mixed import CenteredStationaryBeam as CompensatedStationaryBeam +from anyfesolver._native_reference_modal import _owned +from anyfesolver._native_stationary_spectrum import solve_stationary_spectrum +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.control import cancellation_safe_point +from anyfesolver.nonlinear_state import create_model_native_rotation_store +from anyfesolver._ge_beam3_p5_centered.reference_modal import prepare as prepare_reference +from anyfesolver._ge_beam3_p5_centered.core import sha +from anyfesolver._ge_beam3_centered_mixed import CenteredStationaryBeam as CompensatedStationaryBeam from .positions import validate_total_pair, rest_mass diff --git a/src/anysolver/_ge_beam3_p5_centered/core.py b/src/anyfesolver/_ge_beam3_p5_centered/core.py similarity index 94% rename from src/anysolver/_ge_beam3_p5_centered/core.py rename to src/anyfesolver/_ge_beam3_p5_centered/core.py index 6d6855d8a..d1eec7c65 100644 --- a/src/anysolver/_ge_beam3_p5_centered/core.py +++ b/src/anyfesolver/_ge_beam3_p5_centered/core.py @@ -9,13 +9,13 @@ import hashlib import json import numpy as np -from anysolver.elements import Element -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as CurvedBeam3ReferenceGeometry -from anysolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry as HistoricalReferenceGeometry -from anysolver._ge_beam3_centered_mixed import CenteredStationaryBeam as CompensatedStationaryBeam -from anysolver._ge_beam3_p5.arrays import _array, _frames -from anysolver._ge_beam3_p5.mixed import LocalForceAccuracy -from anysolver._ge_beam3_p5.section import DirectedHardeningSection, SectionHistory, _history +from anyfesolver.elements import Element +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as CurvedBeam3ReferenceGeometry +from anyfesolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry as HistoricalReferenceGeometry +from anyfesolver._ge_beam3_centered_mixed import CenteredStationaryBeam as CompensatedStationaryBeam +from anyfesolver._ge_beam3_p5.arrays import _array, _frames +from anyfesolver._ge_beam3_p5.mixed import LocalForceAccuracy +from anyfesolver._ge_beam3_p5.section import DirectedHardeningSection, SectionHistory, _history from .positions import POLICY, from_total, validate_total_pair SCHEMA='GE_BEAM3_P5_CENTERED_STATION_STATE_V3' diff --git a/src/anysolver/_ge_beam3_p5_centered/element.py b/src/anyfesolver/_ge_beam3_p5_centered/element.py similarity index 97% rename from src/anysolver/_ge_beam3_p5_centered/element.py rename to src/anyfesolver/_ge_beam3_p5_centered/element.py index 3a0369be8..97f648df4 100644 --- a/src/anysolver/_ge_beam3_p5_centered/element.py +++ b/src/anyfesolver/_ge_beam3_p5_centered/element.py @@ -8,14 +8,14 @@ import numpy as np -from anysolver.elements import Element -from anysolver._native_material_protocol import PROTOCOL, NativeMaterialContext, NativeMaterialValidator -from anysolver._ge_beam3_p5_centered.core import ( +from anyfesolver.elements import Element +from anyfesolver._native_material_protocol import PROTOCOL, NativeMaterialContext, NativeMaterialValidator +from anyfesolver._ge_beam3_p5_centered.core import ( StationaryCore, NativeMaterialError, sha, seal, ) -from anysolver._ge_beam3_p5.chart import pullback -from anysolver._ge_beam3_p5.arrays import _array, _readonly -from anysolver._ge_beam3_p5_centered import codec as codec +from anyfesolver._ge_beam3_p5.chart import pullback +from anyfesolver._ge_beam3_p5.arrays import _array, _readonly +from anyfesolver._ge_beam3_p5_centered import codec as codec from .positions import POLICY, from_total, station_position diff --git a/src/anysolver/_ge_beam3_p5_centered/mass.py b/src/anyfesolver/_ge_beam3_p5_centered/mass.py similarity index 92% rename from src/anysolver/_ge_beam3_p5_centered/mass.py rename to src/anyfesolver/_ge_beam3_p5_centered/mass.py index 5e4d2946c..8c8be6187 100644 --- a/src/anysolver/_ge_beam3_p5_centered/mass.py +++ b/src/anyfesolver/_ge_beam3_p5_centered/mass.py @@ -8,11 +8,11 @@ import numpy as np -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry -from anysolver._ge_beam3_p5.algebra import HALVES, metrics, skew, validate_section -from anysolver._ge_beam3_p5.arrays import _array, _readonly -from anysolver._ge_beam3_p5.compensated_coordinates import validate_pair, split_sum -from anysolver._ge_beam3_p5.inertia import LiftedInertia +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry +from anyfesolver._ge_beam3_p5.algebra import HALVES, metrics, skew, validate_section +from anyfesolver._ge_beam3_p5.arrays import _array, _readonly +from anyfesolver._ge_beam3_p5.compensated_coordinates import validate_pair, split_sum +from anyfesolver._ge_beam3_p5.inertia import LiftedInertia def _reference(reference, order): diff --git a/src/anysolver/_ge_beam3_p5_centered/positions.py b/src/anyfesolver/_ge_beam3_p5_centered/positions.py similarity index 88% rename from src/anysolver/_ge_beam3_p5_centered/positions.py rename to src/anyfesolver/_ge_beam3_p5_centered/positions.py index 083e756cd..c526a47a6 100644 --- a/src/anysolver/_ge_beam3_p5_centered/positions.py +++ b/src/anyfesolver/_ge_beam3_p5_centered/positions.py @@ -3,11 +3,11 @@ from fractions import Fraction as F import numpy as np -from anysolver._ge_beam3_p5_coordinates.positions import ( +from anyfesolver._ge_beam3_p5_coordinates.positions import ( POLICY, from_total, validate_total_pair, _rounded_pair, ) -from anysolver._ge_beam3_p5.arrays import _array, _frames, _readonly -from anysolver._ge_beam3_p5.compensated_coordinates import validate_pair +from anyfesolver._ge_beam3_p5.arrays import _array, _frames, _readonly +from anyfesolver._ge_beam3_p5.compensated_coordinates import validate_pair from .mass import current_rest_mass as rest_mass diff --git a/src/anysolver/_ge_beam3_p5_centered/reference_modal.py b/src/anyfesolver/_ge_beam3_p5_centered/reference_modal.py similarity index 91% rename from src/anysolver/_ge_beam3_p5_centered/reference_modal.py rename to src/anyfesolver/_ge_beam3_p5_centered/reference_modal.py index 93b40bf21..c62f45e05 100644 --- a/src/anysolver/_ge_beam3_p5_centered/reference_modal.py +++ b/src/anyfesolver/_ge_beam3_p5_centered/reference_modal.py @@ -6,12 +6,12 @@ import numpy as np -from anysolver._native_reference_modal import ReferenceModalBlock, solve_reference_modal -from anysolver.control import cancellation_safe_point -from anysolver._ge_beam3_p5_centered.element import NativeP5BeamElement -from anysolver._ge_beam3_p5_centered.core import sha +from anyfesolver._native_reference_modal import ReferenceModalBlock, solve_reference_modal +from anyfesolver.control import cancellation_safe_point +from anyfesolver._ge_beam3_p5_centered.element import NativeP5BeamElement +from anyfesolver._ge_beam3_p5_centered.core import sha from .mass import reference_kinetic_factors -from anysolver._ge_beam3_p5.algebra import validate_section +from anyfesolver._ge_beam3_p5.algebra import validate_section def prepare(model, section_inertias, *, cancellation_token=None): diff --git a/src/anysolver/_ge_beam3_p5_coordinates/__init__.py b/src/anyfesolver/_ge_beam3_p5_coordinates/__init__.py similarity index 72% rename from src/anysolver/_ge_beam3_p5_coordinates/__init__.py rename to src/anyfesolver/_ge_beam3_p5_coordinates/__init__.py index b62788399..70aff1365 100644 --- a/src/anysolver/_ge_beam3_p5_coordinates/__init__.py +++ b/src/anyfesolver/_ge_beam3_p5_coordinates/__init__.py @@ -1,6 +1,6 @@ """Private coordinate-state P5 successor; not a public element selector.""" -from anysolver._ge_beam3_p5.section import DirectedHardeningSection +from anyfesolver._ge_beam3_p5.section import DirectedHardeningSection from .element import NativeP5BeamElement __all__ = ['NativeP5BeamElement', 'DirectedHardeningSection'] diff --git a/src/anysolver/_ge_beam3_p5_coordinates/codec.py b/src/anyfesolver/_ge_beam3_p5_coordinates/codec.py similarity index 96% rename from src/anysolver/_ge_beam3_p5_coordinates/codec.py rename to src/anyfesolver/_ge_beam3_p5_coordinates/codec.py index ce270daf3..aa164dea2 100644 --- a/src/anysolver/_ge_beam3_p5_coordinates/codec.py +++ b/src/anyfesolver/_ge_beam3_p5_coordinates/codec.py @@ -6,8 +6,8 @@ import json -from anysolver._ge_beam3_p5_coordinates.core import canonical, NativeMaterialError -from anysolver._ge_beam3_p5 import typed_schema as schema_source +from anyfesolver._ge_beam3_p5_coordinates.core import canonical, NativeMaterialError +from anyfesolver._ge_beam3_p5 import typed_schema as schema_source SCHEMA='GE_BEAM3_P5_COORDINATE_TYPED_STATE_JSON_V2' diff --git a/src/anysolver/_ge_beam3_p5_coordinates/committed_modal.py b/src/anyfesolver/_ge_beam3_p5_coordinates/committed_modal.py similarity index 94% rename from src/anysolver/_ge_beam3_p5_coordinates/committed_modal.py rename to src/anyfesolver/_ge_beam3_p5_coordinates/committed_modal.py index 284ee0c42..4289bbeb3 100644 --- a/src/anysolver/_ge_beam3_p5_coordinates/committed_modal.py +++ b/src/anyfesolver/_ge_beam3_p5_coordinates/committed_modal.py @@ -10,14 +10,14 @@ import numpy as np from scipy import sparse -from anysolver._native_reference_modal import _owned -from anysolver._native_stationary_spectrum import solve_stationary_spectrum -from anysolver.assembly import build_constraint_transformation -from anysolver.control import cancellation_safe_point -from anysolver.nonlinear_state import create_model_native_rotation_store -from anysolver._ge_beam3_p5_coordinates.reference_modal import prepare as prepare_reference -from anysolver._ge_beam3_p5_coordinates.core import sha -from anysolver._ge_beam3_p5.compensated import CompensatedStationaryBeam +from anyfesolver._native_reference_modal import _owned +from anyfesolver._native_stationary_spectrum import solve_stationary_spectrum +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.control import cancellation_safe_point +from anyfesolver.nonlinear_state import create_model_native_rotation_store +from anyfesolver._ge_beam3_p5_coordinates.reference_modal import prepare as prepare_reference +from anyfesolver._ge_beam3_p5_coordinates.core import sha +from anyfesolver._ge_beam3_p5.compensated import CompensatedStationaryBeam from .positions import validate_total_pair, rest_mass diff --git a/src/anysolver/_ge_beam3_p5_coordinates/core.py b/src/anyfesolver/_ge_beam3_p5_coordinates/core.py similarity index 95% rename from src/anysolver/_ge_beam3_p5_coordinates/core.py rename to src/anyfesolver/_ge_beam3_p5_coordinates/core.py index 4f85da373..4f68f6033 100644 --- a/src/anysolver/_ge_beam3_p5_coordinates/core.py +++ b/src/anyfesolver/_ge_beam3_p5_coordinates/core.py @@ -9,12 +9,12 @@ import hashlib import json import numpy as np -from anysolver.elements import Element -from anysolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry -from anysolver._ge_beam3_p5.compensated import CompensatedStationaryBeam -from anysolver._ge_beam3_p5.arrays import _array, _frames -from anysolver._ge_beam3_p5.mixed import LocalForceAccuracy -from anysolver._ge_beam3_p5.section import DirectedHardeningSection, SectionHistory, _history +from anyfesolver.elements import Element +from anyfesolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry +from anyfesolver._ge_beam3_p5.compensated import CompensatedStationaryBeam +from anyfesolver._ge_beam3_p5.arrays import _array, _frames +from anyfesolver._ge_beam3_p5.mixed import LocalForceAccuracy +from anyfesolver._ge_beam3_p5.section import DirectedHardeningSection, SectionHistory, _history from .positions import POLICY, from_total, validate_total_pair SCHEMA='GE_BEAM3_P5_COORDINATE_STATION_STATE_V2' diff --git a/src/anysolver/_ge_beam3_p5_coordinates/element.py b/src/anyfesolver/_ge_beam3_p5_coordinates/element.py similarity index 97% rename from src/anysolver/_ge_beam3_p5_coordinates/element.py rename to src/anyfesolver/_ge_beam3_p5_coordinates/element.py index 1499c94e6..462830192 100644 --- a/src/anysolver/_ge_beam3_p5_coordinates/element.py +++ b/src/anyfesolver/_ge_beam3_p5_coordinates/element.py @@ -8,14 +8,14 @@ import numpy as np -from anysolver.elements import Element -from anysolver._native_material_protocol import PROTOCOL, NativeMaterialContext, NativeMaterialValidator -from anysolver._ge_beam3_p5_coordinates.core import ( +from anyfesolver.elements import Element +from anyfesolver._native_material_protocol import PROTOCOL, NativeMaterialContext, NativeMaterialValidator +from anyfesolver._ge_beam3_p5_coordinates.core import ( StationaryCore, NativeMaterialError, sha, seal, ) -from anysolver._ge_beam3_p5.chart import pullback -from anysolver._ge_beam3_p5.arrays import _array, _readonly -from anysolver._ge_beam3_p5_coordinates import codec as codec +from anyfesolver._ge_beam3_p5.chart import pullback +from anyfesolver._ge_beam3_p5.arrays import _array, _readonly +from anyfesolver._ge_beam3_p5_coordinates import codec as codec from .positions import POLICY, from_total, station_position diff --git a/src/anysolver/_ge_beam3_p5_coordinates/positions.py b/src/anyfesolver/_ge_beam3_p5_coordinates/positions.py similarity index 95% rename from src/anysolver/_ge_beam3_p5_coordinates/positions.py rename to src/anyfesolver/_ge_beam3_p5_coordinates/positions.py index f1490b4c8..758cdb28e 100644 --- a/src/anysolver/_ge_beam3_p5_coordinates/positions.py +++ b/src/anyfesolver/_ge_beam3_p5_coordinates/positions.py @@ -10,9 +10,9 @@ import numpy as np -from anysolver._ge_beam3_p5.arrays import _array, _frames, _readonly -from anysolver._ge_beam3_p5.compensated_coordinates import split_sum, validate_pair -from anysolver._ge_beam3_p5.inertia import LiftedInertia +from anyfesolver._ge_beam3_p5.arrays import _array, _frames, _readonly +from anyfesolver._ge_beam3_p5.compensated_coordinates import split_sum, validate_pair +from anyfesolver._ge_beam3_p5.inertia import LiftedInertia POLICY = 'GE_BEAM3_P5_REFERENCE_PLUS_TOTAL_TWO_COMPONENT_V1' diff --git a/src/anysolver/_ge_beam3_p5_coordinates/reference_modal.py b/src/anyfesolver/_ge_beam3_p5_coordinates/reference_modal.py similarity index 89% rename from src/anysolver/_ge_beam3_p5_coordinates/reference_modal.py rename to src/anyfesolver/_ge_beam3_p5_coordinates/reference_modal.py index 092b6da47..1946e5053 100644 --- a/src/anysolver/_ge_beam3_p5_coordinates/reference_modal.py +++ b/src/anyfesolver/_ge_beam3_p5_coordinates/reference_modal.py @@ -6,12 +6,12 @@ import numpy as np -from anysolver._native_reference_modal import ReferenceModalBlock, solve_reference_modal -from anysolver.control import cancellation_safe_point -from anysolver._ge_beam3_p5_coordinates.element import NativeP5BeamElement -from anysolver._ge_beam3_p5_coordinates.core import sha -from anysolver._ge_beam3_p5.mass import reference_kinetic_factors -from anysolver._ge_beam3_p5.algebra import validate_section +from anyfesolver._native_reference_modal import ReferenceModalBlock, solve_reference_modal +from anyfesolver.control import cancellation_safe_point +from anyfesolver._ge_beam3_p5_coordinates.element import NativeP5BeamElement +from anyfesolver._ge_beam3_p5_coordinates.core import sha +from anyfesolver._ge_beam3_p5.mass import reference_kinetic_factors +from anyfesolver._ge_beam3_p5.algebra import validate_section def prepare(model, section_inertias, *, cancellation_token=None): diff --git a/src/anysolver/_ge_beam3_p5_loads/__init__.py b/src/anyfesolver/_ge_beam3_p5_loads/__init__.py similarity index 77% rename from src/anysolver/_ge_beam3_p5_loads/__init__.py rename to src/anyfesolver/_ge_beam3_p5_loads/__init__.py index 0089f0bf7..4e47497e8 100644 --- a/src/anysolver/_ge_beam3_p5_loads/__init__.py +++ b/src/anyfesolver/_ge_beam3_p5_loads/__init__.py @@ -1,6 +1,6 @@ """Private parameter-aware native candidate; no public selector authority.""" -from anysolver._ge_beam3_p5.section import DirectedHardeningSection +from anyfesolver._ge_beam3_p5.section import DirectedHardeningSection from .state import LoadStateStore from .element import NativeP5BeamElement diff --git a/src/anysolver/_ge_beam3_p5_loads/codec.py b/src/anyfesolver/_ge_beam3_p5_loads/codec.py similarity index 96% rename from src/anysolver/_ge_beam3_p5_loads/codec.py rename to src/anyfesolver/_ge_beam3_p5_loads/codec.py index f4765be8f..b9ba92a4f 100644 --- a/src/anysolver/_ge_beam3_p5_loads/codec.py +++ b/src/anyfesolver/_ge_beam3_p5_loads/codec.py @@ -6,8 +6,8 @@ import json -from anysolver._ge_beam3_p5_loads.core import canonical, NativeMaterialError -from anysolver._ge_beam3_p5 import typed_schema as schema_source +from anyfesolver._ge_beam3_p5_loads.core import canonical, NativeMaterialError +from anyfesolver._ge_beam3_p5 import typed_schema as schema_source SCHEMA='GE_BEAM3_P5_LOAD_TYPED_STATE_JSON_V4' diff --git a/src/anysolver/_ge_beam3_p5_loads/core.py b/src/anyfesolver/_ge_beam3_p5_loads/core.py similarity index 94% rename from src/anysolver/_ge_beam3_p5_loads/core.py rename to src/anyfesolver/_ge_beam3_p5_loads/core.py index 94fec3303..8800603af 100644 --- a/src/anysolver/_ge_beam3_p5_loads/core.py +++ b/src/anyfesolver/_ge_beam3_p5_loads/core.py @@ -9,14 +9,14 @@ import hashlib import json import numpy as np -from anysolver.elements import Element -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as CurvedBeam3ReferenceGeometry -from anysolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry as HistoricalReferenceGeometry -from anysolver._ge_beam3_centered_mixed import CenteredStationaryBeam as CompensatedStationaryBeam -from anysolver._ge_beam3_p5.arrays import _array, _frames -from anysolver._ge_beam3_p5.mixed import LocalForceAccuracy -from anysolver._ge_beam3_p5.section import DirectedHardeningSection, SectionHistory, _history -from anysolver._ge_beam3_p5_centered.positions import POLICY, from_total, validate_total_pair +from anyfesolver.elements import Element +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as CurvedBeam3ReferenceGeometry +from anyfesolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry as HistoricalReferenceGeometry +from anyfesolver._ge_beam3_centered_mixed import CenteredStationaryBeam as CompensatedStationaryBeam +from anyfesolver._ge_beam3_p5.arrays import _array, _frames +from anyfesolver._ge_beam3_p5.mixed import LocalForceAccuracy +from anyfesolver._ge_beam3_p5.section import DirectedHardeningSection, SectionHistory, _history +from anyfesolver._ge_beam3_p5_centered.positions import POLICY, from_total, validate_total_pair from .state import LOAD_POLICY, parameter_value SCHEMA='GE_BEAM3_P5_LOAD_STATION_STATE_V4' diff --git a/src/anysolver/_ge_beam3_p5_loads/element.py b/src/anyfesolver/_ge_beam3_p5_loads/element.py similarity index 96% rename from src/anysolver/_ge_beam3_p5_loads/element.py rename to src/anyfesolver/_ge_beam3_p5_loads/element.py index 2779583d7..40c985194 100644 --- a/src/anysolver/_ge_beam3_p5_loads/element.py +++ b/src/anyfesolver/_ge_beam3_p5_loads/element.py @@ -8,15 +8,15 @@ import numpy as np -from anysolver.elements import Element -from anysolver._native_material_protocol import PROTOCOL, NativeMaterialContext, NativeMaterialValidator -from anysolver._ge_beam3_p5_loads.core import ( +from anyfesolver.elements import Element +from anyfesolver._native_material_protocol import PROTOCOL, NativeMaterialContext, NativeMaterialValidator +from anyfesolver._ge_beam3_p5_loads.core import ( StationaryCore, NativeMaterialError, sha, seal, ) -from anysolver._ge_beam3_p5.chart import pullback -from anysolver._ge_beam3_p5.arrays import _array, _readonly -from anysolver._ge_beam3_p5_loads import codec as codec -from anysolver._ge_beam3_p5_centered.positions import POLICY, from_total, station_position +from anyfesolver._ge_beam3_p5.chart import pullback +from anyfesolver._ge_beam3_p5.arrays import _array, _readonly +from anyfesolver._ge_beam3_p5_loads import codec as codec +from anyfesolver._ge_beam3_p5_centered.positions import POLICY, from_total, station_position from .state import LOAD_POLICY, LoadStateStore @@ -221,7 +221,7 @@ def native_load_parameter_derivative(self, mesh, state, *, native_rotation_trial or inner['origins']!=previous['histories']): raise NativeMaterialError('load derivative state is not this trial candidate') spatial,work=self.core._load_parameter_derivative(inner) - from anysolver._ge_beam3_p5.chart import exp_chart_terms + from anyfesolver._ge_beam3_p5.chart import exp_chart_terms result=spatial.copy() for node,increment in enumerate(view.rotation_coordinate_increment): slot=slice(6*node+3,6*node+6) diff --git a/src/anysolver/_ge_beam3_p5_loads/state.py b/src/anyfesolver/_ge_beam3_p5_loads/state.py similarity index 98% rename from src/anysolver/_ge_beam3_p5_loads/state.py rename to src/anyfesolver/_ge_beam3_p5_loads/state.py index b977732ed..be8b30d02 100644 --- a/src/anysolver/_ge_beam3_p5_loads/state.py +++ b/src/anyfesolver/_ge_beam3_p5_loads/state.py @@ -9,7 +9,7 @@ import math import threading -from anysolver.nonlinear_state import NonlinearStateStore, StateTransactionError +from anyfesolver.nonlinear_state import NonlinearStateStore, StateTransactionError LOAD_POLICY = 'SPATIAL_DEAD_FORCE_PER_REFERENCE_ARCLENGTH_V1' diff --git a/src/anysolver/_ge_beam3_p5_loads/work.py b/src/anyfesolver/_ge_beam3_p5_loads/work.py similarity index 88% rename from src/anysolver/_ge_beam3_p5_loads/work.py rename to src/anyfesolver/_ge_beam3_p5_loads/work.py index 5bfebbfa2..bd79fcf2d 100644 --- a/src/anysolver/_ge_beam3_p5_loads/work.py +++ b/src/anyfesolver/_ge_beam3_p5_loads/work.py @@ -4,10 +4,10 @@ """ from dataclasses import dataclass import numpy as np -from anysolver._ge_beam3_p5.arrays import _array, _readonly, _frames -from anysolver._ge_beam3_p5.compensated_coordinates import split_sum, validate_pair -from anysolver._ge_beam3_p5.compensated import sum_jets -from anysolver._ge_beam3_mixed_ad import Jet2, so3_exp, matmul, constant_matrix +from anyfesolver._ge_beam3_p5.arrays import _array, _readonly, _frames +from anyfesolver._ge_beam3_p5.compensated_coordinates import split_sum, validate_pair +from anyfesolver._ge_beam3_p5.compensated import sum_jets +from anyfesolver._ge_beam3_mixed_ad import Jet2, so3_exp, matmul, constant_matrix @dataclass(frozen=True) class AugmentedWork: diff --git a/src/anysolver/_ge_beam3_p5_seeded/__init__.py b/src/anyfesolver/_ge_beam3_p5_seeded/__init__.py similarity index 84% rename from src/anysolver/_ge_beam3_p5_seeded/__init__.py rename to src/anyfesolver/_ge_beam3_p5_seeded/__init__.py index 2def392eb..856ea390f 100644 --- a/src/anysolver/_ge_beam3_p5_seeded/__init__.py +++ b/src/anyfesolver/_ge_beam3_p5_seeded/__init__.py @@ -2,7 +2,7 @@ # remain unchanged; authoritative operator seeding is bound by the V5 core. """Private parameter-aware native candidate; no public selector authority.""" -from anysolver._ge_beam3_p5.section import DirectedHardeningSection +from anyfesolver._ge_beam3_p5.section import DirectedHardeningSection from .state import LoadStateStore from .element import NativeP5BeamElement diff --git a/src/anysolver/_ge_beam3_p5_seeded/codec.py b/src/anyfesolver/_ge_beam3_p5_seeded/codec.py similarity index 96% rename from src/anysolver/_ge_beam3_p5_seeded/codec.py rename to src/anyfesolver/_ge_beam3_p5_seeded/codec.py index c735f7d2d..cd781f678 100644 --- a/src/anysolver/_ge_beam3_p5_seeded/codec.py +++ b/src/anyfesolver/_ge_beam3_p5_seeded/codec.py @@ -8,8 +8,8 @@ import json -from anysolver._ge_beam3_p5_seeded.core import canonical, NativeMaterialError -from anysolver._ge_beam3_p5 import typed_schema as schema_source +from anyfesolver._ge_beam3_p5_seeded.core import canonical, NativeMaterialError +from anyfesolver._ge_beam3_p5 import typed_schema as schema_source SCHEMA='GE_BEAM3_P5_LOAD_TYPED_STATE_JSON_V5' diff --git a/src/anysolver/_ge_beam3_p5_seeded/core.py b/src/anyfesolver/_ge_beam3_p5_seeded/core.py similarity index 93% rename from src/anysolver/_ge_beam3_p5_seeded/core.py rename to src/anyfesolver/_ge_beam3_p5_seeded/core.py index 9fcf48ac8..e02404af3 100644 --- a/src/anysolver/_ge_beam3_p5_seeded/core.py +++ b/src/anyfesolver/_ge_beam3_p5_seeded/core.py @@ -11,17 +11,17 @@ import hashlib import json import numpy as np -from anysolver.elements import Element -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as CurvedBeam3ReferenceGeometry -from anysolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry as HistoricalReferenceGeometry -from anysolver._ge_beam3_centered_mixed import CenteredStationaryBeam as CompensatedStationaryBeam -from anysolver._ge_beam3_p5.arrays import _array, _frames -from anysolver._ge_beam3_p5.mixed import LocalForceAccuracy -from anysolver._ge_beam3_p5.section import DirectedHardeningSection, SectionHistory, _history -from anysolver._ge_beam3_p5_centered.positions import POLICY, from_total, validate_total_pair +from anyfesolver.elements import Element +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as CurvedBeam3ReferenceGeometry +from anyfesolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry as HistoricalReferenceGeometry +from anyfesolver._ge_beam3_centered_mixed import CenteredStationaryBeam as CompensatedStationaryBeam +from anyfesolver._ge_beam3_p5.arrays import _array, _frames +from anyfesolver._ge_beam3_p5.mixed import LocalForceAccuracy +from anyfesolver._ge_beam3_p5.section import DirectedHardeningSection, SectionHistory, _history +from anyfesolver._ge_beam3_p5_centered.positions import POLICY, from_total, validate_total_pair from .state import LOAD_POLICY, parameter_value -from anysolver._ge_beam3_authoritative_cell_seed import cell_initial_rotations, POLICY as SEED_POLICY +from anyfesolver._ge_beam3_authoritative_cell_seed import cell_initial_rotations, POLICY as SEED_POLICY SCHEMA='GE_BEAM3_P5_LOAD_STATION_STATE_V5' diff --git a/src/anysolver/_ge_beam3_p5_seeded/element.py b/src/anyfesolver/_ge_beam3_p5_seeded/element.py similarity index 96% rename from src/anysolver/_ge_beam3_p5_seeded/element.py rename to src/anyfesolver/_ge_beam3_p5_seeded/element.py index 5cf13121f..37bfebcd0 100644 --- a/src/anysolver/_ge_beam3_p5_seeded/element.py +++ b/src/anyfesolver/_ge_beam3_p5_seeded/element.py @@ -10,15 +10,15 @@ import numpy as np -from anysolver.elements import Element -from anysolver._native_material_protocol import PROTOCOL, NativeMaterialContext, NativeMaterialValidator -from anysolver._ge_beam3_p5_seeded.core import ( +from anyfesolver.elements import Element +from anyfesolver._native_material_protocol import PROTOCOL, NativeMaterialContext, NativeMaterialValidator +from anyfesolver._ge_beam3_p5_seeded.core import ( StationaryCore, NativeMaterialError, sha, seal, ) -from anysolver._ge_beam3_p5.chart import pullback -from anysolver._ge_beam3_p5.arrays import _array, _readonly -from anysolver._ge_beam3_p5_seeded import codec as codec -from anysolver._ge_beam3_p5_centered.positions import POLICY, from_total, station_position +from anyfesolver._ge_beam3_p5.chart import pullback +from anyfesolver._ge_beam3_p5.arrays import _array, _readonly +from anyfesolver._ge_beam3_p5_seeded import codec as codec +from anyfesolver._ge_beam3_p5_centered.positions import POLICY, from_total, station_position from .state import LOAD_POLICY, LoadStateStore @@ -223,7 +223,7 @@ def native_load_parameter_derivative(self, mesh, state, *, native_rotation_trial or inner['origins']!=previous['histories']): raise NativeMaterialError('load derivative state is not this trial candidate') spatial,work=self.core._load_parameter_derivative(inner) - from anysolver._ge_beam3_p5.chart import exp_chart_terms + from anyfesolver._ge_beam3_p5.chart import exp_chart_terms result=spatial.copy() for node,increment in enumerate(view.rotation_coordinate_increment): slot=slice(6*node+3,6*node+6) diff --git a/src/anysolver/_ge_beam3_p5_seeded/state.py b/src/anyfesolver/_ge_beam3_p5_seeded/state.py similarity index 98% rename from src/anysolver/_ge_beam3_p5_seeded/state.py rename to src/anyfesolver/_ge_beam3_p5_seeded/state.py index 5d6902e9b..e89d38246 100644 --- a/src/anysolver/_ge_beam3_p5_seeded/state.py +++ b/src/anyfesolver/_ge_beam3_p5_seeded/state.py @@ -11,7 +11,7 @@ import math import threading -from anysolver.nonlinear_state import NonlinearStateStore, StateTransactionError +from anyfesolver.nonlinear_state import NonlinearStateStore, StateTransactionError LOAD_POLICY = 'SPATIAL_DEAD_FORCE_PER_REFERENCE_ARCLENGTH_V1' diff --git a/src/anysolver/_ge_beam3_p5_seeded/work.py b/src/anyfesolver/_ge_beam3_p5_seeded/work.py similarity index 88% rename from src/anysolver/_ge_beam3_p5_seeded/work.py rename to src/anyfesolver/_ge_beam3_p5_seeded/work.py index 517333a08..d88bd6be9 100644 --- a/src/anysolver/_ge_beam3_p5_seeded/work.py +++ b/src/anyfesolver/_ge_beam3_p5_seeded/work.py @@ -6,10 +6,10 @@ """ from dataclasses import dataclass import numpy as np -from anysolver._ge_beam3_p5.arrays import _array, _readonly, _frames -from anysolver._ge_beam3_p5.compensated_coordinates import split_sum, validate_pair -from anysolver._ge_beam3_p5.compensated import sum_jets -from anysolver._ge_beam3_mixed_ad import Jet2, so3_exp, matmul, constant_matrix +from anyfesolver._ge_beam3_p5.arrays import _array, _readonly, _frames +from anyfesolver._ge_beam3_p5.compensated_coordinates import split_sum, validate_pair +from anyfesolver._ge_beam3_p5.compensated import sum_jets +from anyfesolver._ge_beam3_mixed_ad import Jet2, so3_exp, matmul, constant_matrix @dataclass(frozen=True) class AugmentedWork: diff --git a/src/anysolver/_ge_beam3_pose_joint.py b/src/anyfesolver/_ge_beam3_pose_joint.py similarity index 100% rename from src/anysolver/_ge_beam3_pose_joint.py rename to src/anyfesolver/_ge_beam3_pose_joint.py diff --git a/src/anysolver/_ge_beam3_precise_geometric_work.py b/src/anyfesolver/_ge_beam3_precise_geometric_work.py similarity index 100% rename from src/anysolver/_ge_beam3_precise_geometric_work.py rename to src/anyfesolver/_ge_beam3_precise_geometric_work.py diff --git a/src/anysolver/_ge_beam3_reassembled_signed_modes.py b/src/anyfesolver/_ge_beam3_reassembled_signed_modes.py similarity index 100% rename from src/anysolver/_ge_beam3_reassembled_signed_modes.py rename to src/anyfesolver/_ge_beam3_reassembled_signed_modes.py diff --git a/src/anysolver/_ge_beam3_reference_identity.py b/src/anyfesolver/_ge_beam3_reference_identity.py similarity index 100% rename from src/anysolver/_ge_beam3_reference_identity.py rename to src/anyfesolver/_ge_beam3_reference_identity.py diff --git a/src/anysolver/_ge_beam3_refined_fibre_schur_solver.py b/src/anyfesolver/_ge_beam3_refined_fibre_schur_solver.py similarity index 100% rename from src/anysolver/_ge_beam3_refined_fibre_schur_solver.py rename to src/anyfesolver/_ge_beam3_refined_fibre_schur_solver.py diff --git a/src/anysolver/_ge_beam3_refinement_capacity.py b/src/anyfesolver/_ge_beam3_refinement_capacity.py similarity index 100% rename from src/anysolver/_ge_beam3_refinement_capacity.py rename to src/anyfesolver/_ge_beam3_refinement_capacity.py diff --git a/src/anysolver/_ge_beam3_relative_virgin_reference_modes.py b/src/anyfesolver/_ge_beam3_relative_virgin_reference_modes.py similarity index 100% rename from src/anysolver/_ge_beam3_relative_virgin_reference_modes.py rename to src/anyfesolver/_ge_beam3_relative_virgin_reference_modes.py diff --git a/src/anysolver/_ge_beam3_retained_arc.py b/src/anyfesolver/_ge_beam3_retained_arc.py similarity index 100% rename from src/anysolver/_ge_beam3_retained_arc.py rename to src/anyfesolver/_ge_beam3_retained_arc.py diff --git a/src/anysolver/_ge_beam3_retained_arc_geometry.py b/src/anyfesolver/_ge_beam3_retained_arc_geometry.py similarity index 100% rename from src/anysolver/_ge_beam3_retained_arc_geometry.py rename to src/anyfesolver/_ge_beam3_retained_arc_geometry.py diff --git a/src/anysolver/_ge_beam3_retained_arc_modal.py b/src/anyfesolver/_ge_beam3_retained_arc_modal.py similarity index 100% rename from src/anysolver/_ge_beam3_retained_arc_modal.py rename to src/anyfesolver/_ge_beam3_retained_arc_modal.py diff --git a/src/anysolver/_ge_beam3_retained_elastic.py b/src/anyfesolver/_ge_beam3_retained_elastic.py similarity index 95% rename from src/anysolver/_ge_beam3_retained_elastic.py rename to src/anyfesolver/_ge_beam3_retained_elastic.py index 1e0eec116..bb417532e 100644 --- a/src/anysolver/_ge_beam3_retained_elastic.py +++ b/src/anyfesolver/_ge_beam3_retained_elastic.py @@ -8,14 +8,14 @@ from dataclasses import dataclass from math import fsum import numpy as np -from anysolver._ge_beam3_centered_mixed import CenteredStationaryBeam -from anysolver._ge_beam3_mixed_ad import ( +from anyfesolver._ge_beam3_centered_mixed import CenteredStationaryBeam +from anyfesolver._ge_beam3_mixed_ad import ( Jet2, constant_matrix, matmul, transpose, so3_exp, so3_log, ) -from anysolver._ge_beam3_p5.compensated import compensated_strain -from anysolver._ge_beam3_p5.algebra import HALVES -from anysolver._ge_beam3_p5.arrays import _array, _frames -from anysolver._native_reference_modal import _owned as _readonly +from anyfesolver._ge_beam3_p5.compensated import compensated_strain +from anyfesolver._ge_beam3_p5.algebra import HALVES +from anyfesolver._ge_beam3_p5.arrays import _array, _frames +from anyfesolver._native_reference_modal import _owned as _readonly POLICY = 'CANDIDATE_GE_BEAM3_RETAINED_ELASTIC_V1' diff --git a/src/anysolver/_ge_beam3_retained_fibre.py b/src/anyfesolver/_ge_beam3_retained_fibre.py similarity index 98% rename from src/anysolver/_ge_beam3_retained_fibre.py rename to src/anyfesolver/_ge_beam3_retained_fibre.py index 8c6e6cd65..37a740ecb 100644 --- a/src/anysolver/_ge_beam3_retained_fibre.py +++ b/src/anyfesolver/_ge_beam3_retained_fibre.py @@ -1,36 +1,36 @@ -"""Private finite-rotation retained physical-fibre beam potential. - -Pi(q,p;origin)=p.k(q)-Psi*(p;origin). The geometry is the preserved centered -two-cell kinematic map; material comes from the coupled physical-fibre cell. -No history commit, hidden static condensation or public routing occurs here. -""" -from dataclasses import dataclass -from math import fsum -import numpy as np - -from ._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference -from ._ge_beam3_fibre_cell import FibreCellConjugate, CellHistory -from ._ge_beam3_fibre_section import PhysicalFibreSection -from ._ge_beam3_mixed_ad import Jet2, constant_matrix, matmul, transpose, so3_exp, so3_log -from ._ge_beam3_p5.compensated import compensated_strain -from ._ge_beam3_p5.compensated_coordinates import validate_pair -from ._ge_beam3_p5.algebra import HALVES -from ._ge_beam3_p5.arrays import _array, _frames -from ._native_reference_modal import _owned -from ._ge_beam3_p5_seeded.core import canonical, sha - - -POLICY = 'CANDIDATE_GE_BEAM3_RETAINED_PHYSICAL_FIBRE_V1' - - -@dataclass(frozen=True) -class Evaluation: - potential: float - residual: np.ndarray - hessian: np.ndarray - hessian_low: np.ndarray - kinematics: np.ndarray - history: CellHistory +"""Private finite-rotation retained physical-fibre beam potential. + +Pi(q,p;origin)=p.k(q)-Psi*(p;origin). The geometry is the preserved centered +two-cell kinematic map; material comes from the coupled physical-fibre cell. +No history commit, hidden static condensation or public routing occurs here. +""" +from dataclasses import dataclass +from math import fsum +import numpy as np + +from ._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference +from ._ge_beam3_fibre_cell import FibreCellConjugate, CellHistory +from ._ge_beam3_fibre_section import PhysicalFibreSection +from ._ge_beam3_mixed_ad import Jet2, constant_matrix, matmul, transpose, so3_exp, so3_log +from ._ge_beam3_p5.compensated import compensated_strain +from ._ge_beam3_p5.compensated_coordinates import validate_pair +from ._ge_beam3_p5.algebra import HALVES +from ._ge_beam3_p5.arrays import _array, _frames +from ._native_reference_modal import _owned +from ._ge_beam3_p5_seeded.core import canonical, sha + + +POLICY = 'CANDIDATE_GE_BEAM3_RETAINED_PHYSICAL_FIBRE_V1' + + +@dataclass(frozen=True) +class Evaluation: + potential: float + residual: np.ndarray + hessian: np.ndarray + hessian_low: np.ndarray + kinematics: np.ndarray + history: CellHistory material: bytes production_qualified: bool = False @@ -39,72 +39,72 @@ class Evaluation: class BoundaryEvaluation(Evaluation): """New-policy-only owned payload; historical Evaluation schema stays fixed.""" trial_material: object = None - - -@dataclass(frozen=True) -class MaterialRecovery: - """Native beam material quantities in J, not the mixed saddle potential.""" - stations: tuple - history: CellHistory - stored_energy: tuple[float, float] - previous_hardening_energy: tuple[float, float] - incremental_dissipation: tuple[float, float] - material_potential: tuple[float, float] - energy_recovery_station_updates: int - - -class RetainedFibreOperator: + + +@dataclass(frozen=True) +class MaterialRecovery: + """Native beam material quantities in J, not the mixed saddle potential.""" + stations: tuple + history: CellHistory + stored_energy: tuple[float, float] + previous_hardening_energy: tuple[float, float] + incremental_dissipation: tuple[float, float] + material_potential: tuple[float, float] + energy_recovery_station_updates: int + + +class RetainedFibreOperator: __slots__ = ('reference', 'section', 'order', 'cell', 'stations', 'identity', '_reference_identity', '_sealed', 'arithmetic_policy', '_arithmetic_capture') - - def __setattr__(self, name, value): - if getattr(self, '_sealed', False): raise AttributeError('retained fibre operator is immutable') - object.__setattr__(self, name, value) - + + def __setattr__(self, name, value): + if getattr(self, '_sealed', False): raise AttributeError('retained fibre operator is immutable') + object.__setattr__(self, name, value) + def __init__(self, reference, section, *, order, arithmetic_policy=None): from ._stiffened_shell_f06_increment_arithmetic import POLICY as compensated if arithmetic_policy is not None and (type(arithmetic_policy) is not str or arithmetic_policy != compensated): raise ValueError('explicit physical fibre arithmetic policy required') - if type(reference) is not Reference or type(section) is not PhysicalFibreSection: - raise ValueError('explicit centered reference and native physical fibre section required') - if type(order) is not int or order not in (4, 8): - raise ValueError('private retained fibre entry supports explicit quadrature order 4 or 8') - self.reference = Reference(reference.coordinates, reference.nodal_triads, - regularity_relative_tolerance=reference._regularity_relative_tolerance, - rotation_tolerance=reference._rotation_tolerance, frame_tolerance=reference._frame_tolerance) - self.section = section; self.order = order - points, weights = np.polynomial.legendre.leggauss(order) - data = []; stations = [] - for cell in (0, 1): - for index, (point, weight) in enumerate(zip(points, weights)): - t = float((point+1)/2); xi = cell-1+t; jacobian = self.reference.jacobian(xi) - measure = float(weight*jacobian/2); frame = _owned(self.reference.frame(xi)) - data.append(dict(cell=cell, t=t, weight=measure, v=(frame.T/jacobian).tolist())) - stations.append((cell, index, xi, measure, frame)) - self.cell = FibreCellConjugate(section, data); self.stations = tuple(stations) - self._reference_identity = self.reference.fingerprint() + if type(reference) is not Reference or type(section) is not PhysicalFibreSection: + raise ValueError('explicit centered reference and native physical fibre section required') + if type(order) is not int or order not in (4, 8): + raise ValueError('private retained fibre entry supports explicit quadrature order 4 or 8') + self.reference = Reference(reference.coordinates, reference.nodal_triads, + regularity_relative_tolerance=reference._regularity_relative_tolerance, + rotation_tolerance=reference._rotation_tolerance, frame_tolerance=reference._frame_tolerance) + self.section = section; self.order = order + points, weights = np.polynomial.legendre.leggauss(order) + data = []; stations = [] + for cell in (0, 1): + for index, (point, weight) in enumerate(zip(points, weights)): + t = float((point+1)/2); xi = cell-1+t; jacobian = self.reference.jacobian(xi) + measure = float(weight*jacobian/2); frame = _owned(self.reference.frame(xi)) + data.append(dict(cell=cell, t=t, weight=measure, v=(frame.T/jacobian).tolist())) + stations.append((cell, index, xi, measure, frame)) + self.cell = FibreCellConjugate(section, data); self.stations = tuple(stations) + self._reference_identity = self.reference.fingerprint() self.identity = sha(dict(formulation_id=POLICY, section=section.identity, reference=self._reference_identity, quadrature=order, cell=self.cell.identity)) self.arithmetic_policy = arithmetic_policy if arithmetic_policy is not None: self.identity = sha(dict(source_operator=self.identity, arithmetic_policy=arithmetic_policy)) self._arithmetic_capture = (self.arithmetic_policy, self.identity) - self._sealed = True - + self._sealed = True + def guard(self): if (self.arithmetic_policy, self.identity) != self._arithmetic_capture: raise ValueError('captured fibre arithmetic policy changed') - if self.reference.fingerprint() != self._reference_identity: - raise ValueError('captured retained fibre reference changed') - + if self.reference.fingerprint() != self._reference_identity: + raise ValueError('captured retained fibre reference changed') + def evaluate(self, positions, position_low, vertices, rotations, resultants, *, origin=None, increment=None, check=None, capture_trial=False, vertices_low=None, rotations_low=None, resultants_low=None): if type(capture_trial) is not bool: raise ValueError('explicit fibre trial capture policy required') - self.guard() - if check is not None: check() - x = _array(positions, (3, 3), 'fibre positions'); low = _array(position_low, (3, 3), 'fibre low positions') - for h, l in zip(x.flat, low.flat): validate_pair(float(h), float(l)) - q = _frames(vertices, 3, 'fibre nodal frames'); u = _frames(rotations, 2, 'fibre cell rotations') + self.guard() + if check is not None: check() + x = _array(positions, (3, 3), 'fibre positions'); low = _array(position_low, (3, 3), 'fibre low positions') + for h, l in zip(x.flat, low.flat): validate_pair(float(h), float(l)) + q = _frames(vertices, 3, 'fibre nodal frames'); u = _frames(rotations, 2, 'fibre cell rotations') p = _array(resultants, (18,), 'fibre retained resultants') if self.arithmetic_policy is not None: if increment is not None: @@ -122,40 +122,40 @@ def evaluate(self, positions, position_low, vertices, rotations, resultants, *, return BoundaryEvaluation(*fields, trial_material=trial_material) if capture_trial else Evaluation(*fields) if any(v is not None for v in (vertices_low, rotations_low, resultants_low)): raise ValueError('native corrections require selected durable compensated policy') - delta = np.zeros(42) if increment is None else _array(increment, (42,), 'fibre chart increment') - angular = [delta[6*n+3:6*n+6] for n in range(3)]+[delta[18+3*c:21+3*c] for c in (0, 1)] - if max(np.linalg.norm(v) for v in angular) >= .9*np.pi: - raise ValueError('retained fibre rotation chart requires cutback') - variables = [Jet2.variable(value, i, 24) for i, value in enumerate(delta[:24])] - made_q = [matmul(so3_exp(variables[6*n+3:6*n+6]), constant_matrix(q[n], 24)) for n in range(3)] - z = []; ell = [] - for cell, (left, right) in enumerate(HALVES): - made_u = matmul(so3_exp(variables[18+3*cell:21+3*cell]), constant_matrix(u[cell], 24)) - z.extend(compensated_strain(made_u, self.reference.coordinates, x, low, variables, left, right)) - for node, sign in ((left, -1), (right, 1)): - frame = matmul(made_u, constant_matrix(self.reference.nodal_triads[node], 24)) - ell.extend(sign*v for v in so3_log(matmul(transpose(frame), made_q[node]))) - values = z+ell; k = np.array([v.value for v in values]); j = np.array([v.gradient for v in values]) - p = p+delta[24:] + delta = np.zeros(42) if increment is None else _array(increment, (42,), 'fibre chart increment') + angular = [delta[6*n+3:6*n+6] for n in range(3)]+[delta[18+3*c:21+3*c] for c in (0, 1)] + if max(np.linalg.norm(v) for v in angular) >= .9*np.pi: + raise ValueError('retained fibre rotation chart requires cutback') + variables = [Jet2.variable(value, i, 24) for i, value in enumerate(delta[:24])] + made_q = [matmul(so3_exp(variables[6*n+3:6*n+6]), constant_matrix(q[n], 24)) for n in range(3)] + z = []; ell = [] + for cell, (left, right) in enumerate(HALVES): + made_u = matmul(so3_exp(variables[18+3*cell:21+3*cell]), constant_matrix(u[cell], 24)) + z.extend(compensated_strain(made_u, self.reference.coordinates, x, low, variables, left, right)) + for node, sign in ((left, -1), (right, 1)): + frame = matmul(made_u, constant_matrix(self.reference.nodal_triads[node], 24)) + ell.extend(sign*v for v in so3_log(matmul(transpose(frame), made_q[node]))) + values = z+ell; k = np.array([v.value for v in values]); j = np.array([v.gradient for v in values]) + p = p+delta[24:] response = self.cell.response(p.tolist(), origin, check=check, **({'capture_trial': True} if capture_trial else {})) trial_material = response.pop('_trial_state', None) - gh, gl = response['gradient'] - compatibility = [fsum((float(v), -h, -l)) for v, h, l in zip(k, gh, gl)] - residual = np.r_[j.T@p, compatibility] - geometric = sum((v.hessian*force for v, force in zip(values, p)), np.zeros((24, 24))) - ch = np.array([row[0] for row in response['hessian']]); cl = np.array([row[1] for row in response['hessian']]) - hessian = np.block([[geometric, j.T], [j, -ch]]) - hessian_low = np.zeros((42, 42)); hessian_low[24:, 24:] = -cl - potential = fsum([*(float(a)*float(b) for a, b in zip(p, k)), - -response['potential'][0][0], -response['potential'][1][0]]) - if not np.isfinite(potential): raise ValueError('finite retained fibre potential required') - self.guard() - if check is not None: check() + gh, gl = response['gradient'] + compatibility = [fsum((float(v), -h, -l)) for v, h, l in zip(k, gh, gl)] + residual = np.r_[j.T@p, compatibility] + geometric = sum((v.hessian*force for v, force in zip(values, p)), np.zeros((24, 24))) + ch = np.array([row[0] for row in response['hessian']]); cl = np.array([row[1] for row in response['hessian']]) + hessian = np.block([[geometric, j.T], [j, -ch]]) + hessian_low = np.zeros((42, 42)); hessian_low[24:, 24:] = -cl + potential = fsum([*(float(a)*float(b) for a, b in zip(p, k)), + -response['potential'][0][0], -response['potential'][1][0]]) + if not np.isfinite(potential): raise ValueError('finite retained fibre potential required') + self.guard() + if check is not None: check() fields = (potential, _owned(residual), _owned(hessian), _owned(hessian_low), _owned(k), response['history'], canonical(response)) return BoundaryEvaluation(*fields, trial_material=trial_material) if capture_trial else Evaluation(*fields) - + def _recovery_input(self, rotations, resultants, rotations_low, resultants_low): u = _frames(rotations, 2, 'retained fibre recovery rotations') p = _array(resultants, (18,), 'retained fibre recovery resultants') @@ -175,35 +175,35 @@ def recover(self, rotations, resultants, *, origin=None, check=None, rotations_l self.guard() u, p, extra = self._recovery_input(rotations, resultants, rotations_low, resultants_low) response = self.cell.response(p.tolist(), origin, check=check, **extra) - rows = self._recovery_rows(u, response) - self.guard() - if check is not None: check() - return rows - - def _recovery_rows(self, u, response): - rows = [] - for (cell, index, xi, weight, ref), fields, history in zip(self.stations, response['stations'], response['history'].stations): - rows.append(dict(cell=cell, station=index, xi=xi, measure=weight, - strain=_owned(fields['strain'][0]), strain_low=_owned(fields['strain'][1]), - resultants=_owned(fields['resultants'][0]), resultants_low=_owned(fields['resultants'][1]), - fibres=fields['fibres'], history=history, reference_frame=ref, - current_frame=_owned(u[cell]@ref), formulation_id=POLICY, - recovery_policy='PAIRED_PHYSICAL_FIBRE_RETAINED_FIELDS_V1')) - return tuple(rows) - + rows = self._recovery_rows(u, response) + self.guard() + if check is not None: check() + return rows + + def _recovery_rows(self, u, response): + rows = [] + for (cell, index, xi, weight, ref), fields, history in zip(self.stations, response['stations'], response['history'].stations): + rows.append(dict(cell=cell, station=index, xi=xi, measure=weight, + strain=_owned(fields['strain'][0]), strain_low=_owned(fields['strain'][1]), + resultants=_owned(fields['resultants'][0]), resultants_low=_owned(fields['resultants'][1]), + fibres=fields['fibres'], history=history, reference_frame=ref, + current_frame=_owned(u[cell]@ref), formulation_id=POLICY, + recovery_policy='PAIRED_PHYSICAL_FIBRE_RETAINED_FIELDS_V1')) + return tuple(rows) + def recover_material(self, rotations, resultants, *, origin=None, check=None, rotations_low=None, resultants_low=None): - """One local solve plus final accepted return-map energy capture. - - Default evaluate/recover payloads and their identities remain unchanged. - The supplied origin is the last accepted material predecessor. - """ + """One local solve plus final accepted return-map energy capture. + + Default evaluate/recover payloads and their identities remain unchanged. + The supplied origin is the last accepted material predecessor. + """ self.guard() u, p, extra = self._recovery_input(rotations, resultants, rotations_low, resultants_low) response = self.cell.response(p.tolist(), origin, check=check, include_energy=True, **extra) - rows = self._recovery_rows(u, response) - self.guard() - if check is not None: check() - return MaterialRecovery(rows, response['history'], response['stored_energy'], - response['previous_hardening_energy'], response['incremental_dissipation'], - tuple(value[0] for value in response['material_potential']), - response['energy_recovery_station_updates']) + rows = self._recovery_rows(u, response) + self.guard() + if check is not None: check() + return MaterialRecovery(rows, response['history'], response['stored_energy'], + response['previous_hardening_energy'], response['incremental_dissipation'], + tuple(value[0] for value in response['material_potential']), + response['energy_recovery_station_updates']) diff --git a/src/anysolver/_ge_beam3_retained_fibre_control.py b/src/anyfesolver/_ge_beam3_retained_fibre_control.py similarity index 100% rename from src/anysolver/_ge_beam3_retained_fibre_control.py rename to src/anyfesolver/_ge_beam3_retained_fibre_control.py diff --git a/src/anysolver/_ge_beam3_retained_fibre_element.py b/src/anyfesolver/_ge_beam3_retained_fibre_element.py similarity index 100% rename from src/anysolver/_ge_beam3_retained_fibre_element.py rename to src/anyfesolver/_ge_beam3_retained_fibre_element.py diff --git a/src/anysolver/_ge_beam3_retained_fibre_modal.py b/src/anyfesolver/_ge_beam3_retained_fibre_modal.py similarity index 100% rename from src/anysolver/_ge_beam3_retained_fibre_modal.py rename to src/anyfesolver/_ge_beam3_retained_fibre_modal.py diff --git a/src/anysolver/_ge_beam3_retained_fibre_modes.py b/src/anyfesolver/_ge_beam3_retained_fibre_modes.py similarity index 100% rename from src/anysolver/_ge_beam3_retained_fibre_modes.py rename to src/anyfesolver/_ge_beam3_retained_fibre_modes.py diff --git a/src/anysolver/_ge_beam3_retained_fibre_program.py b/src/anyfesolver/_ge_beam3_retained_fibre_program.py similarity index 100% rename from src/anysolver/_ge_beam3_retained_fibre_program.py rename to src/anyfesolver/_ge_beam3_retained_fibre_program.py diff --git a/src/anysolver/_ge_beam3_retained_fibre_state.py b/src/anyfesolver/_ge_beam3_retained_fibre_state.py similarity index 100% rename from src/anysolver/_ge_beam3_retained_fibre_state.py rename to src/anyfesolver/_ge_beam3_retained_fibre_state.py diff --git a/src/anysolver/_ge_beam3_retained_force_program.py b/src/anyfesolver/_ge_beam3_retained_force_program.py similarity index 94% rename from src/anysolver/_ge_beam3_retained_force_program.py rename to src/anyfesolver/_ge_beam3_retained_force_program.py index 540c837cb..104baec44 100644 --- a/src/anysolver/_ge_beam3_retained_force_program.py +++ b/src/anyfesolver/_ge_beam3_retained_force_program.py @@ -2,9 +2,9 @@ from dataclasses import dataclass from time import monotonic import numpy as np -from anysolver.control import cancellation_safe_point, SolveCancelled -from anysolver._ge_beam3_seeded_load_program import ForceProgram -from anysolver._ge_beam3_retained_state import Context, State +from anyfesolver.control import cancellation_safe_point, SolveCancelled +from anyfesolver._ge_beam3_seeded_load_program import ForceProgram +from anyfesolver._ge_beam3_retained_state import Context, State @dataclass(frozen=True) diff --git a/src/anysolver/_ge_beam3_retained_generalized.py b/src/anyfesolver/_ge_beam3_retained_generalized.py similarity index 100% rename from src/anysolver/_ge_beam3_retained_generalized.py rename to src/anyfesolver/_ge_beam3_retained_generalized.py diff --git a/src/anysolver/_ge_beam3_retained_generalized_modal.py b/src/anyfesolver/_ge_beam3_retained_generalized_modal.py similarity index 100% rename from src/anysolver/_ge_beam3_retained_generalized_modal.py rename to src/anyfesolver/_ge_beam3_retained_generalized_modal.py diff --git a/src/anysolver/_ge_beam3_retained_generalized_program.py b/src/anyfesolver/_ge_beam3_retained_generalized_program.py similarity index 100% rename from src/anysolver/_ge_beam3_retained_generalized_program.py rename to src/anyfesolver/_ge_beam3_retained_generalized_program.py diff --git a/src/anysolver/_ge_beam3_retained_generalized_state.py b/src/anyfesolver/_ge_beam3_retained_generalized_state.py similarity index 100% rename from src/anysolver/_ge_beam3_retained_generalized_state.py rename to src/anyfesolver/_ge_beam3_retained_generalized_state.py diff --git a/src/anysolver/_ge_beam3_retained_nodal_loading.py b/src/anyfesolver/_ge_beam3_retained_nodal_loading.py similarity index 100% rename from src/anysolver/_ge_beam3_retained_nodal_loading.py rename to src/anyfesolver/_ge_beam3_retained_nodal_loading.py diff --git a/src/anysolver/_ge_beam3_retained_plastic.py b/src/anyfesolver/_ge_beam3_retained_plastic.py similarity index 90% rename from src/anysolver/_ge_beam3_retained_plastic.py rename to src/anyfesolver/_ge_beam3_retained_plastic.py index 1b953a0cb..69295e984 100644 --- a/src/anysolver/_ge_beam3_retained_plastic.py +++ b/src/anyfesolver/_ge_beam3_retained_plastic.py @@ -8,16 +8,16 @@ from dataclasses import dataclass from math import fsum import numpy as np -from anysolver._ge_beam3_centered_mixed import CenteredStationaryBeam -from anysolver._ge_beam3_complementary_section import ComplementaryDirectedSection -from anysolver._ge_beam3_mixed_ad import Jet2, constant_matrix, matmul, transpose, so3_exp, so3_log -from anysolver._ge_beam3_p5.compensated import compensated_strain -from anysolver._ge_beam3_p5.compensated_coordinates import validate_pair -from anysolver._ge_beam3_p5.algebra import HALVES -from anysolver._ge_beam3_p5.arrays import _array, _frames -from anysolver._native_reference_modal import _owned -from anysolver._ge_beam3_p5_seeded.core import canonical, sha -from anysolver._ge_beam3_station_resultant_cell import StationResultantCell +from anyfesolver._ge_beam3_centered_mixed import CenteredStationaryBeam +from anyfesolver._ge_beam3_complementary_section import ComplementaryDirectedSection +from anyfesolver._ge_beam3_mixed_ad import Jet2, constant_matrix, matmul, transpose, so3_exp, so3_log +from anyfesolver._ge_beam3_p5.compensated import compensated_strain +from anyfesolver._ge_beam3_p5.compensated_coordinates import validate_pair +from anyfesolver._ge_beam3_p5.algebra import HALVES +from anyfesolver._ge_beam3_p5.arrays import _array, _frames +from anyfesolver._native_reference_modal import _owned +from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha +from anyfesolver._ge_beam3_station_resultant_cell import StationResultantCell POLICY = 'CANDIDATE_GE_BEAM3_RETAINED_DIRECTED_PLASTIC_V1' diff --git a/src/anysolver/_ge_beam3_retained_plastic_modes.py b/src/anyfesolver/_ge_beam3_retained_plastic_modes.py similarity index 94% rename from src/anysolver/_ge_beam3_retained_plastic_modes.py rename to src/anyfesolver/_ge_beam3_retained_plastic_modes.py index 03dc87f87..d7a04e7bf 100644 --- a/src/anysolver/_ge_beam3_retained_plastic_modes.py +++ b/src/anyfesolver/_ge_beam3_retained_plastic_modes.py @@ -12,13 +12,13 @@ import json import numpy as np from scipy.linalg import block_diag -from anysolver._ge_beam3_retained_plastic_state import Context -from anysolver._ge_beam3_station_resultant_cell import cholesky, solve, ident, sub, mul, tr, mv, pair -from anysolver._ge_beam3_lifted_kinetic_factor import current_lifted_kinetic_factor -from anysolver._native_factor_chain_modes import solve_factor_chain_modes -from anysolver._native_reference_modal import _owned -from anysolver._ge_beam3_p5_seeded.core import sha -from anysolver.control import cancellation_safe_point +from anyfesolver._ge_beam3_retained_plastic_state import Context +from anyfesolver._ge_beam3_station_resultant_cell import cholesky, solve, ident, sub, mul, tr, mv, pair +from anyfesolver._ge_beam3_lifted_kinetic_factor import current_lifted_kinetic_factor +from anyfesolver._native_factor_chain_modes import solve_factor_chain_modes +from anyfesolver._native_reference_modal import _owned +from anyfesolver._ge_beam3_p5_seeded.core import sha +from anyfesolver.control import cancellation_safe_point FROZEN = 'FROZEN_PLASTIC_COORDINATES_ELASTIC_PERTURBATION' ALGORITHMIC = 'ACCEPTED_INCREMENT_ALGORITHMIC_OPERATOR_DIAGNOSTIC' diff --git a/src/anysolver/_ge_beam3_retained_plastic_program.py b/src/anyfesolver/_ge_beam3_retained_plastic_program.py similarity index 95% rename from src/anysolver/_ge_beam3_retained_plastic_program.py rename to src/anyfesolver/_ge_beam3_retained_plastic_program.py index 1e2bb4605..c808e0ddf 100644 --- a/src/anysolver/_ge_beam3_retained_plastic_program.py +++ b/src/anyfesolver/_ge_beam3_retained_plastic_program.py @@ -2,9 +2,9 @@ from dataclasses import dataclass from time import monotonic import numpy as np -from anysolver.control import cancellation_safe_point, SolveCancelled -from anysolver._ge_beam3_seeded_load_program import ForceProgram -from anysolver._ge_beam3_retained_plastic_state import Context, State +from anyfesolver.control import cancellation_safe_point, SolveCancelled +from anyfesolver._ge_beam3_seeded_load_program import ForceProgram +from anyfesolver._ge_beam3_retained_plastic_state import Context, State @dataclass(frozen=True) diff --git a/src/anysolver/_ge_beam3_retained_plastic_state.py b/src/anyfesolver/_ge_beam3_retained_plastic_state.py similarity index 95% rename from src/anysolver/_ge_beam3_retained_plastic_state.py rename to src/anyfesolver/_ge_beam3_retained_plastic_state.py index 5f96a5469..06779d0b3 100644 --- a/src/anysolver/_ge_beam3_retained_plastic_state.py +++ b/src/anyfesolver/_ge_beam3_retained_plastic_state.py @@ -9,12 +9,12 @@ from hashlib import sha256 from time import monotonic import numpy as np -from anysolver._ge_beam3_retained_state import Context as MechanicalLayout, State as MechanicalState -from anysolver._ge_beam3_retained_plastic import RetainedPlasticOperator, POLICY -from anysolver._ge_beam3_station_resultant_cell import history_row -from anysolver._native_reference_modal import _owned -from anysolver._ge_beam3_p5_seeded.core import canonical, sha -from anysolver._ge_beam3_p5_seeded.codec import _load, MAX_BYTES +from anyfesolver._ge_beam3_retained_state import Context as MechanicalLayout, State as MechanicalState +from anyfesolver._ge_beam3_retained_plastic import RetainedPlasticOperator, POLICY +from anyfesolver._ge_beam3_station_resultant_cell import history_row +from anyfesolver._native_reference_modal import _owned +from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha +from anyfesolver._ge_beam3_p5_seeded.codec import _load, MAX_BYTES SCHEMA = 'GE_BEAM3_RETAINED_PAIRED_PLASTIC_ACCEPTED_CHAIN_V1' PROGRAM = 'GE_BEAM3_RETAINED_PAIRED_PLASTIC_FORCE_PROGRAM_V1' diff --git a/src/anysolver/_ge_beam3_retained_state.py b/src/anyfesolver/_ge_beam3_retained_state.py similarity index 95% rename from src/anysolver/_ge_beam3_retained_state.py rename to src/anyfesolver/_ge_beam3_retained_state.py index f1c5041d2..4d3753694 100644 --- a/src/anysolver/_ge_beam3_retained_state.py +++ b/src/anyfesolver/_ge_beam3_retained_state.py @@ -5,14 +5,14 @@ """ from dataclasses import dataclass import numpy as np -from anysolver._ge_beam3_seeded_load_program import _capture, ForceProgram -from anysolver._ge_beam3_p5_seeded.core import canonical, sha -from anysolver._ge_beam3_p5_seeded.codec import _load -from anysolver._ge_beam3_p5.arrays import _frames -from anysolver._ge_beam3_p5.compensated_coordinates import validate_pair, split_sum -from anysolver._native_reference_modal import _owned -from anysolver._ge_beam3_p5.algebra import rotation -from anysolver._ge_beam3_retained_elastic import RetainedElasticOperator, POLICY +from anyfesolver._ge_beam3_seeded_load_program import _capture, ForceProgram +from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha +from anyfesolver._ge_beam3_p5_seeded.codec import _load +from anyfesolver._ge_beam3_p5.arrays import _frames +from anyfesolver._ge_beam3_p5.compensated_coordinates import validate_pair, split_sum +from anyfesolver._native_reference_modal import _owned +from anyfesolver._ge_beam3_p5.algebra import rotation +from anyfesolver._ge_beam3_retained_elastic import RetainedElasticOperator, POLICY SCHEMA = 'GE_BEAM3_RETAINED_ELASTIC_ACCEPTED_STATE_V1' diff --git a/src/anysolver/_ge_beam3_retained_translation_control.py b/src/anyfesolver/_ge_beam3_retained_translation_control.py similarity index 100% rename from src/anysolver/_ge_beam3_retained_translation_control.py rename to src/anyfesolver/_ge_beam3_retained_translation_control.py diff --git a/src/anysolver/_ge_beam3_retained_translation_modal.py b/src/anyfesolver/_ge_beam3_retained_translation_modal.py similarity index 100% rename from src/anysolver/_ge_beam3_retained_translation_modal.py rename to src/anyfesolver/_ge_beam3_retained_translation_modal.py diff --git a/src/anysolver/_ge_beam3_schur_line_program.py b/src/anyfesolver/_ge_beam3_schur_line_program.py similarity index 100% rename from src/anysolver/_ge_beam3_schur_line_program.py rename to src/anyfesolver/_ge_beam3_schur_line_program.py diff --git a/src/anysolver/_ge_beam3_seeded_fibre_control.py b/src/anyfesolver/_ge_beam3_seeded_fibre_control.py similarity index 100% rename from src/anysolver/_ge_beam3_seeded_fibre_control.py rename to src/anyfesolver/_ge_beam3_seeded_fibre_control.py diff --git a/src/anysolver/_ge_beam3_seeded_load_program.py b/src/anyfesolver/_ge_beam3_seeded_load_program.py similarity index 95% rename from src/anysolver/_ge_beam3_seeded_load_program.py rename to src/anyfesolver/_ge_beam3_seeded_load_program.py index 74baa1788..a2594d6ca 100644 --- a/src/anysolver/_ge_beam3_seeded_load_program.py +++ b/src/anyfesolver/_ge_beam3_seeded_load_program.py @@ -15,17 +15,17 @@ import numpy as np from scipy import sparse -from anysolver.assembly import build_constraint_transformation -from anysolver.control import cancellation_safe_point, SolveCancelled -from anysolver.linalg import MatrixClass, factorize -from anysolver.nonlinear_static import _assemble_nonlinear_system -from anysolver.nonlinear_state import create_model_native_rotation_store, native_trial_full_coordinates -from anysolver._ge_beam3_p5.arrays import _readonly -from anysolver._ge_beam3_p5_seeded import NativeP5BeamElement, LoadStateStore -from anysolver._ge_beam3_p5_seeded.core import canonical, sha -from anysolver._ge_beam3_p5_seeded.codec import _load -from anysolver._ge_beam3_p5_seeded.state import parameter_value, LOAD_POLICY -from anysolver._ge_beam3_conservative_backtrack import acceptance +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.control import cancellation_safe_point, SolveCancelled +from anyfesolver.linalg import MatrixClass, factorize +from anyfesolver.nonlinear_static import _assemble_nonlinear_system +from anyfesolver.nonlinear_state import create_model_native_rotation_store, native_trial_full_coordinates +from anyfesolver._ge_beam3_p5.arrays import _readonly +from anyfesolver._ge_beam3_p5_seeded import NativeP5BeamElement, LoadStateStore +from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha +from anyfesolver._ge_beam3_p5_seeded.codec import _load +from anyfesolver._ge_beam3_p5_seeded.state import parameter_value, LOAD_POLICY +from anyfesolver._ge_beam3_conservative_backtrack import acceptance SCHEMA = 'GE_BEAM3_SEEDED_FORCE_PROGRAM_CHECKPOINT_V1' @@ -169,7 +169,7 @@ def _restore(raw, model, program, identity, elements, n, free, nodal): if type(cursor) is not int or not 0 <= cursor <= len(program.targets): raise ValueError('bounded checkpoint cursor required') parameter = parameter_value(value['accepted_parameter']) if parameter != (0. if cursor == 0 else program.targets[cursor-1]): raise ValueError('checkpoint schedule/parameter mismatch') - from anysolver._ge_beam3_p5.typed_schema import _decode + from anyfesolver._ge_beam3_p5.typed_schema import _decode total = _decode(value['total_displacement'],('array',(n,))) reaction = _decode(value['physical_imbalance'],('array',(n,))) if np.any(total[list(set(range(n))-set(free))]): raise ValueError('checkpoint violates prescribed supports') diff --git a/src/anysolver/_ge_beam3_seeded_loaded_modal.py b/src/anyfesolver/_ge_beam3_seeded_loaded_modal.py similarity index 93% rename from src/anysolver/_ge_beam3_seeded_loaded_modal.py rename to src/anyfesolver/_ge_beam3_seeded_loaded_modal.py index 99f54925b..4d2d2aa17 100644 --- a/src/anysolver/_ge_beam3_seeded_loaded_modal.py +++ b/src/anyfesolver/_ge_beam3_seeded_loaded_modal.py @@ -11,17 +11,17 @@ import numpy as np from scipy import sparse -from anysolver.assembly import build_constraint_transformation -from anysolver.control import cancellation_safe_point -from anysolver.nonlinear_state import create_model_native_rotation_store -from anysolver._native_reference_modal import _owned -from anysolver._native_stationary_spectrum import solve_stationary_spectrum -from anysolver._ge_beam3_centered_mixed import CenteredStationaryBeam -from anysolver._ge_beam3_p5.algebra import validate_section -from anysolver._ge_beam3_p5_centered.positions import validate_total_pair, rest_mass -from anysolver._ge_beam3_p5_seeded import NativeP5BeamElement -from anysolver._ge_beam3_p5_seeded.core import sha -from anysolver._ge_beam3_p5_seeded.state import parameter_value, LOAD_POLICY +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.control import cancellation_safe_point +from anyfesolver.nonlinear_state import create_model_native_rotation_store +from anyfesolver._native_reference_modal import _owned +from anyfesolver._native_stationary_spectrum import solve_stationary_spectrum +from anyfesolver._ge_beam3_centered_mixed import CenteredStationaryBeam +from anyfesolver._ge_beam3_p5.algebra import validate_section +from anyfesolver._ge_beam3_p5_centered.positions import validate_total_pair, rest_mass +from anyfesolver._ge_beam3_p5_seeded import NativeP5BeamElement +from anyfesolver._ge_beam3_p5_seeded.core import sha +from anyfesolver._ge_beam3_p5_seeded.state import parameter_value, LOAD_POLICY POLICY = 'GE_BEAM3_V5_LOADED_HESSIAN_CURRENT_REST_MASS_V1' diff --git a/src/anysolver/_ge_beam3_seeded_signed_modes.py b/src/anyfesolver/_ge_beam3_seeded_signed_modes.py similarity index 96% rename from src/anysolver/_ge_beam3_seeded_signed_modes.py rename to src/anyfesolver/_ge_beam3_seeded_signed_modes.py index f1fbb39f7..905aeef8c 100644 --- a/src/anysolver/_ge_beam3_seeded_signed_modes.py +++ b/src/anyfesolver/_ge_beam3_seeded_signed_modes.py @@ -19,10 +19,10 @@ import numpy as np -from anysolver._ge_beam3_mixed_ad import Jet2, constant_matrix, matmul, matvec, transpose, so3_exp, so3_log -from anysolver._ge_beam3_p5.compensated import compensated_strain -from anysolver._ge_beam3_centered_mixed import CenteredStationaryBeam -from anysolver._ge_beam3_p5.algebra import HALVES +from anyfesolver._ge_beam3_mixed_ad import Jet2, constant_matrix, matmul, matvec, transpose, so3_exp, so3_log +from anyfesolver._ge_beam3_p5.compensated import compensated_strain +from anyfesolver._ge_beam3_centered_mixed import CenteredStationaryBeam +from anyfesolver._ge_beam3_p5.algebra import HALVES def _split(element, inner, checkpoint): diff --git a/src/anysolver/_ge_beam3_shared_kinematic_split.py b/src/anyfesolver/_ge_beam3_shared_kinematic_split.py similarity index 91% rename from src/anysolver/_ge_beam3_shared_kinematic_split.py rename to src/anyfesolver/_ge_beam3_shared_kinematic_split.py index 79b3ff6d4..862f320e2 100644 --- a/src/anysolver/_ge_beam3_shared_kinematic_split.py +++ b/src/anyfesolver/_ge_beam3_shared_kinematic_split.py @@ -4,10 +4,10 @@ constitutive factors. No changed quadrature, section law, state or defaults. """ import numpy as np -from anysolver._ge_beam3_mixed_ad import Jet2, constant_matrix, matmul, matvec, transpose, so3_exp, so3_log -from anysolver._ge_beam3_p5.compensated import compensated_strain -from anysolver._ge_beam3_centered_mixed import CenteredStationaryBeam -from anysolver._ge_beam3_p5.algebra import HALVES +from anyfesolver._ge_beam3_mixed_ad import Jet2, constant_matrix, matmul, matvec, transpose, so3_exp, so3_log +from anyfesolver._ge_beam3_p5.compensated import compensated_strain +from anyfesolver._ge_beam3_centered_mixed import CenteredStationaryBeam +from anyfesolver._ge_beam3_p5.algebra import HALVES def shared_kinematic_chain(element,inner,checkpoint=lambda stage:None): diff --git a/src/anysolver/_ge_beam3_shell_joint_state.py b/src/anyfesolver/_ge_beam3_shell_joint_state.py similarity index 100% rename from src/anysolver/_ge_beam3_shell_joint_state.py rename to src/anyfesolver/_ge_beam3_shell_joint_state.py diff --git a/src/anysolver/_ge_beam3_shell_joint_trial.py b/src/anyfesolver/_ge_beam3_shell_joint_trial.py similarity index 100% rename from src/anysolver/_ge_beam3_shell_joint_trial.py rename to src/anyfesolver/_ge_beam3_shell_joint_trial.py diff --git a/src/anysolver/_ge_beam3_signed_loaded_modes.py b/src/anyfesolver/_ge_beam3_signed_loaded_modes.py similarity index 96% rename from src/anysolver/_ge_beam3_signed_loaded_modes.py rename to src/anyfesolver/_ge_beam3_signed_loaded_modes.py index d665338bf..4cfee5a1e 100644 --- a/src/anysolver/_ge_beam3_signed_loaded_modes.py +++ b/src/anyfesolver/_ge_beam3_signed_loaded_modes.py @@ -17,10 +17,10 @@ import numpy as np -from anysolver._ge_beam3_mixed_ad import Jet2, constant_matrix, matmul, matvec, transpose, so3_exp, so3_log -from anysolver._ge_beam3_p5.compensated import compensated_strain -from anysolver._ge_beam3_centered_mixed import CenteredStationaryBeam -from anysolver._ge_beam3_p5.algebra import HALVES +from anyfesolver._ge_beam3_mixed_ad import Jet2, constant_matrix, matmul, matvec, transpose, so3_exp, so3_log +from anyfesolver._ge_beam3_p5.compensated import compensated_strain +from anyfesolver._ge_beam3_centered_mixed import CenteredStationaryBeam +from anyfesolver._ge_beam3_p5.algebra import HALVES def _split(element, inner, checkpoint): diff --git a/src/anysolver/_ge_beam3_spatial_fibre_program.py b/src/anyfesolver/_ge_beam3_spatial_fibre_program.py similarity index 100% rename from src/anysolver/_ge_beam3_spatial_fibre_program.py rename to src/anyfesolver/_ge_beam3_spatial_fibre_program.py diff --git a/src/anysolver/_ge_beam3_spatial_nodal_moments.py b/src/anyfesolver/_ge_beam3_spatial_nodal_moments.py similarity index 100% rename from src/anysolver/_ge_beam3_spatial_nodal_moments.py rename to src/anyfesolver/_ge_beam3_spatial_nodal_moments.py diff --git a/src/anysolver/_ge_beam3_station_resultant_cell.py b/src/anyfesolver/_ge_beam3_station_resultant_cell.py similarity index 100% rename from src/anysolver/_ge_beam3_station_resultant_cell.py rename to src/anyfesolver/_ge_beam3_station_resultant_cell.py diff --git a/src/anysolver/_ge_beam3_variational_shell.py b/src/anyfesolver/_ge_beam3_variational_shell.py similarity index 98% rename from src/anysolver/_ge_beam3_variational_shell.py rename to src/anyfesolver/_ge_beam3_variational_shell.py index 289b14b60..2aaf2a8fd 100644 --- a/src/anysolver/_ge_beam3_variational_shell.py +++ b/src/anyfesolver/_ge_beam3_variational_shell.py @@ -1,57 +1,57 @@ -"""Private conservative shell pullback for the GE-B3 connection successor. - -Unchanged local Q4/S3 operators supply forces, material history and tangent. -The new connection policy differentiates the COMPLETE deformational map, not -just its rigid rotation. It neither replaces the existing corotational route -nor grants production qualification. See GE_BEAM3_VARIATIONAL_SHELL_MAP.md. -""" -import numpy as np - -from ._ge_beam3_mixed_ad import Jet2, constant_matrix, matmul, matvec, transpose, so3_exp, so3_log -from ._ge_beam3_pose_joint import _exp_terms - -POLICY = 'GE_BEAM3_PROCRUSTES_VARIATIONAL_SHELL_PULLBACK_V2' - - -def _davenport(c): - trace = np.trace(c) - z = np.array([c[2, 1]-c[1, 2], c[0, 2]-c[2, 0], c[1, 0]-c[0, 1]]) - return np.block([[np.array([[trace]]), z[None, :]], - [z[:, None], c+c.T-trace*np.eye(3)]]) - - -def _quaternion_jets(reference, current, *, displacement=None): - """Equal nodal-weight proper Procrustes fit and analytic two derivatives. - -Centered vectors retain their lengths (no unit-vector normalization). The -normalized largest quaternion eigenpair is differentiated implicitly. Only -the top eigenvalue must be simple; repeated lower eigenvalues are harmless. -""" - ref = np.asarray(reference, dtype=float) - x = np.asarray(current if displacement is None else displacement, dtype=float) - if (ref.ndim != 2 or ref.shape[1:] != (3,) or len(ref) not in (3, 4) - or x.shape != ref.shape or not np.isfinite(ref).all() or not np.isfinite(x).all()): - raise ValueError('finite three/four-node shell fit required') - ref = ref-ref.mean(axis=0) - x = x-x.mean(axis=0) - n = 6*len(ref) - # Constant reference scaling improves eigenspace conditioning without - # introducing a displacement-dependent coefficient into differentiation. - scale = np.linalg.norm(ref) - if not np.isfinite(scale) or scale == 0.: - raise ValueError('degenerate reference shell fit') - ref = ref/scale - if displacement is None: - matrix = _davenport((x/scale).T@ref) - else: - # Algebraically the same centered covariance, without forming ref+u. - # Build the linear Davenport contributions separately: subtracting - # O(1) covariance entries would erase tiny antisymmetric increments. - matrix = _davenport(ref.T@ref)+_davenport((x/scale).T@ref) - eigenvalues, vectors = np.linalg.eigh(matrix) - gap = eigenvalues[-1]-eigenvalues[-2] - if not gap > 1e-11*max(np.finfo(float).tiny, np.max(np.abs(eigenvalues))): - raise ValueError('nonunique proper shell fit; refine or cut back') +"""Private conservative shell pullback for the GE-B3 connection successor. + +Unchanged local Q4/S3 operators supply forces, material history and tangent. +The new connection policy differentiates the COMPLETE deformational map, not +just its rigid rotation. It neither replaces the existing corotational route +nor grants production qualification. See GE_BEAM3_VARIATIONAL_SHELL_MAP.md. +""" +import numpy as np + +from ._ge_beam3_mixed_ad import Jet2, constant_matrix, matmul, matvec, transpose, so3_exp, so3_log +from ._ge_beam3_pose_joint import _exp_terms + +POLICY = 'GE_BEAM3_PROCRUSTES_VARIATIONAL_SHELL_PULLBACK_V2' + + +def _davenport(c): + trace = np.trace(c) + z = np.array([c[2, 1]-c[1, 2], c[0, 2]-c[2, 0], c[1, 0]-c[0, 1]]) + return np.block([[np.array([[trace]]), z[None, :]], + [z[:, None], c+c.T-trace*np.eye(3)]]) + + +def _quaternion_jets(reference, current, *, displacement=None): + """Equal nodal-weight proper Procrustes fit and analytic two derivatives. + +Centered vectors retain their lengths (no unit-vector normalization). The +normalized largest quaternion eigenpair is differentiated implicitly. Only +the top eigenvalue must be simple; repeated lower eigenvalues are harmless. +""" + ref = np.asarray(reference, dtype=float) + x = np.asarray(current if displacement is None else displacement, dtype=float) + if (ref.ndim != 2 or ref.shape[1:] != (3,) or len(ref) not in (3, 4) + or x.shape != ref.shape or not np.isfinite(ref).all() or not np.isfinite(x).all()): + raise ValueError('finite three/four-node shell fit required') + ref = ref-ref.mean(axis=0) + x = x-x.mean(axis=0) + n = 6*len(ref) + # Constant reference scaling improves eigenspace conditioning without + # introducing a displacement-dependent coefficient into differentiation. + scale = np.linalg.norm(ref) + if not np.isfinite(scale) or scale == 0.: + raise ValueError('degenerate reference shell fit') + ref = ref/scale + if displacement is None: + matrix = _davenport((x/scale).T@ref) + else: + # Algebraically the same centered covariance, without forming ref+u. + # Build the linear Davenport contributions separately: subtracting + # O(1) covariance entries would erase tiny antisymmetric increments. + matrix = _davenport(ref.T@ref)+_davenport((x/scale).T@ref) + eigenvalues, vectors = np.linalg.eigh(matrix) + gap = eigenvalues[-1]-eigenvalues[-2] + if not gap > 1e-11*max(np.finfo(float).tiny, np.max(np.abs(eigenvalues))): + raise ValueError('nonunique proper shell fit; refine or cut back') q = vectors[:, -1] if displacement is None: inverse = (vectors[:, :-1]/(eigenvalues[-1]-eigenvalues[:-1]))@vectors[:, :-1].T @@ -75,137 +75,137 @@ def _quaternion_jets(reference, current, *, displacement=None): bordered = np.block([[eigenvalue*np.eye(4)-matrix, q[:, None]], [q[None, :], np.zeros((1, 1))]]) inverse = np.linalg.solve(bordered, np.vstack((np.eye(4), np.zeros((1, 4)))))[:4] - derivatives = np.zeros((n, 4, 4)) - derivative_reference = ref if displacement is None else ref-ref.mean(axis=0) - for node, r in enumerate(derivative_reference): - for axis in range(3): - dc = np.zeros((3, 3)); dc[axis] = r/scale - derivatives[6*node+axis] = _davenport(dc) - dq = np.einsum('ab,jbc,c->aj', inverse, derivatives, q) - dl = np.einsum('a,jab,b->j', q, derivatives, q) - reduced = derivatives-dl[:, None, None]*np.eye(4) - rhs = np.einsum('jab,bk->ajk', reduced, dq) - ddq = np.einsum('ab,bjk->ajk', inverse, rhs+rhs.transpose(0, 2, 1)) - ddq -= q[:, None, None]*(dq.T@dq)[None, :, :] - return [Jet2(q[i], dq[i], ddq[i]) for i in range(4)] - - -def rotation_jets(reference, current): - """Proper Procrustes rotation with the historical two-argument contract.""" - w, a, b, d = _quaternion_jets(reference, current) - return [[w*w+a*a-b*b-d*d, 2*(a*b-w*d), 2*(a*d+w*b)], - [2*(a*b+w*d), w*w-a*a+b*b-d*d, 2*(b*d-w*a)], - [2*(a*d-w*b), 2*(b*d+w*a), w*w-a*a-b*b+d*d]] - - + derivatives = np.zeros((n, 4, 4)) + derivative_reference = ref if displacement is None else ref-ref.mean(axis=0) + for node, r in enumerate(derivative_reference): + for axis in range(3): + dc = np.zeros((3, 3)); dc[axis] = r/scale + derivatives[6*node+axis] = _davenport(dc) + dq = np.einsum('ab,jbc,c->aj', inverse, derivatives, q) + dl = np.einsum('a,jab,b->j', q, derivatives, q) + reduced = derivatives-dl[:, None, None]*np.eye(4) + rhs = np.einsum('jab,bk->ajk', reduced, dq) + ddq = np.einsum('ab,bjk->ajk', inverse, rhs+rhs.transpose(0, 2, 1)) + ddq -= q[:, None, None]*(dq.T@dq)[None, :, :] + return [Jet2(q[i], dq[i], ddq[i]) for i in range(4)] + + +def rotation_jets(reference, current): + """Proper Procrustes rotation with the historical two-argument contract.""" + w, a, b, d = _quaternion_jets(reference, current) + return [[w*w+a*a-b*b-d*d, 2*(a*b-w*d), 2*(a*d+w*b)], + [2*(a*b+w*d), w*w-a*a+b*b-d*d, 2*(b*d-w*a)], + [2*(a*d-w*b), 2*(b*d+w*a), w*w-a*a-b*b+d*d]] + + def deformation(reference, displacement, *, stable_translation=False, rotation_anchors=None, stable_rotation=False): - """Value, differential and Hessian of all corotated nodal coordinates.""" - ref = np.asarray(reference, dtype=float) + """Value, differential and Hessian of all corotated nodal coordinates.""" + ref = np.asarray(reference, dtype=float) u = np.asarray(displacement, dtype=float) if type(stable_rotation) is not bool: raise ValueError('typed shell rotation numerical selection required') exponential, logarithm = so3_exp, so3_log if stable_rotation: from ._ge_beam3_g3c_so3_numerics import so3_exp as exponential, so3_log as logarithm - if u.shape != (6*len(ref),) or not np.isfinite(u).all(): - raise ValueError('finite complete shell coordinates required') - n = len(u) - if rotation_anchors is not None: - from ._stiffened_shell_rotation_charts import owned_anchors - rotation_anchors = owned_anchors(rotation_anchors, len(ref)) - if stable_translation: - w, a, b, d = _quaternion_jets( - ref, None, displacement=u.reshape(-1, 6)[:, :3]) - # Unit-quaternion R-I, including its full two derivatives. Avoid - # subtracting one from a near-unit diagonal after rotation evaluation. - increment = [[-2*(b*b+d*d), 2*(a*b-w*d), 2*(a*d+w*b)], - [2*(a*b+w*d), -2*(a*a+d*d), 2*(b*d-w*a)], - [2*(a*d-w*b), 2*(b*d+w*a), -2*(a*a+b*b)]] - rotation = [[increment[i][j]+float(i == j) for j in range(3)] - for i in range(3)] - else: - current = ref+u.reshape(-1, 6)[:, :3] - rotation = rotation_jets(ref, current) - rt = transpose(rotation) - jets = [[Jet2.variable(u[6*i+j], 6*i+j, n) for j in range(6)] for i in range(len(ref))] - x = [[jets[i][j]+(0. if stable_translation else ref[i, j]) - for j in range(3)] for i in range(len(ref))] - centre = [sum(row[j] for row in x)/len(x) for j in range(3)] - refc = ref-ref.mean(axis=0) - values = [] - for i in range(len(ref)): - local = matvec(rt, [x[i][j]-centre[j] for j in range(3)]) - if stable_translation: - rotated_reference = [sum(increment[k][j]*refc[i, k] - for k in range(3)) for j in range(3)] - values.extend(local[j]+rotated_reference[j] for j in range(3)) - else: - values.extend(local[j]-refc[i, j] for j in range(3)) + if u.shape != (6*len(ref),) or not np.isfinite(u).all(): + raise ValueError('finite complete shell coordinates required') + n = len(u) + if rotation_anchors is not None: + from ._stiffened_shell_rotation_charts import owned_anchors + rotation_anchors = owned_anchors(rotation_anchors, len(ref)) + if stable_translation: + w, a, b, d = _quaternion_jets( + ref, None, displacement=u.reshape(-1, 6)[:, :3]) + # Unit-quaternion R-I, including its full two derivatives. Avoid + # subtracting one from a near-unit diagonal after rotation evaluation. + increment = [[-2*(b*b+d*d), 2*(a*b-w*d), 2*(a*d+w*b)], + [2*(a*b+w*d), -2*(a*a+d*d), 2*(b*d-w*a)], + [2*(a*d-w*b), 2*(b*d+w*a), -2*(a*a+b*b)]] + rotation = [[increment[i][j]+float(i == j) for j in range(3)] + for i in range(3)] + else: + current = ref+u.reshape(-1, 6)[:, :3] + rotation = rotation_jets(ref, current) + rt = transpose(rotation) + jets = [[Jet2.variable(u[6*i+j], 6*i+j, n) for j in range(6)] for i in range(len(ref))] + x = [[jets[i][j]+(0. if stable_translation else ref[i, j]) + for j in range(3)] for i in range(len(ref))] + centre = [sum(row[j] for row in x)/len(x) for j in range(3)] + refc = ref-ref.mean(axis=0) + values = [] + for i in range(len(ref)): + local = matvec(rt, [x[i][j]-centre[j] for j in range(3)]) + if stable_translation: + rotated_reference = [sum(increment[k][j]*refc[i, k] + for k in range(3)) for j in range(3)] + values.extend(local[j]+rotated_reference[j] for j in range(3)) + else: + values.extend(local[j]-refc[i, j] for j in range(3)) physical = exponential(jets[i][3:]) - if rotation_anchors is not None: - physical = matmul(physical, constant_matrix(rotation_anchors[i], n)) + if rotation_anchors is not None: + physical = matmul(physical, constant_matrix(rotation_anchors[i], n)) values.extend(logarithm(matmul(rt, physical))) - return (np.array([v.value for v in values]), - np.array([v.gradient for v in values]), - np.array([v.hessian for v in values])) - - -def response(model, element, displacement, origin, layers, *, split=False, - rotation_anchors=None, stable_translation=False): - """Spatial wrench rows, additive columns, and unchanged local trial state. - -g=D.T f; H=D.T K D + sum(f_i Hess(d_i)). Spatial rows then follow -P.T r=g and P.T J=H-dP.T r. No post-hoc symmetrization is performed. -""" - if type(stable_translation) is not bool: - raise ValueError('explicit shell translation arithmetic policy required') - ref = np.array([model.mesh.nodes[i].coords() for i in element.node_ids]) - u = np.asarray(displacement, dtype=float) - local, differential, second = deformation(ref, u, rotation_anchors=rotation_anchors, - stable_translation=stable_translation) - material = model.get_material(element.material_name) - # This successor currently owns virgin elastic shells only. Do not imply - # a conservative potential for active plastic/unsupported section states. - if material.yield_stress != 0. or material.hardening_curve is not None or element.shell_section is not None: - raise ValueError('variational shell successor requires its owned elastic section') - if split and element.num_nodes == 4: - f, k, candidate, components = element.compute_nonlinear_response(model.mesh, material, - local, origin, layers, True, _return_tangent_components=True) - km, kg = components['material'], components['geometric'] - else: - f, k, candidate = element.compute_nonlinear_response(model.mesh, material, - local, origin, layers, True) - # The admitted elastic S3 V2D local strains are linear in local_u. - # Its finite geometric variation belongs entirely to this pullback. - km, kg = k, np.zeros_like(k) - f, k = np.asarray(f), np.asarray(k) - if not np.isfinite(f).all() or not np.isfinite(k).all(): - raise ValueError('nonfinite local shell response') - if np.linalg.norm(k-k.T) > 1e-11*max(1., np.linalg.norm(k)): - raise ValueError('nonconservative local shell tangent') - g = differential.T@f - h = differential.T@k@differential+np.einsum('i,ijk->jk', f, second) - p = np.eye(len(u)); blocks = [] - for node, row in enumerate(u.reshape(-1, 6)): - _, a, da = _exp_terms(row[3:]) - singular = np.linalg.svd(a, compute_uv=False) - if singular[-1] <= 1e-11*max(1., singular[0]): - raise ValueError('singular additive shell chart; owner rebase required') - s = slice(6*node+3, 6*node+6) - p[s, s] = a; blocks.append((s, da)) - residual = np.linalg.solve(p.T, g) - correction = np.zeros_like(h) - for s, da in blocks: - correction[s, s] = np.einsum('ijk,i->jk', da, residual[s]) - tangent = np.linalg.solve(p.T, h-correction) - if split: - inverse = np.linalg.solve(p, np.eye(len(u))) - b = differential@inverse - material = b.T@km@b - geometric = np.linalg.solve(p.T, differential.T@kg@differential - +np.einsum('i,ijk->jk', f, second)-correction)@inverse - if np.linalg.norm(material+geometric-tangent@inverse) > 1e-11*max(1., np.linalg.norm(tangent@inverse)): - raise ValueError('shell variational material/geometric split mismatch') - return residual, tangent, candidate, material, geometric - return residual, tangent, candidate + return (np.array([v.value for v in values]), + np.array([v.gradient for v in values]), + np.array([v.hessian for v in values])) + + +def response(model, element, displacement, origin, layers, *, split=False, + rotation_anchors=None, stable_translation=False): + """Spatial wrench rows, additive columns, and unchanged local trial state. + +g=D.T f; H=D.T K D + sum(f_i Hess(d_i)). Spatial rows then follow +P.T r=g and P.T J=H-dP.T r. No post-hoc symmetrization is performed. +""" + if type(stable_translation) is not bool: + raise ValueError('explicit shell translation arithmetic policy required') + ref = np.array([model.mesh.nodes[i].coords() for i in element.node_ids]) + u = np.asarray(displacement, dtype=float) + local, differential, second = deformation(ref, u, rotation_anchors=rotation_anchors, + stable_translation=stable_translation) + material = model.get_material(element.material_name) + # This successor currently owns virgin elastic shells only. Do not imply + # a conservative potential for active plastic/unsupported section states. + if material.yield_stress != 0. or material.hardening_curve is not None or element.shell_section is not None: + raise ValueError('variational shell successor requires its owned elastic section') + if split and element.num_nodes == 4: + f, k, candidate, components = element.compute_nonlinear_response(model.mesh, material, + local, origin, layers, True, _return_tangent_components=True) + km, kg = components['material'], components['geometric'] + else: + f, k, candidate = element.compute_nonlinear_response(model.mesh, material, + local, origin, layers, True) + # The admitted elastic S3 V2D local strains are linear in local_u. + # Its finite geometric variation belongs entirely to this pullback. + km, kg = k, np.zeros_like(k) + f, k = np.asarray(f), np.asarray(k) + if not np.isfinite(f).all() or not np.isfinite(k).all(): + raise ValueError('nonfinite local shell response') + if np.linalg.norm(k-k.T) > 1e-11*max(1., np.linalg.norm(k)): + raise ValueError('nonconservative local shell tangent') + g = differential.T@f + h = differential.T@k@differential+np.einsum('i,ijk->jk', f, second) + p = np.eye(len(u)); blocks = [] + for node, row in enumerate(u.reshape(-1, 6)): + _, a, da = _exp_terms(row[3:]) + singular = np.linalg.svd(a, compute_uv=False) + if singular[-1] <= 1e-11*max(1., singular[0]): + raise ValueError('singular additive shell chart; owner rebase required') + s = slice(6*node+3, 6*node+6) + p[s, s] = a; blocks.append((s, da)) + residual = np.linalg.solve(p.T, g) + correction = np.zeros_like(h) + for s, da in blocks: + correction[s, s] = np.einsum('ijk,i->jk', da, residual[s]) + tangent = np.linalg.solve(p.T, h-correction) + if split: + inverse = np.linalg.solve(p, np.eye(len(u))) + b = differential@inverse + material = b.T@km@b + geometric = np.linalg.solve(p.T, differential.T@kg@differential + +np.einsum('i,ijk->jk', f, second)-correction)@inverse + if np.linalg.norm(material+geometric-tangent@inverse) > 1e-11*max(1., np.linalg.norm(tangent@inverse)): + raise ValueError('shell variational material/geometric split mismatch') + return residual, tangent, candidate, material, geometric + return residual, tangent, candidate diff --git a/src/anysolver/_ge_beam3_virgin_reference_modes.py b/src/anyfesolver/_ge_beam3_virgin_reference_modes.py similarity index 100% rename from src/anysolver/_ge_beam3_virgin_reference_modes.py rename to src/anyfesolver/_ge_beam3_virgin_reference_modes.py diff --git a/src/anysolver/_impact_coupling.py b/src/anyfesolver/_impact_coupling.py similarity index 100% rename from src/anysolver/_impact_coupling.py rename to src/anyfesolver/_impact_coupling.py diff --git a/src/anysolver/_native_authority_dag.py b/src/anyfesolver/_native_authority_dag.py similarity index 100% rename from src/anysolver/_native_authority_dag.py rename to src/anyfesolver/_native_authority_dag.py diff --git a/src/anysolver/_native_dyadic_interval_inertia.py b/src/anyfesolver/_native_dyadic_interval_inertia.py similarity index 100% rename from src/anysolver/_native_dyadic_interval_inertia.py rename to src/anyfesolver/_native_dyadic_interval_inertia.py diff --git a/src/anysolver/_native_exact_shift_chain_modes.py b/src/anyfesolver/_native_exact_shift_chain_modes.py similarity index 100% rename from src/anysolver/_native_exact_shift_chain_modes.py rename to src/anyfesolver/_native_exact_shift_chain_modes.py diff --git a/src/anysolver/_native_exact_shift_inertia.py b/src/anyfesolver/_native_exact_shift_inertia.py similarity index 100% rename from src/anysolver/_native_exact_shift_inertia.py rename to src/anyfesolver/_native_exact_shift_inertia.py diff --git a/src/anysolver/_native_factor_chain_modes.py b/src/anyfesolver/_native_factor_chain_modes.py similarity index 97% rename from src/anysolver/_native_factor_chain_modes.py rename to src/anyfesolver/_native_factor_chain_modes.py index 969b0770f..8ca488414 100644 --- a/src/anysolver/_native_factor_chain_modes.py +++ b/src/anyfesolver/_native_factor_chain_modes.py @@ -13,10 +13,10 @@ from time import monotonic import numpy as np from scipy import linalg -from anysolver._native_signed_kinetic_factor_modes import _reduce, _orthonormalize -from anysolver._native_reference_modal import _owned -from anysolver.control import cancellation_safe_point -from anysolver._dyadic_factor_chain import reassemble_chain_exact_binary64 +from anyfesolver._native_signed_kinetic_factor_modes import _reduce, _orthonormalize +from anyfesolver._native_reference_modal import _owned +from anyfesolver.control import cancellation_safe_point +from anyfesolver._dyadic_factor_chain import reassemble_chain_exact_binary64 def product_error(x, y, product): diff --git a/src/anysolver/_native_guard.cpp b/src/anyfesolver/_native_guard.cpp similarity index 97% rename from src/anysolver/_native_guard.cpp rename to src/anyfesolver/_native_guard.cpp index b19294b21..340c6fc1e 100644 --- a/src/anysolver/_native_guard.cpp +++ b/src/anyfesolver/_native_guard.cpp @@ -461,7 +461,7 @@ Result owned_counter(PyObject* fn,PyObject* name,PyObject* value,bool& owned) { Ref module(PyObject_GetAttrString(fn,"__module__")); Ref qualname(PyObject_GetAttrString(fn,"__qualname__")); if(!module||!qualname)return Result::Error; - Result mod=string_equal(module.p,"anysolver._qualified_authority_epoch"); + Result mod=string_equal(module.p,"anyfesolver._qualified_authority_epoch"); if(mod==Result::Error||mod==Result::Unsupported)return mod; if(mod!=Result::Equal)return Result::Equal; if(!text(qualname.p))return Result::Unsupported; @@ -540,9 +540,20 @@ Result class_state(Context& context,PyObject* cls,PyObject* expected) { if(!type_access_supported(base))return Result::Unsupported; PyObject* ns=reinterpret_cast(base)->tp_dict; if(!ns||!PyDict_CheckExact(ns))return Result::Unsupported; - Py_ssize_t pos=0;PyObject *name,*value; - while(PyDict_Next(ns,&pos,&name,&value)) { - if(!text(name))return Result::Unsupported; + // _class_state records each MRO namespace in member-name order. Snapshot + // the pairs before sorting. Exact, distinct Unicode keys decide every + // comparison between entries, so no member comparison hook can run. + Ref members(PyDict_Items(ns)); + if(!members)return Result::Error; + const Py_ssize_t count=PyList_GET_SIZE(members.p); + for(Py_ssize_t j=0;j=PyTuple_GET_SIZE(expected))return Result::Changed; @@ -807,7 +818,7 @@ PyMODINIT_FUNC PyInit__native_guard() { if(PyInterpreterState_Get()!=PyInterpreterState_Main()) { PyErr_SetString(PyExc_ImportError,"native guard does not support subinterpreters");return nullptr; } - PlanType.tp_name="anysolver._native_guard.Plan";PlanType.tp_basicsize=sizeof(PlanObject); + PlanType.tp_name="anyfesolver._native_guard.Plan";PlanType.tp_basicsize=sizeof(PlanObject); PlanType.tp_flags=Py_TPFLAGS_DEFAULT|Py_TPFLAGS_IMMUTABLETYPE|Py_TPFLAGS_HAVE_GC; PlanType.tp_dealloc=reinterpret_cast(plan_dealloc);PlanType.tp_new=nullptr; PlanType.tp_traverse=reinterpret_cast(plan_traverse);PlanType.tp_clear=reinterpret_cast(plan_clear); diff --git a/src/anysolver/_native_guard_dispatch.py b/src/anyfesolver/_native_guard_dispatch.py similarity index 96% rename from src/anysolver/_native_guard_dispatch.py rename to src/anyfesolver/_native_guard_dispatch.py index 6eb8a3012..1c626eb86 100644 --- a/src/anysolver/_native_guard_dispatch.py +++ b/src/anyfesolver/_native_guard_dispatch.py @@ -27,9 +27,9 @@ def initialise(classes,helpers,missing,literal_roots): _STATE=('fallback','unsupported_abi_or_explicit_python') return try: - module=importlib.import_module('anysolver._native_guard') + module=importlib.import_module('anyfesolver._native_guard') except ModuleNotFoundError as error: - if error.name!='anysolver._native_guard': + if error.name!='anyfesolver._native_guard': raise _STATE=('fallback','extension_absent') return @@ -65,7 +65,7 @@ def initialise(classes,helpers,missing,literal_roots): source=Path(__file__).with_name('_native_guard.cpp') if hashlib.sha256(source.read_bytes()).hexdigest()!=source_sha: raise ValueError('native compiled source identity mismatch') - distribution=importlib.metadata.distribution('ANYsolver') + distribution=importlib.metadata.distribution('ANYfeSolver') record=distribution.read_text('RECORD') if record is None: _STATE=('fallback','unadmitted_no_binary_record') @@ -105,7 +105,7 @@ def try_compare(classes,helpers): return 2 if any(type(key) is not str for key in sys.__dict__) or any(type(key) is not str for key in _MODULES): return NotImplemented - if sys.__dict__.get('modules') is not _MODULES or _MODULES.get('anysolver._native_guard') is not module: + if sys.__dict__.get('modules') is not _MODULES or _MODULES.get('anyfesolver._native_guard') is not module: return 2 namespace=module.__dict__ if any(type(key) is not str for key in namespace): diff --git a/src/anysolver/_native_large_factor_chain.py b/src/anyfesolver/_native_large_factor_chain.py similarity index 100% rename from src/anysolver/_native_large_factor_chain.py rename to src/anyfesolver/_native_large_factor_chain.py diff --git a/src/anysolver/_native_material_protocol.py b/src/anyfesolver/_native_material_protocol.py similarity index 100% rename from src/anysolver/_native_material_protocol.py rename to src/anyfesolver/_native_material_protocol.py diff --git a/src/anysolver/_native_midpoint_controller.py b/src/anyfesolver/_native_midpoint_controller.py similarity index 100% rename from src/anysolver/_native_midpoint_controller.py rename to src/anyfesolver/_native_midpoint_controller.py diff --git a/src/anysolver/_native_modal_capacity.py b/src/anyfesolver/_native_modal_capacity.py similarity index 100% rename from src/anysolver/_native_modal_capacity.py rename to src/anyfesolver/_native_modal_capacity.py diff --git a/src/anysolver/_native_paired_factor_chain_modes.py b/src/anyfesolver/_native_paired_factor_chain_modes.py similarity index 97% rename from src/anysolver/_native_paired_factor_chain_modes.py rename to src/anyfesolver/_native_paired_factor_chain_modes.py index a535e2903..7097ee8f5 100644 --- a/src/anysolver/_native_paired_factor_chain_modes.py +++ b/src/anyfesolver/_native_paired_factor_chain_modes.py @@ -16,10 +16,10 @@ from time import monotonic import numpy as np from scipy import linalg -from anysolver._native_signed_kinetic_factor_modes import _reduce, _orthonormalize -from anysolver._native_reference_modal import _owned -from anysolver.control import cancellation_safe_point -from anysolver._dyadic_factor_chain import reassemble_chain_exact_binary64 +from anyfesolver._native_signed_kinetic_factor_modes import _reduce, _orthonormalize +from anyfesolver._native_reference_modal import _owned +from anyfesolver.control import cancellation_safe_point +from anyfesolver._dyadic_factor_chain import reassemble_chain_exact_binary64 def product_error(x, y, product): diff --git a/src/anysolver/_native_reassembled_factor_modes.py b/src/anyfesolver/_native_reassembled_factor_modes.py similarity index 97% rename from src/anysolver/_native_reassembled_factor_modes.py rename to src/anyfesolver/_native_reassembled_factor_modes.py index baf4619bd..81e24f3e4 100644 --- a/src/anysolver/_native_reassembled_factor_modes.py +++ b/src/anyfesolver/_native_reassembled_factor_modes.py @@ -13,10 +13,10 @@ from time import monotonic import numpy as np from scipy import linalg -from anysolver._native_signed_kinetic_factor_modes import _reduce, _orthonormalize -from anysolver._native_reference_modal import _owned -from anysolver.control import cancellation_safe_point -from anysolver._dyadic_bilinear import reassemble_exact_binary64 +from anyfesolver._native_signed_kinetic_factor_modes import _reduce, _orthonormalize +from anyfesolver._native_reference_modal import _owned +from anyfesolver.control import cancellation_safe_point +from anyfesolver._dyadic_bilinear import reassemble_exact_binary64 def product_error(x, y, product): diff --git a/src/anysolver/_native_reference_factor_spectrum.py b/src/anyfesolver/_native_reference_factor_spectrum.py similarity index 100% rename from src/anysolver/_native_reference_factor_spectrum.py rename to src/anyfesolver/_native_reference_factor_spectrum.py diff --git a/src/anysolver/_native_reference_modal.py b/src/anyfesolver/_native_reference_modal.py similarity index 100% rename from src/anysolver/_native_reference_modal.py rename to src/anyfesolver/_native_reference_modal.py diff --git a/src/anysolver/_native_relative_factor_chain_modes.py b/src/anyfesolver/_native_relative_factor_chain_modes.py similarity index 97% rename from src/anysolver/_native_relative_factor_chain_modes.py rename to src/anyfesolver/_native_relative_factor_chain_modes.py index 31949686e..d88e58761 100644 --- a/src/anysolver/_native_relative_factor_chain_modes.py +++ b/src/anyfesolver/_native_relative_factor_chain_modes.py @@ -13,10 +13,10 @@ from time import monotonic import numpy as np from scipy import linalg -from anysolver._native_signed_kinetic_factor_modes import _reduce, _orthonormalize -from anysolver._native_reference_modal import _owned -from anysolver.control import cancellation_safe_point -from anysolver._dyadic_factor_chain import reassemble_chain_exact_binary64 +from anyfesolver._native_signed_kinetic_factor_modes import _reduce, _orthonormalize +from anyfesolver._native_reference_modal import _owned +from anyfesolver.control import cancellation_safe_point +from anyfesolver._dyadic_factor_chain import reassemble_chain_exact_binary64 def product_error(x, y, product): diff --git a/src/anysolver/_native_relative_reference_factor_spectrum.py b/src/anyfesolver/_native_relative_reference_factor_spectrum.py similarity index 100% rename from src/anysolver/_native_relative_reference_factor_spectrum.py rename to src/anyfesolver/_native_relative_reference_factor_spectrum.py diff --git a/src/anysolver/_native_retained_step.py b/src/anyfesolver/_native_retained_step.py similarity index 100% rename from src/anysolver/_native_retained_step.py rename to src/anyfesolver/_native_retained_step.py diff --git a/src/anysolver/_native_rotation_state.py b/src/anyfesolver/_native_rotation_state.py similarity index 99% rename from src/anysolver/_native_rotation_state.py rename to src/anyfesolver/_native_rotation_state.py index 74d15c5de..4076f5f4a 100644 --- a/src/anysolver/_native_rotation_state.py +++ b/src/anyfesolver/_native_rotation_state.py @@ -1,6 +1,6 @@ """Solver-owned multiplicative rotations for formulation-native elements. -The ordinary ANYsolver displacement vector retains additive rotational +The ordinary ANYfeSolver displacement vector retains additive rotational coordinates for compatibility with existing elements. A formulation-native large-rotation element needs a different history variable: one proper rotation operator shared by every native element incident on a node. This module owns diff --git a/src/anysolver/_native_signed_factor_modes.py b/src/anyfesolver/_native_signed_factor_modes.py similarity index 100% rename from src/anysolver/_native_signed_factor_modes.py rename to src/anyfesolver/_native_signed_factor_modes.py diff --git a/src/anysolver/_native_signed_kinetic_factor_modes.py b/src/anyfesolver/_native_signed_kinetic_factor_modes.py similarity index 100% rename from src/anysolver/_native_signed_kinetic_factor_modes.py rename to src/anyfesolver/_native_signed_kinetic_factor_modes.py diff --git a/src/anysolver/_native_stationary_spectrum.py b/src/anyfesolver/_native_stationary_spectrum.py similarity index 100% rename from src/anysolver/_native_stationary_spectrum.py rename to src/anyfesolver/_native_stationary_spectrum.py diff --git a/src/anysolver/_nonlinear_events.py b/src/anyfesolver/_nonlinear_events.py similarity index 100% rename from src/anysolver/_nonlinear_events.py rename to src/anyfesolver/_nonlinear_events.py diff --git a/src/anysolver/_nonlinear_seed.py b/src/anyfesolver/_nonlinear_seed.py similarity index 100% rename from src/anysolver/_nonlinear_seed.py rename to src/anyfesolver/_nonlinear_seed.py diff --git a/src/anysolver/_paired_modal_arithmetic.py b/src/anyfesolver/_paired_modal_arithmetic.py similarity index 100% rename from src/anysolver/_paired_modal_arithmetic.py rename to src/anyfesolver/_paired_modal_arithmetic.py diff --git a/src/anysolver/_plate_stability_continuation.py b/src/anyfesolver/_plate_stability_continuation.py similarity index 100% rename from src/anysolver/_plate_stability_continuation.py rename to src/anyfesolver/_plate_stability_continuation.py diff --git a/src/anysolver/_q4_assumed_strain_plasticity.py b/src/anyfesolver/_q4_assumed_strain_plasticity.py similarity index 100% rename from src/anysolver/_q4_assumed_strain_plasticity.py rename to src/anyfesolver/_q4_assumed_strain_plasticity.py diff --git a/src/anysolver/_qualified_authority_epoch.py b/src/anyfesolver/_qualified_authority_epoch.py similarity index 100% rename from src/anysolver/_qualified_authority_epoch.py rename to src/anyfesolver/_qualified_authority_epoch.py diff --git a/src/anysolver/_relative_reference_svd.py b/src/anyfesolver/_relative_reference_svd.py similarity index 100% rename from src/anysolver/_relative_reference_svd.py rename to src/anyfesolver/_relative_reference_svd.py diff --git a/src/anysolver/_stiffened_shell_affine_endpoint.py b/src/anyfesolver/_stiffened_shell_affine_endpoint.py similarity index 100% rename from src/anysolver/_stiffened_shell_affine_endpoint.py rename to src/anyfesolver/_stiffened_shell_affine_endpoint.py diff --git a/src/anysolver/_stiffened_shell_algorithmic_pullback.py b/src/anyfesolver/_stiffened_shell_algorithmic_pullback.py similarity index 98% rename from src/anysolver/_stiffened_shell_algorithmic_pullback.py rename to src/anyfesolver/_stiffened_shell_algorithmic_pullback.py index 2be72e2cf..86994d58d 100644 --- a/src/anysolver/_stiffened_shell_algorithmic_pullback.py +++ b/src/anyfesolver/_stiffened_shell_algorithmic_pullback.py @@ -1,38 +1,38 @@ -"""Spatial rows for a complete, fixed-predecessor shell algorithmic pullback.""" - -import numpy as np - -from ._ge_beam3_pose_joint import _exp_terms - - +"""Spatial rows for a complete, fixed-predecessor shell algorithmic pullback.""" + +import numpy as np + +from ._ge_beam3_pose_joint import _exp_terms + + def spatial_response(displacement, force, tangent, differential, second, *, stable_rotation=False): - """Convert D.T f and its complete derivative through the actual chart. - - A consistent material derivative is not an assertion of a plastic energy - potential. No symmetry repair is applied to the algorithmic operator. - """ + """Convert D.T f and its complete derivative through the actual chart. + + A consistent material derivative is not an assertion of a plastic energy + potential. No symmetry repair is applied to the algorithmic operator. + """ u = np.asarray(displacement, dtype=float) if type(stable_rotation) is not bool: raise ValueError('typed shell rotation numerical selection required') exp_terms = _exp_terms if stable_rotation: from ._ge_beam3_g3c_stable.joint import _exp_terms as exp_terms - covector = differential.T@force - derivative = differential.T@tangent@differential+np.einsum( - "i,ijk->jk", force, second) - chart = np.eye(len(u)) - chart_derivatives = [] - for node, row in enumerate(u.reshape(-1, 6)): + covector = differential.T@force + derivative = differential.T@tangent@differential+np.einsum( + "i,ijk->jk", force, second) + chart = np.eye(len(u)) + chart_derivatives = [] + for node, row in enumerate(u.reshape(-1, 6)): _, jacobian, curvature = exp_terms(row[3:]) - singular = np.linalg.svd(jacobian, compute_uv=False) - if singular[-1] <= 1e-11*max(1., singular[0]): - raise ValueError("singular additive shell chart; owner rebase required") - slots = slice(6*node+3, 6*node+6) - chart[slots, slots] = jacobian - chart_derivatives.append((slots, curvature)) - residual = np.linalg.solve(chart.T, covector) - correction = np.zeros((len(u), len(u))) - for slots, curvature in chart_derivatives: - correction[slots, slots] = np.einsum("ijk,i->jk", curvature, residual[slots]) - spatial_tangent = np.linalg.solve(chart.T, derivative-correction) - return residual, spatial_tangent + singular = np.linalg.svd(jacobian, compute_uv=False) + if singular[-1] <= 1e-11*max(1., singular[0]): + raise ValueError("singular additive shell chart; owner rebase required") + slots = slice(6*node+3, 6*node+6) + chart[slots, slots] = jacobian + chart_derivatives.append((slots, curvature)) + residual = np.linalg.solve(chart.T, covector) + correction = np.zeros((len(u), len(u))) + for slots, curvature in chart_derivatives: + correction[slots, slots] = np.einsum("ijk,i->jk", curvature, residual[slots]) + spatial_tangent = np.linalg.solve(chart.T, derivative-correction) + return residual, spatial_tangent diff --git a/src/anysolver/_stiffened_shell_arc_checkpoint.py b/src/anyfesolver/_stiffened_shell_arc_checkpoint.py similarity index 99% rename from src/anysolver/_stiffened_shell_arc_checkpoint.py rename to src/anyfesolver/_stiffened_shell_arc_checkpoint.py index 8e475a8ec..d60ec948a 100644 --- a/src/anysolver/_stiffened_shell_arc_checkpoint.py +++ b/src/anyfesolver/_stiffened_shell_arc_checkpoint.py @@ -1,19 +1,19 @@ -"""Experimental arc endpoint framing, distinct from force/displacement history. - -Checksums and controller consistency do not authenticate a loading history. -Mechanical restoration uses the common fixed-predecessor endpoint validator. -""" -import json -from hashlib import sha256 -from dataclasses import asdict -import numpy as np +"""Experimental arc endpoint framing, distinct from force/displacement history. + +Checksums and controller consistency do not authenticate a loading history. +Mechanical restoration uses the common fixed-predecessor endpoint validator. +""" +import json +from hashlib import sha256 +from dataclasses import asdict +import numpy as np from ._stiffened_shell_ge_checkpoint_binary import encode,decode,encode_s3,decode_s3,MAX_CHECKPOINT_BYTES from ._stiffened_shell_arc_metric import (PhysicalChordMetric, NativeDirectorChordMetric, DIRECTOR_METRIC_ID, require_metric_owner, require_director_chart) -from ._stiffened_shell_rotation_charts import physical_frames - -MAGIC=b'ANYSSARC1' -KIND='finite_arc_bl5_coupled' +from ._stiffened_shell_rotation_charts import physical_frames + +MAGIC=b'ANYSSARC1' +KIND='finite_arc_bl5_coupled' POLICY='B3_GE_BL5_PHYSICAL_TANGENT_PLANE_V1_DEV' NATIVE_CHART_POLICY='B3_GE_NATIVE_POINT_ARC_FIXED_SHELL_CHART_V1_DEV' NATIVE_BL5_CHART_POLICY='B3_GE_NATIVE_FIBRE_BL5_ARC_UNREBASED_SHELL_CHART_V1_DEV' @@ -114,11 +114,11 @@ def identities(owner, *, native_version=2): policy.replace('DISPLACEMENT_','TANGENT_PLANE_').replace('_V1_DEV',f'_V{native_version}_DEV')) if getattr(owner, '_curved_material', False): return 'finite_arc_curved_material', 'B3_GE_CURVED_MATERIAL_POINT_TANGENT_PLANE_V1_DEV' - if getattr(owner, '_curved_reference', False): - return 'finite_arc_curved_points', 'B3_GE_CURVED_ELASTIC_POINT_TANGENT_PLANE_V1_DEV' - if owner._bl5_shell_material: - return KIND, POLICY - raise ValueError('admitted material or curved elastic point arc owner required') + if getattr(owner, '_curved_reference', False): + return 'finite_arc_curved_points', 'B3_GE_CURVED_ELASTIC_POINT_TANGENT_PLANE_V1_DEV' + if owner._bl5_shell_material: + return KIND, POLICY + raise ValueError('admitted material or curved elastic point arc owner required') def director_policy(owner): @@ -155,64 +155,64 @@ def metric_from_snapshot(owner,metadata,arrays): metric=PhysicalChordMetric(arrays['metric_weights'],metadata['metric_length']) require_metric_owner(owner,metric) return metric - - -CONTROL_LIMITS=(('max_cutbacks',0,8),('max_attempts',1,64), - ('max_iterations',1,24),('max_backtracks',0,12)) -ATTEMPT_GROUP_KEYS={'requested_radius','amplitude_origin','attempts', - *(name for name,_,_ in CONTROL_LIMITS)} - - -def _validate_attempt_group(group): - if (type(group) is not dict or set(group)!=ATTEMPT_GROUP_KEYS - or any(type(group[k]) is not int or not low<=group[k]<=high - for k,low,high in CONTROL_LIMITS) - or type(group['amplitude_origin']) not in (float,int) - or not np.isfinite(group['amplitude_origin'])): - raise ValueError('arc step controller contract') - requested=group['requested_radius'] - if (type(requested) not in (float,int) or not np.isfinite(requested) - or requested<=0. or not np.isfinite(requested*requested) or requested*requested<=0.): - raise ValueError('arc requested radius') - attempts=group['attempts'] - keys={'radius','accepted','evaluations','linear_solves','rejected_trials','event_cell_evaluations','failure'} - if type(attempts) is not list or not 1<=len(attempts)<=min(group['max_cutbacks']+1,group['max_attempts']): - raise ValueError('bounded arc step attempts required') - for i,row in enumerate(attempts): - if (type(row) is not dict or set(row)!=keys or type(row['accepted']) is not bool - or row['accepted']!=(i==len(attempts)-1) - or type(row['radius']) not in (float,int) or row['radius']!=requested*.5**i - or not np.isfinite(row['radius']*row['radius']) or row['radius']*row['radius']<=0. - or any(type(row[k]) is not int or not 0<=row[k]<=2**63-1 for k in - ('evaluations','linear_solves','rejected_trials','event_cell_evaluations')) - or row['evaluations']<1 or row['linear_solves']<1 - or row['linear_solves']>group['max_iterations']+1 - or row['rejected_trials']>group['max_iterations']*(group['max_backtracks']+1) - or row['evaluations']>2+group['max_iterations']*(group['max_backtracks']+1) - or (row['accepted'] and row['failure'] is not None) - or (not row['accepted'] and (type(row['failure']) is not str or not row['failure'] or len(row['failure'])>256))): - raise ValueError('inconsistent arc attempt inventory') - return attempts - - + + +CONTROL_LIMITS=(('max_cutbacks',0,8),('max_attempts',1,64), + ('max_iterations',1,24),('max_backtracks',0,12)) +ATTEMPT_GROUP_KEYS={'requested_radius','amplitude_origin','attempts', + *(name for name,_,_ in CONTROL_LIMITS)} + + +def _validate_attempt_group(group): + if (type(group) is not dict or set(group)!=ATTEMPT_GROUP_KEYS + or any(type(group[k]) is not int or not low<=group[k]<=high + for k,low,high in CONTROL_LIMITS) + or type(group['amplitude_origin']) not in (float,int) + or not np.isfinite(group['amplitude_origin'])): + raise ValueError('arc step controller contract') + requested=group['requested_radius'] + if (type(requested) not in (float,int) or not np.isfinite(requested) + or requested<=0. or not np.isfinite(requested*requested) or requested*requested<=0.): + raise ValueError('arc requested radius') + attempts=group['attempts'] + keys={'radius','accepted','evaluations','linear_solves','rejected_trials','event_cell_evaluations','failure'} + if type(attempts) is not list or not 1<=len(attempts)<=min(group['max_cutbacks']+1,group['max_attempts']): + raise ValueError('bounded arc step attempts required') + for i,row in enumerate(attempts): + if (type(row) is not dict or set(row)!=keys or type(row['accepted']) is not bool + or row['accepted']!=(i==len(attempts)-1) + or type(row['radius']) not in (float,int) or row['radius']!=requested*.5**i + or not np.isfinite(row['radius']*row['radius']) or row['radius']*row['radius']<=0. + or any(type(row[k]) is not int or not 0<=row[k]<=2**63-1 for k in + ('evaluations','linear_solves','rejected_trials','event_cell_evaluations')) + or row['evaluations']<1 or row['linear_solves']<1 + or row['linear_solves']>group['max_iterations']+1 + or row['rejected_trials']>group['max_iterations']*(group['max_backtracks']+1) + or row['evaluations']>2+group['max_iterations']*(group['max_backtracks']+1) + or (row['accepted'] and row['failure'] is not None) + or (not row['accepted'] and (type(row['failure']) is not str or not row['failure'] or len(row['failure'])>256))): + raise ValueError('inconsistent arc attempt inventory') + return attempts + + def layout(owner,steps): - # Reuse only the existing mechanical array layout, not its control fields. + # Reuse only the existing mechanical array layout, not its control fields. from ._stiffened_shell_displacement_checkpoint import _layout from ._stiffened_shell_affine_endpoint import has_shell_material - mechanical=tuple((name,shape) for name,shape in _layout(owner,steps) - if name not in ('seed','history') and + mechanical=tuple((name,shape) for name,shape in _layout(owner,steps) + if name not in ('seed','history') and (has_shell_material(owner) or name not in - ('shell_plastic','shell_alpha','shell_origin_plastic','shell_origin_alpha'))) - nodes=len(owner._shell_ids)+len(owner._beam_ids) - return mechanical+(("history",(steps,2)),("metric_weights",(nodes,)), - ("normal_translations",(nodes,3)),("normal_spins",(nodes,3)), - ("origin_translations",(nodes,3)),("origin_frames",(nodes,3,3))) - - -def canonical(value): - return json.dumps(value,sort_keys=True,separators=(',',':'),allow_nan=False).encode('ascii') - - + ('shell_plastic','shell_alpha','shell_origin_plastic','shell_origin_alpha'))) + nodes=len(owner._shell_ids)+len(owner._beam_ids) + return mechanical+(("history",(steps,2)),("metric_weights",(nodes,)), + ("normal_translations",(nodes,3)),("normal_spins",(nodes,3)), + ("origin_translations",(nodes,3)),("origin_frames",(nodes,3,3))) + + +def canonical(value): + return json.dumps(value,sort_keys=True,separators=(',',':'),allow_nan=False).encode('ascii') + + def encode_snapshot(owner,metadata,arrays): from ._stiffened_shell_affine_endpoint import has_native_s3_material,is_native_point_material s3=has_native_s3_material(owner) @@ -231,30 +231,30 @@ def encode_snapshot(owner,metadata,arrays): inner=(encode_s3(owner._identity,metadata['generation'],numeric,arrays['s3_states'], native_material=True,displacement=True) if s3 else encode(kind,owner._identity,metadata['generation'],numeric)) - content=MAGIC+len(header).to_bytes(4,'little')+header+inner - if len(content)+32>MAX_CHECKPOINT_BYTES:raise ValueError('arc snapshot size limit') - raw=content+sha256(content).digest() - decode_snapshot(owner,raw) - return raw - - + content=MAGIC+len(header).to_bytes(4,'little')+header+inner + if len(content)+32>MAX_CHECKPOINT_BYTES:raise ValueError('arc snapshot size limit') + raw=content+sha256(content).digest() + decode_snapshot(owner,raw) + return raw + + def decode_snapshot(owner,raw): from ._stiffened_shell_affine_endpoint import is_native_point_material,has_native_s3_material native=_native_owner(owner);point=is_native_point_material(owner);s3=has_native_s3_material(owner) - identities(owner) - if (type(raw) is not bytes - or not raw.startswith(MAGIC) or not len(MAGIC)+36=len(raw)-32: - raise ValueError('arc metadata size') - if sha256(memoryview(raw)[:-32]).digest()!=raw[-32:]:raise ValueError('arc snapshot digest') - header=raw[start:start+length] - try:m=json.loads(header.decode('ascii')) - except (ValueError,UnicodeError,RecursionError) as e:raise ValueError('arc metadata') from e - keys={'policy','model','generation','seed_generation','seed_sha256','steps', - 'metric_length','predictor_dof','orientation','requested_radius','attempts', - 'max_cutbacks','max_attempts','max_iterations','max_backtracks', + identities(owner) + if (type(raw) is not bytes + or not raw.startswith(MAGIC) or not len(MAGIC)+36=len(raw)-32: + raise ValueError('arc metadata size') + if sha256(memoryview(raw)[:-32]).digest()!=raw[-32:]:raise ValueError('arc snapshot digest') + header=raw[start:start+length] + try:m=json.loads(header.decode('ascii')) + except (ValueError,UnicodeError,RecursionError) as e:raise ValueError('arc metadata') from e + keys={'policy','model','generation','seed_generation','seed_sha256','steps', + 'metric_length','predictor_dof','orientation','requested_radius','attempts', + 'max_cutbacks','max_attempts','max_iterations','max_backtracks', 'amplitude_origin','attempt_history','predecessor_sha256'} if native:keys.add('native_chart_policy') from ._stiffened_shell_affine_endpoint import is_native_material_bl5_arc @@ -278,25 +278,25 @@ def decode_snapshot(owner,raw): if director and (m['metric_kind']!=DIRECTOR_METRIC_ID or type(m['metric_shell_nodes']) is not int or m['metric_shell_nodes']!=len(owner._shell_ids)): raise ValueError('incompatible arc director metric layout') - if (any(type(m[k]) is not int for k in ('generation','seed_generation','steps','predictor_dof','orientation')) - or not 1<=m['steps']<=1024 or not 1<=m['seed_generation']=3 or dof not in owner._free: - raise ValueError('arc physical orientation coordinate') - for name in ('seed_sha256','predecessor_sha256'): - digest=m[name] - if type(digest) is not str or len(digest)!=64 or any(c not in '0123456789abcdef' for c in digest): - raise ValueError('arc predecessor/seed identity') - if m['steps']==1 and m['predecessor_sha256']!=m['seed_sha256']: - raise ValueError('first arc predecessor must be its seed') - if type(m['requested_radius']) not in (float,int) or not np.isfinite(m['requested_radius']) or m['requested_radius']<=0.: - raise ValueError('arc requested radius') - if (type(m['metric_length']) not in (float,int) or - any(type(m[k]) is not int or not low<=m[k]<=high for k,low,high in - (('max_cutbacks',0,8),('max_attempts',1,64),('max_iterations',1,24),('max_backtracks',0,12)))): - raise ValueError('arc controller/scaling contract') + if (any(type(m[k]) is not int for k in ('generation','seed_generation','steps','predictor_dof','orientation')) + or not 1<=m['steps']<=1024 or not 1<=m['seed_generation']=3 or dof not in owner._free: + raise ValueError('arc physical orientation coordinate') + for name in ('seed_sha256','predecessor_sha256'): + digest=m[name] + if type(digest) is not str or len(digest)!=64 or any(c not in '0123456789abcdef' for c in digest): + raise ValueError('arc predecessor/seed identity') + if m['steps']==1 and m['predecessor_sha256']!=m['seed_sha256']: + raise ValueError('first arc predecessor must be its seed') + if type(m['requested_radius']) not in (float,int) or not np.isfinite(m['requested_radius']) or m['requested_radius']<=0.: + raise ValueError('arc requested radius') + if (type(m['metric_length']) not in (float,int) or + any(type(m[k]) is not int or not low<=m[k]<=high for k,low,high in + (('max_cutbacks',0,8),('max_attempts',1,64),('max_iterations',1,24),('max_backtracks',0,12)))): + raise ValueError('arc controller/scaling contract') def shapes(kind,generation): expected=identities(owner)[0] if native: @@ -314,28 +314,28 @@ def s3_shapes(generation): a['s3_states']=states else:_,_,a=decode(raw[start+length:-32],owner._identity,shapes) metric=metric_from_snapshot(owner,m,a) - groups=m['attempt_history'] - if type(groups) is not list or len(groups)!=m['steps']: - raise ValueError('complete arc attempt history required') - for index,group in enumerate(groups): - rows=_validate_attempt_group(group) - if ((index==0 and group['amplitude_origin']!=0.) or - any(group[key]!=m[key] for key in - ('requested_radius','max_cutbacks','max_attempts','max_iterations','max_backtracks'))): - raise ValueError('arc frozen controller/history mismatch') - if rows[-1]['radius']!=a['history'][index,0]: - raise ValueError('arc step radius/history mismatch') - if index and group['amplitude_origin']!=a['history'][index-1,1]: - raise ValueError('arc amplitude origin/history mismatch') - if groups[-1]!={key:m[key] for key in ATTEMPT_GROUP_KEYS}: - raise ValueError('arc final controls/history mismatch') - attempts=m['attempts'] - radius,amplitude=a['history'][-1] - if np.any(a['history'][:,0]<=0.) or radius!=attempts[-1]['radius']: - raise ValueError('arc accepted radius/history mismatch') - if not np.array_equal(a['base_load']+amplitude*a['load_direction'],a['applied_load']): - raise ValueError('arc affine load mismatch') - translations=a['normal_translations'];spins=a['normal_spins'] + groups=m['attempt_history'] + if type(groups) is not list or len(groups)!=m['steps']: + raise ValueError('complete arc attempt history required') + for index,group in enumerate(groups): + rows=_validate_attempt_group(group) + if ((index==0 and group['amplitude_origin']!=0.) or + any(group[key]!=m[key] for key in + ('requested_radius','max_cutbacks','max_attempts','max_iterations','max_backtracks'))): + raise ValueError('arc frozen controller/history mismatch') + if rows[-1]['radius']!=a['history'][index,0]: + raise ValueError('arc step radius/history mismatch') + if index and group['amplitude_origin']!=a['history'][index-1,1]: + raise ValueError('arc amplitude origin/history mismatch') + if groups[-1]!={key:m[key] for key in ATTEMPT_GROUP_KEYS}: + raise ValueError('arc final controls/history mismatch') + attempts=m['attempts'] + radius,amplitude=a['history'][-1] + if np.any(a['history'][:,0]<=0.) or radius!=attempts[-1]['radius']: + raise ValueError('arc accepted radius/history mismatch') + if not np.array_equal(a['base_load']+amplitude*a['load_direction'],a['applied_load']): + raise ValueError('arc affine load mismatch') + translations=a['normal_translations'];spins=a['normal_spins'] if director: require_director_chart(a['q'][:owner._shell_count]) if 'shell_origin_q' in a:require_director_chart(a['shell_origin_q']) @@ -343,40 +343,40 @@ def s3_shapes(generation): else: norm=np.sum(metric.weights*(np.sum((translations/metric.length)**2,axis=1)+np.sum(spins*spins,axis=1))) if not np.isfinite(norm) or abs(norm-1.)>1e-10:raise ValueError('arc physical normal is not unit') - frames=np.concatenate((physical_frames(a['q'][:owner._shell_count],a['shell_anchors']),a['frames'])) - delta=a['q'][:nodes*6].reshape(-1,6)[:,:3]-a['origin_translations'] + frames=np.concatenate((physical_frames(a['q'][:owner._shell_count],a['shell_anchors']),a['frames'])) + delta=a['q'][:nodes*6].reshape(-1,6)[:,:3]-a['origin_translations'] if native and ((m['policy'] in _s3_arc_policies()[1:] if supports_generalized_stable_s3(owner) else m['policy']==identities(owner)[1]) or director): progress=m['orientation']*delta[dof//6,dof%6] if not progress>0.:raise ValueError('native arc selected coordinate made no oriented progress') - distance,_,_=metric.plane(delta,frames,a['origin_frames'],translations,spins) - if abs(distance-radius)/radius>1e-9:raise ValueError('arc path endpoint mismatch') - return m,a - - + distance,_,_=metric.plane(delta,frames,a['origin_frames'],translations,spins) + if abs(distance-radius)/radius>1e-9:raise ValueError('arc path endpoint mismatch') + return m,a + + def from_selection(owner,selection,*,seed_generation,seed_sha256,history=(),attempt_history=()): from ._stiffened_shell_ge_finite_experimental import _material_arrays,_shell_material_arrays from ._stiffened_shell_affine_endpoint import has_shell_material,is_native_point_material,has_native_s3_material trial=selection.trial;state=trial.state;parent=trial.predecessor_state require_metric_owner(owner,trial.metric) - with owner._commit_lock: - driver=owner._finite_driver - if (driver is None or owner._generation!=trial.accepted_generation - or driver._state is not parent or driver._shell_origins is not trial.shell_predecessor - or driver._beam_origins is not trial.beam_predecessor): - raise ValueError('stale arc checkpoint predecessor') - predecessor_sha256=sha256(owner.checkpoint()).hexdigest() - nodes=len(owner._shell_ids)+len(owner._beam_ids) - anchors=np.tile(np.eye(3),(len(owner._shell_ids),1,1)) if state.shell_anchors is None else state.shell_anchors - arrays={k:getattr(state,k) for k in ('q','frames','cells','resultants','multipliers')} - arrays.update(shell_anchors=anchors,shell_frames=physical_frames(state.q[:owner._shell_count],anchors), - base_load=trial.base_load,load_direction=trial.load_direction, - applied_load=trial.base_load+trial.amplitude*trial.load_direction, - history=np.asarray(tuple(history)+((trial.radius,trial.amplitude),)), - metric_weights=trial.metric.weights,normal_translations=trial.normal_translations, - normal_spins=trial.normal_spins,origin_translations=parent.q[:nodes*6].reshape(-1,6)[:,:3], - origin_frames=np.concatenate((physical_frames(parent.q[:owner._shell_count],parent.shell_anchors),parent.frames))) + with owner._commit_lock: + driver=owner._finite_driver + if (driver is None or owner._generation!=trial.accepted_generation + or driver._state is not parent or driver._shell_origins is not trial.shell_predecessor + or driver._beam_origins is not trial.beam_predecessor): + raise ValueError('stale arc checkpoint predecessor') + predecessor_sha256=sha256(owner.checkpoint()).hexdigest() + nodes=len(owner._shell_ids)+len(owner._beam_ids) + anchors=np.tile(np.eye(3),(len(owner._shell_ids),1,1)) if state.shell_anchors is None else state.shell_anchors + arrays={k:getattr(state,k) for k in ('q','frames','cells','resultants','multipliers')} + arrays.update(shell_anchors=anchors,shell_frames=physical_frames(state.q[:owner._shell_count],anchors), + base_load=trial.base_load,load_direction=trial.load_direction, + applied_load=trial.base_load+trial.amplitude*trial.load_direction, + history=np.asarray(tuple(history)+((trial.radius,trial.amplitude),)), + metric_weights=trial.metric.weights,normal_translations=trial.normal_translations, + normal_spins=trial.normal_spins,origin_translations=parent.q[:nodes*6].reshape(-1,6)[:,:3], + origin_frames=np.concatenate((physical_frames(parent.q[:owner._shell_count],parent.shell_anchors),parent.frames))) native=_native_owner(owner);s3=has_native_s3_material(owner) if native: from ._stiffened_shell_beam_history import arrays as native_arrays @@ -399,24 +399,24 @@ def from_selection(owner,selection,*,seed_generation,seed_sha256,history=(),atte arrays['shell_origin_q']=parent.q[:owner._shell_count] arrays['shell_origin_anchors']=(np.tile(np.eye(3),(len(owner._shell_ids),1,1)) if parent.shell_anchors is None else parent.shell_anchors) - group=dict(requested_radius=selection.requested_radius,amplitude_origin=trial.amplitude_origin, - attempts=[asdict(row) for row in selection.attempts], - max_cutbacks=selection.max_cutbacks,max_attempts=selection.max_attempts, - max_iterations=selection.max_iterations,max_backtracks=selection.max_backtracks) + group=dict(requested_radius=selection.requested_radius,amplitude_origin=trial.amplitude_origin, + attempts=[asdict(row) for row in selection.attempts], + max_cutbacks=selection.max_cutbacks,max_attempts=selection.max_attempts, + max_iterations=selection.max_iterations,max_backtracks=selection.max_backtracks) m=dict(policy=active_policy(owner,trial.metric),model=owner._identity,generation=trial.accepted_generation+1, - seed_generation=seed_generation,seed_sha256=seed_sha256,steps=len(history)+1, - metric_length=trial.metric.length,predictor_dof=trial.predictor_dof,orientation=trial.orientation, - predecessor_sha256=predecessor_sha256, + seed_generation=seed_generation,seed_sha256=seed_sha256,steps=len(history)+1, + metric_length=trial.metric.length,predictor_dof=trial.predictor_dof,orientation=trial.orientation, + predecessor_sha256=predecessor_sha256, attempt_history=list(attempt_history)+[group],**group) if native:m['native_chart_policy']=_chart_policy(owner) if type(trial.metric) is NativeDirectorChordMetric: m.update(metric_kind=DIRECTOR_METRIC_ID,metric_shell_nodes=trial.metric.shell_nodes) return encode_snapshot(owner,m,arrays) - - + + def validate_endpoint(owner,raw): from ._stiffened_shell_affine_endpoint import validate_arrays,is_native_point_material - metadata,arrays=decode_snapshot(owner,raw) + metadata,arrays=decode_snapshot(owner,raw) return metadata,arrays,*validate_arrays(owner,arrays, native_chart=is_native_point_material(owner), s3_stable=_replay_s3_stable(owner,metadata['policy'])) diff --git a/src/anysolver/_stiffened_shell_arc_control.py b/src/anyfesolver/_stiffened_shell_arc_control.py similarity index 98% rename from src/anysolver/_stiffened_shell_arc_control.py rename to src/anyfesolver/_stiffened_shell_arc_control.py index fe30796d4..fde07e35a 100644 --- a/src/anysolver/_stiffened_shell_arc_control.py +++ b/src/anyfesolver/_stiffened_shell_arc_control.py @@ -1,57 +1,57 @@ -"""Experimental fixed-mesh physical tangent-plane continuation. - -The requested count is a count of accepted steps, not a requested total distance. -Cutbacks reduce actual travelled distance and remain visible in history. This -local controller does not establish stability, a limit point or branch uniqueness. -""" -from copy import deepcopy -from dataclasses import dataclass,replace -from hashlib import sha256 -import numpy as np -from .control import cancellation_safe_point +"""Experimental fixed-mesh physical tangent-plane continuation. + +The requested count is a count of accepted steps, not a requested total distance. +Cutbacks reduce actual travelled distance and remain visible in history. This +local controller does not establish stability, a limit point or branch uniqueness. +""" +from copy import deepcopy +from dataclasses import dataclass,replace +from hashlib import sha256 +import numpy as np +from .control import cancellation_safe_point from ._stiffened_shell_arc_metric import (PhysicalChordMetric, NativeDirectorChordMetric, require_metric_owner, DIRECTOR_METRIC_ID) -from ._stiffened_shell_arc_trial import select_trial -from ._stiffened_shell_arc_checkpoint import from_selection -from ._stiffened_shell_arc_publication import publish -from ._stiffened_shell_displacement_control import DisplacementControl - - -@dataclass(frozen=True) -class ArcLengthControl: - """Fixed mesh weights follow compiled shell nodes, then beam nodes. - - The chosen free translation orients the tangent at each step. It must remain - a usable local branch coordinate; no automatic branch switching is provided. - Weights and characteristic length are explicit and frozen across restart. - """ - domain: str - node: int - component: int +from ._stiffened_shell_arc_trial import select_trial +from ._stiffened_shell_arc_checkpoint import from_selection +from ._stiffened_shell_arc_publication import publish +from ._stiffened_shell_displacement_control import DisplacementControl + + +@dataclass(frozen=True) +class ArcLengthControl: + """Fixed mesh weights follow compiled shell nodes, then beam nodes. + + The chosen free translation orients the tangent at each step. It must remain + a usable local branch coordinate; no automatic branch switching is provided. + Weights and characteristic length are explicit and frozen across restart. + """ + domain: str + node: int + component: int metric: PhysicalChordMetric | NativeDirectorChordMetric - radius: float - orientation: int = 1 - max_cutbacks: int = 4 - max_attempts: int = 5 - max_iterations: int = 20 - max_backtracks: int = 12 - - def __post_init__(self): + radius: float + orientation: int = 1 + max_cutbacks: int = 4 + max_attempts: int = 5 + max_iterations: int = 20 + max_backtracks: int = 12 + + def __post_init__(self): if type(self.metric) not in (PhysicalChordMetric, NativeDirectorChordMetric): - raise ValueError('explicit physical arc metric required') - if (type(self.radius) not in (int,float) or not np.isfinite(self.radius) - or self.radius<=0. or type(self.orientation) is not int or self.orientation not in (-1,1)): - raise ValueError('positive arc radius and signed orientation required') - for name,low,high in (('max_cutbacks',0,8),('max_attempts',1,64), - ('max_iterations',1,24),('max_backtracks',0,12)): - if type(getattr(self,name)) is not int or not low<=getattr(self,name)<=high: - raise ValueError('bounded arc controls required') - - -def solve(owner,actions,control,*,steps=1,cancellation_token=None,on_accepted=None): - if not isinstance(control,ArcLengthControl) or type(steps) is not int or not 1<=steps<=1024: - raise ValueError('arc control and bounded accepted-step count required') - if on_accepted is not None and not callable(on_accepted):raise ValueError('accepted observer must be callable') + raise ValueError('explicit physical arc metric required') + if (type(self.radius) not in (int,float) or not np.isfinite(self.radius) + or self.radius<=0. or type(self.orientation) is not int or self.orientation not in (-1,1)): + raise ValueError('positive arc radius and signed orientation required') + for name,low,high in (('max_cutbacks',0,8),('max_attempts',1,64), + ('max_iterations',1,24),('max_backtracks',0,12)): + if type(getattr(self,name)) is not int or not low<=getattr(self,name)<=high: + raise ValueError('bounded arc controls required') + + +def solve(owner,actions,control,*,steps=1,cancellation_token=None,on_accepted=None): + if not isinstance(control,ArcLengthControl) or type(steps) is not int or not 1<=steps<=1024: + raise ValueError('arc control and bounded accepted-step count required') + if on_accepted is not None and not callable(on_accepted):raise ValueError('accepted observer must be callable') driver=owner._finite_driver require_metric_owner(owner,control.metric) from ._stiffened_shell_affine_endpoint import is_native_point_material,is_native_material_bl5_arc @@ -61,48 +61,48 @@ def solve(owner,actions,control,*,steps=1,cancellation_token=None,on_accepted=No if native: from ._stiffened_shell_arc_checkpoint import require_native_seed require_native_seed(owner,driver) - if getattr(owner,'_external_context',None) is not None or driver._external is not None: - raise ValueError('arc continuation admits affine nodal dead translations only') - adaptive=getattr(owner,'_displacement_adaptive',None) - if adaptive is not None: - raise ValueError('finish displacement history and use its endpoint checkpoint before arc continuation') - dof=DisplacementControl(control.domain,control.node,control.component).dof(owner) - direction=driver._load(actions) - saved=getattr(owner,'_arc_snapshot',None) - knobs={name:getattr(control,name) for name in - ('max_cutbacks','max_attempts','max_iterations','max_backtracks')} - if saved is None: - seed_generation=owner._generation;seed_sha256=sha256(owner.checkpoint()).hexdigest() - base=None;amplitude=0.;history=();attempt_history=() - else: + if getattr(owner,'_external_context',None) is not None or driver._external is not None: + raise ValueError('arc continuation admits affine nodal dead translations only') + adaptive=getattr(owner,'_displacement_adaptive',None) + if adaptive is not None: + raise ValueError('finish displacement history and use its endpoint checkpoint before arc continuation') + dof=DisplacementControl(control.domain,control.node,control.component).dof(owner) + direction=driver._load(actions) + saved=getattr(owner,'_arc_snapshot',None) + knobs={name:getattr(control,name) for name in + ('max_cutbacks','max_attempts','max_iterations','max_backtracks')} + if saved is None: + seed_generation=owner._generation;seed_sha256=sha256(owner.checkpoint()).hexdigest() + base=None;amplitude=0.;history=();attempt_history=() + else: _,m,a=saved director=type(control.metric) is NativeDirectorChordMetric if (m.get('metric_kind')!=(DIRECTOR_METRIC_ID if director else None) or m.get('metric_shell_nodes')!=(control.metric.shell_nodes if director else None)): raise ValueError('arc metric identity differs from accepted history') - if (m['predictor_dof']!=dof or m['orientation']!=control.orientation - or m['requested_radius']!=control.radius or m['metric_length']!=control.metric.length - or not np.array_equal(a['metric_weights'],control.metric.weights) - or not np.array_equal(a['load_direction'],direction) - or any(m[name]!=value for name,value in knobs.items())): - raise ValueError('arc controller/load/metric differs from accepted history') - seed_generation=m['seed_generation'];seed_sha256=m['seed_sha256'] - base=a['base_load'];history=tuple(map(tuple,a['history']));amplitude=float(history[-1][1]) - attempt_history=tuple(m['attempt_history']) - if len(history)+steps>1024:raise ValueError('arc accepted history limit') - for _ in range(steps): - cancellation_safe_point(cancellation_token,'stiffened-shell.arc.step') - driver=owner._finite_driver;generation=owner._generation - selection=select_trial(driver,load_direction=direction,metric=control.metric, - radius=control.radius,predictor_dof=dof,orientation=control.orientation, - load_base=base,amplitude_origin=amplitude,cancellation_token=cancellation_token,**knobs) - raw=from_selection(owner,selection,seed_generation=seed_generation, - seed_sha256=seed_sha256,history=history,attempt_history=attempt_history) - result=publish(owner,raw,expected_driver=driver,expected_generation=generation, - cancellation_token=cancellation_token) - _,m,a=owner._arc_snapshot - base=a['base_load'];history=result.history;amplitude=result.amplitude - attempt_history=tuple(m['attempt_history']) - if on_accepted is not None:on_accepted(deepcopy(result)) - # Owner/restore retain an accepted prefix, independently of this call's goal. - return replace(result,status='completed') + if (m['predictor_dof']!=dof or m['orientation']!=control.orientation + or m['requested_radius']!=control.radius or m['metric_length']!=control.metric.length + or not np.array_equal(a['metric_weights'],control.metric.weights) + or not np.array_equal(a['load_direction'],direction) + or any(m[name]!=value for name,value in knobs.items())): + raise ValueError('arc controller/load/metric differs from accepted history') + seed_generation=m['seed_generation'];seed_sha256=m['seed_sha256'] + base=a['base_load'];history=tuple(map(tuple,a['history']));amplitude=float(history[-1][1]) + attempt_history=tuple(m['attempt_history']) + if len(history)+steps>1024:raise ValueError('arc accepted history limit') + for _ in range(steps): + cancellation_safe_point(cancellation_token,'stiffened-shell.arc.step') + driver=owner._finite_driver;generation=owner._generation + selection=select_trial(driver,load_direction=direction,metric=control.metric, + radius=control.radius,predictor_dof=dof,orientation=control.orientation, + load_base=base,amplitude_origin=amplitude,cancellation_token=cancellation_token,**knobs) + raw=from_selection(owner,selection,seed_generation=seed_generation, + seed_sha256=seed_sha256,history=history,attempt_history=attempt_history) + result=publish(owner,raw,expected_driver=driver,expected_generation=generation, + cancellation_token=cancellation_token) + _,m,a=owner._arc_snapshot + base=a['base_load'];history=result.history;amplitude=result.amplitude + attempt_history=tuple(m['attempt_history']) + if on_accepted is not None:on_accepted(deepcopy(result)) + # Owner/restore retain an accepted prefix, independently of this call's goal. + return replace(result,status='completed') diff --git a/src/anysolver/_stiffened_shell_arc_metric.py b/src/anyfesolver/_stiffened_shell_arc_metric.py similarity index 100% rename from src/anysolver/_stiffened_shell_arc_metric.py rename to src/anyfesolver/_stiffened_shell_arc_metric.py diff --git a/src/anysolver/_stiffened_shell_arc_publication.py b/src/anyfesolver/_stiffened_shell_arc_publication.py similarity index 98% rename from src/anysolver/_stiffened_shell_arc_publication.py rename to src/anyfesolver/_stiffened_shell_arc_publication.py index 80177e190..73618aa29 100644 --- a/src/anysolver/_stiffened_shell_arc_publication.py +++ b/src/anyfesolver/_stiffened_shell_arc_publication.py @@ -1,54 +1,54 @@ -"""Atomic endpoint publication behind the experimental public arc controller.""" +"""Atomic endpoint publication behind the experimental public arc controller.""" from dataclasses import dataclass,replace -from math import fsum -from hashlib import sha256 -import numpy as np -from scipy.spatial.transform import Rotation -from .control import cancellation_safe_point -from ._stiffened_shell_arc_checkpoint import validate_endpoint +from math import fsum +from hashlib import sha256 +import numpy as np +from scipy.spatial.transform import Rotation +from .control import cancellation_safe_point +from ._stiffened_shell_arc_checkpoint import validate_endpoint from ._stiffened_shell_arc_trial import ArcAttempt from ._stiffened_shell_affine_endpoint import has_shell_material,uses_native_material_history,has_native_s3_material - - -@dataclass(frozen=True) -class ArcResult: - status: str - amplitude: float - arc_position: float - history: tuple - generation: int - shell_displacement: np.ndarray - beam_positions: np.ndarray - beam_frames: np.ndarray - cell_frames: np.ndarray - cell_resultants: np.ndarray - multipliers: np.ndarray - support_reactions: np.ndarray - applied_dead_load: np.ndarray - free_equilibrium_ratio: float - constraint_max: float - shell_frames: np.ndarray - shell_chart_coordinates: np.ndarray - shell_rotation_anchors: np.ndarray - shell_q4_material: tuple - beam_station_accumulated: tuple - shell_layer_alpha: tuple - beam_shell_line_work: tuple - point_wrenches: tuple - beam_generalized_material: tuple - increment_attempts: tuple - attempt_history: tuple + + +@dataclass(frozen=True) +class ArcResult: + status: str + amplitude: float + arc_position: float + history: tuple + generation: int + shell_displacement: np.ndarray + beam_positions: np.ndarray + beam_frames: np.ndarray + cell_frames: np.ndarray + cell_resultants: np.ndarray + multipliers: np.ndarray + support_reactions: np.ndarray + applied_dead_load: np.ndarray + free_equilibrium_ratio: float + constraint_max: float + shell_frames: np.ndarray + shell_chart_coordinates: np.ndarray + shell_rotation_anchors: np.ndarray + shell_q4_material: tuple + beam_station_accumulated: tuple + shell_layer_alpha: tuple + beam_shell_line_work: tuple + point_wrenches: tuple + beam_generalized_material: tuple + increment_attempts: tuple + attempt_history: tuple production_qualified: bool = False beam_fibre_material: tuple = () beam_fibre_energy: tuple = () shell_s3_material: tuple = () - - -def prepare(owner,raw): - from ._stiffened_shell_ge_finite_experimental import ( - _owned,_accepted_shell_material_origins,_shell_q4_recovery, - _material_observables,_material_histories) - m,a,driver,state,evaluation,shell_parent,beam_parent=validate_endpoint(owner,raw) + + +def prepare(owner,raw): + from ._stiffened_shell_ge_finite_experimental import ( + _owned,_accepted_shell_material_origins,_shell_q4_recovery, + _material_observables,_material_histories) + m,a,driver,state,evaluation,shell_parent,beam_parent=validate_endpoint(owner,raw) residual,_,relative,gap,shell_next,beam_next=evaluation native=uses_native_material_history(owner);s3=has_native_s3_material(owner) count=len(owner._definition.shell.q4_elements) @@ -60,22 +60,22 @@ def prepare(owner,raw): from ._stiffened_shell_beam_history import histories beam_next=histories(owner._beam_parts,a,'beam') else:beam_next=_material_histories(owner,a['beam_plastic'],a['beam_accumulated']) - history=tuple(tuple(float(x) for x in row) for row in a['history']) - support=np.zeros(owner._K.shape[0]);support[owner._fixed]=residual[owner._fixed] - local=_owned(state.q[:owner._shell_count]);display=local.copy().reshape(-1,6) - display[:,3:]=Rotation.from_matrix(a['shell_frames']).as_rotvec() - result=ArcResult('accepted_prefix',history[-1][1],fsum(row[0] for row in history), - history,m['generation'],_owned(display.ravel()),_owned(driver._beam_positions(state)), - state.frames,state.cells,state.resultants,state.multipliers,_owned(support), - a['applied_load'],relative,gap,a['shell_frames'],local,a['shell_anchors'], + history=tuple(tuple(float(x) for x in row) for row in a['history']) + support=np.zeros(owner._K.shape[0]);support[owner._fixed]=residual[owner._fixed] + local=_owned(state.q[:owner._shell_count]);display=local.copy().reshape(-1,6) + display[:,3:]=Rotation.from_matrix(a['shell_frames']).as_rotvec() + result=ArcResult('accepted_prefix',history[-1][1],fsum(row[0] for row in history), + history,m['generation'],_owned(display.ravel()),_owned(driver._beam_positions(state)), + state.frames,state.cells,state.resultants,state.multipliers,_owned(support), + a['applied_load'],relative,gap,a['shell_frames'],local,a['shell_anchors'], (_shell_q4_recovery(owner._shell_parts[:count],shell_next[:count]) if s3 else _shell_q4_recovery(owner._shell_parts,shell_next) if has_shell_material(owner) else ()),_material_observables(beam_next), - (tuple(tuple(float(v) for v in row['alpha']) for row in shell_next) if has_shell_material(owner) else ()), - driver._line_trial_recovery[1],driver._point_records(state), + (tuple(tuple(float(v) for v in row['alpha']) for row in shell_next) if has_shell_material(owner) else ()), + driver._line_trial_recovery[1],driver._point_records(state), driver._generalized_records(state,beam_parent,beam_next,include_native=native), - tuple(ArcAttempt(**row) for row in m['attempts']), - tuple(tuple(ArcAttempt(**row) for row in group['attempts']) for group in m['attempt_history'])) - driver._state=state;driver._shell_predecessors=shell_parent;driver._beam_predecessors=beam_parent + tuple(ArcAttempt(**row) for row in m['attempts']), + tuple(tuple(ArcAttempt(**row) for row in group['attempts']) for group in m['attempt_history'])) + driver._state=state;driver._shell_predecessors=shell_parent;driver._beam_predecessors=beam_parent if native: from ._stiffened_shell_ge_finite_experimental import _fibre_recovery records,energies=_fibre_recovery(owner,state,beam_parent,beam_next) @@ -84,17 +84,17 @@ def prepare(owner,raw): from ._stiffened_shell_ge_finite_experimental import _shell_s3_recovery result=replace(result,shell_s3_material=_shell_s3_recovery(owner._shell_parts[count:],shell_next[count:])) driver._shell_origins=(shell_next if s3 else _accepted_shell_material_origins(owner,state,shell_next) - if has_shell_material(owner) else shell_next) - driver._beam_origins=beam_next;driver._accepted=result - driver._arc_applied_load=a['applied_load'] - return m,a,driver,result - - + if has_shell_material(owner) else shell_next) + driver._beam_origins=beam_next;driver._accepted=result + driver._arc_applied_load=a['applied_load'] + return m,a,driver,result + + def _bind_predecessor(owner,m,a,live,expected_generation): - from ._stiffened_shell_ge_finite_experimental import _material_arrays,_shell_material_arrays - from ._stiffened_shell_rotation_charts import physical_frames + from ._stiffened_shell_ge_finite_experimental import _material_arrays,_shell_material_arrays + from ._stiffened_shell_rotation_charts import physical_frames if (live is None or m['generation']!=expected_generation+1 - or m['predecessor_sha256']!=sha256(owner.checkpoint()).hexdigest()): + or m['predecessor_sha256']!=sha256(owner.checkpoint()).hexdigest()): raise ValueError('arc endpoint has a different accepted predecessor') saved=getattr(owner,'_arc_snapshot',None) if saved is not None: @@ -105,12 +105,12 @@ def _bind_predecessor(owner,m,a,live,expected_generation): native=uses_native_material_history(owner);s3=has_native_s3_material(owner) count=len(owner._definition.shell.q4_elements) shell=(_shell_material_arrays(live._shell_origins[:count] if s3 else live._shell_origins) if has_shell_material(owner) else ()) - frames=np.concatenate((physical_frames(live._state.q[:owner._shell_count], - live._state.shell_anchors),live._state.frames)) - applied=getattr(live,'_arc_applied_load',None) - if applied is None:applied=getattr(live,'_displacement_applied_load',None) - if applied is None: - applied=live._applied_load if live._programme is not None else live._load_factor*live._pattern + frames=np.concatenate((physical_frames(live._state.q[:owner._shell_count], + live._state.shell_anchors),live._state.frames)) + applied=getattr(live,'_arc_applied_load',None) + if applied is None:applied=getattr(live,'_displacement_applied_load',None) + if applied is None: + applied=live._applied_load if live._programme is not None else live._load_factor*live._pattern witnesses=(('origin_translations',live._state.q[:nodes*6].reshape(-1,6)[:,:3]), ('origin_frames',frames)) if native: @@ -129,25 +129,25 @@ def _bind_predecessor(owner,m,a,live,expected_generation): blobs=tuple(element.serialize_nonlinear_state(owner._shell_model.mesh,material,origin,3) for (_,element,_,_),origin in zip(owner._shell_parts[count:],live._shell_origins[count:])) if a['s3_states'][len(blobs):]!=blobs:raise ValueError('arc S3 predecessor mismatch') - if (any(not np.array_equal(a[name],value) for name,value in witnesses) - or not np.array_equal(a['base_load']+m['amplitude_origin']*a['load_direction'],applied)): - raise ValueError('arc physical/material predecessor mismatch') - - -def publish(owner,raw,*,expected_driver,expected_generation,cancellation_token=None,restoring=False): - m,a,driver,result=prepare(owner,raw) - cancellation_safe_point(cancellation_token,'stiffened-shell.arc.publish') - with owner._commit_lock: - owner._require_open() - if owner._generation!=expected_generation or owner._finite_driver is not expected_driver: - raise ValueError('stale arc publication') - if restoring: - if expected_driver is not None or owner._accepted is not None or expected_generation!=0: - raise ValueError('arc restore requires a fresh owner') - else: - _bind_predecessor(owner,m,a,expected_driver,expected_generation) - cancellation_safe_point(cancellation_token,'stiffened-shell.arc.commit') - driver.owner=owner;owner._finite_driver=driver;owner._generation=result.generation - owner._arc_snapshot=(raw,m,a) - owner._displacement_snapshot=None;owner._displacement_adaptive=None - return result + if (any(not np.array_equal(a[name],value) for name,value in witnesses) + or not np.array_equal(a['base_load']+m['amplitude_origin']*a['load_direction'],applied)): + raise ValueError('arc physical/material predecessor mismatch') + + +def publish(owner,raw,*,expected_driver,expected_generation,cancellation_token=None,restoring=False): + m,a,driver,result=prepare(owner,raw) + cancellation_safe_point(cancellation_token,'stiffened-shell.arc.publish') + with owner._commit_lock: + owner._require_open() + if owner._generation!=expected_generation or owner._finite_driver is not expected_driver: + raise ValueError('stale arc publication') + if restoring: + if expected_driver is not None or owner._accepted is not None or expected_generation!=0: + raise ValueError('arc restore requires a fresh owner') + else: + _bind_predecessor(owner,m,a,expected_driver,expected_generation) + cancellation_safe_point(cancellation_token,'stiffened-shell.arc.commit') + driver.owner=owner;owner._finite_driver=driver;owner._generation=result.generation + owner._arc_snapshot=(raw,m,a) + owner._displacement_snapshot=None;owner._displacement_adaptive=None + return result diff --git a/src/anysolver/_stiffened_shell_arc_trial.py b/src/anyfesolver/_stiffened_shell_arc_trial.py similarity index 98% rename from src/anysolver/_stiffened_shell_arc_trial.py rename to src/anyfesolver/_stiffened_shell_arc_trial.py index f2aa7eff0..6b3f7a3f1 100644 --- a/src/anysolver/_stiffened_shell_arc_trial.py +++ b/src/anyfesolver/_stiffened_shell_arc_trial.py @@ -1,158 +1,158 @@ -"""Uncommitted local tangent-plane continuation of coupled BL5/J2 equilibria. - -Experimental fixed mesh, explicit frozen physical weights and affine -translational dead loads. The public controller owns commit; no capacity claim. -""" -from dataclasses import dataclass -import numpy as np -from .control import cancellation_safe_point -from ._ge_beam3_pose_joint import _exp_terms -from ._stiffened_shell_rotation_charts import physical_frames +"""Uncommitted local tangent-plane continuation of coupled BL5/J2 equilibria. + +Experimental fixed mesh, explicit frozen physical weights and affine +translational dead loads. The public controller owns commit; no capacity claim. +""" +from dataclasses import dataclass +import numpy as np +from .control import cancellation_safe_point +from ._ge_beam3_pose_joint import _exp_terms +from ._stiffened_shell_rotation_charts import physical_frames from ._stiffened_shell_arc_metric import (PhysicalChordMetric, NativeDirectorChordMetric, ChordDomainError, _owned, require_metric_owner, require_director_chart) -from ._stiffened_shell_displacement_corrector import ( - bordered_correction, bordered_path_correction, DisplacementCorrectorFailure) - - -@dataclass(frozen=True) -class ArcTrial: - state: object - amplitude: float - evaluation: tuple - accepted_generation: int - predecessor_state: object - shell_predecessor: object - beam_predecessor: object - radius: float - path_error: float - evaluations: int - linear_solves: int - rejected_trials: int - event_cell_evaluations: int - base_load: np.ndarray - load_direction: np.ndarray - normal_translations: np.ndarray - normal_spins: np.ndarray +from ._stiffened_shell_displacement_corrector import ( + bordered_correction, bordered_path_correction, DisplacementCorrectorFailure) + + +@dataclass(frozen=True) +class ArcTrial: + state: object + amplitude: float + evaluation: tuple + accepted_generation: int + predecessor_state: object + shell_predecessor: object + beam_predecessor: object + radius: float + path_error: float + evaluations: int + linear_solves: int + rejected_trials: int + event_cell_evaluations: int + base_load: np.ndarray + load_direction: np.ndarray + normal_translations: np.ndarray + normal_spins: np.ndarray metric: PhysicalChordMetric | NativeDirectorChordMetric - predictor_dof: int - orientation: int - amplitude_origin: float - - -class ArcTrialFailure(DisplacementCorrectorFailure): - """Failed uncommitted candidate and work, retained for a caller's cutback.""" - def __init__(self,message,trial): - super().__init__(message) - self.trial=trial - - -@dataclass(frozen=True) -class ArcAttempt: - radius: float - accepted: bool - evaluations: int - linear_solves: int - rejected_trials: int - event_cell_evaluations: int - failure: str | None - - -@dataclass(frozen=True) -class ArcSelection: - """One selected, uncommitted step; not completion of a requested path.""" - requested_radius: float - trial: ArcTrial - attempts: tuple - max_cutbacks: int - max_attempts: int - max_iterations: int - max_backtracks: int - - -class ArcSelectionFailure(RuntimeError): - def __init__(self,message,attempts): - super().__init__(message) - self.attempts=tuple(attempts) - - -def select_trial(driver, *, radius, max_cutbacks=4, max_attempts=5, - attempt_records=None, **kwargs): - """Bounded cutback from one unchanged accepted predecessor. - - Retry only the explicitly typed Newton/backtrack failures emitted below. - Cancellation, stale ownership, programming errors and unclassified numerical - failures propagate. The caller still owns atomic publication and path control. - """ - if (type(max_cutbacks) is not int or not 0<=max_cutbacks<=8 - or type(max_attempts) is not int or not 1<=max_attempts<=64 - or not np.isfinite(radius) or radius<=0.): - raise ValueError("bounded arc selection controls required") - owner=driver.owner - with owner._commit_lock: - generation=owner._generation;parent=driver._state - shell=driver._shell_origins;beam=driver._beam_origins - kwargs=dict(kwargs) - kwargs['load_direction']=np.array(kwargs['load_direction'],dtype=float,copy=True) - if kwargs.get('load_base') is not None: - kwargs['load_base']=_owned(kwargs['load_base']) - attempts=[] - def current(): - if (owner._finite_driver is not driver or owner._generation!=generation - or driver._state is not parent or driver._shell_origins is not shell - or driver._beam_origins is not beam): - raise ValueError("stale arc selection predecessor") - cancellation_safe_point(kwargs.get('cancellation_token'),"stiffened-shell.arc.selection") - for depth in range(min(max_attempts,max_cutbacks+1)): - current() - actual=float(radius)*(.5**depth) - if not np.isfinite(actual*actual) or actual*actual<=0.: - raise ArcSelectionFailure("arc radius no longer representable",attempts) - failure=None - try: - trial=correct(driver,radius=actual,**kwargs) - except ArcTrialFailure as error: - trial=error.trial;failure=str(error) - with owner._commit_lock:current() - row=ArcAttempt(actual,failure is None,trial.evaluations,trial.linear_solves, - trial.rejected_trials,trial.event_cell_evaluations,failure) - attempts.append(row) - if attempt_records is not None:attempt_records.append(row) - if failure is None: - with owner._commit_lock: - current() - return ArcSelection(float(radius),trial,tuple(attempts),max_cutbacks,max_attempts, - kwargs.get('max_iterations',20),kwargs.get('max_backtracks',12)) - raise ArcSelectionFailure("arc cutback/attempt limit",attempts) - - -def path_row(driver,state,parent,metric,normal=None): - """Squared physical chord and row in the driver's actual update columns.""" + predictor_dof: int + orientation: int + amplitude_origin: float + + +class ArcTrialFailure(DisplacementCorrectorFailure): + """Failed uncommitted candidate and work, retained for a caller's cutback.""" + def __init__(self,message,trial): + super().__init__(message) + self.trial=trial + + +@dataclass(frozen=True) +class ArcAttempt: + radius: float + accepted: bool + evaluations: int + linear_solves: int + rejected_trials: int + event_cell_evaluations: int + failure: str | None + + +@dataclass(frozen=True) +class ArcSelection: + """One selected, uncommitted step; not completion of a requested path.""" + requested_radius: float + trial: ArcTrial + attempts: tuple + max_cutbacks: int + max_attempts: int + max_iterations: int + max_backtracks: int + + +class ArcSelectionFailure(RuntimeError): + def __init__(self,message,attempts): + super().__init__(message) + self.attempts=tuple(attempts) + + +def select_trial(driver, *, radius, max_cutbacks=4, max_attempts=5, + attempt_records=None, **kwargs): + """Bounded cutback from one unchanged accepted predecessor. + + Retry only the explicitly typed Newton/backtrack failures emitted below. + Cancellation, stale ownership, programming errors and unclassified numerical + failures propagate. The caller still owns atomic publication and path control. + """ + if (type(max_cutbacks) is not int or not 0<=max_cutbacks<=8 + or type(max_attempts) is not int or not 1<=max_attempts<=64 + or not np.isfinite(radius) or radius<=0.): + raise ValueError("bounded arc selection controls required") + owner=driver.owner + with owner._commit_lock: + generation=owner._generation;parent=driver._state + shell=driver._shell_origins;beam=driver._beam_origins + kwargs=dict(kwargs) + kwargs['load_direction']=np.array(kwargs['load_direction'],dtype=float,copy=True) + if kwargs.get('load_base') is not None: + kwargs['load_base']=_owned(kwargs['load_base']) + attempts=[] + def current(): + if (owner._finite_driver is not driver or owner._generation!=generation + or driver._state is not parent or driver._shell_origins is not shell + or driver._beam_origins is not beam): + raise ValueError("stale arc selection predecessor") + cancellation_safe_point(kwargs.get('cancellation_token'),"stiffened-shell.arc.selection") + for depth in range(min(max_attempts,max_cutbacks+1)): + current() + actual=float(radius)*(.5**depth) + if not np.isfinite(actual*actual) or actual*actual<=0.: + raise ArcSelectionFailure("arc radius no longer representable",attempts) + failure=None + try: + trial=correct(driver,radius=actual,**kwargs) + except ArcTrialFailure as error: + trial=error.trial;failure=str(error) + with owner._commit_lock:current() + row=ArcAttempt(actual,failure is None,trial.evaluations,trial.linear_solves, + trial.rejected_trials,trial.event_cell_evaluations,failure) + attempts.append(row) + if attempt_records is not None:attempt_records.append(row) + if failure is None: + with owner._commit_lock: + current() + return ArcSelection(float(radius),trial,tuple(attempts),max_cutbacks,max_attempts, + kwargs.get('max_iterations',20),kwargs.get('max_backtracks',12)) + raise ArcSelectionFailure("arc cutback/attempt limit",attempts) + + +def path_row(driver,state,parent,metric,normal=None): + """Squared physical chord and row in the driver's actual update columns.""" owner=driver.owner nodal=owner._shell_count+6*len(owner._beam_ids) if type(metric) is NativeDirectorChordMetric: require_director_chart(parent.q[:owner._shell_count]) require_director_chart(state.q[:owner._shell_count]) - reference=np.concatenate((physical_frames(parent.q[:owner._shell_count],parent.shell_anchors),parent.frames)) - frames=np.concatenate((physical_frames(state.q[:owner._shell_count],state.shell_anchors),state.frames)) - displacement=(state.q[:nodal]-parent.q[:nodal]).reshape(-1,6)[:,:3] - value,translations,spins=(metric.evaluate(displacement,frames,reference) if normal is None - else metric.plane(displacement,frames,reference,*normal)) - gradient=np.zeros(len(state.q)+len(state.multipliers)) - rows=gradient[:nodal].reshape(-1,6) - rows[:,:3]=translations;rows[:,3:]=spins - for i,chart in enumerate(state.q[:owner._shell_count].reshape(-1,6)): - rows[i,3:]=_exp_terms(chart[3:])[1].T@spins[i] - return value,gradient - - -def correct(driver, *, load_direction, metric, radius, predictor_dof, - orientation, max_iterations=20, max_backtracks=12, - cancellation_token=None, iteration_records=None, - load_base=None, amplitude_origin=0.): - """Return a candidate; all trial material updates share one predecessor.""" - from ._stiffened_shell_ge_finite_experimental import _RotationStepTooLarge - from ._stiffened_shell_bl5_local_experimental import BL5TrialDomainError - from ._stiffened_shell_branch_event_trial import trial_fraction + reference=np.concatenate((physical_frames(parent.q[:owner._shell_count],parent.shell_anchors),parent.frames)) + frames=np.concatenate((physical_frames(state.q[:owner._shell_count],state.shell_anchors),state.frames)) + displacement=(state.q[:nodal]-parent.q[:nodal]).reshape(-1,6)[:,:3] + value,translations,spins=(metric.evaluate(displacement,frames,reference) if normal is None + else metric.plane(displacement,frames,reference,*normal)) + gradient=np.zeros(len(state.q)+len(state.multipliers)) + rows=gradient[:nodal].reshape(-1,6) + rows[:,:3]=translations;rows[:,3:]=spins + for i,chart in enumerate(state.q[:owner._shell_count].reshape(-1,6)): + rows[i,3:]=_exp_terms(chart[3:])[1].T@spins[i] + return value,gradient + + +def correct(driver, *, load_direction, metric, radius, predictor_dof, + orientation, max_iterations=20, max_backtracks=12, + cancellation_token=None, iteration_records=None, + load_base=None, amplitude_origin=0.): + """Return a candidate; all trial material updates share one predecessor.""" + from ._stiffened_shell_ge_finite_experimental import _RotationStepTooLarge + from ._stiffened_shell_bl5_local_experimental import BL5TrialDomainError + from ._stiffened_shell_branch_event_trial import trial_fraction owner=driver.owner n=owner._K.shape[0]; nodal=owner._shell_count+6*len(owner._beam_ids) from ._stiffened_shell_affine_endpoint import is_native_point_material,is_native_material_bl5_arc @@ -163,95 +163,95 @@ def correct(driver, *, load_direction, metric, radius, predictor_dof, if native: from ._stiffened_shell_arc_checkpoint import require_native_seed require_native_seed(owner,driver) - size=n+len(driver._state.multipliers) + size=n+len(driver._state.multipliers) if (len(metric.weights)!=nodal//6 or not (owner._bl5_shell_material or getattr(owner,"_curved_reference",False) or native) or driver._accepted is None - or driver._external is not None): - raise ValueError("accepted admitted arc owner with fixed physical metric required") - if (not np.isfinite(radius) or radius<=0. or type(orientation) is not int or orientation not in (-1,1) - or type(predictor_dof) is not int or predictor_dof not in owner._free - or not 0<=predictor_dof=3 - or type(max_iterations) is not int or not 1<=max_iterations<=24 - or type(max_backtracks) is not int or not 0<=max_backtracks<=12): - raise ValueError("bounded radius, orientation and physical predictor required") - radius2=float(radius)*float(radius) - if not np.isfinite(radius2) or radius2<=0.: - raise ValueError("representable squared radius required") - pattern=np.array(load_direction,dtype=float,copy=True) - allowed=np.zeros(n,dtype=bool) - for start in range(0,nodal,6):allowed[start:start+3]=True - if (pattern.shape!=(n,) or not np.isfinite(pattern).all() - or np.any(pattern[~allowed]) or not np.any(pattern[owner._free])): - raise ValueError("finite free translational dead-load direction required") - with owner._commit_lock: - if owner._finite_driver is not driver: - raise ValueError("stale continuation driver") - generation=owner._generation;parent=driver._state - shell=driver._shell_origins;beam=driver._beam_origins - accepted_load=getattr(driver,"_arc_applied_load",None) - if accepted_load is None:accepted_load=getattr(driver,"_displacement_applied_load",None) - if accepted_load is None: - accepted_load=driver._applied_load if driver._programme is not None else driver._load_factor*driver._pattern - base=_owned(accepted_load if load_base is None else load_base) - if (not isinstance(amplitude_origin,(float,int,np.floating,np.integer)) - or isinstance(amplitude_origin,(bool,np.bool_)) or not np.isfinite(amplitude_origin) - or base.shape!=(n,) or not np.isfinite(base).all() or np.any(base[~allowed]) - or not np.array_equal(base+float(amplitude_origin)*pattern,accepted_load)): - raise ValueError("affine arc load must start at the accepted endpoint") - pattern=_owned(pattern) - free=np.r_[owner._free,np.arange(n,size)] - direction=np.r_[pattern,np.zeros(size-n)] - energy=float(np.max((abs(owner._K)@owner._coordinate_scale)*owner._coordinate_scale)) - if not np.isfinite(energy) or energy<=0.:raise ValueError("positive reference work scale required") - weights=np.r_[owner._coordinate_scale,energy/owner._constraint_scale]/energy - evaluations=solves=rejected=0; events=[] - - def current(): - if (owner._finite_driver is not driver or owner._generation!=generation or driver._state is not parent - or driver._shell_origins is not shell or driver._beam_origins is not beam): - raise ValueError("stale continuation predecessor") - cancellation_safe_point(cancellation_token,"stiffened-shell.arc.trial") - - def evaluate(state,amplitude): - nonlocal evaluations - current();evaluations+=1 - return driver._assemble(state,0.,shell,beam,applied_load=base+amplitude*pattern) - - def path(state): - value,gradient=path_row(driver,state,parent,metric,normal) - return value-radius,gradient - - def merit(state,evaluation): - gap,_=path(state) - return float(np.hypot(np.linalg.norm(evaluation[0][free]*weights[free]),gap)) - - state=driver._increment_origin(parent);amplitude=float(amplitude_origin);evaluation=evaluate(state,amplitude) - # Homogeneous equilibrium tangent, oriented by a physical free translation. - # Retained entries follow that tangent but do not determine its norm. - step,delta=bordered_correction(evaluation[1],np.zeros(size),direction, - predictor_dof,-orientation*metric.length,free);solves+=1 - translations=step[:nodal].reshape(-1,6)[:,:3].copy() - spins=step[:nodal].reshape(-1,6)[:,3:].copy() - for i,chart in enumerate(state.q[:owner._shell_count].reshape(-1,6)): - spins[i]=_exp_terms(chart[3:])[1]@spins[i] + or driver._external is not None): + raise ValueError("accepted admitted arc owner with fixed physical metric required") + if (not np.isfinite(radius) or radius<=0. or type(orientation) is not int or orientation not in (-1,1) + or type(predictor_dof) is not int or predictor_dof not in owner._free + or not 0<=predictor_dof=3 + or type(max_iterations) is not int or not 1<=max_iterations<=24 + or type(max_backtracks) is not int or not 0<=max_backtracks<=12): + raise ValueError("bounded radius, orientation and physical predictor required") + radius2=float(radius)*float(radius) + if not np.isfinite(radius2) or radius2<=0.: + raise ValueError("representable squared radius required") + pattern=np.array(load_direction,dtype=float,copy=True) + allowed=np.zeros(n,dtype=bool) + for start in range(0,nodal,6):allowed[start:start+3]=True + if (pattern.shape!=(n,) or not np.isfinite(pattern).all() + or np.any(pattern[~allowed]) or not np.any(pattern[owner._free])): + raise ValueError("finite free translational dead-load direction required") + with owner._commit_lock: + if owner._finite_driver is not driver: + raise ValueError("stale continuation driver") + generation=owner._generation;parent=driver._state + shell=driver._shell_origins;beam=driver._beam_origins + accepted_load=getattr(driver,"_arc_applied_load",None) + if accepted_load is None:accepted_load=getattr(driver,"_displacement_applied_load",None) + if accepted_load is None: + accepted_load=driver._applied_load if driver._programme is not None else driver._load_factor*driver._pattern + base=_owned(accepted_load if load_base is None else load_base) + if (not isinstance(amplitude_origin,(float,int,np.floating,np.integer)) + or isinstance(amplitude_origin,(bool,np.bool_)) or not np.isfinite(amplitude_origin) + or base.shape!=(n,) or not np.isfinite(base).all() or np.any(base[~allowed]) + or not np.array_equal(base+float(amplitude_origin)*pattern,accepted_load)): + raise ValueError("affine arc load must start at the accepted endpoint") + pattern=_owned(pattern) + free=np.r_[owner._free,np.arange(n,size)] + direction=np.r_[pattern,np.zeros(size-n)] + energy=float(np.max((abs(owner._K)@owner._coordinate_scale)*owner._coordinate_scale)) + if not np.isfinite(energy) or energy<=0.:raise ValueError("positive reference work scale required") + weights=np.r_[owner._coordinate_scale,energy/owner._constraint_scale]/energy + evaluations=solves=rejected=0; events=[] + + def current(): + if (owner._finite_driver is not driver or owner._generation!=generation or driver._state is not parent + or driver._shell_origins is not shell or driver._beam_origins is not beam): + raise ValueError("stale continuation predecessor") + cancellation_safe_point(cancellation_token,"stiffened-shell.arc.trial") + + def evaluate(state,amplitude): + nonlocal evaluations + current();evaluations+=1 + return driver._assemble(state,0.,shell,beam,applied_load=base+amplitude*pattern) + + def path(state): + value,gradient=path_row(driver,state,parent,metric,normal) + return value-radius,gradient + + def merit(state,evaluation): + gap,_=path(state) + return float(np.hypot(np.linalg.norm(evaluation[0][free]*weights[free]),gap)) + + state=driver._increment_origin(parent);amplitude=float(amplitude_origin);evaluation=evaluate(state,amplitude) + # Homogeneous equilibrium tangent, oriented by a physical free translation. + # Retained entries follow that tangent but do not determine its norm. + step,delta=bordered_correction(evaluation[1],np.zeros(size),direction, + predictor_dof,-orientation*metric.length,free);solves+=1 + translations=step[:nodal].reshape(-1,6)[:,:3].copy() + spins=step[:nodal].reshape(-1,6)[:,3:].copy() + for i,chart in enumerate(state.q[:owner._shell_count].reshape(-1,6)): + spins[i]=_exp_terms(chart[3:])[1]@spins[i] if type(metric) is NativeDirectorChordMetric: reference=np.concatenate((physical_frames(parent.q[:owner._shell_count],parent.shell_anchors),parent.frames)) norm=float(np.sqrt(metric.tangent_norm_squared(reference,translations,spins))) else: norm=float(np.sqrt(np.sum(metric.weights*(np.sum((translations/metric.length)**2,axis=1) +np.sum(spins*spins,axis=1))))) - if not np.isfinite(norm) or norm<=0.: - raise DisplacementCorrectorFailure("unmeasured physical continuation tangent") - normal=(translations/norm,spins/norm) - step*=radius/norm;delta*=radius/norm - if (not np.isfinite(normal[0]).all() or not np.isfinite(normal[1]).all() - or not np.isfinite(step).all() or not np.isfinite(delta)): - raise DisplacementCorrectorFailure("continuation tangent normalization not representable") + if not np.isfinite(norm) or norm<=0.: + raise DisplacementCorrectorFailure("unmeasured physical continuation tangent") + normal=(translations/norm,spins/norm) + step*=radius/norm;delta*=radius/norm + if (not np.isfinite(normal[0]).all() or not np.isfinite(normal[1]).all() + or not np.isfinite(step).all() or not np.isfinite(delta)): + raise DisplacementCorrectorFailure("continuation tangent normalization not representable") def trial_snapshot(): - gap,_=path(state) - return ArcTrial(state,amplitude,evaluation,generation,parent,shell,beam, - float(radius),float(gap/radius),evaluations,solves,rejected, - sum(row['cell_evaluations'] for row in events),_owned(base),_owned(pattern), + gap,_=path(state) + return ArcTrial(state,amplitude,evaluation,generation,parent,shell,beam, + float(radius),float(gap/radius),evaluations,solves,rejected, + sum(row['cell_evaluations'] for row in events),_owned(base),_owned(pattern), _owned(normal[0]),_owned(normal[1]),metric,predictor_dof,orientation,float(amplitude_origin)) if type(metric) is NativeDirectorChordMetric: # Refuse an invalid accepted chart before assembly above. A predictor @@ -267,17 +267,17 @@ def trial_snapshot(): else: state=driver._advance(state,step,1.);amplitude+=delta evaluation=evaluate(state,amplitude) - for iteration in range(max_iterations+1): - gap,gradient=path(state) - if iteration_records is not None: - iteration_records.append(dict(iteration=iteration,amplitude=amplitude, - equilibrium=float(evaluation[2]),constraint=float(evaluation[3]), - path_error=float(gap/radius),evaluations=evaluations, - solves=solves,rejected=rejected, - events=sum(row['cell_evaluations'] for row in events))) - if evaluation[2]<=1e-8 and evaluation[3]<=1e-9 and abs(gap)/radius<=1e-9: - with owner._commit_lock: - current() + for iteration in range(max_iterations+1): + gap,gradient=path(state) + if iteration_records is not None: + iteration_records.append(dict(iteration=iteration,amplitude=amplitude, + equilibrium=float(evaluation[2]),constraint=float(evaluation[3]), + path_error=float(gap/radius),evaluations=evaluations, + solves=solves,rejected=rejected, + events=sum(row['cell_evaluations'] for row in events))) + if evaluation[2]<=1e-8 and evaluation[3]<=1e-9 and abs(gap)/radius<=1e-9: + with owner._commit_lock: + current() trial=trial_snapshot() from ._stiffened_shell_arc_checkpoint import requires_coordinate_progress if requires_coordinate_progress(owner): @@ -285,26 +285,26 @@ def trial_snapshot(): if not progress>0.: raise ArcTrialFailure("native arc selected coordinate made no oriented progress",trial) return trial - if iteration==max_iterations: - raise ArcTrialFailure("local arc Newton limit",trial_snapshot()) - step,delta=bordered_path_correction(evaluation[1],evaluation[0],direction,gradient,gap,free);solves+=1 - record=dict(cell_evaluations=0);events.append(record) + if iteration==max_iterations: + raise ArcTrialFailure("local arc Newton limit",trial_snapshot()) + step,delta=bordered_path_correction(evaluation[1],evaluation[0],direction,gradient,gap,free);solves+=1 + record=dict(cell_evaluations=0);events.append(record) initial=1. if not native:initial,_=trial_fraction(driver,state,step,beam,current,record) - old=merit(state,evaluation) - for backtrack in range(max_backtracks+1): - amount=initial*.5**backtrack - try: + old=merit(state,evaluation) + for backtrack in range(max_backtracks+1): + amount=initial*.5**backtrack + try: candidate=driver._advance(state,step,amount) if type(metric) is NativeDirectorChordMetric: path_row(driver,candidate,parent,metric,normal) value=amplitude+amount*delta - changed=evaluate(candidate,value) - improved=merit(candidate,changed)eps or np.max(abs(e.T@e-np.eye(2)))>eps or np.max(abs(e.T@n))>eps: - raise ValueError("unit physical director and orthonormal owned tangent basis required") - object.__setattr__(self,"reference_director",n);object.__setattr__(self,"tangent_basis",e) - - def descriptor(self): - return dict(law=LAW_ID,footprint_id=self.footprint_id,shell_nodes=self.shell_nodes,beam_node=self.beam_node, - patch_cells=self.patch_cells,semantics="complete_selected_cell_patch" if self.patch_cells else "selected_nodes_only", - configuration="reference_linear_static_with_objective_spectral_continuation",rows_per_node=5,normal_spin="independent", - director=tuple(self.reference_director),tangent_basis=tuple(tuple(row) for row in self.tangent_basis),production_qualified=False) - -@dataclass(frozen=True) -class B2PhysicalRigidFootprintSelection: - footprint_ids: tuple - def __post_init__(self): - if isinstance(self.footprint_ids,(str,bytes)): raise ValueError("explicit physical footprint recovery sequence required") - values=tuple(self.footprint_ids) - if not values or any(type(v)is not str or not v for v in values) or len(set(values))!=len(values): - raise ValueError("distinct physical footprint selection IDs required") - object.__setattr__(self,"footprint_ids",values) - -@dataclass(frozen=True) -class PhysicalFootprintNode: - footprint_id: str - shell_node: int - beam_node: int - row_start: int - shell_slots: tuple - beam_slots: tuple - shell_position: tuple - beam_position: tuple - director: np.ndarray - tangent_basis: np.ndarray - constraint: np.ndarray - constraint_hessians: np.ndarray - row_count: int = 5 - - @property - def shell_matrix(self): return self.constraint[:,:6] - @property - def beam_matrix(self): return self.constraint[:,6:] - - def functional(self,shell_pose,beam_pose): - shell=_owned(shell_pose,(6,));beam=_owned(beam_pose,(6,)) + if not self.patch_cells: raise ValueError("physical rigid footprint requires complete patch_cells") + n=_owned(self.reference_director,(3,));e=_owned(self.tangent_basis,(3,2)) + eps=128*np.finfo(float).eps + if abs(n@n-1.)>eps or np.max(abs(e.T@e-np.eye(2)))>eps or np.max(abs(e.T@n))>eps: + raise ValueError("unit physical director and orthonormal owned tangent basis required") + object.__setattr__(self,"reference_director",n);object.__setattr__(self,"tangent_basis",e) + + def descriptor(self): + return dict(law=LAW_ID,footprint_id=self.footprint_id,shell_nodes=self.shell_nodes,beam_node=self.beam_node, + patch_cells=self.patch_cells,semantics="complete_selected_cell_patch" if self.patch_cells else "selected_nodes_only", + configuration="reference_linear_static_with_objective_spectral_continuation",rows_per_node=5,normal_spin="independent", + director=tuple(self.reference_director),tangent_basis=tuple(tuple(row) for row in self.tangent_basis),production_qualified=False) + +@dataclass(frozen=True) +class B2PhysicalRigidFootprintSelection: + footprint_ids: tuple + def __post_init__(self): + if isinstance(self.footprint_ids,(str,bytes)): raise ValueError("explicit physical footprint recovery sequence required") + values=tuple(self.footprint_ids) + if not values or any(type(v)is not str or not v for v in values) or len(set(values))!=len(values): + raise ValueError("distinct physical footprint selection IDs required") + object.__setattr__(self,"footprint_ids",values) + +@dataclass(frozen=True) +class PhysicalFootprintNode: + footprint_id: str + shell_node: int + beam_node: int + row_start: int + shell_slots: tuple + beam_slots: tuple + shell_position: tuple + beam_position: tuple + director: np.ndarray + tangent_basis: np.ndarray + constraint: np.ndarray + constraint_hessians: np.ndarray + row_count: int = 5 + + @property + def shell_matrix(self): return self.constraint[:,:6] + @property + def beam_matrix(self): return self.constraint[:,6:] + + def functional(self,shell_pose,beam_pose): + shell=_owned(shell_pose,(6,));beam=_owned(beam_pose,(6,)) qb=Rotation.from_rotvec(beam[3:].copy()).as_matrix();qs=Rotation.from_rotvec(shell[3:].copy()).as_matrix() - relative=qb.T@qs@self.director - if self.director@relative<=0.: raise ValueError("physical footprint director left positive hemisphere") - arm=np.array([fsum(_difference(float(a),float(b))) for a,b in zip(self.shell_position,self.beam_position)]) - return np.r_[qb.T@(arm+shell[:3]-beam[:3])-arm,self.tangent_basis.T@relative] - - def multiplier_hessian(self,multiplier): - lam=_owned(multiplier,(5,)) - return np.einsum('i,iab->ab',lam,self.constraint_hessians) - -def _node(group,item,row_start): - n=group.reference_director;e=group.tangent_basis - arm=np.array([fsum(_difference(float(a),float(b))) for a,b in zip(item.shell_position,item.beam_position)]) - c=np.zeros((5,12));c[:3,:3]=np.eye(3);c[:3,6:9]=-np.eye(3);c[:3,9:]=_skew(arm) - c[3:,3:6]=-e.T@_skew(n);c[3:,9:]=e.T@_skew(n) + relative=qb.T@qs@self.director + if self.director@relative<=0.: raise ValueError("physical footprint director left positive hemisphere") + arm=np.array([fsum(_difference(float(a),float(b))) for a,b in zip(self.shell_position,self.beam_position)]) + return np.r_[qb.T@(arm+shell[:3]-beam[:3])-arm,self.tangent_basis.T@relative] + + def multiplier_hessian(self,multiplier): + lam=_owned(multiplier,(5,)) + return np.einsum('i,iab->ab',lam,self.constraint_hessians) + +def _node(group,item,row_start): + n=group.reference_director;e=group.tangent_basis + arm=np.array([fsum(_difference(float(a),float(b))) for a,b in zip(item.shell_position,item.beam_position)]) + c=np.zeros((5,12));c[:3,:3]=np.eye(3);c[:3,6:9]=-np.eye(3);c[:3,9:]=_skew(arm) + c[3:,3:6]=-e.T@_skew(n);c[3:,9:]=e.T@_skew(n) h=np.zeros((5,12,12));basis=np.eye(3) arm_cross=np.cross(basis,arm);director_cross=np.cross(basis,n) for i in range(3): @@ -113,12 +113,12 @@ def _node(group,item,row_start): h[3:,3+i,9+j]=e.T@(-np.cross(basis[j],director_cross[i])) h[3:,9+j,3+i]=h[3:,3+i,9+j] h[3:,9+i,9+j]=e.T@(.5*(np.cross(basis[i],director_cross[j])+np.cross(basis[j],director_cross[i]))) - return PhysicalFootprintNode(group.footprint_id,item.shell_node,item.beam_node,row_start,item.shell_slots,item.beam_slots, - item.shell_position,item.beam_position,n,e,_owned(c,(5,12)),_owned(h,(5,12,12))) - -def compile_physical_footprints(groups,positions,shells,beam_positions,shell_index,beam_index,points): - groups=tuple(groups) - if any(type(g)is not B2PhysicalRigidFootprint for g in groups):raise ValueError("typed physical rigid footprints required") + return PhysicalFootprintNode(group.footprint_id,item.shell_node,item.beam_node,row_start,item.shell_slots,item.beam_slots, + item.shell_position,item.beam_position,n,e,_owned(c,(5,12)),_owned(h,(5,12,12))) + +def compile_physical_footprints(groups,positions,shells,beam_positions,shell_index,beam_index,points): + groups=tuple(groups) + if any(type(g)is not B2PhysicalRigidFootprint for g in groups):raise ValueError("typed physical rigid footprints required") # Reconstruct owned records, independently of the legacy six-row/Q4 policy. groups=tuple(B2PhysicalRigidFootprint(g.footprint_id,g.shell_nodes,g.beam_node, g.reference_director,g.tangent_basis,g.patch_cells) for g in groups) @@ -130,108 +130,108 @@ def compile_physical_footprints(groups,positions,shells,beam_positions,shell_ind for shell in shells: for node in dict.fromkeys(shell.node_ids): shells_by_node.setdefault(node,[]).append(shell) - for group in groups: - n=group.reference_director;base=np.asarray(positions[group.shell_nodes[0]]) - for node in group.shell_nodes: - d=np.asarray(positions[node])-base - if abs(d@n)>eps*(abs(d)@abs(n)):raise ValueError("physical footprint selected nodes must be coplanar with owned director") + for group in groups: + n=group.reference_director;base=np.asarray(positions[group.shell_nodes[0]]) + for node in group.shell_nodes: + d=np.asarray(positions[node])-base + if abs(d@n)>eps*(abs(d)@abs(n)):raise ValueError("physical footprint selected nodes must be coplanar with owned director") for shell in shells_by_node.get(node,()): if np.max(abs(np.asarray(shell.reference_normal)-n))>eps: - raise ValueError("physical footprint ambiguous director seam") - made=tuple(_node(by_id[item.footprint_id],item,6*len(points)+5*i) for i,item in enumerate(old)) - return groups,made - -def checked_selection(selection,groups): - if selection is None:return () - if type(selection)is not B2PhysicalRigidFootprintSelection:raise ValueError("typed physical footprint selection required") - if any(name not in {g.footprint_id for g in groups} for name in selection.footprint_ids):raise ValueError("physical footprint selection not compiled") - return selection.footprint_ids - -@dataclass(frozen=True) -class PhysicalFootprintNodeAction: - shell_node_id: int - beam_node_id: int - row_start: int - shell_force_N: tuple - shell_direct_couple_Nm: tuple - beam_force_N: tuple - beam_direct_couple_Nm: tuple - gap: tuple - -@dataclass(frozen=True) -class B2PhysicalRigidFootprintWrench: - footprint_id: str - common_reference_origin_m: tuple - shell_force_N: tuple - shell_moment_Nm: tuple - beam_force_N: tuple - beam_moment_Nm: tuple - node_actions: tuple - law_id: str = LAW_ID - production_qualified: bool = False - -def selected_wrenches(incidences,selected,multipliers,gaps): - made=[] - for name in selected: - sf=[];sm=[];bf=[];bm=[];actions=[];origin=None - for item in incidences: - if item.footprint_id!=name:continue - origin=item.beam_position;lam=np.asarray(multipliers[item.row_start:item.row_start+5]) - actual=-item.constraint.T@lam;s=actual[:6];b=actual[6:] - arm=[_difference(float(a),float(b)) for a,b in zip(item.shell_position,origin)] - moment=np.array([fsum((float(s[i+3]),arm[(i+1)%3][0]*s[(i+2)%3],arm[(i+1)%3][1]*s[(i+2)%3],-arm[(i+2)%3][0]*s[(i+1)%3],-arm[(i+2)%3][1]*s[(i+1)%3])) for i in range(3)]) - sf.append(s[:3]);sm.append(moment);bf.append(b[:3]);bm.append(b[3:]) - actions.append(PhysicalFootprintNodeAction(item.shell_node,item.beam_node,item.row_start, - tuple(s[:3]),tuple(s[3:]),tuple(b[:3]),tuple(b[3:]),tuple(gaps[item.row_start:item.row_start+5]))) - vectors=tuple(tuple(fsum(float(v[i]) for v in rows) for i in range(3)) for rows in (sf,sm,bf,bm)) - if origin is None or not np.isfinite(vectors).all():raise ValueError("finite physical footprint wrench required") - made.append(B2PhysicalRigidFootprintWrench(name,origin,*vectors,tuple(actions))) - return tuple(made) - - -def q4_exp_director_chart_correction(element,mesh,material,displacement): - """Native physical first-work pullback from linear director to Exp chart. - - PL/drilling fields are excluded by the native stationary physical covector. - Only the flat, strict-zero-shear new spectral operation calls this helper. - """ - recovered=element._recover_planar_mixed_fields(mesh,displacement,material,element.gauss_points) - local_force=recovered["stationary_coupling"]@recovered["stationary_parameters"] - frame=recovered["frame"];n=frame[:,2] - moments=np.array([frame@local_force[6*node+3:6*node+6] for node in range(4)]) - return _exp_director_covector_hessian(n,moments) - - -def _exp_director_covector_hessian(n,moments): - correction=np.zeros((24,24));axes=np.eye(3) - for node,m in enumerate(moments): - for a in range(3): - for b in range(3): - second=.5*(np.cross(axes[a],np.cross(axes[b],n))+np.cross(axes[b],np.cross(axes[a],n))) - correction[6*node+3+a,6*node+3+b]=m@np.cross(n,second) - if not np.isfinite(correction).all():raise ValueError("physical Q4 Exp-director chart work not representable") - return correction - - -def q4_kernel_frame_resultants(element,mesh,material,displacement,resultants): - """Express native physical N/M in each inherited kernel GP frame. - - M is a director-odd first stress moment; N and H are director-even. - No changes are made to the element equations or recovered source data. - """ - native=element._recover_planar_mixed_fields(mesh,displacement,material,element.gauss_points) - physical=element._physical_director_context(native["frame"])[0] - coordinates=element.get_node_coordinates(mesh) - output=np.empty((len(element.gauss_points),6)) - for k,(xi,eta) in enumerate(element.gauss_points): - _,dxi,deta=element.compute_shape_functions(float(xi),float(eta)) - kernel,*_=element._local_frame_and_derivatives(coordinates,dxi,deta) - rotation=kernel[:,:2].T@physical[:,:2] - polarity=float(kernel[:,2]@physical[:,2]) - if abs(abs(polarity)-1.)>128*np.finfo(float).eps:raise ValueError("flat Q4 physical / kernel director mismatch") - for start,sign in ((0,1.),(3,polarity)): - x,y,xy=resultants[k,start:start+3] - transformed=sign*(rotation@np.array(((x,xy),(xy,y)))@rotation.T) - output[k,start:start+3]=(transformed[0,0],transformed[1,1],transformed[0,1]) - if not np.isfinite(output).all():raise ValueError("Q4 physical stress frame transformation not representable") - return output + raise ValueError("physical footprint ambiguous director seam") + made=tuple(_node(by_id[item.footprint_id],item,6*len(points)+5*i) for i,item in enumerate(old)) + return groups,made + +def checked_selection(selection,groups): + if selection is None:return () + if type(selection)is not B2PhysicalRigidFootprintSelection:raise ValueError("typed physical footprint selection required") + if any(name not in {g.footprint_id for g in groups} for name in selection.footprint_ids):raise ValueError("physical footprint selection not compiled") + return selection.footprint_ids + +@dataclass(frozen=True) +class PhysicalFootprintNodeAction: + shell_node_id: int + beam_node_id: int + row_start: int + shell_force_N: tuple + shell_direct_couple_Nm: tuple + beam_force_N: tuple + beam_direct_couple_Nm: tuple + gap: tuple + +@dataclass(frozen=True) +class B2PhysicalRigidFootprintWrench: + footprint_id: str + common_reference_origin_m: tuple + shell_force_N: tuple + shell_moment_Nm: tuple + beam_force_N: tuple + beam_moment_Nm: tuple + node_actions: tuple + law_id: str = LAW_ID + production_qualified: bool = False + +def selected_wrenches(incidences,selected,multipliers,gaps): + made=[] + for name in selected: + sf=[];sm=[];bf=[];bm=[];actions=[];origin=None + for item in incidences: + if item.footprint_id!=name:continue + origin=item.beam_position;lam=np.asarray(multipliers[item.row_start:item.row_start+5]) + actual=-item.constraint.T@lam;s=actual[:6];b=actual[6:] + arm=[_difference(float(a),float(b)) for a,b in zip(item.shell_position,origin)] + moment=np.array([fsum((float(s[i+3]),arm[(i+1)%3][0]*s[(i+2)%3],arm[(i+1)%3][1]*s[(i+2)%3],-arm[(i+2)%3][0]*s[(i+1)%3],-arm[(i+2)%3][1]*s[(i+1)%3])) for i in range(3)]) + sf.append(s[:3]);sm.append(moment);bf.append(b[:3]);bm.append(b[3:]) + actions.append(PhysicalFootprintNodeAction(item.shell_node,item.beam_node,item.row_start, + tuple(s[:3]),tuple(s[3:]),tuple(b[:3]),tuple(b[3:]),tuple(gaps[item.row_start:item.row_start+5]))) + vectors=tuple(tuple(fsum(float(v[i]) for v in rows) for i in range(3)) for rows in (sf,sm,bf,bm)) + if origin is None or not np.isfinite(vectors).all():raise ValueError("finite physical footprint wrench required") + made.append(B2PhysicalRigidFootprintWrench(name,origin,*vectors,tuple(actions))) + return tuple(made) + + +def q4_exp_director_chart_correction(element,mesh,material,displacement): + """Native physical first-work pullback from linear director to Exp chart. + + PL/drilling fields are excluded by the native stationary physical covector. + Only the flat, strict-zero-shear new spectral operation calls this helper. + """ + recovered=element._recover_planar_mixed_fields(mesh,displacement,material,element.gauss_points) + local_force=recovered["stationary_coupling"]@recovered["stationary_parameters"] + frame=recovered["frame"];n=frame[:,2] + moments=np.array([frame@local_force[6*node+3:6*node+6] for node in range(4)]) + return _exp_director_covector_hessian(n,moments) + + +def _exp_director_covector_hessian(n,moments): + correction=np.zeros((24,24));axes=np.eye(3) + for node,m in enumerate(moments): + for a in range(3): + for b in range(3): + second=.5*(np.cross(axes[a],np.cross(axes[b],n))+np.cross(axes[b],np.cross(axes[a],n))) + correction[6*node+3+a,6*node+3+b]=m@np.cross(n,second) + if not np.isfinite(correction).all():raise ValueError("physical Q4 Exp-director chart work not representable") + return correction + + +def q4_kernel_frame_resultants(element,mesh,material,displacement,resultants): + """Express native physical N/M in each inherited kernel GP frame. + + M is a director-odd first stress moment; N and H are director-even. + No changes are made to the element equations or recovered source data. + """ + native=element._recover_planar_mixed_fields(mesh,displacement,material,element.gauss_points) + physical=element._physical_director_context(native["frame"])[0] + coordinates=element.get_node_coordinates(mesh) + output=np.empty((len(element.gauss_points),6)) + for k,(xi,eta) in enumerate(element.gauss_points): + _,dxi,deta=element.compute_shape_functions(float(xi),float(eta)) + kernel,*_=element._local_frame_and_derivatives(coordinates,dxi,deta) + rotation=kernel[:,:2].T@physical[:,:2] + polarity=float(kernel[:,2]@physical[:,2]) + if abs(abs(polarity)-1.)>128*np.finfo(float).eps:raise ValueError("flat Q4 physical / kernel director mismatch") + for start,sign in ((0,1.),(3,polarity)): + x,y,xy=resultants[k,start:start+3] + transformed=sign*(rotation@np.array(((x,xy),(xy,y)))@rotation.T) + output[k,start:start+3]=(transformed[0,0],transformed[1,1],transformed[0,1]) + if not np.isfinite(output).all():raise ValueError("Q4 physical stress frame transformation not representable") + return output diff --git a/src/anysolver/_stiffened_shell_b2_q4_panel_experimental.py b/src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py similarity index 98% rename from src/anysolver/_stiffened_shell_b2_q4_panel_experimental.py rename to src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py index 204c937bb..daef41df5 100644 --- a/src/anysolver/_stiffened_shell_b2_q4_panel_experimental.py +++ b/src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py @@ -1,1123 +1,1123 @@ -"""Small elastic multi-Q4/multi-B2 panel with existing F10 point joints. - -This is an experimental reference-linear owner. Shell and beam node identities -are explicit and separate. Reference modes require explicit physical mass. -Explicit nodal footprints have a distinct reference-linear law; virgin supported -modes retain its normal-spin locking and incomplete mechanical qualification. -No line, geometric stiffness, nonlinear state or qualification is inferred. -""" - -from __future__ import annotations - -from functools import wraps -from dataclasses import dataclass, field -from hashlib import sha256 -from math import fsum, isfinite -from numbers import Real -from typing import Callable, Mapping, Sequence - -import numpy as np -from scipy import sparse -from scipy.sparse.linalg import LinearOperator, eigs, ArpackError -from scipy.sparse.csgraph import maximum_bipartite_matching - -from ._b2_f10_f11_point_attachment import LAW_ID, compile_reference_point -from ._stiffened_shell_b2_nodal_footprint import ( - LAW_ID as FOOTPRINT_LAW_ID, B2NodalRigidFootprint, - B2NodalRigidFootprintSelection, B2NodalRigidFootprintWrench, - compile_footprints, checked_selection, selected_wrenches, -) -from ._stiffened_shell_b2_physical_rigid_footprint import ( - LAW_ID as PHYSICAL_FOOTPRINT_LAW_ID, B2PhysicalRigidFootprint, - B2PhysicalRigidFootprintSelection, B2PhysicalRigidFootprintWrench, - compile_physical_footprints, checked_selection as checked_physical_selection, - selected_wrenches as physical_selected_wrenches, -) -from ._b2_physical_linear_definition import ( - PROFILE_ID, CompiledPhysicalB2Member, PhysicalB2Member, - PhysicalB2OperatorCache, -) -from ._b2_physical_linear_batch_dev import ( - _load_value_snapshot, _checked_affine_projection as _project_affine_work, - _accurate_sparse_residual, B2NumericalSolveFailure, -) -from .control import CancellationToken, SolveCancelled -from ._stiffened_shell_physical_q4_mass import physical_mass, POLICY as Q4_MASS_POLICY -from .e4_pl_s3_v2d_element import ( - MASS_POLICY_ID as S3_V2D_TRANSLATIONAL_LUMPED_SECTION_AREAL_MASS_V1, - FORMULATION_ID as S3_V2D_FORMULATION_ID, -) -from ._b2_physical_flexibility_linear import RepresentabilityError +"""Small elastic multi-Q4/multi-B2 panel with existing F10 point joints. + +This is an experimental reference-linear owner. Shell and beam node identities +are explicit and separate. Reference modes require explicit physical mass. +Explicit nodal footprints have a distinct reference-linear law; virgin supported +modes retain its normal-spin locking and incomplete mechanical qualification. +No line, geometric stiffness, nonlinear state or qualification is inferred. +""" + +from __future__ import annotations + +from functools import wraps +from dataclasses import dataclass, field +from hashlib import sha256 +from math import fsum, isfinite +from numbers import Real +from typing import Callable, Mapping, Sequence + +import numpy as np +from scipy import sparse +from scipy.sparse.linalg import LinearOperator, eigs, ArpackError +from scipy.sparse.csgraph import maximum_bipartite_matching + +from ._b2_f10_f11_point_attachment import LAW_ID, compile_reference_point +from ._stiffened_shell_b2_nodal_footprint import ( + LAW_ID as FOOTPRINT_LAW_ID, B2NodalRigidFootprint, + B2NodalRigidFootprintSelection, B2NodalRigidFootprintWrench, + compile_footprints, checked_selection, selected_wrenches, +) +from ._stiffened_shell_b2_physical_rigid_footprint import ( + LAW_ID as PHYSICAL_FOOTPRINT_LAW_ID, B2PhysicalRigidFootprint, + B2PhysicalRigidFootprintSelection, B2PhysicalRigidFootprintWrench, + compile_physical_footprints, checked_selection as checked_physical_selection, + selected_wrenches as physical_selected_wrenches, +) +from ._b2_physical_linear_definition import ( + PROFILE_ID, CompiledPhysicalB2Member, PhysicalB2Member, + PhysicalB2OperatorCache, +) +from ._b2_physical_linear_batch_dev import ( + _load_value_snapshot, _checked_affine_projection as _project_affine_work, + _accurate_sparse_residual, B2NumericalSolveFailure, +) +from .control import CancellationToken, SolveCancelled +from ._stiffened_shell_physical_q4_mass import physical_mass, POLICY as Q4_MASS_POLICY +from .e4_pl_s3_v2d_element import ( + MASS_POLICY_ID as S3_V2D_TRANSLATIONAL_LUMPED_SECTION_AREAL_MASS_V1, + FORMULATION_ID as S3_V2D_FORMULATION_ID, +) +from ._b2_physical_flexibility_linear import RepresentabilityError from ._b2_loaded_point_trace_dev import LoadedPointMember, checked_sparse_action from ._stiffened_shell_b2_affine_resolution import certify_affine from ._b2_attachment_elimination_dev import prepare_attachment_elimination -from .e4_pl_element import _retire_q4_private_mesh_caches -from ._stiffened_shell_b2_assembly_diagnostics import active_capture, DiagnosticRefusal -from .elements import create_shell_element -from .fe_core import FEModel -from .linalg import MatrixClass, factorize_cached - -B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV = "B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV" - -class ExperimentalB2Q4PanelError(RuntimeError): - """The experimental panel cannot be prepared or used.""" - - -class _NumericalFailure(RuntimeError): - """A checked sparse panel solution failed numerically.""" - - -_MAX_DENSE_AUDIT_ROWS = 48 -_MAX_DENSE_AUDIT_VALUES = 16_384 - - -def _bounded_accurate_residual(matrix, solution, rhs): - """Stored-equation residual and outward bound using exact products. - - Only selected explicitly loaded rows use this exceptional path. Fraction - products/summation avoid FMA/fsum portability and underflow assumptions. - Conversion to binary64 is correctly rounded; a full ULP and outward final - rounding conservatively enclose the absolute rational residual. This does - not certify element/assembly rounding or forward displacement accuracy. - """ - if (not np.isfinite(matrix.data).all() or not np.isfinite(solution).all() or - not np.isfinite(rhs).all()): - raise B2NumericalSolveFailure("physical B2 residual is not representable") - defect = _accurate_sparse_residual(matrix, solution, rhs, exact_products=True) - magnitude = np.abs(defect) - with np.errstate(over="ignore", under="ignore", invalid="ignore"): - rounding = np.nextafter(magnitude, np.inf)-magnitude - upper = np.nextafter(magnitude+rounding, np.inf) - return defect, upper - - -def _checked_affine_projection(rows, multi, singles, values: np.ndarray) -> np.ndarray: - """Keep the panel's failure identity while sharing checked affine work.""" - return _project_affine_work(rows, multi, singles, values, - failure_type=_NumericalFailure, label="panel") - - -def _scaled_point_kkt(reduced_k: sparse.spmatrix, - reduced_c: sparse.spmatrix, - multiplier_compliance: sparse.spmatrix | None = None) -> tuple[sparse.csc_matrix, np.ndarray]: - """Representable congruence for the elastic point-constrained KKT. - - A zero-energy primal coordinate is valid when a constraint anchors it; - its scale then follows that constraint column. This owner admits no - negative-energy primal diagonal or unanchored zero-energy coordinate. - """ - diagonal = reduced_k.diagonal() - if not np.isfinite(diagonal).all() or np.any(diagonal < 0.): - raise ExperimentalB2Q4PanelError( - "panel factorization requires nonnegative finite primal diagonal") - primal_scale = np.empty(len(diagonal)) - positive = diagonal > 0. - with np.errstate(over="ignore", under="ignore", divide="ignore", - invalid="ignore"): - primal_scale[positive] = 1./np.sqrt(diagonal[positive]) - if np.any(~positive): - # For a positive-semidefinite elastic K, a zero diagonal has a - # zero row. An off-diagonal term instead signals invalid data. - zero_rows = reduced_k.tocsr()[np.flatnonzero(~positive)] - if np.any(zero_rows.data != 0.): - raise ExperimentalB2Q4PanelError( - "zero-energy primal row has nonzero stiffness coupling") - column_max = np.asarray( - abs(reduced_c).max(axis=0).toarray()).reshape(-1) - if (not np.isfinite(column_max[~positive]).all() or - np.any(column_max[~positive] <= 0.)): - raise ExperimentalB2Q4PanelError( - "unanchored zero-energy primal coordinate") - primal_scale[~positive] = 1./column_max[~positive] - if (not np.isfinite(primal_scale).all() or - np.any(primal_scale <= 0.)): - raise ExperimentalB2Q4PanelError( - "panel factorization scaling is not representable") - scaled_rows = reduced_c @ sparse.diags(primal_scale) - row_max = np.asarray(abs(scaled_rows).max(axis=1).toarray()).reshape(-1) - if multiplier_compliance is not None: - diagonal_h = multiplier_compliance.diagonal() - if (multiplier_compliance.shape != (reduced_c.shape[0],)*2 or - not np.isfinite(multiplier_compliance.data).all() or - np.any(diagonal_h < 0.)): - raise ExperimentalB2Q4PanelError("finite nonnegative point compliance required") - row_max = np.maximum(row_max, np.sqrt(diagonal_h)) - multiplier_scale = 1./row_max - factor_scale = np.r_[primal_scale, multiplier_scale] - kkt = sparse.bmat( - ((reduced_k, reduced_c.T), (reduced_c, None if multiplier_compliance is None - else -multiplier_compliance)), format="csc") - scaling = sparse.diags(factor_scale, format="csc") - scaled_kkt = (scaling @ kkt @ scaling).tocsc() - kkt.sort_indices() - scaled_kkt.sort_indices() - if (not np.isfinite(factor_scale).all() or - np.any(factor_scale <= 0.) or - not np.isfinite(scaled_kkt.data).all() or - kkt.nnz != scaled_kkt.nnz or - not np.array_equal(kkt.indptr, scaled_kkt.indptr) or - not np.array_equal(kkt.indices, scaled_kkt.indices) or - np.any((kkt.data != 0.) & (scaled_kkt.data == 0.))): - raise ExperimentalB2Q4PanelError( - "panel factorization scaling is not representable") - return scaled_kkt, factor_scale - - -def _require_independent_supported_point_rows(reduced_c: sparse.spmatrix) -> None: - """Bound the dense audit; defer large numerical rank to KKT factorization. - - A matching proves only structural rank. The subsequent sparse KKT - factorization must still reject numerical row dependence for larger models. - """ - rows, columns = reduced_c.shape - if rows > columns or not np.isfinite(reduced_c.data).all(): - raise ValueError("independent supported point rows required") - if rows <= _MAX_DENSE_AUDIT_ROWS and rows*columns <= _MAX_DENSE_AUDIT_VALUES: - if np.linalg.matrix_rank(reduced_c.toarray()) != rows: - raise ValueError("independent supported point rows required") - return - pattern = reduced_c.tocsr(copy=True) - pattern.eliminate_zeros() - matching = maximum_bipartite_matching(pattern, perm_type="column") - if np.any(matching < 0): - raise ValueError("structurally independent supported point rows required") - - -@dataclass(frozen=True) -class Q4PanelShell: - shell_id: str - node_ids: tuple[int, int, int, int] - E: float - nu: float - thickness_m: float - reference_normal: tuple[float, float, float] = (0., 0., 1.) - density_kg_m3: float | None = None - - -@dataclass(frozen=True) -class Q4B2Point: - point_id: str - shell_id: str - member_id: str - station: float - offset_local_m: tuple[float, float, float] = (0., 0., 0.) - - -@dataclass(frozen=True) -class S3V2DPanelShell: - """Explicit native S3 V2D elastic facet; reference mass requires modal opt-in.""" - - shell_id: str - node_ids: tuple[int, int, int] - E: float - nu: float - thickness_m: float - reference_normal: tuple[float, float, float] - density_kg_m3: float | None = None - - -@dataclass(frozen=True) -class ExperimentalB2Q4PanelCapabilities: - profile_id: str = PROFILE_ID - point_law_id: str = LAW_ID - status: str = "experimental" - production_qualified: bool = False - shell_domain: str = "multiple flat elastic Q4" - beam_domain: str = "multiple physical B2 members" - attachment: str = "F10 reference points only" - operations: tuple[str, ...] = ("solve_linear", "solve_linear_many", "close") - spectral_domain: str = "unavailable without explicit physical mass" - body_load_domain: str = "unavailable without complete physical density/mass" - point_trace_policy: str | None = None - - -@dataclass(frozen=True) -class ExperimentalB2LoadedPointCapabilities(ExperimentalB2Q4PanelCapabilities): - point_trace_policy: str = B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV - spectral_domain: str = "unsupported: loaded point trace inertia unverified" - - -@dataclass(frozen=True, eq=False) -class B2ReferenceBodyLoad: - """Owned reference-linear body load; six global coordinates per node. - - Shell nodes precede beam nodes, each in the returned ID order. Acceleration - is global in m/s2. This is a reference load, not finite-configuration gravity. - """ - - acceleration_m_s2: tuple[float, float, float] - shell_node_ids: tuple[int, ...] - beam_node_ids: tuple[int, ...] - load: np.ndarray - model_identity: str = "" - policy: str = field(default="B2_E4_PL_REFERENCE_BODY_ACCELERATION_V1", init=False) - production_qualified: bool = field(default=False, init=False) - member_recovery: str = field(default="pass typed load for particular-load equilibrated fields; .load alone retains nodal-state constitutive recovery", init=False) - - def __post_init__(self): - # Bytes-backed storage cannot be made writable, and never aliases the - # owner's compiled map or the caller's acceleration. - values = np.asarray(self.load, dtype=np.float64) - object.__setattr__(self, "load", np.frombuffer(values.tobytes(), dtype=np.float64)) - object.__setattr__(self, "acceleration_m_s2", tuple(self.acceleration_m_s2)) - object.__setattr__(self, "shell_node_ids", tuple(self.shell_node_ids)) - object.__setattr__(self, "beam_node_ids", tuple(self.beam_node_ids)) - - -@dataclass(frozen=True) -class B2LoadedMemberSections: - """Static admissible section fields; not a new loaded kinematic state.""" - - member_id: str - stations: tuple[float, ...] - resultants_left: tuple[tuple[float, ...], ...] - resultants_right: tuple[tuple[float, ...], ...] - strains_left: tuple[tuple[float, ...], ...] - strains_right: tuple[tuple[float, ...], ...] - endpoint_tractions_local: tuple[float, ...] - policy: str = field(default="B2_REFERENCE_EQUILIBRATED_MEMBER_FIELDS_V1_DEV", init=False) - production_qualified: bool = field(default=False, init=False) - - -def _beam_body_map(member: CompiledPhysicalB2Member, frame: np.ndarray) -> np.ndarray: - """Integrate physical section action before any rotary-mass cancellation.""" - section = member.definition.mass.matrix_at_reference_axis()[:, :3] - abscissae, weights = np.polynomial.legendre.leggauss(4) - stations = tuple(float((x+1.)/2.) for x in abscissae) - trace = member.operator.trace(np.zeros(12), stations=stations) - local = np.zeros((12, 3)) - with np.errstate(over="ignore", invalid="ignore"): - for weight, jacobian in zip(weights, trace.jacobian): - local += member.definition.length_m*(weight/2.)*(jacobian.T@section) - result = frame.T@local@frame[:3, :3] - if not np.isfinite(result).all(): - raise RepresentabilityError("physical B2 body-load map is not representable") - return result - - -@dataclass(frozen=True) -class ExperimentalB2Q4FootprintCapabilities(ExperimentalB2Q4PanelCapabilities): - footprint_law_id: str = FOOTPRINT_LAW_ID - footprints: tuple[B2NodalRigidFootprint, ...] = () - -@dataclass(frozen=True) -class B2PhysicalRigidFootprintCapabilities(ExperimentalB2Q4PanelCapabilities): - footprint_law_id: str = PHYSICAL_FOOTPRINT_LAW_ID - footprints: tuple[B2PhysicalRigidFootprint, ...] = () - normal_spin: str = "independent; normal torque through noncollinear translation arms" - - -@dataclass(frozen=True) -class ExperimentalB2MixedPanelCapabilities(ExperimentalB2Q4PanelCapabilities): - shell_domain: str = "explicit flat elastic Q4/native S3 V2D panel" - point_law_id: tuple[str, ...] = () - shell_formulations: tuple[tuple[str, str], ...] = () - point_laws: tuple[tuple[str, str], ...] = () - footprint_law_id: str | None = None - footprints: tuple[B2NodalRigidFootprint, ...] = () - - -@dataclass(frozen=True) -class ExperimentalB2MixedReferenceModalCapabilities(ExperimentalB2MixedPanelCapabilities): - inertia_policy: str = S3_V2D_TRANSLATIONAL_LUMPED_SECTION_AREAL_MASS_V1 - shell_mass_policies: tuple[tuple[str, str], ...] = () - s3_rotary_inertia: str = "omitted by S3 facet contributions; shared nodes may retain Q4 director inertia" - beam_mass_policy: str = "declared physical B2 sectional inertia through the station trace" - boundary_policy: str | None = None - - -B2_FREE_FREE_MODAL_ONLY_V1 = "B2_FREE_FREE_MODAL_ONLY_V1" - - -@dataclass(frozen=True) -class B2ReferenceModesRequest: - """Elastic finite reference pairs; boundary policy belongs to the definition.""" - - count: int = 3 - shift_hz: float = 1. - max_iterations: int = 600 - - def __post_init__(self): - if (type(self.count) is not int or self.count <= 0 or - type(self.max_iterations) is not int or self.max_iterations <= 0 or - isinstance(self.shift_hz, (bool, np.bool_)) or - not isinstance(self.shift_hz, (int, float, np.floating)) or - not np.isfinite(self.shift_hz) or self.shift_hz <= 0.): - raise ValueError("positive finite reference-mode controls required") - - -@dataclass(frozen=True) -class B2ReferenceModesResult: - status: str - frequencies_hz: tuple[float, ...] = () - physical_modes: tuple[tuple[float, ...], ...] = () - point_multiplier_modes: tuple[tuple[float, ...], ...] = () - equation_residuals: tuple[float, ...] = () - constraint_residuals: tuple[float, ...] = () - factorization_count: int = 0 - solve_count: int = 0 - failure_reason: str | None = None - production_qualified: bool = False - - -@dataclass(frozen=True) -class B2FreeReferenceModesResult: - """Six verified physical rigid fields and selected finite flexible pairs. - - This does not certify complete nullity or an eigenvalue error bound. - All returned numerical collections own immutable scalar tuples. - """ - - status: str - flexible: B2ReferenceModesResult - rigid_origin_m: tuple[float, ...] = () - canonical_rigid_modes: tuple[tuple[float, ...], ...] = () - rigid_modes: tuple[tuple[float, ...], ...] = () - rigid_multiplier_modes: tuple[tuple[float, ...], ...] = () - rigid_kinetic_gram: tuple[tuple[float, ...], ...] = () - rigid_equation_residuals: tuple[float, ...] = () - rigid_constraint_residuals: tuple[float, ...] = () - rigid_flexible_mass_overlap: float = 0. - spectral_shift_rad2_s2: float = 0. - failure_reason: str | None = None - policy: str = B2_FREE_FREE_MODAL_ONLY_V1 - production_qualified: bool = False - - -@dataclass(frozen=True) -class B2ModalConstraintRow: - """Immutable provenance for one actual physical constraint/multiplier row. - - Rows follow C. Footprint gaps are global; point translation gaps use the - master shell reference frame and point rotational gaps use the beam - reference frame. Multipliers are work-conjugate covectors, not display-ready - global wrenches. Frame columns give the actual basis in global coordinates. - """ - - row_index: int - component: str - point_id: str | None = None - footprint_id: str | None = None - shell_node_id: int | None = None - beam_node_id: int | None = None - coordinate_frame: str = "global" - reference_frame_columns: tuple[tuple[float, ...], ...] = ( - (1., 0., 0.), (0., 1., 0.), (0., 0., 1.)) - - -@dataclass(frozen=True) -class B2FootprintReferenceModesResult(B2ReferenceModesResult): - """Virgin descriptor modes of the reference-linear, normal-spin locked law. - - All multipliers follow constraint_rows. Inherited point_multiplier_modes - contain only the true point prefix, never footprint multipliers. - """ - - footprint_law_id: str = FOOTPRINT_LAW_ID - footprint_ids: tuple[str, ...] = () - constraint_multiplier_modes: tuple[tuple[float, ...], ...] = () - constraint_rows: tuple[B2ModalConstraintRow, ...] = () - normal_spin: str = "locked" - mechanical_qualification: str = "incomplete" - - -@dataclass(frozen=True) -class ExperimentalB2Q4PanelResult: - status: str - displacements: tuple[float, ...] = () - point_multipliers: tuple[tuple[str, tuple[float, ...]], ...] = () - affine_reactions: tuple[float, ...] = () - point_gaps: tuple[tuple[str, tuple[float, ...]], ...] = () - beam_resultants_local: tuple[tuple[str, tuple[tuple[float, ...], ...]], ...] = () - internal_strain_energy: float | None = None - factorization_count: int | None = None - solve_count: int | None = None - failure_reason: str | None = None - production_qualified: bool = False - - -@dataclass(frozen=True) -class ExperimentalB2Q4PanelSelectedCase: - case_id: str - selected_displacements: tuple[float, ...] - selected_affine_reactions: tuple[float, ...] - point_multipliers: tuple[tuple[str, tuple[float, ...]], ...] - point_gaps: tuple[tuple[str, tuple[float, ...]], ...] - beam_resultants_local: tuple[tuple[str, tuple[tuple[float, ...], ...]], ...] - internal_strain_energy: float - - -@dataclass(frozen=True) -class ExperimentalB2Q4PanelResponseEnvelope: - """One selected physical coordinate's signed complete-case extrema. - - Displacements retain m/rad and affine reactions N/Nm according to the - selected DOF. Equal extrema are governed by the first submitted case. - """ - - selected_dof: int - minimum: float - minimum_case_id: str - maximum: float - maximum_case_id: str - - -@dataclass(frozen=True) -class ExperimentalB2Q4PanelMemberResultantEnvelope: - """Signed local sectional-resultant extrema at one requested station. - - Components are N, Qy, Qz, Mx, My, Mz in the member's local frame. - Station indices distinguish repeated normalized station coordinates. - """ - - member_id: str - station_index: int - station_normalized: float - component: str - minimum: float - minimum_case_id: str - maximum: float - maximum_case_id: str - - -@dataclass(frozen=True) -class ExperimentalB2Q4PanelBatchResult: - status: str - selected_dofs: tuple[int, ...] - selected_points: tuple[str, ...] - cases: tuple[ExperimentalB2Q4PanelSelectedCase, ...] - factorization_count: int - solve_count: int - maximum_rhs_chunk: int = 1 - failure_reason: str | None = None - production_qualified: bool = False - displacement_envelopes: tuple[ExperimentalB2Q4PanelResponseEnvelope, ...] = () - affine_reaction_envelopes: tuple[ExperimentalB2Q4PanelResponseEnvelope, ...] = () - member_resultant_envelopes: tuple[ExperimentalB2Q4PanelMemberResultantEnvelope, ...] = () - - -@dataclass(frozen=True) -class ExperimentalB2Q4FootprintResult(ExperimentalB2Q4PanelResult): - footprint_ids: tuple[str, ...] = () - footprint_wrenches: tuple[B2NodalRigidFootprintWrench, ...] = () - footprint_law_id: str = FOOTPRINT_LAW_ID - -@dataclass(frozen=True) -class B2PhysicalRigidFootprintResult(ExperimentalB2Q4PanelResult): - footprint_ids: tuple[str, ...] = () - footprint_wrenches: tuple[B2PhysicalRigidFootprintWrench, ...] = () - constraint_multipliers: tuple = () - constraint_gaps: tuple = () - constraint_rows: tuple = () - footprint_law_id: str = PHYSICAL_FOOTPRINT_LAW_ID - - -@dataclass(frozen=True) -class B2PhysicalRigidFootprintSelectedCase(ExperimentalB2Q4PanelSelectedCase): - """Only requested physical outputs from one complete batch case.""" - footprint_wrenches: tuple[B2PhysicalRigidFootprintWrench, ...] = () - constraint_multipliers: tuple[float, ...] = () - constraint_gaps: tuple[float, ...] = () - footprint_law_id: str = PHYSICAL_FOOTPRINT_LAW_ID - - -@dataclass(frozen=True) -class B2PhysicalRigidFootprintBatchResult(ExperimentalB2Q4PanelBatchResult): - selected_footprints: tuple[str, ...] = () - constraint_rows: tuple = () - footprint_law_id: str = PHYSICAL_FOOTPRINT_LAW_ID - - -@dataclass(frozen=True) -class ExperimentalB2Q4FootprintSelectedCase(ExperimentalB2Q4PanelSelectedCase): - footprint_wrenches: tuple[B2NodalRigidFootprintWrench, ...] = () - - -@dataclass(frozen=True) -class ExperimentalB2Q4FootprintBatchResult(ExperimentalB2Q4PanelBatchResult): - selected_footprints: tuple[str, ...] = () - footprint_law_id: str = FOOTPRINT_LAW_ID - - -@dataclass(frozen=True) -class B2BodyLoadedPanelResult(ExperimentalB2Q4PanelResult): - body_model_identity: str = "" - body_acceleration_m_s2: tuple[float, ...] = () - equilibrated_sections: tuple[B2LoadedMemberSections, ...] = () - - -@dataclass(frozen=True) -class B2BodyLoadedFootprintResult(ExperimentalB2Q4FootprintResult): - body_model_identity: str = "" - body_acceleration_m_s2: tuple[float, ...] = () - equilibrated_sections: tuple[B2LoadedMemberSections, ...] = () - - -@dataclass(frozen=True) -class B2BodyLoadedPanelSelectedCase(ExperimentalB2Q4PanelSelectedCase): - body_model_identity: str = "" - body_acceleration_m_s2: tuple[float, ...] = () - equilibrated_sections: tuple[B2LoadedMemberSections, ...] = () - - -@dataclass(frozen=True) -class B2BodyLoadedFootprintSelectedCase(ExperimentalB2Q4FootprintSelectedCase): - body_model_identity: str = "" - body_acceleration_m_s2: tuple[float, ...] = () - equilibrated_sections: tuple[B2LoadedMemberSections, ...] = () - - -@dataclass(frozen=True) -class B2LoadedMemberPoses: - member_id: str - stations: tuple[float, ...] - poses_local: tuple[tuple[float, ...], ...] - point_trace_policy: str = field(default=B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV, init=False) - production_qualified: bool = field(default=False, init=False) - - -@dataclass(frozen=True) -class B2LoadedPointPanelResult(B2BodyLoadedPanelResult): - loaded_member_poses: tuple[B2LoadedMemberPoses, ...] = () - loaded_strain_energy: float | None = None - point_trace_policy: str = field(default=B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV, init=False) - - -@dataclass(frozen=True) -class B2LoadedPointPanelSelectedCase(B2BodyLoadedPanelSelectedCase): - loaded_member_poses: tuple[B2LoadedMemberPoses, ...] = () - loaded_strain_energy: float | None = None - point_trace_policy: str = field(default=B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV, init=False) - - -def _unique_ids(items, name): - ids = [getattr(item, name) for item in items] - if any(not isinstance(value, str) or not value.strip() for value in ids): - raise ValueError(f"nonempty {name} required") - if len(set(ids)) != len(ids): - raise ValueError(f"unique {name} required") - - -def _checked_recovery(recover_members, available): - if recover_members is None: - return None - if not isinstance(recover_members, Mapping): - raise ValueError("selected physical B2 recovery mapping required") - selected = {} - for member_id, requested in recover_members.items(): - if member_id not in available: - raise ValueError("selected physical B2 member is not compiled") - try: - stations = np.asarray(requested, dtype=float).copy() - except (TypeError, ValueError, OverflowError) as exc: - raise ValueError("finite normalized recovery stations required") from exc - if (stations.ndim != 1 or not len(stations) or - not np.isfinite(stations).all() or - np.any((stations < 0.) | (stations > 1.))): - raise ValueError("finite normalized recovery stations required") - selected[member_id] = tuple(float(value) for value in stations) - return selected - - -def _flat_vertices(vertices): - base = vertices[0] - normal = np.cross(vertices[1]-base, vertices[3]-base) - diameter = max(np.linalg.norm(a-b) for a in vertices for b in vertices) - magnitude = np.linalg.norm(normal) - if (not isfinite(diameter) or diameter <= 0. or - magnitude <= 1e-12*diameter**2 or - abs((vertices[2]-base) @ normal) > 1e-10*diameter*magnitude): - raise ValueError("nondegenerate flat Q4 shell required") - - -def _require_connected_panel(shells, members, points, footprints=()): - """Check physical incidence without forming a numerical constraint matrix.""" - neighbours = {(0, shell.shell_id): set() for shell in shells} - neighbours.update({(1, member.member_id): set() for member in members}) - - def join(a, b): - neighbours[a].add(b) - neighbours[b].add(a) - - for kind, entities in ((0, shells), (1, members)): - owners = {} - for entity in entities: - key = (kind, entity.shell_id if kind == 0 else entity.member_id) - shell_count = 3 if type(entity) is S3V2DPanelShell else 4 - if (kind == 0 and (type(entity.node_ids) is not tuple or - len(entity.node_ids) != shell_count or - any(type(node_id) is not int for node_id in entity.node_ids))): - raise ValueError("three integer S3 V2D nodes required" if shell_count == 3 - else "four integer Q4 nodes required") - for node_id in entity.node_ids: - previous = owners.setdefault(node_id, key) - join(key, previous) - for point in points: - shell_key, member_key = (0, point.shell_id), (1, point.member_id) - if shell_key not in neighbours or member_key not in neighbours: - raise ValueError("point host IDs must identify declared elements") - join(shell_key, member_key) - for group in footprints: - shell_hosts = [s for s in shells if set(s.node_ids) & set(group.shell_nodes)] - beam_hosts = [m for m in members if group.beam_node in m.node_ids] - if (not beam_hosts or set(group.shell_nodes) - - {n for s in shell_hosts for n in s.node_ids}): - raise ValueError("known shell nodes and physical B2 endpoint required") - for shell in shell_hosts: - for member in beam_hosts: - join((0, shell.shell_id), (1, member.member_id)) - first = next(iter(neighbours)) - visited = {first} - pending = [first] - while pending: - for other in neighbours[pending.pop()]-visited: - visited.add(other) - pending.append(other) - if len(visited) != len(neighbours): - raise ValueError("connected shell/beam point panel required") - - -def _supports_all_panel_rigid_fields(transformation, shell_positions, beam_positions): - """Detect all six physical rigid fields using only fixed coordinate rows. - - The constructor requires one connected physical incidence graph, so this - is its one component's necessary support check, not a stiffness/kernel or - mechanical qualification claim. u=a+w cross (X-origin), theta=w. Translate - and scale its origin/length to keep rank independent of coordinate units. - Stream at most six support rows through a 6x6 QR; no global dense rigid, - stiffness, constraint or nullspace matrix is assembled. - """ - selector = transformation.copy() - selector.eliminate_zeros() - fixed = np.flatnonzero(np.diff(selector.indptr) == 0) - if len(fixed) < 6: - return False - xyz = tuple(shell_positions[n] for n in sorted(shell_positions))+tuple( - beam_positions[n] for n in sorted(beam_positions)) - supported_nodes = np.unique(fixed//6) - origin = np.asarray(xyz[int(supported_nodes[0])], dtype=float) - length = 0. - with np.errstate(over="ignore", invalid="ignore"): - for node in supported_nodes: - arm = np.asarray(xyz[int(node)], dtype=float)-origin - if not np.isfinite(arm).all(): - return False - length = max(length, float(np.max(abs(arm)))) - length = length or 1. - reduced = np.zeros((6, 6)) - start = 0 - for node in supported_nodes: - stop = start - while stop < len(fixed) and fixed[stop]//6 == node: - stop += 1 - arm = (np.asarray(xyz[int(node)], dtype=float)-origin)/length - x, y, z = arm - cross = np.array(((0., -z, y), (z, 0., -x), (-y, x, 0.))) - rigid = np.block([[np.eye(3), -cross], [np.zeros((3, 3)), np.eye(3)]]) - reduced = np.linalg.qr(np.vstack((reduced, rigid[fixed[start:stop] % 6])), - mode="r") - start = stop - scales = np.linalg.norm(reduced, axis=0) - if not np.isfinite(reduced).all() or np.any(scales == 0.): - return False - singular = np.linalg.svd(reduced/scales, compute_uv=False) - return bool(singular[-1] > 64*np.finfo(float).eps*max(6, len(fixed))*singular[0]) - - -def _retire_private_q4_mesh(owner): - mesh = owner._private_q4_mesh - for element in owner._private_q4_elements: - _retire_q4_private_mesh_caches(element, mesh) - owner._private_q4_elements.clear() - owner._private_q4_mesh = None - - -def _private_q4_constructor_lifetime(initialize): - @wraps(initialize) - def guarded(owner, *args, **kwargs): - owner._private_q4_mesh = None - owner._private_q4_elements = [] - try: - return initialize(owner, *args, **kwargs) - except BaseException as original: - try: - _retire_private_q4_mesh(owner) - except BaseException as cleanup: - original.add_note("private Q4 retirement failed: " + repr(cleanup)) - raise - return guarded - - -class ExperimentalB2Q4PanelAnalysis: - """Own one connected reference-linear panel and its sparse factorization. - - The coordinate order is sorted shell node IDs, then sorted beam node IDs, - six global translations/rotations for each. Affine ``T/u0`` is supplied - in that order. Reactions are affine reactions; they are support reactions - only when the affine plan fixes coordinates without other MPCs. - """ - - _mixed_shells = False - - @_private_q4_constructor_lifetime - def __init__(self, shell_nodes_m: Mapping[int, Sequence[float]], - shells: Sequence[Q4PanelShell], - members: Sequence[PhysicalB2Member | CompiledPhysicalB2Member], - points: Sequence[Q4B2Point], *, - transformation: sparse.spmatrix, prescribed_offset, - footprints: Sequence[B2NodalRigidFootprint] = (), - reference_inertia_policy: str | None = None, - reference_boundary_policy: str | None = None, - point_trace_policy: str | None = None, - physical_footprints: Sequence[B2PhysicalRigidFootprint] = ()): - diagnostic = active_capture() - if diagnostic is not None: - diagnostic.begin() - if not physical_footprints or points or footprints or reference_inertia_policy is not None or reference_boundary_policy is not None or point_trace_policy is not None: - raise DiagnosticRefusal("capture admits physical static footprint compilation only") - shells = tuple(shells) - supplied_members = tuple(members) - points = tuple(points) - footprints = tuple(footprints) - physical_footprints = tuple(physical_footprints) - self._physical_footprint_law = bool(physical_footprints) - if physical_footprints: +from .e4_pl_element import _retire_q4_private_mesh_caches +from ._stiffened_shell_b2_assembly_diagnostics import active_capture, DiagnosticRefusal +from .elements import create_shell_element +from .fe_core import FEModel +from .linalg import MatrixClass, factorize_cached + +B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV = "B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV" + +class ExperimentalB2Q4PanelError(RuntimeError): + """The experimental panel cannot be prepared or used.""" + + +class _NumericalFailure(RuntimeError): + """A checked sparse panel solution failed numerically.""" + + +_MAX_DENSE_AUDIT_ROWS = 48 +_MAX_DENSE_AUDIT_VALUES = 16_384 + + +def _bounded_accurate_residual(matrix, solution, rhs): + """Stored-equation residual and outward bound using exact products. + + Only selected explicitly loaded rows use this exceptional path. Fraction + products/summation avoid FMA/fsum portability and underflow assumptions. + Conversion to binary64 is correctly rounded; a full ULP and outward final + rounding conservatively enclose the absolute rational residual. This does + not certify element/assembly rounding or forward displacement accuracy. + """ + if (not np.isfinite(matrix.data).all() or not np.isfinite(solution).all() or + not np.isfinite(rhs).all()): + raise B2NumericalSolveFailure("physical B2 residual is not representable") + defect = _accurate_sparse_residual(matrix, solution, rhs, exact_products=True) + magnitude = np.abs(defect) + with np.errstate(over="ignore", under="ignore", invalid="ignore"): + rounding = np.nextafter(magnitude, np.inf)-magnitude + upper = np.nextafter(magnitude+rounding, np.inf) + return defect, upper + + +def _checked_affine_projection(rows, multi, singles, values: np.ndarray) -> np.ndarray: + """Keep the panel's failure identity while sharing checked affine work.""" + return _project_affine_work(rows, multi, singles, values, + failure_type=_NumericalFailure, label="panel") + + +def _scaled_point_kkt(reduced_k: sparse.spmatrix, + reduced_c: sparse.spmatrix, + multiplier_compliance: sparse.spmatrix | None = None) -> tuple[sparse.csc_matrix, np.ndarray]: + """Representable congruence for the elastic point-constrained KKT. + + A zero-energy primal coordinate is valid when a constraint anchors it; + its scale then follows that constraint column. This owner admits no + negative-energy primal diagonal or unanchored zero-energy coordinate. + """ + diagonal = reduced_k.diagonal() + if not np.isfinite(diagonal).all() or np.any(diagonal < 0.): + raise ExperimentalB2Q4PanelError( + "panel factorization requires nonnegative finite primal diagonal") + primal_scale = np.empty(len(diagonal)) + positive = diagonal > 0. + with np.errstate(over="ignore", under="ignore", divide="ignore", + invalid="ignore"): + primal_scale[positive] = 1./np.sqrt(diagonal[positive]) + if np.any(~positive): + # For a positive-semidefinite elastic K, a zero diagonal has a + # zero row. An off-diagonal term instead signals invalid data. + zero_rows = reduced_k.tocsr()[np.flatnonzero(~positive)] + if np.any(zero_rows.data != 0.): + raise ExperimentalB2Q4PanelError( + "zero-energy primal row has nonzero stiffness coupling") + column_max = np.asarray( + abs(reduced_c).max(axis=0).toarray()).reshape(-1) + if (not np.isfinite(column_max[~positive]).all() or + np.any(column_max[~positive] <= 0.)): + raise ExperimentalB2Q4PanelError( + "unanchored zero-energy primal coordinate") + primal_scale[~positive] = 1./column_max[~positive] + if (not np.isfinite(primal_scale).all() or + np.any(primal_scale <= 0.)): + raise ExperimentalB2Q4PanelError( + "panel factorization scaling is not representable") + scaled_rows = reduced_c @ sparse.diags(primal_scale) + row_max = np.asarray(abs(scaled_rows).max(axis=1).toarray()).reshape(-1) + if multiplier_compliance is not None: + diagonal_h = multiplier_compliance.diagonal() + if (multiplier_compliance.shape != (reduced_c.shape[0],)*2 or + not np.isfinite(multiplier_compliance.data).all() or + np.any(diagonal_h < 0.)): + raise ExperimentalB2Q4PanelError("finite nonnegative point compliance required") + row_max = np.maximum(row_max, np.sqrt(diagonal_h)) + multiplier_scale = 1./row_max + factor_scale = np.r_[primal_scale, multiplier_scale] + kkt = sparse.bmat( + ((reduced_k, reduced_c.T), (reduced_c, None if multiplier_compliance is None + else -multiplier_compliance)), format="csc") + scaling = sparse.diags(factor_scale, format="csc") + scaled_kkt = (scaling @ kkt @ scaling).tocsc() + kkt.sort_indices() + scaled_kkt.sort_indices() + if (not np.isfinite(factor_scale).all() or + np.any(factor_scale <= 0.) or + not np.isfinite(scaled_kkt.data).all() or + kkt.nnz != scaled_kkt.nnz or + not np.array_equal(kkt.indptr, scaled_kkt.indptr) or + not np.array_equal(kkt.indices, scaled_kkt.indices) or + np.any((kkt.data != 0.) & (scaled_kkt.data == 0.))): + raise ExperimentalB2Q4PanelError( + "panel factorization scaling is not representable") + return scaled_kkt, factor_scale + + +def _require_independent_supported_point_rows(reduced_c: sparse.spmatrix) -> None: + """Bound the dense audit; defer large numerical rank to KKT factorization. + + A matching proves only structural rank. The subsequent sparse KKT + factorization must still reject numerical row dependence for larger models. + """ + rows, columns = reduced_c.shape + if rows > columns or not np.isfinite(reduced_c.data).all(): + raise ValueError("independent supported point rows required") + if rows <= _MAX_DENSE_AUDIT_ROWS and rows*columns <= _MAX_DENSE_AUDIT_VALUES: + if np.linalg.matrix_rank(reduced_c.toarray()) != rows: + raise ValueError("independent supported point rows required") + return + pattern = reduced_c.tocsr(copy=True) + pattern.eliminate_zeros() + matching = maximum_bipartite_matching(pattern, perm_type="column") + if np.any(matching < 0): + raise ValueError("structurally independent supported point rows required") + + +@dataclass(frozen=True) +class Q4PanelShell: + shell_id: str + node_ids: tuple[int, int, int, int] + E: float + nu: float + thickness_m: float + reference_normal: tuple[float, float, float] = (0., 0., 1.) + density_kg_m3: float | None = None + + +@dataclass(frozen=True) +class Q4B2Point: + point_id: str + shell_id: str + member_id: str + station: float + offset_local_m: tuple[float, float, float] = (0., 0., 0.) + + +@dataclass(frozen=True) +class S3V2DPanelShell: + """Explicit native S3 V2D elastic facet; reference mass requires modal opt-in.""" + + shell_id: str + node_ids: tuple[int, int, int] + E: float + nu: float + thickness_m: float + reference_normal: tuple[float, float, float] + density_kg_m3: float | None = None + + +@dataclass(frozen=True) +class ExperimentalB2Q4PanelCapabilities: + profile_id: str = PROFILE_ID + point_law_id: str = LAW_ID + status: str = "experimental" + production_qualified: bool = False + shell_domain: str = "multiple flat elastic Q4" + beam_domain: str = "multiple physical B2 members" + attachment: str = "F10 reference points only" + operations: tuple[str, ...] = ("solve_linear", "solve_linear_many", "close") + spectral_domain: str = "unavailable without explicit physical mass" + body_load_domain: str = "unavailable without complete physical density/mass" + point_trace_policy: str | None = None + + +@dataclass(frozen=True) +class ExperimentalB2LoadedPointCapabilities(ExperimentalB2Q4PanelCapabilities): + point_trace_policy: str = B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV + spectral_domain: str = "unsupported: loaded point trace inertia unverified" + + +@dataclass(frozen=True, eq=False) +class B2ReferenceBodyLoad: + """Owned reference-linear body load; six global coordinates per node. + + Shell nodes precede beam nodes, each in the returned ID order. Acceleration + is global in m/s2. This is a reference load, not finite-configuration gravity. + """ + + acceleration_m_s2: tuple[float, float, float] + shell_node_ids: tuple[int, ...] + beam_node_ids: tuple[int, ...] + load: np.ndarray + model_identity: str = "" + policy: str = field(default="B2_E4_PL_REFERENCE_BODY_ACCELERATION_V1", init=False) + production_qualified: bool = field(default=False, init=False) + member_recovery: str = field(default="pass typed load for particular-load equilibrated fields; .load alone retains nodal-state constitutive recovery", init=False) + + def __post_init__(self): + # Bytes-backed storage cannot be made writable, and never aliases the + # owner's compiled map or the caller's acceleration. + values = np.asarray(self.load, dtype=np.float64) + object.__setattr__(self, "load", np.frombuffer(values.tobytes(), dtype=np.float64)) + object.__setattr__(self, "acceleration_m_s2", tuple(self.acceleration_m_s2)) + object.__setattr__(self, "shell_node_ids", tuple(self.shell_node_ids)) + object.__setattr__(self, "beam_node_ids", tuple(self.beam_node_ids)) + + +@dataclass(frozen=True) +class B2LoadedMemberSections: + """Static admissible section fields; not a new loaded kinematic state.""" + + member_id: str + stations: tuple[float, ...] + resultants_left: tuple[tuple[float, ...], ...] + resultants_right: tuple[tuple[float, ...], ...] + strains_left: tuple[tuple[float, ...], ...] + strains_right: tuple[tuple[float, ...], ...] + endpoint_tractions_local: tuple[float, ...] + policy: str = field(default="B2_REFERENCE_EQUILIBRATED_MEMBER_FIELDS_V1_DEV", init=False) + production_qualified: bool = field(default=False, init=False) + + +def _beam_body_map(member: CompiledPhysicalB2Member, frame: np.ndarray) -> np.ndarray: + """Integrate physical section action before any rotary-mass cancellation.""" + section = member.definition.mass.matrix_at_reference_axis()[:, :3] + abscissae, weights = np.polynomial.legendre.leggauss(4) + stations = tuple(float((x+1.)/2.) for x in abscissae) + trace = member.operator.trace(np.zeros(12), stations=stations) + local = np.zeros((12, 3)) + with np.errstate(over="ignore", invalid="ignore"): + for weight, jacobian in zip(weights, trace.jacobian): + local += member.definition.length_m*(weight/2.)*(jacobian.T@section) + result = frame.T@local@frame[:3, :3] + if not np.isfinite(result).all(): + raise RepresentabilityError("physical B2 body-load map is not representable") + return result + + +@dataclass(frozen=True) +class ExperimentalB2Q4FootprintCapabilities(ExperimentalB2Q4PanelCapabilities): + footprint_law_id: str = FOOTPRINT_LAW_ID + footprints: tuple[B2NodalRigidFootprint, ...] = () + +@dataclass(frozen=True) +class B2PhysicalRigidFootprintCapabilities(ExperimentalB2Q4PanelCapabilities): + footprint_law_id: str = PHYSICAL_FOOTPRINT_LAW_ID + footprints: tuple[B2PhysicalRigidFootprint, ...] = () + normal_spin: str = "independent; normal torque through noncollinear translation arms" + + +@dataclass(frozen=True) +class ExperimentalB2MixedPanelCapabilities(ExperimentalB2Q4PanelCapabilities): + shell_domain: str = "explicit flat elastic Q4/native S3 V2D panel" + point_law_id: tuple[str, ...] = () + shell_formulations: tuple[tuple[str, str], ...] = () + point_laws: tuple[tuple[str, str], ...] = () + footprint_law_id: str | None = None + footprints: tuple[B2NodalRigidFootprint, ...] = () + + +@dataclass(frozen=True) +class ExperimentalB2MixedReferenceModalCapabilities(ExperimentalB2MixedPanelCapabilities): + inertia_policy: str = S3_V2D_TRANSLATIONAL_LUMPED_SECTION_AREAL_MASS_V1 + shell_mass_policies: tuple[tuple[str, str], ...] = () + s3_rotary_inertia: str = "omitted by S3 facet contributions; shared nodes may retain Q4 director inertia" + beam_mass_policy: str = "declared physical B2 sectional inertia through the station trace" + boundary_policy: str | None = None + + +B2_FREE_FREE_MODAL_ONLY_V1 = "B2_FREE_FREE_MODAL_ONLY_V1" + + +@dataclass(frozen=True) +class B2ReferenceModesRequest: + """Elastic finite reference pairs; boundary policy belongs to the definition.""" + + count: int = 3 + shift_hz: float = 1. + max_iterations: int = 600 + + def __post_init__(self): + if (type(self.count) is not int or self.count <= 0 or + type(self.max_iterations) is not int or self.max_iterations <= 0 or + isinstance(self.shift_hz, (bool, np.bool_)) or + not isinstance(self.shift_hz, (int, float, np.floating)) or + not np.isfinite(self.shift_hz) or self.shift_hz <= 0.): + raise ValueError("positive finite reference-mode controls required") + + +@dataclass(frozen=True) +class B2ReferenceModesResult: + status: str + frequencies_hz: tuple[float, ...] = () + physical_modes: tuple[tuple[float, ...], ...] = () + point_multiplier_modes: tuple[tuple[float, ...], ...] = () + equation_residuals: tuple[float, ...] = () + constraint_residuals: tuple[float, ...] = () + factorization_count: int = 0 + solve_count: int = 0 + failure_reason: str | None = None + production_qualified: bool = False + + +@dataclass(frozen=True) +class B2FreeReferenceModesResult: + """Six verified physical rigid fields and selected finite flexible pairs. + + This does not certify complete nullity or an eigenvalue error bound. + All returned numerical collections own immutable scalar tuples. + """ + + status: str + flexible: B2ReferenceModesResult + rigid_origin_m: tuple[float, ...] = () + canonical_rigid_modes: tuple[tuple[float, ...], ...] = () + rigid_modes: tuple[tuple[float, ...], ...] = () + rigid_multiplier_modes: tuple[tuple[float, ...], ...] = () + rigid_kinetic_gram: tuple[tuple[float, ...], ...] = () + rigid_equation_residuals: tuple[float, ...] = () + rigid_constraint_residuals: tuple[float, ...] = () + rigid_flexible_mass_overlap: float = 0. + spectral_shift_rad2_s2: float = 0. + failure_reason: str | None = None + policy: str = B2_FREE_FREE_MODAL_ONLY_V1 + production_qualified: bool = False + + +@dataclass(frozen=True) +class B2ModalConstraintRow: + """Immutable provenance for one actual physical constraint/multiplier row. + + Rows follow C. Footprint gaps are global; point translation gaps use the + master shell reference frame and point rotational gaps use the beam + reference frame. Multipliers are work-conjugate covectors, not display-ready + global wrenches. Frame columns give the actual basis in global coordinates. + """ + + row_index: int + component: str + point_id: str | None = None + footprint_id: str | None = None + shell_node_id: int | None = None + beam_node_id: int | None = None + coordinate_frame: str = "global" + reference_frame_columns: tuple[tuple[float, ...], ...] = ( + (1., 0., 0.), (0., 1., 0.), (0., 0., 1.)) + + +@dataclass(frozen=True) +class B2FootprintReferenceModesResult(B2ReferenceModesResult): + """Virgin descriptor modes of the reference-linear, normal-spin locked law. + + All multipliers follow constraint_rows. Inherited point_multiplier_modes + contain only the true point prefix, never footprint multipliers. + """ + + footprint_law_id: str = FOOTPRINT_LAW_ID + footprint_ids: tuple[str, ...] = () + constraint_multiplier_modes: tuple[tuple[float, ...], ...] = () + constraint_rows: tuple[B2ModalConstraintRow, ...] = () + normal_spin: str = "locked" + mechanical_qualification: str = "incomplete" + + +@dataclass(frozen=True) +class ExperimentalB2Q4PanelResult: + status: str + displacements: tuple[float, ...] = () + point_multipliers: tuple[tuple[str, tuple[float, ...]], ...] = () + affine_reactions: tuple[float, ...] = () + point_gaps: tuple[tuple[str, tuple[float, ...]], ...] = () + beam_resultants_local: tuple[tuple[str, tuple[tuple[float, ...], ...]], ...] = () + internal_strain_energy: float | None = None + factorization_count: int | None = None + solve_count: int | None = None + failure_reason: str | None = None + production_qualified: bool = False + + +@dataclass(frozen=True) +class ExperimentalB2Q4PanelSelectedCase: + case_id: str + selected_displacements: tuple[float, ...] + selected_affine_reactions: tuple[float, ...] + point_multipliers: tuple[tuple[str, tuple[float, ...]], ...] + point_gaps: tuple[tuple[str, tuple[float, ...]], ...] + beam_resultants_local: tuple[tuple[str, tuple[tuple[float, ...], ...]], ...] + internal_strain_energy: float + + +@dataclass(frozen=True) +class ExperimentalB2Q4PanelResponseEnvelope: + """One selected physical coordinate's signed complete-case extrema. + + Displacements retain m/rad and affine reactions N/Nm according to the + selected DOF. Equal extrema are governed by the first submitted case. + """ + + selected_dof: int + minimum: float + minimum_case_id: str + maximum: float + maximum_case_id: str + + +@dataclass(frozen=True) +class ExperimentalB2Q4PanelMemberResultantEnvelope: + """Signed local sectional-resultant extrema at one requested station. + + Components are N, Qy, Qz, Mx, My, Mz in the member's local frame. + Station indices distinguish repeated normalized station coordinates. + """ + + member_id: str + station_index: int + station_normalized: float + component: str + minimum: float + minimum_case_id: str + maximum: float + maximum_case_id: str + + +@dataclass(frozen=True) +class ExperimentalB2Q4PanelBatchResult: + status: str + selected_dofs: tuple[int, ...] + selected_points: tuple[str, ...] + cases: tuple[ExperimentalB2Q4PanelSelectedCase, ...] + factorization_count: int + solve_count: int + maximum_rhs_chunk: int = 1 + failure_reason: str | None = None + production_qualified: bool = False + displacement_envelopes: tuple[ExperimentalB2Q4PanelResponseEnvelope, ...] = () + affine_reaction_envelopes: tuple[ExperimentalB2Q4PanelResponseEnvelope, ...] = () + member_resultant_envelopes: tuple[ExperimentalB2Q4PanelMemberResultantEnvelope, ...] = () + + +@dataclass(frozen=True) +class ExperimentalB2Q4FootprintResult(ExperimentalB2Q4PanelResult): + footprint_ids: tuple[str, ...] = () + footprint_wrenches: tuple[B2NodalRigidFootprintWrench, ...] = () + footprint_law_id: str = FOOTPRINT_LAW_ID + +@dataclass(frozen=True) +class B2PhysicalRigidFootprintResult(ExperimentalB2Q4PanelResult): + footprint_ids: tuple[str, ...] = () + footprint_wrenches: tuple[B2PhysicalRigidFootprintWrench, ...] = () + constraint_multipliers: tuple = () + constraint_gaps: tuple = () + constraint_rows: tuple = () + footprint_law_id: str = PHYSICAL_FOOTPRINT_LAW_ID + + +@dataclass(frozen=True) +class B2PhysicalRigidFootprintSelectedCase(ExperimentalB2Q4PanelSelectedCase): + """Only requested physical outputs from one complete batch case.""" + footprint_wrenches: tuple[B2PhysicalRigidFootprintWrench, ...] = () + constraint_multipliers: tuple[float, ...] = () + constraint_gaps: tuple[float, ...] = () + footprint_law_id: str = PHYSICAL_FOOTPRINT_LAW_ID + + +@dataclass(frozen=True) +class B2PhysicalRigidFootprintBatchResult(ExperimentalB2Q4PanelBatchResult): + selected_footprints: tuple[str, ...] = () + constraint_rows: tuple = () + footprint_law_id: str = PHYSICAL_FOOTPRINT_LAW_ID + + +@dataclass(frozen=True) +class ExperimentalB2Q4FootprintSelectedCase(ExperimentalB2Q4PanelSelectedCase): + footprint_wrenches: tuple[B2NodalRigidFootprintWrench, ...] = () + + +@dataclass(frozen=True) +class ExperimentalB2Q4FootprintBatchResult(ExperimentalB2Q4PanelBatchResult): + selected_footprints: tuple[str, ...] = () + footprint_law_id: str = FOOTPRINT_LAW_ID + + +@dataclass(frozen=True) +class B2BodyLoadedPanelResult(ExperimentalB2Q4PanelResult): + body_model_identity: str = "" + body_acceleration_m_s2: tuple[float, ...] = () + equilibrated_sections: tuple[B2LoadedMemberSections, ...] = () + + +@dataclass(frozen=True) +class B2BodyLoadedFootprintResult(ExperimentalB2Q4FootprintResult): + body_model_identity: str = "" + body_acceleration_m_s2: tuple[float, ...] = () + equilibrated_sections: tuple[B2LoadedMemberSections, ...] = () + + +@dataclass(frozen=True) +class B2BodyLoadedPanelSelectedCase(ExperimentalB2Q4PanelSelectedCase): + body_model_identity: str = "" + body_acceleration_m_s2: tuple[float, ...] = () + equilibrated_sections: tuple[B2LoadedMemberSections, ...] = () + + +@dataclass(frozen=True) +class B2BodyLoadedFootprintSelectedCase(ExperimentalB2Q4FootprintSelectedCase): + body_model_identity: str = "" + body_acceleration_m_s2: tuple[float, ...] = () + equilibrated_sections: tuple[B2LoadedMemberSections, ...] = () + + +@dataclass(frozen=True) +class B2LoadedMemberPoses: + member_id: str + stations: tuple[float, ...] + poses_local: tuple[tuple[float, ...], ...] + point_trace_policy: str = field(default=B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV, init=False) + production_qualified: bool = field(default=False, init=False) + + +@dataclass(frozen=True) +class B2LoadedPointPanelResult(B2BodyLoadedPanelResult): + loaded_member_poses: tuple[B2LoadedMemberPoses, ...] = () + loaded_strain_energy: float | None = None + point_trace_policy: str = field(default=B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV, init=False) + + +@dataclass(frozen=True) +class B2LoadedPointPanelSelectedCase(B2BodyLoadedPanelSelectedCase): + loaded_member_poses: tuple[B2LoadedMemberPoses, ...] = () + loaded_strain_energy: float | None = None + point_trace_policy: str = field(default=B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV, init=False) + + +def _unique_ids(items, name): + ids = [getattr(item, name) for item in items] + if any(not isinstance(value, str) or not value.strip() for value in ids): + raise ValueError(f"nonempty {name} required") + if len(set(ids)) != len(ids): + raise ValueError(f"unique {name} required") + + +def _checked_recovery(recover_members, available): + if recover_members is None: + return None + if not isinstance(recover_members, Mapping): + raise ValueError("selected physical B2 recovery mapping required") + selected = {} + for member_id, requested in recover_members.items(): + if member_id not in available: + raise ValueError("selected physical B2 member is not compiled") + try: + stations = np.asarray(requested, dtype=float).copy() + except (TypeError, ValueError, OverflowError) as exc: + raise ValueError("finite normalized recovery stations required") from exc + if (stations.ndim != 1 or not len(stations) or + not np.isfinite(stations).all() or + np.any((stations < 0.) | (stations > 1.))): + raise ValueError("finite normalized recovery stations required") + selected[member_id] = tuple(float(value) for value in stations) + return selected + + +def _flat_vertices(vertices): + base = vertices[0] + normal = np.cross(vertices[1]-base, vertices[3]-base) + diameter = max(np.linalg.norm(a-b) for a in vertices for b in vertices) + magnitude = np.linalg.norm(normal) + if (not isfinite(diameter) or diameter <= 0. or + magnitude <= 1e-12*diameter**2 or + abs((vertices[2]-base) @ normal) > 1e-10*diameter*magnitude): + raise ValueError("nondegenerate flat Q4 shell required") + + +def _require_connected_panel(shells, members, points, footprints=()): + """Check physical incidence without forming a numerical constraint matrix.""" + neighbours = {(0, shell.shell_id): set() for shell in shells} + neighbours.update({(1, member.member_id): set() for member in members}) + + def join(a, b): + neighbours[a].add(b) + neighbours[b].add(a) + + for kind, entities in ((0, shells), (1, members)): + owners = {} + for entity in entities: + key = (kind, entity.shell_id if kind == 0 else entity.member_id) + shell_count = 3 if type(entity) is S3V2DPanelShell else 4 + if (kind == 0 and (type(entity.node_ids) is not tuple or + len(entity.node_ids) != shell_count or + any(type(node_id) is not int for node_id in entity.node_ids))): + raise ValueError("three integer S3 V2D nodes required" if shell_count == 3 + else "four integer Q4 nodes required") + for node_id in entity.node_ids: + previous = owners.setdefault(node_id, key) + join(key, previous) + for point in points: + shell_key, member_key = (0, point.shell_id), (1, point.member_id) + if shell_key not in neighbours or member_key not in neighbours: + raise ValueError("point host IDs must identify declared elements") + join(shell_key, member_key) + for group in footprints: + shell_hosts = [s for s in shells if set(s.node_ids) & set(group.shell_nodes)] + beam_hosts = [m for m in members if group.beam_node in m.node_ids] + if (not beam_hosts or set(group.shell_nodes) - + {n for s in shell_hosts for n in s.node_ids}): + raise ValueError("known shell nodes and physical B2 endpoint required") + for shell in shell_hosts: + for member in beam_hosts: + join((0, shell.shell_id), (1, member.member_id)) + first = next(iter(neighbours)) + visited = {first} + pending = [first] + while pending: + for other in neighbours[pending.pop()]-visited: + visited.add(other) + pending.append(other) + if len(visited) != len(neighbours): + raise ValueError("connected shell/beam point panel required") + + +def _supports_all_panel_rigid_fields(transformation, shell_positions, beam_positions): + """Detect all six physical rigid fields using only fixed coordinate rows. + + The constructor requires one connected physical incidence graph, so this + is its one component's necessary support check, not a stiffness/kernel or + mechanical qualification claim. u=a+w cross (X-origin), theta=w. Translate + and scale its origin/length to keep rank independent of coordinate units. + Stream at most six support rows through a 6x6 QR; no global dense rigid, + stiffness, constraint or nullspace matrix is assembled. + """ + selector = transformation.copy() + selector.eliminate_zeros() + fixed = np.flatnonzero(np.diff(selector.indptr) == 0) + if len(fixed) < 6: + return False + xyz = tuple(shell_positions[n] for n in sorted(shell_positions))+tuple( + beam_positions[n] for n in sorted(beam_positions)) + supported_nodes = np.unique(fixed//6) + origin = np.asarray(xyz[int(supported_nodes[0])], dtype=float) + length = 0. + with np.errstate(over="ignore", invalid="ignore"): + for node in supported_nodes: + arm = np.asarray(xyz[int(node)], dtype=float)-origin + if not np.isfinite(arm).all(): + return False + length = max(length, float(np.max(abs(arm)))) + length = length or 1. + reduced = np.zeros((6, 6)) + start = 0 + for node in supported_nodes: + stop = start + while stop < len(fixed) and fixed[stop]//6 == node: + stop += 1 + arm = (np.asarray(xyz[int(node)], dtype=float)-origin)/length + x, y, z = arm + cross = np.array(((0., -z, y), (z, 0., -x), (-y, x, 0.))) + rigid = np.block([[np.eye(3), -cross], [np.zeros((3, 3)), np.eye(3)]]) + reduced = np.linalg.qr(np.vstack((reduced, rigid[fixed[start:stop] % 6])), + mode="r") + start = stop + scales = np.linalg.norm(reduced, axis=0) + if not np.isfinite(reduced).all() or np.any(scales == 0.): + return False + singular = np.linalg.svd(reduced/scales, compute_uv=False) + return bool(singular[-1] > 64*np.finfo(float).eps*max(6, len(fixed))*singular[0]) + + +def _retire_private_q4_mesh(owner): + mesh = owner._private_q4_mesh + for element in owner._private_q4_elements: + _retire_q4_private_mesh_caches(element, mesh) + owner._private_q4_elements.clear() + owner._private_q4_mesh = None + + +def _private_q4_constructor_lifetime(initialize): + @wraps(initialize) + def guarded(owner, *args, **kwargs): + owner._private_q4_mesh = None + owner._private_q4_elements = [] + try: + return initialize(owner, *args, **kwargs) + except BaseException as original: + try: + _retire_private_q4_mesh(owner) + except BaseException as cleanup: + original.add_note("private Q4 retirement failed: " + repr(cleanup)) + raise + return guarded + + +class ExperimentalB2Q4PanelAnalysis: + """Own one connected reference-linear panel and its sparse factorization. + + The coordinate order is sorted shell node IDs, then sorted beam node IDs, + six global translations/rotations for each. Affine ``T/u0`` is supplied + in that order. Reactions are affine reactions; they are support reactions + only when the affine plan fixes coordinates without other MPCs. + """ + + _mixed_shells = False + + @_private_q4_constructor_lifetime + def __init__(self, shell_nodes_m: Mapping[int, Sequence[float]], + shells: Sequence[Q4PanelShell], + members: Sequence[PhysicalB2Member | CompiledPhysicalB2Member], + points: Sequence[Q4B2Point], *, + transformation: sparse.spmatrix, prescribed_offset, + footprints: Sequence[B2NodalRigidFootprint] = (), + reference_inertia_policy: str | None = None, + reference_boundary_policy: str | None = None, + point_trace_policy: str | None = None, + physical_footprints: Sequence[B2PhysicalRigidFootprint] = ()): + diagnostic = active_capture() + if diagnostic is not None: + diagnostic.begin() + if not physical_footprints or points or footprints or reference_inertia_policy is not None or reference_boundary_policy is not None or point_trace_policy is not None: + raise DiagnosticRefusal("capture admits physical static footprint compilation only") + shells = tuple(shells) + supplied_members = tuple(members) + points = tuple(points) + footprints = tuple(footprints) + physical_footprints = tuple(physical_footprints) + self._physical_footprint_law = bool(physical_footprints) + if physical_footprints: if points or footprints or reference_inertia_policy is not None or reference_boundary_policy is not None or point_trace_policy is not None: raise ValueError("separate physical footprint static family required") - footprints = physical_footprints - modal_mass = reference_inertia_policy is not None - if reference_boundary_policy is not None and ( - type(reference_boundary_policy) is not str or - reference_boundary_policy != B2_FREE_FREE_MODAL_ONLY_V1 or - not modal_mass): - raise ValueError("explicit mixed free-free modal-only boundary policy required") - self._modal_only = reference_boundary_policy is not None - self._reference_boundary_policy = reference_boundary_policy - if modal_mass and (not self._mixed_shells or - type(reference_inertia_policy) is not str or - reference_inertia_policy != S3_V2D_TRANSLATIONAL_LUMPED_SECTION_AREAL_MASS_V1 or - footprints): - raise ValueError("explicit native-S3 reference inertia policy without footprints required") - has_s3 = any(type(shell) is S3V2DPanelShell for shell in shells) - if point_trace_policy is not None and ( - type(point_trace_policy) is not str or - point_trace_policy != B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV or - self._mixed_shells or has_s3 or footprints or modal_mass): - raise ValueError("explicit Q4-only fixed-end loaded point trace without footprints or modes required") - self._point_trace_policy = point_trace_policy + footprints = physical_footprints + modal_mass = reference_inertia_policy is not None + if reference_boundary_policy is not None and ( + type(reference_boundary_policy) is not str or + reference_boundary_policy != B2_FREE_FREE_MODAL_ONLY_V1 or + not modal_mass): + raise ValueError("explicit mixed free-free modal-only boundary policy required") + self._modal_only = reference_boundary_policy is not None + self._reference_boundary_policy = reference_boundary_policy + if modal_mass and (not self._mixed_shells or + type(reference_inertia_policy) is not str or + reference_inertia_policy != S3_V2D_TRANSLATIONAL_LUMPED_SECTION_AREAL_MASS_V1 or + footprints): + raise ValueError("explicit native-S3 reference inertia policy without footprints required") + has_s3 = any(type(shell) is S3V2DPanelShell for shell in shells) + if point_trace_policy is not None and ( + type(point_trace_policy) is not str or + point_trace_policy != B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV or + self._mixed_shells or has_s3 or footprints or modal_mass): + raise ValueError("explicit Q4-only fixed-end loaded point trace without footprints or modes required") + self._point_trace_policy = point_trace_policy if has_s3 and footprints and not self._physical_footprint_law: - raise ValueError("S3 mixed-panel nodal footprints are unsupported") - admitted_shells = ((Q4PanelShell, S3V2DPanelShell) if self._mixed_shells - else (Q4PanelShell,)) - footprint_type = B2PhysicalRigidFootprint if self._physical_footprint_law else B2NodalRigidFootprint - if any(type(g) is not footprint_type for g in footprints): - raise ValueError("typed experimental B2 nodal footprints required") - if (len(shells) < 2 or len(supplied_members) < 2 or not (points or footprints) or - any((type(shell) not in admitted_shells if self._mixed_shells else - not isinstance(shell, Q4PanelShell)) for shell in shells) or - any(not isinstance(member, (PhysicalB2Member, - CompiledPhysicalB2Member)) - for member in supplied_members) or - any(not isinstance(point, Q4B2Point) for point in points)): - raise ValueError("multi-Q4/S3/multi-B2 physical point panel required" if - self._mixed_shells else - "multi-Q4/multi-B2 physical point panel required") - _unique_ids(shells, "shell_id") - _unique_ids(points, "point_id") + raise ValueError("S3 mixed-panel nodal footprints are unsupported") + admitted_shells = ((Q4PanelShell, S3V2DPanelShell) if self._mixed_shells + else (Q4PanelShell,)) + footprint_type = B2PhysicalRigidFootprint if self._physical_footprint_law else B2NodalRigidFootprint + if any(type(g) is not footprint_type for g in footprints): + raise ValueError("typed experimental B2 nodal footprints required") + if (len(shells) < 2 or len(supplied_members) < 2 or not (points or footprints) or + any((type(shell) not in admitted_shells if self._mixed_shells else + not isinstance(shell, Q4PanelShell)) for shell in shells) or + any(not isinstance(member, (PhysicalB2Member, + CompiledPhysicalB2Member)) + for member in supplied_members) or + any(not isinstance(point, Q4B2Point) for point in points)): + raise ValueError("multi-Q4/S3/multi-B2 physical point panel required" if + self._mixed_shells else + "multi-Q4/multi-B2 physical point panel required") + _unique_ids(shells, "shell_id") + _unique_ids(points, "point_id") definitions = tuple(member.definition if isinstance( member, CompiledPhysicalB2Member) else member for member in supplied_members) if diagnostic is not None and (any(shell.density_kg_m3 is not None for shell in shells) or any(member.mass is not None for member in definitions)): raise DiagnosticRefusal("capture of physical mass/body-map storage is not admitted") - if modal_mass: - for shell in shells: - density = shell.density_kg_m3 - if isinstance(density, (bool, np.bool_)) or not isinstance(density, Real): - raise ValueError("mixed reference modes require complete positive finite shell density") - try: - density_value = float(density) - except OverflowError as exc: - raise ValueError("mixed reference modes require representable shell density") from exc - if not isfinite(density_value) or density_value <= 0.: - raise ValueError("mixed reference modes require complete positive finite shell density") - if any(member.mass is None for member in definitions): - raise ValueError("mixed reference modes require complete declared physical B2 mass") - if any(member.geometric is not None for member in definitions): - raise ValueError("mixed reference modes are virgin elastic; prestress/geometric metadata unsupported") - _unique_ids(definitions, "member_id") - _require_connected_panel(shells, definitions, points, footprints) - cache = PhysicalB2OperatorCache() - if diagnostic is not None: diagnostic.mark("member_compilation") - compiled = tuple( - member if isinstance(member, CompiledPhysicalB2Member) - else member.compile_local(operator_cache=cache) - for member in supplied_members) - if diagnostic is not None: diagnostic.mark("topology_mapping") - shell_ids = tuple(sorted(shell_nodes_m)) - if any(type(node_id) is not int for node_id in shell_ids): - raise ValueError("integer shell node IDs required") - positions = {} - for node_id in shell_ids: - vector = np.array(shell_nodes_m[node_id], dtype=float, copy=True) - if vector.shape != (3,) or not np.isfinite(vector).all(): - raise ValueError("finite shell node coordinates required") - positions[node_id] = vector - used_shell_nodes = {node_id for shell in shells for node_id in shell.node_ids} - if used_shell_nodes != set(shell_ids): - raise ValueError("every declared shell node must belong to a Q4/S3" if self._mixed_shells - else "every declared shell node must belong to a Q4") - shell_index = {node_id: i for i, node_id in enumerate(shell_ids)} - beam_positions = {} - for member in definitions: - for node_id, point in zip(member.node_ids, member.reference_points_m): - old = beam_positions.setdefault(node_id, point) - if old != point: - raise ValueError("shared B2 node has inconsistent position") - beam_ids = tuple(sorted(beam_positions)) - beam_index = {node_id: i+len(shell_ids) - for i, node_id in enumerate(beam_ids)} - footprint_compiler = compile_physical_footprints if self._physical_footprint_law else compile_footprints - footprints, footprint_incidence = footprint_compiler( - footprints, positions, shells, beam_positions, - shell_index, beam_index, points) - total = 6*(len(shell_ids)+len(beam_ids)) - for shell in shells: - density = shell.density_kg_m3 - if density is not None: - if isinstance(density, (bool, np.bool_)) or not isinstance(density, Real): - raise ValueError("positive finite shell density required when supplied") - try: - density_value = float(density) - except (ValueError, TypeError, OverflowError) as exc: - raise ValueError("representable positive shell density required") from exc - if not isfinite(density_value) or density_value <= 0.: - raise ValueError("positive finite shell density required when supplied") - complete_body_mass = (all(shell.density_kg_m3 is not None for shell in shells) - and all(member.definition.mass is not None for member in compiled)) - body_map = np.zeros((total, 3)) if complete_body_mass else None - body_masses = [] - if diagnostic is not None: diagnostic.mark("shell_model_setup") - model = FEModel("experimental-multi-Q4-B2-point") - self._private_q4_mesh = model.mesh - for node_id in shell_ids: - model.add_node(node_id, *positions[node_id]) - rows, columns, values = [], [], [] - mass_rows, mass_columns, mass_values = [], [], [] - complete_mass = (not has_s3 or modal_mass) and all(shell.density_kg_m3 is not None for shell in shells) - complete_mass = complete_mass and all(member.definition.mass is not None - for member in compiled) - shell_lookup = {} - pieces = [] - for index, shell in enumerate(shells, 1): - count = 3 if type(shell) is S3V2DPanelShell else 4 - if (len(shell.node_ids) != count or len(set(shell.node_ids)) != count or - any(node_id not in shell_index for node_id in shell.node_ids)): - raise ValueError("distinct declared Q4/S3 nodes required" if self._mixed_shells - else "four declared Q4 nodes required") - vertices = np.array([positions[node_id] for node_id in shell.node_ids]) - if count == 4: - _flat_vertices(vertices) - material_id = f"panel-material-{index}" - if modal_mass: - model.add_material(material_id, shell.E, shell.nu, density=shell.density_kg_m3) - else: - model.add_material(material_id, shell.E, shell.nu) - if self._mixed_shells: - element = create_shell_element( - index, list(shell.node_ids), material_id, - formulation="e4-pl-s3-v2d" if count == 3 else "e4-pl", - thickness=shell.thickness_m, - reference_normal=np.asarray(shell.reference_normal, dtype=float)) - else: - element = create_shell_element( - index, shell.node_ids, material_id, formulation="e4-pl", thickness=shell.thickness_m, - reference_normal=np.asarray(shell.reference_normal, dtype=float)) - if count == 4: - self._private_q4_elements.append(element) - model.add_element(index, element) - pieces.append((shell, vertices, element, material_id, count)) - # Native S3 scope validation must see the complete shell registry. - if diagnostic is not None: diagnostic.mark("shell_response_scatter") - for shell, vertices, element, material_id, count in pieces: - local = element.compute_stiffness_matrix( - model.mesh, model.get_material(material_id)) - if local.shape != (6*count, 6*count) or not np.isfinite(local).all(): - raise ExperimentalB2Q4PanelError("finite Q4/S3 stiffness required" if self._mixed_shells - else "finite Q4 stiffness required") - slots = np.array([6*shell_index[node_id]+component - for node_id in shell.node_ids - for component in range(6)]) - _scatter(rows, columns, values, slots, local) - if count == 4 and shell.density_kg_m3 is not None: - local_mass = physical_mass( - vertices, density_kg_m3=shell.density_kg_m3, - thickness_m=shell.thickness_m, - reference_normal=shell.reference_normal) - if complete_mass: - _scatter(mass_rows, mass_columns, mass_values, slots, local_mass) - if body_map is not None: - translations = np.zeros((24, 3)) - for i in range(4): - translations[6*i:6*i+3] = np.eye(3) - local_body = local_mass@translations - body_map[slots] += local_body - body_masses.append(fsum(float(v) for v in local_body[::6, 0])) - elif count == 3 and modal_mass: - local_mass = element.compute_mass_matrix(model.mesh, model.get_material(material_id)) - angular = np.array([6*i+j for i in range(3) for j in (3, 4, 5)]) - translation = np.array([6*i+j for i in range(3) for j in (0, 1, 2)]) - if (local_mass.shape != (18, 18) or not np.isfinite(local_mass).all() - or np.any(np.diag(local_mass)[translation] <= 0.) - or np.any(local_mass[angular, :] != 0.) - or np.any(local_mass[:, angular] != 0.)): - raise ValueError("native S3 translational mass is not representable with zero angular inertia") - _scatter(mass_rows, mass_columns, mass_values, slots, local_mass) - if count == 3 and body_map is not None: - density = shell.density_kg_m3 - area = .5*float(np.linalg.norm(np.cross(vertices[1]-vertices[0], vertices[2]-vertices[0]))) - weight = float(density)*shell.thickness_m*area/3. - if not isfinite(weight) or weight <= 0.: - raise RepresentabilityError("S3 reference body load is not representable") - for i in range(3): - body_map[slots[6*i:6*i+3]] += weight*np.eye(3) - body_masses.append(3.*weight) - shell_lookup[shell.shell_id] = (vertices, slots) - if diagnostic is not None: diagnostic.mark("beam_response_scatter") - member_lookup = {} - for member in compiled: - frame = member.local_dof_map() - local = frame.T @ member.operator.evaluate(np.zeros(12)).tangent @ frame - if local.shape != (12, 12) or not np.isfinite(local).all(): - raise ExperimentalB2Q4PanelError("finite physical B2 stiffness required") - slots = np.array([6*beam_index[node_id]+component - for node_id in member.definition.node_ids - for component in range(6)]) - _scatter(rows, columns, values, slots, local) - if complete_mass: - local_mass = frame.T@member.local_candidate_mass_matrix()@frame - if not np.isfinite(local_mass).all(): - raise ValueError("physical B2 mass assembly is not representable") - if modal_mass and np.any(np.diag(local_mass)[[0, 1, 2, 6, 7, 8]] <= 0.): - raise ValueError("physical B2 translational mass is not representable") - _scatter(mass_rows, mass_columns, mass_values, slots, local_mass) - if body_map is not None: - body_map[slots] += _beam_body_map(member, frame) - body_masses.append(member.definition.length_m*member.definition.mass.matrix_per_m[0][0]) - member_lookup[member.definition.member_id] = (member, slots) - if diagnostic is not None: diagnostic.mark("K_CSR") - K = sparse.coo_matrix((values, (rows, columns)), - shape=(total, total)).tocsr() - _release_coo_scratch(rows, columns, values, diagnostic, "K_CSR") - if diagnostic is not None: diagnostic.mark("attachment_rows") - constraint_rows, constraint_cols, constraint_values = [], [], [] - point_reference_frames = [] - point_laws = [] - buckling_points = [] - section_point_actions = {} - loaded_point_entries = {} - for point_index, point in enumerate(points): - if (point.shell_id not in shell_lookup or - point.member_id not in member_lookup): - raise ValueError("point host IDs must identify declared elements") - vertices, shell_slots = shell_lookup[point.shell_id] - member, beam_slots = member_lookup[point.member_id] - law = compile_reference_point( - member.definition, vertices, station=point.station, - offset_local_m=point.offset_local_m) - point_laws.append((point.point_id, law.law_id)) - buckling_points.append((point, law, vertices.copy(), member, - np.r_[shell_slots, beam_slots])) - if point_trace_policy is not None: - port_constraint = (law.beam_constraint_differential @ - np.kron(np.eye(2), member.definition.local_frame_rows().T)) - loaded_point_entries.setdefault(point.member_id, []).append( - (point_index, float(point.station), tuple(point.offset_local_m), port_constraint)) - if 0. < point.station < 1.: - d = np.array(point.offset_local_m, dtype=float, copy=True) - shift = np.eye(6) - shift[3:, :3] = ((0., -d[2], d[1]), (d[2], 0., -d[0]), (-d[1], d[0], 0.)) - pullback = shift@np.kron(np.eye(2), member.definition.local_frame_rows())@(-law.beam_constraint_differential.T) - pullback.setflags(write=False) - section_point_actions.setdefault(point.member_id, []).append( - (point_index, float(point.station), pullback)) - if footprints: - point_reference_frames.append(tuple( - tuple(tuple(map(float, row)) for row in frame) - for frame in law.reference_frames)) - slots = np.r_[shell_slots, beam_slots] - for local_row in range(6): - for local_col, slot in enumerate(slots): - constraint_rows.append(6*point_index+local_row) - constraint_cols.append(int(slot)) - constraint_values.append(law.constraint[local_row, local_col]) - for item in footprint_incidence: - slots = item.shell_slots+item.beam_slots - width = getattr(item, "row_count", 6) - local = np.column_stack((item.shell_matrix, getattr(item, "beam_matrix", np.eye(6)))) - for local_row in range(width): - for local_col, slot in enumerate(slots): - constraint_rows.append(item.row_start+local_row) - constraint_cols.append(slot) - constraint_values.append(local[local_row, local_col]) - if diagnostic is not None: diagnostic.mark("C_CSR") - C = sparse.coo_matrix( - (constraint_values, (constraint_rows, constraint_cols)), - shape=(6*len(points)+sum(getattr(item,"row_count",6) for item in footprint_incidence), total)).tocsr() - _release_coo_scratch(constraint_rows, constraint_cols, constraint_values, diagnostic, "C_CSR") - if diagnostic is not None: diagnostic.mark("support_reduction_scaling_elimination") - loaded_members = {} - H = None - if point_trace_policy is not None: - h_rows, h_columns, h_values = [], [], [] - for member_id, (member, _) in member_lookup.items(): - compiled_load = LoadedPointMember(member, loaded_point_entries.get(member_id, ()), - body_enabled=body_map is not None) - loaded_members[member_id] = compiled_load - slots = np.array([6*index+channel for index in compiled_load.point_indices - for channel in range(6)]) - _scatter(h_rows, h_columns, h_values, slots, compiled_load.constraint_compliance) - H = sparse.coo_matrix((h_values, (h_rows, h_columns)), shape=(C.shape[0],)*2).tocsr() - # Stored analytical zeros carry no numerical information. Remove - # them before congruence so underflow checks compare nonzero patterns. - H.eliminate_zeros() - try: - T = transformation.tocsr(copy=True) - u0 = np.array(prescribed_offset, dtype=float, copy=True) - except (AttributeError, TypeError, ValueError) as exc: - raise ValueError("finite sparse panel affine plan required") from exc - minimum_columns = C.shape[0] if point_trace_policy is None else 0 - if (T.shape[0] != total or T.shape[1] <= minimum_columns or - u0.shape != (total,) or not np.isfinite(T.data).all() or - not np.isfinite(u0).all()): - raise ValueError("finite sparse panel affine plan required") - if modal_mass: - if np.any(u0 != 0.): - raise ValueError("virgin mixed reference modes require zero prescribed offset") - selector = T.copy() - selector.eliminate_zeros() - if (np.any(np.diff(selector.tocsc().indptr) != 1) or - np.any(np.diff(selector.indptr) > 1)): - raise ValueError("mixed reference modes require coordinate supports without MPCs") - if self._modal_only: - delta = (T-sparse.eye(total, format="csr")) if T.shape == (total, total) else None - if delta is None or np.any(delta.data != 0.): - raise ValueError("free-free modal-only policy requires identity transformation without supports") - elif not _supports_all_panel_rigid_fields(T, positions, beam_positions): - raise ValueError("mixed reference modes require supports detecting all six rigid fields; free-free unsupported") - reduced_c = (C @ T).tocsc() - if point_trace_policy is None: - _require_independent_supported_point_rows(reduced_c) - elif not np.isfinite(reduced_c.data).all(): - raise ValueError("finite supported loaded-point rows required") - # Loaded fixed-end compliance can anchor a multiplier row even when - # its free-coordinate trace vanishes. Independence is therefore a - # property of the complete [K, C.T; C, -H] factorization on this route. - reduced_k = (T.T @ K @ T).tocsc() - # Congruence scaling changes factorization coordinates only. The - # physical displacement and multiplier are both restored after solve. - # Without this, a valid slender B2 section can leave point gaps above - # the physical acceptance tolerance despite a sound local operator. + if modal_mass: + for shell in shells: + density = shell.density_kg_m3 + if isinstance(density, (bool, np.bool_)) or not isinstance(density, Real): + raise ValueError("mixed reference modes require complete positive finite shell density") + try: + density_value = float(density) + except OverflowError as exc: + raise ValueError("mixed reference modes require representable shell density") from exc + if not isfinite(density_value) or density_value <= 0.: + raise ValueError("mixed reference modes require complete positive finite shell density") + if any(member.mass is None for member in definitions): + raise ValueError("mixed reference modes require complete declared physical B2 mass") + if any(member.geometric is not None for member in definitions): + raise ValueError("mixed reference modes are virgin elastic; prestress/geometric metadata unsupported") + _unique_ids(definitions, "member_id") + _require_connected_panel(shells, definitions, points, footprints) + cache = PhysicalB2OperatorCache() + if diagnostic is not None: diagnostic.mark("member_compilation") + compiled = tuple( + member if isinstance(member, CompiledPhysicalB2Member) + else member.compile_local(operator_cache=cache) + for member in supplied_members) + if diagnostic is not None: diagnostic.mark("topology_mapping") + shell_ids = tuple(sorted(shell_nodes_m)) + if any(type(node_id) is not int for node_id in shell_ids): + raise ValueError("integer shell node IDs required") + positions = {} + for node_id in shell_ids: + vector = np.array(shell_nodes_m[node_id], dtype=float, copy=True) + if vector.shape != (3,) or not np.isfinite(vector).all(): + raise ValueError("finite shell node coordinates required") + positions[node_id] = vector + used_shell_nodes = {node_id for shell in shells for node_id in shell.node_ids} + if used_shell_nodes != set(shell_ids): + raise ValueError("every declared shell node must belong to a Q4/S3" if self._mixed_shells + else "every declared shell node must belong to a Q4") + shell_index = {node_id: i for i, node_id in enumerate(shell_ids)} + beam_positions = {} + for member in definitions: + for node_id, point in zip(member.node_ids, member.reference_points_m): + old = beam_positions.setdefault(node_id, point) + if old != point: + raise ValueError("shared B2 node has inconsistent position") + beam_ids = tuple(sorted(beam_positions)) + beam_index = {node_id: i+len(shell_ids) + for i, node_id in enumerate(beam_ids)} + footprint_compiler = compile_physical_footprints if self._physical_footprint_law else compile_footprints + footprints, footprint_incidence = footprint_compiler( + footprints, positions, shells, beam_positions, + shell_index, beam_index, points) + total = 6*(len(shell_ids)+len(beam_ids)) + for shell in shells: + density = shell.density_kg_m3 + if density is not None: + if isinstance(density, (bool, np.bool_)) or not isinstance(density, Real): + raise ValueError("positive finite shell density required when supplied") + try: + density_value = float(density) + except (ValueError, TypeError, OverflowError) as exc: + raise ValueError("representable positive shell density required") from exc + if not isfinite(density_value) or density_value <= 0.: + raise ValueError("positive finite shell density required when supplied") + complete_body_mass = (all(shell.density_kg_m3 is not None for shell in shells) + and all(member.definition.mass is not None for member in compiled)) + body_map = np.zeros((total, 3)) if complete_body_mass else None + body_masses = [] + if diagnostic is not None: diagnostic.mark("shell_model_setup") + model = FEModel("experimental-multi-Q4-B2-point") + self._private_q4_mesh = model.mesh + for node_id in shell_ids: + model.add_node(node_id, *positions[node_id]) + rows, columns, values = [], [], [] + mass_rows, mass_columns, mass_values = [], [], [] + complete_mass = (not has_s3 or modal_mass) and all(shell.density_kg_m3 is not None for shell in shells) + complete_mass = complete_mass and all(member.definition.mass is not None + for member in compiled) + shell_lookup = {} + pieces = [] + for index, shell in enumerate(shells, 1): + count = 3 if type(shell) is S3V2DPanelShell else 4 + if (len(shell.node_ids) != count or len(set(shell.node_ids)) != count or + any(node_id not in shell_index for node_id in shell.node_ids)): + raise ValueError("distinct declared Q4/S3 nodes required" if self._mixed_shells + else "four declared Q4 nodes required") + vertices = np.array([positions[node_id] for node_id in shell.node_ids]) + if count == 4: + _flat_vertices(vertices) + material_id = f"panel-material-{index}" + if modal_mass: + model.add_material(material_id, shell.E, shell.nu, density=shell.density_kg_m3) + else: + model.add_material(material_id, shell.E, shell.nu) + if self._mixed_shells: + element = create_shell_element( + index, list(shell.node_ids), material_id, + formulation="e4-pl-s3-v2d" if count == 3 else "e4-pl", + thickness=shell.thickness_m, + reference_normal=np.asarray(shell.reference_normal, dtype=float)) + else: + element = create_shell_element( + index, shell.node_ids, material_id, formulation="e4-pl", thickness=shell.thickness_m, + reference_normal=np.asarray(shell.reference_normal, dtype=float)) + if count == 4: + self._private_q4_elements.append(element) + model.add_element(index, element) + pieces.append((shell, vertices, element, material_id, count)) + # Native S3 scope validation must see the complete shell registry. + if diagnostic is not None: diagnostic.mark("shell_response_scatter") + for shell, vertices, element, material_id, count in pieces: + local = element.compute_stiffness_matrix( + model.mesh, model.get_material(material_id)) + if local.shape != (6*count, 6*count) or not np.isfinite(local).all(): + raise ExperimentalB2Q4PanelError("finite Q4/S3 stiffness required" if self._mixed_shells + else "finite Q4 stiffness required") + slots = np.array([6*shell_index[node_id]+component + for node_id in shell.node_ids + for component in range(6)]) + _scatter(rows, columns, values, slots, local) + if count == 4 and shell.density_kg_m3 is not None: + local_mass = physical_mass( + vertices, density_kg_m3=shell.density_kg_m3, + thickness_m=shell.thickness_m, + reference_normal=shell.reference_normal) + if complete_mass: + _scatter(mass_rows, mass_columns, mass_values, slots, local_mass) + if body_map is not None: + translations = np.zeros((24, 3)) + for i in range(4): + translations[6*i:6*i+3] = np.eye(3) + local_body = local_mass@translations + body_map[slots] += local_body + body_masses.append(fsum(float(v) for v in local_body[::6, 0])) + elif count == 3 and modal_mass: + local_mass = element.compute_mass_matrix(model.mesh, model.get_material(material_id)) + angular = np.array([6*i+j for i in range(3) for j in (3, 4, 5)]) + translation = np.array([6*i+j for i in range(3) for j in (0, 1, 2)]) + if (local_mass.shape != (18, 18) or not np.isfinite(local_mass).all() + or np.any(np.diag(local_mass)[translation] <= 0.) + or np.any(local_mass[angular, :] != 0.) + or np.any(local_mass[:, angular] != 0.)): + raise ValueError("native S3 translational mass is not representable with zero angular inertia") + _scatter(mass_rows, mass_columns, mass_values, slots, local_mass) + if count == 3 and body_map is not None: + density = shell.density_kg_m3 + area = .5*float(np.linalg.norm(np.cross(vertices[1]-vertices[0], vertices[2]-vertices[0]))) + weight = float(density)*shell.thickness_m*area/3. + if not isfinite(weight) or weight <= 0.: + raise RepresentabilityError("S3 reference body load is not representable") + for i in range(3): + body_map[slots[6*i:6*i+3]] += weight*np.eye(3) + body_masses.append(3.*weight) + shell_lookup[shell.shell_id] = (vertices, slots) + if diagnostic is not None: diagnostic.mark("beam_response_scatter") + member_lookup = {} + for member in compiled: + frame = member.local_dof_map() + local = frame.T @ member.operator.evaluate(np.zeros(12)).tangent @ frame + if local.shape != (12, 12) or not np.isfinite(local).all(): + raise ExperimentalB2Q4PanelError("finite physical B2 stiffness required") + slots = np.array([6*beam_index[node_id]+component + for node_id in member.definition.node_ids + for component in range(6)]) + _scatter(rows, columns, values, slots, local) + if complete_mass: + local_mass = frame.T@member.local_candidate_mass_matrix()@frame + if not np.isfinite(local_mass).all(): + raise ValueError("physical B2 mass assembly is not representable") + if modal_mass and np.any(np.diag(local_mass)[[0, 1, 2, 6, 7, 8]] <= 0.): + raise ValueError("physical B2 translational mass is not representable") + _scatter(mass_rows, mass_columns, mass_values, slots, local_mass) + if body_map is not None: + body_map[slots] += _beam_body_map(member, frame) + body_masses.append(member.definition.length_m*member.definition.mass.matrix_per_m[0][0]) + member_lookup[member.definition.member_id] = (member, slots) + if diagnostic is not None: diagnostic.mark("K_CSR") + K = sparse.coo_matrix((values, (rows, columns)), + shape=(total, total)).tocsr() + _release_coo_scratch(rows, columns, values, diagnostic, "K_CSR") + if diagnostic is not None: diagnostic.mark("attachment_rows") + constraint_rows, constraint_cols, constraint_values = [], [], [] + point_reference_frames = [] + point_laws = [] + buckling_points = [] + section_point_actions = {} + loaded_point_entries = {} + for point_index, point in enumerate(points): + if (point.shell_id not in shell_lookup or + point.member_id not in member_lookup): + raise ValueError("point host IDs must identify declared elements") + vertices, shell_slots = shell_lookup[point.shell_id] + member, beam_slots = member_lookup[point.member_id] + law = compile_reference_point( + member.definition, vertices, station=point.station, + offset_local_m=point.offset_local_m) + point_laws.append((point.point_id, law.law_id)) + buckling_points.append((point, law, vertices.copy(), member, + np.r_[shell_slots, beam_slots])) + if point_trace_policy is not None: + port_constraint = (law.beam_constraint_differential @ + np.kron(np.eye(2), member.definition.local_frame_rows().T)) + loaded_point_entries.setdefault(point.member_id, []).append( + (point_index, float(point.station), tuple(point.offset_local_m), port_constraint)) + if 0. < point.station < 1.: + d = np.array(point.offset_local_m, dtype=float, copy=True) + shift = np.eye(6) + shift[3:, :3] = ((0., -d[2], d[1]), (d[2], 0., -d[0]), (-d[1], d[0], 0.)) + pullback = shift@np.kron(np.eye(2), member.definition.local_frame_rows())@(-law.beam_constraint_differential.T) + pullback.setflags(write=False) + section_point_actions.setdefault(point.member_id, []).append( + (point_index, float(point.station), pullback)) + if footprints: + point_reference_frames.append(tuple( + tuple(tuple(map(float, row)) for row in frame) + for frame in law.reference_frames)) + slots = np.r_[shell_slots, beam_slots] + for local_row in range(6): + for local_col, slot in enumerate(slots): + constraint_rows.append(6*point_index+local_row) + constraint_cols.append(int(slot)) + constraint_values.append(law.constraint[local_row, local_col]) + for item in footprint_incidence: + slots = item.shell_slots+item.beam_slots + width = getattr(item, "row_count", 6) + local = np.column_stack((item.shell_matrix, getattr(item, "beam_matrix", np.eye(6)))) + for local_row in range(width): + for local_col, slot in enumerate(slots): + constraint_rows.append(item.row_start+local_row) + constraint_cols.append(slot) + constraint_values.append(local[local_row, local_col]) + if diagnostic is not None: diagnostic.mark("C_CSR") + C = sparse.coo_matrix( + (constraint_values, (constraint_rows, constraint_cols)), + shape=(6*len(points)+sum(getattr(item,"row_count",6) for item in footprint_incidence), total)).tocsr() + _release_coo_scratch(constraint_rows, constraint_cols, constraint_values, diagnostic, "C_CSR") + if diagnostic is not None: diagnostic.mark("support_reduction_scaling_elimination") + loaded_members = {} + H = None + if point_trace_policy is not None: + h_rows, h_columns, h_values = [], [], [] + for member_id, (member, _) in member_lookup.items(): + compiled_load = LoadedPointMember(member, loaded_point_entries.get(member_id, ()), + body_enabled=body_map is not None) + loaded_members[member_id] = compiled_load + slots = np.array([6*index+channel for index in compiled_load.point_indices + for channel in range(6)]) + _scatter(h_rows, h_columns, h_values, slots, compiled_load.constraint_compliance) + H = sparse.coo_matrix((h_values, (h_rows, h_columns)), shape=(C.shape[0],)*2).tocsr() + # Stored analytical zeros carry no numerical information. Remove + # them before congruence so underflow checks compare nonzero patterns. + H.eliminate_zeros() + try: + T = transformation.tocsr(copy=True) + u0 = np.array(prescribed_offset, dtype=float, copy=True) + except (AttributeError, TypeError, ValueError) as exc: + raise ValueError("finite sparse panel affine plan required") from exc + minimum_columns = C.shape[0] if point_trace_policy is None else 0 + if (T.shape[0] != total or T.shape[1] <= minimum_columns or + u0.shape != (total,) or not np.isfinite(T.data).all() or + not np.isfinite(u0).all()): + raise ValueError("finite sparse panel affine plan required") + if modal_mass: + if np.any(u0 != 0.): + raise ValueError("virgin mixed reference modes require zero prescribed offset") + selector = T.copy() + selector.eliminate_zeros() + if (np.any(np.diff(selector.tocsc().indptr) != 1) or + np.any(np.diff(selector.indptr) > 1)): + raise ValueError("mixed reference modes require coordinate supports without MPCs") + if self._modal_only: + delta = (T-sparse.eye(total, format="csr")) if T.shape == (total, total) else None + if delta is None or np.any(delta.data != 0.): + raise ValueError("free-free modal-only policy requires identity transformation without supports") + elif not _supports_all_panel_rigid_fields(T, positions, beam_positions): + raise ValueError("mixed reference modes require supports detecting all six rigid fields; free-free unsupported") + reduced_c = (C @ T).tocsc() + if point_trace_policy is None: + _require_independent_supported_point_rows(reduced_c) + elif not np.isfinite(reduced_c.data).all(): + raise ValueError("finite supported loaded-point rows required") + # Loaded fixed-end compliance can anchor a multiplier row even when + # its free-coordinate trace vanishes. Independence is therefore a + # property of the complete [K, C.T; C, -H] factorization on this route. + reduced_k = (T.T @ K @ T).tocsc() + # Congruence scaling changes factorization coordinates only. The + # physical displacement and multiplier are both restored after solve. + # Without this, a valid slender B2 section can leave point gaps above + # the physical acceptance tolerance despite a sound local operator. handle = factor_scale = None attachment_maps = None attachment_reason = "not_physical_static_family" @@ -1136,7 +1136,7 @@ def __init__(self, shell_nodes_m: Mapping[int, Sequence[float]], scaled_kkt=scaled_kkt,factor_scale=factor_scale,attachment_maps=attachment_maps, model=model,positions=positions,beam_positions=beam_positions,shell_index=shell_index, beam_index=beam_index,shell_lookup=shell_lookup,member_lookup=member_lookup, - footprint_incidence=footprint_incidence,compiled=compiled,cache=cache, + footprint_incidence=footprint_incidence,compiled=compiled,cache=cache, private_q4_elements=self._private_q4_elements), dict(rows=rows,columns=columns,values=values,constraint_rows=constraint_rows, constraint_cols=constraint_cols,constraint_values=constraint_values, @@ -1145,131 +1145,131 @@ def __init__(self, shell_nodes_m: Mapping[int, Sequence[float]], *(m for m in supplied_members if isinstance(m,CompiledPhysicalB2Member)))) handle = (attachment_maps.factorize() if attachment_maps is not None else factorize_cached(scaled_kkt, MatrixClass.SYMMETRIC_INDEFINITE)) - if handle.status != "ok": - raise ExperimentalB2Q4PanelError( - "panel factorization failed: " + str(handle.failure_reason)) - if diagnostic is not None: - try: diagnostic.mark("owner_publication") - except BaseException: - if handle is not None: - try: handle.close() - except BaseException: pass - raise - self._modal_positions = (np.array( - [positions[i] for i in shell_ids]+[beam_positions[i] for i in beam_ids], - dtype=float, copy=True) if self._modal_only else None) - self.shell_node_ids = shell_ids - self.beam_node_ids = beam_ids - self.point_ids = tuple(point.point_id for point in points) - self._has_s3 = has_s3 - self._reference_inertia_policy = reference_inertia_policy - self._shell_formulations = tuple((shell.shell_id, element.formulation_id) - for shell, _, element, _, _ in pieces) - self._point_laws = tuple(point_laws) - self._point_reference_frames = tuple(point_reference_frames) - self.footprints = footprints - self.footprint_ids = tuple(g.footprint_id for g in footprints) - self._footprint_incidence = footprint_incidence - self._members = tuple(member_lookup.items()) - self._section_point_actions = {key: tuple(value) for key, value in section_point_actions.items()} - self._loaded_members = loaded_members - self._H = H - self._abs_H = None if H is None else abs(H) - self._K = K - # Spectral-only captures reuse the exact prepared reference operators; - # no accepted state or nonlinear material history is manufactured. - self._buckling_model = model - self._buckling_shells = tuple((shell, element, material_id, - shell_lookup[shell.shell_id][1]) for shell, _, element, material_id, _ in pieces) - self._buckling_points = tuple(buckling_points) - if body_map is not None and not np.isfinite(body_map).all(): - raise RepresentabilityError("reference body-load map is not representable") - self._body_map = body_map - self._body_mass = None - if self._body_map is not None: - try: - self._body_mass = fsum(body_masses) - except OverflowError as exc: - raise RepresentabilityError("total reference body mass is not representable") from exc - if not isfinite(self._body_mass) or self._body_mass <= 0.: - raise RepresentabilityError("total reference body mass is not representable") - self._body_map.setflags(write=False) - self._M = (sparse.coo_matrix((mass_values, (mass_rows, mass_columns)), - shape=(total, total)).tocsr() - if complete_mass else None) - if self._M is not None and not np.isfinite(self._M.data).all(): - raise ValueError("physical panel mass assembly is not representable") - self._C = C - # Freeze a translation scale from the physical reference geometry; - # rotation constraints remain in radians. Origin shifts do not alter it. - self._compatibility_length = None - if footprints: - reference = np.asarray(tuple(positions.values())+tuple(beam_positions.values())) - relative = reference-reference[0] - radius = np.linalg.norm(relative-np.mean(relative, axis=0), axis=1) - self._compatibility_length = 2.*float(np.max(radius)) - if not isfinite(self._compatibility_length) or self._compatibility_length <= 0.: - raise ValueError("representable physical reference length required") - self._T = T - self._Tt = T.T.tocsr() - self._projection_multi = np.flatnonzero( - np.diff(self._Tt.indptr) > 1) - self._projection_single = np.flatnonzero( - np.diff(self._Tt.indptr) == 1) - # Reuse the immutable CSR patterns; only the absolute values need - # separate storage for repeated RHS validation. - self._abs_K = sparse.csr_matrix( - (np.abs(K.data), K.indices, K.indptr), shape=K.shape, copy=False) - self._abs_C = sparse.csr_matrix( - (np.abs(C.data), C.indices, C.indptr), shape=C.shape, copy=False) - self._abs_Ct = abs(C.T.tocsr()) - self._abs_Tt = abs(T.T.tocsr()) - self._u0 = u0 - # One compilation-time binding covers the numerical model and physical - # member data used by body action/recovery. Never hash the model per case. - identity = sha256(b"B2_REFERENCE_BODY_LOAD_BINDING_V1_DEV") - if self._modal_only: - identity.update(reference_boundary_policy.encode("ascii")) - identity.update(repr((shell_ids, beam_ids, tuple((i, tuple(positions[i])) for i in shell_ids), self._shell_formulations, - tuple(point_laws), reference_inertia_policy)).encode("utf-8")) - for matrix in (K, C, T): - data = matrix.tocsr() - identity.update(repr(data.shape).encode("ascii")) - for array in (data.indptr, data.indices): - identity.update(np.asarray(array, dtype=" 1) + self._projection_single = np.flatnonzero( + np.diff(self._Tt.indptr) == 1) + # Reuse the immutable CSR patterns; only the absolute values need + # separate storage for repeated RHS validation. + self._abs_K = sparse.csr_matrix( + (np.abs(K.data), K.indices, K.indptr), shape=K.shape, copy=False) + self._abs_C = sparse.csr_matrix( + (np.abs(C.data), C.indices, C.indptr), shape=C.shape, copy=False) + self._abs_Ct = abs(C.T.tocsr()) + self._abs_Tt = abs(T.T.tocsr()) + self._u0 = u0 + # One compilation-time binding covers the numerical model and physical + # member data used by body action/recovery. Never hash the model per case. + identity = sha256(b"B2_REFERENCE_BODY_LOAD_BINDING_V1_DEV") + if self._modal_only: + identity.update(reference_boundary_policy.encode("ascii")) + identity.update(repr((shell_ids, beam_ids, tuple((i, tuple(positions[i])) for i in shell_ids), self._shell_formulations, + tuple(point_laws), reference_inertia_policy)).encode("utf-8")) + for matrix in (K, C, T): + data = matrix.tocsr() + identity.update(repr(data.shape).encode("ascii")) + for array in (data.indptr, data.indices): + identity.update(np.asarray(array, dtype=" 0.) - ratios[(tolerance == 0.) & (projected == 0.)] = 0. - return float(np.max(ratios)) - - def _physical_work_ratio(self, answer, applied): - """Check one explicit physical load against homogeneous-constraint work.""" - if np.any(self._u0 != 0.): - return 0. - q = answer[:-len(self._cu0)] - u = np.asarray(self._T @ q).reshape(-1) - with np.errstate(over="ignore", under="ignore", invalid="ignore"): - internal = float(u @ (self._K @ u)) - external = float(u @ applied) - if not isfinite(internal) or not isfinite(external): - raise _NumericalFailure("panel physical footprint work is not representable") - defect = abs(internal-external) - # The physical-footprint family admits no points, body-load driver or - # nonzero constraint RHS. Keep the registered work absolute allowance. - tolerance = 1e-12 + 1e-8*abs(external) - return defect/tolerance - + self._closed = False + if diagnostic is not None: + try: diagnostic.finish() + except BaseException: + try: self.close() + except BaseException: pass + raise + + def _physical_equilibrium_ratio(self, answer, applied): + """Measure the existing per-row equilibrium check before recovery.""" + q, lam = answer[:-len(self._cu0)], answer[-len(self._cu0):] + u = np.asarray(self._T @ q).reshape(-1)+self._u0 + force = np.asarray(self._K @ u).reshape(-1) + constraint_force = np.asarray(self._C.T @ lam).reshape(-1) + projected = self._project(force+constraint_force-applied) + physical_force_scale = np.asarray( + self._abs_K @ np.abs(u)+self._abs_Ct @ np.abs(lam)+ + np.abs(applied)).reshape(-1) + equilibrium_scale = np.asarray(self._abs_Tt @ physical_force_scale).reshape(-1) + by_node = physical_force_scale.reshape(-1, 6) + physical_roundoff = np.tile( + (float(np.max(by_node[:, :3])),)*3+ + (float(np.max(by_node[:, 3:])),)*3, len(by_node)) + projected_roundoff = np.asarray(self._abs_Tt @ physical_roundoff).reshape(-1) + tolerance = (1e-9*equilibrium_scale+ + len(answer)*np.finfo(float).eps*projected_roundoff) + if (not np.isfinite(projected).all() or + not np.isfinite(tolerance).all() or np.any(tolerance < 0.)): + raise _NumericalFailure("panel equilibrium correction is not representable") + with np.errstate(divide="ignore", invalid="ignore"): + ratios = np.divide(np.abs(projected), tolerance, + out=np.full_like(projected, np.inf), + where=tolerance > 0.) + ratios[(tolerance == 0.) & (projected == 0.)] = 0. + return float(np.max(ratios)) + + def _physical_work_ratio(self, answer, applied): + """Check one explicit physical load against homogeneous-constraint work.""" + if np.any(self._u0 != 0.): + return 0. + q = answer[:-len(self._cu0)] + u = np.asarray(self._T @ q).reshape(-1) + with np.errstate(over="ignore", under="ignore", invalid="ignore"): + internal = float(u @ (self._K @ u)) + external = float(u @ applied) + if not isfinite(internal) or not isfinite(external): + raise _NumericalFailure("panel physical footprint work is not representable") + defect = abs(internal-external) + # The physical-footprint family admits no points, body-load driver or + # nonzero constraint RHS. Keep the registered work absolute allowance. + tolerance = 1e-12 + 1e-8*abs(external) + return defect/tolerance + @staticmethod def _structural_physical_singletons(C, T, u0): """Admit only a single product with individually zero offset terms. @@ -1437,9 +1437,9 @@ def _correct_physical_equilibrium(self, scaled_answer, scaled_rhs, applied): Physical equation/work/compatibility acceptance remains unchanged. """ answer = self._restore_physical_singletons(self._factor_scale*scaled_answer) - original_ratio = self._physical_equilibrium_ratio(answer, applied) - original_work_ratio = self._physical_work_ratio(answer, applied) - original_score = max(original_ratio, original_work_ratio) + original_ratio = self._physical_equilibrium_ratio(answer, applied) + original_work_ratio = self._physical_work_ratio(answer, applied) + original_score = max(original_ratio, original_work_ratio) if original_score <= 1.: return answer original_target = self._physical_original_residual(answer, applied) @@ -1447,37 +1447,37 @@ def _correct_physical_equilibrium(self, scaled_answer, scaled_rhs, applied): correction_rhs = -self._factor_scale*original_target if (not np.isfinite(correction_rhs).all() or np.any((original_target != 0.) & (correction_rhs == 0.))): - raise _NumericalFailure("panel equilibrium correction is not representable") - try: - delta = np.asarray(self._handle.solve(correction_rhs), dtype=float) - except RuntimeError as exc: - raise _NumericalFailure("panel equilibrium correction failed: " + str(exc)) from exc + raise _NumericalFailure("panel equilibrium correction is not representable") + try: + delta = np.asarray(self._handle.solve(correction_rhs), dtype=float) + except RuntimeError as exc: + raise _NumericalFailure("panel equilibrium correction failed: " + str(exc)) from exc with np.errstate(over="ignore", under="ignore", invalid="ignore"): candidate = answer+self._factor_scale*delta if candidate.shape != answer.shape or not np.isfinite(candidate).all(): raise _NumericalFailure("finite panel equilibrium correction required") candidate = self._restore_physical_singletons(candidate) - candidate_score = max(self._physical_equilibrium_ratio(candidate, applied), - self._physical_work_ratio(candidate, applied)) - if candidate_score >= original_score: - raise _NumericalFailure("panel equilibrium correction did not improve") - return candidate - + candidate_score = max(self._physical_equilibrium_ratio(candidate, applied), + self._physical_work_ratio(candidate, applied)) + if candidate_score >= original_score: + raise _NumericalFailure("panel equilibrium correction did not improve") + return candidate + def _explicit_load_resolved(self, answer, rhs, explicit_rhs, *, applied=None, reconstructed=None) -> bool: - """Certify active stored KKT rows without a model-wide force floor. - + """Certify active stored KKT rows without a model-wide force floor. + Pure unit selectors retain the stored KKT certificate. Zero-offset footprint affine maps certify exact physical virtual equilibrium and the actual reconstruction error from original sparse operators/load. Nonzero offsets and loaded-point affine maps remain ineligible. This resolves net projected loads only, not cancelling individual actions. All existing physical equilibrium/compatibility checks still apply. - """ - if (np.any(self._u0 != 0.) or not np.isfinite(answer).all() or - not np.isfinite(rhs).all()): - return False - selector = self._T.tocsc(copy=True) - selector.eliminate_zeros() + """ + if (np.any(self._u0 != 0.) or not np.isfinite(answer).all() or + not np.isfinite(rhs).all()): + return False + selector = self._T.tocsc(copy=True) + selector.eliminate_zeros() if (np.any(np.diff(selector.indptr) != 1) or np.any(selector.data != 1.) or len(np.unique(selector.indices)) != selector.shape[1]): @@ -1488,960 +1488,960 @@ def _explicit_load_resolved(self, answer, rhs, explicit_rhs, *, applied=None, re return certify_affine(self._K,self._C,self._T,answer,applied,reconstructed,self._affine_resolution_cache) except B2NumericalSolveFailure: return False - active = np.flatnonzero(explicit_rhs > 0.) - with np.errstate(over="ignore", under="ignore", invalid="ignore"): - cap = np.nextafter(1e-9*explicit_rhs[active], 0.) - if not len(active) or np.any(cap <= 0.) or not np.isfinite(cap).all(): - return False - if self._resolution_kkt is None: - columns = selector.indices - rk = self._K.tocsr()[columns][:, columns] - rc = self._C.tocsr()[:, columns] - self._resolution_kkt = sparse.bmat( - ((rk, rc.T), (rc, None if self._point_trace_policy is None else -self._H)), format="csr") - try: - _, upper = _bounded_accurate_residual( - self._resolution_kkt[active], answer[:, None], rhs[active, None]) - except B2NumericalSolveFailure: - return False - return bool(np.isfinite(upper).all() and np.all(upper[:, 0] <= cap)) - - def _project(self, values: np.ndarray) -> np.ndarray: - return _checked_affine_projection( - self._Tt, self._projection_multi, self._projection_single, values) - - def _footprint_gap_tolerance(self, u, gap_scale, roundoff_fraction): - """Quiet-channel solve admission, bounded by reference compatibility. - + active = np.flatnonzero(explicit_rhs > 0.) + with np.errstate(over="ignore", under="ignore", invalid="ignore"): + cap = np.nextafter(1e-9*explicit_rhs[active], 0.) + if not len(active) or np.any(cap <= 0.) or not np.isfinite(cap).all(): + return False + if self._resolution_kkt is None: + columns = selector.indices + rk = self._K.tocsr()[columns][:, columns] + rc = self._C.tocsr()[:, columns] + self._resolution_kkt = sparse.bmat( + ((rk, rc.T), (rc, None if self._point_trace_policy is None else -self._H)), format="csr") + try: + _, upper = _bounded_accurate_residual( + self._resolution_kkt[active], answer[:, None], rhs[active, None]) + except B2NumericalSolveFailure: + return False + return bool(np.isfinite(upper).all() and np.all(upper[:, 0] <= cap)) + + def _project(self, values: np.ndarray) -> np.ndarray: + return _checked_affine_projection( + self._Tt, self._projection_multi, self._projection_single, values) + + def _footprint_gap_tolerance(self, u, gap_scale, roundoff_fraction): + """Quiet-channel solve admission, bounded by reference compatibility. + Called only after explicit-load certification for unit selectors or proved general-affine footprint maps, with zero offsets. This is a solve/compatibility convention, not a bound on - rounding in C@u. Translation and rotation amplitudes stay separate; - actual row coefficients include eccentric lever arms. Historical point - rows retain their original check. Every footprint row also stays below - the independent reference-geometry 1e-9 compatibility cap. - """ - tolerance = 1e-9*gap_scale - poses = np.abs(u).reshape(-1, 6) - amplitude = np.tile((float(np.max(poses[:, :3])),)*3+ - (float(np.max(poses[:, 3:])),)*3, len(poses)) - allowance = roundoff_fraction*np.asarray(self._abs_C@amplitude).reshape(-1) - if not np.isfinite(allowance).all(): - raise _NumericalFailure("footprint compatibility allowance is not representable") - for item in self._footprint_incidence: - width = getattr(item,"row_count",6) - rows = slice(item.row_start, item.row_start+width) - cap = 1e-9*np.array((self._compatibility_length,)*3+(1.,)*(width-3)) - tolerance[rows] = np.minimum(tolerance[rows]+allowance[rows], cap) - return tolerance - - @property - def capabilities(self) -> ExperimentalB2Q4PanelCapabilities: - if self._physical_footprint_law: - return B2PhysicalRigidFootprintCapabilities( - attachment="physical rigid-region translations and director tangents; five rows per selected node", + rounding in C@u. Translation and rotation amplitudes stay separate; + actual row coefficients include eccentric lever arms. Historical point + rows retain their original check. Every footprint row also stays below + the independent reference-geometry 1e-9 compatibility cap. + """ + tolerance = 1e-9*gap_scale + poses = np.abs(u).reshape(-1, 6) + amplitude = np.tile((float(np.max(poses[:, :3])),)*3+ + (float(np.max(poses[:, 3:])),)*3, len(poses)) + allowance = roundoff_fraction*np.asarray(self._abs_C@amplitude).reshape(-1) + if not np.isfinite(allowance).all(): + raise _NumericalFailure("footprint compatibility allowance is not representable") + for item in self._footprint_incidence: + width = getattr(item,"row_count",6) + rows = slice(item.row_start, item.row_start+width) + cap = 1e-9*np.array((self._compatibility_length,)*3+(1.,)*(width-3)) + tolerance[rows] = np.minimum(tolerance[rows]+allowance[rows], cap) + return tolerance + + @property + def capabilities(self) -> ExperimentalB2Q4PanelCapabilities: + if self._physical_footprint_law: + return B2PhysicalRigidFootprintCapabilities( + attachment="physical rigid-region translations and director tangents; five rows per selected node", operations=(("solve_linear","solve_linear_many","close") if self._has_s3 else ("solve_linear","solve_linear_many","buckling","close")), spectral_domain=("S3/mixed physical footprint modes and buckling unsupported" if self._has_s3 else "explicit physical-footprint conservative reference buckling request; modes unavailable without mass contract"), - footprints=self.footprints) - if self._modal_only: - return ExperimentalB2Q4PanelCapabilities( - operations=("modes", "close"), - body_load_domain="unsupported by free-free modal-only policy", - spectral_domain="experimental connected free-free reference descriptor; six verified physical rigid fields and selected finite flexible pairs; completeness unqualified") - body_operations = (("body_acceleration_load",) if self._body_map is not None else ()) - body_domain = ("experimental reference-linear uniform global acceleration; typed loads give separate equilibrated section fields including interior point actions; raw vectors retain nodal constitutive recovery; loaded interior pose and finite gravity unsupported" - if self._body_map is not None else "unavailable without complete physical density/mass") - if self._point_trace_policy is not None: - return ExperimentalB2LoadedPointCapabilities( - attachment="explicit fixed-end loaded finite-vertex point trace", - operations=("solve_linear", "solve_linear_many", "close") + body_operations, - body_load_domain=("typed reference body acceleration and multiplier-dependent fixed-end bubbles; " - "raw arrays are nodal loads; finite gravity unsupported" if self._body_map is not None - else body_domain)) - if self.footprints: - admitted = (self._M is not None and self._coordinate_modal_supports() - and not np.any(self._u0 != 0.) and self._footprint_rigid_supported) - return ExperimentalB2Q4FootprintCapabilities( - attachment="explicit reference-linear selected-node rigid footprints and finite-vertex points", - operations=(("solve_linear", "solve_linear_many", "modes", "close") - if admitted else ("solve_linear", "solve_linear_many", "close")) + body_operations, - body_load_domain=body_domain, - spectral_domain=("experimental virgin supported reference modes; normal-spin locked; " - "mechanical qualification incomplete; prestress unsupported" - if admitted else - "reference modes require complete physical mass, coordinate supports detecting all six rigid fields and zero offset; " - "normal-spin locked; mechanical qualification incomplete; prestress unsupported"), - footprints=self.footprints) - if self._M is None: - return ExperimentalB2Q4PanelCapabilities( - operations=("solve_linear", "solve_linear_many", "close") + body_operations, - body_load_domain=body_domain) - return ExperimentalB2Q4PanelCapabilities( - operations=("solve_linear", "solve_linear_many", "modes", "close") + body_operations, - body_load_domain=body_domain, - spectral_domain="experimental reference B2/Q4 finite pairs with coordinate supports; completeness unqualified") - - def body_acceleration_load(self, acceleration_m_s2) -> B2ReferenceBodyLoad: - """Prepare an owned dead-load vector without assembling or factoring. - - f = integral D.T rho a uses the compiled physical trace and mass origin. - Pass ``result.load`` to the existing static or compatible batch route. - """ - if self._closed: - raise ExperimentalB2Q4PanelError("experimental panel is closed") - if self._modal_only: - raise ValueError("free-free modal-only policy does not admit body loads") - if self._body_map is None: - raise ValueError("complete physical density/mass required for reference body load") - raw = np.asarray(acceleration_m_s2, dtype=object) - if (raw.shape != (3,) or any(isinstance(v, (bool, np.bool_)) or - not isinstance(v, Real) for v in raw.flat)): - raise ValueError("three finite real global acceleration components required") - try: - acceleration = np.array(raw, dtype=float, copy=True) - except (ValueError, TypeError, OverflowError) as exc: - raise ValueError("three finite real global acceleration components required") from exc - if not np.isfinite(acceleration).all(): - raise ValueError("three finite real global acceleration components required") - with np.errstate(over="ignore", invalid="ignore", under="ignore"): - applied = self._body_map@acceleration - if not np.isfinite(applied).all(): - raise RepresentabilityError("reference body acceleration load is not representable") - # A finite vector can still lose a required force through underflow or - # cancellation. Test rigid-translation work against integrated physical - # mass without adding an absolute load floor or changing solver criteria. - for axis, component in enumerate(acceleration): - if component == 0.: - continue - expected = self._body_mass*float(component) - try: - actual = fsum(float(v) for v in applied[axis::6]) - except OverflowError as exc: - raise RepresentabilityError("reference body force is not representable") from exc - if (not isfinite(expected) or expected == 0. or not isfinite(actual) - or abs(actual/expected-1.) > 1e-9): - raise RepresentabilityError("required reference body force is not representable") - return B2ReferenceBodyLoad(tuple(float(v) for v in acceleration), - self.shell_node_ids, self.beam_node_ids, applied, - self._body_model_identity) - - def _body_load_snapshot(self, load): - if isinstance(load, B2ReferenceBodyLoad): - if (load.model_identity != self._body_model_identity or - load.shell_node_ids != self.shell_node_ids or load.beam_node_ids != self.beam_node_ids): - raise ValueError("body load belongs to a different compiled model") - expected = self.body_acceleration_load(load.acceleration_m_s2) - if not np.array_equal(load.load, expected.load): - raise ValueError("body load values disagree with its physical acceleration") - snapshot, fingerprint = _load_value_snapshot(load.load, self._u0.shape) - metadata = sha256(fingerprint) - metadata.update(load.model_identity.encode("utf-8")) - metadata.update(repr((load.shell_node_ids, load.beam_node_ids)).encode("utf-8")) - metadata.update(np.asarray(load.acceleration_m_s2, dtype=" bool: - selector = self._T.copy() - selector.eliminate_zeros() - return not (np.any(np.diff(selector.tocsc().indptr) != 1) or - np.any(np.diff(selector.indptr) > 1)) - - def _reference_modes_result(self, status, frequencies=(), physical=(), - multipliers=(), equations=(), constraints=(), - factorization_count=0, solve_count=0, - failure_reason=None): - args = (status, frequencies, physical, multipliers, equations, constraints, - factorization_count, solve_count, failure_reason) - if not self.footprints: - return B2ReferenceModesResult(*args) - components = ("ux", "uy", "uz", "rx", "ry", "rz") - provenance = [B2ModalConstraintRow( - 6*i+j, component, point_id=point_id, - coordinate_frame=("point_master_shell_reference" if j < 3 - else "point_beam_reference"), - reference_frame_columns=self._point_reference_frames[i][0 if j < 3 else 1]) - for i, point_id in enumerate(self.point_ids) - for j, component in enumerate(components)] - for item in self._footprint_incidence: - provenance.extend(B2ModalConstraintRow( - item.row_start+j, component, footprint_id=item.footprint_id, - shell_node_id=item.shell_node, beam_node_id=item.beam_node) - for j, component in enumerate(components)) - point_modes = (tuple(mode[:6*len(self.point_ids)] for mode in multipliers) - if self.point_ids else ()) - return B2FootprintReferenceModesResult( - status, frequencies, physical, point_modes, equations, constraints, - factorization_count, solve_count, failure_reason, - footprint_ids=self.footprint_ids, - constraint_multiplier_modes=multipliers, constraint_rows=tuple(provenance)) - - @property - def physical_footprint_buckling_capabilities(self): - from ._stiffened_shell_b2_reference_buckling import physical_footprint_capabilities - return physical_footprint_capabilities(self) - - @property - def reference_buckling_capabilities(self): - from ._stiffened_shell_b2_reference_buckling import capabilities - return capabilities(self) - - def buckling(self, request, *, cancellation=None): - """Explicit experimental reference-preload conservative spectral route.""" - from ._stiffened_shell_b2_reference_buckling import solve - return solve(self, request, cancellation=cancellation) - - def modes(self, request: B2ReferenceModesRequest, *, - cancellation: CancellationToken | None = None - ) -> B2ReferenceModesResult | B2FreeReferenceModesResult: - """Sparse descriptor modes with physical inertia and massless multipliers. - - Reuse compiled K/C/T and mass, never a global nullspace or dense inverse. - A shifted general inverse-product is not Euclidean symmetric, so use - eigs rather than eigsh. Explicit free-free owners project verified rigid - fields in the physical mass metric; loaded/prestressed modes remain out. - """ - if self._physical_footprint_law: - raise ValueError("physical footprint reference modes require a separately adopted mass contract") - if self._closed: - raise ExperimentalB2Q4PanelError("experimental panel is closed") - if self._point_trace_policy is not None: - raise ValueError("loaded point trace reference modes unsupported: shape inertia unverified") - if self._has_s3 and self._reference_inertia_policy is None: - raise ValueError("native S3 V2D physical mass and reference modes are deferred") - if type(request) is not B2ReferenceModesRequest: - raise ValueError("typed reference-mode request required") - if self._M is None: - raise ValueError("explicit shell density and beam physical mass required") - if not self._coordinate_modal_supports(): - raise ValueError("reference modes currently require coordinate supports without MPCs") - if self.footprints and np.any(self._u0 != 0.): - raise ValueError("virgin nodal-footprint reference modes require zero prescribed offset") - if self.footprints and not self._footprint_rigid_supported: - raise ValueError("nodal-footprint reference modes require coordinate supports detecting all six physical rigid fields; free-free and under-supported modes unsupported") - if cancellation is not None and not isinstance(cancellation, CancellationToken): - raise ValueError("CancellationToken required") - n = self._T.shape[1] - rows = self._C.shape[0] - if request.count >= min(n-rows-(6 if self._modal_only else 0), n+rows-1): - raise ValueError("reference mode count exceeds supported sparse spectrum") - with np.errstate(over="ignore", under="ignore", invalid="ignore"): - sigma = -float(np.square(2.*np.pi*np.float64(request.shift_hz))) - if not np.isfinite(sigma) or sigma == 0.: - raise ValueError("reference mode shift is not representable") - - def safe_point(stage): - if cancellation is not None: - cancellation.checkpoint(stage) - - handle = None - rigid = None - overlap = 0. - - def finish(*args, **kwargs): - flexible = self._reference_modes_result(*args, **kwargs) - if not self._modal_only: - return flexible - data = {} - if flexible.status == "ok": - data = dict(rigid_origin_m=rigid["origin"], - canonical_rigid_modes=tuple(tuple(map(float, x)) for x in rigid["canonical"].T), - rigid_modes=tuple(tuple(map(float, x)) for x in rigid["normalized"].T), - rigid_multiplier_modes=tuple((0.,)*rows for _ in range(6)), - rigid_kinetic_gram=tuple(tuple(map(float, x)) for x in rigid["gram"]), - rigid_equation_residuals=rigid["equations"], - rigid_constraint_residuals=rigid["gaps"], - rigid_flexible_mass_overlap=overlap) - return B2FreeReferenceModesResult(flexible.status, flexible, - spectral_shift_rad2_s2=sigma, failure_reason=flexible.failure_reason, **data) - - try: - safe_point("reference modes before factorization") - k = (self._T.T@self._K@self._T).tocsc() - m = (self._T.T@self._M@self._T).tocsc() - c = (self._C@self._T).tocsc() - a = sparse.bmat(((k, c.T), (c, None)), format="csc") - b = sparse.block_diag((m, sparse.csc_matrix((rows, rows))), format="csc") - try: - shifted, scale = _scaled_point_kkt(k-sigma*m, c) - except ExperimentalB2Q4PanelError as exc: - raise _NumericalFailure("reference modal scaling failed: "+str(exc)) from exc - scaling = sparse.diags(scale, format="csc") - bs = (scaling@b@scaling).tocsc() - b.eliminate_zeros(); b.sort_indices() - bs.eliminate_zeros(); bs.sort_indices() - if (not np.isfinite(bs.data).all() or b.nnz != bs.nnz or - not np.array_equal(b.indptr, bs.indptr) or - not np.array_equal(b.indices, bs.indices) or - np.any((b.data != 0.) & (bs.data == 0.))): - raise _NumericalFailure("reference modal mass scaling is not representable") - if self._modal_only: - rigid = _free_b2_rigid_space(self, scale, bs, safe_point) - - def project(vector): - if not self._modal_only: - return vector - return vector-rigid["scaled"]@(rigid["scaled"].T@(bs@vector)) - - handle = factorize_cached(shifted, MatrixClass.GENERAL) - safe_point("reference modes after factorization") - if handle.status != "ok": - raise _NumericalFailure("reference modal factorization failed: "+str(handle.failure_reason)) - - def action(vector): - safe_point("reference modal iteration") - try: - answer = np.asarray(handle.solve(bs@project(vector)), dtype=float) - except RuntimeError as exc: - # These are explicit numerical failures of the shared - # backend. Unclassified/programming errors still propagate. - if (str(exc) == "Sparse solve produced NaN/Inf values" or - str(exc).startswith("Cannot solve with failed factorization:")): - raise _NumericalFailure("reference modal sparse solve failed: "+str(exc)) from exc - raise - if not np.isfinite(answer).all(): - raise _NumericalFailure("finite reference modal inverse action required") - safe_point("reference modal iteration completed") - return project(answer) - - operator = LinearOperator(a.shape, matvec=action, dtype=float) - values, vectors = eigs(operator, k=request.count, which="LM", - v0=np.sin(np.arange(a.shape[0])+.23), - tol=1e-11, maxiter=request.max_iterations) - safe_point("reference modes after eigensolve") - abs_a, abs_b, abs_c = abs(a), abs(b), abs(c) - recovered = [] - for mu, y in zip(values, vectors.T): - if (not np.isfinite(mu) or abs(mu.imag) > 1e-9*abs(mu.real) or - mu.real <= 0. or not np.isfinite(y).all() or - np.linalg.norm(y.imag) > 1e-9*np.linalg.norm(y.real)): - raise _NumericalFailure("nonphysical or unresolved finite modal pair") - lam = sigma+1./mu.real - if self._modal_only: - # Resolution screen, not a certified eigenvalue error bound. - screen = 64*np.finfo(float).eps*a.shape[0]*(abs(sigma)+abs(1./mu.real)) - if not np.isfinite(screen) or lam <= screen: - raise _NumericalFailure("extra mechanism or unresolved near-zero flexible pair") - x = scale*y.real - mass_norm = float(x@b@x) - if not np.isfinite(lam) or lam <= 0. or not np.isfinite(mass_norm) or mass_norm <= 0.: - raise _NumericalFailure("positive finite supported mode and physical inertia required") - x /= np.sqrt(mass_norm) - physical = np.asarray(self._T@x[:n]) - if not np.isfinite(x).all() or not np.isfinite(physical).all(): - raise _NumericalFailure("physical mode normalization is not representable") - residual = a@x-lam*(b@x) - bound = abs_a@abs(x)+abs(lam)*(abs_b@abs(x)) - equation = _modal_scaled_residual(residual, bound, scale) - constraint = _modal_scaled_residual(c@x[:n], abs_c@abs(x[:n]), scale[n:]) - physical_gap = _modal_scaled_residual( - self._C@physical, abs(self._C)@abs(physical), scale[n:]) - physical_balance = self._K@physical+self._C.T@x[n:]-lam*(self._M@physical) - physical_bound = (abs(self._K)@abs(physical)+abs(self._C.T)@abs(x[n:])+ - abs(lam)*(abs(self._M)@abs(physical))) - physical_equation = _modal_scaled_residual( - self._project(physical_balance), abs(self._T.T)@physical_bound, scale[:n]) - equation = max(equation, physical_equation) - constraint = max(constraint, physical_gap) - if equation > 1e-8 or constraint > 1e-9: - raise _NumericalFailure("reference modal equation or constraint residual failed") - recovered.append((float(np.sqrt(lam)/(2.*np.pi)), - tuple(physical), tuple(x[n:]), - equation, constraint)) - recovered.sort(key=lambda mode: mode[0]) - primal = np.array([mode[1] for mode in recovered]).T - modal_gram = primal.T@self._M@primal - if (not np.isfinite(modal_gram).all() or - np.max(abs(modal_gram-np.eye(request.count))) > 1e-7): - raise _NumericalFailure("modal physical-mass orthogonality failed") - if self._modal_only: - overlap = float(np.max(abs(rigid["normalized"].T@self._M@primal))) - if not np.isfinite(overlap) or overlap > 1e-7: - raise _NumericalFailure("rigid/flexible physical-mass overlap failed") - safe_point("reference modes before publication") - return finish( - "ok", tuple(mode[0] for mode in recovered), - tuple(mode[1] for mode in recovered), tuple(mode[2] for mode in recovered), - tuple(mode[3] for mode in recovered), tuple(mode[4] for mode in recovered), - handle.factorization_count, handle.solve_count) - except SolveCancelled as exc: - return finish( - "cancelled", factorization_count=handle.factorization_count if handle else 0, - solve_count=handle.solve_count if handle else 0, failure_reason=str(exc)) - except (ArpackError, _NumericalFailure) as exc: - return finish( - "failed", factorization_count=handle.factorization_count if handle else 0, - solve_count=handle.solve_count if handle else 0, failure_reason=str(exc)) - finally: - # Do not retain a numerical factor through an exception traceback. - handle = None - - def _panel_result(self, *args, **kwargs): - if self._physical_footprint_law: - return B2PhysicalRigidFootprintResult(*args,footprint_ids=self.footprint_ids,**kwargs) - if self._point_trace_policy is not None: - return B2LoadedPointPanelResult(*args, **kwargs) - if "body_model_identity" in kwargs: - result_type = B2BodyLoadedFootprintResult if self.footprints else B2BodyLoadedPanelResult - if self.footprints: - kwargs["footprint_ids"] = self.footprint_ids - return result_type(*args, **kwargs) - if self.footprints: - return ExperimentalB2Q4FootprintResult( - *args, footprint_ids=self.footprint_ids, **kwargs) - return ExperimentalB2Q4PanelResult(*args, **kwargs) - - def solve_linear(self, load, *, recover_members=None, - selected_footprints: B2NodalRigidFootprintSelection | B2PhysicalRigidFootprintSelection | None = None - ) -> ExperimentalB2Q4PanelResult: - if self._closed: - raise ExperimentalB2Q4PanelError("experimental panel is closed") - if self._modal_only: - raise ValueError("free-free modal-only policy does not admit static solves") - selector = checked_physical_selection if self._physical_footprint_law else checked_selection - chosen_footprints = selector(selected_footprints, self.footprints) - if self._physical_footprint_law and isinstance(load,B2ReferenceBodyLoad): - raise ValueError("physical footprint body-load driver not admitted") - recovery = _checked_recovery( - recover_members, {member_id for member_id, _ in self._members}) - try: - applied, _ = self._body_load_snapshot(load) - except (TypeError, ValueError, OverflowError) as exc: - if isinstance(load, B2ReferenceBodyLoad): - raise - raise ValueError("finite panel load vector required") from exc - if applied.shape != self._u0.shape or not np.isfinite(applied).all(): - raise ValueError("finite panel load vector required") - acceleration = load.acceleration_m_s2 if isinstance(load, B2ReferenceBodyLoad) else None - body_gap = body_gap_scale = None - try: - rhs = np.r_[self._project(applied-self._ku0), -self._cu0] - if self._point_trace_policy is not None: - body_gap = np.zeros(len(self._cu0)) - body_gap_scale = np.zeros(len(self._cu0)) - for compiled_load in self._loaded_members.values(): - values, scales = compiled_load.body_constraint(acceleration) - slots = [6*index+channel for index in compiled_load.point_indices for channel in range(6)] - body_gap[slots] = values - body_gap_scale[slots] = scales - rhs[-len(self._cu0):] -= body_gap - except (_NumericalFailure, RepresentabilityError) as exc: - return self._panel_result( - "failed", factorization_count=self._handle.factorization_count, - solve_count=self._handle.solve_count, failure_reason=str(exc)) - with np.errstate(over="ignore", under="ignore", invalid="ignore"): - scaled_rhs = self._factor_scale*rhs - if (not np.isfinite(scaled_rhs).all() or - np.any((rhs != 0.) & (scaled_rhs == 0.))): - return self._panel_result( - "failed", factorization_count=self._handle.factorization_count, - solve_count=self._handle.solve_count, - failure_reason="panel right-hand side scaling is not representable") - try: - scaled_answer = np.asarray(self._handle.solve(scaled_rhs), dtype=float) - answer = self._factor_scale*scaled_answer - if self._physical_footprint_law and answer.shape == rhs.shape and np.isfinite(answer).all(): - answer = self._correct_physical_equilibrium( - scaled_answer, scaled_rhs, applied) - if self._physical_work_ratio(answer, applied) > 1.: - raise _NumericalFailure("panel physical footprint work consistency failed") - except (RuntimeError, _NumericalFailure) as exc: - return self._panel_result( - "failed", factorization_count=self._handle.factorization_count, - solve_count=self._handle.solve_count, failure_reason=str(exc)) - try: - if answer.shape != rhs.shape or not np.isfinite(answer).all(): - raise _NumericalFailure("finite panel solution required") - q, lam = answer[:-len(self._cu0)], answer[-len(self._cu0):] - u = np.asarray(self._T @ q).reshape(-1)+self._u0 - if not np.isfinite(u).all(): - raise _NumericalFailure("finite panel solution required") - gap = np.asarray(self._C @ u).reshape(-1) - compliance_gap_scale = None - if self._point_trace_policy is not None: - compliance_gap, compliance_gap_scale = checked_sparse_action(self._H, lam) - gap = gap+body_gap-compliance_gap - force = np.asarray(self._K @ u).reshape(-1) - constraint_force = np.asarray(self._C.T @ lam).reshape(-1) - reaction = force+constraint_force-applied - projected = self._project(reaction) - # Each row uses the absolute contribution sum in its own physical - # work unit. A 1 N floor would mask a failed micro-/nano-load; - # a single mixed force/moment norm would depend on chosen units. - gap_scale = np.asarray(self._abs_C @ np.abs(u)).reshape(-1) - if self._point_trace_policy is not None: - gap_scale += body_gap_scale+compliance_gap_scale - physical_force_scale = np.asarray( - self._abs_K @ np.abs(u)+self._abs_Ct @ np.abs(lam)+ - np.abs(applied)).reshape(-1) - equilibrium_scale = np.asarray( - self._abs_Tt @ physical_force_scale).reshape(-1) - # Sparse factorization can leave roundoff in a locally quiet DOF. - # Its allowance follows the current force and moment magnitudes, - # separately, then maps through the affine transpose; it has no - # fixed N, Nm, m or rad floor. - by_node = physical_force_scale.reshape(-1, 6) - force_roundoff = float(np.max(by_node[:, :3])) - moment_roundoff = float(np.max(by_node[:, 3:])) - physical_roundoff = np.tile( - (force_roundoff,)*3+(moment_roundoff,)*3, - len(by_node)) - projected_roundoff = np.asarray( - self._abs_Tt @ physical_roundoff).reshape(-1) - roundoff_fraction = len(rhs)*np.finfo(float).eps - if roundoff_fraction >= 1e-9: - raise _NumericalFailure("panel equilibrium resolution insufficient") - explicit_rhs = np.abs(self._project(applied)) - resolution_floor = roundoff_fraction*projected_roundoff - # Prescribed offsets can induce reduced loads much smaller than - # the model-wide reaction scale. Their physical effect is checked - # by the full equilibrium/compatibility test below. This extra - # small-load resolution guard applies to explicit applied work, - # so a superposed tiny external load cannot disappear silently. - active = explicit_rhs > 0. - certified = False - if np.any(resolution_floor[active] > - 1e-9*explicit_rhs[active]): - certified = (bool(self.footprints) or self._point_trace_policy is not None) and self._explicit_load_resolved( + footprints=self.footprints) + if self._modal_only: + return ExperimentalB2Q4PanelCapabilities( + operations=("modes", "close"), + body_load_domain="unsupported by free-free modal-only policy", + spectral_domain="experimental connected free-free reference descriptor; six verified physical rigid fields and selected finite flexible pairs; completeness unqualified") + body_operations = (("body_acceleration_load",) if self._body_map is not None else ()) + body_domain = ("experimental reference-linear uniform global acceleration; typed loads give separate equilibrated section fields including interior point actions; raw vectors retain nodal constitutive recovery; loaded interior pose and finite gravity unsupported" + if self._body_map is not None else "unavailable without complete physical density/mass") + if self._point_trace_policy is not None: + return ExperimentalB2LoadedPointCapabilities( + attachment="explicit fixed-end loaded finite-vertex point trace", + operations=("solve_linear", "solve_linear_many", "close") + body_operations, + body_load_domain=("typed reference body acceleration and multiplier-dependent fixed-end bubbles; " + "raw arrays are nodal loads; finite gravity unsupported" if self._body_map is not None + else body_domain)) + if self.footprints: + admitted = (self._M is not None and self._coordinate_modal_supports() + and not np.any(self._u0 != 0.) and self._footprint_rigid_supported) + return ExperimentalB2Q4FootprintCapabilities( + attachment="explicit reference-linear selected-node rigid footprints and finite-vertex points", + operations=(("solve_linear", "solve_linear_many", "modes", "close") + if admitted else ("solve_linear", "solve_linear_many", "close")) + body_operations, + body_load_domain=body_domain, + spectral_domain=("experimental virgin supported reference modes; normal-spin locked; " + "mechanical qualification incomplete; prestress unsupported" + if admitted else + "reference modes require complete physical mass, coordinate supports detecting all six rigid fields and zero offset; " + "normal-spin locked; mechanical qualification incomplete; prestress unsupported"), + footprints=self.footprints) + if self._M is None: + return ExperimentalB2Q4PanelCapabilities( + operations=("solve_linear", "solve_linear_many", "close") + body_operations, + body_load_domain=body_domain) + return ExperimentalB2Q4PanelCapabilities( + operations=("solve_linear", "solve_linear_many", "modes", "close") + body_operations, + body_load_domain=body_domain, + spectral_domain="experimental reference B2/Q4 finite pairs with coordinate supports; completeness unqualified") + + def body_acceleration_load(self, acceleration_m_s2) -> B2ReferenceBodyLoad: + """Prepare an owned dead-load vector without assembling or factoring. + + f = integral D.T rho a uses the compiled physical trace and mass origin. + Pass ``result.load`` to the existing static or compatible batch route. + """ + if self._closed: + raise ExperimentalB2Q4PanelError("experimental panel is closed") + if self._modal_only: + raise ValueError("free-free modal-only policy does not admit body loads") + if self._body_map is None: + raise ValueError("complete physical density/mass required for reference body load") + raw = np.asarray(acceleration_m_s2, dtype=object) + if (raw.shape != (3,) or any(isinstance(v, (bool, np.bool_)) or + not isinstance(v, Real) for v in raw.flat)): + raise ValueError("three finite real global acceleration components required") + try: + acceleration = np.array(raw, dtype=float, copy=True) + except (ValueError, TypeError, OverflowError) as exc: + raise ValueError("three finite real global acceleration components required") from exc + if not np.isfinite(acceleration).all(): + raise ValueError("three finite real global acceleration components required") + with np.errstate(over="ignore", invalid="ignore", under="ignore"): + applied = self._body_map@acceleration + if not np.isfinite(applied).all(): + raise RepresentabilityError("reference body acceleration load is not representable") + # A finite vector can still lose a required force through underflow or + # cancellation. Test rigid-translation work against integrated physical + # mass without adding an absolute load floor or changing solver criteria. + for axis, component in enumerate(acceleration): + if component == 0.: + continue + expected = self._body_mass*float(component) + try: + actual = fsum(float(v) for v in applied[axis::6]) + except OverflowError as exc: + raise RepresentabilityError("reference body force is not representable") from exc + if (not isfinite(expected) or expected == 0. or not isfinite(actual) + or abs(actual/expected-1.) > 1e-9): + raise RepresentabilityError("required reference body force is not representable") + return B2ReferenceBodyLoad(tuple(float(v) for v in acceleration), + self.shell_node_ids, self.beam_node_ids, applied, + self._body_model_identity) + + def _body_load_snapshot(self, load): + if isinstance(load, B2ReferenceBodyLoad): + if (load.model_identity != self._body_model_identity or + load.shell_node_ids != self.shell_node_ids or load.beam_node_ids != self.beam_node_ids): + raise ValueError("body load belongs to a different compiled model") + expected = self.body_acceleration_load(load.acceleration_m_s2) + if not np.array_equal(load.load, expected.load): + raise ValueError("body load values disagree with its physical acceleration") + snapshot, fingerprint = _load_value_snapshot(load.load, self._u0.shape) + metadata = sha256(fingerprint) + metadata.update(load.model_identity.encode("utf-8")) + metadata.update(repr((load.shell_node_ids, load.beam_node_ids)).encode("utf-8")) + metadata.update(np.asarray(load.acceleration_m_s2, dtype=" bool: + selector = self._T.copy() + selector.eliminate_zeros() + return not (np.any(np.diff(selector.tocsc().indptr) != 1) or + np.any(np.diff(selector.indptr) > 1)) + + def _reference_modes_result(self, status, frequencies=(), physical=(), + multipliers=(), equations=(), constraints=(), + factorization_count=0, solve_count=0, + failure_reason=None): + args = (status, frequencies, physical, multipliers, equations, constraints, + factorization_count, solve_count, failure_reason) + if not self.footprints: + return B2ReferenceModesResult(*args) + components = ("ux", "uy", "uz", "rx", "ry", "rz") + provenance = [B2ModalConstraintRow( + 6*i+j, component, point_id=point_id, + coordinate_frame=("point_master_shell_reference" if j < 3 + else "point_beam_reference"), + reference_frame_columns=self._point_reference_frames[i][0 if j < 3 else 1]) + for i, point_id in enumerate(self.point_ids) + for j, component in enumerate(components)] + for item in self._footprint_incidence: + provenance.extend(B2ModalConstraintRow( + item.row_start+j, component, footprint_id=item.footprint_id, + shell_node_id=item.shell_node, beam_node_id=item.beam_node) + for j, component in enumerate(components)) + point_modes = (tuple(mode[:6*len(self.point_ids)] for mode in multipliers) + if self.point_ids else ()) + return B2FootprintReferenceModesResult( + status, frequencies, physical, point_modes, equations, constraints, + factorization_count, solve_count, failure_reason, + footprint_ids=self.footprint_ids, + constraint_multiplier_modes=multipliers, constraint_rows=tuple(provenance)) + + @property + def physical_footprint_buckling_capabilities(self): + from ._stiffened_shell_b2_reference_buckling import physical_footprint_capabilities + return physical_footprint_capabilities(self) + + @property + def reference_buckling_capabilities(self): + from ._stiffened_shell_b2_reference_buckling import capabilities + return capabilities(self) + + def buckling(self, request, *, cancellation=None): + """Explicit experimental reference-preload conservative spectral route.""" + from ._stiffened_shell_b2_reference_buckling import solve + return solve(self, request, cancellation=cancellation) + + def modes(self, request: B2ReferenceModesRequest, *, + cancellation: CancellationToken | None = None + ) -> B2ReferenceModesResult | B2FreeReferenceModesResult: + """Sparse descriptor modes with physical inertia and massless multipliers. + + Reuse compiled K/C/T and mass, never a global nullspace or dense inverse. + A shifted general inverse-product is not Euclidean symmetric, so use + eigs rather than eigsh. Explicit free-free owners project verified rigid + fields in the physical mass metric; loaded/prestressed modes remain out. + """ + if self._physical_footprint_law: + raise ValueError("physical footprint reference modes require a separately adopted mass contract") + if self._closed: + raise ExperimentalB2Q4PanelError("experimental panel is closed") + if self._point_trace_policy is not None: + raise ValueError("loaded point trace reference modes unsupported: shape inertia unverified") + if self._has_s3 and self._reference_inertia_policy is None: + raise ValueError("native S3 V2D physical mass and reference modes are deferred") + if type(request) is not B2ReferenceModesRequest: + raise ValueError("typed reference-mode request required") + if self._M is None: + raise ValueError("explicit shell density and beam physical mass required") + if not self._coordinate_modal_supports(): + raise ValueError("reference modes currently require coordinate supports without MPCs") + if self.footprints and np.any(self._u0 != 0.): + raise ValueError("virgin nodal-footprint reference modes require zero prescribed offset") + if self.footprints and not self._footprint_rigid_supported: + raise ValueError("nodal-footprint reference modes require coordinate supports detecting all six physical rigid fields; free-free and under-supported modes unsupported") + if cancellation is not None and not isinstance(cancellation, CancellationToken): + raise ValueError("CancellationToken required") + n = self._T.shape[1] + rows = self._C.shape[0] + if request.count >= min(n-rows-(6 if self._modal_only else 0), n+rows-1): + raise ValueError("reference mode count exceeds supported sparse spectrum") + with np.errstate(over="ignore", under="ignore", invalid="ignore"): + sigma = -float(np.square(2.*np.pi*np.float64(request.shift_hz))) + if not np.isfinite(sigma) or sigma == 0.: + raise ValueError("reference mode shift is not representable") + + def safe_point(stage): + if cancellation is not None: + cancellation.checkpoint(stage) + + handle = None + rigid = None + overlap = 0. + + def finish(*args, **kwargs): + flexible = self._reference_modes_result(*args, **kwargs) + if not self._modal_only: + return flexible + data = {} + if flexible.status == "ok": + data = dict(rigid_origin_m=rigid["origin"], + canonical_rigid_modes=tuple(tuple(map(float, x)) for x in rigid["canonical"].T), + rigid_modes=tuple(tuple(map(float, x)) for x in rigid["normalized"].T), + rigid_multiplier_modes=tuple((0.,)*rows for _ in range(6)), + rigid_kinetic_gram=tuple(tuple(map(float, x)) for x in rigid["gram"]), + rigid_equation_residuals=rigid["equations"], + rigid_constraint_residuals=rigid["gaps"], + rigid_flexible_mass_overlap=overlap) + return B2FreeReferenceModesResult(flexible.status, flexible, + spectral_shift_rad2_s2=sigma, failure_reason=flexible.failure_reason, **data) + + try: + safe_point("reference modes before factorization") + k = (self._T.T@self._K@self._T).tocsc() + m = (self._T.T@self._M@self._T).tocsc() + c = (self._C@self._T).tocsc() + a = sparse.bmat(((k, c.T), (c, None)), format="csc") + b = sparse.block_diag((m, sparse.csc_matrix((rows, rows))), format="csc") + try: + shifted, scale = _scaled_point_kkt(k-sigma*m, c) + except ExperimentalB2Q4PanelError as exc: + raise _NumericalFailure("reference modal scaling failed: "+str(exc)) from exc + scaling = sparse.diags(scale, format="csc") + bs = (scaling@b@scaling).tocsc() + b.eliminate_zeros(); b.sort_indices() + bs.eliminate_zeros(); bs.sort_indices() + if (not np.isfinite(bs.data).all() or b.nnz != bs.nnz or + not np.array_equal(b.indptr, bs.indptr) or + not np.array_equal(b.indices, bs.indices) or + np.any((b.data != 0.) & (bs.data == 0.))): + raise _NumericalFailure("reference modal mass scaling is not representable") + if self._modal_only: + rigid = _free_b2_rigid_space(self, scale, bs, safe_point) + + def project(vector): + if not self._modal_only: + return vector + return vector-rigid["scaled"]@(rigid["scaled"].T@(bs@vector)) + + handle = factorize_cached(shifted, MatrixClass.GENERAL) + safe_point("reference modes after factorization") + if handle.status != "ok": + raise _NumericalFailure("reference modal factorization failed: "+str(handle.failure_reason)) + + def action(vector): + safe_point("reference modal iteration") + try: + answer = np.asarray(handle.solve(bs@project(vector)), dtype=float) + except RuntimeError as exc: + # These are explicit numerical failures of the shared + # backend. Unclassified/programming errors still propagate. + if (str(exc) == "Sparse solve produced NaN/Inf values" or + str(exc).startswith("Cannot solve with failed factorization:")): + raise _NumericalFailure("reference modal sparse solve failed: "+str(exc)) from exc + raise + if not np.isfinite(answer).all(): + raise _NumericalFailure("finite reference modal inverse action required") + safe_point("reference modal iteration completed") + return project(answer) + + operator = LinearOperator(a.shape, matvec=action, dtype=float) + values, vectors = eigs(operator, k=request.count, which="LM", + v0=np.sin(np.arange(a.shape[0])+.23), + tol=1e-11, maxiter=request.max_iterations) + safe_point("reference modes after eigensolve") + abs_a, abs_b, abs_c = abs(a), abs(b), abs(c) + recovered = [] + for mu, y in zip(values, vectors.T): + if (not np.isfinite(mu) or abs(mu.imag) > 1e-9*abs(mu.real) or + mu.real <= 0. or not np.isfinite(y).all() or + np.linalg.norm(y.imag) > 1e-9*np.linalg.norm(y.real)): + raise _NumericalFailure("nonphysical or unresolved finite modal pair") + lam = sigma+1./mu.real + if self._modal_only: + # Resolution screen, not a certified eigenvalue error bound. + screen = 64*np.finfo(float).eps*a.shape[0]*(abs(sigma)+abs(1./mu.real)) + if not np.isfinite(screen) or lam <= screen: + raise _NumericalFailure("extra mechanism or unresolved near-zero flexible pair") + x = scale*y.real + mass_norm = float(x@b@x) + if not np.isfinite(lam) or lam <= 0. or not np.isfinite(mass_norm) or mass_norm <= 0.: + raise _NumericalFailure("positive finite supported mode and physical inertia required") + x /= np.sqrt(mass_norm) + physical = np.asarray(self._T@x[:n]) + if not np.isfinite(x).all() or not np.isfinite(physical).all(): + raise _NumericalFailure("physical mode normalization is not representable") + residual = a@x-lam*(b@x) + bound = abs_a@abs(x)+abs(lam)*(abs_b@abs(x)) + equation = _modal_scaled_residual(residual, bound, scale) + constraint = _modal_scaled_residual(c@x[:n], abs_c@abs(x[:n]), scale[n:]) + physical_gap = _modal_scaled_residual( + self._C@physical, abs(self._C)@abs(physical), scale[n:]) + physical_balance = self._K@physical+self._C.T@x[n:]-lam*(self._M@physical) + physical_bound = (abs(self._K)@abs(physical)+abs(self._C.T)@abs(x[n:])+ + abs(lam)*(abs(self._M)@abs(physical))) + physical_equation = _modal_scaled_residual( + self._project(physical_balance), abs(self._T.T)@physical_bound, scale[:n]) + equation = max(equation, physical_equation) + constraint = max(constraint, physical_gap) + if equation > 1e-8 or constraint > 1e-9: + raise _NumericalFailure("reference modal equation or constraint residual failed") + recovered.append((float(np.sqrt(lam)/(2.*np.pi)), + tuple(physical), tuple(x[n:]), + equation, constraint)) + recovered.sort(key=lambda mode: mode[0]) + primal = np.array([mode[1] for mode in recovered]).T + modal_gram = primal.T@self._M@primal + if (not np.isfinite(modal_gram).all() or + np.max(abs(modal_gram-np.eye(request.count))) > 1e-7): + raise _NumericalFailure("modal physical-mass orthogonality failed") + if self._modal_only: + overlap = float(np.max(abs(rigid["normalized"].T@self._M@primal))) + if not np.isfinite(overlap) or overlap > 1e-7: + raise _NumericalFailure("rigid/flexible physical-mass overlap failed") + safe_point("reference modes before publication") + return finish( + "ok", tuple(mode[0] for mode in recovered), + tuple(mode[1] for mode in recovered), tuple(mode[2] for mode in recovered), + tuple(mode[3] for mode in recovered), tuple(mode[4] for mode in recovered), + handle.factorization_count, handle.solve_count) + except SolveCancelled as exc: + return finish( + "cancelled", factorization_count=handle.factorization_count if handle else 0, + solve_count=handle.solve_count if handle else 0, failure_reason=str(exc)) + except (ArpackError, _NumericalFailure) as exc: + return finish( + "failed", factorization_count=handle.factorization_count if handle else 0, + solve_count=handle.solve_count if handle else 0, failure_reason=str(exc)) + finally: + # Do not retain a numerical factor through an exception traceback. + handle = None + + def _panel_result(self, *args, **kwargs): + if self._physical_footprint_law: + return B2PhysicalRigidFootprintResult(*args,footprint_ids=self.footprint_ids,**kwargs) + if self._point_trace_policy is not None: + return B2LoadedPointPanelResult(*args, **kwargs) + if "body_model_identity" in kwargs: + result_type = B2BodyLoadedFootprintResult if self.footprints else B2BodyLoadedPanelResult + if self.footprints: + kwargs["footprint_ids"] = self.footprint_ids + return result_type(*args, **kwargs) + if self.footprints: + return ExperimentalB2Q4FootprintResult( + *args, footprint_ids=self.footprint_ids, **kwargs) + return ExperimentalB2Q4PanelResult(*args, **kwargs) + + def solve_linear(self, load, *, recover_members=None, + selected_footprints: B2NodalRigidFootprintSelection | B2PhysicalRigidFootprintSelection | None = None + ) -> ExperimentalB2Q4PanelResult: + if self._closed: + raise ExperimentalB2Q4PanelError("experimental panel is closed") + if self._modal_only: + raise ValueError("free-free modal-only policy does not admit static solves") + selector = checked_physical_selection if self._physical_footprint_law else checked_selection + chosen_footprints = selector(selected_footprints, self.footprints) + if self._physical_footprint_law and isinstance(load,B2ReferenceBodyLoad): + raise ValueError("physical footprint body-load driver not admitted") + recovery = _checked_recovery( + recover_members, {member_id for member_id, _ in self._members}) + try: + applied, _ = self._body_load_snapshot(load) + except (TypeError, ValueError, OverflowError) as exc: + if isinstance(load, B2ReferenceBodyLoad): + raise + raise ValueError("finite panel load vector required") from exc + if applied.shape != self._u0.shape or not np.isfinite(applied).all(): + raise ValueError("finite panel load vector required") + acceleration = load.acceleration_m_s2 if isinstance(load, B2ReferenceBodyLoad) else None + body_gap = body_gap_scale = None + try: + rhs = np.r_[self._project(applied-self._ku0), -self._cu0] + if self._point_trace_policy is not None: + body_gap = np.zeros(len(self._cu0)) + body_gap_scale = np.zeros(len(self._cu0)) + for compiled_load in self._loaded_members.values(): + values, scales = compiled_load.body_constraint(acceleration) + slots = [6*index+channel for index in compiled_load.point_indices for channel in range(6)] + body_gap[slots] = values + body_gap_scale[slots] = scales + rhs[-len(self._cu0):] -= body_gap + except (_NumericalFailure, RepresentabilityError) as exc: + return self._panel_result( + "failed", factorization_count=self._handle.factorization_count, + solve_count=self._handle.solve_count, failure_reason=str(exc)) + with np.errstate(over="ignore", under="ignore", invalid="ignore"): + scaled_rhs = self._factor_scale*rhs + if (not np.isfinite(scaled_rhs).all() or + np.any((rhs != 0.) & (scaled_rhs == 0.))): + return self._panel_result( + "failed", factorization_count=self._handle.factorization_count, + solve_count=self._handle.solve_count, + failure_reason="panel right-hand side scaling is not representable") + try: + scaled_answer = np.asarray(self._handle.solve(scaled_rhs), dtype=float) + answer = self._factor_scale*scaled_answer + if self._physical_footprint_law and answer.shape == rhs.shape and np.isfinite(answer).all(): + answer = self._correct_physical_equilibrium( + scaled_answer, scaled_rhs, applied) + if self._physical_work_ratio(answer, applied) > 1.: + raise _NumericalFailure("panel physical footprint work consistency failed") + except (RuntimeError, _NumericalFailure) as exc: + return self._panel_result( + "failed", factorization_count=self._handle.factorization_count, + solve_count=self._handle.solve_count, failure_reason=str(exc)) + try: + if answer.shape != rhs.shape or not np.isfinite(answer).all(): + raise _NumericalFailure("finite panel solution required") + q, lam = answer[:-len(self._cu0)], answer[-len(self._cu0):] + u = np.asarray(self._T @ q).reshape(-1)+self._u0 + if not np.isfinite(u).all(): + raise _NumericalFailure("finite panel solution required") + gap = np.asarray(self._C @ u).reshape(-1) + compliance_gap_scale = None + if self._point_trace_policy is not None: + compliance_gap, compliance_gap_scale = checked_sparse_action(self._H, lam) + gap = gap+body_gap-compliance_gap + force = np.asarray(self._K @ u).reshape(-1) + constraint_force = np.asarray(self._C.T @ lam).reshape(-1) + reaction = force+constraint_force-applied + projected = self._project(reaction) + # Each row uses the absolute contribution sum in its own physical + # work unit. A 1 N floor would mask a failed micro-/nano-load; + # a single mixed force/moment norm would depend on chosen units. + gap_scale = np.asarray(self._abs_C @ np.abs(u)).reshape(-1) + if self._point_trace_policy is not None: + gap_scale += body_gap_scale+compliance_gap_scale + physical_force_scale = np.asarray( + self._abs_K @ np.abs(u)+self._abs_Ct @ np.abs(lam)+ + np.abs(applied)).reshape(-1) + equilibrium_scale = np.asarray( + self._abs_Tt @ physical_force_scale).reshape(-1) + # Sparse factorization can leave roundoff in a locally quiet DOF. + # Its allowance follows the current force and moment magnitudes, + # separately, then maps through the affine transpose; it has no + # fixed N, Nm, m or rad floor. + by_node = physical_force_scale.reshape(-1, 6) + force_roundoff = float(np.max(by_node[:, :3])) + moment_roundoff = float(np.max(by_node[:, 3:])) + physical_roundoff = np.tile( + (force_roundoff,)*3+(moment_roundoff,)*3, + len(by_node)) + projected_roundoff = np.asarray( + self._abs_Tt @ physical_roundoff).reshape(-1) + roundoff_fraction = len(rhs)*np.finfo(float).eps + if roundoff_fraction >= 1e-9: + raise _NumericalFailure("panel equilibrium resolution insufficient") + explicit_rhs = np.abs(self._project(applied)) + resolution_floor = roundoff_fraction*projected_roundoff + # Prescribed offsets can induce reduced loads much smaller than + # the model-wide reaction scale. Their physical effect is checked + # by the full equilibrium/compatibility test below. This extra + # small-load resolution guard applies to explicit applied work, + # so a superposed tiny external load cannot disappear silently. + active = explicit_rhs > 0. + certified = False + if np.any(resolution_floor[active] > + 1e-9*explicit_rhs[active]): + certified = (bool(self.footprints) or self._point_trace_policy is not None) and self._explicit_load_resolved( answer, rhs, explicit_rhs, applied=applied, reconstructed=u) - if not certified: - raise _NumericalFailure("panel mixed-load resolution insufficient") - equilibrium_tolerance = (1e-9*equilibrium_scale+ - roundoff_fraction*projected_roundoff) - gap_tolerance = 1e-9*gap_scale - if (self.footprints and np.any(np.abs(gap) > gap_tolerance) and + if not certified: + raise _NumericalFailure("panel mixed-load resolution insufficient") + equilibrium_tolerance = (1e-9*equilibrium_scale+ + roundoff_fraction*projected_roundoff) + gap_tolerance = 1e-9*gap_scale + if (self.footprints and np.any(np.abs(gap) > gap_tolerance) and (certified or self._explicit_load_resolved(answer, rhs, explicit_rhs, applied=applied, reconstructed=u))): - gap_tolerance = self._footprint_gap_tolerance(u, gap_scale, roundoff_fraction) - for item in self._footprint_incidence: - width=getattr(item,"row_count",6) - rows = slice(item.row_start, item.row_start+width) - cap = 1e-9*np.array((self._compatibility_length,)*3+(1.,)*(width-3)) - gap_tolerance[rows] = np.minimum(gap_tolerance[rows], cap) - if (not np.isfinite(reaction).all() or - not np.isfinite(gap).all() or not np.isfinite(projected).all() or - not np.isfinite(gap_scale).all() or - not np.isfinite(equilibrium_tolerance).all() or - not np.isfinite(gap_tolerance).all() or - np.any(np.abs(gap) > gap_tolerance) or - np.any(np.abs(projected) > equilibrium_tolerance)): - raise _NumericalFailure("panel point gap or equilibrium failed") - except (_NumericalFailure, RepresentabilityError) as exc: - return self._panel_result( - "failed", factorization_count=self._handle.factorization_count, - solve_count=self._handle.solve_count, failure_reason=str(exc)) - recovered = [] - equilibrated = [] - loaded_poses = [] - loaded_states = {} - if self._point_trace_policy is not None: - try: - loaded_states = {member_id: compiled_load.bubble_state(acceleration, lam) - for member_id, compiled_load in self._loaded_members.items()} - except RepresentabilityError as exc: - return self._panel_result("failed", factorization_count=self._handle.factorization_count, - solve_count=self._handle.solve_count, failure_reason=str(exc)) - for member_id, (member, slots) in self._members: - if recovery is not None and member_id not in recovery: - continue - local = member.local_dof_map() @ u[slots] - if not np.isfinite(local).all(): - return self._panel_result( - "failed", factorization_count=self._handle.factorization_count, - solve_count=self._handle.solve_count, - failure_reason="finite physical B2 recovery coordinates required") - result = member.operator.recover_sections( - local, stations=(0., .5, 1.) if recovery is None - else recovery[member_id]) - if (not np.isfinite(result.resultants).all() or - not np.isfinite(result.strains).all()): - return self._panel_result( - "failed", factorization_count=self._handle.factorization_count, - solve_count=self._handle.solve_count, - failure_reason="finite physical B2 recovery required") - recovered.append((member_id, tuple( - tuple(map(float, row)) for row in result.resultants))) - if isinstance(load, B2ReferenceBodyLoad) or self._point_trace_policy is not None: - try: - if self._point_trace_policy is not None: - compiled_load = self._loaded_members[member_id] - uniform, point_wrenches, _ = loaded_states[member_id] - actions = compiled_load.section_actions(point_wrenches) - poses = compiled_load.recover_pose(local, result.stations, uniform, point_wrenches) - loaded_poses.append(B2LoadedMemberPoses(member_id, tuple(map(float, result.stations)), - tuple(tuple(map(float, row)) for row in poses))) - else: - with np.errstate(over="ignore", invalid="ignore"): - uniform = (member.definition.mass.matrix_at_reference_axis()[:, :3]@ - member.definition.local_frame_rows()@np.asarray(load.acceleration_m_s2)) - actions = tuple((station, pullback@lam[6*i:6*i+6]) for i, station, pullback in - self._section_point_actions.get(member_id, ())) - if (not np.isfinite(uniform).all() or - any(not np.isfinite(wrench).all() for _, wrench in actions)): - raise RepresentabilityError("physical section actions are not representable") - fields = member.operator.recover_equilibrated_sections(local, - uniform_wrench=uniform, point_actions=actions, stations=result.stations) - except RepresentabilityError as exc: - return self._panel_result("failed", factorization_count=self._handle.factorization_count, - solve_count=self._handle.solve_count, failure_reason=str(exc)) - rows = lambda values: tuple(tuple(map(float, row)) for row in values) - equilibrated.append(B2LoadedMemberSections(member_id, tuple(map(float, fields.stations)), - rows(fields.resultants_left), rows(fields.resultants_right), - rows(fields.strains_left), rows(fields.strains_right), - tuple(map(float, fields.endpoint_tractions)))) - energy = .5*float(u @ force) - if not isfinite(energy): - return self._panel_result( - "failed", factorization_count=self._handle.factorization_count, - solve_count=self._handle.solve_count, - failure_reason="finite panel strain energy required") - extra = {} - if self._physical_footprint_law: - extra.update(constraint_multipliers=tuple(map(float,lam)),constraint_gaps=tuple(map(float,gap)), - constraint_rows=tuple((item.row_start+j,item.footprint_id,item.shell_node,item.beam_node,component) - for item in self._footprint_incidence for j,component in enumerate(("translation_x","translation_y","translation_z","director_1","director_2")))) - if isinstance(load, B2ReferenceBodyLoad): - extra.update(body_model_identity=load.model_identity, - body_acceleration_m_s2=load.acceleration_m_s2, - equilibrated_sections=tuple(equilibrated)) - if self._point_trace_policy is not None: - try: - loaded_energy = fsum((energy, *(state[2] for state in loaded_states.values()))) - except OverflowError: - loaded_energy = float("inf") - if not isfinite(loaded_energy) or loaded_energy < 0.: - return self._panel_result("failed", factorization_count=self._handle.factorization_count, - solve_count=self._handle.solve_count, failure_reason="loaded strain energy is not representable") - extra.update(equilibrated_sections=tuple(equilibrated), loaded_member_poses=tuple(loaded_poses), - loaded_strain_energy=loaded_energy) - if chosen_footprints: - try: - wrench_recovery = physical_selected_wrenches if self._physical_footprint_law else selected_wrenches - extra["footprint_wrenches"] = wrench_recovery( - self._footprint_incidence, chosen_footprints, lam, gap) - except (ValueError, OverflowError) as exc: - return self._panel_result( - "failed", factorization_count=self._handle.factorization_count, - solve_count=self._handle.solve_count, failure_reason=str(exc)) - return self._panel_result( - "completed", tuple(map(float, u)), - tuple((point_id, tuple(map(float, lam[6*i:6*i+6]))) - for i, point_id in enumerate(self.point_ids)), - tuple(map(float, reaction)), - tuple((point_id, tuple(map(float, gap[6*i:6*i+6]))) - for i, point_id in enumerate(self.point_ids)), - tuple(recovered), energy, self._handle.factorization_count, - self._handle.solve_count, **extra) - - def solve_linear_many( - self, cases: Sequence[tuple[str, object]], *, - selected_dofs: Sequence[int], - selected_points: Sequence[str] = (), - selected_footprints: B2NodalRigidFootprintSelection | B2PhysicalRigidFootprintSelection | None = None, - recover_members: Mapping[str, Sequence[float]] | None = None, - cancellation_token: CancellationToken | None = None, - on_case: Callable[[str], None] | None = None, - ) -> ExperimentalB2Q4PanelBatchResult: - """Solve ordered cases with one factorization and bounded case storage. - - Each result is complete before it joins the returned prefix. Numerical - failure, cooperative cancellation or owner closure stops further cases. - Closing from a completion callback preserves the complete prefix; a - final-case closure still returns completed. Callback and programming - errors propagate. This development route uses one RHS at a - time, avoiding full displacement/reaction batches for large panels. - Selected displacement, reaction and local member-resultant envelopes - describe only complete cases in the returned prefix, with the first - submitted case governing ties. - """ - if self._closed: - raise ExperimentalB2Q4PanelError("experimental panel is closed") - if self._modal_only: - raise ValueError("free-free modal-only policy does not admit static solves") - selector = checked_physical_selection if self._physical_footprint_law else checked_selection - chosen_footprints = selector(selected_footprints, self.footprints) - try: - chosen = tuple(selected_dofs) - chosen_points = tuple(selected_points) - submitted = tuple(cases) - except TypeError as exc: - raise ValueError("ordered B2 panel cases and selection required") from exc - if (not chosen or any(type(value) is not int or - not 0 <= value < len(self._u0) - for value in chosen) or - len(set(chosen)) != len(chosen)): - raise ValueError("unique selected panel coordinate indices required") - if (any(type(point_id) is not str or - point_id not in self.point_ids for point_id in chosen_points) or - len(set(chosen_points)) != len(chosen_points)): - raise ValueError("unique selected panel point IDs required") - if (not submitted or - any(type(item) not in (tuple, list) or len(item) != 2 or - type(item[0]) is not str or not item[0].strip() - for item in submitted) or - len({item[0] for item in submitted}) != len(submitted)): - raise ValueError("unique nonempty ordered B2 panel case IDs required") - # Caller-owned list pairs may be changed by a completion callback. - # Snapshot their inventory/references now; later load-value mutation - # remains checked by the existing bounded fingerprints below. - submitted = tuple((case_id, load) for case_id, load in submitted) - if self._physical_footprint_law and any(isinstance(load,B2ReferenceBodyLoad) for _,load in submitted): - raise ValueError("physical footprint body-load driver not admitted") - selected_rows = tuple((item.row_start+j,item.footprint_id,item.shell_node,item.beam_node,component) - for item in self._footprint_incidence if item.footprint_id in chosen_footprints - for j,component in enumerate(("translation_x","translation_y","translation_z","director_1","director_2"))) if self._physical_footprint_law else () - if cancellation_token is not None and not isinstance( - cancellation_token, CancellationToken): - raise TypeError("B2 panel cancellation token required") - if on_case is not None and not callable(on_case): - raise TypeError("B2 panel case callback required") - recovery = _checked_recovery( - {} if recover_members is None else recover_members, - {member_id for member_id, _ in self._members}) - # Counts outlive a callback closing the owner, without retaining its - # factor in this operation or a propagated callback-error traceback. - factorization_count = self._handle.factorization_count - solve_count = self._handle.solve_count - fingerprints = [] - for _case_id, load in submitted: - if cancellation_token is not None and cancellation_token.is_cancelled: - break - snapshot, fingerprint = self._body_load_snapshot(load) - fingerprints.append(fingerprint) - del snapshot - completed = [] - - def envelopes(attribute): - if not completed: - return () - extrema = [] - for index, dof in enumerate(chosen): - # min/max preserve the first case on exact ties. No rounding, - # absolute envelope or physical-unit conversion is introduced. - minimum = min(completed, key=lambda case: getattr(case, attribute)[index]) - maximum = max(completed, key=lambda case: getattr(case, attribute)[index]) - extrema.append(ExperimentalB2Q4PanelResponseEnvelope( - dof, getattr(minimum, attribute)[index], minimum.case_id, - getattr(maximum, attribute)[index], maximum.case_id)) - return tuple(extrema) - - def member_envelopes(): - if not completed or not recovery: - return () - sections = tuple((case.case_id, dict(case.beam_resultants_local)) - for case in completed) - extrema = [] - for member_id, stations in recovery.items(): - if any(member_id not in rows or len(rows[member_id]) != len(stations) - for _, rows in sections): - raise RuntimeError("incomplete selected B2 member recovery") - for station_index, station in enumerate(stations): - for component_index, component in enumerate( - ("N", "Qy", "Qz", "Mx", "My", "Mz")): - values = tuple((case_id, rows[member_id][station_index][component_index]) - for case_id, rows in sections) - minimum = min(values, key=lambda item: item[1]) - maximum = max(values, key=lambda item: item[1]) - extrema.append(ExperimentalB2Q4PanelMemberResultantEnvelope( - member_id, station_index, station, component, - minimum[1], minimum[0], maximum[1], maximum[0])) - return tuple(extrema) - - def finish(status, failure_reason=None): - result_type = (ExperimentalB2Q4FootprintBatchResult if self.footprints - else ExperimentalB2Q4PanelBatchResult) - extra = {"selected_footprints": chosen_footprints} if self.footprints else {} - if self._physical_footprint_law: - result_type = B2PhysicalRigidFootprintBatchResult - extra["constraint_rows"] = selected_rows - return result_type( - status, chosen, chosen_points, tuple(completed), - factorization_count, solve_count, - failure_reason=failure_reason, - displacement_envelopes=envelopes("selected_displacements"), - affine_reaction_envelopes=envelopes("selected_affine_reactions"), - member_resultant_envelopes=member_envelopes(), **extra) - - for index, (case_id, load) in enumerate(submitted): - if self._closed or (cancellation_token is not None and - cancellation_token.is_cancelled): - break - snapshot, fingerprint = self._body_load_snapshot(load) - if fingerprint != fingerprints[index]: - raise ValueError("B2 panel load case changed after submission") - result = self.solve_linear(load if isinstance(load, B2ReferenceBodyLoad) else snapshot, recover_members=recovery, - selected_footprints=selected_footprints) - factorization_count = result.factorization_count - solve_count = result.solve_count - if result.status != "completed": - return finish("failed", f"{case_id}: {result.failure_reason}") - point_multipliers = dict(result.point_multipliers) - point_gaps = dict(result.point_gaps) - case_type = (ExperimentalB2Q4FootprintSelectedCase if self.footprints - else ExperimentalB2Q4PanelSelectedCase) - extra = {"footprint_wrenches": result.footprint_wrenches} if self.footprints else {} - if self._physical_footprint_law: - case_type = B2PhysicalRigidFootprintSelectedCase - row_indices = tuple(row[0] for row in selected_rows) - extra.update(constraint_multipliers=tuple(result.constraint_multipliers[i] for i in row_indices), - constraint_gaps=tuple(result.constraint_gaps[i] for i in row_indices)) - if isinstance(load, B2ReferenceBodyLoad): - case_type = B2BodyLoadedFootprintSelectedCase if self.footprints else B2BodyLoadedPanelSelectedCase - extra.update(body_model_identity=result.body_model_identity, - body_acceleration_m_s2=result.body_acceleration_m_s2, - equilibrated_sections=result.equilibrated_sections) - if self._point_trace_policy is not None: - case_type = B2LoadedPointPanelSelectedCase - extra.update(equilibrated_sections=result.equilibrated_sections, - loaded_member_poses=result.loaded_member_poses, - loaded_strain_energy=result.loaded_strain_energy) - completed.append(case_type( - case_id, - tuple(result.displacements[index] for index in chosen), - tuple(result.affine_reactions[index] for index in chosen), - tuple((point_id, point_multipliers[point_id]) - for point_id in chosen_points), - tuple((point_id, point_gaps[point_id]) - for point_id in chosen_points), - result.beam_resultants_local, - result.internal_strain_energy, **extra)) - if on_case is not None: - on_case(case_id) - return finish( - "cancelled" if len(completed) != len(submitted) else "completed", - failure_reason=("experimental panel closed" + - (" after " + completed[-1].case_id if completed else "") - if self._closed and len(completed) != len(submitted) - else None)) - + gap_tolerance = self._footprint_gap_tolerance(u, gap_scale, roundoff_fraction) + for item in self._footprint_incidence: + width=getattr(item,"row_count",6) + rows = slice(item.row_start, item.row_start+width) + cap = 1e-9*np.array((self._compatibility_length,)*3+(1.,)*(width-3)) + gap_tolerance[rows] = np.minimum(gap_tolerance[rows], cap) + if (not np.isfinite(reaction).all() or + not np.isfinite(gap).all() or not np.isfinite(projected).all() or + not np.isfinite(gap_scale).all() or + not np.isfinite(equilibrium_tolerance).all() or + not np.isfinite(gap_tolerance).all() or + np.any(np.abs(gap) > gap_tolerance) or + np.any(np.abs(projected) > equilibrium_tolerance)): + raise _NumericalFailure("panel point gap or equilibrium failed") + except (_NumericalFailure, RepresentabilityError) as exc: + return self._panel_result( + "failed", factorization_count=self._handle.factorization_count, + solve_count=self._handle.solve_count, failure_reason=str(exc)) + recovered = [] + equilibrated = [] + loaded_poses = [] + loaded_states = {} + if self._point_trace_policy is not None: + try: + loaded_states = {member_id: compiled_load.bubble_state(acceleration, lam) + for member_id, compiled_load in self._loaded_members.items()} + except RepresentabilityError as exc: + return self._panel_result("failed", factorization_count=self._handle.factorization_count, + solve_count=self._handle.solve_count, failure_reason=str(exc)) + for member_id, (member, slots) in self._members: + if recovery is not None and member_id not in recovery: + continue + local = member.local_dof_map() @ u[slots] + if not np.isfinite(local).all(): + return self._panel_result( + "failed", factorization_count=self._handle.factorization_count, + solve_count=self._handle.solve_count, + failure_reason="finite physical B2 recovery coordinates required") + result = member.operator.recover_sections( + local, stations=(0., .5, 1.) if recovery is None + else recovery[member_id]) + if (not np.isfinite(result.resultants).all() or + not np.isfinite(result.strains).all()): + return self._panel_result( + "failed", factorization_count=self._handle.factorization_count, + solve_count=self._handle.solve_count, + failure_reason="finite physical B2 recovery required") + recovered.append((member_id, tuple( + tuple(map(float, row)) for row in result.resultants))) + if isinstance(load, B2ReferenceBodyLoad) or self._point_trace_policy is not None: + try: + if self._point_trace_policy is not None: + compiled_load = self._loaded_members[member_id] + uniform, point_wrenches, _ = loaded_states[member_id] + actions = compiled_load.section_actions(point_wrenches) + poses = compiled_load.recover_pose(local, result.stations, uniform, point_wrenches) + loaded_poses.append(B2LoadedMemberPoses(member_id, tuple(map(float, result.stations)), + tuple(tuple(map(float, row)) for row in poses))) + else: + with np.errstate(over="ignore", invalid="ignore"): + uniform = (member.definition.mass.matrix_at_reference_axis()[:, :3]@ + member.definition.local_frame_rows()@np.asarray(load.acceleration_m_s2)) + actions = tuple((station, pullback@lam[6*i:6*i+6]) for i, station, pullback in + self._section_point_actions.get(member_id, ())) + if (not np.isfinite(uniform).all() or + any(not np.isfinite(wrench).all() for _, wrench in actions)): + raise RepresentabilityError("physical section actions are not representable") + fields = member.operator.recover_equilibrated_sections(local, + uniform_wrench=uniform, point_actions=actions, stations=result.stations) + except RepresentabilityError as exc: + return self._panel_result("failed", factorization_count=self._handle.factorization_count, + solve_count=self._handle.solve_count, failure_reason=str(exc)) + rows = lambda values: tuple(tuple(map(float, row)) for row in values) + equilibrated.append(B2LoadedMemberSections(member_id, tuple(map(float, fields.stations)), + rows(fields.resultants_left), rows(fields.resultants_right), + rows(fields.strains_left), rows(fields.strains_right), + tuple(map(float, fields.endpoint_tractions)))) + energy = .5*float(u @ force) + if not isfinite(energy): + return self._panel_result( + "failed", factorization_count=self._handle.factorization_count, + solve_count=self._handle.solve_count, + failure_reason="finite panel strain energy required") + extra = {} + if self._physical_footprint_law: + extra.update(constraint_multipliers=tuple(map(float,lam)),constraint_gaps=tuple(map(float,gap)), + constraint_rows=tuple((item.row_start+j,item.footprint_id,item.shell_node,item.beam_node,component) + for item in self._footprint_incidence for j,component in enumerate(("translation_x","translation_y","translation_z","director_1","director_2")))) + if isinstance(load, B2ReferenceBodyLoad): + extra.update(body_model_identity=load.model_identity, + body_acceleration_m_s2=load.acceleration_m_s2, + equilibrated_sections=tuple(equilibrated)) + if self._point_trace_policy is not None: + try: + loaded_energy = fsum((energy, *(state[2] for state in loaded_states.values()))) + except OverflowError: + loaded_energy = float("inf") + if not isfinite(loaded_energy) or loaded_energy < 0.: + return self._panel_result("failed", factorization_count=self._handle.factorization_count, + solve_count=self._handle.solve_count, failure_reason="loaded strain energy is not representable") + extra.update(equilibrated_sections=tuple(equilibrated), loaded_member_poses=tuple(loaded_poses), + loaded_strain_energy=loaded_energy) + if chosen_footprints: + try: + wrench_recovery = physical_selected_wrenches if self._physical_footprint_law else selected_wrenches + extra["footprint_wrenches"] = wrench_recovery( + self._footprint_incidence, chosen_footprints, lam, gap) + except (ValueError, OverflowError) as exc: + return self._panel_result( + "failed", factorization_count=self._handle.factorization_count, + solve_count=self._handle.solve_count, failure_reason=str(exc)) + return self._panel_result( + "completed", tuple(map(float, u)), + tuple((point_id, tuple(map(float, lam[6*i:6*i+6]))) + for i, point_id in enumerate(self.point_ids)), + tuple(map(float, reaction)), + tuple((point_id, tuple(map(float, gap[6*i:6*i+6]))) + for i, point_id in enumerate(self.point_ids)), + tuple(recovered), energy, self._handle.factorization_count, + self._handle.solve_count, **extra) + + def solve_linear_many( + self, cases: Sequence[tuple[str, object]], *, + selected_dofs: Sequence[int], + selected_points: Sequence[str] = (), + selected_footprints: B2NodalRigidFootprintSelection | B2PhysicalRigidFootprintSelection | None = None, + recover_members: Mapping[str, Sequence[float]] | None = None, + cancellation_token: CancellationToken | None = None, + on_case: Callable[[str], None] | None = None, + ) -> ExperimentalB2Q4PanelBatchResult: + """Solve ordered cases with one factorization and bounded case storage. + + Each result is complete before it joins the returned prefix. Numerical + failure, cooperative cancellation or owner closure stops further cases. + Closing from a completion callback preserves the complete prefix; a + final-case closure still returns completed. Callback and programming + errors propagate. This development route uses one RHS at a + time, avoiding full displacement/reaction batches for large panels. + Selected displacement, reaction and local member-resultant envelopes + describe only complete cases in the returned prefix, with the first + submitted case governing ties. + """ + if self._closed: + raise ExperimentalB2Q4PanelError("experimental panel is closed") + if self._modal_only: + raise ValueError("free-free modal-only policy does not admit static solves") + selector = checked_physical_selection if self._physical_footprint_law else checked_selection + chosen_footprints = selector(selected_footprints, self.footprints) + try: + chosen = tuple(selected_dofs) + chosen_points = tuple(selected_points) + submitted = tuple(cases) + except TypeError as exc: + raise ValueError("ordered B2 panel cases and selection required") from exc + if (not chosen or any(type(value) is not int or + not 0 <= value < len(self._u0) + for value in chosen) or + len(set(chosen)) != len(chosen)): + raise ValueError("unique selected panel coordinate indices required") + if (any(type(point_id) is not str or + point_id not in self.point_ids for point_id in chosen_points) or + len(set(chosen_points)) != len(chosen_points)): + raise ValueError("unique selected panel point IDs required") + if (not submitted or + any(type(item) not in (tuple, list) or len(item) != 2 or + type(item[0]) is not str or not item[0].strip() + for item in submitted) or + len({item[0] for item in submitted}) != len(submitted)): + raise ValueError("unique nonempty ordered B2 panel case IDs required") + # Caller-owned list pairs may be changed by a completion callback. + # Snapshot their inventory/references now; later load-value mutation + # remains checked by the existing bounded fingerprints below. + submitted = tuple((case_id, load) for case_id, load in submitted) + if self._physical_footprint_law and any(isinstance(load,B2ReferenceBodyLoad) for _,load in submitted): + raise ValueError("physical footprint body-load driver not admitted") + selected_rows = tuple((item.row_start+j,item.footprint_id,item.shell_node,item.beam_node,component) + for item in self._footprint_incidence if item.footprint_id in chosen_footprints + for j,component in enumerate(("translation_x","translation_y","translation_z","director_1","director_2"))) if self._physical_footprint_law else () + if cancellation_token is not None and not isinstance( + cancellation_token, CancellationToken): + raise TypeError("B2 panel cancellation token required") + if on_case is not None and not callable(on_case): + raise TypeError("B2 panel case callback required") + recovery = _checked_recovery( + {} if recover_members is None else recover_members, + {member_id for member_id, _ in self._members}) + # Counts outlive a callback closing the owner, without retaining its + # factor in this operation or a propagated callback-error traceback. + factorization_count = self._handle.factorization_count + solve_count = self._handle.solve_count + fingerprints = [] + for _case_id, load in submitted: + if cancellation_token is not None and cancellation_token.is_cancelled: + break + snapshot, fingerprint = self._body_load_snapshot(load) + fingerprints.append(fingerprint) + del snapshot + completed = [] + + def envelopes(attribute): + if not completed: + return () + extrema = [] + for index, dof in enumerate(chosen): + # min/max preserve the first case on exact ties. No rounding, + # absolute envelope or physical-unit conversion is introduced. + minimum = min(completed, key=lambda case: getattr(case, attribute)[index]) + maximum = max(completed, key=lambda case: getattr(case, attribute)[index]) + extrema.append(ExperimentalB2Q4PanelResponseEnvelope( + dof, getattr(minimum, attribute)[index], minimum.case_id, + getattr(maximum, attribute)[index], maximum.case_id)) + return tuple(extrema) + + def member_envelopes(): + if not completed or not recovery: + return () + sections = tuple((case.case_id, dict(case.beam_resultants_local)) + for case in completed) + extrema = [] + for member_id, stations in recovery.items(): + if any(member_id not in rows or len(rows[member_id]) != len(stations) + for _, rows in sections): + raise RuntimeError("incomplete selected B2 member recovery") + for station_index, station in enumerate(stations): + for component_index, component in enumerate( + ("N", "Qy", "Qz", "Mx", "My", "Mz")): + values = tuple((case_id, rows[member_id][station_index][component_index]) + for case_id, rows in sections) + minimum = min(values, key=lambda item: item[1]) + maximum = max(values, key=lambda item: item[1]) + extrema.append(ExperimentalB2Q4PanelMemberResultantEnvelope( + member_id, station_index, station, component, + minimum[1], minimum[0], maximum[1], maximum[0])) + return tuple(extrema) + + def finish(status, failure_reason=None): + result_type = (ExperimentalB2Q4FootprintBatchResult if self.footprints + else ExperimentalB2Q4PanelBatchResult) + extra = {"selected_footprints": chosen_footprints} if self.footprints else {} + if self._physical_footprint_law: + result_type = B2PhysicalRigidFootprintBatchResult + extra["constraint_rows"] = selected_rows + return result_type( + status, chosen, chosen_points, tuple(completed), + factorization_count, solve_count, + failure_reason=failure_reason, + displacement_envelopes=envelopes("selected_displacements"), + affine_reaction_envelopes=envelopes("selected_affine_reactions"), + member_resultant_envelopes=member_envelopes(), **extra) + + for index, (case_id, load) in enumerate(submitted): + if self._closed or (cancellation_token is not None and + cancellation_token.is_cancelled): + break + snapshot, fingerprint = self._body_load_snapshot(load) + if fingerprint != fingerprints[index]: + raise ValueError("B2 panel load case changed after submission") + result = self.solve_linear(load if isinstance(load, B2ReferenceBodyLoad) else snapshot, recover_members=recovery, + selected_footprints=selected_footprints) + factorization_count = result.factorization_count + solve_count = result.solve_count + if result.status != "completed": + return finish("failed", f"{case_id}: {result.failure_reason}") + point_multipliers = dict(result.point_multipliers) + point_gaps = dict(result.point_gaps) + case_type = (ExperimentalB2Q4FootprintSelectedCase if self.footprints + else ExperimentalB2Q4PanelSelectedCase) + extra = {"footprint_wrenches": result.footprint_wrenches} if self.footprints else {} + if self._physical_footprint_law: + case_type = B2PhysicalRigidFootprintSelectedCase + row_indices = tuple(row[0] for row in selected_rows) + extra.update(constraint_multipliers=tuple(result.constraint_multipliers[i] for i in row_indices), + constraint_gaps=tuple(result.constraint_gaps[i] for i in row_indices)) + if isinstance(load, B2ReferenceBodyLoad): + case_type = B2BodyLoadedFootprintSelectedCase if self.footprints else B2BodyLoadedPanelSelectedCase + extra.update(body_model_identity=result.body_model_identity, + body_acceleration_m_s2=result.body_acceleration_m_s2, + equilibrated_sections=result.equilibrated_sections) + if self._point_trace_policy is not None: + case_type = B2LoadedPointPanelSelectedCase + extra.update(equilibrated_sections=result.equilibrated_sections, + loaded_member_poses=result.loaded_member_poses, + loaded_strain_energy=result.loaded_strain_energy) + completed.append(case_type( + case_id, + tuple(result.displacements[index] for index in chosen), + tuple(result.affine_reactions[index] for index in chosen), + tuple((point_id, point_multipliers[point_id]) + for point_id in chosen_points), + tuple((point_id, point_gaps[point_id]) + for point_id in chosen_points), + result.beam_resultants_local, + result.internal_strain_energy, **extra)) + if on_case is not None: + on_case(case_id) + return finish( + "cancelled" if len(completed) != len(submitted) else "completed", + failure_reason=("experimental panel closed" + + (" after " + completed[-1].case_id if completed else "") + if self._closed and len(completed) != len(submitted) + else None)) + def close(self) -> None: - self._closed = True - try: - _retire_private_q4_mesh(self) - finally: - self._handle = None - self._physical_scaled_kkt = None - self._attachment_elimination = None - if self._point_trace_policy is not None: - for compiled_load in self._loaded_members.values(): - compiled_load._recovery_maps.clear() - self._loaded_members.clear() - self._H = self._abs_H = self._resolution_kkt = None - self._resolution_kkt = None - self._affine_resolution_cache = None - self._buckling_model = None - self._buckling_shells = () - - -def _release_coo_scratch(rows, columns, values, diagnostic, phase): - # CSR owns its arrays; these compiler lists have no later mechanics use. - counts = tuple(map(len, (rows, columns, values))) if diagnostic is not None else None - rows.clear() - columns.clear() - values.clear() - if diagnostic is not None: - diagnostic.record_coo_release(phase, counts) - - -def _scatter(rows, columns, values, slots, local): - width = len(slots) - rows.extend(np.repeat(slots, width)) - columns.extend(np.tile(slots, width)) - values.extend(np.asarray(local).ravel()) - - -def _modal_scaled_residual(residual, bound, row_scale): - """Infinity backward error in the fixed congruence row representation. - - Near-zero components of an uncoupled mode are not separate relative-error - denominators. Scaling the rows before the norm keeps their units consistent - with the factorization coordinates without an arbitrary physical floor. - """ - residual, bound = np.asarray(residual), np.asarray(bound) - if not np.isfinite(residual).all() or not np.isfinite(bound).all(): - return float("inf") - numerator = np.max(abs(residual)*row_scale, initial=0.) - denominator = np.max(bound*row_scale, initial=0.) - if not np.isfinite(numerator) or not np.isfinite(denominator): - return float("inf") - if denominator == 0.: - return 0. if numerator == 0. else float("inf") - return float(numerator/denominator) - - -def _free_b2_rigid_space(owner, scale, scaled_mass, safe_point): - """Common physical velocities, with only a bounded six-by-six Gram solve.""" - origin = owner._modal_positions[:len(owner.shell_node_ids)].mean(axis=0) - canonical = np.zeros((owner._K.shape[0], 6)) - for i, position in enumerate(owner._modal_positions): - slots = slice(6*i, 6*i+3) - canonical[slots, :3] = np.eye(3) - for j in range(3): - canonical[slots, 3+j] = np.cross(np.eye(3)[j], position-origin) - canonical[6*i+3:6*i+6, 3:] = np.eye(3) - n = owner._K.shape[0] - equations, gaps = [], [] - for column in canonical.T: - safe_point("reference modes rigid field") - equation = _modal_scaled_residual(owner._K@column, - abs(owner._K)@abs(column), scale[:n]) - gap = _modal_scaled_residual(owner._C@column, - abs(owner._C)@abs(column), scale[n:]) - if equation > 1e-8 or gap > 1e-9: - raise _NumericalFailure("canonical free-free rigid field violates physical K or point C") - equations.append(equation); gaps.append(gap) - gram = canonical.T@owner._M@canonical - if (not np.isfinite(gram).all() or - np.max(abs(gram-gram.T)) > 1e-10*np.max(abs(gram))): - raise _NumericalFailure("canonical rigid kinetic Gram symmetry unresolved") - try: - lower = np.linalg.cholesky(gram) - normalized = canonical@np.linalg.solve(lower.T, np.eye(6)) - except np.linalg.LinAlgError as exc: - raise _NumericalFailure("six physical rigid fields require positive kinetic Gram") from exc - if (not np.isfinite(normalized).all() or - np.max(abs(normalized.T@owner._M@normalized-np.eye(6))) > 1e-7): - raise _NumericalFailure("rigid kinetic normalization unresolved") - scaled = np.vstack((normalized, np.zeros((owner._C.shape[0], 6))))/scale[:, None] - if (not np.isfinite(scaled).all() or - np.max(abs(scaled.T@scaled_mass@scaled-np.eye(6))) > 1e-7): - raise _NumericalFailure("rigid congruence reconstruction unresolved") - return dict(origin=tuple(map(float, origin)), canonical=canonical, - normalized=normalized, scaled=scaled, gram=gram, - equations=tuple(equations), gaps=tuple(gaps)) - - -class ExperimentalB2MixedPanelAnalysis(ExperimentalB2Q4PanelAnalysis): - """Explicit mixed-shell admission using the existing static sparse owner.""" - - _mixed_shells = True - - @property - def capabilities(self) -> ExperimentalB2MixedPanelCapabilities: - existing = super().capabilities - capability_type = (ExperimentalB2MixedReferenceModalCapabilities if - self._reference_inertia_policy is not None else ExperimentalB2MixedPanelCapabilities) - extra = ({"shell_mass_policies": tuple((shell_id, - S3_V2D_TRANSLATIONAL_LUMPED_SECTION_AREAL_MASS_V1 if formulation == - S3_V2D_FORMULATION_ID else Q4_MASS_POLICY) - for shell_id, formulation in self._shell_formulations)} - if self._reference_inertia_policy is not None else {}) - if self._reference_inertia_policy is not None: - extra["boundary_policy"] = self._reference_boundary_policy - return capability_type( - point_law_id=tuple(dict.fromkeys(law for _, law in self._point_laws)), - attachment=existing.attachment, - operations=existing.operations, - body_load_domain=existing.body_load_domain, + self._closed = True + try: + _retire_private_q4_mesh(self) + finally: + self._handle = None + self._physical_scaled_kkt = None + self._attachment_elimination = None + if self._point_trace_policy is not None: + for compiled_load in self._loaded_members.values(): + compiled_load._recovery_maps.clear() + self._loaded_members.clear() + self._H = self._abs_H = self._resolution_kkt = None + self._resolution_kkt = None + self._affine_resolution_cache = None + self._buckling_model = None + self._buckling_shells = () + + +def _release_coo_scratch(rows, columns, values, diagnostic, phase): + # CSR owns its arrays; these compiler lists have no later mechanics use. + counts = tuple(map(len, (rows, columns, values))) if diagnostic is not None else None + rows.clear() + columns.clear() + values.clear() + if diagnostic is not None: + diagnostic.record_coo_release(phase, counts) + + +def _scatter(rows, columns, values, slots, local): + width = len(slots) + rows.extend(np.repeat(slots, width)) + columns.extend(np.tile(slots, width)) + values.extend(np.asarray(local).ravel()) + + +def _modal_scaled_residual(residual, bound, row_scale): + """Infinity backward error in the fixed congruence row representation. + + Near-zero components of an uncoupled mode are not separate relative-error + denominators. Scaling the rows before the norm keeps their units consistent + with the factorization coordinates without an arbitrary physical floor. + """ + residual, bound = np.asarray(residual), np.asarray(bound) + if not np.isfinite(residual).all() or not np.isfinite(bound).all(): + return float("inf") + numerator = np.max(abs(residual)*row_scale, initial=0.) + denominator = np.max(bound*row_scale, initial=0.) + if not np.isfinite(numerator) or not np.isfinite(denominator): + return float("inf") + if denominator == 0.: + return 0. if numerator == 0. else float("inf") + return float(numerator/denominator) + + +def _free_b2_rigid_space(owner, scale, scaled_mass, safe_point): + """Common physical velocities, with only a bounded six-by-six Gram solve.""" + origin = owner._modal_positions[:len(owner.shell_node_ids)].mean(axis=0) + canonical = np.zeros((owner._K.shape[0], 6)) + for i, position in enumerate(owner._modal_positions): + slots = slice(6*i, 6*i+3) + canonical[slots, :3] = np.eye(3) + for j in range(3): + canonical[slots, 3+j] = np.cross(np.eye(3)[j], position-origin) + canonical[6*i+3:6*i+6, 3:] = np.eye(3) + n = owner._K.shape[0] + equations, gaps = [], [] + for column in canonical.T: + safe_point("reference modes rigid field") + equation = _modal_scaled_residual(owner._K@column, + abs(owner._K)@abs(column), scale[:n]) + gap = _modal_scaled_residual(owner._C@column, + abs(owner._C)@abs(column), scale[n:]) + if equation > 1e-8 or gap > 1e-9: + raise _NumericalFailure("canonical free-free rigid field violates physical K or point C") + equations.append(equation); gaps.append(gap) + gram = canonical.T@owner._M@canonical + if (not np.isfinite(gram).all() or + np.max(abs(gram-gram.T)) > 1e-10*np.max(abs(gram))): + raise _NumericalFailure("canonical rigid kinetic Gram symmetry unresolved") + try: + lower = np.linalg.cholesky(gram) + normalized = canonical@np.linalg.solve(lower.T, np.eye(6)) + except np.linalg.LinAlgError as exc: + raise _NumericalFailure("six physical rigid fields require positive kinetic Gram") from exc + if (not np.isfinite(normalized).all() or + np.max(abs(normalized.T@owner._M@normalized-np.eye(6))) > 1e-7): + raise _NumericalFailure("rigid kinetic normalization unresolved") + scaled = np.vstack((normalized, np.zeros((owner._C.shape[0], 6))))/scale[:, None] + if (not np.isfinite(scaled).all() or + np.max(abs(scaled.T@scaled_mass@scaled-np.eye(6))) > 1e-7): + raise _NumericalFailure("rigid congruence reconstruction unresolved") + return dict(origin=tuple(map(float, origin)), canonical=canonical, + normalized=normalized, scaled=scaled, gram=gram, + equations=tuple(equations), gaps=tuple(gaps)) + + +class ExperimentalB2MixedPanelAnalysis(ExperimentalB2Q4PanelAnalysis): + """Explicit mixed-shell admission using the existing static sparse owner.""" + + _mixed_shells = True + + @property + def capabilities(self) -> ExperimentalB2MixedPanelCapabilities: + existing = super().capabilities + capability_type = (ExperimentalB2MixedReferenceModalCapabilities if + self._reference_inertia_policy is not None else ExperimentalB2MixedPanelCapabilities) + extra = ({"shell_mass_policies": tuple((shell_id, + S3_V2D_TRANSLATIONAL_LUMPED_SECTION_AREAL_MASS_V1 if formulation == + S3_V2D_FORMULATION_ID else Q4_MASS_POLICY) + for shell_id, formulation in self._shell_formulations)} + if self._reference_inertia_policy is not None else {}) + if self._reference_inertia_policy is not None: + extra["boundary_policy"] = self._reference_boundary_policy + return capability_type( + point_law_id=tuple(dict.fromkeys(law for _, law in self._point_laws)), + attachment=existing.attachment, + operations=existing.operations, + body_load_domain=existing.body_load_domain, spectral_domain=(existing.spectral_domain if self._modal_only or self._physical_footprint_law else - "experimental virgin supported finite descriptor pairs; heterogeneous Q4 director and native S3 lumped translation inertia; S3 rotary inertia omitted; completeness unqualified; prestress unsupported" - if self._reference_inertia_policy is not None else - "native S3 V2D physical mass and modes deferred" if self._has_s3 - else existing.spectral_domain), - shell_formulations=self._shell_formulations, - point_laws=self._point_laws, + "experimental virgin supported finite descriptor pairs; heterogeneous Q4 director and native S3 lumped translation inertia; S3 rotary inertia omitted; completeness unqualified; prestress unsupported" + if self._reference_inertia_policy is not None else + "native S3 V2D physical mass and modes deferred" if self._has_s3 + else existing.spectral_domain), + shell_formulations=self._shell_formulations, + point_laws=self._point_laws, footprint_law_id=existing.footprint_law_id if self._physical_footprint_law else FOOTPRINT_LAW_ID if self.footprints else None, - footprints=self.footprints, **extra) - - -def create_experimental_b2_q4_panel_analysis(*args, **kwargs): - return ExperimentalB2Q4PanelAnalysis(*args, **kwargs) + footprints=self.footprints, **extra) + + +def create_experimental_b2_q4_panel_analysis(*args, **kwargs): + return ExperimentalB2Q4PanelAnalysis(*args, **kwargs) diff --git a/src/anysolver/_stiffened_shell_b2_q4_point_experimental.py b/src/anyfesolver/_stiffened_shell_b2_q4_point_experimental.py similarity index 100% rename from src/anysolver/_stiffened_shell_b2_q4_point_experimental.py rename to src/anyfesolver/_stiffened_shell_b2_q4_point_experimental.py diff --git a/src/anysolver/_stiffened_shell_b2_reference_buckling.py b/src/anyfesolver/_stiffened_shell_b2_reference_buckling.py similarity index 98% rename from src/anysolver/_stiffened_shell_b2_reference_buckling.py rename to src/anyfesolver/_stiffened_shell_b2_reference_buckling.py index c9ce408b9..15dc5ff57 100644 --- a/src/anysolver/_stiffened_shell_b2_reference_buckling.py +++ b/src/anyfesolver/_stiffened_shell_b2_reference_buckling.py @@ -1,413 +1,413 @@ -"""Experimental conservative reference buckling of the physical B2 panel. - -Spectral kinematics are deliberately separate from the affine static owner. -Section tractions are supplied physical data, never reconstructed from stiffness. -""" -from dataclasses import dataclass -import hashlib -import numpy as np -from scipy import sparse -from scipy.sparse.linalg import LinearOperator, eigs, ArpackError - -POLICY = "B2_PHYSICAL_REFERENCE_GREEN_POINT_BUCKLING_V1_DEV" -PORT_POLICY = "B2_GEODESIC_MIDFRAME_PROPER_POLAR_SECOND_VARIATION_V1_DEV" -Q4_KERNEL_POLICY = "Q4_QUALIFIED_REFERENCE_RECOVERED_N_M_HOMOGENEOUS_SECOND_MOMENT_PHYSICAL_TO_GP_FRAME_V2_DEV" -S3_KERNEL_POLICY = "S3_V2D_FROZEN_THIN_UNIFORM_MEMBRANE_OMITS_PHYSICAL_SECOND_MOMENT" - -class _BucklingNumericalFailure(RuntimeError): - """A deliberately classified failed numerical spectral operation.""" - -def _sealed(value, shape, label): - a = np.asarray(value, dtype=float) - if a.shape != shape or not np.isfinite(a).all(): - raise ValueError(f"finite {label} with shape {shape} required") - return np.frombuffer(a.tobytes(), dtype=float).reshape(shape) - -def _cross_matrix(v): - return np.array(((0.,-v[2],v[1]),(v[2],0.,-v[0]),(-v[1],v[0],0.))) - -@dataclass(frozen=True) -class B2SectionTractionQuadrature: - """Physical traction source about the member reference axis, in its frame. - - ``traction_map[k] @ [N,Qy,Qz,Mx,My,Mz]`` gives S11,S12,S13. - Transverse stresses are zero under this declared beam idealization. - """ - member_id: str - source_id: str - coordinates_yz_m: tuple - area_weights_m2: tuple - traction_map: tuple - datum: str = "member_reference_axis_local_yz" - - def __post_init__(self): - if type(self.member_id) is not str or type(self.source_id) is not str or not self.member_id or not self.source_id or self.datum != "member_reference_axis_local_yz": - raise ValueError("explicit source and member reference-axis datum required") - n = len(self.area_weights_m2) - yz = _sealed(self.coordinates_yz_m,(n,2),"section coordinates") - w = _sealed(self.area_weights_m2,(n,),"section area weights") - t = _sealed(self.traction_map,(n,3,6),"section traction reconstruction") - if n < 3 or np.any(w <= 0.): - raise ValueError("positive physical section area quadrature required") - length=float(np.max(abs(yz))) - if not np.isfinite(length) or length <= 0.: raise ValueError("nonzero physical section length required") - result = np.zeros((6,6)); scale = np.zeros((6,6)) - for xy, weight, mapping in zip(yz,w,t): - rho = np.r_[0.,xy/length] - action = np.vstack((np.eye(3),_cross_matrix(rho))) - # D R D^-1, with D=diag(I, I/length): dimensionless force / - # moment virtual-work certificate in the declared physical datum. - normalized=mapping.copy();normalized[:,3:]*=length - with np.errstate(over="ignore",invalid="ignore"): - result += weight*action@normalized - scale += weight*abs(action)@abs(normalized) - if not np.isfinite(result).all() or not np.isfinite(scale).all(): - raise ValueError("section six-resultant arithmetic not representable") - # Elementwise backward work certificate; cancellation is measured, not hidden. - error = abs(result-np.eye(6)) - if np.any(error > 128*np.finfo(float).eps*(scale+np.eye(6))): - raise ValueError("section source does not reproduce six physical resultants") - if np.max(np.sum(error,axis=1)) > 1e-10: - raise ValueError("section source forward six-resultant identity failed") - object.__setattr__(self,"coordinates_yz_m",yz) - object.__setattr__(self,"area_weights_m2",w) - object.__setattr__(self,"traction_map",t) - - @property - def identity(self): - h = hashlib.sha256((self.member_id+"\0"+self.source_id+"\0"+self.datum).encode()) - for a in (self.coordinates_yz_m,self.area_weights_m2,self.traction_map): h.update(a.tobytes()) - return h.hexdigest() - -@dataclass(frozen=True) -class B2ReferenceBucklingRequest: - preload: tuple - section_tractions: tuple - count: int = 1 - shift: float = 0. - max_iterations: int = 1000 - - def __post_init__(self): - p = np.asarray(self.preload,dtype=float) - if p.ndim != 1 or not np.isfinite(p).all(): raise ValueError("finite dead nodal force vector required") - object.__setattr__(self,"preload",tuple(map(float,p))) - sources = tuple(self.section_tractions) - if any(type(s) is not B2SectionTractionQuadrature for s in sources): raise ValueError("typed physical traction sources required") - if len({s.member_id for s in sources}) != len(sources): raise ValueError("one source per member required") - object.__setattr__(self,"section_tractions",sources) - if type(self.count) is not int or self.count < 1: raise ValueError("positive buckling count required") - if not np.isfinite(self.shift) or self.shift < 0.: raise ValueError("finite nonnegative load-factor shift required") - if type(self.max_iterations) is not int or self.max_iterations < 1: raise ValueError("positive iteration bound required") - -@dataclass(frozen=True) -class B2ReferenceBucklingCapabilities: - eligible: bool - reasons: tuple = () - policy: str = POLICY - production_qualified: bool = False - scope: str = "zero-prescription Cartesian dead-force endpoint POINT Q4 / uniform-membrane S3" - remaining: tuple = ("general S3 bending/director second moment/shear", "Q4 shear prestress", "interior loaded ports", "weak lines", "footprints", "prescribed prestress", "dead-couple potential", "full F12/B14 qualification") - shell_kernel_policies: tuple = () - -@dataclass(frozen=True) -class B2ReferenceBucklingResult: - status: str - load_factors: tuple = () - modes: tuple = () - multiplier_modes: tuple = () - equation_residuals: tuple = () - constraint_residuals: tuple = () - preload_result: object = None - identity: str = "" - failure_reason: str | None = None - policy: str = POLICY - production_qualified: bool = False - -def beam_reference_derivatives(operator, station): - """Position/rotation derivatives of the objective geodesic-midframe trace. - - Return first derivatives and coordinate Hessians, plus reference-length - derivatives. Coordinates are the existing twelve additive physical slots. - """ - length = float(operator.length) - poly = operator._trace_polynomials - maps = np.array([[sum(float(c)*station**d for d,c in enumerate(p)) for p in row] for row in poly]) - slope = np.array([[sum(d*float(c)*station**(d-1)/length for d,c in enumerate(p) if d) for p in row] for row in poly]) - eye = np.eye(12) - omega = .5*(eye[3:6]+eye[9:12]).T - mean = .5*(eye[:3]+eye[6:9]).T - first = np.zeros((12,12)); second = np.zeros((12,12,12)) - for node, pos in ((0,np.array((-length/2,0.,0.))),(1,np.array((length/2,0.,0.)))): - base = 6*node - delta = eye[base:base+3].T-mean - theta = eye[base+3:base+6].T - first[base:base+3] = (delta-np.cross(omega,pos)).T - first[base+3:base+6] = (theta-omega).T - for a in range(12): - for b in range(12): - second[base:base+3,a,b] = (-np.cross(omega[a],delta[b])-np.cross(omega[b],delta[a]) - +.5*(np.cross(omega[a],np.cross(omega[b],pos))+np.cross(omega[b],np.cross(omega[a],pos)))) - second[base+3:base+6,a,b] = -.5*(np.cross(omega[a],theta[b])+np.cross(omega[b],theta[a])) - d = maps@first; ds = slope@first - h = np.einsum('ij,jab->iab',maps,second) - hs = np.einsum('ij,jab->iab',slope,second) - pos = np.array(((station-.5)*length,0.,0.)); axis=np.array((1.,0.,0.)) - for a in range(12): - for b in range(12): - h[:3,a,b] += .5*(np.cross(omega[a],np.cross(omega[b],pos))+np.cross(omega[b],np.cross(omega[a],pos)))+np.cross(omega[a],d[:3,b])+np.cross(omega[b],d[:3,a]) - hs[:3,a,b] += .5*(np.cross(omega[a],np.cross(omega[b],axis))+np.cross(omega[b],np.cross(omega[a],axis)))+np.cross(omega[a],ds[:3,b])+np.cross(omega[b],ds[:3,a]) - h[3:,a,b] += .5*(np.cross(omega[a],d[3:,b])+np.cross(omega[b],d[3:,a])) - hs[3:,a,b] += .5*(np.cross(omega[a],ds[3:,b])+np.cross(omega[b],ds[3:,a])) - actual = d.copy(); actual[:3] += mean.T+np.cross(omega,pos).T;actual[3:] += omega.T - actual_s = ds.copy();actual_s[:3] += np.cross(omega,axis).T - if not np.allclose(actual,maps,rtol=0.,atol=128*np.finfo(float).eps*max(1.,abs(maps).max())): - raise ValueError("objective beam continuation does not reproduce reference trace") - return maps,slope,h,hs - -def member_green_hessian(member, displacement, source): - """Full S11/S12/S13 Green sectional initial-stress work, tension sign.""" - operator=member.operator; length=float(operator.length) - nodes, weights=np.polynomial.legendre.leggauss(4) - stations=(nodes+1.)/2; result=operator.recover_sections(displacement,stations=stations).resultants - made=np.zeros((12,12)); virtual=np.zeros(12) - for s,w,resultants in zip(stations,weights,result): - j,js,h,hs=beam_reference_derivatives(operator,float(s)) - for yz,area,traction_map in zip(source.coordinates_yz_m,source.area_weights_m2,source.traction_map): - rho=np.r_[0.,yz]; stress=traction_map@resultants - xs=js[:3].T+np.cross(js[3:].T,rho) - dy=np.cross(j[3:].T,(0.,1.,0.)); dz=np.cross(j[3:].T,(0.,0.,1.)) - e11=xs[:,0]; g12=xs[:,1]+dy[:,0];g13=xs[:,2]+dz[:,0] - virtual += w*length/2*area*(stress[0]*e11+stress[1]*g12+stress[2]*g13) - for a in range(12): - for b in range(12): - xsh=hs[:3,a,b]+np.cross(hs[3:,a,b],rho)+.5*( - np.cross(js[3:,a],np.cross(j[3:,b],rho))+np.cross(j[3:,a],np.cross(js[3:,b],rho))+ - np.cross(js[3:,b],np.cross(j[3:,a],rho))+np.cross(j[3:,b],np.cross(js[3:,a],rho))) - dyh=np.cross(h[3:,a,b],(0.,1.,0.))+.5*(np.cross(j[3:,a],dy[b])+np.cross(j[3:,b],dy[a])) - dzh=np.cross(h[3:,a,b],(0.,0.,1.))+.5*(np.cross(j[3:,a],dz[b])+np.cross(j[3:,b],dz[a])) - v=(stress[0]*(xs[a]@xs[b]+xsh[0])+stress[1]*(xs[a]@dy[b]+xs[b]@dy[a]+xsh[1]+dyh[0])+ - stress[2]*(xs[a]@dz[b]+xs[b]@dz[a]+xsh[2]+dzh[0])) - made[a,b] += w*length/2*area*v - force=np.asarray(operator.evaluate(displacement).force) - force=force.copy();virtual=virtual.copy() - force.reshape(2,6)[:,3:]/=length;virtual.reshape(2,6)[:,3:]/=length - if not np.isfinite(force).all() or not np.isfinite(virtual).all(): - raise ValueError("normalized sectional virtual work not representable") - magnitude=max(float(np.max(abs(force))),float(np.max(abs(virtual)))) - # One common magnitude keeps all norms finite and introduces no unit floor. - f=force/magnitude if magnitude else force;v=virtual/magnitude if magnitude else virtual - denominator=np.linalg.norm(f)+np.linalg.norm(v) - if np.linalg.norm(f-v) > 1e-10*denominator: - raise ValueError("sectional first virtual work disagrees with physical force-flexibility trace") - return made - -def point_green_hessian(law, vertices, member, station, offset, multiplier): - from ._ge_beam3_pose_joint import RigidPoseJoint - width=law.shell_port.shape[1]; r=vertices-vertices.mean(axis=0) - gram=sum((_cross_matrix(x).T@_cross_matrix(x) for x in r),np.zeros((3,3))) - shell_h=np.zeros((6,width,width)); eye=np.eye(width) - omega=law.shell_port[3:].T - translations=np.stack([eye[6*i:6*i+3].T for i in range(len(r))]) - translations-=translations.mean(axis=0) - for a in range(width): - for b in range(width): - rhs=np.zeros(3) - for i,x in enumerate(r): - rhs += np.cross(np.cross(omega[a],x),translations[i,b])+np.cross(np.cross(omega[b],x),translations[i,a]) - rhs += np.cross(.5*(np.cross(omega[a],np.cross(omega[b],x))+np.cross(omega[b],np.cross(omega[a],x))),x) - shell_h[3:,a,b]=np.linalg.solve(gram,rhs) - j,_,h,_=beam_reference_derivatives(member.operator,float(station)) - d=np.asarray(offset,dtype=float); local_h=h.copy() - for a in range(12): - for b in range(12): - local_h[:3,a,b] += np.cross(h[3:,a,b],d)+.5*(np.cross(j[3:,a],np.cross(j[3:,b],d))+np.cross(j[3:,b],np.cross(j[3:,a],d))) - frame=member.definition.local_frame_rows().T; transform=member.local_dof_map() - beam_h=np.einsum('ij,jab,ak,bl->ikl',np.kron(np.eye(2),frame),local_h,transform,transform) - port=np.zeros((12,width+12));port[:6,:width]=law.shell_port;port[6:,width:]=law.beam_port - curvature=np.zeros((12,width+12,width+12));curvature[:6,:width,:width]=shell_h;curvature[6:,width:,width:]=beam_h - joint=RigidPoseJoint(np.stack((law.shell_reference_m,law.beam_reference_m)),law.reference_frames) - response=joint.evaluate(np.stack((law.shell_reference_m,law.beam_reference_m)),law.reference_frames,np.asarray(multiplier)) - return port.T@response.chart_hessian[:12,:12]@port+np.einsum('i,iab->ab',response.residual[:12],curvature) - -@dataclass(frozen=True) -class B2PhysicalFootprintBucklingRequest(B2ReferenceBucklingRequest): - """Opt-in five-row Q4 physical rigid-footprint spectral operation.""" - -@dataclass(frozen=True) -class B2PhysicalFootprintBucklingResult(B2ReferenceBucklingResult): - policy: str = "B2_PHYSICAL_RIGID_FOOTPRINT_GREEN_BUCKLING_V1_DEV" - -def physical_footprint_capabilities(owner): - from ._stiffened_shell_b2_physical_rigid_footprint import BUCKLING_POLICY - reasons=[] - if not getattr(owner,"_physical_footprint_law",False): reasons.append("physical footprint family required") - if owner._closed: reasons.append("owner closed") - if owner.point_ids: reasons.append("mixed POINT / physical footprint spectral operation unavailable") - if np.any(owner._u0 != 0.): reasons.append("prescribed prestress split unavailable") +"""Experimental conservative reference buckling of the physical B2 panel. + +Spectral kinematics are deliberately separate from the affine static owner. +Section tractions are supplied physical data, never reconstructed from stiffness. +""" +from dataclasses import dataclass +import hashlib +import numpy as np +from scipy import sparse +from scipy.sparse.linalg import LinearOperator, eigs, ArpackError + +POLICY = "B2_PHYSICAL_REFERENCE_GREEN_POINT_BUCKLING_V1_DEV" +PORT_POLICY = "B2_GEODESIC_MIDFRAME_PROPER_POLAR_SECOND_VARIATION_V1_DEV" +Q4_KERNEL_POLICY = "Q4_QUALIFIED_REFERENCE_RECOVERED_N_M_HOMOGENEOUS_SECOND_MOMENT_PHYSICAL_TO_GP_FRAME_V2_DEV" +S3_KERNEL_POLICY = "S3_V2D_FROZEN_THIN_UNIFORM_MEMBRANE_OMITS_PHYSICAL_SECOND_MOMENT" + +class _BucklingNumericalFailure(RuntimeError): + """A deliberately classified failed numerical spectral operation.""" + +def _sealed(value, shape, label): + a = np.asarray(value, dtype=float) + if a.shape != shape or not np.isfinite(a).all(): + raise ValueError(f"finite {label} with shape {shape} required") + return np.frombuffer(a.tobytes(), dtype=float).reshape(shape) + +def _cross_matrix(v): + return np.array(((0.,-v[2],v[1]),(v[2],0.,-v[0]),(-v[1],v[0],0.))) + +@dataclass(frozen=True) +class B2SectionTractionQuadrature: + """Physical traction source about the member reference axis, in its frame. + + ``traction_map[k] @ [N,Qy,Qz,Mx,My,Mz]`` gives S11,S12,S13. + Transverse stresses are zero under this declared beam idealization. + """ + member_id: str + source_id: str + coordinates_yz_m: tuple + area_weights_m2: tuple + traction_map: tuple + datum: str = "member_reference_axis_local_yz" + + def __post_init__(self): + if type(self.member_id) is not str or type(self.source_id) is not str or not self.member_id or not self.source_id or self.datum != "member_reference_axis_local_yz": + raise ValueError("explicit source and member reference-axis datum required") + n = len(self.area_weights_m2) + yz = _sealed(self.coordinates_yz_m,(n,2),"section coordinates") + w = _sealed(self.area_weights_m2,(n,),"section area weights") + t = _sealed(self.traction_map,(n,3,6),"section traction reconstruction") + if n < 3 or np.any(w <= 0.): + raise ValueError("positive physical section area quadrature required") + length=float(np.max(abs(yz))) + if not np.isfinite(length) or length <= 0.: raise ValueError("nonzero physical section length required") + result = np.zeros((6,6)); scale = np.zeros((6,6)) + for xy, weight, mapping in zip(yz,w,t): + rho = np.r_[0.,xy/length] + action = np.vstack((np.eye(3),_cross_matrix(rho))) + # D R D^-1, with D=diag(I, I/length): dimensionless force / + # moment virtual-work certificate in the declared physical datum. + normalized=mapping.copy();normalized[:,3:]*=length + with np.errstate(over="ignore",invalid="ignore"): + result += weight*action@normalized + scale += weight*abs(action)@abs(normalized) + if not np.isfinite(result).all() or not np.isfinite(scale).all(): + raise ValueError("section six-resultant arithmetic not representable") + # Elementwise backward work certificate; cancellation is measured, not hidden. + error = abs(result-np.eye(6)) + if np.any(error > 128*np.finfo(float).eps*(scale+np.eye(6))): + raise ValueError("section source does not reproduce six physical resultants") + if np.max(np.sum(error,axis=1)) > 1e-10: + raise ValueError("section source forward six-resultant identity failed") + object.__setattr__(self,"coordinates_yz_m",yz) + object.__setattr__(self,"area_weights_m2",w) + object.__setattr__(self,"traction_map",t) + + @property + def identity(self): + h = hashlib.sha256((self.member_id+"\0"+self.source_id+"\0"+self.datum).encode()) + for a in (self.coordinates_yz_m,self.area_weights_m2,self.traction_map): h.update(a.tobytes()) + return h.hexdigest() + +@dataclass(frozen=True) +class B2ReferenceBucklingRequest: + preload: tuple + section_tractions: tuple + count: int = 1 + shift: float = 0. + max_iterations: int = 1000 + + def __post_init__(self): + p = np.asarray(self.preload,dtype=float) + if p.ndim != 1 or not np.isfinite(p).all(): raise ValueError("finite dead nodal force vector required") + object.__setattr__(self,"preload",tuple(map(float,p))) + sources = tuple(self.section_tractions) + if any(type(s) is not B2SectionTractionQuadrature for s in sources): raise ValueError("typed physical traction sources required") + if len({s.member_id for s in sources}) != len(sources): raise ValueError("one source per member required") + object.__setattr__(self,"section_tractions",sources) + if type(self.count) is not int or self.count < 1: raise ValueError("positive buckling count required") + if not np.isfinite(self.shift) or self.shift < 0.: raise ValueError("finite nonnegative load-factor shift required") + if type(self.max_iterations) is not int or self.max_iterations < 1: raise ValueError("positive iteration bound required") + +@dataclass(frozen=True) +class B2ReferenceBucklingCapabilities: + eligible: bool + reasons: tuple = () + policy: str = POLICY + production_qualified: bool = False + scope: str = "zero-prescription Cartesian dead-force endpoint POINT Q4 / uniform-membrane S3" + remaining: tuple = ("general S3 bending/director second moment/shear", "Q4 shear prestress", "interior loaded ports", "weak lines", "footprints", "prescribed prestress", "dead-couple potential", "full F12/B14 qualification") + shell_kernel_policies: tuple = () + +@dataclass(frozen=True) +class B2ReferenceBucklingResult: + status: str + load_factors: tuple = () + modes: tuple = () + multiplier_modes: tuple = () + equation_residuals: tuple = () + constraint_residuals: tuple = () + preload_result: object = None + identity: str = "" + failure_reason: str | None = None + policy: str = POLICY + production_qualified: bool = False + +def beam_reference_derivatives(operator, station): + """Position/rotation derivatives of the objective geodesic-midframe trace. + + Return first derivatives and coordinate Hessians, plus reference-length + derivatives. Coordinates are the existing twelve additive physical slots. + """ + length = float(operator.length) + poly = operator._trace_polynomials + maps = np.array([[sum(float(c)*station**d for d,c in enumerate(p)) for p in row] for row in poly]) + slope = np.array([[sum(d*float(c)*station**(d-1)/length for d,c in enumerate(p) if d) for p in row] for row in poly]) + eye = np.eye(12) + omega = .5*(eye[3:6]+eye[9:12]).T + mean = .5*(eye[:3]+eye[6:9]).T + first = np.zeros((12,12)); second = np.zeros((12,12,12)) + for node, pos in ((0,np.array((-length/2,0.,0.))),(1,np.array((length/2,0.,0.)))): + base = 6*node + delta = eye[base:base+3].T-mean + theta = eye[base+3:base+6].T + first[base:base+3] = (delta-np.cross(omega,pos)).T + first[base+3:base+6] = (theta-omega).T + for a in range(12): + for b in range(12): + second[base:base+3,a,b] = (-np.cross(omega[a],delta[b])-np.cross(omega[b],delta[a]) + +.5*(np.cross(omega[a],np.cross(omega[b],pos))+np.cross(omega[b],np.cross(omega[a],pos)))) + second[base+3:base+6,a,b] = -.5*(np.cross(omega[a],theta[b])+np.cross(omega[b],theta[a])) + d = maps@first; ds = slope@first + h = np.einsum('ij,jab->iab',maps,second) + hs = np.einsum('ij,jab->iab',slope,second) + pos = np.array(((station-.5)*length,0.,0.)); axis=np.array((1.,0.,0.)) + for a in range(12): + for b in range(12): + h[:3,a,b] += .5*(np.cross(omega[a],np.cross(omega[b],pos))+np.cross(omega[b],np.cross(omega[a],pos)))+np.cross(omega[a],d[:3,b])+np.cross(omega[b],d[:3,a]) + hs[:3,a,b] += .5*(np.cross(omega[a],np.cross(omega[b],axis))+np.cross(omega[b],np.cross(omega[a],axis)))+np.cross(omega[a],ds[:3,b])+np.cross(omega[b],ds[:3,a]) + h[3:,a,b] += .5*(np.cross(omega[a],d[3:,b])+np.cross(omega[b],d[3:,a])) + hs[3:,a,b] += .5*(np.cross(omega[a],ds[3:,b])+np.cross(omega[b],ds[3:,a])) + actual = d.copy(); actual[:3] += mean.T+np.cross(omega,pos).T;actual[3:] += omega.T + actual_s = ds.copy();actual_s[:3] += np.cross(omega,axis).T + if not np.allclose(actual,maps,rtol=0.,atol=128*np.finfo(float).eps*max(1.,abs(maps).max())): + raise ValueError("objective beam continuation does not reproduce reference trace") + return maps,slope,h,hs + +def member_green_hessian(member, displacement, source): + """Full S11/S12/S13 Green sectional initial-stress work, tension sign.""" + operator=member.operator; length=float(operator.length) + nodes, weights=np.polynomial.legendre.leggauss(4) + stations=(nodes+1.)/2; result=operator.recover_sections(displacement,stations=stations).resultants + made=np.zeros((12,12)); virtual=np.zeros(12) + for s,w,resultants in zip(stations,weights,result): + j,js,h,hs=beam_reference_derivatives(operator,float(s)) + for yz,area,traction_map in zip(source.coordinates_yz_m,source.area_weights_m2,source.traction_map): + rho=np.r_[0.,yz]; stress=traction_map@resultants + xs=js[:3].T+np.cross(js[3:].T,rho) + dy=np.cross(j[3:].T,(0.,1.,0.)); dz=np.cross(j[3:].T,(0.,0.,1.)) + e11=xs[:,0]; g12=xs[:,1]+dy[:,0];g13=xs[:,2]+dz[:,0] + virtual += w*length/2*area*(stress[0]*e11+stress[1]*g12+stress[2]*g13) + for a in range(12): + for b in range(12): + xsh=hs[:3,a,b]+np.cross(hs[3:,a,b],rho)+.5*( + np.cross(js[3:,a],np.cross(j[3:,b],rho))+np.cross(j[3:,a],np.cross(js[3:,b],rho))+ + np.cross(js[3:,b],np.cross(j[3:,a],rho))+np.cross(j[3:,b],np.cross(js[3:,a],rho))) + dyh=np.cross(h[3:,a,b],(0.,1.,0.))+.5*(np.cross(j[3:,a],dy[b])+np.cross(j[3:,b],dy[a])) + dzh=np.cross(h[3:,a,b],(0.,0.,1.))+.5*(np.cross(j[3:,a],dz[b])+np.cross(j[3:,b],dz[a])) + v=(stress[0]*(xs[a]@xs[b]+xsh[0])+stress[1]*(xs[a]@dy[b]+xs[b]@dy[a]+xsh[1]+dyh[0])+ + stress[2]*(xs[a]@dz[b]+xs[b]@dz[a]+xsh[2]+dzh[0])) + made[a,b] += w*length/2*area*v + force=np.asarray(operator.evaluate(displacement).force) + force=force.copy();virtual=virtual.copy() + force.reshape(2,6)[:,3:]/=length;virtual.reshape(2,6)[:,3:]/=length + if not np.isfinite(force).all() or not np.isfinite(virtual).all(): + raise ValueError("normalized sectional virtual work not representable") + magnitude=max(float(np.max(abs(force))),float(np.max(abs(virtual)))) + # One common magnitude keeps all norms finite and introduces no unit floor. + f=force/magnitude if magnitude else force;v=virtual/magnitude if magnitude else virtual + denominator=np.linalg.norm(f)+np.linalg.norm(v) + if np.linalg.norm(f-v) > 1e-10*denominator: + raise ValueError("sectional first virtual work disagrees with physical force-flexibility trace") + return made + +def point_green_hessian(law, vertices, member, station, offset, multiplier): + from ._ge_beam3_pose_joint import RigidPoseJoint + width=law.shell_port.shape[1]; r=vertices-vertices.mean(axis=0) + gram=sum((_cross_matrix(x).T@_cross_matrix(x) for x in r),np.zeros((3,3))) + shell_h=np.zeros((6,width,width)); eye=np.eye(width) + omega=law.shell_port[3:].T + translations=np.stack([eye[6*i:6*i+3].T for i in range(len(r))]) + translations-=translations.mean(axis=0) + for a in range(width): + for b in range(width): + rhs=np.zeros(3) + for i,x in enumerate(r): + rhs += np.cross(np.cross(omega[a],x),translations[i,b])+np.cross(np.cross(omega[b],x),translations[i,a]) + rhs += np.cross(.5*(np.cross(omega[a],np.cross(omega[b],x))+np.cross(omega[b],np.cross(omega[a],x))),x) + shell_h[3:,a,b]=np.linalg.solve(gram,rhs) + j,_,h,_=beam_reference_derivatives(member.operator,float(station)) + d=np.asarray(offset,dtype=float); local_h=h.copy() + for a in range(12): + for b in range(12): + local_h[:3,a,b] += np.cross(h[3:,a,b],d)+.5*(np.cross(j[3:,a],np.cross(j[3:,b],d))+np.cross(j[3:,b],np.cross(j[3:,a],d))) + frame=member.definition.local_frame_rows().T; transform=member.local_dof_map() + beam_h=np.einsum('ij,jab,ak,bl->ikl',np.kron(np.eye(2),frame),local_h,transform,transform) + port=np.zeros((12,width+12));port[:6,:width]=law.shell_port;port[6:,width:]=law.beam_port + curvature=np.zeros((12,width+12,width+12));curvature[:6,:width,:width]=shell_h;curvature[6:,width:,width:]=beam_h + joint=RigidPoseJoint(np.stack((law.shell_reference_m,law.beam_reference_m)),law.reference_frames) + response=joint.evaluate(np.stack((law.shell_reference_m,law.beam_reference_m)),law.reference_frames,np.asarray(multiplier)) + return port.T@response.chart_hessian[:12,:12]@port+np.einsum('i,iab->ab',response.residual[:12],curvature) + +@dataclass(frozen=True) +class B2PhysicalFootprintBucklingRequest(B2ReferenceBucklingRequest): + """Opt-in five-row Q4 physical rigid-footprint spectral operation.""" + +@dataclass(frozen=True) +class B2PhysicalFootprintBucklingResult(B2ReferenceBucklingResult): + policy: str = "B2_PHYSICAL_RIGID_FOOTPRINT_GREEN_BUCKLING_V1_DEV" + +def physical_footprint_capabilities(owner): + from ._stiffened_shell_b2_physical_rigid_footprint import BUCKLING_POLICY + reasons=[] + if not getattr(owner,"_physical_footprint_law",False): reasons.append("physical footprint family required") + if owner._closed: reasons.append("owner closed") + if owner.point_ids: reasons.append("mixed POINT / physical footprint spectral operation unavailable") + if np.any(owner._u0 != 0.): reasons.append("prescribed prestress split unavailable") if any(len(shell.node_ids)!=4 for shell,*_ in owner._buckling_shells): reasons.append("S3/mixed physical footprint buckling unsupported; Q4 director chart required") - return B2ReferenceBucklingCapabilities(not reasons,tuple(reasons),policy=BUCKLING_POLICY, - scope="zero-prescription Cartesian dead-force Q4 endpoint complete physical rigid footprints",shell_kernel_policies=(Q4_KERNEL_POLICY+":NATIVE_PHYSICAL_EXP_DIRECTOR_FIRST_WORK_PULLBACK",)) - -def capabilities(owner): - reasons=[] - if owner._closed: reasons.append("owner closed") - if owner._modal_only: reasons.append("modal-only boundary") - if owner.footprints: reasons.append("footprint second variation unavailable") - if owner._point_trace_policy is not None: reasons.append("loaded point trace unavailable") - if np.any(owner._u0 != 0.): reasons.append("prescribed prestress split unavailable") - if any(point.station not in (0.,1.) for point,*_ in owner._buckling_points): reasons.append("interior loaded port unavailable") - kernels=tuple(sorted({S3_KERNEL_POLICY if len(shell.node_ids)==3 else Q4_KERNEL_POLICY for shell,*_ in owner._buckling_shells})) - return B2ReferenceBucklingCapabilities(not reasons,tuple(reasons),shell_kernel_policies=kernels) - -def _shell_resultants(owner, element, material, displacement, count): - mesh=owner._buckling_model.mesh - if count == 3: - recovered=element.compute_variational_resultants(mesh,displacement,material) - else: - recovered=element.compute_stresses(mesh,displacement,material) - return np.column_stack((recovered["membrane_resultants"],recovered["bending_resultants"],recovered["transverse_shear_resultants"])) - -def compile_geometric(owner, request, preload, safe_point=lambda stage: None): - """Assemble tensile-sign G; all constraint coordinates remain algebraic.""" - from ._stiffened_shell_b2_q4_panel_experimental import _scatter - displacement=np.asarray(preload.displacements); multipliers=dict(preload.point_multipliers) - sources={source.member_id:source for source in request.section_tractions} - rows=[];cols=[];values=[];provenance=[] - for member_id,(member,slots) in owner._members: - safe_point("buckling member initial stress") - transform=member.local_dof_map() - local=member_green_hessian(member,transform@displacement[slots],sources[member_id]) - _scatter(rows,cols,values,slots,transform.T@local@transform) - provenance.append((member_id,sources[member_id].identity)) - for shell,element,material_id,slots in owner._buckling_shells: - safe_point("buckling shell preload recovery") - material=owner._buckling_model.get_material(material_id) - count=len(shell.node_ids); local_u=displacement[slots] - recovered=_shell_resultants(owner,element,material,local_u,count) - if not np.isfinite(recovered).all(): raise ValueError("nonfinite shell preload recovery") - # Initially require exact zero forbidden resultants; no dimensional - # floors or specimen-adjusted arithmetic tolerance conceal prestress. - if np.any(recovered[:,6:] != 0.): raise ValueError("shell transverse-shear prestress unsupported") - if count == 3: - if np.any(recovered[:,3:6] != 0.): raise ValueError("S3 bending prestress unsupported") - if not np.array_equal(recovered[:,:3],np.broadcast_to(recovered[0,:3],recovered[:,:3].shape)): - raise ValueError("S3 nonuniform membrane preload unsupported") - state={"membrane_compression":-recovered[0,:3]} - kernel_policy=S3_KERNEL_POLICY - else: - from ._stiffened_shell_b2_physical_rigid_footprint import q4_kernel_frame_resultants - kernel_resultants=q4_kernel_frame_resultants(element,owner._buckling_model.mesh,material,local_u,recovered) - state={"membrane_compression_at_gauss":-kernel_resultants[:,:3], - "bending_compression_at_gauss":-kernel_resultants[:,3:6], - "stress_second_moment_at_gauss":-kernel_resultants[:,:3]*shell.thickness_m**2/12.} - kernel_policy=Q4_KERNEL_POLICY - # Existing shell KG uses compression positive; convert exactly once. - local=-element.compute_geometric_stiffness_matrix(owner._buckling_model.mesh,material,state) - if getattr(owner,"_physical_footprint_law",False): - from ._stiffened_shell_b2_physical_rigid_footprint import q4_exp_director_chart_correction - local=local+q4_exp_director_chart_correction(element,owner._buckling_model.mesh,material,local_u) - kernel_policy += ":NATIVE_PHYSICAL_EXP_DIRECTOR_FIRST_WORK_PULLBACK" - _scatter(rows,cols,values,slots,local) - provenance.append((shell.shell_id,kernel_policy,hashlib.sha256(recovered.tobytes()).hexdigest())) - for point,law,vertices,member,slots in owner._buckling_points: - safe_point("buckling point multiplier curvature") - local=point_green_hessian(law,vertices,member,point.station,point.offset_local_m,multipliers[point.point_id]) - _scatter(rows,cols,values,slots,local) - if getattr(owner,"_physical_footprint_law",False): - all_lambda=np.asarray(preload.constraint_multipliers) - for item in owner._footprint_incidence: - safe_point("buckling physical footprint multiplier curvature") - slots=tuple(item.shell_slots)+tuple(item.beam_slots) - local=item.multiplier_hessian(all_lambda[item.row_start:item.row_start+5]) - _scatter(rows,cols,values,slots,local) - provenance.append((item.footprint_id,item.shell_node,"physical_director_five_row",hashlib.sha256(item.constraint_hessians.tobytes()).hexdigest())) - g=sparse.coo_matrix((values,(rows,cols)),shape=owner._K.shape).tocsr() - if not np.isfinite(g.data).all(): raise ValueError("initial-stress assembly not representable") - digest=hashlib.sha256((POLICY+PORT_POLICY+repr(provenance)).encode()) - digest.update(owner._body_model_identity.encode()) - for matrix in (owner._K,owner._C,owner._T,g): - for a in (matrix.indptr,matrix.indices,matrix.data): digest.update(a.tobytes()) - digest.update(np.asarray(request.preload).tobytes()) - return g,digest.hexdigest() - -def solve(owner, request, *, cancellation=None): - from .control import CancellationToken,SolveCancelled - from .linalg import factorize_cached,MatrixClass - from ._stiffened_shell_b2_q4_panel_experimental import _scaled_point_kkt,_modal_scaled_residual - physical=type(request) is B2PhysicalFootprintBucklingRequest - if type(request) not in (B2ReferenceBucklingRequest,B2PhysicalFootprintBucklingRequest): raise ValueError("typed physical B2 reference-buckling request required") - result_type=B2PhysicalFootprintBucklingResult if physical else B2ReferenceBucklingResult - admission=physical_footprint_capabilities(owner) if physical else capabilities(owner) - if not admission.eligible: raise ValueError("; ".join(admission.reasons)) - load=np.asarray(request.preload) - if load.shape != owner._u0.shape or np.any(load.reshape(-1,6)[:,3:] != 0.): raise ValueError("Cartesian dead nodal forces only; rotational couples unsupported") - if {s.member_id for s in request.section_tractions} != {m for m,_ in owner._members}: raise ValueError("explicit physical traction source for every member required") - if cancellation is not None and not isinstance(cancellation,CancellationToken): raise ValueError("CancellationToken required") - n=owner._T.shape[1];q=owner._C.shape[0] - if request.count >= min(n-q,n+q-1): raise ValueError("buckling count exceeds supported sparse spectrum") - def safe(stage): - if cancellation is not None: cancellation.checkpoint(stage) - preload=None;identity="" - try: - safe("buckling before reference preload") - preload=owner.solve_linear(load) - safe("buckling after reference preload") - if preload.status != "completed": - return result_type("failed",preload_result=preload, - failure_reason="reference preload status "+str(preload.status)+": "+str(preload.failure_reason)) - g,identity=compile_geometric(owner,request,preload,safe) - k=(owner._T.T@owner._K@owner._T).tocsc(); c=(owner._C@owner._T).tocsc() - destabilizing=-(owner._T.T@g@owner._T).tocsc() - a=sparse.bmat(((k,c.T),(c,None)),format="csc") - b=sparse.block_diag((destabilizing,sparse.csc_matrix((q,q))),format="csc") - # Positive coordinate normalization belongs to reference K/C only. - # A valid shifted indefinite pencil must never face the static guard. - _,scale=_scaled_point_kkt(k,c) - b.eliminate_zeros();b.sort_indices() - scaling=sparse.diags(scale,format="csc");bs=(scaling@b@scaling).tocsc();bs.eliminate_zeros();bs.sort_indices() - if (not np.isfinite(bs.data).all() or b.nnz != bs.nnz or - not np.array_equal(b.indptr,bs.indptr) or not np.array_equal(b.indices,bs.indices) or - np.any((b.data != 0.) & (bs.data == 0.))): raise _BucklingNumericalFailure("buckling scaling loses nonzero entries") - raw_shifted=(a-request.shift*b).tocsc();raw_shifted.eliminate_zeros();raw_shifted.sort_indices() - shifted=(scaling@raw_shifted@scaling).tocsc();shifted.eliminate_zeros();shifted.sort_indices() - if (not np.isfinite(shifted.data).all() or shifted.nnz!=raw_shifted.nnz or - not np.array_equal(shifted.indptr,raw_shifted.indptr) or not np.array_equal(shifted.indices,raw_shifted.indices) or - np.any((raw_shifted.data!=0.)&(shifted.data==0.))): - raise _BucklingNumericalFailure("shifted buckling scaling loses nonzero entries") - safe("buckling before factorization") - handle=factorize_cached(shifted,MatrixClass.GENERAL) - if handle.status != "ok": raise _BucklingNumericalFailure("buckling factorization failed: "+str(handle.failure_reason)) - def action(v): - safe("buckling iteration") - try: - answer=np.asarray(handle.solve(bs@v)) - except RuntimeError as exc: - if (str(exc) == "Sparse solve produced NaN/Inf values" or - str(exc).startswith("Cannot solve with failed factorization:")): - raise _BucklingNumericalFailure("buckling sparse solve failed: "+str(exc)) from exc - raise - if not np.isfinite(answer).all(): raise _BucklingNumericalFailure("nonfinite buckling inverse action") - return answer - eigvalues,vectors=eigs(LinearOperator(a.shape,matvec=action,dtype=float),k=request.count,which="LM",v0=np.sin(np.arange(a.shape[0])+.23),tol=1e-11,maxiter=request.max_iterations) - modes=[] - for mu,y in zip(eigvalues,vectors.T): - if not np.isfinite(mu) or abs(mu.imag)>1e-9*abs(mu.real) or mu.real == 0. or np.linalg.norm(y.imag)>1e-9*np.linalg.norm(y.real): raise _BucklingNumericalFailure("unresolved buckling pair") - lam=request.shift+1./mu.real - if not np.isfinite(lam) or lam <= 0.: raise _BucklingNumericalFailure("requested shift selected nonpositive buckling factor") - x=scale*y.real;physical=np.asarray(owner._T@x[:n]);norm=np.linalg.norm(physical) - if not np.isfinite(norm) or norm == 0.: raise _BucklingNumericalFailure("invalid physical buckling mode") - x/=norm;physical/=norm - residual=a@x-lam*(b@x);bound=abs(a)@abs(x)+abs(lam)*(abs(b)@abs(x)) - equation=_modal_scaled_residual(residual,bound,scale) - constraint=_modal_scaled_residual(owner._C@physical,abs(owner._C)@abs(physical),scale[n:]) - balance=owner._K@physical+owner._C.T@x[n:]+lam*(g@physical) - physical_bound=abs(owner._K)@abs(physical)+abs(owner._C.T)@abs(x[n:])+abs(lam)*(abs(g)@abs(physical)) - equation=max(equation,_modal_scaled_residual(owner._project(balance),abs(owner._T.T)@physical_bound,scale[:n])) - if equation>1e-8 or constraint>1e-9: raise _BucklingNumericalFailure("buckling physical equation or constraint residual failed") - modes.append((float(lam),tuple(physical),tuple(x[n:]),equation,constraint)) - modes.sort(key=lambda item:item[0]);safe("buckling before publication") - return result_type("ok",*(tuple(m[i] for m in modes) for i in range(5)),preload,identity) - except SolveCancelled as exc: - return result_type("cancelled",preload_result=preload,identity=identity,failure_reason=str(exc)) - except (ArpackError,_BucklingNumericalFailure) as exc: - return result_type("failed",preload_result=preload,identity=identity,failure_reason=str(exc)) + return B2ReferenceBucklingCapabilities(not reasons,tuple(reasons),policy=BUCKLING_POLICY, + scope="zero-prescription Cartesian dead-force Q4 endpoint complete physical rigid footprints",shell_kernel_policies=(Q4_KERNEL_POLICY+":NATIVE_PHYSICAL_EXP_DIRECTOR_FIRST_WORK_PULLBACK",)) + +def capabilities(owner): + reasons=[] + if owner._closed: reasons.append("owner closed") + if owner._modal_only: reasons.append("modal-only boundary") + if owner.footprints: reasons.append("footprint second variation unavailable") + if owner._point_trace_policy is not None: reasons.append("loaded point trace unavailable") + if np.any(owner._u0 != 0.): reasons.append("prescribed prestress split unavailable") + if any(point.station not in (0.,1.) for point,*_ in owner._buckling_points): reasons.append("interior loaded port unavailable") + kernels=tuple(sorted({S3_KERNEL_POLICY if len(shell.node_ids)==3 else Q4_KERNEL_POLICY for shell,*_ in owner._buckling_shells})) + return B2ReferenceBucklingCapabilities(not reasons,tuple(reasons),shell_kernel_policies=kernels) + +def _shell_resultants(owner, element, material, displacement, count): + mesh=owner._buckling_model.mesh + if count == 3: + recovered=element.compute_variational_resultants(mesh,displacement,material) + else: + recovered=element.compute_stresses(mesh,displacement,material) + return np.column_stack((recovered["membrane_resultants"],recovered["bending_resultants"],recovered["transverse_shear_resultants"])) + +def compile_geometric(owner, request, preload, safe_point=lambda stage: None): + """Assemble tensile-sign G; all constraint coordinates remain algebraic.""" + from ._stiffened_shell_b2_q4_panel_experimental import _scatter + displacement=np.asarray(preload.displacements); multipliers=dict(preload.point_multipliers) + sources={source.member_id:source for source in request.section_tractions} + rows=[];cols=[];values=[];provenance=[] + for member_id,(member,slots) in owner._members: + safe_point("buckling member initial stress") + transform=member.local_dof_map() + local=member_green_hessian(member,transform@displacement[slots],sources[member_id]) + _scatter(rows,cols,values,slots,transform.T@local@transform) + provenance.append((member_id,sources[member_id].identity)) + for shell,element,material_id,slots in owner._buckling_shells: + safe_point("buckling shell preload recovery") + material=owner._buckling_model.get_material(material_id) + count=len(shell.node_ids); local_u=displacement[slots] + recovered=_shell_resultants(owner,element,material,local_u,count) + if not np.isfinite(recovered).all(): raise ValueError("nonfinite shell preload recovery") + # Initially require exact zero forbidden resultants; no dimensional + # floors or specimen-adjusted arithmetic tolerance conceal prestress. + if np.any(recovered[:,6:] != 0.): raise ValueError("shell transverse-shear prestress unsupported") + if count == 3: + if np.any(recovered[:,3:6] != 0.): raise ValueError("S3 bending prestress unsupported") + if not np.array_equal(recovered[:,:3],np.broadcast_to(recovered[0,:3],recovered[:,:3].shape)): + raise ValueError("S3 nonuniform membrane preload unsupported") + state={"membrane_compression":-recovered[0,:3]} + kernel_policy=S3_KERNEL_POLICY + else: + from ._stiffened_shell_b2_physical_rigid_footprint import q4_kernel_frame_resultants + kernel_resultants=q4_kernel_frame_resultants(element,owner._buckling_model.mesh,material,local_u,recovered) + state={"membrane_compression_at_gauss":-kernel_resultants[:,:3], + "bending_compression_at_gauss":-kernel_resultants[:,3:6], + "stress_second_moment_at_gauss":-kernel_resultants[:,:3]*shell.thickness_m**2/12.} + kernel_policy=Q4_KERNEL_POLICY + # Existing shell KG uses compression positive; convert exactly once. + local=-element.compute_geometric_stiffness_matrix(owner._buckling_model.mesh,material,state) + if getattr(owner,"_physical_footprint_law",False): + from ._stiffened_shell_b2_physical_rigid_footprint import q4_exp_director_chart_correction + local=local+q4_exp_director_chart_correction(element,owner._buckling_model.mesh,material,local_u) + kernel_policy += ":NATIVE_PHYSICAL_EXP_DIRECTOR_FIRST_WORK_PULLBACK" + _scatter(rows,cols,values,slots,local) + provenance.append((shell.shell_id,kernel_policy,hashlib.sha256(recovered.tobytes()).hexdigest())) + for point,law,vertices,member,slots in owner._buckling_points: + safe_point("buckling point multiplier curvature") + local=point_green_hessian(law,vertices,member,point.station,point.offset_local_m,multipliers[point.point_id]) + _scatter(rows,cols,values,slots,local) + if getattr(owner,"_physical_footprint_law",False): + all_lambda=np.asarray(preload.constraint_multipliers) + for item in owner._footprint_incidence: + safe_point("buckling physical footprint multiplier curvature") + slots=tuple(item.shell_slots)+tuple(item.beam_slots) + local=item.multiplier_hessian(all_lambda[item.row_start:item.row_start+5]) + _scatter(rows,cols,values,slots,local) + provenance.append((item.footprint_id,item.shell_node,"physical_director_five_row",hashlib.sha256(item.constraint_hessians.tobytes()).hexdigest())) + g=sparse.coo_matrix((values,(rows,cols)),shape=owner._K.shape).tocsr() + if not np.isfinite(g.data).all(): raise ValueError("initial-stress assembly not representable") + digest=hashlib.sha256((POLICY+PORT_POLICY+repr(provenance)).encode()) + digest.update(owner._body_model_identity.encode()) + for matrix in (owner._K,owner._C,owner._T,g): + for a in (matrix.indptr,matrix.indices,matrix.data): digest.update(a.tobytes()) + digest.update(np.asarray(request.preload).tobytes()) + return g,digest.hexdigest() + +def solve(owner, request, *, cancellation=None): + from .control import CancellationToken,SolveCancelled + from .linalg import factorize_cached,MatrixClass + from ._stiffened_shell_b2_q4_panel_experimental import _scaled_point_kkt,_modal_scaled_residual + physical=type(request) is B2PhysicalFootprintBucklingRequest + if type(request) not in (B2ReferenceBucklingRequest,B2PhysicalFootprintBucklingRequest): raise ValueError("typed physical B2 reference-buckling request required") + result_type=B2PhysicalFootprintBucklingResult if physical else B2ReferenceBucklingResult + admission=physical_footprint_capabilities(owner) if physical else capabilities(owner) + if not admission.eligible: raise ValueError("; ".join(admission.reasons)) + load=np.asarray(request.preload) + if load.shape != owner._u0.shape or np.any(load.reshape(-1,6)[:,3:] != 0.): raise ValueError("Cartesian dead nodal forces only; rotational couples unsupported") + if {s.member_id for s in request.section_tractions} != {m for m,_ in owner._members}: raise ValueError("explicit physical traction source for every member required") + if cancellation is not None and not isinstance(cancellation,CancellationToken): raise ValueError("CancellationToken required") + n=owner._T.shape[1];q=owner._C.shape[0] + if request.count >= min(n-q,n+q-1): raise ValueError("buckling count exceeds supported sparse spectrum") + def safe(stage): + if cancellation is not None: cancellation.checkpoint(stage) + preload=None;identity="" + try: + safe("buckling before reference preload") + preload=owner.solve_linear(load) + safe("buckling after reference preload") + if preload.status != "completed": + return result_type("failed",preload_result=preload, + failure_reason="reference preload status "+str(preload.status)+": "+str(preload.failure_reason)) + g,identity=compile_geometric(owner,request,preload,safe) + k=(owner._T.T@owner._K@owner._T).tocsc(); c=(owner._C@owner._T).tocsc() + destabilizing=-(owner._T.T@g@owner._T).tocsc() + a=sparse.bmat(((k,c.T),(c,None)),format="csc") + b=sparse.block_diag((destabilizing,sparse.csc_matrix((q,q))),format="csc") + # Positive coordinate normalization belongs to reference K/C only. + # A valid shifted indefinite pencil must never face the static guard. + _,scale=_scaled_point_kkt(k,c) + b.eliminate_zeros();b.sort_indices() + scaling=sparse.diags(scale,format="csc");bs=(scaling@b@scaling).tocsc();bs.eliminate_zeros();bs.sort_indices() + if (not np.isfinite(bs.data).all() or b.nnz != bs.nnz or + not np.array_equal(b.indptr,bs.indptr) or not np.array_equal(b.indices,bs.indices) or + np.any((b.data != 0.) & (bs.data == 0.))): raise _BucklingNumericalFailure("buckling scaling loses nonzero entries") + raw_shifted=(a-request.shift*b).tocsc();raw_shifted.eliminate_zeros();raw_shifted.sort_indices() + shifted=(scaling@raw_shifted@scaling).tocsc();shifted.eliminate_zeros();shifted.sort_indices() + if (not np.isfinite(shifted.data).all() or shifted.nnz!=raw_shifted.nnz or + not np.array_equal(shifted.indptr,raw_shifted.indptr) or not np.array_equal(shifted.indices,raw_shifted.indices) or + np.any((raw_shifted.data!=0.)&(shifted.data==0.))): + raise _BucklingNumericalFailure("shifted buckling scaling loses nonzero entries") + safe("buckling before factorization") + handle=factorize_cached(shifted,MatrixClass.GENERAL) + if handle.status != "ok": raise _BucklingNumericalFailure("buckling factorization failed: "+str(handle.failure_reason)) + def action(v): + safe("buckling iteration") + try: + answer=np.asarray(handle.solve(bs@v)) + except RuntimeError as exc: + if (str(exc) == "Sparse solve produced NaN/Inf values" or + str(exc).startswith("Cannot solve with failed factorization:")): + raise _BucklingNumericalFailure("buckling sparse solve failed: "+str(exc)) from exc + raise + if not np.isfinite(answer).all(): raise _BucklingNumericalFailure("nonfinite buckling inverse action") + return answer + eigvalues,vectors=eigs(LinearOperator(a.shape,matvec=action,dtype=float),k=request.count,which="LM",v0=np.sin(np.arange(a.shape[0])+.23),tol=1e-11,maxiter=request.max_iterations) + modes=[] + for mu,y in zip(eigvalues,vectors.T): + if not np.isfinite(mu) or abs(mu.imag)>1e-9*abs(mu.real) or mu.real == 0. or np.linalg.norm(y.imag)>1e-9*np.linalg.norm(y.real): raise _BucklingNumericalFailure("unresolved buckling pair") + lam=request.shift+1./mu.real + if not np.isfinite(lam) or lam <= 0.: raise _BucklingNumericalFailure("requested shift selected nonpositive buckling factor") + x=scale*y.real;physical=np.asarray(owner._T@x[:n]);norm=np.linalg.norm(physical) + if not np.isfinite(norm) or norm == 0.: raise _BucklingNumericalFailure("invalid physical buckling mode") + x/=norm;physical/=norm + residual=a@x-lam*(b@x);bound=abs(a)@abs(x)+abs(lam)*(abs(b)@abs(x)) + equation=_modal_scaled_residual(residual,bound,scale) + constraint=_modal_scaled_residual(owner._C@physical,abs(owner._C)@abs(physical),scale[n:]) + balance=owner._K@physical+owner._C.T@x[n:]+lam*(g@physical) + physical_bound=abs(owner._K)@abs(physical)+abs(owner._C.T)@abs(x[n:])+abs(lam)*(abs(g)@abs(physical)) + equation=max(equation,_modal_scaled_residual(owner._project(balance),abs(owner._T.T)@physical_bound,scale[:n])) + if equation>1e-8 or constraint>1e-9: raise _BucklingNumericalFailure("buckling physical equation or constraint residual failed") + modes.append((float(lam),tuple(physical),tuple(x[n:]),equation,constraint)) + modes.sort(key=lambda item:item[0]);safe("buckling before publication") + return result_type("ok",*(tuple(m[i] for m in modes) for i in range(5)),preload,identity) + except SolveCancelled as exc: + return result_type("cancelled",preload_result=preload,identity=identity,failure_reason=str(exc)) + except (ArpackError,_BucklingNumericalFailure) as exc: + return result_type("failed",preload_result=preload,identity=identity,failure_reason=str(exc)) diff --git a/src/anysolver/_stiffened_shell_b3_chart.py b/src/anyfesolver/_stiffened_shell_b3_chart.py similarity index 100% rename from src/anysolver/_stiffened_shell_b3_chart.py rename to src/anyfesolver/_stiffened_shell_b3_chart.py diff --git a/src/anysolver/_stiffened_shell_b3_local_adapter.py b/src/anyfesolver/_stiffened_shell_b3_local_adapter.py similarity index 100% rename from src/anysolver/_stiffened_shell_b3_local_adapter.py rename to src/anyfesolver/_stiffened_shell_b3_local_adapter.py diff --git a/src/anysolver/_stiffened_shell_beam_history.py b/src/anyfesolver/_stiffened_shell_beam_history.py similarity index 98% rename from src/anysolver/_stiffened_shell_beam_history.py rename to src/anyfesolver/_stiffened_shell_beam_history.py index 122044a5d..a8df57bf5 100644 --- a/src/anysolver/_stiffened_shell_beam_history.py +++ b/src/anyfesolver/_stiffened_shell_beam_history.py @@ -1,20 +1,20 @@ -"""Model-bound native beam histories for the experimental mixed owner. - -Offsets and identities come only from compiled beam cells. Both halves of -every compensated history value are preserved; no constitutive update occurs -while packing or reconstructing a history. -""" -from decimal import localcontext - -import numpy as np - -from ._ge_beam3_fibre_cell import CellHistory -from ._ge_beam3_fibre_section import FibreHistory, PhysicalFibreSection -from ._ge_beam3_generalized_cell import GeneralizedCellHistory +"""Model-bound native beam histories for the experimental mixed owner. + +Offsets and identities come only from compiled beam cells. Both halves of +every compensated history value are preserved; no constitutive update occurs +while packing or reconstructing a history. +""" +from decimal import localcontext + +import numpy as np + +from ._ge_beam3_fibre_cell import CellHistory +from ._ge_beam3_fibre_section import FibreHistory, PhysicalFibreSection +from ._ge_beam3_generalized_cell import GeneralizedCellHistory from ._ge_beam3_generalized_ellipsoid_section import GeneralizedHistory, EllipsoidalGeneralizedSection -def compensated_kind(parts, *, coupled=False): +def compensated_kind(parts, *, coupled=False): """Exact compiled member families; the owner identity binds their order/laws.""" from ._stiffened_shell_f06_increment_arithmetic import POLICY families = [] @@ -30,78 +30,78 @@ def compensated_kind(parts, *, coupled=False): if not families: raise ValueError('complete compensated native member inventory required') family = families[0] if len(set(families)) == 1 else 'mixed' - return 'finite_compensated_'+family+('_coupled' if coupled else '_material') - - -def shapes(parts, prefix): - generalized = sum(len(e.operator.cell.stations) for e, _, _ in parts - if type(e.section) is not PhysicalFibreSection) - fibres = sum(len(e.operator.cell.stations)*len(e.section.fibres) - for e, _, _ in parts if type(e.section) is PhysicalFibreSection) - return ((prefix+"_plastic", (generalized, 6, 2)), - (prefix+"_accumulated", (generalized, 2)), - (prefix+"_fibres", (fibres, 4))) - - -def arrays(parts, histories, prefix): - if type(histories) is not tuple or len(histories) != len(parts): - raise ValueError("complete native beam histories required") - result = {name: np.empty(shape) for name, shape in shapes(parts, prefix)} - gi = fi = 0 - with localcontext() as context: - context.prec = 80 - for (element, _, _), history in zip(parts, histories): - element.operator.cell._origins(history) - for station in history.stations: - if type(element.section) is PhysicalFibreSection: - count = len(element.section.fibres) - result[prefix+"_fibres"][fi:fi+count] = station.rows - fi += count - else: - result[prefix+"_plastic"][gi] = station.plastic - result[prefix+"_accumulated"][gi] = station.accumulated - gi += 1 - return tuple(result.items()) - - -def histories(parts, values, prefix): - captured = {} - for name, shape in shapes(parts, prefix): - value = np.array(values[name], dtype=float, copy=True) - if value.shape != shape or not np.isfinite(value).all(): - raise ValueError("complete finite model-bound native history required") - captured[name] = value - gi = fi = 0 - result = [] - with localcontext() as context: - context.prec = 80 - for element, _, _ in parts: - cell = element.operator.cell - stations = [] - physical = type(element.section) is PhysicalFibreSection - for _ in cell.stations: - if physical: - count = len(element.section.fibres) - rows = tuple(tuple(map(float, row)) for row in - captured[prefix+"_fibres"][fi:fi+count]) - stations.append(FibreHistory(element.section.identity, rows)) - fi += count - else: - stations.append(GeneralizedHistory(element.section.identity, - tuple(tuple(map(float, row)) for row in - captured[prefix+"_plastic"][gi]), - tuple(map(float, captured[prefix+"_accumulated"][gi])))) - gi += 1 - history = (CellHistory if physical else GeneralizedCellHistory)( - cell.identity, tuple(stations)) - cell._origins(history) - result.append(history) - return tuple(result) - - -def observables(histories): - """Generalized accumulated strain, or maximum fibre accumulation per station.""" - return tuple(tuple( - max((float(row[2]+row[3]) for row in station.rows), default=0.) - if type(station) is FibreHistory else float(sum(station.accumulated)) - for station in history.stations) for history in histories) + return 'finite_compensated_'+family+('_coupled' if coupled else '_material') + + +def shapes(parts, prefix): + generalized = sum(len(e.operator.cell.stations) for e, _, _ in parts + if type(e.section) is not PhysicalFibreSection) + fibres = sum(len(e.operator.cell.stations)*len(e.section.fibres) + for e, _, _ in parts if type(e.section) is PhysicalFibreSection) + return ((prefix+"_plastic", (generalized, 6, 2)), + (prefix+"_accumulated", (generalized, 2)), + (prefix+"_fibres", (fibres, 4))) + + +def arrays(parts, histories, prefix): + if type(histories) is not tuple or len(histories) != len(parts): + raise ValueError("complete native beam histories required") + result = {name: np.empty(shape) for name, shape in shapes(parts, prefix)} + gi = fi = 0 + with localcontext() as context: + context.prec = 80 + for (element, _, _), history in zip(parts, histories): + element.operator.cell._origins(history) + for station in history.stations: + if type(element.section) is PhysicalFibreSection: + count = len(element.section.fibres) + result[prefix+"_fibres"][fi:fi+count] = station.rows + fi += count + else: + result[prefix+"_plastic"][gi] = station.plastic + result[prefix+"_accumulated"][gi] = station.accumulated + gi += 1 + return tuple(result.items()) + + +def histories(parts, values, prefix): + captured = {} + for name, shape in shapes(parts, prefix): + value = np.array(values[name], dtype=float, copy=True) + if value.shape != shape or not np.isfinite(value).all(): + raise ValueError("complete finite model-bound native history required") + captured[name] = value + gi = fi = 0 + result = [] + with localcontext() as context: + context.prec = 80 + for element, _, _ in parts: + cell = element.operator.cell + stations = [] + physical = type(element.section) is PhysicalFibreSection + for _ in cell.stations: + if physical: + count = len(element.section.fibres) + rows = tuple(tuple(map(float, row)) for row in + captured[prefix+"_fibres"][fi:fi+count]) + stations.append(FibreHistory(element.section.identity, rows)) + fi += count + else: + stations.append(GeneralizedHistory(element.section.identity, + tuple(tuple(map(float, row)) for row in + captured[prefix+"_plastic"][gi]), + tuple(map(float, captured[prefix+"_accumulated"][gi])))) + gi += 1 + history = (CellHistory if physical else GeneralizedCellHistory)( + cell.identity, tuple(stations)) + cell._origins(history) + result.append(history) + return tuple(result) + + +def observables(histories): + """Generalized accumulated strain, or maximum fibre accumulation per station.""" + return tuple(tuple( + max((float(row[2]+row[3]) for row in station.rows), default=0.) + if type(station) is FibreHistory else float(sum(station.accumulated)) + for station in history.stations) for history in histories) diff --git a/src/anysolver/_stiffened_shell_bl5_local_experimental.py b/src/anyfesolver/_stiffened_shell_bl5_local_experimental.py similarity index 100% rename from src/anysolver/_stiffened_shell_bl5_local_experimental.py rename to src/anyfesolver/_stiffened_shell_bl5_local_experimental.py diff --git a/src/anysolver/_stiffened_shell_bl5_native_elastic.py b/src/anyfesolver/_stiffened_shell_bl5_native_elastic.py similarity index 100% rename from src/anysolver/_stiffened_shell_bl5_native_elastic.py rename to src/anyfesolver/_stiffened_shell_bl5_native_elastic.py diff --git a/src/anysolver/_stiffened_shell_branch_event_trial.py b/src/anyfesolver/_stiffened_shell_branch_event_trial.py similarity index 100% rename from src/anysolver/_stiffened_shell_branch_event_trial.py rename to src/anyfesolver/_stiffened_shell_branch_event_trial.py diff --git a/src/anysolver/_stiffened_shell_consumer_capabilities.py b/src/anyfesolver/_stiffened_shell_consumer_capabilities.py similarity index 100% rename from src/anysolver/_stiffened_shell_consumer_capabilities.py rename to src/anyfesolver/_stiffened_shell_consumer_capabilities.py diff --git a/src/anysolver/_stiffened_shell_coordinate_support.py b/src/anyfesolver/_stiffened_shell_coordinate_support.py similarity index 100% rename from src/anysolver/_stiffened_shell_coordinate_support.py rename to src/anyfesolver/_stiffened_shell_coordinate_support.py diff --git a/src/anysolver/_stiffened_shell_displacement_adaptive.py b/src/anyfesolver/_stiffened_shell_displacement_adaptive.py similarity index 100% rename from src/anysolver/_stiffened_shell_displacement_adaptive.py rename to src/anyfesolver/_stiffened_shell_displacement_adaptive.py diff --git a/src/anysolver/_stiffened_shell_displacement_checkpoint.py b/src/anyfesolver/_stiffened_shell_displacement_checkpoint.py similarity index 100% rename from src/anysolver/_stiffened_shell_displacement_checkpoint.py rename to src/anyfesolver/_stiffened_shell_displacement_checkpoint.py diff --git a/src/anysolver/_stiffened_shell_displacement_control.py b/src/anyfesolver/_stiffened_shell_displacement_control.py similarity index 100% rename from src/anysolver/_stiffened_shell_displacement_control.py rename to src/anyfesolver/_stiffened_shell_displacement_control.py diff --git a/src/anysolver/_stiffened_shell_displacement_corrector.py b/src/anyfesolver/_stiffened_shell_displacement_corrector.py similarity index 100% rename from src/anysolver/_stiffened_shell_displacement_corrector.py rename to src/anyfesolver/_stiffened_shell_displacement_corrector.py diff --git a/src/anysolver/_stiffened_shell_displacement_increment.py b/src/anyfesolver/_stiffened_shell_displacement_increment.py similarity index 100% rename from src/anysolver/_stiffened_shell_displacement_increment.py rename to src/anyfesolver/_stiffened_shell_displacement_increment.py diff --git a/src/anysolver/_stiffened_shell_distributing_footprint.py b/src/anyfesolver/_stiffened_shell_distributing_footprint.py similarity index 100% rename from src/anysolver/_stiffened_shell_distributing_footprint.py rename to src/anyfesolver/_stiffened_shell_distributing_footprint.py diff --git a/src/anysolver/_stiffened_shell_distributing_pose.py b/src/anyfesolver/_stiffened_shell_distributing_pose.py similarity index 100% rename from src/anysolver/_stiffened_shell_distributing_pose.py rename to src/anyfesolver/_stiffened_shell_distributing_pose.py diff --git a/src/anysolver/_stiffened_shell_f06_increment_arithmetic.py b/src/anyfesolver/_stiffened_shell_f06_increment_arithmetic.py similarity index 98% rename from src/anysolver/_stiffened_shell_f06_increment_arithmetic.py rename to src/anyfesolver/_stiffened_shell_f06_increment_arithmetic.py index 7e3f7b757..bbba9aff5 100644 --- a/src/anysolver/_stiffened_shell_f06_increment_arithmetic.py +++ b/src/anyfesolver/_stiffened_shell_f06_increment_arithmetic.py @@ -1,205 +1,205 @@ -"""Opt-in binary64 expansion arithmetic for durable native state and work. - -Two components retain roundoff information; no decimal/extended-precision -backend, projection, altered mechanical equation or empirical stabilization. -""" -import math -import numpy as np -POLICY='GE_BEAM3_DURABLE_COMPENSATED_NATIVE_STATE_V1_DEV' -MAGIC=b'ANYF06DD1\0' - - -def two_sum(a,b): - h=a+b;v=h-a - return h,(a-(h-v))+(b-v) - -def two_product(a,b): - h=a*b;split=134217729. - ca=split*a;cb=split*b - ah=ca-(ca-a);al=a-ah;bh=cb-(cb-b);bl=b-bh - return h,((ah*bh-h)+ah*bl+al*bh)+al*bl - -class Pair: - __array_priority__=1000 - def __init__(self,high,low=0.): - self.high,self.low=two_sum(np.asarray(high,dtype=float),np.asarray(low,dtype=float)) - if not np.isfinite(self.high).all() or not np.isfinite(self.low).all(): - raise ValueError('finite representable compensated native values required') - @staticmethod - def make(value):return value if isinstance(value,Pair) else Pair(value) - def __add__(self,other): - b=self.make(other);h,l=two_sum(self.high,b.high) - return Pair(h,l+self.low+b.low) - __radd__=__add__ - def __neg__(self):return Pair(-self.high,-self.low) - def __sub__(self,other):return self+-self.make(other) - def __rsub__(self,other):return self.make(other)+-self - def __mul__(self,other): - b=self.make(other);h,l=two_product(self.high,b.high) - return Pair(h,l+self.high*b.low+self.low*b.high+self.low*b.low) - __rmul__=__mul__ - def reciprocal(self): - if np.any(self.high==0.):raise ValueError('singular compensated native reciprocal') - q=Pair(1./self.high) - return q+(1.-self*q)*(1./self.high) - def __truediv__(self,other):return self*self.make(other).reciprocal() - def __rtruediv__(self,other):return self.make(other)*self.reciprocal() - def __getitem__(self,index):return Pair(self.high[index],self.low[index]) - @property - def T(self):return Pair(self.high.T,self.low.T) - def rounded(self):return self.high+self.low - def scalar(self):return float(self.high)+float(self.low) - -def outer(a,b):return Pair(a.high[:,None],a.low[:,None])*Pair(b.high[None,:],b.low[None,:]) - -class Jet: - def __init__(self,value,gradient,hessian): - self.value=Pair.make(value);self.gradient=Pair.make(gradient);self.hessian=Pair.make(hessian) - @classmethod - def constant(cls,value,size):return cls(value,Pair(np.zeros(size)),Pair(np.zeros((size,size)))) - @classmethod - def variable(cls,value,index,size): - g=np.zeros(size);g[index]=1. - return cls(value,Pair(g),Pair(np.zeros((size,size)))) - def make(self,value):return value if isinstance(value,Jet) else Jet.constant(value,self.gradient.high.size) - def __add__(self,other): - b=self.make(other);return Jet(self.value+b.value,self.gradient+b.gradient,self.hessian+b.hessian) - __radd__=__add__ - def __neg__(self):return Jet(-self.value,-self.gradient,-self.hessian) - def __sub__(self,other):return self+-self.make(other) - def __rsub__(self,other):return self.make(other)+-self - def __mul__(self,other): - b=self.make(other) - return Jet(self.value*b.value,self.gradient*b.value+self.value*b.gradient, - self.hessian*b.value+self.value*b.hessian+outer(self.gradient,b.gradient)+outer(b.gradient,self.gradient)) - __rmul__=__mul__ - def __truediv__(self,other): - if isinstance(other,Jet): - r=other.value.reciprocal();return self*unary(other,r,-r*r,2*r*r*r) - return self*Pair.make(other).reciprocal() - -def unary(j,v,d,dd):return Jet(v,j.gradient*d,j.hessian*d+outer(j.gradient,j.gradient)*dd) -def transpose(a):return [list(row) for row in zip(*a)] -def mm(a,b):return [[sum(x*y for x,y in zip(row,col)) for col in zip(*b)] for row in a] -def mv(a,b):return [sum(x*y for x,y in zip(row,b)) for row in a] -def const(a,low,size): - return [[Jet.constant(Pair(a[i,j],low[i,j]),size) for j in range(3)] for i in range(3)] -def exp(w): - n=w[0].gradient.high.size;z=Jet.constant(0.,n);t=sum((v*v for v in w),z) - if math.sqrt(max(0.,t.value.scalar()))>=.9*math.pi:raise ValueError('native increment requires cutback') - # Entire-function Rodrigues coefficients, evaluated from their defining - # series. 32 terms cover the unchanged native chart radius. - a=Jet.constant(1.,n);b=Jet.constant(.5,n);ta=a;tb=b - stop=2 if t.value.scalar()==0. and not np.any(t.gradient.high) and not np.any(t.gradient.low) else 33 - for k in range(1,stop): - ta=-ta*t/((2*k)*(2*k+1));tb=-tb*t/((2*k+1)*(2*k+2));a=a+ta;b=b+tb - S=[[z,-w[2],w[1]],[w[2],z,-w[0]],[-w[1],w[0],z]];SS=mm(S,S) - return [[Jet.constant(float(i==j),n)+a*S[i][j]+b*SS[i][j] for j in range(3)] for i in range(3)] -def greater_scalar(value,bound): - """Compare authoritative normalized scalar parts without rounding the low.""" - return bool(value.high>bound or (value.high==bound and value.low>0.)) - -def pair_sqrt(value): - value=Pair.make(value) - if not greater_scalar(value,0.):raise ValueError('positive compensated square root required') - root=Pair(float(np.sqrt(value.high))) - for _ in range(2):root=root+(value-root*root)/(2.*root) - return root - -def pair_sin_cos(value): - """Bounded principal-angle entire series in binary64 expansions.""" - value=Pair.make(value);t=value*value - sine=value;cosine=Pair(1.);a=value;b=Pair(1.) - for k in range(1,33): - a=-a*t/((2*k)*(2*k+1));b=-b*t/((2*k-1)*(2*k)) - sine=sine+a;cosine=cosine+b - return sine,cosine - -def full_log_coefficients(cosine): - """Same principal acos(c)/sqrt(1-c*c) and its first two derivatives. - - Acos is seeded at the high component, then corrected using the defining - cosine equation in the same binary64 expansion arithmetic. The recurrences - (1-c*c) f' = c*f-1 and (1-c*c) f'' = f+3*c*f' avoid introducing a new law. - """ - from ._ge_beam3_mixed_ad import RotationDomainError,math_cos_limit - c=Pair.make(cosine) - if not greater_scalar(c,math_cos_limit()) or greater_scalar(c,1.) or (c.high==1. and c.low==0.): - raise RotationDomainError('relative rotation must remain below 0.9*pi; refine or cut back') - t=1.-c*c;sine=pair_sqrt(t);angle=Pair(float(np.arccos(c.high))) - for _ in range(2): - sn,cs=pair_sin_cos(angle);angle=angle+(cs-c)/sn - value=angle/sine;first=(c*value-1.)/t;second=(value+3.*c*first)/t - return value,first,second - -def log(a): - n=a[0][0].gradient.high.size;c=(a[0][0]+a[1][1]+a[2][2]-1.)/2. - if greater_scalar(c.value,1.-1e-7): - d=1.-c;f=1.+d/3.+2.*d*d/15.+2.*d*d*d/35. - else: - f=unary(c,*full_log_coefficients(c.value)) - return [f*(a[2][1]-a[1][2])/2.,f*(a[0][2]-a[2][0])/2.,f*(a[1][0]-a[0][1])/2.] - -def updated_rotation(high,low,angle): - w=[Jet.constant(float(v),1) for v in angle];e=exp(w);made=mm(e,const(high,low,1)) - return (np.array([[v.value.high for v in row] for row in made]), - np.array([[v.value.low for v in row] for row in made])) - -def add_state(high,low,delta): - p=Pair(high,low)+Pair(delta) - return p.high.copy(),p.low.copy() - - -def retained_evaluation(reference,x,low,q,q_low,u,u_low,p,p_low,material): - size=24;variables=[Jet.variable(0.,i,size) for i in range(size)] - made_q=[mm(exp(variables[6*n+3:6*n+6]),const(q[n],q_low[n],size)) for n in range(3)] - z=[];ell=[] - for cell,(left,right) in enumerate(((0,1),(1,2))): - made_u=mm(exp(variables[18+3*cell:21+3*cell]),const(u[cell],u_low[cell],size)) - chord=[Jet.constant(Pair(x[right,i],low[right,i])-Pair(x[left,i],low[left,i]),size) - +variables[6*right+i]-variables[6*left+i] for i in range(3)] - local=mv(transpose(made_u),chord) - z.extend(v-Pair(reference.coordinates[right,i])+Pair(reference.coordinates[left,i]) for i,v in enumerate(local)) - for node,sign in ((left,-1),(right,1)): - frame=mm(made_u,const(reference.nodal_triads[node],np.zeros((3,3)),size)) - ell.extend(sign*v for v in log(mm(transpose(frame),made_q[node]))) - values=z+ell;forces=Pair(p,p_low);gradient=Pair(np.zeros(24));geometric=Pair(np.zeros((24,24))) - potential=Pair(0.) - for v,ph,pl in zip(values,forces.high,forces.low): - f=Pair(ph,pl);gradient=gradient+v.gradient*f;geometric=geometric+v.hessian*f;potential=potential+v.value*f - gh,gl=material['gradient'];compatibility=[v.value-Pair(h,l) for v,h,l in zip(values,gh,gl)] - jh=np.array([v.gradient.high for v in values]);jl=np.array([v.gradient.low for v in values]) - ch=np.array([r[0] for r in material['hessian']]);cl=np.array([r[1] for r in material['hessian']]) - high=np.block([[geometric.high,jh.T],[jh,-ch]]) - lowh=np.block([[geometric.low,jl.T],[jl,-cl]]) - residual=np.r_[gradient.rounded(),[v.scalar() for v in compatibility]] - potential=potential-Pair(material['potential'][0][0],material['potential'][1][0]) - return potential.scalar(),residual,high,lowh,np.array([v.value.scalar() for v in values]) - - -def validate_pairs(high,low,label): - p=Pair(high,low) - if not np.array_equal(p.high,high) or not np.array_equal(p.low,low): - raise ValueError('normalized compensated '+label+' required') - return p - -def validate_frames(high,low,label): - validate_pairs(high,low,label) - for h,l in zip(np.asarray(high).reshape(-1,3,3),np.asarray(low).reshape(-1,3,3)): - m=[[Pair(h[i,j],l[i,j]) for j in range(3)] for i in range(3)] - product=mm(transpose(m),m) - error=np.array([[v.scalar()-float(i==j) for j,v in enumerate(row)] for i,row in enumerate(product)]) - physical=h+l - if np.linalg.norm(error)>1e-11 or abs(np.linalg.det(physical)-1.)>1e-11: - raise ValueError('proper physical compensated '+label+' required') - -def pose_evaluation(x,low,frames,frames_low,multipliers,offset,relative): - size=18;variables=[Jet.variable(0.,i,size) for i in range(12)] - variables+=[Jet.variable(float(v),12+i,size) for i,v in enumerate(multipliers)] - made=[mm(exp(variables[6*n+3:6*n+6]),const(frames[n],frames_low[n],size)) for n in range(2)] - distance=[Jet.constant(Pair(x[1,i],low[1,i])-Pair(x[0,i],low[0,i]),size)+variables[6+i]-variables[i] for i in range(3)] - ct=[v-float(e) for v,e in zip(mv(transpose(made[0]),distance),offset)] - rel=mm(const(relative.T,np.zeros((3,3)),size),mm(transpose(made[0]),made[1])) - constraints=ct+log(rel);potential=sum((v*variables[12+i] for i,v in enumerate(constraints)),Jet.constant(0.,size)) - return (potential.value.scalar(),np.array([v.value.scalar() for v in constraints]), - np.array([v.gradient.rounded()[:12] for v in constraints]),potential.gradient.rounded(),potential.hessian.rounded()) +"""Opt-in binary64 expansion arithmetic for durable native state and work. + +Two components retain roundoff information; no decimal/extended-precision +backend, projection, altered mechanical equation or empirical stabilization. +""" +import math +import numpy as np +POLICY='GE_BEAM3_DURABLE_COMPENSATED_NATIVE_STATE_V1_DEV' +MAGIC=b'ANYF06DD1\0' + + +def two_sum(a,b): + h=a+b;v=h-a + return h,(a-(h-v))+(b-v) + +def two_product(a,b): + h=a*b;split=134217729. + ca=split*a;cb=split*b + ah=ca-(ca-a);al=a-ah;bh=cb-(cb-b);bl=b-bh + return h,((ah*bh-h)+ah*bl+al*bh)+al*bl + +class Pair: + __array_priority__=1000 + def __init__(self,high,low=0.): + self.high,self.low=two_sum(np.asarray(high,dtype=float),np.asarray(low,dtype=float)) + if not np.isfinite(self.high).all() or not np.isfinite(self.low).all(): + raise ValueError('finite representable compensated native values required') + @staticmethod + def make(value):return value if isinstance(value,Pair) else Pair(value) + def __add__(self,other): + b=self.make(other);h,l=two_sum(self.high,b.high) + return Pair(h,l+self.low+b.low) + __radd__=__add__ + def __neg__(self):return Pair(-self.high,-self.low) + def __sub__(self,other):return self+-self.make(other) + def __rsub__(self,other):return self.make(other)+-self + def __mul__(self,other): + b=self.make(other);h,l=two_product(self.high,b.high) + return Pair(h,l+self.high*b.low+self.low*b.high+self.low*b.low) + __rmul__=__mul__ + def reciprocal(self): + if np.any(self.high==0.):raise ValueError('singular compensated native reciprocal') + q=Pair(1./self.high) + return q+(1.-self*q)*(1./self.high) + def __truediv__(self,other):return self*self.make(other).reciprocal() + def __rtruediv__(self,other):return self.make(other)*self.reciprocal() + def __getitem__(self,index):return Pair(self.high[index],self.low[index]) + @property + def T(self):return Pair(self.high.T,self.low.T) + def rounded(self):return self.high+self.low + def scalar(self):return float(self.high)+float(self.low) + +def outer(a,b):return Pair(a.high[:,None],a.low[:,None])*Pair(b.high[None,:],b.low[None,:]) + +class Jet: + def __init__(self,value,gradient,hessian): + self.value=Pair.make(value);self.gradient=Pair.make(gradient);self.hessian=Pair.make(hessian) + @classmethod + def constant(cls,value,size):return cls(value,Pair(np.zeros(size)),Pair(np.zeros((size,size)))) + @classmethod + def variable(cls,value,index,size): + g=np.zeros(size);g[index]=1. + return cls(value,Pair(g),Pair(np.zeros((size,size)))) + def make(self,value):return value if isinstance(value,Jet) else Jet.constant(value,self.gradient.high.size) + def __add__(self,other): + b=self.make(other);return Jet(self.value+b.value,self.gradient+b.gradient,self.hessian+b.hessian) + __radd__=__add__ + def __neg__(self):return Jet(-self.value,-self.gradient,-self.hessian) + def __sub__(self,other):return self+-self.make(other) + def __rsub__(self,other):return self.make(other)+-self + def __mul__(self,other): + b=self.make(other) + return Jet(self.value*b.value,self.gradient*b.value+self.value*b.gradient, + self.hessian*b.value+self.value*b.hessian+outer(self.gradient,b.gradient)+outer(b.gradient,self.gradient)) + __rmul__=__mul__ + def __truediv__(self,other): + if isinstance(other,Jet): + r=other.value.reciprocal();return self*unary(other,r,-r*r,2*r*r*r) + return self*Pair.make(other).reciprocal() + +def unary(j,v,d,dd):return Jet(v,j.gradient*d,j.hessian*d+outer(j.gradient,j.gradient)*dd) +def transpose(a):return [list(row) for row in zip(*a)] +def mm(a,b):return [[sum(x*y for x,y in zip(row,col)) for col in zip(*b)] for row in a] +def mv(a,b):return [sum(x*y for x,y in zip(row,b)) for row in a] +def const(a,low,size): + return [[Jet.constant(Pair(a[i,j],low[i,j]),size) for j in range(3)] for i in range(3)] +def exp(w): + n=w[0].gradient.high.size;z=Jet.constant(0.,n);t=sum((v*v for v in w),z) + if math.sqrt(max(0.,t.value.scalar()))>=.9*math.pi:raise ValueError('native increment requires cutback') + # Entire-function Rodrigues coefficients, evaluated from their defining + # series. 32 terms cover the unchanged native chart radius. + a=Jet.constant(1.,n);b=Jet.constant(.5,n);ta=a;tb=b + stop=2 if t.value.scalar()==0. and not np.any(t.gradient.high) and not np.any(t.gradient.low) else 33 + for k in range(1,stop): + ta=-ta*t/((2*k)*(2*k+1));tb=-tb*t/((2*k+1)*(2*k+2));a=a+ta;b=b+tb + S=[[z,-w[2],w[1]],[w[2],z,-w[0]],[-w[1],w[0],z]];SS=mm(S,S) + return [[Jet.constant(float(i==j),n)+a*S[i][j]+b*SS[i][j] for j in range(3)] for i in range(3)] +def greater_scalar(value,bound): + """Compare authoritative normalized scalar parts without rounding the low.""" + return bool(value.high>bound or (value.high==bound and value.low>0.)) + +def pair_sqrt(value): + value=Pair.make(value) + if not greater_scalar(value,0.):raise ValueError('positive compensated square root required') + root=Pair(float(np.sqrt(value.high))) + for _ in range(2):root=root+(value-root*root)/(2.*root) + return root + +def pair_sin_cos(value): + """Bounded principal-angle entire series in binary64 expansions.""" + value=Pair.make(value);t=value*value + sine=value;cosine=Pair(1.);a=value;b=Pair(1.) + for k in range(1,33): + a=-a*t/((2*k)*(2*k+1));b=-b*t/((2*k-1)*(2*k)) + sine=sine+a;cosine=cosine+b + return sine,cosine + +def full_log_coefficients(cosine): + """Same principal acos(c)/sqrt(1-c*c) and its first two derivatives. + + Acos is seeded at the high component, then corrected using the defining + cosine equation in the same binary64 expansion arithmetic. The recurrences + (1-c*c) f' = c*f-1 and (1-c*c) f'' = f+3*c*f' avoid introducing a new law. + """ + from ._ge_beam3_mixed_ad import RotationDomainError,math_cos_limit + c=Pair.make(cosine) + if not greater_scalar(c,math_cos_limit()) or greater_scalar(c,1.) or (c.high==1. and c.low==0.): + raise RotationDomainError('relative rotation must remain below 0.9*pi; refine or cut back') + t=1.-c*c;sine=pair_sqrt(t);angle=Pair(float(np.arccos(c.high))) + for _ in range(2): + sn,cs=pair_sin_cos(angle);angle=angle+(cs-c)/sn + value=angle/sine;first=(c*value-1.)/t;second=(value+3.*c*first)/t + return value,first,second + +def log(a): + n=a[0][0].gradient.high.size;c=(a[0][0]+a[1][1]+a[2][2]-1.)/2. + if greater_scalar(c.value,1.-1e-7): + d=1.-c;f=1.+d/3.+2.*d*d/15.+2.*d*d*d/35. + else: + f=unary(c,*full_log_coefficients(c.value)) + return [f*(a[2][1]-a[1][2])/2.,f*(a[0][2]-a[2][0])/2.,f*(a[1][0]-a[0][1])/2.] + +def updated_rotation(high,low,angle): + w=[Jet.constant(float(v),1) for v in angle];e=exp(w);made=mm(e,const(high,low,1)) + return (np.array([[v.value.high for v in row] for row in made]), + np.array([[v.value.low for v in row] for row in made])) + +def add_state(high,low,delta): + p=Pair(high,low)+Pair(delta) + return p.high.copy(),p.low.copy() + + +def retained_evaluation(reference,x,low,q,q_low,u,u_low,p,p_low,material): + size=24;variables=[Jet.variable(0.,i,size) for i in range(size)] + made_q=[mm(exp(variables[6*n+3:6*n+6]),const(q[n],q_low[n],size)) for n in range(3)] + z=[];ell=[] + for cell,(left,right) in enumerate(((0,1),(1,2))): + made_u=mm(exp(variables[18+3*cell:21+3*cell]),const(u[cell],u_low[cell],size)) + chord=[Jet.constant(Pair(x[right,i],low[right,i])-Pair(x[left,i],low[left,i]),size) + +variables[6*right+i]-variables[6*left+i] for i in range(3)] + local=mv(transpose(made_u),chord) + z.extend(v-Pair(reference.coordinates[right,i])+Pair(reference.coordinates[left,i]) for i,v in enumerate(local)) + for node,sign in ((left,-1),(right,1)): + frame=mm(made_u,const(reference.nodal_triads[node],np.zeros((3,3)),size)) + ell.extend(sign*v for v in log(mm(transpose(frame),made_q[node]))) + values=z+ell;forces=Pair(p,p_low);gradient=Pair(np.zeros(24));geometric=Pair(np.zeros((24,24))) + potential=Pair(0.) + for v,ph,pl in zip(values,forces.high,forces.low): + f=Pair(ph,pl);gradient=gradient+v.gradient*f;geometric=geometric+v.hessian*f;potential=potential+v.value*f + gh,gl=material['gradient'];compatibility=[v.value-Pair(h,l) for v,h,l in zip(values,gh,gl)] + jh=np.array([v.gradient.high for v in values]);jl=np.array([v.gradient.low for v in values]) + ch=np.array([r[0] for r in material['hessian']]);cl=np.array([r[1] for r in material['hessian']]) + high=np.block([[geometric.high,jh.T],[jh,-ch]]) + lowh=np.block([[geometric.low,jl.T],[jl,-cl]]) + residual=np.r_[gradient.rounded(),[v.scalar() for v in compatibility]] + potential=potential-Pair(material['potential'][0][0],material['potential'][1][0]) + return potential.scalar(),residual,high,lowh,np.array([v.value.scalar() for v in values]) + + +def validate_pairs(high,low,label): + p=Pair(high,low) + if not np.array_equal(p.high,high) or not np.array_equal(p.low,low): + raise ValueError('normalized compensated '+label+' required') + return p + +def validate_frames(high,low,label): + validate_pairs(high,low,label) + for h,l in zip(np.asarray(high).reshape(-1,3,3),np.asarray(low).reshape(-1,3,3)): + m=[[Pair(h[i,j],l[i,j]) for j in range(3)] for i in range(3)] + product=mm(transpose(m),m) + error=np.array([[v.scalar()-float(i==j) for j,v in enumerate(row)] for i,row in enumerate(product)]) + physical=h+l + if np.linalg.norm(error)>1e-11 or abs(np.linalg.det(physical)-1.)>1e-11: + raise ValueError('proper physical compensated '+label+' required') + +def pose_evaluation(x,low,frames,frames_low,multipliers,offset,relative): + size=18;variables=[Jet.variable(0.,i,size) for i in range(12)] + variables+=[Jet.variable(float(v),12+i,size) for i,v in enumerate(multipliers)] + made=[mm(exp(variables[6*n+3:6*n+6]),const(frames[n],frames_low[n],size)) for n in range(2)] + distance=[Jet.constant(Pair(x[1,i],low[1,i])-Pair(x[0,i],low[0,i]),size)+variables[6+i]-variables[i] for i in range(3)] + ct=[v-float(e) for v,e in zip(mv(transpose(made[0]),distance),offset)] + rel=mm(const(relative.T,np.zeros((3,3)),size),mm(transpose(made[0]),made[1])) + constraints=ct+log(rel);potential=sum((v*variables[12+i] for i,v in enumerate(constraints)),Jet.constant(0.,size)) + return (potential.value.scalar(),np.array([v.value.scalar() for v in constraints]), + np.array([v.gradient.rounded()[:12] for v in constraints]),potential.gradient.rounded(),potential.hessian.rounded()) diff --git a/src/anysolver/_stiffened_shell_ge_body_load.py b/src/anyfesolver/_stiffened_shell_ge_body_load.py similarity index 100% rename from src/anysolver/_stiffened_shell_ge_body_load.py rename to src/anyfesolver/_stiffened_shell_ge_body_load.py diff --git a/src/anysolver/_stiffened_shell_ge_checkpoint_binary.py b/src/anyfesolver/_stiffened_shell_ge_checkpoint_binary.py similarity index 99% rename from src/anysolver/_stiffened_shell_ge_checkpoint_binary.py rename to src/anyfesolver/_stiffened_shell_ge_checkpoint_binary.py index b0b30dc6b..b907fc501 100644 --- a/src/anysolver/_stiffened_shell_ge_checkpoint_binary.py +++ b/src/anyfesolver/_stiffened_shell_ge_checkpoint_binary.py @@ -85,13 +85,13 @@ "finite_native_material_stable": STABLE_NATIVE_SCHEMA, "finite_chart_native_material_stable": "B3_GE_E4_PL_STIFFENED_SHELL_EXPERIMENTAL_ANCHORED_STABLE_S3_NATIVE_MATERIAL_V9", } - -# Distinct shell-J2 domain: historical material kinds remain elastic-shell only. -COMPENSATED_COUPLED_KINDS = tuple('finite_compensated_'+family+'_coupled' - for family in ('generalized', 'fibre', 'mixed')) -for _family, _kind in zip(('GENERALIZED', 'PHYSICAL_FIBRE', 'MIXED_NATIVE'), COMPENSATED_COUPLED_KINDS): - SCHEMAS[_kind] = 'GE_COMPENSATED_'+_family+'_POINT_COUPLED_J2_STATE_V1_DEV' - SCHEMAS[_kind.replace('finite', 'finite_chart', 1)] = 'GE_ANCHORED_COMPENSATED_'+_family+'_POINT_COUPLED_J2_STATE_V1_DEV' + +# Distinct shell-J2 domain: historical material kinds remain elastic-shell only. +COMPENSATED_COUPLED_KINDS = tuple('finite_compensated_'+family+'_coupled' + for family in ('generalized', 'fibre', 'mixed')) +for _family, _kind in zip(('GENERALIZED', 'PHYSICAL_FIBRE', 'MIXED_NATIVE'), COMPENSATED_COUPLED_KINDS): + SCHEMAS[_kind] = 'GE_COMPENSATED_'+_family+'_POINT_COUPLED_J2_STATE_V1_DEV' + SCHEMAS[_kind.replace('finite', 'finite_chart', 1)] = 'GE_ANCHORED_COMPENSATED_'+_family+'_POINT_COUPLED_J2_STATE_V1_DEV' CURVED_POINT_MATERIAL_KINDS = ("finite_curved_points_material", "finite_curved_points_coupled") FINITE_DISTRIBUTING_NATIVE_KINDS = ("finite_distributing_cyclic_native_material", diff --git a/src/anysolver/_stiffened_shell_ge_distributed_load.py b/src/anyfesolver/_stiffened_shell_ge_distributed_load.py similarity index 98% rename from src/anysolver/_stiffened_shell_ge_distributed_load.py rename to src/anyfesolver/_stiffened_shell_ge_distributed_load.py index f4a19c85c..13053c615 100644 --- a/src/anysolver/_stiffened_shell_ge_distributed_load.py +++ b/src/anyfesolver/_stiffened_shell_ge_distributed_load.py @@ -1,210 +1,210 @@ -"""Explicit native force/couple densities, per reference arclength. - -Fixed spatial force work is conservative; fixed spatial couples have no scalar -potential. Full native cell rotations and actual element quadrature are retained. -New load identity binds objective Q4 / stable elastic S3 finite arithmetic. -""" -from dataclasses import dataclass, field -from hashlib import sha256 -from types import SimpleNamespace -import numpy as np -from scipy import sparse -from ._stiffened_shell_staged_load_experimental import _canonical, _identity, _number, _json -from ._stiffened_shell_ge_checkpoint_binary import MAX_CHECKPOINT_BYTES -from ._stiffened_shell_native_gravity import _owned, _sum, _product, _finite_array -from ._ge_beam3_p5.compensated_coordinates import split_sum - -POLICY='STIFFENED_SHELL_GE_NATIVE_DISTRIBUTED_LOAD_V1_DEV' -MAGIC=b'ANYSGE_LINE1\0' -MAX_METADATA_BYTES=1024*1024 -MAX_ACTIONS=16384 - - +"""Explicit native force/couple densities, per reference arclength. + +Fixed spatial force work is conservative; fixed spatial couples have no scalar +potential. Full native cell rotations and actual element quadrature are retained. +New load identity binds objective Q4 / stable elastic S3 finite arithmetic. +""" +from dataclasses import dataclass, field +from hashlib import sha256 +from types import SimpleNamespace +import numpy as np +from scipy import sparse +from ._stiffened_shell_staged_load_experimental import _canonical, _identity, _number, _json +from ._stiffened_shell_ge_checkpoint_binary import MAX_CHECKPOINT_BYTES +from ._stiffened_shell_native_gravity import _owned, _sum, _product, _finite_array +from ._ge_beam3_p5.compensated_coordinates import split_sum + +POLICY='STIFFENED_SHELL_GE_NATIVE_DISTRIBUTED_LOAD_V1_DEV' +MAGIC=b'ANYSGE_LINE1\0' +MAX_METADATA_BYTES=1024*1024 +MAX_ACTIONS=16384 + + def admits_owner(owner): """Attachment scope shared by public capabilities and load compilation.""" - if owner._definition.distributing_footprints or owner._definition.finite_distributing_footprints: + if owner._definition.distributing_footprints or owner._definition.finite_distributing_footprints: return False - if owner._definition.footprints: - return False - if owner._line_samples: - from ._stiffened_shell_q4_algorithmic_pullback import POLICY - return bool(owner._finite_bl5 and owner._definition.q4_pullback_policy == POLICY) - return bool(owner._definition.points) - - -def _vector(value): - if np.shape(value)!=(3,): raise ValueError('three finite load density components required') - return tuple(_number(v) for v in value) - - -@dataclass(frozen=True) -class GEBeamLineAction: - element_id: int - force_N_per_reference_m: tuple=(0.,0.,0.) - couple_Nm_per_reference_m: tuple=(0.,0.,0.) - - def __post_init__(self): - if type(self.element_id) is not int or self.element_id<=0: - raise ValueError('positive native element identifier required') - for name in ('force_N_per_reference_m','couple_Nm_per_reference_m'): - object.__setattr__(self,name,_vector(getattr(self,name))) - if not any(self.force_N_per_reference_m+self.couple_Nm_per_reference_m): - raise ValueError('each native distributed action must be nonzero') - - def payload(self): - return dict(element_id=self.element_id,force_N_per_reference_m=list(self.force_N_per_reference_m), - couple_Nm_per_reference_m=list(self.couple_Nm_per_reference_m)) - - -@dataclass(frozen=True) -class GEBeamDistributedLoad: - model_identity: str - actions: tuple[GEBeamLineAction,...] - identity: str=field(init=False) - - def __post_init__(self): - object.__setattr__(self,'model_identity',_identity(self.model_identity)) - if type(self.actions) is not tuple or not 0MAX_METADATA_BYTES:raise ValueError('bounded distributed descriptor required') - - def _core(self): - return dict(policy=POLICY,model_identity=self.model_identity,actions=[a.payload() for a in self.actions]) - - def to_payload(self):return dict(self._core(),identity=self.identity) - def serialize(self):return _canonical(self.to_payload()) - - @classmethod - def from_payload(cls,value): - if type(value) is not dict or set(value)!={'policy','model_identity','actions','identity'} or value['policy']!=POLICY or type(value['actions']) is not list: - raise ValueError('strict distributed load descriptor required') - if not 0MAX_METADATA_BYTES or len(MAGIC)+4+len(header)+len(inner)+32>MAX_CHECKPOINT_BYTES: - raise ValueError('distributed checkpoint byte bound exceeded') - content=MAGIC+len(header).to_bytes(4,'little')+header+inner - return content+sha256(content).digest() - - -def decode_checkpoint(raw): - if type(raw) is not bytes or not raw.startswith(MAGIC) or not len(MAGIC)+4+32=len(raw)-32 or sha256(memoryview(raw)[:-32]).digest()!=raw[-32:]: - raise ValueError('distributed checkpoint bound/digest mismatch') - header_raw=raw[start:start+size];header=_json(header_raw) - if type(header) is not dict or set(header)!={'policy','request','inner_sha256'} or header['policy']!=POLICY or _canonical(header)!=header_raw: - raise ValueError('strict distributed checkpoint metadata required') - request=GEBeamDistributedLoad.from_payload(header['request']);inner=raw[start+size:-32] - if sha256(inner).hexdigest()!=header['inner_sha256']:raise ValueError('distributed inner checkpoint mismatch') - return request,inner + if owner._definition.footprints: + return False + if owner._line_samples: + from ._stiffened_shell_q4_algorithmic_pullback import POLICY + return bool(owner._finite_bl5 and owner._definition.q4_pullback_policy == POLICY) + return bool(owner._definition.points) + + +def _vector(value): + if np.shape(value)!=(3,): raise ValueError('three finite load density components required') + return tuple(_number(v) for v in value) + + +@dataclass(frozen=True) +class GEBeamLineAction: + element_id: int + force_N_per_reference_m: tuple=(0.,0.,0.) + couple_Nm_per_reference_m: tuple=(0.,0.,0.) + + def __post_init__(self): + if type(self.element_id) is not int or self.element_id<=0: + raise ValueError('positive native element identifier required') + for name in ('force_N_per_reference_m','couple_Nm_per_reference_m'): + object.__setattr__(self,name,_vector(getattr(self,name))) + if not any(self.force_N_per_reference_m+self.couple_Nm_per_reference_m): + raise ValueError('each native distributed action must be nonzero') + + def payload(self): + return dict(element_id=self.element_id,force_N_per_reference_m=list(self.force_N_per_reference_m), + couple_Nm_per_reference_m=list(self.couple_Nm_per_reference_m)) + + +@dataclass(frozen=True) +class GEBeamDistributedLoad: + model_identity: str + actions: tuple[GEBeamLineAction,...] + identity: str=field(init=False) + + def __post_init__(self): + object.__setattr__(self,'model_identity',_identity(self.model_identity)) + if type(self.actions) is not tuple or not 0MAX_METADATA_BYTES:raise ValueError('bounded distributed descriptor required') + + def _core(self): + return dict(policy=POLICY,model_identity=self.model_identity,actions=[a.payload() for a in self.actions]) + + def to_payload(self):return dict(self._core(),identity=self.identity) + def serialize(self):return _canonical(self.to_payload()) + + @classmethod + def from_payload(cls,value): + if type(value) is not dict or set(value)!={'policy','model_identity','actions','identity'} or value['policy']!=POLICY or type(value['actions']) is not list: + raise ValueError('strict distributed load descriptor required') + if not 0MAX_METADATA_BYTES or len(MAGIC)+4+len(header)+len(inner)+32>MAX_CHECKPOINT_BYTES: + raise ValueError('distributed checkpoint byte bound exceeded') + content=MAGIC+len(header).to_bytes(4,'little')+header+inner + return content+sha256(content).digest() + + +def decode_checkpoint(raw): + if type(raw) is not bytes or not raw.startswith(MAGIC) or not len(MAGIC)+4+32=len(raw)-32 or sha256(memoryview(raw)[:-32]).digest()!=raw[-32:]: + raise ValueError('distributed checkpoint bound/digest mismatch') + header_raw=raw[start:start+size];header=_json(header_raw) + if type(header) is not dict or set(header)!={'policy','request','inner_sha256'} or header['policy']!=POLICY or _canonical(header)!=header_raw: + raise ValueError('strict distributed checkpoint metadata required') + request=GEBeamDistributedLoad.from_payload(header['request']);inner=raw[start+size:-32] + if sha256(inner).hexdigest()!=header['inner_sha256']:raise ValueError('distributed inner checkpoint mismatch') + return request,inner diff --git a/src/anysolver/_stiffened_shell_ge_distributed_programme.py b/src/anyfesolver/_stiffened_shell_ge_distributed_programme.py similarity index 100% rename from src/anysolver/_stiffened_shell_ge_distributed_programme.py rename to src/anyfesolver/_stiffened_shell_ge_distributed_programme.py diff --git a/src/anysolver/_stiffened_shell_ge_distributing_finite.py b/src/anyfesolver/_stiffened_shell_ge_distributing_finite.py similarity index 98% rename from src/anysolver/_stiffened_shell_ge_distributing_finite.py rename to src/anyfesolver/_stiffened_shell_ge_distributing_finite.py index 3f6179116..81a6de7d8 100644 --- a/src/anysolver/_stiffened_shell_ge_distributing_finite.py +++ b/src/anyfesolver/_stiffened_shell_ge_distributing_finite.py @@ -1,179 +1,179 @@ -"""Experimental physical-pose assembly and recovery for finite area coupling. - -Prepare reference correspondence once from the existing GE owner. Keep its -spatial rows and pull shell increment columns only. This adapter owns no state, -changes no owner flags, and cannot publish a trial or authorize a checkpoint. -""" -from dataclasses import dataclass -from math import fsum -import weakref - -import numpy as np -from scipy import sparse - -from ._ge_beam3_pose_joint import _exp_terms -from ._ge_beam3_mixed_ad import RotationDomainError -from ._stiffened_shell_distributing_pose import ( - LAW, FiniteDistributingPose, DistributingPoseDomainError, _owned, _frozen_sparse, -) -from ._stiffened_shell_distributing_footprint import DistributingFootprintDefinition -from ._stiffened_shell_ge_distributing_reference import _compile_reference_geometry, _reference_owner -from ._stiffened_shell_rotation_charts import physical_frames - - -@dataclass(frozen=True) -class FiniteDistributingFootprintDefinition: - """Explicit opt-in finite law; never upgrades a reference-only record.""" - footprint: DistributingFootprintDefinition - - def __post_init__(self): - if type(self.footprint) is not DistributingFootprintDefinition: - raise ValueError("typed reference footprint geometry required") - g = self.footprint - object.__setattr__(self, "footprint", DistributingFootprintDefinition( - g.footprint_id, g.host_element_ids, g.beam_node_id, g.bounds_xy_m)) - - -@dataclass(frozen=True) -class FiniteDistributingFootprintWrench: - """Evaluated exerted spatial actions, measured at physical port origins. - - The shell origin is the fixed-reference-area-weighted current position. - Area is a reference measure; this is not a rigid or pointwise welded patch. - """ - footprint_id: str - model_identity: str - compiled_identity: str - host_element_ids: tuple[int, ...] - shell_node_ids: tuple[int, ...] - beam_node_id: int - centroid_m: np.ndarray - centroid_low_m: np.ndarray - beam_position_m: np.ndarray - beam_position_low_m: np.ndarray - area_reference_m2: float - shell_node_positions_m: np.ndarray - shell_node_position_low_m: np.ndarray - shell_node_actions: np.ndarray - shell_action: np.ndarray - beam_action: np.ndarray - gap: np.ndarray - generation: int - configuration: str - - @property - def law(self): - return LAW - - @property - def production_qualified(self): - return False - - def __post_init__(self): - count = len(self.shell_node_ids) - for name, shape in (("centroid_m", (3,)), ("centroid_low_m", (3,)), - ("beam_position_m", (3,)), ("beam_position_low_m", (3,)), - ("shell_node_positions_m", (count,3)), ("shell_node_position_low_m", (count,3)), - ("shell_node_actions", (count,6)), ("shell_action", (6,)), - ("beam_action", (6,)), ("gap", (6,))): - array = np.asarray(getattr(self, name)) - if array.shape != shape or not np.isfinite(array).all(): - raise DistributingPoseDomainError("finite owned distributing recovery required") - object.__setattr__(self, name, _owned(array)) - - -def wrench_record(assembly, reference, generation): - return FiniteDistributingFootprintWrench(reference.definition.footprint_id, - assembly.model_identity, assembly.candidate_identity, reference.host_element_ids, - reference.shell_node_ids, reference.beam_node_id, assembly.centroid, - assembly.centroid_low, assembly.beam_position, assembly.beam_position_low, - reference.area_m2, assembly.shell_positions, assembly.shell_position_low, - assembly.shell_node_actions, assembly.shell_action, assembly.beam_action, - assembly.gap, generation, "current") - - - -@dataclass(frozen=True) -class FiniteDistributingAssembly: - """Owned candidate work, local saddle block and explicit global scatter.""" - model_identity: str - candidate_identity: str - generation: int - slots: np.ndarray - residual: np.ndarray - tangent: sparse.csr_matrix - gap: np.ndarray - shell_positions: np.ndarray - shell_position_low: np.ndarray - beam_position: np.ndarray - beam_position_low: np.ndarray - shell_action: np.ndarray - beam_action: np.ndarray - shell_node_actions: np.ndarray - centroid: np.ndarray - centroid_low: np.ndarray - production_qualified: bool = False - owner_binding_authorized: bool = False - - def scatter(self, global_dimension): - if (type(global_dimension) is not int or global_dimension <= 0 or - self.slots.max() >= global_dimension): - raise ValueError("complete declared extended global dimension required") - matrix = self.tangent.tocoo() - tangent = sparse.coo_matrix((matrix.data, - (self.slots[matrix.row], self.slots[matrix.col])), - shape=(global_dimension, global_dimension)).tocsr() - residual = np.zeros(global_dimension) - np.add.at(residual, self.slots, self.residual) - return _owned(residual), _frozen_sparse(tangent) - - -class PreparedFiniteDistributingAttachment: - """Private reusable local operator compiled from an unadvanced owner. - - Current trial state is supplied explicitly, using the existing owner's - additive shell chart and spatial beam update. No model-wide hash/search - occurs during evaluation. A different/closed/recompiled owner is rejected. - """ - __slots__ = ("reference", "pose", "model_identity", "_owner", "_K", - "_shell_parts", "_count", "_shell_nodes", "_beam_node", "_sealed") - - def __setattr__(self, name, value): - if getattr(self, "_sealed", False): - raise AttributeError("prepared finite attachment is immutable") - object.__setattr__(self, name, value) - - def __init__(self, owner, definition): - _reference_owner(owner) - reference = _compile_reference_geometry(definition, - shell_parts=owner._shell_parts, shell_index=owner._shell_index, - shell_xyz=owner._shell_xyz, beam_index=owner._beam_index, - beam_nodes=owner._beam_nodes, shell_count=owner._shell_count, - global_dimension=owner._K.shape[0]) - self._bind(owner, reference, FiniteDistributingPose(reference)) - - @classmethod +"""Experimental physical-pose assembly and recovery for finite area coupling. + +Prepare reference correspondence once from the existing GE owner. Keep its +spatial rows and pull shell increment columns only. This adapter owns no state, +changes no owner flags, and cannot publish a trial or authorize a checkpoint. +""" +from dataclasses import dataclass +from math import fsum +import weakref + +import numpy as np +from scipy import sparse + +from ._ge_beam3_pose_joint import _exp_terms +from ._ge_beam3_mixed_ad import RotationDomainError +from ._stiffened_shell_distributing_pose import ( + LAW, FiniteDistributingPose, DistributingPoseDomainError, _owned, _frozen_sparse, +) +from ._stiffened_shell_distributing_footprint import DistributingFootprintDefinition +from ._stiffened_shell_ge_distributing_reference import _compile_reference_geometry, _reference_owner +from ._stiffened_shell_rotation_charts import physical_frames + + +@dataclass(frozen=True) +class FiniteDistributingFootprintDefinition: + """Explicit opt-in finite law; never upgrades a reference-only record.""" + footprint: DistributingFootprintDefinition + + def __post_init__(self): + if type(self.footprint) is not DistributingFootprintDefinition: + raise ValueError("typed reference footprint geometry required") + g = self.footprint + object.__setattr__(self, "footprint", DistributingFootprintDefinition( + g.footprint_id, g.host_element_ids, g.beam_node_id, g.bounds_xy_m)) + + +@dataclass(frozen=True) +class FiniteDistributingFootprintWrench: + """Evaluated exerted spatial actions, measured at physical port origins. + + The shell origin is the fixed-reference-area-weighted current position. + Area is a reference measure; this is not a rigid or pointwise welded patch. + """ + footprint_id: str + model_identity: str + compiled_identity: str + host_element_ids: tuple[int, ...] + shell_node_ids: tuple[int, ...] + beam_node_id: int + centroid_m: np.ndarray + centroid_low_m: np.ndarray + beam_position_m: np.ndarray + beam_position_low_m: np.ndarray + area_reference_m2: float + shell_node_positions_m: np.ndarray + shell_node_position_low_m: np.ndarray + shell_node_actions: np.ndarray + shell_action: np.ndarray + beam_action: np.ndarray + gap: np.ndarray + generation: int + configuration: str + + @property + def law(self): + return LAW + + @property + def production_qualified(self): + return False + + def __post_init__(self): + count = len(self.shell_node_ids) + for name, shape in (("centroid_m", (3,)), ("centroid_low_m", (3,)), + ("beam_position_m", (3,)), ("beam_position_low_m", (3,)), + ("shell_node_positions_m", (count,3)), ("shell_node_position_low_m", (count,3)), + ("shell_node_actions", (count,6)), ("shell_action", (6,)), + ("beam_action", (6,)), ("gap", (6,))): + array = np.asarray(getattr(self, name)) + if array.shape != shape or not np.isfinite(array).all(): + raise DistributingPoseDomainError("finite owned distributing recovery required") + object.__setattr__(self, name, _owned(array)) + + +def wrench_record(assembly, reference, generation): + return FiniteDistributingFootprintWrench(reference.definition.footprint_id, + assembly.model_identity, assembly.candidate_identity, reference.host_element_ids, + reference.shell_node_ids, reference.beam_node_id, assembly.centroid, + assembly.centroid_low, assembly.beam_position, assembly.beam_position_low, + reference.area_m2, assembly.shell_positions, assembly.shell_position_low, + assembly.shell_node_actions, assembly.shell_action, assembly.beam_action, + assembly.gap, generation, "current") + + + +@dataclass(frozen=True) +class FiniteDistributingAssembly: + """Owned candidate work, local saddle block and explicit global scatter.""" + model_identity: str + candidate_identity: str + generation: int + slots: np.ndarray + residual: np.ndarray + tangent: sparse.csr_matrix + gap: np.ndarray + shell_positions: np.ndarray + shell_position_low: np.ndarray + beam_position: np.ndarray + beam_position_low: np.ndarray + shell_action: np.ndarray + beam_action: np.ndarray + shell_node_actions: np.ndarray + centroid: np.ndarray + centroid_low: np.ndarray + production_qualified: bool = False + owner_binding_authorized: bool = False + + def scatter(self, global_dimension): + if (type(global_dimension) is not int or global_dimension <= 0 or + self.slots.max() >= global_dimension): + raise ValueError("complete declared extended global dimension required") + matrix = self.tangent.tocoo() + tangent = sparse.coo_matrix((matrix.data, + (self.slots[matrix.row], self.slots[matrix.col])), + shape=(global_dimension, global_dimension)).tocsr() + residual = np.zeros(global_dimension) + np.add.at(residual, self.slots, self.residual) + return _owned(residual), _frozen_sparse(tangent) + + +class PreparedFiniteDistributingAttachment: + """Private reusable local operator compiled from an unadvanced owner. + + Current trial state is supplied explicitly, using the existing owner's + additive shell chart and spatial beam update. No model-wide hash/search + occurs during evaluation. A different/closed/recompiled owner is rejected. + """ + __slots__ = ("reference", "pose", "model_identity", "_owner", "_K", + "_shell_parts", "_count", "_shell_nodes", "_beam_node", "_sealed") + + def __setattr__(self, name, value): + if getattr(self, "_sealed", False): + raise AttributeError("prepared finite attachment is immutable") + object.__setattr__(self, name, value) + + def __init__(self, owner, definition): + _reference_owner(owner) + reference = _compile_reference_geometry(definition, + shell_parts=owner._shell_parts, shell_index=owner._shell_index, + shell_xyz=owner._shell_xyz, beam_index=owner._beam_index, + beam_nodes=owner._beam_nodes, shell_count=owner._shell_count, + global_dimension=owner._K.shape[0]) + self._bind(owner, reference, FiniteDistributingPose(reference)) + + @classmethod def _from_compiled(cls, owner, reference, pose): """Reuse the owner's own prepared map and pose without a second search.""" _reference_owner(owner, allow_finite_material=True) - if pose.reference_identity != reference.identity: - raise ValueError("matching finite pose and reference correspondence required") - instance = object.__new__(cls) - instance._bind(owner, reference, pose) - return instance - - def _bind(self, owner, reference, pose): - self.reference, self.pose = reference, pose - self.model_identity = owner._identity - self._owner = weakref.ref(owner) - self._K = owner._K - self._shell_parts = owner._shell_parts - self._count = owner._K.shape[0] - self._shell_nodes = _owned(np.array( - [owner._shell_index[node] for node in self.reference.shell_node_ids], dtype=np.int64)) - self._beam_node = owner._beam_index[self.reference.beam_node_id] - self._sealed = True - + if pose.reference_identity != reference.identity: + raise ValueError("matching finite pose and reference correspondence required") + instance = object.__new__(cls) + instance._bind(owner, reference, pose) + return instance + + def _bind(self, owner, reference, pose): + self.reference, self.pose = reference, pose + self.model_identity = owner._identity + self._owner = weakref.ref(owner) + self._K = owner._K + self._shell_parts = owner._shell_parts + self._count = owner._K.shape[0] + self._shell_nodes = _owned(np.array( + [owner._shell_index[node] for node in self.reference.shell_node_ids], dtype=np.int64)) + self._beam_node = owner._beam_index[self.reference.beam_node_id] + self._sealed = True + def descriptor(self): owner = self._owner() admitted = bool(owner is not None and owner._finite_distributing) @@ -181,62 +181,62 @@ def descriptor(self): scatter="LOCAL_SPARSE_SADDLE_BLOCK", accepted_state_owned=False, public_admission=admitted, owner_binding_authorized=admitted, checkpoint_admission=admitted) - - def evaluate(self, owner, state, multipliers, *, multiplier_row_start=0): - from ._stiffened_shell_ge_finite_experimental import _State, _position_pair - if (self._owner() is not owner or owner._identity != self.model_identity or - owner._K is not self._K or owner._shell_parts is not self._shell_parts): - raise ValueError("stale or different finite attachment owner") - owner._require_open() - if (type(state) is not _State or state.q.shape != (self._count,) or - state.frames.shape != (len(owner._beam_ids), 3, 3) or - type(multiplier_row_start) is not int or multiplier_row_start < 0): - raise ValueError("complete owner trial and explicit multiplier row start required") - nodes = self._shell_nodes - local_q = state.q[:owner._shell_count].reshape(-1, 6)[nodes] - anchors = (None if state.shell_anchors is None else state.shell_anchors[nodes]) - frames = physical_frames(local_q.ravel(), anchors) - pairs = [_position_pair(owner._shell_xyz[node], q[:3]) for node, q in zip(nodes, local_q)] - positions, low = np.array([v[0] for v in pairs]), np.array([v[1] for v in pairs]) - start = owner._shell_count+6*self._beam_node - beam, beam_low = _position_pair(owner._beam_nodes[self.reference.beam_node_id][0], state.q[start:start+3]) - try: - result = self.pose.evaluate(positions, frames, beam, state.frames[self._beam_node], - multipliers, shell_position_low=low, beam_position_low=beam_low) - except RotationDomainError as error: - raise DistributingPoseDomainError("finite distributing relative rotation requires cutback") from error - blocks = [] - for q in local_q: - left = _exp_terms(q[3:])[1] - if np.linalg.svd(left, compute_uv=False)[-1] <= 1e-11: - raise DistributingPoseDomainError("singular distributing shell chart; owner must rebase") - blocks.append(sparse.block_diag((np.eye(3), left), format="csr")) - blocks.append(sparse.eye(6, format="csr")) - columns = sparse.block_diag(blocks, format="csr") - C = sparse.csr_matrix(result.constraint_jacobian) - tangent = sparse.bmat(((result.spatial_jacobian@columns, C.T), - (C@columns, sparse.csr_matrix((6, 6)))), format="csr") - slots = np.r_[self.reference.gather_slots, - self._count+multiplier_row_start+np.arange(6, dtype=np.int64)] - # Exerted physical actions are minus the evaluated spatial work rows; - # raw Log multipliers are not recovered display moments. - action = -result.residual.reshape(-1, 6) - arms = np.array([[fsum((float(x[j]),float(xl[j]), - -float(result.shell_position[j]),-float(result.shell_position_low[j]))) - for j in range(3)] for x,xl in zip(positions,low)]) - with np.errstate(over="ignore", invalid="ignore"): - couples = np.cross(arms, action[:-1,:3])+action[:-1,3:] - if not np.isfinite(arms).all() or not np.isfinite(couples).all(): - raise DistributingPoseDomainError("unrepresentable distributing recovery moment") - try: - shell_action = np.array([fsum(float(v) for v in column) - for column in np.c_[action[:-1,:3], couples].T]) - except OverflowError as error: - raise DistributingPoseDomainError("unrepresentable distributing recovery resultant") from error - if not np.isfinite(shell_action).all(): - raise DistributingPoseDomainError("unrepresentable distributing recovery resultant") - return FiniteDistributingAssembly(self.model_identity, self.pose.identity, owner._generation, - _owned(slots), _owned(np.r_[result.residual,result.constraints]), _frozen_sparse(tangent), - result.constraints, _owned(positions), _owned(low), _owned(beam), _owned(beam_low), - _owned(shell_action), _owned(action[-1]), _owned(action[:-1]), - result.shell_position, result.shell_position_low) + + def evaluate(self, owner, state, multipliers, *, multiplier_row_start=0): + from ._stiffened_shell_ge_finite_experimental import _State, _position_pair + if (self._owner() is not owner or owner._identity != self.model_identity or + owner._K is not self._K or owner._shell_parts is not self._shell_parts): + raise ValueError("stale or different finite attachment owner") + owner._require_open() + if (type(state) is not _State or state.q.shape != (self._count,) or + state.frames.shape != (len(owner._beam_ids), 3, 3) or + type(multiplier_row_start) is not int or multiplier_row_start < 0): + raise ValueError("complete owner trial and explicit multiplier row start required") + nodes = self._shell_nodes + local_q = state.q[:owner._shell_count].reshape(-1, 6)[nodes] + anchors = (None if state.shell_anchors is None else state.shell_anchors[nodes]) + frames = physical_frames(local_q.ravel(), anchors) + pairs = [_position_pair(owner._shell_xyz[node], q[:3]) for node, q in zip(nodes, local_q)] + positions, low = np.array([v[0] for v in pairs]), np.array([v[1] for v in pairs]) + start = owner._shell_count+6*self._beam_node + beam, beam_low = _position_pair(owner._beam_nodes[self.reference.beam_node_id][0], state.q[start:start+3]) + try: + result = self.pose.evaluate(positions, frames, beam, state.frames[self._beam_node], + multipliers, shell_position_low=low, beam_position_low=beam_low) + except RotationDomainError as error: + raise DistributingPoseDomainError("finite distributing relative rotation requires cutback") from error + blocks = [] + for q in local_q: + left = _exp_terms(q[3:])[1] + if np.linalg.svd(left, compute_uv=False)[-1] <= 1e-11: + raise DistributingPoseDomainError("singular distributing shell chart; owner must rebase") + blocks.append(sparse.block_diag((np.eye(3), left), format="csr")) + blocks.append(sparse.eye(6, format="csr")) + columns = sparse.block_diag(blocks, format="csr") + C = sparse.csr_matrix(result.constraint_jacobian) + tangent = sparse.bmat(((result.spatial_jacobian@columns, C.T), + (C@columns, sparse.csr_matrix((6, 6)))), format="csr") + slots = np.r_[self.reference.gather_slots, + self._count+multiplier_row_start+np.arange(6, dtype=np.int64)] + # Exerted physical actions are minus the evaluated spatial work rows; + # raw Log multipliers are not recovered display moments. + action = -result.residual.reshape(-1, 6) + arms = np.array([[fsum((float(x[j]),float(xl[j]), + -float(result.shell_position[j]),-float(result.shell_position_low[j]))) + for j in range(3)] for x,xl in zip(positions,low)]) + with np.errstate(over="ignore", invalid="ignore"): + couples = np.cross(arms, action[:-1,:3])+action[:-1,3:] + if not np.isfinite(arms).all() or not np.isfinite(couples).all(): + raise DistributingPoseDomainError("unrepresentable distributing recovery moment") + try: + shell_action = np.array([fsum(float(v) for v in column) + for column in np.c_[action[:-1,:3], couples].T]) + except OverflowError as error: + raise DistributingPoseDomainError("unrepresentable distributing recovery resultant") from error + if not np.isfinite(shell_action).all(): + raise DistributingPoseDomainError("unrepresentable distributing recovery resultant") + return FiniteDistributingAssembly(self.model_identity, self.pose.identity, owner._generation, + _owned(slots), _owned(np.r_[result.residual,result.constraints]), _frozen_sparse(tangent), + result.constraints, _owned(positions), _owned(low), _owned(beam), _owned(beam_low), + _owned(shell_action), _owned(action[-1]), _owned(action[:-1]), + result.shell_position, result.shell_position_low) diff --git a/src/anysolver/_stiffened_shell_ge_distributing_reference.py b/src/anyfesolver/_stiffened_shell_ge_distributing_reference.py similarity index 100% rename from src/anysolver/_stiffened_shell_ge_distributing_reference.py rename to src/anyfesolver/_stiffened_shell_ge_distributing_reference.py diff --git a/src/anysolver/_stiffened_shell_ge_experimental.py b/src/anyfesolver/_stiffened_shell_ge_experimental.py similarity index 100% rename from src/anysolver/_stiffened_shell_ge_experimental.py rename to src/anyfesolver/_stiffened_shell_ge_experimental.py diff --git a/src/anysolver/_stiffened_shell_ge_finite_experimental.py b/src/anyfesolver/_stiffened_shell_ge_finite_experimental.py similarity index 100% rename from src/anysolver/_stiffened_shell_ge_finite_experimental.py rename to src/anyfesolver/_stiffened_shell_ge_finite_experimental.py diff --git a/src/anysolver/_stiffened_shell_ge_mixed_modal_mass.py b/src/anyfesolver/_stiffened_shell_ge_mixed_modal_mass.py similarity index 100% rename from src/anysolver/_stiffened_shell_ge_mixed_modal_mass.py rename to src/anyfesolver/_stiffened_shell_ge_mixed_modal_mass.py diff --git a/src/anysolver/_stiffened_shell_ge_point_buckling.py b/src/anyfesolver/_stiffened_shell_ge_point_buckling.py similarity index 100% rename from src/anysolver/_stiffened_shell_ge_point_buckling.py rename to src/anyfesolver/_stiffened_shell_ge_point_buckling.py diff --git a/src/anysolver/_stiffened_shell_ge_pressure_load.py b/src/anyfesolver/_stiffened_shell_ge_pressure_load.py similarity index 99% rename from src/anysolver/_stiffened_shell_ge_pressure_load.py rename to src/anyfesolver/_stiffened_shell_ge_pressure_load.py index b5d594563..3429dfa57 100644 --- a/src/anysolver/_stiffened_shell_ge_pressure_load.py +++ b/src/anyfesolver/_stiffened_shell_ge_pressure_load.py @@ -1,55 +1,55 @@ -"""Owned shell interpolation-surface pressure, using existing native kernels. - -Reference-dead V2D S3 loads retain enhanced rotational covectors and are admitted -only for reference-linear work. Current-surface loads act on translations, with -the existing generally nonsymmetric spatial Jacobian and no invented potential. +"""Owned shell interpolation-surface pressure, using existing native kernels. + +Reference-dead V2D S3 loads retain enhanced rotational covectors and are admitted +only for reference-linear work. Current-surface loads act on translations, with +the existing generally nonsymmetric spatial Jacobian and no invented potential. The Q4 current-surface admission rejects degenerate quadrature stations instead of inheriting the old generic kernel's silent skip. No legacy kernel is changed. An explicitly selected director-enhanced S3 dead surface is a separate elastic development law, not a reinterpretation of the native reference-dead vector. -""" -from dataclasses import dataclass, field -from hashlib import sha256 -from types import SimpleNamespace - -import numpy as np -from scipy import sparse - -from .boundary import LoadCase, _SMALL -from .e4_pl_element import QualifiedE4PLShellElement as Q4 -from .e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement as S3 -from ._stiffened_shell_staged_load_experimental import _canonical, _identity, _number, _json -from ._stiffened_shell_ge_checkpoint_binary import MAX_CHECKPOINT_BYTES -from ._stiffened_shell_native_gravity import _owned, _sum, _product, _finite_array - +""" +from dataclasses import dataclass, field +from hashlib import sha256 +from types import SimpleNamespace + +import numpy as np +from scipy import sparse + +from .boundary import LoadCase, _SMALL +from .e4_pl_element import QualifiedE4PLShellElement as Q4 +from .e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement as S3 +from ._stiffened_shell_staged_load_experimental import _canonical, _identity, _number, _json +from ._stiffened_shell_ge_checkpoint_binary import MAX_CHECKPOINT_BYTES +from ._stiffened_shell_native_gravity import _owned, _sum, _product, _finite_array + POLICY = 'STIFFENED_SHELL_GE_NATIVE_SHELL_PRESSURE_LOAD_V1_DEV' DIRECTOR_CONFIGURATION = 'reference_dead_director_v2' DIRECTOR_LOAD_POLICY = 'STIFFENED_SHELL_GE_DIRECTOR_PRESSURE_LOAD_V2_DEV' VECTOR_EQUILIBRIUM_POLICY = 'STIFFENED_SHELL_PRESSURE_VECTOR_EQUILIBRIUM_V1_DEV' -MAGIC = b'ANYSGE_PRESS1\0' -MAX_METADATA_BYTES = 1024*1024 -MAX_ACTIONS = 16384 - - -@dataclass(frozen=True) -class GEShellPressureAction: - element_id: int - pressure_pa: float - configuration: str = 'reference_dead' - - def __post_init__(self): - if type(self.element_id) is not int or self.element_id <= 0: - raise ValueError('positive shell element identifier required') - object.__setattr__(self, 'pressure_pa', _number(self.pressure_pa)) - if self.pressure_pa == 0.: - raise ValueError('nonzero signed shell pressure required') +MAGIC = b'ANYSGE_PRESS1\0' +MAX_METADATA_BYTES = 1024*1024 +MAX_ACTIONS = 16384 + + +@dataclass(frozen=True) +class GEShellPressureAction: + element_id: int + pressure_pa: float + configuration: str = 'reference_dead' + + def __post_init__(self): + if type(self.element_id) is not int or self.element_id <= 0: + raise ValueError('positive shell element identifier required') + object.__setattr__(self, 'pressure_pa', _number(self.pressure_pa)) + if self.pressure_pa == 0.: + raise ValueError('nonzero signed shell pressure required') if type(self.configuration) is not str or self.configuration not in ('reference_dead', 'current_surface', DIRECTOR_CONFIGURATION): raise ValueError('explicit admitted shell pressure configuration required') - - def payload(self): - return dict(element_id=self.element_id, pressure_pa=self.pressure_pa, configuration=self.configuration) - - + + def payload(self): + return dict(element_id=self.element_id, pressure_pa=self.pressure_pa, configuration=self.configuration) + + @dataclass(frozen=True) class GEShellPressureLoad: """Owned pressure request with optional, checkpoint-bound finite assessment. @@ -62,21 +62,21 @@ class GEShellPressureLoad: actions: tuple[GEShellPressureAction,...] equilibrium_policy: str | None = None identity: str=field(init=False) - - def __post_init__(self): - object.__setattr__(self,'model_identity',_identity(self.model_identity)) + + def __post_init__(self): + object.__setattr__(self,'model_identity',_identity(self.model_identity)) if type(self.actions) is not tuple or not 0MAX_METADATA_BYTES:raise ValueError('bounded pressure descriptor required') - + ids=[a.element_id for a in self.actions] + if len(set(ids))!=len(ids):raise ValueError('duplicate shell pressure action element') + object.__setattr__(self,'actions',tuple(sorted(self.actions,key=lambda a:a.element_id))) + object.__setattr__(self,'identity',sha256(_canonical(self._core())).hexdigest()) + if len(self.serialize())>MAX_METADATA_BYTES:raise ValueError('bounded pressure descriptor required') + @property def policy(self): return (DIRECTOR_LOAD_POLICY if any(a.configuration == DIRECTOR_CONFIGURATION for a in self.actions) @@ -87,55 +87,55 @@ def _core(self): if self.equilibrium_policy is not None: core['equilibrium_policy'] = self.equilibrium_policy return core - - def to_payload(self):return dict(self._core(),identity=self.identity) - def serialize(self):return _canonical(self.to_payload()) - - @classmethod - def from_payload(cls,value): + + def to_payload(self):return dict(self._core(),identity=self.identity) + def serialize(self):return _canonical(self.to_payload()) + + @classmethod + def from_payload(cls,value): if (type(value) is not dict or set(value) not in ({'policy','model_identity','actions','identity'}, {'policy','model_identity','actions','identity','equilibrium_policy'}) or value['policy'] not in (POLICY, DIRECTOR_LOAD_POLICY) or type(value['actions']) is not list): - raise ValueError('strict pressure load descriptor required') - if not 0= owner._shell_count) - or not np.array_equal(slots.reshape(nodes, 6), slots[::6, None]+np.arange(6)) - or np.any(slots[::6] % 6) or len(set(slots.tolist())) != len(slots)): - raise ValueError('strict shell pressure coordinate mapping required') - xyz = _owned(shell_xyz[slots[::6]//6]) - binding = _binding(element, mesh) - native_xyz = _coordinates(element, mesh) - if not np.array_equal(xyz, native_xyz): - raise ValueError('pressure shell reference mapping mismatch') - load = LoadCase('GE shell pressure native kernel') - dead = None + slots = np.asarray(raw_slots) + nodes = len(element.node_ids) + if (slots.shape != (6*nodes,) or not np.issubdtype(slots.dtype, np.integer) + or np.any(slots < 0) or np.any(slots >= owner._shell_count) + or not np.array_equal(slots.reshape(nodes, 6), slots[::6, None]+np.arange(6)) + or np.any(slots[::6] % 6) or len(set(slots.tolist())) != len(slots)): + raise ValueError('strict shell pressure coordinate mapping required') + xyz = _owned(shell_xyz[slots[::6]//6]) + binding = _binding(element, mesh) + native_xyz = _coordinates(element, mesh) + if not np.array_equal(xyz, native_xyz): + raise ValueError('pressure shell reference mapping mismatch') + load = LoadCase('GE shell pressure native kernel') + dead = None if action.configuration in ('reference_dead', DIRECTOR_CONFIGURATION): - dead = _owned(_finite_array(load._consistent_pressure_load(element, mesh, action.pressure_pa), - (6*nodes,), 'native reference pressure covector')) - patch = _PressurePatch(action, element, mesh, tuple(int(v) for v in slots), xyz, binding, dead) - patches.append(patch) - identity = sha256(_canonical(dict(model=self.model_identity, pressure_load=self.identity))).hexdigest() - context = GEPressureContext(self, identity, count, tuple(patches)) - force, _, recovery = context.evaluate(SimpleNamespace(q=np.zeros(count))) - object.__setattr__(context, 'reference_gradient', force) - object.__setattr__(context, 'reference_recovery', recovery) - return context - - + dead = _owned(_finite_array(load._consistent_pressure_load(element, mesh, action.pressure_pa), + (6*nodes,), 'native reference pressure covector')) + patch = _PressurePatch(action, element, mesh, tuple(int(v) for v in slots), xyz, binding, dead) + patches.append(patch) + identity = sha256(_canonical(dict(model=self.model_identity, pressure_load=self.identity))).hexdigest() + context = GEPressureContext(self, identity, count, tuple(patches)) + force, _, recovery = context.evaluate(SimpleNamespace(q=np.zeros(count))) + object.__setattr__(context, 'reference_gradient', force) + object.__setattr__(context, 'reference_recovery', recovery) + return context + + def _coordinates(element, mesh): values = element._coordinates(mesh) if type(element) is S3 else element.get_node_coordinates(mesh) return _finite_array(values, (len(element.node_ids), 3), 'native pressure reference coordinates') @@ -341,26 +341,26 @@ def evaluate(self, state): def encode_checkpoint(context,inner): - if type(context) is not GEPressureContext or type(inner) is not bytes or not inner: - raise ValueError('compiled pressure context and checkpoint required') + if type(context) is not GEPressureContext or type(inner) is not bytes or not inner: + raise ValueError('compiled pressure context and checkpoint required') header=_canonical(dict(policy=context.request.policy,request=context.request.to_payload(),inner_sha256=sha256(inner).hexdigest())) - if len(header)>MAX_METADATA_BYTES or len(MAGIC)+4+len(header)+len(inner)+32>MAX_CHECKPOINT_BYTES: - raise ValueError('pressure checkpoint byte bound exceeded') - content=MAGIC+len(header).to_bytes(4,'little')+header+inner - return content+sha256(content).digest() - - -def decode_checkpoint(raw): - if type(raw) is not bytes or not raw.startswith(MAGIC) or not len(MAGIC)+4+32=len(raw)-32 or sha256(memoryview(raw)[:-32]).digest()!=raw[-32:]: - raise ValueError('pressure checkpoint bound/digest mismatch') - header_raw=raw[start:start+size];header=_json(header_raw) + if len(header)>MAX_METADATA_BYTES or len(MAGIC)+4+len(header)+len(inner)+32>MAX_CHECKPOINT_BYTES: + raise ValueError('pressure checkpoint byte bound exceeded') + content=MAGIC+len(header).to_bytes(4,'little')+header+inner + return content+sha256(content).digest() + + +def decode_checkpoint(raw): + if type(raw) is not bytes or not raw.startswith(MAGIC) or not len(MAGIC)+4+32=len(raw)-32 or sha256(memoryview(raw)[:-32]).digest()!=raw[-32:]: + raise ValueError('pressure checkpoint bound/digest mismatch') + header_raw=raw[start:start+size];header=_json(header_raw) if type(header) is not dict or set(header)!={'policy','request','inner_sha256'} or header['policy'] not in (POLICY, DIRECTOR_LOAD_POLICY) or _canonical(header)!=header_raw: - raise ValueError('strict pressure checkpoint metadata required') + raise ValueError('strict pressure checkpoint metadata required') request=GEShellPressureLoad.from_payload(header['request']);inner=raw[start+size:-32] if header['policy'] != request.policy: raise ValueError('pressure checkpoint work-law policy mismatch') - if sha256(inner).hexdigest()!=header['inner_sha256']:raise ValueError('pressure inner checkpoint mismatch') - return request,inner + if sha256(inner).hexdigest()!=header['inner_sha256']:raise ValueError('pressure inner checkpoint mismatch') + return request,inner diff --git a/src/anysolver/_stiffened_shell_ge_reference_modal.py b/src/anyfesolver/_stiffened_shell_ge_reference_modal.py similarity index 98% rename from src/anysolver/_stiffened_shell_ge_reference_modal.py rename to src/anyfesolver/_stiffened_shell_ge_reference_modal.py index 840c2a910..9215bc715 100644 --- a/src/anysolver/_stiffened_shell_ge_reference_modal.py +++ b/src/anyfesolver/_stiffened_shell_ge_reference_modal.py @@ -1,72 +1,72 @@ -"""Experimental supported virgin Q4/native-GE point descriptor modes. - -The full mixed pencil is retained. Physical half-cell rotations have inertia; -nodal beam rotation traces, eighteen resultants/member, Q4 normal spin and point -multipliers do not. No static/Guyan reduction, tangent averaging or mass floor. -Requested pairs are nearest the declared shift, not a complete lowest spectrum. -""" -from dataclasses import dataclass -from hashlib import sha256 - -import numpy as np -from scipy import sparse -from scipy.sparse.linalg import LinearOperator, eigs, ArpackError - -from .control import CancellationToken, SolveCancelled, cancellation_safe_point -from .linalg import MatrixClass, factorize_cached -from ._native_reference_modal import _owned -from ._ge_beam3_p5_centered.mass import reference_kinetic_factors +"""Experimental supported virgin Q4/native-GE point descriptor modes. + +The full mixed pencil is retained. Physical half-cell rotations have inertia; +nodal beam rotation traces, eighteen resultants/member, Q4 normal spin and point +multipliers do not. No static/Guyan reduction, tangent averaging or mass floor. +Requested pairs are nearest the declared shift, not a complete lowest spectrum. +""" +from dataclasses import dataclass +from hashlib import sha256 + +import numpy as np +from scipy import sparse +from scipy.sparse.linalg import LinearOperator, eigs, ArpackError + +from .control import CancellationToken, SolveCancelled, cancellation_safe_point +from .linalg import MatrixClass, factorize_cached +from ._native_reference_modal import _owned +from ._ge_beam3_p5_centered.mass import reference_kinetic_factors from ._stiffened_shell_physical_q4_mass import physical_mass from ._stiffened_shell_physical_s3_mass import physical_mass as s3_physical_mass from ._stiffened_shell_ge_mixed_modal_mass import native_physical_mass -from ._stiffened_shell_b2_q4_panel_experimental import _modal_scaled_residual - -POLICY = "GE_Q4_POINT_SUPPORTED_VIRGIN_FULL_DESCRIPTOR_REFERENCE_MODES_V1_EXPERIMENTAL" -MASS_POLICY = "Q4_DIRECTOR_AND_CENTERED_NATIVE_FULL_CELL_INERTIA_24_POINT_V1" +from ._stiffened_shell_b2_q4_panel_experimental import _modal_scaled_residual + +POLICY = "GE_Q4_POINT_SUPPORTED_VIRGIN_FULL_DESCRIPTOR_REFERENCE_MODES_V1_EXPERIMENTAL" +MASS_POLICY = "Q4_DIRECTOR_AND_CENTERED_NATIVE_FULL_CELL_INERTIA_24_POINT_V1" GE_FREE_FREE_MODAL_ONLY_V1 = "GE_CONNECTED_Q4_POINT_FREE_FREE_MODAL_ONLY_V1_EXPERIMENTAL" MIXED_POLICY = "GE_FLAT_Q4_S3_NATIVE_VIRGIN_FULL_DESCRIPTOR_REFERENCE_MODES_V1_EXPERIMENTAL" MIXED_MASS_POLICY = "Q4_DIRECTOR_S3_LINEAR_NODAL_DIRECTOR_CENTERED_NATIVE_FULL_CELL_INERTIA_24_POINT_V1" GE_MIXED_FREE_FREE_MODAL_ONLY_V1 = "GE_FLAT_Q4_S3_POINT_FREE_FREE_MODAL_ONLY_V1_EXPERIMENTAL" - - -@dataclass(frozen=True) -class GEReferenceModesRequest: - count: int = 3 - shift_hz: float = 1. - max_iterations: int = 600 - - def __post_init__(self): - if (type(self.count) is not int or self.count <= 0 or - type(self.max_iterations) is not int or self.max_iterations <= 0 or - type(self.shift_hz) not in (int, float) or - not np.isfinite(self.shift_hz) or self.shift_hz <= 0.): - raise ValueError("positive finite GE reference-mode controls required") - - -@dataclass(frozen=True) + + +@dataclass(frozen=True) +class GEReferenceModesRequest: + count: int = 3 + shift_hz: float = 1. + max_iterations: int = 600 + + def __post_init__(self): + if (type(self.count) is not int or self.count <= 0 or + type(self.max_iterations) is not int or self.max_iterations <= 0 or + type(self.shift_hz) not in (int, float) or + not np.isfinite(self.shift_hz) or self.shift_hz <= 0.): + raise ValueError("positive finite GE reference-mode controls required") + + +@dataclass(frozen=True) class GEReferenceModesResult: - status: str - model_identity: str - mass_identity: str = "" - frequencies_hz: tuple[float, ...] = () - eigenvalues_rad2_s2: tuple[float, ...] = () - full_coordinates: tuple[np.ndarray, ...] = () - shell_modes: tuple[np.ndarray, ...] = () - beam_modes: tuple[np.ndarray, ...] = () - multiplier_modes: tuple[np.ndarray, ...] = () - support_reactions: tuple[np.ndarray, ...] = () - equation_residuals: tuple[float, ...] = () - constraint_residuals: tuple[float, ...] = () - physical_equation_residuals: tuple[float, ...] = () - zero_inertia_dofs: tuple[int, ...] = () - inverse_eigenvalues: tuple[complex, ...] = () - factorization_count: int = 0 - solve_count: int = 0 - shift_hz: float = 0. - failure_reason: str | None = None - policy: str = POLICY - mass_policy: str = MASS_POLICY - selection: str = "requested finite pairs nearest shift; completeness unqualified" + status: str + model_identity: str + mass_identity: str = "" + frequencies_hz: tuple[float, ...] = () + eigenvalues_rad2_s2: tuple[float, ...] = () + full_coordinates: tuple[np.ndarray, ...] = () + shell_modes: tuple[np.ndarray, ...] = () + beam_modes: tuple[np.ndarray, ...] = () + multiplier_modes: tuple[np.ndarray, ...] = () + support_reactions: tuple[np.ndarray, ...] = () + equation_residuals: tuple[float, ...] = () + constraint_residuals: tuple[float, ...] = () + physical_equation_residuals: tuple[float, ...] = () + zero_inertia_dofs: tuple[int, ...] = () + inverse_eigenvalues: tuple[complex, ...] = () + factorization_count: int = 0 + solve_count: int = 0 + shift_hz: float = 0. + failure_reason: str | None = None + policy: str = POLICY + mass_policy: str = MASS_POLICY + selection: str = "requested finite pairs nearest shift; completeness unqualified" production_qualified: bool = False @@ -85,48 +85,48 @@ def __post_init__(self): class GEMixedReferenceModesResult(GEReferenceModesResult): policy: str = MIXED_POLICY mass_policy: str = MIXED_MASS_POLICY - - -@dataclass(frozen=True) -class GEFreeReferenceModesResult: - """Separate zero-mode space and flexible requested pairs; no legacy schema change.""" - status: str - model_identity: str - flexible: GEReferenceModesResult - rigid_origin_m: tuple[float, float, float] = () - canonical_rigid_coordinates: tuple[np.ndarray, ...] = () - rigid_coordinates: tuple[np.ndarray, ...] = () - rigid_multipliers: tuple[np.ndarray, ...] = () - rigid_kinetic_gram: np.ndarray | None = None - rigid_equation_residuals: tuple[float, ...] = () - rigid_constraint_residuals: tuple[float, ...] = () - rigid_flexible_mass_overlap: float = 0. - spectral_shift_rad2_s2: float = 0. - failure_reason: str | None = None - policy: str = GE_FREE_FREE_MODAL_ONLY_V1 - selection: str = "six verified canonical rigid fields and flexible pairs nearest negative shift; completeness unqualified" - production_qualified: bool = False - - -class _ModalFailure(RuntimeError): - pass - - + + +@dataclass(frozen=True) +class GEFreeReferenceModesResult: + """Separate zero-mode space and flexible requested pairs; no legacy schema change.""" + status: str + model_identity: str + flexible: GEReferenceModesResult + rigid_origin_m: tuple[float, float, float] = () + canonical_rigid_coordinates: tuple[np.ndarray, ...] = () + rigid_coordinates: tuple[np.ndarray, ...] = () + rigid_multipliers: tuple[np.ndarray, ...] = () + rigid_kinetic_gram: np.ndarray | None = None + rigid_equation_residuals: tuple[float, ...] = () + rigid_constraint_residuals: tuple[float, ...] = () + rigid_flexible_mass_overlap: float = 0. + spectral_shift_rad2_s2: float = 0. + failure_reason: str | None = None + policy: str = GE_FREE_FREE_MODAL_ONLY_V1 + selection: str = "six verified canonical rigid fields and flexible pairs nearest negative shift; completeness unqualified" + production_qualified: bool = False + + +class _ModalFailure(RuntimeError): + pass + + def _admit(owner, *, mixed=False): owner._require_open() - if owner._definition.distributing_footprints or owner._definition.finite_distributing_footprints: + if owner._definition.distributing_footprints or owner._definition.finite_distributing_footprints: raise ValueError('spectral operations exclude reference-linear distributing footprints') if getattr(owner,"_curved_reference",False): raise ValueError("curved reference spectra are not admitted") definition = owner._definition if not mixed and definition.modal_boundary_policy == GE_MIXED_FREE_FREE_MODAL_ONLY_V1: raise ValueError("mixed free-free boundary requires GEMixedReferenceModesRequest") - if (owner._accepted is not None or owner._finite_driver is not None or - owner._generation != 0): - raise ValueError("GE reference modes require a fresh virgin owner without accepted histories") + if (owner._accepted is not None or owner._finite_driver is not None or + owner._generation != 0): + raise ValueError("GE reference modes require a fresh virgin owner without accepted histories") if not mixed and (definition.lines or definition.footprints or definition.shell.s3_elements or - definition.shell.j2_curve is not None or owner._has_physical_fibre or - not definition.points or (not definition.fixed and not owner._modal_only)): + definition.shell.j2_curve is not None or owner._has_physical_fibre or + not definition.points or (not definition.fixed and not owner._modal_only)): raise ValueError("virgin elastic Q4/generalized-GE six-pose points required; lines, footprints, S3 and materials unsupported") if mixed: from ._stiffened_shell_l1_assembly_experimental import ExperimentalBL5Line @@ -140,118 +140,118 @@ def _admit(owner, *, mixed=False): if any(len(slots) == 18 and getattr(element, "formulation_id", None) != FORMULATION_ID for _, element, slots, _ in owner._shell_parts): raise ValueError("S3 linear nodal director mass requires actual direct18 V2D owner; bubble families unsupported") - if owner._unsupported_modes: - raise ValueError(owner._unsupported_modes[0]) - # The shell's compile seam already requires one connected cell graph. - # Native components use declared node identity, never coordinate merging. - neighbours = {node: set() for node in owner._beam_ids} - for element, _, _ in owner._beam_parts: - for node in element.node_ids: - neighbours[node].update(element.node_ids) + if owner._unsupported_modes: + raise ValueError(owner._unsupported_modes[0]) + # The shell's compile seam already requires one connected cell graph. + # Native components use declared node identity, never coordinate merging. + neighbours = {node: set() for node in owner._beam_ids} + for element, _, _ in owner._beam_parts: + for node in element.node_ids: + neighbours[node].update(element.node_ids) linked = {point.beam_node for point in definition.points} if mixed: for line in definition.lines: for member, _ in line.beam_halfcells: linked.update(owner._beam_parts[member][0].node_ids) - unseen = set(neighbours) - while unseen: - start = min(unseen) - component = {start}; pending = [start] - while pending: - for other in neighbours[pending.pop()]-component: - component.add(other); pending.append(other) - if not component.intersection(linked): - raise ValueError("connected reference-modal panel requires every native beam component linked by a six-pose point to the shell") - unseen.difference_update(component) - # Bounded six-column physical rigid-field detectability, not a global - # stiffness/kernel test. Reject partial/free supports in this first scope. - rigid = np.zeros((owner._K.shape[0], 6)) - for offset, xyz in ((0, owner._shell_xyz), - (owner._shell_count, np.array([owner._beam_nodes[i][0] - for i in owner._beam_ids]))): - for i, position in enumerate(xyz): - row = offset+6*i - rigid[row:row+3, :3] = np.eye(3) - for j in range(3): - rigid[row:row+3, 3+j] = np.cross(np.eye(3)[j], position) - rigid[row+3:row+6, 3:] = np.eye(3) - if not owner._modal_only: - supported = rigid[owner._fixed] - scales = np.linalg.norm(supported, axis=0) - if np.any(scales == 0.): - raise ValueError("all six physical rigid fields require supported detectability") - singular = np.linalg.svd(supported/scales, compute_uv=False) - if len(singular) < 6 or singular[-1] <= 64*np.finfo(float).eps*max(supported.shape)*singular[0]: - raise ValueError("all six physical rigid fields require supported detectability") - for inertia in owner._reference_modal_inertias: - _physical_spatial_inertia(inertia) - - -def _physical_spatial_inertia(matrix): - """New-operation physical spatial admission; never project legacy input. - - Relative 128-epsilon budgets cover the bounded 3x3 arithmetic and eigen - evaluation. This is binary64 spatial realizability, not a planar-section - geometry certificate. The captured native tensor is used without changes. - """ - a = np.asarray(matrix) - if a.shape != (6, 6) or not np.isfinite(a).all() or not np.array_equal(a, a.T): - raise ValueError("explicit symmetric physical spatial inertia required") - eps = 128*np.finfo(float).eps - with np.errstate(over="ignore", invalid="ignore"): - m = float(np.trace(a[:3, :3])/3.) - if not np.isfinite(m): - raise ValueError("physical spatial inertia scalar mass is not representable") - translation_scale = max(float(np.max(abs(a[:3, :3]))), abs(m)) - if m <= 0. or np.max(abs(a[:3, :3]-m*np.eye(3))) > eps*translation_scale: - raise ValueError("physical spatial inertia translation must equal positive mass times identity") - cross = a[:3, 3:] - cross_scale = float(np.max(abs(cross), initial=0.)) - if np.max(abs(cross+cross.T), initial=0.) > eps*cross_scale: - raise ValueError("physical spatial inertia requires skew first-moment coupling") - # cross=-[h]x. Do not symmetrize/project the supplied cross block. - h = np.array((cross[1, 2], cross[2, 0], cross[0, 1])) - with np.errstate(over="ignore", invalid="ignore", divide="ignore"): - c = h/m - if not np.isfinite(c).all(): - raise ValueError("physical spatial inertia centroid is not representable") - with np.errstate(over="ignore", invalid="ignore"): - parallel = m*((c@c)*np.eye(3)-np.outer(c, c)) - if not np.isfinite(parallel).all(): - raise ValueError("physical spatial inertia parallel-axis term is not representable") - with np.errstate(over="ignore", invalid="ignore"): - central = a[3:, 3:]-parallel - second = .5*np.trace(central)*np.eye(3)-central - if not np.isfinite(central).all() or not np.isfinite(second).all(): - raise ValueError("physical spatial inertia central second moment is not representable") - scale = max(float(np.linalg.norm(a[3:, 3:], 2)), - float(np.linalg.norm(parallel, 2))) - budget = eps*scale - eigenvalues = np.linalg.eigvalsh(second) - if not np.isfinite(budget) or not np.isfinite(eigenvalues).all(): - raise ValueError("physical spatial inertia realizability evaluation is not representable") - if eigenvalues[0] < -budget: - raise ValueError("physical spatial inertia violates central second-moment realizability") - return m, c, central - - + unseen = set(neighbours) + while unseen: + start = min(unseen) + component = {start}; pending = [start] + while pending: + for other in neighbours[pending.pop()]-component: + component.add(other); pending.append(other) + if not component.intersection(linked): + raise ValueError("connected reference-modal panel requires every native beam component linked by a six-pose point to the shell") + unseen.difference_update(component) + # Bounded six-column physical rigid-field detectability, not a global + # stiffness/kernel test. Reject partial/free supports in this first scope. + rigid = np.zeros((owner._K.shape[0], 6)) + for offset, xyz in ((0, owner._shell_xyz), + (owner._shell_count, np.array([owner._beam_nodes[i][0] + for i in owner._beam_ids]))): + for i, position in enumerate(xyz): + row = offset+6*i + rigid[row:row+3, :3] = np.eye(3) + for j in range(3): + rigid[row:row+3, 3+j] = np.cross(np.eye(3)[j], position) + rigid[row+3:row+6, 3:] = np.eye(3) + if not owner._modal_only: + supported = rigid[owner._fixed] + scales = np.linalg.norm(supported, axis=0) + if np.any(scales == 0.): + raise ValueError("all six physical rigid fields require supported detectability") + singular = np.linalg.svd(supported/scales, compute_uv=False) + if len(singular) < 6 or singular[-1] <= 64*np.finfo(float).eps*max(supported.shape)*singular[0]: + raise ValueError("all six physical rigid fields require supported detectability") + for inertia in owner._reference_modal_inertias: + _physical_spatial_inertia(inertia) + + +def _physical_spatial_inertia(matrix): + """New-operation physical spatial admission; never project legacy input. + + Relative 128-epsilon budgets cover the bounded 3x3 arithmetic and eigen + evaluation. This is binary64 spatial realizability, not a planar-section + geometry certificate. The captured native tensor is used without changes. + """ + a = np.asarray(matrix) + if a.shape != (6, 6) or not np.isfinite(a).all() or not np.array_equal(a, a.T): + raise ValueError("explicit symmetric physical spatial inertia required") + eps = 128*np.finfo(float).eps + with np.errstate(over="ignore", invalid="ignore"): + m = float(np.trace(a[:3, :3])/3.) + if not np.isfinite(m): + raise ValueError("physical spatial inertia scalar mass is not representable") + translation_scale = max(float(np.max(abs(a[:3, :3]))), abs(m)) + if m <= 0. or np.max(abs(a[:3, :3]-m*np.eye(3))) > eps*translation_scale: + raise ValueError("physical spatial inertia translation must equal positive mass times identity") + cross = a[:3, 3:] + cross_scale = float(np.max(abs(cross), initial=0.)) + if np.max(abs(cross+cross.T), initial=0.) > eps*cross_scale: + raise ValueError("physical spatial inertia requires skew first-moment coupling") + # cross=-[h]x. Do not symmetrize/project the supplied cross block. + h = np.array((cross[1, 2], cross[2, 0], cross[0, 1])) + with np.errstate(over="ignore", invalid="ignore", divide="ignore"): + c = h/m + if not np.isfinite(c).all(): + raise ValueError("physical spatial inertia centroid is not representable") + with np.errstate(over="ignore", invalid="ignore"): + parallel = m*((c@c)*np.eye(3)-np.outer(c, c)) + if not np.isfinite(parallel).all(): + raise ValueError("physical spatial inertia parallel-axis term is not representable") + with np.errstate(over="ignore", invalid="ignore"): + central = a[3:, 3:]-parallel + second = .5*np.trace(central)*np.eye(3)-central + if not np.isfinite(central).all() or not np.isfinite(second).all(): + raise ValueError("physical spatial inertia central second moment is not representable") + scale = max(float(np.linalg.norm(a[3:, 3:], 2)), + float(np.linalg.norm(parallel, 2))) + budget = eps*scale + eigenvalues = np.linalg.eigvalsh(second) + if not np.isfinite(budget) or not np.isfinite(eigenvalues).all(): + raise ValueError("physical spatial inertia realizability evaluation is not representable") + if eigenvalues[0] < -budget: + raise ValueError("physical spatial inertia violates central second-moment realizability") + return m, c, central + + def capabilities(owner): - """Separate explicit route descriptor; legacy capability schema is unchanged.""" - reason = None - try: - _admit(owner) - except (ValueError, RuntimeError) as exc: - reason = str(exc) - free = owner._modal_only - return dict(policy=GE_FREE_FREE_MODAL_ONLY_V1 if free else POLICY, mass_policy=MASS_POLICY, - status="EXPERIMENTAL_NOT_QUALIFIED", operation="modes", scope=("connected free-free virgin Q4/GE point panel modal-only" if free else "connected supported virgin Q4/GE point panel reference only"), - eligible=reason is None, ineligibility_reason=reason, - mass_source="explicit native definition inertia; explicit shell density and thickness", - mass_admission="binary64 physical 3D spatial inertia; planar section realizability unqualified", - inertia="nodal translations and six native half-cell rotations; tangential shell directors", - algebraic="native nodal rotation traces, eighteen resultants/member, Q4 normal spin and multipliers", - selection=("six canonical rigid fields and requested flexible pairs nearest negative shift; completeness unqualified" if free else "requested finite pairs nearest shift; completeness unqualified"), - excluded=(("static solve", "finite solve", "restore", "chart state writes") if free else ("free-free",))+("prestress", "buckling", "finite dynamics", "accepted material histories", "S3", "line", "footprint"), + """Separate explicit route descriptor; legacy capability schema is unchanged.""" + reason = None + try: + _admit(owner) + except (ValueError, RuntimeError) as exc: + reason = str(exc) + free = owner._modal_only + return dict(policy=GE_FREE_FREE_MODAL_ONLY_V1 if free else POLICY, mass_policy=MASS_POLICY, + status="EXPERIMENTAL_NOT_QUALIFIED", operation="modes", scope=("connected free-free virgin Q4/GE point panel modal-only" if free else "connected supported virgin Q4/GE point panel reference only"), + eligible=reason is None, ineligibility_reason=reason, + mass_source="explicit native definition inertia; explicit shell density and thickness", + mass_admission="binary64 physical 3D spatial inertia; planar section realizability unqualified", + inertia="nodal translations and six native half-cell rotations; tangential shell directors", + algebraic="native nodal rotation traces, eighteen resultants/member, Q4 normal spin and multipliers", + selection=("six canonical rigid fields and requested flexible pairs nearest negative shift; completeness unqualified" if free else "requested finite pairs nearest shift; completeness unqualified"), + excluded=(("static solve", "finite solve", "restore", "chart state writes") if free else ("free-free",))+("prestress", "buckling", "finite dynamics", "accepted material histories", "S3", "line", "footprint"), production_qualified=False) @@ -273,308 +273,308 @@ def mixed_capabilities(owner): excluded=("accepted histories", "prestress", "active plasticity", "shell J2", "material BL5", "chart state", "curved shell", "footprints"), production_qualified=False) - - + + def _assemble_mass(owner, check=lambda stage: None, *, mixed=False): - """Reuse physical local kinetic laws and the owner's authoritative slots.""" + """Reuse physical local kinetic laws and the owner's authoritative slots.""" cache_name = "_mixed_reference_modal_mass" if mixed else "_reference_modal_mass" cached = getattr(owner, cache_name, None) if cached is not None: check("cached_mass") return cached - rows = []; columns = []; values = [] - zero = {6*i+5 for i in range(len(owner._shell_ids))} - offset = owner._shell_count - zero.update(offset+6*i+j for i in range(len(owner._beam_ids)) for j in (3, 4, 5)) - def scatter(slots, matrix): - rows.extend(np.repeat(slots, len(slots))) - columns.extend(np.tile(slots, len(slots))) - values.extend(matrix.ravel()) - panel = owner._definition.shell - for _, _, slots, _ in owner._shell_parts: - check("shell_mass") - vertices = owner._shell_xyz[np.asarray(slots)[::6]//6] + rows = []; columns = []; values = [] + zero = {6*i+5 for i in range(len(owner._shell_ids))} + offset = owner._shell_count + zero.update(offset+6*i+j for i in range(len(owner._beam_ids)) for j in (3, 4, 5)) + def scatter(slots, matrix): + rows.extend(np.repeat(slots, len(slots))) + columns.extend(np.tile(slots, len(slots))) + values.extend(matrix.ravel()) + panel = owner._definition.shell + for _, _, slots, _ in owner._shell_parts: + check("shell_mass") + vertices = owner._shell_xyz[np.asarray(slots)[::6]//6] law = s3_physical_mass if mixed and len(slots) == 18 else physical_mass scatter(slots, law(vertices, density_kg_m3=panel.density_kg_m3, - thickness_m=panel.thickness_m)) - for inertia, (element, slots, _) in zip(owner._reference_modal_inertias, owner._beam_parts): - check("beam_mass") - _physical_spatial_inertia(inertia) + thickness_m=panel.thickness_m)) + for inertia, (element, slots, _) in zip(owner._reference_modal_inertias, owner._beam_parts): + check("beam_mass") + _physical_spatial_inertia(inertia) if mixed: local = native_physical_mass(element.operator.reference, inertia) else: factors = reference_kinetic_factors(element.operator.reference, element.section.elastic, inertia, order=24) local = factors.full.T@factors.full - if not np.isfinite(local).all(): - raise ValueError("finite explicit native reference inertia required") - # slots are beam-local global incidences; the first24 retain nodal18 - # and inertial cell6. The following eighteen resultants stay massless. - scatter(offset+slots[:24], local) - zero.update(int(offset+slot) for slot in slots[24:]) - mass = sparse.coo_matrix((values, (rows, columns)), shape=owner._K.shape).tocsr() - mass.sum_duplicates(); mass.eliminate_zeros(); mass.sort_indices() - zero = tuple(sorted(zero)) - if (not np.isfinite(mass.data).all() or mass[:, zero].nnz or mass[zero, :].nnz): - raise ValueError("declared reference algebraic inertia must be exactly absent") - if np.any(mass.diagonal()[[i for i in range(mass.shape[0]) if i not in zero]] <= 0.): - raise ValueError("positive physical reference coordinate inertia required") - digest = sha256() + if not np.isfinite(local).all(): + raise ValueError("finite explicit native reference inertia required") + # slots are beam-local global incidences; the first24 retain nodal18 + # and inertial cell6. The following eighteen resultants stay massless. + scatter(offset+slots[:24], local) + zero.update(int(offset+slot) for slot in slots[24:]) + mass = sparse.coo_matrix((values, (rows, columns)), shape=owner._K.shape).tocsr() + mass.sum_duplicates(); mass.eliminate_zeros(); mass.sort_indices() + zero = tuple(sorted(zero)) + if (not np.isfinite(mass.data).all() or mass[:, zero].nnz or mass[zero, :].nnz): + raise ValueError("declared reference algebraic inertia must be exactly absent") + if np.any(mass.diagonal()[[i for i in range(mass.shape[0]) if i not in zero]] <= 0.): + raise ValueError("positive physical reference coordinate inertia required") + digest = sha256() digest.update(owner._identity.encode("ascii")) digest.update((MIXED_MASS_POLICY if mixed else MASS_POLICY).encode("ascii")) - for array in (mass.indptr, mass.indices, mass.data): digest.update(array.tobytes()) - # Immutable byte-backed arrays; publication only after complete preparation. - for name in ("data", "indices", "indptr"): - array = getattr(mass, name) - setattr(mass, name, np.frombuffer(array.tobytes(), dtype=array.dtype)) - check("mass_publish") + for array in (mass.indptr, mass.indices, mass.data): digest.update(array.tobytes()) + # Immutable byte-backed arrays; publication only after complete preparation. + for name in ("data", "indices", "indptr"): + array = getattr(mass, name) + setattr(mass, name, np.frombuffer(array.tobytes(), dtype=array.dtype)) + check("mass_publish") result = (mass, zero, digest.hexdigest()) setattr(owner, cache_name, result) return result - - -def _congruence(owner, A, B): - # Reuse the established scale calculation with its correct native packing, - # exclusively for this new route. No legacy solve or stored scale changes. - from ._stiffened_shell_ge_experimental import _reference_scales - _, shell, beam = _reference_scales(owner._shell_xyz, owner._beam_nodes, - owner._beam_parts, owner._shell_count, owner._beam_count, - footprint_retained_roles=True) - primal = np.r_[shell, beam][owner._free] - Dp = sparse.diags(primal) - weighted = (Dp@owner._K[owner._free, :][:, owner._free]@Dp).tocsr() - work = float(np.max(np.abs(weighted.data), initial=0.)) - if not np.isfinite(work) or work <= 0.: - raise _ModalFailure("positive representable reference work scale required") - scale = np.r_[primal/np.sqrt(work), np.sqrt(work)/owner._constraint_scale] - if not np.isfinite(scale).all() or np.any(scale <= 0.): - raise _ModalFailure("reference modal congruence is not representable") - D = sparse.diags(scale) - As, Bs = (D@A@D).tocsc(), (D@B@D).tocsc() - for original, scaled in ((A, As), (B, Bs)): - old = original.copy(); old.eliminate_zeros(); old.sort_indices() - scaled.eliminate_zeros(); scaled.sort_indices() - if (not np.isfinite(scaled.data).all() or old.nnz != scaled.nnz or - not np.array_equal(old.indptr, scaled.indptr) or - not np.array_equal(old.indices, scaled.indices)): - raise _ModalFailure("modal matrix entries lost through congruence") - denominator = float(np.max(np.abs(scaled.data), initial=0.)) - delta = scaled-scaled.T - if denominator == 0. or np.max(np.abs(delta.data), initial=0.) > 1e-10*denominator: - raise _ModalFailure("conservative reference pencil symmetry unresolved; no averaging permitted") - return As, Bs, scale - - -def _free_rigid_space(owner, mass, scale, Bs, check): - """Six physical common-body velocities; only a bounded 6x6 Gram solve.""" - origin = owner._shell_xyz.mean(axis=0) - R = np.zeros((owner._K.shape[0], 6)) - for offset, xyz in ((0, owner._shell_xyz), - (owner._shell_count, np.array([owner._beam_nodes[i][0] - for i in owner._beam_ids]))): - for i, position in enumerate(xyz): - row = offset+6*i - R[row:row+3, :3] = np.eye(3) - for j in range(3): - R[row:row+3, 3+j] = np.cross(np.eye(3)[j], position-origin) - R[row+3:row+6, 3:] = np.eye(3) - for _, slots, _ in owner._beam_parts: - R[owner._shell_count+slots[18:21], 3:] = np.eye(3) - R[owner._shell_count+slots[21:24], 3:] = np.eye(3) - n = len(owner._free) - equations = []; gaps = [] - for column in R.T: - check("rigid_field") - equation = _modal_scaled_residual(owner._K@column, - abs(owner._K)@abs(column), scale[:n]) - gap = _modal_scaled_residual(owner._C@column, - abs(owner._C)@abs(column), scale[n:]) - if equation > 1e-8 or gap > 1e-9: - raise _ModalFailure("canonical free-free rigid field violates physical K or point C") - equations.append(equation); gaps.append(gap) - gram = R.T@mass@R - if (not np.isfinite(gram).all() or - np.max(abs(gram-gram.T)) > 1e-10*np.max(abs(gram))): - raise _ModalFailure("canonical rigid kinetic Gram symmetry unresolved") - try: - lower = np.linalg.cholesky(gram) - W = R@np.linalg.solve(lower.T, np.eye(6)) - except np.linalg.LinAlgError as exc: - raise _ModalFailure("six physical rigid fields require positive kinetic Gram") from exc - if (not np.isfinite(W).all() or - np.max(abs(W.T@mass@W-np.eye(6))) > 1e-7): - raise _ModalFailure("rigid kinetic normalization unresolved") - Ws = np.vstack((W, np.zeros((owner._C.shape[0], 6))))/scale[:, None] - if not np.isfinite(Ws).all() or np.max(abs(Ws.T@Bs@Ws-np.eye(6))) > 1e-7: - raise _ModalFailure("rigid congruence reconstruction unresolved") - return dict(origin=tuple(map(float, origin)), canonical=R, normalized=W, - scaled=Ws, gram=gram, equations=tuple(equations), gaps=tuple(gaps)) - - + + +def _congruence(owner, A, B): + # Reuse the established scale calculation with its correct native packing, + # exclusively for this new route. No legacy solve or stored scale changes. + from ._stiffened_shell_ge_experimental import _reference_scales + _, shell, beam = _reference_scales(owner._shell_xyz, owner._beam_nodes, + owner._beam_parts, owner._shell_count, owner._beam_count, + footprint_retained_roles=True) + primal = np.r_[shell, beam][owner._free] + Dp = sparse.diags(primal) + weighted = (Dp@owner._K[owner._free, :][:, owner._free]@Dp).tocsr() + work = float(np.max(np.abs(weighted.data), initial=0.)) + if not np.isfinite(work) or work <= 0.: + raise _ModalFailure("positive representable reference work scale required") + scale = np.r_[primal/np.sqrt(work), np.sqrt(work)/owner._constraint_scale] + if not np.isfinite(scale).all() or np.any(scale <= 0.): + raise _ModalFailure("reference modal congruence is not representable") + D = sparse.diags(scale) + As, Bs = (D@A@D).tocsc(), (D@B@D).tocsc() + for original, scaled in ((A, As), (B, Bs)): + old = original.copy(); old.eliminate_zeros(); old.sort_indices() + scaled.eliminate_zeros(); scaled.sort_indices() + if (not np.isfinite(scaled.data).all() or old.nnz != scaled.nnz or + not np.array_equal(old.indptr, scaled.indptr) or + not np.array_equal(old.indices, scaled.indices)): + raise _ModalFailure("modal matrix entries lost through congruence") + denominator = float(np.max(np.abs(scaled.data), initial=0.)) + delta = scaled-scaled.T + if denominator == 0. or np.max(np.abs(delta.data), initial=0.) > 1e-10*denominator: + raise _ModalFailure("conservative reference pencil symmetry unresolved; no averaging permitted") + return As, Bs, scale + + +def _free_rigid_space(owner, mass, scale, Bs, check): + """Six physical common-body velocities; only a bounded 6x6 Gram solve.""" + origin = owner._shell_xyz.mean(axis=0) + R = np.zeros((owner._K.shape[0], 6)) + for offset, xyz in ((0, owner._shell_xyz), + (owner._shell_count, np.array([owner._beam_nodes[i][0] + for i in owner._beam_ids]))): + for i, position in enumerate(xyz): + row = offset+6*i + R[row:row+3, :3] = np.eye(3) + for j in range(3): + R[row:row+3, 3+j] = np.cross(np.eye(3)[j], position-origin) + R[row+3:row+6, 3:] = np.eye(3) + for _, slots, _ in owner._beam_parts: + R[owner._shell_count+slots[18:21], 3:] = np.eye(3) + R[owner._shell_count+slots[21:24], 3:] = np.eye(3) + n = len(owner._free) + equations = []; gaps = [] + for column in R.T: + check("rigid_field") + equation = _modal_scaled_residual(owner._K@column, + abs(owner._K)@abs(column), scale[:n]) + gap = _modal_scaled_residual(owner._C@column, + abs(owner._C)@abs(column), scale[n:]) + if equation > 1e-8 or gap > 1e-9: + raise _ModalFailure("canonical free-free rigid field violates physical K or point C") + equations.append(equation); gaps.append(gap) + gram = R.T@mass@R + if (not np.isfinite(gram).all() or + np.max(abs(gram-gram.T)) > 1e-10*np.max(abs(gram))): + raise _ModalFailure("canonical rigid kinetic Gram symmetry unresolved") + try: + lower = np.linalg.cholesky(gram) + W = R@np.linalg.solve(lower.T, np.eye(6)) + except np.linalg.LinAlgError as exc: + raise _ModalFailure("six physical rigid fields require positive kinetic Gram") from exc + if (not np.isfinite(W).all() or + np.max(abs(W.T@mass@W-np.eye(6))) > 1e-7): + raise _ModalFailure("rigid kinetic normalization unresolved") + Ws = np.vstack((W, np.zeros((owner._C.shape[0], 6))))/scale[:, None] + if not np.isfinite(Ws).all() or np.max(abs(Ws.T@Bs@Ws-np.eye(6))) > 1e-7: + raise _ModalFailure("rigid congruence reconstruction unresolved") + return dict(origin=tuple(map(float, origin)), canonical=R, normalized=W, + scaled=Ws, gram=gram, equations=tuple(equations), gaps=tuple(gaps)) + + def solve(owner, request, *, cancellation_token=None): mixed = type(request) is GEMixedReferenceModesRequest _admit(owner, mixed=mixed) if type(request) not in (GEReferenceModesRequest, GEMixedReferenceModesRequest): - raise ValueError("typed GE reference-mode request required") - if cancellation_token is not None and not isinstance(cancellation_token, CancellationToken): - raise ValueError("CancellationToken required") - n = len(owner._free); r = owner._C.shape[0] - if request.count >= n+r-1: - raise ValueError("reference mode count must leave sparse Arnoldi room") - sigma = float((2*np.pi*request.shift_hz)**2) - if not np.isfinite(sigma) or sigma <= 0.: - raise ValueError("positive representable squared reference frequency required") - free = owner._modal_only - if free: sigma = -sigma - handle = None; raw = (); mass_id = ""; zero = () - rigid = None; overlap = 0. - def check(stage): - cancellation_safe_point(cancellation_token, "ge_reference_modes."+stage) - def finish(status, **kwargs): - if free: - kwargs.update(policy=GE_FREE_FREE_MODAL_ONLY_V1, - selection="flexible finite pairs nearest negative shift; completeness unqualified") + raise ValueError("typed GE reference-mode request required") + if cancellation_token is not None and not isinstance(cancellation_token, CancellationToken): + raise ValueError("CancellationToken required") + n = len(owner._free); r = owner._C.shape[0] + if request.count >= n+r-1: + raise ValueError("reference mode count must leave sparse Arnoldi room") + sigma = float((2*np.pi*request.shift_hz)**2) + if not np.isfinite(sigma) or sigma <= 0.: + raise ValueError("positive representable squared reference frequency required") + free = owner._modal_only + if free: sigma = -sigma + handle = None; raw = (); mass_id = ""; zero = () + rigid = None; overlap = 0. + def check(stage): + cancellation_safe_point(cancellation_token, "ge_reference_modes."+stage) + def finish(status, **kwargs): + if free: + kwargs.update(policy=GE_FREE_FREE_MODAL_ONLY_V1, + selection="flexible finite pairs nearest negative shift; completeness unqualified") if mixed: kwargs["policy"] = GE_MIXED_FREE_FREE_MODAL_ONLY_V1 if free else MIXED_POLICY result_type = GEMixedReferenceModesResult if mixed else GEReferenceModesResult flexible = result_type(status, owner._identity, mass_id, - zero_inertia_dofs=zero, inverse_eigenvalues=raw, - factorization_count=handle.factorization_count if handle else 0, - solve_count=handle.solve_count if handle else 0, - shift_hz=float(request.shift_hz), **kwargs) - if not free: return flexible - data = {} - if status == "completed": - data = dict(rigid_origin_m=rigid["origin"], - canonical_rigid_coordinates=tuple(_owned(x) for x in rigid["canonical"].T), - rigid_coordinates=tuple(_owned(x) for x in rigid["normalized"].T), - rigid_multipliers=tuple(_owned(np.zeros(r)) for _ in range(6)), - rigid_kinetic_gram=_owned(rigid["gram"]), - rigid_equation_residuals=rigid["equations"], - rigid_constraint_residuals=rigid["gaps"], - rigid_flexible_mass_overlap=overlap) + zero_inertia_dofs=zero, inverse_eigenvalues=raw, + factorization_count=handle.factorization_count if handle else 0, + solve_count=handle.solve_count if handle else 0, + shift_hz=float(request.shift_hz), **kwargs) + if not free: return flexible + data = {} + if status == "completed": + data = dict(rigid_origin_m=rigid["origin"], + canonical_rigid_coordinates=tuple(_owned(x) for x in rigid["canonical"].T), + rigid_coordinates=tuple(_owned(x) for x in rigid["normalized"].T), + rigid_multipliers=tuple(_owned(np.zeros(r)) for _ in range(6)), + rigid_kinetic_gram=_owned(rigid["gram"]), + rigid_equation_residuals=rigid["equations"], + rigid_constraint_residuals=rigid["gaps"], + rigid_flexible_mass_overlap=overlap) if mixed: data["policy"] = GE_MIXED_FREE_FREE_MODAL_ONLY_V1 return GEFreeReferenceModesResult(status, owner._identity, flexible, - spectral_shift_rad2_s2=sigma, failure_reason=flexible.failure_reason, **data) - try: - check("start") + spectral_shift_rad2_s2=sigma, failure_reason=flexible.failure_reason, **data) + try: + check("start") mass, zero, mass_id = _assemble_mass(owner, check, mixed=mixed) - B = sparse.block_diag((mass[owner._free, :][:, owner._free], - sparse.csc_matrix((r, r))), format="csc") - A = owner._A.copy() - As, Bs, scale = _congruence(owner, A, B) - if free: - rigid = _free_rigid_space(owner, mass, scale, Bs, check) - def project(vector): - if not free: return vector - return vector-rigid["scaled"]@(rigid["scaled"].T@(Bs@vector)) - check("before_factorization") - handle = factorize_cached((As-sigma*Bs).tocsc(), MatrixClass.GENERAL) - if handle.status != "ok": - raise _ModalFailure("reference modal factorization failed: "+str(handle.failure_reason)) - def action(vector): - check("iteration") - try: - answer = np.asarray(handle.solve(Bs@project(vector)), dtype=float) - except RuntimeError as exc: - if (str(exc) == "Sparse solve produced NaN/Inf values" or - str(exc).startswith("Cannot solve with failed factorization:")): - raise _ModalFailure("reference modal sparse solve failed: "+str(exc)) from exc - raise - if not np.isfinite(answer).all(): - raise _ModalFailure("finite reference modal inverse action required") - check("iteration_complete") - return project(answer) - values, vectors = eigs(LinearOperator(A.shape, matvec=action, dtype=float), - k=request.count, which="LM", tol=1e-10, maxiter=request.max_iterations, - v0=np.linspace(1., 2., A.shape[0])) - raw = tuple(map(complex, values)) - check("after_iteration") - abs_A, abs_B = abs(A), abs(B) - pairs = [] - for mu, vector in zip(values, vectors.T): - if (not np.isfinite(mu) or mu.real == 0. or - abs(mu.imag) > 1e-8*abs(mu.real) or - np.max(abs(vector.imag)) > 1e-8*np.max(abs(vector.real))): - raise _ModalFailure("nonphysical or unresolved finite reference pair") - eigenvalue = sigma+1./float(mu.real) - if free: - # Retain the separate shift/reconstruction cancellation guard. - roundoff_screen = 64*np.finfo(float).eps*A.shape[0]*(abs(sigma)+abs(1./float(mu.real))) - if not np.isfinite(roundoff_screen) or eigenvalue <= roundoff_screen: - raise _ModalFailure("extra mechanism or unresolved near-zero flexible pair") - x = scale*np.asarray(vector.real) - q = np.zeros(owner._K.shape[0]); q[owner._free] = x[:n] - if free: - # Physical quadratic-work resolution screen on the reconstructed - # candidate (the congruence inverse applied to the Krylov vector). - # The pair is resolvable only when its inertial quadratic work - # exceeds the abs-coefficient quadratic-work roundoff of this - # candidate's elastic and descriptor constraint work. Both sides - # are physical energy, so the decision is invariant under - # equivalent diagonal unit/coordinate rescalings. Absolute-entry - # bounds can vary under general frame rotations; this is a - # conservative resolution screen, not a frame-invariance proof. - # Its coefficient uncertainty uses no fitted eigenvalue or shift. Cancellation/roundoff - # screen only: not a certified Arnoldi/LU eigenvalue error bound - # or exactly-six nullity proof. - kinetic = float(q@mass@q) - work = eigenvalue*kinetic - uncertainty = 64*np.finfo(float).eps*A.shape[0]*( - float((abs(owner._K)@abs(q))@abs(q))+ - 2.*float((abs(owner._C).T@abs(x[n:]))@abs(q))) - if (not np.isfinite(work) or not np.isfinite(uncertainty) or - work <= uncertainty): - raise _ModalFailure("extra mechanism or unresolved near-zero flexible pair") - norm = float(q@mass@q) - if not np.isfinite(eigenvalue) or eigenvalue <= 0. or not np.isfinite(norm) or norm <= 0.: - raise _ModalFailure("positive finite eigenvalue and physical modal mass required") - x /= np.sqrt(norm); q /= np.sqrt(norm) - if not np.isfinite(x).all() or not np.isfinite(q).all(): - raise _ModalFailure("physical reference mode normalization is not representable") - # Sign uses physical inertial coordinates, not massless resultants. - physical_slots = np.setdiff1d(np.arange(len(q)), zero) - largest = physical_slots[int(np.argmax(np.abs(q[physical_slots])))] - if q[largest] < 0.: x = -x; q = -q - lam = x[n:] - residual = A@x-eigenvalue*(B@x) - bound = abs_A@abs(x)+abs(eigenvalue)*(abs_B@abs(x)) - equation = _modal_scaled_residual(residual, bound, scale) - gap = owner._C@q - constraint = _modal_scaled_residual(gap, abs(owner._C)@abs(q), scale[n:]) - reactions = owner._K@q+owner._C.T@lam-eigenvalue*(mass@q) - physical_bound = abs(owner._K)@abs(q)+abs(owner._C.T)@abs(lam)+abs(eigenvalue)*(abs(mass)@abs(q)) - physical = _modal_scaled_residual(reactions[owner._free], - physical_bound[owner._free], scale[:n]) - if equation > 1e-8 or physical > 1e-8 or constraint > 1e-9: - raise _ModalFailure("reference modal physical equation or constraint residual failed") - pairs.append((float(eigenvalue), _owned(q), _owned(lam), _owned(reactions), - equation, constraint, physical)) - pairs.sort(key=lambda item: item[0]) - modes = np.column_stack([pair[1] for pair in pairs]) - gram = modes.T@mass@modes - if not np.isfinite(gram).all() or np.max(abs(gram-np.eye(request.count))) > 1e-7: - raise _ModalFailure("physical reference modal mass orthogonality failed") - if free: - overlap = float(np.max(abs(rigid["normalized"].T@mass@modes))) - if not np.isfinite(overlap) or overlap > 1e-7: - raise _ModalFailure("rigid and flexible physical mode spaces not mass orthogonal") - check("publish") - return finish("completed", frequencies_hz=tuple(np.sqrt(p[0])/(2*np.pi) for p in pairs), - eigenvalues_rad2_s2=tuple(p[0] for p in pairs), - full_coordinates=tuple(p[1] for p in pairs), - shell_modes=tuple(_owned(p[1][:owner._shell_count]) for p in pairs), - beam_modes=tuple(_owned(p[1][owner._shell_count:]) for p in pairs), - multiplier_modes=tuple(p[2] for p in pairs), support_reactions=tuple(p[3] for p in pairs), - equation_residuals=tuple(p[4] for p in pairs), - constraint_residuals=tuple(p[5] for p in pairs), - physical_equation_residuals=tuple(p[6] for p in pairs)) - except SolveCancelled as exc: - return finish("cancelled", failure_reason=str(exc)) - except (ArpackError, _ModalFailure) as exc: - partial = getattr(exc, "eigenvalues", None) - if partial is not None: raw = tuple(map(complex, partial)) - return finish("failed", failure_reason=str(exc)) - finally: - # Do not retain a factor through an operation closure/error traceback. - handle = None + B = sparse.block_diag((mass[owner._free, :][:, owner._free], + sparse.csc_matrix((r, r))), format="csc") + A = owner._A.copy() + As, Bs, scale = _congruence(owner, A, B) + if free: + rigid = _free_rigid_space(owner, mass, scale, Bs, check) + def project(vector): + if not free: return vector + return vector-rigid["scaled"]@(rigid["scaled"].T@(Bs@vector)) + check("before_factorization") + handle = factorize_cached((As-sigma*Bs).tocsc(), MatrixClass.GENERAL) + if handle.status != "ok": + raise _ModalFailure("reference modal factorization failed: "+str(handle.failure_reason)) + def action(vector): + check("iteration") + try: + answer = np.asarray(handle.solve(Bs@project(vector)), dtype=float) + except RuntimeError as exc: + if (str(exc) == "Sparse solve produced NaN/Inf values" or + str(exc).startswith("Cannot solve with failed factorization:")): + raise _ModalFailure("reference modal sparse solve failed: "+str(exc)) from exc + raise + if not np.isfinite(answer).all(): + raise _ModalFailure("finite reference modal inverse action required") + check("iteration_complete") + return project(answer) + values, vectors = eigs(LinearOperator(A.shape, matvec=action, dtype=float), + k=request.count, which="LM", tol=1e-10, maxiter=request.max_iterations, + v0=np.linspace(1., 2., A.shape[0])) + raw = tuple(map(complex, values)) + check("after_iteration") + abs_A, abs_B = abs(A), abs(B) + pairs = [] + for mu, vector in zip(values, vectors.T): + if (not np.isfinite(mu) or mu.real == 0. or + abs(mu.imag) > 1e-8*abs(mu.real) or + np.max(abs(vector.imag)) > 1e-8*np.max(abs(vector.real))): + raise _ModalFailure("nonphysical or unresolved finite reference pair") + eigenvalue = sigma+1./float(mu.real) + if free: + # Retain the separate shift/reconstruction cancellation guard. + roundoff_screen = 64*np.finfo(float).eps*A.shape[0]*(abs(sigma)+abs(1./float(mu.real))) + if not np.isfinite(roundoff_screen) or eigenvalue <= roundoff_screen: + raise _ModalFailure("extra mechanism or unresolved near-zero flexible pair") + x = scale*np.asarray(vector.real) + q = np.zeros(owner._K.shape[0]); q[owner._free] = x[:n] + if free: + # Physical quadratic-work resolution screen on the reconstructed + # candidate (the congruence inverse applied to the Krylov vector). + # The pair is resolvable only when its inertial quadratic work + # exceeds the abs-coefficient quadratic-work roundoff of this + # candidate's elastic and descriptor constraint work. Both sides + # are physical energy, so the decision is invariant under + # equivalent diagonal unit/coordinate rescalings. Absolute-entry + # bounds can vary under general frame rotations; this is a + # conservative resolution screen, not a frame-invariance proof. + # Its coefficient uncertainty uses no fitted eigenvalue or shift. Cancellation/roundoff + # screen only: not a certified Arnoldi/LU eigenvalue error bound + # or exactly-six nullity proof. + kinetic = float(q@mass@q) + work = eigenvalue*kinetic + uncertainty = 64*np.finfo(float).eps*A.shape[0]*( + float((abs(owner._K)@abs(q))@abs(q))+ + 2.*float((abs(owner._C).T@abs(x[n:]))@abs(q))) + if (not np.isfinite(work) or not np.isfinite(uncertainty) or + work <= uncertainty): + raise _ModalFailure("extra mechanism or unresolved near-zero flexible pair") + norm = float(q@mass@q) + if not np.isfinite(eigenvalue) or eigenvalue <= 0. or not np.isfinite(norm) or norm <= 0.: + raise _ModalFailure("positive finite eigenvalue and physical modal mass required") + x /= np.sqrt(norm); q /= np.sqrt(norm) + if not np.isfinite(x).all() or not np.isfinite(q).all(): + raise _ModalFailure("physical reference mode normalization is not representable") + # Sign uses physical inertial coordinates, not massless resultants. + physical_slots = np.setdiff1d(np.arange(len(q)), zero) + largest = physical_slots[int(np.argmax(np.abs(q[physical_slots])))] + if q[largest] < 0.: x = -x; q = -q + lam = x[n:] + residual = A@x-eigenvalue*(B@x) + bound = abs_A@abs(x)+abs(eigenvalue)*(abs_B@abs(x)) + equation = _modal_scaled_residual(residual, bound, scale) + gap = owner._C@q + constraint = _modal_scaled_residual(gap, abs(owner._C)@abs(q), scale[n:]) + reactions = owner._K@q+owner._C.T@lam-eigenvalue*(mass@q) + physical_bound = abs(owner._K)@abs(q)+abs(owner._C.T)@abs(lam)+abs(eigenvalue)*(abs(mass)@abs(q)) + physical = _modal_scaled_residual(reactions[owner._free], + physical_bound[owner._free], scale[:n]) + if equation > 1e-8 or physical > 1e-8 or constraint > 1e-9: + raise _ModalFailure("reference modal physical equation or constraint residual failed") + pairs.append((float(eigenvalue), _owned(q), _owned(lam), _owned(reactions), + equation, constraint, physical)) + pairs.sort(key=lambda item: item[0]) + modes = np.column_stack([pair[1] for pair in pairs]) + gram = modes.T@mass@modes + if not np.isfinite(gram).all() or np.max(abs(gram-np.eye(request.count))) > 1e-7: + raise _ModalFailure("physical reference modal mass orthogonality failed") + if free: + overlap = float(np.max(abs(rigid["normalized"].T@mass@modes))) + if not np.isfinite(overlap) or overlap > 1e-7: + raise _ModalFailure("rigid and flexible physical mode spaces not mass orthogonal") + check("publish") + return finish("completed", frequencies_hz=tuple(np.sqrt(p[0])/(2*np.pi) for p in pairs), + eigenvalues_rad2_s2=tuple(p[0] for p in pairs), + full_coordinates=tuple(p[1] for p in pairs), + shell_modes=tuple(_owned(p[1][:owner._shell_count]) for p in pairs), + beam_modes=tuple(_owned(p[1][owner._shell_count:]) for p in pairs), + multiplier_modes=tuple(p[2] for p in pairs), support_reactions=tuple(p[3] for p in pairs), + equation_residuals=tuple(p[4] for p in pairs), + constraint_residuals=tuple(p[5] for p in pairs), + physical_equation_residuals=tuple(p[6] for p in pairs)) + except SolveCancelled as exc: + return finish("cancelled", failure_reason=str(exc)) + except (ArpackError, _ModalFailure) as exc: + partial = getattr(exc, "eigenvalues", None) + if partial is not None: raw = tuple(map(complex, partial)) + return finish("failed", failure_reason=str(exc)) + finally: + # Do not retain a factor through an operation closure/error traceback. + handle = None diff --git a/src/anysolver/_stiffened_shell_generalized_recovery.py b/src/anyfesolver/_stiffened_shell_generalized_recovery.py similarity index 100% rename from src/anysolver/_stiffened_shell_generalized_recovery.py rename to src/anyfesolver/_stiffened_shell_generalized_recovery.py diff --git a/src/anysolver/_stiffened_shell_increment_control.py b/src/anyfesolver/_stiffened_shell_increment_control.py similarity index 98% rename from src/anysolver/_stiffened_shell_increment_control.py rename to src/anyfesolver/_stiffened_shell_increment_control.py index f841bcf14..0958530b0 100644 --- a/src/anysolver/_stiffened_shell_increment_control.py +++ b/src/anyfesolver/_stiffened_shell_increment_control.py @@ -1,152 +1,152 @@ -"""Bounded deterministic load-factor cutbacks; no constitutive approximation.""" - -from dataclasses import asdict, dataclass, replace -from hashlib import sha256 -import json -from math import isfinite - -from ._stiffened_shell_ge_checkpoint_binary import MAX_CHECKPOINT_BYTES - - -MAGIC = b"ANYSGECP10\0" -SCHEMA = "B3_GE_E4_PL_STIFFENED_SHELL_EXPERIMENTAL_INCREMENT_CONTROL_V10" -MAX_METADATA_BYTES = 256 * 1024 - - -@dataclass(frozen=True) -class AdaptiveIncrementControl: - """Halve failed intervals and hold that step until the requested target. - +"""Bounded deterministic load-factor cutbacks; no constitutive approximation.""" + +from dataclasses import asdict, dataclass, replace +from hashlib import sha256 +import json +from math import isfinite + +from ._stiffened_shell_ge_checkpoint_binary import MAX_CHECKPOINT_BYTES + + +MAGIC = b"ANYSGECP10\0" +SCHEMA = "B3_GE_E4_PL_STIFFENED_SHELL_EXPERIMENTAL_INCREMENT_CONTROL_V10" +MAX_METADATA_BYTES = 256 * 1024 + + +@dataclass(frozen=True) +class AdaptiveIncrementControl: + """Halve failed intervals and hold that step until the requested target. + Limits apply to each invocation, including work in its restored accepted checkpoint. Rejected attempts after the last acceptance are reported on exhaustion but are not durable; retrying that prefix may repeat them. - Defaults do not activate this optional experimental controller. - """ - max_cutbacks: int = 6 - max_attempts: int = 64 - - def __post_init__(self): - if (type(self.max_cutbacks) is not int or not 0 <= self.max_cutbacks <= 20 or - type(self.max_attempts) is not int or not 1 <= self.max_attempts <= 1024): - raise ValueError("bounded integer adaptive increment controls required") - - -@dataclass(frozen=True) -class IncrementAttempt: - factor: float - accepted_from: float - target: float - status: str - iterations: int - evaluations: int - linear_solves: int - rejected_trials: int - equilibrium_ratio: float - constraint_max: float - failure: str | None = None - - -class FiniteIncrementFailure(RuntimeError): - """Specifically retryable global Newton/backtrack exhaustion only.""" - def __init__(self, attempt): - super().__init__(attempt.failure) - self.attempt = attempt - - -class AdaptiveIncrementExhausted(RuntimeError): - """Requested sequence incomplete; physical accepted prefix remains owned.""" - def __init__(self, reason, state, accepted_factors): - super().__init__(reason) - self.attempts = state.attempts - self.requested_targets = state.targets - self.accepted_factors = accepted_factors - - -@dataclass(frozen=True) -class _AdaptiveState: - control: AdaptiveIncrementControl - targets: tuple[float, ...] - max_iterations: int - max_backtracks: int - cursor: int - origin: float - depth: int = 0 - attempts: tuple[IncrementAttempt, ...] = () - - @property - def completed(self): - return self.cursor == len(self.targets) - - def next_factor(self, accepted): - target = self.targets[self.cursor] - step = (target - self.origin) / (2**self.depth) - remaining = target - accepted - return target if abs(step) >= abs(remaining) else accepted + step - - def accepted(self, attempt): - finished = attempt.factor == self.targets[self.cursor] - return replace(self, attempts=self.attempts + (attempt,), - cursor=self.cursor + int(finished), - origin=attempt.factor if finished else self.origin, - depth=0 if finished else self.depth) - - def rejected(self, attempt): - return replace(self, attempts=self.attempts + (attempt,), depth=self.depth + 1) - - -def encode_control(model, state, inner): - header = json.dumps({"schema": SCHEMA, "model": model, "state": asdict(state)}, - sort_keys=True, separators=(",", ":"), allow_nan=False).encode("ascii") - if len(header) > MAX_METADATA_BYTES: - raise ValueError("adaptive checkpoint metadata exceeds resource envelope") - content = MAGIC + len(header).to_bytes(4, "little") + header + inner - if len(content) + 32 > MAX_CHECKPOINT_BYTES: - raise ValueError("adaptive checkpoint exceeds resource envelope") - return content + sha256(content).digest() - - -def _unique(pairs): - value = {} - for key, item in pairs: - if key in value: - raise ValueError("duplicate adaptive checkpoint metadata") - value[key] = item - return value - - -def decode_control(raw, model): - if (type(raw) is not bytes or not raw.startswith(MAGIC) or - not len(MAGIC) + 4 + 32 < len(raw) <= MAX_CHECKPOINT_BYTES or - sha256(raw[:-32]).digest() != raw[-32:]): - raise ValueError("invalid adaptive checkpoint framing") - start = len(MAGIC) + 4 - size = int.from_bytes(raw[len(MAGIC):start], "little") - if not 0 < size <= MAX_METADATA_BYTES or start + size >= len(raw) - 32: - raise ValueError("invalid adaptive checkpoint metadata bound") - try: - header = json.loads(raw[start:start+size], object_pairs_hook=_unique) - if (type(header) is not dict or set(header) != {"schema", "model", "state"} or - header["schema"] != SCHEMA or header["model"] != model): - raise ValueError("incompatible adaptive checkpoint") - if json.dumps(header,sort_keys=True,separators=(",", ":"), - allow_nan=False).encode("ascii") != raw[start:start+size]: - raise ValueError("noncanonical adaptive checkpoint metadata") - value = header["state"] - if type(value) is not dict or set(value) != set(_AdaptiveState.__dataclass_fields__): - raise ValueError("invalid adaptive controller fields") - if (type(value["control"]) is not dict or - set(value["control"]) != {"max_cutbacks", "max_attempts"} or - type(value["targets"]) is not list or type(value["attempts"]) is not list): - raise ValueError("invalid adaptive controller layout") - control = AdaptiveIncrementControl(**value["control"]) - state = _AdaptiveState(**{**value, "control": control, - "targets": tuple(value["targets"]), - "attempts": tuple(IncrementAttempt(**v) for v in value["attempts"])}) - except (TypeError, KeyError, UnicodeError, json.JSONDecodeError) as error: - raise ValueError("invalid adaptive checkpoint metadata") from error - return state, raw[start+size:-32] - - + Defaults do not activate this optional experimental controller. + """ + max_cutbacks: int = 6 + max_attempts: int = 64 + + def __post_init__(self): + if (type(self.max_cutbacks) is not int or not 0 <= self.max_cutbacks <= 20 or + type(self.max_attempts) is not int or not 1 <= self.max_attempts <= 1024): + raise ValueError("bounded integer adaptive increment controls required") + + +@dataclass(frozen=True) +class IncrementAttempt: + factor: float + accepted_from: float + target: float + status: str + iterations: int + evaluations: int + linear_solves: int + rejected_trials: int + equilibrium_ratio: float + constraint_max: float + failure: str | None = None + + +class FiniteIncrementFailure(RuntimeError): + """Specifically retryable global Newton/backtrack exhaustion only.""" + def __init__(self, attempt): + super().__init__(attempt.failure) + self.attempt = attempt + + +class AdaptiveIncrementExhausted(RuntimeError): + """Requested sequence incomplete; physical accepted prefix remains owned.""" + def __init__(self, reason, state, accepted_factors): + super().__init__(reason) + self.attempts = state.attempts + self.requested_targets = state.targets + self.accepted_factors = accepted_factors + + +@dataclass(frozen=True) +class _AdaptiveState: + control: AdaptiveIncrementControl + targets: tuple[float, ...] + max_iterations: int + max_backtracks: int + cursor: int + origin: float + depth: int = 0 + attempts: tuple[IncrementAttempt, ...] = () + + @property + def completed(self): + return self.cursor == len(self.targets) + + def next_factor(self, accepted): + target = self.targets[self.cursor] + step = (target - self.origin) / (2**self.depth) + remaining = target - accepted + return target if abs(step) >= abs(remaining) else accepted + step + + def accepted(self, attempt): + finished = attempt.factor == self.targets[self.cursor] + return replace(self, attempts=self.attempts + (attempt,), + cursor=self.cursor + int(finished), + origin=attempt.factor if finished else self.origin, + depth=0 if finished else self.depth) + + def rejected(self, attempt): + return replace(self, attempts=self.attempts + (attempt,), depth=self.depth + 1) + + +def encode_control(model, state, inner): + header = json.dumps({"schema": SCHEMA, "model": model, "state": asdict(state)}, + sort_keys=True, separators=(",", ":"), allow_nan=False).encode("ascii") + if len(header) > MAX_METADATA_BYTES: + raise ValueError("adaptive checkpoint metadata exceeds resource envelope") + content = MAGIC + len(header).to_bytes(4, "little") + header + inner + if len(content) + 32 > MAX_CHECKPOINT_BYTES: + raise ValueError("adaptive checkpoint exceeds resource envelope") + return content + sha256(content).digest() + + +def _unique(pairs): + value = {} + for key, item in pairs: + if key in value: + raise ValueError("duplicate adaptive checkpoint metadata") + value[key] = item + return value + + +def decode_control(raw, model): + if (type(raw) is not bytes or not raw.startswith(MAGIC) or + not len(MAGIC) + 4 + 32 < len(raw) <= MAX_CHECKPOINT_BYTES or + sha256(raw[:-32]).digest() != raw[-32:]): + raise ValueError("invalid adaptive checkpoint framing") + start = len(MAGIC) + 4 + size = int.from_bytes(raw[len(MAGIC):start], "little") + if not 0 < size <= MAX_METADATA_BYTES or start + size >= len(raw) - 32: + raise ValueError("invalid adaptive checkpoint metadata bound") + try: + header = json.loads(raw[start:start+size], object_pairs_hook=_unique) + if (type(header) is not dict or set(header) != {"schema", "model", "state"} or + header["schema"] != SCHEMA or header["model"] != model): + raise ValueError("incompatible adaptive checkpoint") + if json.dumps(header,sort_keys=True,separators=(",", ":"), + allow_nan=False).encode("ascii") != raw[start:start+size]: + raise ValueError("noncanonical adaptive checkpoint metadata") + value = header["state"] + if type(value) is not dict or set(value) != set(_AdaptiveState.__dataclass_fields__): + raise ValueError("invalid adaptive controller fields") + if (type(value["control"]) is not dict or + set(value["control"]) != {"max_cutbacks", "max_attempts"} or + type(value["targets"]) is not list or type(value["attempts"]) is not list): + raise ValueError("invalid adaptive controller layout") + control = AdaptiveIncrementControl(**value["control"]) + state = _AdaptiveState(**{**value, "control": control, + "targets": tuple(value["targets"]), + "attempts": tuple(IncrementAttempt(**v) for v in value["attempts"])}) + except (TypeError, KeyError, UnicodeError, json.JSONDecodeError) as error: + raise ValueError("invalid adaptive checkpoint metadata") from error + return state, raw[start+size:-32] + + def validate_control(state, factors, *, _allow_fibre_predictor=False, _allow_coupled_predictor=False): """Replay bounded controller decisions, never element/material history. @@ -163,30 +163,30 @@ def validate_control(state, factors, *, _allow_fibre_predictor=False, type(_allow_coupled_predictor) is not bool or (_allow_fibre_predictor and _allow_coupled_predictor) or type(state) is not _AdaptiveState or not state.targets or - any(type(v) is not float or not isfinite(v) or v <= 0. for v in state.targets) or - any(a == b for a, b in zip(state.targets, state.targets[1:])) or - type(state.max_iterations) is not int or not 1 <= state.max_iterations <= 24 or - type(state.max_backtracks) is not int or not 0 <= state.max_backtracks <= 12 or - type(state.cursor) is not int or not 0 <= state.cursor <= len(state.targets) or - type(state.depth) is not int or not 0 <= state.depth <= state.control.max_cutbacks or - type(state.origin) is not float or not isfinite(state.origin) or state.origin < 0. or - not 0 < len(state.attempts) <= state.control.max_attempts): - raise ValueError("invalid accepted adaptive controller state") - accepted = tuple(row.factor for row in state.attempts if row.status == "accepted") - if not accepted or tuple(factors[-len(accepted):]) != accepted: - raise ValueError("adaptive controller disagrees with accepted load history") - origin = float(factors[-len(accepted)-1]) if len(factors) > len(accepted) else 0. - replay = _AdaptiveState(state.control, state.targets, - state.max_iterations, state.max_backtracks, 0, origin) - previous = origin - for row in state.attempts: - if (replay.completed or row.factor != replay.next_factor(previous) or - row.accepted_from != previous or row.target != replay.targets[replay.cursor] or - any(type(v) is not float or not isfinite(v) for v in ( - row.factor, row.accepted_from, row.target, row.equilibrium_ratio, row.constraint_max)) or - min(row.equilibrium_ratio, row.constraint_max) < 0. or - any(type(v) is not int or v < 0 for v in ( - row.iterations, row.evaluations, row.linear_solves, row.rejected_trials)) or + any(type(v) is not float or not isfinite(v) or v <= 0. for v in state.targets) or + any(a == b for a, b in zip(state.targets, state.targets[1:])) or + type(state.max_iterations) is not int or not 1 <= state.max_iterations <= 24 or + type(state.max_backtracks) is not int or not 0 <= state.max_backtracks <= 12 or + type(state.cursor) is not int or not 0 <= state.cursor <= len(state.targets) or + type(state.depth) is not int or not 0 <= state.depth <= state.control.max_cutbacks or + type(state.origin) is not float or not isfinite(state.origin) or state.origin < 0. or + not 0 < len(state.attempts) <= state.control.max_attempts): + raise ValueError("invalid accepted adaptive controller state") + accepted = tuple(row.factor for row in state.attempts if row.status == "accepted") + if not accepted or tuple(factors[-len(accepted):]) != accepted: + raise ValueError("adaptive controller disagrees with accepted load history") + origin = float(factors[-len(accepted)-1]) if len(factors) > len(accepted) else 0. + replay = _AdaptiveState(state.control, state.targets, + state.max_iterations, state.max_backtracks, 0, origin) + previous = origin + for row in state.attempts: + if (replay.completed or row.factor != replay.next_factor(previous) or + row.accepted_from != previous or row.target != replay.targets[replay.cursor] or + any(type(v) is not float or not isfinite(v) for v in ( + row.factor, row.accepted_from, row.target, row.equilibrium_ratio, row.constraint_max)) or + min(row.equilibrium_ratio, row.constraint_max) < 0. or + any(type(v) is not int or v < 0 for v in ( + row.iterations, row.evaluations, row.linear_solves, row.rejected_trials)) or (not row.iterations <= row.linear_solves <= row.iterations + min( row.iterations, row.rejected_trials) if (_allow_fibre_predictor or _allow_coupled_predictor) else @@ -198,20 +198,20 @@ def validate_control(state, factors, *, _allow_fibre_predictor=False, row.rejected_trials > (state.max_backtracks + 1) * ( row.iterations if (_allow_fibre_predictor or _allow_coupled_predictor) else row.linear_solves)): - raise ValueError("invalid adaptive attempt or interval") - if row.status == "accepted": - if row.failure is not None or row.equilibrium_ratio > 1e-8 or row.constraint_max > 1e-9: - raise ValueError("invalid adaptive acceptance") - replay = replay.accepted(row) - previous = row.factor - elif row.status == "rejected": - if (row.failure not in ("finite mixed Newton iteration limit", - "finite mixed backtrack budget exhausted") or - replay.depth >= state.control.max_cutbacks): - raise ValueError("invalid adaptive rejection") - replay = replay.rejected(row) - else: - raise ValueError("invalid adaptive attempt status") - if (replay != state or state.attempts[-1].status != "accepted" or - previous != factors[-1]): - raise ValueError("adaptive cursor disagrees with physical checkpoint") + raise ValueError("invalid adaptive attempt or interval") + if row.status == "accepted": + if row.failure is not None or row.equilibrium_ratio > 1e-8 or row.constraint_max > 1e-9: + raise ValueError("invalid adaptive acceptance") + replay = replay.accepted(row) + previous = row.factor + elif row.status == "rejected": + if (row.failure not in ("finite mixed Newton iteration limit", + "finite mixed backtrack budget exhausted") or + replay.depth >= state.control.max_cutbacks): + raise ValueError("invalid adaptive rejection") + replay = replay.rejected(row) + else: + raise ValueError("invalid adaptive attempt status") + if (replay != state or state.attempts[-1].status != "accepted" or + previous != factors[-1]): + raise ValueError("adaptive cursor disagrees with physical checkpoint") diff --git a/src/anysolver/_stiffened_shell_l1_assembly_experimental.py b/src/anyfesolver/_stiffened_shell_l1_assembly_experimental.py similarity index 100% rename from src/anysolver/_stiffened_shell_l1_assembly_experimental.py rename to src/anyfesolver/_stiffened_shell_l1_assembly_experimental.py diff --git a/src/anysolver/_stiffened_shell_l1_local_experimental.py b/src/anyfesolver/_stiffened_shell_l1_local_experimental.py similarity index 100% rename from src/anysolver/_stiffened_shell_l1_local_experimental.py rename to src/anyfesolver/_stiffened_shell_l1_local_experimental.py diff --git a/src/anysolver/_stiffened_shell_l1_supported_work_experimental.py b/src/anyfesolver/_stiffened_shell_l1_supported_work_experimental.py similarity index 100% rename from src/anysolver/_stiffened_shell_l1_supported_work_experimental.py rename to src/anyfesolver/_stiffened_shell_l1_supported_work_experimental.py diff --git a/src/anysolver/_stiffened_shell_native_distributed_load.py b/src/anyfesolver/_stiffened_shell_native_distributed_load.py similarity index 100% rename from src/anysolver/_stiffened_shell_native_distributed_load.py rename to src/anyfesolver/_stiffened_shell_native_distributed_load.py diff --git a/src/anysolver/_stiffened_shell_native_gravity.py b/src/anyfesolver/_stiffened_shell_native_gravity.py similarity index 100% rename from src/anysolver/_stiffened_shell_native_gravity.py rename to src/anyfesolver/_stiffened_shell_native_gravity.py diff --git a/src/anysolver/_stiffened_shell_nodal_footprint.py b/src/anyfesolver/_stiffened_shell_nodal_footprint.py similarity index 100% rename from src/anysolver/_stiffened_shell_nodal_footprint.py rename to src/anyfesolver/_stiffened_shell_nodal_footprint.py diff --git a/src/anysolver/_stiffened_shell_physical_q4_mass.py b/src/anyfesolver/_stiffened_shell_physical_q4_mass.py similarity index 100% rename from src/anysolver/_stiffened_shell_physical_q4_mass.py rename to src/anyfesolver/_stiffened_shell_physical_q4_mass.py diff --git a/src/anysolver/_stiffened_shell_physical_s3_mass.py b/src/anyfesolver/_stiffened_shell_physical_s3_mass.py similarity index 100% rename from src/anysolver/_stiffened_shell_physical_s3_mass.py rename to src/anyfesolver/_stiffened_shell_physical_s3_mass.py diff --git a/src/anysolver/_stiffened_shell_point_recovery.py b/src/anyfesolver/_stiffened_shell_point_recovery.py similarity index 100% rename from src/anysolver/_stiffened_shell_point_recovery.py rename to src/anyfesolver/_stiffened_shell_point_recovery.py diff --git a/src/anysolver/_stiffened_shell_q4_algorithmic_pullback.py b/src/anyfesolver/_stiffened_shell_q4_algorithmic_pullback.py similarity index 98% rename from src/anysolver/_stiffened_shell_q4_algorithmic_pullback.py rename to src/anyfesolver/_stiffened_shell_q4_algorithmic_pullback.py index 518a7222e..745153220 100644 --- a/src/anysolver/_stiffened_shell_q4_algorithmic_pullback.py +++ b/src/anyfesolver/_stiffened_shell_q4_algorithmic_pullback.py @@ -1,88 +1,88 @@ -"""Explicit Q4 elastic/J2 full-map adapter; ordinary Q4 routes are unchanged.""" - -import numpy as np - -from ._ge_beam3_variational_shell import deformation -from ._stiffened_shell_algorithmic_pullback import spatial_response -from .e4_pl_element import FORMULATION_ID -from .material_curves import DNVC208MaterialCurve - - -POLICY = "STIFFENED_SHELL_Q4_ALGORITHMIC_PULLBACK_V1" -HISTORICAL_POLICY = "historical_corotational" - - -def local_coordinates(model, element, displacement, *, rotation_anchors=None): - reference = np.array([model.mesh.nodes[node].coords() for node in element.node_ids]) - return deformation(reference, displacement, stable_translation=True, - rotation_anchors=rotation_anchors)[0] - - -def response(model, element, displacement, origin, layers, *, rotation_anchors=None, - prepared_correction=None, stable_rotation=False, capture_material_trial=False): - """Differentiate the unchanged local update from one accepted predecessor.""" - if type(capture_material_trial) is not bool: - raise ValueError("explicit Q4 material trial capture policy required") - material = model.get_material(element.material_name) - curve = material.hardening_curve - if (getattr(element, "formulation_id", None) != FORMULATION_ID or - element.num_nodes != 4 or element.shell_section is not None or - (curve is not None and not isinstance(curve, DNVC208MaterialCurve)) or - (curve is None and material.yield_stress != 0.) or origin is None): - raise ValueError("experimental Q4 elastic/isotropic J2 accepted predecessor required") - reference = np.array([model.mesh.nodes[node].coords() for node in element.node_ids]) - u = np.asarray(displacement, dtype=float) - local, differential, second = deformation(reference, u, stable_translation=True, - rotation_anchors=rotation_anchors, - stable_rotation=stable_rotation) - if prepared_correction is None: - force, tangent, candidate = element.compute_nonlinear_response( - model.mesh, material, local, origin, layers, True) - else: - force, tangent, candidate = element._compute_prepared_nonlinear_response( - model.mesh, material, local, origin, layers, True, - prepared=prepared_correction) - force, tangent = np.asarray(force), np.asarray(tangent) - if (force.shape != (24,) or tangent.shape != (24, 24) or - not np.isfinite(force).all() or not np.isfinite(tangent).all() or - candidate is None): - raise ValueError("finite Q4 algorithmic trial required") - residual, spatial_tangent = spatial_response(u, force, tangent, differential, second, - stable_rotation=stable_rotation) - if capture_material_trial: - from ._stiffened_shell_q4_material_event import capture - payload = capture(model, element, u, local, differential, origin, candidate, layers) - return residual, spatial_tangent, candidate, payload - return residual, spatial_tangent, candidate - - -def conservative_components(model, element, displacement, origin, layers, *, - rotation_anchors=None, prepared_correction=None): - """Read-only elastic covector Hessian in the actual additive shell chart. - - Unlike a spatial-row tangent, these blocks are derivatives of one scalar - potential. The unchanged qualified linear correction contributes to both - material stiffness and the force contracted with deformation curvature. - """ - material = model.get_material(element.material_name) - if (getattr(element, 'formulation_id', None) != FORMULATION_ID or - element.num_nodes != 4 or element.shell_section is not None or - material.hardening_curve is not None or material.yield_stress != 0. or origin is None): - raise ValueError('conservative Q4 capture requires the owned elastic section') - reference = np.array([model.mesh.nodes[node].coords() for node in element.node_ids]) - local, differential, second = deformation(reference, displacement, - stable_translation=True, rotation_anchors=rotation_anchors) - if prepared_correction is None: - force, tangent, candidate, parts = element.compute_nonlinear_response( - model.mesh, material, local, origin, layers, True, _return_tangent_components=True) - else: - force, tangent, candidate, parts = element._compute_prepared_nonlinear_response( - model.mesh, material, local, origin, layers, True, - prepared=prepared_correction, _return_tangent_components=True) - km = differential.T @ parts['material'] @ differential - geometric = differential.T @ parts['geometric'] @ differential + np.einsum('i,ijk->jk', force, second) - hessian = differential.T @ tangent @ differential + np.einsum('i,ijk->jk', force, second) - covector = differential.T @ force - if not all(np.isfinite(a).all() for a in (km, geometric, hessian, covector)): - raise ValueError('finite conservative Q4 components required') - return covector, hessian, km, geometric, candidate +"""Explicit Q4 elastic/J2 full-map adapter; ordinary Q4 routes are unchanged.""" + +import numpy as np + +from ._ge_beam3_variational_shell import deformation +from ._stiffened_shell_algorithmic_pullback import spatial_response +from .e4_pl_element import FORMULATION_ID +from .material_curves import DNVC208MaterialCurve + + +POLICY = "STIFFENED_SHELL_Q4_ALGORITHMIC_PULLBACK_V1" +HISTORICAL_POLICY = "historical_corotational" + + +def local_coordinates(model, element, displacement, *, rotation_anchors=None): + reference = np.array([model.mesh.nodes[node].coords() for node in element.node_ids]) + return deformation(reference, displacement, stable_translation=True, + rotation_anchors=rotation_anchors)[0] + + +def response(model, element, displacement, origin, layers, *, rotation_anchors=None, + prepared_correction=None, stable_rotation=False, capture_material_trial=False): + """Differentiate the unchanged local update from one accepted predecessor.""" + if type(capture_material_trial) is not bool: + raise ValueError("explicit Q4 material trial capture policy required") + material = model.get_material(element.material_name) + curve = material.hardening_curve + if (getattr(element, "formulation_id", None) != FORMULATION_ID or + element.num_nodes != 4 or element.shell_section is not None or + (curve is not None and not isinstance(curve, DNVC208MaterialCurve)) or + (curve is None and material.yield_stress != 0.) or origin is None): + raise ValueError("experimental Q4 elastic/isotropic J2 accepted predecessor required") + reference = np.array([model.mesh.nodes[node].coords() for node in element.node_ids]) + u = np.asarray(displacement, dtype=float) + local, differential, second = deformation(reference, u, stable_translation=True, + rotation_anchors=rotation_anchors, + stable_rotation=stable_rotation) + if prepared_correction is None: + force, tangent, candidate = element.compute_nonlinear_response( + model.mesh, material, local, origin, layers, True) + else: + force, tangent, candidate = element._compute_prepared_nonlinear_response( + model.mesh, material, local, origin, layers, True, + prepared=prepared_correction) + force, tangent = np.asarray(force), np.asarray(tangent) + if (force.shape != (24,) or tangent.shape != (24, 24) or + not np.isfinite(force).all() or not np.isfinite(tangent).all() or + candidate is None): + raise ValueError("finite Q4 algorithmic trial required") + residual, spatial_tangent = spatial_response(u, force, tangent, differential, second, + stable_rotation=stable_rotation) + if capture_material_trial: + from ._stiffened_shell_q4_material_event import capture + payload = capture(model, element, u, local, differential, origin, candidate, layers) + return residual, spatial_tangent, candidate, payload + return residual, spatial_tangent, candidate + + +def conservative_components(model, element, displacement, origin, layers, *, + rotation_anchors=None, prepared_correction=None): + """Read-only elastic covector Hessian in the actual additive shell chart. + + Unlike a spatial-row tangent, these blocks are derivatives of one scalar + potential. The unchanged qualified linear correction contributes to both + material stiffness and the force contracted with deformation curvature. + """ + material = model.get_material(element.material_name) + if (getattr(element, 'formulation_id', None) != FORMULATION_ID or + element.num_nodes != 4 or element.shell_section is not None or + material.hardening_curve is not None or material.yield_stress != 0. or origin is None): + raise ValueError('conservative Q4 capture requires the owned elastic section') + reference = np.array([model.mesh.nodes[node].coords() for node in element.node_ids]) + local, differential, second = deformation(reference, displacement, + stable_translation=True, rotation_anchors=rotation_anchors) + if prepared_correction is None: + force, tangent, candidate, parts = element.compute_nonlinear_response( + model.mesh, material, local, origin, layers, True, _return_tangent_components=True) + else: + force, tangent, candidate, parts = element._compute_prepared_nonlinear_response( + model.mesh, material, local, origin, layers, True, + prepared=prepared_correction, _return_tangent_components=True) + km = differential.T @ parts['material'] @ differential + geometric = differential.T @ parts['geometric'] @ differential + np.einsum('i,ijk->jk', force, second) + hessian = differential.T @ tangent @ differential + np.einsum('i,ijk->jk', force, second) + covector = differential.T @ force + if not all(np.isfinite(a).all() for a in (km, geometric, hessian, covector)): + raise ValueError('finite conservative Q4 components required') + return covector, hessian, km, geometric, candidate diff --git a/src/anysolver/_stiffened_shell_q4_material_event.py b/src/anyfesolver/_stiffened_shell_q4_material_event.py similarity index 98% rename from src/anysolver/_stiffened_shell_q4_material_event.py rename to src/anyfesolver/_stiffened_shell_q4_material_event.py index 34f8ccf0c..56caa3e60 100644 --- a/src/anysolver/_stiffened_shell_q4_material_event.py +++ b/src/anyfesolver/_stiffened_shell_q4_material_event.py @@ -1,114 +1,114 @@ -"""Owned fixed-origin Q4 numerical-switch proposal, never acceptance/history.""" -from dataclasses import dataclass -from decimal import Decimal as D, localcontext -from inspect import signature -from math import isfinite, nextafter, ulp -import numpy as np -from .plasticity import plane_stress_elastic_matrix, plane_stress_return_map, _jit_flow_stress, lobatto_layers - -@dataclass(frozen=True) -class Q4MaterialTrial: - origin: object - origin_values: tuple - displacement: tuple - strain: tuple - strain_differential: tuple - elastic_matrix: tuple - flow: tuple - tolerance: float - -def _origin_values(origin): - def owned(value): - if isinstance(value,(tuple,list,np.ndarray)):return tuple(owned(x) for x in value) - return float(value) - offsets=tuple((key,owned(origin[key])) for key in ('initial_membrane_stress','initial_bending_stress', - 'initial_membrane_prestrain','initial_curvature_prestrain','initial_generalized_prestrain','initial_generalized_resultant') if key in origin) - return (tuple(tuple(float(x) for x in row) for row in origin['plastic_strain']),tuple(map(float,origin['alpha'])),offsets) - -def capture(model, element, displacement, local, differential, origin, candidate, layers): - material=model.get_material(element.material_name);curve=material.hardening_curve - if curve is None:return None - cache=element._nonlinear_geometry(model.mesh);u=cache['T0']@local; jacobian=[] - z,_=lobatto_layers(layers,element.thickness) - for gp in cache['gp']: - theta=gp['Gw']@u - nonlinear=np.vstack((theta[0]*gp['Gw'][0],theta[1]*gp['Gw'][1],theta[0]*gp['Gw'][1]+theta[1]*gp['Gw'][0])) - for level in z:jacobian.append((gp['B_m']+nonlinear+level*gp['B_b'])@cache['T0']@differential) - flow=_jit_flow_stress(np.asarray(origin['alpha'],dtype=float),*(float(getattr(curve,n)) for n in - ('sigma_prop','sigma_yield','sigma_yield_2','eps_p_y1','eps_p_y2','K','n','_power_offset'))) - return Q4MaterialTrial(origin,_origin_values(origin),tuple(map(float,displacement)), - tuple(tuple(map(float,row)) for row in candidate['layer_strain']), - tuple(tuple(tuple(map(float,row)) for row in layer) for layer in jacobian), - tuple(tuple(map(float,row)) for row in plane_stress_elastic_matrix(material.elastic_modulus,material.poisson_ratio)), - tuple(map(float,flow)),float(signature(plane_stress_return_map).parameters['tolerance'].default)) - -def boundary_amount(trial,direction,*,origin): - return _boundary_amount(trial,direction,origin=origin,coordinate_count=24) - -def _boundary_amount(trial,direction,*,origin,coordinate_count): - """Local predictor only: pose remainder and kernel/flow/dot rounding are - not certified by the outward affine-update margin. Actual merit decides. - """ - if type(trial) is not Q4MaterialTrial or trial.origin is not origin or trial.origin_values!=_origin_values(origin): - raise ValueError('current origin-bound Q4 material trial required') - values=tuple(direction) - if type(coordinate_count) is not int or coordinate_count not in (18,24): - raise ValueError('admitted shell coordinate dimension required') - if len(values)!=coordinate_count or any(isinstance(x,(bool,np.bool_)) or not isfinite(float(x)) for x in values): - raise ValueError('finite complete shell coordinate corrections required') - if (len(trial.displacement)!=coordinate_count or len(trial.strain)!=len(trial.flow) or - len(trial.strain)!=len(trial.origin_values[0]) or len(trial.strain)!=len(trial.origin_values[1]) or - any(len(r)!=3 for r in trial.origin_values[0]) or - len(trial.strain_differential)!=len(trial.strain) or len(trial.elastic_matrix)!=3 or - any(len(r)!=3 for r in trial.elastic_matrix) or any(len(r)!=3 for r in trial.strain) or - any(len(layer)!=3 or any(len(r)!=coordinate_count for r in layer) for layer in trial.strain_differential)): - raise ValueError('complete Q4 material trial shapes required') - scalars=(*trial.displacement,*trial.flow,trial.tolerance,*[x for r in trial.strain for x in r], - *[x for r in trial.elastic_matrix for x in r],*[x for layer in trial.strain_differential for r in layer for x in r], - *[x for r in trial.origin_values[0] for x in r],*trial.origin_values[1]) - if any(isinstance(x,(bool,np.bool_)) or not isfinite(float(x)) for x in scalars) or trial.tolerance<=0 or any(x<=0 for x in trial.flow): - raise ValueError('finite positive Q4 material trial data required') - with localcontext() as context: - context.prec=80;dec=lambda x:D.from_float(float(x));dp=tuple(map(dec,values)) - matrix=tuple(tuple(map(dec,r)) for r in trial.elastic_matrix) - def mv(m,x):return tuple(sum((a*b for a,b in zip(r,x)),D(0)) for r in m) - def phi(x):return (x[0]+x[1])**2/12+(x[0]-x[1])**2/4+x[2]**2 - first=None - for strain,jacobian,ep,flow in zip(trial.strain,trial.strain_differential,trial.origin_values[0],trial.flow): - jac=tuple(tuple(map(dec,r)) for r in jacobian) - stress=mv(matrix,tuple(dec(a)-dec(b) for a,b in zip(strain,ep)));change=mv(matrix,mv(jac,dp));sy=dec(flow) - a=phi(change);b=(stress[0]+stress[1])*(change[0]+change[1])/6+(stress[0]-stress[1])*(change[0]-change[1])/2+2*stress[2]*change[2] - c=phi(stress)-sy*sy/3-dec(trial.tolerance)*max(sy*sy,D(1));roots=[] - if a: - discriminant=b*b-4*a*c - if discriminant<=0:continue # tangent contact does not switch branch - q=-(b+(discriminant.sqrt() if b>=0 else -discriminant.sqrt()))/2 - roots=(q/a,c/q) if q else (D(0),) - elif b:roots=(-c/b,) - for root in roots: - if not 0=0 else -discriminant.sqrt()))/2 + roots=(q/a,c/q) if q else (D(0),) + elif b:roots=(-c/b,) + for root in roots: + if not 0 MAX_ACTIONS_PER_STAGE for row in self.endpoints): - raise ValueError("bounded tuple of actions at every stage required") - if sum(map(len, self.endpoints)) > MAX_ACTIONS: - raise ValueError("staged-load total action bound exceeded") - endpoints = [] - for row in self.endpoints: - normalized = tuple(_action(a) for a in row) - nodes = [(a.domain, a.node) for a in normalized] - if len(set(nodes)) != len(nodes): - raise ValueError("duplicate same-node staged actions are not admitted") - endpoints.append(normalized) + identity: str = field(init=False) + _serialized: bytes = field(init=False, repr=False, compare=False) + + def __post_init__(self): + model_identity = _identity(self.model_identity) + if type(self.endpoints) is not tuple or not 1 <= len(self.endpoints) <= MAX_STAGES: + raise ValueError("bounded nonempty tuple of staged endpoints required") + if any(type(row) is not tuple or len(row) > MAX_ACTIONS_PER_STAGE for row in self.endpoints): + raise ValueError("bounded tuple of actions at every stage required") + if sum(map(len, self.endpoints)) > MAX_ACTIONS: + raise ValueError("staged-load total action bound exceeded") + endpoints = [] + for row in self.endpoints: + normalized = tuple(_action(a) for a in row) + nodes = [(a.domain, a.node) for a in normalized] + if len(set(nodes)) != len(nodes): + raise ValueError("duplicate same-node staged actions are not admitted") + endpoints.append(normalized) object.__setattr__(self, "model_identity", model_identity) object.__setattr__(self, "endpoints", tuple(endpoints)) reference = self.zero_load_reference_endpoint @@ -135,44 +135,44 @@ def __post_init__(self): raise ValueError("zero-load reference must identify an existing endpoint") if not any(v != 0. for action in endpoints[reference-1] for v in action.wrench): raise ValueError("zero-load reference endpoint must be nonzero") - core = self._core_payload() - identity = sha256(_canonical(core)).hexdigest() - object.__setattr__(self, "identity", identity) - raw = _canonical({**core, "identity": identity}) - if len(raw) > MAX_METADATA_BYTES: - raise ValueError("staged-load descriptor metadata bound exceeded") - object.__setattr__(self, "_serialized", raw) - - @property + core = self._core_payload() + identity = sha256(_canonical(core)).hexdigest() + object.__setattr__(self, "identity", identity) + raw = _canonical({**core, "identity": identity}) + if len(raw) > MAX_METADATA_BYTES: + raise ValueError("staged-load descriptor metadata bound exceeded") + object.__setattr__(self, "_serialized", raw) + + @property def stage_count(self): return len(self.endpoints) @property def policy(self): return POLICY if self.zero_load_reference_endpoint is None else ZERO_REFERENCE_POLICY - - @property - def augmented_model_identity(self): + + @property + def augmented_model_identity(self): return sha256(_canonical(dict(policy=self.policy, model_identity=self.model_identity, - programme_identity=self.identity))).hexdigest() - - def _core_payload(self): + programme_identity=self.identity))).hexdigest() + + def _core_payload(self): value = dict(policy=self.policy, model_identity=self.model_identity, endpoints=[[dict(domain=a.domain, node=a.node, wrench=list(a.wrench)) for a in row] for row in self.endpoints]) if self.zero_load_reference_endpoint is not None: value["zero_load_reference_endpoint"] = self.zero_load_reference_endpoint return value - - def to_payload(self): - return {**self._core_payload(), "identity": self.identity} - - def serialize(self): - return self._serialized - - @classmethod - def from_payload(cls, value): - from ._stiffened_shell_ge_experimental import NodalAction + + def to_payload(self): + return {**self._core_payload(), "identity": self.identity} + + def serialize(self): + return self._serialized + + @classmethod + def from_payload(cls, value): + from ._stiffened_shell_ge_experimental import NodalAction if type(value) is not dict: raise ValueError("invalid staged-load descriptor fields/policy") required = {"policy", "model_identity", "endpoints", "identity"} @@ -180,41 +180,41 @@ def from_payload(cls, value): required.add("zero_load_reference_endpoint") if (set(value) != required or value.get("policy") not in (POLICY, ZERO_REFERENCE_POLICY) or type(value["endpoints"]) is not list - or not 1 <= len(value["endpoints"]) <= MAX_STAGES): - raise ValueError("invalid staged-load descriptor fields/policy") - rows = value["endpoints"] - if (any(type(row) is not list or len(row) > MAX_ACTIONS_PER_STAGE for row in rows) or - sum(map(len, rows)) > MAX_ACTIONS): - raise ValueError("staged-load descriptor action bound exceeded") - normalized = [] - for row in rows: - actions = [] - for action in row: - if type(action) is not dict or set(action) != {"domain", "node", "wrench"}: - raise ValueError("invalid staged-load action fields") - if type(action["node"]) is not int or type(action["wrench"]) is not list: - raise ValueError("invalid staged-load action types") - actions.append(NodalAction(action["domain"], action["node"], action["wrench"])) - normalized.append(tuple(actions)) + or not 1 <= len(value["endpoints"]) <= MAX_STAGES): + raise ValueError("invalid staged-load descriptor fields/policy") + rows = value["endpoints"] + if (any(type(row) is not list or len(row) > MAX_ACTIONS_PER_STAGE for row in rows) or + sum(map(len, rows)) > MAX_ACTIONS): + raise ValueError("staged-load descriptor action bound exceeded") + normalized = [] + for row in rows: + actions = [] + for action in row: + if type(action) is not dict or set(action) != {"domain", "node", "wrench"}: + raise ValueError("invalid staged-load action fields") + if type(action["node"]) is not int or type(action["wrench"]) is not list: + raise ValueError("invalid staged-load action types") + actions.append(NodalAction(action["domain"], action["node"], action["wrench"])) + normalized.append(tuple(actions)) programme = cls(value["model_identity"], tuple(normalized), zero_load_reference_endpoint=value.get("zero_load_reference_endpoint")) - if (_identity(value["identity"]) != programme.identity or - _canonical(value) != programme.serialize()): - raise ValueError("staged-load descriptor identity/canonical representation mismatch") - return programme - - @classmethod - def deserialize(cls, raw): - if type(raw) is not bytes or not 0 < len(raw) <= MAX_METADATA_BYTES: - raise ValueError("bounded staged-load descriptor bytes required") - programme = cls.from_payload(_json(raw)) - if raw != programme.serialize(): - raise ValueError("canonical staged-load descriptor bytes required") - return programme - + if (_identity(value["identity"]) != programme.identity or + _canonical(value) != programme.serialize()): + raise ValueError("staged-load descriptor identity/canonical representation mismatch") + return programme + + @classmethod + def deserialize(cls, raw): + if type(raw) is not bytes or not 0 < len(raw) <= MAX_METADATA_BYTES: + raise ValueError("bounded staged-load descriptor bytes required") + programme = cls.from_payload(_json(raw)) + if raw != programme.serialize(): + raise ValueError("canonical staged-load descriptor bytes required") + return programme + def compile(self, owner, load): - if getattr(owner, "_identity", None) != self.model_identity: - raise ValueError("staged-load programme belongs to a different model") + if getattr(owner, "_identity", None) != self.model_identity: + raise ValueError("staged-load programme belongs to a different model") if not callable(load): raise TypeError("staged-load compiler requires the owner load callable") if self.zero_load_reference_endpoint is not None: @@ -225,18 +225,18 @@ def compile(self, owner, load): definition.distributing_footprints or definition.finite_distributing_footprints or definition.shell_reference_policy != "flat"): raise ValueError("zero-load reference policy requires the admitted flat point GE owner") - shape = getattr(getattr(owner, "_K", None), "shape", None) - if (type(shape) is not tuple or len(shape) != 2 or shape[0] != shape[1] or - not isinstance(shape[0], (int, np.integer)) or shape[0] <= 0 or - (self.stage_count+1)*shape[0] > MAX_COMPILED_VALUES): - raise ValueError("staged-load compiled vector shape/storage bound exceeded") - # No compiler/loader exceptions are swallowed or converted to cutbacks. - vectors = [] - for row in ((),)+self.endpoints: - made = np.asarray(load(row), dtype=np.float64) - if made.shape != (shape[0],) or not np.isfinite(made).all(): - raise ValueError("staged-load compiler returned invalid vectors") - # Snapshot before the next call: loaders may reuse a work buffer. + shape = getattr(getattr(owner, "_K", None), "shape", None) + if (type(shape) is not tuple or len(shape) != 2 or shape[0] != shape[1] or + not isinstance(shape[0], (int, np.integer)) or shape[0] <= 0 or + (self.stage_count+1)*shape[0] > MAX_COMPILED_VALUES): + raise ValueError("staged-load compiled vector shape/storage bound exceeded") + # No compiler/loader exceptions are swallowed or converted to cutbacks. + vectors = [] + for row in ((),)+self.endpoints: + made = np.asarray(load(row), dtype=np.float64) + if made.shape != (shape[0],) or not np.isfinite(made).all(): + raise ValueError("staged-load compiler returned invalid vectors") + # Snapshot before the next call: loaders may reuse a work buffer. vectors.append(np.frombuffer(made.tobytes(), dtype=np.float64)) if self.zero_load_reference_endpoint is not None: reference = vectors[self.zero_load_reference_endpoint][owner._free] @@ -247,50 +247,50 @@ def compile(self, owner, load): np.any((reference != 0.) & (weighted == 0.)) or not np.any(weighted != 0.)): raise ValueError("representable nonzero free work required at the reference endpoint") return CompiledStagedDeadLoadProgramme(self, tuple(vectors)) - - -@dataclass(frozen=True) -class CompiledStagedDeadLoadProgramme: - programme: StagedDeadLoadProgramme - vectors: tuple[np.ndarray, ...] - - def __post_init__(self): - if (type(self.programme) is not StagedDeadLoadProgramme or type(self.vectors) is not tuple or - len(self.vectors) != self.programme.stage_count+1): - raise ValueError("complete typed staged-load compilation required") - shape = np.shape(self.vectors[0]) - if len(shape) != 1 or shape[0] <= 0 or len(self.vectors)*shape[0] > MAX_COMPILED_VALUES: - raise ValueError("staged-load compiled storage bound exceeded") - owned = [] - for vector in self.vectors: - made = np.asarray(vector, dtype=np.float64) - if made.shape != shape or not np.isfinite(made).all(): - raise ValueError("finite consistent staged-load vectors required") - owned.append(np.frombuffer(made.tobytes(), dtype=np.float64)) + + +@dataclass(frozen=True) +class CompiledStagedDeadLoadProgramme: + programme: StagedDeadLoadProgramme + vectors: tuple[np.ndarray, ...] + + def __post_init__(self): + if (type(self.programme) is not StagedDeadLoadProgramme or type(self.vectors) is not tuple or + len(self.vectors) != self.programme.stage_count+1): + raise ValueError("complete typed staged-load compilation required") + shape = np.shape(self.vectors[0]) + if len(shape) != 1 or shape[0] <= 0 or len(self.vectors)*shape[0] > MAX_COMPILED_VALUES: + raise ValueError("staged-load compiled storage bound exceeded") + owned = [] + for vector in self.vectors: + made = np.asarray(vector, dtype=np.float64) + if made.shape != shape or not np.isfinite(made).all(): + raise ValueError("finite consistent staged-load vectors required") + owned.append(np.frombuffer(made.tobytes(), dtype=np.float64)) if np.any(owned[0] != 0.): raise ValueError("implicit staged initial force must be zero") reference = self.programme.zero_load_reference_endpoint if reference is not None and not np.any(owned[reference] != 0.): raise ValueError("compiled zero-load reference endpoint must be nonzero") - object.__setattr__(self, "vectors", tuple(owned)) - - @property - def identity(self): - return self.programme.identity - - @property - def physical_model_identity(self): - return self.programme.model_identity - - @property - def augmented_model_identity(self): - return self.programme.augmented_model_identity - - @property - def model_identity(self): - return self.augmented_model_identity - - @property + object.__setattr__(self, "vectors", tuple(owned)) + + @property + def identity(self): + return self.programme.identity + + @property + def physical_model_identity(self): + return self.programme.model_identity + + @property + def augmented_model_identity(self): + return self.programme.augmented_model_identity + + @property + def model_identity(self): + return self.augmented_model_identity + + @property def stage_count(self): return self.programme.stage_count @@ -304,89 +304,89 @@ def equilibrium_load(self, applied): if reference is not None and not np.any(applied != 0.): return self.vectors[reference] return applied - - def progress_at(self, position): - _, cursor, fraction = _progress(self.stage_count, position) - return cursor, fraction - - def load_at(self, position): - _, cursor, fraction = _progress(self.stage_count, position) - if fraction == 0.: - return self.vectors[cursor] - a, b = self.vectors[cursor], self.vectors[cursor+1] - result = np.zeros_like(a) - wb = Fraction(fraction) - wa = 1-wb - # Only active spatial components need a bounded exact two-term dot. - # This avoids overflow-prone endpoint subtraction and false zero work. - for index in np.flatnonzero((a != 0.) | (b != 0.)): - if a[index] == b[index]: - result[index] = a[index] - continue - exact = wa*Fraction(float(a[index])) + wb*Fraction(float(b[index])) - try: - value = float(exact) - except OverflowError as exc: - raise StagedLoadResolutionError("staged force interpolation overflow") from exc - if (not isfinite(value) or (exact != 0 and value == 0.) or - (0. < abs(value) < np.finfo(float).tiny and Fraction(value) != exact)): - raise StagedLoadResolutionError("staged force interpolation is unresolved") - result[index] = value - return np.frombuffer(result.tobytes(), dtype=np.float64) - - def validate_targets(self, accepted_position, targets): - accepted, _, _ = _progress(self.stage_count, accepted_position) - if type(targets) is not tuple or not targets: - raise ValueError("nonempty tuple of staged positions required") - normalized = tuple(_progress(self.stage_count, p)[0] for p in targets) - if any(b <= a for a, b in zip((accepted,)+normalized, normalized)): - raise ValueError("staged positions must advance strictly forward") - required = set(range(floor(accepted)+1, floor(normalized[-1])+1)) - if not required.issubset(normalized): - raise ValueError("staged positions must include every crossed integer boundary") - return normalized - - -def encode_checkpoint(compiled, position, inner): - if type(compiled) is not CompiledStagedDeadLoadProgramme: - raise TypeError("typed compiled staged programme required") - position, cursor, fraction = _progress(compiled.stage_count, position) - if type(inner) is not bytes or not inner or len(inner) > MAX_CHECKPOINT_BYTES: - raise ValueError("bounded staged inner checkpoint bytes required") + + def progress_at(self, position): + _, cursor, fraction = _progress(self.stage_count, position) + return cursor, fraction + + def load_at(self, position): + _, cursor, fraction = _progress(self.stage_count, position) + if fraction == 0.: + return self.vectors[cursor] + a, b = self.vectors[cursor], self.vectors[cursor+1] + result = np.zeros_like(a) + wb = Fraction(fraction) + wa = 1-wb + # Only active spatial components need a bounded exact two-term dot. + # This avoids overflow-prone endpoint subtraction and false zero work. + for index in np.flatnonzero((a != 0.) | (b != 0.)): + if a[index] == b[index]: + result[index] = a[index] + continue + exact = wa*Fraction(float(a[index])) + wb*Fraction(float(b[index])) + try: + value = float(exact) + except OverflowError as exc: + raise StagedLoadResolutionError("staged force interpolation overflow") from exc + if (not isfinite(value) or (exact != 0 and value == 0.) or + (0. < abs(value) < np.finfo(float).tiny and Fraction(value) != exact)): + raise StagedLoadResolutionError("staged force interpolation is unresolved") + result[index] = value + return np.frombuffer(result.tobytes(), dtype=np.float64) + + def validate_targets(self, accepted_position, targets): + accepted, _, _ = _progress(self.stage_count, accepted_position) + if type(targets) is not tuple or not targets: + raise ValueError("nonempty tuple of staged positions required") + normalized = tuple(_progress(self.stage_count, p)[0] for p in targets) + if any(b <= a for a, b in zip((accepted,)+normalized, normalized)): + raise ValueError("staged positions must advance strictly forward") + required = set(range(floor(accepted)+1, floor(normalized[-1])+1)) + if not required.issubset(normalized): + raise ValueError("staged positions must include every crossed integer boundary") + return normalized + + +def encode_checkpoint(compiled, position, inner): + if type(compiled) is not CompiledStagedDeadLoadProgramme: + raise TypeError("typed compiled staged programme required") + position, cursor, fraction = _progress(compiled.stage_count, position) + if type(inner) is not bytes or not inner or len(inner) > MAX_CHECKPOINT_BYTES: + raise ValueError("bounded staged inner checkpoint bytes required") header = _canonical(dict(policy=compiled.programme.policy, programme=compiled.programme.to_payload(), - position=position, cursor=cursor, fraction=fraction, inner_sha256=sha256(inner).hexdigest())) - size = len(MAGIC)+4+len(header)+len(inner)+32 - if len(header) > MAX_METADATA_BYTES or size > MAX_CHECKPOINT_BYTES: - raise ValueError("staged checkpoint metadata/total byte bound exceeded") - content = MAGIC+len(header).to_bytes(4, "little")+header+inner - return content+sha256(content).digest() - - -def decode_checkpoint(raw): - if (type(raw) is not bytes or not raw.startswith(MAGIC) or - not len(MAGIC)+4+32 < len(raw) <= MAX_CHECKPOINT_BYTES): - raise ValueError("invalid bounded staged checkpoint framing") - start = len(MAGIC)+4 - size = int.from_bytes(raw[len(MAGIC):start], "little") - if not 0 < size <= MAX_METADATA_BYTES or start+size >= len(raw)-32: - raise ValueError("invalid staged checkpoint metadata bound") - if sha256(memoryview(raw)[:-32]).digest() != raw[-32:]: - raise ValueError("staged checkpoint content digest mismatch") - header_raw = raw[start:start+size] - header = _json(header_raw) - if (type(header) is not dict or set(header) != {"policy", "programme", "position", "cursor", "fraction", "inner_sha256"} + position=position, cursor=cursor, fraction=fraction, inner_sha256=sha256(inner).hexdigest())) + size = len(MAGIC)+4+len(header)+len(inner)+32 + if len(header) > MAX_METADATA_BYTES or size > MAX_CHECKPOINT_BYTES: + raise ValueError("staged checkpoint metadata/total byte bound exceeded") + content = MAGIC+len(header).to_bytes(4, "little")+header+inner + return content+sha256(content).digest() + + +def decode_checkpoint(raw): + if (type(raw) is not bytes or not raw.startswith(MAGIC) or + not len(MAGIC)+4+32 < len(raw) <= MAX_CHECKPOINT_BYTES): + raise ValueError("invalid bounded staged checkpoint framing") + start = len(MAGIC)+4 + size = int.from_bytes(raw[len(MAGIC):start], "little") + if not 0 < size <= MAX_METADATA_BYTES or start+size >= len(raw)-32: + raise ValueError("invalid staged checkpoint metadata bound") + if sha256(memoryview(raw)[:-32]).digest() != raw[-32:]: + raise ValueError("staged checkpoint content digest mismatch") + header_raw = raw[start:start+size] + header = _json(header_raw) + if (type(header) is not dict or set(header) != {"policy", "programme", "position", "cursor", "fraction", "inner_sha256"} or header["policy"] not in (POLICY, ZERO_REFERENCE_POLICY) or type(header["position"]) is not float - or type(header["fraction"]) is not float or type(header["cursor"]) is not int - or _canonical(header) != header_raw): - raise ValueError("invalid staged checkpoint fields/types/canonical metadata") + or type(header["fraction"]) is not float or type(header["cursor"]) is not int + or _canonical(header) != header_raw): + raise ValueError("invalid staged checkpoint fields/types/canonical metadata") programme = StagedDeadLoadProgramme.from_payload(header["programme"]) if header["policy"] != programme.policy: raise ValueError("staged checkpoint normalization policy mismatch") - position, cursor, fraction = _progress(programme.stage_count, header["position"]) - if (header["cursor"] != cursor or header["fraction"] != fraction or - _canonical({**header, "position": position, "cursor": cursor, "fraction": fraction}) != header_raw): - raise ValueError("staged checkpoint progress derivation mismatch") - inner = raw[start+size:-32] - if header["inner_sha256"] != sha256(inner).hexdigest(): - raise ValueError("staged checkpoint inner digest mismatch") - return programme, position, inner + position, cursor, fraction = _progress(programme.stage_count, header["position"]) + if (header["cursor"] != cursor or header["fraction"] != fraction or + _canonical({**header, "position": position, "cursor": cursor, "fraction": fraction}) != header_raw): + raise ValueError("staged checkpoint progress derivation mismatch") + inner = raw[start+size:-32] + if header["inner_sha256"] != sha256(inner).hexdigest(): + raise ValueError("staged checkpoint inner digest mismatch") + return programme, position, inner diff --git a/src/anysolver/_stiffened_shell_stress_free_reference.py b/src/anyfesolver/_stiffened_shell_stress_free_reference.py similarity index 100% rename from src/anysolver/_stiffened_shell_stress_free_reference.py rename to src/anyfesolver/_stiffened_shell_stress_free_reference.py diff --git a/src/anyfesolver/_wire_types.py b/src/anyfesolver/_wire_types.py new file mode 100644 index 000000000..fe2781614 --- /dev/null +++ b/src/anyfesolver/_wire_types.py @@ -0,0 +1,17 @@ +"""Type identities used by checkpoint and detached-result format versions.""" + +import sys + + +def wire_class_name(cls: type) -> str: + """Return the original wire namespace for a class defined by the solver. + + These identifiers are included in checksums. They are never imported from + a serialized record. Foreign classes keep their original qualification. + """ + module_name = cls.__module__ + if module_name.startswith("anyfesolver."): + owner = sys.modules.get(module_name) + if owner is not None and vars(owner).get(cls.__qualname__) is cls: + module_name = "anysolver." + module_name.removeprefix("anyfesolver.") + return f"{module_name}.{cls.__qualname__}" diff --git a/src/anysolver/activity.py b/src/anyfesolver/activity.py similarity index 100% rename from src/anysolver/activity.py rename to src/anyfesolver/activity.py diff --git a/src/anysolver/algebraic_dynamics.py b/src/anyfesolver/algebraic_dynamics.py similarity index 100% rename from src/anysolver/algebraic_dynamics.py rename to src/anyfesolver/algebraic_dynamics.py diff --git a/src/anysolver/analysis_session.py b/src/anyfesolver/analysis_session.py similarity index 99% rename from src/anysolver/analysis_session.py rename to src/anyfesolver/analysis_session.py index 35e173a6e..05865f414 100644 --- a/src/anysolver/analysis_session.py +++ b/src/anyfesolver/analysis_session.py @@ -1,7 +1,7 @@ """Bounded, revision-aware reuse for repeated analyses. The session owns immutable structural matrices, the affine constraint plan and -factorizations for one :class:`~anysolver.fe_core.FEModel`. Load values are +factorizations for one :class:`~anyfesolver.fe_core.FEModel`. Load values are deliberately excluded from structural cache keys. Callers may therefore reuse one session across static load cases, modal analysis and linear buckling while ordinary one-off solves retain their existing behaviour. diff --git a/src/anysolver/anystructure_fem_mode.py b/src/anyfesolver/anystructure_fem_mode.py similarity index 99% rename from src/anysolver/anystructure_fem_mode.py rename to src/anyfesolver/anystructure_fem_mode.py index b435c5e98..8c4fea81f 100644 --- a/src/anysolver/anystructure_fem_mode.py +++ b/src/anyfesolver/anystructure_fem_mode.py @@ -853,7 +853,7 @@ def idealize_generated_geometry_members( used_node_ids = set(node_coords) output: Dict[str, Any] = { - "name": str(_value(generated_geometry, "name", default="ANYsolverGeneratedGeometry")), + "name": str(_value(generated_geometry, "name", default="ANYfeSolverGeneratedGeometry")), "nodes": nodes, "shells": [], "beams": [_beam_item_copy(source, beam) for source, beam in _combined_collections( @@ -973,12 +973,12 @@ def _add_materials(model: FEModel, generated_geometry: Any, config: AnyStructure if symmetry == "anisotropic": raise NotImplementedError( f"Generated material {name!r} requests general anisotropic elasticity; " - "ANYsolver currently supports isotropic and orthotropic materials only." + "ANYfeSolver currently supports isotropic and orthotropic materials only." ) if symmetry not in {"isotropic", "orthotropic"}: raise NotImplementedError( f"Generated material {name!r} requests unsupported elastic symmetry " - f"{symmetry!r}; ANYsolver currently supports isotropic and " + f"{symmetry!r}; ANYfeSolver currently supports isotropic and " "orthotropic materials only." ) if symmetry == "orthotropic": @@ -1018,7 +1018,7 @@ def build_fe_model_from_generated_geometry( raise ValueError("missing-generated-geometry") generated_geometry = idealize_generated_geometry_members(generated_geometry, config) - model = FEModel(str(_value(generated_geometry, "name", default="ANYsolverGeneratedGeometry"))) + model = FEModel(str(_value(generated_geometry, "name", default="ANYfeSolverGeneratedGeometry"))) _add_materials(model, generated_geometry, config) generalized_shell_sections = _generalized_shell_section_definitions( generated_geometry diff --git a/src/anysolver/arc_length.py b/src/anyfesolver/arc_length.py similarity index 99% rename from src/anysolver/arc_length.py rename to src/anyfesolver/arc_length.py index ef6440499..82ee3ec5a 100644 --- a/src/anysolver/arc_length.py +++ b/src/anyfesolver/arc_length.py @@ -3,9 +3,9 @@ This module follows one proportional reference load through the first limit point. It reuses the production nonlinear element response, constraint transformation and committed material-state machinery from -:mod:`anysolver.nonlinear_static`. +:mod:`anyfesolver.nonlinear_static`. -Scope is deliberately limited to the ANYsolver capacity workflow: +Scope is deliberately limited to the ANYfeSolver capacity workflow: * one proportional load pattern plus an optional constant preload, * constrained models (no nonlinear free-free nullspace solve), @@ -903,7 +903,7 @@ def _solve_static_arc_length_under_lease( Current-area follower pressure contributes both its displacement-dependent force and exact load tangent. Corotational ``"auto"`` tangent selection - follows :func:`anysolver.solve_static_nonlinear`: it selects the consistent + follows :func:`anyfesolver.solve_static_nonlinear`: it selects the consistent chain-rule tangent for follower pressure and the rotated approximation otherwise. """ diff --git a/src/anysolver/assembly.py b/src/anyfesolver/assembly.py similarity index 99% rename from src/anysolver/assembly.py rename to src/anyfesolver/assembly.py index 6d514df59..d25349c51 100644 --- a/src/anysolver/assembly.py +++ b/src/anyfesolver/assembly.py @@ -75,7 +75,7 @@ def assemble_system( load_case: Optional["LoadCase"] = None, include_mass: bool = False, ) -> Tuple[sparse.csr_matrix, np.ndarray, Dict[str, Any]]: - """Compatibility wrapper around :mod:`anysolver.matrix_assembly`.""" + """Compatibility wrapper around :mod:`anyfesolver.matrix_assembly`.""" return _canonical_assemble_system(model, load_case, include_mass) @@ -1320,7 +1320,7 @@ def solve_nonlinear( ) -> Tuple[np.ndarray, Dict[str, Any]]: """Deprecated prototype nonlinear solve. - Use :func:`anysolver.solve_static_nonlinear` for the qualified incremental + Use :func:`anyfesolver.solve_static_nonlinear` for the qualified incremental geometric/material nonlinear API. """ cancellation_safe_point(cancellation_token, "deprecated_nonlinear.start") diff --git a/src/anysolver/b3_ge.py b/src/anyfesolver/b3_ge.py similarity index 100% rename from src/anysolver/b3_ge.py rename to src/anyfesolver/b3_ge.py diff --git a/src/anysolver/baselines.py b/src/anyfesolver/baselines.py similarity index 100% rename from src/anysolver/baselines.py rename to src/anyfesolver/baselines.py diff --git a/src/anysolver/beam_sections.py b/src/anyfesolver/beam_sections.py similarity index 100% rename from src/anysolver/beam_sections.py rename to src/anyfesolver/beam_sections.py diff --git a/src/anysolver/beam_shell_verification.py b/src/anyfesolver/beam_shell_verification.py similarity index 99% rename from src/anysolver/beam_shell_verification.py rename to src/anyfesolver/beam_shell_verification.py index e0fa89740..4ca55f7d6 100644 --- a/src/anysolver/beam_shell_verification.py +++ b/src/anyfesolver/beam_shell_verification.py @@ -71,31 +71,31 @@ DEFAULT_BEAM_SHELL_VERIFICATION_PATH = Path("reports/beam_shell_verification/beam_shell_verification_report.json") _EXTERNAL_REFERENCE_REPORT_OVERRIDE: contextvars.ContextVar[Optional[Path]] = contextvars.ContextVar( - "anysolver_external_reference_report", + "anyfesolver_external_reference_report", default=None, ) _EXTERNAL_REFERENCE_REPORT_RUN_CACHE: contextvars.ContextVar[ Optional[Dict[Path, Dict[str, Any]]] ] = contextvars.ContextVar( - "anysolver_external_reference_report_run_cache", + "anyfesolver_external_reference_report_run_cache", default=None, ) _COMPOSITE_METRIC_RUN_CACHE: contextvars.ContextVar[ Optional[Dict[str, Tuple[Tuple[Dict[str, Any], ...], float, float]]] ] = contextvars.ContextVar( - "anysolver_composite_metric_run_cache", + "anyfesolver_composite_metric_run_cache", default=None, ) _PLATE_BUCKLING_RUN_CACHE: contextvars.ContextVar[ Optional[Dict[Tuple[int, float], Tuple[float, Dict[str, Any]]]] ] = contextvars.ContextVar( - "anysolver_plate_buckling_run_cache", + "anyfesolver_plate_buckling_run_cache", default=None, ) _NONLINEAR_FRAMEWORK_RUN_CACHE: contextvars.ContextVar[ Optional[Dict[str, "VerificationCaseResult"]] ] = contextvars.ContextVar( - "anysolver_nonlinear_framework_run_cache", + "anyfesolver_nonlinear_framework_run_cache", default=None, ) @@ -3828,7 +3828,7 @@ def _run_vvr_001(case: VerificationCase) -> VerificationCaseResult: "external_numerical_validation_status": external_evidence["numerical_validation_status"], "known_limitations": [ external_limitation, - "The verified production scope remains the documented ANYsolver beam-shell scope, not a general-purpose FE claim.", + "The verified production scope remains the documented ANYfeSolver beam-shell scope, not a general-purpose FE claim.", "The beam-shell and production-readiness reports are generated by the caller after this case completes, so VVR-001 avoids a circular dependency on the file currently being written.", ], } @@ -4573,7 +4573,7 @@ def _run_beam_shell_verification(selected_ids: Optional[Iterable[str]] = None) - "release_gate_status": thin_gate["release_gate_status"], "default_tolerances": dict(DEFAULT_TOLERANCES), "verification_programme": { - "title": "ANYsolver Complete Verification Programme", + "title": "ANYfeSolver Complete Verification Programme", "version": 1, "batches": {key: list(value) for key, value in PROGRAMME_BATCH_CASES.items()}, "release_gates": {key: list(value) for key, value in PROGRAMME_RELEASE_GATES.items()}, diff --git a/src/anysolver/beam_validity.py b/src/anyfesolver/beam_validity.py similarity index 100% rename from src/anysolver/beam_validity.py rename to src/anyfesolver/beam_validity.py diff --git a/src/anysolver/benchmarks.py b/src/anyfesolver/benchmarks.py similarity index 100% rename from src/anysolver/benchmarks.py rename to src/anyfesolver/benchmarks.py diff --git a/src/anysolver/boundary.py b/src/anyfesolver/boundary.py similarity index 99% rename from src/anysolver/boundary.py rename to src/anyfesolver/boundary.py index db4f8af78..2de0e8568 100644 --- a/src/anysolver/boundary.py +++ b/src/anyfesolver/boundary.py @@ -660,7 +660,7 @@ def _get_load_vector_under_lease( gravity loads retain their reference-configuration semantics. """ qualified_runtime_guard(stage="load-vector preflight") - if any(type(e).__module__ == "anysolver._ge_beam3_native_fibre_static_element" for e in mesh.elements.values()): + if any(type(e).__module__ == "anyfesolver._ge_beam3_native_fibre_static_element" for e in mesh.elements.values()): from ._ge_beam3_native_load_admission import assemble_nodal_forces return assemble_nodal_forces( @@ -814,7 +814,7 @@ def _callable_authority(member: Any, seen: tuple = ()) -> tuple: None if member.__kwdefaults__ is None else tuple(member.__kwdefaults__.items()), tuple((value, _callable_authority(value, seen + (member,)), name == "accepted_generation" and type(value) is int - and member.__globals__.get("__name__") == "anysolver._qualified_authority_epoch" + and member.__globals__.get("__name__") == "anyfesolver._qualified_authority_epoch" and member.__qualname__ in ( "_AuthorityEpochManager.bind..require", "_AuthorityEpochManager.bind_context..require", @@ -866,7 +866,7 @@ def _callable_authority_matches(member: Any, authority: tuple) -> bool: (name, type.__getattribute__(_FEMesh, "__dict__")[name]) for name in ("get_node", "get_element") ) -_NATIVE_FIBRE_STATIC_MODULE = "anysolver._ge_beam3_native_fibre_static_element" +_NATIVE_FIBRE_STATIC_MODULE = "anyfesolver._ge_beam3_native_fibre_static_element" _EXACT_LOAD_CASE_FIELDS = frozenset(LoadCase.__dataclass_fields__) _EXACT_LOAD_ROUTING_CLASSES = tuple( (owner, type.__getattribute__(owner, "__mro__"), @@ -1246,7 +1246,7 @@ def _capture_mass_function_dependencies() -> tuple: pending.extend(methods.get(name, ())) value = namespace.get(name) if (type(value) is types.FunctionType and - value.__globals__.get("__name__", "").startswith(("anysolver.", "anymaterial."))): + value.__globals__.get("__name__", "").startswith(("anyfesolver.", "anymaterial."))): dependencies.append((namespace, name, value, _callable_authority(value))) pending.append(value) return tuple(dependencies) diff --git a/src/anysolver/buckling.py b/src/anyfesolver/buckling.py similarity index 99% rename from src/anysolver/buckling.py rename to src/anyfesolver/buckling.py index cf29f6c4a..259f9dd00 100644 --- a/src/anysolver/buckling.py +++ b/src/anyfesolver/buckling.py @@ -194,7 +194,7 @@ def _try_exact_dead_load_zero_tangent( type(element) is QualifiedE4PLS3ShellElement or _static_formulation_id(element) == _QUALIFIED_S3_FORMULATION_ID or type.__getattribute__(type(element), "__module__") - == "anysolver._ge_beam3_native_fibre_static_element" + == "anyfesolver._ge_beam3_native_fibre_static_element" for element in element_values ): return None @@ -664,7 +664,7 @@ def _solve_eigenvalue_buckling_under_lease( """Solve ``K phi = lambda (KG + Kload) phi`` for positive factors. ``element_states`` is passed to - :func:`anysolver.matrix_assembly.assemble_geometric_stiffness_matrix`. + :func:`anyfesolver.matrix_assembly.assemble_geometric_stiffness_matrix`. Beam elements accept axial reference compression and shell elements accept membrane resultant prestress (compression positive, or tension-positive ``membrane_forces``). diff --git a/src/anysolver/buckling_validity.py b/src/anyfesolver/buckling_validity.py similarity index 100% rename from src/anysolver/buckling_validity.py rename to src/anyfesolver/buckling_validity.py diff --git a/src/anysolver/capacity_workflow.py b/src/anyfesolver/capacity_workflow.py similarity index 100% rename from src/anysolver/capacity_workflow.py rename to src/anyfesolver/capacity_workflow.py diff --git a/src/anysolver/capsule_runtime_guard.py b/src/anyfesolver/capsule_runtime_guard.py similarity index 95% rename from src/anysolver/capsule_runtime_guard.py rename to src/anyfesolver/capsule_runtime_guard.py index 24645e91a..1aaf1c84b 100644 --- a/src/anysolver/capsule_runtime_guard.py +++ b/src/anyfesolver/capsule_runtime_guard.py @@ -32,13 +32,13 @@ def visit(function): records.append((function,_callable_authority(function),bindings)) for name,value in bindings: module_name=getattr(value,'__module__','') if type(value) in (types.FunctionType,type) else '' - if type(value) is types.FunctionType and (module_name == source_name or module_name.startswith('anysolver_results')): + if type(value) is types.FunctionType and (module_name == source_name or module_name.startswith('anyfesolver_results')): visit(value) - elif type(value) is type and (module_name == source_name or module_name.startswith('anysolver_results')): + elif type(value) is type and (module_name == source_name or module_name.startswith('anyfesolver_results')): visit_class(value) elif type(value) is dict and name == 'OPERATIONS': tables.append((value,tuple(value.items()))) - elif type(value) is types.ModuleType and value.__name__.startswith('anysolver_results'): + elif type(value) is types.ModuleType and value.__name__.startswith('anyfesolver_results'): module_vars=vars(value) for member in function.__code__.co_names: if member in module_vars and type(module_vars[member]) is types.FunctionType: @@ -59,8 +59,8 @@ def visit(function): numpy_linalg_type=type(numpy_linalg) spectral_authority=_callable_authority(numpy_spectral[1]) # Module entrypoints are pinned as well as aliases used by the producer. - import anysolver_results as runtime - from anysolver_results import capsule, registry + import anyfesolver_results as runtime + from anyfesolver_results import capsule, registry for module,names in ((runtime,('reconstruct_response','derive_field')), (capsule,('reconstruct_response','_combine_response')), (registry,('derive_field',))): diff --git a/src/anysolver/cases.py b/src/anyfesolver/cases.py similarity index 100% rename from src/anysolver/cases.py rename to src/anyfesolver/cases.py diff --git a/src/anysolver/composite_strip_verification.py b/src/anyfesolver/composite_strip_verification.py similarity index 100% rename from src/anysolver/composite_strip_verification.py rename to src/anyfesolver/composite_strip_verification.py diff --git a/src/anysolver/concentrated_mass.py b/src/anyfesolver/concentrated_mass.py similarity index 100% rename from src/anysolver/concentrated_mass.py rename to src/anyfesolver/concentrated_mass.py diff --git a/src/anysolver/constraint_audit.py b/src/anyfesolver/constraint_audit.py similarity index 99% rename from src/anysolver/constraint_audit.py rename to src/anyfesolver/constraint_audit.py index aa349b3e5..8abf6a92a 100644 --- a/src/anysolver/constraint_audit.py +++ b/src/anyfesolver/constraint_audit.py @@ -1,6 +1,6 @@ """Auditable fixed-DOF and linear MPC constraint contracts. -ANYsolver deliberately supports a restricted affine constraint form:: +ANYfeSolver deliberately supports a restricted affine constraint form:: u_slave = sum(a_i * u_master_i) + value @@ -47,7 +47,7 @@ class ConstraintEquation: The public constructor uses ``terms``, ``rhs`` and ``source_id``. The first term is the dependent/pivot DOF unless ``dependent_dof`` is supplied explicitly. Ordering equations this way preserves the sparse, acyclic - affine reduction used throughout ANYsolver. + affine reduction used throughout ANYfeSolver. Legacy normalized names (``coefficients``, ``value`` and ``origin``) stay available as read-only aliases and accepted keyword arguments. diff --git a/src/anysolver/contact.py b/src/anyfesolver/contact.py similarity index 100% rename from src/anysolver/contact.py rename to src/anyfesolver/contact.py diff --git a/src/anysolver/contact_performance.py b/src/anyfesolver/contact_performance.py similarity index 99% rename from src/anysolver/contact_performance.py rename to src/anyfesolver/contact_performance.py index 08010be2c..4b88f68ac 100644 --- a/src/anysolver/contact_performance.py +++ b/src/anyfesolver/contact_performance.py @@ -1,6 +1,6 @@ """Compact work storage for rigid-sphere contact assembly. -Contact geometry remains in :mod:`anysolver.contact`. This module only owns +Contact geometry remains in :mod:`anyfesolver.contact`. This module only owns the reusable candidate arrays, deterministic active-contact reduction, direct full-vector scatter, and lazy conversion to the public contact-record type. """ diff --git a/src/anysolver/control.py b/src/anyfesolver/control.py similarity index 98% rename from src/anysolver/control.py rename to src/anyfesolver/control.py index be9d68d0e..1049ebbc5 100644 --- a/src/anysolver/control.py +++ b/src/anyfesolver/control.py @@ -1,6 +1,6 @@ """Cooperative solve cancellation and structured progress contracts. -The numerical kernels in :mod:`anysolver` are intentionally synchronous. A +The numerical kernels in :mod:`anyfesolver` are intentionally synchronous. A caller that runs them in a worker thread can nevertheless request cancellation at deterministic safe points by sharing a :class:`CancellationToken`. Sparse factorizations performed by third-party libraries cannot be interrupted; the diff --git a/src/anysolver/corotational.py b/src/anyfesolver/corotational.py similarity index 100% rename from src/anysolver/corotational.py rename to src/anyfesolver/corotational.py diff --git a/src/anysolver/corotational_performance.py b/src/anyfesolver/corotational_performance.py similarity index 100% rename from src/anysolver/corotational_performance.py rename to src/anyfesolver/corotational_performance.py diff --git a/src/anysolver/current_state_tangent.py b/src/anyfesolver/current_state_tangent.py similarity index 100% rename from src/anysolver/current_state_tangent.py rename to src/anyfesolver/current_state_tangent.py diff --git a/src/anysolver/cylinder_benchmarks.py b/src/anyfesolver/cylinder_benchmarks.py similarity index 100% rename from src/anysolver/cylinder_benchmarks.py rename to src/anyfesolver/cylinder_benchmarks.py diff --git a/src/anysolver/damage_matrix_performance.py b/src/anyfesolver/damage_matrix_performance.py similarity index 100% rename from src/anysolver/damage_matrix_performance.py rename to src/anyfesolver/damage_matrix_performance.py diff --git a/src/anysolver/dynamics.py b/src/anyfesolver/dynamics.py similarity index 100% rename from src/anysolver/dynamics.py rename to src/anyfesolver/dynamics.py diff --git a/src/anysolver/e4_pl_element.py b/src/anyfesolver/e4_pl_element.py similarity index 99% rename from src/anysolver/e4_pl_element.py rename to src/anyfesolver/e4_pl_element.py index 47efceacb..3ded2fff1 100644 --- a/src/anysolver/e4_pl_element.py +++ b/src/anyfesolver/e4_pl_element.py @@ -1,6 +1,6 @@ """Dormant production implementation of the qualified E4-PL four-node shell. -The class reuses the mature :class:`~anysolver.elements.ShellElement` +The class reuses the mature :class:`~anyfesolver.elements.ShellElement` infrastructure for mass, geometric stiffness, state, nonlinear, dynamics, contact and serialization behavior. Planar facets use the qualified 35+3 stationary E4-PL formulation for both tangent and physical recovery. Genuinely @@ -2609,7 +2609,7 @@ def get_node_coordinates( raise ValueError(f"Node {node_id} not found") if type(node) is not Node: raise ValueError( - f"Node {node_id} is not an exact ANYsolver Node" + f"Node {node_id} is not an exact ANYfeSolver Node" ) namespace = object.__getattribute__(node, "__dict__") if type(namespace) is not dict or not all( diff --git a/src/anysolver/e4_pl_enriched.py b/src/anyfesolver/e4_pl_enriched.py similarity index 100% rename from src/anysolver/e4_pl_enriched.py rename to src/anyfesolver/e4_pl_enriched.py diff --git a/src/anysolver/e4_pl_enriched_nonlinear.py b/src/anyfesolver/e4_pl_enriched_nonlinear.py similarity index 100% rename from src/anysolver/e4_pl_enriched_nonlinear.py rename to src/anyfesolver/e4_pl_enriched_nonlinear.py diff --git a/src/anysolver/e4_pl_s3_element.py b/src/anyfesolver/e4_pl_s3_element.py similarity index 99% rename from src/anysolver/e4_pl_s3_element.py rename to src/anyfesolver/e4_pl_s3_element.py index 8047c66f6..be978bd2b 100644 --- a/src/anysolver/e4_pl_s3_element.py +++ b/src/anyfesolver/e4_pl_s3_element.py @@ -3674,7 +3674,7 @@ def get_node_coordinates( raise ValueError(f"Node {node_id} not found") if type(node) is not Node: raise ValueError( - f"Node {node_id} is not an exact ANYsolver Node" + f"Node {node_id} is not an exact ANYfeSolver Node" ) namespace = object.__getattribute__(node, "__dict__") if type(namespace) is not dict or not all( diff --git a/src/anysolver/e4_pl_s3_initial_fields.py b/src/anyfesolver/e4_pl_s3_initial_fields.py similarity index 97% rename from src/anysolver/e4_pl_s3_initial_fields.py rename to src/anyfesolver/e4_pl_s3_initial_fields.py index e5ca4e05c..3acbeb6d3 100644 --- a/src/anysolver/e4_pl_s3_initial_fields.py +++ b/src/anyfesolver/e4_pl_s3_initial_fields.py @@ -1,6 +1,6 @@ """Generalized initial-field offsets for the qualified S3 companion. -The public :class:`~anysolver.nonlinear_static.ShellInitialField` convention +The public :class:`~anyfesolver.nonlinear_static.ShellInitialField` convention describes a uniform membrane stress, an antisymmetric *surface* bending stress, and membrane/curvature eigenstrains in the numbered shell frame. A pre-integrated generalized section has no layers from which those inputs can diff --git a/src/anysolver/e4_pl_s3_state.py b/src/anyfesolver/e4_pl_s3_state.py similarity index 100% rename from src/anysolver/e4_pl_s3_state.py rename to src/anyfesolver/e4_pl_s3_state.py diff --git a/src/anysolver/e4_pl_s3_v2_element.py b/src/anyfesolver/e4_pl_s3_v2_element.py similarity index 100% rename from src/anysolver/e4_pl_s3_v2_element.py rename to src/anyfesolver/e4_pl_s3_v2_element.py diff --git a/src/anysolver/e4_pl_s3_v2b_element.py b/src/anyfesolver/e4_pl_s3_v2b_element.py similarity index 100% rename from src/anysolver/e4_pl_s3_v2b_element.py rename to src/anyfesolver/e4_pl_s3_v2b_element.py diff --git a/src/anysolver/e4_pl_s3_v2c_element.py b/src/anyfesolver/e4_pl_s3_v2c_element.py similarity index 100% rename from src/anysolver/e4_pl_s3_v2c_element.py rename to src/anyfesolver/e4_pl_s3_v2c_element.py diff --git a/src/anysolver/e4_pl_s3_v2d_element.py b/src/anyfesolver/e4_pl_s3_v2d_element.py similarity index 100% rename from src/anysolver/e4_pl_s3_v2d_element.py rename to src/anyfesolver/e4_pl_s3_v2d_element.py diff --git a/src/anysolver/e4_pl_s3_v2d_state.py b/src/anyfesolver/e4_pl_s3_v2d_state.py similarity index 100% rename from src/anysolver/e4_pl_s3_v2d_state.py rename to src/anyfesolver/e4_pl_s3_v2d_state.py diff --git a/src/anysolver/element_capabilities.py b/src/anyfesolver/element_capabilities.py similarity index 100% rename from src/anysolver/element_capabilities.py rename to src/anyfesolver/element_capabilities.py diff --git a/src/anysolver/element_qualification.py b/src/anyfesolver/element_qualification.py similarity index 100% rename from src/anysolver/element_qualification.py rename to src/anyfesolver/element_qualification.py diff --git a/src/anysolver/elements.py b/src/anyfesolver/elements.py similarity index 97% rename from src/anysolver/elements.py rename to src/anyfesolver/elements.py index 0654d4196..beae44a0c 100644 --- a/src/anysolver/elements.py +++ b/src/anyfesolver/elements.py @@ -1,4435 +1,4435 @@ -""" -Finite Element Implementations - -This module contains element formulations for: -- ShellElement: 3/6-node triangular and 4/8-node quadrilateral Mindlin-Reissner shell element -- BeamElement: 2-node Timoshenko beam element with 6 DOF/node -- QuadraticBeamElement: 3-node quadratic Timoshenko beam element -- CoupledBeamShellElement: kinematic MPC element for eccentric beam-shell interaction - -Shell convention ----------------- -The shell element forms stiffness and stresses in an element-local orthonormal -basis at each integration point: - - local x = projected xi tangent direction - local y = in-surface direction perpendicular to local x - local z = shell normal - -Global nodal translations and rotations are transformed to this local basis -before the membrane, bending and transverse shear B-matrices are evaluated. - -Shell shear treatment ---------------------- -Membrane and bending always use full integration for the element topology. -Transverse shear depends on the topology: - - * 4-node: MITC4 assumed natural shear (covariant shear sampled at the four - edge midpoints and interpolated), integrated at the full 2x2 rule. This - avoids both shear locking and the spurious zero-energy w-hourglass mode - of one-point reduced shear integration. - * 3-node: centroidal edge-compatible assumed shear. This is the constant - shear part of the DSG/MITC3 family: transverse shear is evaluated from - the element-average shear gap in the centroid frame, preserving rigid - body motion and constant-shear patches without the locking-prone fully - integrated linear Mindlin shear term. - * 6-node: quadratic displacement interpolation with reduced three-point - triangular shear integration. - * 8-node: reduced 2x2 shear integration (S8R style). When full element - reduced integration is requested, a small nullspace-projection - hourglass stiffness stabilizes modes outside the six rigid-body modes. - -Beam section convention ------------------------ -Beam local axes are (x = member axis, y, z). ``Iy`` is the second moment of -area about the local y axis and governs bending that deflects the beam in -local z; ``Iz`` governs deflection in local y. ``shear_factor_y`` scales the -shear area for transverse shear force in local y, ``shear_factor_z`` for local -z. The optional ``cross_section["orientation"]`` vector prescribes the local -z direction (e.g. the stiffener web direction). Without it, a heuristic picks -local y close to global Y (or global Z for members nearly parallel to Y), -which leaves the section orientation unconstrained for asymmetric sections. - -Beam-shell coupling -------------------- -Beam-shell coupling is represented as a linear multi-point constraint (MPC), -not as a large penalty spring. For a beam node offset from a shell node by -vector r, the coupling relation is: - - u_beam = u_shell + theta_shell x r - theta_beam = theta_shell - -The assembly solver eliminates these slave beam DOFs through a transformation. -""" - -from __future__ import annotations - -from abc import ABC, abstractmethod -import copy -from types import FunctionType, MemberDescriptorType -import warnings -from typing import TYPE_CHECKING, Any, Callable, Dict, List, Mapping, Optional, Tuple - -import numpy as np -from anymaterial import IsotropicMaterial as _RecoveryIsotropicMaterial -from . import _compensated_contractions as _local_contractions - -from .beam_sections import ( - GENERALIZED_BEAM_RESULTANT_ORDER, - GENERALIZED_BEAM_STRAIN_ORDER, - generalized_beam_mass_matrix, - generalized_beam_stiffness, - resolve_generalized_beam_section, -) -from .jit_compiler import njit -from .material_curves import FiberSectionPlasticityConfig -from .materials import ( - beam_material_properties as _canonical_beam_material_properties, - elastic_compliance_matrix as _canonical_elastic_compliance, - material_symmetry as _canonical_material_symmetry, -) -from .plasticity import lobatto_layers, plane_stress_elastic_matrix, plane_stress_return_map -from .shell_sections import ( - SHELL_MEMBRANE_VOIGT_ORDER, - SHELL_TRANSVERSE_SHEAR_ORDER, - GeneralizedShellSection, - coerce_generalized_shell_section, -) - -if TYPE_CHECKING: - from .fe_core import FEMesh, Material - - -_SMALL = 1.0e-12 -_INITIAL_SHELL_STATE_KEYS = ( - "initial_membrane_stress", - "initial_bending_stress", - "initial_membrane_prestrain", - "initial_curvature_prestrain", - "initial_field_provenance", -) -_INITIAL_BEAM_STATE_KEYS = ( - "initial_fiber_stress", - "initial_fiber_prestrain", - "initial_field_provenance", -) - - -_OBSERVATION_MISSING = object() -_NO_ATTRIBUTE_DEFAULT = object() - - -def _run_post_observation_guard( - post_observation: Optional[Callable[[], None]], -) -> None: - """Recheck a caller-supplied exact authority lease after one observation.""" - - if post_observation is not None: - post_observation() - - -def _guarded_observe_attribute( - owner: Any, - name: str, - *, - default: Any = _NO_ATTRIBUTE_DEFAULT, - post_observation: Optional[Callable[[], None]] = None, -) -> Any: - """Read one external attribute and recheck before consuming its value.""" - - if default is _NO_ATTRIBUTE_DEFAULT: - value = getattr(owner, name) - else: - value = getattr(owner, name, default) - _run_post_observation_guard(post_observation) - return value - - -def _guarded_observe_call( - provider: Any, - *args: Any, - post_observation: Optional[Callable[[], None]] = None, - **kwargs: Any, -) -> Any: - """Invoke one external provider and recheck before consuming its result.""" - - value = provider(*args, **kwargs) - _run_post_observation_guard(post_observation) - return value - - -def _guarded_float( - value: Any, - *, - post_observation: Optional[Callable[[], None]] = None, -) -> float: - made = float(value) - if type(value) is not float: - _run_post_observation_guard(post_observation) - return made - - -def _guarded_array( - value: Any, - *, - dtype: Any = np.float64, - post_observation: Optional[Callable[[], None]] = None, -) -> np.ndarray: - made = np.asarray(value, dtype=dtype) - # Converting an exact numeric ndarray runs no foreign code. - pure = type(value) is np.ndarray and value.dtype.kind in "fiub" - if not pure: - _run_post_observation_guard(post_observation) - owned = np.array(made, dtype=dtype, order="C", copy=True) - if not pure: - _run_post_observation_guard(post_observation) - return owned - - -def _guarded_owned_mapping( - value: Any, - *, - label: str, - post_observation: Optional[Callable[[], None]] = None, -) -> Dict[str, Any]: - """Detach a string-keyed external mapping before later evaluation.""" - - items_provider = _guarded_observe_attribute( - value, - "items", - post_observation=post_observation, - ) - observed_items = _guarded_observe_call( - items_provider, - post_observation=post_observation, - ) - items = tuple(observed_items) - _run_post_observation_guard(post_observation) - owned: Dict[str, Any] = {} - for item in items: - if type(item) is not tuple or len(item) != 2 or type(item[0]) is not str: - raise TypeError(f"{label} must contain exact string keys") - key, member = item - if key in owned: - raise ValueError(f"{label} contains duplicate key {key!r}") - owned[key] = member - return owned - - -def _guarded_owned_plain_value( - value: Any, - *, - label: str, - post_observation: Optional[Callable[[], None]] = None, -) -> Any: - """Recursively detach caller-owned state before formulation mechanics.""" - - if value is None or type(value) in {bool, int, float, str, bytes}: - return value - if type(value) is np.ndarray: - return _guarded_array( - value, - dtype=value.dtype, - post_observation=post_observation, - ) - if isinstance(value, Mapping): - observed = _guarded_owned_mapping( - value, - label=label, - post_observation=post_observation, - ) - return { - key: _guarded_owned_plain_value( - member, - label=f"{label}.{key}", - post_observation=post_observation, - ) - for key, member in observed.items() - } - if type(value) in {list, tuple}: - observed = tuple(value) - _run_post_observation_guard(post_observation) - made = [ - _guarded_owned_plain_value( - member, - label=f"{label}[{index}]", - post_observation=post_observation, - ) - for index, member in enumerate(observed) - ] - return made if type(value) is list else tuple(made) - try: - return _guarded_array( - value, - post_observation=post_observation, - ) - except (TypeError, ValueError) as exc: - raise TypeError(f"{label} contains an unsupported external value") from exc - - -def _guarded_owned_generalized_shell_section( - section: Any, - *, - post_observation: Optional[Callable[[], None]] = None, - _section_class: type[GeneralizedShellSection] = GeneralizedShellSection, -) -> Optional[GeneralizedShellSection]: - """Coerce one section protocol to an exact solver-owned section.""" - - if section is None: - return None - if type(section) is _section_class: - return section - if isinstance(section, Mapping): - source = _guarded_owned_mapping( - section, - label="generalized shell section", - post_observation=post_observation, - ) - - def read(label: str, default: Any = None) -> Any: - return source[label] if label in source else default - - else: - - def read(label: str, default: Any = None) -> Any: - return _guarded_observe_attribute( - section, - label, - default=default, - post_observation=post_observation, - ) - - matrices: Dict[str, np.ndarray] = {} - for name in ("A", "B", "D", "As"): - raw = read(name, _OBSERVATION_MISSING) - if raw is _OBSERVATION_MISSING or raw is None: - raise TypeError( - "Generalized shell section must provide A, B, D and As; " - f"missing {name}" - ) - matrices[name] = _guarded_array( - raw, - post_observation=post_observation, - ) - raw_name = read("name", "") - name = str(raw_name) - _run_post_observation_guard(post_observation) - masses: Dict[str, Optional[float]] = {} - for field in ("mass_per_area", "rotary_inertia_per_area"): - raw = read(field, None) - masses[field] = ( - None - if raw is None - else _guarded_float(raw, post_observation=post_observation) - ) - return _section_class( - A=matrices["A"], - B=matrices["B"], - D=matrices["D"], - As=matrices["As"], - name=name, - mass_per_area=masses["mass_per_area"], - rotary_inertia_per_area=masses["rotary_inertia_per_area"], - ) - - -def _immutable_float64_array(value: Any) -> np.ndarray: - """Return a C-contiguous float64 array backed by immutable bytes. - - Shell quadrature tables are process-wide formulation inputs. A normal - ``setflags(write=False)`` array can be made writable again when it owns its - storage; a bytes-backed view cannot. This prevents one element or test - from silently changing the rule used by every other shell element. - """ - - contiguous = np.ascontiguousarray(value, dtype=np.float64) - return np.frombuffer( - contiguous.tobytes(order="C"), dtype=np.float64 - ).reshape(contiguous.shape) - - -def _copy_state_fields(state: Any, keys: Tuple[str, ...]) -> Dict[str, Any]: - if not isinstance(state, dict): - return {} - copied: Dict[str, Any] = {} - for key in keys: - if key not in state: - continue - value = state[key] - copied[key] = value.copy() if isinstance(value, np.ndarray) else value - return copied - - -def _shell_field_rows(value: Any, n_gp: int, name: str) -> np.ndarray: - """Broadcast a shell-local engineering vector to one row per Gauss point.""" - array = np.asarray(value, dtype=float) - if array.shape == (3,): - return np.broadcast_to(array, (n_gp, 3)).copy() - if array.shape == (1, 3): - return np.broadcast_to(array, (n_gp, 3)).copy() - if array.shape == (n_gp, 3): - return array.copy() - raise ValueError(f"{name} must have shape (3,) or ({n_gp}, 3); got {array.shape}") - - -def _beam_fiber_field( - value: Any, - total_fibers: int, - section_fibers: int, - name: str, -) -> np.ndarray: - """Broadcast a beam-fiber field over one or all integration sections.""" - array = np.asarray(value, dtype=float).reshape(-1) - if array.size == 1: - return np.full(total_fibers, float(array[0]), dtype=float) - if array.size == section_fibers and total_fibers % section_fibers == 0: - return np.tile(array, total_fibers // section_fibers) - if array.size == total_fibers: - return array.copy() - raise ValueError( - f"{name} must be scalar, have {section_fibers} section-fiber values, " - f"or {total_fibers} total values; got {array.size}" - ) - - -@njit -def _cross3(a: np.ndarray, b: np.ndarray) -> np.ndarray: - """Cross product of two 3-vectors without np.cross dispatch overhead.""" - return np.array( - [ - a[1] * b[2] - a[2] * b[1], - a[2] * b[0] - a[0] * b[2], - a[0] * b[1] - a[1] * b[0], - ], - ) - - -@njit -def _inv2(matrix: np.ndarray) -> Tuple[np.ndarray, float]: - """Inverse and determinant of a 2x2 matrix without LAPACK overhead.""" - det = matrix[0, 0] * matrix[1, 1] - matrix[0, 1] * matrix[1, 0] - if abs(det) < _SMALL: - raise np.linalg.LinAlgError("singular 2x2 matrix") - inv = np.array( - [[matrix[1, 1], -matrix[0, 1]], [-matrix[1, 0], matrix[0, 0]]], - ) / det - return inv, float(det) - - -def _section_orientation(cross_section: Dict[str, Any]) -> Optional[np.ndarray]: - """Return the prescribed local-z (web) direction from a cross-section dict.""" - value = cross_section.get("orientation", cross_section.get("web_direction")) - if value is None: - return None - vector = np.asarray(value, dtype=float).reshape(-1) - if vector.size < 3 or float(np.linalg.norm(vector[:3])) < _SMALL: - return None - return np.array(vector[:3], dtype=float) - - -def _beam_rotation_matrix(e1: np.ndarray, orientation: Optional[np.ndarray]) -> np.ndarray: - """Build the beam local frame [e1 e2 e3] with optional prescribed local z. - - ``orientation`` is the requested local z direction (section web direction). - It is projected perpendicular to the member axis; if it is (nearly) - parallel to the axis the heuristic fallback is used instead. - """ - if orientation is not None: - candidate = orientation - np.dot(orientation, e1) * e1 - norm = float(np.linalg.norm(candidate)) - if norm > 1.0e-6 * float(np.linalg.norm(orientation)): - e3 = candidate / norm - e2 = _cross3(e3, e1) - e2 /= np.linalg.norm(e2) - return np.column_stack((e1, e2, e3)) - trial = np.array([0.0, 1.0, 0.0]) - if abs(float(np.dot(e1, trial))) > 0.95: - trial = np.array([0.0, 0.0, 1.0]) - e2 = trial - np.dot(trial, e1) * e1 - e2 /= np.linalg.norm(e2) - e3 = _cross3(e1, e2) - e3 /= np.linalg.norm(e3) - return np.column_stack((e1, e2, e3)) - - -def _elastic_symmetry( - material: Any, - post_observation: Optional[Callable[[], None]] = None, -) -> str: - """Return the normalized elastic symmetry without inventing isotropic aliases.""" - - symmetry = _canonical_material_symmetry(material) - _run_post_observation_guard(post_observation) - if symmetry not in {"isotropic", "orthotropic"}: - raise ValueError( - f"Unsupported elastic symmetry {symmetry!r}; ANYsolver currently supports " - "only isotropic and orthotropic materials." - ) - return symmetry - - -def _elastic_compliance( - material: Any, - post_observation: Optional[Callable[[], None]] = None, -) -> np.ndarray: - """Engineering compliance in [11,22,33,23,13,12] order.""" - - if post_observation is None: - raw_compliance = _canonical_elastic_compliance(material) - else: - provider = _guarded_observe_attribute( - material, - "elastic_compliance_matrix", - default=None, - post_observation=post_observation, - ) - if callable(provider): - raw_compliance = _guarded_observe_call( - provider, - post_observation=post_observation, - ) - elif _elastic_symmetry(material, post_observation) == "isotropic": - elastic_modulus = _guarded_float( - _guarded_observe_attribute( - material, - "elastic_modulus", - post_observation=post_observation, - ), - post_observation=post_observation, - ) - poisson_ratio = _guarded_float( - _guarded_observe_attribute( - material, - "poisson_ratio", - post_observation=post_observation, - ), - post_observation=post_observation, - ) - shear_modulus = elastic_modulus / (2.0 * (1.0 + poisson_ratio)) - raw_compliance = np.array( - [ - [ - 1.0 / elastic_modulus, - -poisson_ratio / elastic_modulus, - -poisson_ratio / elastic_modulus, - 0.0, - 0.0, - 0.0, - ], - [ - -poisson_ratio / elastic_modulus, - 1.0 / elastic_modulus, - -poisson_ratio / elastic_modulus, - 0.0, - 0.0, - 0.0, - ], - [ - -poisson_ratio / elastic_modulus, - -poisson_ratio / elastic_modulus, - 1.0 / elastic_modulus, - 0.0, - 0.0, - 0.0, - ], - [0.0, 0.0, 0.0, 1.0 / shear_modulus, 0.0, 0.0], - [0.0, 0.0, 0.0, 0.0, 1.0 / shear_modulus, 0.0], - [0.0, 0.0, 0.0, 0.0, 0.0, 1.0 / shear_modulus], - ], - dtype=float, - ) - else: - raise ValueError( - "Structural material must provide elastic_compliance_matrix()" - ) - compliance = np.asarray(raw_compliance, dtype=float) - _run_post_observation_guard(post_observation) - if compliance.shape != (6, 6) or not np.all(np.isfinite(compliance)): - raise ValueError("elastic_compliance_matrix() must return a finite 6x6 matrix") - if not np.allclose(compliance, compliance.T, rtol=1.0e-10, atol=1.0e-18): - raise ValueError("elastic compliance matrix must be symmetric") - return 0.5 * (compliance + compliance.T) - - -def _shell_elastic_material_cache_fingerprint( - material: Any, - post_observation: Optional[Callable[[], None]] = None, -) -> Tuple[Any, ...]: - """Bind every elastic input consumed by ``_shell_material_matrices``. - - Material objects are intentionally public and may be edited in place. A - cache key based only on object identity therefore admits stale shell - mechanics. Keep the isotropic branch bit-for-bit aligned with the actual - scalar path, including an explicitly supplied shear modulus; use the - canonical compliance bytes for every other supported material protocol. - """ - - symmetry = _elastic_symmetry(material, post_observation) - raw_elastic_modulus = _guarded_observe_attribute( - material, - "elastic_modulus", - default=_OBSERVATION_MISSING, - post_observation=post_observation, - ) - raw_poisson_ratio = _guarded_observe_attribute( - material, - "poisson_ratio", - default=_OBSERVATION_MISSING, - post_observation=post_observation, - ) - if ( - symmetry == "isotropic" - and raw_elastic_modulus is not _OBSERVATION_MISSING - and raw_poisson_ratio is not _OBSERVATION_MISSING - ): - elastic_modulus = _guarded_float( - raw_elastic_modulus, - post_observation=post_observation, - ) - poisson_ratio = _guarded_float( - raw_poisson_ratio, - post_observation=post_observation, - ) - raw_shear_modulus = _guarded_observe_attribute( - material, - "shear_modulus", - default=elastic_modulus / (2.0 * (1.0 + poisson_ratio)), - post_observation=post_observation, - ) - shear_modulus = _guarded_float( - raw_shear_modulus, - post_observation=post_observation, - ) - return ( - "isotropic_scalar_path", - elastic_modulus, - poisson_ratio, - shear_modulus, - ) - compliance = np.ascontiguousarray( - _elastic_compliance(material, post_observation), - dtype=np.float64, - ) - _run_post_observation_guard(post_observation) - return ( - symmetry, - compliance.shape, - compliance.tobytes(order="C"), - ) - - -def _generalized_shell_section_cache_fingerprint( - section: Any, - post_observation: Optional[Callable[[], None]] = None, -) -> Optional[Tuple[Any, ...]]: - """Return the complete stiffness/mass identity of a generalized section.""" - - if section is None: - return None - matrices = [] - for name, shape in (("A", (3, 3)), ("B", (3, 3)), ("D", (3, 3)), ("As", (2, 2))): - raw = _guarded_observe_attribute( - section, - name, - post_observation=post_observation, - ) - value = _guarded_array( - raw, - post_observation=post_observation, - ) - if value.shape != shape or not np.all(np.isfinite(value)): - raise ValueError( - f"Generalized shell section {name} must remain a finite {shape} matrix" - ) - matrices.append((name, shape, value.tobytes(order="C"))) - raw_name = _guarded_observe_attribute( - section, - "name", - default="", - post_observation=post_observation, - ) - name = str(raw_name) - _run_post_observation_guard(post_observation) - mass_values = [] - for field in ("mass_per_area", "rotary_inertia_per_area"): - raw = _guarded_observe_attribute( - section, - field, - default=None, - post_observation=post_observation, - ) - mass_values.append( - None - if raw is None - else _guarded_float(raw, post_observation=post_observation) - ) - return ( - tuple(matrices), - name, - *mass_values, - ) - - -def _in_plane_transform_matrices(angle_rad: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: - """Engineering-strain, stress, and transverse-shear transforms. - - The material 1-axis is rotated by ``angle_rad`` from element-local x - toward local y about the positive shell normal. - """ - - c = float(np.cos(angle_rad)) - s = float(np.sin(angle_rad)) - axes = np.array([[c, -s], [s, c]], dtype=float) - strain_to_material = np.zeros((3, 3), dtype=float) - stress_to_local = np.zeros((3, 3), dtype=float) - for column in range(3): - engineering_strain = np.zeros(3, dtype=float) - engineering_strain[column] = 1.0 - local_tensor = np.array( - [ - [engineering_strain[0], 0.5 * engineering_strain[2]], - [0.5 * engineering_strain[2], engineering_strain[1]], - ], - dtype=float, - ) - material_tensor = axes.T @ local_tensor @ axes - strain_to_material[:, column] = ( - material_tensor[0, 0], - material_tensor[1, 1], - 2.0 * material_tensor[0, 1], - ) - material_stress = np.zeros(3, dtype=float) - material_stress[column] = 1.0 - stress_tensor = np.array( - [ - [material_stress[0], material_stress[2]], - [material_stress[2], material_stress[1]], - ], - dtype=float, - ) - local_stress = axes @ stress_tensor @ axes.T - stress_to_local[:, column] = ( - local_stress[0, 0], - local_stress[1, 1], - local_stress[0, 1], - ) - return strain_to_material, stress_to_local, axes - - -def _compensated_elastic_zero_tangent(element, mesh, material, post_observation=None): - """Scalar zero-state realization, called only after qualified elastic admission. - - Preserve scalar coefficient operations, including reciprocal-compliance - drill, independently of the batch coefficient construction. No state/cache - or caller eligibility is changed here. - """ - geometry = element._nonlinear_geometry(mesh) - membrane, shear, _strain, _stress = _shell_material_matrices( - material, element._material_angle(geometry["R0"]), post_observation) - modulus = 1.0 / float(_elastic_compliance(material, post_observation)[5, 5]) - h = element.thickness - result = _local_contractions.shell_zero_tangent( - geometry, h * membrane, h**3 / 12.0 * membrane, - shear * (5.0 / 6.0) * h, modulus * h * element.drilling_stabilization) - if post_observation is not None: - post_observation() - return result - - -def _shell_material_matrices( - material: Any, - angle_rad: float, - post_observation: Optional[Callable[[], None]] = None, -) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]: - """Return local plane-stress/shear matrices and material-axis transforms.""" - - symmetry = _elastic_symmetry(material, post_observation) - # Preserve the legacy isotropic arithmetic exactly. Forming and reducing - # the 3-D compliance is mathematically equivalent, but its final-bit - # roundoff can perturb tightly qualified eigenvalue thresholds. External - # protocol objects without the historical scalar fields still use the - # compliance path below. - raw_elastic_modulus = _guarded_observe_attribute( - material, - "elastic_modulus", - default=_OBSERVATION_MISSING, - post_observation=post_observation, - ) - raw_poisson_ratio = _guarded_observe_attribute( - material, - "poisson_ratio", - default=_OBSERVATION_MISSING, - post_observation=post_observation, - ) - if ( - symmetry == "isotropic" - and raw_elastic_modulus is not _OBSERVATION_MISSING - and raw_poisson_ratio is not _OBSERVATION_MISSING - ): - E = _guarded_float( - raw_elastic_modulus, - post_observation=post_observation, - ) - nu = _guarded_float( - raw_poisson_ratio, - post_observation=post_observation, - ) - raw_shear_modulus = _guarded_observe_attribute( - material, - "shear_modulus", - default=E / (2.0 * (1.0 + nu)), - post_observation=post_observation, - ) - G = _guarded_float( - raw_shear_modulus, - post_observation=post_observation, - ) - Q_material = E / (1.0 - nu**2) * np.array( - [ - [1.0, nu, 0.0], - [nu, 1.0, 0.0], - [0.0, 0.0, (1.0 - nu) / 2.0], - ], - dtype=float, - ) - return ( - Q_material, - G * np.eye(2, dtype=float), - np.eye(3, dtype=float), - np.eye(3, dtype=float), - ) - - compliance = _elastic_compliance(material, post_observation) - membrane_indices = np.array([0, 1, 5], dtype=np.intp) - shear_indices = np.array([4, 3], dtype=np.intp) # [13, 23] - Q_material = np.linalg.inv(compliance[np.ix_(membrane_indices, membrane_indices)]) - G_material = np.linalg.inv(compliance[np.ix_(shear_indices, shear_indices)]) - strain_to_material, stress_to_local, axes = _in_plane_transform_matrices(angle_rad) - Q_local = stress_to_local @ Q_material @ strain_to_material - G_local = axes @ G_material @ axes.T - return ( - 0.5 * (Q_local + Q_local.T), - 0.5 * (G_local + G_local.T), - strain_to_material, - stress_to_local, - ) - - -def _beam_material_properties(material: Any, cross_section: Dict[str, Any]) -> Tuple[float, float, float, float]: - """Return E1, G12, G13 and torsional rigidity for a beam.""" - - properties = _canonical_beam_material_properties(material) - E1 = float(properties.axial_modulus) - G12 = float(properties.shear_modulus_xy) - G13 = float(properties.shear_modulus_xz) - if _elastic_symmetry(material) == "orthotropic": - value = cross_section.get("torsional_rigidity") - try: - torsional_rigidity = float(value) - except (TypeError, ValueError): - torsional_rigidity = float("nan") - if not np.isfinite(torsional_rigidity) or torsional_rigidity <= 0.0: - raise ValueError( - "Orthotropic beam sections require a positive " - "cross_section['torsional_rigidity'] in N*m^2." - ) - else: - torsional_rigidity = G12 * float(cross_section.get("J", 1.0e-8)) - return E1, G12, G13, torsional_rigidity - - -def _beam2_basic_deformation_matrix(length: float) -> np.ndarray: - """Map local Beam2 DOFs to six work-conjugate basic deformations.""" - - L = float(length) - transform = np.zeros((6, 12), dtype=float) - # Axial extension and torsional rotation. - transform[0, 0], transform[0, 6] = -1.0, 1.0 - transform[1, 3], transform[1, 9] = -1.0, 1.0 - # Bending about y: rotations relative to the rigid chord rotation - # ry + (w2-w1)/L. - transform[2, 2], transform[2, 8], transform[2, 4] = ( - -1.0 / L, - 1.0 / L, - 1.0, - ) - transform[3, 2], transform[3, 8], transform[3, 10] = ( - -1.0 / L, - 1.0 / L, - 1.0, - ) - # Bending about z: rotations relative to the rigid chord rotation - # rz - (v2-v1)/L. - transform[4, 1], transform[4, 7], transform[4, 5] = ( - 1.0 / L, - -1.0 / L, - 1.0, - ) - transform[5, 1], transform[5, 7], transform[5, 11] = ( - 1.0 / L, - -1.0 / L, - 1.0, - ) - return transform - - -def _beam2_force_interpolation(length: float, xi: float) -> np.ndarray: - """Map Beam2 basic forces to equilibrium section resultants.""" - - L = float(length) - x_over_length = 0.5 * (float(xi) + 1.0) - interpolation = np.zeros((6, 6), dtype=float) - interpolation[0, 0] = 1.0 # N - interpolation[3, 1] = 1.0 # T - # q[2:4] are the two basic local-y bending rotations. - interpolation[2, 2:4] = 1.0 / L # Vz - interpolation[4, 2] = -1.0 + x_over_length # My - interpolation[4, 3] = x_over_length - # q[4:6] are the two basic local-z bending rotations. The sign of Vy - # follows gamma_xy = v' - rz. - interpolation[1, 4:6] = -1.0 / L # Vy - interpolation[5, 4] = -1.0 + x_over_length # Mz - interpolation[5, 5] = x_over_length - return interpolation - - -def _beam2_generalized_flexibility( - length: float, - section_stiffness: np.ndarray, -) -> Tuple[np.ndarray, np.ndarray]: - """Return exact constant-section basic flexibility and stiffness.""" - - L = float(length) - compliance = np.linalg.inv(np.asarray(section_stiffness, dtype=float)) - flexibility = np.zeros((6, 6), dtype=float) - points = (-np.sqrt(3.0 / 5.0), 0.0, np.sqrt(3.0 / 5.0)) - weights = (5.0 / 9.0, 8.0 / 9.0, 5.0 / 9.0) - for xi, weight in zip(points, weights): - interpolation = _beam2_force_interpolation(L, xi) - flexibility += ( - interpolation.T - @ compliance - @ interpolation - * (L / 2.0 * weight) - ) - return flexibility, np.linalg.inv(flexibility) - - -def _beam_generalized_strain_matrix_from_shape( - shape_functions: np.ndarray, - shape_derivatives: np.ndarray, -) -> np.ndarray: - """Build a generalized beam B-matrix from compatible shape functions.""" - - N = np.asarray(shape_functions, dtype=float).reshape(-1) - derivative = np.asarray(shape_derivatives, dtype=float).reshape(-1) - if derivative.size != N.size: - raise ValueError("beam shape function and derivative sizes must match") - B = np.zeros((6, 6 * N.size), dtype=float) - for i in range(N.size): - base = 6 * i - B[0, base + 0] = derivative[i] # eps_x - B[1, base + 1] = derivative[i] # gamma_xy = v' - rz - B[1, base + 5] = -N[i] - B[2, base + 2] = derivative[i] # gamma_xz = w' + ry - B[2, base + 4] = N[i] - B[3, base + 3] = derivative[i] # kappa_x - B[4, base + 4] = derivative[i] # kappa_y - B[5, base + 5] = derivative[i] # kappa_z - return B - - -def _generalized_beam_recovery( - strains: np.ndarray, - resultants: np.ndarray, - *, - stations: Optional[np.ndarray] = None, -) -> Dict[str, Any]: - """Build resultants-only recovery without inventing physical stresses.""" - - strain_values = np.asarray(strains, dtype=float) - resultant_values = np.asarray(resultants, dtype=float) - recovered: Dict[str, Any] = { - "generalized_strain": strain_values.copy(), - "generalized_resultant": resultant_values.copy(), - "generalized_strain_order": GENERALIZED_BEAM_STRAIN_ORDER, - "generalized_resultant_order": GENERALIZED_BEAM_RESULTANT_ORDER, - "recovery_scope": "section_resultants_only", - "physical_stress_available": False, - "resultant_frame": "beam_local", - "station_coordinate_system": "natural_xi", - } - for index, key in enumerate(GENERALIZED_BEAM_STRAIN_ORDER): - recovered[key] = ( - float(strain_values[index]) - if strain_values.ndim == 1 - else strain_values[:, index].copy() - ) - for index, key in enumerate(GENERALIZED_BEAM_RESULTANT_ORDER): - recovered[key] = ( - float(resultant_values[index]) - if resultant_values.ndim == 1 - else resultant_values[:, index].copy() - ) - descriptive_strains = ( - "axial_strain", - "shear_strain_xy", - "shear_strain_xz", - "twist_rate", - "curvature_y", - "curvature_z", - ) - descriptive_resultants = ( - "axial_force", - "shear_force_y", - "shear_force_z", - "torsional_moment", - "bending_moment_y", - "bending_moment_z", - ) - for index, key in enumerate(descriptive_strains): - recovered[key] = ( - float(strain_values[index]) - if strain_values.ndim == 1 - else strain_values[:, index].copy() - ) - for index, key in enumerate(descriptive_resultants): - recovered[key] = ( - float(resultant_values[index]) - if resultant_values.ndim == 1 - else resultant_values[:, index].copy() - ) - if stations is not None: - recovered["station_coordinates"] = np.asarray( - stations, - dtype=float, - ).copy() - return recovered - - -def _beam_flow_scale(material: Any, curve: Any) -> float: - """Scale a scalar hardening curve to the Hill longitudinal strength X. - - With no curve, the returned value is the constant perfect-plastic flow - stress. Otherwise it multiplies the curve so ``flow_stress(0) == X``. - """ - - if _elastic_symmetry(material) != "orthotropic": - return 1.0 - hill_yield = getattr(material, "hill_yield", None) - if hill_yield is None: - raise ValueError( - f"Orthotropic material {getattr(material, 'name', '')!r} " - "requires hill_yield for beam fiber plasticity." - ) - if curve is None: - return float(hill_yield.X) - reference = float(np.asarray(curve.flow_stress(np.array([0.0])), dtype=float)[0]) - if not np.isfinite(reference) or reference <= 0.0: - raise ValueError("hardening curve must provide a positive initial flow stress") - return float(hill_yield.X) / reference - - -def _rotation_vector_from_matrix(rotation: np.ndarray) -> np.ndarray: - """Return the axis-angle rotation vector for a proper 3x3 rotation matrix.""" - R = np.asarray(rotation, dtype=float).reshape(3, 3) - trace_value = float(np.trace(R)) - cos_angle = max(min((trace_value - 1.0) / 2.0, 1.0), -1.0) - angle = float(np.arccos(cos_angle)) - if angle < 1.0e-12: - return 0.5 * np.array( - [R[2, 1] - R[1, 2], R[0, 2] - R[2, 0], R[1, 0] - R[0, 1]], - dtype=float, - ) - if abs(np.pi - angle) < 1.0e-6: - axis = np.sqrt(np.maximum(np.diag(R) + 1.0, 0.0) / 2.0) - if R[2, 1] - R[1, 2] < 0.0: - axis[0] *= -1.0 - if R[0, 2] - R[2, 0] < 0.0: - axis[1] *= -1.0 - if R[1, 0] - R[0, 1] < 0.0: - axis[2] *= -1.0 - norm = float(np.linalg.norm(axis)) - if norm <= _SMALL: - return np.zeros(3, dtype=float) - return angle * axis / norm - axis = np.array( - [R[2, 1] - R[1, 2], R[0, 2] - R[2, 0], R[1, 0] - R[0, 1]], - dtype=float, - ) / (2.0 * np.sin(angle)) - return angle * axis - - -_STRICT_FLAT_S3_V2_CANDIDATE_ID = "CANDIDATE_E4_PL_S3_V2A_FLAT_LINEAR_V1" -_STRICT_FLAT_S3_V2B_CANDIDATE_ID = "CANDIDATE_E4_PL_S3_V2B_FLAT_LINEAR_V1" -_STRICT_FLAT_S3_V2C_CANDIDATE_ID = "CANDIDATE_E4_PL_S3_V2C_FLAT_LINEAR_PARITY_V1" -_S3_V2D_NATIVE_PARITY_CANDIDATE_ID = "CANDIDATE_E4_PL_S3_V2D_NATIVE_PARITY_V1" - - -def _reject_strict_flat_s3_v2_legacy_dispatch( - element: Any, operation: str -) -> None: - if ( - getattr(type(element), "_legacy_shell_dispatch_forbidden", None) - in { - _STRICT_FLAT_S3_V2_CANDIDATE_ID, - _STRICT_FLAT_S3_V2B_CANDIDATE_ID, - _STRICT_FLAT_S3_V2C_CANDIDATE_ID, - _S3_V2D_NATIVE_PARITY_CANDIDATE_ID, - } - ): - from .element_capabilities import ElementCapabilityError - - raise ElementCapabilityError( - "strict-flat S3 V2 forbids explicit legacy ShellElement dispatch: " - + operation - ) - - -class Element(ABC): - """Abstract base class for all FE elements.""" - - def __init__(self, element_id: int, node_ids: List[int], material_name: str = "default"): - self.element_id = element_id - self.node_ids = node_ids - self.material_name = material_name - self._stiffness_matrix: Optional[np.ndarray] = None - self._mass_matrix: Optional[np.ndarray] = None - self._internal_forces: Optional[np.ndarray] = None - - def __deepcopy__(self, memo: Dict[int, Any]) -> "Element": - """Copy instance state without asking ``copyreg`` about the class. - - The generic ``copy.deepcopy`` reconstruction path may lazily add a - ``__slotnames__`` cache to a class. Element class namespaces are part - of the qualified Q4/S3 runtime authority, so even copying a legacy - element must not mutate them. Build the uninitialised instance - directly, copy its instance dictionary, and explicitly copy any slots - declared anywhere in a concrete subclass hierarchy. - """ - - _reject_strict_flat_s3_v2_legacy_dispatch(self, "Element.__deepcopy__") - source_id = id(self) - if source_id in memo: - return memo[source_id] - - cls = type(self) - made = object.__new__(cls) - memo[source_id] = made - - try: - source_namespace = object.__getattribute__(self, "__dict__") - target_namespace = object.__getattribute__(made, "__dict__") - except AttributeError: - source_namespace = None - target_namespace = None - if source_namespace is not None and target_namespace is not None: - for name, value in source_namespace.items(): - target_namespace[name] = copy.deepcopy(value, memo) - - for owner in type.__getattribute__(cls, "__mro__"): - namespace = type.__getattribute__(owner, "__dict__") - for slot_name, descriptor in namespace.items(): - if type(descriptor) is not MemberDescriptorType: - continue - try: - value = object.__getattribute__(self, slot_name) - except AttributeError: - continue - object.__setattr__(made, slot_name, copy.deepcopy(value, memo)) - return made - - @property - @abstractmethod - def num_nodes(self) -> int: - raise NotImplementedError - - @property - @abstractmethod - def dofs_per_node(self) -> int: - raise NotImplementedError - - @property - def total_dofs(self) -> int: - return self.num_nodes * self.dofs_per_node - - @abstractmethod - def get_node_coordinates(self, mesh: "FEMesh") -> np.ndarray: - raise NotImplementedError - - @abstractmethod - def compute_stiffness_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: - raise NotImplementedError - - def compute_mass_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: - _reject_strict_flat_s3_v2_legacy_dispatch(self, "Element.compute_mass_matrix") - return np.zeros((self.total_dofs, self.total_dofs)) - - def compute_geometric_stiffness_matrix( - self, - mesh: "FEMesh", - material: "Material", - state: Optional[Any] = None, - ) -> np.ndarray: - _reject_strict_flat_s3_v2_legacy_dispatch( - self, "Element.compute_geometric_stiffness_matrix" - ) - return np.zeros((self.total_dofs, self.total_dofs)) - - def compute_internal_forces( - self, mesh: "FEMesh", displacements: np.ndarray, material: "Material" - ) -> np.ndarray: - _reject_strict_flat_s3_v2_legacy_dispatch( - self, "Element.compute_internal_forces" - ) - return np.zeros(self.total_dofs) - - def compute_nonlinear_response( - self, - mesh: "FEMesh", - material: "Material", - u_elem: np.ndarray, - state: Optional[Any] = None, - num_layers: int = 5, - tangent: bool = True, - ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: - """Internal force vector, tangent stiffness and trial state at u_elem. - - The default is linear elastic: F = K u with the constant stiffness as - tangent. Elements supporting geometric and/or material nonlinearity - override this. The returned state is a trial state; the incremental - solver commits it only when the load step converges. With - ``tangent=False`` the stiffness entry may be None (used by the line - search, which only needs residuals). - """ - _reject_strict_flat_s3_v2_legacy_dispatch( - self, "Element.compute_nonlinear_response" - ) - K = self._stiffness_matrix - if K is None: - K = self.compute_stiffness_matrix(mesh, material) - return K @ u_elem, (K if tangent else None), state - - def compute_stresses( - self, - mesh: "FEMesh", - displacements: np.ndarray, - material: "Material", - return_global: bool = False, - ) -> Dict[str, Any]: - _reject_strict_flat_s3_v2_legacy_dispatch(self, "Element.compute_stresses") - return {} - - def get_dof_mapping(self, mesh: "FEMesh") -> List[int]: - dof_mapping: List[int] = [] - for node_id in self.node_ids: - node = mesh.get_node(node_id) - if node: - dof_mapping.extend(node.dofs) - return dof_mapping - - def _get_element_displacements(self, mesh: "FEMesh", displacements: np.ndarray) -> np.ndarray: - u = np.asarray(displacements, dtype=float) - if u.size == self.total_dofs: - return u.copy() - dof_mapping = self.get_dof_mapping(mesh) - if not dof_mapping: - return np.zeros(self.total_dofs) - dof_indices = np.asarray(dof_mapping, dtype=np.intp) - if int(dof_indices.max()) >= u.size: - raise IndexError( - f"Displacement vector has length {u.size}, but element {self.element_id} " - f"requires global DOF {int(dof_indices.max())}." - ) - return u[dof_indices] - - def to_dict(self) -> Dict[str, Any]: - _reject_strict_flat_s3_v2_legacy_dispatch(self, "Element.to_dict") - return { - "element_id": self.element_id, - "type": self.__class__.__name__, - "node_ids": self.node_ids, - "material_name": self.material_name, - } - - -def _install_strict_flat_s3_v2_element_base_guards() -> None: - """Capture the V2 guard in Element routes exposed by explicit dispatch.""" - - from functools import wraps - from inspect import signature - - guard = _reject_strict_flat_s3_v2_legacy_dispatch - names = ( - "__deepcopy__", - "compute_mass_matrix", - "compute_geometric_stiffness_matrix", - "compute_internal_forces", - "compute_nonlinear_response", - "compute_stresses", - "to_dict", - ) - for name in names: - original = vars(Element)[name] - - @wraps(original) - def guarded( - self: Any, - *args: Any, - __name: str = name, - __original: Callable[..., Any] = original, - __guard: Callable[[Any, str], None] = guard, - **kwargs: Any, - ) -> Any: - __guard(self, f"Element.{__name}") - return __original(self, *args, **kwargs) - - guarded.__signature__ = signature(original) # type: ignore[attr-defined] - delattr(guarded, "__wrapped__") - setattr(Element, name, guarded) - - -_install_strict_flat_s3_v2_element_base_guards() -del _install_strict_flat_s3_v2_element_base_guards - - -@njit -def _jit_compute_4node_shape_functions(xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: - N = np.array( - [ - 0.25 * (1.0 - xi) * (1.0 - eta), - 0.25 * (1.0 + xi) * (1.0 - eta), - 0.25 * (1.0 + xi) * (1.0 + eta), - 0.25 * (1.0 - xi) * (1.0 + eta), - ], - ) - dN_dxi = np.array( - [ - -0.25 * (1.0 - eta), - 0.25 * (1.0 - eta), - 0.25 * (1.0 + eta), - -0.25 * (1.0 + eta), - ], - ) - dN_deta = np.array( - [ - -0.25 * (1.0 - xi), - -0.25 * (1.0 + xi), - 0.25 * (1.0 + xi), - 0.25 * (1.0 - xi), - ], - ) - return N, dN_dxi, dN_deta - - -@njit -def _jit_compute_8node_shape_functions(xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: - N = np.zeros(8, dtype=float) - N[0] = -0.25 * (1.0 - xi) * (1.0 - eta) * (1.0 + xi + eta) - N[1] = -0.25 * (1.0 + xi) * (1.0 - eta) * (1.0 - xi + eta) - N[2] = -0.25 * (1.0 + xi) * (1.0 + eta) * (1.0 - xi - eta) - N[3] = -0.25 * (1.0 - xi) * (1.0 + eta) * (1.0 + xi - eta) - N[4] = 0.5 * (1.0 - xi**2) * (1.0 - eta) - N[5] = 0.5 * (1.0 + xi) * (1.0 - eta**2) - N[6] = 0.5 * (1.0 - xi**2) * (1.0 + eta) - N[7] = 0.5 * (1.0 - xi) * (1.0 - eta**2) - - dN_dxi = np.zeros(8, dtype=float) - dN_dxi[0] = 0.25 * (1.0 - eta) * (1.0 + xi + eta) - 0.25 * (1.0 - xi) * (1.0 - eta) - dN_dxi[1] = -0.25 * (1.0 - eta) * (1.0 - xi + eta) + 0.25 * (1.0 + xi) * (1.0 - eta) - dN_dxi[2] = -0.25 * (1.0 + eta) * (1.0 - xi - eta) + 0.25 * (1.0 + xi) * (1.0 + eta) - dN_dxi[3] = 0.25 * (1.0 + eta) * (1.0 + xi - eta) - 0.25 * (1.0 - xi) * (1.0 + eta) - dN_dxi[4] = -xi * (1.0 - eta) - dN_dxi[5] = 0.5 * (1.0 - eta**2) - dN_dxi[6] = -xi * (1.0 + eta) - dN_dxi[7] = -0.5 * (1.0 - eta**2) - - dN_deta = np.zeros(8, dtype=float) - dN_deta[0] = 0.25 * (1.0 - xi) * (1.0 + xi + eta) - 0.25 * (1.0 - xi) * (1.0 - eta) - dN_deta[1] = 0.25 * (1.0 + xi) * (1.0 - xi + eta) - 0.25 * (1.0 + xi) * (1.0 - eta) - dN_deta[2] = -0.25 * (1.0 + xi) * (1.0 - xi - eta) + 0.25 * (1.0 + xi) * (1.0 + eta) - dN_deta[3] = -0.25 * (1.0 - xi) * (1.0 + xi - eta) + 0.25 * (1.0 - xi) * (1.0 + eta) - dN_deta[4] = -0.5 * (1.0 - xi**2) - dN_deta[5] = -eta * (1.0 + xi) - dN_deta[6] = 0.5 * (1.0 - xi**2) - dN_deta[7] = -eta * (1.0 - xi) - return N, dN_dxi, dN_deta - - -@njit -def _jit_compute_3node_shape_functions(r: float, s: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: - N = np.array([1.0 - r - s, r, s]) - dN_dr = np.array([-1.0, 1.0, 0.0]) - dN_ds = np.array([-1.0, 0.0, 1.0]) - return N, dN_dr, dN_ds - - -@njit -def _jit_compute_6node_shape_functions(r: float, s: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: - l1 = 1.0 - r - s - l2 = r - l3 = s - - N = np.zeros(6, dtype=float) - N[0] = l1 * (2.0 * l1 - 1.0) - N[1] = l2 * (2.0 * l2 - 1.0) - N[2] = l3 * (2.0 * l3 - 1.0) - N[3] = 4.0 * l1 * l2 - N[4] = 4.0 * l2 * l3 - N[5] = 4.0 * l3 * l1 - - dN_dr = np.zeros(6, dtype=float) - dN_dr[0] = 1.0 - 4.0 * l1 - dN_dr[1] = 4.0 * l2 - 1.0 - dN_dr[2] = 0.0 - dN_dr[3] = 4.0 * (l1 - l2) - dN_dr[4] = 4.0 * l3 - dN_dr[5] = -4.0 * l3 - - dN_ds = np.zeros(6, dtype=float) - dN_ds[0] = 1.0 - 4.0 * l1 - dN_ds[1] = 0.0 - dN_ds[2] = 4.0 * l3 - 1.0 - dN_ds[3] = -4.0 * l2 - dN_ds[4] = 4.0 * l2 - dN_ds[5] = 4.0 * (l1 - l3) - return N, dN_dr, dN_ds - - -@njit -def _jit_integrate_nonlinear_response( - u_loc: np.ndarray, - N_res: np.ndarray, - M_res: np.ndarray, - C0: np.ndarray, - C1: np.ndarray, - C2: np.ndarray, - B_m_all: np.ndarray, - B_b_all: np.ndarray, - B_d_all: np.ndarray, - Gw_all: np.ndarray, - detw_all: np.ndarray, - B_s_all: np.ndarray, - detw_shear_all: np.ndarray, - D_shear: np.ndarray, - drilling_stiffness: float, - tangent: bool, - has_plasticity: bool, - n_dof: int, -) -> Tuple[np.ndarray, np.ndarray]: - F_loc = np.zeros(n_dof) - K_loc = np.zeros((n_dof, n_dof)) - - n_gp = len(detw_all) - for g in range(n_gp): - detw = detw_all[g] - B_m = B_m_all[g] - B_b = B_b_all[g] - B_d = B_d_all[g] - Gw = Gw_all[g] - - # Calculate theta = Gw @ u_loc - theta_0 = 0.0 - theta_1 = 0.0 - for i in range(n_dof): - theta_0 += Gw[0, i] * u_loc[i] - theta_1 += Gw[1, i] * u_loc[i] - - # Calculate B_eff = B_m + B_nl - B_eff = np.zeros((3, n_dof)) - for i in range(n_dof): - B_eff[0, i] = B_m[0, i] + theta_0 * Gw[0, i] - B_eff[1, i] = B_m[1, i] + theta_1 * Gw[1, i] - B_eff[2, i] = B_m[2, i] + theta_0 * Gw[1, i] + theta_1 * Gw[0, i] - - # B_eff.T @ N_res[g] + B_b.T @ M_res[g] - N_g = N_res[g] - M_g = M_res[g] - B_eff_T_N = np.zeros(n_dof) - B_b_T_M = np.zeros(n_dof) - for i in range(n_dof): - B_eff_T_N[i] = B_eff[0, i] * N_g[0] + B_eff[1, i] * N_g[1] + B_eff[2, i] * N_g[2] - B_b_T_M[i] = B_b[0, i] * M_g[0] + B_b[1, i] * M_g[1] + B_b[2, i] * M_g[2] - - # B_d @ u_loc - Bd_u = 0.0 - for i in range(n_dof): - Bd_u += B_d[0, i] * u_loc[i] - - for i in range(n_dof): - F_loc[i] += (B_eff_T_N[i] + B_b_T_M[i]) * detw - F_loc[i] += B_d[0, i] * (drilling_stiffness * Bd_u) * detw - - if not tangent: - continue - - # K_loc += (B_eff.T @ C0[g] @ B_eff + B_b.T @ C2[g] @ B_b) * detw - C0_g = C0[g] - C2_g = C2[g] - - C0_B_eff = np.zeros((3, n_dof)) - C2_B_b = np.zeros((3, n_dof)) - for r in range(3): - for c in range(n_dof): - val0 = 0.0 - val2 = 0.0 - for k in range(3): - val0 += C0_g[r, k] * B_eff[k, c] - val2 += C2_g[r, k] * B_b[k, c] - C0_B_eff[r, c] = val0 - C2_B_b[r, c] = val2 - - for r in range(n_dof): - for c in range(n_dof): - val_eff = 0.0 - val_b = 0.0 - for k in range(3): - val_eff += B_eff[k, r] * C0_B_eff[k, c] - val_b += B_b[k, r] * C2_B_b[k, c] - K_loc[r, c] += (val_eff + val_b) * detw - - if has_plasticity: - # Membrane-bending coupling: - # B_eff.T @ C1 @ B_b + B_b.T @ C1.T @ B_eff. - # Layered material tangents make C1 symmetric, while a general - # pre-integrated section may legitimately supply a non-symmetric - # B coupling block in the symmetric [[A, B], [B.T, D]] law. - C1_g = C1[g] - C1_B_b = np.zeros((3, n_dof)) - C1_T_B_eff = np.zeros((3, n_dof)) - for r in range(3): - for c in range(n_dof): - val_b = 0.0 - val_eff = 0.0 - for k in range(3): - val_b += C1_g[r, k] * B_b[k, c] - val_eff += C1_g[k, r] * B_eff[k, c] - C1_B_b[r, c] = val_b - C1_T_B_eff[r, c] = val_eff - - for r in range(n_dof): - for c in range(n_dof): - forward = 0.0 - reverse = 0.0 - for k in range(3): - forward += B_eff[k, r] * C1_B_b[k, c] - reverse += B_b[k, r] * C1_T_B_eff[k, c] - K_loc[r, c] += (forward + reverse) * detw - - # Geometric initial stress stiffness - N00 = N_g[0] - N11 = N_g[1] - N01 = N_g[2] - - N_Gw_0 = N00 * Gw[0] + N01 * Gw[1] - N_Gw_1 = N01 * Gw[0] + N11 * Gw[1] - for r in range(n_dof): - for c in range(n_dof): - K_loc[r, c] += (Gw[0, r] * N_Gw_0[c] + Gw[1, r] * N_Gw_1[c]) * detw - K_loc[r, c] += B_d[0, r] * (drilling_stiffness * B_d[0, c]) * detw - - # Shear stiffness and force contribution - for g in range(len(detw_shear_all)): - detw_s = detw_shear_all[g] - B_s = B_s_all[g] - - # F_loc += K_s @ u_loc - Bs_u_0 = 0.0 - Bs_u_1 = 0.0 - for i in range(n_dof): - Bs_u_0 += B_s[0, i] * u_loc[i] - Bs_u_1 += B_s[1, i] * u_loc[i] - - f_s_0 = D_shear[0, 0] * Bs_u_0 + D_shear[0, 1] * Bs_u_1 - f_s_1 = D_shear[1, 0] * Bs_u_0 + D_shear[1, 1] * Bs_u_1 - - for i in range(n_dof): - F_loc[i] += (B_s[0, i] * f_s_0 + B_s[1, i] * f_s_1) * detw_s - - if not tangent: - continue - - # K_loc += K_s - C_s = np.zeros((2, n_dof)) - for r in range(2): - for c in range(n_dof): - C_s[r, c] = D_shear[r, 0] * B_s[0, c] + D_shear[r, 1] * B_s[1, c] - - for r in range(n_dof): - for c in range(n_dof): - K_loc[r, c] += (B_s[0, r] * C_s[0, c] + B_s[1, r] * C_s[1, c]) * detw_s - - return F_loc, K_loc - - -def _integrate_nonlinear_tangent_components( - u_loc: np.ndarray, - N_res: np.ndarray, - M_res: np.ndarray, - C0: np.ndarray, - C1: np.ndarray, - C2: np.ndarray, - B_m_all: np.ndarray, - B_b_all: np.ndarray, - B_d_all: np.ndarray, - Gw_all: np.ndarray, - detw_all: np.ndarray, - B_s_all: np.ndarray, - detw_shear_all: np.ndarray, - D_shear: np.ndarray, - drilling_stiffness: float, - has_membrane_bending_coupling: bool, - n_dof: int, -) -> Tuple[np.ndarray, np.ndarray]: - """Integrate constitutive and stress-Hessian tangents independently. - - The two calls deliberately reuse :func:`_jit_integrate_nonlinear_response` - rather than recovering one component as ``total - other``. The material - call carries the exact current algorithmic moduli, transverse shear and - drilling terms with zero resultants. The geometric call carries the exact - tension-positive membrane resultants with every constitutive/numerical - modulus set to zero. Consequently both pieces use the same Gauss order, - von-Karman ``B_eff`` construction and arithmetic kernel as the ordinary - nonlinear tangent. - """ - - zero_resultants = np.zeros_like(np.asarray(N_res, dtype=float)) - _unused_force, material = _jit_integrate_nonlinear_response( - np.asarray(u_loc, dtype=float), - zero_resultants, - np.zeros_like(np.asarray(M_res, dtype=float)), - np.asarray(C0, dtype=float), - np.asarray(C1, dtype=float), - np.asarray(C2, dtype=float), - np.asarray(B_m_all, dtype=float), - np.asarray(B_b_all, dtype=float), - np.asarray(B_d_all, dtype=float), - np.asarray(Gw_all, dtype=float), - np.asarray(detw_all, dtype=float), - np.asarray(B_s_all, dtype=float), - np.asarray(detw_shear_all, dtype=float), - np.asarray(D_shear, dtype=float), - float(drilling_stiffness), - True, - bool(has_membrane_bending_coupling), - int(n_dof), - ) - zero_C0 = np.zeros_like(np.asarray(C0, dtype=float)) - zero_C1 = np.zeros_like(np.asarray(C1, dtype=float)) - zero_C2 = np.zeros_like(np.asarray(C2, dtype=float)) - zero_shear = np.zeros_like(np.asarray(D_shear, dtype=float)) - _unused_force, geometric = _jit_integrate_nonlinear_response( - np.asarray(u_loc, dtype=float), - np.asarray(N_res, dtype=float), - np.asarray(M_res, dtype=float), - zero_C0, - zero_C1, - zero_C2, - np.asarray(B_m_all, dtype=float), - np.asarray(B_b_all, dtype=float), - np.asarray(B_d_all, dtype=float), - np.asarray(Gw_all, dtype=float), - np.asarray(detw_all, dtype=float), - np.asarray(B_s_all, dtype=float), - np.asarray(detw_shear_all, dtype=float), - zero_shear, - 0.0, - True, - False, - int(n_dof), - ) - return material, geometric - - -class ShellElement(Element): - """3/6-node triangular and 4/8-node quadrilateral Mindlin-Reissner shell element.""" - - TRI_GAUSS_POINTS_1 = _immutable_float64_array( - [[1.0 / 3.0, 1.0 / 3.0]] - ) - TRI_GAUSS_WEIGHTS_1 = _immutable_float64_array([0.5]) - - TRI_GAUSS_POINTS_3 = _immutable_float64_array( - [[1.0 / 6.0, 1.0 / 6.0], [2.0 / 3.0, 1.0 / 6.0], [1.0 / 6.0, 2.0 / 3.0]], - ) - TRI_GAUSS_WEIGHTS_3 = _immutable_float64_array( - [1.0 / 6.0, 1.0 / 6.0, 1.0 / 6.0] - ) - - _DUNAVANT_A1 = 0.059715871789770 - _DUNAVANT_B1 = 0.470142064105115 - _DUNAVANT_A2 = 0.797426985353087 - _DUNAVANT_B2 = 0.101286507323456 - TRI_GAUSS_POINTS_7 = _immutable_float64_array( - [ - [1.0 / 3.0, 1.0 / 3.0], - [_DUNAVANT_B1, _DUNAVANT_B1], - [_DUNAVANT_A1, _DUNAVANT_B1], - [_DUNAVANT_B1, _DUNAVANT_A1], - [_DUNAVANT_B2, _DUNAVANT_B2], - [_DUNAVANT_A2, _DUNAVANT_B2], - [_DUNAVANT_B2, _DUNAVANT_A2], - ], - ) - TRI_GAUSS_WEIGHTS_7 = _immutable_float64_array( - [ - 0.1125, - 0.066197076394253, - 0.066197076394253, - 0.066197076394253, - 0.062969590272414, - 0.062969590272414, - 0.062969590272414, - ], - ) - - GAUSS_POINTS_1x1 = _immutable_float64_array([[0.0, 0.0]]) - GAUSS_WEIGHTS_1x1 = _immutable_float64_array([4.0]) - - GAUSS_POINTS_2x2 = _immutable_float64_array( - np.asarray( - [[-1.0, -1.0], [1.0, -1.0], [-1.0, 1.0], [1.0, 1.0]], - dtype=np.float64, - ) - / np.sqrt(3.0) - ) - GAUSS_WEIGHTS_2x2 = _immutable_float64_array(np.ones(4, dtype=np.float64)) - - GAUSS_POINTS_3x3 = _immutable_float64_array( - [ - [-np.sqrt(3.0 / 5.0), -np.sqrt(3.0 / 5.0)], - [0.0, -np.sqrt(3.0 / 5.0)], - [np.sqrt(3.0 / 5.0), -np.sqrt(3.0 / 5.0)], - [-np.sqrt(3.0 / 5.0), 0.0], - [0.0, 0.0], - [np.sqrt(3.0 / 5.0), 0.0], - [-np.sqrt(3.0 / 5.0), np.sqrt(3.0 / 5.0)], - [0.0, np.sqrt(3.0 / 5.0)], - [np.sqrt(3.0 / 5.0), np.sqrt(3.0 / 5.0)], - ], - ) - GAUSS_WEIGHTS_3x3 = _immutable_float64_array( - [ - 25.0 / 81.0, - 40.0 / 81.0, - 25.0 / 81.0, - 40.0 / 81.0, - 64.0 / 81.0, - 40.0 / 81.0, - 25.0 / 81.0, - 40.0 / 81.0, - 25.0 / 81.0, - ], - ) - - def __init__( - self, - element_id: int, - node_ids: List[int], - material_name: str = "default", - thickness: float = 0.01, - drilling_stabilization: float = 1.0e-3, - reduced_integration: bool = False, - hourglass_stabilization: float = 1.0e-8, - material_direction: Optional[np.ndarray] = None, - material_angle_deg: float = 0.0, - shell_section: Optional[Any] = None, - ): - super().__init__(element_id, node_ids, material_name) - if len(set(node_ids)) != len(node_ids): - raise ValueError(f"Shell element {element_id} has repeated node ids") - if self.__class__ is ShellElement and len(node_ids) == 4: - warnings.warn( - "Legacy four-node ShellElement is a temporary rollback path; " - "use create_shell_element() or QualifiedE4PLShellElement. The " - "legacy Q4 implementation is available through the 0.4.x " - "burn-in line and is scheduled for removal no earlier than 0.5.0.", - LegacyQ4DeprecationWarning, - stacklevel=2, - ) - self.thickness = float(thickness) - self.drilling_stabilization = float(drilling_stabilization) - self.reduced_integration = reduced_integration - self.hourglass_stabilization = float(hourglass_stabilization) - self.material_angle_deg = float(material_angle_deg) - if not np.isfinite(self.material_angle_deg): - raise ValueError("material_angle_deg must be finite") - if material_direction is None: - self.material_direction = None - else: - direction = np.asarray(material_direction, dtype=float).reshape(-1) - if direction.size != 3 or not np.all(np.isfinite(direction)): - raise ValueError("material_direction must be a finite 3-vector") - if float(np.linalg.norm(direction)) <= _SMALL: - raise ValueError("material_direction must be non-zero") - self.material_direction = direction.copy() - self.shell_section = coerce_generalized_shell_section(shell_section) - self._is_3node = len(node_ids) == 3 - self._is_6node = len(node_ids) == 6 - self._is_8node = len(node_ids) == 8 - self._is_4node = len(node_ids) == 4 - self._is_triangular = self._is_3node or self._is_6node - self._is_quadrilateral = self._is_4node or self._is_8node - if not (self._is_triangular or self._is_quadrilateral): - raise ValueError(f"ShellElement requires 3, 4, 6 or 8 nodes, got {len(node_ids)}") - - def _material_angle(self, local_frame: np.ndarray) -> float: - """Material 1-axis angle in the supplied element-local frame.""" - - angle = np.deg2rad(self.material_angle_deg) - if self.material_direction is None: - return float(angle) - frame = np.asarray(local_frame, dtype=float).reshape(3, 3) - direction = np.asarray(self.material_direction, dtype=float) - components = np.array( - [float(np.dot(direction, frame[:, 0])), float(np.dot(direction, frame[:, 1]))], - dtype=float, - ) - norm = float(np.linalg.norm(components)) - if norm <= 1.0e-10 * max(float(np.linalg.norm(direction)), 1.0): - raise ValueError( - f"Shell element {self.element_id} material_direction is parallel to " - "the shell normal and cannot define an in-plane material axis." - ) - return float(np.arctan2(components[1], components[0]) + angle) - - def _generalized_section_in_frame( - self, - local_frame: np.ndarray, - ) -> Optional[GeneralizedShellSection]: - """Return the pre-integrated section rotated into shell-local axes.""" - - if self.shell_section is None: - return None - return self.shell_section.rotated(self._material_angle(local_frame)) - - def to_dict(self) -> Dict[str, Any]: - payload = super().to_dict() - payload.update( - { - "thickness": float(self.thickness), - "material_angle_deg": float(self.material_angle_deg), - "material_direction": ( - None - if self.material_direction is None - else np.asarray(self.material_direction, dtype=float).tolist() - ), - "shell_section": ( - None if self.shell_section is None else self.shell_section.to_dict() - ), - } - ) - return payload - - @property - def num_nodes(self) -> int: - return len(self.node_ids) - - @property - def dofs_per_node(self) -> int: - return 6 - - @property - def gauss_points(self) -> np.ndarray: - if self._is_3node: - return self.TRI_GAUSS_POINTS_3 - if self._is_6node: - return self.TRI_GAUSS_POINTS_7 - if self._is_8node and self.reduced_integration: - return self.GAUSS_POINTS_2x2 - return self.GAUSS_POINTS_3x3 if self._is_8node else self.GAUSS_POINTS_2x2 - - @property - def gauss_weights(self) -> np.ndarray: - if self._is_3node: - return self.TRI_GAUSS_WEIGHTS_3 - if self._is_6node: - return self.TRI_GAUSS_WEIGHTS_7 - if self._is_8node and self.reduced_integration: - return self.GAUSS_WEIGHTS_2x2 - return self.GAUSS_WEIGHTS_3x3 if self._is_8node else self.GAUSS_WEIGHTS_2x2 - - @property - def shear_gauss_points(self) -> np.ndarray: - if self._is_3node: - return self.TRI_GAUSS_POINTS_1 - if self._is_6node: - return self.TRI_GAUSS_POINTS_3 - return self.GAUSS_POINTS_2x2 if self._is_8node else self.GAUSS_POINTS_1x1 - - @property - def shear_gauss_weights(self) -> np.ndarray: - if self._is_3node: - return self.TRI_GAUSS_WEIGHTS_1 - if self._is_6node: - return self.TRI_GAUSS_WEIGHTS_3 - return self.GAUSS_WEIGHTS_2x2 if self._is_8node else self.GAUSS_WEIGHTS_1x1 - - def get_node_coordinates(self, mesh: "FEMesh") -> np.ndarray: - coords = np.zeros((self.num_nodes, 3), dtype=float) - for i, node_id in enumerate(self.node_ids): - node = mesh.get_node(node_id) - if node is None: - raise ValueError(f"Shell element {self.element_id} references missing node {node_id}") - coords[i] = node.coords() - return coords - - def compute_shape_functions(self, xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: - if self._is_3node: - return self._compute_3node_shape_functions(xi, eta) - if self._is_6node: - return self._compute_6node_shape_functions(xi, eta) - if self._is_4node: - return self._compute_4node_shape_functions(xi, eta) - return self._compute_8node_shape_functions(xi, eta) - - def _compute_3node_shape_functions(self, xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: - return _jit_compute_3node_shape_functions(xi, eta) - - def _compute_4node_shape_functions(self, xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: - return _jit_compute_4node_shape_functions(xi, eta) - - def _compute_6node_shape_functions(self, xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: - return _jit_compute_6node_shape_functions(xi, eta) - - def _compute_8node_shape_functions(self, xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: - return _jit_compute_8node_shape_functions(xi, eta) - - def compute_jacobian(self, coords: np.ndarray, dN_dxi: np.ndarray, dN_deta: np.ndarray) -> np.ndarray: - return np.array([coords.T @ dN_dxi, coords.T @ dN_deta], dtype=float) - - @staticmethod - def _normalize(vector: np.ndarray) -> Tuple[np.ndarray, float]: - norm = float(np.sqrt(vector @ vector)) - if norm < _SMALL: - return np.zeros(3, dtype=float), norm - return vector / norm, norm - - def _fallback_edge_direction(self, coords: np.ndarray, normal: np.ndarray) -> np.ndarray: - candidate_edges = [] - if coords.shape[0] >= 2: - candidate_edges.append(coords[1] - coords[0]) - if coords.shape[0] >= 3: - candidate_edges.append(coords[2] - coords[0]) - candidate_edges.append(coords[2] - coords[1]) - if coords.shape[0] >= 4: - candidate_edges.append(coords[2] - coords[3]) - candidate_edges.append(coords[3] - coords[0]) - candidate_edges.append(coords[2] - coords[1]) - for edge in candidate_edges: - projected = edge - np.dot(edge, normal) * normal - e1, n = self._normalize(projected) - if n > _SMALL: - return e1 - raise ValueError(f"Shell element {self.element_id} has no valid in-plane direction") - - def _local_frame_and_derivatives( - self, - coords: np.ndarray, - dN_dxi: np.ndarray, - dN_deta: np.ndarray, - ) -> Tuple[np.ndarray, np.ndarray, np.ndarray, float]: - J = self.compute_jacobian(coords, dN_dxi, dN_deta) - tangent_xi = J[0] - tangent_eta = J[1] - e3, det_j = self._normalize(_cross3(tangent_xi, tangent_eta)) - if det_j < _SMALL: - raise ValueError(f"Shell element {self.element_id} has a near-zero surface Jacobian") - - e1_raw = tangent_xi - np.dot(tangent_xi, e3) * e3 - e1, e1_norm = self._normalize(e1_raw) - if e1_norm < _SMALL: - e1 = self._fallback_edge_direction(coords, e3) - e2, e2_norm = self._normalize(_cross3(e3, e1)) - if e2_norm < _SMALL: - raise ValueError(f"Shell element {self.element_id} has an invalid local y direction") - e1, _ = self._normalize(_cross3(e2, e3)) - R = np.column_stack((e1, e2, e3)) - - J_local = np.array( - [ - [np.dot(tangent_xi, e1), np.dot(tangent_xi, e2)], - [np.dot(tangent_eta, e1), np.dot(tangent_eta, e2)], - ], - dtype=float, - ) - try: - inv_j_local, _ = _inv2(J_local) - except np.linalg.LinAlgError as exc: - raise ValueError(f"Shell element {self.element_id} has a singular local Jacobian") from exc - - dN_dx = inv_j_local[0, 0] * dN_dxi + inv_j_local[0, 1] * dN_deta - dN_dy = inv_j_local[1, 0] * dN_dxi + inv_j_local[1, 1] * dN_deta - return R, dN_dx, dN_dy, det_j - - def _local_dof_transform(self, R: np.ndarray) -> np.ndarray: - n_blocks = 2 * self.num_nodes - T = np.zeros((self.total_dofs, self.total_dofs), dtype=float) - blocks = T.reshape(n_blocks, 3, n_blocks, 3) - indices = np.arange(n_blocks) - blocks[indices, :, indices, :] = R.T - return T - - def _build_shell_b_matrices( - self, - N: np.ndarray, - dN_dx: np.ndarray, - dN_dy: np.ndarray, - ) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: - B_m = np.zeros((3, self.total_dofs), dtype=float) - B_b = np.zeros((3, self.total_dofs), dtype=float) - B_s = np.zeros((2, self.total_dofs), dtype=float) - - B_m[0, 0::6] = dN_dx - B_m[1, 1::6] = dN_dy - B_m[2, 0::6] = dN_dy - B_m[2, 1::6] = dN_dx - - B_b[0, 4::6] = dN_dx - B_b[1, 3::6] = -dN_dy - B_b[2, 4::6] = dN_dy - B_b[2, 3::6] = -dN_dx - - B_s[0, 2::6] = dN_dx - B_s[0, 4::6] = N - B_s[1, 2::6] = dN_dy - B_s[1, 3::6] = -N - return B_m, B_b, B_s - - def _build_drilling_b_matrix( - self, - N: np.ndarray, - dN_dx: np.ndarray, - dN_dy: np.ndarray, - ) -> np.ndarray: - """ - Build a small drilling stabilization strain. - - The stabilized quantity is theta_z - 0.5 * (dv/dx - du/dy), so a - physical rigid rotation about the shell normal has exactly zero energy. - """ - B_d = np.zeros((1, self.total_dofs), dtype=float) - B_d[0, 0::6] = 0.5 * dN_dy - B_d[0, 1::6] = -0.5 * dN_dx - B_d[0, 5::6] = N - return B_d - - def _reference_center(self) -> Tuple[float, float]: - if self._is_triangular: - return 1.0 / 3.0, 1.0 / 3.0 - return 0.0, 0.0 - - # MITC4 assumed natural transverse shear (4-node elements only). - # - # Covariant shear strains are sampled where they are exact for pure - # bending, at the edge midpoints A(0,-1), B(1,0), C(0,1), D(-1,0): - # - # gamma_xi(xi, eta) = (1-eta)/2 * gamma_xi|A + (1+eta)/2 * gamma_xi|C - # gamma_eta(xi, eta) = (1-xi)/2 * gamma_eta|D + (1+xi)/2 * gamma_eta|B - # - # with gamma_xi = dw/dxi + x_,xi * theta_y - y_,xi * theta_x in a fixed - # element-plane frame, then mapped to Cartesian shear through the inverse - # in-plane Jacobian at the integration point. The element geometry is - # treated as a flat facet in the frame evaluated at the element centre. - _MITC4_SAMPLE_POINTS = {"A": (0.0, -1.0), "B": (1.0, 0.0), "C": (0.0, 1.0), "D": (-1.0, 0.0)} - - def _center_frame(self, coords: np.ndarray) -> np.ndarray: - xi, eta = self._reference_center() - _, dN_dxi, dN_deta = self.compute_shape_functions(xi, eta) - R, _, _, _ = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) - return R - - def _tri3_assumed_shear_b_matrix(self, coords: np.ndarray, R: np.ndarray) -> Tuple[np.ndarray, float]: - """ - Constant assumed-shear field for the 3-node triangle. - - The row space is evaluated in the centroid frame and integrated once - over the triangular area. This is the constant shear-gap part used by - DSG3/MITC3-style triangles: rigid rotations satisfy - ``dw/dx + theta_y = 0`` and ``dw/dy - theta_x = 0`` exactly, while a - constant transverse-shear patch is reproduced without the locking-prone - fully integrated linear Mindlin shear interpolation. - """ - if not self._is_3node: - raise ValueError("_tri3_assumed_shear_b_matrix is only valid for 3-node shells") - planar = coords @ R[:, :2] - r, s = self._reference_center() - N, dN_dr, dN_ds = self.compute_shape_functions(r, s) - J2 = np.array( - [ - [float(dN_dr @ planar[:, 0]), float(dN_dr @ planar[:, 1])], - [float(dN_ds @ planar[:, 0]), float(dN_ds @ planar[:, 1])], - ], - dtype=float, - ) - try: - inv_j2, det_j = _inv2(J2) - except np.linalg.LinAlgError as exc: - raise ValueError(f"Shell element {self.element_id} has a singular triangular shear Jacobian") from exc - dN_dx = inv_j2[0, 0] * dN_dr + inv_j2[0, 1] * dN_ds - dN_dy = inv_j2[1, 0] * dN_dr + inv_j2[1, 1] * dN_ds - _, _, B_s = self._build_shell_b_matrices(N, dN_dx, dN_dy) - return B_s, abs(float(det_j)) - - def _mitc4_shear_samples(self, coords: np.ndarray, R: np.ndarray) -> Tuple[np.ndarray, Dict[str, Tuple[np.ndarray, np.ndarray]]]: - """Return in-plane node coordinates and covariant shear rows at A-D.""" - planar = coords @ R[:, :2] - samples: Dict[str, Tuple[np.ndarray, np.ndarray]] = {} - for name, (xi, eta) in self._MITC4_SAMPLE_POINTS.items(): - N, dN_dxi, dN_deta = self.compute_shape_functions(xi, eta) - x_xi = float(dN_dxi @ planar[:, 0]) - y_xi = float(dN_dxi @ planar[:, 1]) - x_eta = float(dN_deta @ planar[:, 0]) - y_eta = float(dN_deta @ planar[:, 1]) - row_xi = np.zeros(self.total_dofs, dtype=float) - row_eta = np.zeros(self.total_dofs, dtype=float) - row_xi[2::6] = dN_dxi - row_xi[3::6] = -N * y_xi - row_xi[4::6] = N * x_xi - row_eta[2::6] = dN_deta - row_eta[3::6] = -N * y_eta - row_eta[4::6] = N * x_eta - samples[name] = (row_xi, row_eta) - return planar, samples - - def _mitc4_shear_b_matrix( - self, - planar: np.ndarray, - samples: Dict[str, Tuple[np.ndarray, np.ndarray]], - xi: float, - eta: float, - ) -> Tuple[np.ndarray, float]: - """Assumed-shear B matrix (local Cartesian) and in-plane Jacobian det.""" - _, dN_dxi, dN_deta = self.compute_shape_functions(xi, eta) - J2 = np.array( - [ - [float(dN_dxi @ planar[:, 0]), float(dN_dxi @ planar[:, 1])], - [float(dN_deta @ planar[:, 0]), float(dN_deta @ planar[:, 1])], - ], - dtype=float, - ) - try: - inv_j2, det_j = _inv2(J2) - except np.linalg.LinAlgError as exc: - raise ValueError(f"Shell element {self.element_id} has a singular in-plane Jacobian") from exc - B_covariant = np.vstack( - [ - 0.5 * (1.0 - eta) * samples["A"][0] + 0.5 * (1.0 + eta) * samples["C"][0], - 0.5 * (1.0 - xi) * samples["D"][1] + 0.5 * (1.0 + xi) * samples["B"][1], - ] - ) - return inv_j2 @ B_covariant, det_j - - def _rigid_body_mode_matrix(self, coords: np.ndarray) -> np.ndarray: - modes = np.zeros((self.total_dofs, 6), dtype=float) - centroid = np.mean(coords, axis=0) - axes = np.eye(3, dtype=float) - - for local, coord in enumerate(coords): - base = local * 6 - r = coord - centroid - modes[base + 0, 0] = 1.0 - modes[base + 1, 1] = 1.0 - modes[base + 2, 2] = 1.0 - for axis_index, axis in enumerate(axes): - displacement = _cross3(axis, r) - modes[base : base + 3, 3 + axis_index] = displacement - modes[base + 3 : base + 6, 3 + axis_index] = axis - - q, rmat = np.linalg.qr(modes) - diag = np.abs(np.diag(rmat)) - if diag.size == 0: - return np.zeros((self.total_dofs, 0), dtype=float) - keep = diag > max(float(np.max(diag)) * 1.0e-10, _SMALL) - return q[:, keep] - - def _hourglass_stabilization_matrix(self, K_base: np.ndarray, coords: np.ndarray) -> np.ndarray: - """Small stiffness on non-rigid zero modes outside rigid motion.""" - coefficient = float(getattr(self, "hourglass_stabilization", 0.0)) - stabilized_topology = (self._is_8node and self.reduced_integration) or self._is_triangular - if not stabilized_topology or coefficient <= 0.0: - return np.zeros_like(K_base) - - K_sym = 0.5 * (K_base + K_base.T) - eigvals, eigvecs = np.linalg.eigh(K_sym) - max_eig = max(float(np.max(np.abs(eigvals))), 1.0) - zero_tol = 1.0e-9 * max_eig - zero_mask = np.abs(eigvals) < zero_tol - if int(np.sum(zero_mask)) <= 6: - return np.zeros_like(K_base) - - zero_space = eigvecs[:, zero_mask] - rigid = self._rigid_body_mode_matrix(coords) - if rigid.size: - zero_space = zero_space - rigid @ (rigid.T @ zero_space) - - u, singular_values, _ = np.linalg.svd(zero_space, full_matrices=False) - if singular_values.size == 0: - return np.zeros_like(K_base) - keep = singular_values > 1.0e-8 - if not np.any(keep): - return np.zeros_like(K_base) - - hourglass_modes = u[:, keep] - stiffness_scale = coefficient * max_eig - K_hg = stiffness_scale * (hourglass_modes @ hourglass_modes.T) - return 0.5 * (K_hg + K_hg.T) - - def compute_stiffness_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: - coords = self.get_node_coordinates(mesh) - generalized_section = self.shell_section is not None - h = self.thickness - if generalized_section: - drilling_modulus = None - else: - _elastic_symmetry(material) - compliance = _elastic_compliance(material) - drilling_modulus = 1.0 / float(compliance[5, 5]) - - K = np.zeros((self.total_dofs, self.total_dofs), dtype=float) - - for (xi, eta), weight in zip(self.gauss_points, self.gauss_weights): - N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) - R, dN_dx, dN_dy, det_j = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) - T = self._local_dof_transform(R) - B_m, B_b, _ = self._build_shell_b_matrices(N, dN_dx, dN_dy) - B_d = self._build_drilling_b_matrix(N, dN_dx, dN_dy) - if generalized_section: - section_local = self._generalized_section_in_frame(R) - assert section_local is not None - K_local = ( - B_m.T @ section_local.A @ B_m - + B_m.T @ section_local.B @ B_b - + B_b.T @ section_local.B.T @ B_m - + B_b.T @ section_local.D @ B_b - ) * det_j * weight - drilling_stiffness = ( - float(section_local.A[2, 2]) - * getattr(self, "drilling_stabilization", 1.0e-3) - ) - else: - Q_local, _G_local, _strain_transform, _stress_transform = ( - _shell_material_matrices( - material, - self._material_angle(R), - ) - ) - D_membrane = h * Q_local - D_bending = h**3 / 12.0 * Q_local - K_local = ( - B_m.T @ D_membrane @ B_m - + B_b.T @ D_bending @ B_b - ) * det_j * weight - drilling_stiffness = ( - float(drilling_modulus) - * h - * getattr(self, "drilling_stabilization", 1.0e-3) - ) - K_local += (B_d.T @ (drilling_stiffness * np.eye(1)) @ B_d) * det_j * weight - K += T.T @ K_local @ T - - if self._is_4node: - R = self._center_frame(coords) - if generalized_section: - section_local = self._generalized_section_in_frame(R) - assert section_local is not None - D_shear = section_local.As - else: - _Q_local, G_local, _strain_transform, _stress_transform = ( - _shell_material_matrices( - material, - self._material_angle(R), - ) - ) - D_shear = (5.0 / 6.0) * h * G_local - T = self._local_dof_transform(R) - planar, samples = self._mitc4_shear_samples(coords, R) - for (xi, eta), weight in zip(self.GAUSS_POINTS_2x2, self.GAUSS_WEIGHTS_2x2): - B_s, det_j = self._mitc4_shear_b_matrix(planar, samples, float(xi), float(eta)) - K_local = (B_s.T @ D_shear @ B_s) * det_j * weight - K += T.T @ K_local @ T - elif self._is_3node: - R = self._center_frame(coords) - if generalized_section: - section_local = self._generalized_section_in_frame(R) - assert section_local is not None - D_shear = section_local.As - else: - _Q_local, G_local, _strain_transform, _stress_transform = ( - _shell_material_matrices( - material, - self._material_angle(R), - ) - ) - D_shear = (5.0 / 6.0) * h * G_local - T = self._local_dof_transform(R) - B_s, det_j = self._tri3_assumed_shear_b_matrix(coords, R) - K_local = (B_s.T @ D_shear @ B_s) * det_j * float(np.sum(self.shear_gauss_weights)) - K += T.T @ K_local @ T - else: - for (xi, eta), weight in zip(self.shear_gauss_points, self.shear_gauss_weights): - N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) - R, dN_dx, dN_dy, det_j = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) - if generalized_section: - section_local = self._generalized_section_in_frame(R) - assert section_local is not None - D_shear = section_local.As - else: - _Q_local, G_local, _strain_transform, _stress_transform = ( - _shell_material_matrices( - material, - self._material_angle(R), - ) - ) - D_shear = (5.0 / 6.0) * h * G_local - T = self._local_dof_transform(R) - _, _, B_s = self._build_shell_b_matrices(N, dN_dx, dN_dy) - K_local = (B_s.T @ D_shear @ B_s) * det_j * weight - K += T.T @ K_local @ T - - self._hourglass_stiffness_matrix = self._hourglass_stabilization_matrix(K, coords) - K += self._hourglass_stiffness_matrix - - self._stiffness_matrix = K - return K - - def compute_mass_matrix( - self, - mesh: "FEMesh", - material: "Material", - *, - _qualified_runtime_post_observation: Optional[Callable[[], None]] = None, - ) -> np.ndarray: - coords = self.get_node_coordinates(mesh) - raw_density = _guarded_observe_attribute( - material, - "density", - post_observation=_qualified_runtime_post_observation, - ) - rho = _guarded_float( - raw_density, - post_observation=_qualified_runtime_post_observation, - ) - h = self.thickness - section_mass = ( - None - if self.shell_section is None - else _guarded_observe_attribute( - self.shell_section, - "mass_per_area", - post_observation=_qualified_runtime_post_observation, - ) - ) - mass_per_area = ( - _guarded_float( - section_mass, - post_observation=_qualified_runtime_post_observation, - ) - if section_mass is not None - else rho * h - ) - section_rotary_inertia = ( - None - if self.shell_section is None - else _guarded_observe_attribute( - self.shell_section, - "rotary_inertia_per_area", - post_observation=_qualified_runtime_post_observation, - ) - ) - rotary_inertia_per_area = ( - _guarded_float( - section_rotary_inertia, - post_observation=_qualified_runtime_post_observation, - ) - if section_rotary_inertia is not None - else rho * h**3 / 12.0 - ) - M = np.zeros((self.total_dofs, self.total_dofs), dtype=float) - if self._is_8node and self.reduced_integration: - area = 0.0 - for (xi, eta), weight in zip(self.gauss_points, self.gauss_weights): - _N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) - _R, _dN_dx, _dN_dy, det_j = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) - area += float(det_j) * float(weight) - translational = mass_per_area * max(area, 0.0) / max(self.num_nodes, 1) - rotational = ( - rotary_inertia_per_area - * max(area, 0.0) - / max(self.num_nodes, 1) - ) - for i in range(self.num_nodes): - base = 6 * i - M[base + 0, base + 0] = translational - M[base + 1, base + 1] = translational - M[base + 2, base + 2] = translational - M[base + 3, base + 3] = rotational - M[base + 4, base + 4] = rotational - M[base + 5, base + 5] = rotational - self._mass_matrix = M - return M - for (xi, eta), weight in zip(self.gauss_points, self.gauss_weights): - N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) - R, _, _, det_j = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) - T = self._local_dof_transform(R) - M_local = np.zeros_like(M) - outer_n = np.outer(N, N) * det_j * weight - translational = mass_per_area * outer_n - rotational = rotary_inertia_per_area * outer_n - for d in range(3): - M_local[d::6, d::6] += translational - M_local[3 + d::6, 3 + d::6] += rotational - M += T.T @ M_local @ T - self._mass_matrix = M - return M - - @staticmethod - def _membrane_compression_from_state(state: Optional[Any]) -> Tuple[float, float, float]: - """Return local membrane resultants with compression-positive convention.""" - if state is None or not isinstance(state, dict): - return 0.0, 0.0, 0.0 - - if "membrane_compression" in state: - values = np.asarray(state["membrane_compression"], dtype=float).reshape(-1) - if values.size >= 3: - return float(values[0]), float(values[1]), float(values[2]) - if "membrane_forces" in state: - values = np.asarray(state["membrane_forces"], dtype=float).reshape(-1) - if values.size >= 3: - return -float(values[0]), -float(values[1]), -float(values[2]) - - compression_x = state.get("membrane_compression_x", state.get("Nx_compression")) - compression_y = state.get("membrane_compression_y", state.get("Ny_compression")) - compression_xy = state.get("membrane_compression_xy", state.get("Nxy_compression")) - if compression_x is not None or compression_y is not None or compression_xy is not None: - return ( - float(compression_x or 0.0), - float(compression_y or 0.0), - float(compression_xy or 0.0), - ) - - force_x = state.get("membrane_force_x", state.get("Nx")) - force_y = state.get("membrane_force_y", state.get("Ny")) - force_xy = state.get("membrane_force_xy", state.get("Nxy")) - return ( - -float(force_x or 0.0), - -float(force_y or 0.0), - -float(force_xy or 0.0), - ) - - @classmethod - def _membrane_compression_samples( - cls, - state: Optional[Any], - count: int, - ) -> np.ndarray: - """Return compression-positive ``[Nx, Ny, Nxy]`` at integration points. - - Uniform legacy state keys remain supported. Spatially varying - prestress can be supplied as ``membrane_compression_at_gauss`` or - tension-positive ``membrane_forces_at_gauss`` with shape ``(n_gp, 3)``. - The shorter aliases ``membrane_compression`` and ``membrane_forces`` - also accept that two-dimensional form. - """ - if isinstance(state, dict): - compression_values = state.get( - "membrane_compression_at_gauss", - state.get("membrane_compression"), - ) - force_values = state.get( - "membrane_forces_at_gauss", - state.get("membrane_forces"), - ) - values = compression_values if compression_values is not None else force_values - if values is not None: - samples = np.asarray(values, dtype=float) - if samples.ndim == 2: - if samples.shape != (int(count), 3): - raise ValueError( - "Gauss-point membrane resultants must have shape " - f"({int(count)}, 3), got {samples.shape}." - ) - return samples.copy() if compression_values is not None else -samples - - uniform = np.asarray(cls._membrane_compression_from_state(state), dtype=float) - return np.repeat(uniform.reshape(1, 3), int(count), axis=0) - - @staticmethod - def _resultant_samples( - state: Optional[Any], - count: int, - *, - compression_keys: Tuple[str, ...], - tension_keys: Tuple[str, ...] = (), - ) -> np.ndarray: - """Read uniform or Gauss-point vector resultants with sign conversion.""" - if not isinstance(state, dict): - return np.zeros((int(count), 3), dtype=float) - values = None - compression_positive = True - for key in compression_keys: - if key in state: - values = state[key] - break - if values is None: - for key in tension_keys: - if key in state: - values = state[key] - compression_positive = False - break - if values is None: - return np.zeros((int(count), 3), dtype=float) - samples = np.asarray(values, dtype=float) - if samples.ndim == 1 and samples.size == 3: - samples = np.repeat(samples.reshape(1, 3), int(count), axis=0) - if samples.shape != (int(count), 3): - raise ValueError( - f"Initial-stress resultants must have shape (3,) or ({int(count)}, 3), " - f"got {samples.shape}." - ) - return samples.copy() if compression_positive else -samples - - @classmethod - def _bending_compression_samples( - cls, - state: Optional[Any], - count: int, - ) -> np.ndarray: - """Compression-positive first stress moments ``[Mx, My, Mxy]``.""" - return cls._resultant_samples( - state, - count, - compression_keys=( - "bending_compression_at_gauss", - "bending_compression", - "bending_compression_moments_at_gauss", - "bending_compression_moments", - ), - tension_keys=("bending_moments_at_gauss", "bending_moments"), - ) - - @classmethod - def _stress_second_moment_samples( - cls, - state: Optional[Any], - count: int, - membrane_compression: np.ndarray, - thickness: float, - ) -> np.ndarray: - """Compression-positive second stress moments, defaulting to ``N h²/12``.""" - explicit = cls._resultant_samples( - state, - count, - compression_keys=( - "stress_second_moment_at_gauss", - "stress_second_moment", - "membrane_compression_second_moment_at_gauss", - "membrane_compression_second_moment", - ), - ) - has_explicit = isinstance(state, dict) and any( - key in state - for key in ( - "stress_second_moment_at_gauss", - "stress_second_moment", - "membrane_compression_second_moment_at_gauss", - "membrane_compression_second_moment", - ) - ) - if has_explicit: - return explicit - return np.asarray(membrane_compression, dtype=float) * float(thickness) ** 2 / 12.0 - - def compute_geometric_stiffness_matrix( - self, - mesh: "FEMesh", - material: "Material", - state: Optional[Any] = None, - ) -> np.ndarray: - """ - Shell stress-stiffness matrix from membrane resultants. - - The state can supply either tension-positive membrane forces - (``membrane_force_x/y/xy`` or ``membrane_forces``) or - compression-positive values (``membrane_compression_x/y/xy``). The - returned matrix follows the package convention - ``K phi = lambda KG phi`` with compression destabilizing. - - The total-Lagrangian initial-stress operator uses the Mindlin director - field ``[u + z*ry, v - z*rx, w]``. Membrane resultants therefore act - on all translations, their second stress moment (``N*h**2/12`` for a - uniform through-thickness membrane stress) acts on ``rx``/``ry`` - gradients, and optional bending resultants provide the signed - translation-director coupling. Drilling ``rz`` has no director term. - """ - compression = self._membrane_compression_samples(state, len(self.gauss_points)) - bending_compression = self._bending_compression_samples(state, len(self.gauss_points)) - second_moment = self._stress_second_moment_samples( - state, - len(self.gauss_points), - compression, - self.thickness, - ) - if not np.any(compression) and not np.any(bending_compression) and not np.any(second_moment): - return np.zeros((self.total_dofs, self.total_dofs), dtype=float) - - coords = self.get_node_coordinates(mesh) - KG = np.zeros((self.total_dofs, self.total_dofs), dtype=float) - - for gp_index, ((xi, eta), weight) in enumerate(zip(self.gauss_points, self.gauss_weights)): - N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) - R, dN_dx, dN_dy, det_j = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) - T = self._local_dof_transform(R) - Nx, Ny, Nxy = compression[gp_index] - N_matrix = np.array([[Nx, Nxy], [Nxy, Ny]], dtype=float) - Mx, My, Mxy = bending_compression[gp_index] - M_matrix = np.array([[Mx, Mxy], [Mxy, My]], dtype=float) - Hx, Hy, Hxy = second_moment[gp_index] - H_matrix = np.array([[Hx, Hxy], [Hxy, Hy]], dtype=float) - KG_local = np.zeros((self.total_dofs, self.total_dofs), dtype=float) - translation_gradients = [] - for component in range(3): - G = np.zeros((2, self.total_dofs), dtype=float) - G[0, component::6] = dN_dx - G[1, component::6] = dN_dy - translation_gradients.append(G) - KG_local += G.T @ N_matrix @ G - G_rx = np.zeros((2, self.total_dofs), dtype=float) - G_ry = np.zeros((2, self.total_dofs), dtype=float) - G_rx[0, 3::6] = dN_dx - G_rx[1, 3::6] = dN_dy - G_ry[0, 4::6] = dN_dx - G_ry[1, 4::6] = dN_dy - KG_local += G_rx.T @ H_matrix @ G_rx - KG_local += G_ry.T @ H_matrix @ G_ry - # u(z)=u+z*ry and v(z)=v-z*rx. - coupling_u_ry = translation_gradients[0].T @ M_matrix @ G_ry - coupling_v_rx = translation_gradients[1].T @ M_matrix @ G_rx - KG_local += coupling_u_ry + coupling_u_ry.T - KG_local -= coupling_v_rx + coupling_v_rx.T - KG_local *= det_j * float(weight) - KG += T.T @ KG_local @ T - return KG - - # ------------------------------------------------------------------ - # Incremental nonlinear response: total-Lagrangian von Karman membrane - # kinematics in the flat-facet centre frame, layered J2 plane-stress - # plasticity through the thickness, elastic transverse shear (MITC4 for - # 4-node, reduced for 8-node) and elastic drilling stabilization. - # ------------------------------------------------------------------ - - def _nonlinear_geometry(self, mesh: "FEMesh") -> Dict[str, Any]: - """Reference-configuration data, computed once per element.""" - cache = getattr(self, "_nl_cache", None) - if cache is not None: - return cache - coords = self.get_node_coordinates(mesh) - R0 = self._center_frame(coords) - T0 = self._local_dof_transform(R0) - planar = coords @ R0[:, :2] - - gp_data = [] - for (xi, eta), weight in zip(self.gauss_points, self.gauss_weights): - N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) - J2 = np.array( - [ - [float(dN_dxi @ planar[:, 0]), float(dN_dxi @ planar[:, 1])], - [float(dN_deta @ planar[:, 0]), float(dN_deta @ planar[:, 1])], - ], - dtype=float, - ) - inv_j2, det_j = _inv2(J2) - dN_dx = inv_j2[0, 0] * dN_dxi + inv_j2[0, 1] * dN_deta - dN_dy = inv_j2[1, 0] * dN_dxi + inv_j2[1, 1] * dN_deta - B_m, B_b, B_s = self._build_shell_b_matrices(N, dN_dx, dN_dy) - B_d = self._build_drilling_b_matrix(N, dN_dx, dN_dy) - Gw = np.zeros((2, self.total_dofs), dtype=float) - Gw[0, 2::6] = dN_dx - Gw[1, 2::6] = dN_dy - gp_data.append( - { - "B_m": B_m, - "B_b": B_b, - "B_d": B_d, - "Gw": Gw, - "detw": abs(det_j) * float(weight), - } - ) - - shear_data = [] - if self._is_4node: - _, samples = self._mitc4_shear_samples(coords, R0) - for (xi, eta), weight in zip(self.GAUSS_POINTS_2x2, self.GAUSS_WEIGHTS_2x2): - B_s, det_j = self._mitc4_shear_b_matrix(planar, samples, float(xi), float(eta)) - shear_data.append({"B_s": B_s, "detw": abs(det_j) * float(weight)}) - elif self._is_3node: - B_s, det_j = self._tri3_assumed_shear_b_matrix(coords, R0) - shear_data.append({"B_s": B_s, "detw": det_j * float(np.sum(self.shear_gauss_weights))}) - else: - for (xi, eta), weight in zip(self.shear_gauss_points, self.shear_gauss_weights): - N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) - J2 = np.array( - [ - [float(dN_dxi @ planar[:, 0]), float(dN_dxi @ planar[:, 1])], - [float(dN_deta @ planar[:, 0]), float(dN_deta @ planar[:, 1])], - ], - dtype=float, - ) - inv_j2, det_j = _inv2(J2) - dN_dx = inv_j2[0, 0] * dN_dxi + inv_j2[0, 1] * dN_deta - dN_dy = inv_j2[1, 0] * dN_dxi + inv_j2[1, 1] * dN_deta - _, _, B_s = self._build_shell_b_matrices(N, dN_dx, dN_dy) - shear_data.append({"B_s": B_s, "detw": abs(det_j) * float(weight)}) - - n_gp = len(gp_data) - B_m_all = np.zeros((n_gp, 3, self.total_dofs)) - B_b_all = np.zeros((n_gp, 3, self.total_dofs)) - B_d_all = np.zeros((n_gp, 1, self.total_dofs)) - Gw_all = np.zeros((n_gp, 2, self.total_dofs)) - detw_all = np.zeros(n_gp) - for g, gp in enumerate(gp_data): - B_m_all[g] = gp["B_m"] - B_b_all[g] = gp["B_b"] - B_d_all[g] = gp["B_d"] - Gw_all[g] = gp["Gw"] - detw_all[g] = gp["detw"] - - n_shear = len(shear_data) - B_s_all = np.zeros((n_shear, 2, self.total_dofs)) - detw_shear_all = np.zeros(n_shear) - for g, sh in enumerate(shear_data): - B_s_all[g] = sh["B_s"] - detw_shear_all[g] = sh["detw"] - - cache = { - "R0": R0, - "T0": T0, - "gp": gp_data, - "shear": shear_data, - "B_m_all": B_m_all, - "B_b_all": B_b_all, - "B_d_all": B_d_all, - "Gw_all": Gw_all, - "detw_all": detw_all, - "B_s_all": B_s_all, - "detw_shear_all": detw_shear_all, - } - # This is a solver-owned derived cache. Qualified subclasses reserve - # the public assignment surface so callers cannot replace a warm - # nonlinear operator while preserving its cache key. - object.__setattr__(self, "_nl_cache", cache) - return cache - - def init_nonlinear_state(self, num_layers: int) -> Dict[str, Any]: - if self.shell_section is not None: - return {"generalized_section": True} - n_points = len(self.gauss_points) * num_layers - return { - "plastic_strain": np.zeros((n_points, 3), dtype=float), - "alpha": np.zeros(n_points, dtype=float), - } - - def _generalized_section_nonlinear_response( - self, - mesh: "FEMesh", - material: "Material", - u_elem: np.ndarray, - state: Optional[Any], - tangent: bool, - *, - _return_tangent_components: bool = False, - ) -> Any: - """Geometrically nonlinear response for a linear generalized section.""" - - if getattr(material, "hardening_curve", None) is not None or getattr( - material, - "hill_yield", - None, - ) is not None: - raise ValueError( - "Generalized shell sections are linear elastic and cannot use " - "material hardening or Hill plasticity; use a layered section " - "constitutive model for nonlinear laminate response." - ) - if isinstance(state, dict) and any(key in state for key in _INITIAL_SHELL_STATE_KEYS): - raise ValueError( - "Initial layer stress/prestrain fields are not defined for a " - "pre-integrated generalized shell section." - ) - - cache = self._nonlinear_geometry(mesh) - R0 = cache["R0"] - T0 = cache["T0"] - u_loc = T0 @ np.asarray(u_elem, dtype=float) - section = self._generalized_section_in_frame(R0) - assert section is not None - - n_gp = len(cache["gp"]) - membrane_strain = np.zeros((n_gp, 3), dtype=float) - curvature = np.zeros((n_gp, 3), dtype=float) - for index, gp in enumerate(cache["gp"]): - theta = gp["Gw"] @ u_loc - membrane_strain[index] = gp["B_m"] @ u_loc + np.array( - [ - 0.5 * theta[0] ** 2, - 0.5 * theta[1] ** 2, - theta[0] * theta[1], - ], - dtype=float, - ) - curvature[index] = gp["B_b"] @ u_loc - - membrane_resultants = ( - membrane_strain @ section.A.T + curvature @ section.B.T - ) - bending_resultants = ( - membrane_strain @ section.B + curvature @ section.D.T - ) - transverse_shear_strain = np.einsum( - "gij,j->gi", - cache["B_s_all"], - u_loc, - ) - transverse_shear_resultants = ( - transverse_shear_strain @ section.As.T - ) - C0 = np.broadcast_to(section.A, (n_gp, 3, 3)) - C1 = np.broadcast_to(section.B, (n_gp, 3, 3)) - C2 = np.broadcast_to(section.D, (n_gp, 3, 3)) - drilling_stiffness = ( - float(section.A[2, 2]) - * getattr(self, "drilling_stabilization", 1.0e-3) - ) - - F_loc, K_loc = _jit_integrate_nonlinear_response( - u_loc, - membrane_resultants, - bending_resultants, - C0, - C1, - C2, - cache["B_m_all"], - cache["B_b_all"], - cache["B_d_all"], - cache["Gw_all"], - cache["detw_all"], - cache["B_s_all"], - cache["detw_shear_all"], - section.As, - drilling_stiffness, - tangent, - True, - self.total_dofs, - ) - - K_hg = getattr(self, "_hourglass_stiffness_matrix", None) - if ( - self._is_8node - and self.reduced_integration - and float(getattr(self, "hourglass_stabilization", 0.0)) > 0.0 - and K_hg is None - ): - self.compute_stiffness_matrix(mesh, material) - K_hg = getattr(self, "_hourglass_stiffness_matrix", None) - - F_global = T0.T @ F_loc - if K_hg is not None: - F_global = F_global + K_hg @ np.asarray(u_elem, dtype=float) - K_global: Optional[np.ndarray] - if tangent: - K_global = T0.T @ K_loc @ T0 - if K_hg is not None: - K_global = K_global + K_hg - else: - K_global = None - - trial_state: Dict[str, Any] = { - "generalized_section": True, - "geometric_nonlinearity": "von_karman", - "membrane_strain": membrane_strain.copy(), - "curvature": curvature.copy(), - "transverse_shear_strain": transverse_shear_strain.copy(), - "membrane_resultants": membrane_resultants.copy(), - "bending_resultants": bending_resultants.copy(), - "transverse_shear_resultants": ( - transverse_shear_resultants.copy() - ), - "membrane_resultant_order": SHELL_MEMBRANE_VOIGT_ORDER, - "transverse_shear_resultant_order": ( - SHELL_TRANSVERSE_SHEAR_ORDER - ), - "recovery_scope": "section_resultants_only", - } - if _return_tangent_components: - if K_global is None: - raise ValueError( - "nonlinear tangent components require tangent=True" - ) - material_local, geometric_local = ( - _integrate_nonlinear_tangent_components( - u_loc, - membrane_resultants, - bending_resultants, - C0, - C1, - C2, - cache["B_m_all"], - cache["B_b_all"], - cache["B_d_all"], - cache["Gw_all"], - cache["detw_all"], - cache["B_s_all"], - cache["detw_shear_all"], - section.As, - drilling_stiffness, - True, - self.total_dofs, - ) - ) - material_global = T0.T @ material_local @ T0 - geometric_global = T0.T @ geometric_local @ T0 - if K_hg is not None: - material_global = material_global + K_hg - return F_global, K_global, trial_state, { - "material": material_global, - "geometric": geometric_global, - } - return F_global, K_global, trial_state - - def compute_nonlinear_response( - self, - mesh: "FEMesh", - material: "Material", - u_elem: np.ndarray, - state: Optional[Any] = None, - num_layers: int = 5, - tangent: bool = True, - *, - _return_tangent_components: bool = False, - _qualified_runtime_post_observation: Optional[Callable[[], None]] = None, - ) -> Any: - if _return_tangent_components and not tangent: - raise ValueError("nonlinear tangent components require tangent=True") - if self.shell_section is not None: - return self._generalized_section_nonlinear_response( - mesh, - material, - u_elem, - state, - tangent, - _return_tangent_components=_return_tangent_components, - ) - cache = self._nonlinear_geometry(mesh) - R0 = cache["R0"] - T0 = cache["T0"] - u_loc = T0 @ np.asarray(u_elem, dtype=float) - - symmetry = _elastic_symmetry( - material, - _qualified_runtime_post_observation, - ) - h = self.thickness - curve = _guarded_observe_attribute( - material, - "hardening_curve", - default=None, - post_observation=_qualified_runtime_post_observation, - ) - C_el, shear_elastic, strain_to_material, stress_to_local = _shell_material_matrices( - material, - self._material_angle(R0), - _qualified_runtime_post_observation, - ) - C_material, _shear_material, _identity_strain, _identity_stress = ( - _shell_material_matrices( - material, - 0.0, - _qualified_runtime_post_observation, - ) - ) - drilling_modulus = 1.0 / float( - _elastic_compliance( - material, - _qualified_runtime_post_observation, - )[5, 5] - ) - D_shear = shear_elastic * (5.0 / 6.0) * h - drilling_stiffness = ( - drilling_modulus - * h - * getattr(self, "drilling_stabilization", 1.0e-3) - ) - hill_yield = _guarded_observe_attribute( - material, - "hill_yield", - default=None, - post_observation=_qualified_runtime_post_observation, - ) - if symmetry == "orthotropic" and curve is not None and hill_yield is None: - raise ValueError( - f"Orthotropic material {getattr(material, 'name', '')!r} " - "requires hill_yield when hardening_curve is active." - ) - hill_plasticity = symmetry == "orthotropic" and hill_yield is not None - constitutive_plasticity = curve is not None or hill_plasticity - - n_gp = len(cache["gp"]) - z_layers, w_layers = lobatto_layers(num_layers, h) - - if state is None: - state = self.init_nonlinear_state(num_layers) - initial_state = _copy_state_fields(state, _INITIAL_SHELL_STATE_KEYS) - has_initial_field = any( - key in initial_state - for key in ( - "initial_membrane_stress", - "initial_bending_stress", - "initial_membrane_prestrain", - "initial_curvature_prestrain", - ) - ) - - # Membrane and bending strains at every integration point. - memb_strain = np.zeros((n_gp, 3), dtype=float) - curvature = np.zeros((n_gp, 3), dtype=float) - B_eff_list = [] - theta_list = [] - for g, gp in enumerate(cache["gp"]): - theta = gp["Gw"] @ u_loc # (2,) transverse deflection gradients - B_nl = np.vstack( - [ - theta[0] * gp["Gw"][0], - theta[1] * gp["Gw"][1], - theta[0] * gp["Gw"][1] + theta[1] * gp["Gw"][0], - ] - ) - B_eff = gp["B_m"] + B_nl - memb_strain[g] = gp["B_m"] @ u_loc + np.array( - [0.5 * theta[0] ** 2, 0.5 * theta[1] ** 2, theta[0] * theta[1]] - ) - curvature[g] = gp["B_b"] @ u_loc - B_eff_list.append(B_eff) - theta_list.append(theta) - - if not constitutive_plasticity and not has_initial_field: - # Elastic shortcut: resultants and integrated moduli in closed form. - trial_state = state - N_res = memb_strain @ (h * C_el).T - M_res = curvature @ (h**3 / 12.0 * C_el).T - C0 = np.broadcast_to(h * C_el, (n_gp, 3, 3)) - C1 = np.zeros((n_gp, 3, 3), dtype=float) - C2 = np.broadcast_to(h**3 / 12.0 * C_el, (n_gp, 3, 3)) - else: - # Layer strains for all (gp, layer) points at once. Prescribed - # residual stress is represented by its elastic strain offset and - # prestrain is subtracted as an eigenstrain. Both therefore enter - # the same return map as the kinematic strain and participate in - # yielding, hardening, unloading, and the geometric stiffness. - kinematic_layer_strain = ( - memb_strain[:, None, :] + z_layers[None, :, None] * curvature[:, None, :] - ) - zero_rows = np.zeros((n_gp, 3), dtype=float) - membrane_stress = _shell_field_rows( - initial_state.get("initial_membrane_stress", zero_rows), - n_gp, - "initial_membrane_stress", - ) - bending_stress = _shell_field_rows( - initial_state.get("initial_bending_stress", zero_rows), - n_gp, - "initial_bending_stress", - ) - membrane_prestrain = _shell_field_rows( - initial_state.get("initial_membrane_prestrain", zero_rows), - n_gp, - "initial_membrane_prestrain", - ) - curvature_prestrain = _shell_field_rows( - initial_state.get("initial_curvature_prestrain", zero_rows), - n_gp, - "initial_curvature_prestrain", - ) - initial_stress = ( - membrane_stress[:, None, :] - + (2.0 * z_layers[None, :, None] / h) * bending_stress[:, None, :] - ) - eigenstrain = ( - membrane_prestrain[:, None, :] - + z_layers[None, :, None] * curvature_prestrain[:, None, :] - ) - if symmetry == "orthotropic": - initial_stress_material = np.einsum( - "ij,glj->gli", - np.linalg.inv(stress_to_local), - initial_stress, - ) - kinematic_material = np.einsum( - "ij,glj->gli", - strain_to_material, - kinematic_layer_strain, - ) - eigenstrain_material = np.einsum( - "ij,glj->gli", - strain_to_material, - eigenstrain, - ) - stress_strain_offset = np.einsum( - "ij,glj->gli", - np.linalg.inv(C_material), - initial_stress_material, - ) - layer_strain_material = ( - kinematic_material - eigenstrain_material + stress_strain_offset - ).reshape(n_gp * num_layers, 3) - layer_strain = ( - kinematic_layer_strain - eigenstrain - + np.einsum( - "ij,glj->gli", - np.linalg.inv(C_el), - initial_stress, - ) - ).reshape(n_gp * num_layers, 3) - else: - stress_strain_offset = np.einsum( - "ij,glj->gli", - np.linalg.inv(C_el), - initial_stress, - ) - layer_strain = ( - kinematic_layer_strain - eigenstrain + stress_strain_offset - ).reshape(n_gp * num_layers, 3) - layer_strain_material = layer_strain - if not constitutive_plasticity: - sigma = layer_strain @ C_el.T - C_tan = np.broadcast_to(C_el, (n_gp * num_layers, 3, 3)).copy() - ep_new = np.zeros_like(layer_strain) - alpha_new = np.zeros(n_gp * num_layers, dtype=float) - if symmetry == "orthotropic": - sigma_material = layer_strain_material @ C_material.T - elif hill_plasticity: - from .plasticity import hill48_plane_stress_return_map - - sigma_material, C_tan_material, ep_new, alpha_new = ( - hill48_plane_stress_return_map( - layer_strain_material, - state["plastic_strain"], - state["alpha"], - C_material, - hill_yield, - curve, - compute_tangent=tangent, - ) - ) - sigma = sigma_material @ stress_to_local.T - C_tan = np.einsum( - "ij,njk,kl->nil", - stress_to_local, - C_tan_material, - strain_to_material, - ) - else: - sigma, C_tan, ep_new, alpha_new = plane_stress_return_map( - layer_strain, - state["plastic_strain"], - state["alpha"], - _guarded_float( - _guarded_observe_attribute( - material, - "elastic_modulus", - post_observation=_qualified_runtime_post_observation, - ), - post_observation=_qualified_runtime_post_observation, - ), - _guarded_float( - _guarded_observe_attribute( - material, - "poisson_ratio", - post_observation=_qualified_runtime_post_observation, - ), - post_observation=_qualified_runtime_post_observation, - ), - curve, - compute_tangent=tangent, - ) - trial_state = { - "plastic_strain": ep_new, - "alpha": alpha_new, - "layer_strain": layer_strain.copy(), - "layer_strain_material": layer_strain_material.copy(), - "kinematic_layer_strain": kinematic_layer_strain.reshape(n_gp * num_layers, 3).copy(), - **initial_state, - } - - sigma = sigma.reshape(n_gp, num_layers, 3) - C_tan = C_tan.reshape(n_gp, num_layers, 3, 3) - trial_state["layer_stress"] = sigma.reshape(n_gp * num_layers, 3).copy() - if symmetry == "orthotropic": - trial_state["layer_stress_material"] = sigma_material.reshape( - n_gp * num_layers, - 3, - ).copy() - trial_state["equivalent_stress_measure"] = ( - "hill48" if hill_yield is not None else "von_mises" - ) - - # Through-thickness resultants and integrated tangent moduli. - N_res = np.einsum("l,gli->gi", w_layers, sigma) - M_res = np.einsum("l,l,gli->gi", w_layers, z_layers, sigma) - C0 = np.einsum("l,glij->gij", w_layers, C_tan) - C1 = np.einsum("l,l,glij->gij", w_layers, z_layers, C_tan) - C2 = np.einsum("l,l,l,glij->gij", w_layers, z_layers, z_layers, C_tan) - - n_dof = self.total_dofs - F_loc, K_loc_temp = _jit_integrate_nonlinear_response( - u_loc, - N_res, - M_res, - C0, - C1, - C2, - cache["B_m_all"], - cache["B_b_all"], - cache["B_d_all"], - cache["Gw_all"], - cache["detw_all"], - cache["B_s_all"], - cache["detw_shear_all"], - D_shear, - drilling_stiffness, - tangent, - constitutive_plasticity, - n_dof, - ) - K_loc = K_loc_temp if tangent else None - - K_hg = getattr(self, "_hourglass_stiffness_matrix", None) - if self._is_8node and self.reduced_integration and float(getattr(self, "hourglass_stabilization", 0.0)) > 0.0: - if K_hg is None: - self.compute_stiffness_matrix(mesh, material) - K_hg = getattr(self, "_hourglass_stiffness_matrix", None) - - F_global = T0.T @ F_loc - if K_hg is not None: - u_global = np.asarray(u_elem, dtype=float) - F_global = F_global + K_hg @ u_global - - if not tangent: - return F_global, None, trial_state - K_global = T0.T @ K_loc @ T0 - if K_hg is not None: - K_global = K_global + K_hg - if _return_tangent_components: - material_local, geometric_local = ( - _integrate_nonlinear_tangent_components( - u_loc, - N_res, - M_res, - C0, - C1, - C2, - cache["B_m_all"], - cache["B_b_all"], - cache["B_d_all"], - cache["Gw_all"], - cache["detw_all"], - cache["B_s_all"], - cache["detw_shear_all"], - D_shear, - drilling_stiffness, - constitutive_plasticity, - n_dof, - ) - ) - material_global = T0.T @ material_local @ T0 - geometric_global = T0.T @ geometric_local @ T0 - if K_hg is not None: - material_global = material_global + K_hg - return F_global, K_global, trial_state, { - "material": material_global, - "geometric": geometric_global, - } - return F_global, K_global, trial_state - - def _compute_generalized_section_results( - self, - mesh: "FEMesh", - displacements: np.ndarray, - *, - return_global: bool, - ) -> Dict[str, Any]: - """Recover exact generalized strains and resultants. - - A/B/D/As do not contain enough information to reconstruct ply or - through-thickness surface stresses, so this path intentionally does - not report von Mises, Hill, or fabricated top/bottom stress fields. - """ - - coords = self.get_node_coordinates(mesh) - u_elem_global = self._get_element_displacements(mesh, displacements) - num_ip = len(self.gauss_points) - membrane_strain = np.zeros((num_ip, 3), dtype=float) - curvature = np.zeros((num_ip, 3), dtype=float) - transverse_shear_strain = np.zeros((num_ip, 2), dtype=float) - membrane_resultants = np.zeros((num_ip, 3), dtype=float) - bending_resultants = np.zeros((num_ip, 3), dtype=float) - transverse_shear_resultants = np.zeros((num_ip, 2), dtype=float) - - global_membrane = ( - np.zeros((num_ip, 3, 3), dtype=float) if return_global else None - ) - global_bending = ( - np.zeros((num_ip, 3, 3), dtype=float) if return_global else None - ) - global_shear = ( - np.zeros((num_ip, 3), dtype=float) if return_global else None - ) - - mitc_planar = None - mitc_samples = None - mitc_u_local = None - tri3_B_s = None - tri3_u_local = None - center_section = None - if self._is_4node: - R_center = self._center_frame(coords) - center_section = self._generalized_section_in_frame(R_center) - mitc_planar, mitc_samples = self._mitc4_shear_samples(coords, R_center) - mitc_u_local = self._local_dof_transform(R_center) @ u_elem_global - elif self._is_3node: - R_center = self._center_frame(coords) - center_section = self._generalized_section_in_frame(R_center) - tri3_B_s, _ = self._tri3_assumed_shear_b_matrix(coords, R_center) - tri3_u_local = self._local_dof_transform(R_center) @ u_elem_global - - for index, (xi, eta) in enumerate(self.gauss_points): - N, dN_dxi, dN_deta = self.compute_shape_functions( - float(xi), - float(eta), - ) - R, dN_dx, dN_dy, _ = self._local_frame_and_derivatives( - coords, - dN_dxi, - dN_deta, - ) - section = self._generalized_section_in_frame(R) - assert section is not None - T = self._local_dof_transform(R) - u_local = T @ u_elem_global - B_m, B_b, B_s = self._build_shell_b_matrices(N, dN_dx, dN_dy) - strain = B_m @ u_local - bend = B_b @ u_local - if self._is_4node: - B_s_mitc, _ = self._mitc4_shear_b_matrix( - mitc_planar, - mitc_samples, - float(xi), - float(eta), - ) - shear_strain = B_s_mitc @ mitc_u_local - shear_section = center_section - elif self._is_3node: - shear_strain = tri3_B_s @ tri3_u_local - shear_section = center_section - else: - shear_strain = B_s @ u_local - shear_section = section - assert shear_section is not None - - force = section.A @ strain + section.B @ bend - moment = section.B.T @ strain + section.D @ bend - shear_force = shear_section.As @ shear_strain - - membrane_strain[index] = strain - curvature[index] = bend - transverse_shear_strain[index] = shear_strain - membrane_resultants[index] = force - bending_resultants[index] = moment - transverse_shear_resultants[index] = shear_force - - if return_global: - force_tensor = np.array( - [ - [force[0], force[2], 0.0], - [force[2], force[1], 0.0], - [0.0, 0.0, 0.0], - ], - dtype=float, - ) - moment_tensor = np.array( - [ - [moment[0], moment[2], 0.0], - [moment[2], moment[1], 0.0], - [0.0, 0.0, 0.0], - ], - dtype=float, - ) - assert global_membrane is not None - assert global_bending is not None - assert global_shear is not None - global_membrane[index] = R @ force_tensor @ R.T - global_bending[index] = R @ moment_tensor @ R.T - global_shear[index] = ( - shear_force[0] * R[:, 0] + shear_force[1] * R[:, 1] - ) - - results: Dict[str, Any] = { - "generalized_stress_scope": "section_resultants_only", - "recovery_scope": "section_resultants_only", - "physical_stress_available": False, - "membrane_resultant_order": SHELL_MEMBRANE_VOIGT_ORDER, - "transverse_shear_resultant_order": SHELL_TRANSVERSE_SHEAR_ORDER, - "membrane_strain": membrane_strain, - "curvature": curvature, - "transverse_shear_strain": transverse_shear_strain, - "membrane_resultants": membrane_resultants, - "bending_resultants": bending_resultants, - "transverse_shear_resultants": transverse_shear_resultants, - } - if return_global: - results.update( - { - "global_membrane_resultant_tensors": global_membrane, - "global_bending_resultant_tensors": global_bending, - "global_transverse_shear_resultants": global_shear, - } - ) - return results - - def compute_stresses( - self, - mesh: "FEMesh", - displacements: np.ndarray, - material: "Material", - return_global: bool = False, - *, - natural_points=None, - ) -> Dict[str, Any]: - if self.shell_section is not None: - if natural_points is not None: - raise ValueError('custom stress points are unsupported for generalized shell sections') - return self._compute_generalized_section_results( - mesh, - displacements, - return_global=return_global, - ) - coords = self.get_node_coordinates(mesh) - u_elem_global = self._get_element_displacements(mesh, displacements) - symmetry = _elastic_symmetry(material) - h = self.thickness - kappa = 5.0 / 6.0 - - recovery_points=self.gauss_points if natural_points is None else np.asarray(natural_points,dtype=float) - if natural_points is not None and (recovery_points.ndim!=2 or recovery_points.shape[1]!=2 or len(recovery_points)==0 or not np.all(np.isfinite(recovery_points)) or np.any(np.abs(recovery_points)>1)): - raise ValueError('natural stress points must be nonempty finite Nx2 in [-1,1]') - num_ip = len(recovery_points) - stresses: Dict[str, np.ndarray] = { - "membrane_xx": np.zeros(num_ip), - "membrane_yy": np.zeros(num_ip), - "membrane_xy": np.zeros(num_ip), - "bending_xx": np.zeros(num_ip), - "bending_yy": np.zeros(num_ip), - "bending_xy": np.zeros(num_ip), - "shear_xz": np.zeros(num_ip), - "shear_yz": np.zeros(num_ip), - "von_mises": np.zeros(num_ip), - "equivalent_stress": np.zeros(num_ip), - "hill_utilization": np.zeros(num_ip), - } - stresses["equivalent_stress_measure"] = ( - "hill48" if symmetry == "orthotropic" and getattr(material, "hill_yield", None) is not None - else "von_mises" - ) - if return_global: - stresses.update({ - "local_xx_top": np.zeros(num_ip), - "local_yy_top": np.zeros(num_ip), - "local_zz_top": np.zeros(num_ip), - "local_xy_top": np.zeros(num_ip), - "local_yz_top": np.zeros(num_ip), - "local_xz_top": np.zeros(num_ip), - "local_xx_bot": np.zeros(num_ip), - "local_yy_bot": np.zeros(num_ip), - "local_zz_bot": np.zeros(num_ip), - "local_xy_bot": np.zeros(num_ip), - "local_yz_bot": np.zeros(num_ip), - "local_xz_bot": np.zeros(num_ip), - "global_xx_top": np.zeros(num_ip), - "global_yy_top": np.zeros(num_ip), - "global_zz_top": np.zeros(num_ip), - "global_xy_top": np.zeros(num_ip), - "global_yz_top": np.zeros(num_ip), - "global_xz_top": np.zeros(num_ip), - "global_xx_bot": np.zeros(num_ip), - "global_yy_bot": np.zeros(num_ip), - "global_zz_bot": np.zeros(num_ip), - "global_xy_bot": np.zeros(num_ip), - "global_yz_bot": np.zeros(num_ip), - "global_xz_bot": np.zeros(num_ip), - }) - - mitc_planar = None - mitc_samples = None - mitc_u_local = None - tri3_B_s = None - tri3_u_local = None - if self._is_4node: - R_center = self._center_frame(coords) - _Q_center, G_center, _strain_center, _stress_center = _shell_material_matrices( - material, - self._material_angle(R_center), - ) - mitc_planar, mitc_samples = self._mitc4_shear_samples(coords, R_center) - mitc_u_local = self._local_dof_transform(R_center) @ u_elem_global - elif self._is_3node: - R_center = self._center_frame(coords) - _Q_center, G_center, _strain_center, _stress_center = _shell_material_matrices( - material, - self._material_angle(R_center), - ) - tri3_B_s, _ = self._tri3_assumed_shear_b_matrix(coords, R_center) - tri3_u_local = self._local_dof_transform(R_center) @ u_elem_global - - from .recovery_shell_frames import native_recovery_frames - - frames = native_recovery_frames(self, coords, recovery_points, material) - for idx, (xi, eta) in enumerate(recovery_points): - if frames is None: - N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) - R, dN_dx, dN_dy, _ = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) - else: - N, R, dN_dx, dN_dy = frames[idx] - Q_local, G_local, _strain_to_material, stress_to_local = _shell_material_matrices( - material, - self._material_angle(R), - ) - T = self._local_dof_transform(R) - u_local = T @ u_elem_global - B_m, B_b, B_s = self._build_shell_b_matrices(N, dN_dx, dN_dy) - membrane_strain = B_m @ u_local - curvature = B_b @ u_local - if self._is_4node: - B_s_mitc, _ = self._mitc4_shear_b_matrix(mitc_planar, mitc_samples, float(xi), float(eta)) - shear_strain = B_s_mitc @ mitc_u_local - elif self._is_3node: - shear_strain = tri3_B_s @ tri3_u_local - else: - shear_strain = B_s @ u_local - - sigma_m = Q_local @ membrane_strain - moments = (h**3 / 12.0 * Q_local) @ curvature - sigma_b = 6.0 * moments / max(h**2, _SMALL) - shear_matrix = G_center if self._is_4node or self._is_3node else G_local - tau_s = kappa * shear_matrix @ shear_strain - - stresses["membrane_xx"][idx] = sigma_m[0] - stresses["membrane_yy"][idx] = sigma_m[1] - stresses["membrane_xy"][idx] = sigma_m[2] - stresses["bending_xx"][idx] = sigma_b[0] - stresses["bending_yy"][idx] = sigma_b[1] - stresses["bending_xy"][idx] = sigma_b[2] - stresses["shear_xz"][idx] = tau_s[0] - stresses["shear_yz"][idx] = tau_s[1] - - # Top surface (z = +h/2) - sigma_x_top = sigma_m[0] + sigma_b[0] - sigma_y_top = sigma_m[1] + sigma_b[1] - tau_xy_top = sigma_m[2] + sigma_b[2] - vm_top = np.sqrt( - sigma_x_top**2 + sigma_y_top**2 - sigma_x_top * sigma_y_top + 3.0 * (tau_xy_top**2 + tau_s[0]**2 + tau_s[1]**2) - ) - - # Bottom surface (z = -h/2) - sigma_x_bot = sigma_m[0] - sigma_b[0] - sigma_y_bot = sigma_m[1] - sigma_b[1] - tau_xy_bot = sigma_m[2] - sigma_b[2] - vm_bot = np.sqrt( - sigma_x_bot**2 + sigma_y_bot**2 - sigma_x_bot * sigma_y_bot + 3.0 * (tau_xy_bot**2 + tau_s[0]**2 + tau_s[1]**2) - ) - - stresses["von_mises"][idx] = max(vm_top, vm_bot) - hill_yield = getattr(material, "hill_yield", None) - if hill_yield is not None: - from .plasticity import hill48_plane_stress_equivalent_stress - - top_material = np.linalg.solve(stress_to_local, np.array( - [sigma_x_top, sigma_y_top, tau_xy_top], - dtype=float, - )) - bottom_material = np.linalg.solve(stress_to_local, np.array( - [sigma_x_bot, sigma_y_bot, tau_xy_bot], - dtype=float, - )) - hill_values = hill48_plane_stress_equivalent_stress( - np.vstack((top_material, bottom_material)), - hill_yield, - ) - equivalent = float(np.max(hill_values)) - stresses["equivalent_stress"][idx] = equivalent - stresses["hill_utilization"][idx] = equivalent / max(float(hill_yield.X), _SMALL) - else: - stresses["equivalent_stress"][idx] = stresses["von_mises"][idx] - - if return_global: - # Top local stress tensor - sigma_loc_top = np.array([ - [sigma_x_top, tau_xy_top, tau_s[0]], - [tau_xy_top, sigma_y_top, tau_s[1]], - [tau_s[0], tau_s[1], 0.0] - ], dtype=float) - sigma_glob_top = R @ sigma_loc_top @ R.T - - # Bottom local stress tensor - sigma_loc_bot = np.array([ - [sigma_x_bot, tau_xy_bot, tau_s[0]], - [tau_xy_bot, sigma_y_bot, tau_s[1]], - [tau_s[0], tau_s[1], 0.0] - ], dtype=float) - sigma_glob_bot = R @ sigma_loc_bot @ R.T - - # Store local components - stresses["local_xx_top"][idx] = sigma_x_top - stresses["local_yy_top"][idx] = sigma_y_top - stresses["local_zz_top"][idx] = 0.0 - stresses["local_xy_top"][idx] = tau_xy_top - stresses["local_xz_top"][idx] = tau_s[0] - stresses["local_yz_top"][idx] = tau_s[1] - - stresses["local_xx_bot"][idx] = sigma_x_bot - stresses["local_yy_bot"][idx] = sigma_y_bot - stresses["local_zz_bot"][idx] = 0.0 - stresses["local_xy_bot"][idx] = tau_xy_bot - stresses["local_xz_bot"][idx] = tau_s[0] - stresses["local_yz_bot"][idx] = tau_s[1] - - # Store global components - stresses["global_xx_top"][idx] = sigma_glob_top[0, 0] - stresses["global_yy_top"][idx] = sigma_glob_top[1, 1] - stresses["global_zz_top"][idx] = sigma_glob_top[2, 2] - stresses["global_xy_top"][idx] = sigma_glob_top[0, 1] - stresses["global_xz_top"][idx] = sigma_glob_top[0, 2] - stresses["global_yz_top"][idx] = sigma_glob_top[1, 2] - - stresses["global_xx_bot"][idx] = sigma_glob_bot[0, 0] - stresses["global_yy_bot"][idx] = sigma_glob_bot[1, 1] - stresses["global_zz_bot"][idx] = sigma_glob_bot[2, 2] - stresses["global_xy_bot"][idx] = sigma_glob_bot[0, 1] - stresses["global_xz_bot"][idx] = sigma_glob_bot[0, 2] - stresses["global_yz_bot"][idx] = sigma_glob_bot[1, 2] - return stresses - - -def _publish_shell_element_public_signatures() -> None: - """Hide private runtime-guard hooks from the stable public API surface.""" - - from inspect import signature - - mass_signature = signature(ShellElement.compute_mass_matrix) - ShellElement.compute_mass_matrix.__signature__ = mass_signature.replace( - parameters=tuple( - parameter - for parameter in mass_signature.parameters.values() - if parameter.name != "_qualified_runtime_post_observation" - ) - ) - nonlinear_signature = signature(ShellElement.compute_nonlinear_response) - public_nonlinear_return = signature( - Element.compute_nonlinear_response - ).return_annotation - ShellElement.compute_nonlinear_response.__signature__ = ( - nonlinear_signature.replace( - parameters=tuple( - parameter - for parameter in nonlinear_signature.parameters.values() - if parameter.name - not in { - "_return_tangent_components", - "_qualified_runtime_post_observation", - } - ), - return_annotation=public_nonlinear_return, - ) - ) - - -_publish_shell_element_public_signatures() -del _publish_shell_element_public_signatures - - -def _install_strict_flat_s3_v2_legacy_dispatch_guards() -> None: - """Reject explicit base-method bypasses on the Stage-1 V2 candidate.""" - - from functools import wraps - from inspect import signature - - guard = _reject_strict_flat_s3_v2_legacy_dispatch - allowed = {"__init__", "dofs_per_node", "get_node_coordinates", "num_nodes"} - for name, original in tuple(vars(ShellElement).items()): - if name in allowed or name.startswith("__"): - continue - - if type(original) is property: - def wrap_accessor( - accessor: Optional[Callable[..., Any]], - label: str, - _guard: Callable[[Any, str], None] = guard, - ) -> Optional[Callable[..., Any]]: - if accessor is None: - return None - - @wraps(accessor) - def guarded_accessor(self: Any, *args: Any, **kwargs: Any) -> Any: - _guard(self, f"ShellElement.{label}") - return accessor(self, *args, **kwargs) - - guarded_accessor.__signature__ = signature(accessor) # type: ignore[attr-defined] - delattr(guarded_accessor, "__wrapped__") - return guarded_accessor - - setattr( - ShellElement, - name, - property( - wrap_accessor(original.fget, name), - wrap_accessor(original.fset, name), - wrap_accessor(original.fdel, name), - original.__doc__, - ), - ) - continue - if type(original) is not FunctionType: - continue - - @wraps(original) - def guarded( - self: Any, - *args: Any, - __name: str = name, - __original: Callable[..., Any] = original, - __guard: Callable[[Any, str], None] = guard, - **kwargs: Any, - ) -> Any: - __guard(self, f"ShellElement.{__name}") - return __original(self, *args, **kwargs) - - guarded.__signature__ = signature(original) # type: ignore[attr-defined] - delattr(guarded, "__wrapped__") - setattr(ShellElement, name, guarded) - - -_install_strict_flat_s3_v2_legacy_dispatch_guards() -del _install_strict_flat_s3_v2_legacy_dispatch_guards - -# Exact dispatch surface for the recovery-only quadrature frame optimization. -# Subclasses and instance/class overrides retain their scalar dispatch. -_SHELL_RECOVERY_FRAME_METHODS = tuple(vars(ShellElement).items()) -_SHELL_RECOVERY_BASE_METHODS = tuple(vars(Element).items()) -_SHELL_RECOVERY_MATERIAL_METHODS = tuple(vars(_RecoveryIsotropicMaterial).items()) -_SHELL_RECOVERY_FRAME_HELPERS = tuple((name, globals()[name]) for name in ( - "_cross3", "_inv2", "_shell_material_matrices", "_elastic_symmetry", - "_canonical_material_symmetry", "_guarded_observe_attribute", "_guarded_float", - "_jit_compute_8node_shape_functions", -)) - - -class BeamElement(Element): - """2-node Timoshenko beam element with 6 DOF per node. - - ``section=`` opts into a coupled generalized section. The same object may - be supplied under ``cross_section["generalized_section"]``; a raw matrix - is accepted under ``cross_section["generalized_stiffness"]``. Legacy - scalar cross-section dictionaries retain their historical formulation. - A generalized stiffness matrix does not define centroidal geometry, so - its Wagner torsional geometric-stiffness term is omitted by default. - Supply ``cross_section["geometric_polar_radius_squared"]`` in m^2 to opt in - explicitly. - """ - - def __init__( - self, - element_id: int, - node_ids: List[int], - material_name: str = "default", - cross_section: Optional[Dict[str, Any]] = None, - section: Any = None, - ): - super().__init__(element_id, node_ids, material_name) - if len(node_ids) != 2: - raise ValueError(f"BeamElement requires 2 nodes, got {len(node_ids)}") - self.cross_section = cross_section or {} - self._A = self.cross_section.get("area", 0.01) - self._Iy = self.cross_section.get("Iy", 1.0e-8) - self._Iz = self.cross_section.get("Iz", 1.0e-8) - self._J = self.cross_section.get("J", 1.0e-8) - self._ky = self.cross_section.get("shear_factor_y", 5.0 / 6.0) - self._kz = self.cross_section.get("shear_factor_z", 5.0 / 6.0) - self._orientation = _section_orientation(self.cross_section) - self._fiber_plasticity = self.cross_section.get("fiber_plasticity") - self.generalized_section = resolve_generalized_beam_section( - self.cross_section, - section, - ) - if self.generalized_section is not None and self._fiber_plasticity is not None: - raise ValueError( - "Generalized beam sections do not support " - "cross_section['fiber_plasticity']; supply an elastic section " - "without fiber plasticity." - ) - if self.generalized_section is not None: - self._geometric_polar_radius_squared() - self._geometric_nonlinearity = str( - self.cross_section.get("geometric_nonlinearity", self.cross_section.get("geometry", "von_karman")) - ).lower() - # Optional exact stress-recovery data; estimated from A and I if absent. - self._c_y = self.cross_section.get("c_y") - self._c_z = self.cross_section.get("c_z") - self._torsion_modulus = self.cross_section.get("torsion_modulus") - - def set_linear_nodal_offsets(self, offsets) -> None: - """Global node-to-centroid rigid arms for the linear static route only.""" - values=np.asarray(offsets,dtype=float) - if self.num_nodes!=2 or values.shape!=(2,3) or not np.all(np.isfinite(values)): - raise ValueError('linear beam offsets require two finite global vectors') - self._linear_nodal_offsets=values.copy() - - def _linear_rigid_arm_map(self) -> np.ndarray: - arm=np.eye(12) - for i,d in enumerate(getattr(self,'_linear_nodal_offsets',np.zeros((2,3)))): - x,y,z=d - arm[i*6:i*6+3,i*6+3:i*6+6]=np.array([[0,z,-y],[-z,0,x],[y,-x,0]]) - return arm - - def recover_linear_section_forces(self, mesh, displacements, material, stations): - """Global force/moment on a positive local-x cut; no beam distributed loads.""" - stations=np.asarray(stations,dtype=float) - if stations.ndim!=2 or stations.shape[1]!=3 or len(stations)==0 or not np.all(np.isfinite(stations)): - raise ValueError('beam stations must be nonempty finite Nx3 coordinates') - coords=self.get_node_coordinates(mesh) - length,transform=self._beam_frame_and_transform(coords) - local=transform@self._get_element_displacements(mesh,displacements) - end=self._local_linear_stiffness(length,material)@local - rotation=_beam_rotation_matrix((coords[1]-coords[0])/length,self._orientation) - output=[] - for station in stations: - distance=float(np.dot(station-coords[0],rotation[:,0])) - if distance < -1e-6 or distance>length+1e-6 or np.linalg.norm(station-(coords[0]+distance*rotation[:,0]))>1e-6: - raise ValueError('beam result station is not on physical centroid line') - force=-end[:3] - moment=-end[3:6]+np.cross([distance,0,0],end[:3]) - output.append(np.r_[rotation@force,rotation@moment]) - return np.asarray(output) - - def _refuse_offset_route(self, route): - if np.any(getattr(self,'_linear_nodal_offsets',0)): - raise ValueError(f'offset beam {route} is not admitted; linear static only') - - def _fiber_distances(self) -> Tuple[float, float]: - """Extreme fiber distances (local y, local z), estimated when not given.""" - c_y = self._c_y - c_z = self._c_z - if c_y is None or c_y <= 0.0: - c_y = np.sqrt(abs(self._Iz) / max(self._A, _SMALL)) * 2.0 - if c_z is None or c_z <= 0.0: - c_z = np.sqrt(abs(self._Iy) / max(self._A, _SMALL)) * 2.0 - return max(float(c_y), _SMALL), max(float(c_z), _SMALL) - - def _torsion_section_modulus(self) -> float: - """Torsional section modulus Wt with tau = T / Wt, estimated when not given.""" - wt = self._torsion_modulus - if wt is None or wt <= 0.0: - wt = 2.0 * self._A - return max(float(wt), _SMALL) - - def _geometric_polar_radius_squared(self) -> float: - """Return the section polar radius squared used by the Wagner term. - - The legacy scalar section defines this quantity as ``(Iy + Iz) / A``. - A generalized 6x6 stiffness does not uniquely define any of those - geometric quantities, even when legacy keys happen to be present for - mass fallback or other workflows. Generalized sections therefore - require an explicitly named geometric value and otherwise omit the - Wagner term. - """ - if self.generalized_section is None: - return (self._Iy + self._Iz) / max(self._A, 1.0e-30) - - value = self.cross_section.get("geometric_polar_radius_squared") - if value is None: - return 0.0 - try: - polar_radius_squared = float(value) - except (TypeError, ValueError) as exc: - raise ValueError( - "cross_section['geometric_polar_radius_squared'] must be a " - "finite non-negative value in m^2 for a generalized beam " - "section." - ) from exc - if ( - not np.isfinite(polar_radius_squared) - or polar_radius_squared < 0.0 - ): - raise ValueError( - "cross_section['geometric_polar_radius_squared'] must be a " - "finite non-negative value in m^2 for a generalized beam " - "section." - ) - return polar_radius_squared - - @property - def num_nodes(self) -> int: - return 2 - - @property - def dofs_per_node(self) -> int: - return 6 - - def get_node_coordinates(self, mesh: "FEMesh") -> np.ndarray: - coords = np.zeros((2, 3), dtype=float) - for i, node_id in enumerate(self.node_ids): - node = mesh.get_node(node_id) - if node is None: - raise ValueError(f"Beam element {self.element_id} references missing node {node_id}") - coords[i] = node.coords() - return coords+getattr(self,'_linear_nodal_offsets',0) - - def _beam_frame_and_transform(self, coords: np.ndarray) -> Tuple[float, np.ndarray]: - length = float(np.linalg.norm(coords[1] - coords[0])) - if length < _SMALL: - raise ValueError(f"Beam element {self.element_id} has near-zero length") - e1 = (coords[1] - coords[0]) / length - R = _beam_rotation_matrix(e1, self._orientation) - T = np.zeros((12, 12), dtype=float) - Rt = R.T - for i in range(2): - b = i * 6 - T[b:b + 3, b:b + 3] = Rt - T[b + 3:b + 6, b + 3:b + 6] = Rt - return length, T@self._linear_rigid_arm_map() - - def _local_linear_stiffness(self, length: float, material: "Material", include_axial: bool = True) -> np.ndarray: - L = float(length) - if self.generalized_section is not None: - section_stiffness = generalized_beam_stiffness( - self.generalized_section - ) - basic_transform = _beam2_basic_deformation_matrix(L) - if not include_axial: - basic_transform = basic_transform.copy() - basic_transform[0, :] = 0.0 - _flexibility, basic_stiffness = ( - _beam2_generalized_flexibility(L, section_stiffness) - ) - # Force-based integration satisfies beam equilibrium exactly and - # avoids shear locking. For a diagonal section matrix this - # reduces to the historical closed-form Timoshenko stiffness; - # off-diagonal terms retain all generalized couplings. - return ( - basic_transform.T - @ basic_stiffness - @ basic_transform - ) - E, G12, G13, GJ = _beam_material_properties(material, self.cross_section) - EA = E * self._A - EIy = E * self._Iy - EIz = E * self._Iz - K = np.zeros((12, 12), dtype=float) - if include_axial: - K[0, 0] = K[6, 6] = EA / L - K[0, 6] = K[6, 0] = -EA / L - - # Bending about local y: deflection w (local z), rotation ry, EIy, - # Timoshenko shear parameter from the local-z shear area. - phi_w = 12.0 * EIy / max(G13 * self._A * self._kz * L**2, _SMALL) - K[2, 2] = K[8, 8] = 12.0 * EIy / (L**3 * (1.0 + phi_w)) - K[2, 8] = K[8, 2] = -K[2, 2] - K[2, 4] = K[4, 2] = -6.0 * EIy / (L**2 * (1.0 + phi_w)) - K[2, 10] = K[10, 2] = K[2, 4] - K[8, 4] = K[4, 8] = -K[2, 4] - K[8, 10] = K[10, 8] = -K[2, 4] - K[4, 4] = K[10, 10] = (4.0 + phi_w) * EIy / (L * (1.0 + phi_w)) - K[4, 10] = K[10, 4] = (2.0 - phi_w) * EIy / (L * (1.0 + phi_w)) - - # Bending about local z: deflection v (local y), rotation rz, EIz, - # Timoshenko shear parameter from the local-y shear area. - phi_v = 12.0 * EIz / max(G12 * self._A * self._ky * L**2, _SMALL) - K[1, 1] = K[7, 7] = 12.0 * EIz / (L**3 * (1.0 + phi_v)) - K[1, 7] = K[7, 1] = -K[1, 1] - K[1, 5] = K[5, 1] = 6.0 * EIz / (L**2 * (1.0 + phi_v)) - K[1, 11] = K[11, 1] = 6.0 * EIz / (L**2 * (1.0 + phi_v)) - K[7, 5] = K[5, 7] = -6.0 * EIz / (L**2 * (1.0 + phi_v)) - K[7, 11] = K[11, 7] = -6.0 * EIz / (L**2 * (1.0 + phi_v)) - K[5, 5] = K[11, 11] = (4.0 + phi_v) * EIz / (L * (1.0 + phi_v)) - K[5, 11] = K[11, 5] = (2.0 - phi_v) * EIz / (L * (1.0 + phi_v)) - - K[3, 3] = K[9, 9] = GJ / L - K[3, 9] = K[9, 3] = -GJ / L - return K - - def compute_stiffness_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: - coords = self.get_node_coordinates(mesh) - try: - L, T = self._beam_frame_and_transform(coords) - except ValueError: - if np.any(getattr(self,'_linear_nodal_offsets',0)): - raise - return np.zeros((self.total_dofs, self.total_dofs)) - K = self._local_linear_stiffness(L, material) - K_global = T.T @ K @ T - self._stiffness_matrix = K_global - return K_global - - def compute_mass_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: - self._refuse_offset_route('mass/dynamics') - coords = self.get_node_coordinates(mesh) - try: - L, T = self._beam_frame_and_transform(coords) - except ValueError: - return np.zeros((self.total_dofs, self.total_dofs)) - generalized_mass = ( - None - if self.generalized_section is None - else generalized_beam_mass_matrix(self.generalized_section) - ) - if generalized_mass is not None: - # Exact consistent integration of the linear interpolation. A - # full sectional inertia matrix may include centre-of-mass or - # product-of-inertia translation/rotation coupling, so diagonal - # lumping would discard part of the supplied constitutive data. - interpolation_mass = np.array( - [[1.0 / 3.0, 1.0 / 6.0], [1.0 / 6.0, 1.0 / 3.0]], - dtype=float, - ) - M = np.zeros((12, 12), dtype=float) - for i in range(2): - for j in range(2): - M[ - i * 6 : (i + 1) * 6, - j * 6 : (j + 1) * 6, - ] = interpolation_mass[i, j] * L * generalized_mass - M_global = T.T @ M @ T - self._mass_matrix = M_global - return M_global - rho = material.density - M = np.zeros((12, 12), dtype=float) - if bool(self.cross_section.get("consistent_mass", False)): - # Consistent mass on the element's own linear interpolation, - # mirroring the 3-node quadratic beam: N_i N_j blocks for the - # translations (rho A) and for each rotation with its matching - # section inertia (polar Iy+Iz for torsion). Rigid-body - # translational and rotational inertia are exact, so no lumped - # bar-length correction terms are needed. - coupling = np.array([[1.0 / 3.0, 1.0 / 6.0], [1.0 / 6.0, 1.0 / 3.0]], dtype=float) - rotary_density = ( - rho * (self._Iy + self._Iz), # rx (torsion) - rho * self._Iy, # ry - rho * self._Iz, # rz - ) - for i in range(2): - for j in range(2): - factor = coupling[i, j] * L - for d in range(3): - M[i * 6 + d, j * 6 + d] = rho * self._A * factor - M[i * 6 + 3 + d, j * 6 + 3 + d] = rotary_density[d] * factor - M_global = T.T @ M @ T - self._mass_matrix = M_global - return M_global - mass_per_node = rho * self._A * L / 2.0 - # Lumped rotary inertia: bending rotations carry the rigid-bar term - # rho*A*L^3/24 plus the section rotatory term rho*I*L/2; the torsion - # DOF carries the polar section inertia rho*(Iy+Iz)*L/2, not a - # bar-length term, because spinning about the member axis does not - # translate the distributed mass. - rotary_bar = mass_per_node * L**2 / 12.0 - rotary = ( - rho * (self._Iy + self._Iz) * L / 2.0, # rx (torsion) - rotary_bar + rho * self._Iy * L / 2.0, # ry - rotary_bar + rho * self._Iz * L / 2.0, # rz - ) - for i in range(2): - b = i * 6 - for d in range(3): - M[b + d, b + d] = mass_per_node - M[b + 3 + d, b + 3 + d] = rotary[d] - M_global = T.T @ M @ T - self._mass_matrix = M_global - return M_global - - @staticmethod - def _axial_compression_from_state(state: Optional[Any]) -> float: - """Return positive compression from a user/reference element state.""" - if state is None: - return 0.0 - if isinstance(state, (int, float, np.number)): - return float(state) - if not isinstance(state, dict): - return 0.0 - - for key in ("axial_compression", "compression", "N_compression"): - if key in state: - return float(state[key]) - - for key in ("axial_force", "N", "reference_axial_force"): - if key in state: - # Stress recovery uses positive axial strain/stress in tension, - # so a negative axial force is destabilizing compression. - return -float(state[key]) - return 0.0 - - def compute_geometric_stiffness_matrix( - self, - mesh: "FEMesh", - material: "Material", - state: Optional[Any] = None, - ) -> np.ndarray: - """ - Beam-column geometric stiffness for an axial reference compression. - - The returned matrix follows ``K phi = lambda KG phi``. A positive - ``axial_compression`` in ``state`` therefore produces a positive - destabilizing ``KG``. - """ - self._refuse_offset_route('geometric stiffness') - axial_compression = self._axial_compression_from_state(state) - if axial_compression == 0.0: - return np.zeros((self.total_dofs, self.total_dofs), dtype=float) - - coords = self.get_node_coordinates(mesh) - try: - L, T = self._beam_frame_and_transform(coords) - except ValueError: - return np.zeros((self.total_dofs, self.total_dofs), dtype=float) - - factor = axial_compression / (30.0 * L) - L2 = L * L - g_standard = factor * np.array( - [ - [36.0, 3.0 * L, -36.0, 3.0 * L], - [3.0 * L, 4.0 * L2, -3.0 * L, -L2], - [-36.0, -3.0 * L, 36.0, -3.0 * L], - [3.0 * L, -L2, -3.0 * L, 4.0 * L2], - ], - dtype=float, - ) - - K_geo = np.zeros((12, 12), dtype=float) - v_rz = [1, 5, 7, 11] - w_ry = [2, 4, 8, 10] - sign_w = np.diag([1.0, -1.0, 1.0, -1.0]) - g_w = sign_w @ g_standard @ sign_w - - for i, row in enumerate(v_rz): - for j, col in enumerate(v_rz): - K_geo[row, col] += g_standard[i, j] - for i, row in enumerate(w_ry): - for j, col in enumerate(w_ry): - K_geo[row, col] += g_w[i, j] - - # Wagner term: axial compression destabilizes twist about the shear - # center, enabling torsional and flexural-torsional column modes - # (stiffener tripping under axial stress). The shear center is taken - # at the centroid and warping is neglected, consistent with the - # element's St. Venant torsion treatment, so the torsional critical - # load is G*J*A/Ip. - polar_ratio = self._geometric_polar_radius_squared() - g_torsion = axial_compression * polar_ratio / L - K_geo[3, 3] += g_torsion - K_geo[3, 9] -= g_torsion - K_geo[9, 3] -= g_torsion - K_geo[9, 9] += g_torsion - - return T.T @ K_geo @ T - - def _fiber_plasticity_config(self, material: "Material") -> Optional[FiberSectionPlasticityConfig]: - config = self._fiber_plasticity - if config is None: - return None - if isinstance(config, dict): - config = FiberSectionPlasticityConfig(**config) - elif config is True: - config = FiberSectionPlasticityConfig() - elif not isinstance(config, FiberSectionPlasticityConfig): - raise TypeError("cross_section['fiber_plasticity'] must be a FiberSectionPlasticityConfig, dict or True") - curve = config.material_curve or getattr(material, "hardening_curve", None) - if curve is None: - if ( - _elastic_symmetry(material) == "orthotropic" - and getattr(material, "hill_yield", None) is not None - ): - # Hill X supplies an elastic-perfectly-plastic longitudinal - # fiber law when no scalar hardening curve is provided. - return config - return None - if config.material_curve is curve: - return config - return FiberSectionPlasticityConfig(config.num_y, config.num_z, curve) - - def _fiber_section_grid(self, config: FiberSectionPlasticityConfig) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: - cross = self.cross_section if isinstance(getattr(self, "cross_section", None), dict) else {} - web_height = float(cross.get("web_height") or 0.0) - web_thickness = float(cross.get("web_thickness") or 0.0) - flange_width = float(cross.get("flange_width") or 0.0) - flange_thickness = float(cross.get("flange_thickness") or 0.0) - shaped = ( - web_height > 0.0 - and web_thickness > 0.0 - and flange_width > 0.0 - and flange_thickness > 0.0 - ) - key = ( - "fiber_grid", - int(config.num_y), - int(config.num_z), - float(self._A), - float(self._Iy), - float(self._Iz), - round(web_height, 12), - round(web_thickness, 12), - round(flange_width, 12), - round(flange_thickness, 12), - ) - cache = getattr(self, "_fiber_grid_cache", None) - if cache is not None and cache.get("key") == key: - return cache["y"], cache["z"], cache["weights"] - - if shaped: - # Profile-true fiber layout: web and flange strips follow the real - # T/L section geometry so the plastification order (flange tips vs - # web) is captured. The coordinates and weights are afterwards - # recentred and rescaled to reproduce the section constants - # A/Iy/Iz exactly, keeping the elastic response identical to the - # section-property idealization. Flanges are laid out symmetric - # in y also for L profiles (the section constants carry no product - # of inertia). - n_web = max(int(config.num_z), 3) - n_flange = max(int(config.num_y), 3) - web_z = (np.arange(n_web, dtype=float) + 0.5) * (web_height / n_web) - y_parts = [np.zeros(n_web)] - z_parts = [web_z] - weight_parts = [np.full(n_web, web_height * web_thickness / n_web)] - flange_y = (np.arange(n_flange, dtype=float) + 0.5) * (flange_width / n_flange) - 0.5 * flange_width - for z_level in (web_height + 0.25 * flange_thickness, web_height + 0.75 * flange_thickness): - y_parts.append(flange_y.copy()) - z_parts.append(np.full(n_flange, z_level)) - weight_parts.append(np.full(n_flange, flange_width * flange_thickness / (2 * n_flange))) - y = np.concatenate(y_parts) - z = np.concatenate(z_parts) - weights = np.concatenate(weight_parts) - total = float(np.sum(weights)) - if total > _SMALL and self._A > 0.0: - weights *= float(self._A) / total - area = float(np.sum(weights)) - if area > _SMALL: - y = y - float(np.sum(weights * y)) / area - z = z - float(np.sum(weights * z)) / area - else: - raw_y = np.linspace(-1.0, 1.0, int(config.num_y)) if config.num_y > 1 else np.zeros(1) - raw_z = np.linspace(-1.0, 1.0, int(config.num_z)) if config.num_z > 1 else np.zeros(1) - yy, zz = np.meshgrid(raw_y, raw_z, indexing="ij") - y = yy.reshape(-1) - z = zz.reshape(-1) - weights = np.full(y.size, float(self._A) / max(y.size, 1), dtype=float) - - denom_y = float(np.sum(weights * y * y)) - denom_z = float(np.sum(weights * z * z)) - if denom_y > _SMALL and self._Iz > 0.0: - y *= np.sqrt(float(self._Iz) / denom_y) - else: - y *= 0.0 - if denom_z > _SMALL and self._Iy > 0.0: - z *= np.sqrt(float(self._Iy) / denom_z) - else: - z *= 0.0 - - self._fiber_grid_cache = {"key": key, "y": y, "z": z, "weights": weights} - return y, z, weights - - @staticmethod - def _uniaxial_return_map( - strain: np.ndarray, - state: Optional[Any], - E: float, - curve: Any, - flow_scale: float = 1.0, - ) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]: - strain = np.asarray(strain, dtype=float).reshape(-1) - n = strain.size - if isinstance(state, dict) and np.asarray(state.get("plastic_strain", [])).size == n: - plastic_old = np.asarray(state["plastic_strain"], dtype=float).reshape(-1) - alpha_old = np.asarray(state.get("alpha", np.zeros(n)), dtype=float).reshape(-1) - if alpha_old.size == 1: - alpha_old = np.full(n, float(alpha_old[0]), dtype=float) - elif alpha_old.size != n: - raise ValueError( - f"Beam fiber alpha has {alpha_old.size} entries; expected 1 or {n}" - ) - else: - plastic_old = np.zeros(n, dtype=float) - alpha_old = np.zeros(n, dtype=float) - - trial = E * (strain - plastic_old) - abs_trial = np.abs(trial) - scale = float(flow_scale) - if not np.isfinite(scale) or scale <= 0.0: - raise ValueError("beam fiber flow_scale must be positive") - flow_old = ( - np.full(n, scale, dtype=float) - if curve is None - else scale * curve.flow_stress(alpha_old) - ) - yielding = abs_trial > flow_old + 1.0e-9 * np.maximum(flow_old, 1.0) - - stress = trial.copy() - tangent = np.full(n, E, dtype=float) - plastic_new = plastic_old.copy() - alpha_new = alpha_old.copy() - if not np.any(yielding): - return stress, tangent, plastic_new, alpha_new - - indices = np.where(yielding)[0] - for idx in indices: - sign = 1.0 if trial[idx] >= 0.0 else -1.0 - dgamma = 0.0 - lower = 0.0 - upper = abs_trial[idx] / E - H = ( - 0.0 - if curve is None - else scale - * float( - curve.hardening_modulus(np.array([alpha_old[idx]]))[0] - ) - ) - converged = False - for _ in range(30): - alpha_trial = alpha_old[idx] + dgamma - if curve is None: - sy = scale - H = 0.0 - else: - sy = scale * float( - curve.flow_stress(np.array([alpha_trial]))[0] - ) - H = scale * float( - curve.hardening_modulus(np.array([alpha_trial]))[0] - ) - residual = abs_trial[idx] - E * dgamma - sy - # At very large trial strains, ``abs_trial - E * dgamma`` - # loses several hundred pascals to floating-point cancellation. - # Do not demand a residual below the resolution of the terms - # being subtracted. The physical tolerance remains governing - # for ordinary structural strain ranges. - roundoff_tolerance = 16.0 * np.finfo(float).eps * max( - abs_trial[idx], abs(E * dgamma), abs(sy), 1.0 - ) - convergence_tolerance = max( - 1.0e-8 * max(abs(sy), 1.0), roundoff_tolerance - ) +""" +Finite Element Implementations + +This module contains element formulations for: +- ShellElement: 3/6-node triangular and 4/8-node quadrilateral Mindlin-Reissner shell element +- BeamElement: 2-node Timoshenko beam element with 6 DOF/node +- QuadraticBeamElement: 3-node quadratic Timoshenko beam element +- CoupledBeamShellElement: kinematic MPC element for eccentric beam-shell interaction + +Shell convention +---------------- +The shell element forms stiffness and stresses in an element-local orthonormal +basis at each integration point: + + local x = projected xi tangent direction + local y = in-surface direction perpendicular to local x + local z = shell normal + +Global nodal translations and rotations are transformed to this local basis +before the membrane, bending and transverse shear B-matrices are evaluated. + +Shell shear treatment +--------------------- +Membrane and bending always use full integration for the element topology. +Transverse shear depends on the topology: + + * 4-node: MITC4 assumed natural shear (covariant shear sampled at the four + edge midpoints and interpolated), integrated at the full 2x2 rule. This + avoids both shear locking and the spurious zero-energy w-hourglass mode + of one-point reduced shear integration. + * 3-node: centroidal edge-compatible assumed shear. This is the constant + shear part of the DSG/MITC3 family: transverse shear is evaluated from + the element-average shear gap in the centroid frame, preserving rigid + body motion and constant-shear patches without the locking-prone fully + integrated linear Mindlin shear term. + * 6-node: quadratic displacement interpolation with reduced three-point + triangular shear integration. + * 8-node: reduced 2x2 shear integration (S8R style). When full element + reduced integration is requested, a small nullspace-projection + hourglass stiffness stabilizes modes outside the six rigid-body modes. + +Beam section convention +----------------------- +Beam local axes are (x = member axis, y, z). ``Iy`` is the second moment of +area about the local y axis and governs bending that deflects the beam in +local z; ``Iz`` governs deflection in local y. ``shear_factor_y`` scales the +shear area for transverse shear force in local y, ``shear_factor_z`` for local +z. The optional ``cross_section["orientation"]`` vector prescribes the local +z direction (e.g. the stiffener web direction). Without it, a heuristic picks +local y close to global Y (or global Z for members nearly parallel to Y), +which leaves the section orientation unconstrained for asymmetric sections. + +Beam-shell coupling +------------------- +Beam-shell coupling is represented as a linear multi-point constraint (MPC), +not as a large penalty spring. For a beam node offset from a shell node by +vector r, the coupling relation is: + + u_beam = u_shell + theta_shell x r + theta_beam = theta_shell + +The assembly solver eliminates these slave beam DOFs through a transformation. +""" + +from __future__ import annotations + +from abc import ABC, abstractmethod +import copy +from types import FunctionType, MemberDescriptorType +import warnings +from typing import TYPE_CHECKING, Any, Callable, Dict, List, Mapping, Optional, Tuple + +import numpy as np +from anymaterial import IsotropicMaterial as _RecoveryIsotropicMaterial +from . import _compensated_contractions as _local_contractions + +from .beam_sections import ( + GENERALIZED_BEAM_RESULTANT_ORDER, + GENERALIZED_BEAM_STRAIN_ORDER, + generalized_beam_mass_matrix, + generalized_beam_stiffness, + resolve_generalized_beam_section, +) +from .jit_compiler import njit +from .material_curves import FiberSectionPlasticityConfig +from .materials import ( + beam_material_properties as _canonical_beam_material_properties, + elastic_compliance_matrix as _canonical_elastic_compliance, + material_symmetry as _canonical_material_symmetry, +) +from .plasticity import lobatto_layers, plane_stress_elastic_matrix, plane_stress_return_map +from .shell_sections import ( + SHELL_MEMBRANE_VOIGT_ORDER, + SHELL_TRANSVERSE_SHEAR_ORDER, + GeneralizedShellSection, + coerce_generalized_shell_section, +) + +if TYPE_CHECKING: + from .fe_core import FEMesh, Material + + +_SMALL = 1.0e-12 +_INITIAL_SHELL_STATE_KEYS = ( + "initial_membrane_stress", + "initial_bending_stress", + "initial_membrane_prestrain", + "initial_curvature_prestrain", + "initial_field_provenance", +) +_INITIAL_BEAM_STATE_KEYS = ( + "initial_fiber_stress", + "initial_fiber_prestrain", + "initial_field_provenance", +) + + +_OBSERVATION_MISSING = object() +_NO_ATTRIBUTE_DEFAULT = object() + + +def _run_post_observation_guard( + post_observation: Optional[Callable[[], None]], +) -> None: + """Recheck a caller-supplied exact authority lease after one observation.""" + + if post_observation is not None: + post_observation() + + +def _guarded_observe_attribute( + owner: Any, + name: str, + *, + default: Any = _NO_ATTRIBUTE_DEFAULT, + post_observation: Optional[Callable[[], None]] = None, +) -> Any: + """Read one external attribute and recheck before consuming its value.""" + + if default is _NO_ATTRIBUTE_DEFAULT: + value = getattr(owner, name) + else: + value = getattr(owner, name, default) + _run_post_observation_guard(post_observation) + return value + + +def _guarded_observe_call( + provider: Any, + *args: Any, + post_observation: Optional[Callable[[], None]] = None, + **kwargs: Any, +) -> Any: + """Invoke one external provider and recheck before consuming its result.""" + + value = provider(*args, **kwargs) + _run_post_observation_guard(post_observation) + return value + + +def _guarded_float( + value: Any, + *, + post_observation: Optional[Callable[[], None]] = None, +) -> float: + made = float(value) + if type(value) is not float: + _run_post_observation_guard(post_observation) + return made + + +def _guarded_array( + value: Any, + *, + dtype: Any = np.float64, + post_observation: Optional[Callable[[], None]] = None, +) -> np.ndarray: + made = np.asarray(value, dtype=dtype) + # Converting an exact numeric ndarray runs no foreign code. + pure = type(value) is np.ndarray and value.dtype.kind in "fiub" + if not pure: + _run_post_observation_guard(post_observation) + owned = np.array(made, dtype=dtype, order="C", copy=True) + if not pure: + _run_post_observation_guard(post_observation) + return owned + + +def _guarded_owned_mapping( + value: Any, + *, + label: str, + post_observation: Optional[Callable[[], None]] = None, +) -> Dict[str, Any]: + """Detach a string-keyed external mapping before later evaluation.""" + + items_provider = _guarded_observe_attribute( + value, + "items", + post_observation=post_observation, + ) + observed_items = _guarded_observe_call( + items_provider, + post_observation=post_observation, + ) + items = tuple(observed_items) + _run_post_observation_guard(post_observation) + owned: Dict[str, Any] = {} + for item in items: + if type(item) is not tuple or len(item) != 2 or type(item[0]) is not str: + raise TypeError(f"{label} must contain exact string keys") + key, member = item + if key in owned: + raise ValueError(f"{label} contains duplicate key {key!r}") + owned[key] = member + return owned + + +def _guarded_owned_plain_value( + value: Any, + *, + label: str, + post_observation: Optional[Callable[[], None]] = None, +) -> Any: + """Recursively detach caller-owned state before formulation mechanics.""" + + if value is None or type(value) in {bool, int, float, str, bytes}: + return value + if type(value) is np.ndarray: + return _guarded_array( + value, + dtype=value.dtype, + post_observation=post_observation, + ) + if isinstance(value, Mapping): + observed = _guarded_owned_mapping( + value, + label=label, + post_observation=post_observation, + ) + return { + key: _guarded_owned_plain_value( + member, + label=f"{label}.{key}", + post_observation=post_observation, + ) + for key, member in observed.items() + } + if type(value) in {list, tuple}: + observed = tuple(value) + _run_post_observation_guard(post_observation) + made = [ + _guarded_owned_plain_value( + member, + label=f"{label}[{index}]", + post_observation=post_observation, + ) + for index, member in enumerate(observed) + ] + return made if type(value) is list else tuple(made) + try: + return _guarded_array( + value, + post_observation=post_observation, + ) + except (TypeError, ValueError) as exc: + raise TypeError(f"{label} contains an unsupported external value") from exc + + +def _guarded_owned_generalized_shell_section( + section: Any, + *, + post_observation: Optional[Callable[[], None]] = None, + _section_class: type[GeneralizedShellSection] = GeneralizedShellSection, +) -> Optional[GeneralizedShellSection]: + """Coerce one section protocol to an exact solver-owned section.""" + + if section is None: + return None + if type(section) is _section_class: + return section + if isinstance(section, Mapping): + source = _guarded_owned_mapping( + section, + label="generalized shell section", + post_observation=post_observation, + ) + + def read(label: str, default: Any = None) -> Any: + return source[label] if label in source else default + + else: + + def read(label: str, default: Any = None) -> Any: + return _guarded_observe_attribute( + section, + label, + default=default, + post_observation=post_observation, + ) + + matrices: Dict[str, np.ndarray] = {} + for name in ("A", "B", "D", "As"): + raw = read(name, _OBSERVATION_MISSING) + if raw is _OBSERVATION_MISSING or raw is None: + raise TypeError( + "Generalized shell section must provide A, B, D and As; " + f"missing {name}" + ) + matrices[name] = _guarded_array( + raw, + post_observation=post_observation, + ) + raw_name = read("name", "") + name = str(raw_name) + _run_post_observation_guard(post_observation) + masses: Dict[str, Optional[float]] = {} + for field in ("mass_per_area", "rotary_inertia_per_area"): + raw = read(field, None) + masses[field] = ( + None + if raw is None + else _guarded_float(raw, post_observation=post_observation) + ) + return _section_class( + A=matrices["A"], + B=matrices["B"], + D=matrices["D"], + As=matrices["As"], + name=name, + mass_per_area=masses["mass_per_area"], + rotary_inertia_per_area=masses["rotary_inertia_per_area"], + ) + + +def _immutable_float64_array(value: Any) -> np.ndarray: + """Return a C-contiguous float64 array backed by immutable bytes. + + Shell quadrature tables are process-wide formulation inputs. A normal + ``setflags(write=False)`` array can be made writable again when it owns its + storage; a bytes-backed view cannot. This prevents one element or test + from silently changing the rule used by every other shell element. + """ + + contiguous = np.ascontiguousarray(value, dtype=np.float64) + return np.frombuffer( + contiguous.tobytes(order="C"), dtype=np.float64 + ).reshape(contiguous.shape) + + +def _copy_state_fields(state: Any, keys: Tuple[str, ...]) -> Dict[str, Any]: + if not isinstance(state, dict): + return {} + copied: Dict[str, Any] = {} + for key in keys: + if key not in state: + continue + value = state[key] + copied[key] = value.copy() if isinstance(value, np.ndarray) else value + return copied + + +def _shell_field_rows(value: Any, n_gp: int, name: str) -> np.ndarray: + """Broadcast a shell-local engineering vector to one row per Gauss point.""" + array = np.asarray(value, dtype=float) + if array.shape == (3,): + return np.broadcast_to(array, (n_gp, 3)).copy() + if array.shape == (1, 3): + return np.broadcast_to(array, (n_gp, 3)).copy() + if array.shape == (n_gp, 3): + return array.copy() + raise ValueError(f"{name} must have shape (3,) or ({n_gp}, 3); got {array.shape}") + + +def _beam_fiber_field( + value: Any, + total_fibers: int, + section_fibers: int, + name: str, +) -> np.ndarray: + """Broadcast a beam-fiber field over one or all integration sections.""" + array = np.asarray(value, dtype=float).reshape(-1) + if array.size == 1: + return np.full(total_fibers, float(array[0]), dtype=float) + if array.size == section_fibers and total_fibers % section_fibers == 0: + return np.tile(array, total_fibers // section_fibers) + if array.size == total_fibers: + return array.copy() + raise ValueError( + f"{name} must be scalar, have {section_fibers} section-fiber values, " + f"or {total_fibers} total values; got {array.size}" + ) + + +@njit +def _cross3(a: np.ndarray, b: np.ndarray) -> np.ndarray: + """Cross product of two 3-vectors without np.cross dispatch overhead.""" + return np.array( + [ + a[1] * b[2] - a[2] * b[1], + a[2] * b[0] - a[0] * b[2], + a[0] * b[1] - a[1] * b[0], + ], + ) + + +@njit +def _inv2(matrix: np.ndarray) -> Tuple[np.ndarray, float]: + """Inverse and determinant of a 2x2 matrix without LAPACK overhead.""" + det = matrix[0, 0] * matrix[1, 1] - matrix[0, 1] * matrix[1, 0] + if abs(det) < _SMALL: + raise np.linalg.LinAlgError("singular 2x2 matrix") + inv = np.array( + [[matrix[1, 1], -matrix[0, 1]], [-matrix[1, 0], matrix[0, 0]]], + ) / det + return inv, float(det) + + +def _section_orientation(cross_section: Dict[str, Any]) -> Optional[np.ndarray]: + """Return the prescribed local-z (web) direction from a cross-section dict.""" + value = cross_section.get("orientation", cross_section.get("web_direction")) + if value is None: + return None + vector = np.asarray(value, dtype=float).reshape(-1) + if vector.size < 3 or float(np.linalg.norm(vector[:3])) < _SMALL: + return None + return np.array(vector[:3], dtype=float) + + +def _beam_rotation_matrix(e1: np.ndarray, orientation: Optional[np.ndarray]) -> np.ndarray: + """Build the beam local frame [e1 e2 e3] with optional prescribed local z. + + ``orientation`` is the requested local z direction (section web direction). + It is projected perpendicular to the member axis; if it is (nearly) + parallel to the axis the heuristic fallback is used instead. + """ + if orientation is not None: + candidate = orientation - np.dot(orientation, e1) * e1 + norm = float(np.linalg.norm(candidate)) + if norm > 1.0e-6 * float(np.linalg.norm(orientation)): + e3 = candidate / norm + e2 = _cross3(e3, e1) + e2 /= np.linalg.norm(e2) + return np.column_stack((e1, e2, e3)) + trial = np.array([0.0, 1.0, 0.0]) + if abs(float(np.dot(e1, trial))) > 0.95: + trial = np.array([0.0, 0.0, 1.0]) + e2 = trial - np.dot(trial, e1) * e1 + e2 /= np.linalg.norm(e2) + e3 = _cross3(e1, e2) + e3 /= np.linalg.norm(e3) + return np.column_stack((e1, e2, e3)) + + +def _elastic_symmetry( + material: Any, + post_observation: Optional[Callable[[], None]] = None, +) -> str: + """Return the normalized elastic symmetry without inventing isotropic aliases.""" + + symmetry = _canonical_material_symmetry(material) + _run_post_observation_guard(post_observation) + if symmetry not in {"isotropic", "orthotropic"}: + raise ValueError( + f"Unsupported elastic symmetry {symmetry!r}; ANYfeSolver currently supports " + "only isotropic and orthotropic materials." + ) + return symmetry + + +def _elastic_compliance( + material: Any, + post_observation: Optional[Callable[[], None]] = None, +) -> np.ndarray: + """Engineering compliance in [11,22,33,23,13,12] order.""" + + if post_observation is None: + raw_compliance = _canonical_elastic_compliance(material) + else: + provider = _guarded_observe_attribute( + material, + "elastic_compliance_matrix", + default=None, + post_observation=post_observation, + ) + if callable(provider): + raw_compliance = _guarded_observe_call( + provider, + post_observation=post_observation, + ) + elif _elastic_symmetry(material, post_observation) == "isotropic": + elastic_modulus = _guarded_float( + _guarded_observe_attribute( + material, + "elastic_modulus", + post_observation=post_observation, + ), + post_observation=post_observation, + ) + poisson_ratio = _guarded_float( + _guarded_observe_attribute( + material, + "poisson_ratio", + post_observation=post_observation, + ), + post_observation=post_observation, + ) + shear_modulus = elastic_modulus / (2.0 * (1.0 + poisson_ratio)) + raw_compliance = np.array( + [ + [ + 1.0 / elastic_modulus, + -poisson_ratio / elastic_modulus, + -poisson_ratio / elastic_modulus, + 0.0, + 0.0, + 0.0, + ], + [ + -poisson_ratio / elastic_modulus, + 1.0 / elastic_modulus, + -poisson_ratio / elastic_modulus, + 0.0, + 0.0, + 0.0, + ], + [ + -poisson_ratio / elastic_modulus, + -poisson_ratio / elastic_modulus, + 1.0 / elastic_modulus, + 0.0, + 0.0, + 0.0, + ], + [0.0, 0.0, 0.0, 1.0 / shear_modulus, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 1.0 / shear_modulus, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 1.0 / shear_modulus], + ], + dtype=float, + ) + else: + raise ValueError( + "Structural material must provide elastic_compliance_matrix()" + ) + compliance = np.asarray(raw_compliance, dtype=float) + _run_post_observation_guard(post_observation) + if compliance.shape != (6, 6) or not np.all(np.isfinite(compliance)): + raise ValueError("elastic_compliance_matrix() must return a finite 6x6 matrix") + if not np.allclose(compliance, compliance.T, rtol=1.0e-10, atol=1.0e-18): + raise ValueError("elastic compliance matrix must be symmetric") + return 0.5 * (compliance + compliance.T) + + +def _shell_elastic_material_cache_fingerprint( + material: Any, + post_observation: Optional[Callable[[], None]] = None, +) -> Tuple[Any, ...]: + """Bind every elastic input consumed by ``_shell_material_matrices``. + + Material objects are intentionally public and may be edited in place. A + cache key based only on object identity therefore admits stale shell + mechanics. Keep the isotropic branch bit-for-bit aligned with the actual + scalar path, including an explicitly supplied shear modulus; use the + canonical compliance bytes for every other supported material protocol. + """ + + symmetry = _elastic_symmetry(material, post_observation) + raw_elastic_modulus = _guarded_observe_attribute( + material, + "elastic_modulus", + default=_OBSERVATION_MISSING, + post_observation=post_observation, + ) + raw_poisson_ratio = _guarded_observe_attribute( + material, + "poisson_ratio", + default=_OBSERVATION_MISSING, + post_observation=post_observation, + ) + if ( + symmetry == "isotropic" + and raw_elastic_modulus is not _OBSERVATION_MISSING + and raw_poisson_ratio is not _OBSERVATION_MISSING + ): + elastic_modulus = _guarded_float( + raw_elastic_modulus, + post_observation=post_observation, + ) + poisson_ratio = _guarded_float( + raw_poisson_ratio, + post_observation=post_observation, + ) + raw_shear_modulus = _guarded_observe_attribute( + material, + "shear_modulus", + default=elastic_modulus / (2.0 * (1.0 + poisson_ratio)), + post_observation=post_observation, + ) + shear_modulus = _guarded_float( + raw_shear_modulus, + post_observation=post_observation, + ) + return ( + "isotropic_scalar_path", + elastic_modulus, + poisson_ratio, + shear_modulus, + ) + compliance = np.ascontiguousarray( + _elastic_compliance(material, post_observation), + dtype=np.float64, + ) + _run_post_observation_guard(post_observation) + return ( + symmetry, + compliance.shape, + compliance.tobytes(order="C"), + ) + + +def _generalized_shell_section_cache_fingerprint( + section: Any, + post_observation: Optional[Callable[[], None]] = None, +) -> Optional[Tuple[Any, ...]]: + """Return the complete stiffness/mass identity of a generalized section.""" + + if section is None: + return None + matrices = [] + for name, shape in (("A", (3, 3)), ("B", (3, 3)), ("D", (3, 3)), ("As", (2, 2))): + raw = _guarded_observe_attribute( + section, + name, + post_observation=post_observation, + ) + value = _guarded_array( + raw, + post_observation=post_observation, + ) + if value.shape != shape or not np.all(np.isfinite(value)): + raise ValueError( + f"Generalized shell section {name} must remain a finite {shape} matrix" + ) + matrices.append((name, shape, value.tobytes(order="C"))) + raw_name = _guarded_observe_attribute( + section, + "name", + default="", + post_observation=post_observation, + ) + name = str(raw_name) + _run_post_observation_guard(post_observation) + mass_values = [] + for field in ("mass_per_area", "rotary_inertia_per_area"): + raw = _guarded_observe_attribute( + section, + field, + default=None, + post_observation=post_observation, + ) + mass_values.append( + None + if raw is None + else _guarded_float(raw, post_observation=post_observation) + ) + return ( + tuple(matrices), + name, + *mass_values, + ) + + +def _in_plane_transform_matrices(angle_rad: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + """Engineering-strain, stress, and transverse-shear transforms. + + The material 1-axis is rotated by ``angle_rad`` from element-local x + toward local y about the positive shell normal. + """ + + c = float(np.cos(angle_rad)) + s = float(np.sin(angle_rad)) + axes = np.array([[c, -s], [s, c]], dtype=float) + strain_to_material = np.zeros((3, 3), dtype=float) + stress_to_local = np.zeros((3, 3), dtype=float) + for column in range(3): + engineering_strain = np.zeros(3, dtype=float) + engineering_strain[column] = 1.0 + local_tensor = np.array( + [ + [engineering_strain[0], 0.5 * engineering_strain[2]], + [0.5 * engineering_strain[2], engineering_strain[1]], + ], + dtype=float, + ) + material_tensor = axes.T @ local_tensor @ axes + strain_to_material[:, column] = ( + material_tensor[0, 0], + material_tensor[1, 1], + 2.0 * material_tensor[0, 1], + ) + material_stress = np.zeros(3, dtype=float) + material_stress[column] = 1.0 + stress_tensor = np.array( + [ + [material_stress[0], material_stress[2]], + [material_stress[2], material_stress[1]], + ], + dtype=float, + ) + local_stress = axes @ stress_tensor @ axes.T + stress_to_local[:, column] = ( + local_stress[0, 0], + local_stress[1, 1], + local_stress[0, 1], + ) + return strain_to_material, stress_to_local, axes + + +def _compensated_elastic_zero_tangent(element, mesh, material, post_observation=None): + """Scalar zero-state realization, called only after qualified elastic admission. + + Preserve scalar coefficient operations, including reciprocal-compliance + drill, independently of the batch coefficient construction. No state/cache + or caller eligibility is changed here. + """ + geometry = element._nonlinear_geometry(mesh) + membrane, shear, _strain, _stress = _shell_material_matrices( + material, element._material_angle(geometry["R0"]), post_observation) + modulus = 1.0 / float(_elastic_compliance(material, post_observation)[5, 5]) + h = element.thickness + result = _local_contractions.shell_zero_tangent( + geometry, h * membrane, h**3 / 12.0 * membrane, + shear * (5.0 / 6.0) * h, modulus * h * element.drilling_stabilization) + if post_observation is not None: + post_observation() + return result + + +def _shell_material_matrices( + material: Any, + angle_rad: float, + post_observation: Optional[Callable[[], None]] = None, +) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]: + """Return local plane-stress/shear matrices and material-axis transforms.""" + + symmetry = _elastic_symmetry(material, post_observation) + # Preserve the legacy isotropic arithmetic exactly. Forming and reducing + # the 3-D compliance is mathematically equivalent, but its final-bit + # roundoff can perturb tightly qualified eigenvalue thresholds. External + # protocol objects without the historical scalar fields still use the + # compliance path below. + raw_elastic_modulus = _guarded_observe_attribute( + material, + "elastic_modulus", + default=_OBSERVATION_MISSING, + post_observation=post_observation, + ) + raw_poisson_ratio = _guarded_observe_attribute( + material, + "poisson_ratio", + default=_OBSERVATION_MISSING, + post_observation=post_observation, + ) + if ( + symmetry == "isotropic" + and raw_elastic_modulus is not _OBSERVATION_MISSING + and raw_poisson_ratio is not _OBSERVATION_MISSING + ): + E = _guarded_float( + raw_elastic_modulus, + post_observation=post_observation, + ) + nu = _guarded_float( + raw_poisson_ratio, + post_observation=post_observation, + ) + raw_shear_modulus = _guarded_observe_attribute( + material, + "shear_modulus", + default=E / (2.0 * (1.0 + nu)), + post_observation=post_observation, + ) + G = _guarded_float( + raw_shear_modulus, + post_observation=post_observation, + ) + Q_material = E / (1.0 - nu**2) * np.array( + [ + [1.0, nu, 0.0], + [nu, 1.0, 0.0], + [0.0, 0.0, (1.0 - nu) / 2.0], + ], + dtype=float, + ) + return ( + Q_material, + G * np.eye(2, dtype=float), + np.eye(3, dtype=float), + np.eye(3, dtype=float), + ) + + compliance = _elastic_compliance(material, post_observation) + membrane_indices = np.array([0, 1, 5], dtype=np.intp) + shear_indices = np.array([4, 3], dtype=np.intp) # [13, 23] + Q_material = np.linalg.inv(compliance[np.ix_(membrane_indices, membrane_indices)]) + G_material = np.linalg.inv(compliance[np.ix_(shear_indices, shear_indices)]) + strain_to_material, stress_to_local, axes = _in_plane_transform_matrices(angle_rad) + Q_local = stress_to_local @ Q_material @ strain_to_material + G_local = axes @ G_material @ axes.T + return ( + 0.5 * (Q_local + Q_local.T), + 0.5 * (G_local + G_local.T), + strain_to_material, + stress_to_local, + ) + + +def _beam_material_properties(material: Any, cross_section: Dict[str, Any]) -> Tuple[float, float, float, float]: + """Return E1, G12, G13 and torsional rigidity for a beam.""" + + properties = _canonical_beam_material_properties(material) + E1 = float(properties.axial_modulus) + G12 = float(properties.shear_modulus_xy) + G13 = float(properties.shear_modulus_xz) + if _elastic_symmetry(material) == "orthotropic": + value = cross_section.get("torsional_rigidity") + try: + torsional_rigidity = float(value) + except (TypeError, ValueError): + torsional_rigidity = float("nan") + if not np.isfinite(torsional_rigidity) or torsional_rigidity <= 0.0: + raise ValueError( + "Orthotropic beam sections require a positive " + "cross_section['torsional_rigidity'] in N*m^2." + ) + else: + torsional_rigidity = G12 * float(cross_section.get("J", 1.0e-8)) + return E1, G12, G13, torsional_rigidity + + +def _beam2_basic_deformation_matrix(length: float) -> np.ndarray: + """Map local Beam2 DOFs to six work-conjugate basic deformations.""" + + L = float(length) + transform = np.zeros((6, 12), dtype=float) + # Axial extension and torsional rotation. + transform[0, 0], transform[0, 6] = -1.0, 1.0 + transform[1, 3], transform[1, 9] = -1.0, 1.0 + # Bending about y: rotations relative to the rigid chord rotation + # ry + (w2-w1)/L. + transform[2, 2], transform[2, 8], transform[2, 4] = ( + -1.0 / L, + 1.0 / L, + 1.0, + ) + transform[3, 2], transform[3, 8], transform[3, 10] = ( + -1.0 / L, + 1.0 / L, + 1.0, + ) + # Bending about z: rotations relative to the rigid chord rotation + # rz - (v2-v1)/L. + transform[4, 1], transform[4, 7], transform[4, 5] = ( + 1.0 / L, + -1.0 / L, + 1.0, + ) + transform[5, 1], transform[5, 7], transform[5, 11] = ( + 1.0 / L, + -1.0 / L, + 1.0, + ) + return transform + + +def _beam2_force_interpolation(length: float, xi: float) -> np.ndarray: + """Map Beam2 basic forces to equilibrium section resultants.""" + + L = float(length) + x_over_length = 0.5 * (float(xi) + 1.0) + interpolation = np.zeros((6, 6), dtype=float) + interpolation[0, 0] = 1.0 # N + interpolation[3, 1] = 1.0 # T + # q[2:4] are the two basic local-y bending rotations. + interpolation[2, 2:4] = 1.0 / L # Vz + interpolation[4, 2] = -1.0 + x_over_length # My + interpolation[4, 3] = x_over_length + # q[4:6] are the two basic local-z bending rotations. The sign of Vy + # follows gamma_xy = v' - rz. + interpolation[1, 4:6] = -1.0 / L # Vy + interpolation[5, 4] = -1.0 + x_over_length # Mz + interpolation[5, 5] = x_over_length + return interpolation + + +def _beam2_generalized_flexibility( + length: float, + section_stiffness: np.ndarray, +) -> Tuple[np.ndarray, np.ndarray]: + """Return exact constant-section basic flexibility and stiffness.""" + + L = float(length) + compliance = np.linalg.inv(np.asarray(section_stiffness, dtype=float)) + flexibility = np.zeros((6, 6), dtype=float) + points = (-np.sqrt(3.0 / 5.0), 0.0, np.sqrt(3.0 / 5.0)) + weights = (5.0 / 9.0, 8.0 / 9.0, 5.0 / 9.0) + for xi, weight in zip(points, weights): + interpolation = _beam2_force_interpolation(L, xi) + flexibility += ( + interpolation.T + @ compliance + @ interpolation + * (L / 2.0 * weight) + ) + return flexibility, np.linalg.inv(flexibility) + + +def _beam_generalized_strain_matrix_from_shape( + shape_functions: np.ndarray, + shape_derivatives: np.ndarray, +) -> np.ndarray: + """Build a generalized beam B-matrix from compatible shape functions.""" + + N = np.asarray(shape_functions, dtype=float).reshape(-1) + derivative = np.asarray(shape_derivatives, dtype=float).reshape(-1) + if derivative.size != N.size: + raise ValueError("beam shape function and derivative sizes must match") + B = np.zeros((6, 6 * N.size), dtype=float) + for i in range(N.size): + base = 6 * i + B[0, base + 0] = derivative[i] # eps_x + B[1, base + 1] = derivative[i] # gamma_xy = v' - rz + B[1, base + 5] = -N[i] + B[2, base + 2] = derivative[i] # gamma_xz = w' + ry + B[2, base + 4] = N[i] + B[3, base + 3] = derivative[i] # kappa_x + B[4, base + 4] = derivative[i] # kappa_y + B[5, base + 5] = derivative[i] # kappa_z + return B + + +def _generalized_beam_recovery( + strains: np.ndarray, + resultants: np.ndarray, + *, + stations: Optional[np.ndarray] = None, +) -> Dict[str, Any]: + """Build resultants-only recovery without inventing physical stresses.""" + + strain_values = np.asarray(strains, dtype=float) + resultant_values = np.asarray(resultants, dtype=float) + recovered: Dict[str, Any] = { + "generalized_strain": strain_values.copy(), + "generalized_resultant": resultant_values.copy(), + "generalized_strain_order": GENERALIZED_BEAM_STRAIN_ORDER, + "generalized_resultant_order": GENERALIZED_BEAM_RESULTANT_ORDER, + "recovery_scope": "section_resultants_only", + "physical_stress_available": False, + "resultant_frame": "beam_local", + "station_coordinate_system": "natural_xi", + } + for index, key in enumerate(GENERALIZED_BEAM_STRAIN_ORDER): + recovered[key] = ( + float(strain_values[index]) + if strain_values.ndim == 1 + else strain_values[:, index].copy() + ) + for index, key in enumerate(GENERALIZED_BEAM_RESULTANT_ORDER): + recovered[key] = ( + float(resultant_values[index]) + if resultant_values.ndim == 1 + else resultant_values[:, index].copy() + ) + descriptive_strains = ( + "axial_strain", + "shear_strain_xy", + "shear_strain_xz", + "twist_rate", + "curvature_y", + "curvature_z", + ) + descriptive_resultants = ( + "axial_force", + "shear_force_y", + "shear_force_z", + "torsional_moment", + "bending_moment_y", + "bending_moment_z", + ) + for index, key in enumerate(descriptive_strains): + recovered[key] = ( + float(strain_values[index]) + if strain_values.ndim == 1 + else strain_values[:, index].copy() + ) + for index, key in enumerate(descriptive_resultants): + recovered[key] = ( + float(resultant_values[index]) + if resultant_values.ndim == 1 + else resultant_values[:, index].copy() + ) + if stations is not None: + recovered["station_coordinates"] = np.asarray( + stations, + dtype=float, + ).copy() + return recovered + + +def _beam_flow_scale(material: Any, curve: Any) -> float: + """Scale a scalar hardening curve to the Hill longitudinal strength X. + + With no curve, the returned value is the constant perfect-plastic flow + stress. Otherwise it multiplies the curve so ``flow_stress(0) == X``. + """ + + if _elastic_symmetry(material) != "orthotropic": + return 1.0 + hill_yield = getattr(material, "hill_yield", None) + if hill_yield is None: + raise ValueError( + f"Orthotropic material {getattr(material, 'name', '')!r} " + "requires hill_yield for beam fiber plasticity." + ) + if curve is None: + return float(hill_yield.X) + reference = float(np.asarray(curve.flow_stress(np.array([0.0])), dtype=float)[0]) + if not np.isfinite(reference) or reference <= 0.0: + raise ValueError("hardening curve must provide a positive initial flow stress") + return float(hill_yield.X) / reference + + +def _rotation_vector_from_matrix(rotation: np.ndarray) -> np.ndarray: + """Return the axis-angle rotation vector for a proper 3x3 rotation matrix.""" + R = np.asarray(rotation, dtype=float).reshape(3, 3) + trace_value = float(np.trace(R)) + cos_angle = max(min((trace_value - 1.0) / 2.0, 1.0), -1.0) + angle = float(np.arccos(cos_angle)) + if angle < 1.0e-12: + return 0.5 * np.array( + [R[2, 1] - R[1, 2], R[0, 2] - R[2, 0], R[1, 0] - R[0, 1]], + dtype=float, + ) + if abs(np.pi - angle) < 1.0e-6: + axis = np.sqrt(np.maximum(np.diag(R) + 1.0, 0.0) / 2.0) + if R[2, 1] - R[1, 2] < 0.0: + axis[0] *= -1.0 + if R[0, 2] - R[2, 0] < 0.0: + axis[1] *= -1.0 + if R[1, 0] - R[0, 1] < 0.0: + axis[2] *= -1.0 + norm = float(np.linalg.norm(axis)) + if norm <= _SMALL: + return np.zeros(3, dtype=float) + return angle * axis / norm + axis = np.array( + [R[2, 1] - R[1, 2], R[0, 2] - R[2, 0], R[1, 0] - R[0, 1]], + dtype=float, + ) / (2.0 * np.sin(angle)) + return angle * axis + + +_STRICT_FLAT_S3_V2_CANDIDATE_ID = "CANDIDATE_E4_PL_S3_V2A_FLAT_LINEAR_V1" +_STRICT_FLAT_S3_V2B_CANDIDATE_ID = "CANDIDATE_E4_PL_S3_V2B_FLAT_LINEAR_V1" +_STRICT_FLAT_S3_V2C_CANDIDATE_ID = "CANDIDATE_E4_PL_S3_V2C_FLAT_LINEAR_PARITY_V1" +_S3_V2D_NATIVE_PARITY_CANDIDATE_ID = "CANDIDATE_E4_PL_S3_V2D_NATIVE_PARITY_V1" + + +def _reject_strict_flat_s3_v2_legacy_dispatch( + element: Any, operation: str +) -> None: + if ( + getattr(type(element), "_legacy_shell_dispatch_forbidden", None) + in { + _STRICT_FLAT_S3_V2_CANDIDATE_ID, + _STRICT_FLAT_S3_V2B_CANDIDATE_ID, + _STRICT_FLAT_S3_V2C_CANDIDATE_ID, + _S3_V2D_NATIVE_PARITY_CANDIDATE_ID, + } + ): + from .element_capabilities import ElementCapabilityError + + raise ElementCapabilityError( + "strict-flat S3 V2 forbids explicit legacy ShellElement dispatch: " + + operation + ) + + +class Element(ABC): + """Abstract base class for all FE elements.""" + + def __init__(self, element_id: int, node_ids: List[int], material_name: str = "default"): + self.element_id = element_id + self.node_ids = node_ids + self.material_name = material_name + self._stiffness_matrix: Optional[np.ndarray] = None + self._mass_matrix: Optional[np.ndarray] = None + self._internal_forces: Optional[np.ndarray] = None + + def __deepcopy__(self, memo: Dict[int, Any]) -> "Element": + """Copy instance state without asking ``copyreg`` about the class. + + The generic ``copy.deepcopy`` reconstruction path may lazily add a + ``__slotnames__`` cache to a class. Element class namespaces are part + of the qualified Q4/S3 runtime authority, so even copying a legacy + element must not mutate them. Build the uninitialised instance + directly, copy its instance dictionary, and explicitly copy any slots + declared anywhere in a concrete subclass hierarchy. + """ + + _reject_strict_flat_s3_v2_legacy_dispatch(self, "Element.__deepcopy__") + source_id = id(self) + if source_id in memo: + return memo[source_id] + + cls = type(self) + made = object.__new__(cls) + memo[source_id] = made + + try: + source_namespace = object.__getattribute__(self, "__dict__") + target_namespace = object.__getattribute__(made, "__dict__") + except AttributeError: + source_namespace = None + target_namespace = None + if source_namespace is not None and target_namespace is not None: + for name, value in source_namespace.items(): + target_namespace[name] = copy.deepcopy(value, memo) + + for owner in type.__getattribute__(cls, "__mro__"): + namespace = type.__getattribute__(owner, "__dict__") + for slot_name, descriptor in namespace.items(): + if type(descriptor) is not MemberDescriptorType: + continue + try: + value = object.__getattribute__(self, slot_name) + except AttributeError: + continue + object.__setattr__(made, slot_name, copy.deepcopy(value, memo)) + return made + + @property + @abstractmethod + def num_nodes(self) -> int: + raise NotImplementedError + + @property + @abstractmethod + def dofs_per_node(self) -> int: + raise NotImplementedError + + @property + def total_dofs(self) -> int: + return self.num_nodes * self.dofs_per_node + + @abstractmethod + def get_node_coordinates(self, mesh: "FEMesh") -> np.ndarray: + raise NotImplementedError + + @abstractmethod + def compute_stiffness_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: + raise NotImplementedError + + def compute_mass_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: + _reject_strict_flat_s3_v2_legacy_dispatch(self, "Element.compute_mass_matrix") + return np.zeros((self.total_dofs, self.total_dofs)) + + def compute_geometric_stiffness_matrix( + self, + mesh: "FEMesh", + material: "Material", + state: Optional[Any] = None, + ) -> np.ndarray: + _reject_strict_flat_s3_v2_legacy_dispatch( + self, "Element.compute_geometric_stiffness_matrix" + ) + return np.zeros((self.total_dofs, self.total_dofs)) + + def compute_internal_forces( + self, mesh: "FEMesh", displacements: np.ndarray, material: "Material" + ) -> np.ndarray: + _reject_strict_flat_s3_v2_legacy_dispatch( + self, "Element.compute_internal_forces" + ) + return np.zeros(self.total_dofs) + + def compute_nonlinear_response( + self, + mesh: "FEMesh", + material: "Material", + u_elem: np.ndarray, + state: Optional[Any] = None, + num_layers: int = 5, + tangent: bool = True, + ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: + """Internal force vector, tangent stiffness and trial state at u_elem. + + The default is linear elastic: F = K u with the constant stiffness as + tangent. Elements supporting geometric and/or material nonlinearity + override this. The returned state is a trial state; the incremental + solver commits it only when the load step converges. With + ``tangent=False`` the stiffness entry may be None (used by the line + search, which only needs residuals). + """ + _reject_strict_flat_s3_v2_legacy_dispatch( + self, "Element.compute_nonlinear_response" + ) + K = self._stiffness_matrix + if K is None: + K = self.compute_stiffness_matrix(mesh, material) + return K @ u_elem, (K if tangent else None), state + + def compute_stresses( + self, + mesh: "FEMesh", + displacements: np.ndarray, + material: "Material", + return_global: bool = False, + ) -> Dict[str, Any]: + _reject_strict_flat_s3_v2_legacy_dispatch(self, "Element.compute_stresses") + return {} + + def get_dof_mapping(self, mesh: "FEMesh") -> List[int]: + dof_mapping: List[int] = [] + for node_id in self.node_ids: + node = mesh.get_node(node_id) + if node: + dof_mapping.extend(node.dofs) + return dof_mapping + + def _get_element_displacements(self, mesh: "FEMesh", displacements: np.ndarray) -> np.ndarray: + u = np.asarray(displacements, dtype=float) + if u.size == self.total_dofs: + return u.copy() + dof_mapping = self.get_dof_mapping(mesh) + if not dof_mapping: + return np.zeros(self.total_dofs) + dof_indices = np.asarray(dof_mapping, dtype=np.intp) + if int(dof_indices.max()) >= u.size: + raise IndexError( + f"Displacement vector has length {u.size}, but element {self.element_id} " + f"requires global DOF {int(dof_indices.max())}." + ) + return u[dof_indices] + + def to_dict(self) -> Dict[str, Any]: + _reject_strict_flat_s3_v2_legacy_dispatch(self, "Element.to_dict") + return { + "element_id": self.element_id, + "type": self.__class__.__name__, + "node_ids": self.node_ids, + "material_name": self.material_name, + } + + +def _install_strict_flat_s3_v2_element_base_guards() -> None: + """Capture the V2 guard in Element routes exposed by explicit dispatch.""" + + from functools import wraps + from inspect import signature + + guard = _reject_strict_flat_s3_v2_legacy_dispatch + names = ( + "__deepcopy__", + "compute_mass_matrix", + "compute_geometric_stiffness_matrix", + "compute_internal_forces", + "compute_nonlinear_response", + "compute_stresses", + "to_dict", + ) + for name in names: + original = vars(Element)[name] + + @wraps(original) + def guarded( + self: Any, + *args: Any, + __name: str = name, + __original: Callable[..., Any] = original, + __guard: Callable[[Any, str], None] = guard, + **kwargs: Any, + ) -> Any: + __guard(self, f"Element.{__name}") + return __original(self, *args, **kwargs) + + guarded.__signature__ = signature(original) # type: ignore[attr-defined] + delattr(guarded, "__wrapped__") + setattr(Element, name, guarded) + + +_install_strict_flat_s3_v2_element_base_guards() +del _install_strict_flat_s3_v2_element_base_guards + + +@njit +def _jit_compute_4node_shape_functions(xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + N = np.array( + [ + 0.25 * (1.0 - xi) * (1.0 - eta), + 0.25 * (1.0 + xi) * (1.0 - eta), + 0.25 * (1.0 + xi) * (1.0 + eta), + 0.25 * (1.0 - xi) * (1.0 + eta), + ], + ) + dN_dxi = np.array( + [ + -0.25 * (1.0 - eta), + 0.25 * (1.0 - eta), + 0.25 * (1.0 + eta), + -0.25 * (1.0 + eta), + ], + ) + dN_deta = np.array( + [ + -0.25 * (1.0 - xi), + -0.25 * (1.0 + xi), + 0.25 * (1.0 + xi), + 0.25 * (1.0 - xi), + ], + ) + return N, dN_dxi, dN_deta + + +@njit +def _jit_compute_8node_shape_functions(xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + N = np.zeros(8, dtype=float) + N[0] = -0.25 * (1.0 - xi) * (1.0 - eta) * (1.0 + xi + eta) + N[1] = -0.25 * (1.0 + xi) * (1.0 - eta) * (1.0 - xi + eta) + N[2] = -0.25 * (1.0 + xi) * (1.0 + eta) * (1.0 - xi - eta) + N[3] = -0.25 * (1.0 - xi) * (1.0 + eta) * (1.0 + xi - eta) + N[4] = 0.5 * (1.0 - xi**2) * (1.0 - eta) + N[5] = 0.5 * (1.0 + xi) * (1.0 - eta**2) + N[6] = 0.5 * (1.0 - xi**2) * (1.0 + eta) + N[7] = 0.5 * (1.0 - xi) * (1.0 - eta**2) + + dN_dxi = np.zeros(8, dtype=float) + dN_dxi[0] = 0.25 * (1.0 - eta) * (1.0 + xi + eta) - 0.25 * (1.0 - xi) * (1.0 - eta) + dN_dxi[1] = -0.25 * (1.0 - eta) * (1.0 - xi + eta) + 0.25 * (1.0 + xi) * (1.0 - eta) + dN_dxi[2] = -0.25 * (1.0 + eta) * (1.0 - xi - eta) + 0.25 * (1.0 + xi) * (1.0 + eta) + dN_dxi[3] = 0.25 * (1.0 + eta) * (1.0 + xi - eta) - 0.25 * (1.0 - xi) * (1.0 + eta) + dN_dxi[4] = -xi * (1.0 - eta) + dN_dxi[5] = 0.5 * (1.0 - eta**2) + dN_dxi[6] = -xi * (1.0 + eta) + dN_dxi[7] = -0.5 * (1.0 - eta**2) + + dN_deta = np.zeros(8, dtype=float) + dN_deta[0] = 0.25 * (1.0 - xi) * (1.0 + xi + eta) - 0.25 * (1.0 - xi) * (1.0 - eta) + dN_deta[1] = 0.25 * (1.0 + xi) * (1.0 - xi + eta) - 0.25 * (1.0 + xi) * (1.0 - eta) + dN_deta[2] = -0.25 * (1.0 + xi) * (1.0 - xi - eta) + 0.25 * (1.0 + xi) * (1.0 + eta) + dN_deta[3] = -0.25 * (1.0 - xi) * (1.0 + xi - eta) + 0.25 * (1.0 - xi) * (1.0 + eta) + dN_deta[4] = -0.5 * (1.0 - xi**2) + dN_deta[5] = -eta * (1.0 + xi) + dN_deta[6] = 0.5 * (1.0 - xi**2) + dN_deta[7] = -eta * (1.0 - xi) + return N, dN_dxi, dN_deta + + +@njit +def _jit_compute_3node_shape_functions(r: float, s: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + N = np.array([1.0 - r - s, r, s]) + dN_dr = np.array([-1.0, 1.0, 0.0]) + dN_ds = np.array([-1.0, 0.0, 1.0]) + return N, dN_dr, dN_ds + + +@njit +def _jit_compute_6node_shape_functions(r: float, s: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + l1 = 1.0 - r - s + l2 = r + l3 = s + + N = np.zeros(6, dtype=float) + N[0] = l1 * (2.0 * l1 - 1.0) + N[1] = l2 * (2.0 * l2 - 1.0) + N[2] = l3 * (2.0 * l3 - 1.0) + N[3] = 4.0 * l1 * l2 + N[4] = 4.0 * l2 * l3 + N[5] = 4.0 * l3 * l1 + + dN_dr = np.zeros(6, dtype=float) + dN_dr[0] = 1.0 - 4.0 * l1 + dN_dr[1] = 4.0 * l2 - 1.0 + dN_dr[2] = 0.0 + dN_dr[3] = 4.0 * (l1 - l2) + dN_dr[4] = 4.0 * l3 + dN_dr[5] = -4.0 * l3 + + dN_ds = np.zeros(6, dtype=float) + dN_ds[0] = 1.0 - 4.0 * l1 + dN_ds[1] = 0.0 + dN_ds[2] = 4.0 * l3 - 1.0 + dN_ds[3] = -4.0 * l2 + dN_ds[4] = 4.0 * l2 + dN_ds[5] = 4.0 * (l1 - l3) + return N, dN_dr, dN_ds + + +@njit +def _jit_integrate_nonlinear_response( + u_loc: np.ndarray, + N_res: np.ndarray, + M_res: np.ndarray, + C0: np.ndarray, + C1: np.ndarray, + C2: np.ndarray, + B_m_all: np.ndarray, + B_b_all: np.ndarray, + B_d_all: np.ndarray, + Gw_all: np.ndarray, + detw_all: np.ndarray, + B_s_all: np.ndarray, + detw_shear_all: np.ndarray, + D_shear: np.ndarray, + drilling_stiffness: float, + tangent: bool, + has_plasticity: bool, + n_dof: int, +) -> Tuple[np.ndarray, np.ndarray]: + F_loc = np.zeros(n_dof) + K_loc = np.zeros((n_dof, n_dof)) + + n_gp = len(detw_all) + for g in range(n_gp): + detw = detw_all[g] + B_m = B_m_all[g] + B_b = B_b_all[g] + B_d = B_d_all[g] + Gw = Gw_all[g] + + # Calculate theta = Gw @ u_loc + theta_0 = 0.0 + theta_1 = 0.0 + for i in range(n_dof): + theta_0 += Gw[0, i] * u_loc[i] + theta_1 += Gw[1, i] * u_loc[i] + + # Calculate B_eff = B_m + B_nl + B_eff = np.zeros((3, n_dof)) + for i in range(n_dof): + B_eff[0, i] = B_m[0, i] + theta_0 * Gw[0, i] + B_eff[1, i] = B_m[1, i] + theta_1 * Gw[1, i] + B_eff[2, i] = B_m[2, i] + theta_0 * Gw[1, i] + theta_1 * Gw[0, i] + + # B_eff.T @ N_res[g] + B_b.T @ M_res[g] + N_g = N_res[g] + M_g = M_res[g] + B_eff_T_N = np.zeros(n_dof) + B_b_T_M = np.zeros(n_dof) + for i in range(n_dof): + B_eff_T_N[i] = B_eff[0, i] * N_g[0] + B_eff[1, i] * N_g[1] + B_eff[2, i] * N_g[2] + B_b_T_M[i] = B_b[0, i] * M_g[0] + B_b[1, i] * M_g[1] + B_b[2, i] * M_g[2] + + # B_d @ u_loc + Bd_u = 0.0 + for i in range(n_dof): + Bd_u += B_d[0, i] * u_loc[i] + + for i in range(n_dof): + F_loc[i] += (B_eff_T_N[i] + B_b_T_M[i]) * detw + F_loc[i] += B_d[0, i] * (drilling_stiffness * Bd_u) * detw + + if not tangent: + continue + + # K_loc += (B_eff.T @ C0[g] @ B_eff + B_b.T @ C2[g] @ B_b) * detw + C0_g = C0[g] + C2_g = C2[g] + + C0_B_eff = np.zeros((3, n_dof)) + C2_B_b = np.zeros((3, n_dof)) + for r in range(3): + for c in range(n_dof): + val0 = 0.0 + val2 = 0.0 + for k in range(3): + val0 += C0_g[r, k] * B_eff[k, c] + val2 += C2_g[r, k] * B_b[k, c] + C0_B_eff[r, c] = val0 + C2_B_b[r, c] = val2 + + for r in range(n_dof): + for c in range(n_dof): + val_eff = 0.0 + val_b = 0.0 + for k in range(3): + val_eff += B_eff[k, r] * C0_B_eff[k, c] + val_b += B_b[k, r] * C2_B_b[k, c] + K_loc[r, c] += (val_eff + val_b) * detw + + if has_plasticity: + # Membrane-bending coupling: + # B_eff.T @ C1 @ B_b + B_b.T @ C1.T @ B_eff. + # Layered material tangents make C1 symmetric, while a general + # pre-integrated section may legitimately supply a non-symmetric + # B coupling block in the symmetric [[A, B], [B.T, D]] law. + C1_g = C1[g] + C1_B_b = np.zeros((3, n_dof)) + C1_T_B_eff = np.zeros((3, n_dof)) + for r in range(3): + for c in range(n_dof): + val_b = 0.0 + val_eff = 0.0 + for k in range(3): + val_b += C1_g[r, k] * B_b[k, c] + val_eff += C1_g[k, r] * B_eff[k, c] + C1_B_b[r, c] = val_b + C1_T_B_eff[r, c] = val_eff + + for r in range(n_dof): + for c in range(n_dof): + forward = 0.0 + reverse = 0.0 + for k in range(3): + forward += B_eff[k, r] * C1_B_b[k, c] + reverse += B_b[k, r] * C1_T_B_eff[k, c] + K_loc[r, c] += (forward + reverse) * detw + + # Geometric initial stress stiffness + N00 = N_g[0] + N11 = N_g[1] + N01 = N_g[2] + + N_Gw_0 = N00 * Gw[0] + N01 * Gw[1] + N_Gw_1 = N01 * Gw[0] + N11 * Gw[1] + for r in range(n_dof): + for c in range(n_dof): + K_loc[r, c] += (Gw[0, r] * N_Gw_0[c] + Gw[1, r] * N_Gw_1[c]) * detw + K_loc[r, c] += B_d[0, r] * (drilling_stiffness * B_d[0, c]) * detw + + # Shear stiffness and force contribution + for g in range(len(detw_shear_all)): + detw_s = detw_shear_all[g] + B_s = B_s_all[g] + + # F_loc += K_s @ u_loc + Bs_u_0 = 0.0 + Bs_u_1 = 0.0 + for i in range(n_dof): + Bs_u_0 += B_s[0, i] * u_loc[i] + Bs_u_1 += B_s[1, i] * u_loc[i] + + f_s_0 = D_shear[0, 0] * Bs_u_0 + D_shear[0, 1] * Bs_u_1 + f_s_1 = D_shear[1, 0] * Bs_u_0 + D_shear[1, 1] * Bs_u_1 + + for i in range(n_dof): + F_loc[i] += (B_s[0, i] * f_s_0 + B_s[1, i] * f_s_1) * detw_s + + if not tangent: + continue + + # K_loc += K_s + C_s = np.zeros((2, n_dof)) + for r in range(2): + for c in range(n_dof): + C_s[r, c] = D_shear[r, 0] * B_s[0, c] + D_shear[r, 1] * B_s[1, c] + + for r in range(n_dof): + for c in range(n_dof): + K_loc[r, c] += (B_s[0, r] * C_s[0, c] + B_s[1, r] * C_s[1, c]) * detw_s + + return F_loc, K_loc + + +def _integrate_nonlinear_tangent_components( + u_loc: np.ndarray, + N_res: np.ndarray, + M_res: np.ndarray, + C0: np.ndarray, + C1: np.ndarray, + C2: np.ndarray, + B_m_all: np.ndarray, + B_b_all: np.ndarray, + B_d_all: np.ndarray, + Gw_all: np.ndarray, + detw_all: np.ndarray, + B_s_all: np.ndarray, + detw_shear_all: np.ndarray, + D_shear: np.ndarray, + drilling_stiffness: float, + has_membrane_bending_coupling: bool, + n_dof: int, +) -> Tuple[np.ndarray, np.ndarray]: + """Integrate constitutive and stress-Hessian tangents independently. + + The two calls deliberately reuse :func:`_jit_integrate_nonlinear_response` + rather than recovering one component as ``total - other``. The material + call carries the exact current algorithmic moduli, transverse shear and + drilling terms with zero resultants. The geometric call carries the exact + tension-positive membrane resultants with every constitutive/numerical + modulus set to zero. Consequently both pieces use the same Gauss order, + von-Karman ``B_eff`` construction and arithmetic kernel as the ordinary + nonlinear tangent. + """ + + zero_resultants = np.zeros_like(np.asarray(N_res, dtype=float)) + _unused_force, material = _jit_integrate_nonlinear_response( + np.asarray(u_loc, dtype=float), + zero_resultants, + np.zeros_like(np.asarray(M_res, dtype=float)), + np.asarray(C0, dtype=float), + np.asarray(C1, dtype=float), + np.asarray(C2, dtype=float), + np.asarray(B_m_all, dtype=float), + np.asarray(B_b_all, dtype=float), + np.asarray(B_d_all, dtype=float), + np.asarray(Gw_all, dtype=float), + np.asarray(detw_all, dtype=float), + np.asarray(B_s_all, dtype=float), + np.asarray(detw_shear_all, dtype=float), + np.asarray(D_shear, dtype=float), + float(drilling_stiffness), + True, + bool(has_membrane_bending_coupling), + int(n_dof), + ) + zero_C0 = np.zeros_like(np.asarray(C0, dtype=float)) + zero_C1 = np.zeros_like(np.asarray(C1, dtype=float)) + zero_C2 = np.zeros_like(np.asarray(C2, dtype=float)) + zero_shear = np.zeros_like(np.asarray(D_shear, dtype=float)) + _unused_force, geometric = _jit_integrate_nonlinear_response( + np.asarray(u_loc, dtype=float), + np.asarray(N_res, dtype=float), + np.asarray(M_res, dtype=float), + zero_C0, + zero_C1, + zero_C2, + np.asarray(B_m_all, dtype=float), + np.asarray(B_b_all, dtype=float), + np.asarray(B_d_all, dtype=float), + np.asarray(Gw_all, dtype=float), + np.asarray(detw_all, dtype=float), + np.asarray(B_s_all, dtype=float), + np.asarray(detw_shear_all, dtype=float), + zero_shear, + 0.0, + True, + False, + int(n_dof), + ) + return material, geometric + + +class ShellElement(Element): + """3/6-node triangular and 4/8-node quadrilateral Mindlin-Reissner shell element.""" + + TRI_GAUSS_POINTS_1 = _immutable_float64_array( + [[1.0 / 3.0, 1.0 / 3.0]] + ) + TRI_GAUSS_WEIGHTS_1 = _immutable_float64_array([0.5]) + + TRI_GAUSS_POINTS_3 = _immutable_float64_array( + [[1.0 / 6.0, 1.0 / 6.0], [2.0 / 3.0, 1.0 / 6.0], [1.0 / 6.0, 2.0 / 3.0]], + ) + TRI_GAUSS_WEIGHTS_3 = _immutable_float64_array( + [1.0 / 6.0, 1.0 / 6.0, 1.0 / 6.0] + ) + + _DUNAVANT_A1 = 0.059715871789770 + _DUNAVANT_B1 = 0.470142064105115 + _DUNAVANT_A2 = 0.797426985353087 + _DUNAVANT_B2 = 0.101286507323456 + TRI_GAUSS_POINTS_7 = _immutable_float64_array( + [ + [1.0 / 3.0, 1.0 / 3.0], + [_DUNAVANT_B1, _DUNAVANT_B1], + [_DUNAVANT_A1, _DUNAVANT_B1], + [_DUNAVANT_B1, _DUNAVANT_A1], + [_DUNAVANT_B2, _DUNAVANT_B2], + [_DUNAVANT_A2, _DUNAVANT_B2], + [_DUNAVANT_B2, _DUNAVANT_A2], + ], + ) + TRI_GAUSS_WEIGHTS_7 = _immutable_float64_array( + [ + 0.1125, + 0.066197076394253, + 0.066197076394253, + 0.066197076394253, + 0.062969590272414, + 0.062969590272414, + 0.062969590272414, + ], + ) + + GAUSS_POINTS_1x1 = _immutable_float64_array([[0.0, 0.0]]) + GAUSS_WEIGHTS_1x1 = _immutable_float64_array([4.0]) + + GAUSS_POINTS_2x2 = _immutable_float64_array( + np.asarray( + [[-1.0, -1.0], [1.0, -1.0], [-1.0, 1.0], [1.0, 1.0]], + dtype=np.float64, + ) + / np.sqrt(3.0) + ) + GAUSS_WEIGHTS_2x2 = _immutable_float64_array(np.ones(4, dtype=np.float64)) + + GAUSS_POINTS_3x3 = _immutable_float64_array( + [ + [-np.sqrt(3.0 / 5.0), -np.sqrt(3.0 / 5.0)], + [0.0, -np.sqrt(3.0 / 5.0)], + [np.sqrt(3.0 / 5.0), -np.sqrt(3.0 / 5.0)], + [-np.sqrt(3.0 / 5.0), 0.0], + [0.0, 0.0], + [np.sqrt(3.0 / 5.0), 0.0], + [-np.sqrt(3.0 / 5.0), np.sqrt(3.0 / 5.0)], + [0.0, np.sqrt(3.0 / 5.0)], + [np.sqrt(3.0 / 5.0), np.sqrt(3.0 / 5.0)], + ], + ) + GAUSS_WEIGHTS_3x3 = _immutable_float64_array( + [ + 25.0 / 81.0, + 40.0 / 81.0, + 25.0 / 81.0, + 40.0 / 81.0, + 64.0 / 81.0, + 40.0 / 81.0, + 25.0 / 81.0, + 40.0 / 81.0, + 25.0 / 81.0, + ], + ) + + def __init__( + self, + element_id: int, + node_ids: List[int], + material_name: str = "default", + thickness: float = 0.01, + drilling_stabilization: float = 1.0e-3, + reduced_integration: bool = False, + hourglass_stabilization: float = 1.0e-8, + material_direction: Optional[np.ndarray] = None, + material_angle_deg: float = 0.0, + shell_section: Optional[Any] = None, + ): + super().__init__(element_id, node_ids, material_name) + if len(set(node_ids)) != len(node_ids): + raise ValueError(f"Shell element {element_id} has repeated node ids") + if self.__class__ is ShellElement and len(node_ids) == 4: + warnings.warn( + "Legacy four-node ShellElement is a temporary rollback path; " + "use create_shell_element() or QualifiedE4PLShellElement. The " + "legacy Q4 implementation is available through the 0.4.x " + "burn-in line and is scheduled for removal no earlier than 0.5.0.", + LegacyQ4DeprecationWarning, + stacklevel=2, + ) + self.thickness = float(thickness) + self.drilling_stabilization = float(drilling_stabilization) + self.reduced_integration = reduced_integration + self.hourglass_stabilization = float(hourglass_stabilization) + self.material_angle_deg = float(material_angle_deg) + if not np.isfinite(self.material_angle_deg): + raise ValueError("material_angle_deg must be finite") + if material_direction is None: + self.material_direction = None + else: + direction = np.asarray(material_direction, dtype=float).reshape(-1) + if direction.size != 3 or not np.all(np.isfinite(direction)): + raise ValueError("material_direction must be a finite 3-vector") + if float(np.linalg.norm(direction)) <= _SMALL: + raise ValueError("material_direction must be non-zero") + self.material_direction = direction.copy() + self.shell_section = coerce_generalized_shell_section(shell_section) + self._is_3node = len(node_ids) == 3 + self._is_6node = len(node_ids) == 6 + self._is_8node = len(node_ids) == 8 + self._is_4node = len(node_ids) == 4 + self._is_triangular = self._is_3node or self._is_6node + self._is_quadrilateral = self._is_4node or self._is_8node + if not (self._is_triangular or self._is_quadrilateral): + raise ValueError(f"ShellElement requires 3, 4, 6 or 8 nodes, got {len(node_ids)}") + + def _material_angle(self, local_frame: np.ndarray) -> float: + """Material 1-axis angle in the supplied element-local frame.""" + + angle = np.deg2rad(self.material_angle_deg) + if self.material_direction is None: + return float(angle) + frame = np.asarray(local_frame, dtype=float).reshape(3, 3) + direction = np.asarray(self.material_direction, dtype=float) + components = np.array( + [float(np.dot(direction, frame[:, 0])), float(np.dot(direction, frame[:, 1]))], + dtype=float, + ) + norm = float(np.linalg.norm(components)) + if norm <= 1.0e-10 * max(float(np.linalg.norm(direction)), 1.0): + raise ValueError( + f"Shell element {self.element_id} material_direction is parallel to " + "the shell normal and cannot define an in-plane material axis." + ) + return float(np.arctan2(components[1], components[0]) + angle) + + def _generalized_section_in_frame( + self, + local_frame: np.ndarray, + ) -> Optional[GeneralizedShellSection]: + """Return the pre-integrated section rotated into shell-local axes.""" + + if self.shell_section is None: + return None + return self.shell_section.rotated(self._material_angle(local_frame)) + + def to_dict(self) -> Dict[str, Any]: + payload = super().to_dict() + payload.update( + { + "thickness": float(self.thickness), + "material_angle_deg": float(self.material_angle_deg), + "material_direction": ( + None + if self.material_direction is None + else np.asarray(self.material_direction, dtype=float).tolist() + ), + "shell_section": ( + None if self.shell_section is None else self.shell_section.to_dict() + ), + } + ) + return payload + + @property + def num_nodes(self) -> int: + return len(self.node_ids) + + @property + def dofs_per_node(self) -> int: + return 6 + + @property + def gauss_points(self) -> np.ndarray: + if self._is_3node: + return self.TRI_GAUSS_POINTS_3 + if self._is_6node: + return self.TRI_GAUSS_POINTS_7 + if self._is_8node and self.reduced_integration: + return self.GAUSS_POINTS_2x2 + return self.GAUSS_POINTS_3x3 if self._is_8node else self.GAUSS_POINTS_2x2 + + @property + def gauss_weights(self) -> np.ndarray: + if self._is_3node: + return self.TRI_GAUSS_WEIGHTS_3 + if self._is_6node: + return self.TRI_GAUSS_WEIGHTS_7 + if self._is_8node and self.reduced_integration: + return self.GAUSS_WEIGHTS_2x2 + return self.GAUSS_WEIGHTS_3x3 if self._is_8node else self.GAUSS_WEIGHTS_2x2 + + @property + def shear_gauss_points(self) -> np.ndarray: + if self._is_3node: + return self.TRI_GAUSS_POINTS_1 + if self._is_6node: + return self.TRI_GAUSS_POINTS_3 + return self.GAUSS_POINTS_2x2 if self._is_8node else self.GAUSS_POINTS_1x1 + + @property + def shear_gauss_weights(self) -> np.ndarray: + if self._is_3node: + return self.TRI_GAUSS_WEIGHTS_1 + if self._is_6node: + return self.TRI_GAUSS_WEIGHTS_3 + return self.GAUSS_WEIGHTS_2x2 if self._is_8node else self.GAUSS_WEIGHTS_1x1 + + def get_node_coordinates(self, mesh: "FEMesh") -> np.ndarray: + coords = np.zeros((self.num_nodes, 3), dtype=float) + for i, node_id in enumerate(self.node_ids): + node = mesh.get_node(node_id) + if node is None: + raise ValueError(f"Shell element {self.element_id} references missing node {node_id}") + coords[i] = node.coords() + return coords + + def compute_shape_functions(self, xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + if self._is_3node: + return self._compute_3node_shape_functions(xi, eta) + if self._is_6node: + return self._compute_6node_shape_functions(xi, eta) + if self._is_4node: + return self._compute_4node_shape_functions(xi, eta) + return self._compute_8node_shape_functions(xi, eta) + + def _compute_3node_shape_functions(self, xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + return _jit_compute_3node_shape_functions(xi, eta) + + def _compute_4node_shape_functions(self, xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + return _jit_compute_4node_shape_functions(xi, eta) + + def _compute_6node_shape_functions(self, xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + return _jit_compute_6node_shape_functions(xi, eta) + + def _compute_8node_shape_functions(self, xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + return _jit_compute_8node_shape_functions(xi, eta) + + def compute_jacobian(self, coords: np.ndarray, dN_dxi: np.ndarray, dN_deta: np.ndarray) -> np.ndarray: + return np.array([coords.T @ dN_dxi, coords.T @ dN_deta], dtype=float) + + @staticmethod + def _normalize(vector: np.ndarray) -> Tuple[np.ndarray, float]: + norm = float(np.sqrt(vector @ vector)) + if norm < _SMALL: + return np.zeros(3, dtype=float), norm + return vector / norm, norm + + def _fallback_edge_direction(self, coords: np.ndarray, normal: np.ndarray) -> np.ndarray: + candidate_edges = [] + if coords.shape[0] >= 2: + candidate_edges.append(coords[1] - coords[0]) + if coords.shape[0] >= 3: + candidate_edges.append(coords[2] - coords[0]) + candidate_edges.append(coords[2] - coords[1]) + if coords.shape[0] >= 4: + candidate_edges.append(coords[2] - coords[3]) + candidate_edges.append(coords[3] - coords[0]) + candidate_edges.append(coords[2] - coords[1]) + for edge in candidate_edges: + projected = edge - np.dot(edge, normal) * normal + e1, n = self._normalize(projected) + if n > _SMALL: + return e1 + raise ValueError(f"Shell element {self.element_id} has no valid in-plane direction") + + def _local_frame_and_derivatives( + self, + coords: np.ndarray, + dN_dxi: np.ndarray, + dN_deta: np.ndarray, + ) -> Tuple[np.ndarray, np.ndarray, np.ndarray, float]: + J = self.compute_jacobian(coords, dN_dxi, dN_deta) + tangent_xi = J[0] + tangent_eta = J[1] + e3, det_j = self._normalize(_cross3(tangent_xi, tangent_eta)) + if det_j < _SMALL: + raise ValueError(f"Shell element {self.element_id} has a near-zero surface Jacobian") + + e1_raw = tangent_xi - np.dot(tangent_xi, e3) * e3 + e1, e1_norm = self._normalize(e1_raw) + if e1_norm < _SMALL: + e1 = self._fallback_edge_direction(coords, e3) + e2, e2_norm = self._normalize(_cross3(e3, e1)) + if e2_norm < _SMALL: + raise ValueError(f"Shell element {self.element_id} has an invalid local y direction") + e1, _ = self._normalize(_cross3(e2, e3)) + R = np.column_stack((e1, e2, e3)) + + J_local = np.array( + [ + [np.dot(tangent_xi, e1), np.dot(tangent_xi, e2)], + [np.dot(tangent_eta, e1), np.dot(tangent_eta, e2)], + ], + dtype=float, + ) + try: + inv_j_local, _ = _inv2(J_local) + except np.linalg.LinAlgError as exc: + raise ValueError(f"Shell element {self.element_id} has a singular local Jacobian") from exc + + dN_dx = inv_j_local[0, 0] * dN_dxi + inv_j_local[0, 1] * dN_deta + dN_dy = inv_j_local[1, 0] * dN_dxi + inv_j_local[1, 1] * dN_deta + return R, dN_dx, dN_dy, det_j + + def _local_dof_transform(self, R: np.ndarray) -> np.ndarray: + n_blocks = 2 * self.num_nodes + T = np.zeros((self.total_dofs, self.total_dofs), dtype=float) + blocks = T.reshape(n_blocks, 3, n_blocks, 3) + indices = np.arange(n_blocks) + blocks[indices, :, indices, :] = R.T + return T + + def _build_shell_b_matrices( + self, + N: np.ndarray, + dN_dx: np.ndarray, + dN_dy: np.ndarray, + ) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + B_m = np.zeros((3, self.total_dofs), dtype=float) + B_b = np.zeros((3, self.total_dofs), dtype=float) + B_s = np.zeros((2, self.total_dofs), dtype=float) + + B_m[0, 0::6] = dN_dx + B_m[1, 1::6] = dN_dy + B_m[2, 0::6] = dN_dy + B_m[2, 1::6] = dN_dx + + B_b[0, 4::6] = dN_dx + B_b[1, 3::6] = -dN_dy + B_b[2, 4::6] = dN_dy + B_b[2, 3::6] = -dN_dx + + B_s[0, 2::6] = dN_dx + B_s[0, 4::6] = N + B_s[1, 2::6] = dN_dy + B_s[1, 3::6] = -N + return B_m, B_b, B_s + + def _build_drilling_b_matrix( + self, + N: np.ndarray, + dN_dx: np.ndarray, + dN_dy: np.ndarray, + ) -> np.ndarray: + """ + Build a small drilling stabilization strain. + + The stabilized quantity is theta_z - 0.5 * (dv/dx - du/dy), so a + physical rigid rotation about the shell normal has exactly zero energy. + """ + B_d = np.zeros((1, self.total_dofs), dtype=float) + B_d[0, 0::6] = 0.5 * dN_dy + B_d[0, 1::6] = -0.5 * dN_dx + B_d[0, 5::6] = N + return B_d + + def _reference_center(self) -> Tuple[float, float]: + if self._is_triangular: + return 1.0 / 3.0, 1.0 / 3.0 + return 0.0, 0.0 + + # MITC4 assumed natural transverse shear (4-node elements only). + # + # Covariant shear strains are sampled where they are exact for pure + # bending, at the edge midpoints A(0,-1), B(1,0), C(0,1), D(-1,0): + # + # gamma_xi(xi, eta) = (1-eta)/2 * gamma_xi|A + (1+eta)/2 * gamma_xi|C + # gamma_eta(xi, eta) = (1-xi)/2 * gamma_eta|D + (1+xi)/2 * gamma_eta|B + # + # with gamma_xi = dw/dxi + x_,xi * theta_y - y_,xi * theta_x in a fixed + # element-plane frame, then mapped to Cartesian shear through the inverse + # in-plane Jacobian at the integration point. The element geometry is + # treated as a flat facet in the frame evaluated at the element centre. + _MITC4_SAMPLE_POINTS = {"A": (0.0, -1.0), "B": (1.0, 0.0), "C": (0.0, 1.0), "D": (-1.0, 0.0)} + + def _center_frame(self, coords: np.ndarray) -> np.ndarray: + xi, eta = self._reference_center() + _, dN_dxi, dN_deta = self.compute_shape_functions(xi, eta) + R, _, _, _ = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) + return R + + def _tri3_assumed_shear_b_matrix(self, coords: np.ndarray, R: np.ndarray) -> Tuple[np.ndarray, float]: + """ + Constant assumed-shear field for the 3-node triangle. + + The row space is evaluated in the centroid frame and integrated once + over the triangular area. This is the constant shear-gap part used by + DSG3/MITC3-style triangles: rigid rotations satisfy + ``dw/dx + theta_y = 0`` and ``dw/dy - theta_x = 0`` exactly, while a + constant transverse-shear patch is reproduced without the locking-prone + fully integrated linear Mindlin shear interpolation. + """ + if not self._is_3node: + raise ValueError("_tri3_assumed_shear_b_matrix is only valid for 3-node shells") + planar = coords @ R[:, :2] + r, s = self._reference_center() + N, dN_dr, dN_ds = self.compute_shape_functions(r, s) + J2 = np.array( + [ + [float(dN_dr @ planar[:, 0]), float(dN_dr @ planar[:, 1])], + [float(dN_ds @ planar[:, 0]), float(dN_ds @ planar[:, 1])], + ], + dtype=float, + ) + try: + inv_j2, det_j = _inv2(J2) + except np.linalg.LinAlgError as exc: + raise ValueError(f"Shell element {self.element_id} has a singular triangular shear Jacobian") from exc + dN_dx = inv_j2[0, 0] * dN_dr + inv_j2[0, 1] * dN_ds + dN_dy = inv_j2[1, 0] * dN_dr + inv_j2[1, 1] * dN_ds + _, _, B_s = self._build_shell_b_matrices(N, dN_dx, dN_dy) + return B_s, abs(float(det_j)) + + def _mitc4_shear_samples(self, coords: np.ndarray, R: np.ndarray) -> Tuple[np.ndarray, Dict[str, Tuple[np.ndarray, np.ndarray]]]: + """Return in-plane node coordinates and covariant shear rows at A-D.""" + planar = coords @ R[:, :2] + samples: Dict[str, Tuple[np.ndarray, np.ndarray]] = {} + for name, (xi, eta) in self._MITC4_SAMPLE_POINTS.items(): + N, dN_dxi, dN_deta = self.compute_shape_functions(xi, eta) + x_xi = float(dN_dxi @ planar[:, 0]) + y_xi = float(dN_dxi @ planar[:, 1]) + x_eta = float(dN_deta @ planar[:, 0]) + y_eta = float(dN_deta @ planar[:, 1]) + row_xi = np.zeros(self.total_dofs, dtype=float) + row_eta = np.zeros(self.total_dofs, dtype=float) + row_xi[2::6] = dN_dxi + row_xi[3::6] = -N * y_xi + row_xi[4::6] = N * x_xi + row_eta[2::6] = dN_deta + row_eta[3::6] = -N * y_eta + row_eta[4::6] = N * x_eta + samples[name] = (row_xi, row_eta) + return planar, samples + + def _mitc4_shear_b_matrix( + self, + planar: np.ndarray, + samples: Dict[str, Tuple[np.ndarray, np.ndarray]], + xi: float, + eta: float, + ) -> Tuple[np.ndarray, float]: + """Assumed-shear B matrix (local Cartesian) and in-plane Jacobian det.""" + _, dN_dxi, dN_deta = self.compute_shape_functions(xi, eta) + J2 = np.array( + [ + [float(dN_dxi @ planar[:, 0]), float(dN_dxi @ planar[:, 1])], + [float(dN_deta @ planar[:, 0]), float(dN_deta @ planar[:, 1])], + ], + dtype=float, + ) + try: + inv_j2, det_j = _inv2(J2) + except np.linalg.LinAlgError as exc: + raise ValueError(f"Shell element {self.element_id} has a singular in-plane Jacobian") from exc + B_covariant = np.vstack( + [ + 0.5 * (1.0 - eta) * samples["A"][0] + 0.5 * (1.0 + eta) * samples["C"][0], + 0.5 * (1.0 - xi) * samples["D"][1] + 0.5 * (1.0 + xi) * samples["B"][1], + ] + ) + return inv_j2 @ B_covariant, det_j + + def _rigid_body_mode_matrix(self, coords: np.ndarray) -> np.ndarray: + modes = np.zeros((self.total_dofs, 6), dtype=float) + centroid = np.mean(coords, axis=0) + axes = np.eye(3, dtype=float) + + for local, coord in enumerate(coords): + base = local * 6 + r = coord - centroid + modes[base + 0, 0] = 1.0 + modes[base + 1, 1] = 1.0 + modes[base + 2, 2] = 1.0 + for axis_index, axis in enumerate(axes): + displacement = _cross3(axis, r) + modes[base : base + 3, 3 + axis_index] = displacement + modes[base + 3 : base + 6, 3 + axis_index] = axis + + q, rmat = np.linalg.qr(modes) + diag = np.abs(np.diag(rmat)) + if diag.size == 0: + return np.zeros((self.total_dofs, 0), dtype=float) + keep = diag > max(float(np.max(diag)) * 1.0e-10, _SMALL) + return q[:, keep] + + def _hourglass_stabilization_matrix(self, K_base: np.ndarray, coords: np.ndarray) -> np.ndarray: + """Small stiffness on non-rigid zero modes outside rigid motion.""" + coefficient = float(getattr(self, "hourglass_stabilization", 0.0)) + stabilized_topology = (self._is_8node and self.reduced_integration) or self._is_triangular + if not stabilized_topology or coefficient <= 0.0: + return np.zeros_like(K_base) + + K_sym = 0.5 * (K_base + K_base.T) + eigvals, eigvecs = np.linalg.eigh(K_sym) + max_eig = max(float(np.max(np.abs(eigvals))), 1.0) + zero_tol = 1.0e-9 * max_eig + zero_mask = np.abs(eigvals) < zero_tol + if int(np.sum(zero_mask)) <= 6: + return np.zeros_like(K_base) + + zero_space = eigvecs[:, zero_mask] + rigid = self._rigid_body_mode_matrix(coords) + if rigid.size: + zero_space = zero_space - rigid @ (rigid.T @ zero_space) + + u, singular_values, _ = np.linalg.svd(zero_space, full_matrices=False) + if singular_values.size == 0: + return np.zeros_like(K_base) + keep = singular_values > 1.0e-8 + if not np.any(keep): + return np.zeros_like(K_base) + + hourglass_modes = u[:, keep] + stiffness_scale = coefficient * max_eig + K_hg = stiffness_scale * (hourglass_modes @ hourglass_modes.T) + return 0.5 * (K_hg + K_hg.T) + + def compute_stiffness_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: + coords = self.get_node_coordinates(mesh) + generalized_section = self.shell_section is not None + h = self.thickness + if generalized_section: + drilling_modulus = None + else: + _elastic_symmetry(material) + compliance = _elastic_compliance(material) + drilling_modulus = 1.0 / float(compliance[5, 5]) + + K = np.zeros((self.total_dofs, self.total_dofs), dtype=float) + + for (xi, eta), weight in zip(self.gauss_points, self.gauss_weights): + N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) + R, dN_dx, dN_dy, det_j = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) + T = self._local_dof_transform(R) + B_m, B_b, _ = self._build_shell_b_matrices(N, dN_dx, dN_dy) + B_d = self._build_drilling_b_matrix(N, dN_dx, dN_dy) + if generalized_section: + section_local = self._generalized_section_in_frame(R) + assert section_local is not None + K_local = ( + B_m.T @ section_local.A @ B_m + + B_m.T @ section_local.B @ B_b + + B_b.T @ section_local.B.T @ B_m + + B_b.T @ section_local.D @ B_b + ) * det_j * weight + drilling_stiffness = ( + float(section_local.A[2, 2]) + * getattr(self, "drilling_stabilization", 1.0e-3) + ) + else: + Q_local, _G_local, _strain_transform, _stress_transform = ( + _shell_material_matrices( + material, + self._material_angle(R), + ) + ) + D_membrane = h * Q_local + D_bending = h**3 / 12.0 * Q_local + K_local = ( + B_m.T @ D_membrane @ B_m + + B_b.T @ D_bending @ B_b + ) * det_j * weight + drilling_stiffness = ( + float(drilling_modulus) + * h + * getattr(self, "drilling_stabilization", 1.0e-3) + ) + K_local += (B_d.T @ (drilling_stiffness * np.eye(1)) @ B_d) * det_j * weight + K += T.T @ K_local @ T + + if self._is_4node: + R = self._center_frame(coords) + if generalized_section: + section_local = self._generalized_section_in_frame(R) + assert section_local is not None + D_shear = section_local.As + else: + _Q_local, G_local, _strain_transform, _stress_transform = ( + _shell_material_matrices( + material, + self._material_angle(R), + ) + ) + D_shear = (5.0 / 6.0) * h * G_local + T = self._local_dof_transform(R) + planar, samples = self._mitc4_shear_samples(coords, R) + for (xi, eta), weight in zip(self.GAUSS_POINTS_2x2, self.GAUSS_WEIGHTS_2x2): + B_s, det_j = self._mitc4_shear_b_matrix(planar, samples, float(xi), float(eta)) + K_local = (B_s.T @ D_shear @ B_s) * det_j * weight + K += T.T @ K_local @ T + elif self._is_3node: + R = self._center_frame(coords) + if generalized_section: + section_local = self._generalized_section_in_frame(R) + assert section_local is not None + D_shear = section_local.As + else: + _Q_local, G_local, _strain_transform, _stress_transform = ( + _shell_material_matrices( + material, + self._material_angle(R), + ) + ) + D_shear = (5.0 / 6.0) * h * G_local + T = self._local_dof_transform(R) + B_s, det_j = self._tri3_assumed_shear_b_matrix(coords, R) + K_local = (B_s.T @ D_shear @ B_s) * det_j * float(np.sum(self.shear_gauss_weights)) + K += T.T @ K_local @ T + else: + for (xi, eta), weight in zip(self.shear_gauss_points, self.shear_gauss_weights): + N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) + R, dN_dx, dN_dy, det_j = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) + if generalized_section: + section_local = self._generalized_section_in_frame(R) + assert section_local is not None + D_shear = section_local.As + else: + _Q_local, G_local, _strain_transform, _stress_transform = ( + _shell_material_matrices( + material, + self._material_angle(R), + ) + ) + D_shear = (5.0 / 6.0) * h * G_local + T = self._local_dof_transform(R) + _, _, B_s = self._build_shell_b_matrices(N, dN_dx, dN_dy) + K_local = (B_s.T @ D_shear @ B_s) * det_j * weight + K += T.T @ K_local @ T + + self._hourglass_stiffness_matrix = self._hourglass_stabilization_matrix(K, coords) + K += self._hourglass_stiffness_matrix + + self._stiffness_matrix = K + return K + + def compute_mass_matrix( + self, + mesh: "FEMesh", + material: "Material", + *, + _qualified_runtime_post_observation: Optional[Callable[[], None]] = None, + ) -> np.ndarray: + coords = self.get_node_coordinates(mesh) + raw_density = _guarded_observe_attribute( + material, + "density", + post_observation=_qualified_runtime_post_observation, + ) + rho = _guarded_float( + raw_density, + post_observation=_qualified_runtime_post_observation, + ) + h = self.thickness + section_mass = ( + None + if self.shell_section is None + else _guarded_observe_attribute( + self.shell_section, + "mass_per_area", + post_observation=_qualified_runtime_post_observation, + ) + ) + mass_per_area = ( + _guarded_float( + section_mass, + post_observation=_qualified_runtime_post_observation, + ) + if section_mass is not None + else rho * h + ) + section_rotary_inertia = ( + None + if self.shell_section is None + else _guarded_observe_attribute( + self.shell_section, + "rotary_inertia_per_area", + post_observation=_qualified_runtime_post_observation, + ) + ) + rotary_inertia_per_area = ( + _guarded_float( + section_rotary_inertia, + post_observation=_qualified_runtime_post_observation, + ) + if section_rotary_inertia is not None + else rho * h**3 / 12.0 + ) + M = np.zeros((self.total_dofs, self.total_dofs), dtype=float) + if self._is_8node and self.reduced_integration: + area = 0.0 + for (xi, eta), weight in zip(self.gauss_points, self.gauss_weights): + _N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) + _R, _dN_dx, _dN_dy, det_j = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) + area += float(det_j) * float(weight) + translational = mass_per_area * max(area, 0.0) / max(self.num_nodes, 1) + rotational = ( + rotary_inertia_per_area + * max(area, 0.0) + / max(self.num_nodes, 1) + ) + for i in range(self.num_nodes): + base = 6 * i + M[base + 0, base + 0] = translational + M[base + 1, base + 1] = translational + M[base + 2, base + 2] = translational + M[base + 3, base + 3] = rotational + M[base + 4, base + 4] = rotational + M[base + 5, base + 5] = rotational + self._mass_matrix = M + return M + for (xi, eta), weight in zip(self.gauss_points, self.gauss_weights): + N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) + R, _, _, det_j = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) + T = self._local_dof_transform(R) + M_local = np.zeros_like(M) + outer_n = np.outer(N, N) * det_j * weight + translational = mass_per_area * outer_n + rotational = rotary_inertia_per_area * outer_n + for d in range(3): + M_local[d::6, d::6] += translational + M_local[3 + d::6, 3 + d::6] += rotational + M += T.T @ M_local @ T + self._mass_matrix = M + return M + + @staticmethod + def _membrane_compression_from_state(state: Optional[Any]) -> Tuple[float, float, float]: + """Return local membrane resultants with compression-positive convention.""" + if state is None or not isinstance(state, dict): + return 0.0, 0.0, 0.0 + + if "membrane_compression" in state: + values = np.asarray(state["membrane_compression"], dtype=float).reshape(-1) + if values.size >= 3: + return float(values[0]), float(values[1]), float(values[2]) + if "membrane_forces" in state: + values = np.asarray(state["membrane_forces"], dtype=float).reshape(-1) + if values.size >= 3: + return -float(values[0]), -float(values[1]), -float(values[2]) + + compression_x = state.get("membrane_compression_x", state.get("Nx_compression")) + compression_y = state.get("membrane_compression_y", state.get("Ny_compression")) + compression_xy = state.get("membrane_compression_xy", state.get("Nxy_compression")) + if compression_x is not None or compression_y is not None or compression_xy is not None: + return ( + float(compression_x or 0.0), + float(compression_y or 0.0), + float(compression_xy or 0.0), + ) + + force_x = state.get("membrane_force_x", state.get("Nx")) + force_y = state.get("membrane_force_y", state.get("Ny")) + force_xy = state.get("membrane_force_xy", state.get("Nxy")) + return ( + -float(force_x or 0.0), + -float(force_y or 0.0), + -float(force_xy or 0.0), + ) + + @classmethod + def _membrane_compression_samples( + cls, + state: Optional[Any], + count: int, + ) -> np.ndarray: + """Return compression-positive ``[Nx, Ny, Nxy]`` at integration points. + + Uniform legacy state keys remain supported. Spatially varying + prestress can be supplied as ``membrane_compression_at_gauss`` or + tension-positive ``membrane_forces_at_gauss`` with shape ``(n_gp, 3)``. + The shorter aliases ``membrane_compression`` and ``membrane_forces`` + also accept that two-dimensional form. + """ + if isinstance(state, dict): + compression_values = state.get( + "membrane_compression_at_gauss", + state.get("membrane_compression"), + ) + force_values = state.get( + "membrane_forces_at_gauss", + state.get("membrane_forces"), + ) + values = compression_values if compression_values is not None else force_values + if values is not None: + samples = np.asarray(values, dtype=float) + if samples.ndim == 2: + if samples.shape != (int(count), 3): + raise ValueError( + "Gauss-point membrane resultants must have shape " + f"({int(count)}, 3), got {samples.shape}." + ) + return samples.copy() if compression_values is not None else -samples + + uniform = np.asarray(cls._membrane_compression_from_state(state), dtype=float) + return np.repeat(uniform.reshape(1, 3), int(count), axis=0) + + @staticmethod + def _resultant_samples( + state: Optional[Any], + count: int, + *, + compression_keys: Tuple[str, ...], + tension_keys: Tuple[str, ...] = (), + ) -> np.ndarray: + """Read uniform or Gauss-point vector resultants with sign conversion.""" + if not isinstance(state, dict): + return np.zeros((int(count), 3), dtype=float) + values = None + compression_positive = True + for key in compression_keys: + if key in state: + values = state[key] + break + if values is None: + for key in tension_keys: + if key in state: + values = state[key] + compression_positive = False + break + if values is None: + return np.zeros((int(count), 3), dtype=float) + samples = np.asarray(values, dtype=float) + if samples.ndim == 1 and samples.size == 3: + samples = np.repeat(samples.reshape(1, 3), int(count), axis=0) + if samples.shape != (int(count), 3): + raise ValueError( + f"Initial-stress resultants must have shape (3,) or ({int(count)}, 3), " + f"got {samples.shape}." + ) + return samples.copy() if compression_positive else -samples + + @classmethod + def _bending_compression_samples( + cls, + state: Optional[Any], + count: int, + ) -> np.ndarray: + """Compression-positive first stress moments ``[Mx, My, Mxy]``.""" + return cls._resultant_samples( + state, + count, + compression_keys=( + "bending_compression_at_gauss", + "bending_compression", + "bending_compression_moments_at_gauss", + "bending_compression_moments", + ), + tension_keys=("bending_moments_at_gauss", "bending_moments"), + ) + + @classmethod + def _stress_second_moment_samples( + cls, + state: Optional[Any], + count: int, + membrane_compression: np.ndarray, + thickness: float, + ) -> np.ndarray: + """Compression-positive second stress moments, defaulting to ``N h²/12``.""" + explicit = cls._resultant_samples( + state, + count, + compression_keys=( + "stress_second_moment_at_gauss", + "stress_second_moment", + "membrane_compression_second_moment_at_gauss", + "membrane_compression_second_moment", + ), + ) + has_explicit = isinstance(state, dict) and any( + key in state + for key in ( + "stress_second_moment_at_gauss", + "stress_second_moment", + "membrane_compression_second_moment_at_gauss", + "membrane_compression_second_moment", + ) + ) + if has_explicit: + return explicit + return np.asarray(membrane_compression, dtype=float) * float(thickness) ** 2 / 12.0 + + def compute_geometric_stiffness_matrix( + self, + mesh: "FEMesh", + material: "Material", + state: Optional[Any] = None, + ) -> np.ndarray: + """ + Shell stress-stiffness matrix from membrane resultants. + + The state can supply either tension-positive membrane forces + (``membrane_force_x/y/xy`` or ``membrane_forces``) or + compression-positive values (``membrane_compression_x/y/xy``). The + returned matrix follows the package convention + ``K phi = lambda KG phi`` with compression destabilizing. + + The total-Lagrangian initial-stress operator uses the Mindlin director + field ``[u + z*ry, v - z*rx, w]``. Membrane resultants therefore act + on all translations, their second stress moment (``N*h**2/12`` for a + uniform through-thickness membrane stress) acts on ``rx``/``ry`` + gradients, and optional bending resultants provide the signed + translation-director coupling. Drilling ``rz`` has no director term. + """ + compression = self._membrane_compression_samples(state, len(self.gauss_points)) + bending_compression = self._bending_compression_samples(state, len(self.gauss_points)) + second_moment = self._stress_second_moment_samples( + state, + len(self.gauss_points), + compression, + self.thickness, + ) + if not np.any(compression) and not np.any(bending_compression) and not np.any(second_moment): + return np.zeros((self.total_dofs, self.total_dofs), dtype=float) + + coords = self.get_node_coordinates(mesh) + KG = np.zeros((self.total_dofs, self.total_dofs), dtype=float) + + for gp_index, ((xi, eta), weight) in enumerate(zip(self.gauss_points, self.gauss_weights)): + N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) + R, dN_dx, dN_dy, det_j = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) + T = self._local_dof_transform(R) + Nx, Ny, Nxy = compression[gp_index] + N_matrix = np.array([[Nx, Nxy], [Nxy, Ny]], dtype=float) + Mx, My, Mxy = bending_compression[gp_index] + M_matrix = np.array([[Mx, Mxy], [Mxy, My]], dtype=float) + Hx, Hy, Hxy = second_moment[gp_index] + H_matrix = np.array([[Hx, Hxy], [Hxy, Hy]], dtype=float) + KG_local = np.zeros((self.total_dofs, self.total_dofs), dtype=float) + translation_gradients = [] + for component in range(3): + G = np.zeros((2, self.total_dofs), dtype=float) + G[0, component::6] = dN_dx + G[1, component::6] = dN_dy + translation_gradients.append(G) + KG_local += G.T @ N_matrix @ G + G_rx = np.zeros((2, self.total_dofs), dtype=float) + G_ry = np.zeros((2, self.total_dofs), dtype=float) + G_rx[0, 3::6] = dN_dx + G_rx[1, 3::6] = dN_dy + G_ry[0, 4::6] = dN_dx + G_ry[1, 4::6] = dN_dy + KG_local += G_rx.T @ H_matrix @ G_rx + KG_local += G_ry.T @ H_matrix @ G_ry + # u(z)=u+z*ry and v(z)=v-z*rx. + coupling_u_ry = translation_gradients[0].T @ M_matrix @ G_ry + coupling_v_rx = translation_gradients[1].T @ M_matrix @ G_rx + KG_local += coupling_u_ry + coupling_u_ry.T + KG_local -= coupling_v_rx + coupling_v_rx.T + KG_local *= det_j * float(weight) + KG += T.T @ KG_local @ T + return KG + + # ------------------------------------------------------------------ + # Incremental nonlinear response: total-Lagrangian von Karman membrane + # kinematics in the flat-facet centre frame, layered J2 plane-stress + # plasticity through the thickness, elastic transverse shear (MITC4 for + # 4-node, reduced for 8-node) and elastic drilling stabilization. + # ------------------------------------------------------------------ + + def _nonlinear_geometry(self, mesh: "FEMesh") -> Dict[str, Any]: + """Reference-configuration data, computed once per element.""" + cache = getattr(self, "_nl_cache", None) + if cache is not None: + return cache + coords = self.get_node_coordinates(mesh) + R0 = self._center_frame(coords) + T0 = self._local_dof_transform(R0) + planar = coords @ R0[:, :2] + + gp_data = [] + for (xi, eta), weight in zip(self.gauss_points, self.gauss_weights): + N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) + J2 = np.array( + [ + [float(dN_dxi @ planar[:, 0]), float(dN_dxi @ planar[:, 1])], + [float(dN_deta @ planar[:, 0]), float(dN_deta @ planar[:, 1])], + ], + dtype=float, + ) + inv_j2, det_j = _inv2(J2) + dN_dx = inv_j2[0, 0] * dN_dxi + inv_j2[0, 1] * dN_deta + dN_dy = inv_j2[1, 0] * dN_dxi + inv_j2[1, 1] * dN_deta + B_m, B_b, B_s = self._build_shell_b_matrices(N, dN_dx, dN_dy) + B_d = self._build_drilling_b_matrix(N, dN_dx, dN_dy) + Gw = np.zeros((2, self.total_dofs), dtype=float) + Gw[0, 2::6] = dN_dx + Gw[1, 2::6] = dN_dy + gp_data.append( + { + "B_m": B_m, + "B_b": B_b, + "B_d": B_d, + "Gw": Gw, + "detw": abs(det_j) * float(weight), + } + ) + + shear_data = [] + if self._is_4node: + _, samples = self._mitc4_shear_samples(coords, R0) + for (xi, eta), weight in zip(self.GAUSS_POINTS_2x2, self.GAUSS_WEIGHTS_2x2): + B_s, det_j = self._mitc4_shear_b_matrix(planar, samples, float(xi), float(eta)) + shear_data.append({"B_s": B_s, "detw": abs(det_j) * float(weight)}) + elif self._is_3node: + B_s, det_j = self._tri3_assumed_shear_b_matrix(coords, R0) + shear_data.append({"B_s": B_s, "detw": det_j * float(np.sum(self.shear_gauss_weights))}) + else: + for (xi, eta), weight in zip(self.shear_gauss_points, self.shear_gauss_weights): + N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) + J2 = np.array( + [ + [float(dN_dxi @ planar[:, 0]), float(dN_dxi @ planar[:, 1])], + [float(dN_deta @ planar[:, 0]), float(dN_deta @ planar[:, 1])], + ], + dtype=float, + ) + inv_j2, det_j = _inv2(J2) + dN_dx = inv_j2[0, 0] * dN_dxi + inv_j2[0, 1] * dN_deta + dN_dy = inv_j2[1, 0] * dN_dxi + inv_j2[1, 1] * dN_deta + _, _, B_s = self._build_shell_b_matrices(N, dN_dx, dN_dy) + shear_data.append({"B_s": B_s, "detw": abs(det_j) * float(weight)}) + + n_gp = len(gp_data) + B_m_all = np.zeros((n_gp, 3, self.total_dofs)) + B_b_all = np.zeros((n_gp, 3, self.total_dofs)) + B_d_all = np.zeros((n_gp, 1, self.total_dofs)) + Gw_all = np.zeros((n_gp, 2, self.total_dofs)) + detw_all = np.zeros(n_gp) + for g, gp in enumerate(gp_data): + B_m_all[g] = gp["B_m"] + B_b_all[g] = gp["B_b"] + B_d_all[g] = gp["B_d"] + Gw_all[g] = gp["Gw"] + detw_all[g] = gp["detw"] + + n_shear = len(shear_data) + B_s_all = np.zeros((n_shear, 2, self.total_dofs)) + detw_shear_all = np.zeros(n_shear) + for g, sh in enumerate(shear_data): + B_s_all[g] = sh["B_s"] + detw_shear_all[g] = sh["detw"] + + cache = { + "R0": R0, + "T0": T0, + "gp": gp_data, + "shear": shear_data, + "B_m_all": B_m_all, + "B_b_all": B_b_all, + "B_d_all": B_d_all, + "Gw_all": Gw_all, + "detw_all": detw_all, + "B_s_all": B_s_all, + "detw_shear_all": detw_shear_all, + } + # This is a solver-owned derived cache. Qualified subclasses reserve + # the public assignment surface so callers cannot replace a warm + # nonlinear operator while preserving its cache key. + object.__setattr__(self, "_nl_cache", cache) + return cache + + def init_nonlinear_state(self, num_layers: int) -> Dict[str, Any]: + if self.shell_section is not None: + return {"generalized_section": True} + n_points = len(self.gauss_points) * num_layers + return { + "plastic_strain": np.zeros((n_points, 3), dtype=float), + "alpha": np.zeros(n_points, dtype=float), + } + + def _generalized_section_nonlinear_response( + self, + mesh: "FEMesh", + material: "Material", + u_elem: np.ndarray, + state: Optional[Any], + tangent: bool, + *, + _return_tangent_components: bool = False, + ) -> Any: + """Geometrically nonlinear response for a linear generalized section.""" + + if getattr(material, "hardening_curve", None) is not None or getattr( + material, + "hill_yield", + None, + ) is not None: + raise ValueError( + "Generalized shell sections are linear elastic and cannot use " + "material hardening or Hill plasticity; use a layered section " + "constitutive model for nonlinear laminate response." + ) + if isinstance(state, dict) and any(key in state for key in _INITIAL_SHELL_STATE_KEYS): + raise ValueError( + "Initial layer stress/prestrain fields are not defined for a " + "pre-integrated generalized shell section." + ) + + cache = self._nonlinear_geometry(mesh) + R0 = cache["R0"] + T0 = cache["T0"] + u_loc = T0 @ np.asarray(u_elem, dtype=float) + section = self._generalized_section_in_frame(R0) + assert section is not None + + n_gp = len(cache["gp"]) + membrane_strain = np.zeros((n_gp, 3), dtype=float) + curvature = np.zeros((n_gp, 3), dtype=float) + for index, gp in enumerate(cache["gp"]): + theta = gp["Gw"] @ u_loc + membrane_strain[index] = gp["B_m"] @ u_loc + np.array( + [ + 0.5 * theta[0] ** 2, + 0.5 * theta[1] ** 2, + theta[0] * theta[1], + ], + dtype=float, + ) + curvature[index] = gp["B_b"] @ u_loc + + membrane_resultants = ( + membrane_strain @ section.A.T + curvature @ section.B.T + ) + bending_resultants = ( + membrane_strain @ section.B + curvature @ section.D.T + ) + transverse_shear_strain = np.einsum( + "gij,j->gi", + cache["B_s_all"], + u_loc, + ) + transverse_shear_resultants = ( + transverse_shear_strain @ section.As.T + ) + C0 = np.broadcast_to(section.A, (n_gp, 3, 3)) + C1 = np.broadcast_to(section.B, (n_gp, 3, 3)) + C2 = np.broadcast_to(section.D, (n_gp, 3, 3)) + drilling_stiffness = ( + float(section.A[2, 2]) + * getattr(self, "drilling_stabilization", 1.0e-3) + ) + + F_loc, K_loc = _jit_integrate_nonlinear_response( + u_loc, + membrane_resultants, + bending_resultants, + C0, + C1, + C2, + cache["B_m_all"], + cache["B_b_all"], + cache["B_d_all"], + cache["Gw_all"], + cache["detw_all"], + cache["B_s_all"], + cache["detw_shear_all"], + section.As, + drilling_stiffness, + tangent, + True, + self.total_dofs, + ) + + K_hg = getattr(self, "_hourglass_stiffness_matrix", None) + if ( + self._is_8node + and self.reduced_integration + and float(getattr(self, "hourglass_stabilization", 0.0)) > 0.0 + and K_hg is None + ): + self.compute_stiffness_matrix(mesh, material) + K_hg = getattr(self, "_hourglass_stiffness_matrix", None) + + F_global = T0.T @ F_loc + if K_hg is not None: + F_global = F_global + K_hg @ np.asarray(u_elem, dtype=float) + K_global: Optional[np.ndarray] + if tangent: + K_global = T0.T @ K_loc @ T0 + if K_hg is not None: + K_global = K_global + K_hg + else: + K_global = None + + trial_state: Dict[str, Any] = { + "generalized_section": True, + "geometric_nonlinearity": "von_karman", + "membrane_strain": membrane_strain.copy(), + "curvature": curvature.copy(), + "transverse_shear_strain": transverse_shear_strain.copy(), + "membrane_resultants": membrane_resultants.copy(), + "bending_resultants": bending_resultants.copy(), + "transverse_shear_resultants": ( + transverse_shear_resultants.copy() + ), + "membrane_resultant_order": SHELL_MEMBRANE_VOIGT_ORDER, + "transverse_shear_resultant_order": ( + SHELL_TRANSVERSE_SHEAR_ORDER + ), + "recovery_scope": "section_resultants_only", + } + if _return_tangent_components: + if K_global is None: + raise ValueError( + "nonlinear tangent components require tangent=True" + ) + material_local, geometric_local = ( + _integrate_nonlinear_tangent_components( + u_loc, + membrane_resultants, + bending_resultants, + C0, + C1, + C2, + cache["B_m_all"], + cache["B_b_all"], + cache["B_d_all"], + cache["Gw_all"], + cache["detw_all"], + cache["B_s_all"], + cache["detw_shear_all"], + section.As, + drilling_stiffness, + True, + self.total_dofs, + ) + ) + material_global = T0.T @ material_local @ T0 + geometric_global = T0.T @ geometric_local @ T0 + if K_hg is not None: + material_global = material_global + K_hg + return F_global, K_global, trial_state, { + "material": material_global, + "geometric": geometric_global, + } + return F_global, K_global, trial_state + + def compute_nonlinear_response( + self, + mesh: "FEMesh", + material: "Material", + u_elem: np.ndarray, + state: Optional[Any] = None, + num_layers: int = 5, + tangent: bool = True, + *, + _return_tangent_components: bool = False, + _qualified_runtime_post_observation: Optional[Callable[[], None]] = None, + ) -> Any: + if _return_tangent_components and not tangent: + raise ValueError("nonlinear tangent components require tangent=True") + if self.shell_section is not None: + return self._generalized_section_nonlinear_response( + mesh, + material, + u_elem, + state, + tangent, + _return_tangent_components=_return_tangent_components, + ) + cache = self._nonlinear_geometry(mesh) + R0 = cache["R0"] + T0 = cache["T0"] + u_loc = T0 @ np.asarray(u_elem, dtype=float) + + symmetry = _elastic_symmetry( + material, + _qualified_runtime_post_observation, + ) + h = self.thickness + curve = _guarded_observe_attribute( + material, + "hardening_curve", + default=None, + post_observation=_qualified_runtime_post_observation, + ) + C_el, shear_elastic, strain_to_material, stress_to_local = _shell_material_matrices( + material, + self._material_angle(R0), + _qualified_runtime_post_observation, + ) + C_material, _shear_material, _identity_strain, _identity_stress = ( + _shell_material_matrices( + material, + 0.0, + _qualified_runtime_post_observation, + ) + ) + drilling_modulus = 1.0 / float( + _elastic_compliance( + material, + _qualified_runtime_post_observation, + )[5, 5] + ) + D_shear = shear_elastic * (5.0 / 6.0) * h + drilling_stiffness = ( + drilling_modulus + * h + * getattr(self, "drilling_stabilization", 1.0e-3) + ) + hill_yield = _guarded_observe_attribute( + material, + "hill_yield", + default=None, + post_observation=_qualified_runtime_post_observation, + ) + if symmetry == "orthotropic" and curve is not None and hill_yield is None: + raise ValueError( + f"Orthotropic material {getattr(material, 'name', '')!r} " + "requires hill_yield when hardening_curve is active." + ) + hill_plasticity = symmetry == "orthotropic" and hill_yield is not None + constitutive_plasticity = curve is not None or hill_plasticity + + n_gp = len(cache["gp"]) + z_layers, w_layers = lobatto_layers(num_layers, h) + + if state is None: + state = self.init_nonlinear_state(num_layers) + initial_state = _copy_state_fields(state, _INITIAL_SHELL_STATE_KEYS) + has_initial_field = any( + key in initial_state + for key in ( + "initial_membrane_stress", + "initial_bending_stress", + "initial_membrane_prestrain", + "initial_curvature_prestrain", + ) + ) + + # Membrane and bending strains at every integration point. + memb_strain = np.zeros((n_gp, 3), dtype=float) + curvature = np.zeros((n_gp, 3), dtype=float) + B_eff_list = [] + theta_list = [] + for g, gp in enumerate(cache["gp"]): + theta = gp["Gw"] @ u_loc # (2,) transverse deflection gradients + B_nl = np.vstack( + [ + theta[0] * gp["Gw"][0], + theta[1] * gp["Gw"][1], + theta[0] * gp["Gw"][1] + theta[1] * gp["Gw"][0], + ] + ) + B_eff = gp["B_m"] + B_nl + memb_strain[g] = gp["B_m"] @ u_loc + np.array( + [0.5 * theta[0] ** 2, 0.5 * theta[1] ** 2, theta[0] * theta[1]] + ) + curvature[g] = gp["B_b"] @ u_loc + B_eff_list.append(B_eff) + theta_list.append(theta) + + if not constitutive_plasticity and not has_initial_field: + # Elastic shortcut: resultants and integrated moduli in closed form. + trial_state = state + N_res = memb_strain @ (h * C_el).T + M_res = curvature @ (h**3 / 12.0 * C_el).T + C0 = np.broadcast_to(h * C_el, (n_gp, 3, 3)) + C1 = np.zeros((n_gp, 3, 3), dtype=float) + C2 = np.broadcast_to(h**3 / 12.0 * C_el, (n_gp, 3, 3)) + else: + # Layer strains for all (gp, layer) points at once. Prescribed + # residual stress is represented by its elastic strain offset and + # prestrain is subtracted as an eigenstrain. Both therefore enter + # the same return map as the kinematic strain and participate in + # yielding, hardening, unloading, and the geometric stiffness. + kinematic_layer_strain = ( + memb_strain[:, None, :] + z_layers[None, :, None] * curvature[:, None, :] + ) + zero_rows = np.zeros((n_gp, 3), dtype=float) + membrane_stress = _shell_field_rows( + initial_state.get("initial_membrane_stress", zero_rows), + n_gp, + "initial_membrane_stress", + ) + bending_stress = _shell_field_rows( + initial_state.get("initial_bending_stress", zero_rows), + n_gp, + "initial_bending_stress", + ) + membrane_prestrain = _shell_field_rows( + initial_state.get("initial_membrane_prestrain", zero_rows), + n_gp, + "initial_membrane_prestrain", + ) + curvature_prestrain = _shell_field_rows( + initial_state.get("initial_curvature_prestrain", zero_rows), + n_gp, + "initial_curvature_prestrain", + ) + initial_stress = ( + membrane_stress[:, None, :] + + (2.0 * z_layers[None, :, None] / h) * bending_stress[:, None, :] + ) + eigenstrain = ( + membrane_prestrain[:, None, :] + + z_layers[None, :, None] * curvature_prestrain[:, None, :] + ) + if symmetry == "orthotropic": + initial_stress_material = np.einsum( + "ij,glj->gli", + np.linalg.inv(stress_to_local), + initial_stress, + ) + kinematic_material = np.einsum( + "ij,glj->gli", + strain_to_material, + kinematic_layer_strain, + ) + eigenstrain_material = np.einsum( + "ij,glj->gli", + strain_to_material, + eigenstrain, + ) + stress_strain_offset = np.einsum( + "ij,glj->gli", + np.linalg.inv(C_material), + initial_stress_material, + ) + layer_strain_material = ( + kinematic_material - eigenstrain_material + stress_strain_offset + ).reshape(n_gp * num_layers, 3) + layer_strain = ( + kinematic_layer_strain - eigenstrain + + np.einsum( + "ij,glj->gli", + np.linalg.inv(C_el), + initial_stress, + ) + ).reshape(n_gp * num_layers, 3) + else: + stress_strain_offset = np.einsum( + "ij,glj->gli", + np.linalg.inv(C_el), + initial_stress, + ) + layer_strain = ( + kinematic_layer_strain - eigenstrain + stress_strain_offset + ).reshape(n_gp * num_layers, 3) + layer_strain_material = layer_strain + if not constitutive_plasticity: + sigma = layer_strain @ C_el.T + C_tan = np.broadcast_to(C_el, (n_gp * num_layers, 3, 3)).copy() + ep_new = np.zeros_like(layer_strain) + alpha_new = np.zeros(n_gp * num_layers, dtype=float) + if symmetry == "orthotropic": + sigma_material = layer_strain_material @ C_material.T + elif hill_plasticity: + from .plasticity import hill48_plane_stress_return_map + + sigma_material, C_tan_material, ep_new, alpha_new = ( + hill48_plane_stress_return_map( + layer_strain_material, + state["plastic_strain"], + state["alpha"], + C_material, + hill_yield, + curve, + compute_tangent=tangent, + ) + ) + sigma = sigma_material @ stress_to_local.T + C_tan = np.einsum( + "ij,njk,kl->nil", + stress_to_local, + C_tan_material, + strain_to_material, + ) + else: + sigma, C_tan, ep_new, alpha_new = plane_stress_return_map( + layer_strain, + state["plastic_strain"], + state["alpha"], + _guarded_float( + _guarded_observe_attribute( + material, + "elastic_modulus", + post_observation=_qualified_runtime_post_observation, + ), + post_observation=_qualified_runtime_post_observation, + ), + _guarded_float( + _guarded_observe_attribute( + material, + "poisson_ratio", + post_observation=_qualified_runtime_post_observation, + ), + post_observation=_qualified_runtime_post_observation, + ), + curve, + compute_tangent=tangent, + ) + trial_state = { + "plastic_strain": ep_new, + "alpha": alpha_new, + "layer_strain": layer_strain.copy(), + "layer_strain_material": layer_strain_material.copy(), + "kinematic_layer_strain": kinematic_layer_strain.reshape(n_gp * num_layers, 3).copy(), + **initial_state, + } + + sigma = sigma.reshape(n_gp, num_layers, 3) + C_tan = C_tan.reshape(n_gp, num_layers, 3, 3) + trial_state["layer_stress"] = sigma.reshape(n_gp * num_layers, 3).copy() + if symmetry == "orthotropic": + trial_state["layer_stress_material"] = sigma_material.reshape( + n_gp * num_layers, + 3, + ).copy() + trial_state["equivalent_stress_measure"] = ( + "hill48" if hill_yield is not None else "von_mises" + ) + + # Through-thickness resultants and integrated tangent moduli. + N_res = np.einsum("l,gli->gi", w_layers, sigma) + M_res = np.einsum("l,l,gli->gi", w_layers, z_layers, sigma) + C0 = np.einsum("l,glij->gij", w_layers, C_tan) + C1 = np.einsum("l,l,glij->gij", w_layers, z_layers, C_tan) + C2 = np.einsum("l,l,l,glij->gij", w_layers, z_layers, z_layers, C_tan) + + n_dof = self.total_dofs + F_loc, K_loc_temp = _jit_integrate_nonlinear_response( + u_loc, + N_res, + M_res, + C0, + C1, + C2, + cache["B_m_all"], + cache["B_b_all"], + cache["B_d_all"], + cache["Gw_all"], + cache["detw_all"], + cache["B_s_all"], + cache["detw_shear_all"], + D_shear, + drilling_stiffness, + tangent, + constitutive_plasticity, + n_dof, + ) + K_loc = K_loc_temp if tangent else None + + K_hg = getattr(self, "_hourglass_stiffness_matrix", None) + if self._is_8node and self.reduced_integration and float(getattr(self, "hourglass_stabilization", 0.0)) > 0.0: + if K_hg is None: + self.compute_stiffness_matrix(mesh, material) + K_hg = getattr(self, "_hourglass_stiffness_matrix", None) + + F_global = T0.T @ F_loc + if K_hg is not None: + u_global = np.asarray(u_elem, dtype=float) + F_global = F_global + K_hg @ u_global + + if not tangent: + return F_global, None, trial_state + K_global = T0.T @ K_loc @ T0 + if K_hg is not None: + K_global = K_global + K_hg + if _return_tangent_components: + material_local, geometric_local = ( + _integrate_nonlinear_tangent_components( + u_loc, + N_res, + M_res, + C0, + C1, + C2, + cache["B_m_all"], + cache["B_b_all"], + cache["B_d_all"], + cache["Gw_all"], + cache["detw_all"], + cache["B_s_all"], + cache["detw_shear_all"], + D_shear, + drilling_stiffness, + constitutive_plasticity, + n_dof, + ) + ) + material_global = T0.T @ material_local @ T0 + geometric_global = T0.T @ geometric_local @ T0 + if K_hg is not None: + material_global = material_global + K_hg + return F_global, K_global, trial_state, { + "material": material_global, + "geometric": geometric_global, + } + return F_global, K_global, trial_state + + def _compute_generalized_section_results( + self, + mesh: "FEMesh", + displacements: np.ndarray, + *, + return_global: bool, + ) -> Dict[str, Any]: + """Recover exact generalized strains and resultants. + + A/B/D/As do not contain enough information to reconstruct ply or + through-thickness surface stresses, so this path intentionally does + not report von Mises, Hill, or fabricated top/bottom stress fields. + """ + + coords = self.get_node_coordinates(mesh) + u_elem_global = self._get_element_displacements(mesh, displacements) + num_ip = len(self.gauss_points) + membrane_strain = np.zeros((num_ip, 3), dtype=float) + curvature = np.zeros((num_ip, 3), dtype=float) + transverse_shear_strain = np.zeros((num_ip, 2), dtype=float) + membrane_resultants = np.zeros((num_ip, 3), dtype=float) + bending_resultants = np.zeros((num_ip, 3), dtype=float) + transverse_shear_resultants = np.zeros((num_ip, 2), dtype=float) + + global_membrane = ( + np.zeros((num_ip, 3, 3), dtype=float) if return_global else None + ) + global_bending = ( + np.zeros((num_ip, 3, 3), dtype=float) if return_global else None + ) + global_shear = ( + np.zeros((num_ip, 3), dtype=float) if return_global else None + ) + + mitc_planar = None + mitc_samples = None + mitc_u_local = None + tri3_B_s = None + tri3_u_local = None + center_section = None + if self._is_4node: + R_center = self._center_frame(coords) + center_section = self._generalized_section_in_frame(R_center) + mitc_planar, mitc_samples = self._mitc4_shear_samples(coords, R_center) + mitc_u_local = self._local_dof_transform(R_center) @ u_elem_global + elif self._is_3node: + R_center = self._center_frame(coords) + center_section = self._generalized_section_in_frame(R_center) + tri3_B_s, _ = self._tri3_assumed_shear_b_matrix(coords, R_center) + tri3_u_local = self._local_dof_transform(R_center) @ u_elem_global + + for index, (xi, eta) in enumerate(self.gauss_points): + N, dN_dxi, dN_deta = self.compute_shape_functions( + float(xi), + float(eta), + ) + R, dN_dx, dN_dy, _ = self._local_frame_and_derivatives( + coords, + dN_dxi, + dN_deta, + ) + section = self._generalized_section_in_frame(R) + assert section is not None + T = self._local_dof_transform(R) + u_local = T @ u_elem_global + B_m, B_b, B_s = self._build_shell_b_matrices(N, dN_dx, dN_dy) + strain = B_m @ u_local + bend = B_b @ u_local + if self._is_4node: + B_s_mitc, _ = self._mitc4_shear_b_matrix( + mitc_planar, + mitc_samples, + float(xi), + float(eta), + ) + shear_strain = B_s_mitc @ mitc_u_local + shear_section = center_section + elif self._is_3node: + shear_strain = tri3_B_s @ tri3_u_local + shear_section = center_section + else: + shear_strain = B_s @ u_local + shear_section = section + assert shear_section is not None + + force = section.A @ strain + section.B @ bend + moment = section.B.T @ strain + section.D @ bend + shear_force = shear_section.As @ shear_strain + + membrane_strain[index] = strain + curvature[index] = bend + transverse_shear_strain[index] = shear_strain + membrane_resultants[index] = force + bending_resultants[index] = moment + transverse_shear_resultants[index] = shear_force + + if return_global: + force_tensor = np.array( + [ + [force[0], force[2], 0.0], + [force[2], force[1], 0.0], + [0.0, 0.0, 0.0], + ], + dtype=float, + ) + moment_tensor = np.array( + [ + [moment[0], moment[2], 0.0], + [moment[2], moment[1], 0.0], + [0.0, 0.0, 0.0], + ], + dtype=float, + ) + assert global_membrane is not None + assert global_bending is not None + assert global_shear is not None + global_membrane[index] = R @ force_tensor @ R.T + global_bending[index] = R @ moment_tensor @ R.T + global_shear[index] = ( + shear_force[0] * R[:, 0] + shear_force[1] * R[:, 1] + ) + + results: Dict[str, Any] = { + "generalized_stress_scope": "section_resultants_only", + "recovery_scope": "section_resultants_only", + "physical_stress_available": False, + "membrane_resultant_order": SHELL_MEMBRANE_VOIGT_ORDER, + "transverse_shear_resultant_order": SHELL_TRANSVERSE_SHEAR_ORDER, + "membrane_strain": membrane_strain, + "curvature": curvature, + "transverse_shear_strain": transverse_shear_strain, + "membrane_resultants": membrane_resultants, + "bending_resultants": bending_resultants, + "transverse_shear_resultants": transverse_shear_resultants, + } + if return_global: + results.update( + { + "global_membrane_resultant_tensors": global_membrane, + "global_bending_resultant_tensors": global_bending, + "global_transverse_shear_resultants": global_shear, + } + ) + return results + + def compute_stresses( + self, + mesh: "FEMesh", + displacements: np.ndarray, + material: "Material", + return_global: bool = False, + *, + natural_points=None, + ) -> Dict[str, Any]: + if self.shell_section is not None: + if natural_points is not None: + raise ValueError('custom stress points are unsupported for generalized shell sections') + return self._compute_generalized_section_results( + mesh, + displacements, + return_global=return_global, + ) + coords = self.get_node_coordinates(mesh) + u_elem_global = self._get_element_displacements(mesh, displacements) + symmetry = _elastic_symmetry(material) + h = self.thickness + kappa = 5.0 / 6.0 + + recovery_points=self.gauss_points if natural_points is None else np.asarray(natural_points,dtype=float) + if natural_points is not None and (recovery_points.ndim!=2 or recovery_points.shape[1]!=2 or len(recovery_points)==0 or not np.all(np.isfinite(recovery_points)) or np.any(np.abs(recovery_points)>1)): + raise ValueError('natural stress points must be nonempty finite Nx2 in [-1,1]') + num_ip = len(recovery_points) + stresses: Dict[str, np.ndarray] = { + "membrane_xx": np.zeros(num_ip), + "membrane_yy": np.zeros(num_ip), + "membrane_xy": np.zeros(num_ip), + "bending_xx": np.zeros(num_ip), + "bending_yy": np.zeros(num_ip), + "bending_xy": np.zeros(num_ip), + "shear_xz": np.zeros(num_ip), + "shear_yz": np.zeros(num_ip), + "von_mises": np.zeros(num_ip), + "equivalent_stress": np.zeros(num_ip), + "hill_utilization": np.zeros(num_ip), + } + stresses["equivalent_stress_measure"] = ( + "hill48" if symmetry == "orthotropic" and getattr(material, "hill_yield", None) is not None + else "von_mises" + ) + if return_global: + stresses.update({ + "local_xx_top": np.zeros(num_ip), + "local_yy_top": np.zeros(num_ip), + "local_zz_top": np.zeros(num_ip), + "local_xy_top": np.zeros(num_ip), + "local_yz_top": np.zeros(num_ip), + "local_xz_top": np.zeros(num_ip), + "local_xx_bot": np.zeros(num_ip), + "local_yy_bot": np.zeros(num_ip), + "local_zz_bot": np.zeros(num_ip), + "local_xy_bot": np.zeros(num_ip), + "local_yz_bot": np.zeros(num_ip), + "local_xz_bot": np.zeros(num_ip), + "global_xx_top": np.zeros(num_ip), + "global_yy_top": np.zeros(num_ip), + "global_zz_top": np.zeros(num_ip), + "global_xy_top": np.zeros(num_ip), + "global_yz_top": np.zeros(num_ip), + "global_xz_top": np.zeros(num_ip), + "global_xx_bot": np.zeros(num_ip), + "global_yy_bot": np.zeros(num_ip), + "global_zz_bot": np.zeros(num_ip), + "global_xy_bot": np.zeros(num_ip), + "global_yz_bot": np.zeros(num_ip), + "global_xz_bot": np.zeros(num_ip), + }) + + mitc_planar = None + mitc_samples = None + mitc_u_local = None + tri3_B_s = None + tri3_u_local = None + if self._is_4node: + R_center = self._center_frame(coords) + _Q_center, G_center, _strain_center, _stress_center = _shell_material_matrices( + material, + self._material_angle(R_center), + ) + mitc_planar, mitc_samples = self._mitc4_shear_samples(coords, R_center) + mitc_u_local = self._local_dof_transform(R_center) @ u_elem_global + elif self._is_3node: + R_center = self._center_frame(coords) + _Q_center, G_center, _strain_center, _stress_center = _shell_material_matrices( + material, + self._material_angle(R_center), + ) + tri3_B_s, _ = self._tri3_assumed_shear_b_matrix(coords, R_center) + tri3_u_local = self._local_dof_transform(R_center) @ u_elem_global + + from .recovery_shell_frames import native_recovery_frames + + frames = native_recovery_frames(self, coords, recovery_points, material) + for idx, (xi, eta) in enumerate(recovery_points): + if frames is None: + N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) + R, dN_dx, dN_dy, _ = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) + else: + N, R, dN_dx, dN_dy = frames[idx] + Q_local, G_local, _strain_to_material, stress_to_local = _shell_material_matrices( + material, + self._material_angle(R), + ) + T = self._local_dof_transform(R) + u_local = T @ u_elem_global + B_m, B_b, B_s = self._build_shell_b_matrices(N, dN_dx, dN_dy) + membrane_strain = B_m @ u_local + curvature = B_b @ u_local + if self._is_4node: + B_s_mitc, _ = self._mitc4_shear_b_matrix(mitc_planar, mitc_samples, float(xi), float(eta)) + shear_strain = B_s_mitc @ mitc_u_local + elif self._is_3node: + shear_strain = tri3_B_s @ tri3_u_local + else: + shear_strain = B_s @ u_local + + sigma_m = Q_local @ membrane_strain + moments = (h**3 / 12.0 * Q_local) @ curvature + sigma_b = 6.0 * moments / max(h**2, _SMALL) + shear_matrix = G_center if self._is_4node or self._is_3node else G_local + tau_s = kappa * shear_matrix @ shear_strain + + stresses["membrane_xx"][idx] = sigma_m[0] + stresses["membrane_yy"][idx] = sigma_m[1] + stresses["membrane_xy"][idx] = sigma_m[2] + stresses["bending_xx"][idx] = sigma_b[0] + stresses["bending_yy"][idx] = sigma_b[1] + stresses["bending_xy"][idx] = sigma_b[2] + stresses["shear_xz"][idx] = tau_s[0] + stresses["shear_yz"][idx] = tau_s[1] + + # Top surface (z = +h/2) + sigma_x_top = sigma_m[0] + sigma_b[0] + sigma_y_top = sigma_m[1] + sigma_b[1] + tau_xy_top = sigma_m[2] + sigma_b[2] + vm_top = np.sqrt( + sigma_x_top**2 + sigma_y_top**2 - sigma_x_top * sigma_y_top + 3.0 * (tau_xy_top**2 + tau_s[0]**2 + tau_s[1]**2) + ) + + # Bottom surface (z = -h/2) + sigma_x_bot = sigma_m[0] - sigma_b[0] + sigma_y_bot = sigma_m[1] - sigma_b[1] + tau_xy_bot = sigma_m[2] - sigma_b[2] + vm_bot = np.sqrt( + sigma_x_bot**2 + sigma_y_bot**2 - sigma_x_bot * sigma_y_bot + 3.0 * (tau_xy_bot**2 + tau_s[0]**2 + tau_s[1]**2) + ) + + stresses["von_mises"][idx] = max(vm_top, vm_bot) + hill_yield = getattr(material, "hill_yield", None) + if hill_yield is not None: + from .plasticity import hill48_plane_stress_equivalent_stress + + top_material = np.linalg.solve(stress_to_local, np.array( + [sigma_x_top, sigma_y_top, tau_xy_top], + dtype=float, + )) + bottom_material = np.linalg.solve(stress_to_local, np.array( + [sigma_x_bot, sigma_y_bot, tau_xy_bot], + dtype=float, + )) + hill_values = hill48_plane_stress_equivalent_stress( + np.vstack((top_material, bottom_material)), + hill_yield, + ) + equivalent = float(np.max(hill_values)) + stresses["equivalent_stress"][idx] = equivalent + stresses["hill_utilization"][idx] = equivalent / max(float(hill_yield.X), _SMALL) + else: + stresses["equivalent_stress"][idx] = stresses["von_mises"][idx] + + if return_global: + # Top local stress tensor + sigma_loc_top = np.array([ + [sigma_x_top, tau_xy_top, tau_s[0]], + [tau_xy_top, sigma_y_top, tau_s[1]], + [tau_s[0], tau_s[1], 0.0] + ], dtype=float) + sigma_glob_top = R @ sigma_loc_top @ R.T + + # Bottom local stress tensor + sigma_loc_bot = np.array([ + [sigma_x_bot, tau_xy_bot, tau_s[0]], + [tau_xy_bot, sigma_y_bot, tau_s[1]], + [tau_s[0], tau_s[1], 0.0] + ], dtype=float) + sigma_glob_bot = R @ sigma_loc_bot @ R.T + + # Store local components + stresses["local_xx_top"][idx] = sigma_x_top + stresses["local_yy_top"][idx] = sigma_y_top + stresses["local_zz_top"][idx] = 0.0 + stresses["local_xy_top"][idx] = tau_xy_top + stresses["local_xz_top"][idx] = tau_s[0] + stresses["local_yz_top"][idx] = tau_s[1] + + stresses["local_xx_bot"][idx] = sigma_x_bot + stresses["local_yy_bot"][idx] = sigma_y_bot + stresses["local_zz_bot"][idx] = 0.0 + stresses["local_xy_bot"][idx] = tau_xy_bot + stresses["local_xz_bot"][idx] = tau_s[0] + stresses["local_yz_bot"][idx] = tau_s[1] + + # Store global components + stresses["global_xx_top"][idx] = sigma_glob_top[0, 0] + stresses["global_yy_top"][idx] = sigma_glob_top[1, 1] + stresses["global_zz_top"][idx] = sigma_glob_top[2, 2] + stresses["global_xy_top"][idx] = sigma_glob_top[0, 1] + stresses["global_xz_top"][idx] = sigma_glob_top[0, 2] + stresses["global_yz_top"][idx] = sigma_glob_top[1, 2] + + stresses["global_xx_bot"][idx] = sigma_glob_bot[0, 0] + stresses["global_yy_bot"][idx] = sigma_glob_bot[1, 1] + stresses["global_zz_bot"][idx] = sigma_glob_bot[2, 2] + stresses["global_xy_bot"][idx] = sigma_glob_bot[0, 1] + stresses["global_xz_bot"][idx] = sigma_glob_bot[0, 2] + stresses["global_yz_bot"][idx] = sigma_glob_bot[1, 2] + return stresses + + +def _publish_shell_element_public_signatures() -> None: + """Hide private runtime-guard hooks from the stable public API surface.""" + + from inspect import signature + + mass_signature = signature(ShellElement.compute_mass_matrix) + ShellElement.compute_mass_matrix.__signature__ = mass_signature.replace( + parameters=tuple( + parameter + for parameter in mass_signature.parameters.values() + if parameter.name != "_qualified_runtime_post_observation" + ) + ) + nonlinear_signature = signature(ShellElement.compute_nonlinear_response) + public_nonlinear_return = signature( + Element.compute_nonlinear_response + ).return_annotation + ShellElement.compute_nonlinear_response.__signature__ = ( + nonlinear_signature.replace( + parameters=tuple( + parameter + for parameter in nonlinear_signature.parameters.values() + if parameter.name + not in { + "_return_tangent_components", + "_qualified_runtime_post_observation", + } + ), + return_annotation=public_nonlinear_return, + ) + ) + + +_publish_shell_element_public_signatures() +del _publish_shell_element_public_signatures + + +def _install_strict_flat_s3_v2_legacy_dispatch_guards() -> None: + """Reject explicit base-method bypasses on the Stage-1 V2 candidate.""" + + from functools import wraps + from inspect import signature + + guard = _reject_strict_flat_s3_v2_legacy_dispatch + allowed = {"__init__", "dofs_per_node", "get_node_coordinates", "num_nodes"} + for name, original in tuple(vars(ShellElement).items()): + if name in allowed or name.startswith("__"): + continue + + if type(original) is property: + def wrap_accessor( + accessor: Optional[Callable[..., Any]], + label: str, + _guard: Callable[[Any, str], None] = guard, + ) -> Optional[Callable[..., Any]]: + if accessor is None: + return None + + @wraps(accessor) + def guarded_accessor(self: Any, *args: Any, **kwargs: Any) -> Any: + _guard(self, f"ShellElement.{label}") + return accessor(self, *args, **kwargs) + + guarded_accessor.__signature__ = signature(accessor) # type: ignore[attr-defined] + delattr(guarded_accessor, "__wrapped__") + return guarded_accessor + + setattr( + ShellElement, + name, + property( + wrap_accessor(original.fget, name), + wrap_accessor(original.fset, name), + wrap_accessor(original.fdel, name), + original.__doc__, + ), + ) + continue + if type(original) is not FunctionType: + continue + + @wraps(original) + def guarded( + self: Any, + *args: Any, + __name: str = name, + __original: Callable[..., Any] = original, + __guard: Callable[[Any, str], None] = guard, + **kwargs: Any, + ) -> Any: + __guard(self, f"ShellElement.{__name}") + return __original(self, *args, **kwargs) + + guarded.__signature__ = signature(original) # type: ignore[attr-defined] + delattr(guarded, "__wrapped__") + setattr(ShellElement, name, guarded) + + +_install_strict_flat_s3_v2_legacy_dispatch_guards() +del _install_strict_flat_s3_v2_legacy_dispatch_guards + +# Exact dispatch surface for the recovery-only quadrature frame optimization. +# Subclasses and instance/class overrides retain their scalar dispatch. +_SHELL_RECOVERY_FRAME_METHODS = tuple(vars(ShellElement).items()) +_SHELL_RECOVERY_BASE_METHODS = tuple(vars(Element).items()) +_SHELL_RECOVERY_MATERIAL_METHODS = tuple(vars(_RecoveryIsotropicMaterial).items()) +_SHELL_RECOVERY_FRAME_HELPERS = tuple((name, globals()[name]) for name in ( + "_cross3", "_inv2", "_shell_material_matrices", "_elastic_symmetry", + "_canonical_material_symmetry", "_guarded_observe_attribute", "_guarded_float", + "_jit_compute_8node_shape_functions", +)) + + +class BeamElement(Element): + """2-node Timoshenko beam element with 6 DOF per node. + + ``section=`` opts into a coupled generalized section. The same object may + be supplied under ``cross_section["generalized_section"]``; a raw matrix + is accepted under ``cross_section["generalized_stiffness"]``. Legacy + scalar cross-section dictionaries retain their historical formulation. + A generalized stiffness matrix does not define centroidal geometry, so + its Wagner torsional geometric-stiffness term is omitted by default. + Supply ``cross_section["geometric_polar_radius_squared"]`` in m^2 to opt in + explicitly. + """ + + def __init__( + self, + element_id: int, + node_ids: List[int], + material_name: str = "default", + cross_section: Optional[Dict[str, Any]] = None, + section: Any = None, + ): + super().__init__(element_id, node_ids, material_name) + if len(node_ids) != 2: + raise ValueError(f"BeamElement requires 2 nodes, got {len(node_ids)}") + self.cross_section = cross_section or {} + self._A = self.cross_section.get("area", 0.01) + self._Iy = self.cross_section.get("Iy", 1.0e-8) + self._Iz = self.cross_section.get("Iz", 1.0e-8) + self._J = self.cross_section.get("J", 1.0e-8) + self._ky = self.cross_section.get("shear_factor_y", 5.0 / 6.0) + self._kz = self.cross_section.get("shear_factor_z", 5.0 / 6.0) + self._orientation = _section_orientation(self.cross_section) + self._fiber_plasticity = self.cross_section.get("fiber_plasticity") + self.generalized_section = resolve_generalized_beam_section( + self.cross_section, + section, + ) + if self.generalized_section is not None and self._fiber_plasticity is not None: + raise ValueError( + "Generalized beam sections do not support " + "cross_section['fiber_plasticity']; supply an elastic section " + "without fiber plasticity." + ) + if self.generalized_section is not None: + self._geometric_polar_radius_squared() + self._geometric_nonlinearity = str( + self.cross_section.get("geometric_nonlinearity", self.cross_section.get("geometry", "von_karman")) + ).lower() + # Optional exact stress-recovery data; estimated from A and I if absent. + self._c_y = self.cross_section.get("c_y") + self._c_z = self.cross_section.get("c_z") + self._torsion_modulus = self.cross_section.get("torsion_modulus") + + def set_linear_nodal_offsets(self, offsets) -> None: + """Global node-to-centroid rigid arms for the linear static route only.""" + values=np.asarray(offsets,dtype=float) + if self.num_nodes!=2 or values.shape!=(2,3) or not np.all(np.isfinite(values)): + raise ValueError('linear beam offsets require two finite global vectors') + self._linear_nodal_offsets=values.copy() + + def _linear_rigid_arm_map(self) -> np.ndarray: + arm=np.eye(12) + for i,d in enumerate(getattr(self,'_linear_nodal_offsets',np.zeros((2,3)))): + x,y,z=d + arm[i*6:i*6+3,i*6+3:i*6+6]=np.array([[0,z,-y],[-z,0,x],[y,-x,0]]) + return arm + + def recover_linear_section_forces(self, mesh, displacements, material, stations): + """Global force/moment on a positive local-x cut; no beam distributed loads.""" + stations=np.asarray(stations,dtype=float) + if stations.ndim!=2 or stations.shape[1]!=3 or len(stations)==0 or not np.all(np.isfinite(stations)): + raise ValueError('beam stations must be nonempty finite Nx3 coordinates') + coords=self.get_node_coordinates(mesh) + length,transform=self._beam_frame_and_transform(coords) + local=transform@self._get_element_displacements(mesh,displacements) + end=self._local_linear_stiffness(length,material)@local + rotation=_beam_rotation_matrix((coords[1]-coords[0])/length,self._orientation) + output=[] + for station in stations: + distance=float(np.dot(station-coords[0],rotation[:,0])) + if distance < -1e-6 or distance>length+1e-6 or np.linalg.norm(station-(coords[0]+distance*rotation[:,0]))>1e-6: + raise ValueError('beam result station is not on physical centroid line') + force=-end[:3] + moment=-end[3:6]+np.cross([distance,0,0],end[:3]) + output.append(np.r_[rotation@force,rotation@moment]) + return np.asarray(output) + + def _refuse_offset_route(self, route): + if np.any(getattr(self,'_linear_nodal_offsets',0)): + raise ValueError(f'offset beam {route} is not admitted; linear static only') + + def _fiber_distances(self) -> Tuple[float, float]: + """Extreme fiber distances (local y, local z), estimated when not given.""" + c_y = self._c_y + c_z = self._c_z + if c_y is None or c_y <= 0.0: + c_y = np.sqrt(abs(self._Iz) / max(self._A, _SMALL)) * 2.0 + if c_z is None or c_z <= 0.0: + c_z = np.sqrt(abs(self._Iy) / max(self._A, _SMALL)) * 2.0 + return max(float(c_y), _SMALL), max(float(c_z), _SMALL) + + def _torsion_section_modulus(self) -> float: + """Torsional section modulus Wt with tau = T / Wt, estimated when not given.""" + wt = self._torsion_modulus + if wt is None or wt <= 0.0: + wt = 2.0 * self._A + return max(float(wt), _SMALL) + + def _geometric_polar_radius_squared(self) -> float: + """Return the section polar radius squared used by the Wagner term. + + The legacy scalar section defines this quantity as ``(Iy + Iz) / A``. + A generalized 6x6 stiffness does not uniquely define any of those + geometric quantities, even when legacy keys happen to be present for + mass fallback or other workflows. Generalized sections therefore + require an explicitly named geometric value and otherwise omit the + Wagner term. + """ + if self.generalized_section is None: + return (self._Iy + self._Iz) / max(self._A, 1.0e-30) + + value = self.cross_section.get("geometric_polar_radius_squared") + if value is None: + return 0.0 + try: + polar_radius_squared = float(value) + except (TypeError, ValueError) as exc: + raise ValueError( + "cross_section['geometric_polar_radius_squared'] must be a " + "finite non-negative value in m^2 for a generalized beam " + "section." + ) from exc + if ( + not np.isfinite(polar_radius_squared) + or polar_radius_squared < 0.0 + ): + raise ValueError( + "cross_section['geometric_polar_radius_squared'] must be a " + "finite non-negative value in m^2 for a generalized beam " + "section." + ) + return polar_radius_squared + + @property + def num_nodes(self) -> int: + return 2 + + @property + def dofs_per_node(self) -> int: + return 6 + + def get_node_coordinates(self, mesh: "FEMesh") -> np.ndarray: + coords = np.zeros((2, 3), dtype=float) + for i, node_id in enumerate(self.node_ids): + node = mesh.get_node(node_id) + if node is None: + raise ValueError(f"Beam element {self.element_id} references missing node {node_id}") + coords[i] = node.coords() + return coords+getattr(self,'_linear_nodal_offsets',0) + + def _beam_frame_and_transform(self, coords: np.ndarray) -> Tuple[float, np.ndarray]: + length = float(np.linalg.norm(coords[1] - coords[0])) + if length < _SMALL: + raise ValueError(f"Beam element {self.element_id} has near-zero length") + e1 = (coords[1] - coords[0]) / length + R = _beam_rotation_matrix(e1, self._orientation) + T = np.zeros((12, 12), dtype=float) + Rt = R.T + for i in range(2): + b = i * 6 + T[b:b + 3, b:b + 3] = Rt + T[b + 3:b + 6, b + 3:b + 6] = Rt + return length, T@self._linear_rigid_arm_map() + + def _local_linear_stiffness(self, length: float, material: "Material", include_axial: bool = True) -> np.ndarray: + L = float(length) + if self.generalized_section is not None: + section_stiffness = generalized_beam_stiffness( + self.generalized_section + ) + basic_transform = _beam2_basic_deformation_matrix(L) + if not include_axial: + basic_transform = basic_transform.copy() + basic_transform[0, :] = 0.0 + _flexibility, basic_stiffness = ( + _beam2_generalized_flexibility(L, section_stiffness) + ) + # Force-based integration satisfies beam equilibrium exactly and + # avoids shear locking. For a diagonal section matrix this + # reduces to the historical closed-form Timoshenko stiffness; + # off-diagonal terms retain all generalized couplings. + return ( + basic_transform.T + @ basic_stiffness + @ basic_transform + ) + E, G12, G13, GJ = _beam_material_properties(material, self.cross_section) + EA = E * self._A + EIy = E * self._Iy + EIz = E * self._Iz + K = np.zeros((12, 12), dtype=float) + if include_axial: + K[0, 0] = K[6, 6] = EA / L + K[0, 6] = K[6, 0] = -EA / L + + # Bending about local y: deflection w (local z), rotation ry, EIy, + # Timoshenko shear parameter from the local-z shear area. + phi_w = 12.0 * EIy / max(G13 * self._A * self._kz * L**2, _SMALL) + K[2, 2] = K[8, 8] = 12.0 * EIy / (L**3 * (1.0 + phi_w)) + K[2, 8] = K[8, 2] = -K[2, 2] + K[2, 4] = K[4, 2] = -6.0 * EIy / (L**2 * (1.0 + phi_w)) + K[2, 10] = K[10, 2] = K[2, 4] + K[8, 4] = K[4, 8] = -K[2, 4] + K[8, 10] = K[10, 8] = -K[2, 4] + K[4, 4] = K[10, 10] = (4.0 + phi_w) * EIy / (L * (1.0 + phi_w)) + K[4, 10] = K[10, 4] = (2.0 - phi_w) * EIy / (L * (1.0 + phi_w)) + + # Bending about local z: deflection v (local y), rotation rz, EIz, + # Timoshenko shear parameter from the local-y shear area. + phi_v = 12.0 * EIz / max(G12 * self._A * self._ky * L**2, _SMALL) + K[1, 1] = K[7, 7] = 12.0 * EIz / (L**3 * (1.0 + phi_v)) + K[1, 7] = K[7, 1] = -K[1, 1] + K[1, 5] = K[5, 1] = 6.0 * EIz / (L**2 * (1.0 + phi_v)) + K[1, 11] = K[11, 1] = 6.0 * EIz / (L**2 * (1.0 + phi_v)) + K[7, 5] = K[5, 7] = -6.0 * EIz / (L**2 * (1.0 + phi_v)) + K[7, 11] = K[11, 7] = -6.0 * EIz / (L**2 * (1.0 + phi_v)) + K[5, 5] = K[11, 11] = (4.0 + phi_v) * EIz / (L * (1.0 + phi_v)) + K[5, 11] = K[11, 5] = (2.0 - phi_v) * EIz / (L * (1.0 + phi_v)) + + K[3, 3] = K[9, 9] = GJ / L + K[3, 9] = K[9, 3] = -GJ / L + return K + + def compute_stiffness_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: + coords = self.get_node_coordinates(mesh) + try: + L, T = self._beam_frame_and_transform(coords) + except ValueError: + if np.any(getattr(self,'_linear_nodal_offsets',0)): + raise + return np.zeros((self.total_dofs, self.total_dofs)) + K = self._local_linear_stiffness(L, material) + K_global = T.T @ K @ T + self._stiffness_matrix = K_global + return K_global + + def compute_mass_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: + self._refuse_offset_route('mass/dynamics') + coords = self.get_node_coordinates(mesh) + try: + L, T = self._beam_frame_and_transform(coords) + except ValueError: + return np.zeros((self.total_dofs, self.total_dofs)) + generalized_mass = ( + None + if self.generalized_section is None + else generalized_beam_mass_matrix(self.generalized_section) + ) + if generalized_mass is not None: + # Exact consistent integration of the linear interpolation. A + # full sectional inertia matrix may include centre-of-mass or + # product-of-inertia translation/rotation coupling, so diagonal + # lumping would discard part of the supplied constitutive data. + interpolation_mass = np.array( + [[1.0 / 3.0, 1.0 / 6.0], [1.0 / 6.0, 1.0 / 3.0]], + dtype=float, + ) + M = np.zeros((12, 12), dtype=float) + for i in range(2): + for j in range(2): + M[ + i * 6 : (i + 1) * 6, + j * 6 : (j + 1) * 6, + ] = interpolation_mass[i, j] * L * generalized_mass + M_global = T.T @ M @ T + self._mass_matrix = M_global + return M_global + rho = material.density + M = np.zeros((12, 12), dtype=float) + if bool(self.cross_section.get("consistent_mass", False)): + # Consistent mass on the element's own linear interpolation, + # mirroring the 3-node quadratic beam: N_i N_j blocks for the + # translations (rho A) and for each rotation with its matching + # section inertia (polar Iy+Iz for torsion). Rigid-body + # translational and rotational inertia are exact, so no lumped + # bar-length correction terms are needed. + coupling = np.array([[1.0 / 3.0, 1.0 / 6.0], [1.0 / 6.0, 1.0 / 3.0]], dtype=float) + rotary_density = ( + rho * (self._Iy + self._Iz), # rx (torsion) + rho * self._Iy, # ry + rho * self._Iz, # rz + ) + for i in range(2): + for j in range(2): + factor = coupling[i, j] * L + for d in range(3): + M[i * 6 + d, j * 6 + d] = rho * self._A * factor + M[i * 6 + 3 + d, j * 6 + 3 + d] = rotary_density[d] * factor + M_global = T.T @ M @ T + self._mass_matrix = M_global + return M_global + mass_per_node = rho * self._A * L / 2.0 + # Lumped rotary inertia: bending rotations carry the rigid-bar term + # rho*A*L^3/24 plus the section rotatory term rho*I*L/2; the torsion + # DOF carries the polar section inertia rho*(Iy+Iz)*L/2, not a + # bar-length term, because spinning about the member axis does not + # translate the distributed mass. + rotary_bar = mass_per_node * L**2 / 12.0 + rotary = ( + rho * (self._Iy + self._Iz) * L / 2.0, # rx (torsion) + rotary_bar + rho * self._Iy * L / 2.0, # ry + rotary_bar + rho * self._Iz * L / 2.0, # rz + ) + for i in range(2): + b = i * 6 + for d in range(3): + M[b + d, b + d] = mass_per_node + M[b + 3 + d, b + 3 + d] = rotary[d] + M_global = T.T @ M @ T + self._mass_matrix = M_global + return M_global + + @staticmethod + def _axial_compression_from_state(state: Optional[Any]) -> float: + """Return positive compression from a user/reference element state.""" + if state is None: + return 0.0 + if isinstance(state, (int, float, np.number)): + return float(state) + if not isinstance(state, dict): + return 0.0 + + for key in ("axial_compression", "compression", "N_compression"): + if key in state: + return float(state[key]) + + for key in ("axial_force", "N", "reference_axial_force"): + if key in state: + # Stress recovery uses positive axial strain/stress in tension, + # so a negative axial force is destabilizing compression. + return -float(state[key]) + return 0.0 + + def compute_geometric_stiffness_matrix( + self, + mesh: "FEMesh", + material: "Material", + state: Optional[Any] = None, + ) -> np.ndarray: + """ + Beam-column geometric stiffness for an axial reference compression. + + The returned matrix follows ``K phi = lambda KG phi``. A positive + ``axial_compression`` in ``state`` therefore produces a positive + destabilizing ``KG``. + """ + self._refuse_offset_route('geometric stiffness') + axial_compression = self._axial_compression_from_state(state) + if axial_compression == 0.0: + return np.zeros((self.total_dofs, self.total_dofs), dtype=float) + + coords = self.get_node_coordinates(mesh) + try: + L, T = self._beam_frame_and_transform(coords) + except ValueError: + return np.zeros((self.total_dofs, self.total_dofs), dtype=float) + + factor = axial_compression / (30.0 * L) + L2 = L * L + g_standard = factor * np.array( + [ + [36.0, 3.0 * L, -36.0, 3.0 * L], + [3.0 * L, 4.0 * L2, -3.0 * L, -L2], + [-36.0, -3.0 * L, 36.0, -3.0 * L], + [3.0 * L, -L2, -3.0 * L, 4.0 * L2], + ], + dtype=float, + ) + + K_geo = np.zeros((12, 12), dtype=float) + v_rz = [1, 5, 7, 11] + w_ry = [2, 4, 8, 10] + sign_w = np.diag([1.0, -1.0, 1.0, -1.0]) + g_w = sign_w @ g_standard @ sign_w + + for i, row in enumerate(v_rz): + for j, col in enumerate(v_rz): + K_geo[row, col] += g_standard[i, j] + for i, row in enumerate(w_ry): + for j, col in enumerate(w_ry): + K_geo[row, col] += g_w[i, j] + + # Wagner term: axial compression destabilizes twist about the shear + # center, enabling torsional and flexural-torsional column modes + # (stiffener tripping under axial stress). The shear center is taken + # at the centroid and warping is neglected, consistent with the + # element's St. Venant torsion treatment, so the torsional critical + # load is G*J*A/Ip. + polar_ratio = self._geometric_polar_radius_squared() + g_torsion = axial_compression * polar_ratio / L + K_geo[3, 3] += g_torsion + K_geo[3, 9] -= g_torsion + K_geo[9, 3] -= g_torsion + K_geo[9, 9] += g_torsion + + return T.T @ K_geo @ T + + def _fiber_plasticity_config(self, material: "Material") -> Optional[FiberSectionPlasticityConfig]: + config = self._fiber_plasticity + if config is None: + return None + if isinstance(config, dict): + config = FiberSectionPlasticityConfig(**config) + elif config is True: + config = FiberSectionPlasticityConfig() + elif not isinstance(config, FiberSectionPlasticityConfig): + raise TypeError("cross_section['fiber_plasticity'] must be a FiberSectionPlasticityConfig, dict or True") + curve = config.material_curve or getattr(material, "hardening_curve", None) + if curve is None: + if ( + _elastic_symmetry(material) == "orthotropic" + and getattr(material, "hill_yield", None) is not None + ): + # Hill X supplies an elastic-perfectly-plastic longitudinal + # fiber law when no scalar hardening curve is provided. + return config + return None + if config.material_curve is curve: + return config + return FiberSectionPlasticityConfig(config.num_y, config.num_z, curve) + + def _fiber_section_grid(self, config: FiberSectionPlasticityConfig) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + cross = self.cross_section if isinstance(getattr(self, "cross_section", None), dict) else {} + web_height = float(cross.get("web_height") or 0.0) + web_thickness = float(cross.get("web_thickness") or 0.0) + flange_width = float(cross.get("flange_width") or 0.0) + flange_thickness = float(cross.get("flange_thickness") or 0.0) + shaped = ( + web_height > 0.0 + and web_thickness > 0.0 + and flange_width > 0.0 + and flange_thickness > 0.0 + ) + key = ( + "fiber_grid", + int(config.num_y), + int(config.num_z), + float(self._A), + float(self._Iy), + float(self._Iz), + round(web_height, 12), + round(web_thickness, 12), + round(flange_width, 12), + round(flange_thickness, 12), + ) + cache = getattr(self, "_fiber_grid_cache", None) + if cache is not None and cache.get("key") == key: + return cache["y"], cache["z"], cache["weights"] + + if shaped: + # Profile-true fiber layout: web and flange strips follow the real + # T/L section geometry so the plastification order (flange tips vs + # web) is captured. The coordinates and weights are afterwards + # recentred and rescaled to reproduce the section constants + # A/Iy/Iz exactly, keeping the elastic response identical to the + # section-property idealization. Flanges are laid out symmetric + # in y also for L profiles (the section constants carry no product + # of inertia). + n_web = max(int(config.num_z), 3) + n_flange = max(int(config.num_y), 3) + web_z = (np.arange(n_web, dtype=float) + 0.5) * (web_height / n_web) + y_parts = [np.zeros(n_web)] + z_parts = [web_z] + weight_parts = [np.full(n_web, web_height * web_thickness / n_web)] + flange_y = (np.arange(n_flange, dtype=float) + 0.5) * (flange_width / n_flange) - 0.5 * flange_width + for z_level in (web_height + 0.25 * flange_thickness, web_height + 0.75 * flange_thickness): + y_parts.append(flange_y.copy()) + z_parts.append(np.full(n_flange, z_level)) + weight_parts.append(np.full(n_flange, flange_width * flange_thickness / (2 * n_flange))) + y = np.concatenate(y_parts) + z = np.concatenate(z_parts) + weights = np.concatenate(weight_parts) + total = float(np.sum(weights)) + if total > _SMALL and self._A > 0.0: + weights *= float(self._A) / total + area = float(np.sum(weights)) + if area > _SMALL: + y = y - float(np.sum(weights * y)) / area + z = z - float(np.sum(weights * z)) / area + else: + raw_y = np.linspace(-1.0, 1.0, int(config.num_y)) if config.num_y > 1 else np.zeros(1) + raw_z = np.linspace(-1.0, 1.0, int(config.num_z)) if config.num_z > 1 else np.zeros(1) + yy, zz = np.meshgrid(raw_y, raw_z, indexing="ij") + y = yy.reshape(-1) + z = zz.reshape(-1) + weights = np.full(y.size, float(self._A) / max(y.size, 1), dtype=float) + + denom_y = float(np.sum(weights * y * y)) + denom_z = float(np.sum(weights * z * z)) + if denom_y > _SMALL and self._Iz > 0.0: + y *= np.sqrt(float(self._Iz) / denom_y) + else: + y *= 0.0 + if denom_z > _SMALL and self._Iy > 0.0: + z *= np.sqrt(float(self._Iy) / denom_z) + else: + z *= 0.0 + + self._fiber_grid_cache = {"key": key, "y": y, "z": z, "weights": weights} + return y, z, weights + + @staticmethod + def _uniaxial_return_map( + strain: np.ndarray, + state: Optional[Any], + E: float, + curve: Any, + flow_scale: float = 1.0, + ) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]: + strain = np.asarray(strain, dtype=float).reshape(-1) + n = strain.size + if isinstance(state, dict) and np.asarray(state.get("plastic_strain", [])).size == n: + plastic_old = np.asarray(state["plastic_strain"], dtype=float).reshape(-1) + alpha_old = np.asarray(state.get("alpha", np.zeros(n)), dtype=float).reshape(-1) + if alpha_old.size == 1: + alpha_old = np.full(n, float(alpha_old[0]), dtype=float) + elif alpha_old.size != n: + raise ValueError( + f"Beam fiber alpha has {alpha_old.size} entries; expected 1 or {n}" + ) + else: + plastic_old = np.zeros(n, dtype=float) + alpha_old = np.zeros(n, dtype=float) + + trial = E * (strain - plastic_old) + abs_trial = np.abs(trial) + scale = float(flow_scale) + if not np.isfinite(scale) or scale <= 0.0: + raise ValueError("beam fiber flow_scale must be positive") + flow_old = ( + np.full(n, scale, dtype=float) + if curve is None + else scale * curve.flow_stress(alpha_old) + ) + yielding = abs_trial > flow_old + 1.0e-9 * np.maximum(flow_old, 1.0) + + stress = trial.copy() + tangent = np.full(n, E, dtype=float) + plastic_new = plastic_old.copy() + alpha_new = alpha_old.copy() + if not np.any(yielding): + return stress, tangent, plastic_new, alpha_new + + indices = np.where(yielding)[0] + for idx in indices: + sign = 1.0 if trial[idx] >= 0.0 else -1.0 + dgamma = 0.0 + lower = 0.0 + upper = abs_trial[idx] / E + H = ( + 0.0 + if curve is None + else scale + * float( + curve.hardening_modulus(np.array([alpha_old[idx]]))[0] + ) + ) + converged = False + for _ in range(30): + alpha_trial = alpha_old[idx] + dgamma + if curve is None: + sy = scale + H = 0.0 + else: + sy = scale * float( + curve.flow_stress(np.array([alpha_trial]))[0] + ) + H = scale * float( + curve.hardening_modulus(np.array([alpha_trial]))[0] + ) + residual = abs_trial[idx] - E * dgamma - sy + # At very large trial strains, ``abs_trial - E * dgamma`` + # loses several hundred pascals to floating-point cancellation. + # Do not demand a residual below the resolution of the terms + # being subtracted. The physical tolerance remains governing + # for ordinary structural strain ranges. + roundoff_tolerance = 16.0 * np.finfo(float).eps * max( + abs_trial[idx], abs(E * dgamma), abs(sy), 1.0 + ) + convergence_tolerance = max( + 1.0e-8 * max(abs(sy), 1.0), roundoff_tolerance + ) # Yield entry is tighter than the closure tolerance. A point # admitted as yielding must take a positive return update # before reporting a plastic tangent; otherwise its unchanged # elastic stress has derivative E, not E*H/(E+H). if dgamma > 0.0 and abs(residual) <= convergence_tolerance: - converged = True - break - if residual > 0.0: - lower = dgamma - else: - upper = dgamma - newton = dgamma + residual / max(E + H, _SMALL) - if ( - not np.isfinite(newton) - or newton <= lower - or newton >= upper - ): - newton = 0.5 * (lower + upper) - dgamma = newton - if not converged: - raise RuntimeError( - "Beam fiber return mapping did not converge after 30 iterations" - ) - stress[idx] = sign * max(abs_trial[idx] - E * dgamma, 0.0) - plastic_new[idx] = plastic_old[idx] + sign * dgamma - alpha_new[idx] = alpha_old[idx] + dgamma - tangent[idx] = E * H / max(E + H, _SMALL) - return stress, tangent, plastic_new, alpha_new - - def _compute_fiber_nonlinear_response( - self, - mesh: "FEMesh", - material: "Material", - u_elem: np.ndarray, - state: Optional[Any], - config: FiberSectionPlasticityConfig, - tangent: bool, - ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: - coords = self.get_node_coordinates(mesh) - L, T = self._beam_frame_and_transform(coords) - u_loc = T @ np.asarray(u_elem, dtype=float) - E, G12, G13, GJ = _beam_material_properties(material, self.cross_section) - y, z, weights = self._fiber_section_grid(config) - - du = u_loc[6] - u_loc[0] - dv = u_loc[7] - u_loc[1] - dw = u_loc[8] - u_loc[2] - eps0 = du / L + (dv**2 + dw**2) / (2.0 * L**2) - kappa_y = (u_loc[10] - u_loc[4]) / L - kappa_z = (u_loc[11] - u_loc[5]) / L - fiber_strain = eps0 + z * kappa_y + y * kappa_z - initial_state = _copy_state_fields(state, _INITIAL_BEAM_STATE_KEYS) - initial_stress = _beam_fiber_field( - initial_state.get("initial_fiber_stress", 0.0), - fiber_strain.size, - fiber_strain.size, - "initial_fiber_stress", - ) - initial_prestrain = _beam_fiber_field( - initial_state.get("initial_fiber_prestrain", 0.0), - fiber_strain.size, - fiber_strain.size, - "initial_fiber_prestrain", - ) - constitutive_fiber_strain = fiber_strain - initial_prestrain + initial_stress / E - stress, Et, plastic_new, alpha_new = self._uniaxial_return_map( - constitutive_fiber_strain, - state, - E, - config.material_curve, - _beam_flow_scale(material, config.material_curve), - ) - - B = np.zeros((fiber_strain.size, 12), dtype=float) - B[:, 0] = -1.0 / L - B[:, 6] = 1.0 / L - B[:, 1] = -dv / L**2 - B[:, 7] = dv / L**2 - B[:, 2] = -dw / L**2 - B[:, 8] = dw / L**2 - B[:, 4] = -z / L - B[:, 10] = z / L - B[:, 5] = -y / L - B[:, 11] = y / L - - F_loc = L * np.einsum("i,i,ij->j", weights, stress, B) - K_loc = None - if tangent: - K_loc = L * np.einsum("i,i,ij,ik->jk", weights, Et, B, B) - - N_force = float(np.sum(weights * stress)) - if tangent: - string = N_force / L - for a, b in ((1, 7), (2, 8)): - K_loc[a, a] += string - K_loc[b, b] += string - K_loc[a, b] -= string - K_loc[b, a] -= string - - B_shear_y = np.zeros(12, dtype=float) - B_shear_y[1], B_shear_y[7] = -1.0 / L, 1.0 / L - B_shear_y[5], B_shear_y[11] = -0.5, -0.5 - B_shear_z = np.zeros(12, dtype=float) - B_shear_z[2], B_shear_z[8] = -1.0 / L, 1.0 / L - B_shear_z[4], B_shear_z[10] = 0.5, 0.5 - B_torsion = np.zeros(12, dtype=float) - B_torsion[3], B_torsion[9] = -1.0 / L, 1.0 / L + converged = True + break + if residual > 0.0: + lower = dgamma + else: + upper = dgamma + newton = dgamma + residual / max(E + H, _SMALL) + if ( + not np.isfinite(newton) + or newton <= lower + or newton >= upper + ): + newton = 0.5 * (lower + upper) + dgamma = newton + if not converged: + raise RuntimeError( + "Beam fiber return mapping did not converge after 30 iterations" + ) + stress[idx] = sign * max(abs_trial[idx] - E * dgamma, 0.0) + plastic_new[idx] = plastic_old[idx] + sign * dgamma + alpha_new[idx] = alpha_old[idx] + dgamma + tangent[idx] = E * H / max(E + H, _SMALL) + return stress, tangent, plastic_new, alpha_new + + def _compute_fiber_nonlinear_response( + self, + mesh: "FEMesh", + material: "Material", + u_elem: np.ndarray, + state: Optional[Any], + config: FiberSectionPlasticityConfig, + tangent: bool, + ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: + coords = self.get_node_coordinates(mesh) + L, T = self._beam_frame_and_transform(coords) + u_loc = T @ np.asarray(u_elem, dtype=float) + E, G12, G13, GJ = _beam_material_properties(material, self.cross_section) + y, z, weights = self._fiber_section_grid(config) + + du = u_loc[6] - u_loc[0] + dv = u_loc[7] - u_loc[1] + dw = u_loc[8] - u_loc[2] + eps0 = du / L + (dv**2 + dw**2) / (2.0 * L**2) + kappa_y = (u_loc[10] - u_loc[4]) / L + kappa_z = (u_loc[11] - u_loc[5]) / L + fiber_strain = eps0 + z * kappa_y + y * kappa_z + initial_state = _copy_state_fields(state, _INITIAL_BEAM_STATE_KEYS) + initial_stress = _beam_fiber_field( + initial_state.get("initial_fiber_stress", 0.0), + fiber_strain.size, + fiber_strain.size, + "initial_fiber_stress", + ) + initial_prestrain = _beam_fiber_field( + initial_state.get("initial_fiber_prestrain", 0.0), + fiber_strain.size, + fiber_strain.size, + "initial_fiber_prestrain", + ) + constitutive_fiber_strain = fiber_strain - initial_prestrain + initial_stress / E + stress, Et, plastic_new, alpha_new = self._uniaxial_return_map( + constitutive_fiber_strain, + state, + E, + config.material_curve, + _beam_flow_scale(material, config.material_curve), + ) + + B = np.zeros((fiber_strain.size, 12), dtype=float) + B[:, 0] = -1.0 / L + B[:, 6] = 1.0 / L + B[:, 1] = -dv / L**2 + B[:, 7] = dv / L**2 + B[:, 2] = -dw / L**2 + B[:, 8] = dw / L**2 + B[:, 4] = -z / L + B[:, 10] = z / L + B[:, 5] = -y / L + B[:, 11] = y / L + + F_loc = L * np.einsum("i,i,ij->j", weights, stress, B) + K_loc = None + if tangent: + K_loc = L * np.einsum("i,i,ij,ik->jk", weights, Et, B, B) + + N_force = float(np.sum(weights * stress)) + if tangent: + string = N_force / L + for a, b in ((1, 7), (2, 8)): + K_loc[a, a] += string + K_loc[b, b] += string + K_loc[a, b] -= string + K_loc[b, a] -= string + + B_shear_y = np.zeros(12, dtype=float) + B_shear_y[1], B_shear_y[7] = -1.0 / L, 1.0 / L + B_shear_y[5], B_shear_y[11] = -0.5, -0.5 + B_shear_z = np.zeros(12, dtype=float) + B_shear_z[2], B_shear_z[8] = -1.0 / L, 1.0 / L + B_shear_z[4], B_shear_z[10] = 0.5, 0.5 + B_torsion = np.zeros(12, dtype=float) + B_torsion[3], B_torsion[9] = -1.0 / L, 1.0 / L # The one-section fiber state resolves constant curvature. The # remaining elastic curvature/shear compliance must be condensed just # as in _local_linear_stiffness: 1/S_eff = 1/S + L^2/(12*EI). @@ -4441,978 +4441,978 @@ def _compute_fiber_nonlinear_response( phi_z = 12.0 * E * self._Iy / max(G13 * self._A * self._kz * L**2, _SMALL) shear_y = 12.0 * E * self._Iz / (L**2 * (1.0 + phi_y)) shear_z = 12.0 * E * self._Iy / (L**2 * (1.0 + phi_z)) - K_aux = L * ( + K_aux = L * ( shear_y * np.outer(B_shear_y, B_shear_y) + shear_z * np.outer(B_shear_z, B_shear_z) - + GJ * np.outer(B_torsion, B_torsion) - ) - F_loc += K_aux @ u_loc - if tangent: - K_loc += K_aux - - trial_state = { - "plastic_strain": plastic_new, - "alpha": alpha_new, - "fiber_strain": constitutive_fiber_strain.copy(), - "kinematic_fiber_strain": fiber_strain.copy(), - "fiber_stress": stress.copy(), - "axial_force": N_force, - "equivalent_stress_measure": ( - "hill48" if _elastic_symmetry(material) == "orthotropic" else "von_mises" - ), - **initial_state, - } - if not tangent: - return T.T @ F_loc, None, trial_state - return T.T @ F_loc, T.T @ K_loc @ T, trial_state - - def _current_beam_frame_and_transform(self, coords: np.ndarray, u_elem: np.ndarray) -> Tuple[float, np.ndarray, np.ndarray, np.ndarray]: - current = coords.copy() - current[0] += np.asarray(u_elem[0:3], dtype=float) - current[1] += np.asarray(u_elem[6:9], dtype=float) - length = float(np.linalg.norm(current[1] - current[0])) - if length < _SMALL: - raise ValueError(f"Beam element {self.element_id} has near-zero current length") - e1 = (current[1] - current[0]) / length - R = _beam_rotation_matrix(e1, self._orientation) - T = np.zeros((12, 12), dtype=float) - Rt = R.T - for i in range(2): - b = i * 6 - T[b:b + 3, b:b + 3] = Rt - T[b + 3:b + 6, b + 3:b + 6] = Rt - return length, T, R, current - - def _compute_corotational_nonlinear_response( - self, - mesh: "FEMesh", - material: "Material", - u_elem: np.ndarray, - state: Optional[Any], - tangent: bool, - ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: - """Elastic 2-node corotational beam response. - - The element frame follows the current chord. Rigid-body chord rotation - is subtracted from nodal rotations, so a finite rigid rotation with - matching nodal rotation vectors produces near-zero internal force. - """ - coords = self.get_node_coordinates(mesh) - L0, _T0 = self._beam_frame_and_transform(coords) - Lc, Tc, Rc, _current = self._current_beam_frame_and_transform(coords, np.asarray(u_elem, dtype=float)) - R0 = _beam_rotation_matrix((coords[1] - coords[0]) / L0, self._orientation) - rigid_rotation = _rotation_vector_from_matrix(Rc @ R0.T) - - u_global = np.asarray(u_elem, dtype=float).reshape(12) - q = np.zeros(12, dtype=float) - q[6] = Lc - L0 - q[3:6] = Rc.T @ (u_global[3:6] - rigid_rotation) - q[9:12] = Rc.T @ (u_global[9:12] - rigid_rotation) - - K_loc = self._local_linear_stiffness(L0, material) - F_loc = K_loc @ q - F_global = Tc.T @ F_loc - trial_state = { - "geometric_nonlinearity": "corotational", - "initial_length": float(L0), - "current_length": float(Lc), - "axial_extension": float(Lc - L0), - "rigid_rotation_vector": rigid_rotation.copy(), - "basic_deformation_norm": float(np.linalg.norm(q)), - } - if self.generalized_section is not None: - section_stiffness = generalized_beam_stiffness( - self.generalized_section - ) - basic_deformation = ( - _beam2_basic_deformation_matrix(L0) @ q - ) - _flexibility, basic_stiffness = ( - _beam2_generalized_flexibility( - L0, - section_stiffness, - ) - ) - basic_force = basic_stiffness @ basic_deformation - stations = np.array((-1.0, 0.0, 1.0), dtype=float) - generalized_resultant = np.asarray( - [ - _beam2_force_interpolation(L0, xi) @ basic_force - for xi in stations - ], - dtype=float, - ) - generalized_strain = ( - generalized_resultant - @ np.linalg.inv(section_stiffness).T - ) - trial_state.update( - { - "generalized_section": True, - "generalized_strain": generalized_strain.copy(), - "generalized_resultant": generalized_resultant.copy(), - "generalized_station_coordinates": stations, - "generalized_strain_order": GENERALIZED_BEAM_STRAIN_ORDER, - "generalized_resultant_order": ( - GENERALIZED_BEAM_RESULTANT_ORDER - ), - "axial_force": float( - np.mean(generalized_resultant[:, 0]) - ), - "recovery_scope": "section_resultants_only", - } - ) - if not tangent: - return F_global, None, trial_state - K_global = Tc.T @ K_loc @ Tc - return F_global, K_global, trial_state - - def _compute_generalized_von_karman_response( - self, - mesh: "FEMesh", - u_elem: np.ndarray, - state: Optional[Any], - tangent: bool, - ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: - """Coupled generalized-section response from one strain-energy law.""" - - coords = self.get_node_coordinates(mesh) - L, T = self._beam_frame_and_transform(coords) - u_loc = T @ np.asarray(u_elem, dtype=float) - basic_transform = _beam2_basic_deformation_matrix(L) - basic_deformation = basic_transform @ u_loc - dv = float(u_loc[7] - u_loc[1]) - dw = float(u_loc[8] - u_loc[2]) - basic_deformation[0] += (dv**2 + dw**2) / (2.0 * L) - basic_tangent = basic_transform.copy() - basic_tangent[0, 1], basic_tangent[0, 7] = -dv / L, dv / L - basic_tangent[0, 2], basic_tangent[0, 8] = -dw / L, dw / L - - section_stiffness = generalized_beam_stiffness( - self.generalized_section - ) - _flexibility, basic_stiffness = _beam2_generalized_flexibility( - L, - section_stiffness, - ) - basic_force = basic_stiffness @ basic_deformation - F_loc = basic_tangent.T @ basic_force - stations = np.array((-1.0, 0.0, 1.0), dtype=float) - generalized_resultant = np.asarray( - [ - _beam2_force_interpolation(L, xi) @ basic_force - for xi in stations - ], - dtype=float, - ) - generalized_strain = ( - generalized_resultant @ np.linalg.inv(section_stiffness).T - ) - trial_state = { - **(dict(state) if isinstance(state, dict) else {}), - "generalized_section": True, - "geometric_nonlinearity": "von_karman", - "generalized_strain": generalized_strain.copy(), - "generalized_resultant": generalized_resultant.copy(), - "generalized_station_coordinates": stations, - "generalized_strain_order": GENERALIZED_BEAM_STRAIN_ORDER, - "generalized_resultant_order": GENERALIZED_BEAM_RESULTANT_ORDER, - "axial_force": float(np.mean(generalized_resultant[:, 0])), - "recovery_scope": "section_resultants_only", - } - if not tangent: - return T.T @ F_loc, None, trial_state - - K_loc = basic_tangent.T @ basic_stiffness @ basic_tangent - # Hessian of the von Karman axial extension, multiplied by N. - string = float(basic_force[0]) / L - for a, b in ((1, 7), (2, 8)): - K_loc[a, a] += string - K_loc[b, b] += string - K_loc[a, b] -= string - K_loc[b, a] -= string - return T.T @ F_loc, T.T @ K_loc @ T, trial_state - - def compute_nonlinear_response( - self, - mesh: "FEMesh", - material: "Material", - u_elem: np.ndarray, - state: Optional[Any] = None, - num_layers: int = 5, - tangent: bool = True, - ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: - """Elastic beam-column response with von Karman axial coupling. - - The axial strain includes the transverse-displacement rotation terms - - eps = (u2-u1)/L + ((v2-v1)^2 + (w2-w1)^2) / (2 L^2) - - which gives the P-delta string effect consistently (internal force - and tangent from the same potential). Bending, shear and torsion - remain linear elastic unless ``cross_section["fiber_plasticity"]`` is - provided, in which case axial/bending response is integrated over a - uniaxial fiber section using the material hardening curve. - """ - self._refuse_offset_route('nonlinear response') - if self._geometric_nonlinearity in {"corotational", "co_rotational", "corot"}: - return self._compute_corotational_nonlinear_response( - mesh, material, u_elem, state, tangent - ) - - if self.generalized_section is not None: - return self._compute_generalized_von_karman_response( - mesh, - u_elem, - state, - tangent, - ) - - fiber_config = self._fiber_plasticity_config(material) - if fiber_config is not None: - return self._compute_fiber_nonlinear_response( - mesh, material, u_elem, state, fiber_config, tangent - ) - - cache = getattr(self, "_nl_cache", None) - if cache is None: - coords = self.get_node_coordinates(mesh) - L, T = self._beam_frame_and_transform(coords) - K_global = self.compute_stiffness_matrix(mesh, material) - K_loc = T @ K_global @ T.T - # Remove the linear axial block; the von Karman axial response - # replaces it entirely. - for i in (0, 6): - K_loc[i, :] = 0.0 - K_loc[:, i] = 0.0 - E1, _G12, _G13, _GJ = _beam_material_properties( - material, - self.cross_section, - ) - cache = {"L": L, "T": T, "K_noax": K_loc, "EA": E1 * self._A} - self._nl_cache = cache - - L = cache["L"] - T = cache["T"] - EA = cache["EA"] - u_loc = T @ np.asarray(u_elem, dtype=float) - - du = u_loc[6] - u_loc[0] - dv = u_loc[7] - u_loc[1] - dw = u_loc[8] - u_loc[2] - eps = du / L + (dv**2 + dw**2) / (2.0 * L**2) - N_force = EA * eps - - d_eps = np.zeros(12, dtype=float) - d_eps[0], d_eps[6] = -1.0 / L, 1.0 / L - d_eps[1], d_eps[7] = -dv / L**2, dv / L**2 - d_eps[2], d_eps[8] = -dw / L**2, dw / L**2 - - F_loc = cache["K_noax"] @ u_loc + N_force * L * d_eps - if not tangent: - return T.T @ F_loc, None, state - K_loc = cache["K_noax"] + EA * L * np.outer(d_eps, d_eps) - string = N_force / L - for a, b in ((1, 7), (2, 8)): - K_loc[a, a] += string - K_loc[b, b] += string - K_loc[a, b] -= string - K_loc[b, a] -= string - - return T.T @ F_loc, T.T @ K_loc @ T, state - - def _end_displacements(self, u_local: np.ndarray) -> Tuple[np.ndarray, np.ndarray]: - """Local DOF vectors of the two geometric end nodes.""" - return u_local[0:6], u_local[6:12] - - def compute_stresses( - self, - mesh: "FEMesh", - displacements: np.ndarray, - material: "Material", - return_global: bool = False, - ) -> Dict[str, Any]: - coords = self.get_node_coordinates(mesh) - try: - L, T = self._beam_frame_and_transform(coords) - except ValueError: - return {} - u_local = T @ self._get_element_displacements(mesh, displacements) - if self.generalized_section is not None: - section_stiffness = generalized_beam_stiffness( - self.generalized_section - ) - if isinstance(self, QuadraticBeamElement): - strain_rows = [] - for xi in self.GAUSS_POINTS: - shape, derivative_xi = self.compute_shape_functions( - float(xi) - ) - B = _beam_generalized_strain_matrix_from_shape( - shape, - derivative_xi * 2.0 / L, - ) - strain_rows.append(B @ u_local) - generalized_strain = np.asarray(strain_rows, dtype=float) - generalized_resultant = ( - generalized_strain @ section_stiffness.T - ) - return _generalized_beam_recovery( - generalized_strain, - generalized_resultant, - stations=np.asarray(self.GAUSS_POINTS, dtype=float), - ) - basic_transform = _beam2_basic_deformation_matrix(L) - basic_deformation = basic_transform @ u_local - _flexibility, basic_stiffness = ( - _beam2_generalized_flexibility(L, section_stiffness) - ) - basic_force = basic_stiffness @ basic_deformation - compliance = np.linalg.inv(section_stiffness) - stations = np.array((-1.0, 0.0, 1.0), dtype=float) - generalized_resultant = np.asarray( - [ - _beam2_force_interpolation(L, xi) @ basic_force - for xi in stations - ], - dtype=float, - ) - generalized_strain = generalized_resultant @ compliance.T - return _generalized_beam_recovery( - generalized_strain, - generalized_resultant, - stations=stations, - ) - E, G12, G13, GJ = _beam_material_properties(material, self.cross_section) - end_a, end_b = self._end_displacements(u_local) - u1, v1, w1, rx1, ry1, rz1 = end_a - u2, v2, w2, rx2, ry2, rz2 = end_b - sigma_axial = E * (u2 - u1) / L - kappa_z = (rz2 - rz1) / L - kappa_y = (ry2 - ry1) / L - M_z = E * self._Iz * kappa_z - M_y = E * self._Iy * kappa_y - c_y, c_z = self._fiber_distances() - sigma_bending_y = M_y * c_z / max(self._Iy, _SMALL) - sigma_bending_z = M_z * c_y / max(self._Iz, _SMALL) - gamma_xy = (v2 - v1) / L - 0.5 * (rz1 + rz2) - gamma_xz = (w2 - w1) / L + 0.5 * (ry1 + ry2) - tau_y = G12 * self._ky * gamma_xy - tau_z = G13 * self._kz * gamma_xz - tau_torsion = GJ * (rx2 - rx1) / L / self._torsion_section_modulus() - sigma_x = sigma_axial + sigma_bending_y + sigma_bending_z - von_mises = np.sqrt(sigma_x**2 + 3.0 * (tau_y**2 + tau_z**2 + tau_torsion**2)) - recovered = { - "axial_stress": sigma_axial, - "bending_stress_y": sigma_bending_y, - "bending_stress_z": sigma_bending_z, - "shear_stress_y": tau_y, - "shear_stress_z": tau_z, - "torsional_stress": tau_torsion, - "von_mises": von_mises, - } - hill_yield = getattr(material, "hill_yield", None) - if hill_yield is not None: - from .plasticity import hill48_equivalent_stress - - # Section recovery supplies envelopes rather than a resolved - # perimeter stress point. Include both directional transverse - # shears, and conservatively combine the torsional envelope with - # either x-y or x-z shear. - candidates = np.array( - [ - [sigma_x, 0.0, 0.0, 0.0, tau_z, tau_y], - [sigma_x, 0.0, 0.0, 0.0, tau_z, tau_y + tau_torsion], - [sigma_x, 0.0, 0.0, 0.0, tau_z, tau_y - tau_torsion], - [sigma_x, 0.0, 0.0, 0.0, tau_z + tau_torsion, tau_y], - [sigma_x, 0.0, 0.0, 0.0, tau_z - tau_torsion, tau_y], - ], - dtype=float, - ) - equivalent = float( - np.max(hill48_equivalent_stress(candidates, hill_yield)) - ) - recovered["equivalent_stress"] = equivalent - recovered["equivalent_stress_measure"] = "hill48" - recovered["hill_utilization"] = equivalent / max(float(hill_yield.X), _SMALL) - recovered["equivalent_stress_scope"] = ( - "conservative beam-local axial/shear/torsion envelope" - ) - else: - recovered["equivalent_stress"] = von_mises - recovered["equivalent_stress_measure"] = "von_mises" - return recovered - - -class QuadraticBeamElement(BeamElement): - """3-node quadratic Timoshenko beam element with 6 DOF per node.""" - - GAUSS_POINTS = np.array([-np.sqrt(3.0 / 5.0), 0.0, np.sqrt(3.0 / 5.0)], dtype=float) - GAUSS_WEIGHTS = np.array([5.0 / 9.0, 8.0 / 9.0, 5.0 / 9.0], dtype=float) - - def __init__( - self, - element_id: int, - node_ids: List[int], - material_name: str = "default", - cross_section: Optional[Dict[str, Any]] = None, - eccentricity: Optional[np.ndarray] = None, - section: Any = None, - ): - Element.__init__(self, element_id, node_ids, material_name) - if len(node_ids) != 3: - raise ValueError(f"QuadraticBeamElement requires 3 nodes, got {len(node_ids)}") - self.cross_section = cross_section or {} - self._A = self.cross_section.get("area", 0.01) - self._Iy = self.cross_section.get("Iy", 1.0e-8) - self._Iz = self.cross_section.get("Iz", 1.0e-8) - self._J = self.cross_section.get("J", 1.0e-8) - self._ky = self.cross_section.get("shear_factor_y", 5.0 / 6.0) - self._kz = self.cross_section.get("shear_factor_z", 5.0 / 6.0) - self._orientation = _section_orientation(self.cross_section) - self._c_y = self.cross_section.get("c_y") - self._c_z = self.cross_section.get("c_z") - self._torsion_modulus = self.cross_section.get("torsion_modulus") - self._fiber_plasticity = self.cross_section.get("fiber_plasticity") - self._geometric_nonlinearity = str( - self.cross_section.get( - "geometric_nonlinearity", - self.cross_section.get("geometry", "von_karman"), - ) - ).lower() - self.generalized_section = resolve_generalized_beam_section( - self.cross_section, - section, - ) - if self.generalized_section is not None and self._fiber_plasticity is not None: - raise ValueError( - "Generalized beam sections do not support " - "cross_section['fiber_plasticity']; supply an elastic section " - "without fiber plasticity." - ) - if self.generalized_section is not None: - self._geometric_polar_radius_squared() - if self.generalized_section is not None and self._geometric_nonlinearity in { - "corotational", - "co_rotational", - "corot", - }: - raise ValueError( - "QuadraticBeamElement does not support corotational kinematics " - "with a generalized beam section; use BeamElement or " - "geometric_nonlinearity='von_karman'." - ) - self.eccentricity = np.zeros(3, dtype=float) if eccentricity is None else np.asarray(eccentricity, dtype=float) - - def _end_displacements(self, u_local: np.ndarray) -> Tuple[np.ndarray, np.ndarray]: - # Geometric end nodes are 0 and 2; node 1 is the midside node. The - # end-difference over the full length equals the quadratic shape - # function derivative evaluated at the element centre. - return u_local[0:6], u_local[12:18] - - def _compute_generalized_von_karman_response_quadratic( - self, - length: float, - transform: np.ndarray, - u_local: np.ndarray, - state: Optional[Any], - tangent: bool, - ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: - """Quadratic coupled-section response and exact energy tangent.""" - - L = float(length) - section_stiffness = generalized_beam_stiffness( - self.generalized_section - ) - F_loc = np.zeros(18, dtype=float) - K_loc = np.zeros((18, 18), dtype=float) if tangent else None - strain_rows = [] - resultant_rows = [] - for xi, weight in zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS): - shape, derivative_xi = self.compute_shape_functions(float(xi)) - derivative_x = derivative_xi * 2.0 / L - B_linear = _beam_generalized_strain_matrix_from_shape( - shape, - derivative_x, - ) - B_v = np.zeros(18, dtype=float) - B_w = np.zeros(18, dtype=float) - for i in range(3): - B_v[i * 6 + 1] = derivative_x[i] - B_w[i * 6 + 2] = derivative_x[i] - v_gradient = float(B_v @ u_local) - w_gradient = float(B_w @ u_local) - - generalized_strain = B_linear @ u_local - generalized_strain[0] += 0.5 * ( - v_gradient**2 + w_gradient**2 - ) - B_tangent = B_linear.copy() - B_tangent[0, :] += ( - v_gradient * B_v + w_gradient * B_w - ) - generalized_resultant = ( - section_stiffness @ generalized_strain - ) - jacobian_weight = L / 2.0 * float(weight) - F_loc += ( - jacobian_weight - * (B_tangent.T @ generalized_resultant) - ) - if tangent: - K_loc += jacobian_weight * ( - B_tangent.T @ section_stiffness @ B_tangent - + float(generalized_resultant[0]) - * (np.outer(B_v, B_v) + np.outer(B_w, B_w)) - ) - strain_rows.append(generalized_strain.copy()) - resultant_rows.append(generalized_resultant.copy()) - - generalized_strains = np.asarray(strain_rows, dtype=float) - generalized_resultants = np.asarray(resultant_rows, dtype=float) - trial_state = { - **(dict(state) if isinstance(state, dict) else {}), - "generalized_section": True, - "geometric_nonlinearity": "von_karman", - "generalized_strain": generalized_strains, - "generalized_resultant": generalized_resultants, - "generalized_station_coordinates": np.asarray( - self.GAUSS_POINTS, - dtype=float, - ).copy(), - "generalized_strain_order": GENERALIZED_BEAM_STRAIN_ORDER, - "generalized_resultant_order": GENERALIZED_BEAM_RESULTANT_ORDER, - "axial_force": float( - np.mean(generalized_resultants[:, 0]) - ), - "recovery_scope": "section_resultants_only", - } - if not tangent: - return transform.T @ F_loc, None, trial_state - return ( - transform.T @ F_loc, - transform.T @ K_loc @ transform, - trial_state, - ) - - def compute_nonlinear_response( - self, - mesh: "FEMesh", - material: "Material", - u_elem: np.ndarray, - state: Optional[Any] = None, - num_layers: int = 5, - tangent: bool = True, - ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: - """Gauss-point von Karman beam-column response on the quadratic interpolation. - - At each integration point the axial strain includes the transverse - gradient coupling - - eps = u' + (v'^2 + w'^2) / 2 - - with all gradients from the quadratic shape functions, giving internal - force and consistent tangent (including the string/geometric term) from - the same potential. With ``cross_section["fiber_plasticity"]`` the - axial/bending response is integrated over the uniaxial fiber grid per - Gauss point using the material hardening curve; shear and torsion stay - linear elastic, matching the 2-node beam formulation. - """ - coords = self.get_node_coordinates(mesh) - try: - L, T = self._beam_frame_and_transform(coords) - except ValueError: - return Element.compute_nonlinear_response( - self, mesh, material, u_elem, state, num_layers, tangent - ) - u_loc = T @ np.asarray(u_elem, dtype=float) - if self.generalized_section is not None: - return self._compute_generalized_von_karman_response_quadratic( - L, - T, - u_loc, - state, - tangent, - ) - E, G12, G13, GJ = _beam_material_properties(material, self.cross_section) - EA = E * self._A - EIy = E * self._Iy - EIz = E * self._Iz - GA_y = G12 * self._A * self._ky - GA_z = G13 * self._A * self._kz - - fiber_config = self._fiber_plasticity_config(material) - num_gp = len(self.GAUSS_POINTS) - if fiber_config is not None: - y_f, z_f, w_f = self._fiber_section_grid(fiber_config) - n_fibers = y_f.size - fiber_strain_all = np.zeros(num_gp * n_fibers, dtype=float) - B_fiber_all = np.zeros((num_gp * n_fibers, 18), dtype=float) - - F_loc = np.zeros(18, dtype=float) - K_loc = np.zeros((18, 18), dtype=float) if tangent else None - gp_data = [] - axial_forces = [] - for gp_index, (xi, weight) in enumerate(zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS)): - N, dN_dxi = self.compute_shape_functions(float(xi)) - dN_dx = dN_dxi * 2.0 / L - jac = L / 2.0 * float(weight) - - B_ax = np.zeros(18, dtype=float) - B_v = np.zeros(18, dtype=float) - B_w = np.zeros(18, dtype=float) - B_ry = np.zeros(18, dtype=float) - B_rz = np.zeros(18, dtype=float) - B_torsion = np.zeros(18, dtype=float) - B_shear_xy = np.zeros(18, dtype=float) - B_shear_xz = np.zeros(18, dtype=float) - for i in range(3): - b = i * 6 - B_ax[b + 0] = dN_dx[i] - B_v[b + 1] = dN_dx[i] - B_w[b + 2] = dN_dx[i] - B_torsion[b + 3] = dN_dx[i] - B_ry[b + 4] = dN_dx[i] - B_rz[b + 5] = dN_dx[i] - B_shear_xy[b + 1] = dN_dx[i] - B_shear_xy[b + 5] = -N[i] - B_shear_xz[b + 2] = dN_dx[i] - B_shear_xz[b + 4] = N[i] - - v_grad = float(B_v @ u_loc) - w_grad = float(B_w @ u_loc) - eps0 = float(B_ax @ u_loc) + 0.5 * (v_grad**2 + w_grad**2) - kappa_y = float(B_ry @ u_loc) - kappa_z = float(B_rz @ u_loc) - B_membrane = B_ax + v_grad * B_v + w_grad * B_w - - # linear shear and torsion at every integration point - gamma_xy = float(B_shear_xy @ u_loc) - gamma_xz = float(B_shear_xz @ u_loc) - twist = float(B_torsion @ u_loc) - F_loc += jac * (GA_y * gamma_xy * B_shear_xy + GA_z * gamma_xz * B_shear_xz + GJ * twist * B_torsion) - if tangent: - K_loc += jac * ( - GA_y * np.outer(B_shear_xy, B_shear_xy) - + GA_z * np.outer(B_shear_xz, B_shear_xz) - + GJ * np.outer(B_torsion, B_torsion) - ) - - if fiber_config is not None: - rows = slice(gp_index * n_fibers, (gp_index + 1) * n_fibers) - fiber_strain_all[rows] = eps0 + z_f * kappa_y + y_f * kappa_z - B_fiber_all[rows] = ( - B_membrane[None, :] + z_f[:, None] * B_ry[None, :] + y_f[:, None] * B_rz[None, :] - ) - gp_data.append((jac, B_v, B_w, rows)) - else: - axial_force = EA * eps0 - axial_forces.append(axial_force) - F_loc += jac * (axial_force * B_membrane + EIy * kappa_y * B_ry + EIz * kappa_z * B_rz) - if tangent: - K_loc += jac * ( - EA * np.outer(B_membrane, B_membrane) - + axial_force * (np.outer(B_v, B_v) + np.outer(B_w, B_w)) - + EIy * np.outer(B_ry, B_ry) - + EIz * np.outer(B_rz, B_rz) - ) - - trial_state: Optional[Any] = state - if fiber_config is not None: - initial_state = _copy_state_fields(state, _INITIAL_BEAM_STATE_KEYS) - initial_stress = _beam_fiber_field( - initial_state.get("initial_fiber_stress", 0.0), - fiber_strain_all.size, - n_fibers, - "initial_fiber_stress", - ) - initial_prestrain = _beam_fiber_field( - initial_state.get("initial_fiber_prestrain", 0.0), - fiber_strain_all.size, - n_fibers, - "initial_fiber_prestrain", - ) - constitutive_fiber_strain = ( - fiber_strain_all - initial_prestrain + initial_stress / E - ) - stress, Et, plastic_new, alpha_new = self._uniaxial_return_map( - constitutive_fiber_strain, - state, - E, - fiber_config.material_curve, - _beam_flow_scale(material, fiber_config.material_curve), - ) - for jac, B_v, B_w, rows in gp_data: - weights_gp = w_f - stress_gp = stress[rows] - F_loc += jac * np.einsum("f,f,fj->j", weights_gp, stress_gp, B_fiber_all[rows]) - axial_force = float(np.sum(weights_gp * stress_gp)) - axial_forces.append(axial_force) - if tangent: - K_loc += jac * np.einsum("f,f,fj,fk->jk", weights_gp, Et[rows], B_fiber_all[rows], B_fiber_all[rows]) - K_loc += jac * axial_force * (np.outer(B_v, B_v) + np.outer(B_w, B_w)) - trial_state = { - "plastic_strain": plastic_new, - "alpha": alpha_new, - "fiber_strain": constitutive_fiber_strain.copy(), - "kinematic_fiber_strain": fiber_strain_all.copy(), - "fiber_stress": stress.copy(), - "axial_force": float(np.mean(axial_forces)) if axial_forces else 0.0, - "equivalent_stress_measure": ( - "hill48" - if _elastic_symmetry(material) == "orthotropic" - else "von_mises" - ), - **initial_state, - } - - if not tangent: - return T.T @ F_loc, None, trial_state - return T.T @ F_loc, T.T @ K_loc @ T, trial_state - - @property - def num_nodes(self) -> int: - return 3 - - @property - def dofs_per_node(self) -> int: - return 6 - - @property - def total_dofs(self) -> int: - return 18 - - def get_node_coordinates(self, mesh: "FEMesh") -> np.ndarray: - coords = np.zeros((3, 3), dtype=float) - for i, node_id in enumerate(self.node_ids): - node = mesh.get_node(node_id) - if node is None: - raise ValueError(f"Quadratic beam element {self.element_id} references missing node {node_id}") - coords[i] = node.coords() - chord = coords[2] - coords[0] - length = float(np.linalg.norm(chord)) - if length > _SMALL: - midpoint_error = float(np.linalg.norm(coords[1] - 0.5 * (coords[0] + coords[2]))) - if midpoint_error > max(1.0e-8 * length, 1.0e-12): - raise ValueError( - f"Quadratic beam element {self.element_id} is curved or has a non-midpoint middle node. " - "The current B3 formulation is straight-sided; use two-node beam segments for curved geometry." - ) - return coords - - def compute_shape_functions(self, xi: float) -> Tuple[np.ndarray, np.ndarray]: - N = np.array([xi * (xi - 1.0) / 2.0, 1.0 - xi**2, xi * (xi + 1.0) / 2.0], dtype=float) - dN_dxi = np.array([xi - 0.5, -2.0 * xi, xi + 0.5], dtype=float) - return N, dN_dxi - - def _beam_frame_and_transform(self, coords: np.ndarray) -> Tuple[float, np.ndarray]: - length = float(np.linalg.norm(coords[2] - coords[0])) - if length < _SMALL: - raise ValueError(f"Quadratic beam element {self.element_id} has near-zero length") - e1 = (coords[2] - coords[0]) / length - R = _beam_rotation_matrix(e1, self._orientation) - T = np.zeros((18, 18), dtype=float) - Rt = R.T - for i in range(3): - b = i * 6 - T[b:b + 3, b:b + 3] = Rt - T[b + 3:b + 6, b + 3:b + 6] = Rt - return length, T - - def compute_stiffness_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: - coords = self.get_node_coordinates(mesh) - try: - L, T = self._beam_frame_and_transform(coords) - except ValueError: - return np.zeros((18, 18), dtype=float) - if self.generalized_section is not None: - section_stiffness = generalized_beam_stiffness( - self.generalized_section - ) - K = np.zeros((18, 18), dtype=float) - for xi, weight in zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS): - shape, derivative_xi = self.compute_shape_functions(float(xi)) - B = _beam_generalized_strain_matrix_from_shape( - shape, - derivative_xi * 2.0 / L, - ) - K += ( - B.T - @ section_stiffness - @ B - * (L / 2.0 * float(weight)) - ) - K_global = T.T @ K @ T - self._stiffness_matrix = K_global - return K_global - E, G12, G13, GJ = _beam_material_properties(material, self.cross_section) - EA = E * self._A - EIy = E * self._Iy - EIz = E * self._Iz - GA_y = G12 * self._A * self._ky - GA_z = G13 * self._A * self._kz - K = np.zeros((18, 18), dtype=float) - for xi, weight in zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS): - N, dN_dxi = self.compute_shape_functions(float(xi)) - dN_dx = dN_dxi * 2.0 / L - B_axial = np.zeros((1, 18), dtype=float) - B_torsion = np.zeros((1, 18), dtype=float) - B_shear_xz = np.zeros((1, 18), dtype=float) - B_shear_xy = np.zeros((1, 18), dtype=float) - B_bend_y = np.zeros((1, 18), dtype=float) - B_bend_z = np.zeros((1, 18), dtype=float) - for i in range(3): - b = i * 6 - B_axial[0, b + 0] = dN_dx[i] - B_torsion[0, b + 3] = dN_dx[i] - B_shear_xz[0, b + 2] = dN_dx[i] - B_shear_xz[0, b + 4] = N[i] - B_shear_xy[0, b + 1] = dN_dx[i] - B_shear_xy[0, b + 5] = -N[i] - B_bend_y[0, b + 4] = dN_dx[i] - B_bend_z[0, b + 5] = dN_dx[i] - jac = L / 2.0 * weight - K += B_axial.T @ (EA * np.eye(1)) @ B_axial * jac - K += B_torsion.T @ (GJ * np.eye(1)) @ B_torsion * jac - K += B_shear_xz.T @ (GA_z * np.eye(1)) @ B_shear_xz * jac - K += B_shear_xy.T @ (GA_y * np.eye(1)) @ B_shear_xy * jac - K += B_bend_y.T @ (EIy * np.eye(1)) @ B_bend_y * jac - K += B_bend_z.T @ (EIz * np.eye(1)) @ B_bend_z * jac - K_global = T.T @ K @ T - self._stiffness_matrix = K_global - return K_global - - def compute_mass_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: - coords = self.get_node_coordinates(mesh) - try: - L, T = self._beam_frame_and_transform(coords) - except ValueError: - return np.zeros((18, 18), dtype=float) - M = np.zeros((18, 18), dtype=float) - generalized_mass = ( - None - if self.generalized_section is None - else generalized_beam_mass_matrix(self.generalized_section) - ) - if generalized_mass is not None: - for xi, weight in zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS): - N, _ = self.compute_shape_functions(float(xi)) - jacobian_weight = float(weight) * L / 2.0 - for i in range(3): - for j in range(3): - M[ - i * 6 : (i + 1) * 6, - j * 6 : (j + 1) * 6, - ] += ( - N[i] - * N[j] - * jacobian_weight - * generalized_mass - ) - M_global = T.T @ M @ T - self._mass_matrix = M_global - return M_global - rho = material.density - # Consistent rotary inertia per rotation axis: polar (Iy+Iz) for - # torsion, the matching section inertia for each bending rotation. - rotary_inertia = (rho * (self._Iy + self._Iz), rho * self._Iy, rho * self._Iz) - for xi, weight in zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS): - N, _ = self.compute_shape_functions(float(xi)) - for i in range(3): - for j in range(3): - translational = N[i] * N[j] * rho * self._A * weight * L / 2.0 - for d in range(3): - M[i * 6 + d, j * 6 + d] += translational - M[i * 6 + 3 + d, j * 6 + 3 + d] += N[i] * N[j] * rotary_inertia[d] * weight * L / 2.0 - M_global = T.T @ M @ T - self._mass_matrix = M_global - return M_global - - def compute_geometric_stiffness_matrix( - self, - mesh: "FEMesh", - material: "Material", - state: Optional[Any] = None, - ) -> np.ndarray: - """ - Beam-column stress stiffness from the lateral displacement gradient: - - KG = N_compression * integral (dN/dx)^T (dN/dx) dx - - applied to both transverse deflections. This is the same - destabilizing-gradient theory as the shell membrane KG and follows the - package convention ``K phi = lambda KG phi`` with compression positive. - The higher-order rotation-gradient term is omitted, which makes the - predicted critical loads slightly conservative on coarse meshes. - """ - axial_compression = self._axial_compression_from_state(state) - if axial_compression == 0.0: - return np.zeros((self.total_dofs, self.total_dofs), dtype=float) - - coords = self.get_node_coordinates(mesh) - try: - L, T = self._beam_frame_and_transform(coords) - except ValueError: - return np.zeros((self.total_dofs, self.total_dofs), dtype=float) - - KG = np.zeros((18, 18), dtype=float) - # Wagner term factor: see BeamElement.compute_geometric_stiffness_matrix. - polar_ratio = self._geometric_polar_radius_squared() - for xi, weight in zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS): - _, dN_dxi = self.compute_shape_functions(float(xi)) - dN_dx = dN_dxi * 2.0 / L - G_matrix = np.zeros((2, 18), dtype=float) - twist_gradient = np.zeros((1, 18), dtype=float) - for i in range(3): - b = i * 6 - G_matrix[0, b + 1] = dN_dx[i] - G_matrix[1, b + 2] = dN_dx[i] - twist_gradient[0, b + 3] = dN_dx[i] - KG += axial_compression * (G_matrix.T @ G_matrix) * (L / 2.0 * weight) - KG += axial_compression * polar_ratio * (twist_gradient.T @ twist_gradient) * (L / 2.0 * weight) - return T.T @ KG @ T - - -class CoupledBeamShellElement(Element): - """Kinematic MPC coupling between one eccentric beam node and one shell node.""" - - def __init__( - self, - element_id: int, - beam_node_id: int, - shell_node_id: int, - material_name: str = "default", - coupling_stiffness: float = 0.0, - eccentricity: Optional[np.ndarray] = None, + + GJ * np.outer(B_torsion, B_torsion) + ) + F_loc += K_aux @ u_loc + if tangent: + K_loc += K_aux + + trial_state = { + "plastic_strain": plastic_new, + "alpha": alpha_new, + "fiber_strain": constitutive_fiber_strain.copy(), + "kinematic_fiber_strain": fiber_strain.copy(), + "fiber_stress": stress.copy(), + "axial_force": N_force, + "equivalent_stress_measure": ( + "hill48" if _elastic_symmetry(material) == "orthotropic" else "von_mises" + ), + **initial_state, + } + if not tangent: + return T.T @ F_loc, None, trial_state + return T.T @ F_loc, T.T @ K_loc @ T, trial_state + + def _current_beam_frame_and_transform(self, coords: np.ndarray, u_elem: np.ndarray) -> Tuple[float, np.ndarray, np.ndarray, np.ndarray]: + current = coords.copy() + current[0] += np.asarray(u_elem[0:3], dtype=float) + current[1] += np.asarray(u_elem[6:9], dtype=float) + length = float(np.linalg.norm(current[1] - current[0])) + if length < _SMALL: + raise ValueError(f"Beam element {self.element_id} has near-zero current length") + e1 = (current[1] - current[0]) / length + R = _beam_rotation_matrix(e1, self._orientation) + T = np.zeros((12, 12), dtype=float) + Rt = R.T + for i in range(2): + b = i * 6 + T[b:b + 3, b:b + 3] = Rt + T[b + 3:b + 6, b + 3:b + 6] = Rt + return length, T, R, current + + def _compute_corotational_nonlinear_response( + self, + mesh: "FEMesh", + material: "Material", + u_elem: np.ndarray, + state: Optional[Any], + tangent: bool, + ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: + """Elastic 2-node corotational beam response. + + The element frame follows the current chord. Rigid-body chord rotation + is subtracted from nodal rotations, so a finite rigid rotation with + matching nodal rotation vectors produces near-zero internal force. + """ + coords = self.get_node_coordinates(mesh) + L0, _T0 = self._beam_frame_and_transform(coords) + Lc, Tc, Rc, _current = self._current_beam_frame_and_transform(coords, np.asarray(u_elem, dtype=float)) + R0 = _beam_rotation_matrix((coords[1] - coords[0]) / L0, self._orientation) + rigid_rotation = _rotation_vector_from_matrix(Rc @ R0.T) + + u_global = np.asarray(u_elem, dtype=float).reshape(12) + q = np.zeros(12, dtype=float) + q[6] = Lc - L0 + q[3:6] = Rc.T @ (u_global[3:6] - rigid_rotation) + q[9:12] = Rc.T @ (u_global[9:12] - rigid_rotation) + + K_loc = self._local_linear_stiffness(L0, material) + F_loc = K_loc @ q + F_global = Tc.T @ F_loc + trial_state = { + "geometric_nonlinearity": "corotational", + "initial_length": float(L0), + "current_length": float(Lc), + "axial_extension": float(Lc - L0), + "rigid_rotation_vector": rigid_rotation.copy(), + "basic_deformation_norm": float(np.linalg.norm(q)), + } + if self.generalized_section is not None: + section_stiffness = generalized_beam_stiffness( + self.generalized_section + ) + basic_deformation = ( + _beam2_basic_deformation_matrix(L0) @ q + ) + _flexibility, basic_stiffness = ( + _beam2_generalized_flexibility( + L0, + section_stiffness, + ) + ) + basic_force = basic_stiffness @ basic_deformation + stations = np.array((-1.0, 0.0, 1.0), dtype=float) + generalized_resultant = np.asarray( + [ + _beam2_force_interpolation(L0, xi) @ basic_force + for xi in stations + ], + dtype=float, + ) + generalized_strain = ( + generalized_resultant + @ np.linalg.inv(section_stiffness).T + ) + trial_state.update( + { + "generalized_section": True, + "generalized_strain": generalized_strain.copy(), + "generalized_resultant": generalized_resultant.copy(), + "generalized_station_coordinates": stations, + "generalized_strain_order": GENERALIZED_BEAM_STRAIN_ORDER, + "generalized_resultant_order": ( + GENERALIZED_BEAM_RESULTANT_ORDER + ), + "axial_force": float( + np.mean(generalized_resultant[:, 0]) + ), + "recovery_scope": "section_resultants_only", + } + ) + if not tangent: + return F_global, None, trial_state + K_global = Tc.T @ K_loc @ Tc + return F_global, K_global, trial_state + + def _compute_generalized_von_karman_response( + self, + mesh: "FEMesh", + u_elem: np.ndarray, + state: Optional[Any], + tangent: bool, + ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: + """Coupled generalized-section response from one strain-energy law.""" + + coords = self.get_node_coordinates(mesh) + L, T = self._beam_frame_and_transform(coords) + u_loc = T @ np.asarray(u_elem, dtype=float) + basic_transform = _beam2_basic_deformation_matrix(L) + basic_deformation = basic_transform @ u_loc + dv = float(u_loc[7] - u_loc[1]) + dw = float(u_loc[8] - u_loc[2]) + basic_deformation[0] += (dv**2 + dw**2) / (2.0 * L) + basic_tangent = basic_transform.copy() + basic_tangent[0, 1], basic_tangent[0, 7] = -dv / L, dv / L + basic_tangent[0, 2], basic_tangent[0, 8] = -dw / L, dw / L + + section_stiffness = generalized_beam_stiffness( + self.generalized_section + ) + _flexibility, basic_stiffness = _beam2_generalized_flexibility( + L, + section_stiffness, + ) + basic_force = basic_stiffness @ basic_deformation + F_loc = basic_tangent.T @ basic_force + stations = np.array((-1.0, 0.0, 1.0), dtype=float) + generalized_resultant = np.asarray( + [ + _beam2_force_interpolation(L, xi) @ basic_force + for xi in stations + ], + dtype=float, + ) + generalized_strain = ( + generalized_resultant @ np.linalg.inv(section_stiffness).T + ) + trial_state = { + **(dict(state) if isinstance(state, dict) else {}), + "generalized_section": True, + "geometric_nonlinearity": "von_karman", + "generalized_strain": generalized_strain.copy(), + "generalized_resultant": generalized_resultant.copy(), + "generalized_station_coordinates": stations, + "generalized_strain_order": GENERALIZED_BEAM_STRAIN_ORDER, + "generalized_resultant_order": GENERALIZED_BEAM_RESULTANT_ORDER, + "axial_force": float(np.mean(generalized_resultant[:, 0])), + "recovery_scope": "section_resultants_only", + } + if not tangent: + return T.T @ F_loc, None, trial_state + + K_loc = basic_tangent.T @ basic_stiffness @ basic_tangent + # Hessian of the von Karman axial extension, multiplied by N. + string = float(basic_force[0]) / L + for a, b in ((1, 7), (2, 8)): + K_loc[a, a] += string + K_loc[b, b] += string + K_loc[a, b] -= string + K_loc[b, a] -= string + return T.T @ F_loc, T.T @ K_loc @ T, trial_state + + def compute_nonlinear_response( + self, + mesh: "FEMesh", + material: "Material", + u_elem: np.ndarray, + state: Optional[Any] = None, + num_layers: int = 5, + tangent: bool = True, + ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: + """Elastic beam-column response with von Karman axial coupling. + + The axial strain includes the transverse-displacement rotation terms + + eps = (u2-u1)/L + ((v2-v1)^2 + (w2-w1)^2) / (2 L^2) + + which gives the P-delta string effect consistently (internal force + and tangent from the same potential). Bending, shear and torsion + remain linear elastic unless ``cross_section["fiber_plasticity"]`` is + provided, in which case axial/bending response is integrated over a + uniaxial fiber section using the material hardening curve. + """ + self._refuse_offset_route('nonlinear response') + if self._geometric_nonlinearity in {"corotational", "co_rotational", "corot"}: + return self._compute_corotational_nonlinear_response( + mesh, material, u_elem, state, tangent + ) + + if self.generalized_section is not None: + return self._compute_generalized_von_karman_response( + mesh, + u_elem, + state, + tangent, + ) + + fiber_config = self._fiber_plasticity_config(material) + if fiber_config is not None: + return self._compute_fiber_nonlinear_response( + mesh, material, u_elem, state, fiber_config, tangent + ) + + cache = getattr(self, "_nl_cache", None) + if cache is None: + coords = self.get_node_coordinates(mesh) + L, T = self._beam_frame_and_transform(coords) + K_global = self.compute_stiffness_matrix(mesh, material) + K_loc = T @ K_global @ T.T + # Remove the linear axial block; the von Karman axial response + # replaces it entirely. + for i in (0, 6): + K_loc[i, :] = 0.0 + K_loc[:, i] = 0.0 + E1, _G12, _G13, _GJ = _beam_material_properties( + material, + self.cross_section, + ) + cache = {"L": L, "T": T, "K_noax": K_loc, "EA": E1 * self._A} + self._nl_cache = cache + + L = cache["L"] + T = cache["T"] + EA = cache["EA"] + u_loc = T @ np.asarray(u_elem, dtype=float) + + du = u_loc[6] - u_loc[0] + dv = u_loc[7] - u_loc[1] + dw = u_loc[8] - u_loc[2] + eps = du / L + (dv**2 + dw**2) / (2.0 * L**2) + N_force = EA * eps + + d_eps = np.zeros(12, dtype=float) + d_eps[0], d_eps[6] = -1.0 / L, 1.0 / L + d_eps[1], d_eps[7] = -dv / L**2, dv / L**2 + d_eps[2], d_eps[8] = -dw / L**2, dw / L**2 + + F_loc = cache["K_noax"] @ u_loc + N_force * L * d_eps + if not tangent: + return T.T @ F_loc, None, state + K_loc = cache["K_noax"] + EA * L * np.outer(d_eps, d_eps) + string = N_force / L + for a, b in ((1, 7), (2, 8)): + K_loc[a, a] += string + K_loc[b, b] += string + K_loc[a, b] -= string + K_loc[b, a] -= string + + return T.T @ F_loc, T.T @ K_loc @ T, state + + def _end_displacements(self, u_local: np.ndarray) -> Tuple[np.ndarray, np.ndarray]: + """Local DOF vectors of the two geometric end nodes.""" + return u_local[0:6], u_local[6:12] + + def compute_stresses( + self, + mesh: "FEMesh", + displacements: np.ndarray, + material: "Material", + return_global: bool = False, + ) -> Dict[str, Any]: + coords = self.get_node_coordinates(mesh) + try: + L, T = self._beam_frame_and_transform(coords) + except ValueError: + return {} + u_local = T @ self._get_element_displacements(mesh, displacements) + if self.generalized_section is not None: + section_stiffness = generalized_beam_stiffness( + self.generalized_section + ) + if isinstance(self, QuadraticBeamElement): + strain_rows = [] + for xi in self.GAUSS_POINTS: + shape, derivative_xi = self.compute_shape_functions( + float(xi) + ) + B = _beam_generalized_strain_matrix_from_shape( + shape, + derivative_xi * 2.0 / L, + ) + strain_rows.append(B @ u_local) + generalized_strain = np.asarray(strain_rows, dtype=float) + generalized_resultant = ( + generalized_strain @ section_stiffness.T + ) + return _generalized_beam_recovery( + generalized_strain, + generalized_resultant, + stations=np.asarray(self.GAUSS_POINTS, dtype=float), + ) + basic_transform = _beam2_basic_deformation_matrix(L) + basic_deformation = basic_transform @ u_local + _flexibility, basic_stiffness = ( + _beam2_generalized_flexibility(L, section_stiffness) + ) + basic_force = basic_stiffness @ basic_deformation + compliance = np.linalg.inv(section_stiffness) + stations = np.array((-1.0, 0.0, 1.0), dtype=float) + generalized_resultant = np.asarray( + [ + _beam2_force_interpolation(L, xi) @ basic_force + for xi in stations + ], + dtype=float, + ) + generalized_strain = generalized_resultant @ compliance.T + return _generalized_beam_recovery( + generalized_strain, + generalized_resultant, + stations=stations, + ) + E, G12, G13, GJ = _beam_material_properties(material, self.cross_section) + end_a, end_b = self._end_displacements(u_local) + u1, v1, w1, rx1, ry1, rz1 = end_a + u2, v2, w2, rx2, ry2, rz2 = end_b + sigma_axial = E * (u2 - u1) / L + kappa_z = (rz2 - rz1) / L + kappa_y = (ry2 - ry1) / L + M_z = E * self._Iz * kappa_z + M_y = E * self._Iy * kappa_y + c_y, c_z = self._fiber_distances() + sigma_bending_y = M_y * c_z / max(self._Iy, _SMALL) + sigma_bending_z = M_z * c_y / max(self._Iz, _SMALL) + gamma_xy = (v2 - v1) / L - 0.5 * (rz1 + rz2) + gamma_xz = (w2 - w1) / L + 0.5 * (ry1 + ry2) + tau_y = G12 * self._ky * gamma_xy + tau_z = G13 * self._kz * gamma_xz + tau_torsion = GJ * (rx2 - rx1) / L / self._torsion_section_modulus() + sigma_x = sigma_axial + sigma_bending_y + sigma_bending_z + von_mises = np.sqrt(sigma_x**2 + 3.0 * (tau_y**2 + tau_z**2 + tau_torsion**2)) + recovered = { + "axial_stress": sigma_axial, + "bending_stress_y": sigma_bending_y, + "bending_stress_z": sigma_bending_z, + "shear_stress_y": tau_y, + "shear_stress_z": tau_z, + "torsional_stress": tau_torsion, + "von_mises": von_mises, + } + hill_yield = getattr(material, "hill_yield", None) + if hill_yield is not None: + from .plasticity import hill48_equivalent_stress + + # Section recovery supplies envelopes rather than a resolved + # perimeter stress point. Include both directional transverse + # shears, and conservatively combine the torsional envelope with + # either x-y or x-z shear. + candidates = np.array( + [ + [sigma_x, 0.0, 0.0, 0.0, tau_z, tau_y], + [sigma_x, 0.0, 0.0, 0.0, tau_z, tau_y + tau_torsion], + [sigma_x, 0.0, 0.0, 0.0, tau_z, tau_y - tau_torsion], + [sigma_x, 0.0, 0.0, 0.0, tau_z + tau_torsion, tau_y], + [sigma_x, 0.0, 0.0, 0.0, tau_z - tau_torsion, tau_y], + ], + dtype=float, + ) + equivalent = float( + np.max(hill48_equivalent_stress(candidates, hill_yield)) + ) + recovered["equivalent_stress"] = equivalent + recovered["equivalent_stress_measure"] = "hill48" + recovered["hill_utilization"] = equivalent / max(float(hill_yield.X), _SMALL) + recovered["equivalent_stress_scope"] = ( + "conservative beam-local axial/shear/torsion envelope" + ) + else: + recovered["equivalent_stress"] = von_mises + recovered["equivalent_stress_measure"] = "von_mises" + return recovered + + +class QuadraticBeamElement(BeamElement): + """3-node quadratic Timoshenko beam element with 6 DOF per node.""" + + GAUSS_POINTS = np.array([-np.sqrt(3.0 / 5.0), 0.0, np.sqrt(3.0 / 5.0)], dtype=float) + GAUSS_WEIGHTS = np.array([5.0 / 9.0, 8.0 / 9.0, 5.0 / 9.0], dtype=float) + + def __init__( + self, + element_id: int, + node_ids: List[int], + material_name: str = "default", + cross_section: Optional[Dict[str, Any]] = None, + eccentricity: Optional[np.ndarray] = None, + section: Any = None, + ): + Element.__init__(self, element_id, node_ids, material_name) + if len(node_ids) != 3: + raise ValueError(f"QuadraticBeamElement requires 3 nodes, got {len(node_ids)}") + self.cross_section = cross_section or {} + self._A = self.cross_section.get("area", 0.01) + self._Iy = self.cross_section.get("Iy", 1.0e-8) + self._Iz = self.cross_section.get("Iz", 1.0e-8) + self._J = self.cross_section.get("J", 1.0e-8) + self._ky = self.cross_section.get("shear_factor_y", 5.0 / 6.0) + self._kz = self.cross_section.get("shear_factor_z", 5.0 / 6.0) + self._orientation = _section_orientation(self.cross_section) + self._c_y = self.cross_section.get("c_y") + self._c_z = self.cross_section.get("c_z") + self._torsion_modulus = self.cross_section.get("torsion_modulus") + self._fiber_plasticity = self.cross_section.get("fiber_plasticity") + self._geometric_nonlinearity = str( + self.cross_section.get( + "geometric_nonlinearity", + self.cross_section.get("geometry", "von_karman"), + ) + ).lower() + self.generalized_section = resolve_generalized_beam_section( + self.cross_section, + section, + ) + if self.generalized_section is not None and self._fiber_plasticity is not None: + raise ValueError( + "Generalized beam sections do not support " + "cross_section['fiber_plasticity']; supply an elastic section " + "without fiber plasticity." + ) + if self.generalized_section is not None: + self._geometric_polar_radius_squared() + if self.generalized_section is not None and self._geometric_nonlinearity in { + "corotational", + "co_rotational", + "corot", + }: + raise ValueError( + "QuadraticBeamElement does not support corotational kinematics " + "with a generalized beam section; use BeamElement or " + "geometric_nonlinearity='von_karman'." + ) + self.eccentricity = np.zeros(3, dtype=float) if eccentricity is None else np.asarray(eccentricity, dtype=float) + + def _end_displacements(self, u_local: np.ndarray) -> Tuple[np.ndarray, np.ndarray]: + # Geometric end nodes are 0 and 2; node 1 is the midside node. The + # end-difference over the full length equals the quadratic shape + # function derivative evaluated at the element centre. + return u_local[0:6], u_local[12:18] + + def _compute_generalized_von_karman_response_quadratic( + self, + length: float, + transform: np.ndarray, + u_local: np.ndarray, + state: Optional[Any], + tangent: bool, + ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: + """Quadratic coupled-section response and exact energy tangent.""" + + L = float(length) + section_stiffness = generalized_beam_stiffness( + self.generalized_section + ) + F_loc = np.zeros(18, dtype=float) + K_loc = np.zeros((18, 18), dtype=float) if tangent else None + strain_rows = [] + resultant_rows = [] + for xi, weight in zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS): + shape, derivative_xi = self.compute_shape_functions(float(xi)) + derivative_x = derivative_xi * 2.0 / L + B_linear = _beam_generalized_strain_matrix_from_shape( + shape, + derivative_x, + ) + B_v = np.zeros(18, dtype=float) + B_w = np.zeros(18, dtype=float) + for i in range(3): + B_v[i * 6 + 1] = derivative_x[i] + B_w[i * 6 + 2] = derivative_x[i] + v_gradient = float(B_v @ u_local) + w_gradient = float(B_w @ u_local) + + generalized_strain = B_linear @ u_local + generalized_strain[0] += 0.5 * ( + v_gradient**2 + w_gradient**2 + ) + B_tangent = B_linear.copy() + B_tangent[0, :] += ( + v_gradient * B_v + w_gradient * B_w + ) + generalized_resultant = ( + section_stiffness @ generalized_strain + ) + jacobian_weight = L / 2.0 * float(weight) + F_loc += ( + jacobian_weight + * (B_tangent.T @ generalized_resultant) + ) + if tangent: + K_loc += jacobian_weight * ( + B_tangent.T @ section_stiffness @ B_tangent + + float(generalized_resultant[0]) + * (np.outer(B_v, B_v) + np.outer(B_w, B_w)) + ) + strain_rows.append(generalized_strain.copy()) + resultant_rows.append(generalized_resultant.copy()) + + generalized_strains = np.asarray(strain_rows, dtype=float) + generalized_resultants = np.asarray(resultant_rows, dtype=float) + trial_state = { + **(dict(state) if isinstance(state, dict) else {}), + "generalized_section": True, + "geometric_nonlinearity": "von_karman", + "generalized_strain": generalized_strains, + "generalized_resultant": generalized_resultants, + "generalized_station_coordinates": np.asarray( + self.GAUSS_POINTS, + dtype=float, + ).copy(), + "generalized_strain_order": GENERALIZED_BEAM_STRAIN_ORDER, + "generalized_resultant_order": GENERALIZED_BEAM_RESULTANT_ORDER, + "axial_force": float( + np.mean(generalized_resultants[:, 0]) + ), + "recovery_scope": "section_resultants_only", + } + if not tangent: + return transform.T @ F_loc, None, trial_state + return ( + transform.T @ F_loc, + transform.T @ K_loc @ transform, + trial_state, + ) + + def compute_nonlinear_response( + self, + mesh: "FEMesh", + material: "Material", + u_elem: np.ndarray, + state: Optional[Any] = None, + num_layers: int = 5, + tangent: bool = True, + ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: + """Gauss-point von Karman beam-column response on the quadratic interpolation. + + At each integration point the axial strain includes the transverse + gradient coupling + + eps = u' + (v'^2 + w'^2) / 2 + + with all gradients from the quadratic shape functions, giving internal + force and consistent tangent (including the string/geometric term) from + the same potential. With ``cross_section["fiber_plasticity"]`` the + axial/bending response is integrated over the uniaxial fiber grid per + Gauss point using the material hardening curve; shear and torsion stay + linear elastic, matching the 2-node beam formulation. + """ + coords = self.get_node_coordinates(mesh) + try: + L, T = self._beam_frame_and_transform(coords) + except ValueError: + return Element.compute_nonlinear_response( + self, mesh, material, u_elem, state, num_layers, tangent + ) + u_loc = T @ np.asarray(u_elem, dtype=float) + if self.generalized_section is not None: + return self._compute_generalized_von_karman_response_quadratic( + L, + T, + u_loc, + state, + tangent, + ) + E, G12, G13, GJ = _beam_material_properties(material, self.cross_section) + EA = E * self._A + EIy = E * self._Iy + EIz = E * self._Iz + GA_y = G12 * self._A * self._ky + GA_z = G13 * self._A * self._kz + + fiber_config = self._fiber_plasticity_config(material) + num_gp = len(self.GAUSS_POINTS) + if fiber_config is not None: + y_f, z_f, w_f = self._fiber_section_grid(fiber_config) + n_fibers = y_f.size + fiber_strain_all = np.zeros(num_gp * n_fibers, dtype=float) + B_fiber_all = np.zeros((num_gp * n_fibers, 18), dtype=float) + + F_loc = np.zeros(18, dtype=float) + K_loc = np.zeros((18, 18), dtype=float) if tangent else None + gp_data = [] + axial_forces = [] + for gp_index, (xi, weight) in enumerate(zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS)): + N, dN_dxi = self.compute_shape_functions(float(xi)) + dN_dx = dN_dxi * 2.0 / L + jac = L / 2.0 * float(weight) + + B_ax = np.zeros(18, dtype=float) + B_v = np.zeros(18, dtype=float) + B_w = np.zeros(18, dtype=float) + B_ry = np.zeros(18, dtype=float) + B_rz = np.zeros(18, dtype=float) + B_torsion = np.zeros(18, dtype=float) + B_shear_xy = np.zeros(18, dtype=float) + B_shear_xz = np.zeros(18, dtype=float) + for i in range(3): + b = i * 6 + B_ax[b + 0] = dN_dx[i] + B_v[b + 1] = dN_dx[i] + B_w[b + 2] = dN_dx[i] + B_torsion[b + 3] = dN_dx[i] + B_ry[b + 4] = dN_dx[i] + B_rz[b + 5] = dN_dx[i] + B_shear_xy[b + 1] = dN_dx[i] + B_shear_xy[b + 5] = -N[i] + B_shear_xz[b + 2] = dN_dx[i] + B_shear_xz[b + 4] = N[i] + + v_grad = float(B_v @ u_loc) + w_grad = float(B_w @ u_loc) + eps0 = float(B_ax @ u_loc) + 0.5 * (v_grad**2 + w_grad**2) + kappa_y = float(B_ry @ u_loc) + kappa_z = float(B_rz @ u_loc) + B_membrane = B_ax + v_grad * B_v + w_grad * B_w + + # linear shear and torsion at every integration point + gamma_xy = float(B_shear_xy @ u_loc) + gamma_xz = float(B_shear_xz @ u_loc) + twist = float(B_torsion @ u_loc) + F_loc += jac * (GA_y * gamma_xy * B_shear_xy + GA_z * gamma_xz * B_shear_xz + GJ * twist * B_torsion) + if tangent: + K_loc += jac * ( + GA_y * np.outer(B_shear_xy, B_shear_xy) + + GA_z * np.outer(B_shear_xz, B_shear_xz) + + GJ * np.outer(B_torsion, B_torsion) + ) + + if fiber_config is not None: + rows = slice(gp_index * n_fibers, (gp_index + 1) * n_fibers) + fiber_strain_all[rows] = eps0 + z_f * kappa_y + y_f * kappa_z + B_fiber_all[rows] = ( + B_membrane[None, :] + z_f[:, None] * B_ry[None, :] + y_f[:, None] * B_rz[None, :] + ) + gp_data.append((jac, B_v, B_w, rows)) + else: + axial_force = EA * eps0 + axial_forces.append(axial_force) + F_loc += jac * (axial_force * B_membrane + EIy * kappa_y * B_ry + EIz * kappa_z * B_rz) + if tangent: + K_loc += jac * ( + EA * np.outer(B_membrane, B_membrane) + + axial_force * (np.outer(B_v, B_v) + np.outer(B_w, B_w)) + + EIy * np.outer(B_ry, B_ry) + + EIz * np.outer(B_rz, B_rz) + ) + + trial_state: Optional[Any] = state + if fiber_config is not None: + initial_state = _copy_state_fields(state, _INITIAL_BEAM_STATE_KEYS) + initial_stress = _beam_fiber_field( + initial_state.get("initial_fiber_stress", 0.0), + fiber_strain_all.size, + n_fibers, + "initial_fiber_stress", + ) + initial_prestrain = _beam_fiber_field( + initial_state.get("initial_fiber_prestrain", 0.0), + fiber_strain_all.size, + n_fibers, + "initial_fiber_prestrain", + ) + constitutive_fiber_strain = ( + fiber_strain_all - initial_prestrain + initial_stress / E + ) + stress, Et, plastic_new, alpha_new = self._uniaxial_return_map( + constitutive_fiber_strain, + state, + E, + fiber_config.material_curve, + _beam_flow_scale(material, fiber_config.material_curve), + ) + for jac, B_v, B_w, rows in gp_data: + weights_gp = w_f + stress_gp = stress[rows] + F_loc += jac * np.einsum("f,f,fj->j", weights_gp, stress_gp, B_fiber_all[rows]) + axial_force = float(np.sum(weights_gp * stress_gp)) + axial_forces.append(axial_force) + if tangent: + K_loc += jac * np.einsum("f,f,fj,fk->jk", weights_gp, Et[rows], B_fiber_all[rows], B_fiber_all[rows]) + K_loc += jac * axial_force * (np.outer(B_v, B_v) + np.outer(B_w, B_w)) + trial_state = { + "plastic_strain": plastic_new, + "alpha": alpha_new, + "fiber_strain": constitutive_fiber_strain.copy(), + "kinematic_fiber_strain": fiber_strain_all.copy(), + "fiber_stress": stress.copy(), + "axial_force": float(np.mean(axial_forces)) if axial_forces else 0.0, + "equivalent_stress_measure": ( + "hill48" + if _elastic_symmetry(material) == "orthotropic" + else "von_mises" + ), + **initial_state, + } + + if not tangent: + return T.T @ F_loc, None, trial_state + return T.T @ F_loc, T.T @ K_loc @ T, trial_state + + @property + def num_nodes(self) -> int: + return 3 + + @property + def dofs_per_node(self) -> int: + return 6 + + @property + def total_dofs(self) -> int: + return 18 + + def get_node_coordinates(self, mesh: "FEMesh") -> np.ndarray: + coords = np.zeros((3, 3), dtype=float) + for i, node_id in enumerate(self.node_ids): + node = mesh.get_node(node_id) + if node is None: + raise ValueError(f"Quadratic beam element {self.element_id} references missing node {node_id}") + coords[i] = node.coords() + chord = coords[2] - coords[0] + length = float(np.linalg.norm(chord)) + if length > _SMALL: + midpoint_error = float(np.linalg.norm(coords[1] - 0.5 * (coords[0] + coords[2]))) + if midpoint_error > max(1.0e-8 * length, 1.0e-12): + raise ValueError( + f"Quadratic beam element {self.element_id} is curved or has a non-midpoint middle node. " + "The current B3 formulation is straight-sided; use two-node beam segments for curved geometry." + ) + return coords + + def compute_shape_functions(self, xi: float) -> Tuple[np.ndarray, np.ndarray]: + N = np.array([xi * (xi - 1.0) / 2.0, 1.0 - xi**2, xi * (xi + 1.0) / 2.0], dtype=float) + dN_dxi = np.array([xi - 0.5, -2.0 * xi, xi + 0.5], dtype=float) + return N, dN_dxi + + def _beam_frame_and_transform(self, coords: np.ndarray) -> Tuple[float, np.ndarray]: + length = float(np.linalg.norm(coords[2] - coords[0])) + if length < _SMALL: + raise ValueError(f"Quadratic beam element {self.element_id} has near-zero length") + e1 = (coords[2] - coords[0]) / length + R = _beam_rotation_matrix(e1, self._orientation) + T = np.zeros((18, 18), dtype=float) + Rt = R.T + for i in range(3): + b = i * 6 + T[b:b + 3, b:b + 3] = Rt + T[b + 3:b + 6, b + 3:b + 6] = Rt + return length, T + + def compute_stiffness_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: + coords = self.get_node_coordinates(mesh) + try: + L, T = self._beam_frame_and_transform(coords) + except ValueError: + return np.zeros((18, 18), dtype=float) + if self.generalized_section is not None: + section_stiffness = generalized_beam_stiffness( + self.generalized_section + ) + K = np.zeros((18, 18), dtype=float) + for xi, weight in zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS): + shape, derivative_xi = self.compute_shape_functions(float(xi)) + B = _beam_generalized_strain_matrix_from_shape( + shape, + derivative_xi * 2.0 / L, + ) + K += ( + B.T + @ section_stiffness + @ B + * (L / 2.0 * float(weight)) + ) + K_global = T.T @ K @ T + self._stiffness_matrix = K_global + return K_global + E, G12, G13, GJ = _beam_material_properties(material, self.cross_section) + EA = E * self._A + EIy = E * self._Iy + EIz = E * self._Iz + GA_y = G12 * self._A * self._ky + GA_z = G13 * self._A * self._kz + K = np.zeros((18, 18), dtype=float) + for xi, weight in zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS): + N, dN_dxi = self.compute_shape_functions(float(xi)) + dN_dx = dN_dxi * 2.0 / L + B_axial = np.zeros((1, 18), dtype=float) + B_torsion = np.zeros((1, 18), dtype=float) + B_shear_xz = np.zeros((1, 18), dtype=float) + B_shear_xy = np.zeros((1, 18), dtype=float) + B_bend_y = np.zeros((1, 18), dtype=float) + B_bend_z = np.zeros((1, 18), dtype=float) + for i in range(3): + b = i * 6 + B_axial[0, b + 0] = dN_dx[i] + B_torsion[0, b + 3] = dN_dx[i] + B_shear_xz[0, b + 2] = dN_dx[i] + B_shear_xz[0, b + 4] = N[i] + B_shear_xy[0, b + 1] = dN_dx[i] + B_shear_xy[0, b + 5] = -N[i] + B_bend_y[0, b + 4] = dN_dx[i] + B_bend_z[0, b + 5] = dN_dx[i] + jac = L / 2.0 * weight + K += B_axial.T @ (EA * np.eye(1)) @ B_axial * jac + K += B_torsion.T @ (GJ * np.eye(1)) @ B_torsion * jac + K += B_shear_xz.T @ (GA_z * np.eye(1)) @ B_shear_xz * jac + K += B_shear_xy.T @ (GA_y * np.eye(1)) @ B_shear_xy * jac + K += B_bend_y.T @ (EIy * np.eye(1)) @ B_bend_y * jac + K += B_bend_z.T @ (EIz * np.eye(1)) @ B_bend_z * jac + K_global = T.T @ K @ T + self._stiffness_matrix = K_global + return K_global + + def compute_mass_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: + coords = self.get_node_coordinates(mesh) + try: + L, T = self._beam_frame_and_transform(coords) + except ValueError: + return np.zeros((18, 18), dtype=float) + M = np.zeros((18, 18), dtype=float) + generalized_mass = ( + None + if self.generalized_section is None + else generalized_beam_mass_matrix(self.generalized_section) + ) + if generalized_mass is not None: + for xi, weight in zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS): + N, _ = self.compute_shape_functions(float(xi)) + jacobian_weight = float(weight) * L / 2.0 + for i in range(3): + for j in range(3): + M[ + i * 6 : (i + 1) * 6, + j * 6 : (j + 1) * 6, + ] += ( + N[i] + * N[j] + * jacobian_weight + * generalized_mass + ) + M_global = T.T @ M @ T + self._mass_matrix = M_global + return M_global + rho = material.density + # Consistent rotary inertia per rotation axis: polar (Iy+Iz) for + # torsion, the matching section inertia for each bending rotation. + rotary_inertia = (rho * (self._Iy + self._Iz), rho * self._Iy, rho * self._Iz) + for xi, weight in zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS): + N, _ = self.compute_shape_functions(float(xi)) + for i in range(3): + for j in range(3): + translational = N[i] * N[j] * rho * self._A * weight * L / 2.0 + for d in range(3): + M[i * 6 + d, j * 6 + d] += translational + M[i * 6 + 3 + d, j * 6 + 3 + d] += N[i] * N[j] * rotary_inertia[d] * weight * L / 2.0 + M_global = T.T @ M @ T + self._mass_matrix = M_global + return M_global + + def compute_geometric_stiffness_matrix( + self, + mesh: "FEMesh", + material: "Material", + state: Optional[Any] = None, + ) -> np.ndarray: + """ + Beam-column stress stiffness from the lateral displacement gradient: + + KG = N_compression * integral (dN/dx)^T (dN/dx) dx + + applied to both transverse deflections. This is the same + destabilizing-gradient theory as the shell membrane KG and follows the + package convention ``K phi = lambda KG phi`` with compression positive. + The higher-order rotation-gradient term is omitted, which makes the + predicted critical loads slightly conservative on coarse meshes. + """ + axial_compression = self._axial_compression_from_state(state) + if axial_compression == 0.0: + return np.zeros((self.total_dofs, self.total_dofs), dtype=float) + + coords = self.get_node_coordinates(mesh) + try: + L, T = self._beam_frame_and_transform(coords) + except ValueError: + return np.zeros((self.total_dofs, self.total_dofs), dtype=float) + + KG = np.zeros((18, 18), dtype=float) + # Wagner term factor: see BeamElement.compute_geometric_stiffness_matrix. + polar_ratio = self._geometric_polar_radius_squared() + for xi, weight in zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS): + _, dN_dxi = self.compute_shape_functions(float(xi)) + dN_dx = dN_dxi * 2.0 / L + G_matrix = np.zeros((2, 18), dtype=float) + twist_gradient = np.zeros((1, 18), dtype=float) + for i in range(3): + b = i * 6 + G_matrix[0, b + 1] = dN_dx[i] + G_matrix[1, b + 2] = dN_dx[i] + twist_gradient[0, b + 3] = dN_dx[i] + KG += axial_compression * (G_matrix.T @ G_matrix) * (L / 2.0 * weight) + KG += axial_compression * polar_ratio * (twist_gradient.T @ twist_gradient) * (L / 2.0 * weight) + return T.T @ KG @ T + + +class CoupledBeamShellElement(Element): + """Kinematic MPC coupling between one eccentric beam node and one shell node.""" + + def __init__( + self, + element_id: int, + beam_node_id: int, + shell_node_id: int, + material_name: str = "default", + coupling_stiffness: float = 0.0, + eccentricity: Optional[np.ndarray] = None, *, rotating_eccentricity: bool = True, - ): + ): if type(rotating_eccentricity) is not bool: raise TypeError("rotating_eccentricity must be a bool") - super().__init__(element_id, [beam_node_id, shell_node_id], material_name) + super().__init__(element_id, [beam_node_id, shell_node_id], material_name) self.rotating_eccentricity = rotating_eccentricity - self.beam_node_id = beam_node_id - self.shell_node_id = shell_node_id - self.coupling_stiffness = coupling_stiffness - self.eccentricity = None if eccentricity is None else np.asarray(eccentricity, dtype=float) + self.beam_node_id = beam_node_id + self.shell_node_id = shell_node_id + self.coupling_stiffness = coupling_stiffness + self.eccentricity = None if eccentricity is None else np.asarray(eccentricity, dtype=float) if self.eccentricity is not None: self._validate_eccentricity_shape(self.eccentricity) - - @property - def num_nodes(self) -> int: - return 2 - - @property - def dofs_per_node(self) -> int: - return 6 - - def get_node_coordinates(self, mesh: "FEMesh") -> np.ndarray: - beam_node = mesh.get_node(self.beam_node_id) - shell_node = mesh.get_node(self.shell_node_id) - if beam_node is None or shell_node is None: - raise ValueError(f"Coupling element {self.element_id} references a missing node") - return np.array([beam_node.coords(), shell_node.coords()], dtype=float) - + + @property + def num_nodes(self) -> int: + return 2 + + @property + def dofs_per_node(self) -> int: + return 6 + + def get_node_coordinates(self, mesh: "FEMesh") -> np.ndarray: + beam_node = mesh.get_node(self.beam_node_id) + shell_node = mesh.get_node(self.shell_node_id) + if beam_node is None or shell_node is None: + raise ValueError(f"Coupling element {self.element_id} references a missing node") + return np.array([beam_node.coords(), shell_node.coords()], dtype=float) + def _validate_eccentricity_shape(self, eccentricity: np.ndarray) -> np.ndarray: eccentricity = np.asarray(eccentricity, dtype=float) if eccentricity.shape != (3,): @@ -5426,32 +5426,32 @@ def _validate_eccentricity_shape(self, eccentricity: np.ndarray) -> np.ndarray: ) return eccentricity - def _eccentricity_vector(self, mesh: "FEMesh") -> np.ndarray: - if self.eccentricity is not None: + def _eccentricity_vector(self, mesh: "FEMesh") -> np.ndarray: + if self.eccentricity is not None: r = np.asarray(self.eccentricity, dtype=float) else: coords = self.get_node_coordinates(mesh) r = np.asarray(coords[0] - coords[1], dtype=float) return self._validate_eccentricity_shape(r) - - def compute_stiffness_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: - # Coupling is enforced exactly by assembly.build_constraint_transformation(). - # Returning zero avoids penalty-stiffness pollution. - K = np.zeros((self.total_dofs, self.total_dofs), dtype=float) - self._stiffness_matrix = K - return K - - def get_mpc_constraints(self, mesh: "FEMesh") -> List[Dict[str, Any]]: - """ - Return slave/master constraints for the eccentric beam-shell relation. - - Beam node DOFs are slaves. Shell node DOFs are masters: - u_b = u_s + theta_s x r - theta_b = theta_s - where r points from shell node to beam node. - """ - beam_node = mesh.get_node(self.beam_node_id) - shell_node = mesh.get_node(self.shell_node_id) + + def compute_stiffness_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: + # Coupling is enforced exactly by assembly.build_constraint_transformation(). + # Returning zero avoids penalty-stiffness pollution. + K = np.zeros((self.total_dofs, self.total_dofs), dtype=float) + self._stiffness_matrix = K + return K + + def get_mpc_constraints(self, mesh: "FEMesh") -> List[Dict[str, Any]]: + """ + Return slave/master constraints for the eccentric beam-shell relation. + + Beam node DOFs are slaves. Shell node DOFs are masters: + u_b = u_s + theta_s x r + theta_b = theta_s + where r points from shell node to beam node. + """ + beam_node = mesh.get_node(self.beam_node_id) + shell_node = mesh.get_node(self.shell_node_id) if beam_node is None: raise ValueError( f"Coupling element {self.element_id} references missing beam node " @@ -5462,35 +5462,35 @@ def get_mpc_constraints(self, mesh: "FEMesh") -> List[Dict[str, Any]]: f"Coupling element {self.element_id} references missing shell node " f"{self.shell_node_id}" ) - - b = beam_node.dofs - s = shell_node.dofs - rx, ry, rz = self._eccentricity_vector(mesh) - - return [ - { - "slave": b[0], - "masters": {s[0]: 1.0, s[4]: rz, s[5]: -ry}, - "value": 0.0, - "label": f"beam_shell_ecc_u_x_{self.element_id}", - }, - { - "slave": b[1], - "masters": {s[1]: 1.0, s[3]: -rz, s[5]: rx}, - "value": 0.0, - "label": f"beam_shell_ecc_u_y_{self.element_id}", - }, - { - "slave": b[2], - "masters": {s[2]: 1.0, s[3]: ry, s[4]: -rx}, - "value": 0.0, - "label": f"beam_shell_ecc_u_z_{self.element_id}", - }, - {"slave": b[3], "masters": {s[3]: 1.0}, "value": 0.0, "label": f"beam_shell_ecc_rx_{self.element_id}"}, - {"slave": b[4], "masters": {s[4]: 1.0}, "value": 0.0, "label": f"beam_shell_ecc_ry_{self.element_id}"}, - {"slave": b[5], "masters": {s[5]: 1.0}, "value": 0.0, "label": f"beam_shell_ecc_rz_{self.element_id}"}, - ] - + + b = beam_node.dofs + s = shell_node.dofs + rx, ry, rz = self._eccentricity_vector(mesh) + + return [ + { + "slave": b[0], + "masters": {s[0]: 1.0, s[4]: rz, s[5]: -ry}, + "value": 0.0, + "label": f"beam_shell_ecc_u_x_{self.element_id}", + }, + { + "slave": b[1], + "masters": {s[1]: 1.0, s[3]: -rz, s[5]: rx}, + "value": 0.0, + "label": f"beam_shell_ecc_u_y_{self.element_id}", + }, + { + "slave": b[2], + "masters": {s[2]: 1.0, s[3]: ry, s[4]: -rx}, + "value": 0.0, + "label": f"beam_shell_ecc_u_z_{self.element_id}", + }, + {"slave": b[3], "masters": {s[3]: 1.0}, "value": 0.0, "label": f"beam_shell_ecc_rx_{self.element_id}"}, + {"slave": b[4], "masters": {s[4]: 1.0}, "value": 0.0, "label": f"beam_shell_ecc_ry_{self.element_id}"}, + {"slave": b[5], "masters": {s[5]: 1.0}, "value": 0.0, "label": f"beam_shell_ecc_rz_{self.element_id}"}, + ] + def get_nonlinear_mpc_descriptor(self, mesh: "FEMesh") -> Optional[Dict[str, Any]]: """Return the finite-rotation master-slave descriptor for corotational solves. @@ -5538,790 +5538,790 @@ def get_nonlinear_mpc_descriptor(self, mesh: "FEMesh") -> Optional[Dict[str, Any "label_prefix": f"beam_shell_ecc_{self.element_id}", } - def compute_mass_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: - return np.zeros((self.total_dofs, self.total_dofs), dtype=float) - - - -def validate_initial_field_state( - element: Element, - material: "Material", - state: Dict[str, Any], - num_layers: int, - mesh: Optional["FEMesh"] = None, -) -> None: - """Validate that a prescribed initial stress is locally admissible. - - Residual-stress input specifies the stress *at the initialized reference - state*; it is not a request for the solver to reconstruct an unknown - manufacturing load path. For nonlinear materials the supplied stress - must therefore lie on or inside the flow surface associated with the - supplied hardening state. - """ - tolerance = 1.0e-9 - if isinstance(element, ShellElement) and ( - "initial_membrane_stress" in state or "initial_bending_stress" in state - ): - symmetry = _elastic_symmetry(material) - curve = getattr(material, "hardening_curve", None) - hill_yield = getattr(material, "hill_yield", None) - if symmetry == "orthotropic" and curve is not None and hill_yield is None: - raise ValueError( - f"Orthotropic material {getattr(material, 'name', '')!r} " - "requires hill_yield when hardening_curve is active." - ) - if curve is None and hill_yield is None: - return - n_gp = len(element.gauss_points) - z_layers, _weights = lobatto_layers(num_layers, element.thickness) - zero = np.zeros((n_gp, 3), dtype=float) - membrane = _shell_field_rows( - state.get("initial_membrane_stress", zero), - n_gp, - "initial_membrane_stress", - ) - bending = _shell_field_rows( - state.get("initial_bending_stress", zero), - n_gp, - "initial_bending_stress", - ) - stress = ( - membrane[:, None, :] - + (2.0 * z_layers[None, :, None] / element.thickness) * bending[:, None, :] - ).reshape(n_gp * num_layers, 3) - alpha = np.asarray(state.get("alpha", np.zeros(stress.shape[0])), dtype=float).reshape(-1) - if alpha.size != stress.shape[0]: - raise ValueError( - f"Shell initial alpha has {alpha.size} entries; expected {stress.shape[0]}" - ) - if np.any(~np.isfinite(alpha)) or np.any(alpha < 0.0): - raise ValueError("Shell initial alpha must be finite and non-negative") - if symmetry == "orthotropic": - from .plasticity import hill48_plane_stress_equivalent_stress - - if mesh is None: - if element.material_direction is not None: - raise ValueError( - "mesh is required to validate an oriented orthotropic " - "shell initial stress" - ) - material_angle = np.deg2rad(element.material_angle_deg) - else: - coordinates = element.get_node_coordinates(mesh) - material_angle = element._material_angle( - element._center_frame(coordinates) - ) - _Q, _G, _strain_to_material, stress_to_local = ( - _shell_material_matrices(material, material_angle) - ) - stress_material = np.einsum( - "ij,nj->ni", - np.linalg.inv(stress_to_local), - stress, - ) - equivalent = hill48_plane_stress_equivalent_stress( - stress_material, - hill_yield, - ) - if curve is None: - flow = np.full(equivalent.shape, float(hill_yield.X)) - else: - reference = float( - np.asarray(curve.flow_stress(np.array([0.0])), dtype=float)[0] - ) - flow = ( - float(hill_yield.X) - * np.asarray(curve.flow_stress(alpha), dtype=float) - / reference - ) - else: - equivalent = np.sqrt( - np.maximum( - stress[:, 0] ** 2 - - stress[:, 0] * stress[:, 1] - + stress[:, 1] ** 2 - + 3.0 * stress[:, 2] ** 2, - 0.0, - ) - ) - flow = np.asarray(curve.flow_stress(alpha), dtype=float) - excess = equivalent - flow - if np.any(excess > tolerance * np.maximum(flow, 1.0)): - index = int(np.argmax(excess)) - raise ValueError( - f"Initial shell stress on element {element.element_id} is outside the supplied " - f"hardening-state flow surface at point {index}: " - f"sigma_eq={equivalent[index]:.6g}, flow={flow[index]:.6g}. " - "Supply an admissible stress or compatible alpha history." - ) - if isinstance(element, (BeamElement, QuadraticBeamElement)) and "initial_fiber_stress" in state: - config = element._fiber_plasticity_config(material) - if config is None: - return - curve = config.material_curve - y, _z, _weights = element._fiber_section_grid(config) - section_fibers = y.size - total_fibers = section_fibers * ( - len(element.GAUSS_POINTS) if isinstance(element, QuadraticBeamElement) else 1 - ) - stress = _beam_fiber_field( - state["initial_fiber_stress"], - total_fibers, - section_fibers, - "initial_fiber_stress", - ) - alpha = np.asarray(state.get("alpha", np.zeros(total_fibers)), dtype=float).reshape(-1) - if alpha.size not in {1, total_fibers}: - raise ValueError( - f"Beam initial alpha has {alpha.size} entries; expected 1 or {total_fibers}" - ) - if alpha.size == 1: - alpha = np.full(total_fibers, float(alpha[0]), dtype=float) - if np.any(~np.isfinite(alpha)) or np.any(alpha < 0.0): - raise ValueError("Beam initial alpha must be finite and non-negative") - scale = _beam_flow_scale(material, curve) - flow = ( - np.full(alpha.shape, scale, dtype=float) - if curve is None - else scale * np.asarray(curve.flow_stress(alpha), dtype=float) - ) - excess = np.abs(stress) - flow - if np.any(excess > tolerance * np.maximum(flow, 1.0)): - index = int(np.argmax(excess)) - raise ValueError( - f"Initial beam-fiber stress on element {element.element_id} is outside the supplied " - f"hardening-state flow surface at fiber {index}: " - f"|sigma|={abs(stress[index]):.6g}, flow={flow[index]:.6g}. " - "Supply an admissible stress or compatible alpha history." - ) - - -ELEMENT_TYPES = { - "shell": ShellElement, - "shell3": ShellElement, - "tri3": ShellElement, - "tria3": ShellElement, - "t3": ShellElement, - "s3": ShellElement, - "shell6": ShellElement, - "tri6": ShellElement, - "tria6": ShellElement, - "t6": ShellElement, - "s6": ShellElement, - "beam": BeamElement, - "quadratic_beam": QuadraticBeamElement, - "coupled": CoupledBeamShellElement, -} - - -DEFAULT_Q4_FORMULATION = "e4-pl" -# New/current-policy three-node shells use the V2D companion accepted by the -# V6W qualification. Historical records without formulation identity still -# deserialize explicitly as ``legacy-s3`` below, and direct -# ``ShellElement(...)`` construction remains the documented legacy API. -DEFAULT_S3_FORMULATION = "e4-pl-s3-v2d" -LEGACY_Q4_AVAILABLE_THROUGH = "0.4.x" -LEGACY_Q4_REMOVAL_TARGET = "0.5.0" - - -class LegacyQ4DeprecationWarning(DeprecationWarning): - """Warning emitted when the temporary legacy four-node rollback is used.""" - - -class LegacyS3MigrationWarning(UserWarning): - """Warning emitted when a missing-ID historical TRI3 loads as legacy.""" - - -LegacyShellElement = ShellElement - - -def _normalized_shell_formulation( - node_count: int, - formulation: Optional[str], -) -> str: - if formulation is None: - resolved = ( - DEFAULT_Q4_FORMULATION - if node_count == 4 - else DEFAULT_S3_FORMULATION - if node_count == 3 - else "legacy" - ) - else: - resolved = str(formulation) - raw_resolved = resolved.strip().lower() - resolved = raw_resolved.replace("_", "-") - exact_s3_v2_selectors = {"e4-pl-s3-v2", "qualified-s3-v2"} - exact_s3_v2b_selectors = {"e4-pl-s3-v2b", "qualified-s3-v2b"} - exact_s3_v2c_selectors = {"e4-pl-s3-v2c", "qualified-s3-v2c"} - exact_s3_v2d_selectors = {"e4-pl-s3-v2d", "qualified-s3-v2d"} - if resolved in exact_s3_v2_selectors and raw_resolved not in exact_s3_v2_selectors: - raise ValueError( - "strict-flat E4-PL S3 V2 requires the canonical e4-pl-s3-v2 selector" - ) - if resolved in exact_s3_v2b_selectors and raw_resolved not in exact_s3_v2b_selectors: - raise ValueError( - "strict-flat E4-PL S3 V2B requires the canonical e4-pl-s3-v2b selector" - ) - if resolved in exact_s3_v2c_selectors and raw_resolved not in exact_s3_v2c_selectors: - raise ValueError( - "strict-flat E4-PL S3 V2C requires the canonical e4-pl-s3-v2c selector" - ) - if resolved in exact_s3_v2d_selectors and raw_resolved not in exact_s3_v2d_selectors: - raise ValueError( - "native-parity E4-PL S3 V2D requires the canonical e4-pl-s3-v2d selector" - ) - if resolved == "default": - resolved = ( - DEFAULT_Q4_FORMULATION - if node_count == 4 - else DEFAULT_S3_FORMULATION - if node_count == 3 - else "legacy" - ) - e4_aliases = {"e4-pl", "qualified-s4"} - s3_aliases = {"e4-pl-s3", "qualified-s3"} - s3_v2_aliases = exact_s3_v2_selectors - s3_v2b_aliases = exact_s3_v2b_selectors - s3_v2c_aliases = exact_s3_v2c_selectors - s3_v2d_aliases = exact_s3_v2d_selectors - legacy_aliases = {"legacy", "legacy-shell", "legacy-s4"} - if node_count == 4 and resolved in e4_aliases: - return "e4-pl" - if node_count == 3 and resolved in s3_aliases: - return "e4-pl-s3-v2d" - if node_count == 3 and resolved in s3_v2_aliases: - return "e4-pl-s3-v2" - if node_count == 3 and resolved in s3_v2b_aliases: - return "e4-pl-s3-v2b" - if node_count == 3 and resolved in s3_v2c_aliases: - return "e4-pl-s3-v2c" - if node_count == 3 and resolved in s3_v2d_aliases: - return "e4-pl-s3-v2d" - if resolved == "legacy-s3": - if node_count != 3: - raise ValueError("legacy-s3 is available only for three-node shell topology") - return "legacy-s3" - if resolved in legacy_aliases: - return "legacy" - if resolved in e4_aliases: - raise ValueError("E4-PL is available only for four-node shell topology") - if resolved in s3_aliases: - raise ValueError("qualified E4-PL S3 is available only for three-node shell topology") - if resolved in s3_v2_aliases: - raise ValueError( - "strict-flat E4-PL S3 V2 is available only for three-node shell topology" - ) - if resolved in s3_v2b_aliases: - raise ValueError( - "strict-flat E4-PL S3 V2B is available only for three-node shell topology" - ) - if resolved in s3_v2c_aliases: - raise ValueError( - "strict-flat E4-PL S3 V2C is available only for three-node shell topology" - ) - if resolved in s3_v2d_aliases: - raise ValueError( - "native-parity E4-PL S3 V2D is available only for three-node shell topology" - ) - raise ValueError(f"Unknown shell formulation: {formulation}") - - -def shell_formulation_diagnostics( - *, - node_count: int = 4, - formulation: Optional[str] = None, -) -> Dict[str, Any]: - """Describe shell selection and the temporary legacy-Q4 rollback state. - - This helper performs no element construction or mechanics. It is intended - for migration tooling, logs, and support diagnostics. - """ - - count = int(node_count) - if count not in {3, 4, 6, 8}: - raise ValueError("shell node_count must be one of 3, 4, 6 or 8") - selected = _normalized_shell_formulation(count, formulation) - normalized_request = ( - None - if formulation is None - else str(formulation).strip().lower().replace("_", "-") - ) - return { - "schema": "anysolver.shell-formulation-diagnostics-v1", - "node_count": count, - "requested_formulation": normalized_request, - "selected_formulation": selected, - "production_default": formulation is None and count in {3, 4}, - "topology_policy": ( - "QUALIFIED_E4_PL_Q4" - if count == 4 and selected == "e4-pl" - else ( - "DEPRECATED_LEGACY_Q4_ROLLBACK" - if count == 4 - else ( - "QUALIFIED_E4_PL_S3_OPT_IN" - if count == 3 and selected == "e4-pl-s3" - else ( - "STRICT_FLAT_LINEAR_E4_PL_S3_V2_OPT_IN" - if count == 3 and selected == "e4-pl-s3-v2" - else ( - "STRICT_FLAT_LINEAR_E4_PL_S3_V2B_OPT_IN" - if count == 3 and selected == "e4-pl-s3-v2b" - else ( - "STRICT_FLAT_LINEAR_E4_PL_S3_V2C_OPT_IN" - if count == 3 and selected == "e4-pl-s3-v2c" - else ( - "NATIVE_PARITY_E4_PL_S3_V2D_DEFAULT" - if count == 3 and selected == "e4-pl-s3-v2d" - else "PRESERVED_LEGACY_NON_Q4" - ) - ) - ) - ) - ) - ) - ), - "legacy_q4": { - "state": "DEPRECATED_BURN_IN_ROLLBACK", - "available_through": LEGACY_Q4_AVAILABLE_THROUGH, - "removal_not_before": LEGACY_Q4_REMOVAL_TARGET, - "selector": "legacy", - "warning": "LegacyQ4DeprecationWarning", - }, - } - - -def create_shell_element( - element_id: int, - node_ids: List[int], - material_name: str = "default", - *, - formulation: Optional[str] = None, - **kwargs: Any, -) -> ShellElement: - """Create a topology-selected shell while retaining explicit rollbacks. - - Four-node and three-node shells select their qualified E4-PL formulations - by default. Higher-order shell topologies retain - :class:`LegacyShellElement`. Passing ``formulation="legacy-s3"`` is the - documented three-node rollback; an explicit ``e4-pl`` request remains - Q4-only. - """ - - resolved = _normalized_shell_formulation(len(node_ids), formulation) - if resolved == "e4-pl": - from .e4_pl_element import QualifiedE4PLShellElement - - return QualifiedE4PLShellElement( - element_id, - node_ids, - material_name, - **kwargs, - ) - if resolved == "e4-pl-s3": - from .e4_pl_s3_element import QualifiedE4PLS3ShellElement - - return QualifiedE4PLS3ShellElement( - element_id, - node_ids, - material_name, - **kwargs, - ) - if resolved == "e4-pl-s3-v2": - from .e4_pl_s3_v2_element import StrictFlatLinearE4PLS3V2ShellElement - - return StrictFlatLinearE4PLS3V2ShellElement( - element_id, - node_ids, - material_name, - **kwargs, - ) - if resolved == "e4-pl-s3-v2b": - from .e4_pl_s3_v2b_element import StrictFlatLinearE4PLS3V2BShellElement - - return StrictFlatLinearE4PLS3V2BShellElement( - element_id, - node_ids, - material_name, - **kwargs, - ) - if resolved == "e4-pl-s3-v2c": - from .e4_pl_s3_v2c_element import StrictFlatLinearE4PLS3V2CShellElement - - return StrictFlatLinearE4PLS3V2CShellElement( - element_id, - node_ids, - material_name, - **kwargs, - ) - if resolved == "e4-pl-s3-v2d": - from .e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement - - if kwargs.get("reference_normal") is None: - raise ValueError( - "qualified S3 V2D requires authoritative reference_normal; " - "use formulation='legacy-s3' for historical connectivity-only input" - ) - - return NativeParityE4PLS3V2DShellElement( - element_id, - node_ids, - material_name, - **kwargs, - ) - if resolved in {"legacy", "legacy-s3"}: - return LegacyShellElement(element_id, node_ids, material_name, **kwargs) - raise AssertionError(f"unreachable shell formulation selection: {resolved}") - - -def shell_element_from_dict(payload: Mapping[str, Any]) -> ShellElement: - """Deserialize a shell without guessing a qualified formulation. - - Historical three-node records without ``formulation_id`` remain legacy. - Qualified records are dispatched by their exact identity and unknown - identities fail closed. - """ - - if not isinstance(payload, Mapping): - raise TypeError("serialized shell element must be a mapping") - data = dict(payload) - node_ids = [int(value) for value in data.get("node_ids", ())] - formulation_id = data.get("formulation_id") - if formulation_id is not None: - from .e4_pl_s3_v2_element import ( - FORMULATION_ID as S3_V2_FORMULATION_ID, - StrictFlatLinearCapabilityError, - ) - from .e4_pl_s3_v2b_element import ( - FORMULATION_ID as S3_V2B_FORMULATION_ID, - StrictFlatLinearCapabilityError as StrictFlatLinearV2BCapabilityError, - ) - from .e4_pl_s3_v2c_element import ( - FORMULATION_ID as S3_V2C_FORMULATION_ID, - StrictFlatLinearE4PLS3V2CShellElement, - ) - from .e4_pl_s3_v2d_element import ( - FORMULATION_ID as S3_V2D_FORMULATION_ID, - NativeParityE4PLS3V2DShellElement, - ) - - if formulation_id == S3_V2_FORMULATION_ID: - raise StrictFlatLinearCapabilityError( - "strict-flat S3 V2 serialization/restart is outside the " - "authorized Stage-1 surface" - ) - if formulation_id == S3_V2B_FORMULATION_ID: - raise StrictFlatLinearV2BCapabilityError( - "strict-flat S3 V2B serialization/restart is outside the " - "authorized production-parity surface" - ) - if formulation_id == S3_V2C_FORMULATION_ID: - return StrictFlatLinearE4PLS3V2CShellElement.from_dict(data) - if formulation_id == S3_V2D_FORMULATION_ID: - return NativeParityE4PLS3V2DShellElement.from_dict(data) - from .e4_pl_element import ( - FORMULATION_ID as Q4_FORMULATION_ID, - QualifiedE4PLShellElement, - _PLANAR_FORMULATION_ID, - ) - from .e4_pl_s3_element import ( - FORMULATION_ID as S3_FORMULATION_ID, - QualifiedE4PLS3ShellElement, - ) - - if formulation_id in {Q4_FORMULATION_ID, _PLANAR_FORMULATION_ID}: - return QualifiedE4PLShellElement.from_dict(data) - if formulation_id == S3_FORMULATION_ID: - return QualifiedE4PLS3ShellElement.from_dict(data) - raise ValueError(f"unknown serialized shell formulation_id: {formulation_id}") - def normalize_candidate_fingerprint(value: Any) -> str: - return str(value).strip().lower().replace("_", "-") - - normalized_serialized_type = normalize_candidate_fingerprint( - data.get("type", "") - ) - if normalized_serialized_type in { - "qualifiede4plshellelement", - "qualifiede4pls3shellelement", - "strictflatlineare4pls3v2shellelement", - "strictflatlineare4pls3v2bshellelement", - "strictflatlineare4pls3v2cshellelement", - "nativeparitye4pls3v2dshellelement", - "e4-pl", - "e4-pl-s3", - "e4-pl-s3-v2", - "e4-pl-s3-v2b", - "e4-pl-s3-v2c", - "e4-pl-s3-v2d", - "qualified-s3-v2", - "qualified-s3-v2b", - "qualified-s3-v2c", - "qualified-s3-v2d", - "qualified-s3", - }: - raise ValueError("serialized qualified shell is missing formulation_id") - qualified_s3_markers = frozenset( - { - "algebraic_coordinate_policy", - "bubble_convention", - "dynamic_reduction_policy", - "director_polarity", - "director_polarity_policy_id", - "director_reversal_transform_id", - "formulation_schema", - "geometric_stiffness_policy", - "mass_moment_id", - "quadrature_id", - "quadrature_authority_id", - "reference_normal", - "reference_surface_offset", - "reference_surface_offset_policy_id", - "reference_surface_strain_transform_id", - "reference_surface_mass_shift_id", - "recovery_policy_id", - "state_layout_id", - } - ) - strict_s3_v2_unique_markers = frozenset( - { - "director_policy_id", - "equation_map_sha256", - "pl_completion_policy_id", - "primary_source_sha256", - "resultant_policy_id", - "section_policy_id", - "source_contract_schema", - "source_contract_sha256", - "strict_flat_linear_scope_id", - } - ) - qualified_q4_markers = frozenset( - { - "activity_disposition_schema_id", - "current_state_binding_schema_id", - "current_state_algorithmic_origin_schema_id", - "current_state_projection_policy_id", - "current_state_tangent_decomposition_policy_id", - "deleted_frozen_policy_id", - "director_polarity", - "director_polarity_policy_id", - "director_reversal_transform_id", - "implementation_id", - "quadrature_authority_id", - "failed_state_policy_id", - "recovery_policy_id", - "reference_normal", - "stationary_solve_policy_id", - } - ) - strict_s3_v2_marker_set = set(strict_s3_v2_unique_markers & data.keys()) - serialized_selector = data.get("selector") - if isinstance(serialized_selector, str) and normalize_candidate_fingerprint( - serialized_selector - ) in { - "e4-pl-s3-v2", - "e4-pl-s3-v2b", - "e4-pl-s3-v2c", - "e4-pl-s3-v2d", - "qualified-s3-v2", - "qualified-s3-v2b", - "qualified-s3-v2c", - "qualified-s3-v2d", - }: - strict_s3_v2_marker_set.add("selector") - if normalize_candidate_fingerprint(data.get("implementation_id", "")) == ( - "e4-pl-s3-v2-dkmt-eq12-41-cst-pl-hammer3-v1" - ): - strict_s3_v2_marker_set.add("implementation_id") - if normalize_candidate_fingerprint(data.get("implementation_id", "")) == ( - "e4-pl-s3-v2c-min3-relaxed-uhm-cst-pl-parity-v1" - ): - strict_s3_v2_marker_set.add("implementation_id") - if normalize_candidate_fingerprint(data.get("implementation_id", "")) == ( - "e4-pl-s3-v2d-min3-native-section-linear-gate-v1" - ): - strict_s3_v2_marker_set.add("implementation_id") - if normalize_candidate_fingerprint(data.get("implementation_id", "")) == ( - "e4-pl-s3-v2b-min3-relaxed-uhm-cst-pl-hammer3-v1" - ): - strict_s3_v2_marker_set.add("implementation_id") - if normalize_candidate_fingerprint(data.get("formulation_schema", "")) == ( - "anysolver.e4-pl-s3-v2-strict-flat-linear-element-v1" - ): - strict_s3_v2_marker_set.add("formulation_schema") - if normalize_candidate_fingerprint(data.get("formulation_schema", "")) == ( - "anysolver.e4-pl-s3-v2c-flat-linear-parity-element-v1" - ): - strict_s3_v2_marker_set.add("formulation_schema") - if normalize_candidate_fingerprint(data.get("formulation_schema", "")) == ( - "anysolver.e4-pl-s3-v2d-native-parity-element-v1" - ): - strict_s3_v2_marker_set.add("formulation_schema") - if normalize_candidate_fingerprint(data.get("formulation_schema", "")) == ( - "anysolver.e4-pl-s3-v2b-strict-flat-linear-element-v1" - ): - strict_s3_v2_marker_set.add("formulation_schema") - if normalize_candidate_fingerprint( - data.get("quadrature_authority_id", "") - ) == "s3-v2-dkmt-hammer3-degree2-exact-v1": - strict_s3_v2_marker_set.add("quadrature_authority_id") - if strict_s3_v2_marker_set: - raise ValueError( - "serialized shell retains strict-flat S3 V2 fingerprint markers " - "but is missing formulation_id: " - + ", ".join(sorted(strict_s3_v2_marker_set)) - ) - retained_s3_marker_set = set(qualified_s3_markers & data.keys()) - retained_s3_markers = tuple(sorted(retained_s3_marker_set)) - if len(node_ids) == 3 and retained_s3_markers: - raise ValueError( - "serialized three-node shell retains qualified S3 fingerprint " - "markers but is missing formulation_id: " - + ", ".join(retained_s3_markers) - ) - retained_q4_markers = tuple(sorted(qualified_q4_markers & data.keys())) - if len(node_ids) == 4 and retained_q4_markers: - raise ValueError( - "serialized four-node shell retains qualified Q4 fingerprint " - "markers but is missing formulation_id: " - + ", ".join(retained_q4_markers) - ) - if len(node_ids) not in {3, 4, 6, 8}: - raise ValueError("serialized legacy shell requires 3, 4, 6 or 8 nodes") - element = create_shell_element( - element_id=int(data["element_id"]), - node_ids=node_ids, - material_name=str(data.get("material_name", "default")), - formulation="legacy-s3" if len(node_ids) == 3 else "legacy", - thickness=float(data.get("thickness", 0.01)), - drilling_stabilization=float(data.get("drilling_stabilization", 1.0e-3)), - reduced_integration=bool(data.get("reduced_integration", False)), - hourglass_stabilization=float(data.get("hourglass_stabilization", 1.0e-8)), - material_direction=data.get("material_direction"), - material_angle_deg=float(data.get("material_angle_deg", 0.0)), - shell_section=data.get("shell_section"), - ) - if len(node_ids) == 3: - warnings.warn( - "LEGACY_S3_MISSING_FORMULATION_ID: historical three-node shell " - "record loaded as legacy-s3; qualified-s3 was not inferred; " - "qualified-s3 hot restart is forbidden without full load-history " - "replay", - LegacyS3MigrationWarning, - stacklevel=2, - ) - return element - - -def create_element( - element_type: str, - element_id: int, - node_ids: List[int], - material_name: str = "default", - **kwargs: Any, -) -> Element: - normalized_type = str(element_type).lower() - if normalized_type == "ge-beam3": - # The qualified geometrically exact three-node beam is deliberately - # kept out of ``ELEMENT_TYPES``. That registry also feeds legacy - # beam dispatch and batching paths, while GE-B3 has its own rotation - # transaction and state contract. Keep this one exact opt-in route - # local so no existing beam spelling changes meaning. - from .ge_beam3_element import GeometricallyExactBeam3D3NElement - - return GeometricallyExactBeam3D3NElement( - element_id, - node_ids, - material_name, - **kwargs, - ) - if normalized_type in {"e4-pl-s3-v2d", "qualified-s3-v2d"}: - return create_shell_element( - element_id, - node_ids, - material_name, - formulation="e4-pl-s3-v2d", - **kwargs, - ) - if normalized_type in {"e4-pl-s3-v2c", "qualified-s3-v2c"}: - return create_shell_element( - element_id, - node_ids, - material_name, - formulation="e4-pl-s3-v2c", - **kwargs, - ) - if normalized_type in {"e4-pl-s3-v2b", "qualified-s3-v2b"}: - return create_shell_element( - element_id, - node_ids, - material_name, - formulation="e4-pl-s3-v2b", - **kwargs, - ) - if normalized_type in {"e4-pl-s3-v2", "qualified-s3-v2"}: - return create_shell_element( - element_id, - node_ids, - material_name, - formulation="e4-pl-s3-v2", - **kwargs, - ) - if normalized_type in {"e4-pl-s3", "e4_pl_s3", "qualified-s3", "qualified_s3"}: - return create_shell_element( - element_id, - node_ids, - material_name, - formulation="e4-pl-s3", - **kwargs, - ) - if normalized_type in {"legacy-s3", "legacy_s3"}: - return create_shell_element( - element_id, - node_ids, - material_name, - formulation="legacy-s3", - **kwargs, - ) - if normalized_type in {"e4-pl", "e4_pl", "qualified_s4"}: - return create_shell_element( - element_id, - node_ids, - material_name, - formulation="e4-pl", - **kwargs, - ) - if normalized_type in {"legacy-shell", "legacy_shell", "legacy-s4", "legacy_s4"}: - return create_shell_element( - element_id, - node_ids, - material_name, - formulation="legacy", - **kwargs, - ) - if normalized_type == "shell": - formulation = kwargs.pop("formulation", None) - return create_shell_element( - element_id, - node_ids, - material_name, - formulation=formulation, - **kwargs, - ) - if normalized_type in {"shell3", "tri3", "tria3", "t3", "s3"}: - formulation = kwargs.pop("formulation", None) - return create_shell_element( - element_id, - node_ids, - material_name, - formulation=formulation, - **kwargs, - ) - if normalized_type not in ELEMENT_TYPES: - raise ValueError(f"Unknown element type: {element_type}") - if normalized_type == "coupled": - if len(node_ids) != 2: - raise ValueError("CoupledBeamShellElement factory requires [beam_node_id, shell_node_id]") - return CoupledBeamShellElement(element_id, node_ids[0], node_ids[1], material_name, **kwargs) - return ELEMENT_TYPES[normalized_type](element_id, node_ids, material_name, **kwargs) + def compute_mass_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: + return np.zeros((self.total_dofs, self.total_dofs), dtype=float) + + + +def validate_initial_field_state( + element: Element, + material: "Material", + state: Dict[str, Any], + num_layers: int, + mesh: Optional["FEMesh"] = None, +) -> None: + """Validate that a prescribed initial stress is locally admissible. + + Residual-stress input specifies the stress *at the initialized reference + state*; it is not a request for the solver to reconstruct an unknown + manufacturing load path. For nonlinear materials the supplied stress + must therefore lie on or inside the flow surface associated with the + supplied hardening state. + """ + tolerance = 1.0e-9 + if isinstance(element, ShellElement) and ( + "initial_membrane_stress" in state or "initial_bending_stress" in state + ): + symmetry = _elastic_symmetry(material) + curve = getattr(material, "hardening_curve", None) + hill_yield = getattr(material, "hill_yield", None) + if symmetry == "orthotropic" and curve is not None and hill_yield is None: + raise ValueError( + f"Orthotropic material {getattr(material, 'name', '')!r} " + "requires hill_yield when hardening_curve is active." + ) + if curve is None and hill_yield is None: + return + n_gp = len(element.gauss_points) + z_layers, _weights = lobatto_layers(num_layers, element.thickness) + zero = np.zeros((n_gp, 3), dtype=float) + membrane = _shell_field_rows( + state.get("initial_membrane_stress", zero), + n_gp, + "initial_membrane_stress", + ) + bending = _shell_field_rows( + state.get("initial_bending_stress", zero), + n_gp, + "initial_bending_stress", + ) + stress = ( + membrane[:, None, :] + + (2.0 * z_layers[None, :, None] / element.thickness) * bending[:, None, :] + ).reshape(n_gp * num_layers, 3) + alpha = np.asarray(state.get("alpha", np.zeros(stress.shape[0])), dtype=float).reshape(-1) + if alpha.size != stress.shape[0]: + raise ValueError( + f"Shell initial alpha has {alpha.size} entries; expected {stress.shape[0]}" + ) + if np.any(~np.isfinite(alpha)) or np.any(alpha < 0.0): + raise ValueError("Shell initial alpha must be finite and non-negative") + if symmetry == "orthotropic": + from .plasticity import hill48_plane_stress_equivalent_stress + + if mesh is None: + if element.material_direction is not None: + raise ValueError( + "mesh is required to validate an oriented orthotropic " + "shell initial stress" + ) + material_angle = np.deg2rad(element.material_angle_deg) + else: + coordinates = element.get_node_coordinates(mesh) + material_angle = element._material_angle( + element._center_frame(coordinates) + ) + _Q, _G, _strain_to_material, stress_to_local = ( + _shell_material_matrices(material, material_angle) + ) + stress_material = np.einsum( + "ij,nj->ni", + np.linalg.inv(stress_to_local), + stress, + ) + equivalent = hill48_plane_stress_equivalent_stress( + stress_material, + hill_yield, + ) + if curve is None: + flow = np.full(equivalent.shape, float(hill_yield.X)) + else: + reference = float( + np.asarray(curve.flow_stress(np.array([0.0])), dtype=float)[0] + ) + flow = ( + float(hill_yield.X) + * np.asarray(curve.flow_stress(alpha), dtype=float) + / reference + ) + else: + equivalent = np.sqrt( + np.maximum( + stress[:, 0] ** 2 + - stress[:, 0] * stress[:, 1] + + stress[:, 1] ** 2 + + 3.0 * stress[:, 2] ** 2, + 0.0, + ) + ) + flow = np.asarray(curve.flow_stress(alpha), dtype=float) + excess = equivalent - flow + if np.any(excess > tolerance * np.maximum(flow, 1.0)): + index = int(np.argmax(excess)) + raise ValueError( + f"Initial shell stress on element {element.element_id} is outside the supplied " + f"hardening-state flow surface at point {index}: " + f"sigma_eq={equivalent[index]:.6g}, flow={flow[index]:.6g}. " + "Supply an admissible stress or compatible alpha history." + ) + if isinstance(element, (BeamElement, QuadraticBeamElement)) and "initial_fiber_stress" in state: + config = element._fiber_plasticity_config(material) + if config is None: + return + curve = config.material_curve + y, _z, _weights = element._fiber_section_grid(config) + section_fibers = y.size + total_fibers = section_fibers * ( + len(element.GAUSS_POINTS) if isinstance(element, QuadraticBeamElement) else 1 + ) + stress = _beam_fiber_field( + state["initial_fiber_stress"], + total_fibers, + section_fibers, + "initial_fiber_stress", + ) + alpha = np.asarray(state.get("alpha", np.zeros(total_fibers)), dtype=float).reshape(-1) + if alpha.size not in {1, total_fibers}: + raise ValueError( + f"Beam initial alpha has {alpha.size} entries; expected 1 or {total_fibers}" + ) + if alpha.size == 1: + alpha = np.full(total_fibers, float(alpha[0]), dtype=float) + if np.any(~np.isfinite(alpha)) or np.any(alpha < 0.0): + raise ValueError("Beam initial alpha must be finite and non-negative") + scale = _beam_flow_scale(material, curve) + flow = ( + np.full(alpha.shape, scale, dtype=float) + if curve is None + else scale * np.asarray(curve.flow_stress(alpha), dtype=float) + ) + excess = np.abs(stress) - flow + if np.any(excess > tolerance * np.maximum(flow, 1.0)): + index = int(np.argmax(excess)) + raise ValueError( + f"Initial beam-fiber stress on element {element.element_id} is outside the supplied " + f"hardening-state flow surface at fiber {index}: " + f"|sigma|={abs(stress[index]):.6g}, flow={flow[index]:.6g}. " + "Supply an admissible stress or compatible alpha history." + ) + + +ELEMENT_TYPES = { + "shell": ShellElement, + "shell3": ShellElement, + "tri3": ShellElement, + "tria3": ShellElement, + "t3": ShellElement, + "s3": ShellElement, + "shell6": ShellElement, + "tri6": ShellElement, + "tria6": ShellElement, + "t6": ShellElement, + "s6": ShellElement, + "beam": BeamElement, + "quadratic_beam": QuadraticBeamElement, + "coupled": CoupledBeamShellElement, +} + + +DEFAULT_Q4_FORMULATION = "e4-pl" +# New/current-policy three-node shells use the V2D companion accepted by the +# V6W qualification. Historical records without formulation identity still +# deserialize explicitly as ``legacy-s3`` below, and direct +# ``ShellElement(...)`` construction remains the documented legacy API. +DEFAULT_S3_FORMULATION = "e4-pl-s3-v2d" +LEGACY_Q4_AVAILABLE_THROUGH = "0.4.x" +LEGACY_Q4_REMOVAL_TARGET = "0.5.0" + + +class LegacyQ4DeprecationWarning(DeprecationWarning): + """Warning emitted when the temporary legacy four-node rollback is used.""" + + +class LegacyS3MigrationWarning(UserWarning): + """Warning emitted when a missing-ID historical TRI3 loads as legacy.""" + + +LegacyShellElement = ShellElement + + +def _normalized_shell_formulation( + node_count: int, + formulation: Optional[str], +) -> str: + if formulation is None: + resolved = ( + DEFAULT_Q4_FORMULATION + if node_count == 4 + else DEFAULT_S3_FORMULATION + if node_count == 3 + else "legacy" + ) + else: + resolved = str(formulation) + raw_resolved = resolved.strip().lower() + resolved = raw_resolved.replace("_", "-") + exact_s3_v2_selectors = {"e4-pl-s3-v2", "qualified-s3-v2"} + exact_s3_v2b_selectors = {"e4-pl-s3-v2b", "qualified-s3-v2b"} + exact_s3_v2c_selectors = {"e4-pl-s3-v2c", "qualified-s3-v2c"} + exact_s3_v2d_selectors = {"e4-pl-s3-v2d", "qualified-s3-v2d"} + if resolved in exact_s3_v2_selectors and raw_resolved not in exact_s3_v2_selectors: + raise ValueError( + "strict-flat E4-PL S3 V2 requires the canonical e4-pl-s3-v2 selector" + ) + if resolved in exact_s3_v2b_selectors and raw_resolved not in exact_s3_v2b_selectors: + raise ValueError( + "strict-flat E4-PL S3 V2B requires the canonical e4-pl-s3-v2b selector" + ) + if resolved in exact_s3_v2c_selectors and raw_resolved not in exact_s3_v2c_selectors: + raise ValueError( + "strict-flat E4-PL S3 V2C requires the canonical e4-pl-s3-v2c selector" + ) + if resolved in exact_s3_v2d_selectors and raw_resolved not in exact_s3_v2d_selectors: + raise ValueError( + "native-parity E4-PL S3 V2D requires the canonical e4-pl-s3-v2d selector" + ) + if resolved == "default": + resolved = ( + DEFAULT_Q4_FORMULATION + if node_count == 4 + else DEFAULT_S3_FORMULATION + if node_count == 3 + else "legacy" + ) + e4_aliases = {"e4-pl", "qualified-s4"} + s3_aliases = {"e4-pl-s3", "qualified-s3"} + s3_v2_aliases = exact_s3_v2_selectors + s3_v2b_aliases = exact_s3_v2b_selectors + s3_v2c_aliases = exact_s3_v2c_selectors + s3_v2d_aliases = exact_s3_v2d_selectors + legacy_aliases = {"legacy", "legacy-shell", "legacy-s4"} + if node_count == 4 and resolved in e4_aliases: + return "e4-pl" + if node_count == 3 and resolved in s3_aliases: + return "e4-pl-s3-v2d" + if node_count == 3 and resolved in s3_v2_aliases: + return "e4-pl-s3-v2" + if node_count == 3 and resolved in s3_v2b_aliases: + return "e4-pl-s3-v2b" + if node_count == 3 and resolved in s3_v2c_aliases: + return "e4-pl-s3-v2c" + if node_count == 3 and resolved in s3_v2d_aliases: + return "e4-pl-s3-v2d" + if resolved == "legacy-s3": + if node_count != 3: + raise ValueError("legacy-s3 is available only for three-node shell topology") + return "legacy-s3" + if resolved in legacy_aliases: + return "legacy" + if resolved in e4_aliases: + raise ValueError("E4-PL is available only for four-node shell topology") + if resolved in s3_aliases: + raise ValueError("qualified E4-PL S3 is available only for three-node shell topology") + if resolved in s3_v2_aliases: + raise ValueError( + "strict-flat E4-PL S3 V2 is available only for three-node shell topology" + ) + if resolved in s3_v2b_aliases: + raise ValueError( + "strict-flat E4-PL S3 V2B is available only for three-node shell topology" + ) + if resolved in s3_v2c_aliases: + raise ValueError( + "strict-flat E4-PL S3 V2C is available only for three-node shell topology" + ) + if resolved in s3_v2d_aliases: + raise ValueError( + "native-parity E4-PL S3 V2D is available only for three-node shell topology" + ) + raise ValueError(f"Unknown shell formulation: {formulation}") + + +def shell_formulation_diagnostics( + *, + node_count: int = 4, + formulation: Optional[str] = None, +) -> Dict[str, Any]: + """Describe shell selection and the temporary legacy-Q4 rollback state. + + This helper performs no element construction or mechanics. It is intended + for migration tooling, logs, and support diagnostics. + """ + + count = int(node_count) + if count not in {3, 4, 6, 8}: + raise ValueError("shell node_count must be one of 3, 4, 6 or 8") + selected = _normalized_shell_formulation(count, formulation) + normalized_request = ( + None + if formulation is None + else str(formulation).strip().lower().replace("_", "-") + ) + return { + "schema": "anysolver.shell-formulation-diagnostics-v1", + "node_count": count, + "requested_formulation": normalized_request, + "selected_formulation": selected, + "production_default": formulation is None and count in {3, 4}, + "topology_policy": ( + "QUALIFIED_E4_PL_Q4" + if count == 4 and selected == "e4-pl" + else ( + "DEPRECATED_LEGACY_Q4_ROLLBACK" + if count == 4 + else ( + "QUALIFIED_E4_PL_S3_OPT_IN" + if count == 3 and selected == "e4-pl-s3" + else ( + "STRICT_FLAT_LINEAR_E4_PL_S3_V2_OPT_IN" + if count == 3 and selected == "e4-pl-s3-v2" + else ( + "STRICT_FLAT_LINEAR_E4_PL_S3_V2B_OPT_IN" + if count == 3 and selected == "e4-pl-s3-v2b" + else ( + "STRICT_FLAT_LINEAR_E4_PL_S3_V2C_OPT_IN" + if count == 3 and selected == "e4-pl-s3-v2c" + else ( + "NATIVE_PARITY_E4_PL_S3_V2D_DEFAULT" + if count == 3 and selected == "e4-pl-s3-v2d" + else "PRESERVED_LEGACY_NON_Q4" + ) + ) + ) + ) + ) + ) + ), + "legacy_q4": { + "state": "DEPRECATED_BURN_IN_ROLLBACK", + "available_through": LEGACY_Q4_AVAILABLE_THROUGH, + "removal_not_before": LEGACY_Q4_REMOVAL_TARGET, + "selector": "legacy", + "warning": "LegacyQ4DeprecationWarning", + }, + } + + +def create_shell_element( + element_id: int, + node_ids: List[int], + material_name: str = "default", + *, + formulation: Optional[str] = None, + **kwargs: Any, +) -> ShellElement: + """Create a topology-selected shell while retaining explicit rollbacks. + + Four-node and three-node shells select their qualified E4-PL formulations + by default. Higher-order shell topologies retain + :class:`LegacyShellElement`. Passing ``formulation="legacy-s3"`` is the + documented three-node rollback; an explicit ``e4-pl`` request remains + Q4-only. + """ + + resolved = _normalized_shell_formulation(len(node_ids), formulation) + if resolved == "e4-pl": + from .e4_pl_element import QualifiedE4PLShellElement + + return QualifiedE4PLShellElement( + element_id, + node_ids, + material_name, + **kwargs, + ) + if resolved == "e4-pl-s3": + from .e4_pl_s3_element import QualifiedE4PLS3ShellElement + + return QualifiedE4PLS3ShellElement( + element_id, + node_ids, + material_name, + **kwargs, + ) + if resolved == "e4-pl-s3-v2": + from .e4_pl_s3_v2_element import StrictFlatLinearE4PLS3V2ShellElement + + return StrictFlatLinearE4PLS3V2ShellElement( + element_id, + node_ids, + material_name, + **kwargs, + ) + if resolved == "e4-pl-s3-v2b": + from .e4_pl_s3_v2b_element import StrictFlatLinearE4PLS3V2BShellElement + + return StrictFlatLinearE4PLS3V2BShellElement( + element_id, + node_ids, + material_name, + **kwargs, + ) + if resolved == "e4-pl-s3-v2c": + from .e4_pl_s3_v2c_element import StrictFlatLinearE4PLS3V2CShellElement + + return StrictFlatLinearE4PLS3V2CShellElement( + element_id, + node_ids, + material_name, + **kwargs, + ) + if resolved == "e4-pl-s3-v2d": + from .e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement + + if kwargs.get("reference_normal") is None: + raise ValueError( + "qualified S3 V2D requires authoritative reference_normal; " + "use formulation='legacy-s3' for historical connectivity-only input" + ) + + return NativeParityE4PLS3V2DShellElement( + element_id, + node_ids, + material_name, + **kwargs, + ) + if resolved in {"legacy", "legacy-s3"}: + return LegacyShellElement(element_id, node_ids, material_name, **kwargs) + raise AssertionError(f"unreachable shell formulation selection: {resolved}") + + +def shell_element_from_dict(payload: Mapping[str, Any]) -> ShellElement: + """Deserialize a shell without guessing a qualified formulation. + + Historical three-node records without ``formulation_id`` remain legacy. + Qualified records are dispatched by their exact identity and unknown + identities fail closed. + """ + + if not isinstance(payload, Mapping): + raise TypeError("serialized shell element must be a mapping") + data = dict(payload) + node_ids = [int(value) for value in data.get("node_ids", ())] + formulation_id = data.get("formulation_id") + if formulation_id is not None: + from .e4_pl_s3_v2_element import ( + FORMULATION_ID as S3_V2_FORMULATION_ID, + StrictFlatLinearCapabilityError, + ) + from .e4_pl_s3_v2b_element import ( + FORMULATION_ID as S3_V2B_FORMULATION_ID, + StrictFlatLinearCapabilityError as StrictFlatLinearV2BCapabilityError, + ) + from .e4_pl_s3_v2c_element import ( + FORMULATION_ID as S3_V2C_FORMULATION_ID, + StrictFlatLinearE4PLS3V2CShellElement, + ) + from .e4_pl_s3_v2d_element import ( + FORMULATION_ID as S3_V2D_FORMULATION_ID, + NativeParityE4PLS3V2DShellElement, + ) + + if formulation_id == S3_V2_FORMULATION_ID: + raise StrictFlatLinearCapabilityError( + "strict-flat S3 V2 serialization/restart is outside the " + "authorized Stage-1 surface" + ) + if formulation_id == S3_V2B_FORMULATION_ID: + raise StrictFlatLinearV2BCapabilityError( + "strict-flat S3 V2B serialization/restart is outside the " + "authorized production-parity surface" + ) + if formulation_id == S3_V2C_FORMULATION_ID: + return StrictFlatLinearE4PLS3V2CShellElement.from_dict(data) + if formulation_id == S3_V2D_FORMULATION_ID: + return NativeParityE4PLS3V2DShellElement.from_dict(data) + from .e4_pl_element import ( + FORMULATION_ID as Q4_FORMULATION_ID, + QualifiedE4PLShellElement, + _PLANAR_FORMULATION_ID, + ) + from .e4_pl_s3_element import ( + FORMULATION_ID as S3_FORMULATION_ID, + QualifiedE4PLS3ShellElement, + ) + + if formulation_id in {Q4_FORMULATION_ID, _PLANAR_FORMULATION_ID}: + return QualifiedE4PLShellElement.from_dict(data) + if formulation_id == S3_FORMULATION_ID: + return QualifiedE4PLS3ShellElement.from_dict(data) + raise ValueError(f"unknown serialized shell formulation_id: {formulation_id}") + def normalize_candidate_fingerprint(value: Any) -> str: + return str(value).strip().lower().replace("_", "-") + + normalized_serialized_type = normalize_candidate_fingerprint( + data.get("type", "") + ) + if normalized_serialized_type in { + "qualifiede4plshellelement", + "qualifiede4pls3shellelement", + "strictflatlineare4pls3v2shellelement", + "strictflatlineare4pls3v2bshellelement", + "strictflatlineare4pls3v2cshellelement", + "nativeparitye4pls3v2dshellelement", + "e4-pl", + "e4-pl-s3", + "e4-pl-s3-v2", + "e4-pl-s3-v2b", + "e4-pl-s3-v2c", + "e4-pl-s3-v2d", + "qualified-s3-v2", + "qualified-s3-v2b", + "qualified-s3-v2c", + "qualified-s3-v2d", + "qualified-s3", + }: + raise ValueError("serialized qualified shell is missing formulation_id") + qualified_s3_markers = frozenset( + { + "algebraic_coordinate_policy", + "bubble_convention", + "dynamic_reduction_policy", + "director_polarity", + "director_polarity_policy_id", + "director_reversal_transform_id", + "formulation_schema", + "geometric_stiffness_policy", + "mass_moment_id", + "quadrature_id", + "quadrature_authority_id", + "reference_normal", + "reference_surface_offset", + "reference_surface_offset_policy_id", + "reference_surface_strain_transform_id", + "reference_surface_mass_shift_id", + "recovery_policy_id", + "state_layout_id", + } + ) + strict_s3_v2_unique_markers = frozenset( + { + "director_policy_id", + "equation_map_sha256", + "pl_completion_policy_id", + "primary_source_sha256", + "resultant_policy_id", + "section_policy_id", + "source_contract_schema", + "source_contract_sha256", + "strict_flat_linear_scope_id", + } + ) + qualified_q4_markers = frozenset( + { + "activity_disposition_schema_id", + "current_state_binding_schema_id", + "current_state_algorithmic_origin_schema_id", + "current_state_projection_policy_id", + "current_state_tangent_decomposition_policy_id", + "deleted_frozen_policy_id", + "director_polarity", + "director_polarity_policy_id", + "director_reversal_transform_id", + "implementation_id", + "quadrature_authority_id", + "failed_state_policy_id", + "recovery_policy_id", + "reference_normal", + "stationary_solve_policy_id", + } + ) + strict_s3_v2_marker_set = set(strict_s3_v2_unique_markers & data.keys()) + serialized_selector = data.get("selector") + if isinstance(serialized_selector, str) and normalize_candidate_fingerprint( + serialized_selector + ) in { + "e4-pl-s3-v2", + "e4-pl-s3-v2b", + "e4-pl-s3-v2c", + "e4-pl-s3-v2d", + "qualified-s3-v2", + "qualified-s3-v2b", + "qualified-s3-v2c", + "qualified-s3-v2d", + }: + strict_s3_v2_marker_set.add("selector") + if normalize_candidate_fingerprint(data.get("implementation_id", "")) == ( + "e4-pl-s3-v2-dkmt-eq12-41-cst-pl-hammer3-v1" + ): + strict_s3_v2_marker_set.add("implementation_id") + if normalize_candidate_fingerprint(data.get("implementation_id", "")) == ( + "e4-pl-s3-v2c-min3-relaxed-uhm-cst-pl-parity-v1" + ): + strict_s3_v2_marker_set.add("implementation_id") + if normalize_candidate_fingerprint(data.get("implementation_id", "")) == ( + "e4-pl-s3-v2d-min3-native-section-linear-gate-v1" + ): + strict_s3_v2_marker_set.add("implementation_id") + if normalize_candidate_fingerprint(data.get("implementation_id", "")) == ( + "e4-pl-s3-v2b-min3-relaxed-uhm-cst-pl-hammer3-v1" + ): + strict_s3_v2_marker_set.add("implementation_id") + if normalize_candidate_fingerprint(data.get("formulation_schema", "")) == ( + "anysolver.e4-pl-s3-v2-strict-flat-linear-element-v1" + ): + strict_s3_v2_marker_set.add("formulation_schema") + if normalize_candidate_fingerprint(data.get("formulation_schema", "")) == ( + "anysolver.e4-pl-s3-v2c-flat-linear-parity-element-v1" + ): + strict_s3_v2_marker_set.add("formulation_schema") + if normalize_candidate_fingerprint(data.get("formulation_schema", "")) == ( + "anysolver.e4-pl-s3-v2d-native-parity-element-v1" + ): + strict_s3_v2_marker_set.add("formulation_schema") + if normalize_candidate_fingerprint(data.get("formulation_schema", "")) == ( + "anysolver.e4-pl-s3-v2b-strict-flat-linear-element-v1" + ): + strict_s3_v2_marker_set.add("formulation_schema") + if normalize_candidate_fingerprint( + data.get("quadrature_authority_id", "") + ) == "s3-v2-dkmt-hammer3-degree2-exact-v1": + strict_s3_v2_marker_set.add("quadrature_authority_id") + if strict_s3_v2_marker_set: + raise ValueError( + "serialized shell retains strict-flat S3 V2 fingerprint markers " + "but is missing formulation_id: " + + ", ".join(sorted(strict_s3_v2_marker_set)) + ) + retained_s3_marker_set = set(qualified_s3_markers & data.keys()) + retained_s3_markers = tuple(sorted(retained_s3_marker_set)) + if len(node_ids) == 3 and retained_s3_markers: + raise ValueError( + "serialized three-node shell retains qualified S3 fingerprint " + "markers but is missing formulation_id: " + + ", ".join(retained_s3_markers) + ) + retained_q4_markers = tuple(sorted(qualified_q4_markers & data.keys())) + if len(node_ids) == 4 and retained_q4_markers: + raise ValueError( + "serialized four-node shell retains qualified Q4 fingerprint " + "markers but is missing formulation_id: " + + ", ".join(retained_q4_markers) + ) + if len(node_ids) not in {3, 4, 6, 8}: + raise ValueError("serialized legacy shell requires 3, 4, 6 or 8 nodes") + element = create_shell_element( + element_id=int(data["element_id"]), + node_ids=node_ids, + material_name=str(data.get("material_name", "default")), + formulation="legacy-s3" if len(node_ids) == 3 else "legacy", + thickness=float(data.get("thickness", 0.01)), + drilling_stabilization=float(data.get("drilling_stabilization", 1.0e-3)), + reduced_integration=bool(data.get("reduced_integration", False)), + hourglass_stabilization=float(data.get("hourglass_stabilization", 1.0e-8)), + material_direction=data.get("material_direction"), + material_angle_deg=float(data.get("material_angle_deg", 0.0)), + shell_section=data.get("shell_section"), + ) + if len(node_ids) == 3: + warnings.warn( + "LEGACY_S3_MISSING_FORMULATION_ID: historical three-node shell " + "record loaded as legacy-s3; qualified-s3 was not inferred; " + "qualified-s3 hot restart is forbidden without full load-history " + "replay", + LegacyS3MigrationWarning, + stacklevel=2, + ) + return element + + +def create_element( + element_type: str, + element_id: int, + node_ids: List[int], + material_name: str = "default", + **kwargs: Any, +) -> Element: + normalized_type = str(element_type).lower() + if normalized_type == "ge-beam3": + # The qualified geometrically exact three-node beam is deliberately + # kept out of ``ELEMENT_TYPES``. That registry also feeds legacy + # beam dispatch and batching paths, while GE-B3 has its own rotation + # transaction and state contract. Keep this one exact opt-in route + # local so no existing beam spelling changes meaning. + from .ge_beam3_element import GeometricallyExactBeam3D3NElement + + return GeometricallyExactBeam3D3NElement( + element_id, + node_ids, + material_name, + **kwargs, + ) + if normalized_type in {"e4-pl-s3-v2d", "qualified-s3-v2d"}: + return create_shell_element( + element_id, + node_ids, + material_name, + formulation="e4-pl-s3-v2d", + **kwargs, + ) + if normalized_type in {"e4-pl-s3-v2c", "qualified-s3-v2c"}: + return create_shell_element( + element_id, + node_ids, + material_name, + formulation="e4-pl-s3-v2c", + **kwargs, + ) + if normalized_type in {"e4-pl-s3-v2b", "qualified-s3-v2b"}: + return create_shell_element( + element_id, + node_ids, + material_name, + formulation="e4-pl-s3-v2b", + **kwargs, + ) + if normalized_type in {"e4-pl-s3-v2", "qualified-s3-v2"}: + return create_shell_element( + element_id, + node_ids, + material_name, + formulation="e4-pl-s3-v2", + **kwargs, + ) + if normalized_type in {"e4-pl-s3", "e4_pl_s3", "qualified-s3", "qualified_s3"}: + return create_shell_element( + element_id, + node_ids, + material_name, + formulation="e4-pl-s3", + **kwargs, + ) + if normalized_type in {"legacy-s3", "legacy_s3"}: + return create_shell_element( + element_id, + node_ids, + material_name, + formulation="legacy-s3", + **kwargs, + ) + if normalized_type in {"e4-pl", "e4_pl", "qualified_s4"}: + return create_shell_element( + element_id, + node_ids, + material_name, + formulation="e4-pl", + **kwargs, + ) + if normalized_type in {"legacy-shell", "legacy_shell", "legacy-s4", "legacy_s4"}: + return create_shell_element( + element_id, + node_ids, + material_name, + formulation="legacy", + **kwargs, + ) + if normalized_type == "shell": + formulation = kwargs.pop("formulation", None) + return create_shell_element( + element_id, + node_ids, + material_name, + formulation=formulation, + **kwargs, + ) + if normalized_type in {"shell3", "tri3", "tria3", "t3", "s3"}: + formulation = kwargs.pop("formulation", None) + return create_shell_element( + element_id, + node_ids, + material_name, + formulation=formulation, + **kwargs, + ) + if normalized_type not in ELEMENT_TYPES: + raise ValueError(f"Unknown element type: {element_type}") + if normalized_type == "coupled": + if len(node_ids) != 2: + raise ValueError("CoupledBeamShellElement factory requires [beam_node_id, shell_node_id]") + return CoupledBeamShellElement(element_id, node_ids[0], node_ids[1], material_name, **kwargs) + return ELEMENT_TYPES[normalized_type](element_id, node_ids, material_name, **kwargs) diff --git a/src/anysolver/experimental_csr_assembly.py b/src/anyfesolver/experimental_csr_assembly.py similarity index 99% rename from src/anysolver/experimental_csr_assembly.py rename to src/anyfesolver/experimental_csr_assembly.py index 0a9c33c38..7ffe44648 100644 --- a/src/anysolver/experimental_csr_assembly.py +++ b/src/anyfesolver/experimental_csr_assembly.py @@ -1,7 +1,7 @@ """Opt-in topology-cached CSR assembly prototype. This is a clean-room benchmark implementation. Production K/M/KG assembly -continues to use the qualified COO path in :mod:`anysolver.matrix_assembly`. +continues to use the qualified COO path in :mod:`anyfesolver.matrix_assembly`. """ from __future__ import annotations diff --git a/src/anysolver/external_references.py b/src/anyfesolver/external_references.py similarity index 100% rename from src/anysolver/external_references.py rename to src/anyfesolver/external_references.py diff --git a/src/anysolver/fe_core.py b/src/anyfesolver/fe_core.py similarity index 100% rename from src/anysolver/fe_core.py rename to src/anyfesolver/fe_core.py diff --git a/src/anysolver/floating_pressure_regions.py b/src/anyfesolver/floating_pressure_regions.py similarity index 100% rename from src/anysolver/floating_pressure_regions.py rename to src/anyfesolver/floating_pressure_regions.py diff --git a/src/anysolver/floating_response.py b/src/anyfesolver/floating_response.py similarity index 100% rename from src/anysolver/floating_response.py rename to src/anyfesolver/floating_response.py diff --git a/src/anysolver/floating_transient.py b/src/anyfesolver/floating_transient.py similarity index 100% rename from src/anysolver/floating_transient.py rename to src/anyfesolver/floating_transient.py diff --git a/src/anysolver/fracture.py b/src/anyfesolver/fracture.py similarity index 100% rename from src/anysolver/fracture.py rename to src/anyfesolver/fracture.py diff --git a/src/anysolver/ge_beam3_curved_reference.py b/src/anyfesolver/ge_beam3_curved_reference.py similarity index 99% rename from src/anysolver/ge_beam3_curved_reference.py rename to src/anyfesolver/ge_beam3_curved_reference.py index 084783be0..9431a7c7e 100644 --- a/src/anysolver/ge_beam3_curved_reference.py +++ b/src/anyfesolver/ge_beam3_curved_reference.py @@ -1,7 +1,7 @@ """Private curved-reference geometry for the GE-B3 P4 research candidate. This module owns geometry and reference-frame construction only. It is not a -selectable formulation and is deliberately absent from :mod:`anysolver` +selectable formulation and is deliberately absent from :mod:`anyfesolver` exports. The mechanics that consume it must be separately preregistered and qualified. diff --git a/src/anysolver/ge_beam3_element.py b/src/anyfesolver/ge_beam3_element.py similarity index 99% rename from src/anysolver/ge_beam3_element.py rename to src/anyfesolver/ge_beam3_element.py index 0857d0e00..f3b2eefc9 100644 --- a/src/anysolver/ge_beam3_element.py +++ b/src/anyfesolver/ge_beam3_element.py @@ -1,6 +1,6 @@ """Qualified opt-in facade for the straight mixed GE-Beam3. -The mechanics live in :mod:`anysolver.ge_beam3_mixed_element` and are the +The mechanics live in :mod:`anyfesolver.ge_beam3_mixed_element` and are the accepted P2 implementation. This module changes no equation or numerical path. It supplies the P3 public integration boundary: the qualified formulation identity, standard linear routes, qualified committed state, and diff --git a/src/anysolver/ge_beam3_mixed_element.py b/src/anyfesolver/ge_beam3_mixed_element.py similarity index 100% rename from src/anysolver/ge_beam3_mixed_element.py rename to src/anyfesolver/ge_beam3_mixed_element.py diff --git a/src/anysolver/ge_beam3_mixed_state.py b/src/anyfesolver/ge_beam3_mixed_state.py similarity index 100% rename from src/anysolver/ge_beam3_mixed_state.py rename to src/anyfesolver/ge_beam3_mixed_state.py diff --git a/src/anysolver/ge_beam3_native.py b/src/anyfesolver/ge_beam3_native.py similarity index 100% rename from src/anysolver/ge_beam3_native.py rename to src/anyfesolver/ge_beam3_native.py diff --git a/src/anysolver/ge_beam3_native_connected_dynamics.py b/src/anyfesolver/ge_beam3_native_connected_dynamics.py similarity index 100% rename from src/anysolver/ge_beam3_native_connected_dynamics.py rename to src/anyfesolver/ge_beam3_native_connected_dynamics.py diff --git a/src/anysolver/ge_beam3_native_dynamics.py b/src/anyfesolver/ge_beam3_native_dynamics.py similarity index 100% rename from src/anysolver/ge_beam3_native_dynamics.py rename to src/anyfesolver/ge_beam3_native_dynamics.py diff --git a/src/anysolver/ge_beam3_state.py b/src/anyfesolver/ge_beam3_state.py similarity index 100% rename from src/anysolver/ge_beam3_state.py rename to src/anyfesolver/ge_beam3_state.py diff --git a/src/anysolver/general_contact/__init__.py b/src/anyfesolver/general_contact/__init__.py similarity index 100% rename from src/anysolver/general_contact/__init__.py rename to src/anyfesolver/general_contact/__init__.py diff --git a/src/anysolver/general_contact/_enriched_multitarget_empty.py b/src/anyfesolver/general_contact/_enriched_multitarget_empty.py similarity index 100% rename from src/anysolver/general_contact/_enriched_multitarget_empty.py rename to src/anyfesolver/general_contact/_enriched_multitarget_empty.py diff --git a/src/anysolver/general_contact/_enriched_multitarget_trial.py b/src/anyfesolver/general_contact/_enriched_multitarget_trial.py similarity index 93% rename from src/anysolver/general_contact/_enriched_multitarget_trial.py rename to src/anyfesolver/general_contact/_enriched_multitarget_trial.py index 84cbfad07..774b4169d 100644 --- a/src/anysolver/general_contact/_enriched_multitarget_trial.py +++ b/src/anyfesolver/general_contact/_enriched_multitarget_trial.py @@ -7,10 +7,10 @@ from dataclasses import dataclass import numpy as np -from anysolver.e4_pl_enriched import EnrichedProfileError +from anyfesolver.e4_pl_enriched import EnrichedProfileError from .enriched_static import check_cancel -from anysolver.matrix_assembly import AssemblyError -from anysolver.element_capabilities import ElementCapabilityError +from anyfesolver.matrix_assembly import AssemblyError +from anyfesolver.element_capabilities import ElementCapabilityError def _callables(owner): @@ -66,7 +66,7 @@ def argument(exception): def _history(owner): - from anysolver.nonlinear_state import NonlinearStateStore + from anyfesolver.nonlinear_state import NonlinearStateStore state=owner._nodal.states if type(state) is dict: if dict.__len__(state)==0: @@ -103,11 +103,11 @@ def capture(cls, owner, reduced, z, load, criteria, control, result, cancel, dep @classmethod def _capture(cls, owner, reduced, z, load, criteria, control, result, cancel, dependencies): - from anysolver.matrix_assembly import _CAPTURE_QUALIFIED_ASSEMBLY_RUNTIME_LEASE - from anysolver.current_state_tangent import _capture_qualified_v2d_trusted_authority - from anysolver.e4_pl_element import QualifiedE4PLShellElement - from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement - from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement + from anyfesolver.matrix_assembly import _CAPTURE_QUALIFIED_ASSEMBLY_RUNTIME_LEASE + from anyfesolver.current_state_tangent import _capture_qualified_v2d_trusted_authority + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement + from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement if not _pure(owner,dependencies):return _decline('UNSUPPORTED_OPERATOR_GRAPH') if cls.dependencies(owner,reduced,z,load) != dependencies:return _decline('PRETRIAL_DEPENDENCIES_CHANGED') diff --git a/src/anysolver/general_contact/_results_archive_common.py b/src/anyfesolver/general_contact/_results_archive_common.py similarity index 97% rename from src/anysolver/general_contact/_results_archive_common.py rename to src/anyfesolver/general_contact/_results_archive_common.py index a4c59214b..ed4387519 100644 --- a/src/anysolver/general_contact/_results_archive_common.py +++ b/src/anyfesolver/general_contact/_results_archive_common.py @@ -44,7 +44,7 @@ def _encode_committed_results(data, cap, records, *, schema, conventions, snapsh data['snapshots'] = () payload = codec._encode(data, budget, records) nodes = [] - from anysolver.nonlinear_static import NonlinearIncrementSnapshot + from anyfesolver.nonlinear_static import NonlinearIncrementSnapshot for snapshot in snapshots: if type(snapshot) is not NonlinearIncrementSnapshot: codec._fail('exact committed snapshot required') diff --git a/src/anysolver/general_contact/algebraic_path.py b/src/anyfesolver/general_contact/algebraic_path.py similarity index 100% rename from src/anysolver/general_contact/algebraic_path.py rename to src/anyfesolver/general_contact/algebraic_path.py diff --git a/src/anysolver/general_contact/arc_contact.py b/src/anyfesolver/general_contact/arc_contact.py similarity index 100% rename from src/anysolver/general_contact/arc_contact.py rename to src/anyfesolver/general_contact/arc_contact.py diff --git a/src/anysolver/general_contact/arc_results_archive.py b/src/anyfesolver/general_contact/arc_results_archive.py similarity index 95% rename from src/anysolver/general_contact/arc_results_archive.py rename to src/anyfesolver/general_contact/arc_results_archive.py index 1f0e1d2c1..d766a0e8c 100644 --- a/src/anysolver/general_contact/arc_results_archive.py +++ b/src/anyfesolver/general_contact/arc_results_archive.py @@ -5,6 +5,7 @@ from types import MappingProxyType import numpy as np from . import transient_results_archive as codec +from .._wire_types import wire_class_name from ._results_archive_common import _vector, _state, _diagnostics, _encode_committed_results from . import static_results_archive as static @@ -21,17 +22,17 @@ def _types(): - from anysolver.arc_length import ArcLengthResult, ArcLengthStep - from anysolver.nonlinear_static import NonlinearIncrementSnapshot + from anyfesolver.arc_length import ArcLengthResult, ArcLengthStep + from anyfesolver.nonlinear_static import NonlinearIncrementSnapshot _, records = codec._types() records = dict(records) for cls in (ArcLengthStep, NonlinearIncrementSnapshot): - records[cls.__module__ + '.' + cls.__qualname__] = cls + records[wire_class_name(cls)] = cls return ArcLengthResult, records def _roles(cls, data): - if cls.__module__ != 'anysolver.arc_length': + if cls.__module__ != 'anyfesolver.arc_length': return static._roles(cls, data) for key,value in data.items(): if key in ('step_index','iterations','retries'): @@ -139,7 +140,7 @@ def serialize_arc_contact_results(results, *, max_bytes=MAX_BYTES): codec._fail('exact ArcLengthResult required') try: data = {f.name: getattr(results, f.name) for f in fields(results)} except AttributeError: codec._fail('incomplete ArcLengthResult producer') - from anysolver.arc_length import ArcLengthStep + from anyfesolver.arc_length import ArcLengthStep if type(data['steps']) is not list: codec._fail('arc steps must be list') for step in data['steps']: if type(step) is not ArcLengthStep: codec._fail('exact accepted step required') diff --git a/src/anysolver/general_contact/augmentation.py b/src/anyfesolver/general_contact/augmentation.py similarity index 100% rename from src/anysolver/general_contact/augmentation.py rename to src/anyfesolver/general_contact/augmentation.py diff --git a/src/anysolver/general_contact/automatic_domain.py b/src/anyfesolver/general_contact/automatic_domain.py similarity index 99% rename from src/anysolver/general_contact/automatic_domain.py rename to src/anyfesolver/general_contact/automatic_domain.py index d38ea78c4..c650ce2e6 100644 --- a/src/anysolver/general_contact/automatic_domain.py +++ b/src/anyfesolver/general_contact/automatic_domain.py @@ -390,8 +390,8 @@ def _face_area(points): def _reference(model,participants): import numpy as np - from anysolver.e4_pl_element import QualifiedE4PLShellElement - from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement from .core import ContactSurface from .q4_skin_work import Q4SkinWorkAdapter from .s3_skin_work import S3SkinWorkAdapter @@ -432,8 +432,8 @@ def _reference(model,participants): def _guard_model(model): - from anysolver.fe_core import FEModel - from anysolver.current_state_tangent import require_exact_qualified_component_lifecycle_api + from anyfesolver.fe_core import FEModel + from anyfesolver.current_state_tangent import require_exact_qualified_component_lifecycle_api if type(model) is not FEModel: _error('invalid_model','exact FEModel required') require_exact_qualified_component_lifecycle_api(model,context='automatic domain reference observation') diff --git a/src/anysolver/general_contact/beam_chain_consistent.py b/src/anyfesolver/general_contact/beam_chain_consistent.py similarity index 100% rename from src/anysolver/general_contact/beam_chain_consistent.py rename to src/anyfesolver/general_contact/beam_chain_consistent.py diff --git a/src/anysolver/general_contact/beam_chain_end_geometry.py b/src/anyfesolver/general_contact/beam_chain_end_geometry.py similarity index 100% rename from src/anysolver/general_contact/beam_chain_end_geometry.py rename to src/anyfesolver/general_contact/beam_chain_end_geometry.py diff --git a/src/anysolver/general_contact/beam_chain_ends.py b/src/anyfesolver/general_contact/beam_chain_ends.py similarity index 100% rename from src/anysolver/general_contact/beam_chain_ends.py rename to src/anyfesolver/general_contact/beam_chain_ends.py diff --git a/src/anysolver/general_contact/beam_chain_pair.py b/src/anyfesolver/general_contact/beam_chain_pair.py similarity index 99% rename from src/anysolver/general_contact/beam_chain_pair.py rename to src/anyfesolver/general_contact/beam_chain_pair.py index 44cfeb660..dd7798c1f 100644 --- a/src/anysolver/general_contact/beam_chain_pair.py +++ b/src/anyfesolver/general_contact/beam_chain_pair.py @@ -71,7 +71,7 @@ def validate_beam_chain_pair_contact(model, definition: ContactDefinition, if (len(a.element_ids) * len(b.element_ids) > controls.maximum_candidate_pairs or len(a.element_ids) > 16 or len(b.element_ids) > 16): issues.append("beam-chain pair exceeds its admitted cell resource limit; no contact is dropped") - from anysolver.elements import BeamElement + from anyfesolver.elements import BeamElement from anymaterial import IsotropicMaterial selected_nodes = [] diff --git a/src/anysolver/general_contact/beam_curve_end_geometry.py b/src/anyfesolver/general_contact/beam_curve_end_geometry.py similarity index 100% rename from src/anysolver/general_contact/beam_curve_end_geometry.py rename to src/anyfesolver/general_contact/beam_curve_end_geometry.py diff --git a/src/anysolver/general_contact/beam_curve_ends.py b/src/anyfesolver/general_contact/beam_curve_ends.py similarity index 100% rename from src/anysolver/general_contact/beam_curve_ends.py rename to src/anyfesolver/general_contact/beam_curve_ends.py diff --git a/src/anysolver/general_contact/beam_curve_pair.py b/src/anyfesolver/general_contact/beam_curve_pair.py similarity index 99% rename from src/anysolver/general_contact/beam_curve_pair.py rename to src/anyfesolver/general_contact/beam_curve_pair.py index be5a5ba67..cc05df8cf 100644 --- a/src/anysolver/general_contact/beam_curve_pair.py +++ b/src/anyfesolver/general_contact/beam_curve_pair.py @@ -10,7 +10,7 @@ import numpy as np from scipy.optimize import brentq -from anysolver._ge_beam3_deterministic_reduction import deterministic_dot, deterministic_norm +from anyfesolver._ge_beam3_deterministic_reduction import deterministic_dot, deterministic_norm from .polynomial_roots import near_real_roots diff --git a/src/anysolver/general_contact/beam_curve_pair_static.py b/src/anyfesolver/general_contact/beam_curve_pair_static.py similarity index 99% rename from src/anysolver/general_contact/beam_curve_pair_static.py rename to src/anyfesolver/general_contact/beam_curve_pair_static.py index 97f3b8c5e..f69fac121 100644 --- a/src/anysolver/general_contact/beam_curve_pair_static.py +++ b/src/anyfesolver/general_contact/beam_curve_pair_static.py @@ -61,7 +61,7 @@ def validate_b3_pair_contact(model, definition: ContactDefinition, if (first.beam_radius is not None and second.beam_radius is not None and interaction.gap_tolerance >= first.beam_radius + second.beam_radius): issues.append("B3 pair gap tolerance must be smaller than combined radius") - from anysolver.elements import BeamElement, QuadraticBeamElement + from anyfesolver.elements import BeamElement, QuadraticBeamElement from anymaterial import IsotropicMaterial selected_nodes = [] diff --git a/src/anysolver/general_contact/beam_end_radial_geometry.py b/src/anyfesolver/general_contact/beam_end_radial_geometry.py similarity index 100% rename from src/anysolver/general_contact/beam_end_radial_geometry.py rename to src/anyfesolver/general_contact/beam_end_radial_geometry.py diff --git a/src/anysolver/general_contact/beam_end_topology.py b/src/anyfesolver/general_contact/beam_end_topology.py similarity index 100% rename from src/anysolver/general_contact/beam_end_topology.py rename to src/anyfesolver/general_contact/beam_end_topology.py diff --git a/src/anysolver/general_contact/beam_hemisphere_coupled_tool.py b/src/anyfesolver/general_contact/beam_hemisphere_coupled_tool.py similarity index 100% rename from src/anysolver/general_contact/beam_hemisphere_coupled_tool.py rename to src/anyfesolver/general_contact/beam_hemisphere_coupled_tool.py diff --git a/src/anysolver/general_contact/beam_hemisphere_cylinder.py b/src/anyfesolver/general_contact/beam_hemisphere_cylinder.py similarity index 100% rename from src/anysolver/general_contact/beam_hemisphere_cylinder.py rename to src/anyfesolver/general_contact/beam_hemisphere_cylinder.py diff --git a/src/anysolver/general_contact/beam_hemisphere_cylinder_motion.py b/src/anyfesolver/general_contact/beam_hemisphere_cylinder_motion.py similarity index 100% rename from src/anysolver/general_contact/beam_hemisphere_cylinder_motion.py rename to src/anyfesolver/general_contact/beam_hemisphere_cylinder_motion.py diff --git a/src/anysolver/general_contact/beam_hemisphere_cylinder_work.py b/src/anyfesolver/general_contact/beam_hemisphere_cylinder_work.py similarity index 99% rename from src/anysolver/general_contact/beam_hemisphere_cylinder_work.py rename to src/anyfesolver/general_contact/beam_hemisphere_cylinder_work.py index 867928ee6..0466e67f7 100644 --- a/src/anysolver/general_contact/beam_hemisphere_cylinder_work.py +++ b/src/anyfesolver/general_contact/beam_hemisphere_cylinder_work.py @@ -9,7 +9,7 @@ from numbers import Integral import math import numpy as np -from anysolver._ge_beam3_mixed_ad import Jet2, dot, sqrt, sin, cos +from anyfesolver._ge_beam3_mixed_ad import Jet2, dot, sqrt, sin, cos from .beam_hemisphere_support import _readonly, _vector, _cross, HemispherePlaneGeometryError diff --git a/src/anysolver/general_contact/beam_hemisphere_plane.py b/src/anyfesolver/general_contact/beam_hemisphere_plane.py similarity index 100% rename from src/anysolver/general_contact/beam_hemisphere_plane.py rename to src/anyfesolver/general_contact/beam_hemisphere_plane.py diff --git a/src/anysolver/general_contact/beam_hemisphere_s3_support.py b/src/anyfesolver/general_contact/beam_hemisphere_s3_support.py similarity index 99% rename from src/anysolver/general_contact/beam_hemisphere_s3_support.py rename to src/anyfesolver/general_contact/beam_hemisphere_s3_support.py index 561247deb..a636a6a42 100644 --- a/src/anysolver/general_contact/beam_hemisphere_s3_support.py +++ b/src/anyfesolver/general_contact/beam_hemisphere_s3_support.py @@ -14,7 +14,7 @@ import numpy as np -from anysolver._ge_beam3_mixed_ad import Jet2, dot, sqrt +from anyfesolver._ge_beam3_mixed_ad import Jet2, dot, sqrt from .beam_hemisphere_support import ( HemispherePlaneGeometryError, HemispherePlaneState, _cross, _exact_dot, _readonly, _replace_value, _stable_gap, diff --git a/src/anysolver/general_contact/beam_hemisphere_sphere.py b/src/anyfesolver/general_contact/beam_hemisphere_sphere.py similarity index 100% rename from src/anysolver/general_contact/beam_hemisphere_sphere.py rename to src/anyfesolver/general_contact/beam_hemisphere_sphere.py diff --git a/src/anysolver/general_contact/beam_hemisphere_sphere_work.py b/src/anyfesolver/general_contact/beam_hemisphere_sphere_work.py similarity index 99% rename from src/anysolver/general_contact/beam_hemisphere_sphere_work.py rename to src/anyfesolver/general_contact/beam_hemisphere_sphere_work.py index f1eb936d7..ffc1ed8b0 100644 --- a/src/anysolver/general_contact/beam_hemisphere_sphere_work.py +++ b/src/anyfesolver/general_contact/beam_hemisphere_sphere_work.py @@ -10,7 +10,7 @@ from numbers import Integral import numpy as np -from anysolver._ge_beam3_mixed_ad import Jet2, dot, sqrt +from anyfesolver._ge_beam3_mixed_ad import Jet2, dot, sqrt from .beam_hemisphere_support import (_readonly, _vector, _cross, _exact_dot, _replace_value, HemispherePlaneGeometryError) from .capped_cylinder import _sqrt_bound diff --git a/src/anysolver/general_contact/beam_hemisphere_support.py b/src/anyfesolver/general_contact/beam_hemisphere_support.py similarity index 99% rename from src/anysolver/general_contact/beam_hemisphere_support.py rename to src/anyfesolver/general_contact/beam_hemisphere_support.py index 458f0d730..9f2a49ef5 100644 --- a/src/anysolver/general_contact/beam_hemisphere_support.py +++ b/src/anyfesolver/general_contact/beam_hemisphere_support.py @@ -16,7 +16,7 @@ import numpy as np -from anysolver._ge_beam3_mixed_ad import Jet2, dot, sqrt +from anyfesolver._ge_beam3_mixed_ad import Jet2, dot, sqrt from .capped_cylinder import _sqrt_bound diff --git a/src/anysolver/general_contact/beam_pair.py b/src/anyfesolver/general_contact/beam_pair.py similarity index 99% rename from src/anysolver/general_contact/beam_pair.py rename to src/anyfesolver/general_contact/beam_pair.py index a449c3feb..217071875 100644 --- a/src/anysolver/general_contact/beam_pair.py +++ b/src/anyfesolver/general_contact/beam_pair.py @@ -73,7 +73,7 @@ def validate_beam_pair_contact(model, definition: ContactDefinition, ) -> ContactValidationReport: if (len(definition.surfaces) == 2 and all(len(surface.element_ids) == 1 for surface in definition.surfaces)): - from anysolver.elements import BeamElement, QuadraticBeamElement + from anyfesolver.elements import BeamElement, QuadraticBeamElement element_types = tuple(type(model.mesh.elements.get(surface.element_ids[0])) for surface in definition.surfaces) @@ -108,7 +108,7 @@ def validate_beam_pair_contact(model, definition: ContactDefinition, issues.append("beam-pair contact requires a penalty line_stiffness only") if len(surface_a.element_ids) * len(surface_b.element_ids) > controls.maximum_candidate_pairs: issues.append("beam-pair candidate limit exceeded; no pair is discarded") - from anysolver.elements import BeamElement + from anyfesolver.elements import BeamElement from anymaterial import IsotropicMaterial selected_nodes: list[set[int]] = [] diff --git a/src/anysolver/general_contact/beam_pair_end_geometry.py b/src/anyfesolver/general_contact/beam_pair_end_geometry.py similarity index 100% rename from src/anysolver/general_contact/beam_pair_end_geometry.py rename to src/anyfesolver/general_contact/beam_pair_end_geometry.py diff --git a/src/anysolver/general_contact/beam_pair_ends.py b/src/anyfesolver/general_contact/beam_pair_ends.py similarity index 99% rename from src/anysolver/general_contact/beam_pair_ends.py rename to src/anyfesolver/general_contact/beam_pair_ends.py index 6c4df13cf..47bfb1642 100644 --- a/src/anysolver/general_contact/beam_pair_ends.py +++ b/src/anyfesolver/general_contact/beam_pair_ends.py @@ -32,12 +32,12 @@ def validate_beam_pair_ends(model, definition, settings=None): if len(definition.surfaces)==2 and any(len(s.element_ids)>1 for s in definition.surfaces): from .beam_chain_ends import validate_beam_chain_ends return validate_beam_chain_ends(model,definition,settings) - from anysolver.elements import QuadraticBeamElement + from anyfesolver.elements import QuadraticBeamElement if any(type(model.mesh.elements.get(element)) is QuadraticBeamElement for s in definition.surfaces for element in s.element_ids): from .beam_curve_ends import validate_curve_beam_ends return validate_curve_beam_ends(model, definition, settings) - from anysolver.elements import BeamElement + from anyfesolver.elements import BeamElement if tuple(map(len, (definition.surfaces, definition.rigid_bodies, definition.interactions))) != (2, 0, 1): return ContactValidationReport('invalid', ('two explicit B2 surfaces and one pair required',), PROFILE) diff --git a/src/anysolver/general_contact/beam_plane.py b/src/anyfesolver/general_contact/beam_plane.py similarity index 99% rename from src/anysolver/general_contact/beam_plane.py rename to src/anyfesolver/general_contact/beam_plane.py index 9946a19b1..ccf57512c 100644 --- a/src/anysolver/general_contact/beam_plane.py +++ b/src/anyfesolver/general_contact/beam_plane.py @@ -24,7 +24,7 @@ def _beam_types(): - from anysolver.elements import BeamElement, QuadraticBeamElement + from anyfesolver.elements import BeamElement, QuadraticBeamElement return BeamElement, QuadraticBeamElement diff --git a/src/anysolver/general_contact/beam_radial.py b/src/anyfesolver/general_contact/beam_radial.py similarity index 100% rename from src/anysolver/general_contact/beam_radial.py rename to src/anyfesolver/general_contact/beam_radial.py diff --git a/src/anysolver/general_contact/beam_radial_ends.py b/src/anyfesolver/general_contact/beam_radial_ends.py similarity index 100% rename from src/anysolver/general_contact/beam_radial_ends.py rename to src/anyfesolver/general_contact/beam_radial_ends.py diff --git a/src/anysolver/general_contact/beam_s3_directional_rates.py b/src/anyfesolver/general_contact/beam_s3_directional_rates.py similarity index 100% rename from src/anysolver/general_contact/beam_s3_directional_rates.py rename to src/anyfesolver/general_contact/beam_s3_directional_rates.py diff --git a/src/anysolver/general_contact/beam_s3_rotational_transient.py b/src/anyfesolver/general_contact/beam_s3_rotational_transient.py similarity index 100% rename from src/anysolver/general_contact/beam_s3_rotational_transient.py rename to src/anyfesolver/general_contact/beam_s3_rotational_transient.py diff --git a/src/anysolver/general_contact/beam_s3_transient.py b/src/anyfesolver/general_contact/beam_s3_transient.py similarity index 100% rename from src/anysolver/general_contact/beam_s3_transient.py rename to src/anyfesolver/general_contact/beam_s3_transient.py diff --git a/src/anysolver/general_contact/beam_shell.py b/src/anyfesolver/general_contact/beam_shell.py similarity index 98% rename from src/anysolver/general_contact/beam_shell.py rename to src/anyfesolver/general_contact/beam_shell.py index 447324996..4797eb90b 100644 --- a/src/anysolver/general_contact/beam_shell.py +++ b/src/anyfesolver/general_contact/beam_shell.py @@ -246,7 +246,7 @@ def refine(left: float, right: float, depth: int): def validate_beam_shell_contact(model, definition: ContactDefinition, settings: ContactSolverSettings | None = None, ) -> ContactValidationReport: - from anysolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id + from anyfesolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id issues: list[str] = [] controls = ContactSolverSettings() if settings is None else settings if (len(definition.surfaces) != 2 or definition.rigid_bodies @@ -291,9 +291,9 @@ def validate_beam_shell_contact(model, definition: ContactDefinition, issues.append("beam-shell interaction requires directed line penalty and no other stiffness") profile = PROFILE if len(beam.element_ids) == 1 and len(shell.element_ids) == 1: - from anysolver.elements import BeamElement, QuadraticBeamElement - from anysolver.e4_pl_element import FORMULATION_ID as q4_id - from anysolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id + from anyfesolver.elements import BeamElement, QuadraticBeamElement + from anyfesolver.e4_pl_element import FORMULATION_ID as q4_id + from anyfesolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id from anymaterial import IsotropicMaterial beam_element = model.mesh.elements.get(beam.element_ids[0]) @@ -429,7 +429,7 @@ def __init__(self, model, definition: ContactDefinition, sign = 1.0 if shell.side == "top" else -1.0 side_normal = sign * np.asarray(director, dtype=float) coordinate = sign - from anysolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id + from anyfesolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id offset = ( float(shell_element.material_surface_offset_from_reference(coordinate)) diff --git a/src/anysolver/general_contact/beam_shell_patch.py b/src/anyfesolver/general_contact/beam_shell_patch.py similarity index 98% rename from src/anysolver/general_contact/beam_shell_patch.py rename to src/anyfesolver/general_contact/beam_shell_patch.py index 9c98fc21d..004f32a17 100644 --- a/src/anysolver/general_contact/beam_shell_patch.py +++ b/src/anyfesolver/general_contact/beam_shell_patch.py @@ -208,7 +208,7 @@ def validate_beam_shell_patch_contact(model, definition: ContactDefinition, if len(beam.element_ids) != 1: issues.append("patch profile admits one classical B2/B3 cell") else: - from anysolver.elements import BeamElement, QuadraticBeamElement + from anyfesolver.elements import BeamElement, QuadraticBeamElement if type(model.mesh.elements.get(beam.element_ids[0])) not in { BeamElement, QuadraticBeamElement, @@ -232,7 +232,7 @@ def validate_beam_shell_patch_contact(model, definition: ContactDefinition, settings.beam_shell_rim_clearance) levers = [] side_normals = [] - from anysolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id + from anyfesolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id for eid in shell.element_ids: element = model.mesh.elements[eid] @@ -308,7 +308,7 @@ def __init__(self, model, definition: ContactDefinition, director = np.cross(corners[1] - corners[0], corners[-1] - corners[0]) director /= np.linalg.norm(director) sign = 1.0 if self.shell_surface.side == "top" else -1.0 - from anysolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id + from anyfesolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id offset = (first_element.material_surface_offset_from_reference(sign) if first_element.formulation_id == s3_id else sign * first_element.thickness / 2.0) diff --git a/src/anysolver/general_contact/beam_temporal_bounds.py b/src/anyfesolver/general_contact/beam_temporal_bounds.py similarity index 100% rename from src/anysolver/general_contact/beam_temporal_bounds.py rename to src/anyfesolver/general_contact/beam_temporal_bounds.py diff --git a/src/anysolver/general_contact/capability.py b/src/anyfesolver/general_contact/capability.py similarity index 100% rename from src/anysolver/general_contact/capability.py rename to src/anyfesolver/general_contact/capability.py diff --git a/src/anysolver/general_contact/capped_cylinder.py b/src/anyfesolver/general_contact/capped_cylinder.py similarity index 100% rename from src/anysolver/general_contact/capped_cylinder.py rename to src/anyfesolver/general_contact/capped_cylinder.py diff --git a/src/anysolver/general_contact/contact_search.py b/src/anyfesolver/general_contact/contact_search.py similarity index 98% rename from src/anysolver/general_contact/contact_search.py rename to src/anyfesolver/general_contact/contact_search.py index 30e8c0162..4faf2b38d 100644 --- a/src/anysolver/general_contact/contact_search.py +++ b/src/anyfesolver/general_contact/contact_search.py @@ -50,7 +50,7 @@ def __init__(self, keys: Sequence[ContactFeatureKey], boxes: np.ndarray): raise raise RuntimeError( "contact search requires ANYgeometry; install " - "ANYsolver[general-contact]" + "ANYfeSolver[general-contact]" ) from exc self._aabb = AABB self._tree_type = AABBTree diff --git a/src/anysolver/general_contact/core.py b/src/anyfesolver/general_contact/core.py similarity index 98% rename from src/anysolver/general_contact/core.py rename to src/anyfesolver/general_contact/core.py index 5e7c65205..b786a976d 100644 --- a/src/anysolver/general_contact/core.py +++ b/src/anyfesolver/general_contact/core.py @@ -57,7 +57,7 @@ def _contact_settings_contract(settings): return value if TYPE_CHECKING: - from anysolver.fe_core import FEModel + from anyfesolver.fe_core import FEModel @dataclass(frozen=True) @@ -633,7 +633,7 @@ def to_dict(self) -> dict[str, object]: def _exact_single_q4_pair(model: FEModel, definition: ContactDefinition) -> bool: """Route only exact qualified one-Q4-per-side definitions to the patch owner.""" - from anysolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement return (len(definition.surfaces) == 2 and all(len(surface.element_ids) == 1 @@ -645,8 +645,8 @@ def _exact_single_q4_pair(model: FEModel, def _exact_q4_s3_patch(model: FEModel, definition: ContactDefinition) -> bool: """Admit only one Q4 pressure face against two qualified S3 target faces.""" - from anysolver.e4_pl_element import QualifiedE4PLShellElement - from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement if len(definition.surfaces) != 2 or len(definition.interactions) != 1: return False @@ -667,8 +667,8 @@ def _exact_q4_s3_patch(model: FEModel, def _refined_q4_s3_patch(model: FEModel, definition: ContactDefinition) -> bool: - from anysolver.e4_pl_element import QualifiedE4PLShellElement - from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement if len(definition.surfaces) != 2 or len(definition.interactions) != 1: return False @@ -686,7 +686,7 @@ def _refined_q4_s3_patch(model: FEModel, def _exact_monolithic_s3_pair(model, definition, settings): """Named full-face hard S3 row; historical single-pair routing stays intact.""" - from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement + from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement return (settings is not None and settings.pair_motion == 'general' and settings.general_s3_differentiation == 'jet2_s3_dev' and settings.enforcement_solver == 'monolithic_active_set' @@ -720,7 +720,7 @@ def validate_general_contact(model: FEModel, definition: ContactDefinition, except ValueError as exc: return ContactValidationReport("invalid", (str(exc),)) if settings is not None and settings.shell_skin_kinematics != "reference_linear": - from anysolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement from .finite_mixed_state import admitted_definition finite_mixed = analysis_control=='contact_path' and admitted_definition(model,definition,settings) from .finite_v2d_state import admitted_definition as admitted_v2d @@ -743,7 +743,7 @@ def validate_general_contact(model: FEModel, definition: ContactDefinition, return ContactValidationReport("invalid", ( "corotational_nodal_director_dev requires the explicit frictionless Q4/Q4 monolithic whole-face contact path",)) if settings is not None and settings.general_s3_differentiation == "jet2_q4_q4_dev": - from anysolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement if (analysis_control not in {"force", "displacement", "contact_path"} or definition.rigid_bodies or len(definition.surfaces) != 2 or len(definition.interactions) != 1 @@ -758,8 +758,8 @@ def validate_general_contact(model: FEModel, definition: ContactDefinition, if settings is not None and settings.shell_pair_orientation != "legacy": if analysis_control != "contact_path": return ContactValidationReport("invalid", ("shell_pair_orientation requires contact_path_program",)) - from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement - from anysolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement physical_s3 = (settings.general_s3_differentiation == "jet2_s3_dev" and definition.interactions and ((settings.enforcement_solver == "nested_augmented" @@ -905,7 +905,7 @@ def validate_general_contact(model: FEModel, definition: ContactDefinition, return validate_multiple_projected_pairs( model, definition, settings, analysis_control=analysis_control) if any(item.normal_law == "projected_penalty" for item in definition.interactions): - from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement + from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement s3_geometry = (not definition.rigid_bodies and len(definition.surfaces) == 2 and all(surface.element_ids for surface in definition.surfaces) @@ -921,7 +921,7 @@ def validate_general_contact(model: FEModel, definition: ContactDefinition, q4_route = (settings is not None and _refined_q4_s3_patch(model, definition) and settings.general_s3_differentiation == "jet2_q4_s3_dev" and settings.q4_source_gap_certificate == "overlap_local_dev") - from anysolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement q4_q4_route = (settings is not None and settings.general_s3_differentiation == "jet2_q4_q4_dev" and settings.q4_source_gap_certificate == "whole_face" @@ -964,7 +964,7 @@ def validate_general_contact(model: FEModel, definition: ContactDefinition, "macro Q1 pressure basis needs refined Q4-source/S3-target Jet2 augmented mortar with exact support", )) if settings is not None and settings.general_s3_differentiation == "jet2_s3_dev": - from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement + from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement selected = (settings.pair_motion == "general" and not definition.rigid_bodies @@ -1173,8 +1173,8 @@ def validate_general_contact(model: FEModel, definition: ContactDefinition, if tuple(map(len, (definition.surfaces, definition.rigid_bodies, definition.interactions))) != (1, 1, 1): issues.append("this profile requires exactly one surface, one plane, and one interaction") - from anysolver.e4_pl_element import FORMULATION_ID as q4_formulation - from anysolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_formulation + from anyfesolver.e4_pl_element import FORMULATION_ID as q4_formulation + from anyfesolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_formulation contains_s3 = False @@ -1260,7 +1260,7 @@ def __init__(self, model: FEModel, definition: ContactDefinition, data: list[float] = [] self.patches = [] contact_length_scale = 0.0 - from anysolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_formulation + from anyfesolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_formulation for element_id in surface.element_ids: element = model.mesh.elements[element_id] @@ -1654,7 +1654,7 @@ def contact_scope(model: FEModel, definition: ContactDefinition, from .beam_chain_ends import BeamChainEndManager manager = BeamChainEndManager(model, definition, settings, initial_displacement) else: - from anysolver.elements import QuadraticBeamElement + from anyfesolver.elements import QuadraticBeamElement if any(type(model.mesh.elements.get(element)) is QuadraticBeamElement for surface in definition.surfaces for element in surface.element_ids): from .beam_curve_ends import BeamCurveEndManager @@ -1667,7 +1667,7 @@ def contact_scope(model: FEModel, definition: ContactDefinition, manager = _BeamChainPairManager(model, definition, settings, initial_displacement) else: - from anysolver.elements import BeamElement, QuadraticBeamElement + from anyfesolver.elements import BeamElement, QuadraticBeamElement element_types = tuple( type(model.mesh.elements.get(surface.element_ids[0])) diff --git a/src/anysolver/general_contact/curved_s3_q4_work.py b/src/anyfesolver/general_contact/curved_s3_q4_work.py similarity index 100% rename from src/anysolver/general_contact/curved_s3_q4_work.py rename to src/anyfesolver/general_contact/curved_s3_q4_work.py diff --git a/src/anysolver/general_contact/curved_shell_skin.py b/src/anyfesolver/general_contact/curved_shell_skin.py similarity index 99% rename from src/anysolver/general_contact/curved_shell_skin.py rename to src/anyfesolver/general_contact/curved_shell_skin.py index 8209a18b1..f3f905131 100644 --- a/src/anysolver/general_contact/curved_shell_skin.py +++ b/src/anyfesolver/general_contact/curved_shell_skin.py @@ -75,8 +75,8 @@ class CurvedSkinFace: def _face_adapter(model, body_id: int, element_id: int, side: str): """Reuse the authoritative per-element S3/Q4 skin adapters unchanged.""" - from anysolver.e4_pl_element import QualifiedE4PLShellElement - from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement element = model.mesh.elements.get(int(element_id)) if element is None: diff --git a/src/anysolver/general_contact/d1_interior_profile.py b/src/anyfesolver/general_contact/d1_interior_profile.py similarity index 99% rename from src/anysolver/general_contact/d1_interior_profile.py rename to src/anyfesolver/general_contact/d1_interior_profile.py index fed782fcd..c2bff9f57 100644 --- a/src/anysolver/general_contact/d1_interior_profile.py +++ b/src/anyfesolver/general_contact/d1_interior_profile.py @@ -331,7 +331,7 @@ def swept_projected_coverage_admissible( def physical_q4_rim_node_ids(model, selected_faces) -> frozenset[int]: """Find selected nodes on a physical Q4 edge, including adjoining Q4s.""" - from anysolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement edge_counts: Counter[tuple[int, int]] = Counter() for element in model.mesh.elements.values(): diff --git a/src/anysolver/general_contact/deformable_beam_s3_caps.py b/src/anyfesolver/general_contact/deformable_beam_s3_caps.py similarity index 100% rename from src/anysolver/general_contact/deformable_beam_s3_caps.py rename to src/anyfesolver/general_contact/deformable_beam_s3_caps.py diff --git a/src/anysolver/general_contact/deformable_beam_s3_line.py b/src/anyfesolver/general_contact/deformable_beam_s3_line.py similarity index 99% rename from src/anysolver/general_contact/deformable_beam_s3_line.py rename to src/anyfesolver/general_contact/deformable_beam_s3_line.py index 19e102362..5d904437e 100644 --- a/src/anysolver/general_contact/deformable_beam_s3_line.py +++ b/src/anyfesolver/general_contact/deformable_beam_s3_line.py @@ -9,7 +9,7 @@ import numpy as np -from anysolver._ge_beam3_mixed_ad import Jet2, sqrt +from anyfesolver._ge_beam3_mixed_ad import Jet2, sqrt from .beam_plane import _active_intervals, _gap_coefficients, _minimum_polynomial diff --git a/src/anysolver/general_contact/deformable_beam_s3_static.py b/src/anyfesolver/general_contact/deformable_beam_s3_static.py similarity index 100% rename from src/anysolver/general_contact/deformable_beam_s3_static.py rename to src/anyfesolver/general_contact/deformable_beam_s3_static.py diff --git a/src/anysolver/general_contact/descriptor_rates.py b/src/anyfesolver/general_contact/descriptor_rates.py similarity index 100% rename from src/anysolver/general_contact/descriptor_rates.py rename to src/anyfesolver/general_contact/descriptor_rates.py diff --git a/src/anysolver/general_contact/enriched_cold_predictor.py b/src/anyfesolver/general_contact/enriched_cold_predictor.py similarity index 99% rename from src/anysolver/general_contact/enriched_cold_predictor.py rename to src/anyfesolver/general_contact/enriched_cold_predictor.py index 2be1ca16b..9428853cb 100644 --- a/src/anysolver/general_contact/enriched_cold_predictor.py +++ b/src/anyfesolver/general_contact/enriched_cold_predictor.py @@ -6,7 +6,7 @@ """ from __future__ import annotations import numpy as np -from anysolver.e4_pl_enriched import EnrichedProfileError,readonly +from anyfesolver.e4_pl_enriched import EnrichedProfileError,readonly from .enriched_static import check_cancel diff --git a/src/anysolver/general_contact/enriched_moment_batch.py b/src/anyfesolver/general_contact/enriched_moment_batch.py similarity index 100% rename from src/anysolver/general_contact/enriched_moment_batch.py rename to src/anyfesolver/general_contact/enriched_moment_batch.py diff --git a/src/anysolver/general_contact/enriched_multitarget.py b/src/anyfesolver/general_contact/enriched_multitarget.py similarity index 99% rename from src/anysolver/general_contact/enriched_multitarget.py rename to src/anyfesolver/general_contact/enriched_multitarget.py index b8177ea34..15fc9538d 100644 --- a/src/anysolver/general_contact/enriched_multitarget.py +++ b/src/anyfesolver/general_contact/enriched_multitarget.py @@ -8,7 +8,7 @@ from dataclasses import dataclass import numpy as np from scipy.linalg import null_space -from anysolver.e4_pl_enriched import EnrichedProfileError,readonly +from anyfesolver.e4_pl_enriched import EnrichedProfileError,readonly from .enriched_nonlinear import NonlinearEnrichedSystem from .enriched_static import (AcceptedState,ContactState,check_cancel,digest,array_digest) from .enriched_multitarget_topology import certify_disk @@ -299,7 +299,7 @@ def restore(self,checkpoint,*,criteria,cancel=lambda:False): # Exact built-in pure graph admitted for duplicate-value reuse. Unknown overrides # keep complete evaluation; no arbitrary __wrapped__ metadata is trusted. from .enriched_nonlinear import CurrentNodalBaseline as _Baseline -from anysolver.e4_pl_enriched_nonlinear import NonlinearEnrichedCell as _Cell +from anyfesolver.e4_pl_enriched_nonlinear import NonlinearEnrichedCell as _Cell from . import enriched_multitarget_moments as _Selected, enriched_moment_batch as _Batch _REUSE_OPERATOR_FUNCTIONS=tuple((f,f.__code__) for f in ( MultiTargetSystem.equations,MultiTargetSystem.structural_response, diff --git a/src/anysolver/general_contact/enriched_multitarget_gap.py b/src/anyfesolver/general_contact/enriched_multitarget_gap.py similarity index 99% rename from src/anysolver/general_contact/enriched_multitarget_gap.py rename to src/anyfesolver/general_contact/enriched_multitarget_gap.py index 1cfa135e8..b51f7cd79 100644 --- a/src/anysolver/general_contact/enriched_multitarget_gap.py +++ b/src/anyfesolver/general_contact/enriched_multitarget_gap.py @@ -6,7 +6,7 @@ from fractions import Fraction as F from math import comb, sqrt import numpy as np -from anysolver.e4_pl_enriched import EnrichedProfileError +from anyfesolver.e4_pl_enriched import EnrichedProfileError ReferenceRefused=EnrichedProfileError def require(ok,message): if not ok: raise EnrichedProfileError(message) diff --git a/src/anysolver/general_contact/enriched_multitarget_moments.py b/src/anyfesolver/general_contact/enriched_multitarget_moments.py similarity index 100% rename from src/anysolver/general_contact/enriched_multitarget_moments.py rename to src/anyfesolver/general_contact/enriched_multitarget_moments.py diff --git a/src/anysolver/general_contact/enriched_multitarget_topology.py b/src/anyfesolver/general_contact/enriched_multitarget_topology.py similarity index 100% rename from src/anysolver/general_contact/enriched_multitarget_topology.py rename to src/anyfesolver/general_contact/enriched_multitarget_topology.py diff --git a/src/anysolver/general_contact/enriched_nonlinear.py b/src/anyfesolver/general_contact/enriched_nonlinear.py similarity index 97% rename from src/anysolver/general_contact/enriched_nonlinear.py rename to src/anyfesolver/general_contact/enriched_nonlinear.py index 41d433a03..d4766c2e2 100644 --- a/src/anysolver/general_contact/enriched_nonlinear.py +++ b/src/anyfesolver/general_contact/enriched_nonlinear.py @@ -10,10 +10,10 @@ import numpy as np from scipy.linalg import null_space -from anysolver.e4_pl_enriched import EnrichedProfileError, readonly -from anysolver.e4_pl_enriched_nonlinear import FORMULATION, compile_nonlinear_cell -from anysolver.nonlinear_restart import model_configuration_fingerprint -from anysolver.nonlinear_static import ( +from anyfesolver.e4_pl_enriched import EnrichedProfileError, readonly +from anyfesolver.e4_pl_enriched_nonlinear import FORMULATION, compile_nonlinear_cell +from anyfesolver.nonlinear_restart import model_configuration_fingerprint +from anyfesolver.nonlinear_static import ( _prepare_initial_states, _prepare_qualified_q4_states_for_nonlinear_solve, _activate_nonlinear_state_storage, _assemble_nonlinear_system, _discard_nonlinear_state_candidate, @@ -63,12 +63,12 @@ def _compile_physical_definition(model,definitions,normal_stiffness,quadrature): only its integration vertex/DOF ordering, preserving its actual director and the caller's physical surface offset. No element or model is edited. """ - from anysolver.e4_pl_element import QualifiedE4PLShellElement - from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement - from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement - from anysolver.e4_pl_enriched import compile_cell - from anysolver.matrix_assembly import assemble_stiffness_matrix - from anysolver.assembly import build_constraint_transformation + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement + from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement + from anyfesolver.e4_pl_enriched import compile_cell + from anyfesolver.matrix_assembly import assemble_stiffness_matrix + from anyfesolver.assembly import build_constraint_transformation definitions=tuple(definitions) allowed=(QualifiedE4PLShellElement,QualifiedE4PLS3ShellElement,NativeParityE4PLS3V2DShellElement) if (not definitions or any(type(d)is not PairDefinition for d in definitions) diff --git a/src/anysolver/general_contact/enriched_overlap.py b/src/anyfesolver/general_contact/enriched_overlap.py similarity index 98% rename from src/anysolver/general_contact/enriched_overlap.py rename to src/anyfesolver/general_contact/enriched_overlap.py index 0ccb810a7..510810ce7 100644 --- a/src/anysolver/general_contact/enriched_overlap.py +++ b/src/anyfesolver/general_contact/enriched_overlap.py @@ -13,9 +13,9 @@ from dataclasses import dataclass import numpy as np -from anysolver._ge_beam3_mixed_ad import Jet2, sqrt -from anysolver.control import SolveCancelled -from anysolver.e4_pl_enriched import EnrichedProfileError, bubble_basis, readonly +from anyfesolver._ge_beam3_mixed_ad import Jet2, sqrt +from anyfesolver.control import SolveCancelled +from anyfesolver.e4_pl_enriched import EnrichedProfileError, bubble_basis, readonly SIZE = 37 diff --git a/src/anysolver/general_contact/enriched_path.py b/src/anyfesolver/general_contact/enriched_path.py similarity index 98% rename from src/anysolver/general_contact/enriched_path.py rename to src/anyfesolver/general_contact/enriched_path.py index 35221f90f..0b1a255fa 100644 --- a/src/anysolver/general_contact/enriched_path.py +++ b/src/anyfesolver/general_contact/enriched_path.py @@ -7,7 +7,7 @@ from .enriched_multitarget import MultiTargetSystem,FORMULATION from .enriched_multitarget_gap import global_gap_certificate from .enriched_static import PairDefinition,MixedCriteria,IterationControl,check_cancel,digest -from anysolver.e4_pl_enriched import EnrichedProfileError,readonly +from anyfesolver.e4_pl_enriched import EnrichedProfileError,readonly PATH_PROFILE='ENRICHED_MULTITARGET_CONTACT_PATH_V16' DOF={'ux':0,'uy':1,'uz':2,'rx':3,'ry':4,'rz':5} @@ -57,9 +57,9 @@ def __init__(self,model,definition,program,*,quadrature,force_scale_n, physical_force_scale_n=.018,control=IterationControl(18,8)): from .static_path import ContactPathProgram from .core import ContactDefinition,ContactSurface,ContactInteraction - from anysolver.e4_pl_element import QualifiedE4PLShellElement - from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement - from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement + from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement if type(program) is not ContactPathProgram or program.control_profile!='translation_v1': raise EnrichedProfileError('original immutable translation ContactPathProgram required') self.program=program diff --git a/src/anysolver/general_contact/enriched_small_cut.py b/src/anyfesolver/general_contact/enriched_small_cut.py similarity index 100% rename from src/anysolver/general_contact/enriched_small_cut.py rename to src/anyfesolver/general_contact/enriched_small_cut.py diff --git a/src/anysolver/general_contact/enriched_static.py b/src/anyfesolver/general_contact/enriched_static.py similarity index 97% rename from src/anysolver/general_contact/enriched_static.py rename to src/anyfesolver/general_contact/enriched_static.py index ba7eda390..31c9864ef 100644 --- a/src/anysolver/general_contact/enriched_static.py +++ b/src/anyfesolver/general_contact/enriched_static.py @@ -14,9 +14,9 @@ import numpy as np -from anysolver._ge_beam3_mixed_ad import Jet2, matvec, so3_exp -from anysolver.control import SolveCancelled -from anysolver.e4_pl_enriched import ( +from anyfesolver._ge_beam3_mixed_ad import Jet2, matvec, so3_exp +from anyfesolver.control import SolveCancelled +from anyfesolver.e4_pl_enriched import ( FORMULATION, EnrichedProfileError, compile_cell, readonly, ) from .enriched_overlap import QuadraturePolicy, moments @@ -203,11 +203,11 @@ def coordinate_map(self): @classmethod def from_model(cls, model, definitions, *, normal_stiffness, quadrature): - from anysolver.e4_pl_element import QualifiedE4PLShellElement - from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement - from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement - from anysolver.matrix_assembly import assemble_stiffness_matrix - from anysolver.assembly import build_constraint_transformation + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement + from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement + from anyfesolver.matrix_assembly import assemble_stiffness_matrix + from anyfesolver.assembly import build_constraint_transformation definitions = tuple(definitions) if (not definitions or any(type(d) is not PairDefinition for d in definitions) or len({(d.source_element, d.target_element) for d in definitions}) != len(definitions)): diff --git a/src/anysolver/general_contact/enriched_union.py b/src/anyfesolver/general_contact/enriched_union.py similarity index 100% rename from src/anysolver/general_contact/enriched_union.py rename to src/anyfesolver/general_contact/enriched_union.py diff --git a/src/anysolver/general_contact/equilibrated_pressure_pivot.py b/src/anyfesolver/general_contact/equilibrated_pressure_pivot.py similarity index 98% rename from src/anysolver/general_contact/equilibrated_pressure_pivot.py rename to src/anyfesolver/general_contact/equilibrated_pressure_pivot.py index d55fdd9f5..95348fb43 100644 --- a/src/anysolver/general_contact/equilibrated_pressure_pivot.py +++ b/src/anyfesolver/general_contact/equilibrated_pressure_pivot.py @@ -7,8 +7,8 @@ import numpy as np from scipy import sparse -from anysolver.linalg import MatrixClass, factorize -from anysolver.nonlinear_static import ( +from anyfesolver.linalg import MatrixClass, factorize +from anyfesolver.nonlinear_static import ( _assemble_nonlinear_system, _discard_nonlinear_state_candidate, ) diff --git a/src/anysolver/general_contact/event_subdivision.py b/src/anyfesolver/general_contact/event_subdivision.py similarity index 100% rename from src/anysolver/general_contact/event_subdivision.py rename to src/anyfesolver/general_contact/event_subdivision.py diff --git a/src/anysolver/general_contact/finite_mixed_state.py b/src/anyfesolver/general_contact/finite_mixed_state.py similarity index 95% rename from src/anysolver/general_contact/finite_mixed_state.py rename to src/anyfesolver/general_contact/finite_mixed_state.py index 07d7a90ba..407812afb 100644 --- a/src/anysolver/general_contact/finite_mixed_state.py +++ b/src/anyfesolver/general_contact/finite_mixed_state.py @@ -11,8 +11,8 @@ def admitted_definition(model,definition,settings): """Exact opt-in pair; this does not broaden any existing finite profile.""" - from anysolver.e4_pl_element import QualifiedE4PLShellElement - from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement if (settings.shell_skin_kinematics!='corotational_nodal_director_dev' or settings.general_s3_differentiation!='jet2_q4_s3_dev' or settings.enforcement_solver!='monolithic_active_set' @@ -44,8 +44,8 @@ def admitted_definition(model,definition,settings): return True def owner_contract(model): - from anysolver.e4_pl_element import QualifiedE4PLShellElement - from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement from anymaterial import IsotropicMaterial from .finite_rotation_state import COORDINATES as Q4_COORDINATES owners=[] @@ -82,7 +82,7 @@ def mixed_state_contract(contract): return finite_state_contract(legacy) def local_coordinates(model,element,q): - from anysolver.corotational import _corotational_cache,_corotational_deformation_state + from anyfesolver.corotational import _corotational_cache,_corotational_deformation_state reference=_corotational_cache(model,centered_shell=False).get(int(element.element_id)) if reference is None or reference.category!='shell':raise ValueError('mixed owner shell reference missing') local,_,_=_corotational_deformation_state(reference,element,q) diff --git a/src/anysolver/general_contact/finite_rigid_patch.py b/src/anyfesolver/general_contact/finite_rigid_patch.py similarity index 99% rename from src/anysolver/general_contact/finite_rigid_patch.py rename to src/anyfesolver/general_contact/finite_rigid_patch.py index fbdd8782a..54ebaccfd 100644 --- a/src/anysolver/general_contact/finite_rigid_patch.py +++ b/src/anyfesolver/general_contact/finite_rigid_patch.py @@ -81,7 +81,7 @@ def __init__(self, model, definition, settings, initial_displacement=None, *, _p self.finite_skin = _FixedTargetSkin(FiniteQ4SkinMap(model, self.adapters, self.law.source_node_ids), self.reference[1]) from .s3_pair_static import _normal self.reference_normals = (_normal(source[self.law.source_face_indices[0]]), _normal(self.reference[1][self.law.target_face_indices[0]])) - from anysolver.corotational import _corotational_cache + from anyfesolver.corotational import _corotational_cache self.finite_elements = [] for adapter in self.adapters: element = model.mesh.elements[adapter.element_id] diff --git a/src/anysolver/general_contact/finite_rigid_support.py b/src/anyfesolver/general_contact/finite_rigid_support.py similarity index 100% rename from src/anysolver/general_contact/finite_rigid_support.py rename to src/anyfesolver/general_contact/finite_rigid_support.py diff --git a/src/anysolver/general_contact/finite_rigid_sweep.py b/src/anyfesolver/general_contact/finite_rigid_sweep.py similarity index 100% rename from src/anysolver/general_contact/finite_rigid_sweep.py rename to src/anyfesolver/general_contact/finite_rigid_sweep.py diff --git a/src/anysolver/general_contact/finite_rotation_predictor.py b/src/anyfesolver/general_contact/finite_rotation_predictor.py similarity index 99% rename from src/anysolver/general_contact/finite_rotation_predictor.py rename to src/anyfesolver/general_contact/finite_rotation_predictor.py index 054c3d18f..55f81709d 100644 --- a/src/anysolver/general_contact/finite_rotation_predictor.py +++ b/src/anyfesolver/general_contact/finite_rotation_predictor.py @@ -1,7 +1,7 @@ """Explicit finite-profile rigid-frame seed; no free coordinate is constrained.""" from __future__ import annotations import numpy as np -from anysolver.corotational import rotation_matrix_from_vector,rotation_vector_from_matrix +from anyfesolver.corotational import rotation_matrix_from_vector,rotation_vector_from_matrix _DOF=dict(ux=0,uy=1,uz=2,rx=3,ry=4,rz=5) diff --git a/src/anysolver/general_contact/finite_rotation_skin.py b/src/anyfesolver/general_contact/finite_rotation_skin.py similarity index 100% rename from src/anysolver/general_contact/finite_rotation_skin.py rename to src/anyfesolver/general_contact/finite_rotation_skin.py diff --git a/src/anysolver/general_contact/finite_rotation_state.py b/src/anyfesolver/general_contact/finite_rotation_state.py similarity index 97% rename from src/anysolver/general_contact/finite_rotation_state.py rename to src/anyfesolver/general_contact/finite_rotation_state.py index f12b71c46..266ef789d 100644 --- a/src/anysolver/general_contact/finite_rotation_state.py +++ b/src/anyfesolver/general_contact/finite_rotation_state.py @@ -49,8 +49,8 @@ def finite_state_contract(contract): def owner_local_coordinates(model, element, global_element_q): - from anysolver.corotational import _corotational_cache, _corotational_deformation_state - from anysolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.corotational import _corotational_cache, _corotational_deformation_state + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement from anymaterial import IsotropicMaterial material = model.get_material(element.material_name) if (type(element) is not QualifiedE4PLShellElement or type(material) is not IsotropicMaterial diff --git a/src/anysolver/general_contact/finite_rotation_sweep.py b/src/anyfesolver/general_contact/finite_rotation_sweep.py similarity index 100% rename from src/anysolver/general_contact/finite_rotation_sweep.py rename to src/anyfesolver/general_contact/finite_rotation_sweep.py diff --git a/src/anysolver/general_contact/finite_v2d_state.py b/src/anyfesolver/general_contact/finite_v2d_state.py similarity index 98% rename from src/anysolver/general_contact/finite_v2d_state.py rename to src/anyfesolver/general_contact/finite_v2d_state.py index add0ab568..d58123b95 100644 --- a/src/anysolver/general_contact/finite_v2d_state.py +++ b/src/anyfesolver/general_contact/finite_v2d_state.py @@ -10,7 +10,7 @@ COORDINATES=V2D_COORDINATES def owner_contract(model): - from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement + from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement from anymaterial import IsotropicMaterial owners=[] for eid,element in sorted(model.mesh.elements.items()): diff --git a/src/anysolver/general_contact/fixed_projection_graph.py b/src/anyfesolver/general_contact/fixed_projection_graph.py similarity index 100% rename from src/anysolver/general_contact/fixed_projection_graph.py rename to src/anyfesolver/general_contact/fixed_projection_graph.py diff --git a/src/anysolver/general_contact/fixed_projection_s3_events.py b/src/anyfesolver/general_contact/fixed_projection_s3_events.py similarity index 100% rename from src/anysolver/general_contact/fixed_projection_s3_events.py rename to src/anyfesolver/general_contact/fixed_projection_s3_events.py diff --git a/src/anysolver/general_contact/free_rigid.py b/src/anyfesolver/general_contact/free_rigid.py similarity index 100% rename from src/anysolver/general_contact/free_rigid.py rename to src/anyfesolver/general_contact/free_rigid.py diff --git a/src/anysolver/general_contact/friction_point.py b/src/anyfesolver/general_contact/friction_point.py similarity index 100% rename from src/anysolver/general_contact/friction_point.py rename to src/anyfesolver/general_contact/friction_point.py diff --git a/src/anysolver/general_contact/gap_extrema.py b/src/anyfesolver/general_contact/gap_extrema.py similarity index 100% rename from src/anysolver/general_contact/gap_extrema.py rename to src/anyfesolver/general_contact/gap_extrema.py diff --git a/src/anysolver/general_contact/guided_pair_transient_geometry.py b/src/anyfesolver/general_contact/guided_pair_transient_geometry.py similarity index 100% rename from src/anysolver/general_contact/guided_pair_transient_geometry.py rename to src/anyfesolver/general_contact/guided_pair_transient_geometry.py diff --git a/src/anysolver/general_contact/initial_contact_seed.py b/src/anyfesolver/general_contact/initial_contact_seed.py similarity index 99% rename from src/anysolver/general_contact/initial_contact_seed.py rename to src/anyfesolver/general_contact/initial_contact_seed.py index abaff96bb..b9b4446ea 100644 --- a/src/anysolver/general_contact/initial_contact_seed.py +++ b/src/anyfesolver/general_contact/initial_contact_seed.py @@ -32,7 +32,7 @@ import numpy as np from scipy import sparse -from anysolver.linalg import MatrixClass, factorize +from anyfesolver.linalg import MatrixClass, factorize from .core import (_INITIAL_CONTACT_SEED_REVISION, _INITIAL_CONTACT_SEED_GLOBALIZATION_REVISION) diff --git a/src/anysolver/general_contact/linearized_pivot.py b/src/anyfesolver/general_contact/linearized_pivot.py similarity index 99% rename from src/anysolver/general_contact/linearized_pivot.py rename to src/anyfesolver/general_contact/linearized_pivot.py index 12eef7108..12c700b07 100644 --- a/src/anysolver/general_contact/linearized_pivot.py +++ b/src/anyfesolver/general_contact/linearized_pivot.py @@ -12,7 +12,7 @@ from scipy import sparse from scipy.linalg import null_space -from anysolver.linalg import MatrixClass, factorize +from anyfesolver.linalg import MatrixClass, factorize from .augmentation import ActiveSetPivot, propose_active_set_pivot from .overlap import PlanarFace diff --git a/src/anysolver/general_contact/material_work_diagnostics.py b/src/anyfesolver/general_contact/material_work_diagnostics.py similarity index 100% rename from src/anysolver/general_contact/material_work_diagnostics.py rename to src/anyfesolver/general_contact/material_work_diagnostics.py diff --git a/src/anysolver/general_contact/moment_batch_ad.py b/src/anyfesolver/general_contact/moment_batch_ad.py similarity index 99% rename from src/anysolver/general_contact/moment_batch_ad.py rename to src/anyfesolver/general_contact/moment_batch_ad.py index 91fb4c2d8..47b0e1b1d 100644 --- a/src/anysolver/general_contact/moment_batch_ad.py +++ b/src/anyfesolver/general_contact/moment_batch_ad.py @@ -6,7 +6,7 @@ """ from __future__ import annotations import numpy as np -from anysolver._ge_beam3_mixed_ad import Jet2 +from anyfesolver._ge_beam3_mixed_ad import Jet2 class PointJet: __slots__=('value','gradient','hessian') diff --git a/src/anysolver/general_contact/moment_batch_points.py b/src/anyfesolver/general_contact/moment_batch_points.py similarity index 98% rename from src/anysolver/general_contact/moment_batch_points.py rename to src/anyfesolver/general_contact/moment_batch_points.py index 449cfae68..2dfc4518e 100644 --- a/src/anysolver/general_contact/moment_batch_points.py +++ b/src/anyfesolver/general_contact/moment_batch_points.py @@ -1,7 +1,7 @@ """Same physical moment integrand evaluated in25 independent point lanes.""" from __future__ import annotations import numpy as np -from anysolver.e4_pl_enriched import bubble_basis +from anyfesolver.e4_pl_enriched import bubble_basis from .moment_batch_ad import PointJet,sqrt,choose from .enriched_overlap import EnrichedGeometryError,SIZE diff --git a/src/anysolver/general_contact/moving.py b/src/anyfesolver/general_contact/moving.py similarity index 100% rename from src/anysolver/general_contact/moving.py rename to src/anyfesolver/general_contact/moving.py diff --git a/src/anysolver/general_contact/multiple_beam_rigid.py b/src/anyfesolver/general_contact/multiple_beam_rigid.py similarity index 100% rename from src/anysolver/general_contact/multiple_beam_rigid.py rename to src/anyfesolver/general_contact/multiple_beam_rigid.py diff --git a/src/anysolver/general_contact/multiple_beam_s3_caps.py b/src/anyfesolver/general_contact/multiple_beam_s3_caps.py similarity index 100% rename from src/anysolver/general_contact/multiple_beam_s3_caps.py rename to src/anyfesolver/general_contact/multiple_beam_s3_caps.py diff --git a/src/anysolver/general_contact/multiple_beam_s3_transient.py b/src/anyfesolver/general_contact/multiple_beam_s3_transient.py similarity index 98% rename from src/anysolver/general_contact/multiple_beam_s3_transient.py rename to src/anyfesolver/general_contact/multiple_beam_s3_transient.py index 7fa137ac6..60310d27a 100644 --- a/src/anysolver/general_contact/multiple_beam_s3_transient.py +++ b/src/anyfesolver/general_contact/multiple_beam_s3_transient.py @@ -9,9 +9,9 @@ import numpy as np from scipy import sparse from anymaterial.isotropic import IsotropicMaterial -from anysolver.elements import BeamElement,QuadraticBeamElement -from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement -from anysolver.nonlinear_restart import model_configuration_fingerprint +from anyfesolver.elements import BeamElement,QuadraticBeamElement +from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement +from anyfesolver.nonlinear_restart import model_configuration_fingerprint from .core import ContactDefinition,ContactSolverSettings,_contact_settings_contract from .beam_shell import validate_beam_shell_contact from .deformable_beam_s3_static import PROFILE as CHILD_PROFILE diff --git a/src/anysolver/general_contact/multiple_projected_pairs.py b/src/anyfesolver/general_contact/multiple_projected_pairs.py similarity index 100% rename from src/anysolver/general_contact/multiple_projected_pairs.py rename to src/anyfesolver/general_contact/multiple_projected_pairs.py diff --git a/src/anysolver/general_contact/multiple_shell_planes.py b/src/anyfesolver/general_contact/multiple_shell_planes.py similarity index 99% rename from src/anysolver/general_contact/multiple_shell_planes.py rename to src/anyfesolver/general_contact/multiple_shell_planes.py index 67bd08775..0beef47a4 100644 --- a/src/anysolver/general_contact/multiple_shell_planes.py +++ b/src/anyfesolver/general_contact/multiple_shell_planes.py @@ -20,7 +20,7 @@ def _parts(model, definition, settings, analysis_control): - from anysolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement from .core import validate_general_contact if type(definition) is not ContactDefinition or type(settings) is not ContactSolverSettings: diff --git a/src/anysolver/general_contact/native_activation_static.py b/src/anyfesolver/general_contact/native_activation_static.py similarity index 98% rename from src/anysolver/general_contact/native_activation_static.py rename to src/anyfesolver/general_contact/native_activation_static.py index eda776e7a..a4858452d 100644 --- a/src/anysolver/general_contact/native_activation_static.py +++ b/src/anyfesolver/general_contact/native_activation_static.py @@ -6,8 +6,8 @@ from dataclasses import dataclass, replace from math import isfinite import numpy as np -from anysolver.control import cancellation_safe_point -from anysolver._ge_beam3_p5_seeded.core import sha +from anyfesolver.control import cancellation_safe_point +from anyfesolver._ge_beam3_p5_seeded.core import sha from .native_multi_s3_static import NativeRetainedMultiS3Analysis, NativeMultiS3Run from .native_s3_swept import native_s3_swept_admissible diff --git a/src/anysolver/general_contact/native_checkpoint_results.py b/src/anyfesolver/general_contact/native_checkpoint_results.py similarity index 100% rename from src/anysolver/general_contact/native_checkpoint_results.py rename to src/anyfesolver/general_contact/native_checkpoint_results.py diff --git a/src/anysolver/general_contact/native_curve_union.py b/src/anyfesolver/general_contact/native_curve_union.py similarity index 99% rename from src/anysolver/general_contact/native_curve_union.py rename to src/anyfesolver/general_contact/native_curve_union.py index cb1df34ca..41f5f0ac4 100644 --- a/src/anysolver/general_contact/native_curve_union.py +++ b/src/anyfesolver/general_contact/native_curve_union.py @@ -8,7 +8,7 @@ import numpy as np -from anysolver._ge_beam3_deterministic_reduction import deterministic_norm +from anyfesolver._ge_beam3_deterministic_reduction import deterministic_norm from .beam_curve_pair import ( _bezier_controls, _curve, diff --git a/src/anysolver/general_contact/native_curved_geometry.py b/src/anyfesolver/general_contact/native_curved_geometry.py similarity index 99% rename from src/anysolver/general_contact/native_curved_geometry.py rename to src/anyfesolver/general_contact/native_curved_geometry.py index d7af4bb60..7ab5b8ca8 100644 --- a/src/anysolver/general_contact/native_curved_geometry.py +++ b/src/anyfesolver/general_contact/native_curved_geometry.py @@ -10,7 +10,7 @@ import numpy as np -from anysolver._ge_beam3_p5.arrays import _array +from anyfesolver._ge_beam3_p5.arrays import _array from .capped_cylinder import _sqrt_bound from .native_surface_bounds import _reference_radial_gain, _rotation_gain, _restrict_q2 from .native_retained_station import _readonly @@ -293,8 +293,8 @@ def curved_patch_path_control(rule,start,translations,angular,origin,normal,*, Positive controls retain the declared normal/side. Unresolved controls never commit a state or return an inferred collision time. """ - from anysolver.control import cancellation_safe_point - from anysolver._ge_beam3_p5_seeded.core import sha + from anyfesolver.control import cancellation_safe_point + from anyfesolver._ge_beam3_p5_seeded.core import sha from .native_surface_s3_friction import NativeS3MaterialConfiguration from .native_surface_path import material_path_pose if type(start) is not NativeS3MaterialConfiguration or start.shell_displacement.size: diff --git a/src/anysolver/general_contact/native_curved_pair_partition.py b/src/anyfesolver/general_contact/native_curved_pair_partition.py similarity index 100% rename from src/anysolver/general_contact/native_curved_pair_partition.py rename to src/anyfesolver/general_contact/native_curved_pair_partition.py diff --git a/src/anysolver/general_contact/native_curved_plane_work.py b/src/anyfesolver/general_contact/native_curved_plane_work.py similarity index 99% rename from src/anysolver/general_contact/native_curved_plane_work.py rename to src/anyfesolver/general_contact/native_curved_plane_work.py index 5a94655cb..664e6d9a3 100644 --- a/src/anysolver/general_contact/native_curved_plane_work.py +++ b/src/anyfesolver/general_contact/native_curved_plane_work.py @@ -12,9 +12,9 @@ import numpy as np from numpy.polynomial.legendre import leggauss -from anysolver._ge_beam3_mixed_ad import Jet2 -from anysolver._ge_beam3_generalized_static_boundary import spatial_jacobian -from anysolver._ge_beam3_p5_seeded.core import sha +from anyfesolver._ge_beam3_mixed_ad import Jet2 +from anyfesolver._ge_beam3_generalized_static_boundary import spatial_jacobian +from anyfesolver._ge_beam3_p5_seeded.core import sha from .native_retained_station import _readonly from .native_surface_quadrature import NativeRoundSurfaceRule,_prepare_reference_area from .native_surface_normal import StraightNormalIntegrationSettings diff --git a/src/anysolver/general_contact/native_curved_s3_work.py b/src/anyfesolver/general_contact/native_curved_s3_work.py similarity index 98% rename from src/anysolver/general_contact/native_curved_s3_work.py rename to src/anyfesolver/general_contact/native_curved_s3_work.py index 5c502c15a..76a3f5e88 100644 --- a/src/anysolver/general_contact/native_curved_s3_work.py +++ b/src/anyfesolver/general_contact/native_curved_s3_work.py @@ -9,11 +9,11 @@ import numpy as np from scipy import sparse -from anysolver._ge_beam3_mixed_ad import Jet2,dot,sqrt as jet_sqrt -from anysolver._ge_beam3_deterministic_reduction import deterministic_dot, deterministic_norm +from anyfesolver._ge_beam3_mixed_ad import Jet2,dot,sqrt as jet_sqrt +from anyfesolver._ge_beam3_deterministic_reduction import deterministic_dot, deterministic_norm from .native_replay_arithmetic import gap_matrix_product, gap_vector_product -from anysolver._ge_beam3_generalized_static_boundary import spatial_jacobian -from anysolver._ge_beam3_p5_seeded.core import sha +from anyfesolver._ge_beam3_generalized_static_boundary import spatial_jacobian +from anyfesolver._ge_beam3_p5_seeded.core import sha from .native_curved_plane_work import NativeCurvedMaterialPlaneWork,_station_field,_critical_gaps from .native_curved_geometry import (curved_patch_geometry_control, _reference_norm_bounds,_reference_second_bound,_reference_curvature_norm) @@ -364,7 +364,7 @@ def certify_path(self,start,translations,angular,shell_increment,*, middle control has twice the physical lift; all rates below include it. Endpoint or midpoint sampling alone never establishes path admission. """ - from anysolver.control import cancellation_safe_point + from anyfesolver.control import cancellation_safe_point from .native_surface_s3_friction import NativeS3MaterialConfiguration from .native_surface_path import material_path_pose pose=self._configuration(start.positions,start.position_low,start.cell_rotations,start.shell_displacement) diff --git a/src/anysolver/general_contact/native_event_polynomial.py b/src/anyfesolver/general_contact/native_event_polynomial.py similarity index 100% rename from src/anysolver/general_contact/native_event_polynomial.py rename to src/anyfesolver/general_contact/native_event_polynomial.py diff --git a/src/anysolver/general_contact/native_fibre_context.py b/src/anyfesolver/general_contact/native_fibre_context.py similarity index 90% rename from src/anysolver/general_contact/native_fibre_context.py rename to src/anyfesolver/general_contact/native_fibre_context.py index 5dcde3a7c..3a460adac 100644 --- a/src/anysolver/general_contact/native_fibre_context.py +++ b/src/anyfesolver/general_contact/native_fibre_context.py @@ -11,17 +11,17 @@ import numpy as np -from anysolver.control import cancellation_safe_point -from anysolver.fe_core import FEModel -from anysolver.constraint_audit import require_valid_constraints -from anysolver._ge_beam3_native_analysis import NativeBeamAnalysis -from anysolver._ge_beam3_native_fibre_static_element import NativeFibreStaticElement -from anysolver._ge_beam3_retained_fibre_element import NativeRetainedFibreElement -from anysolver._ge_beam3_retained_fibre_state import Context as FibreContext -from anysolver._ge_beam3_retained_nodal_loading import Program -from anysolver._ge_beam3_seeded_load_program import ForceProgram -from anysolver._ge_beam3_generalized_static_boundary import spatial_jacobian -from anysolver._ge_beam3_p5_seeded.core import canonical,sha +from anyfesolver.control import cancellation_safe_point +from anyfesolver.fe_core import FEModel +from anyfesolver.constraint_audit import require_valid_constraints +from anyfesolver._ge_beam3_native_analysis import NativeBeamAnalysis +from anyfesolver._ge_beam3_native_fibre_static_element import NativeFibreStaticElement +from anyfesolver._ge_beam3_retained_fibre_element import NativeRetainedFibreElement +from anyfesolver._ge_beam3_retained_fibre_state import Context as FibreContext +from anyfesolver._ge_beam3_retained_nodal_loading import Program +from anyfesolver._ge_beam3_seeded_load_program import ForceProgram +from anyfesolver._ge_beam3_generalized_static_boundary import spatial_jacobian +from anyfesolver._ge_beam3_p5_seeded.core import canonical,sha POLICY='PHYSICAL_FIBRE_RETAINED_CONTACT_CONTEXT_DEV_V1' @@ -125,7 +125,7 @@ def advance(self,state,step): self.guard();return self._backend.layout.advance(state,step) def step(self,state,residual,tangent): - from anysolver._native_retained_step import retained_newton_step + from anyfesolver._native_retained_step import retained_newton_step self.guard() result=retained_newton_step(self,state,residual,tangent,family='physical-fibre') self.guard();return result @@ -135,7 +135,7 @@ def histories(self,values,*,decoded=False): def recover(self,mechanical,origins,histories,completed_targets): """Recover exact accepted fibre fields using this family's state owner.""" - from anysolver._ge_beam3_retained_fibre_state import State + from anyfesolver._ge_beam3_retained_fibre_state import State state=State(self.make(mechanical.descriptor()),self.histories(origins), self.histories(histories),completed_targets,self._backend.identity) return self._backend.recover(state) diff --git a/src/anysolver/general_contact/native_fibre_results.py b/src/anyfesolver/general_contact/native_fibre_results.py similarity index 96% rename from src/anysolver/general_contact/native_fibre_results.py rename to src/anyfesolver/general_contact/native_fibre_results.py index 0b93316ed..4a7770258 100644 --- a/src/anysolver/general_contact/native_fibre_results.py +++ b/src/anyfesolver/general_contact/native_fibre_results.py @@ -5,9 +5,9 @@ """ from math import fsum,isfinite import numpy as np -from anysolver.control import cancellation_safe_point -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_p5_seeded.codec import _load,MAX_BYTES +from anyfesolver.control import cancellation_safe_point +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_p5_seeded.codec import _load,MAX_BYTES SCHEMA='NATIVE_CONTACT_PHYSICAL_FIBRE_RECOVERY_DEV_V1' diff --git a/src/anysolver/general_contact/native_initial_guess.py b/src/anyfesolver/general_contact/native_initial_guess.py similarity index 98% rename from src/anysolver/general_contact/native_initial_guess.py rename to src/anyfesolver/general_contact/native_initial_guess.py index b6a8f38c3..bcbdccbd9 100644 --- a/src/anysolver/general_contact/native_initial_guess.py +++ b/src/anyfesolver/general_contact/native_initial_guess.py @@ -7,8 +7,8 @@ from math import fsum import numpy as np from scipy.spatial.transform import Rotation -from anysolver.control import cancellation_safe_point -from anysolver._ge_beam3_p5_seeded.core import sha,canonical +from anyfesolver.control import cancellation_safe_point +from anyfesolver._ge_beam3_p5_seeded.core import sha,canonical from .native_retained_station import _readonly diff --git a/src/anysolver/general_contact/native_material_activation.py b/src/anyfesolver/general_contact/native_material_activation.py similarity index 98% rename from src/anysolver/general_contact/native_material_activation.py rename to src/anyfesolver/general_contact/native_material_activation.py index 513853849..92c4e439d 100644 --- a/src/anysolver/general_contact/native_material_activation.py +++ b/src/anyfesolver/general_contact/native_material_activation.py @@ -5,7 +5,7 @@ The existing radius, director and physical-rim certificates admit the prefix. """ import numpy as np -from anysolver.control import cancellation_safe_point +from anyfesolver.control import cancellation_safe_point from .native_s3_swept import native_s3_swept_admissible diff --git a/src/anysolver/general_contact/native_material_plane.py b/src/anyfesolver/general_contact/native_material_plane.py similarity index 98% rename from src/anysolver/general_contact/native_material_plane.py rename to src/anyfesolver/general_contact/native_material_plane.py index 8294b0692..4d65f65c1 100644 --- a/src/anysolver/general_contact/native_material_plane.py +++ b/src/anyfesolver/general_contact/native_material_plane.py @@ -10,8 +10,8 @@ import numpy as np -from anysolver._ge_beam3_mixed_ad import Jet2 -from anysolver._ge_beam3_p5_seeded.core import sha +from anyfesolver._ge_beam3_mixed_ad import Jet2 +from anyfesolver._ge_beam3_p5_seeded.core import sha from .native_retained_line_plane import NativeRetainedLinePlaneResult from .native_retained_station import _readonly from .native_surface_extrema import straight_patch_plane_extrema diff --git a/src/anysolver/general_contact/native_material_s3.py b/src/anyfesolver/general_contact/native_material_s3.py similarity index 99% rename from src/anysolver/general_contact/native_material_s3.py rename to src/anyfesolver/general_contact/native_material_s3.py index 5095eab45..0a3fbbe2b 100644 --- a/src/anysolver/general_contact/native_material_s3.py +++ b/src/anyfesolver/general_contact/native_material_s3.py @@ -7,7 +7,7 @@ from math import isfinite import numpy as np from scipy import sparse -from anysolver._ge_beam3_p5_seeded.core import sha +from anyfesolver._ge_beam3_p5_seeded.core import sha from .native_retained_station import _readonly from .native_surface_extrema import straight_patch_plane_extrema,straight_patch_s3_gap from .native_surface_normal import StraightNormalIntegrationSettings,integrate_straight_normal diff --git a/src/anysolver/general_contact/native_multi_s3_static.py b/src/anyfesolver/general_contact/native_multi_s3_static.py similarity index 98% rename from src/anysolver/general_contact/native_multi_s3_static.py rename to src/anyfesolver/general_contact/native_multi_s3_static.py index f56f1f81e..42cadac68 100644 --- a/src/anysolver/general_contact/native_multi_s3_static.py +++ b/src/anyfesolver/general_contact/native_multi_s3_static.py @@ -11,15 +11,15 @@ import numpy as np from scipy import sparse from anymaterial import IsotropicMaterial -from anysolver._ge_beam3_native_analysis import NativeBeamAnalysis -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement -from anysolver._ge_beam3_retained_nodal_loading import Context, Program -from anysolver._ge_beam3_generalized_static_boundary import spatial_jacobian -from anysolver._ge_beam3_p5_seeded.core import canonical, sha -from anysolver._ge_beam3_p5_seeded.codec import MAX_BYTES, _load -from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement -from anysolver.fe_core import FEModel +from anyfesolver._ge_beam3_native_analysis import NativeBeamAnalysis +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement +from anyfesolver._ge_beam3_retained_nodal_loading import Context, Program +from anyfesolver._ge_beam3_generalized_static_boundary import spatial_jacobian +from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha +from anyfesolver._ge_beam3_p5_seeded.codec import MAX_BYTES, _load +from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement +from anyfesolver.fe_core import FEModel from .native_retained_line_s3_work import NativeRetainedLineS3Work from .native_material_s3 import NativeRetainedMaterialS3Work from .native_curved_s3_work import NativeCurvedMaterialS3Work @@ -506,7 +506,7 @@ def _assemble(self, mechanical, displacement, parameter, origins): def _activation_fraction(self, start, u_start, step, fraction, contact, cancellation_token): if self._curved_mode: - from anysolver.control import cancellation_safe_point + from anyfesolver.control import cancellation_safe_point cancellation_safe_point(cancellation_token,'curved S3 initial gap fraction') end=self.context.advance(start,step[:self.context.count]*fraction) u_end=u_start+step[self.context.count:]*fraction diff --git a/src/anysolver/general_contact/native_normal_angles.py b/src/anyfesolver/general_contact/native_normal_angles.py similarity index 100% rename from src/anysolver/general_contact/native_normal_angles.py rename to src/anyfesolver/general_contact/native_normal_angles.py diff --git a/src/anysolver/general_contact/native_pair_error_budget.py b/src/anyfesolver/general_contact/native_pair_error_budget.py similarity index 100% rename from src/anysolver/general_contact/native_pair_error_budget.py rename to src/anyfesolver/general_contact/native_pair_error_budget.py diff --git a/src/anysolver/general_contact/native_replay_arithmetic.py b/src/anyfesolver/general_contact/native_replay_arithmetic.py similarity index 100% rename from src/anysolver/general_contact/native_replay_arithmetic.py rename to src/anyfesolver/general_contact/native_replay_arithmetic.py diff --git a/src/anysolver/general_contact/native_replay_diagnostics.py b/src/anyfesolver/general_contact/native_replay_diagnostics.py similarity index 100% rename from src/anysolver/general_contact/native_replay_diagnostics.py rename to src/anyfesolver/general_contact/native_replay_diagnostics.py diff --git a/src/anysolver/general_contact/native_retained_body_junction.py b/src/anyfesolver/general_contact/native_retained_body_junction.py similarity index 100% rename from src/anysolver/general_contact/native_retained_body_junction.py rename to src/anyfesolver/general_contact/native_retained_body_junction.py diff --git a/src/anysolver/general_contact/native_retained_body_pair.py b/src/anyfesolver/general_contact/native_retained_body_pair.py similarity index 99% rename from src/anysolver/general_contact/native_retained_body_pair.py rename to src/anyfesolver/general_contact/native_retained_body_pair.py index f33a07eed..92e2e40ca 100644 --- a/src/anysolver/general_contact/native_retained_body_pair.py +++ b/src/anyfesolver/general_contact/native_retained_body_pair.py @@ -4,7 +4,7 @@ from types import SimpleNamespace import numpy as np -from anysolver._ge_beam3_p5_seeded.core import sha +from anyfesolver._ge_beam3_p5_seeded.core import sha from .native_retained_curve_cell import NativeRetainedCurveCell from .native_retained_station import _cross_matrix, _readonly from .native_retained_whole_pair import NativeRetainedWholeCurvePair, NativeRetainedWholePairResult, _exact_controls diff --git a/src/anysolver/general_contact/native_retained_body_projection.py b/src/anyfesolver/general_contact/native_retained_body_projection.py similarity index 100% rename from src/anysolver/general_contact/native_retained_body_projection.py rename to src/anyfesolver/general_contact/native_retained_body_projection.py diff --git a/src/anysolver/general_contact/native_retained_body_static.py b/src/anyfesolver/general_contact/native_retained_body_static.py similarity index 97% rename from src/anysolver/general_contact/native_retained_body_static.py rename to src/anyfesolver/general_contact/native_retained_body_static.py index b9ea721db..74c190749 100644 --- a/src/anysolver/general_contact/native_retained_body_static.py +++ b/src/anyfesolver/general_contact/native_retained_body_static.py @@ -1,7 +1,7 @@ """Explicit physical-fibre grouped-body static owner; full native transaction.""" import numpy as np -from anysolver._ge_beam3_native_analysis import NativeBeamAnalysis -from anysolver._ge_beam3_p5.algebra import skew +from anyfesolver._ge_beam3_native_analysis import NativeBeamAnalysis +from anyfesolver._ge_beam3_p5.algebra import skew from .native_fibre_context import NativeFibreContactContext from .native_retained_pair_static import NativeRetainedRoundPairAnalysis, NativeRetainedPairAccepted from .native_retained_body_pair import NativeRetainedBodyPair diff --git a/src/anysolver/general_contact/native_retained_cell_pair.py b/src/anyfesolver/general_contact/native_retained_cell_pair.py similarity index 98% rename from src/anysolver/general_contact/native_retained_cell_pair.py rename to src/anyfesolver/general_contact/native_retained_cell_pair.py index e473a6d50..b5db8fa1b 100644 --- a/src/anysolver/general_contact/native_retained_cell_pair.py +++ b/src/anyfesolver/general_contact/native_retained_cell_pair.py @@ -7,10 +7,10 @@ import numpy as np -from anysolver._ge_beam3_centered_reference import ( +from anyfesolver._ge_beam3_centered_reference import ( CenteredCurvedBeam3ReferenceGeometry, ) -from anysolver._ge_beam3_p5_seeded.core import sha +from anyfesolver._ge_beam3_p5_seeded.core import sha from .beam_curve_pair import B3PairPotential, certify_b3_pair_gap from .native_retained_curve_cell import NativeRetainedCurveCell diff --git a/src/anysolver/general_contact/native_retained_curve_cell.py b/src/anyfesolver/general_contact/native_retained_curve_cell.py similarity index 94% rename from src/anysolver/general_contact/native_retained_curve_cell.py rename to src/anyfesolver/general_contact/native_retained_curve_cell.py index d4b129a09..e2d1a11ff 100644 --- a/src/anysolver/general_contact/native_retained_curve_cell.py +++ b/src/anyfesolver/general_contact/native_retained_curve_cell.py @@ -7,12 +7,12 @@ import numpy as np -from anysolver._ge_beam3_centered_reference import ( +from anyfesolver._ge_beam3_centered_reference import ( CenteredCurvedBeam3ReferenceGeometry, ) -from anysolver._ge_beam3_p5.arrays import _array, _frames -from anysolver._ge_beam3_p5.compensated_coordinates import validate_pair -from anysolver._ge_beam3_p5_seeded.core import sha +from anyfesolver._ge_beam3_p5.arrays import _array, _frames +from anyfesolver._ge_beam3_p5.compensated_coordinates import validate_pair +from anyfesolver._ge_beam3_p5_seeded.core import sha from .native_retained_station import _cross_matrix, _readonly diff --git a/src/anysolver/general_contact/native_retained_line_plane.py b/src/anyfesolver/general_contact/native_retained_line_plane.py similarity index 97% rename from src/anysolver/general_contact/native_retained_line_plane.py rename to src/anyfesolver/general_contact/native_retained_line_plane.py index 31d991f1e..ad2086064 100644 --- a/src/anysolver/general_contact/native_retained_line_plane.py +++ b/src/anyfesolver/general_contact/native_retained_line_plane.py @@ -7,11 +7,11 @@ import numpy as np -from anysolver._ge_beam3_centered_reference import ( +from anyfesolver._ge_beam3_centered_reference import ( CenteredCurvedBeam3ReferenceGeometry, ) -from anysolver._ge_beam3_p5.arrays import _array, _frames -from anysolver._ge_beam3_p5.compensated_coordinates import validate_pair +from anyfesolver._ge_beam3_p5.arrays import _array, _frames +from anyfesolver._ge_beam3_p5.compensated_coordinates import validate_pair from .native_retained_station import NativeRetainedRoundStation diff --git a/src/anysolver/general_contact/native_retained_line_s3.py b/src/anyfesolver/general_contact/native_retained_line_s3.py similarity index 99% rename from src/anysolver/general_contact/native_retained_line_s3.py rename to src/anyfesolver/general_contact/native_retained_line_s3.py index 49ecd4887..bd3c13b25 100644 --- a/src/anysolver/general_contact/native_retained_line_s3.py +++ b/src/anyfesolver/general_contact/native_retained_line_s3.py @@ -13,10 +13,10 @@ import numpy as np -from anysolver._ge_beam3_centered_reference import ( +from anyfesolver._ge_beam3_centered_reference import ( CenteredCurvedBeam3ReferenceGeometry, ) -from anysolver._ge_beam3_p5_seeded.core import sha +from anyfesolver._ge_beam3_p5_seeded.core import sha from .beam_curve_pair import _bezier_controls, _curve from .native_retained_curve_cell import NativeRetainedCurveCell diff --git a/src/anysolver/general_contact/native_retained_line_s3_work.py b/src/anyfesolver/general_contact/native_retained_line_s3_work.py similarity index 98% rename from src/anysolver/general_contact/native_retained_line_s3_work.py rename to src/anyfesolver/general_contact/native_retained_line_s3_work.py index d88993308..342422708 100644 --- a/src/anysolver/general_contact/native_retained_line_s3_work.py +++ b/src/anyfesolver/general_contact/native_retained_line_s3_work.py @@ -7,7 +7,7 @@ import numpy as np from scipy import sparse -from anysolver._ge_beam3_p5_seeded.core import sha +from anyfesolver._ge_beam3_p5_seeded.core import sha from .native_retained_line_s3 import ( NativeRetainedLineS3Result, diff --git a/src/anysolver/general_contact/native_retained_pair_static.py b/src/anyfesolver/general_contact/native_retained_pair_static.py similarity index 98% rename from src/anysolver/general_contact/native_retained_pair_static.py rename to src/anyfesolver/general_contact/native_retained_pair_static.py index d8cd5f3ae..b7f4faa1b 100644 --- a/src/anysolver/general_contact/native_retained_pair_static.py +++ b/src/anyfesolver/general_contact/native_retained_pair_static.py @@ -9,17 +9,17 @@ import numpy as np -from anysolver._ge_beam3_generalized_static_boundary import spatial_jacobian -from anysolver._ge_beam3_native_analysis import NativeBeamAnalysis -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement -from anysolver._ge_beam3_retained_nodal_loading import ( +from anyfesolver._ge_beam3_generalized_static_boundary import spatial_jacobian +from anyfesolver._ge_beam3_native_analysis import NativeBeamAnalysis +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement +from anyfesolver._ge_beam3_retained_nodal_loading import ( Context as NativeNodalContext, Program as NativeNodalProgram, ) -from anysolver._ge_beam3_p5_seeded.core import canonical, sha -from anysolver._ge_beam3_p5_seeded.codec import MAX_BYTES, _load -from anysolver._ge_beam3_p5.algebra import log_rotation +from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha +from anyfesolver._ge_beam3_p5_seeded.codec import MAX_BYTES, _load +from anyfesolver._ge_beam3_p5.algebra import log_rotation from .native_retained_cell_pair import ( NativeRetainedCellPairResult, diff --git a/src/anysolver/general_contact/native_retained_s3_static.py b/src/anyfesolver/general_contact/native_retained_s3_static.py similarity index 97% rename from src/anysolver/general_contact/native_retained_s3_static.py rename to src/anyfesolver/general_contact/native_retained_s3_static.py index 526b21767..606e3b4d0 100644 --- a/src/anysolver/general_contact/native_retained_s3_static.py +++ b/src/anyfesolver/general_contact/native_retained_s3_static.py @@ -9,18 +9,18 @@ import numpy as np from anymaterial import IsotropicMaterial -from anysolver._ge_beam3_generalized_static_boundary import spatial_jacobian -from anysolver._ge_beam3_native_analysis import NativeBeamAnalysis -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement -from anysolver._ge_beam3_retained_nodal_loading import ( +from anyfesolver._ge_beam3_generalized_static_boundary import spatial_jacobian +from anyfesolver._ge_beam3_native_analysis import NativeBeamAnalysis +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement +from anyfesolver._ge_beam3_retained_nodal_loading import ( Context as NativeNodalContext, Program as NativeNodalProgram, ) -from anysolver._ge_beam3_p5_seeded.core import canonical, sha -from anysolver._ge_beam3_p5_seeded.codec import MAX_BYTES, _load -from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement -from anysolver.fe_core import FEModel +from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha +from anyfesolver._ge_beam3_p5_seeded.codec import MAX_BYTES, _load +from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement +from anyfesolver.fe_core import FEModel from .native_retained_line_s3_work import ( NativeRetainedLineS3Work, @@ -398,7 +398,7 @@ def solve_material_increment(self, transaction, parameter, *, cancellation_token Unresolved contact transitions require caller continuation/event cutback; no rejected Newton iterate can advance the transaction's physical state. """ - from anysolver.control import cancellation_safe_point + from anyfesolver.control import cancellation_safe_point if type(self.contact) is NativeRetainedMaterialS3Work: raise ValueError('normal material-patch owner does not admit the existing friction transaction') from .native_surface_transaction import NativeS3MaterialTransaction diff --git a/src/anysolver/general_contact/native_retained_static.py b/src/anyfesolver/general_contact/native_retained_static.py similarity index 97% rename from src/anysolver/general_contact/native_retained_static.py rename to src/anyfesolver/general_contact/native_retained_static.py index b250c17b9..04188d962 100644 --- a/src/anysolver/general_contact/native_retained_static.py +++ b/src/anyfesolver/general_contact/native_retained_static.py @@ -12,19 +12,19 @@ from math import isfinite import numpy as np -from anysolver.control import SolveCancelled, cancellation_safe_point +from anyfesolver.control import SolveCancelled, cancellation_safe_point -from anysolver._ge_beam3_generalized_static_boundary import spatial_jacobian -from anysolver._ge_beam3_native_analysis import NativeBeamAnalysis -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement -from anysolver._ge_beam3_retained_nodal_loading import ( +from anyfesolver._ge_beam3_generalized_static_boundary import spatial_jacobian +from anyfesolver._ge_beam3_native_analysis import NativeBeamAnalysis +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement +from anyfesolver._ge_beam3_retained_nodal_loading import ( Context as NativeNodalContext, Program as NativeNodalProgram, ) -from anysolver._ge_beam3_p5_seeded.core import sha -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_p5_seeded.codec import MAX_BYTES, _load +from anyfesolver._ge_beam3_p5_seeded.core import sha +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_p5_seeded.codec import MAX_BYTES, _load from .native_retained_line_plane import ( NativeRetainedLinePlaneResult, diff --git a/src/anysolver/general_contact/native_retained_station.py b/src/anyfesolver/general_contact/native_retained_station.py similarity index 97% rename from src/anysolver/general_contact/native_retained_station.py rename to src/anyfesolver/general_contact/native_retained_station.py index cc4897c8b..2ac179d99 100644 --- a/src/anysolver/general_contact/native_retained_station.py +++ b/src/anyfesolver/general_contact/native_retained_station.py @@ -13,12 +13,12 @@ import numpy as np -from anysolver._ge_beam3_centered_reference import ( +from anyfesolver._ge_beam3_centered_reference import ( CenteredCurvedBeam3ReferenceGeometry, ) -from anysolver._ge_beam3_p5.arrays import _array, _frames -from anysolver._ge_beam3_p5.compensated_coordinates import validate_pair -from anysolver._ge_beam3_p5_seeded.core import sha +from anyfesolver._ge_beam3_p5.arrays import _array, _frames +from anyfesolver._ge_beam3_p5.compensated_coordinates import validate_pair +from anyfesolver._ge_beam3_p5_seeded.core import sha def _cross_matrix(value: np.ndarray) -> np.ndarray: diff --git a/src/anysolver/general_contact/native_retained_whole_pair.py b/src/anyfesolver/general_contact/native_retained_whole_pair.py similarity index 99% rename from src/anysolver/general_contact/native_retained_whole_pair.py rename to src/anyfesolver/general_contact/native_retained_whole_pair.py index da583e1b7..614ee5bd8 100644 --- a/src/anysolver/general_contact/native_retained_whole_pair.py +++ b/src/anyfesolver/general_contact/native_retained_whole_pair.py @@ -9,11 +9,11 @@ import numpy as np from scipy.optimize import brentq -from anysolver._ge_beam3_deterministic_reduction import deterministic_dot, deterministic_norm -from anysolver._ge_beam3_centered_reference import ( +from anyfesolver._ge_beam3_deterministic_reduction import deterministic_dot, deterministic_norm +from anyfesolver._ge_beam3_centered_reference import ( CenteredCurvedBeam3ReferenceGeometry, ) -from anysolver._ge_beam3_p5_seeded.core import sha +from anyfesolver._ge_beam3_p5_seeded.core import sha from .beam_curve_pair import ( _GAUSS_8, _GAUSS_16, _bezier_controls, _curve, diff --git a/src/anysolver/general_contact/native_s3_swept.py b/src/anyfesolver/general_contact/native_s3_swept.py similarity index 100% rename from src/anysolver/general_contact/native_s3_swept.py rename to src/anyfesolver/general_contact/native_s3_swept.py diff --git a/src/anysolver/general_contact/native_shell_static_driver.py b/src/anyfesolver/general_contact/native_shell_static_driver.py similarity index 98% rename from src/anysolver/general_contact/native_shell_static_driver.py rename to src/anyfesolver/general_contact/native_shell_static_driver.py index 71736e4bd..06cd79cdb 100644 --- a/src/anysolver/general_contact/native_shell_static_driver.py +++ b/src/anyfesolver/general_contact/native_shell_static_driver.py @@ -4,8 +4,8 @@ single-beam owner keeps its equations, identities and public controls. """ import numpy as np -from anysolver.control import cancellation_safe_point, SolveCancelled -from anysolver._ge_beam3_p5_seeded.core import sha +from anyfesolver.control import cancellation_safe_point, SolveCancelled +from anyfesolver._ge_beam3_p5_seeded.core import sha def solve_native_shell(owner, schema, run_type, *, checkpoint=None, diff --git a/src/anysolver/general_contact/native_surface_activation.py b/src/anyfesolver/general_contact/native_surface_activation.py similarity index 99% rename from src/anysolver/general_contact/native_surface_activation.py rename to src/anyfesolver/general_contact/native_surface_activation.py index 8044f3f04..45e4edc79 100644 --- a/src/anysolver/general_contact/native_surface_activation.py +++ b/src/anyfesolver/general_contact/native_surface_activation.py @@ -9,9 +9,9 @@ import numpy as np from scipy.optimize import brentq -from anysolver._ge_beam3_p5_seeded.core import sha +from anyfesolver._ge_beam3_p5_seeded.core import sha -from anysolver._ge_beam3_mixed_ad import Jet2, so3_exp, so3_log, matmul, matvec, constant_matrix, dot, rotation_exponential +from anyfesolver._ge_beam3_mixed_ad import Jet2, so3_exp, so3_log, matmul, matvec, constant_matrix, dot, rotation_exponential from .native_retained_station import _readonly from .native_surface_path import material_path_pose, certify_material_ownership, affine_gap_polynomial from .native_surface_s3_friction import _unit, _cross diff --git a/src/anysolver/general_contact/native_surface_bounds.py b/src/anyfesolver/general_contact/native_surface_bounds.py similarity index 98% rename from src/anysolver/general_contact/native_surface_bounds.py rename to src/anyfesolver/general_contact/native_surface_bounds.py index db3ceb6fc..9ba73fd0f 100644 --- a/src/anysolver/general_contact/native_surface_bounds.py +++ b/src/anyfesolver/general_contact/native_surface_bounds.py @@ -10,8 +10,8 @@ import numpy as np -from anysolver._ge_beam3_deterministic_reduction import deterministic_norm -from anysolver._ge_beam3_p5.arrays import _array, _frames +from anyfesolver._ge_beam3_deterministic_reduction import deterministic_norm +from anyfesolver._ge_beam3_p5.arrays import _array, _frames from .native_retained_station import _readonly from .native_surface_quadrature import NativeRoundSurfaceRule diff --git a/src/anysolver/general_contact/native_surface_contributor.py b/src/anyfesolver/general_contact/native_surface_contributor.py similarity index 98% rename from src/anysolver/general_contact/native_surface_contributor.py rename to src/anyfesolver/general_contact/native_surface_contributor.py index b9e50eefc..de0d9fa9e 100644 --- a/src/anysolver/general_contact/native_surface_contributor.py +++ b/src/anyfesolver/general_contact/native_surface_contributor.py @@ -8,8 +8,8 @@ import numpy as np -from anysolver._ge_beam3_p5_seeded.core import sha -from anysolver.corotational import _rotation_right_jacobian +from anyfesolver._ge_beam3_p5_seeded.core import sha +from anyfesolver.corotational import _rotation_right_jacobian from .native_retained_s3_static import NativeRetainedRoundS3Analysis from .native_retained_line_s3_work import NativeRetainedLineS3Work from .native_retained_station import _readonly diff --git a/src/anysolver/general_contact/native_surface_crossing.py b/src/anyfesolver/general_contact/native_surface_crossing.py similarity index 100% rename from src/anysolver/general_contact/native_surface_crossing.py rename to src/anyfesolver/general_contact/native_surface_crossing.py diff --git a/src/anysolver/general_contact/native_surface_event_sequence.py b/src/anyfesolver/general_contact/native_surface_event_sequence.py similarity index 99% rename from src/anysolver/general_contact/native_surface_event_sequence.py rename to src/anyfesolver/general_contact/native_surface_event_sequence.py index 5bd318130..bf2152afc 100644 --- a/src/anysolver/general_contact/native_surface_event_sequence.py +++ b/src/anyfesolver/general_contact/native_surface_event_sequence.py @@ -10,7 +10,7 @@ import numpy as np from scipy.optimize import brentq -from anysolver._ge_beam3_p5_seeded.core import sha +from anyfesolver._ge_beam3_p5_seeded.core import sha from .friction_point import FrictionPointState,trial_coulomb_point from .native_retained_station import _readonly from .native_surface_path import material_path_pose,certify_material_ownership diff --git a/src/anysolver/general_contact/native_surface_extrema.py b/src/anyfesolver/general_contact/native_surface_extrema.py similarity index 100% rename from src/anysolver/general_contact/native_surface_extrema.py rename to src/anyfesolver/general_contact/native_surface_extrema.py diff --git a/src/anysolver/general_contact/native_surface_friction_integral.py b/src/anyfesolver/general_contact/native_surface_friction_integral.py similarity index 99% rename from src/anysolver/general_contact/native_surface_friction_integral.py rename to src/anyfesolver/general_contact/native_surface_friction_integral.py index 6e50db26a..8461e6178 100644 --- a/src/anysolver/general_contact/native_surface_friction_integral.py +++ b/src/anyfesolver/general_contact/native_surface_friction_integral.py @@ -1262,7 +1262,7 @@ def resolve_support(parent): # coverage certifies their union; the parent's independent integration # error estimate still decides whether its quadrature must subdivide. nonlocal unresolved_support_panels,support_panels_visited,segment_cover_reuses,prepared_segment_reuses - from anysolver._ge_beam3_p5_seeded.core import sha + from anyfesolver._ge_beam3_p5_seeded.core import sha if sha(field._definition())!=field.identity: raise ValueError('native material history field changed') if _front_uncertainty is not None: diff --git a/src/anysolver/general_contact/native_surface_front.py b/src/anyfesolver/general_contact/native_surface_front.py similarity index 99% rename from src/anysolver/general_contact/native_surface_front.py rename to src/anyfesolver/general_contact/native_surface_front.py index e8226608a..6646bd054 100644 --- a/src/anysolver/general_contact/native_surface_front.py +++ b/src/anyfesolver/general_contact/native_surface_front.py @@ -643,7 +643,7 @@ def stationary_front_partition_prepared(field,prepared,angle,*,maximum_axial_unc the shared budget. Root and endpoint coordinate uncertainties still gate. """ from scipy.optimize import brentq - from anysolver._ge_beam3_p5_seeded.core import sha + from anyfesolver._ge_beam3_p5_seeded.core import sha if (type(prepared) is not PreparedStationaryBand or prepared.cover.field_identity!=field.identity or sha(field._definition())!=field.identity or not prepared.cover.angle_bounds[0]<=angle<=prepared.cover.angle_bounds[1]): diff --git a/src/anysolver/general_contact/native_surface_front_boundary.py b/src/anyfesolver/general_contact/native_surface_front_boundary.py similarity index 99% rename from src/anysolver/general_contact/native_surface_front_boundary.py rename to src/anyfesolver/general_contact/native_surface_front_boundary.py index 9e46ef333..229d8c0df 100644 --- a/src/anysolver/general_contact/native_surface_front_boundary.py +++ b/src/anyfesolver/general_contact/native_surface_front_boundary.py @@ -130,7 +130,7 @@ def stationary_endpoint_angular_partition(field,cell,angle_bounds,*,budget): combined evaluation uses three times that bound. These are padded binary64 development controls, not a formal arithmetic proof or admission policy. """ - from anysolver._ge_beam3_p5_seeded.core import sha + from anyfesolver._ge_beam3_p5_seeded.core import sha if type(budget) is not SupportIntervalBudget:raise TypeError('shared support budget required') if type(cell) is not int or cell not in (0,1):raise ValueError('one native half-cell required') if sha(field._definition())!=field.identity:raise ValueError('native material history field changed') diff --git a/src/anysolver/general_contact/native_surface_front_precision.py b/src/anyfesolver/general_contact/native_surface_front_precision.py similarity index 100% rename from src/anysolver/general_contact/native_surface_front_precision.py rename to src/anyfesolver/general_contact/native_surface_front_precision.py diff --git a/src/anysolver/general_contact/native_surface_front_work.py b/src/anyfesolver/general_contact/native_surface_front_work.py similarity index 100% rename from src/anysolver/general_contact/native_surface_front_work.py rename to src/anyfesolver/general_contact/native_surface_front_work.py diff --git a/src/anysolver/general_contact/native_surface_history.py b/src/anyfesolver/general_contact/native_surface_history.py similarity index 99% rename from src/anysolver/general_contact/native_surface_history.py rename to src/anyfesolver/general_contact/native_surface_history.py index 3526ca03b..ac70c259d 100644 --- a/src/anysolver/general_contact/native_surface_history.py +++ b/src/anyfesolver/general_contact/native_surface_history.py @@ -8,7 +8,7 @@ import numpy as np -from anysolver._ge_beam3_p5_seeded.core import sha +from anyfesolver._ge_beam3_p5_seeded.core import sha from .friction_point import initial_friction_point from .native_retained_station import NativeRetainedRoundStation, _readonly from .native_surface_path import material_path_pose diff --git a/src/anysolver/general_contact/native_surface_normal.py b/src/anyfesolver/general_contact/native_surface_normal.py similarity index 99% rename from src/anysolver/general_contact/native_surface_normal.py rename to src/anyfesolver/general_contact/native_surface_normal.py index 110282f67..b08c8f405 100644 --- a/src/anysolver/general_contact/native_surface_normal.py +++ b/src/anyfesolver/general_contact/native_surface_normal.py @@ -13,8 +13,8 @@ import numpy as np from numpy.polynomial.legendre import leggauss -from anysolver._ge_beam3_generalized_static_boundary import spatial_jacobian -from anysolver._ge_beam3_mixed_ad import ( +from anyfesolver._ge_beam3_generalized_static_boundary import spatial_jacobian +from anyfesolver._ge_beam3_mixed_ad import ( Jet2, constant_matrix, dot, matmul, so3_exp, sqrt, ) from .native_normal_angles import PRECISION, PreciseNormalAngles diff --git a/src/anysolver/general_contact/native_surface_patch.py b/src/anyfesolver/general_contact/native_surface_patch.py similarity index 99% rename from src/anysolver/general_contact/native_surface_patch.py rename to src/anyfesolver/general_contact/native_surface_patch.py index 7cd2f5011..2c8dcaea1 100644 --- a/src/anysolver/general_contact/native_surface_patch.py +++ b/src/anyfesolver/general_contact/native_surface_patch.py @@ -7,7 +7,7 @@ import numpy as np -from anysolver._ge_beam3_p5_seeded.core import sha +from anyfesolver._ge_beam3_p5_seeded.core import sha from .friction_point import initial_friction_point from .native_retained_station import _readonly from .native_surface_quadrature import NativeRoundSurfaceRule diff --git a/src/anysolver/general_contact/native_surface_path.py b/src/anyfesolver/general_contact/native_surface_path.py similarity index 99% rename from src/anysolver/general_contact/native_surface_path.py rename to src/anyfesolver/general_contact/native_surface_path.py index a632ad432..bfb0e620d 100644 --- a/src/anysolver/general_contact/native_surface_path.py +++ b/src/anyfesolver/general_contact/native_surface_path.py @@ -9,9 +9,9 @@ import numpy as np -from anysolver._ge_beam3_p5.compensated_coordinates import advance -from anysolver._ge_beam3_p5.algebra import rotation -from anysolver._ge_beam3_p5_seeded.core import sha +from anyfesolver._ge_beam3_p5.compensated_coordinates import advance +from anyfesolver._ge_beam3_p5.algebra import rotation +from anyfesolver._ge_beam3_p5_seeded.core import sha from .native_surface_s3_friction import NativeS3MaterialConfiguration diff --git a/src/anysolver/general_contact/native_surface_quadrature.py b/src/anyfesolver/general_contact/native_surface_quadrature.py similarity index 98% rename from src/anysolver/general_contact/native_surface_quadrature.py rename to src/anyfesolver/general_contact/native_surface_quadrature.py index 571197de2..376ddd05b 100644 --- a/src/anysolver/general_contact/native_surface_quadrature.py +++ b/src/anyfesolver/general_contact/native_surface_quadrature.py @@ -9,8 +9,8 @@ import numpy as np from numpy.polynomial.legendre import leggauss -from anysolver._ge_beam3_deterministic_reduction import deterministic_dot, deterministic_norm -from anysolver._ge_beam3_p5_seeded.core import sha +from anyfesolver._ge_beam3_deterministic_reduction import deterministic_dot, deterministic_norm +from anyfesolver._ge_beam3_p5_seeded.core import sha from .native_retained_station import NativeRetainedRoundStation, _readonly diff --git a/src/anysolver/general_contact/native_surface_s3_friction.py b/src/anyfesolver/general_contact/native_surface_s3_friction.py similarity index 98% rename from src/anysolver/general_contact/native_surface_s3_friction.py rename to src/anyfesolver/general_contact/native_surface_s3_friction.py index a2b4364ed..e13e05e91 100644 --- a/src/anysolver/general_contact/native_surface_s3_friction.py +++ b/src/anyfesolver/general_contact/native_surface_s3_friction.py @@ -15,10 +15,10 @@ import numpy as np -from anysolver._ge_beam3_mixed_ad import Jet2, so3_exp, matvec, dot, sqrt -from anysolver._ge_beam3_p5.arrays import _array, _frames -from anysolver._ge_beam3_generalized_static_boundary import spatial_jacobian -from anysolver._ge_beam3_p5_seeded.core import sha +from anyfesolver._ge_beam3_mixed_ad import Jet2, so3_exp, matvec, dot, sqrt +from anyfesolver._ge_beam3_p5.arrays import _array, _frames +from anyfesolver._ge_beam3_generalized_static_boundary import spatial_jacobian +from anyfesolver._ge_beam3_p5_seeded.core import sha from .native_retained_station import NativeRetainedRoundStation, _readonly from .s3_friction_point import S3SkinMaterialPoint from .friction_point import ( diff --git a/src/anysolver/general_contact/native_surface_support.py b/src/anyfesolver/general_contact/native_surface_support.py similarity index 99% rename from src/anysolver/general_contact/native_surface_support.py rename to src/anyfesolver/general_contact/native_surface_support.py index 5b99bd319..72f7c8bc7 100644 --- a/src/anysolver/general_contact/native_surface_support.py +++ b/src/anyfesolver/general_contact/native_surface_support.py @@ -11,7 +11,7 @@ import numpy as np -from anysolver._ge_beam3_p5_seeded.core import sha +from anyfesolver._ge_beam3_p5_seeded.core import sha from .native_surface_history import NativeSurfaceHistoryField from .native_surface_path import material_path_pose diff --git a/src/anysolver/general_contact/native_surface_transaction.py b/src/anyfesolver/general_contact/native_surface_transaction.py similarity index 98% rename from src/anysolver/general_contact/native_surface_transaction.py rename to src/anyfesolver/general_contact/native_surface_transaction.py index 89e14b63b..bd205cb49 100644 --- a/src/anysolver/general_contact/native_surface_transaction.py +++ b/src/anyfesolver/general_contact/native_surface_transaction.py @@ -8,9 +8,9 @@ import numpy as np -from anysolver._ge_beam3_p5_seeded.core import canonical, sha -from anysolver._ge_beam3_p5_seeded.codec import MAX_BYTES, _load -from anysolver.control import cancellation_safe_point +from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha +from anyfesolver._ge_beam3_p5_seeded.codec import MAX_BYTES, _load +from anyfesolver.control import cancellation_safe_point from .friction_point import initial_friction_point from .native_retained_station import _readonly from .native_surface_contributor import NativeS3MaterialContributor diff --git a/src/anysolver/general_contact/native_transient_multi_shell.py b/src/anyfesolver/general_contact/native_transient_multi_shell.py similarity index 95% rename from src/anysolver/general_contact/native_transient_multi_shell.py rename to src/anyfesolver/general_contact/native_transient_multi_shell.py index 7a6f326a9..e2d0b4257 100644 --- a/src/anysolver/general_contact/native_transient_multi_shell.py +++ b/src/anyfesolver/general_contact/native_transient_multi_shell.py @@ -2,11 +2,11 @@ from dataclasses import dataclass from math import nextafter, inf, sqrt import json -from anysolver._ge_beam3_connected_dynamic import MAX_COORDINATES +from anyfesolver._ge_beam3_connected_dynamic import MAX_COORDINATES import numpy as np -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver.fe_core import FEModel -from anysolver._ge_beam3_native_multi_shell_contact import NativeMultiShellContactAnalysis +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver.fe_core import FEModel +from anyfesolver._ge_beam3_native_multi_shell_contact import NativeMultiShellContactAnalysis from .native_retained_line_s3 import NativeRetainedRoundLineS3Interior from .native_retained_line_s3_work import NativeRetainedLineS3Work from .s3_skin_work import S3SkinWorkAdapter @@ -103,6 +103,6 @@ def create_native_transient_multi_shell_analysis(formulation,native_bodies,shell def solve_native_transient_multi_shell(analysis,config,*,checkpoint=None,expected_sha256=None, max_steps=10000,max_cutbacks=8,minimum_dt=None,cancellation_token=None): if type(analysis) is not NativeMultiShellContactAnalysis:raise TypeError('exact global native/S3 development owner required') - from anysolver._ge_beam3_connected_trajectory import _solve_retained_transient + from anyfesolver._ge_beam3_connected_trajectory import _solve_retained_transient return _solve_retained_transient(analysis,config,checkpoint=checkpoint,expected_sha256=expected_sha256, max_steps=max_steps,max_cutbacks=max_cutbacks,minimum_dt=minimum_dt,cancellation_token=cancellation_token) diff --git a/src/anysolver/general_contact/native_transient_pair.py b/src/anyfesolver/general_contact/native_transient_pair.py similarity index 94% rename from src/anysolver/general_contact/native_transient_pair.py rename to src/anyfesolver/general_contact/native_transient_pair.py index a8c51d4a0..eb6cd9818 100644 --- a/src/anysolver/general_contact/native_transient_pair.py +++ b/src/anyfesolver/general_contact/native_transient_pair.py @@ -2,10 +2,10 @@ Exact selector only; not a generic FEModel admission or engineering acceptance. """ -from anysolver._ge_beam3_native_pair_contact import ( +from anyfesolver._ge_beam3_native_pair_contact import ( NativePairContactAnalysis, PROFILE, ENDPOINT_POLICY, ) -from anysolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition from .native_retained_whole_pair import NativeRetainedWholeCurvePair SELECTOR = 'ge_beam3_native_whole_round_pair_transient_dev' @@ -54,7 +54,7 @@ def solve_native_transient_pair(analysis, config, *, checkpoint=None, """One TransientConfig controller and one uncondensed retained midpoint solve.""" if type(analysis) is not NativePairContactAnalysis: raise TypeError('exact native pair transient development owner required') - from anysolver._ge_beam3_connected_trajectory import _solve_retained_transient + from anyfesolver._ge_beam3_connected_trajectory import _solve_retained_transient return _solve_retained_transient(analysis, config, checkpoint=checkpoint, expected_sha256=expected_sha256, max_steps=max_steps, max_cutbacks=max_cutbacks, minimum_dt=minimum_dt, diff --git a/src/anysolver/general_contact/native_transient_shell.py b/src/anyfesolver/general_contact/native_transient_shell.py similarity index 92% rename from src/anysolver/general_contact/native_transient_shell.py rename to src/anyfesolver/general_contact/native_transient_shell.py index 9c3701585..6d651a7c6 100644 --- a/src/anysolver/general_contact/native_transient_shell.py +++ b/src/anyfesolver/general_contact/native_transient_shell.py @@ -1,6 +1,6 @@ """Explicit development factory for one native beam plus one S3 descriptor.""" -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_native_shell_contact import NativeShellContactAnalysis +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_native_shell_contact import NativeShellContactAnalysis from .native_retained_line_s3 import NativeRetainedRoundLineS3Interior from .native_retained_line_s3_work import NativeRetainedLineS3Work from .s3_skin_work import S3SkinWorkAdapter @@ -39,6 +39,6 @@ def create_native_transient_shell_analysis(formulation,definitions,boundaries,sh def solve_native_transient_shell(analysis,config,*,checkpoint=None,expected_sha256=None, max_steps=10000,max_cutbacks=8,minimum_dt=None,cancellation_token=None): if type(analysis) is not NativeShellContactAnalysis:raise TypeError('exact native/S3 development owner required') - from anysolver._ge_beam3_connected_trajectory import _solve_retained_transient + from anyfesolver._ge_beam3_connected_trajectory import _solve_retained_transient return _solve_retained_transient(analysis,config,checkpoint=checkpoint,expected_sha256=expected_sha256, max_steps=max_steps,max_cutbacks=max_cutbacks,minimum_dt=minimum_dt,cancellation_token=cancellation_token) diff --git a/src/anysolver/general_contact/normal_s3_skin_path.py b/src/anyfesolver/general_contact/normal_s3_skin_path.py similarity index 100% rename from src/anysolver/general_contact/normal_s3_skin_path.py rename to src/anyfesolver/general_contact/normal_s3_skin_path.py diff --git a/src/anysolver/general_contact/overlap.py b/src/anyfesolver/general_contact/overlap.py similarity index 98% rename from src/anysolver/general_contact/overlap.py rename to src/anyfesolver/general_contact/overlap.py index cd5d32563..d2861902d 100644 --- a/src/anysolver/general_contact/overlap.py +++ b/src/anyfesolver/general_contact/overlap.py @@ -379,8 +379,8 @@ def reference_shell_face(model: object, body_id: int, element_id: int, midsurface. The formulation owns that offset and its director polarity. """ - from anysolver.e4_pl_element import FORMULATION_ID as q4_id - from anysolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id + from anyfesolver.e4_pl_element import FORMULATION_ID as q4_id + from anyfesolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id coordinate = {"bottom": -1.0, "midsurface": 0.0, "top": 1.0}.get(side) if coordinate is None: @@ -416,7 +416,7 @@ def current_planar_shell_face(model: object, body_id: int, element_id: int, separate varying-frame contact route is admitted. """ - from anysolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id + from anyfesolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id reference_face = reference_shell_face(model, body_id, element_id, side) element = model.mesh.elements[element_id] diff --git a/src/anysolver/general_contact/pair.py b/src/anyfesolver/general_contact/pair.py similarity index 98% rename from src/anysolver/general_contact/pair.py rename to src/anyfesolver/general_contact/pair.py index fcfd8d736..220308956 100644 --- a/src/anysolver/general_contact/pair.py +++ b/src/anyfesolver/general_contact/pair.py @@ -64,8 +64,8 @@ def _definition_parts(model, definition: ContactDefinition): return issues, None integration = surfaces[interaction.surface] target = surfaces[interaction.target] - from anysolver.e4_pl_element import FORMULATION_ID as q4_id - from anysolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id + from anyfesolver.e4_pl_element import FORMULATION_ID as q4_id + from anyfesolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id for surface in (integration, target): for element_id in surface.element_ids: @@ -169,7 +169,7 @@ def validate_planar_shell_pair(model, definition: ContactDefinition, *, def _profile_for_pair(model, definition: ContactDefinition) -> str: - from anysolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id + from anyfesolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id if any(getattr(model.mesh.elements.get(element_id), "formulation_id", None) == s3_id for surface in definition.surfaces for element_id in surface.element_ids): @@ -214,7 +214,7 @@ def __init__(self, model, definition: ContactDefinition, for element_id in target.element_ids] self.normal = _reference_pair_normal(model, integration, self.faces_a, self.faces_b) self.face_gradients = {} - from anysolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id + from anyfesolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id for face, side in ( *((face, integration.side) for face in self.faces_a), diff --git a/src/anysolver/general_contact/patch_broadphase.py b/src/anyfesolver/general_contact/patch_broadphase.py similarity index 100% rename from src/anysolver/general_contact/patch_broadphase.py rename to src/anyfesolver/general_contact/patch_broadphase.py diff --git a/src/anysolver/general_contact/patch_mortar.py b/src/anyfesolver/general_contact/patch_mortar.py similarity index 100% rename from src/anysolver/general_contact/patch_mortar.py rename to src/anyfesolver/general_contact/patch_mortar.py diff --git a/src/anysolver/general_contact/patch_sliding.py b/src/anyfesolver/general_contact/patch_sliding.py similarity index 99% rename from src/anysolver/general_contact/patch_sliding.py rename to src/anyfesolver/general_contact/patch_sliding.py index 6537c823e..bfd5a383d 100644 --- a/src/anysolver/general_contact/patch_sliding.py +++ b/src/anyfesolver/general_contact/patch_sliding.py @@ -221,7 +221,7 @@ def __init__(self, model, definition: ContactDefinition, ))) for face in (*source_faces, *target_faces)) self.motion_tolerance = 256.0 * np.finfo(float).eps * scale surface_levers: dict[tuple[int, int], np.ndarray] = {} - from anysolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id + from anyfesolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id for body, (surface, faces) in enumerate(zip( (integration, target), (source_faces, target_faces) diff --git a/src/anysolver/general_contact/plane_newmark_events.py b/src/anyfesolver/general_contact/plane_newmark_events.py similarity index 100% rename from src/anysolver/general_contact/plane_newmark_events.py rename to src/anyfesolver/general_contact/plane_newmark_events.py diff --git a/src/anysolver/general_contact/pointwise_patch.py b/src/anyfesolver/general_contact/pointwise_patch.py similarity index 100% rename from src/anysolver/general_contact/pointwise_patch.py rename to src/anyfesolver/general_contact/pointwise_patch.py diff --git a/src/anysolver/general_contact/polynomial_roots.py b/src/anyfesolver/general_contact/polynomial_roots.py similarity index 100% rename from src/anysolver/general_contact/polynomial_roots.py rename to src/anyfesolver/general_contact/polynomial_roots.py diff --git a/src/anysolver/general_contact/pressure_basis.py b/src/anyfesolver/general_contact/pressure_basis.py similarity index 100% rename from src/anysolver/general_contact/pressure_basis.py rename to src/anyfesolver/general_contact/pressure_basis.py diff --git a/src/anysolver/general_contact/pressure_diagnostics.py b/src/anyfesolver/general_contact/pressure_diagnostics.py similarity index 98% rename from src/anysolver/general_contact/pressure_diagnostics.py rename to src/anyfesolver/general_contact/pressure_diagnostics.py index dd808de2c..4aaa6289e 100644 --- a/src/anysolver/general_contact/pressure_diagnostics.py +++ b/src/anyfesolver/general_contact/pressure_diagnostics.py @@ -100,7 +100,7 @@ def finite_pressure_pose(model, manager, displacement, nodal_forces, free_dofs, the owner's validated local coordinate interpretation; an empty mapping means elastic-origin re-evaluation, never a history reconstruction. """ - from anysolver.nonlinear_static import _assemble_nonlinear_system, _discard_nonlinear_state_candidate + from anyfesolver.nonlinear_static import _assemble_nonlinear_system, _discard_nonlinear_state_candidate from .core import suspend_contact from .s3_patch_static import FINITE_Q4_Q4_MONOLITHIC_PROFILE from .semismooth import linearize, complementarity, reference_nodal_support diff --git a/src/anysolver/general_contact/pressure_overlay.py b/src/anyfesolver/general_contact/pressure_overlay.py similarity index 100% rename from src/anysolver/general_contact/pressure_overlay.py rename to src/anyfesolver/general_contact/pressure_overlay.py diff --git a/src/anysolver/general_contact/pressure_space.py b/src/anyfesolver/general_contact/pressure_space.py similarity index 100% rename from src/anysolver/general_contact/pressure_space.py rename to src/anyfesolver/general_contact/pressure_space.py diff --git a/src/anysolver/general_contact/q4_material_checkpoint.py b/src/anyfesolver/general_contact/q4_material_checkpoint.py similarity index 98% rename from src/anysolver/general_contact/q4_material_checkpoint.py rename to src/anyfesolver/general_contact/q4_material_checkpoint.py index 43656b81e..078dc7adf 100644 --- a/src/anysolver/general_contact/q4_material_checkpoint.py +++ b/src/anyfesolver/general_contact/q4_material_checkpoint.py @@ -13,11 +13,11 @@ import numpy as np -from anysolver.current_state_tangent import ( +from anyfesolver.current_state_tangent import ( require_exact_qualified_component_lifecycle_api as _LIFECYCLE_GUARD, ) -from anysolver.e4_pl_element import QualifiedE4PLShellElement -from anysolver.nonlinear_restart import ( +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement +from anyfesolver.nonlinear_restart import ( analysis_configuration_fingerprint, canonical_checkpoint_json_bytes, model_configuration_fingerprint, diff --git a/src/anysolver/general_contact/q4_overlap_local_bound.py b/src/anyfesolver/general_contact/q4_overlap_local_bound.py similarity index 100% rename from src/anysolver/general_contact/q4_overlap_local_bound.py rename to src/anyfesolver/general_contact/q4_overlap_local_bound.py diff --git a/src/anysolver/general_contact/q4_q4_overlap_derivatives.py b/src/anyfesolver/general_contact/q4_q4_overlap_derivatives.py similarity index 99% rename from src/anysolver/general_contact/q4_q4_overlap_derivatives.py rename to src/anyfesolver/general_contact/q4_q4_overlap_derivatives.py index 102935aaa..db7d6258d 100644 --- a/src/anysolver/general_contact/q4_q4_overlap_derivatives.py +++ b/src/anyfesolver/general_contact/q4_q4_overlap_derivatives.py @@ -6,7 +6,7 @@ """ from dataclasses import dataclass import numpy as np -from anysolver._ge_beam3_mixed_ad import Jet2,sqrt +from anyfesolver._ge_beam3_mixed_ad import Jet2,sqrt from .moving import _TRIANGLE_RULE from .overlap import PlanarFace from .q4_s3_overlap_derivatives import UnsupportedQ4S3Branch,_clip,_area_resolution,_parts diff --git a/src/anysolver/general_contact/q4_q4_swept_bound.py b/src/anyfesolver/general_contact/q4_q4_swept_bound.py similarity index 100% rename from src/anysolver/general_contact/q4_q4_swept_bound.py rename to src/anyfesolver/general_contact/q4_q4_swept_bound.py diff --git a/src/anysolver/general_contact/q4_s3_overlap_derivatives.py b/src/anyfesolver/general_contact/q4_s3_overlap_derivatives.py similarity index 99% rename from src/anysolver/general_contact/q4_s3_overlap_derivatives.py rename to src/anyfesolver/general_contact/q4_s3_overlap_derivatives.py index a2d47f622..c2bc2fab1 100644 --- a/src/anysolver/general_contact/q4_s3_overlap_derivatives.py +++ b/src/anyfesolver/general_contact/q4_s3_overlap_derivatives.py @@ -13,7 +13,7 @@ import numpy as np -from anysolver._ge_beam3_mixed_ad import Jet2, sqrt +from anyfesolver._ge_beam3_mixed_ad import Jet2, sqrt from .moving import _TRIANGLE_RULE @@ -112,7 +112,7 @@ def _enable_compiled_bjet_mul(): global _COMPILED_BJET_MUL_ENABLED, _COMPILED_BJET_MUL_INITIALIZED global _compiled_bjet_mul if not _COMPILED_BJET_MUL_INITIALIZED: - from anysolver.jit_compiler import JIT_ENABLED, njit + from anyfesolver.jit_compiler import JIT_ENABLED, njit if JIT_ENABLED: _compiled_bjet_mul = njit(cache=True)(_compiled_bjet_mul) diff --git a/src/anysolver/general_contact/q4_s3_tiny_wedge.py b/src/anyfesolver/general_contact/q4_s3_tiny_wedge.py similarity index 100% rename from src/anysolver/general_contact/q4_s3_tiny_wedge.py rename to src/anyfesolver/general_contact/q4_s3_tiny_wedge.py diff --git a/src/anysolver/general_contact/q4_skin_work.py b/src/anyfesolver/general_contact/q4_skin_work.py similarity index 98% rename from src/anysolver/general_contact/q4_skin_work.py rename to src/anyfesolver/general_contact/q4_skin_work.py index 2566ca3f5..47a1685b5 100644 --- a/src/anysolver/general_contact/q4_skin_work.py +++ b/src/anyfesolver/general_contact/q4_skin_work.py @@ -24,7 +24,7 @@ class Q4SkinWorkAdapter: @classmethod def from_model(cls, model, body_id: int, element_id: int, side: str) -> Q4SkinWorkAdapter: - from anysolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement element = model.mesh.elements.get(element_id) if type(element) is not QualifiedE4PLShellElement: diff --git a/src/anysolver/general_contact/q4_source_mortar_energy.py b/src/anyfesolver/general_contact/q4_source_mortar_energy.py similarity index 100% rename from src/anysolver/general_contact/q4_source_mortar_energy.py rename to src/anyfesolver/general_contact/q4_source_mortar_energy.py diff --git a/src/anysolver/general_contact/q4_source_overlap.py b/src/anyfesolver/general_contact/q4_source_overlap.py similarity index 100% rename from src/anysolver/general_contact/q4_source_overlap.py rename to src/anyfesolver/general_contact/q4_source_overlap.py diff --git a/src/anysolver/general_contact/q4_target_overlap.py b/src/anyfesolver/general_contact/q4_target_overlap.py similarity index 100% rename from src/anysolver/general_contact/q4_target_overlap.py rename to src/anyfesolver/general_contact/q4_target_overlap.py diff --git a/src/anysolver/general_contact/request_identity.py b/src/anyfesolver/general_contact/request_identity.py similarity index 98% rename from src/anysolver/general_contact/request_identity.py rename to src/anyfesolver/general_contact/request_identity.py index 2a88c41b8..fa03f0a8b 100644 --- a/src/anysolver/general_contact/request_identity.py +++ b/src/anyfesolver/general_contact/request_identity.py @@ -38,10 +38,10 @@ def __init__(self, code: str, message: str): def _package_manifest(): root = Path(__file__).resolve().parents[1] for name, module in tuple(sys.modules.items()): - if name == "anysolver" or name.startswith("anysolver."): + if name == "anyfesolver" or name.startswith("anyfesolver."): filename = vars(module).get("__file__") if module is not None else None if filename and not Path(filename).resolve().is_relative_to(root): - raise ContactRequestIdentityError("mixed_source", "loaded ANYsolver modules use different package roots") + raise ContactRequestIdentityError("mixed_source", "loaded ANYfeSolver modules use different package roots") files = {} for path in sorted(root.rglob("*")): if path.is_file() and path.suffix.lower() in {".py", ".pyd", ".so", ".dll"}: @@ -49,7 +49,7 @@ def _package_manifest(): raise ContactRequestIdentityError("mixed_source", "package file resolves outside its source root") files[path.relative_to(root).as_posix()] = hashlib.sha256(path.read_bytes()).hexdigest() if "__init__.py" not in files: - raise ContactRequestIdentityError("source_unavailable", "complete file-backed ANYsolver package required") + raise ContactRequestIdentityError("source_unavailable", "complete file-backed ANYfeSolver package required") return files diff --git a/src/anysolver/general_contact/rigid_translation.py b/src/anyfesolver/general_contact/rigid_translation.py similarity index 100% rename from src/anysolver/general_contact/rigid_translation.py rename to src/anyfesolver/general_contact/rigid_translation.py diff --git a/src/anysolver/general_contact/runtime.py b/src/anyfesolver/general_contact/runtime.py similarity index 92% rename from src/anysolver/general_contact/runtime.py rename to src/anyfesolver/general_contact/runtime.py index 63c57cbcd..e69455091 100644 --- a/src/anysolver/general_contact/runtime.py +++ b/src/anyfesolver/general_contact/runtime.py @@ -8,7 +8,7 @@ _ACTIVE_CONTACT: ContextVar[object | None] = ContextVar( - "anysolver_general_contact", default=None, + "anyfesolver_general_contact", default=None, ) diff --git a/src/anysolver/general_contact/s3_friction_chart_interval.py b/src/anyfesolver/general_contact/s3_friction_chart_interval.py similarity index 100% rename from src/anysolver/general_contact/s3_friction_chart_interval.py rename to src/anyfesolver/general_contact/s3_friction_chart_interval.py diff --git a/src/anysolver/general_contact/s3_friction_coverage.py b/src/anyfesolver/general_contact/s3_friction_coverage.py similarity index 100% rename from src/anysolver/general_contact/s3_friction_coverage.py rename to src/anyfesolver/general_contact/s3_friction_coverage.py diff --git a/src/anysolver/general_contact/s3_friction_dyadic_interval.py b/src/anyfesolver/general_contact/s3_friction_dyadic_interval.py similarity index 100% rename from src/anysolver/general_contact/s3_friction_dyadic_interval.py rename to src/anyfesolver/general_contact/s3_friction_dyadic_interval.py diff --git a/src/anysolver/general_contact/s3_friction_history_path.py b/src/anyfesolver/general_contact/s3_friction_history_path.py similarity index 100% rename from src/anysolver/general_contact/s3_friction_history_path.py rename to src/anyfesolver/general_contact/s3_friction_history_path.py diff --git a/src/anysolver/general_contact/s3_friction_mesh_coverage.py b/src/anyfesolver/general_contact/s3_friction_mesh_coverage.py similarity index 100% rename from src/anysolver/general_contact/s3_friction_mesh_coverage.py rename to src/anyfesolver/general_contact/s3_friction_mesh_coverage.py diff --git a/src/anysolver/general_contact/s3_friction_mesh_gap.py b/src/anyfesolver/general_contact/s3_friction_mesh_gap.py similarity index 100% rename from src/anysolver/general_contact/s3_friction_mesh_gap.py rename to src/anyfesolver/general_contact/s3_friction_mesh_gap.py diff --git a/src/anysolver/general_contact/s3_friction_mesh_monolithic.py b/src/anyfesolver/general_contact/s3_friction_mesh_monolithic.py similarity index 100% rename from src/anysolver/general_contact/s3_friction_mesh_monolithic.py rename to src/anyfesolver/general_contact/s3_friction_mesh_monolithic.py diff --git a/src/anysolver/general_contact/s3_friction_monolithic.py b/src/anyfesolver/general_contact/s3_friction_monolithic.py similarity index 100% rename from src/anysolver/general_contact/s3_friction_monolithic.py rename to src/anyfesolver/general_contact/s3_friction_monolithic.py diff --git a/src/anysolver/general_contact/s3_friction_moving_coverage.py b/src/anyfesolver/general_contact/s3_friction_moving_coverage.py similarity index 100% rename from src/anysolver/general_contact/s3_friction_moving_coverage.py rename to src/anyfesolver/general_contact/s3_friction_moving_coverage.py diff --git a/src/anysolver/general_contact/s3_friction_pair.py b/src/anyfesolver/general_contact/s3_friction_pair.py similarity index 100% rename from src/anysolver/general_contact/s3_friction_pair.py rename to src/anyfesolver/general_contact/s3_friction_pair.py diff --git a/src/anysolver/general_contact/s3_friction_point.py b/src/anyfesolver/general_contact/s3_friction_point.py similarity index 100% rename from src/anysolver/general_contact/s3_friction_point.py rename to src/anyfesolver/general_contact/s3_friction_point.py diff --git a/src/anysolver/general_contact/s3_friction_prepared_path.py b/src/anyfesolver/general_contact/s3_friction_prepared_path.py similarity index 100% rename from src/anysolver/general_contact/s3_friction_prepared_path.py rename to src/anyfesolver/general_contact/s3_friction_prepared_path.py diff --git a/src/anysolver/general_contact/s3_friction_replay.py b/src/anyfesolver/general_contact/s3_friction_replay.py similarity index 100% rename from src/anysolver/general_contact/s3_friction_replay.py rename to src/anyfesolver/general_contact/s3_friction_replay.py diff --git a/src/anysolver/general_contact/s3_friction_rim_path.py b/src/anyfesolver/general_contact/s3_friction_rim_path.py similarity index 100% rename from src/anysolver/general_contact/s3_friction_rim_path.py rename to src/anyfesolver/general_contact/s3_friction_rim_path.py diff --git a/src/anysolver/general_contact/s3_friction_rim_transaction.py b/src/anyfesolver/general_contact/s3_friction_rim_transaction.py similarity index 100% rename from src/anysolver/general_contact/s3_friction_rim_transaction.py rename to src/anyfesolver/general_contact/s3_friction_rim_transaction.py diff --git a/src/anysolver/general_contact/s3_friction_static.py b/src/anyfesolver/general_contact/s3_friction_static.py similarity index 100% rename from src/anysolver/general_contact/s3_friction_static.py rename to src/anyfesolver/general_contact/s3_friction_static.py diff --git a/src/anysolver/general_contact/s3_friction_swept_gap.py b/src/anyfesolver/general_contact/s3_friction_swept_gap.py similarity index 100% rename from src/anysolver/general_contact/s3_friction_swept_gap.py rename to src/anyfesolver/general_contact/s3_friction_swept_gap.py diff --git a/src/anysolver/general_contact/s3_friction_touch.py b/src/anyfesolver/general_contact/s3_friction_touch.py similarity index 100% rename from src/anysolver/general_contact/s3_friction_touch.py rename to src/anyfesolver/general_contact/s3_friction_touch.py diff --git a/src/anysolver/general_contact/s3_friction_weak_pressure.py b/src/anyfesolver/general_contact/s3_friction_weak_pressure.py similarity index 100% rename from src/anysolver/general_contact/s3_friction_weak_pressure.py rename to src/anyfesolver/general_contact/s3_friction_weak_pressure.py diff --git a/src/anysolver/general_contact/s3_overlap_derivatives.py b/src/anyfesolver/general_contact/s3_overlap_derivatives.py similarity index 99% rename from src/anysolver/general_contact/s3_overlap_derivatives.py rename to src/anyfesolver/general_contact/s3_overlap_derivatives.py index be9071a7d..1e0b3261e 100644 --- a/src/anysolver/general_contact/s3_overlap_derivatives.py +++ b/src/anyfesolver/general_contact/s3_overlap_derivatives.py @@ -12,7 +12,7 @@ import numpy as np -from anysolver._ge_beam3_mixed_ad import Jet2, sqrt +from anyfesolver._ge_beam3_mixed_ad import Jet2, sqrt class UnsupportedOverlapBranch(ValueError): """The positive overlap has no differentiable, unambiguous local branch.""" diff --git a/src/anysolver/general_contact/s3_overlap_hermite_gap.py b/src/anyfesolver/general_contact/s3_overlap_hermite_gap.py similarity index 100% rename from src/anysolver/general_contact/s3_overlap_hermite_gap.py rename to src/anyfesolver/general_contact/s3_overlap_hermite_gap.py diff --git a/src/anysolver/general_contact/s3_pair_static.py b/src/anyfesolver/general_contact/s3_pair_static.py similarity index 99% rename from src/anysolver/general_contact/s3_pair_static.py rename to src/anyfesolver/general_contact/s3_pair_static.py index 258157122..240845298 100644 --- a/src/anysolver/general_contact/s3_pair_static.py +++ b/src/anyfesolver/general_contact/s3_pair_static.py @@ -47,7 +47,7 @@ def validate_general_s3_pair(model, definition: ContactDefinition, or interaction.endpoint_stiffness is not None): issues.append("general S3 pair needs penalty surface-pressure stiffness only") from anymaterial import IsotropicMaterial - from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement + from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement nodes: list[set[int]] = [] for surface in definition.surfaces: diff --git a/src/anysolver/general_contact/s3_patch_augmented.py b/src/anyfesolver/general_contact/s3_patch_augmented.py similarity index 99% rename from src/anysolver/general_contact/s3_patch_augmented.py rename to src/anyfesolver/general_contact/s3_patch_augmented.py index c2e9ecbf6..bd4eb15f0 100644 --- a/src/anysolver/general_contact/s3_patch_augmented.py +++ b/src/anyfesolver/general_contact/s3_patch_augmented.py @@ -96,7 +96,7 @@ def _geometry_preparation_value(value): if is_dataclass(value): return (type(value), tuple((f.name, _geometry_preparation_value( getattr(value, f.name))) for f in fields(value))) - if (type(value).__module__.startswith("anysolver.general_contact.") + if (type(value).__module__.startswith("anyfesolver.general_contact.") and hasattr(value, "__dict__")): return (type(value), id(value), _geometry_preparation_value(vars(value))) raise TypeError("unsupported geometry configuration is not cacheable") diff --git a/src/anysolver/general_contact/s3_patch_mortar_energy.py b/src/anyfesolver/general_contact/s3_patch_mortar_energy.py similarity index 100% rename from src/anysolver/general_contact/s3_patch_mortar_energy.py rename to src/anyfesolver/general_contact/s3_patch_mortar_energy.py diff --git a/src/anysolver/general_contact/s3_patch_static.py b/src/anyfesolver/general_contact/s3_patch_static.py similarity index 99% rename from src/anysolver/general_contact/s3_patch_static.py rename to src/anyfesolver/general_contact/s3_patch_static.py index 01ea37cd7..4ef817acf 100644 --- a/src/anysolver/general_contact/s3_patch_static.py +++ b/src/anyfesolver/general_contact/s3_patch_static.py @@ -124,7 +124,7 @@ def _physical_side_adapter(adapter, role): def _adapters(model, selected, *, orientation="legacy"): - from anysolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement from .q4_skin_work import Q4SkinWorkAdapter adapters = tuple(tuple( @@ -177,8 +177,8 @@ def _validate_general_s3_patch(model, definition, settings, *, prepared=None): # A manager may consume this preparation immediately in the same call. # There is no model/global cache or reuse across poses or definitions. issues: list[str] = [] - from anysolver.e4_pl_element import QualifiedE4PLShellElement - from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement profile = PROFILE if (len(definition.surfaces) != 2 or definition.rigid_bodies @@ -693,7 +693,7 @@ def __init__(self, model, definition: ContactDefinition, self.last_finite_deformation_maxima = (0., 0., 0.) if self.settings.shell_skin_kinematics != "reference_linear": from .finite_rotation_skin import FiniteQ4SkinMap - from anysolver.corotational import _corotational_cache + from anyfesolver.corotational import _corotational_cache self.finite_skin = FiniteQ4SkinMap( model, adapters[0]+adapters[1], self.law.source_node_ids+self.law.target_node_ids) @@ -743,7 +743,7 @@ def require_finite_deformation(self, displacement): """ if self.finite_skin is None: return - from anysolver.corotational import _corotational_deformation_state + from anyfesolver.corotational import _corotational_deformation_state u = np.asarray(displacement, float) maxima = np.zeros(3) for element, reference, dofs, length in self.finite_elements: diff --git a/src/anysolver/general_contact/s3_pressure_hermite_bounds.py b/src/anyfesolver/general_contact/s3_pressure_hermite_bounds.py similarity index 100% rename from src/anysolver/general_contact/s3_pressure_hermite_bounds.py rename to src/anyfesolver/general_contact/s3_pressure_hermite_bounds.py diff --git a/src/anysolver/general_contact/s3_pressure_polygon_bounds.py b/src/anyfesolver/general_contact/s3_pressure_polygon_bounds.py similarity index 100% rename from src/anysolver/general_contact/s3_pressure_polygon_bounds.py rename to src/anyfesolver/general_contact/s3_pressure_polygon_bounds.py diff --git a/src/anysolver/general_contact/s3_q4_gap_resolution.py b/src/anyfesolver/general_contact/s3_q4_gap_resolution.py similarity index 100% rename from src/anysolver/general_contact/s3_q4_gap_resolution.py rename to src/anyfesolver/general_contact/s3_q4_gap_resolution.py diff --git a/src/anysolver/general_contact/s3_q4_overlap_derivatives.py b/src/anyfesolver/general_contact/s3_q4_overlap_derivatives.py similarity index 99% rename from src/anysolver/general_contact/s3_q4_overlap_derivatives.py rename to src/anyfesolver/general_contact/s3_q4_overlap_derivatives.py index def154881..2b3939a2c 100644 --- a/src/anysolver/general_contact/s3_q4_overlap_derivatives.py +++ b/src/anyfesolver/general_contact/s3_q4_overlap_derivatives.py @@ -9,7 +9,7 @@ import numpy as np -from anysolver._ge_beam3_mixed_ad import Jet2, sqrt +from anyfesolver._ge_beam3_mixed_ad import Jet2, sqrt from .moving import _TRIANGLE_RULE from .q4_s3_overlap_derivatives import ( UnsupportedQ4S3Branch, _area_resolution, _clip, _cross, _cross2, _dot, _natural, diff --git a/src/anysolver/general_contact/s3_q4_swept.py b/src/anyfesolver/general_contact/s3_q4_swept.py similarity index 100% rename from src/anysolver/general_contact/s3_q4_swept.py rename to src/anyfesolver/general_contact/s3_q4_swept.py diff --git a/src/anysolver/general_contact/s3_skin_work.py b/src/anyfesolver/general_contact/s3_skin_work.py similarity index 98% rename from src/anysolver/general_contact/s3_skin_work.py rename to src/anyfesolver/general_contact/s3_skin_work.py index 71827b16e..3e6d8efe7 100644 --- a/src/anysolver/general_contact/s3_skin_work.py +++ b/src/anyfesolver/general_contact/s3_skin_work.py @@ -24,7 +24,7 @@ class S3SkinWorkAdapter: @classmethod def from_model(cls, model, body_id: int, element_id: int, side: str) -> S3SkinWorkAdapter: - from anysolver.e4_pl_s3_v2d_element import ( + from anyfesolver.e4_pl_s3_v2d_element import ( NativeParityE4PLS3V2DShellElement, ) diff --git a/src/anysolver/general_contact/s3_sliding_friction.py b/src/anyfesolver/general_contact/s3_sliding_friction.py similarity index 100% rename from src/anysolver/general_contact/s3_sliding_friction.py rename to src/anyfesolver/general_contact/s3_sliding_friction.py diff --git a/src/anysolver/general_contact/s3_stable_plane_gap.py b/src/anyfesolver/general_contact/s3_stable_plane_gap.py similarity index 95% rename from src/anysolver/general_contact/s3_stable_plane_gap.py rename to src/anyfesolver/general_contact/s3_stable_plane_gap.py index fd983e883..848f720cc 100644 --- a/src/anysolver/general_contact/s3_stable_plane_gap.py +++ b/src/anyfesolver/general_contact/s3_stable_plane_gap.py @@ -7,7 +7,7 @@ adjusted. Ordinary overlap/chart admission remains the caller's responsibility. """ from fractions import Fraction -from anysolver._ge_beam3_mixed_ad import Jet2 +from anyfesolver._ge_beam3_mixed_ad import Jet2 def _sub(a,b):return [x-y for x,y in zip(a,b)] def _dot(a,b):return sum((x*y for x,y in zip(a,b))) @@ -21,7 +21,7 @@ def stable_corner_gap_jets(source_jets,target_jets,source,target): analytic derivatives remain Jet2 arrays; subsequent division/product uses these stable primals consistently for gradient and Hessian coefficients. """ - from anysolver._ge_beam3_mixed_ad import sqrt as jet_sqrt + from anyfesolver._ge_beam3_mixed_ad import sqrt as jet_sqrt s=[[Fraction(float(v)) for v in row] for row in source] t=[[Fraction(float(v)) for v in row] for row in target] ns=_cross(_sub(s[1],s[0]),_sub(s[2],s[0])) diff --git a/src/anysolver/general_contact/seed_path_vertex_interval.py b/src/anyfesolver/general_contact/seed_path_vertex_interval.py similarity index 100% rename from src/anysolver/general_contact/seed_path_vertex_interval.py rename to src/anyfesolver/general_contact/seed_path_vertex_interval.py diff --git a/src/anysolver/general_contact/semismooth.py b/src/anyfesolver/general_contact/semismooth.py similarity index 100% rename from src/anysolver/general_contact/semismooth.py rename to src/anyfesolver/general_contact/semismooth.py diff --git a/src/anysolver/general_contact/semismooth_block.py b/src/anyfesolver/general_contact/semismooth_block.py similarity index 99% rename from src/anysolver/general_contact/semismooth_block.py rename to src/anyfesolver/general_contact/semismooth_block.py index c9b913aac..d95a93ac7 100644 --- a/src/anysolver/general_contact/semismooth_block.py +++ b/src/anyfesolver/general_contact/semismooth_block.py @@ -12,7 +12,7 @@ import numpy as np from scipy import sparse -from anysolver.linalg import MatrixClass, factorize +from anyfesolver.linalg import MatrixClass, factorize @dataclass(frozen=True) diff --git a/src/anysolver/general_contact/semismooth_path.py b/src/anyfesolver/general_contact/semismooth_path.py similarity index 99% rename from src/anysolver/general_contact/semismooth_path.py rename to src/anyfesolver/general_contact/semismooth_path.py index 2720f67b3..2003758a1 100644 --- a/src/anysolver/general_contact/semismooth_path.py +++ b/src/anyfesolver/general_contact/semismooth_path.py @@ -7,10 +7,10 @@ import numpy as np from scipy import sparse -from anysolver.control import cancellation_safe_point -from anysolver.linalg import MatrixClass, factorize -from anysolver.nonlinear_static import _assemble_nonlinear_system -from anysolver.nonlinear_static import _discard_nonlinear_state_candidate +from anyfesolver.control import cancellation_safe_point +from anyfesolver.linalg import MatrixClass, factorize +from anyfesolver.nonlinear_static import _assemble_nonlinear_system +from anyfesolver.nonlinear_static import _discard_nonlinear_state_candidate from .core import suspend_contact from .initial_contact_seed import propose_linearized_kkt_seed diff --git a/src/anysolver/general_contact/shell_pair_hermite_sweep.py b/src/anyfesolver/general_contact/shell_pair_hermite_sweep.py similarity index 100% rename from src/anysolver/general_contact/shell_pair_hermite_sweep.py rename to src/anyfesolver/general_contact/shell_pair_hermite_sweep.py diff --git a/src/anysolver/general_contact/shell_sphere_temporal_bounds.py b/src/anyfesolver/general_contact/shell_sphere_temporal_bounds.py similarity index 100% rename from src/anysolver/general_contact/shell_sphere_temporal_bounds.py rename to src/anyfesolver/general_contact/shell_sphere_temporal_bounds.py diff --git a/src/anysolver/general_contact/skin_geometry.py b/src/anyfesolver/general_contact/skin_geometry.py similarity index 100% rename from src/anysolver/general_contact/skin_geometry.py rename to src/anyfesolver/general_contact/skin_geometry.py diff --git a/src/anysolver/general_contact/sliding.py b/src/anyfesolver/general_contact/sliding.py similarity index 99% rename from src/anysolver/general_contact/sliding.py rename to src/anyfesolver/general_contact/sliding.py index ecf13af20..6af854d1e 100644 --- a/src/anysolver/general_contact/sliding.py +++ b/src/anyfesolver/general_contact/sliding.py @@ -147,7 +147,7 @@ def __init__(self, model, definition: ContactDefinition, director = np.cross(reference[1] - reference[0], reference[-1] - reference[0]) director /= np.linalg.norm(director) - from anysolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id + from anyfesolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id coordinate = {"bottom": -1.0, "midsurface": 0.0, "top": 1.0}[side] offset = (float(element.material_surface_offset_from_reference(coordinate)) diff --git a/src/anysolver/general_contact/sphere.py b/src/anyfesolver/general_contact/sphere.py similarity index 99% rename from src/anysolver/general_contact/sphere.py rename to src/anyfesolver/general_contact/sphere.py index f23d97125..ba5f573e6 100644 --- a/src/anysolver/general_contact/sphere.py +++ b/src/anyfesolver/general_contact/sphere.py @@ -52,8 +52,8 @@ def _sphere_parts(model, definition: ContactDefinition): issues.append(f"{obstacle} profile currently admits penalty normal law only") if surface.side == "midsurface": issues.append(f"{obstacle} contact requires an explicit top or bottom shell side") - from anysolver.e4_pl_element import FORMULATION_ID as q4_id - from anysolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id + from anyfesolver.e4_pl_element import FORMULATION_ID as q4_id + from anyfesolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id from anymaterial.isotropic import IsotropicMaterial for element in model.mesh.elements.values(): @@ -198,7 +198,7 @@ def _prepare_face(model, surface, element_id: int) -> _SphereFace: reference[-1] - reference[0]) director /= np.linalg.norm(director) director = np.asarray(director, dtype=float) - from anysolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id + from anyfesolver.e4_pl_s3_v2d_element import FORMULATION_ID as s3_id side = 1.0 if surface.side == "top" else -1.0 offset = (float(element.material_surface_offset_from_reference(side)) diff --git a/src/anysolver/general_contact/sphere_temporal_bounds.py b/src/anyfesolver/general_contact/sphere_temporal_bounds.py similarity index 100% rename from src/anysolver/general_contact/sphere_temporal_bounds.py rename to src/anyfesolver/general_contact/sphere_temporal_bounds.py diff --git a/src/anysolver/general_contact/static_path.py b/src/anyfesolver/general_contact/static_path.py similarity index 99% rename from src/anysolver/general_contact/static_path.py rename to src/anyfesolver/general_contact/static_path.py index 013b5d2ee..77858c00b 100644 --- a/src/anysolver/general_contact/static_path.py +++ b/src/anyfesolver/general_contact/static_path.py @@ -14,18 +14,18 @@ import numpy as np from scipy import sparse -from anysolver.assembly import build_constraint_transformation -from anysolver.control import CancellationToken, SolveCancelled, cancellation_safe_point -from anysolver.linalg import MatrixClass, factorize -from anysolver.matrix_assembly import ( +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.control import CancellationToken, SolveCancelled, cancellation_safe_point +from anyfesolver.linalg import MatrixClass, factorize +from anyfesolver.matrix_assembly import ( _run_with_qualified_assembly_runtime_lease, assemble_stiffness_matrix, ) -from anysolver.nonlinear_restart import ( +from anyfesolver.nonlinear_restart import ( create_nonlinear_checkpoint, validate_nonlinear_checkpoint, ) -from anysolver.nonlinear_state import NonlinearStateStore, _run_with_nonlinear_state_cleanup +from anyfesolver.nonlinear_state import NonlinearStateStore, _run_with_nonlinear_state_cleanup def _control_projection_seed(rows, start, target): @@ -65,7 +65,7 @@ def _control_projection_seed(rows, start, target): raise ValueError("control projection predictor could not satisfy controls") return seed -from anysolver.nonlinear_static import ( +from anyfesolver.nonlinear_static import ( NonlinearStaticResult, NonlinearStaticStep, _activate_nonlinear_state_storage, @@ -289,7 +289,7 @@ def contract(self) -> dict[str, object]: def _program_from_dead_nodal_load_case(load_case, num_steps: int) -> ContactPathProgram: """Own a narrow ordinary force load as a zero-control contact path.""" - from anysolver.boundary import LoadCase + from anyfesolver.boundary import LoadCase if type(load_case) is not LoadCase or type(num_steps) is not int or num_steps < 1: raise ValueError("monolithic ordinary force contact needs a LoadCase and positive num_steps") @@ -326,7 +326,7 @@ def _program_from_dead_nodal_load_case(load_case, num_steps: int) -> ContactPath def _program_from_simple_displacement_control(control, num_steps: int) -> ContactPathProgram: """Own one ordinary nodal translation displacement without applied loads.""" - from anysolver.nonlinear_static import DisplacementControl + from anyfesolver.nonlinear_static import DisplacementControl if (type(control) is not DisplacementControl or type(num_steps) is not int or num_steps < 1 @@ -643,7 +643,7 @@ def solve_static_contact_path( if friction is not None and not moving_friction and (settings.shell_pair_orientation != "legacy" or settings.path_predictor != "none"): from .s3_sliding_friction import S3SlidingFrictionSettings - from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement + from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement if (type(friction) not in {S3SlidingFrictionSettings,S3RimReplayFrictionSettings} or settings.general_s3_differentiation != "jet2_s3_dev" or settings.normal_discretization != "primal_mortar" diff --git a/src/anysolver/general_contact/static_results_archive.py b/src/anyfesolver/general_contact/static_results_archive.py similarity index 95% rename from src/anysolver/general_contact/static_results_archive.py rename to src/anyfesolver/general_contact/static_results_archive.py index 955968d5e..43141ea1e 100644 --- a/src/anysolver/general_contact/static_results_archive.py +++ b/src/anyfesolver/general_contact/static_results_archive.py @@ -5,6 +5,7 @@ from types import MappingProxyType import numpy as np from . import transient_results_archive as codec +from .._wire_types import wire_class_name from ._results_archive_common import _vector, _state, _diagnostics, _encode_committed_results SCHEMA = 'ANYSOLVER_STATIC_CONTACT_RESULTS_ARCHIVE_V1' @@ -18,17 +19,17 @@ def _types(): - from anysolver.nonlinear_static import (NonlinearStaticResult, NonlinearStaticStep, + from anyfesolver.nonlinear_static import (NonlinearStaticResult, NonlinearStaticStep, NonlinearIncrementSnapshot) _, records = codec._types() records = dict(records) for cls in (NonlinearStaticStep, NonlinearIncrementSnapshot): - records[cls.__module__ + '.' + cls.__qualname__] = cls + records[wire_class_name(cls)] = cls return NonlinearStaticResult, records def _roles(cls, data): - if cls.__module__ != 'anysolver.nonlinear_static': + if cls.__module__ != 'anyfesolver.nonlinear_static': return codec._record_roles(cls, data) for key, value in data.items(): if key in ('step_index', 'iterations', 'deleted_element_count'): @@ -123,7 +124,7 @@ def serialize_static_contact_results(results, *, max_bytes=MAX_BYTES): if type(results) is not producer: codec._fail('exact NonlinearStaticResult required') data = {f.name: getattr(results, f.name) for f in fields(results)} - from anysolver.nonlinear_static import NonlinearStaticStep + from anyfesolver.nonlinear_static import NonlinearStaticStep if type(data['steps']) is not list: codec._fail('static steps must be list') for step in data['steps']: if type(step) is not NonlinearStaticStep: codec._fail('exact accepted step required') diff --git a/src/anysolver/general_contact/structural_state_bridge.py b/src/anyfesolver/general_contact/structural_state_bridge.py similarity index 97% rename from src/anysolver/general_contact/structural_state_bridge.py rename to src/anyfesolver/general_contact/structural_state_bridge.py index 06f1d25be..831575221 100644 --- a/src/anysolver/general_contact/structural_state_bridge.py +++ b/src/anyfesolver/general_contact/structural_state_bridge.py @@ -12,9 +12,9 @@ import numpy as np from scipy import sparse -from anysolver.assembly import build_constraint_transformation -from anysolver.corotational import build_nonlinear_rotating_mpc_map -from anysolver.nonlinear_restart import model_configuration_fingerprint +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.corotational import build_nonlinear_rotating_mpc_map +from anyfesolver.nonlinear_restart import model_configuration_fingerprint def _vector(value, size): diff --git a/src/anysolver/general_contact/supported_schur.py b/src/anyfesolver/general_contact/supported_schur.py similarity index 100% rename from src/anysolver/general_contact/supported_schur.py rename to src/anyfesolver/general_contact/supported_schur.py diff --git a/src/anysolver/general_contact/swept_patch_broadphase.py b/src/anyfesolver/general_contact/swept_patch_broadphase.py similarity index 100% rename from src/anysolver/general_contact/swept_patch_broadphase.py rename to src/anyfesolver/general_contact/swept_patch_broadphase.py diff --git a/src/anysolver/general_contact/transient.py b/src/anyfesolver/general_contact/transient.py similarity index 99% rename from src/anysolver/general_contact/transient.py rename to src/anyfesolver/general_contact/transient.py index b980ff0e3..197372f8b 100644 --- a/src/anysolver/general_contact/transient.py +++ b/src/anyfesolver/general_contact/transient.py @@ -25,22 +25,22 @@ from scipy.sparse.linalg import spsolve from anymaterial.isotropic import IsotropicMaterial -from anysolver.algebraic_dynamics import build_declared_algebraic_basis -from anysolver.assembly import assemble_mass_matrix, build_constraint_transformation -from anysolver.boundary import LoadCase -from anysolver.control import CancellationToken -from anysolver.dynamics import TransientConfig -from anysolver.e4_pl_element import QualifiedE4PLShellElement -from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement -from anysolver.matrix_assembly import assemble_load_vector, assemble_stiffness_matrix -from anysolver.nonlinear_state import ( +from anyfesolver.algebraic_dynamics import build_declared_algebraic_basis +from anyfesolver.assembly import assemble_mass_matrix, build_constraint_transformation +from anyfesolver.boundary import LoadCase +from anyfesolver.control import CancellationToken +from anyfesolver.dynamics import TransientConfig +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement +from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement +from anyfesolver.matrix_assembly import assemble_load_vector, assemble_stiffness_matrix +from anyfesolver.nonlinear_state import ( commit_state_candidate, discard_active_state_candidate, _run_with_nonlinear_state_cleanup, ) -from anysolver.nonlinear_restart import ( +from anyfesolver.nonlinear_restart import ( analysis_configuration_fingerprint, model_configuration_fingerprint, ) -from anysolver.nonlinear_static import ( +from anyfesolver.nonlinear_static import ( _assemble_nonlinear_system, _is_known_cancellation_checkpoint, ) @@ -1483,7 +1483,7 @@ def _admit(model, definition: ContactDefinition, settings: ContactSolverSettings if multiple else "transient development profile requires every shell element on the surface") elements = tuple(model.mesh.elements.values()) if controls.allow_classical_beam_dev: - from anysolver.elements import BeamElement, QuadraticBeamElement + from anyfesolver.elements import BeamElement, QuadraticBeamElement if (not elements or any(type(element) not in (BeamElement,QuadraticBeamElement) for element in elements) or any(surface.beam_radius is None or surface.beam_end_caps != "none" diff --git a/src/anysolver/general_contact/transient_results_archive.py b/src/anyfesolver/general_contact/transient_results_archive.py similarity index 98% rename from src/anysolver/general_contact/transient_results_archive.py rename to src/anyfesolver/general_contact/transient_results_archive.py index 337c21520..31529ffcb 100644 --- a/src/anysolver/general_contact/transient_results_archive.py +++ b/src/anyfesolver/general_contact/transient_results_archive.py @@ -9,6 +9,7 @@ import struct from types import MappingProxyType import numpy as np +from .._wire_types import wire_class_name SCHEMA = 'ANYSOLVER_TRANSIENT_CONTACT_RESULTS_ARCHIVE_V1' MAX_BYTES = 16 * 1024 * 1024 @@ -53,7 +54,7 @@ def _types(): records = (RotationalBeamS3Results, DeformableBeamS3Results, t.ContactResults, t._PairResults, t._PatchResults, t._BeamPlaneResults, t.MultipleBeamRigidResults, t.MultipleShellPlaneResults, t._RadialResults, t.FreeRigidBodyState) - return t.TransientContactResults, {c.__module__ + '.' + c.__qualname__: c for c in records} + return t.TransientContactResults, {wire_class_name(c): c for c in records} class _Budget: @@ -126,7 +127,7 @@ def _encode(value, budget, records, depth=0, gap=False): items.append([_encode(key,budget,records,depth+1), _encode(item,budget,records,depth+1,gap or key in _GAPS)]) return {'tag':'mapping','items':items} - name=type(value).__module__+'.'+type(value).__qualname__ + name=wire_class_name(type(value)) if name in records and type(value) is records[name]: data={f.name:getattr(value,f.name) for f in fields(value)} encoded_fields=_encode(data,budget,records,depth+1,gap) @@ -412,7 +413,7 @@ def to_dict(self): def _prepare_material_data(data, cap): # Explicit solver state protocol only. Each element is materialized once; # known state buffers are preflighted before the owned-copy operation. - from anysolver.nonlinear_state import NonlinearStateStore + from anyfesolver.nonlinear_state import NonlinearStateStore material_total=0;material_nodes=0 closed_nodes=0 def material_mapping(mapping): @@ -457,7 +458,7 @@ def buffers(value,depth=0): for v in value.values():buffers(v,depth+1) elif type(value) in (list,tuple): for v in value:buffers(v,depth+1) - elif type(value).__module__=='anysolver.nonlinear_state' and hasattr(value,'__dict__'): + elif type(value).__module__=='anyfesolver.nonlinear_state' and hasattr(value,'__dict__'): buffers(vars(value),depth+1) if material_total>cap//2:_fail('material buffer byte limit before materialization') finally:path.remove(id(value)) diff --git a/src/anysolver/general_contact/triangle_mortar_energy.py b/src/anyfesolver/general_contact/triangle_mortar_energy.py similarity index 100% rename from src/anysolver/general_contact/triangle_mortar_energy.py rename to src/anyfesolver/general_contact/triangle_mortar_energy.py diff --git a/src/anysolver/general_contact/triangle_pair_energy.py b/src/anyfesolver/general_contact/triangle_pair_energy.py similarity index 100% rename from src/anysolver/general_contact/triangle_pair_energy.py rename to src/anyfesolver/general_contact/triangle_pair_energy.py diff --git a/src/anysolver/general_contact/triangulated_rigid.py b/src/anyfesolver/general_contact/triangulated_rigid.py similarity index 100% rename from src/anysolver/general_contact/triangulated_rigid.py rename to src/anyfesolver/general_contact/triangulated_rigid.py diff --git a/src/anysolver/general_contact/triangulated_rigid_static.py b/src/anyfesolver/general_contact/triangulated_rigid_static.py similarity index 99% rename from src/anysolver/general_contact/triangulated_rigid_static.py rename to src/anyfesolver/general_contact/triangulated_rigid_static.py index 47deb8ebb..337f205f8 100644 --- a/src/anysolver/general_contact/triangulated_rigid_static.py +++ b/src/anyfesolver/general_contact/triangulated_rigid_static.py @@ -139,7 +139,7 @@ def _prepare(model, definition, settings): or settings.general_s3_difference_step is None or settings.d1_interior_profile or settings.q4_source_gap_certificate!='whole_face'): raise ValueError('rigid mesh requires explicit general primal mortar settings') - from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement + from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement adapters=[] for eid in surface.element_ids: if type(model.mesh.elements[eid]) is not NativeParityE4PLS3V2DShellElement: diff --git a/src/anysolver/general_contact/warped_q4_plane.py b/src/anyfesolver/general_contact/warped_q4_plane.py similarity index 100% rename from src/anysolver/general_contact/warped_q4_plane.py rename to src/anyfesolver/general_contact/warped_q4_plane.py diff --git a/src/anysolver/general_contact/warped_q4_skin.py b/src/anyfesolver/general_contact/warped_q4_skin.py similarity index 99% rename from src/anysolver/general_contact/warped_q4_skin.py rename to src/anyfesolver/general_contact/warped_q4_skin.py index fb7ee31d3..b58c7e875 100644 --- a/src/anysolver/general_contact/warped_q4_skin.py +++ b/src/anyfesolver/general_contact/warped_q4_skin.py @@ -43,7 +43,7 @@ class WarpedQ4Skin: """Evaluate one physical Q4 side using the accepted varying-frame route.""" def __init__(self, model, element_id: int, side: str): - from anysolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement element = model.mesh.elements.get(element_id) if type(element) is not QualifiedE4PLShellElement: diff --git a/src/anysolver/general_contact/warped_q4_static.py b/src/anyfesolver/general_contact/warped_q4_static.py similarity index 99% rename from src/anysolver/general_contact/warped_q4_static.py rename to src/anyfesolver/general_contact/warped_q4_static.py index 7bb90a067..119a43b99 100644 --- a/src/anysolver/general_contact/warped_q4_static.py +++ b/src/anyfesolver/general_contact/warped_q4_static.py @@ -26,8 +26,8 @@ def validate_warped_q4_plane(model, definition, settings, *, analysis_control="force"): from .core import ContactValidationReport - from anysolver.e4_pl_element import QualifiedE4PLShellElement - from anysolver.fe_core import Material + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.fe_core import Material issues = [] if (len(definition.surfaces) != 1 or len(definition.rigid_bodies) != 1 diff --git a/src/anysolver/impact_performance.py b/src/anyfesolver/impact_performance.py similarity index 100% rename from src/anysolver/impact_performance.py rename to src/anyfesolver/impact_performance.py diff --git a/src/anysolver/impact_reduced_assembly.py b/src/anyfesolver/impact_reduced_assembly.py similarity index 100% rename from src/anysolver/impact_reduced_assembly.py rename to src/anyfesolver/impact_reduced_assembly.py diff --git a/src/anysolver/imperfections.py b/src/anyfesolver/imperfections.py similarity index 100% rename from src/anysolver/imperfections.py rename to src/anyfesolver/imperfections.py diff --git a/src/anysolver/inertia_relief.py b/src/anyfesolver/inertia_relief.py similarity index 100% rename from src/anysolver/inertia_relief.py rename to src/anyfesolver/inertia_relief.py diff --git a/src/anysolver/initial_field_state.py b/src/anyfesolver/initial_field_state.py similarity index 100% rename from src/anysolver/initial_field_state.py rename to src/anyfesolver/initial_field_state.py diff --git a/src/anysolver/jit_compiler.py b/src/anyfesolver/jit_compiler.py similarity index 100% rename from src/anysolver/jit_compiler.py rename to src/anyfesolver/jit_compiler.py diff --git a/src/anysolver/kernel_warmup.py b/src/anyfesolver/kernel_warmup.py similarity index 100% rename from src/anysolver/kernel_warmup.py rename to src/anyfesolver/kernel_warmup.py diff --git a/src/anysolver/linalg.py b/src/anyfesolver/linalg.py similarity index 100% rename from src/anysolver/linalg.py rename to src/anyfesolver/linalg.py diff --git a/src/anysolver/marine_contributions.py b/src/anyfesolver/marine_contributions.py similarity index 98% rename from src/anysolver/marine_contributions.py rename to src/anyfesolver/marine_contributions.py index 05cdcc8a2..c1a34ec55 100644 --- a/src/anysolver/marine_contributions.py +++ b/src/anyfesolver/marine_contributions.py @@ -504,7 +504,7 @@ class DryGravityContribution(DynamicContribution): """ def __init__(self, body, gravity_world=(0., 0., -9.81)): - from anysolver.marine_rigid import RigidBody6D + from anyfesolver.marine_rigid import RigidBody6D if not isinstance(body, RigidBody6D): raise MarineContributionsError("body must be a RigidBody6D") self._body = body @@ -515,7 +515,7 @@ def __init__(self, body, gravity_world=(0., 0., -9.81)): self.history_transport = None def evaluate_trial(self, committed_history, states, layout): - from anysolver.marine_rigid import left_jacobian, left_jacobian_rate, skew + from anyfesolver.marine_rigid import left_jacobian, left_jacobian_rate, skew state = states[self._body.body_id] force_world = self._body.mass*self._gravity covector = self._body.gravity_force(state, self._gravity) @@ -550,7 +550,7 @@ class WorldWrenchContribution(DynamicContribution): def __init__(self, contribution_id, body, point_body, force_world=(0., 0., 0.), moment_world=(0., 0., 0.)): - from anysolver.marine_rigid import RigidBody6D + from anyfesolver.marine_rigid import RigidBody6D if not isinstance(contribution_id, str) or not contribution_id.strip(): raise MarineContributionsError("contribution_id must be a nonempty string") if not isinstance(body, RigidBody6D): @@ -565,7 +565,7 @@ def __init__(self, contribution_id, body, point_body, self.history_transport = None def evaluate_trial(self, committed_history, states, layout): - from anysolver.marine_rigid import left_jacobian, left_jacobian_rate + from anyfesolver.marine_rigid import left_jacobian, left_jacobian_rate state = states[self._body.body_id] covector = (self._body.point_force(state, self._point, self._force) + state.rate_map.T @ np.r_[np.zeros(3), self._moment]) @@ -595,7 +595,7 @@ class MechanicalLinkSetContribution(DynamicContribution): """Trusted native wrapper assembling a set of MechanicalLink6D links.""" def __init__(self, links): - from anysolver.marine_link import MechanicalLink6D + from anyfesolver.marine_link import MechanicalLink6D links = tuple(links) if not links: raise MarineContributionsError("at least one link is required") diff --git a/src/anysolver/marine_coupled_equilibrium.py b/src/anyfesolver/marine_coupled_equilibrium.py similarity index 100% rename from src/anysolver/marine_coupled_equilibrium.py rename to src/anyfesolver/marine_coupled_equilibrium.py diff --git a/src/anysolver/marine_equilibrium.py b/src/anyfesolver/marine_equilibrium.py similarity index 100% rename from src/anysolver/marine_equilibrium.py rename to src/anyfesolver/marine_equilibrium.py diff --git a/src/anysolver/marine_hydro_coordinates.py b/src/anyfesolver/marine_hydro_coordinates.py similarity index 99% rename from src/anysolver/marine_hydro_coordinates.py rename to src/anyfesolver/marine_hydro_coordinates.py index 5a98e98df..cac58c703 100644 --- a/src/anysolver/marine_hydro_coordinates.py +++ b/src/anyfesolver/marine_hydro_coordinates.py @@ -8,7 +8,7 @@ from collections.abc import Mapping import math import numpy as np -from anysolver.marine_rigid import ( +from anyfesolver.marine_rigid import ( RigidBodyState, left_jacobian, left_jacobian_rate, left_jacobian_second_rate, skew) diff --git a/src/anysolver/marine_linear.py b/src/anyfesolver/marine_linear.py similarity index 99% rename from src/anysolver/marine_linear.py rename to src/anyfesolver/marine_linear.py index 35fef3c9e..953611340 100644 --- a/src/anysolver/marine_linear.py +++ b/src/anyfesolver/marine_linear.py @@ -320,14 +320,14 @@ def _cancel_requested(cancel: Any) -> bool: return False is_cancelled = getattr(cancel, "is_cancelled", None) if is_cancelled is not None: - # anysolver.control.CancellationToken exposes a bool property; other + # anyfesolver.control.CancellationToken exposes a bool property; other # token types may expose a callable instead. return bool(is_cancelled() if callable(is_cancelled) else is_cancelled) if callable(cancel): return bool(cancel()) raise MarineLinearInputError( "cancel: must be None, a callable returning a truthy value, or an " - "anysolver.control.CancellationToken; received " + "anyfesolver.control.CancellationToken; received " f"{type(cancel).__name__}" ) diff --git a/src/anysolver/marine_link.py b/src/anyfesolver/marine_link.py similarity index 99% rename from src/anysolver/marine_link.py rename to src/anyfesolver/marine_link.py index f5877b28a..ab812670f 100644 --- a/src/anysolver/marine_link.py +++ b/src/anyfesolver/marine_link.py @@ -10,7 +10,7 @@ from dataclasses import dataclass import math import numpy as np -from anysolver.marine_rigid import (MarineRigidInputError, RigidBodyState, +from anyfesolver.marine_rigid import (MarineRigidInputError, RigidBodyState, left_jacobian, left_jacobian_rate, skew) API_VERSION = "marine_link_v1" diff --git a/src/anysolver/marine_mechanical.py b/src/anyfesolver/marine_mechanical.py similarity index 98% rename from src/anysolver/marine_mechanical.py rename to src/anyfesolver/marine_mechanical.py index 00abdd592..bd0504608 100644 --- a/src/anysolver/marine_mechanical.py +++ b/src/anyfesolver/marine_mechanical.py @@ -21,14 +21,14 @@ from scipy import sparse from scipy.sparse.linalg import spsolve, MatrixRankWarning import warnings -from anysolver.marine_contributions import (CommittedHistory, ContributionSet, +from anyfesolver.marine_contributions import (CommittedHistory, ContributionSet, DryGravityContribution, DynamicContribution, MarineContributionsCancelled, MarineContributionsError, MechanicalLinkSetContribution, RechartInfo, ChartMove, StepInformation) -from anysolver.marine_contributions import freeze_value -from anysolver.marine_linear import NEWMARK_BETA, NEWMARK_GAMMA -from anysolver.marine_link import MechanicalLink6D, MarineLinkError -from anysolver.marine_rigid import (MarineRigidInputError, RigidBody6D, +from anyfesolver.marine_contributions import freeze_value +from anyfesolver.marine_linear import NEWMARK_BETA, NEWMARK_GAMMA +from anyfesolver.marine_link import MechanicalLink6D, MarineLinkError +from anyfesolver.marine_rigid import (MarineRigidInputError, RigidBody6D, RigidBodyState) API_VERSION = "marine_mechanical_v1" @@ -719,9 +719,9 @@ def model_to_dict(model): if (any(type(body) is not RigidBody6D for body in model.bodies) or any(type(link) is not MechanicalLink6D for link in model.links)): raise MarineMechanicalInputError("native serialization cannot erase subclass physics") - from anysolver.marine_contributions import WorldWrenchContribution - from anysolver.marine_potential_flow import PotentialFlowDevelopmentContribution, data_to_dict - from anysolver.marine_morison import MorisonMemberSetContribution, data_to_dict as morison_to_dict + from anyfesolver.marine_contributions import WorldWrenchContribution + from anyfesolver.marine_potential_flow import PotentialFlowDevelopmentContribution, data_to_dict + from anyfesolver.marine_morison import MorisonMemberSetContribution, data_to_dict as morison_to_dict data = {"api_version": API_VERSION, "bodies": [{"body_id": b.body_id, "mass": b.mass, "cg_body": list(b.cg_body), @@ -796,12 +796,12 @@ def model_from_dict(data): for item in data["links"]) except (KeyError, TypeError, ValueError) as error: raise MarineMechanicalInputError(f"invalid native model data: {error}") from error - from anysolver.marine_contributions import WorldWrenchContribution + from anyfesolver.marine_contributions import WorldWrenchContribution contributions = [] by_id = {body.body_id: body for body in bodies} for item in data.get("contributions", ()): if isinstance(item,dict) and item.get('type')=='morison_members_development': - from anysolver.marine_morison import data_from_dict as morison_from_dict + from anyfesolver.marine_morison import data_from_dict as morison_from_dict if set(item)!={'type','data'}: raise MarineMechanicalInputError('Morison contribution fields must match named schema') try: @@ -810,7 +810,7 @@ def model_from_dict(data): raise MarineMechanicalInputError(f'invalid native Morison: {error}') from error continue if isinstance(item,dict) and item.get('type') == 'potential_flow_development': - from anysolver.marine_potential_flow import PotentialFlowDevelopmentContribution, data_from_dict + from anyfesolver.marine_potential_flow import PotentialFlowDevelopmentContribution, data_from_dict if set(item) != {'type','data'}: raise MarineMechanicalInputError('potential-flow contribution fields must match the named schema') try: diff --git a/src/anysolver/marine_mooring.py b/src/anyfesolver/marine_mooring.py similarity index 100% rename from src/anysolver/marine_mooring.py rename to src/anyfesolver/marine_mooring.py diff --git a/src/anysolver/marine_morison.py b/src/anyfesolver/marine_morison.py similarity index 100% rename from src/anysolver/marine_morison.py rename to src/anyfesolver/marine_morison.py diff --git a/src/anysolver/marine_potential_flow.py b/src/anyfesolver/marine_potential_flow.py similarity index 98% rename from src/anysolver/marine_potential_flow.py rename to src/anyfesolver/marine_potential_flow.py index b2bcf1620..9d28659ad 100644 --- a/src/anysolver/marine_potential_flow.py +++ b/src/anyfesolver/marine_potential_flow.py @@ -13,9 +13,9 @@ import numpy as np -from anysolver.marine_contributions import (ContributionResult, DynamicContribution, +from anyfesolver.marine_contributions import (ContributionResult, DynamicContribution, HISTORY_PHYSICAL, MarineContributionsError, StepInformation) -from anysolver.marine_hydro_coordinates import (EquilibriumHydroFrame, +from anyfesolver.marine_hydro_coordinates import (EquilibriumHydroFrame, MarineHydroCoordinatesError, evaluate_coupled) API_VERSION = 'marine_potential_flow_development_v1' @@ -292,7 +292,7 @@ def evaluate_static(self, states, layout): def validate_accepted_history(self, memory, states, step_index): """Check the last accepted physical velocity/clock; never mutate history.""" - from anysolver.marine_contributions import CommittedHistory + from anyfesolver.marine_contributions import CommittedHistory if type(step_index) is not int or step_index < 1: raise MarinePotentialFlowError('accepted history requires a positive completed step index') self._memory(CommittedHistory({self.contribution_id:memory}), diff --git a/src/anysolver/marine_rigid.py b/src/anyfesolver/marine_rigid.py similarity index 100% rename from src/anysolver/marine_rigid.py rename to src/anyfesolver/marine_rigid.py diff --git a/src/anysolver/marine_seabed.py b/src/anyfesolver/marine_seabed.py similarity index 100% rename from src/anysolver/marine_seabed.py rename to src/anyfesolver/marine_seabed.py diff --git a/src/anysolver/mass_properties.py b/src/anyfesolver/mass_properties.py similarity index 100% rename from src/anysolver/mass_properties.py rename to src/anyfesolver/mass_properties.py diff --git a/src/anysolver/material_curves.py b/src/anyfesolver/material_curves.py similarity index 100% rename from src/anysolver/material_curves.py rename to src/anyfesolver/material_curves.py diff --git a/src/anysolver/materials.py b/src/anyfesolver/materials.py similarity index 87% rename from src/anysolver/materials.py rename to src/anyfesolver/materials.py index ef9b1a59e..b4c310817 100644 --- a/src/anysolver/materials.py +++ b/src/anyfesolver/materials.py @@ -1,8 +1,8 @@ """Compatibility imports for the extracted :mod:`anymaterial` package. Material contracts, elastic reductions and yield criteria are owned by -ANYmaterial as of ANYsolver 0.2. This module remains for the 0.2.x line so -existing ``anysolver.materials`` imports keep resolving to the canonical +ANYmaterial as of ANYfeSolver 0.2. This module remains for the 0.2.x line so +existing ``anyfesolver.materials`` imports keep resolving to the canonical objects rather than to duplicated implementations. """ diff --git a/src/anysolver/matrix_assembly.py b/src/anyfesolver/matrix_assembly.py similarity index 99% rename from src/anysolver/matrix_assembly.py rename to src/anyfesolver/matrix_assembly.py index e6a3012bc..0a645cadc 100644 --- a/src/anysolver/matrix_assembly.py +++ b/src/anyfesolver/matrix_assembly.py @@ -6861,7 +6861,7 @@ def exact_qualified_guard( context="external-load tangent assembly preflight", ) if load_case is not None and any( - type(e).__module__ == "anysolver._ge_beam3_native_fibre_static_element" + type(e).__module__ == "anyfesolver._ge_beam3_native_fibre_static_element" for e in model.mesh.elements.values() ): from ._ge_beam3_native_load_admission import assemble_nodal_forces diff --git a/src/anysolver/mesh_gen.py b/src/anyfesolver/mesh_gen.py similarity index 99% rename from src/anysolver/mesh_gen.py rename to src/anyfesolver/mesh_gen.py index fb904d0d7..09c7ae1c2 100644 --- a/src/anysolver/mesh_gen.py +++ b/src/anyfesolver/mesh_gen.py @@ -1,4 +1,4 @@ -"""ANYsolver adapters for neutral meshes produced by ANYmesher. +"""ANYfeSolver adapters for neutral meshes produced by ANYmesher. ANYmesher owns geometry, numbering, mesh quality and beam-shell coupling records. This module retains the solver decisions: converting those records to diff --git a/src/anysolver/mesh_load_bc_verification.py b/src/anyfesolver/mesh_load_bc_verification.py similarity index 99% rename from src/anysolver/mesh_load_bc_verification.py rename to src/anyfesolver/mesh_load_bc_verification.py index 1e496096d..4087b8cad 100644 --- a/src/anysolver/mesh_load_bc_verification.py +++ b/src/anyfesolver/mesh_load_bc_verification.py @@ -546,7 +546,7 @@ def run_mesh_load_bc_verification(selected_ids: Optional[Iterable[str]] = None) "manifest_cases": [case.to_dict() for case in mesh_load_bc_manifest_cases()], "results": [result.to_dict() for result in results], "known_limitations": [ - "This focused gate verifies supported ANYsolver mesh/load/boundary behavior only.", + "This focused gate verifies supported ANYfeSolver mesh/load/boundary behavior only.", "Follower-pressure tangents, contact and arbitrary CAD topology are outside this focused gate.", "External pressure is negative element-normal direction; internal/outward pressure is positive normal.", ], diff --git a/src/anysolver/modal.py b/src/anyfesolver/modal.py similarity index 100% rename from src/anysolver/modal.py rename to src/anyfesolver/modal.py diff --git a/src/anysolver/nonlinear.py b/src/anyfesolver/nonlinear.py similarity index 100% rename from src/anysolver/nonlinear.py rename to src/anyfesolver/nonlinear.py diff --git a/src/anysolver/nonlinear_analysis_diagnostics.py b/src/anyfesolver/nonlinear_analysis_diagnostics.py similarity index 99% rename from src/anysolver/nonlinear_analysis_diagnostics.py rename to src/anyfesolver/nonlinear_analysis_diagnostics.py index c57f6191f..38a7ae127 100644 --- a/src/anysolver/nonlinear_analysis_diagnostics.py +++ b/src/anyfesolver/nonlinear_analysis_diagnostics.py @@ -347,7 +347,7 @@ def payload(self, info: Mapping[str, Any]) -> Dict[str, Any]: _ACTIVE_RECORDERS: ContextVar[tuple[_AnalysisPerformanceRecorder, ...]] = ( - ContextVar("anysolver_active_nonlinear_analysis_recorders", default=()) + ContextVar("anyfesolver_active_nonlinear_analysis_recorders", default=()) ) diff --git a/src/anysolver/nonlinear_element_evaluation.py b/src/anyfesolver/nonlinear_element_evaluation.py similarity index 100% rename from src/anysolver/nonlinear_element_evaluation.py rename to src/anyfesolver/nonlinear_element_evaluation.py diff --git a/src/anysolver/nonlinear_performance.py b/src/anyfesolver/nonlinear_performance.py similarity index 99% rename from src/anysolver/nonlinear_performance.py rename to src/anyfesolver/nonlinear_performance.py index dadf6837b..17c8c2ccd 100644 --- a/src/anysolver/nonlinear_performance.py +++ b/src/anyfesolver/nonlinear_performance.py @@ -1,6 +1,6 @@ """Performance layer for nonlinear shell/beam analyses. -The production nonlinear formulations remain in :mod:`anysolver.nonlinear_static` +The production nonlinear formulations remain in :mod:`anyfesolver.nonlinear_static` and the element modules. This module removes repeated Python and sparse-matrix bookkeeping from every Newton iteration by building a persistent assembly plan for each model/layer-count pair. @@ -371,7 +371,7 @@ def _shell_kernel(self) -> Any: """Return the batch kernel for this plan's constitutive route. Qualified plastic Q4 batches evaluate the layered return map at the - hybrid assumed strain (:mod:`anysolver._q4_assumed_strain_plasticity`); + hybrid assumed strain (:mod:`anyfesolver._q4_assumed_strain_plasticity`); every other batch keeps the ordinary compatible kernel. """ diff --git a/src/anysolver/nonlinear_performance_batch_b.py b/src/anyfesolver/nonlinear_performance_batch_b.py similarity index 100% rename from src/anysolver/nonlinear_performance_batch_b.py rename to src/anyfesolver/nonlinear_performance_batch_b.py diff --git a/src/anysolver/nonlinear_performance_batch_c.py b/src/anyfesolver/nonlinear_performance_batch_c.py similarity index 99% rename from src/anysolver/nonlinear_performance_batch_c.py rename to src/anyfesolver/nonlinear_performance_batch_c.py index 28e010ec5..fd9e66f2d 100644 --- a/src/anysolver/nonlinear_performance_batch_c.py +++ b/src/anyfesolver/nonlinear_performance_batch_c.py @@ -680,7 +680,7 @@ def _replace_function_references(original: Any, replacement: Any) -> None: Batch C is installed lazily, so callers can legitimately bind ``solve_static_nonlinear`` or ``solve_static_arc_length`` before the first nonlinear solve triggers installation. Restricting this pass to - ``anysolver.*`` modules leaves those consumer aliases pointing at the + ``anyfesolver.*`` modules leaves those consumer aliases pointing at the unwrapped function and therefore bypasses the solve context required for direct reduced assembly. @@ -732,7 +732,7 @@ def install_batch_c_optimizations() -> bool: if not isinstance(module, ModuleType): continue module_name = getattr(module, "__name__", "") - if not module_name.startswith("anysolver") or module_name == __name__: + if not module_name.startswith("anyfesolver") or module_name == __name__: continue if hasattr(module, "_assemble_nonlinear_system"): _record_patch( diff --git a/src/anysolver/nonlinear_performance_bootstrap.py b/src/anyfesolver/nonlinear_performance_bootstrap.py similarity index 100% rename from src/anysolver/nonlinear_performance_bootstrap.py rename to src/anyfesolver/nonlinear_performance_bootstrap.py diff --git a/src/anysolver/nonlinear_reduced_assembly.py b/src/anyfesolver/nonlinear_reduced_assembly.py similarity index 100% rename from src/anysolver/nonlinear_reduced_assembly.py rename to src/anyfesolver/nonlinear_reduced_assembly.py diff --git a/src/anysolver/nonlinear_restart.py b/src/anyfesolver/nonlinear_restart.py similarity index 99% rename from src/anysolver/nonlinear_restart.py rename to src/anyfesolver/nonlinear_restart.py index e3c0ff8d1..2195ca1cf 100644 --- a/src/anysolver/nonlinear_restart.py +++ b/src/anyfesolver/nonlinear_restart.py @@ -27,6 +27,7 @@ require_exact_qualified_component_lifecycle_api as _EXACT_QUALIFIED_COMPONENT_LIFECYCLE_GUARD, ) from .element_capabilities import ElementCapabilityError +from ._wire_types import wire_class_name from .fe_core import Node as _CHECKPOINT_NODE_TYPE @@ -257,8 +258,7 @@ def _validate_complete_activity_history(activity: Any) -> None: def _class_id(value: Any) -> str: - cls = type(value) - return f"{cls.__module__}.{cls.__qualname__}" + return wire_class_name(type(value)) def _checkpoint_observation_guard( diff --git a/src/anysolver/nonlinear_state.py b/src/anyfesolver/nonlinear_state.py similarity index 99% rename from src/anysolver/nonlinear_state.py rename to src/anyfesolver/nonlinear_state.py index 31f95b57d..c410beb88 100644 --- a/src/anysolver/nonlinear_state.py +++ b/src/anyfesolver/nonlinear_state.py @@ -239,13 +239,13 @@ def __post_init__(self) -> None: ) -_NATIVE_ELEMENT_BINDINGS_ATTRIBUTE = "_anysolver_native_element_state_bindings_v1" +_NATIVE_ELEMENT_BINDINGS_ATTRIBUTE = "_anyfesolver_native_element_state_bindings_v1" _NATIVE_DIRECTOR_CONSISTENCY_TOLERANCE = 1.0e-12 # A synchronous solve owns only stores explicitly activated in its context. # Nested/concurrent solves do not share a mutable global cleanup registry. _SOLVE_STATE_CLEANUP: ContextVar[Optional[list[Any]]] = ContextVar( - "anysolver_nonlinear_state_cleanup", default=None + "anyfesolver_nonlinear_state_cleanup", default=None ) diff --git a/src/anysolver/nonlinear_static.py b/src/anyfesolver/nonlinear_static.py similarity index 99% rename from src/anysolver/nonlinear_static.py rename to src/anyfesolver/nonlinear_static.py index 1abe774ed..906619ece 100644 --- a/src/anysolver/nonlinear_static.py +++ b/src/anyfesolver/nonlinear_static.py @@ -8,7 +8,7 @@ Material nonlinearity: layered J2 plane-stress plasticity in the shells with the isotropic hardening curve attached to the material (``Material.hardening_curve``, e.g. a DNV-RP-C208 curve from -:mod:`anysolver.material_curves`). Materials without a curve stay elastic. +:mod:`anyfesolver.material_curves`). Materials without a curve stay elastic. Solution strategy (chosen for speed): @@ -2054,28 +2054,28 @@ def _owned_initial_element_states( if element_id in owned: raise ValueError("initial_element_states contains duplicate element IDs") element = model.mesh.elements.get(element_id) - if type(element).__module__ == "anysolver._ge_beam3_native_generalized_element": + if type(element).__module__ == "anyfesolver._ge_beam3_native_generalized_element": from ._ge_beam3_native_generalized_restart import capture_solver_state owned[element_id] = capture_solver_state( model, element_id, state, exact_guard=_exact_guard ) continue - if type(element).__module__ == "anysolver._ge_beam3_native_distributed_element": + if type(element).__module__ == "anyfesolver._ge_beam3_native_distributed_element": from ._ge_beam3_native_distributed_restart import capture_solver_state owned[element_id] = capture_solver_state( model, element_id, state, exact_guard=_exact_guard ) continue - if type(element).__module__ == "anysolver._ge_beam3_native_line_static_element": + if type(element).__module__ == "anyfesolver._ge_beam3_native_line_static_element": from ._ge_beam3_native_line_restart import capture_solver_state owned[element_id] = capture_solver_state( model, element_id, state, exact_guard=_exact_guard ) continue - if type(element).__module__ == "anysolver._ge_beam3_native_fibre_static_element": + if type(element).__module__ == "anyfesolver._ge_beam3_native_fibre_static_element": # Private typed candidate only; the helper checks the exact class. # Keep the closed generic copier unchanged for all existing elements. from ._ge_beam3_native_fibre_restart import capture_solver_state @@ -5748,7 +5748,7 @@ def exact_guard( return result native_generalized_model = any( - type(e).__module__ == "anysolver._ge_beam3_native_generalized_element" + type(e).__module__ == "anyfesolver._ge_beam3_native_generalized_element" for e in model.mesh.elements.values() ) if native_generalized_model: @@ -5931,7 +5931,7 @@ def cancellation_checkpoint(stage: str, *, context: str) -> Dict[str, Any]: imperfection, _exact_guard=exact_guard, ) - if any(type(e).__module__ == "anysolver._ge_beam3_native_fibre_static_element" for e in model.mesh.elements.values()): + if any(type(e).__module__ == "anyfesolver._ge_beam3_native_fibre_static_element" for e in model.mesh.elements.values()): from ._ge_beam3_native_load_admission import assemble_nodal_forces native_load_cases = (load_case, constant_load_case) + ( @@ -6057,7 +6057,7 @@ def cancellation_checkpoint(stage: str, *, context: str) -> Dict[str, Any]: "line_search='armijo' does not yet support fracture or element deletion" ) if any( - type(element).__module__.startswith("anysolver._ge_beam3_native") + type(element).__module__.startswith("anyfesolver._ge_beam3_native") for element in model.mesh.elements.values() ): raise ValueError( @@ -6388,7 +6388,7 @@ def cancellation_checkpoint(stage: str, *, context: str) -> Dict[str, Any]: info['equilibrium_tangent'] = 'K_generalized_static_Schur-K_spatial_nodal_chart_external' info['native_generalized_combined_couple_general_matrix'] = True native_distributed_model = any( - type(e).__module__ == 'anysolver._ge_beam3_native_distributed_element' + type(e).__module__ == 'anyfesolver._ge_beam3_native_distributed_element' for e in model.mesh.elements.values() ) if native_distributed_model: @@ -6409,7 +6409,7 @@ def cancellation_checkpoint(stage: str, *, context: str) -> Dict[str, Any]: info['equilibrium_tangent'] = 'K_distributed_static_Schur-K_spatial_nodal_chart_external' info['native_combined_couple_general_matrix'] = True native_line_model = any( - type(e).__module__ == 'anysolver._ge_beam3_native_line_static_element' + type(e).__module__ == 'anyfesolver._ge_beam3_native_line_static_element' for e in model.mesh.elements.values() ) if native_line_model: @@ -6576,7 +6576,7 @@ def cancellation_checkpoint(stage: str, *, context: str) -> Dict[str, Any]: ) elif control_name == "force": if initial_displacements is not None and model.mesh.elements and all( - type(element).__module__ == "anysolver._ge_beam3_native_fibre_static_element" + type(element).__module__ == "anyfesolver._ge_beam3_native_fibre_static_element" for element in model.mesh.elements.values() ): from ._ge_beam3_native_fibre_restart import supported_solver_coordinates @@ -6585,7 +6585,7 @@ def cancellation_checkpoint(stage: str, *, context: str) -> Dict[str, Any]: model, T, u0, initial_displacements ) elif initial_displacements is not None and model.mesh.elements and all( - type(element).__module__ == "anysolver._ge_beam3_native_line_static_element" + type(element).__module__ == "anyfesolver._ge_beam3_native_line_static_element" for element in model.mesh.elements.values() ): from ._ge_beam3_native_line_restart import supported_solver_coordinates @@ -6594,7 +6594,7 @@ def cancellation_checkpoint(stage: str, *, context: str) -> Dict[str, Any]: model, T, u0, initial_displacements ) elif initial_displacements is not None and model.mesh.elements and all( - type(element).__module__ == "anysolver._ge_beam3_native_generalized_element" + type(element).__module__ == "anyfesolver._ge_beam3_native_generalized_element" for element in model.mesh.elements.values() ): from ._ge_beam3_native_generalized_restart import supported_solver_coordinates @@ -6603,7 +6603,7 @@ def cancellation_checkpoint(stage: str, *, context: str) -> Dict[str, Any]: model, T, u0, initial_displacements ) elif initial_displacements is not None and model.mesh.elements and all( - type(element).__module__ == "anysolver._ge_beam3_native_distributed_element" + type(element).__module__ == "anyfesolver._ge_beam3_native_distributed_element" for element in model.mesh.elements.values() ): from ._ge_beam3_native_distributed_restart import supported_solver_coordinates @@ -7507,7 +7507,7 @@ def assemble_force_system(path_factor, *args, **kwargs): if native_distributed_model: from ._ge_beam3_native_distributed_program import assemble_at return assemble_at(path_factor, *args, **kwargs) - if any(type(e).__module__ == 'anysolver._ge_beam3_native_line_static_element' + if any(type(e).__module__ == 'anyfesolver._ge_beam3_native_line_static_element' for e in model.mesh.elements.values()): from ._ge_beam3_native_line_program import assemble_at return assemble_at(path_factor, *args, **kwargs) diff --git a/src/anysolver/outcomes.py b/src/anyfesolver/outcomes.py similarity index 99% rename from src/anysolver/outcomes.py rename to src/anyfesolver/outcomes.py index 2c5f0d377..1b45a2a18 100644 --- a/src/anysolver/outcomes.py +++ b/src/anyfesolver/outcomes.py @@ -289,7 +289,7 @@ def outcome(self) -> SolveOutcome: ... def _is_result_type(result: Any, module: str, name: str) -> bool: result_type = type(result) - module_name = f"anysolver.{module}" + module_name = f"anyfesolver.{module}" if result_type.__module__ != module_name or result_type.__name__ != name: return False try: @@ -534,7 +534,7 @@ def _adapt_fe_result(result: Any) -> SolveOutcome: def _adapt_known_result(result: Any) -> Optional[SolveOutcome]: - """Adapt only concrete public ANYsolver result carriers. + """Adapt only concrete public ANYfeSolver result carriers. This deliberately uses an exact module/class allowlist. Duck-typed status objects and third-party wrappers are not guessed; they remain fail-closed. diff --git a/src/anysolver/plasticity.py b/src/anyfesolver/plasticity.py similarity index 99% rename from src/anysolver/plasticity.py rename to src/anyfesolver/plasticity.py index 6a24404d1..1e0b689bb 100644 --- a/src/anysolver/plasticity.py +++ b/src/anyfesolver/plasticity.py @@ -57,7 +57,7 @@ def plane_stress_elastic_matrix(E: float, nu: float) -> np.ndarray: _ANALYTICAL_TANGENT_CONDITION_LIMIT = 1.0e12 _ANALYTICAL_TANGENT_AMPLIFICATION_LIMIT = 1.0e8 _TANGENT_METHOD_OVERRIDE: ContextVar[str | None] = ContextVar( - "anysolver_plane_stress_tangent_method", + "anyfesolver_plane_stress_tangent_method", default=None, ) @@ -1173,7 +1173,7 @@ def hill48_equivalent_stress( Stress order is engineering Voigt ``[11, 22, 33, 23, 13, 12]``. The function consumes the six-strength protocol directly so material records - from ANYmaterial need not inherit ANYsolver classes. + from ANYmaterial need not inherit ANYfeSolver classes. """ values = np.asarray(stress, dtype=float) diff --git a/src/anysolver/plasticity_qualification.py b/src/anyfesolver/plasticity_qualification.py similarity index 100% rename from src/anysolver/plasticity_qualification.py rename to src/anyfesolver/plasticity_qualification.py diff --git a/src/anysolver/prepared_static.py b/src/anyfesolver/prepared_static.py similarity index 100% rename from src/anysolver/prepared_static.py rename to src/anyfesolver/prepared_static.py diff --git a/src/anysolver/prepared_static_envelopes.py b/src/anyfesolver/prepared_static_envelopes.py similarity index 100% rename from src/anysolver/prepared_static_envelopes.py rename to src/anyfesolver/prepared_static_envelopes.py diff --git a/src/anysolver/prepared_static_loads.py b/src/anyfesolver/prepared_static_loads.py similarity index 99% rename from src/anysolver/prepared_static_loads.py rename to src/anyfesolver/prepared_static_loads.py index e68550efd..16aadb58e 100644 --- a/src/anysolver/prepared_static_loads.py +++ b/src/anyfesolver/prepared_static_loads.py @@ -179,7 +179,7 @@ def _capture_native_helpers(): def visit(function): if type(function) is not types.FunctionType or id(function) in seen: return - if not function.__module__.startswith(("anysolver", "anymaterial")): + if not function.__module__.startswith(("anyfesolver", "anymaterial")): return seen.add(id(function)) if function is _native_authority_matches: diff --git a/src/anysolver/prepared_static_measures.py b/src/anyfesolver/prepared_static_measures.py similarity index 82% rename from src/anysolver/prepared_static_measures.py rename to src/anyfesolver/prepared_static_measures.py index 93e24fb64..d4451eeda 100644 --- a/src/anysolver/prepared_static_measures.py +++ b/src/anyfesolver/prepared_static_measures.py @@ -1,12 +1,12 @@ """Derived principal stresses from physically resolved symmetric stress tensors. -The shared measure formulas live in :mod:`anysolver_results.formulas` so the +The shared measure formulas live in :mod:`anyfesolver_results.formulas` so the solver's reviewed derived measures and the offline capsule runtime compute identical values from one source; this module re-exports them for the solver's internal callers. """ from __future__ import annotations -from anysolver_results.formulas import ( +from anyfesolver_results.formulas import ( PRINCIPAL_COMPONENTS, SHELL_LINEAR_COMPONENTS, principal_stresses, diff --git a/src/anysolver/prepared_static_numeric.py b/src/anyfesolver/prepared_static_numeric.py similarity index 100% rename from src/anysolver/prepared_static_numeric.py rename to src/anyfesolver/prepared_static_numeric.py diff --git a/src/anysolver/prepared_static_q4.py b/src/anyfesolver/prepared_static_q4.py similarity index 100% rename from src/anysolver/prepared_static_q4.py rename to src/anyfesolver/prepared_static_q4.py diff --git a/src/anysolver/prepared_static_recovery.py b/src/anyfesolver/prepared_static_recovery.py similarity index 99% rename from src/anysolver/prepared_static_recovery.py rename to src/anyfesolver/prepared_static_recovery.py index d5fa3115d..d76baf31d 100644 --- a/src/anysolver/prepared_static_recovery.py +++ b/src/anyfesolver/prepared_static_recovery.py @@ -460,7 +460,16 @@ def _capture_owned_local_recovery(model, element, *, warm_stress=True, pressure_ # Authenticate the new helper before fetching it from its module. Keep # only its builtin bool, never the original mesh/scalar providers. _require_prepared_q4_authority() - source_q4_policy = _prepared_q4._capture_original_q4_policy(element, model.mesh, material) + try: + source_q4_policy = _prepared_q4._capture_original_q4_policy(element, model.mesh, material) + except ValueError: + # Native policy capture checks the Q4 module before the opt-in + # prepared span is entered. Preserve its typed refusal when a + # trusted factory was rebound, without probing hooked modules. + if _trusted_capture_active() and _capture_modules_unhooked(): + _require_capture_scope_tables() + _require_owned_scope_factory_authority() + raise def freeze(value): if type(value) is np.ndarray: return (value.dtype.str, tuple(value.shape), value.tobytes()) @@ -823,10 +832,10 @@ def _shell_surface_von_mises(record: Dict[str, Any]) -> Any: ``e4_pl_s3_element.QualifiedE4PLS3ShellElement`` elastic recovery: the measure is the max of the top/bottom plane-stress von Mises with the shared transverse shear. The formula is shared with the offline capsule - runtime through :mod:`anysolver_results.formulas`. + runtime through :mod:`anyfesolver_results.formulas`. """ - from anysolver_results.formulas import shell_surface_von_mises + from anyfesolver_results.formulas import shell_surface_von_mises return shell_surface_von_mises(record) @@ -835,10 +844,10 @@ def _beam_von_mises(record: Dict[str, Any]) -> Any: Source: ``elements.BeamElement.compute_stresses`` elastic path. The formula is shared with the offline capsule runtime through - :mod:`anysolver_results.formulas`. + :mod:`anyfesolver_results.formulas`. """ - from anysolver_results.formulas import beam_von_mises + from anyfesolver_results.formulas import beam_von_mises return beam_von_mises(record) @@ -1766,7 +1775,7 @@ def _make_capture_module_check(): import types from importlib.machinery import ModuleSpec families = ('numpy', 'math', 'cmath', 'warnings', 'sys', 'types', 'io', 'dataclasses', 'builtins', - 'functools', 'operator', 'contextlib', 'contextvars', 'copy', 'linecache', 'anysolver', + 'functools', 'operator', 'contextlib', 'contextvars', 'copy', 'linecache', 'anyfesolver', 'anymaterial', 'numba') # scipy is used by neither the proofs nor the span code missing = object() held = [None] # sys.modules, captured on the first opt-in admission diff --git a/src/anysolver/prepared_static_response.py b/src/anyfesolver/prepared_static_response.py similarity index 99% rename from src/anysolver/prepared_static_response.py rename to src/anyfesolver/prepared_static_response.py index 7f563ba15..1b1f2d70a 100644 --- a/src/anysolver/prepared_static_response.py +++ b/src/anyfesolver/prepared_static_response.py @@ -983,7 +983,7 @@ def visit(function): if type(function) is not _types.FunctionType or id(function) in seen: return seen.add(id(function)) - if function.__module__ in ('anysolver._native_authority_dag','anysolver._native_guard_dispatch'): + if function.__module__ in ('anyfesolver._native_authority_dag','anyfesolver._native_guard_dispatch'): def names(code): return set(code.co_names).union(*(names(child) for child in code.co_consts if type(child) is _types.CodeType)) bindings = tuple((name,name in function.__globals__,function.__globals__.get(name)) @@ -994,7 +994,7 @@ def names(code): records.append((function,_callable_authority(function),bindings)) for binding in bindings: value=binding[-1] - if type(value) is _types.FunctionType and value.__module__.startswith('anysolver'): + if type(value) is _types.FunctionType and value.__module__.startswith('anyfesolver'): visit(value) for cls in (PreparedStaticEvaluator,PreparedStaticResponseEvaluator,PatternCase,_PatternPacket, VectorEnvelope,VectorRecovery,CompiledPressure,ReactionPlan,NumericCase,NumericField): diff --git a/src/anysolver/prepared_static_shared.py b/src/anyfesolver/prepared_static_shared.py similarity index 100% rename from src/anysolver/prepared_static_shared.py rename to src/anyfesolver/prepared_static_shared.py diff --git a/src/anysolver/prepared_static_snapshot.py b/src/anyfesolver/prepared_static_snapshot.py similarity index 100% rename from src/anysolver/prepared_static_snapshot.py rename to src/anyfesolver/prepared_static_snapshot.py diff --git a/src/anysolver/prepared_static_vectorized.py b/src/anyfesolver/prepared_static_vectorized.py similarity index 99% rename from src/anysolver/prepared_static_vectorized.py rename to src/anyfesolver/prepared_static_vectorized.py index f8a9e0ba2..be980c5ce 100644 --- a/src/anysolver/prepared_static_vectorized.py +++ b/src/anyfesolver/prepared_static_vectorized.py @@ -17,7 +17,7 @@ from dataclasses import replace import numpy as np -from anysolver_results.formulas import (shell_surface_von_mises as _shared_shell_von_mises, +from anyfesolver_results.formulas import (shell_surface_von_mises as _shared_shell_von_mises, beam_von_mises as _shared_beam_von_mises) from scipy import sparse diff --git a/src/anysolver/pressure_regions.py b/src/anyfesolver/pressure_regions.py similarity index 100% rename from src/anysolver/pressure_regions.py rename to src/anyfesolver/pressure_regions.py diff --git a/src/anysolver/production_readiness.py b/src/anyfesolver/production_readiness.py similarity index 99% rename from src/anysolver/production_readiness.py rename to src/anyfesolver/production_readiness.py index 62bd0f323..f180898e2 100644 --- a/src/anysolver/production_readiness.py +++ b/src/anyfesolver/production_readiness.py @@ -213,7 +213,7 @@ def build_capability_matrix(report: Optional[Mapping[str, Any]] = None) -> List[ status=full_release, release_gate="fully_documented_verified_release", verification_cases=["V1:*", "V2:*", "V3:*", "V4:*", "V5:*", "MLBC:*", "CONTACT:*", "FRACTURE:*"], - limits={"claim": "documented ANYsolver beam-shell analysis scope only"}, + limits={"claim": "documented ANYfeSolver beam-shell analysis scope only"}, limitations=[ "General-purpose commercial-solver replacement claims are prohibited.", "External-reference decks are reproducible handoff artifacts unless executed external-solver result files are supplied.", @@ -286,7 +286,7 @@ def _markdown_list(items: Iterable[str]) -> List[str]: def scope_statement_markdown(scope: Mapping[str, Any]) -> str: lines = [ - "# ANYsolver Production Scope Statement", + "# ANYfeSolver Production Scope Statement", "", f"- Production release status: {scope.get('production_release_status')}", "", diff --git a/src/anysolver/quality_control.py b/src/anyfesolver/quality_control.py similarity index 100% rename from src/anysolver/quality_control.py rename to src/anyfesolver/quality_control.py diff --git a/src/anysolver/quantities.py b/src/anyfesolver/quantities.py similarity index 99% rename from src/anysolver/quantities.py rename to src/anyfesolver/quantities.py index 0447afbbb..febc36121 100644 --- a/src/anysolver/quantities.py +++ b/src/anyfesolver/quantities.py @@ -1008,7 +1008,7 @@ def _plastic_strain_quantity( def _is_exact_result_type(result: Any, module: str, name: str) -> bool: - module_name = f"anysolver.{module}" + module_name = f"anyfesolver.{module}" result_type = type(result) if result_type.__module__ != module_name or result_type.__name__ != name: return False diff --git a/src/anysolver/recovery.py b/src/anyfesolver/recovery.py similarity index 99% rename from src/anysolver/recovery.py rename to src/anyfesolver/recovery.py index 733b6bb3d..3fc116112 100644 --- a/src/anysolver/recovery.py +++ b/src/anyfesolver/recovery.py @@ -2396,8 +2396,8 @@ def recover_stress_result( """Recover stresses with material-history provenance. ``nonlinear_result`` may be either a - :class:`~anysolver.nonlinear_static.NonlinearStaticResult` or an - :class:`~anysolver.arc_length.ArcLengthResult`; any object exposing + :class:`~anyfesolver.nonlinear_static.NonlinearStaticResult` or an + :class:`~anyfesolver.arc_length.ArcLengthResult`; any object exposing ``element_states`` follows the same contract. Directly supplied ``element_states`` are also supported. Valid committed shell-layer, beam-fiber, and generalized shell/beam section states replace the diff --git a/src/anysolver/recovery_batches.py b/src/anyfesolver/recovery_batches.py similarity index 100% rename from src/anysolver/recovery_batches.py rename to src/anyfesolver/recovery_batches.py diff --git a/src/anysolver/recovery_policy.py b/src/anyfesolver/recovery_policy.py similarity index 100% rename from src/anysolver/recovery_policy.py rename to src/anyfesolver/recovery_policy.py diff --git a/src/anysolver/recovery_s4.py b/src/anyfesolver/recovery_s4.py similarity index 99% rename from src/anysolver/recovery_s4.py rename to src/anyfesolver/recovery_s4.py index cae721349..ec25396db 100644 --- a/src/anysolver/recovery_s4.py +++ b/src/anyfesolver/recovery_s4.py @@ -3,7 +3,7 @@ The kernel mirrors :meth:`ShellElement.compute_stresses` for the qualified four-node isotropic case, including the element's MITC4 assumed-shear field and optional local/global top/bottom tensors. Unsupported formulations continue -through the scalar oracle in :mod:`anysolver.recovery`. +through the scalar oracle in :mod:`anyfesolver.recovery`. """ from __future__ import annotations diff --git a/src/anysolver/recovery_shell_frames.py b/src/anyfesolver/recovery_shell_frames.py similarity index 100% rename from src/anysolver/recovery_shell_frames.py rename to src/anyfesolver/recovery_shell_frames.py diff --git a/src/anysolver/reference_cases.py b/src/anyfesolver/reference_cases.py similarity index 100% rename from src/anysolver/reference_cases.py rename to src/anyfesolver/reference_cases.py diff --git a/src/anysolver/result_capsule.py b/src/anyfesolver/result_capsule.py similarity index 99% rename from src/anysolver/result_capsule.py rename to src/anyfesolver/result_capsule.py index 7a53f906d..0cc7967e8 100644 --- a/src/anysolver/result_capsule.py +++ b/src/anyfesolver/result_capsule.py @@ -35,9 +35,9 @@ from .prepared_static_measures import PRINCIPAL_COMPONENTS from .prepared_static_numeric import NumericCase, NumericField, float_bits_equal from time import perf_counter_ns as _capsule_guard_clock_ns -from anysolver_results import (reconstruct_response, derive_field, ReconstructionError, +from anyfesolver_results import (reconstruct_response, derive_field, ReconstructionError, DerivationError, validate_storage_prediction) -import anysolver_results as _storage_runtime +import anyfesolver_results as _storage_runtime _STORAGE_SCHEMA_INPUTS = tuple(sorted(validate_storage_prediction.__globals__['_INPUTS'].items())) _STORAGE_NUMPY_PINS = tuple((name,vars(np)[name],_callable_authority(vars(np)[name])) @@ -665,7 +665,7 @@ def _library_basis(evaluator: PreparedStaticResponseEvaluator) -> Optional[dict] The library columns are exactly the evaluator's admitted combination basis: column 0 is the baseline record and every pattern column is the zero-subtracted incremental record, so capsule reconstruction with - ``anysolver_results.reconstruct_response`` reproduces the evaluator's + ``anyfesolver_results.reconstruct_response`` reproduces the evaluator's admitted ``_combine`` arithmetic. """ library = evaluator._element_library @@ -2015,7 +2015,7 @@ def run(self, sink) -> None: identity = dict(self.solver_identity) if self.solver_identity is not None else {} from . import __version__ - identity.setdefault('solver', 'ANYsolver') + identity.setdefault('solver', 'ANYfeSolver') identity.setdefault('version', __version__) identity.setdefault('stress_execution', self.stress_execution) identity.setdefault('export_contract', self.contract_id) @@ -2165,7 +2165,7 @@ def export_recovery_capsule(evaluator, cases, *, model_identity, mesh_identity, geometry=geometry, solver_identity=solver_identity, batch_size=batch_size,recovery_execution=recovery_execution,replay_version=replay_version, cancellation_token=cancellation_token) - from anysolver_results import validate_capsule + from anyfesolver_results import validate_capsule validate_capsule(sink.capsule) return _readonly_data(sink.capsule) diff --git a/src/anysolver/results.py b/src/anyfesolver/results.py similarity index 100% rename from src/anysolver/results.py rename to src/anyfesolver/results.py diff --git a/src/anysolver/runtime.py b/src/anyfesolver/runtime.py similarity index 99% rename from src/anysolver/runtime.py rename to src/anyfesolver/runtime.py index 492cba602..12fc34997 100644 --- a/src/anysolver/runtime.py +++ b/src/anyfesolver/runtime.py @@ -1,4 +1,4 @@ -"""Headless runtime meshing and analysis facade for ANYsolver. +"""Headless runtime meshing and analysis facade for ANYfeSolver. The module accepts normalized geometry dictionaries and contains no ANYstructure imports or GUI dependencies. Application integrations map their @@ -22,7 +22,7 @@ import numpy as np -import anysolver as _full_backend +import anyfesolver as _full_backend from .e4_pl_element import ( QualifiedE4PLShellElement as _QualifiedE4PLShellElement, _q4_trusted_operation_scope as _Q4_TRUSTED_OPERATION_SCOPE, @@ -304,7 +304,7 @@ class LightweightFEMResult: prestress_summary: dict[str, float] = field(default_factory=dict) load_resultant: dict[str, tuple[float, float, float]] = field(default_factory=dict) visualization: dict[str, object] = field(default_factory=dict) - solver_name: str = "ANYsolver lightweight" + solver_name: str = "ANYfeSolver lightweight" _RUNTIME_CONTEXT_STRUCTURAL_REVISIONS = ( @@ -3697,7 +3697,7 @@ def node_id(row: int, col: int) -> int: if not boundary_map and not config.custom_load_bc_enabled: supports.extend(_enforced_displacement_supports(nodes, config, "flat", exclude_node_ids=set(boundary_nodes))) return { - "name": "ANYsolverFlatPanelFullMesh", + "name": "ANYfeSolverFlatPanelFullMesh", "thickness_regions": thickness_region_info, "nodes": nodes, "shells": shells, @@ -4252,7 +4252,7 @@ def cylinder_normal(_node_id: int, coord: np.ndarray) -> np.ndarray: if not boundary_map and not config.custom_load_bc_enabled: supports.extend(_enforced_displacement_supports(nodes, config, "cylinder")) return { - "name": "ANYsolverCylinderFullMesh", + "name": "ANYfeSolverCylinderFullMesh", "thickness_regions": thickness_region_info, "nodes": nodes, "shells": shells, @@ -5612,6 +5612,7 @@ def _record_buckling_mesh_adequacy( def _wants_capacity_workflow(config: LightweightFEMConfig) -> bool: choice = _normalized_choice(config.runtime_solver, "stepwise") return choice in { + "anyfesolver capacity workflow", "anysolver capacity workflow", # Legacy serialized ANYstructure selector; retained so saved FEM # option state remains readable after the package transfer. @@ -5937,7 +5938,7 @@ def _auto_set_parameter_notes(config: LightweightFEMConfig) -> list[str]: effective_kinematics = _effective_nonlinear_static_kinematics(config) if effective_kinematics != kinematics_choice: if _wants_capacity_workflow(config): - reason = "the ANYsolver capacity workflow solves with Von Karman kinematics" + reason = "the ANYfeSolver capacity workflow solves with Von Karman kinematics" elif _wants_tangent_stability_analysis(config): reason = "tangent stability solves with Von Karman kinematics" else: @@ -7202,7 +7203,7 @@ def _run_collision_response( displacement_max_m=0.0, diagnostics=tuple(diagnostics + ["Rigid-sphere collision backend is not available."]), mesh_info={"nodes": int(model.mesh.num_nodes), "shells": len(generated_geometry.get("shells", [])), "beams": len(generated_geometry.get("beams", []))}, - solver_name="ANYsolver production FE mesh", + solver_name="ANYfeSolver production FE mesh", visualization=_visualization_from_full_result(generated_geometry, model, None), ) if not _runtime_collision_has_fixed_support(config, geometry): @@ -7213,7 +7214,7 @@ def _run_collision_response( displacement_max_m=0.0, diagnostics=tuple(diagnostics + ["Collision runs require at least one fixed, pinned, clamped, or otherwise constrained side/top/bottom. Nullspace projection is not used for collision."]), mesh_info={"nodes": int(model.mesh.num_nodes), "shells": len(generated_geometry.get("shells", [])), "beams": len(generated_geometry.get("beams", []))}, - solver_name="ANYsolver production FE mesh", + solver_name="ANYfeSolver production FE mesh", ) if status_callback: status_callback("Solving rigid-sphere collision transient...") @@ -7264,10 +7265,10 @@ def _run_collision_response( "collision_allowed_initial_penetration_m": float(allowed_initial_penetration), "collision_representative_shell_edge_m": float(representative_edge), }, - solver_name="ANYsolver production FE mesh", + solver_name="ANYfeSolver production FE mesh", ) sphere = _backend_RigidSphereImpact( - name="ANYsolver sphere", + name="ANYfeSolver sphere", radius=radius, mass=max(float(config.collision_mass_kg), 1.0e-9), start_point=( @@ -7727,7 +7728,7 @@ def live_progress(payload: dict[str, object]) -> None: prestress_summary=prestress_summary, load_resultant={}, visualization=visualization, - solver_name="ANYsolver production FE mesh", + solver_name="ANYfeSolver production FE mesh", ) @@ -8577,7 +8578,7 @@ def run_production_fem( stress_p95_pa=0.0, displacement_max_m=0.0, diagnostics=("Production FE backend is not available.",), - solver_name="ANYsolver production FE mesh", + solver_name="ANYfeSolver production FE mesh", ) if status_callback: status_callback("Building generated geometry...") @@ -8624,7 +8625,7 @@ def run_production_fem( yield_stress=effective_yield_stress, ) diagnostics = [ - "ANYsolver production FE mesh backend.", + "ANYfeSolver production FE mesh backend.", ( "Generated shells and selected stiffener/girder shell member parts from active-line geometry." if _member_webs_as_shells(config) @@ -8778,7 +8779,7 @@ def run_production_fem( if _allow_unbalanced_free_free(config, geometry): diagnostics.append("Unbalanced free-free/nullspace static loads are explicitly allowed and will be carried as generalized balancing reactions.") if _wants_capacity_workflow(config): - diagnostics.append("Using ANYsolver structured nonlinear capacity workflow after the reference static solve.") + diagnostics.append("Using ANYfeSolver structured nonlinear capacity workflow after the reference static solve.") buckling_range = _buckling_load_factor_range(config) if float(config.buckling_shift_load_factor or 0.0) > 0.0 or buckling_range is not None or bool(config.buckling_allow_dense_fallback): diagnostics.append("Buckling validity controls are active: shift/range filtering and dense fallback are passed to the backend.") @@ -8822,7 +8823,7 @@ def run_production_fem( "rigid_lids": int(len(generated_geometry.get("rigid_lids", []))), **_mesh_size_diagnostics(generated_geometry), }, - solver_name="ANYsolver production FE mesh", + solver_name="ANYfeSolver production FE mesh", ) if _invalid_corotational_static_fracture(config): message = ( @@ -8846,7 +8847,7 @@ def run_production_fem( "nonlinear_static_kinematics": "corotational", "fracture_enabled": 1.0, }, - solver_name="ANYsolver production FE mesh", + solver_name="ANYfeSolver production FE mesh", ) model = None @@ -9005,7 +9006,7 @@ def run_production_fem( stress_p95_pa=0.0, displacement_max_m=0.0, diagnostics=tuple(diagnostics + ["Backend status: " + str(exc)]), - solver_name="ANYsolver production FE mesh", + solver_name="ANYfeSolver production FE mesh", visualization=_visualization_from_full_result(generated_geometry, model, None), ) @@ -9031,7 +9032,7 @@ def run_production_fem( diagnostics=tuple(diagnostics), mesh_info={"nodes": model.mesh.num_nodes, "shells": len(generated_geometry.get("shells", [])), "beams": len(generated_geometry.get("beams", []))}, load_resultant=_resultant_dict(load_resultant), - solver_name="ANYsolver production FE mesh", + solver_name="ANYfeSolver production FE mesh", visualization=_visualization_from_full_result(generated_geometry, model, None), ) @@ -9119,7 +9120,7 @@ def run_production_fem( if _wants_capacity_workflow(config): if status_callback: status_callback("Solving nonlinear capacity workflow...") if not hasattr(_full_backend, "run_nonlinear_capacity_workflow"): - diagnostics.append("ANYsolver capacity workflow is unavailable in this backend.") + diagnostics.append("ANYfeSolver capacity workflow is unavailable in this backend.") else: try: selected_imperfection = None @@ -9200,7 +9201,7 @@ def run_production_fem( ) plastic_strain_by_node = _nodal_engineering_plastic_strain(analysis_model, nonlinear_static_result.element_states) diagnostics.append( - "ANYsolver capacity workflow " + "ANYfeSolver capacity workflow " + str(capacity_workflow_result.status) + "; mesh mode adequacy " + str(capacity_workflow_result.mesh_adequacy.status) @@ -9210,7 +9211,7 @@ def run_production_fem( diagnostics.append(str(warning)) except Exception as exc: prestress_summary["capacity_workflow_status"] = "failed" - diagnostics.append("ANYsolver capacity workflow failed: " + str(exc)) + diagnostics.append("ANYfeSolver capacity workflow failed: " + str(exc)) if _wants_static_nonlinear_analysis(config) and capacity_workflow_result is None: nonlinear_control = _nonlinear_solution_control(config) @@ -9637,7 +9638,7 @@ class DummyBucklingResult: diagnostics + ["Runtime analysis context finalization failed: " + str(exc)] ), - solver_name="ANYsolver production FE mesh", + solver_name="ANYfeSolver production FE mesh", ) prestress_summary["runtime_analysis_context"] = analysis_context.diagnostics() phase_timings["total"] = float(time.perf_counter() - runtime_started) @@ -9681,7 +9682,7 @@ class DummyBucklingResult: prestress_summary=dict(prestress_summary or {}), load_resultant=_resultant_dict(load_resultant), visualization=visualization, - solver_name="ANYsolver production FE mesh", + solver_name="ANYfeSolver production FE mesh", ) @@ -9716,7 +9717,7 @@ def _run_flat_panel(geometry: dict, config: LightweightFEMConfig, status_callbac stress_p95_pa=0.92 * stress, displacement_max_m=displacement, buckling_factors=_sorted_positive_factors(buckling_factor, config.num_buckling_modes), - diagnostics=("ANYsolver compact solver: flat shell/beam idealization.",), + diagnostics=("ANYfeSolver compact solver: flat shell/beam idealization.",), mesh_info={"nodes": (div + 1) ** 2, "shells": div * div, "beams": int(bool(geometry.get("has_stiffener"))) + int(bool(geometry.get("has_girder")))}, prestress_summary={ "membrane_compression_pa": pressure, @@ -9760,7 +9761,7 @@ def _run_cylinder(geometry: dict, config: LightweightFEMConfig, status_callback= stress_p95_pa=0.90 * von_mises, displacement_max_m=displacement, buckling_factors=_sorted_positive_factors(buckling_factor, config.num_buckling_modes), - diagnostics=("ANYsolver compact solver: cylindrical shell membrane idealization.",), + diagnostics=("ANYfeSolver compact solver: cylindrical shell membrane idealization.",), mesh_info={"nodes": div * (axial_div + 1), "shells": div * axial_div, "beams": int(bool(geometry.get("has_stiffener"))) + int(bool(geometry.get("has_girder")))}, prestress_summary={ "hoop_stress_pa": hoop, @@ -9784,16 +9785,16 @@ def run_lightweight_fem( return _run_flat_panel(geometry, config, status_callback=status_callback) def full_backend_available() -> bool: - """Return whether the ANYsolver backend is available.""" + """Return whether the ANYfeSolver backend is available.""" return _full_backend is not None def full_backend_api() -> ModuleType: - """Return the ANYsolver backend module for future integration.""" + """Return the ANYfeSolver backend module for future integration.""" if _full_backend is None: - raise RuntimeError("The ANYsolver backend is not available.") + raise RuntimeError("The ANYfeSolver backend is not available.") return _full_backend @@ -9809,7 +9810,7 @@ def warm_fe_solver_kernels( return { "status": "backend_unavailable", "shell_orders": {}, - "message": "The ANYsolver backend warmup helper is not available.", + "message": "The ANYfeSolver backend warmup helper is not available.", } return _backend_warm_fe_solver_kernels( shell_orders, diff --git a/src/anysolver/s3_reference_batch.py b/src/anyfesolver/s3_reference_batch.py similarity index 100% rename from src/anysolver/s3_reference_batch.py rename to src/anyfesolver/s3_reference_batch.py diff --git a/src/anysolver/s3_v2c_fast_assembly.py b/src/anyfesolver/s3_v2c_fast_assembly.py similarity index 100% rename from src/anysolver/s3_v2c_fast_assembly.py rename to src/anyfesolver/s3_v2c_fast_assembly.py diff --git a/src/anysolver/s3_v2d_fast_assembly.py b/src/anyfesolver/s3_v2d_fast_assembly.py similarity index 100% rename from src/anysolver/s3_v2d_fast_assembly.py rename to src/anyfesolver/s3_v2d_fast_assembly.py diff --git a/src/anysolver/s4_validity.py b/src/anyfesolver/s4_validity.py similarity index 100% rename from src/anysolver/s4_validity.py rename to src/anyfesolver/s4_validity.py diff --git a/src/anysolver/sections.py b/src/anyfesolver/sections.py similarity index 96% rename from src/anysolver/sections.py rename to src/anyfesolver/sections.py index 394f7a307..b53e3175c 100644 --- a/src/anysolver/sections.py +++ b/src/anyfesolver/sections.py @@ -2,7 +2,7 @@ The protocols in this module are structural: future section objects from ANYmaterial or another repository can satisfy them without importing or -subclassing ANYsolver. The concrete dataclasses are convenience containers, +subclassing ANYfeSolver. The concrete dataclasses are convenience containers, not an inheritance requirement. """ diff --git a/src/anysolver/sesam_fem/__init__.py b/src/anyfesolver/sesam_fem/__init__.py similarity index 94% rename from src/anysolver/sesam_fem/__init__.py rename to src/anyfesolver/sesam_fem/__init__.py index 48c277d1d..b3e113838 100644 --- a/src/anysolver/sesam_fem/__init__.py +++ b/src/anyfesolver/sesam_fem/__init__.py @@ -1,4 +1,4 @@ -"""Compatibility facade plus the ANYfileio-to-ANYsolver model adapter.""" +"""Compatibility facade plus the ANYfileio-to-ANYfeSolver model adapter.""" from .diagnostics import FemDiagnostic, SesamFemError from .document import ( diff --git a/src/anysolver/sesam_fem/__main__.py b/src/anyfesolver/sesam_fem/__main__.py similarity index 97% rename from src/anysolver/sesam_fem/__main__.py rename to src/anyfesolver/sesam_fem/__main__.py index 673382b09..99ff683ec 100644 --- a/src/anysolver/sesam_fem/__main__.py +++ b/src/anyfesolver/sesam_fem/__main__.py @@ -14,7 +14,7 @@ def main(argv: list[str] | None = None) -> int: - parser = argparse.ArgumentParser(prog="python -m anysolver.sesam_fem") + parser = argparse.ArgumentParser(prog="python -m anyfesolver.sesam_fem") parser.add_argument("--lenient", action="store_true", help="collect diagnostics instead of failing on errors") parser.add_argument("--json", action="store_true", help="print machine-readable JSON") sub = parser.add_subparsers(dest="command", required=True) diff --git a/src/anysolver/sesam_fem/diagnostics.py b/src/anyfesolver/sesam_fem/diagnostics.py similarity index 100% rename from src/anysolver/sesam_fem/diagnostics.py rename to src/anyfesolver/sesam_fem/diagnostics.py diff --git a/src/anysolver/sesam_fem/document.py b/src/anyfesolver/sesam_fem/document.py similarity index 100% rename from src/anysolver/sesam_fem/document.py rename to src/anyfesolver/sesam_fem/document.py diff --git a/src/anysolver/sesam_fem/exporter.py b/src/anyfesolver/sesam_fem/exporter.py similarity index 100% rename from src/anysolver/sesam_fem/exporter.py rename to src/anyfesolver/sesam_fem/exporter.py diff --git a/src/anysolver/sesam_fem/importer.py b/src/anyfesolver/sesam_fem/importer.py similarity index 99% rename from src/anysolver/sesam_fem/importer.py rename to src/anyfesolver/sesam_fem/importer.py index 0513d1257..7a82ca377 100644 --- a/src/anysolver/sesam_fem/importer.py +++ b/src/anyfesolver/sesam_fem/importer.py @@ -1,4 +1,4 @@ -"""SESAM-to-ANYsolver adapter over ANYfileio's neutral semantic model.""" +"""SESAM-to-ANYfeSolver adapter over ANYfileio's neutral semantic model.""" from __future__ import annotations diff --git a/src/anysolver/sesam_fem/records.py b/src/anyfesolver/sesam_fem/records.py similarity index 100% rename from src/anysolver/sesam_fem/records.py rename to src/anyfesolver/sesam_fem/records.py diff --git a/src/anysolver/sesam_fem/schema.py b/src/anyfesolver/sesam_fem/schema.py similarity index 100% rename from src/anysolver/sesam_fem/schema.py rename to src/anyfesolver/sesam_fem/schema.py diff --git a/src/anysolver/sesam_fem/sif_importer.py b/src/anyfesolver/sesam_fem/sif_importer.py similarity index 100% rename from src/anysolver/sesam_fem/sif_importer.py rename to src/anyfesolver/sesam_fem/sif_importer.py diff --git a/src/anysolver/sesam_fem/validation.py b/src/anyfesolver/sesam_fem/validation.py similarity index 100% rename from src/anysolver/sesam_fem/validation.py rename to src/anyfesolver/sesam_fem/validation.py diff --git a/src/anysolver/sestra_deep_diagnostics.py b/src/anyfesolver/sestra_deep_diagnostics.py similarity index 100% rename from src/anysolver/sestra_deep_diagnostics.py rename to src/anyfesolver/sestra_deep_diagnostics.py diff --git a/src/anysolver/sestra_mixed_verification.py b/src/anyfesolver/sestra_mixed_verification.py similarity index 100% rename from src/anysolver/sestra_mixed_verification.py rename to src/anyfesolver/sestra_mixed_verification.py diff --git a/src/anysolver/sestra_structure_benchmarks.py b/src/anyfesolver/sestra_structure_benchmarks.py similarity index 100% rename from src/anysolver/sestra_structure_benchmarks.py rename to src/anyfesolver/sestra_structure_benchmarks.py diff --git a/src/anysolver/sestra_three_case.py b/src/anyfesolver/sestra_three_case.py similarity index 100% rename from src/anysolver/sestra_three_case.py rename to src/anyfesolver/sestra_three_case.py diff --git a/src/anysolver/sestra_verification.py b/src/anyfesolver/sestra_verification.py similarity index 99% rename from src/anysolver/sestra_verification.py rename to src/anyfesolver/sestra_verification.py index 9e4565683..3e6b8bd8e 100644 --- a/src/anysolver/sestra_verification.py +++ b/src/anyfesolver/sestra_verification.py @@ -461,7 +461,7 @@ def run_verification(manifest, output_root, *, mode="prepare"): "case_directory":str(case), "python":sys.version,"platform":platform.platform(), "source":identity(__file__), "dependencies":{}, "sampling_limitation":"arithmetic station mean; no pointwise or bending acceptance"} - for name in ("ANYsolver","ANYfileio","numpy","scipy"): + for name in ("ANYfeSolver","ANYfileio","numpy","scipy"): try: report["dependencies"][name]=importlib.metadata.version(name) except importlib.metadata.PackageNotFoundError: report["dependencies"][name]="uninstalled source" from . import assembly, elements diff --git a/src/anysolver/shell_benchmarks.py b/src/anyfesolver/shell_benchmarks.py similarity index 100% rename from src/anysolver/shell_benchmarks.py rename to src/anyfesolver/shell_benchmarks.py diff --git a/src/anysolver/shell_formulations/director_field.py b/src/anyfesolver/shell_formulations/director_field.py similarity index 100% rename from src/anysolver/shell_formulations/director_field.py rename to src/anyfesolver/shell_formulations/director_field.py diff --git a/src/anysolver/shell_formulations/geometry_provenance.py b/src/anyfesolver/shell_formulations/geometry_provenance.py similarity index 99% rename from src/anysolver/shell_formulations/geometry_provenance.py rename to src/anyfesolver/shell_formulations/geometry_provenance.py index 9f609075d..b794db4cb 100644 --- a/src/anysolver/shell_formulations/geometry_provenance.py +++ b/src/anyfesolver/shell_formulations/geometry_provenance.py @@ -562,7 +562,7 @@ def handle_kind(self, handle_index: int) -> str: def _payload(self) -> dict[str, Any]: return { - "contract": "ANYsolver.s4_geometry_handoff.v1", + "contract": "ANYfeSolver.s4_geometry_handoff.v1", "anygeometry_api": SUPPORTED_ANYGEOMETRY_API, "header": self.header.to_dict(), "entity_kind_table": list(self.entity_kind_table), @@ -611,7 +611,7 @@ def to_dict(self) -> dict[str, Any]: def from_dict(cls, payload: Mapping[str, Any]) -> "GeometryProvenanceTables": """Reconstruct neutral tables and verify their deterministic fingerprint.""" - if payload.get("contract") != "ANYsolver.s4_geometry_handoff.v1": + if payload.get("contract") != "ANYfeSolver.s4_geometry_handoff.v1": raise ValueError("unsupported neutral S4 geometry handoff contract") if payload.get("anygeometry_api") != SUPPORTED_ANYGEOMETRY_API: raise ValueError("neutral handoff declares an incompatible ANYgeometry API boundary") diff --git a/src/anysolver/shell_formulations/mitc4_plus_d_quality.py b/src/anyfesolver/shell_formulations/mitc4_plus_d_quality.py similarity index 99% rename from src/anysolver/shell_formulations/mitc4_plus_d_quality.py rename to src/anyfesolver/shell_formulations/mitc4_plus_d_quality.py index 04d27e599..dd247c087 100644 --- a/src/anysolver/shell_formulations/mitc4_plus_d_quality.py +++ b/src/anyfesolver/shell_formulations/mitc4_plus_d_quality.py @@ -281,7 +281,7 @@ def numeric_payload_fingerprint(*arrays: Iterable[float] | np.ndarray) -> str: """ digest = hashlib.sha256() - digest.update(b"ANYsolver.numeric-payload.v1\0") + digest.update(b"ANYfeSolver.numeric-payload.v1\0") for values in arrays: source = np.asarray(values) if np.issubdtype(source.dtype, np.bool_): diff --git a/src/anysolver/shell_formulations/mitc4_plus_d_reference.py b/src/anyfesolver/shell_formulations/mitc4_plus_d_reference.py similarity index 100% rename from src/anysolver/shell_formulations/mitc4_plus_d_reference.py rename to src/anyfesolver/shell_formulations/mitc4_plus_d_reference.py diff --git a/src/anysolver/shell_formulations/mitc4_plus_d_scalar.py b/src/anyfesolver/shell_formulations/mitc4_plus_d_scalar.py similarity index 100% rename from src/anysolver/shell_formulations/mitc4_plus_d_scalar.py rename to src/anyfesolver/shell_formulations/mitc4_plus_d_scalar.py diff --git a/src/anysolver/shell_formulations/protocol.py b/src/anyfesolver/shell_formulations/protocol.py similarity index 100% rename from src/anysolver/shell_formulations/protocol.py rename to src/anyfesolver/shell_formulations/protocol.py diff --git a/src/anysolver/shell_formulations/q4_common.py b/src/anyfesolver/shell_formulations/q4_common.py similarity index 100% rename from src/anysolver/shell_formulations/q4_common.py rename to src/anyfesolver/shell_formulations/q4_common.py diff --git a/src/anysolver/shell_formulations/s4_restricted_policy.py b/src/anyfesolver/shell_formulations/s4_restricted_policy.py similarity index 100% rename from src/anysolver/shell_formulations/s4_restricted_policy.py rename to src/anyfesolver/shell_formulations/s4_restricted_policy.py diff --git a/src/anysolver/shell_sections.py b/src/anyfesolver/shell_sections.py similarity index 98% rename from src/anysolver/shell_sections.py rename to src/anyfesolver/shell_sections.py index dd830b74b..39e39e53b 100644 --- a/src/anysolver/shell_sections.py +++ b/src/anyfesolver/shell_sections.py @@ -33,10 +33,10 @@ @runtime_checkable class GeneralizedShellSectionProtocol(Protocol): - """Structural contract accepted by :class:`~anysolver.ShellElement`. + """Structural contract accepted by :class:`~anyfesolver.ShellElement`. External section repositories can satisfy this protocol without importing - or subclassing ANYsolver. Optional metadata such as ``name`` and mass + or subclassing ANYfeSolver. Optional metadata such as ``name`` and mass properties is read structurally by :func:`coerce_generalized_shell_section`. """ diff --git a/src/anysolver/solid_submodel.py b/src/anyfesolver/solid_submodel.py similarity index 100% rename from src/anysolver/solid_submodel.py rename to src/anyfesolver/solid_submodel.py diff --git a/src/anysolver/static_batch.py b/src/anyfesolver/static_batch.py similarity index 99% rename from src/anysolver/static_batch.py rename to src/anyfesolver/static_batch.py index 9a01f8a0c..d0309b542 100644 --- a/src/anysolver/static_batch.py +++ b/src/anyfesolver/static_batch.py @@ -111,7 +111,7 @@ def _callable_state(function: Any, seen: Optional[set[int]] = None) -> Any: cells.append("empty") else: owned_counter = (name == "accepted_generation" and type(value) is int - and function.__module__ == "anysolver._qualified_authority_epoch" + and function.__module__ == "anyfesolver._qualified_authority_epoch" and function.__qualname__ in { "_AuthorityEpochManager.bind..require", "_AuthorityEpochManager.bind_context..require", diff --git a/src/anysolver/static_envelopes.py b/src/anyfesolver/static_envelopes.py similarity index 100% rename from src/anysolver/static_envelopes.py rename to src/anyfesolver/static_envelopes.py diff --git a/src/anysolver/stiffened_shell.py b/src/anyfesolver/stiffened_shell.py similarity index 100% rename from src/anysolver/stiffened_shell.py rename to src/anyfesolver/stiffened_shell.py diff --git a/src/anysolver/submodel_transfer.py b/src/anyfesolver/submodel_transfer.py similarity index 99% rename from src/anysolver/submodel_transfer.py rename to src/anyfesolver/submodel_transfer.py index 0e4d72b20..ecd29e4e8 100644 --- a/src/anysolver/submodel_transfer.py +++ b/src/anyfesolver/submodel_transfer.py @@ -1,6 +1,6 @@ """Sequential displacement-driven shell submodel transfer. -Implements the ANYsolver part of the submodelling contract +Implements the ANYfeSolver part of the submodelling contract (``docs/SUBMODEL_TRANSFER_CONTRACT.md``): * :func:`interpolate_nodal_field` -- evaluate a source solution at target points diff --git a/src/anysolver/test_cases.py b/src/anyfesolver/test_cases.py similarity index 100% rename from src/anysolver/test_cases.py rename to src/anyfesolver/test_cases.py diff --git a/src/anysolver/threading_policy.py b/src/anyfesolver/threading_policy.py similarity index 98% rename from src/anysolver/threading_policy.py rename to src/anyfesolver/threading_policy.py index 2a71308af..398822092 100644 --- a/src/anysolver/threading_policy.py +++ b/src/anyfesolver/threading_policy.py @@ -23,16 +23,16 @@ F = TypeVar("F", bound=Callable[..., Any]) _SOLVER_THREADS: contextvars.ContextVar[Optional[int]] = contextvars.ContextVar( - "anysolver_solver_threads", default=None + "anyfesolver_solver_threads", default=None ) _ACTIVE_NATIVE_LIMIT: contextvars.ContextVar[Optional[int]] = contextvars.ContextVar( - "anysolver_active_native_limit", default=None + "anyfesolver_active_native_limit", default=None ) _ACTIVE_NATIVE_LIMIT_OWNER: contextvars.ContextVar[Optional[int]] = contextvars.ContextVar( - "anysolver_active_native_limit_owner", default=None + "anyfesolver_active_native_limit_owner", default=None ) _ACTIVE_NATIVE_DEFAULT_OWNER: contextvars.ContextVar[Optional[int]] = contextvars.ContextVar( - "anysolver_active_native_default_owner", default=None + "anyfesolver_active_native_default_owner", default=None ) diff --git a/src/anysolver/validation.py b/src/anyfesolver/validation.py similarity index 100% rename from src/anysolver/validation.py rename to src/anyfesolver/validation.py diff --git a/src/anysolver/vectorized_beam.py b/src/anyfesolver/vectorized_beam.py similarity index 100% rename from src/anysolver/vectorized_beam.py rename to src/anyfesolver/vectorized_beam.py diff --git a/src/anysolver/vectorized_generalized_shell.py b/src/anyfesolver/vectorized_generalized_shell.py similarity index 99% rename from src/anysolver/vectorized_generalized_shell.py rename to src/anyfesolver/vectorized_generalized_shell.py index 2963260a2..e0c0b7009 100644 --- a/src/anysolver/vectorized_generalized_shell.py +++ b/src/anyfesolver/vectorized_generalized_shell.py @@ -1,6 +1,6 @@ """Compiled S4 batches for orthotropic and generalized shell sections. -The scalar :class:`~anysolver.elements.ShellElement` remains the reference +The scalar :class:`~anyfesolver.elements.ShellElement` remains the reference implementation. This module only handles four-node quadrilateral shells and keeps the same integration rules, material-axis construction, MITC4 shear field, drilling stabilization, and blockwise local/global transformation. diff --git a/src/anysolver/vectorized_hill48.py b/src/anyfesolver/vectorized_hill48.py similarity index 100% rename from src/anysolver/vectorized_hill48.py rename to src/anyfesolver/vectorized_hill48.py diff --git a/src/anysolver/vectorized_nonlinear.py b/src/anyfesolver/vectorized_nonlinear.py similarity index 97% rename from src/anysolver/vectorized_nonlinear.py rename to src/anyfesolver/vectorized_nonlinear.py index b2ed521ff..656c7baa0 100644 --- a/src/anysolver/vectorized_nonlinear.py +++ b/src/anyfesolver/vectorized_nonlinear.py @@ -1,360 +1,360 @@ -import numpy as np -from typing import Tuple, Optional, Any, Dict - -from .jit_compiler import njit -from .plasticity import plane_stress_return_map -from .elements import lobatto_layers, plane_stress_elastic_matrix -from . import _compensated_contractions as _contractions - - -def compensated_elastic_batch_zero(geometry, E, nu, G_mod, h, drilling): - """Batch coefficient realization, independent of scalar compliance/drill.""" - constitutive = plane_stress_elastic_matrix(E, nu) - return _contractions.shell_zero_tangent( - geometry, h * constitutive, h**3 / 12.0 * constitutive, - G_mod * (5.0 / 6.0) * h * np.eye(2), G_mod * h * drilling) - - -def elastic_shell_nonlinear_increment(u_elem, geometry, E, nu, h, *, tangent=True): - """Direct elastic von-Karman increment over the reference linear shell. - - Admission and input lifetime belong to the qualified caller. No state or - geometry is retained. Linear bending, shear and drill are supplied by that - caller's baseline; the geometric tangent uses the *full* membrane stress. - - The arithmetic is the reference loop in ``_compensated_contractions``; for - well-formed float64 input one fused compiled call evaluates it bit for bit, - and any refusal or unexpected layout runs the reference (and its exceptions). - """ - return _contractions.elastic_increment( - u_elem, geometry, lambda: h * plane_stress_elastic_matrix(E, nu), tangent) - - -@njit -def _jit_batch_integrate_nonlinear_response( - u_loc_batch: np.ndarray, - N_res_batch: np.ndarray, - M_res_batch: np.ndarray, - C0_batch: np.ndarray, - C1_batch: np.ndarray, - C2_batch: np.ndarray, - B_m_all_batch: np.ndarray, - B_b_all_batch: np.ndarray, - B_d_all_batch: np.ndarray, - Gw_all_batch: np.ndarray, - detw_all_batch: np.ndarray, - B_s_all_batch: np.ndarray, - detw_shear_all_batch: np.ndarray, - D_shear: np.ndarray, - drilling_stiffness: float, - tangent: bool, - has_plasticity: bool, - n_dof: int, -) -> Tuple[np.ndarray, np.ndarray]: - n_elem = u_loc_batch.shape[0] - F_loc_batch = np.zeros((n_elem, n_dof)) - K_loc_batch = np.zeros((n_elem, n_dof, n_dof)) - - n_gp = detw_all_batch.shape[1] - - for e in range(n_elem): - u_loc = u_loc_batch[e] - detw_all = detw_all_batch[e] - B_m_all = B_m_all_batch[e] - B_b_all = B_b_all_batch[e] - B_d_all = B_d_all_batch[e] - Gw_all = Gw_all_batch[e] - N_res = N_res_batch[e] - M_res = M_res_batch[e] - C0 = C0_batch[e] - C1 = C1_batch[e] - C2 = C2_batch[e] - - for g in range(n_gp): - detw = detw_all[g] - B_m = B_m_all[g] - B_b = B_b_all[g] - B_d = B_d_all[g] - Gw = Gw_all[g] - - theta_0 = 0.0 - theta_1 = 0.0 - for i in range(n_dof): - theta_0 += Gw[0, i] * u_loc[i] - theta_1 += Gw[1, i] * u_loc[i] - - B_eff = np.zeros((3, n_dof)) - for i in range(n_dof): - B_eff[0, i] = B_m[0, i] + theta_0 * Gw[0, i] - B_eff[1, i] = B_m[1, i] + theta_1 * Gw[1, i] - B_eff[2, i] = B_m[2, i] + theta_0 * Gw[1, i] + theta_1 * Gw[0, i] - - N_g = N_res[g] - M_g = M_res[g] - B_eff_T_N = np.zeros(n_dof) - B_b_T_M = np.zeros(n_dof) - for i in range(n_dof): - B_eff_T_N[i] = B_eff[0, i] * N_g[0] + B_eff[1, i] * N_g[1] + B_eff[2, i] * N_g[2] - B_b_T_M[i] = B_b[0, i] * M_g[0] + B_b[1, i] * M_g[1] + B_b[2, i] * M_g[2] - - Bd_u = 0.0 - for i in range(n_dof): - Bd_u += B_d[0, i] * u_loc[i] - - for i in range(n_dof): - F_loc_batch[e, i] += (B_eff_T_N[i] + B_b_T_M[i]) * detw - F_loc_batch[e, i] += B_d[0, i] * (drilling_stiffness * Bd_u) * detw - - if not tangent: - continue - - C0_g = C0[g] - C2_g = C2[g] - - C0_B_eff = np.zeros((3, n_dof)) - C2_B_b = np.zeros((3, n_dof)) - for r in range(3): - for c in range(n_dof): - val0 = 0.0 - val2 = 0.0 - for k in range(3): - val0 += C0_g[r, k] * B_eff[k, c] - val2 += C2_g[r, k] * B_b[k, c] - C0_B_eff[r, c] = val0 - C2_B_b[r, c] = val2 - - for r in range(n_dof): - for c in range(n_dof): - val_eff = 0.0 - val_b = 0.0 - for k in range(3): - val_eff += B_eff[k, r] * C0_B_eff[k, c] - val_b += B_b[k, r] * C2_B_b[k, c] - K_loc_batch[e, r, c] += (val_eff + val_b) * detw - - if has_plasticity: - C1_g = C1[g] - C1_B_b = np.zeros((3, n_dof)) - C1_B_eff = np.zeros((3, n_dof)) - for r in range(3): - for c in range(n_dof): - val_b = 0.0 - val_eff = 0.0 - for k in range(3): - val_b += C1_g[r, k] * B_b[k, c] - val_eff += C1_g[r, k] * B_eff[k, c] - C1_B_b[r, c] = val_b - C1_B_eff[r, c] = val_eff - - for r in range(n_dof): - for c in range(n_dof): - forward = 0.0 - reverse = 0.0 - for k in range(3): - forward += B_eff[k, r] * C1_B_b[k, c] - reverse += B_b[k, r] * C1_B_eff[k, c] - K_loc_batch[e, r, c] += (forward + reverse) * detw - - N00 = N_g[0] - N11 = N_g[1] - N01 = N_g[2] - - N_Gw_0 = N00 * Gw[0] + N01 * Gw[1] - N_Gw_1 = N01 * Gw[0] + N11 * Gw[1] - for r in range(n_dof): - for c in range(n_dof): - K_loc_batch[e, r, c] += (Gw[0, r] * N_Gw_0[c] + Gw[1, r] * N_Gw_1[c]) * detw - K_loc_batch[e, r, c] += B_d[0, r] * (drilling_stiffness * B_d[0, c]) * detw - - n_shear = detw_shear_all_batch.shape[1] - detw_shear_all = detw_shear_all_batch[e] - B_s_all = B_s_all_batch[e] - - for g in range(n_shear): - detw_s = detw_shear_all[g] - B_s = B_s_all[g] - - Bs_u_0 = 0.0 - Bs_u_1 = 0.0 - for i in range(n_dof): - Bs_u_0 += B_s[0, i] * u_loc[i] - Bs_u_1 += B_s[1, i] * u_loc[i] - - f_s_0 = D_shear[0, 0] * Bs_u_0 + D_shear[0, 1] * Bs_u_1 - f_s_1 = D_shear[1, 0] * Bs_u_0 + D_shear[1, 1] * Bs_u_1 - - for i in range(n_dof): - F_loc_batch[e, i] += (B_s[0, i] * f_s_0 + B_s[1, i] * f_s_1) * detw_s - - if not tangent: - continue - - C_s = np.zeros((2, n_dof)) - for r in range(2): - for c in range(n_dof): - C_s[r, c] = D_shear[r, 0] * B_s[0, c] + D_shear[r, 1] * B_s[1, c] - - for r in range(n_dof): - for c in range(n_dof): - K_loc_batch[e, r, c] += (B_s[0, r] * C_s[0, c] + B_s[1, r] * C_s[1, c]) * detw_s - - return F_loc_batch, K_loc_batch - - -def batch_shell_nonlinear_response( - u_elem_batch: np.ndarray, - T0_batch: np.ndarray, - B_m_all_batch: np.ndarray, - B_b_all_batch: np.ndarray, - B_d_all_batch: np.ndarray, - Gw_all_batch: np.ndarray, - detw_all_batch: np.ndarray, - B_s_all_batch: np.ndarray, - detw_shear_all_batch: np.ndarray, - E: float, - nu: float, - G_mod: float, - h: float, - drilling_stabilization: float, - tangent: bool, - curve: Any, - plastic_strain_batch: np.ndarray, - alpha_batch: np.ndarray, - num_layers: int, -) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray]: - """Computes nonlinear response for a batch of elements.""" - n_elem = u_elem_batch.shape[0] - n_dof = u_elem_batch.shape[1] - - u_loc_batch = (T0_batch @ u_elem_batch[:, :, None]).squeeze(-1) - - C_el = plane_stress_elastic_matrix(E, nu) - D_shear = G_mod * (5.0 / 6.0) * h * np.eye(2, dtype=float) - drilling_stiffness = G_mod * h * drilling_stabilization - - n_gp = detw_all_batch.shape[1] - - theta_batch = (Gw_all_batch @ u_loc_batch[:, None, :, None]).squeeze(-1) - memb_strain_batch = (B_m_all_batch @ u_loc_batch[:, None, :, None]).squeeze(-1) - memb_strain_batch += np.stack([ - 0.5 * theta_batch[..., 0]**2, - 0.5 * theta_batch[..., 1]**2, - theta_batch[..., 0] * theta_batch[..., 1] - ], axis=-1) - - curvature_batch = (B_b_all_batch @ u_loc_batch[:, None, :, None]).squeeze(-1) - - z_layers, w_layers = lobatto_layers(num_layers, h) - layer_strain = ( - memb_strain_batch[:, :, None, :] + z_layers[None, None, :, None] * curvature_batch[:, :, None, :] - ).reshape(n_elem * n_gp * num_layers, 3) - - has_plasticity = curve is not None - if not has_plasticity: - N_res_batch = memb_strain_batch @ (h * C_el).T - M_res_batch = curvature_batch @ (h**3 / 12.0 * C_el).T - C0_batch = np.broadcast_to(h * C_el, (n_elem, n_gp, 3, 3)) - C1_batch = np.zeros((n_elem, n_gp, 3, 3), dtype=float) - C2_batch = np.broadcast_to(h**3 / 12.0 * C_el, (n_elem, n_gp, 3, 3)) - ep_new = plastic_strain_batch - alpha_new = alpha_batch - else: - sigma, C_tan, ep_new, alpha_new = plane_stress_return_map( - layer_strain, - plastic_strain_batch.reshape(n_elem * n_gp * num_layers, 3), - alpha_batch.reshape(n_elem * n_gp * num_layers), - E, - nu, - curve, - compute_tangent=tangent, - ) - - ep_new = ep_new.reshape(n_elem, n_gp * num_layers, 3) - alpha_new = alpha_new.reshape(n_elem, n_gp * num_layers) - - sigma = sigma.reshape(n_elem, n_gp, num_layers, 3) - C_tan = C_tan.reshape(n_elem, n_gp, num_layers, 3, 3) - - N_res_batch, M_res_batch, C0_batch, C1_batch, C2_batch = _jit_integrate_layers( - sigma, C_tan, w_layers, z_layers, tangent - ) - - F_loc_batch, K_loc_batch = _jit_batch_integrate_nonlinear_response( - u_loc_batch, - N_res_batch, - M_res_batch, - C0_batch, - C1_batch, - C2_batch, - B_m_all_batch, - B_b_all_batch, - B_d_all_batch, - Gw_all_batch, - detw_all_batch, - B_s_all_batch, - detw_shear_all_batch, - D_shear, - drilling_stiffness, - tangent, - has_plasticity, - n_dof, - ) - - F_int_batch = (T0_batch.transpose(0, 2, 1) @ F_loc_batch[:, :, None]).squeeze(-1) - if tangent: - K_T_batch = T0_batch.transpose(0, 2, 1) @ K_loc_batch @ T0_batch - else: - K_T_batch = np.zeros((n_elem, 0, 0)) - - return F_int_batch, K_T_batch, ep_new, alpha_new, layer_strain - - -def shell_nonlinear_batch_eligible(element: Any) -> bool: - """Return whether the vectorized kernel matches the scalar shell response.""" - - return bool( - getattr(element, "legacy_nonlinear_batch_eligible", True) - and getattr(element, "_is_quadrilateral", False) - and getattr(element, "shell_section", None) is None - and not ( - getattr(element, "_is_8node", False) - and bool(getattr(element, "reduced_integration", False)) - ) - ) - - -@njit -def _jit_integrate_layers( - sigma: np.ndarray, - C_tan: np.ndarray, - w_layers: np.ndarray, - z_layers: np.ndarray, - tangent: bool, -) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray]: - n_elem, n_gp, num_layers, _ = sigma.shape - N_res_batch = np.zeros((n_elem, n_gp, 3)) - M_res_batch = np.zeros((n_elem, n_gp, 3)) - C0_batch = np.zeros((n_elem, n_gp, 3, 3)) - C1_batch = np.zeros((n_elem, n_gp, 3, 3)) - C2_batch = np.zeros((n_elem, n_gp, 3, 3)) - - for e in range(n_elem): - for g in range(n_gp): - for l in range(num_layers): - w = w_layers[l] - z = z_layers[l] - wz = w * z - wz2 = wz * z - for i in range(3): - N_res_batch[e, g, i] += w * sigma[e, g, l, i] - M_res_batch[e, g, i] += wz * sigma[e, g, l, i] - - if tangent: - for i in range(3): - for j in range(3): - val = C_tan[e, g, l, i, j] - C0_batch[e, g, i, j] += w * val - C1_batch[e, g, i, j] += wz * val - C2_batch[e, g, i, j] += wz2 * val - - return N_res_batch, M_res_batch, C0_batch, C1_batch, C2_batch +import numpy as np +from typing import Tuple, Optional, Any, Dict + +from .jit_compiler import njit +from .plasticity import plane_stress_return_map +from .elements import lobatto_layers, plane_stress_elastic_matrix +from . import _compensated_contractions as _contractions + + +def compensated_elastic_batch_zero(geometry, E, nu, G_mod, h, drilling): + """Batch coefficient realization, independent of scalar compliance/drill.""" + constitutive = plane_stress_elastic_matrix(E, nu) + return _contractions.shell_zero_tangent( + geometry, h * constitutive, h**3 / 12.0 * constitutive, + G_mod * (5.0 / 6.0) * h * np.eye(2), G_mod * h * drilling) + + +def elastic_shell_nonlinear_increment(u_elem, geometry, E, nu, h, *, tangent=True): + """Direct elastic von-Karman increment over the reference linear shell. + + Admission and input lifetime belong to the qualified caller. No state or + geometry is retained. Linear bending, shear and drill are supplied by that + caller's baseline; the geometric tangent uses the *full* membrane stress. + + The arithmetic is the reference loop in ``_compensated_contractions``; for + well-formed float64 input one fused compiled call evaluates it bit for bit, + and any refusal or unexpected layout runs the reference (and its exceptions). + """ + return _contractions.elastic_increment( + u_elem, geometry, lambda: h * plane_stress_elastic_matrix(E, nu), tangent) + + +@njit +def _jit_batch_integrate_nonlinear_response( + u_loc_batch: np.ndarray, + N_res_batch: np.ndarray, + M_res_batch: np.ndarray, + C0_batch: np.ndarray, + C1_batch: np.ndarray, + C2_batch: np.ndarray, + B_m_all_batch: np.ndarray, + B_b_all_batch: np.ndarray, + B_d_all_batch: np.ndarray, + Gw_all_batch: np.ndarray, + detw_all_batch: np.ndarray, + B_s_all_batch: np.ndarray, + detw_shear_all_batch: np.ndarray, + D_shear: np.ndarray, + drilling_stiffness: float, + tangent: bool, + has_plasticity: bool, + n_dof: int, +) -> Tuple[np.ndarray, np.ndarray]: + n_elem = u_loc_batch.shape[0] + F_loc_batch = np.zeros((n_elem, n_dof)) + K_loc_batch = np.zeros((n_elem, n_dof, n_dof)) + + n_gp = detw_all_batch.shape[1] + + for e in range(n_elem): + u_loc = u_loc_batch[e] + detw_all = detw_all_batch[e] + B_m_all = B_m_all_batch[e] + B_b_all = B_b_all_batch[e] + B_d_all = B_d_all_batch[e] + Gw_all = Gw_all_batch[e] + N_res = N_res_batch[e] + M_res = M_res_batch[e] + C0 = C0_batch[e] + C1 = C1_batch[e] + C2 = C2_batch[e] + + for g in range(n_gp): + detw = detw_all[g] + B_m = B_m_all[g] + B_b = B_b_all[g] + B_d = B_d_all[g] + Gw = Gw_all[g] + + theta_0 = 0.0 + theta_1 = 0.0 + for i in range(n_dof): + theta_0 += Gw[0, i] * u_loc[i] + theta_1 += Gw[1, i] * u_loc[i] + + B_eff = np.zeros((3, n_dof)) + for i in range(n_dof): + B_eff[0, i] = B_m[0, i] + theta_0 * Gw[0, i] + B_eff[1, i] = B_m[1, i] + theta_1 * Gw[1, i] + B_eff[2, i] = B_m[2, i] + theta_0 * Gw[1, i] + theta_1 * Gw[0, i] + + N_g = N_res[g] + M_g = M_res[g] + B_eff_T_N = np.zeros(n_dof) + B_b_T_M = np.zeros(n_dof) + for i in range(n_dof): + B_eff_T_N[i] = B_eff[0, i] * N_g[0] + B_eff[1, i] * N_g[1] + B_eff[2, i] * N_g[2] + B_b_T_M[i] = B_b[0, i] * M_g[0] + B_b[1, i] * M_g[1] + B_b[2, i] * M_g[2] + + Bd_u = 0.0 + for i in range(n_dof): + Bd_u += B_d[0, i] * u_loc[i] + + for i in range(n_dof): + F_loc_batch[e, i] += (B_eff_T_N[i] + B_b_T_M[i]) * detw + F_loc_batch[e, i] += B_d[0, i] * (drilling_stiffness * Bd_u) * detw + + if not tangent: + continue + + C0_g = C0[g] + C2_g = C2[g] + + C0_B_eff = np.zeros((3, n_dof)) + C2_B_b = np.zeros((3, n_dof)) + for r in range(3): + for c in range(n_dof): + val0 = 0.0 + val2 = 0.0 + for k in range(3): + val0 += C0_g[r, k] * B_eff[k, c] + val2 += C2_g[r, k] * B_b[k, c] + C0_B_eff[r, c] = val0 + C2_B_b[r, c] = val2 + + for r in range(n_dof): + for c in range(n_dof): + val_eff = 0.0 + val_b = 0.0 + for k in range(3): + val_eff += B_eff[k, r] * C0_B_eff[k, c] + val_b += B_b[k, r] * C2_B_b[k, c] + K_loc_batch[e, r, c] += (val_eff + val_b) * detw + + if has_plasticity: + C1_g = C1[g] + C1_B_b = np.zeros((3, n_dof)) + C1_B_eff = np.zeros((3, n_dof)) + for r in range(3): + for c in range(n_dof): + val_b = 0.0 + val_eff = 0.0 + for k in range(3): + val_b += C1_g[r, k] * B_b[k, c] + val_eff += C1_g[r, k] * B_eff[k, c] + C1_B_b[r, c] = val_b + C1_B_eff[r, c] = val_eff + + for r in range(n_dof): + for c in range(n_dof): + forward = 0.0 + reverse = 0.0 + for k in range(3): + forward += B_eff[k, r] * C1_B_b[k, c] + reverse += B_b[k, r] * C1_B_eff[k, c] + K_loc_batch[e, r, c] += (forward + reverse) * detw + + N00 = N_g[0] + N11 = N_g[1] + N01 = N_g[2] + + N_Gw_0 = N00 * Gw[0] + N01 * Gw[1] + N_Gw_1 = N01 * Gw[0] + N11 * Gw[1] + for r in range(n_dof): + for c in range(n_dof): + K_loc_batch[e, r, c] += (Gw[0, r] * N_Gw_0[c] + Gw[1, r] * N_Gw_1[c]) * detw + K_loc_batch[e, r, c] += B_d[0, r] * (drilling_stiffness * B_d[0, c]) * detw + + n_shear = detw_shear_all_batch.shape[1] + detw_shear_all = detw_shear_all_batch[e] + B_s_all = B_s_all_batch[e] + + for g in range(n_shear): + detw_s = detw_shear_all[g] + B_s = B_s_all[g] + + Bs_u_0 = 0.0 + Bs_u_1 = 0.0 + for i in range(n_dof): + Bs_u_0 += B_s[0, i] * u_loc[i] + Bs_u_1 += B_s[1, i] * u_loc[i] + + f_s_0 = D_shear[0, 0] * Bs_u_0 + D_shear[0, 1] * Bs_u_1 + f_s_1 = D_shear[1, 0] * Bs_u_0 + D_shear[1, 1] * Bs_u_1 + + for i in range(n_dof): + F_loc_batch[e, i] += (B_s[0, i] * f_s_0 + B_s[1, i] * f_s_1) * detw_s + + if not tangent: + continue + + C_s = np.zeros((2, n_dof)) + for r in range(2): + for c in range(n_dof): + C_s[r, c] = D_shear[r, 0] * B_s[0, c] + D_shear[r, 1] * B_s[1, c] + + for r in range(n_dof): + for c in range(n_dof): + K_loc_batch[e, r, c] += (B_s[0, r] * C_s[0, c] + B_s[1, r] * C_s[1, c]) * detw_s + + return F_loc_batch, K_loc_batch + + +def batch_shell_nonlinear_response( + u_elem_batch: np.ndarray, + T0_batch: np.ndarray, + B_m_all_batch: np.ndarray, + B_b_all_batch: np.ndarray, + B_d_all_batch: np.ndarray, + Gw_all_batch: np.ndarray, + detw_all_batch: np.ndarray, + B_s_all_batch: np.ndarray, + detw_shear_all_batch: np.ndarray, + E: float, + nu: float, + G_mod: float, + h: float, + drilling_stabilization: float, + tangent: bool, + curve: Any, + plastic_strain_batch: np.ndarray, + alpha_batch: np.ndarray, + num_layers: int, +) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray]: + """Computes nonlinear response for a batch of elements.""" + n_elem = u_elem_batch.shape[0] + n_dof = u_elem_batch.shape[1] + + u_loc_batch = (T0_batch @ u_elem_batch[:, :, None]).squeeze(-1) + + C_el = plane_stress_elastic_matrix(E, nu) + D_shear = G_mod * (5.0 / 6.0) * h * np.eye(2, dtype=float) + drilling_stiffness = G_mod * h * drilling_stabilization + + n_gp = detw_all_batch.shape[1] + + theta_batch = (Gw_all_batch @ u_loc_batch[:, None, :, None]).squeeze(-1) + memb_strain_batch = (B_m_all_batch @ u_loc_batch[:, None, :, None]).squeeze(-1) + memb_strain_batch += np.stack([ + 0.5 * theta_batch[..., 0]**2, + 0.5 * theta_batch[..., 1]**2, + theta_batch[..., 0] * theta_batch[..., 1] + ], axis=-1) + + curvature_batch = (B_b_all_batch @ u_loc_batch[:, None, :, None]).squeeze(-1) + + z_layers, w_layers = lobatto_layers(num_layers, h) + layer_strain = ( + memb_strain_batch[:, :, None, :] + z_layers[None, None, :, None] * curvature_batch[:, :, None, :] + ).reshape(n_elem * n_gp * num_layers, 3) + + has_plasticity = curve is not None + if not has_plasticity: + N_res_batch = memb_strain_batch @ (h * C_el).T + M_res_batch = curvature_batch @ (h**3 / 12.0 * C_el).T + C0_batch = np.broadcast_to(h * C_el, (n_elem, n_gp, 3, 3)) + C1_batch = np.zeros((n_elem, n_gp, 3, 3), dtype=float) + C2_batch = np.broadcast_to(h**3 / 12.0 * C_el, (n_elem, n_gp, 3, 3)) + ep_new = plastic_strain_batch + alpha_new = alpha_batch + else: + sigma, C_tan, ep_new, alpha_new = plane_stress_return_map( + layer_strain, + plastic_strain_batch.reshape(n_elem * n_gp * num_layers, 3), + alpha_batch.reshape(n_elem * n_gp * num_layers), + E, + nu, + curve, + compute_tangent=tangent, + ) + + ep_new = ep_new.reshape(n_elem, n_gp * num_layers, 3) + alpha_new = alpha_new.reshape(n_elem, n_gp * num_layers) + + sigma = sigma.reshape(n_elem, n_gp, num_layers, 3) + C_tan = C_tan.reshape(n_elem, n_gp, num_layers, 3, 3) + + N_res_batch, M_res_batch, C0_batch, C1_batch, C2_batch = _jit_integrate_layers( + sigma, C_tan, w_layers, z_layers, tangent + ) + + F_loc_batch, K_loc_batch = _jit_batch_integrate_nonlinear_response( + u_loc_batch, + N_res_batch, + M_res_batch, + C0_batch, + C1_batch, + C2_batch, + B_m_all_batch, + B_b_all_batch, + B_d_all_batch, + Gw_all_batch, + detw_all_batch, + B_s_all_batch, + detw_shear_all_batch, + D_shear, + drilling_stiffness, + tangent, + has_plasticity, + n_dof, + ) + + F_int_batch = (T0_batch.transpose(0, 2, 1) @ F_loc_batch[:, :, None]).squeeze(-1) + if tangent: + K_T_batch = T0_batch.transpose(0, 2, 1) @ K_loc_batch @ T0_batch + else: + K_T_batch = np.zeros((n_elem, 0, 0)) + + return F_int_batch, K_T_batch, ep_new, alpha_new, layer_strain + + +def shell_nonlinear_batch_eligible(element: Any) -> bool: + """Return whether the vectorized kernel matches the scalar shell response.""" + + return bool( + getattr(element, "legacy_nonlinear_batch_eligible", True) + and getattr(element, "_is_quadrilateral", False) + and getattr(element, "shell_section", None) is None + and not ( + getattr(element, "_is_8node", False) + and bool(getattr(element, "reduced_integration", False)) + ) + ) + + +@njit +def _jit_integrate_layers( + sigma: np.ndarray, + C_tan: np.ndarray, + w_layers: np.ndarray, + z_layers: np.ndarray, + tangent: bool, +) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray]: + n_elem, n_gp, num_layers, _ = sigma.shape + N_res_batch = np.zeros((n_elem, n_gp, 3)) + M_res_batch = np.zeros((n_elem, n_gp, 3)) + C0_batch = np.zeros((n_elem, n_gp, 3, 3)) + C1_batch = np.zeros((n_elem, n_gp, 3, 3)) + C2_batch = np.zeros((n_elem, n_gp, 3, 3)) + + for e in range(n_elem): + for g in range(n_gp): + for l in range(num_layers): + w = w_layers[l] + z = z_layers[l] + wz = w * z + wz2 = wz * z + for i in range(3): + N_res_batch[e, g, i] += w * sigma[e, g, l, i] + M_res_batch[e, g, i] += wz * sigma[e, g, l, i] + + if tangent: + for i in range(3): + for j in range(3): + val = C_tan[e, g, l, i, j] + C0_batch[e, g, i, j] += w * val + C1_batch[e, g, i, j] += wz * val + C2_batch[e, g, i, j] += wz2 * val + + return N_res_batch, M_res_batch, C0_batch, C1_batch, C2_batch diff --git a/src/anysolver/vectorized_stiffness.py b/src/anyfesolver/vectorized_stiffness.py similarity index 100% rename from src/anysolver/vectorized_stiffness.py rename to src/anyfesolver/vectorized_stiffness.py diff --git a/tests/_e4_pl_s3_native_trial.py b/tests/_e4_pl_s3_native_trial.py index 289a24180..ef0e9a033 100644 --- a/tests/_e4_pl_s3_native_trial.py +++ b/tests/_e4_pl_s3_native_trial.py @@ -6,7 +6,7 @@ import numpy as np -from anysolver._native_rotation_state import ( +from anyfesolver._native_rotation_state import ( NativeElementRotationView, NativeRotationStateStore, create_native_rotation_state_store, diff --git a/tests/_s3_angle_fixtures.py b/tests/_s3_angle_fixtures.py index 6a5084945..4f3aa055b 100644 --- a/tests/_s3_angle_fixtures.py +++ b/tests/_s3_angle_fixtures.py @@ -195,8 +195,8 @@ def build_default_s3( ): """Build a one-element mesh and the *default* three-node shell element.""" - from anysolver.elements import create_shell_element - from anysolver.fe_core import FEMesh, Material + from anyfesolver.elements import create_shell_element + from anyfesolver.fe_core import FEMesh, Material mesh = FEMesh() for node_id, xyz in zip((1, 2, 3), coordinates): diff --git a/tests/b3_e4_l1_installed_probe.py b/tests/b3_e4_l1_installed_probe.py index 5d05195f3..e1506b21b 100644 --- a/tests/b3_e4_l1_installed_probe.py +++ b/tests/b3_e4_l1_installed_probe.py @@ -33,15 +33,15 @@ def main() -> None: raise ValueError("exact source commit required") sys.path.insert(0, str(site)) - import anysolver + import anyfesolver import numpy as np import scipy from threadpoolctl import threadpool_info - from anysolver._stiffened_shell_l1_assembly_experimental import SPACE_A, SPACE_B + from anyfesolver._stiffened_shell_l1_assembly_experimental import SPACE_A, SPACE_B - imported = Path(anysolver.__file__).resolve(strict=True) + imported = Path(anyfesolver.__file__).resolve(strict=True) if site not in imported.parents: - raise RuntimeError("installed ANYsolver was not imported") + raise RuntimeError("installed ANYfeSolver was not imported") test_file = Path(__file__).with_name( "test_stiffened_shell_l1_assembly_experimental.py") spec = importlib.util.spec_from_file_location("l1_installed_checks", test_file) diff --git a/tests/b3_ge_g7_installed_probe.py b/tests/b3_ge_g7_installed_probe.py index 635128303..9505a53df 100644 --- a/tests/b3_ge_g7_installed_probe.py +++ b/tests/b3_ge_g7_installed_probe.py @@ -65,12 +65,12 @@ def main() -> int: raise RuntimeError("invalid frozen solver identity") import numpy as np - import anysolver - from anysolver import b3_ge - from anysolver.boundary import BoundaryCondition - from anysolver.elements import ELEMENT_TYPES, QuadraticBeamElement, create_element + import anyfesolver + from anyfesolver import b3_ge + from anyfesolver.boundary import BoundaryCondition + from anyfesolver.elements import ELEMENT_TYPES, QuadraticBeamElement, create_element - origin = Path(anysolver.__file__).resolve(strict=True) + origin = Path(anyfesolver.__file__).resolve(strict=True) if site not in origin.parents: raise RuntimeError("ANYSolver was not imported from the installed target") if b3_ge.SELECTOR != "b3-ge" or b3_ge.NAME != "B3-GE": @@ -155,7 +155,7 @@ def main() -> int: "commit": anyfem_commit, "tree": anyfem_tree, }, - "anysolver": {"commit": args.solver_commit, "tree": args.solver_tree}, + "anyfesolver": {"commit": args.solver_commit, "tree": args.solver_tree}, "anystructure": { "adapter_sha256": file_sha(anystructure_root / "anystruct/ge_beam3_optin.py"), "commit": anystructure_commit, diff --git a/tests/benchmark_general_contact_q4_s3_jet2.py b/tests/benchmark_general_contact_q4_s3_jet2.py index 45021dc23..42235774b 100644 --- a/tests/benchmark_general_contact_q4_s3_jet2.py +++ b/tests/benchmark_general_contact_q4_s3_jet2.py @@ -10,7 +10,7 @@ sys.path.insert(0, str(Path(__file__).resolve().parents[1]/"src")) -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactPathControl, ContactPathProgram, solve_static_nonlinear, ) diff --git a/tests/data/confirmed_f2_replay.npz b/tests/data/confirmed_f2_replay.npz new file mode 100644 index 0000000000000000000000000000000000000000..d2752ac821e98552c69582561016fa31d1339f59 GIT binary patch literal 214100 zcmV($K;yqqO9KQg000080000X00mJ5Hvj+s|NsC0{|NvT0AgWtX>%@aaCrd$5CAw@ z0{{R3003q}0{{R3005kt_dgKc_s1!Fm0ck_nHiPLdy#C}duNC25lLhgDzZvs6;gzd zajy}wLbfPdNmgdY_x<@7zW2BLdOYqA=iGDddA=Txo1|^1rDIA+;7<_DXYb&1!<$c< zgHP7+3ZD=MpW`iWUvFCv>s#LT4*%1y*}C~S{HOak+j=_uw?8i?Au1`vAuh%*#Bqn? z|FtMK2TCs%=e|O5{meq@l6Bw#7nModtv>M6r19M0LN{_u5->;;Yyn5-3oIh9zXp0) z7c+3e6ry})R-;+*78Txd_PqD)H;_yTvvS!VKn=fsvqdu?)a*SNA|%&}0xqQdOxJw{ zmVUjCb*|4w$`$$b`d@p%REEaXBd7>WyGE6-EJR*b^I!G8^4FO|iK7o;XwS5NT5X)_aiPW&zn z>$C@c8M$zsA>JSQkJ{F#|CGX7iY}xonud74l=@Q?ksFryyOvn<)(MZ~U1XwVGsW`* zcC$(El;P+g54Ea=1N6yYo$?GYfK1ox+8=0Y!TvMdCYCPNI5fuidxJI-8SB_i> z6VAN9_>sv6rtEnJ7H#NbtA9T`opvoTRhS(oE~eET0q-300B24*d`2ku zDD=c3x^eA~R!-k>ywG#~@h9;$R3pl0PtC>#Sw7Sm<+yKw-jd&zGzTQm`a7tjGs-RBq=5PMLq^{# zH^6PfPnc(Q6%DvNiHqqx1h$&Pceb=P0g;^>oo`VGdhSOaqyK0ZM1JXIy{nuLEFTS1 zJTy5%!EImt@22#k_)h|IDPk?)boj3?(`XY_K=;9f2UFk(J<`k)-3HcsmZF0bYoK=N zl$b{Y5hgM%5mSD=1avH9zO3+$Ad$4qqaejhv~EVe^(2!Rk`wC0aK0V}3S8U%UXjeu zHb#+CjQJ-ryY4uUqI(?9#PHAo=W1XO?Nih6f*kHJPVdP5p}`uZ2UTa`0eG&>oIUz& z3vrqGNUklfBlX1Ozrp91(FiejzLdcaU?i^)Nb+_E+#jY_9pO5?X@XWf^Z z%yDwTA3=B|0@ImJQG{g6!6x?Plf~Q$_$ZC}EFhPL=~q2nJO3)f>~l2LrPK^i`(|<$ z*C|n0_JXvhl#Lnd-u>2mB~2ffibNf{R9=9zdlDPMNrG^+PIF$mSOr&QULm}^Z2-CZ zeY-tKU!%2cDFt=qV#FMgJKeNo41UyQW^MQvf~3Vxt-`Q7sJK;dE!qABBB=OjG^F(c zY?9Om9VDlKAhv+Ux9TyV1+#XrWjq5+B2Ajo0rtS$^vL|>@@*8+Xp^0!9}m=j-P>L* zyaUcLj{t3lXprs1E8RL(iP$S5zyGc;0U?&p_suRm5&VsE{&Cdtk8@e^{iJw;n)?JCR_llUPqKqpR7hzxoO2-n@Q;BI~%66 zoVlpluqveGQX#4(aC^wOlZDbL`Pv5Q*kBZ8dd>YuJWy8kY|@0w5g4*-bm9yD3kU`$ zX52+MF?n(4Z$tBZZTQ zl#1rB_}i0sLx16CvZyEwEP|$$fBB(*fB^1xJ7PLa4t&dre=^DvMu;d*Yw2}2{M@c6wh}+Z=zbi z6PDT|xASI~ce(GOPV=e{)s{EFW6H5+#PWkw&uQ558*&hH9KL zKyl}Z)D4Wi0abogtrK++cpUQXeEM%+AacXrH$hVu1l|4Bm(84xUXHnHxvd8yjtlqi zG2U`Tlk^0Q>G%m!^Z)*`y&wy1{~azL8jA*GyF3KCGp3+}zi2blAsubFY8|{VK94Bk zuav6KW`MUmmkg&*JOZBOZ1m^mpMrJrnUJrB@gSkWx-MN?A3gV0djT2lfs#pLp4xz0 z00;X|TX}h+ zi>0*#F?;hH@7Z&Judd>Ohu#P9$2#tH@t;0$#2x9`X@fwR^yRXQg)l_w9DBHa9HYC; zyQz@{`Dje39YiFnBHZx_Bt?a^1)u8xvl^ok304?6#@cWMjQmF5 zf{kDP3-3j?4R80}&^LgJAiqpK;a+4&^*uyuWg5h93V;30SqB)kh;-eW+R<_Ifmaeb z4S@MVr$ph;d2rJEg>sf;6Dn&*GeO(MsN8~Kuzg@0eDtl=(jRXHPWs{=BMco#^`-w* z`XEMeX9ReexvN2^yHtPc^I4?-glstORXbW1{Tmrf^%Ct3w`}=FwjzQDN&FEy)8Jw1 z(k(H)5VW`7ut9!15_DB3%e+IGh;Mk@~ZwP~wvk$ka)0@g1)+=)0sLywjKsF15H%@YX&8dhr@G zmwCewMONpG$5$EnbR>R&5UJzH!u6|8n(A<+w!DLoRu!LRs!x5ntAj~A3pvH(WN``o zAoD{naj0$;afLNR9y^q*TPBYlgA12#kG#o^$knHGO2dXxkF)CWmVVl!{r?OW1O9*aY%~;=;|`*{^OOVV1<1f zvU9MZDZJ>!06z>fzTl!XW-I?VA6eWv{jx!G_iAxoS%&7X zi8rSa+o!s(8Bh`O(yOmiaB$#(i2!P4S6)n3^mXD*$1mWxbpO1{&Q;to{B5)J#TA(P zMNe*VA3`Ie9}BE3m!W98assb|6!!aLv`)%G3!le)IOO;$jvu~VVS5-VjUBRn>O_;U zVY$Ag;?(*J@MxzzQ(r|GmcE&(IVCKEyBs^0cO@03>WU8gjt8w=aqzip`46u%gtXzu%yef){u@4Ml{MX9)~BOG)tZBMG_hu zxVo2jTy+y!n0A#e38HT$ii0{ z%P<^I>3&NHXQcT|L)aytsUwwBNZC~!ewuL0B1Ip27ln&tE*ZkeE$bW8{`A;vRz*Fg z>IA%0-#gX8$_Tk*x|`@*Bq3|B|CJ&eJ@|5dGx^dFOSqZTZ8T^Nu%}A-+P04x&S&0J z@!vOs@pARw)rl_u7vIo>=cF>2$~a!JRX`3aB)Y90JFAC@|D$g^$d1ojp1Zqdt%-+b z{%MuPGQf^LCb}PY)(*+Egh#kJmopz^beA0%^)sZ;kLXOJ~4`}RTNHq zHk5+b&W$^JLJqtZcGYn|BMI#ema@dYV1gwb(XBh}GEn1rFh3>NCZc#`1~{F`Lkb9jI{FqsOcNEg9~4&4?cW+giI!v0r;2K=89!7ESc$>JS;gX^@P%Sbl1KwqPW5>xFG z+AUWJ{Ix|0*%gdfDXx=2i@#d$XHQUJmy2TYNt0{9EcE^g-*YBt^PJrIC)FVM#qVrI zLUaTSSQ2a#oHv21(WI4pdNml#xTn>*z6zGkJ1{3pQ^0aE@%vYv9>c_r*}O_mMv&Dpw z`Qe|B4kd?{rA`mq7moraJN+wvC|rW@RhIy#vj zf0G|q_$j14K!NPXS?B4OR~uL*^%vKA4(0h}d2J2HTu^`*`Q3mERbZ6wbn#1rKsc6RKC)35~_@SlG!7B4=K`GYwcWU1ep8mWa{T&@acZtrs(;{AikV3?p@(K zWaAW+dDQ<7{H=Xi-F>zRU~?`;{H+8?{)==lxSxlNRGzpBR97K$k273$BQMaID1w2L z&jNvc@VoN#kO!bos-5Hgh#7DnJwsUg@+IQqcX~nQlL>70Hz!!A6`+60@P=%?0Az@q zAF=f2#ZyI2pJv@JV~M(ZSIth5!P19&ooA=6K;>Bz+21b|Fw+w=SD|idJQ~pZ)4xU* z>c*H8+b&&%JE|!c_V&(UnVy)oYGOVZ=ln(5ew+t>w_(BJ9Rhfo@jj*P+!U%j9u`t? zTpWAm3>lmZ;K1h|Quz6u7lgG7GE~#4+&KBhIc=VVbu{iq7F<9~1P^&7gfrSsV7lB| z#)vpRyfD+mW|72$MTzIrOwMB&*NN|+S0ZHa(t}CSo0ej2i*K8;X}(s4C&JgowYQD z@z48_ybG5Yp$(Ta#dz2@us1yWbhwWbuYFH2BmPYUkB90zT;=1ysUCLW6Y&Hv+j(Xt zGqxWkmN(5OR_7ryFHMmv_qqW?1l8(p!Z12e)>t--odI=m$L|TQd`2!tappJY$B^{> zAMEd83s5;|@10;80a}5k>Wzv;po#j|R(?u00I%<;`L7_bBf9@za%aHJ?z|eMIIT)P#;sa?X@{SAzPi2@%2WQcxa0y zf@VYc#k-G0F_bTT-W|z{RYpcn#|R#WT(vFY{?=z;wXZhE__gy;rJbjb_a6~H&hudlU|IEbNeyFNk-g@HZMVwEFR#`2^PZ z$n`Vj`EhtlZ8B+tWeafHx6!+$p2Fstv(EQ7*>S(`AScnHIBq@=pOxU*LJTAH!Uon7 zxQa0pb2ps9{Kg7v&Y8!+>L&F z?*t;~ra!-+4MA^M40D;pZP4uetH4|)9gss4s#rN~3z`IZSEyo50QvYI_PRqyz-75( zXb>BO1U>Ed+$nFOU1@&O6G;xhY`-U#+sGEUzn{6@_1F$&>l{3>JgEp);+vBLl0v|N zf^`z#2PecR$E8hi@h-X=&q0^(oPwUdx_I{J)KmQoFPFlHtn2&@n3DwGL z*MZ6Q!1woMOM$Kb&4&wLOHfeL0?D`7bi}p1M;ibSQ^d#x^>{sZKRLJ;BQaqX% z84u#IYzDE<`5eg1Q<326OUvOGWr*Fqt&i8C6@5KqPG5b|3CwlxHpbq13fyLVoL)Kg zp+BUN`wxXOP=vD(aYAr05=<$**X(g0kcl4gn9}qD)v2IooJNBn_VCOMfk-P74EsyC znBIWsWHKYALVLk%a7Omm--Bq_Dvw)LdQy=Nc~qp z_G=Uej2ayK^O0^5gxLN*nz3ibbMM~x!f_H@XffeA;X#XC#RiaY3XfcQwzD#sU3-O!nJvoY8uK|GSlu zFkr*+_p1rw_6;j3Em$;U zn9=HD04JUaI{ZtxflqIzY#uc6;ghFJREo|({9TQ??c%UL{-M4rB)n&Z`6cu&kAZ>&EH5Xlqz$e&0Aa&jH_#2fTFSJ8E`V2^6`MK+x@h_~SIFO+s>sXKLEebFui==TUL>oz0-~EqaPd@3R$F_jb%#8~TYXYB|<-J!bR^UuSKUct!92knQqEzrzK@GwzHjVep z(Ve29D6<<_el0S7e9}D-)kc_f4Ew~RFy&7RDq)ErDsW&Z=AJLGILUjqZ9oNFzFB)= z(lG&SbLr>0C72O+M#xK$HA z*^GRqiiVed^@0l>ksh|4ZPL>a&*e>>-#H(P|wW3q}ML{zVG8vPjfHv#QnE3n_-Y?W18cM6X7obpLWE zfa!kL%GPdA5G_;iF8zW7a;B1`8IcqQ>r>W$zrTBg%+4u28{P3iJ{vsRdVzO=(!H$k z=nOwZwzi*t6mJS#)hb_AdxfGr9@4y%1zw2SzU}yy;(c)Cxz;azvsfVa^Gw`qMH5Pn z6s;RI!sy=K`Yw0&M{uX5ndhEH3ur&7c*o^MGqPa*E&VV*4<%acuc-ADq7zs38}E_6 zLEhOr^Rg1z$gfgLIc>WMFt~iIJ7-*oI9D{E$_|%;kA;i9xyuz`Ns_RbA2b7wn$;gB zZmHn9Qj)EgU>Xvu@qecGxfZEy@?|ONR->($BsTfJX7rc2S8K8SC6X8FFUwI@Mk}K&402I}lZ+293*~6Sr@Z~P4BM)hC2C=OBSH?} z+2mj}F6V?(7fNUET_A@Ik-ImWOPpZzpK_^THfPLo`p0wr8Fkns@=Wa`p%u1@Iib=l zY=!3tG}9vaw4mr?mFW9+x{&fzc0~o78Z0XJ^qRaT2WObu-j6YvV;Rn|Rd!lEI9V|6 z(epGPu*_^oAL$X`b*DX!zZ=z_%!L!<6B zbjtgv^`Gzp*jjpfjxXjX@(!szRXIwArMwqr692ZKB~gYYMHVtx>`=7tA-M!NBp3Zq z!4~=~#qs)sSuT=s$VvE|mH}MdZ~Qsl6%8(&<9OImPb`O zdh_jTi`46Ez@(;2lfv={IShRKFn2m1d3P;tGC#-%-Fr@AeV#dpOwyNKAm$NB2+uHe zCVK?PE}q+`%YBXh7!;m3ICToT|Ke(IIC&D2*OK-|7i^$@&1;`HOu1no!I9pHDmu6? zzBDfXof|i?55!RhorZU2-UYk;I{{x@VQ!iF&WIas+;0+O7QxXf&DuTE)X?pBdd96f zK6p`OMWf`90iJlW8AYGO4Rb$6FUGDOAQd|k9i%A@)j8CYn*CUC-*WLr8{r@zdEQn3 zd+;=t4q$piHOmPJMDuz^Xiveo?oHlr^vxhkZ0Nm}_6)eEOtxqAY92_48j~jq*Mach zKz7>Deq`?Q+r?G76kK(lyy7l64$g7+IR`(UNA7}YEL41dfZw497bC?NlwW9ktU|dT zTuNk6$ZIb_y@TEMp4^#e^1^1~75REVY1M-YrRI?Or`j6E*3ZCLBed}!K^wR>c`-Ej zZZp_u*0H?%x&k=8+oCR2Z$kE&>x#`PJ&05@Kl|yMH9%YM5SsGzA7bOIzC_TmJs5k!uj45K1jJK1>a^>GdiDxegq~?4F_bc=QMou426{7VX_8J{Vgum=b?i28Zq2JbF^f1kaZ6 zL}zPT!!zICjlSE^gl;wMVnvlQm`iVtA+ALW@~5P7$XwvW6(E(!K=39Wpq3V`jdzA$ zoB+Y0jyU{%eUah#IZL>>6nHFA(iF}=nCbSYBEs`t(Jw#tIN(ryv!U6~J;*XRMfYOrDJ+z$caDL>{K^f>pcW+M|_2lxdkH$|e0@e*V5GARrdNQA={C zR*F9(>2ab;zKh3Usz#q!Nfa4u@mGI$b9ooImEhg117dg>Iy+6LObriCI6YLUmz4tDtmbg7oeL4NRqX*NI7Ggm-LGh;Fkpz=>8(uAsnFX7GPO;gFP3s^qFF@NVWZ;OnI8r)BC}Yv~uSBI^SN)JcjP_uc{{y6Ehy{Bt zgn>H(&)&_4#)AE^z8k#G0BLkAOor1%qbb_jdJZRVL`636=1FD(Y7)_@Rv~c)&#nly z2`-0$@n?mh^v?Ex=ZI-&y6YY?Qj%6@E%O84iYq7csNBI`3!Mjp`5j=mTjbz+;0L;5 z`<4dpYx20oo-Zwf!bF4IUBYTbpjZLI3)NX|O}YH%Odl5{|?-3Nkw) z-zC6pO^wLnuy|Z3{rMcDa0txG^qn4f8-v9v6W=GC^TAK}B|E+lJ%u06vfUvSH^m9e z9%T<$qj4?E1mAXuKcuAHV4me{1KRFOG#q8qC<}*3J9JDS8|r`nA(JV<=AKF&FWU#! zDFcKB$ohe$ODp^4(I@m;cEQ28XclDX|2yU4jsclevY?>0JJ1%QCmyQ!2n-#J1SX?$ zL44}j*3ha(z?M!;z0>p_J-0b$ee}K`y~d|HIvtwOmY;s$9jPiX4)r$ns-B^WfRd(_ z)h}RH$G+#rv2SQqRAp;%yAG)&`5YQc+((mL5Bnc}YXenJaU;<}BbaB@J=4OOj<$=c zFLkh|BAwLi2h+pN=(O2*?sfSRV6<{7FJb>VXup5Ks6V0!l=?6`Y#Q{U!M_)1dahQ2 z2)fA7$}NgCuqK&nm=giZhK}C7J zT^|tvfb;(M_}6Z0 zKxWD~|5Mo%xVL!eWrI~eGMu(zG#xJoXDirqF0*za%AlN;MbAGV&&$iNe`^OE#Y_Ki zo}L8V>>T3O*XmJ;>aB5Jy-j4;aH*p`a90G`eix zpcSOq4idjL{Ms5>26~sWXv`UA0b^0;DMq_y&?NZg;*IOSz~FW&Sxw?Ps0n!V@x{;~ z`ddM-bT#1zI(NJLSvkQ1h<_;OpI1E!{I%ZqSg!OSo{YHnUyNG8fVQnYk4pkpIwT2l zWHW*ljNY{iWd6{-i*gsdgS+@epBk}3w z0M;AFd~l0$|F>7BQSkouKo;I~#?Cb>QNe&8k8#Kjgl73;!VyJ_%ddPfg^KC^P`DkQ z^ItqnV>QI7{vxEqRTi*FSuAC8B@jRPV|cgpZ5U>@%~Klb??m6J7oL10xr?o(KO9pQ zNx{|>8m!Gq;c&>CwczxA6ntITeRc2YYnvn=qp_J^U>t~{~pn`2hmhyZeK7Vw_>d~irn8|kVU%rzb+#yiA@@XLjUt=q=;Z%0V zua_t~R~W*f(xgah{9GVx8ISZ&$T&N9oMbYlanT zW)29fax8Civ+1B~0r6!25Ng(z*p#_ZJ`Z4ZNSprTD0V^3#De%Sn zA;UhoG8*$y$c~z^0moiHQBii3K|OB6&S&{;!3Fr5xz0i#d^c65P>R<=YM^A>O4Jse zvw2iH6l)8n?$8*&ow|s2w&?k4*JQziD9u18Ed?a%-asn#UK{yi160P5P-ycfgu~?J*!)9(UUbqDLTb0q531|7UZ}^bE z$_Js&DqYlO!T0WtqcUhFqLG(c$wLHxG|t6`lmf;#gDHRBq=1c;wppu+Jj9>MtJLr> z94vjF)Be!&29aI9#q{M}4O-6~dfy}e1)$s+%fq@BFxf+8yH8yK9!Z>hd)BA~J%0Nz zdX2RL@&~-yq5Pg4crO{lHp`(YC~O8T`p=CiK~A173lwMyYZi zK*k>mZsn3`^gS3jY-o;ym#-*ZT7~}i4xY++^;)(9h#Yc`-ebdH_fpk1?5_e}CI{Eu zM>X$*`-Vdy7>!P`@=7P$d?XbK*Q^+mOXzRLtH*#zw>n!hUKs^!! z>>^n+$j*M00Iik*$~iM*4vn9PqW^W!nZ`cw_K%MQtAzx7ti*=ZYFOYEWm5&;8w|Ly z?#eX(0L?c|)S)pHRIvzi#7+DRh5hu)0Hk4m>`XDI=&_1@D?trnijd!1qjx zw!`6NpfAb6&YZmj$~ahXT6TF!VHrMv<@cIn8qoFjmP&u6Bp)aF18 z2dinBKNIvBlbw8Ca{`yr)HlARpFrkXn|e`$MA$?sY%F#46RHeEV&||kmS+Rz&|e|XMKVG{>>th@Sd&12gXeZ+eHE#&t82FSj1?hHN^70s zTy6vDYFa)`w$H$CyS~{+dsLX2Px?Gpo$*A?T5y?-#dDZ`X|7YSyx_WVk;QrAXPkSi|9Li6O@Cw}l204A|SBuE; z{a2PfSDcBVo6Gy#WNRa657BtMh@yfEO#2nB?^e;WoXN_z4h^>DYA2nur@}%0C+knN zd_pMlCcRrnI-$-%xzaB*K^$>b?UA;PmCE#CBli|3G|%Go(&$!oC}Y_^Ab zzxZ^g>wQDXf}L;FmI1lJY3#xf7RNN^{?uo z7uSgKc653^!#ieJby-;IL?02Xv{muRDP_av0(YN&6ywLZlI8?qG9`SaYjse*x{hvs zf2$ekdJ1pHHF}aO{6r@|*?f3+=Lo&b`N#cRzZJD>=F`$|g#kUER%)7tG?4g}Gn)DK z07xZ>yGZ(}6>Mys=2Q(E2jbeoF3r7d=uCvl|ONbfU^(hl&ZxwXcc=dtAnb$&75|v=+ zV8DgeX#%;?;2p8GLJ;5e3pkrPq9m0G<7Ju;AYuQWDPh(a8c>{{;jY?85jSs!oMobb zd^&+aeBc0WZkaK=tnC6J&V!5BUT%OU^f7Hxa0OMa_yqJBb z2oNb+pH7~{=-)H*pS148Q0_7*>CnU2;-bfe9YC;CJ$mMAF+jddR$&Od1D(k>UOkP#ds~mB>vuZDd(SU?7 zRy8Jg3Wd^Y?e~an1HR(Pu3q;A#36IhB)ESPxm}SM5q~rbD!qz%p2Y5<0P*tg+E>v^xv6J7?^2?X{f@yz|16$`o@$eu}V4C6hXgLDDC53IuG_0V8M^VAL zDI1_17;yd2T}7iRvVPo@v&eZl^0Me`AMoV$;W}=-1o*b2hy>~OkV<6QnSUG$pdmWn z%>UjVn5bE|GZKzN-*AP{9oq#&)HQlXeS8TWN^fLnxcx?kp2}j>57yCDZ&h73o_!Q` zcr{``l@NBdQdB*pn@3FCN%CEE3&7};V=qJe9=dn#XP$}c5jbZz_QQE`7pUTMMf2bP zqW)4TarV7UbW&bnh>&g?eAI5C|2@19q_SI8A`gFo?`?~PxoWH6q0lm6iu(o_;JnnJ z+!cTWPO^k~Tn)q4r?T6$UxmXg`I{-2y7 z@lS$}g6EIlgEy7J=;F=O@Flad)8h3Jn3-eAZMEeAW;splWZ#p4M`FyCtNi1z<0oQA zEEJEGg`&TFO`(UEIlJ8GCC|fb=5b~Toq3>ky0tOp1T8$U3k zRo%%8=TOn*W&`!7ba3eh4Jk|59^&MA8@hUM76#_Tn%WYdz*k$xjYjYsdgE_0ckLH9 z)VoFSBm5yfWQyKtRte(3ERSZ$AFz!huI}GiQk;a)C*A7~5Ieg%GO$ga~(~~}lkzs$ER$Wi0HNYb<^Sn}T49V(G zdEYqPMRP_3U9?*3$SeEbHj~3J3XL@E9t-c?y>5A@}d^_UlOmLxv&9vMoPIgC|AIS`)NLV!+sQFu&ZoKN&wGB{E76k zr-0{Z?r)Ifk04UbrJr;eS;#N>SHv*u2qN~%RacK+0R*4^g%nz^gS&csuE%HAk@v5$ zV{x35;KtHa#y5!#K%oB4)@)@MVeYZ@Fp5JYZ`u>_Lt_YN1?gB8S_6>iw%Xy5*$as5 zGj7=Xt%HM4$a6V!6Y<_hr&MazKp7~mdj0MX;6}gh)KqK&1+nI*EvpA8=Njq3Ky?>z z=Wkj!73)S)b6+CT+uFc|ngXJ4WsBf-)xjQtemzj+2raJlXhe+*j>igAn^E+-s8yg1 zLcv@)rEMqPqr0b$Cb|-;k)P|Akk;~I^xnRG_3is&uwg|ue zsOEnQgkDJGWGq#H=TvHus@w&rxbSk=?&fWful)KESz|lmp`kw?*q(_F=0-?3ua$%2 z)GUN2YBPXVxKJ~xcn0vFt><84j{qK7b7S89Mc}IXwQPs$4bYKz$JN%f0&=xB3(bWV z;G6_Vc$T9G-pV~u9aQre?+g(nyvWPLiZ@q~`N#{rm=ymhVX6urSO< zV>P%29$eJBrDatHtD9cE31fJMQ|Al2{3Pz-q|P~!oQh0*L}*w2DcBePU5QF`+`bOO zo2=%nPu;=EbozwVeVPdmpD#_)1mjL-i8BtPmhjmm!TIZa zjxZ*uHh|9E3_dyPtIn{tgUn?DB7P4%agv;&OAa>11c9vl(btS%-uBfU#>{KjaL$PO$h0 zm4%LFWgSKXmp@itwPI30*fkg_GV=;}d`R3U%5O&Y+}GFR?LVNkw`Nb@eQg51pQ6<% z-_`;tvDsMao9!qvEpd*OBoHWZwN6F|VBq4JJi5o2h6cY~UV16|3C(IaUH+EZ0y@2l z8t`@jP&SC_o#FKb>4~M(qz;M5-&ruREiD_gN;_tMrZE6BPZ|S#HzLrx$g;BAl@E}? z;UG!Rs|Wvap-B+WiYu^W?u?@Qoek(NL`(OtCL>)K!XB#}15Wb`HLvpJ0#^R8K&7}B zi2s(!KQ-wLK*+w3I@cABgxgQn%a%U{vw3!n!$&cw>T$#&q2wLpQN#D^`Kv?_wfZt} zXEzVgmp}c|7!Gm-*yF#NGCgc=W{@z_@S+?WpV6$+xmLzBN0ru8mqn-$$+6&fXWzV zhW9^E?F9Wf4`o;e6(&y&A*~N32|xCa!Ec|-*uPpI$2^j7Apa~0CZc|_Sj_hWv=pqE z7soL`$wz8uH1Es+RvIUDKR$9Oaq-_WY0Y<({H=5W9PNO|MQ0tZbkC!`6DfDro*##a zMO7xQw?BgZrqckop20Q!ocBeRhunJN0VlWL{E+8+T^R^}a$}akh$0wnq`-n_26n z4c8!DR4vPci~oQ~sdrs&stoKUPHhsAJc%onB=7#%(11S_dffBsbTIe4qOR;2Su7wt zO{!hVjMJhgu9vk4VqptYCt@*4_<_7Cq*+fI1}{&XR#$`2HRGFfg6TDw`Sa@Ey@+c# z^bs>>`z1qo@vG(?i4ZAla(%pKaYP&5DYFeo<5k68?}t-egv(Guac4r`IT=jP7EIwa&P#3P%~r6dd&p~hr3w(&51KyfDgqB<*>roz zqtKwT-TDioV(?tKGVH{o&uHe$PV}7QGJKpistLv6>p5$mqbg3pa6^xo?GhJ|(-GVald^%!^qP}^3GS?qg6 z)>NE7c&QBt65lNkt8W7+HM@eHw+if@H(mCZY5@Cw^JN;o!$?Dy?1K1{YQ!qia8Ix* zA2rp|QxoN-p(zQ^V+Xdc5zErq_4~>`C}~p0D9kP&y^vP+qIq8g*85UkjQPF?$8PRT z>bSiD=BMs6yzvM_vlc2Xrv@ScwR2QBYw-uL+Y)bhB{~At<$4v4e<}iop&vX2*qHVzV|2~4buw0XGYlY}7R}o{PR0Xj`=n^jOgD?7wiUABhKM3C269ah{{6B|I5|{SYIS*Q$CK7&6C>_Zb?HRAm+`` z>!&T~lwV{5Zmt9_yO+-GiN8fuk9$`|_WOY_KC5kVs~c@LbuUkJcB9HW|K40ACAjJ?9s0LYErQ1PikA8}S0V4RmLUbiK z*#ee&FPprfF~-Is#M9^-gk*9e97=3$6GEvJanlqfkNIAx@tX3 zqm>qhPm})!n*TF|W-_%?uBuXSP}D}_hK?mP-!h>yD`qjPgT|=+u0NxTKqC+Dk}Ypg zqmrL&>EB~L09B%B0)c!is+>?ie#!JUO1YaoQ*hA+T%U>VXi^9SeS%5P*!;W^yIixp zrTT5;G%iGEO6CRr)!#m88ljKQjy^w+L%c!5g3vF!BUdDS(IQ?hEF95Y$=oL<_X3J_ zcfQi!&;~nlGfE+TuBbqSDUrZt4!rkeG2b#;MW^pB>c$YRBR!SpFU|4?(EHAISlBZU z(&|2xThHvE6UN!6r8n0=)A1nLkd#rh^!{rL@q-u0l9?caU-~`x-WTsEIzEmryS$R; z&c{fw!w^tD89|)oRzvsvSHXR=J6w0Vrclm`V^jXAPbicyDr2nvA#ioi&ExI=1I&4T z5B{T=0};*D^!`E%s7UeL#oS{vKt?N%Bs<&%ia;IFf*4h)^PB!|&Srvq*1#bkZIvc^8$Eq@-nN9I*EWU21 zX#uZQCQVl6dSc@0_obJ@L$E}V+3H_=9vs^~q*XQT293=QrQ458V6ryxM5mV%^D->YXj%`Q36*zIrIJDlYVsT)-{3Pw=VE%{p-l+eI01Z zocS&@L<)wpI-5WIa|7;McTNe7S>l5mXFsHr*}*ANx6@1#HgG4!u#t@J9R87geC>9U zC_EV7@{0SfKfK?)wb*sl!QU+E`E7*saKPpRyE8|EP>hAa^Im~H264A}WqX<2EH%~;$2 zFvOKH$l=g*@E!dw1hLqlADg?WCejWJ@3y88h@2;bRUTx_@)1Uv5p7CFKK3+~VY0 zWBvzPJ0q)9Y$hlwgG(7DR}iT5Qre1paPox{0xM0}P-ayJaXrvYKhd+TzT zbo3~`Iz#~`ez?9uc25pp@*6wxU!o+`@~O^gGAaUZ`qry|#Z-fwG!D~EpBW^U_V~2A z%nS7B&UgYf>IRM)hB=AKFTni+K2=)F9wgQzo3z>e1-+Yi{Q8xB3UIUTXZEjnk3M#9 zlS`W}0{4UIw)D&%!0dVCaJwo4TXj_1z z>)Vwf${FO&#}wTk*nu=CFZN7sR{=%2?O2i6FKE2 zoX)yeqQH3uS8?$UDKBpzN9GNhF#}mVGGatoFwcN_Nglkr1S9-q~t59Pbf1|!l~59yKw@E6Ao zcxIO$zV0PyDO?kSH1iH@(jJn~&ex?Rb(b4X)+Skfy{ifDJw8@3+jRpjEDy!YOdF7= zo$ZQ8LOB|bFDW=lQwVpceN*fRwEog(b(xcLtXuGj);KMXz!YASS%!&UPQ|(rK{9 z5qkoKUh#8BTg9lmHG+NkbOB-H^2aIga8_!cNVN`;nG^Qp^L+v@(uVkrXbZuYqT93t&sx#3mJuuM z_%z~riH2Dd9Uvjuny1ok91Yq2D7LHW1v3=fMZznSfW;P^lX?FYRHvCX zjqmutA2Q8d*Z%Lv#E-ewX$mr+Q){tChi5R{Up0x^>9@rdyxKQ%^n5Yxho!t5I|2|1 zyUm+!Ccxy^ON2BJ!{E)OD=}Pwe$YF=H!jOA3U=(DnQaTZ19#Kqp38g_#woj;jANeW z_^tUtvyylOq*oZ4r?B^igu8^2CCC{+mJ40;)3wK)Rrb7>I(%`}3#gU)(F-cv=WhPg z-&R1{D~t-S#@5h0b+%YE>*~uq~zZ9fJ5{Bs1Ah zobI-UY?SOGa{e8FKa>(#T*M4`Jigv&Rq`)LIaS3>Z^{R08?IRdKIedH24o%$LzFN* zK%q}W{25TRx!u%aLk2~Hc5&zSOFlTxF z7n~z@QQ)ei#V^dRZU!zCfQn}-PlLJ&L0IC=#iE2l6g06dNI92`nuLSQuB>C^$xgJU zMOuWS$k`dxZZx2O#^$3*hCb+y?VU?}G7+F?Oswu1#Z#1^_0^4gs{k3PKjck?eaY1Gm2EPfe@kh}f2?l28J?x(L0 z25$j^n!7#*ku*5V)$-3E{Q^K5-18gK2jDJIe5r?e2e>|B`%^Dr7&S7>Tv@xCk9?Ck z?#B=j;2qVw8LvKSIaP+}vT(J|fp@d&8tJ4w(jW5-5sdDf}nNKA5od7g)P? zJauCIJF2LhP1Q?!>+*oX@xNDJQ(tQbZ9iCs7ykL%;9t#RDSN9@^<%~@~_H}?? zRjSr2+n~b9yP@e4Bj8NHGMwM~gL(&o-+RzxB3zyKU~y&%^fGFH5vAJz51Q$&RZi@p zdl_6Sw*{9_mMb#p4tVB6W2(H_m{z)9KuV(yIVl`_06!l+9fb;P`1Fc zHjJ)!HgH^un*k;15?7{ozaopFVw2=Q^T6#hqk7urZ$y{xUE|CB6Ql+T9^L2jM*J;q zc>yuTz|-~-|8$ora(hMT?EB0F5M-{XTitqqjzMl^PYU~f5b_4f{1^+H_nxXYuodmJa6{$Q9FgF

s11lJ1k)I zoN&SUC`0^B*|c?{-V8^SbrHV!VvZ;InQS*Tufa00uJFlvT_}6jc=#2m3SQQ+7HRm; z9G_a4N-)ha#HXVaYHBV2!*Abv5%Z>)!QgAEr*8jH!*xyt6D&v!U$|`WV?N&+E9M%C zK7V=v-hJ(JW%`8!<{$Krh-|Wjj>D@tAI3%C_qo{aOUDlQ{^~68$9X?Yo@k&f@kR%e z@|j6|Q}n_al(XW`$Q*Ix=i}gz5+58jBO-XH?+j;?cKi2V+F^?M4$YD~+E|p=wyYz= z52~^+eYDs%z_Nav30c{GxNlUv+px_GOG$Mt)5%Qw}kMgrNZXoSu)%)+)(?msuvx>ATa8=4Jv-s#!PT-BE_J9 z(>HJLpwjem6IrdF!1VBl*W}wxaH0N(ByAljz9utuTQ{8$POuA}5`0dM2jk6sHy$0J zue&%)UFnfVr9{#DRcz^uBSiy?y}$jxT()y`xVe{cy+yS zIzW=4#p!NJpFtB9P4-1@Lip^WX3dSur=WTI2OW83RV)-O8M9lb4jJTk=VuxWa6(1% zJ;^*Bd|GyW)|F8K+YJ9m&t_A??gtyh4FBiKB57xldoMFKidZ+8ua}1sdxGmec^uH| zX!4OFF@$Lh8Ao^QwO~-0`AvE+5gbK#CcDYs0N>e(&sN$M!-R*|Z0yt)(FNnGKnrgn z{DfrLLZE>J_jgUL`+Qe}J66v(cZVUopI5E6Ct?YB&o*5~D;Gdfi@DQEk32dZF1~I$ zqlfAZeFU$~D}qFKCwfl8b3mt6i~T2u2H4j!cMxSWKufpSTHmvr2P>YmJF&;+=;`K0 zO~bYGp!`L;*@2-Rk{At%bQqCGZ(oH9doSxF@n)dyQ*shr^bU~LJdywl)`am*6Z+`y zNA7#~1I~e^uva-&k9k2BkHSU6Ielch_cMuYMI4c_Oze0hGUCSPlujbRzxvO)CtieDnt zq^bb^{{b#Jt+oJe$Gt?7d$Kq^Y24)#D+#`C+?Y2xCylvC1RDAn1aX^d4joquD`c#M zOhkrM*!1cwAQ7a7g9hUV$-Qhil>2)ryAU_LxNs`blUo{w(ZH<2*nQARC((osvSH49FBF{x$vb^2rqqlb8mOs2!E+!B=LSI3+Jx-KG5D5fm2jVapF1~sE||jlcl~k z&iA^@XCGcd`Qab&RAZU`q1cd%>Szbbr-LmS~W)WiNoBp}_<^q_JR**S%UJ-^W1)&Ji=b+{K z&q;O*fKHoRR;uUxvE#b{;20djjaKbR_q*1eu)?w)?t>K)rxj@1SNEFs{qIsBh8= z-ocAe4CDrAyk|ts&Q}`gTf|nG@Hrp_jZgoWdPISeFfXGUjXJtXPqc9Lj|K>}tg~4K z`d~Hj+pOnbOOTmcNd7YZ3dr4>=TE_=fG&1VgV+2znBLV)bKJE8IuyNq#ir+wkbeVN zK%Xw^zWiC(!tpw4U0;otC$R^Xv*nRndlyhXH8r7{bea_^l*4e@c314edt~HbIL}_0+I@cYFTOOLG_5$b2mMN z;KhAo2OxGHD=4HqXHJsEcLe?xKCU>4ul*WaCfG8Dd)GTTHfIfC-@jAz-rp>->+JhI zTY4!dm?d)Wsg(}=FLgkR5>UdjYITi>4;uar5=|Os!c4(Jvr}I) zX<3Odik)V-lXHN&-?d~;nlwPCDb^_5~YG6LOf0BxM&b zUKVy`n0msbwsxQuF(rJ7E-es(m9_JCzZnQ&nSXwD3+ZamG?Io`Ym5SarLxZv-X?*E z31de~gG}($NjguKVh(tpsZkY|oq<&`zd}z-vf^)c6K--kli*Fy!^B@yry)m0lbG2x zK4@^#YfXJo5>f>hel}C&gZe%unT9R`n6xIW%k-rJW}|_-KGezB-HUm#>9`Am?zO=2 zZ_hECdr+nVe=|IpTB`8Ut{$7E%^t^xx53v`&*{g~YOvQ^W}=579k4&jo0mGj9t!d* za6ff##;sfD(l6XaxO=X@5T zvfCy&5CkKy0z_DHu4=rB!D*!TK6(xPx{zc^n9XiSZbV{>k49 z^e~ur|5i*j6;9#LAz4!Riar+oGutmAft~|CoF9K21NE_j4-x9~U}j~_nX%wENIWO; z+F^JTb^7-H2zy0=S01G*&^DF;YA=gb)~3p$=9@jw^gAUFz=tHc-TG7q zbW>B2xN6B3P_C#I)35uWR_fZ!)LTvdbQ*MULf`{|MB!id*Dslb9*Y-3{7&pD_2kQ0sGcnkp#59K>6b3 zJOe&!fR%HkMyz?DfBJtDRG+D#-mL;nrOO1kWUhr^HI4(vdN53Z*GH@bZ_l4_3@5 zq5t7xU^Nvr{G|F#H0c2wjMl4aH@sU7M!t{Su-#_Fh5Ffav#L9wx90er+7$}8a7D=G z_V<6trJC%sJlzqHZDgd}2(<^X|30-`HIGIsY7HMR6Bx}?V?8yRhzRKy?q-X)qmMV%R`)86k+Gsd;V`8i zQe8LHzjEM=Hj5|!hP0ZaPV>^lYY!uUh_cSd1gjX-GBO@!66J@S`-8oSmfZk-Gm~7x zgdd>i1)AML*1&6aE#>=41epF_`slGg5v*or{F>fOiKj<)F8C(TqP8a6R6_Zm zC_-sdi|5uRI3GA@M8WYFl%NZ*ey5H)3^*;~%_2Zh+1L-(eD#x|A6YK|vdj;;QzShCV zJTJDMNqNJYKl4NXW4({n&WS5^1SP@yW6Go)??a)F-{;-F;JetSZuex!O-q;)AAGZd z+zD2eRe#LC!=ct*t60>0@~nVbt0E=^e^4%afn?8IDRQA^dq?zG&TZ|ak~tB{SU;J1zbmJV^6C~R}0a3 z{!A^wy>xUzi9_JV)grJp)GHqU?k>8~KtCw^t^j#8uUwt4%mmv0l{J2Jx#)(`zpu%Y zzQBBEM9GMu2*f8@On)ZGM^(Z`q--^rsJF;sOIpnkQLK0nG^#yE$=0t&8U;u&Wz$Qa z?6o&Q-%*CqeBuBNU3$Fuv6vIuRsHsRZ*zz$>NbV$IWM9+jxF9#Zyuxi6BOE?*_fbv z>~$uQA2Wbe#LgPq3BdN2T8XKO6~y;}vGyqU5NU7KCw`k|#3HSK&fHL$0Nc6;r>^L% zfibRI=A~A1AU{xik7Pj@@{y4rrk^2(;#%huM$fWh!&eTKqIpMX#l6KgqT~osM7`e= zo0mmT>|gYei}3(~p@9hfI}q_rxnssa6~I@);T@l)3nIG6HB$`KfY15Uj7@V&K+fNk z@UxHxI8*((wr*4j-G08qrg5kQ<^t8lb*uI@XBO$2DOO}aef6BI8Yv~9$B+DcEBQc9 z(nkP%;2x$MZcg(H8d}&onf4yiufg^*iOa@ zqAT_WF0?_?5WT$?Tt(XnE}5oJ`T3CIyw2|7UJF{-|9RUjHIWde2s~O=mH7wivVZP( zkkY_j`pFhDw=XFC1tsh2B`Wys`RHY3B{CQ%w_=d3DhPRQ8~o}XIt{BYXn5_ulffd>T&-SJD35|~D)i28FO7omttNR7$pJv{X7y3w+FQ`0aR1!p@oBIk zVgIm3b_}eSy(GyrssX=3{r$g>WdgCU>iyKlGsq~zIRER<7(^&|&#%MnGb+~qW87_C z4a6R15O~{;AuXJpwRfo=Rqnlf^MXb(lr4svdrT17 z3zAz=TteWA&WQkP5ofqzpRzQ-UI!<3XcLynl-8d7}rVCmMSjj)B zUqfa4r<&IfTtI%B&17YaEGlD>l;dDW6KuNhGEGCC`2<}b*jq$WH^pMeT4 zUTra&`wLVhNrioP=g?Zj?`I)Q$EX{>7=FaNfRw%b{f=n%fpaN1oh3yKO)k7Bg`V5M zn>#|~vGW+R8|KqDN~glF|Fg;CCjJHNe0M(lb!Y`XTT!0mHat)tX48CL)5osK`m@$W zlfeIc4w2eZMSOyaGdnGa3XV4N?h5uv;YhV!wq1Kx7Ulx~z%SuPG2N$I9LewSCn|fNX>!PE@CFYAzAlpiXj#v?vy0*=HWE8;j ziPc{wzbayKkiwuep@21VGoy(o^>JQ0;X<~wF{aiGCr`Vn3+3x)Li+B?z_?Cpx`C|; zpyV&Q%Oi9IjEXd)1ac37_MhzwjQM4#xG{q_j4%;6zujnf#JvE>cRQhGoYdVMS;1~Ft~Qs_eMhC9PsD= zO-!Iu47i*N4Z*1%&>rx*CoXIg^#^-s$t1QS<^C~hjesd|N}J&GEb%4~@$hOdvil6U z|0_yit`Wgbm3QC23lW4ADa}ODlUjJWlRmCZkP-8KwLE)zM;5ly3DrM-r~^B%S#y-P zNaE0pGv)I@1xA#78P7Nnf_J#hsT8jX<2*K{&kCc4|1ZE!Um)lq%l$ zj(($0$c>Q4KXfR1YSE!rjDx51s1e5EpH5i8(BO z@UAU@s-olp!>Xv*<=*n^KAlWw??&NSx_C(AMIqR@9o~b%zzwgNfctl9{66gOM zPs=U~WrkEF8)WFRM3RXHivOKu{p^j(bw(mGQX;CMs7;nLcfbNM4H?pQHkV0l>~P%IQR3$-pJM?)FW_a zz=iY%lGvDA^HL2%#+kPrP=N4x{=6iFduZ~o4D>X>!Z@B z@tZ@U5vath+|f@w2r(v8anba9fNj#_b7=Mn=p|p0m#j)a)tvjGUuiRdwDw=#RJ9;< zMwo6i_iiS-`(g9xwoEp1I=EfD=q!Vxx|`O6<2}LU^Ln561rv|}Y+4qY2|->=g@F+r z_Mp7s6;q^}AL8Jk;=i*M3C_h>n6U)8pxauH<=aEjfJ#!@`&a+9qvx)-)k6ykQP5#M zrNa4SP*qsks^OLn95>3kO%m+TnFK)M^0gK%U4iD-vMoS`%Stwpq8jN${2*bfECF|K zJYJ!S%mfv`zs2nLy+v;#9Z5Vk8v!j@b_RY>f^;1l*%jnpBKr2MrfBk3@S!g+`uAcP zswF>`uc3Gi79xo(viItNzY60G2J;+nzHoD%;zD3zXk9M(L5TJ zA4F3-HtrMgpMd`nA<^f;dGP(y#qS+^h2Zm(wz#E|YS2eLO?m(NASycnc@LiUqDOMe z`m#5hz(dQC(Lj%B#E^dJSZfR;sxL3nPKQ?`rD7vtb^SghN7PwN()bD7J5WnD3hP4( zrZoINdKQsb*hT>-c^}ZqDEk++J`4^7ZOU&O^@20rGBFYN2T^L<;p{ceB=D!Pwq{-O z0C;?BwIBJvr|GDd{EqKs#+TDZ#}0Hi0b}hsXT_S|NZXMi$Xe(xdMix*QAl1e_bdnt2 zYqO^Ji{3;f5!&hmEyOUa;cUwR2L+yN*lhp(_A~I$QMpg|j06vsUH&mL&5T`GZYL^z zX-1lZSD}`L7Mw^oAEuf0hT-A7W&wf0nE2L^>rlvD_)$4egLCK}w!R@6>R(|3k>mMH zWBcn^Y=NuDUDy-8KS@p0A zbBrG|u_sQ+h&I(|^TSC}I4wL+nl z(!?BV&Dvjy6?24oUTSiYwGL1a2x~{5G{-*!YtlMZtuTMyU&D6)|DbqNAyJx*GS0dh zSi90A2AxbVPU<&$K}F%eVf4+sc&JI-#N6p3eiT{!w*AayXs&kip0%PQ9L9UMCsP&S zdJ(Jdf77x!>S2abw9h$sB_>i~)a?wO%lSs@8qWl&XZSN_CdII$xPefd6(5ehW}Bd! z$d36mht72lioi(I)VCIY`QfYQfvW1coKQ{EFg9v{5qB|WxtIN+#KW0735)kdVBf)w z)Yxq{9Dbwg3j+lUOmR5-TK2f=ToiC8VCpeZzmAg;DXHWn1$`eaN zL7@mKssd5?k4Lk)iIoUuG7(-$4kyKIQejh6+>PK_H+M_Z&l7m?*ol3M=@ar{t!m$W z&4|Z-M*F?*`VNG*)DBKa?;)Sen;FwB|A6miW5nhITByz?W+8Tt0m_CbS8V1I!%Uk} zGrLcxFw>#8cN64mkCD9x!D|maZ4Vm2O|9goPNpNkin4%|@at0$a^>DP$tx3p;(M0AP;f0Uyz91c z+V?HUv562RV(Ukxg_Y4fk7qzdl9;tb$XyU+dT6pDx(W;f^b1$4v%n*>1fh4X1K>|c zRk==CH(H|>en^T4rdkW9YGp+ zPp3%NlF$&}^q=W~=@9>Q4fSiZR>G6c{t;O-T3Exf>nB|`E2NQ@WN_HFfHMWnAL~`c zFs)!Ysy}0d=gwT(S(lc?xTp4fhRLGxqS1*&$q^SNb9F*^v-d<>kpYU_S+aBy+Qo|I@*?>PKPZJR0!c&Fk-Vku)Yr zEl@DT%f4Ywg_}ItgLeRl~6Hu15~j5j^1Y&zHs1RIF83 zqduZCf7at05fD#(_q`w?2;f_nXp@I5diYRxc|iY`5q8LTN%p7K$4`GI&?JfWBKZWV z!pE9MII*~JM}JEOBcj#NTj?9XH`Ivth>smVr+e^+cfcG*ux-8FzkC8Vrz<$Qx%@<< z{Cn@WSG6IzolBj%mkO+Y`$cKqNFVbXwG&RBl!4=PF5!Krfb?lPPo5qs75MwJ;>d}BXeF;ANbDmFf6S+4(!IyWBia{qrvzjg8k zscpI7cY85St72B{g5sJR3@M=m2c=iQ_1{2Ow;-j^WEYJs3KC9@^1eNvSAwm zmy2P>Z1`iMS5bM(3@VVOQ3*6e-OS&{k*}aV$;= z<$pb6_W4Z-Pgk8gT%};fgMkv){C0%#Y?IY&FR=oAA@bQUGe;V#5l-AS*p$T6H{y~7 z26>@kRfC&TnikyhcRc%0ngy14M=Ll5uwsHmzld658d&qP#8t0&6kR2&n@zc>h{Z%c z{QKP~1mB-I(|uY<1NX7jO`uyscsBapO7mN3D07A^bkj@`KV~!1iF$bgetO##Z-(VBpzWVc5v1TN_`a?j#ll$+yvrHF zuBuLgp&~lk7iyb`?}v>v`{hv->X|{guegsc9p5-s`BsnQIiKX}Ie!9p$u%o3It#Vc z+&fA4e_jPVRG8T!`HjB#MkULSZUgt|*fF_4dB}1WaFer0!^X!graeTmu)3}N&FlMW z_+*MpLcY*NNLcuUzwH#yc#|;n`COX+0)FT^e(hiwPe_-s!+tVBU30H^|cxLKd~fZ>Whc3+4Pg)L7TQ8ppmT7)GO zKle~SMdn?);a#+&i%e+?R?+MC#e1@`Yba(k`Q+fUuOL@?kA%~33^8P=EgDg5fDNs& z*y_bKr1*-|tLjNL+CANESNh)%v^`rV=57BE3C_e)vu*B!W0yhS>eg;>_Q4Iq;&*@1 zdlA7<-o9M4lu_&KBQl9>Ry~&6)qjA=r_$vgJodoth!^%VpD^lq>EmH1G>YiKbGyMQ zQOH0fckZRtNhtGK?T9(%3=B__r(>+$M(^$KUtPV<2hBaV2|J60@X+v!vWiV1>@C@} zsq)vVdDjX}VE`DeMyN+F7 zy&7wf=f^mDW{*5{!y_v0&v7SWS&i37WqFE{YPm0l$u|KR@~@;OEfwgx#X58m%ms<7 zp|2YRYf<=_nJ0pq3BW>gp|h0&0p-v~^zSSxK;O%M6}u0ffsoTA>B)aufxaFCyZ6av z@M`6kh-Y#v5^(yD4_!_H29XW1?_MSV-SASQ|1O3j$Hg$Ctoj0wRZ4YBkL(e0kPqcI zB)Eyr8kBsfbuUM)FCSjE*EB;KifmCY7vjOzyq8n9`4g1${-e>0$T+Y=mRU%rm5A7M z67Ma1C;<{>{oN-z(tv!8%T#hxG*FZ{eZO6>04ZKSEUNChhdz%)%Xa?E2Y0`EIcpz! z0N?Z1ym%hvgI$Ae(D)TH~g`mPVPG zR{k8gJ?=E2+8BYzCQ3oL`aEbTb@}DYUjvk`%u;bp{YHD=%naWjYyl&-$E(Tiqo8;6 z58?2`9^~4zn=`%Bgf<`dN&$yoh(|(g#Ug4P$dtTSbI_RrxkFk91cAfAAL!{^Nu5Gt z`$Bqbw#6v-oAed3@h#Nu7@fS=&;#yU8WuentH6Hb#ST){LDpsmBJkJ37e z|J;W{C7?A=HW^pi+MIsfkcmy=^L!O^{@=qGX6F?ZfuF7>t5#j9!Mc6G`@ypec=|YA z-6Sa+!sJ7O2E#8q3LS9KkuFWlR0>5bl1A6r zYJk*hmSY$DY|ww#|7*4IxQq_JnfTt8kOROcj_cuuBcSOiX@3~m3@)jp`aPPgLnpfb z)W2ygM}6thTiHDGXq)jb0Z(HoD)qTZ{GxmlWqJ~vJKLNAwyLPEc%EMecP%rc<6QrO z2fejh5zAv}x4-e^82o`8>?B@_hs**=^)DwAkBOker$~p9cVB?X*00TM(^}BDSpdWT zETX&FKG$oyHW77IgY*sCUr2aUWkF|S5cMio$0koq0JZ16%Gt)FAhu*Z=>G9@m@zR9N}MA>hUn@fr?k8(fA8&{!wpWTn%g$rt< z?r3D&zUsVP{}jkQjFN?G3`u9MyrfB9qfPzjDyt%MH1{?RJntuN%ov{R|y; zDS?}3y3kW<@^N3=QnbVuLzlCY1ejtj*ycz0q5HiOZ`r^|@t6gE6(RHEbA$raCFgpk`A!JC2}NkG z{%3+qRXJ2+Bjm7x>pRPHAEa?cEs@+}kUf<09oe;#(8SkCd^Gk(ba2xb0UOIj2q|Sr zN7*AU;f)&eCj#N}c;a{aXJ3PhSSQBR|M#2$ruLQIaJ$a|8+tNd>J>x$`#KlB&5j=Q zp2s(;{#nBS@War;-ww~lai45?cLLAW4cXBSGeV)HGhgP3>2RbZ+pZ%aEtHF^W*hD! zfhX7lhwGMvur@`p%*O#zO#9!}tM1(_5MHm@hhD^RNA69g@+>)g`Y-V%mCrGFWM0qh z1wW&|SERyn$oJ5f`wAPEK9gaJca|$#BV3rl?8-;31qygg=+uDXoEZFG+@nm^&xGew z2lAJ8XFW8)`=(NnXNo7~&LWZ2*G#mE6V3{Rusb$S7ov&a%p(#|8z&zj0XViZt${q*${ zvqX5&%wpupvqfaBn$1#cP7TY5mEVaC?}DAz?H{Q8H-T2MajJRvCSvswn!eM(1f!h- zE*?Afq9%6VejWNTFq!`~q5T{wv>GqunRF+@MgEs~Qhpmiy1zQ~NtGs0v%JMQ{0hWW zK^$JwS5D%w`&x!FTfhhX9^@gsw)j|L>CXv1 z4aok&qb9LK8s2wg)=zJ;!C#*Xoa3UBfEniwg63T>!P6m`i?ZWaU}DwJ&cjN8r6wbq zXawb<@97hFOr}iXXsP_Km!DPO1&*uNn)&RYc1*ztll(ZkEufwMGPeeGk0|9W3U?qo zcbCU(juoiItuB36Jrxaq((&(SEdspX!g9aJW&yUT5trq2m4N%KH}j}wF$#XX4O7xz zf!W@`Z2PKyS1^rwzQGfFky%N0=pWQit3VW+2r~98FF>4Tf`bq~<)6`eK zGcyQGa5GCZLmpBmK2ab;fe@qd1)kjg52&Y-L92eQ2(_O+ie{Q>N3Mgy{eHS}Si_X1?E zw)W!PQG;{UYI(bBe9-cue87W03b6P?1@m)KcIc_0Px(B&7m;ufLvg?lC##K>bh4zd zZbU1O35^t79t7;xNP(J2}3-!>DeR-KBDlE`x^}d z<-ple!r#I7B~qLJn&sg430!2}SR8R z0yq^Lrpa$r1M?pmjPX7b$mII_gbQ|AXwqhVm^0@UGCebOtwg&WtRI>1>!>LXB=`CjIhG;O9-E=cyv;a5k067V#|tocsWfjD<5p&0i~bp4tBek92K+ zYMht_=l;l1zMiCk%0A70gRl2dk{&VhS{nl8;m#}4sd$X^FZQX%k#tk){xlqZ+eOBqo7AVLaC2@7>wy=EWzbh=)sFG_qo*O zk)U>Ui;~R`6k^=5L*Y3A()fgKuzkZogZ&-X>fs3ZSb4Y<^Q;;KJO0v_4IBd+za7IW zp5`M%gYW$uM$2gH%8U1)6@#$d@OCA~PvCm|O*peQ@_()ct6X+&0M}_hl?QSTqR8dW zJ4yB55aY6Dh}q}@pxPBbQIqi*QM<$*WYjzX)Db3ard5xC;X*7*=JNyigHNX@hX+WE zb)8Ke2L;i?b>Cc%`z{pd|@V{Zh9gu=fFbP?onL#SIOZ698e# zWT2NEcW)S7MM|U!2e!kB$kKzBeoW&Y+B+ijPwFxQ_5oKGB6I5idj)ekvQ0&)GAp6d zgDD_0_iCG8V?1AnOp0{UKJ{e- ziCg98O1mlyk!`S4@llq+-vj1nh(y>y4VZgQ}bb;c|*_R z+Yh!L&PaH`_d8$P9iqK)$FF@_HUnooRB7fJP<9W>@7P?jIcrhG$z3)avE1vwTd_V3#mv8TMQ{_ zdFr0jlolp_9Uy@t0NyY7_WiRO1$I4-N-Aa-#DG#$zR`vs>aqyj=zGS3Im9Km%a1Yk zf5^$GzcPsH%3kK5`#6E68mEMsHrpZBwF}(+V(+oKg``l{?gEZ0Qhl6%tsfixgO(3N zdT_pxlG~p7B(C6d*CoPRF(nztm?Iw=A58&Ka(; z^wHJ0i|SL_56xLP{iF7SP)r@XM|Ui4HrfYuoi5oZ#irt&t@7`C;`1q-#GbFNoyqYG&1wE3xWf)bMpwJ_SvGU6VkYd?nnvm=S zuKZ8)+j&<`T%CK~Z^@qs3dSvoXCIMZ+03tpapshGt@7_9787oG;6C$cOM@TY=bD;y zR-l9mqm?&VnCYSQOves^+%8f~w+M)E$VFtLx0pJDIYfDgb*IgXY!s znX!r2PV5vu2_-zIzge|&!v|>$C*So8!r8SDpGWxu_@aW7#gD#kU`n~7-XK)~zuYrX z8;K%=C+V^meQcJHbgtlfV&5z(+pN6p-I9HhBZA z>K`<%6MR6=LR$TcAC;nCVTsg)L*qz0FN5xh>>!{_Vygf2tOcq3k+0mWsQ?sK+A5M^ zeP~oYdh`CLR`BmB>5w6N4$74FW50U-e-xK@JP=+R#StMRBYP7GiL5B@MQGWPU3O$8 zLiWrkE7>x#ldP=Ny|zlSS28jR**oF=y?>t1bN+qK`5t%h=9tbfRjwuYsVvUD^HCPpM-s8ch)0cI`^(FGJw0u{3w4$`h1tF7>xAnu8NYq7?bD zHpuYk>L8)51*+@izaTpK08FxsY)L#+0+8gH8sWY>YEt14_ac`;-<0Nec_v%|y;Y}y z`hh)|@ISR+XJ`j}PJ1PG6g)tT_pM@f(#%2h{o5ams)LY_>@23MJ&%2F$5xYi&|vC; zrj8;`TKF$iVA`^B6A(PLe}8$C7@p}UxN^mw0cM#;HwpW(K_T<6mzx3)K<%UwO`{+; zoH?ms{i&E9p7KuZpOHR?b@YVfBNvDI@xrY;IY;wtm}r@Kz4_=H{DICnrgoR&M|7+g2m9Kgi^atuoLPVm*Piw2e;tMs zHzW4Z=O#>WT)n3G^&m_ilDhItyA?x|aFW=gHXQQrs_0F%Zb)*dbirrS9}5SLwK0cw z!ey_o!iL*%Q04qG?K%HJ+~V58K^Rnq9~WPm>Y~rb64GnT$MSn{6lr@H-oe6B%m?Q;lq`d8z5&KbL3teu{%C<-*ZzV`AnHH(IcQQ_1}Oeg&(#7uWO8xkhIHry zbiU*XMRN-eXt-EQEiY1ryf%)1Zh2e=v|nzQ8_lpF-kf?d+eB|bL&rDfEcpyfkO+U$ z`%{PVsz-QT?+{=`V~0v7p(-H$1X-BHd`EA8L<>-6lEIM0smXE66HrB*`jQ?0Dyn=E zd1F3*4_J;cC8u6pK^n>rKMLGE4y~=UOo&P7p!Jfn(}Md3$nGRz6_MNoqQ}1QO%Bq- zez$VZUX5)q`}iqAN=_Z969W6axBkoTR^pfXT_lh?x49tk%Q1L6YbQed&Nd)Crcg-$ zR6wi0P|gDHrQ@m_q6E;xWij!Ms2aRm)VMZMp$xy5lN@-xw}f2vANjeLG%**>`{XWa z0Q2T*3SxYiF|B@T;?1JJ;C9TQb`zNjyrZ(u09?5+k+}sEapGP0de!Lzld>8dbkB(= zbk@XToJSvSn`yvp(;FEI#=k)Cw`@X+c};wzqirK_pa+%jh$IC5f!Hm&{j#~16ijC~ z`7=qN32C)zJUd_Cg3G_@N>uE%;JraN5xWQhpgP`Nmg{l{s`g+ zN~d@Qwb)dEXsIBNinAu7VgK{E+(-emy9ESsNN6K8E$}-_R}XNLmg48d_Qx%+_ zM6H5t=ZN@5k;naRm+YJ}5Tx4T#QkLqtkjRNJp^;;+a6hfX<`--VtxFE?sWq)&eBh= zu*?OCN5r~at&>2K{{iXs^g*y7fBJ&1!Yq1z#%W)`VhIG5{M0Btcn|l2Wf?h$dY~3{ z@7DTa5?tepm1=VOibts%OjY)qAjLpN>1UHFOyzyQfq;1w-uXPcE4cOr3!ImuJ;6Kx zXGLxh?Nc>i1_!bi1O%V)@>*q78Sf+vx;4O~8D0i&>wnyTDv<{N?B)z9EA-m*E; z$1ySBvJ~BRpXR zIGfwYB(T<6rflS;4P=#Wcl|6cBdie!5K!e4hsA4hVZ)AuFyqTsKR+cqd==`cK*+^| zJN&p`k~|c_EK2=;f-leE+dc^em$d()fyuwjVU9dlc#Fz}(VN6*w3 zt&THHE?E0Rzvi2a_O!~I(d>k;#*VwSu zj|GdC>nz1*(?GebyEuL8Gh`(fB>br9CHSQ`Mmg{%1!<;eKUbQO0OMD^rJuT|plDmP z=XS9iuy?+1@ii(!Ui=1-|Ou8 z>k(yyPt6=%4%>6aO`<$YXK9r&M=RC20dcMVPO=Nt3`mUoV-wY1Mhym0TUvpvpw2P9NbG_LsJJ9@GZ*Y*@91;pmyk6nIhZGfaY9f+X zk#i(X!O-isfGljwCG*}dV9Z|3=g&Eaq=T8eWDyxm<}z!DiP{JHN%z7@Pi=!cJ`*Nq z)Aqpmhgm(^ZH?fZVZf&Nr*%X*zq-xO!&wdJ^LG>ahO$n*e@usS6U4Ai^7l zDSlSj1aQP4;g*3d0pyt)+$&=z!zM&IX9L!=!3ExZ--(hypnkiv@JDPAi1B>`y~!V; z?mRlH2I6Y8|3Z1Q^imnxaeW<{FqI2V2Yx(!8Ium!M-RDTC6WN{t>_hS$wss{No=n< z6@$2El$CEQ^AYJ+eiHs*f0U&8?{RTy5YmyT{x=cx3~&jFIi?4sqk-yBk@}G=5P$x8 z7t_6XAU~KD^1>`1aWu`bW;{tivggMq0=#2UQRc^+54!^pvAxfdUAZGVvt}Uba47*v z`;;}ef3ia6(bFv*tahNfPR3wZ{VCFmO)(Vne~uXI=qC!fGeF+)Z)}(5Vu2P;{H@y( z3aB5dN!n&U24(e0@e>hNV5Y`D^&(vmlKcBB{BuMc5D6T#5+!#K(qOW*$;}=LTIkLk z+SJ^$0YWNM#KLAT;vk-fD^W)*@JsI!?Zgl_USvD^eDyRlTnlGnbj~1wT)9Fw_A1CR zy96(l+86`g6>^B3v=Szj*hdLOA?d4? zm!Q}gf9Yp!JW$TP2!)iNgOVY4eK3;tBiA1!JigP*koi1q5SVRc)%m#U`hP_=WVU7d~u z8%+Kf{Mjx5rx&W!wnkVW7m;GMKqV0jRS)6imZ8LdbN;{8`Ji%}#}Lz!TZP zY;xJ!b%s&VpiX-$|0R`Tcj(6(&I)H6*W{jGe-zHGSf8I}U`ox=xDXi@KJu8Ou}p~E z@?0*Fq6$+~I%PdigTKUiY8y9Pru7Q zrug*TtMQig(~ZS`68i>+6pDoe&E7OW1r%TI=Zr;$oovhxDR0no_z9&C2!~=b2^DkF zr4I+c@GIW+pP-E$I-w~3W5Q&(BL^w`EIZPRF9*tf^CeZRX~3V0QFCLo8lX~p3)VCB zpj2WpS6H_Ou|`)EX{dIf(!YFmz@ZsAR*BEPIF$=jAD#=Wz1o4+C0xY1VI2@u=siOk zRs$l^*<`e5x)8EY?8>QaLR~pZOE-7g(HV}1x^>;H=>9FCy>`#9$TNGL&MCeE2(KjE za5HNJ;}u^BPH&We)Uop?goEE9ftzUw^>OM@Nv-3)_4pMiao?`+;h`>Olr>8~o~(kI z&h$Mpc(0BtTsnSm6EkD>@kN_FdL#Upw^;#Ya1DXj1(-q7qWz@z&z62I(Kpi$>3EeV=!)S_+j$y&@1e^>Qpyz)a0e>guz zpygnKbG`}OJ^H1NCq-{ZE~qQOrnevR{a1N0$Ci}2$8B?LNkk<-edQV+HG6bVFwh!* z+#FFXQ!{fFYH$jLoUG51pWzf$ZsCp=(fI=Roz#Agx zkUXiGg@LLV5D;|a(|Ae)rmuS!Tz?WW3bMK6yJ}B}9tbg$Q!6v*9?_RgeAQNMgCwIni)pPJ|Lvw?8-b6@=wo4mT5HV|_*|IQ!*^;G z0kI9~d*`MQK9c@bbZi?52Y&gqrMV4moG44FnXLl$iy_~Cw~m2;Q@YBJ?*BrZhk=Y& z&38e399iKp)<5Xn2_gT?^=0JWHGZ6XWCNI0a5tJ8_5f4z)AMJB*MPYM`M&P!ZBP(@ z@SDo+)jfM#t3@yzSREkZVNi&--(`C>5HMaNlS{EXF6<1nvJIM&HGPbOBPF zn7YSV&pL^kI#=y=cPBtmJnx)K+Y;E>maf2l2SCeSA2n5c=rex43dDA*)Fdho z0ij8bUUU5ln(?)GOBua~{#;j1z5n4D3@*v^&M=jLWS43hZbu4Wx-;@eS&}E=lKFI} z)|whr{-S)NG+YYb(dsLFL`4fbYLXh_oCP6=-OyepJ0;wX^KLMCF9Bu0H(wZ6VaHfJ z-}<|+1S~bSIF}N@k4J*NyJ-3;;S1L@MqQz7SW8SGVH1(S-vz6Tbaxn_jG?D%cBUxy zelRqZ7$A-x1P79wlaPQ+vtpEod%T#OWnn4UlX50J zK?=zciDAT#kw&_7jmU=(5JV;?v3EZJ{LoH|p|Yq20+p$^jdWZ$MpSr;9<3x}Urue*};?6sTCfmId5+MzpDW-=UUe_=LZ*098rd zClMn}08hB13di%ZK=B9iek%S%1a5UynVV&!QFYRrFC#Jl^YsTtglq9&Fgno24QGMS z>CmnnSb-chhNs<(8c|~r{gZEIeP}%`OW9+309_W{Ysn{lgH$#LuloeYgDT+a#n|u| zRT1=Us9JqN?n&Urv87f(w)xfP>)Qfwbi=&n{;PMO(Jp~-bg>7`IDGKD9r6ZQ$)o+Tc7a&if&}*v3PssUmG|tPx$tTwhf)1QMEPLehP@ye0|7Go6#D-^<&1)4Kzht z9bLt;1wK-;E{-J4gWABJqjinbFgBHt&+76Ce9Lw5tl|}C57MUXUzb18XKIU1>;hf%_2%KPkQS=!G5957ri!pY%XJd&+LTdUufl zC-qG~=#IX+x=?NWat7V~-H&N|{eV{vm#(3jHqiJPK3!MnhVpDnbm-#k&~e?pYr!I7 zNL%M%h&J&dkRPR;_$r_VDx^d*`MJEoI%(PYu7>+)`xNVG=hBBr`G%d*r#IT@p9kUc z>#tTo_`yQsqK7PI$uG(0>XwAAfTbw%(`iWZBZ5~kMjpo8qTgtdB>mQh(QZ-fOmkIErW-($ zhvK0(X)Zwpl5i&8scG7jWbE2TcA4rmAF+lgpU`JR3+{+ zVgoO#*wfBJkYe1feKf`jbzRhX{=HWMDOOwe9!vgls zc;a24{HMIUWo%7>kj}m?aqI!`cdo7qJCH^C#_SpQH!Z=B9+4|IA33AF*{L}5W({y% zm!`1vxDseote8FCco+Qq=v3wU2!Q^RG@1Dk#-RHC=j}jQL)2tjmBY1V4#*Ys8A8iU z(Ss&Udf|k-h^wd3LyW`%q?=9Lvaj<7YAqxmmusp~OIMMMpBV;>X6LRHX4IpzpX|PW zl&Aw|N!Mu--=u>NWAycecM<^RKOw#S@+HWQB==91Mabfc*$(fiR3t4JT3k(pQN#TA zbee`o$f=}la)+uHtPA$u(fm_drA+{;ove^Krkxt=ll zMHF(3>vU5E4g4qH@wl7#5S$OQ97!UXLu*UMx1_(VqB~=27x(23fyH@IAui8NFcs%l zO(OPR&*;)!->sNIo(#0r-FXDK<~vPiRvZhaJ+G8YcagVYM2j2pt#xOruRA zEMziIo|mqO2V#7isaPrCe)odJn=L80mvr!st9ceZr!dL55i5?#bU$#`eiw&YkFETv z9;-mxvZH(R%aVBam(x?tVj1jpi_0hb#08wA6c%mxRt0Y{H1;z{@ZvzP)7uoRYWTVk z`@+uNG5C|q!cx_g4=?}8-B#JB$34di@4721;K-jn@5Y!Ip=jsnYf>THI71hS8mym$ z)Jt#Xdq*kZ$(Ou|LTWUyo4Irg+@-;dM$Tt%QE7hYinFkY^#1{?cm>&AGoX zNgz9gWnXiPSep?+s;R_N-rgtSGoPY^&xF4K(aX=h18e`lw@ata&A$DGL@d7Et(>EQ z5o2f0Oc7JJ=sQw70hk$+7kx6hduC%L7jS6Rg`KVLA zM_^C7Vz^TO9T+rYkW-@ihqekt^s5HBu{H6$iIw^~8ud`@W3HY8oku-xv z9FBB&sdq<==-&cRO7mAK6sN_%M0mp+GA6+pibifTqvLS&^#=QL=m+%8$Zzl~D>*jS z=M`g}Q^P!Jk9UuVE@E5#g}z=dNjTgT(f4|V141JrKbl2-c*Rd=joMxh6TWSF{V((i zG`6cC8@j8B;qUBUn;lXx>Zm8@$~`s6?Cj8fj!YfCt*_)DzpjMSc6G)hy5;coHNSdq z4t6+;KQqJ=%i^x%YQGLn-+}|gN;X^br{U?@%^A(AlW=wYbtYfpqhxf!^ZdmI8+mT ziB~8Amb5(_+^rLFx@`SzZc7LLCYn{d@EqAT!N*?-+^tfVgm|9$Ot85S{+zJKv^>uWh15Q${|mVY zf!${32@z#H|GuSqU`ql!*|qw{x?hJZGk?`cYde4`z~_ASPC~}f2|+K3<1p0D!1+(! z0-7vrVGeR7fFJxWHItuR0?${ozEK{Hfa9%?79wZ1z(l3{vB=tE`0~M^=Ebm8Wc8NV zo-zah`S;Y!1w75*YoEjh4>=WFcd4GJr27F{-&$|e()9wwkuF3TJ_V$+T7IdkkVET9 zhi4)E#5gZlWp#3i4sveW@KcblAx66#ul)W)bVpV8MbiQUboQkA@P=g$QFStU@;)Pm z_VI6pX#TFFZYIg}$+~$k6GTxWN=Jw_(zqTTo1($*#?3MxWi#W0z1MXgIZok(pWbT$ z!9>vHId{tE%LLGSVgBQLdt&Ij5%fKqdl)%d{-#PD*+i=~2Xtj`$*}C%)(|55e<(9> zXwO}z6BRytZ#d&j0UxZ?z5o4S7Wsb~Z7~wq0$&8)XbRsV!uPKJUbCNk0(Q^ccFv1) zMoex z0~0%tUSr^}fV_Z2T9D5uLpUG`Co5a9d4%2o`O-7z0+8yD?Bti{o`NT|UbGSXDaes7 z`9}VkL~vo+*!F$%Q$*a1x?RmYz?MMs&kwulV3NL9gQE8Zvbpx1D52;qkSo|Ow2C3Z z62pUT#Il2cf@x|0+JAS)+x*vQZ!81j$MGB-y#%oIfhe88!7eg45f?ibO9b`0>EBeX z)8U?++|QZ~r=WXlX`X29HWK2w%%&_v4Eg;8U$%JDV!7Rbe!M&j?1th)N$+vNb_Vn1 z3-beLqenjC(0?8sPTBX(=FXvEu4sw7Yg?!-!&L0+I4LgrPNmP$#0JY4C>g>&t^;O= ztIIjkZ2$_Es2<;~2dyTHH=nNdqDit(E4MQ~0zhE;hS266`aIR57Bh#zGisOXC;Li( zOMZ-lNNG2^WbVDEB{>MX0zQ9l;*Ua!u_2}|<-H)xO_l77_a2#0%97>er>>prS~t|HhZr;FGhe}MDM>!F;YMrUJ;@C5s>EkSe0RCpyJQNjn9{+2ab^U%p z0bYuVyx~Ztile&=%$f&Taq#<)K((qf*u#!>Ipn<(Y_|*#YZVuP3M=ikxfdmI*91|{ z3j#9i^u40?=M^DLOH!6$x~G9s9~zqa6$pZw3p8^>JP^FIYu(d2t_5C>!aFWGnrPaX zwQJbxEkM}C6_ zm7Vo`q(tg5#k?3=P^&RsQWB0R*`&_gy=%IpM1G`b>b{z8TcXYL%*HMRT!{vk5VQJIx! z>8WkSRvI0)7C7dDHOTR|O_KfNgA_RJk)k9r{0^QAXIfNeZ39iW$J(h638BJu=dAZX zNTJqwwe@v}12kgvdHe?}6|`NFT|7Tc3-_MqWfy%R$HM|JUD4u{@eRxVtkC+mP3M$2q(Q_9U=Nf2lsPdL=4EEg(@y*l-iyh zf-RZ9R-LYN@a)iJtxnAe969)B!9Rr_tB|#up7UKotQ)==k;WW&`en;2=foqVQ1$9y zgqaauYlcKj@D%J~9?1?n_n-d#{#-2g0t#Xc_Q~|vLc0;-r@lWWgeSx)*Mt7%gZRwu z;%7{Ws3NWr2(9M;f)*>c(~n+*LpOdW0|OVtVEN_OWrhMI&`s&U%2f$wii@o@846J_ z+vn{!bxw%!pMKw^za?m!G%`@ZvJgqEl7{II`=B?RPvX|+^U*&N2jThNVDMAhTD(Oz z7hO+|diJ2r540B2_2Ma)*Ezqhrz6z z#<5c|Q%G@4=xfhN4=BGE)R%p44cz@H%%*dH9vK=hKkM*X12%@AaP^ZGkZG!*x~;nd zCSEb_h09^^wPkHw>SrwCZBi-AJ<$b1#>rggFK2^9a#k;QjZi>6-!*7?Z2;X+O=a+y z{sNpIw~u+cW`j597#vfaJ^>f^d>*^T3Y2BIQD3w;1j1aZowF~N0G-fd3726#_#87D z-^1*=fK5|bhe171yt2B;BHoFt`7L!1jhm4{5v`WUk3N*sW~LJ?U5A*5 z%!)?h-y!yT&0*^uSJY_{#=n*p1pda6bvnmKAUZ=5b*v?cJbKwyM&DYYPm!MckLqAiEE(c=FEqZ9YeIUdEuoJ`*SeFZ|B6e zVgoLn$$Xqj{|w1R4BIMH27=x=#+|4|ca-#eONubg2V~_=aY{~kgZrs%Vn%lE=!8$b z`beKW@{1{7;o*w~x|8EC5;_im5Rm@+lV%@KjVPuN?Ck*gl2>zXgyV?%Y}>|h$rY4w z%JNH|+&)OB_HYu+8AN{vPE0R^6G9U`w@G43GWco8bj?M79chkx8#c0bBkAALx>uSK z(bN>LzjSmHy72v;FOOOlurbNAw!1wAbRELOo^Q4R)$Omozy2)(se$j==AZ{W?*2`` z`13b_<-s~waTXm{VsE;ZF$?m>e6%78-{2dp>NcbqxloHeaW9X*1V_Be{l!^nk3YqT zl~dUb;&*vEx%uOzu=K)uWW4(aD8_XuQe7?swvc_|w_K@)VvSqQN(C=4MSaJmik(R8 z_lq;<*4sY#W_+S1;y!{?+@bShcM9;{W2JlII!SO(!Yt37=RIx?^ABAYG(=`F(E~wzS+Gxbx0hu>bJ)?iThkNB5AFr+1fxcv(4T=pDRNlXzT}Y#dD&{jK znj3F`;cHPg70%kI(Oc?%dzt}=b5b#T6MYxd-XZBA$hiS5Z@APAWU7Hk-rX4$9ZTSL zHpT3IfdC08=k&`_+a$LU; z+U`;HyuNcA1f4e3SEJVjO0|MA!Go?yk!4xcHqZb>J*DB5N&kW}ooBG?(knm`UH?I) zIt@{s_pK!$4gl4*s<(dME&z;#>Hj7i3W3J#H{;(=1A*rl_h1Tr8j_oSq-(?Fi;83I zrF@eM!CO|E1;%slP(;gO!CY!N%D>Ocrmz(QI>k~Ii`|OQ7qWKRYQ;A|$J6ak5hw>5 z42}Jr@>w9UjVbO9ECUj=Jd6Amk?5uqXAzU|Td)oqb+x8bK}@h#$D_U9$W`#i@}I0B z(0OPpR1~y=c2ff$KK+hSy1$@pd~iFeUTCIDy3`Mp-YI@M-7pKDJnz?Xx7ErU0~M~4;L<9`Ctcbjm7o9)^_ z==X=_(|KATnN#@Vib($1BW-bQT z$Dz?c-cR*5nP_prFCd1e6y(446doCV4Mg;|W*G{skr-WFv6yHQI?p@s`R0`r@Q|A5 zq_#>vP#)dqU=s`kY^yp?S?gWVNG<9SO)EfgY;j&n%x_Tdc)0ub9WTVQGOAtDQVtXk z)kV?C1Z@6Np=$B{BWSwf-gu7L6v{uNJ&Yy~!wtp(5k|@Z@Xf{Ix9OQ7*!ojpi0)`8 zd=b{sIPLKmCKgIgMRwkUV(yJ$Tj~K&;N4}oW`7T#in`+4E)k0Zqt0L2;MT*R0@GQD zZGxcsJItt|?+G7oTn}>0^@cNtY8R&Y1EF3#h;}Jd4HfOw^Jp!vAj-BGXat93x(fV%B zhNA2Z;)z^KLy*e;VznW~6r@;Fo|scH2Tn>nAJj-J(f%a4jZ%g!vU#9LTe{^A_Tw1Y z;{M~di+=7FWwrr8+nr6GsWuicY`%P)`luevd@0N13lBu86n`o$^KTg)qT7e&;PS!7!UBL8E^X?gCBjlW3 z&Uf{h6;N^ItbaFbkJc`Ip^4-bKn>?*W2N2AfiLBsu}k@?DE|jvPu6Qo?#eqOxYCEy{@y~d90knv>TY@hqV&%*~n50ZB&@2pig~b0t)-( z09N>3{yX{~$K5Xx%K1_PCQcfQGf>9^5=T0ZUo%y}pskc%E58wl^4|VQb|M`l{(1iI zA4fI%6MnBOt1S+Aa;ijGWHunLDUU~sbLjwcrO$LtJOT2G^%s$L652{weg3}dC9@#@@5_DDTM#63T2vyshv2wY7>seNUhU%_nM1@;!{tg!CBp zu!>i*d~ysrT)4Kq_4PCQ+fFaj!AlGO)DS70s@O*kj=!g0%P>M|3h_4$6?;G^0Oyt#T}XfewiJnGTedF2Gr*izrCc$Oz>bGL!@B+($5-W8O@eN4R0(iiyzd5bcFNTB{G zMMkDx9+Ecn2|0V+#I_aP%gOO7aIbp#eXxl*G-*hFzc8zV7ydaYz`jG&nw~j7?97G@ zI{vZzC}D-?bq8Y;{k8Ee`{!EHVmdGqw6%vbs=+?#J^H-&JXj>-(-81Q={h68i@TN%PBa7X54GBQt5Oj9CyO=f}$s|Qr}tsPv(s-!Ht=hnorK+wc% zdWY+nlJJQRHxDhgWm(Shzn3cg+L*Np%=6&@wMp1NW!UY z&HW^!3%F|d8WBa3GPY>Do>7WraCdTIgTxXQ28WV5pCl=9m$2fmU{eTxWJVTf6H8+K zc+_Cl#fw+`V|=fXFhX|g3tai*^jNTo(KM%=4C92$x2eo1VKgzXT(Phi{&+F^)E*N( z^v?3U>+E(GR&V=Bf;&$ErE{rXV@M3>?J?0gRu&9a-!ito5Az3E!&_H;CnCWsk>k34 zCSGWBGGId?GX{+@KYu?4JWwx46h)*lAna6m3VB5wisYmrZU~G(i#eZ9>QO&NTUlI> z1SS)J5LbQO0+|~szQEGtIg)_J?$pH+5Bj1Ff;=*MH6JAQMCRqQtr!%oxF1gbArw`o zO0jHQ(*V!vZJetqqrfJggO^X{IV_g^3#2fCj{h#*RAc zwu~?;*FAG?Rt?gcG;j*=kiee@s&68^w$Y*13*?R78*YoX%(VA1!I{+ zf8MgXhKnS}XqKcDVfAs9espvVyZ=&pw!`%pu|)-rhp?oBC$A_|zRv}rwB`=>#fAXT z8b#GKzn29pr`~m7z8WO+Yi`C3wjCMP2FD0>8Dnr)QptV|(3`;s)2|96>4%;xSN7|H~#(fr+ zC-T`(Vf&9dohL0s@TjV2q1Es($Ye}8{Aqs&wYe<5P9}H*tiI7kKdNX2_R00{dX#HXh0(LA!}ey7Gbg3QxH$nf z4<@-&^}m5puCHyC^j{D~sMuA$ydt!4FFa3lX9%=MjOa!ld;n8GI_E`MExOQ2vf8}Y ziF7J8e})nHqkC7(R^}91!P_Sum7=m3JbH4i<%3HHAe%LfzPwz99{W4+37_JJ?|i&A zIt=(Q(uki5XcB{8hYRC_YsE0%*xlh@6IZcF)o9T%UI48B% zb$CCsDEtkm4r&{;mKd<=Gs%rs&o$6uw87zIa2D#|OO`g>oN&0NWT}O590{C$L_@Fh z6y7T2Ixn#8jM>OEsU^lA;TKo7g zY>%nGJLci_7Ug>P9BP=zP?@=D!{o;ktyvlmaYyioDqXJ&HYz;jeQ`b#Qa%!RJGXKh z+l$_QlR9vOJg=%HCKpq}qSGB+=iB>0)s@dsX@>~&$Ib95{2{^Ci4TXc!Z#owc#kk~ zWgJAFt<5MuI}I#OJblsg?GRj$YrEZ6R1St+ZtOG&AA^3^w{)rIj^i;Dt`V`cglay$ zSZp}856*pExtu%RkI3{wl+RqX8sKY zCfLybi+b#nIPQblKOYD2z~4nrmn~j1!d<54XFNtWfM(PQ_SC{N@XPG_CAGyRw4tti zR;q*vu4(}>4hIe>7<^`a_SI=Pmfw`W;UkWJy__zpap#76<4wc@fC77wzb2|kX26f{ zJrMV6Uj$JUvzFg{4uQ*-h}nW&KB(vY<}w^Hh4k5?&s-y>!p)SG^nVn|umjb7WKl?k z>3>|?kg;HcyN29>orHTJiL7muGiD1N%Febfn4W^^RC)&|IeNi|hIgHzS_eo$bCk2r zZVuTU=N_{@0-J|s?D-Q_??Ao5q}Z_jq1mizG69CQe=T9Dt8bMv5J3$$e8NA<;?%e{&1MEi22+L6iZIee{ z@&I^XF!t)?R3BPjZ~6SwA`c}RJ*VLNn1zZgSi+Xsjc|eL+J}KkTiEsFYg^hIQJi?` z#X?V&IacmfVYZEzhppRDLiZgV;aAQ-S9v3@z~z6Mk7ys=gWy*Sgn=U-*w%Qvsa}V!~d9hQann8vO-OZH^FL1Q$v!dj$QShm) zPAGM8D8AgH^@_(a7|tE2^}AT4!0O9RL)4G{Tbg+<#O5Z z!&#|k-T~=Y;su+YoIxebDN|#r%FBY1(QaQ_mkQy_28le4Cs}YXh9sAAG8GD7M}gO* zPhpM!6YJy`*6`WmSgX_@MX+jJ$5WRq8%t@9HY)EY;cJC2K3u6Rh9|9`Dltt{VPl85 zsPor|G0lvKbBER;0$=$jnmMM>ziX6Vn8Vq{{dkR3}1`-dNX zWetmi4|z|Uowdn>pP~r!Ka+;SV7Vu$c26F_Bj&BuAeA8ev1ffFDfKxPW}4)(5lhBs zm}0snIuo)}l-2fo1!GP1HiGjtY4}1TUte|RTj-hpuU@3_6}J3!a98O~95$rA?_$jo zkH=%YeI~DD!ISZ-o9RQPF!V=QUGmFlFf{} zz6-=Jbi!EFJ+6QjOV9Slz7}BHFC;a^MHj^-+CR_vPK|`*qNv|WaD(Fw>J`B`dLWp~ z^}h3hG1z!b1{ehGk#EY6AeU=ah!S0;%^fsHBfJ|g&R)2VwE2%wczj_8LYqMnZ>_A* z>BK3GFG?z)2Qga`X1F6+4xVeWwf8|io4|+ZQr@u7dW0)U`QVgf6R7nmNG-`;xo2wmNEeX_7>0bDN1?1#H(fCmpw zO1nI;1MitctgvGMVpkkVd0*lJ=-h4{Q)V~;dX~BR*0ik=XFxdZhH^aeOUqbWceX%Z zT*`xvvMdpIdSloFFrAo5YKFw|FkhMoM2nfLG-jV5{GGO@ ztJ4+~L?z#r+6_Y)0o_@7?61&?$Nn&kA{E?G%zA31T?Wjwdc7o16`)90helZS92NLD z%bih+L5;KoC;iBtqlbpyyZfdKkZu^b5^(A*I&Vf@oANOQ)PA}c-Fl%M6yC_wIej@5 zEfDZu`6*}xWa7yey+X3UYJ!%y&0d*YJ5%U^o&%gU4)#xV>X2I->?DJ^EM~39@(05eqx*{$eF$1_%Pb~IQ4}g5C zBWjQDH6Zu++ypz-778AF!=BLh2~CvHkhmqSfNO1nlhf**h%3v5_LXEHIvrECANi>l zl)8!AHT^9GzET9=$lH66u&R1m65S+nQXr@fD(Of6CKwB@_QwK8o_pz=-NQ)VXGT@} z!30<>s^%$n7(twmGuwCH_MlK*V;_->c67~YhQ?UC6b*JeGl=PSgCC6#4qNLRP>8A2 zbq}s_1c{}rUMqb<7ccgEq{sB2gSX)UZ{{$1R=E22&e>O}!{T>GfN~Ac=+wVCL~n!T z$Qbs@eN^E4C+niuG;c$4;S5KWp;;!=JMiV{3oo1}Eup=xKWTD- z8vbj`7#TLE2m8-cB^}jj!&Dockq*)OkmSDO;#*E__-azCBj>mstiI-P{P~Oye!Y6T zeKXt${*U4E3!>|#u_sX8xl2yn#GKwPEvl69LvKnS0LRKMr&yZyAb0~XdWTcFY zjLb4KzVGk3uJ^}z$8+7ck5<#--BxQjJD^S43LW4%1JQcbW?i`6eE3q>&<1MYE1x(n z-NC_cf^W;n%fk|W_>$m@Fgy%N`E{j?4NJDaWWH3$1!;dvTrx3}z_%Btb0S3{e&T)f z^gZImAq#p@i%tLMdv|9^IE4Tl_#9BJ)Wi=@wm%RSy8;=qLl_A@md}7PRU68^;u_`Mfja}po7rO)au$}xebDWwejyXnfhbm79 zCQDy4v^hKmPk>Q|>bp$PIxnk;0+ON=E!RWrY1bOWgraS0Z26JvXeDpnumEZtO`Kfz zU28CYQP**Xiws!sx~wJe95pbKDB9K;NrA%_7{oOziZoX8PUKDs08MF$uVz7l$mY`1 zK6fe+kgQH2;ZaPE0GU0VPXIOe^hujl?g|O|sld(^a#j%hW;PAtTx0&UVTO;X{A!x4C zrP-?LHh66_c3$ymA|lt_Dhc6@M6QN9!+$&@0ek)Ko-xr5nhq))%wgF?ud_K&qtp7VA325UMrSQa`Mc4gylVY36%w3X`y!m)i3%!sZ(_l(yP$m$%~#x(vExE zxd*?1!7UY;fKCFqzB2yl*O^VUYHjPoTCxo~LIQ5qwG!dNphWc5N(<6$(f8U{oW*VX zRK^3_QgE5`L?(sq|J;RW-WED5z~H3E4})X1aZ#dQWuVSgm{n{bt4?wXI)6AykbPo_ zrKwDGWG8OHh;gRqok)JX7^tZ3G7quh`pr%HGz%Qp#~sx)Wr&rh;$)wY?*m1_g`5}7 zn)uqTmu}^#F}6s|oY5pwgY6t1+g)#ruw?Zc75gvdF!AT#urD^!cq2Aj_0f|I^yxw2 zNYZpVsRziv=J~SHz&9K7fjEKWTd(#)Ru)yMJYfZK1c@ znJ1sc&_i~!7j0)L8R3cN3)RzIY%n#B>a)NA9S+a2IL<^qglKZh83!iVV0d|g>t9D& z7**f-xh5?afcW*5lc77ncZWIl&2?gYzwEM(fz_DQd3gsyxUfFW^ps@@NZ#`p(Hr`O7Fv5oePegQo~EVb;*C|* z@ojZBw0I9)E%+vt!1xU$Cx>_EwvHg*O&1R7%hM?2aSutj^BSUZ06jp$zqyhsV@e2( zy~g&*cD50ri_>bWQUWO=%F?9WxLciqX z5PD-huhzLXfS%o|81`TMg_?OD%oUvej$|)b`Aa7L1YOoY(Mh_W;O6@#1^@m%aG-m5 zUZl1Se7)7u*WNJ&#;cCKVv?H%q1K_9y!O)|B>!{mRquXKX>onO-8%p&l~M7ImVQCm zwACN2p6((qy=KNK^)f(ukgM(~H;+tBb}fmIF#-1_^6D>l-B4kBSg*Fk0}#z}XQ*D; z8w@(m&bpCZ(WCKS?q40)gM<= zEu^*3vcluy)<-UACRpmGUUdvgvhi{is*XYjTa+D_f?j~#HkRdpkAXnP=u*GnJrA@N zl(_V+%L}}mOUsy53r3z~AqBK|-NA#Vf9>+RK8W?zB>CgB21rX;^Xb5L1PUI#K-FNJ z00JJ$5)rc117*jN0XpLnWHo$Zl|;E5AogD)5#-INmBf`vw5$S9iP|JyW^DkE!s{8D zsVk79z}2@CHcp6T=iY#~U;^6Q8hsFaE)hMjIW<4GP!7~}*bT=D-=fvhTjs6!EwB`+ zs$jetkC>?hh1aydprGG^JJM7>AiB$|x>70;xRMi|{81SL`04egl*h&KEr)?u!#6mv zvXuQx6=_LWWfr01UcrIGxRhyxh*j_fJN10qTp@hfvrPSqCLb2cE?cD((ZnHMWTXj- z`uM?#S?9PsIe6knd8GIuCDyD!|H>=p5y3Iq&mH&p;8i5ye5p+v{zz?3Qkj#6H?E!j zve74x*#W;9(V++~)7@fJ`pyHpgu0H(RfI5II!oe5MRGWQ@@F|C>lA3TI1-1>QBcBt zFg(HJF3j`P+MM(Azyaa^jFYsTAJaf3jf^Y-Q_M-6t{s7Dokh}j5*>mX8ve}=hvXV%{i)| z=|}Lsse09&6Yh8}!O8bsnK4Wl?3B>qdW3_0ZWmDM`@nIF!Xfp#N6^KDq+m|)Jggax z$+tC`K#7cFyx9e0&=!WyZVoZv_G{uN>{AFZo>>!c%x!X6VW z_LYM0?{W5mN3Wj(*!!!D?A%Qhzb*aQN&h)&)7|}aWbKCd<6Ai#$Gy-o8sAS0vd&;k zD~UZtSqt3DcLOXjK4^OSlc?@fAG9t$k-m5JK3bfvPWx4G3$)ixkf#iK0zW(HyPAHM z$lxYl`~0L9dO4qQNa|^iyzR|Y%sLIx{*=+yZ9ykcWUcdE>6sJ~-*0-$CnbZ3m<2~F zN$61CSb~3P$Q^K*YtO;4;}Cq{lk!VaJw(OEo#OY2j>E&#hU)$1>wwG2VOwf>5o15t^i2VN$&*Dp*A@}uXivJ? z_8&xEv=pcjthDT zC|HU#px8G)b_se??0c)}EJ30o{B3`1_&{(0`ChzEp;)U1g&og7OP&;l@ozVykNKR( zw{+4!2M;hpk1EL@z8ZXZk$z4j<0BOoxTDC-;~|fIS$~!;ABbS5+Hmh%(sIz3E8+P^ zr&Exi7>9W*^Fy-$>C&A8dA#dMrGMOB7A~zOK0o)r-v)QDQdAdNplu2#CWWvr%*XVRks7o^-k+2g@?1VllAOD)dTuKf+rddf37(-H^vL`cYq6hpzJ zpr-cy-e<_>;Xu0adN9boEudAY=7+R(xtf0KMgW#qrh$B0N#Jzi<%};$Z$R`Yd27h0 z0K__wI%~%n0G<>r842~=02}V6hYdemk<96H&dI-DBFbM8uJ#lk(ZXk~ILhD;=;TN! z*+>3H&}A<_)lK1nGIiD+7NS%B&$IVSrhNzqfBH1AdO83oT=lfNlvxG-Nuh0LZGDtg zQ))BzJpzr?_WmJqD@5F{xoRy$Kcbg~qA&09eMEw8L~+BM#VFTva^-qkHj?4yCOgxa z2h7gezipMMK>^9FJ=*@+C|XO!gGww6kY8NYqWPPHg6z88z8v}^G%%L?IP^Shx)^ZY zj2YnW#QrC>4P5Y@L_uPfp(50anljd5XToIfA`G4kUc|rdMLhbbb`qD5UmqsAuU08(7)a4noRGL10c-z=?dXRB6MZQ284{c2r=3W6A5~7J^H7DRQS5t`N z!cfZ_xjr&p$4t2Dp^lE#A6ju@btC=(8;XS za|@0H`KJ`f*d+XsNBo^9eY0Wch$n?3{ecrO)Mn6)A+-Zte)Tt0vck~ciukr3nn&pU zX+7I;!&Kl-JYSqS&j@1cyv{qE6h@mzN9GkL9sr|;)9J^m%@O0tqqo{_Z_zuQlD3pz zfxtDwmj5&}7aDCN|J2FShJFfvuwRyHMyEdgrU*riK&*%Bg{ERTIC4-pYxipmh>Umo z#8&hpIf*+AMX(Eb_FwY-zBGu)T3h9_>|4RTJ}qA>3xvpw0h16~-bbk=>kGKBdWVShe#q z>P}1xP-1(qQ1#(AIA#6EhW{D^Jf+kd|Hx$m(4c~qMBZVrk<$6rZ;lk}R}m}hYwv?0 z?UOkx@-)y(Yh%1pA)48^1=Q$XYX1Hvm;S^>9_KvbAUBWPX`-84O3i{g*(@Fkm+ z13~?28#jqyKr}5{a~MAc7~OhJ%PXf*=x_^_{O?a7$bciKMr{I}kdaNXa32PEiv2PE z+mEzRBL%3Bc|V%t;uI!R6pum0%_}}p9V*80up>$Ix;aVej zKXmVY#?UBoMQQ^dZhS`51fs9*{y*1JZ%cw)#_sc0a4A#C<41H7G?A!mGx z3f41LD{pkMz~$;krhn$eV53leDa)7t^Q^SrSiM^m`dyS)PB|e5b(KSHm91sa&>Itv zluia9srP4jpFV)WnN_QmZ`btfDE8v)y*{@BH&%67xu`25|Fir zZOq?c2OJSU;?*~g8c1FJVj@@g(blcXvnQ6$p28vwz-`)-5zd7hRBUG3~lRGkq59lYTpiXWMQM67%Hb|Vk^8SDLdk6aiXetB6(K_v#Zom{*< z2j3y;+#%V9Za?6}uBFk`U5pxZ`>7&*9)UQLDaAn+Pox;nWbUw)j7Y0q#JiLwfP6NV z`uNvjpmFn$BI{QtBz=L&dQ0L7y2-3(3m^M{JI~||V|>HFhY7_Ok-_PJr@UiPX(AXo z|E=g}VN3&dw3p~u$9#c+Qfp*N5JWqFY-al}#R3&A*X6=84^ZAoLMnGP8_4T19FI7e z1$ei|6gRe`fqRq9TO+3rKqc$_Vt7(4Xup5u%^^!IGJX8f+fgbSQ5|M(q8tS?V zTVIP&v3N<)3A+UJ(W{j!G9VQhT8C%!{BuFHrL0cf(dkHR){vgcBpE4G`$pScQN?V@kFqc&B(e&N4`{9fv4VQrt4jTR=yX=+G<5E(S627x&IrPpU zhm{Bjo-~RHtTac&7X;YOaa}+I;=vC|nXaPiBD=nX;s>gWL}k3ip+<=APnEdBdl_KB zA?Pr@bRMzU`RjW4oC3?A)iz7_G$6J1uKcMc72L5a@$qN14P>?NEnaCnhXdT=@AOdK zgq;-bb#=~Ga3!5hH+w}E9(Sjq;BXYfqWT;^-;~;6-qrcO%)%>}XWHVLm7YG-_e+|+ zlPrO)L|wGD)NWx@I(h3~1DrS}la%5#uNt1F;=P>abP3X5ttvRGQN(;5F@|i|1aewN zUe>U`0*QsqUU4#*z*KR;r(O=GuqxYDWb&gq{#1R(y}aBAd+#VZ7IFz;X;wGS=?@oi zLPCbP^S~_}GelD!N@NJ7g}B_ZE*rwZ^hiIN_vVm{6gWKXx5Z+6$v4*xB=N$(eZrSy zvasy!=DG9H+L$d>=wqj}HI5}c-u+?t8dTlyV)N*_h+}1phjNH*uxxnbGkVuskn>tA zdo`Ui^zia{#Ac?6#hnQ^f3#RbtFvFEHLq#Fw*FhEsB3vpZsCO{i*|Y>IiItitRRM7 zk5no?QWQk-9IMMmvcl-Cfe~hS#|R462+7V6(E-U5TL#0Ev}o+X=Dv%9Ab6W}>uL-S zGf?`ny;KKB8|w68~yuLQk@XG^leBx_OmFEJWgr*{#yZ*E=<-kw2Ouu zYaJs-&IQowV{*q~WDpGG>4`NC&c?HG;USEa?;tPj)`)_34JIb9m)AU1fZeQIyfeoF zVCl_sl|oUK@FcYrQ^~C$EWPur+SL9XW^gUjDa{OmeX-+7Lo?}EJMN{_hsPE8!R22@ zJ;bH>A7f~(o^ULl-O|>SG%dtePW&?^_>%_9z8DA)R1`q*t8a~PeilqsJx*6%LWCcR zC+rb_SwoJ~k|U>H5JHQI!C5(qZS1(&#DwXkKTM+~IR~}x8|z5ow%L6W_7d>*$pbDwyCx(Qy;2$*vV#VDeOKJQ765$_ zbt^inhPgzhTlP3)@lMQz^A?*ju*dc39e!#JICH$bwd1`qWP3kxtdFA?3SX zE?D(KXl|^P55~9FnYoP{;_&$s-fvRRV#<3LhYgLiaGju0vC)JACN&XzHpFQFci*uT z-nJh_}->kMNzrqNQEi>CJ@AE;i)%(#!KYya%=Ts%EIDP`} zWJzf5DvB9gZV0Yr^FmpXYs-}vSn#pDY-3$j0=PYC5N%lf9T{j@Fv#5`z|mTjAzFn~ z;JLg~Hm%G_9QZ=~-!9WBy!&#`Uul{PmwA7*>eZyewyQSOlEw^BIzi;xi{dj_;q#ee zFXTm_W1X%DQKTTY+|WONbRhPPVRpwxv>3b??4x75f;aZ1+^pv z-#w9rG20p!4voa2RM~|Ekzx}3@)dJRNs$zMnv!|L+msKcJ$U$XeNGs6xu54r=n=!b zi{Qk5sT%YuKiM0{BnWSE+#ZkY5W=huLvZsBCA8(!$me@Tn2vdJLDtj?o;M?7q87kzq&};L0##Mux*lx+^ zqT0d(Z0a{|eWA$)<|?z3D1FkwtD1q4o+}pc+^;_~TL0%>+N@In|9fZ1dY?S!34?Uvfe z2FmiB;WZ#O!TmA$;;HxkB5iJ7*`pdaT<9B`L&|Rt*@5M?_%Q(t>s0t%NEz_IM!G+= zy2r4PE_Y02AunF}X+-xcP!6|#`FNeKjt^&-6{?>fl7%-F}WZ{eH#LvW#5V!WT*0pl)gVw%tJ0|nYQ13W@ZfJoZ42m*JyTT?4rKH@v?I%^S zNnfOR-nc51AYTz|SrLc!%UNZ7%RfN$?~HdPIkNZ<1+UEN&?cy}B^+-1yoDT}9X$yz zyNxr6^5i2d9dP=Z%bjN-524kWY(McBXMF8e@EV(&72X}MX}TQ#e?J6HT>q0~2EBbK ztsB3Q1`K9Y;79~m}i}Foi9ZKuT3c@@-aA4zPtS}wh26|S&E71C{Gb=WT30|_q4=4w+bP&j!hD?ip6oO9i8Z(d|V`PSmxmq%TY<07;4bQ6L_PGp%UI3uWuvv7IP=NnkT3={rEMNZ7XnFvGb_t z#!5q9&}z0P(|vI1{nWP0eJLR9F>0f-ru;uw)87~9asuXmlVe$oEfKYTYH1b89prnx zLPtd76o@l#-!ZbekItOwJJ4e=!9??6ql+cBkoS{lA7`HgHeEd-J+5K}ot2-}X%Sq4 zUe)sS3m?>R^vK?pbC^1Oe7EFP`GyLv-CkqtU)RCM0x0S~j?=;!y4ls=Bg!x_@rJ*~ z6$k~b5-v=9J%KeQ*kl6Jr68N0d~bH1CRAA%9l-P#am%v)MBqFPzH~HxP^PE{JIWV3 zSr-hUmX$=}^ECsgDbr6>z$=Swbt}xq`~UZTyQHz_T}#N?^ViKK$uVG3X3DwWG=PSs zf3&Ywm814ZIePQUcaX$at>&O?deOU87`1K@*yK;RDDFVJwcJxOQ58_J#6N+iv7gH7?fxxsxFcs$3~ zzP|4je7{ZBei(Zf`~HpVSbgG)vyKfX8=Q8>oz}ZY@$;T|`vg;*Y^o;~lzJb1%+()C z*-ndHj1ItSZ?-J5JD*}N0|ze7!`D#XCviwo{3Wz{r9dPk>xWATcAPUQP2k6qpM!Qr zJ)!wb%he23U-(4GV10qg4U$fhQ@lCl3Qf+w=6MQqU{{%@rEbqxbVYGrZDVN~5#7J& zuK#uma8EByt86zSckhqlsipfUJjdW?TF4h*A3@NnoiYLlAnAD4-e05zhHn|@PoT&* z&!!sP8d0Nvw-nKf4wPp@y;wC&h+B#b@^W379q4PPR+JpV5s%tjH4S!DH+{JOzxTK+ zSrtU52T(<9ex`LsE8-*Asu{JM0z;EO3^l&C0CLLaS<0Rtp!)1=AYEP;N?(XSF>$I0 z9K9u|*BCtnEo_9JiVFy!=GiOyXH4gT#zW8JbZLYbhHE^q`Zou%|Ju>qhckf6+&?Bp zoe)mw!UVOQWe`hP&0u-3ix%olZy7O@z`K8UZE{5auQ&GjN%eXKnQb-9z7Zbqjp4 zQgrazO@m$WHIYWY9AT(OogQ1nZS3??YC?_H5Bj&7(oap_#{rKrw8op_VTaB=;|$vb zX!lb*lV-*M3&a>bnktRLuUE+r2LxYYf{oSF@$$ZKQRDINwA@I1vzO|-j$Rbz34b%1 zlA8eCLPjsV{Pq;miZhWNX$E3br)NYC1<`mTW8k(LLo!^Y=&3Ul3C5Fe-n;yM?F-9P z#fIys%^~#gS6Kg)g4XvQb!I#)0nESI;CR>5E9t=gO`>m*pf5^2t4Ko`k`4Uyd>kAr zQ-D*O*pu@O3r=tBI)_WRfVdJBoiW82&_*&~nNr{lUM$3WXTli7!2WL1 zCHMu(N9Rkq;=&Qjs}z%$f1?naY+<|B%VQ9H*@^qiwvPmBEIQ02_~C6LagX5YEszz| zxnfAoh{ZxxiS7INvBlA$M4#dzn#sE}7h(7p+`R?V&wQc8Yo6cuI);gPfU{EN!(XSwx#CW0jWN}pyM{{hm%CO^Bo zo9JGkHwbU$gAb{$P5O8fLa|q`I4q6$@u{wccFxH$WOk+7U*oF)^y|?|;iF~6FJ{D6 z%G?;BRy0pyc?dHu-yjrYRX7O;{^@o*|K*4On1H+82_g7G+MUi!fd)r;lWo1SI{chba z=p$Y7#Y_7S3MlOE^avAx#F;j)K0iMRWxMGIrtB#3T8Nk@WkDN?sWIeMy4Me$=8WEO zlB`6AMm$43jOpmWhxEqm*Cupz8gMiX6(ea;=V!saUy$az3+=Z!D}mscW$Tl3{UGMY zqiHwdLKHkTmf!KO5tP`mFP5$S|9*$jOeYK~g0>CDIhf&>|Ydkh7jb!wF9Lgq8@)a5y8 zeTfP9@hgd{t2Q3!Ez$-%g@l6!vM0NQ57WRr`!SJbID~1yp-?^_g}Ae@t!-n=<%10Txn{a_NW}?50!+A60XeOdK@?1c^vRJ==WMLKQ3KoI&*$g6ke!T z{iwey2xIs(u93N&hn$%cO*27?Sh4R)?A3D$u$4~y+if;xEFUVMkgF|@)#J0h-&Bg= z2a?k-_`kBll5zT%p~dQu<>fxr-n{!&;kQV$8s0wzOaS2P{dgf^x*606AEy1v5AHO8L&=sDAdide@ ze3|dv*77hUmSuI%OcpLi-BUkLx{W5X84ROV+2Id+9+B1i6!7I}psU-xV~|p{%zaCn z4HtWR9b;lV0olT5L`r^1V3Sa-q0U|c?D6<+R&9n5EaBN131IjKhON}-gr|A&q(CO8 z-pP}2V@?14lm{ut^6oj`V#mJ< zC%(hQ2-UG~+NOg{$X|KYw%m9{}QBG;@;c zh`ogPz~kj6@O|IiK767c<#&U+1oB=`aCOiqv~~yGFSQuiB4UBoY3p^3W9e48xp%F)vftBVjpd*-kKx?oDhJS5!b|#I3(-Yc#nzx8y`hvsgw~+y$ z^tt1+)=VS%8awcK-@dH1y#)BJ1)Buf zM!>^ggM}_{ClS|}|GneyXOQ~9Zu4pFeYEZ(yCM1NFDh-9W7q822G4lNMz{8fV0e&3 zpf%qCYFJ^2*mau*q&M7_Oz#rn=?WhGB)4Jo_;N|Z_oOi()e=`Qrr!kydwLiM`hO<d3 z0=Y)8=A;rKWYO;A*|y#R)28|N$pW{*@6$p~E+)$;c=^i8sy6{Voog7)lTivEBb4LX7Ry^J`*506R;3gUbkMJ=;5 zLC8sQttG&j91a>~Q<+keV{PGF^Oi#a`10#9(;0FeJS*zaov_#sz~V+rUm6*{?r@PV zfP)Z5vFkYB*8T^cWs8%i`s@I0;!;~FO?LP=$nn0r2ray*MDxywc^+_E(tWLq+D6v) zEz+MOiLsu}YMiw_EHKt8UP{%!9Z zFwJ&Zpjl+VDq+G;n-$-q3+KhRq;!6OTCx-iTF4AH{ywHmiHZTbQe+Wri}Y~xRb^U7 z;5Fn~_xaa%^|y#dX+Pj$Y!dkX=Vk42t+yzLvvS7R-W_OK9k%Jzc!34#1aYx&Kk)C3 zZUb45F7kff`teGwFDMoA4L|y5WSEtK;$Eq;ZrH$=`e4kx1E_|LVvd+}hiRQ^@U#%qvXZ}@4v z=OLi_y}iyp%7LZ5)&o|ODR6_a0q36N1*pG$BKf$GD4sP)j=sjF1^t-E??&}Az-{fu zp1=!gSWlp$LU~C94rjFRW&W0f78hOXN+U>MK>D2aZX`vpiNo06!(Ofm|2( z;h(=w5-06XW4gjR?!-fHR5=svQegi-PyOl{ACq)I?ioB1Hrg-Ix`bzlm=jReXB$}ilxc5U3=(TD(KS;4h zdZPxs@^r31{;9|(isGxFX#5j#xlt)n`*3;5%b^=}^V}dB<>*9Wm3C$ccC9EbPR2}I ztr^w(Wzh-i_J9!!3AZ-=a$v}F&{Aep4G^W_5sm8;)YN(H*l*bg1nfiwp9H0$O|_Si zHdC&sVQBPh@^UN))8zR^wp5L-@E&_qznzRUUsrs)t(k)wFX(&@=!^yY-dBR{K45ey zp3Em_v~Ew_Tu`p6hTZdfOBo1_J==Lb;K-;37u zb6>!;$=T+eb7f#(Sq@}>D+f8N2^aQLTM@|(H}@<#f6z-v%cuK23NbG08@X8~qTP;U zuFm_C9EA=c4zNCc_Au{*7p}(SLxmE$mnKx6i{{xli9Tlqlko z%~hg*T1J@HoUfCq-4+`k@1nZs454St@N(8=0bDbfZQ&fm3@iY)^PCw z_9|{OE*iau-&s%ICQsML%dN&v_To2iN*_VH!@dS)JS$K!y?+Xx*s$MwxUCC|w{zBC z{Bgs%HoS$~*>|DAA11bk+h$PyQ;E+X2>|&je9WzSZeq^Q3{6Cf*Kt_WLC5)bTv(0o zTCP~BDD3?3MCwpu4fRhK(T*2W;Z)V9o6^*0F=vtk^X_8>Y^yyd;HbfcZ#cFaH3~~Y z2KhqciXKUP_gCDUpCTV5VzVRG`@@Y_GeEBbC;k80?((F@UlyCsC3JOAO2ZA&&cd^? zG?L8 zX60VN;tc}YO0H=9x1!_W;@qYV!8uuimtL?M z;^$|zgpdBrVzEaC=Q6$5@wpCEy}wDI78oC}CV1))5}mc^(?SP$UNBo&dY@YD)$hpq zp`>Gt{xr-N$?BqTd+^u4{l$k^Y3kSuan3(j?oo75bkGhY|H5_cX+41&=>T8EI}+N) zq&`4&@n8z(X>fktiTwjJeevS%5Ot%r^}|8xjyC8yoGlQeT7)l*&*nYorE2tSwLQ%v zPo@?cm3}wKa}qN>y8d;a>Kr1?JsS#6+knsaI!Pa#Gy$!7dVDFbOwk2hWhWa0De!aS z$G*f@DPU(5G^wg72$=6zjfT`~qfZ`A@VB5ox-r;umaP9OS}h(Mz2a?v207-{?T?*7 z%j?tPbG=tUhO5)_)sHv9pX`j+(oX=;IJI(Ojad~;Si#-_#j7Yx?6&(%t|1r{eb-;& zql_f~@-Iv4sGvXYPsBawHPNXHTO|y~c2Io8b3r}7Nzj^n-XnKz7bv^;OCB_?fep6h z#!F&*!1d%Firr+va-2FJ*1jL0qEiuusuMe4<5#o((N_+f8W6?tZtn}YuQjeCy-0^` zC=NbaM>E0igR2LR{dUnG#&@3lo?EDUnr*L`^8nb{tUYsTTSEa7eISp&2%IQy%rxiw z3tmYLTx2w2faSl)4BO%v@qEYc%w*o5NZ{7^0~Jpbq_~&~dA-fi&m`^9p^VFjXrhnf z1Hn0@Ry9)c7jgn2It5y6s0&zn8cjGqnjoK#-$o+d5TM0xb1V*VQpolDWy|gsV-%=t zKx)t|jJl#bhQC>!2jXNl#PoO1fKSPTjP2`N4Y^ALGncDP(fq@U1@-S7fNMhCaONQZ zL|k^(C(BQx-6@BWM{{~0wl@m%dR<0;TjKrht%;)Vkpmq>tB>K$$%6GSUgsdMsMOrZ zEhpR*v&>ti?uWH_zrPbPd5jR*q0~Jv(P_jA<7+R6R`F2QM=#(9yWJYZU-EDQ+O$HAq0v%Rkq!}or$uq>#q7YTOedDA2T?Xjo@+wu=`~b_u zx8QJ&Okhu_`$c6h7tC$m4@?VhMDJV{NM*i61F5#DbiIIDK+48T{QF@(7~KlK&2+XM z|J!{Sx-{1ekK(V4zae=D_ZZe%Kl60L{h6++&pHe6l7_D%lkFNDmwDFAKR=8A9p5E* zv5oMhdLTl_y@mbcoQ3s|hGA7BN1R*p5PrfKIwX5)4BvsN9mTCbA;U7YtxDS*44SAX z{wF^LTl(Uh8BJ!OxYi$~T;g_UHP>2UyjhM70wb!v$NqxFy-~#hZa?u$GlwUp;u`ityW(OmKoIesT+A@V0_10?%eF`nJrMYfM;FWtXO zhAC4q2gXd#n*t7s#K91;$rs2cgh4V)8gY-?*(!P*byky%q2aAs#Uy&ypaRPP+TAG|G% zzQ@F$W>XSGPt?qcZCFmBf1@w1YAbIxQ0J4deB>lUl+2w4n;K`3aZHw5Y#BXj3boV@ zN)t!g-U?ho%bltY2jcGCGvug2QQ2jLOaSf52AL8YRyMfFP+JQ*GlQGM^is5|>R`;~ zy;dMN4T=-Ji3i%*Q9gUb6CZ{uz*`#eTqr6Q861S#Ya-2KZ@^TZXxQMBA!M9L z7OkW_1;QSzEL5KQf;1hP&g4xs0t*d!R(XYRw7ctg-btby$mD;G@=|I=3H7WpLLozF zC}{Z#5|~A+PeV<4pR6Ed`Ocd++kOFUn!zctvT5W{LDeEpQ-U;{w0G}3{08=B^*P@Q zd_{SV+1z|SI)EyNw(r&M2r_>5uH}W{45(&sQEQk=2SscVPh1H)k>^$AUfFL;;NTRW z$>8H*kY}K6lHt{ba5H27qp}G^D&c99<(3Y}*lSeyU&jOWbN40|gSt_^SC+rcnJMr^ zGQ#!HY6hG-9iNq?Jq$MPM6@ngZ-Tf;XB*{bQ{bU~t4NCIHy|s_`I2KZ8(q3vRQr1rqP$a@{stOt39=qoKibl=e*`YzSJ(~rXwYw$xi0!G9ECWUuEhv9fcK}) zPIwl$gSo0)<4MJLUOF5ufNorc3_dU3;`J0iiC>Q)O3V3(QsSR`(?Cy6j z^Z>ty!R&=LKhQ)7aT2?74H6Y{jLzH5M3HgZe`VYIfkje6tZ!Zy3ew|V>WWE6?%#9u ze++*@2Vy55zI{E2(l}M8&fa~8vYR?qN88&`@^>HDI8qMQURPHSqH7w`4=GI z7E$3N`#NOyYNBP~O%F(Md87a2UNunDS9V`sZ3GAHcL;VVYfyD&kHwqHcA(U{zHnH7 z9+(!Tt{0OigL*zZNK+^bq@JX?nBS5HJ9-<7zIta-?_!zA!*O!JbG*>zk-0w74E(%m zBKBAH->XqoolsSfM7{r@txgfG39#LD+vi8@KEakZ%zFGQ7dJ@H|r2Y-KZ361k*my)w>H+^i)ia-XFMyuw9i=_d z(+zJl^6yX@M58NCbF72$k%(W8*`ztY4rQslS>U@^hP*F4<4^n%iH>AlL^ZBffwfK^ z#m&o+Ag6XYart5)@Q=_?F)N7$dK>IlXQESquZd&kZhR8*SNZ64qf7B3N&+Q z0<$l|D9j{$fT{R-0xD{MlzKb!ZA<7gFnUFSdqBYf_^sW%StV})>=jym;j`hWQJwI| z{MXm$Ws<-beuhA_<9WjD^j%M2J0-RIXjutO&;4WWHMxpX`D``?g7F)t=3O{l0?}7sRA`M4*(&*)kBl!Tj)`6=HGDeNA<)Bb}8}W zKET@5&ntz}11PsA=&i9kBQv1_PeS%)EO4xlntiea)4Z;;Nz|>v_nz*=>_m4!;ip+H zHYwS-hn9o0u&Mx>1q%fD=iSH0tM%RgZTZ5Hs!D3{u@bmCw)9b=wGF@bqo?>3S^;A= zW3@SnFuXMQgL9!M37+O-xbpV>N7y!}SXkAX1+!1tPkb(F!w((gQZBM%c;V}aSV3_Y z=2(Av?1W^tacA-J-CY1U-S4!tY=gFTC>y8p4H#}bO_P%)gaSPSG5y0bxS;)->Cbf`_;cf_ z?ok>qmTyXBmUj|{Ew1^2Cn-+i=||dtxKD&otnk z{R^V|lmzg@C#B~P+xTG6y~pAKVrStc$=}y@E*v775YlHQIcGtl%-tBrCJtocz?(xg z!Hce6Oed-pmILS7gWo&QF@W$$hJ8=E<%ZK<9EqgEim2A%*Dc#g1;CX*uBzS7jdnAA zDt@FgB7N_v-mYmr;CWws>3%C8I9byeP*kIa8a*DiINlHk^U>L!*Yjk+J5ipe?*2+Z z!d78$cv=o@3$AxO_u@kj%~bYj3DtpoiQrw!VP5boA|Ools~|`p>&Xzk)`wPgqg-ll zW`Mh&9%;*V^rM=_ev#|aMd0v*mFlqg|J=n+QBOSIj;_COs_AnWLWvwxkDfkAM{~15 z+-D|QP-cHC@0+r2bef8dg9i*Fx=x}kmYpw%`}faNZ}dJRRtLk=^xxCbhpAeHHPQ@# z=Mpz}n})%=5mSGfm@X7jX8t3Qz6tq|e0f_a6Ad`In@BbLr_c|b`P))AyTNpBaM?rQ zJa8$p#HxO{4j3m7C-RWxp}H~!p;l;uM@kRwuyx!qTVWZT2W^w?U^M`_7D zE{aefbMB+rW4thK@UjGoap!f#p8kPP>(RsfE;k98L*|H;|WRnsZNjS#{ z$=+MGNF{`XjFiYuNV2y=vcfr5Mr34`?2(xr3h(#*2hMe_b3ONcf9_w-GyT3K8$4Rt zCXTYHL~)MqvPW-bfqbK&-MzG@FcPHzS zPn)4x$Z#E+5)CE^ODYCeTAaR#W-;O)N2Z=szbisyzy<>Wj&nPj-+hgsyVlq4=Eu6X2jQv^;1iK&IZ6Tyr3^Yxi8P-D{N zilg|!^Z10f(`xCPJ#cJVNc`k6PHg8EELIWAh3$ir3-ndFAwR(ra}K)&kR`uYSJux8 zFDNgsf6m`RMeJFoOvY!hFRPE10uLeVXWvX=7d-*}4IV|OSDl4>0db`h0=?iYx6gi* z^(Z=*q`c2twSwUI6r+g1jY7h{euI+j5}?8F3a^AFL2ttCJ*sfIhIL=l$ zlXoGV8P-pl9ekc=hZT1WYVD?2@xPM8OH&*?m@UKc-Ha(c+?r-677C%mBlKn+f!?C{ zi1@e9{Q_o~@xarH_vR6Z8(3n#&A|%CRNwTii5!4m7ma>RPOkz7&2S>k-b(bj%i!a( z-XLH;3MAP1HU?7Y_C&b{3E`lx<)?9xW|YWNa7t2W8kL0!pL+Ou8z{^Dq8O4pLOM=8 zZ*2Oj3TW1gD7T(d+&R9dW zx9Iym{l}e|Mz0u*0%t%1ABjq5?i%PnS~^48H3_V#kNLa~-UNTRk{>b941y3#avMSs z11OZO`^{S26WczW9_SF&g8jV(S!q#j@WjB4Q?v3Ou!HUH!{02ET1rYYuS zkv^sinbN|=TK0k<_ev@B6tu=&xv3I+MXIG&ebMGd=HO~reS#==2V;@ahoxY-N;qyt$wZ%x6H9Y(URUe3YESGE5 z{{MYt3>hw_nV@jxqUt2!IH0(kwf>s%3&^FfsAe|%2vlaWGww*@M8hfc{9?w|u1#vf`Ct00s9;_h{m zLG)}?Xw)~R7AaM4(OG6KBH5|On^IG=VEO*Vz^ztKGoeFJJ zv0evb^iQ;DK{c8WX`y2u9s(jv&!+~)XF{6?Nv)212gwh; zY&3}ZPnVbf)QOh<*SD(tZsw#pfnBD8RKi9(pj;pQ+KJ{S5)$2Z%=+yIG)NPA@=INj z8|977+EH`l_~3l#g@^Y+`Jr#1o3%YKX{;iQFR?{}9nlk^jQ7xJPrfH7pEGFbU~Dbf z(?Hji&h&KpdVx*DwoZmLZ@?&UYr#w29kA*wZ}&?XqA<0}d}hXA;GOY`!#c$T@LwV3 zkO;R!%uBQ>tUdfyw9X1>^5psqu@?I-tDlo+u4$NdC$N@D!`uBQ`wH4}^z9=Nc|#{zwm8#={q zQo-Wx=IPe&1larLj(M{YE3Q~3=vL~W#KG03)O(-=EWw|%Y*c}OOaHS>`K3}oRvfy* z)mDtYWKT#lT<%218Y%sRuQQPqrM0`Fa4vc?-n46(-vw;EUX=5=l>)lBB0-Y*0F=mh zeI&Fy4eS6rK*YcIUznEtQVzU~dsokRH-c+N1}Uof6+lGv8J7t6d(gOcPusJt5#8+Q z*GnM(g8Z^YzG_G_=yBr9b3pgaNiU7 z$?C`tMLSQ0J?L3N??gS4DtC$C$5w8x!kCNrrW!OocO-^U`PVF?RaPi*7@I=Jm;ufH z+?`2Ni-c!yLGPWue3&;+AMXLUwVY zmPjhH@)5HLDDCHvlF>K;zSSmMTKVvyf>VpN-^xxR$`hQz3#Um?d+*N^{n>;- zh3Mk6{CRTFY0aB#okoTxmmU!)dlDm$WAj61r-VRmpW;y#gD7wkQwy;mJ&i~&yzj$s zN6y+a%p-`91&sgRe))=l57=4AAWdUJ)af+(pyz6v+$4dRYs;7biZ8nG&Q(nWxE545 zhy2^G=j~8u`|{)>0TmWuL|JHdP9jOj4EE)QRD5 zo4fX&ol-bvSe1^(m=TxP2DUuAs0cg8{=_r~T*tO-B~oTtoOsZO>*(E-Cce68(&^=- zgGG0Ly;Ty?!wj30VbjU`NJQZk4c8AdNG3B&&t7ba2iu5^s@VClu^@kOcdikSEv91?JBWBmmy%+^7ZKPGXnGpqB;S#df?g_ zem~bBJERxd?-DSq2R5Jk8!++fgJN@B|G?H1y_3p0M1Jd@SJ8|&{gdSN&*t8ZQ@mrA|hef1Z zd#T3+>-cIMd;J7)#6dCDA2$+raD^plkf$7FvB-$E;zQ}z)LDgiM?VCszeBQ|KmDJvB3D#*!b+O8P9WC z9LP~O?8Z%xrAy{dg@2j{L@P^Y10;x{s0BmfBK-!qXndNy@H+u)A`)F0G#7+qT;`g` znMH8UagKkhAGx6SH&U~nFXmCrD>lD1Oz7zb=lmnKWk?wr`j~Bn3 zJ2vyna~w36`sl3=p1=msIDAF+2o-cPN~@DoU>gUQ8;!%ifgyXg&FEY^TK6W>rckN^ zC$G)kE^})}NyEL;&Hts$%k@sP!NVTZY(3Ir@6(8?{!EUPBtHhdinoO#wlWcuVz@!k zrz-GcXZ~pFWIMQRtPn^Y5Q+Y{6r?^FY6A7XKDpmkno(Y?8reujFLI@CGTR9DLLImN zP~f{&$SK1klX3I|IvCI?T#D-g{FmIXaWEGFeJ@s;3jG?OE=d%9uPOtjZjD6-5K7_? zjQyB!_Xue)(;Eu5$ic_|`QsU|4qPUekyg0`o-Hl6a!$Mm+pfARa76M!-Ly%`f0Jji zK*MrNBDoke$#TD~HhK!5@wiVnDldY4Guf(D|I3F0neW{p&GPWq>9UMlb3^FC^Bjkt z5+d-A&hp9MpM_vs%ky!b&(~mFa?YEub7Hu}e2|D%jT_4cYtlW^2JlcoT|W9HG0wGV zYCFz61spTGcD2lBk%2l@=&(!`5SM1pjQc}??>)krf=pzvjydJE%IXd<>Y=kTen|(r zTN>3Q`ND(xo9XFgIStDprW$QP7={pNo8DG(==}+S__rT~c zLF>>$<2YOR`Y06YupgjwnZn|cW+ksX|6p}(ZaImPQEYtG{=vr=RrtA1vo^c*627)Y z%0IO;3omSIIFG6AVUg*Yl`!fAG|>_}uVkEuX5NRaS~L{_$Dff#Z)T#=hmDtiT2zvO z-QnqqQ{tk zLxZv<;JtiT-ePGD&~|YfS39ggn}VlpZu}L(do{(iL#c%LvW!$^uN5zD%bh+sK&p%* z6fP&k_9*?Q(_4Ss%cNnfR-|w&g)ST)o6IMjy#|}-&d%R%VS)kWqA4~im!VEOpFmR0 zRcM~~OpEE%HEgl`RA8vX)(RUo3nNBjP|9shxo%&kE8tOz-5Lr}&<`DPSxeK;2LJ)jlDbWGeHs~!iW z#?0uaPcO)Syc>1pNgJxr3=NE#Xar7Y#dIkIM*u_D%lWK*j2h0`<3O)3|MAzeh3;c> z$bx1Au<-VwbSx(S?M)w;)=(aqBbrA0Uh;|WYx}`~x-#Wg@+H9e&E(&)mrdZ%={7@Z z&SSt@ArSD*y8u1zeR>)W^n>HEG~>BWwdg@0FWKnD2~_8j{-K?^4@lEoyemWe5!4B) z44WS`gHuQ-@I5(3MhtVg>gQ*{d}U`wq30IR@r?}Wr}+i2id~V%ooRGO{I$27&J>Ds zVGXMg*#Jy4pP05kU~uWP|JHKK1j-e*OqL68L#+)KP9e{}p~S!N|)Q zgc^P)4qfdA(<5ma<&OW5<>*R|XM6)VY@h2FoY@2eZBOp9$M>UAmIvlvt<#`MA_GUQ zXf<@~R0|7sYrrl`AIUP4pF))Y*3K2FR_yzp@Pvl44_p{)8dj#rfzu{xi)0$nSYY(} zUnSWl81pT`czh%iU!YWsW&c_UgMRV*l?5cg`Wx4@k^LCq7|uqC<v@>ET4Afn-vxfPym73ZEe$I?o$^o4 zjsYD(5!#+xp-6z3&i2{j9YDetA8gK33f_}(Thz1U1Lwl)JpPtpz~x_s%t!rHaQU-~ zCuYk*(MiqY3tZ`_m^6VhIyWDP3D6a1hvcK^AD`*&lxL%G(&aZ%gRjBo&*Tav>t%pz zcJ{N*a0!b4Bm3=XemuDDAa+?*{wZiT!=`+qNnn5Yv|B2bH}JCOSS#+y1*2(of7{vf zP_sm@L%nY|iZpDgV}5@RsCH+ZeO5n(!tPj#`Z*2)>|9aCz&ZnDFCX^hjaMP_#G0#n zv_oL2LE!NA&?F#P=OjAaH45$?X3}xPGQ{^rYNMTC2>J2Pv2m=AphfP)X}=4<(MDKo z#DvQ}sQ$AYkr&&BD9BGMqNo9M&bN;!JhB^HzT;f1AyR?pkM7QYUK#*d-%mMk7Dj{0 z_dx9Ky)IPB!js}vZUy;Utk~MJ1K{FAYlk~uJ>lguy3}unY+%ov#cY4|HF#hYp651t z2`k6V>g+b%!`%f(`EtSjFf~u5hx(=k{7l6!FK_)A-c1no=HEAiXZU7X_j>}ce%%vA z@l9E*L8-gYbv6LEsObzbgnPn)vbE_OPi?Stb2EY0gS%A&Th;Jw0WhvkF_@|8U?K!>~6Ky&?{!W+tg?R@s&@&E8>k-9XTpy2- zYn{Ma5eGxst>o~x=THK*{~s{SC8L$|ixX3E>Ne!>661eouN5X1@gE@3i~?rMg?r$iZ_E ze&@75SyBuN2%hm!Vaz}*)34wE8;(U84U8&9slRXhlM?Dl+2iTT zhylYKl|XqG6l-6~2)~t#l<0}`KQPCj&dIP?kq_~x zI9Bl+SzIY#${uwH>oZ3T-?>xbN<#oB?V%|0eSqv%Q}{viE1;oeMiW^07H#bZ%Dhic zMV&*2nqLKyP)9+cJYju0&?093c~997$OK<8H|%=?l!gzz$_4FJouB=-_v>T&l) zO9x==;jiBJ_bF)7)QTl1O-GAYE(!;EB_e0rs?CS4et`D%t?fv%E8xH+fM=f32xS)f zUVIf`1HQkZ_~6+h4<_jXt;J4i13Ik_lwvklP|ul(h^MV4XtqdS+)d34M4hP3&8V{i zpVsHHOHZgEpC5g;8p(DbGWR8~BK1uq{~HlFbKL{4BK+Sm5}gK7MQZJQZhpw@@3c+; zkv&L$U4MRkh#ou?iyY^jQ3L0$OnQ*;hy&J*fyzr?G?Bngi4l{!HlPYg(U2;L6` zyifc`0!yNUqj|(Bu+Nc-1ib$TZMl5neh|fsT{MzaF1%*IQkUj-6TPW%gv#>We9BC) zQ?+aQ+ME!F_#S)HQ%iss6NZ}x*q4CMU{c0H&@5OjrbxLFhfr;=g${=S0~Y>TZ?NiF z0UYS~{BPPXA-i_t4j;FDL`3@KR9ZU$R=$7f;y~XrYRFu0pLaS0c`o~^JxNrs)X0a6 zLEIYN)i~4`Q}BWf*}vG&KY9q^R&GUavLmdQ*yd9{c?(;Ach;{`w8FdWx9&Xu=nc{Q zQ9Ko)38c2!H4n~{ha}R#Y$x0Uj!w(0H9um5i7$Q{$#<*cK=?+nw9*Z}UCgw55CfpT z$ZDyhmj%wA$X9w$ZVvmb$^V^Ra>6-^A`3?Z_uyV_(ce%~6{r)F%Kxuf0S^4`{`ppQ z1x&KnZ9Yvu2g|OuNZzH9#1)Yb1zzgY!>&N-;PY=p;M}=)i2}aj*gh;KhHUQytY=Ha zf#h6}#vSMsPH@8~0XD%y$2JhwBK|u>M+O-qOuR~SC1HUf>tdBG34Gq}b;|S)557jN zEoi`T5fdln`Wb#d3oTj{ysc@N;0dviAF}1gVcnREtF`7cYs+*vCbA}BuiRdi2*3QM<7 zSvFN4gZeZf+59|&u(AH?+>T=&`eC`Dpz<>sT^(Qilx0{A=3Ln?=ofuN6VsW8pI4uN zB!w}XoAQmo=I!FWE4E+29bP9w!D@_*2Mlg>eN9B|3cTpQ3<2sM{%$kmIp834s#NRr zV-TY~yqNH-8SvgPApQNQABDeV+Pzzviar+Zb{7%9MLziMG_WWt-mJR z0qd2!G*+@+K+&6EG>XF$1ddWu+IH!p(|s#M&a=*7{qE4z%P4DL`*Xv~ht?g`*%ZDT zT)B;!bq;E)6imS7cXocfkOrqu z_`9lwE`TpdluAn7P2iE_Lg*E0D%j{ub9ebK0nDD05KAv0$9nJPBe(~Ska%^yo{0Q0 z>`A~il0!xUYrj@YpWfL*WYR?m^x1R3*>QcUznB9S*uLxl(c|03C|hD&d<88HXT$$xVHdO@VJn$Q~aHej3k zSbz8L1mKE#G4t-;cd(=Hwic1ti>lc&s5(ls0Nj0(Z9Gtqh+m!&iX(iF{wXLoe`%Wn zcPs-^j8wmXAABl8j!jEwylmlzy8QwIxu;3j&SinL$6W8J|Kn(qvRy|t-Bx6B!~M(w zQz?oSwEnsEXcm#kDVWi_nb1wK5pJCGvk0nOn?H1 zY#sd^uCTURDfrvBTaYo)^hxtiTWtMJK*ji`E8O1UdphOkk9kM>c?nws@z(o$doLck z!4cOV3hzTg@%a5?neOEwxHF^qMM;4V%q!)8dCUJHEND8JK^Po|BPH>M%iml0Q$6RJ z-jBzSBvcEp4ZjDn`Bi3rX-YxXqf_5B|I0&>^>s;YXAMNoKxrI1QvxUyX=LILn^3*9 z>2e8kA;`OP5SnCh4+M-VNGnnQxK*WZ?f;jFa@I7$)I(tG2ow)lk{K2CS zfP=%MQJ%jJX{5K0Tb&96OcTE^IIO+{+9?;CD3;Q|3FWXz=8iPPc}&Qtm9-SaU%IeX z!Q%yP#hdVpPL`t_-59s+@;%U*mElP8^AGX}5UrMYNPEY>h?>soN=h&+9hb@v%lw*wK}6{{}HM$$P+O{eum^AUhd-fszw@zFd2f z=C_3&MG+;K8=b<5#nf#pH5Z_>>tc=8;1nXCcH8K?^BoNwo=kUboG|J%~ zz4s-i28De(WL=7D2SM?oZ+>?F0;&ayv6av3k!0GSO-Xqby0}2Fxo-6d$bU7Wy8Qbm zSRJCH^mP1;F3b3mi#_=OJX}o1_g4o&Rx#U`q}>TXTPNQU@oo@xZx)`KAelv#T?)>g zIlX{E$mUSHCKY%waeC*q#RIkF+eshwCcwMvN(<)_32+H|Smu+=2zmGtX_UPwv4nP} zA5thNua zoCoUP5-w*ka^qnC<91cgIdJjQi<(?rWZ3!RX7*7JAEw`|7r)%~1Z^tKzn3@k0<>)a5>8`Up@{#%etJ#0hAAAkPnSwnhe}mmAz> z9{`@w3|Y2Mw~^fRW#?-WkI}0O-#A6L!w?yC{oVh;2la1tK2~pf2nf2Kz3OE1K(T$J zwqr4}pvreizUloHB%sJ#60vt4RTyvUXPVois=_y!@5UTZuB5QF{*oJdlsC0EBy}5| zn4TZel+r^?r%iHxSvdmtOOL6X(```p&eO`hn(N@qnEw1bS_#xdv&SBhZUNq1yVbw> z@jlAqyvCCB_X={X^itku(*?XBAtm6T~#ik`8>-M3v^V z6}M6rLF^lP8pRQAsMII1P;llmS|v}?yrX*w)A!1});Pt3pS^Np{&R~0HqS)xD@60d zsSNc`Z9Kft7W458CNba(Z|CsOOkN!LeEU!Lv*Qkam?W@{gH0lJ%}C%-E{huQu`hp?7OV51-GJLkPe(Q>Z4 z+e#TbmNp+JJ*!2IO>9Qmew2=*U}=laTNE3JgO9rWYGDuf8Ae0i&eMZ>H}zj;wXTEF zuQf3rL^jZ!OB(x^PY^;2g*5-tH`_q=YfyMu=Q>zy6lQ*lwh`~!KE=9#KGdh)>yhz! z1B96jcvP|c22YAfJ`~cEVy5ELiLYw^fyfb}D4p6PB-Ar-F)*VGi5VykHOp?Js1@RV z7O^4pAY1tMMCcI`Jju{#F{y*JQgRB}^U@Gg6U2X?%ggxs2GGxh8Ti@!cMfyOsYi5K zXf}oR;pA`(FlING3|ol@7ti?gfxRR+F8OPHutb{xv<2mxZj+X+bXiX=L z0Do{J|JdPpa11I-osEt8FE3XzkDn~CNkj)j$sP8q*MW@Jt4HUG|Kpo;{(+SKfe0~v zixietMgq*=pC3X;B(|ECl9=QVD5>Cg@k_$8fj`w{{Y-o=LJ*SRC_ z7Vd#pj1SQ-i=iy$9Wzk5AyidL7=Y^XO>atl_CWK-=?53id7x_&bDKkB{^*-u=+;n- zKe}_QgyKrRD_UtTrSwklN4dI}nW=K@5cl7ol#UOsA!+8#8qMt@q=0{j99wyfRwDTv zuEv!BuMV76&XkQn*yWnwhD1=3$T>~1oCvP}w&`F7g<$wY^x6-D$DohcsW|YP`~-WaXTI`p}kp> z{FM_;hTN4@zs(J}($|anjyO@B*p~9>2s>aU(?~H9Vh5`G?r|x}m(V#gS#D=0QN+-v z=~_5QkG>l`pD?whM}19)cKaM>(IxY^d9Qc|6rSobSE_g(PfR0W% zh(v!7?a^+?m9DLzSJmQQ{T7qK<_CV^D&^lz z){-rQxKf~0BD>cAXaZ?JB#L9C+5>jyr8BC2{YGS@vFViQpOM_8(k%nWVPGEOdMSFT z1GV@@Yy&}3=(%<%Tk$XkObF-&58Cb_LmH*Ebg2W-apO`&-n$hv-%suGa_0bS`^cAx zr#7HpQe{pamK$Kgp60WjDmj$PWfSlYSws}-7AN`_ni2U#`AKWRJzy#9OYqX<5KTEL zcfm&l*#1C|)>LR0+@%q_dhNi~=C&N~XM zmJzxAN@WM_Ir^Lzk`4pIzb$h(Pegzfs&1<-7H2ea@oFTZEdi-or<2E~GLZKC+-rN+ zm#A&lQib}4GAQY>OYgC=1rP2ddrm991QtnB7qplX(U6htv6`$>@M2W|#qjNSU{m(Y zSN`MqKwH{{Th%Wa5lFTCawUEX!0N$(pyPYsz99Ie=~@DkdP{%V=}$W7#4O616?cHw z4>#R6)3GSf-X)U%M>2T9=<7$r*N#rSxpwI6QH`wK55FX8Zi0tNWY+G1OF+Nb2c>!R zfybfk{#x9>K|{G7?e63^5UlCMRBtnbq@D^BZn!QX#xU)Q*LU|(gV)~id%UaYtj@&# z1lJ70ZqxKnKCA+Km*~^As5L+`C6JUyJdPM%Q(rN^KLTQ8-FCzue@Bl9-whZV4k5*k zso-4aUKGgLMDIS;3ZRMR@r?92FktO<7hirW7d7Y78pAp&_fW-mOe=D~p15qOQcG{L z{zboUc#zO$eXu59V5Ry~`>+EC>Y+x5j(9$a4* zv7_}y7`y*?iDaUbVfsMc+f@}MJltlKp7B&2)_(Ur+`DlFQ`KC5-?^X+$MdR2ha^?8 z&&dyjRO9@(g8jV4rjRZ!OXfO#QdJdyqh5}uXqLj-EY%B^E8Ngjd-C0%(Q8nJrs{JF zl_D-5cr^7^$qQZXxVp>Ri(`^9gM^3`Y3R~C75H+40mA3A>e2!OKt;U< z#IJ56?%4iED*D@CRNub8CUyec)*&$pVVOb;&spp3k|xo;L~zpqWT|(>yeTcpS+L{oN11eFkl>fy5C|K-^ey zT*3!NJ%4zE{=NoGV-)5ia@K>&{(R9aN!pOVl<13d#&_UcHytml;RszaP}In>Csw=S z`!DOCF8l&+KX^E0h3g9F|Amv^!z|2qc+z=q!gmJ4F7@}lpwWowjGvJmPXAzI_=4>U zq_}dE?AxR*RwZm9jFh>9lZbizBd*=WKY&G%sp}nlSKomv=z=BQvkRJ_sy2s7V)>g6 zAvUQ+F@!VJ*SB+2=;2|7+DD}y8c=btfyVI?7xo+i z&2cZ3F!$UNvB9bhToPB$JjZN;CqJsuzwgt<;%|h0%34@J*591rMh|sxlt@p&M2abX zHSH|(>9_)ZxN;uHwcdnonwLWl>KHM1i`7aLREK+^5yWUx0nSa10q($SktdRe*4Qm@JW=EosDJ-1&BWG&wbVa)~goj_&c_N=icta zPldDK=06u}KJ`&#b>=*ULHRy-7pg}bY`BUndn2D!e@zpHEMVm%6 zVl@ct&ISmEQ^o?OGL4PLBVQ2f%IR;eNl~DtS+#{zq!9UpvSuEs<%0^zsH3s@Hnekb zVfCtJ8`65s+M_Sp3oe4TU0!1MA(er=*IRBz{BeRru8%=-{qd|>HD z@-E-AwnH#bYBg`}CjN=EuI$-7I-iMxX}VtsvW@^JU2F&@kY6B zZIrHow!r&n&*09;1X81W|Ae`73dkJk20!(lL9u(3T6Yr^;iF2O=5tm`Sbz2A5PcyF zo*ZOtoNT!YcRRq*R?#`^)LKgt;kk?$c*eAIKU~7CxAxG@tN;0n^c9PT^t*skn9w@( zg*FV8XKK|mT|jQ}tx}BrYPdgj49Yl&Luo$!E?;eFoI!8oGj?ei6gfw<^E%VRDCC9bOz*Ac=oA zj_taSk=gAkVGoIL;BH~@(fEcMTKR49n>Q>SoaN@$dD?On7YKvV9c z&YIgLWEuMJ#`m+*DB!9@m02eVc%qV)^G8AgeJk1HBt*PmBUwbL(pnTu`0z%0$Vdaf zDzvmMIn!x&^2x_ee;p?jyKb>3jBHd=@~A5e}^X^_YfPir>GUeME6GHLNVoiRg5u z_Y+}$jA~d1=QX)P(HG;OpzhPnV4^Az&=9{t!dk>iiQVteh^S&~o_Ys3%lW(h>Usm> zpA8&(ty6~_N5{|l8+4)y6NhuWy)x~7>pi#YNY=66DV{Jj@1Y3qA%y2?f=b=qO`DlQv&-1Fj6+${o1u3oU(Xp z=3+LCu5C|oJIMS51Sw6_f6zDNQf3qPCu#tFY;G8>?cGP5r*$k_sdvEG^+(e~TRR{{ zJeoi-W)es~vDV&;o(G@YSzIkuX8`Xk$E7Qc_lbm^E~0NUwYXC7FL zAxrC^L&A$`;7D!^J<8|D%ycI1l+1cqtDQ~#ks3Laj}z#s_m;xXqlbSnlO}6U!ZaYrGT1jTHn>`u%p(!p8A5 zr^(ArarYDH^FpmkSnF|l|MTt3uyb2Cn2}!_iaPc0JNL@N;qna!jj#GJYVU$-2q7m9 z=@Gp#y&wWRhq>Y+C?uhKugdDLG6ncuc!>RM4`Y|UZa0OvV z8ufxC?x7q=*)3p!7p=#_eB+exe!Y5Z1DQE~LqAD!Q$`tfvS%H9zN?6fFW+Bd)1$)+ zzpYM>UDd^E4~S`~Vk~gZe1pt!8DlKH{_#t1u`cxAzshDTWQ?`Es*jzRlfzQ`%+<2w zH{k6v)*mV#)5DToBkMtuGcegXF8`{s5atRuVcy%)#|uGt{akdN(op)aj8kPQQ z#VvDYW8aF{WBUg_5fOrjlj>Cu?r**_?e4 zc7e&wGiC}EQ%(qPJQxSbB#(~h45q++p6gWxYqN-bF(sQ^VjT!Eyv;MYicx*#(DL-r z8rb4h2#j)E0Jc}ICdNtiB88WIEemWIWqk2&^r!3v3vNBiBo@u!GdtxZd435PVmnUq zak&T0SEkk6fAEXMeE?i! z^V(`J{fgcO5{cK|%0f4@qZy}1S`ojpng?6UAkrWam`^GDf|jFeGgIFs0lqco*R;;< z;Nv|@A>)6afCO!@_GKyz%30A%rt^KsEROv)w?z$jn#ty#$NU4)HCiuyp=k#9Rgy)X z{p~@@SBcl_v{gWnQ9md5`ULuuVZo)*IRjD~gr0Q2?*Pi$S0B=<)SyC!!N5nf2B3E4 zt6=l2GV1a@Ytf*i59*yg{US^C(R$Pwue=3wB!5BJ;#-0VYHzL8m`afWL^G^&{C~Ak zSjf+EuWD=b#3b;oPtR5K;H1fJsJ;Xm*;iIin79O-j$UWvR-HpaNx8QwwM9@;tcmBS zus*0!fAt_M!VK}u=}gR3Ng^U5%*flL4Fuq;yhsaS6ykf|HS%T>Yf)EA}D=a=u}ijq{m9=$wFE8RGXq`1MnFFx3Ssb-p&1DXqr# zKZEVVqhG`E8HJhaU*2PfYTmYV?lfHJEzPI3RfyM^#0nhKgE4E-sRviHa$x*IL-Fuu z4`}(K+cfJ|Dn32&<1(*738Yp#Q6dqT4V%)0ok`qWpaT7};$^QuY$ZWcS1UfzQICRE3JJ;k&PF$k?7iD69}LnTe`wz+@L*JKeum1M6sM+d z$Ha$@0qLi8o{qw_(1|zhU&0hUrZ9=6U2fsU#}&t^bCT%bd`x)skBvXTOXKCk-JO$A z=_?p#k0FGG{*XxQD-XQ%?>ZM{A~Te9lQ*i5RDdsg9WHVHJcey#sg1r8PoYnVqlzgf zE@1nIS0DIy9EX*|5AK-k9>)|cT5z|xUh5mww?(S_N%$HJadW~Uf*D1l6LqGR=rYw%FFK~_;_rLP>&4{ zHJNNiPO)NFe+u$Yd3ubG8%G6%5#n7%H^!GFhu}LwO5ZnnMmQWp-+kMJ1=@FsFFy<* z#>&!fuX7(~fS*4p6-(Tqh5Fh#{*&D!$cAT@BW_a`Z|NS3ES?~N1m0lntpFXIIXq+Z zjN}-cr1T0~cNW1T9sdGEN`;|K zZ*o>#f#$qi9TY+2P|#?oHBEQ}*sV6sR7NntDhFZt>0VBpV)kX8PeKHTv@;BQpW%lC z+*8|I$<+9^ra-U=62lUIUWtT@{zixGVtiUJ`S4WCta#%HGwiE;JgZ|&gr{~4P03ig z&~e+B`FTQAFk9TfT{WB>GSbOKD@%Sweg;5|s(~FoTjy4iZ`cA(Of~O=)K5Z@=hMZ8 z;>$o{J9H+exDl|#Z`%%>m_?|3_Ql~MJI&7?M;~ zn3m+4LYEo%2SY0IQAPB}2Odv{(AA}UBJqj;`iH-r1i5ns>LSTMsU_P1Y@@qA*VPUq z_xa-yCg=50TSUU++RNj>?1FkSQO_7q^xSjUmuNyR3T+O~e`k>)JmtHlUI$bdbuP^A zETI{R_2lWAeo)uFk~0+5j?5emP7eJkLZJNaOu9rfSS7BS?-1%ijlx$m=YmgwtHCQ9 zdp$%z=WVG8+v*7*a@cY%@+&vcZ^}|I|0ReB9ly;7$)7|qv{l+SBSnBP=dMo6j5v_U z7yY~wPk?4i7GD^_^B^rLBJ9eJ5ZFnP)|qb*L8&9tWItU`0rG7QmyeyN5&w3sNXwoW zGNM=({d!Lx>8iEU7*Z*sZCBBCk8ws|+O7YD_wio+w4GFs+b=#~)tu9*>&^k=50TN>KDLX_YD~6+vrSK&Uh3S3glA*VG%H)c<5mUx-*4Q6tZGj8EfU}vEXgrTRGr*nv5&K zbQNfgJtw8;_7OKXcb*Tjm+VBW6P>JK z9(^cDv?*BXStas0KOb>}p#e~Iz{mup3V<%?7m2!*A{@1Hjw`YUly}|O596-_hh6Qm z&l$ghL>4iZ*G=hQ=MT3(!-o+-s^NO4zGw|l-w*%lV@?8@R@6khk52 zFLb`dHKAC452dMIqTPih7BwuwqAS%8%4yfW-8yoGrng%@v@y@&hR>w6@4TqSS@HI_06J+%6x;45KO9_Kp&r2ISyp4DLo%Aw#9R z|ibYJsqNoMs8Tx0X zpxS7WXw>clsyqC!Igk~PD2Tkeuc?-UQxW>rTe^)Pl5pqBmPHvVGTzrB{__^C^Ulv$ zJ3GV9YiA#I-FL)1$+;834WN$J;Mky=G zh_Z#ULS~dv=JS{(J2Mp$6|#w}-tT+JUnOo;FE?reiniVoCtRCn2HmY^l7J&3Gu@; zr)@;_lW)Ug^W9~+JK`|#=dr&+VLDhMsV207&=_W4zi+7EX9%rA9ViAmEund#JQcx? zD~>5Aw)$Dr`4icnj`9u-GGM%)Nl!xso zNT4^fI>NiWZp zuRz53$eopH6FK#K45cDJj;EiNXKAPIf(9?S%Xh4f!TGdDGHOkqfr`@Loqo=>+D5EgUyC%7C3`<9Vv6!~gE4Y-oblA8?=&b#6GE94iGx zDs5^C-R{1w?m+t+*2i&lIgn_|Jed zR2I(~B|e~xVKLIfs48R`Am9_(G=P3^82{3stOlR>QUU{6F`(Cdo(K-#qo3}7O^*GU z1;^d@%d3@Uky3THJ6UNfcw6%7S1Hd&)FkZnJg#*J<>*Zh1~LtS?cKAt^?XLq+tPz! z#l=$42W1IQkzwTeqU&XT>@N`OS5@vc_Z4v9pgobemuSRBleAXhE843S;}5vn046(Fc+`6GY(0@RUvMda1d2x1>!e|+xZTVR57Uvj?b1Tw8Ja)UKHkfMmWA=hvl!ixdt zwxR^#rDHf+u3r`kPiAs9xyi#F=e^^Wy8q>0Ya@$o2#wo~W!W=iFlG6?x#)8XSb%>^%jK!V(8G@FQ>B(rKekOgt5*rj zkCd{0+&hJ_$#xGIs*#JwF$Ql;0aat(-Cri3NABdB zDI?7!I9i88j$xJvwp}dR^nbq%T&j7BPXA8mox;?|GnS%%P3G?&9O%WcG?9%1NK z@deafRu?a7Tt{;ifN$y65VHIeb+W#04-nSnWdZdywAc1QGZuV9f>wV!>tuET*U5;6 ze~ARR{_HAG2G0(PzY+Rg%8eM4o&4J^GP;5W+)C|GO;gOWl$MJ1zv4tH|`DqXSN+`IN1ckiIzq847Kk(1G{ zkc!z9$sWxnI#;yC%sxDXniPsP1cJH&(^D&&3w{$Q$GZPgl1B<~(j?~55S|CqS0ec& zUUz{I%N6~Hrk_C7u2{_X&uyUpj-UNk4no+hU$T}(auScN^>zrA5JD!oYZ{^6+lbRf za8w8%!=eL5+aw8ZP&#S2BT>{Lu!v!|t$xo1=~@@1GXwarBkg_Hx7+l%_r2WkJ6?Ls zWc=j$EgCX-#n^|pQC0$;<}8(cl$`+nUcEvI|NEmW6?Pre0jny7+(8VV5mW0qcz ziW)F(>Kx+RmxtC@xB2AwBavC5zy|qI4RQ=-ZPu?%N1j73b((Zipq;tx(aSpk?%Pp$ ziX=K=%g5?ZMf4-^W+tDW`nOovOP#@Yn!ynoKE1TRQXYo+j9-M!~0_4@IL>`{?vC7bhFRVB_59FJ0tl(g3BX5WV8gm&mnYXZO#NK^I{W^SrWj-w^RQj9z8D7TAo{4*CfZglm zPXP{`&TZ_UZXyNAni+O}?w-cC&G-N)K-a$tIE|TM&ew+p9Tx~8>DkdQy_pjDpXY5t zCoeU)(cNcb8GZ(C{rPh6x`Pk0l3E~ri+?~{)hn*wKml?;eih-`;5yX_K|7wk3Y2lOJyUP73V{h?m90f)$NdKj@_qj z7dPPWH?*-aQxARoU9#08VuKWWBcB_`UIRJ}3zDXpY-lc5MuYvCKAQUeGS@Os6QqA> zDXXP)0tw^Y_1q2`;CkYj<`r8Ha7MXZ%iGBp7`$zPwfDcb6x?g#P}lYcbh^|I>z+p7 zw&$g~rjo1ZcH;=uVi7ikln9pRIT`>PjV{7r$KIj~3oWV) zm&?%4+`>_r>n*7F)#u-ZHdE;O)_NuVg&*KOaMSq7RRJCemgn>aje`5n5;mg0jsv~o z-KmCazd?ZE>8m$c-=lYPUYA=>4kNFMzKB(`Z{X$Yc#nzOb70kSGk9%#1&Kwg|J`f) z2t+6gUwphW0k-3WspW1(rH{Y!&DEDE?{y4xfH} zMdXGjUVixMMr8P1sBxUv#(Op#rwfU4B)iApn;K2(ojoV;!06ekYi?oqhr(dF`fRudTn;8^ zbqX!8C!KnyI0(@1B)hG-3e+0eDiR-23qrr*uBfS3C|GESWt^cOc{%@NM)lU9!QcP9 z-FHr~Q-T}n3$1|0_ZbyIEjpB<-l&!7zzD7i0S@s6Rd6NF(t#@31zqUTd~r9x6j0_X zoO7R7L7H}T=eN7~QP}4;g{&w^@Z0U{#f!2Uz@$ubE-y_BrGKI|j!3$KPF1pA-;=rm zehb}|;O;R2^X^wtmiDir!mHmo?lBVqKev@G^Xpn5_SD&5r7OE0SS?};pLNi$x*p@qDqnlArfu|rK` z*1l{8LP)y!`j3bw4&b3dvHbF5FQn2lCjaNAC>m)uC1P1JMytX_ALU=!p!JnMPH7Bb z=+kyy?^=yHa7t7r6F0d9jJi%`txJXjdM>BPHY#VN+8&d|N^=`*KN?#)rEw0ZPd~7o zZ26{qy7k&QqxdQiO`HBqD}4wYyA|1(P|*vNbF`9-^gkl$3ztux`w3Zvk!*^19T=$Ix&_s;$}a5!6F+tlv7Q z3Amoxd`2#u2TY3vqpMyFqR*v>^h$Xojla*T z*4>(6!3C5~yCRRzVCi#&f=->v_}NQ>>(3r*!nVk?B{gLLt*OPhQrx7m+Y`6HnGM_E z$BN~Ju2^CC-aDJ1yhjojtruypP#QvlfLgcb_UoWx;8b+#Cn?;F%KXRj2sU4#Z{wIc1l3b<{i_KW$8X&|#jc!y4;2`Il&xqtrq93o}EOilS5p|f`y zUIhsBqu(XuKQA6l0y+&%>!&MU(8fo<7gv>PK*M>T<;j>L#KCaY)%0#Znmga8x|TbN z2-<5OGD&_z-!GFVsHuEGCsn5GlNC3R@z^oOZ@kIiNRm8YEbS|@@u$D5VqXos9c3am zDu%(55XDI=?LHtquW>Sjc@|O67JiPUo!TbL*P!HsSZil1AAB?ONMr2UMf^K3 z-+NEW8z$Y!k=vW_fDe~U9UiE-KtT>$2I}ogc$GDl_!+SoHsUU{Ar3c$Ec7F-2Xm}g zEku>;%T;T*QNFi2#c2zPEUv?RKOG#DSN~A|G&f#XW%oZb>TDbe`` zp7>%!XN^#)7@S%X-AZ%yfZMb8vsZ3t!?gO7blJZ&Fn6;B;m2%q_@$n-nWsq?$NLHi z-r=|bEgAGT5AOtF^>ZJ8zh-g4C4Ie5wq5nHX_oHWMT%g^;Cbg<^UcRNYMJ<0PLDfG zi#x%7RC^EJus(f$#WfQ8SUlYI(>8}v*{M$$zPUi+z;LFw9)56{^~rqLs1ZJs7ft^+ zNE2RkS`#YHzm1ColbCDV?&F~w1ICdxCh(Wj*crQ815D!kr}?Rq0A&25^qshh4Q?n^ z$HiRcz#d1_Pi*A&0gcj#6wqVELVfK7?@35-=TW*`Xa_w$DIF5{BbOUHa{f^msM$cj zEKF_ll@5V4LwsF`4kr#KE3ob-pui_0%Tk-hSztP~NAslrNyxIlq;J^B2A7{@ol|V# zgTs4L3$cYfaIMnhTiN1Y02j=BK8{ksF8hxjzS}%l|J`i~Gt=*=V4<_fyeEl=_7vmxs576~E-*U%lFGgWIRERaT5 z>AbBRMC#uNy>F#x09v%2raNa0=%+=QxTXz|+9h+j_)8X`GO09|dUAjUFZ?wsg;MgzC{rj$RrEFv31n=3D$km7P?HT@?pU0^pTn)c=n zBi8TrU=u5+hb3D@(f$9{kU8_@5Eslwv3V2dK$kOiJ-X(Mu1ch2=z{XqIP6=Jq*k>PZolmNEyvQ(`9@-hMk&99@;%WBRK=4^6NZm>t_n4jpXU8aHW{ypvJCZ@KUdGg; z$T0Dr3Bl7K_W~(BtJorPHFN(gxjqj#oq0Gj(_6sRmE*>Tx!(}yfStq9>nY^BaJ-@T zXa$7L_VIaS_kqZmjHP0e5nz_b7XLQ=Es)o=b*9c)1^btKPk0`C2FQ*bC_SG@MvTs- zzSEptU_X59-Sga5aBno8KEgB?Nc1{22dz(lljpzaW(NiW-+ty-b$@M8AZ@d$sl`3; zfWgX(VM_oJ9i$O|6!r!WDT1$T-@l90{&c_m7Gj6`Jad0C)H$GcDq|v|!~rPOGhglG zycat2UaxH0-3T?ld2%at&Kr>ndpo&4wLuFtW(x9|wJ3ozYO z46n+JL9;ZebMJ2WArp4t{kdriBsR}8dbsX@q}O76ed`^HW zQfj~Q3_;N3m)fDMM*&2hi3?Zja-q|Nlno>nO5kQEW1x}dNpzL{K@CB)FlhhQQ0rq( zj)c#f+Jxyy1M>mp$G7##(67YSGkgpJ;KuR%Ey05=Wt~UNTJl@0i07u|>s&r=aH;!c zVE8=|uwtBW!}DkjxQv>(5A<|_wC9IS<%v_E%*RqgG36tAO!m!;^3e=h_7P7zT{r_| z+l#|rtj>e}m9yM7AHJf=tXqn2q6X2GMw1(A&TW9WtT*l2hdB@}DrToH-whZtD4r&Z z_9CWbGS7;o74)01m_sRU0Zm+Jx}Op?fT)Kn1Oa=?) zLj0pTsbHn%nq?MG31D1xqF*yD158htg!lwfkmLs{m&UsVh~R2;OxK4r&?{*oe}l9X zh^PIyPhC_1oO(Q=7_|=4?I8S#uQ-7{_Cz_Ggcl%DH>A*FqX10^h+4;T}zQ9U7-?IZ6Cxc@D? zn_>tRE|?pvZxbcLIs2jSeHjICdyUCI$$d2#<*|6LH}4qEetuqkDO(b=@COOR?efCP z{rx3dLM?3WfF~+O&*KQ`xyJbjtC@{B+z!losr2O}>?(_~rR#}+`!~`|N6w_fYX00)LO%XDjE0Dw zl{5s-JG5M@NB6K~eogWDsQ~=_VSb-%urltJcgA6KNzi~&H!<^H7W9|B;~yM;6&i~0 zKC6sM!fO_5Jq|vBc&-!74mw0*($ycRvoH<@W>3V&}In;JmO@1x>02KO;BzLn#gZ&qe6Q5_@ zMX!kS5AN^#AseZh*F0noP?f$YSE0HxihW95Sx({&Xf#jlcAiZDzl~p2yyi^@?x)su zOn4Gd@LWn)v%Wh@SWVtjIC=nv+S@I5>3opX1Zks!O&mzP;4xpaoDAf?{`@m%7>JZJ z`E0tfbWw3Nv&izvO!O=I-*06_8$haKYw?{w4hekHJJsuG3a;6TbCS7BV9}Dt*41|I zaQY8(cFedtR{~U8KV@A0oZ#s%)@An8&14 zp%1iwG0_zDOdVtHfadfTd2H0tDyVPnh;4bNyz=jO<7@XQ2g}op;2Kl*g`9CK?83l6 z5SnR*53-7Oj$gNgR)Kl<`PHvs24)wQULS3&my#A$IHHA>FL<9CO;Uz@S1%;hym^i8 zxcSrFcv%S2=w=m8-e^OOB^TW?9yWqrp2>pLv}_cUx&837)CVLNTcqZ?+>ZQcUp|`| zZ$r;*@8*lE6#yGndTMFCkI2eUF_q#{c5cdU1|{EGFU>Ccp>O=fxzbT7!07E@ zH|<_0ST=e1f~mI(v{K&k-5jh!W3qR-Dz7{M9J10U@8mQAQpfb>Ci)_j({if5ue%R* zwvKV03X1?F%vQ+#&=Q;@+Rug$Zi7?$*)f+`yupa^-TVJZII1&jysV&k59GJ}DL7W; z30SHM>PG6x(Uq$fRXexBfr!@*1FN<(dJ*E7lX3Pwdf?we*7YG2y?ZnJ{Ewj-asy2f zp8TQUbB5?_b`cj+P@f`+Hxohi7eGKWua)(Jg39Ut|CIuwoX zU8d`P9EvLa>|e8&b%P*~F8%oAJMi#rtU&?c8ej=e+bp^~g3NN>e6Q(Q1E*|x@97W> zgSX-?26itS5D|5D24~I}R^E4DL?J&_ zEWD0xhiyfz2=$|&GhT7RMpbBOUfw6z?I$9XU^s|R8v;zrq)DC;VT0Y?U5Qt{u=rFR(Ee3y?EeN&B zCS*xH1fbLE`2*WqRG6`-hCcN!KYUy@qN=^f1bG!6=4cTxVyC_0XZxw7*o%WKlWm9_ z$KuQ~<4J(CFD@N>@tzwdrqMj3IZcC=h%&bAFYrO?L{|g82NKvI)vh@xlMVk0xgqIy zQ5c_oc}1^1Ll~zq&9M=Dm4tQ7zqzE~5s1&9clI~f2CrSa|M^aAAc;NNM_-GUfQ}i{ zb5fBVFm*R|SgvCi(Qrl0>4f|Nxjy$(Z7%)+B^%N@F(G@P)**Gmc4!Bk>9os<)1E`0 z#VPvaRcWDXgF=L0#X3^YXu6~?N(z0Nzpe)_Z-Em3o6Lcd@6e^h5TU@EM`$J~CV6pv z7R^~OZ6$}1;;M+J3fz%oP+9uFag9C!UJo?>e0&MK|HYr~d#)XMF1Jpr+;0H+G%5M= zLlx*l&i&O78^d77KI*bg#R$kJu%iDI{RUkX=WJosVI0lTHdU#2f?;( zrqPOeB!Ex(ZtA>8lJ2rzwcbNWWSsnhuFW7IlBQAK3rYYB-^E}49;iZPyJt^-$H^#x zFf(bmx(zMRu`jPFy#b?f)!Pk%t!VD>#o*F|PL!2aa(Y#;0l7x!W)R=`4N61|III}I zqxt1UrjhPx6EC&%5l-!XNxw8y-SO}e^ z1Ae2E855b~H`c(-%MmscgnLL;ay#BcW&_a46|pB1lR}Avv(lsDe?gi{vusns9y-3; zM$-15*Pf~2@DmI>LW-paYm&9YXgp$=qrC4mXwdf2)#LsL6l>!9$*NWmZ>--YS?g2K z&-*2Q>rDu%Fwo@_yXc0(4|rPMm}G*x+FACVcK47IDaDD{oNOcl{|(DHrvd&;{nN77 z9s!Co;^SGRs(`Wi-9z=6=jdw@Ws$q62Z-tXc6e?jALvr0lO-NFfkjLE@R*e>6p&oY z()q&y@z{zVU(^c#Y7LYRD+c^P?MuND%0J2|l{$WoamWWW)4Dozv}S@iU6Jd~e749` z!hGx4?Pk#1@iOZ4$#K*+!Fwiuwhc|)(oIP`+kx)M$Z2rSwt|_gNCL;?k3jvMaDsSAsPq!P;UA+@Kz1Id#J+hkac~Z{1k;O*-P47CmX^Lp zF2yok2xBT6z$323ffq>f`Zphm<9ZV1 z(_B%i@Yl$0vRZ&9yn5OBTs_}9@}2@p4Xd)yB4sdB>kSLets0h!`L2dFXe$edv$Fu#T*k;Y(;P6Fdv-?&mF`MyBN)yPa28i6LjC34*%^VKIe0XUDm>Q+R=Mt;)lt?^?97Y^k{EoSK4cT4VgHy2*69Pt{=5r>ya zuO1gRA&1pJyTXOoH&DYr`|`U){MhO&j-r0YjOn}wKAaO!gx1$k&gX~6VDgI+B355P zs7gQ`ed;|syj_~}w0lwvE<~>%bsxyV;e792x>73azmU6aNh*l-L@f+QxB21v^9Kx_ z8f1{$`_IeCp5t(?!s|k5m^@zR0|pn_FW?Pxg9-1zEp+Z*SJb;sLVV&;LB_PnccA9# zanQfl2VUBT9ZO5uK(Kc9`IWLSz^`dEg63{Ap#1!>`lHo%Fi_QbdX(rZn*Sa|njHEC zsA+bNB}je&$weu8tnOQAx%rh>NX~b}@<8f#M94QFYn`>F@4g8ux+OZgf76f0g@R8ds8l zu1zDfZC}XnqNUs?f#|asRQfE^LS2J0Ct*okI0;OMCw+Uw0FG*{XIdnA+GTbs8$!ca#J^gH+(Tctu-m=_}kdyOrhD} zbQhh&shN0m-YMc@tb8SUa}xFt8a4o-;XT!`2cZjT?TNj!-yvwy2*TLG;Gut2ZHj#h22?6hMP zBLXs_SR+VS^3gDlQ4>d$U*R_`=dcFgDzTuH_{VL&F{nF6{X2^US(~ zp(8-sEi6;7N`yZtnvd7rrG`9twp=?ROc)Sd=DGNH2FTs+-0bDu0-pr3CKpSI@Eq}3 z%WMW=ST9zy<~v6P-#I5eAK}?WonK2cQ@H5hYc5N609pIKj;4uO>bHj3zkJ>?@AX$Iz(_9qgdP>rwWdNx~ z-f&NsdyiD#{>~tr`wdv>$2OS72T{P}wd)boq>#e%!MbGTKKLivZc25J0!~$5^?Ez= z7ft=3E}+n%$6GIGUWfM21ADm~_9ziD%+(h?c#oL?-U^*NQ^m6j=J`dgxiOQ%;dL6i zM@JNJC|bfk*@FPieRutn9PkI3@HKLOl_J5vTl#1Vp1nii?v)`I#|WWLowd-XTZHi3 zvPPBK?`5#KUML&PK?z6PBJUW0LA2m1dGk2`B7(lvkM7R~p$u(iyJV(v6lbh7OUD?6 zMC9Fq>0+vYo2U=Fw`wV>V61Wsh%EpN{#^5vFdZ>ZTpoY4Qv_BUyVP5bXQLa4{$7V~ z2;wv_r4>_401sc6vCl52fS1zi3AgGqki$7tXt@yryves4w8lNa=QMs@MZGj2eOD%v zLiI6H%Dwc3=KFn6%)`R}D=Yv}v?Ch5CpXdQM|y)cBk^E+rYe@DEE2Q2Cs5R~-NO0p zEa6{g4Dc(G-lMD_S4fq)RRTN>puF_Xnz5QX{83CmQ#k4e|G8lIcuoggU7W*4uzM4# zHKlfoy}f~7a=EZvNPy7mSYFAtZXiB)F)3)?P6yMZW>P)aFvP^8 zonb0V;W__(b6ni3euKHk8RyYvKY0{!5e^8f5=fpg!t3&c?Yy*pI2+Eaz8HOrRy4Ha zfZbQDMZbPCDS zULDL483Qi>%_H{xYScnQ>}pdzfxL(MAManELF;xM1~W&WkcH)$q>Fc2L3Be#2~Xl6 zU{#hPf6zCIe*WGh4}Jd@sNH^Y5OS*xVMi*Zh15@A@l%50LiiF=RN7DOKb{HdbOgy| zFG-?{1(#0`7x)0#9?rV~{OVw!{EkZTek_{OPE5;;HAbhlc~14R-Ug-%JJxqu>441a z?u@QKw^!*a*6*s`eCvP8(tbB46z)6+%xo32QrwnC>nZMLcgyv zx69t!VR|V0m!!%VGbkMM_{!;ynG`Pz1W-9+^DSf;U*?ASnWe<|8touuH8cgr`tX$V ziv>aoTfDpfKHs%X8nSpix$m=m6$%s^aOyjn;D{swdG9yoc*QLzdb8vTbZq?DNG^OG z&Rfwx_7~^IJk}XsmimZsb#8CV?_yJUS^D9`$qq#*tsH)DA;BKYmJHTj6LG>c?NHIO%bjSr(a{Suv!n>>4 zY>@ZapH@`K2iva+MFdYWLAOG$T|OoOxY*MY+v~~#r;>%UEb>@zqJPcsBH=P>vet0A zJwpO}m`}eHBiu#zZr)mN^<6;p)(g60|NqbAG%8Oz01*5d}OLD z+K?FM`GY=+5yZilof0Gxi$+M_xM+hnV1ImP<-x0Rpx0GD{mQo+t?4JlJt2Dq3|vcs z9_kjL74gEE=Ta4*|H##|mnZ~e)fw3jfHq`HYthd4-yA}x{5D2FDOzXDyWXf$4l?s8 z7#Jxr`svi5eEgst+3|c;v8gFWMPDlJcTW_8k_Dw5Mb>5zE%@=1t?W(om4B}Hb5A_j zy*;L%aXuGhy(0~Ew5bK*e%Ynmy?Nk_)=X~C?HV9ylHny+{uG=jmfap>EJq5!{?g=` zHgLZ2M(DlQ)!^M#{#qRT5`;Zi%y;0gL3`W}+-qs-fd?&J<*VOSh{st5Qb{F(2_GM? zWSbf^Wq+Jg>r4mYmV-B$$dkanMX81%V>@8#nigHOYejA9rM*Od+tJR$I+E9${b=&a zuXAUe+JJm`p=zaP8+!jsn_0#FIoR;^wmNUxid+g!>k>adK_&E3k{!vtsO5F@`8PZD zfcgMPbf0oy`M!M$`{VqYGA9VqOD&QIg~K@5@1!^e+Qrb2fO`6qVkd zrHiw#5c`l5a^i%!8>hGX7Z5}2iLa7MQZR*_DBS9nA~e3Zv35I-3!Xk}(xGoC2g6%P zdl;|j!P%le^7QhdqJ~EoAz48q{a9Q! zXg0e}X*yX5L{H!OacwyYshQ0iFRozl!9ix7{eB%9h$p&|)D;QBHH+RQv?hSm*)fi5 zS>>otBeL!4|%E~a4pw8#~Z0q+>x+ilT` z!jkuH$f>`Lf*-xL)>l?lFz1@4YFF=5Tti+FL&Fn^*SJizf}f_sxsh$p4@R+&P;IPK z%d`}}Q4Jb})v%EuJ0 z4548TiBLF7J(tq#6#N~wKD5Ed3Ge*U{xdWq3ghO?rKln#@SO*mUAMD{v259Q!Lb%D zOnyGKx>r>MN}Lz)IHhm_7Voe=Z*<)O`H!!aon&Li>t=kxjj9BA?I10P+>aTyXauxw zH=KvUhL<^5yX5h&B65|Wp)**>@doh=9TvR*r0JIh9R&<0iC&D8Rf7e^LR>5*GFYI} z`$NcmaTvA|dVeXG267H}>kqQK;^Qn;9-8E)(AVm`Y5+3C=gTanQal~;OiIcR;bIN! zN6dQVO+p~_mMR0{f)}9ZRu;{~o+G@Kv`5&&qXA=Hohq!%xdn0gsg{;4QJBA(dR{2U z8|z()ns#dP!W`9yeJZJbxSf)2#VpMhQd;~RV)QqLhv&n8sWPjAZM4!0mcJ?XnNA(B2~^vkB95v~ejL zN*pUh57V?H+H? z(25f{oB07ynEu=6Xp6MY6Y^9Y(+1anB+o=}7$MHCf2@>bmSFkt&g6KD3@Qq&dN%mP z3^WKv5SpjBB00%hJP&gm&;cvkEu#@9a6*E3b)Hil*?f4s-T%oA6a9F(2bLA^K$O1r zrv_hmQ=pnBP%r=vJ@juRkaL9dgLzh>l@`$VYP^U=!!;~w-m8~}rSO^W{;D(KhIsMW z`rpb-8Mt;#Rl_{R0l!TYZcn^nhhqwUko{|PhjI#&wLNtZGBF4C?lRcn35HiOu+|sq zcE+w(+{OyAg$6G6$=9YA9i{ct|*2^T!+EalA zOtph?mt*01MKkwPzPY$R)9K}BlTdi8;cLp&jR0(Q;-uof^>1`!+WyUP-VLvPV?P-y z5ef9?86G8mdVn121nuJoeSq#OO4&D0b-@cx>Axx`eZhvgVcIpy7@*L|bYWWYG6=uu z(5JPZ2<*oWevRBnM5?kxd1*2(Kz_^O6|-p!(!VU^nobu0aAJV|iF2V~!sL`jI%#K7?pJs%acHb#*CKZjz3Y6@;}F?zEsfiaUNO96LM_HQRT5a^c@Wz zf<|c>BHY+Bxu<=T7GF-55gkyY$Bb`91+9!p;2ibMA2)TGVD;vf76yDcFyM-07412k z$j;|3gD9Y8V@FqRb{bZm9QvY7ng9cpSa*dI-^1FjjO;I6Z(!&Cg_30AHmILgQ4yow z2yFxx%$c&DL&YinpJpi-yM7r8e@;IEwL3~HZhS9?p5dyaXPnyci6>OXWyan3-!Gwz zg#G7m@n&h4;QctcpKpj*;wnvEufsGFL{KRhN23FeB~#enxf!7NS4p{oL| zuStBFNE=2UPVlOvN54bv<2`Lot=-^O1;55E!eMZ%|Nes$96ca+^RURf{W%cXaChGw zssh(ZZxO}!x1i!`sg;S3&rtb{2srIr0|ft>>^dI=gW6Ry5p(?}WKQ;W_2H`l;Ap+a zuj2Ke|1Z4dA0mC($}a8ZQt&cayE;tgEs&bNf1m4fItni*biIE% z3+Vi^z3zH736Vc#78z&779`_AW5#7Rl4%R7~eT158b_R0UtC*hFw!EY+a#i(tJDygtg zEqD7_3L1QGNq%S9x&tMDp6{@Mf5DwtB~ii83uxi%NW-IvABg(5!EH~gk3h0Wa{I~k z8StUF>HB6HHLN~+xtUay5NChSCN6YgfWDKQ#Ej0$P`*`U6!(38q^`XwRP?#4_p@F-FW{mKH{pZG> zYIaB(`%7(l{S;K;{>h?I$PPbw9*2g%B_QL`kZEx8C2V2o&;G9%;N;_NqJ6aOC|2xq zxs759NcliA|Iw)gl)2cvUm~poX|HZHJ&14w(MKJrMyoG?ruCfewTp!y_tPylVU0F$ zq2`XhUr#1DNBwP6Y^4w}oe{RACT>7Qo9ezj+wV|O*jiLuV=5P11)v4FU<8Lhtmc3ds$4LB^7{-inj0*p|| zI>j;PBKvO(3wbpd6&}IfVv{G`Tx+yGSp?MHMk?O^j}vY&x9g;jRU-izkg@e&|KIPte_en73K-q6r7@gL z0&b~@Ul=5n!aE~N#M|i2E@Fe-gYzijg=_v{HlRo!2C&y z83gvlk}LB|#_{|3?=UKI99w5KQ+zrYf{d++lM^$uFqnll+F)k_sz(0tUeEprSJA1~ z$dL~G{=|c;Y)(Tk*o4A(m$(;aU7p{}t9uPOA~N%j8B}1!cZI8_hT~9`VK4ej=qF5X zxPtW*Utwb8ksF~i0aK)`ZZ93R!5gl9I@cCH-~q`)KB``COyS4>PSUOquIH_)D;L#6 zhNbM7@2x|S?q}X$^FABqn|)*~x=sRt+vDH|=Z@hAQDzRHlN!tDww=SJw0LaZ$g%O_ z42VxH7tGrxz&xtIhCmSk4q3d)>cYf}iL=rZr2=>$tE8Bf%i;m@bjp4)rtl4fhkh7g zYoWlm?2RXs9q6FQXa{khBsos0w{&8;UIZ8?WM-BE_R*=4IGa0qtk8GDy^AA+7OtoY zO-_v-pu=ZO-d*)a;L%T_Abs}(Fiw|_e(dD~`m0(0?CWPh>|*oJ!sRWL;m(Ai%(O}2XjB)qh;V9S|Cf6LP>y_w$ub<+y|hR#Lgk{rN7 z>$i{ksuDKKws*iTcUO{!!X~>hRkzq6l32fZ{SR%)4p6FC z)8K>q1}q%9o1oZ@|H;o49M`Gd zE%Z+fR$Uf5>6oX9dj(8~5$#*W^f>zwe9Zf{_ zAl+hkRY$uy{1z8^o6JBAi=Fp$*YHrpTM12KP6ifOVwv8}lVcQ_+V+Kv7R{pbXKlS2 zvwtJDv9lhslpDZ&!7VsM;RrM>T^g;={EAA4d_Keu65)p;+C2ZXx4@&X7b5p4{(#Sk zqNN0O)bLo&s-5Pa4KU5y;VU#lh{tF%pIiz3f;6}Ulz&YALBHrid8Q)Q!Ny+mXa2b@ z;Hp=_rgw!9-+t4U-SB(?^`eajuEJl?;-ORLs}@2`RJ5zzlXnQhEkS3{F8r^2#3A)% zNV2AQJXpXEinyd&C5n3o4R4GiO%%h?c#!N{pEh*6r1tv9 zSA95gep~axk_Bw{e_ffGEr7fAx-R>yi$ZQj3c~Sc2Ka)?oObD^2|PS_OHlkv3p#Em z*&Iwb;?(<2fed$z;ga;wsZ zn|ad$C;vw0PA!*CFHu85SCQ(vN@}R9wdEA)vI@L^lqL~By9XFIi$1%4o(Bg!b8JSv z)HwHngB0CsCai9d)_Jvr2+}>7zltnK@f%(WBOMzu$k2adi|QXU++MeKeEgFLw(|{T zKMFiT&J{P9#0|F4g&|{pTOM*K);v})t51Om(?|$1jYzQ4%Oh9VLI!g-GXz}t4!}$P zftze82GBfp-}8lo9n_z@Ic--SkBg&gcbnAmq3sKafX8zG9n*2!+h&u}89J_72I+ruTonpU#(aoe%dp*E#p^%khBo zu2*V~uH`_V(5j=5!EkIqfvFzayWy(}logNAP5jPky3M4^3>Q+CnMCl1V4F0{h7s8i zEC5UsyBQPV$PKTam8nEn+IZVJUn3Nz&@KgBY)*u{PA{BJ2uH#i`wr%ikA_f=Q1MxY zkuLO$y3@~_;e(&D8ZWjmrQuITUD7QXX|T4*NUdxj3HP`*9G$F5hF0jpvCe1*{K!#7 ze2d8sJ0J1<;fMZMguU&iS#}moTMHc?7I+8o9P#rx!VLI#i779x@&#-i=T%*O?gXEn zvbR+Z^~RTG=SJ)P#AB_i=j5;G`e6azPgcC2La}740mpUrG}xlIPP>^Hguk)B&-Ax6 z#J{-X@--a2pvKi|LSt)xIKw$`koo(2sZc0?J7FKv0N=1vj%D5V?z?0x~-xNpLA zX7vTyma7j_vQ0v#Ge)+u@)AJ$VDsiQXCkN~4PBb7E<#zxk?R$T1%Nt+9DBfZN-iTh<2d27v<|8L5!&sukD72{;X?x@L7yOJkW8$bd49;9|-BbxJ zg^zW643pyG@CqqG@hzQt?48+Z*lgj8mFAy_H!)|zN2`A{*Pr;}vo^k8yB4D`x6b#c z*0kwZ+cZR#Yw!y+{yjBf*%t`0v68C%*dF2V_J)mML#=0Yki zM=?>cQY_sx$o-qM0(M_8{vGHT32nu87)?JGK`O#}zP?Y@&?3J7S69+8NWMR|z#&M1 zR}tfndtE)~Jf$=3ApsF~`cpoZlTM4RwA*!Z$qLX&{AJzJ+XQ%Gr;(t&Z5D)-4@(~0 z2u7mk@Ziq;I%?Kv96H|q9W46qI{lF*#iwntmtYz_-dZ}id^>&}oTF~^hqV)6jn^sF z^mRYbXO3C>G_(N*Z~0G8C^2Dj!w*Euayuy7K<0c#6cZ*2BoBP(x`}eS-`V+WZ6hOD zuk;s36X4v=SVn=@545|OocD!!8!ag(-J|ZHhvET}zt0M>V&47D3z{dVfYsFJi>~2x zFi4Xv?+*TsdZQyM#YAFwnP_|EcikcIGjdxGd2<>|Z%r(&?33WRtAlHW zFKO|u`-j@8c2w9sLo~U*h7`9KcH~cH`~_h(hJq|^Jb12x&%UkX5Sg3qnG9Pq!W;Bc z?mUDwXkj9LH{P-nD6Hq--RfIG=PInUy^Cp zZU_~#njs@$eNoo#s5j-yRp(?M zKqlz}_;+6vA%+TNRbTMNeDohMqI{Rr-yZsnW&Isn=gzH||;BNUOh(Z7~82y~L!z3%(X zfcbsr*oo?&z}(c3hR>=UnN2w5&D15L>(#WCq6Fh;EuKRP8r35I%-))8pGm~^-CN`M zb`OYV8@i+J(TF0YcgVI?5qNmhr5#UFV`rL0PlA`!kWw|KN0jaeNy_p1P?ZxvO0KFS z;Wjo{IUe>dSc(c$T^aULB4U9FDL(I>I5Ob4_K@6f+j~ecYkIHX=N>q-_Uc0GuW7(d zvg>Lby$=q4GwRP-k;9a~G|PS)?0C7)!!46!u`PPDw$Sjcx7 z`s;4TE$s;5)~MXoYYRd+>t3DF~1}I4xF;^vB82 zC}SOXdOm08Oqvhyiy`{R{HzF(=P8g|aAGuPt2}oY(23ehVoPoFzoO_PQl&=fbfjY~ zyZU#p2e{pvt&HF<0bxdCKES;f1*?@TUZ+n1)@I|L3%kwWyVMEE+D{39QuIhsUpWEk z2Zc$n*cJn}M;qr(Kl1^;KW;^lYu5uZSN2ADD++0RKYr!CK^m~h4%^W5{R9*jwG6%+ zB_cI_GQ%gYVorIi|PBJL}8@2~jIB zUR~#*;{So(@eAqiq<;ZC3Iz_Sveuwp)Zu8n{WE$ne2aQdJ_Fdw2E&qPP3ZnYDu0wl zF{qtzFBT|>Le3D{(Y{;PU(Dy0zC z>hXG73|_!X4=68ovG8D@(j>)9Ryjy3nRbm)4Z=2aIg{t|Lip7iy~yT0MmPz(uC>fa zLxJgi{R>T;xM026&G~>A7dTCkvX^qg(XtPHPc*r)7kSkL&2L)#xBQ)9iwp}!@?YsC zH;-WWNOKI^^!H$ce0roi-P8hh>Z7;rARXvw*;lej}OMo_th1)kgT zmy*cBU{*@fVHd4QVCnc_%)Vk7jT~b@ zvMpNx22Pps$F8F^DVX?%oD9Z_l@5mc|3U7y#bi86%RutD5pzxND$vva?DEC(81#4C zWq4D%iw=bhk{?dg0E37Yn&?StD02R7*^cc`V9Cp6rB=X*dqrY|y<&*rS6i#qKDHT@ zZf2-z{GJAS*UY?J%cg>~4@zDMz^Y+~yX0OMva&c- zswHeh-M5kkm@0mN&IG+CBlS*jV5QivY}gBA=l;^iNp^$6?}}})`GY8l?i-0y-5gN2 zy;$2$Hw{j<6eza^w;@}e_4!z3HP!gNC=?zutM! zjP%?!2WC$<0Lh(RDOZYs(7s)haT|S z>Mh;hYu#Wu^^W2W;<{bn=v(McVt}#J_NI#lkcH z6xJM_WrLZ}!TL-BC(IiZRMBoag;TwC=H#lWv6$P`wQnS>P8;5<<*#6VUxYDrSa18{zS7?W*%mYqi|9-yOX7Du(H7yx#AySnLtyudt;4nD# zNr&|>Vl+xT9eQp9&G%%6Tg6O+HA83lZk{FJn&Ao_m#3hT43@N);{`~~w$**;!W6j3 zT_tv4-UP~BBv*VVt-#I12MeZhk${(N@7#ImSfmdWZvWtSM=Skt7B)uV;LN8|hJ|qx zBv*OiHbHw3V4Jev5Z4U>B7SYHUlIb)t2qT{gAeymc+c~TKUD64K;`E39UW(M#r1Yf z;dKv0Di(EL=lToac9-pb+nYDQC@j=7Ciw<9!?+U>^z12+(T8*bmXXLP%<^M~ZWQ>c zY^THf#R61gmu&w2m&kx;$7uU}7>IX%D_r=o1YG*M!O>X|1@<0QpC4;*MZa9q@9ZRe zK+4*U4X^4k3Kn+~IMOWu{p+7)M=2w~;*qvbqLnvr+Z7mECi6s#y2ZpaEE!1E_JOm) z!$kB!xGJORRxu!Qd2T}9k^;z{y%xAr$%NERe-k_xEdsVjK2k3QssL+wX>kliBuaRp z^O%*c9EI?dmt44;jKs3vn|*12hsdvQh81qWM_2uUW5PMBZ!$9=|c%xK^-c@AJb9{bamr2?idTC;9 z%6^ps;~S7`#h`Oh z4%fzEDw3m89NTFR0m2%ZS&|xw=Fql;RIFuEnhSLFl}0|9I#(Fp=SLo}KO^A`44$QhQB+U9|LH zO==Nh4dH7>d%grv=4&ojmGTU7d&+#_ZPq-H+lXAOoZCXo1Ibb5gVV@lN_6B{)F#qO z8qRVVAi)k5ozj2blmqT#lSu|P)!@4KSpTZZ8fXf&thB#Ng6nB3#60~w(Sr!Vj;sIw zr*Ga;j=DqNFYTqu>&oMPMOu zBx3*Pf0i`y1nL{EJ9ctA0&P?e)Tc&9gY|kwJK}TppyT30UwhAFwpX>HkGh8V!EBa5v7+4=F^mT4-!WAyUOo6v5~RJ+mvdSWW~*TlJJx~7yprW#uV%U#{c?W*7#11*9zx+T$F9Pcy?^l7@ zZ*rTSs~9W=d}ADr`vXpKpQ^VpCWBhfuZVl5?VtjEk6B*THFV{)np8sgI!K%R+kBw4 zgBt8ZqLK(FfG2A-_rH@PDDlO|%t+=VISJtN>w z+$;X5nHl7Ko=1NZ5Wwgue*rC{OMp2volwTHtD2)Y(}ty76-jY`pBAJF=vBIrgjBLF zaQaE}eWL=RJ%#?IGBs}Wvc?ZM)~ty zdd{GZXJSK6Ru@o#%CJV4A}bP$d3|~!@B(^o*qLg-rwpDhyXpIKOM`~ENtgH47f`Sc zlqu-B2?#kBLij^8P{!XMDimqt=wYYrB{}O>6w`WIt}>_w?YNWjzBly;_ZpoR7J~f& z(d+I@dR28GIO3hnb4rA`-k!M<>iYw&(N5DbPJad`6f;ZTz3xZ5jK!*7nOjh5?@unf zoMccuqa&DWkOI(Ur(F3Mp$AmsZtpGPfu}GD zb!7Sw>U%-Um$2P{xE?*P@XF5yV`az7Dc!x0qr-g}398!r;~H(9_vS zgP!CXCt)o3zo#gUO&taz>j_F&16^5GxcX?t_BMShg7WJ|G7Azi0a^ z^3lB6ua|KWZ&AZUh-4gjDxwo8F2gm3i28lIjLflA;F3C36#45ZP>D_}`XZVI1oO;y zXfMQrI&!hRUwZi{Mlt`|OkNiFP9#7$J(vOdX-jG}Peg-h<(2BLJJi@t)$xtq7eYv^ z5g*dT!2qA8-c@(KMhP_nWkv_Y_kqvN=GeW?6(skKS@gw_1lE%fDF2+y16OD^xa`Mx zV1cI1^w%aPm=LrC7#)eR$e;JR7MK|3m|wHY6Dmh~u}4Xvx;)TP%ekb^?hIZ`;4@=c zp@w0%e@5Rap@Z|4@@ot3^!R3h8I(bb5sv2}JFj$|WBM~fJ+SJn3 zYzOmEyPD)o-RN%Ylgke-_JZDH;{lrWxT3F28y34W9?z60e_%|&B4I{gHd4omJ zn@Mml_0lTxdD0eL^k@!L^`*K?Z~ey|gBIsSr00;K!Hm@v;c-;uM?xwXFby(O{CK}U zFGGq}9~rcq50G}kArD{V4hr>rFnU4r0MT|najBDZ0-XZ0d!qhZD9%ZGywhO;v6+?9 z4qPRG`rE)TQ*9F{6zCrQkXZ%+dRyGj)#>n~zHK9OX+liyXrvnvunStB2Y!rtTZwe_ zzGM&u9w4q z_4rnuBQUhK>=Op){YhlN7!cvs za6tlG&;TMlxjn`8|DvPh9=GsTdaStm`0eF?1P~7obUrpdK&2XYkG}~bg<&Qll#8|< zNFsTj#x{%z+B@%*E>RKT;Ey5$vcZ!`!I~u}Mv(x|+!POFA=yWn^Pc3#wU5Ebq??ud z%}nt4*x!^5Zd&LjbK~LX2158-qjz)UJQcnh^ac{h9w8sqp?>oNMi}L7bv5BL34Wsa zU{o;c5OC?Ps^0y(4|90@i1B#a1Adkn)@Z#7pwL5)tptx*tL#l)c zN=F0P08vW(*7V<{{D}=P%9j~DOGp8uTTDA%DidPMy+h6~PnS_{Nn!4nr47KdWD(;d zL<9+H*|YyqF9G>0AF@VI5#wPy#xU!!9zbp29;H(_3hu6-P2>Tih`k^*sM2`}bp(GL z-i7O^=_-n3{xJ(~SaZ`=7IhMC8bG_+_z}48mhSxC>O_^qT+>k9oi<|{waw`(N)o6SAclGwr0(}&qJRHOo~1l*dZw* znOQ)a2D+E59&Bj&qQ9dN9gCt7sO9-zDc?;Gbc$pvv0p10#UEUKOHts8M#md=FR}U~ z#yg6i-4k7aQKi>=n&D@FtLK{H9^q?HN=($R(f1cscyjxhz~?^^B7oz$eArd3zbN` z;jX@Sk);W?o{albI?{lTrpTCsuI0e1$0J7erwVb~J!aH=xgURiA5!pO@H=eyJKVV- zQHIa@tc>#R7htt~|@OY&2 z<+R-rIu<`|9m5P#N8g>-8)H_Zpa=dSz~-ytCFvBlqeN{q8F!-SlZd^YYL7FZnqT z-4_h9HzJqk17X}*34d|4@_Cb&4D6&O$ z0kclcU_J3`Sp0S|lDjJt{`-Oue73bEWRgOH4Q&oDe`44H{TzDaI&bOV##XN4yX)-u z86Q!X3?nZb*R6~<`!f5V&sLonzp{z08K_%K=k%Z_O}A(=3Y!sgABUAyAqx&&vf)cQ z_zUWOe>b0kRQTQ{R#uN6#Bg5m=NW@^UK|u;yhyWp3UAxquy<`ZMC$KuJ-Ri|hW++m zbG1=&;Pk79D&#s_fP=+!{|7Gx9-UVIKwLBc2%oE&+-}GKx!vlo$6ghoRG~s;$@{hF zkXe90<;4%seqa7kia17XiW*q`VkBCz@IU?5p$-L|a^Z9ui$=1hXLw!~zeN586y9oV z#i+;3l*JGhgW=Kihy3K-$jegaFzBEXc#kwJzP0W|A8)o~@Nt%*?7cV96F5$aO;ef(3YJ#U$!a}bS%)>iB7LPs)`kj> z?(QhJYmq|UKBG!m*9I^mcp2|Dt|RGK_c!&Q|AKE+<^_g?w0QL+|Ate17x0Q}u&emB zg~|-8BQ2}9(N$xqPyBVnuuL>%fWq?#z1V8DaEKgtzGfH@;uGz&*_&ZwEnYm}YDulE~0 zKbDIbE1KUu2SupH`1tPrLOi}gbU{JlSSB~Gg4RF;f6+cA(wci39(>FBMS7PUJH_mr zTry$7+jN>#gU+ zwg}^!0$xDHBCEem)d9%APQCW)M-W))&bCfCAB>#J{B?ZFuA>*Rxf9Ci)*$mDL*!^` zH2PH2Cd>pw(Qrm@*NaCH;6)-~_2+mFaPyI;tUmKw(9PVFRp1+kj16K%W8Rv8)e|_7 zIU*Givq#Z)zP*mB8Gp--{>ul;Q1}3mj24Qds`tW4Yg5 z7xA>*{Cuetgz-{7;W6I?a4CzE<9k;n*e`e?Me(c(CT@9@mQ$<;P1zUukC#Zn%P+ly zY0A&S!SnYfnuf%1Q(J1@Hm4Ef1$FDovl7tbr>;iQyc#^c!}`Ym#dX+bLiVoI<}y|_ zQ}G?tJBj-egMx|zL~t>+=KFti?Vw-9)N|dd3kZtNxj0OZAuX1fx0&X3h=OBjl>O8c zm~&rCh`HE^?xyrpmFpJ+X5Di)OtZWYM@93$LWN!==+GNN{k;T?o-MAVeBJ_vP8yVx z=#>J?pD!=G+NcA=c_aKdq5*ww;l)*Kt*G$c@qCcph}hoF4Qr_9BEsz6sBj8@)K2hV z*C(?d9Y$=NKe5~ouD?rU>K~f|G@Uf|)z@Q@r1eFO1L9~@wQRj{GVngg-97jFb4(`a zH|cLym-z~Qq$C~xh^0WWctqC3TpBvcxLbQ6_5*6Kdlts~?H#fqzi3>*@(6siaUl`> z9SJ;72(TJ^=A(yqv&JJ|M1wc(rw}t;8u)H;w$5_J0!DV<4_(C)G9_08851`HtdM z5Fyo{M}_{P2PajG#>>{wz1YiUcoYLy)?Xn;N^QXAGKmxEn<-G8cz<5w1u^u0=f54* zJr5-B)+;B6kzjvS!ok7hY4lF5zUe~D3Tj=v^@{7)IPI)Cbpaz4Yrq2`3dI#DG$HZT!RNEeL$_4RiJ$rph#X1eztKjP7z zeu&F2=PKYwZ<|Am4Z$$cr1@BDKH%oHy%RqXiP)!Q>8LXbzysI=yLw!s(#*& z$V^&pq4s?m7>qldS2Zs{_VRCXpWO{a%U3AerAU*I32)@dbKg_Y^2{*bz_td?%V0X3 zrsT)pF-;fQYwGwQg^Fh_!CNe`C&ULa#3mc%C$FQ~qE*2Y9(FNR-9(7{h* zrA~h03YcACX5FM&5u40D{PRFv9l!tkplW659NwSwr2Ha#4p;45tx*ITS#85qi(#tMX)Dfe`qLtc`Y> z1Op0IUZT9jt4|5y0|5Ot;S%RJZ}3S{-$iWk77BV28GVh(186i5GXz`cAv)WSjismj zP}`q}IqG#@K=>AOtPk}YbcXvRRk6J_Hhe-@`aK8FK=lWqQV0)gm-yCLhyKz)o zqrQQ6*LTyrkXm)NK>wu@lpX3UD#lX)n%Iba ze)I3~I$}^r>(DMgo(80t-m%4w=LX?Trg&IVuppDJ_ggR|CF!v(S5?1~SijT>aI7c?2tdR&? zPfuNRRbRQjW6BxGZ?moXWH}%`5#q6saXaO%}-ZE4%l6svhXD_p4C#egQ?x z?NJUb6~N&5D(6q}M({(V^$q74Thu0cd*8)I7rPC~SwCWdSl(eI`@4c9j;r50U|zqD z&jrl*dK|k5>nEb_-xL+X0uHKOMt-7Ln&ni4cdjmsuVEQcu~&v;_8)H#)ZKvEaRwV3 zLh4YS$>dIa$z|;CtZ%q~MIE|7@U}HrkjEkEjl51AQkZzvD#qSW4LcI1x{wE`;3r!C z?zJM^IHR%hvxCricq@mP(MRGIR?uUj_#<}~G6m=x8*iCIMqjE+E3SsP)8uqn()1Hp zbIyjs<^_E9`|y6 ze1PqG{*0;~IKZ>#;-@M)?C>S>+BcWYAHpx;AHx4I*kZnvgs!+i3z#6fdp45Y3|If^ zn9Y=bhI_>Z+l<2=VcIYblH>IHxYDryR+63vw)QJ{7|Q($5{oPG)_uQ(S8fMw4`nIA zwK13VoXYDktc>rnW2z{gLRsoUeHxH0*Rj{yTp5o{)&JxPhS-MVMCsjYckxBtlzICk zRoJ4yI>?;C4bw;C#2rJ7;nT;1XBF}x)PKs-lN_%IAE@08`I)MW-Bcb7Pc7(T_VR&| zWNeHx<5pJ;jO6j}3Wh&(hnJvV!Ck4>kFVo9SNgBi)jx!}mk73g9BJY2om(=#QKzs@ z{bSenF;tLRJ6futlo#96vDV!ox(JOV6B2n60DMnx~z=e*0%Eg^83`L+bExx~HhbyXRrcghT|`EbC}haODjsic@jB74yP zJ_BsHU#vMwMT1*jvW$tB%Rr`q{v5dnyNK+hW3cLlUSRXx_%Mx@5sHhfU21rC8nSGe zU8IU5R#G|nXu)}V8aG~a22PyaaQ&2Q!oJKZOwFJMXZZ%~|iNI#xn>!`t;^rsOzM z&Wec>ZQKM}WOSc){~Vw@#%^IjVWY@KE><}*_yBzJ7yP4MN{NHH$o4tYdQh5j!-it= zE^1hCh)s{*0t`APp9DUWKpPK_92EW=d`}{G887>RKAlnQevyn(`gW?^jvSFq^?8ay%O3tA69_yPVqD2g}F#sGx_Y>EEn{0sHsP(%mtWD zc4pg_zXL!1Z5+kiEA(m>|M;yTh52)nSsxP$0Vq^}*#bb;=8 zy1uW4ooFWdy~m3&LbyaBa?ouPPmxRk*}ZzXlX7JEjBV?5`fXx36u}-6TGVJXRxxKTa z`U8Nby5&S`7Y*DX&oLg$8wBUP_k_+_9K)CgufGpufcYMu!Q`o9IAP+{&XmLqlBk_v z_q9EVzw&c?$2smIy&0AJ1oS%qJ<8sCC(I6|EUqRqvHe4lg{J-a*IDqoi!Gg!G7Yw- z^>4EL#stNVhbNCZQsClp#_kUq%<#1Ox1YHS2Y_o>LZS8wDZFLsy5xSB5WXqXJgCjw z2W#fi7w@-^gP>;F{infXZ^oVNaM+X_iz9q6ltW5Ub-EKO!BkeJmZW3%|G9W zip1Omf}c;2P!pK~DRSO@-lafP|D*auLRS=0s1e|RQV z1)Z4}eJEz_2il}QVXtExTUR3RkuOf3963>3?|xvoLpC zo?(^64wWk#f+J^OkKC76^(8lO-QVUN)!#}`%7)^S!;{nSetY$1e7rQavuZ!n6mSL0 zIQM$Hr5+*8!jFcltXE;ia*_NX?PZ+%Zl3n-*ez_imA|d|R}-2VcNn1?zkp$?WN9Pcp&nlJ0@#$5~<$wRKn<=wW0U;B;^qD@WZ; z`YII!;^y)RbYfqlxQkn_W^(*M>srLQJ`y_=64))`e!(A!)mnJlxha8&aD2~^;~tD{L)^#45jZ^lJ6f6W0$k?&AhY;E7v)SXQV6~e1HGINY3w?~ z!0nPK8MBT!0KDh-$k_b=w-(`p&jIns{K-lMDW3-tr{ZL}xabOq)_8p+d;&qBFJrs* z(OtBoXv+28o(tdE4p%5q<%2}lBJ7Sb$KXV0od2346F%oMIVN+H1B&o=S6cH)!Y7TV zP3KHR;Vakt0#-d4n95{l-zhADGxEm-8O!Og^~Vn`r&v#8uB?Fz^me?^CZ*-|~iBn?-4idw^oqi@8ySX1vJ*;4*b}Wp>Lx3jsUFt6wM~`nID$0J>f07C=S!2vu%>r z1+nEP<&HVXh_@F+>e}azDOpighqCW7E8UY_nhSeA4`;_bDq=zoV8Fcnm}YVcw7s@X zOZ$jai6D4Eccpv=e)42-glD;G`jge_mJfGevB|?$gHw}u&pOAPZ)*}JKjL`lZ*)va z^ZBhgUbS|7PvDSOOzt1n-1#LV_>82c{%Oe-a^e+en90DJa)P49WlrXDc6}cF!D)Wd z#(fXYN%X&ru-?YfA$GSK`wuYKZth)a{0Rp4{vMZg%>PmcbedH0eH--*0y9INxuyFZ`_fLjgGsAPpYKgVR7fpnl@(=MJ>oS@X5(6EUuLE(0s= zEbyhQWl2rtKk#a(Z;wot9#dcWA%9k$8+XViCx5u!0~XacOtb^DfT3^Y*NC4Ts6tiN zAnJTO`g@`hJX&u?4_3+kcE0KY@0@6Ueq8WFhksVZE$nTOR>(0Lj`>W$&7>_oRh|Z% z5~n*tMLz<$t#3WNi=}AAk0_5;;3r6Q1QO1qHK3VvNP~L|p~LNHdxk`e2F7)t8CbWX z;-|d&4YwLm{j1oU%di!ttqZ5*aFwC~GMW_0-(L~EK;^II&PC94jfH35O#!NLs&-JB z=|ewPvyytI^YD*%oZ4@D6?i1GLO+%&j+4Ln3JX2Egts?zb)($R!>YKrUx(F7@X6TH zo%arcP~>1=pCMcxa}#c#d03zW&8MGw+!7MS#fg3U?wTD)$I4gg&$tR!2wct} zmki?x&Z}UW1a4tDem8>6H{k8AlS>xarJLmM4LiI3hT`{RwbJMxA-7 z90kS&4F8#{<~FevJ#+Zo(V zSX>!CxQ*_|S&Xcb9mi!$lb!}iN9grFr`6ALURY}q>clok0Y!q6rqs0Aus`u{A?7_1 zT<%|MMEvyxHga{WRXMkf4AMP5TmAAvJJDVHuk zi+AeNh{cN0c6(b%@rV})xEgD|p3sC^DdG)nOG*LtXhq?GX&(}@VlwmX{emKA8;2Pm z+JRHgm#kHvr=bj8zV8Ii#fW44Siz~g2ozs*pSS*t5iet}x+fP#&80@KjLl|{>k0v2 z==MS7Q;i>Zjj1q2whlh}D2h#NL=G5;c0oy1+$OP<0TvD(r>t|(fa?P-@wCf~g4UZ?3*}* z*8?qVU5CL6<)6c!$ie4NWEdG9Y2wB=4L>%tuHecXGf9OLGEi1O^a8gDfXn9U7pzMm z_HC?))7nFvd)P1&`f}uj%^C4cD2jcj*kDhSP#% zCNq6Q=;?Ja3%Xzd*mp@akACk2mdziltxM*C3q5;hgtSiJ!)4lW8gf=hS?@V?dW;_L zH;uX{OdrRm`kmZW?lEG1(!J|q3Hf+(;HBW1+aXYL{id1uu>!35y#FdwO$)TKw$qVV zErAD5pFWH=NQNnY{rCyg(%@^Wdxna2F_7KzJ>HTofw6OI%%az8aRvML*tg+tV8rbj z2m4FuaIS~a#f!KAbFx+4jh^p>J&^|jcj@z?+xJT%F~jAssfRrALS_oQUJy+@{qPIy zyoXwxOupg4piDpACn@+8V_h)cSP2w-4xZfk;}43)NFDhVQqi7}+M#dy8*tlnFVUhu z5qR;}=M>i2BOm(*5|fOHVBl?T5u}d*4`*ywHH1?^Fq{7uN~cJ`&BZan5fFt6IqUf= z$-)6O<9cS-u^3R5QSsfUAO)3hm>a%&7ztKo^-5wCAEPQS&krl+kAQZVH=jCzBdR!X zR@XQcg`C^;#F3Q?us5{Ki)6Dy#-l-@`|GaY{?F%X*Enmz>C3J({pQ6;eBFe?mZu$A z2PBi-*7^eIo~YO@m-PUK3$ZD0D{Fziz$hQpVi~wexcXkbvk~!fYz|SQ0?^y99sJHJ z8zl4A`=8VuIeAW4=~nlQKkO!I7O=NQzZyi4M&n}==4&2xq5o>63g zUGET3(ce9*M3|3E>q^ZDK6ZdUeK5DJpMk{3b}qi+?*L1bvpU3Go`~Jz8Apa#3Wz#V zt^Z%5v+Eg$=`k~5uQ!dF!Uu=ciWY82OJmsn^8ps4+6TJfH&&8s5 z$v0l@jk_Vb#*(uq&%}W5fv0JPwj97Gr882SiXTy1Xv4d>3O~>;y~~?N`W~?zsTOEv z1OnY~+2cHZuhGrna*9*FNoc%D_@c^S7BDT;i;T>2MApWsq>6e;$ly&t+t~PVjPzwK zD^9WCQS{4GSVIWwM{+HdFUvxWyT>wjNQCgh!U5ftR7M;i|1_7lkPnZ=EA-opio@Ka zq!T?*95Rc^T|W7X1rGZ@x&I`c1R5>O*;8wuh6Mk3^miC}@LEF6vI#3SHj$%>_^2y_ z`?qO~h~*{Wlt69HOD-zxI{MHkwO|U7at$y%LE?}%&Q0W9hA_O!DO5{S!i86Y%4~$U zqCl?1+N5irFVLF=z9kx|=p1iIQ>C^A@?dmTz^!P+Z=pUu*C5LHS1SWGe_)~-mb8vdjXUlmn_43i7s@$E^L zI6W?yC$FN-ZzP59ST{adk3B@fq@!(O(lU5CmOtm*iYQ(UMLEAH*`QCCeO^&NA0!zI zEh9SmZx1?;&YkyF!eq4?|I+vj zl#--6a?3phhuCeJO|)VF`zIcv3hj90O7%}_-ZTU-DzTos8JiC3gvf~uE54!UsUyRT zAJftM^!rH4xwQPuC`9nl2Zh~1P-R_Tl}3d`Wn zy;pb-+!-lX%k)tJ{w+K&G}rH-ViuLnXje^?tCD+2yQc_huiubOHMoKtsxs#uX(@x| z(rz6KAt}`VPusWT?ltuDXBB(+yeY_+`K8Ee(ugWEzyVUf2(}YKiA)g} z@!M^vY|!c1Ap%9WODVB0{i8aa!+-D$A$oha!S(NjRMvN5eOWgRJs z6i)91lS0YI13Cpn^T4Z`ohfFL0-xaPb7P?pKo3<3$t%E>^e}2%X=QeU-Q=kVzH<8Dhmr-!r zLm+SCGFWrx5!#7wSY^^R0#fg~KWQn60Zm%}oEKpxXzzTQQk?m9z+YF;iO4Ka`PH+8 zm(umXjXK*|*+306Z+bb&MQgqquyj}E`Iw=Suwb>v|3wA^G&GyEfg(xDRr13<0e=mZ zLVWQW82Q_p5}w}+ZgTSx6Ecq=5%VeAhO`cJ$?eKFFX=rnJMn7qN7y7f-n^?2+pvs8 zPdR;KH<|+b!^(sX1~ceJ;q%|=vjq6g-AfLdCL7?rT1yS>i{Icj;m(Yd&J5`3iJSM_ z`i<^8hPZMcPNB}2mp;$DcL4=03CF14FAynJwf_84DdKm{{vSo>9S`*X#Bn1#vbU`4 zJ+gVfZK=pCL}aG2M~bqtGqWRmCD|kL{$!WP%qnDL&#Z`k-`}72-`zd#p7*-@=NO4e z`+$bPCSXt)M42hEPyUj;0XWb>nNvj!;_i#C`u<>o&*KKUFKAGC=(WaZtZTkuLQQi$Dx$bBn=tOn=5ClF2Pk-F}FNxTByK2 zPsS=B3DbNFdD}lo!hz+wRWw42X;k%6^<`E32Zz@8E9D$mDkVnugMbv1&??+cJ+B2R zR`odR1r#8W{4k9hUM?6IDj_0*sfcu5qEV4M0{zOse=r`M3no;`8>wVpB1JMC3CZ1f zH1v$P!l~#bNY2o=3^5A>F-MLM{|={tNn*d$Y#0v)ahfH?kUfaIiFT%1GeJ&DgepT` z3cxl;xQ7?>0CIO=V=2o(tCAn+jB^t}wr8&)sdo_KQsMB3kdFp|r`mXML}8^Gc^_X`~IpZOd$AESX!b2YyD;8LpYc)zkXAeKM%#>-!82Qa84L& zPdXGbkC%iaDiYo=eHpR+3O9xZL4IgP8XDm!Obac#Kg)&flS7l|ds=lgim;3^lz7BJ z07}e}$Lb_gV{`A83hlo$K+9S7@8-#oz=L+1YB19cJRYw66td@t3T~R-S-9zrQlioX zyZMcg&;IRi8a1A%B3$p1 zt*nh^uYmjL3L|Oh4M|&I(a)o1uf&GJs+@@$DV*U3$3#krq&v*N(Qk4b^)22TTO%3 z9!fiGByN1Y29)XAnPsmo0+I)vs{twlKz6M6ucZ7TAf7n%kl^?O7U-XaCBg}Cd7d>A zm3#qLPt!@2qCO$Kd4bIC<4y2t`1#F`$3sXiy?0+}Y8?^1%1&LU`~ierZDZ?thCw2` zrv8nX9Z+&qe*jQFVCjY*HYEmtCR$25l-~o>7m&&);vQr)TdpdeHjOGs)LHL!ts^0v zNa{BY7*Jxn>!#WD2}t>{a^%V6{YNa>NR=t3!qWLJM0HbsFv`B{Jq-+Xy3(3U5V`vS}uCN6(YKaa&ecJ zmuP!|Iqzm;w;vg{3t|*&?AAcuVn$wn$PU7Ka3>u!N`UI{vy$7{`^dsqXS=kX3cFFk zrmdPbg`_KW@f!2n(T6r^3n8vZ{yxsT z<(}B*+@PbP`Ug;OH1t&MmOjSPlcTp|n+!=yOS9}grog5Lg$_HoEu~-mE zUQ|`ACv;BUn^7J_aQycsI1%^02pQ*z(9O5x{W zzgo3#@SjtMe`f5f-r^@h1}2v{O5A9uHcA%lAshr(d=oc+GKlH@r zb`%yJXOF9IRtY46ccd~WbHU^BKV5!~d7yg4v70xq7CfMlG^h8f0e(CO`L<1!Kudno zg_o}oaT;Bb2p|6l-2Z5+UV?8y&A_?GAVUFkWka8YfVR zR2R0FUn<6c7^h0~TfGSg?#!%R;(Uj;Ps%NNay}!kToqA*jR+LT)m8n6tOr@&BP}y( z%LTO6r*s;8gUDj=_(h&U3mB;&dypCN0X(RByn;~`g7i#&7l;8I@}W~HO&Q2sLNbxk}JX9wet%y^0la+_H>|Jz84$~eEo23uM>6b zy$YcBN8r`8t7&8x*f~eEfiJ2|Nn=?mPre5?(An zrCb09QI;KTYBhl0Q!3%7-+%G<=rlxL9RO>d^WCS~i>U3vP{R;^C;CP?K9#Ck3+h!* zg&GV;k&73%ckQE5V8(0MEBI*^uvljXC1#I;%vq*Oy1Hk`$6_zdW3dJme~iDGMfwXx z`uC1{T$lqXoY~;Z3k*3#^E(y^PJ&S0&VDM|9<-u;)h^3+6I5}}ePO!4f}$(RWBan# zkxW`JJ>SnR)H|%ry{kQrKF#XsG@EyzX15!|>`N!;o>Gho-qjzdzwULr=Q11lw+xYz2#bd~a=fSA;d@8Wi;8OTxP!0G+gro*VQ_#;u z4kGF|#fU+~FVqiD4^VvE(ieH1hV1e~Fuhv>v74 zQV?#gEMpG9p_O$OHw*#0_KG?wn}z6|-p+UKhG_8k8E4gncbTY_^6}1hjc7#6MKz`7 z9|TmxE*yA>ze3}e(cSOCQ3xkLbQU`)K=|ixZ#G{_MVAsT+-!WJ2!n`o@@X&eVdp0A zy(nGgfVbrDx2g|ILb`P(*&D@T*y+Y6o23(cIK5ePR7p&Sy)wuzdscLY?%rvaAUoYa z-10+{8U(D6Zew3r%=jW?Xk9-ZKF5Ov{O%&znYaM|$hJDPamYi*_Gb3m_+(Ja?L;F) zf(v85AgEIBN)6f6NN`u~odEkA&sgfLIIyL+HD{ksiJ_)hV&$^LCD@|<>4#^%2b9vp zb2~M8g2nzVKCEwe20yZePZ~E`V+)g3ci*V_LItw^tBk3>m@8rW4^5K_l<|1N)uZPaTg{nmVr5#Okrzf~BH;Y@8^rU-L~GTD7f*8RR%wP8kE zZMYpYDo|4pWpROY7S#b}HhfJV;Q&>$(sv-8t=|_xeHw!G1qM~yX(uUVfeu*A0 zUxoC%jx;#hcj4bu!{pmTme^6z>9?z_D1_lidHCa$alm_j9K2_~aA9Fq16)tG zX|dy5)0%1F^l)W*TU?!l8N0GVI7so22D9^)@2CRYnC`uA*UgiOpu1k_rLUTj*qE$U zotO|ORH-wezgEZ%+vNm7*$ELe{`gyRNmLvwqiH7zT_D3IyzvfFlrKR1BI^XdH3sZ? z+)M2+zd@vvV-}F?go9n4+PJVxLk$y`imk~szX7A4AJXPTeuH!Jj2GLjIWW&3Ppzbq zD6wP3mQzVa21tNwP$X{2iz(J{8M+*-bLv5-XB@Skqd?x*4dY7v%xp<_*wUFjlgE7j9A^m6}9`98jsz{M|9RX zw?5ltgW2M?s+}9j$bc}=QN=k6O@oEPX{UVjd{d&@nIIc|&=8O_Psl|iC!+Sf0Yj+o zTDOvUS}$0;WzaI!^98*3sf}VV>I7K@@}zv4wZPjWG#$?yLxY#%$W(Cpk-w)u11uOr z^9EE#X`R)G+f;q)WA6aiNO(2i$~X+{eCia_TbscrK|rSqmr+1_sVv5y10q_hZ=I{{cd}pI81? z41uY~Bqa{wyWlrx+Vg{eY2eZO4TrR32%H^%yQws}iW~+VNv8c)fojT+Cv$l}fymTd zjacF?V5dv}`@%Fr{)#rWyu@FT^Zr@d#+?Mjvd2AZOxK6R9?U(v{<#bpI_geF2rzbU^75P$2{+#l)#PT(s!!}m6%c#%h&d9f3Ow-KF) z=QpDgH6R(-P>T!{E#ow7DuJ1cJe%lfGwQ*S5eTB|Mv0@Vw}e%rK+0Idq2l9D$c|ic z@0NEO(7}~aup})(9r7*XOn~Df$&Qnqr9m1rdA8%d!~Nq3S6fpGR-%kPVGZ+kRRT z>bgdMI>=Uujy?z4x#;zwV_gD!R<{mxBwr=GhZBdi36kJGbqsh4|qC;U%#7p1V|G) zDqA$GQ6pXIl@o;ma97)~=<)hTL~*#R3IU>SiQ{65HFCczHwbY7L}KLt+g6>{-x z^pFF5W63^T1Qs88bCRDO0y~sT7kI*k`9#K4_zx1opbzdV4Nr-&`Hx$*ch1&9?NqC= ze-|azeDh+qx>6Z9_FN78R7{UuTn?C9AlU*H4|~>?yw=d8F#F(o1!h=bDk5@ml@Y6M z&BNhUTn7XTtOp4Jc$lvE&&65WGsI3uN~-Oqh0%O?a!^bs3vo?IpMdeZaGBg9J9 zI@s`qFgr4*E!4w2SYEh_J-LcksJFk8Dde1BBBn=NQzBR9)p>2wL>Ow%bB32u?|Ds zgi=cyoP}tdYfmh=TO7zFU7K+d$^h{KEiRKLHDH*kXY)N}3`$YTcI}yrMb-3nxeCmw zi2hpBwEsOjbcyD`G5yaQ^b9YDnx8Hm?6%wvG^WT0qSq9@PT^(&q51?_eP?&{B`&!) zalQ!1i$9%feh~ob_2Y+0m@0tTTL)&3)(~`W+PCIUbrv$e8Q4M`S%ex>2hW>?8o@;C z@UfscX*iPA;}tl=3HvEm#rUiwv2O|X&&po$LZ-n35n?t~82f57q=JMS4lBz34RTY5 z0`Zg2wXaBFxCtg9^kMQCb9A&{S06pJNh!W}_?Q?Qy)R~}cvA%?@nvMV-xi0_W+|U5 zXO*xC$*g6`0%`bW*;#&wS_xApyY@@1Lkcz}hqcgu(8d;uf$gE5DJIoS~KH@|%XlXVG+AK!Ap1l|5T6P%61 zM2e)^B5SP^eItKngDngWuf1GL>IL_`g6z+( zBwV0YGjX72g%8&NiV67J`SR}imv4;}-M|1DIAd&AKvqD=B%+Un4 z8*F=GPrlhGit;Q1=}w(|6Pqq@lheUcY`Y8Gikw!>dNB=7p7K-5&&;5Jwb*o)fC(V` zBpL7cS`FyVUwzYRIFHslEXQOdM}Z%u`43|6DP&93lAVGRi#{a9zI|r?8J!aH)V()o z0Iq3)Gp8dtKycRUY1-i^;K}U5)~0q*Ahz#&__Y$STd%D>HXZ_(=pw(|xZZ^Z*<-G1 z5FxN~WU!~^@C95YY#qDHuL83k+|Ro*d=pN*tI6kc;e*m*!b_MD#LgdU{SvZ}!+d32 zB+9xpuq6kXSwpA_*$w>*v@GVdwIvuLmj0YQliP;+v;|ea zbM%Av_7~evF7*J(8)P=79bZwtvJH3VRw*hzupc}ZQG@(?W*#<8{Qq8M=Z!H|fY@BS zx_rM%pmC(X5JVV&s4lE_DT{Vz!N z?5ME$Lk~)+%soh?2t-VDbfhw^?EwGA>wuux5hSvv+WynG3aE-kr?=gxLNZL+y@U6M z&}Too$0k?15#w4YZ|hklnw>Gxe)s_cym!PeR#!}*H(ISfd&UPq-sp`_#cq@6#QE&m z=O5!pCDBqSdf_X|h;4S&e%c4-XQ}Fw*1mw)D&C#1?rmUP))AWXc7hijs&UaTnn1(o zb<5y_|K<`7&B9H!F`!BB-1@ue8_Ie@Xucy=gIWw~v{ySefiB-cjl%;cFv%-~X0_JA zNsry5uYX_mi(Pxn$H3~>HLf#N9!N0x`(^Mb7c{$0G_lY~1qp>} z3B}d~k#9Lw@b8yuK*H4VI#s4MFkKbhU0W1F;S_U?E-Jc6Mv^a3Sn?twr+(=k(r*i1 zjV?WnDZd7sIqn$!D~Dh!-^Ik3M*&^xSWI3uS41PyH`7N(G!d&VFWr^!3qao6*!Q8h z5z>D=rX?{npSK`OO;p0>@D|lQ8kf@}-3QlVGu>aglp#iy zJOvl~WT3ZyW;Iau2XTwCrRD~1qZWHp<5>MQAbXIwy>YgTmNm(x>?405@wECnKfg>s zO&)I_PV*bEY6mlpC!WW;d@afalZL?9?|2n!&R?MHyT1wE96oj>RrYp++Bjn5ikhI; z+eT*L);l|`gi!jLF{RG80rat@n#V(T8}ael+?Nk+1-F7GT+WM*qHj|{o11H6z~m2I z;G>yl;7?lpRjW4!9Ep001Un6Z&nNMi14lP_o)I}`@u?r#{L@+-Bb!F6EDsOg6xN~i zvb$aPgyuj)i_5Yw;}~)q)s0das0X;s&Ie~77tmN2E+@ywVW6>phcr2*8B7j7hj6k@^%6|bmsq29LTKYO<{$pJ#Wp44qLt0G0@qf+f4fv7o(vg#!9P}VD2l4tc|;HFdd1&tsG@X0fh zLc9e5u)-nY@n-c1(y%Ggrg~m-YUggGoogjv}g-?i>qjri=a>XiJ8r zu5egQXpI22D%U{j01}^m3sq@H1LVeK==&t1<2*C;pr|;4X0Y`U$9q|fE~i$k5(=e0z!#m zn@Gb-u$TEgk|Zn?$ek~xr=D&_$1i(LHrY~9eZ9ZZbEj&AWEQ(=T-wmxkZ8jjR3)fA zBV(90d;tCU^Ha%lp&W1ql}Rb~6oBhQ_6CU)-N5HX#=P*#Q&8RiGeIV+3E5ujO>{S| z171(s4_6#(P+zo@b_q`gI8g}Q6jkU%%zvvd9@4x5Q?VpE-z?gIq=lcfBkeZulxPa| zymNp$=c@DXOr(MXp}%kIcaxEh`M5-k)Ee?N7Q@e5?guRy3;tizc0t6$`d1AHcv#5# zvwf`)Tx_@Ik#)P+4#>{nZ(D1eMUO{T#ny&*5J}RbJsbjjIQ1xDf9K9J63JVOeiL*I z?tL0Khhuew+EXlQ2aFaG*YRvr*D4;2N^P1c3s?tFnRaY#xVnM7OWZV-dIC_{thQ2R z6@+E!=h~Te|A3@N9H01ExiFQBWjKksJ7~<<{f9>g3nnsm>T-*JA2 zQp*#k=(KE)=cOnG{F)Ybg@%Fy>%ZdCl|r=$CO-Mk=blkuB<4!dpZSl`z`{pv)ocn( zGUHZH7d;1dc}`|-vVj@Xl@Ckr5_)SqO#tU#=qR5h zo&m4hVgX!FyurXV+wiITwm_QL8RT8P2jn?t`CleL1P=@?xwf6r^paBT2Zbl7U?bF^ zE9*WA=LlBa9<@Qg$lv>2ueAUt4i24^qBdwl|E%j%ixt>CVQ0AbE(8p&DNZ!A+93aT znXN?pe&APxpr*a1KDg^S$e@($hwv_)_et8YN3|KTAAU331r9eV#mzIE(e9mMDwRZg zP#$osE?T6BZYbb71f{9NS!R>l-Z5&}pu`aQOoH3ypFnW!)vzX{`VG);o$3q zh6gPG(s9P$^w++Qh1i!}oFvnQ9m^$zPZbrgI}%j3viRzd2e8USAbafZNT|>gUIVx? z&|XSk$PbHFzsubl7RMGyXa_mAAXZ;#uadTZgmOH)q?VeLA>OSU#E<+1;9wGWfa5D1 z%t_PHE1HTCQin6te~{sW!H(36_le1|$6%lW_vU3tmUIxz!4EOMZuqh}oEuZ`7P0(U zb%6Gt@Y#RwTu1$tqSQbB$zbQNJR_k`<$|ls<+ubB7ciwQin@pzVYq2zSf+64Jmy2S z8a^QavA|NjZ(;mgm_lvc?L;Ys|Cqz}^gcxeQs*I&=j5zLt%0xX^n*VDF9&D6o-1F` zp!(X-r&}26)_3-ZDy~F!l}XO)t#8rzd(+Dz9ev>Oyt+H7?H9xols$TP=q;e@%*=5g zXal@=>0K@icOemcdfB-f)2Kali5i^|d`1Z(BYb5#|4Iz3VU&jz|>(OIc0tAOew1Tik$P zgey(F{GcEh=@U}nHqIua&h)qMl5Yiqg#G=WIio3vdT>)mvo`~Ao&*-G%=6P2)Z9{j43;-q$C~2<`=vDerY0Q+mOQ>gUlYjVvUd zZu0s+hM)(NzwyXZCR!JA&3((QdqG6Xcl%o9FTgV80~t+V4|>0#bdZ%&1YS$HhHb65 zq01Ml7A&;Y_QM&jmOb$&~RI zt^jJRf9J#e&^XR&56e)K30Xw<3c4G*J^7W;>w9bh`7sAtQ{G zZpA;{#>aL@HwldG=&>PZ73Z|S6qr}I#7=&|KA^JYP+UBiLD#2sY8!M}FvPsX+tGA_ z4lXI}=5?}Q;uNAU1E12vlg~zwmI@aO`*m@Xhl2^TWt`X5C&b0*68grpx#+P}3K!I?dgs)AUj!Ooy@4A(Ck!#8P@LEmS}dF}J(_Ru5?pH{(2SiBfyBAD zboMEkFm-$x?`l37csC{?Q6oVPb0y9*QVpZUXtcH`$CP2C}p#0Ry@i~Z})|s#-A&FgY^|cjckjFHurQ4i|gfOzD58+~3 z7so!4ZlkN8>r`ZasFdDUe5X>+$TkXG+FRS(8d`7X)u@Pxmy7Wey0`k5)W;^`RkhB? z28ZZd)U@X2Gj*IMe`%d*6g&_mutsfc$F}(@4rp`Q=kRL%cI$a%#^(n56v+Fk*(m!L zL(u$fpIM~H7FAU#W&SQ#2e+v0*MAzwf^)^g4_@r3fz6KHVhZ;gh(J<$arV#64K0i@R!o?;j!gbfP6%iAaAw_)HyPZ*mi>>unI- z*XP%NEI6TAHgUz5E!Jq)7BptOu?Ke^>FAFR<${5)wue`GVi2o-T!*iX7GjUMa5Jp7 z3Yjlf-ieScLcuZ*Kl#MugYWO(Vkq7o5LQlymZT(rc)X|4yvK2fmiNyOoWy#NF_cxX zLY9r{>4mS~l&l877(mqhk|Gq;Wpur9H4mu%{a4~R`vT~T!-w5k&A=uso353#5Y(6V zS>B1v2MN#dZRryW(D}f-{%ejopvGvBIVUz7J^077CfaKTm>Z4@zPz}DhBHIX;l|qn zL8rRhZcAMdOFIxpYGa7f-0m67Gns(#6c+VY(iR|}!g|F2n+M3Ublt<7mjWwiE&nzE$}g|s3r2TMDCY-$~dnGAp>_3|KwcvWy}?y#axr{{3gNCKT`JR<+~=oVPmcrUXT>INkA$;wqfY9akw z4K?7UEYeX9Y%%Q-1Lw%kQ5J`rf%Ed><9F>GQPg?mv0&eapddYpqD$Wp)m(0~xMXLF zmb$HEs`%Xjg}H(o-~3tYc7)~g-g~xy>BTRP{_X3)zjx!cXQ43|c76Kc+uPenIm55T zXTlk&cuY2mESMvog`RwwD^f_ZWoWZ)*cN$FJhk?7umT^<^c8Os+yN9?p}ORHsi^hH z;}bJ^6$*SJPN_B}6=>FQvB&-XM?q`bvdv{{Ob zQ|>nF|1Ae+ETm_08!v&2*MpLK3WX>`#9L%ECkf3zY?>x@O9H=ys5CC%lp+#`vF>z^ zNbpUDxkHgN1(ZoT{!5I01Kh%Q(;8LXz`<#t%j-KO2&-02zY_fpnFvn>7%t}`!`I&h z9j*-kCYo<-yJ!dKGpL;;x_ts)g)X;h&g}yHKpui%oK+BKyydrn4WV11J+}tPw?J); z(d4hqLnJj^L@#|Xjk4SIURrF;0)pe7c;T2y0w}N!vnQM0kYd|2rzODDIcVMqk=JIOBYf$@W zgU9YoF>>YvCrVLqK<1MgCy7S`Qar1yDNOc4VIpt${2zp(*z3Ta?^XrE^GS?ISIGo) zr&F?$IsfT=<6ld84h6{L{`*8>sX}B-;VZsZRDv1_ZpCI1Rv~W?GahE0i@rV=|2uB@ z9(i!z!h1Vjiw4&N?~?h(B75(=pRG=XAT7cdf07jc5GRv!3ZRf2cvzrOarpx#ju91n!# zPH$#8r-A{Kz0o+XS4j841HVzH1hmmDZu;}U6%lPWSvxkRf#aYILxzDuM8+<(vHK?l zRM`$zK0Yf&4)XPP@+@Bh@nz!ftqZSFQx)0zNm&l^%vZ^Nl<9)_JgwEPynBaYXWnjp z6SG1>=Q(M3V_yJ1-wXfLpQV8tEc)_~_UllObd8dIM>!y^lXU2uaRVL)6|@7dHIYT_ zld!+zq=4!iql25dYkM9hj;lvuzf8-Y>Wrx#%4R&f7b*TL?U0bIm&>vZ+^c- z+O$!GZ`$uW-h7}j;jLHy__0bhmkV?Ghkcc>ZdKFcT}>b(W2=A7L>-WbSRC^LF(3%)XGRgi<5=9NaMh2#f!RP=qjzz?#&c;fvLi0x78&>OEb zbfbx^qQSHZ(SFgNO;8&IBkD_X#vi|;%-`f&Ih8#~b4B2+rFH;_j#-;HsMR5Ht^jNC zfA5k0ilp7M@h_-6lOLYn8$izYqQ0@lGy%LPZ!a6atVTH=k*s%b)*#QDW@dvwJ|kD% zx3tO++kvF+cag=xJK(lmY~M-^l_CVqMb5KglGQa8g-gUxN5Q%R(Ne;{$B9YQWh{_mHaWc~ zjS4QSyfm-C=Z4A>51pbTC}E-FJ(2FjLi8t|HJA4M5%`rRN$n3Au!wY2+dQ>1X zxKDvip8O1<6lR3OZ`5!eO5$UJ#gQzxDE^|#e|~z4ga>HnyD^Wh`w;lE(HHmiiW@TR zId?i-ngIx#yc`;2!a>-GBF>E66=WAt)flM%6q(xDR)AG6v_oE=`sY8+S2v%D6Ud~Y zC&DLxB;zvynR|ysh*&5v$eYswjZuh3Y2Z|dgc#|#+r9eI=rln*=_KZ)jd`COD5~n2R7rdMO zj?$-I2QAx(L$%r~3ej;|SZ`SQG}B*3I8bUdyeeXj+3N4pjW5Z;x0$K9BmzPh|GpJz zOzJu8_PL<3(x-x0)7aqA7~ww1Ir{$WO}YkbXeKg$eMJ&u#y{%*MY#>&?)`zJ1Zp^C z273~&F>Bpcan$hcMY<)? zux-HoosNdrg$Zkcwr?aH-vHBeDi6h;*Ff~&;dR1wsU<3U`d#bm>+3J1|EX~!d!3B-eMn3$KwukkA2fghPMRFo5ajqQZ7bC zNoW6fB8pKLsb1=`bQStDNa$g8vmVsPCl_w2)d6A+wy%pX;=wBo!KjF#HuTrEza%3t z0tG5=m|t#q36!pTx;@P<0?mxErGl@10E5|THKEu+#LxRrnkS?hrBRNSiENgGScBfK zovViESl1@YP+$byU#D+YI2k|*Ill`7AN7KMXx=SU`5t6TwmtJH9Y%EcEY^b8zM-~= z=8Kkj#egMm@mA_k3lcmIeC?Lo0xI~}S$b-dP=LYHMw;dcATbn8D5X;fJ_p4;+)7SC z+_ziFM?OuW(ulsmIQCYAbN`tulSLD6@uHvO{4@bN|F13C-s-h8GyqnHO$50C89aIsYW@J101A|#a3thZxX8r4G3$;;#nI8#{cSnuZ!i<7lX@=d zy8mD}h_wJYM+A5hQrt)L_&6L*(q1T^a-qUHwiR@SPDphT4Wo;S%x&&H-C(EBYLZy` zA6oHhKiDH#MscnWrSZ}~B8&c}f6B9~z-z6O`H}Z;M3EFOR(t~=JNl;Q?2lHEX*v@F zmGy7nHrNp(+VUIlURd`%^7@B%WLUV$6#5Z+;Y)@{&|z|W)W`-S5+eI77$(}x1_sr1eTV)g>F(Gf+3IOyMr(0z;&s;g}*cWP;!E~gUEv! zcGl%F;DzAAxsw16hYU(=2;zUAl3YYr#dX~;Rq|mjeri@NQKZoKgwN`Y_#WDu-72~K zlL~sYQ;VIrGGUX$`yvKQ|A2x)vL59W8EkVom@7|N1X>q6j<$_1VvVULW>ghS@YBp^ z6A~jzSk71FIqF1?(eiB*kabZ)QA#Nn0d5{F>0EZff!;W}M}NuaF&{6?YGRiConHr( zEk}*30|x*_U9)|_n<`{QFw-2R9zErQYq|LXCF|@Z7Wpz&VAn?^IpG$YzY05qGT zZRUQ0u9^ga4$o$AyNLGJmP`sb)yX>}sa!+hUV~wc@_it&$k#-V@gqtS>%6R|(uU@! zB4}v1W3iqtPqMXZK3D~DZO%i!R7{@ZJI#BANX(9lDqT882=XU)Xug}f4*lenO()YH z!pujddyG^mSdi;wArbBnY|SIrErvG$zAP91p)C*vy*1k|=;A(yl2RlmoBrYOYo3+C z?!YtbTt|qse2^QwA)l$JSeb@>|8p->H#-!&KcW8Gk~0t6dgPxXryT)xPk;Gu1SMd) z1y>`9(p|84ftI6nClS~*WZ-MCE(H5qg0Hn%%E47G;oPq_02{|_BCPYTV+Y0`|2D}j zAmJ-Z$&3AraK!%6R=v@6c=0vMic%>DwjzLtyF~dhQm%)<;|noXT26OP*@_A~8kZON zd%_68f$7E9d-K47IOYAtMr|m7R~f$@tbr-u;);Hmk;Xm*7Bz$t$-=i1|I~aROJeMK zlb6NtL@|-1A2>Bs>ewhbE0Oy{cVzmcTCR1-2Hn3(o8~TLiN4_^#p_r(p*b=9&3C=d zXlD@{zsli*@PzOr1CuR)LwAaqGKnal&hxLG`ltwyl>QceAy-AiC>ne_WSZT4u4+kov2<#ST_rdGNq;43IsKXvhhP!^kxl`7W6g z6Hy^~IP>TjbPIj|{w0eUvhQr={>(iDu{zJGbF1e;w)K{^+yXP^q>`(9Ayp23zarD# z<4uW;8AM9w0wt{BwpHSgk2Ksh@l|OnyMV1dX7XiuQUKONV@Sum+QE)oDwUZ+A$a*6 zqg{+>21k3n-$*2$f#5gg8)DBtpj(QaIbGfb=%WXD-#^zlV2T=LaSYp$??UX7n?M|B zYa^OzeN_QS9ur@E{rSJuwd&zl;j?7$TlqB=H)SCpJqV}%x?TsEszaKWdKy7F{@ayO z=_)WLgLl|#7Xy0e?gs@lGyq*Pfpm`PS|IJ@2U5smP}QVlA1IweTVDfXKZfB!4I5^+ zihf)eCdPGgB1eVYPU5fFcut2czFJB*w4%iV@}HkSGsnlw;+^P*ln+3J%rkpi$|G<) zXG&j9n-`jwUU&v4Mt^ODoJgiVjxV?;e2@@Fv z*6kqvbmgCUK~wlNry=Kpf(ADELPNew!T^RhCcbX-+5<-ncW}sv^x%le_@GIzDtvyI zaus!GV|XTWi;6Rh(7P%>Gb~*agHN?CAyGAWnsP=Dy>7vd5}QWLpK4HRS>imNq%ziI z8Z*%vtbpx*F@E`JR}s^rq41wFFvoB^1?a9{;l@6e$vPc=P=z#a9BHL(EwD=z&xGH5 zXbe9aP?>^4{H|GftZ$@PeEWdpEF!C&r@Nj}6H@y^-| z*1fTo1McKiVGDS2loRya(;dpP$HZ~**}_!<4x4`;JuuUIVd4)dgWxZk0NdIVX?TG` zljWgAD3tcF9(X7ofo;?;-YP5ihRc_Wgx#(`#O^5x*Y6v#!sLnoHXTZT$PP(AZr-+r z7q?z`(0%a0uDcxT4qpv~|9r2%5iP~T@HREwbzJG;`Ow{f7g@g%!P&j!y{?Kc5* z7m}7vCC5xPZv<1^BEjDMwR&Lr@gnS-nYrIWauMTf_TVXypvQ#nNbl0b?g0&Ie;JBb zY}ne*j{WbSHbKGS;j4RoB$y?sSmTRlr|2lE>FU$p1}O7;aFNSW1c=z$bFjg=i+G5c zDV>ykP(F$;u-EkgY?CutK@rN}ZRWKqS$%zwM+FM@xjoUg{uW%4vqd{eTb`fQoPZ(2 z3tqgB!6;T+^|9Z}2WUE<_E#qe23H;k)wR-kp$n?CVytoxkW2oP#xMBxs34!0l4Uvs zv=zVe^dblXrlth$*dv-83@{W)Yu_ZjVE9K43mc;<^w8*VpAuN1|^2g$uJtnVbp^<$Xz;}w! zJBdgR`#^1AF59aMA6RCleZjNDydGnpGupLaxoAO}zK1NVv74~CVrCAt0*f2s%?+@J zvh1Lf%NRx)3cPq$W(ijV=vQ{<#Ib{0a{IJ>CfJ#?_Q&Hj6G-soykn1x7&iUkX8Ozn z1$b40n|Z@#0?pI#8>V$%gw!@?Z~Kro{Gocn$wSTuH@(GqmagltcnJ+4ARb(ej9SyrM~Gh5M5 z>f+FkK^iCbtYk1$V?3YDng^Dfo(b6)RUw@gFFc&ALd5-hi&@>P3k*;vu+DHrgW;>2 zyh5KpqIlv;ymJ$=z`7x>&4r~F1^X}S7CjFFHm^?~l9oIIPBg;vPMWzu8!zah??EHj z6HVrRw#A&`$kdlrMO_<=j1S4;Z@LS^E4W~G#(S7c!+9@qe7rMkzEzn9wKpB_{0ykTk2`7r=4`l)OHVN!p%+4;RykUQCq$d=f%8 zM>%|WFEF!B%l$WMnC2H-5g@@FDxCvqJk}834OgKTjPr=jHQ-T*F)=1i6uat+i-UPI z)8cDY{z9Y^cJpGU!9YV!P%!OxGPoLK9TgfJfiUj6Ka&CfrM%TDUYX)4c>fB=FL2i% z{F|GqsK(NPp?zw5*PajRn^7C<~Otf2d}>7zn;@bI`H5 zWT3r&!u&Ks`5=D_XN!G82F%ks4<5}Yf-f4x)3V{di1x)!<$$F)y0;x-cuh(feJ4rS z8LC$W)u)ubPb0jLD>Q3!-nB=&Ki~zna9iN7meJWN;Mv+Zta;pmI7;g z*P3tQxufvV;{EI;4lvIl-)P07j1tsam?|jzz?+x-i|gmS!AlCg)O(A{=$-B3Wi0M4 zP`NOz9r)V>)d=0FN|U>XD5xK4yihSms#TA&XZh@qsfxqw%i4#4F5H!%gxnjvxJS{o zQtgYLXNbxvh})p*%ZqzP+}E zOXs0&J-AcsG{7WNfz&=w6p!V61oV-mL=}1%7*t3TO`Cs-&aKA2BYWk6E|}Vk^1MOd z8se`xm3jt1pgz6Kvk&ObkZR_ql|t~K{=RTNV;0g)KD(iTTaAjdmvH;a3qj=d3oAlw zpAinvF_WR5H88)gBAyx*fa2f(WM&(w0#jUOauxIp*y`299(GG|sI21Z#p*hXvOh90 z(L6o|FK}?rwHaQ-wy`qmM}joixyfA07g9u6kO>s|2pzMUk*3xew`_xSA$)8drxmy^dNhy`TL!8qWJWOTl4qK4WSKd zc9c4uG;X>)`sLmUMOafYVwrtI3if%BCVT!+!B2T_kEUA@;vOy>`cF(7Zpwdh`+SEB zdbsGzKNvNHhoTH*x6T^knc=#tWds ze3zldE(;i`{W{p+u0k0k(}ht%AHaZXT-b(LF3_itjqi8*fyzRS7AZ@^z$|0#@jH*+ z1IS=Qbud(mCgNTcj_hZlcuu$SA;-@EBzy_;Ev-fhODElpq%rUmSbV0u{~G;ja*TTS zz5*pE(9lG)#et4eC-TQOq(l6We|MhDuIrSo{ zjkgFSPgwvpT~w4)3p*&;XE}yplnPt&9`n(WtU{!gB(mY3ZJsfpw*@KA*w^C@y#Dn*|)6uFj|?L|I5ekrCbxwMK4sUa zs{KI-ALM?B%P;6bQb~4PSoRQ@wy0?yurWY4fpMCoaz?y%%eeg1>^eGYQTUoLss~WL zpmmky*aVAlcZ_X9h4Aqse?!sN{Xq7IWyX*>4L)W$>>1%sik*CK?(gahBT?bY@)_ck zID(vTXwRPz=Z5dGC|;$)lO7hbyRj>vGnZAj{=fhyZ_Mw}g>%A?m7P3CcQIVcGP6ml zYJsuUOuxG$UY_-|M^M2}PAv5A>tmpvk;?Syq@h?0xDT{;}2u52tk0 zZ>!2;-`pp)J^xJcb)Wjx%6?WnyT>Lo*`$K6o~Bu9%eny%;)A?XI02j^xot0)ZH+}Y zpXxT8amPCRhixSC9#BSgOS1I;z`h}!bD4c;2)*Zfqk%6oTdADNXF-7P4NSDXvY~$xHaP48c#b3D!}&x zwLTq0crK5R2V0;%}W$eE{XkVoflB;|6)S^=N0 zI?TdJ>!|eY^~_|-A>h`bqQvStgMQv6*EX0vK(?<{e9ln64ds=P;z~J z9#zn}n7cWSAywxr|CGpe@WxE{Qg;3tSf;sJdDm_Ugrv}xe7sW&%A6nluH9V(&*SqK z%wkqis+m8#QtCF4F&7g*Cou;&SkJvm&L)H#L5YN7msXI15;&Nnp9U8nIGmq-w1N6Z zU!MpZ`G@jJw|!)0meIO>?z0i%LGY(rY%GGM7=@7~g!x|`1V3JoxLwnn1f@$Kh-}=Z zkX##~s90(b8cTU?_gkF=T5K!(ri^_9fA&R#RHv5FIJvGgnqNkv*No1E5_E(5VmXQI z@f@V3a3-GR_%7HcwR+^sSq&1X+`s#T$DzY-PB(w?RH8RR%6prBg~{^K`d(B>9v8fE;WA_qc8BTP z+AlQ49{3zdl_6W+x)gk}8kGJc{Mq>=4dhOJr_9ykz|ODVtK6^@h7~<@y!S;oVdCwA zV3Kpo;A6J)#TsHdNI2`gtKH9so!g8%PT8MZa8oYEt3bg0p;~_A36Ns!P#1+_tFQ5;Wt_0U!<}afBg-HlpfiRb5Fsp3pWmWDi$!cXTqTbP;c3D%Y&{~2pr~OoeUf_- z1ZifTE~22p(a8*kzU7CYT>pDQ&d~z6Y|)>^(zk}%FY4`8yj(&+deL$0^bB|z`c`TE zc0c$gwW^<+n+$Z54gE|j`jF&oU;T*UB)I)g^j(kK0NATJM_jnDgqBtdj6~Fy(SpIJ zrz?-9!IMA790Nbhf*=YH`PkC(rmR=-{jqWHg zH$L@FWF`kxsA?C9CjLPxQ`U6JDp4pn3x&@;8v^Lt-HpiP33PK#{UndK8_-#+ld`4v zK(sH(fAW1d0)MS*{L}*6(7nm|mhD|z;5J`-&5P9=yf*XpzAbqZ-HzOqVaa%e{O{Oq z)T_#)a>j%F@5V0ZUz>6?>xex#=lxs{JaGa~efFbYCEP{+bm37k%T6Gm^3S!=qF|)+ zcH~k}#Zz$Cy#KIn+5;R9U4OV`=Li_Nn94^J+`&-1DSbn+D_UM?=-np2i4F~phkU+C zRJHArs5;q0Q)Rctopn-=O{FB5#im?f3+H*~)QO6)tML63_*K4<0$;ZT6-@-MLb-aq z!}(BxD*sb7rf&pERr(Hczs!an!0!iDdCKnOD%XONuG-ksR|RRC3#UD&Rx#xNP8;xS z8DDx9Q1o1E7B{Eef6NiI16v;+CG8ngRSm6O7>!_~ue#{$?@uN{Ri!9)jE9wlxym5q z?CB)NGgUH4&ju+YR#1Mlg|zDyHJ zyDov%3+pxhwu(c&@fJ@16Z}}NFpS~886mtNyCQMMMgddgee%qVlZGJ-Odo%3YyqyN zOtP*@R=DfH^_wwI2)h#MGX=-q!9BzYZJLVb;r??&rH^txn1!_`OmH|5u5bw_-qbaP z3RyN<{e*Yn{>As>W^EA$i9L6XP!_PvgQ`JAHW(5q|fqp6O=_F?q5S5 z_hL)Ymzks9?6f?@^=F6Wh1++aXXs#>I#P|o|K*vUHSvXs70u3#rvflu`FTOp>o%mS zDZO_k+6C69UFd4p2Jjc)COKQFk7eFlf9OcDgJKHB8O*Pppn+uU4(W-z805R%$Tif) zkCi-IJnvt_jdk|lZix9|wQ1U|q)k^`q1N!5U*7?fwS0cIbKDckKNJleaxue$Q%9wz zdpw{xo$8cJjxA0KVb3?qxr3wMT0LqIc81Qss+8u;Ju%nI*zG>kMo@oFcVV5f07Ohs zogMxA4Fnte+~%d}M;`R09ySjO5b-@ymV$_{s3%pl;`V_fcvWLXG1!rV6#Q>npGofl zuZgsud`&7sO!RS|dawHed}8oKaZf&Y!jw=LS`i2ubrZf7lvjd)GqwbRthvCV<9xX& z@kb=0d6txgF%rBXxnve9{|lYJKupiJ{}QFLE?z0oZvef#zqibUNUK{W}f%p9U_uXId!Y?;Z6wTe|$9z(m6F)K}F`=>?gR{vw z+`$v3RTp~}Dl@0vV;bdvI)i$(kL5Wbb+bb7f&&+n2KPce@C;rvQ2C_Y-Qj$C0^H_cxWBgW!OOt+~SZ49zNUCg)YbxmJJwAA@sky z7(|x=5|kEmsj>?lG@f+N@y7qpAv?+O8hZ$;6G;zuX%xr~!b;2TurbG?s5afU`O z@zZr?%o~EobqLSm=F8>1XLmNyymq$hKMo-*-z&lj=Q#RZ51Y=H|(u zw$fv3^#yv!;L(2al5!a$(z;(zclj*#OKz`EW8lZWKY6*zRTyyFUuLl~ZBfW862`;9 zbqpq4{7kq#GL9S@j#~5Xa>77ShEQn6hTCa`Xq#Lm;W6QGg?IU^P2dz60eQV)H+rw-da~HM3zgH$Oa5NY2bavLa-=$H zK%CW6n)|G6K;&Psm)@y*FwiF|cwIOP&|5u}_ZrJXHPb-mNY}1VJDn=X~8W(^RxxX}MF)oC@6Ta}{6oP6mXm5etDtPf;3$^5eJU zF+hH~L~@_=D?0gWZbvOJ0i=!uFdnDM1XqspbnDlIp(D}K-kU>FNM1kW_J9)#h3GC)65!nRg{V4PCzI*fFA9jEe7$UATWD2QWEa>t*=ApQy;-(qQF! z@LPh8f@Z`8sDD4zth7^(6#8Q%N;i^_Ohyq`G*=<=2%O0Al7E64!zo(HJ#zqsi63Q# z906|H=$DH)!vk*_RM&n`qQ&fj2C*V`q%eS6KAEy$9mJ&Dpc*$a_|31yP3dzH(0N-I zWurxoITBK<1Wx`%*~A8EX3?T}jqaOJn9kwgdKqI7t`HssLtVR@4i(t2_D>$bXA%`gcsjQd?Std&*ClaSe;*n2jKeTT8VD! z7Mgz@98GgZ5TAxY3(=~7(AV693)b&taW_xMUV6PCj$YLtGikkmzne!)-lb%LZE0ik zg=^~AZ8>KqKt%^SeAf+nlq3c9GL}?)jx)oKyr@hsdqsS)#BnQ~SPiOIId+tAKxldN z_Qh%(gp2o|IuUy5;iAizUm5;?kMvo$T`ux)LXVG)w4<(^FjRWp9(zi`f*0M)w;K;Y z-u<=prJ-GL#8+`ID6|sL&m2}}xTYdrcYZs~9~EFrPFTgBrx}INhF6X}YX%ZqC06cw zg~*NId3Q=bA3oCXlZU!SLE#eSfw-25$TY2nl@RAmv`gy2JEZ_~( z%WGFV?%u}+6v5AwoxGs%m098at6tc~@`wD7FcUnQx#8z0>IsMLjL*=%dFL5Wm5k`c;Y(v@<7$~+*@NL zRH?R_#CHdre{O%ZYr+n^8;sOTi1I|$EC#Q;bFZTVC$0MrraaL?zj(%#ygOh<&ok?~ z{0-FG*m6I&+z328VLMk9}t z*_qGT0>SS`N>xNR5VLJ=cwDL{*lB)p`z5goD02`vnWuIUWa|c8?<~kesjt8P{={2~ z-e%?Iig|nnO2PBFg+)2QBbUP?Rwp0XR~48qlqI9knpr6&+FTG8asIRKk1X*01m$U4 zub+r{zmitOy$02}ZArQ<6`_n29`Dh-FX+0}T)tDqT|^jm{hB!)Ml~}I7uOookkU+? z-GTlC@dGnQUHYKU3I(#7G>;KX%jP5wk&=Do=~JyM0i~snZ#c9)#ex|`=g&s`kg^l)loGxvx-f=L z@@j}w@H7ER>*!oN<{98E(>K<#`xjtXPj|1C7{5B%XR21e0=DmaGYnGv-&fdnW`V{s z`qqA&cjMg%Pz?l8rw&F@<-}Ix^!y({Ty8`V-q{Um7U;*sjE=yP@wxDgjeNjRa<+uN zJsCWCtyGfhI0cLq^S7HV4uDXYHS59U4HR z#0Y*BZyHAn^8PcHGu`0qV(Xm?@+II#<5~uPRx;w;rL>s2UJJ4&qnrmNr+{d6=8cK} zJ*JzWl=HsDAn*&1-K43g2JRk8G!#Du5M_ZhA?M>-px?i9F{`s09p=^>S#K5rQg5pC zPqxh>#mbo7ujF&Xf-t>}eaN&%mB zsS@l7dQqst(ZWDd4Is_?6>(?lJLq5$`#U*U1S0+7mb-JR(daZEBbh=gV2~GlFfUmI z+`>;(ti7%QQ+tC(K@N$45ZO_7&2^)2k9*%c9?;-*0m`q*gQI|ZtB&?n?mF@u67UV- zB*L1)&JWt2?Sb=lobBeDJ19b_TD`jJ($2nxTBS`uaK=1X7taTb^J^$=z9^(McpDtr3Asn`kwM{- zt|*TFO)y_)JJB?`1#D(I!qsw#@Ej}lU)LQ4$5Yh39tUy3f4x>4jsZg0h5KV(Q5X@N zKP5$*ds!8q-|-3w_;ws}3lgp5q)=cd^|#0V){4Uhmv@#cLmIEujZH?)P zI)^8kg_)}O8R0jU1KVQ`qVV>^a^cw^NqF&;qTIiOdN8#)5UbTGfqU16Mhg7dpe9FI z><0=i=#|7zrr$RYyd5btgfDNRj`Jx(YwKLtUPNH7o9HK^+4nb)8H$475v}(xpE4Ze zR{wn6HVvn+O``tm-*Na*e94a?9VqLo>p`a%gwt{bwIs%0!-AukzSZE5P|~#i!u_Tg zD8kUhXL6$!tMQdg&pgkDCS@vN$Ak)T0|SkEklh1l_$b)^)iDGUUfS8%(MLn~s{?)~ ze%*mUj#k6(dotdSHy9wu3Wbj%Php*N#n7_X_Tq7h7&vVnU2yev8qQ0X5-<7ckIm{@ zAO0XRgukRJ&hH93;cG^KNHFpld`^G*;+T*f7Qd2qE;!*ed{K8BJ{oz9Wj%k7|32x3 zz39enR$P7wJKmG%C&avl>e9mfGJhXquhKH_aRGnGOtzldKjIJ9J(sj}8Xm#Iqse6Y zndk7b)}GIUh(&Sw7=D3_f9l+6`10F;qm~63HoClTt`U6}k1wD%nKN6! z)mclS!;%sQ&YeHp&SAtcjhd$_Dh~lyd3>A}6&chSzsYh=j2&;M1(c@KP9v2rOFfwj zq%gHmvJ@)Q!nsG5wzi2U@Dq~Y#x{pj@Ki$vquCS#)_TXsmfcH^uU6EtlQnMuu3U-R z+zJ2ZgGI}c01zSO&wm*Nw2aW_(l|yPqpRRItNlQGuQN)kUY~rSsRAO@OR!3$6SB}B zGYv4;1_RmKPou)Fp_-5;QY~L?#72^-D^+I&lwDa>zq5$|Lh|3y)O}iLwrrxDaorIN zEnT{yI%f$+hrTP^mT&=Pe2qi$j}*b%rw&5m{1=c?r%C(BC290q`5Aba#s|XqW1ce{ z*`XlmU^T*PmLP!W^NPlbh$*!{!Bz6}6G0RLt7jKTdru$e12I^n$-MN>6I(*_JEva+B z?w@j<>g#zZ$gvEgtOB64KV0RpR|T5;xb}!dQxRF!!&TnJbfk5vG+l!s9?_iFyJ!;{ z3MzW@``vca!MuxFM1A2SBy)N%=~zNKI)3iqbw!TPK;%bQbRkD5kWz78QVVJTtz%-< z3Q3(vsEz!JdQ~4fZ%oVd$}bz(u{`-^`f3D4d*(DfB&!By$0~H>h0{?(*mjCqU?ZT5 zQ!g%}Nk(IlVU1$71E@RexydF$BTDr+&^m73h`3|l22onoqUa@-^S+@CU~9BOQk|&| z8S&NeU;a0aHi;$}d$@*B0#gRv=v_qi>=KI)uHA71dr`x}~baUAQpQ){} zal7S!PZqLm`Cq<+A5I&`Wg0$#ry_DQBJe%<>9D%k`0q1l$*HDTuV@FG&6-fu18!(^ zYlq%=%N~2b$SBQzbQ{h`ED%)N>p_N$g4#@SL#Tf@X8CjRIedXYNNuE$4QgNY;S6Yb*a387i#sbf~Rqga;0eg%TMYK}aImR2jx14V7uW zOMCq9Up~Kh=iDr5acyjr%H3LCe4TVp_O2`^exEmuCN7F&Qxi$rN}iX%FO#FWP4Ep+ zlQzlZ8F~je))$s~#y%rM=D|W5?=&Dx?R!%u(j7F|CSJ30)9c5E_h0}G|f^+7EVwwm3pxAn&q;)(Q95!0YO7h(TKM6l5eKt=-`rCW5 z!|Pws6*lj=B9si`9vmJ#8h;K{2?hh}KDN(m#1gj=!T|CZa?A1~aNR@2#`x0)Pu{$FU3MiK4I`{a|FWQBapEJy5Z@iA?D-YwoG#{692rN6XMSDL(MbWpuS7U1>uZs* zj#@E3QH5Gxrhe>fokYW1B!fYEKS15#w|7kQy(sRbTfpYApXha1x|f1k1EO^N0<7L+ z5dS_e?pFOMTAgUoc9EF?iAkF*6M^H1b&Tk(v|k5OWDs7Q6C44IDS{#U!BePmoMzHW zZwi3#p8`hW{~*@zh7#x8A+WVu_NU2V4QO*GC;SQd3%t9wK4a7%C@bcG1%Bn(zqizfO|xDPf+(ori~S|@8U-H6 zXSU}O&F_whr?hu&cwfYqo9Q0tJ}Cr4(Bw9gKpM#DY&^lHl8M~+n8a_#b|7MSjFXY# z8cJ3cxvxkchr%Ap-d3&d1DhXzUdYjH1g2an85f>pgBK;2Z=B9<2S!;#T^BeYV{r}$e6t0Z0EOW3aIueMa+`t_C3wS!I+?7gpeIj9XNL>Ru|WvoN3 z1M?rKSQ}BItsjrc%|28reI$dvw*XERtpp;wI&@`_OX>Pj6R36e6yzzmf-d=fAmX^% z1nxdE$+x!8MZZ@G3Z6agM9PJHPelV#K;bu+>&;?4Xmecs1)&@Q(lsBBX*<*du0xMA z=|b(`4(VgFoAx=VL`Ti*{A@MIRQ9hC$bJoE*lk5pNiqRxuhfF@_ov7-_m}W{zXovP z1AEWj%PesCBy^e}yABznC7OkC56~?vzmZklg3{$cJu^(tLEVWQ)2XC>1f_!j5_~`OK^eN3ML90M z^$l>hB%PNSs{mrDPD|-t$>>VQ#pa!qKt!P?V-i^R23>u1!f3}k6RcZN!IvZXpt_xv z_Ri>MP_fzelV|xM;J$NWRb;0a8E8l~X@1N>*SHhMB*a=k?OsKJx=b)=ySh;5`sq6` zBYIf0bMyiIHN7ypl3D<;xxjC^o_Nq|LD&5JT|78%{Y8~a=_?Az6>kwclY_VSyntJ-~;44W=T~7z0sfH?X0EMry!%W-TvZ@lX(A# zMg1+aDEt$|U!~Bhhy7Bch>t>~FvA@A;@x{(u=?XQj_W`Epex=$nyp?2-j1|7L+QGP zoSnJ?1t}q(Qloybn#K&#cA4O?Ej6s;$(iMolf)lL|BfwH3c-JJ#}@;usc}xs!>sqt z5J!Bzl0{acj1#Hjw%pz1v9QMtu5b=cxVqA(F{3C0+dD{dzMqhWUJB{G3J2`?U10E~ z8S)@>Gfk@3>3uvp%5+`j@=O8^;ni*wmXDE&IFq91&&Mcy>xuYIUI>WO+M;l5`GOqB zo%CEhKcXwU$AX&+J_48N-*5d--vT!xe_Wfr`Uy3R(1sPgehpGwt*vQ2Q_;;I8qXyZ z0>IsVkAEUo$w;wGvTvX~2(|xBT>{$S;82l}sX#OYYzieFo^yEx7T>fP70W&Wh5a9T zPDVXL0>$yoXQU!S?=ho2Q;kBWCqhWB9 zwZ#Srr2%8&`nUo6eGnr0dijIQ2Kel95Ug2K2ST#rN@!%rF?Vo(h?eLCcx574G+0d! zi{xMHuHEbfyi*NJH_3+*VOV(<~x}DZ@$M1s-wX#O%gK!b$;1j5TPF3!cPHa+F^q-d@0B zURcX_eL%V_)J1O|BGhu-Y;nQk;kefj6HDn4j(IY`hRoqz+A_VLD^p zG3an0rg@V@2K%lzrj1lf!iSuY<=ezN)W7xQ#FLaHpcyXdvm+Ug*3PYpEl$Rvpf5HY zoM!L96WZ`H!Rb%H>6ravg;EtX`l4KOT>K-LRMkA|li>A#EXk=m(x0G)uN7-*SyzBo z_cCC>$pE>OQdeqtpjg#QYj*#Eb#14Al!goilJ|7Wg#oALe?1P!CC!e`4&7pA0 zy#!bOQ4VUqO7(B;_H^as&eI@2r;cw=XS-$1

$U5?5~#`beL^$WzECMhC*}5C$Gf9Mq!LQ6B1iU zJ#}z3)8a_Jr!%hY5`0_`X^(Hom-I$mkc8J4Isu>d6=+n{7a=5|3v-Wsepda@9!t(I zy2}h`plqugbthXDaPHah8m%=UnDgO54A2dMy} z?vuMJm3a-Bb<$;T?*rh`ZJPACUkY?He2cN}6h?9NDDkbaHi$}s_QxYl(3@u8nyE)B zsQIHB``5>oXmn2h{y7sVq_J7|{rOi-#8EsgUX@7&5_hzN_>#4dm>=i2P;YY-U@O?- z{8k#gckQXyXHxUkJEA-E)yInF0m%}XD)8Zz zzL-!$Rm`Iw#z2XsVU!(l@y4bItpCNaX7a!HjE?Yudpy!O{k@%G1+yYX6j~LFQU>^w z5BEf=&uM6G91{QJ8Xtb1N~(MMH^giQi>75=7vM4P?_d%~-NC*JR2`@U5oL>O8L+8G&Krd7^xk>!`We}Lt+a-Ki;sq+~ zUsl|fx&x%|@fc7lTmx2mX%qUpKB!20NuB8Hbr8{#w7E+E6g;gio{iczMFVrq&+0Ox z5%aaaYme#f0fmDUr5l~kkgsBqepkdX{6K=;q9^k_eAB0Nv8s6=l?RwD(50M(LDz1@ zPHSnxeUAT%~^*H(tnKRo61#!G392$9hWA|D*=? zr6bqxeJX@AeMLwPyXHWO$^45rQw^B#?0x{*A7RKlGpD)nNCGoWT-@0IEsIA#>5u1T z%HYUO+5ww?!E&7)inc6;KM)IfC z2fBrjs?oRP_>Kpbyr2R%RI=fw?`7?0Egtx=%Qbt%Fc(tS6m7rkev8j%8Xmh}{24Ca zG)&y1kAwg0VvawA=W%!RzTB2}3YJ|GyW7A01{Z5MbRP?UfGJDgB=PBdg|)uY8LiM0 zi_}R(P3t<~!$9>YH{x_`MO5{OktP{F`4zZbIBbc@H0sGIf+!$CfPLf9-35>sEwGfY z#)fb0o%CxqqsCHhn_IF!8L{z%y%)XQaaeGWy7r@B8C49W93@k%166wR#a&GWxrQSXt;M(VfXNRBSU}FaSl5}2NQ*v6v zor>p{1t}(%SLC_ZzJrcEn~*6uh(Y>Nf?Gd6(7_W-9N>M+F5-xKE-)4?g2S@mtI%LZ zETf^E$Lz_1Z-q=0osbj5nc;?;>F>^9_Pl3jGW5uB#?hR=2iZyJTsnEN8FRvm-m;5b zw{k&?&dG}u?mU>_xzT&(EByG&!X5f;A{JPWeg!}2mw}fQHf-9ePvgu&*>2_acGH6Cl7Qx=Dm z`kc2b#iZeb4(_{W8aL5Zd2z|?;blm5~b9$u&yxU+elnFm_+DlyCO?4!|DiGc_O zF6gkiO_>pK9ul!Ee`7CUgMYdC7d3PxFl)gNR_H8($CZ1$FNSc#7o!gvCO@;{mdpBA zeIjIWc&`cXD;-wseZ)FTv-=O(7PT_3OfccwZ;PEm8U(OWO2(P~1Zo%i z#AqoE4Iu$uxm)dz2Enjm{z$TA4fy@fmf&@7I*7|C>Kp0kK^>pz(f7We;3f-6gNk4$ zII+OU$g|prbcg0ot=#Db`xJ)xCF9ZPR+99h_gXs=*482m`qK+|`c7V4xIBRVEmXvg zB@O^C!7J4XW1V1EyUF$2auoVkpwShm}Pt6I?i$0i~`VH9h0jLB0@I_m#z2P#0|N-#@$u{#;89t6X14=Y-7T>BiQ8 zbJ)_?tb)&=r2mC_F2gL~iT7bJuUP_{vV5cWsJFrL^|xbd9V?)w()8{4I5A|xQ4Wa2Ts7Qm}n}pdL#Q8XdpY<+BxBbzA z?A=&2mPcQu=<*Hl7X&6w^(2E&6-U+we6eT;sOe`2R03Ho(c3g;`RH@ui<7$VGEjCG zU1=^)9!R_7lp&nC# zerYz6nbDS`j3k1Z#V^@Ngj@AFVfmxC^|bxain<)NY%s|EkoFxdPp` zPIElwhUdsHjQ6NB;FxFpWnn_xSXO!^z0;H$e?RBSt)s_)sn&Ts^#DSi*vOSJfj9k{wyMR+h+q_XHIpDCpx2hh4H%2 zUpgSA`t9C#-6n`n`g-EzMH9qS_t8Ma#}>2|mPHS0i2>_5&1;EeH_()v)z@3Z87QfQ zIl9}`0_3=Gy1dE9s759@s7|FGyjb|a)9ILwQZ$=#QwN&Cr1}IPE9;+5`K)iW<*X};B0FPZTpHsy>ByWPP3jFT@ zp+SPHTV+Cl>nWlD}wOD#C#~NC@tJzwWP?1 zCd1D@CvQA9+60#8sJbMC|$>qlNWvN|6Mtgbv@H!Es^TLarOTu{Eui?TOEe3ol@%;CL++9TR zCw=6PI1jWL3&~5GHUY+`jDk;6`hvEJJ!N}8S0ESm!f$8hF8bk99p6dhh_20<@t7UA zLuW~C$vBc9gHtpQxyi+?!C%pz^=)N$L2dz!ZpQhGz!KbR=dHMd{2GPi3u&)|Es>Sx zw%$8P{F8f$L8u`(d!Pm=Xda?t>3q#sx&y%UiVif?weHvT&~gW^*44@&;$S3$Q|2`5D$4AgWhd8)|;$xBNg z5iqgBgOE@D*8}A7UyUA_dB+nl+|w=m)n8MLT+gbUlQ4qAH%!7;kRqnLJ;2XXZ2v#U z%yP9?UBSAC3Z=sw#`u%#h2#BRI&dX~RN3;pD2$@dw>X}mh%Yy1og~=YU~zH{9)QnBbh}eVb~zG2mu8P`>>9 z1T5ozqQl>~hMq9*_4j`!#>?V%8U~5e;FD(7FV_d`*!bJM@V)Xwa8@Mb{{9Cd9N^bc zA(O#?%NC!1YapLN6QBLMZ&OggL7$J4`2H?9bc^Olk|u5i?1oA-YQAM$;|g3i6#JpX_rofw?2q&?TS^CW8;MS-Rl= z++Z1fnob><#?!sgb2kQTt%Gc{y%s3!rr1pu7_mqiq%G|<+`nW56h2E*+0UM?S{BKFDK!`xdiQSvb#`8 zdPy@tF#{K?w&bml+Tve+#qZnXD`DJnRB2moG9+&0l^ zCKT_;U4H%zj+1S0jHeW0mSfX*&AxrY6TDpPA2{DJC^QAUHwSb~r94o;{aYCwx2~f^|Gfv34q7PduVIChuK{@F z(nPel{1~x#@dw2A`=N`pox4}E{J;&r)-Q`0cIb8FMPoWvTadG}9l6cz3@$%ND}EoX zi^x;54$tIYM@<)RTzo&I4ZM9LYLZlaQ9uJz>K^qKz~S3OEAiI?mGM$VDDZKE@~E^l zIb@22iOkDRUpNWpt+xGc{+}eKPXyNvQR1;HF~yJ>M&}W`Gn$^o zR)62NZ48~nT=Vpe(|c=RtN6*Rq3>xdbx&Z%cZeSU;~NgP&SHjJoFZ)oR%amqM;xK? zjM#jHZ2Ii}Hj<_+N~&-e2f=;fReVYt=-KQ?V;-qqa4TId(6g@#d?~uQ*}InpstuVw zl289a0v|bsFZxy^Te_22ntB-7$}N7NIGjgu%70oXx;9YHY}O+au5J{g)DoOQp9Adb zAG>~h*o96>5~zaXxhRW2_hJAh#IDcfSvw0S5N9BHppN(k`WNlfen-0&7~DM&B0RkS zocXuyQ)ySgpPJsArdky!@ReNtgQ(fc52t9({Aiu7?6o@KOni|S_$b_r-0L<1DK1|3 zqB_J7bvNmZJSQt+I6bWED{qL1n49PG)0I(JFtuF#APsmf;HZ-}?_d=W{;iobP!alwSAjc*vQ{=;fntO4UFa446xa{`{+s;vBY0pWIhP=Rb1R zj?SrpkZ6;L?`yIM4>;IvegQyIpTOLzS_{b8zFYIXD+3CdD=xk`76@9YpG;AF%mMmc zH5qD$!61(CQsNVvav(ZrQlws+0{CJm23~hO1a@~rq@^iik&a+yUg}XHdd6M(V!bL2 zh-6W2b#5ktz~R0Pk%s}mUpMY&^YU9X8lTMdJTwZ~vzb{D?fapyUG?A#^ktyJtuw~S zG8|2)Sh>_G+y}C7*sH7VHE>FOWkQXs0rRWd$DbS}gM%*W7tP^?fcOmE-aVg9P?d1@ zPro=Deoez36*|O&YuO4dVl#R1x(;il$1`?pl`r$*nC}n7OSN%a>^CWH>M5Xq?@I&C zlYw0S85W$}K{rdA`4=oFGwjBpRbW#umM}8&7imjV-KlxJh_p?8pI>4aL}|@s9o8nx zh)<^HRQz9lm_?+QHZ4SsFS;8M2j3%uhIH>U4`PX-T7ZtE69XfjW|+@?Ep!We1JLc0Vn_)5If=F4yZw4{rC>GJal)(U0gqI2|z zdm7higjUs|pmG>br;7_*i*?JOCq9XPeO0`crv3M4LjdL3#WL@c+0&JJmjnY+DGMYL8|?P*UIJf!ztd{a8B(WTl9Te+rs?Hv=kECM#(>Uwr zfX5Pz(S_(4v{a>f$i@E%a?PmLl{&}5orV{zukR;7%EiR_Es+2iA!uArRB;Dx*N44? z^c3pe?9X6(~4&W`5=GTdGUMPv3-Bo zs*+M(JCp>k4F`+bNm|3Ivvv7gKg`kNXWV+`s$!r%?Ex)ohZi_wG$grt*8w$+E6(@b zw?Q(Ka-aKt+&~M&BP5E+7D!f2Vo!+82$|7F^#&qqpy~Hw>f>))Kt9k@VqkUyjXkan zoAxzBHn&v0j60OU&T_n2{r)vjHv$gQS9pLP6+OR?*!+XH8utn+q zYR}(ZP>IwHa?kamPP*ceV6C%8{7kNm9ng7Ml5bcrSb5>~R zgX0JY(juLVskOX#9JH zJqCOwggOeA4*;U(_tY$jMt`!-+!r1*K;wzOf9pG?g3$LR_RU?XAh>0oC;ho1-XeTs z)g^C&Ni5f5cE@FL;3N9lju#eC_4N5V4I*O*;O|pPRmzw!@W$)&Qa4~O7dunsp%uLU zgW<+Tk{bqJ^O)C19pOL4)vaHu2JpMdaH3qWD>NE%r7L2*4vTVl{`ovJ!aU%7LU)-V z=AbZ{s@47+Y+sqbO#@5SWsHfu1t53r<|EqTL*UB_vRjFnvHA3G)h`!5BNPAPa|ea2aC2Gi zqx1eINaod|uIwj(9^6yhAvgc?C34Z}a-R-C`@Ab%`{WcD*ZcLibejY!s08@Q-k`># z)qNhdN_ zK#QjJl+?sKl$v;MGxSX<@c0(t^N^+keVo_o+3aZo>Q6+KdeURjbp2%Voy+N<_Vt?| zPqzz!$Ng`c-cbV}Zs^?`Q@eNQ17)l)HR(GrTm9~fzhNz)&j=rB+0O-$VvgSqy(*Di zx_hz6a5dW4mVX@<(17OEKaDpD=7H*?r{px9)#w9{5tZ6{0l+TKf@1!ysBrKqiKt>A zlKhKETF%@;6$(a)LlyoYHpxo;`so*dr8i=8sWTC%wssfO`{bbKYA7v$E*0>OoVMkW zsYU1N&VO87dy6#wG|^w^$v_@IuLVEy(M3 ziS;ZutY4sq90E#HY~J9?19$3YM6~eW>;hBT6;>#~O;V-dzy$-TM>osz2_P9a>GOWy zdDNcu-uQ3$0@#!nxGvtZjgE^{yxjRthm)^c2$I`SL1s@ZJI_9d;`|N2OI(`-xBm9<_YWVoiDu0{6`5o~{C=p(zfiGZZY5TCCWUbacHv-o}y=e8sgY7{8J z%Q7U_!kh$Qd|AB8wQOTJK@jr8pGE_oi+pDI6!XHPpQWc3P1K-Sv-PV?K@E89LFbio z#h0PJ+|ogP5DAVU30KhGRf3KwXIyN08Q>KtCK`WDGRSlv)n?ztKQ*`sgW zU0^7~NfIfx&-i_C7?PR|D2m3SCCag~%(roC?+YopU^(n1!u`o#&J~v_QGYIXO@#Wr zJBhuHzL4u7)4Rq24Sb_hY4(*vJWgUUHG8g~1VzhbjD{tRF+tJk2~?|tlC372cRO^p@@e6{IJtvP*u-wA6?w`8Ezq(?jrH<-M z5?7q$AsN#5`Z1)=P=0e!)(?AKpGi1>-xcTG_}aP35(lN^ma86h>p`+y!C=;#>tODi ztLDFGV%TBGTk!MSAHXI~9rj~f2wE*fn|af3q3heX75!u9(co{tDym&EJkDUVAy-0z zwHj_>bf%PP`3euUjLe>x8;H~?fS23Syw^l6SuFt7F76sfd6YQ zXC7Q>_T18QnFhCO1e2WFrh>d1;<~lneAw~s!s$Ir60FpF&(y-|H!^hlC(1ClgR1#_ z4kZ$Vz-Z20ZdMgZa6%=~E~j1u`Fx91zW8)X@gW=i&?{#S#LLO#ka*$(U<(kptY#BO zwfz-Ll&SoP+x+B|*b`1PIvjM&@7zUnip*h=LQ@#s-LgH-VkwL=|72bb<2VTlXS3Sg zevkmcm7hQU6BkFha;DX1e_sNAJ7=X9;+fGU!=cGHTmq=P?v;2twK&qJSL)YN5e7$< zVYu$50C@X3cS2aW11Wbj+P|hA0;#r2E^=EHX!zusNxM}Ul8+^>A7^d@n-wi*v`aoB z{+&(Ymx^6T@Z5^_HQhGEBV^dn=v9ZFY&52+?bL$?{=xT!4jsT}Z9#{fXb6agv=!#O z{|e47OLh|f>;NtCWfvd#XM=#xg4a8@BLTX3aaLe)6vSAWJhut`5MsV;&yuqPNV&L* z!-y8a{f(^={lF3MTkmYuU&3#wIHQJ>DMc8HI9oY6uBgBO>6anTM+Klj^_f>I3kLY= zC#x|rYgrsF|L&^Rq#9=Z*LM=^3*s$uDj;}d0iAq)=84Mk!@}TCzKmUJ@Qrr3?G^en zc*pA@_m9hlc&tC?uDGBw47Tx8l#%C#liQ+AJ7V;>lu2Q~A;kR`R;oVi{jkQe8Ozb#XT>|VAosC~s~H@TW4=28!E`yJddd8!a8 zrd%O;x|0S}GgIp{LL$J2^px|BFW;dk!c~vE*#n5;;UH;3d^cjBt{_sA?Lc}TzLce2 z%SPEE{9;FSt$>!PERV{u4TR^1^kp(5lxy=snO(LWL@iBK$&LL1q7M8gn{F+j#qont zevUz)%l=6^<@yh>!0~E;)ouf91U>e9*M0y#zb&FUq1TFP>^e+NbuJ_4ySs||EXJ;@^>Vo^me|9ihMnRy5-t zQ^17#hS05^_kbdS&Y_uc3V3MlunQiIq9NI^`i3X-h;F#Ak;G{R4DAQnch_Ek7huP9 zw;nIc-@XDsDp!>?dHK@{;Mi=H%81Hb1j9|hZ0jV*y?d9lS5(;c+%iy z6*7rZk1ZV^1LSk%lzFSAC~MHIQ!Zy4G+mQ?+rqkt&K7_EX6L;LgREko(u^{E|XSS`+T^1~+3lB~0i@tp+H3Bkn{4k19Y;>n`E`8PCd`O}x=M_e3Amb2PN}Y z-VjYSgYQ-jY+FT$bRCUrG1)*7^h8q`Yd(aMk;_^YS9=uw=$8&|N3MksxlR6Q$ zqU(div{L3}V1+_OgJh!!U3(!XMK*$wZ;1B~N~2lia&))Oc_b4A^xi%0H1Y|>9P{vF zQ^RQBe!tlI{x;yzy6Pu1_zUqIYmNwU_=-j+bB}3xG$4JiFYGg8O+e=Igh%|)G^$#E zMkrbQ85~vJh^9N)gH+2=qq#m{~BVq;+YtJ1O*QF!)Q}e*#-rOcafK z5JTf<+KF3g^!U+3U3SLMPr#_i93yh zC{MrK^8bKJv)@eFIC8+xWo|v1L;sMpm%WAIF$!F`-_EX(X^olpBqo#mdEpOJR!xdC z63{^HZNW(=bu8exzdGT<2XBh-GV*@qfuw%jk2{M+p;C{#mBx+BIN?_5FPQ;Gm=an1 z;T*FAl-JA_j_o~*J6(oMEL2UgR{N~z)IUv}Gv8#FpbIdcfOuFCz6K>C%bY%I>EY%z z3*nVKJt#uwF0jI`23=^JsrvXJUcN|D@zIkTM|wU||In)o6%IF_x(@N-OLxW$HvTGM zf%EirWQ8*D`yKi>5p_r4&enA5O$Idx7_~UtjHRICa)UwID>0m8F--X%1Mrvoy^~5^ zB9Qggqp#bZ68NpRTi10vY3yn*FcWAnh2%X}4%v zk)vJ~-YDr5@ZJ-|R>Ka|Z_R)# zNho9NQ7p>JE?bLZa|SDt)5C4MH?u`faDMr zsz7a1l+&o%e-LX1<|hsMPu;o#ltC6>?3@}popn{%*xnj68l9!72;@WkiVe?3t;`YU z-j3B5ihJNK(ZXdL`paPZPK5%;BU^C(&+VXFw>8njf$zH!C8h|w`3Z4~T|^dqbW~rn z4S|)`6j^Ek1Qa7 zQr8n8uf0lG6zv0un`@R?y`F-!<8}{)Geg1i`r9j6n?Wbv;G}i#;X>KP2>_`;Ed1%{`;M`QA^yK(``2oga&TwN6dzx zTXo<0g&cf=b#w+Dv0e!B(V(yr7m7vmgS$;SM1d$gh|K$zVmKJgc}2H+JPa9@WT$$% zilfF|4(ZKAYvk#->iOrK2h!_L>b))U3_N;zzMbdJ6X3d%CtFGo1S&|))#_MnfY$;l zAE7r!jCI>gsT3-xtZ&D-qBiN+S$CfKxKiP8juXunj`A zmbF5acQTQdq;OsVLoN8E*!8*O_*Fz$BK7p{{da)u_F0YO>1vd<_vdy}Loqnu$Vktp zivahEER^LLTS3bE{nYrARe%~^i_zO`0$I)!^&cM={+H`K*Sx*n04sxht!%9tOk*3~ z?s;00- zDSxf#>UVsi*_1xP<1?i3)O_*9=MyA)O@+?s4#B`u%WDLr9q=(Z&qpW zf>yvf9sJZ;1A)__j>BiTdO+JpC%Oy1$%vsYUXCrI2E|HM}=su8q zYl-(S_b^ZnE+X)W>O}BVK7FBeKiINwylMQS9b}upGjG1uA=4ZN3$4r|l%xKqOySZy z5HEF6iS$?{im)QO(U$rWNo~_}CEUmaYH=%8%UAnRfI~kovrh$ZZs}MOmWT%=r02wq z^U6Ra6?6TnXc=IMwmOmT)`D_Pvi8h562YdPag^{(HcHm09Z-(Q1`T@I13GK5DB-0> zUvEVWatg}4Qhe(r;)^8Q8xAZ+h0miXX=W>t%!POT<+80{P5PlsvrQLbSvB3JP-#F{ zi!as>zH328r*S0v$Y<1bnbA>eZ3ERgm43L<`x~7+dy$y&$~*}AmvQqwSsQTXd+An4 zGL58mk~KQM=Yg)vS=EJ{zd@d7p3~3%WkmUdTfU3u4>HsKnRSPB3OS3^L_H|kN9G%Y zyc5K8=&*;pQ~mB=a9rcw+bsHDz#^&DIqlR0P#y5JA z#s$b3KQMz@YyMLFlbS=T`|S)dS3e?(f8VRT8`{va@cB=|H!~1?av|wD<2d?U;ca}B zl7`;6+TBY~{fe?;B$-TqPNByp$A*7$wf)C&p7~?BO(5~-Daw2Q%}dYkgj-49G`K9` zGkEkO1*jf6)Q?wAqvVg-rUL=(;KJPg(>U&5AX2Z2!;5+ZO=(J!jfivup{If0uSXAn za_`PpzY5xrblmJho3Apu@Y-3E=te*Ay;$}|rZg8h8FfzWuuTBrcU~ViANL`J&jRD% z$wxFtJ)mNIE(7?tiu;FX)gjTMo|UEBouKQl+1;XNUl8l@M^EoByh8$8>CZI0>%o&i zxnLiMMnIdfksABhAIU6<3v^hv1M%r+v;RCgKtt&<9sPz5V3vC;EJ(1N_X})A zv>On3o$m(1f7-|H-3db_Y9}?b8XJ(d(M5RUF#_yjk9M9)?4Wo}FQ_K?9aTy1_S!yQ zL0kUjNq$e(k>+8+SXp*5a;~=L-jW(ZPx#q>o|fN4j})Zt#i{*8QAb;a(yqthYIKa{ zNugiJn8|Fj>tF=wwyWoeHY9>F~sd~QT*XbtGF zzCX5TMhQnw+ogwRABQ?i54lP#PQW`tezXm{r0^<9>pdgESw#PIp+m!x2j3*Gsa93c z!6hwu9lBY3_%VMp%fT%GmnP>eVsqHBhhj*ppW+4lrf7>q>!cJul}fracqjoK^O-i? zh{R#_$ZoWi#aT?#M$MsR%@6&H8=`zyg&?)7`6olxi}1vTi8Z4x10GdBr9XnWpt`;4 zSi{IAnD@lR?r?Px7^(Ps|H~A?T3SJR{2RoW!JVJxNfjYHEcM+j-#mlmf?n)X{>p-% z>n_QrIwiw1Dxre<_lvN4Kzi3k93%JcjU3V(2Py~0C$cZnv zK<8qfWtyuj_!vY-d4BmaIDKN`BQLQr*rcnh4Ph`s`=bdwBA-~1V^hR-#0iMvJec45 zZ)>4Sf#=6BT55ssZzu=9T#*0?@0)HCa9e}p!%>a#TufkmU|Y(9_cY2K%Q8^NkVOai z59lj`Z2-#}bB>GfCEWb6XVI=r8*2Sh%(I6oSYkb|I`z3FPL|hN+;c^D6V_(A;ph@l#!dA}1%5~GIO?=2c!O|ilg@mERM zV_C7W$1`6IIU2maH7Qv;SD!P%ubm5>bls3_$5& zn>z=qNod4@Mb=Eq7c6JD7F>!-2lStwT!}ani!PA6kGcH^j?OA0@3-Mm;P+5MW$m{Y zK&O;tz|AWhI98=65y>V4_DNxdShb5FcAsmV^Q;GOJ#tGIxu%8^ibdtqwIb2{#SEel z!W)2_>t3Yj%T#3Zqc_2TG8QefpQ#R@Nd%p%lfp|395C;)Uc1tOFgANv@5)@q1oQm6 zZ(gcBkDGeZCc-Aq;UNYl-ybO#aiU5AQOJc0@OD)TWsu7mI52cPeuI@Aikd~=;d^`u z))~k3*z#Y75)Pa?bV(|3gVJT!p5hSPS+((sCg8pKDGQ3Wa5%lLDdCSD3O9;S{3P)fI${g=p-C zHa(nMzO-=5YYsIsm6@uH(ZK)}_f9PjUi?TrQ1@wL9r~j6B34pZ0;lRtI##Rfp{@^a zW(O{aU_ParZYSJXG4o&Q@#=*WIJaTP>uMT1=B=%~JU74qRUWBY%6c-w;TFxO#wY0T zG=*FY(s%L4E!m*izDbc04K2*n8Y(G&FN)K7{wSzE zwLw1Dt$ofWngX%>?&v4`{vce-#3I4k3B|0KxJO^OiN1IQsc(C_p#4~Lp{T}NXujI6 z;xCarDERb)&%#{;FuRi|MXj7dNtGlo{}{S~GVk8VA7(metS}&YMp_N|lJb)$T)vB3 z&pzE_a|%L***T{TH%*W@fqWvf=q-?*9@8=`>xm?TcB52g4be8W6n*u9BPc%Q|DuH0 z64fu3Onl$D1Xl}`2zc|w;7f(ew23PhVaJIv?$B^$d}B4bykKFhH?We9i6hFMf2ah+kX&T4c3MaQi(WAl`i7c z9z8EoM`=vFOz8e=Q4Ky5dUXlPLU@BBqpO1NIJ_TPZr5Hu4hqioc-OSaV%>J$=*{=y z&|bhpsc}US4u^%9JZ30G8FL}Kt~RA0=y>VpGX@o?|Bh$ymCK%JwU*MnX*L)99DCTg zMx2l4I-W%?oi_&G44=PmuzHC273@Rj=_%?&y6#!#lG->njhK)ZjYK^PXCfmg2cX1TBh3U z)^&H>Ll*up;h`)3dqpe1zUC%=?oRMYn*A=8eU$ePE~&y`UoU5?cQ=;iM3K zfIqT@t?y?$VzR`8&+XmPkaB?d+u3vXaDbLS75mx}S`%L45nkFratZG(gXm8}SDFrM zw)?%Hnbhli-wQJQHJ32q>&`547pEv3jw(laW1(`Z8LOcA<)@&J8~+fWqakj7w*f9> z=2)IFC4&BK+OMDLyhG|_>-{@l>EL6sg2%etd+6`h!+#@7ji8`J>Pq30UGThqP_wrG zJ^0+wzt`!ELF!T5*|P5)U^s0=>#8m>JaT^hRI#KR5m29gwZ4BF+&&@YTe2JruFG9s z9f){_Y;UG_^nxJp<0VTV;>to(qS1XF3Q359&$g|4ECB2q{Hbs03P+W3Lz^^IS>PA> z4?Y>acy#wNUqgU=2*BNx591ReK^R9j(uHH$*SXnOiz&A*XD@? za$932xWloUg#L@C0}&(Z9eQ0Uj>*?YL7K; zdInPN2|4Jpq@bs>)sBK)mEcjRva<1LH6Y7t@0utK1d&A5wuc@CD6S~2H@)K(sLS5u zOLFZ(tlv8+r|cWiU&WA+)@X!A_HsoGo;mbMx>a zD?RU3!+K(Lr<#!=JBtjJ5*gk7qsI#bJd=-jk|1JKi@n+E#f##P-I2KCva86u`zbCq zloq-DywcgZCkQCq_^ycF;08kHz15^|N~4tSV_f2wgwW1ELFxn_2>wl4oOau}jCfYr zH%(#{L1W3oCzbFd+NN->Cfkz&@uy6Q(nh5aW&khO;uTSRBJWk=x4&D+JuDkVtOStB z@%>Mt=9l54q;HK0W}^6hW>m4R`6(O+Nh6O%oyC`=%)Zfmx`cHJGVf^(DqzAQ!=vmd zWjsPONIfMC@uFC2rJ=AAPCT3)k$OsodCsOth7%h@qr&#j&21WZIJ~jO4xh!b1A0Tc zMG8>ompO0w8)2A6GF>(@bPg+hCp^sRR)#h+J#s86ym;K;O7hnuWmtDse9~6c2pikY zXIQ0)!wKs2#0d{(IJ1e&^Jn;QWHF#vjow81M3{8;KR^G(VKUoTgbUlfgOAIBfee{#u?NOC$}!K!DgksaG`s=@Q$-v{^I}=eDUyZ$Fz|U z-a9zeX`pfr2T6E^hQE=;4{Dr!Y^;6UQvCH_1R%+c1Wt_XT)I zzxb;1eh65SqP(V_UI5gkcTWTr76Pk77O`miYH+&awDRBONWdJsi>&Bc0I&7T^t=11 zs6a9xG51&jxT;?6yLa(5FbPztoFeZ<5*7BhJwCUAS2?Ckf4SFzqiCTo(ZW17qpRK#FtX_zyRZq@+t{ek?kpVd$^`^mdJ^fRFR(rRLZVf%% z95Q}MKMwpA6T@yS=YdhRiX71=!yu4A?}yy=b|BlOwdb2RizEkmc9zdggWStJ9`!xr z=L zP?$7+iWrNDi@$~E0@T(MVQlsa_&r~GJt|uc>Sey)+&G_%Sf+UWwKhV*+I^C+9FkN~2Q1SbIgW32h=U-CfMF%}L$$wF_F9(=OKhrfu+oC?A&z3(UPoc6QKX3HMPzMFhzkaQCTD6qv3GC82Sxn*8Pk!whX!!C4o#1O>$J>6#0mBMB=(Q`wa z(wOm|%?CN>zaWnz;MKw;H~xF3|BqT-GcY%M22(t|q&j@QlOMr`XrS>Do?3Ry{BO`or;#Sa?X z3CE(E;bYt*+}76(RVk|8J=bf8GAHW~g%4`5_Gb_JbE@y~hQe)yaS06VTvv#gVlr_g zWr1z17X~@Z^JQxnn}K;7?b@VE5&9<0f1wy9pr(W#Zd2Vtbc^szvX4Uo_-ubr!KXTk zrhR5buSs>I`7v5frm|k3V)lwcr@9KoJ39w(Fe4BVV&4A!az2<|;I>u>oeCFPq->@*`kt+G%`ko42^EhqHNx^|dvc!51u@LTeoY~blwgE!9o?YO~7s5iO zF5gZ|(81%E(*@-x&Ows_p2W#BoN$X-+$zqU5USqH746dyg3Rn0taFNAC`-?wDJqu1YueSblO$-{r@?oBhpA0c2eO;8LcKFSHxFA;<1TGYQf z5Q*YNFFK8=QmlTFxrF!l8$C{sdtlx#j%3d*y)e}=l25LjDwsBGJ|vni0)NRN z3}V9i(8(xd=%1t&q%vA#sm*x+rz&pxn3cQ3K6VM3YC{7^tKBkAF#HftS_&K?wuy!rc%DDWBCPb)cfeskNrXn4+6;IhDXsD^)Cy-)6*a| zWQa2T#Q=yYh?fkk&qm@0TO)3g%fRCBkqxQh8Zw~!{amPG5~VQF$xSntqleF_6UlC` zg1US=pC!$1w6^=VOYVLzGIz3TxT*CWIkb?IJzO0}L;F6lmMsV9i&6{eAJ+!UJ*aC<$vIu#$YtH&|h%bQ|od~bOmUB zEdOco%@#Vl(Dz5fauS{URongI#W&=yx{Uwo)n37WFHMbp4EBYJ&%4R(e52u# z+ig1|f&_d~j*Qcr-4CjhYuOHTg~E#?-j(bPSy1J?Q=kTG3S7{m|3ky+4RtJ!SsGXb zLQ=AUt2br?V11S1Wv_4{teq`zp<^`x`__ADyBgnyTYSwVp)9BIr=sCOqh2CBVeTSz zeTo3T`D^**pTicQ7rGcQ-M5dX|G5f0m_0yYO(&M=6}FK7Nq5~(C)R*&n165m+E37D zWxgN8{0lJZhkj;VC4lNNqlb)1KLJ;R2~p?g9YhwS!?-3f2)4^k-7aMxM|+z3cP5CY zfwq_};lr8%FjdKV)!VrhIVpHZ0&12_YEh&RM0tz{?C6=YMsE;E%6oLB@*c~ zW#NT52}2`V(tHrh`QaWu^JuX3aOZc8steH4+7xoqHU_Tq`bwaQHJA^s4jcJ-!|Rl5VcDCHX!; zhv^2*xW*pcBi5N~R(^z>y>*YMXdWT58W?SH5CATyaJaN3J^|~j5w6`FdLYGjU?J5b z6rE6?OcY*bhjx@oilG@iP^~-AqSkT+SWOd!Q<(>uMWQdJtxjVm>HFV_M<{T;qp0wQ@6ombP8Y8@mKNCjKV3qx4! zUr-Ww8lN#}(bxDuhR^3#&ksA(!#`Dg6@0#b!0Dy=qqvi-nC6DhO({-lJRu}>iG}9` zX7p8gAdtz9ot|no^rVntLMNX9O5bhpnAx_A!S6F#{5~qF5=)Eet{S8#57Tf7bZ*&4w$xIZUH&5-!0039#-Fd>k=+?9LHSIxjH3H0F&1#{|WK# zBAv!3?|y$>1OFOc&5;&&;ONB6||@Va#=#R|(=96DuiF5wI#v|Z-SXxi8XdC@Vg zMPj^=#^AmBw5kB^(#SsVT+0r-kFWmaQ6+-!nu(7jbx+|!{LMCti~whehTcJ0w6Okd zPG9`eBodIHxEV-D0;j%C5sK@tgPu@X-A|e$m@i|>_Pl%tT&{gxY*^X{YyVu(HF(<% zy{>%zGI6{Qc9v_(^s%Sm46bUPw0q_M^^wf3SKR`4V@tWFE8Fq=U4bOB=jE7sXq4aX zZ60PZ3l1DSHGp$EcWfUne#D{r2DA!k2(q>c@7Gg*z{(>NZ_{qnV<)wNjso0|4NemE z>lgImn|Z@YHDpb&U8yrujNvm@N~Fm@^QHw~itn~4DUyWjG}rqm9-M`J#_Q!tUqzw4 zz!4tuk%b$swVycEPC|haF0X|P3{WzjhCXyy4QB=4S@}}Q2MM%~-MUMsjK!Nv>o4e> z$3^x_LhTG(Fea^|`%*n0PH>&!`Pa*WMgL@0e2MuD_38U>n@Gi}6DW7$7!`pt>VILD;lIKPts^GD|J?73_szY`|~h6zcb zozt=u*kDq}tK^_CH|LKvt))k$9 zyM!`|QY@EciSf^ILk@>=U;l_T~%`Qe%*6WcaH@TxM^#QDN+H7>uQ^KXc+-{D3e6%EFHMvsAbS{ zk_kPxeN$)it4)!C`RmR|2p5RpUeAv-*>1^|jR`k7JdX%aAYjh<+wv!rENxbi2mEc| zl)tiY9I~V~4PNvn#Wns~zO7MfNSjx7_vOzB5R%@MCiUVIsP;%gWP}R zIF1PIpOu;41JB(9W-XG&QPiEc!Fi?R@Pd}gx4E$mf;OX0b`)nC`q1rrSh#x#qP=ZI~#odgErJGYepk?eAV*v(s3i zJZG~gR388FZK`RpIz$~Fu9wKX#b83`t8YHbTKINIe8jUA1I%;oylidBKlJGIX|c!m zgrI(z{om2koRERwgICitdMMe-y?F9y2RJF19Y5oJ95!aWXz|Y=z-_jq1L;a6Smd&Z zKl{}=Ft@8~XxE&fX-no4G8bcZ1l@nJln);Ym7$N-Fl{b@5mr+B zmnt~31)R#=PO4rpfI8KJz0DCkm}bAka;#Ja4+<}Ctr%Q_N2>I$2|5~Bd9FC{FwX!U zXuP0d;1xCEKycS|d5dxf;*FZ4DOT=6f$twHk9D^r^ZWFBylUORLy9OU z_CW=Je0TV(_2!Y-UdO1?)(o(c4LC?qe2*f-YXn-zme8nfE&svCpCF|2{X{_EJd!|T zTSX5?&`zsTK-BR?aBT#!3aw6oId!SKE>hFz4w?QTap^DgHZ8oWYyKzjfBQ&+I%f<> zN4|>xT{eMUKDuSu4K~4+R{HAaiWRW*DdOOl<2O{QP_j?YvJ39(*Oh!3o&kOfpKr7m z62WC1jyRrtV(emc6XrV+z>PL13FD)E6g5xK8TD)pWUe_osl}`VHA?ZYNb_k#J!@zk zEJp&j&NQVO?h@m*HFFI}QjJQp9~9{|m!X<%-NPTbm0+B#PS~t{1Cca8X=1Vp2ZPVe zBCq~*N6$apyUHx}992G#mQM^8Qn6B*{3XIq?+5N}qr9Vc;cFS@}08C};(Khc=sj zh;%?5(ux^DXClD&(BHcEijzT{A%WU@p&Q^^ysuT|QGtHx1Wxoh2LtKO4pOEe2cULL z#8;oJ7PT(;z7yIhLXUX{kDtkCNBg#HFNaE6QDo5Uc0+SMV*N>E!_yuCu2~$2^9ket z_n7b`E5cOdA}@dB8sHCReD)nHshR-)m5;37CH%olLY4D8x^>`e07>1+@g^kKa$d{b zy$>nR#3h|=%LQB=7i~UD63xPrLNQ`C@VQ|p^AUuQwQ92$3;@sa3ckG1G;rJK z*}W0lui%@_{uRRUT40e$^*@HoGaLvu3d2TLw#-m=Sw%)d-q#KxvRC$2Muf;7sbrKw zc0wqk6!N}V5z3y)4w>0A-}meMe$KhB=iK+DigyTEzutdzj;0)ZgFQ6OjBmgbN>hyl zuL5M#J>^yNy9HVHgImJm+29_n%Z6Rn7oZzzf7#5u4K&FqaF=FuBd=NB@>k!xLA5P` zgv>${nmYGl>GAI_6dGvqu|w+>3TaUi9-FHLJlCoiMhPTgll<}gfb>gPLcBVW;D6rn z7HH*^{CypZduhMD(ZP#n2NaWjs_S9p;vQF`3~jtbHb}uuauFWctK8B-?D&Lznb+JS zNw~7g!gT4Dxs_J+TieJ zU*J{z?P*nDT%r;lP5q-3XS|A%!ha_yi=TpLNVik0zcXWUif2ZCnPOOhTQgMl3=g(C zwPYudV~?Ah?K56?YT|J}15KC)@QH`Vk({*|PTulb;nxwy56KjRItooO?fWw_+ZIAF zJO9bsUzXS5J&o13RiqbT@+O~ZT^AF)XX54RRHzJzyR_nGUtEBJuY4nh_Z8vZnPX)R z@&=gTU@^$iK^&)ER_+L4zq_-&Y9;1L1vm?^|8Prf@BUH9MAuZ*@lcCeUvqIbVHo7^R?=%k%;}h`{%9(fT3(8~_pEDE|$Ugg9advwy8Il`D^_rAn=DM46C(LR^8 zB7r4~6>od|VTYMzkMdW=2;c|G=T}Gu+fX7~QAY2!2xc7#*SH#Xi0bEfiO-1$VHbn8 zpJ`J>5Re;l$&gaP2Ua(aJ@%uA!*9s`<^In#Q$;!Zo}T28@>Y}2itGlsdvN2=?S}$b zW9@9LVgv{Fet#{;&-F5_G&+8X$LtKWf0pR4{fZa{Tz?tMA}<6hf*XW;q(;z`pW>y2 zm_I1$Tq})`=tW4t@~nTxdJKpjrndg3egkwq&;>?@mjkLwW`))4T4dHW>^9}v0xnKx zRX9AgLH6}aadvD&i0bDV3lZNQun`W0&agZN>Q^ciA4FuJv&41HQx9uFOip!Oop1qg zX;?9DSn2|8D3U~9Zwxtcvz_ABz(~C047bhy|F@>QrGqqJ2050QP7nFjf{b|X;yY!1 zK-Y5QwR6G)PbY^k2>zO>Co|nf10}GX#*_aM@Czb{*uaACuP_ z{teg&{P|M+Vo~P))+d>P1%Tcjjx&W4;$GUIq-!R7Xh$lcW91!1-FqbM#Gtoi^b_dyIY>|C5aJx0+}w)parC?^ zH-SLpFY3~`SbWs=7pU;wEzN7)MQ+Ax1pA-1K-M)ypA5rhkRCkS{^DmJnB%8*wf#GQ zDo?Uk8+>m>yOBG^1qLmEb`E!wXLN(cH?&Xo2u8ukRK4*zhDp>mW8K5PIRx@Z*vqpN zhmn!X(!$Gz3UHGI#BQ%-qahJig&WNnJ?|{fFy{M(Sj>cE_@=tSW6^+@f;$c9-cPFS zLGv!qwG-STKi3N0rc#P>{qGy@4n7}jKbC`ss}|!o2|j`1kYHw48fmEiyDsOOG%FnM zvB4e`dnlDtO6fcuCGL%DOuD)x4m$*cnHa3)@vYUso|YXMe57I28tl6Px?R*I^NLuY zm(#+h>`$WDVOTk-dXfkG=7+sm>f?s|2DlKNlEv4(IBG@GSTQBf-1a#oA^79TdgY~Z z5xi!`q)q!p5ZV(jFzpw~!PAAcgP9f8Wm)_AzYEa9b4TSxgco+o*qvF-SI5;8 zCChpzG_bXhvdHdzd-&&O$&TPDWy}(Mk;}B&3)>&?vd{jqgx({^Df(aP;kuJMX0Bvn z(EpgIA!V~Od`^5X!GhBk+SC|kw$7Ns#4u0EH+N{@?6YV~9|w1M*G%X;--;~0;g}(t z@FD}yNFEsm`C#-tO0B=49C_Uo)jAW{}ZfZE^0|~dSsbBK#h&J`HZ`Y-2 zbejB9N?`pb+`-6nM%+RV5-h=iE`1R?yE${ioU)(hC5a>mB(FM#;Msf?-i15mH{ zNtoitU!bR2(kHIAi4I%%mxF(7pug7gE&np8aT}%$Q`Y(iM*iNS7BY{-BE)h?!%_7G#uRF#?oH8v<8>$iHkWEYTXk^A=< zoyDs~@}z^=%$VazB5l^eZT$33%GHrWRV;LNm@}c-0e*d#tv7wkA3m}!Yz&TaUtRbnEWyDd(-|7S4u6qH?S#!IuO$iyTf^Z`v2%nXez5XRs_Yz}KGtu|zru1- z2is6ae0!i^0BJ_uq9$)B|4~>@2NuWPOBzO^X3;ubuOdUc3xr6))|$h&MR>Rz}Yl z;#0oax+97tc)+*T>0YWP)@RbRnKzY&$G7g=W=6X}`CN+Y(y?C9nRiQ`S4aypJnwns z#di&-d{6&Fqkav0N-p>PTD}JFTo(}v!lszLMVNKj-Un9}z8)B_P{icdS$g_xyz#@| z@6`!k>qDFMvb366YxqJcOkGD!58gBGP5b)J8{XYAnHSr)g-l5`4SQ6!(1HGQqV>Kr ztc$Q|a`3Q$Jp7!0sq#&*MQUid;ca`Y<8w7@rQQMFk}+HT)wvFM+^HuW8v8&V>7a^W zA|(|0^G=n?kRIPN>vKq%pu%p2z3&LNx{;+JJl+_yfhNPa&0DQj&}>=wQQ$vjnD$Ce zEb(vvEwfzp_M_*=Ao-W-FOd_NKZJYEV0Ij=a_zhjZKs3}YldllV?iPXwrm2USE^-W^ zK|8&pHM2%EkS!2;si6t^629IEdGbFuo+7r;TJ8d4i-Gaq-j@S4xqj2_V|}2eC%(G< zR|8OcZE=43Sqt(N9`1-x90dE9+}uEM0}6P#SKU$g4lO=6Hfk*$2Z>3i3}e2uAR(%$ zd+ApjQM;+W)yW^f(2H%#U-8n-Kw2SFCaQ20Jr;hMm{{D6sCT~dDGq%FT*FRe{Dgf- ziEd6tWVaP8ybz*`n%G3!ugp_TRzD%}W=~z?@@cdZrA(lZJc#llRK5kKZlYUPKWO?G zHzN_Mtc{}+BZypRMC9OS7f5f-?0i$Yh0f&K_U^G(A}W%}AnnT=ph5XtL=T)rH{ zzrMIv;XjRfXuIXFR_`GX_2)`iH9vr9Nwvvl+c09JO;vwZ+61P>Gw%A?Poi$Mh^D-Y z^JvP%|Hwv@5VzG|&uWSN0}Ov89XtPI9wht~;M6H>M~T68r3T#7K>A5fb1%;V80Qk{ zqiOvF%)e%fnyJo%f(*fLL6#fn!`@?_n-d#=NaSJYmqA-Etm7MPiZ111~ zVuQzl|M$03_3Jy12OA*b&&PPjgAcf*Yof#~sTH>n1+L#6`+~{7z{Ea}O!(N$Vfy?~ z37%10c2h**GUhxYTK$Bd1{#N!%JTS6kAU#k3tL_86 zg8MJ9vWsC1ms&jBy?Mpcg{1}BlIK&M3T%f`=M87$aTzuskyHDegW*B^?Qolq%~(l- zZ?v7H6JPp8&11;_6`M?ZG4R~Yg*UFw@Mgu5fU1C7^=(I7s4Gi@anR%xqQ~{X&_)Ox zYi{IO3nN9^fer@^WaJ=H;fi|iO={FCbxqIYXj#F^G@P|KhXK5Md+(3_o?GU z0R)H~WxbX4WB_?>qs?Ya4B*wQa^M?2QsiQ6qiN2`iLOe!5mEBfAkEOx*wyol;G%}0 z3E@{h5SdPE+fKxd7N3zQHhEK_$*X?bj8O{;&UJBPHy%>q;HW(L<4N*(?MG?C`3j={ zeVDQD((DQN!?{6|yiW>i=~gY!XYQaEjqj#^o`BF>y+JN3>=^dv;%^9@lEq4;9UmWz zi9;Qo@wX;aB)GxogWq@3^RPCG{MM(d=iyrB<=3u&8~^Bg8?05qj)gX2GyAL0LD8^Q zZfOztKab@G3*1~o3q&r_!4CnBkYiy^8s&tk{vk}SuBgH8=HXi$CvyOkqfq<4WD(*# zdd#Iv_6mhYYikXIR3Pz5{F?8h07P?o5M&;PfvPyNH1e%i=$YOnKA}&p!0^!hLB+#7 z;7n4se&$L78j!u;SP~EfZpCYQ9{6UUQvXNEZ)9VD_*q3QgB^e5@3|*)Jv|KcNFMgIYNHuLDxr*NPayZOMNje}C901k zv$}hXAMlXz7c|@TgI;bTzN_L+G#r$swx!-maYCj~sF6CcT z_;r{6*K)|8y3iZSSGNoJ(cZ?$L~#=(xa;|vflKZ@T24LqE}}00%4jvIU24RDh|z;c zrSJ40dLUo8>^=)HTE885C07c0^wd%sJ|hLDV;_m{5{MvkhwiU@(S)E;fcn;#c5cu# zazoCNM-%?wD*m=Jyb1mVv%IhC^}sJ3?>-0()r17AHwG?G_(1`YL8?tBKWID*{m5<; z;O2O=*`i?l#3aajhivJQ{CmS;0JH4t{+<{|0@L2Yd3_7 zg!temyl*$G8+~A?j``@YL>Qj`-rC6G?2Z4({Cld7FXPFYnI`BFiJ$m?$^SbW51;hD zw>u1HhVL6?lrEf01}yHz_HKSXjQm8Ep5L`!eU%SPY6N7lm^e2VU4G~cV} zOwWLUqn_^7DdIeocqQX(^T)5qQWYYJlPww-@<1A%qU232D^kSG{_+pt zq6N&|xSrV%2Jz?jo9iXA3b3wuJ2_!!7uA<{PbI#&js*%Vu29-u!)8Xb)J08~@$dZ* z^Czxacng~ZIdZGQ7X|8(%Y}Tilj{QR64eWy*I2+tWkaTOZdR%oZbBuT`Vw=6w|n)jxU&fQzBQ=!6B0kjP6tvjDbCl;(Xk zmw`E#D#v?Gau~Y%u$ohf0AGnEwLarU2>)bUE|g^ZiAF3s0bSfY8u#kxEi&Ij#94|i zR#XHqAw0y+nT8VkJ6>G<)6j}epR5?``a6!+%M2}&#%4g4o)jG;`69^dE0->I+eEiN z83@UU_Mk32x;3A@1YGXv@3(0GMlMswLpo=E0>$xUQK5wm;QRPqxysf7;*TXcm$Gw+ z&MP|=!^^|Snbq@Fp!Q#+LL@RT?@tW(7_R60ny;d$w6yRuR$IVeAcpU(I5DoVVnBm> z>qwkcRSc2tqPe;A$$?$OSk&FzL7#RNbkHadTw$LAaaqBKh6g_Y>#3K~_GW2lgG>4! zH@_?!UoydBi{+_t*HAPvt5bJ>($lY>Kw9LbU@#xQ3}xH+cP402GN)hr=1 z!p!xBm9s%&P;w}|tEb%(`uvDKNyP-AykwjECo4;6tj}MV6>tl4@pl=EP|D(#s0^VT zH5vG)zWA7YP66oD^(Xt_or2t2fl%~l5;(hs*6)1I1n1)PSReN%fvOd9&#z*|K>mC6 z{MD8hK>VGARb6Q|@=N#6xFPrv)V&mpWea->l4uyehLhYy(LTnM2c%EYJgdx)V=JH0 zGl{Jb&4D76e`|;-*s~g`c-U*25a$68v6gqSnYp0e{m%iu5g9NdlUl`s{?ZQX!{OFJ{e9 zCUDY!w#$)<2OUiKCcY{sL9y1V1bzne$kIEwJ?=6a>Ri3cx#UKG7?WN|FKn>`CO(fH zeH{jrOKG<3f=I!Bj)KOEPvZ(wIQ)bo{9E_!lac%Tw+D5dDgMmC-9s zvxY`J>?|wxCjsG=*DfU|hY{b3EB{}z&wyB*K7ESe7y4_~RJoY^0}wgK(dDwQ03tEV zWwOVeXjqS6?Ao7EB>q}x;o9GIVEHgTC_rZdR9>heS52Nk6Cnf5r$fFVPIIRWy|hu# zGP-oPoNyU^IJ626`nU~TyD!bvyUc=a@3VHxAzf%jG?d_id^z$jbxaE$KLB?$EJPGC zcyMw_+EH{b3p7z5ygMdJ2JP)ads<1vU`_7sx4)Y_FlpE_?4QX$WTEqXa!iLBU-ICi zzDRfq$_H*fsJkMF3kaJuf+$bI-EuJ@p6N^YD;nDWps#8cr6IO>n}rHX&s$h)-7X*`i0=bfw!Ir?`D&gM_*)K9{7l`K8QUeW^|q`=n1LKBJ1yNH`1TJ45BS}B8chg~70>LkCwu`W z$-kPyQi}jzo9Ihd6K*KHN42b}_YXBD-BdU`K!I-&JyjQP8%0a5O3YI!3#k8Qn0C1) zE&QN)cKu}^4fZ@a!(`TW66O$n{H@JE1&vKFtlxJe#3#p|XlAH zm&2b2zB$EX^m2CrvAvvqeZ_qRedV^^x3{8z8x>;xR4*8@x-_3g$Tt@Fz(L=cSe_EE z>}!#Vz9)clQ)?~JuUW9CC8O>`BXW3P>(*jAeH`B;D7iSFP6P>_DTENDte~60R-yTu zYoLPVU6l%12hx4VdHC<#A4Hk`twJXMC;A7UHs7kN0CgmtD{_@%Af#aV%&Yc(6l>>I z?4leE=+|%4q`eph;)lI$lfe_fx=k2Kwv7RuE9snO3%}91lYKOzDg($M`0F`d1!usQ zztgruJq`lqx)TIte}RmSD3D(GQ*`lfC3R>B110*EUocCbC8#u3u5PAoMf^=z)b9zK~&}vLkOxZ#Jpwd1N zG@1`UhKmoXFR(|Tirra<%UTg=_uj;<$~ZS9Hp}H-7_5(+cD`9w_&fqxMDNq@k=_D< zq|^TleukoVc8d#6eo;Ww_Nmd@QMiI?nAg!~ExWq7p8b-lcaIgavnce1w1VokEw@eL zE@jrKMb;)=SiD~+sboPmKa;C)4O8q|Dwfur=C>#|j>%V`FuEm0lTlVj)hPJbNhV5x zsY3Txr*UbWzi#E_WYtFs=-?d01Jb;nUX zVZg$(I)@kB@9%!qt#eR!o()lsRuERBjv1`UsMC2_-Pdcu2`5T!^o13x!XIp_o_SOD z5LABf)(N+V>=gy1N9RegW8t??)SN1~U^L)Xm8A*v-rJe#oVbD=S*`EcY3ae0%4)Ob zDm$!HuE>15)d_aF<=+@9HG*Z-fv;~)tHQkM=dUkLDZ|qrKaxu;dSEHlE3b%5S#fjx zGci9?H+($v;nPdl7}_j+RAT~6Fz30>{4q6iJhivyP{^-}8(&|}FO9SUit{_72X8IG zn=Z_#a;OUwj24tW%R@Ay=kt|0RuWw#@8w~mA&vfy1^zoAG6xU+=FT$3 z+5jcubJ>gXE&%Sz#xB-beiQzKxjPhMe#eN_*c9B8&f=J zqkB|*wd@NbBK}I%@AS z-s&Vjn!`SWH1RiF-d#iB?y~>6`z%waro>*$8!K#%_>BOZ-VU zxE*=Csy>w$_6}sG{~Hz2Hap`RK+0a-H#@|;5=~bc-&5{!b_B|84(rwJ_D#G&)nIoCf@nPj4>QG(QHoFXMjO>hF zT6vCaeQoOK%Hj}3CTsSs9@=SbwF_3e$;cc|Q9 zAe`x~A9CGJyRY@_F*sa%%pleEe;(%TQsSv7G?q-*=2(9Z&1!!$D(pxEz24Zp^L-7l ziA>}BOa2gCU!rBK47&pa&V0H_c&q>ffOo2ff8U^}zD^%*?qo12H2rT+sRFI%ygd`` zk%B@~I<`1etkIRtd#jln$;i@)=t`r5H8^pNCQqA%8_PZsUekTt2U7ICv7jI+-luSn zRU+C)yL=(n)S`|+bX9~{b{sFv7OKl_+M5EHG|HNlkP22;(QVC3!SqYYIem~~Orlt_dTet9AKMB*kb zF7Qdp*On2$Kh%h_!_Uz`|K1A8{#H`>EX4UDlNl3Mzd8Rw^Me?^&j%+3{UNl9n0YXD zR}r%wXHnG^X2;WKhGTqo6yZjbnf%y*0><~g6e{FPLgn0h_m&s8z_wc3`Quxvkl7)Q zuG;e-Qi>mx>*nLeFYn(j9*xk2w#wa~b9lvIQ`#wQdP!|O?fA(;OF|dF|HHPjeRL8x z5IOyp6Vby5mbX93kI-Ym=nF?RbsE_1;iBAZmI{2~E+hj?Rq?ATb?QLXJXAWGepA9N z6QNMQGsULQz}(AH9m1sl{rTsm&ks8#kjRMp;fWI-s6-;#@p{z*5M5F0H({IrWKSF7 z_rzr&+_}-@o>Cz)%whTL))a=izRo;O2}l7||Ni`HVT=VPkDhojF5E>IN~_-RKYj+Z zL-yC3AO7Dz34Z$F-o8kca-xBK#|*u5?ceMSe1%Q~X;qpjr=xjEEqPnTGO!;6#ky5} z0EM79m7L#uU`1;keAcKO81g-tTiT2U-d5jC!sp9SN3`Q`jD0ZZEh+q$BwhwI{?;BB z&#VU}mA1Quw@T2QBZqSl<9kF{JDWkMjDd#D`qHx58(>Vw=~vk0h}e=p${)SU0fyU= zA(w+n!EXBch4uQ6i1eAR-3P4@u%G}ejZp?7D|a@myHN$MOrHAm@PCggG)S?1z*PuL z%MIhJ{?>!KA3K7qm%2fyPVl^bUOw`KA)Yw83uKN3)NXHoMGNr(B&3AjkQ(!(`cI!tPerk1PsM@c2L&42goVM3*}!&PxEs(?4lyLdn1iQz=^ol`t}#_;dQ={Bgin zBebp(v{84bO=fWNlQc-_W#b*%5CETY_UIVWWPo_9Sf@Qd9jLcjB!742ELx69x$w5= zB3PRyNoi6M0U5IrQ?(oC(dj4tHhapHfa`Hz?$t6jwCVQd+szaI>JBQxZ1P=%K)y=Z zrO&eGko_99rtIPw#4A8ms!Og2tfvsvuT%vbIxBZrVj-GLyhC+~Rt$Vn>;4X*BJi*k z^*E6vgXAoU1s6JX(ILqL>rVv+Xh%h|^D$OJ0nYO6AD=m*VSQ54A}J+Qyg%kX5~7RF z9GhcwnGgdMH}cn3`ZYj=(eU}J2LhlO9r!&{JdY-?(mp<8Xn-`+Pd?KilmbjATfd?+9=-9)$@xD9DE1IZDNIrOA8o}}#-%~l;5z4cUMO*i2 z-^KSp8D6@vLo@-?;%>EHZSREjf5d*M*{;GvB72EDzMJ^UF%`Aqi<9stmy&_*-M{d1 zR;{2c)f8;J#32;K-ijZ!rtfOo9O0x7OD=;VL|^8uO1nil=P+OK-GG;J>$vl)`w3UY z321s>A)AQ27wV{{n$ec6!=9kECN#eUvvg?Oj)zk#2K9?X1wCEEp0>rmZ%fa?)8~{o z_L_I`8?o$Fh2;tOE18Ft>uwdi^)5TU`tmx~7zm>^x(B~j57P%|9`g{pK zWBD5@BE5k#lB5p`B!=;L{m+l}a}muf4orMnR@{hq4qAPFZs>cO;0v?h8PQEMGR2CQ{szFH9*Rf3m8%@ig$A?i z8N`}Dpvh#q9hjSkg@HzE=ld(Mbm_gNFTq2QT;H6}csw6l=Zz-mOumA40|$>n1qZQs zPJHaWol5Lf?3e$_e-Q7%(6iU=-a_kljDw#Cy5OV5#n`^@->{BL#b(0KPF(&@d;IHY zFT8_`Xc~-vV=G;*Wyblp*hwIw>+E1Z+?x%Z>x-Gjd@9GJslL`hEh7e<8Dn3xl}VDk ze=Z4mgjZb}7Eb`i1yXCD`*YAM&6j_YuRcHq-39Lzt;>-)oBP9iY0ts5(bC(O#YV_q z^5D<+@Q2`4tncXuE$r0TJ0GSW$ZDfks;Eg&kpt5*G@;(3YhF$$?xJ(#k-@vvbFjd@u@`wa#50 zp$mibk?xb1zemC9UFGn&b{8DDQ}l{vGXN`2-#&_c8V-M2G0`Qa1wqY+%$#$jk+|L6 zq|&)I6gT_1WbujE;=K~=n`Q8c_fGH_q4rXoL6ifx5IrH znEKoCgkdD?;6=`poYpvHNJF$r)C%szHqjT;SVO%?+K6tB``A%ZQSptm1*U0o>|nfi z7p^M)qK+r0Lyt0#@g53sA|C2TwQetoz-F!4@#}8;bq*SyU$`@r0Z-|ND27X?fQJN) z9c42K0;}&!jW5Z8Gizd{FR!Vg62vX(eVQFTb$jIWX-xs$*5?_u;e;S8w8uI0Jpgf% z@7y&e#lh`N)5u!kGpJTVEbk)8MZmUT%#z~6ft>X%lZo#T0lt+-rj~SA;ml$WZSDz8 zK;5>VlrN(I4$2eATV06YX^U&e&MWPrh1Hv4;tb(%h&ptP2?V~bYx^qlIpnTcz0q*ui#wM1y-BU30%s4Z63GOF;Anfx~eq#dzGqhvyg4d@em3CclI> zgD0)L$S83n`=tl99|)k5aixoJdLFbKin8kKe}+$OJ(VYjeS=SS#1pNhHQw*|u#*9&)7e@2Q}=)= zRiDrN25iun+kxlnePVbl-d8qln*+YTS-EXV?sjt%! zq!XMlr$F)L+=BFsW=$L;yL75#2RL0hcoFj(EopiMg+WsQa2W}dd&ToT@ zH=L8D2&iCL!D@y_4F@#iwG~%bI)U}|oB360PTW3Dqs$#w~@y2L98OYXsn| zuP4!Sy9Nb?G^>XM@-uY?Mdypk(Og|&Ise$(@s7HuA!>GPAscnB=N>W|UG1+MUN{~9 zWMWa_S^e37FT3k?3WY3+nH2kV@>UJ}JIaR&H;>&6?xFZySDL)3M5nu6Cv|gWg52Y% zE;W9Jp#t?PbZgRXvx%|KXU9@*i3pvxKf{i7oiq6y zmwfRE5MvCho_lu-{QXONDXp*t=<2h47MN-S>#qm$LF)jr7rAT$R^$nJ#HHW2d}*d1?^_R$+&Z8W&3`h{Ve*% zy|M|kXgU*eI)DL}oL|>}Fv$elXWTffh7@s5;p?1q#-G%YOjen3BIz& zR`y_60$&xck)Ew$grwWEchr(3Fre`49t@L)3zUCr)ch17ML_Re)ihb$70dCcDO>_; zPhVC%;*!N=(P!r0kBejC1n!?_71o`*5H z=hqsL*H`98ug4P6W8G8b0*N0$xy<|ej*d47&^G=i2URF`f|h2rCKu5e$Ho+#PeEgu zy+6FPUZc|^dKa^AWTMXrKB<>>1HieUw#sIu_rQIbi`aZEAEc94aXZJBpm#3+Cs_Oh z626k|e^*9{ zW}3hYr945siXlY(G?=DKY7!WQhu!RR+yKd{n&)n*bpiUlDl)m5#5-<{7B9;nj&gBCXx9H=;|dETjZ^xt&!`zbdS1F z=gB>0imX3q^o#tFHP2Usp3kHe>8>OFWQL%kUUT#_R-EXBTM`I=mK81eA_B>EO{JSU zCn8aSj6uJZbQJL$GFU&zMrDR11D@Ca_jeiI(a(OFAVM!Tg6hZ>u*K(O>)&|+mV*6S z`4gU@Cp#O-PbhN1{MWOn?Z#7N`LZxCKQ{D3BA_9?0DO%eNdIhTg z1o_IT*#Lu@+xK>^=b_)tMz7QZi%`DEm$$D7q7bP7-Mh;|MDPsc$iEpKgksZltTvw$ z;F(ijE<3Uw$4#tb*48Dv;AmzG&YMqNWo~%g!xC9Q+<=kHlW=_LE_#^X-#fN>+Us+Gs7CZ*>M*f(eh+aj{l%k8J-m&68 zUrUZ?`fc&e7ykVMKd-?LMH+)^AMEf@z_?Ip%{AD)p&_VtoD(;?GshM2t3c6v-{-Ur zjBupm%X8y0dU)bqGWT6&GyGblE7dOC9J;ua_{ug*V#zTci|@Cuz~GeG#)<)3>`r(? zsUhkrBzi;rYWdDpJZ|i+Na}A1@5sN<9AUkTC10Eu{`lcK47Phd#fvw9V6yMp>`iN^ zVtKT4H(Ci#I2lUVQA)vt=7cvKjw-mPN;^KM-4K!tS0~J!{J*y{zlGhg*Tt+Jp=&}y z+AyUm&Sd}170kt_LVadM9gjOdx3f^Wf{z9%AEeYu!qY4g$?<&3(3UU9+G#@!bJVko zq&1(yMpxYSS0*oDet)Fap>BXzz81Lt{z(SEF7~MVKIO;N=eu^B3@&3+b~(u~LSby* zmA%#wWQ#v*^DmM#rUPbT)qf3-o}l|RBGW=~aR{p#TuGjKhaUg?k;T_k3RHUZ#Ztez zqae5zqbFC0h~3p`-9{_Ga^lmO0n=Pi;!Bh#d$9uKDsTu9vmkWaxbwR@Lpu1CI(baf z^c^}%vk$5-DFP40F1TAM)gcBKsrml=Tx9?C<48v?p_am z>!OG>rhfDSmq`uwdpl(~6a^XuqDtz1no_W^+vtS=C&Z(zh;j>!x zaWD$RKagA5(v<_AEq|>khgP)J_ zl{Mp&3)IT^dmxbMhS?|1x;-rRhO>`IIVIhN;Zbd4I|HRPG+q}fw%5_c&V((tEQby- z|1Vhuv%4vbnMi;IVRq2(DPg^6njh3~sZBWHdL63S+ zdSp^GW(~i`$glM@+`^(CpIdsBc|y0Mt`duCTNt#M{H>is0}pz6OG*eC!I&Lp!6E|# zsF>|yVJ2aOg-*ph^5?REqQ-3{iDGW>NS@>DN~#;Q8Y`N&BDaU1@0q$A7aAZ9#;VuE z5k_F=z$U6m+!DEdJJGLGvMZa&T1vM*pgWDd% zVM#}JV1vS$axO;)*eP5rS1^Idaz}L}Ox6$-+i+8pNL)uH$r_#yt8ReWAN-H=Pne?_ zZ)`Zd>V@2HF3--M}`e;5W|gqUM4pcdynY5(+~j9vK!? zvw&z?qZamETfjM;qrkHnw3y@JnF}NU;M=n=Rg-On;l7Gw!iO0KXyq2U7+>~M$QXWmGN1DfNCbtjnvVAc52N$2!xkSSYvaM@d{H+di!WgPT*`KF zUT&Pk&EdkW$J+U&nHoH*w?_kD8>AvlR>>}@8+aKFZH(<_Sd&?~(H|1MR6UrUx{Bny^ok8xmqE;%Bc5*sn<#{GXT0qOHEg47zkb_&4YVDk#*6y9Zp0D0)lo=$Ilg&a&xw6Ds-xJ-Vzk;r?_79Xy^lO0-!+D+8J3 z=JY$rHZh+!Y+?ZvI%_Ko0YzMz;~pz|O958c-rSx4X$)K4^Co?v4o)qpk^RwV4_gIW z8a+>2V})NYIwW2T;kUn9`$YImAtQ5Jgw3=mJgUzTz0RQr6?yJ%|Pn0V!0ip41YPa9HS1C%GI)4)8*lm-cMxfqm1eH{|=nYkbsr(TrB5nW#9wb*V6|c z`cNT}q1x{Msdr*gZ+^-EK1_A*r&*muEBv4HD#*vsxQdUmR?sNoD!NKPcYOvG)_g8G z%323R+{a|?smp;O{mVLb*KTCnuE)NeG>w=~OC95;-v-@$GhUw5D}W-vndAFLADU3P z*YU@80A=L*j_}1S0*8Trs~+E{(Mi7gt+se;Ajv1{zMQiTSO?qlS;+wcm_ZACd%nAA1K(pKtqxZ z_kkQ^*>+kYH=)nTO0B8>yEx?HRHP`O0SsM=-6BL%*!zn&U=&t??S|DN6_LV_V=zdi zb;%n3vfA6w8xa{F=?+@3Vcdx^|{IE;6H_c!+XD?aVDIx5+(^NWhRS!Dq zTaK>3v=JJxP#;}>iQn&NG7iQ0OGFA8Y#xsRAyq>S9V6g)Ev>mrBW)8LcJ;V$CzR}zEgspVL1Dp!>K!$u{_s!LXU(r?2vN4 z`yogMrwDL2_wRGz%yUm>&hrRDR~}FPozJZBOEkq5-)$Z!_1&ARkfsy(?wkD(jj0B= z`HhKQN6#aPoP1%h*npx^s#iIu{=YlFx{2uR6~N9&TJh=6IJnwp8|CJ>FULzR9~(hzRDYcx)vkl>ju61i@|xr?mqP3UZ8=r z-Y2lscRM5UupE6)6L%iFTmiNogooD3dWcI2rJl@j~wjmalu)#?tpwR9Ne0%C;h}6#_iZ}MALiYilNHnxSm_Eci?^h-4ZW+ z5z8$iT2H7^1Zzy6xk1meoX^ds-dHr$hAouY6<#T6i$5DZL#2fKKFIM*nz~F>REEV zK!v}(8mZR9_Z2q%e|pZ+JXcV8J3nl)Jpe+lQtbS+oB`gEtps~$1N4(*rEkuDK~;70 zoTKBL=&-W*?sIBl4695HwpT~cdT;-P=Fv9#clunD?e!h-KrcJ{xn>QTKPj%;nX?7X zY}xV#z$M^y-o}1{e*it{UlpNT{|(v-6mtfbM}gSi*LTmQbb-@kZ3ZGJ(>`1E*wv@ zYGsB(VheFd`3QBe?FC+uKY^otf_3lHAD~qe!H;KY4}s6xx=p6VG!o#VhC$slaCCcO zcd6(nU={v*rLJWIt#CiAIP-Y}vCHB&XI`-4B<}OS@`s7A`{P}&WHM5``Q~#ojnO`6 zI1Dgy4eSCtb{}18nT(QsuWZQ(iBk3s8QD9cQbt0dgkDP>`}<`DzdpYPp$3(et0F## z6fMx2wP}Ocv`@u$d&ww3@p_Tdueadm^v!<+qXnRD$g##TqX5`(SNGOCJV%P=@iY^A z3=ms>e*66jInLLF#|w*&!K6pd#COAgfMB5~xmwKqs7ETVz3g}|D2Sz7k=-K10gqB? zoCQfSHL<8_a#R=a+kH`(lSm5tpZNdVXQ6=syfe2i4eg@10P-_i8>>LX&Xk?ZWC!st zwT2gp^21eCZN`spxS;SA>#}jye`xAr+2`rs!{`Fzbf;1C2Kc(A5lyDGgh<~AO^j(b z18O7274z*v1VTkwEp=v*IfK21d`mrQpzAc~o?k&pzm&r${pL|#@bM7S&kMld_Q^AG zhcjTlP5wdX`6*O*+VEn!$vkN3BfMrRH3^<7zZrmk-lIgC00GJ~btrA;ug*ukGDO}= zZR~m@9kKd6C;V(WizouUw+5dyfI!QQ#m$XTbSmJRL#)PkwAzwc`LwSSVb(%9d7ch% zF0;96alQ+*sHW#)sw6N;CBsL4D-v{boYN?-OGaL7uZ1(I<3NGzqP`))YtYzrf5m#S z1XRCv5;y0MMuXDV4-Vz-q9Zx8K<$7WkSA6W;2HS_Fg$2jd zvjbj0XdtUq@mfAo8x4KpeL52uC+J(({eBL_<`$YhIa~*i`*dQya3`YKg>CT(XI~H_ z8vKL^2O#;ON3N01p5RvDYWc_icXqD;IT0Gyg@a^9!cO1TkX>49t)FQyRN*;hc_PCb znlR9023ea!ZYgz&LrZtK>bLvwsX!#mx=nQIM~n-8svfYo+3t(`KP?FgF$Q3!vFcCH zq9|cUXzWNvsUOz7CzC5@>x19^Y@}o0wSftX0)5U;#G%dWSVJfmfNwZ1st8t_!x*b1 zvVLWItj2DgPqLZ*Rdn)!d~Mix_roD#9eTCK-#UXB#XL^xkLLlk@>jfeXLpbk zWs9o~`#kvBDc#x8u!Gp-Yur1}EdbsngSHp<#z4*d;<=ntONdux&&a-Z5pnZb=6*W* zh7K%@^%pxnf`pD6m@ob-lH%QxJ(s!$UY>fFb0V$>e9ZXOpyR)S%4|NXp1n?h#h4g` z23uwT&7r@m=Bm0TZhS-4gd1h576l+b z{p#jFYJ}D=QNBF;s}yW+HJ$#W{sAc55+T_;)&h?HxH)nK)u6NQ-Vrg}PX~)x_8QdP zy+E}kS$Ci!83_nV5uC^^M>%7jl;dh2Ku>o1(z0zF>L2O-W!Cc^b&uXr>R5RJQe+l& z2tpdbJK_(@f*tipKU?+one-NP^_~%EbHt#8Dd+*w|2<(hT^vIlq7MC9#hu6#Xd#uy zH9-AE01^=;&tLtx0jNznAK%~S!**R2T*6_OpyhkVH9`Ru_+$K(bij-J$&4NnRXz`F*Ui_ZcYqCHGe) zi#m+@YplT{EePK%$1$Fgmx94vQ&(!11+bZQ#ne%u82($x^II-f4ioek^xCSQfGI@6 zlU(n1kl&g7=8hCPczrAIGPyhx<~TuON>xsPzdQdDQ6cz+P#Akw-5V}^=~+%!PA?A* zAPcu!xXuHsqz(irNmf9u1Mhgf2OG8+2_c*Aq{3DWQ=!{CEO2W(cIiU@ArfkM{@6{F z7Ms{<$H_XeW4TqUhMZdz_<2h`LnNO7_G!^4GhyV$2eW=DFMe`DT@mL9g&`qa_jrn6 z%3c{~xIS~Q?9#yY@9xt4@wx;%Uxe<&Td2T|H-{1b60Tq#kj2UvqX<7z-EO+tD35vK zJZ%p36mV_p%|niI0XR$^Y@Ovy55IB-s~9Cn;g=dV-|w~)VjKQCo5>6bSsp< zCk3(ABhRcfZs^LpLbxi&1A{KQv)tFF#{|@V1L3uF@TTX!iK3V&q<<>fS?F^bYTk(d zb90Xe_gP40#cXc?>p0~z(hs% z-}mTx9uVUap+yC!r9H&aN!t^ad>XT}6P>0zJ&R~&%6OE{oWM`=)PDZ;-vUM#e2%HS zZbQGhx}LGwGho)igwzcuC45^i=gSP?SuDFCYhlAI3HyHXp5&fBjRU9V`d;<&LVD2w z-Mm6hJo~8bNGyv1Tl=>sBwpr%xyxK+DoSVZU&%O02Wv%~Cm=EWr{)6uQxiQ~NzMnk z&VT9nXi1BM8SUNf4wB=yr}gepbDxBTFB?dx{z^fTtv>|vid?u)-CR(`L>k|ndvxDB zlLvAZZP9ggGeGX`RiOkOPMj5f_wCxscZ4|;UW*zMz&c|^F$>E>oIVoTVSzNf4 zEui!d$@rHC{i!|y$-WL$o&9(%7M^K9 z^}?4lp_>#IJvDUw()|-$9ORozB;G*ldF)m%UL2xZ`P%wf!#@yd(QCJez#d>dv8jNK z*Fa0jH+K8rWe^yo%&1F41l0sSPH3E-1O-gOlz40a)G%d5^U1tM36sB6GniU{rj<}N z9jZfq%N$q2sq&EB$bPv^^Lrq(Ub@PV+K$Si7^%Er6L>8B2utkuA!>IEJGS+Yh+5CX zhhnJ?QJvoI8!GJu)h~l2;u{-L)6)m)#xlc5kL4l{qjM*ySy%mSEkA}bW~fd-OB?|~ z1a{6}Q~SUV;Y(({alUA|gpIX>V*uD_u#_8rsRxVSCwQD?v%rp<-tm`>f55fMhA@f? z1aL9i^u4O)KhRh~dK1eGqVtc`$;uACqTA0pi%ST9p`M`l05Q9Dp!2U!?efPJM3Fvs znl)|>RTMoC)z4i*ZC%xd*FXF~j~DCm)o5ox37YQSyR(d{S=4FortJgY(~g4EXVwu- z4DYNw^$w!BF%?LDSPPzhE#9f?{|%%(R14l+S_AFi&hFSPB6wuBXeT0SfmWF)8^1*P zfKk6TnuoI&(U>h~yMCPkC=~CMy|Yb@Xv>dv4qb(4TQToV%~LxRS7If(pl5^JuQtUo zjHn{lADvr)WFH!X+hF#+oYsv```;DnlU-tSMABu3Kt>n@RT;2^VC+Nc6M#C|ii0*N?hyfmfh? z^o&g7nPzaWH9Snlwi&FQR{yD^j{)uEgci}YHq=J8s@10X1+9CXyEZORimJ)u#tPFu z1Im`GGji)?=Ge^0Ir@gW^uKKl+~O&e9+ncDD6a zINpkMABfe&QAC4I>j*Nw0aqmM^=!%f##`{=_UO{*uRp*e&Af`+S31z*ycqfQ51r^~ zcF-HrXMfN#kxY%Q?i_k!UDR;Tau=yH6SXd99ii+s7b1Ge1H^hQA}NG?80?KPOor0@ z04u)M`_0*hfPCn6V#cv;YZuGm}XBL6ZTLZ~iG*hqW=e;NDV4s{uTl+rPr4tc!W?-pzT> zrVq>1zW!UBPw*Re0kl?1Z=WHTcey(qiU+0AKB?cOIUxfJ;AQ zs*e#~z>IIW-J)Kb!ZevcGJOR{kWHYoJ_te)U4b8ew7neAtL2_p%DRJixZ8so&cz`` z-P9lV=z~zcz>HC^)-5m>!b!1Bd>yP%>wKF@xB==GzfL`+xC`7H3Uj=l-9-5c#FbBx z4;tSCW*+69AoSAZfe`8RHF{2RrD zjQFgi%p!sFRf3^`Wgt~gb<8=U7xlRv7btj;3GRzB7){@v0BuHBZqPQ*fG-=b#>$I( zL6?90%2C-zKzptwEAFrldB;7zw|=W0JgxNJNE9CcUPE#_v@?a^$@g>TC0qJ|3ui2g zuJ8-w?|bExUVJl192TLgHTi;ShJ1cXbY_FE9Q!f~X3gMxq`Q-K-Z1bayBpl^_5s9D z?)6k3wxX#PB9iAh*?^YMW9be}6Ik({4JKH>hn_Rgkl(!U2H3Bis?zN2LDWO;Nr&`R z=&f#z^(b*QV0fu(=@?W9#4Hy7|G!4`RfRgwp7a}_SJVE(ee*r|&fdpqxf=!EuScGC z8Vo^h+TqPFPSt@Ik*|YR(<+e2l$Z}$Q~`SJT>%Utj8T}a+? z{4z`01my1sU)2834-$8g==wR-nI{9eIuBEeH~LH*sdU8%Xxg z$d}}{0tuI^F+mr`LE^XEoTcgYD%LR&mYU9^#X(lCSu_1KRhbo4<_Y28K4^%b>q(i^0SenWM~^fEx%BogBaiG3tp z3i|E?VMp6c^fHBBf@(Gc?HL^33zeus>(pDWm2~FFj8AX;`QO)wi}8jo@8|>c1w?v> zwihFnfV}R2r`4d~W^tKJN&>Q&UwvPcn1yN!US}wT6#(s2arJQH2EhIPm8CRM8dBOk zo?<7O47zVQJY?$#2QM3p_3}pEgNKg?(JI$76!xw8*U6@*sI`AC&-Qc`s>;)MeRU=g z88sB@e)_fzL=J3j(Xy|D`wY_KEGgZzxQT%^m4d4o-#ojX4Zct=c1&$$yp zXY!eA<0r}CtF#d_nz=~8K`fZ*#^8%uuNa43V$1+(7GKqiIG&+@`~AD*bjjdAyw`zv z?GeKAk#aUnHfW;o5d{>ALki~uDQ-QsM+Rw^4Kvmf!EF};fBhU)Ff}%gV;@8#-8(y7 zO^@BtS`A4t+XGLOSVTXm!w?6IK+k~LUI>tWK4@1n)@5_#(S2IP23sj##=UX9}C+C)de#*K+V#0TnrZ%px7dVdMb7YO{ z*ZV;WN0wS)S{op1%$q~MeuDG>Gy2rZG89Jiaj`7^572#b>Vl94HRPl%yO`og00|@{ zlvdK0kb&JPPnz?8k>N^1=8FF=a-`&F=S*XQTlDdpH|02RVs(MA?e-~LyxPULXHbvq zWPEu-OlHtfMbm?F(RCC7i!>;h$>7KXo8(z7TG%sbk?VQsFA~Q)MAXY9Se0cXp!EGR zs^qG^%kNAH-<{{JYGOD5YY#6!Ow{WG)CXrc+ZNXVo3-*~dF$)gT~Bk|uuU2MqVT$+ z;1Y`6_D*uWe(H%?b+XFLID(<|e9s9(Q3==?qOMEGa$be4}KZi8{~Y4H>SAYrB_l04YG$ zzmPM>-M%z6oTzZZ#B*E@YkKOfD6wc@!i?6Jva76^V=|}LBS-{)eBco(Ca;E@^(Dyf ztMS9sTj|vYH(4-E8E{g~(S{WuPtK+P6lSQ}BoNt_gT{`jjcS`R(AnsVhME5Y>QS@p zS&MUo5*0U??p48E=7BGu8)ns}543_zl$@XZ<3VYRm8UHK-@g;MDhXXR4c*D?y^xC#N{%!BH zelf)z&$S%q$90KF-JI3_fzL~@)Yx^Y*ft9scOP0j@UQ{#qjyTQhHH_)&xeb@<1zs` zNyR}(y9IC-U`{#N+Xb$CaoXf^E<{{WPM%Xl?I=(86K#uL3}O>HAMDE)kEXs$gsM8{ zfcbCiFC;@9kSX<}O((xfWZEJ9Y*4QUo!Jn&Ccl!6W{W$;&wg(K#)18dCx4Od>v&_~anIixt#j&X3Vvu?x9OP8_&2=_UK>b0ScF?t08|Cjn{j zJZW7wiUwqXnv!we@u=oz@&S+8GjOi@`%?SE*TA}9(p_ma4?Jt4H9CxX09e?*bbomm z1JZLv+igcuLDT6;1;N-%bURtnzbq^Sq%kDgpMOvd>e`1(1Iyl``3n(Z;meU=%q#fR z>#YQEtnlpbzQ|X=CGZ^oAxk2PA!YO4FHr-z)I7qPlN8`?RFCY1RySnix~uo{rUQCV zZkc(J$pL)*{_)A=lsd|eHMXz)<_6-+tXdXE4Uo{`uGW^R6rzMo(Q!w%KxQ~W;!2!8 z_&|DfC3{62Jr1JV=W5ji(P=iBw-f`xUAoO|i-4Pm;Y%~8`ae2!Z{g``yMh}K*jo(* z``Tz>dy$3lNDm|dYm$*i)~J~Gt=7NS7RWDFgl#XK6+eEMW)pA34|nI9s<5MrKsG!*?ZcP~4BO^+|fD+uzuH>Cr6E5;~s1yvqgG$gN$>vyZ_E z_xnF=H#l+Z?XDZH?|uS`-+r~ZKbbM=?Q*@s9<6`%XI zjiK2NRl4C@Ofa0e{8U621>W~C8BSWF#+ILltiwczae`06m&tW2=snH+J}}h-`&_yz zm+-+G#*cH~{ZniTZ!N0ajUsb_J9ck$^Ix8aem7(JB!{iBHXVa`xvYVkWGk911}p#XiF?t%B$LqMPTu^K$Oj~?MW`rbodOs% zxTovB)FBETR>94~U+7SHo+z=j6HHy#8B->m0JJkZs)EOsK?;8=iEHF&=DBE)~^MCIwOFNFL`kSbW)^#HvPyl=#= z^9(Vk$@ekwBq21&V9w*Pi63?b@lJIgQ_hHV;ESXFjZ-am{=obVynEo&GJEz9d?Cwh zl{loZ|KVeex}sURD)#VueJx_V#4wDbWS| z#PLR3+5&CU_UZd)jqZ{)85eWt7ah&O@Hvap4wfIdoREg_(#5}6xlN11Nv;K62=3z- zRr!l`=18Kn(vBd1MCcFR`_#&%j{Mtwp2Ya?qkew#!$njddNRAvd>tKBJ2X7ZriEnt z#gj$&1TxfL!;asNC#L)Jrncpb+1I;Ib@meMQdN}g2HAr z$1ivEmU0}w}A_l42!lW=r_Eah12{!nLwz9AK zEH^BYp$jhdzKy*5%msJ&$ARI8{_TzEHE>ezm)q*AX{ATPCl0Genj7C3YMUERZ8YBg zb7I3Wr(db^*f$Hy=}(Q677+$^flEp`V&Z3P-~Leg5->aIn2a0u1SP)Df3j3EIEV`U z{Ch>|8}l>AQJad!`)wJQ6h^z1d_s*H?wTwq3FsVpypP{#+>1B9xkxy##B5>MP~qFI zlx8QH&rdzps6>AJ*q^+~MvC!vM!AiR#?66z>Kjqt8aHb)sg|#gHEx%gK0FNuLG#x4 zUut()FzJN9V)838>|p4B$n=i@SBNTh5E|3M)$u?QxpWq6A@qp!k|YDXOg7>m-!+eN zjYjE&AThL)8x(x!%LJ>8OkTUV(ZabD6T_9oUBoPnR69PNgzy=TZLwy@J9C5lCHGEZ zHs)t}pXEbv0h=-R6WZXER*31D(U=t=xfTh6f^nNu`cny#F}JB+`B zSGV}_anmM;)EIUwJaJ`E=Lrk^ynBD?T`nOW8gfySrKN`)LiG}<%&hq6w2*GA3oC9X zHO}m#Bf|=*B+UNSe-Np8po6(DF^)KMq^J0f3kt|Azl&@p#dZ&UUmkoW#3!gpe!4TX zf$>S!+`K~%M0RKMikG$rn16BUEMN=+v$}+;0ZxfPJO`hD+IJObNr#U~hliu%p%)zn zPB|fNuMp+sFmEJ0C}Q9KF9_Xx-(%8sBNT{*)sI{pzY93Xl?aDRB2W(Rvr?)2AatOe zBQUJ!gOWb6&-iLPBfj9V0s{YdR69#RB&Zn(lD-abx?PDwi8P_aebe!%;QF0m=cYJN zI-Y50@O#(?*3q3M`LiQ;3D7s_JT5yti`EwM2T>F!;-HbI zr$48KawiSsm~I&$Bd;Qogu{!-&acmjsahMAX9(F0D@cMXGJ3kL5&Y;ZL$C_(BOdg! z?euOMks0_}Kk|H;MFnX|cGXPFIUu6j`6^P52`GfkOO~6M4KTDsY(KTNN8iIg`9;yk zASDwGRt-u!^tG`cnP|oW?iQ1%dzlFcr+6DSPJ%ln&l$e;gfG4l)URP3uBL-g$FGjzYqncWFXRV7O$H`um%fOv2nuO?N-<*hrcF}{QDJPP zE&E2|@);Q0Zd+Cqd>&I6iTAZwNaJe#7^6%|In26$OXPH#99~;X4SgUWk1PLFTF@|v z!*>pQl=4n8uzRz5%Rh=ywDP3uRG}n3ApY%` zOMM>x)#RTy`gRNlWYCf)*7HJ1HN%?TB`J7epZdG@Kt`x3Uyc zhs4!tVwX>e<2!1hgNH4=IL*m%M3PiKJr8KHy%4vcVxlzAuch!iqhp(wogm<4m{DPb04Dy%bV zyS8;Wi)=2p*@gaP#(CSyftGsf$oQW7Ps@h{@N$5Z<-H4B(85{bp+g}BUUO!)NVZ~y z>S?OF=e|w7H*^fE zRQa*qvyjQuOjV$NLh;5WCKo_?TG>33Lldwlhq(4A6M$c4$A;R8)sPb*AFW5944Bj< zQyb~AKn_25PYUNTAS&-Ls*C)N;G?_r$1kTYftK1Plpm^r&c%L%uRE`T%j8EA24ot* zDoeiTWb+NMQDCItntvWO9u3x>ox6hW^8fH0OV$UEOry+(&7?tjsMzc!)mwO0ne z4nso6hTbNyJvNYIskMa`+2e`Q+V+6_z<8|-^9q_Q9c`zpPze+=eU0( zIUaz_^K%@35oOX5!+ky?_)0gYm2S=lm^R11Y`J|8rB3rC>Nr0Hj)5tPe*fRQO9kW3 z7iuja<~Hb)782V2pgvTzIAhozUfD7mT?gMqd$jh9VJ25P-lP@HI)fU4;kO$S5Ypmp%@oW|ovfX#Qpe!um99_$-R z@QFtP()Hg|_e(O-kD3Q8Zkunw&IL)4WDo_aC|9Q02m*j#`_WYR*Ho0p7<1S9Y6{|; zsbfmMpNrhgsFHgFA0TfT0%YW#fXaqD&ufn)f-gRtE{YU7sJzSH%R=b}$h&;pjhI{w zSo}Jm%p|;mvQMN@tNhO|V)wqc6?70xSmiFw6S;yS%C7m&Tw|m@oMXzhZ;0yExuYdt z+k&cFLONul79gpk_Op-#D{%SR|G+o=Hu9_re-a!cjaF7jJdVcAQ1w970mW%saHFtU zAv8h;Tzo6hN%Ytrh1@)KflERUT-13uDi&Y@7V3`EZEs&j?R-=_W5H7>35%cl-lmSj zGS!rNY~`Ab_wh44e|JX}3stVm4#zY(iG9mz?ePZ&c{x?vq=cbzVHMZBmX4J(9p;m!|LhCE>;ww~G>=eC!4MwWLl#F`uxH z!s7dG?^qaNEj6@s^8>sodJ)8BzQaPv4?oLmWy7*Tdr=#P=de*y&pUA|4({{$QkP$- zgszN=4C&da_+99uXb;XzTv2UTVXWPR-;I#oPY!Ow9UMWAx{TT&#ePAbC0ia0Mq@o= z0Tr0z*dH=iEsQ(Z@6mfuWMUm|$r{dw2s(T}|I$XN7V9qqrRJ(SNNA8WN>$v8+bOyw zzfZV94dTR#V-DId_;Nz*{bGICUYHj9meC5nsc)7I~a7jHgBO81^ ze^P4Wwk57+YTotTHpOd?zxW=+m_oBN=b}{nrLnNsO4>q&9gHPc5|7Zc#6yazx@Anp zF!D7^ZIktNI3g%b@4;t?uQ{cNwSQK`mJuhOrOQ}if0Yo)qdF;kea({Yb*}+D_wLEJ z2B+JQO}kQUruQFmrA+sXPA&()o7GI@=RP`V-*uABrUP;RK65coV-lPvc}gkD@Dpf< z1b;tT8$h)htw9>a3&4t!!=!TM7kE&^?)dN25Yi|+x^q2!10+c=Z+=+XKsLLAr#cO` z5wp^k@iI{#SU1~qZ9kYo#6hyL1HL_A#*6G+D#0IcqDcZK-kt#$Yd*F%f80aLMDc>l zJVQWmmtEQ~*2Si6%cDlR5Vkvwu)2y~hJ^$BktCKtZz9CloC}*+z7eaF6vH4J5849=9U$&Gr#(t-yjt6S%;pxz! z$2-Chis)C4?mDW#SG85jzj&_WoKNaKnOEiT@LzVr$L|I3ztMlvCn&V>xZ>V2Cy>Li zhew0)w-RPPao=n1r8+d!;13I8Tt{-mH5y{tlW0t=Q?!5nGY~zMaeD160h}F(24jL# zKt%AK@?V}w1gKJu)K<$;DADayN}0bPba_QZyQ~K|zc^^iy*CXm)G^R1u41$>BEM^O zuNBdV&G=|0&w(*qw_}{VhY}q`1wWV_fFWs`)|r|m1SS^v8d+zMNa!WU_?6$F>iEgp zTeRh1@8r78t@B@joY~ON)tPM+|NY~q@q2bKNnT$2{v}mx7~`+2tR4uTSMZ zsEKkao_gc75JvZ?2ky|wg^kzY!Zm!-N0j(;#4XrZzFZ_|6Nx!kKPJrZx!}r@5>d8e zzSw)MAkwVB51zuS!hFjXc-C{8KD6;F^oz4>?a`4s^_=@2AYKJ=9{S%C2eE3%ESqbUTTTgRr4`>U553(4y1S5u?3;7AzCr^y5Zw zX+r5;Og1r`;U#>tGDwVP;Wcj)SO<#p^%4p-dQbqpcjxo3v*6s-e=61mpApTa?JH)& z_2^w$_!@HUK)&6U#v__Dz$HLQ`p3(D^!H%*V)4)i#1KkYD$aR;0`GaJ+m3Dnt7txb z!dMEZ(#DWhraTWi7k_Omr+o*ZhRt+m1lLgnT?g%5;&t%9bG(R^T1Qv zz($pPmThzksXT_`MUh+RUi;dt)Sq7TZgzfhWN!`eG1_H)enk%D4p?%U2Y!Ql)#QHX zp6vlc1MS#HjpWeQC?}}3`#4lD`4kj_iE(4mdC7)(0(_pfj_y4xJ$_I~(2X(<06alB zx1lzJ*k`$Ygg`_Zp;LcCjPYxMPot4FZ9fI#!^=`!{M*xtk zXxXA8#noCQHg+%9(a^iAAKuRs!qXNivubvvSXxh6?`VS(2G2%U64R5wEQbD!XrCyw zb3yR$v;1%n8|yZAH9HnrMCGP>4MwBfi*HP<$!)=2qyLpxIzgb#AXLg~GZp<%FLIAQ zmjeD|*ir1iwnqeG)%iLg3|(Bhl>90;0W3tmliG~6Mn4rgmx$W$0r7*iM)FVYAmycm z)7j%5h--`BSZjJ1dUhx$$_iM`^&;pR_@8^eWKOpXxSI_jP>jAX+|}S`F{^Ggoj(>cVO7JKNKF zteEv>y-`B1D()TeXy6iQMgDO27UC9!=Hi4N?%%H9m;Rq}l-gx+TrQn76_XxTXuMBg zwRsZC?LD;89Fo8WFUoef-|9ff^uh03oi;r4Zh!muJ~#Z$scd$?MHP#Pxy<>SN@4eN zuav%j<-w}9Ed0AFk*L0HJ~XlK8j>jBDniG-fp%0~Sx0d=IvejGC3GneDQI!akGh+H ze?BG>>GJVl+0p&9w3jFH##+B`MBGHtgzG}wTG42IBqulSrXL`kavr-@7!HD)*Rrfg z!og?b*A)d>PN-_IBehl425gB=u*N>I0F{H34)YcFzy?K2xSB^a3b`geNA41e2(0c0 zPwR#ve}hb}vxojb{`}IZ>)#X6Wid|In13~(JR?I;Pct1wQW}Nx@n@pxDLKU-?mnZ zjd_a1dyjqu*1SbZ?RU<$+;vAUmCZ`dzE1`#e?K`W_}7CRInLIV_pxAfaU^VwB>_CH zAC9WLl#I0NXRPjMc_ENxC95=21w!iErDb-@kxx3SJlpnTl*j64E`Wb?z48*E|5fR-S9ula^w#|n(PE4wi)3H;+dTjQ5fk5(D;@*Q zw-JRa{@GxgyjjHaTQ0g{zo_*5AQ{vUag#Cx)POCs0O=qKjB=|^H|EvX0(zC1e-Vw( zQ1J6owVz3aU?*$QoMJ2o6iarfUzU7>h;)CPDOY}vL<1})9rWwbD$%asz=`)rR^#c( zFTcp10_vEWP=P|vhSp*tIOXR`utWR~6&Gbc$Q{cxiH7OHRoZ&dJ`XCDo z4Qh&9XYNE>q3P#?cHaXgGTGrCsu!qy^y-`P`AYC5;H`$VQW^3&!S=Jt*#j3n3P?Fe zZwNWgSqq8oh~caQu>581VYECsaxh2kTBZk#WiOO+{Z-xYT~O69Lcm`y_>5G zc7N|&m5lI&&bJQpxfy zM@1kJwX3)Ekr7<6Qw)<0RzceDjdvveae;!r4Oh9ZsDY=o>SHA8+~`*YMQx*t0PyA7 zch@6S2gW~IgJL6@(7)yD#w1A!;5HxAE81~YU?9r4LtrI|PSR+TKqECLLlZy!I<%O_~xGq+0j9-|Ytvvq0@IqJ@pZB@F-KchJ$o^`2hVS;W{W{^qmB z0ebPfMANrq7OA{&V>muS2-gm2ETe`%;GY2thoL(hy?$(tQ5R_8&V^ozd*)hu||hmpP5n-Sl$aj`CSr^R&b zo@~TN&Wgnat`H>YBh)&PNBD1p|Qg6W`X>W|IAWIIeJJDAF|$B3@U{0 z-Z*j4j0$jE!tb6o6h-lwl~tY*T7Ew_boVhAOlITO;WrV-@m-g8S*3XJa}(|IYT~na zWwDu>h?WkI9b=;69uUS%%>&HULE=y{ETG$EfD$IGP9OI0oP-XSDl0~Es4 zg-vpg;}zxBnP|y1^dQh-KGK00Gmct%6u1)Oh^doQ4bJQs_dHeupMD^@rnquFsby4Q zA8>4PWCldB69htH0{p?cNPNQgIClDw8P@AC04&e28b9x=LC=*HHm!Dd(2w-?*oyPt z(GC|EM)toD`Pw)%ojyR1{ev5E903-Yul-!;tA&zz-;v&kH$l|R6?rn5a-eq+NgQL; zKmngPf4`8mK$kxVFg_$#KpS;YvQ6`MK%`Ax1X+a=2w)P)W$Knkmz5OU?rS(9mp}5i zne%UhPb~AEUrF4NQ2j0Cu(g{YN0c>b^5QM@GG6(k{k{sib7s;_*ZVq1`S<4Q0hJlb zsaqHk6uyZ@)n&w$pDKfLP96TM=k1YYW}Kaah9!IUBVACQZB=@ET=7SQ4{$X{xiLy|k0)frNYXeffM?%c)z%H+@v@MRi8gyQ-4 zHxjyl-JY8nW_pcWV?-FtKX(IyUVLJE=L`7IaCf(v8=?7F6yoeP3LdN1)8^`bL%08= z_T>D(7g?!o;wUn!fyCpkx0&rLVEb0N;BSjTkdrYM&&l2nu1m_q^~be?YR9|PlNmKg zvk7_zmG&UERP6V%tP4e7zZ8X;i$R{(@GYwC9`r%%?Op&iLe@9SwfcWVqQh*~i`NQ2 zq8YWvZ{JtE2aZE8B<252f`?>7N|EQg(D>5BAD&_J=>3Bj^xLfmr95Hw?dHeeW@Y-D zRNo5JKxMIc0EdCslD~pjN(XY+n0qv2ItZ>9#&ihlv;%tbcCyyL_2}bj%iU-3wD{NS zsJPL?Re)2xC@;{^!j!1Tr|ipUa4=ms^G_vCIF~isb=!LcusSPItTg%{y3TbychMWgfMnO( zOgJiEDLOj+06mC(ES!1yB(6H+IH4EBghi%aJcO-0xah%0LjOH-s7_8&v}8Mj8oZpB zG=0{=*fG_H-Z(x;J3Ut1kk^6&Vmp6jC`^GnVetgKZ0u07l7_|$2;umMJmh;%7^-f( z&h`5t3WwZm^ep6|Hv zO#DIuWdkcz4o$!5LcEHu%cm$P8FIo_P%T(MN(dW+jLc3avEpHWCEJN1Hh9=!_3xYX z7ZiWhieCSS5_V2ri>a*30^&+z?@FEa5I;)(#pa=Yj@zVSfNPz2xKgO!W%mcpr3Vj22i1BBne6ZSl4El0yaywU7 zqN&eBp_h%1VQWBWf0D5W#ksYfd<2?NFVpwhxFc&o^5^s=TenYu{BoMc2bF%1;=g}< zrl1`NT{GMx;(v=+NSH+UtUFPvB9~`3O*=3Tspq`0-UAk^LINAZMgb!?<15bePl!n| zkM>F4F#5kU-qj?20slTQ{#tUV`G3DO(A%y|q4E5#z|rYIv_~=fxq&|q#l5HIPmmZ# ztbcKDsZtKOHTsn04F3$8*ON3ed_xVFoYHgdyxm3TD3`3uKJEd5?;%3>f3U)j-HX+^ zN`FyJ(Pi%w1V6w_vXFE2$B*N0+sm0JOZPyEy}iVdI4!ixBMul$8boaFrQfawvO+lr zCB@eztKjz!<*O7-|3K!5iHDLr39f1ppp0E5z{QjAGgx0PBbyr1OW&Gl@u>Nf(8odq zWaUHE7+6?gf3)%UCUP<;!d(TcdWkTr`Y3NXw=c$ikvIIh!*Q~J8!Od}2lVW(ahueO z!^upCw->$b;m!U)kll#?h&0p*##n_9g?EPH8SOt+ZQbrT#qIC4`R68B!Wr_6 zW=BAzNvY*4{|Gy+jfIu2L}Lrb{Aa~o-gx8(d72NS1$-IP%%RAqi|MCEpEk2v!Nor* zEiru>`0f4$u2s2EOchD|mYeh{rko_YOUV<7RnDBLWG(rmRCg3$u(Gz-NZ6@cl)cr} zIHM^w*z|-D4c$)KJD*7hw#n$xSs4PfD5|(Nxt4rCF95jU>);k=>*M7RDYtkDTU|Y8uXP>mLz< zUloY4%JQGmM{hk|0u?&MxBiM^t9MQ5!L9ZQSx*YUMma#wFTJQ_PWh9{<)S+XXCU$+ z8hH$A({{a!Mzw&?rMOL#{Kw!CwZHkT1y5vE-zT3teGTY*aBHj_hz8^FDl|PIj)<9i zP~m#NE8;j$`#`b&IvOa+34quYO{odR13^g}xGzejS2w%!1)Rm=PRGHrnCbJ@iH z_Z&oeJR-cgITdVM$V)}-I-*JQPb3pkjmY*HmuuzAN))9^t09x|3J4}<@I1{g0!k?d z!%3rWLE$%QicdV5=olf(&iX)*tW3)$sJ zl1a4Qg<-rFJU0;?8 zT*MBE`?KG|^|4L1JR^p_DznErN zpG*2v&tq8d#P>*z9&RW+RV*~RHVS%w`fFuxenD@!3QN*I{s8Px_;^zWx=>Bq>j1`; zHpCH40DB@*0T7X)|ss7T$=OAM(f^B67J2{tEzBvqyIvtKLdcdyc=drOhMg^F;$wvata*()`d&}M6lmVB;8N8$IqU#ri}r$IPR=D$)897J{x0`^odGeByzEU!UBVGmTlWns zy|Dq7JzJjjd_RT+N;)+{PJaNi-VeguiCus_bGGlUKLhw)ho`x2jDp4QT73$6tUkyw7?FXj}C^eSAobBycp`nEMz9 z!dHF{kf`-Svf|3ys#>3+_UaSo`+He%fW&u?lCBZp%&tB#dRPw97xCJ7Ci=jl2bX(r zT{UPjsA1)c2?J5iZ&=0IhXI=$i3DziJ`7uz5UEW40ZC~>vRpCRL5Yml`)~YXKsBIQ zqvu-}{8b-2^eL$p2wvN<$UAL=^+F$q2}+W|-vu7A$?O`axo^An=xsh2mYi~nYpnrX zH^_JO219Ez(HKVgu3B3VC%%s_+e-mVt!3Y#vS<%w|{8ki0!SzhY#D;CTTB#jqIq} zOOkbs|A|iS+Qa8XTe7r-drIYsVbLi6}rfq7p z+T7mK`9uiqp}tu%X~BnD{8-WK#F&LbjnvGTn^;IGW`JA-`3ak{NhK5bva z5+cGU3ZT?VBJdQ>8l^m;@$8Tv$^@qV)YIS>#H zNxxe_k2DraCixFv!YM8t0M6AdD)#l?wwxz8(mkGpChwSIc^RM_3 zPwShHb%yZJ)FrfFGJz8ryjz)c2}F_F(Evxw6lS!^Yz$jygB6u_FLy#d^PoD+7Yw*0 z{3uor4aPLr5#X6it6dEiLm{m<1y?!+@?Cy0vsPRIVeSaiZG9+?*i$lOCf7YVqR_ z9)GB~cBM|9+6OazEb~dPMqyD6lXC#~chH*0>hVpa2grPO8x+2Yg=*6>thistMjnS- z(RzkoK+0FHntGd5NH_6QJVA!<&@kyzav_5Rm0}y{cSv1;AEjv6)Uinr)}P&?Dc5E| zSCY#XVm<`Sd?V<6KCi)8j+9(EJVIo-6Vr?~i2)IJ^ld#CJ_MotKX5bma8d6|Jgl^s zWAK|9ccl4>5vAkc`>UXWLL=()j5lhl08kCpKH{fC2n6^)X$fE<@6LJCKlVtV`NB^Q z&L!>9%ae~$nbL+xI6+ArcHB#(tZF^#N4yhi<^NG&f7={A#>f^B{rduW@2vNUcFYFx zQT3MGl$S$)WL)Immv=#rXZv|se@UY5n{0PRuwI~F(l1Lr?8P|hRW>xJrn!xk(`(?u}e@A>X27$RkHry{dAbWk5h-gaH(mnhpi8l@x*IW*xB zLSFTT0P$%lN|AaajI1i<2>IBtBOMAK;|cH4AUxum>cI9ca=p9F97RRmjX%uaFXvJGY7Wn9m(`4_ROS<@8ud~y+se$ z%c+q5n;{0thr%d}?%@qfYks7sTe@5I12Mv0(DQ6Qwhu5Hzoj6zTZPXiZa=u;B8r~t zcFJsiphHbgxC|t6ilN@%FKJc6Hu&XLf`XPJ1cod2bf?Ej;NDNw*h}JUp!rc?%hRb1 zGVt@KpSG32yp+pbHYOAp_(yP%t+c^L2QyF4_f0_5#5>O@Cl^{XFtyHLv;Z<0w`Ko; zWI$>DZCeAWhm<2dias|gpy z*FhVw^gEw$mkNU#*^D0BfurEW(`NLy>M#`Q7d&_((gKSg$51N!{R6f%Lp^M%BLL4L zDJpYf3w*w-`-0JR3&=FnC%=_EfDr~JKHr`$LRuV36R*3|@J{tI?Q`jIcr4X0au9Y7 z?!;~$mKJ;mw)>+Op>mC|Uj>hN#$*+Ii7wCYW154SH%r@C;uc}UdPVGg=_dH0FDUcx z+Y#_6<;xX0)d3j7sAl=na|FLPE`6Yp?}V?}Rwz|fHb61k=k8UpSwLjX@{{1#3UrGY zsR<-mf#2q;gE}Ucz|111i9py2U=w1Ix*z!m?ggj|=dWKv)`!<-?C10#SdjZc2oxgK-O##OjpQ048hQW5UE9TVX zA^6f6_Q_No3n3`^`}po9A%feX%33r27sQ6BMsdFlLSLu}Q6=g|qO58v0c#xz2+#Cu zTB@0NwCX9}#z9j8@->%bhW^Y7m1%!mvP1k5b$Yl_%95LdHa`<7b^DNl`r$jPosC2z zeMHPftnR9aYgmVV;%*YM%<6JO{t4Pe7tbb;Bg6R>!E z$68it1kJ?kB23K*a4ANI%8;}M(A|48&P`Vim2M{xI~&%)z9&*gB(>d8H$e@V|nB=z0i83$n;-( zKd`G-^L^Bp1=+Az4{Edr0rfDApgz?%AhX1nL;WogqVAdPSgPY-gPO?hsG1d3HnW^& zY`uxt5hcoJ^B;pt3W92yoBT-Me`}SQgA;9Ny9rxgaUqWv)GHOKf57xWw|o)8eOPD{ z|E}R24_PcL!%4o+f>MfmG2$8#ptCzOrC-EZklP(3ZOytQ$Z5^f6>WDm)W7d-J;IlX<4& z9~a;_0VG%d+6K*z_`V+%9fE>U$?f3Yga6*Mv&Xja5_oBd1%Fe;Kr%Q|t>v38;3!!; zi&oD#z=tIZ7&uE%S=B+&b$AB^P#X;Ikp2U-1k{G<PR3Xyw0<)|J~OyI}-aCMN318eG6j9;F`^ve?K7{s}qm zmjzIdx78owfPqX)<=L9N!A2C$C^^kaaFG@nthg4^U+@RnjUg%NUr_Py2QgPeGE{DX zt!Arz4C<&I=qgJ&HJM#;F5_CG^>gv2?&&*zHe6L>IyI@Z*<%PFuks`}k&nQ6G$$HnHZS znTC9EkxPsz4RBkfI=NbJ1af|854cDffx1HdQ4cnjfr`k&O37LSFl)7AG}NsEhdV1a z*gUmhySpyzNz@{!o!2xg7fgYDygzto+512>k*z&${Qzh%kZPN{Hw{9?d|2M z>k|bxW`XkZ&eNM@EkH=QjAO^727KPS)pA*?2(ktfHS8x-0L`R5Z3Blt$epet~M-zm9`FJ^}99d7-iPEYQ&WP-HH+8>Fl?=y4|60QE2D3lSyxa0o{= zd<&-?^5E}S>uvf%st??+V@?yn@TvO+7LP4__x!s9Dz6CS;_JOJIrV^ZX&e>WZV8>- z7FoWwKY-gUCyaBsmN3D2Sx_(;kk+E!+o*PX`KmN5((O6?#1v~hQs@X=pIO;Aw0lG6=(vr%FZbaiM+Jvl zOZvdcg?}lnMGbt?9;k8P#)0%6=1+yQ4B=4qV~I%KRcIh27hrR?513Y@-!d-$1B8qm z*&c4cAcfdu3YP8xAPQ@tX<(fP&13x*;o37$ApK|W7xxpuN$*WwX?g{?`ft;5DgD+aX93D{S6Ly z*&9Tlt|J7ZlfTMnRI7kdWv|w}TsaWKcWpCRSP%SSD52;4EDkfd9uMd}U`IGVefag` zgcSLCk@cw#!AE=((!HcknUSjv+FJRYZg^2g1_H+@Q4h?eFMh7PNaqFBF&jH8N-^}g ziP4_}$?6emH6&m`$22lKzflvR?$zPen9^5ptY}~`W`!E@iyAOoG9X9o+{lqpD>8K2 zblg~h<}W0DTi{0OIt-U&zfFI7%Y%ZCMy7Juf8m1l7E=;F#Be)~kPY-+gree&x@;P*s?~4x9s7 z4G&d-d1dzP-MAFEYPS8;fUOR(U)t_PzY>6yE$VUHrv^}OR@>X!8G%J#9@B|2KLgje z#Lv%FRG^@@b`;)}13bN|x!K_efWK4f&z@VH(2%%9Z9`8C5P2)pOQ~|gtxC=BYY7h^ zLDS(-^Yuf3lVP_Po+pElr|Cia2|>i1yl1*A<37sm^;B$_kP~@4E-W|^!-MAXd~)bi zM-cOeMI{EhHL!QNytI7pK9We3xHCX3gAlWn#;ELUK$}!5qNm1-K;_0>|D_)n;<-&4 z#AnHh9^Z?a8|LFde8Qx=isZ3T9Hw|S_dIq4gr$7GX-tnw3apSyeWXBeQvwc{;>eLt zVQM$azYN2><~dxEgqr~SCy=>6cLQm8Modew|NL_5Pqh-i`=ty;`SEgt>_;XiIF zjLxjUM|%cJaWvP^<&I*$#2#$a!kV_9|@ohFt%3bqwGW7$hqXd(>`Z-|#kgD2l zIv@1MKg-D0EdaUKMcJ(R3LxJ)s!Baz1(XH1SZ{D;!E-eI{v1UPXxS}vFkO5JTdy5e zdv%sUGyCDq=QQb%I_a}Fwm~-NUOevK9nXVp*jG7J7e0WB1n-))Q8RqPPjng#QlRGU zYl-R9udpgAukfj{1w4qt8W6bA3h(LU-ow!O2pcZ_Pwyx90JfH_vAxS`AQeq&Zp@nn z75~MOr?a*~=Zs;ceu*;hrA1+P{J;Usu>T8a!1)U5B$uCrySIV6eWC$pe8s?SJNH}X zP6udxhkNguU=U35rf$%$CCli5tD0`ImH+{To=ts)iG#y#@kof0+9@6iU zqKC8%kd<5>IgPkQ%|yb5@ObBx*yAfArkFM%eagpxp^il>P(v6kT*F(tRVsrL`QsC> zIPfBA+$}|cmn;YpKAHYu=?1cuVAwIgLV@OJ@pM6wH6Xu1@qWbWF%r)8HNtXG7}bp| z;C!7egF28|xSJ5kqO_xyGmqCrP=AIm8tnfRkisCL8?B87=#=A0F?OOddN-Ri!fRa~ zr3y*2X7y1)$#V#X?){QRI=20J%z9LjeKuK}>DvZKx7x1lrmi8%aGIxmT567r9^~N* zb}1k(^jqRUiz!))%sd^UbC5tj1 z7FhFp@}NodQ@^D31kqa@Pm13JP@tJoX|q$btmu+ORK@c&G1MyBqd!%h4Uzfx!DOJD z4gELculo&;8_5gbKWm7%g$_PDz3r$aj>uC~%&~SzAeT(5uZ-?1B59# zGq_i}mRrEn3MSu?61V#2flH=Q-(>Ot@T_5cTJ|snJgyLRIZ*!qLa#C7mal(-pNiO> zJ=_u@&4|?VBZ^w^?A?9T!lV^`!I`}XdRzprJtO|r&(I38NTCG}YXPW;yWcEM6b~f( zSjKI)yFu#Lo9$&gxahOC2GgrMhv1=k<@+a(c3|;smW3GYMQAKt_nUVQ8=2-O%n*VBtL4O z|LHf7@fJIq^avB#dl1XXjDv|BTBujdo?;-9ldHL-_lS^`0zG|9-d5nd9C!dpK(@aE zBXN-RdZ#h{3=)Kd#Zb~QXAxp>k(u7ae+B=+fKiEu>5!W#rtXxc9B@g$>!)c9gxRrK zTNSI7ASP&`o-i*LnvCT=I@^c`nz~dfe_xhB?NBNE8H!q{>r+-;xBd}+2(KD)+)05v z?l*%wnJQqQLZLx|a24d`oKx?e{{ZqrqwoDt%mRr(gSCxCG6K z#KU3R$}Qic3fQkD9*m(I4(%Ekg5Br};8Rr(2mEi5FskJ8QR4GlC`c|<&RbIfohZ~i zg*IbhahrwxD;NvhELwVqL{h-S3l@aiAQ57TmNm+&_yCQ#M}Mf;lHhX^4_KC&2p1l4 zb(&ih!f}nt_;#~=kaC_OB^%-g=ptw~X1?VEtuedlVVN-CJnS4v&X@w7_TwMn(Imke zH|W1oW@W(S$shVgXE9(*QEO@IdMvCx`9K!X`xpl8Z|2m0cn^L=XBiqF`@%!9?}P3Z zp3pS=OH2u+ABZ-JEMUO(1NV06I~^M>At&ei9P08n@Um(<&qVMQypb0D>B&D2&|R%g(n zDS^02jJ0?wF>sTNcZY5}7y9yP{ZQmfg(?yHZ&xDf;J*+|F{b1|h`YDu|M_k_oZSC* zDXUNjZLYn$bx0oqLgpWj)PM$X=ZO{8qg4p346OdmXh%bA&h^1@@efe#a$CqB-w&pa z`$|j3r9j1K3qCvFB#2yJO{^;S17w@R$TpGH;Qt zCW7s(g>`=MWcZ*?t-^629xQY-n%!Zr2RFoH&d-m+VJDQ44gFLAI)5*G3$ykDv%-FZ zF7$jzQH4z*7Y`@uU1dAm$;O5(deT?t-@m}UoDtyvi0*yBry@vUVhzuHyI}jB7uS^r7Lt$*$q&dTj3n0RnY6%)Brzg z4T!M_*>9Hq1br?vXu0zmfU2rD-MnNIc=PH8pB{fTm=+;us-CEZZ{y0sH#a{5j$EJZ z$9|c>J!)jRdo~xKaS!*J{U3sFF)^b4)f;{V z=^oV*U4>1+X>UIu+9efQZyIW5<9C5V;RLm_@kXF9-=KI??K|*!b%rcfOoG_Mi03wX zW3VBZsl;bt68cZPuwLlchcl^E;}$=cK>x@4xGl}ouqyhRe8=+g@KlVaGdcp@!Ew-V42u)Xg$T!HF z8S#zs?;@;qKH`0IG6j1AM{?+r=AZ|@evOL*iZIbGxCCqkqY07rMn*vmh%GNcyh2_g zQkYN{%Xt=y{&n>vv-k-S&s2>V4309?!9R9+95y0hw8IZspZOsMuFM+vPoh!na5;90 zns}5qdDl20eN^%ECa5^-tf6NEBGm=}VG@MuR|{nUn;ZYFI?%{p9Xu z4LIoFemL7x3!Lx&30%Kwf$vJE2g?}dmlnKJN@(q@ zR^6B>3X-utueQf}>)86bW6|a1j*E=tgC`C14*9K5^Jr_OKW4Xt%Cz)KL4^kqSZ)gRTC%1Vi^;c=^{}PC?|a_v$WGdd|VhKBYcg2 zwx2l%Ibog6wbhD1){8t?q^E;XyM^X)r&xC+S)}59iCF-e`_!F)j6MJXA?a3u&y&#} z^Eo!^h&=SBV3JLrK{&!s<}b?@V~tp|?;HF5{(w9~horIU!V!+(C}Z+Zfv5xp`jq3? z2DLVdxqMz9h!$e}6UnM_M{M*zJ6n*(A^4TGW4AsRXD#y^YxfJ?j~g;JsN+QT;1hReVm(brjSGwZ=YCfg)$OxA2)xYPneIq zmt>T4lZZq#?iL)sUUou1d&O@Gmc2%gFPLK-N_>$w$;p;4Cq)rE3nPS0Jq2~_Q4VmP z%0@G(DY7w>IS_v7Yt$;*$tX!uz*vi`4LV!K0e>^4p@@CVgP$M#Q4)4d|FIkK=);My zucr3NDC5=A+i%0}h^v7;Y}FcvZTr@ftPTqh?9z*JTb1l7#)WuQw1%I)`x)A4py3&H9!>R8@8HCh^}8TeJEDPK!w*W${*hR1^XA;mXrVe0z^tu zK4%-4NF;nPm?h8y*GyLT^vE=8VS4(!M&vg^pA5G3H*000FBOB|hqwi3G zYhx_L{0inNt7P_`;3B6rSAB)IE?|GiO&_w%Q?PY#YS5&Ni)wAuD&@OwfRluFnURxO zsM|psZ*Pf-gg&Wr{$aTWdB=_W*E)UxB?aqa_sB`OFR4`^FFFb8Uz^Id@GimXy7>qB zpaGs_8cq87)PfghR90V=M`7FXf$?KzR~WozcG&B%0oEtp6|W{X!~K{GO+LDDcz^4@ zUK(B#@YMKPy65!)e%1}-z<=Kd7I{~|vhpfW=db5%wp;`Me%?RP*%$|I(~BgTnByRZ zexj!;=sPritXNI0wFxTTyBe`-HiI7bp)~&SBruAS>gUT{0r^fQS(Cr5aNZ=d6`!UV z9FOLYlDAaD#@_Qsni{yM;=4Ip!qva2^LNZqn}Eltl4+k(fE#g<6Fg-$5mY*VD zu?MleZSyf^?jx9leDtvoegi#6Utd9s|GG7TL!2m!3KjbBs&lB759uCz^(amKHd;z{ zYv&DzKEzHh>}UCF4zk0O#U^JhVG%NwI{n%X*5Qv)Hi@wT-X3=aFl?O}LFRUo5JOIU2mC%l;8H_8!V+X2g zAQ)m=rQXwqNJ{!8e*?uFc}MamW*@MEzspL`Z=tpi#a61m)1ZrjH;X8fi2qwP+t<4psgTlt z1j3#i6v$iBkVSn(cC> zAaAy)zIzT8;;YP6TiS!P1!t=@3; z7c-#^{b~HPU>CZTR(w)z`2%hmek^tbr{J8!PtiO65aK+J`-hrS04TCj zbLp=`>Q@FD*pc-hTKb!h9%Co?^D=xlhV%e(s*Q$N@EibMsjbBR=^aR`zk9*>7lpN7 zZ{1xrJb*c4sdq6$|GS62S5T8;94Jc&=ceedfO3l!tR}yG$envm8%;Y3+S}oE#@I+l+gO4LCW7b5GE)OX;K@x$@h?h@FQcb^06xE^Ra-Z6

B5_edctvTMI-vo~~WzPJpxBzGhAbu&-ikh+!D zAruFl{I|L1%7lT4J)cY@uAhMZ>;jU%Ju#82ovNFzlNXR#LEQSy#TK|cN=4CuVYp8z z(>Y3g0K(n}(_Ydo0>gl8EE!4+B+_Ok)pbn+$qz~2t<7DrADS3)RlQcv!06$}1AWO(W5zm7>X zd&#L?0nhUE%PDHApzwRmwF}+>kUUx=S)Y;%Ghf$M7k4xRuS*XaY@Q)l!Tf^^A#4N9 zhL6=gn2!OH&m|3Slk?%LHG;Wr!g9!_{%v7k{xg(*m^X@BUjnZG(zktdS_>H|Fsn`+ zJ_7pWyS(kUyTFg){s<+GuaMz#k3e#&1YQ*O*WKE#gBXmlIf8dlPV!DDRnY^Hf?wK4t2&o4l5gN?e0?u+JR4 z>eKAFYEA**mB{uINhmlINv)jc@&Fu3ZTd8x0npIJgFrt<{iz)iww>v zZ0ii6v?E0@=eC!-bIs7&7@-lam#T=Gi|_d$jvK1VqGzR3uZ$Z1Ba4uG>W-!l{VH|p zGDn4F1B%$CT4C7DUpyX0T|mVHFx0_^zcs?Q}IAjbov@)l+~v|&TfIiRU^M2rxwCijD+I^eFV!iic%Bs4ed=I=S~hT6#U{?*+c`1C|C?E-#+!yz7m4z1%*Rf6SI0B0Cn z6HJnMQ9lZ&1U!1*udD*gI?KY{1!rWdzP9>NzYgjmGQ+0d8h=BT2(;lvh{j=H=xzr7CdBAQY?*_Xjf_O6#g3$ws!)9&!? z>lzTPUH*ou_#5nDt!n$j)B(~Q&SPqGcc9+%&y=IA3pgRzS7FP)3rrGka9K@ZqU?5w zY(KI);Sw(ack;k07|7&0b7HFpPBh59hk;k%YL4@o^Vl-@%*h(b6n_T&ug#O~rH~?L z8BeReJv;}Gzn{{#P#1$&hBGJkHm5;av8-cKI~O`j`A|fRT?m!#IQo%d!+?CUo9^MZ z6G5#oaU@>7GejLa0%jSE4bZ4t@BRon%OEX+!yB#in&=Ii)yazpN#rCe*nmt|6I~L% zzsp)Eila+4*Y(+)Stuj&8$(Ge>p3HGiv#c9)f;K##x+Ut+(UjK=~K`z-DvtdM2 zerf`yn+fC*s&1fK_n`EV`wrqh!H8MhAieq73=C6 zAT&RTtBZXpx={~lGhT_m&^Ge@Z3qNKLA+=PkxzFRq5M;fo|cZheBURG&wguEzj&A(q4|?f3Ay z*L?i6QW@m@BcMAOoekTXk(xW{tzgAMh0C-g4@$XO`gRaC!54pKdTO#$K_IhYk$vt5 zz)O8VTcF$yzVYWT8kW%`cUU(VT)GZnIorF(+(H;gTCP9l{uLqm%1epeLX8TU7O~+s zYrg;;S8QB)N~DN;YXJvYA`xmoi*Zt;cdCHnRjWoTgkG>FbnJ)=#mZ-j5Z%<%3?-HWV)RP- zrRAJZj&I{II71gKxM@;6HW!Dh_mt4-fJ$H{c23>SoD84scZV-k=fPBa5tj~e2$h2{ z=fpA#fM!Dh8;x&1yrwGh^dogPe9&XvO_f;XlfAJFm zooAM8&BhmKS+iiJxN8i4T(s5`KTd=ig!v)m-TCm3h(K?tLl=O0!&O@LO_0vA@rX{p z3f|AKb~LEYhg_eZnRpKr!0RI%hGNw<(5*S1FAv)s=?~ms{wn<(iAdnvWMMKzr)#*3 zYr17ndlEn1umyFrQIxrK6Ewhp>P_oS>%(g?A4&1B(pFh?|kCmzo}eS`{YWYc8@njz)k%$mHV zrikB+39V_PBNDf)Gn@VW30jT0Yx5Gr773o{;oiGphSX>bZaL@pfpqx?@ba^V z#F>aU+%zGJR~nCmHQG2f@0lZ@M;b-CsEIO+@N%Uk)6)U-(oJ<+e!)N~`o8*%zYTcF zr>@)W69SFjK61Qk1;&AHHBZS&&XKg*tpNJzggx(voZ{<)u@{%^G+#|TFH8YUWN`gd} zTqa}TG9uNjHRZbYcM+P}0Pp+?5%jcF`v%I!gm?xR6iRxCA?AxO=El_p&=gbqGno`V zWGkolm2}`f;CM8yEM@%#93|q8mX5B2_uh#evv+17o8Z=YzsUg{XnbDK-82quR-1+5 zSbss)WdFo`)+^}zxipYgdI9uPW{%N^w1QgW7Y{u-Pr%Qu*z#bbJ&>t&{rAzG9w5Bk z|6cfF2>NxA{v)1TgORBvrR>)i;jxX%=i`VScx!nj##(n6;u5)(f!y&vG{UJfC zb`z)~)Er5|ROriK7w4!XCPdAgi`cD}8`ZW~)$HA*LPZ9sT}-F>(cj6T1tTF8h{crC zm;w(w@?e4ngJB{8MEw*?Wp`vnpR1~7C(bY-D=vP!rZSvJ5lvL>n}TEb(3!ZPg_0b( z-0s!GmJvkkM-58u^<$!a4AM&_W@F&bbhaUMWkq>#6Q7}pd}!<+PQyxT4%8*8c}i`I z7->vSx%QOe7Q$&CCx<6YiA+6DC=u`HM5}-N7BnOzMYEg6b?w7$qU$v6Gk2S>;EHO{ z^KO3*WXk6H$X+!E8n#}0u$+|#>^jqR#3_Uje}(n3$&a|`PSR}OF%vt&ssVSq$vBYa zM<4xUFBlL7EQE#i8zwTSZMnv-G!KoXvSW?hl#$+QAsc#KQgnvW(4#km4%ri7sG4Tr zL5CTfifL`uz~UQqJ$%bMh>}j1mT@yRDjN6p0Tz}3dV92&7eDX;GTvPOqTMgT0qIcO^R|%q0d6E@JDKFycOkU*et=9d{V@=-%Sb6Uhj3&?ROj?XD-4LXpzK%s z2#cidy=h#`0vE0uIlJBsz})U`glSDXNSUbA&~i+I9>4qevBIX{tA6`iRwm=%8?V_v zggYP72>d-ZjmrX2_{XbW@f9G))$o_`aw|l}YJc`gjsVjkcRSIEICvoF=jZja8sa^7 zOOT@&flU{r8%1eFFuJe@x0HDV-uKhAyieN*o@ChTHx3kneT=6EbWUAh(kwP~jsk_Q zlB}k;(qcf8@b^1H_wztxN!mzCvm0^H)r^(3Y<{>$Qi88fZp8&f3LH4p?S%+ zCfLuakWu!Uih!LuWO{vEI34Dr3TWfqzPJj+p=a8r!m$pG@I=Wy>*k04r^|3u}P~EaiUKuNM`A6MNxuc(pwsX~2xVcJWU?a>;#2$O z2X5G1WKf?>{hRIq)ckuSx)_0noELdH=+WaL23l0D&))UHbN12`{@Ov9L)Mi&@ZY&S z!IrPu@&yzz2_nEXn*&z)k2(|?=YXNqPM0U{G2~Fi{GRvb05)9Ms7|M2po?STuU5_0 zfZy-2P^SLhu$v=R??W&-BArqDz>x_T71zE0UNs#9u{jib^KTI!CAbto_3Z??8>|w$zo6~ zO&&)EoUcguhrXYMj_s(Ci(nI@(hRC8w3}c>HjWM-+(G=+KA)*@~B-h5mA||2@oeiO$BueoE0Zh(p4&v4TByJ?f_Zh(_RpOUCLvHZ3 zfWk5JkN1E!yRHeR=q1c~>qkr1@g7!sx-yrm`2ZVw>x`X;UckgW=Mk;oQz$Xx>L$$V z2spg(L@&f_qC?=FVS;Z; zOkUu2)OE7pMR%y^qmX-J&IL*boyxrk5`qL7BqO?9RtUb$nh_I*FLF8fmdaE;7?Ha@ z)f&Bj1G$iNn*Ch)4*gZuf?nAMpuY4!{tppb&omWmLpQ|fb+rXc%D;}tyJF^G=$@clo|%!u9QaVDN035s?Q z?KLitqb$f9rhpgh%ik_Ntp7Cke576FNQ6n7=E(;)r}XPaNm+E7I`X_Hhu z6O>IVicB~yLNTJD^v=s|*fc<)Lmv7Y?z!gQZ4UenI>Wbh$|eS(e!$?@0AEb>p>K`1 zbHXXevL=ptTlO0)=5@Z}ojrr?TF&CqmUCd)CbCrM_Z3K5|0dbTy#ju%qeGN8Ccy09 z`nQ41i(tEnCim&`KR|Ii`h25f8TtvnWnc>Z0TaKZ>KpNm0kJn0??tTE;A$6c*d6D; z;Kq2F!jqgy$dLb=a9#<8E{kdU*_0>o8v$pJosJgCO)7C0XM zN$V`m&^ngEFu1Smd>H3H~yZtLfi4qr6J=u^JQ zgOPVF6gg+J;cRMU2*K@U@K`MAR#{Fe#9LY(+U_rel@DMT7E=ne+V*s($7zOV-uRNa z@LXCW=BN4Io+;GzJ2(0JF&=y`dXZ@tHwJg}SPp*6+(Nn(tY2_i5Fu|#{;C(~Qz69U zj=5A|4g99D5J5f3P)6^TYkz_n5V!Y<2E_9HAhTA_Rl|z{W#g;97IHz2^tyc#C8nZ6 z%o&ZibN~Uu8Um(ocQT>jQO}f0DGuPm!Oe)O8XANtOv1o5dl`7)Jzw;%AxBNPxl)6K zNRYkBKUga+B&ah3^03Hw4U~tp1##q4p`U1T^GP09elMY$0k%7;Rc?#B0u6`A=N12JxI7%O;KDd+WM^+OUNbVY z6Zew6l87WyStUv#qmLA_3B^lgWo3lyaW5HVZ<0brl39{jU;o2-p5HmQZUdW!mrebt zL13j>GD=7KCNe&)tkBcx0S2x|xpgeYfYl%ZD|zb^M0PAKd{!_YttN_$N|Ok}U~0uE zJ0B)k;7i`GoG*=+#;hF&&L4wHhjO0~3-?j{Lhdhib}^h&&&a2DNDwROO$RJZjssST zF-rZq{>Tr!6`Z}$9?9OOxUz@^rh-2^Q!^qc`hr zS%AU=!qr{5Ymv?1`jAw|8{~A$&_MD1EmS%j1$2$yB9(Qog-4{>NKU|a1RQQdg<1)z z!H)0I6;q2PtI-^w&A&sDjxz6pu(mS-*CC@~Re2b{u zXg}{>%t3LYJo#+u)xd$}mQ_&RYw*XI^i!EqAu@M<(8Fa?gl2^112o^H0E{>gJ2M9>a(EV`$o#-iuh?s~cC*ppbE-@M_#u1c{p z^k@#cnM1tH+?)q|6#`5QH*=9x!dQ{IV;T~22@!~V6O3;8k~G%wr6M8mXH^Ug&(NjN zK)r;*mte-$dB?2cB_d{#J9GV4jymV#>B%eeLG%qXa*@qqKvyN-_AWdNB{`JUt6?wD zXYw||;#Vc;igsly^%(=HCWHpB#5p7t#&x4x;vGnQu}q_pw1G0}jUV4Gp8!kL8n;^P zr@@J6mXi-(eFIKcPjw#){09EZOAfhewTUiVJ;yc4IE=>Qn)U6~)=@3@F=)C4|w73;q zIXN_-^>0T#w(4!;&n_W@0_$H+p`F0q()g_+aU4bDQnu^78bcDagUwWKbI9MCzg=~* z9LSh|m0OeR1{Nn)i_94wqOv^F$KS+807vc3IEmgtG~XiUcWP!33@|ddS-DgKw+0h^ zskI?AIgo#M_edcy%J|j7Tr`Sg|F&}{9&G?m%^!!!6ud>Y`~&tKsg+1jJi(^-R1UJx z`#YeooCaz>Y^tkS6oCB`@d@qpl|a9LdQq5p7`*W}yVA|P3JemeMVzV^!SFYk1D!AJ zh`u9SR>Eo#J(b}3ES<1|G{!Ei*Gnv*ZTAc&ne-WOW$~AZHNyy+nJYW%v^EM7e*Wj8 zlu3$vcpQvWg=YZ{8})k`@dx>j<|UmV{6gxA-JJ3qq;Pm*euCurPh{HYV&*^GjHDFn z=0_EmQOfo1@<_?Ih>SAYgwZA3!J`vK|6S00kBVY*w3Y~;SF!UnApxgK=%G5>$Zm| zG!dKElGo;g@4r!0D(bJIS3e&3sF@BU<7w?Qrd&bHNu#oteDxUo_+@DM{SYUNi!Cg8 zp)CNjY--p;bc7(8>+vj~P+?rPpm;R;4>MjHNxq>dLcoUddD%GwzrmcS&@}dZf?vGi%5QXZh1wr0=DzbJ!T|BP$rD-LIMCZ_oTcVDJni2yG_dD^ zCyQ@(T&vWBKD<%Y7R6yu*1z@4ZqWk>EFa#Z42^>K1!X@GTAt$gx}Bz-$IX3yh$$S`25ICn*{zXN65K5H-5I0U*XIz~&s*P*9pnQ1?~8ApBx>dUMoW8i4I zX~`Y$FX%qqTFk9CD~OY_ON>GGEz&sIES^fY1YGH$!T#1TI5}hfDt>neHUE%d8f6{> zmAz(6nj3?_VI}F4JM|2D$@f)xA*vTt7H9WesP94Z(O8<0SA>tl616p`DX&v zy$bMXuS2NDX8@2mc?3`EkAaY5>n&j?N051Y)oYHtF<=y~>ELmz9q?yyR&O*Ug9}|X z>gn^Z(Vr8X0Tv?|2&68HmNNB%AKo-aN~hj|52kqs_6ehC&UNUkxN#hio4%uFZ9jx0 zuMYFYh6u7Qke z@w0!?OKAZ{t)5+U+2_TqGW{%2)sGiCbA1;$7EdUxux%lI&R-)7B2j2=F-2O6?kA$X ztHMCdor5HRiLz4M0g|;-nMepEg@!StOY-_;I9=Jnj(+PW_^$ZsqHo74Fcc*;+oxPsH9;I82U%Zq(>qH{yUb&ttl^#*W}sD+{^cLz-BPh7WnL zZv)SW$&d=clkn<@tXY;m2M)U0#F(4Ohl`azJSRUzfM3<8-eof?Ln&9b=bRxB54F`$ zQt3-#N%yzsTW0*+wo-)o=0Um0bJ@|e^4%Q74@j~lIq@m+wsa(B*#14+f*|>cJ zl!0UMij-^M-8CyORaaM#JgQT`ZL!3KCOjX4dQj@Ae`xbY@dOusaGjDcDbFZ75 zLO0x-tm3B%-$26T5-mG6yj#x|r6UC!yUawM5VT?ayv@BJA{CT>opk0HoiP+iF1_kb z)W!fOImG6a@BB5M8jY!Bisv-NqIj<#L(u0hM{UV&W`%JN3QrR39^p zzSvQ7U77<@WWE2act;Xymdc%VZrDRs9d9I@XGw5+_7NV*1_~@5u9JR`|1f-a*?>@S zX#u$HC}dTg=_EBYq^LsLDR_tGXgW*;Q8T9a~ zTKD`>fFcdwQmSzM^SIaaEfZqtAnq>(tA+YAkRs%>3JuZ`{d|L7aDD)y(w0ihdtL?l zln3YZ6~h4Ul6JiI{&5taImM{8n+1%$1(c5Z<$OlEYg^;| z4}D-(cYH03k{*Ne|#fU_?*;>Hgmc=+*7W7XhGG}UZO*jOz`OHbrM z<+In|;I}(}3ELogqwIg|(>wuw3khn8uOP#kvciA)HvVy#LO~D^3VTLBJ(>W zk`LoJsuIuDL3(`XT;sflXccO|o8O+>HHaRalgR!lSPpugT)M>HGk_$Nx9nc$yhPeH zrq5Qk^O4p0o*`+E#~_pa%w5s?8t~vrBJu0geZc5+?F83m6^de%qK>afMPrO@6$d#z zpfT6#3-7m1ivq77iIqj_Ix7W0twkXQzHNDN-z3 zZCH$oV=ADMb17JkY6`^p72xy4y|G)lndqV>V9MVw1De*9jyV;1pj+yNZrq(NBt*DjC#_4Vxp>YoVWn;UPz(XYgxVcGfUZ~99{J*!NR%46x2!-2uf zg2Km|fBaHNeiB3Mf7&X4aAx zAdpwB5)<2v1Tl7jyt5SHJ(^)TV~&NxDq$ zMkw(S+b%_U=AS4)g268rNORIJmWO`lz6J2b2;c52{!hW+v~Yag?YzA zncXlGRA4=+_GWDNUuQ*Z*1n!aXyp3)J3OTLkyGmSB4Ho6<|N%A7?Z#g1H}u8|L$s8 z#+6=SYXh*)?C`tBP~iKtJRF1aRFL7JX@5B76w2<>e)V^{6j(eW$TCor0e=xkZwjAU zG-J3=`-b%?;!RF)Gkba)5&5%AI1>v2b;zlDot=7A?mMP1vzd*WwCc860Y*;BqTe0kS;zzW+1!xTFzsKbh!!{xc`jf!Na&d2O+HG%n#O#jWHA zZmK+Ke?Vu1cop24tIKo1KyL$!hkY_gzHApPyLleWZ3f#iC7cCpE4$2u$ppakZP2ou z@iA)Dv0GmhOhG|GO|f}`;fUL&&2z6H83mva(&G%qXf&qrN>HyWDsFI~1jv>t} ztrr7;KDwcpotFd-?D=@;MV}(uN4B2%95+E>OB=h{t6&glvLs=9ITXFAb3PN$9FGcf z+KS|ILxG@*Ca0`wCeS32;wM!hqV?HA>nMR>kVEe=T>UHw4T=(@SAX0FJm0;@o>oSo zd;MBJFDE}hoqxVevNv5qikmwog$ho9VuGM~*ufiA_E@a?wr7KU5i(2NPcfjj5E<@2 zQo~Z>;sc4__+kCPB|1W}64bg7xnGz=4v8{TEB`$ggO-|c+{Ob+&@DkGFh+nDnlcV; z)9r4cc1k*q+s*{|g747hVLKY=X9k8;t50CoRh5YAk98m#uDsIWw*eB5e4x>Z6vXmp zN2)X2SYTdXC;zVzLCi}=BfYfAj(?}0v^ird35ni$zXtteVP05L6|0vl4vAA^buN|0 zer8(b?l~8*kh;3%z-Jb$S^a=^*Zwekw#z^#-_C@6>hWjeSQUKHu}0XO4`K=-k9fUg zZFupOwZMVD227hJa}j=|4ojZr@U+fq!IgiX&dmzqPwpOCR^ex`hP2xA9{TfmGWFS* z#2yRgbk~X+&o#io+KMv_+bTGaq~$KT%2CXbApZ6H7CGeSHdrGenm}=;|A_BO^f6(5 z@r=R=1sHXH-0oaj0Xhi1AADJ)41HLCb#Q+DJqI;N$EC+}+RR*s?=5?zhq>swc?>mf!!pRuj_f}C7C1#`0`z_QQ=ZC;O>BVU} zsamkPAF;ZPtNw9*mc9^;BEOP)Pkc$?(8glvrl6i1x-1ndeczy`Y z`E1>UB<@&Al7@an4dlhb@}kq4TViFO-bq=5&0LA9rhoj-?VfW?OS1=Jf?xgj#q7~T z0WJ08008EcFKdF@+K9}pDZt}|53rRH$=S$11t{%!Ed@#0K$pY~S?Xri3(Kk2jPuu;XiiRdqAhIqtU{oKRn& zyye>*JN{7r;B@y6EBvf+_k~u_QCuWPE#*QZ24CDuDvP$}fsvA~A{W#)QCZ5OLhlPv z9Pirm{XhC6_`Mg7!Y5ab{9%OHqVA=Wd>nbRc-&Rz?BsVVRmLTF3Q>?0$8PJT@6uCz44b1XiS2jFO z01f0Xt<&}&f?#$_e}DS~(3zC$`zYKE$#S;QKC^NMM+18N=<=>C(BE_SWR6osZB`Eq{mCk%yvzRqCBLpU2Xq{;2b-hF|x1=tUIz4pOxzcBU! z`*C!mKSGg$svl64FSHJ|%>(P!XWjF#8D&v|MBTxEo@5?f)V(+k;#&-Ki=X{QQ@bxG z3qxxWpGc$kjM5trLu9Y;{`?sf*hPNlyglIi*JrGEC+{~^6d)DJR@ukG?SRjdp5gjzCEIVQ`FRV{D2*eWNWDzRBM5Zskjh1 z_a99SXSgI(9JP?h13N|r5fzkc&LC{!tPOZO^k1cysv-peBU`ryRdmSNjP9-rBWNj+ zna=Gw1x|AvJ0EFAi>^7HwVO2;MW13rBTRVNfWFr9FU}|hq&I#s`4g=cD14+dBIII) z9OL+V=|UTD(=N$Mj#CYu=9Uy%W;_lHa$RU*j%Pz_iM!{-q;p_kxv8syc?dC44zF8zde?=MS~! zfI=j&g(I6$?S+T@!i`1XDx=5w0?I1TY}s2BNXSQAvO~1Ho~>Zbb#&>)Oe0cNWV%%O zw-E96{C13rdkX#sP)h>@EdT%j2mk;8Apms*&oux4|NsC0|NjdB6aaT+X=iA3b1rUh zc>w?r03ZPX000000Pp|+000000GsR=>KhQr$WX>mt)7xvoLr=CrJ!z;W}&X5pq`dr zR8o|f7oT60k_r-cOUx-w1&SAEBo?Fs`zhtdW;M%-Yb)0i=55nAGHkUv#z^! zzW8JIlT)|t--LhK>5+cr%lrGL2fy6k_U-+*%gVFoi|AKn)c=3}>3fgS{_pi)d~W?! zdiC|+%thbj^JaW1vS$eJW@OT3Km-?SAd6X=6ElNF6f*-SG)zEL12~+L5{omzL5Hpl k6w06=1O+EIinfJ7!;r!}z?+o~B+mqd1wi_oGc%9`0JVNA=>Px# literal 0 HcmV?d00001 diff --git a/tests/data/namespace_migration/arc.json b/tests/data/namespace_migration/arc.json new file mode 100644 index 000000000..0d66946df --- /dev/null +++ b/tests/data/namespace_migration/arc.json @@ -0,0 +1 @@ +{"conventions":{"analysis":"arc_length_contact","arc_radius":"producer_spherical_metric_radius","archive_authority":"data_only_confers_no_admission_or_qualification","constraint_reactions":"raw_generalized_work_conjugate_not_physical_moments","endpoint_force":"N","endpoint_stiffness":"N/m","energy_and_work":"J","gap":"m","line_pressure":"N/m","line_stiffness":"N/m^2","load_factor":"producer_arc_proportional_parameter","numeric":"exact_binary_bits_v1","peaks":"producer_peak_load_factor_index_and_accepted_step_flags","physical_contact_force":"N","physical_contact_moment":"N*m","record_identity":"inert_producer_type_and_exact_fields","snapshots":"committed_generalized_displacement_and_material_data","steps":"accepted_increments_with_producer_indices","structural_kinematics":"producer_generalized_chart_translations_m_rotations_rad","surface_pressure":"Pa","surface_stiffness":"N/m^3","time":"s"},"payload":{"items":[["steps",{"items":[{"fields":{"items":[["step_index",1],["load_factor",{"bits":"3fb999999999999a","tag":"binary64"}],["iterations",2],["retries",1],["arc_radius",{"bits":"3f947ae147ae147b","tag":"binary64"}],["residual_norm",{"bits":"0000000000000000","tag":"binary64"}],["arc_residual",{"bits":"8000000000000000","tag":"binary64"}],["displacement_norm",{"bits":"3f847ae147ae147b","tag":"binary64"}],["load_increment",{"bits":"3fb999999999999a","tag":"binary64"}],["path_increment_norm",{"bits":"3f947ae147ae147b","tag":"binary64"}],["max_equivalent_plastic_strain",{"bits":"0000000000000000","tag":"binary64"}],["is_peak",true],["support_reactions",{"items":[["root",{"items":[{"bits":"0000000000000000","tag":"binary64"},{"bits":"0000000000000000","tag":"binary64"},{"bits":"0000000000000000","tag":"binary64"},{"bits":"0000000000000000","tag":"binary64"},{"bits":"0000000000000000","tag":"binary64"},{"bits":"0000000000000000","tag":"binary64"}],"tag":"tuple"}]],"tag":"mapping"}]],"tag":"mapping"},"record_type":"anysolver.arc_length.ArcLengthStep","summary":{"items":[["step_index",1],["load_factor",{"bits":"3fb999999999999a","tag":"binary64"}],["iterations",2],["retries",1],["arc_radius",{"bits":"3f947ae147ae147b","tag":"binary64"}],["residual_norm",{"bits":"0000000000000000","tag":"binary64"}],["arc_residual",{"bits":"8000000000000000","tag":"binary64"}],["displacement_norm",{"bits":"3f847ae147ae147b","tag":"binary64"}],["load_increment",{"bits":"3fb999999999999a","tag":"binary64"}],["path_increment_norm",{"bits":"3f947ae147ae147b","tag":"binary64"}],["max_equivalent_plastic_strain",{"bits":"0000000000000000","tag":"binary64"}],["is_peak",true],["support_reactions",{"items":[["root",{"items":[{"bits":"0000000000000000","tag":"binary64"},{"bits":"0000000000000000","tag":"binary64"},{"bits":"0000000000000000","tag":"binary64"},{"bits":"0000000000000000","tag":"binary64"},{"bits":"0000000000000000","tag":"binary64"},{"bits":"0000000000000000","tag":"binary64"}],"tag":"list"}]],"tag":"mapping"}]],"tag":"mapping"},"tag":"record"}],"tag":"list"}],["status","maximum_steps_reached"],["displacements",{"data":"AAAAAAAAAIABAAAAAAAAAAAAAAAAAPA/","dtype":" 0.0) +assert np.array_equal(active, np.flatnonzero(oracle_pressure > 0.0)) +active_nodes = [pressure_nodes[index] for index in active] + + +def source_elements_of(node): + return {int(element_id) for element_id in definition.surfaces[0].element_ids + if node in model.mesh.elements[element_id].node_ids} + + +control_elements = set().union(*(source_elements_of(node) + for node in control_nodes)) +active_elements = set().union(*(source_elements_of(node) + for node in active_nodes)) +disjointness = { + "control_nodes": list(control_nodes), + "active_mode_nodes": active_nodes, + "control_source_elements": sorted(control_elements), + "active_source_elements": sorted(active_elements), + "active_elements_disjoint_from_control_elements": + bool(active_elements.isdisjoint(control_elements)), + "control_nodes_on_target_skin": + [bool(node in target_skin_nodes) for node in control_nodes], +} +assert disjointness["active_elements_disjoint_from_control_elements"] +assert not any(disjointness["control_nodes_on_target_skin"]) + +pose = np.asarray(saved["production_displacements"]) +support, weighted, _area, _points, signature = integrate_current_skin( + model, definition, pose) +control_columns = np.eye(ndof)[:, control_list] +gradients = {} +bitwise_invariance = {} +for label, step in (("half", 1e-6), ("nominal", 2e-6), ("double", 4e-6)): + gradient = np.zeros((len(pressure_nodes), len(control_dofs))) + invariant = True + for column, dof in enumerate(control_dofs): + plus = pose.copy() + minus = pose.copy() + plus[dof] += step + minus[dof] -= step + plus_support, plus_weighted, _a, _p, plus_signature = ( + integrate_current_skin(model, definition, plus)) + minus_support, minus_weighted, _a, _p, minus_signature = ( + integrate_current_skin(model, definition, minus)) + assert plus_signature == signature == minus_signature + invariant = invariant and bool( + np.array_equal(plus_support[active], support[active]) + and np.array_equal(plus_weighted[active], weighted[active]) + and np.array_equal(minus_support[active], support[active]) + and np.array_equal(minus_weighted[active], weighted[active])) + gradient[:, column] = ((plus_weighted/plus_support + -minus_weighted/minus_support)/(2*step)) + gradients[label] = gradient + bitwise_invariance[label] = invariant + assert not gradient[active].any() + assert invariant + +production_support = np.asarray(saved["production_support_m2"]) +production_z = production_pressure*production_support +manager = GeneralS3PatchManager(model, definition, settings) +contact = linearize(manager, pose, production_z, tangent=False) +production_force_control = np.asarray(contact.force[control_list]) +production_gradient_control = np.asarray( + contact.gap_gradient[:, control_list]) +assert not production_force_control.any() +assert not production_gradient_control[active].any() + +external = np.zeros(ndof) +for force, value in zip(_program.nodal_forces, + _program.force_values_at(4), strict=True): + assert force.dof == "uz" + external[model.mesh.dof_manager.get_node_dofs(force.node_id)[2]] += value +external_control = external[control_list] +assert not external_control.any() + +record = { + "status": "development_control_reaction_route_probe", + "source_commit": subprocess.check_output( + ("git", "rev-parse", "HEAD"), text=True).strip(), + "harness_sha256": hashlib.sha256(Path(__file__).read_bytes()).hexdigest(), + "saved_source_sha256": hashlib.sha256(saved_bytes).hexdigest(), + "python": sys.version.split()[0], + "platform": platform.platform(), + "anyfesolver_module": str(Path(anyfesolver.__file__).resolve()), + "active_pressure_modes": active.tolist(), + "disjointness": disjointness, + "independent_control_gradient_half_step": gradients["half"].tolist(), + "independent_control_gradient_nominal": gradients["nominal"].tolist(), + "independent_control_gradient_double_step": gradients["double"].tolist(), + "active_rows_bitwise_invariance": bitwise_invariance, + "production_contact_force_control_n": production_force_control.tolist(), + "production_gap_gradient_control_columns": + production_gradient_control.tolist(), + "production_gap_gradient_control_max_abs": float( + np.max(abs(production_gradient_control))), + "external_control_n": external_control.tolist(), +} +print(json.dumps(record, indent=2)) diff --git a/tests/fixtures/d1_current_skin.py b/tests/fixtures/d1_current_skin.py new file mode 100644 index 000000000..bb9c49085 --- /dev/null +++ b/tests/fixtures/d1_current_skin.py @@ -0,0 +1,227 @@ +"""Independent current-skin quadrature for the active D1 regression. + +The clipping and quadrature definitions follow the September 2026 reference +oracle and current-skin comparison preserved in docs/d1_review_support. +""" +import numpy as np + + +def _cross(a: np.ndarray, b: np.ndarray) -> float: + return float(a[0]*b[1] - a[1]*b[0]) + + +def _clip(polygon: np.ndarray, triangle: np.ndarray) -> np.ndarray: + """Intersect a convex XY polygon with a counterclockwise triangle.""" + output = [np.asarray(point, dtype=float) for point in polygon] + if _cross(triangle[1]-triangle[0], triangle[2]-triangle[0]) <= 0: + raise ValueError("oracle triangle must be counterclockwise") + for index in range(3): + start, end = triangle[index], triangle[(index+1) % 3] + edge = end-start + source = output + output = [] + if not source: + break + for first, second in zip(source, source[1:]+source[:1]): + first_side = _cross(edge, first-start) + second_side = _cross(edge, second-start) + first_inside = first_side >= -1e-14 + second_inside = second_side >= -1e-14 + if first_inside != second_inside: + fraction = first_side/(first_side-second_side) + output.append(first + fraction*(second-first)) + if second_inside: + output.append(second) + return np.asarray(output).reshape(-1, 2) + + +def _triangle_quadrature(vertices: np.ndarray): + """Integrate polynomials of sufficient degree via a tensor Gauss map.""" + roots, weights = np.polynomial.legendre.leggauss(4) + roots = 0.5*(roots+1) + weights = 0.5*weights + origin, first, second = vertices + jacobian = abs(_cross(first-origin, second-origin)) + for u, wu in zip(roots, weights): + for v, wv in zip(roots, weights): + point = origin+u*(first-origin)+(1-u)*v*(second-origin) + yield point, float(wu*wv*(1-u)*jacobian) + + +def _target_shape(point: np.ndarray, triangle: np.ndarray) -> np.ndarray: + a, b, c = triangle + denominator = _cross(b-a, c-a) + beta = _cross(point-a, c-a)/denominator + gamma = _cross(b-a, point-a)/denominator + return np.array((1-beta-gamma, beta, gamma)) + + +def physical_vertices(model, element, displacement, side): + nodes = [model.mesh.nodes[node] for node in element.node_ids] + reference = np.asarray([(node.x, node.y, node.z) for node in nodes]) + if side == "bottom": + assert len(nodes) == 4 + director = np.cross(reference[1]-reference[0], + reference[3]-reference[0]) + director /= np.linalg.norm(director) + offset = -0.5*element.thickness + else: + assert side == "top" and len(nodes) == 3 + director = (np.asarray(element.reference_normal) + *element.director_polarity) + offset = 0.5*element.thickness-element.reference_surface_offset + current = [] + for node, point in zip(element.node_ids, reference, strict=True): + dofs = model.mesh.dof_manager.get_node_dofs(node) + current.append(point+displacement[dofs[:3]] + +offset*(director+np.cross(displacement[dofs[3:6]], + director))) + return reference+offset*director, np.asarray(current) + + +def q4_shape(xi, eta): + return np.array(((1-xi)*(1-eta), xi*(1-eta), xi*eta, + (1-xi)*eta)) + + +def q4_derivatives(vertices, xi, eta): + along_x = (1-eta)*(vertices[1]-vertices[0]) \ + +eta*(vertices[2]-vertices[3]) + along_y = (1-xi)*(vertices[3]-vertices[0]) \ + +xi*(vertices[2]-vertices[1]) + return along_x, along_y + + +def source_shape_current_xy(point, vertices): + """Invert a convex bilinear Q4 independently in the projected plane.""" + xi = eta = 0.5 + for _ in range(12): + shape = q4_shape(xi, eta) + difference = shape @ vertices-point + dx, dy = q4_derivatives(vertices, xi, eta) + correction = np.linalg.solve(np.column_stack((dx, dy)), difference) + xi -= float(correction[0]) + eta -= float(correction[1]) + if np.linalg.norm(correction, ord=np.inf) < 2e-14: + break + if (not -1e-10 <= xi <= 1+1e-10 + or not -1e-10 <= eta <= 1+1e-10 + or np.linalg.norm(q4_shape(xi, eta) @ vertices-point, + ord=np.inf) > 1e-11): + raise ValueError("independent current Q4 inverse failed") + return q4_shape(xi, eta) + + +def overlap_incidence(source_xy, target_xy, polygon): + """Identify the source and target edges incident to clipped vertices. + + This is an oracle branch signature, not a physical contact-feature label. + Cyclic normalization removes the arbitrary starting corner of the clipper + while retaining vertex order around the overlap. + """ + length = max(float(np.linalg.norm(np.roll(vertices, -1, axis=0) + -vertices, axis=1).max()) + for vertices in (source_xy, target_xy)) + tolerance = 1e-10*length + + def edges_at(point, vertices): + matches = [] + for edge_id, start in enumerate(vertices): + edge = vertices[(edge_id+1) % len(vertices)]-start + edge_length = float(np.linalg.norm(edge)) + if edge_length <= 0: + raise ValueError("degenerate oracle polygon edge") + along = float(np.dot(point-start, edge))/edge_length + distance = abs(float(np.linalg.det(np.stack((edge, point-start))))) / edge_length + if (distance <= tolerance + and -tolerance <= along <= edge_length+tolerance): + matches.append(edge_id) + return tuple(matches) + + incidences = [] + for point in polygon: + source_edges = edges_at(point, source_xy) + target_edges = edges_at(point, target_xy) + if not source_edges and not target_edges: + raise AssertionError("clipped vertex has no parent edge") + incidences.append((source_edges, target_edges)) + if not incidences: + return (0, ()) + rotations = (tuple(incidences[index:]+incidences[:index]) + for index in range(len(incidences))) + return (len(polygon), min(rotations)) + + +def integrate_current_skin(model, definition, pose, *, pressure_gram=False, + support_by_source_face=False): + pressure_nodes = sorted({ + node for element_id in definition.surfaces[0].element_ids + for node in model.mesh.elements[element_id].node_ids + }) + pressure_index = {node: index for index, node in enumerate(pressure_nodes)} + support = np.zeros(len(pressure_nodes)) + weighted_gap = np.zeros(len(pressure_nodes)) + gram = (np.zeros((len(pressure_nodes), len(pressure_nodes))) + if pressure_gram else None) + face_support = (np.zeros((len(definition.surfaces[0].element_ids), + len(pressure_nodes))) + if support_by_source_face else None) + current_xy_area = 0.0 + quadrature_points = 0 + topology = [] + for source_index, source_id in enumerate(definition.surfaces[0].element_ids): + source_element = model.mesh.elements[source_id] + reference_source, current_source = physical_vertices( + model, source_element, pose, "bottom") + source_xy = current_source[:, :2] + for target_id in definition.surfaces[1].element_ids: + target_element = model.mesh.elements[target_id] + _reference_target, current_target = physical_vertices( + model, target_element, pose, "top") + polygon = _clip(source_xy, current_target[:, :2]) + topology.append((int(source_id), int(target_id), overlap_incidence( + source_xy, current_target[:, :2], polygon))) + for fan in range(1, len(polygon)-1): + triangle = polygon[[0, fan, fan+1]] + for point, weight in _triangle_quadrature(triangle): + source_shape = source_shape_current_xy(point, source_xy) + target_shape = _target_shape(point, current_target[:, :2]) + xi = source_shape[1]+source_shape[2] + eta = source_shape[2]+source_shape[3] + assert np.max(abs(source_shape-q4_shape(xi, eta))) < 1e-12 + dx, dy = q4_derivatives(current_source, xi, eta) + rdx, rdy = q4_derivatives(reference_source, xi, eta) + physical_normal = np.cross(dx, dy) + projected_jacobian = float(physical_normal[2]) + assert projected_jacobian > 0 + reference_jacobian = float(np.linalg.norm( + np.cross(rdx, rdy))) + physical_normal /= np.linalg.norm(physical_normal) + source_point = source_shape @ current_source + target_point = target_shape @ current_target + gap = float(physical_normal @ (source_point-target_point)) + reference_weight = (weight*reference_jacobian + /projected_jacobian) + for local, node in enumerate(source_element.node_ids): + index = pressure_index[node] + value = reference_weight*source_shape[local] + support[index] += value + if face_support is not None: + face_support[source_index, index] += value + weighted_gap[index] += value*gap + if gram is not None: + indices = [pressure_index[node] + for node in source_element.node_ids] + gram[np.ix_(indices, indices)] += ( + reference_weight*np.outer(source_shape, + source_shape)) + current_xy_area += weight + quadrature_points += 1 + assert np.all(support > 0) + result = (support, weighted_gap, current_xy_area, quadrature_points, + tuple(topology)) + if gram is not None: + result = (*result, gram) + if face_support is not None: + result = (*result, face_support) + return result diff --git a/tests/fixtures/d1_nonlinear_kkt.py b/tests/fixtures/d1_nonlinear_kkt.py new file mode 100644 index 000000000..ebc2d6788 --- /dev/null +++ b/tests/fixtures/d1_nonlinear_kkt.py @@ -0,0 +1,300 @@ +"""Bounded nonlinear coupled Q1/S3 comparison with independent contact work. + +The admitted shell structural residual/tangent are shared with production. +Contact gap and its work map come only from independent current-skin +quadrature and numerical derivatives. This is same-model code verification, +not an independent continuum or spatial-accuracy reference. +""" + +import hashlib +import json +import platform +import subprocess +import sys +import time +from pathlib import Path + +import numpy as np +from scipy import sparse + +import anyfesolver +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.general_contact.core import suspend_contact +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.semismooth import linearize +from anyfesolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.nonlinear_static import _assemble_nonlinear_system +from d1_current_skin import integrate_current_skin +from scripts.general_contact_d1_free_target_press_probe import build_free_target_case + + +started = time.perf_counter() +path = (Path(__file__).resolve().parents[2] / "docs/d1_review_support" + / "d1_two_body_reference_compare_full_20260928.json") +saved_bytes = path.read_bytes() +saved = json.loads(saved_bytes) +assert saved["production_status"] == "completed" +assert saved["production_accepted_steps"] == 4 +model, definition, _settings, program = build_free_target_case( + 4, steps_per_segment=2, four_phase=True, + enforcement_solver="monolithic_active_set", +) +model.apply_boundary_conditions() +ndof = model.mesh.dof_manager.total_dofs +stiffness, _info = assemble_stiffness_matrix(model) +_reduced, _rhs, transform, offset, _fixed, _constraint_info = ( + build_constraint_transformation(stiffness, np.zeros(ndof), model) +) +assert np.linalg.norm(offset) == 0.0 +transform = transform.tocsr() +control_nodes = (1, 6) +control_dofs = tuple(int(model.mesh.dof_manager.get_node_dofs(node)[0]) + for node in control_nodes) +control_values = np.asarray(program.target_at(4), dtype=float) +assert control_values.shape == (2,) +controlled_coordinates = [] +for dof in control_dofs: + row = transform.getrow(dof) + assert row.nnz == 1 and row.data[0] == 1.0 + controlled_coordinates.append(int(row.indices[0])) +free_coordinates = np.setdiff1d(np.arange(transform.shape[1]), + controlled_coordinates) +physical_transform = transform[:, free_coordinates].tocsr() +columns = np.asarray(physical_transform.toarray()) +assert np.all(np.sum(abs(columns) > 0.0, axis=0) == 1) +fixed_pose = np.zeros(ndof) +fixed_pose[list(control_dofs)] = control_values +external = np.zeros(ndof) +for force, value in zip(program.nodal_forces, + program.force_values_at(4), strict=True): + assert force.dof == "uz" + external[model.mesh.dof_manager.get_node_dofs(force.node_id)[2]] += value +oracle_pressure = np.asarray(saved["oracle_pressure_pa"]) +active = np.flatnonzero(oracle_pressure > 0.0) +oracle_pose = np.asarray(saved["oracle_displacements"]) +q = np.asarray(physical_transform.T @ (oracle_pose-fixed_pose)).reshape(-1) +assert np.max(abs(fixed_pose+columns @ q-oracle_pose)) < 1e-12 +z = (oracle_pressure*np.asarray(saved["oracle_support_m2"]))[active].copy() +assert np.all(z > 0.0) +steps = np.array([2e-5 if np.flatnonzero(columns[:, index])[0] % 6 >= 3 + else 2e-6 for index in range(columns.shape[1])]) +evaluation_count = 0 +gradient_count = 0 +topology_signature = None + + +def geometry(pose): + global evaluation_count, topology_signature + if time.perf_counter()-started > 165.0: + raise TimeoutError("independent nonlinear KKT development budget exhausted") + support, weighted, _area, _points, signature = ( + integrate_current_skin(model, definition, pose)) + evaluation_count += 1 + if topology_signature is None: + topology_signature = signature + elif signature != topology_signature: + raise RuntimeError("independent current-skin clipping topology changed") + return support, weighted/support + + +def numerical_gap_gradient(pose, directions, sizes, multiplier=1.0): + global gradient_count + rows = len(saved["production_pressure_pa"]) + gradient = np.zeros((rows, directions.shape[1])) + for index, base_step in enumerate(sizes): + step = multiplier*base_step + plus = pose+step*directions[:, index] + minus = pose-step*directions[:, index] + _support, plus_gap = geometry(plus) + _support, minus_gap = geometry(minus) + gradient[:, index] = (plus_gap-minus_gap)/(2*step) + gradient_count += 1 + return gradient + + +def independent_gap_gradient(pose): + return numerical_gap_gradient(pose, columns, steps) + + +def state(coordinates, nodal_forces): + pose = fixed_pose+columns @ coordinates + support, gap = geometry(pose) + gradient = independent_gap_gradient(pose)[active] + with suspend_contact(): + internal, tangent, _states = _assemble_nonlinear_system( + model, pose, {}, 5, tangent=True, kinematics="von_karman", + require_full_coordinates=True, + ) + structural = np.asarray(physical_transform.T @ (internal-external)).reshape(-1) + residual = structural-gradient.T @ nodal_forces + scaled_merit = float(np.hypot(np.linalg.norm(residual)/0.3, + np.linalg.norm(gap[active])/5e-5)) + reduced_tangent = (physical_transform.T @ sparse.csr_matrix(tangent) + @ physical_transform).toarray() + return pose, support, gap, gradient, residual, reduced_tangent, scaled_merit + + +trace = [] +for iteration in range(8): + pose, support, gap, gradient, residual, tangent, merit = state(q, z) + trace.append({"iteration": iteration, "scaled_merit": merit, + "force_residual_norm_n": float(np.linalg.norm(residual)), + "active_gap_norm_m": float(np.linalg.norm(gap[active])), + "minimum_active_force_n": float(np.min(z))}) + if merit <= 1e-9: + break + size = len(q) + active_count = len(active) + matrix = np.block([ + [tangent, -gradient.T], + [gradient, np.zeros((active_count, active_count))], + ]) + correction = np.linalg.solve(matrix, -np.r_[residual, gap[active]]) + accepted = False + for backtrack in range(8): + fraction = 0.5**backtrack + candidate_q = q+fraction*correction[:size] + candidate_z = z+fraction*correction[size:] + if np.min(candidate_z) <= 0.0: + continue + candidate_merit = state(candidate_q, candidate_z)[-1] + if candidate_merit < merit*(1-1e-4*fraction): + q, z = candidate_q, candidate_z + accepted = True + break + if not accepted: + raise RuntimeError("independent nonlinear KKT backtracking failed") +else: + raise RuntimeError("independent nonlinear KKT iteration budget exhausted") + +assert np.min(gap) >= -1e-9 +production_active = np.flatnonzero( + np.asarray(saved["production_pressure_pa"]) > 0.0) +assert np.array_equal(active, production_active) +pressure = np.zeros(len(support)) +pressure[active] = z/support[active] +production_pose = np.asarray(saved["production_displacements"]) +production_pressure = np.asarray(saved["production_pressure_pa"]) +production_support = np.asarray(saved["production_support_m2"]) +production_z = production_pressure*production_support +control_columns = np.eye(ndof)[:, list(control_dofs)] +control_gradient = numerical_gap_gradient( + pose, control_columns, np.full(len(control_dofs), 2e-6))[active] +all_columns = np.column_stack((columns, control_columns)) +all_steps = np.r_[steps, np.full(len(control_dofs), 2e-6)] +half_step_gradient = numerical_gap_gradient( + pose, all_columns, all_steps, multiplier=0.5) +nominal_step_gradient = numerical_gap_gradient( + pose, all_columns, all_steps) +double_step_gradient = numerical_gap_gradient( + pose, all_columns, all_steps, multiplier=2.0) +column_norms = np.linalg.norm(nominal_step_gradient, axis=0) +resolved_columns = column_norms >= 1e-4 +assert np.any(resolved_columns) +half_differences = np.linalg.norm( + half_step_gradient-nominal_step_gradient, axis=0) +double_differences = np.linalg.norm( + double_step_gradient-nominal_step_gradient, axis=0) +gradient_step_sensitivity = { + "directions": int(all_columns.shape[1]), + "resolved_columns_at_norm_1e_minus_4": int(np.count_nonzero(resolved_columns)), + "maximum_half_vs_nominal_absolute_difference": float( + np.max(half_differences)), + "maximum_double_vs_nominal_absolute_difference": float( + np.max(double_differences)), + "maximum_half_vs_nominal_resolved_relative_difference": float( + np.max(half_differences[resolved_columns] + /column_norms[resolved_columns])), + "maximum_double_vs_nominal_resolved_relative_difference": float( + np.max(double_differences[resolved_columns] + /column_norms[resolved_columns])), + "minimum_nominal_column_norm": float(np.min(column_norms)), + "maximum_nominal_column_norm": float(np.max(column_norms)), +} +with suspend_contact(): + independent_internal = _assemble_nonlinear_system( + model, pose, {}, 5, tangent=False, kinematics="von_karman", + require_full_coordinates=True, + )[0] + production_internal = _assemble_nonlinear_system( + model, production_pose, {}, 5, tangent=False, + kinematics="von_karman", require_full_coordinates=True, + )[0] +independent_control_reaction = ( + independent_internal[list(control_dofs)]-external[list(control_dofs)] + -control_gradient.T @ z) +manager = GeneralS3PatchManager(model, definition, _settings) +production_contact = linearize( + manager, production_pose, production_z, tangent=False) +production_control_reaction = ( + production_internal[list(control_dofs)]-external[list(control_dofs)] + +production_contact.force[list(control_dofs)]) +reaction_scale = max(float(np.linalg.norm(production_control_reaction)), 1e-10) +# The contact route contributes exactly zero at the control dofs (the active +# gap modes' elements are disjoint from the control nodes), so the reaction +# difference is entirely the structural internal force between the two +# roundoff-level solution realizations of the same system. +control_reaction_structural_pose_term = ( + independent_internal[list(control_dofs)] + -production_internal[list(control_dofs)]) +# Attribute only this checkout, never an enclosing development worktree. +# Exported/installed sources retain their file hashes without inventing a SHA. +def _checkout_commit(project_root): + try: + top = subprocess.check_output(("git", "rev-parse", "--show-toplevel"), + cwd=project_root, text=True, stderr=subprocess.DEVNULL).strip() + if Path(top).resolve() != project_root.resolve(): + return None + return subprocess.check_output(("git", "rev-parse", "HEAD"), + cwd=project_root, text=True, stderr=subprocess.DEVNULL).strip() + except (OSError, subprocess.CalledProcessError): + return None +source_commit = _checkout_commit(Path(__file__).resolve().parents[2]) +record = { + "status": "development_independent_contact_nonlinear_kkt", + "source_commit": source_commit, + "command": "python tests/fixtures/d1_nonlinear_kkt.py", + "harness_sha256": hashlib.sha256(Path(__file__).read_bytes()).hexdigest(), + "saved_source_sha256": hashlib.sha256(saved_bytes).hexdigest(), + "current_skin_oracle_source_sha256": hashlib.sha256(Path(__file__).with_name("d1_current_skin.py").read_bytes()).hexdigest(), + "python": sys.version.split()[0], + "platform": platform.platform(), + "anyfesolver_module": str(Path(anyfesolver.__file__).resolve()), + "saved_pose_current_free_force_residual_norm_n": float(np.linalg.norm( + physical_transform.T @ (production_internal-external+production_contact.force))), + "largest_displacement_difference_dof": int(np.argmax(abs(pose-production_pose))), + "active_pressure_modes": active.tolist(), + "free_structural_coordinates": len(q), + "geometry_evaluations": evaluation_count, + "gradient_evaluations": gradient_count, + "gradient_step_sensitivity": gradient_step_sensitivity, + "clipping_incidence_signature": topology_signature, + "elapsed_seconds": time.perf_counter()-started, + "trace": trace, + "final_scaled_merit": merit, + "minimum_inactive_gap_m": float(np.min(np.delete(gap, active))), + "relative_pressure_l2_difference": float( + np.linalg.norm(pressure-production_pressure) + /np.linalg.norm(production_pressure)), + "relative_nodal_force_l2_difference": float( + np.linalg.norm(np.bincount(active, weights=z, + minlength=len(support))-production_z) + /np.linalg.norm(production_z)), + "maximum_displacement_difference_m_or_rad": float( + np.max(abs(pose-production_pose))), + "relative_displacement_l2_difference": float( + np.linalg.norm(pose-production_pose)/np.linalg.norm(production_pose)), + "integrated_normal_force_n": float(np.sum(z)), + "production_integrated_normal_force_n": float(np.sum(production_z)), + "relative_integrated_force_difference": float( + abs(np.sum(z)-np.sum(production_z))/abs(np.sum(production_z))), + "independent_control_reaction_n": independent_control_reaction.tolist(), + "production_recovered_control_reaction_n": ( + production_control_reaction.tolist()), + "control_reaction_relative_l2_difference": float( + np.linalg.norm(independent_control_reaction + -production_control_reaction)/reaction_scale), + "control_reaction_structural_pose_term_n": ( + control_reaction_structural_pose_term.tolist()), +} +print(json.dumps(record, indent=2)) diff --git a/tests/prepared_static_qualification_cases.py b/tests/prepared_static_qualification_cases.py index 7320313e1..b3239f4f9 100644 --- a/tests/prepared_static_qualification_cases.py +++ b/tests/prepared_static_qualification_cases.py @@ -6,9 +6,9 @@ """ import numpy as np from test_prepared_static_evaluator import _shell_model, _shell_case -from anysolver import RecoveryConfig, prepare_static_evaluator -from anysolver.recovery import recover_stress_result -from anysolver.prepared_static_measures import shell_surface_tensor +from anyfesolver import RecoveryConfig, prepare_static_evaluator +from anyfesolver.recovery import recover_stress_result +from anyfesolver.prepared_static_measures import shell_surface_tensor def test_canonical_principal_recovery_qualification(): diff --git a/tests/prepared_static_response_m10_diagnostic.py b/tests/prepared_static_response_m10_diagnostic.py index 8832c0428..d21bf9571 100644 --- a/tests/prepared_static_response_m10_diagnostic.py +++ b/tests/prepared_static_response_m10_diagnostic.py @@ -79,7 +79,7 @@ def run(family): fields.extend(matvec((5./6.)*shear,strain[6:])) expected.extend(native['shear_'+name][k] for name in ('xz','yz')) else: - from anysolver.elements import _beam_material_properties + from anyfesolver.elements import _beam_material_properties element,mesh,material=recipe.execution_owner L,T=element._beam_frame_and_transform(element.get_node_coordinates(mesh)) local=matvec(T,[ui[j] for j in mapping]) diff --git a/tests/prepared_static_response_m11_diagnostic.py b/tests/prepared_static_response_m11_diagnostic.py index 03ff4d849..3f7de7489 100644 --- a/tests/prepared_static_response_m11_diagnostic.py +++ b/tests/prepared_static_response_m11_diagnostic.py @@ -2,7 +2,7 @@ from pathlib import Path import numpy as np from scipy import sparse -from anysolver.assembly import _backward_error +from anyfesolver.assembly import _backward_error from prepared_static_response_m11_gate import * from prepared_static_response_m9_diagnostic import ( _shell_model,_shell_case,mixed_free_model,free_cases,PatternCase, diff --git a/tests/prepared_static_response_m11_gate_tests.py b/tests/prepared_static_response_m11_gate_tests.py index 90e8f4342..67f58b78a 100644 --- a/tests/prepared_static_response_m11_gate_tests.py +++ b/tests/prepared_static_response_m11_gate_tests.py @@ -1,7 +1,7 @@ import numpy as np import pytest from scipy import sparse -from anysolver.assembly import _backward_error +from anyfesolver.assembly import _backward_error from prepared_static_response_m11_gate import * def test_identity_accepted_solution_outside_output_tolerance_is_enclosed(): diff --git a/tests/prepared_static_response_m12_diagnostic.py b/tests/prepared_static_response_m12_diagnostic.py index 073df01a9..f17df7c09 100644 --- a/tests/prepared_static_response_m12_diagnostic.py +++ b/tests/prepared_static_response_m12_diagnostic.py @@ -53,7 +53,7 @@ def run(family): fields.extend(matvec((5./6.)*shear,strain[6:])) expected_keys.extend(('shear_'+name,k) for name in ('xz','yz')) else: - from anysolver.elements import _beam_material_properties + from anyfesolver.elements import _beam_material_properties element,mesh,material=recipe.execution_owner L,T=element._beam_frame_and_transform(element.get_node_coordinates(mesh)) local=matvec(T,[ui[j] for j in mapping]) diff --git a/tests/prepared_static_response_m13_diagnostic.py b/tests/prepared_static_response_m13_diagnostic.py index b6d248ba6..b7025ba4c 100644 --- a/tests/prepared_static_response_m13_diagnostic.py +++ b/tests/prepared_static_response_m13_diagnostic.py @@ -54,7 +54,7 @@ def run(family): fields.extend(graph.matvec((5./6.)*shear,strain[6:],'material_shear')) expected_keys.extend(('shear_'+name,k) for name in ('xz','yz')) else: - from anysolver.elements import _beam_material_properties + from anyfesolver.elements import _beam_material_properties element,mesh,material=recipe.execution_owner L,T=element._beam_frame_and_transform(element.get_node_coordinates(mesh)) local=graph.matvec(T,[ui[j] for j in mapping],'local_transform') diff --git a/tests/prepared_static_response_m14_diagnostic.py b/tests/prepared_static_response_m14_diagnostic.py index a82844ae4..eb7ed9cbe 100644 --- a/tests/prepared_static_response_m14_diagnostic.py +++ b/tests/prepared_static_response_m14_diagnostic.py @@ -54,7 +54,7 @@ def run(family): fields.extend(graph.matvec((5./6.)*shear,strain[6:],'material_shear')) expected_keys.extend(('shear_'+name,k) for name in ('xz','yz')) else: - from anysolver.elements import _beam_material_properties + from anyfesolver.elements import _beam_material_properties element,mesh,material=recipe.execution_owner L,T=element._beam_frame_and_transform(element.get_node_coordinates(mesh)) local=graph.matvec(T,[ui[j] for j in mapping],'local_transform') diff --git a/tests/prepared_static_response_m16_assessment.py b/tests/prepared_static_response_m16_assessment.py index 79adf4d73..2754e601e 100644 --- a/tests/prepared_static_response_m16_assessment.py +++ b/tests/prepared_static_response_m16_assessment.py @@ -16,12 +16,12 @@ if str(extra) not in sys.path: sys.path.insert(0, str(extra)) -from anysolver import PatternCase, RecoveryConfig, prepare_static_response_evaluator -from anysolver.prepared_static import PreparedStaticEvaluator -from anysolver.prepared_static_envelopes import _numeric_fields -from anysolver.prepared_static_recovery import (_recover_owned_local, _derived_measure, +from anyfesolver import PatternCase, RecoveryConfig, prepare_static_response_evaluator +from anyfesolver.prepared_static import PreparedStaticEvaluator +from anyfesolver.prepared_static_envelopes import _numeric_fields +from anyfesolver.prepared_static_recovery import (_recover_owned_local, _derived_measure, owned_recovery_scope, constraint_force_diagnostics, _array_value) -from anysolver.prepared_static_response import _library_schema, _library_vector +from anyfesolver.prepared_static_response import _library_schema, _library_vector # Frozen M16 criteria constants. UNIT_ROUNDOFF = 2.0 ** -53 @@ -90,7 +90,7 @@ def _canonical_reference(record, requested): def _combined_load_case(patterns, coefficients, name, baseline=None): """M20: one native original-time LoadCase equal in exact arithmetic to F0 + sum c_j F_j.""" - from anysolver import LoadCase + from anyfesolver import LoadCase terms = ([] if baseline is None else [(baseline, 1.0)]) + [(patterns[key], float(value)) for key, value in coefficients.items()] made = LoadCase(name) @@ -242,8 +242,8 @@ def assess(label, model, patterns, coefficient_sets, *, recovery, envelope=None, packets.append(block.case_results[j]) u_cases.append(np.asarray(block.displacements[:, j], dtype=float)) # Native and route loads per case, evaluated before the recovery scope. - from anysolver.prepared_static_loads import evaluate_load_vector - from anysolver.prepared_static_vectorized import c7_ratio + from anyfesolver.prepared_static_loads import evaluate_load_vector + from anyfesolver.prepared_static_vectorized import c7_ratio abs_stiffness = abs(snapshot.stiffness) loads_by_case = [] with owned_recovery_scope(tuple(snapshot.load_maps.pressure_recipes.values())): @@ -509,7 +509,7 @@ def holdout_a3(stress_execution='certified_library', native_loads=False, route_o def holdout_a4(stress_execution='certified_library', route_options=None): - from anysolver import BoundaryCondition, LoadCase + from anyfesolver import BoundaryCondition, LoadCase from test_prepared_static_evaluator import _bar, _case model = _bar(False) model.add_boundary_condition(BoundaryCondition('left', [1], {'ux': 0.001, 'uy': 0., 'uz': 0., 'rx': 0., 'ry': 0., 'rz': 0.})) diff --git a/tests/prepared_static_response_m9_diagnostic.py b/tests/prepared_static_response_m9_diagnostic.py index 64c06baff..afee43a24 100644 --- a/tests/prepared_static_response_m9_diagnostic.py +++ b/tests/prepared_static_response_m9_diagnostic.py @@ -5,11 +5,11 @@ import numpy as np ROOT=Path(__file__).resolve().parents[1] sys.path[:0]=[str(ROOT/'tests'),str(ROOT/'scripts')] -from anysolver import PatternCase,RecoveryConfig,prepare_static_response_evaluator -from anysolver.prepared_static import PreparedStaticEvaluator -from anysolver.prepared_static_recovery import _recover_owned_local,_derived_measure -from anysolver.prepared_static_measures import SHELL_LINEAR_COMPONENTS,shell_surface_tensor -from anysolver.prepared_static_q4 import recover_q4_stages +from anyfesolver import PatternCase,RecoveryConfig,prepare_static_response_evaluator +from anyfesolver.prepared_static import PreparedStaticEvaluator +from anyfesolver.prepared_static_recovery import _recover_owned_local,_derived_measure +from anyfesolver.prepared_static_measures import SHELL_LINEAR_COMPONENTS,shell_surface_tensor +from anyfesolver.prepared_static_q4 import recover_q4_stages from test_prepared_static_evaluator import _shell_model,_shell_case from benchmark_static_batches import mixed_free_model,free_cases @@ -43,7 +43,7 @@ def combine(columns,c,extended=False): def s3_setup(recipe): - from anysolver import e4_pl_s3_element as native + from anyfesolver import e4_pl_s3_element as native element,mesh,material=recipe.execution_owner element._compute_stiffness_components(mesh,material,enforce_positive_winding=True) arrays=element._snapshot_qualified_component_arrays((("frame",(3,3)),("bubble_map",(2,15)),("local_nodes",(3,2)),("constitutive",(8,8)),("assumed_shear_samples",tuple((name,(2,17)) for name in ('A','B','C','D','E','F'))))) @@ -154,7 +154,7 @@ def run_family(family): records['local_sum_vs_same_u']=shell_metrics(proposed,same_u) row['elements'][eid]=records else: - from anysolver.elements import _beam_material_properties + from anyfesolver.elements import _beam_material_properties element,mesh,material=recipe.execution_owner L,Q=element._beam_frame_and_transform(element.get_node_coordinates(mesh)) G13=_beam_material_properties(material,element.cross_section)[2] diff --git a/tests/prepared_static_roundoff_diagnostic.py b/tests/prepared_static_roundoff_diagnostic.py index 3d2b68a6b..e522a04f8 100644 --- a/tests/prepared_static_roundoff_diagnostic.py +++ b/tests/prepared_static_roundoff_diagnostic.py @@ -5,11 +5,11 @@ import numpy as np sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'scripts')) from benchmark_static_batches import mixed_free_model, free_cases, numeric_leaves -from anysolver import AnalysisSession, RecoveryConfig, StaticCase, prepare_static_evaluator, iter_linear_batches -from anysolver.matrix_assembly import assemble_load_matrix -from anysolver.recovery import recover_stress_result -from anysolver.prepared_static_loads import ingest_static_case, evaluate_load_vector -from anysolver.prepared_static_recovery import apply_compiled_recovery +from anyfesolver import AnalysisSession, RecoveryConfig, StaticCase, prepare_static_evaluator, iter_linear_batches +from anyfesolver.matrix_assembly import assemble_load_matrix +from anyfesolver.recovery import recover_stress_result +from anyfesolver.prepared_static_loads import ingest_static_case, evaluate_load_vector +from anyfesolver.prepared_static_recovery import apply_compiled_recovery model, groups, balancing = mixed_free_model() name, instant, load = next(free_cases(model, groups, balancing, [48])) diff --git a/tests/test_abc_annotation_authority.py b/tests/test_abc_annotation_authority.py index 688bc462d..776482195 100644 --- a/tests/test_abc_annotation_authority.py +++ b/tests/test_abc_annotation_authority.py @@ -19,20 +19,20 @@ def test_cold_abc_annotations_and_later_mutations(family, observer_first, tmp_pa import inspect,json,sys observer_first = sys.argv[3] == "1" if observer_first: assert inspect.get_annotations(ABC) == {} -import anysolver +import anyfesolver from pathlib import Path import os -from anysolver.current_state_tangent import require_exact_qualified_component_lifecycle_api as guard -from anysolver.element_capabilities import ElementCapabilityError +from anyfesolver.current_state_tangent import require_exact_qualified_component_lifecycle_api as guard +from anyfesolver.element_capabilities import ElementCapabilityError family = sys.argv[1] record_path = Path(sys.argv[2]) -entry = {"family":family,"solver":anysolver.__file__,"observer_first":observer_first} +entry = {"family":family,"solver":anyfesolver.__file__,"observer_first":observer_first} record_path.write_text(json.dumps(entry)) -assert Path(anysolver.__file__).is_relative_to(Path(os.environ["ANYSOLVER_DEVELOPMENT_SOURCE"])) -owner = anysolver.QualifiedE4PLShellElement if family == "q4" else anysolver.QualifiedE4PLS3ShellElement +assert Path(anyfesolver.__file__).is_relative_to(Path(os.environ["ANYSOLVER_DEVELOPMENT_SOURCE"])) +owner = anyfesolver.QualifiedE4PLShellElement if family == "q4" else anyfesolver.QualifiedE4PLS3ShellElement points = ((0.,0.,0.),(1.,0.,0.),(1.,1.,0.),(0.,1.,0.)) if family == "q4" else ((0.,0.,0.),(1.,0.,0.),(0.,1.,0.)) -model = anysolver.FEModel("cold-abc-"+family) +model = anyfesolver.FEModel("cold-abc-"+family) model.add_material("elastic",1e5,.3) for node,point in enumerate(points,1): model.add_node(node,*point) model.add_element(1,owner(1,tuple(range(1,len(points)+1)),"elastic",thickness=.05,reference_normal=(0.,0.,1.))) @@ -69,7 +69,7 @@ def forbidden_annotation(*args,**kwargs): record_path.write_text(json.dumps(entry)) print(json.dumps(entry)) ''' - expected = Path(os.environ.get("ANYSOLVER_DEVELOPMENT_SOURCE", Path(__file__).parents[1]/"src/anysolver")) + expected = Path(os.environ.get("ANYSOLVER_DEVELOPMENT_SOURCE", Path(__file__).parents[1]/"src/anyfesolver")) environment = os.environ.copy() environment["ANYSOLVER_DEVELOPMENT_SOURCE"] = str(expected) environment["PYTHONPATH"] = str(expected.parent)+os.pathsep+environment.get("PYTHONPATH", "") @@ -86,21 +86,21 @@ def forbidden_annotation(*args,**kwargs): @pytest.mark.parametrize("attribute", ["__annotate__", "__annotate_func__"]) def test_preimport_annotation_callback_is_rejected_without_invocation(attribute, tmp_path): - expected = Path(os.environ.get("ANYSOLVER_DEVELOPMENT_SOURCE", Path(__file__).parents[1]/"src/anysolver")) + expected = Path(os.environ.get("ANYSOLVER_DEVELOPMENT_SOURCE", Path(__file__).parents[1]/"src/anyfesolver")) environment = os.environ.copy() environment["PYTHONPATH"] = str(expected.parent)+os.pathsep+environment.get("PYTHONPATH", "") code = r''' from abc import ABC import importlib.util,json,sys from pathlib import Path -assert Path(importlib.util.find_spec("anysolver").origin).is_relative_to(Path(sys.argv[2])) +assert Path(importlib.util.find_spec("anyfesolver").origin).is_relative_to(Path(sys.argv[2])) calls = [] def forbidden(*args,**kwargs): calls.append(True) raise AssertionError("preimport annotation callback executed") setattr(ABC,sys.argv[1],forbidden) try: - import anysolver + import anyfesolver except RuntimeError as exc: assert "ABC annotation callback is incompatible" in str(exc),str(exc) else: diff --git a/tests/test_advanced_s4_batches.py b/tests/test_advanced_s4_batches.py index cade0388b..21958adcb 100644 --- a/tests/test_advanced_s4_batches.py +++ b/tests/test_advanced_s4_batches.py @@ -5,7 +5,7 @@ import numpy as np from scipy import sparse -from anysolver import ( +from anyfesolver import ( FEModel, GeneralizedShellSection, Material, @@ -14,12 +14,12 @@ assemble_stiffness_matrix, create_element, ) -from anysolver.nonlinear_performance_bootstrap import ( +from anyfesolver.nonlinear_performance_bootstrap import ( clear_nonlinear_assembly_cache, get_nonlinear_assembly_plan, install_nonlinear_performance_optimizations, ) -from anysolver.nonlinear_performance_batch_c import ( +from anyfesolver.nonlinear_performance_batch_c import ( assemble_reduced_system, build_reduced_assembly_plan, ) diff --git a/tests/test_analysis_session.py b/tests/test_analysis_session.py index 8013e00d9..1c98af25b 100644 --- a/tests/test_analysis_session.py +++ b/tests/test_analysis_session.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( AnalysisSession, BoundaryCondition, FixedSupport, @@ -13,9 +13,9 @@ solve_linear, solve_linear_many, ) -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel -from anysolver.mesh_gen import generate_beam_mesh +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.mesh_gen import generate_beam_mesh def _loads() -> tuple[LoadCase, LoadCase]: diff --git a/tests/test_arc_length.py b/tests/test_arc_length.py index eb881535a..f927184a1 100644 --- a/tests/test_arc_length.py +++ b/tests/test_arc_length.py @@ -5,11 +5,11 @@ import numpy as np import pytest -from anysolver.arc_length import ArcLengthControl, solve_static_arc_length -from anysolver.boundary import BoundaryCondition, LoadCase -from anysolver.elements import Element -from anysolver.fe_core import FEModel -from anysolver.nonlinear_static import ( +from anyfesolver.arc_length import ArcLengthControl, solve_static_arc_length +from anyfesolver.boundary import BoundaryCondition, LoadCase +from anyfesolver.elements import Element +from anyfesolver.fe_core import FEModel +from anyfesolver.nonlinear_static import ( _support_reaction_resultants, _support_reaction_resultants_from_forces, ) @@ -369,7 +369,7 @@ def test_arc_length_control_validates_post_buckling_fields(): def test_force_control_nonlinear_static_streams_progress_dicts(): - from anysolver.nonlinear_static import solve_static_nonlinear + from anyfesolver.nonlinear_static import solve_static_nonlinear model, load = _spring_model(k=1.0, c=1.0) progress: list[dict] = [] diff --git a/tests/test_arc_length_predictor_reuse.py b/tests/test_arc_length_predictor_reuse.py index 414ccceea..7de8f9b5c 100644 --- a/tests/test_arc_length_predictor_reuse.py +++ b/tests/test_arc_length_predictor_reuse.py @@ -4,11 +4,11 @@ import numpy as np import pytest -from anysolver import arc_length as arc -from anysolver.boundary import BoundaryCondition, LoadCase -from anysolver.control import CancellationToken, SolveCancelled -from anysolver.e4_pl_element import QualifiedE4PLShellElement -from anysolver.fe_core import FEModel +from anyfesolver import arc_length as arc +from anyfesolver.boundary import BoundaryCondition, LoadCase +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement +from anyfesolver.fe_core import FEModel def panel(): @@ -164,8 +164,8 @@ def singular(matrix, rhs, signature, **kwargs): def test_s3_and_plastic_material_keep_uncached_path(): - from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement - from anysolver.material_curves import dnv_c208_steel_curve + from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement + from anyfesolver.material_curves import dnv_c208_steel_curve model, load = panel() common = dict(model=model, load_cases=(load, None), contact=None, follower_active=False, kinematics="von_karman", cancellation_token=None) diff --git a/tests/test_authority_signature_immutable_cache.py b/tests/test_authority_signature_immutable_cache.py index ecef4d211..d3bbe0642 100644 --- a/tests/test_authority_signature_immutable_cache.py +++ b/tests/test_authority_signature_immutable_cache.py @@ -11,7 +11,7 @@ import numpy as np import pytest -from anysolver import e4_pl_s3_state as state +from anyfesolver import e4_pl_s3_state as state def fresh_signer(): @@ -138,7 +138,7 @@ def test_cache_is_bounded_owns_identity_and_rejects_large_aggregates(): def test_live_authority_tables_match_their_frozen_signatures(): - from anysolver.current_state_tangent import _QUALIFIED_PROFILES + from anyfesolver.current_state_tangent import _QUALIFIED_PROFILES signer, _, _ = fresh_signer() checked = 0 for profile in _QUALIFIED_PROFILES.values(): diff --git a/tests/test_b2_equilibrated_body_sections.py b/tests/test_b2_equilibrated_body_sections.py index 70a723c25..0c19c40e5 100644 --- a/tests/test_b2_equilibrated_body_sections.py +++ b/tests/test_b2_equilibrated_body_sections.py @@ -3,10 +3,10 @@ import numpy as np import pytest -from anysolver import stiffened_shell as api -from anysolver._b2_physical_flexibility_linear import LinearOperator -from anysolver._b2_f10_f11_point_attachment import compile_reference_point -from anysolver.control import CancellationToken +from anyfesolver import stiffened_shell as api +from anyfesolver._b2_physical_flexibility_linear import LinearOperator +from anyfesolver._b2_f10_f11_point_attachment import compile_reference_point +from anyfesolver.control import CancellationToken from test_stiffened_shell_b2_body_acceleration import _loaded_definition, _mass diff --git a/tests/test_b2_f09_fixed_aspect_wrench.py b/tests/test_b2_f09_fixed_aspect_wrench.py index 632c8f9e2..0a9c84a57 100644 --- a/tests/test_b2_f09_fixed_aspect_wrench.py +++ b/tests/test_b2_f09_fixed_aspect_wrench.py @@ -14,10 +14,10 @@ from scipy.sparse.linalg import splu import pytest -from anysolver import stiffened_shell +from anyfesolver import stiffened_shell -from anysolver._b2_physical_flexibility_linear import LinearSection -from anysolver._b2_physical_linear_definition import PhysicalB2Member +from anyfesolver._b2_physical_flexibility_linear import LinearSection +from anyfesolver._b2_physical_linear_definition import PhysicalB2Member WIDTH_DEPTH_M = ( diff --git a/tests/test_b2_f09_graph_reversal_probe.py b/tests/test_b2_f09_graph_reversal_probe.py index 9d20708bc..b7e83349b 100644 --- a/tests/test_b2_f09_graph_reversal_probe.py +++ b/tests/test_b2_f09_graph_reversal_probe.py @@ -10,7 +10,7 @@ from scipy.sparse import diags from scipy.sparse.linalg import splu -from anysolver._b2_physical_flexibility_linear import LinearSection +from anyfesolver._b2_physical_flexibility_linear import LinearSection PROBE = runpy.run_path(str(Path(__file__).resolve().parents[1] / "scripts" diff --git a/tests/test_b2_f09_physical_off_axis_elbow.py b/tests/test_b2_f09_physical_off_axis_elbow.py index 8e01b2f36..03703a3e3 100644 --- a/tests/test_b2_f09_physical_off_axis_elbow.py +++ b/tests/test_b2_f09_physical_off_axis_elbow.py @@ -16,8 +16,8 @@ PROBE = runpy.run_path(str(Path(__file__).resolve().parents[1] / "scripts" / "probe_b3_ge_e4_pl_g0_f09_graph_reversal.py")) -from anysolver._b2_physical_linear_batch_dev import CompiledB2AffineBatch -from anysolver._b2_physical_flexibility_linear import ( +from anyfesolver._b2_physical_linear_batch_dev import CompiledB2AffineBatch +from anyfesolver._b2_physical_flexibility_linear import ( LinearOperator, LinearSection, _flexibility, ) diff --git a/tests/test_b2_f09_public_shear_threshold.py b/tests/test_b2_f09_public_shear_threshold.py index eaf131fc7..dfbf7e563 100644 --- a/tests/test_b2_f09_public_shear_threshold.py +++ b/tests/test_b2_f09_public_shear_threshold.py @@ -11,9 +11,9 @@ import pytest from scipy import sparse -from anysolver import stiffened_shell -from anysolver.elements import BeamElement -from anysolver.fe_core import Material +from anyfesolver import stiffened_shell +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import Material @pytest.mark.parametrize("area", (1e-14, 2e-12, 1e-10)) diff --git a/tests/test_b2_f10_f11_point_attachment.py b/tests/test_b2_f10_f11_point_attachment.py index 290adea8c..e2c674e0e 100644 --- a/tests/test_b2_f10_f11_point_attachment.py +++ b/tests/test_b2_f10_f11_point_attachment.py @@ -7,12 +7,12 @@ from scipy.sparse.linalg import spsolve from scipy.spatial.transform import Rotation -from anysolver._b2_physical_flexibility_linear import LinearSection -from anysolver._b2_physical_linear_definition import PhysicalB2Member -from anysolver._b2_f10_f11_point_attachment import compile_reference_point -from anysolver._ge_beam3_pose_joint import RigidPoseJoint -from anysolver.e4_pl_element import QualifiedE4PLShellElement -from anysolver.fe_core import FEModel +from anyfesolver._b2_physical_flexibility_linear import LinearSection +from anyfesolver._b2_physical_linear_definition import PhysicalB2Member +from anyfesolver._b2_f10_f11_point_attachment import compile_reference_point +from anyfesolver._ge_beam3_pose_joint import RigidPoseJoint +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement +from anyfesolver.fe_core import FEModel VERTICES = np.array([[0., 0., 0.], [1., 0., 0.], [1., 1., 0.], [0., 1., 0.]]) diff --git a/tests/test_b2_f10_f11_s3_point_attachment.py b/tests/test_b2_f10_f11_s3_point_attachment.py index 8fdb16fb2..e540891ca 100644 --- a/tests/test_b2_f10_f11_s3_point_attachment.py +++ b/tests/test_b2_f10_f11_s3_point_attachment.py @@ -9,12 +9,12 @@ from scipy.sparse.linalg import spsolve from scipy.spatial.transform import Rotation -from anysolver._b2_physical_flexibility_linear import LinearSection -from anysolver._b2_physical_linear_definition import PhysicalB2Member -from anysolver._b2_f10_f11_point_attachment import compile_reference_point -from anysolver._ge_beam3_pose_joint import RigidPoseJoint -from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement -from anysolver.fe_core import FEModel +from anyfesolver._b2_physical_flexibility_linear import LinearSection +from anyfesolver._b2_physical_linear_definition import PhysicalB2Member +from anyfesolver._b2_f10_f11_point_attachment import compile_reference_point +from anyfesolver._ge_beam3_pose_joint import RigidPoseJoint +from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement +from anyfesolver.fe_core import FEModel TRIANGLE = np.array(((0., 0., 0.), (1., 0., 0.), (0., 1., 0.))) diff --git a/tests/test_b2_f12_coupled_mass_descriptor.py b/tests/test_b2_f12_coupled_mass_descriptor.py index dfbf388c8..1c70a3419 100644 --- a/tests/test_b2_f12_coupled_mass_descriptor.py +++ b/tests/test_b2_f12_coupled_mass_descriptor.py @@ -6,8 +6,8 @@ import pytest from scipy import linalg -from anysolver._b2_physical_linear_definition import MassMetadata -from anysolver._stiffened_shell_physical_q4_mass import physical_mass +from anyfesolver._b2_physical_linear_definition import MassMetadata +from anyfesolver._stiffened_shell_physical_q4_mass import physical_mass from test_b2_f10_f11_point_attachment import VERTICES, specimen diff --git a/tests/test_b2_f12_geometric_prestress_dev.py b/tests/test_b2_f12_geometric_prestress_dev.py index bb13ca98e..407b50c60 100644 --- a/tests/test_b2_f12_geometric_prestress_dev.py +++ b/tests/test_b2_f12_geometric_prestress_dev.py @@ -7,9 +7,9 @@ from scipy.linalg import eig from scipy.spatial.transform import Rotation -from anysolver._b2_physical_flexibility_linear import LinearOperator, LinearSection -from anysolver._b2_physical_linear_definition import PhysicalB2Member -from anysolver._ge_beam3_pose_joint import RigidPoseJoint +from anyfesolver._b2_physical_flexibility_linear import LinearOperator, LinearSection +from anyfesolver._b2_physical_linear_definition import PhysicalB2Member +from anyfesolver._ge_beam3_pose_joint import RigidPoseJoint from test_b2_f10_f11_point_attachment import specimen diff --git a/tests/test_b2_f13_affine_batch_dev.py b/tests/test_b2_f13_affine_batch_dev.py index 676ab4907..cada0f7b4 100644 --- a/tests/test_b2_f13_affine_batch_dev.py +++ b/tests/test_b2_f13_affine_batch_dev.py @@ -9,15 +9,15 @@ from scipy import sparse from scipy.sparse.linalg import spsolve -import anysolver._b2_physical_linear_batch_dev as batch_module -from anysolver.assembly import build_constraint_transformation -from anysolver.boundary import BoundaryCondition -from anysolver._b2_physical_linear_batch_dev import CompiledB2AffineBatch -from anysolver._b2_physical_flexibility_linear import LinearSection -from anysolver._b2_physical_linear_definition import PhysicalB2OperatorCache -from anysolver.control import CancellationToken -from anysolver.fe_core import FEModel -from anysolver.linalg import FactorizationCache +import anyfesolver._b2_physical_linear_batch_dev as batch_module +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.boundary import BoundaryCondition +from anyfesolver._b2_physical_linear_batch_dev import CompiledB2AffineBatch +from anyfesolver._b2_physical_flexibility_linear import LinearSection +from anyfesolver._b2_physical_linear_definition import PhysicalB2OperatorCache +from anyfesolver.control import CancellationToken +from anyfesolver.fe_core import FEModel +from anyfesolver.linalg import FactorizationCache from test_b2_physical_linear_oriented_graph import ( _exact_linear_solve, _force_method_energy, _members, _solve, ) diff --git a/tests/test_b2_large_scale_development_runner.py b/tests/test_b2_large_scale_development_runner.py index 6be3922ad..fa001b36c 100644 --- a/tests/test_b2_large_scale_development_runner.py +++ b/tests/test_b2_large_scale_development_runner.py @@ -26,7 +26,7 @@ def run_args(tmp_path, *, run_profile="source_dev", size="large", cases=1, def make_site(tmp_path): site = tmp_path / "site" - package = site / "anysolver" + package = site / "anyfesolver" package.mkdir(parents=True) for name in ("__init__.py", "stiffened_shell.py", "_stiffened_shell_b2_q4_panel_experimental.py", @@ -39,7 +39,7 @@ def make_site(tmp_path): for file in package.iterdir(): data = file.read_bytes() encoded = base64.urlsafe_b64encode(hashlib.sha256(data).digest()).rstrip(b"=").decode() - rows.append(f"anysolver/{file.name},sha256={encoded},{len(data)}") + rows.append(f"anyfesolver/{file.name},sha256={encoded},{len(data)}") rows.append("anysolver-0.4.7.dist-info/RECORD,,") (metadata / "RECORD").write_text("\n".join(rows) + "\n") return site @@ -48,8 +48,8 @@ def make_site(tmp_path): def bind_fake_wheel(tmp_path, site, monkeypatch, *, run_profile="installed_large_dev"): wheel = tmp_path / "frozen.whl" with ZipFile(wheel, "w") as archive: - for file in (site / "anysolver").iterdir(): - archive.write(file, f"anysolver/{file.name}") + for file in (site / "anyfesolver").iterdir(): + archive.write(file, f"anyfesolver/{file.name}") archive.write(site / "anysolver-0.4.7.dist-info/RECORD", "anysolver-0.4.7.dist-info/RECORD") if run_profile in ("installed_large_refinement_dev", "installed_beam_rich_dev"): @@ -118,7 +118,7 @@ def test_refinement_profile_requires_bound_site_budget_and_wheel(tmp_path, monke identity = runner.installed_site_identity(site, run_profile=name) assert identity["installed_wheel"] == str(wheel) assert identity["installed_wheel_sha256"] == runner.digest(wheel) - elsewhere = tmp_path / "elsewhere/anysolver" + elsewhere = tmp_path / "elsewhere/anyfesolver" elsewhere.mkdir(parents=True) (elsewhere / "__init__.py").write_text("# other site\n") for changes, message in ( @@ -131,7 +131,7 @@ def test_refinement_profile_requires_bound_site_budget_and_wheel(tmp_path, monke ): with pytest.raises(ValueError, match=message): runner.resolve_run(SimpleNamespace(**(vars(args) | changes))) - (site / "anysolver/dependency.py").write_text("tampered\n") + (site / "anyfesolver/dependency.py").write_text("tampered\n") with pytest.raises(ValueError, match="differs from frozen wheel"): runner.installed_site_identity(site, run_profile=name) @@ -158,9 +158,9 @@ def test_refinement_large_budget_is_distinct_from_focused_installed_checks(): def test_installed_site_identity_and_import_origin_guard(tmp_path, monkeypatch): site = make_site(tmp_path) wheel = bind_fake_wheel(tmp_path, site, monkeypatch) - package = site / "anysolver" + package = site / "anyfesolver" assert runner.verify_installed_import_origin(package / "__init__.py", site) == (package / "__init__.py") - source_package = tmp_path / "source/anysolver" + source_package = tmp_path / "source/anyfesolver" source_package.mkdir(parents=True) (source_package / "__init__.py").write_text("# source\n") with pytest.raises(RuntimeError, match="outside installed site"): @@ -238,8 +238,8 @@ def test_installed_zero_exit_needs_bound_child_record(tmp_path, monkeypatch): runtime = dict(python_optimize=0, affinity=[0], NUMBA_DISABLE_JIT="1", thread_env={name: "1" for name in runner.THREAD_ENV}, threadpools=[{"num_threads": 1}], - anysolver_file=str(site / "anysolver/__init__.py"), - anysolver_sha256=runner.digest(site / "anysolver/__init__.py")) + anyfesolver_file=str(site / "anyfesolver/__init__.py"), + anyfesolver_sha256=runner.digest(site / "anyfesolver/__init__.py")) record = dict(status="passed_development_probe", config=json.loads(json.dumps(config)), inventory=dict(runner.INSTALLED_EXPECTED_COUNTS), @@ -450,8 +450,8 @@ def test_beam_rich_child_receipt_requires_recovery_and_work(tmp_path, monkeypatc runtime = dict(python_optimize=0, affinity=[0], NUMBA_DISABLE_JIT="1", thread_env={name: "1" for name in runner.THREAD_ENV}, threadpools=[{"num_threads": 1}], - anysolver_file=str(site / "anysolver/__init__.py"), - anysolver_sha256=runner.digest(site / "anysolver/__init__.py")) + anyfesolver_file=str(site / "anyfesolver/__init__.py"), + anyfesolver_sha256=runner.digest(site / "anyfesolver/__init__.py")) record = dict(status="passed_development_probe", run_profile="installed_beam_rich_dev", config=json.loads(json.dumps(config)), inventory=dict(runner.BEAM_RICH_EXPECTED_COUNTS), @@ -479,9 +479,9 @@ def test_beam_rich_child_receipt_requires_recovery_and_work(tmp_path, monkeypatc def test_finite_response_accepts_real_physical_footprint_result_types(monkeypatch): monkeypatch.syspath_prepend(str(runner.ROOT / "src")) - from anysolver._stiffened_shell_b2_physical_rigid_footprint import ( + from anyfesolver._stiffened_shell_b2_physical_rigid_footprint import ( B2PhysicalRigidFootprintWrench, PhysicalFootprintNodeAction) - from anysolver._stiffened_shell_b2_q4_panel_experimental import ( + from anyfesolver._stiffened_shell_b2_q4_panel_experimental import ( B2PhysicalRigidFootprintBatchResult, B2PhysicalRigidFootprintSelectedCase, ExperimentalB2Q4PanelResponseEnvelope, ExperimentalB2Q4PanelMemberResultantEnvelope) @@ -527,8 +527,8 @@ def test_refinement_child_record_rejects_unaccounted_work(tmp_path, monkeypatch) runtime = dict(python_optimize=0, affinity=[0], NUMBA_DISABLE_JIT="1", thread_env={name: "1" for name in runner.THREAD_ENV}, threadpools=[{"num_threads": 1}], - anysolver_file=str(site / "anysolver/__init__.py"), - anysolver_sha256=runner.digest(site / "anysolver/__init__.py")) + anyfesolver_file=str(site / "anyfesolver/__init__.py"), + anyfesolver_sha256=runner.digest(site / "anyfesolver/__init__.py")) record = dict(status="passed_development_probe", run_profile="installed_large_refinement_dev", config=json.loads(json.dumps(config)), @@ -758,7 +758,7 @@ def test_corrective_capture_is_bounded_and_keeps_latest_attempt(): def test_failed_case_accurate_kkt_row_uses_unscaled_production_rhs(monkeypatch): from scipy import sparse monkeypatch.syspath_prepend(str(runner.ROOT / "src")) - from anysolver._stiffened_shell_b2_q4_panel_experimental import _bounded_accurate_residual + from anyfesolver._stiffened_shell_b2_q4_panel_experimental import _bounded_accurate_residual selector = sparse.csr_matrix(([1.], ([0], [0])), shape=(6, 1)) constraint = sparse.csr_matrix(([1.], ([0], [0])), shape=(1, 6)) diff --git a/tests/test_b2_loaded_point_owner.py b/tests/test_b2_loaded_point_owner.py index f75dbae98..c9e59872c 100644 --- a/tests/test_b2_loaded_point_owner.py +++ b/tests/test_b2_loaded_point_owner.py @@ -4,9 +4,9 @@ import pytest from scipy import sparse from scipy.spatial.transform import Rotation -from anysolver import stiffened_shell as api -from anysolver._b2_f10_f11_point_attachment import compile_reference_point -from anysolver.control import CancellationToken +from anyfesolver import stiffened_shell as api +from anyfesolver._b2_f10_f11_point_attachment import compile_reference_point +from anyfesolver.control import CancellationToken from test_stiffened_shell_b2_q4_panel_experimental import _panel, _independent_dense from test_stiffened_shell_b2_body_acceleration import _mass diff --git a/tests/test_b2_output_representation.py b/tests/test_b2_output_representation.py index b0a905c8b..a960bd2bf 100644 --- a/tests/test_b2_output_representation.py +++ b/tests/test_b2_output_representation.py @@ -6,8 +6,8 @@ import numpy as np import pytest -import anysolver._b2_physical_flexibility_linear as local -from anysolver import stiffened_shell +import anyfesolver._b2_physical_flexibility_linear as local +from anyfesolver import stiffened_shell def _section(): diff --git a/tests/test_b2_physical_fixed_wrench.py b/tests/test_b2_physical_fixed_wrench.py index dbbc51039..6934b8b17 100644 --- a/tests/test_b2_physical_fixed_wrench.py +++ b/tests/test_b2_physical_fixed_wrench.py @@ -6,10 +6,10 @@ import numpy as np import pytest -from anysolver._b2_physical_flexibility_linear import ( +from anyfesolver._b2_physical_flexibility_linear import ( ConditioningAdmissionError, LinearSection, _flexibility, _inverse_spd, ) -from anysolver._b2_physical_linear_definition import PhysicalB2Member +from anyfesolver._b2_physical_linear_definition import PhysicalB2Member def _inverse(matrix): diff --git a/tests/test_b2_physical_flexibility_linear.py b/tests/test_b2_physical_flexibility_linear.py index 8ae299b12..945095177 100644 --- a/tests/test_b2_physical_flexibility_linear.py +++ b/tests/test_b2_physical_flexibility_linear.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from anysolver._b2_physical_flexibility_linear import ( +from anyfesolver._b2_physical_flexibility_linear import ( ConditioningAdmissionError, LinearOperator, LinearSection, OPERATOR_ID, RepresentabilityError, ) diff --git a/tests/test_b2_physical_linear_definition.py b/tests/test_b2_physical_linear_definition.py index 0e7965424..686e2f0cd 100644 --- a/tests/test_b2_physical_linear_definition.py +++ b/tests/test_b2_physical_linear_definition.py @@ -5,9 +5,9 @@ import numpy as np import pytest -import anysolver._b2_physical_linear_definition as definition_module -from anysolver._b2_physical_flexibility_linear import LinearSection -from anysolver._b2_physical_linear_definition import ( +import anyfesolver._b2_physical_linear_definition as definition_module +from anyfesolver._b2_physical_flexibility_linear import LinearSection +from anyfesolver._b2_physical_linear_definition import ( GeometricMetadata, MassMetadata, PhysicalB2Member, PhysicalB2OperatorCache, PROFILE_ID, ) diff --git a/tests/test_b2_physical_linear_oriented_graph.py b/tests/test_b2_physical_linear_oriented_graph.py index 7f4634e34..ced90a830 100644 --- a/tests/test_b2_physical_linear_oriented_graph.py +++ b/tests/test_b2_physical_linear_oriented_graph.py @@ -7,8 +7,8 @@ from scipy import sparse from scipy.sparse.linalg import splu -from anysolver._b2_physical_flexibility_linear import LinearSection -from anysolver._b2_physical_linear_definition import PhysicalB2Member +from anyfesolver._b2_physical_flexibility_linear import LinearSection +from anyfesolver._b2_physical_linear_definition import PhysicalB2Member def _members(rotation=np.eye(3), origin=np.zeros(3)): diff --git a/tests/test_b2_physical_linear_trace.py b/tests/test_b2_physical_linear_trace.py index 394cacbc2..9895d110c 100644 --- a/tests/test_b2_physical_linear_trace.py +++ b/tests/test_b2_physical_linear_trace.py @@ -3,10 +3,10 @@ import numpy as np import pytest -from anysolver._b2_physical_flexibility_linear import ( +from anyfesolver._b2_physical_flexibility_linear import ( LinearOperator, LinearSection, RepresentabilityError, ) -from anysolver._b2_physical_linear_definition import PhysicalB2Member +from anyfesolver._b2_physical_linear_definition import PhysicalB2Member STATIONS = (0., 1/8, 1/3, .5, 7/8, 1.) diff --git a/tests/test_b2_physical_load_bubbles.py b/tests/test_b2_physical_load_bubbles.py index a363340d8..b1e12e3fd 100644 --- a/tests/test_b2_physical_load_bubbles.py +++ b/tests/test_b2_physical_load_bubbles.py @@ -4,10 +4,10 @@ import numpy as np import pytest -from anysolver._b2_physical_flexibility_linear import ( +from anyfesolver._b2_physical_flexibility_linear import ( LinearOperator, LinearSection, RepresentabilityError, ) -from anysolver._b2_physical_load_bubbles import FixedEndLoadBubbleMaps +from anyfesolver._b2_physical_load_bubbles import FixedEndLoadBubbleMaps def _section(coupled=False): diff --git a/tests/test_b2_point_foundation.py b/tests/test_b2_point_foundation.py index feb57dfc3..8afc50db1 100644 --- a/tests/test_b2_point_foundation.py +++ b/tests/test_b2_point_foundation.py @@ -11,9 +11,9 @@ from scipy.spatial.transform import Rotation from scipy.sparse.linalg import splu -from anysolver._b2_f10_f11_point_attachment import compile_reference_point -from anysolver._b2_physical_flexibility_linear import LinearSection -from anysolver._stiffened_shell_b2_q4_panel_experimental import _scaled_point_kkt +from anyfesolver._b2_f10_f11_point_attachment import compile_reference_point +from anyfesolver._b2_physical_flexibility_linear import LinearSection +from anyfesolver._stiffened_shell_b2_q4_panel_experimental import _scaled_point_kkt from test_b2_f10_f11_point_attachment import specimen, VERTICES from test_b2_f10_f11_s3_point_attachment import _specimen, TRIANGLE from test_b2_physical_linear_trace import _bvp_pose @@ -285,7 +285,7 @@ def test_nonplanar_q4_support_rejected(): @pytest.mark.parametrize("defect", ("dimension","nonfinite_t","nonfinite_u0","dependent_rows")) def test_invalid_affine_point_input(defect): - from anysolver._stiffened_shell_b2_q4_point_experimental import create_experimental_b2_q4_point_analysis + from anyfesolver._stiffened_shell_b2_q4_point_experimental import create_experimental_b2_q4_point_analysis member,vertices,_,_=base("q4",False) t=sparse.eye(36,format="csr")[:,:12];u0=np.zeros(36) if defect=="dimension":t=t[:35] diff --git a/tests/test_b3_e4_e01_matching_point_canary.py b/tests/test_b3_e4_e01_matching_point_canary.py index f364aeaa2..89070bc68 100644 --- a/tests/test_b3_e4_e01_matching_point_canary.py +++ b/tests/test_b3_e4_e01_matching_point_canary.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver._ge_beam3_pose_joint import RigidPoseJoint +from anyfesolver._ge_beam3_pose_joint import RigidPoseJoint from scripts.b3_e4_e01_matching_point_canary import ( SHELL, STATIONS, _beam_nodes, bond_rows, validate_work, ) diff --git a/tests/test_b3_e4_f03_ccx_solid_bond_screen.py b/tests/test_b3_e4_f03_ccx_solid_bond_screen.py index 3eb3c5540..7b916ef0a 100644 --- a/tests/test_b3_e4_f03_ccx_solid_bond_screen.py +++ b/tests/test_b3_e4_f03_ccx_solid_bond_screen.py @@ -590,7 +590,7 @@ def test_c1_penalty_runner_allows_only_its_known_static_notice(): def test_smooth_terminal_clearance_admits_shared_native_b3_frames(): """The native Q2 frame guard admits the C1 reference used by the solid.""" - source=MODULE.parents[1]/"src"/"anysolver"/"ge_beam3_curved_reference.py" + source=MODULE.parents[1]/"src"/"anyfesolver"/"ge_beam3_curved_reference.py" spec=importlib.util.spec_from_file_location("f03_curved_reference_source",source) curved=importlib.util.module_from_spec(spec) sys.modules[spec.name]=curved diff --git a/tests/test_b3_e4_f03_coupled_point_work_candidate.py b/tests/test_b3_e4_f03_coupled_point_work_candidate.py index f650a4f10..917933cf5 100644 --- a/tests/test_b3_e4_f03_coupled_point_work_candidate.py +++ b/tests/test_b3_e4_f03_coupled_point_work_candidate.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver._ge_beam3_pose_joint import RigidPoseJoint +from anyfesolver._ge_beam3_pose_joint import RigidPoseJoint from scripts._b3_e4_f03_coupled_point_work_candidate import directional_point_work from scripts._b3_e4_f03_native_fixture import build diff --git a/tests/test_b3_e4_f03_distributed_surface_finite.py b/tests/test_b3_e4_f03_distributed_surface_finite.py index e2788807b..a840a6a8c 100644 --- a/tests/test_b3_e4_f03_distributed_surface_finite.py +++ b/tests/test_b3_e4_f03_distributed_surface_finite.py @@ -13,7 +13,7 @@ FiniteSurfaceTopFaceLine, c1_hybrid_line_space, bounded_physical_compliance_screen, finite_chart_screen, ) -from anysolver.corotational import rotation_matrix_from_vector +from anyfesolver.corotational import rotation_matrix_from_vector from scripts.b3_e4_f03_local_footprint_work import ( bond_x_segments, distributed_surface_patch_trace, graded_terminal_coupling, structured_c1_mixed_point_shape, diff --git a/tests/test_b3_e4_f03_finite_patch_pose.py b/tests/test_b3_e4_f03_finite_patch_pose.py index 92676241e..cb1c33588 100644 --- a/tests/test_b3_e4_f03_finite_patch_pose.py +++ b/tests/test_b3_e4_f03_finite_patch_pose.py @@ -5,7 +5,7 @@ from scipy.spatial.transform import Rotation from scipy import linalg -from anysolver._ge_beam3_pose_joint import RigidPoseJoint +from anyfesolver._ge_beam3_pose_joint import RigidPoseJoint from scripts._b3_e4_f03_native_fixture import build from scripts._b3_e4_f03_native_spatial_port import NativeHalfCellSpatialPort from scripts.b3_e4_f03_finite_patch_pose import FlatQ4FiniteSupportPose diff --git a/tests/test_b3_e4_f03_l1_matched_flat_web.py b/tests/test_b3_e4_f03_l1_matched_flat_web.py index 74e2b8f96..2dd96053b 100644 --- a/tests/test_b3_e4_f03_l1_matched_flat_web.py +++ b/tests/test_b3_e4_f03_l1_matched_flat_web.py @@ -3,8 +3,8 @@ import numpy as np import pytest -from anysolver import stiffened_shell -from anysolver._stiffened_shell_l1_assembly_experimental import SPACE_A, SPACE_B +from anyfesolver import stiffened_shell +from anyfesolver._stiffened_shell_l1_assembly_experimental import SPACE_A, SPACE_B from scripts.b3_e4_f03_l1_matched_flat_web import build, evaluate from scripts.b3_e4_f03_l1_uncoupled_flat_controls import evaluate as controls diff --git a/tests/test_b3_e4_f03_l1_native_connection_probe.py b/tests/test_b3_e4_f03_l1_native_connection_probe.py index 698c168e7..55c5d5bea 100644 --- a/tests/test_b3_e4_f03_l1_native_connection_probe.py +++ b/tests/test_b3_e4_f03_l1_native_connection_probe.py @@ -4,7 +4,7 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver.corotational import rotation_matrix_from_vector +from anyfesolver.corotational import rotation_matrix_from_vector from scripts._b3_e4_f03_native_fixture import build from scripts._b3_e4_f03_native_spatial_port import NativeHalfCellSpatialPort from scripts.b3_e4_f03_l1_native_connection_probe import ( diff --git a/tests/test_b3_e4_f03_l1_physical_rail.py b/tests/test_b3_e4_f03_l1_physical_rail.py index 08f252e07..483a6cbfe 100644 --- a/tests/test_b3_e4_f03_l1_physical_rail.py +++ b/tests/test_b3_e4_f03_l1_physical_rail.py @@ -5,9 +5,9 @@ from scipy import linalg from scipy.spatial.transform import Rotation -from anysolver.corotational import rotation_matrix_from_vector -from anysolver._ge_beam3_pose_joint import RigidPoseJoint -from anysolver.elements import create_shell_element +from anyfesolver.corotational import rotation_matrix_from_vector +from anyfesolver._ge_beam3_pose_joint import RigidPoseJoint +from anyfesolver.elements import create_shell_element from scripts._b3_e4_f03_native_fixture import build from scripts._b3_e4_f03_native_spatial_port import NativeHalfCellSpatialPort from scripts.b3_e4_f03_plate_patch_work import raw_e4_tangent diff --git a/tests/test_b3_e4_f03_local_scientific_child_identity.py b/tests/test_b3_e4_f03_local_scientific_child_identity.py index d49b25ebc..dc1e01ea8 100644 --- a/tests/test_b3_e4_f03_local_scientific_child_identity.py +++ b/tests/test_b3_e4_f03_local_scientific_child_identity.py @@ -23,11 +23,11 @@ def _context(tmp_path, monkeypatch): run_root = tmp_path / "run" case_dir = run_root / "cases" / "Q1_L0" source_root.mkdir() - version = identity.observed_package("ANYsolver")[0] + version = identity.observed_package("ANYfeSolver")[0] (source_root / "pyproject.toml").write_text( - f"[project]\nname = 'ANYsolver'\nversion = '{version}'\n", encoding="ascii", + f"[project]\nname = 'ANYfeSolver'\nversion = '{version}'\n", encoding="ascii", ) - solver_origin = source_root / "src" / "anysolver" / "__init__.py" + solver_origin = source_root / "src" / "anyfesolver" / "__init__.py" solver_origin.parent.mkdir(parents=True) solver_origin.write_text("__version__ = '0.4.7'\n", encoding="ascii") case_dir.mkdir(parents=True) @@ -37,7 +37,7 @@ def _context(tmp_path, monkeypatch): def observed_package(name): version, origin = original_observed_package(name) - return version, str(solver_origin) if name == "ANYsolver" else origin + return version, str(solver_origin) if name == "ANYfeSolver" else origin monkeypatch.setattr(identity, "observed_package", observed_package) packages = tuple( @@ -120,17 +120,17 @@ def test_child_identity_rejects_runtime_package_and_hardware_changes(tmp_path, m identity.verify_child_context(directory, plan, SOURCE, DIGEST) -def test_child_rejects_external_anysolver_even_if_registration_matches(tmp_path, monkeypatch): +def test_child_rejects_external_anyfesolver_even_if_registration_matches(tmp_path, monkeypatch): directory, plan, _, value = _context(tmp_path, monkeypatch) - external = tmp_path / "external_anysolver.py" + external = tmp_path / "external_anyfesolver.py" external.write_text("external\n", encoding="ascii") package = value.packages[0] - value.packages = (SimpleNamespace(name="ANYsolver", version=package.version, + value.packages = (SimpleNamespace(name="ANYfeSolver", version=package.version, origin=str(external)), *value.packages[1:]) observed = identity.observed_package monkeypatch.setattr(identity, "observed_package", lambda name: (package.version, str(external)) - if name == "ANYsolver" else observed(name)) + if name == "ANYfeSolver" else observed(name)) with pytest.raises(ValueError, match="origin/version disagrees"): identity.verify_child_context(directory, plan, SOURCE, DIGEST) diff --git a/tests/test_b3_e4_f03_local_scientific_coordinator.py b/tests/test_b3_e4_f03_local_scientific_coordinator.py index 32f8c94a9..4fb48396d 100644 --- a/tests/test_b3_e4_f03_local_scientific_coordinator.py +++ b/tests/test_b3_e4_f03_local_scientific_coordinator.py @@ -162,19 +162,19 @@ def test_registration_preparation_is_exclusive_and_launch_free(monkeypatch, tmp_ source = tmp_path / "source" source.mkdir() (source / "pyproject.toml").write_text( - "[project]\nname = 'ANYsolver'\nversion = '1.0'\n", encoding="ascii", + "[project]\nname = 'ANYfeSolver'\nversion = '1.0'\n", encoding="ascii", ) for role, relative in registration.SOURCE_ROLES: path = source.joinpath(*relative.split("/")) path.parent.mkdir(parents=True, exist_ok=True) path.write_text(f"synthetic {role}\n", encoding="ascii") - solver_origin = source / "src" / "anysolver" / "__init__.py" + solver_origin = source / "src" / "anyfesolver" / "__init__.py" solver_origin.parent.mkdir(parents=True) solver_origin.write_text("__version__ = '0.4.7'\n", encoding="ascii") package_paths = {} for name in registration.PACKAGE_NAMES: - path = solver_origin if name == "ANYsolver" else tmp_path / f"{name}.py" - if name != "ANYsolver": + path = solver_origin if name == "ANYfeSolver" else tmp_path / f"{name}.py" + if name != "ANYfeSolver": path.write_text(f"package {name}\n", encoding="ascii") package_paths[name] = path hardware = registration.HardwareIdentity( @@ -200,10 +200,10 @@ def test_registration_preparation_is_exclusive_and_launch_free(monkeypatch, tmp_ for item in registered.cases) with pytest.raises(FileExistsError, match="must be new"): coordinator.prepare_registration(source, run_root) - (tmp_path / "ANYsolver.py").write_text("external solver\n", encoding="ascii") + (tmp_path / "ANYfeSolver.py").write_text("external solver\n", encoding="ascii") monkeypatch.setattr(coordinator.child_identity, "observed_package", lambda name: ("1.0", str(tmp_path / f"{name}.py"))) - with pytest.raises(ValueError, match="candidate ANYsolver origin/version"): + with pytest.raises(ValueError, match="candidate ANYfeSolver origin/version"): coordinator.prepare_registration(source, tmp_path / "run-external-origin") assert not (tmp_path / "run-external-origin").exists() diff --git a/tests/test_b3_e4_f03_local_scientific_registration.py b/tests/test_b3_e4_f03_local_scientific_registration.py index ac3ea4850..154ba448f 100644 --- a/tests/test_b3_e4_f03_local_scientific_registration.py +++ b/tests/test_b3_e4_f03_local_scientific_registration.py @@ -222,7 +222,7 @@ def test_registration_verifies_source_runtime_and_package_bytes(tmp_path): runtime_path.write_bytes(b"synthetic python executable\n") package_path = Path(value.packages[0].origin) package_path.write_bytes(b"x" * value.packages[0].origin_bytes) - with pytest.raises(ValueError, match="package ANYsolver byte identity"): + with pytest.raises(ValueError, match="package ANYfeSolver byte identity"): registration.read_registration(directory) diff --git a/tests/test_b3_e4_f03_native_spatial_port.py b/tests/test_b3_e4_f03_native_spatial_port.py index 783582679..fa80cfb81 100644 --- a/tests/test_b3_e4_f03_native_spatial_port.py +++ b/tests/test_b3_e4_f03_native_spatial_port.py @@ -6,14 +6,14 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver.boundary import BoundaryCondition -from anysolver.fe_core import FEModel -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry -from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection -from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_retained_generalized_state import Context, Program +from anyfesolver.boundary import BoundaryCondition +from anyfesolver.fe_core import FEModel +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry +from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection +from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_retained_generalized_state import Context, Program from scripts._b3_e4_f03_native_fixture import SECTION_DIAGONAL, build from scripts._b3_e4_f03_native_spatial_port import (NativeHalfCellSpatialPort, diff --git a/tests/test_b3_e4_f03_native_trace_kinematics.py b/tests/test_b3_e4_f03_native_trace_kinematics.py index bebd74e5a..649ce87d8 100644 --- a/tests/test_b3_e4_f03_native_trace_kinematics.py +++ b/tests/test_b3_e4_f03_native_trace_kinematics.py @@ -8,10 +8,10 @@ import pytest from scipy import linalg -from anysolver._ge_beam3_generalized_ellipsoid_section import ( +from anyfesolver._ge_beam3_generalized_ellipsoid_section import ( EllipsoidalGeneralizedSection, ) -from anysolver._ge_beam3_retained_generalized import RetainedGeneralizedOperator +from anyfesolver._ge_beam3_retained_generalized import RetainedGeneralizedOperator from scripts._b3_e4_f03_native_fixture import SECTION_DIAGONAL, build diff --git a/tests/test_b3_e4_f03_shell_finite_pose_candidate.py b/tests/test_b3_e4_f03_shell_finite_pose_candidate.py index 51c1837ac..31234e9c1 100644 --- a/tests/test_b3_e4_f03_shell_finite_pose_candidate.py +++ b/tests/test_b3_e4_f03_shell_finite_pose_candidate.py @@ -4,7 +4,7 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_pose_joint import _exp_terms +from anyfesolver._ge_beam3_pose_joint import _exp_terms from scripts._b3_e4_f03_shell_finite_pose_candidate import ( directional_pose, directional_pose_from_e4_total, pose, diff --git a/tests/test_b3_e4_f03_weak_line_candidate.py b/tests/test_b3_e4_f03_weak_line_candidate.py index c745b33df..f7530df21 100644 --- a/tests/test_b3_e4_f03_weak_line_candidate.py +++ b/tests/test_b3_e4_f03_weak_line_candidate.py @@ -4,7 +4,7 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_pose_joint import RigidPoseJoint +from anyfesolver._ge_beam3_pose_joint import RigidPoseJoint from scripts._b3_e4_f03_e4_trial_panel import FlatE4TrialPanel from scripts._b3_e4_f03_native_fixture import build diff --git a/tests/test_b3_e4_f06_beam_chart_v5.py b/tests/test_b3_e4_f06_beam_chart_v5.py index 1cf6311df..262450df8 100644 --- a/tests/test_b3_e4_f06_beam_chart_v5.py +++ b/tests/test_b3_e4_f06_beam_chart_v5.py @@ -7,8 +7,8 @@ import numpy as np import pytest -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_shell_joint_state import decode +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_shell_joint_state import decode os.environ.setdefault("NUMBA_CACHE_DIR", str(Path(tempfile.gettempdir()) / "f06_v5_numba")) diff --git a/tests/test_b3_e4_f06_owned_rebase_v4.py b/tests/test_b3_e4_f06_owned_rebase_v4.py index f2ae2b5ca..8b4869e3d 100644 --- a/tests/test_b3_e4_f06_owned_rebase_v4.py +++ b/tests/test_b3_e4_f06_owned_rebase_v4.py @@ -7,10 +7,10 @@ import numpy as np import pytest -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._ge_beam3_g3c_local_shell import deformation -from anysolver._ge_beam3_pose_joint import _exp_terms -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._ge_beam3_g3c_local_shell import deformation +from anyfesolver._ge_beam3_pose_joint import _exp_terms +from anyfesolver._ge_beam3_p5_seeded.core import canonical os.environ.setdefault("NUMBA_CACHE_DIR", str(Path(tempfile.gettempdir()) / "f06_v4_numba")) @@ -18,7 +18,7 @@ OwnedRebasePrototype, main, measure_pilot, physical_tangent, ) from scripts.probe_b3_ge_e4_pl_g0_f06_loaded_rebase_v3 import numeric_state, shell_spatial -from anysolver._ge_beam3_shell_joint_state import decode +from anyfesolver._ge_beam3_shell_joint_state import decode def _git_history_available(): @@ -329,7 +329,7 @@ def test_unregistered_pilot_reports_raw_scaled_metrics_and_identity(tmp_path): assert metric["schema"] == "G0_F06_CURVED_S3_V4_SCIENTIFIC_MEASUREMENT_V1" assert metric["scope"] == "G0_S3_OWNED_REBASE_MEASUREMENT_NOT_ADJUDICATED" assert metric["effective_environment"]["python_executable"] - assert metric["effective_environment"]["anysolver_import"] + assert metric["effective_environment"]["anyfesolver_import"] assert "numba_cache_dir" in metric["effective_environment"] assert set(metric["effective_environment"]["python_environment"]) == { "PYTHONPATH", "PYTHONNOUSERSITE"} @@ -344,9 +344,9 @@ def test_unregistered_pilot_reports_raw_scaled_metrics_and_identity(tmp_path): assert "blas" in metric["effective_environment"] assert len(metric["source_commit"]) == 40 assert len(metric["source_sha256"]) == 25 - assert {"src/anysolver/_ge_beam3_native_generalized_element.py", - "src/anysolver/_ge_beam3_generalized_ellipsoid_section.py", - "src/anysolver/_ge_beam3_generalized_static_boundary.py"} <= set( + assert {"src/anyfesolver/_ge_beam3_native_generalized_element.py", + "src/anyfesolver/_ge_beam3_generalized_ellipsoid_section.py", + "src/anyfesolver/_ge_beam3_generalized_static_boundary.py"} <= set( metric["source_sha256"]) assert metric["targets"] == (.5, 1., .75) assert metric["runtime_seconds"]["total"] > 0. diff --git a/tests/test_b3_e4_f06_q4_owned_rebase_v1.py b/tests/test_b3_e4_f06_q4_owned_rebase_v1.py index b4a1b528a..c8888e00b 100644 --- a/tests/test_b3_e4_f06_q4_owned_rebase_v1.py +++ b/tests/test_b3_e4_f06_q4_owned_rebase_v1.py @@ -15,10 +15,10 @@ os.environ.setdefault("NUMBA_CACHE_DIR", str(Path(tempfile.gettempdir()) / "f06_q4_numba")) -from anysolver._ge_beam3_g3c_local_shell import deformation -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_shell_joint_state import decode -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver._ge_beam3_g3c_local_shell import deformation +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_shell_joint_state import decode +from anyfesolver.control import CancellationToken, SolveCancelled from scripts.probe_b3_ge_e4_pl_g0_f06_q4_owned_rebase_v1 import ( Q4OwnedRebaseCandidate, SCHEMA, ) diff --git a/tests/test_b3_e4_f06_v4_adjudicator.py b/tests/test_b3_e4_f06_v4_adjudicator.py index 651b62886..b0985b48e 100644 --- a/tests/test_b3_e4_f06_v4_adjudicator.py +++ b/tests/test_b3_e4_f06_v4_adjudicator.py @@ -13,7 +13,7 @@ os.environ.setdefault("NUMBA_CACHE_DIR", str(Path(tempfile.gettempdir()) / "f06_v4_numba")) -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_p5_seeded.core import canonical from scripts.adjudicate_b3_ge_e4_pl_g0_f06_v4 import ( F_REF, ROOT, THRESHOLDS, _canonical, adjudicate, ) @@ -71,7 +71,7 @@ def _evidence(tmp_path, measurement): environment = body.get("effective_environment") or dict( python_executable=str(Path(sys.executable).resolve()), python_version=sys.version.split()[0], numpy_version="dry-run", - scipy_version="dry-run", anysolver_import=str((ROOT / "src/anysolver/__init__.py").resolve()), + scipy_version="dry-run", anyfesolver_import=str((ROOT / "src/anyfesolver/__init__.py").resolve()), psutil_version="dry-run", threadpoolctl_version="dry-run", platform="dry-run", numba_cache_dir=None, thread_environment={}, blas=[]) command = dict(argv=[environment["python_executable"], diff --git a/tests/test_b3_e4_f06_v4_supervisor.py b/tests/test_b3_e4_f06_v4_supervisor.py index 15ffc9ae4..eeba79e9b 100644 --- a/tests/test_b3_e4_f06_v4_supervisor.py +++ b/tests/test_b3_e4_f06_v4_supervisor.py @@ -209,12 +209,12 @@ def test_supervisor_requires_exact_source_inventory_before_claim(tmp_path, monke def test_supervisor_freezes_direct_runner_imports(): assert { - "src/anysolver/control.py", - "src/anysolver/_native_reference_modal.py", - "src/anysolver/_ge_beam3_native_generalized_loading.py", - "src/anysolver/_ge_beam3_native_line_loading.py", - "src/anysolver/_ge_beam3_centered_reference.py", - "src/anysolver/fe_core.py", + "src/anyfesolver/control.py", + "src/anyfesolver/_native_reference_modal.py", + "src/anyfesolver/_ge_beam3_native_generalized_loading.py", + "src/anyfesolver/_ge_beam3_native_line_loading.py", + "src/anyfesolver/_ge_beam3_centered_reference.py", + "src/anyfesolver/fe_core.py", } <= supervisor.MEASUREMENT_SOURCES diff --git a/tests/test_b3_e4_g0_f05_mixed_rejection_dev.py b/tests/test_b3_e4_g0_f05_mixed_rejection_dev.py index cb42868aa..4651bb6dc 100644 --- a/tests/test_b3_e4_g0_f05_mixed_rejection_dev.py +++ b/tests/test_b3_e4_g0_f05_mixed_rejection_dev.py @@ -10,12 +10,12 @@ import numpy as np -from anysolver._ge_beam3_pose_joint import RigidPoseJoint -from anysolver._ge_beam3_retained_plastic_program import ForceProgram, solve_force_program -from anysolver.e4_pl_s3_v2d_state import canonical_json_bytes -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEModel -from anysolver.material_curves import DNVC208MaterialCurve +from anyfesolver._ge_beam3_pose_joint import RigidPoseJoint +from anyfesolver._ge_beam3_retained_plastic_program import ForceProgram, solve_force_program +from anyfesolver.e4_pl_s3_v2d_state import canonical_json_bytes +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.material_curves import DNVC208MaterialCurve from test_ge_beam3_retained_plastic_force_probe import model_with_plasticity diff --git a/tests/test_b3_e4_g0_f06_native_chart_pullback_dev.py b/tests/test_b3_e4_g0_f06_native_chart_pullback_dev.py index 3b540d91c..1c8b29793 100644 --- a/tests/test_b3_e4_g0_f06_native_chart_pullback_dev.py +++ b/tests/test_b3_e4_g0_f06_native_chart_pullback_dev.py @@ -6,18 +6,18 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_p5.chart import exp_chart_terms -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_retained_fibre_program import solve_force_program -from anysolver._ge_beam3_retained_fibre_state import Context as FibreContext -from anysolver._ge_beam3_retained_generalized_state import ( +from anyfesolver._ge_beam3_p5.chart import exp_chart_terms +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_retained_fibre_program import solve_force_program +from anyfesolver._ge_beam3_retained_fibre_state import Context as FibreContext +from anyfesolver._ge_beam3_retained_generalized_state import ( Context as GeneralizedContext, Program as GeneralizedProgram, ) -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_seeded_load_program import ForceProgram -from anysolver._stiffened_shell_b3_chart import pullback_sparse_trial -from anysolver._stiffened_shell_b3_local_adapter import evaluate_sparse_trial +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_seeded_load_program import ForceProgram +from anyfesolver._stiffened_shell_b3_chart import pullback_sparse_trial +from anyfesolver._stiffened_shell_b3_local_adapter import evaluate_sparse_trial from scripts._b3_e4_f03_native_fixture import build from scripts.b3_e4_f03_square_section_control import square_torsion_constant from test_ge_beam3_retained_fibre import make_model diff --git a/tests/test_b3_e4_g0_f07_free_free_descriptor_dev.py b/tests/test_b3_e4_g0_f07_free_free_descriptor_dev.py index fa58ec497..9be1ecf70 100644 --- a/tests/test_b3_e4_g0_f07_free_free_descriptor_dev.py +++ b/tests/test_b3_e4_g0_f07_free_free_descriptor_dev.py @@ -4,9 +4,9 @@ import pytest from scipy import linalg -from anysolver._ge_beam3_coupled_modes import capture -from anysolver._ge_beam3_shell_joint_state import decode -from anysolver._ge_beam3_variational_shell import response as shell_response +from anyfesolver._ge_beam3_coupled_modes import capture +from anyfesolver._ge_beam3_shell_joint_state import decode +from anyfesolver._ge_beam3_variational_shell import response as shell_response from test_ge_beam3_coupled_modes import arguments, fixture diff --git a/tests/test_b3_e4_g0_f07_massless_descriptor.py b/tests/test_b3_e4_g0_f07_massless_descriptor.py index 4319da99e..17f33aa0f 100644 --- a/tests/test_b3_e4_g0_f07_massless_descriptor.py +++ b/tests/test_b3_e4_g0_f07_massless_descriptor.py @@ -7,8 +7,8 @@ import numpy as np from scipy import linalg -from anysolver._ge_beam3_native_buckling import factor_buckling -from anysolver._native_paired_factor_chain_modes import solve_paired_factor_chain_modes +from anyfesolver._ge_beam3_native_buckling import factor_buckling +from anyfesolver._native_paired_factor_chain_modes import solve_paired_factor_chain_modes def test_massless_retained_coordinate_and_multiplier_are_algebraic(): diff --git a/tests/test_b3_e4_g0_f07_native_physical_descriptor.py b/tests/test_b3_e4_g0_f07_native_physical_descriptor.py index 32271e9d7..b90a4f162 100644 --- a/tests/test_b3_e4_g0_f07_native_physical_descriptor.py +++ b/tests/test_b3_e4_g0_f07_native_physical_descriptor.py @@ -9,7 +9,7 @@ import pytest from scipy import linalg -from anysolver._ge_beam3_coupled_modes import capture, modes +from anyfesolver._ge_beam3_coupled_modes import capture, modes from test_ge_beam3_coupled_modes import arguments, fixture diff --git a/tests/test_b3_e4_g0_f08_adapter_contract.py b/tests/test_b3_e4_g0_f08_adapter_contract.py index 159e0b542..bd109c84e 100644 --- a/tests/test_b3_e4_g0_f08_adapter_contract.py +++ b/tests/test_b3_e4_g0_f08_adapter_contract.py @@ -7,17 +7,17 @@ import numpy as np import pytest -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_retained_fibre_program import solve_force_program -from anysolver._ge_beam3_retained_generalized_program import solve as solve_generalized -from anysolver._ge_beam3_retained_fibre_state import Context as FibreContext -from anysolver._ge_beam3_retained_generalized_state import ( +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_retained_fibre_program import solve_force_program +from anyfesolver._ge_beam3_retained_generalized_program import solve as solve_generalized +from anyfesolver._ge_beam3_retained_fibre_state import Context as FibreContext +from anyfesolver._ge_beam3_retained_generalized_state import ( Context as GeneralizedContext, Program as GeneralizedProgram, ) -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_seeded_load_program import ForceProgram -from anysolver._stiffened_shell_b3_local_adapter import ( +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_seeded_load_program import ForceProgram +from anyfesolver._stiffened_shell_b3_local_adapter import ( evaluate_local_trial, evaluate_sparse_trial, ) from scripts._b3_e4_f03_native_fixture import build diff --git a/tests/test_b3_e4_g0_f08_local_operator_seam.py b/tests/test_b3_e4_g0_f08_local_operator_seam.py index e005aec55..ff7219b32 100644 --- a/tests/test_b3_e4_g0_f08_local_operator_seam.py +++ b/tests/test_b3_e4_g0_f08_local_operator_seam.py @@ -6,15 +6,15 @@ import pytest from scipy import sparse -from anysolver._ge_beam3_fibre_line_work import evaluate as line_work -from anysolver._ge_beam3_generalized_static_boundary import ( +from anyfesolver._ge_beam3_fibre_line_work import evaluate as line_work +from anyfesolver._ge_beam3_generalized_static_boundary import ( cell_couple_load, spatial_jacobian, ) -from anysolver._ge_beam3_operator_validation_scope import operator_call -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_retained_fibre_state import Context as FibreContext -from anysolver._ge_beam3_retained_fibre_program import solve_force_program -from anysolver._ge_beam3_seeded_load_program import ForceProgram +from anyfesolver._ge_beam3_operator_validation_scope import operator_call +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_retained_fibre_state import Context as FibreContext +from anyfesolver._ge_beam3_retained_fibre_program import solve_force_program +from anyfesolver._ge_beam3_seeded_load_program import ForceProgram from scripts._b3_e4_f03_native_fixture import build from scripts.b3_e4_f03_square_section_control import square_torsion_constant from test_ge_beam3_retained_fibre import make_model diff --git a/tests/test_b3_ge_production_optin.py b/tests/test_b3_ge_production_optin.py index 0cfd33288..62d4653ef 100644 --- a/tests/test_b3_ge_production_optin.py +++ b/tests/test_b3_ge_production_optin.py @@ -6,10 +6,10 @@ import numpy as np import pytest -from anysolver import b3_ge -from anysolver._ge_beam3_native_analysis import NativeBeamAnalysis -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver.elements import QuadraticBeamElement, create_element +from anyfesolver import b3_ge +from anyfesolver._ge_beam3_native_analysis import NativeBeamAnalysis +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver.elements import QuadraticBeamElement, create_element from test_ge_beam3_native_generalized import problem @@ -96,7 +96,7 @@ def test_legacy_b3_factory_default_is_unchanged_and_b3_ge_is_not_an_element_alia def test_historical_ge_beam3_is_not_reinterpreted(): - from anysolver.ge_beam3_element import GeometricallyExactBeam3D3NElement + from anyfesolver.ge_beam3_element import GeometricallyExactBeam3D3NElement historical = create_element( "ge-beam3", diff --git a/tests/test_batch_b_activation.py b/tests/test_batch_b_activation.py index 61193cf09..9b18d99f7 100644 --- a/tests/test_batch_b_activation.py +++ b/tests/test_batch_b_activation.py @@ -1,6 +1,6 @@ -from anysolver.jit_compiler import JIT_ENABLED -from anysolver.nonlinear_performance_bootstrap import nonlinear_performance_status -from anysolver.nonlinear_static import _ensure_nonlinear_acceleration +from anyfesolver.jit_compiler import JIT_ENABLED +from anyfesolver.nonlinear_performance_bootstrap import nonlinear_performance_status +from anyfesolver.nonlinear_static import _ensure_nonlinear_acceleration def test_batch_b_activation_policy(): diff --git a/tests/test_beam_axis_conventions.py b/tests/test_beam_axis_conventions.py index f7d3c618d..e091d03b1 100644 --- a/tests/test_beam_axis_conventions.py +++ b/tests/test_beam_axis_conventions.py @@ -14,11 +14,11 @@ import numpy as np import pytest -from anysolver.fe_core import FEModel -from anysolver.elements import BeamElement, QuadraticBeamElement -from anysolver.boundary import BoundaryCondition, FixedSupport, LoadCase, PinnedSupport -from anysolver.assembly import solve_linear -from anysolver.buckling import solve_eigenvalue_buckling +from anyfesolver.fe_core import FEModel +from anyfesolver.elements import BeamElement, QuadraticBeamElement +from anyfesolver.boundary import BoundaryCondition, FixedSupport, LoadCase, PinnedSupport +from anyfesolver.assembly import solve_linear +from anyfesolver.buckling import solve_eigenvalue_buckling E = 210.0e9 NU = 0.3 diff --git a/tests/test_beam_shell_checkpoint_workflow.py b/tests/test_beam_shell_checkpoint_workflow.py index 55523f18c..06e2d16d7 100644 --- a/tests/test_beam_shell_checkpoint_workflow.py +++ b/tests/test_beam_shell_checkpoint_workflow.py @@ -13,9 +13,9 @@ import numpy as np import pytest -from anysolver import CancellationToken -from anysolver.nonlinear_restart import load_nonlinear_checkpoint -from anysolver.constraint_audit import constraint_residual_summary +from anyfesolver import CancellationToken +from anyfesolver.nonlinear_restart import load_nonlinear_checkpoint +from anyfesolver.constraint_audit import constraint_residual_summary from examples import beam_shell_coupling as example from test_nonlinear_beam_shell_slice3_continuation import ( _assert_states_allclose, _independent_equilibrium, diff --git a/tests/test_beam_shell_connection_options.py b/tests/test_beam_shell_connection_options.py index 24a8e666b..9485fe764 100644 --- a/tests/test_beam_shell_connection_options.py +++ b/tests/test_beam_shell_connection_options.py @@ -6,11 +6,11 @@ import numpy as np import pytest -from anysolver import (BoundaryCondition, CoupledBeamShellElement, FEModel, +from anyfesolver import (BoundaryCondition, CoupledBeamShellElement, FEModel, InterpolatedBeamShellMPCElement, LoadCase, MeshConfig, PanelGeometry, generate_stiffened_panel_mesh, solve_static_nonlinear) -from anysolver.elements import BeamElement -import anysolver.mesh_gen as mesh_gen +from anyfesolver.elements import BeamElement +import anyfesolver.mesh_gen as mesh_gen def test_documented_complete_example_executes(): diff --git a/tests/test_beam_shell_verification.py b/tests/test_beam_shell_verification.py index d8c35f628..c2f8f1b04 100644 --- a/tests/test_beam_shell_verification.py +++ b/tests/test_beam_shell_verification.py @@ -8,8 +8,8 @@ from types import SimpleNamespace from pathlib import Path -from anysolver import run_beam_shell_verification, verification_manifest_cases, write_beam_shell_verification_report -import anysolver.beam_shell_verification as beam_shell_verification +from anyfesolver import run_beam_shell_verification, verification_manifest_cases, write_beam_shell_verification_report +import anyfesolver.beam_shell_verification as beam_shell_verification def test_manifest_contains_stable_case_ids_from_spec() -> None: @@ -195,8 +195,12 @@ def evaluator(case): def test_beam_shell_verification_report_separates_pass_and_xfail(tmp_path: Path, monkeypatch) -> None: monkeypatch.chdir(tmp_path) report = run_beam_shell_verification() + (tmp_path / "beam_shell_verification.json").write_text( + json.dumps(report, indent=2), encoding="utf-8" + ) + failed = [row for row in report["results"] if row["status"] == "FAIL"] - assert report["status"] == "passed" + assert report["status"] == "passed", failed assert report["test_execution_status"] == "passed" assert report["verification_completion_status"] == "complete" assert report["release_gate_status"] == "passed" diff --git a/tests/test_beam_shell_workflow.py b/tests/test_beam_shell_workflow.py index 45d75bedd..19381d24f 100644 --- a/tests/test_beam_shell_workflow.py +++ b/tests/test_beam_shell_workflow.py @@ -16,13 +16,13 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( CancellationToken, CoupledBeamShellElement, InterpolatedBeamShellMPCElement, solve_static_nonlinear, ) -from anysolver.elements import BeamElement +from anyfesolver.elements import BeamElement EXAMPLE = Path(__file__).resolve().parents[1] / "examples" / "beam_shell_coupling.py" diff --git a/tests/test_benchmark_driver.py b/tests/test_benchmark_driver.py index e2aec2171..8a4650520 100644 --- a/tests/test_benchmark_driver.py +++ b/tests/test_benchmark_driver.py @@ -2,7 +2,7 @@ Covers the frozen case histories, the exact per-case selected-response digest, and the driver-side equivalent backend-operation instrumentation used when the -measured checkout predates ``anysolver.linalg.backend_operation_counts``. +measured checkout predates ``anyfesolver.linalg.backend_operation_counts``. """ import importlib.util import math @@ -77,7 +77,7 @@ def _active_solver(self): def stub_linalg(): - module = types.ModuleType('stub_anysolver_linalg') + module = types.ModuleType('stub_anyfesolver_linalg') module._pardiso_full_factorize = lambda solver, prepared: None module._new_pypardiso_solver = lambda *, mtype: StubPardisoSolver() module._PardisoFactorization = StubFactorization diff --git a/tests/test_checkpoint_inert_node_observation.py b/tests/test_checkpoint_inert_node_observation.py index a68b9bc3b..46856a632 100644 --- a/tests/test_checkpoint_inert_node_observation.py +++ b/tests/test_checkpoint_inert_node_observation.py @@ -3,8 +3,8 @@ import numpy as np import pytest -from anysolver.fe_core import FEModel, Node -from anysolver import nonlinear_restart as restart +from anyfesolver.fe_core import FEModel, Node +from anyfesolver import nonlinear_restart as restart def model_and_node(): diff --git a/tests/test_ci5_v2d_binding_refusal.py b/tests/test_ci5_v2d_binding_refusal.py index abe28ea25..f8bc42ee7 100644 --- a/tests/test_ci5_v2d_binding_refusal.py +++ b/tests/test_ci5_v2d_binding_refusal.py @@ -14,7 +14,7 @@ import numpy as np import pytest -from anysolver.e4_pl_s3_v2d_state import ( +from anyfesolver.e4_pl_s3_v2d_state import ( V2DStateError, canonical_json_bytes, initialize_v2d_state, diff --git a/tests/test_common_main_import_admission.py b/tests/test_common_main_import_admission.py index d2b423c86..df95bec25 100644 --- a/tests/test_common_main_import_admission.py +++ b/tests/test_common_main_import_admission.py @@ -1,11 +1,11 @@ """The combined public entry points retain ordinary load-vector admission.""" def test_combined_public_namespaces_preserve_builtin_gravity(): - import anysolver - from anysolver import stiffened_shell, general_contact + import anyfesolver + from anyfesolver import stiffened_shell, general_contact from test_static_batch_coupled_acceleration_guards import _model, _gravity, _owned, _public assert stiffened_shell.create_analysis is not None assert general_contact.report_general_contact_capability is not None - assert anysolver.iter_linear_batches is not None + assert anyfesolver.iter_linear_batches is not None model = _model() case = _gravity() owned = _owned(model, case) @@ -14,7 +14,7 @@ def test_combined_public_namespaces_preserve_builtin_gravity(): def test_foreign_warning_facade_is_refused_without_observation(): - from anysolver import boundary + from anyfesolver import boundary import warnings import pytest if boundary._WARNING_IMPLEMENTATION is warnings: @@ -32,7 +32,7 @@ def __getattribute__(self, name): def test_foreign_warning_context_getter_is_refused(monkeypatch): - from anysolver import boundary + from anyfesolver import boundary import warnings import pytest if boundary._WARNING_IMPLEMENTATION is warnings: @@ -44,7 +44,7 @@ def test_foreign_warning_context_getter_is_refused(monkeypatch): def test_missing_or_foreign_warning_context_is_refused(monkeypatch): - from anysolver import boundary + from anyfesolver import boundary import warnings import pytest if boundary._WARNING_IMPLEMENTATION is warnings: @@ -71,7 +71,7 @@ def foreign(): seen.append('foreign') return original() warnings._get_context = foreign -import anysolver.boundary as boundary +import anyfesolver.boundary as boundary seen.clear() assert not boundary._numpy_error_routes_are_builtin() assert not seen @@ -83,7 +83,7 @@ def foreign(): def test_ordinary_warning_writer_and_context_refusal(monkeypatch, tmp_path): import io, sys, warnings - from anysolver import boundary + from anyfesolver import boundary if boundary._WARNING_IMPLEMENTATION is warnings: import pytest pytest.skip('This stdlib does not split its warnings implementation') @@ -106,7 +106,7 @@ def test_preimport_warning_context_descriptor_is_not_authorized(): code = '''import _py_warnings seen = [] _py_warnings._GlobalContext.log = property(lambda self: seen.append('foreign')) -import anysolver.boundary as boundary +import anyfesolver.boundary as boundary seen.clear() assert not boundary._numpy_error_routes_are_builtin() assert not seen diff --git a/tests/test_compensated_contractions_vectorized.py b/tests/test_compensated_contractions_vectorized.py index fc1403ab7..b184258c2 100644 --- a/tests/test_compensated_contractions_vectorized.py +++ b/tests/test_compensated_contractions_vectorized.py @@ -2,7 +2,7 @@ import numpy as np import pytest -from anysolver import _compensated_contractions as fast +from anyfesolver import _compensated_contractions as fast @pytest.fixture(autouse=True, params=["native", "numpy"]) def backend(request, monkeypatch): @@ -186,7 +186,7 @@ def test_weighted_sum_first_failure_type_matches_scalar_policy(): def test_prepared_q4_authority_covers_native_kernels(backend): if backend != "native": pytest.skip("the authority guard deliberately refuses a flipped backend flag") - from anysolver import prepared_static_q4 as q + from anyfesolver import prepared_static_q4 as q assert {row[0] for row in q._NATIVE_KERNEL_FACTS} >= {"contract_product", "contract_sum", "contract_weighted"} q.require_q4_kernel_authority() kernels = fast._native diff --git a/tests/test_compensated_fused_kernels.py b/tests/test_compensated_fused_kernels.py index 70864b220..fd5319792 100644 --- a/tests/test_compensated_fused_kernels.py +++ b/tests/test_compensated_fused_kernels.py @@ -12,8 +12,8 @@ import numpy as np import pytest -from anysolver import _compensated_contractions as cc -from anysolver import vectorized_nonlinear as vn +from anyfesolver import _compensated_contractions as cc +from anyfesolver import vectorized_nonlinear as vn # Skipped only when the compiled kernels are really unavailable (or explicitly opted out); # a fused path that was disabled at import by a failed self-check must make these tests fail. @@ -212,7 +212,7 @@ def test_scalar_square_uses_libm_pow_not_multiply(): def test_fused_backend_flag_is_authority_guarded(): - from anysolver import prepared_static_q4 as q + from anyfesolver import prepared_static_q4 as q q.require_q4_kernel_authority() names = {row[0] for row in q._NATIVE_KERNEL_FACTS} assert {"fused_shell_zero_tangent", "fused_elastic_increment", "_mm", "_tc"} <= names diff --git a/tests/test_compensated_native_stress.py b/tests/test_compensated_native_stress.py index b12db0d41..2493bb895 100644 --- a/tests/test_compensated_native_stress.py +++ b/tests/test_compensated_native_stress.py @@ -2,7 +2,7 @@ import numpy as np import pytest -from anysolver import _compensated_contractions as fast +from anyfesolver import _compensated_contractions as fast from test_compensated_contractions_vectorized import ( dot as scalar_dot, reference_product, reference_sum_arrays, reference_weighted_sum) diff --git a/tests/test_concentrated_mass.py b/tests/test_concentrated_mass.py index abbbf0520..ad29147d1 100644 --- a/tests/test_concentrated_mass.py +++ b/tests/test_concentrated_mass.py @@ -1,9 +1,9 @@ import copy import numpy as np import pytest -from anysolver import FEModel, LoadCase, calculate_mass_properties, solve_inertia_relief, AnalysisSession -from anysolver.concentrated_mass import ConcentratedMass -from anysolver.matrix_assembly import assemble_mass_matrix +from anyfesolver import FEModel, LoadCase, calculate_mass_properties, solve_inertia_relief, AnalysisSession +from anyfesolver.concentrated_mass import ConcentratedMass +from anyfesolver.matrix_assembly import assemble_mass_matrix from test_inertia_relief import bar, rigid, load_vector @@ -47,7 +47,7 @@ def test_invalid_mass(mass,J): def test_batch_matches_scalar_and_refuses_midstream_mass_mutation(): - from anysolver import iter_linear_batches, StaticCase, StaticBatchError + from anyfesolver import iter_linear_batches, StaticCase, StaticBatchError m=bar(); m.add_concentrated_mass(4,5.,offset=(1.,2.,3.),inertia_cg=np.diag([2.,3.,4.])) M,_=assemble_mass_matrix(m) a=rigid(m,np.zeros(3))@np.array([.2,.1,-.3,.4,.5,-.2]) @@ -64,7 +64,7 @@ def cases(): def test_mesh_positional_constructor_stays_compatible(): - from anysolver.fe_core import FEMesh,DOFManager + from anyfesolver.fe_core import FEMesh,DOFManager activity=object(); revisions={'mass':0} mesh=FEMesh({}, {}, DOFManager(), {}, activity, revisions) assert mesh.element_activity is activity and mesh.revisions is revisions @@ -73,7 +73,7 @@ def test_mesh_positional_constructor_stays_compatible(): def test_legacy_pickle_state_without_concentrated_masses(): import pickle - from anysolver.fe_core import FEMesh + from anyfesolver.fe_core import FEMesh m=bar(); state=m.mesh.__getstate__(); state.pop('concentrated_masses') mesh=FEMesh.__new__(FEMesh); mesh.__setstate__(state) assert mesh.concentrated_masses=={} @@ -83,7 +83,7 @@ def test_legacy_pickle_state_without_concentrated_masses(): def test_exact_canonical_record_types(): - from anysolver.concentrated_mass import identity + from anyfesolver.concentrated_mass import identity class Sub(ConcentratedMass): pass good=ConcentratedMass(1.) for bad in ({4:[Sub(1.)]},{4.0:[good]},{True:[good]},{4:good},{4:{good}}): @@ -109,7 +109,7 @@ def test_rotated_inertia_roundoff_is_symmetrized(): def test_empty_concentrated_mass_keeps_legacy_relief_identity(): - from anysolver.inertia_relief import _mass_identity + from anyfesolver.inertia_relief import _mass_identity m=bar(); m.add_point_mass(4,3.) assert _mass_identity(m)==((4,3.),) m.add_concentrated_mass(4,1.) @@ -129,7 +129,7 @@ def test_pure_gravity_inertia_relief_with_eccentric_mass(): def _native_mesh(concentrated): from types import SimpleNamespace - from anysolver.fe_core import DOFManager + from anyfesolver.fe_core import DOFManager dm=DOFManager(); dm.add_node(1) return SimpleNamespace(elements={1:object()},dof_manager=dm,nodes={1:None},point_masses={}, element_activity=None,concentrated_masses=concentrated) @@ -137,7 +137,7 @@ def _native_mesh(concentrated): def test_native_distributed_identity_rejects_concentrated_masses(): from types import SimpleNamespace - from anysolver._ge_beam3_native_generalized_program import _model_identity + from anyfesolver._ge_beam3_native_generalized_program import _model_identity model=SimpleNamespace(mesh=_native_mesh({1:[ConcentratedMass(1.)]}),constraint_equations=[]) with pytest.raises(ValueError,match='activity/dynamics'): _model_identity(model,16) # Control: without the mass admission proceeds to the element-authority check. @@ -146,8 +146,8 @@ def test_native_distributed_identity_rejects_concentrated_masses(): def test_native_fibre_load_admission_rejects_concentrated_masses(monkeypatch): - import anysolver._ge_beam3_native_fibre_static_element as fibre - from anysolver._ge_beam3_native_load_admission import assemble_nodal_forces + import anyfesolver._ge_beam3_native_fibre_static_element as fibre + from anyfesolver._ge_beam3_native_load_admission import assemble_nodal_forces class Fake: def _check(self,mesh): pass monkeypatch.setattr(fibre,'NativeFibreStaticElement',Fake) diff --git a/tests/test_constraint_audit.py b/tests/test_constraint_audit.py index 08f23b0a3..7a6575edc 100644 --- a/tests/test_constraint_audit.py +++ b/tests/test_constraint_audit.py @@ -1,12 +1,12 @@ import numpy as np import pytest -from anysolver import audit_constraints, constraint_residual_summary -from anysolver.assembly import build_constraint_transformation -import anysolver.assembly as assembly_module -from anysolver.boundary import BoundaryCondition -from anysolver.fe_core import FEModel -from anysolver.mesh_gen import InterpolatedBeamShellMPCElement +from anyfesolver import audit_constraints, constraint_residual_summary +from anyfesolver.assembly import build_constraint_transformation +import anyfesolver.assembly as assembly_module +from anyfesolver.boundary import BoundaryCondition +from anyfesolver.fe_core import FEModel +from anyfesolver.mesh_gen import InterpolatedBeamShellMPCElement class MPCElement: diff --git a/tests/test_contact_nonfinite_refusal.py b/tests/test_contact_nonfinite_refusal.py index 6b054eb21..b2dd2dd9c 100644 --- a/tests/test_contact_nonfinite_refusal.py +++ b/tests/test_contact_nonfinite_refusal.py @@ -1,7 +1,7 @@ """Nonfinite sphere/contact inputs are refused at construction, not deep in the solve.""" import pytest -import anysolver as fs +import anyfesolver as fs NAN, INF = float("nan"), float("inf") diff --git a/tests/test_contact_work_buffer.py b/tests/test_contact_work_buffer.py index d4770633b..f405a2ddb 100644 --- a/tests/test_contact_work_buffer.py +++ b/tests/test_contact_work_buffer.py @@ -3,7 +3,7 @@ import numpy as np -from anysolver.contact import ( +from anyfesolver.contact import ( RigidSphereImpact, SphereContactConfig, SphereContactRecord, @@ -13,7 +13,7 @@ _verification_contact_panel, assemble_sphere_contact_load_vector, ) -from anysolver.contact_performance import ContactWorkBuffer, ContactWorkCounters +from anyfesolver.contact_performance import ContactWorkBuffer, ContactWorkCounters def _record_payload(records): diff --git a/tests/test_corotational.py b/tests/test_corotational.py index 23acd2ae2..cddb51064 100644 --- a/tests/test_corotational.py +++ b/tests/test_corotational.py @@ -5,22 +5,22 @@ import numpy as np import pytest -from anysolver.boundary import BoundaryCondition, LoadCase -from anysolver.corotational import ( +from anyfesolver.boundary import BoundaryCondition, LoadCase +from anyfesolver.corotational import ( corotational_element_response, rotation_matrix_from_vector, rotation_vector_from_matrix, ) -from anysolver.elements import ( +from anyfesolver.elements import ( BeamElement, LegacyShellElement, LegacyQ4DeprecationWarning, QuadraticBeamElement, create_shell_element, ) -from anysolver.fe_core import FEModel -from anysolver.material_curves import dnv_c208_steel_curve -from anysolver.nonlinear_static import _assemble_nonlinear_system, solve_static_nonlinear +from anyfesolver.fe_core import FEModel +from anyfesolver.material_curves import dnv_c208_steel_curve +from anyfesolver.nonlinear_static import _assemble_nonlinear_system, solve_static_nonlinear E_STEEL = 2.1e11 @@ -263,7 +263,7 @@ def test_legacy_corotational_matches_von_karman_for_registered_small_displacemen # Note the realistic load scale: the corotational pull-back has an # intrinsic residual floor of about eps * ||K|| * L per element, so # convergence tolerances must sit above that floor (documented in - # anysolver.corotational). + # anyfesolver.corotational). model = _single_legacy_shell_model() model.add_boundary_condition(BoundaryCondition("clamp", [1, 4], {"ux": 0, "uy": 0, "uz": 0, "rx": 0, "ry": 0, "rz": 0})) # ~0.5% of span deflection: small-displacement regime, but the residual @@ -283,7 +283,7 @@ def test_legacy_corotational_matches_von_karman_for_registered_small_displacemen def test_corotational_scope_rejects_bad_kinematics_and_fracture() -> None: - from anysolver.fracture import FractureConfig + from anyfesolver.fracture import FractureConfig model = _single_beam_model() load_case = LoadCase("f") @@ -464,7 +464,7 @@ def test_corotational_shell_strip_rolls_to_quarter_circle_efficiently() -> None: the necessary corotational frame-rotation excursion (grinding thousands of assemblies), and geometric tangent terms destabilize the shell Newton map. """ - import anysolver.nonlinear_static as ns + import anyfesolver.nonlinear_static as ns n, width, thickness = 8, 0.1, 0.005 model = FEModel("shell_rollup") diff --git a/tests/test_corotational_performance.py b/tests/test_corotational_performance.py index a55a5f527..31060342b 100644 --- a/tests/test_corotational_performance.py +++ b/tests/test_corotational_performance.py @@ -3,17 +3,17 @@ import numpy as np import pytest -import anysolver.corotational as corotational -from anysolver.corotational import corotational_element_response, rotation_matrix_from_vector -from anysolver.corotational_performance import ( +import anyfesolver.corotational as corotational +from anyfesolver.corotational import corotational_element_response, rotation_matrix_from_vector +from anyfesolver.corotational_performance import ( corotational_performance_status, reset_corotational_performance_status, rotate_corotational_force_blocks, rotate_corotational_force_tangent_blocks, ) -from anysolver.elements import BeamElement, QuadraticBeamElement, create_element -from anysolver.fe_core import FEModel -from anysolver.nonlinear_performance_bootstrap import nonlinear_performance_status +from anyfesolver.elements import BeamElement, QuadraticBeamElement, create_element +from anyfesolver.fe_core import FEModel +from anyfesolver.nonlinear_performance_bootstrap import nonlinear_performance_status def _dense_rotation(rotation: np.ndarray, size: int) -> np.ndarray: diff --git a/tests/test_corotational_shell_precision.py b/tests/test_corotational_shell_precision.py index ea1e5b93f..d31bdef6e 100644 --- a/tests/test_corotational_shell_precision.py +++ b/tests/test_corotational_shell_precision.py @@ -2,9 +2,9 @@ import importlib.util,pathlib,decimal import numpy as np import pytest -from anysolver import solve_static_nonlinear,solve_linear -from anysolver import corotational as cr -from anysolver.nonlinear_static import _assemble_nonlinear_system +from anyfesolver import solve_static_nonlinear,solve_linear +from anyfesolver import corotational as cr +from anyfesolver.nonlinear_static import _assemble_nonlinear_system spec=importlib.util.spec_from_file_location('abuse_fixture',pathlib.Path(__file__).parents[1]/'scripts/explore_nonlinear_abuse.py');fixture=importlib.util.module_from_spec(spec);spec.loader.exec_module(fixture) @pytest.mark.parametrize('inputs',[{'E':1e12},{'thickness':.1},{'E':1e12,'origin':1e6},{'E':1e12,'scale':.01}]) @@ -51,7 +51,7 @@ def test_automatic_precision_keeps_explicit_route_policies(mode): def test_history_owner_keeps_historical_policy_and_recovery_reads_result_policy(): - from anysolver.recovery import recover_stress_result + from anyfesolver.recovery import recover_stress_result for initial,expected in [(None,True),({},False)]: m,_=fixture.plate_model({'name':'recovery','E':1e5}) r=solve_static_nonlinear(m,None,num_steps=2,kinematics='corotational',corotational_tangent='work_conjugate',initial_element_states=initial) diff --git a/tests/test_corotational_speed_guards.py b/tests/test_corotational_speed_guards.py index 260951dd7..baf596d91 100644 --- a/tests/test_corotational_speed_guards.py +++ b/tests/test_corotational_speed_guards.py @@ -18,9 +18,9 @@ from anymaterial import IsotropicMaterial -from anysolver import _compensated_contractions as cc -from anysolver import elements as el -from anysolver.corotational import rotation_matrix_from_vector +from anyfesolver import _compensated_contractions as cc +from anyfesolver import elements as el +from anyfesolver.corotational import rotation_matrix_from_vector class _Recorder: @@ -214,9 +214,9 @@ def test_rotation_vector_branches_are_the_same_rotation_but_not_equivariant(): def _simply_supported_plate(n: int, thickness: float, pressure: float): - import anysolver as fs - from anysolver.boundary import BoundaryCondition, LoadCase - from anysolver.elements import create_shell_element + import anyfesolver as fs + from anyfesolver.boundary import BoundaryCondition, LoadCase + from anyfesolver.elements import create_shell_element model = fs.FEModel("plate") model.add_material("mat", 210e9, 0.3, density=7850.0) @@ -248,7 +248,7 @@ def _simply_supported_plate(n: int, thickness: float, pressure: float): def test_one_step_and_five_step_corotational_plate_agree_as_rotations(): """Rotation DOF values may differ by multiples of 2*pi; the rotations do not.""" - import anysolver as fs + import anyfesolver as fs model, load = _simply_supported_plate(4, 0.001, 5.0e4) states = {} diff --git a/tests/test_corotational_work_conjugate.py b/tests/test_corotational_work_conjugate.py index 78f8053ad..c47291ebb 100644 --- a/tests/test_corotational_work_conjugate.py +++ b/tests/test_corotational_work_conjugate.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from anysolver.corotational import ( +from anyfesolver.corotational import ( _CorotationalReference, _corotational_cache, _corotational_deformation_state, @@ -17,8 +17,8 @@ rotation_vector_from_matrix, spatial_force_and_moment_resultants, ) -from anysolver.elements import BeamElement, create_shell_element -from anysolver.fe_core import FEModel +from anyfesolver.elements import BeamElement, create_shell_element +from anyfesolver.fe_core import FEModel def _make_beam_model() -> tuple[FEModel, int, BeamElement]: diff --git a/tests/test_damage_matrix_performance.py b/tests/test_damage_matrix_performance.py index b7559ca4d..16066dd65 100644 --- a/tests/test_damage_matrix_performance.py +++ b/tests/test_damage_matrix_performance.py @@ -4,12 +4,12 @@ import numpy as np -from anysolver.contact import ( +from anyfesolver.contact import ( _assemble_damaged_linear_matrices, _assemble_damaged_linear_matrices_with_gate, _linear_element_matrix_terms, ) -from anysolver.damage_matrix_performance import ( +from anyfesolver.damage_matrix_performance import ( DAMAGE_MATRIX_PLAN_BREAK_EVEN_FUTURE_UPDATES, DamageMatrixPlan, DamageMatrixPlanGate, @@ -17,8 +17,8 @@ estimate_damage_matrix_combined_retained_bytes, estimate_damage_matrix_plan_retained_bytes, ) -from anysolver.elements import create_element -from anysolver.fe_core import FEModel +from anyfesolver.elements import create_element +from anyfesolver.fe_core import FEModel def _panel(nx: int = 2, ny: int = 2) -> FEModel: diff --git a/tests/test_development_test_runner.py b/tests/test_development_test_runner.py index e4ad14cd1..5e8895f78 100644 --- a/tests/test_development_test_runner.py +++ b/tests/test_development_test_runner.py @@ -75,7 +75,7 @@ def test_child_non_success_is_never_accepted(tmp_path, monkeypatch, code): def test_runtime_reports_observed_settings_and_rejects_wrong_source(tmp_path, monkeypatch): monkeypatch.setenv('NUMBA_DISABLE_JIT', '1') numba = SimpleNamespace(config=SimpleNamespace(DISABLE_JIT=True), get_num_threads=lambda: 1) - modules = {'anysolver': SimpleNamespace(__file__=str(tmp_path/'__init__.py')), 'numba': numba} + modules = {'anyfesolver': SimpleNamespace(__file__=str(tmp_path/'__init__.py')), 'numba': numba} result = runtime.runtime_record(modules, tmp_path, [{'num_threads': 1}]) assert not result['errors'] and result['jit_disabled'] is True and result['numba_threads'] == 1 assert runtime.runtime_record(modules, tmp_path/'other')['errors'] diff --git a/tests/test_director_integrated_trace.py b/tests/test_director_integrated_trace.py index 5235cbf5f..25256e111 100644 --- a/tests/test_director_integrated_trace.py +++ b/tests/test_director_integrated_trace.py @@ -4,13 +4,13 @@ import numpy as np import pytest from scipy import sparse -from anysolver import FEModel, InterpolatedBeamShellMPCElement -from anysolver._director_trace import director_trace_state -from anysolver.assembly import build_constraint_transformation -from anysolver.corotational import (build_nonlinear_rotating_mpc_map,rotation_matrix_from_vector, +from anyfesolver import FEModel, InterpolatedBeamShellMPCElement +from anyfesolver._director_trace import director_trace_state +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.corotational import (build_nonlinear_rotating_mpc_map,rotation_matrix_from_vector, rotation_vector_from_matrix,spatial_moment_from_rotation_covector,SO3MeanDomainError) -from anysolver.nonlinear_restart import model_configuration_fingerprint -from anysolver.elements import BeamElement +from anyfesolver.nonlinear_restart import model_configuration_fingerprint +from anyfesolver.elements import BeamElement def fixture(offset=(0.,0.,.03),xi=.37): @@ -203,7 +203,7 @@ def test_unsupported_trace_geometry_is_refused_without_mutation(fault): def elastic_trace_model(policy="director_integrated"): - from anysolver import BoundaryCondition,LoadCase + from anyfesolver import BoundaryCondition,LoadCase model=FEModel("elastic_trace"); model.add_material("elastic",210e9,.3) for n,xyz in ((1,(0.,0.,0.)),(2,(1.,0.,0.)),(3,(0.,0.,.03)),(4,(.5,0.,.03)),(5,(1.,0.,.03))): model.add_node(n,*xyz) for i,(slave,masters,weights) in enumerate(((3,[1],[1.]),(4,[1,2],[.5,.5]),(5,[2],[1.]))): @@ -228,7 +228,7 @@ def test_all_new_trace_chart_bounds_refused_without_mutation(fault): def test_baseline_style_linear_checkpoint_and_explicit_linear_identity(): - from anysolver import solve_static_nonlinear + from anyfesolver import solve_static_nonlinear baseline,load=elastic_trace_model("linear") for element in baseline.mesh.elements.values(): if isinstance(element,InterpolatedBeamShellMPCElement): @@ -286,8 +286,8 @@ def test_trace_preserves_exact_nonzero_reference_closure(): def test_public_solve_copied_restart_and_cancel_integrity(): - from anysolver import solve_static_nonlinear - from anysolver.control import CancellationToken,SolveCancelled + from anyfesolver import solve_static_nonlinear + from anyfesolver.control import CancellationToken,SolveCancelled model,load=elastic_trace_model() common=dict(kinematics="corotational",num_steps=2,max_iterations=20,tolerance=1e-8,emit_restart_checkpoint=False) first=solve_static_nonlinear(model,load,**common) @@ -313,7 +313,7 @@ def test_public_solve_copied_restart_and_cancel_integrity(): solve_static_nonlinear(model,load,kinematics="von_karman") with pytest.raises(ValueError,match="rotating-MPC"): solve_static_nonlinear(model,load,kinematics="corotational",corotational_tangent="rotated") - from anysolver.nonlinear_restart import NonlinearCheckpointError + from anyfesolver.nonlinear_restart import NonlinearCheckpointError checkpointed=solve_static_nonlinear(model,load,**dict(common,emit_restart_checkpoint=True)) assert checkpointed.status=="completed" and checkpointed.restart_checkpoint is not None resumed=solve_static_nonlinear(model,load,restart_checkpoint=checkpointed.restart_checkpoint,**common) diff --git a/tests/test_displacement_event_metadata.py b/tests/test_displacement_event_metadata.py index 6d6748a2a..4bfc39426 100644 --- a/tests/test_displacement_event_metadata.py +++ b/tests/test_displacement_event_metadata.py @@ -6,11 +6,11 @@ import numpy as np import pytest -from anysolver._stiffened_shell_displacement_adaptive import ( +from anyfesolver._stiffened_shell_displacement_adaptive import ( Context, MAGIC, EVENT_MAGIC, EVENT_POLICY, encode, decode, direction_hash, validate_progress) -from anysolver._stiffened_shell_displacement_increment import DisplacementIncrementState -from anysolver._stiffened_shell_increment_control import AdaptiveIncrementControl +from anyfesolver._stiffened_shell_displacement_increment import DisplacementIncrementState +from anyfesolver._stiffened_shell_increment_control import AdaptiveIncrementControl def state(): diff --git a/tests/test_dyadic_bilinear.py b/tests/test_dyadic_bilinear.py index 22104282c..6f5a231d4 100644 --- a/tests/test_dyadic_bilinear.py +++ b/tests/test_dyadic_bilinear.py @@ -2,7 +2,7 @@ from fractions import Fraction as F import numpy as np import pytest -from anysolver._dyadic_bilinear import reassemble_exact_binary64 as reassemble +from anyfesolver._dyadic_bilinear import reassemble_exact_binary64 as reassemble def dot(a,b): return sum((x*y for x,y in zip(a,b)),F()) diff --git a/tests/test_dyadic_factor_chain.py b/tests/test_dyadic_factor_chain.py index b123f37be..f3a8026f0 100644 --- a/tests/test_dyadic_factor_chain.py +++ b/tests/test_dyadic_factor_chain.py @@ -2,7 +2,7 @@ from fractions import Fraction as F import numpy as np import pytest -from anysolver._dyadic_factor_chain import reassemble_chain_exact_binary64 +from anyfesolver._dyadic_factor_chain import reassemble_chain_exact_binary64 def exact(a): return [[F(float(x)) for x in row] for row in a] diff --git a/tests/test_e3_baseline.py b/tests/test_e3_baseline.py index c42850c80..6f3fca526 100644 --- a/tests/test_e3_baseline.py +++ b/tests/test_e3_baseline.py @@ -127,11 +127,11 @@ def test_e3_material_scope_and_production_boundary_are_frozen() -> None: assert environment["baseline_execution"]["one_live_118_suite"] is False assert environment["oracle"]["dependencies"] == "python_standard_library_only" expected_paths = [ - "C:/Github/ANYsolver/tmp/s4_candidate_a_mpmath_valid", - "C:/Github/ANYsolver/.s4_candidate_a_pinned/fileio/src", - "C:/Github/ANYsolver/.s4_candidate_a_pinned/material/src", - "C:/Github/ANYsolver/.s4_candidate_a_pinned/mesh/src", - "C:/Github/ANYsolver/.s4_candidate_a_pinned/geometry/src", + "C:/Github/ANYfeSolver/tmp/s4_candidate_a_mpmath_valid", + "C:/Github/ANYfeSolver/.s4_candidate_a_pinned/fileio/src", + "C:/Github/ANYfeSolver/.s4_candidate_a_pinned/material/src", + "C:/Github/ANYfeSolver/.s4_candidate_a_pinned/mesh/src", + "C:/Github/ANYfeSolver/.s4_candidate_a_pinned/geometry/src", ] assert inherited_environment["baseline_test_runtime"]["pythonpath_order_absolute"] == expected_paths assert environment["reproduced_e0_runtime"]["pythonpath_order_absolute"] == expected_paths diff --git a/tests/test_e3_closeout.py b/tests/test_e3_closeout.py index 8107b4e4f..50ceaa5c7 100644 --- a/tests/test_e3_closeout.py +++ b/tests/test_e3_closeout.py @@ -44,9 +44,9 @@ } PRODUCTION = { - "src/anysolver/__init__.py": (24779, "0C782CCE93C1346F8A9B6DB832156A4F2689B33460C58F5966E9DE2169C2B8F0"), - "src/anysolver/anystructure_fem_mode.py": (60057, "2FEACAAFD2A516B8ACCD919124A18614B0C3096EC0EEAF02DF6BC4280A80616E"), - "src/anysolver/elements.py": (190422, "5D0AF716CD2E466EB831B1896553DE06236AC1BA80A84BD1B09C7E4CEBBDE670"), + "src/anyfesolver/__init__.py": (24779, "0C782CCE93C1346F8A9B6DB832156A4F2689B33460C58F5966E9DE2169C2B8F0"), + "src/anyfesolver/anystructure_fem_mode.py": (60057, "2FEACAAFD2A516B8ACCD919124A18614B0C3096EC0EEAF02DF6BC4280A80616E"), + "src/anyfesolver/elements.py": (190422, "5D0AF716CD2E466EB831B1896553DE06236AC1BA80A84BD1B09C7E4CEBBDE670"), } diff --git a/tests/test_e4_closeout.py b/tests/test_e4_closeout.py index 6b98a17f0..24f508753 100644 --- a/tests/test_e4_closeout.py +++ b/tests/test_e4_closeout.py @@ -189,7 +189,7 @@ def test_e4_closeout_preserves_source_scope_and_no_production_boundary() -> None elif isinstance(node, ast.ImportFrom) and node.module: imports.add(node.module.split(".")[0]) assert imports <= permitted | {"__future__"} - assert "anysolver" not in imports + assert "anyfesolver" not in imports plan = (ROOT / "docs/agent_plans/S4_E4_PL_LINEAR_QUALIFICATION_PLAN.md").read_text( encoding="utf-8" diff --git a/tests/test_e4_pl_burnin.py b/tests/test_e4_pl_burnin.py index a158c4404..3ebbd1b61 100644 --- a/tests/test_e4_pl_burnin.py +++ b/tests/test_e4_pl_burnin.py @@ -17,7 +17,7 @@ from scripts import run_portable_ci as portable_ci -from anysolver import ( +from anyfesolver import ( LEGACY_Q4_AVAILABLE_THROUGH, LEGACY_Q4_REMOVAL_TARGET, LegacyQ4DeprecationWarning, @@ -111,7 +111,7 @@ def _prospective_gate_result(gate) -> dict[str, object]: "candidate": { "clean": True, "commit": "1" * 40, - "repository": "ANYsolver", + "repository": "ANYfeSolver", "tree": "a" * 40, }, "clean_gate_index": 1, @@ -183,8 +183,8 @@ def _prospective_package_result(gate, gate_result) -> dict[str, object]: } names = [name for name, _distribution, _package in gate.LOCAL_DISTRIBUTIONS] identities = { - "ANYsolver": gate_result["candidate"], - **{name: gate_result["siblings"][name] for name in names if name != "ANYsolver"}, + "ANYfeSolver": gate_result["candidate"], + **{name: gate_result["siblings"][name] for name in names if name != "ANYfeSolver"}, } return { "build_logs": {name: copy.deepcopy(log) for name in names}, @@ -316,7 +316,7 @@ def test_burn_in_contract_and_runtime_diagnostics_are_aligned() -> None: "ANYgeometry": "TRACKED_AND_INDEX_CLEAN_HEAD_ARCHIVE_UNTRACKED_EXCLUDED", "ANYmaterial": "TRACKED_AND_INDEX_CLEAN_HEAD_ARCHIVE_UNTRACKED_EXCLUDED", "ANYmesh": "TRACKED_AND_INDEX_CLEAN_HEAD_ARCHIVE_UNTRACKED_EXCLUDED", - "ANYsolver": "FULLY_CLEAN_INCLUDING_UNTRACKED", + "ANYfeSolver": "FULLY_CLEAN_INCLUDING_UNTRACKED", } assert contract["sibling_authority"] == { "ANYfem": { @@ -482,7 +482,7 @@ def test_diagnostics_fail_closed_for_unknown_topology_and_formulation() -> None: def test_migration_surface_is_mechanics_free_and_production_bypasses_stay_closed() -> None: diagnostics_source = ast.parse( - (ROOT / "src" / "anysolver" / "elements.py").read_text(encoding="utf-8") + (ROOT / "src" / "anyfesolver" / "elements.py").read_text(encoding="utf-8") ) function = next( node @@ -505,7 +505,7 @@ def test_migration_surface_is_mechanics_free_and_production_bypasses_stay_closed ROOT / relative for relative in _gate_module().inventory()["performance"] ] guarded_paths = [ - *(ROOT / "src" / "anysolver").rglob("*.py"), + *(ROOT / "src" / "anyfesolver").rglob("*.py"), *(ROOT / "scripts").glob("*.py"), *performance_paths, ] @@ -554,7 +554,7 @@ def test_migration_surface_is_mechanics_free_and_production_bypasses_stay_closed routed_performance_tests.add(path.relative_to(ROOT).as_posix()) assert bypasses == [] assert legacy_calls == { - "src/anysolver/elements.py", + "src/anyfesolver/elements.py", "tests/test_performance_improvements.py", } assert routed_scripts >= { @@ -945,11 +945,11 @@ def test_pytest_lane_keeps_source_metadata_visible_during_real_execution( "ANYmaterial": ("ANYmaterial", "0.1.1"), "ANYmesh": ("ANYmesher", "0.2.5"), "ANYfileIO": ("ANYfileio", "0.2.0"), - "ANYsolver": ("ANYsolver", "0.3.0"), + "ANYfeSolver": ("ANYfeSolver", "0.3.0"), } roots = {} for repository, (distribution, version) in projects.items(): - project = tmp_path if repository == "ANYsolver" else tmp_path / repository + project = tmp_path if repository == "ANYfeSolver" else tmp_path / repository project.mkdir(exist_ok=True) (project / "pyproject.toml").write_text( f'[project]\nname = "{distribution}"\nversion = "{version}"\n', @@ -989,7 +989,7 @@ def test_package_lane_is_isolated_and_covers_the_declared_wheel_smoke() -> None: ("ANYmaterial", "ANYmaterial", "anymaterial"), ("ANYmesh", "ANYmesher", "anymesher"), ("ANYfileIO", "ANYfileio", "anyfileio"), - ("ANYsolver", "ANYsolver", "anysolver"), + ("ANYfeSolver", "ANYfeSolver", "anyfesolver"), ] source = (ROOT / "scripts" / "run_e4_pl_burnin_gate.py").read_text(encoding="utf-8") assert 'environment.pop("PYTHONPATH", None)' in source @@ -1234,7 +1234,7 @@ def test_fail_fast_blocked_result_forbids_fabricated_downstream_evidence() -> No def test_repository_identity_validation_fails_closed_on_dirty_inputs(monkeypatch) -> None: gate = _gate_module() record = _prospective_gate_result(gate) - paths = {name: Path(name) for name in ("ANYsolver", *gate.SIBLING_NAMES)} + paths = {name: Path(name) for name in ("ANYfeSolver", *gate.SIBLING_NAMES)} def dirty_status(_repository: Path) -> dict[str, object]: raw = b" M tracked.py\0" @@ -1248,7 +1248,7 @@ def dirty_status(_repository: Path) -> dict[str, object]: def test_repository_cleanliness_policy_is_full_for_candidate_and_anyfem(monkeypatch) -> None: gate = _gate_module() record = _prospective_gate_result(gate) - paths = {name: Path(name) for name in ("ANYsolver", *gate.SIBLING_NAMES)} + paths = {name: Path(name) for name in ("ANYfeSolver", *gate.SIBLING_NAMES)} status_order = [] def clean_status(repository: Path) -> dict[str, object]: @@ -1257,13 +1257,13 @@ def clean_status(repository: Path) -> dict[str, object]: def clean_git(repository: Path, *args: str) -> str: name = repository.name - identity = record["candidate"] if name == "ANYsolver" else record["siblings"][name] + identity = record["candidate"] if name == "ANYfeSolver" else record["siblings"][name] return identity["tree"] if args[-1] == "HEAD^{tree}" else identity["commit"] monkeypatch.setattr(gate, "_functional_source_status", clean_status) monkeypatch.setattr(gate, "_git", clean_git) gate.validate_gate_result(record, repository_paths=paths) - assert status_order == sorted(("ANYsolver", *gate.SIBLING_NAMES)) + assert status_order == sorted(("ANYfeSolver", *gate.SIBLING_NAMES)) def test_complete_sibling_authority_is_fail_closed() -> None: @@ -1316,7 +1316,7 @@ def test_package_source_override_is_explicit_and_resolved( roots = gate._local_roots() assert roots["ANYgeometry"] == frozen.resolve() - assert roots["ANYsolver"] == ROOT.resolve() + assert roots["ANYfeSolver"] == ROOT.resolve() def test_pytest_source_metadata_overlay_binds_the_frozen_source_graph( @@ -1425,13 +1425,13 @@ def test_final_validation_binds_requests_logs_package_and_wheel( wheel.write_bytes(b"preserved installed-wheel candidate") record["wheel"] = gate.wheel_hash_record(wheel) package = _prospective_package_result(gate, record) - package["wheels"]["ANYsolver"] = record["wheel"] + package["wheels"]["ANYfeSolver"] = record["wheel"] package_path = tmp_path / "package-result.json" package_path.write_bytes(gate.canonical_json_bytes(package)) record["package_result"] = gate.file_hash_record(package_path) monkeypatch.setattr(gate, "_validate_repository_identities", lambda *_args: None) - repositories = {name: tmp_path / name for name in ("ANYsolver", *gate.SIBLING_NAMES)} + repositories = {name: tmp_path / name for name in ("ANYfeSolver", *gate.SIBLING_NAMES)} gate.validate_final_gate_result( record, contract=contract, diff --git a/tests/test_e4_pl_component_snapshot_integrity.py b/tests/test_e4_pl_component_snapshot_integrity.py index 0a1d7710c..17cda3496 100644 --- a/tests/test_e4_pl_component_snapshot_integrity.py +++ b/tests/test_e4_pl_component_snapshot_integrity.py @@ -8,13 +8,13 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( FEModel, QualifiedE4PLS3ShellElement, QualifiedE4PLShellElement, ) -import anysolver.e4_pl_element as q4_module -import anysolver.e4_pl_s3_element as s3_module +import anyfesolver.e4_pl_element as q4_module +import anyfesolver.e4_pl_s3_element as s3_module def _q4_case() -> tuple[FEModel, QualifiedE4PLShellElement, Any]: diff --git a/tests/test_e4_pl_current_state_input_ownership.py b/tests/test_e4_pl_current_state_input_ownership.py index 3dfddd600..5f6aec17d 100644 --- a/tests/test_e4_pl_current_state_input_ownership.py +++ b/tests/test_e4_pl_current_state_input_ownership.py @@ -6,19 +6,19 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( FEModel, QualifiedE4PLShellElement, solve_eigenvalue_buckling, solve_free_vibration, ) -from anysolver.boundary import FixedSupport -from anysolver.current_state_tangent import ( +from anyfesolver.boundary import FixedSupport +from anyfesolver.current_state_tangent import ( COMMITTED_CURRENT_TANGENT_INPUT_OWNERSHIP_POLICY_ID, assemble_committed_current_tangent_components, validate_committed_current_tangent_inputs, ) -from anysolver.element_capabilities import ElementCapabilityError +from anyfesolver.element_capabilities import ElementCapabilityError class _SingleItemsMapping(Mapping[Any, Any]): diff --git a/tests/test_e4_pl_default_activation.py b/tests/test_e4_pl_default_activation.py index b864ac8db..cf1853832 100644 --- a/tests/test_e4_pl_default_activation.py +++ b/tests/test_e4_pl_default_activation.py @@ -3,7 +3,7 @@ import ast from pathlib import Path -from anysolver import ( +from anyfesolver import ( DEFAULT_Q4_FORMULATION, DEFAULT_S3_FORMULATION, LegacyShellElement, @@ -13,8 +13,8 @@ create_shell_element, generate_simple_panel_mesh, ) -from anysolver.anystructure_fem_mode import build_fe_model_from_generated_geometry -from anysolver.cylinder_benchmarks import ( +from anyfesolver.anystructure_fem_mode import build_fe_model_from_generated_geometry +from anyfesolver.cylinder_benchmarks import ( CylinderBenchmarkConfig, build_cylindrical_shell_benchmark_model, ) @@ -99,7 +99,7 @@ def test_explicit_e4_request_rejects_non_q4_topology() -> None: def test_in_package_shell_construction_is_closed_world_through_selector() -> None: - source_root = Path(__file__).resolve().parents[1] / "src" / "anysolver" + source_root = Path(__file__).resolve().parents[1] / "src" / "anyfesolver" direct_calls: list[str] = [] for path in source_root.rglob("*.py"): tree = ast.parse(path.read_text(encoding="utf-8"), filename=str(path)) diff --git a/tests/test_e4_pl_dormant_element.py b/tests/test_e4_pl_dormant_element.py index 581fd891d..8daee78d2 100644 --- a/tests/test_e4_pl_dormant_element.py +++ b/tests/test_e4_pl_dormant_element.py @@ -9,13 +9,13 @@ import numpy as np import pytest -import anysolver.e4_pl_element as q4_element_module -from anysolver.e4_pl_element import FORMULATION_ID, QualifiedE4PLShellElement, equation7_frame -from anysolver.elements import ShellElement, create_element -from anysolver.fe_core import FEMesh, Material -from anysolver.material_curves import DNVC208MaterialCurve -from anysolver.materials import Hill48Yield, OrthotropicMaterial -from anysolver.shell_sections import GeneralizedShellSection +import anyfesolver.e4_pl_element as q4_element_module +from anyfesolver.e4_pl_element import FORMULATION_ID, QualifiedE4PLShellElement, equation7_frame +from anyfesolver.elements import ShellElement, create_element +from anyfesolver.fe_core import FEMesh, Material +from anyfesolver.material_curves import DNVC208MaterialCurve +from anyfesolver.materials import Hill48Yield, OrthotropicMaterial +from anyfesolver.shell_sections import GeneralizedShellSection ROOT = Path(__file__).resolve().parents[1] @@ -660,7 +660,7 @@ def test_orthotropic_elastic_and_plastic_state_paths_keep_qualified_tangent() -> # Owner decision 2026-10-23: plastic qualified Q4 outside the assumed-strain # route scope is refused (the compatible-strain plastic route with the # qualified correction is unstable once layers yield). - from anysolver._q4_assumed_strain_plasticity import UnsupportedQ4PlasticRouteError + from anyfesolver._q4_assumed_strain_plasticity import UnsupportedQ4PlasticRouteError with pytest.raises(UnsupportedQ4PlasticRouteError, match="orthotropic/Hill48"): candidate.compute_nonlinear_response( mesh, material, displacement, num_layers=3, tangent=True diff --git a/tests/test_e4_pl_enriched_skin.py b/tests/test_e4_pl_enriched_skin.py index e1c9ca861..f1dfd7c18 100644 --- a/tests/test_e4_pl_enriched_skin.py +++ b/tests/test_e4_pl_enriched_skin.py @@ -3,7 +3,7 @@ import pytest from examples.general_contact_enriched_patch import build -from anysolver.e4_pl_enriched import bubble_basis, compile_cell, EnrichedProfileError +from anyfesolver.e4_pl_enriched import bubble_basis, compile_cell, EnrichedProfileError @pytest.fixture(scope="module") @@ -22,7 +22,7 @@ def test_four_bubbles_have_zero_boundary_trace_and_independent_values(): def test_complete_stationary_functional_nodal_identity_and_all_bubble_energy(compiled): model, system = compiled - from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement + from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement assert type(model.mesh.elements[2]) is NativeParityE4PLS3V2DShellElement target_identity = next(row for row in system.definition["element_formulations"] if row["element_id"] == 2) assert target_identity["formulation_id"] == model.mesh.elements[2].formulation_id @@ -65,7 +65,7 @@ def test_complete_stationary_functional_nodal_identity_and_all_bubble_energy(com def test_rotated_cell_recovery_uses_same_global_coordinates_as_energy(compiled): - from anysolver._ge_beam3_mixed_ad import rotation_exponential + from anyfesolver._ge_beam3_mixed_ad import rotation_exponential rotation = rotation_exponential((.21, -.17, .11)) model, system = build(target_z=-.01, rotation=rotation) cell = system.cells[0] @@ -93,7 +93,7 @@ def test_rectangular_reference_and_immutable_energy_refuse_mutation(compiled): for unsupported in ({"director_polarity": -1}, {"reference_surface_offset": .001}): with pytest.raises(EnrichedProfileError, match="V2D elastic overlap"): build(target_options=unsupported) - from anysolver.shell_sections import GeneralizedShellSection + from anyfesolver.shell_sections import GeneralizedShellSection section = GeneralizedShellSection(A=np.eye(3), B=np.zeros((3, 3)), D=np.eye(3), As=np.eye(2)) with pytest.raises(EnrichedProfileError, match="V2D elastic overlap"): build(target_options={"shell_section": section, "material_direction": (1., 0., 0.)}) diff --git a/tests/test_e4_pl_functional_constructor_policy.py b/tests/test_e4_pl_functional_constructor_policy.py index 5dbaa4744..98d0e0253 100644 --- a/tests/test_e4_pl_functional_constructor_policy.py +++ b/tests/test_e4_pl_functional_constructor_policy.py @@ -386,12 +386,12 @@ def test_functional_lane_legacy_q4_calls_are_explicit_and_closed_world() -> None def test_production_constructor_calls_are_confined_to_central_factory() -> None: - paths = sorted((ROOT / "src" / "anysolver").rglob("*.py")) + paths = sorted((ROOT / "src" / "anyfesolver").rglob("*.py")) calls = _constructor_calls(paths) assert calls["ShellElement"] == Counter() assert calls["LegacyShellElement"] == Counter( - {("src/anysolver/elements.py", "create_shell_element"): 1} + {("src/anyfesolver/elements.py", "create_shell_element"): 1} ) assert calls["QualifiedE4PLShellElement"] == Counter( - {("src/anysolver/elements.py", "create_shell_element"): 1} + {("src/anyfesolver/elements.py", "create_shell_element"): 1} ) diff --git a/tests/test_e4_pl_guarded_observations.py b/tests/test_e4_pl_guarded_observations.py index 321ccbc08..1c9e7ab80 100644 --- a/tests/test_e4_pl_guarded_observations.py +++ b/tests/test_e4_pl_guarded_observations.py @@ -8,21 +8,21 @@ import pytest from anymaterial import DNVC208MaterialCurve, LinearHardeningCurve -from anysolver import FEModel, QualifiedE4PLS3ShellElement, QualifiedE4PLShellElement -from anysolver._native_rotation_state import ( +from anyfesolver import FEModel, QualifiedE4PLS3ShellElement, QualifiedE4PLShellElement +from anyfesolver._native_rotation_state import ( NativeElementRotationView, create_native_rotation_state_store, ) -from anysolver.current_state_tangent import ( +from anyfesolver.current_state_tangent import ( require_exact_qualified_component_lifecycle_api, ) -from anysolver.e4_pl_element import _QUALIFIED_Q4_CLASS_NAMESPACE_AUTHORITY -from anysolver.e4_pl_s3_element import _QUALIFIED_S3_CLASS_NAMESPACE_AUTHORITY -from anysolver.element_capabilities import ElementCapabilityError -from anysolver.elements import Element -from anysolver.fe_core import FEMesh -from anysolver.material_curves import FiberSectionPlasticityConfig -from anysolver.shell_sections import GeneralizedShellSection +from anyfesolver.e4_pl_element import _QUALIFIED_Q4_CLASS_NAMESPACE_AUTHORITY +from anyfesolver.e4_pl_s3_element import _QUALIFIED_S3_CLASS_NAMESPACE_AUTHORITY +from anyfesolver.element_capabilities import ElementCapabilityError +from anyfesolver.elements import Element +from anyfesolver.fe_core import FEMesh +from anyfesolver.material_curves import FiberSectionPlasticityConfig +from anyfesolver.shell_sections import GeneralizedShellSection def _qualified_case(family: str): diff --git a/tests/test_e4_pl_mixed_current_state_route.py b/tests/test_e4_pl_mixed_current_state_route.py index 89beb4abc..4ec5960a4 100644 --- a/tests/test_e4_pl_mixed_current_state_route.py +++ b/tests/test_e4_pl_mixed_current_state_route.py @@ -8,12 +8,12 @@ import pytest from scipy import linalg -import anysolver.e4_pl_element as q4_module -import anysolver.e4_pl_s3_element as s3_module -import anysolver.e4_pl_s3_state as s3_state_module -import anysolver.elements as elements_module -import anysolver.shell_sections as shell_sections_module -from anysolver import ( +import anyfesolver.e4_pl_element as q4_module +import anyfesolver.e4_pl_s3_element as s3_module +import anyfesolver.e4_pl_s3_state as s3_state_module +import anyfesolver.elements as elements_module +import anyfesolver.shell_sections as shell_sections_module +from anyfesolver import ( AnalysisSession, FEModel, assemble_stiffness_matrix, @@ -21,36 +21,36 @@ solve_free_vibration, solve_static_nonlinear, ) -from anysolver.activity import ElementActivity -from anysolver.assembly import build_constraint_transformation -from anysolver.boundary import FixedSupport, LoadCase -from anysolver.buckling import ( +from anyfesolver.activity import ElementActivity +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.boundary import FixedSupport, LoadCase +from anyfesolver.buckling import ( QUALIFIED_Q4_S3_CURRENT_STATE_BUCKLING_POLICY_ID, ) -from anysolver.current_state_tangent import ( +from anyfesolver.current_state_tangent import ( COMMITTED_CURRENT_TANGENT_ASSEMBLY_POLICY_ID, COMMITTED_CURRENT_TANGENT_ROUTE_POLICY_ID, assemble_committed_current_tangent_components, require_exact_qualified_component_lifecycle_api, validate_committed_current_tangent_inputs, ) -from anysolver.e4_pl_element import QualifiedE4PLShellElement -from anysolver.e4_pl_s3_element import ( +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement +from anyfesolver.e4_pl_s3_element import ( REFERENCE_ELASTIC_BUBBLE_LINEARIZATION_ID, QualifiedE4PLS3ShellElement, ) -from anysolver.e4_pl_s3_state import canonical_json_bytes -from anysolver.element_capabilities import ElementCapabilityError -from anysolver.elements import ShellElement -from anysolver.linalg import FactorizationCache -from anysolver.modal import CURRENT_STATE_MODAL_POLICY_ID -from anysolver.nonlinear_state import ( +from anyfesolver.e4_pl_s3_state import canonical_json_bytes +from anyfesolver.element_capabilities import ElementCapabilityError +from anyfesolver.elements import ShellElement +from anyfesolver.linalg import FactorizationCache +from anyfesolver.modal import CURRENT_STATE_MODAL_POLICY_ID +from anyfesolver.nonlinear_state import ( NonlinearStateStore, begin_state_evaluation, create_model_native_rotation_store, discard_active_state_candidate, ) -from anysolver.shell_sections import GeneralizedShellSection +from anyfesolver.shell_sections import GeneralizedShellSection def _b_coupled_section() -> GeneralizedShellSection: diff --git a/tests/test_e4_pl_orchestrator_operation_lease.py b/tests/test_e4_pl_orchestrator_operation_lease.py index 3277a5448..806057124 100644 --- a/tests/test_e4_pl_orchestrator_operation_lease.py +++ b/tests/test_e4_pl_orchestrator_operation_lease.py @@ -7,14 +7,14 @@ import numpy as np import pytest -import anysolver.dynamics as dynamics -import anysolver.e4_pl_element as q4_runtime -import anysolver.e4_pl_s3_element as s3_runtime -import anysolver.nonlinear_static as nonlinear_static_module +import anyfesolver.dynamics as dynamics +import anyfesolver.e4_pl_element as q4_runtime +import anyfesolver.e4_pl_s3_element as s3_runtime +import anyfesolver.nonlinear_static as nonlinear_static_module import test_e4_pl_s3_current_tangent_buckling as current_fixture import test_e4_pl_s3_generalized_nonlinear as nonlinear_fixture import test_e4_pl_workflow_parity as workflow_fixture -from anysolver import ( +from anyfesolver import ( LoadCase, FractureConfig, ImperfectionField, @@ -28,9 +28,9 @@ solve_free_vibration, solve_transient_newmark, ) -from anysolver.arc_length import ArcLengthControl, solve_static_arc_length -from anysolver.matrix_assembly import AssemblyError -from anysolver.nonlinear_static import DisplacementControl, solve_static_nonlinear +from anyfesolver.arc_length import ArcLengthControl, solve_static_arc_length +from anyfesolver.matrix_assembly import AssemblyError +from anyfesolver.nonlinear_static import DisplacementControl, solve_static_nonlinear class _MutatingSequence(Sequence[object]): diff --git a/tests/test_e4_pl_parity_matrix.py b/tests/test_e4_pl_parity_matrix.py index c8ce97034..d1bb3fd99 100644 --- a/tests/test_e4_pl_parity_matrix.py +++ b/tests/test_e4_pl_parity_matrix.py @@ -4,8 +4,8 @@ import json from pathlib import Path -from anysolver import QualifiedE4PLShellElement -from anysolver.elements import LegacyShellElement, create_element +from anyfesolver import QualifiedE4PLShellElement +from anyfesolver.elements import LegacyShellElement, create_element ROOT = Path(__file__).resolve().parents[1] @@ -13,7 +13,7 @@ def _public_shell_api() -> set[str]: - tree = ast.parse((ROOT / "src" / "anysolver" / "elements.py").read_text(encoding="utf-8")) + tree = ast.parse((ROOT / "src" / "anyfesolver" / "elements.py").read_text(encoding="utf-8")) result: set[str] = set() for node in tree.body: if isinstance(node, ast.ClassDef) and node.name in {"Element", "ShellElement"}: @@ -71,7 +71,7 @@ def test_every_required_parity_item_is_closed_at_default_activation() -> None: rollback = create_element("legacy-shell", 2, [1, 2, 3, 4], "steel") assert type(default) is QualifiedE4PLShellElement assert type(rollback) is LegacyShellElement - assert QualifiedE4PLShellElement.__module__ == "anysolver.e4_pl_element" + assert QualifiedE4PLShellElement.__module__ == "anyfesolver.e4_pl_element" def test_warped_and_performance_rows_are_closed_before_activation() -> None: @@ -92,8 +92,8 @@ def test_runtime_shell_dispatch_accepts_subclasses_without_exact_name_checks() - matrix = json.loads(MATRIX.read_text(encoding="utf-8")) by_id = {row["id"]: row for row in matrix["capabilities"]} assert by_id["runtime_exact_class_name_dispatch"]["status"] == "CLOSED_ISINSTANCE_DISPATCH" - runtime_source = (ROOT / "src" / "anysolver" / "runtime.py").read_text(encoding="utf-8") - test_case_source = (ROOT / "src" / "anysolver" / "test_cases.py").read_text(encoding="utf-8") + runtime_source = (ROOT / "src" / "anyfesolver" / "runtime.py").read_text(encoding="utf-8") + test_case_source = (ROOT / "src" / "anyfesolver" / "test_cases.py").read_text(encoding="utf-8") assert '.__class__.__name__ != "ShellElement"' not in runtime_source assert '.__class__.__name__ == "ShellElement"' not in runtime_source assert ".__class__.__name__ == 'ShellElement'" not in test_case_source diff --git a/tests/test_e4_pl_planar_physical_recovery.py b/tests/test_e4_pl_planar_physical_recovery.py index 4a49f5717..cc93225f2 100644 --- a/tests/test_e4_pl_planar_physical_recovery.py +++ b/tests/test_e4_pl_planar_physical_recovery.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from anysolver.e4_pl_element import ( +from anyfesolver.e4_pl_element import ( DIRECTOR_POLARITY_POLICY_ID, DIRECTOR_REVERSAL_TRANSFORM_ID, IMPLEMENTATION_ID, @@ -23,10 +23,10 @@ QualifiedQ4MigrationWarning, equation7_frame, ) -from anysolver.elements import LegacyShellElement, shell_element_from_dict -from anysolver.fe_core import FEMesh, Material -from anysolver.materials import OrthotropicMaterial -from anysolver.shell_sections import GeneralizedShellSection +from anyfesolver.elements import LegacyShellElement, shell_element_from_dict +from anyfesolver.fe_core import FEMesh, Material +from anyfesolver.materials import OrthotropicMaterial +from anyfesolver.shell_sections import GeneralizedShellSection GAUSS = tuple( diff --git a/tests/test_e4_pl_q1h_domain_coercivity.py b/tests/test_e4_pl_q1h_domain_coercivity.py index 077ff69af..394dd653f 100644 --- a/tests/test_e4_pl_q1h_domain_coercivity.py +++ b/tests/test_e4_pl_q1h_domain_coercivity.py @@ -222,7 +222,7 @@ def test_q1h_research_only_extent_and_production_boundary() -> None: if isinstance(node, ast.Import) for alias in node.names } | {node.module or "" for node in ast.walk(tree) if isinstance(node, ast.ImportFrom)} - assert not any(name.startswith("src.anysolver") or name == "anysolver" for name in imports) + assert not any(name.startswith("src.anyfesolver") or name == "anyfesolver" for name in imports) plan = (ROOT / "docs" / "agent_plans" / "S4_E4_PL_Q1H_DOMAIN_COERCIVITY_COMPLETION_PLAN.md").read_text(encoding="utf-8") assert _strict_json(CONTRACT.read_bytes())["production"] == "NO_GO_PRODUCTION_RESTRICTION_UNCHANGED" assert "replacement of legacy `ShellElement`" in plan diff --git a/tests/test_e4_pl_q4_current_tangent.py b/tests/test_e4_pl_q4_current_tangent.py index c18df1745..55f6b948e 100644 --- a/tests/test_e4_pl_q4_current_tangent.py +++ b/tests/test_e4_pl_q4_current_tangent.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from anysolver.e4_pl_element import ( +from anyfesolver.e4_pl_element import ( Q4_CURRENT_STATE_ALGORITHMIC_ORIGIN_SCHEMA_ID, Q4_CURRENT_STATE_BINDING_SCHEMA_ID, Q4_CURRENT_STATE_PROJECTION_POLICY_ID, @@ -13,15 +13,15 @@ QualifiedE4PLShellElement, _q4_compact_replay_last_place_equivalent, ) -from anysolver.e4_pl_s3_state import canonical_json_bytes -from anysolver.elements import ShellElement -from anysolver.fe_core import FEMesh, Material -from anysolver.material_curves import DNVC208MaterialCurve -from anysolver.materials import Hill48Yield, OrthotropicMaterial -from anysolver.nonlinear_state import ShellStateBatch, ShellStateLayout -from anysolver.shell_sections import GeneralizedShellSection -from anysolver.vectorized_nonlinear import batch_shell_nonlinear_response -from anysolver import _q4_assumed_strain_plasticity as _q4_assumed_strain +from anyfesolver.e4_pl_s3_state import canonical_json_bytes +from anyfesolver.elements import ShellElement +from anyfesolver.fe_core import FEMesh, Material +from anyfesolver.material_curves import DNVC208MaterialCurve +from anyfesolver.materials import Hill48Yield, OrthotropicMaterial +from anyfesolver.nonlinear_state import ShellStateBatch, ShellStateLayout +from anyfesolver.shell_sections import GeneralizedShellSection +from anyfesolver.vectorized_nonlinear import batch_shell_nonlinear_response +from anyfesolver import _q4_assumed_strain_plasticity as _q4_assumed_strain def _production_q4_kernel(element, mesh, material): diff --git a/tests/test_e4_pl_q4_state_lifecycle.py b/tests/test_e4_pl_q4_state_lifecycle.py index 33595c8ea..e686bb7d4 100644 --- a/tests/test_e4_pl_q4_state_lifecycle.py +++ b/tests/test_e4_pl_q4_state_lifecycle.py @@ -8,27 +8,27 @@ import numpy as np import pytest -import anysolver.arc_length as arc_length_module -import anysolver.e4_pl_element as q4_element_module -import anysolver.nonlinear_static as nonlinear_static -from anysolver.activity import ElementActivity -from anysolver.arc_length import ArcLengthControl, solve_static_arc_length -from anysolver.boundary import BoundaryCondition, FixedSupport, LoadCase -from anysolver.control import CancellationToken -from anysolver.e4_pl_element import QualifiedE4PLShellElement -from anysolver.e4_pl_s3_state import canonical_json_bytes -from anysolver.element_capabilities import ElementCapabilityError -from anysolver.elements import ShellElement -from anysolver.fe_core import FEModel -from anysolver.material_curves import DNVC208MaterialCurve -from anysolver.matrix_assembly import AssemblyError -from anysolver.nonlinear_restart import ( +import anyfesolver.arc_length as arc_length_module +import anyfesolver.e4_pl_element as q4_element_module +import anyfesolver.nonlinear_static as nonlinear_static +from anyfesolver.activity import ElementActivity +from anyfesolver.arc_length import ArcLengthControl, solve_static_arc_length +from anyfesolver.boundary import BoundaryCondition, FixedSupport, LoadCase +from anyfesolver.control import CancellationToken +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement +from anyfesolver.e4_pl_s3_state import canonical_json_bytes +from anyfesolver.element_capabilities import ElementCapabilityError +from anyfesolver.elements import ShellElement +from anyfesolver.fe_core import FEModel +from anyfesolver.material_curves import DNVC208MaterialCurve +from anyfesolver.matrix_assembly import AssemblyError +from anyfesolver.nonlinear_restart import ( NonlinearCheckpointError, canonical_checkpoint_json_bytes, create_nonlinear_checkpoint, ) -from anysolver.nonlinear_static import ShellInitialField -from anysolver.shell_sections import GeneralizedShellSection +from anyfesolver.nonlinear_static import ShellInitialField +from anyfesolver.shell_sections import GeneralizedShellSection def _cache_tree_snapshot(value: Any) -> tuple[Any, ...]: @@ -176,7 +176,7 @@ def test_solver_seals_scalar_and_batched_layered_q4_results_deterministically( monkeypatch: pytest.MonkeyPatch, ) -> None: nonlinear_static._ensure_nonlinear_acceleration() - from anysolver import nonlinear_performance + from anyfesolver import nonlinear_performance batched_model, batched_load = _loaded_q4_model() batched = nonlinear_static.solve_static_nonlinear( @@ -1017,7 +1017,7 @@ def test_fully_constrained_plastic_q4_with_initial_field_keeps_true_origin() -> # Owner decision 2026-10-23: plastic qualified Q4 outside the assumed-strain # route scope is refused (the compatible-strain plastic route with the # qualified correction is unstable once layers yield). - from anysolver._q4_assumed_strain_plasticity import UnsupportedQ4PlasticRouteError + from anyfesolver._q4_assumed_strain_plasticity import UnsupportedQ4PlasticRouteError with pytest.raises(UnsupportedQ4PlasticRouteError, match="active initial"): nonlinear_static.solve_static_nonlinear( model, diff --git a/tests/test_e4_pl_q4_stationary_conditioning.py b/tests/test_e4_pl_q4_stationary_conditioning.py index 94ff6ef31..b9a7253a8 100644 --- a/tests/test_e4_pl_q4_stationary_conditioning.py +++ b/tests/test_e4_pl_q4_stationary_conditioning.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from anysolver.e4_pl_element import ( +from anyfesolver.e4_pl_element import ( STATIONARY_SOLVE_POLICY_ID, QualifiedE4PLShellElement, _coefficients, @@ -14,7 +14,7 @@ _symmetric_ruiz_congruence, equation7_frame, ) -from anysolver.fe_core import FEMesh, Material +from anyfesolver.fe_core import FEMesh, Material GEOMETRIES = ( diff --git a/tests/test_e4_pl_s3_assembly_fast_total.py b/tests/test_e4_pl_s3_assembly_fast_total.py index 492c6a3f0..bfa961ae2 100644 --- a/tests/test_e4_pl_s3_assembly_fast_total.py +++ b/tests/test_e4_pl_s3_assembly_fast_total.py @@ -6,16 +6,16 @@ import numpy as np import pytest -import anysolver.e4_pl_s3_element as s3_module -import anysolver.s3_reference_batch as s3_batch_module -from anysolver import ( +import anyfesolver.e4_pl_s3_element as s3_module +import anyfesolver.s3_reference_batch as s3_batch_module +from anyfesolver import ( FEModel, QualifiedE4PLS3ShellElement, QualifiedE4PLShellElement, assemble_stiffness_matrix, ) -from anysolver.matrix_assembly import AssemblyError -import anysolver.matrix_assembly as matrix_module +from anyfesolver.matrix_assembly import AssemblyError +import anyfesolver.matrix_assembly as matrix_module def _model(*, s3_count: int = 4, include_q4: bool = False) -> FEModel: diff --git a/tests/test_e4_pl_s3_bubble_policy.py b/tests/test_e4_pl_s3_bubble_policy.py index 8d064726a..241d84564 100644 --- a/tests/test_e4_pl_s3_bubble_policy.py +++ b/tests/test_e4_pl_s3_bubble_policy.py @@ -6,8 +6,8 @@ import numpy as np import pytest -import anysolver.e4_pl_s3_element as s3 -from anysolver.e4_pl_s3_state import ( +import anyfesolver.e4_pl_s3_element as s3 +from anyfesolver.e4_pl_s3_state import ( BUBBLE_CONDITION_LIMIT, BUBBLE_FORCE_CONDENSATION_ID, BUBBLE_LINE_SEARCH_MIN_FACTOR, @@ -17,7 +17,7 @@ BUBBLE_STEP_TOLERANCE, formulation_fingerprint_payload, ) -from anysolver.fe_core import Material +from anyfesolver.fe_core import Material from _e4_pl_s3_native_trial import native_trial_for_increment diff --git a/tests/test_e4_pl_s3_committed_state.py b/tests/test_e4_pl_s3_committed_state.py index 7ca6df5f2..9fd4c4cf8 100644 --- a/tests/test_e4_pl_s3_committed_state.py +++ b/tests/test_e4_pl_s3_committed_state.py @@ -7,8 +7,8 @@ import pytest from anymaterial import Hill48Yield, OrthotropicMaterial -from anysolver.fe_core import Material -from anysolver.e4_pl_s3_state import ( +from anyfesolver.fe_core import Material +from anyfesolver.e4_pl_s3_state import ( BUBBLE_STATE_ROLE, CANONICALIZATION_ID, DIRECTOR_INCREMENT_MAP_ID, diff --git a/tests/test_e4_pl_s3_contact_virtual_work.py b/tests/test_e4_pl_s3_contact_virtual_work.py index 40c6ae8f3..024016481 100644 --- a/tests/test_e4_pl_s3_contact_virtual_work.py +++ b/tests/test_e4_pl_s3_contact_virtual_work.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, FEModel, FixedSupport, @@ -13,20 +13,20 @@ TransientConfig, solve_transient_sphere_impact, ) -from anysolver._native_rotation_state import ( +from anyfesolver._native_rotation_state import ( create_native_rotation_state_store, rotation_exponential, ) -from anysolver.contact import ( +from anyfesolver.contact import ( NonlinearTransientConfig, RigidSphereImpact, SphereContactConfig, assemble_sphere_contact_load_vector, ) -from anysolver.elements import create_shell_element -from anysolver.nonlinear_state import NonlinearStateStore -from anysolver.shell_sections import GeneralizedShellSection -from anysolver.validation import load_vector_resultant +from anyfesolver.elements import create_shell_element +from anyfesolver.nonlinear_state import NonlinearStateStore +from anyfesolver.shell_sections import GeneralizedShellSection +from anyfesolver.validation import load_vector_resultant _THICKNESS = 0.2 @@ -733,7 +733,7 @@ def test_unconstrained_drill_matches_explicit_projected_contact_reference() -> N def test_top_level_native_contact_cutbacks_do_not_commit_rejected_rotations( monkeypatch: pytest.MonkeyPatch, ) -> None: - import anysolver.nonlinear_static as nonlinear_static + import anyfesolver.nonlinear_static as nonlinear_static captured: list[NonlinearStateStore] = [] original_activate = nonlinear_static._activate_nonlinear_state_storage diff --git a/tests/test_e4_pl_s3_current_tangent_buckling.py b/tests/test_e4_pl_s3_current_tangent_buckling.py index 4c43ffeda..3fa8d99ac 100644 --- a/tests/test_e4_pl_s3_current_tangent_buckling.py +++ b/tests/test_e4_pl_s3_current_tangent_buckling.py @@ -8,8 +8,8 @@ import numpy as np import pytest -import anysolver.e4_pl_s3_element as s3 -from anysolver import ( +import anyfesolver.e4_pl_s3_element as s3 +from anyfesolver import ( AnalysisSession, FEModel, QualifiedE4PLS3ShellElement, @@ -17,22 +17,22 @@ solve_eigenvalue_buckling, solve_static_nonlinear, ) -from anysolver.assembly import build_constraint_transformation -from anysolver.boundary import BoundaryCondition, FixedSupport, LoadCase -from anysolver.buckling import CURRENT_STATE_BUCKLING_POLICY_ID -from anysolver.current_state_tangent import ( +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.boundary import BoundaryCondition, FixedSupport, LoadCase +from anyfesolver.buckling import CURRENT_STATE_BUCKLING_POLICY_ID +from anyfesolver.current_state_tangent import ( assemble_committed_current_tangent_components, ) -from anysolver.e4_pl_s3_state import canonical_json_bytes -from anysolver.element_capabilities import ( +from anyfesolver.e4_pl_s3_state import canonical_json_bytes +from anyfesolver.element_capabilities import ( ElementCapabilityError, STATEFUL_MATERIAL_RESPONSE_MODE, STATELESS_FIXED_GENERALIZED_SECTION_RESPONSE_MODE, require_model_element_capabilities, require_model_nonlinear_workflow_capabilities, ) -from anysolver.linalg import FactorizationCache -from anysolver.nonlinear_state import ( +from anyfesolver.linalg import FactorizationCache +from anyfesolver.nonlinear_state import ( NonlinearStateStore, begin_state_evaluation, create_model_native_rotation_store, diff --git a/tests/test_e4_pl_s3_descriptor_hardening.py b/tests/test_e4_pl_s3_descriptor_hardening.py index 48d27956e..e3a36f092 100644 --- a/tests/test_e4_pl_s3_descriptor_hardening.py +++ b/tests/test_e4_pl_s3_descriptor_hardening.py @@ -4,22 +4,22 @@ import pytest from scipy import sparse -from anysolver import ( +from anyfesolver import ( FEModel, FixedSupport, QualifiedE4PLS3ShellElement, QualifiedE4PLShellElement, ) -from anysolver.algebraic_dynamics import ( +from anyfesolver.algebraic_dynamics import ( AlgebraicDynamicsError, _certify_spd, _sparse_nullspace_basis, build_declared_algebraic_basis, solve_descriptor_spectrum, ) -from anysolver.assembly import build_constraint_transformation -from anysolver.matrix_assembly import assemble_mass_matrix, assemble_stiffness_matrix -from anysolver.shell_sections import GeneralizedShellSection +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.matrix_assembly import assemble_mass_matrix, assemble_stiffness_matrix +from anyfesolver.shell_sections import GeneralizedShellSection def _q4_section(*, rotary_inertia_per_area: float) -> GeneralizedShellSection: diff --git a/tests/test_e4_pl_s3_descriptor_spectrum.py b/tests/test_e4_pl_s3_descriptor_spectrum.py index 41134b625..e3947a41a 100644 --- a/tests/test_e4_pl_s3_descriptor_spectrum.py +++ b/tests/test_e4_pl_s3_descriptor_spectrum.py @@ -6,7 +6,7 @@ import pytest from scipy import linalg, sparse -from anysolver.algebraic_dynamics import ( +from anyfesolver.algebraic_dynamics import ( AlgebraicDynamicsError, DESCRIPTOR_RAYLEIGH_REFINEMENT_POLICY_ID, _deterministic_block, diff --git a/tests/test_e4_pl_s3_direct_nonlinear_response.py b/tests/test_e4_pl_s3_direct_nonlinear_response.py index 83409bc65..51414fcdf 100644 --- a/tests/test_e4_pl_s3_direct_nonlinear_response.py +++ b/tests/test_e4_pl_s3_direct_nonlinear_response.py @@ -6,18 +6,18 @@ import numpy as np import pytest -from anysolver._native_rotation_state import ( +from anyfesolver._native_rotation_state import ( NativeElementRotationView, create_native_rotation_state_store, rotation_exponential, ) -from anysolver.e4_pl_s3_element import ( +from anyfesolver.e4_pl_s3_element import ( QualifiedE4PLS3ShellElement, invariant_drilling_scale, ) -from anysolver.e4_pl_s3_state import canonical_json_bytes -from anysolver.fe_core import FEModel -from anysolver.material_curves import ( +from anyfesolver.e4_pl_s3_state import canonical_json_bytes +from anyfesolver.fe_core import FEModel +from anyfesolver.material_curves import ( DNVC208MaterialCurve, LinearHardeningCurve, PiecewiseLinearCurve, diff --git a/tests/test_e4_pl_s3_domain_coercivity.py b/tests/test_e4_pl_s3_domain_coercivity.py index a126d68bc..9f93dacfd 100644 --- a/tests/test_e4_pl_s3_domain_coercivity.py +++ b/tests/test_e4_pl_s3_domain_coercivity.py @@ -426,7 +426,7 @@ def test_certifier_is_independently_authored_and_research_only() -> None: if isinstance(node, ast.ImportFrom) and node.module is not None ) assert not any( - name.startswith(("anysolver", "e4_pl_s3_", "sympy", "scipy", "numpy")) + name.startswith(("anyfesolver", "e4_pl_s3_", "sympy", "scipy", "numpy")) for name in imports ) source = CERTIFIER_PATH.read_text(encoding="utf-8") diff --git a/tests/test_e4_pl_s3_dynamic_guard.py b/tests/test_e4_pl_s3_dynamic_guard.py index 9bf100e68..aec8a8831 100644 --- a/tests/test_e4_pl_s3_dynamic_guard.py +++ b/tests/test_e4_pl_s3_dynamic_guard.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ElementCapabilityError, FEModel, @@ -13,7 +13,7 @@ TransientConfig, solve_transient_sphere_impact, ) -from anysolver.element_capabilities import require_model_element_capabilities +from anyfesolver.element_capabilities import require_model_element_capabilities def _model() -> FEModel: diff --git a/tests/test_e4_pl_s3_exact_oracle.py b/tests/test_e4_pl_s3_exact_oracle.py index 09844d516..1f89c599f 100644 --- a/tests/test_e4_pl_s3_exact_oracle.py +++ b/tests/test_e4_pl_s3_exact_oracle.py @@ -9,10 +9,10 @@ import numpy as np import pytest -import anysolver.e4_pl_s3_element as s3_element -from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement -from anysolver.fe_core import FEMesh, Material -from anysolver.shell_sections import GeneralizedShellSection +import anyfesolver.e4_pl_s3_element as s3_element +from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement +from anyfesolver.fe_core import FEMesh, Material +from anyfesolver.shell_sections import GeneralizedShellSection ROOT = Path(__file__).resolve().parents[1] @@ -397,7 +397,7 @@ def test_exact_oracle_is_independent_and_rejects_nonexact_inputs() -> None: imports.add(node.module.split(".", 1)[0]) assert imports <= {"__future__", "dataclasses", "fractions", "typing"} source = ORACLE_PATH.read_text(encoding="utf-8").lower() - assert "import anysolver" not in source + assert "import anyfesolver" not in source assert "e4_pl_s3_linear_reference" not in source with pytest.raises(TypeError, match="exact oracle inputs"): oracle.reconstruct_exact_blocks( diff --git a/tests/test_e4_pl_s3_fast_total.py b/tests/test_e4_pl_s3_fast_total.py index cf0125c4e..b53a1e96f 100644 --- a/tests/test_e4_pl_s3_fast_total.py +++ b/tests/test_e4_pl_s3_fast_total.py @@ -3,11 +3,11 @@ import numpy as np import pytest -import anysolver.e4_pl_s3_element as s3_module -import anysolver.fe_core as fe_core_module -from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement -from anysolver.elements import Element, ShellElement -from anysolver.fe_core import FEMesh, Material +import anyfesolver.e4_pl_s3_element as s3_module +import anyfesolver.fe_core as fe_core_module +from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement +from anyfesolver.elements import Element, ShellElement +from anyfesolver.fe_core import FEMesh, Material def _exact_case() -> tuple[FEMesh, QualifiedE4PLS3ShellElement, Material]: diff --git a/tests/test_e4_pl_s3_formulation_contract.py b/tests/test_e4_pl_s3_formulation_contract.py index 4f4226923..f99c8741f 100644 --- a/tests/test_e4_pl_s3_formulation_contract.py +++ b/tests/test_e4_pl_s3_formulation_contract.py @@ -7,7 +7,7 @@ import pytest -from anysolver.algebraic_dynamics import ( +from anyfesolver.algebraic_dynamics import ( DESCRIPTOR_COORDINATE_SHEAR_LIMIT, DESCRIPTOR_DENSE_CONDENSATION_LIMIT, DESCRIPTOR_MODAL_POLICY_ID, @@ -17,24 +17,24 @@ DESCRIPTOR_TRANSIENT_POLICY_ID, DESCRIPTOR_TRANSIENT_STATIC_POLICY_ID, ) -from anysolver.buckling import ( +from anyfesolver.buckling import ( CURRENT_STATE_BUCKLING_POLICY_ID, QUALIFIED_Q4_S3_CURRENT_STATE_BUCKLING_POLICY_ID, ) -from anysolver.current_state_tangent import ( +from anyfesolver.current_state_tangent import ( COMMITTED_CURRENT_TANGENT_ASSEMBLY_POLICY_ID, COMMITTED_CURRENT_TANGENT_INPUT_OWNERSHIP_POLICY_ID, COMMITTED_CURRENT_TANGENT_ROUTE_POLICY_ID, CURRENT_STATE_EIGEN_ACTIVITY_POLICY_ID, ) -from anysolver.dynamics import QUALIFIED_REFERENCE_TRANSIENT_AUTHORITY_POLICY_ID -from anysolver.e4_pl_element import ( +from anyfesolver.dynamics import QUALIFIED_REFERENCE_TRANSIENT_AUTHORITY_POLICY_ID +from anyfesolver.e4_pl_element import ( Q4_ACTIVITY_DISPOSITION_SCHEMA_ID, Q4_DELETED_FROZEN_POLICY_ID, Q4_FAILED_STATE_POLICY_ID, Q4_QUADRATURE_AUTHORITY_ID, ) -from anysolver.e4_pl_s3_element import ( +from anyfesolver.e4_pl_s3_element import ( ALGEBRAIC_COORDINATE_POLICY_ID, BUBBLE_OFFSET_D, CURRENT_STATE_BUBBLE_PROJECTION_POLICY_ID, @@ -62,7 +62,7 @@ TYING_POINTS, QualifiedE4PLS3ShellElement, ) -from anysolver.e4_pl_s3_state import ( +from anyfesolver.e4_pl_s3_state import ( BUBBLE_CONVENTION as STATE_BUBBLE_CONVENTION, BUBBLE_CONDITION_LIMIT, BUBBLE_FORCE_CONDENSATION_ID, @@ -134,11 +134,11 @@ state_field_manifest_fingerprint, stiffness_station_table_fingerprint, ) -from anysolver.modal import ( +from anyfesolver.modal import ( CURRENT_STATE_MODAL_POLICY_ID, QUALIFIED_PRESTRESS_OPERATOR_AUTHORITY_POLICY_ID, ) -from anysolver.nonlinear_restart import ( +from anyfesolver.nonlinear_restart import ( NONLINEAR_CHECKPOINT_INTEGRITY_ID, NONLINEAR_CHECKPOINT_SCHEMA, NONLINEAR_CHECKPOINT_VERSION, diff --git a/tests/test_e4_pl_s3_generalized_initial_fields.py b/tests/test_e4_pl_s3_generalized_initial_fields.py index 3bd7bf7f3..1c9b7b2c3 100644 --- a/tests/test_e4_pl_s3_generalized_initial_fields.py +++ b/tests/test_e4_pl_s3_generalized_initial_fields.py @@ -6,12 +6,12 @@ import numpy as np import pytest -import anysolver.e4_pl_s3_element as s3 -from anysolver._native_rotation_state import create_native_rotation_state_store -from anysolver.arc_length import ArcLengthControl, solve_static_arc_length -from anysolver.boundary import BoundaryCondition, FixedSupport, LoadCase -from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement -from anysolver.e4_pl_s3_state import ( +import anyfesolver.e4_pl_s3_element as s3 +from anyfesolver._native_rotation_state import create_native_rotation_state_store +from anyfesolver.arc_length import ArcLengthControl, solve_static_arc_length +from anyfesolver.boundary import BoundaryCondition, FixedSupport, LoadCase +from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement +from anyfesolver.e4_pl_s3_state import ( GENERALIZED_INITIAL_FIELD_POLICY_ID, GENERALIZED_NONLINEAR_STATE_SCHEMA, S3CommittedStateError, @@ -19,10 +19,10 @@ seal_committed_s3_state, strict_canonical_json_loads, ) -from anysolver.fe_core import FEModel -from anysolver.nonlinear_static import ShellInitialField, solve_static_nonlinear -from anysolver.recovery import _recover_qualified_s3_committed_state -from anysolver.shell_sections import GeneralizedShellSection +from anyfesolver.fe_core import FEModel +from anyfesolver.nonlinear_static import ShellInitialField, solve_static_nonlinear +from anyfesolver.recovery import _recover_qualified_s3_committed_state +from anyfesolver.shell_sections import GeneralizedShellSection REFERENCE = np.asarray( diff --git a/tests/test_e4_pl_s3_generalized_nonlinear.py b/tests/test_e4_pl_s3_generalized_nonlinear.py index 7eba1307c..85cf8c1cc 100644 --- a/tests/test_e4_pl_s3_generalized_nonlinear.py +++ b/tests/test_e4_pl_s3_generalized_nonlinear.py @@ -6,17 +6,17 @@ import numpy as np import pytest -import anysolver.e4_pl_s3_element as s3 +import anyfesolver.e4_pl_s3_element as s3 -from anysolver._native_rotation_state import ( +from anyfesolver._native_rotation_state import ( NativeElementRotationView, create_native_rotation_state_store, rotation_exponential, ) -from anysolver.arc_length import ArcLengthControl, solve_static_arc_length -from anysolver.boundary import BoundaryCondition, FixedSupport, LoadCase -from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement -from anysolver.e4_pl_s3_state import ( +from anyfesolver.arc_length import ArcLengthControl, solve_static_arc_length +from anyfesolver.boundary import BoundaryCondition, FixedSupport, LoadCase +from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement +from anyfesolver.e4_pl_s3_state import ( GENERALIZED_NONLINEAR_STATE_SCHEMA, GENERALIZED_STATE_MODE, S3CommittedStateError, @@ -24,9 +24,9 @@ seal_committed_s3_state, strict_canonical_json_loads, ) -from anysolver.fe_core import FEModel -from anysolver.nonlinear_static import solve_static_nonlinear -from anysolver.shell_sections import GeneralizedShellSection +from anyfesolver.fe_core import FEModel +from anyfesolver.nonlinear_static import solve_static_nonlinear +from anyfesolver.shell_sections import GeneralizedShellSection from _e4_pl_s3_native_trial import native_trial_for_increment diff --git a/tests/test_e4_pl_s3_geometric_stiffness.py b/tests/test_e4_pl_s3_geometric_stiffness.py index 51f429562..564867dd3 100644 --- a/tests/test_e4_pl_s3_geometric_stiffness.py +++ b/tests/test_e4_pl_s3_geometric_stiffness.py @@ -5,20 +5,20 @@ import numpy as np import pytest -from anysolver import FEModel, QualifiedE4PLS3ShellElement -from anysolver.buckling import solve_eigenvalue_buckling -from anysolver.e4_pl_s3_element import ( +from anyfesolver import FEModel, QualifiedE4PLS3ShellElement +from anyfesolver.buckling import solve_eigenvalue_buckling +from anyfesolver.e4_pl_s3_element import ( GEOMETRIC_STIFFNESS_POLICY_ID, HOMOGENEOUS_ELASTIC_STRESS_PROFILE_ID, PHYSICAL_EXTERNAL_INDICES, REFERENCE_ELASTIC_BUBBLE_LINEARIZATION_ID, TRIANGLE_QUADRATURE, ) -from anysolver.element_capabilities import ElementCapabilityError -from anysolver.fe_core import FEMesh, Material -from anysolver.matrix_assembly import assemble_geometric_stiffness_matrix -from anysolver.nonlinear import solve_nonlinear_load_stepping -from anysolver.shell_sections import GeneralizedShellSection +from anyfesolver.element_capabilities import ElementCapabilityError +from anyfesolver.fe_core import FEMesh, Material +from anyfesolver.matrix_assembly import assemble_geometric_stiffness_matrix +from anyfesolver.nonlinear import solve_nonlinear_load_stepping +from anyfesolver.shell_sections import GeneralizedShellSection OWNER_NORMAL = np.asarray((0.0, 0.0, 1.0)) diff --git a/tests/test_e4_pl_s3_guard_persistence.py b/tests/test_e4_pl_s3_guard_persistence.py index f509c7547..f6df390e7 100644 --- a/tests/test_e4_pl_s3_guard_persistence.py +++ b/tests/test_e4_pl_s3_guard_persistence.py @@ -7,12 +7,12 @@ import numpy as np import pytest -import anysolver.arc_length as arc_length_module -import anysolver.imperfections as imperfections_module -import anysolver.nonlinear_static as nonlinear_static_module -import anysolver.recovery as recovery_module -import anysolver.results as results_module -from anysolver import ( +import anyfesolver.arc_length as arc_length_module +import anyfesolver.imperfections as imperfections_module +import anyfesolver.nonlinear_static as nonlinear_static_module +import anyfesolver.recovery as recovery_module +import anyfesolver.results as results_module +from anyfesolver import ( ElementCapabilityError, FEModel, GeneralizedShellSection, @@ -26,8 +26,8 @@ create_shell_element, shell_element_from_dict, ) -from anysolver.assembly import compute_stresses as assembly_compute_stresses -from anysolver.element_capabilities import require_model_element_capabilities +from anyfesolver.assembly import compute_stresses as assembly_compute_stresses +from anyfesolver.element_capabilities import require_model_element_capabilities OWNER_NORMAL = np.asarray((0.0, 0.0, 1.0)) diff --git a/tests/test_e4_pl_s3_independent_linear_reference.py b/tests/test_e4_pl_s3_independent_linear_reference.py index ba48ba717..db792950a 100644 --- a/tests/test_e4_pl_s3_independent_linear_reference.py +++ b/tests/test_e4_pl_s3_independent_linear_reference.py @@ -8,9 +8,9 @@ import numpy as np import pytest -from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement -from anysolver.fe_core import FEMesh, Material -from anysolver.shell_sections import GeneralizedShellSection +from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement +from anyfesolver.fe_core import FEMesh, Material +from anyfesolver.shell_sections import GeneralizedShellSection ROOT = Path(__file__).resolve().parents[1] @@ -182,7 +182,7 @@ def test_independent_reference_matches_every_d3_action_and_director_polarity( _compare_case(permutation, polarity, generalized=generalized) -def test_reference_is_independent_of_anysolver_and_producer_mechanics() -> None: +def test_reference_is_independent_of_anyfesolver_and_producer_mechanics() -> None: tree = ast.parse(REFERENCE_PATH.read_text(encoding="utf-8")) imports: set[str] = set() for node in ast.walk(tree): @@ -191,8 +191,8 @@ def test_reference_is_independent_of_anysolver_and_producer_mechanics() -> None: elif isinstance(node, ast.ImportFrom) and node.module: imports.add(node.module.split(".", 1)[0]) assert imports <= {"__future__", "dataclasses", "math", "typing", "numpy"} - assert "anysolver" not in REFERENCE_PATH.read_text(encoding="utf-8").lower().replace( - "anysolver module", "" + assert "anyfesolver" not in REFERENCE_PATH.read_text(encoding="utf-8").lower().replace( + "anyfesolver module", "" ) diff --git a/tests/test_e4_pl_s3_mass.py b/tests/test_e4_pl_s3_mass.py index 041d7c3eb..5b63e0205 100644 --- a/tests/test_e4_pl_s3_mass.py +++ b/tests/test_e4_pl_s3_mass.py @@ -7,14 +7,14 @@ import numpy as np import pytest -from anysolver.e4_pl_s3_element import ( +from anyfesolver.e4_pl_s3_element import ( MASS_MOMENT_ID, TRIANGLE_QUADRATURE, QualifiedE4PLS3ShellElement, _analytic_mass_moments, ) -from anysolver.fe_core import FEMesh, Material -from anysolver.shell_sections import GeneralizedShellSection +from anyfesolver.fe_core import FEMesh, Material +from anyfesolver.shell_sections import GeneralizedShellSection def _mesh(nodes: np.ndarray) -> FEMesh: diff --git a/tests/test_e4_pl_s3_mixed_eigen_performance.py b/tests/test_e4_pl_s3_mixed_eigen_performance.py index e7894f481..024c299fc 100644 --- a/tests/test_e4_pl_s3_mixed_eigen_performance.py +++ b/tests/test_e4_pl_s3_mixed_eigen_performance.py @@ -70,8 +70,8 @@ def test_input_is_canonical_hash_bound_and_uses_the_frozen_candidate( "tests/test_e4_pl_s3_mixed_structural_qualification.py", ], "changed_paths": [ - "src/anysolver/matrix_assembly.py", - "src/anysolver/s3_reference_batch.py", + "src/anyfesolver/matrix_assembly.py", + "src/anyfesolver/s3_reference_batch.py", "tests/test_e4_pl_s3_reference_batch.py", ], "commit": "4e5b5976d4286ffd0cda5b8424d154132f3f8da0", @@ -125,7 +125,7 @@ def test_duplicate_nonfinite_hash_and_topology_mutations_fail_before_mechanics( payload["authority"]["candidate"]["changed_paths"] = sorted( [ *payload["authority"]["candidate"]["changed_paths"][:-1], - "src/anysolver/e4_pl_element.py", + "src/anyfesolver/e4_pl_element.py", ] ) extent = tmp_path / "extent.json" @@ -462,10 +462,10 @@ def test_timeout_terminates_worker_and_removes_partial_canonical_output( def test_default_s3_remains_legacy_and_q4_mechanics_is_unchanged( authorities: Any, ) -> None: - from anysolver.elements import DEFAULT_S3_FORMULATION + from anyfesolver.elements import DEFAULT_S3_FORMULATION assert DEFAULT_S3_FORMULATION == "legacy-s3" - q4 = ROOT / "src" / "anysolver" / "e4_pl_element.py" + q4 = ROOT / "src" / "anyfesolver" / "e4_pl_element.py" assert authorities.input["authority"]["production_boundary"]["q4_mechanics"][ "sha256" ] == ( diff --git a/tests/test_e4_pl_s3_mixed_mesh_manifest.py b/tests/test_e4_pl_s3_mixed_mesh_manifest.py index 83d85adba..3e6b378e5 100644 --- a/tests/test_e4_pl_s3_mixed_mesh_manifest.py +++ b/tests/test_e4_pl_s3_mixed_mesh_manifest.py @@ -29,7 +29,7 @@ QUALIFICATION_CONTRACT_SHA256 = ( "3F933786A334A876C1B53EF90891237F18C0970DE6B95F885CF5B775791E0A99" ) -QUALIFIED_Q4_MECHANICS = ROOT / "src" / "anysolver" / "e4_pl_element.py" +QUALIFIED_Q4_MECHANICS = ROOT / "src" / "anyfesolver" / "e4_pl_element.py" Q4_REPLAY_HOTFIX = ( ROOT / "docs" @@ -475,9 +475,9 @@ def _require_prospective_q4_source_binding( } inventory = _mechanics_nodes(source) expected_external = { - '_elastic_increment_module': 'src/anysolver/vectorized_nonlinear.py', - '_local_contractions': 'src/anysolver/_compensated_contractions.py', - '_elements_module': 'src/anysolver/elements.py', + '_elastic_increment_module': 'src/anyfesolver/vectorized_nonlinear.py', + '_local_contractions': 'src/anyfesolver/_compensated_contractions.py', + '_elements_module': 'src/anyfesolver/elements.py', } assert set(record['external_arithmetic_dependencies']) == set(expected_external) for alias, relative in expected_external.items(): @@ -496,7 +496,7 @@ def _require_prospective_q4_source_binding( assert observed['status'] == 'PASS' assert observed['case_count'] == 41 and observed['phase_count'] == 123 assert set(observed['all_source_symbol_delta']['files']) == { - 'src/anysolver/e4_pl_element.py', + 'src/anyfesolver/e4_pl_element.py', 'tests/test_e4_pl_s3_mixed_mesh_manifest.py', 'tests/test_general_contact_c5_elastic_increment.py', 'tests/test_general_contact_c5_numpy_coordinate_admission.py', @@ -651,7 +651,7 @@ def test_prospective_q4_source_binding_rejects_external_dependency_drift(monkeyp path=authority["path"], required_symbols=set(authority["symbols"]), ) record = Q4_SOURCE_BINDING.read_bytes() - dependency = ROOT / "src" / "anysolver" / "vectorized_nonlinear.py" + dependency = ROOT / "src" / "anyfesolver" / "vectorized_nonlinear.py" original = Path.read_bytes def changed_bytes(path): value = original(path) diff --git a/tests/test_e4_pl_s3_mixed_mesh_qualification_runner.py b/tests/test_e4_pl_s3_mixed_mesh_qualification_runner.py index e45951c39..03c2e7413 100644 --- a/tests/test_e4_pl_s3_mixed_mesh_qualification_runner.py +++ b/tests/test_e4_pl_s3_mixed_mesh_qualification_runner.py @@ -293,9 +293,9 @@ def test_full_model_inputs_and_hashes_are_deterministic( def test_factories_are_real_qualified_classes_and_s3_remains_opt_in( built_cases: list[Any], ) -> None: - from anysolver.e4_pl_element import QualifiedE4PLShellElement - from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement - from anysolver.elements import ( + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement + from anyfesolver.elements import ( DEFAULT_Q4_FORMULATION, DEFAULT_S3_FORMULATION, ShellElement, diff --git a/tests/test_e4_pl_s3_mixed_structural_qualification.py b/tests/test_e4_pl_s3_mixed_structural_qualification.py index 6794df386..0efd5458f 100644 --- a/tests/test_e4_pl_s3_mixed_structural_qualification.py +++ b/tests/test_e4_pl_s3_mixed_structural_qualification.py @@ -154,7 +154,7 @@ def test_input_schema_candidate_and_frozen_authorities_are_exact(authorities: An common.ALLOWED_EXECUTION_EXTENT ) assert all(line.startswith("A\t") for line in extent) - q4 = ROOT / "src" / "anysolver" / "e4_pl_element.py" + q4 = ROOT / "src" / "anyfesolver" / "e4_pl_element.py" assert hashlib.sha256(q4.read_bytes()).hexdigest().upper() == ( "EE49BAE1C9439C41EC2D61798A8A8B88CBA9081DCAD2DFDC857FE313C6C0D4D1" ) diff --git a/tests/test_e4_pl_s3_modal.py b/tests/test_e4_pl_s3_modal.py index 4af2cc75f..ba7cdee55 100644 --- a/tests/test_e4_pl_s3_modal.py +++ b/tests/test_e4_pl_s3_modal.py @@ -4,7 +4,7 @@ import pytest from scipy import linalg -from anysolver import ( +from anyfesolver import ( AnalysisSession, BoundaryCondition, FEModel, @@ -13,14 +13,14 @@ QualifiedE4PLShellElement, solve_free_vibration, ) -from anysolver.algebraic_dynamics import ( +from anyfesolver.algebraic_dynamics import ( DESCRIPTOR_MODAL_POLICY_ID, DESCRIPTOR_RAYLEIGH_REFINEMENT_POLICY_ID, solve_descriptor_spectrum, ) -from anysolver.assembly import build_constraint_transformation -from anysolver.matrix_assembly import assemble_mass_matrix, assemble_stiffness_matrix -from anysolver.shell_sections import GeneralizedShellSection +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.matrix_assembly import assemble_mass_matrix, assemble_stiffness_matrix +from anyfesolver.shell_sections import GeneralizedShellSection def _supported_model(*, inclined: bool = False) -> FEModel: diff --git a/tests/test_e4_pl_s3_modal_provenance.py b/tests/test_e4_pl_s3_modal_provenance.py index 024f30dbd..f67722680 100644 --- a/tests/test_e4_pl_s3_modal_provenance.py +++ b/tests/test_e4_pl_s3_modal_provenance.py @@ -8,7 +8,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, FEModel, FixedSupport, @@ -16,12 +16,12 @@ shell_element_from_dict, solve_free_vibration, ) -from anysolver.e4_pl_s3_element import ( +from anyfesolver.e4_pl_s3_element import ( ALGEBRAIC_COORDINATE_POLICY_ID, FORMULATION_ID, ) -from anysolver.element_capabilities import ElementCapabilityError -from anysolver.elements import BeamElement +from anyfesolver.element_capabilities import ElementCapabilityError +from anyfesolver.elements import BeamElement _PROVENANCE = [ @@ -131,7 +131,7 @@ def test_descriptor_failure_provenance_and_diagnostics_are_stable() -> None: def test_descriptor_backend_failure_is_wrapped_without_backend_text( monkeypatch: pytest.MonkeyPatch, ) -> None: - import anysolver.algebraic_dynamics as algebraic_dynamics + import anyfesolver.algebraic_dynamics as algebraic_dynamics calls = 0 diff --git a/tests/test_e4_pl_s3_model_bound_nonlinear_hook.py b/tests/test_e4_pl_s3_model_bound_nonlinear_hook.py index 36b176d25..f335fcbc1 100644 --- a/tests/test_e4_pl_s3_model_bound_nonlinear_hook.py +++ b/tests/test_e4_pl_s3_model_bound_nonlinear_hook.py @@ -5,25 +5,25 @@ import numpy as np import pytest -from anysolver.assembly import solve_nonlinear -from anysolver.boundary import LoadCase -from anysolver.corotational import ( +from anyfesolver.assembly import solve_nonlinear +from anyfesolver.boundary import LoadCase +from anyfesolver.corotational import ( corotational_element_response, validate_corotational_scope, ) -from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement -from anysolver.elements import ShellElement -from anysolver.fe_core import FEModel -from anysolver.nonlinear_static import ( +from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement +from anyfesolver.elements import ShellElement +from anyfesolver.fe_core import FEModel +from anyfesolver.nonlinear_static import ( ShellInitialField, _prepare_initial_states, _state_has_initial_field, ) -from anysolver.nonlinear_performance import ( +from anyfesolver.nonlinear_performance import ( _state_has_initial_fields as _performance_state_has_initial_fields, ) -from anysolver.nonlinear import solve_nonlinear_load_stepping -from anysolver.nonlinear_state import StateTransactionError +from anyfesolver.nonlinear import solve_nonlinear_load_stepping +from anyfesolver.nonlinear_state import StateTransactionError _TRIANGLE = ( @@ -110,7 +110,7 @@ def record_validation( ) monkeypatch.setattr( - "anysolver.elements.validate_initial_field_state", + "anyfesolver.elements.validate_initial_field_state", record_validation, ) states, provenance = _prepare_initial_states( diff --git a/tests/test_e4_pl_s3_native_tl_covariance.py b/tests/test_e4_pl_s3_native_tl_covariance.py index ce5d0215e..529d5928b 100644 --- a/tests/test_e4_pl_s3_native_tl_covariance.py +++ b/tests/test_e4_pl_s3_native_tl_covariance.py @@ -12,8 +12,8 @@ import numpy as np -import anysolver.e4_pl_s3_element as s3 -from anysolver.e4_pl_s3_state import reconstruct_director_triad +import anyfesolver.e4_pl_s3_element as s3 +from anyfesolver.e4_pl_s3_state import reconstruct_director_triad from _e4_pl_s3_native_trial import native_trial_for_increment diff --git a/tests/test_e4_pl_s3_native_tl_full_d3.py b/tests/test_e4_pl_s3_native_tl_full_d3.py index cd5ec7c64..d793d695f 100644 --- a/tests/test_e4_pl_s3_native_tl_full_d3.py +++ b/tests/test_e4_pl_s3_native_tl_full_d3.py @@ -15,8 +15,8 @@ import numpy as np -import anysolver.e4_pl_s3_element as s3 -from anysolver import OrthotropicMaterial +import anyfesolver.e4_pl_s3_element as s3 +from anyfesolver import OrthotropicMaterial from _e4_pl_s3_native_trial import native_trial_for_increment diff --git a/tests/test_e4_pl_s3_native_tl_kernel.py b/tests/test_e4_pl_s3_native_tl_kernel.py index bc03f38db..96455a445 100644 --- a/tests/test_e4_pl_s3_native_tl_kernel.py +++ b/tests/test_e4_pl_s3_native_tl_kernel.py @@ -25,8 +25,8 @@ import numpy as np import pytest -import anysolver -import anysolver.e4_pl_s3_element as s3 +import anyfesolver +import anyfesolver.e4_pl_s3_element as s3 from _e4_pl_s3_native_trial import native_trial_for_increment @@ -423,4 +423,4 @@ def evaluate(candidate: np.ndarray) -> tuple[np.ndarray, np.ndarray, np.ndarray] def test_private_kernel_is_not_exposed_as_a_supported_api() -> None: assert "_native_incremental_strain_jets" not in s3.__all__ - assert not hasattr(anysolver, "_native_incremental_strain_jets") + assert not hasattr(anyfesolver, "_native_incremental_strain_jets") diff --git a/tests/test_e4_pl_s3_native_tl_response.py b/tests/test_e4_pl_s3_native_tl_response.py index 1cfdfc3b2..f9260e2d6 100644 --- a/tests/test_e4_pl_s3_native_tl_response.py +++ b/tests/test_e4_pl_s3_native_tl_response.py @@ -5,8 +5,8 @@ import numpy as np import pytest -import anysolver.e4_pl_s3_element as s3 -from anysolver.fe_core import Material +import anyfesolver.e4_pl_s3_element as s3 +from anyfesolver.fe_core import Material from _e4_pl_s3_native_trial import native_trial_for_increment diff --git a/tests/test_e4_pl_s3_nonlinear_workflows.py b/tests/test_e4_pl_s3_nonlinear_workflows.py index fedf6f341..2b4c5d101 100644 --- a/tests/test_e4_pl_s3_nonlinear_workflows.py +++ b/tests/test_e4_pl_s3_nonlinear_workflows.py @@ -2,12 +2,12 @@ import numpy as np -from anysolver.arc_length import ArcLengthControl, solve_static_arc_length -from anysolver.boundary import BoundaryCondition, FixedSupport, LoadCase -from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement -from anysolver.fe_core import FEModel -from anysolver.material_curves import LinearHardeningCurve -from anysolver.nonlinear_static import ShellInitialField, solve_static_nonlinear +from anyfesolver.arc_length import ArcLengthControl, solve_static_arc_length +from anyfesolver.boundary import BoundaryCondition, FixedSupport, LoadCase +from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement +from anyfesolver.fe_core import FEModel +from anyfesolver.material_curves import LinearHardeningCurve +from anyfesolver.nonlinear_static import ShellInitialField, solve_static_nonlinear def _single_coordinate_model(*, plastic: bool = False) -> tuple[FEModel, LoadCase]: diff --git a/tests/test_e4_pl_s3_objective_pl.py b/tests/test_e4_pl_s3_objective_pl.py index 3e5e874f8..5388f1b13 100644 --- a/tests/test_e4_pl_s3_objective_pl.py +++ b/tests/test_e4_pl_s3_objective_pl.py @@ -6,7 +6,7 @@ import numpy as np import pytest -from anysolver.e4_pl_s3_element import ( +from anyfesolver.e4_pl_s3_element import ( NODAL_ROTATION_UPDATE_POLICY_ID, NONLINEAR_PL_ENERGY_POLICY_ID, PL_PHASE_POLICY_ID, @@ -17,7 +17,7 @@ _rodrigues_rotation, triangle_frame, ) -from anysolver.e4_pl_s3_state import ( +from anyfesolver.e4_pl_s3_state import ( PL_MINIMUM_TWIST_DENOMINATOR, PL_PHASE_MARGIN, ) diff --git a/tests/test_e4_pl_s3_opt_in.py b/tests/test_e4_pl_s3_opt_in.py index 82471cbc6..c4eb35066 100644 --- a/tests/test_e4_pl_s3_opt_in.py +++ b/tests/test_e4_pl_s3_opt_in.py @@ -7,8 +7,8 @@ import numpy as np import pytest -import anysolver.e4_pl_s3_element as s3_element_module -from anysolver import ( +import anyfesolver.e4_pl_s3_element as s3_element_module +from anyfesolver import ( DEFAULT_Q4_FORMULATION, DEFAULT_S3_FORMULATION, ElementCapabilityError, @@ -25,7 +25,7 @@ create_shell_element, shell_element_from_dict, ) -from anysolver.e4_pl_s3_element import ( +from anyfesolver.e4_pl_s3_element import ( BUBBLE_OFFSET_D, CAPABILITY_GAPS, FORMULATION_ID, @@ -37,8 +37,8 @@ TYING_POINTS, invariant_drilling_scale, ) -from anysolver.fe_core import FEMesh, Material -from anysolver.shell_sections import GeneralizedShellSection +from anyfesolver.fe_core import FEMesh, Material +from anyfesolver.shell_sections import GeneralizedShellSection def _mesh(nodes: np.ndarray) -> FEMesh: diff --git a/tests/test_e4_pl_s3_patch_recovery.py b/tests/test_e4_pl_s3_patch_recovery.py index 3cff6cc07..00ccba960 100644 --- a/tests/test_e4_pl_s3_patch_recovery.py +++ b/tests/test_e4_pl_s3_patch_recovery.py @@ -7,27 +7,27 @@ import numpy as np import pytest -from anysolver import FEModel, PatchRecoveryConfig -from anysolver.e4_pl_element import QualifiedE4PLShellElement -from anysolver.corotational import rotation_matrix_from_vector -from anysolver.e4_pl_s3_element import ( +from anyfesolver import FEModel, PatchRecoveryConfig +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement +from anyfesolver.corotational import rotation_matrix_from_vector +from anyfesolver.e4_pl_s3_element import ( QualifiedE4PLS3ShellElement, triangle_frame, ) -from anysolver.e4_pl_s3_state import ( +from anyfesolver.e4_pl_s3_state import ( GENERALIZED_NONLINEAR_STATE_SCHEMA, seal_committed_s3_state, ) -from anysolver.elements import ShellElement -from anysolver.plasticity import lobatto_layers -from anysolver.recovery import ( +from anyfesolver.elements import ShellElement +from anyfesolver.plasticity import lobatto_layers +from anyfesolver.recovery import ( _qualified_s3_current_physical_frame, _recover_qualified_s3_committed_state, recover_shell_patch_stresses, recover_stress_result, ) -from anysolver.results import _gauss_to_node_extrapolation -from anysolver.shell_sections import GeneralizedShellSection +from anyfesolver.results import _gauss_to_node_extrapolation +from anyfesolver.shell_sections import GeneralizedShellSection _SURFACE_COMPONENTS = ("xx", "yy", "zz", "xy", "yz", "xz") diff --git a/tests/test_e4_pl_s3_physical_director_reversal.py b/tests/test_e4_pl_s3_physical_director_reversal.py index 477d683f6..69b4d566e 100644 --- a/tests/test_e4_pl_s3_physical_director_reversal.py +++ b/tests/test_e4_pl_s3_physical_director_reversal.py @@ -6,18 +6,18 @@ import numpy as np import pytest -from anysolver import FEModel, QualifiedE4PLS3ShellElement, shell_element_from_dict -from anysolver._native_rotation_state import create_native_rotation_state_store -from anysolver.boundary import LoadCase -from anysolver.e4_pl_s3_state import ( +from anyfesolver import FEModel, QualifiedE4PLS3ShellElement, shell_element_from_dict +from anyfesolver._native_rotation_state import create_native_rotation_state_store +from anyfesolver.boundary import LoadCase +from anyfesolver.e4_pl_s3_state import ( DIRECTOR_POLARITY_POLICY_ID, DIRECTOR_REVERSAL_TRANSFORM_ID, S3CommittedStateError, seal_committed_s3_state, ) -from anysolver.material_curves import LinearHardeningCurve -from anysolver.shell_sections import GeneralizedShellSection -from anysolver.recovery import _recover_qualified_s3_committed_state +from anyfesolver.material_curves import LinearHardeningCurve +from anyfesolver.shell_sections import GeneralizedShellSection +from anyfesolver.recovery import _recover_qualified_s3_committed_state REFERENCE = np.asarray( diff --git a/tests/test_e4_pl_s3_physical_recovery.py b/tests/test_e4_pl_s3_physical_recovery.py index f97f60ab7..fdbc77608 100644 --- a/tests/test_e4_pl_s3_physical_recovery.py +++ b/tests/test_e4_pl_s3_physical_recovery.py @@ -6,7 +6,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( FEModel, Hill48Yield, OrthotropicMaterial, @@ -16,16 +16,16 @@ describe_result_quantities, recover_stress_result, ) -from anysolver.e4_pl_s3_element import ( +from anyfesolver.e4_pl_s3_element import ( CAPABILITY_GAPS, PHYSICAL_EXTERNAL_INDICES, TRIANGLE_QUADRATURE, triangle_frame, ) -from anysolver.fe_core import FEMesh, Material -from anysolver.plasticity import hill48_plane_stress_equivalent_stress -from anysolver.recovery import recover_element_stresses_with_report -from anysolver.shell_sections import GeneralizedShellSection +from anyfesolver.fe_core import FEMesh, Material +from anyfesolver.plasticity import hill48_plane_stress_equivalent_stress +from anyfesolver.recovery import recover_element_stresses_with_report +from anyfesolver.shell_sections import GeneralizedShellSection OWNER_NORMAL = np.asarray((0.0, 0.0, 1.0), dtype=float) diff --git a/tests/test_e4_pl_s3_prestressed_modal_buckling.py b/tests/test_e4_pl_s3_prestressed_modal_buckling.py index 468192e49..e723c6f76 100644 --- a/tests/test_e4_pl_s3_prestressed_modal_buckling.py +++ b/tests/test_e4_pl_s3_prestressed_modal_buckling.py @@ -7,12 +7,12 @@ import pytest from scipy import linalg -import anysolver.modal as modal_module -import anysolver.e4_pl_element as q4_element_module -import anysolver.e4_pl_s3_element as s3_element_module -import anysolver.e4_pl_s3_state as s3_state_module -import anysolver.matrix_assembly as matrix_assembly_module -from anysolver import ( +import anyfesolver.modal as modal_module +import anyfesolver.e4_pl_element as q4_element_module +import anyfesolver.e4_pl_s3_element as s3_element_module +import anyfesolver.e4_pl_s3_state as s3_state_module +import anyfesolver.matrix_assembly as matrix_assembly_module +from anyfesolver import ( AnalysisSession, BoundaryCondition, FEModel, @@ -23,37 +23,37 @@ solve_eigenvalue_buckling, solve_free_vibration, ) -from anysolver.boundary import LoadCase -from anysolver.control import CancellationToken -from anysolver.assembly import build_constraint_transformation -from anysolver.algebraic_dynamics import ( +from anyfesolver.boundary import LoadCase +from anyfesolver.control import CancellationToken +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.algebraic_dynamics import ( DESCRIPTOR_RAYLEIGH_REFINEMENT_POLICY_ID, ) -from anysolver.e4_pl_s3_element import ( +from anyfesolver.e4_pl_s3_element import ( REFERENCE_ELASTIC_BUBBLE_LINEARIZATION_ID, ) -from anysolver.e4_pl_s3_state import canonical_json_bytes -from anysolver.element_capabilities import ElementCapabilityError -from anysolver.elements import BeamElement, Element, ShellElement -from anysolver.linalg import FactorizationCache -from anysolver.matrix_assembly import ( +from anyfesolver.e4_pl_s3_state import canonical_json_bytes +from anyfesolver.element_capabilities import ElementCapabilityError +from anyfesolver.elements import BeamElement, Element, ShellElement +from anyfesolver.linalg import FactorizationCache +from anyfesolver.matrix_assembly import ( AssemblyError, assemble_geometric_stiffness_matrix, assemble_mass_matrix, assemble_stiffness_matrix, ) -from anysolver.modal import ( +from anyfesolver.modal import ( CURRENT_STATE_MODAL_POLICY_ID, PRESTRESSED_MODAL_POLICY_ID, PRESTRESS_INPUT_SCHEMA_ID, QUALIFIED_PRESTRESS_OPERATOR_AUTHORITY_POLICY_ID, ) -from anysolver.nonlinear_state import ( +from anyfesolver.nonlinear_state import ( NonlinearStateStore, create_model_native_rotation_store, discard_active_state_candidate, ) -from anysolver.shell_sections import GeneralizedShellSection +from anyfesolver.shell_sections import GeneralizedShellSection def _model() -> FEModel: @@ -711,7 +711,7 @@ def _committed_trial_force( assert native is not None store.attach_native_rotation_store(native) try: - from anysolver.nonlinear_static import _assemble_nonlinear_system + from anyfesolver.nonlinear_static import _assemble_nonlinear_system force, _tangent, _candidate = _assemble_nonlinear_system( model, diff --git a/tests/test_e4_pl_s3_q4_burnin_authority.py b/tests/test_e4_pl_s3_q4_burnin_authority.py index 7ee50a8a0..b2279a037 100644 --- a/tests/test_e4_pl_s3_q4_burnin_authority.py +++ b/tests/test_e4_pl_s3_q4_burnin_authority.py @@ -31,9 +31,9 @@ "519b24c97f7a3953457922aa08514efd59e5aacfc26843c1765988e79cc1842c" ) RESOURCE_MANAGER = Path(r"C:\Github\.resource-manager") -FINAL_FREEZE = Path(r"C:\Github\ANYsolver\.perf2-worktrees\s3-e4-pl-final-freeze") +FINAL_FREEZE = Path(r"C:\Github\ANYfeSolver\.perf2-worktrees\s3-e4-pl-final-freeze") ANYFEM_FREEZE = Path( - r"C:\Github\ANYsolver\.perf2-worktrees\anyfem-e4-pl-default-routing" + r"C:\Github\ANYfeSolver\.perf2-worktrees\anyfem-e4-pl-default-routing" ) CORRECTION_OUTPUT_ROOT = Path( r"C:\Users\AudunArnesenNyhus\AppData\Local\ANYrelease\s3-q4-final-freeze-correction-22" @@ -254,30 +254,30 @@ "docs/reference_cases/e4_pl_s3_mixed_mesh_qualification_contract.json", "docs/reference_cases/e4_pl_s3_mixed_mesh_smoke_input.json", "scripts/run_e4_pl_burnin_gate.py", - "src/anysolver/__init__.py", - "src/anysolver/_qualified_authority_epoch.py", - "src/anysolver/algebraic_dynamics.py", - "src/anysolver/arc_length.py", - "src/anysolver/assembly.py", - "src/anysolver/boundary.py", - "src/anysolver/buckling.py", - "src/anysolver/current_state_tangent.py", - "src/anysolver/dynamics.py", - "src/anysolver/e4_pl_element.py", - "src/anysolver/e4_pl_s3_element.py", - "src/anysolver/e4_pl_s3_state.py", - "src/anysolver/elements.py", - "src/anysolver/fe_core.py", - "src/anysolver/matrix_assembly.py", - "src/anysolver/modal.py", - "src/anysolver/nonlinear_performance.py", - "src/anysolver/nonlinear_restart.py", - "src/anysolver/nonlinear_state.py", - "src/anysolver/nonlinear_static.py", - "src/anysolver/recovery.py", - "src/anysolver/recovery_batches.py", - "src/anysolver/s3_reference_batch.py", - "src/anysolver/shell_sections.py", + "src/anyfesolver/__init__.py", + "src/anyfesolver/_qualified_authority_epoch.py", + "src/anyfesolver/algebraic_dynamics.py", + "src/anyfesolver/arc_length.py", + "src/anyfesolver/assembly.py", + "src/anyfesolver/boundary.py", + "src/anyfesolver/buckling.py", + "src/anyfesolver/current_state_tangent.py", + "src/anyfesolver/dynamics.py", + "src/anyfesolver/e4_pl_element.py", + "src/anyfesolver/e4_pl_s3_element.py", + "src/anyfesolver/e4_pl_s3_state.py", + "src/anyfesolver/elements.py", + "src/anyfesolver/fe_core.py", + "src/anyfesolver/matrix_assembly.py", + "src/anyfesolver/modal.py", + "src/anyfesolver/nonlinear_performance.py", + "src/anyfesolver/nonlinear_restart.py", + "src/anyfesolver/nonlinear_state.py", + "src/anyfesolver/nonlinear_static.py", + "src/anyfesolver/recovery.py", + "src/anyfesolver/recovery_batches.py", + "src/anyfesolver/s3_reference_batch.py", + "src/anyfesolver/shell_sections.py", "tests/test_e4_pl_burnin.py", "tests/test_e4_pl_component_snapshot_integrity.py", "tests/test_e4_pl_current_state_input_ownership.py", @@ -326,17 +326,17 @@ "docs/reference_cases/e4_pl_s3_q4_cycle1_rejected_resource_status.json", ] CORRECTION_PATHS = [ - "src/anysolver/current_state_tangent.py", - "src/anysolver/recovery.py", - "src/anysolver/s4_validity.py", + "src/anyfesolver/current_state_tangent.py", + "src/anyfesolver/recovery.py", + "src/anyfesolver/s4_validity.py", "tests/test_e4_pl_guarded_observations.py", "tests/test_material_history_recovery.py", "tests/test_nonlinear_static_state_lifecycle.py", "tests/test_production_validation.py", ] RUNTIME_EFFICIENCY_CORRECTION_PATHS = [ - "src/anysolver/matrix_assembly.py", - "src/anysolver/nonlinear_static.py", + "src/anyfesolver/matrix_assembly.py", + "src/anyfesolver/nonlinear_static.py", "tests/test_e4_pl_orchestrator_operation_lease.py", "tests/test_qualified_mutation_epoch.py", ] @@ -1072,7 +1072,7 @@ def test_contract_is_canonical_and_binds_all_local_inputs() -> None: "src/anyfileio/__pycache__/cad.cpython-313.pyc", ], "repository": ( - r"C:\Github\ANYsolver\.perf2-worktrees\s3-q4-anyfileio-9b1e5ad" + r"C:\Github\ANYfeSolver\.perf2-worktrees\s3-q4-anyfileio-9b1e5ad" ), }, "lane": "quick", @@ -2007,9 +2007,9 @@ def test_candidate_chain_and_authority_extent_are_exact() -> None: ( contract["candidate_chain"]["recovery_efficiency_correction"], [ - "src/anysolver/assembly.py", - "src/anysolver/matrix_assembly.py", - "src/anysolver/recovery_batches.py", + "src/anyfesolver/assembly.py", + "src/anyfesolver/matrix_assembly.py", + "src/anyfesolver/recovery_batches.py", "tests/test_qualified_mutation_epoch.py", ], ), @@ -2020,17 +2020,17 @@ def test_candidate_chain_and_authority_extent_are_exact() -> None: ( contract["candidate_chain"]["prestress_efficiency_correction"], [ - "src/anysolver/buckling.py", - "src/anysolver/matrix_assembly.py", - "src/anysolver/modal.py", + "src/anyfesolver/buckling.py", + "src/anyfesolver/matrix_assembly.py", + "src/anyfesolver/modal.py", "tests/test_e4_pl_s3_prestressed_modal_buckling.py", ], ), ( contract["candidate_chain"]["mixed_prestress_efficiency_correction"], [ - "src/anysolver/matrix_assembly.py", - "src/anysolver/modal.py", + "src/anyfesolver/matrix_assembly.py", + "src/anyfesolver/modal.py", "tests/test_e4_pl_s3_prestressed_modal_buckling.py", ], ), @@ -2515,7 +2515,7 @@ def test_functional_wave_is_exact_staged_parallel_and_hard_bounded() -> None: "FINAL_RESULT_VALIDATION", ] assert contract["execution"]["clean_status_scope"] == [ - "ANYsolver", + "ANYfeSolver", "ANYfem", "ANYfileIO", "ANYgeometry", @@ -4077,7 +4077,7 @@ def test_v18_shard_environment_discards_barrier_and_inner_wave_controls( monkeypatch.setenv("PYTHONPATH", "") roots = { name: tmp_path / name - for name in ("ANYmesh", "ANYgeometry", "ANYmaterial", "ANYfileIO", "ANYsolver") + for name in ("ANYmesh", "ANYgeometry", "ANYmaterial", "ANYfileIO", "ANYfeSolver") } monkeypatch.setattr(gate, "_local_roots", lambda: dict(roots)) monkeypatch.setattr(gate, "_write_source_metadata_overlay", lambda *_args: None) @@ -5435,7 +5435,7 @@ def test_failed_acquisition_job_close_prevents_request_consumption( monkeypatch.setattr( process_runner.burnin, "external_repository_paths", - lambda _contract: {"ANYsolver": candidate}, + lambda _contract: {"ANYfeSolver": candidate}, ) monkeypatch.setattr(process_runner, "_manager_paths", lambda _contract: manager) monkeypatch.setattr( @@ -6572,7 +6572,7 @@ def test_resource_state_machine_order_and_finalizer_prefixes_are_frozen( assert scope_iteration < complete_clean_probe < named_repository < candidate_authority # Canonical JSON sorts repository keys, while the frozen clean-status scope - # deliberately starts with ANYsolver. Runtime verification must therefore + # deliberately starts with ANYfeSolver. Runtime verification must therefore # select repositories by scope name instead of trusting mapping insertion order. scope = contract["execution"]["clean_status_scope"] repository_root = tmp_path / "repositories" @@ -6585,7 +6585,7 @@ def test_resource_state_machine_order_and_finalizer_prefixes_are_frozen( assert list(canonical_repositories) != scope clean_probes: list[Path] = [] - monkeypatch.setattr(process_runner, "ROOT", canonical_repositories["ANYsolver"]) + monkeypatch.setattr(process_runner, "ROOT", canonical_repositories["ANYfeSolver"]) monkeypatch.setattr(process_runner, "_verify_local_runner_inputs", lambda _contract: None) monkeypatch.setattr( process_runner.burnin, @@ -6623,7 +6623,7 @@ def sibling_git(path: Path, *args: str, contract: dict[str, object]) -> str: monkeypatch.setattr(process_runner.burnin, "_git", sibling_git) candidate, siblings, head, tree = process_runner._verify_repositories(contract) - assert candidate == canonical_repositories["ANYsolver"] + assert candidate == canonical_repositories["ANYfeSolver"] assert siblings == { name: canonical_repositories[name] for name in contract["sibling_authority"] } @@ -7176,7 +7176,7 @@ def test_package_artifacts_are_revalidated_before_approval_and_consumption( candidate = {"commit": "a" * 40, "tree": "b" * 40} package = _valid_package_result(contract) expected_sources = { - "ANYsolver": candidate, + "ANYfeSolver": candidate, **{ name: authority for name, authority in contract["sibling_authority"].items() @@ -7186,7 +7186,7 @@ def test_package_artifacts_are_revalidated_before_approval_and_consumption( for name, authority in expected_sources.items(): package["sources"][name]["commit"] = authority["commit"] package["sources"][name]["tree"] = authority["tree"] - package["wheels"]["ANYsolver"] = { + package["wheels"]["ANYfeSolver"] = { "bytes": len(wheel_bytes), "filename": wheel_path.name, "sha256": hashlib.sha256(wheel_bytes).hexdigest(), diff --git a/tests/test_e4_pl_s3_qv9_v1_nogo_closeout.py b/tests/test_e4_pl_s3_qv9_v1_nogo_closeout.py index a57570bb2..3e4d3c081 100644 --- a/tests/test_e4_pl_s3_qv9_v1_nogo_closeout.py +++ b/tests/test_e4_pl_s3_qv9_v1_nogo_closeout.py @@ -9,7 +9,7 @@ ROOT = Path(__file__).resolve().parents[1] REFERENCE = ROOT / "docs" / "reference_cases" PLAN = ROOT / "docs" / "agent_plans" / "S3_E4_PL_V2_FORMULATION_PLAN.md" -ELEMENTS = ROOT / "src" / "anysolver" / "elements.py" +ELEMENTS = ROOT / "src" / "anyfesolver" / "elements.py" def _load_canonical(path: Path) -> tuple[dict[str, object], bytes]: diff --git a/tests/test_e4_pl_s3_reference_batch.py b/tests/test_e4_pl_s3_reference_batch.py index eeb37fff4..a6b549670 100644 --- a/tests/test_e4_pl_s3_reference_batch.py +++ b/tests/test_e4_pl_s3_reference_batch.py @@ -18,29 +18,29 @@ import numpy as np import pytest -import anysolver.matrix_assembly as matrix_assembly_module -import anysolver.e4_pl_s3_element as s3_element_module -import anysolver.s3_reference_batch as s3_batch_module -from anysolver.assembly import ( +import anyfesolver.matrix_assembly as matrix_assembly_module +import anyfesolver.e4_pl_s3_element as s3_element_module +import anyfesolver.s3_reference_batch as s3_batch_module +from anyfesolver.assembly import ( compute_constraint_force_diagnostics, compute_reactions, ) -from anysolver.activity import ElementActivity -from anysolver.boundary import LoadCase -from anysolver.e4_pl_element import QualifiedE4PLShellElement -from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement -from anysolver.fe_core import FEModel, FEMesh -from anysolver.matrix_assembly import AssemblyError, assemble_stiffness_matrix -from anysolver.materials import Hill48Yield -from anysolver.recovery import ( +from anyfesolver.activity import ElementActivity +from anyfesolver.boundary import LoadCase +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement +from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement +from anyfesolver.fe_core import FEModel, FEMesh +from anyfesolver.matrix_assembly import AssemblyError, assemble_stiffness_matrix +from anyfesolver.materials import Hill48Yield +from anyfesolver.recovery import ( RecoveryConfig, ResourceConfig, _compute_one_element_stress, recover_element_stresses_with_report, recover_stress_result, ) -from anysolver.recovery_batches import get_recovery_batch_plan -from anysolver.s3_reference_batch import ( +from anyfesolver.recovery_batches import get_recovery_batch_plan +from anyfesolver.s3_reference_batch import ( MIN_REFERENCE_S3_RECOVERY_GROUP, REFERENCE_S3_BATCH_POLICY_ID, REFERENCE_S3_FORMULATION_ID, @@ -48,7 +48,7 @@ prepare_reference_s3_components, reference_s3_eligibility, ) -from anysolver.shell_sections import GeneralizedShellSection +from anyfesolver.shell_sections import GeneralizedShellSection def _build_model( @@ -1395,7 +1395,7 @@ def test_committed_state_recovery_stays_outside_reference_batch( def forbidden(*_args, **_kwargs): raise AssertionError("committed recovery entered the reference-elastic batch") - monkeypatch.setattr("anysolver.recovery.recover_reference_s3", forbidden) + monkeypatch.setattr("anyfesolver.recovery.recover_reference_s3", forbidden) result = recover_stress_result( model, vector, diff --git a/tests/test_e4_pl_s3_reference_surface_offset.py b/tests/test_e4_pl_s3_reference_surface_offset.py index b31ff922f..7f6428cbe 100644 --- a/tests/test_e4_pl_s3_reference_surface_offset.py +++ b/tests/test_e4_pl_s3_reference_surface_offset.py @@ -6,7 +6,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, FEModel, FixedSupport, @@ -18,18 +18,18 @@ solve_eigenvalue_buckling, solve_free_vibration, ) -from anysolver._native_rotation_state import create_native_rotation_state_store -from anysolver.contact import SphereContactConfig, _surface_offset -from anysolver.e4_pl_s3_element import ( +from anyfesolver._native_rotation_state import create_native_rotation_state_store +from anyfesolver.contact import SphereContactConfig, _surface_offset +from anyfesolver.e4_pl_s3_element import ( REFERENCE_ELASTIC_BUBBLE_LINEARIZATION_ID, ) -from anysolver.e4_pl_s3_state import ( +from anyfesolver.e4_pl_s3_state import ( REFERENCE_SURFACE_MASS_SHIFT_ID, REFERENCE_SURFACE_OFFSET_POLICY_ID, REFERENCE_SURFACE_STRAIN_TRANSFORM_ID, S3CommittedStateError, ) -from anysolver.shell_sections import GeneralizedShellSection +from anyfesolver.shell_sections import GeneralizedShellSection REFERENCE = np.asarray( diff --git a/tests/test_e4_pl_s3_restart_history.py b/tests/test_e4_pl_s3_restart_history.py index bffd90e3c..8fc6bb41d 100644 --- a/tests/test_e4_pl_s3_restart_history.py +++ b/tests/test_e4_pl_s3_restart_history.py @@ -5,17 +5,17 @@ import numpy as np import pytest -from anysolver.arc_length import ArcLengthControl, solve_static_arc_length -from anysolver.boundary import BoundaryCondition, FixedSupport, LoadCase -from anysolver.e4_pl_element import QualifiedE4PLShellElement -from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement -from anysolver.e4_pl_s3_state import ( +from anyfesolver.arc_length import ArcLengthControl, solve_static_arc_length +from anyfesolver.boundary import BoundaryCondition, FixedSupport, LoadCase +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement +from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement +from anyfesolver.e4_pl_s3_state import ( canonical_json_bytes, strict_canonical_json_loads, ) -from anysolver.fe_core import FEModel -from anysolver.material_curves import LinearHardeningCurve -from anysolver.nonlinear_static import ( +from anyfesolver.fe_core import FEModel +from anyfesolver.material_curves import LinearHardeningCurve +from anyfesolver.nonlinear_static import ( NonlinearLoadProgram, NonlinearLoadStage, solve_static_nonlinear, diff --git a/tests/test_e4_pl_s3_shared_rotation_kinematics.py b/tests/test_e4_pl_s3_shared_rotation_kinematics.py index 90e267550..c7eb7e258 100644 --- a/tests/test_e4_pl_s3_shared_rotation_kinematics.py +++ b/tests/test_e4_pl_s3_shared_rotation_kinematics.py @@ -5,12 +5,12 @@ import numpy as np import pytest -import anysolver.e4_pl_s3_element as s3 -from anysolver._native_rotation_state import ( +import anyfesolver.e4_pl_s3_element as s3 +from anyfesolver._native_rotation_state import ( create_native_rotation_state_store, rotation_exponential, ) -from anysolver.e4_pl_s3_state import reconstruct_director_triad +from anyfesolver.e4_pl_s3_state import reconstruct_director_triad from _e4_pl_s3_native_trial import native_trial_for_increment diff --git a/tests/test_e4_pl_s3_state_lifecycle.py b/tests/test_e4_pl_s3_state_lifecycle.py index 5c5477aa9..d91891f50 100644 --- a/tests/test_e4_pl_s3_state_lifecycle.py +++ b/tests/test_e4_pl_s3_state_lifecycle.py @@ -7,10 +7,10 @@ import numpy as np import pytest -import anysolver.e4_pl_s3_element as s3_module -import anysolver.nonlinear_performance as nonlinear_performance -import anysolver.nonlinear_static as nonlinear_static -from anysolver import ( +import anyfesolver.e4_pl_s3_element as s3_module +import anyfesolver.nonlinear_performance as nonlinear_performance +import anyfesolver.nonlinear_static as nonlinear_static +from anyfesolver import ( FEModel, QualifiedE4PLS3ShellElement, QualifiedE4PLShellElement, @@ -18,16 +18,16 @@ solve_free_vibration, solve_static_nonlinear, ) -from anysolver.boundary import BoundaryCondition, FixedSupport, LoadCase -from anysolver.e4_pl_s3_state import canonical_json_bytes, seal_committed_s3_state -from anysolver.element_capabilities import ElementCapabilityError -from anysolver.fracture import FractureConfig -from anysolver.nonlinear_restart import ( +from anyfesolver.boundary import BoundaryCondition, FixedSupport, LoadCase +from anyfesolver.e4_pl_s3_state import canonical_json_bytes, seal_committed_s3_state +from anyfesolver.element_capabilities import ElementCapabilityError +from anyfesolver.fracture import FractureConfig +from anyfesolver.nonlinear_restart import ( NonlinearCheckpointError, canonical_checkpoint_json_bytes, create_nonlinear_checkpoint, ) -from anysolver.nonlinear_static import ShellInitialField +from anyfesolver.nonlinear_static import ShellInitialField def _pure_s3_model() -> tuple[FEModel, LoadCase, int]: diff --git a/tests/test_e4_pl_s3_state_schema_closure.py b/tests/test_e4_pl_s3_state_schema_closure.py index 59f4c518d..7316836b4 100644 --- a/tests/test_e4_pl_s3_state_schema_closure.py +++ b/tests/test_e4_pl_s3_state_schema_closure.py @@ -9,8 +9,8 @@ import pytest from anymaterial import Hill48Yield, OrthotropicMaterial -import anysolver.e4_pl_s3_state as state_module -from anysolver.e4_pl_s3_state import ( +import anyfesolver.e4_pl_s3_state as state_module +from anyfesolver.e4_pl_s3_state import ( BUBBLE_PREDICTOR_COMMIT_POLICY_ID, GENERALIZED_RESULTANT_COMPONENT_ORDER, GENERALIZED_STRAIN_COMPONENT_ORDER, @@ -38,7 +38,7 @@ stiffness_station_table_fingerprint, validate_committed_s3_state, ) -from anysolver.fe_core import Material +from anyfesolver.fe_core import Material ELEMENT_ID = 41 diff --git a/tests/test_e4_pl_s3_transient_algebraic.py b/tests/test_e4_pl_s3_transient_algebraic.py index e7e5573fe..ac7a6ad2e 100644 --- a/tests/test_e4_pl_s3_transient_algebraic.py +++ b/tests/test_e4_pl_s3_transient_algebraic.py @@ -6,7 +6,7 @@ import pytest from scipy import sparse -from anysolver import ( +from anyfesolver import ( AnalysisSession, BoundaryCondition, FEModel, @@ -18,7 +18,7 @@ TransientConfig, solve_transient_newmark, ) -from anysolver.algebraic_dynamics import ( +from anyfesolver.algebraic_dynamics import ( AlgebraicDynamicsError, DESCRIPTOR_TRANSIENT_CONSTRAINED_POLICY_ID, DESCRIPTOR_TRANSIENT_FIRST_ORDER_POLICY_ID, @@ -29,15 +29,15 @@ build_declared_algebraic_basis, certify_descriptor_effective_operator, ) -from anysolver.assembly import build_constraint_transformation -from anysolver.dynamics import _sampled_grid_derivative -from anysolver.matrix_assembly import ( +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.dynamics import _sampled_grid_derivative +from anyfesolver.matrix_assembly import ( assemble_load_vector, assemble_mass_matrix, assemble_stiffness_matrix, ) -from anysolver.linalg import FactorizationHandle, MatrixClass -from anysolver.recovery import RecoveryConfig +from anyfesolver.linalg import FactorizationHandle, MatrixClass +from anyfesolver.recovery import RecoveryConfig @dataclass(frozen=True) @@ -712,7 +712,7 @@ def test_static_reduction_rejects_nonsymmetric_descriptor_inputs( def test_static_reduction_wraps_construction_pivot_solve_failure( monkeypatch: pytest.MonkeyPatch, ) -> None: - import anysolver.algebraic_dynamics as algebraic_module + import anyfesolver.algebraic_dynamics as algebraic_module original = algebraic_module.sparse_linalg.splu call_count = 0 @@ -735,7 +735,7 @@ def adversarial_splu(matrix, *args, **kwargs): def test_sparse_pivot_matching_is_invariant_to_internal_index_order() -> None: - import anysolver.algebraic_dynamics as algebraic_module + import anyfesolver.algebraic_dynamics as algebraic_module row_count = 520 dense = np.zeros((row_count, 3), dtype=float) @@ -859,7 +859,7 @@ def test_descriptor_transient_rejects_a_nonfinite_pressure_history() -> None: def test_descriptor_effective_factorization_failure_never_uses_general_fallback( monkeypatch: pytest.MonkeyPatch, ) -> None: - import anysolver.dynamics as dynamics_module + import anyfesolver.dynamics as dynamics_module model = _single_s3_model(coupled=True) original = dynamics_module.factorize @@ -1263,7 +1263,7 @@ def test_constrained_s3_factor_failures_are_canonical_and_never_fall_back( failed_signature: str, message: str, ) -> None: - import anysolver.dynamics as dynamics_module + import anyfesolver.dynamics as dynamics_module model = _single_s3_model(coupled=False) model.add_boundary_condition( diff --git a/tests/test_e4_pl_s3_v2_authority.py b/tests/test_e4_pl_s3_v2_authority.py index 94de7f375..64b0c8d9b 100644 --- a/tests/test_e4_pl_s3_v2_authority.py +++ b/tests/test_e4_pl_s3_v2_authority.py @@ -156,16 +156,16 @@ def test_successor_binds_exact_base_predecessors_and_defaults() -> None: assert authority["q4_mechanics_change_authorized"] is False assert authority["historical_evidence_mutation_authorized"] is False - elements = (ROOT / "src" / "anysolver" / "elements.py").read_text(encoding="utf-8") + elements = (ROOT / "src" / "anyfesolver" / "elements.py").read_text(encoding="utf-8") q4 = re.search(r'^DEFAULT_Q4_FORMULATION = "([^"]+)"$', elements, re.MULTILINE) s3 = re.search(r'^DEFAULT_S3_FORMULATION = "([^"]+)"$', elements, re.MULTILINE) assert q4 is not None and q4.group(1) == "e4-pl" assert s3 is not None and s3.group(1) == "legacy-s3" assert 'FORMULATION_ID = "E4_PL_QUALIFIED_Q4_HYBRID_V2"' in ( - ROOT / "src" / "anysolver" / "e4_pl_element.py" + ROOT / "src" / "anyfesolver" / "e4_pl_element.py" ).read_text(encoding="utf-8") assert 'FORMULATION_ID = "E4_PL_QUALIFIED_S3_COMPANION_V1"' in ( - ROOT / "src" / "anysolver" / "e4_pl_s3_state.py" + ROOT / "src" / "anyfesolver" / "e4_pl_s3_state.py" ).read_text(encoding="utf-8") diff --git a/tests/test_e4_pl_s3_v2_candidate_binding.py b/tests/test_e4_pl_s3_v2_candidate_binding.py index c57a4b659..ee6fa9e65 100644 --- a/tests/test_e4_pl_s3_v2_candidate_binding.py +++ b/tests/test_e4_pl_s3_v2_candidate_binding.py @@ -8,12 +8,12 @@ import pytest -from anysolver.e4_pl_s3_v2_element import ( +from anyfesolver.e4_pl_s3_v2_element import ( FORMULATION_ID, IMPLEMENTATION_ID, SELECTOR, ) -from anysolver.elements import DEFAULT_Q4_FORMULATION, DEFAULT_S3_FORMULATION +from anyfesolver.elements import DEFAULT_Q4_FORMULATION, DEFAULT_S3_FORMULATION ROOT = Path(__file__).resolve().parents[1] diff --git a/tests/test_e4_pl_s3_v2_component_cache.py b/tests/test_e4_pl_s3_v2_component_cache.py index e885c0607..73b0a477f 100644 --- a/tests/test_e4_pl_s3_v2_component_cache.py +++ b/tests/test_e4_pl_s3_v2_component_cache.py @@ -12,13 +12,13 @@ import numpy as np import pytest -import anysolver.e4_pl_s3_v2_element as candidate_module -from anysolver.e4_pl_s3_v2_element import ( +import anyfesolver.e4_pl_s3_v2_element as candidate_module +from anyfesolver.e4_pl_s3_v2_element import ( StrictFlatLinearCapabilityError, StrictFlatLinearE4PLS3V2ShellElement, ) -from anysolver.elements import ShellElement -from anysolver.fe_core import FEMesh, Material +from anyfesolver.elements import ShellElement +from anyfesolver.fe_core import FEMesh, Material NORMAL = np.asarray((0.0, 0.0, 1.0), dtype=np.float64) @@ -259,8 +259,8 @@ def test_two_fresh_processes_have_one_cold_compute_and_identical_hits( import json import sys import numpy as np -from anysolver.e4_pl_s3_v2_element import StrictFlatLinearE4PLS3V2ShellElement -from anysolver.fe_core import FEMesh, Material +from anyfesolver.e4_pl_s3_v2_element import StrictFlatLinearE4PLS3V2ShellElement +from anyfesolver.fe_core import FEMesh, Material mesh = FEMesh() for node_id, coordinate in enumerate(((0.0, 0.0, 0.0), (1.8125, 0.0625, 0.0), (0.3125, 1.5625, 0.0)), 1): @@ -313,8 +313,8 @@ def test_content_key_eviction_is_bounded_and_insertion_order_independent( import inspect import json import sys -from anysolver.e4_pl_s3_v2_element import StrictFlatLinearE4PLS3V2ShellElement -from anysolver.fe_core import FEMesh, Material +from anyfesolver.e4_pl_s3_v2_element import StrictFlatLinearE4PLS3V2ShellElement +from anyfesolver.fe_core import FEMesh, Material order = range(514) if sys.argv[1] == "forward" else range(513, -1, -1) material = Material("steel", 210.0e9, 0.3, density=7850.0) diff --git a/tests/test_e4_pl_s3_v2_flat_funnel.py b/tests/test_e4_pl_s3_v2_flat_funnel.py index 611014a44..47cd0209d 100644 --- a/tests/test_e4_pl_s3_v2_flat_funnel.py +++ b/tests/test_e4_pl_s3_v2_flat_funnel.py @@ -278,7 +278,7 @@ def test_harness_is_standard_library_planning_only() -> None: "pathlib", "typing", } - assert "anysolver" not in imports + assert "anyfesolver" not in imports assert "numpy" not in imports assert "scipy" not in imports assert "sympy" not in imports @@ -334,7 +334,7 @@ def changed() -> dict: del changed()["candidate"]["flat_candidate_id"] changed()["candidate"]["final_formulation_id"] = "MUTATED" changed()["candidate"]["v1_fallback_forbidden"] = False - changed()["frozen_inputs"]["anysolver_base"]["commit"] = "0" * 40 + changed()["frozen_inputs"]["anyfesolver_base"]["commit"] = "0" * 40 changed()["frozen_inputs"]["historical_qv9"]["v1_nogo_result_sha256"] = "0" * 64 changed()["phase_funnel"]["4A"]["masks"] = ["dispersed"] changed()["phase_funnel"]["4B"]["levels"] = [20, 40] diff --git a/tests/test_e4_pl_s3_v2_flat_funnel_checker.py b/tests/test_e4_pl_s3_v2_flat_funnel_checker.py index a79dd5062..035cd447b 100644 --- a/tests/test_e4_pl_s3_v2_flat_funnel_checker.py +++ b/tests/test_e4_pl_s3_v2_flat_funnel_checker.py @@ -178,7 +178,7 @@ def _rewrite(path: Path, value: dict[str, object]) -> None: path.write_bytes(funnel.canonical_bytes(value)) -def test_checker_is_independent_of_producer_and_anysolver_mechanics() -> None: +def test_checker_is_independent_of_producer_and_anyfesolver_mechanics() -> None: tree = ast.parse(PROGRAM.read_text(encoding="utf-8")) imported = { node.module @@ -191,7 +191,7 @@ def test_checker_is_independent_of_producer_and_anysolver_mechanics() -> None: if isinstance(node, ast.Import) for alias in node.names ) - assert not any(name.startswith("anysolver") for name in imported) + assert not any(name.startswith("anyfesolver") for name in imported) assert not any("producer" in name for name in imported) diff --git a/tests/test_e4_pl_s3_v2_flat_funnel_producer.py b/tests/test_e4_pl_s3_v2_flat_funnel_producer.py index 0bcc250c7..fc70fc736 100644 --- a/tests/test_e4_pl_s3_v2_flat_funnel_producer.py +++ b/tests/test_e4_pl_s3_v2_flat_funnel_producer.py @@ -50,9 +50,9 @@ def _plan(tmp_path: Path) -> tuple[Path, dict[str, object]]: def _tiny_q4_model() -> tuple[object, dict[int, str]]: - from anysolver.boundary import LoadCase - from anysolver.elements import create_shell_element - from anysolver.fe_core import FEModel + from anyfesolver.boundary import LoadCase + from anyfesolver.elements import create_shell_element + from anyfesolver.fe_core import FEModel level = 2 model = FEModel("tiny-phase4a-q4") @@ -105,8 +105,8 @@ def _tiny_q4_model() -> tuple[object, dict[int, str]]: def _tiny_mixed_model() -> tuple[object, list[object], object]: - from anysolver.elements import create_shell_element - from anysolver.fe_core import FEModel + from anyfesolver.elements import create_shell_element + from anyfesolver.fe_core import FEModel model = FEModel("tiny-phase4a-qualified-q4-v2a") model.add_material( @@ -851,7 +851,7 @@ def test_candidate_archive_must_exactly_match_extracted_source( tmp_path: Path, monkeypatch: pytest.MonkeyPatch ) -> None: candidate = tmp_path / "candidate-source" - package = candidate / "src" / "anysolver" + package = candidate / "src" / "anyfesolver" package.mkdir(parents=True) source = b'FORMULATION = "S3_V2A"\n' (package / "__init__.py").write_bytes(source) @@ -861,11 +861,11 @@ def test_candidate_archive_must_exactly_match_extracted_source( generator.write_bytes(generator_source) archive = tmp_path / "candidate-source.tar" with tarfile.open(archive, mode="w:") as bundle: - for name in ("src", "src/anysolver", "docs", "docs/reference_cases"): + for name in ("src", "src/anyfesolver", "docs", "docs/reference_cases"): directory = tarfile.TarInfo(name) directory.type = tarfile.DIRTYPE bundle.addfile(directory) - member = tarfile.TarInfo("src/anysolver/__init__.py") + member = tarfile.TarInfo("src/anyfesolver/__init__.py") member.size = len(source) bundle.addfile(member, io.BytesIO(source)) member = tarfile.TarInfo( diff --git a/tests/test_e4_pl_s3_v2_independent_reference.py b/tests/test_e4_pl_s3_v2_independent_reference.py index 6aeb372c5..4106ac585 100644 --- a/tests/test_e4_pl_s3_v2_independent_reference.py +++ b/tests/test_e4_pl_s3_v2_independent_reference.py @@ -285,8 +285,8 @@ def test_independent_modules_have_no_solver_or_production_imports() -> None: elif isinstance(node, ast.ImportFrom) and node.module: imports.add(node.module.split(".", 1)[0]) assert imports <= allowed_roots - assert "from anysolver" not in source - assert "import anysolver" not in source + assert "from anyfesolver" not in source + assert "import anyfesolver" not in source checker_source = CHECKER_PATH.read_text(encoding="utf-8") checker_tree = ast.parse(checker_source) diff --git a/tests/test_e4_pl_s3_v2_mixed_scope.py b/tests/test_e4_pl_s3_v2_mixed_scope.py index 595ca0d67..3fd412fd7 100644 --- a/tests/test_e4_pl_s3_v2_mixed_scope.py +++ b/tests/test_e4_pl_s3_v2_mixed_scope.py @@ -5,16 +5,16 @@ import numpy as np import pytest -from anysolver.e4_pl_element import QualifiedE4PLShellElement -from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement -from anysolver.e4_pl_s3_v2_element import ( +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement +from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement +from anyfesolver.e4_pl_s3_v2_element import ( BLOCKED_OPERATIONS, SUPPORTED_OPERATIONS, StrictFlatLinearCapabilityError, StrictFlatLinearE4PLS3V2ShellElement, ) -from anysolver.elements import BeamElement, ShellElement -from anysolver.fe_core import FEMesh, Material +from anyfesolver.elements import BeamElement, ShellElement +from anyfesolver.fe_core import FEMesh, Material NORMAL = np.asarray((0.0, 0.0, 1.0), dtype=np.float64) diff --git a/tests/test_e4_pl_s3_v2_production.py b/tests/test_e4_pl_s3_v2_production.py index 5782c777a..d3de2ad46 100644 --- a/tests/test_e4_pl_s3_v2_production.py +++ b/tests/test_e4_pl_s3_v2_production.py @@ -9,12 +9,12 @@ import numpy as np import pytest -import anysolver -from anysolver.boundary import LoadCase -from anysolver.e4_pl_element import QualifiedE4PLShellElement -from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement -from anysolver.element_capabilities import ElementCapabilityError -from anysolver.e4_pl_s3_v2_element import ( +import anyfesolver +from anyfesolver.boundary import LoadCase +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement +from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement +from anyfesolver.element_capabilities import ElementCapabilityError +from anyfesolver.e4_pl_s3_v2_element import ( EQUATION_MAP_SHA256, FORMULATION_ID, HAMMER_POINTS, @@ -26,7 +26,7 @@ _ALLOWED_INHERITED_CALLABLES, _SEALED_INHERITED_CALLABLES, ) -from anysolver.elements import ( +from anyfesolver.elements import ( BeamElement, DEFAULT_Q4_FORMULATION, DEFAULT_S3_FORMULATION, @@ -38,8 +38,8 @@ shell_element_from_dict, shell_formulation_diagnostics, ) -from anysolver.fe_core import FEModel, FEMesh, Material -from anysolver.matrix_assembly import ( +from anyfesolver.fe_core import FEModel, FEMesh, Material +from anyfesolver.matrix_assembly import ( assemble_external_load_tangent, assemble_load_vector, ) @@ -219,12 +219,12 @@ def test_explicit_selector_preserves_every_existing_default_and_q4_route() -> No def test_authority_identity_and_fixed_hammer_rule_are_exact() -> None: assert issubclass(StrictFlatLinearCapabilityError, ElementCapabilityError) - assert anysolver.StrictFlatLinearE4PLS3V2ShellElement is ( + assert anyfesolver.StrictFlatLinearE4PLS3V2ShellElement is ( StrictFlatLinearE4PLS3V2ShellElement ) - assert anysolver.STRICT_FLAT_S3_V2_FORMULATION_ID == FORMULATION_ID - assert anysolver.STRICT_FLAT_S3_V2_IMPLEMENTATION_ID == IMPLEMENTATION_ID - assert anysolver.STRICT_FLAT_S3_V2_SELECTOR == "e4-pl-s3-v2" + assert anyfesolver.STRICT_FLAT_S3_V2_FORMULATION_ID == FORMULATION_ID + assert anyfesolver.STRICT_FLAT_S3_V2_IMPLEMENTATION_ID == IMPLEMENTATION_ID + assert anyfesolver.STRICT_FLAT_S3_V2_SELECTOR == "e4-pl-s3-v2" assert FORMULATION_ID == "CANDIDATE_E4_PL_S3_V2A_FLAT_LINEAR_V1" assert IMPLEMENTATION_ID == "E4_PL_S3_V2_DKMT_EQ12_41_CST_PL_HAMMER3_V1" assert SOURCE_CONTRACT_SHA256 == ( @@ -693,7 +693,7 @@ def test_candidate_instance_and_module_authority_fail_closed(monkeypatch) -> Non lambda unused_self, unused_material: {}, ) - import anysolver.e4_pl_s3_v2_element as candidate_module + import anyfesolver.e4_pl_s3_v2_element as candidate_module monkeypatch.setattr(candidate_module, "_validate_module_authority", lambda: None) monkeypatch.setattr(candidate_module, "SHEAR_CORRECTION", 0.0) @@ -719,7 +719,7 @@ def test_candidate_instance_and_module_authority_fail_closed(monkeypatch) -> Non with pytest.raises(TypeError): object.__setattr__(element, "__class__", ShellElement) - import anysolver.elements as elements_module + import anyfesolver.elements as elements_module monkeypatch.setattr( elements_module, diff --git a/tests/test_e4_pl_s3_v2_production_reference.py b/tests/test_e4_pl_s3_v2_production_reference.py index 17eedc16b..d63ed76cc 100644 --- a/tests/test_e4_pl_s3_v2_production_reference.py +++ b/tests/test_e4_pl_s3_v2_production_reference.py @@ -16,10 +16,10 @@ import numpy as np -from anysolver.e4_pl_s3_v2_element import ( +from anyfesolver.e4_pl_s3_v2_element import ( StrictFlatLinearE4PLS3V2ShellElement, ) -from anysolver.fe_core import FEMesh, Material +from anyfesolver.fe_core import FEMesh, Material REFERENCE_PATH = ( diff --git a/tests/test_e4_pl_s3_v2_stage4a_authority.py b/tests/test_e4_pl_s3_v2_stage4a_authority.py index 1b2c83067..8c963d3d9 100644 --- a/tests/test_e4_pl_s3_v2_stage4a_authority.py +++ b/tests/test_e4_pl_s3_v2_stage4a_authority.py @@ -136,9 +136,9 @@ def test_stage4a_authority_preserves_defaults_and_mechanics_boundaries(authority extent = authority["allowed_extent"] assert extent["q4_or_v1_mechanics_change_authorized"] is False assert extent["v2_matrix_or_equation_change_authorized"] is False - assert "src/anysolver/e4_pl_element.py" not in extent["implementation_paths"] - assert "src/anysolver/e4_pl_s3_element.py" not in extent["implementation_paths"] - assert "src/anysolver/boundary.py" not in extent["implementation_paths"] + assert "src/anyfesolver/e4_pl_element.py" not in extent["implementation_paths"] + assert "src/anyfesolver/e4_pl_s3_element.py" not in extent["implementation_paths"] + assert "src/anyfesolver/boundary.py" not in extent["implementation_paths"] assert "tests/test_e4_pl_s3_v2_component_cache.py" in extent["implementation_paths"] @@ -850,7 +850,7 @@ def test_stage4a_correction7_dependency_authority_is_exact(authority) -> None: "commit": "de2be5819dd07b9ad9c02d87335d61482808bcec", "name": "ANYmaterial", "path": ( - "C:\\Github\\ANYsolver\\.perf2-worktrees\\" + "C:\\Github\\ANYfeSolver\\.perf2-worktrees\\" "s3-v2-stage4a-anymaterial-dependency" ), "source_file_count": 15, @@ -858,7 +858,7 @@ def test_stage4a_correction7_dependency_authority_is_exact(authority) -> None: "AA316B42C0D4053F4A468C2D453EA6BFAC8EA7A17ABC1F7F0BFDD4F4F343C109" ), "source_path": ( - "C:\\Github\\ANYsolver\\.perf2-worktrees\\" + "C:\\Github\\ANYfeSolver\\.perf2-worktrees\\" "s3-v2-stage4a-anymaterial-dependency\\src" ), "tree": "e1e75423f623e9aad787bf584b3f0c9a6fe2360a", @@ -867,7 +867,7 @@ def test_stage4a_correction7_dependency_authority_is_exact(authority) -> None: "commit": "b2c4df0892025963623201b27e45a1e9af615d8e", "name": "ANYgeometry", "path": ( - "C:\\Github\\ANYsolver\\.perf2-worktrees\\" + "C:\\Github\\ANYfeSolver\\.perf2-worktrees\\" "s3-v2-stage4a-anygeometry-dependency" ), "source_file_count": 37, @@ -875,7 +875,7 @@ def test_stage4a_correction7_dependency_authority_is_exact(authority) -> None: "60AEC025D7659B5714A9588150B1EFABF74DA3398FAA9297420BB2E1D0A29149" ), "source_path": ( - "C:\\Github\\ANYsolver\\.perf2-worktrees\\" + "C:\\Github\\ANYfeSolver\\.perf2-worktrees\\" "s3-v2-stage4a-anygeometry-dependency\\src" ), "tree": "8ee3a63ade1127f45245bf9f0b1c442717ec34d5", @@ -884,7 +884,7 @@ def test_stage4a_correction7_dependency_authority_is_exact(authority) -> None: "commit": "ffeb538f6f1422cd7c8f3f2b86610c29dc26e078", "name": "ANYmesh", "path": ( - "C:\\Github\\ANYsolver\\.perf2-worktrees\\" + "C:\\Github\\ANYfeSolver\\.perf2-worktrees\\" "s3-v2-stage4a-anymesh-dependency" ), "source_file_count": 50, @@ -892,7 +892,7 @@ def test_stage4a_correction7_dependency_authority_is_exact(authority) -> None: "7226109CD4986C4F18828F72B0DAA80EEDD37DA86AC9FEBB908CA4779F21F324" ), "source_path": ( - "C:\\Github\\ANYsolver\\.perf2-worktrees\\" + "C:\\Github\\ANYfeSolver\\.perf2-worktrees\\" "s3-v2-stage4a-anymesh-dependency\\src" ), "tree": "c6092a1fce57a7182d647c34d393838ef700a846", @@ -901,7 +901,7 @@ def test_stage4a_correction7_dependency_authority_is_exact(authority) -> None: "commit": "9b1e5adea77a20155bbc23866af8c9aad853ddfd", "name": "ANYfileIO", "path": ( - "C:\\Github\\ANYsolver\\.perf2-worktrees\\" + "C:\\Github\\ANYfeSolver\\.perf2-worktrees\\" "s3-v2-stage4a-anyfileio-dependency" ), "source_file_count": 24, @@ -909,7 +909,7 @@ def test_stage4a_correction7_dependency_authority_is_exact(authority) -> None: "FCDECDEFAF7E1DC370287215D6C2EE705332C721360C0D95B477E6F003F9512D" ), "source_path": ( - "C:\\Github\\ANYsolver\\.perf2-worktrees\\" + "C:\\Github\\ANYfeSolver\\.perf2-worktrees\\" "s3-v2-stage4a-anyfileio-dependency\\src" ), "tree": "70b406be2574adceab4a7b688c0e489e0937df5d", diff --git a/tests/test_e4_pl_s3_v2_stage4a_coordinator.py b/tests/test_e4_pl_s3_v2_stage4a_coordinator.py index e0effa182..550728ead 100644 --- a/tests/test_e4_pl_s3_v2_stage4a_coordinator.py +++ b/tests/test_e4_pl_s3_v2_stage4a_coordinator.py @@ -2146,28 +2146,28 @@ def test_registered_resource_command_isolated_and_supplies_only_bound_dependenci ( "ANYmaterial", Path( - r"C:\Github\ANYsolver\.perf2-worktrees" + r"C:\Github\ANYfeSolver\.perf2-worktrees" r"\s3-v2-stage4a-anymaterial-dependency" ), ), ( "ANYgeometry", Path( - r"C:\Github\ANYsolver\.perf2-worktrees" + r"C:\Github\ANYfeSolver\.perf2-worktrees" r"\s3-v2-stage4a-anygeometry-dependency" ), ), ( "ANYmesh", Path( - r"C:\Github\ANYsolver\.perf2-worktrees" + r"C:\Github\ANYfeSolver\.perf2-worktrees" r"\s3-v2-stage4a-anymesh-dependency" ), ), ( "ANYfileIO", Path( - r"C:\Github\ANYsolver\.perf2-worktrees" + r"C:\Github\ANYfeSolver\.perf2-worktrees" r"\s3-v2-stage4a-anyfileio-dependency" ), ), @@ -2915,22 +2915,22 @@ def test_candidate_archive_extraction_rejects_escape_and_is_exclusive( safe_root.mkdir() safe_archive = safe_root / "candidate.tar" with tarfile.open(safe_archive, "w") as bundle: - directory = tarfile.TarInfo("src/anysolver/") + directory = tarfile.TarInfo("src/anyfesolver/") directory.type = tarfile.DIRTYPE bundle.addfile(directory) payload = b"# exact candidate\n" - member = tarfile.TarInfo("src/anysolver/__init__.py") + member = tarfile.TarInfo("src/anyfesolver/__init__.py") member.size = len(payload) bundle.addfile(member, io.BytesIO(payload)) extracted = module._extract_candidate_archive(safe_archive, safe_root) - assert (extracted / "src" / "anysolver" / "__init__.py").read_bytes() == payload + assert (extracted / "src" / "anyfesolver" / "__init__.py").read_bytes() == payload fresh_child = subprocess.run( [ sys.executable, "-I", "-c", "from pathlib import Path; import sys; print(Path(sys.argv[1]).read_text())", - str(extracted / "src" / "anysolver" / "__init__.py"), + str(extracted / "src" / "anyfesolver" / "__init__.py"), ], check=True, capture_output=True, @@ -3434,7 +3434,7 @@ def _correction4_success_receipt(module, tmp_path, monkeypatch): "request_id": request_id, "requested_at": f"2026-08-31T12:{wave_index:02d}:00+02:00", "status": "PENDING", - "task": f"ANYsolver S3 V2A Stage 4A bounded leaf wave {wave_index:02d}", + "task": f"ANYfeSolver S3 V2A Stage 4A bounded leaf wave {wave_index:02d}", } request_raw = module.canonical_bytes(request) request_path = resource_root / "requests" / f"{request_id}.json" diff --git a/tests/test_e4_pl_s3_v2b_interface_funnel.py b/tests/test_e4_pl_s3_v2b_interface_funnel.py index 38527d9e7..3815224a6 100644 --- a/tests/test_e4_pl_s3_v2b_interface_funnel.py +++ b/tests/test_e4_pl_s3_v2b_interface_funnel.py @@ -9,7 +9,7 @@ import numpy as np import pytest -from anysolver.elements import DEFAULT_Q4_FORMULATION, DEFAULT_S3_FORMULATION +from anyfesolver.elements import DEFAULT_Q4_FORMULATION, DEFAULT_S3_FORMULATION ROOT = Path(__file__).resolve().parents[1] diff --git a/tests/test_e4_pl_s3_v2b_production.py b/tests/test_e4_pl_s3_v2b_production.py index 2de27a8d0..d429d9dec 100644 --- a/tests/test_e4_pl_s3_v2b_production.py +++ b/tests/test_e4_pl_s3_v2b_production.py @@ -7,9 +7,9 @@ import numpy as np import pytest -import anysolver -from anysolver.e4_pl_element import QualifiedE4PLShellElement -from anysolver.e4_pl_s3_v2b_element import ( +import anyfesolver +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement +from anyfesolver.e4_pl_s3_v2b_element import ( CBMIN3, FORMULATION_ID, IMPLEMENTATION_ID, @@ -18,8 +18,8 @@ StrictFlatLinearCapabilityError, StrictFlatLinearE4PLS3V2BShellElement, ) -from anysolver.element_capabilities import ElementCapabilityError -from anysolver.elements import ( +from anyfesolver.element_capabilities import ElementCapabilityError +from anyfesolver.elements import ( DEFAULT_Q4_FORMULATION, DEFAULT_S3_FORMULATION, ShellElement, @@ -27,7 +27,7 @@ create_shell_element, shell_formulation_diagnostics, ) -from anysolver.fe_core import FEMesh, Material +from anyfesolver.fe_core import FEMesh, Material ROOT = Path(__file__).resolve().parents[1] @@ -117,10 +117,10 @@ def test_v2b_is_additive_opt_in_and_defaults_are_unchanged() -> None: def test_v2b_authority_identity_is_explicit() -> None: - assert anysolver.StrictFlatLinearE4PLS3V2BShellElement is StrictFlatLinearE4PLS3V2BShellElement - assert anysolver.STRICT_FLAT_S3_V2B_FORMULATION_ID == FORMULATION_ID - assert anysolver.STRICT_FLAT_S3_V2B_IMPLEMENTATION_ID == IMPLEMENTATION_ID - assert anysolver.STRICT_FLAT_S3_V2B_SELECTOR == SELECTOR + assert anyfesolver.StrictFlatLinearE4PLS3V2BShellElement is StrictFlatLinearE4PLS3V2BShellElement + assert anyfesolver.STRICT_FLAT_S3_V2B_FORMULATION_ID == FORMULATION_ID + assert anyfesolver.STRICT_FLAT_S3_V2B_IMPLEMENTATION_ID == IMPLEMENTATION_ID + assert anyfesolver.STRICT_FLAT_S3_V2B_SELECTOR == SELECTOR assert FORMULATION_ID == "CANDIDATE_E4_PL_S3_V2B_FLAT_LINEAR_V1" assert SELECTOR == "e4-pl-s3-v2b" assert CBMIN3 == 2.0 diff --git a/tests/test_e4_pl_s3_v2c_production.py b/tests/test_e4_pl_s3_v2c_production.py index 63fb341ba..e1306d76d 100644 --- a/tests/test_e4_pl_s3_v2c_production.py +++ b/tests/test_e4_pl_s3_v2c_production.py @@ -3,9 +3,9 @@ import numpy as np import pytest -import anysolver -from anysolver.e4_pl_s3_v2b_element import StrictFlatLinearE4PLS3V2BShellElement -from anysolver.e4_pl_s3_v2c_element import ( +import anyfesolver +from anyfesolver.e4_pl_s3_v2b_element import StrictFlatLinearE4PLS3V2BShellElement +from anyfesolver.e4_pl_s3_v2c_element import ( FORMULATION_ID, GEOMETRIC_STIFFNESS_POLICY_ID, MASS_POLICY_ID, @@ -13,15 +13,15 @@ StrictFlatLinearCapabilityError, StrictFlatLinearE4PLS3V2CShellElement, ) -from anysolver.elements import ( +from anyfesolver.elements import ( DEFAULT_Q4_FORMULATION, DEFAULT_S3_FORMULATION, create_shell_element, shell_element_from_dict, ) -from anysolver.fe_core import FEModel, FEMesh, Material -from anysolver.boundary import BoundaryCondition, FixedSupport -from anysolver.modal import solve_free_vibration +from anyfesolver.fe_core import FEModel, FEMesh, Material +from anyfesolver.boundary import BoundaryCondition, FixedSupport +from anyfesolver.modal import solve_free_vibration COORDINATES = np.asarray( @@ -72,7 +72,7 @@ def test_v2c_is_additive_and_preserves_both_defaults() -> None: reference_normal=NORMAL, ) ) is StrictFlatLinearE4PLS3V2CShellElement - assert anysolver.STRICT_FLAT_S3_V2C_FORMULATION_ID == FORMULATION_ID + assert anyfesolver.STRICT_FLAT_S3_V2C_FORMULATION_ID == FORMULATION_ID for spelling in ("e4_pl_s3_v2c", "qualified_s3_v2c"): with pytest.raises(ValueError, match="canonical"): create_shell_element(3, [1, 2, 3], "steel", formulation=spelling) diff --git a/tests/test_e4_pl_s3_v2d_linear_native_parity.py b/tests/test_e4_pl_s3_v2d_linear_native_parity.py index f371c7c86..c6d277dc8 100644 --- a/tests/test_e4_pl_s3_v2d_linear_native_parity.py +++ b/tests/test_e4_pl_s3_v2d_linear_native_parity.py @@ -3,24 +3,24 @@ import numpy as np import pytest -import anysolver -from anysolver.e4_pl_s3_v2c_element import ( +import anyfesolver +from anyfesolver.e4_pl_s3_v2c_element import ( StrictFlatLinearE4PLS3V2CShellElement, ) -from anysolver.e4_pl_s3_v2d_element import ( +from anyfesolver.e4_pl_s3_v2d_element import ( FORMULATION_ID, NativeParityCapabilityError, NativeParityE4PLS3V2DShellElement, ) -from anysolver.elements import ( +from anyfesolver.elements import ( DEFAULT_Q4_FORMULATION, DEFAULT_S3_FORMULATION, create_shell_element, shell_element_from_dict, shell_formulation_diagnostics, ) -from anysolver.fe_core import FEMesh, Material -from anysolver.shell_sections import GeneralizedShellSection +from anyfesolver.fe_core import FEMesh, Material +from anyfesolver.shell_sections import GeneralizedShellSection COORDINATES = np.asarray( @@ -57,7 +57,7 @@ def _v2d(**kwargs: object) -> NativeParityE4PLS3V2DShellElement: def test_v2d_elastic_surface_stress_is_available_through_default_public_recovery() -> None: - from anysolver import FEModel, recover_stress_result + from anyfesolver import FEModel, recover_stress_result model = FEModel("mixed-q4-s3-surface-stress") model.add_material("steel", E, NU, density=7850.0) @@ -203,7 +203,7 @@ def test_v2d_is_the_s3_default_and_preserves_the_q4_default() -> None: reference_normal=NORMAL, ) ) is NativeParityE4PLS3V2DShellElement - assert anysolver.S3_V2D_FORMULATION_ID == FORMULATION_ID + assert anyfesolver.S3_V2D_FORMULATION_ID == FORMULATION_ID assert shell_formulation_diagnostics( node_count=3, formulation="e4-pl-s3-v2d" )["topology_policy"] == "NATIVE_PARITY_E4_PL_S3_V2D_DEFAULT" @@ -345,7 +345,7 @@ def test_v2d_stateless_identity_roundtrip_and_remaining_successor_gaps() -> None [ "git", "show", - "dfe3d31424fdc97bd770a2657f19bb009bab7989:src/anysolver/e4_pl_s3_v2d_element.py", + "dfe3d31424fdc97bd770a2657f19bb009bab7989:src/anyfesolver/e4_pl_s3_v2d_element.py", ], check=True, stdout=subprocess.PIPE, @@ -358,7 +358,7 @@ def test_v2d_stateless_identity_roundtrip_and_remaining_successor_gaps() -> None [ "git", "show", - "afe691759a611278e341be7d58ffaae4f71bde89:src/anysolver/e4_pl_s3_v2d_element.py", + "afe691759a611278e341be7d58ffaae4f71bde89:src/anyfesolver/e4_pl_s3_v2d_element.py", ], check=True, stdout=subprocess.PIPE, diff --git a/tests/test_e4_pl_s3_v2d_native_state_corotational.py b/tests/test_e4_pl_s3_v2d_native_state_corotational.py index 7e692dcd1..5bd0f71e8 100644 --- a/tests/test_e4_pl_s3_v2d_native_state_corotational.py +++ b/tests/test_e4_pl_s3_v2d_native_state_corotational.py @@ -5,20 +5,20 @@ import numpy as np import pytest -from anysolver.corotational import ( +from anyfesolver.corotational import ( corotational_element_response, rotation_matrix_from_vector, ) -from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement -from anysolver.e4_pl_s3_v2d_state import ( +from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement +from anyfesolver.e4_pl_s3_v2d_state import ( STATE_SCHEMA, V2DStateError, canonical_json_bytes, ) -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEModel -from anysolver.material_curves import DNVC208MaterialCurve -from anysolver.shell_sections import GeneralizedShellSection +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.material_curves import DNVC208MaterialCurve +from anyfesolver.shell_sections import GeneralizedShellSection E = 210.0e9 diff --git a/tests/test_e4_pl_s3_v2d_von_karman.py b/tests/test_e4_pl_s3_v2d_von_karman.py index 662b38723..dd1ed3086 100644 --- a/tests/test_e4_pl_s3_v2d_von_karman.py +++ b/tests/test_e4_pl_s3_v2d_von_karman.py @@ -9,7 +9,7 @@ import numpy as np import pytest -from anysolver.e4_pl_s3_v2d_state import canonical_json_bytes +from anyfesolver.e4_pl_s3_v2d_state import canonical_json_bytes from test_e4_pl_s3_v2d_native_state_corotational import _model @@ -21,8 +21,8 @@ def record_measurements(): yield path = os.environ.get("S3_EVIDENCE_OUT") if path: - import anysolver - MEASUREMENTS["runtime"] = {"python":sys.version, "module":anysolver.__file__, + import anyfesolver + MEASUREMENTS["runtime"] = {"python":sys.version, "module":anyfesolver.__file__, "PYTHONPATH":os.environ.get("PYTHONPATH"), "OMP_NUM_THREADS":os.environ.get("OMP_NUM_THREADS")} Path(path).write_text(json.dumps(MEASUREMENTS, indent=2)) @@ -93,9 +93,9 @@ def test_consistent_tangent_initial_fields_history_and_nonmutation(plastic, gene def test_reference_and_optimized_assembly_dispatch_and_recovery(): - from anysolver.nonlinear_static import _assemble_nonlinear_system_unchecked - from anysolver.nonlinear_performance import NonlinearAssemblyPlan - from anysolver.recovery import _recover_v2d_committed_state + from anyfesolver.nonlinear_static import _assemble_nonlinear_system_unchecked + from anyfesolver.nonlinear_performance import NonlinearAssemblyPlan + from anyfesolver.recovery import _recover_v2d_committed_state model, element = _model() model.apply_boundary_conditions() u = np.zeros(18); u[8] = .02 @@ -115,9 +115,9 @@ def test_reference_and_optimized_assembly_dispatch_and_recovery(): def test_public_clamped_n4_plate_membrane_stiffens(): - import anysolver as fs - from anysolver.elements import create_shell_element - from anysolver.boundary import FixedSupport, LoadCase + import anyfesolver as fs + from anyfesolver.elements import create_shell_element + from anyfesolver.boundary import FixedSupport, LoadCase model = fs.FEModel("experimental-s3-vk-n4") model.add_material("steel", 210e9, .3, density=7850.) n = 4 @@ -153,7 +153,7 @@ def test_public_clamped_n4_plate_membrane_stiffens(): assert .010 < deflection < .016 assert max(np.linalg.norm(s["station_generalized_resultant"][:,:3]) for s in result.element_states.values()) > 1. - from anysolver.matrix_assembly import assemble_load_vector + from anyfesolver.matrix_assembly import assemble_load_vector internal = np.zeros_like(result.displacements) for eid, element in model.mesh.elements.items(): dofs = element.get_dof_mapping(model.mesh) @@ -169,9 +169,9 @@ def test_public_clamped_n4_plate_membrane_stiffens(): def test_candidate_state_provenance_integrity_and_spectral_refusal(): - from anysolver.e4_pl_s3_v2d_state import V2DStateError, seal_v2d_state - from anysolver.element_capabilities import ElementCapabilityError - from anysolver.current_state_tangent import _s3_v2d_committed_current_tangent_components + from anyfesolver.e4_pl_s3_v2d_state import V2DStateError, seal_v2d_state + from anyfesolver.element_capabilities import ElementCapabilityError + from anyfesolver.current_state_tangent import _s3_v2d_committed_current_tangent_components model, element = _model() material = model.get_material("steel") u = np.zeros(18); u[8] = .02 @@ -197,7 +197,7 @@ def test_candidate_state_provenance_integrity_and_spectral_refusal(): def test_virgin_accepted_state_recovery_and_non_vk_isolation(): - from anysolver.corotational import corotational_element_response + from anyfesolver.corotational import corotational_element_response model, element = _model() model.apply_boundary_conditions() material = model.get_material("steel") @@ -224,8 +224,8 @@ def test_virgin_accepted_state_recovery_and_non_vk_isolation(): def test_cancelled_trial_discards_candidate_without_mutating_history(): - from anysolver.nonlinear_state import NonlinearStateStore, discard_active_state_candidate - from anysolver.nonlinear_static import _assemble_nonlinear_system_unchecked + from anyfesolver.nonlinear_state import NonlinearStateStore, discard_active_state_candidate + from anyfesolver.nonlinear_static import _assemble_nonlinear_system_unchecked model, element = _model(plastic=True) model.apply_boundary_conditions() virgin = element.init_model_bound_nonlinear_state(model.mesh, model.get_material("steel"), 5) @@ -265,8 +265,8 @@ def test_deleted_frozen_history_operator_preserves_explicit_mode(von_karman): def test_second_production_deleted_assembly_keeps_frozen_vk_history(): - from anysolver.nonlinear_performance import _optimized_assemble_nonlinear_system - from anysolver.nonlinear_state import NonlinearStateStore, discard_active_state_candidate + from anyfesolver.nonlinear_performance import _optimized_assemble_nonlinear_system + from anyfesolver.nonlinear_state import NonlinearStateStore, discard_active_state_candidate model, element = _model(plastic=True) model.apply_boundary_conditions() material = model.get_material("steel") @@ -293,9 +293,9 @@ def test_second_production_deleted_assembly_keeps_frozen_vk_history(): def test_public_cancellation_after_accepted_step_preserves_restart_input(): - import anysolver as fs - from anysolver.boundary import FixedSupport, LoadCase - from anysolver.control import CancellationToken, SolveCancelled + import anyfesolver as fs + from anyfesolver.boundary import FixedSupport, LoadCase + from anyfesolver.control import CancellationToken, SolveCancelled model, element = _model() model.add_boundary_condition(FixedSupport("root", [1,3])) model.apply_boundary_conditions() diff --git a/tests/test_e4_pl_s3_v3a_implementation_screen.py b/tests/test_e4_pl_s3_v3a_implementation_screen.py index aad949ef8..6d46bb7a5 100644 --- a/tests/test_e4_pl_s3_v3a_implementation_screen.py +++ b/tests/test_e4_pl_s3_v3a_implementation_screen.py @@ -48,8 +48,8 @@ def test_source_native_producer_does_not_import_failed_mechanics() -> None: imports.update(alias.name for alias in node.names) elif isinstance(node, ast.ImportFrom) and node.module: imports.add(node.module) - assert "anysolver.e4_pl_s3_element" not in imports - assert "anysolver.e4_pl_s3_v2_element" not in imports + assert "anyfesolver.e4_pl_s3_element" not in imports + assert "anyfesolver.e4_pl_s3_v2_element" not in imports assert "e4_pl_s3_v2_flat_funnel_producer" not in imports @@ -115,7 +115,7 @@ def test_two_bounded_cycles_are_byte_identical_and_stop_at_local_gate(tmp_path: def test_production_boundary_remains_static() -> None: - source = (ROOT / "src" / "anysolver" / "elements.py").read_text(encoding="utf-8") + source = (ROOT / "src" / "anyfesolver" / "elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source assert not any(path.is_file() for path in (ROOT / "src").rglob("*v3a*")) diff --git a/tests/test_e4_pl_s3_v4a_q4_subcell_screen.py b/tests/test_e4_pl_s3_v4a_q4_subcell_screen.py index 1428f273c..53ff7bf2d 100644 --- a/tests/test_e4_pl_s3_v4a_q4_subcell_screen.py +++ b/tests/test_e4_pl_s3_v4a_q4_subcell_screen.py @@ -54,8 +54,8 @@ def imported(tree: ast.AST) -> set[str]: producer_imports = imported(producer) checker_imports = imported(checker) - assert "anysolver.e4_pl_s3_element" not in producer_imports - assert "anysolver.e4_pl_s3_v2_element" not in producer_imports + assert "anyfesolver.e4_pl_s3_element" not in producer_imports + assert "anyfesolver.e4_pl_s3_v2_element" not in producer_imports assert "e4_pl_s3_v4a_screen_producer" not in checker_imports @@ -118,7 +118,7 @@ def test_two_bounded_cycles_are_byte_identical_and_stop_at_local_gate(tmp_path: def test_production_boundary_remains_static() -> None: - source = (ROOT / "src" / "anysolver" / "elements.py").read_text(encoding="utf-8") + source = (ROOT / "src" / "anyfesolver" / "elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source assert not any(path.is_file() for path in (ROOT / "src").rglob("*v4a*")) diff --git a/tests/test_e4_pl_s3_v4b_drill_release_screen.py b/tests/test_e4_pl_s3_v4b_drill_release_screen.py index 4f66e194d..8c782b1db 100644 --- a/tests/test_e4_pl_s3_v4b_drill_release_screen.py +++ b/tests/test_e4_pl_s3_v4b_drill_release_screen.py @@ -48,8 +48,8 @@ def test_checker_is_independent_of_v4b_producer() -> None: elif isinstance(node, ast.ImportFrom) and node.module: imports.add(node.module) assert "e4_pl_s3_v4b_screen_producer" not in imports - assert "anysolver.e4_pl_s3_element" not in imports - assert "anysolver.e4_pl_s3_v2_element" not in imports + assert "anyfesolver.e4_pl_s3_element" not in imports + assert "anyfesolver.e4_pl_s3_v2_element" not in imports def test_independent_reconstruction_finds_physical_rank_contradiction() -> None: @@ -104,7 +104,7 @@ def test_two_bounded_cycles_are_byte_identical_and_stop_locally(tmp_path: Path) def test_production_boundary_remains_static() -> None: - source = (ROOT / "src" / "anysolver" / "elements.py").read_text(encoding="utf-8") + source = (ROOT / "src" / "anyfesolver" / "elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source assert not any(path.is_file() for path in (ROOT / "src").rglob("*v4b*")) diff --git a/tests/test_e4_pl_s3_v4b_preregistration.py b/tests/test_e4_pl_s3_v4b_preregistration.py index fab692bc4..7d2fdcd46 100644 --- a/tests/test_e4_pl_s3_v4b_preregistration.py +++ b/tests/test_e4_pl_s3_v4b_preregistration.py @@ -71,7 +71,7 @@ def test_validator_is_standard_library_only_and_does_not_import_mechanics() -> N imports.update(alias.name for alias in node.names) elif isinstance(node, ast.ImportFrom) and node.module: imports.add(node.module) - assert not imports.intersection({"numpy", "sympy", "scipy", "anysolver", "anymesh", "anymesher"}) + assert not imports.intersection({"numpy", "sympy", "scipy", "anyfesolver", "anymesh", "anymesher"}) def test_canonical_parser_rejects_duplicate_nonfinite_and_hash_mutation(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None: @@ -103,7 +103,7 @@ def test_preregistration_authorizes_only_bounded_screen() -> None: def test_production_boundary_remains_static() -> None: - source = (ROOT / "src" / "anysolver" / "elements.py").read_text(encoding="utf-8") + source = (ROOT / "src" / "anyfesolver" / "elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source assert not any(path.is_file() for path in (ROOT / "src").rglob("*v4b*")) diff --git a/tests/test_e4_pl_s3_v4c_physical_first_screen.py b/tests/test_e4_pl_s3_v4c_physical_first_screen.py index 0414c471d..e14cc9adf 100644 --- a/tests/test_e4_pl_s3_v4c_physical_first_screen.py +++ b/tests/test_e4_pl_s3_v4c_physical_first_screen.py @@ -48,8 +48,8 @@ def test_checker_does_not_import_v4c_producer_or_failed_s3_mechanics() -> None: elif isinstance(node, ast.ImportFrom) and node.module: imports.add(node.module) assert "e4_pl_s3_v4c_screen_producer" not in imports - assert "anysolver.e4_pl_s3_element" not in imports - assert "anysolver.e4_pl_s3_v2_element" not in imports + assert "anyfesolver.e4_pl_s3_element" not in imports + assert "anyfesolver.e4_pl_s3_v2_element" not in imports def test_local_gate_passes_and_complete_macrocell_gate_fails_independently() -> None: @@ -108,7 +108,7 @@ def test_two_bounded_cycles_are_identical_and_stop_before_development(tmp_path: def test_production_boundary_remains_static() -> None: - source = (ROOT / "src" / "anysolver" / "elements.py").read_text(encoding="utf-8") + source = (ROOT / "src" / "anyfesolver" / "elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source assert not any(path.is_file() for path in (ROOT / "src").rglob("*v4c*")) diff --git a/tests/test_e4_pl_s3_v4c_preregistration.py b/tests/test_e4_pl_s3_v4c_preregistration.py index 05a60db0a..0ca8d3808 100644 --- a/tests/test_e4_pl_s3_v4c_preregistration.py +++ b/tests/test_e4_pl_s3_v4c_preregistration.py @@ -55,7 +55,7 @@ def test_validator_is_standard_library_only() -> None: imports.update(alias.name for alias in node.names) elif isinstance(node, ast.ImportFrom) and node.module: imports.add(node.module) - assert not imports.intersection({"numpy", "sympy", "scipy", "anysolver", "anymesh", "anymesher"}) + assert not imports.intersection({"numpy", "sympy", "scipy", "anyfesolver", "anymesh", "anymesher"}) def test_preregistration_authorizes_only_bounded_screen() -> None: @@ -66,7 +66,7 @@ def test_preregistration_authorizes_only_bounded_screen() -> None: def test_production_boundary_remains_static() -> None: - source = (ROOT / "src" / "anysolver" / "elements.py").read_text(encoding="utf-8") + source = (ROOT / "src" / "anyfesolver" / "elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source assert not any(path.is_file() for path in (ROOT / "src").rglob("*v4c*")) diff --git a/tests/test_e4_pl_s3_v4d_hermite_edge_screen.py b/tests/test_e4_pl_s3_v4d_hermite_edge_screen.py index a5ecac870..178e8aaf7 100644 --- a/tests/test_e4_pl_s3_v4d_hermite_edge_screen.py +++ b/tests/test_e4_pl_s3_v4d_hermite_edge_screen.py @@ -48,8 +48,8 @@ def test_checker_does_not_import_v4d_producer_or_failed_s3_mechanics() -> None: elif isinstance(node, ast.ImportFrom) and node.module: imports.add(node.module) assert "e4_pl_s3_v4d_screen_producer" not in imports - assert "anysolver.e4_pl_s3_element" not in imports - assert "anysolver.e4_pl_s3_v2_element" not in imports + assert "anyfesolver.e4_pl_s3_element" not in imports + assert "anyfesolver.e4_pl_s3_v2_element" not in imports def test_hermite_local_gate_passes_and_complete_macrocell_gate_fails() -> None: @@ -108,7 +108,7 @@ def test_two_bounded_cycles_are_identical_and_stop_before_development(tmp_path: def test_production_boundary_remains_static() -> None: - source = (ROOT / "src" / "anysolver" / "elements.py").read_text(encoding="utf-8") + source = (ROOT / "src" / "anyfesolver" / "elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source assert not any(path.is_file() for path in (ROOT / "src").rglob("*v4d*")) diff --git a/tests/test_e4_pl_s3_v4d_preregistration.py b/tests/test_e4_pl_s3_v4d_preregistration.py index 3c90ebb24..07b84b3af 100644 --- a/tests/test_e4_pl_s3_v4d_preregistration.py +++ b/tests/test_e4_pl_s3_v4d_preregistration.py @@ -53,7 +53,7 @@ def test_validator_is_standard_library_only() -> None: imports.update(alias.name for alias in node.names) elif isinstance(node, ast.ImportFrom) and node.module: imports.add(node.module) - assert not imports.intersection({"numpy", "sympy", "scipy", "anysolver", "anymesh", "anymesher"}) + assert not imports.intersection({"numpy", "sympy", "scipy", "anyfesolver", "anymesh", "anymesher"}) def test_preregistration_authorizes_only_bounded_screen() -> None: @@ -64,7 +64,7 @@ def test_preregistration_authorizes_only_bounded_screen() -> None: def test_production_boundary_remains_static() -> None: - source = (ROOT / "src" / "anysolver" / "elements.py").read_text(encoding="utf-8") + source = (ROOT / "src" / "anyfesolver" / "elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source assert not any(path.is_file() for path in (ROOT / "src").rglob("*v4d*")) diff --git a/tests/test_e4_pl_s3_v4e_preregistration.py b/tests/test_e4_pl_s3_v4e_preregistration.py index 8f1596c8e..d06447826 100644 --- a/tests/test_e4_pl_s3_v4e_preregistration.py +++ b/tests/test_e4_pl_s3_v4e_preregistration.py @@ -37,7 +37,7 @@ def test_validator_is_standard_library_only() -> None: imports.update(alias.name for alias in node.names) elif isinstance(node, ast.ImportFrom) and node.module: imports.add(node.module) - assert not imports.intersection({"numpy", "sympy", "scipy", "anysolver", "anymesh", "anymesher"}) + assert not imports.intersection({"numpy", "sympy", "scipy", "anyfesolver", "anymesh", "anymesher"}) def test_preregistration_authorizes_only_bounded_diagnosis() -> None: @@ -48,7 +48,7 @@ def test_preregistration_authorizes_only_bounded_diagnosis() -> None: def test_production_boundary_remains_static() -> None: - source = (ROOT / "src" / "anysolver" / "elements.py").read_text(encoding="utf-8") + source = (ROOT / "src" / "anyfesolver" / "elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source assert not any(path.is_file() for path in (ROOT / "src").rglob("*v4e*")) diff --git a/tests/test_e4_pl_s3_v4e_shear_diagnosis.py b/tests/test_e4_pl_s3_v4e_shear_diagnosis.py index 7bf924029..f0c5bf047 100644 --- a/tests/test_e4_pl_s3_v4e_shear_diagnosis.py +++ b/tests/test_e4_pl_s3_v4e_shear_diagnosis.py @@ -39,8 +39,8 @@ def test_checker_does_not_import_v4e_producer_or_failed_s3_mechanics() -> None: elif isinstance(node, ast.ImportFrom) and node.module: imports.add(node.module) assert "e4_pl_s3_v4e_shear_diagnosis_producer" not in imports - assert "anysolver.e4_pl_s3_element" not in imports - assert "anysolver.e4_pl_s3_v2_element" not in imports + assert "anyfesolver.e4_pl_s3_element" not in imports + assert "anyfesolver.e4_pl_s3_v2_element" not in imports def test_independent_diagnosis_is_identity_complete_and_shear_limited() -> None: @@ -92,7 +92,7 @@ def test_two_bounded_cycles_are_identical(tmp_path: Path) -> None: def test_production_boundary_remains_static() -> None: - source = (ROOT / "src" / "anysolver" / "elements.py").read_text(encoding="utf-8") + source = (ROOT / "src" / "anyfesolver" / "elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source assert not any(path.is_file() for path in (ROOT / "src").rglob("*v4e*")) diff --git a/tests/test_e4_pl_s3_v5a_min3_screen.py b/tests/test_e4_pl_s3_v5a_min3_screen.py index 9ae0806b2..3ecc706c8 100644 --- a/tests/test_e4_pl_s3_v5a_min3_screen.py +++ b/tests/test_e4_pl_s3_v5a_min3_screen.py @@ -38,8 +38,8 @@ def test_source_maps_are_independent_and_agree() -> None: elif isinstance(node, ast.ImportFrom) and node.module: imports.add(node.module) assert "e4_pl_s3_v5a_screen_producer" not in imports - assert "anysolver.e4_pl_s3_element" not in imports - assert "anysolver.e4_pl_s3_v2_element" not in imports + assert "anyfesolver.e4_pl_s3_element" not in imports + assert "anyfesolver.e4_pl_s3_v2_element" not in imports vertices = np.asarray(((0.0, 0.0, 0.0), (1.0, 0.0, 0.0), (0.2, 0.9, 0.0))) produced = min3_components(vertices) checked = reconstruct(vertices) @@ -109,7 +109,7 @@ def test_terminal_precedence_and_two_bounded_cycles(tmp_path: Path) -> None: def test_production_boundary_and_optional_closeout() -> None: - source = (ROOT / "src" / "anysolver" / "elements.py").read_text(encoding="utf-8") + source = (ROOT / "src" / "anyfesolver" / "elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source assert not any(path.is_file() for path in (ROOT / "src").rglob("*v5a*")) diff --git a/tests/test_e4_pl_s3_v5a_preregistration.py b/tests/test_e4_pl_s3_v5a_preregistration.py index 575077d68..db9b08cb4 100644 --- a/tests/test_e4_pl_s3_v5a_preregistration.py +++ b/tests/test_e4_pl_s3_v5a_preregistration.py @@ -149,7 +149,7 @@ def test_frozen_inputs_and_external_receipts_are_hash_bound() -> None: def test_production_boundary_sources_remain_unchanged() -> None: - source = (ROOT / "src" / "anysolver" / "elements.py").read_text(encoding="utf-8") + source = (ROOT / "src" / "anyfesolver" / "elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source assert not any(path.is_file() for path in (ROOT / "src").rglob("*v5a*")) diff --git a/tests/test_e4_pl_s3_v5b_relaxation_authority.py b/tests/test_e4_pl_s3_v5b_relaxation_authority.py index 65b8a35d1..d233976e9 100644 --- a/tests/test_e4_pl_s3_v5b_relaxation_authority.py +++ b/tests/test_e4_pl_s3_v5b_relaxation_authority.py @@ -154,7 +154,7 @@ def test_contract_freezes_bounds_terminal_precedence_and_inputs() -> None: def test_production_boundary_remains_unchanged() -> None: - source = (ROOT / "src" / "anysolver" / "elements.py").read_text(encoding="utf-8") + source = (ROOT / "src" / "anyfesolver" / "elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source assert not any(path.is_file() for path in (ROOT / "src").rglob("*v5b*")) diff --git a/tests/test_e4_pl_s3_v5b_relaxed_screen.py b/tests/test_e4_pl_s3_v5b_relaxed_screen.py index ade715573..83e3d2e75 100644 --- a/tests/test_e4_pl_s3_v5b_relaxed_screen.py +++ b/tests/test_e4_pl_s3_v5b_relaxed_screen.py @@ -34,8 +34,8 @@ def test_checker_is_independent_of_v5b_producer_and_production_s3() -> None: elif isinstance(node, ast.ImportFrom) and node.module: imports.add(node.module) assert "e4_pl_s3_v5b_relaxed_screen_producer" not in imports - assert "anysolver.e4_pl_s3_element" not in imports - assert "anysolver.e4_pl_s3_v2_element" not in imports + assert "anyfesolver.e4_pl_s3_element" not in imports + assert "anyfesolver.e4_pl_s3_v2_element" not in imports def test_exact_source_relaxation_and_independent_reconstruction() -> None: @@ -138,7 +138,7 @@ def test_contract_freezes_coverage_bounds_thresholds_and_inputs() -> None: def test_production_boundary_remains_unchanged() -> None: - source = (ROOT / "src" / "anysolver" / "elements.py").read_text(encoding="utf-8") + source = (ROOT / "src" / "anyfesolver" / "elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source assert not any(path.is_file() for path in (ROOT / "src").rglob("*v5b*")) diff --git a/tests/test_e4_pl_s3_v5d_response_metric.py b/tests/test_e4_pl_s3_v5d_response_metric.py index ede8597dc..e9c8866a8 100644 --- a/tests/test_e4_pl_s3_v5d_response_metric.py +++ b/tests/test_e4_pl_s3_v5d_response_metric.py @@ -147,6 +147,6 @@ def test_production_boundary_is_unchanged(): "default_s3_formulation": "legacy-s3", "q4_mechanics_unchanged": True, } - source = (ROOT / "src" / "anysolver" / "elements.py").read_text(encoding="utf-8") + source = (ROOT / "src" / "anyfesolver" / "elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source diff --git a/tests/test_e4_pl_s3_v5e_stage4a_spatial.py b/tests/test_e4_pl_s3_v5e_stage4a_spatial.py index 9cdf6e062..c1e485cf7 100644 --- a/tests/test_e4_pl_s3_v5e_stage4a_spatial.py +++ b/tests/test_e4_pl_s3_v5e_stage4a_spatial.py @@ -162,6 +162,6 @@ def test_production_boundary_is_unchanged(): "default_s3_formulation": "legacy-s3", "q4_mechanics_unchanged": True, } - source = (ROOT / "src" / "anysolver" / "elements.py").read_text(encoding="utf-8") + source = (ROOT / "src" / "anyfesolver" / "elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source diff --git a/tests/test_e4_pl_s3_v5f_production_parity.py b/tests/test_e4_pl_s3_v5f_production_parity.py index 192c19997..5ac242fc1 100644 --- a/tests/test_e4_pl_s3_v5f_production_parity.py +++ b/tests/test_e4_pl_s3_v5f_production_parity.py @@ -52,7 +52,7 @@ def test_checker_is_independent_of_producer_and_production_mechanics() -> None: elif isinstance(node, ast.ImportFrom) and node.module: imports.add(node.module) assert "e4_pl_s3_v5f_production_parity_producer" not in imports - assert "anysolver" not in imports + assert "anyfesolver" not in imports def test_contract_is_canonical_and_binds_exact_authority_extent() -> None: @@ -123,7 +123,7 @@ def test_terminal_precedence_and_bounds(coordinator) -> None: def test_defaults_and_q4_mechanics_remain_unchanged() -> None: - source = (ROOT / "src/anysolver/elements.py").read_text(encoding="utf-8") + source = (ROOT / "src/anyfesolver/elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source contract = json.loads(CONTRACT.read_text(encoding="ascii")) diff --git a/tests/test_e4_pl_s3_v5g_stage4b_extension_authority.py b/tests/test_e4_pl_s3_v5g_stage4b_extension_authority.py index e24459b75..da5fba692 100644 --- a/tests/test_e4_pl_s3_v5g_stage4b_extension_authority.py +++ b/tests/test_e4_pl_s3_v5g_stage4b_extension_authority.py @@ -77,6 +77,6 @@ def test_q4_and_defaults_remain_unchanged() -> None: "default_s3_formulation": "legacy-s3", "q4_mechanics_unchanged": True, } - source = (ROOT / "src/anysolver/elements.py").read_text(encoding="utf-8") + source = (ROOT / "src/anyfesolver/elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source diff --git a/tests/test_e4_pl_s3_v5h_closeout.py b/tests/test_e4_pl_s3_v5h_closeout.py index 89f3e8318..0fb615f3a 100644 --- a/tests/test_e4_pl_s3_v5h_closeout.py +++ b/tests/test_e4_pl_s3_v5h_closeout.py @@ -92,7 +92,7 @@ def test_authority_commit_and_production_boundary_are_exact() -> None: text=True, ).splitlines() assert paths == contract["authority"]["exact_paths"] - source = (ROOT / "src/anysolver/elements.py").read_text(encoding="utf-8") + source = (ROOT / "src/anyfesolver/elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source changed = subprocess.check_output( @@ -100,4 +100,4 @@ def test_authority_commit_and_production_boundary_are_exact() -> None: cwd=ROOT, text=True, ).splitlines() - assert "src/anysolver/e4_pl_element.py" not in changed + assert "src/anyfesolver/e4_pl_element.py" not in changed diff --git a/tests/test_e4_pl_s3_v5h_local_parity.py b/tests/test_e4_pl_s3_v5h_local_parity.py index 15550438e..adae39f23 100644 --- a/tests/test_e4_pl_s3_v5h_local_parity.py +++ b/tests/test_e4_pl_s3_v5h_local_parity.py @@ -109,7 +109,7 @@ def test_independent_checker_has_no_production_or_producer_import() -> None: imported.extend(alias.name for alias in node.names) elif isinstance(node, ast.ImportFrom) and node.module: imported.append(node.module) - assert not any(name == "anysolver" or name.startswith("anysolver.") for name in imported) + assert not any(name == "anyfesolver" or name.startswith("anyfesolver.") for name in imported) assert "e4_pl_s3_v5h_local_parity_producer" not in imported @@ -189,7 +189,7 @@ def test_payload_hash_and_terminal_precedence(proof, checker, coordinator) -> No def test_bounds_and_defaults_are_preserved(coordinator) -> None: - source = (ROOT / "src/anysolver/elements.py").read_text(encoding="utf-8") + source = (ROOT / "src/anyfesolver/elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source assert coordinator.CHILD_TIMEOUT_SECONDS == 600 diff --git a/tests/test_e4_pl_s3_v5i_r1_closeout.py b/tests/test_e4_pl_s3_v5i_r1_closeout.py index c9d5d85e8..e548a6953 100644 --- a/tests/test_e4_pl_s3_v5i_r1_closeout.py +++ b/tests/test_e4_pl_s3_v5i_r1_closeout.py @@ -46,6 +46,6 @@ def test_v5i_r1_diagnosis_is_narrow_and_nonactivating() -> None: assert review["findings"] == {"P0": [], "P1": []} assert review["conclusions"]["mechanics_change_authorized"] is False assert status["activation_authorized"] is False - source = (ROOT / "src/anysolver/elements.py").read_text(encoding="utf-8") + source = (ROOT / "src/anyfesolver/elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source diff --git a/tests/test_e4_pl_s3_v5i_r1_diagnosis.py b/tests/test_e4_pl_s3_v5i_r1_diagnosis.py index 1c98e5700..5eea11cb5 100644 --- a/tests/test_e4_pl_s3_v5i_r1_diagnosis.py +++ b/tests/test_e4_pl_s3_v5i_r1_diagnosis.py @@ -54,7 +54,7 @@ def test_independent_checker_imports_no_production_or_producer() -> None: imports.extend(alias.name for alias in node.names) elif isinstance(node, ast.ImportFrom) and node.module: imports.append(node.module) - assert not any(name == "anysolver" or name.startswith("anysolver.") for name in imports) + assert not any(name == "anyfesolver" or name.startswith("anyfesolver.") for name in imports) assert "e4_pl_s3_v5i_r1_diagnosis_producer" not in imports @@ -78,7 +78,7 @@ def test_pair_subspace_formula_and_terminal_precedence() -> None: def test_bounds_and_defaults_are_preserved() -> None: coordinator = _load("_v5i_r1_coordinator_bounds", COORDINATOR) - source = (ROOT / "src/anysolver/elements.py").read_text(encoding="utf-8") + source = (ROOT / "src/anyfesolver/elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source assert coordinator.CHILD_TIMEOUT_SECONDS == 600 diff --git a/tests/test_e4_pl_s3_v5i_stage4b.py b/tests/test_e4_pl_s3_v5i_stage4b.py index cd2223773..853bd9cdb 100644 --- a/tests/test_e4_pl_s3_v5i_stage4b.py +++ b/tests/test_e4_pl_s3_v5i_stage4b.py @@ -118,7 +118,7 @@ def test_hash_and_bounds_mutations_are_rejected(tmp_path: Path, runner) -> None: def test_defaults_and_q4_are_unchanged(runner) -> None: - source = (ROOT / "src/anysolver/elements.py").read_text(encoding="utf-8") + source = (ROOT / "src/anyfesolver/elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source assert runner.CHILD_TIMEOUT_SECONDS == 600 diff --git a/tests/test_e4_pl_s3_v5i_stage4b_closeout.py b/tests/test_e4_pl_s3_v5i_stage4b_closeout.py index 462c6312d..56306c85f 100644 --- a/tests/test_e4_pl_s3_v5i_stage4b_closeout.py +++ b/tests/test_e4_pl_s3_v5i_stage4b_closeout.py @@ -65,7 +65,7 @@ def test_v5i_records_genuine_eigen_precedence_and_no_activation() -> None: def test_v5i_preserves_q4_and_legacy_s3_defaults() -> None: - source = (ROOT / "src/anysolver/elements.py").read_text(encoding="utf-8") + source = (ROOT / "src/anyfesolver/elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source assert _canonical(RESULT)["production_boundary"] == { diff --git a/tests/test_e4_pl_s3_v5k_closeout.py b/tests/test_e4_pl_s3_v5k_closeout.py index c1b5b1fa2..bed24ffbe 100644 --- a/tests/test_e4_pl_s3_v5k_closeout.py +++ b/tests/test_e4_pl_s3_v5k_closeout.py @@ -63,6 +63,6 @@ def test_v5k_does_not_activate_s3_or_change_q4() -> None: "default_s3_formulation": "legacy-s3", "q4_mechanics_unchanged": True, } - source = (ROOT / "src/anysolver/elements.py").read_text(encoding="utf-8") + source = (ROOT / "src/anyfesolver/elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source diff --git a/tests/test_e4_pl_s3_v5k_protocol.py b/tests/test_e4_pl_s3_v5k_protocol.py index 2450a2757..73a15b389 100644 --- a/tests/test_e4_pl_s3_v5k_protocol.py +++ b/tests/test_e4_pl_s3_v5k_protocol.py @@ -29,4 +29,4 @@ def test_protocol_reviewer_is_standard_library_only() -> None: tree = ast.parse(MODULE_PATH.read_text(encoding="utf-8")) roots = {node.names[0].name.split(".")[0] for node in ast.walk(tree) if isinstance(node, ast.Import)} roots |= {str(node.module).split(".")[0] for node in ast.walk(tree) if isinstance(node, ast.ImportFrom)} - assert not roots & {"anysolver", "numpy", "scipy", "sympy"} + assert not roots & {"anyfesolver", "numpy", "scipy", "sympy"} diff --git a/tests/test_e4_pl_s3_v5k_repair.py b/tests/test_e4_pl_s3_v5k_repair.py index dbdc281d3..baacaee82 100644 --- a/tests/test_e4_pl_s3_v5k_repair.py +++ b/tests/test_e4_pl_s3_v5k_repair.py @@ -9,10 +9,10 @@ import numpy as np from scipy import sparse -from anysolver.e4_pl_s3_v2c_element import StrictFlatLinearE4PLS3V2CShellElement -from anysolver.fe_core import FEModel -from anysolver.matrix_assembly import assemble_stiffness_matrix -from anysolver.s3_v2c_fast_assembly import get_v2c_stiffness_plan +from anyfesolver.e4_pl_s3_v2c_element import StrictFlatLinearE4PLS3V2CShellElement +from anyfesolver.fe_core import FEModel +from anyfesolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.s3_v2c_fast_assembly import get_v2c_stiffness_plan ROOT = Path(__file__).resolve().parents[1] @@ -143,7 +143,7 @@ def test_independent_checker_imports_no_production_or_producer() -> None: imports.extend(alias.name for alias in node.names) elif isinstance(node, ast.ImportFrom) and node.module: imports.append(node.module) - assert not any(name == "anysolver" or name.startswith("anysolver.") for name in imports) + assert not any(name == "anyfesolver" or name.startswith("anyfesolver.") for name in imports) assert not any("v5k_producer" in name for name in imports) diff --git a/tests/test_e4_pl_s3_v5l_closeout.py b/tests/test_e4_pl_s3_v5l_closeout.py index 2c00a42bd..1db2acdf6 100644 --- a/tests/test_e4_pl_s3_v5l_closeout.py +++ b/tests/test_e4_pl_s3_v5l_closeout.py @@ -46,6 +46,6 @@ def test_v5l_preserves_nonactivation_boundary() -> None: _raw, result = _canonical(RESULT) assert result["activation_authorized"] is False assert result["production_boundary"] == {"default_q4_formulation":"e4-pl","default_s3_formulation":"legacy-s3","q4_mechanics_unchanged":True} - source = (ROOT / "src/anysolver/elements.py").read_text(encoding="utf-8") + source = (ROOT / "src/anyfesolver/elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source diff --git a/tests/test_e4_pl_s3_v5l_protocol.py b/tests/test_e4_pl_s3_v5l_protocol.py index 9ce46f225..e43395268 100644 --- a/tests/test_e4_pl_s3_v5l_protocol.py +++ b/tests/test_e4_pl_s3_v5l_protocol.py @@ -29,4 +29,4 @@ def test_v5l_protocol_reviewer_is_standard_library_only() -> None: tree = ast.parse(REVIEWER.read_text(encoding="utf-8")) roots = {node.names[0].name.split(".")[0] for node in ast.walk(tree) if isinstance(node, ast.Import)} roots |= {str(node.module).split(".")[0] for node in ast.walk(tree) if isinstance(node, ast.ImportFrom)} - assert not roots & {"anysolver", "numpy", "scipy", "sympy"} + assert not roots & {"anyfesolver", "numpy", "scipy", "sympy"} diff --git a/tests/test_e4_pl_s3_v5l_stage4b.py b/tests/test_e4_pl_s3_v5l_stage4b.py index c9d6ce165..82a874705 100644 --- a/tests/test_e4_pl_s3_v5l_stage4b.py +++ b/tests/test_e4_pl_s3_v5l_stage4b.py @@ -38,7 +38,7 @@ def test_checker_imports_no_production_or_runner() -> None: imports.extend(alias.name for alias in node.names) elif isinstance(node, ast.ImportFrom) and node.module: imports.append(node.module) - assert not any(name == "anysolver" or name.startswith("anysolver.") for name in imports) + assert not any(name == "anyfesolver" or name.startswith("anyfesolver.") for name in imports) assert not any("v5l_stage4b" in name for name in imports) diff --git a/tests/test_e4_pl_s3_v5m_parity.py b/tests/test_e4_pl_s3_v5m_parity.py index 95d1e9efa..797391768 100644 --- a/tests/test_e4_pl_s3_v5m_parity.py +++ b/tests/test_e4_pl_s3_v5m_parity.py @@ -51,7 +51,7 @@ def test_checker_imports_no_production_or_runner() -> None: imports.extend(alias.name for alias in node.names) elif isinstance(node, ast.ImportFrom) and node.module: imports.append(node.module) - assert not any(name == "anysolver" or name.startswith("anysolver.") for name in imports) + assert not any(name == "anyfesolver" or name.startswith("anyfesolver.") for name in imports) assert not any("v5m_parity" in name for name in imports) @@ -71,16 +71,16 @@ def test_bounds_terminal_precedence_and_exact_worker_set_are_frozen() -> None: def test_staged_build_artifact_purge_is_scoped(tmp_path: Path) -> None: runner = _load("_v5m_runner_purge_test", RUNNER) source = tmp_path / "source" - retained = source / "src" / "anysolver" / "module.py" + retained = source / "src" / "anyfesolver" / "module.py" retained.parent.mkdir(parents=True) retained.write_text("retained\n", encoding="ascii") (source / "build" / "lib").mkdir(parents=True) (source / "build" / "lib" / "stale.py").write_text("stale\n", encoding="ascii") - (source / "src" / "ANYsolver.egg-info").mkdir() + (source / "src" / "ANYfeSolver.egg-info").mkdir() outside = tmp_path / "outside.txt" outside.write_text("preserved\n", encoding="ascii") removed = runner._purge_staged_build_artifacts(source) - assert removed == ("build", "src/ANYsolver.egg-info") + assert removed == ("build", "src/ANYfeSolver.egg-info") assert retained.read_text(encoding="ascii") == "retained\n" assert outside.read_text(encoding="ascii") == "preserved\n" diff --git a/tests/test_e4_pl_s3_v5m_protocol.py b/tests/test_e4_pl_s3_v5m_protocol.py index a0152f7cc..36e400161 100644 --- a/tests/test_e4_pl_s3_v5m_protocol.py +++ b/tests/test_e4_pl_s3_v5m_protocol.py @@ -67,6 +67,6 @@ def test_v5m_protocol_reviewer_is_independent_and_empty() -> None: imports.extend(alias.name for alias in node.names) elif isinstance(node, ast.ImportFrom) and node.module: imports.append(node.module) - assert not any(name == "anysolver" or name.startswith("anysolver.") for name in imports) + assert not any(name == "anyfesolver" or name.startswith("anyfesolver.") for name in imports) reviewer = _load("_v5m_protocol_reviewer_test", REVIEWER) assert reviewer.review()["findings"] == [] diff --git a/tests/test_e4_pl_s3_v5n_activation_audit.py b/tests/test_e4_pl_s3_v5n_activation_audit.py index 2e3596cbe..b08311bbb 100644 --- a/tests/test_e4_pl_s3_v5n_activation_audit.py +++ b/tests/test_e4_pl_s3_v5n_activation_audit.py @@ -50,7 +50,7 @@ def test_v5n_auditor_imports_only_standard_library_and_not_mechanics() -> None: imports.extend(alias.name for alias in node.names) elif isinstance(node, ast.ImportFrom) and node.module: imports.append(node.module) - assert not any(name == "anysolver" or name.startswith("anysolver.") for name in imports) + assert not any(name == "anyfesolver" or name.startswith("anyfesolver.") for name in imports) assert set(imports) <= {"__future__", "argparse", "ast", "hashlib", "json", "pathlib", "typing"} diff --git a/tests/test_e4_pl_s3_v6_native_parity_source_authority.py b/tests/test_e4_pl_s3_v6_native_parity_source_authority.py index 68cc4de81..ac41edb3c 100644 --- a/tests/test_e4_pl_s3_v6_native_parity_source_authority.py +++ b/tests/test_e4_pl_s3_v6_native_parity_source_authority.py @@ -80,7 +80,7 @@ def test_v6_authority_imports_only_standard_library_and_not_mechanics() -> None: imports.extend(alias.name for alias in node.names) elif isinstance(node, ast.ImportFrom) and node.module: imports.append(node.module) - assert not any(name == "anysolver" or name.startswith("anysolver.") for name in imports) + assert not any(name == "anyfesolver" or name.startswith("anyfesolver.") for name in imports) assert set(imports) <= { "__future__", "argparse", diff --git a/tests/test_e4_pl_s3_v6a_linear_native_parity_closeout.py b/tests/test_e4_pl_s3_v6a_linear_native_parity_closeout.py index a9f7c596d..4f9a1b577 100644 --- a/tests/test_e4_pl_s3_v6a_linear_native_parity_closeout.py +++ b/tests/test_e4_pl_s3_v6a_linear_native_parity_closeout.py @@ -80,9 +80,9 @@ def test_v6a_authority_commit_has_exact_six_path_extent() -> None: assert sorted(paths) == sorted( [ "docs/reference_cases/e4_pl_s3_v6a_v2d_linear_native_parity_contract.json", - "src/anysolver/__init__.py", - "src/anysolver/e4_pl_s3_v2d_element.py", - "src/anysolver/elements.py", + "src/anyfesolver/__init__.py", + "src/anyfesolver/e4_pl_s3_v2d_element.py", + "src/anyfesolver/elements.py", "tests/test_e4_pl_s3_v2d_linear_native_parity.py", "tests/test_e4_pl_s3_v6a_linear_native_parity_contract.py", ] diff --git a/tests/test_e4_pl_s3_v6a_linear_native_parity_contract.py b/tests/test_e4_pl_s3_v6a_linear_native_parity_contract.py index cc6c14c13..5402e56b5 100644 --- a/tests/test_e4_pl_s3_v6a_linear_native_parity_contract.py +++ b/tests/test_e4_pl_s3_v6a_linear_native_parity_contract.py @@ -49,11 +49,11 @@ def test_v6a_contract_binds_exact_implementation_files() -> None: ).stdout digest = hashlib.sha256(payload).hexdigest().upper() checkout_hash_incident = { - "src/anysolver/__init__.py": ( + "src/anyfesolver/__init__.py": ( 28467, "4BD041459EF7889C77AEE0DC614CD74FB4135239231DFD948F91BDBEE3A6F410", ), - "src/anysolver/elements.py": ( + "src/anyfesolver/elements.py": ( 243788, "B105A62B32D0EB4855E538491FE6B46194F8E43A069591CCEB46D86B157B9053", ), @@ -94,7 +94,7 @@ def test_v6a_contract_is_implementation_only_and_preserves_defaults() -> None: def test_v2d_module_does_not_import_rejected_v1_or_q4_mechanics() -> None: - module = ROOT / "src/anysolver/e4_pl_s3_v2d_element.py" + module = ROOT / "src/anyfesolver/e4_pl_s3_v2d_element.py" tree = ast.parse(module.read_text(encoding="utf-8")) imports: set[str] = set() for node in ast.walk(tree): @@ -103,7 +103,7 @@ def test_v2d_module_does_not_import_rejected_v1_or_q4_mechanics() -> None: elif isinstance(node, ast.ImportFrom) and node.module: imports.add(node.module) assert "e4_pl_s3_element" not in imports - assert "anysolver.e4_pl_s3_element" not in imports + assert "anyfesolver.e4_pl_s3_element" not in imports source = module.read_text(encoding="utf-8") assert "QualifiedE4PLS3ShellElement" not in source assert not any( diff --git a/tests/test_e4_pl_s3_v6b_native_state_corotational_closeout.py b/tests/test_e4_pl_s3_v6b_native_state_corotational_closeout.py index f9612f694..09d79f168 100644 --- a/tests/test_e4_pl_s3_v6b_native_state_corotational_closeout.py +++ b/tests/test_e4_pl_s3_v6b_native_state_corotational_closeout.py @@ -5,7 +5,7 @@ from pathlib import Path import subprocess -import anysolver +import anyfesolver ROOT = Path(__file__).resolve().parents[1] @@ -92,8 +92,8 @@ def test_v6b_result_has_two_clean_cycles_and_only_successor_authority() -> None: "default_s3_formulation": "legacy-s3", "q4_mechanics_unchanged": True, } - assert anysolver.DEFAULT_Q4_FORMULATION == "e4-pl" - assert anysolver.DEFAULT_S3_FORMULATION == "legacy-s3" + assert anyfesolver.DEFAULT_Q4_FORMULATION == "e4-pl" + assert anyfesolver.DEFAULT_S3_FORMULATION == "legacy-s3" def test_v6b_review_is_five_key_empty_p0_p1_and_status_binds_bytes() -> None: diff --git a/tests/test_e4_pl_s3_v6b_native_state_corotational_contract.py b/tests/test_e4_pl_s3_v6b_native_state_corotational_contract.py index db90e6ad1..2586e1f1c 100644 --- a/tests/test_e4_pl_s3_v6b_native_state_corotational_contract.py +++ b/tests/test_e4_pl_s3_v6b_native_state_corotational_contract.py @@ -9,8 +9,8 @@ import numpy as np import pytest -import anysolver -from anysolver.e4_pl_s3_v2d_element import ( +import anyfesolver +from anyfesolver.e4_pl_s3_v2d_element import ( BLOCKED_OPERATIONS, CAPABILITY_MATRIX, COROTATIONAL_POLICY_ID, @@ -21,8 +21,8 @@ NATIVE_STATE_SCHEMA_ID, NativeParityE4PLS3V2DShellElement, ) -from anysolver.e4_pl_s3_v2d_state import V2DStateError, strict_canonical_json_loads -from anysolver.elements import create_shell_element +from anyfesolver.e4_pl_s3_v2d_state import V2DStateError, strict_canonical_json_loads +from anyfesolver.elements import create_shell_element ROOT = Path(__file__).resolve().parents[1] @@ -121,7 +121,7 @@ def test_v6b_identity_capabilities_and_defaults_are_fail_closed() -> None: candidate = contract["candidate"] source = _commit_blob( "afe691759a611278e341be7d58ffaae4f71bde89", - "src/anysolver/e4_pl_s3_v2d_element.py", + "src/anyfesolver/e4_pl_s3_v2d_element.py", ).decode("utf-8") assignments: dict[str, object] = {} for node in ast.parse(source).body: @@ -142,7 +142,7 @@ def test_v6b_identity_capabilities_and_defaults_are_fail_closed() -> None: ] state_source = _commit_blob( "afe691759a611278e341be7d58ffaae4f71bde89", - "src/anysolver/e4_pl_s3_v2d_state.py", + "src/anyfesolver/e4_pl_s3_v2d_state.py", ).decode("utf-8") state_assignments: dict[str, object] = {} for node in ast.parse(state_source).body: @@ -157,8 +157,8 @@ def test_v6b_identity_capabilities_and_defaults_are_fail_closed() -> None: pass assert state_assignments["STATE_SCHEMA"] == candidate["state_schema"] assert state_assignments["STATE_LAYOUT_ID"] == candidate["state_layout_id"] - assert anysolver.DEFAULT_Q4_FORMULATION == "e4-pl" - assert anysolver.DEFAULT_S3_FORMULATION == "legacy-s3" + assert anyfesolver.DEFAULT_Q4_FORMULATION == "e4-pl" + assert anyfesolver.DEFAULT_S3_FORMULATION == "legacy-s3" element = create_shell_element( 1, [1, 2, 3], @@ -198,8 +198,8 @@ def test_v6b_state_json_rejects_duplicate_nonfinite_noncanonical_and_bom() -> No def test_v6b_implementation_does_not_import_qualified_v1_or_q4_mechanics() -> None: modules = {} for relative in ( - "src/anysolver/e4_pl_s3_v2d_element.py", - "src/anysolver/e4_pl_s3_v2d_state.py", + "src/anyfesolver/e4_pl_s3_v2d_element.py", + "src/anyfesolver/e4_pl_s3_v2d_state.py", ): tree = ast.parse((ROOT / relative).read_text(encoding="utf-8")) imported: set[str] = set() @@ -213,7 +213,7 @@ def test_v6b_implementation_does_not_import_qualified_v1_or_q4_mechanics() -> No assert not any(name.endswith("e4_pl_s3_element") for name in all_imports) source = _commit_blob( "afe691759a611278e341be7d58ffaae4f71bde89", - "src/anysolver/e4_pl_s3_v2d_element.py", + "src/anyfesolver/e4_pl_s3_v2d_element.py", ).decode("utf-8") assert "QualifiedE4PLS3ShellElement" not in source # The exact Q4 class is admitted only as a mixed-model registry identity; diff --git a/tests/test_e4_pl_s3_v6c_offset_load_restart.py b/tests/test_e4_pl_s3_v6c_offset_load_restart.py index 7d5d29725..9208d5e7f 100644 --- a/tests/test_e4_pl_s3_v6c_offset_load_restart.py +++ b/tests/test_e4_pl_s3_v6c_offset_load_restart.py @@ -5,21 +5,21 @@ import numpy as np import pytest -from anysolver.boundary import BoundaryCondition, LoadCase -from anysolver.e4_pl_s3_v2d_element import ( +from anyfesolver.boundary import BoundaryCondition, LoadCase +from anyfesolver.e4_pl_s3_v2d_element import ( FORMULATION_ID, NativeParityE4PLS3V2DShellElement, ) -from anysolver.e4_pl_s3_v2d_state import V2DStateError, canonical_json_bytes -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEModel -from anysolver.material_curves import DNVC208MaterialCurve -from anysolver.matrix_assembly import ( +from anyfesolver.e4_pl_s3_v2d_state import V2DStateError, canonical_json_bytes +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.material_curves import DNVC208MaterialCurve +from anyfesolver.matrix_assembly import ( assemble_external_load_tangent, assemble_load_vector, ) -from anysolver.nonlinear_static import solve_static_nonlinear -from anysolver.shell_sections import GeneralizedShellSection +from anyfesolver.nonlinear_static import solve_static_nonlinear +from anyfesolver.shell_sections import GeneralizedShellSection E = 210.0e9 diff --git a/tests/test_e4_pl_s3_v6c_offset_load_restart_closeout.py b/tests/test_e4_pl_s3_v6c_offset_load_restart_closeout.py index 334a83bc2..a8fb94369 100644 --- a/tests/test_e4_pl_s3_v6c_offset_load_restart_closeout.py +++ b/tests/test_e4_pl_s3_v6c_offset_load_restart_closeout.py @@ -5,7 +5,7 @@ from pathlib import Path import subprocess -import anysolver +import anyfesolver ROOT = Path(__file__).resolve().parents[1] @@ -93,8 +93,8 @@ def test_v6c_result_has_two_clean_cycles_and_only_successor_authority() -> None: "default_s3_formulation": "legacy-s3", "q4_mechanics_unchanged": True, } - assert anysolver.DEFAULT_Q4_FORMULATION == "e4-pl" - assert anysolver.DEFAULT_S3_FORMULATION == "legacy-s3" + assert anyfesolver.DEFAULT_Q4_FORMULATION == "e4-pl" + assert anyfesolver.DEFAULT_S3_FORMULATION == "legacy-s3" def test_v6c_review_is_five_key_empty_p0_p1_and_status_binds_bytes() -> None: diff --git a/tests/test_e4_pl_s3_v6c_offset_load_restart_contract.py b/tests/test_e4_pl_s3_v6c_offset_load_restart_contract.py index 79de21d58..107928419 100644 --- a/tests/test_e4_pl_s3_v6c_offset_load_restart_contract.py +++ b/tests/test_e4_pl_s3_v6c_offset_load_restart_contract.py @@ -6,7 +6,7 @@ from pathlib import Path import subprocess -import anysolver +import anyfesolver ROOT = Path(__file__).resolve().parents[1] @@ -96,7 +96,7 @@ def test_v6c_capability_boundary_and_defaults_are_exact() -> None: "distributed_couple", "solver_integrated_hot_restart", } - element_source = _authority_source("src/anysolver/e4_pl_s3_v2d_element.py") + element_source = _authority_source("src/anyfesolver/e4_pl_s3_v2d_element.py") assert all(f'"{name}"' in element_source for name in required) assert set(contract["prohibited_scope"]) == { "qualified_s3_v1_physical_mechanics", @@ -113,7 +113,7 @@ def test_v6c_capability_boundary_and_defaults_are_exact() -> None: # V6W activation intentionally changed the live S3 default to V2D. defaults = { target.id: node.value.value - for node in ast.parse(_authority_source("src/anysolver/elements.py")).body + for node in ast.parse(_authority_source("src/anyfesolver/elements.py")).body if isinstance(node, ast.Assign) and isinstance(node.value, ast.Constant) for target in node.targets if isinstance(target, ast.Name) and target.id in { @@ -127,7 +127,7 @@ def test_v6c_capability_boundary_and_defaults_are_exact() -> None: def test_v6c_implementation_is_native_and_restart_route_is_exactly_scoped() -> None: element_source = _authority_source( - "src/anysolver/e4_pl_s3_v2d_element.py" + "src/anyfesolver/e4_pl_s3_v2d_element.py" ) tree = ast.parse(element_source) imports: set[str] = set() @@ -143,12 +143,12 @@ def test_v6c_implementation_is_native_and_restart_route_is_exactly_scoped() -> N assert "seal_solver_integrated_nonlinear_state" in element_source nonlinear_source = _authority_source( - "src/anysolver/nonlinear_static.py" + "src/anyfesolver/nonlinear_static.py" ) assert nonlinear_source.count("CANDIDATE_E4_PL_S3_V2D_NATIVE_PARITY_V1") == 2 assert "seal_solver_integrated_nonlinear_state" in nonlinear_source boundary_source = _authority_source( - "src/anysolver/boundary.py" + "src/anyfesolver/boundary.py" ) assert boundary_source.count("compute_native_current_pressure_load") == 1 assert boundary_source.count("compute_native_current_pressure_tangent") == 1 diff --git a/tests/test_e4_pl_s3_v6d_activity_contact_batch.py b/tests/test_e4_pl_s3_v6d_activity_contact_batch.py index d34c61cb5..f7f118f5d 100644 --- a/tests/test_e4_pl_s3_v6d_activity_contact_batch.py +++ b/tests/test_e4_pl_s3_v6d_activity_contact_batch.py @@ -5,28 +5,28 @@ import numpy as np import pytest -from anysolver.boundary import BoundaryCondition, LoadCase -from anysolver.contact import ( +from anyfesolver.boundary import BoundaryCondition, LoadCase +from anyfesolver.contact import ( RigidSphereImpact, SphereContactConfig, assemble_sphere_contact_load_vector, ) -from anysolver.e4_pl_s3_v2d_element import ( +from anyfesolver.e4_pl_s3_v2d_element import ( BATCH_POLICY_ID, NativeParityE4PLS3V2DShellElement, ) -from anysolver.e4_pl_s3_v2d_state import ( +from anyfesolver.e4_pl_s3_v2d_state import ( V2DStateError, canonical_json_bytes, seal_v2d_state, ) -from anysolver.fe_core import FEModel -from anysolver.fracture import FractureConfig -from anysolver.material_curves import DNVC208MaterialCurve -from anysolver.matrix_assembly import assemble_stiffness_matrix -from anysolver.nonlinear_static import solve_static_nonlinear -from anysolver.validation import load_vector_resultant -import anysolver.s3_v2d_fast_assembly as v2d_batch +from anyfesolver.fe_core import FEModel +from anyfesolver.fracture import FractureConfig +from anyfesolver.material_curves import DNVC208MaterialCurve +from anyfesolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.nonlinear_static import solve_static_nonlinear +from anyfesolver.validation import load_vector_resultant +import anyfesolver.s3_v2d_fast_assembly as v2d_batch COORDINATES = ((0.0, 0.0, 0.0), (1.2, 0.05, 0.0), (0.2, 0.95, 0.0)) diff --git a/tests/test_e4_pl_s3_v6d_activity_contact_batch_closeout.py b/tests/test_e4_pl_s3_v6d_activity_contact_batch_closeout.py index 142a806a3..65b180780 100644 --- a/tests/test_e4_pl_s3_v6d_activity_contact_batch_closeout.py +++ b/tests/test_e4_pl_s3_v6d_activity_contact_batch_closeout.py @@ -5,7 +5,7 @@ from pathlib import Path import subprocess -import anysolver +import anyfesolver ROOT = Path(__file__).resolve().parents[1] @@ -93,8 +93,8 @@ def test_v6d_result_has_two_clean_cycles_and_only_successor_authority() -> None: "default_s3_formulation": "legacy-s3", "q4_mechanics_unchanged": True, } - assert anysolver.DEFAULT_Q4_FORMULATION == "e4-pl" - assert anysolver.DEFAULT_S3_FORMULATION == "legacy-s3" + assert anyfesolver.DEFAULT_Q4_FORMULATION == "e4-pl" + assert anyfesolver.DEFAULT_S3_FORMULATION == "legacy-s3" def test_v6d_review_is_five_key_empty_p0_p1_and_status_binds_bytes() -> None: diff --git a/tests/test_e4_pl_s3_v6d_activity_contact_batch_contract.py b/tests/test_e4_pl_s3_v6d_activity_contact_batch_contract.py index 8963a9693..0a6c4864b 100644 --- a/tests/test_e4_pl_s3_v6d_activity_contact_batch_contract.py +++ b/tests/test_e4_pl_s3_v6d_activity_contact_batch_contract.py @@ -6,8 +6,8 @@ from pathlib import Path import subprocess -import anysolver -from anysolver.e4_pl_s3_v2d_element import ( +import anyfesolver +from anyfesolver.e4_pl_s3_v2d_element import ( BATCH_POLICY_ID, BLOCKED_OPERATIONS, CAPABILITY_MATRIX, @@ -93,12 +93,12 @@ def test_v6d_capability_boundary_and_defaults_are_exact() -> None: CAPABILITY_MATRIX[name] == "BLOCKED_PENDING_SUCCESSOR_GATE" for name in BLOCKED_OPERATIONS ) - assert anysolver.DEFAULT_Q4_FORMULATION == "e4-pl" - assert anysolver.DEFAULT_S3_FORMULATION == "legacy-s3" + assert anyfesolver.DEFAULT_Q4_FORMULATION == "e4-pl" + assert anyfesolver.DEFAULT_S3_FORMULATION == "legacy-s3" def test_v6d_routes_are_orchestration_only_and_fail_closed() -> None: - element_source = (ROOT / "src/anysolver/e4_pl_s3_v2d_element.py").read_text( + element_source = (ROOT / "src/anyfesolver/e4_pl_s3_v2d_element.py").read_text( encoding="utf-8" ) tree = ast.parse(element_source) @@ -117,7 +117,7 @@ def test_v6d_routes_are_orchestration_only_and_fail_closed() -> None: "native_reference_directors", ): assert route in element_source - batch_source = (ROOT / "src/anysolver/s3_v2d_fast_assembly.py").read_text( + batch_source = (ROOT / "src/anyfesolver/s3_v2d_fast_assembly.py").read_text( encoding="utf-8" ) assert "e4_pl_s3_element" not in batch_source diff --git a/tests/test_e4_pl_s3_v6e_final_parity.py b/tests/test_e4_pl_s3_v6e_final_parity.py index 0d178c528..aec611991 100644 --- a/tests/test_e4_pl_s3_v6e_final_parity.py +++ b/tests/test_e4_pl_s3_v6e_final_parity.py @@ -6,10 +6,10 @@ import numpy as np import pytest -from anysolver.boundary import BoundaryCondition, FixedSupport -from anysolver.buckling import solve_eigenvalue_buckling -from anysolver.dynamics import TransientConfig, solve_transient_newmark -from anysolver.e4_pl_s3_v2d_element import ( +from anyfesolver.boundary import BoundaryCondition, FixedSupport +from anyfesolver.buckling import solve_eigenvalue_buckling +from anyfesolver.dynamics import TransientConfig, solve_transient_newmark +from anyfesolver.e4_pl_s3_v2d_element import ( DYNAMIC_ALGEBRAIC_MASS_WITNESS, DYNAMIC_ALGEBRAIC_POLICY_ID, FORMULATION_ID, @@ -19,15 +19,15 @@ NativeParityCapabilityError, NativeParityE4PLS3V2DShellElement, ) -from anysolver.elements import ( +from anyfesolver.elements import ( DEFAULT_Q4_FORMULATION, DEFAULT_S3_FORMULATION, create_shell_element, shell_element_from_dict, ) -from anysolver.fe_core import FEModel, FEMesh, Material -from anysolver.modal import solve_free_vibration -from anysolver.recovery import recover_stress_result +from anyfesolver.fe_core import FEModel, FEMesh, Material +from anyfesolver.modal import solve_free_vibration +from anyfesolver.recovery import recover_stress_result ROOT = Path(__file__).resolve().parents[1] diff --git a/tests/test_e4_pl_s3_v6e_final_parity_closeout.py b/tests/test_e4_pl_s3_v6e_final_parity_closeout.py index ab856c572..1a9f91c89 100644 --- a/tests/test_e4_pl_s3_v6e_final_parity_closeout.py +++ b/tests/test_e4_pl_s3_v6e_final_parity_closeout.py @@ -87,7 +87,7 @@ def test_v6e_authority_commit_is_reachable_and_exact() -> None: assert subject == "feat: close S3 V2D final production parity" assert paths == [ "docs/reference_cases/e4_pl_s3_v6e_v2d_final_parity_contract.json", - "src/anysolver/e4_pl_s3_v2d_element.py", + "src/anyfesolver/e4_pl_s3_v2d_element.py", "tests/test_e4_pl_s3_v6d_activity_contact_batch_contract.py", "tests/test_e4_pl_s3_v6e_final_parity.py", ] diff --git a/tests/test_e4_pl_s3_v6f_final_parity_audit.py b/tests/test_e4_pl_s3_v6f_final_parity_audit.py index 30e6d5e87..7194efcf8 100644 --- a/tests/test_e4_pl_s3_v6f_final_parity_audit.py +++ b/tests/test_e4_pl_s3_v6f_final_parity_audit.py @@ -41,8 +41,8 @@ def test_v6f_audit_is_standard_library_only() -> None: "typing", } source = AUDIT_PATH.read_text(encoding="utf-8") - assert "import anysolver" not in source - assert "from anysolver" not in source + assert "import anyfesolver" not in source + assert "from anyfesolver" not in source def test_v6f_frozen_audit_preserves_the_three_reviewed_open_routes() -> None: diff --git a/tests/test_e4_pl_s3_v6g_closeout.py b/tests/test_e4_pl_s3_v6g_closeout.py index 35eece211..701164ef5 100644 --- a/tests/test_e4_pl_s3_v6g_closeout.py +++ b/tests/test_e4_pl_s3_v6g_closeout.py @@ -4,7 +4,7 @@ import json from pathlib import Path -from anysolver.elements import DEFAULT_Q4_FORMULATION, DEFAULT_S3_FORMULATION +from anyfesolver.elements import DEFAULT_Q4_FORMULATION, DEFAULT_S3_FORMULATION ROOT = Path(__file__).resolve().parents[1] diff --git a/tests/test_e4_pl_s3_v6g_recovery_current_eigen.py b/tests/test_e4_pl_s3_v6g_recovery_current_eigen.py index ff7d65d82..39950cc32 100644 --- a/tests/test_e4_pl_s3_v6g_recovery_current_eigen.py +++ b/tests/test_e4_pl_s3_v6g_recovery_current_eigen.py @@ -7,25 +7,25 @@ import numpy as np import pytest -from anysolver.boundary import BoundaryCondition, FixedSupport -from anysolver.buckling import solve_eigenvalue_buckling -from anysolver.corotational import corotational_element_response -from anysolver.current_state_tangent import ( +from anyfesolver.boundary import BoundaryCondition, FixedSupport +from anyfesolver.buckling import solve_eigenvalue_buckling +from anyfesolver.corotational import corotational_element_response +from anyfesolver.current_state_tangent import ( S3_V2D_CURRENT_STATE_PROJECTION_POLICY_ID, S3_V2D_CURRENT_STATE_TANGENT_DECOMPOSITION_POLICY_ID, assemble_committed_current_tangent_components, ) -from anysolver.e4_pl_s3_v2d_element import ( +from anyfesolver.e4_pl_s3_v2d_element import ( FORMULATION_ID, IMPLEMENTATION_ID, NativeParityE4PLS3V2DShellElement, ) -from anysolver.e4_pl_s3_v2d_state import canonical_json_bytes -from anysolver.element_capabilities import ElementCapabilityError -from anysolver.elements import DEFAULT_Q4_FORMULATION, DEFAULT_S3_FORMULATION, create_shell_element -from anysolver.fe_core import FEModel -from anysolver.modal import solve_free_vibration -from anysolver.recovery import PatchRecoveryConfig, recover_stress_result +from anyfesolver.e4_pl_s3_v2d_state import canonical_json_bytes +from anyfesolver.element_capabilities import ElementCapabilityError +from anyfesolver.elements import DEFAULT_Q4_FORMULATION, DEFAULT_S3_FORMULATION, create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.modal import solve_free_vibration +from anyfesolver.recovery import PatchRecoveryConfig, recover_stress_result ROOT = Path(__file__).resolve().parents[1] diff --git a/tests/test_e4_pl_s3_v6h_closeout.py b/tests/test_e4_pl_s3_v6h_closeout.py index 3e9a9e159..32766bfc0 100644 --- a/tests/test_e4_pl_s3_v6h_closeout.py +++ b/tests/test_e4_pl_s3_v6h_closeout.py @@ -4,7 +4,7 @@ import json from pathlib import Path -from anysolver.elements import DEFAULT_Q4_FORMULATION, DEFAULT_S3_FORMULATION +from anyfesolver.elements import DEFAULT_Q4_FORMULATION, DEFAULT_S3_FORMULATION ROOT = Path(__file__).resolve().parents[1] diff --git a/tests/test_e4_pl_s3_v6h_stage4a_authority.py b/tests/test_e4_pl_s3_v6h_stage4a_authority.py index 550e3bf45..b6cd36524 100644 --- a/tests/test_e4_pl_s3_v6h_stage4a_authority.py +++ b/tests/test_e4_pl_s3_v6h_stage4a_authority.py @@ -11,7 +11,7 @@ import pytest -from anysolver.elements import DEFAULT_Q4_FORMULATION, DEFAULT_S3_FORMULATION +from anyfesolver.elements import DEFAULT_Q4_FORMULATION, DEFAULT_S3_FORMULATION ROOT = Path(__file__).resolve().parents[1] @@ -82,7 +82,7 @@ def _one_percent_record() -> dict[str, object]: def test_v6h_adapter_builds_exact_v2d_and_restores_public_factory() -> None: - import anysolver.elements as element_factory + import anyfesolver.elements as element_factory adapter = _module(ADAPTER, "v6h_adapter_build") original = element_factory.create_shell_element @@ -111,7 +111,7 @@ def test_v6h_adapter_builds_exact_v2d_and_restores_public_factory() -> None: def test_v6h_adapter_restores_factory_when_model_build_fails() -> None: - import anysolver.elements as element_factory + import anyfesolver.elements as element_factory adapter = _module(ADAPTER, "v6h_adapter_failure") original = element_factory.create_shell_element diff --git a/tests/test_e4_pl_s3_v6i_stage4a_execution_authority.py b/tests/test_e4_pl_s3_v6i_stage4a_execution_authority.py index 86c059a20..92158a1b5 100644 --- a/tests/test_e4_pl_s3_v6i_stage4a_execution_authority.py +++ b/tests/test_e4_pl_s3_v6i_stage4a_execution_authority.py @@ -24,7 +24,7 @@ def _default_formulations() -> dict[str, str]: - tree = ast.parse((ROOT / "src/anysolver/elements.py").read_text(encoding="utf-8")) + tree = ast.parse((ROOT / "src/anyfesolver/elements.py").read_text(encoding="utf-8")) made: dict[str, str] = {} for node in tree.body: if not isinstance(node, (ast.Assign, ast.AnnAssign)): @@ -216,7 +216,7 @@ def test_v6i_request_preview_is_deterministic_but_cannot_publish( "request_id": request_id, "requested_at": "2099-01-01T00:00:00+00:00", "status": "PENDING", - "task": f"ANYsolver S3 V2D Stage 4A bounded wave {wave_index + 1:02d}", + "task": f"ANYfeSolver S3 V2D Stage 4A bounded wave {wave_index + 1:02d}", } raw_request = publisher.canonical_bytes(request) rows.append( @@ -261,7 +261,7 @@ def test_v6i_registered_execution_fails_before_outputs_without_v6j_authority( "request_id": request_id, "requested_at": "FROZEN_BY_SUCCESSOR_AUTHORITY", "status": "PENDING", - "task": "ANYsolver S3 V2D Stage 4A bounded wave 01", + "task": "ANYfeSolver S3 V2D Stage 4A bounded wave 01", } ) ) diff --git a/tests/test_e4_pl_s3_v6i_stage4a_execution_closeout.py b/tests/test_e4_pl_s3_v6i_stage4a_execution_closeout.py index 7c618c016..1775fb3e8 100644 --- a/tests/test_e4_pl_s3_v6i_stage4a_execution_closeout.py +++ b/tests/test_e4_pl_s3_v6i_stage4a_execution_closeout.py @@ -81,7 +81,7 @@ def test_v6i_closeout_authorizes_only_request_preparation() -> None: def test_v6i_closeout_preserves_q4_and_legacy_s3_defaults() -> None: - tree = ast.parse((ROOT / "src/anysolver/elements.py").read_text(encoding="utf-8")) + tree = ast.parse((ROOT / "src/anyfesolver/elements.py").read_text(encoding="utf-8")) defaults: dict[str, str] = {} for node in tree.body: if not isinstance(node, (ast.Assign, ast.AnnAssign)): diff --git a/tests/test_e4_pl_s3_v6j_stage4a_execution_authority.py b/tests/test_e4_pl_s3_v6j_stage4a_execution_authority.py index 68fa81ddc..eb2c03688 100644 --- a/tests/test_e4_pl_s3_v6j_stage4a_execution_authority.py +++ b/tests/test_e4_pl_s3_v6j_stage4a_execution_authority.py @@ -178,7 +178,7 @@ def test_v6j_preserves_production_defaults_and_extent() -> None: path.startswith("docs/reference_cases/") or path.startswith("tests/") for path in contract["authority_commit"]["expected_paths"] ) - tree = ast.parse((ROOT / "src/anysolver/elements.py").read_text(encoding="utf-8")) + tree = ast.parse((ROOT / "src/anyfesolver/elements.py").read_text(encoding="utf-8")) defaults: dict[str, str] = {} for node in tree.body: if not isinstance(node, (ast.Assign, ast.AnnAssign)): diff --git a/tests/test_e4_pl_s3_v6j_stage4a_execution_closeout.py b/tests/test_e4_pl_s3_v6j_stage4a_execution_closeout.py index 323576cde..42ed1b908 100644 --- a/tests/test_e4_pl_s3_v6j_stage4a_execution_closeout.py +++ b/tests/test_e4_pl_s3_v6j_stage4a_execution_closeout.py @@ -98,7 +98,7 @@ def test_v6j_execution_authority_does_not_activate_or_change_defaults() -> None: status = _canonical(STATUS) assert status["activation_authorized"] is False assert status["stage4a_execution_authorized"] is True - tree = ast.parse((ROOT / "src/anysolver/elements.py").read_text(encoding="utf-8")) + tree = ast.parse((ROOT / "src/anyfesolver/elements.py").read_text(encoding="utf-8")) defaults: dict[str, str] = {} for node in tree.body: if not isinstance(node, (ast.Assign, ast.AnnAssign)): diff --git a/tests/test_e4_pl_s3_v6k_stage4a_execution_authority.py b/tests/test_e4_pl_s3_v6k_stage4a_execution_authority.py index feac8452d..53773601a 100644 --- a/tests/test_e4_pl_s3_v6k_stage4a_execution_authority.py +++ b/tests/test_e4_pl_s3_v6k_stage4a_execution_authority.py @@ -155,7 +155,7 @@ def test_v6k_program_is_standard_library_only_and_nonactivating() -> None: "__future__", "argparse", "copy", "hashlib", "importlib", "pathlib", "stat", "sys", "types", "typing", } - elements = ast.parse((ROOT / "src/anysolver/elements.py").read_text(encoding="utf-8")) + elements = ast.parse((ROOT / "src/anyfesolver/elements.py").read_text(encoding="utf-8")) defaults: dict[str, str] = {} for node in elements.body: if not isinstance(node, (ast.Assign, ast.AnnAssign)): diff --git a/tests/test_e4_pl_s3_v6k_stage4a_execution_closeout.py b/tests/test_e4_pl_s3_v6k_stage4a_execution_closeout.py index ca6c62fa6..baa842e9a 100644 --- a/tests/test_e4_pl_s3_v6k_stage4a_execution_closeout.py +++ b/tests/test_e4_pl_s3_v6k_stage4a_execution_closeout.py @@ -98,7 +98,7 @@ def test_v6k_closeout_does_not_activate_or_change_defaults() -> None: status = _canonical(STATUS) assert status["activation_authorized"] is False assert status["stage4a_execution_authorized"] is True - tree = ast.parse((ROOT / "src/anysolver/elements.py").read_text(encoding="utf-8")) + tree = ast.parse((ROOT / "src/anyfesolver/elements.py").read_text(encoding="utf-8")) defaults: dict[str, str] = {} for node in tree.body: if not isinstance(node, (ast.Assign, ast.AnnAssign)): diff --git a/tests/test_e4_pl_s3_v6k_stage4a_request_authority.py b/tests/test_e4_pl_s3_v6k_stage4a_request_authority.py index 3f0e4bc44..f5409c9ac 100644 --- a/tests/test_e4_pl_s3_v6k_stage4a_request_authority.py +++ b/tests/test_e4_pl_s3_v6k_stage4a_request_authority.py @@ -109,7 +109,7 @@ def test_v6k_extent_and_defaults_remain_nonproduction() -> None: path.startswith("docs/reference_cases/") or path.startswith("tests/") for path in contract["authority_commit"]["expected_paths"] ) - tree = ast.parse((ROOT / "src/anysolver/elements.py").read_text(encoding="utf-8")) + tree = ast.parse((ROOT / "src/anyfesolver/elements.py").read_text(encoding="utf-8")) defaults: dict[str, str] = {} for node in tree.body: if not isinstance(node, (ast.Assign, ast.AnnAssign)): diff --git a/tests/test_e4_pl_s3_v6l_stage4a_execution_authority.py b/tests/test_e4_pl_s3_v6l_stage4a_execution_authority.py index b91fe349d..24646ed93 100644 --- a/tests/test_e4_pl_s3_v6l_stage4a_execution_authority.py +++ b/tests/test_e4_pl_s3_v6l_stage4a_execution_authority.py @@ -182,7 +182,7 @@ def test_v6l_rejects_support_mutation_and_preserves_defaults(tmp_path: Path) -> "__future__", "argparse", "copy", "hashlib", "importlib", "json", "os", "pathlib", "shutil", "stat", "sys", "tarfile", "types", "typing", } - elements = ast.parse((ROOT / "src/anysolver/elements.py").read_text(encoding="utf-8")) + elements = ast.parse((ROOT / "src/anyfesolver/elements.py").read_text(encoding="utf-8")) defaults: dict[str, str] = {} for node in elements.body: if not isinstance(node, (ast.Assign, ast.AnnAssign)): diff --git a/tests/test_e4_pl_s3_v6l_stage4a_execution_closeout.py b/tests/test_e4_pl_s3_v6l_stage4a_execution_closeout.py index 6da00c7fb..29f283112 100644 --- a/tests/test_e4_pl_s3_v6l_stage4a_execution_closeout.py +++ b/tests/test_e4_pl_s3_v6l_stage4a_execution_closeout.py @@ -111,7 +111,7 @@ def test_v6l_closeout_does_not_activate_or_change_defaults() -> None: status = _canonical(STATUS) assert status["activation_authorized"] is False assert status["stage4a_execution_authorized"] is True - tree = ast.parse((ROOT / "src/anysolver/elements.py").read_text(encoding="utf-8")) + tree = ast.parse((ROOT / "src/anyfesolver/elements.py").read_text(encoding="utf-8")) defaults: dict[str, str] = {} for node in tree.body: if not isinstance(node, (ast.Assign, ast.AnnAssign)): diff --git a/tests/test_e4_pl_s3_v6n_stage4a_profile.py b/tests/test_e4_pl_s3_v6n_stage4a_profile.py index c642da462..ad82acc0b 100644 --- a/tests/test_e4_pl_s3_v6n_stage4a_profile.py +++ b/tests/test_e4_pl_s3_v6n_stage4a_profile.py @@ -69,7 +69,7 @@ def test_profile_bindings_and_registered_timeout_members() -> None: def test_pressure_surface_traversal_uses_captured_constant_time_guard() -> None: - source_path = ROOT / "src" / "anysolver" / "matrix_assembly.py" + source_path = ROOT / "src" / "anyfesolver" / "matrix_assembly.py" source = source_path.read_text(encoding="utf-8") function_start = source.index("def _qualified_s3_pressure_surface_records(") function_end = source.index("\ndef _assemble_load_vector_under_lease(", function_start) diff --git a/tests/test_e4_pl_s3_v6r_gate_decision.py b/tests/test_e4_pl_s3_v6r_gate_decision.py index 1cdc72949..4fbf30b7e 100644 --- a/tests/test_e4_pl_s3_v6r_gate_decision.py +++ b/tests/test_e4_pl_s3_v6r_gate_decision.py @@ -74,8 +74,8 @@ def test_programs_are_syntax_valid_and_checker_has_no_production_import() -> Non for path in (CHECKER, COORDINATOR): ast.parse(path.read_text(encoding="utf-8")) text = CHECKER.read_text(encoding="utf-8") - assert "from anysolver" not in text - assert "import anysolver" not in text + assert "from anyfesolver" not in text + assert "import anyfesolver" not in text assert "raw_metric_identity_disposition" in text assert "scientific_gate_passed" in text diff --git a/tests/test_e4_pl_s3_v6s_stage4b.py b/tests/test_e4_pl_s3_v6s_stage4b.py index 25e7701ea..57089deff 100644 --- a/tests/test_e4_pl_s3_v6s_stage4b.py +++ b/tests/test_e4_pl_s3_v6s_stage4b.py @@ -66,7 +66,7 @@ def test_checker_imports_no_production_or_runner() -> None: imports.extend(alias.name for alias in node.names) elif isinstance(node, ast.ImportFrom) and node.module: imports.append(node.module) - assert not any(name == "anysolver" or name.startswith("anysolver.") for name in imports) + assert not any(name == "anyfesolver" or name.startswith("anyfesolver.") for name in imports) assert not any("v6s_stage4b" in name for name in imports) @@ -89,7 +89,7 @@ def test_v2d_adapter_is_explicit_and_defaults_are_unchanged() -> None: source = RUNNER.read_text(encoding="utf-8") assert 'formulation="e4-pl-s3-v2d"' in source assert 'CANDIDATE_E4_PL_S3_V2D_NATIVE_PARITY_V1' in source - elements = (ROOT / "src/anysolver/elements.py").read_text(encoding="utf-8") + elements = (ROOT / "src/anyfesolver/elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in elements assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in elements diff --git a/tests/test_e4_pl_s3_v6s_stage4b_closeout.py b/tests/test_e4_pl_s3_v6s_stage4b_closeout.py index ae22f1363..8df500093 100644 --- a/tests/test_e4_pl_s3_v6s_stage4b_closeout.py +++ b/tests/test_e4_pl_s3_v6s_stage4b_closeout.py @@ -42,6 +42,6 @@ def test_v6s_status_binds_result_and_review() -> None: def test_defaults_and_q4_boundary_remain_unchanged() -> None: - source = (ROOT / "src/anysolver/elements.py").read_text(encoding="utf-8") + source = (ROOT / "src/anyfesolver/elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source diff --git a/tests/test_e4_pl_s3_v6t_global_cache.py b/tests/test_e4_pl_s3_v6t_global_cache.py index 1e8b10ec1..cac9bf1ce 100644 --- a/tests/test_e4_pl_s3_v6t_global_cache.py +++ b/tests/test_e4_pl_s3_v6t_global_cache.py @@ -3,11 +3,11 @@ import numpy as np from scipy import sparse -from anysolver.activity import ElementActivity -from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement -from anysolver.fe_core import FEModel -from anysolver.matrix_assembly import assemble_stiffness_matrix -from anysolver.s3_v2d_fast_assembly import V2D_GLOBAL_ASSEMBLY_POLICY_ID +from anyfesolver.activity import ElementActivity +from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement +from anyfesolver.fe_core import FEModel +from anyfesolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.s3_v2d_fast_assembly import V2D_GLOBAL_ASSEMBLY_POLICY_ID def _model(count: int = 4) -> FEModel: diff --git a/tests/test_e4_pl_s3_v6t_global_cache_authority.py b/tests/test_e4_pl_s3_v6t_global_cache_authority.py index d5cacc664..0a81cc4f8 100644 --- a/tests/test_e4_pl_s3_v6t_global_cache_authority.py +++ b/tests/test_e4_pl_s3_v6t_global_cache_authority.py @@ -33,9 +33,9 @@ def test_contract_is_canonical_and_binds_frozen_diagnosis() -> None: def test_diagnosis_is_specific_to_global_reassembly() -> None: - v2c = _git_show("src/anysolver/s3_v2c_fast_assembly.py").decode("utf-8") - v2d = _git_show("src/anysolver/s3_v2d_fast_assembly.py").decode("utf-8") - assembly = _git_show("src/anysolver/matrix_assembly.py").decode("utf-8") + v2c = _git_show("src/anyfesolver/s3_v2c_fast_assembly.py").decode("utf-8") + v2d = _git_show("src/anyfesolver/s3_v2d_fast_assembly.py").decode("utf-8") + assembly = _git_show("src/anyfesolver/matrix_assembly.py").decode("utf-8") assert "lookup_v2c_global_stiffness_plan" in v2c assert "bind_v2c_global_stiffness_plan" in v2c assert "get_v2d_stiffness_plan" in v2d @@ -47,10 +47,10 @@ def test_diagnosis_is_specific_to_global_reassembly() -> None: def test_authority_preserves_defaults_and_limits_extent() -> None: contract = json.loads((REFERENCE / "e4_pl_s3_v6t_global_cache_contract.json").read_text(encoding="ascii")) assert contract["implementation_extent"] == [ - "src/anysolver/matrix_assembly.py", - "src/anysolver/s3_v2d_fast_assembly.py", + "src/anyfesolver/matrix_assembly.py", + "src/anyfesolver/s3_v2d_fast_assembly.py", "tests/test_e4_pl_s3_v6t_global_cache.py", ] - elements = (ROOT / "src/anysolver/elements.py").read_text(encoding="utf-8") + elements = (ROOT / "src/anyfesolver/elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in elements assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in elements diff --git a/tests/test_e4_pl_s3_v6t_global_cache_closeout.py b/tests/test_e4_pl_s3_v6t_global_cache_closeout.py index d0d32c282..c8360bea2 100644 --- a/tests/test_e4_pl_s3_v6t_global_cache_closeout.py +++ b/tests/test_e4_pl_s3_v6t_global_cache_closeout.py @@ -41,6 +41,6 @@ def test_v6t_status_binds_review_and_result() -> None: def test_defaults_remain_frozen() -> None: - source = (ROOT / "src/anysolver/elements.py").read_text(encoding="utf-8") + source = (ROOT / "src/anyfesolver/elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source diff --git a/tests/test_e4_pl_s3_v6u_performance.py b/tests/test_e4_pl_s3_v6u_performance.py index 060e11fb2..19721bf6e 100644 --- a/tests/test_e4_pl_s3_v6u_performance.py +++ b/tests/test_e4_pl_s3_v6u_performance.py @@ -52,7 +52,7 @@ def test_checker_has_no_production_import() -> None: imports.extend(alias.name for alias in node.names) elif isinstance(node, ast.ImportFrom) and node.module: imports.append(node.module) - assert not any(name == "anysolver" or name.startswith("anysolver.") for name in imports) + assert not any(name == "anyfesolver" or name.startswith("anyfesolver.") for name in imports) def test_scope_and_bounds_are_frozen() -> None: @@ -88,6 +88,6 @@ def test_strict_loader_rejects_duplicate_and_nonfinite_json(tmp_path: Path) -> N def test_defaults_remain_unchanged() -> None: - source = (ROOT / "src/anysolver/elements.py").read_text(encoding="utf-8") + source = (ROOT / "src/anyfesolver/elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source diff --git a/tests/test_e4_pl_s3_v6u_performance_closeout.py b/tests/test_e4_pl_s3_v6u_performance_closeout.py index fdde3922d..16f65168f 100644 --- a/tests/test_e4_pl_s3_v6u_performance_closeout.py +++ b/tests/test_e4_pl_s3_v6u_performance_closeout.py @@ -66,6 +66,6 @@ def test_success_closes_only_stage4b_and_preserves_predecessors() -> None: def test_q4_and_s3_defaults_remain_unchanged() -> None: - source = (ROOT / "src/anysolver/elements.py").read_text(encoding="utf-8") + source = (ROOT / "src/anyfesolver/elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source diff --git a/tests/test_e4_pl_s3_v6v_activation_gap_audit.py b/tests/test_e4_pl_s3_v6v_activation_gap_audit.py index b140e434a..37e66455d 100644 --- a/tests/test_e4_pl_s3_v6v_activation_gap_audit.py +++ b/tests/test_e4_pl_s3_v6v_activation_gap_audit.py @@ -81,7 +81,7 @@ def test_checker_imports_no_production_or_runner() -> None: imports.extend(alias.name for alias in node.names) elif isinstance(node, ast.ImportFrom) and node.module: imports.append(node.module) - assert not any(name == "anysolver" or name.startswith("anysolver.") for name in imports) + assert not any(name == "anyfesolver" or name.startswith("anyfesolver.") for name in imports) assert not any("v6v_activation_gap_audit" in name for name in imports) @@ -116,7 +116,7 @@ def test_strict_loader_rejects_duplicate_and_nonfinite(tmp_path: Path) -> None: def test_defaults_and_anymesh_boundary_remain_unchanged() -> None: - source = (ROOT / "src/anysolver/elements.py").read_text(encoding="utf-8") + source = (ROOT / "src/anyfesolver/elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source runner = RUNNER.read_text(encoding="utf-8") diff --git a/tests/test_e4_pl_s3_v6v_activation_gap_closeout.py b/tests/test_e4_pl_s3_v6v_activation_gap_closeout.py index 389860ece..b2448a424 100644 --- a/tests/test_e4_pl_s3_v6v_activation_gap_closeout.py +++ b/tests/test_e4_pl_s3_v6v_activation_gap_closeout.py @@ -42,8 +42,8 @@ def test_v6v_closes_every_registered_audit_gate_without_activation() -> None: assert result["activation_authorized"] is False assert result["checks"]["focused_test_count"] == 42 assert all(value is True for key, value in result["checks"].items() if key != "focused_test_count") - assert result["package"]["anysolver"]["import_from_isolated_target"] is True - assert result["package"]["anysolver"]["round_trip_exact"] is True + assert result["package"]["anyfesolver"]["import_from_isolated_target"] is True + assert result["package"]["anyfesolver"]["round_trip_exact"] is True assert result["next_gate"] == "V6W_FINAL_QUALIFICATION_EVIDENCE_COMPOSITION" diff --git a/tests/test_e4_pl_s3_v6w_final_qualification.py b/tests/test_e4_pl_s3_v6w_final_qualification.py index 446751f9a..1c48781a8 100644 --- a/tests/test_e4_pl_s3_v6w_final_qualification.py +++ b/tests/test_e4_pl_s3_v6w_final_qualification.py @@ -88,6 +88,6 @@ def test_strict_loader_rejects_duplicate_and_nonfinite_json(tmp_path: Path) -> N def test_defaults_remain_unactivated() -> None: - source = (ROOT / "src/anysolver/elements.py").read_text(encoding="utf-8") + source = (ROOT / "src/anyfesolver/elements.py").read_text(encoding="utf-8") assert 'DEFAULT_Q4_FORMULATION = "e4-pl"' in source assert 'DEFAULT_S3_FORMULATION = "legacy-s3"' in source diff --git a/tests/test_e4_pl_transient_authority.py b/tests/test_e4_pl_transient_authority.py index f1b35535f..832ed2094 100644 --- a/tests/test_e4_pl_transient_authority.py +++ b/tests/test_e4_pl_transient_authority.py @@ -3,8 +3,8 @@ import numpy as np import pytest -import anysolver.dynamics as dynamics -from anysolver import ( +import anyfesolver.dynamics as dynamics +from anyfesolver import ( AnalysisSession, BoundaryCondition, ElementActivity, @@ -13,11 +13,11 @@ PressurePatch, TransientConfig, ) -from anysolver.e4_pl_element import QualifiedE4PLShellElement -from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement -from anysolver.element_capabilities import ElementCapabilityError -from anysolver.elements import ShellElement -from anysolver.control import CancellationToken +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement +from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement +from anyfesolver.element_capabilities import ElementCapabilityError +from anyfesolver.elements import ShellElement +from anyfesolver.control import CancellationToken def _qualified_q4_model( diff --git a/tests/test_e4_pl_warped_qualification.py b/tests/test_e4_pl_warped_qualification.py index 2e47ed577..9c790408f 100644 --- a/tests/test_e4_pl_warped_qualification.py +++ b/tests/test_e4_pl_warped_qualification.py @@ -3,12 +3,12 @@ import numpy as np import pytest -import anysolver.e4_pl_element as e4_pl_module -from anysolver.e4_pl_element import QualifiedE4PLShellElement, equation7_frame -from anysolver.elements import ShellElement -from anysolver.fe_core import FEMesh, Material -from anysolver.materials import OrthotropicMaterial -from anysolver.shell_sections import GeneralizedShellSection +import anyfesolver.e4_pl_element as e4_pl_module +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement, equation7_frame +from anyfesolver.elements import ShellElement +from anyfesolver.fe_core import FEMesh, Material +from anyfesolver.materials import OrthotropicMaterial +from anyfesolver.shell_sections import GeneralizedShellSection OPERATIONS = ( diff --git a/tests/test_e4_pl_workflow_parity.py b/tests/test_e4_pl_workflow_parity.py index 3dfb195bf..74655527e 100644 --- a/tests/test_e4_pl_workflow_parity.py +++ b/tests/test_e4_pl_workflow_parity.py @@ -2,7 +2,7 @@ import numpy as np -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContributionPolicy, CoupledBeamShellElement, @@ -22,15 +22,15 @@ solve_linear, solve_transient_newmark, ) -from anysolver.contact import ( +from anyfesolver.contact import ( RigidSphereImpact, SphereContactConfig, assemble_sphere_contact_load_vector, ) -from anysolver.e4_pl_element import QualifiedE4PLShellElement -from anysolver.material_curves import DNVC208MaterialCurve -from anysolver.nonlinear_static import ShellInitialField, solve_static_nonlinear -from anysolver.vectorized_nonlinear import shell_nonlinear_batch_eligible +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement +from anyfesolver.material_curves import DNVC208MaterialCurve +from anyfesolver.nonlinear_static import ShellInitialField, solve_static_nonlinear +from anyfesolver.vectorized_nonlinear import shell_nonlinear_batch_eligible def _candidate_model(*, constrained: bool = False) -> tuple[FEModel, QualifiedE4PLShellElement]: diff --git a/tests/test_e4_route.py b/tests/test_e4_route.py index 2fb4b3b3e..9d0019b82 100644 --- a/tests/test_e4_route.py +++ b/tests/test_e4_route.py @@ -176,7 +176,7 @@ def test_e4_oracles_are_closed_world_standard_library_programs() -> None: elif isinstance(node, ast.ImportFrom) and node.module: imports.add(node.module.split(".")[0]) assert imports <= permitted | {"__future__"} - assert "anysolver" not in imports + assert "anyfesolver" not in imports source = path.read_text(encoding="utf-8") assert "BLOCKED_E4_CONTRACT_NONDETERMINISM_OR_REVIEW" in source assert "allow_nan=False" in source diff --git a/tests/test_element_activity.py b/tests/test_element_activity.py index 55790eb60..569e3aed5 100644 --- a/tests/test_element_activity.py +++ b/tests/test_element_activity.py @@ -7,7 +7,7 @@ import numpy as np import pytest -from anysolver.activity import ( +from anyfesolver.activity import ( ContributionPolicy, CouplingPolicy, CouplingResolutionError, diff --git a/tests/test_element_activity_integration.py b/tests/test_element_activity_integration.py index 9961c6357..5d2e7407f 100644 --- a/tests/test_element_activity_integration.py +++ b/tests/test_element_activity_integration.py @@ -2,7 +2,7 @@ import numpy as np -from anysolver import ( +from anyfesolver import ( ContributionPolicy, ElementActivity, ElementActivityPolicy, diff --git a/tests/test_experimental_csr_assembly.py b/tests/test_experimental_csr_assembly.py index ab43a800c..3a8794c1a 100644 --- a/tests/test_experimental_csr_assembly.py +++ b/tests/test_experimental_csr_assembly.py @@ -2,13 +2,13 @@ import pytest from scipy import sparse -from anysolver.experimental_csr_assembly import ( +from anyfesolver.experimental_csr_assembly import ( CSRPromotionGates, ExperimentalCSRAssemblyPlan, benchmark_experimental_csr_assembly, ) -from anysolver.mesh_gen import generate_beam_mesh, generate_simple_panel_mesh -from anysolver.matrix_assembly import _get_cached_sparsity_pattern +from anyfesolver.mesh_gen import generate_beam_mesh, generate_simple_panel_mesh +from anyfesolver.matrix_assembly import _get_cached_sparsity_pattern @pytest.mark.parametrize( diff --git a/tests/test_external_references.py b/tests/test_external_references.py index f8c5cbb62..c9830828d 100644 --- a/tests/test_external_references.py +++ b/tests/test_external_references.py @@ -10,8 +10,8 @@ import pytest -import anysolver -from anysolver.external_references import ( +import anyfesolver +from anyfesolver.external_references import ( generate_external_reference_cases, generate_external_reference_report, run_calculix_reference_case, @@ -72,8 +72,8 @@ def test_external_reference_execution_api_is_available_from_package_root() -> No "resolve_calculix_executable", "run_calculix_reference_case", } - assert names <= set(anysolver.__all__) - assert all(hasattr(anysolver, name) for name in names) + assert names <= set(anyfesolver.__all__) + assert all(hasattr(anyfesolver, name) for name in names) def test_verification_command_only_executes_calculix_when_explicitly_requested(tmp_path: Path) -> None: diff --git a/tests/test_f06_replay_arithmetic.py b/tests/test_f06_replay_arithmetic.py index 7301bbc7a..53870ea7a 100644 --- a/tests/test_f06_replay_arithmetic.py +++ b/tests/test_f06_replay_arithmetic.py @@ -172,7 +172,7 @@ def test_slot_addition_is_already_exactly_rounded(): # --------------------------------------------------------------------------- # Private P1 reference backend: deterministic fixed-order binary64 LU. -STATE_SOURCE = Path(__file__).resolve().parents[1]/"src/anysolver/_ge_beam3_shell_joint_state.py" +STATE_SOURCE = Path(__file__).resolve().parents[1]/"src/anyfesolver/_ge_beam3_shell_joint_state.py" PROBE_SOURCE = Path(__file__).resolve().parents[1]/"scripts/probe_b3_ge_e4_pl_g0_f06_owned_rebase_v4.py" @@ -326,7 +326,7 @@ def test_reference_solve_is_deterministic_across_repeats_and_rhs_layouts(): def test_coupled_analysis_default_hook_signature_is_unchanged(): - from anysolver._ge_beam3_shell_joint_state import CoupledShellBeamAnalysis + from anyfesolver._ge_beam3_shell_joint_state import CoupledShellBeamAnalysis assert CoupledShellBeamAnalysis.__init__.__kwdefaults__.get( "_linear_solve") is None assert isinstance(REFERENCE_LINEAR_SOLVE_ID, str) and REFERENCE_LINEAR_SOLVE_ID diff --git a/tests/test_fe_solver_anystructure_fem_mode.py b/tests/test_fe_solver_anystructure_fem_mode.py index 55eb3c434..04ce9ff7f 100644 --- a/tests/test_fe_solver_anystructure_fem_mode.py +++ b/tests/test_fe_solver_anystructure_fem_mode.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( AnyStructureFEMConfig, FEModel, QualifiedE4PLS3ShellElement, @@ -14,14 +14,14 @@ recover_prestress_from_static_result, run_anystructure_fem_mode, ) -from anysolver.assembly import solve_linear -from anysolver.e4_pl_s3_element import ( +from anyfesolver.assembly import solve_linear +from anyfesolver.e4_pl_s3_element import ( HOMOGENEOUS_ELASTIC_STRESS_PROFILE_ID, REFERENCE_ELASTIC_BUBBLE_LINEARIZATION_ID, RESULTANT_SUMMARY_POLICY_ID, ) -from anysolver.elements import BeamElement, ShellElement -from anysolver.matrix_assembly import assemble_geometric_stiffness_matrix +from anyfesolver.elements import BeamElement, ShellElement +from anyfesolver.matrix_assembly import assemble_geometric_stiffness_matrix class _Part: @@ -376,7 +376,7 @@ def test_shell_prestress_consumer_rejects_wrong_or_nonfinite_station_fields( stress["bending_resultants"] = bending monkeypatch.setattr( - "anysolver.anystructure_fem_mode.compute_stresses", + "anyfesolver.anystructure_fem_mode.compute_stresses", lambda *_args, **_kwargs: {1: stress}, ) with pytest.raises( @@ -400,7 +400,7 @@ def test_shell_prestress_consumer_prefers_native_resultants_over_stress_fallback membrane = np.arange(21, dtype=float).reshape(7, 3) - 9.0 bending = 0.1 * membrane monkeypatch.setattr( - "anysolver.anystructure_fem_mode.compute_stresses", + "anyfesolver.anystructure_fem_mode.compute_stresses", lambda *_args, **_kwargs: { 1: { "membrane_resultants": membrane, diff --git a/tests/test_fe_solver_architecture.py b/tests/test_fe_solver_architecture.py index d9cdcc16a..98b15355f 100644 --- a/tests/test_fe_solver_architecture.py +++ b/tests/test_fe_solver_architecture.py @@ -4,7 +4,7 @@ import numpy as np -from anysolver import ( +from anyfesolver import ( LoadCase, MeshConfig, PanelGeometry, diff --git a/tests/test_fe_solver_buckling.py b/tests/test_fe_solver_buckling.py index a9d139e7e..d92b69c5c 100644 --- a/tests/test_fe_solver_buckling.py +++ b/tests/test_fe_solver_buckling.py @@ -2,13 +2,13 @@ import pytest from scipy import linalg, sparse -import anysolver.buckling as buckling_module -from anysolver.boundary import BoundaryCondition, LoadCase -from anysolver.buckling import solve_eigenvalue_buckling -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel -from anysolver.linalg import FactorizationCache -from anysolver.matrix_assembly import ( +import anyfesolver.buckling as buckling_module +from anyfesolver.boundary import BoundaryCondition, LoadCase +from anyfesolver.buckling import solve_eigenvalue_buckling +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.linalg import FactorizationCache +from anyfesolver.matrix_assembly import ( _pack_owned_geometric_states, assemble_geometric_stiffness_matrix, ) @@ -681,9 +681,9 @@ def test_repeated_buckling_mode_groups_are_reported_for_symmetric_column(): def test_torsional_column_buckling_matches_wagner_analytic_load(): """Axial compression + weak St. Venant torsion: P_cr = G*J*A/Ip (no warping).""" - from anysolver.boundary import BoundaryCondition - from anysolver.elements import BeamElement, QuadraticBeamElement - from anysolver.fe_core import FEModel + from anyfesolver.boundary import BoundaryCondition + from anyfesolver.elements import BeamElement, QuadraticBeamElement + from anyfesolver.fe_core import FEModel section = {"area": 1.0e-2, "Iy": 1.0e-5, "Iz": 1.0e-5, "J": 1.0e-9} diff --git a/tests/test_fe_solver_capacity_workflow.py b/tests/test_fe_solver_capacity_workflow.py index edcb52a6f..2e45bb271 100644 --- a/tests/test_fe_solver_capacity_workflow.py +++ b/tests/test_fe_solver_capacity_workflow.py @@ -11,15 +11,15 @@ import pytest -from anysolver.boundary import BoundaryCondition, LoadCase -from anysolver.capacity_workflow import ( +from anyfesolver.boundary import BoundaryCondition, LoadCase +from anyfesolver.capacity_workflow import ( CapacityWorkflowConfig, evaluate_mode_mesh_adequacy, run_nonlinear_capacity_workflow, write_capacity_workflow_report, ) -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel def _beam_column_model(num_elements: int = 6) -> FEModel: diff --git a/tests/test_fe_solver_contact.py b/tests/test_fe_solver_contact.py index 78dc0c9b4..8dc55281d 100644 --- a/tests/test_fe_solver_contact.py +++ b/tests/test_fe_solver_contact.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, CoupledBeamShellElement, ImpactDamageConfig, @@ -20,11 +20,11 @@ validate_contact_configuration, create_shell_element, ) -from anysolver.contact import _impact_contact_patch_area, _update_impact_damage_states -from anysolver.recovery import RecoveryConfig -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel -from anysolver.validation import load_vector_resultant +from anyfesolver.contact import _impact_contact_patch_area, _update_impact_damage_states +from anyfesolver.recovery import RecoveryConfig +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.validation import load_vector_resultant def _contact_panel(stiffener: bool = False) -> FEModel: @@ -824,7 +824,7 @@ def _beam_bridge() -> FEModel: def test_impact_fracture_erodes_struck_beam_target() -> None: """Impact fracture (contact-force trigger) erodes beam contact targets, not just shells.""" - from anysolver.fracture import ImpactFractureConfig + from anyfesolver.fracture import ImpactFractureConfig def _beam_bridge() -> FEModel: model = FEModel("frac_bridge") @@ -858,7 +858,7 @@ def _beam_bridge() -> FEModel: def test_capacity_impact_damage_warns_it_skips_beam_contact_targets() -> None: - from anysolver.fracture import ImpactDamageConfig + from anyfesolver.fracture import ImpactDamageConfig model = FEModel("mixed_damage") model.add_material("steel", 2.1e11, 0.3, density=7850.0) diff --git a/tests/test_fe_solver_corotational_beam.py b/tests/test_fe_solver_corotational_beam.py index 17c24c85d..bb3f77a13 100644 --- a/tests/test_fe_solver_corotational_beam.py +++ b/tests/test_fe_solver_corotational_beam.py @@ -12,9 +12,9 @@ import numpy as np import pytest -from anysolver.beam_validity import generate_beam_validity_report -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel +from anyfesolver.beam_validity import generate_beam_validity_report +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel E = 210.0e9 diff --git a/tests/test_fe_solver_cylinder_benchmarks.py b/tests/test_fe_solver_cylinder_benchmarks.py index 2183374f9..6a7116f9d 100644 --- a/tests/test_fe_solver_cylinder_benchmarks.py +++ b/tests/test_fe_solver_cylinder_benchmarks.py @@ -5,13 +5,13 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( CylinderBenchmarkConfig, build_cylindrical_shell_benchmark_model, nominal_cylinder_membrane_stress, run_cylindrical_shell_benchmark, ) -from anysolver.elements import ShellElement +from anyfesolver.elements import ShellElement def test_nominal_cylinder_membrane_stress_reports_hoop_axial_and_von_mises() -> None: diff --git a/tests/test_fe_solver_dynamics.py b/tests/test_fe_solver_dynamics.py index aa2e00a2c..a00d22e4c 100644 --- a/tests/test_fe_solver_dynamics.py +++ b/tests/test_fe_solver_dynamics.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( LoadCase, PressurePatch, TransientConfig, @@ -13,10 +13,10 @@ generate_simple_panel_mesh, solve_transient_newmark, ) -from anysolver.boundary import BoundaryCondition, FixedSupport -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel -from anysolver.validation import load_vector_resultant +from anyfesolver.boundary import BoundaryCondition, FixedSupport +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.validation import load_vector_resultant def test_pressure_patch_centroid_selection_and_resultant() -> None: diff --git a/tests/test_fe_solver_element_qualification.py b/tests/test_fe_solver_element_qualification.py index be66c3a83..66b552ef9 100644 --- a/tests/test_fe_solver_element_qualification.py +++ b/tests/test_fe_solver_element_qualification.py @@ -12,7 +12,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( beam_qualification_metrics, generate_element_qualification_report, q4_q8_convergence_cost_sweep, @@ -25,8 +25,8 @@ q8r_patch_metric, reference_q8_geometries, ) -from anysolver.elements import ShellElement -from anysolver.fe_core import FEModel +from anyfesolver.elements import ShellElement +from anyfesolver.fe_core import FEModel def test_q8_free_element_has_six_rigid_modes_for_reference_geometries() -> None: diff --git a/tests/test_fe_solver_element_quality.py b/tests/test_fe_solver_element_quality.py index 52b9257dc..c689c5e55 100644 --- a/tests/test_fe_solver_element_quality.py +++ b/tests/test_fe_solver_element_quality.py @@ -11,13 +11,13 @@ import numpy as np import pytest -from anysolver.fe_core import FEModel -from anysolver.elements import BeamElement, QuadraticBeamElement, create_shell_element -from anysolver.boundary import BoundaryCondition, FixedSupport, LoadCase -from anysolver.assembly import compute_stresses, solve_linear -from anysolver.buckling import solve_eigenvalue_buckling -from anysolver.mesh_gen import StiffenerCrossSection -from anysolver.nonlinear import solve_nonlinear_load_stepping +from anyfesolver.fe_core import FEModel +from anyfesolver.elements import BeamElement, QuadraticBeamElement, create_shell_element +from anyfesolver.boundary import BoundaryCondition, FixedSupport, LoadCase +from anyfesolver.assembly import compute_stresses, solve_linear +from anyfesolver.buckling import solve_eigenvalue_buckling +from anyfesolver.mesh_gen import StiffenerCrossSection +from anyfesolver.nonlinear import solve_nonlinear_load_stepping E = 210.0e9 NU = 0.3 diff --git a/tests/test_fe_solver_fracture.py b/tests/test_fe_solver_fracture.py index 907674715..183b2351d 100644 --- a/tests/test_fe_solver_fracture.py +++ b/tests/test_fe_solver_fracture.py @@ -6,18 +6,18 @@ import numpy as np import pytest -from anysolver.boundary import BoundaryCondition, FixedSupport, LoadCase -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEModel -from anysolver.fracture import ( +from anyfesolver.boundary import BoundaryCondition, FixedSupport, LoadCase +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.fracture import ( FractureConfig, deleted_pressure_load_resultant, filtered_load_case_for_deleted_elements, ) -from anysolver.material_curves import DNVC208MaterialCurve -from anysolver.matrix_assembly import assemble_load_vector -from anysolver.nonlinear_static import _assemble_nonlinear_system, solve_static_nonlinear -from anysolver.nonlinear_restart import canonical_checkpoint_json_bytes +from anyfesolver.material_curves import DNVC208MaterialCurve +from anyfesolver.matrix_assembly import assemble_load_vector +from anyfesolver.nonlinear_static import _assemble_nonlinear_system, solve_static_nonlinear +from anyfesolver.nonlinear_restart import canonical_checkpoint_json_bytes E = 210.0e9 @@ -162,7 +162,7 @@ def test_max_deleted_fraction_stops_after_converged_deletion() -> None: def test_fracture_displacement_control_is_explicitly_unsupported() -> None: - from anysolver.nonlinear_static import DisplacementControl + from anyfesolver.nonlinear_static import DisplacementControl model = _one_shell_model() with pytest.raises(ValueError, match="force control"): diff --git a/tests/test_fe_solver_infrastructure.py b/tests/test_fe_solver_infrastructure.py index 7dc11abb5..113845d57 100644 --- a/tests/test_fe_solver_infrastructure.py +++ b/tests/test_fe_solver_infrastructure.py @@ -17,10 +17,10 @@ import pytest from scipy import sparse -import anysolver -import anysolver.assembly as assembly_module -import anysolver.linalg as linalg -from anysolver import ( +import anyfesolver +import anyfesolver.assembly as assembly_module +import anyfesolver.linalg as linalg +from anyfesolver import ( AssemblyError, FactorizationCache, LoadCase, @@ -37,18 +37,18 @@ solve_linear_many, solve_transient_newmark, ) -from anysolver.assembly import build_constraint_transformation, build_reduced_rigid_body_modes -from anysolver.baselines import compare_baseline_documents, generate_baseline_document -from anysolver.linalg import _HAS_PYPARDISO, AutoSparseSolverBackend -from anysolver.boundary import BoundaryCondition, FixedSupport -from anysolver.buckling import solve_eigenvalue_buckling -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel -from anysolver.nonlinear_static import solve_static_nonlinear +from anyfesolver.assembly import build_constraint_transformation, build_reduced_rigid_body_modes +from anyfesolver.baselines import compare_baseline_documents, generate_baseline_document +from anyfesolver.linalg import _HAS_PYPARDISO, AutoSparseSolverBackend +from anyfesolver.boundary import BoundaryCondition, FixedSupport +from anyfesolver.buckling import solve_eigenvalue_buckling +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.nonlinear_static import solve_static_nonlinear def test_public_all_symbols_importable() -> None: - missing = [name for name in anysolver.__all__ if not hasattr(anysolver, name)] + missing = [name for name in anyfesolver.__all__ if not hasattr(anyfesolver, name)] assert missing == [] @@ -132,9 +132,9 @@ def test_root_import_does_not_eagerly_load_optional_accelerators() -> None: if path ) code = ( - "import sys; import anysolver; " + "import sys; import anyfesolver; " "assert 'pypardiso' not in sys.modules; " - "assert 'anysolver.nonlinear_performance' not in sys.modules" + "assert 'anyfesolver.nonlinear_performance' not in sys.modules" ) completed = subprocess.run( [sys.executable, "-c", code], @@ -191,7 +191,7 @@ def test_default_sparse_backend_uses_superlu_for_small_matrices_and_can_force_py def test_pypardiso_backend_symmetric_mtypes_pattern_reuse_and_stale_handles() -> None: if not _HAS_PYPARDISO: pytest.skip("pypardiso not installed") - from anysolver.linalg import PyPardisoSolverBackend + from anyfesolver.linalg import PyPardisoSolverBackend backend = PyPardisoSolverBackend(max_pattern_slots=2) rng = np.random.default_rng(0) diff --git a/tests/test_fe_solver_mass_modal.py b/tests/test_fe_solver_mass_modal.py index 191974c33..cdb126974 100644 --- a/tests/test_fe_solver_mass_modal.py +++ b/tests/test_fe_solver_mass_modal.py @@ -13,9 +13,9 @@ import pytest from scipy import sparse -import anysolver.modal as modal_module +import anyfesolver.modal as modal_module -from anysolver import ( +from anyfesolver import ( BoundaryCondition, FEModel, FactorizationCache, @@ -24,8 +24,8 @@ generate_simple_panel_mesh, solve_free_vibration, ) -from anysolver.boundary import LoadCase, LoadCombination -from anysolver.elements import BeamElement +from anyfesolver.boundary import LoadCase, LoadCombination +from anyfesolver.elements import BeamElement def _axial_bar_model() -> FEModel: @@ -335,9 +335,9 @@ def _cantilever(n: int, consistent: bool) -> FEModel: def test_point_mass_enters_mass_matrix_and_shifts_frequency() -> None: """model.add_point_mass augments M (modal/dynamic) and the acceleration load.""" - from anysolver.boundary import LoadCase - from anysolver.elements import create_shell_element - from anysolver.matrix_assembly import assemble_load_vector, assemble_mass_matrix + from anyfesolver.boundary import LoadCase + from anyfesolver.elements import create_shell_element + from anyfesolver.matrix_assembly import assemble_load_vector, assemble_mass_matrix def _plate(add_mass: float = 0.0): model = FEModel("pm") diff --git a/tests/test_fe_solver_nonlinear_dnv.py b/tests/test_fe_solver_nonlinear_dnv.py index 3b435b767..4307201ab 100644 --- a/tests/test_fe_solver_nonlinear_dnv.py +++ b/tests/test_fe_solver_nonlinear_dnv.py @@ -5,11 +5,11 @@ import numpy as np import pytest -from anysolver.boundary import BoundaryCondition, FixedSupport, LoadCase -from anysolver.buckling import BucklingMode, BucklingResult -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel -from anysolver.imperfections import ( +from anyfesolver.boundary import BoundaryCondition, FixedSupport, LoadCase +from anyfesolver.buckling import BucklingMode, BucklingResult +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.imperfections import ( ImperfectionField, apply_imperfection, imperfection_from_buckling_mode, @@ -17,13 +17,13 @@ standard_member_bow, standard_plate_mode, ) -from anysolver.material_curves import ( +from anyfesolver.material_curves import ( DNVC208MaterialCurve, FiberSectionPlasticityConfig, dnv_c208_steel_curve, dnv_c208_steel_properties, ) -from anysolver.nonlinear_static import ( +from anyfesolver.nonlinear_static import ( DisplacementControl, NonlinearLoadProgram, NonlinearLoadStage, @@ -74,7 +74,7 @@ def test_runtime_dnv_properties_facade_matches_canonical_table( thickness: float, thickness_class: str, ) -> None: - from anysolver.runtime import dnv_c208_steel_properties as runtime_dnv_c208_steel_properties + from anyfesolver.runtime import dnv_c208_steel_properties as runtime_dnv_c208_steel_properties canonical = dnv_c208_steel_properties(grade, thickness, thickness_class=thickness_class) runtime = runtime_dnv_c208_steel_properties(grade, thickness, thickness_class=thickness_class) diff --git a/tests/test_fe_solver_nonlinear_limit_point.py b/tests/test_fe_solver_nonlinear_limit_point.py index ff79eae57..499168cd7 100644 --- a/tests/test_fe_solver_nonlinear_limit_point.py +++ b/tests/test_fe_solver_nonlinear_limit_point.py @@ -1,11 +1,11 @@ import numpy as np import pytest -from anysolver.boundary import BoundaryCondition, LoadCase -from anysolver.buckling import solve_eigenvalue_buckling -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel -from anysolver.nonlinear import solve_nonlinear_load_stepping +from anyfesolver.boundary import BoundaryCondition, LoadCase +from anyfesolver.buckling import solve_eigenvalue_buckling +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.nonlinear import solve_nonlinear_load_stepping def _beam_column_model(num_elements=8): diff --git a/tests/test_fe_solver_nonlinear_static.py b/tests/test_fe_solver_nonlinear_static.py index f37b47966..577a7c32f 100644 --- a/tests/test_fe_solver_nonlinear_static.py +++ b/tests/test_fe_solver_nonlinear_static.py @@ -17,14 +17,14 @@ import numpy as np import pytest -from anysolver.fe_core import FEModel -from anysolver.elements import BeamElement, create_shell_element -from anysolver.boundary import BoundaryCondition, FixedSupport, LoadCase -from anysolver.assembly import solve_linear -from anysolver.material_curves import DNVC208MaterialCurve -from anysolver.plasticity import lobatto_layers -from anysolver.nonlinear_static import NonlinearConvergenceSettings, solve_static_nonlinear -from anysolver.recovery import ResourceConfig +from anyfesolver.fe_core import FEModel +from anyfesolver.elements import BeamElement, create_shell_element +from anyfesolver.boundary import BoundaryCondition, FixedSupport, LoadCase +from anyfesolver.assembly import solve_linear +from anyfesolver.material_curves import DNVC208MaterialCurve +from anyfesolver.plasticity import lobatto_layers +from anyfesolver.nonlinear_static import NonlinearConvergenceSettings, solve_static_nonlinear +from anyfesolver.recovery import ResourceConfig E = 210.0e9 NU = 0.3 @@ -367,7 +367,7 @@ def __exit__(self, exc_type, exc, tb): calls.append(("exit", self.thread_count)) return False - import anysolver.nonlinear_static as nonlinear_static_module + import anyfesolver.nonlinear_static as nonlinear_static_module monkeypatch.setattr( nonlinear_static_module, diff --git a/tests/test_fe_solver_plasticity_qualification.py b/tests/test_fe_solver_plasticity_qualification.py index 16bdffe0d..76449cc6c 100644 --- a/tests/test_fe_solver_plasticity_qualification.py +++ b/tests/test_fe_solver_plasticity_qualification.py @@ -9,16 +9,16 @@ import sys from pathlib import Path -from anysolver import ( +from anyfesolver import ( element_tangent_metrics, generate_plasticity_qualification_report, material_point_path_metrics, reference_plastic_curve, yield_function_residual, ) -from anysolver.plasticity import plane_stress_return_map -from anysolver.elements import _jit_integrate_nonlinear_response -from anysolver.vectorized_nonlinear import _jit_batch_integrate_nonlinear_response +from anyfesolver.plasticity import plane_stress_return_map +from anyfesolver.elements import _jit_integrate_nonlinear_response +from anyfesolver.vectorized_nonlinear import _jit_batch_integrate_nonlinear_response import numpy as np diff --git a/tests/test_fe_solver_recovery_policy.py b/tests/test_fe_solver_recovery_policy.py index da3a8308f..c7e0df22a 100644 --- a/tests/test_fe_solver_recovery_policy.py +++ b/tests/test_fe_solver_recovery_policy.py @@ -9,7 +9,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( LoadCase, RecoveryConfig, ResourcePolicyError, @@ -24,9 +24,9 @@ select_node_displacements, solve_transient_newmark, ) -from anysolver.boundary import BoundaryCondition, FixedSupport -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel +from anyfesolver.boundary import BoundaryCondition, FixedSupport +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel def test_recovery_config_selects_nodes_elements_and_components() -> None: diff --git a/tests/test_fe_solver_reference_cases.py b/tests/test_fe_solver_reference_cases.py index 58bbe864f..d953a2c40 100644 --- a/tests/test_fe_solver_reference_cases.py +++ b/tests/test_fe_solver_reference_cases.py @@ -9,7 +9,7 @@ import numpy as np -from anysolver import ( +from anyfesolver import ( FEModel, classify_reference_case_from_nodes, compare_shell_benchmark_to_reference, @@ -26,8 +26,8 @@ upstream_calculix_shell_reference_values, write_external_reference_report, ) -from anysolver.boundary import LoadCase -from anysolver.elements import BeamElement +from anyfesolver.boundary import LoadCase +from anyfesolver.elements import BeamElement def _make_reference_temp_dir() -> Path: @@ -36,7 +36,7 @@ def _make_reference_temp_dir() -> Path: A runner can set TMP/TEMP to an accessible external evidence root on Windows. Existing repository-local evidence is never reused or removed. """ - return Path(tempfile.mkdtemp(prefix="anysolver-reference-cases-")) + return Path(tempfile.mkdtemp(prefix="anyfesolver-reference-cases-")) def test_reference_case_discovery_finds_local_inp_frd_pair() -> None: diff --git a/tests/test_fe_solver_s4_validity.py b/tests/test_fe_solver_s4_validity.py index 06966eeb7..b9c56e7f1 100644 --- a/tests/test_fe_solver_s4_validity.py +++ b/tests/test_fe_solver_s4_validity.py @@ -9,7 +9,7 @@ import sys from pathlib import Path -from anysolver.s4_validity import ( +from anyfesolver.s4_validity import ( bending_patch_metric, free_element_mode_metric, generate_s4_validity_report, diff --git a/tests/test_fe_solver_shell_verification.py b/tests/test_fe_solver_shell_verification.py index d3e18d8bb..f3e13a1a8 100644 --- a/tests/test_fe_solver_shell_verification.py +++ b/tests/test_fe_solver_shell_verification.py @@ -11,7 +11,7 @@ import numpy as np import pytest -from anysolver import assemble_stiffness_matrix, generate_simple_panel_mesh, shell_element_patch_summary +from anyfesolver import assemble_stiffness_matrix, generate_simple_panel_mesh, shell_element_patch_summary @pytest.mark.parametrize("use_8node_elements", [False, True]) diff --git a/tests/test_fe_solver_theory.py b/tests/test_fe_solver_theory.py index d7e404830..9eca8bfac 100644 --- a/tests/test_fe_solver_theory.py +++ b/tests/test_fe_solver_theory.py @@ -2,7 +2,7 @@ import pytest from scipy import sparse -from anysolver.assembly import ( +from anyfesolver.assembly import ( _orthonormalize_columns, assemble_mass_matrix, assemble_system, @@ -11,15 +11,15 @@ reconstruct_full_solution, solve_linear, ) -from anysolver.boundary import FixedSupport, LoadCase -from anysolver.elements import ( +from anyfesolver.boundary import FixedSupport, LoadCase +from anyfesolver.elements import ( BeamElement, CoupledBeamShellElement, ShellElement, create_shell_element, ) -from anysolver.fe_core import FEModel -from anysolver.mesh_gen import StiffenerCrossSection, generate_beam_mesh +from anyfesolver.fe_core import FEModel +from anyfesolver.mesh_gen import StiffenerCrossSection, generate_beam_mesh def _steel_model(name="model"): diff --git a/tests/test_fe_solver_triangular_shell.py b/tests/test_fe_solver_triangular_shell.py index a4ce969dd..8849e0f99 100644 --- a/tests/test_fe_solver_triangular_shell.py +++ b/tests/test_fe_solver_triangular_shell.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( AnyStructureFEMConfig, FEModel, LoadCase, diff --git a/tests/test_fe_solver_triangular_shell_backend.py b/tests/test_fe_solver_triangular_shell_backend.py index 66ae9edd3..63b215bd3 100644 --- a/tests/test_fe_solver_triangular_shell_backend.py +++ b/tests/test_fe_solver_triangular_shell_backend.py @@ -5,8 +5,8 @@ import numpy as np import pytest -from anysolver import runtime as runtime_fe_solver -from anysolver import ( +from anyfesolver import runtime as runtime_fe_solver +from anyfesolver import ( AnyStructureFEMConfig, FEModel, LoadCase, diff --git a/tests/test_floating_pressure_regions.py b/tests/test_floating_pressure_regions.py index e746f557e..443d80cb2 100644 --- a/tests/test_floating_pressure_regions.py +++ b/tests/test_floating_pressure_regions.py @@ -2,10 +2,10 @@ import numpy as np import pytest -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEModel -from anysolver.floating_pressure_regions import full_element_vectors, region_nodal_vectors -from anysolver.pressure_regions import PressureRegionError, region_wrench, wet_region_load +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.floating_pressure_regions import full_element_vectors, region_nodal_vectors +from anyfesolver.pressure_regions import PressureRegionError, region_wrench, wet_region_load RHO_G = 1000.0 @@ -76,7 +76,7 @@ def test_regions_tiling_the_element_reproduce_the_whole_element_load(): def test_owner_kernel_equivalence_proof_gates_the_region_integration_and_is_reused_only_for_identical_elements(monkeypatch): - import anysolver.floating_pressure_regions as module + import anyfesolver.floating_pressure_regions as module corners = [(0., 0., 0.), (2., 0., 0.), (2., 0., 2.), (0., 0., 2.)] mesh, element = build(corners) tri = np.array([[(0, 0, 0), (1, 0, 0), (0, 0, 1)]], float) @@ -99,7 +99,7 @@ def test_owner_kernel_equivalence_proof_gates_the_region_integration_and_is_reus def test_a_failed_owner_equivalence_proof_refuses_the_region_load(monkeypatch): - import anysolver.floating_pressure_regions as module + import anyfesolver.floating_pressure_regions as module corners = [(0., 0., 0.), (2., 0., 0.), (2., 0., 2.), (0., 0., 2.)] mesh, element = build(corners) tri = np.array([[(0, 0, 0), (1, 0, 0), (0, 0, 1)]], float) diff --git a/tests/test_floating_response.py b/tests/test_floating_response.py index 7aa38f809..32fe60a22 100644 --- a/tests/test_floating_response.py +++ b/tests/test_floating_response.py @@ -2,7 +2,7 @@ import numpy as np import pytest -from anysolver import floating_response as fr +from anyfesolver import floating_response as fr RHO, G = 1025.0, 9.81 diff --git a/tests/test_floating_transient.py b/tests/test_floating_transient.py index 640fc044b..0f705049c 100644 --- a/tests/test_floating_transient.py +++ b/tests/test_floating_transient.py @@ -3,14 +3,14 @@ import pytest from scipy.integrate import solve_ivp -from anysolver.floating_transient import ( +from anyfesolver.floating_transient import ( FloatingTransientError, FloatingTransientResourceConfig, FloatingTransientSpec, solve_floating_transient, waterline_guard, ) -from anysolver.marine_linear import MarineLinearSpec, solve_marine_linear +from anyfesolver.marine_linear import MarineLinearSpec, solve_marine_linear def _grid(dt, duration): @@ -589,7 +589,7 @@ def test_both_adjacent_slopes_are_reported_at_a_curve_knot(): def test_result_carries_digests_of_the_actual_kernel_and_ainf(): - from anysolver.floating_transient import numeric_array_digest + from anyfesolver.floating_transient import numeric_array_digest kern = np.zeros((2, 6, 6)); kern[0] = 5.0 * np.eye(6) res = solve_floating_transient(_spec(duration=0.1, added=7.0, radiation_kernel=kern, kernel_horizon=0.01)) assert res.kernel_digest == numeric_array_digest(kern) and res.ainf_digest == numeric_array_digest(7.0 * np.eye(6)) @@ -601,7 +601,7 @@ def test_result_carries_digests_of_the_actual_kernel_and_ainf(): def _active_kernel_spec(mode, c=1.0e-3): """Kernel K(t) = -c exp(-t) I (an ACTIVE, non-passive memory): Herm Z(w) = -c/(1+w^2) I, so the normalised non-passivity at w = 0.1 is ~ c/(1.01 * 0.1 * M) >> 1e-3 for M = 1.""" - from anysolver.floating_transient import numeric_array_digest + from anyfesolver.floating_transient import numeric_array_digest dt, n_k = 0.01, 101 tk = np.arange(n_k) * dt w = np.clip(1.0 - tk / tk[-1], 0.0, None) # exactly zero endpoint (windowed) @@ -617,7 +617,7 @@ def _active_kernel_spec(mode, c=1.0e-3): def test_development_unverified_retains_the_failed_passivity_gate_instead_of_refusing(): - from anysolver.floating_transient import BoundedNativeAdmissionError + from anyfesolver.floating_transient import BoundedNativeAdmissionError with pytest.raises(BoundedNativeAdmissionError, match="non-passivity"): solve_floating_transient(_active_kernel_spec("bounded_native")) # bounded mode unchanged: refused res = solve_floating_transient(_active_kernel_spec("development_unverified")) @@ -629,14 +629,14 @@ def test_development_unverified_retains_the_failed_passivity_gate_instead_of_ref def test_development_mode_keeps_every_other_gate(): - from anysolver.floating_transient import BoundedNativeAdmissionError + from anyfesolver.floating_transient import BoundedNativeAdmissionError spec = _active_kernel_spec("development_unverified") bad = dict(spec.native_source_binding); bad["kernel_digest"] = "0" * 64 from dataclasses import replace with pytest.raises(BoundedNativeAdmissionError, match="binding"): solve_floating_transient(replace(spec, native_source_binding=bad)) A = spec.added_mass_infinite.copy(); A[0, 1] += 0.1; A[1, 0] -= 0.1 # large mass skew: rho >> 1e-3 - from anysolver.floating_transient import numeric_array_digest + from anyfesolver.floating_transient import numeric_array_digest b2 = dict(spec.native_source_binding); b2["ainf_digest"] = numeric_array_digest(A) with pytest.raises(BoundedNativeAdmissionError, match="rho"): solve_floating_transient(replace(spec, added_mass_infinite=A, native_source_binding=b2)) @@ -645,7 +645,7 @@ def test_development_mode_keeps_every_other_gate(): def test_complex_inputs_are_refused_before_any_float_cast(): import warnings from dataclasses import replace - from anysolver.floating_transient import numeric_array_digest + from anyfesolver.floating_transient import numeric_array_digest cx = lambda x: np.asarray(x) * (1.0 + 0j) # zero imaginary part is still complex base = _spec(duration=0.1) with warnings.catch_warnings(): @@ -678,7 +678,7 @@ def test_complex_inputs_are_refused_before_any_float_cast(): def test_digest_is_incremental_and_equals_the_reference_protocol(): import hashlib - from anysolver.floating_transient import numeric_array_digest + from anyfesolver.floating_transient import numeric_array_digest rng = np.random.default_rng(1) for shape in ((5,), (2, 3), (3, 40000), (1, 6, 6)): # one shape exceeds a 65536-element chunk x = rng.standard_normal(shape) @@ -693,7 +693,7 @@ def test_digest_is_incremental_and_equals_the_reference_protocol(): def test_digest_of_a_transposed_strided_array_has_no_full_copy_and_matches_the_protocol(): import hashlib import tracemalloc - from anysolver.floating_transient import numeric_array_digest + from anyfesolver.floating_transient import numeric_array_digest base = np.random.default_rng(6).standard_normal((1200, 1000)) # 9.6 MB view = base.T # strided view, not C-contiguous h = hashlib.sha256(b"numeric-array-v1|(1000, 1200)|") @@ -711,7 +711,7 @@ def test_digest_of_a_transposed_strided_array_has_no_full_copy_and_matches_the_p def test_admission_shape_handling_never_converts_lists_and_rejects_unknown_types(): - from anysolver.floating_transient import _shape_of + from anyfesolver.floating_transient import _shape_of assert _shape_of([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]) == (2, 3) and _shape_of((1.0, 2.0)) == (2,) assert _shape_of(np.zeros((4, 2))) == (4, 2) and _shape_of([]) == (0,) assert _shape_of(np.broadcast_to(np.zeros(1), (10**9, 6, 6))) == (10**9, 6, 6) # metadata only diff --git a/tests/test_floating_transient_native_admission.py b/tests/test_floating_transient_native_admission.py index 11c95a68c..048a64945 100644 --- a/tests/test_floating_transient_native_admission.py +++ b/tests/test_floating_transient_native_admission.py @@ -5,7 +5,7 @@ import pytest from scipy.integrate import solve_ivp -from anysolver.floating_transient import ( +from anyfesolver.floating_transient import ( FloatingTransientSpec, FloatingTransientError, BoundedNativeAdmissionError, solve_floating_transient, numeric_array_digest, bounded_native_admission, ) diff --git a/tests/test_follower_pressure.py b/tests/test_follower_pressure.py index 28109db92..c8d2d3252 100644 --- a/tests/test_follower_pressure.py +++ b/tests/test_follower_pressure.py @@ -6,29 +6,29 @@ import pytest from scipy import sparse -from anysolver.arc_length import ArcLengthControl, solve_static_arc_length -from anysolver.boundary import BoundaryCondition, FixedSupport, LoadCase -from anysolver.buckling import solve_eigenvalue_buckling -from anysolver.cylinder_benchmarks import ( +from anyfesolver.arc_length import ArcLengthControl, solve_static_arc_length +from anyfesolver.boundary import BoundaryCondition, FixedSupport, LoadCase +from anyfesolver.buckling import solve_eigenvalue_buckling +from anyfesolver.cylinder_benchmarks import ( CylinderBenchmarkConfig, build_cylindrical_shell_benchmark_model, ) -from anysolver.elements import ( +from anyfesolver.elements import ( CoupledBeamShellElement, LegacyQ4DeprecationWarning, LegacyShellElement, ShellElement, create_shell_element, ) -from anysolver.fe_core import FEModel -from anysolver.matrix_assembly import ( +from anyfesolver.fe_core import FEModel +from anyfesolver.matrix_assembly import ( assemble_external_load_tangent, assemble_geometric_stiffness_matrix, assemble_load_vector, ) -from anysolver.mesh_gen import generate_simple_panel_mesh -from anysolver.nonlinear_static import solve_static_nonlinear -from anysolver.validation import validate_production_model +from anyfesolver.mesh_gen import generate_simple_panel_mesh +from anyfesolver.nonlinear_static import solve_static_nonlinear +from anyfesolver.validation import validate_production_model def _single_shell(node_count: int = 4) -> tuple[FEModel, ShellElement]: diff --git a/tests/test_ge_beam3_adaptive_arc_checkpoint.py b/tests/test_ge_beam3_adaptive_arc_checkpoint.py index 1e6ba3167..d0c5d83d4 100644 --- a/tests/test_ge_beam3_adaptive_arc_checkpoint.py +++ b/tests/test_ge_beam3_adaptive_arc_checkpoint.py @@ -60,7 +60,7 @@ def test_preserved_failure_and_two_fresh_diagnostics(): assert right['sha256'] == old_rows['cycle-2/'+name]['sha256'] -@pytest.mark.parametrize('path', ['src/anysolver/_ge_beam3_adaptive_arc_program.py', +@pytest.mark.parametrize('path', ['src/anyfesolver/_ge_beam3_adaptive_arc_program.py', 'tests/test_ge_beam3_adaptive_arc_program.py']) def test_mutated_adaptive_source_is_rejected(monkeypatch, path): original = source diff --git a/tests/test_ge_beam3_adaptive_arc_program.py b/tests/test_ge_beam3_adaptive_arc_program.py index 2c1ed7f37..96ec1b724 100644 --- a/tests/test_ge_beam3_adaptive_arc_program.py +++ b/tests/test_ge_beam3_adaptive_arc_program.py @@ -5,10 +5,10 @@ import numpy as np import pytest -from anysolver import _ge_beam3_adaptive_arc_program as driver -from anysolver._ge_beam3_arc_program import ArcProgram, solve_arc_program -from anysolver._ge_beam3_p5_loads.core import canonical, sha -from anysolver.control import CancellationToken +from anyfesolver import _ge_beam3_adaptive_arc_program as driver +from anyfesolver._ge_beam3_arc_program import ArcProgram, solve_arc_program +from anyfesolver._ge_beam3_p5_loads.core import canonical, sha +from anyfesolver.control import CancellationToken from test_ge_beam3_native_load_state import problem diff --git a/tests/test_ge_beam3_adaptive_continuation.py b/tests/test_ge_beam3_adaptive_continuation.py index bf196aeac..d378ed415 100644 --- a/tests/test_ge_beam3_adaptive_continuation.py +++ b/tests/test_ge_beam3_adaptive_continuation.py @@ -34,13 +34,13 @@ def test_curved_restart(kind,tmp_path): inputs.update(kind=kind,source_sha256=sha256(source_raw).hexdigest(),expected_sha256=sha256(expected).hexdigest()) save(tmp_path/'input.json',inputs) import numpy as np - from anysolver import _ge_beam3_native_arc_adaptive as adaptive - from anysolver import _ge_beam3_native_arc as arc - from anysolver._ge_beam3_native_arc_restart import encode_checkpoint as encode_arc - from anysolver._ge_beam3_native_arc_source import TranslationArcSource - from anysolver._ge_beam3_native_translation import TranslationProgram - from anysolver._ge_beam3_spatial_nodal_moments import SpatialNodalMoments - from anysolver._ge_beam3_native_generalized_recovery import recover_native_fields + from anyfesolver import _ge_beam3_native_arc_adaptive as adaptive + from anyfesolver import _ge_beam3_native_arc as arc + from anyfesolver._ge_beam3_native_arc_restart import encode_checkpoint as encode_arc + from anyfesolver._ge_beam3_native_arc_source import TranslationArcSource + from anyfesolver._ge_beam3_native_translation import TranslationProgram + from anyfesolver._ge_beam3_spatial_nodal_moments import SpatialNodalMoments + from anyfesolver._ge_beam3_native_generalized_recovery import recover_native_fields from test_ge_beam3_native_generalized_restart import make,pattern from test_ge_beam3_native_arc_adaptive import packet phase='decode_preserved';print(dict(kind=kind,stage=phase),flush=True) @@ -91,11 +91,11 @@ def test_adaptive_arch_growth(tmp_path): import numpy as np from test_ge_beam3_uniform_arch_sixteen import make,SECTION from test_ge_beam3_native_arc_adaptive import packet - from anysolver._ge_beam3_native_arc import ArcProgram - from anysolver._ge_beam3_native_arc_adaptive import AdaptiveArcProgram,solve_adaptive_arc,decode_checkpoint,wrap_checkpoint - from anysolver._ge_beam3_native_arc_source import TranslationArcSource - from anysolver._ge_beam3_native_history_profile import HISTORY8M,load - from anysolver._ge_beam3_native_generalized_recovery import recover_native_fields + from anyfesolver._ge_beam3_native_arc import ArcProgram + from anyfesolver._ge_beam3_native_arc_adaptive import AdaptiveArcProgram,solve_adaptive_arc,decode_checkpoint,wrap_checkpoint + from anyfesolver._ge_beam3_native_arc_source import TranslationArcSource + from anyfesolver._ge_beam3_native_history_profile import HISTORY8M,load + from anyfesolver._ge_beam3_native_generalized_recovery import recover_native_fields from docs.reference_cases.ge_beam3_native_control_slope import accepted_slope from docs.reference_cases.ge_beam3_uniform_arch_reference import solve as continuum from docs.reference_cases.ge_beam3_uniform_arch_fields import fields diff --git a/tests/test_ge_beam3_adaptive_modal_installed.py b/tests/test_ge_beam3_adaptive_modal_installed.py index 8b2731e3b..646f12dec 100644 --- a/tests/test_ge_beam3_adaptive_modal_installed.py +++ b/tests/test_ge_beam3_adaptive_modal_installed.py @@ -88,7 +88,7 @@ def command(argv, cwd, name, limit=180): wheel = candidates[0] with zipfile.ZipFile(wheel) as archive: for name in ('_ge_beam3_adaptive_arc_program.py', '_ge_beam3_loaded_modal.py'): - assert 'anysolver/'+name in archive.namelist() + assert 'anyfesolver/'+name in archive.namelist() assert not any(name.startswith(('docs/', 'tests/')) for name in archive.namelist()) environment = tmp_path/'environment' command([sys.executable, '-I', '-B', '-m', 'venv', str(environment)], tmp_path, 'venv') diff --git a/tests/test_ge_beam3_analysis_combined.py b/tests/test_ge_beam3_analysis_combined.py index 5f627d368..54c2dd9bd 100644 --- a/tests/test_ge_beam3_analysis_combined.py +++ b/tests/test_ge_beam3_analysis_combined.py @@ -5,16 +5,16 @@ import numpy as np import pytest -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._ge_beam3_native_analysis import COMBINED_WORKFLOW, FORCE_WORKFLOW_SCHEMA -from anysolver._ge_beam3_native_force_adaptation import AdaptiveForcePolicy -from anysolver._ge_beam3_native_generalized_combined_couples import solve_combined_static, _RUN -from anysolver._ge_beam3_native_generalized_combined_restart import LoadPoint, encode_checkpoint, decode_checkpoint -from anysolver._ge_beam3_native_generalized_restart import LoadPoint as DistributedPoint -from anysolver._ge_beam3_native_generalized_program import _PROGRAM -from anysolver._ge_beam3_native_generalized_loading import _ACTIVE -from anysolver._ge_beam3_spatial_nodal_moments import SpatialNodalMoments -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._ge_beam3_native_analysis import COMBINED_WORKFLOW, FORCE_WORKFLOW_SCHEMA +from anyfesolver._ge_beam3_native_force_adaptation import AdaptiveForcePolicy +from anyfesolver._ge_beam3_native_generalized_combined_couples import solve_combined_static, _RUN +from anyfesolver._ge_beam3_native_generalized_combined_restart import LoadPoint, encode_checkpoint, decode_checkpoint +from anyfesolver._ge_beam3_native_generalized_restart import LoadPoint as DistributedPoint +from anyfesolver._ge_beam3_native_generalized_program import _PROGRAM +from anyfesolver._ge_beam3_native_generalized_loading import _ACTIVE +from anyfesolver._ge_beam3_spatial_nodal_moments import SpatialNodalMoments +from anyfesolver._ge_beam3_p5_seeded.core import canonical from test_ge_beam3_native_analysis import analysis from test_ge_beam3_native_generalized_restart import make, pattern, scale, CASES, EMPTY from test_ge_beam3_native_generalized_combined_restart import moment_scale, packet, snapshots @@ -189,7 +189,7 @@ def forbidden(*a, **k): raise AssertionError('cancelled solve issued a checkpoin def test_adaptive_cutback_preserves_exact_accepted_origin(monkeypatch, tmp_path): - import anysolver.nonlinear_static as solver + import anyfesolver.nonlinear_static as solver made = owned(CASES[1]) line = pattern(made.model) fixed = made.solve_spatial_couples(MOMENTS, distributed_pattern=line, steps=2) diff --git a/tests/test_ge_beam3_analysis_fibre_translation.py b/tests/test_ge_beam3_analysis_fibre_translation.py index 4e1dac6bf..f854a9e43 100644 --- a/tests/test_ge_beam3_analysis_fibre_translation.py +++ b/tests/test_ge_beam3_analysis_fibre_translation.py @@ -4,12 +4,12 @@ import numpy as np import pytest -from anysolver._ge_beam3_native_analysis import NativeBeamAnalysis -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_native_fibre_static_element import NativeFibreStaticElement -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver import _ge_beam3_analysis_fibre_translation as route -from anysolver.control import CancellationToken +from anyfesolver._ge_beam3_native_analysis import NativeBeamAnalysis +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_native_fibre_static_element import NativeFibreStaticElement +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver import _ge_beam3_analysis_fibre_translation as route +from anyfesolver.control import CancellationToken from test_ge_beam3_retained_fibre import make_model from test_ge_beam3_retained_fibre_control import program diff --git a/tests/test_ge_beam3_analysis_nodal_program.py b/tests/test_ge_beam3_analysis_nodal_program.py index 15b2c0122..d9cc52446 100644 --- a/tests/test_ge_beam3_analysis_nodal_program.py +++ b/tests/test_ge_beam3_analysis_nodal_program.py @@ -6,9 +6,9 @@ import numpy as np import pytest -from anysolver import _ge_beam3_analysis_nodal_program as route -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver import _ge_beam3_analysis_nodal_program as route +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.control import CancellationToken, SolveCancelled from test_ge_beam3_native_analysis import analysis from test_ge_beam3_native_generalized_modal import make from test_ge_beam3_native_fibre_static_element import problem as fibre_problem diff --git a/tests/test_ge_beam3_analysis_translation.py b/tests/test_ge_beam3_analysis_translation.py index 178c09889..03d23d09c 100644 --- a/tests/test_ge_beam3_analysis_translation.py +++ b/tests/test_ge_beam3_analysis_translation.py @@ -3,13 +3,13 @@ import json import numpy as np import pytest -from anysolver._ge_beam3_native_analysis import NativeBeamAnalysis, NativeBeamAnalysisError, NativeBeamWorkflowError -from anysolver import _ge_beam3_native_definition as codec -from anysolver import _ge_beam3_analysis_translation as route -from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement -from anysolver._ge_beam3_precise_geometric_work import POLICY -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver.control import CancellationToken +from anyfesolver._ge_beam3_native_analysis import NativeBeamAnalysis, NativeBeamAnalysisError, NativeBeamWorkflowError +from anyfesolver import _ge_beam3_native_definition as codec +from anyfesolver import _ge_beam3_analysis_translation as route +from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement +from anyfesolver._ge_beam3_precise_geometric_work import POLICY +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.control import CancellationToken from test_ge_beam3_native_analysis import analysis, definitions from test_ge_beam3_elastic_seed_continuation import seed, model, programme from test_ge_beam3_native_generalized_modal import make diff --git a/tests/test_ge_beam3_analysis_translation_modal.py b/tests/test_ge_beam3_analysis_translation_modal.py index eb9c4fe4f..6e3db3494 100644 --- a/tests/test_ge_beam3_analysis_translation_modal.py +++ b/tests/test_ge_beam3_analysis_translation_modal.py @@ -3,11 +3,11 @@ import numpy as np import pytest -from anysolver import _ge_beam3_analysis_translation_modal as route -from anysolver import _ge_beam3_retained_translation_modal as ordinary_modal -from anysolver import _ge_beam3_elastic_seed_modal as seeded_modal -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver import _ge_beam3_analysis_translation_modal as route +from anyfesolver import _ge_beam3_retained_translation_modal as ordinary_modal +from anyfesolver import _ge_beam3_elastic_seed_modal as seeded_modal +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.control import CancellationToken, SolveCancelled from test_ge_beam3_native_analysis import analysis from test_ge_beam3_elastic_seed_continuation import seed, model, programme from test_ge_beam3_analysis_fibre_translation import analysis as fibre_analysis, program as fibre_program diff --git a/tests/test_ge_beam3_arc_geometry.py b/tests/test_ge_beam3_arc_geometry.py index 840cdb94a..090df76e4 100644 --- a/tests/test_ge_beam3_arc_geometry.py +++ b/tests/test_ge_beam3_arc_geometry.py @@ -5,9 +5,9 @@ import numpy as np import pytest -from anysolver._ge_beam3_arc_geometry import frame_chord_terms, constraint -from anysolver._ge_beam3_p5.algebra import rotation, skew -from anysolver._ge_beam3_p5.chart import exp_chart_terms +from anyfesolver._ge_beam3_arc_geometry import frame_chord_terms, constraint +from anyfesolver._ge_beam3_p5.algebra import rotation, skew +from anyfesolver._ge_beam3_p5.chart import exp_chart_terms def direct(v,w,q0): @@ -16,7 +16,7 @@ def direct(v,w,q0): @pytest.mark.parametrize('magnitude',[0.,2.**-54,1e-8,1e-4,.000999999,.001000001,.1,1.3,2.7]) def test_chord_and_chart_row_match_independent_exp_jet(magnitude): - from anysolver._ge_beam3_mixed_ad import Jet2, so3_exp + from anyfesolver._ge_beam3_mixed_ad import Jet2, so3_exp axis = np.array([1.,-2.,3.]); axis /= np.linalg.norm(axis) v = magnitude*axis; w = np.array([.2,.6,-.5]) q = so3_exp([Jet2.variable(float(x),i,3) for i,x in enumerate(v)]) diff --git a/tests/test_ge_beam3_arc_geometry_checkpoint.py b/tests/test_ge_beam3_arc_geometry_checkpoint.py index 4c60c3d23..7590c55f9 100644 --- a/tests/test_ge_beam3_arc_geometry_checkpoint.py +++ b/tests/test_ge_beam3_arc_geometry_checkpoint.py @@ -37,7 +37,7 @@ def test_geometry_only_scope_is_explicit(): @pytest.mark.parametrize('path',[ - 'src/anysolver/_ge_beam3_arc_geometry.py', + 'src/anyfesolver/_ge_beam3_arc_geometry.py', 'tests/test_ge_beam3_arc_geometry.py', 'docs/reference_cases/ge_beam3_curved_p5_continuation_probe.py', ]) diff --git a/tests/test_ge_beam3_arc_program.py b/tests/test_ge_beam3_arc_program.py index de862be87..c6201df4a 100644 --- a/tests/test_ge_beam3_arc_program.py +++ b/tests/test_ge_beam3_arc_program.py @@ -6,10 +6,10 @@ import pytest from scipy import sparse -import anysolver._ge_beam3_arc_program as driver -from anysolver._ge_beam3_load_program import ForceProgram, solve_force_program -from anysolver._ge_beam3_p5_loads.core import canonical, sha -from anysolver.control import CancellationToken +import anyfesolver._ge_beam3_arc_program as driver +from anyfesolver._ge_beam3_load_program import ForceProgram, solve_force_program +from anyfesolver._ge_beam3_p5_loads.core import canonical, sha +from anyfesolver.control import CancellationToken from test_ge_beam3_native_load_state import problem from test_ge_beam3_displacement_program import arch @@ -174,10 +174,10 @@ def test_invalid_arc_json_is_rejected(accepted,kind): def test_native_arc_is_covariant_under_a_proper_coordinate_frame_change(): from copy import deepcopy - from anysolver.fe_core import FEModel - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference - from anysolver._ge_beam3_p5_loads import NativeP5BeamElement, DirectedHardeningSection - from anysolver._ge_beam3_p5.algebra import rotation + from anyfesolver.fe_core import FEModel + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference + from anyfesolver._ge_beam3_p5_loads import NativeP5BeamElement, DirectedHardeningSection + from anyfesolver._ge_beam3_p5.algebra import rotation original = problem(); rotated = FEModel('rotated-native-arc'); s = rotation(np.array([.7,-.4,.3])) for i,node in original.mesh.nodes.items(): rotated.add_node(i,*(s@np.array(node.coords()))) for i,e in original.mesh.elements.items(): diff --git a/tests/test_ge_beam3_arc_program_checkpoint.py b/tests/test_ge_beam3_arc_program_checkpoint.py index 99d9fd79e..e49169be6 100644 --- a/tests/test_ge_beam3_arc_program_checkpoint.py +++ b/tests/test_ge_beam3_arc_program_checkpoint.py @@ -54,9 +54,9 @@ def test_both_arch_traces_and_capsules_are_bound_identically(): @pytest.mark.parametrize('path',[ - 'src/anysolver/_ge_beam3_arc_program.py', - 'src/anysolver/_ge_beam3_arc_geometry.py', - 'src/anysolver/_native_rotation_state.py', + 'src/anyfesolver/_ge_beam3_arc_program.py', + 'src/anyfesolver/_ge_beam3_arc_geometry.py', + 'src/anyfesolver/_native_rotation_state.py', ]) def test_new_or_preserved_source_mutation_breaks_binding(monkeypatch,path): original = source diff --git a/tests/test_ge_beam3_arch_seeded_crossing.py b/tests/test_ge_beam3_arch_seeded_crossing.py index 7d75618f4..5eea0d70b 100644 --- a/tests/test_ge_beam3_arch_seeded_crossing.py +++ b/tests/test_ge_beam3_arch_seeded_crossing.py @@ -34,11 +34,11 @@ def test_seeded_arch_crossing(tmp_path): import numpy as np from test_ge_beam3_uniform_arch_sixteen import make,SECTION from test_ge_beam3_native_arc import packet - from anysolver._ge_beam3_native_arc import ArcProgram,solve_arc - from anysolver._ge_beam3_native_arc_source import TranslationArcSource - from anysolver._ge_beam3_native_arc_restart import decode_checkpoint,encode_checkpoint - from anysolver._ge_beam3_native_history_profile import HISTORY8M,load - from anysolver._ge_beam3_native_generalized_recovery import recover_native_fields + from anyfesolver._ge_beam3_native_arc import ArcProgram,solve_arc + from anyfesolver._ge_beam3_native_arc_source import TranslationArcSource + from anyfesolver._ge_beam3_native_arc_restart import decode_checkpoint,encode_checkpoint + from anyfesolver._ge_beam3_native_history_profile import HISTORY8M,load + from anyfesolver._ge_beam3_native_generalized_recovery import recover_native_fields from docs.reference_cases.ge_beam3_native_control_slope import accepted_slope from docs.reference_cases.ge_beam3_uniform_arch_reference import solve as continuum from docs.reference_cases.ge_beam3_uniform_arch_fields import fields diff --git a/tests/test_ge_beam3_arch_source_cost.py b/tests/test_ge_beam3_arch_source_cost.py index 3e59d2985..9879bd4b6 100644 --- a/tests/test_ge_beam3_arch_source_cost.py +++ b/tests/test_ge_beam3_arch_source_cost.py @@ -21,11 +21,11 @@ def test_sixteen_macro_empty_handoff(tmp_path): source_sha256=sha256(source_raw).hexdigest(),manifest_sha256=sha256(manifest_raw).hexdigest())) from test_ge_beam3_uniform_arch_sixteen import make from test_ge_beam3_native_arc import packet - from anysolver._ge_beam3_native_arc import ArcProgram,solve_arc - from anysolver._ge_beam3_native_arc_source import TranslationArcSource - from anysolver._ge_beam3_native_arc_restart import decode_checkpoint,encode_checkpoint - from anysolver._ge_beam3_native_history_profile import HISTORY8M - from anysolver._ge_beam3_p5_seeded.core import canonical + from anyfesolver._ge_beam3_native_arc import ArcProgram,solve_arc + from anyfesolver._ge_beam3_native_arc_source import TranslationArcSource + from anyfesolver._ge_beam3_native_arc_restart import decode_checkpoint,encode_checkpoint + from anyfesolver._ge_beam3_native_history_profile import HISTORY8M + from anyfesolver._ge_beam3_p5_seeded.core import canonical model,translation=make();source=TranslationArcSource(translation,source_raw,row['sha256'],1.) program=ArcProgram((.12,.12,.12),.01,translation.distributed,parameter_scale=.1,history_profile=HISTORY8M,source=source) started=monotonic();cpu=process_time();timings={};phase='initial_handoff' diff --git a/tests/test_ge_beam3_authoritative_cell_seed.py b/tests/test_ge_beam3_authoritative_cell_seed.py index cd47c436f..4db6d5942 100644 --- a/tests/test_ge_beam3_authoritative_cell_seed.py +++ b/tests/test_ge_beam3_authoritative_cell_seed.py @@ -3,14 +3,14 @@ import json import numpy as np import pytest -from anysolver._ge_beam3_authoritative_cell_seed import cell_initial_rotations -from anysolver._ge_beam3_p5.algebra import rotation, log_rotation -from anysolver._ge_beam3_p5_loads import NativeP5BeamElement as V4 -from anysolver._ge_beam3_p5_seeded import NativeP5BeamElement as V5 -from anysolver._ge_beam3_p5_loads.core import canonical -from anysolver._ge_beam3_signed_loaded_modes import solve_signed_loaded_modes as old_modes -from anysolver._ge_beam3_seeded_signed_modes import solve_signed_loaded_modes -from anysolver._ge_beam3_seeded_load_program import ForceProgram, solve_force_program +from anyfesolver._ge_beam3_authoritative_cell_seed import cell_initial_rotations +from anyfesolver._ge_beam3_p5.algebra import rotation, log_rotation +from anyfesolver._ge_beam3_p5_loads import NativeP5BeamElement as V4 +from anyfesolver._ge_beam3_p5_seeded import NativeP5BeamElement as V5 +from anyfesolver._ge_beam3_p5_loads.core import canonical +from anyfesolver._ge_beam3_signed_loaded_modes import solve_signed_loaded_modes as old_modes +from anyfesolver._ge_beam3_seeded_signed_modes import solve_signed_loaded_modes +from anyfesolver._ge_beam3_seeded_load_program import ForceProgram, solve_force_program from test_ge_beam3_curved_contrast_probe import make_curved @@ -48,7 +48,7 @@ def test_preserved_v4_reference_defect_is_not_reclassified_as_qualification(slen with pytest.raises(ValueError, match='loaded free equilibrium required'): old_modes(model, states, np.zeros(30), inertias, np.zeros(30), load_parameter=0., bounds=(-10000., 100000000.), num_modes=6) - from anysolver._ge_beam3_loaded_modal import prepare + from anyfesolver._ge_beam3_loaded_modal import prepare packet, _ = prepare(model, states, np.zeros(30), inertias, load_parameter=0.) assert np.linalg.norm(packet.net_residual[list(packet.free_dofs)]) > 1e-11 assert canonical(states) == before @@ -85,7 +85,7 @@ def test_v5_finite_loaded_equilibrium_and_serialized_replay(tmp_path, monkeypatc model, inertias = make_curved(100.) program = ForceProgram((.5, 1.), ((5, .05, -.001, 0.),)) with (tmp_path/'progress.jsonl').open('x') as log: - from anysolver import _ge_beam3_seeded_load_program as driver + from anyfesolver import _ge_beam3_seeded_load_program as driver original = driver._physical_force def measured(*args): force = original(*args) diff --git a/tests/test_ge_beam3_branch_direction.py b/tests/test_ge_beam3_branch_direction.py index 8fc44b9a4..20deb98f0 100644 --- a/tests/test_ge_beam3_branch_direction.py +++ b/tests/test_ge_beam3_branch_direction.py @@ -1,8 +1,8 @@ """Implicit native cell loading indicators, not a changed constitutive law.""" import numpy as np import pytest -from anysolver._ge_beam3_generalized_cell import GeneralizedCellConjugate -from anysolver._ge_beam3_fibre_section import canonical +from anyfesolver._ge_beam3_generalized_cell import GeneralizedCellConjugate +from anyfesolver._ge_beam3_fibre_section import canonical from test_ge_beam3_generalized_ellipsoid_section import section from test_ge_beam3_fibre_cell import stations @@ -45,8 +45,8 @@ def test_zero_norm_and_invalid_direction(): def test_exact_boundary_and_failed_event_work_are_reported(): from types import SimpleNamespace as NS - from anysolver._stiffened_shell_branch_event_trial import trial_fraction - from anysolver._stiffened_shell_displacement_corrector import DisplacementCorrectorFailure + from anyfesolver._stiffened_shell_branch_event_trial import trial_fraction + from anyfesolver._stiffened_shell_displacement_corrector import DisplacementCorrectorFailure # Branch identity is authoritative even if a reconstructed margin rounds. cell=NS(response=lambda *args,**kwargs:dict(branch_direction=(dict( station=0,branch="YIELD_BOUNDARY",margin=([1e-80],[0.]), diff --git a/tests/test_ge_beam3_cell_identity.py b/tests/test_ge_beam3_cell_identity.py index 5b55f99db..863130f31 100644 --- a/tests/test_ge_beam3_cell_identity.py +++ b/tests/test_ge_beam3_cell_identity.py @@ -2,10 +2,10 @@ import json import numpy as np import pytest -from anysolver import _ge_beam3_generalized_cell as source -from anysolver import _ge_beam3_cell_identity as identity -from anysolver import _ge_beam3_retained_translation_control as control -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver import _ge_beam3_generalized_cell as source +from anyfesolver import _ge_beam3_cell_identity as identity +from anyfesolver import _ge_beam3_retained_translation_control as control +from anyfesolver._ge_beam3_p5_seeded.core import canonical from docs.reference_cases import ge_beam3_refined_controlled_case as case @pytest.fixture diff --git a/tests/test_ge_beam3_centered_line_load.py b/tests/test_ge_beam3_centered_line_load.py index 1e071b893..d93b31f03 100644 --- a/tests/test_ge_beam3_centered_line_load.py +++ b/tests/test_ge_beam3_centered_line_load.py @@ -8,11 +8,11 @@ from docs.reference_cases import ge_beam3_centered_line_load_oracle as oracle from docs.reference_cases import ge_beam3_centered_line_load_probe as probe -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Centered -from anysolver._ge_beam3_p5_coordinates.positions import from_total -from anysolver._ge_beam3_p5.core import canonical -from anysolver._ge_beam3_p5.algebra import rotation -from anysolver._ge_beam3_p5.section import SectionHistory, DirectedHardeningSection +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Centered +from anyfesolver._ge_beam3_p5_coordinates.positions import from_total +from anyfesolver._ge_beam3_p5.core import canonical +from anyfesolver._ge_beam3_p5.algebra import rotation +from anyfesolver._ge_beam3_p5.section import SectionHistory, DirectedHardeningSection from test_ge_beam3_centered_reference import fixture from test_ge_beam3_curved_p5_nonlinear_mixed_probe import law from test_ge_beam3_curved_p5_native_chart_probe import sample @@ -65,7 +65,7 @@ def test_full_work_force_and_hessian_match_independent_reconstruction(solved): def test_load_only_derivatives_match_the_frozen_complete_variational_core(solved): - from anysolver._ge_beam3_centered_mixed import CenteredStationaryBeam + from anyfesolver._ge_beam3_centered_mixed import CenteredStationaryBeam data, result, _, _ = solved; ref, section, high, low, vertex, _, origins = data full = [] for value in (0.,1.): @@ -149,7 +149,7 @@ def test_load_only_variations_retain_tiny_work_without_material_subtraction(scal def test_material_potential_subtraction_would_erase_tiny_line_work(): - from anysolver._ge_beam3_centered_mixed import CenteredStationaryBeam + from anyfesolver._ge_beam3_centered_mixed import CenteredStationaryBeam data = setup(shift=2.**40); ref, section, high, low, vertex, _, origins = data cells = np.array([rotation([.4,-.2,.3]),rotation([-.1,.35,.2])]) moments = np.zeros((2,2,3)); tiny = FORCE*1e-20 diff --git a/tests/test_ge_beam3_centered_line_load_evidence.py b/tests/test_ge_beam3_centered_line_load_evidence.py index 8a2c86b52..58a1f65a1 100644 --- a/tests/test_ge_beam3_centered_line_load_evidence.py +++ b/tests/test_ge_beam3_centered_line_load_evidence.py @@ -53,7 +53,7 @@ def test_preserved_source_mutation_fails_before_diagnostic_mechanics(monkeypatch original = diagnostic.binding def mutated(path): value = original(path) - if path == 'src/anysolver/_ge_beam3_centered_mixed.py': value = {**value,'sha256':'0'*64} + if path == 'src/anyfesolver/_ge_beam3_centered_mixed.py': value = {**value,'sha256':'0'*64} return value monkeypatch.setattr(diagnostic,'binding',mutated) import pytest diff --git a/tests/test_ge_beam3_centered_mixed.py b/tests/test_ge_beam3_centered_mixed.py index f235785be..5fc87b776 100644 --- a/tests/test_ge_beam3_centered_mixed.py +++ b/tests/test_ge_beam3_centered_mixed.py @@ -5,13 +5,13 @@ import numpy as np import pytest -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Centered -from anysolver._ge_beam3_centered_mixed import CenteredStationaryBeam -from anysolver._ge_beam3_p5.compensated import CompensatedStationaryBeam -from anysolver._ge_beam3_p5.mixed import LocalForceAccuracy -from anysolver._ge_beam3_p5.section import DirectedHardeningSection -from anysolver._ge_beam3_p5.core import canonical -from anysolver._ge_beam3_p5_coordinates.positions import from_total +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Centered +from anyfesolver._ge_beam3_centered_mixed import CenteredStationaryBeam +from anyfesolver._ge_beam3_p5.compensated import CompensatedStationaryBeam +from anyfesolver._ge_beam3_p5.mixed import LocalForceAccuracy +from anyfesolver._ge_beam3_p5.section import DirectedHardeningSection +from anyfesolver._ge_beam3_p5.core import canonical +from anyfesolver._ge_beam3_p5_coordinates.positions import from_total from test_ge_beam3_centered_reference import fixture from test_ge_beam3_curved_p5_native_chart_probe import sample from test_ge_beam3_curved_p5_nonlinear_mixed_probe import law diff --git a/tests/test_ge_beam3_centered_native.py b/tests/test_ge_beam3_centered_native.py index e3e93be4f..a7b29bc2c 100644 --- a/tests/test_ge_beam3_centered_native.py +++ b/tests/test_ge_beam3_centered_native.py @@ -5,16 +5,16 @@ import numpy as np import pytest -from anysolver.fe_core import FEModel -from anysolver.boundary import BoundaryCondition, LoadCase -from anysolver.nonlinear_static import solve_static_nonlinear -from anysolver.nonlinear_restart import canonical_checkpoint_json_bytes -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Centered -from anysolver._ge_beam3_p5_centered import NativeP5BeamElement, DirectedHardeningSection -from anysolver._ge_beam3_p5_centered.core import canonical, seal -from anysolver._ge_beam3_p5_centered.committed_modal import prepare, solve_elastic_modes -from anysolver._ge_beam3_p5_centered.reference_modal import solve as reference_modes -from anysolver._ge_beam3_p5_centered.mass import reference_kinetic_factors, current_rest_mass +from anyfesolver.fe_core import FEModel +from anyfesolver.boundary import BoundaryCondition, LoadCase +from anyfesolver.nonlinear_static import solve_static_nonlinear +from anyfesolver.nonlinear_restart import canonical_checkpoint_json_bytes +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Centered +from anyfesolver._ge_beam3_p5_centered import NativeP5BeamElement, DirectedHardeningSection +from anyfesolver._ge_beam3_p5_centered.core import canonical, seal +from anyfesolver._ge_beam3_p5_centered.committed_modal import prepare, solve_elastic_modes +from anyfesolver._ge_beam3_p5_centered.reference_modal import solve as reference_modes +from anyfesolver._ge_beam3_p5_centered.mass import reference_kinetic_factors, current_rest_mass from test_ge_beam3_curved_p5_nonlinear_mixed_probe import law from test_ge_beam3_curved_p5_mass_probe import section_mass @@ -118,7 +118,7 @@ def test_translated_plastic_restart_continues_exactly(): def test_reference_evaluator_fingerprint_and_no_legacy_clone_are_enforced(): - from anysolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry as Old + from anyfesolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry as Old model,_ = problem(); element = model.mesh.elements[1] old = Old(element.core.reference.coordinates,element.core.reference.nodal_triads) with pytest.raises(ValueError,match='centered reference'): @@ -129,7 +129,7 @@ def test_reference_evaluator_fingerprint_and_no_legacy_clone_are_enforced(): def test_v2_checkpoint_is_not_accepted_as_centered_v3(): - from anysolver._ge_beam3_p5_coordinates import NativeP5BeamElement as V2 + from anyfesolver._ge_beam3_p5_coordinates import NativeP5BeamElement as V2 model,_ = problem(); element = model.mesh.elements[1] prior = V2(1,element.node_ids,element.core.reference,element.core.section) old_model = FEModel('v2-not-v3') @@ -154,8 +154,8 @@ def test_centered_mass_retains_cell_rotations_without_guyan_or_trace_mass(): def test_affine_split_recovery_does_not_amplify_weight_rounding(): from fractions import Fraction as F - from anysolver._ge_beam3_p5_centered.positions import station_position - from anysolver._ge_beam3_p5_coordinates.positions import station_position as v2_station + from anyfesolver._ge_beam3_p5_centered.positions import station_position + from anyfesolver._ge_beam3_p5_coordinates.positions import station_position as v2_station points = np.array([[0.,0.,0.],[1.,0.,0.],[2.,0.,0.]]) t = float((np.polynomial.legendre.leggauss(8)[0][3]+1)/2) assert F(1.-t)+F(t) != 1 # The diagnostic requires a genuinely rounded complement. @@ -173,8 +173,8 @@ def test_affine_split_recovery_does_not_amplify_weight_rounding(): @pytest.fixture def state_contracts(monkeypatch): import test_ge_beam3_curved_p5_coordinate_state as previous - from anysolver._ge_beam3_p5_centered import codec - from anysolver._ge_beam3_p5_centered.positions import rest_mass + from anyfesolver._ge_beam3_p5_centered import codec + from anyfesolver._ge_beam3_p5_centered.positions import rest_mass original = previous.problem def make_problem(*,curved=False,plastic=False,cls=NativeP5BeamElement): return original(curved=curved,plastic=plastic,cls=cls) @@ -241,7 +241,7 @@ def test_mutated_reference_coefficients_are_detected_before_native_use(): def test_centered_rest_inertia_rejects_finite_velocity_route(): - from anysolver._ge_beam3_p5_centered.mass import _CenteredRestInertia + from anyfesolver._ge_beam3_p5_centered.mass import _CenteredRestInertia model,_ = problem(); ref = model.mesh.elements[1].core.reference mass = _CenteredRestInertia(ref,section_mass(),order=8) velocity = np.zeros(24); velocity[0] = 1. diff --git a/tests/test_ge_beam3_centered_native_checkpoint.py b/tests/test_ge_beam3_centered_native_checkpoint.py index 20656f03e..75fd414a9 100644 --- a/tests/test_ge_beam3_centered_native_checkpoint.py +++ b/tests/test_ge_beam3_centered_native_checkpoint.py @@ -39,7 +39,7 @@ def test_centered_native_source_binding_and_development_boundary(): def test_source_mutations_cannot_keep_the_development_binding(monkeypatch, kind): original = source_map.source target = (source_map.TARGET+'/positions.py' if kind != 'preserved' else - 'src/anysolver/_ge_beam3_p5_coordinates/positions.py') + 'src/anyfesolver/_ge_beam3_p5_coordinates/positions.py') def altered(path): raw = original(path) if path == target: diff --git a/tests/test_ge_beam3_centered_native_installed.py b/tests/test_ge_beam3_centered_native_installed.py index 1b362c432..7060110ba 100644 --- a/tests/test_ge_beam3_centered_native_installed.py +++ b/tests/test_ge_beam3_centered_native_installed.py @@ -28,10 +28,10 @@ def test_centered_native_wheel_two_fresh_process_checks(tmp_path): shutil.copytree(root/'src',build/'src',ignore=shutil.ignore_patterns('__pycache__','*.egg-info')) # Exercise the Windows checkout transform in the disposable snapshot. # Canonical source hashes and actual installed byte hashes are distinct. - for path in [*(build/'src/anysolver/_ge_beam3_p5').glob('*.py'), - *(build/'src/anysolver/_ge_beam3_p5_coordinates').glob('*.py'), - *(build/'src/anysolver/_ge_beam3_p5_centered').glob('*.py'), - build/'src/anysolver/_ge_beam3_centered_reference.py',build/'src/anysolver/_ge_beam3_centered_mixed.py']: + for path in [*(build/'src/anyfesolver/_ge_beam3_p5').glob('*.py'), + *(build/'src/anyfesolver/_ge_beam3_p5_coordinates').glob('*.py'), + *(build/'src/anyfesolver/_ge_beam3_p5_centered').glob('*.py'), + build/'src/anyfesolver/_ge_beam3_centered_reference.py',build/'src/anyfesolver/_ge_beam3_centered_mixed.py']: raw = path.read_bytes().replace(b'\r\n',b'\n') path.write_bytes(raw.replace(b'\n',b'\r\n')) for name in ('pyproject.toml','README.md','LICENSE','COPYRIGHT','THIRD_PARTY_NOTICES.md'): @@ -51,9 +51,9 @@ def command(argv, cwd, limit=120): wheel = candidates[0] with zipfile.ZipFile(wheel) as archive: assert not any(name.startswith(('docs/','tests/')) for name in archive.namelist()) - assert 'anysolver/_ge_beam3_p5/element.py' in archive.namelist() - assert 'anysolver/_ge_beam3_p5_coordinates/element.py' in archive.namelist() - assert 'anysolver/_ge_beam3_p5_centered/element.py' in archive.namelist() + assert 'anyfesolver/_ge_beam3_p5/element.py' in archive.namelist() + assert 'anyfesolver/_ge_beam3_p5_coordinates/element.py' in archive.namelist() + assert 'anyfesolver/_ge_beam3_p5_centered/element.py' in archive.namelist() environment = tmp_path/'environment' command([sys.executable,'-I','-B','-m','venv',str(environment)],tmp_path) python = environment/('Scripts/python.exe' if os.name == 'nt' else 'bin/python') diff --git a/tests/test_ge_beam3_centered_reference.py b/tests/test_ge_beam3_centered_reference.py index cce588e31..26771aef3 100644 --- a/tests/test_ge_beam3_centered_reference.py +++ b/tests/test_ge_beam3_centered_reference.py @@ -5,8 +5,8 @@ import numpy as np import pytest -from anysolver import ge_beam3_curved_reference as historical -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Centered +from anyfesolver import ge_beam3_curved_reference as historical +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Centered def oracle(nodes, xi, derivative=False): @@ -122,8 +122,8 @@ def test_midpoint_frame_derivative_traces_and_owned_fingerprint(): def test_old_consumers_do_not_silently_claim_the_centered_evaluator(): - from anysolver._ge_beam3_p5.compensated import CompensatedStationaryBeam - from anysolver._ge_beam3_p5.section import DirectedHardeningSection + from anyfesolver._ge_beam3_p5.compensated import CompensatedStationaryBeam + from anyfesolver._ge_beam3_p5.section import DirectedHardeningSection nodes, frames = fixture(translation=2.**30) ref = Centered(nodes,frames) section = DirectedHardeningSection(np.eye(6),np.array([1.,0.,0.,0.,0.,0.]),1.,1.) diff --git a/tests/test_ge_beam3_closed_ring.py b/tests/test_ge_beam3_closed_ring.py index 9c052de6a..5f32e86ed 100644 --- a/tests/test_ge_beam3_closed_ring.py +++ b/tests/test_ge_beam3_closed_ring.py @@ -15,15 +15,15 @@ import numpy as np import pytest -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry -from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement -from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection -from anysolver._ge_beam3_retained_nodal_loading import Program, NodalDeadForces -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver.fe_core import FEModel -from anysolver.boundary import BoundaryCondition +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry +from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement +from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection +from anyfesolver._ge_beam3_retained_nodal_loading import Program, NodalDeadForces +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.fe_core import FEModel +from anyfesolver.boundary import BoundaryCondition from test_ge_beam3_native_analysis import analysis EA = 1000. diff --git a/tests/test_ge_beam3_common_kinematic_chain_checkpoint.py b/tests/test_ge_beam3_common_kinematic_chain_checkpoint.py index 5f154778b..5a2955171 100644 --- a/tests/test_ge_beam3_common_kinematic_chain_checkpoint.py +++ b/tests/test_ge_beam3_common_kinematic_chain_checkpoint.py @@ -88,16 +88,16 @@ def test_same_author_decimal_audit_has_no_production_or_numerical_library_import def test_split_reuses_preserved_derivative_and_section_building_blocks(): - tree=ast.parse((ROOT/'src/anysolver/_ge_beam3_shared_kinematic_split.py').read_text()) + tree=ast.parse((ROOT/'src/anyfesolver/_ge_beam3_shared_kinematic_split.py').read_text()) imports={n.module for n in ast.walk(tree) if isinstance(n,ast.ImportFrom)} - assert imports=={'anysolver._ge_beam3_mixed_ad','anysolver._ge_beam3_p5.compensated', - 'anysolver._ge_beam3_centered_mixed','anysolver._ge_beam3_p5.algebra'} + assert imports=={'anyfesolver._ge_beam3_mixed_ad','anyfesolver._ge_beam3_p5.compensated', + 'anyfesolver._ge_beam3_centered_mixed','anyfesolver._ge_beam3_p5.algebra'} assert not any(isinstance(n,ast.ClassDef) for n in ast.walk(tree)) def test_private_result_types_retain_signs_and_reject_qualification_upgrade(): - from anysolver._native_factor_chain_modes import FactorChainModes - from anysolver._ge_beam3_factor_chain_modes import SignedLoadedModes + from anyfesolver._native_factor_chain_modes import FactorChainModes + from anyfesolver._ge_beam3_factor_chain_modes import SignedLoadedModes for cls in (FactorChainModes,SignedLoadedModes): assert cls.__dataclass_fields__['negative_eigenvalues_retained'].default is True assert cls.__dataclass_fields__['production_qualified'].default is False diff --git a/tests/test_ge_beam3_common_kinematic_factor_probe.py b/tests/test_ge_beam3_common_kinematic_factor_probe.py index d72664306..30960cae4 100644 --- a/tests/test_ge_beam3_common_kinematic_factor_probe.py +++ b/tests/test_ge_beam3_common_kinematic_factor_probe.py @@ -6,10 +6,10 @@ from docs.reference_cases.ge_beam3_common_kinematic_factor_probe import reference_chain from docs.reference_cases.ge_beam3_decimal_chain_audit import factor_chain_modes from docs.reference_cases.ge_beam3_reassembly_runtime_diagnostic import contrast -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_p5.algebra import rotation -import anysolver._ge_beam3_reassembled_signed_modes as adapter -from anysolver._native_factor_chain_modes import solve_factor_chain_modes +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_p5.algebra import rotation +import anyfesolver._ge_beam3_reassembled_signed_modes as adapter +from anyfesolver._native_factor_chain_modes import solve_factor_chain_modes def test_decimal_chain_preserves_unit_term_lost_by_expanded_binary64(): diff --git a/tests/test_ge_beam3_complementary_section.py b/tests/test_ge_beam3_complementary_section.py index 47ceb69d6..3dceff387 100644 --- a/tests/test_ge_beam3_complementary_section.py +++ b/tests/test_ge_beam3_complementary_section.py @@ -3,9 +3,9 @@ from math import fsum import numpy as np import pytest -from anysolver._ge_beam3_complementary_section import ComplementaryDirectedSection -from anysolver._ge_beam3_p5.section import DirectedHardeningSection, SectionHistory -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_complementary_section import ComplementaryDirectedSection +from anyfesolver._ge_beam3_p5.section import DirectedHardeningSection, SectionHistory +from anyfesolver._ge_beam3_p5_seeded.core import canonical def section(contrast=1.): diff --git a/tests/test_ge_beam3_compliance_snapshot_guard.py b/tests/test_ge_beam3_compliance_snapshot_guard.py index ca0427686..1db809594 100644 --- a/tests/test_ge_beam3_compliance_snapshot_guard.py +++ b/tests/test_ge_beam3_compliance_snapshot_guard.py @@ -1,9 +1,9 @@ from time import perf_counter import numpy as np import pytest -from anysolver import _ge_beam3_compliance_snapshot_guard as policy -from anysolver._ge_beam3_native_generalized_factor_modal import compliance_factor -from anysolver.control import CancellationToken,SolveCancelled +from anyfesolver import _ge_beam3_compliance_snapshot_guard as policy +from anyfesolver._ge_beam3_native_generalized_factor_modal import compliance_factor +from anyfesolver.control import CancellationToken,SolveCancelled @pytest.mark.parametrize('scale',(1e-8,1.,1e8)) def test_exact_factor_and_error_equality_with_fewer_full_checks(scale): @@ -49,7 +49,7 @@ def test_original_deadline_not_extended(monkeypatch): policy.deadline_checkpoint(10.) with pytest.raises(RuntimeError,match='context deadline'):policy.deadline_checkpoint(9.999) def test_unknown_policy_rejects_before_native_owner(monkeypatch): - from anysolver import _ge_beam3_elastic_seed_modal as modal + from anyfesolver import _ge_beam3_elastic_seed_modal as modal def forbidden(*a,**kw):raise AssertionError('owner must not run') monkeypatch.setattr(modal.control,'Context',forbidden) for invalid in ('unregistered',True,1): diff --git a/tests/test_ge_beam3_control_programs_installed.py b/tests/test_ge_beam3_control_programs_installed.py index 6d2f3d953..bb2bdf9fb 100644 --- a/tests/test_ge_beam3_control_programs_installed.py +++ b/tests/test_ge_beam3_control_programs_installed.py @@ -88,7 +88,7 @@ def command(argv, cwd, name, limit=180): wheel = candidates[0] with zipfile.ZipFile(wheel) as archive: for name in ('_ge_beam3_displacement_program.py', '_ge_beam3_arc_geometry.py', '_ge_beam3_arc_program.py'): - assert 'anysolver/'+name in archive.namelist() + assert 'anyfesolver/'+name in archive.namelist() assert not any(name.startswith(('docs/', 'tests/')) for name in archive.namelist()) environment = tmp_path/'environment' command([sys.executable, '-I', '-B', '-m', 'venv', str(environment)], tmp_path, 'venv') diff --git a/tests/test_ge_beam3_controlled_fibre_modes.py b/tests/test_ge_beam3_controlled_fibre_modes.py index 464a6bd26..7500731ce 100644 --- a/tests/test_ge_beam3_controlled_fibre_modes.py +++ b/tests/test_ge_beam3_controlled_fibre_modes.py @@ -4,11 +4,11 @@ import numpy as np import pytest -import anysolver._ge_beam3_controlled_fibre_modes as native -import anysolver._ge_beam3_seeded_fibre_control as control -from anysolver._ge_beam3_retained_fibre_state import Layout -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver.control import CancellationToken, SolveCancelled +import anyfesolver._ge_beam3_controlled_fibre_modes as native +import anyfesolver._ge_beam3_seeded_fibre_control as control +from anyfesolver._ge_beam3_retained_fibre_state import Layout +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.control import CancellationToken, SolveCancelled from test_ge_beam3_retained_fibre_control import make_model, program, arch from test_ge_beam3_retained_fibre_modes import dense_reference @@ -72,7 +72,7 @@ def test_control_authority_guards(accepted, incident): elif incident == 'policy': policy = 'automatic' elif incident == 'old_controller': - from anysolver._ge_beam3_retained_fibre_control import Context as Old + from anyfesolver._ge_beam3_retained_fibre_control import Context as Old raw = Old(model, p).checkpoint(()); expected = sha256(raw).hexdigest() else: token.cancel() diff --git a/tests/test_ge_beam3_controlled_history_objectivity.py b/tests/test_ge_beam3_controlled_history_objectivity.py index 7ae5152fc..fa8368f95 100644 --- a/tests/test_ge_beam3_controlled_history_objectivity.py +++ b/tests/test_ge_beam3_controlled_history_objectivity.py @@ -3,10 +3,10 @@ import json import numpy as np import pytest -from anysolver import _ge_beam3_retained_translation_control as control -from anysolver._ge_beam3_p5_seeded.core import canonical, sha -from anysolver._ge_beam3_native_generalized_program import model_identity -from anysolver.control import CancellationToken +from anyfesolver import _ge_beam3_retained_translation_control as control +from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha +from anyfesolver._ge_beam3_native_generalized_program import model_identity +from anyfesolver.control import CancellationToken from docs.reference_cases.ge_beam3_controlled_history_cases import ( CASES, make, pose, transformed_positions, position_error, axial_reference) from docs.reference_cases.ge_beam3_generalized_ellipsoid_oracle import response as independent diff --git a/tests/test_ge_beam3_coupled_free_beam.py b/tests/test_ge_beam3_coupled_free_beam.py index 499cab611..e38e9b6fb 100644 --- a/tests/test_ge_beam3_coupled_free_beam.py +++ b/tests/test_ge_beam3_coupled_free_beam.py @@ -4,13 +4,13 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_coupled_beam_subdomain import CoupledBeamSubdomain -from anysolver._ge_beam3_shell_joint_trial import ShellBeamTrialAssembly -from anysolver._ge_beam3_shell_joint_state import CoupledShellBeamAnalysis -from anysolver._ge_beam3_retained_generalized_state import Context, Program -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_coupled_beam_subdomain import CoupledBeamSubdomain +from anyfesolver._ge_beam3_shell_joint_trial import ShellBeamTrialAssembly +from anyfesolver._ge_beam3_shell_joint_state import CoupledShellBeamAnalysis +from anyfesolver._ge_beam3_retained_generalized_state import Context, Program +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_p5_seeded.core import canonical from test_ge_beam3_native_generalized_modal import make diff --git a/tests/test_ge_beam3_coupled_modes.py b/tests/test_ge_beam3_coupled_modes.py index f8a1dbd8b..1306bfdae 100644 --- a/tests/test_ge_beam3_coupled_modes.py +++ b/tests/test_ge_beam3_coupled_modes.py @@ -5,14 +5,14 @@ from scipy.linalg import eigvals from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_coupled_modes import capture, modes, buckling -from anysolver._ge_beam3_shell_joint_trial import ShellBeamTrialAssembly -from anysolver._ge_beam3_shell_joint_state import CoupledShellBeamAnalysis -from anysolver._ge_beam3_shell_joint_state import decode -from anysolver._ge_beam3_variational_shell import response as shell_response -from anysolver._ge_beam3_pose_joint import _exp_terms -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver._ge_beam3_coupled_modes import capture, modes, buckling +from anyfesolver._ge_beam3_shell_joint_trial import ShellBeamTrialAssembly +from anyfesolver._ge_beam3_shell_joint_state import CoupledShellBeamAnalysis +from anyfesolver._ge_beam3_shell_joint_state import decode +from anyfesolver._ge_beam3_variational_shell import response as shell_response +from anyfesolver._ge_beam3_pose_joint import _exp_terms +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.control import CancellationToken, SolveCancelled from test_ge_beam3_coupled_free_beam import build from test_ge_beam3_native_generalized_modal import inertia @@ -154,10 +154,10 @@ def test_buckling_without_mass_and_uncondensed_multiplier_pencil(topology, curve def test_nonconservative_programme_rejected_before_spectrum(): - from anysolver._ge_beam3_retained_generalized_state import Program - from anysolver._ge_beam3_coupled_beam_subdomain import CoupledBeamSubdomain - from anysolver._ge_beam3_native_generalized_loading import DistributedPattern - from anysolver._ge_beam3_native_line_loading import LinePattern + from anyfesolver._ge_beam3_retained_generalized_state import Program + from anyfesolver._ge_beam3_coupled_beam_subdomain import CoupledBeamSubdomain + from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern + from anyfesolver._ge_beam3_native_line_loading import LinePattern base = fixture('Q4'); a = base.assembly program = Program((1.,), DistributedPattern(LinePattern(()), ((1, .1, .0, .0), (2, .1, .0, .0)))) beam = CoupledBeamSubdomain(a.beam.model, program) @@ -174,9 +174,9 @@ def test_nonconservative_programme_rejected_before_spectrum(): @pytest.mark.parametrize('topology', ('Q4', 'S3-V2D')) def test_actual_active_plastic_coupled_state_is_not_elastic_spectral_authority(topology, tmp_path): - from anysolver._ge_beam3_retained_generalized_state import Context, Program - from anysolver._ge_beam3_native_generalized_loading import DistributedPattern - from anysolver._ge_beam3_native_line_loading import LinePattern + from anyfesolver._ge_beam3_retained_generalized_state import Context, Program + from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern + from anyfesolver._ge_beam3_native_line_loading import LinePattern from test_ge_beam3_native_generalized_restart import make as plastic_model model = plastic_model('curved-plastic') pattern = DistributedPattern(LinePattern(((1, .09, -.03, .02),)), ()) @@ -225,7 +225,7 @@ def test_exact_zero_versus_small_real_eccentric_inertia(offset, tmp_path): def test_inertia_mutation_during_spectral_solution_rejected(monkeypatch): - from anysolver import _ge_beam3_coupled_modes as module + from anyfesolver import _ge_beam3_coupled_modes as module owner = fixture('Q4', False); state = owner.solve(stop_after=0).state; kwargs = arguments(owner) def mutate(*args, **controls): kwargs['section_inertias'][1][0, 0] += 1. diff --git a/tests/test_ge_beam3_curved_contrast_probe.py b/tests/test_ge_beam3_curved_contrast_probe.py index 2550b2cf4..2e355d7a4 100644 --- a/tests/test_ge_beam3_curved_contrast_probe.py +++ b/tests/test_ge_beam3_curved_contrast_probe.py @@ -7,12 +7,12 @@ import numpy as np import pytest -from anysolver.fe_core import FEModel -from anysolver.boundary import BoundaryCondition -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry -from anysolver._ge_beam3_p5_seeded import NativeP5BeamElement, DirectedHardeningSection -from anysolver._ge_beam3_p5_loads.core import canonical -from anysolver._ge_beam3_seeded_signed_modes import solve_signed_loaded_modes +from anyfesolver.fe_core import FEModel +from anyfesolver.boundary import BoundaryCondition +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry +from anyfesolver._ge_beam3_p5_seeded import NativeP5BeamElement, DirectedHardeningSection +from anyfesolver._ge_beam3_p5_loads.core import canonical +from anyfesolver._ge_beam3_seeded_signed_modes import solve_signed_loaded_modes ROTATION = np.array([[0., -1., 0.], [1., 0., 0.], [0., 0., 1.]]) diff --git a/tests/test_ge_beam3_curved_p4_closeout.py b/tests/test_ge_beam3_curved_p4_closeout.py index 653ed92c4..a624705db 100644 --- a/tests/test_ge_beam3_curved_p4_closeout.py +++ b/tests/test_ge_beam3_curved_p4_closeout.py @@ -469,16 +469,16 @@ def test_authority_topology_incident_archive_and_protected_mechanics_are_exact() ] protected = { - "src/anysolver/ge_beam3_element.py": "70542da7fea26dcb2da5b5f9da5fc0b0b8d484ab", - "src/anysolver/ge_beam3_mixed_element.py": "f49062b55b4bf749a1654100cf3a4ed6ffb61d37", - "src/anysolver/ge_beam3_mixed_state.py": "74caa1814448245f907bd3efdb6c8a1cc1d2269d", - "src/anysolver/ge_beam3_state.py": "ba8f65761197c62cb2b7ce74bf488e75f2c24818", + "src/anyfesolver/ge_beam3_element.py": "70542da7fea26dcb2da5b5f9da5fc0b0b8d484ab", + "src/anyfesolver/ge_beam3_mixed_element.py": "f49062b55b4bf749a1654100cf3a4ed6ffb61d37", + "src/anyfesolver/ge_beam3_mixed_state.py": "74caa1814448245f907bd3efdb6c8a1cc1d2269d", + "src/anyfesolver/ge_beam3_state.py": "ba8f65761197c62cb2b7ce74bf488e75f2c24818", } for path, blob in protected.items(): assert _git_text("rev-parse", f"{C5}:{path}") == blob assert _git_text("rev-parse", f"{P3}:{path}") == blob assert _git_text("diff", "--name-only", P3, C5, "--", "src").splitlines() == [ - "src/anysolver/ge_beam3_curved_reference.py" + "src/anyfesolver/ge_beam3_curved_reference.py" ] assert _git_text("diff", "--name-only", P3, C5, "--", "pyproject.toml", ".github") == "" diff --git a/tests/test_ge_beam3_curved_p4_formal_runner.py b/tests/test_ge_beam3_curved_p4_formal_runner.py index 70826dd81..752b33e11 100644 --- a/tests/test_ge_beam3_curved_p4_formal_runner.py +++ b/tests/test_ge_beam3_curved_p4_formal_runner.py @@ -19,7 +19,7 @@ PRODUCER = REFERENCE / "ge_beam3_curved_p4_reference_producer.py" CHECKER = REFERENCE / "ge_beam3_curved_p4_reference_checker.py" RUNNER = REFERENCE / "ge_beam3_curved_p4_reference_runner.py" -REFERENCE_MODULE = ROOT / "src" / "anysolver" / "ge_beam3_curved_reference.py" +REFERENCE_MODULE = ROOT / "src" / "anyfesolver" / "ge_beam3_curved_reference.py" CASES = REFERENCE / "ge_beam3_curved_p4_cases.json" CONTRACT = REFERENCE / "ge_beam3_curved_p4_contract.json" PASS = "PROVISIONAL_GO_GE_BEAM3_P4_PRIVATE_CURVED_REFERENCE_CORE" @@ -114,14 +114,14 @@ def _complete_cycle(terminal: str) -> dict[str, object]: @pytest.fixture def external_tmp_path() -> Path: - with tempfile.TemporaryDirectory(prefix="anysolver-p4-disposable-") as directory: + with tempfile.TemporaryDirectory(prefix="anyfesolver-p4-disposable-") as directory: path = Path(directory).resolve() with pytest.raises(ValueError): path.relative_to(ROOT) yield path -def test_independent_checker_imports_no_anysolver_or_mechanics_modules() -> None: +def test_independent_checker_imports_no_anyfesolver_or_mechanics_modules() -> None: tree = ast.parse(CHECKER.read_text(encoding="utf-8")) imported: list[str] = [] for node in ast.walk(tree): @@ -129,7 +129,7 @@ def test_independent_checker_imports_no_anysolver_or_mechanics_modules() -> None imported.extend(alias.name for alias in node.names) elif isinstance(node, ast.ImportFrom): imported.append(node.module or "") - assert not any(name == "anysolver" or name.startswith("anysolver.") for name in imported) + assert not any(name == "anyfesolver" or name.startswith("anyfesolver.") for name in imported) assert not any(token in name.lower() for name in imported for token in ("element", "mechanics", "corotational", "recovery")) @@ -157,7 +157,7 @@ def test_authority_manifest_binds_all_programs_commits_and_protected_blobs() -> @pytest.mark.parametrize( "path", - ("pyproject.toml", "src/anysolver/__init__.py", "src/anysolver/elements.py"), + ("pyproject.toml", "src/anyfesolver/__init__.py", "src/anyfesolver/elements.py"), ) def test_added_baseline_blob_drift_is_rejected( monkeypatch: pytest.MonkeyPatch, diff --git a/tests/test_ge_beam3_curved_p4_implementation_review.py b/tests/test_ge_beam3_curved_p4_implementation_review.py index dcc752725..d78979609 100644 --- a/tests/test_ge_beam3_curved_p4_implementation_review.py +++ b/tests/test_ge_beam3_curved_p4_implementation_review.py @@ -19,10 +19,10 @@ "tests/test_ge_beam3_curved_p4_implementation_review.py", } PROTECTED = { - "src/anysolver/ge_beam3_element.py": "70542da7fea26dcb2da5b5f9da5fc0b0b8d484ab", - "src/anysolver/ge_beam3_mixed_element.py": "f49062b55b4bf749a1654100cf3a4ed6ffb61d37", - "src/anysolver/ge_beam3_mixed_state.py": "74caa1814448245f907bd3efdb6c8a1cc1d2269d", - "src/anysolver/ge_beam3_state.py": "ba8f65761197c62cb2b7ce74bf488e75f2c24818", + "src/anyfesolver/ge_beam3_element.py": "70542da7fea26dcb2da5b5f9da5fc0b0b8d484ab", + "src/anyfesolver/ge_beam3_mixed_element.py": "f49062b55b4bf749a1654100cf3a4ed6ffb61d37", + "src/anyfesolver/ge_beam3_mixed_state.py": "74caa1814448245f907bd3efdb6c8a1cc1d2269d", + "src/anyfesolver/ge_beam3_state.py": "ba8f65761197c62cb2b7ce74bf488e75f2c24818", } @@ -109,11 +109,11 @@ def test_review_accepts_only_the_corrected_two_path_reference_core() -> None: "tree": "2235c5f868384f0122ec5eda766cdf01c0923a1f", } assert set(_git("diff-tree", "--no-commit-id", "--name-only", "-r", INITIAL).splitlines()) == { - "src/anysolver/ge_beam3_curved_reference.py", + "src/anyfesolver/ge_beam3_curved_reference.py", "tests/test_ge_beam3_curved_p4_reference.py", } assert set(_git("diff-tree", "--no-commit-id", "--name-only", "-r", CORRECTION).splitlines()) == { - "src/anysolver/ge_beam3_curved_reference.py", + "src/anyfesolver/ge_beam3_curved_reference.py", "tests/test_ge_beam3_curved_p4_reference.py", } diff --git a/tests/test_ge_beam3_curved_p4_preregistration.py b/tests/test_ge_beam3_curved_p4_preregistration.py index b054558cb..391e94cbc 100644 --- a/tests/test_ge_beam3_curved_p4_preregistration.py +++ b/tests/test_ge_beam3_curved_p4_preregistration.py @@ -43,10 +43,10 @@ "tests/test_ge_beam3_curved_p4_preregistration.py", } PROTECTED_STRAIGHT_BLOBS = { - "src/anysolver/ge_beam3_element.py": "70542da7fea26dcb2da5b5f9da5fc0b0b8d484ab", - "src/anysolver/ge_beam3_mixed_element.py": "f49062b55b4bf749a1654100cf3a4ed6ffb61d37", - "src/anysolver/ge_beam3_mixed_state.py": "74caa1814448245f907bd3efdb6c8a1cc1d2269d", - "src/anysolver/ge_beam3_state.py": "ba8f65761197c62cb2b7ce74bf488e75f2c24818", + "src/anyfesolver/ge_beam3_element.py": "70542da7fea26dcb2da5b5f9da5fc0b0b8d484ab", + "src/anyfesolver/ge_beam3_mixed_element.py": "f49062b55b4bf749a1654100cf3a4ed6ffb61d37", + "src/anyfesolver/ge_beam3_mixed_state.py": "74caa1814448245f907bd3efdb6c8a1cc1d2269d", + "src/anyfesolver/ge_beam3_state.py": "ba8f65761197c62cb2b7ce74bf488e75f2c24818", } TERMINALS = [ "BLOCKED_GE_BEAM3_P4_BASELINE_OR_AUTHORITY", @@ -291,7 +291,7 @@ def test_accepted_straight_core_is_bound_by_git_blob_and_content_hash() -> None: assert _git("rev-parse", f"{BASE_COMMIT}:{path}") == git_blob blob = _git_blob(P3_CLOSEOUT, path) assert (len(blob), _sha(blob)) == (row["bytes"], row["sha256"]) - for path in ("src/anysolver/__init__.py", "src/anysolver/elements.py", "pyproject.toml"): + for path in ("src/anyfesolver/__init__.py", "src/anyfesolver/elements.py", "pyproject.toml"): row = rows[path] assert _git("rev-parse", f"{P3_CLOSEOUT}:{path}") == row["git_blob"] assert _git("rev-parse", f"{BASE_COMMIT}:{path}") == row["git_blob"] diff --git a/tests/test_ge_beam3_curved_p4_reference.py b/tests/test_ge_beam3_curved_p4_reference.py index 4d9203fc5..a6929d57d 100644 --- a/tests/test_ge_beam3_curved_p4_reference.py +++ b/tests/test_ge_beam3_curved_p4_reference.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from anysolver.ge_beam3_curved_reference import ( +from anyfesolver.ge_beam3_curved_reference import ( CurvedBeam3ReferenceGeometry, GE_BEAM3_CURVED_REFERENCE_INTERPOLATION_ID, GE_BEAM3_CURVED_REFERENCE_SCHEMA_ID, diff --git a/tests/test_ge_beam3_curved_p4_scientific_executor.py b/tests/test_ge_beam3_curved_p4_scientific_executor.py index ad86ed24c..e96bbc197 100644 --- a/tests/test_ge_beam3_curved_p4_scientific_executor.py +++ b/tests/test_ge_beam3_curved_p4_scientific_executor.py @@ -445,7 +445,7 @@ def test_authority_scope_chain_and_hash_bindings_are_closed( elif mutation == "relative_location": authority["locations"]["output"] = "relative/result.json" elif mutation == "harness_path": - authority["harness"]["runner"]["path"] = "src/anysolver/elements.py" + authority["harness"]["runner"]["path"] = "src/anyfesolver/elements.py" elif mutation == "manifest_hash": authority["harness"]["authority_manifest_sha256"] = "F" * 64 elif mutation == "harness_hash": @@ -589,7 +589,7 @@ def test_executor_is_stdlib_only_and_cannot_author_request_or_authority() -> Non "signal", "stat", "subprocess", "sys", "time", "typing", } assert imports <= allowed - assert "numpy" not in imports and "anysolver" not in imports + assert "numpy" not in imports and "anyfesolver" not in imports assert "--create-authority" not in source assert "--create-request" not in source # The official request helper may be named in a comment, but the executor diff --git a/tests/test_ge_beam3_curved_p5_algebra_probe.py b/tests/test_ge_beam3_curved_p5_algebra_probe.py index 289b546d1..30bbca217 100644 --- a/tests/test_ge_beam3_curved_p5_algebra_probe.py +++ b/tests/test_ge_beam3_curved_p5_algebra_probe.py @@ -9,7 +9,7 @@ import numpy as np import pytest -from anysolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry +from anyfesolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry ROOT = Path(__file__).resolve().parents[1] @@ -165,7 +165,7 @@ def test_reversal_preserves_coupled_work_and_transforms_moments_and_hessian(): def test_straight_limit_agrees_with_frozen_p3_uneliminated_functional(): # Comparison target is imported only in this test, never by the probe. - from anysolver.ge_beam3_mixed_element import GeometricallyExactBeam3D3NElement + from anyfesolver.ge_beam3_mixed_element import GeometricallyExactBeam3D3NElement ref = reference(0.) x, q, u = perturbed(ref) _, moments = probe.reduced_energy(ref, section(), x, q, u) @@ -177,7 +177,7 @@ def test_straight_limit_agrees_with_frozen_p3_uneliminated_functional(): def test_straight_reference_full_and_condensed_hessians_agree_with_p3(): - from anysolver.ge_beam3_mixed_element import GeometricallyExactBeam3D3NElement + from anyfesolver.ge_beam3_mixed_element import GeometricallyExactBeam3D3NElement ref = reference(0.) physical_cells = ref.nodal_triads[:2] old = GeometricallyExactBeam3D3NElement._potential( diff --git a/tests/test_ge_beam3_curved_p5_assembly_history_probe.py b/tests/test_ge_beam3_curved_p5_assembly_history_probe.py index 3faca27ad..ef4e4d949 100644 --- a/tests/test_ge_beam3_curved_p5_assembly_history_probe.py +++ b/tests/test_ge_beam3_curved_p5_assembly_history_probe.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry +from anyfesolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry from docs.reference_cases import ge_beam3_curved_p5_assembly_history_probe as assembly from docs.reference_cases.ge_beam3_curved_p5_algebra_probe import rotation, T6 from docs.reference_cases.ge_beam3_curved_p5_continuum_probe import parabolic_references, discrete_tip_compliance diff --git a/tests/test_ge_beam3_curved_p5_centered_chord.py b/tests/test_ge_beam3_curved_p5_centered_chord.py index 25a06b12e..8f441f994 100644 --- a/tests/test_ge_beam3_curved_p5_centered_chord.py +++ b/tests/test_ge_beam3_curved_p5_centered_chord.py @@ -10,8 +10,8 @@ import numpy as np import pytest -from anysolver._ge_beam3_mixed_ad import Jet2, constant_matrix -from anysolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry +from anyfesolver._ge_beam3_mixed_ad import Jet2, constant_matrix +from anyfesolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry from docs.reference_cases.ge_beam3_curved_p5_centered_chord import ( CenteredChordMixedProbe, CenteredChordAssemblyHistoryProbe, SCHEMA, ) diff --git a/tests/test_ge_beam3_curved_p5_chain_probe.py b/tests/test_ge_beam3_curved_p5_chain_probe.py index bc3ec77af..9ba91480b 100644 --- a/tests/test_ge_beam3_curved_p5_chain_probe.py +++ b/tests/test_ge_beam3_curved_p5_chain_probe.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from anysolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry +from anyfesolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry from docs.reference_cases.ge_beam3_curved_p5_algebra_probe import HALVES, metrics from docs.reference_cases.ge_beam3_curved_p5_chain_probe import ReferenceChainProbe, ChainSolveError, add_expansion from docs.reference_cases.ge_beam3_curved_p5_precise_reference_probe import PreciseReferenceAction diff --git a/tests/test_ge_beam3_curved_p5_coordinate_installed.py b/tests/test_ge_beam3_curved_p5_coordinate_installed.py index 7dc04d586..ac9bad133 100644 --- a/tests/test_ge_beam3_curved_p5_coordinate_installed.py +++ b/tests/test_ge_beam3_curved_p5_coordinate_installed.py @@ -28,8 +28,8 @@ def test_coordinate_wheel_two_fresh_process_checks(tmp_path): shutil.copytree(root/'src',build/'src',ignore=shutil.ignore_patterns('__pycache__','*.egg-info')) # Exercise the Windows checkout transform in the disposable snapshot. # Canonical source hashes and actual installed byte hashes are distinct. - for path in [*(build/'src/anysolver/_ge_beam3_p5').glob('*.py'), - *(build/'src/anysolver/_ge_beam3_p5_coordinates').glob('*.py')]: + for path in [*(build/'src/anyfesolver/_ge_beam3_p5').glob('*.py'), + *(build/'src/anyfesolver/_ge_beam3_p5_coordinates').glob('*.py')]: raw = path.read_bytes().replace(b'\r\n',b'\n') path.write_bytes(raw.replace(b'\n',b'\r\n')) for name in ('pyproject.toml','README.md','LICENSE','COPYRIGHT','THIRD_PARTY_NOTICES.md'): @@ -49,8 +49,8 @@ def command(argv, cwd, limit=120): wheel = candidates[0] with zipfile.ZipFile(wheel) as archive: assert not any(name.startswith(('docs/','tests/')) for name in archive.namelist()) - assert 'anysolver/_ge_beam3_p5/element.py' in archive.namelist() - assert 'anysolver/_ge_beam3_p5_coordinates/element.py' in archive.namelist() + assert 'anyfesolver/_ge_beam3_p5/element.py' in archive.namelist() + assert 'anyfesolver/_ge_beam3_p5_coordinates/element.py' in archive.namelist() environment = tmp_path/'environment' command([sys.executable,'-I','-B','-m','venv',str(environment)],tmp_path) python = environment/('Scripts/python.exe' if os.name == 'nt' else 'bin/python') diff --git a/tests/test_ge_beam3_curved_p5_coordinate_state.py b/tests/test_ge_beam3_curved_p5_coordinate_state.py index c3699268b..88a44cdfe 100644 --- a/tests/test_ge_beam3_curved_p5_coordinate_state.py +++ b/tests/test_ge_beam3_curved_p5_coordinate_state.py @@ -6,19 +6,19 @@ import numpy as np import pytest -from anysolver.fe_core import FEModel -from anysolver.boundary import BoundaryCondition, LoadCase -from anysolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry -from anysolver.nonlinear_static import _assemble_nonlinear_system, solve_static_nonlinear -from anysolver.nonlinear_state import NonlinearStateStore, create_model_native_rotation_store -from anysolver.nonlinear_restart import canonical_checkpoint_json_bytes -from anysolver._ge_beam3_p5 import NativeP5BeamElement as V1 -from anysolver._ge_beam3_p5_coordinates import NativeP5BeamElement, DirectedHardeningSection -from anysolver._ge_beam3_p5_coordinates import codec -from anysolver._ge_beam3_p5_coordinates.core import canonical, seal -from anysolver._ge_beam3_p5_coordinates.positions import from_total, validate_total_pair, POLICY, rest_mass -from anysolver._ge_beam3_p5_coordinates.committed_modal import prepare, solve_elastic_modes -from anysolver._ge_beam3_p5_coordinates.reference_modal import solve as reference_modes +from anyfesolver.fe_core import FEModel +from anyfesolver.boundary import BoundaryCondition, LoadCase +from anyfesolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry +from anyfesolver.nonlinear_static import _assemble_nonlinear_system, solve_static_nonlinear +from anyfesolver.nonlinear_state import NonlinearStateStore, create_model_native_rotation_store +from anyfesolver.nonlinear_restart import canonical_checkpoint_json_bytes +from anyfesolver._ge_beam3_p5 import NativeP5BeamElement as V1 +from anyfesolver._ge_beam3_p5_coordinates import NativeP5BeamElement, DirectedHardeningSection +from anyfesolver._ge_beam3_p5_coordinates import codec +from anyfesolver._ge_beam3_p5_coordinates.core import canonical, seal +from anyfesolver._ge_beam3_p5_coordinates.positions import from_total, validate_total_pair, POLICY, rest_mass +from anyfesolver._ge_beam3_p5_coordinates.committed_modal import prepare, solve_elastic_modes +from anyfesolver._ge_beam3_p5_coordinates.reference_modal import solve as reference_modes from test_ge_beam3_curved_p5_algebra_probe import reference from test_ge_beam3_curved_p5_nonlinear_mixed_probe import law from test_ge_beam3_curved_p5_mass_probe import section_mass @@ -326,8 +326,8 @@ def test_successor_source_map_binds_all_modules_and_preserves_v1(): tree = ast.parse(mapping.source(mapping.TARGET+'/'+name)) for node in ast.walk(tree): if isinstance(node, ast.ImportFrom): assert not (node.module or '').startswith(('docs','tests')) - import anysolver - assert not hasattr(anysolver,'NativeP5BeamElement') + import anyfesolver + assert not hasattr(anyfesolver,'NativeP5BeamElement') def test_source_map_rejects_changed_preserved_mechanics(monkeypatch): @@ -335,7 +335,7 @@ def test_source_map_rejects_changed_preserved_mechanics(monkeypatch): read = mapping.source def changed(path): raw = read(path) - return raw+b'\n' if path == 'src/anysolver/_ge_beam3_p5/compensated.py' else raw + return raw+b'\n' if path == 'src/anyfesolver/_ge_beam3_p5/compensated.py' else raw monkeypatch.setattr(mapping,'source',changed) with pytest.raises(ValueError, match='preserved package mechanics'): mapping.build() diff --git a/tests/test_ge_beam3_curved_p5_displacement_control_probe.py b/tests/test_ge_beam3_curved_p5_displacement_control_probe.py index 9334825d8..0cfb005d5 100644 --- a/tests/test_ge_beam3_curved_p5_displacement_control_probe.py +++ b/tests/test_ge_beam3_curved_p5_displacement_control_probe.py @@ -86,7 +86,7 @@ def test_small_controlled_reversal_restores_elastic_reference_state(): def test_coupled_plastic_section_control_replay_and_discard(): - from anysolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry + from anyfesolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry from docs.reference_cases.ge_beam3_curved_p5_assembly_history_probe import NonlinearAssemblyHistoryProbe from test_ge_beam3_curved_p5_nonlinear_mixed_probe import law reference=CurvedBeam3ReferenceGeometry([[0.,0.,0.],[1.,0.,0.],[2.,0.,0.]],np.tile(np.eye(3),(3,1,1))) diff --git a/tests/test_ge_beam3_curved_p5_dynamic_assembly_probe.py b/tests/test_ge_beam3_curved_p5_dynamic_assembly_probe.py index d5096783e..4ebe257eb 100644 --- a/tests/test_ge_beam3_curved_p5_dynamic_assembly_probe.py +++ b/tests/test_ge_beam3_curved_p5_dynamic_assembly_probe.py @@ -6,7 +6,7 @@ import numpy as np import pytest -from anysolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry +from anyfesolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry from docs.reference_cases import ge_beam3_curved_p5_dynamic_assembly_probe as assembly from docs.reference_cases.ge_beam3_curved_p5_algebra_probe import rotation from docs.reference_cases.ge_beam3_curved_p5_continuum_probe import parabolic_references diff --git a/tests/test_ge_beam3_curved_p5_finite_probe.py b/tests/test_ge_beam3_curved_p5_finite_probe.py index d3fcd7408..137ea6c91 100644 --- a/tests/test_ge_beam3_curved_p5_finite_probe.py +++ b/tests/test_ge_beam3_curved_p5_finite_probe.py @@ -125,7 +125,7 @@ def test_finite_reversal_transports_condensed_tangent_and_moment_work(): def test_finite_straight_limit_matches_p3_local_solve_and_response(): - from anysolver.ge_beam3_mixed_element import GeometricallyExactBeam3D3NElement as P3 + from anyfesolver.ge_beam3_mixed_element import GeometricallyExactBeam3D3NElement as P3 ref = reference(0.) x, q, _ = perturbed(ref) made = CurvedFiniteProbe(ref, section()).evaluate(x, q) diff --git a/tests/test_ge_beam3_curved_p5_installed_candidate.py b/tests/test_ge_beam3_curved_p5_installed_candidate.py index 9a11b9e1a..f95f3f36b 100644 --- a/tests/test_ge_beam3_curved_p5_installed_candidate.py +++ b/tests/test_ge_beam3_curved_p5_installed_candidate.py @@ -28,7 +28,7 @@ def test_offline_wheel_two_fresh_process_checks(tmp_path): shutil.copytree(root/'src',build/'src',ignore=shutil.ignore_patterns('__pycache__','*.egg-info')) # Exercise the Windows checkout transform in the disposable snapshot. # Canonical source hashes and actual installed byte hashes are distinct. - for path in (build/'src/anysolver/_ge_beam3_p5').glob('*.py'): + for path in (build/'src/anyfesolver/_ge_beam3_p5').glob('*.py'): raw = path.read_bytes().replace(b'\r\n',b'\n') path.write_bytes(raw.replace(b'\n',b'\r\n')) for name in ('pyproject.toml','README.md','LICENSE','COPYRIGHT','THIRD_PARTY_NOTICES.md'): @@ -48,7 +48,7 @@ def command(argv, cwd, limit=120): wheel = candidates[0] with zipfile.ZipFile(wheel) as archive: assert not any(name.startswith(('docs/','tests/')) for name in archive.namelist()) - assert 'anysolver/_ge_beam3_p5/element.py' in archive.namelist() + assert 'anyfesolver/_ge_beam3_p5/element.py' in archive.namelist() environment = tmp_path/'environment' command([sys.executable,'-I','-B','-m','venv',str(environment)],tmp_path) python = environment/('Scripts/python.exe' if os.name == 'nt' else 'bin/python') diff --git a/tests/test_ge_beam3_curved_p5_local_residual_diagnostic.py b/tests/test_ge_beam3_curved_p5_local_residual_diagnostic.py index 95319af75..0a81da06b 100644 --- a/tests/test_ge_beam3_curved_p5_local_residual_diagnostic.py +++ b/tests/test_ge_beam3_curved_p5_local_residual_diagnostic.py @@ -8,7 +8,7 @@ import numpy as np import pytest -from anysolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry +from anyfesolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry from docs.reference_cases.ge_beam3_curved_p5_algebra_probe import rotation from docs.reference_cases.ge_beam3_curved_p5_nonlinear_mixed_probe import NonlinearMixedBeamProbe from docs.reference_cases.ge_beam3_curved_p5_section_probe import DirectedHardeningSectionProbe diff --git a/tests/test_ge_beam3_curved_p5_native_chart_probe.py b/tests/test_ge_beam3_curved_p5_native_chart_probe.py index b7235a559..bddf83d4d 100644 --- a/tests/test_ge_beam3_curved_p5_native_chart_probe.py +++ b/tests/test_ge_beam3_curved_p5_native_chart_probe.py @@ -3,8 +3,8 @@ import numpy as np import pytest -from anysolver._native_rotation_state import NativeRotationStateStore, NativeRotationStateError -from anysolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry +from anyfesolver._native_rotation_state import NativeRotationStateStore, NativeRotationStateError +from anyfesolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry from docs.reference_cases import ge_beam3_curved_p5_native_chart_probe as probe from docs.reference_cases.ge_beam3_curved_p5_algebra_probe import rotation from docs.reference_cases.ge_beam3_curved_p5_implicit_dynamics_probe import left_jacobian diff --git a/tests/test_ge_beam3_curved_p5_native_committed_modal.py b/tests/test_ge_beam3_curved_p5_native_committed_modal.py index 0165a1d2a..8e33f590a 100644 --- a/tests/test_ge_beam3_curved_p5_native_committed_modal.py +++ b/tests/test_ge_beam3_curved_p5_native_committed_modal.py @@ -6,11 +6,11 @@ import numpy as np import pytest -from anysolver.fe_core import FEModel -from anysolver.boundary import BoundaryCondition, LoadCase -from anysolver.control import CancellationToken, SolveCancelled -from anysolver.nonlinear_static import solve_static_nonlinear -from anysolver._native_stationary_spectrum import solve_stationary_spectrum +from anyfesolver.fe_core import FEModel +from anyfesolver.boundary import BoundaryCondition, LoadCase +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver.nonlinear_static import solve_static_nonlinear +from anyfesolver._native_stationary_spectrum import solve_stationary_spectrum from docs.reference_cases.ge_beam3_curved_p5_native_driver_probe import DriverP5Element from docs.reference_cases.ge_beam3_curved_p5_native_material_probe import canonical, seal from docs.reference_cases.ge_beam3_curved_p5_native_committed_modal_probe import prepare, solve_elastic_modes, _operator diff --git a/tests/test_ge_beam3_curved_p5_native_controls.py b/tests/test_ge_beam3_curved_p5_native_controls.py index 12b42bb9d..8b9fc86bf 100644 --- a/tests/test_ge_beam3_curved_p5_native_controls.py +++ b/tests/test_ge_beam3_curved_p5_native_controls.py @@ -3,14 +3,14 @@ import numpy as np import pytest -from anysolver.arc_length import ArcLengthControl, solve_static_arc_length -from anysolver.control import CancellationToken, SolveCancelled -from anysolver.nonlinear_static import ( +from anyfesolver.arc_length import ArcLengthControl, solve_static_arc_length +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver.nonlinear_static import ( solve_static_nonlinear, DisplacementControl, NonlinearLoadStage, NonlinearLoadProgram, NonlinearConvergenceSettings, ) -from anysolver.boundary import LoadCase -from anysolver.nonlinear_restart import canonical_checkpoint_json_bytes +from anyfesolver.boundary import LoadCase +from anyfesolver.nonlinear_restart import canonical_checkpoint_json_bytes from docs.reference_cases.ge_beam3_curved_p5_native_material_probe import canonical from test_ge_beam3_curved_p5_native_driver_probe import problem diff --git a/tests/test_ge_beam3_curved_p5_native_driver_probe.py b/tests/test_ge_beam3_curved_p5_native_driver_probe.py index f1260cdd2..9eaae4b53 100644 --- a/tests/test_ge_beam3_curved_p5_native_driver_probe.py +++ b/tests/test_ge_beam3_curved_p5_native_driver_probe.py @@ -6,13 +6,13 @@ import numpy as np import pytest -from anysolver.fe_core import FEModel -from anysolver.boundary import BoundaryCondition, LoadCase -from anysolver.nonlinear_static import solve_static_nonlinear, _assemble_nonlinear_system, NonlinearConvergenceSettings -from anysolver.nonlinear_state import NonlinearStateStore, StateTransactionError, create_model_native_rotation_store -from anysolver._native_rotation_state import NativeRotationValidationError -from anysolver._native_material_protocol import NativeMaterialValidator, NativeMaterialContext -from anysolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry +from anyfesolver.fe_core import FEModel +from anyfesolver.boundary import BoundaryCondition, LoadCase +from anyfesolver.nonlinear_static import solve_static_nonlinear, _assemble_nonlinear_system, NonlinearConvergenceSettings +from anyfesolver.nonlinear_state import NonlinearStateStore, StateTransactionError, create_model_native_rotation_store +from anyfesolver._native_rotation_state import NativeRotationValidationError +from anyfesolver._native_material_protocol import NativeMaterialValidator, NativeMaterialContext +from anyfesolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry from docs.reference_cases.ge_beam3_curved_p5_native_driver_probe import DriverP5Element from docs.reference_cases.ge_beam3_curved_p5_native_material_probe import NativeMaterialError, canonical, seal from docs.reference_cases.ge_beam3_curved_p5_algebra_probe import reference_hessians diff --git a/tests/test_ge_beam3_curved_p5_native_material_probe.py b/tests/test_ge_beam3_curved_p5_native_material_probe.py index 7c8a58116..4e1423519 100644 --- a/tests/test_ge_beam3_curved_p5_native_material_probe.py +++ b/tests/test_ge_beam3_curved_p5_native_material_probe.py @@ -6,10 +6,10 @@ import numpy as np import pytest -from anysolver.fe_core import FEModel -from anysolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry -from anysolver.nonlinear_element_evaluation import evaluate_nonlinear_element, NativeNonlinearEvaluationError -from anysolver.nonlinear_state import StateTransactionError +from anyfesolver.fe_core import FEModel +from anyfesolver.ge_beam3_curved_reference import CurvedBeam3ReferenceGeometry +from anyfesolver.nonlinear_element_evaluation import evaluate_nonlinear_element, NativeNonlinearEvaluationError +from anyfesolver.nonlinear_state import StateTransactionError from docs.reference_cases import ge_beam3_curved_p5_native_material_probe as probe from docs.reference_cases.ge_beam3_curved_p5_section_probe import SectionHistory from test_ge_beam3_curved_p5_algebra_probe import reference, assert_scaled_close diff --git a/tests/test_ge_beam3_curved_p5_native_modal.py b/tests/test_ge_beam3_curved_p5_native_modal.py index 3422a793a..49b9a7d83 100644 --- a/tests/test_ge_beam3_curved_p5_native_modal.py +++ b/tests/test_ge_beam3_curved_p5_native_modal.py @@ -5,10 +5,10 @@ import numpy as np import pytest -from anysolver.fe_core import FEModel -from anysolver.boundary import BoundaryCondition -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._native_reference_modal import solve_reference_modal +from anyfesolver.fe_core import FEModel +from anyfesolver.boundary import BoundaryCondition +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._native_reference_modal import solve_reference_modal from docs.reference_cases.ge_beam3_curved_p5_native_driver_probe import DriverP5Element from docs.reference_cases.ge_beam3_curved_p5_native_modal_probe import solve, prepare from docs.reference_cases.ge_beam3_curved_p5_native_material_probe import canonical @@ -210,7 +210,7 @@ def test_caller_inertia_is_copied_not_a_live_mutable_input(): def test_no_research_mechanics_imports_in_native_assembler(): import ast from pathlib import Path - import anysolver._native_reference_modal as native + import anyfesolver._native_reference_modal as native tree = ast.parse(Path(native.__file__).read_text(encoding='utf-8')) imports = [node.module or '' for node in ast.walk(tree) if isinstance(node, ast.ImportFrom)] assert set(imports) == {'dataclasses', 'scipy', 'assembly', 'control'} diff --git a/tests/test_ge_beam3_curved_p5_native_restart_recovery.py b/tests/test_ge_beam3_curved_p5_native_restart_recovery.py index 2fe5bed82..9e9a0a778 100644 --- a/tests/test_ge_beam3_curved_p5_native_restart_recovery.py +++ b/tests/test_ge_beam3_curved_p5_native_restart_recovery.py @@ -11,8 +11,8 @@ import numpy as np import pytest -from anysolver.nonlinear_static import solve_static_nonlinear -from anysolver.nonlinear_restart import canonical_checkpoint_json_bytes, _state_records, NonlinearCheckpointError +from anyfesolver.nonlinear_static import solve_static_nonlinear +from anyfesolver.nonlinear_restart import canonical_checkpoint_json_bytes, _state_records, NonlinearCheckpointError from docs.reference_cases.ge_beam3_curved_p5_native_material_probe import canonical, seal, NativeMaterialError from docs.reference_cases import ge_beam3_curved_p5_native_state_codec as codec from docs.reference_cases.ge_beam3_curved_p5_algebra_probe import rotation @@ -58,7 +58,7 @@ def test_fresh_process_checkpoint_continuation_matches(completed_paths, tmp_path script='''from pathlib import Path import sys from test_ge_beam3_curved_p5_native_restart_recovery import problem, solve -from anysolver.nonlinear_restart import canonical_checkpoint_json_bytes +from anyfesolver.nonlinear_restart import canonical_checkpoint_json_bytes model, element, load=problem() result=solve(model, load, num_steps=2, max_load_factor=1., restart_checkpoint=Path(sys.argv[1]).read_bytes(), emit_restart_checkpoint=True) assert result.status=='completed' diff --git a/tests/test_ge_beam3_curved_p5_nonlinear_mixed_probe.py b/tests/test_ge_beam3_curved_p5_nonlinear_mixed_probe.py index cd65e4a69..5ed3e0d69 100644 --- a/tests/test_ge_beam3_curved_p5_nonlinear_mixed_probe.py +++ b/tests/test_ge_beam3_curved_p5_nonlinear_mixed_probe.py @@ -83,7 +83,7 @@ def test_plastic_full_gradient_hessian_and_geometric_chain_rule(): def test_missing_geometric_second_variation_is_detected(monkeypatch): import docs.reference_cases.ge_beam3_curved_p5_nonlinear_mixed_probe as module - from anysolver._ge_beam3_mixed_ad import Jet2 + from anyfesolver._ge_beam3_mixed_ad import Jet2 ref = reference(.4) x, q, u = perturbed(ref) moments = np.cos(np.arange(12)).reshape(2, 2, 3)/7 diff --git a/tests/test_ge_beam3_curved_p5_package_candidate.py b/tests/test_ge_beam3_curved_p5_package_candidate.py index 2fa961b23..16dd3d4bb 100644 --- a/tests/test_ge_beam3_curved_p5_package_candidate.py +++ b/tests/test_ge_beam3_curved_p5_package_candidate.py @@ -7,14 +7,14 @@ import numpy as np import pytest -from anysolver.fe_core import FEModel -from anysolver.boundary import BoundaryCondition, LoadCase -from anysolver.nonlinear_static import solve_static_nonlinear -from anysolver.nonlinear_restart import canonical_checkpoint_json_bytes -from anysolver._ge_beam3_p5 import NativeP5BeamElement, DirectedHardeningSection -from anysolver._ge_beam3_p5 import codec as package_codec -from anysolver._ge_beam3_p5.reference_modal import solve as package_modes -from anysolver._ge_beam3_p5.committed_modal import solve_elastic_modes as package_current_modes +from anyfesolver.fe_core import FEModel +from anyfesolver.boundary import BoundaryCondition, LoadCase +from anyfesolver.nonlinear_static import solve_static_nonlinear +from anyfesolver.nonlinear_restart import canonical_checkpoint_json_bytes +from anyfesolver._ge_beam3_p5 import NativeP5BeamElement, DirectedHardeningSection +from anyfesolver._ge_beam3_p5 import codec as package_codec +from anyfesolver._ge_beam3_p5.reference_modal import solve as package_modes +from anyfesolver._ge_beam3_p5.committed_modal import solve_elastic_modes as package_current_modes from docs.reference_cases.ge_beam3_curved_p5_native_driver_probe import DriverP5Element from docs.reference_cases.ge_beam3_curved_p5_native_material_probe import canonical from docs.reference_cases.ge_beam3_curved_p5_native_modal_probe import solve as research_modes diff --git a/tests/test_ge_beam3_curved_p5_retained_response_probe.py b/tests/test_ge_beam3_curved_p5_retained_response_probe.py index e05a2bf5c..38ce6870e 100644 --- a/tests/test_ge_beam3_curved_p5_retained_response_probe.py +++ b/tests/test_ge_beam3_curved_p5_retained_response_probe.py @@ -13,7 +13,7 @@ def test_retained_straight_limit_matches_accepted_p3_potential_and_derivatives(): - from anysolver.ge_beam3_mixed_element import GeometricallyExactBeam3D3NElement as P3 + from anyfesolver.ge_beam3_mixed_element import GeometricallyExactBeam3D3NElement as P3 ref = reference(0.) x, q, _ = perturbed(ref) made = RetainedFiniteResponseProbe(ref, section(), x, q).evaluate() diff --git a/tests/test_ge_beam3_curved_reference_modes_probe.py b/tests/test_ge_beam3_curved_reference_modes_probe.py index baa9e255f..e10fde581 100644 --- a/tests/test_ge_beam3_curved_reference_modes_probe.py +++ b/tests/test_ge_beam3_curved_reference_modes_probe.py @@ -48,7 +48,7 @@ def test_frozen_and_higher_kinetic_rules_are_not_conflated(monkeypatch): import numpy as np from docs.reference_cases import ge_beam3_curved_reference_modes as comparison from docs.reference_cases import ge_beam3_curved_moment_fixture as fixture - from anysolver._ge_beam3_lifted_kinetic_factor import current_lifted_kinetic_factor + from anyfesolver._ge_beam3_lifted_kinetic_factor import current_lifted_kinetic_factor if not comparison.REFERENCE_PATH.is_file(): pytest.skip('Preserved development reference not installed') def forbidden(*args,**kwargs): raise AssertionError('reference solve must not be rerun') monkeypatch.setattr(comparison.ritz,'solve',forbidden) diff --git a/tests/test_ge_beam3_dead_line_saved.py b/tests/test_ge_beam3_dead_line_saved.py index 142e015fb..de71f9983 100644 --- a/tests/test_ge_beam3_dead_line_saved.py +++ b/tests/test_ge_beam3_dead_line_saved.py @@ -42,7 +42,7 @@ def test_external_hash_dag_and_complete_recomputation_without_equilibrium_solves def forbidden(*args,**kwargs): raise AssertionError('Inspection must not solve') monkeypatch.setattr(compare,'build',forbidden) monkeypatch.setattr(compare.reference,'solve',forbidden) - from anysolver import _ge_beam3_fibre_line_program as native + from anyfesolver import _ge_beam3_fibre_line_program as native monkeypatch.setattr(native,'solve_force_program',forbidden) result=saved() for row in result['artifacts']: diff --git a/tests/test_ge_beam3_decimal_cell_force_audit.py b/tests/test_ge_beam3_decimal_cell_force_audit.py index a42eec58b..8f1297caf 100644 --- a/tests/test_ge_beam3_decimal_cell_force_audit.py +++ b/tests/test_ge_beam3_decimal_cell_force_audit.py @@ -6,7 +6,7 @@ import pytest from docs.reference_cases.ge_beam3_decimal_cell_force_audit import audit from test_ge_beam3_plastic_cell_conjugate_probe import build -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_p5_seeded.core import canonical ARCHIVE = Path('C:/Users/AudunArnesenNyhus/AppData/Local/ANYrelease/ge-beam3-complementary-plastic-development-20260907-9325e35bd701/cell-final-failure') diff --git a/tests/test_ge_beam3_deterministic_reduction.py b/tests/test_ge_beam3_deterministic_reduction.py index ef7bd5b92..c1932a5c0 100644 --- a/tests/test_ge_beam3_deterministic_reduction.py +++ b/tests/test_ge_beam3_deterministic_reduction.py @@ -16,7 +16,7 @@ import numpy as np import pytest -from anysolver._ge_beam3_deterministic_reduction import ( +from anyfesolver._ge_beam3_deterministic_reduction import ( _round_sqrt, _sqrt_fraction, deterministic_dot, @@ -32,7 +32,7 @@ def isolated_decimal_context(): def test_fma_overflow_accumulator_and_signed_zero(): from math import copysign, inf - from anysolver._ge_beam3_deterministic_reduction import _fma + from anyfesolver._ge_beam3_deterministic_reduction import _fma assert deterministic_dot([2.**1023, 2.**1023], [2., -2.]) == inf assert deterministic_dot([-2.**1023, 2.**1023], [2., 2.]) == -inf assert copysign(1., _fma(-0., 1., -0.)) == -1. diff --git a/tests/test_ge_beam3_displacement_program.py b/tests/test_ge_beam3_displacement_program.py index 318bdf926..8679d20dc 100644 --- a/tests/test_ge_beam3_displacement_program.py +++ b/tests/test_ge_beam3_displacement_program.py @@ -6,10 +6,10 @@ import pytest from scipy import sparse -import anysolver._ge_beam3_displacement_program as driver -from anysolver._ge_beam3_load_program import ForceProgram, solve_force_program -from anysolver._ge_beam3_p5_loads.core import canonical, sha -from anysolver.control import CancellationToken +import anyfesolver._ge_beam3_displacement_program as driver +from anyfesolver._ge_beam3_load_program import ForceProgram, solve_force_program +from anyfesolver._ge_beam3_p5_loads.core import canonical, sha +from anyfesolver.control import CancellationToken from test_ge_beam3_native_load_state import problem, store_for, assemble @@ -137,10 +137,10 @@ def arch(): Reconstruct directly with native elements, not the old research mechanics. No claim that this coarse branch is an engineering/stability certificate. """ - from anysolver.fe_core import FEModel - from anysolver.boundary import BoundaryCondition - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference - from anysolver._ge_beam3_p5_loads import NativeP5BeamElement, DirectedHardeningSection + from anyfesolver.fe_core import FEModel + from anyfesolver.boundary import BoundaryCondition + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference + from anyfesolver._ge_beam3_p5_loads import NativeP5BeamElement, DirectedHardeningSection made = FEModel('native-displacement-arch'); ids = (7,23,55,81,103) x = np.linspace(-1.,1.,5); points = np.array([[s,.1*(1-s*s),0.] for s in x]) frames = [] diff --git a/tests/test_ge_beam3_displacement_program_checkpoint.py b/tests/test_ge_beam3_displacement_program_checkpoint.py index dcb29c2fe..bb7232d72 100644 --- a/tests/test_ge_beam3_displacement_program_checkpoint.py +++ b/tests/test_ge_beam3_displacement_program_checkpoint.py @@ -62,9 +62,9 @@ def test_genuine_failure_and_matching_corrected_traces_are_retained(): @pytest.mark.parametrize('path',[ - 'src/anysolver/_ge_beam3_displacement_program.py', + 'src/anyfesolver/_ge_beam3_displacement_program.py', 'tests/test_ge_beam3_displacement_program.py', - 'src/anysolver/_ge_beam3_load_program.py', + 'src/anyfesolver/_ge_beam3_load_program.py', ]) def test_changed_driver_test_or_preserved_helper_breaks_binding(monkeypatch,path): original = source diff --git a/tests/test_ge_beam3_durable_coupled.py b/tests/test_ge_beam3_durable_coupled.py index 5859cf3c3..21a8997dd 100644 --- a/tests/test_ge_beam3_durable_coupled.py +++ b/tests/test_ge_beam3_durable_coupled.py @@ -5,11 +5,11 @@ import numpy as np import pytest -from anysolver._ge_beam3_durable_coupled import DurableCoupledBeamAnalysis -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_shell_joint_state import decode -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver._ge_beam3_durable_coupled import DurableCoupledBeamAnalysis +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_shell_joint_state import decode +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.control import CancellationToken, SolveCancelled from test_ge_beam3_coupled_modes import fixture, arguments @@ -36,7 +36,7 @@ def test_later_operations_reconstruct_and_replay_without_renewing_old_owner(topo first = made.solve(stop_after=1) assert first.status == 'paused', first.failure # Simulate idle time, not a relaxed deadline: the original owner expires. - import anysolver._ge_beam3_coupled_beam_subdomain as subdomain + import anyfesolver._ge_beam3_coupled_beam_subdomain as subdomain clock = monotonic()+240. monkeypatch.setattr(subdomain, 'monotonic', lambda: monotonic()+240.) with pytest.raises(RuntimeError, match='deadline'): direct.guard() @@ -85,7 +85,7 @@ def test_real_spectral_queries_replay_exact_accepted_state(topology, tmp_path): made, direct = durable(topology) a = made.solve(stop_after=1); b = direct.solve(stop_after=1) assert a.status == b.status == 'paused', (a.failure, b.failure) - from anysolver._ge_beam3_coupled_modes import modes, buckling + from anyfesolver._ge_beam3_coupled_modes import modes, buckling expected_modes = modes(direct, b.state, **arguments(direct), bounds=(-100., 10000.), num_modes=2) expected_buckling = buckling(direct, b.state, bounds=(0., 1000.), num_modes=2) actual_modes = made.modes(a.checkpoint, expected_sha256=a.checkpoint_sha256, bounds=(-100., 10000.), num_modes=2) @@ -112,7 +112,7 @@ def observed(row): def test_near_limit_inner_payload_roundtrips_without_tightening_historical_bound(monkeypatch): - from anysolver._ge_beam3_durable_coupled import MAX_BYTES, OUTER_MAX_BYTES, _outer + from anyfesolver._ge_beam3_durable_coupled import MAX_BYTES, OUTER_MAX_BYTES, _outer made, _ = durable() backend = canonical(dict(padding='"'*(MAX_BYTES//2-32))) assert MAX_BYTES-100 < len(backend) <= MAX_BYTES @@ -128,7 +128,7 @@ def forbidden(*args, **kwargs): raise AssertionError('serialization invoked mech @pytest.mark.parametrize('raw', (b'{"a":1,"a":2}\n', b'{"a":NaN}\n', b'{"a":1e999}\n', b' {"a":1}\n', b'['*33+b'0'+b']'*33+b'\n', b'"\xff"\n')) def test_strict_outer_decoder(raw): - from anysolver._ge_beam3_durable_coupled import _outer + from anyfesolver._ge_beam3_durable_coupled import _outer with pytest.raises(ValueError): _outer(raw) @@ -164,7 +164,7 @@ def test_mutating_caller_configuration_cannot_change_owned_definition(): original, _ = durable() shell = deepcopy(original._shell); controls = deepcopy(original._controls) definitions = tuple(NativeBeamDefinition(raw) for raw in original._definitions) - from anysolver.boundary import BoundaryCondition + from anyfesolver.boundary import BoundaryCondition boundaries = (BoundaryCondition('extra-support', [3], {'ux':0.}),) program = deepcopy(original._program) made = DurableCoupledBeamAnalysis(definitions, boundaries, program, diff --git a/tests/test_ge_beam3_elastic_seed_continuation.py b/tests/test_ge_beam3_elastic_seed_continuation.py index 14a5c1fda..ed35ed8f4 100644 --- a/tests/test_ge_beam3_elastic_seed_continuation.py +++ b/tests/test_ge_beam3_elastic_seed_continuation.py @@ -5,10 +5,10 @@ import json import numpy as np import pytest -from anysolver import _ge_beam3_elastic_seed_continuation as c -from anysolver import _ge_beam3_retained_translation_control as old -from anysolver._ge_beam3_p5_seeded.core import canonical,sha -from anysolver.control import CancellationToken +from anyfesolver import _ge_beam3_elastic_seed_continuation as c +from anyfesolver import _ge_beam3_retained_translation_control as old +from anyfesolver._ge_beam3_p5_seeded.core import canonical,sha +from anyfesolver.control import CancellationToken from test_ge_beam3_native_generalized_modal import make def model():return make(False,1,clamped=True,coupled=False)[0] diff --git a/tests/test_ge_beam3_equilibrium_line_program.py b/tests/test_ge_beam3_equilibrium_line_program.py index 94647ccd9..ff633d214 100644 --- a/tests/test_ge_beam3_equilibrium_line_program.py +++ b/tests/test_ge_beam3_equilibrium_line_program.py @@ -3,10 +3,10 @@ from pathlib import Path from hashlib import sha256 import pytest -from anysolver import _ge_beam3_equilibrium_line_program as native -from anysolver import _ge_beam3_fibre_line_program as dense -from anysolver._ge_beam3_seeded_load_program import ForceProgram -from anysolver.control import CancellationToken +from anyfesolver import _ge_beam3_equilibrium_line_program as native +from anyfesolver import _ge_beam3_fibre_line_program as dense +from anyfesolver._ge_beam3_seeded_load_program import ForceProgram +from anyfesolver.control import CancellationToken from test_ge_beam3_schur_line_program import inputs,save,numerical_difference ARCHIVE=Path('C:/Users/AudunArnesenNyhus/AppData/Local/ANYrelease/ge-beam3-schur-controller-2756a7b-20260907') diff --git a/tests/test_ge_beam3_equilibrium_multielement.py b/tests/test_ge_beam3_equilibrium_multielement.py index e785e9618..717373d88 100644 --- a/tests/test_ge_beam3_equilibrium_multielement.py +++ b/tests/test_ge_beam3_equilibrium_multielement.py @@ -3,14 +3,14 @@ from hashlib import sha256 import numpy as np import pytest -from anysolver.fe_core import FEModel -from anysolver.boundary import BoundaryCondition -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference -from anysolver._ge_beam3_retained_fibre_element import NativeRetainedFibreElement -from anysolver._ge_beam3_seeded_load_program import ForceProgram -from anysolver._ge_beam3_fibre_line_work import ReferenceLineForces -from anysolver import _ge_beam3_equilibrium_line_program as native -from anysolver import _ge_beam3_fibre_line_program as dense +from anyfesolver.fe_core import FEModel +from anyfesolver.boundary import BoundaryCondition +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference +from anyfesolver._ge_beam3_retained_fibre_element import NativeRetainedFibreElement +from anyfesolver._ge_beam3_seeded_load_program import ForceProgram +from anyfesolver._ge_beam3_fibre_line_work import ReferenceLineForces +from anyfesolver import _ge_beam3_equilibrium_line_program as native +from anyfesolver import _ge_beam3_fibre_line_program as dense from test_ge_beam3_spatial_nodal_moments import model as section_model from test_ge_beam3_schur_line_program import save,numerical_difference diff --git a/tests/test_ge_beam3_equilibrium_schur_solver.py b/tests/test_ge_beam3_equilibrium_schur_solver.py index 195592e87..c6b2e1491 100644 --- a/tests/test_ge_beam3_equilibrium_schur_solver.py +++ b/tests/test_ge_beam3_equilibrium_schur_solver.py @@ -4,14 +4,14 @@ from hashlib import sha256 import numpy as np import pytest -from anysolver._ge_beam3_equilibrium_schur_solver import EquilibriumSchurSolver -from anysolver._ge_beam3_fibre_schur_solver import ResultantSchurSolver as Previous -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver.boundary import BoundaryCondition -from anysolver._ge_beam3_seeded_load_program import ForceProgram -from anysolver._ge_beam3_fibre_line_work import ReferenceLineForces -from anysolver import _ge_beam3_fibre_line_program as physical -from anysolver import _ge_beam3_schur_line_program as controller +from anyfesolver._ge_beam3_equilibrium_schur_solver import EquilibriumSchurSolver +from anyfesolver._ge_beam3_fibre_schur_solver import ResultantSchurSolver as Previous +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.boundary import BoundaryCondition +from anyfesolver._ge_beam3_seeded_load_program import ForceProgram +from anyfesolver._ge_beam3_fibre_line_work import ReferenceLineForces +from anyfesolver import _ge_beam3_fibre_line_program as physical +from anyfesolver import _ge_beam3_schur_line_program as controller from docs.reference_cases.ge_beam3_exact_linear_witness import solve as exact_solve from docs.reference_cases.ge_beam3_curved_moment_fixture import model as curved_model from test_ge_beam3_schur_line_program import inputs,save diff --git a/tests/test_ge_beam3_factor_chain_modes_installed.py b/tests/test_ge_beam3_factor_chain_modes_installed.py index cfc56ab8f..2b6a90d76 100644 --- a/tests/test_ge_beam3_factor_chain_modes_installed.py +++ b/tests/test_ge_beam3_factor_chain_modes_installed.py @@ -103,7 +103,7 @@ def command(argv, cwd, name, limit=180): 'from setuptools.build_meta import build_wheel; import sys; build_wheel(sys.argv[1])', str(wheels)], build, 'build') candidates = list(wheels.glob('*.whl')); assert len(candidates) == 1; wheel = candidates[0] with zipfile.ZipFile(wheel) as archive: - assert all('anysolver/'+name in archive.namelist() for name in ( + assert all('anyfesolver/'+name in archive.namelist() for name in ( '_native_factor_chain_modes.py', '_ge_beam3_factor_chain_modes.py', '_dyadic_factor_chain.py', '_ge_beam3_shared_kinematic_split.py')) assert not any(name.startswith(('docs/', 'tests/')) for name in archive.namelist()) environment = tmp_path/'environment' diff --git a/tests/test_ge_beam3_factor_chain_native_modes.py b/tests/test_ge_beam3_factor_chain_native_modes.py index 910d3cdda..582862ccf 100644 --- a/tests/test_ge_beam3_factor_chain_native_modes.py +++ b/tests/test_ge_beam3_factor_chain_native_modes.py @@ -3,13 +3,13 @@ from copy import deepcopy import numpy as np import pytest -import anysolver._ge_beam3_factor_chain_modes as adapter -from anysolver._ge_beam3_seeded_loaded_modal import solve_elastic_modes -from anysolver._ge_beam3_seeded_load_program import ForceProgram, solve_force_program -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_p5_seeded import NativeP5BeamElement -from anysolver._ge_beam3_p5.algebra import rotation as proper_rotation -from anysolver.control import CancellationToken, SolveCancelled +import anyfesolver._ge_beam3_factor_chain_modes as adapter +from anyfesolver._ge_beam3_seeded_loaded_modal import solve_elastic_modes +from anyfesolver._ge_beam3_seeded_load_program import ForceProgram, solve_force_program +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_p5_seeded import NativeP5BeamElement +from anyfesolver._ge_beam3_p5.algebra import rotation as proper_rotation +from anyfesolver.control import CancellationToken, SolveCancelled from test_ge_beam3_curved_contrast_probe import make_curved, ROTATION from test_ge_beam3_seeded_load_program import problem from test_ge_beam3_curved_p5_mass_probe import section_mass @@ -89,8 +89,8 @@ def test_loaded_curved_coupled_modes_match_dense_moderate_reference_and_replay(l assert canonical(states)==before # Numerical representation only: prestress/load Hessians remain exactly # those of the preserved source split, not a positive-reference fallback. - from anysolver._ge_beam3_seeded_signed_modes import _split as original_split - from anysolver._ge_beam3_shared_kinematic_split import shared_kinematic_chain + from anyfesolver._ge_beam3_seeded_signed_modes import _split as original_split + from anyfesolver._ge_beam3_shared_kinematic_split import shared_kinematic_chain for eid,e in model.mesh.elements.items(): decoded=e.validate_model_bound_nonlinear_state(model.mesh,e.core.section,states[eid],1) old_factor,old_g=original_split(e,decoded['material_state'],lambda stage:None) diff --git a/tests/test_ge_beam3_fibre_arch_comparison.py b/tests/test_ge_beam3_fibre_arch_comparison.py index 74f833d88..1f40dcd9b 100644 --- a/tests/test_ge_beam3_fibre_arch_comparison.py +++ b/tests/test_ge_beam3_fibre_arch_comparison.py @@ -117,4 +117,4 @@ def test_no_production_or_discrete_mechanics_imports(): if isinstance(node, (ast.Import, ast.ImportFrom))] for node in imports: names = [node.module or ''] if isinstance(node, ast.ImportFrom) else [a.name for a in node.names] - assert not any(name.startswith('anysolver') for name in names) + assert not any(name.startswith('anyfesolver') for name in names) diff --git a/tests/test_ge_beam3_fibre_cell.py b/tests/test_ge_beam3_fibre_cell.py index 78e3a6c17..e9a6703d3 100644 --- a/tests/test_ge_beam3_fibre_cell.py +++ b/tests/test_ge_beam3_fibre_cell.py @@ -6,8 +6,8 @@ import numpy as np import pytest -from anysolver._ge_beam3_fibre_cell import FibreCellConjugate, CellHistory -from anysolver._ge_beam3_fibre_section import PhysicalFibreSection, FlowCurve, canonical +from anyfesolver._ge_beam3_fibre_cell import FibreCellConjugate, CellHistory +from anyfesolver._ge_beam3_fibre_section import PhysicalFibreSection, FlowCurve, canonical from test_ge_beam3_fibre_section import section, scalar_law from test_ge_beam3_curved_contrast_probe import make_curved @@ -173,7 +173,7 @@ def cancel(): with pytest.raises(RuntimeError, match='cancelled coupled fixture'): cell.response(np.linspace(-.3, .5, 18).tolist(), origin, check=cancel) assert origin == cell.virgin() - import anysolver._ge_beam3_fibre_cell as module + import anyfesolver._ge_beam3_fibre_cell as module ticks = 0 def clock(): nonlocal ticks diff --git a/tests/test_ge_beam3_fibre_cell_checkpoint.py b/tests/test_ge_beam3_fibre_cell_checkpoint.py index 519871632..755e398ab 100644 --- a/tests/test_ge_beam3_fibre_cell_checkpoint.py +++ b/tests/test_ge_beam3_fibre_cell_checkpoint.py @@ -54,7 +54,7 @@ def test_final_tested_source_hashes(index): def test_runtime_imports_do_not_include_research_or_legacy_mechanics(): - tree = ast.parse((ROOT/'src/anysolver/_ge_beam3_fibre_cell.py').read_text()) + tree = ast.parse((ROOT/'src/anyfesolver/_ge_beam3_fibre_cell.py').read_text()) imports = set() for node in ast.walk(tree): if isinstance(node, ast.Import): imports.update(alias.name for alias in node.names) diff --git a/tests/test_ge_beam3_fibre_dense_admission.py b/tests/test_ge_beam3_fibre_dense_admission.py index dca3dd5e4..291189077 100644 --- a/tests/test_ge_beam3_fibre_dense_admission.py +++ b/tests/test_ge_beam3_fibre_dense_admission.py @@ -3,8 +3,8 @@ import numpy as np import pytest -from anysolver import _ge_beam3_retained_fibre_state as state -from anysolver._ge_beam3_seeded_load_program import ForceProgram +from anyfesolver import _ge_beam3_retained_fibre_state as state +from anyfesolver._ge_beam3_seeded_load_program import ForceProgram from docs.reference_cases import ge_beam3_fibre_arch_refinement as family @@ -58,8 +58,8 @@ def test_default_capture_is_unchanged_and_explicit_budget_is_bound(): @pytest.mark.parametrize('entry', ['force', 'translation', 'seeded', 'solve']) def test_explicit_budget_reaches_layout_before_any_mechanics(monkeypatch, entry): - from anysolver import _ge_beam3_retained_fibre_control as translation - from anysolver import _ge_beam3_seeded_fibre_control as seeded + from anyfesolver import _ge_beam3_retained_fibre_control as translation + from anyfesolver import _ge_beam3_seeded_fibre_control as seeded class CapturedBeforeAssembly(Exception): pass def capture(model, program, *, max_coordinates): assert max_coordinates == 512 diff --git a/tests/test_ge_beam3_fibre_distributed_couples.py b/tests/test_ge_beam3_fibre_distributed_couples.py index 73d167efd..a0c888b27 100644 --- a/tests/test_ge_beam3_fibre_distributed_couples.py +++ b/tests/test_ge_beam3_fibre_distributed_couples.py @@ -5,10 +5,10 @@ from pathlib import Path import numpy as np import pytest -from anysolver._ge_beam3_fibre_distributed_couples import cell_couple_load, spatial_jacobian, chart_pullback, solve_distributed_static -from anysolver._ge_beam3_fibre_line_work import evaluate as line_work -from anysolver._ge_beam3_p5.algebra import rotation, skew -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_fibre_distributed_couples import cell_couple_load, spatial_jacobian, chart_pullback, solve_distributed_static +from anyfesolver._ge_beam3_fibre_line_work import evaluate as line_work +from anyfesolver._ge_beam3_p5.algebra import rotation, skew +from anyfesolver._ge_beam3_p5_seeded.core import canonical from docs.reference_cases import ge_beam3_distributed_couple_oracle as oracle from test_ge_beam3_fibre_static_boundary import inputs, solve as conservative_solve from test_ge_beam3_schur_line_program import save @@ -154,7 +154,7 @@ def test_bad_density_rejected(bad): def test_deadline_and_source_separation(monkeypatch): - import anysolver._ge_beam3_fibre_distributed_couples as module + import anyfesolver._ge_beam3_fibre_distributed_couples as module op,x,low,q=inputs(False,False);times=[] def clock():times.append(True);return 61.*len(times) monkeypatch.setattr(module,'monotonic',clock) diff --git a/tests/test_ge_beam3_fibre_force_modal_connected.py b/tests/test_ge_beam3_fibre_force_modal_connected.py index 962f7acb6..714578be5 100644 --- a/tests/test_ge_beam3_fibre_force_modal_connected.py +++ b/tests/test_ge_beam3_fibre_force_modal_connected.py @@ -1,10 +1,10 @@ """Connected curved native force owners retain the complete physical pencil.""" import numpy as np from scipy.linalg import eigh -from anysolver._ge_beam3_native_analysis import NativeBeamAnalysis -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_native_fibre_static_element import NativeFibreStaticElement -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_native_analysis import NativeBeamAnalysis +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_native_fibre_static_element import NativeFibreStaticElement +from anyfesolver._ge_beam3_p5_seeded.core import canonical from test_ge_beam3_retained_fibre import make_model from test_ge_beam3_native_fibre_current_modal import decode diff --git a/tests/test_ge_beam3_fibre_kinematic_cell.py b/tests/test_ge_beam3_fibre_kinematic_cell.py index 230d514b0..a4070a536 100644 --- a/tests/test_ge_beam3_fibre_kinematic_cell.py +++ b/tests/test_ge_beam3_fibre_kinematic_cell.py @@ -3,9 +3,9 @@ from dataclasses import replace import numpy as np import pytest -from anysolver._ge_beam3_fibre_kinematic_cell import response -from anysolver._ge_beam3_fibre_section import canonical -from anysolver._ge_beam3_station_resultant_cell import mul, mv, tr +from anyfesolver._ge_beam3_fibre_kinematic_cell import response +from anyfesolver._ge_beam3_fibre_section import canonical +from anyfesolver._ge_beam3_station_resultant_cell import mul, mv, tr from test_ge_beam3_fibre_cell import model, unpack, dot diff --git a/tests/test_ge_beam3_fibre_line_program.py b/tests/test_ge_beam3_fibre_line_program.py index a1ca35e81..365ea2685 100644 --- a/tests/test_ge_beam3_fibre_line_program.py +++ b/tests/test_ge_beam3_fibre_line_program.py @@ -4,16 +4,16 @@ import numpy as np import pytest -from anysolver.fe_core import FEModel -from anysolver.boundary import BoundaryCondition -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference -from anysolver._ge_beam3_retained_fibre_element import NativeRetainedFibreElement -from anysolver._ge_beam3_seeded_load_program import ForceProgram -from anysolver._ge_beam3_fibre_line_work import ReferenceLineForces, evaluate -from anysolver import _ge_beam3_fibre_line_program as native -from anysolver._ge_beam3_retained_fibre_state import Context as OriginalContext -from anysolver._ge_beam3_p5.algebra import rotation -from anysolver._ge_beam3_p5_seeded.core import canonical, sha +from anyfesolver.fe_core import FEModel +from anyfesolver.boundary import BoundaryCondition +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference +from anyfesolver._ge_beam3_retained_fibre_element import NativeRetainedFibreElement +from anyfesolver._ge_beam3_seeded_load_program import ForceProgram +from anyfesolver._ge_beam3_fibre_line_work import ReferenceLineForces, evaluate +from anyfesolver import _ge_beam3_fibre_line_program as native +from anyfesolver._ge_beam3_retained_fibre_state import Context as OriginalContext +from anyfesolver._ge_beam3_p5.algebra import rotation +from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha from docs.reference_cases import ge_beam3_centered_line_load_oracle as oracle from test_ge_beam3_spatial_nodal_moments import model as straight_model @@ -56,7 +56,7 @@ def test_load_work_matches_separate_rational_geometry_and_closed_derivatives(cur cells = np.array([rotation([.4,-.2,.3]), rotation([-.1,.35,.2])]) f = np.array([.03,-.02,.01])*scale # Exactly represent the supplied nodal displacement, including low parts. - from anysolver._ge_beam3_p5_coordinates.positions import from_total + from anyfesolver._ge_beam3_p5_coordinates.positions import from_total total = np.zeros((3,6)); total[:,:3] = displacement high, low = from_total(ref.coordinates, total.ravel(), ref.coordinates+displacement) a = evaluate(ref, high, low, cells, f, order=4) @@ -128,7 +128,7 @@ def test_physical_plasticity_restart_unload_and_replay(accepted,tmp_path): def test_cancellation_before_commit_preserves_accepted_history(accepted): - from anysolver.control import CancellationToken + from anyfesolver.control import CancellationToken p,f,_ = accepted paused = native.solve_force_program(model(plastic=True),p,line_forces=f,stop_after=1) token = CancellationToken() @@ -184,7 +184,7 @@ def test_failed_step_has_no_trial_history_publication(): def test_exact_large_translation_and_connectivity_reversal_preserve_line_work(): - from anysolver._ge_beam3_p5_coordinates.positions import from_total + from anyfesolver._ge_beam3_p5_coordinates.positions import from_total displacement=np.array([[.03125,.0625,-.125],[.0625,.03125,.0625],[-.125,.0625,.03125]]) total=np.zeros((3,6)); total[:,:3]=displacement cells=np.array([rotation([.4,-.2,.3]),rotation([-.1,.35,.2])]) diff --git a/tests/test_ge_beam3_fibre_modes_checkpoint.py b/tests/test_ge_beam3_fibre_modes_checkpoint.py index dbc203ac8..a9d6d9717 100644 --- a/tests/test_ge_beam3_fibre_modes_checkpoint.py +++ b/tests/test_ge_beam3_fibre_modes_checkpoint.py @@ -47,7 +47,7 @@ def test_final_tested_source_hashes(index): def test_native_fibre_spectra_does_not_import_old_material_or_research_operators(): - tree = ast.parse((ROOT/'src/anysolver/_ge_beam3_retained_fibre_modes.py').read_text()) + tree = ast.parse((ROOT/'src/anyfesolver/_ge_beam3_retained_fibre_modes.py').read_text()) names = [node.module for node in ast.walk(tree) if isinstance(node, ast.ImportFrom)] assert not any(name.startswith(('docs.', 'tests.')) for name in names) assert not any('retained_plastic' in name or 'retained_elastic' in name for name in names) diff --git a/tests/test_ge_beam3_fibre_schur_solver.py b/tests/test_ge_beam3_fibre_schur_solver.py index 5c6dfa608..0a88025aa 100644 --- a/tests/test_ge_beam3_fibre_schur_solver.py +++ b/tests/test_ge_beam3_fibre_schur_solver.py @@ -3,10 +3,10 @@ from pathlib import Path import numpy as np import pytest -from anysolver._ge_beam3_fibre_schur_solver import ResultantSchurSolver -from anysolver import _ge_beam3_fibre_line_program as control -from anysolver._ge_beam3_seeded_load_program import ForceProgram -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_fibre_schur_solver import ResultantSchurSolver +from anyfesolver import _ge_beam3_fibre_line_program as control +from anyfesolver._ge_beam3_seeded_load_program import ForceProgram +from anyfesolver._ge_beam3_p5_seeded.core import canonical from test_ge_beam3_fibre_line_program import model,line from test_ge_beam3_line_fibre_modes import case,ROOT,read diff --git a/tests/test_ge_beam3_fibre_section.py b/tests/test_ge_beam3_fibre_section.py index e0897056d..f30deb3ba 100644 --- a/tests/test_ge_beam3_fibre_section.py +++ b/tests/test_ge_beam3_fibre_section.py @@ -6,7 +6,7 @@ import numpy as np import pytest -from anysolver._ge_beam3_fibre_section import ( +from anyfesolver._ge_beam3_fibre_section import ( Fibre, FibreHistory, FlowCurve, PhysicalFibreSection, PARAMETER_CAPTURE, canonical, ) diff --git a/tests/test_ge_beam3_fibre_section_checkpoint.py b/tests/test_ge_beam3_fibre_section_checkpoint.py index ef48ca4c6..b180b724d 100644 --- a/tests/test_ge_beam3_fibre_section_checkpoint.py +++ b/tests/test_ge_beam3_fibre_section_checkpoint.py @@ -52,7 +52,7 @@ def test_final_tested_source_hashes(index): def test_new_component_has_no_legacy_or_research_mechanics_imports(): - tree = ast.parse((ROOT/'src/anysolver/_ge_beam3_fibre_section.py').read_text()) + tree = ast.parse((ROOT/'src/anyfesolver/_ge_beam3_fibre_section.py').read_text()) imports = set() for node in ast.walk(tree): if isinstance(node, ast.Import): imports.update(alias.name for alias in node.names) diff --git a/tests/test_ge_beam3_fibre_static_boundary.py b/tests/test_ge_beam3_fibre_static_boundary.py index 3c14b218e..fdf890b69 100644 --- a/tests/test_ge_beam3_fibre_static_boundary.py +++ b/tests/test_ge_beam3_fibre_static_boundary.py @@ -3,9 +3,9 @@ from decimal import localcontext import numpy as np import pytest -from anysolver._ge_beam3_fibre_static_boundary import solve_static -from anysolver._ge_beam3_p5.algebra import rotation -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_fibre_static_boundary import solve_static +from anyfesolver._ge_beam3_p5.algebra import rotation +from anyfesolver._ge_beam3_p5_seeded.core import canonical from test_ge_beam3_fibre_line_program import model from test_ge_beam3_schur_line_program import save diff --git a/tests/test_ge_beam3_first_force_step_audit.py b/tests/test_ge_beam3_first_force_step_audit.py index 573bce895..3211fd764 100644 --- a/tests/test_ge_beam3_first_force_step_audit.py +++ b/tests/test_ge_beam3_first_force_step_audit.py @@ -8,10 +8,10 @@ import numpy as np import pytest from scipy.linalg import block_diag -import anysolver._ge_beam3_seeded_load_program as driver -from anysolver._ge_beam3_seeded_loaded_modal import prepare -from anysolver._ge_beam3_shared_kinematic_split import shared_kinematic_chain -from anysolver._ge_beam3_p5_seeded.core import canonical +import anyfesolver._ge_beam3_seeded_load_program as driver +from anyfesolver._ge_beam3_seeded_loaded_modal import prepare +from anyfesolver._ge_beam3_shared_kinematic_split import shared_kinematic_chain +from anyfesolver._ge_beam3_p5_seeded.core import canonical from docs.reference_cases.ge_beam3_decimal_static_chain_audit import solve_static_chain from test_ge_beam3_curved_contrast_probe import make_curved diff --git a/tests/test_ge_beam3_force_program_checkpoint.py b/tests/test_ge_beam3_force_program_checkpoint.py index cff107697..d013cc4c9 100644 --- a/tests/test_ge_beam3_force_program_checkpoint.py +++ b/tests/test_ge_beam3_force_program_checkpoint.py @@ -46,9 +46,9 @@ def test_force_program_checkpoint_is_bound_and_nonqualifying(): @pytest.mark.parametrize('path',[ - 'src/anysolver/_ge_beam3_load_program.py', + 'src/anyfesolver/_ge_beam3_load_program.py', 'tests/test_ge_beam3_load_program.py', - 'src/anysolver/linalg.py', + 'src/anyfesolver/linalg.py', ]) def test_changed_bound_source_is_rejected(monkeypatch,path): original = source @@ -58,11 +58,11 @@ def test_changed_bound_source_is_rejected(monkeypatch,path): def test_private_driver_uses_no_research_or_legacy_mechanics_imports(): - tree = ast.parse(source('src/anysolver/_ge_beam3_load_program.py')) + tree = ast.parse(source('src/anyfesolver/_ge_beam3_load_program.py')) modules = [] for node in ast.walk(tree): if isinstance(node,ast.Import): modules.extend(alias.name for alias in node.names) elif isinstance(node,ast.ImportFrom): modules.append(node.module or '') assert not any(name.split('.')[0] in ('docs','tests') for name in modules) assert not any('quadratic_beam' in name or 'corotational' in name for name in modules) - assert b'_ge_beam3_load_program' not in source('src/anysolver/__init__.py') + assert b'_ge_beam3_load_program' not in source('src/anyfesolver/__init__.py') diff --git a/tests/test_ge_beam3_force_program_installed.py b/tests/test_ge_beam3_force_program_installed.py index bb4637f25..789568243 100644 --- a/tests/test_ge_beam3_force_program_installed.py +++ b/tests/test_ge_beam3_force_program_installed.py @@ -57,7 +57,7 @@ def command(argv,cwd,name,limit=120): candidates = list(wheels.glob('*.whl')); assert len(candidates) == 1 wheel = candidates[0] with zipfile.ZipFile(wheel) as archive: - assert 'anysolver/_ge_beam3_load_program.py' in archive.namelist() + assert 'anyfesolver/_ge_beam3_load_program.py' in archive.namelist() assert not any(name.startswith(('docs/','tests/')) for name in archive.namelist()) environment = tmp_path/'environment' command([sys.executable,'-I','-B','-m','venv',str(environment)],tmp_path,'venv') diff --git a/tests/test_ge_beam3_full_resultant_force_probe.py b/tests/test_ge_beam3_full_resultant_force_probe.py index 064e4a916..2a83e8f46 100644 --- a/tests/test_ge_beam3_full_resultant_force_probe.py +++ b/tests/test_ge_beam3_full_resultant_force_probe.py @@ -1,10 +1,10 @@ """Small actual force solves of the elastic retained-resultant experiment.""" import numpy as np import pytest -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_p5_seeded.core import canonical from docs.reference_cases.ge_beam3_full_resultant_force_probe import solve_two_macro_probe from test_ge_beam3_curved_contrast_probe import make_curved -from anysolver._ge_beam3_p5.algebra import rotation +from anyfesolver._ge_beam3_p5.algebra import rotation @pytest.mark.parametrize('slenderness', [100., 10000., 1000000.]) diff --git a/tests/test_ge_beam3_full_resultant_legendre_probe.py b/tests/test_ge_beam3_full_resultant_legendre_probe.py index 6f9ddd5a1..b5454eb02 100644 --- a/tests/test_ge_beam3_full_resultant_legendre_probe.py +++ b/tests/test_ge_beam3_full_resultant_legendre_probe.py @@ -1,9 +1,9 @@ """Local numerical equivalence and analytic-variation checks, not qualification.""" import numpy as np import pytest -from anysolver._ge_beam3_centered_mixed import CenteredStationaryBeam -from anysolver._ge_beam3_p5.algebra import rotation -from anysolver._ge_beam3_p5_seeded import NativeP5BeamElement, DirectedHardeningSection +from anyfesolver._ge_beam3_centered_mixed import CenteredStationaryBeam +from anyfesolver._ge_beam3_p5.algebra import rotation +from anyfesolver._ge_beam3_p5_seeded import NativeP5BeamElement, DirectedHardeningSection from docs.reference_cases.ge_beam3_full_resultant_legendre_probe import ElasticResultantProbe from test_ge_beam3_curved_contrast_probe import make_curved diff --git a/tests/test_ge_beam3_g1_elastic.py b/tests/test_ge_beam3_g1_elastic.py index 4874e9291..99cf91cfc 100644 --- a/tests/test_ge_beam3_g1_elastic.py +++ b/tests/test_ge_beam3_g1_elastic.py @@ -1,10 +1,10 @@ """G1a material/complementary checks; independent station KKT reconstruction.""" import numpy as np import pytest -from anysolver._ge_beam3_g1_elastic import ElasticSection -from anysolver._ge_beam3_g1_operator import ElasticOperator, schur, local_solve -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference -from anysolver._ge_beam3_p5.algebra import rotation +from anyfesolver._ge_beam3_g1_elastic import ElasticSection +from anyfesolver._ge_beam3_g1_operator import ElasticOperator, schur, local_solve +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference +from anyfesolver._ge_beam3_p5.algebra import rotation def section(dense=False): @@ -132,6 +132,6 @@ def test_isotropic_adapter_boolean_and_overflow_rejection(): def test_unhealthy_factorization_is_not_warning_only(): - from anysolver._ge_beam3_g1_elastic import solve + from anyfesolver._ge_beam3_g1_elastic import solve with pytest.raises(np.linalg.LinAlgError): solve(np.diag([1., 1e-30]), np.ones(2)) diff --git a/tests/test_ge_beam3_g1_elastic_admission.py b/tests/test_ge_beam3_g1_elastic_admission.py index 042804e61..e63a5d94b 100644 --- a/tests/test_ge_beam3_g1_elastic_admission.py +++ b/tests/test_ge_beam3_g1_elastic_admission.py @@ -12,7 +12,7 @@ def source(name): - return (ROOT / "src/anysolver" / name).read_text(encoding="utf-8") + return (ROOT / "src/anyfesolver" / name).read_text(encoding="utf-8") def has_exact_type_guard(name, argument, required_type): diff --git a/tests/test_ge_beam3_g1_integration.py b/tests/test_ge_beam3_g1_integration.py index 9b02be682..c8437c1fb 100644 --- a/tests/test_ge_beam3_g1_integration.py +++ b/tests/test_ge_beam3_g1_integration.py @@ -6,10 +6,10 @@ from unittest.mock import patch import numpy as np import pytest -from anysolver._ge_beam3_g1_elastic import canonical -from anysolver._ge_beam3_g1_element import ElasticElement -from anysolver._ge_beam3_g1_analysis import ElasticAnalysis -from anysolver.nonlinear_state import StaleStateTokenError +from anyfesolver._ge_beam3_g1_elastic import canonical +from anyfesolver._ge_beam3_g1_element import ElasticElement +from anyfesolver._ge_beam3_g1_analysis import ElasticAnalysis +from anyfesolver.nonlinear_state import StaleStateTokenError from test_ge_beam3_g1_elastic import reference, section @@ -116,7 +116,7 @@ def test_S08_restart_and_atomic_publication(tmp_path): with pytest.raises(ValueError): resumed.publish(target) assert target.read_bytes() == old failed = tmp_path / "failed.json" - with patch("anysolver._ge_beam3_g1_analysis.os.link", side_effect=OSError("injected publication fault")): + with patch("anyfesolver._ge_beam3_g1_analysis.os.link", side_effect=OSError("injected publication fault")): with pytest.raises(OSError): resumed.publish(failed) assert not failed.exists() and target.read_bytes() == old @@ -246,7 +246,7 @@ def callback(): elif mutation == "node": owner.model.add_node(6, 3., 0., 0.) elif mutation == "manager_support": owner.model.mesh.dof_manager.constrain_dof(owner.size-1) elif mutation == "model_load": - from anysolver.boundary import LoadCase + from anyfesolver.boundary import LoadCase owner.model.add_load_case(LoadCase("unsupported model load")) else: owner.model.materials[owner.elements[0].material_name] = section(True) return False diff --git a/tests/test_ge_beam3_g2_confirmation.py b/tests/test_ge_beam3_g2_confirmation.py index 011c32861..9b7bef914 100644 --- a/tests/test_ge_beam3_g2_confirmation.py +++ b/tests/test_ge_beam3_g2_confirmation.py @@ -145,7 +145,7 @@ def test_compact_scientific_duplicate_nonfinite_rejection(raw): def test_compact_native_serializer_compatibility(): - from anysolver._ge_beam3_g1_elastic import canonical + from anyfesolver._ge_beam3_g1_elastic import canonical body = dict(schema="example", value=[1., -0.0], qualification=False) raw = canonical(body) assert c.strict(raw, compact=True) == body diff --git a/tests/test_ge_beam3_g2_constraints.py b/tests/test_ge_beam3_g2_constraints.py index 0e741e3e9..d9e48844c 100644 --- a/tests/test_ge_beam3_g2_constraints.py +++ b/tests/test_ge_beam3_g2_constraints.py @@ -8,12 +8,12 @@ import pytest from scipy.linalg import null_space from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_g2_constraints import ConstraintSet, compile_affine -from anysolver._ge_beam3_g2_analysis import ConstrainedAnalysis -from anysolver._ge_beam3_g1_element import ElasticElement -from anysolver._ge_beam3_g1_elastic import canonical -from anysolver._ge_beam3_mixed_ad import RotationDomainError -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference +from anyfesolver._ge_beam3_g2_constraints import ConstraintSet, compile_affine +from anyfesolver._ge_beam3_g2_analysis import ConstrainedAnalysis +from anyfesolver._ge_beam3_g1_element import ElasticElement +from anyfesolver._ge_beam3_g1_elastic import canonical +from anyfesolver._ge_beam3_mixed_ad import RotationDomainError +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference from test_ge_beam3_g1_elastic import reference, section FIXTURE = json.loads((Path(__file__).resolve().parents[1]/"docs/reference_cases/ge_beam3_g2_fixtures_v1.json").read_text()) @@ -155,7 +155,7 @@ def test_S11_noncommuting_targets_and_restart(tmp_path): path = tmp_path/"restart.json"; owner.publish(path); before = path.read_bytes() with pytest.raises(ValueError): owner.publish(path) assert path.read_bytes() == before - with patch("anysolver._ge_beam3_g1_analysis.os.link", side_effect=OSError("publication failure")): + with patch("anyfesolver._ge_beam3_g1_analysis.os.link", side_effect=OSError("publication failure")): with pytest.raises(OSError): owner.publish(tmp_path/"failed.json") assert not (tmp_path/"failed.json").exists() diff --git a/tests/test_ge_beam3_g2_corrections.py b/tests/test_ge_beam3_g2_corrections.py index 9ab5f0a1f..ebe4fa288 100644 --- a/tests/test_ge_beam3_g2_corrections.py +++ b/tests/test_ge_beam3_g2_corrections.py @@ -7,12 +7,12 @@ import pytest from scipy.linalg import block_diag, null_space from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_g1_analysis import ElasticAnalysis -from anysolver._ge_beam3_g2_analysis import ConstrainedAnalysis -from anysolver._ge_beam3_g2_constraints import ConstraintSet -from anysolver._ge_beam3_g1_element import ElasticElement -from anysolver._ge_beam3_g1_elastic import canonical -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference +from anyfesolver._ge_beam3_g1_analysis import ElasticAnalysis +from anyfesolver._ge_beam3_g2_analysis import ConstrainedAnalysis +from anyfesolver._ge_beam3_g2_constraints import ConstraintSet +from anyfesolver._ge_beam3_g1_element import ElasticElement +from anyfesolver._ge_beam3_g1_elastic import canonical +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference from test_ge_beam3_g2_constraints import make, snapshot, invariant, FIXTURE from test_ge_beam3_g1_elastic import reference, section diff --git a/tests/test_ge_beam3_g3_contract.py b/tests/test_ge_beam3_g3_contract.py index edbdbd4f5..15d737660 100644 --- a/tests/test_ge_beam3_g3_contract.py +++ b/tests/test_ge_beam3_g3_contract.py @@ -54,7 +54,7 @@ def test_no_implicit_rotational_admission(self): if kind=="allowlist": f["admission"]["accepted_cross_family_rotational_adapters"]=["owned-joint"] elif kind=="fallback": f["admission"]["implicit_fallback"]=True elif kind=="positive": f["admission"]["s17_positive_status"]="QUALIFIED" - else: f["families"]["S3"]["class"]="anysolver.e4_pl_s3_element.QualifiedE4PLS3ShellElement" + else: f["families"]["S3"]["class"]="anyfesolver.e4_pl_s3_element.QualifiedE4PLS3ShellElement" with self.subTest(kind=kind),self.assertRaises(ValueError): a.validate_fixtures(f) def test_limits_and_tolerance_mutations(self): @@ -94,7 +94,7 @@ def test_missing_base_is_not_silently_accepted(self): with self.assertRaises(subprocess.CalledProcessError): a.expected() def test_source_extent_rejects_production_edit(self): - with patch.object(a,"git",side_effect=[b'',b'src/anysolver/elements.py\n',b'']): + with patch.object(a,"git",side_effect=[b'',b'src/anyfesolver/elements.py\n',b'']): with self.assertRaises(ValueError): a.check_extent() def test_actual_planning_only_extent(self): diff --git a/tests/test_ge_beam3_g3a_boundary.py b/tests/test_ge_beam3_g3a_boundary.py index ad1d63c6b..2936f1dc5 100644 --- a/tests/test_ge_beam3_g3a_boundary.py +++ b/tests/test_ge_beam3_g3a_boundary.py @@ -10,8 +10,8 @@ BASE = "e78c1b667694b43141912c1d85f894de2b41a848" TREE = "ec23282230399da6a5c882f025f1bf53b16bc52b" EXTENT = { - "src/anysolver/_ge_beam3_g3_analysis.py", - "src/anysolver/_ge_beam3_g3_constraints.py", + "src/anyfesolver/_ge_beam3_g3_analysis.py", + "src/anyfesolver/_ge_beam3_g3_constraints.py", "scripts/run_ge_beam3_g3a.py", "tests/test_ge_beam3_g3a_graph.py", "tests/test_ge_beam3_g3a_boundary.py", @@ -51,7 +51,7 @@ def test_parent_authorities_remain_byte_bound(self): self.assertEqual(sha256(raw).hexdigest(), row["sha256"]) def test_no_public_or_mechanics_implementation_imports(self): - raw = source("src/anysolver/_ge_beam3_g3_analysis.py") + raw = source("src/anyfesolver/_ge_beam3_g3_analysis.py") tree = ast.parse(raw) owner = next(n for n in tree.body if isinstance(n, ast.ClassDef) and n.name == "NativeGraphAnalysis") self.assertEqual(owner.bases, []) @@ -73,12 +73,12 @@ def test_runner_limits_and_external_exclusive_logs(self): self.assertIn(token, raw) def test_separate_graph_constraint_bounds(self): - old = source("src/anysolver/_ge_beam3_g2_constraints.py").decode() - new = source("src/anysolver/_ge_beam3_g3_constraints.py").decode() + old = source("src/anyfesolver/_ge_beam3_g2_constraints.py").decode() + new = source("src/anyfesolver/_ge_beam3_g3_constraints.py").decode() self.assertIn("size <= 36", old); self.assertIn("len(node_ids) <= 6", old) self.assertIn("size <= 192", new); self.assertIn("len(node_ids) <= 32", new) self.assertIn("GE_BEAM3_G3_NATIVE_CONSTRAINTS_V1", new) - self.assertIn("GE_BEAM3_G3_GRAPH_ELASTIC_RESTART_V1", source("src/anysolver/_ge_beam3_g3_analysis.py").decode()) + self.assertIn("GE_BEAM3_G3_GRAPH_ELASTIC_RESTART_V1", source("src/anyfesolver/_ge_beam3_g3_analysis.py").decode()) if __name__ == "__main__": unittest.main() diff --git a/tests/test_ge_beam3_g3a_confirmation.py b/tests/test_ge_beam3_g3a_confirmation.py index e00ebbc38..3e4f89aa4 100644 --- a/tests/test_ge_beam3_g3a_confirmation.py +++ b/tests/test_ge_beam3_g3a_confirmation.py @@ -145,7 +145,7 @@ def test_compact_scientific_duplicate_nonfinite_rejection(raw): def test_compact_native_serializer_compatibility(): - from anysolver._ge_beam3_g1_elastic import canonical + from anyfesolver._ge_beam3_g1_elastic import canonical body = dict(schema="example", value=[1., -0.0], qualification=False) raw = canonical(body) assert c.strict(raw, compact=True) == body @@ -156,7 +156,7 @@ def test_compact_native_serializer_compatibility(): def test_correction_extent_and_frozen_parent_authorities(): base = "edad651af3460aa33283686e4f9345190a3b0094" c.git("merge-base", "--is-ancestor", base, "HEAD") - modified = {"src/anysolver/_ge_beam3_g3_analysis.py", "tests/test_ge_beam3_g3a_graph.py"} + modified = {"src/anyfesolver/_ge_beam3_g3_analysis.py", "tests/test_ge_beam3_g3a_graph.py"} added = {"scripts/confirm_ge_beam3_g3a.py", "tests/test_ge_beam3_g3a_confirmation.py", "docs/GE_BEAM3_G3A_CORRECTION_CONFIRMATION.md", "docs/reference_cases/ge_beam3_g3a_confirmation_inventory.json", diff --git a/tests/test_ge_beam3_g3a_graph.py b/tests/test_ge_beam3_g3a_graph.py index 828fa0941..a1f3d6c68 100644 --- a/tests/test_ge_beam3_g3a_graph.py +++ b/tests/test_ge_beam3_g3a_graph.py @@ -6,13 +6,13 @@ import numpy as np import pytest from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_g1_analysis import ElasticAnalysis -from anysolver._ge_beam3_g2_analysis import ConstrainedAnalysis -from anysolver._ge_beam3_g1_element import ElasticElement -from anysolver._ge_beam3_g1_elastic import ElasticSection, canonical -from anysolver._ge_beam3_g3_analysis import NativeGraphAnalysis, rigid_basis -from anysolver._ge_beam3_g3_constraints import GraphConstraintSet, compile_affine -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference +from anyfesolver._ge_beam3_g1_analysis import ElasticAnalysis +from anyfesolver._ge_beam3_g2_analysis import ConstrainedAnalysis +from anyfesolver._ge_beam3_g1_element import ElasticElement +from anyfesolver._ge_beam3_g1_elastic import ElasticSection, canonical +from anyfesolver._ge_beam3_g3_analysis import NativeGraphAnalysis, rigid_basis +from anyfesolver._ge_beam3_g3_constraints import GraphConstraintSet, compile_affine +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference ROOT = Path(__file__).resolve().parents[1] FIXTURE = json.loads((ROOT/"docs/reference_cases/ge_beam3_g3_graph_fixtures_v1.json").read_text()) @@ -253,7 +253,7 @@ def test_noncommuting_shared_pose_and_support_work(name): @pytest.mark.parametrize("name", list(GRAPHS)) def test_full_stationary_schur_nonzero_internal_residual_and_load_work(name): - from anysolver._ge_beam3_g1_operator import schur + from anyfesolver._ge_beam3_g1_operator import schur owner = make(name); n = owner.size; size = n+24*len(owner.elements) H = np.zeros((size, size)); r = np.zeros(size) condensed = np.zeros((n, n)); residual = np.zeros(n) @@ -495,7 +495,7 @@ def test_publication_guard_and_fallible_diagnostics_are_atomic(kind): elif kind == "diagnostic": def fail(stage): if stage == "acceptance prepare": raise OSError("broken progress destination") - with patch("anysolver._ge_beam3_g3_analysis.progress", side_effect=fail): + with patch("anyfesolver._ge_beam3_g3_analysis.progress", side_effect=fail): with pytest.raises(OSError): owner.solve(.5*loads(owner)) else: cancel_at_final_acceptance(owner, loads(owner)) @@ -512,7 +512,7 @@ def test_exclusive_graph_publication_and_deterministic_development_packet(tmp_pa assert out.read_bytes() == data with pytest.raises(ValueError): a.publish(out) failed = tmp_path/"failed.json" - with patch("anysolver._ge_beam3_g1_analysis.os.link", side_effect=OSError("publication fault")): + with patch("anyfesolver._ge_beam3_g1_analysis.os.link", side_effect=OSError("publication fault")): with pytest.raises(OSError): a.publish(failed) assert not failed.exists() and out.read_bytes() == data assert not list(tmp_path.glob("*.pending")) @@ -593,7 +593,7 @@ def cancel(): @pytest.mark.parametrize("kind", ["stale", "foreign"]) @pytest.mark.parametrize("operation", ["commit", "discard", "set_state"]) def test_braced_graph_issued_token_isolation(kind, operation): - from anysolver.nonlinear_state import StateTransactionError + from anyfesolver.nonlinear_state import StateTransactionError owner = make("N_BRACED5"); f = loads(owner, "N_BRACED5"); owner.solve(f) other = make("N_BRACED5") before, foreign_before = snapshot(owner), snapshot(other); checkpoint = owner.checkpoint() diff --git a/tests/test_ge_beam3_g3b_confirmation_authority.py b/tests/test_ge_beam3_g3b_confirmation_authority.py index 1acbe2e4a..3056f0278 100644 --- a/tests/test_ge_beam3_g3b_confirmation_authority.py +++ b/tests/test_ge_beam3_g3b_confirmation_authority.py @@ -136,7 +136,7 @@ def test_real_collection_matches_frozen_lane(lane): def test_confirmation_has_only_owner_entry_runtime_delta(): base="f67aed07ed877aec679837e0a44e2db5cb398f74" git=["git","-c","safe.directory="+ROOT.as_posix()] - path="src/anysolver/_ge_beam3_g3b_owner.py" + path="src/anyfesolver/_ge_beam3_g3b_owner.py" changed=subprocess.check_output(git+["diff","--name-only",base,"--","src/"],cwd=ROOT,timeout=20).decode().splitlines() assert changed==[path] old=ast.parse(subprocess.check_output(git+["show",base+":"+path],cwd=ROOT,timeout=20)) diff --git a/tests/test_ge_beam3_g3b_mb2.py b/tests/test_ge_beam3_g3b_mb2.py index 9972b1430..1390b1226 100644 --- a/tests/test_ge_beam3_g3b_mb2.py +++ b/tests/test_ge_beam3_g3b_mb2.py @@ -6,13 +6,13 @@ from unittest.mock import patch import numpy as np import pytest -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel, Material -from anysolver._ge_beam3_g1_element import ElasticElement -from anysolver._ge_beam3_g1_elastic import ElasticSection, canonical -from anysolver._ge_beam3_g1_operator import ElasticOperator -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference -from anysolver._ge_beam3_g3b_reference import B2TranslationReferenceProblem, POLICY +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel, Material +from anyfesolver._ge_beam3_g1_element import ElasticElement +from anyfesolver._ge_beam3_g1_elastic import ElasticSection, canonical +from anyfesolver._ge_beam3_g1_operator import ElasticOperator +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference +from anyfesolver._ge_beam3_g3b_reference import B2TranslationReferenceProblem, POLICY ROOT = Path(__file__).resolve().parents[1] FIXTURE = json.loads((ROOT/'docs/reference_cases/ge_beam3_g3_graph_fixtures_v1.json').read_text()) @@ -183,25 +183,25 @@ def test_additive_scope_and_immutable_parent_authority(): import subprocess parent = 'ebd3b203e4df72186bd82b2f6d7e6609e18685c6' git = ['git', '-c', 'safe.directory='+ROOT.as_posix()] - allowed = {'src/anysolver/_ge_beam3_g3b_reference.py', 'tests/test_ge_beam3_g3b_mb2.py', + allowed = {'src/anyfesolver/_ge_beam3_g3b_reference.py', 'tests/test_ge_beam3_g3b_mb2.py', 'scripts/run_ge_beam3_g3b.py', 'docs/GE_BEAM3_G3B_M_B2_DEVELOPMENT.md', 'docs/reference_cases/ge_beam3_g3b_mb2_development_v1.json', 'tests/test_ge_beam3_g3b_mb3.py', 'docs/GE_BEAM3_G3B_M_B3_DEVELOPMENT.md', 'docs/reference_cases/ge_beam3_g3b_mb3_development_v1.json', - 'src/anysolver/_ge_beam3_g3b_q4_reference.py', 'tests/test_ge_beam3_g3b_mq4.py', + 'src/anyfesolver/_ge_beam3_g3b_q4_reference.py', 'tests/test_ge_beam3_g3b_mq4.py', 'docs/GE_BEAM3_G3B_M_Q4_DEVELOPMENT.md', 'docs/reference_cases/ge_beam3_g3b_mq4_development_v1.json', - 'src/anysolver/_ge_beam3_g3b_s3_reference.py', 'tests/test_ge_beam3_g3b_ms3.py', + 'src/anyfesolver/_ge_beam3_g3b_s3_reference.py', 'tests/test_ge_beam3_g3b_ms3.py', 'docs/GE_BEAM3_G3B_M_S3_DEVELOPMENT.md', 'docs/reference_cases/ge_beam3_g3b_ms3_development_v1.json', - 'src/anysolver/_ge_beam3_g3b_weighted_reference.py','tests/test_ge_beam3_g3b_weighted.py', + 'src/anyfesolver/_ge_beam3_g3b_weighted_reference.py','tests/test_ge_beam3_g3b_weighted.py', 'docs/GE_BEAM3_G3B_WEIGHTED_DEVELOPMENT.md','docs/reference_cases/ge_beam3_g3b_weighted_development_v1.json'} allowed.update(["tests/test_ge_beam3_g3b_transport.py","docs/GE_BEAM3_G3B_TRANSPORT_DEVELOPMENT.md","docs/reference_cases/ge_beam3_g3b_transport_development_v1.json"]) - allowed.update(["src/anysolver/_ge_beam3_g3b_owner.py","tests/test_ge_beam3_g3b_owner.py","docs/GE_BEAM3_G3B_OWNER_CONTRACT.md","docs/reference_cases/ge_beam3_g3b_owner_development_v1.json"]) + allowed.update(["src/anyfesolver/_ge_beam3_g3b_owner.py","tests/test_ge_beam3_g3b_owner.py","docs/GE_BEAM3_G3B_OWNER_CONTRACT.md","docs/reference_cases/ge_beam3_g3b_owner_development_v1.json"]) allowed.update(["docs/GE_BEAM3_G3B_ENTRY_SAFETY_STATUS.md","docs/reference_cases/ge_beam3_g3b_confirmation_inventory_v2.json"]) allowed.update(["scripts/confirm_ge_beam3_g3b.py","scripts/ge_beam3_g3b_environment.py","tests/test_ge_beam3_g3b_confirmation_runner.py","docs/GE_BEAM3_G3B_CONFIRMATION_RUNNER_STATUS.md"]) allowed.update(["scripts/ge_beam3_g3b_confirmation_authority.py","tests/test_ge_beam3_g3b_confirmation_authority.py","docs/GE_BEAM3_G3B_FORMAL_CONFIRMATION_CONTRACT.md","docs/reference_cases/ge_beam3_g3b_confirmation_inventory_v1.json"]) - allowed.update(["docs/GE_BEAM3_G3B_LOCAL_REVIEW_STATUS.md","docs/reference_cases/ge_beam3_g3b_local_safety_review_v1.json","src/anysolver/_ge_beam3_g3b_result_schema.py","tests/test_ge_beam3_g3b_owner_corrections.py","docs/GE_BEAM3_G3B_OWNER_CORRECTIONS.md"]) + allowed.update(["docs/GE_BEAM3_G3B_LOCAL_REVIEW_STATUS.md","docs/reference_cases/ge_beam3_g3b_local_safety_review_v1.json","src/anyfesolver/_ge_beam3_g3b_result_schema.py","tests/test_ge_beam3_g3b_owner_corrections.py","docs/GE_BEAM3_G3B_OWNER_CORRECTIONS.md"]) diff = subprocess.check_output(git+['diff', '--name-status', parent, '--'], cwd=ROOT, timeout=20).decode() for line in diff.splitlines(): status, name = line.split('\t'); assert status == 'A' and name in allowed @@ -211,4 +211,4 @@ def test_additive_scope_and_immutable_parent_authority(): for binding in contract['source_bindings']+contract['text_bindings']: raw = (ROOT/binding['path']).read_bytes().replace(b'\r\n', b'\n') assert len(raw) == binding['bytes'] and hashlib.sha256(raw).hexdigest() == binding['sha256'] - assert 'g3b' not in (ROOT/'src/anysolver/__init__.py').read_text() + assert 'g3b' not in (ROOT/'src/anyfesolver/__init__.py').read_text() diff --git a/tests/test_ge_beam3_g3b_mb3.py b/tests/test_ge_beam3_g3b_mb3.py index 6806441ad..7e45fc8a7 100644 --- a/tests/test_ge_beam3_g3b_mb3.py +++ b/tests/test_ge_beam3_g3b_mb3.py @@ -6,13 +6,13 @@ from unittest.mock import patch import numpy as np import pytest -from anysolver.elements import QuadraticBeamElement -from anysolver.fe_core import FEModel, Material -from anysolver._ge_beam3_g1_element import ElasticElement -from anysolver._ge_beam3_g1_elastic import ElasticSection, canonical -from anysolver._ge_beam3_g1_operator import ElasticOperator -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference -from anysolver._ge_beam3_g3b_reference import B3TranslationReferenceProblem, B3_POLICY +from anyfesolver.elements import QuadraticBeamElement +from anyfesolver.fe_core import FEModel, Material +from anyfesolver._ge_beam3_g1_element import ElasticElement +from anyfesolver._ge_beam3_g1_elastic import ElasticSection, canonical +from anyfesolver._ge_beam3_g1_operator import ElasticOperator +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference +from anyfesolver._ge_beam3_g3b_reference import B3TranslationReferenceProblem, B3_POLICY ROOT = Path(__file__).resolve().parents[1] FIXTURE = json.loads((ROOT/'docs/reference_cases/ge_beam3_g3_graph_fixtures_v1.json').read_text()) @@ -108,8 +108,8 @@ def test_mb3_reference_kkt_smoke(): @pytest.mark.parametrize('case', ['midpoint', 'curved', 'eccentricity', 'generalized', 'b2_type', 'subclass', 'null_policy', 'b2_policy']) def test_b3_specific_admission_precedes_both_operators(case): - from anysolver.elements import BeamElement - from anysolver._ge_beam3_g3b_reference import POLICY + from anyfesolver.elements import BeamElement + from anyfesolver._ge_beam3_g3b_reference import POLICY native, legacy, material, kw = parts() problem = B3TranslationReferenceProblem if case == 'midpoint': kw['nodes'][202][0] += 1e-9 @@ -135,7 +135,7 @@ def test_b3_specific_capture_mutations(case): elif case == 'eccentricity': p.legacy.eccentricity[0] = .01 elif case == 'generalized': p.legacy.generalized_section = object() elif case == 'family': - from anysolver._ge_beam3_g3b_reference import B2TranslationReferenceProblem + from anyfesolver._ge_beam3_g3b_reference import B2TranslationReferenceProblem p.__class__ = B2TranslationReferenceProblem elif case == 'nullspace': p.T = p.T*.5 else: p.J = p.J*.5 @@ -231,26 +231,26 @@ def test_successor_extent_preserves_mechanics_and_historical_records(): parent = '5da2a9c6efad7feb6a573196f3791b7872717bbe' git = ['git', '-c', 'safe.directory='+ROOT.as_posix()] allowed = { - 'src/anysolver/_ge_beam3_g3b_reference.py': 'M', + 'src/anyfesolver/_ge_beam3_g3b_reference.py': 'M', 'scripts/run_ge_beam3_g3b.py': 'M', 'tests/test_ge_beam3_g3b_mb2.py': 'M', 'tests/test_ge_beam3_g3b_mb3.py': 'A', 'docs/GE_BEAM3_G3B_M_B3_DEVELOPMENT.md': 'A', 'docs/reference_cases/ge_beam3_g3b_mb3_development_v1.json': 'A', - 'src/anysolver/_ge_beam3_g3b_q4_reference.py': 'A', 'tests/test_ge_beam3_g3b_mq4.py': 'A', + 'src/anyfesolver/_ge_beam3_g3b_q4_reference.py': 'A', 'tests/test_ge_beam3_g3b_mq4.py': 'A', 'docs/GE_BEAM3_G3B_M_Q4_DEVELOPMENT.md': 'A', 'docs/reference_cases/ge_beam3_g3b_mq4_development_v1.json': 'A', - 'src/anysolver/_ge_beam3_g3b_s3_reference.py': 'A', 'tests/test_ge_beam3_g3b_ms3.py': 'A', + 'src/anyfesolver/_ge_beam3_g3b_s3_reference.py': 'A', 'tests/test_ge_beam3_g3b_ms3.py': 'A', 'docs/GE_BEAM3_G3B_M_S3_DEVELOPMENT.md': 'A', 'docs/reference_cases/ge_beam3_g3b_ms3_development_v1.json': 'A', - 'src/anysolver/_ge_beam3_g3b_weighted_reference.py':'A','tests/test_ge_beam3_g3b_weighted.py':'A', + 'src/anyfesolver/_ge_beam3_g3b_weighted_reference.py':'A','tests/test_ge_beam3_g3b_weighted.py':'A', 'docs/GE_BEAM3_G3B_WEIGHTED_DEVELOPMENT.md':'A','docs/reference_cases/ge_beam3_g3b_weighted_development_v1.json':'A'} allowed.update({p:'A' for p in ["tests/test_ge_beam3_g3b_transport.py","docs/GE_BEAM3_G3B_TRANSPORT_DEVELOPMENT.md","docs/reference_cases/ge_beam3_g3b_transport_development_v1.json"]}) - allowed.update({p:'A' for p in ["src/anysolver/_ge_beam3_g3b_owner.py","tests/test_ge_beam3_g3b_owner.py","docs/GE_BEAM3_G3B_OWNER_CONTRACT.md","docs/reference_cases/ge_beam3_g3b_owner_development_v1.json"]}) + allowed.update({p:'A' for p in ["src/anyfesolver/_ge_beam3_g3b_owner.py","tests/test_ge_beam3_g3b_owner.py","docs/GE_BEAM3_G3B_OWNER_CONTRACT.md","docs/reference_cases/ge_beam3_g3b_owner_development_v1.json"]}) allowed.update({p:"A" for p in ["docs/GE_BEAM3_G3B_ENTRY_SAFETY_STATUS.md","docs/reference_cases/ge_beam3_g3b_confirmation_inventory_v2.json"]}) allowed.update({p:"A" for p in ["scripts/confirm_ge_beam3_g3b.py","scripts/ge_beam3_g3b_environment.py","tests/test_ge_beam3_g3b_confirmation_runner.py","docs/GE_BEAM3_G3B_CONFIRMATION_RUNNER_STATUS.md"]}) allowed.update({p:"A" for p in ["scripts/ge_beam3_g3b_confirmation_authority.py","tests/test_ge_beam3_g3b_confirmation_authority.py","docs/GE_BEAM3_G3B_FORMAL_CONFIRMATION_CONTRACT.md","docs/reference_cases/ge_beam3_g3b_confirmation_inventory_v1.json"]}) - allowed.update({p:"A" for p in ["docs/GE_BEAM3_G3B_LOCAL_REVIEW_STATUS.md","docs/reference_cases/ge_beam3_g3b_local_safety_review_v1.json","src/anysolver/_ge_beam3_g3b_result_schema.py","tests/test_ge_beam3_g3b_owner_corrections.py","docs/GE_BEAM3_G3B_OWNER_CORRECTIONS.md"]}) + allowed.update({p:"A" for p in ["docs/GE_BEAM3_G3B_LOCAL_REVIEW_STATUS.md","docs/reference_cases/ge_beam3_g3b_local_safety_review_v1.json","src/anyfesolver/_ge_beam3_g3b_result_schema.py","tests/test_ge_beam3_g3b_owner_corrections.py","docs/GE_BEAM3_G3B_OWNER_CORRECTIONS.md"]}) diff = subprocess.check_output(git+['diff', '--name-status', parent, '--'], cwd=ROOT, timeout=20).decode() for line in diff.splitlines(): status, path = line.split('\t'); assert allowed.get(path) == status diff --git a/tests/test_ge_beam3_g3b_mq4.py b/tests/test_ge_beam3_g3b_mq4.py index b6e38e8a3..2cb43d58a 100644 --- a/tests/test_ge_beam3_g3b_mq4.py +++ b/tests/test_ge_beam3_g3b_mq4.py @@ -6,13 +6,13 @@ from unittest.mock import patch import numpy as np import pytest -from anysolver.e4_pl_element import QualifiedE4PLShellElement -from anysolver.fe_core import FEModel, Material -from anysolver._ge_beam3_g1_element import ElasticElement -from anysolver._ge_beam3_g1_elastic import ElasticSection, canonical -from anysolver._ge_beam3_g1_operator import ElasticOperator -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference -from anysolver._ge_beam3_g3b_q4_reference import Q4TranslationReferenceProblem, POLICY +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement +from anyfesolver.fe_core import FEModel, Material +from anyfesolver._ge_beam3_g1_element import ElasticElement +from anyfesolver._ge_beam3_g1_elastic import ElasticSection, canonical +from anyfesolver._ge_beam3_g1_operator import ElasticOperator +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference +from anyfesolver._ge_beam3_g3b_q4_reference import Q4TranslationReferenceProblem, POLICY ROOT = Path(__file__).resolve().parents[1] FIXTURE = json.loads((ROOT/'docs/reference_cases/ge_beam3_g3_graph_fixtures_v1.json').read_text()) @@ -151,7 +151,7 @@ def test_rejection_precedes_both_element_operators(case): class Unregistered(Q4TranslationReferenceProblem): pass cls = Unregistered elif case == 'wrong_class': - from anysolver.elements import ShellElement + from anyfesolver.elements import ShellElement shell = ShellElement(2, [201,202,203,204]) elif case == 'thickness': shell.thickness = .3 else: object.__setattr__(shell, '_qualified_components', {}) @@ -235,22 +235,22 @@ def test_mq4_extent_and_frozen_parent_bindings(): parent = 'd1a564857b2b74f8b0d53c4028040a31652b9caa' git = ['git','-c','safe.directory='+ROOT.as_posix()] allowed = { - 'src/anysolver/_ge_beam3_g3b_q4_reference.py':'A', 'tests/test_ge_beam3_g3b_mq4.py':'A', + 'src/anyfesolver/_ge_beam3_g3b_q4_reference.py':'A', 'tests/test_ge_beam3_g3b_mq4.py':'A', 'docs/GE_BEAM3_G3B_M_Q4_DEVELOPMENT.md':'A', 'docs/reference_cases/ge_beam3_g3b_mq4_development_v1.json':'A', 'scripts/run_ge_beam3_g3b.py':'M', 'tests/test_ge_beam3_g3b_mb2.py':'M', 'tests/test_ge_beam3_g3b_mb3.py':'M', - 'src/anysolver/_ge_beam3_g3b_s3_reference.py':'A', 'tests/test_ge_beam3_g3b_ms3.py':'A', + 'src/anyfesolver/_ge_beam3_g3b_s3_reference.py':'A', 'tests/test_ge_beam3_g3b_ms3.py':'A', 'docs/GE_BEAM3_G3B_M_S3_DEVELOPMENT.md':'A', 'docs/reference_cases/ge_beam3_g3b_ms3_development_v1.json':'A', - 'src/anysolver/_ge_beam3_g3b_weighted_reference.py':'A','tests/test_ge_beam3_g3b_weighted.py':'A', + 'src/anyfesolver/_ge_beam3_g3b_weighted_reference.py':'A','tests/test_ge_beam3_g3b_weighted.py':'A', 'docs/GE_BEAM3_G3B_WEIGHTED_DEVELOPMENT.md':'A','docs/reference_cases/ge_beam3_g3b_weighted_development_v1.json':'A'} allowed.update({p:'A' for p in ["tests/test_ge_beam3_g3b_transport.py","docs/GE_BEAM3_G3B_TRANSPORT_DEVELOPMENT.md","docs/reference_cases/ge_beam3_g3b_transport_development_v1.json"]}) - allowed.update({p:'A' for p in ["src/anysolver/_ge_beam3_g3b_owner.py","tests/test_ge_beam3_g3b_owner.py","docs/GE_BEAM3_G3B_OWNER_CONTRACT.md","docs/reference_cases/ge_beam3_g3b_owner_development_v1.json"]}) + allowed.update({p:'A' for p in ["src/anyfesolver/_ge_beam3_g3b_owner.py","tests/test_ge_beam3_g3b_owner.py","docs/GE_BEAM3_G3B_OWNER_CONTRACT.md","docs/reference_cases/ge_beam3_g3b_owner_development_v1.json"]}) allowed.update({p:"A" for p in ["docs/GE_BEAM3_G3B_ENTRY_SAFETY_STATUS.md","docs/reference_cases/ge_beam3_g3b_confirmation_inventory_v2.json"]}) allowed.update({p:"A" for p in ["scripts/confirm_ge_beam3_g3b.py","scripts/ge_beam3_g3b_environment.py","tests/test_ge_beam3_g3b_confirmation_runner.py","docs/GE_BEAM3_G3B_CONFIRMATION_RUNNER_STATUS.md"]}) allowed.update({p:"A" for p in ["scripts/ge_beam3_g3b_confirmation_authority.py","tests/test_ge_beam3_g3b_confirmation_authority.py","docs/GE_BEAM3_G3B_FORMAL_CONFIRMATION_CONTRACT.md","docs/reference_cases/ge_beam3_g3b_confirmation_inventory_v1.json"]}) - allowed.update({p:"A" for p in ["docs/GE_BEAM3_G3B_LOCAL_REVIEW_STATUS.md","docs/reference_cases/ge_beam3_g3b_local_safety_review_v1.json","src/anysolver/_ge_beam3_g3b_result_schema.py","tests/test_ge_beam3_g3b_owner_corrections.py","docs/GE_BEAM3_G3B_OWNER_CORRECTIONS.md"]}) + allowed.update({p:"A" for p in ["docs/GE_BEAM3_G3B_LOCAL_REVIEW_STATUS.md","docs/reference_cases/ge_beam3_g3b_local_safety_review_v1.json","src/anyfesolver/_ge_beam3_g3b_result_schema.py","tests/test_ge_beam3_g3b_owner_corrections.py","docs/GE_BEAM3_G3B_OWNER_CORRECTIONS.md"]}) diff = subprocess.check_output(git+['diff','--name-status',parent,'--'],cwd=ROOT,timeout=20).decode() for line in diff.splitlines(): status,path = line.split('\t'); assert allowed.get(path) == status diff --git a/tests/test_ge_beam3_g3b_ms3.py b/tests/test_ge_beam3_g3b_ms3.py index 0dba01176..a658fd6f9 100644 --- a/tests/test_ge_beam3_g3b_ms3.py +++ b/tests/test_ge_beam3_g3b_ms3.py @@ -6,13 +6,13 @@ from unittest.mock import patch import numpy as np import pytest -from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement -from anysolver.fe_core import FEModel, Material -from anysolver._ge_beam3_g1_element import ElasticElement -from anysolver._ge_beam3_g1_elastic import ElasticSection, canonical -from anysolver._ge_beam3_g1_operator import ElasticOperator -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference -from anysolver._ge_beam3_g3b_s3_reference import S3TranslationReferenceProblem, POLICY +from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement +from anyfesolver.fe_core import FEModel, Material +from anyfesolver._ge_beam3_g1_element import ElasticElement +from anyfesolver._ge_beam3_g1_elastic import ElasticSection, canonical +from anyfesolver._ge_beam3_g1_operator import ElasticOperator +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference +from anyfesolver._ge_beam3_g3b_s3_reference import S3TranslationReferenceProblem, POLICY ROOT = Path(__file__).resolve().parents[1] FIXTURE = json.loads((ROOT/'docs/reference_cases/ge_beam3_g3_graph_fixtures_v1.json').read_text()) @@ -151,7 +151,7 @@ def test_rejection_precedes_both_element_operators(case): class Unregistered(S3TranslationReferenceProblem): pass cls = Unregistered elif case == 'wrong_class': - from anysolver.elements import ShellElement + from anyfesolver.elements import ShellElement shell = ShellElement(2, [201,202,203]) elif case == 'thickness': shell.thickness = .3 else: object.__setattr__(shell, '_stiffness_matrix', np.eye(18)) @@ -231,9 +231,9 @@ def test_shuffle_insertion_and_rhs_reuse(): @pytest.mark.parametrize('family', ['v2c', 'mitc3plus', 'q4']) def test_older_candidates_and_q4_are_not_s3_v2d(family): - from anysolver.e4_pl_s3_v2c_element import StrictFlatLinearE4PLS3V2CShellElement - from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement - from anysolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.e4_pl_s3_v2c_element import StrictFlatLinearE4PLS3V2CShellElement + from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement native, shell, material, kw = parts() cls = {'v2c': StrictFlatLinearE4PLS3V2CShellElement, 'mitc3plus': QualifiedE4PLS3ShellElement, 'q4': QualifiedE4PLShellElement}[family] @@ -249,19 +249,19 @@ def test_ms3_extent_and_frozen_parent_bindings(): parent = '10a16c522e338088cba2d4f40af19169f149c8c9' git = ['git','-c','safe.directory='+ROOT.as_posix()] allowed = { - 'src/anysolver/_ge_beam3_g3b_s3_reference.py':'A', 'tests/test_ge_beam3_g3b_ms3.py':'A', + 'src/anyfesolver/_ge_beam3_g3b_s3_reference.py':'A', 'tests/test_ge_beam3_g3b_ms3.py':'A', 'docs/GE_BEAM3_G3B_M_S3_DEVELOPMENT.md':'A', 'docs/reference_cases/ge_beam3_g3b_ms3_development_v1.json':'A', 'scripts/run_ge_beam3_g3b.py':'M', 'tests/test_ge_beam3_g3b_mb2.py':'M', 'tests/test_ge_beam3_g3b_mb3.py':'M', 'tests/test_ge_beam3_g3b_mq4.py':'M', - 'src/anysolver/_ge_beam3_g3b_weighted_reference.py':'A','tests/test_ge_beam3_g3b_weighted.py':'A', + 'src/anyfesolver/_ge_beam3_g3b_weighted_reference.py':'A','tests/test_ge_beam3_g3b_weighted.py':'A', 'docs/GE_BEAM3_G3B_WEIGHTED_DEVELOPMENT.md':'A','docs/reference_cases/ge_beam3_g3b_weighted_development_v1.json':'A'} allowed.update({p:'A' for p in ["tests/test_ge_beam3_g3b_transport.py","docs/GE_BEAM3_G3B_TRANSPORT_DEVELOPMENT.md","docs/reference_cases/ge_beam3_g3b_transport_development_v1.json"]}) - allowed.update({p:'A' for p in ["src/anysolver/_ge_beam3_g3b_owner.py","tests/test_ge_beam3_g3b_owner.py","docs/GE_BEAM3_G3B_OWNER_CONTRACT.md","docs/reference_cases/ge_beam3_g3b_owner_development_v1.json"]}) + allowed.update({p:'A' for p in ["src/anyfesolver/_ge_beam3_g3b_owner.py","tests/test_ge_beam3_g3b_owner.py","docs/GE_BEAM3_G3B_OWNER_CONTRACT.md","docs/reference_cases/ge_beam3_g3b_owner_development_v1.json"]}) allowed.update({p:"A" for p in ["docs/GE_BEAM3_G3B_ENTRY_SAFETY_STATUS.md","docs/reference_cases/ge_beam3_g3b_confirmation_inventory_v2.json"]}) allowed.update({p:"A" for p in ["scripts/confirm_ge_beam3_g3b.py","scripts/ge_beam3_g3b_environment.py","tests/test_ge_beam3_g3b_confirmation_runner.py","docs/GE_BEAM3_G3B_CONFIRMATION_RUNNER_STATUS.md"]}) allowed.update({p:"A" for p in ["scripts/ge_beam3_g3b_confirmation_authority.py","tests/test_ge_beam3_g3b_confirmation_authority.py","docs/GE_BEAM3_G3B_FORMAL_CONFIRMATION_CONTRACT.md","docs/reference_cases/ge_beam3_g3b_confirmation_inventory_v1.json"]}) - allowed.update({p:"A" for p in ["docs/GE_BEAM3_G3B_LOCAL_REVIEW_STATUS.md","docs/reference_cases/ge_beam3_g3b_local_safety_review_v1.json","src/anysolver/_ge_beam3_g3b_result_schema.py","tests/test_ge_beam3_g3b_owner_corrections.py","docs/GE_BEAM3_G3B_OWNER_CORRECTIONS.md"]}) + allowed.update({p:"A" for p in ["docs/GE_BEAM3_G3B_LOCAL_REVIEW_STATUS.md","docs/reference_cases/ge_beam3_g3b_local_safety_review_v1.json","src/anyfesolver/_ge_beam3_g3b_result_schema.py","tests/test_ge_beam3_g3b_owner_corrections.py","docs/GE_BEAM3_G3B_OWNER_CORRECTIONS.md"]}) diff = subprocess.check_output(git+['diff','--name-status',parent,'--'],cwd=ROOT,timeout=20).decode() for line in diff.splitlines(): status,path = line.split('\t'); assert allowed.get(path) == status diff --git a/tests/test_ge_beam3_g3b_owner.py b/tests/test_ge_beam3_g3b_owner.py index 85d8bd3d0..a2beb1639 100644 --- a/tests/test_ge_beam3_g3b_owner.py +++ b/tests/test_ge_beam3_g3b_owner.py @@ -11,8 +11,8 @@ import numpy as np import pytest -from anysolver._ge_beam3_g1_elastic import canonical, owned -from anysolver._ge_beam3_g3b_owner import MixedReferenceOwner, _Bundle, MAX_BYTES +from anyfesolver._ge_beam3_g1_elastic import canonical, owned +from anyfesolver._ge_beam3_g3b_owner import MixedReferenceOwner, _Bundle, MAX_BYTES ROOT=Path(__file__).resolve().parents[1] LANES=("mb2","mb3","mq4","ms3","weighted") @@ -217,14 +217,14 @@ def test_owner_deterministic_development_packet(tmp_path): def test_owner_extent_and_prior_tests_unchanged(): git=["git","-c","safe.directory="+ROOT.as_posix()] - allowed={"src/anysolver/_ge_beam3_g3b_owner.py":"A","tests/test_ge_beam3_g3b_owner.py":"A", + allowed={"src/anyfesolver/_ge_beam3_g3b_owner.py":"A","tests/test_ge_beam3_g3b_owner.py":"A", "docs/GE_BEAM3_G3B_OWNER_CONTRACT.md":"A", "docs/reference_cases/ge_beam3_g3b_owner_development_v1.json":"A", "scripts/run_ge_beam3_g3b.py":"M"} allowed.update({p:"A" for p in ["docs/GE_BEAM3_G3B_ENTRY_SAFETY_STATUS.md","docs/reference_cases/ge_beam3_g3b_confirmation_inventory_v2.json"]}) allowed.update({p:"A" for p in ["scripts/confirm_ge_beam3_g3b.py","scripts/ge_beam3_g3b_environment.py","tests/test_ge_beam3_g3b_confirmation_runner.py","docs/GE_BEAM3_G3B_CONFIRMATION_RUNNER_STATUS.md"]}) allowed.update({p:"A" for p in ["scripts/ge_beam3_g3b_confirmation_authority.py","tests/test_ge_beam3_g3b_confirmation_authority.py","docs/GE_BEAM3_G3B_FORMAL_CONFIRMATION_CONTRACT.md","docs/reference_cases/ge_beam3_g3b_confirmation_inventory_v1.json"]}) - allowed.update({p:"A" for p in ["docs/GE_BEAM3_G3B_LOCAL_REVIEW_STATUS.md","docs/reference_cases/ge_beam3_g3b_local_safety_review_v1.json","src/anysolver/_ge_beam3_g3b_result_schema.py","tests/test_ge_beam3_g3b_owner_corrections.py","docs/GE_BEAM3_G3B_OWNER_CORRECTIONS.md"]}) + allowed.update({p:"A" for p in ["docs/GE_BEAM3_G3B_LOCAL_REVIEW_STATUS.md","docs/reference_cases/ge_beam3_g3b_local_safety_review_v1.json","src/anyfesolver/_ge_beam3_g3b_result_schema.py","tests/test_ge_beam3_g3b_owner_corrections.py","docs/GE_BEAM3_G3B_OWNER_CORRECTIONS.md"]}) markers=dict(mb2="test_additive_scope_and_immutable_parent_authority", mb3="test_successor_extent_preserves_mechanics_and_historical_records", mq4="test_mq4_extent_and_frozen_parent_bindings",ms3="test_ms3_extent_and_frozen_parent_bindings", diff --git a/tests/test_ge_beam3_g3b_owner_corrections.py b/tests/test_ge_beam3_g3b_owner_corrections.py index 6ab8ee71e..08b92b219 100644 --- a/tests/test_ge_beam3_g3b_owner_corrections.py +++ b/tests/test_ge_beam3_g3b_owner_corrections.py @@ -8,8 +8,8 @@ from unittest.mock import patch import pytest -from anysolver._ge_beam3_g1_elastic import canonical -from anysolver._ge_beam3_g3b_owner import MixedReferenceOwner +from anyfesolver._ge_beam3_g1_elastic import canonical +from anyfesolver._ge_beam3_g3b_owner import MixedReferenceOwner ROOT=Path(__file__).resolve().parents[1] spec=importlib.util.spec_from_file_location("g3b_owner_baseline",ROOT/"tests/test_ge_beam3_g3b_owner.py") @@ -103,7 +103,7 @@ def test_complete_journal_schema_precedes_owner_construction(lane,kind,request): @pytest.mark.parametrize("lane",LANES) @pytest.mark.parametrize("failure",("raising_view","forged_view")) def test_entry_bookkeeping_rejection_releases_lock(lane,failure,request): - from anysolver._ge_beam3_g3b_owner import _Bundle + from anyfesolver._ge_beam3_g3b_owner import _Bundle module,p,owner,f=baseline.setup(lane); owner.solve((f,)) before=owner.checkpoint(); factor=owner._factor fake_data=canonical(dict(forged=True)); fake=_Bundle(fake_data,sha256(fake_data).hexdigest()) diff --git a/tests/test_ge_beam3_g3b_transport.py b/tests/test_ge_beam3_g3b_transport.py index 98153b9b9..e38b1dd32 100644 --- a/tests/test_ge_beam3_g3b_transport.py +++ b/tests/test_ge_beam3_g3b_transport.py @@ -17,12 +17,12 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference -from anysolver._ge_beam3_g1_element import ElasticElement -from anysolver._ge_beam3_g1_elastic import ElasticSection, canonical -from anysolver._ge_beam3_g1_operator import schur -from anysolver._ge_beam3_g3b_reference import progress -from anysolver.fe_core import FEModel +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference +from anyfesolver._ge_beam3_g1_element import ElasticElement +from anyfesolver._ge_beam3_g1_elastic import ElasticSection, canonical +from anyfesolver._ge_beam3_g1_operator import schur +from anyfesolver._ge_beam3_g3b_reference import progress +from anyfesolver.fe_core import FEModel ROOT = Path(__file__).resolve().parents[1] PARENT = "7c4c980a8c5b4ccadb6721be177746af58c341ae" @@ -315,11 +315,11 @@ def test_transport_extent(): "docs/reference_cases/ge_beam3_g3b_transport_development_v1.json":"A", "scripts/run_ge_beam3_g3b.py":"M"} allowed.update({"tests/test_ge_beam3_g3b_"+lane+".py":"M" for lane in LANES}) - allowed.update({p:'A' for p in ["src/anysolver/_ge_beam3_g3b_owner.py","tests/test_ge_beam3_g3b_owner.py","docs/GE_BEAM3_G3B_OWNER_CONTRACT.md","docs/reference_cases/ge_beam3_g3b_owner_development_v1.json"]}) + allowed.update({p:'A' for p in ["src/anyfesolver/_ge_beam3_g3b_owner.py","tests/test_ge_beam3_g3b_owner.py","docs/GE_BEAM3_G3B_OWNER_CONTRACT.md","docs/reference_cases/ge_beam3_g3b_owner_development_v1.json"]}) allowed.update({p:"A" for p in ["docs/GE_BEAM3_G3B_ENTRY_SAFETY_STATUS.md","docs/reference_cases/ge_beam3_g3b_confirmation_inventory_v2.json"]}) allowed.update({p:"A" for p in ["scripts/confirm_ge_beam3_g3b.py","scripts/ge_beam3_g3b_environment.py","tests/test_ge_beam3_g3b_confirmation_runner.py","docs/GE_BEAM3_G3B_CONFIRMATION_RUNNER_STATUS.md"]}) allowed.update({p:"A" for p in ["scripts/ge_beam3_g3b_confirmation_authority.py","tests/test_ge_beam3_g3b_confirmation_authority.py","docs/GE_BEAM3_G3B_FORMAL_CONFIRMATION_CONTRACT.md","docs/reference_cases/ge_beam3_g3b_confirmation_inventory_v1.json"]}) - allowed.update({p:"A" for p in ["docs/GE_BEAM3_G3B_LOCAL_REVIEW_STATUS.md","docs/reference_cases/ge_beam3_g3b_local_safety_review_v1.json","src/anysolver/_ge_beam3_g3b_result_schema.py","tests/test_ge_beam3_g3b_owner_corrections.py","docs/GE_BEAM3_G3B_OWNER_CORRECTIONS.md"]}) + allowed.update({p:"A" for p in ["docs/GE_BEAM3_G3B_LOCAL_REVIEW_STATUS.md","docs/reference_cases/ge_beam3_g3b_local_safety_review_v1.json","src/anyfesolver/_ge_beam3_g3b_result_schema.py","tests/test_ge_beam3_g3b_owner_corrections.py","docs/GE_BEAM3_G3B_OWNER_CORRECTIONS.md"]}) for line in subprocess.check_output(git+["diff","--name-status",PARENT,"--"],cwd=ROOT,timeout=20).decode().splitlines(): status,path=line.split("\t"); assert allowed.get(path)==status extra=subprocess.check_output(git+["ls-files","--others","--exclude-standard"],cwd=ROOT,timeout=20).decode().splitlines() diff --git a/tests/test_ge_beam3_g3b_weighted.py b/tests/test_ge_beam3_g3b_weighted.py index b4a14355b..9eb2e5c6f 100644 --- a/tests/test_ge_beam3_g3b_weighted.py +++ b/tests/test_ge_beam3_g3b_weighted.py @@ -6,13 +6,13 @@ from unittest.mock import patch import numpy as np import pytest -from anysolver.e4_pl_element import QualifiedE4PLShellElement -from anysolver.fe_core import FEModel, Material -from anysolver._ge_beam3_g1_element import ElasticElement -from anysolver._ge_beam3_g1_elastic import ElasticSection, canonical -from anysolver._ge_beam3_g1_operator import ElasticOperator -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference -from anysolver._ge_beam3_g3b_weighted_reference import WeightedQ4TranslationReferenceProblem, POLICY +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement +from anyfesolver.fe_core import FEModel, Material +from anyfesolver._ge_beam3_g1_element import ElasticElement +from anyfesolver._ge_beam3_g1_elastic import ElasticSection, canonical +from anyfesolver._ge_beam3_g1_operator import ElasticOperator +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference +from anyfesolver._ge_beam3_g3b_weighted_reference import WeightedQ4TranslationReferenceProblem, POLICY ROOT = Path(__file__).resolve().parents[1] FIXTURE = json.loads((ROOT/'docs/reference_cases/ge_beam3_g3_graph_fixtures_v1.json').read_text()) @@ -152,7 +152,7 @@ def test_rejection_precedes_both_element_operators(case): class Unregistered(WeightedQ4TranslationReferenceProblem): pass cls = Unregistered elif case == 'wrong_class': - from anysolver.elements import ShellElement + from anyfesolver.elements import ShellElement shell = ShellElement(2, [201,202,203,204]) elif case == 'thickness': shell.thickness = .3 else: object.__setattr__(shell, '_qualified_components', {}) @@ -296,18 +296,18 @@ def test_weighted_extent_and_frozen_parent_bindings(): import subprocess parent = 'df9a68310943b2e8455d2a06905bd714321bee14' git = ['git','-c','safe.directory='+ROOT.as_posix()] - allowed = {'src/anysolver/_ge_beam3_g3b_weighted_reference.py':'A', + allowed = {'src/anyfesolver/_ge_beam3_g3b_weighted_reference.py':'A', 'tests/test_ge_beam3_g3b_weighted.py':'A','docs/GE_BEAM3_G3B_WEIGHTED_DEVELOPMENT.md':'A', 'docs/reference_cases/ge_beam3_g3b_weighted_development_v1.json':'A', 'scripts/run_ge_beam3_g3b.py':'M','tests/test_ge_beam3_g3b_mb2.py':'M', 'tests/test_ge_beam3_g3b_mb3.py':'M','tests/test_ge_beam3_g3b_mq4.py':'M', 'tests/test_ge_beam3_g3b_ms3.py':'M'} allowed.update({p:'A' for p in ["tests/test_ge_beam3_g3b_transport.py","docs/GE_BEAM3_G3B_TRANSPORT_DEVELOPMENT.md","docs/reference_cases/ge_beam3_g3b_transport_development_v1.json"]}) - allowed.update({p:'A' for p in ["src/anysolver/_ge_beam3_g3b_owner.py","tests/test_ge_beam3_g3b_owner.py","docs/GE_BEAM3_G3B_OWNER_CONTRACT.md","docs/reference_cases/ge_beam3_g3b_owner_development_v1.json"]}) + allowed.update({p:'A' for p in ["src/anyfesolver/_ge_beam3_g3b_owner.py","tests/test_ge_beam3_g3b_owner.py","docs/GE_BEAM3_G3B_OWNER_CONTRACT.md","docs/reference_cases/ge_beam3_g3b_owner_development_v1.json"]}) allowed.update({p:"A" for p in ["docs/GE_BEAM3_G3B_ENTRY_SAFETY_STATUS.md","docs/reference_cases/ge_beam3_g3b_confirmation_inventory_v2.json"]}) allowed.update({p:"A" for p in ["scripts/confirm_ge_beam3_g3b.py","scripts/ge_beam3_g3b_environment.py","tests/test_ge_beam3_g3b_confirmation_runner.py","docs/GE_BEAM3_G3B_CONFIRMATION_RUNNER_STATUS.md"]}) allowed.update({p:"A" for p in ["scripts/ge_beam3_g3b_confirmation_authority.py","tests/test_ge_beam3_g3b_confirmation_authority.py","docs/GE_BEAM3_G3B_FORMAL_CONFIRMATION_CONTRACT.md","docs/reference_cases/ge_beam3_g3b_confirmation_inventory_v1.json"]}) - allowed.update({p:"A" for p in ["docs/GE_BEAM3_G3B_LOCAL_REVIEW_STATUS.md","docs/reference_cases/ge_beam3_g3b_local_safety_review_v1.json","src/anysolver/_ge_beam3_g3b_result_schema.py","tests/test_ge_beam3_g3b_owner_corrections.py","docs/GE_BEAM3_G3B_OWNER_CORRECTIONS.md"]}) + allowed.update({p:"A" for p in ["docs/GE_BEAM3_G3B_LOCAL_REVIEW_STATUS.md","docs/reference_cases/ge_beam3_g3b_local_safety_review_v1.json","src/anyfesolver/_ge_beam3_g3b_result_schema.py","tests/test_ge_beam3_g3b_owner_corrections.py","docs/GE_BEAM3_G3B_OWNER_CORRECTIONS.md"]}) diff = subprocess.check_output(git+['diff','--name-status',parent,'--'],cwd=ROOT,timeout=20).decode() for line in diff.splitlines(): status,path = line.split('\t'); assert allowed.get(path) == status diff --git a/tests/test_ge_beam3_g3c_b2_physical_adapter.py b/tests/test_ge_beam3_g3c_b2_physical_adapter.py index f8f7a4c6e..a91032b74 100644 --- a/tests/test_ge_beam3_g3c_b2_physical_adapter.py +++ b/tests/test_ge_beam3_g3c_b2_physical_adapter.py @@ -5,7 +5,7 @@ from pathlib import Path import numpy as np import pytest -import anysolver._ge_beam3_g3c_b2_physical_adapter as module +import anyfesolver._ge_beam3_g3c_b2_physical_adapter as module CONTRACT = json.loads((Path(__file__).resolve().parents[1]/ 'docs/reference_cases/ge_beam3_g3c_b2_physical_contract_v1.json').read_text()) diff --git a/tests/test_ge_beam3_g3c_b2_physical_core.py b/tests/test_ge_beam3_g3c_b2_physical_core.py index e590883e0..ce5ca3634 100644 --- a/tests/test_ge_beam3_g3c_b2_physical_core.py +++ b/tests/test_ge_beam3_g3c_b2_physical_core.py @@ -4,7 +4,7 @@ from pathlib import Path import numpy as np import pytest -from anysolver._ge_beam3_g3c_b2_physical import evaluate as _evaluate, physical_rigidities, RepresentabilityError +from anyfesolver._ge_beam3_g3c_b2_physical import evaluate as _evaluate, physical_rigidities, RepresentabilityError CONTRACT=json.loads((Path(__file__).resolve().parents[1]/'docs/reference_cases/ge_beam3_g3c_b2_physical_contract_v1.json').read_text()) SCIENTIFIC_RECORDS=[] diff --git a/tests/test_ge_beam3_g3c_elementary_diagnostic.py b/tests/test_ge_beam3_g3c_elementary_diagnostic.py index c800d391c..12e13b778 100644 --- a/tests/test_ge_beam3_g3c_elementary_diagnostic.py +++ b/tests/test_ge_beam3_g3c_elementary_diagnostic.py @@ -4,7 +4,7 @@ import json import numpy as np -from anysolver import _ge_beam3_mixed_ad as ad +from anyfesolver import _ge_beam3_mixed_ad as ad def oracle(kind, value, terms): diff --git a/tests/test_ge_beam3_g3c_finite_local.py b/tests/test_ge_beam3_g3c_finite_local.py index 9d757d3d7..e6c2f71f5 100644 --- a/tests/test_ge_beam3_g3c_finite_local.py +++ b/tests/test_ge_beam3_g3c_finite_local.py @@ -4,7 +4,7 @@ from pathlib import Path import numpy as np import pytest -from anysolver._ge_beam3_g3c_local_beam import LocalBeam +from anyfesolver._ge_beam3_g3c_local_beam import LocalBeam from test_ge_beam3_g3c_local_beam import SECTION, exp, err, equal, state ROOT=Path(__file__).resolve().parents[1] diff --git a/tests/test_ge_beam3_g3c_history_contract.py b/tests/test_ge_beam3_g3c_history_contract.py index b8efe68d2..ea52347c5 100644 --- a/tests/test_ge_beam3_g3c_history_contract.py +++ b/tests/test_ge_beam3_g3c_history_contract.py @@ -62,7 +62,7 @@ def test_bounds_hashes_and_inherited_scope(self): changed=copy.deepcopy(self.c); changed['mutation_categories'].pop() with self.assertRaises(ValueError): contract.validate_contract(changed) self.assertNotIn('numpy',sys.modules) - self.assertNotIn('anysolver',sys.modules) + self.assertNotIn('anyfesolver',sys.modules) if __name__ == '__main__': diff --git a/tests/test_ge_beam3_g3c_history_runner_static.py b/tests/test_ge_beam3_g3c_history_runner_static.py index 00d69090c..c3909f1be 100644 --- a/tests/test_ge_beam3_g3c_history_runner_static.py +++ b/tests/test_ge_beam3_g3c_history_runner_static.py @@ -67,7 +67,7 @@ def close(self): self.closed=True self.assertTrue(job.closed); self.assertEqual(len(failures),1) self.assertFalse(failures[0]['terminal_zero_proven']) self.assertNotIn('numpy',sys.modules) - self.assertNotIn('anysolver',sys.modules) + self.assertNotIn('anyfesolver',sys.modules) def test_prior_smoke_requires_logs_and_actual_completion_evidence(self): # Synthetic process receipts only; never offered to a real run. diff --git a/tests/test_ge_beam3_g3c_history_wrapper_static.py b/tests/test_ge_beam3_g3c_history_wrapper_static.py index 9dfdab501..37dbd3774 100644 --- a/tests/test_ge_beam3_g3c_history_wrapper_static.py +++ b/tests/test_ge_beam3_g3c_history_wrapper_static.py @@ -16,7 +16,7 @@ class WrapperStaticTests(unittest.TestCase): def test_import_is_inert_and_runtime_deterministic(self): self.assertNotIn('numpy',sys.modules) - self.assertNotIn('anysolver',sys.modules) + self.assertNotIn('anyfesolver',sys.modules) self.assertEqual(history.runtime_identity(),history.runtime_identity()) def test_malformed_packet_never_reaches_constructor(self): diff --git a/tests/test_ge_beam3_g3c_local_beam.py b/tests/test_ge_beam3_g3c_local_beam.py index 0588fa650..e475f050e 100644 --- a/tests/test_ge_beam3_g3c_local_beam.py +++ b/tests/test_ge_beam3_g3c_local_beam.py @@ -1,9 +1,9 @@ """Local implementation development only; not G3c graph qualification.""" import numpy as np import pytest -from anysolver._ge_beam3_g3c_local_beam import LocalBeam, deformation -from anysolver.fe_core import FEModel,Material -from anysolver.elements import BeamElement,QuadraticBeamElement +from anyfesolver._ge_beam3_g3c_local_beam import LocalBeam, deformation +from anyfesolver.fe_core import FEModel,Material +from anyfesolver.elements import BeamElement,QuadraticBeamElement SECTION=dict(area=1,Iy=.2,Iz=.3,J=.1,shear_factor_y=.8,shear_factor_z=.7,orientation=[0,0,1]) def exp(v): @@ -121,7 +121,7 @@ def test_detached_definition_outputs_and_invalid_routes(): with pytest.raises(ValueError): p.evaluate(z,q) def test_mutation_of_caller_arrays_cannot_split_kinematic_and_chart_inputs(monkeypatch): - import anysolver._ge_beam3_g3c_local_beam as module + import anyfesolver._ge_beam3_g3c_local_beam as module p=make(2); z,q=state(2); expected=p.evaluate(z.copy(),q.copy()) original=module.deformation def observed(*args): @@ -144,7 +144,7 @@ def test_physical_orientation_scale_never_uses_legacy_fallback(n): for value in results[1:]: equal(value.chart_hessian,results[0].chart_hessian) def test_coherent_definition_swap_during_trial_rejects(monkeypatch): - import anysolver._ge_beam3_g3c_local_beam as module + import anyfesolver._ge_beam3_g3c_local_beam as module p=make(2); d=p.descriptor(); z,q=state(2) other=LocalBeam('B2',tuple(d['node_ids']),np.array(d['coordinates']),d['anchor_node'],200,.25,SECTION) for name in ('_body','_seal'): @@ -174,7 +174,7 @@ def test_runner_rejects_changed_bound_source_and_payload(tmp_path): for name in paths: target=tmp_path/name; target.parent.mkdir(parents=True,exist_ok=True); shutil.copyfile(root/name,target) runner.verify_equation_bindings(c,tmp_path) - for name in ('src/anysolver/elements.py','docs/GE_BEAM3_G3C_OBJECTIVE_BEAM_FRAME_CONTRACT.md'): + for name in ('src/anyfesolver/elements.py','docs/GE_BEAM3_G3C_OBJECTIVE_BEAM_FRAME_CONTRACT.md'): target=tmp_path/name; original=target.read_bytes(); target.write_bytes(original+b'\n') with pytest.raises(ValueError): runner.verify_equation_bindings(c,tmp_path) target.write_bytes(original) @@ -274,7 +274,7 @@ def test_recovery_common_rigid_zero_and_superposed_motion(n): equal(b.current_frame,W@a.current_frame) def test_scalar_shear_floor_is_explicit_unresolved_physical_recovery(): - from anysolver._ge_beam3_g3c_recovery import PhysicalRecoveryBlocked + from anyfesolver._ge_beam3_g3c_recovery import PhysicalRecoveryBlocked s=dict(SECTION,area=1e-14,Iy=1e-12,Iz=1e-12,J=1e-12,shear_factor_y=1,shear_factor_z=1) p=LocalBeam('B2',(1,2),np.array([[0.,0.,0.],[1.,0.,0.]]),1,1,0,s) with pytest.raises(PhysicalRecoveryBlocked,match='BLOCKED_G3C_B2_PHYSICAL_RECOVERY_SHEAR_CLAMP'): diff --git a/tests/test_ge_beam3_g3c_local_shell.py b/tests/test_ge_beam3_g3c_local_shell.py index e060a49d8..bfeb224ab 100644 --- a/tests/test_ge_beam3_g3c_local_shell.py +++ b/tests/test_ge_beam3_g3c_local_shell.py @@ -4,8 +4,8 @@ from dataclasses import fields, is_dataclass, replace import numpy as np import pytest -from anysolver import _ge_beam3_g3c_local_shell as s -from anysolver._ge_beam3_variational_shell import deformation as old_deformation +from anyfesolver import _ge_beam3_g3c_local_shell as s +from anyfesolver._ge_beam3_variational_shell import deformation as old_deformation SHAPES = ('square', 'rectangle', 'right', 'equilateral') STEPS = (1e-4, 1e-5, 1e-6) diff --git a/tests/test_ge_beam3_g3c_mo16_obstruction.py b/tests/test_ge_beam3_g3c_mo16_obstruction.py index 2526d6e29..f041645fd 100644 --- a/tests/test_ge_beam3_g3c_mo16_obstruction.py +++ b/tests/test_ge_beam3_g3c_mo16_obstruction.py @@ -42,7 +42,7 @@ def test_determinism_and_no_qualification(self): self.assertFalse(a.audit()['full_g3c_qualified']) def test_source_floor_mutation_changes_witness(self): - source = a.sources()['src/anysolver/elements.py'] + source = a.sources()['src/anyfesolver/elements.py'] original = a.witness(source) changed = a.witness(source.replace('_SMALL = 1.0e-12', '_SMALL = 1.0e-30')) self.assertNotEqual(original, changed) diff --git a/tests/test_ge_beam3_g3c_owner_bridge.py b/tests/test_ge_beam3_g3c_owner_bridge.py index 864813e21..5a5976f2b 100644 --- a/tests/test_ge_beam3_g3c_owner_bridge.py +++ b/tests/test_ge_beam3_g3c_owner_bridge.py @@ -5,8 +5,8 @@ import numpy as np import pytest from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_g3c_definition import expand, command, canonical -from anysolver._ge_beam3_g3c_owner import MixedGraphOwner +from anyfesolver._ge_beam3_g3c_definition import expand, command, canonical +from anyfesolver._ge_beam3_g3c_owner import MixedGraphOwner def load(stage,scale=.01): return dict(kind='LOAD_STAGE',load_factor=[0.,.5,1.,.25,0.][stage],force_scale=scale,root_stage=stage) @@ -135,7 +135,7 @@ def test_closed_runtime_dispatch_and_no_restart_admission(monkeypatch): owner=MixedGraphOwner() with pytest.raises(AttributeError): owner._published=None assert not hasattr(owner,'resume') and not hasattr(owner,'checkpoint') - from anysolver import _ge_beam3_g3c_local_beam as beam + from anyfesolver import _ge_beam3_g3c_local_beam as beam original=beam.LocalBeam.evaluate def changed(*args,**kwargs): return original(*args,**kwargs) monkeypatch.setattr(beam.LocalBeam,'evaluate',changed) @@ -154,8 +154,8 @@ def replace(stage): @pytest.mark.parametrize('module_name',['owner','definition']) def test_replaced_common_transform_is_rejected_and_poisoned(monkeypatch,module_name): - from anysolver import _ge_beam3_g3c_owner as implementation - from anysolver import _ge_beam3_g3c_definition as definition + from anyfesolver import _ge_beam3_g3c_owner as implementation + from anyfesolver import _ge_beam3_g3c_definition as definition target=implementation if module_name=='owner' else definition owner=MixedGraphOwner(common_motion='CM0'); published=owner._published; original=target.SHIFT def replace(stage): @@ -167,8 +167,8 @@ def replace(stage): @pytest.mark.parametrize('family',['section','reference']) def test_imported_class_dispatch_cannot_change(monkeypatch,family): - from anysolver._ge_beam3_g1_elastic import ElasticSection - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference + from anyfesolver._ge_beam3_g1_elastic import ElasticSection + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference owner=MixedGraphOwner(); published=owner._published cls,name=(ElasticSection,'response') if family=='section' else (Reference,'frame') original=getattr(cls,name) @@ -178,7 +178,7 @@ def changed(*a,**kw): return original(*a,**kw) assert owner._published is published and not owner._owned_lock.locked() def test_authority_read_exception_permanently_poisoned(monkeypatch): - from anysolver import _ge_beam3_g3c_definition as definition + from anyfesolver import _ge_beam3_g3c_definition as definition owner=MixedGraphOwner(); published=owner._published; original=definition.bound def unreadable(*args): raise ValueError('injected frozen authority read failure') monkeypatch.setattr(definition,'bound',unreadable) diff --git a/tests/test_ge_beam3_g3c_owner_diagnostic.py b/tests/test_ge_beam3_g3c_owner_diagnostic.py index 9fe6a7ee6..d52c6e4c3 100644 --- a/tests/test_ge_beam3_g3c_owner_diagnostic.py +++ b/tests/test_ge_beam3_g3c_owner_diagnostic.py @@ -1,8 +1,8 @@ """Nonclassifying component diagnosis of the preserved d90aa3e failure.""" import json import numpy as np -from anysolver._ge_beam3_g3c_owner import MixedGraphOwner -from anysolver._ge_beam3_generalized_static_boundary import chart_pullback +from anyfesolver._ge_beam3_g3c_owner import MixedGraphOwner +from anyfesolver._ge_beam3_generalized_static_boundary import chart_pullback def test_component_directional_diagnostic(): owner=MixedGraphOwner(); u=np.linspace(-.002,.003,48) diff --git a/tests/test_ge_beam3_g3c_physical_owner.py b/tests/test_ge_beam3_g3c_physical_owner.py index 4e38f13fd..8cae7af77 100644 --- a/tests/test_ge_beam3_g3c_physical_owner.py +++ b/tests/test_ge_beam3_g3c_physical_owner.py @@ -91,8 +91,8 @@ def native_checks(previous,current): def test_physical_family_work(): import numpy as np - from anysolver._ge_beam3_g3c_physical_owner import MixedGraphOwner,recovery_witness - from anysolver._ge_beam3_g3c_stable.operator import schur + from anyfesolver._ge_beam3_g3c_physical_owner import MixedGraphOwner,recovery_witness + from anyfesolver._ge_beam3_g3c_stable.operator import schur graph,variant=selected();owner=MixedGraphOwner(graph,variant) before=json.loads(owner.snapshot_bytes())['state'] for command in history.commands('NONE',.01)[:2]: @@ -153,14 +153,14 @@ def directional(owner,command): def test_physical_directional(): - from anysolver._ge_beam3_g3c_physical_owner import MixedGraphOwner + from anyfesolver._ge_beam3_g3c_physical_owner import MixedGraphOwner owner=MixedGraphOwner(*selected()) record('directional',errors=directional(owner,history.commands('NONE',.01)[0])) def test_physical_atomicity(): import pytest - from anysolver._ge_beam3_g3c_physical_owner import MixedGraphOwner + from anyfesolver._ge_beam3_g3c_physical_owner import MixedGraphOwner _,source=history.packet.authorities();graph,variant=selected() expanded=source.expand_inert(graph,variant)[1] last=next(e['id'] for e in reversed(expanded['graph']['elements']) if e['family']!='NATIVE') @@ -176,7 +176,7 @@ def failure(stage): def test_physical_token_and_definition_guards(): import pytest - from anysolver._ge_beam3_g3c_physical_owner import MixedGraphOwner + from anyfesolver._ge_beam3_g3c_physical_owner import MixedGraphOwner for kind in ('nonce','definition','initial','reentry'): owner=MixedGraphOwner(*selected());before=owner._published def mutate(stage): @@ -227,7 +227,7 @@ def independent_constraints(owner,total,qa,mu,W=None,translation=None): def test_physical_independent_joint_work_transport(): import numpy as np - from anysolver._ge_beam3_g3c_physical_owner import MixedGraphOwner + from anyfesolver._ge_beam3_g3c_physical_owner import MixedGraphOwner graph,variant=selected();owner=MixedGraphOwner(graph,variant);n=owner.size state=json.loads(owner._published.state);qa=np.asarray(state['rotations']);u=np.linspace(-.012,.009,n);mu=np.resize([.3,-.2,.1,.25,-.15,.4],len(state['multipliers'])) expected=independent_constraints(owner,u,qa,mu);actual=owner._constraints(u,qa,mu,None) @@ -264,7 +264,7 @@ def test_physical_observation_and_cache_guards(): import pytest import threading from unittest.mock import patch - from anysolver import _ge_beam3_g3c_physical_owner as mechanics + from anyfesolver import _ge_beam3_g3c_physical_owner as mechanics Owner=mechanics.MixedGraphOwner;graph,variant=selected();owner=Owner(graph,variant) state=json.loads(owner._published.state);u=np.zeros(owner.size);mu=np.zeros(len(state['multipliers']));command=history.commands('NONE',.01)[0] baseline=owner.trial(u,mu,dict(command));before=owner._published @@ -334,7 +334,7 @@ def test_physical_recovery_witness_guards(): import numpy as np import pytest from dataclasses import replace - from anysolver import _ge_beam3_g3c_physical_owner as mechanics + from anyfesolver import _ge_beam3_g3c_physical_owner as mechanics owner=mechanics.MixedGraphOwner(*selected());state=json.loads(owner._published.state) trial=owner.trial(np.linspace(-.001,.002,owner.size),np.zeros(len(state['multipliers'])),history.commands('NONE',.01)[0]) candidate=json.loads(trial['candidate']);count=0 diff --git a/tests/test_ge_beam3_g3c_proof_compressed.py b/tests/test_ge_beam3_g3c_proof_compressed.py index 9909f804a..107a4c59a 100644 --- a/tests/test_ge_beam3_g3c_proof_compressed.py +++ b/tests/test_ge_beam3_g3c_proof_compressed.py @@ -122,7 +122,7 @@ def test_checker_is_standard_library_only_and_mechanics_independent(): elif isinstance(node, ast.ImportFrom): imports.add((node.module or "").split(".")[0]) assert imports <= {"hashlib", "json"} - assert imports.isdisjoint({"anysolver", "numpy", "scipy", "sympy"}) + assert imports.isdisjoint({"anyfesolver", "numpy", "scipy", "sympy"}) def test_manifest_is_deterministic(): @@ -275,7 +275,7 @@ def cancel(self): self.cancelled=True def test_physical_owner_backtracks_only_the_typed_chart_cutback(): """Freeze the successor's narrow line-search exception boundary.""" - owner_path = ROOT / "src" / "anysolver" / "_ge_beam3_g3c_physical_owner.py" + owner_path = ROOT / "src" / "anyfesolver" / "_ge_beam3_g3c_physical_owner.py" tree = ast.parse(owner_path.read_text(encoding="utf-8")) run = next(node for node in ast.walk(tree) if isinstance(node, ast.FunctionDef) and node.name == "_run") diff --git a/tests/test_ge_beam3_g3c_rehearsal_bridge_contract.py b/tests/test_ge_beam3_g3c_rehearsal_bridge_contract.py index 901a9bf30..e5cb6a2f1 100644 --- a/tests/test_ge_beam3_g3c_rehearsal_bridge_contract.py +++ b/tests/test_ge_beam3_g3c_rehearsal_bridge_contract.py @@ -22,7 +22,7 @@ def test_unique_literal_without_import(self): for raw in (b'SCHEMA=make()\n',b'SCHEMA="x"\nSCHEMA="y"\n', b'SCHEMA="x"\nSCHEMA=make()\n',b'OTHER="x"\n'): with self.assertRaises(ValueError): c.schema_literal(raw,'SCHEMA') - self.assertNotIn('numpy',sys.modules); self.assertNotIn('anysolver',sys.modules) + self.assertNotIn('numpy',sys.modules); self.assertNotIn('anyfesolver',sys.modules) def test_role_hash_and_scope_mutations(self): for key in ('commit','tree','implementation_review_sha256','inputs_sha256','runtime_sha256','archive_manifest_sha256'): @@ -37,7 +37,7 @@ def test_role_hash_and_scope_mutations(self): def test_schema_and_correction_extent_mutations(self): v=copy.deepcopy(c.expected()); v['source_schemas']['G2']['literal']='GE_BEAM3_G2_RESTART_V1' with self.assertRaises(ValueError): c.validate(v) - v=copy.deepcopy(c.expected()); v['correction_modify'].append('src/anysolver/_ge_beam3_g3c_stable/owner.py') + v=copy.deepcopy(c.expected()); v['correction_modify'].append('src/anyfesolver/_ge_beam3_g3c_stable/owner.py') with self.assertRaises(ValueError): c.validate(v) for raw in (b'{"a":1,"a":2}\n',b'{"a":NaN}\n',b'{"a":1e999}\n'): with self.assertRaises(ValueError): c.common.strict(raw) diff --git a/tests/test_ge_beam3_g3c_rehearsal_consumer_static.py b/tests/test_ge_beam3_g3c_rehearsal_consumer_static.py index 5ad80d402..ee6037b18 100644 --- a/tests/test_ge_beam3_g3c_rehearsal_consumer_static.py +++ b/tests/test_ge_beam3_g3c_rehearsal_consumer_static.py @@ -35,7 +35,7 @@ def test_full_fixed_archive_and_original_inputs(self): for name in r.WAVES['positive']: raw,digest=r.origin_packet(r.ASSIGNMENTS[name],collected) self.assertEqual(sha256(raw).hexdigest(),digest) - self.assertNotIn('numpy',sys.modules); self.assertNotIn('anysolver',sys.modules) + self.assertNotIn('numpy',sys.modules); self.assertNotIn('anyfesolver',sys.modules) def test_scope_review_hash_and_role_substitution(self): candidate,inputs,review=review_fixture() @@ -52,7 +52,7 @@ def test_exact_extent_and_bridge_identity(self): for path in expected: bad=dict(expected); bad.pop(path) with self.assertRaises(ValueError): r.verify_extent(bad) - bad=dict(expected); bad['src/anysolver/_ge_beam3_g3c_stable/owner.py']='M' + bad=dict(expected); bad['src/anyfesolver/_ge_beam3_g3c_stable/owner.py']='M' with self.assertRaises(ValueError): r.verify_extent(bad) for key in b.identity(): bad=b.identity(); bad[key]='wrong' @@ -90,7 +90,7 @@ def test_original_lease_roles_and_terminal_failures(self): def test_unchanged_source_runtime_and_raw_packet_mutations(self): lease=r.environment.strict((b.ARCHIVE/'none/none-j_b2_pair/lease.json').read_bytes()) original=Path.read_bytes - target=ROOT/'src/anysolver/_ge_beam3_g1_analysis.py' + target=ROOT/'src/anyfesolver/_ge_beam3_g1_analysis.py' def changed(path): return original(path)+b'\n' if path==target else original(path) with patch.object(Path,'read_bytes',changed): with self.assertRaisesRegex(ValueError,'unchanged producer input changed'): diff --git a/tests/test_ge_beam3_g3c_rehearsal_contract.py b/tests/test_ge_beam3_g3c_rehearsal_contract.py index 09cc0cef9..d36098c14 100644 --- a/tests/test_ge_beam3_g3c_rehearsal_contract.py +++ b/tests/test_ge_beam3_g3c_rehearsal_contract.py @@ -52,7 +52,7 @@ def test_inert_authority_and_imports(self): imports.update(a.name for n in ast.walk(tree) if isinstance(n,ast.Import) for a in n.names) self.assertEqual(imports, {'hashlib','pathlib','os','subprocess','ge_beam3_g3c_history_contract'}) self.assertNotIn('numpy',sys.modules) - self.assertNotIn('anysolver',sys.modules) + self.assertNotIn('anyfesolver',sys.modules) if __name__ == '__main__': diff --git a/tests/test_ge_beam3_g3c_rehearsal_mutations_static.py b/tests/test_ge_beam3_g3c_rehearsal_mutations_static.py index cd2fcc077..4ad1e621b 100644 --- a/tests/test_ge_beam3_g3c_rehearsal_mutations_static.py +++ b/tests/test_ge_beam3_g3c_rehearsal_mutations_static.py @@ -67,7 +67,7 @@ def test_every_packet_member_has_exact_inert_behavior(self): p.preflight(changed,record['after_sha256'],expected_runtime_sha256='4'*64) self.assertEqual(raw,fake_origin(graph,motion,scale,prefix)) self.assertNotIn('numpy',sys.modules) - self.assertNotIn('anysolver',sys.modules) + self.assertNotIn('anyfesolver',sys.modules) def test_deterministic_and_forbidden_members(self): raw=fake_origin('J_B2_PAIR','NONE',.01,2) diff --git a/tests/test_ge_beam3_g3c_rehearsal_runner_static.py b/tests/test_ge_beam3_g3c_rehearsal_runner_static.py index 113df56c9..105ae12a2 100644 --- a/tests/test_ge_beam3_g3c_rehearsal_runner_static.py +++ b/tests/test_ge_beam3_g3c_rehearsal_runner_static.py @@ -58,7 +58,7 @@ def test_exact_separate_wave_inventories(self): self.assertEqual({r.canonical(p) for p in probes},{r.canonical(p) for p in r.design.expected()['mutation_probes']}) self.assertEqual(len(r.ASSIGNMENTS),44) self.assertNotIn('numpy',sys.modules) - self.assertNotIn('anysolver',sys.modules) + self.assertNotIn('anyfesolver',sys.modules) def test_review_scope_and_hash_rejection(self): candidate=dict(commit='1'*40,tree='2'*40); inputs={} diff --git a/tests/test_ge_beam3_g3c_restart_preflight.py b/tests/test_ge_beam3_g3c_restart_preflight.py index 999107193..ac6a3db16 100644 --- a/tests/test_ge_beam3_g3c_restart_preflight.py +++ b/tests/test_ge_beam3_g3c_restart_preflight.py @@ -73,7 +73,7 @@ def test_all_graph_variants_have_inert_layout_coverage(self): self.assertEqual(result.epoch,0) self.assertEqual(result.fixture_id,graph) self.assertNotIn('numpy',sys.modules) - self.assertNotIn('anysolver',sys.modules) + self.assertNotIn('anyfesolver',sys.modules) def test_external_digest_canonical_and_byte_bounds(self): raw = p.canonical(syntax_packet()) diff --git a/tests/test_ge_beam3_g3c_so3_numerics.py b/tests/test_ge_beam3_g3c_so3_numerics.py index 370bf81c1..67f2c894e 100644 --- a/tests/test_ge_beam3_g3c_so3_numerics.py +++ b/tests/test_ge_beam3_g3c_so3_numerics.py @@ -17,8 +17,8 @@ import numpy as np import pytest -from anysolver import _ge_beam3_g3c_so3_numerics as kernel -from anysolver._ge_beam3_mixed_ad import Jet2, math_cos_limit +from anyfesolver import _ge_beam3_g3c_so3_numerics as kernel +from anyfesolver._ge_beam3_mixed_ad import Jet2, math_cos_limit import run_ge_beam3_g3c_so3_numerics as runner ROOT = Path(__file__).resolve().parents[1] @@ -82,8 +82,8 @@ def test_source_bindings_and_no_existing_routing(self): status, path = row.split('\t') assert status == 'A', path if path.startswith('src/'): - assert path == 'src/anysolver/_ge_beam3_g3c_so3_numerics.py' - tree = ast.parse((ROOT/'src/anysolver/_ge_beam3_g3c_so3_numerics.py').read_text()) + assert path == 'src/anyfesolver/_ge_beam3_g3c_so3_numerics.py' + tree = ast.parse((ROOT/'src/anyfesolver/_ge_beam3_g3c_so3_numerics.py').read_text()) forbidden = {'_exp_coefficients', '_log_factor', 'so3_exp', 'so3_log', 'rotation_exponential', 'rotation_log'} for node in ast.walk(tree): if isinstance(node, ast.Import): diff --git a/tests/test_ge_beam3_g3c_stable_bridge.py b/tests/test_ge_beam3_g3c_stable_bridge.py index f9b7c0688..d4e8c4a36 100644 --- a/tests/test_ge_beam3_g3c_stable_bridge.py +++ b/tests/test_ge_beam3_g3c_stable_bridge.py @@ -5,10 +5,10 @@ import numpy as np import pytest from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_g3c_stable.authority import expand -from anysolver._ge_beam3_g3c_stable.authority import command -from anysolver._ge_beam3_g3c_stable.authority import canonical -from anysolver._ge_beam3_g3c_stable.owner import MixedGraphOwner +from anyfesolver._ge_beam3_g3c_stable.authority import expand +from anyfesolver._ge_beam3_g3c_stable.authority import command +from anyfesolver._ge_beam3_g3c_stable.authority import canonical +from anyfesolver._ge_beam3_g3c_stable.owner import MixedGraphOwner def load(stage,scale=.01): return dict(kind='LOAD_STAGE',load_factor=[0.,.5,1.,.25,0.][stage],force_scale=scale,root_stage=stage) @@ -137,7 +137,7 @@ def test_closed_runtime_dispatch_and_no_restart_admission(monkeypatch): owner=MixedGraphOwner() with pytest.raises(AttributeError): owner._published=None assert not hasattr(owner,'resume') and not hasattr(owner,'checkpoint') - import anysolver._ge_beam3_g3c_stable.beam as beam + import anyfesolver._ge_beam3_g3c_stable.beam as beam original=beam.LocalBeam.evaluate def changed(*args,**kwargs): return original(*args,**kwargs) monkeypatch.setattr(beam.LocalBeam,'evaluate',changed) @@ -156,8 +156,8 @@ def replace(stage): @pytest.mark.parametrize('module_name',['owner','definition']) def test_replaced_common_transform_is_rejected_and_poisoned(monkeypatch,module_name): - import anysolver._ge_beam3_g3c_stable.owner as implementation - import anysolver._ge_beam3_g3c_stable.authority as definition + import anyfesolver._ge_beam3_g3c_stable.owner as implementation + import anyfesolver._ge_beam3_g3c_stable.authority as definition target=implementation if module_name=='owner' else definition owner=MixedGraphOwner(common_motion='CM0'); published=owner._published; original=target.SHIFT def replace(stage): @@ -169,8 +169,8 @@ def replace(stage): @pytest.mark.parametrize('family',['section','reference']) def test_imported_class_dispatch_cannot_change(monkeypatch,family): - from anysolver._ge_beam3_g1_elastic import ElasticSection - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference + from anyfesolver._ge_beam3_g1_elastic import ElasticSection + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference owner=MixedGraphOwner(); published=owner._published cls,name=(ElasticSection,'response') if family=='section' else (Reference,'frame') original=getattr(cls,name) @@ -180,7 +180,7 @@ def changed(*a,**kw): return original(*a,**kw) assert owner._published is published and not owner._owned_lock.locked() def test_authority_read_exception_permanently_poisoned(monkeypatch): - import anysolver._ge_beam3_g3c_stable.authority as definition + import anyfesolver._ge_beam3_g3c_stable.authority as definition owner=MixedGraphOwner(); published=owner._published; original=definition.bound def unreadable(*args): raise ValueError('injected frozen authority read failure') monkeypatch.setattr(definition,'bound',unreadable) diff --git a/tests/test_ge_beam3_g3c_stable_diagnostic.py b/tests/test_ge_beam3_g3c_stable_diagnostic.py index e48c8136e..477a7001a 100644 --- a/tests/test_ge_beam3_g3c_stable_diagnostic.py +++ b/tests/test_ge_beam3_g3c_stable_diagnostic.py @@ -1,8 +1,8 @@ """Nonclassifying component diagnosis of the preserved d90aa3e failure.""" import json import numpy as np -from anysolver._ge_beam3_g3c_stable.owner import MixedGraphOwner -from anysolver._ge_beam3_g3c_stable.boundary import chart_pullback +from anyfesolver._ge_beam3_g3c_stable.owner import MixedGraphOwner +from anyfesolver._ge_beam3_g3c_stable.boundary import chart_pullback def test_component_directional_diagnostic(): owner=MixedGraphOwner(); u=np.linspace(-.002,.003,48) diff --git a/tests/test_ge_beam3_g3c_stable_guards.py b/tests/test_ge_beam3_g3c_stable_guards.py index a80ba2214..fbfd47135 100644 --- a/tests/test_ge_beam3_g3c_stable_guards.py +++ b/tests/test_ge_beam3_g3c_stable_guards.py @@ -5,11 +5,11 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver import _ge_beam3_g3c_so3_numerics as kernel -from anysolver import _ge_beam3_mixed_ad as shared -from anysolver import _native_material_protocol as protocol -from anysolver._ge_beam3_g3c_stable import authority, owner, element, operator -from anysolver._ge_beam3_g3c_stable import beam, shell, joint, chart, boundary, line_work, fit, compensated +from anyfesolver import _ge_beam3_g3c_so3_numerics as kernel +from anyfesolver import _ge_beam3_mixed_ad as shared +from anyfesolver import _native_material_protocol as protocol +from anyfesolver._ge_beam3_g3c_stable import authority, owner, element, operator +from anyfesolver._ge_beam3_g3c_stable import beam, shell, joint, chart, boundary, line_work, fit, compensated def load(): @@ -93,7 +93,7 @@ def test_leased_runtime_hash_mutation_rejected_without_writes(): def test_foreign_predecessor_native_identity_rejected(): - from anysolver._ge_beam3_g1_element import ElasticElement as OldElement + from anyfesolver._ge_beam3_g1_element import ElasticElement as OldElement graph = owner.MixedGraphOwner() model, elements, states = graph._native_model(None) native = elements[0] @@ -114,13 +114,13 @@ def test_authoritative_native_rotations_not_reconstructed(): assert row['payload']['epoch'] == 1 assert np.array_equal(row['payload']['committed_nodal_rotation_matrices'], np.tile(np.eye(3), (3, 1, 1))) - from anysolver import _native_rotation_state as original_rotation + from anyfesolver import _native_rotation_state as original_rotation assert owner.rotation_module is original_rotation def test_nonzero_curved_line_work_directional_derivatives(): # A load-only analytic regression, not a new graph qualification fixture. - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference coordinates = np.array([[0., 0., 0.], [.5, .1, 0.], [1., 0., 0.]]) frames = [] for xi in (-1., 0., 1.): diff --git a/tests/test_ge_beam3_g3c_stable_implementation.py b/tests/test_ge_beam3_g3c_stable_implementation.py index c3b0e72f7..b5c90670e 100644 --- a/tests/test_ge_beam3_g3c_stable_implementation.py +++ b/tests/test_ge_beam3_g3c_stable_implementation.py @@ -1,4 +1,4 @@ -"""Inert implementation checks; intentionally imports no anysolver/NumPy.""" +"""Inert implementation checks; intentionally imports no anyfesolver/NumPy.""" import ast import copy import importlib.util @@ -20,7 +20,7 @@ def test_exact_generated_sources(self): def test_no_numerical_imports_during_preflight(self): self.assertNotIn('numpy', sys.modules) - self.assertNotIn('anysolver', sys.modules) + self.assertNotIn('anyfesolver', sys.modules) for path in runner.EXTRA: if path.endswith('.py'): ast.parse(mapping.normalized(ROOT/path)) diff --git a/tests/test_ge_beam3_g3c_stable_source_map.py b/tests/test_ge_beam3_g3c_stable_source_map.py index 5b479b635..1a37759f5 100644 --- a/tests/test_ge_beam3_g3c_stable_source_map.py +++ b/tests/test_ge_beam3_g3c_stable_source_map.py @@ -47,18 +47,18 @@ def test_mutations(self): with self.assertRaises(ValueError): m.audit(value) value = copy.deepcopy(self.contract) - value['module_map']['anysolver._ge_beam3_g1_operator'] = 'anysolver.forbidden' + value['module_map']['anyfesolver._ge_beam3_g1_operator'] = 'anyfesolver.forbidden' with self.assertRaises(ValueError): m.audit(value) def test_derivative_only_import_split(self): result = m.imports('from ._ge_beam3_mixed_ad import Jet2, so3_exp, rotation_log\n', - 'anysolver.owner', {}) - self.assertIn('from anysolver._ge_beam3_mixed_ad import Jet2', result) - self.assertIn('from anysolver._ge_beam3_g3c_so3_numerics import so3_exp', result) - self.assertIn('from anysolver._ge_beam3_mixed_ad import rotation_log', result) + 'anyfesolver.owner', {}) + self.assertIn('from anyfesolver._ge_beam3_mixed_ad import Jet2', result) + self.assertIn('from anyfesolver._ge_beam3_g3c_so3_numerics import so3_exp', result) + self.assertIn('from anyfesolver._ge_beam3_mixed_ad import rotation_log', result) with self.assertRaises(ValueError): - m.imports('import anysolver.old\n', 'anysolver.owner', {'anysolver.old':'anysolver.new'}) + m.imports('import anyfesolver.old\n', 'anyfesolver.owner', {'anyfesolver.old':'anyfesolver.new'}) if __name__ == '__main__': diff --git a/tests/test_ge_beam3_g4_completion.py b/tests/test_ge_beam3_g4_completion.py index 2f1e85f3d..4b9448356 100644 --- a/tests/test_ge_beam3_g4_completion.py +++ b/tests/test_ge_beam3_g4_completion.py @@ -5,17 +5,17 @@ import numpy as np import pytest -from anysolver._ge_beam3_g4_completion import ( +from anyfesolver._ge_beam3_g4_completion import ( AcceptedHistoryEnvelope, RestartAuthority) -from anysolver._ge_beam3_p5_seeded.core import canonical, sha -from anysolver._ge_beam3_retained_arc import NodalDeadForces, Program as ArcProgram, solve as arc_solve -from anysolver._ge_beam3_retained_fibre_program import solve_force_program -from anysolver._ge_beam3_retained_fibre_control import ( +from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha +from anyfesolver._ge_beam3_retained_arc import NodalDeadForces, Program as ArcProgram, solve as arc_solve +from anyfesolver._ge_beam3_retained_fibre_program import solve_force_program +from anyfesolver._ge_beam3_retained_fibre_control import ( TranslationProgram, solve_translation_program) -from anysolver._ge_beam3_retained_generalized_program import solve as generalized_solve -from anysolver._ge_beam3_retained_generalized_state import Program as GeneralizedProgram -from anysolver._ge_beam3_seeded_load_program import ForceProgram -from anysolver.control import CancellationToken +from anyfesolver._ge_beam3_retained_generalized_program import solve as generalized_solve +from anyfesolver._ge_beam3_retained_generalized_state import Program as GeneralizedProgram +from anyfesolver._ge_beam3_seeded_load_program import ForceProgram +from anyfesolver.control import CancellationToken from test_ge_beam3_g4a_station_transaction import make_owner, strains from test_ge_beam3_native_generalized_modal import make as arc_model from test_ge_beam3_native_generalized_restart import make as generalized_model, pattern as generalized_pattern diff --git a/tests/test_ge_beam3_g4_completion_closeout.py b/tests/test_ge_beam3_g4_completion_closeout.py index da98cfac7..938f74758 100644 --- a/tests/test_ge_beam3_g4_completion_closeout.py +++ b/tests/test_ge_beam3_g4_completion_closeout.py @@ -65,8 +65,8 @@ def test_external_cycles_when_archive_is_available(): pytest.skip("external qualification archive is host-local") science = [] paths = { - "formal_cycle_1": archive / "formal-cycle-1" / "anysolver-beam-qualification-fnb1q3e6", - "formal_cycle_2": archive / "formal-cycle-2" / "anysolver-beam-qualification-s6d9p_57"} + "formal_cycle_1": archive / "formal-cycle-1" / "anyfesolver-beam-qualification-fnb1q3e6", + "formal_cycle_2": archive / "formal-cycle-2" / "anyfesolver-beam-qualification-s6d9p_57"} for key, directory in paths.items(): raw = (directory / "scientific.json").read_bytes(); science.append(raw) expected = value["archive"][key] @@ -84,5 +84,5 @@ def test_closeout_has_no_mechanics_or_process_imports(): modules = {node.module for node in ast.walk(tree) if isinstance(node, ast.ImportFrom)} modules.update(alias.name for node in ast.walk(tree) if isinstance(node, ast.Import) for alias in node.names) - assert not any(name == "anysolver" or name.startswith("anysolver.") for name in modules) + assert not any(name == "anyfesolver" or name.startswith("anyfesolver.") for name in modules) assert "subprocess" not in modules and "numpy" not in modules diff --git a/tests/test_ge_beam3_g4_completion_contract.py b/tests/test_ge_beam3_g4_completion_contract.py index 9e52007bb..c7bbf0942 100644 --- a/tests/test_ge_beam3_g4_completion_contract.py +++ b/tests/test_ge_beam3_g4_completion_contract.py @@ -54,4 +54,4 @@ def test_plan_forbids_scope_expansion(): assert "G5, public routing" in text tree = ast.parse(Path(__file__).read_text(encoding="utf-8")) modules = {node.module for node in ast.walk(tree) if isinstance(node, ast.ImportFrom)} - assert not any(name and name.startswith("anysolver") for name in modules) + assert not any(name and name.startswith("anyfesolver") for name in modules) diff --git a/tests/test_ge_beam3_g4a_station_transaction.py b/tests/test_ge_beam3_g4a_station_transaction.py index 9139925e5..9fcc61ea6 100644 --- a/tests/test_ge_beam3_g4a_station_transaction.py +++ b/tests/test_ge_beam3_g4a_station_transaction.py @@ -8,15 +8,15 @@ import numpy as np import pytest -from anysolver._ge_beam3_fibre_section import Fibre, FlowCurve, PhysicalFibreSection, canonical -from anysolver._ge_beam3_g1_elastic import ElasticSection -from anysolver._ge_beam3_g4a_station_transaction import ( +from anyfesolver._ge_beam3_fibre_section import Fibre, FlowCurve, PhysicalFibreSection, canonical +from anyfesolver._ge_beam3_g1_elastic import ElasticSection +from anyfesolver._ge_beam3_g4a_station_transaction import ( MixedStationTransaction, PHYSICAL_FIBRES, RESULTANT_ONLY, StationDefinition, ) -from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection +from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection ROOT = Path(__file__).resolve().parents[1] diff --git a/tests/test_ge_beam3_g4a_station_transaction_closeout.py b/tests/test_ge_beam3_g4a_station_transaction_closeout.py index ae7266029..d242af733 100644 --- a/tests/test_ge_beam3_g4a_station_transaction_closeout.py +++ b/tests/test_ge_beam3_g4a_station_transaction_closeout.py @@ -88,5 +88,5 @@ def test_closeout_is_static_and_has_no_mechanics_import(): modules = {node.module for node in ast.walk(tree) if isinstance(node, ast.ImportFrom)} modules.update(alias.name for node in ast.walk(tree) if isinstance(node, ast.Import) for alias in node.names) - assert not any(name == "anysolver" or name.startswith("anysolver.") for name in modules) + assert not any(name == "anyfesolver" or name.startswith("anyfesolver.") for name in modules) assert "subprocess" not in modules and "numpy" not in modules diff --git a/tests/test_ge_beam3_g5_completion.py b/tests/test_ge_beam3_g5_completion.py index d840d367e..505a36a25 100644 --- a/tests/test_ge_beam3_g5_completion.py +++ b/tests/test_ge_beam3_g5_completion.py @@ -4,24 +4,24 @@ import numpy as np import pytest -import anysolver -from anysolver import ( +import anyfesolver +from anyfesolver import ( BoundaryCondition, FEModel, FixedSupport, LoadCase, TransientConfig, assemble_damping_matrix, assemble_load_vector, assemble_mass_matrix, assemble_stiffness_matrix, solve_eigenvalue_buckling, solve_free_vibration, solve_linear, solve_transient_newmark, ) -from anysolver.beam_sections import GeneralizedBeamSection -from anysolver.boundary import LoadCombination -from anysolver.elements import BeamElement, QuadraticBeamElement, create_element -from anysolver.ge_beam3_element import ( +from anyfesolver.beam_sections import GeneralizedBeamSection +from anyfesolver.boundary import LoadCombination +from anyfesolver.elements import BeamElement, QuadraticBeamElement, create_element +from anyfesolver.ge_beam3_element import ( GE_BEAM3_QUALIFIED_FORMULATION_ID, GeBeam3IntegrationError, GeometricallyExactBeam3D3NElement, ) -from anysolver.ge_beam3_mixed_element import GeBeam3MixedStateError -from anysolver._ge_beam3_g5_completion import evidence -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver import ge_beam3_native as native +from anyfesolver.ge_beam3_mixed_element import GeBeam3MixedStateError +from anyfesolver._ge_beam3_g5_completion import evidence +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver import ge_beam3_native as native from test_ge_beam3_public_workflows import make as native_owner @@ -222,7 +222,7 @@ def test_selector_and_provenance_boundary_remains_additive(tmp_path): assert type(b2) is BeamElement and type(b3) is QuadraticBeamElement assert create_element("beam", 7, [1, 2], "mat").__class__ is BeamElement assert create_element("quadratic_beam", 8, [1, 2, 3], "mat").__class__ is QuadraticBeamElement - assert "ge-beam3" not in anysolver.elements.ELEMENT_TYPES + assert "ge-beam3" not in anyfesolver.elements.ELEMENT_TYPES with pytest.raises((ValueError, GeBeam3IntegrationError)): native.create_analysis("beam", (), ()) _record(tmp_path, "SELECTOR_AND_PROVENANCE_BOUNDARY", explicit_ge_only=True, diff --git a/tests/test_ge_beam3_g6_completion.py b/tests/test_ge_beam3_g6_completion.py index 291fe990f..d51c90213 100644 --- a/tests/test_ge_beam3_g6_completion.py +++ b/tests/test_ge_beam3_g6_completion.py @@ -6,20 +6,20 @@ import numpy as np -from anysolver import ( +from anyfesolver import ( AnalysisSession, BoundaryCondition, FEModel, FixedSupport, LoadCase, solve_linear_many, ) -from anysolver.beam_sections import GeneralizedBeamSection -from anysolver.elements import QuadraticBeamElement, create_element -from anysolver.ge_beam3_element import GeometricallyExactBeam3D3NElement -from anysolver._ge_beam3_g1_elastic import ElasticSection -from anysolver._ge_beam3_g6_domain import ( +from anyfesolver.beam_sections import GeneralizedBeamSection +from anyfesolver.elements import QuadraticBeamElement, create_element +from anyfesolver.ge_beam3_element import GeometricallyExactBeam3D3NElement +from anyfesolver._ge_beam3_g1_elastic import ElasticSection +from anyfesolver._ge_beam3_g6_domain import ( ConsumerPolicy, GeneralizedInitialField, canonical, evaluate_initial_field, evidence, ) -from anysolver import ge_beam3_native as native -from anysolver._ge_beam3_native_arc import solve_arc +from anyfesolver import ge_beam3_native as native +from anyfesolver._ge_beam3_native_arc import solve_arc from test_ge_beam3_g5_completion import _exercise_reference_family, _model from test_ge_beam3_g6_domain import ( test_beam_contact_and_fracture_classification_cover_three_node_routes as _contact_route, diff --git a/tests/test_ge_beam3_g6_domain.py b/tests/test_ge_beam3_g6_domain.py index 57adf89d4..8d26dbf90 100644 --- a/tests/test_ge_beam3_g6_domain.py +++ b/tests/test_ge_beam3_g6_domain.py @@ -4,23 +4,23 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( ContributionPolicy, ElementActivity, ElementActivityPolicy, assemble_damping_matrix, assemble_mass_matrix, assemble_stiffness_matrix, ) -from anysolver._ge_beam3_g1_elastic import ElasticSection -from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection -from anysolver._ge_beam3_g6_domain import ( +from anyfesolver._ge_beam3_g1_elastic import ElasticSection +from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection +from anyfesolver._ge_beam3_g6_domain import ( ActivityEpochLease, ConsumerPolicy, GeneralizedInitialField, PARITY_DISPOSITIONS, ROUTES, adjudicate, canonical, evaluate_initial_field, evidence, ) -from anysolver.contact import ( +from anyfesolver.contact import ( RigidSphereImpact, SphereContactConfig, assemble_sphere_contact_load_vector, ) -from anysolver.fracture import element_fracture_category, element_measure -from anysolver.validation import load_vector_resultant -from anysolver import ge_beam3_native as native +from anyfesolver.fracture import element_fracture_category, element_measure +from anyfesolver.validation import load_vector_resultant +from anyfesolver import ge_beam3_native as native from test_ge_beam3_g5_completion import _model diff --git a/tests/test_ge_beam3_generalized_cell.py b/tests/test_ge_beam3_generalized_cell.py index 04225a6b3..d7f29a2f0 100644 --- a/tests/test_ge_beam3_generalized_cell.py +++ b/tests/test_ge_beam3_generalized_cell.py @@ -4,11 +4,11 @@ import json import numpy as np import pytest -from anysolver._ge_beam3_generalized_cell import GeneralizedCellConjugate -from anysolver._ge_beam3_retained_generalized import RetainedGeneralizedOperator -from anysolver._ge_beam3_fibre_section import canonical -from anysolver._ge_beam3_p5.algebra import rotation -from anysolver._ge_beam3_p5.compensated_coordinates import split_sum +from anyfesolver._ge_beam3_generalized_cell import GeneralizedCellConjugate +from anyfesolver._ge_beam3_retained_generalized import RetainedGeneralizedOperator +from anyfesolver._ge_beam3_fibre_section import canonical +from anyfesolver._ge_beam3_p5.algebra import rotation +from anyfesolver._ge_beam3_p5.compensated_coordinates import split_sum from docs.reference_cases.ge_beam3_generalized_cell_audit import audit from test_ge_beam3_generalized_ellipsoid_section import section from test_ge_beam3_fibre_cell import stations @@ -76,7 +76,7 @@ def cancel():raise RuntimeError('cancelled fixture') with pytest.raises(ValueError):cell.response([0.]*18,replace(origin,cell_identity='0'*64)) changed=deepcopy(data);changed[0]['weight']=0. with pytest.raises(ValueError):GeneralizedCellConjugate(law,changed) - import anysolver._ge_beam3_generalized_cell as module + import anyfesolver._ge_beam3_generalized_cell as module ticks=[] def clock():ticks.append(1);return 61.*len(ticks) monkeypatch.setattr(module,'monotonic',clock) @@ -89,7 +89,7 @@ def clock():ticks.append(1);return 61.*len(ticks) def test_retained_variations_and_objectivity(kind,tmp_path): ref=make_curved(100.)[0].mesh.elements[1].core.reference if kind=='straight': - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry ref=CenteredCurvedBeam3ReferenceGeometry(np.array([[0.,0.,0.],[.5,0.,0.],[1.,0.,0.]]),np.array([np.eye(3)]*3)) probe=RetainedGeneralizedOperator(ref,section(),order=4);state=args(probe) origin=probe.cell.response((state[-1]*.5).tolist())['history'];saved=canonical(origin) @@ -139,7 +139,7 @@ def test_cell_proper_spatial_reexpression(tmp_path): def test_reference_condensation_rigid_nulls_and_positive_complement(kind,tmp_path): ref=make_curved(100.)[0].mesh.elements[1].core.reference if kind=='straight': - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry ref=CenteredCurvedBeam3ReferenceGeometry(np.array([[0.,0.,0.],[.5,0.,0.],[1.,0.,0.]]),np.array([np.eye(3)]*3)) probe=RetainedGeneralizedOperator(ref,section(),order=4) result=probe.evaluate(ref.coordinates,np.zeros((3,3)),ref.nodal_triads,np.array([np.eye(3)]*2),np.zeros(18)) diff --git a/tests/test_ge_beam3_generalized_ellipsoid_section.py b/tests/test_ge_beam3_generalized_ellipsoid_section.py index ccc5a9b4b..fca0160d0 100644 --- a/tests/test_ge_beam3_generalized_ellipsoid_section.py +++ b/tests/test_ge_beam3_generalized_ellipsoid_section.py @@ -3,8 +3,8 @@ from hashlib import sha256 import numpy as np import pytest -from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection,GeneralizedStation,GeneralizedHistory -from anysolver._ge_beam3_fibre_section import canonical +from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection,GeneralizedStation,GeneralizedHistory +from anyfesolver._ge_beam3_fibre_section import canonical from docs.reference_cases.ge_beam3_generalized_ellipsoid_oracle import response as independent from test_ge_beam3_schur_line_program import save @@ -144,7 +144,7 @@ def test_yield_boundary_and_serialization(tmp_path): def test_internal_deadline_representation_and_history(monkeypatch,tmp_path): - import anysolver._ge_beam3_generalized_ellipsoid_section as module + import anyfesolver._ge_beam3_generalized_ellipsoid_section as module s=section() with pytest.raises(ValueError,match='range'):s.response(np.array([1e308]*6),control='resultant') bad=replace(s.virgin(),plastic=((1.,1.),)+s.virgin().plastic[1:]) diff --git a/tests/test_ge_beam3_generalized_energy_slenderness.py b/tests/test_ge_beam3_generalized_energy_slenderness.py index 88189634f..3bae3f457 100644 --- a/tests/test_ge_beam3_generalized_energy_slenderness.py +++ b/tests/test_ge_beam3_generalized_energy_slenderness.py @@ -6,10 +6,10 @@ from docs.reference_cases.ge_beam3_generalized_energy_chain import energy_chain from docs.reference_cases.ge_beam3_generalized_virgin_chain import virgin_chain from docs.reference_cases.ge_beam3_decimal_chain_audit import factor_chain_modes -from anysolver import _ge_beam3_native_generalized_modal as modal -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_p5.algebra import rotation -from anysolver._native_stationary_spectrum import solve_stationary_spectrum +from anyfesolver import _ge_beam3_native_generalized_modal as modal +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_p5.algebra import rotation +from anyfesolver._native_stationary_spectrum import solve_stationary_spectrum from test_ge_beam3_schur_line_program import save from test_ge_beam3_generalized_slenderness_diagnostic import make,kinetic diff --git a/tests/test_ge_beam3_generalized_factor_modal.py b/tests/test_ge_beam3_generalized_factor_modal.py index 509133ffd..0ba2d2405 100644 --- a/tests/test_ge_beam3_generalized_factor_modal.py +++ b/tests/test_ge_beam3_generalized_factor_modal.py @@ -5,10 +5,10 @@ from types import SimpleNamespace import numpy as np import pytest -from anysolver import _ge_beam3_native_generalized_factor_modal as factor -from anysolver._native_relative_factor_chain_modes import solve_relative_factor_chain_modes -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_p5.algebra import rotation +from anyfesolver import _ge_beam3_native_generalized_factor_modal as factor +from anyfesolver._native_relative_factor_chain_modes import solve_relative_factor_chain_modes +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_p5.algebra import rotation from test_ge_beam3_schur_line_program import save from test_ge_beam3_generalized_slenderness_diagnostic import make as slender from test_ge_beam3_native_generalized_modal import make diff --git a/tests/test_ge_beam3_generalized_force_conditioning.py b/tests/test_ge_beam3_generalized_force_conditioning.py index a774e3b6f..5c04954ad 100644 --- a/tests/test_ge_beam3_generalized_force_conditioning.py +++ b/tests/test_ge_beam3_generalized_force_conditioning.py @@ -1,13 +1,13 @@ """Actual nonlinear force diagnostic; genuine failures are saved then raised.""" import numpy as np import pytest -from anysolver._ge_beam3_native_generalized_program import solve_distributed_model, model_identity -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_native_generalized_recovery import recover_native_fields -from anysolver._ge_beam3_retained_generalized import RetainedGeneralizedOperator -from anysolver._ge_beam3_p5.algebra import rotation -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_native_generalized_program import solve_distributed_model, model_identity +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_native_generalized_recovery import recover_native_fields +from anyfesolver._ge_beam3_retained_generalized import RetainedGeneralizedOperator +from anyfesolver._ge_beam3_p5.algebra import rotation +from anyfesolver._ge_beam3_p5_seeded.core import canonical from test_ge_beam3_generalized_slenderness_diagnostic import make from test_ge_beam3_schur_line_program import save diff --git a/tests/test_ge_beam3_generalized_owned_current_modes.py b/tests/test_ge_beam3_generalized_owned_current_modes.py index bb9c8fe39..8fd03eb40 100644 --- a/tests/test_ge_beam3_generalized_owned_current_modes.py +++ b/tests/test_ge_beam3_generalized_owned_current_modes.py @@ -1,12 +1,12 @@ """Model dispatch must count distributed nodal/internal load work only once.""" import numpy as np import pytest -from anysolver import _ge_beam3_native_generalized_modal as dense -from anysolver import _ge_beam3_native_generalized_paired_modal as paired -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern,nodal_force_vector -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver.control import CancellationToken,SolveCancelled +from anyfesolver import _ge_beam3_native_generalized_modal as dense +from anyfesolver import _ge_beam3_native_generalized_paired_modal as paired +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern,nodal_force_vector +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.control import CancellationToken,SolveCancelled from test_ge_beam3_native_analysis import analysis from test_ge_beam3_native_generalized import problem,pattern diff --git a/tests/test_ge_beam3_generalized_paired_modal.py b/tests/test_ge_beam3_generalized_paired_modal.py index 81a5b7a3c..cc4fba749 100644 --- a/tests/test_ge_beam3_generalized_paired_modal.py +++ b/tests/test_ge_beam3_generalized_paired_modal.py @@ -5,14 +5,14 @@ from types import SimpleNamespace import numpy as np import pytest -from anysolver import _ge_beam3_native_generalized_factor_modal as factor -from anysolver import _ge_beam3_native_generalized_paired_modal as paired +from anyfesolver import _ge_beam3_native_generalized_factor_modal as factor +from anyfesolver import _ge_beam3_native_generalized_paired_modal as paired from dataclasses import replace -from anysolver._native_paired_factor_chain_modes import apply_mode_map, validate_modes -from anysolver._paired_modal_arithmetic import paired_expansion -from anysolver._native_paired_factor_chain_modes import solve_paired_factor_chain_modes as solve_relative_factor_chain_modes -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_p5.algebra import rotation +from anyfesolver._native_paired_factor_chain_modes import apply_mode_map, validate_modes +from anyfesolver._paired_modal_arithmetic import paired_expansion +from anyfesolver._native_paired_factor_chain_modes import solve_paired_factor_chain_modes as solve_relative_factor_chain_modes +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_p5.algebra import rotation from test_ge_beam3_schur_line_program import save from test_ge_beam3_generalized_slenderness_diagnostic import make as slender from test_ge_beam3_native_generalized_modal import make diff --git a/tests/test_ge_beam3_generalized_slenderness_diagnostic.py b/tests/test_ge_beam3_generalized_slenderness_diagnostic.py index bc8725a92..cebb9c53c 100644 --- a/tests/test_ge_beam3_generalized_slenderness_diagnostic.py +++ b/tests/test_ge_beam3_generalized_slenderness_diagnostic.py @@ -4,15 +4,15 @@ import pytest from docs.reference_cases.ge_beam3_generalized_virgin_chain import virgin_chain from docs.reference_cases.ge_beam3_decimal_chain_audit import factor_chain_modes -from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement -from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry -from anysolver import _ge_beam3_native_generalized_modal as modal -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_p5.algebra import rotation -from anysolver._native_stationary_spectrum import solve_stationary_spectrum -from anysolver.fe_core import FEModel -from anysolver.boundary import BoundaryCondition +from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement +from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry +from anyfesolver import _ge_beam3_native_generalized_modal as modal +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_p5.algebra import rotation +from anyfesolver._native_stationary_spectrum import solve_stationary_spectrum +from anyfesolver.fe_core import FEModel +from anyfesolver.boundary import BoundaryCondition from test_ge_beam3_schur_line_program import save @pytest.mark.parametrize('kind',('valid','stress','geometric','asymmetric','nonfinite','shape','indefinite')) diff --git a/tests/test_ge_beam3_high_contrast_force_diagnostic.py b/tests/test_ge_beam3_high_contrast_force_diagnostic.py index 3a1ac892c..28494895a 100644 --- a/tests/test_ge_beam3_high_contrast_force_diagnostic.py +++ b/tests/test_ge_beam3_high_contrast_force_diagnostic.py @@ -3,9 +3,9 @@ from time import monotonic import numpy as np import pytest -from anysolver._ge_beam3_seeded_load_program import ForceProgram,solve_force_program -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_centered_mixed import CenteredStationaryBeam +from anyfesolver._ge_beam3_seeded_load_program import ForceProgram,solve_force_program +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_centered_mixed import CenteredStationaryBeam from test_ge_beam3_curved_contrast_probe import make_curved diff --git a/tests/test_ge_beam3_integration_boundary_audit.py b/tests/test_ge_beam3_integration_boundary_audit.py index e1c0744c7..1b643a130 100644 --- a/tests/test_ge_beam3_integration_boundary_audit.py +++ b/tests/test_ge_beam3_integration_boundary_audit.py @@ -86,7 +86,7 @@ def test_duplicate_and_nonfinite_json_rejected(self): def test_no_mechanics_imported_in_standalone_run(self): # Under a wider pytest session unrelated tests may have imported these. if __name__ == '__main__': - for prefix in ('anysolver', 'numpy', 'scipy', 'sympy'): + for prefix in ('anyfesolver', 'numpy', 'scipy', 'sympy'): self.assertFalse(any(n == prefix or n.startswith(prefix+'.') for n in sys.modules)) diff --git a/tests/test_ge_beam3_internal_residual_secant.py b/tests/test_ge_beam3_internal_residual_secant.py index 8e122d30b..f9ed48aba 100644 --- a/tests/test_ge_beam3_internal_residual_secant.py +++ b/tests/test_ge_beam3_internal_residual_secant.py @@ -1,8 +1,8 @@ """Numerical-globalization tests, without changing constitutive mechanics.""" import numpy as np import pytest -from anysolver import _ge_beam3_generalized_static_boundary as boundary -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver import _ge_beam3_generalized_static_boundary as boundary +from anyfesolver._ge_beam3_p5_seeded.core import canonical import test_ge_beam3_native_spectral_prestress as preload from test_ge_beam3_schur_line_program import save diff --git a/tests/test_ge_beam3_large_modal_ownership.py b/tests/test_ge_beam3_large_modal_ownership.py index 1cf55eeab..5d4341d0c 100644 --- a/tests/test_ge_beam3_large_modal_ownership.py +++ b/tests/test_ge_beam3_large_modal_ownership.py @@ -1,11 +1,11 @@ """Capture completion, separate immutable spectral ownership and old routing.""" from hashlib import sha256 import pytest -from anysolver import _ge_beam3_analysis_modal_snapshot as snapshot -from anysolver import _ge_beam3_analysis_translation_modal as route -from anysolver._ge_beam3_native_analysis import NativeBeamAnalysis -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver.control import CancellationToken,SolveCancelled +from anyfesolver import _ge_beam3_analysis_modal_snapshot as snapshot +from anyfesolver import _ge_beam3_analysis_translation_modal as route +from anyfesolver._ge_beam3_native_analysis import NativeBeamAnalysis +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.control import CancellationToken,SolveCancelled from test_ge_beam3_native_analysis import definitions from test_ge_beam3_elastic_seed_continuation import seed,model,programme diff --git a/tests/test_ge_beam3_line_fibre_modes.py b/tests/test_ge_beam3_line_fibre_modes.py index 748501bd4..a0d112061 100644 --- a/tests/test_ge_beam3_line_fibre_modes.py +++ b/tests/test_ge_beam3_line_fibre_modes.py @@ -7,11 +7,11 @@ import numpy as np import pytest -from anysolver import _ge_beam3_line_fibre_modes as native -from anysolver import _ge_beam3_fibre_line_program as control -from anysolver._ge_beam3_fibre_line_work import ReferenceLineForces -from anysolver._ge_beam3_seeded_load_program import ForceProgram -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver import _ge_beam3_line_fibre_modes as native +from anyfesolver import _ge_beam3_fibre_line_program as control +from anyfesolver._ge_beam3_fibre_line_work import ReferenceLineForces +from anyfesolver._ge_beam3_seeded_load_program import ForceProgram +from anyfesolver._ge_beam3_p5_seeded.core import canonical from docs.reference_cases import ge_beam3_curved_moment_fixture as fixture from docs.reference_cases import ge_beam3_centered_line_load_oracle as oracle from test_ge_beam3_retained_fibre_modes import dense_reference @@ -118,7 +118,7 @@ def test_accepted_plastic_history_has_distinct_frozen_and_algorithmic_policies(t @pytest.mark.parametrize('mutation',['policy','line','hash','bytes','inertia','inertia_key','coordinate','exact','retained','cancel']) def test_load_state_inertia_and_budget_guards(mutation): - from anysolver.control import CancellationToken,SolveCancelled + from anyfesolver.control import CancellationToken,SolveCancelled model,p,line,raw,inertias=case(); policy=native.FROZEN; kw={}; token=CancellationToken() if mutation=='policy': policy='AUTO' if mutation=='line': line=ReferenceLineForces(((1,.31,-.2,.1),)) @@ -137,7 +137,7 @@ def test_load_state_inertia_and_budget_guards(mutation): @pytest.mark.parametrize('mutation',['model','load','cancel']) def test_final_publication_guard_rejects_changes(mutation,monkeypatch): - from anysolver.control import CancellationToken,SolveCancelled + from anyfesolver.control import CancellationToken,SolveCancelled model,p,line,raw,inertias=case(); token=CancellationToken() def changed(*args,**kwargs): if mutation=='model': model.mesh.nodes[3].x+=.001 @@ -152,7 +152,7 @@ def changed(*args,**kwargs): def test_saved_common_rotation_covariance(tmp_path): from test_ge_beam3_fibre_line_program import model - from anysolver._ge_beam3_p5.algebra import rotation + from anyfesolver._ge_beam3_p5.algebra import rotation common=rotation([2.5,-.7,.8]); f=np.array([.03,-.02,.01]); p=ForceProgram((.5,1.),(),max_iterations=24) results=[]; folder=ROOT/'ge-beam3-native-line-20260907-065c21d/cycle-a/pytest/test_curved_load_reactions_cov0' inputs=(('E','curved.json',17169,'f8837ab5ded0d5aafe5ba1f9a1641800f84a0f2a3c5d66982c7773232ee39081',np.eye(3)), diff --git a/tests/test_ge_beam3_line_modal_comparison.py b/tests/test_ge_beam3_line_modal_comparison.py index e3085d7f3..6d9170835 100644 --- a/tests/test_ge_beam3_line_modal_comparison.py +++ b/tests/test_ge_beam3_line_modal_comparison.py @@ -60,8 +60,8 @@ def test_bounded_registered_overlap_profiles_and_no_native_imports(): with pytest.raises(ValueError): comparison.overlap_sites(1,True) tree=ast.parse(Path(comparison.__file__).read_text()) for node in ast.walk(tree): - if isinstance(node,ast.ImportFrom): assert not (node.module or '').startswith('anysolver') - if isinstance(node,ast.Import): assert not any(n.name.startswith('anysolver') for n in node.names) + if isinstance(node,ast.ImportFrom): assert not (node.module or '').startswith('anyfesolver') + if isinstance(node,ast.Import): assert not any(n.name.startswith('anyfesolver') for n in node.names) calls={ast.unparse(n.func) for n in ast.walk(tree) if isinstance(n,ast.Call)} assert not any('native.solve' in x or 'model(' in x or 'solve_modes' in x for x in calls) diff --git a/tests/test_ge_beam3_line_modal_reference.py b/tests/test_ge_beam3_line_modal_reference.py index 9419beeb7..ca53bfd22 100644 --- a/tests/test_ge_beam3_line_modal_reference.py +++ b/tests/test_ge_beam3_line_modal_reference.py @@ -73,6 +73,6 @@ def test_reference_imports_no_producer_or_native_recovery(): for node in ast.walk(tree): if isinstance(node,ast.Import): imports.extend(x.name for x in node.names) if isinstance(node,ast.ImportFrom): imports.append(node.module) - assert not any(x.startswith(('anysolver','tests')) for x in imports) + assert not any(x.startswith(('anyfesolver','tests')) for x in imports) assert set(x for x in imports if x.startswith('docs.'))=={ 'docs.reference_cases.ge_beam3_dead_line_reference','docs.reference_cases.ge_beam3_loaded_ritz_reference'} diff --git a/tests/test_ge_beam3_load_program.py b/tests/test_ge_beam3_load_program.py index f17c98e05..a2eb11b77 100644 --- a/tests/test_ge_beam3_load_program.py +++ b/tests/test_ge_beam3_load_program.py @@ -5,9 +5,9 @@ import numpy as np import pytest -import anysolver._ge_beam3_load_program as driver -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._ge_beam3_p5_loads.core import canonical, sha +import anyfesolver._ge_beam3_load_program as driver +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._ge_beam3_p5_loads.core import canonical, sha from test_ge_beam3_native_load_state import problem, store_for, equilibrium diff --git a/tests/test_ge_beam3_loaded_arch_refinement.py b/tests/test_ge_beam3_loaded_arch_refinement.py index e03d3682b..80d537bed 100644 --- a/tests/test_ge_beam3_loaded_arch_refinement.py +++ b/tests/test_ge_beam3_loaded_arch_refinement.py @@ -8,7 +8,7 @@ def test_complete_worker_wiring_without_eigensolves(tmp_path,monkeypatch): if not probe.INPUT.exists(): pytest.skip('external preserved state absent') - from anysolver import _ge_beam3_controlled_fibre_modes as spectral + from anyfesolver import _ge_beam3_controlled_fibre_modes as spectral calls=[] def fake_modes(model,program,raw,inertias,**options): assert options['coordinate_limit']==128 and options['exact_dimension_limit']==96 @@ -33,21 +33,21 @@ def fake_modes(model,program,raw,inertias,**options): def test_original_default_packet_bytes_unchanged(): if not probe.OLD.exists(): pytest.skip('external preserved state absent') from docs.reference_cases import ge_beam3_fibre_arch_refinement as family - from anysolver import _ge_beam3_controlled_fibre_modes as spectral + from anyfesolver import _ge_beam3_controlled_fibre_modes as spectral model=family.model(4); program=family.program(4); raw=probe.read(probe.OLD/'checkpoint-1.json') inertias={eid:np.diag([1.,1.,1.,.02,.01,.01]) for eid in model.mesh.elements} packet,guard,_=spectral.prepare(model,program,raw,inertias,material_policy=spectral.FROZEN, expected_checkpoint_sha256=sha256(raw).hexdigest()) guard() expected=probe.parse(probe.read(probe.OLD/'native-1.json'))['packet'] - from anysolver._ge_beam3_p5_seeded.core import canonical as native_canonical + from anyfesolver._ge_beam3_p5_seeded.core import canonical as native_canonical assert native_canonical(packet)==probe.canonical(expected) def test_six_macros_rejected_by_original_default_budget(): if not probe.INPUT.exists(): pytest.skip('external preserved state absent') from docs.reference_cases import ge_beam3_fibre_arch_refinement as family - from anysolver import _ge_beam3_controlled_fibre_modes as spectral + from anyfesolver import _ge_beam3_controlled_fibre_modes as spectral model=family.model(6); program=family.program(6) inertias={eid:np.diag([1.,1.,1.,.02,.01,.01]) for eid in model.mesh.elements} with pytest.raises(ValueError,match='small fibre spectral correctness model'): diff --git a/tests/test_ge_beam3_loaded_factor_split_probe.py b/tests/test_ge_beam3_loaded_factor_split_probe.py index 5f091bba7..c2b064e59 100644 --- a/tests/test_ge_beam3_loaded_factor_split_probe.py +++ b/tests/test_ge_beam3_loaded_factor_split_probe.py @@ -4,8 +4,8 @@ import pytest from docs.reference_cases.ge_beam3_loaded_factor_split_probe import split_accepted_elastic_operator -from anysolver._ge_beam3_loaded_modal import prepare -from anysolver._ge_beam3_p5_loads.core import canonical +from anyfesolver._ge_beam3_loaded_modal import prepare +from anyfesolver._ge_beam3_p5_loads.core import canonical from test_ge_beam3_native_load_state import problem from test_ge_beam3_loaded_modal import accepted, straight_model from test_ge_beam3_curved_p5_mass_probe import section_mass diff --git a/tests/test_ge_beam3_loaded_modal.py b/tests/test_ge_beam3_loaded_modal.py index e57bc3182..bc6431cb8 100644 --- a/tests/test_ge_beam3_loaded_modal.py +++ b/tests/test_ge_beam3_loaded_modal.py @@ -6,12 +6,12 @@ import numpy as np import pytest -from anysolver import _ge_beam3_loaded_modal as modal -from anysolver._ge_beam3_load_program import ForceProgram, solve_force_program -from anysolver._ge_beam3_p5_loads.core import canonical -from anysolver._ge_beam3_centered_mixed import CenteredStationaryBeam -from anysolver._ge_beam3_p5_centered.mass import reference_kinetic_factors -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver import _ge_beam3_loaded_modal as modal +from anyfesolver._ge_beam3_load_program import ForceProgram, solve_force_program +from anyfesolver._ge_beam3_p5_loads.core import canonical +from anyfesolver._ge_beam3_centered_mixed import CenteredStationaryBeam +from anyfesolver._ge_beam3_p5_centered.mass import reference_kinetic_factors +from anyfesolver.control import CancellationToken, SolveCancelled from docs.reference_cases import ge_beam3_centered_line_load_oracle as load_oracle from docs.reference_cases.ge_beam3_curved_p5_finite_probe import CurvedFiniteProbe from test_ge_beam3_native_load_state import problem @@ -168,10 +168,10 @@ def test_model_guard_and_pre_cancel_fail_closed(): def straight_model(): - from anysolver.fe_core import FEModel - from anysolver.boundary import BoundaryCondition - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry - from anysolver._ge_beam3_p5_loads import NativeP5BeamElement, DirectedHardeningSection + from anyfesolver.fe_core import FEModel + from anyfesolver.boundary import BoundaryCondition + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry + from anyfesolver._ge_beam3_p5_loads import NativeP5BeamElement, DirectedHardeningSection model = FEModel('loaded-straight-native') points = np.array([[-1., 0., 0.], [0., 0., 0.], [1., 0., 0.]]) for i, point in enumerate(points, 1): model.add_node(i, *point) @@ -219,9 +219,9 @@ def test_two_element_shared_traces_and_large_translation_are_preserved(tmp_path) def test_loaded_pencil_covariance_under_proper_coordinate_reexpression(): - from anysolver.fe_core import FEModel - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry - from anysolver._ge_beam3_p5_loads import NativeP5BeamElement + from anyfesolver.fe_core import FEModel + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry + from anyfesolver._ge_beam3_p5_loads import NativeP5BeamElement old = problem(); rotation = np.array([[0., -1., 0.], [1., 0., 0.], [0., 0., 1.]]) new = FEModel('rotated-loaded-native') for i, node in old.mesh.nodes.items(): new.add_node(i, *(rotation@node.coords())) diff --git a/tests/test_ge_beam3_loaded_modal_checkpoint.py b/tests/test_ge_beam3_loaded_modal_checkpoint.py index 4641193cd..f72d80265 100644 --- a/tests/test_ge_beam3_loaded_modal_checkpoint.py +++ b/tests/test_ge_beam3_loaded_modal_checkpoint.py @@ -55,7 +55,7 @@ def test_two_fresh_diagnostics_match_and_archive_extent_is_exact(): assert left['bytes'] == right['bytes'] and left['sha256'] == right['sha256'] -@pytest.mark.parametrize('path', ['src/anysolver/_ge_beam3_loaded_modal.py', 'tests/test_ge_beam3_loaded_modal.py']) +@pytest.mark.parametrize('path', ['src/anyfesolver/_ge_beam3_loaded_modal.py', 'tests/test_ge_beam3_loaded_modal.py']) def test_mutated_adapter_or_test_is_rejected(monkeypatch, path): original = source monkeypatch.setattr(__import__(__name__), 'source', diff --git a/tests/test_ge_beam3_loaded_six_saved.py b/tests/test_ge_beam3_loaded_six_saved.py index d953f9e78..7895f9e65 100644 --- a/tests/test_ge_beam3_loaded_six_saved.py +++ b/tests/test_ge_beam3_loaded_six_saved.py @@ -37,7 +37,7 @@ def test_refinement_and_signed_stability_not_qualification(saved): def test_original_factor_ritz_identity_and_state_policy(saved): - from anysolver._dyadic_factor_chain import reassemble_chain_exact_binary64 + from anyfesolver._dyadic_factor_chain import reassemble_chain_exact_binary64 for cursor in (1,4): value=probe.parse(probe.read(OUTPUT/f'native-{cursor}.json')); p=value['packet']; modes=value['modes'] assert p['material_policy']==modes['material_policy']=='FROZEN_PLASTIC_COORDINATES_ELASTIC_PERTURBATION' diff --git a/tests/test_ge_beam3_loaded_twelve_preparation.py b/tests/test_ge_beam3_loaded_twelve_preparation.py index 59e27318a..ccff129e1 100644 --- a/tests/test_ge_beam3_loaded_twelve_preparation.py +++ b/tests/test_ge_beam3_loaded_twelve_preparation.py @@ -25,7 +25,7 @@ def test_twelve_inputs_bind_preserved_chain_and_same_continuum(): def test_complete_twelve_worker_wiring_without_eigensolves(tmp_path,monkeypatch): config=probe.configuration(12) if not config['input'].exists(): pytest.skip('external preserved twelve-macro state absent') - from anysolver import _ge_beam3_controlled_fibre_modes as spectral + from anyfesolver import _ge_beam3_controlled_fibre_modes as spectral calls=[] def fake_modes(model,program,raw,inertias,**options): assert options['coordinate_limit']==256 and options['exact_dimension_limit']==160 and options['max_coordinates']==512 @@ -51,7 +51,7 @@ def test_twelve_saved_replay_rejects_default_retained_budget(): config=probe.configuration(12) if not config['input'].exists(): pytest.skip('external preserved twelve-macro state absent') from docs.reference_cases import ge_beam3_fibre_arch_refinement as family - from anysolver import _ge_beam3_controlled_fibre_modes as spectral + from anyfesolver import _ge_beam3_controlled_fibre_modes as spectral model=family.model(12); program=family.program(12) inertias={eid:np.diag([1.,1.,1.,.02,.01,.01]) for eid in model.mesh.elements} with pytest.raises(ValueError,match='bounded standalone retained fibre model'): diff --git a/tests/test_ge_beam3_loaded_twelve_saved.py b/tests/test_ge_beam3_loaded_twelve_saved.py index fed04d8ce..053969fda 100644 --- a/tests/test_ge_beam3_loaded_twelve_saved.py +++ b/tests/test_ge_beam3_loaded_twelve_saved.py @@ -37,7 +37,7 @@ def test_observed_refinement_and_signs_not_full_qualification(saved): def test_saved_original_factor_ritz_and_zero_inertia_traces(saved): - from anysolver._dyadic_factor_chain import reassemble_chain_exact_binary64 + from anyfesolver._dyadic_factor_chain import reassemble_chain_exact_binary64 for cursor in (1,4): value=probe.parse(probe.read(OUTPUT/f'native-{cursor}.json')); p=value['packet']; modes=value['modes'] assert p['identity']==modes['operator_identity'] diff --git a/tests/test_ge_beam3_local_force_linear_audit.py b/tests/test_ge_beam3_local_force_linear_audit.py index b756e9331..c8c99ce54 100644 --- a/tests/test_ge_beam3_local_force_linear_audit.py +++ b/tests/test_ge_beam3_local_force_linear_audit.py @@ -6,7 +6,7 @@ import numpy as np import pytest from docs.reference_cases.ge_beam3_decimal_linear_audit import solve_linear -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_p5_seeded.core import canonical def test_decimal_pivoting_keeps_weak_rhs_and_indefinite_blocks(): diff --git a/tests/test_ge_beam3_mixed_ad_scalars.py b/tests/test_ge_beam3_mixed_ad_scalars.py index db8fe9dfd..967af20f1 100644 --- a/tests/test_ge_beam3_mixed_ad_scalars.py +++ b/tests/test_ge_beam3_mixed_ad_scalars.py @@ -4,7 +4,7 @@ import numpy as np import pytest -from anysolver._ge_beam3_mixed_ad import Jet2 +from anyfesolver._ge_beam3_mixed_ad import Jet2 def _generic_product(left, right): diff --git a/tests/test_ge_beam3_mixed_authority_runner.py b/tests/test_ge_beam3_mixed_authority_runner.py index 31c0cc0f6..113862460 100644 --- a/tests/test_ge_beam3_mixed_authority_runner.py +++ b/tests/test_ge_beam3_mixed_authority_runner.py @@ -112,7 +112,7 @@ def test_modified_current_protected_file_blocks_boundary(monkeypatch) -> None: monkeypatch.setattr( runner, "_working_tree_blob", - lambda path: "0" * 40 if path == "src/anysolver/elements.py" else real_blob(path), + lambda path: "0" * 40 if path == "src/anyfesolver/elements.py" else real_blob(path), ) monkeypatch.setattr( runner, @@ -132,7 +132,7 @@ def test_modified_current_protected_file_blocks_boundary(monkeypatch) -> None: assert record["terminal"] == "BLOCKED_GE_BEAM3_MIXED_BASELINE_OR_AUTHORITY" assert record["current_boundary_checks"]["all_protected_current_blobs_equal_base"] is False - assert record["current_protected_blob_checks"]["src/anysolver/elements.py"] is False + assert record["current_protected_blob_checks"]["src/anyfesolver/elements.py"] is False def _mutated_record( @@ -335,7 +335,7 @@ def test_runner_import_boundary_is_authority_only() -> None: imports.add(node.module.split(".")[0]) imported_modules.add(node.module) - assert imports.isdisjoint({"anysolver", "numpy", "scipy", "sympy", "mpmath"}) + assert imports.isdisjoint({"anyfesolver", "numpy", "scipy", "sympy", "mpmath"}) assert "ge_beam3_mixed_element" not in imported_modules assert "ge_beam3_mixed_finite_producer" not in imported_modules assert "ge_beam3_mixed_finite_checker" not in imported_modules diff --git a/tests/test_ge_beam3_mixed_core.py b/tests/test_ge_beam3_mixed_core.py index c6e4006a6..186ba6746 100644 --- a/tests/test_ge_beam3_mixed_core.py +++ b/tests/test_ge_beam3_mixed_core.py @@ -3,10 +3,10 @@ import numpy as np import pytest -from anysolver.beam_sections import GeneralizedBeamSection -from anysolver.elements import Element, QuadraticBeamElement -from anysolver.fe_core import FEModel -from anysolver.ge_beam3_mixed_element import ( +from anyfesolver.beam_sections import GeneralizedBeamSection +from anyfesolver.elements import Element, QuadraticBeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.ge_beam3_mixed_element import ( GE_BEAM3_MIXED_CANDIDATE_ID, GE_BEAM3_MIXED_FORMULATION_ID, GeBeam3MixedStateError, @@ -77,7 +77,7 @@ def test_reference_tangent_has_rank_twelve_and_six_rigid_modes() -> None: def test_common_finite_rigid_motion_has_zero_energy_and_force() -> None: model, element = _model() vector = np.array((0.37, -0.21, 0.19)) - from anysolver._ge_beam3_mixed_ad import rotation_exponential + from anyfesolver._ge_beam3_mixed_ad import rotation_exponential rotation = rotation_exponential(vector) translation = np.array((0.8, -0.4, 0.6)) @@ -106,7 +106,7 @@ def test_reversal_preserves_coupled_section_energy_force_and_tangent() -> None: 0.05, 0.04, 0.03, -0.01, 0.06, 0.04, ) ) - from anysolver._ge_beam3_mixed_ad import rotation_exponential + from anyfesolver._ge_beam3_mixed_ad import rotation_exponential forward_frame = forward.reference_triad(forward_model.mesh) forward_nodal = values.reshape(3, 6) @@ -147,7 +147,7 @@ def test_condensed_tangent_agrees_with_directional_energy_second_variation() -> ) direction = np.linspace(-0.7, 0.8, 18) direction /= np.linalg.norm(direction) - from anysolver._ge_beam3_mixed_ad import rotation_exponential + from anyfesolver._ge_beam3_mixed_ad import rotation_exponential nodal = values.reshape(3, 6) base_rotations = np.asarray([rotation_exponential(row[3:]) for row in nodal]) @@ -206,7 +206,7 @@ def test_reversal_sensitive_section_requires_physical_axis_authority() -> None: model.add_material("mat", 1.0, 0.25) for node, x in enumerate((0.0, 0.5, 1.0), start=1): model.add_node(node, x, 0.0, 0.0) - from anysolver.ge_beam3_mixed_element import GeBeam3MixedGeometryError + from anyfesolver.ge_beam3_mixed_element import GeBeam3MixedGeometryError with pytest.raises(GeBeam3MixedGeometryError, match="reference_axis_direction"): GeometricallyExactBeam3D3NElement( @@ -219,7 +219,7 @@ def test_reversal_sensitive_section_requires_physical_axis_authority() -> None: def test_cell_vertex_logarithm_uses_frozen_cutback_domain() -> None: - from anysolver._ge_beam3_mixed_ad import ( + from anyfesolver._ge_beam3_mixed_ad import ( Jet2, RotationDomainError, constant_matrix, diff --git a/tests/test_ge_beam3_mixed_exact_reference.py b/tests/test_ge_beam3_mixed_exact_reference.py index b56dd3fa1..b232bffc4 100644 --- a/tests/test_ge_beam3_mixed_exact_reference.py +++ b/tests/test_ge_beam3_mixed_exact_reference.py @@ -90,7 +90,7 @@ def test_reference_builder_has_no_production_or_symbolic_import() -> None: imported.update(alias.name.split(".")[0] for alias in node.names) elif isinstance(node, ast.ImportFrom) and node.module: imported.add(node.module.split(".")[0]) - assert imported.isdisjoint({"anysolver", "numpy", "scipy", "sympy", "mpmath"}) + assert imported.isdisjoint({"anyfesolver", "numpy", "scipy", "sympy", "mpmath"}) def test_preregistration_records_are_strict_json_and_preserve_v1() -> None: diff --git a/tests/test_ge_beam3_mixed_finite_gate.py b/tests/test_ge_beam3_mixed_finite_gate.py index 27f49ba68..bc8f1afe1 100644 --- a/tests/test_ge_beam3_mixed_finite_gate.py +++ b/tests/test_ge_beam3_mixed_finite_gate.py @@ -364,7 +364,7 @@ def test_checker_import_boundary_is_independent() -> None: imported.update(alias.name.split(".")[0] for alias in node.names) elif isinstance(node, ast.ImportFrom) and node.module: imported.add(node.module.split(".")[0]) - assert imported.isdisjoint({"anysolver", "sympy", "mpmath"}) + assert imported.isdisjoint({"anyfesolver", "sympy", "mpmath"}) text = CHECKER.read_text(encoding="utf-8") - assert "from anysolver" not in text - assert "import anysolver" not in text + assert "from anyfesolver" not in text + assert "import anyfesolver" not in text diff --git a/tests/test_ge_beam3_mixed_formal_closeout.py b/tests/test_ge_beam3_mixed_formal_closeout.py index 85a2e3bec..481cef4cf 100644 --- a/tests/test_ge_beam3_mixed_formal_closeout.py +++ b/tests/test_ge_beam3_mixed_formal_closeout.py @@ -336,8 +336,8 @@ def test_scope_and_production_boundary_remain_fail_closed() -> None: ) for route in ( - "src/anysolver/__init__.py", - "src/anysolver/elements.py", + "src/anyfesolver/__init__.py", + "src/anyfesolver/elements.py", ): text = _accepted_route_text(route) assert "GeometricallyExactBeam3D3NElement" not in text diff --git a/tests/test_ge_beam3_mixed_formal_runner.py b/tests/test_ge_beam3_mixed_formal_runner.py index 9c7d9cb00..268e4b566 100644 --- a/tests/test_ge_beam3_mixed_formal_runner.py +++ b/tests/test_ge_beam3_mixed_formal_runner.py @@ -70,12 +70,12 @@ def _fake_producer_source() -> str: from pathlib import Path root=Path(__file__).resolve().parents[2] sys.path.insert(0,str(root/'src')) -import anysolver +import anyfesolver import numpy p=argparse.ArgumentParser();p.add_argument('--output',type=Path,required=True);a=p.parse_args() started=time.monotonic_ns();time.sleep(0.12);ended=time.monotonic_ns() (a.output.parent/'producer-timing.json').write_text(json.dumps({'start':started,'end':ended}),encoding='utf-8') -payload={'anysolver_value':anysolver.VALUE,'schema':'fake-proof-v1','threads':{key:os.environ.get(key) for key in ('OMP_NUM_THREADS','OPENBLAS_NUM_THREADS','MKL_NUM_THREADS','NUMEXPR_NUM_THREADS')}} +payload={'anyfesolver_value':anyfesolver.VALUE,'schema':'fake-proof-v1','threads':{key:os.environ.get(key) for key in ('OMP_NUM_THREADS','OPENBLAS_NUM_THREADS','MKL_NUM_THREADS','NUMEXPR_NUM_THREADS')}} with a.output.open('xb') as stream:stream.write((json.dumps(payload,allow_nan=False,ensure_ascii=True,separators=(',',':'),sort_keys=True)+'\\n').encode('ascii')) """ @@ -92,7 +92,7 @@ def _fake_checker_source() -> str: metric_keys={sorted(template.CASE_METRIC_KEYS)!r} predicate_keys={sorted(template.CASE_EVIDENCE_PREDICATES | template.CASE_SCIENTIFIC_PREDICATES)!r} coverage_keys={sorted(template.COVERAGE_EVIDENCE_PREDICATES | template.COVERAGE_SCIENTIFIC_PREDICATES)!r} -payload={{'authority_bindings':{{key:True for key in {sorted(template.CHECK_BINDING_KEYS)!r}}},'candidate_id':{template.CANDIDATE_ID!r},'cases':[{{'case_id':case_id,'metrics':{{key:'0' for key in metric_keys}},'predicates':{{key:True for key in predicate_keys}},'registered_input_sha256':'A'*64}} for case_id in case_ids],'checker_import_boundary':{{'anysolver':False,'legacy_beam':False,'production_ad':False,'v1_beam':False}},'coverage':{{key:True for key in coverage_keys}},'reversal':{{'energy':True,'residual':True,'tangent':True}},'schema':{template.CHECK_SCHEMA!r},'terminal':'NONCLASSIFYING_FINITE_GATE_PASS'}} +payload={{'authority_bindings':{{key:True for key in {sorted(template.CHECK_BINDING_KEYS)!r}}},'candidate_id':{template.CANDIDATE_ID!r},'cases':[{{'case_id':case_id,'metrics':{{key:'0' for key in metric_keys}},'predicates':{{key:True for key in predicate_keys}},'registered_input_sha256':'A'*64}} for case_id in case_ids],'checker_import_boundary':{{'anyfesolver':False,'legacy_beam':False,'production_ad':False,'v1_beam':False}},'coverage':{{key:True for key in coverage_keys}},'reversal':{{'energy':True,'residual':True,'tangent':True}},'schema':{template.CHECK_SCHEMA!r},'terminal':'NONCLASSIFYING_FINITE_GATE_PASS'}} with a.output.open('xb') as stream:stream.write((json.dumps(payload,allow_nan=False,ensure_ascii=True,separators=(',',':'),sort_keys=True)+'\\n').encode('ascii')) """ @@ -118,13 +118,13 @@ def _make_harness(tmp_path: Path) -> Harness: _git(repository, "config", "user.name", "Formal Runner Test") _git(repository, "config", "user.email", "formal-runner@example.invalid") _git(repository, "config", "core.autocrlf", "false") - _write(repository / "src/anysolver/__init__.py", 'VALUE="materialized-candidate"\n') + _write(repository / "src/anyfesolver/__init__.py", 'VALUE="materialized-candidate"\n') _write(repository / ".gitattributes", "explicit-crlf.txt text eol=crlf\n") _write(repository / "explicit-crlf.txt", "first\nsecond\n") _git( repository, "add", - "src/anysolver/__init__.py", + "src/anyfesolver/__init__.py", ".gitattributes", "explicit-crlf.txt", ) @@ -432,7 +432,7 @@ def _check_record(runner, *, scientific_pass: bool = True) -> dict[str, object]: for case_id in runner.CASE_ORDER ], "checker_import_boundary": { - "anysolver": False, + "anyfesolver": False, "legacy_beam": False, "production_ad": False, "v1_beam": False, @@ -497,12 +497,12 @@ def test_authenticated_rehearsal_is_isolated_overlapping_and_one_time( checker_origin = json.loads( (work / "cycle-1/checker/checker-origin.json").read_text(encoding="utf-8") ) - assert producer_origin["anysolver_origins"] + assert producer_origin["anyfesolver_origins"] assert all( "materialized-harness" in path - for path in producer_origin["anysolver_origins"] + for path in producer_origin["anyfesolver_origins"] ) - assert checker_origin["anysolver_origins"] == [] + assert checker_origin["anyfesolver_origins"] == [] assert producer_origin["isolated"] is checker_origin["isolated"] is True # Publication recovery is idempotent and does not execute or consume the @@ -1000,8 +1000,8 @@ def test_runner_import_boundary_is_standard_library_only() -> None: } text = RUNNER_PATH.read_text(encoding="utf-8") assert "import numpy" not in text - assert "import anysolver" not in text - assert "from anysolver" not in text + assert "import anyfesolver" not in text + assert "from anyfesolver" not in text assert "ge_beam3_mixed_finite_producer import" not in text assert "ge_beam3_mixed_finite_checker import" not in text diff --git a/tests/test_ge_beam3_mixed_independent_checker.py b/tests/test_ge_beam3_mixed_independent_checker.py index 5a9769f27..88fc9c202 100644 --- a/tests/test_ge_beam3_mixed_independent_checker.py +++ b/tests/test_ge_beam3_mixed_independent_checker.py @@ -153,7 +153,7 @@ def test_checker_has_no_production_or_peer_builder_imports() -> None: elif isinstance(node, ast.ImportFrom) and node.module: imports.add(node.module.split(".")[0]) - assert imports.isdisjoint({"anysolver", "numpy", "scipy", "sympy"}) + assert imports.isdisjoint({"anyfesolver", "numpy", "scipy", "sympy"}) assert "ge_beam3_mixed_reference" not in source assert "QuadraticBeamElement" not in source assert "BeamElement" not in source diff --git a/tests/test_ge_beam3_mixed_p2_formal_checker.py b/tests/test_ge_beam3_mixed_p2_formal_checker.py index edb1ab2d5..3f60f1b83 100644 --- a/tests/test_ge_beam3_mixed_p2_formal_checker.py +++ b/tests/test_ge_beam3_mixed_p2_formal_checker.py @@ -153,7 +153,7 @@ def test_checker_import_boundary_excludes_production_and_legacy_mechanics() -> N "pathlib", "typing", } - assert "anysolver" not in imports + assert "anyfesolver" not in imports def test_checker_cli_writes_malformed_record_and_uses_exclusive_output( diff --git a/tests/test_ge_beam3_mixed_p2_formal_closeout.py b/tests/test_ge_beam3_mixed_p2_formal_closeout.py index 5d48e27d6..0d9cb8268 100644 --- a/tests/test_ge_beam3_mixed_p2_formal_closeout.py +++ b/tests/test_ge_beam3_mixed_p2_formal_closeout.py @@ -389,8 +389,8 @@ def test_scope_and_production_boundary_remain_private_and_fail_closed() -> None: "PROVISIONAL_GO_GE_BEAM3_MIXED_STRAIGHT_STATIC_CORE" ) for route in ( - "src/anysolver/__init__.py", - "src/anysolver/elements.py", + "src/anyfesolver/__init__.py", + "src/anyfesolver/elements.py", ): text = _accepted_route_text(route) assert "GeometricallyExactBeam3D3NElement" not in text diff --git a/tests/test_ge_beam3_mixed_p2_formal_runner.py b/tests/test_ge_beam3_mixed_p2_formal_runner.py index 5bc553b5a..fa5e5ef4e 100644 --- a/tests/test_ge_beam3_mixed_p2_formal_runner.py +++ b/tests/test_ge_beam3_mixed_p2_formal_runner.py @@ -701,7 +701,7 @@ def test_execution_review_and_authority_bind_runtime_registry_command_and_one_ti def test_exact_one_parent_two_path_git_authorization_overlay(tmp_path: Path) -> None: repository, harness_commit, harness_tree = _init_repository( - tmp_path / "ANYsolver", {runner.RUNNER_RELATIVE: RUNNER.read_bytes()} + tmp_path / "ANYfeSolver", {runner.RUNNER_RELATIVE: RUNNER.read_bytes()} ) registry_root, registry_identity = _registry(tmp_path) snapshot = _snapshot( @@ -895,8 +895,8 @@ def test_closed_world_materialization_and_isolated_bound_dependency_import( ) -> None: script = b"import json,os,pathlib,sys\nimport anyfileio\nout=pathlib.Path(sys.argv[1])\nr={'origin':str(pathlib.Path(anyfileio.__file__).resolve()),'plugin':os.environ.get('PYTEST_DISABLE_PLUGIN_AUTOLOAD'),'value':anyfileio.VALUE}\nout.write_text(json.dumps(r,sort_keys=True,separators=(',',':'))+'\\n',encoding='utf-8')\n" solver, commit, tree = _init_repository( - tmp_path / "ANYsolver", - {"tool.py": script, "src/anysolver/__init__.py": b"VALUE = 'solver'\n"}, + tmp_path / "ANYfeSolver", + {"tool.py": script, "src/anyfesolver/__init__.py": b"VALUE = 'solver'\n"}, ) dependency = _dependency_repository(tmp_path) dep_identity = runner.validate_anyfileio_repository(dependency) @@ -1016,7 +1016,7 @@ def test_actual_lane_import_closure_is_bound_and_runtime_mutation_refuses( def test_prelaunch_materialization_mutation_fails_closed(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None: made = runner.MaterializedExecution( anyfileio=tmp_path / "ANYfileIO", manifest_path=tmp_path / "materialization.json", - manifest_sha256="A" * 64, root=tmp_path / "materialized", solver=tmp_path / "ANYsolver", + manifest_sha256="A" * 64, root=tmp_path / "materialized", solver=tmp_path / "ANYfeSolver", ) monkeypatch.setattr( runner, "validate_materialization", @@ -1103,7 +1103,7 @@ def inspect_value(value: object) -> None: def test_child_environment_is_closed_and_forces_one_numerical_thread(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None: - repository, dependency = tmp_path / "ANYsolver", tmp_path / "ANYfileIO" + repository, dependency = tmp_path / "ANYfeSolver", tmp_path / "ANYfileIO" repository.mkdir(); dependency.mkdir() monkeypatch.setenv("PYTHONPATH", "UNBOUND_SENTINEL") monkeypatch.setenv("PYTEST_ADDOPTS", "--unbound") @@ -1132,6 +1132,6 @@ def test_runner_does_not_author_or_expose_public_integration() -> None: source = RUNNER.read_text(encoding="utf-8") assert "--emit-authority" not in source and "--create-authority" not in source assert "cycle_runner=" not in source - assert "src/anysolver/__init__.py" not in runner.HARNESS_PATHS + assert "src/anyfesolver/__init__.py" not in runner.HARNESS_PATHS assert "PROVISIONAL_GO_GE_BEAM3_P2_PRIVATE_PARITY" in source assert "PROVISIONAL_GO_GE_BEAM3_STRAIGHT_STANDALONE_OPT_IN" not in source diff --git a/tests/test_ge_beam3_mixed_p2_load_mass_recovery.py b/tests/test_ge_beam3_mixed_p2_load_mass_recovery.py index a1fbddc7c..20932c05b 100644 --- a/tests/test_ge_beam3_mixed_p2_load_mass_recovery.py +++ b/tests/test_ge_beam3_mixed_p2_load_mass_recovery.py @@ -8,10 +8,10 @@ import numpy as np import pytest -from anysolver.beam_sections import GeneralizedBeamSection -from anysolver._ge_beam3_mixed_ad import rotation_exponential -from anysolver.fe_core import FEModel -from anysolver.ge_beam3_mixed_element import ( +from anyfesolver.beam_sections import GeneralizedBeamSection +from anyfesolver._ge_beam3_mixed_ad import rotation_exponential +from anyfesolver.fe_core import FEModel +from anyfesolver.ge_beam3_mixed_element import ( GE_BEAM3_MIXED_CANDIDATE_ID, GeBeam3MixedGeometryError, GeBeam3MixedStateError, diff --git a/tests/test_ge_beam3_mixed_p2_modal_buckling.py b/tests/test_ge_beam3_mixed_p2_modal_buckling.py index c46d38819..72543b36f 100644 --- a/tests/test_ge_beam3_mixed_p2_modal_buckling.py +++ b/tests/test_ge_beam3_mixed_p2_modal_buckling.py @@ -8,9 +8,9 @@ import pytest from scipy.linalg import eig, eigh -from anysolver.beam_sections import GeneralizedBeamSection -from anysolver.fe_core import FEModel -from anysolver.ge_beam3_mixed_element import ( +from anyfesolver.beam_sections import GeneralizedBeamSection +from anyfesolver.fe_core import FEModel +from anyfesolver.ge_beam3_mixed_element import ( GeBeam3MixedStateError, GeometricallyExactBeam3D3NElement, ) diff --git a/tests/test_ge_beam3_mixed_p2_preregistration.py b/tests/test_ge_beam3_mixed_p2_preregistration.py index 7d7dd7816..1621ba0fc 100644 --- a/tests/test_ge_beam3_mixed_p2_preregistration.py +++ b/tests/test_ge_beam3_mixed_p2_preregistration.py @@ -272,8 +272,8 @@ def test_execution_bounds_and_production_boundary_are_exact() -> None: "qualified_s3_v2d_unchanged": True, } for route in ( - "src/anysolver/__init__.py", - "src/anysolver/elements.py", + "src/anyfesolver/__init__.py", + "src/anyfesolver/elements.py", ): text = _accepted_route_text(route) assert "GeometricallyExactBeam3D3NElement" not in text diff --git a/tests/test_ge_beam3_mixed_p2_recovery_correction.py b/tests/test_ge_beam3_mixed_p2_recovery_correction.py index dd2f9e7e4..545723a4e 100644 --- a/tests/test_ge_beam3_mixed_p2_recovery_correction.py +++ b/tests/test_ge_beam3_mixed_p2_recovery_correction.py @@ -95,7 +95,7 @@ def test_independent_rational_stationarity_checker_passes() -> None: assert result["status"] == "PASS" assert len(result["content_sha256"]) == 64 source = CHECKER.read_text(encoding="utf-8") - for forbidden in ("anysolver", "numpy", "scipy", "sympy", "ge_beam3_mixed_element"): + for forbidden in ("anyfesolver", "numpy", "scipy", "sympy", "ge_beam3_mixed_element"): assert f"import {forbidden}" not in source assert f"from {forbidden}" not in source diff --git a/tests/test_ge_beam3_mixed_p2_solver_chart.py b/tests/test_ge_beam3_mixed_p2_solver_chart.py index 21d0f7e3a..342df2e44 100644 --- a/tests/test_ge_beam3_mixed_p2_solver_chart.py +++ b/tests/test_ge_beam3_mixed_p2_solver_chart.py @@ -11,19 +11,19 @@ import numpy as np import pytest -from anysolver._ge_beam3_mixed_ad import RotationDomainError -from anysolver._native_rotation_state import ( +from anyfesolver._ge_beam3_mixed_ad import RotationDomainError +from anyfesolver._native_rotation_state import ( NativeRotationStateStore, create_native_rotation_state_store, rotation_exponential, ) -from anysolver.beam_sections import GeneralizedBeamSection -from anysolver.fe_core import FEModel -from anysolver.ge_beam3_mixed_element import ( +from anyfesolver.beam_sections import GeneralizedBeamSection +from anyfesolver.fe_core import FEModel +from anyfesolver.ge_beam3_mixed_element import ( GeBeam3MixedLocalSolveError, GeometricallyExactBeam3D3NElement, ) -from anysolver.ge_beam3_mixed_state import ( +from anyfesolver.ge_beam3_mixed_state import ( GeBeam3MixedCommittedStateError, deserialize_ge_beam3_mixed_state, seal_committed_ge_beam3_mixed_state, diff --git a/tests/test_ge_beam3_mixed_p2_state_restart.py b/tests/test_ge_beam3_mixed_p2_state_restart.py index 56923e9f4..74ee844c5 100644 --- a/tests/test_ge_beam3_mixed_p2_state_restart.py +++ b/tests/test_ge_beam3_mixed_p2_state_restart.py @@ -9,10 +9,10 @@ import numpy as np import pytest -from anysolver.beam_sections import GeneralizedBeamSection -from anysolver.fe_core import FEModel -from anysolver.ge_beam3_mixed_element import GeometricallyExactBeam3D3NElement -from anysolver.ge_beam3_mixed_state import ( +from anyfesolver.beam_sections import GeneralizedBeamSection +from anyfesolver.fe_core import FEModel +from anyfesolver.ge_beam3_mixed_element import GeometricallyExactBeam3D3NElement +from anyfesolver.ge_beam3_mixed_state import ( GE_BEAM3_MIXED_CANDIDATE_ID, SECTION_SCHEMA, STATE_INTEGRITY_ID, diff --git a/tests/test_ge_beam3_mixed_p3_optin.py b/tests/test_ge_beam3_mixed_p3_optin.py index 038b82238..70b3eff3f 100644 --- a/tests/test_ge_beam3_mixed_p3_optin.py +++ b/tests/test_ge_beam3_mixed_p3_optin.py @@ -11,33 +11,33 @@ import numpy as np import pytest -import anysolver -from anysolver._native_rotation_state import create_native_rotation_state_store -from anysolver.assembly import solve_linear -from anysolver.beam_sections import GeneralizedBeamSection -from anysolver.boundary import BoundaryCondition, LoadCase -from anysolver.elements import ( +import anyfesolver +from anyfesolver._native_rotation_state import create_native_rotation_state_store +from anyfesolver.assembly import solve_linear +from anyfesolver.beam_sections import GeneralizedBeamSection +from anyfesolver.boundary import BoundaryCondition, LoadCase +from anyfesolver.elements import ( ELEMENT_TYPES, CoupledBeamShellElement, QuadraticBeamElement, create_element, ) -from anysolver.fe_core import FEModel -from anysolver.ge_beam3_element import ( +from anyfesolver.fe_core import FEModel +from anyfesolver.ge_beam3_element import ( GE_BEAM3_QUALIFIED_FORMULATION_ID, GeBeam3IntegrationError, GeometricallyExactBeam3D3NElement, deserialize_ge_beam3_element, serialize_ge_beam3_element, ) -from anysolver.ge_beam3_mixed_element import ( +from anyfesolver.ge_beam3_mixed_element import ( GeBeam3MixedStateError, GeometricallyExactBeam3D3NElement as CandidateGeBeam3, ) -from anysolver.ge_beam3_mixed_state import ( +from anyfesolver.ge_beam3_mixed_state import ( serialize_ge_beam3_mixed_state, ) -from anysolver.ge_beam3_state import ( +from anyfesolver.ge_beam3_state import ( STATE_LAYOUT_ID, STATE_SCHEMA, STATE_VERSION, @@ -45,11 +45,11 @@ deserialize_ge_beam3_state, serialize_ge_beam3_state, ) -from anysolver.matrix_assembly import assemble_stiffness_matrix -from anysolver.modal import solve_free_vibration -from anysolver.mesh_gen import InterpolatedBeamShellMPCElement -from anysolver.nonlinear_state import create_model_native_rotation_store -from anysolver.nonlinear_static import solve_static_nonlinear +from anyfesolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.modal import solve_free_vibration +from anyfesolver.mesh_gen import InterpolatedBeamShellMPCElement +from anyfesolver.nonlinear_state import create_model_native_rotation_store +from anyfesolver.nonlinear_static import solve_static_nonlinear ROOT = Path(__file__).resolve().parents[1] @@ -114,13 +114,13 @@ def test_exact_selector_and_public_exports_are_additive() -> None: selected = _element(via_factory=True) assert type(selected) is GeometricallyExactBeam3D3NElement assert selected.formulation_id == GE_BEAM3_QUALIFIED_FORMULATION_ID - assert anysolver.GeometricallyExactBeam3D3NElement is GeometricallyExactBeam3D3NElement + assert anyfesolver.GeometricallyExactBeam3D3NElement is GeometricallyExactBeam3D3NElement assert ( - anysolver.GE_BEAM3_QUALIFIED_FORMULATION_ID + anyfesolver.GE_BEAM3_QUALIFIED_FORMULATION_ID == GE_BEAM3_QUALIFIED_FORMULATION_ID ) - assert "GE_BEAM3_QUALIFIED_FORMULATION_ID" in anysolver.__all__ - assert "GeometricallyExactBeam3D3NElement" in anysolver.__all__ + assert "GE_BEAM3_QUALIFIED_FORMULATION_ID" in anyfesolver.__all__ + assert "GeometricallyExactBeam3D3NElement" in anyfesolver.__all__ assert "ge-beam3" not in ELEMENT_TYPES assert QuadraticBeamElement not in GeometricallyExactBeam3D3NElement.__mro__ @@ -563,10 +563,10 @@ def test_frozen_mechanics_defaults_and_package_metadata_are_unchanged() -> None: for record in baseline["production_snapshot"] if record["path"] in { - "src/anysolver/e4_pl_element.py", - "src/anysolver/e4_pl_s3_v2d_element.py", - "src/anysolver/ge_beam3_mixed_element.py", - "src/anysolver/ge_beam3_mixed_state.py", + "src/anyfesolver/e4_pl_element.py", + "src/anyfesolver/e4_pl_s3_v2d_element.py", + "src/anyfesolver/ge_beam3_mixed_element.py", + "src/anyfesolver/ge_beam3_mixed_state.py", "pyproject.toml", } } diff --git a/tests/test_ge_beam3_mixed_p3_package.py b/tests/test_ge_beam3_mixed_p3_package.py index 471a4f5af..a845a24de 100644 --- a/tests/test_ge_beam3_mixed_p3_package.py +++ b/tests/test_ge_beam3_mixed_p3_package.py @@ -35,7 +35,7 @@ def _valid_installed_record(*, replacement_hash: str | None = None) -> dict[str, "checks": {name: True for name in GATE.INSTALLED_CHECK_KEYS}, "element_record_sha256": digest, "formulation_id": GATE.QUALIFIED_ID, - "loaded_anysolver_module_count": 7, + "loaded_anyfesolver_module_count": 7, "schema": GATE.CHECK_SCHEMA, "selector": GATE.SELECTOR, "state_layout_id": GATE.STATE_LAYOUT_ID, diff --git a/tests/test_ge_beam3_mixed_p3_preregistration.py b/tests/test_ge_beam3_mixed_p3_preregistration.py index 4a8580698..d651eb892 100644 --- a/tests/test_ge_beam3_mixed_p3_preregistration.py +++ b/tests/test_ge_beam3_mixed_p3_preregistration.py @@ -293,8 +293,8 @@ def test_cases_package_performance_and_terminal_precedence_are_complete() -> Non def test_base_has_no_public_ge_beam3_selector_or_export() -> None: - elements = _git_blob(BASE_COMMIT, "src/anysolver/elements.py").decode("utf-8") - package = _git_blob(BASE_COMMIT, "src/anysolver/__init__.py").decode("utf-8") + elements = _git_blob(BASE_COMMIT, "src/anyfesolver/elements.py").decode("utf-8") + package = _git_blob(BASE_COMMIT, "src/anyfesolver/__init__.py").decode("utf-8") assert '"ge-beam3"' not in elements assert "GeometricallyExactBeam3D3NElement" not in package assert "GE_BEAM3_QUALIFIED_FORMULATION_ID" not in package diff --git a/tests/test_ge_beam3_modal_work_diagnostic.py b/tests/test_ge_beam3_modal_work_diagnostic.py index d5bcec9c3..09c12e685 100644 --- a/tests/test_ge_beam3_modal_work_diagnostic.py +++ b/tests/test_ge_beam3_modal_work_diagnostic.py @@ -44,6 +44,6 @@ def test_saved_input_and_no_solver_calls(): for name in ('ge_beam3_modal_work_diagnostic.py','ge_beam3_modal_work_worker.py'): tree=ast.parse((root/name).read_text()) imports=[n.module or '' for n in ast.walk(tree) if isinstance(n,ast.ImportFrom)] - assert not any(x.startswith('anysolver') for x in imports) + assert not any(x.startswith('anyfesolver') for x in imports) calls=[n.func.attr for n in ast.walk(tree) if isinstance(n,ast.Call) and isinstance(n.func,ast.Attribute)] assert not set(calls)&{'eigh','eig','solve_bvp','prepare'} diff --git a/tests/test_ge_beam3_moment_recovery_audit.py b/tests/test_ge_beam3_moment_recovery_audit.py index 45ef6e91c..548c2094a 100644 --- a/tests/test_ge_beam3_moment_recovery_audit.py +++ b/tests/test_ge_beam3_moment_recovery_audit.py @@ -38,7 +38,7 @@ def test_improper_or_outside_chart_rotation_rejects(matrix): def test_audit_imports_no_mechanics_or_reference_solver(): tree=ast.parse(inspect.getsource(audit)) modules=[n.module for n in ast.walk(tree) if isinstance(n,ast.ImportFrom)] - assert not any('anysolver' in n or 'moment_reference' in n for n in modules) + assert not any('anyfesolver' in n or 'moment_reference' in n for n in modules) assert not any(isinstance(n,ast.Call) and isinstance(n.func,ast.Attribute) and n.func.attr in ('solve','solve_force_program') for n in ast.walk(tree)) diff --git a/tests/test_ge_beam3_n32_refinement_capacity.py b/tests/test_ge_beam3_n32_refinement_capacity.py index 2d9d13258..f8db240d5 100644 --- a/tests/test_ge_beam3_n32_refinement_capacity.py +++ b/tests/test_ge_beam3_n32_refinement_capacity.py @@ -2,12 +2,12 @@ from contextvars import Context import numpy as np import pytest -from anysolver._ge_beam3_refinement_capacity import retained_limits,n32_refinement_capacity -from anysolver._ge_beam3_native_generalized_program import model_identity,retained_model_identity -from anysolver._ge_beam3_retained_generalized_state import _retained_size -from anysolver._ge_beam3_elastic_seed_modal import _factor_size -from anysolver._ge_beam3_native_generalized_restart import _model -from anysolver._ge_beam3_precise_geometric_work import POLICY +from anyfesolver._ge_beam3_refinement_capacity import retained_limits,n32_refinement_capacity +from anyfesolver._ge_beam3_native_generalized_program import model_identity,retained_model_identity +from anyfesolver._ge_beam3_retained_generalized_state import _retained_size +from anyfesolver._ge_beam3_elastic_seed_modal import _factor_size +from anyfesolver._ge_beam3_native_generalized_restart import _model +from anyfesolver._ge_beam3_precise_geometric_work import POLICY from docs.reference_cases.ge_beam3_n32_controlled_case import model from docs.reference_cases.ge_beam3_n32_equilibrium import sample,guess_descriptor,write_native from docs.reference_cases.ge_beam3_refined_controlled_case import model as old_model @@ -59,7 +59,7 @@ def test_one_sided_polynomial_sampling(): @pytest.mark.parametrize('sign',('plus','minus')) def test_actual_bound_continuum_guess_native_shapes_frames_and_clamps(sign): from docs.reference_cases.ge_beam3_spatial_ritz_worker import source - from anysolver._ge_beam3_retained_generalized_state import Context as Physical,Mechanical + from anyfesolver._ge_beam3_retained_generalized_state import Context as Physical,Mechanical m=model(32,arithmetic_policy=POLICY);elements=tuple(sorted(m.mesh.elements.items())) positions=np.array([m.mesh.nodes[i].coords() for i in range(1,66)]) frames=np.empty((65,3,3)) @@ -77,7 +77,7 @@ def test_actual_bound_continuum_guess_native_shapes_frames_and_clamps(sign): assert not initial.resultants.any() and not initial.position_low.any() def test_native_array_history_writer_roundtrip_exclusive_and_no_partial(tmp_path): - from anysolver._ge_beam3_p5_seeded.core import canonical + from anyfesolver._ge_beam3_p5_seeded.core import canonical from docs.reference_cases.ge_beam3_retained_prestress_protocol import strict_bytes m=old_model(2,arithmetic_policy=POLICY);history=m.mesh.elements[1].operator.cell.virgin() value=dict(mechanical=dict(cell_rotations=np.tile(np.eye(3),(2,2,1,1))),recovery=[dict(history=history,field=np.zeros(6))]) diff --git a/tests/test_ge_beam3_n32_spectrum.py b/tests/test_ge_beam3_n32_spectrum.py index 1da86bbd0..0e118d8ac 100644 --- a/tests/test_ge_beam3_n32_spectrum.py +++ b/tests/test_ge_beam3_n32_spectrum.py @@ -108,7 +108,7 @@ def test_actual_factor_authority(sign,tmp_path): def test_worker_has_no_production_import_or_owner_solve(): tree=ast.parse(Path(worker.__file__).read_text()) - assert not any(isinstance(n,ast.ImportFrom) and (n.module or '').startswith('anysolver') for n in ast.walk(tree)) + assert not any(isinstance(n,ast.ImportFrom) and (n.module or '').startswith('anyfesolver') for n in ast.walk(tree)) assert not any(isinstance(n,ast.Call) and isinstance(n.func,ast.Attribute) and n.func.attr in ('Context','solve','solve_bvp','prepare') for n in ast.walk(tree)) def test_original_deadline_and_trace_cancellation(monkeypatch): diff --git a/tests/test_ge_beam3_native_analysis.py b/tests/test_ge_beam3_native_analysis.py index a76b795ba..3996a28f1 100644 --- a/tests/test_ge_beam3_native_analysis.py +++ b/tests/test_ge_beam3_native_analysis.py @@ -5,15 +5,15 @@ import numpy as np import pytest -from anysolver._ge_beam3_native_analysis import NativeBeamAnalysis, NativeBeamAnalysisError, NativeBeamWorkflowError -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_native_generalized_program import solve_distributed_model -from anysolver._ge_beam3_native_generalized_modal import solve_modes -from anysolver.nonlinear_static import solve_static_nonlinear -from anysolver.boundary import LoadCase, BoundaryCondition +from anyfesolver._ge_beam3_native_analysis import NativeBeamAnalysis, NativeBeamAnalysisError, NativeBeamWorkflowError +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_native_generalized_program import solve_distributed_model +from anyfesolver._ge_beam3_native_generalized_modal import solve_modes +from anyfesolver.nonlinear_static import solve_static_nonlinear +from anyfesolver.boundary import LoadCase, BoundaryCondition from test_ge_beam3_native_generalized import problem as generalized_problem, pattern from test_ge_beam3_native_fibre_static_element import problem as fibre_problem from test_ge_beam3_native_generalized_modal import make as modal_model diff --git a/tests/test_ge_beam3_native_arc.py b/tests/test_ge_beam3_native_arc.py index f6d852586..64f2cc9b0 100644 --- a/tests/test_ge_beam3_native_arc.py +++ b/tests/test_ge_beam3_native_arc.py @@ -5,17 +5,17 @@ import numpy as np import pytest from scipy import sparse -from anysolver._ge_beam3_native_arc import ArcProgram,solve_arc,direction,capture,_ARC -from anysolver._ge_beam3_native_arc_restart import encode_checkpoint,decode_checkpoint -from anysolver._ge_beam3_native_translation import _PATH -from anysolver._ge_beam3_native_generalized_program import _PROGRAM -from anysolver._ge_beam3_native_generalized_combined_couples import _RUN -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern,_ACTIVE -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_spatial_nodal_moments import SpatialNodalMoments -from anysolver._ge_beam3_native_generalized_recovery import recover_native_fields -from anysolver._ge_beam3_p5_seeded.core import canonical,sha -from anysolver._ge_beam3_p5.algebra import rotation +from anyfesolver._ge_beam3_native_arc import ArcProgram,solve_arc,direction,capture,_ARC +from anyfesolver._ge_beam3_native_arc_restart import encode_checkpoint,decode_checkpoint +from anyfesolver._ge_beam3_native_translation import _PATH +from anyfesolver._ge_beam3_native_generalized_program import _PROGRAM +from anyfesolver._ge_beam3_native_generalized_combined_couples import _RUN +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern,_ACTIVE +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_spatial_nodal_moments import SpatialNodalMoments +from anyfesolver._ge_beam3_native_generalized_recovery import recover_native_fields +from anyfesolver._ge_beam3_p5_seeded.core import canonical,sha +from anyfesolver._ge_beam3_p5.algebra import rotation from test_ge_beam3_native_translation import bar as source_bar from test_ge_beam3_native_generalized_restart import make,pattern from test_ge_beam3_schur_line_program import save @@ -96,9 +96,9 @@ def test_fold_predictor_orientation(tmp_path): def test_rigid_frame_covariance(tmp_path): - from anysolver.fe_core import FEModel - from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference + from anyfesolver.fe_core import FEModel + from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference m,_=bar();load=DistributedPattern(LinePattern(((1,.4,-.1,.15),)),());moments=SpatialNodalMoments(((3,.1,.15,-.12),)) p=ArcProgram((.15,.2),1.,load,moments);r=solve_arc(m,p);assert r.status=='completed',r.failure s=rotation([.4,-.2,.7]);shift=np.array([2.,-3.,1.]);moved=FEModel('native-arc-rotated') diff --git a/tests/test_ge_beam3_native_arc_adaptive.py b/tests/test_ge_beam3_native_arc_adaptive.py index b8769c731..4989f2763 100644 --- a/tests/test_ge_beam3_native_arc_adaptive.py +++ b/tests/test_ge_beam3_native_arc_adaptive.py @@ -4,10 +4,10 @@ import json import numpy as np import pytest -from anysolver import _ge_beam3_native_arc as arc -from anysolver import _ge_beam3_native_arc_adaptive as adaptive -from anysolver._ge_beam3_p5_seeded.core import canonical,sha -from anysolver.control import CancellationToken +from anyfesolver import _ge_beam3_native_arc as arc +from anyfesolver import _ge_beam3_native_arc_adaptive as adaptive +from anyfesolver._ge_beam3_p5_seeded.core import canonical,sha +from anyfesolver.control import CancellationToken from test_ge_beam3_native_arc import bar from test_ge_beam3_schur_line_program import save @@ -151,9 +151,9 @@ def factor(*a,**kw): def test_physical_convergence_cutback(tmp_path): - from anysolver._ge_beam3_native_generalized_loading import DistributedPattern - from anysolver._ge_beam3_native_line_loading import LinePattern - from anysolver._ge_beam3_spatial_nodal_moments import SpatialNodalMoments + from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern + from anyfesolver._ge_beam3_native_line_loading import LinePattern + from anyfesolver._ge_beam3_spatial_nodal_moments import SpatialNodalMoments m,p=make() base=replace(p.prototype,steps=(.2,),max_iterations=1, distributed=DistributedPattern(LinePattern(((1,.4,-.1,.15),)),()), @@ -170,10 +170,10 @@ def test_physical_convergence_cutback(tmp_path): def test_curved_plastic_source(tmp_path): from test_ge_beam3_native_generalized_restart import make as curved,pattern - from anysolver._ge_beam3_native_translation import TranslationProgram,solve_translation - from anysolver._ge_beam3_native_arc_source import TranslationArcSource - from anysolver._ge_beam3_spatial_nodal_moments import SpatialNodalMoments - from anysolver._ge_beam3_native_generalized_recovery import recover_native_fields + from anyfesolver._ge_beam3_native_translation import TranslationProgram,solve_translation + from anyfesolver._ge_beam3_native_arc_source import TranslationArcSource + from anyfesolver._ge_beam3_spatial_nodal_moments import SpatialNodalMoments + from anyfesolver._ge_beam3_native_generalized_recovery import recover_native_fields model=curved('curved-plastic');translation=TranslationProgram((.03,),3,'ux',pattern(model),SpatialNodalMoments(((3,.015,-.01,.008),))) source=solve_translation(model,translation);save(tmp_path/'source.json',source.checkpoint);assert source.status=='completed',source.failure prototype=arc.ArcProgram((.04,),1.,translation.distributed,translation.nodal_moments, @@ -192,13 +192,13 @@ def test_curved_plastic_source(tmp_path): def test_adaptive_rigid_covariance(tmp_path): - from anysolver.fe_core import FEModel - from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference - from anysolver._ge_beam3_native_generalized_loading import DistributedPattern - from anysolver._ge_beam3_native_line_loading import LinePattern - from anysolver._ge_beam3_spatial_nodal_moments import SpatialNodalMoments - from anysolver._ge_beam3_p5.algebra import rotation + from anyfesolver.fe_core import FEModel + from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference + from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern + from anyfesolver._ge_beam3_native_line_loading import LinePattern + from anyfesolver._ge_beam3_spatial_nodal_moments import SpatialNodalMoments + from anyfesolver._ge_beam3_p5.algebra import rotation m,p=make();force=np.array([.4,-.1,.15]);moment=np.array([.1,.15,-.12]) p=replace(p,prototype=replace(p.prototype,distributed=DistributedPattern(LinePattern(((1,*map(float,force)),)),()), nodal_moments=SpatialNodalMoments(((3,*map(float,moment)),)))) @@ -223,9 +223,9 @@ def test_adaptive_rigid_covariance(tmp_path): def test_curved_plastic_rejection(monkeypatch,tmp_path): from test_ge_beam3_native_generalized_restart import make as curved,pattern - from anysolver._ge_beam3_native_translation import TranslationProgram,solve_translation - from anysolver._ge_beam3_native_arc_source import TranslationArcSource - from anysolver._ge_beam3_spatial_nodal_moments import SpatialNodalMoments + from anyfesolver._ge_beam3_native_translation import TranslationProgram,solve_translation + from anyfesolver._ge_beam3_native_arc_source import TranslationArcSource + from anyfesolver._ge_beam3_spatial_nodal_moments import SpatialNodalMoments model=curved('curved-plastic');translation=TranslationProgram((.03,),3,'ux',pattern(model),SpatialNodalMoments(((3,.015,-.01,.008),))) source=solve_translation(model,translation);save(tmp_path/'source.json',source.checkpoint);assert source.status=='completed',source.failure prototype=arc.ArcProgram((.04,),1.,translation.distributed,translation.nodal_moments, diff --git a/tests/test_ge_beam3_native_arc_safety.py b/tests/test_ge_beam3_native_arc_safety.py index 9f659f25e..4f9d93429 100644 --- a/tests/test_ge_beam3_native_arc_safety.py +++ b/tests/test_ge_beam3_native_arc_safety.py @@ -2,18 +2,18 @@ from dataclasses import replace from hashlib import sha256 import pytest -from anysolver.control import CancellationToken -from anysolver._ge_beam3_native_arc import solve_arc,_ARC -from anysolver._ge_beam3_native_arc_restart import decode_checkpoint -from anysolver._ge_beam3_native_translation import _PATH -from anysolver._ge_beam3_native_generalized_program import _PROGRAM +from anyfesolver.control import CancellationToken +from anyfesolver._ge_beam3_native_arc import solve_arc,_ARC +from anyfesolver._ge_beam3_native_arc_restart import decode_checkpoint +from anyfesolver._ge_beam3_native_translation import _PATH +from anyfesolver._ge_beam3_native_generalized_program import _PROGRAM from test_ge_beam3_native_arc import bar,packet from test_ge_beam3_schur_line_program import save @pytest.mark.parametrize('kind',['cancel','factorization','mutation']) def test_accepted_prefix_preserved(kind,monkeypatch,tmp_path): - import anysolver._ge_beam3_native_arc as module + import anyfesolver._ge_beam3_native_arc as module m,p=bar();prefix=solve_arc(m,p,stop_after=1);assert prefix.status=='paused' m,p=bar();token=CancellationToken();committed=False;original=module.factorize def observer(event): @@ -38,7 +38,7 @@ def factor(*a,**kw): @pytest.mark.parametrize('kind',['steps','step-zero','step-range','step-type','length','tiny-length','huge-length','parameter-scale','sign','iterations','backtracks','stop','hash','translation-scope','force-scope','arc-scope']) def test_preflight(kind,monkeypatch,tmp_path): - import anysolver._ge_beam3_native_arc as module + import anyfesolver._ge_beam3_native_arc as module m,p=bar();kwargs={};scope=None;token=None if kind=='steps':p=replace(p,steps=()) elif kind=='step-zero':p=replace(p,steps=(0.,)) diff --git a/tests/test_ge_beam3_native_arc_source.py b/tests/test_ge_beam3_native_arc_source.py index a4b48e19f..b86ac4ad9 100644 --- a/tests/test_ge_beam3_native_arc_source.py +++ b/tests/test_ge_beam3_native_arc_source.py @@ -5,13 +5,13 @@ import json import numpy as np import pytest -from anysolver._ge_beam3_native_translation import solve_translation -from anysolver._ge_beam3_native_translation_restart import decode_checkpoint as decode_translation,encode_checkpoint as encode_translation -from anysolver._ge_beam3_native_arc_source import TranslationArcSource -from anysolver._ge_beam3_native_arc import ArcProgram,solve_arc -from anysolver._ge_beam3_native_arc_restart import encode_checkpoint,decode_checkpoint,SOURCE_SCHEMA -from anysolver._ge_beam3_native_history_profile import HISTORY8M -from anysolver._ge_beam3_p5_seeded.core import canonical,sha +from anyfesolver._ge_beam3_native_translation import solve_translation +from anyfesolver._ge_beam3_native_translation_restart import decode_checkpoint as decode_translation,encode_checkpoint as encode_translation +from anyfesolver._ge_beam3_native_arc_source import TranslationArcSource +from anyfesolver._ge_beam3_native_arc import ArcProgram,solve_arc +from anyfesolver._ge_beam3_native_arc_restart import encode_checkpoint,decode_checkpoint,SOURCE_SCHEMA +from anyfesolver._ge_beam3_native_history_profile import HISTORY8M +from anyfesolver._ge_beam3_p5_seeded.core import canonical,sha from test_ge_beam3_native_translation import bar from test_ge_beam3_native_arc import packet from test_ge_beam3_schur_line_program import save @@ -70,8 +70,8 @@ def test_source_rejection(source,kind,tmp_path): elif kind=='sign':changed=replace(arc,source=replace(seed,forward_sign=True)) elif kind=='profile':changed=replace(arc,history_profile=HISTORY8M if arc.history_profile is None else None) elif kind=='load': - from anysolver._ge_beam3_native_generalized_loading import DistributedPattern - from anysolver._ge_beam3_native_line_loading import LinePattern + from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern + from anyfesolver._ge_beam3_native_line_loading import LinePattern changed=replace(arc,distributed=DistributedPattern(LinePattern(((1,2.,0.,0.),)),())) elif kind=='initial-sign':changed=replace(arc,initial_sign=-1.) elif kind=='history-count':changed=replace(arc,steps=(.1,)*64) @@ -115,7 +115,7 @@ def test_unseeded_rejects_seeded_checkpoint(source,tmp_path): def test_external_arc_guard_precedes_source_replay(source,monkeypatch,tmp_path): - from anysolver import _ge_beam3_native_arc_source as module + from anyfesolver import _ge_beam3_native_arc_source as module _,_,arc,result=source;model,_=bar() def tripwire(*args):raise RuntimeError('source replay must not run') monkeypatch.setattr(module,'load_source',tripwire) @@ -125,8 +125,8 @@ def tripwire(*args):raise RuntimeError('source replay must not run') def test_secant_objectivity_and_zero(tmp_path): - from anysolver._ge_beam3_native_arc_source import secant_orientation - from anysolver._native_rotation_state import rotation_exponential + from anyfesolver._ge_beam3_native_arc_source import secant_orientation + from anyfesolver._native_rotation_state import rotation_exponential s=rotation_exponential(np.array([.7,-.3,.4])) old=np.arange(12,dtype=float)*.002 new=old+np.array([.02,-.01,.03,.04,.03,-.01,-.02,.03,.01,-.03,.01,.02]) @@ -144,9 +144,9 @@ def test_secant_objectivity_and_zero(tmp_path): def test_curved_plastic_source(tmp_path): from test_ge_beam3_native_generalized_restart import make,pattern - from anysolver._ge_beam3_native_translation import TranslationProgram - from anysolver._ge_beam3_spatial_nodal_moments import SpatialNodalMoments - from anysolver._ge_beam3_native_generalized_recovery import recover_native_fields + from anyfesolver._ge_beam3_native_translation import TranslationProgram + from anyfesolver._ge_beam3_spatial_nodal_moments import SpatialNodalMoments + from anyfesolver._ge_beam3_native_generalized_recovery import recover_native_fields model=make('curved-plastic') p=TranslationProgram((.03,),3,'ux',pattern(model),SpatialNodalMoments(((3,.015,-.01,.008),))) original=solve_translation(model,p);save(tmp_path/'source-result.json',dict(status=original.status,failure=original.failure)) diff --git a/tests/test_ge_beam3_native_buckling.py b/tests/test_ge_beam3_native_buckling.py index b8ee1d3c6..ec75e3e86 100644 --- a/tests/test_ge_beam3_native_buckling.py +++ b/tests/test_ge_beam3_native_buckling.py @@ -5,14 +5,14 @@ import pytest from scipy.linalg import eig -from anysolver import _ge_beam3_native_buckling as buckling -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._ge_beam3_native_analysis import NativeBeamAnalysis -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_p5.algebra import rotation +from anyfesolver import _ge_beam3_native_buckling as buckling +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._ge_beam3_native_analysis import NativeBeamAnalysis +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_p5.algebra import rotation from test_ge_beam3_native_analysis import analysis, generalized_problem, fibre_problem @@ -96,7 +96,7 @@ def check(): def make(family, curved=True, common=None, mass_scale=1.): source, _ = (generalized_problem if family == 'generalized' else fibre_problem)(curved, False) if common is not None: - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference old = source.mesh.elements[1] reference = Reference(old.operator.reference.coordinates@common.T, common@old.operator.reference.nodal_triads) @@ -218,7 +218,7 @@ def test_active_plastic_history_and_bad_authority_not_relabelled(): def test_connected_curved_fibres_retain_all_stationary_coordinates(tmp_path): from test_ge_beam3_retained_fibre import make_model - from anysolver._ge_beam3_native_fibre_static_element import NativeFibreStaticElement + from anyfesolver._ge_beam3_native_fibre_static_element import NativeFibreStaticElement source = make_model() definitions = tuple(NativeBeamDefinition.capture(NativeFibreStaticElement( i, tuple(e.node_ids), e.operator.reference, e.section, order=4), diff --git a/tests/test_ge_beam3_native_combined_couples.py b/tests/test_ge_beam3_native_combined_couples.py index a7e7578d8..f6d56b794 100644 --- a/tests/test_ge_beam3_native_combined_couples.py +++ b/tests/test_ge_beam3_native_combined_couples.py @@ -1,13 +1,13 @@ """Combined distributed/nodal work through actual native assembly and Newton.""" import numpy as np import pytest -from anysolver._ge_beam3_native_combined_couples import solve_combined_static,external_at,_Run,_RUN -from anysolver._ge_beam3_native_distributed_loading import DistributedPattern,assemble_distributed_trial,_ACTIVE -from anysolver._ge_beam3_native_distributed_program import solve_distributed_model,_PROGRAM -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_spatial_nodal_moments import SpatialNodalMoments -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_p5.algebra import rotation +from anyfesolver._ge_beam3_native_combined_couples import solve_combined_static,external_at,_Run,_RUN +from anyfesolver._ge_beam3_native_distributed_loading import DistributedPattern,assemble_distributed_trial,_ACTIVE +from anyfesolver._ge_beam3_native_distributed_program import solve_distributed_model,_PROGRAM +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_spatial_nodal_moments import SpatialNodalMoments +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_p5.algebra import rotation from test_ge_beam3_native_distributed import problem,convert,pattern,packet from test_ge_beam3_native_spatial_couples import left_jacobian,make as simple from test_ge_beam3_native_fibre_static_element import store_for,sample @@ -39,8 +39,8 @@ def test_combined_directional_work(plastic,tmp_path): def test_combined_analytical_torsion(monkeypatch,tmp_path): - import anysolver.nonlinear_static as solver - from anysolver.linalg import MatrixClass + import anyfesolver.nonlinear_static as solver + from anyfesolver.linalg import MatrixClass model=convert(simple()[0]);calls=[];original=solver.factorize;tip=.3;density=.12 def observed(matrix,kind,*args,**kwargs): if str(kwargs.get('signature','')).startswith('nonlinear.static_newton'): @@ -75,7 +75,7 @@ def test_zero_nodal_limit_and_fixed_reaction(tmp_path): @pytest.mark.parametrize('mutation',['pattern','foreign-store','unissued-pose']) def test_live_load_authority(mutation,monkeypatch,tmp_path): - import anysolver._ge_beam3_native_combined_couples as module + import anyfesolver._ge_beam3_native_combined_couples as module m,e=problem();store=store_for(m,e);before=canonical(store.materialize());u=sample() run=_Run(m,SpatialNodalMoments(((3,.1,.2,.3),)));token=_RUN.set(run) try: diff --git a/tests/test_ge_beam3_native_combined_restart.py b/tests/test_ge_beam3_native_combined_restart.py index 807c66f36..74e805c36 100644 --- a/tests/test_ge_beam3_native_combined_restart.py +++ b/tests/test_ge_beam3_native_combined_restart.py @@ -3,14 +3,14 @@ import json import numpy as np import pytest -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_native_distributed_program import _PROGRAM, solve_distributed_model -from anysolver._ge_beam3_native_distributed_restart import LoadPoint as LinePoint -from anysolver._ge_beam3_native_distributed_recovery import recover_native_fields -from anysolver._ge_beam3_native_combined_restart import LoadPoint, encode_checkpoint, decode_checkpoint -from anysolver._ge_beam3_native_combined_couples import solve_combined_static, _RUN -from anysolver._ge_beam3_spatial_nodal_moments import SpatialNodalMoments -from anysolver._ge_beam3_p5_seeded.core import canonical, sha +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_native_distributed_program import _PROGRAM, solve_distributed_model +from anyfesolver._ge_beam3_native_distributed_restart import LoadPoint as LinePoint +from anyfesolver._ge_beam3_native_distributed_recovery import recover_native_fields +from anyfesolver._ge_beam3_native_combined_restart import LoadPoint, encode_checkpoint, decode_checkpoint +from anyfesolver._ge_beam3_native_combined_couples import solve_combined_static, _RUN +from anyfesolver._ge_beam3_spatial_nodal_moments import SpatialNodalMoments +from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha from test_ge_beam3_native_distributed_restart import make, scale as line_scale, CASES, EMPTY from test_ge_beam3_native_distributed import pattern from test_ge_beam3_schur_line_program import save @@ -147,8 +147,8 @@ def test_resealed_mutations(saved,mutation,tmp_path): @pytest.mark.parametrize('mutation',['duplicate','nonfinite','noncanonical','external-hash','constant-moment','constant-line','support']) def test_rejection_before_solver(saved,mutation,monkeypatch,tmp_path): - import anysolver._ge_beam3_native_combined_couples as module - from anysolver.boundary import BoundaryCondition + import anyfesolver._ge_beam3_native_combined_couples as module + from anyfesolver.boundary import BoundaryCondition case,_,line,moments,_,raw,_=saved;model=make(case);kwargs={} if mutation=='duplicate':raw=raw.replace(b'{',b'{"schema":"duplicate",',1) elif mutation=='nonfinite':raw=raw.replace(b'"parameter":0.0',b'"parameter":NaN',1) @@ -165,7 +165,7 @@ def forbidden(*args,**kw):raise AssertionError('entered solver before authority def test_cross_schema_and_missing_hash_rejected(saved,tmp_path): - from anysolver._ge_beam3_native_distributed_restart import encode_checkpoint as encode_line + from anyfesolver._ge_beam3_native_distributed_restart import encode_checkpoint as encode_line case,_,line,moments,_,raw,_=saved;model=make(case) with pytest.raises(ValueError):solve_distributed_model(model,line,initial_checkpoint=raw,expected_sha256=sha256(raw).hexdigest()) state={i:e.init_model_bound_nonlinear_state(model.mesh,e.section,1) for i,e in model.mesh.elements.items()} @@ -178,7 +178,7 @@ def test_cross_schema_and_missing_hash_rejected(saved,tmp_path): def test_live_checkpoint_binding(saved,tmp_path): - from anysolver._ge_beam3_native_combined_couples import _Run,decode_active_restart + from anyfesolver._ge_beam3_native_combined_couples import _Run,decode_active_restart case,_,_,moments,_,raw,_=saved;model=make(case) run=_Run(model,moments,moments,restart_sha256='0'*64);token=_RUN.set(run) try: @@ -188,7 +188,7 @@ def test_live_checkpoint_binding(saved,tmp_path): def test_validation_deadline(saved,monkeypatch,tmp_path): - import anysolver._ge_beam3_native_combined_restart as module + import anyfesolver._ge_beam3_native_combined_restart as module case,_,_,_,_,raw,_=saved;calls=[] def clock(): calls.append(True);return 61.*len(calls) diff --git a/tests/test_ge_beam3_native_connected_bending.py b/tests/test_ge_beam3_native_connected_bending.py index b96751a6a..a39a61bdb 100644 --- a/tests/test_ge_beam3_native_connected_bending.py +++ b/tests/test_ge_beam3_native_connected_bending.py @@ -212,8 +212,8 @@ def test_linear_midpoint_modal_phase_refinement(): assert error(fine)1e-3 assert not evidence['program']['conservative_potential'] and _RUN.get() is None @@ -126,7 +126,7 @@ def test_direct_support_moment_is_external_reaction(tmp_path): @pytest.mark.parametrize('kind',['absent-node','wrong-type','mutated-pattern']) def test_authority_preflight(kind,monkeypatch,tmp_path): - import anysolver._ge_beam3_native_spatial_couples as module + import anyfesolver._ge_beam3_native_spatial_couples as module model,_=make();moment=SpatialNodalMoments(((3,.1,.2,.3),)) if kind=='absent-node':moment=SpatialNodalMoments(((9,.1,.2,.3),)) elif kind=='wrong-type':moment=moment.rows @@ -161,7 +161,7 @@ def test_connected_junction_couple_is_counted_once(tmp_path): @pytest.mark.parametrize('mutation',['pattern','foreign-store','unissued-pose']) def test_live_external_authority_and_cleanup(mutation,monkeypatch,tmp_path): - import anysolver._ge_beam3_native_spatial_couples as module + import anyfesolver._ge_beam3_native_spatial_couples as module model,e=problem(True,True);store=store_for(model,e);before=canonical(store.materialize());u=sample() run=_Run(model,SpatialNodalMoments(((3,.1,.2,.3),)));token=_RUN.set(run) try: diff --git a/tests/test_ge_beam3_native_spatial_restart.py b/tests/test_ge_beam3_native_spatial_restart.py index 7745a8162..8cd93e618 100644 --- a/tests/test_ge_beam3_native_spatial_restart.py +++ b/tests/test_ge_beam3_native_spatial_restart.py @@ -3,14 +3,14 @@ import json import numpy as np import pytest -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_native_line_program import _PROGRAM, solve_line_static -from anysolver._ge_beam3_native_line_restart import LoadPoint as LinePoint -from anysolver._ge_beam3_native_line_recovery import recover_native_fields -from anysolver._ge_beam3_native_spatial_restart import LoadPoint, encode_checkpoint, decode_checkpoint -from anysolver._ge_beam3_native_spatial_couples import solve_spatial_static, _RUN -from anysolver._ge_beam3_spatial_nodal_moments import SpatialNodalMoments -from anysolver._ge_beam3_p5_seeded.core import canonical, sha +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_native_line_program import _PROGRAM, solve_line_static +from anyfesolver._ge_beam3_native_line_restart import LoadPoint as LinePoint +from anyfesolver._ge_beam3_native_line_recovery import recover_native_fields +from anyfesolver._ge_beam3_native_spatial_restart import LoadPoint, encode_checkpoint, decode_checkpoint +from anyfesolver._ge_beam3_native_spatial_couples import solve_spatial_static, _RUN +from anyfesolver._ge_beam3_spatial_nodal_moments import SpatialNodalMoments +from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha from test_ge_beam3_native_line_restart import make, scale as line_scale, CASES from test_ge_beam3_schur_line_program import save @@ -142,8 +142,8 @@ def test_resealed_mutations(saved,mutation,tmp_path): @pytest.mark.parametrize('mutation',['duplicate','nonfinite','noncanonical','external-hash','constant-moment','constant-line','support']) def test_rejection_before_solver(saved,mutation,monkeypatch,tmp_path): - import anysolver._ge_beam3_native_spatial_couples as module - from anysolver.boundary import BoundaryCondition + import anyfesolver._ge_beam3_native_spatial_couples as module + from anyfesolver.boundary import BoundaryCondition case,_,line,moments,_,raw,_=saved;model=make(case);kwargs={} if mutation=='duplicate':raw=raw.replace(b'{',b'{"schema":"duplicate",',1) elif mutation=='nonfinite':raw=raw.replace(b'"parameter":0.0',b'"parameter":NaN',1) @@ -160,7 +160,7 @@ def forbidden(*args,**kw):raise AssertionError('entered solver before authority def test_cross_schema_and_missing_hash_rejected(saved,tmp_path): - from anysolver._ge_beam3_native_line_restart import encode_checkpoint as encode_line + from anyfesolver._ge_beam3_native_line_restart import encode_checkpoint as encode_line case,_,line,moments,_,raw,_=saved;model=make(case) with pytest.raises(ValueError):solve_line_static(model,line,initial_checkpoint=raw,expected_sha256=sha256(raw).hexdigest()) state={i:e.init_model_bound_nonlinear_state(model.mesh,e.section,1) for i,e in model.mesh.elements.items()} @@ -173,7 +173,7 @@ def test_cross_schema_and_missing_hash_rejected(saved,tmp_path): def test_live_checkpoint_binding(saved,tmp_path): - from anysolver._ge_beam3_native_spatial_couples import _Run,decode_active_restart + from anyfesolver._ge_beam3_native_spatial_couples import _Run,decode_active_restart case,_,_,moments,_,raw,_=saved;model=make(case) run=_Run(model,moments,moments,restart_sha256='0'*64);token=_RUN.set(run) try: @@ -183,7 +183,7 @@ def test_live_checkpoint_binding(saved,tmp_path): def test_validation_deadline(saved,monkeypatch,tmp_path): - import anysolver._ge_beam3_native_spatial_restart as module + import anyfesolver._ge_beam3_native_spatial_restart as module case,_,_,_,_,raw,_=saved;calls=[] def clock(): calls.append(True);return 61.*len(calls) diff --git a/tests/test_ge_beam3_native_spectral_prestress.py b/tests/test_ge_beam3_native_spectral_prestress.py index abbffaddd..7951339c0 100644 --- a/tests/test_ge_beam3_native_spectral_prestress.py +++ b/tests/test_ge_beam3_native_spectral_prestress.py @@ -2,16 +2,16 @@ from copy import deepcopy import numpy as np import pytest -from anysolver import _ge_beam3_native_generalized_modal as modal -from anysolver._ge_beam3_native_arc import make_store -from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement -from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern,assemble_distributed_trial -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_native_generalized_program import solve_distributed_model -from anysolver.nonlinear_state import native_trial_full_coordinates -from anysolver._ge_beam3_p5_seeded.core import canonical,sha -from anysolver.fe_core import FEModel +from anyfesolver import _ge_beam3_native_generalized_modal as modal +from anyfesolver._ge_beam3_native_arc import make_store +from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement +from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern,assemble_distributed_trial +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_native_generalized_program import solve_distributed_model +from anyfesolver.nonlinear_state import native_trial_full_coordinates +from anyfesolver._ge_beam3_p5_seeded.core import canonical,sha +from anyfesolver.fe_core import FEModel from test_ge_beam3_native_generalized_modal import make,close from test_ge_beam3_schur_line_program import save diff --git a/tests/test_ge_beam3_native_transient.py b/tests/test_ge_beam3_native_transient.py index 835621110..4110a0d68 100644 --- a/tests/test_ge_beam3_native_transient.py +++ b/tests/test_ge_beam3_native_transient.py @@ -13,13 +13,13 @@ import numpy as np import pytest -from anysolver.control import CancellationToken, SolveCancelled -from anysolver.dynamics import TransientConfig -from anysolver.ge_beam3_native_dynamics import solve_transient -from anysolver._ge_beam3_p5_seeded.core import canonical, sha -from anysolver._ge_beam3_native_transient import ( +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver.dynamics import TransientConfig +from anyfesolver.ge_beam3_native_dynamics import solve_transient +from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha +from anyfesolver._ge_beam3_native_transient import ( NativeTransientError, _settings, _advance, _record, _result) -from anysolver._ge_beam3_native_midpoint import MidpointContext +from anyfesolver._ge_beam3_native_midpoint import MidpointContext from examples.native_contact_free_transient_dev import build, run @@ -194,7 +194,7 @@ def broken(self, state): def test_genesis_preparation_cancellation_and_serialization_roll_back(monkeypatch): - import anysolver._ge_beam3_native_transient as driver + import anyfesolver._ge_beam3_native_transient as driver for cancel in (False, True): owner, config = build(t_end=0.) token = CancellationToken() @@ -243,7 +243,7 @@ def test_config_refusal_without_native_construction(change): def test_controller_cutback_and_precommit_failure_oracle(monkeypatch): """No synthetic mechanics proof: injected controller behavior only.""" - import anysolver._ge_beam3_native_transient as driver + import anyfesolver._ge_beam3_native_transient as driver owner, config = build(t_end=.001) prefix = solve_transient(owner, replace(config, t_end=0.)) capsule = json.loads(prefix.checkpoint) @@ -300,7 +300,7 @@ def cancel_after_prepare(self, candidate, **kwargs): def test_keyboard_interrupt_precommit_discards_candidate(monkeypatch): - import anysolver._ge_beam3_native_transient as driver + import anyfesolver._ge_beam3_native_transient as driver owner, config = build(t_end=0.) previous = solve_transient(owner, config) row = json.loads(previous.checkpoint) diff --git a/tests/test_ge_beam3_native_translation.py b/tests/test_ge_beam3_native_translation.py index 1d4beffd5..f04ae03da 100644 --- a/tests/test_ge_beam3_native_translation.py +++ b/tests/test_ge_beam3_native_translation.py @@ -6,14 +6,14 @@ import numpy as np import pytest from scipy import sparse -from anysolver._ge_beam3_native_translation import TranslationProgram,solve_translation,bordered,effective,load_point,_PATH -from anysolver._ge_beam3_native_translation_restart import encode_checkpoint,decode_checkpoint -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern,_ACTIVE -from anysolver._ge_beam3_native_generalized_combined_couples import _RUN -from anysolver._ge_beam3_native_generalized_recovery import recover_native_fields -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_spatial_nodal_moments import SpatialNodalMoments -from anysolver._ge_beam3_p5_seeded.core import canonical,sha +from anyfesolver._ge_beam3_native_translation import TranslationProgram,solve_translation,bordered,effective,load_point,_PATH +from anyfesolver._ge_beam3_native_translation_restart import encode_checkpoint,decode_checkpoint +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern,_ACTIVE +from anyfesolver._ge_beam3_native_generalized_combined_couples import _RUN +from anyfesolver._ge_beam3_native_generalized_recovery import recover_native_fields +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_spatial_nodal_moments import SpatialNodalMoments +from anyfesolver._ge_beam3_p5_seeded.core import canonical,sha from test_ge_beam3_native_generalized_restart import make,pattern from test_ge_beam3_native_generalized_combined_couples import convert,simple from test_ge_beam3_schur_line_program import save @@ -99,7 +99,7 @@ def test_signed_zero_mapping(tmp_path): @pytest.mark.parametrize('kind',['failure','mutation','nested']) def test_transaction_failure(kind,tmp_path,monkeypatch): - import anysolver._ge_beam3_native_translation as module + import anyfesolver._ge_beam3_native_translation as module m,p=bar();genesis=solve_translation(m,p,stop_after=0) fresh,p=bar();original=module.factorize if kind=='failure': diff --git a/tests/test_ge_beam3_native_translation_safety.py b/tests/test_ge_beam3_native_translation_safety.py index 9cb725fb6..72bedb27a 100644 --- a/tests/test_ge_beam3_native_translation_safety.py +++ b/tests/test_ge_beam3_native_translation_safety.py @@ -2,18 +2,18 @@ from dataclasses import replace from hashlib import sha256 import pytest -from anysolver.control import CancellationToken -from anysolver._ge_beam3_native_translation import solve_translation,_PATH -from anysolver._ge_beam3_native_translation_restart import decode_checkpoint -from anysolver._ge_beam3_native_generalized_combined_couples import _RUN -from anysolver._ge_beam3_native_generalized_loading import _ACTIVE +from anyfesolver.control import CancellationToken +from anyfesolver._ge_beam3_native_translation import solve_translation,_PATH +from anyfesolver._ge_beam3_native_translation_restart import decode_checkpoint +from anyfesolver._ge_beam3_native_generalized_combined_couples import _RUN +from anyfesolver._ge_beam3_native_generalized_loading import _ACTIVE from test_ge_beam3_native_translation import bar,packet from test_ge_beam3_schur_line_program import save @pytest.mark.parametrize('kind',['cancel','factorization']) def test_accepted_prefix_preserved(kind,monkeypatch,tmp_path): - import anysolver._ge_beam3_native_translation as module + import anyfesolver._ge_beam3_native_translation as module m,p=bar();prefix=solve_translation(m,p,stop_after=1);assert prefix.status=='paused' m,p=bar();token=CancellationToken();committed=False;original=module.factorize def observer(event): @@ -34,7 +34,7 @@ def factor(*a,**kw): @pytest.mark.parametrize('kind',['targets','target-type','control','node','iterations','backtracks','pattern','stop','observer','hash']) def test_preflight_before_assembly(kind,monkeypatch,tmp_path): - import anysolver._ge_beam3_native_translation as module + import anyfesolver._ge_beam3_native_translation as module m,p=bar();kwargs={} if kind=='targets':p=replace(p,targets=()) elif kind=='target-type':p=replace(p,targets=(True,)) diff --git a/tests/test_ge_beam3_native_uniform_arch.py b/tests/test_ge_beam3_native_uniform_arch.py index a016845b7..49f7c3afb 100644 --- a/tests/test_ge_beam3_native_uniform_arch.py +++ b/tests/test_ge_beam3_native_uniform_arch.py @@ -2,15 +2,15 @@ from dataclasses import asdict from hashlib import sha256 import numpy as np -from anysolver.fe_core import FEModel -from anysolver.boundary import BoundaryCondition -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference -from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection -from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_native_arc import ArcProgram,solve_arc -from anysolver._ge_beam3_native_arc_restart import decode_checkpoint +from anyfesolver.fe_core import FEModel +from anyfesolver.boundary import BoundaryCondition +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference +from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection +from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_native_arc import ArcProgram,solve_arc +from anyfesolver._ge_beam3_native_arc_restart import decode_checkpoint from docs.reference_cases import ge_beam3_uniform_arch_reference as continuum from test_ge_beam3_native_arc import packet from test_ge_beam3_schur_line_program import save diff --git a/tests/test_ge_beam3_next_spatial_native.py b/tests/test_ge_beam3_next_spatial_native.py index b4d8820a2..eb524372a 100644 --- a/tests/test_ge_beam3_next_spatial_native.py +++ b/tests/test_ge_beam3_next_spatial_native.py @@ -57,9 +57,9 @@ def test_resealed_extent_policy_mutations(kind): def test_actual_precise_endpoint_capture_schur_and_custody(original): - from anysolver import _ge_beam3_elastic_seed_continuation as owner - from anysolver import _ge_beam3_elastic_seed_modal as modal - from anysolver._ge_beam3_p5_seeded.core import canonical as native + from anyfesolver import _ge_beam3_elastic_seed_continuation as owner + from anyfesolver import _ge_beam3_elastic_seed_modal as modal + from anyfesolver._ge_beam3_p5_seeded.core import canonical as native from docs.reference_cases.ge_beam3_precise_work_enrollment import enroll program=programme((.0003,));context,enrolled=enroll(precise_model(),program,original,sha256(original).hexdigest()) result=owner.solve(precise_model(),program,enrolled,expected_seed_sha256=sha256(enrolled).hexdigest()) diff --git a/tests/test_ge_beam3_operator_validation_scope.py b/tests/test_ge_beam3_operator_validation_scope.py index d9fa5269d..e1a3be65a 100644 --- a/tests/test_ge_beam3_operator_validation_scope.py +++ b/tests/test_ge_beam3_operator_validation_scope.py @@ -2,9 +2,9 @@ from time import monotonic import numpy as np import pytest -from anysolver import _ge_beam3_operator_validation_scope as scope -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver import _ge_beam3_operator_validation_scope as scope +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.control import CancellationToken, SolveCancelled from test_ge_beam3_elastic_seed_continuation import seed, model, programme, solve, context from test_ge_beam3_elastic_seed_continuation import test_owner_mutations as owner_mutation from test_ge_beam3_elastic_seed_continuation import test_rehashed_checkpoint_mutations as checkpoint_mutation @@ -71,7 +71,7 @@ def test_real_failure_does_not_return_result(seed,monkeypatch,kind): token=CancellationToken(); calls=[] def full(): calls.append(1); owner.guard() if kind=='deadline': - from anysolver._ge_beam3_effective_deadline import effective_deadline_seconds + from anyfesolver._ge_beam3_effective_deadline import effective_deadline_seconds monkeypatch.setattr(scope,'monotonic',lambda:p.started+effective_deadline_seconds(120.)+.01) if kind=='cancellation': token.cancel() if kind=='model': diff --git a/tests/test_ge_beam3_owned_force_cancellation.py b/tests/test_ge_beam3_owned_force_cancellation.py index 1038c0f98..fef4b7f49 100644 --- a/tests/test_ge_beam3_owned_force_cancellation.py +++ b/tests/test_ge_beam3_owned_force_cancellation.py @@ -4,10 +4,10 @@ import numpy as np import pytest -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._ge_beam3_native_generalized_loading import _ACTIVE -from anysolver._ge_beam3_native_generalized_program import _PROGRAM -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._ge_beam3_native_generalized_loading import _ACTIVE +from anyfesolver._ge_beam3_native_generalized_program import _PROGRAM +from anyfesolver._ge_beam3_p5_seeded.core import canonical from test_ge_beam3_native_analysis import analysis, generalized_problem, fibre_problem, pattern diff --git a/tests/test_ge_beam3_owned_reference_factor_modes.py b/tests/test_ge_beam3_owned_reference_factor_modes.py index a4d00ded8..aff5097d7 100644 --- a/tests/test_ge_beam3_owned_reference_factor_modes.py +++ b/tests/test_ge_beam3_owned_reference_factor_modes.py @@ -2,9 +2,9 @@ import numpy as np import pytest -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_native_generalized_paired_modal import solve_modes -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_native_generalized_paired_modal import solve_modes +from anyfesolver.control import CancellationToken, SolveCancelled from test_ge_beam3_native_analysis import analysis from test_ge_beam3_native_generalized_modal import make diff --git a/tests/test_ge_beam3_paired_modal_consumers.py b/tests/test_ge_beam3_paired_modal_consumers.py index 5a0ef2d59..677265284 100644 --- a/tests/test_ge_beam3_paired_modal_consumers.py +++ b/tests/test_ge_beam3_paired_modal_consumers.py @@ -2,9 +2,9 @@ from types import SimpleNamespace import numpy as np import pytest -from anysolver import _ge_beam3_native_generalized_paired_modal as paired -from anysolver._native_paired_factor_chain_modes import apply_mode_map -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver import _ge_beam3_native_generalized_paired_modal as paired +from anyfesolver._native_paired_factor_chain_modes import apply_mode_map +from anyfesolver._ge_beam3_p5_seeded.core import canonical from docs.reference_cases.ge_beam3_reference_modal_groups import principal_correlations from docs.reference_cases import ge_beam3_continuum_frequency_shooting as reference import test_ge_beam3_native_generalized_modal as inherited diff --git a/tests/test_ge_beam3_paired_plastic_modal_probe.py b/tests/test_ge_beam3_paired_plastic_modal_probe.py index ed23fdf1c..e21c841df 100644 --- a/tests/test_ge_beam3_paired_plastic_modal_probe.py +++ b/tests/test_ge_beam3_paired_plastic_modal_probe.py @@ -1,17 +1,17 @@ """Small explicit-policy spectra; no plastic vibration/buckling qualification.""" import numpy as np import pytest -from anysolver._ge_beam3_retained_plastic_program import solve_force_program -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._native_factor_chain_modes import solve_factor_chain_modes +from anyfesolver._ge_beam3_retained_plastic_program import solve_force_program +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._native_factor_chain_modes import solve_factor_chain_modes from docs.reference_cases.ge_beam3_paired_plastic_modal_probe import prepare, FROZEN, ALGORITHMIC from test_ge_beam3_retained_plastic_state import program from test_ge_beam3_retained_plastic_force_probe import model_with_plasticity from test_ge_beam3_curved_contrast_probe import make_curved, ROTATION from test_ge_beam3_complementary_section import section -from anysolver._ge_beam3_p5_seeded import NativeP5BeamElement -from anysolver._ge_beam3_p5.algebra import rotation -from anysolver._ge_beam3_seeded_load_program import ForceProgram +from anyfesolver._ge_beam3_p5_seeded import NativeP5BeamElement +from anyfesolver._ge_beam3_p5.algebra import rotation +from anyfesolver._ge_beam3_seeded_load_program import ForceProgram @pytest.fixture(scope='module', params=[1., 1000000000000.]) diff --git a/tests/test_ge_beam3_plastic_cell_conjugate_probe.py b/tests/test_ge_beam3_plastic_cell_conjugate_probe.py index 972b39cbe..3a0792c09 100644 --- a/tests/test_ge_beam3_plastic_cell_conjugate_probe.py +++ b/tests/test_ge_beam3_plastic_cell_conjugate_probe.py @@ -1,9 +1,9 @@ """Integrated nonlinear cell conjugacy and history checks, not qualification.""" import numpy as np import pytest -from anysolver._ge_beam3_p5_seeded import NativeP5BeamElement -from anysolver._ge_beam3_p5.section import SectionHistory -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_p5_seeded import NativeP5BeamElement +from anyfesolver._ge_beam3_p5.section import SectionHistory +from anyfesolver._ge_beam3_p5_seeded.core import canonical from docs.reference_cases.ge_beam3_plastic_cell_conjugate_probe import PlasticCellConjugate from test_ge_beam3_complementary_section import section from test_ge_beam3_curved_contrast_probe import make_curved diff --git a/tests/test_ge_beam3_plastic_modal_checkpoint.py b/tests/test_ge_beam3_plastic_modal_checkpoint.py index 5e0ec2d9b..428c894fd 100644 --- a/tests/test_ge_beam3_plastic_modal_checkpoint.py +++ b/tests/test_ge_beam3_plastic_modal_checkpoint.py @@ -37,7 +37,7 @@ def test_source_bindings_and_no_runtime_research_import(): if isinstance(node, ast.Import): imports = [a.name for a in node.names] elif isinstance(node, ast.ImportFrom): imports = [node.module] else: continue - assert all(name.split('.')[0] in sys.stdlib_module_names | {'anysolver', 'numpy', 'scipy'} for name in imports) + assert all(name.split('.')[0] in sys.stdlib_module_names | {'anyfesolver', 'numpy', 'scipy'} for name in imports) def test_exact_archive_and_deterministic_pairs(): diff --git a/tests/test_ge_beam3_plastic_state_checkpoint.py b/tests/test_ge_beam3_plastic_state_checkpoint.py index 0e6adafe2..070e3d376 100644 --- a/tests/test_ge_beam3_plastic_state_checkpoint.py +++ b/tests/test_ge_beam3_plastic_state_checkpoint.py @@ -37,7 +37,7 @@ def test_bound_sources_have_no_runtime_research_dependency(): if isinstance(node, ast.Import): imports = [a.name for a in node.names] elif isinstance(node, ast.ImportFrom): imports = [node.module] else: continue - assert all(name.split('.')[0] in sys.stdlib_module_names | {'anysolver', 'numpy'} for name in imports) + assert all(name.split('.')[0] in sys.stdlib_module_names | {'anyfesolver', 'numpy'} for name in imports) def test_external_archive_and_cycle_equality(): diff --git a/tests/test_ge_beam3_pose_joint.py b/tests/test_ge_beam3_pose_joint.py index 49b563dff..319d14c79 100644 --- a/tests/test_ge_beam3_pose_joint.py +++ b/tests/test_ge_beam3_pose_joint.py @@ -11,9 +11,9 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_pose_joint import RigidPoseJoint -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver._ge_beam3_pose_joint import RigidPoseJoint +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.control import CancellationToken, SolveCancelled def exp(v): diff --git a/tests/test_ge_beam3_precise_continuation.py b/tests/test_ge_beam3_precise_continuation.py index 3fe64bee7..4d324a993 100644 --- a/tests/test_ge_beam3_precise_continuation.py +++ b/tests/test_ge_beam3_precise_continuation.py @@ -1,9 +1,9 @@ from copy import deepcopy from hashlib import sha256 import pytest -from anysolver import _ge_beam3_elastic_seed_continuation as owner -from anysolver.control import CancellationToken -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver import _ge_beam3_elastic_seed_continuation as owner +from anyfesolver.control import CancellationToken +from anyfesolver._ge_beam3_p5_seeded.core import canonical from docs.reference_cases.ge_beam3_precise_continuation import recipe,adjudicate,source,ARCHIVE,INPUTS from docs.reference_cases.ge_beam3_precise_work_enrollment import enroll from test_ge_beam3_precise_work_enrollment import original,precise_model diff --git a/tests/test_ge_beam3_precise_geometric_work.py b/tests/test_ge_beam3_precise_geometric_work.py index 8bf8f5d9f..f5e0c0133 100644 --- a/tests/test_ge_beam3_precise_geometric_work.py +++ b/tests/test_ge_beam3_precise_geometric_work.py @@ -4,10 +4,10 @@ import numpy as np import pytest from scipy.spatial.transform import Rotation -from anysolver import _ge_beam3_precise_geometric_work as precise -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_retained_generalized import RetainedGeneralizedOperator -from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection +from anyfesolver import _ge_beam3_precise_geometric_work as precise +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_retained_generalized import RetainedGeneralizedOperator +from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection from docs.reference_cases.ge_beam3_refined_controlled_case import model @@ -123,7 +123,7 @@ def test_native_finite_variations_and_material_origin(plastic): def test_explicit_arithmetic_identity_and_mutation(): source=model(2).mesh.elements[1] - from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement as Element + from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement as Element old=Element(1,source.node_ids,source.operator.reference,source.section) new=Element(1,source.node_ids,source.operator.reference,source.section,arithmetic_policy=precise.POLICY) assert old.identity==source.identity and old.to_dict()==source.to_dict() diff --git a/tests/test_ge_beam3_precise_work_enrollment.py b/tests/test_ge_beam3_precise_work_enrollment.py index d6b47d7e0..2b6c3fa1f 100644 --- a/tests/test_ge_beam3_precise_work_enrollment.py +++ b/tests/test_ge_beam3_precise_work_enrollment.py @@ -1,10 +1,10 @@ from hashlib import sha256 import json import pytest -from anysolver import _ge_beam3_elastic_seed_continuation as owner -from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement as Element -from anysolver._ge_beam3_precise_geometric_work import POLICY -from anysolver._ge_beam3_p5_seeded.core import canonical,sha +from anyfesolver import _ge_beam3_elastic_seed_continuation as owner +from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement as Element +from anyfesolver._ge_beam3_precise_geometric_work import POLICY +from anyfesolver._ge_beam3_p5_seeded.core import canonical,sha from docs.reference_cases.ge_beam3_precise_work_enrollment import enroll from test_ge_beam3_elastic_seed_continuation import seed,model,programme diff --git a/tests/test_ge_beam3_preserved_adaptive_arch.py b/tests/test_ge_beam3_preserved_adaptive_arch.py index de6890175..c791d7c43 100644 --- a/tests/test_ge_beam3_preserved_adaptive_arch.py +++ b/tests/test_ge_beam3_preserved_adaptive_arch.py @@ -78,11 +78,11 @@ def test_preserved_arch_assessment(origin, tmp_path): import numpy as np from test_ge_beam3_schur_line_program import save from test_ge_beam3_uniform_arch_sixteen import make, SECTION - from anysolver._ge_beam3_native_arc import ArcProgram - from anysolver._ge_beam3_native_arc_adaptive import AdaptiveArcProgram, decode_checkpoint, wrap_checkpoint - from anysolver._ge_beam3_native_arc_source import TranslationArcSource - from anysolver._ge_beam3_native_history_profile import HISTORY8M, load - from anysolver._ge_beam3_native_generalized_recovery import recover_native_fields + from anyfesolver._ge_beam3_native_arc import ArcProgram + from anyfesolver._ge_beam3_native_arc_adaptive import AdaptiveArcProgram, decode_checkpoint, wrap_checkpoint + from anyfesolver._ge_beam3_native_arc_source import TranslationArcSource + from anyfesolver._ge_beam3_native_history_profile import HISTORY8M, load + from anyfesolver._ge_beam3_native_generalized_recovery import recover_native_fields from docs.reference_cases.ge_beam3_native_control_slope import accepted_slope from docs.reference_cases.ge_beam3_uniform_arch_reference import solve as continuum from docs.reference_cases.ge_beam3_uniform_arch_fields import fields diff --git a/tests/test_ge_beam3_public_workflows.py b/tests/test_ge_beam3_public_workflows.py index 6e5994ce7..3059946f2 100644 --- a/tests/test_ge_beam3_public_workflows.py +++ b/tests/test_ge_beam3_public_workflows.py @@ -4,8 +4,8 @@ import numpy as np import pytest -from anysolver import ge_beam3_native as api -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver import ge_beam3_native as api +from anyfesolver._ge_beam3_p5_seeded.core import canonical from test_ge_beam3_native_analysis import analysis from test_ge_beam3_native_generalized import problem as generalized from test_ge_beam3_native_fibre_static_element import problem as fibre @@ -107,15 +107,15 @@ def test_profile_does_not_self_declare_artifact_acceptance_or_relabel_history(): assert 'production_qualified' not in value assert api.PROFILE_SHA256 == sha256(api.PROFILE_BYTES).hexdigest() assert set(api.__all__) <= set(vars(api)) - from anysolver.ge_beam3_element import GeometricallyExactBeam3D3NElement + from anyfesolver.ge_beam3_element import GeometricallyExactBeam3D3NElement assert GeometricallyExactBeam3D3NElement.formulation_id == 'GE_BEAM3_DC_MIXED_K1_MACRO_V2' def test_exported_programs_are_exact_existing_workflow_types(): - from anysolver._ge_beam3_retained_nodal_loading import Program as Nodal - from anysolver._ge_beam3_retained_generalized_state import Program as Distributed - from anysolver._ge_beam3_retained_translation_control import Program as Translation - from anysolver._ge_beam3_retained_fibre_control import TranslationProgram as FibreTranslation + from anyfesolver._ge_beam3_retained_nodal_loading import Program as Nodal + from anyfesolver._ge_beam3_retained_generalized_state import Program as Distributed + from anyfesolver._ge_beam3_retained_translation_control import Program as Translation + from anyfesolver._ge_beam3_retained_fibre_control import TranslationProgram as FibreTranslation assert api.NodalProgram is Nodal assert api.DistributedProgram is Distributed assert api.TranslationProgram is Translation diff --git a/tests/test_ge_beam3_q4_affine_numerical_recovery.py b/tests/test_ge_beam3_q4_affine_numerical_recovery.py index 307fe2ceb..81336e0d3 100644 --- a/tests/test_ge_beam3_q4_affine_numerical_recovery.py +++ b/tests/test_ge_beam3_q4_affine_numerical_recovery.py @@ -19,16 +19,16 @@ ROOT=Path(__file__).resolve().parents[1] sys.path.insert(0,str(ROOT/'docs/reference_cases')) -from anysolver import _ge_beam3_g3c_affine_q4_recovery as candidate -from anysolver import _ge_beam3_g3c_affine_q4_registry as registry +from anyfesolver import _ge_beam3_g3c_affine_q4_recovery as candidate +from anyfesolver import _ge_beam3_g3c_affine_q4_registry as registry import ge_beam3_q4_affine_numerical_checker as checker -from anysolver import _ge_beam3_g3c_affine_q4_chart as stable_chart -from anysolver import _ge_beam3_g3c_affine_q4_increment_chart as increment_chart -from anysolver import _ge_beam3_g3c_so3_numerics as stable_so3 -from anysolver import _ge_beam3_variational_shell as original_fit -from anysolver import _ge_beam3_mixed_ad as original_ad -from anysolver import _ge_beam3_g3c_local_shell as original_shell -from anysolver import _ge_beam3_pose_joint as original_joint +from anyfesolver import _ge_beam3_g3c_affine_q4_chart as stable_chart +from anyfesolver import _ge_beam3_g3c_affine_q4_increment_chart as increment_chart +from anyfesolver import _ge_beam3_g3c_so3_numerics as stable_so3 +from anyfesolver import _ge_beam3_variational_shell as original_fit +from anyfesolver import _ge_beam3_mixed_ad as original_ad +from anyfesolver import _ge_beam3_g3c_local_shell as original_shell +from anyfesolver import _ge_beam3_pose_joint as original_joint SCIENTIFIC_RECORDS=[] CONTRADICTIONS=[] @@ -38,14 +38,14 @@ _OBSERVATIONS={} _CURRENT_OBSERVATION=None SOURCES={ - 'src/anysolver/e4_pl_element.py':'7fc46a18046e043512a5fb2c3f61ed0b95b834e4dde764f63c500a885e87ea38', - 'src/anysolver/elements.py':'f8c59792947a3c9b84416c61a4d9db98e42926d1bf21e74e736afbf6a9a88b37', - 'src/anysolver/_ge_beam3_g3c_local_shell.py':'69d9f27a96ed7e9a5959a42a081eeafbbe72021de6e4da1f91355c5fb3850f10', - 'src/anysolver/_ge_beam3_variational_shell.py':'b0db7a83633f4a835c06e940a6f0de36ab958f7e816c37a23c6ebc16259a2a60', - 'src/anysolver/_ge_beam3_mixed_ad.py':'b299ff765cd2eaae8b33a2ba1d05069f6fe8c39209e1eac75df356a2afb1fe36', - 'src/anysolver/_ge_beam3_pose_joint.py':'69cfb0a71761ab7cad0d62080d81511949e7c920f7f70162bcaba0497b402657', - 'src/anysolver/_ge_beam3_g3c_definition.py':'4b46b870fec010e3378df83c374d763f858d8f25820c14f9704dc6f0a656f0c2', - 'src/anysolver/_ge_beam3_g3c_owner.py':'18b9565d56192e23f192b1a3fbae3cb12ed7ede958c0e4b3e46279a799d1afc5', + 'src/anyfesolver/e4_pl_element.py':'7fc46a18046e043512a5fb2c3f61ed0b95b834e4dde764f63c500a885e87ea38', + 'src/anyfesolver/elements.py':'f8c59792947a3c9b84416c61a4d9db98e42926d1bf21e74e736afbf6a9a88b37', + 'src/anyfesolver/_ge_beam3_g3c_local_shell.py':'69d9f27a96ed7e9a5959a42a081eeafbbe72021de6e4da1f91355c5fb3850f10', + 'src/anyfesolver/_ge_beam3_variational_shell.py':'b0db7a83633f4a835c06e940a6f0de36ab958f7e816c37a23c6ebc16259a2a60', + 'src/anyfesolver/_ge_beam3_mixed_ad.py':'b299ff765cd2eaae8b33a2ba1d05069f6fe8c39209e1eac75df356a2afb1fe36', + 'src/anyfesolver/_ge_beam3_pose_joint.py':'69cfb0a71761ab7cad0d62080d81511949e7c920f7f70162bcaba0497b402657', + 'src/anyfesolver/_ge_beam3_g3c_definition.py':'4b46b870fec010e3378df83c374d763f858d8f25820c14f9704dc6f0a656f0c2', + 'src/anyfesolver/_ge_beam3_g3c_owner.py':'18b9565d56192e23f192b1a3fbae3cb12ed7ede958c0e4b3e46279a799d1afc5', 'docs/reference_cases/ge_beam3_g3c_fixtures_v1.json':'d5fecc80c3203ac7d191b4031d64bf35c56d2900066cb01fc1dfa4276d24c006'} @@ -279,14 +279,14 @@ def chart_authority(): assert registry._exp_terms is original_joint._exp_terms assert registry._exp_terms.__globals__['so3_exp'] is original_ad.so3_exp sources={ - 'src/anysolver/_ge_beam3_g3c_affine_q4_chart.py':'2a26742ec7680a5e75934fb32ee8601d3877cd0befb250489f991f1b9d198a9f', + 'src/anyfesolver/_ge_beam3_g3c_affine_q4_chart.py':'2a26742ec7680a5e75934fb32ee8601d3877cd0befb250489f991f1b9d198a9f', 'docs/reference_cases/ge_beam3_q4_affine_numerical_chart.py':'b7cc92f70d35e3b8f2ab10202cb2f3ad1116e92775425888e482293b323c23ac', - 'src/anysolver/_ge_beam3_g3c_so3_numerics.py':'588ace39570658f1a83c0110d3a019ebad770d6091b271ff4bbc40b97f96e12e', + 'src/anyfesolver/_ge_beam3_g3c_so3_numerics.py':'588ace39570658f1a83c0110d3a019ebad770d6091b271ff4bbc40b97f96e12e', 'docs/GE_BEAM3_G3C_SO3_NUMERICS_CONTRACT.md':'269bcd4e1fda151e7c22c396a70c43498e8450b222c263dd2655b9ca45998496', 'docs/reference_cases/ge_beam3_g3c_so3_numerics_implementation_review_v1.json':'4debde89b44c990478487dda4852d7734b852ca01dfb2d3626e782c2328756f1', 'docs/reference_cases/ge_beam3_g3c_so3_numerics_confirmation_receipt_v1.json':'aa7225cae347662bf92b3c02f8a1ff541d40e67f13db21900d0ad3269f88b91f', 'docs/reference_cases/ge_beam3_g3c_so3_numerics_result_v1.json':'c8b938bbdbcce329aa83afc00037905d158142d7d2e417acee159bab95aba6fd', - 'src/anysolver/_ge_beam3_g3c_affine_q4_registry.py':'5f208b716d89ba778193d1261fb5975db4ece68c93fa2efce97e5c129c56acf1'} + 'src/anyfesolver/_ge_beam3_g3c_affine_q4_registry.py':'5f208b716d89ba778193d1261fb5975db4ece68c93fa2efce97e5c129c56acf1'} addendum='1eb29b8814e6555e7d16569e2c8d30c828a60458dea4a2801c10f4d58d2c2176' review='ca6de27e79186c9e0b37bf21e765322aa8e46dc323eb858db039951fec7efeab' increment_addendum='7e637ff69453715e5251614d76e08d2be7c7fd8ac4932c5fd7a4cc939023caf0' diff --git a/tests/test_ge_beam3_q4_affine_recovery.py b/tests/test_ge_beam3_q4_affine_recovery.py index 9503c912f..361169748 100644 --- a/tests/test_ge_beam3_q4_affine_recovery.py +++ b/tests/test_ge_beam3_q4_affine_recovery.py @@ -20,13 +20,13 @@ SCIENTIFIC_RECORDS=[] FIXTURES=('AFFINE_Q4_SQUARE','AFFINE_Q4_RECTANGLE','AFFINE_Q4_RHOMBUS') SOURCE_BINDINGS={ - 'src/anysolver/e4_pl_element.py':'7fc46a18046e043512a5fb2c3f61ed0b95b834e4dde764f63c500a885e87ea38', - 'src/anysolver/elements.py':'f8c59792947a3c9b84416c61a4d9db98e42926d1bf21e74e736afbf6a9a88b37', - 'src/anysolver/_ge_beam3_g3c_local_shell.py':'69d9f27a96ed7e9a5959a42a081eeafbbe72021de6e4da1f91355c5fb3850f10', + 'src/anyfesolver/e4_pl_element.py':'7fc46a18046e043512a5fb2c3f61ed0b95b834e4dde764f63c500a885e87ea38', + 'src/anyfesolver/elements.py':'f8c59792947a3c9b84416c61a4d9db98e42926d1bf21e74e736afbf6a9a88b37', + 'src/anyfesolver/_ge_beam3_g3c_local_shell.py':'69d9f27a96ed7e9a5959a42a081eeafbbe72021de6e4da1f91355c5fb3850f10', 'docs/GE_BEAM3_G3C_MATRIX_SHELL_CONTRACT.md':'59a09dc7db6256a145520ae7b4f2d325dee1abca5d5b5c381a7ada57a2ad92fd', 'docs/GE_BEAM3_G3C_MO16_SOURCE_ASSESSMENT.md':'e6b702fba5c32ef22537a137fc150fa54b63028c6910df96c5c5f0c6a722026e', 'docs/reference_cases/ge_beam3_g3c_fixtures_v1.json':'d5fecc80c3203ac7d191b4031d64bf35c56d2900066cb01fc1dfa4276d24c006', - 'src/anysolver/_ge_beam3_g3c_definition.py':'4b46b870fec010e3378df83c374d763f858d8f25820c14f9704dc6f0a656f0c2'} + 'src/anyfesolver/_ge_beam3_g3c_definition.py':'4b46b870fec010e3378df83c374d763f858d8f25820c14f9704dc6f0a656f0c2'} def canonical(value): diff --git a/tests/test_ge_beam3_q4_recovery_coefficient_audit.py b/tests/test_ge_beam3_q4_recovery_coefficient_audit.py index a06d3a840..92119b29a 100644 --- a/tests/test_ge_beam3_q4_recovery_coefficient_audit.py +++ b/tests/test_ge_beam3_q4_recovery_coefficient_audit.py @@ -29,9 +29,9 @@ SCIENTIFIC_RECORDS = [] SOURCE_BINDINGS = { - 'src/anysolver/e4_pl_element.py': (293258, '7fc46a18046e043512a5fb2c3f61ed0b95b834e4dde764f63c500a885e87ea38'), - 'src/anysolver/elements.py': (244692, 'f8c59792947a3c9b84416c61a4d9db98e42926d1bf21e74e736afbf6a9a88b37'), - 'src/anysolver/_ge_beam3_g3c_local_shell.py': (19430, '69d9f27a96ed7e9a5959a42a081eeafbbe72021de6e4da1f91355c5fb3850f10'), + 'src/anyfesolver/e4_pl_element.py': (293258, '7fc46a18046e043512a5fb2c3f61ed0b95b834e4dde764f63c500a885e87ea38'), + 'src/anyfesolver/elements.py': (244692, 'f8c59792947a3c9b84416c61a4d9db98e42926d1bf21e74e736afbf6a9a88b37'), + 'src/anyfesolver/_ge_beam3_g3c_local_shell.py': (19430, '69d9f27a96ed7e9a5959a42a081eeafbbe72021de6e4da1f91355c5fb3850f10'), 'docs/GE_BEAM3_G3C_MATRIX_SHELL_CONTRACT.md': (9625, '59a09dc7db6256a145520ae7b4f2d325dee1abca5d5b5c381a7ada57a2ad92fd'), 'docs/GE_BEAM3_G3C_MO16_SOURCE_ASSESSMENT.md': (7666, 'e6b702fba5c32ef22537a137fc150fa54b63028c6910df96c5c5f0c6a722026e'), } diff --git a/tests/test_ge_beam3_qualification_runner.py b/tests/test_ge_beam3_qualification_runner.py index 1b398e4f6..640a38506 100644 --- a/tests/test_ge_beam3_qualification_runner.py +++ b/tests/test_ge_beam3_qualification_runner.py @@ -213,7 +213,7 @@ def test_physical_registered_inventories_are_exact_and_inert(self): self.assertEqual(sum(row['kind']=='mutation' for row in inventories['rehearsal']),136) self.assertEqual([row['case']['case_id'] for row in inventories['smoke']], [graph+'::BASE::S0::NONE' for graph in r.physical_support().GRAPHS]) - self.assertNotIn('numpy',sys.modules);self.assertNotIn('anysolver',sys.modules) + self.assertNotIn('numpy',sys.modules);self.assertNotIn('anyfesolver',sys.modules) def test_physical_formal_case_association_is_exact_and_complete(self): rows=r.physical_formal_case_associations();inventory=r.physical_inventory('formal') @@ -350,7 +350,7 @@ def test_physical_formal_execution_remains_locked_and_worker_import_is_guarded(s and 'formal runtime authority' in ast.get_source_segment(source,node)) self.assertLess(runtime_guard,authority_line) imports=[node for node in ast.walk(worker) if isinstance(node,(ast.Import,ast.ImportFrom)) - and (getattr(node,'module','')or'').startswith('anysolver')] + and (getattr(node,'module','')or'').startswith('anyfesolver')] self.assertTrue(imports);self.assertTrue(all(node.lineno>authority_line for node in imports)) formal_test=(Path(r.__file__).resolve().parents[1]/r.PHYSICAL_FORMAL_TEST).read_text(encoding='utf-8') formal_tree=ast.parse(formal_test);case=next(node for node in formal_tree.body @@ -627,7 +627,7 @@ def test_physical_union_finalizer_has_no_mechanics_import(self): def test_physical_review_schema_and_mutations(self): candidate=dict(commit='a'*40,tree='b'*40) rows={'docs/reference_cases/ge_beam3_g3c_fixtures_v1.json':dict(bytes=1,sha256='c'*64), - 'src/anysolver/_ge_beam3_g3c_definition.py':dict(bytes=1,sha256='d'*64)} + 'src/anyfesolver/_ge_beam3_g3c_definition.py':dict(bytes=1,sha256='d'*64)} scope=dict(scope_id=r.SCOPE,gate='g3c-physical',subject_tree=candidate['tree'], inputs_sha256=sha256(r.canonical(rows)).hexdigest(),contract_sha256=r.PHYSICAL_PLAN_SHA, partition_addendum_sha256=r.PHYSICAL_PARTITION_ADDENDUM_SHA, @@ -952,7 +952,7 @@ def test_exception_closes_and_drains_no_canonical_output(self): self.assertFalse((root/'scientific.json').exists());self.assertTrue((root/'process.json').exists()) def test_no_mechanics_import_before_authority(self): - self.assertNotIn('numpy',sys.modules);self.assertNotIn('anysolver',sys.modules) + self.assertNotIn('numpy',sys.modules);self.assertNotIn('anyfesolver',sys.modules) def test_checker_gate_and_replica_before_import(self): with self.assertRaises(ValueError):r.q4_checker(Path('.'),'wrong','1','bad') diff --git a/tests/test_ge_beam3_reassembled_modes_checkpoint.py b/tests/test_ge_beam3_reassembled_modes_checkpoint.py index a8f4ee7d6..9ee941269 100644 --- a/tests/test_ge_beam3_reassembled_modes_checkpoint.py +++ b/tests/test_ge_beam3_reassembled_modes_checkpoint.py @@ -101,7 +101,7 @@ def git(*args): def test_adapter_imports_preserved_mechanics_split_without_redefinition(): - path = ROOT / 'src/anysolver/_ge_beam3_reassembled_signed_modes.py' + path = ROOT / 'src/anyfesolver/_ge_beam3_reassembled_signed_modes.py' tree = ast.parse(path.read_text()) assert any(isinstance(n, ast.ImportFrom) and n.module == '_ge_beam3_seeded_signed_modes' and [a.name for a in n.names] == ['_split'] for n in ast.walk(tree)) @@ -120,8 +120,8 @@ def test_historical_covariance_failure_test_is_not_modified_or_relaxed(): def test_result_types_keep_private_scope_flags(): - from anysolver._native_reassembled_factor_modes import ReassembledFactorModes - from anysolver._ge_beam3_reassembled_signed_modes import SignedLoadedModes + from anyfesolver._native_reassembled_factor_modes import ReassembledFactorModes + from anyfesolver._ge_beam3_reassembled_signed_modes import SignedLoadedModes for cls in (ReassembledFactorModes, SignedLoadedModes): assert cls.__dataclass_fields__['production_qualified'].default is False assert cls.__dataclass_fields__['certified_intervals'].default is False diff --git a/tests/test_ge_beam3_reassembled_modes_installed.py b/tests/test_ge_beam3_reassembled_modes_installed.py index 51f195080..a8691161e 100644 --- a/tests/test_ge_beam3_reassembled_modes_installed.py +++ b/tests/test_ge_beam3_reassembled_modes_installed.py @@ -102,7 +102,7 @@ def command(argv, cwd, name, limit=180): 'from setuptools.build_meta import build_wheel; import sys; build_wheel(sys.argv[1])', str(wheels)], build, 'build') candidates = list(wheels.glob('*.whl')); assert len(candidates) == 1; wheel = candidates[0] with zipfile.ZipFile(wheel) as archive: - assert all('anysolver/'+name in archive.namelist() for name in ( + assert all('anyfesolver/'+name in archive.namelist() for name in ( '_native_reassembled_factor_modes.py', '_ge_beam3_reassembled_signed_modes.py', '_dyadic_bilinear.py')) assert not any(name.startswith(('docs/', 'tests/')) for name in archive.namelist()) environment = tmp_path/'environment' diff --git a/tests/test_ge_beam3_reassembled_native_modes.py b/tests/test_ge_beam3_reassembled_native_modes.py index 72346eb9d..d78482c00 100644 --- a/tests/test_ge_beam3_reassembled_native_modes.py +++ b/tests/test_ge_beam3_reassembled_native_modes.py @@ -3,13 +3,13 @@ from copy import deepcopy import numpy as np import pytest -import anysolver._ge_beam3_reassembled_signed_modes as adapter -from anysolver._ge_beam3_seeded_loaded_modal import solve_elastic_modes -from anysolver._ge_beam3_seeded_load_program import ForceProgram, solve_force_program -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_p5_seeded import NativeP5BeamElement -from anysolver._ge_beam3_p5.algebra import rotation as proper_rotation -from anysolver.control import CancellationToken, SolveCancelled +import anyfesolver._ge_beam3_reassembled_signed_modes as adapter +from anyfesolver._ge_beam3_seeded_loaded_modal import solve_elastic_modes +from anyfesolver._ge_beam3_seeded_load_program import ForceProgram, solve_force_program +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_p5_seeded import NativeP5BeamElement +from anyfesolver._ge_beam3_p5.algebra import rotation as proper_rotation +from anyfesolver.control import CancellationToken, SolveCancelled from test_ge_beam3_curved_contrast_probe import make_curved, ROTATION from test_ge_beam3_seeded_load_program import problem from test_ge_beam3_curved_p5_mass_probe import section_mass diff --git a/tests/test_ge_beam3_reassembled_spectrum_probe.py b/tests/test_ge_beam3_reassembled_spectrum_probe.py index 04ebd6a07..4e44e9e6f 100644 --- a/tests/test_ge_beam3_reassembled_spectrum_probe.py +++ b/tests/test_ge_beam3_reassembled_spectrum_probe.py @@ -4,10 +4,10 @@ import numpy as np import pytest from docs.reference_cases.ge_beam3_reassembled_spectrum_probe import solve -from anysolver._native_reassembled_factor_modes import solve_reassembled_factor_modes as native_solve +from anyfesolver._native_reassembled_factor_modes import solve_reassembled_factor_modes as native_solve from test_ge_beam3_seeded_reduction_diagnostic import test_capture_reference_factor_reduction as capture from test_ge_beam3_curved_contrast_probe import ROTATION -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_p5_seeded.core import canonical from docs.reference_cases.ge_beam3_decimal_factor_audit import factor_roots diff --git a/tests/test_ge_beam3_reference_factor_spectrum_checkpoint.py b/tests/test_ge_beam3_reference_factor_spectrum_checkpoint.py index 8d8857c45..5d5a142df 100644 --- a/tests/test_ge_beam3_reference_factor_spectrum_checkpoint.py +++ b/tests/test_ge_beam3_reference_factor_spectrum_checkpoint.py @@ -38,7 +38,7 @@ def test_exact_source_bindings_and_no_old_source_replacement(): raw = path.read_text(encoding='utf-8').encode('utf-8') assert len(raw) == row['bytes'] and hashlib.sha256(raw).hexdigest() == row['sha256'] assert {r['path'] for r in record['sources'] if r['path'].startswith('src/')} == { - 'src/anysolver/_native_reference_factor_spectrum.py', 'src/anysolver/_ge_beam3_virgin_reference_modes.py'} + 'src/anyfesolver/_native_reference_factor_spectrum.py', 'src/anyfesolver/_ge_beam3_virgin_reference_modes.py'} def test_failed_evidence_preserved_without_fabricated_absent_output(): diff --git a/tests/test_ge_beam3_reference_identity.py b/tests/test_ge_beam3_reference_identity.py index fe130d95a..29a744a0d 100644 --- a/tests/test_ge_beam3_reference_identity.py +++ b/tests/test_ge_beam3_reference_identity.py @@ -3,8 +3,8 @@ import ast, inspect import numpy as np import pytest -from anysolver import _ge_beam3_reference_identity as identity -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference +from anyfesolver import _ge_beam3_reference_identity as identity +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference from test_ge_beam3_centered_reference import fixture from test_ge_beam3_native_generalized_modal import make diff --git a/tests/test_ge_beam3_relative_spectrum_engineering.py b/tests/test_ge_beam3_relative_spectrum_engineering.py index df926001e..c53990db2 100644 --- a/tests/test_ge_beam3_relative_spectrum_engineering.py +++ b/tests/test_ge_beam3_relative_spectrum_engineering.py @@ -8,12 +8,12 @@ import numpy as np import pytest -from anysolver._ge_beam3_relative_virgin_reference_modes import solve_relative_virgin_reference_modes -from anysolver._ge_beam3_p5_loads import NativeP5BeamElement, DirectedHardeningSection -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry -from anysolver._ge_beam3_p5_loads.core import canonical -from anysolver.fe_core import FEModel -from anysolver.boundary import BoundaryCondition +from anyfesolver._ge_beam3_relative_virgin_reference_modes import solve_relative_virgin_reference_modes +from anyfesolver._ge_beam3_p5_loads import NativeP5BeamElement, DirectedHardeningSection +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry +from anyfesolver._ge_beam3_p5_loads.core import canonical +from anyfesolver.fe_core import FEModel +from anyfesolver.boundary import BoundaryCondition from docs.reference_cases.ge_beam3_straight_prestress_reference import StraightPrestress diff --git a/tests/test_ge_beam3_relative_spectrum_installed.py b/tests/test_ge_beam3_relative_spectrum_installed.py index 741ecc7d0..a80c2b68c 100644 --- a/tests/test_ge_beam3_relative_spectrum_installed.py +++ b/tests/test_ge_beam3_relative_spectrum_installed.py @@ -94,7 +94,7 @@ def command(argv, cwd, name, limit=180): 'from setuptools.build_meta import build_wheel; import sys; build_wheel(sys.argv[1])', str(wheels)], build, 'build') candidates = list(wheels.glob('*.whl')); assert len(candidates) == 1; wheel = candidates[0] with zipfile.ZipFile(wheel) as archive: - assert all('anysolver/'+name in archive.namelist() for name in ( + assert all('anyfesolver/'+name in archive.namelist() for name in ( '_relative_reference_svd.py', '_native_relative_reference_factor_spectrum.py', '_ge_beam3_relative_virgin_reference_modes.py')) assert not any(name.startswith(('docs/', 'tests/')) for name in archive.namelist()) diff --git a/tests/test_ge_beam3_relative_svd_probe.py b/tests/test_ge_beam3_relative_svd_probe.py index 16c172746..29fb0ce96 100644 --- a/tests/test_ge_beam3_relative_svd_probe.py +++ b/tests/test_ge_beam3_relative_svd_probe.py @@ -6,7 +6,7 @@ import pytest from docs.reference_cases.ge_beam3_relative_svd_probe import jacobi_svd, beam_comparison -from anysolver._ge_beam3_p5_loads.core import canonical +from anyfesolver._ge_beam3_p5_loads.core import canonical @pytest.mark.parametrize('amplitude', [1., 1e8, 1e16]) diff --git a/tests/test_ge_beam3_relative_virgin_reference_modes.py b/tests/test_ge_beam3_relative_virgin_reference_modes.py index 93ce9ca76..05db85be6 100644 --- a/tests/test_ge_beam3_relative_virgin_reference_modes.py +++ b/tests/test_ge_beam3_relative_virgin_reference_modes.py @@ -3,12 +3,12 @@ import numpy as np import pytest -from anysolver._ge_beam3_relative_virgin_reference_modes import solve_relative_virgin_reference_modes -from anysolver._ge_beam3_p5_loads import NativeP5BeamElement, DirectedHardeningSection -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry -from anysolver._ge_beam3_p5_loads.core import canonical -from anysolver.fe_core import FEModel -from anysolver.boundary import BoundaryCondition +from anyfesolver._ge_beam3_relative_virgin_reference_modes import solve_relative_virgin_reference_modes +from anyfesolver._ge_beam3_p5_loads import NativeP5BeamElement, DirectedHardeningSection +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry +from anyfesolver._ge_beam3_p5_loads.core import canonical +from anyfesolver.fe_core import FEModel +from anyfesolver.boundary import BoundaryCondition from test_ge_beam3_native_load_state import problem @@ -55,7 +55,7 @@ def test_curved_coupled_reference_keeps_six_rigid_modes(): @pytest.mark.parametrize('kind', ['displaced', 'loaded_state', 'missing_state', 'bad_inertia']) def test_nonvirgin_or_invalid_inputs_cannot_enter_reference_kernel(kind, monkeypatch): - import anysolver._ge_beam3_relative_virgin_reference_modes as adapter + import anyfesolver._ge_beam3_relative_virgin_reference_modes as adapter from test_ge_beam3_loaded_modal import accepted model = problem(); states = initial(model); total = np.zeros(18) inertias = {1: np.eye(6)} @@ -71,7 +71,7 @@ def forbidden(*args, **kwargs): raise AssertionError('reference factor kernel mu def test_model_changed_inside_reference_solver_is_rejected_after_return(monkeypatch): - import anysolver._ge_beam3_relative_virgin_reference_modes as adapter + import anyfesolver._ge_beam3_relative_virgin_reference_modes as adapter model = problem(); states = initial(model); solve = adapter.solve_relative_reference_factor_spectrum def changed(*args, **kwargs): result = solve(*args, **kwargs) diff --git a/tests/test_ge_beam3_retained_arc.py b/tests/test_ge_beam3_retained_arc.py index 93857c372..37d7868be 100644 --- a/tests/test_ge_beam3_retained_arc.py +++ b/tests/test_ge_beam3_retained_arc.py @@ -5,11 +5,11 @@ from types import SimpleNamespace import numpy as np import pytest -from anysolver import _ge_beam3_retained_arc as arc -from anysolver._ge_beam3_retained_arc_geometry import frame_terms, constraint -from anysolver._ge_beam3_p5.algebra import rotation, skew -from anysolver._ge_beam3_p5_seeded.core import canonical, sha -from anysolver.control import CancellationToken +from anyfesolver import _ge_beam3_retained_arc as arc +from anyfesolver._ge_beam3_retained_arc_geometry import frame_terms, constraint +from anyfesolver._ge_beam3_p5.algebra import rotation, skew +from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha +from anyfesolver.control import CancellationToken from test_ge_beam3_native_generalized_modal import make from test_ge_beam3_schur_line_program import save diff --git a/tests/test_ge_beam3_retained_arc_modal.py b/tests/test_ge_beam3_retained_arc_modal.py index 61bf7b85e..5fc501e3f 100644 --- a/tests/test_ge_beam3_retained_arc_modal.py +++ b/tests/test_ge_beam3_retained_arc_modal.py @@ -3,10 +3,10 @@ from types import SimpleNamespace import numpy as np import pytest -from anysolver import _ge_beam3_retained_arc_modal as modal -from anysolver import _ge_beam3_retained_nodal_loading as nodal -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver import _ge_beam3_retained_arc_modal as modal +from anyfesolver import _ge_beam3_retained_nodal_loading as nodal +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.control import CancellationToken, SolveCancelled from docs.reference_cases import ge_beam3_retained_arch_case as case from docs.reference_cases.ge_beam3_retained_arc_spectrum import planar_partition diff --git a/tests/test_ge_beam3_retained_arch.py b/tests/test_ge_beam3_retained_arch.py index eb54d5401..a433f5e11 100644 --- a/tests/test_ge_beam3_retained_arch.py +++ b/tests/test_ge_beam3_retained_arch.py @@ -5,7 +5,7 @@ import numpy as np import pytest from docs.reference_cases import ge_beam3_retained_arch_case as case -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_p5_seeded.core import canonical from test_ge_beam3_schur_line_program import save diff --git a/tests/test_ge_beam3_retained_fibre.py b/tests/test_ge_beam3_retained_fibre.py index 284ce1051..4879d042e 100644 --- a/tests/test_ge_beam3_retained_fibre.py +++ b/tests/test_ge_beam3_retained_fibre.py @@ -3,12 +3,12 @@ import numpy as np import pytest -from anysolver.fe_core import FEModel -from anysolver.boundary import BoundaryCondition -from anysolver._ge_beam3_retained_fibre_element import NativeRetainedFibreElement -from anysolver._ge_beam3_p5.algebra import rotation -from anysolver._ge_beam3_p5.compensated_coordinates import split_sum -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.fe_core import FEModel +from anyfesolver.boundary import BoundaryCondition +from anyfesolver._ge_beam3_retained_fibre_element import NativeRetainedFibreElement +from anyfesolver._ge_beam3_p5.algebra import rotation +from anyfesolver._ge_beam3_p5.compensated_coordinates import split_sum +from anyfesolver._ge_beam3_p5_seeded.core import canonical from test_ge_beam3_curved_contrast_probe import make_curved from test_ge_beam3_fibre_section import section from test_ge_beam3_retained_plastic import args diff --git a/tests/test_ge_beam3_retained_fibre_checkpoint.py b/tests/test_ge_beam3_retained_fibre_checkpoint.py index 0bbdc3b11..a8d62ea71 100644 --- a/tests/test_ge_beam3_retained_fibre_checkpoint.py +++ b/tests/test_ge_beam3_retained_fibre_checkpoint.py @@ -60,7 +60,7 @@ def test_native_runtime_has_no_research_or_legacy_beam_mechanics_dependency(): assert not any(name.startswith(('docs.', 'tests.')) for name in imports) names = {node.id for node in ast.walk(tree) if isinstance(node, ast.Name)} assert not names & {'QuadraticBeamElement', 'RetainedPlasticOperator', 'RetainedElasticOperator'} - tree = ast.parse((ROOT/'src/anysolver/_ge_beam3_retained_fibre_state.py').read_text()) + tree = ast.parse((ROOT/'src/anyfesolver/_ge_beam3_retained_fibre_state.py').read_text()) layout = next(node for node in tree.body if isinstance(node, ast.ClassDef) and node.name == 'Layout') reused = [node.value.attr for node in layout.body if isinstance(node, ast.Assign) and isinstance(node.value, ast.Attribute) and isinstance(node.value.value, ast.Name) diff --git a/tests/test_ge_beam3_retained_fibre_control.py b/tests/test_ge_beam3_retained_fibre_control.py index 2198e9ce8..765794239 100644 --- a/tests/test_ge_beam3_retained_fibre_control.py +++ b/tests/test_ge_beam3_retained_fibre_control.py @@ -4,10 +4,10 @@ import numpy as np import pytest -import anysolver._ge_beam3_retained_fibre_control as control -from anysolver._ge_beam3_retained_fibre_program import solve_force_program -from anysolver._ge_beam3_p5_seeded.core import canonical, sha -from anysolver.control import CancellationToken, SolveCancelled +import anyfesolver._ge_beam3_retained_fibre_control as control +from anyfesolver._ge_beam3_retained_fibre_program import solve_force_program +from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha +from anyfesolver.control import CancellationToken, SolveCancelled from test_ge_beam3_retained_fibre import make_model from test_ge_beam3_retained_fibre_state import program as force_program @@ -58,11 +58,11 @@ def test_physical_fibre_reversal_and_restart_are_transactional(contrast, tmp_pat def arch(): - from anysolver.fe_core import FEModel - from anysolver.boundary import BoundaryCondition - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference - from anysolver._ge_beam3_retained_fibre_element import NativeRetainedFibreElement - from anysolver._ge_beam3_fibre_section import PhysicalFibreSection, Fibre, FlowCurve + from anyfesolver.fe_core import FEModel + from anyfesolver.boundary import BoundaryCondition + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference + from anyfesolver._ge_beam3_retained_fibre_element import NativeRetainedFibreElement + from anyfesolver._ge_beam3_fibre_section import PhysicalFibreSection, Fibre, FlowCurve model = FEModel('small-physical-fibre-shallow-arch'); frames = [] for node, x in enumerate(np.linspace(-1., 1., 5), 1): model.add_node(node, float(x), float(.1*(1-x*x)), 0.) @@ -194,8 +194,8 @@ def test_iteration_failure_preserves_virgin_state(): def transformed_model(transform, shift=None): - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference - from anysolver._ge_beam3_retained_fibre_element import NativeRetainedFibreElement + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference + from anyfesolver._ge_beam3_retained_fibre_element import NativeRetainedFibreElement model = make_model(); shift = np.zeros(3) if shift is None else shift for node in model.mesh.nodes.values(): node.x, node.y, node.z = map(float, transform@node.coords()+shift) for eid, element in list(model.mesh.elements.items()): @@ -208,7 +208,7 @@ def transformed_model(transform, shift=None): def test_directional_control_under_large_common_rotation(accepted, tmp_path): - from anysolver._ge_beam3_p5.algebra import rotation + from anyfesolver._ge_beam3_p5.algebra import rotation p, result = accepted; transform = rotation([2.6, .8, -.3]) direction = tuple(map(float, transform@np.array(p.direction))) force = tuple(map(float, transform@np.array(p.nodal_forces[0][1:]))) diff --git a/tests/test_ge_beam3_retained_fibre_modal.py b/tests/test_ge_beam3_retained_fibre_modal.py index c17c5f3af..02739b1a9 100644 --- a/tests/test_ge_beam3_retained_fibre_modal.py +++ b/tests/test_ge_beam3_retained_fibre_modal.py @@ -6,15 +6,15 @@ import pytest from scipy.linalg import eigh -from anysolver import _ge_beam3_retained_fibre_modal as modal -from anysolver import _ge_beam3_retained_fibre_control as control -from anysolver import _ge_beam3_analysis_fibre_translation as route -from anysolver import _ge_beam3_fibre_reference_modal as reference_modal -from anysolver._ge_beam3_native_analysis import NativeBeamAnalysis -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_p5.algebra import rotation -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver import _ge_beam3_retained_fibre_modal as modal +from anyfesolver import _ge_beam3_retained_fibre_control as control +from anyfesolver import _ge_beam3_analysis_fibre_translation as route +from anyfesolver import _ge_beam3_fibre_reference_modal as reference_modal +from anyfesolver._ge_beam3_native_analysis import NativeBeamAnalysis +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_p5.algebra import rotation +from anyfesolver.control import CancellationToken, SolveCancelled from test_ge_beam3_retained_fibre import make_model from test_ge_beam3_retained_fibre_control import program, transformed_model from test_ge_beam3_analysis_fibre_translation import analysis diff --git a/tests/test_ge_beam3_retained_fibre_modes.py b/tests/test_ge_beam3_retained_fibre_modes.py index e2b418ea4..dd6c902f9 100644 --- a/tests/test_ge_beam3_retained_fibre_modes.py +++ b/tests/test_ge_beam3_retained_fibre_modes.py @@ -5,11 +5,11 @@ import pytest from scipy.linalg import eigh -import anysolver._ge_beam3_retained_fibre_modes as native -from anysolver._ge_beam3_retained_fibre_program import solve_force_program -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_station_resultant_cell import mul, tr, solve, ident -from anysolver.control import CancellationToken, SolveCancelled +import anyfesolver._ge_beam3_retained_fibre_modes as native +from anyfesolver._ge_beam3_retained_fibre_program import solve_force_program +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_station_resultant_cell import mul, tr, solve, ident +from anyfesolver.control import CancellationToken, SolveCancelled from test_ge_beam3_retained_fibre import make_model from test_ge_beam3_retained_fibre_state import program @@ -131,10 +131,10 @@ def altered(*args, **kwargs): def test_rebuilt_loaded_general_rotation_covariance(accepted, tmp_path): - from anysolver._ge_beam3_p5.algebra import rotation - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference - from anysolver._ge_beam3_retained_fibre_element import NativeRetainedFibreElement - from anysolver._ge_beam3_seeded_load_program import ForceProgram + from anyfesolver._ge_beam3_p5.algebra import rotation + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference + from anyfesolver._ge_beam3_retained_fibre_element import NativeRetainedFibreElement + from anyfesolver._ge_beam3_seeded_load_program import ForceProgram contrast, model, p, value, inertias = accepted transform = rotation([.4, -.3, .2]); other = make_model(contrast) for node in other.mesh.nodes.values(): diff --git a/tests/test_ge_beam3_retained_fibre_state.py b/tests/test_ge_beam3_retained_fibre_state.py index 7be6cf873..42e14d16d 100644 --- a/tests/test_ge_beam3_retained_fibre_state.py +++ b/tests/test_ge_beam3_retained_fibre_state.py @@ -4,11 +4,11 @@ import numpy as np import pytest -from anysolver.control import CancellationToken -from anysolver._ge_beam3_seeded_load_program import ForceProgram -from anysolver._ge_beam3_retained_fibre_program import solve_force_program -from anysolver._ge_beam3_retained_fibre_state import Context, Layout -from anysolver._ge_beam3_p5_seeded.core import canonical, sha +from anyfesolver.control import CancellationToken +from anyfesolver._ge_beam3_seeded_load_program import ForceProgram +from anyfesolver._ge_beam3_retained_fibre_program import solve_force_program +from anyfesolver._ge_beam3_retained_fibre_state import Context, Layout +from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha from test_ge_beam3_retained_fibre import make_model diff --git a/tests/test_ge_beam3_retained_force_state.py b/tests/test_ge_beam3_retained_force_state.py index 2a1545c4f..e9d3d279a 100644 --- a/tests/test_ge_beam3_retained_force_state.py +++ b/tests/test_ge_beam3_retained_force_state.py @@ -3,10 +3,10 @@ import json import numpy as np import pytest -from anysolver._ge_beam3_retained_force_program import ForceProgram, solve_force_program -from anysolver._ge_beam3_retained_state import Context -from anysolver._ge_beam3_p5_seeded.core import canonical, sha -from anysolver.control import CancellationToken +from anyfesolver._ge_beam3_retained_force_program import ForceProgram, solve_force_program +from anyfesolver._ge_beam3_retained_state import Context +from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha +from anyfesolver.control import CancellationToken from test_ge_beam3_curved_contrast_probe import make_curved from docs.reference_cases.ge_beam3_full_resultant_force_probe import solve_two_macro_probe @@ -160,7 +160,7 @@ def observe(row): def test_legacy_state_cannot_hot_restart_retained_candidate(): - from anysolver._ge_beam3_seeded_load_program import solve_force_program as historical + from anyfesolver._ge_beam3_seeded_load_program import solve_force_program as historical model, _ = make_curved(100.) old = historical(model, program(), stop_after=0) assert old.status == 'paused' diff --git a/tests/test_ge_beam3_retained_generalized_force_probe.py b/tests/test_ge_beam3_retained_generalized_force_probe.py index 52b46e844..07f566ff1 100644 --- a/tests/test_ge_beam3_retained_generalized_force_probe.py +++ b/tests/test_ge_beam3_retained_generalized_force_probe.py @@ -5,8 +5,8 @@ import numpy as np import pytest from docs.reference_cases import ge_beam3_retained_generalized_force_probe as probe -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_p5.algebra import rotation +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_p5.algebra import rotation from test_ge_beam3_generalized_slenderness_diagnostic import make from test_ge_beam3_schur_line_program import save diff --git a/tests/test_ge_beam3_retained_generalized_modal.py b/tests/test_ge_beam3_retained_generalized_modal.py index d1582a6db..99ab5de88 100644 --- a/tests/test_ge_beam3_retained_generalized_modal.py +++ b/tests/test_ge_beam3_retained_generalized_modal.py @@ -5,15 +5,15 @@ import json import numpy as np import pytest -from anysolver import _ge_beam3_retained_generalized_modal as modal -from anysolver import _ge_beam3_native_generalized_factor_modal as prior -from anysolver._ge_beam3_retained_generalized_state import Context,Program -from anysolver._ge_beam3_retained_generalized_program import solve -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_p5.algebra import rotation -from anysolver.control import CancellationToken,SolveCancelled +from anyfesolver import _ge_beam3_retained_generalized_modal as modal +from anyfesolver import _ge_beam3_native_generalized_factor_modal as prior +from anyfesolver._ge_beam3_retained_generalized_state import Context,Program +from anyfesolver._ge_beam3_retained_generalized_program import solve +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_p5.algebra import rotation +from anyfesolver.control import CancellationToken,SolveCancelled from test_ge_beam3_generalized_slenderness_diagnostic import make from test_ge_beam3_native_generalized_modal import make as connected from test_ge_beam3_schur_line_program import save diff --git a/tests/test_ge_beam3_retained_generalized_ownership.py b/tests/test_ge_beam3_retained_generalized_ownership.py index 5924ce250..15dca13d8 100644 --- a/tests/test_ge_beam3_retained_generalized_ownership.py +++ b/tests/test_ge_beam3_retained_generalized_ownership.py @@ -2,10 +2,10 @@ from dataclasses import replace import numpy as np import pytest -from anysolver._ge_beam3_retained_generalized_state import Context,Program -from anysolver._ge_beam3_retained_generalized_program import solve -from anysolver._ge_beam3_retained_generalized import RetainedGeneralizedOperator -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_retained_generalized_state import Context,Program +from anyfesolver._ge_beam3_retained_generalized_program import solve +from anyfesolver._ge_beam3_retained_generalized import RetainedGeneralizedOperator +from anyfesolver._ge_beam3_p5_seeded.core import canonical from test_ge_beam3_retained_generalized_state import model,LOAD,resume @pytest.mark.parametrize('kind',('copy','foreign','changed','mutated')) diff --git a/tests/test_ge_beam3_retained_generalized_state.py b/tests/test_ge_beam3_retained_generalized_state.py index 1799ea26c..772cb1676 100644 --- a/tests/test_ge_beam3_retained_generalized_state.py +++ b/tests/test_ge_beam3_retained_generalized_state.py @@ -4,12 +4,12 @@ import json import numpy as np import pytest -from anysolver._ge_beam3_retained_generalized_state import Context,Program -from anysolver._ge_beam3_retained_generalized_program import solve -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_p5_seeded.core import canonical,sha -from anysolver.control import CancellationToken +from anyfesolver._ge_beam3_retained_generalized_state import Context,Program +from anyfesolver._ge_beam3_retained_generalized_program import solve +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_p5_seeded.core import canonical,sha +from anyfesolver.control import CancellationToken from test_ge_beam3_generalized_slenderness_diagnostic import make from test_ge_beam3_native_generalized_restart import make as plastic_model,pattern as plastic_load from test_ge_beam3_schur_line_program import save diff --git a/tests/test_ge_beam3_retained_guard_cost.py b/tests/test_ge_beam3_retained_guard_cost.py index f0bbd4438..90f54f8a0 100644 --- a/tests/test_ge_beam3_retained_guard_cost.py +++ b/tests/test_ge_beam3_retained_guard_cost.py @@ -1,10 +1,10 @@ """Full input checking without repeated sparse support construction.""" from dataclasses import replace import pytest -from anysolver import _ge_beam3_retained_generalized_state as retained -from anysolver import _ge_beam3_native_generalized_restart as restart -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver import _ge_beam3_retained_generalized_state as retained +from anyfesolver import _ge_beam3_native_generalized_restart as restart +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern from test_ge_beam3_native_generalized_modal import make EMPTY=DistributedPattern(LinePattern(()),()) @@ -49,7 +49,7 @@ def test_full_guard_mutations(mutation,monkeypatch): dict(slave=12,masters={6:1.},value=0.,label='injected')],raising=False) elif mutation=='program':c.program=replace(c.program,targets=(.5,)) else: - from anysolver._ge_beam3_effective_deadline import effective_deadline_seconds + from anyfesolver._ge_beam3_effective_deadline import effective_deadline_seconds c.started-=effective_deadline_seconds(120)+1 with pytest.raises((ValueError,RuntimeError)):c.guard() diff --git a/tests/test_ge_beam3_retained_nodal_loading.py b/tests/test_ge_beam3_retained_nodal_loading.py index 7642cd27c..b5963ab4d 100644 --- a/tests/test_ge_beam3_retained_nodal_loading.py +++ b/tests/test_ge_beam3_retained_nodal_loading.py @@ -3,12 +3,12 @@ import json import numpy as np import pytest -from anysolver import _ge_beam3_retained_nodal_loading as nodal -from anysolver._ge_beam3_retained_generalized_state import Context,Program -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_p5_seeded.core import canonical,sha -from anysolver.control import CancellationToken +from anyfesolver import _ge_beam3_retained_nodal_loading as nodal +from anyfesolver._ge_beam3_retained_generalized_state import Context,Program +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_p5_seeded.core import canonical,sha +from anyfesolver.control import CancellationToken from test_ge_beam3_native_generalized_modal import make from test_ge_beam3_schur_line_program import save diff --git a/tests/test_ge_beam3_retained_plastic.py b/tests/test_ge_beam3_retained_plastic.py index 30066fe08..c41c87185 100644 --- a/tests/test_ge_beam3_retained_plastic.py +++ b/tests/test_ge_beam3_retained_plastic.py @@ -2,15 +2,15 @@ import json import numpy as np import pytest -from anysolver._ge_beam3_station_resultant_cell import StationResultantCell +from anyfesolver._ge_beam3_station_resultant_cell import StationResultantCell from docs.reference_cases.ge_beam3_station_resultant_cell import StationResultantCell as ResearchCell -from anysolver._ge_beam3_retained_plastic import RetainedPlasticOperator -from anysolver._ge_beam3_retained_elastic import RetainedElasticOperator -from anysolver._ge_beam3_p5_seeded import NativeP5BeamElement -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_p5.algebra import rotation -from anysolver._ge_beam3_p5.section import DirectedHardeningSection -from anysolver._ge_beam3_p5.compensated_coordinates import split_sum +from anyfesolver._ge_beam3_retained_plastic import RetainedPlasticOperator +from anyfesolver._ge_beam3_retained_elastic import RetainedElasticOperator +from anyfesolver._ge_beam3_p5_seeded import NativeP5BeamElement +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_p5.algebra import rotation +from anyfesolver._ge_beam3_p5.section import DirectedHardeningSection +from anyfesolver._ge_beam3_p5.compensated_coordinates import split_sum from test_ge_beam3_station_resultant_cell import data_for from test_ge_beam3_complementary_section import section from test_ge_beam3_curved_contrast_probe import make_curved diff --git a/tests/test_ge_beam3_retained_plastic_force_probe.py b/tests/test_ge_beam3_retained_plastic_force_probe.py index 4d60ecb71..a002b1ba1 100644 --- a/tests/test_ge_beam3_retained_plastic_force_probe.py +++ b/tests/test_ge_beam3_retained_plastic_force_probe.py @@ -3,14 +3,14 @@ import pytest import json from decimal import Decimal as D -from anysolver._ge_beam3_seeded_load_program import ForceProgram -from anysolver._ge_beam3_p5_seeded import NativeP5BeamElement -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_seeded_load_program import ForceProgram +from anyfesolver._ge_beam3_p5_seeded import NativeP5BeamElement +from anyfesolver._ge_beam3_p5_seeded.core import canonical from docs.reference_cases.ge_beam3_retained_plastic_force_probe import solve from test_ge_beam3_curved_contrast_probe import make_curved from test_ge_beam3_complementary_section import section from test_ge_beam3_station_resultant_cell import identities -from anysolver._ge_beam3_centered_mixed import CenteredStationaryBeam +from anyfesolver._ge_beam3_centered_mixed import CenteredStationaryBeam def section_data(element, origins): diff --git a/tests/test_ge_beam3_retained_plastic_modes.py b/tests/test_ge_beam3_retained_plastic_modes.py index 2625fcfc8..31fb7dae4 100644 --- a/tests/test_ge_beam3_retained_plastic_modes.py +++ b/tests/test_ge_beam3_retained_plastic_modes.py @@ -2,10 +2,10 @@ import numpy as np import pytest import json -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._native_factor_chain_modes import solve_factor_chain_modes -import anysolver._ge_beam3_retained_plastic_modes as native +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._native_factor_chain_modes import solve_factor_chain_modes +import anyfesolver._ge_beam3_retained_plastic_modes as native from docs.reference_cases.ge_beam3_paired_plastic_modal_probe import prepare, FROZEN, ALGORITHMIC from test_ge_beam3_paired_plastic_modal_probe import accepted diff --git a/tests/test_ge_beam3_retained_plastic_state.py b/tests/test_ge_beam3_retained_plastic_state.py index 6b55222ea..76300ffc6 100644 --- a/tests/test_ge_beam3_retained_plastic_state.py +++ b/tests/test_ge_beam3_retained_plastic_state.py @@ -3,10 +3,10 @@ from hashlib import sha256 import numpy as np import pytest -from anysolver.control import CancellationToken -from anysolver._ge_beam3_retained_plastic_program import ForceProgram, solve_force_program -from anysolver._ge_beam3_retained_plastic_state import Context -from anysolver._ge_beam3_p5_seeded.core import canonical, sha +from anyfesolver.control import CancellationToken +from anyfesolver._ge_beam3_retained_plastic_program import ForceProgram, solve_force_program +from anyfesolver._ge_beam3_retained_plastic_state import Context +from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha from test_ge_beam3_retained_plastic_force_probe import model_with_plasticity from docs.reference_cases.ge_beam3_retained_plastic_force_probe import solve as research_solve @@ -150,7 +150,7 @@ def test_newton_limit_leaves_virgin_checkpoint_unchanged(): def test_replay_does_not_advance_or_resolve_newton_steps(accepted, monkeypatch): - from anysolver._ge_beam3_retained_state import Context as Layout + from anyfesolver._ge_beam3_retained_state import Context as Layout p, original = accepted def forbidden(*args, **kwargs): raise AssertionError('restart must not advance mechanics') monkeypatch.setattr(Layout, 'advance', forbidden) @@ -159,7 +159,7 @@ def forbidden(*args, **kwargs): raise AssertionError('restart must not advance m def test_elastic_capsule_is_not_a_plastic_hot_restart(): - from anysolver._ge_beam3_retained_force_program import solve_force_program as elastic + from anyfesolver._ge_beam3_retained_force_program import solve_force_program as elastic p = program(); model = model_with_plasticity(1.) old = elastic(model, p, stop_after=0) assert old.status == 'paused' diff --git a/tests/test_ge_beam3_retained_post_plastic_modal.py b/tests/test_ge_beam3_retained_post_plastic_modal.py index fab3a6a43..d2abab773 100644 --- a/tests/test_ge_beam3_retained_post_plastic_modal.py +++ b/tests/test_ge_beam3_retained_post_plastic_modal.py @@ -3,12 +3,12 @@ import json import numpy as np import pytest -from anysolver import _ge_beam3_retained_generalized_modal as modal -from anysolver._ge_beam3_retained_generalized_state import Context,Program -from anysolver._ge_beam3_retained_generalized_program import solve -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver import _ge_beam3_retained_generalized_modal as modal +from anyfesolver._ge_beam3_retained_generalized_state import Context,Program +from anyfesolver._ge_beam3_retained_generalized_program import solve +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_p5_seeded.core import canonical from docs.reference_cases.ge_beam3_generalized_ellipsoid_oracle import response as independent from test_ge_beam3_native_generalized import problem from test_ge_beam3_native_generalized_restart import make as connected diff --git a/tests/test_ge_beam3_retained_prestress.py b/tests/test_ge_beam3_retained_prestress.py index feaa96c7f..4b2b99e44 100644 --- a/tests/test_ge_beam3_retained_prestress.py +++ b/tests/test_ge_beam3_retained_prestress.py @@ -4,11 +4,11 @@ import json import numpy as np import pytest -from anysolver import _ge_beam3_retained_nodal_loading as nodal -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_p5_seeded.core import canonical,sha -from anysolver._native_paired_factor_chain_modes import solve_paired_factor_chain_modes as paired +from anyfesolver import _ge_beam3_retained_nodal_loading as nodal +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_p5_seeded.core import canonical,sha +from anyfesolver._native_paired_factor_chain_modes import solve_paired_factor_chain_modes as paired from docs.reference_cases.ge_beam3_exact_family_partition import partition from test_ge_beam3_native_generalized_modal import make from test_ge_beam3_schur_line_program import save diff --git a/tests/test_ge_beam3_retained_recovery_objectivity.py b/tests/test_ge_beam3_retained_recovery_objectivity.py index d5bb4c460..79fdc7cc3 100644 --- a/tests/test_ge_beam3_retained_recovery_objectivity.py +++ b/tests/test_ge_beam3_retained_recovery_objectivity.py @@ -1,11 +1,11 @@ """Complementary recovery work and fixed-reference rigid-motion checks.""" import numpy as np import pytest -from anysolver._ge_beam3_retained_force_program import ForceProgram, solve_force_program -from anysolver._ge_beam3_retained_state import Context -from anysolver._ge_beam3_p5.algebra import rotation -from anysolver._ge_beam3_p5.compensated_coordinates import split_sum -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_retained_force_program import ForceProgram, solve_force_program +from anyfesolver._ge_beam3_retained_state import Context +from anyfesolver._ge_beam3_p5.algebra import rotation +from anyfesolver._ge_beam3_p5.compensated_coordinates import split_sum +from anyfesolver._ge_beam3_p5_seeded.core import canonical from test_ge_beam3_curved_contrast_probe import make_curved diff --git a/tests/test_ge_beam3_retained_refinement_capacity.py b/tests/test_ge_beam3_retained_refinement_capacity.py index a10a24090..9c83cbdee 100644 --- a/tests/test_ge_beam3_retained_refinement_capacity.py +++ b/tests/test_ge_beam3_retained_refinement_capacity.py @@ -5,13 +5,13 @@ from types import SimpleNamespace import numpy as np import pytest -from anysolver import _ge_beam3_retained_translation_control as control -from anysolver import _ge_beam3_retained_translation_modal as modal -from anysolver._ge_beam3_retained_generalized_state import _retained_size -from anysolver._ge_beam3_native_generalized_program import model_identity,retained_model_identity -from anysolver._ge_beam3_native_generalized_restart import _model -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver.control import CancellationToken,SolveCancelled +from anyfesolver import _ge_beam3_retained_translation_control as control +from anyfesolver import _ge_beam3_retained_translation_modal as modal +from anyfesolver._ge_beam3_retained_generalized_state import _retained_size +from anyfesolver._ge_beam3_native_generalized_program import model_identity,retained_model_identity +from anyfesolver._ge_beam3_native_generalized_restart import _model +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.control import CancellationToken,SolveCancelled from docs.reference_cases import ge_beam3_refined_controlled_case as case from docs.reference_cases import ge_beam3_retained_arch_case as old_case from docs.reference_cases.ge_beam3_retained_prestress_protocol import strict_bytes diff --git a/tests/test_ge_beam3_retained_translation_control.py b/tests/test_ge_beam3_retained_translation_control.py index 9cd5619ed..a44ce601f 100644 --- a/tests/test_ge_beam3_retained_translation_control.py +++ b/tests/test_ge_beam3_retained_translation_control.py @@ -6,12 +6,12 @@ import numpy as np import pytest -from anysolver import _ge_beam3_retained_translation_control as control -from anysolver import _ge_beam3_retained_nodal_loading as force -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_p5_seeded.core import canonical, sha -from anysolver.control import CancellationToken +from anyfesolver import _ge_beam3_retained_translation_control as control +from anyfesolver import _ge_beam3_retained_nodal_loading as force +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha +from anyfesolver.control import CancellationToken from test_ge_beam3_native_generalized_modal import make from test_ge_beam3_schur_line_program import save diff --git a/tests/test_ge_beam3_retained_translation_modal.py b/tests/test_ge_beam3_retained_translation_modal.py index 37fffadb3..f06e8096b 100644 --- a/tests/test_ge_beam3_retained_translation_modal.py +++ b/tests/test_ge_beam3_retained_translation_modal.py @@ -3,11 +3,11 @@ import json import numpy as np import pytest -from anysolver import _ge_beam3_retained_translation_modal as modal -from anysolver import _ge_beam3_retained_translation_control as control -from anysolver import _ge_beam3_retained_nodal_loading as nodal -from anysolver._ge_beam3_p5_seeded.core import canonical,sha -from anysolver.control import CancellationToken,SolveCancelled +from anyfesolver import _ge_beam3_retained_translation_modal as modal +from anyfesolver import _ge_beam3_retained_translation_control as control +from anyfesolver import _ge_beam3_retained_nodal_loading as nodal +from anyfesolver._ge_beam3_p5_seeded.core import canonical,sha +from anyfesolver.control import CancellationToken,SolveCancelled from docs.reference_cases import ge_beam3_retained_arch_case as case diff --git a/tests/test_ge_beam3_returned_mode_capture.py b/tests/test_ge_beam3_returned_mode_capture.py index d937f5ecf..cdc4d5eba 100644 --- a/tests/test_ge_beam3_returned_mode_capture.py +++ b/tests/test_ge_beam3_returned_mode_capture.py @@ -2,8 +2,8 @@ import sys import numpy as np import pytest -from anysolver import _ge_beam3_native_generalized_factor_modal as factor -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver import _ge_beam3_native_generalized_factor_modal as factor +from anyfesolver._ge_beam3_p5_seeded.core import canonical from docs.reference_cases.ge_beam3_returned_mode_capture import capture_failure, analyze from test_ge_beam3_generalized_slenderness_diagnostic import make from test_ge_beam3_schur_line_program import save diff --git a/tests/test_ge_beam3_saved_continuum_lateral_comparison.py b/tests/test_ge_beam3_saved_continuum_lateral_comparison.py index 785b8e016..eaba340eb 100644 --- a/tests/test_ge_beam3_saved_continuum_lateral_comparison.py +++ b/tests/test_ge_beam3_saved_continuum_lateral_comparison.py @@ -83,8 +83,8 @@ def test_hash_mutation_before_reference_evaluation(monkeypatch): def test_no_production_import_or_base_solve(): tree=ast.parse(Path(gate.__file__).read_text()) for node in ast.walk(tree): - if isinstance(node,ast.Import):assert all(not n.name.startswith('anysolver') for n in node.names) - if isinstance(node,ast.ImportFrom):assert not (node.module or '').startswith('anysolver') + if isinstance(node,ast.Import):assert all(not n.name.startswith('anyfesolver') for n in node.names) + if isinstance(node,ast.ImportFrom):assert not (node.module or '').startswith('anyfesolver') if isinstance(node,ast.Call): name=node.func.id if isinstance(node.func,ast.Name) else node.func.attr if isinstance(node.func,ast.Attribute) else '' assert name not in ('solve','solve_bvp','prepare','restore','stage','solve_modes') diff --git a/tests/test_ge_beam3_schur_line_program.py b/tests/test_ge_beam3_schur_line_program.py index f6beced29..12954ee52 100644 --- a/tests/test_ge_beam3_schur_line_program.py +++ b/tests/test_ge_beam3_schur_line_program.py @@ -3,11 +3,11 @@ from hashlib import sha256 import numpy as np import pytest -from anysolver import _ge_beam3_schur_line_program as native -from anysolver import _ge_beam3_fibre_line_program as dense -from anysolver._ge_beam3_seeded_load_program import ForceProgram -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver.control import CancellationToken +from anyfesolver import _ge_beam3_schur_line_program as native +from anyfesolver import _ge_beam3_fibre_line_program as dense +from anyfesolver._ge_beam3_seeded_load_program import ForceProgram +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.control import CancellationToken from test_ge_beam3_fibre_line_program import model,line @@ -150,7 +150,7 @@ def test_frozen_program_mutation_and_failed_iteration_limit(tmp_path): @pytest.mark.parametrize('case',['straight-elastic','curved-elastic','plastic-cycle']) def test_exactly_unloaded_rows_need_full_system_refinement(case,tmp_path): - from anysolver._ge_beam3_fibre_schur_solver import ResultantSchurSolver as Old + from anyfesolver._ge_beam3_fibre_schur_solver import ResultantSchurSolver as Old made,p,f=inputs(case); c=native.Context(made,p,line_forces=f) r,h,_,_=c.assemble(c.initial.mechanical,p.targets[0],c.initial.histories) a=c.tangent(r,h,p.targets[0]); unrefined=Old(c.layout,a) diff --git a/tests/test_ge_beam3_seeded_development_checkpoint.py b/tests/test_ge_beam3_seeded_development_checkpoint.py index 746aa4617..c7ed84c95 100644 --- a/tests/test_ge_beam3_seeded_development_checkpoint.py +++ b/tests/test_ge_beam3_seeded_development_checkpoint.py @@ -68,17 +68,17 @@ def test_extent_adds_private_successors_without_modifying_historical_sources(): rows=[line.split('\t') for line in result.stdout.splitlines()] assert all(kind=='A' for kind,_ in rows) assert {path for _,path in rows}=={r['path'] for r in p['sources']}|EXTRA - assert all(path.startswith(('src/anysolver/_ge_beam3_','src/anysolver/_native_signed_')) + assert all(path.startswith(('src/anyfesolver/_ge_beam3_','src/anyfesolver/_native_signed_')) for _,path in rows if path.startswith('src/')) def test_seeded_package_is_only_namespace_identity_and_seed_successor(): - prefix='src/anysolver/' + prefix='src/anyfesolver/' for name in ('__init__','codec','core','element','state','work'): old=(ROOT/(prefix+'_ge_beam3_p5_loads/'+name+'.py')).read_text() expected=old.replace('_ge_beam3_p5_loads','_ge_beam3_p5_seeded').replace('_V4','_V5') if name=='core': - expected=expected.replace("SCHEMA='",'from anysolver._ge_beam3_authoritative_cell_seed import cell_initial_rotations, POLICY as SEED_POLICY\n\nSCHEMA=\'') + expected=expected.replace("SCHEMA='",'from anyfesolver._ge_beam3_authoritative_cell_seed import cell_initial_rotations, POLICY as SEED_POLICY\n\nSCHEMA=\'') expected=expected.replace('coordinate_policy=POLICY, element=', 'coordinate_policy=POLICY, initial_rotation_policy=SEED_POLICY, element=') expected=expected.replace('return model.solve(positions, operators@self.reference.nodal_triads,\n', diff --git a/tests/test_ge_beam3_seeded_fibre_control.py b/tests/test_ge_beam3_seeded_fibre_control.py index 38f7f2c01..a9cef860f 100644 --- a/tests/test_ge_beam3_seeded_fibre_control.py +++ b/tests/test_ge_beam3_seeded_fibre_control.py @@ -3,10 +3,10 @@ import json import numpy as np import pytest -import anysolver._ge_beam3_seeded_fibre_control as native -from anysolver._ge_beam3_retained_fibre_control import Context as OldContext -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver.control import CancellationToken +import anyfesolver._ge_beam3_seeded_fibre_control as native +from anyfesolver._ge_beam3_retained_fibre_control import Context as OldContext +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.control import CancellationToken from test_ge_beam3_retained_fibre_control import program, make_model, arch, transformed_model from test_ge_beam3_retained_fibre_control import rehash @@ -124,7 +124,7 @@ def test_seeded_arch_continuation_keeps_the_descending_branch(tmp_path): def test_large_rotation_covariance_of_initialized_controller(accepted, tmp_path): - from anysolver._ge_beam3_p5.algebra import rotation + from anyfesolver._ge_beam3_p5.algebra import rotation p, result = accepted; r = rotation([2.6, .8, -.3]) direction = tuple(map(float, r@np.array(p.direction))) forces = tuple(map(float, r@np.array(p.nodal_forces[0][1:]))) diff --git a/tests/test_ge_beam3_seeded_load_program.py b/tests/test_ge_beam3_seeded_load_program.py index 08569541a..e7fae8993 100644 --- a/tests/test_ge_beam3_seeded_load_program.py +++ b/tests/test_ge_beam3_seeded_load_program.py @@ -5,11 +5,11 @@ import numpy as np import pytest -import anysolver._ge_beam3_seeded_load_program as driver -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._ge_beam3_p5_seeded.core import canonical, sha +import anyfesolver._ge_beam3_seeded_load_program as driver +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha from test_ge_beam3_native_load_state import problem as legacy_problem, store_for, equilibrium -from anysolver._ge_beam3_p5_seeded import NativeP5BeamElement +from anyfesolver._ge_beam3_p5_seeded import NativeP5BeamElement def problem(*args, **kwargs): diff --git a/tests/test_ge_beam3_seeded_numerics.py b/tests/test_ge_beam3_seeded_numerics.py index f70740d24..52c96bab4 100644 --- a/tests/test_ge_beam3_seeded_numerics.py +++ b/tests/test_ge_beam3_seeded_numerics.py @@ -4,11 +4,11 @@ import numpy as np import pytest from scipy.linalg import eigvalsh -from anysolver._native_signed_kinetic_factor_modes import solve_signed_kinetic_factor_modes as solve -from anysolver._ge_beam3_lifted_kinetic_factor import current_lifted_kinetic_factor -from anysolver._ge_beam3_p5_centered.mass import current_rest_mass -from anysolver._ge_beam3_p5.algebra import rotation -from anysolver._ge_beam3_conservative_backtrack import acceptance +from anyfesolver._native_signed_kinetic_factor_modes import solve_signed_kinetic_factor_modes as solve +from anyfesolver._ge_beam3_lifted_kinetic_factor import current_lifted_kinetic_factor +from anyfesolver._ge_beam3_p5_centered.mass import current_rest_mass +from anyfesolver._ge_beam3_p5.algebra import rotation +from anyfesolver._ge_beam3_conservative_backtrack import acceptance from test_ge_beam3_curved_contrast_probe import make_curved @@ -16,7 +16,7 @@ def test_backtrack_is_exact_extraction_of_preserved_research_function(): root=Path(__file__).parents[1] nodes=[] for path in ['docs/reference_cases/ge_beam3_curved_p5_energy_seed_probe.py', - 'src/anysolver/_ge_beam3_conservative_backtrack.py']: + 'src/anyfesolver/_ge_beam3_conservative_backtrack.py']: tree=ast.parse((root/path).read_text()) nodes.append(ast.dump(next(n for n in tree.body if isinstance(n,ast.FunctionDef) and n.name=='acceptance'))) assert nodes[0]==nodes[1] diff --git a/tests/test_ge_beam3_seeded_reduction_diagnostic.py b/tests/test_ge_beam3_seeded_reduction_diagnostic.py index 818e3f662..8488457b6 100644 --- a/tests/test_ge_beam3_seeded_reduction_diagnostic.py +++ b/tests/test_ge_beam3_seeded_reduction_diagnostic.py @@ -1,12 +1,12 @@ """Diagnostic-only separation of kinetic whitening and strain-factor errors.""" import numpy as np from test_ge_beam3_curved_contrast_probe import make_curved, ROTATION -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_seeded_loaded_modal import prepare -from anysolver._ge_beam3_seeded_signed_modes import _split -from anysolver._native_signed_factor_modes import _reduce -from anysolver._native_relative_reference_factor_spectrum import solve_relative_reference_factor_spectrum -from anysolver._ge_beam3_p5_centered.mass import reference_kinetic_factors +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_seeded_loaded_modal import prepare +from anyfesolver._ge_beam3_seeded_signed_modes import _split +from anyfesolver._native_signed_factor_modes import _reduce +from anyfesolver._native_relative_reference_factor_spectrum import solve_relative_reference_factor_spectrum +from anyfesolver._ge_beam3_p5_centered.mass import reference_kinetic_factors def test_capture_reference_factor_reduction(tmp_path): diff --git a/tests/test_ge_beam3_shell_joint_state.py b/tests/test_ge_beam3_shell_joint_state.py index 3e0891263..f67ad6de0 100644 --- a/tests/test_ge_beam3_shell_joint_state.py +++ b/tests/test_ge_beam3_shell_joint_state.py @@ -5,9 +5,9 @@ import numpy as np import pytest -from anysolver._ge_beam3_shell_joint_state import CoupledShellBeamAnalysis, decode -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver._ge_beam3_shell_joint_state import CoupledShellBeamAnalysis, decode +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.control import CancellationToken, SolveCancelled from test_ge_beam3_shell_joint_trial import specimen @@ -175,8 +175,8 @@ def cancelled(*args, **kwargs): @pytest.mark.parametrize('topology', ('Q4', 'S3-V2D')) def test_coupled_plastic_beam_history_advances_once_and_replays(topology, tmp_path): - from anysolver._ge_beam3_retained_generalized_state import Context, Program - from anysolver._ge_beam3_shell_joint_trial import ShellBeamTrialAssembly + from anyfesolver._ge_beam3_retained_generalized_state import Context, Program + from anyfesolver._ge_beam3_shell_joint_trial import ShellBeamTrialAssembly from test_ge_beam3_native_generalized_restart import make as plastic_model, pattern targets = (.25, .5, 1., .5, 0., -.5, 0.) def build(): diff --git a/tests/test_ge_beam3_shell_joint_trial.py b/tests/test_ge_beam3_shell_joint_trial.py index 375d0632e..56cf0c33c 100644 --- a/tests/test_ge_beam3_shell_joint_trial.py +++ b/tests/test_ge_beam3_shell_joint_trial.py @@ -5,13 +5,13 @@ import numpy as np import pytest -from anysolver._ge_beam3_shell_joint_trial import ShellBeamTrialAssembly -from anysolver._ge_beam3_retained_generalized_state import Context, Program -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver.control import CancellationToken, SolveCancelled -from anysolver.corotational import corotational_element_response +from anyfesolver._ge_beam3_shell_joint_trial import ShellBeamTrialAssembly +from anyfesolver._ge_beam3_retained_generalized_state import Context, Program +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver.corotational import corotational_element_response from test_ge_beam3_native_generalized_modal import make @@ -149,7 +149,7 @@ def test_unsupported_shell_and_beam_owner_rejected(): def test_genuine_curved_plastic_beam_predecessor_and_rejected_joint_trial(tmp_path): - from anysolver import _ge_beam3_retained_nodal_loading as nodal + from anyfesolver import _ge_beam3_retained_nodal_loading as nodal from test_ge_beam3_native_generalized_restart import make as plastic_model, pattern model = plastic_model('curved-plastic') p = nodal.Program((.25, .5, 1.), pattern(model), nodal.NodalDeadForces(())) diff --git a/tests/test_ge_beam3_signed_lifecycle.py b/tests/test_ge_beam3_signed_lifecycle.py index b4d0261f9..83ed96d13 100644 --- a/tests/test_ge_beam3_signed_lifecycle.py +++ b/tests/test_ge_beam3_signed_lifecycle.py @@ -31,7 +31,7 @@ def test_cancellation_mutations(kind): def test_exact_preserved_positive_inputs_and_owner(): for name,(_,digest) in p.POSITIVES.items():assert sha256(p.positive(name)).hexdigest()==digest - assert sha256((p.ROOT/'src/anysolver/_ge_beam3_elastic_seed_continuation.py').read_bytes()).hexdigest()==p.OWNER_SHA + assert sha256((p.ROOT/'src/anyfesolver/_ge_beam3_elastic_seed_continuation.py').read_bytes()).hexdigest()==p.OWNER_SHA def test_changed_manifest(tmp_path): (tmp_path/'manifest.json').write_bytes(b'{}\n') diff --git a/tests/test_ge_beam3_signed_loaded_modes.py b/tests/test_ge_beam3_signed_loaded_modes.py index 63f66d640..5d9a5f8f6 100644 --- a/tests/test_ge_beam3_signed_loaded_modes.py +++ b/tests/test_ge_beam3_signed_loaded_modes.py @@ -3,10 +3,10 @@ from copy import deepcopy import numpy as np import pytest -import anysolver._ge_beam3_signed_loaded_modes as adapter -from anysolver._ge_beam3_loaded_modal import solve_elastic_modes -from anysolver._ge_beam3_p5_loads.core import canonical -from anysolver.control import CancellationToken, SolveCancelled +import anyfesolver._ge_beam3_signed_loaded_modes as adapter +from anyfesolver._ge_beam3_loaded_modal import solve_elastic_modes +from anyfesolver._ge_beam3_p5_loads.core import canonical +from anyfesolver.control import CancellationToken, SolveCancelled from test_ge_beam3_native_load_state import problem from test_ge_beam3_loaded_modal import accepted from test_ge_beam3_curved_p5_mass_probe import section_mass @@ -103,9 +103,9 @@ def test_plastic_increment_is_rejected_but_elastic_unloading_keeps_history(): def test_curved_mode_shapes_covary_under_proper_frame_rotation(): - from anysolver.fe_core import FEModel - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry - from anysolver._ge_beam3_p5_loads import NativeP5BeamElement + from anyfesolver.fe_core import FEModel + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry + from anyfesolver._ge_beam3_p5_loads import NativeP5BeamElement old = problem(); rotation = np.array([[0., -1., 0.], [1., 0., 0.], [0., 0., 1.]]) new = FEModel('signed-rotated-loaded-native') for i, node in old.mesh.nodes.items(): new.add_node(i, *(rotation@node.coords())) diff --git a/tests/test_ge_beam3_signed_loaded_spectrum.py b/tests/test_ge_beam3_signed_loaded_spectrum.py index e8a358aa7..5e3bb9237 100644 --- a/tests/test_ge_beam3_signed_loaded_spectrum.py +++ b/tests/test_ge_beam3_signed_loaded_spectrum.py @@ -7,19 +7,19 @@ import numpy as np import pytest from scipy import linalg -from anysolver.fe_core import FEModel -from anysolver.boundary import BoundaryCondition -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry -from anysolver._ge_beam3_p5_loads import NativeP5BeamElement, DirectedHardeningSection -from anysolver._ge_beam3_p5_loads.core import canonical -from anysolver._ge_beam3_loaded_modal import prepare +from anyfesolver.fe_core import FEModel +from anyfesolver.boundary import BoundaryCondition +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry +from anyfesolver._ge_beam3_p5_loads import NativeP5BeamElement, DirectedHardeningSection +from anyfesolver._ge_beam3_p5_loads.core import canonical +from anyfesolver._ge_beam3_loaded_modal import prepare from docs.reference_cases.ge_beam3_loaded_factor_split_probe import split_accepted_elastic_operator from docs.reference_cases.ge_beam3_signed_spectrum_probe import reduce_signed_split, bracket_lowest from docs.reference_cases.ge_beam3_straight_discrete_signed_reference import bending_roots from test_ge_beam3_loaded_modal import accepted from test_ge_beam3_native_load_state import problem from test_ge_beam3_curved_p5_mass_probe import section_mass -from anysolver._native_stationary_spectrum import solve_stationary_spectrum +from anyfesolver._native_stationary_spectrum import solve_stationary_spectrum def make(slenderness): diff --git a/tests/test_ge_beam3_signed_mode_shapes.py b/tests/test_ge_beam3_signed_mode_shapes.py index 67f2667f2..12a6cfbcf 100644 --- a/tests/test_ge_beam3_signed_mode_shapes.py +++ b/tests/test_ge_beam3_signed_mode_shapes.py @@ -2,10 +2,10 @@ import numpy as np import pytest -from anysolver._ge_beam3_loaded_modal import prepare -from anysolver._ge_beam3_p5_loads.core import canonical -from anysolver._native_signed_factor_modes import solve_signed_factor_modes -from anysolver._ge_beam3_signed_loaded_modes import solve_signed_loaded_modes +from anyfesolver._ge_beam3_loaded_modal import prepare +from anyfesolver._ge_beam3_p5_loads.core import canonical +from anyfesolver._native_signed_factor_modes import solve_signed_factor_modes +from anyfesolver._ge_beam3_signed_loaded_modes import solve_signed_loaded_modes from docs.reference_cases.ge_beam3_loaded_factor_split_probe import split_accepted_elastic_operator from docs.reference_cases.ge_beam3_straight_discrete_signed_reference import bending_roots from test_ge_beam3_signed_loaded_spectrum import make diff --git a/tests/test_ge_beam3_signed_modes_checkpoint.py b/tests/test_ge_beam3_signed_modes_checkpoint.py index 72d2a6995..53b6e858c 100644 --- a/tests/test_ge_beam3_signed_modes_checkpoint.py +++ b/tests/test_ge_beam3_signed_modes_checkpoint.py @@ -68,22 +68,22 @@ def normalized_function(path, name): def test_native_split_matches_preserved_research_expression_except_checkpoints(): - assert normalized_function('src/anysolver/_ge_beam3_signed_loaded_modes.py', '_split') == normalized_function( + assert normalized_function('src/anyfesolver/_ge_beam3_signed_loaded_modes.py', '_split') == normalized_function( 'docs/reference_cases/ge_beam3_loaded_factor_split_probe.py', 'split_accepted_elastic_operator') - assert normalized_function('src/anysolver/_native_signed_factor_modes.py', '_reduce') == normalized_function( + assert normalized_function('src/anyfesolver/_native_signed_factor_modes.py', '_reduce') == normalized_function( 'docs/reference_cases/ge_beam3_signed_spectrum_probe.py', 'reduce_signed_split') def test_private_source_has_no_research_import_or_public_export(): names = ('_native_signed_factor_modes', '_ge_beam3_signed_loaded_modes') for name in names: - tree = ast.parse((ROOT/'src/anysolver'/f'{name}.py').read_text(encoding='utf-8')) + tree = ast.parse((ROOT/'src/anyfesolver'/f'{name}.py').read_text(encoding='utf-8')) for node in ast.walk(tree): if isinstance(node, ast.ImportFrom): assert not (node.module or '').startswith(('docs', 'tests')) if isinstance(node, ast.Import): assert all(not n.name.startswith(('docs', 'tests')) for n in node.names) - assert name not in (ROOT/'src/anysolver/__init__.py').read_text(encoding='utf-8') + assert name not in (ROOT/'src/anyfesolver/__init__.py').read_text(encoding='utf-8') def test_archive_pairs_and_failed_sources_are_bound(): diff --git a/tests/test_ge_beam3_signed_modes_installed.py b/tests/test_ge_beam3_signed_modes_installed.py index b0ab092a7..ab2020a6e 100644 --- a/tests/test_ge_beam3_signed_modes_installed.py +++ b/tests/test_ge_beam3_signed_modes_installed.py @@ -94,7 +94,7 @@ def command(argv, cwd, name, limit=180): 'from setuptools.build_meta import build_wheel; import sys; build_wheel(sys.argv[1])', str(wheels)], build, 'build') candidates = list(wheels.glob('*.whl')); assert len(candidates) == 1; wheel = candidates[0] with zipfile.ZipFile(wheel) as archive: - assert all('anysolver/'+name in archive.namelist() for name in ( + assert all('anyfesolver/'+name in archive.namelist() for name in ( '_native_signed_factor_modes.py', '_ge_beam3_signed_loaded_modes.py')) assert not any(name.startswith(('docs/', 'tests/')) for name in archive.namelist()) environment = tmp_path/'environment' diff --git a/tests/test_ge_beam3_slender_spectrum_probe.py b/tests/test_ge_beam3_slender_spectrum_probe.py index fe125a597..676e17919 100644 --- a/tests/test_ge_beam3_slender_spectrum_probe.py +++ b/tests/test_ge_beam3_slender_spectrum_probe.py @@ -4,7 +4,7 @@ import pytest from docs.reference_cases.ge_beam3_slender_spectrum_probe import comparison -from anysolver._ge_beam3_p5_loads.core import canonical +from anyfesolver._ge_beam3_p5_loads.core import canonical @pytest.mark.parametrize('slenderness', [100., 10000., 1000000.]) diff --git a/tests/test_ge_beam3_spatial_continuum.py b/tests/test_ge_beam3_spatial_continuum.py index 8ff8394c0..78cf6a1da 100644 --- a/tests/test_ge_beam3_spatial_continuum.py +++ b/tests/test_ge_beam3_spatial_continuum.py @@ -54,8 +54,8 @@ def test_boundary_count_and_no_smeared_point_force(): def test_no_mechanics_import(): tree=ast.parse(Path(p.__file__).read_bytes()) for node in ast.walk(tree): - if isinstance(node,ast.ImportFrom):assert not (node.module or '').startswith(('anysolver','tests','docs')) - if isinstance(node,ast.Import):assert all(not n.name.startswith(('anysolver','tests','docs')) for n in node.names) + if isinstance(node,ast.ImportFrom):assert not (node.module or '').startswith(('anyfesolver','tests','docs')) + if isinstance(node,ast.Import):assert all(not n.name.startswith(('anyfesolver','tests','docs')) for n in node.names) @pytest.mark.parametrize('knots',(np.linspace(0.,1.,65),np.linspace(0.,1.,385),np.array([0.,.03,.21,.39,.9,1.]))) def test_validation_points_not_collocation_nodes_or_midpoints(knots): diff --git a/tests/test_ge_beam3_spatial_equilibrium_probe.py b/tests/test_ge_beam3_spatial_equilibrium_probe.py index 1e3999bf2..0e98c0e3a 100644 --- a/tests/test_ge_beam3_spatial_equilibrium_probe.py +++ b/tests/test_ge_beam3_spatial_equilibrium_probe.py @@ -23,7 +23,7 @@ def test_no_invented_history(): def test_trial_border_does_not_weaken_virgin_history_owner(): import numpy as np - from anysolver import _ge_beam3_retained_translation_control as control + from anyfesolver import _ge_beam3_retained_translation_control as control from docs.reference_cases.ge_beam3_refined_controlled_case import model programme=control.Program((.003,),2,(0.,0.,1.),control.NodalDeadForces(((3,0.,-1.,0.),))) with pytest.raises(np.linalg.LinAlgError):control.Context(model(2),programme) @@ -33,7 +33,7 @@ def test_trial_border_does_not_weaken_virgin_history_owner(): @pytest.mark.parametrize('kind',('row','node','model')) def test_trial_control_guard(kind): - from anysolver import _ge_beam3_retained_translation_control as control + from anyfesolver import _ge_beam3_retained_translation_control as control from docs.reference_cases.ge_beam3_refined_controlled_case import model trial=p.elastic_control(model(2),control.Program((.003,),2,(0.,0.,1.),control.NodalDeadForces(((3,0.,-1.,0.),)))) if kind=='row':trial.row=-trial.row diff --git a/tests/test_ge_beam3_spatial_next_reference.py b/tests/test_ge_beam3_spatial_next_reference.py index 123a14e1b..a2bb3641a 100644 --- a/tests/test_ge_beam3_spatial_next_reference.py +++ b/tests/test_ge_beam3_spatial_next_reference.py @@ -63,6 +63,6 @@ def test_frozen_continuum_source_and_no_production_imports(): for module in (reference,reference.base): tree=ast.parse(Path(module.__file__).read_text()) for node in ast.walk(tree): - if isinstance(node,ast.Import):assert all(not x.name.startswith('anysolver') for x in node.names) - if isinstance(node,ast.ImportFrom):assert not (node.module or '').startswith('anysolver') + if isinstance(node,ast.Import):assert all(not x.name.startswith('anyfesolver') for x in node.names) + if isinstance(node,ast.ImportFrom):assert not (node.module or '').startswith('anyfesolver') assert not any(isinstance(n,ast.Call) and isinstance(n.func,ast.Name) and n.func.id in ('eval','exec','__import__') for n in ast.walk(tree)) diff --git a/tests/test_ge_beam3_spatial_nodal_moments.py b/tests/test_ge_beam3_spatial_nodal_moments.py index 6b47d7169..7f4599c91 100644 --- a/tests/test_ge_beam3_spatial_nodal_moments.py +++ b/tests/test_ge_beam3_spatial_nodal_moments.py @@ -4,18 +4,18 @@ import numpy as np import pytest -from anysolver.fe_core import FEModel -from anysolver.boundary import BoundaryCondition -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference -from anysolver._ge_beam3_retained_fibre_element import NativeRetainedFibreElement -from anysolver._ge_beam3_fibre_section import PhysicalFibreSection, Fibre, FlowCurve -from anysolver._ge_beam3_seeded_load_program import ForceProgram -from anysolver._ge_beam3_spatial_nodal_moments import SpatialNodalMoments -from anysolver import _ge_beam3_spatial_fibre_program as native -from anysolver._ge_beam3_retained_fibre_state import Layout, Context as OriginalContext -from anysolver._ge_beam3_seeded_fibre_control import spatial_jacobian -from anysolver._ge_beam3_p5.algebra import rotation, log_rotation, skew -from anysolver._ge_beam3_p5_seeded.core import canonical, sha +from anyfesolver.fe_core import FEModel +from anyfesolver.boundary import BoundaryCondition +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference +from anyfesolver._ge_beam3_retained_fibre_element import NativeRetainedFibreElement +from anyfesolver._ge_beam3_fibre_section import PhysicalFibreSection, Fibre, FlowCurve +from anyfesolver._ge_beam3_seeded_load_program import ForceProgram +from anyfesolver._ge_beam3_spatial_nodal_moments import SpatialNodalMoments +from anyfesolver import _ge_beam3_spatial_fibre_program as native +from anyfesolver._ge_beam3_retained_fibre_state import Layout, Context as OriginalContext +from anyfesolver._ge_beam3_seeded_fibre_control import spatial_jacobian +from anyfesolver._ge_beam3_p5.algebra import rotation, log_rotation, skew +from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha def model(common=None, *, plastic=False, coupled=False): @@ -164,7 +164,7 @@ def test_all_six_load_components_physical_plasticity_reactions_and_restart(coupl def test_cancellation_before_commit_preserves_last_accepted_capsule(coupled_plastic): - from anysolver.control import CancellationToken + from anyfesolver.control import CancellationToken p,moments,_=coupled_plastic; token=CancellationToken() paused=native.solve_force_program(model(plastic=True,coupled=True),p,nodal_moments=moments,stop_after=1) def cancel(event): @@ -190,7 +190,7 @@ def test_moment_authority_and_program_mutations_do_not_replay(coupled_plastic): def test_existing_six_macro_checkpoint_replays_without_new_equilibrium_solve(): from pathlib import Path from docs.reference_cases import ge_beam3_fibre_arch_refinement as family - from anysolver import _ge_beam3_seeded_fibre_control as old + from anyfesolver import _ge_beam3_seeded_fibre_control as old path=Path('C:/Users/AudunArnesenNyhus/AppData/Local/ANYrelease/ge-beam3-fibre-arch6-20260907-v1/checkpoint-diagnostic.json') if not path.is_file(): pytest.skip('Preserved external development checkpoint not installed; not qualification') raw=path.read_bytes() diff --git a/tests/test_ge_beam3_spatial_stability_factors.py b/tests/test_ge_beam3_spatial_stability_factors.py index 98fefa4aa..426d420b2 100644 --- a/tests/test_ge_beam3_spatial_stability_factors.py +++ b/tests/test_ge_beam3_spatial_stability_factors.py @@ -3,9 +3,9 @@ from hashlib import sha256 import numpy as np import pytest -from anysolver import _ge_beam3_elastic_seed_modal as modal -from anysolver import _ge_beam3_elastic_seed_continuation as owner -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver import _ge_beam3_elastic_seed_modal as modal +from anyfesolver import _ge_beam3_elastic_seed_continuation as owner +from anyfesolver._ge_beam3_p5_seeded.core import canonical from test_ge_beam3_elastic_seed_continuation import seed, model, programme from docs.reference_cases.ge_beam3_sparse_inertia_audit import inertia from docs.reference_cases.ge_beam3_decimal_inertia_audit import inertia as dense diff --git a/tests/test_ge_beam3_spectral_allocation.py b/tests/test_ge_beam3_spectral_allocation.py index 22bcbb95c..9dd4b7f30 100644 --- a/tests/test_ge_beam3_spectral_allocation.py +++ b/tests/test_ge_beam3_spectral_allocation.py @@ -1,8 +1,8 @@ """Explicit private dense budgets, not relaxed mechanical acceptance.""" import numpy as np import pytest -from anysolver import _native_exact_shift_inertia as exact -from anysolver import _ge_beam3_controlled_fibre_modes as native +from anyfesolver import _native_exact_shift_inertia as exact +from anyfesolver import _ge_beam3_controlled_fibre_modes as native def test_exact_96_coordinate_inertia_and_unchanged_default(): @@ -30,7 +30,7 @@ def forbidden(*args,**kwargs): raise AssertionError('replay after invalid budget def test_chain_propagates_explicit_budget_before_numerics(monkeypatch): - from anysolver import _native_exact_shift_chain_modes as chain + from anyfesolver import _native_exact_shift_chain_modes as chain def forbidden(*args): raise AssertionError('numerics after invalid allocation') monkeypatch.setattr(chain,'_owned',forbidden) with pytest.raises(ValueError,match='dimension limit'): @@ -38,7 +38,7 @@ def forbidden(*args): raise AssertionError('numerics after invalid allocation') def test_budget_reaches_exact_fallback(monkeypatch): - from anysolver import _native_exact_shift_chain_modes as chain + from anyfesolver import _native_exact_shift_chain_modes as chain def unresolved(*args): raise ValueError('unresolved shifted sign') monkeypatch.setattr(chain,'floating_inertia',unresolved) h=np.diag(np.arange(69,dtype=float)-35.25); m=np.zeros_like(h) diff --git a/tests/test_ge_beam3_station_resultant_cell.py b/tests/test_ge_beam3_station_resultant_cell.py index 2919ea9c1..d702192c2 100644 --- a/tests/test_ge_beam3_station_resultant_cell.py +++ b/tests/test_ge_beam3_station_resultant_cell.py @@ -4,7 +4,7 @@ import json import numpy as np import pytest -from anysolver._ge_beam3_p5.section import SectionHistory +from anyfesolver._ge_beam3_p5.section import SectionHistory from docs.reference_cases.ge_beam3_station_resultant_cell import StationResultantCell, pair from docs.reference_cases.ge_beam3_decimal_cell_force_audit import audit from test_ge_beam3_plastic_cell_conjugate_probe import build diff --git a/tests/test_ge_beam3_uniform_arch_eight.py b/tests/test_ge_beam3_uniform_arch_eight.py index ee2bd3d5b..ecfc22eeb 100644 --- a/tests/test_ge_beam3_uniform_arch_eight.py +++ b/tests/test_ge_beam3_uniform_arch_eight.py @@ -3,16 +3,16 @@ from hashlib import sha256 from pathlib import Path import numpy as np -from anysolver.fe_core import FEModel -from anysolver.boundary import BoundaryCondition -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference -from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection -from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_native_translation import TranslationProgram,solve_translation -from anysolver._ge_beam3_native_translation_restart import decode_checkpoint,encode_checkpoint -from anysolver._ge_beam3_native_generalized_recovery import recover_native_fields +from anyfesolver.fe_core import FEModel +from anyfesolver.boundary import BoundaryCondition +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference +from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection +from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_native_translation import TranslationProgram,solve_translation +from anyfesolver._ge_beam3_native_translation_restart import decode_checkpoint,encode_checkpoint +from anyfesolver._ge_beam3_native_generalized_recovery import recover_native_fields from docs.reference_cases.ge_beam3_uniform_arch_reference import solve as continuum from docs.reference_cases.ge_beam3_uniform_arch_fields import fields from docs.reference_cases.ge_beam3_preserved_arch_load_comparison import parse diff --git a/tests/test_ge_beam3_uniform_arch_peak.py b/tests/test_ge_beam3_uniform_arch_peak.py index da09bfc59..cbeb27c82 100644 --- a/tests/test_ge_beam3_uniform_arch_peak.py +++ b/tests/test_ge_beam3_uniform_arch_peak.py @@ -9,10 +9,10 @@ from docs.reference_cases.ge_beam3_uniform_arch_reference import solve as continuum from docs.reference_cases.ge_beam3_uniform_arch_fields import fields from docs.reference_cases.ge_beam3_preserved_arch_load_comparison import parse -from anysolver._ge_beam3_native_translation import solve_translation -from anysolver._ge_beam3_native_translation_restart import decode_checkpoint,encode_checkpoint -from anysolver._ge_beam3_native_generalized_recovery import recover_native_fields -from anysolver._ge_beam3_native_history_profile import HISTORY8M +from anyfesolver._ge_beam3_native_translation import solve_translation +from anyfesolver._ge_beam3_native_translation_restart import decode_checkpoint,encode_checkpoint +from anyfesolver._ge_beam3_native_generalized_recovery import recover_native_fields +from anyfesolver._ge_beam3_native_history_profile import HISTORY8M from test_ge_beam3_uniform_arch_sixteen import make as base_model,SECTION from test_ge_beam3_native_translation import bar,packet from test_ge_beam3_schur_line_program import save diff --git a/tests/test_ge_beam3_uniform_arch_refinement.py b/tests/test_ge_beam3_uniform_arch_refinement.py index 82d5f29b8..7fd0b2c51 100644 --- a/tests/test_ge_beam3_uniform_arch_refinement.py +++ b/tests/test_ge_beam3_uniform_arch_refinement.py @@ -3,16 +3,16 @@ from hashlib import sha256 from pathlib import Path import numpy as np -from anysolver.fe_core import FEModel -from anysolver.boundary import BoundaryCondition -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference -from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection -from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_native_translation import TranslationProgram,solve_translation -from anysolver._ge_beam3_native_translation_restart import decode_checkpoint,encode_checkpoint -from anysolver._ge_beam3_native_generalized_recovery import recover_native_fields +from anyfesolver.fe_core import FEModel +from anyfesolver.boundary import BoundaryCondition +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference +from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection +from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_native_translation import TranslationProgram,solve_translation +from anyfesolver._ge_beam3_native_translation_restart import decode_checkpoint,encode_checkpoint +from anyfesolver._ge_beam3_native_generalized_recovery import recover_native_fields from docs.reference_cases.ge_beam3_uniform_arch_reference import solve as continuum from docs.reference_cases.ge_beam3_uniform_arch_fields import fields from docs.reference_cases.ge_beam3_preserved_arch_load_comparison import parse diff --git a/tests/test_ge_beam3_uniform_arch_sixteen.py b/tests/test_ge_beam3_uniform_arch_sixteen.py index d4d18a020..aae7021e6 100644 --- a/tests/test_ge_beam3_uniform_arch_sixteen.py +++ b/tests/test_ge_beam3_uniform_arch_sixteen.py @@ -1,19 +1,19 @@ """Sixteen-macro diagnostic with explicit history capacity; unchanged arch physics.""" from dataclasses import asdict -from anysolver._ge_beam3_native_history_profile import HISTORY8M +from anyfesolver._ge_beam3_native_history_profile import HISTORY8M from hashlib import sha256 from pathlib import Path import numpy as np -from anysolver.fe_core import FEModel -from anysolver.boundary import BoundaryCondition -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference -from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection -from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_native_translation import TranslationProgram,solve_translation -from anysolver._ge_beam3_native_translation_restart import decode_checkpoint,encode_checkpoint -from anysolver._ge_beam3_native_generalized_recovery import recover_native_fields +from anyfesolver.fe_core import FEModel +from anyfesolver.boundary import BoundaryCondition +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference +from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection +from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_native_translation import TranslationProgram,solve_translation +from anyfesolver._ge_beam3_native_translation_restart import decode_checkpoint,encode_checkpoint +from anyfesolver._ge_beam3_native_generalized_recovery import recover_native_fields from docs.reference_cases.ge_beam3_uniform_arch_reference import solve as continuum from docs.reference_cases.ge_beam3_uniform_arch_fields import fields from docs.reference_cases.ge_beam3_preserved_arch_load_comparison import parse diff --git a/tests/test_ge_beam3_variational_shell.py b/tests/test_ge_beam3_variational_shell.py index 6f2a94d0a..5771a95d7 100644 --- a/tests/test_ge_beam3_variational_shell.py +++ b/tests/test_ge_beam3_variational_shell.py @@ -5,11 +5,11 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_variational_shell import deformation, rotation_jets, response -from anysolver._ge_beam3_pose_joint import _exp_terms -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver._ge_beam3_shell_joint_trial import ShellBeamTrialAssembly -from anysolver._ge_beam3_shell_joint_state import CoupledShellBeamAnalysis +from anyfesolver._ge_beam3_variational_shell import deformation, rotation_jets, response +from anyfesolver._ge_beam3_pose_joint import _exp_terms +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_shell_joint_trial import ShellBeamTrialAssembly +from anyfesolver._ge_beam3_shell_joint_state import CoupledShellBeamAnalysis from test_ge_beam3_coupled_free_beam import build from test_ge_beam3_shell_joint_trial import specimen, norm_error diff --git a/tests/test_ge_beam3_virgin_reference_modes.py b/tests/test_ge_beam3_virgin_reference_modes.py index c8658a51f..136dd4197 100644 --- a/tests/test_ge_beam3_virgin_reference_modes.py +++ b/tests/test_ge_beam3_virgin_reference_modes.py @@ -3,12 +3,12 @@ import numpy as np import pytest -from anysolver._ge_beam3_virgin_reference_modes import solve_virgin_reference_modes -from anysolver._ge_beam3_p5_loads import NativeP5BeamElement, DirectedHardeningSection -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry -from anysolver._ge_beam3_p5_loads.core import canonical -from anysolver.fe_core import FEModel -from anysolver.boundary import BoundaryCondition +from anyfesolver._ge_beam3_virgin_reference_modes import solve_virgin_reference_modes +from anyfesolver._ge_beam3_p5_loads import NativeP5BeamElement, DirectedHardeningSection +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry +from anyfesolver._ge_beam3_p5_loads.core import canonical +from anyfesolver.fe_core import FEModel +from anyfesolver.boundary import BoundaryCondition from test_ge_beam3_native_load_state import problem @@ -53,7 +53,7 @@ def test_curved_coupled_reference_keeps_six_rigid_modes(): @pytest.mark.parametrize('kind', ['displaced', 'loaded_state', 'missing_state', 'bad_inertia']) def test_nonvirgin_or_invalid_inputs_cannot_enter_reference_kernel(kind, monkeypatch): - import anysolver._ge_beam3_virgin_reference_modes as adapter + import anyfesolver._ge_beam3_virgin_reference_modes as adapter from test_ge_beam3_loaded_modal import accepted model = problem(); states = initial(model); total = np.zeros(18) inertias = {1: np.eye(6)} @@ -69,7 +69,7 @@ def forbidden(*args, **kwargs): raise AssertionError('reference factor kernel mu def test_model_changed_inside_reference_solver_is_rejected_after_return(monkeypatch): - import anysolver._ge_beam3_virgin_reference_modes as adapter + import anyfesolver._ge_beam3_virgin_reference_modes as adapter model = problem(); states = initial(model); solve = adapter.solve_reference_factor_spectrum def changed(*args, **kwargs): result = solve(*args, **kwargs) diff --git a/tests/test_general_contact_adaptive_overlap_certificate.py b/tests/test_general_contact_adaptive_overlap_certificate.py index 19c526435..09ce15e4b 100644 --- a/tests/test_general_contact_adaptive_overlap_certificate.py +++ b/tests/test_general_contact_adaptive_overlap_certificate.py @@ -6,7 +6,7 @@ """ import numpy as np import pytest -from anysolver.general_contact import q4_overlap_local_bound as bounds +from anyfesolver.general_contact import q4_overlap_local_bound as bounds BUDGET=5e-5 diff --git a/tests/test_general_contact_admission_globalization_driver.py b/tests/test_general_contact_admission_globalization_driver.py index bdbeee9af..7f85f16f1 100644 --- a/tests/test_general_contact_admission_globalization_driver.py +++ b/tests/test_general_contact_admission_globalization_driver.py @@ -13,15 +13,15 @@ import numpy as np import pytest -from anysolver import solve_static_nonlinear -from anysolver.control import SolveCancelled -from anysolver.general_contact import static_path -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.general_contact.semismooth_path import ( +from anyfesolver import solve_static_nonlinear +from anyfesolver.control import SolveCancelled +from anyfesolver.general_contact import static_path +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.semismooth_path import ( SemismoothStep, solve_increment, ) -from anysolver.nonlinear_restart import ( +from anyfesolver.nonlinear_restart import ( _CHECKPOINT_HASH_KEY, _checkpoint_without_hash, _sha256, diff --git a/tests/test_general_contact_admission_globalization_driver_small_patch.py b/tests/test_general_contact_admission_globalization_driver_small_patch.py index 2fa488021..d0156184f 100644 --- a/tests/test_general_contact_admission_globalization_driver_small_patch.py +++ b/tests/test_general_contact_admission_globalization_driver_small_patch.py @@ -92,18 +92,18 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathNodalForce, ContactPathProgram, ContactSolverSettings, ContactSurface, create_shell_element, solve_static_nonlinear, ) -from anysolver.control import SolveCancelled -from anysolver.fe_core import FEModel -from anysolver.general_contact import s3_patch_static, static_path -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.general_contact.semismooth_path import SemismoothStep -from anysolver.nonlinear_restart import ( +from anyfesolver.control import SolveCancelled +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact import s3_patch_static, static_path +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.semismooth_path import SemismoothStep +from anyfesolver.nonlinear_restart import ( _CHECKPOINT_HASH_KEY, _checkpoint_without_hash, _sha256, diff --git a/tests/test_general_contact_admission_globalization_driver_small_patch_partial.py b/tests/test_general_contact_admission_globalization_driver_small_patch_partial.py index 000a60df6..6efd2b554 100644 --- a/tests/test_general_contact_admission_globalization_driver_small_patch_partial.py +++ b/tests/test_general_contact_admission_globalization_driver_small_patch_partial.py @@ -17,7 +17,7 @@ """ import pytest -from anysolver.control import SolveCancelled +from anyfesolver.control import SolveCancelled from test_general_contact_admission_globalization_driver_small_patch import ( _CancelAt, diff --git a/tests/test_general_contact_admission_globalization_driver_small_patch_probe.py b/tests/test_general_contact_admission_globalization_driver_small_patch_probe.py index 97f835b9c..c77882c6d 100644 --- a/tests/test_general_contact_admission_globalization_driver_small_patch_probe.py +++ b/tests/test_general_contact_admission_globalization_driver_small_patch_probe.py @@ -24,8 +24,8 @@ _enabled, _solve, ) -from anysolver.general_contact import s3_patch_static, static_path -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact import s3_patch_static, static_path +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager def _hook_targets(): diff --git a/tests/test_general_contact_admission_globalization_remaining.py b/tests/test_general_contact_admission_globalization_remaining.py index ca3aa1468..9fe284a47 100644 --- a/tests/test_general_contact_admission_globalization_remaining.py +++ b/tests/test_general_contact_admission_globalization_remaining.py @@ -15,7 +15,7 @@ import numpy as np -from anysolver.general_contact.q4_overlap_local_bound import ( +from anyfesolver.general_contact.q4_overlap_local_bound import ( overlap_violating_point_witness, ) from test_general_contact_admission_globalization_witness_public import ( diff --git a/tests/test_general_contact_admission_globalization_restart_reader.py b/tests/test_general_contact_admission_globalization_restart_reader.py index 2b8f0b700..55161b0a2 100644 --- a/tests/test_general_contact_admission_globalization_restart_reader.py +++ b/tests/test_general_contact_admission_globalization_restart_reader.py @@ -23,7 +23,7 @@ import numpy as np import pytest -from anysolver.general_contact.static_path import ( +from anyfesolver.general_contact.static_path import ( _CONTACT_PATH_PHYSICAL_SUBSTEPS_REVISION, _validate_continuation_history_record, ) diff --git a/tests/test_general_contact_admission_globalization_witness_public.py b/tests/test_general_contact_admission_globalization_witness_public.py index e1421060f..be9fd24fe 100644 --- a/tests/test_general_contact_admission_globalization_witness_public.py +++ b/tests/test_general_contact_admission_globalization_witness_public.py @@ -14,19 +14,19 @@ import numpy as np import pytest -from anysolver import (ContactRequestIdentityError, LoadCase, +from anyfesolver import (ContactRequestIdentityError, LoadCase, identify_general_contact_request) -from anysolver.general_contact import validate_general_contact -from anysolver.general_contact import s3_patch_static -from anysolver.general_contact.core import _contact_settings_contract -from anysolver.general_contact.q4_overlap_local_bound import ( +from anyfesolver.general_contact import validate_general_contact +from anyfesolver.general_contact import s3_patch_static +from anyfesolver.general_contact.core import _contact_settings_contract +from anyfesolver.general_contact.q4_overlap_local_bound import ( _divide_positive, overlap_violating_point_witness, ) -from anysolver.general_contact.request_identity import ( +from anyfesolver.general_contact.request_identity import ( verify_general_contact_request, ) -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from scripts.general_contact_d1_interior_press_dev import build_interior_press from test_general_contact_q4_s3_patch_static import _case diff --git a/tests/test_general_contact_algebraic_path.py b/tests/test_general_contact_algebraic_path.py index 7fcfe9677..9afea6814 100644 --- a/tests/test_general_contact_algebraic_path.py +++ b/tests/test_general_contact_algebraic_path.py @@ -4,14 +4,14 @@ import pytest from scipy.optimize import minimize_scalar, root -from anysolver import ContactNodalLoadHistory, ContactTransientSolverControls, TransientConfig, solve_transient_contact -from anysolver.matrix_assembly import assemble_stiffness_matrix -import anysolver.general_contact.transient as driver +from anyfesolver import ContactNodalLoadHistory, ContactTransientSolverControls, TransientConfig, solve_transient_contact +from anyfesolver.matrix_assembly import assemble_stiffness_matrix +import anyfesolver.general_contact.transient as driver from test_general_contact_transient_plane import _guided_s3_descriptor_impact, _uniform_s3_normal_load from s3_vk_element_oracle import S3VonKarmanExcess -from anysolver.general_contact.algebraic_path import affine_descriptor_path -import anysolver.general_contact.algebraic_path as path_kernel +from anyfesolver.general_contact.algebraic_path import affine_descriptor_path +import anyfesolver.general_contact.algebraic_path as path_kernel @pytest.mark.parametrize("physical", [[.1, -.2, 0.], [.1, -.8, .8]]) @@ -296,7 +296,7 @@ def solve(end, checkpoint=None, emit=False): getattr(direct, field), rtol=0., atol=1e-11) np.testing.assert_allclose(prefix.represented_path_transition_times+resumed.represented_path_transition_times, direct.represented_path_transition_times, rtol=0., atol=1e-12) - from anysolver.general_contact.core import active_contact_manager + from anyfesolver.general_contact.core import active_contact_manager commits = [] original_commit = driver.commit_state_candidate def commit(*args, **kwargs): diff --git a/tests/test_general_contact_arc_length.py b/tests/test_general_contact_arc_length.py index 6369f9de8..78c85fe0c 100644 --- a/tests/test_general_contact_arc_length.py +++ b/tests/test_general_contact_arc_length.py @@ -7,16 +7,16 @@ from examples.general_contact_arc_length import analysis from examples.general_contact_triangulated_rigid_patch import case from test_general_contact_triangulated_rigid_patch import independent_mass -from anysolver import solve_static_arc_length,ArcLengthControl,LoadCase -from anysolver.matrix_assembly import assemble_stiffness_matrix -from anysolver.general_contact import report_general_contact_capability -from anysolver.general_contact.runtime import active_contact_manager -from anysolver.general_contact.arc_contact import PROFILE,ArcContactAdapter +from anyfesolver import solve_static_arc_length,ArcLengthControl,LoadCase +from anyfesolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.general_contact import report_general_contact_capability +from anyfesolver.general_contact.runtime import active_contact_manager +from anyfesolver.general_contact.arc_contact import PROFILE,ArcContactAdapter def test_actual_arc_patch_response_restart(monkeypatch): import importlib - arc=importlib.import_module('anysolver.arc_length');captured=[] + arc=importlib.import_module('anyfesolver.arc_length');captured=[] real=arc._support_reaction_resultants_from_forces def recover(model,internal,constant,proportional,factor,**kwargs): captured.append(np.asarray(internal)-np.asarray(constant)-factor*np.asarray(proportional)) @@ -79,7 +79,7 @@ def test_arc_refusal_cancel_and_exception(monkeypatch): assert report_general_contact_capability(model,definition,settings,analysis_control='arc_length').validation.profile==PROFILE for extra in ({'kinematics':'corotational'},{'imperfection':{}}): with pytest.raises(ValueError):solve_static_arc_length(model,load,**kwargs,**extra) - from anysolver.control import CancellationToken,SolveCancelled + from anyfesolver.control import CancellationToken,SolveCancelled token=CancellationToken();token.cancel() with pytest.raises(SolveCancelled):solve_static_arc_length(model,load,**kwargs,cancellation_token=token) assert active_contact_manager() is None @@ -109,7 +109,7 @@ def test_no_contact_linear_response_compatibility(): @pytest.mark.skipif(not os.environ.get('ARC_CONTACT_DIAGNOSTIC'),reason='explicit exploratory diagnostic only') def test_first_arc_failure_discriminator(monkeypatch): import importlib - arc=importlib.import_module('anysolver.arc_length') + arc=importlib.import_module('anyfesolver.arc_length') original=arc._finalize_arc_element_states sweeps=[];old_admissible=ArcContactAdapter.admissible def check(self,start,end): @@ -132,8 +132,8 @@ def final(model,u,states,num_layers,info,**kwargs): def test_inflight_cancel_and_rejected_retry(monkeypatch): import importlib - arc=importlib.import_module('anysolver.arc_length') - from anysolver.control import CancellationToken,SolveCancelled + arc=importlib.import_module('anyfesolver.arc_length') + from anyfesolver.control import CancellationToken,SolveCancelled token=CancellationToken();real_safe=arc.cancellation_safe_point;seen=[];real_commit=ArcContactAdapter.commit def safe(value,stage=''): if stage=='arc_length.contact_before_commit':token.cancel('in flight') @@ -161,7 +161,7 @@ def once(self,start,end): def test_recomputed_intermediate_history_mutation_refuses(): import hashlib - from anysolver.general_contact import transient_results_archive as codec + from anyfesolver.general_contact import transient_results_archive as codec prefix=analysis(2);capsule=prefix.to_restart_checkpoint() history=codec._decode(capsule['path_state']['contact_state']['history'],codec._Budget(codec.MAX_BYTES),{}) manager=ArcContactAdapter(*case()) @@ -171,7 +171,7 @@ def test_recomputed_intermediate_history_mutation_refuses(): history[0]['contact']=manager.prepare(history[0]['displacements'],1,history[0]['load_factor'])['contact'] capsule['path_state']['contact_state']['history']=codec._encode(history,codec._Budget(codec.MAX_BYTES),{}) unsigned=dict(capsule);unsigned.pop('checkpoint_sha256') - from anysolver.nonlinear_restart import canonical_checkpoint_json_bytes + from anyfesolver.nonlinear_restart import canonical_checkpoint_json_bytes capsule['checkpoint_sha256']=hashlib.sha256(canonical_checkpoint_json_bytes(unsigned)).hexdigest().upper() with pytest.raises(ValueError,match='structural step metric|spherical constraint|predictor history'): analysis(1,capsule) @@ -204,7 +204,7 @@ def test_zero_accepted_contact_failure_is_explicit(): def test_intact_checkpoint_settings_incompatibility(): - from anysolver.nonlinear_restart import load_nonlinear_checkpoint + from anyfesolver.nonlinear_restart import load_nonlinear_checkpoint prefix=analysis(2) capsule=prefix.to_restart_checkpoint() verified=load_nonlinear_checkpoint(capsule) diff --git a/tests/test_general_contact_arc_length_affine.py b/tests/test_general_contact_arc_length_affine.py index 2555a8fa9..0871ae662 100644 --- a/tests/test_general_contact_arc_length_affine.py +++ b/tests/test_general_contact_arc_length_affine.py @@ -5,14 +5,14 @@ import pytest from examples.general_contact_arc_length_affine import build,analysis from test_general_contact_triangulated_rigid_patch import independent_mass -from anysolver.matrix_assembly import assemble_stiffness_matrix -from anysolver.general_contact.arc_contact import ArcContactAdapter -from anysolver.general_contact.runtime import active_contact_manager +from anyfesolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.general_contact.arc_contact import ArcContactAdapter +from anyfesolver.general_contact.runtime import active_contact_manager @pytest.mark.parametrize('preload',[False,True]) def test_affine_preload_response_restart(preload,monkeypatch): - arc=importlib.import_module('anysolver.arc_length');captured=[] + arc=importlib.import_module('anyfesolver.arc_length');captured=[] real=arc._support_reaction_resultants_from_forces def recover(model,internal,constant,proportional,factor,**kwargs): captured.append(np.asarray(internal)-np.asarray(constant)-factor*np.asarray(proportional)) @@ -38,7 +38,7 @@ def oracle(lam): if np.all(weighted[A]<0.) and np.all(weighted[~A]>=0.):return u raise AssertionError('no independent active set') if preload: - from anysolver.general_contact import transient_results_archive as codec + from anyfesolver.general_contact import transient_results_archive as codec base_record=codec._decode(result.restart_checkpoint['path_state']['contact_state']['base'],codec._Budget(codec.MAX_BYTES),{}) base=base_record['displacements'][z] assert np.linalg.norm(base-oracle(0.))/1e-5<1e-6 @@ -76,8 +76,8 @@ def forbidden(*args,**kwargs):raise AssertionError('preload rerun') def test_preload_cancel_and_exception(monkeypatch): - from anysolver.control import CancellationToken,SolveCancelled - static=importlib.import_module('anysolver.nonlinear_static');original=static._assemble_nonlinear_system + from anyfesolver.control import CancellationToken,SolveCancelled + static=importlib.import_module('anyfesolver.nonlinear_static');original=static._assemble_nonlinear_system calls=[] def broken(*args,**kwargs): calls.append(True) @@ -92,8 +92,8 @@ def broken(*args,**kwargs): def test_zero_force_prescribed_preload_and_inflight_cancel(monkeypatch): - from anysolver.general_contact import transient_results_archive as codec - from anysolver.control import CancellationToken,SolveCancelled + from anyfesolver.general_contact import transient_results_archive as codec + from anyfesolver.control import CancellationToken,SolveCancelled result=analysis(1,preload_force=0.) base=codec._decode(result.restart_checkpoint['path_state']['contact_state']['base'],codec._Budget(codec.MAX_BYTES),{}) model,_,_,_,_=build(True) @@ -104,7 +104,7 @@ def test_zero_force_prescribed_preload_and_inflight_cancel(monkeypatch): K,_=assemble_stiffness_matrix(model) assert np.linalg.norm((K@base['displacements'])[z[1:]]) <= 1e-6 assert base['history'][-1]['load_factor']==1. - static=importlib.import_module('anysolver.nonlinear_static');real=static.cancellation_safe_point + static=importlib.import_module('anyfesolver.nonlinear_static');real=static.cancellation_safe_point token=CancellationToken();observed=[] def cancel(value,stage=''): if stage!='nonlinear_static.start': @@ -117,8 +117,8 @@ def cancel(value,stage=''): def test_resigned_preload_intermediate_constraint_refusal(): import copy,hashlib - from anysolver.general_contact import transient_results_archive as codec - from anysolver.nonlinear_restart import canonical_checkpoint_json_bytes + from anyfesolver.general_contact import transient_results_archive as codec + from anyfesolver.nonlinear_restart import canonical_checkpoint_json_bytes result=analysis(1);capsule=copy.deepcopy(result.to_restart_checkpoint()) namespace=capsule['path_state']['contact_state'] base=codec._decode(namespace['base'],codec._Budget(codec.MAX_BYTES),{}) @@ -133,7 +133,7 @@ def test_resigned_preload_intermediate_constraint_refusal(): def test_unselected_plastic_preload_refuses_before_preload(monkeypatch): - from anysolver import create_shell_element,solve_static_arc_length + from anyfesolver import create_shell_element,solve_static_arc_length model,definition,settings,load,constant=build(True) model.add_material('unselected_plastic',1e5,.3,yield_stress=1.) model.add_element(3,create_shell_element(3,(1,2,4),'unselected_plastic',thickness=.01, @@ -148,8 +148,8 @@ def forbidden(*args,**kwargs):raise AssertionError('physical preload started') def test_resigned_preload_history_summary_inventory_refusal(): import copy,hashlib - from anysolver.general_contact import transient_results_archive as codec - from anysolver.nonlinear_restart import canonical_checkpoint_json_bytes + from anyfesolver.general_contact import transient_results_archive as codec + from anyfesolver.nonlinear_restart import canonical_checkpoint_json_bytes capsule=copy.deepcopy(analysis(1).to_restart_checkpoint()) namespace=capsule['path_state']['contact_state'] base=codec._decode(namespace['base'],codec._Budget(codec.MAX_BYTES),{}) diff --git a/tests/test_general_contact_arc_length_release.py b/tests/test_general_contact_arc_length_release.py index 25d1e5368..9b26cc67a 100644 --- a/tests/test_general_contact_arc_length_release.py +++ b/tests/test_general_contact_arc_length_release.py @@ -7,9 +7,9 @@ import numpy as np -from anysolver import ArcLengthControl, LoadCase, solve_static_arc_length -from anysolver.matrix_assembly import assemble_stiffness_matrix -from anysolver.general_contact.runtime import active_contact_manager +from anyfesolver import ArcLengthControl, LoadCase, solve_static_arc_length +from anyfesolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.general_contact.runtime import active_contact_manager from examples.general_contact_arc_length_affine import build from s3_von_karman_oracle import model_triangle_von_karman @@ -118,8 +118,8 @@ def _wrench(model, pose, residual, factor, contact): def test_active_preload_to_open_reverse_arc_complete_restart(monkeypatch): - arc = importlib.import_module('anysolver.arc_length') - static = importlib.import_module('anysolver.nonlinear_static') + arc = importlib.import_module('anyfesolver.arc_length') + static = importlib.import_module('anyfesolver.nonlinear_static') actual_arc, actual_static = arc._support_reaction_resultants_from_forces, static._support_reaction_resultants arc_rows, preload_rows = [], [] def capture_arc(model, internal, constant, proportional, factor, **kwargs): @@ -139,7 +139,7 @@ def capture_static(model, imbalance, **kwargs): Path(output).with_name('accepted_full.checkpoint').write_bytes(full.restart_checkpoint_bytes()) model, *_ = _case() ids, oracle = _reference(model) - from anysolver.general_contact import transient_results_archive as codec + from anyfesolver.general_contact import transient_results_archive as codec base = codec._decode(full.to_restart_checkpoint()['path_state']['contact_state']['base'], codec._Budget(codec.MAX_BYTES), {}) previous = base['displacements'].copy() diff --git a/tests/test_general_contact_arc_results_archive.py b/tests/test_general_contact_arc_results_archive.py index a23438baf..010440e21 100644 --- a/tests/test_general_contact_arc_results_archive.py +++ b/tests/test_general_contact_arc_results_archive.py @@ -4,11 +4,11 @@ from pathlib import Path import numpy as np import pytest -from anysolver.arc_length import ArcLengthResult,ArcLengthStep -from anysolver.nonlinear_static import NonlinearIncrementSnapshot -from anysolver.general_contact import (ArcContactArchiveError as Error, +from anyfesolver.arc_length import ArcLengthResult,ArcLengthStep +from anyfesolver.nonlinear_static import NonlinearIncrementSnapshot +from anyfesolver.general_contact import (ArcContactArchiveError as Error, serialize_arc_contact_results as serialize,read_arc_contact_results as read) -from anysolver.general_contact import transient_results_archive as codec +from anyfesolver.general_contact import transient_results_archive as codec from test_general_contact_static_results_archive import assert_producer_data @@ -49,7 +49,7 @@ def test_unknown_and_active_material_before_callbacks(monkeypatch): class Malicious: def __deepcopy__(self,memo):pytest.fail('untrusted copy callback') with pytest.raises(Error):serialize(replace(sample(),element_states={1:Malicious()})) - from anysolver.nonlinear_state import NonlinearStateStore + from anyfesolver.nonlinear_state import NonlinearStateStore store=NonlinearStateStore();monkeypatch.setattr(NonlinearStateStore,'has_active_trial',property(lambda self:True)) monkeypatch.setattr(NonlinearStateStore,'materialize_owned',lambda *a,**k:pytest.fail('active copy')) with pytest.raises(Error):serialize(replace(sample(),element_states=store)) @@ -83,12 +83,12 @@ def test_actual_arc_producer_consumer(): def test_legacy_static_and_transient_wire_unchanged(): from test_general_contact_static_results_archive import sample as static_sample from test_general_contact_transient_results_archive import sample as transient_sample - from anysolver.general_contact import static_results_archive as static + from anyfesolver.general_contact import static_results_archive as static baseline=Path(os.environ['ARC_ARCHIVE_LEGACY_ROOT']) rows=[] for name,producer,current in (('transient_results_archive',transient_sample,codec), ('static_results_archive',static_sample,static)): - path=baseline/(name+'.py');alias='anysolver.general_contact._legacy_'+name + path=baseline/(name+'.py');alias='anyfesolver.general_contact._legacy_'+name spec=importlib.util.spec_from_file_location(alias,path);module=importlib.util.module_from_spec(spec) sys.modules[alias]=module try: diff --git a/tests/test_general_contact_augmentation_secant.py b/tests/test_general_contact_augmentation_secant.py index 4e04f30c6..14c48448f 100644 --- a/tests/test_general_contact_augmentation_secant.py +++ b/tests/test_general_contact_augmentation_secant.py @@ -6,13 +6,13 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( ContactSolverSettings, solve_static_nonlinear, validate_general_contact, ) -from anysolver.general_contact.augmentation import ( +from anyfesolver.general_contact.augmentation import ( ProjectedAugmentationSecant, propose_active_set_pivot, ) -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from examples.general_contact_refined_q4_s3_mixed_path import make_case diff --git a/tests/test_general_contact_automatic_domain.py b/tests/test_general_contact_automatic_domain.py index 97ebe45d1..4f3b56716 100644 --- a/tests/test_general_contact_automatic_domain.py +++ b/tests/test_general_contact_automatic_domain.py @@ -5,8 +5,8 @@ import numpy as np import pytest -from anysolver import FEModel,BoundaryCondition,create_shell_element -from anysolver.general_contact import (ContactSurface,ContactInteraction,RigidContactBody,ContactSolverSettings, +from anyfesolver import FEModel,BoundaryCondition,create_shell_element +from anyfesolver.general_contact import (ContactSurface,ContactInteraction,RigidContactBody,ContactSolverSettings, AutomaticContactParticipant as Participant,AutomaticContactDefaults as Defaults, AutomaticContactDomain as Domain,AutomaticContactDomainError, resolve_automatic_contact_domain as resolve,verify_automatic_contact_resolution as verify) @@ -77,7 +77,7 @@ def test_coarser_median_reference_role_and_stable_tie(): def test_q4_bilinear_area_is_not_diagonal_area(): - from anysolver.general_contact.automatic_domain import _face_area + from anyfesolver.general_contact.automatic_domain import _face_area corners=np.array(((0.,0.,0.),(1.,0.,0.),(1.,1.,.3),(0.,1.,0.))) # Independent graph z=.3*x*y on unit square, high-order 1D quadrature product. nodes,weights=np.polynomial.legendre.leggauss(40);x=(nodes+1)/2 @@ -88,7 +88,7 @@ def test_q4_bilinear_area_is_not_diagonal_area(): def test_exact_equal_q4_s3_area_role_and_rigid_transform(): - from anysolver.general_contact.automatic_domain import _face_area,_coarser_source + from anyfesolver.general_contact.automatic_domain import _face_area,_coarser_source q4=np.array(((0.,0.,0.),(1.,0.,0.),(1.,1.,0.),(0.,1.,0.))) s3=np.array(((0.,0.,0.),(2.,0.,0.),(0.,1.,0.))) rotation=np.array(((0.,-1.,0.),(1.,0.,0.),(0.,0.,1.))) @@ -99,7 +99,7 @@ def test_exact_equal_q4_s3_area_role_and_rigid_transform(): def test_reference_fold_nonfinite_and_degenerate_refusal(): - from anysolver.general_contact.automatic_domain import _face_area + from anyfesolver.general_contact.automatic_domain import _face_area for corners in ( ((0.,0.,0.),(1.,1.,0.),(1.,0.,0.),(0.,1.,0.)), ((0.,0.,0.),(1.,0.,0.),(2.,0.,0.),(3.,0.,0.)), @@ -123,7 +123,7 @@ def test_s3_formulation_owned_selected_skin_offset(): def test_physical_skin_binding_median_and_persistence(): - from anysolver.general_contact.automatic_domain import _reference,_coarser_source + from anyfesolver.general_contact.automatic_domain import _reference,_coarser_source model=FEModel('median-not-total');model.add_material('elastic',1e5,.3,density=1.) participants=[];eid=0 for name,count,area,z in (('many-fine',2,.5,.1),('one-coarse',1,.75,0.)): @@ -251,7 +251,7 @@ def test_oblique_rigid_component_persistence_is_bit_exact(): @pytest.mark.skipif(os.environ.get('ANY_RUN_AUTOMATIC_SHELL_PAIR')!='1', reason='bounded ordinary Q4/S3 automatic-domain integration') def test_actual_nonmatching_shell_pair_path_parity_and_restart(): - from anysolver import ContactDefinition,solve_static_nonlinear + from anyfesolver import ContactDefinition,solve_static_nonlinear from examples.general_contact_automatic_domain import build_shell_pair,solve_shell_pair model,domain,settings,resolution,path=build_shell_pair() selected=next(row for row in resolution.selections if row.disposition=='resolved') @@ -273,9 +273,9 @@ def record(name,result): if result.restart_checkpoint is not None:report['stages'][name]['checkpoint']=result.to_restart_checkpoint() save() assert result.status=='completed',result.failure_reason - import anysolver,numba + import anyfesolver,numba from threadpoolctl import threadpool_info - report['runtime_before_solve']=dict(anysolver_path=anysolver.__file__, + report['runtime_before_solve']=dict(anyfesolver_path=anyfesolver.__file__, automatic_domain_path=__import__('inspect').getfile(resolve), jit_disabled=bool(numba.config.DISABLE_JIT),numba_threads=int(numba.get_num_threads()), pools=threadpool_info()) @@ -342,7 +342,7 @@ def record(name,result): reason='bounded refined projected Q4/S3 automatic-domain press') def test_actual_projected_shell_pair_press_and_checkpoint(monkeypatch): from examples.general_contact_automatic_domain import build_projected_shell_pair,solve_shell_pair - import anysolver,numba + import anyfesolver,numba from threadpoolctl import threadpool_info model,domain,settings,resolution,path=build_projected_shell_pair() report=dict(fixture='refined_projected_penalty_separate_from_single_Q4_penalty', @@ -351,7 +351,7 @@ def test_actual_projected_shell_pair_press_and_checkpoint(monkeypatch): criteria=dict(force_scale_n=.02,moment_scale_nm=.02,energy_scale_j=2e-7, scale_basis='k1000 * total Q4 area1 * nominal20um penetration; lever1m', wrench_normalized_tolerance=1e-6,gap_budget_m=5e-5), - runtime_before_solve=dict(anysolver_path=anysolver.__file__, + runtime_before_solve=dict(anyfesolver_path=anyfesolver.__file__, automatic_domain_path=__import__('inspect').getfile(resolve), jit_disabled=bool(numba.config.DISABLE_JIT),numba_threads=int(numba.get_num_threads()), pools=threadpool_info())) @@ -360,7 +360,7 @@ def save(): Path(os.environ['AUTOMATIC_DOMAIN_RESULT']).write_text(json.dumps(report,indent=2,default=lambda x:x.item() if isinstance(x,np.generic) else x.tolist()),encoding='utf-8') save() if os.environ.get('AUTOMATIC_WORKFLOW_STAGE','').startswith('press-trace'): - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager original=GeneralS3PatchManager._swept_admissible trace=[];report['proposal_trace']=trace def observed(manager,start,end): @@ -401,10 +401,10 @@ def observed(manager,start,end): reason='bounded installed refined automatic deformable lifecycle') def test_actual_projected_shell_pair_lifecycle_and_restart(): """One guarded stage per invocation, sharing only retained JSON evidence.""" - import anysolver,numba + import anyfesolver,numba from threadpoolctl import threadpool_info - from anysolver import ContactDefinition,solve_static_nonlinear - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver import ContactDefinition,solve_static_nonlinear + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from examples.general_contact_automatic_domain import build_projected_shell_pair,solve_shell_pair raw_stage=os.environ.get('AUTOMATIC_WORKFLOW_STAGE','full-press-v3') press_only='-press' in raw_stage @@ -419,7 +419,7 @@ def test_actual_projected_shell_pair_lifecycle_and_restart(): force_moment_normalized_tolerance=1e-6,gap_budget_m=5e-5, displacement_parity_rtol=1e-7,displacement_parity_atol_m=1e-9, scale_basis='k1000 * area1 * nominal20um penetration; lever1m'), - runtime_before_solve=dict(anysolver_path=anysolver.__file__, + runtime_before_solve=dict(anyfesolver_path=anyfesolver.__file__, automatic_domain_path=__import__('inspect').getfile(resolve), jit_disabled=bool(numba.config.DISABLE_JIT),numba_threads=int(numba.get_num_threads()), pools=threadpool_info())) @@ -496,7 +496,7 @@ def save(): assert abs(result.displacements[target_dof])>1e-10 manager=GeneralS3PatchManager(model,resolution.definition,settings) residual,_,contact_result=manager.evaluate(result.displacements,tangent=False) - from anysolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate + from anyfesolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate structural,_,states=_assemble_nonlinear_system(model,result.displacements,result.element_states, 5,tangent=False,kinematics='von_karman') _discard_nonlinear_state_candidate(states) diff --git a/tests/test_general_contact_automatic_q4_pair.py b/tests/test_general_contact_automatic_q4_pair.py index cab4fe637..b524cecf0 100644 --- a/tests/test_general_contact_automatic_q4_pair.py +++ b/tests/test_general_contact_automatic_q4_pair.py @@ -5,15 +5,15 @@ from pathlib import Path import numpy as np import pytest -from anysolver.general_contact import ContactInteraction,resolve_automatic_contact_domain as resolve +from anyfesolver.general_contact import ContactInteraction,resolve_automatic_contact_domain as resolve def _footprint(model,resolution,settings,u): """Report actual projected pair polygons, not a new admission certificate.""" - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager - from anysolver.general_contact.q4_source_overlap import projected_q4_source_face - from anysolver.general_contact.overlap import PlanarFace,planar_projected_overlap + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.q4_source_overlap import projected_q4_source_face + from anyfesolver.general_contact.overlap import PlanarFace,planar_projected_overlap manager=GeneralS3PatchManager(model,resolution.definition,settings) source,target=manager._positions(u) pairs=[] @@ -35,10 +35,10 @@ def _footprint(model,resolution,settings,u): reason='bounded installed refined automatic deformable lifecycle') def test_installed_automatic_sliding_stage(): """One guarded stage per invocation, sharing only retained JSON evidence.""" - import anysolver,numba + import anyfesolver,numba from threadpoolctl import threadpool_info - from anysolver import ContactDefinition,solve_static_nonlinear - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver import ContactDefinition,solve_static_nonlinear + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from examples.general_contact_automatic_q4_pair import build,solve_shell_pair stage=os.environ['Q4_PAIR_STAGE'].split('-')[0] evidence=Path(os.environ['AUTOMATIC_WORKFLOW_EVIDENCE']) @@ -57,7 +57,7 @@ def test_installed_automatic_sliding_stage(): physical_inputs=dict(source_midplane_z_m=.055,source_bottom_offset_m=-.025, target_midplane_z_m=-.01,target_top_offset_m=.025,source_director=(0.,0.,1.),target_director=(0.,0.,1.), path=path.contract()), - runtime_before_solve=dict(anysolver_path=anysolver.__file__, + runtime_before_solve=dict(anyfesolver_path=anyfesolver.__file__, automatic_domain_path=__import__('inspect').getfile(resolve), jit_disabled=bool(numba.config.DISABLE_JIT),numba_threads=int(numba.get_num_threads()), pools=threadpool_info())) @@ -164,7 +164,7 @@ def save(): assert abs(result.displacements[target_dof])>1e-10 manager=GeneralS3PatchManager(model,resolution.definition,settings) residual,_,contact_result=manager.evaluate(result.displacements,tangent=False) - from anysolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate + from anyfesolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate structural,_,states=_assemble_nonlinear_system(model,result.displacements,result.element_states, 5,tangent=False,kinematics='von_karman') _discard_nonlinear_state_candidate(states) @@ -323,10 +323,10 @@ def _scalar_exact(reference): support_gradient_tolerance=1e-5,support_hessian_tolerance=1e-5,weighted_gap_gradient_tolerance=1e-5,weighted_gap_hessian_tolerance=1e-5) def test_independent_scalar_trapezoid_work_and_tangent(monkeypatch): - from anysolver.general_contact.q4_q4_overlap_derivatives import q4_q4_overlap_derivatives as derivative,q4_q4_swept_chart_admissible as chart - from anysolver.general_contact.q4_source_overlap import q4_source_overlap_integrals - from anysolver.general_contact.s3_patch_mortar_energy import MovingS3PatchPrimalMortarPenalty,S3PatchFace - from anysolver.general_contact.s3_patch_augmented import MovingS3PatchProjectedNormal + from anyfesolver.general_contact.q4_q4_overlap_derivatives import q4_q4_overlap_derivatives as derivative,q4_q4_swept_chart_admissible as chart + from anyfesolver.general_contact.q4_source_overlap import q4_source_overlap_integrals + from anyfesolver.general_contact.s3_patch_mortar_energy import MovingS3PatchPrimalMortarPenalty,S3PatchFace + from anyfesolver.general_contact.s3_patch_augmented import MovingS3PatchProjectedNormal poly=[(F('.1'),F(0)),(F(1),F(0)),(F(0),F(1)),(F(0),F('.1'))] assert _bilinear_extrema(poly,(F(0),F(0),F(0),F(1)))==(0,F(1,4)) xy=np.array([[-.4,-.3],[1.7,-.3],[1.7,1.8],[-.4,1.8]]) @@ -361,7 +361,7 @@ def test_independent_scalar_trapezoid_work_and_tangent(monkeypatch): crossface=float(np.linalg.norm(independent.tangent[0:3,6:9]));assert crossface>1e-10 source[:,2]=.0002*source[:,0]+.0001*source[:,1]+.0003*source[:,0]*source[:,1] pose=np.concatenate((source,target));direction=np.random.default_rng(72).normal(size=pose.shape);direction/=np.linalg.norm(direction) - import anysolver.general_contact.s3_patch_augmented as owner + import anyfesolver.general_contact.s3_patch_augmented as owner agree=owner._q4_s3_pair_values_agree;operand=owner._q4_s3_gap_operand_roundoff forced=[];fallback=[] def force_fallback(*args,**kw): @@ -385,9 +385,9 @@ def checked_operand(a,b,scale): def test_public_transient_refuses_unused_q4_pair_selector(monkeypatch): from examples.general_contact_multiple_beam_s3_transient import build - from anysolver.dynamics import TransientConfig - from anysolver.general_contact.transient import solve_transient_contact,_admit,ContactTransientSolverControls - import anysolver.general_contact.multiple_beam_s3_transient as owner + from anyfesolver.dynamics import TransientConfig + from anyfesolver.general_contact.transient import solve_transient_contact,_admit,ContactTransientSolverControls + import anyfesolver.general_contact.multiple_beam_s3_transient as owner model,definition,settings,velocity=build() controls=ContactTransientSolverControls(allow_multiple_deformable_beam_s3_dev=True) before=repr(model) @@ -418,11 +418,11 @@ def forbidden(*args,**kwargs): def test_default_identity_physical_map_and_public_unused_routes(monkeypatch): - from anysolver import validate_general_contact,CancellationToken,SolveCancelled,LoadCase,solve_static_nonlinear,solve_static_arc_length,ArcLengthControl - from anysolver.general_contact.core import _contact_settings_contract + from anyfesolver import validate_general_contact,CancellationToken,SolveCancelled,LoadCase,solve_static_nonlinear,solve_static_arc_length,ArcLengthControl + from anyfesolver.general_contact.core import _contact_settings_contract from examples.general_contact_automatic_s3_pair import build_s3_pair from examples.general_contact_automatic_q4_pair import build,solve_shell_pair - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager model,domain,settings,res,path=build_s3_pair() assert 'path_predictor' in _contact_settings_contract(settings) and 'shell_pair_orientation' not in _contact_settings_contract(settings) candidate=build();model,domain,settings,res,path=candidate @@ -444,7 +444,7 @@ def test_default_identity_physical_map_and_public_unused_routes(monkeypatch): from examples.general_contact_triangulated_rigid_patch import case as arc_case arc,definition,defaults=arc_case();assert validate_general_contact(arc,definition,defaults,analysis_control='arc_length').valid load=LoadCase('arc_refusal');load.add_nodal_load(2,forces=(0.,0.,-.01));before=repr(arc) - import anysolver.general_contact.arc_contact as arc_owner + import anyfesolver.general_contact.arc_contact as arc_owner calls=[] def forbidden(*args,**kw): calls.append(True);raise AssertionError('arc allocation/mutation reached before selector refusal') diff --git a/tests/test_general_contact_automatic_s3_pair.py b/tests/test_general_contact_automatic_s3_pair.py index 9c304975c..cc5671e98 100644 --- a/tests/test_general_contact_automatic_s3_pair.py +++ b/tests/test_general_contact_automatic_s3_pair.py @@ -5,7 +5,7 @@ from pathlib import Path import numpy as np import pytest -from anysolver.general_contact import ContactInteraction,resolve_automatic_contact_domain as resolve +from anyfesolver.general_contact import ContactInteraction,resolve_automatic_contact_domain as resolve @@ -79,8 +79,8 @@ def turn(a,b,c):return (b[0]-a[0])*(c[1]-a[1])-(b[1]-a[1])*(c[0]-a[0]) def _footprint(model,resolution,settings,u): - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager - from anysolver.general_contact.overlap import PlanarFace,planar_projected_overlap + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.overlap import PlanarFace,planar_projected_overlap manager=GeneralS3PatchManager(model,resolution.definition,settings);source,target=manager._positions(u) pairs=[] for si in manager.law.source_face_indices: @@ -97,10 +97,10 @@ def _footprint(model,resolution,settings,u): reason='bounded installed refined automatic deformable lifecycle') def test_installed_automatic_s3_pair_stage(): """One guarded stage per invocation, sharing only retained JSON evidence.""" - import anysolver,numba + import anyfesolver,numba from threadpoolctl import threadpool_info - from anysolver import ContactDefinition,solve_static_nonlinear - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver import ContactDefinition,solve_static_nonlinear + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from examples.general_contact_automatic_s3_pair import build_s3_pair,solve_shell_pair stage=os.environ['AUTOMATIC_S3_PAIR_STAGE'].split('-')[0] evidence=Path(os.environ['AUTOMATIC_WORKFLOW_EVIDENCE']) @@ -118,7 +118,7 @@ def test_installed_automatic_s3_pair_stage(): physical_inputs=dict(integration_role='lower_coarser',controlled_physical_body='upper',source_work_labels='physical_upper_not_integration_role',upper_actuator_midplane_z_m=.055,upper_physical_bottom_offset_m=-.025,lower_pressure_midplane_z_m=0., lower_physical_top_offset_m=float(.025-.01),upper_director=(0.,0.,-1.),lower_director=(0.,0.,-1.), path=path.contract()), - runtime_before_solve=dict(anysolver_path=anysolver.__file__, + runtime_before_solve=dict(anyfesolver_path=anyfesolver.__file__, automatic_domain_path=__import__('inspect').getfile(resolve), jit_disabled=bool(numba.config.DISABLE_JIT),numba_threads=int(numba.get_num_threads()), pools=threadpool_info())) @@ -225,7 +225,7 @@ def save(): assert abs(result.displacements[target_dof])>1e-10 manager=GeneralS3PatchManager(model,resolution.definition,settings) residual,_,contact_result=manager.evaluate(result.displacements,tangent=False) - from anysolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate + from anyfesolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate structural,_,states=_assemble_nonlinear_system(model,result.displacements,result.element_states, 5,tangent=False,kinematics='von_karman') _discard_nonlinear_state_candidate(states) @@ -289,7 +289,7 @@ def save(): def test_s3_orientation_work_map_and_refusal(): from examples.general_contact_automatic_s3_pair import build_s3_pair - from anysolver.general_contact.s3_skin_work import S3SkinWorkAdapter + from anyfesolver.general_contact.s3_skin_work import S3SkinWorkAdapter down=build_s3_pair(resolve_domain=False);up=build_s3_pair(director_z=1,resolve_domain=False) for eid in range(1,7): a=S3SkinWorkAdapter.from_model(down[0],1,eid,'top' if eid<=4 else 'bottom') @@ -305,7 +305,7 @@ def test_s3_orientation_work_map_and_refusal(): def test_s3_smooth_full_work_tangent_and_unsafe_path(): from examples.general_contact_automatic_s3_pair import build_s3_pair - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from scipy import sparse model,domain,settings,resolution,path=build_s3_pair() manager=GeneralS3PatchManager(model,resolution.definition,settings) @@ -319,8 +319,8 @@ def test_s3_smooth_full_work_tangent_and_unsafe_path(): force,tangent,result=manager.evaluate(u) oracle=_independent_pose_gap(model,u) assert oracle['tilted_source_normal_squared_xy']>1e-13 - from anysolver.general_contact.s3_overlap_derivatives import s3_overlap_derivatives - from anysolver.general_contact.s3_skin_work import S3SkinWorkAdapter + from anyfesolver.general_contact.s3_overlap_derivatives import s3_overlap_derivatives + from anyfesolver.general_contact.s3_skin_work import S3SkinWorkAdapter reference={};current={} for eid in range(1,7): adapter=S3SkinWorkAdapter.from_model(model,1,eid,'top' if eid<=4 else 'bottom') @@ -348,7 +348,7 @@ def test_s3_smooth_full_work_tangent_and_unsafe_path(): def test_s3_predictor_route_and_precancel_safety(): - from anysolver import CancellationToken,SolveCancelled,validate_general_contact + from anyfesolver import CancellationToken,SolveCancelled,validate_general_contact from examples.general_contact_automatic_s3_pair import build_s3_pair,solve_shell_pair model,domain,settings,resolution,path=build_s3_pair() assert not validate_general_contact(model,resolution.definition,settings,analysis_control='force').valid diff --git a/tests/test_general_contact_automatic_s3_q4.py b/tests/test_general_contact_automatic_s3_q4.py index d0e003145..51e2e7e79 100644 --- a/tests/test_general_contact_automatic_s3_q4.py +++ b/tests/test_general_contact_automatic_s3_q4.py @@ -5,15 +5,15 @@ from pathlib import Path import numpy as np import pytest -from anysolver.general_contact import ContactInteraction,resolve_automatic_contact_domain as resolve +from anyfesolver.general_contact import ContactInteraction,resolve_automatic_contact_domain as resolve from test_general_contact_automatic_q4_pair import _turn,_clip_exact,_bilinear_extrema def _footprint(model,resolution,settings,u): - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager - from anysolver.general_contact.overlap import PlanarFace,planar_projected_overlap + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.overlap import PlanarFace,planar_projected_overlap manager=GeneralS3PatchManager(model,resolution.definition,settings);source,target=manager._positions(u);pairs=[] for si in manager.law.source_face_indices: normal=np.cross(source[si][1]-source[si][0],source[si][2]-source[si][0]);normal/=np.linalg.norm(normal) @@ -27,10 +27,10 @@ def _footprint(model,resolution,settings,u): reason='bounded installed refined automatic deformable lifecycle') def test_installed_automatic_s3_q4_stage(monkeypatch): """One guarded stage per invocation, sharing only retained JSON evidence.""" - import anysolver,numba + import anyfesolver,numba from threadpoolctl import threadpool_info - from anysolver import ContactDefinition,solve_static_nonlinear - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver import ContactDefinition,solve_static_nonlinear + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from examples.general_contact_automatic_s3_q4 import build,solve_shell_pair stage=os.environ['S3_Q4_STAGE'].split('-')[0] evidence=Path(os.environ['AUTOMATIC_WORKFLOW_EVIDENCE']) @@ -49,7 +49,7 @@ def test_installed_automatic_s3_q4_stage(monkeypatch): physical_inputs=dict(source_reference_z_m=.065,source_supported_reference_offset_m=.01,source_bottom_physical_offset_m=-.035, target_midplane_z_m=-.01,target_top_offset_m=.025,source_director=(0.,0.,1.),target_director=(0.,0.,1.), path=path.contract()), - runtime_before_solve=dict(anysolver_path=anysolver.__file__, + runtime_before_solve=dict(anyfesolver_path=anyfesolver.__file__, automatic_domain_path=__import__('inspect').getfile(resolve), jit_disabled=bool(numba.config.DISABLE_JIT),numba_threads=int(numba.get_num_threads()), pools=threadpool_info())) @@ -60,7 +60,7 @@ def save(): assert report['runtime_before_solve']['jit_disabled'] assert report['runtime_before_solve']['numba_threads']==1 assert all(pool['num_threads']==1 for pool in report['runtime_before_solve']['pools']) - import anysolver.general_contact.s3_q4_swept as swept + import anyfesolver.general_contact.s3_q4_swept as swept certificate=swept.s3_q4_affine_lower;enclosures=[] def recorded_certificate(*args,**kw): error=kw.get('endpoint_errors') @@ -163,7 +163,7 @@ def recorded_certificate(*args,**kw): assert abs(result.displacements[target_dof])>1e-10 manager=GeneralS3PatchManager(model,resolution.definition,settings) residual,_,contact_result=manager.evaluate(result.displacements,tangent=False) - from anysolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate + from anyfesolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate structural,_,states=_assemble_nonlinear_system(model,result.displacements,result.element_states, 5,tangent=False,kinematics='von_karman') _discard_nonlinear_state_candidate(states) @@ -289,9 +289,9 @@ def integral(p):return sum(v*_triangle_moment((poly[0],poly[k],poly[k+1]),i,j) f def test_independent_scalar_shared_work_and_tangent(): - from anysolver.general_contact.s3_q4_overlap_derivatives import s3_q4_overlap_derivatives - from anysolver.general_contact.s3_patch_mortar_energy import MovingS3PatchPrimalMortarPenalty,S3PatchFace - from anysolver.general_contact.s3_patch_augmented import MovingS3PatchProjectedNormal + from anyfesolver.general_contact.s3_q4_overlap_derivatives import s3_q4_overlap_derivatives + from anyfesolver.general_contact.s3_patch_mortar_energy import MovingS3PatchPrimalMortarPenalty,S3PatchFace + from anyfesolver.general_contact.s3_patch_augmented import MovingS3PatchProjectedNormal source=np.array([[-.2,-.15,0.],[1.8,-.15,0.],[1.8,1.85,0.],[-.2,1.85,0.]]) target_reference=np.array([[0.,0.,.003],[1.,0.,.003],[1.,1.,.003],[0.,1.,.003]]) target=target_reference.copy();x,y=target[:,:2].T;target[:,2]=.003+.0004*x+.0002*y+.0003*x*y @@ -330,9 +330,9 @@ def test_independent_scalar_shared_work_and_tangent(): def test_public_transient_refuses_unused_predictor(monkeypatch): from examples.general_contact_multiple_beam_s3_transient import build - from anysolver.dynamics import TransientConfig - from anysolver.general_contact.transient import solve_transient_contact,_admit,ContactTransientSolverControls - import anysolver.general_contact.multiple_beam_s3_transient as owner + from anyfesolver.dynamics import TransientConfig + from anyfesolver.general_contact.transient import solve_transient_contact,_admit,ContactTransientSolverControls + import anyfesolver.general_contact.multiple_beam_s3_transient as owner model,definition,settings,velocity=build() controls=ContactTransientSolverControls(allow_multiple_deformable_beam_s3_dev=True) before=repr(model) @@ -365,9 +365,9 @@ def forbidden(*args,**kwargs): def test_default_identity_physical_map_and_public_safety(monkeypatch): - from anysolver import CancellationToken,SolveCancelled,solve_static_nonlinear + from anyfesolver import CancellationToken,SolveCancelled,solve_static_nonlinear from examples.general_contact_automatic_s3_q4 import build,solve_shell_pair - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager candidate=build();model,domain,settings,res,path=candidate;before=repr(model) manager=GeneralS3PatchManager(model,res.definition,settings);positions=manager._positions(np.zeros(manager.n_dof)) np.testing.assert_allclose(positions[0][:,2],.03,atol=1e-17,rtol=0);np.testing.assert_allclose(positions[1][:,2],.015,atol=1e-17,rtol=0) diff --git a/tests/test_general_contact_automatic_sliding.py b/tests/test_general_contact_automatic_sliding.py index 52ad223c2..fdfbc2152 100644 --- a/tests/test_general_contact_automatic_sliding.py +++ b/tests/test_general_contact_automatic_sliding.py @@ -5,7 +5,7 @@ from pathlib import Path import numpy as np import pytest -from anysolver.general_contact import ContactInteraction,resolve_automatic_contact_domain as resolve +from anyfesolver.general_contact import ContactInteraction,resolve_automatic_contact_domain as resolve @@ -79,9 +79,9 @@ def turn(a,b,c):return (b[0]-a[0])*(c[1]-a[1])-(b[1]-a[1])*(c[0]-a[0]) def _footprint(model,resolution,settings,u): """Report actual projected pair polygons, not a new admission certificate.""" - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager - from anysolver.general_contact.q4_source_overlap import projected_q4_source_face - from anysolver.general_contact.overlap import PlanarFace,planar_projected_overlap + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.q4_source_overlap import projected_q4_source_face + from anyfesolver.general_contact.overlap import PlanarFace,planar_projected_overlap manager=GeneralS3PatchManager(model,resolution.definition,settings) source,target=manager._positions(u) pairs=[] @@ -103,10 +103,10 @@ def _footprint(model,resolution,settings,u): reason='bounded installed refined automatic deformable lifecycle') def test_installed_automatic_sliding_stage(): """One guarded stage per invocation, sharing only retained JSON evidence.""" - import anysolver,numba + import anyfesolver,numba from threadpoolctl import threadpool_info - from anysolver import ContactDefinition,solve_static_nonlinear - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver import ContactDefinition,solve_static_nonlinear + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from examples.general_contact_automatic_domain import build_projected_shell_pair,solve_shell_pair stage=os.environ['AUTOMATIC_SLIDING_STAGE'].split('-')[0] evidence=Path(os.environ['AUTOMATIC_WORKFLOW_EVIDENCE']) @@ -125,7 +125,7 @@ def test_installed_automatic_sliding_stage(): physical_inputs=dict(source_midplane_z_m=.055,source_bottom_offset_m=-.025, target_top_offset_m=float(.025-.01),source_director=(0.,0.,1.),target_director=(0.,0.,1.), path=path.contract()), - runtime_before_solve=dict(anysolver_path=anysolver.__file__, + runtime_before_solve=dict(anyfesolver_path=anyfesolver.__file__, automatic_domain_path=__import__('inspect').getfile(resolve), jit_disabled=bool(numba.config.DISABLE_JIT),numba_threads=int(numba.get_num_threads()), pools=threadpool_info())) @@ -232,7 +232,7 @@ def save(): assert abs(result.displacements[target_dof])>1e-10 manager=GeneralS3PatchManager(model,resolution.definition,settings) residual,_,contact_result=manager.evaluate(result.displacements,tangent=False) - from anysolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate + from anyfesolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate structural,_,states=_assemble_nonlinear_system(model,result.displacements,result.element_states, 5,tangent=False,kinematics='von_karman') _discard_nonlinear_state_candidate(states) diff --git a/tests/test_general_contact_automatic_swept_lifecycle.py b/tests/test_general_contact_automatic_swept_lifecycle.py index a3da902b6..bcc7bef01 100644 --- a/tests/test_general_contact_automatic_swept_lifecycle.py +++ b/tests/test_general_contact_automatic_swept_lifecycle.py @@ -4,7 +4,7 @@ import numpy as np import pytest -from anysolver.general_contact.q4_overlap_local_bound import ( +from anyfesolver.general_contact.q4_overlap_local_bound import ( q4_s3_whole_pair_swept_lower,overlap_local_swept_lower,q4_s3_swept_chart_admissible, _normal_controls_interval) @@ -116,7 +116,7 @@ def test_large_coordinate_cancellation_encloses_exact_transverse_gap(): def test_public_lifecycle_precancel_is_atomic(): - from anysolver import CancellationToken,SolveCancelled + from anyfesolver import CancellationToken,SolveCancelled from examples.general_contact_automatic_domain import build_projected_shell_pair,solve_shell_pair model,domain,settings,resolution,path=build_projected_shell_pair(lifecycle=True) before=repr(model) @@ -145,7 +145,7 @@ def test_individual_polarity_does_not_certify_mutual_chart(): def test_endpoint_skin_map_error_encloses_exact_sparse_arithmetic(): from fractions import Fraction as F from examples.general_contact_automatic_domain import build_projected_shell_pair - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager model,_,settings,resolution,_=build_projected_shell_pair(lifecycle=True) manager=GeneralS3PatchManager(model,resolution.definition,settings) matrix=manager.map.tocsr();reference=np.concatenate(manager.reference).reshape(-1) @@ -167,7 +167,7 @@ def test_independent_affine_plane_oracle_discriminates_actual_proposals(): # faces: equal z at all corners for both endpoints. Each target triangle # is P1 and physically affine in time. No midpoint sampling proves safety. from examples.general_contact_automatic_domain import build_projected_shell_pair - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager model,_,settings,resolution,_=build_projected_shell_pair(lifecycle=True) manager=GeneralS3PatchManager(model,resolution.definition,settings) outcomes=[] @@ -192,7 +192,7 @@ def test_independent_affine_plane_oracle_discriminates_actual_proposals(): @pytest.mark.skipif(os.environ.get('AUTOMATIC_SWEPT_CAPTURE')!='1',reason='bounded old-candidate diagnosis') def test_capture_unchanged_automatic_lifecycle(monkeypatch): from examples.general_contact_automatic_domain import build_projected_shell_pair,solve_shell_pair - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager model,domain,settings,resolution,path=build_projected_shell_pair(lifecycle=True) trace=[] original=GeneralS3PatchManager._swept_admissible @@ -219,7 +219,7 @@ def observed(manager,start,end): @pytest.mark.parametrize('row_scales', [(1.,1.), (2.**-400,2.**400)]) def test_control_projection_retains_independent_nullspace(row_scales): - from anysolver.general_contact.static_path import _control_projection_seed + from anyfesolver.general_contact.static_path import _control_projection_seed # Independently prescribed sums; differences and fifth coordinate are free. rows=np.array(((1.,1.,0.,0.,0.),(0.,0.,1.,-1.,0.))) start=np.array((2.,-3.,5.,7.,11.)) @@ -233,10 +233,10 @@ def test_control_projection_retains_independent_nullspace(row_scales): def test_predictor_validation_and_ignored_route_refusal(): from dataclasses import replace - from anysolver import ContactSolverSettings,solve_static_nonlinear - from anysolver.general_contact.core import validate_general_contact + from anyfesolver import ContactSolverSettings,solve_static_nonlinear + from anyfesolver.general_contact.core import validate_general_contact from examples.general_contact_automatic_domain import build_projected_shell_pair - from anysolver.general_contact.static_path import _control_projection_seed + from anyfesolver.general_contact.static_path import _control_projection_seed with pytest.raises(ValueError,match='unsupported path_predictor'): ContactSolverSettings(path_predictor='silent') with pytest.raises(ValueError,match='ill-conditioned'): @@ -254,7 +254,7 @@ def test_predictor_validation_and_ignored_route_refusal(): def test_predictor_default_keeps_historical_automatic_identity(): from examples.general_contact_automatic_domain import build_projected_shell_pair - from anysolver.general_contact.automatic_domain import _settings_contract + from anyfesolver.general_contact.automatic_domain import _settings_contract _,_,settings,resolution,_=build_projected_shell_pair(lifecycle=True) assert 'path_predictor' not in _settings_contract(settings) baseline_path=os.environ.get('AUTOMATIC_PREDICTOR_BASELINE') @@ -265,9 +265,9 @@ def test_predictor_default_keeps_historical_automatic_identity(): def test_predictor_public_precancel_and_invalid_seed_are_atomic(monkeypatch): from dataclasses import replace - from anysolver import CancellationToken,SolveCancelled + from anyfesolver import CancellationToken,SolveCancelled from examples.general_contact_automatic_domain import build_projected_shell_pair,solve_shell_pair - from anysolver.general_contact import static_path + from anyfesolver.general_contact import static_path model,domain,settings,resolution,path=build_projected_shell_pair(lifecycle=True, path_predictor='control_projection_dev') before=repr(model) @@ -287,8 +287,8 @@ def prohibited(*args,**kwargs):raise AssertionError('unsafe seed reached structu def test_predictor_refuses_unexercised_profile_and_friction(): from dataclasses import replace - from anysolver.general_contact.core import validate_general_contact - from anysolver.general_contact.static_path import solve_static_contact_path + from anyfesolver.general_contact.core import validate_general_contact + from anyfesolver.general_contact.static_path import solve_static_contact_path from examples.general_contact_automatic_domain import build_projected_shell_pair model,_,settings,resolution,path=build_projected_shell_pair(lifecycle=True, path_predictor='control_projection_dev') diff --git a/tests/test_general_contact_b2_b3_pair_static.py b/tests/test_general_contact_b2_b3_pair_static.py index ef7bc1b81..2c729baa8 100644 --- a/tests/test_general_contact_b2_b3_pair_static.py +++ b/tests/test_general_contact_b2_b3_pair_static.py @@ -5,14 +5,14 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, DisplacementControl, LoadCase, solve_static_nonlinear, validate_general_contact, ) -from anysolver.elements import BeamElement, QuadraticBeamElement -from anysolver.fe_core import FEModel -from anysolver.general_contact.beam_curve_pair_static import B3PairManager, MIXED_PROFILE +from anyfesolver.elements import BeamElement, QuadraticBeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.beam_curve_pair_static import B3PairManager, MIXED_PROFILE def _pair(): diff --git a/tests/test_general_contact_b3_pair_chord_bound.py b/tests/test_general_contact_b3_pair_chord_bound.py index 420342495..431eedd6c 100644 --- a/tests/test_general_contact_b3_pair_chord_bound.py +++ b/tests/test_general_contact_b3_pair_chord_bound.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver.general_contact.beam_curve_pair import ( +from anyfesolver.general_contact.beam_curve_pair import ( _source_interval_target_gap_lower, ) diff --git a/tests/test_general_contact_b3_pair_curved_measure.py b/tests/test_general_contact_b3_pair_curved_measure.py index fb9b523e8..4627ebbee 100644 --- a/tests/test_general_contact_b3_pair_curved_measure.py +++ b/tests/test_general_contact_b3_pair_curved_measure.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver.general_contact.beam_curve_pair import B3PairPotential +from anyfesolver.general_contact.beam_curve_pair import B3PairPotential def _reference(y_shift): diff --git a/tests/test_general_contact_b3_pair_potential.py b/tests/test_general_contact_b3_pair_potential.py index 514f9c466..f566bd231 100644 --- a/tests/test_general_contact_b3_pair_potential.py +++ b/tests/test_general_contact_b3_pair_potential.py @@ -5,7 +5,7 @@ from scipy.integrate import quad from scipy.optimize import minimize_scalar -from anysolver.general_contact.beam_curve_pair import ( +from anyfesolver.general_contact.beam_curve_pair import ( B3PairPotential, certify_b3_pair_gap, ) diff --git a/tests/test_general_contact_b3_pair_projection.py b/tests/test_general_contact_b3_pair_projection.py index 976adb786..5d67be09a 100644 --- a/tests/test_general_contact_b3_pair_projection.py +++ b/tests/test_general_contact_b3_pair_projection.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver.general_contact.beam_curve_pair import ( +from anyfesolver.general_contact.beam_curve_pair import ( b3_distance_jet, closest_on_b3, ) diff --git a/tests/test_general_contact_b3_pair_static.py b/tests/test_general_contact_b3_pair_static.py index 2f32d9228..8a15ef40b 100644 --- a/tests/test_general_contact_b3_pair_static.py +++ b/tests/test_general_contact_b3_pair_static.py @@ -5,14 +5,14 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, DisplacementControl, LoadCase, solve_static_nonlinear, validate_general_contact, ) -from anysolver.elements import QuadraticBeamElement -from anysolver.fe_core import FEModel -from anysolver.general_contact.beam_curve_pair_static import B3PairManager +from anyfesolver.elements import QuadraticBeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.beam_curve_pair_static import B3PairManager def _pair(): diff --git a/tests/test_general_contact_beam_chain_consistent.py b/tests/test_general_contact_beam_chain_consistent.py index c98c42f50..1636f6a77 100644 --- a/tests/test_general_contact_beam_chain_consistent.py +++ b/tests/test_general_contact_beam_chain_consistent.py @@ -9,13 +9,13 @@ import pytest from scipy.integrate import quad -from anysolver import (BoundaryCondition,ContactSolverSettings,DisplacementControl, +from anyfesolver import (BoundaryCondition,ContactSolverSettings,DisplacementControl, LoadCase,solve_static_nonlinear,validate_general_contact) -from anysolver.general_contact.beam_chain_pair import _BeamChainPairManager,PROFILE_CONSISTENT -from anysolver.general_contact.beam_chain_consistent import moving_owner_block -from anysolver.general_contact.beam_chain_consistent import _check_partition_knot,_windows,_roots,_nearest_indices,_coefficients,_rational_geometry -from anysolver.general_contact.beam_pair import _Segment -from anysolver.elements import BeamElement +from anyfesolver.general_contact.beam_chain_pair import _BeamChainPairManager,PROFILE_CONSISTENT +from anyfesolver.general_contact.beam_chain_consistent import moving_owner_block +from anyfesolver.general_contact.beam_chain_consistent import _check_partition_knot,_windows,_roots,_nearest_indices,_coefficients,_rational_geometry +from anyfesolver.general_contact.beam_pair import _Segment +from anyfesolver.elements import BeamElement from test_general_contact_beam_chain_pair import _chains,_closed @@ -326,7 +326,7 @@ def test_public_consistent_chain_example(capsys): def test_capability_does_not_admit_development_or_foreign_geometry(): - from anysolver import RigidContactBody, report_general_contact_capability + from anyfesolver import RigidContactBody, report_general_contact_capability model,definition,settings=_chains() controls=_settings(settings) report=report_general_contact_capability(model,definition,controls) diff --git a/tests/test_general_contact_beam_chain_ends.py b/tests/test_general_contact_beam_chain_ends.py index 93776897e..aeb6b1ecb 100644 --- a/tests/test_general_contact_beam_chain_ends.py +++ b/tests/test_general_contact_beam_chain_ends.py @@ -7,12 +7,12 @@ import pytest from scipy.optimize import root -from anysolver import (BoundaryCondition,ContactDefinition,ContactInteraction, +from anyfesolver import (BoundaryCondition,ContactDefinition,ContactInteraction, ContactSurface,ContactSolverSettings,LoadCase,DisplacementControl, solve_static_nonlinear,validate_general_contact,report_general_contact_capability) -from anysolver.elements import BeamElement,QuadraticBeamElement -from anysolver.fe_core import FEModel -from anysolver.general_contact.beam_chain_ends import BeamChainEndManager,PROFILE +from anyfesolver.elements import BeamElement,QuadraticBeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.beam_chain_ends import BeamChainEndManager,PROFILE def bars(cells=2,other=None): @@ -212,7 +212,7 @@ def test_nonphysical_selected_cut_and_nonreciprocal_cap_pairs_fail_explicitly(): def test_nearest_path_hidden_distinct_partner_switch_and_unrepresented_cut(): from fractions import Fraction as F - from anysolver.general_contact.beam_chain_end_geometry import ( + from anyfesolver.general_contact.beam_chain_end_geometry import ( nearest_endpoint_feature,admissible_chain_endpoint_path) targets=(((F(-1,100),-1,0),(F(-1,100),1,0)), ((F(1,100),-1,0),(F(1,100),1,0))) @@ -254,7 +254,7 @@ def test_swept_activation_rejects_nonreciprocal_cap_features(): @pytest.mark.parametrize('cancel',(False,True)) def test_actual_two_chain_candidate_exception_or_cancel_keeps_origin_and_restart(cancel,monkeypatch): - from anysolver import CancellationToken,SolveCancelled + from anyfesolver import CancellationToken,SolveCancelled model,definition,settings,load,_=bars(2,2) args=dict(contact=definition,contact_settings=settings,num_steps=4,max_iterations=25, tolerance=1e-10,emit_restart_checkpoint=True) diff --git a/tests/test_general_contact_beam_chain_pair.py b/tests/test_general_contact_beam_chain_pair.py index 5a5778b1c..c44465a38 100644 --- a/tests/test_general_contact_beam_chain_pair.py +++ b/tests/test_general_contact_beam_chain_pair.py @@ -6,14 +6,14 @@ import pytest from scipy.integrate import quad -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, DisplacementControl, LoadCase, solve_static_nonlinear, validate_general_contact, ) -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel -from anysolver.general_contact.beam_chain_pair import _BeamChainPairManager +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.beam_chain_pair import _BeamChainPairManager def _chains(*, kink=False): diff --git a/tests/test_general_contact_beam_chain_refinement.py b/tests/test_general_contact_beam_chain_refinement.py index b47af4402..2fcce083d 100644 --- a/tests/test_general_contact_beam_chain_refinement.py +++ b/tests/test_general_contact_beam_chain_refinement.py @@ -4,10 +4,10 @@ import numpy as np import pytest -from anysolver import (BoundaryCondition,ContactDefinition,ContactInteraction, +from anyfesolver import (BoundaryCondition,ContactDefinition,ContactInteraction, ContactSolverSettings,ContactSurface,LoadCase,solve_static_nonlinear) -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel def _oracle(n,k): diff --git a/tests/test_general_contact_beam_curve_ends.py b/tests/test_general_contact_beam_curve_ends.py index 91847773f..622f423db 100644 --- a/tests/test_general_contact_beam_curve_ends.py +++ b/tests/test_general_contact_beam_curve_ends.py @@ -8,12 +8,12 @@ import pytest from scipy.optimize import minimize_scalar, root -from anysolver import (BoundaryCondition, ContactDefinition, ContactInteraction, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, DisplacementControl, LoadCase, solve_static_nonlinear, validate_general_contact) -from anysolver.elements import BeamElement, QuadraticBeamElement -from anysolver.fe_core import FEModel -from anysolver.general_contact.beam_curve_ends import BeamCurveEndManager +from anyfesolver.elements import BeamElement, QuadraticBeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.beam_curve_ends import BeamCurveEndManager def fixture(points, *, kinds=(3, 3), ke=50., kl=1000., radius=.05, tol=.008): @@ -186,7 +186,7 @@ def test_exact_oblique_cap_activation_retains_spring_tangent(): def test_projection_certificate_uses_actual_end_tangent_and_rejects_competing_minima(): - from anysolver.general_contact.beam_curve_end_geometry import endpoint_interval + from anyfesolver.general_contact.beam_curve_end_geometry import endpoint_interval source=np.array(((-1.,.09,0.),(-.1,.1,0.),(-.02,.09,0.))) target=np.array(((0.,-.5,0.),(0.,0.,0.),(0.,.5,0.))) proof=endpoint_interval(source,source,target,target,2,.05) @@ -254,7 +254,7 @@ def test_displacement_control_split_restart_and_incompatible_definitions(): @pytest.mark.parametrize('cancel',(False,True)) def test_actual_trial_exception_or_cancel_restores_origin_and_checkpoint(cancel,monkeypatch): - from anysolver import CancellationToken,SolveCancelled + from anyfesolver import CancellationToken,SolveCancelled model,definition,settings,nodes,load=bars() common=dict(contact=definition,contact_settings=settings,num_steps=4,max_iterations=25, tolerance=1e-10,emit_restart_checkpoint=True) @@ -325,7 +325,7 @@ def test_open_checkpoint_and_public_example(): def test_exact_full_curve_gap_enclosure_and_resource_rejection(): - from anysolver.general_contact.beam_curve_end_geometry import certify_curve_pair_gap + from anyfesolver.general_contact.beam_curve_end_geometry import certify_curve_pair_gap model,definition,settings,nodes,manager,u=curved() a,b=manager._positions(u) def position(p,t):return (1-t)*(1-2*t)*p[0]+4*t*(1-t)*p[1]+t*(2*t-1)*p[2] @@ -347,8 +347,8 @@ def position(p,t):return (1-t)*(1-2*t)*p[0]+4*t*(1-t)*p[1]+t*(2*t-1)*p[2] def test_capability_and_invalid_public_contract_preserve_admission_boundaries(): - from anysolver.general_contact import report_general_contact_capability - from anysolver.general_contact.beam_curve_ends import PROFILE + from anyfesolver.general_contact import report_general_contact_capability + from anyfesolver.general_contact.beam_curve_ends import PROFILE model,definition,settings,nodes,load=bars() capability=report_general_contact_capability(model,definition,settings) assert capability.validation.profile==PROFILE and capability.implemented diff --git a/tests/test_general_contact_beam_foundation_dev.py b/tests/test_general_contact_beam_foundation_dev.py index 573f96087..b29623773 100644 --- a/tests/test_general_contact_beam_foundation_dev.py +++ b/tests/test_general_contact_beam_foundation_dev.py @@ -16,11 +16,11 @@ sys.path.insert(0, str(Path(__file__).resolve().parents[1]/"docs/d1_review_support")) from d3_beam_foundation_reference import cantilever_foundation_reference -from anysolver import (BoundaryCondition, ContactDefinition, ContactInteraction, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, LoadCase, RigidContactBody, solve_static_nonlinear) -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel RADIUS, YOUNG, NU, LENGTH = .01, 1.e7, .3, 1. diff --git a/tests/test_general_contact_beam_pair.py b/tests/test_general_contact_beam_pair.py index 2be9d134b..cb0281f7b 100644 --- a/tests/test_general_contact_beam_pair.py +++ b/tests/test_general_contact_beam_pair.py @@ -6,14 +6,14 @@ import pytest from scipy.integrate import quad -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, DisplacementControl, LoadCase, solve_static_nonlinear, validate_general_contact, ) -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel -from anysolver.general_contact.beam_pair import _BeamPairManager +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.beam_pair import _BeamPairManager def _pair(*, crossing=False): diff --git a/tests/test_general_contact_beam_pair_ends.py b/tests/test_general_contact_beam_pair_ends.py index fdef8a61c..f47728c64 100644 --- a/tests/test_general_contact_beam_pair_ends.py +++ b/tests/test_general_contact_beam_pair_ends.py @@ -9,13 +9,13 @@ from scipy.optimize import brentq from scipy.integrate import quad -from anysolver import (BoundaryCondition, ContactDefinition, ContactInteraction, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, DisplacementControl, LoadCase, solve_static_nonlinear, validate_general_contact, report_general_contact_capability) -from anysolver.elements import BeamElement, QuadraticBeamElement -from anysolver.fe_core import FEModel -from anysolver.general_contact.beam_pair_ends import BeamPairEndManager, PROFILE -from anysolver.general_contact.beam_pair_end_geometry import minimum_gap, endpoint_feature +from anyfesolver.elements import BeamElement, QuadraticBeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.beam_pair_ends import BeamPairEndManager, PROFILE +from anyfesolver.general_contact.beam_pair_end_geometry import minimum_gap, endpoint_feature def fixture(interior=False): @@ -188,8 +188,8 @@ def test_active_line_projection_plateau_rejects_even_when_source_ends_open(): def test_path_rejects_hidden_active_line_plateau_with_open_physical_ends(): - from anysolver.general_contact.beam_pair_end_geometry import admissible_line_projection_path - from anysolver.general_contact.beam_end_radial_geometry import regular_curve_path + from anyfesolver.general_contact.beam_pair_end_geometry import admissible_line_projection_path + from anyfesolver.general_contact.beam_end_radial_geometry import regular_curve_path source0=np.array(((-.003,-.1,.024),(-.003,.1,.024))) source1=source0+(.006,0.,0.) target=np.array(((0.,0.,0.),(.2,0.,0.))) @@ -271,7 +271,7 @@ def test_unselected_middle_node_junction_is_not_a_physical_cap(): def test_hidden_fractional_double_ownership_root_and_open_bypass(): from fractions import Fraction as F - from anysolver.general_contact.beam_pair_end_geometry import admissible_endpoint_path + from anyfesolver.general_contact.beam_pair_end_geometry import admissible_endpoint_path b=((0,0,-1),(0,0,1));root=F(1,3);height=F(1,100) a0=((0,height,-1),(-root,height,0));a1=((0,height,-1),(1-root,height,0)) assert endpoint_feature(a0,b,1,F(1,50)).gap_sign>0 @@ -294,7 +294,7 @@ def test_failed_candidate_has_no_state_and_public_example(): @pytest.mark.parametrize('cancel',(False,True)) def test_candidate_exception_and_cancellation_restore_two_body_model(cancel,monkeypatch): - from anysolver import CancellationToken,SolveCancelled + from anyfesolver import CancellationToken,SolveCancelled model,definition,settings,load=fixture() args=dict(contact=definition,contact_settings=settings,num_steps=4,max_iterations=25, tolerance=1e-10,emit_restart_checkpoint=True) @@ -334,7 +334,7 @@ def test_closed_active_endpoint_ties_reject(ownership_tie): def test_manager_rejects_plateau_path_at_an_unselected_material_junction(): - from anysolver.general_contact.beam_pair_end_geometry import admissible_endpoint_path + from anyfesolver.general_contact.beam_pair_end_geometry import admissible_endpoint_path model,definition,settings,_=fixture() positions=((- .003,-.1,.019999),(-.003,.1,.019999),(0.,0.,0.),(.2,0.,0.)) for node,p in zip(model.mesh.nodes.values(),positions):node.x,node.y,node.z=p diff --git a/tests/test_general_contact_beam_plane.py b/tests/test_general_contact_beam_plane.py index ff8917670..882b8672b 100644 --- a/tests/test_general_contact_beam_plane.py +++ b/tests/test_general_contact_beam_plane.py @@ -5,14 +5,14 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, DisplacementControl, LoadCase, RigidContactBody, solve_static_nonlinear, validate_general_contact, ) -from anysolver.elements import BeamElement, QuadraticBeamElement -from anysolver.fe_core import FEModel -from anysolver.general_contact.beam_plane import _BeamPlaneManager +from anyfesolver.elements import BeamElement, QuadraticBeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.beam_plane import _BeamPlaneManager def _model(*, quadratic=False, vertical=False, end_caps="none"): diff --git a/tests/test_general_contact_beam_radial.py b/tests/test_general_contact_beam_radial.py index a39c727fe..6283640ba 100644 --- a/tests/test_general_contact_beam_radial.py +++ b/tests/test_general_contact_beam_radial.py @@ -6,14 +6,14 @@ import pytest from scipy.integrate import quad -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, DisplacementControl, LoadCase, RigidContactBody, solve_static_nonlinear, validate_general_contact, ) -from anysolver.elements import BeamElement, QuadraticBeamElement -from anysolver.fe_core import FEModel -from anysolver.general_contact.beam_radial import _BeamRadialManager +from anyfesolver.elements import BeamElement, QuadraticBeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.beam_radial import _BeamRadialManager def _model(*, kind="sphere", quadratic=False): diff --git a/tests/test_general_contact_beam_radial_moving.py b/tests/test_general_contact_beam_radial_moving.py index bba5e6722..6d2489e87 100644 --- a/tests/test_general_contact_beam_radial_moving.py +++ b/tests/test_general_contact_beam_radial_moving.py @@ -5,15 +5,15 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, DisplacementControl, LoadCase, RigidContactBody, solve_static_nonlinear, validate_general_contact, ) -from anysolver.elements import BeamElement, QuadraticBeamElement -from anysolver.fe_core import FEModel -from anysolver.general_contact.beam_radial import _BeamRadialManager +from anyfesolver.elements import BeamElement, QuadraticBeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.beam_radial import _BeamRadialManager def _moving_model(*, kind="cylinder", quadratic=False, travel=0.012): diff --git a/tests/test_general_contact_beam_s3_directional_coupling.py b/tests/test_general_contact_beam_s3_directional_coupling.py index 9f3cf8386..ba0a15276 100644 --- a/tests/test_general_contact_beam_s3_directional_coupling.py +++ b/tests/test_general_contact_beam_s3_directional_coupling.py @@ -33,11 +33,11 @@ def _exact_float(x): def _build_local_pose(): - from anysolver import (BoundaryCondition, ContactDefinition, ContactSurface, + from anyfesolver import (BoundaryCondition, ContactDefinition, ContactSurface, ContactInteraction, ContactSolverSettings, create_shell_element) - from anysolver.elements import QuadraticBeamElement - from anysolver.fe_core import FEModel + from anyfesolver.elements import QuadraticBeamElement + from anyfesolver.fe_core import FEModel m, delta, height, radius = 256, Q(1, 16384), Q(1, 128), Q(1, 128) X, Y, rise = (m*m-1)*delta, Q(4), 2*m*delta stations = (Q(1, 4), Q(5, 16), Q(3, 8)) @@ -161,16 +161,16 @@ def dec(x): def test_production_nonzero_null_directional_coupling(): """Future authorized selector; no transient-initial or C2 DAE claim.""" - from anysolver.general_contact.beam_s3_directional_rates import ( + from anyfesolver.general_contact.beam_s3_directional_rates import ( DirectionalBeamS3Manager, directional_coefficients, directional_operator, exact_gap_polynomial, solve_directional_velocity, recover_directional_rates, PROFILE) - from anysolver.assembly import assemble_mass_matrix, build_constraint_transformation - from anysolver.matrix_assembly import assemble_stiffness_matrix - from anysolver.algebraic_dynamics import build_declared_algebraic_basis - from anysolver.nonlinear_static import _assemble_nonlinear_system - from anysolver.general_contact.runtime import suspend_contact - from anysolver.nonlinear_state import discard_active_state_candidate + from anyfesolver.assembly import assemble_mass_matrix, build_constraint_transformation + from anyfesolver.matrix_assembly import assemble_stiffness_matrix + from anyfesolver.algebraic_dynamics import build_declared_algebraic_basis + from anyfesolver.nonlinear_static import _assemble_nonlinear_system + from anyfesolver.general_contact.runtime import suspend_contact + from anyfesolver.nonlinear_state import discard_active_state_candidate (model, definition, settings, u, refs, dofs, height, radius, X, Y, rise) = _build_local_pose() manager = DirectionalBeamS3Manager(model, definition, settings, diff --git a/tests/test_general_contact_beam_s3_directional_impact.py b/tests/test_general_contact_beam_s3_directional_impact.py index ef9ee3578..3d082437d 100644 --- a/tests/test_general_contact_beam_s3_directional_impact.py +++ b/tests/test_general_contact_beam_s3_directional_impact.py @@ -8,10 +8,10 @@ def test_public_directional_impact_opening_restart_and_energy(tmp_path): - from anysolver.assembly import assemble_mass_matrix - from anysolver.nonlinear_static import _assemble_nonlinear_system - from anysolver.general_contact.runtime import suspend_contact,_ACTIVE_CONTACT - from anysolver.general_contact.beam_s3_directional_rates import DirectionalBeamS3Manager + from anyfesolver.assembly import assemble_mass_matrix + from anyfesolver.nonlinear_static import _assemble_nonlinear_system + from anyfesolver.general_contact.runtime import suspend_contact,_ACTIVE_CONTACT + from anyfesolver.general_contact.beam_s3_directional_rates import DirectionalBeamS3Manager m,r=run(end=.0008);destination=Path(os.environ.get('CONTACT_APP_RESULT_RECORD',str(tmp_path/'actual_result.json'))) destination.with_name('accepted_full.checkpoint.json').write_text(json.dumps(r.restart_checkpoint,sort_keys=True,separators=(',',':'))+'\n') split_time=float(r.times[len(r.times)//2]) @@ -63,11 +63,11 @@ def test_public_directional_impact_opening_restart_and_energy(tmp_path): @pytest.mark.parametrize('failure',('cancel','exception','retry')) def test_directional_transaction_boundaries(monkeypatch,failure,tmp_path): - import anysolver.general_contact.transient as driver - import anysolver.general_contact.beam_s3_transient as path - from anysolver.control import CancellationToken,SolveCancelled - from anysolver.general_contact.runtime import active_contact_manager - from anysolver.dynamics import TransientConfig + import anyfesolver.general_contact.transient as driver + import anyfesolver.general_contact.beam_s3_transient as path + from anyfesolver.control import CancellationToken,SolveCancelled + from anyfesolver.general_contact.runtime import active_contact_manager + from anyfesolver.dynamics import TransientConfig m,d,s,v=build();token=CancellationToken();commits=[];original=driver.commit_state_candidate;bound=path.hermite_gap_bounds;calls=0 def commit(origin,trial): commits.append(1);return original(origin,trial) @@ -99,9 +99,9 @@ def checked(*args,**kwargs): def test_directional_secant_history_corruption_refused(tmp_path): import copy - from anysolver.nonlinear_restart import analysis_configuration_fingerprint - from anysolver.matrix_assembly import assemble_stiffness_matrix - from anysolver.assembly import build_constraint_transformation + from anyfesolver.nonlinear_restart import analysis_configuration_fingerprint + from anyfesolver.matrix_assembly import assemble_stiffness_matrix + from anyfesolver.assembly import build_constraint_transformation _,result=run(end=3.e-5);changed=copy.deepcopy(result.restart_checkpoint) m,_,_,v=build();m.apply_boundary_conditions();K,_=assemble_stiffness_matrix(m) _,_,_,_,ids,_=build_constraint_transformation(K,np.zeros(len(v)),m) diff --git a/tests/test_general_contact_beam_s3_directional_loaded_impact.py b/tests/test_general_contact_beam_s3_directional_loaded_impact.py index c1b7ef0ee..2db3e3114 100644 --- a/tests/test_general_contact_beam_s3_directional_loaded_impact.py +++ b/tests/test_general_contact_beam_s3_directional_loaded_impact.py @@ -25,13 +25,13 @@ def test_loaded_impact_coarse(tmp_path): def test_loaded_impact_refinement_equilibrium_restart(tmp_path): - from anysolver.general_contact.beam_s3_directional_rates import EquilibratedDirectionalBeamS3Manager - from anysolver.assembly import assemble_mass_matrix,build_constraint_transformation - from anysolver.matrix_assembly import assemble_stiffness_matrix - from anysolver.algebraic_dynamics import build_declared_algebraic_basis - from anysolver.nonlinear_static import _assemble_nonlinear_system - from anysolver.nonlinear_state import discard_active_state_candidate - from anysolver.general_contact.runtime import suspend_contact + from anyfesolver.general_contact.beam_s3_directional_rates import EquilibratedDirectionalBeamS3Manager + from anyfesolver.assembly import assemble_mass_matrix,build_constraint_transformation + from anyfesolver.matrix_assembly import assemble_stiffness_matrix + from anyfesolver.algebraic_dynamics import build_declared_algebraic_basis + from anyfesolver.nonlinear_static import _assemble_nonlinear_system + from anyfesolver.nonlinear_state import discard_active_state_candidate + from anyfesolver.general_contact.runtime import suspend_contact m,r,initial=run(dt=DT,end=END) fine_failure=None;traces=[] _,fine,_=run(dt=DT/2,end=END) @@ -109,7 +109,7 @@ def energy_defect(result): def test_acceleration_selection_and_legacy_v20_restart(tmp_path): import pytest - from anysolver.general_contact.transient import ContactTransientSolverControls + from anyfesolver.general_contact.transient import ContactTransientSolverControls for value in (1,'true',None): with pytest.raises(ValueError,match='boolean'):ContactTransientSolverControls(equilibrated_newmark_acceleration_unknown_dev=value) with pytest.raises(ValueError,match='requires'):ContactTransientSolverControls(equilibrated_newmark_acceleration_unknown_dev=True) @@ -132,11 +132,11 @@ def test_acceleration_selection_and_legacy_v20_restart(tmp_path): # continuation to the protected driver, not a newly imposed exact split gate. import importlib.util,sys driver_path=Path(os.environ['C6_LOADED_LEGACY_DRIVER']) - name='anysolver.general_contact._loaded_pre_acceleration_transient' + name='anyfesolver.general_contact._loaded_pre_acceleration_transient' spec=importlib.util.spec_from_file_location(name,driver_path);prior=importlib.util.module_from_spec(spec);sys.modules[name]=prior try: spec.loader.exec_module(prior) - from anysolver.dynamics import TransientConfig + from anyfesolver.dynamics import TransientConfig mm,dd,ss,uu,vv,ll,_=prepare() previous=prior.solve_transient_contact(mm,dd,TransientConfig(DT,END+DT,initial_displacement=uu,initial_velocity=vv),base_load_case=ll,contact_settings=ss, solver_controls=prior.ContactTransientSolverControls(allow_equilibrated_directional_beam_s3_dev=True,save_constraint_reactions_dev=True),restart_checkpoint=capsule,emit_restart_checkpoint=True) @@ -151,11 +151,11 @@ def test_acceleration_selection_and_legacy_v20_restart(tmp_path): import pytest @pytest.mark.parametrize("failure",("cancel","exception","retry")) def test_acceleration_transaction_boundaries(monkeypatch,tmp_path,failure): - import anysolver.general_contact.transient as driver - import anysolver.general_contact.beam_s3_transient as path - from anysolver.control import CancellationToken,SolveCancelled - from anysolver.dynamics import TransientConfig - from anysolver.general_contact.runtime import active_contact_manager + import anyfesolver.general_contact.transient as driver + import anyfesolver.general_contact.beam_s3_transient as path + from anyfesolver.control import CancellationToken,SolveCancelled + from anyfesolver.dynamics import TransientConfig + from anyfesolver.general_contact.runtime import active_contact_manager m,d,s,u,v,load,initial=prepare();bound=path.hermite_gap_bounds;commit=driver.commit_state_candidate;calls=0;commits=[];token=CancellationToken() def checked(*args,**kwargs): nonlocal calls diff --git a/tests/test_general_contact_beam_s3_directional_rates.py b/tests/test_general_contact_beam_s3_directional_rates.py index be940a22e..c27e12b75 100644 --- a/tests/test_general_contact_beam_s3_directional_rates.py +++ b/tests/test_general_contact_beam_s3_directional_rates.py @@ -6,7 +6,7 @@ import numpy as np import pytest from examples.general_contact_beam_s3_transient_directional import build,run -from anysolver.general_contact.beam_s3_directional_rates import ( +from anyfesolver.general_contact.beam_s3_directional_rates import ( DirectionalBeamS3Manager,exact_gap_polynomial,directional_coefficients, directional_operator,solve_directional_velocity) @@ -44,8 +44,8 @@ def test_directional_oracle_and_actual_first_touch_restart(): assert result.contact[-1].active_line_length>0 and result.contact[-1].minimum_gap>=-1.e-5 assert resumed.restart_checkpoint==result.restart_checkpoint np.testing.assert_array_equal(resumed.displacements,result.displacements[1:]) - from anysolver.general_contact.transient import solve_transient_contact,ContactTransientSolverControls - from anysolver.dynamics import TransientConfig + from anyfesolver.general_contact.transient import solve_transient_contact,ContactTransientSolverControls + from anyfesolver.dynamics import TransientConfig m,d,s,v=build() with pytest.raises(ValueError,match='analysis|version|incompatible'): solve_transient_contact(m,d,TransientConfig(1.e-5,3.e-5,initial_velocity=v),contact_settings=s, @@ -60,8 +60,8 @@ def test_directional_oracle_and_actual_first_touch_restart(): def test_legacy_load_constructor_directional_controls_and_null_error_transfer(): - from anysolver.general_contact.transient import ContactNodalLoadHistory,ContactTransientSolverControls - from anysolver.general_contact.beam_s3_directional_rates import _null_error_factor + from anyfesolver.general_contact.transient import ContactNodalLoadHistory,ContactTransientSolverControls + from anyfesolver.general_contact.beam_s3_directional_rates import _null_error_factor history=ContactNodalLoadHistory(((0.,0.),(1.,1.))) assert history.factor(.5)==.5 assert ContactTransientSolverControls().allow_directional_beam_s3_dev is False diff --git a/tests/test_general_contact_beam_s3_directional_tilted.py b/tests/test_general_contact_beam_s3_directional_tilted.py index cfc22499b..9fb027e52 100644 --- a/tests/test_general_contact_beam_s3_directional_tilted.py +++ b/tests/test_general_contact_beam_s3_directional_tilted.py @@ -6,8 +6,8 @@ def test_current_public_guard_for_equilibrated_tilted_touch(tmp_path): - from anysolver.general_contact.transient import solve_transient_contact,ContactTransientSolverControls - from anysolver.dynamics import TransientConfig + from anyfesolver.general_contact.transient import solve_transient_contact,ContactTransientSolverControls + from anyfesolver.dynamics import TransientConfig m,d,s,u,v,load,report=prepare() assert report['exact_touch'] and report['contact_null_norm']>0 path=Path(os.environ.get('CONTACT_APP_RESULT_RECORD',str(tmp_path/'actual_result.json'))) @@ -39,11 +39,11 @@ def test_tilted_work_wrench_and_loaded_energy(tmp_path): from fractions import Fraction as Q from examples.general_contact_beam_s3_transient_directional_tilted import run from test_general_contact_beam_s3_directional_coupling import _independent_gap_coefficients,_reference_directional - from anysolver.general_contact.beam_s3_directional_rates import EquilibratedDirectionalBeamS3Manager,directional_coefficients,directional_operator - from anysolver.assembly import assemble_mass_matrix - from anysolver.nonlinear_static import _assemble_nonlinear_system - from anysolver.nonlinear_state import discard_active_state_candidate - from anysolver.general_contact.runtime import suspend_contact + from anyfesolver.general_contact.beam_s3_directional_rates import EquilibratedDirectionalBeamS3Manager,directional_coefficients,directional_operator + from anyfesolver.assembly import assemble_mass_matrix + from anyfesolver.nonlinear_static import _assemble_nonlinear_system + from anyfesolver.nonlinear_state import discard_active_state_candidate + from anyfesolver.general_contact.runtime import suspend_contact m,r,initial=run();_,d,s,u,v,load,_=prepare();manager=EquilibratedDirectionalBeamS3Manager(m,d,s,initial_displacement=u) ids={n:m.mesh.dof_manager.get_node_dofs(n) for n in m.mesh.nodes} refs={n:tuple(Q(float(x)) for x in m.mesh.nodes[n].coords()) for n in m.mesh.nodes} @@ -57,9 +57,9 @@ def test_tilted_work_wrench_and_loaded_energy(tmp_path): fh,_,_=manager.evaluate(u+h*v);difference=(fh-f0)/h-expectedD force_rates.append(dict(h=h,error=float(max(np.max(abs(difference[trans]))/.5,np.max(abs(difference[rot]))/.25)))) M,_=assemble_mass_matrix(m);external=np.array(initial['load_forces']);energy=[];wrench=[];equilibrium=[];rotational_balance=[];reduced_equilibrium=[];null_equilibrium=[];contact_couples=[] - from anysolver.matrix_assembly import assemble_stiffness_matrix - from anysolver.assembly import build_constraint_transformation - from anysolver.algebraic_dynamics import build_declared_algebraic_basis + from anyfesolver.matrix_assembly import assemble_stiffness_matrix + from anyfesolver.assembly import build_constraint_transformation + from anyfesolver.algebraic_dynamics import build_declared_algebraic_basis K0,_=assemble_stiffness_matrix(m);_,_,T,_,independent,_=build_constraint_transformation(K0,np.zeros(len(u)),m) basis=build_declared_algebraic_basis(m,M,(T.T@M@T).tocsr(),T,independent,dense_size_limit=512);Z=basis.reduced_basis # Actual reducer has class-preserving trace ties; force and couple scales stay separate. @@ -107,8 +107,8 @@ def structural(q): def test_equilibrated_initial_refusals_and_restart_binding(tmp_path): import numpy as np from dataclasses import replace - from anysolver.general_contact.transient import solve_transient_contact,ContactTransientSolverControls - from anysolver.dynamics import TransientConfig + from anyfesolver.general_contact.transient import solve_transient_contact,ContactTransientSolverControls + from anyfesolver.dynamics import TransientConfig from examples.general_contact_beam_s3_transient_directional_tilted import run m,d,s,u,v,load,initial=prepare();controls=ContactTransientSolverControls(allow_equilibrated_directional_beam_s3_dev=True) for bad in (1,None,'yes'): @@ -121,7 +121,7 @@ def attempt(pose=u,velocity=v,dead=load,restart=None): with pytest.raises(ValueError,match='constant nodal'):attempt(dead=None) velocity=v.copy();velocity[m.mesh.dof_manager.get_node_dofs(3)[4]]+=.01;velocity[m.mesh.dof_manager.get_node_dofs(4)[4]]+=.01;velocity[m.mesh.dof_manager.get_node_dofs(5)[4]]+=.01 with pytest.raises(ValueError,match='algebraic velocity'):attempt(velocity=velocity) - from anysolver import LoadCase + from anyfesolver import LoadCase for node,axis,message in ((1,2,'initial total force'),(3,4,'initial algebraic force')): values=np.array(initial['load_forces']);values[m.mesh.dof_manager.get_node_dofs(node)[axis]]+=.001 unbalanced=LoadCase('unbalanced_'+str(axis)) @@ -129,12 +129,12 @@ def attempt(pose=u,velocity=v,dead=load,restart=None): ids=m.mesh.dof_manager.get_node_dofs(n) unbalanced.add_nodal_load(n,forces=tuple(values[ids[:3]]),moments=tuple(values[ids[3:]])) with pytest.raises(ValueError,match=message):attempt(dead=unbalanced) - from anysolver.general_contact.transient import ContactNodalLoadHistory + from anyfesolver.general_contact.transient import ContactNodalLoadHistory with pytest.raises(ValueError,match='nodal load history'): solve_transient_contact(m,d,TransientConfig(1.e-5,3.e-5,initial_displacement=u,initial_velocity=v),base_load_case=load, nodal_load_history=ContactNodalLoadHistory(((0.,1.),(1.e-4,1.))),contact_settings=s,solver_controls=controls) _,r,_=run(end=1.e-5) - from anysolver import LoadCase + from anyfesolver import LoadCase changed=LoadCase('changed_equilibrium');changed.add_nodal_load(1,forces=(0,0,.001)) with pytest.raises(ValueError,match='incompatible'):attempt(dead=changed,restart=r.restart_checkpoint) from examples.general_contact_beam_s3_transient_directional import run as oldrun @@ -146,11 +146,11 @@ def attempt(pose=u,velocity=v,dead=load,restart=None): @pytest.mark.parametrize('failure',('cancel','exception','retry')) def test_loaded_initial_transaction_boundaries(monkeypatch,tmp_path,failure): - import anysolver.general_contact.transient as driver - import anysolver.general_contact.beam_s3_transient as path - from anysolver.control import CancellationToken,SolveCancelled - from anysolver.dynamics import TransientConfig - from anysolver.general_contact.runtime import active_contact_manager + import anyfesolver.general_contact.transient as driver + import anyfesolver.general_contact.beam_s3_transient as path + from anyfesolver.control import CancellationToken,SolveCancelled + from anyfesolver.dynamics import TransientConfig + from anyfesolver.general_contact.runtime import active_contact_manager m,d,s,u,v,load,initial=prepare();bound=path.hermite_gap_bounds;commit=driver.commit_state_candidate;calls=0;commits=[];token=CancellationToken() def checked(*args,**kwargs): nonlocal calls @@ -178,11 +178,11 @@ def test_V20_secant_corruption_and_legacy_profile_identity(tmp_path): import copy import numpy as np from examples.general_contact_beam_s3_transient_directional_tilted import run - from anysolver.nonlinear_restart import analysis_configuration_fingerprint - from anysolver.assembly import build_constraint_transformation - from anysolver.matrix_assembly import assemble_stiffness_matrix - from anysolver.dynamics import TransientConfig - from anysolver.general_contact.transient import solve_transient_contact,ContactTransientSolverControls + from anyfesolver.nonlinear_restart import analysis_configuration_fingerprint + from anyfesolver.assembly import build_constraint_transformation + from anyfesolver.matrix_assembly import assemble_stiffness_matrix + from anyfesolver.dynamics import TransientConfig + from anyfesolver.general_contact.transient import solve_transient_contact,ContactTransientSolverControls m,r,initial=run(end=1.e-5);changed=copy.deepcopy(r.restart_checkpoint) m.apply_boundary_conditions();K,_=assemble_stiffness_matrix(m);_,_,_,_,ids,_=build_constraint_transformation(K,np.zeros(len(initial['pose'])),m) index=list(ids).index(m.mesh.dof_manager.get_node_dofs(3)[3]);changed['state']['acceleration'][index]+=.1 @@ -194,13 +194,13 @@ def test_V20_secant_corruption_and_legacy_profile_identity(tmp_path): reason='archived compatibility needs explicit baseline and execution authority') def test_V20_archived_legacy_profile_identity(tmp_path): import importlib.util,sys,hashlib - from anysolver.dynamics import TransientConfig - from anysolver.general_contact.transient import solve_transient_contact,ContactTransientSolverControls + from anyfesolver.dynamics import TransientConfig + from anyfesolver.general_contact.transient import solve_transient_contact,ContactTransientSolverControls # Ordinary checks never discover or import a machine-local archived owner. # An authorised reference runner supplies its exact baseline explicitly. baseline=Path(os.environ['ANYSOLVER_CONTACT_PRE_V20_BASELINE']) if not baseline.is_file():raise ValueError('explicit pre-V20 baseline is not a file') - name='anysolver.general_contact._pre_V20_transient';spec=importlib.util.spec_from_file_location(name,baseline);old=importlib.util.module_from_spec(spec);sys.modules[name]=old + name='anyfesolver.general_contact._pre_V20_transient';spec=importlib.util.spec_from_file_location(name,baseline);old=importlib.util.module_from_spec(spec);sys.modules[name]=old rows=[] try: spec.loader.exec_module(old) diff --git a/tests/test_general_contact_beam_s3_transient.py b/tests/test_general_contact_beam_s3_transient.py index a036522d3..caccc98a1 100644 --- a/tests/test_general_contact_beam_s3_transient.py +++ b/tests/test_general_contact_beam_s3_transient.py @@ -5,8 +5,8 @@ import numpy as np import pytest from examples.general_contact_beam_s3_transient import build,run -from anysolver.general_contact.beam_s3_transient import BeamS3TransientManager,hermite_gap_bounds -from anysolver.general_contact.transient import ContactTransientSolverControls +from anyfesolver.general_contact.beam_s3_transient import BeamS3TransientManager,hermite_gap_bounds +from anyfesolver.general_contact.transient import ContactTransientSolverControls def record(data): @@ -30,9 +30,9 @@ def reference(times): def body_balance(model,result): """Recover each body from actual inertia, constraints and structural work.""" - from anysolver.assembly import assemble_mass_matrix - from anysolver.nonlinear_static import _assemble_nonlinear_system - from anysolver.general_contact.runtime import suspend_contact + from anyfesolver.assembly import assemble_mass_matrix + from anyfesolver.nonlinear_static import _assemble_nonlinear_system + from anyfesolver.general_contact.runtime import suspend_contact M,_=assemble_mass_matrix(model);errors=[] for index in (0,int(np.argmin([x.minimum_gap for x in result.contact])),len(result.times)-1): u=result.displacements[index];inertia=np.asarray(M@result.accelerations[index]).reshape(-1) @@ -62,7 +62,7 @@ def test_actual_two_body_impact_reference_restart_and_export(): _,prefix=run(end=float(r.times[115]));_,resumed=run(restart=prefix.restart_checkpoint) np.testing.assert_array_equal(resumed.displacements,r.displacements[len(prefix.times)-1:]) assert resumed.restart_checkpoint==r.restart_checkpoint - from anysolver.general_contact.transient_results_archive import read_transient_contact_results + from anyfesolver.general_contact.transient_results_archive import read_transient_contact_results archive=read_transient_contact_results(r.to_archive_bytes()) assert archive.to_dict()['contact'][0]['record_type'].endswith('DeformableBeamS3Results') report=dict(states=len(r.times),active=active,displacement_error=displacement_error,velocity_error=velocity_error,energy_error=energy_error,momentum_error=momentum_error, @@ -137,11 +137,11 @@ def test_temporal_and_enforcement_reference_sensitivity(): @pytest.mark.parametrize('failure',('cancel','exception','retry')) def test_transaction_boundaries_and_restart_refusal(monkeypatch,failure): - import anysolver.general_contact.transient as driver - import anysolver.general_contact.beam_s3_transient as path - from anysolver.control import CancellationToken,SolveCancelled - from anysolver.general_contact.runtime import active_contact_manager - from anysolver.dynamics import TransientConfig + import anyfesolver.general_contact.transient as driver + import anyfesolver.general_contact.beam_s3_transient as path + from anyfesolver.control import CancellationToken,SolveCancelled + from anyfesolver.general_contact.runtime import active_contact_manager + from anyfesolver.dynamics import TransientConfig m,d,s,v=build();token=CancellationToken();commits=[];original=driver.commit_state_candidate;calls=0 def commit(origin,trial): commits.append(1) @@ -174,8 +174,8 @@ def checked(*args,**kwargs): def test_exact_zero_target_rates_and_historical_contract(): - from anysolver.general_contact.transient import solve_transient_contact - from anysolver.dynamics import TransientConfig + from anyfesolver.general_contact.transient import solve_transient_contact + from anyfesolver.dynamics import TransientConfig m,d,s,v=build();v[m.mesh.dof_manager.get_node_dofs(3)[3]]=1.e-20 with pytest.raises(ValueError,match='exactly zero'): solve_transient_contact(m,d,TransientConfig(1.e-5,1.e-4,initial_velocity=v),contact_settings=s,solver_controls=ContactTransientSolverControls(allow_deformable_beam_s3_dev=True)) @@ -183,8 +183,8 @@ def test_exact_zero_target_rates_and_historical_contract(): def test_actual_b3_public_and_explicit_rotation_refusals(): - from anysolver.general_contact.transient import solve_transient_contact - from anysolver.dynamics import TransientConfig + from anyfesolver.general_contact.transient import solve_transient_contact + from anyfesolver.dynamics import TransientConfig m,r=run(quadratic=True) assert any(x.active_line_length>0 for x in r.contact) and r.contact[-1].active_line_length==0 assert np.max(body_balance(m,r))<=1.e-6 @@ -194,7 +194,7 @@ def test_actual_b3_public_and_explicit_rotation_refusals(): solve_transient_contact(m,d,TransientConfig(1.e-5,1.e-4,initial_velocity=v,initial_displacement=u),contact_settings=s,solver_controls=ContactTransientSolverControls(allow_deformable_beam_s3_dev=True)) for flag in ('allow_multiple_beam_planes_dev','s3_algebraic_path_dev','s3_event_subdivision_dev','allow_classical_beam_dev','allow_guided_shell_pair_dev'): with pytest.raises(ValueError):ContactTransientSolverControls(allow_deformable_beam_s3_dev=True,**{flag:True}) - from anysolver import BoundaryCondition + from anyfesolver import BoundaryCondition m,d,s,v=build();m.clear_boundary_conditions() m.add_boundary_condition(BoundaryCondition('inplane_only',list(m.mesh.nodes),dict.fromkeys(('ux','uy','rz'),0.))) with pytest.raises(ValueError,match='positive definite|constrained zero'): @@ -203,12 +203,12 @@ def test_actual_b3_public_and_explicit_rotation_refusals(): def test_legacy_archive_wire_is_exact(): import hashlib,importlib.util,sys - from anysolver.general_contact import transient_results_archive as current + from anyfesolver.general_contact import transient_results_archive as current from test_general_contact_transient_results_archive import sample baseline=os.environ.get('C6_LEGACY_CODEC') if not baseline:pytest.skip('protected baseline evidence is opt-in/local') path=Path(baseline);assert path.is_file() - spec=importlib.util.spec_from_file_location('anysolver.general_contact._legacy_c6_archive',path) + spec=importlib.util.spec_from_file_location('anyfesolver.general_contact._legacy_c6_archive',path) legacy=importlib.util.module_from_spec(spec);sys.modules[spec.name]=legacy try: spec.loader.exec_module(legacy);value=sample();before=legacy.serialize_transient_contact_results(value);after=current.serialize_transient_contact_results(value) diff --git a/tests/test_general_contact_beam_s3_transient_flexural.py b/tests/test_general_contact_beam_s3_transient_flexural.py index a33b1ada5..31a83abd3 100644 --- a/tests/test_general_contact_beam_s3_transient_flexural.py +++ b/tests/test_general_contact_beam_s3_transient_flexural.py @@ -114,10 +114,10 @@ def independent_mass_chart(): def test_actual_flexural_impact_and_independent_storage(): - from anysolver.assembly import assemble_mass_matrix - from anysolver.general_contact.beam_s3_transient import BeamS3TransientManager - from anysolver.nonlinear_static import _assemble_nonlinear_system - from anysolver.general_contact.runtime import suspend_contact + from anyfesolver.assembly import assemble_mass_matrix + from anyfesolver.general_contact.beam_s3_transient import BeamS3TransientManager + from anyfesolver.nonlinear_static import _assemble_nonlinear_system + from anyfesolver.general_contact.runtime import suspend_contact m,r=run(quadratic=True,unequal=True,flexural=True) M,_=assemble_mass_matrix(m);dofs=lambda n:m.mesh.dof_manager.get_node_dofs(n) shell=m.mesh.elements[2];sdofs=np.concatenate([dofs(n) for n in (3,4,5)]) diff --git a/tests/test_general_contact_beam_s3_transient_rotational.py b/tests/test_general_contact_beam_s3_transient_rotational.py index 58862b2ce..755b8b9bb 100644 --- a/tests/test_general_contact_beam_s3_transient_rotational.py +++ b/tests/test_general_contact_beam_s3_transient_rotational.py @@ -5,8 +5,8 @@ import numpy as np import pytest from examples.general_contact_beam_s3_transient_rotational import build,run -from anysolver.general_contact.beam_s3_rotational_transient import RotationalBeamS3Manager -from anysolver.general_contact.beam_s3_transient import hermite_gap_bounds +from anyfesolver.general_contact.beam_s3_rotational_transient import RotationalBeamS3Manager +from anyfesolver.general_contact.beam_s3_transient import hermite_gap_bounds from test_general_contact_beam_s3_transient_flexural import independent_beam_storage,independent_shell_coefficients,independent_mass_chart @@ -71,13 +71,13 @@ def test_rotational_complete_work_and_hidden_target_path(): def test_actual_rotational_impact_opening_restart_and_temporal_energy(): - from anysolver.assembly import assemble_mass_matrix - from anysolver.nonlinear_static import _assemble_nonlinear_system - from anysolver.general_contact.runtime import suspend_contact + from anyfesolver.assembly import assemble_mass_matrix + from anyfesolver.nonlinear_static import _assemble_nonlinear_system + from anyfesolver.general_contact.runtime import suspend_contact m,r=run();_,prefix=run(end=float(r.times[110]));_,resumed=run(restart=prefix.restart_checkpoint) assert resumed.restart_checkpoint==r.restart_checkpoint np.testing.assert_array_equal(resumed.displacements,r.displacements[len(prefix.times)-1:]) - from anysolver.general_contact.transient_results_archive import read_transient_contact_results + from anyfesolver.general_contact.transient_results_archive import read_transient_contact_results archive=read_transient_contact_results(r.to_archive_bytes()).to_dict() assert archive['contact'][110]['fields']['shell_nodal_work_moment']==r.contact[110].shell_nodal_work_moment assert archive['contact'][110]['fields']['algebraic_acceleration_semantics']==r.contact[110].algebraic_acceleration_semantics @@ -118,15 +118,15 @@ def test_actual_rotational_impact_opening_restart_and_temporal_energy(): def test_rotational_secant_corruption_refused(): import copy,hashlib,importlib.util,sys - from anysolver.general_contact.transient import solve_transient_contact,ContactTransientSolverControls - from anysolver.nonlinear_restart import analysis_configuration_fingerprint - from anysolver.dynamics import TransientConfig + from anyfesolver.general_contact.transient import solve_transient_contact,ContactTransientSolverControls + from anyfesolver.nonlinear_restart import analysis_configuration_fingerprint + from anyfesolver.dynamics import TransientConfig _,r=run(end=.0011) changed=copy.deepcopy(r.restart_checkpoint) # Shell rx is an actual declared zero-mass reduced coordinate. m,d,s,v=build();m.apply_boundary_conditions() - from anysolver.matrix_assembly import assemble_stiffness_matrix - from anysolver.assembly import build_constraint_transformation + from anyfesolver.matrix_assembly import assemble_stiffness_matrix + from anyfesolver.assembly import build_constraint_transformation K,_=assemble_stiffness_matrix(m) _,_,T,_,ids,_=build_constraint_transformation(K,np.zeros(len(v)),m) target=m.mesh.dof_manager.get_node_dofs(3)[3] @@ -142,10 +142,10 @@ def test_rotational_secant_corruption_refused(): reason='historical V17 producer artifact must be explicitly provisioned') def test_legacy_v17_producer_checkpoint_resumes(): import hashlib,importlib.util,sys - from anysolver.general_contact.transient import solve_transient_contact,ContactTransientSolverControls - from anysolver.dynamics import TransientConfig + from anyfesolver.general_contact.transient import solve_transient_contact,ContactTransientSolverControls + from anyfesolver.dynamics import TransientConfig legacy=Path(os.environ['C6_LEGACY_TRANSIENT']) - name='anysolver.general_contact._legacy_v17_transient' + name='anyfesolver.general_contact._legacy_v17_transient' spec=importlib.util.spec_from_file_location(name,legacy);module=importlib.util.module_from_spec(spec);sys.modules[name]=module try: spec.loader.exec_module(module) @@ -162,8 +162,8 @@ def test_legacy_v17_producer_checkpoint_resumes(): def test_rotational_initial_rate_and_profile_refusal(): - from anysolver.general_contact.transient import solve_transient_contact,ContactTransientSolverControls - from anysolver.dynamics import TransientConfig + from anyfesolver.general_contact.transient import solve_transient_contact,ContactTransientSolverControls + from anyfesolver.dynamics import TransientConfig m,d,s,v=build();v[m.mesh.dof_manager.get_node_dofs(3)[3]]+=.01 with pytest.raises(ValueError,match='velocity|constraints'): solve_transient_contact(m,d,TransientConfig(1.e-5,1.e-4,initial_velocity=v),contact_settings=s,solver_controls=ContactTransientSolverControls(allow_rotational_beam_s3_dev=True)) @@ -172,11 +172,11 @@ def test_rotational_initial_rate_and_profile_refusal(): @pytest.mark.parametrize('failure',('cancel','exception','retry')) def test_rotational_transactions(monkeypatch,failure): - import anysolver.general_contact.transient as driver - import anysolver.general_contact.beam_s3_transient as path - from anysolver.control import CancellationToken,SolveCancelled - from anysolver.general_contact.runtime import active_contact_manager - from anysolver.dynamics import TransientConfig + import anyfesolver.general_contact.transient as driver + import anyfesolver.general_contact.beam_s3_transient as path + from anyfesolver.control import CancellationToken,SolveCancelled + from anyfesolver.general_contact.runtime import active_contact_manager + from anyfesolver.dynamics import TransientConfig token=CancellationToken();commits=[];calls=0 original=driver.commit_state_candidate;bound=path.hermite_gap_bounds def commit(origin,trial): diff --git a/tests/test_general_contact_beam_shell.py b/tests/test_general_contact_beam_shell.py index 33af8cbb7..a114f8afb 100644 --- a/tests/test_general_contact_beam_shell.py +++ b/tests/test_general_contact_beam_shell.py @@ -3,16 +3,16 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, LoadCase, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.elements import BeamElement, QuadraticBeamElement -from anysolver.fe_core import FEModel -from anysolver.general_contact.beam_shell import InteriorBeamShellLine -from anysolver.general_contact.beam_shell import _BeamShellManager -from anysolver.general_contact.overlap import PlanarFace +from anyfesolver.elements import BeamElement, QuadraticBeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.beam_shell import InteriorBeamShellLine +from anyfesolver.general_contact.beam_shell import _BeamShellManager +from anyfesolver.general_contact.overlap import PlanarFace def _triangle(): diff --git a/tests/test_general_contact_beam_shell_patch.py b/tests/test_general_contact_beam_shell_patch.py index ee4214668..7acb6ad72 100644 --- a/tests/test_general_contact_beam_shell_patch.py +++ b/tests/test_general_contact_beam_shell_patch.py @@ -4,18 +4,18 @@ import pytest from scipy.integrate import quad -from anysolver import ( +from anyfesolver import ( BoundaryCondition, FEModel, LoadCase, BeamElement, QuadraticBeamElement, create_shell_element, solve_static_nonlinear, ) -from anysolver.general_contact import ( +from anyfesolver.general_contact import ( ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, validate_general_contact, ) -from anysolver.general_contact.beam_shell_patch import _BeamShellPatchManager -from anysolver.general_contact.beam_shell_patch import _patch_windows -from anysolver.general_contact.overlap import PlanarFace +from anyfesolver.general_contact.beam_shell_patch import _BeamShellPatchManager +from anyfesolver.general_contact.beam_shell_patch import _patch_windows +from anyfesolver.general_contact.overlap import PlanarFace def _patch_model(): @@ -152,7 +152,7 @@ def test_internal_seam_partitions_constant_gap_line_without_double_counting(): def test_exact_seam_line_has_one_stable_owner_and_nonconforming_patch_fails(): model, definition, _ = _patch_model() - from anysolver.general_contact.overlap import reference_shell_face + from anyfesolver.general_contact.overlap import reference_shell_face faces = tuple(reference_shell_face(model, 2, eid, "top") for eid in (2, 3)) ids = ((3, 4, 5, 6), (4, 7, 8, 5)) diff --git a/tests/test_general_contact_beam_temporal_bounds.py b/tests/test_general_contact_beam_temporal_bounds.py index b58693ced..7a90e64b9 100644 --- a/tests/test_general_contact_beam_temporal_bounds.py +++ b/tests/test_general_contact_beam_temporal_bounds.py @@ -6,7 +6,7 @@ import numpy as np import pytest -from anysolver.general_contact.beam_temporal_bounds import ( +from anyfesolver.general_contact.beam_temporal_bounds import ( BeamHermiteGapBoundsError, beam_hermite_gap_bounds, ) diff --git a/tests/test_general_contact_c5_elastic_increment.py b/tests/test_general_contact_c5_elastic_increment.py index da59f7807..5db644a6e 100644 --- a/tests/test_general_contact_c5_elastic_increment.py +++ b/tests/test_general_contact_c5_elastic_increment.py @@ -6,11 +6,11 @@ import numpy as np import pytest -from anysolver import FEModel -from anysolver.elements import create_shell_element -from anysolver import e4_pl_element as qualified -from anysolver import vectorized_nonlinear as vectorized -from anysolver.nonlinear_static import _assemble_nonlinear_system +from anyfesolver import FEModel +from anyfesolver.elements import create_shell_element +from anyfesolver import e4_pl_element as qualified +from anyfesolver import vectorized_nonlinear as vectorized +from anyfesolver.nonlinear_static import _assemble_nonlinear_system def case(*, warped=False, yielding=False): @@ -51,7 +51,7 @@ def single_law_expected(element, mesh, material, u, state): facets (no assumed-strain route) keep the historical law. """ - from anysolver import _q4_assumed_strain_plasticity as assumed + from anyfesolver import _q4_assumed_strain_plasticity as assumed correction = element._qualified_linear_correction(mesh, material, 5) element._hourglass_stiffness_matrix = None @@ -146,7 +146,7 @@ def test_actual_batch_assembly_uses_single_law_kernel(): # Retargeted 2026-10-23 (single elastic law): the retired compensated direct # elastic route is no longer the batch route for a planar qualified Q4; the # actual batch assembly must equal the independent single-law oracle. - from anysolver import _q4_assumed_strain_plasticity as assumed + from anyfesolver import _q4_assumed_strain_plasticity as assumed model, element, material = case() u = pose() diff --git a/tests/test_general_contact_c5_numpy_coordinate_admission.py b/tests/test_general_contact_c5_numpy_coordinate_admission.py index 380d610c3..8236e30c2 100644 --- a/tests/test_general_contact_c5_numpy_coordinate_admission.py +++ b/tests/test_general_contact_c5_numpy_coordinate_admission.py @@ -7,9 +7,9 @@ import numpy as np import pytest -from anysolver import e4_pl_element as qualified -from anysolver.general_contact.core import suspend_contact -from anysolver.nonlinear_static import _assemble_nonlinear_system +from anyfesolver import e4_pl_element as qualified +from anyfesolver.general_contact.core import suspend_contact +from anyfesolver.nonlinear_static import _assemble_nonlinear_system from scripts.general_contact_d1_free_target_press_probe import build_free_target_case @@ -59,7 +59,7 @@ def observe(frame, event, value): @contextmanager def observe_single_law_and_direct_returns(): """Observe the single-law kernel and the retired direct body (no replacement).""" - from anysolver import _q4_assumed_strain_plasticity as assumed + from anyfesolver import _q4_assumed_strain_plasticity as assumed kernel_code = assumed.kernel_batch.__code__ direct_code = inspect.getclosurevars( diff --git a/tests/test_general_contact_capability_report.py b/tests/test_general_contact_capability_report.py index 5757f0dd5..a30447a15 100644 --- a/tests/test_general_contact_capability_report.py +++ b/tests/test_general_contact_capability_report.py @@ -4,7 +4,7 @@ import pytest -from anysolver import report_general_contact_capability, validate_general_contact +from anyfesolver import report_general_contact_capability, validate_general_contact from examples.general_contact_refined_q4_s3_tight_path import make_case diff --git a/tests/test_general_contact_capped_cylinder.py b/tests/test_general_contact_capped_cylinder.py index 2a24c7252..2c35ad634 100644 --- a/tests/test_general_contact_capped_cylinder.py +++ b/tests/test_general_contact_capped_cylinder.py @@ -7,9 +7,9 @@ import pytest from scipy.integrate import quad -from anysolver import (RigidCappedCylinder, validate_general_contact, solve_static_nonlinear, +from anyfesolver import (RigidCappedCylinder, validate_general_contact, solve_static_nonlinear, BoundaryCondition, DisplacementControl, LoadCase) -from anysolver.general_contact.capped_cylinder import (signed_distance_work,_frame, +from anyfesolver.general_contact.capped_cylinder import (signed_distance_work,_frame, curve_gap_lower,CappedCylinderBeamManager,signed_distance_value) from test_general_contact_beam_radial import _model,_trial @@ -303,7 +303,7 @@ def test_public_development_example_runs_actual_static_route(): def test_capability_reports_development_geometry_without_application_admission(): - from anysolver import report_general_contact_capability + from anyfesolver import report_general_contact_capability model,definition,settings=_case(True) report=report_general_contact_capability(model,definition,settings) assert report.implemented and report.rigid_profiles==(('obstacle','capped_cylinder'),) @@ -321,26 +321,26 @@ def test_nonmidpoint_b3_reference_rejects_chord_measure_substitution(): def test_actual_import_root_preserves_lazy_no_contact_solve(): - import anysolver + import anyfesolver import subprocess import sys - root=Path(anysolver.__file__).resolve().parent.parent + root=Path(anyfesolver.__file__).resolve().parent.parent environment=dict(os.environ,PYTHONPATH=str(root),CAPS_EXPECTED_IMPORT_ROOT=str(root)) code='''import os,sys from pathlib import Path -import anysolver -assert Path(anysolver.__file__).resolve().is_relative_to(Path(os.environ['CAPS_EXPECTED_IMPORT_ROOT'])) -assert 'anysolver.general_contact' not in sys.modules -from anysolver.boundary import LoadCase -from anysolver.mesh_gen import generate_beam_mesh +import anyfesolver +assert Path(anyfesolver.__file__).resolve().is_relative_to(Path(os.environ['CAPS_EXPECTED_IMPORT_ROOT'])) +assert 'anyfesolver.general_contact' not in sys.modules +from anyfesolver.boundary import LoadCase +from anyfesolver.mesh_gen import generate_beam_mesh model=generate_beam_mesh(1.,num_divisions=1) load=LoadCase('axial'); load.add_nodal_load(2,[10.,0.,0.,0.,0.,0.]) -result=anysolver.solve_static_nonlinear(model,load,num_steps=1,max_iterations=5) +result=anyfesolver.solve_static_nonlinear(model,load,num_steps=1,max_iterations=5) assert result.status=='completed',result.failure_reason -assert 'anysolver.general_contact.core' not in sys.modules -assert 'anysolver.general_contact.capped_cylinder' not in sys.modules -from anysolver import RigidCappedCylinder -from anysolver.general_contact import RigidCappedCylinder as exported +assert 'anyfesolver.general_contact.core' not in sys.modules +assert 'anyfesolver.general_contact.capped_cylinder' not in sys.modules +from anyfesolver import RigidCappedCylinder +from anyfesolver.general_contact import RigidCappedCylinder as exported assert RigidCappedCylinder is exported ''' completed=subprocess.run([sys.executable,'-c',code],env=environment, diff --git a/tests/test_general_contact_capped_cylinder_endcaps.py b/tests/test_general_contact_capped_cylinder_endcaps.py index 56d245b95..4f3931dbc 100644 --- a/tests/test_general_contact_capped_cylinder_endcaps.py +++ b/tests/test_general_contact_capped_cylinder_endcaps.py @@ -9,12 +9,12 @@ import numpy as np import pytest from scipy.optimize import brentq -from anysolver import (ContactDefinition,ContactInteraction,ContactSolverSettings,ContactSurface, +from anyfesolver import (ContactDefinition,ContactInteraction,ContactSolverSettings,ContactSurface, RigidCappedCylinder,BoundaryCondition,LoadCase,DisplacementControl,solve_static_nonlinear, validate_general_contact) -from anysolver.elements import BeamElement,QuadraticBeamElement -from anysolver.fe_core import FEModel -from anysolver.general_contact.capped_cylinder import (CappedCylinderBeamManager,PROFILE_END_CAPS, +from anyfesolver.elements import BeamElement,QuadraticBeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.capped_cylinder import (CappedCylinderBeamManager,PROFILE_END_CAPS, _cap_orientation_range,_frame,_controls,_end_geometry_controls,_point_gap_sign) from test_general_contact_capped_cylinder import _oracle @@ -102,8 +102,8 @@ def test_physical_end_and_b3_midpoint_junction_ownership(quadratic,reverse): manager=CappedCylinderBeamManager(model,definition,settings) assert set(manager.endpoints)=={3 if quadratic else 2} # The same topology correction applies to the existing plane owner. - from anysolver import RigidContactBody - from anysolver.general_contact.beam_plane import _BeamPlaneManager + from anyfesolver import RigidContactBody + from anyfesolver.general_contact.beam_plane import _BeamPlaneManager plane=replace(definition,rigid_bodies=(RigidContactBody('obstacle','plane',(.1,0.,0.),(1.,0.,0.)),)) plane_manager=_BeamPlaneManager(model,plane,settings) assert set(plane_manager.endpoints)==set(manager.endpoints) @@ -122,7 +122,7 @@ def test_endpoint_law_and_restart_identity_are_explicit(): assert len(contract['physical_endpoints'])==2 old=CappedCylinderBeamManager(model,_without_caps(definition),settings).restart_contract() assert 'end_cap_geometry_revision' not in old - from anysolver import report_general_contact_capability + from anyfesolver import report_general_contact_capability capability=report_general_contact_capability(model,definition,settings) assert capability.implemented and capability.validation.profile==PROFILE_END_CAPS assert not capability.tested and not capability.independently_accepted @@ -308,23 +308,23 @@ def test_public_endpoint_example_and_installed_no_contact_compatibility(): # This child follows the effective source/installed runtime, unlike the # historical lazy-import test whose child explicitly requests source. import subprocess,sys - import anysolver - root=str(Path(anysolver.__file__).resolve().parent) + import anyfesolver + root=str(Path(anyfesolver.__file__).resolve().parent) environment=os.environ.copy() environment['PYTHONPATH']=os.pathsep.join( (str(Path(root).parent),environment.get('PYTHONPATH',''))) command='''import sys from pathlib import Path -import anysolver -assert Path(anysolver.__file__).resolve().is_relative_to(Path(sys.argv[1])) -from anysolver.boundary import LoadCase -from anysolver.mesh_gen import generate_beam_mesh +import anyfesolver +assert Path(anyfesolver.__file__).resolve().is_relative_to(Path(sys.argv[1])) +from anyfesolver.boundary import LoadCase +from anyfesolver.mesh_gen import generate_beam_mesh model=generate_beam_mesh(1.,num_divisions=1) load=LoadCase('axial');load.add_nodal_load(2,[10.,0.,0.,0.,0.,0.]) -result=anysolver.solve_static_nonlinear(model,load,num_steps=1,max_iterations=5) +result=anyfesolver.solve_static_nonlinear(model,load,num_steps=1,max_iterations=5) assert result.status=='completed',result.failure_reason -assert not any(n in sys.modules for n in ('anysolver.general_contact.capped_cylinder', - 'anysolver.general_contact.beam_plane','anysolver.general_contact.beam_end_topology')) +assert not any(n in sys.modules for n in ('anyfesolver.general_contact.capped_cylinder', + 'anyfesolver.general_contact.beam_plane','anyfesolver.general_contact.beam_end_topology')) ''' process=subprocess.run([sys.executable,'-c',command,root],env=environment, capture_output=True,text=True,timeout=30) diff --git a/tests/test_general_contact_compensated_contractions.py b/tests/test_general_contact_compensated_contractions.py index 5e39de32e..099cfc504 100644 --- a/tests/test_general_contact_compensated_contractions.py +++ b/tests/test_general_contact_compensated_contractions.py @@ -8,9 +8,9 @@ import numpy as np import pytest -from anysolver import _compensated_contractions as arithmetic -from anysolver import elements, vectorized_nonlinear -from anysolver.e4_pl_element import QualifiedE4PLShellElement +from anyfesolver import _compensated_contractions as arithmetic +from anyfesolver import elements, vectorized_nonlinear +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement from test_general_contact_c5_elastic_increment import case, pose @@ -164,7 +164,7 @@ def test_committed_current_split_matches_direct_response_without_state_change(): np.testing.assert_array_equal(actual["force"], force) np.testing.assert_array_equal(actual["total"], tangent) # Canonical serialization handles all nested state provenance, not just arrays. - from anysolver.e4_pl_element import canonical_json_bytes + from anyfesolver.e4_pl_element import canonical_json_bytes assert canonical_json_bytes(sealed) == canonical_json_bytes(saved) diff --git a/tests/test_general_contact_constrained_gap_joint_dual.py b/tests/test_general_contact_constrained_gap_joint_dual.py index 2d809fd6a..3ce0f7616 100644 --- a/tests/test_general_contact_constrained_gap_joint_dual.py +++ b/tests/test_general_contact_constrained_gap_joint_dual.py @@ -9,7 +9,7 @@ import numpy as np -from anysolver.general_contact import q4_overlap_local_bound as bounds +from anyfesolver.general_contact import q4_overlap_local_bound as bounds def controls(values, count): diff --git a/tests/test_general_contact_coupled_refinement.py b/tests/test_general_contact_coupled_refinement.py index 4aa90a0f2..9c57b5ea3 100644 --- a/tests/test_general_contact_coupled_refinement.py +++ b/tests/test_general_contact_coupled_refinement.py @@ -2,7 +2,7 @@ import numpy as np -from anysolver import solve_static_nonlinear +from anyfesolver import solve_static_nonlinear from scripts.general_contact_d1_coupled_refinement import build_case diff --git a/tests/test_general_contact_coupled_tool_staging.py b/tests/test_general_contact_coupled_tool_staging.py index 569b9c7b5..0fe0304dd 100644 --- a/tests/test_general_contact_coupled_tool_staging.py +++ b/tests/test_general_contact_coupled_tool_staging.py @@ -4,10 +4,10 @@ from pathlib import Path import numpy as np import pytest -from anysolver import (LoadCase, NonlinearLoadProgram, NonlinearLoadStage, +from anyfesolver import (LoadCase, NonlinearLoadProgram, NonlinearLoadStage, solve_static_nonlinear, validate_general_contact) -from anysolver.general_contact.beam_hemisphere_coupled_tool import CoupledHemisphereToolManager, PROFILE -from anysolver.general_contact.beam_hemisphere_cylinder import ( +from anyfesolver.general_contact.beam_hemisphere_coupled_tool import CoupledHemisphereToolManager, PROFILE +from anyfesolver.general_contact.beam_hemisphere_cylinder import ( HemisphereCylinderManager, PROFILE as FIXED_PROFILE) from test_general_contact_hemisphere_cylinder_motion import fixture, reference from test_general_contact_hemisphere_cylinder_static import _line_reference @@ -209,7 +209,7 @@ def test_open_active_restart_and_incompatible_algorithm(factor): @pytest.mark.parametrize('cancel', (False, True)) def test_seed_interruption_replays_fresh(cancel, monkeypatch): - from anysolver import CancellationToken, SolveCancelled + from anyfesolver import CancellationToken, SolveCancelled model, definition, settings, load = coupled_fixture() common = dict(contact=definition, contact_settings=settings, num_steps=4, max_iterations=20, tolerance=1e-10) @@ -292,7 +292,7 @@ def test_balanced_complete_route_comparison(quadratic): def test_iteration_callback_exception_restores_committed_tool_pose(): - from anysolver.general_contact.runtime import active_contact_manager + from anyfesolver.general_contact.runtime import active_contact_manager model, definition, settings, load = coupled_fixture() last = [0.]; captured = [] def progress(event): @@ -310,7 +310,7 @@ def status(message): @pytest.mark.parametrize('nonfinite', (False,True)) def test_failed_seed_linear_system_cannot_commit(nonfinite, monkeypatch): - import anysolver.nonlinear_static as driver + import anyfesolver.nonlinear_static as driver from types import SimpleNamespace model, definition, settings, load = coupled_fixture() origin = CoupledHemisphereToolManager.coupled_load_seed_active_origin diff --git a/tests/test_general_contact_cross_side_broad_phase.py b/tests/test_general_contact_cross_side_broad_phase.py index 64811e732..47604b1bf 100644 --- a/tests/test_general_contact_cross_side_broad_phase.py +++ b/tests/test_general_contact_cross_side_broad_phase.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver.general_contact.s3_patch_mortar_energy import ( +from anyfesolver.general_contact.s3_patch_mortar_energy import ( MovingS3PatchPrimalMortarPenalty, S3PatchFace, ) diff --git a/tests/test_general_contact_curved_cylinder_response.py b/tests/test_general_contact_curved_cylinder_response.py index 18851f9e0..69f9abd22 100644 --- a/tests/test_general_contact_curved_cylinder_response.py +++ b/tests/test_general_contact_curved_cylinder_response.py @@ -15,8 +15,8 @@ from numpy.polynomial import Polynomial from scipy.optimize import brentq -from anysolver import BoundaryCondition, LoadCase, solve_static_nonlinear -from anysolver.general_contact.beam_hemisphere_cylinder import HemisphereCylinderManager +from anyfesolver import BoundaryCondition, LoadCase, solve_static_nonlinear +from anyfesolver.general_contact.beam_hemisphere_cylinder import HemisphereCylinderManager from test_general_contact_hemisphere_cylinder_static import _support_case, _line_reference from test_general_contact_hemisphere_cylinder_work import _reference @@ -142,7 +142,7 @@ def test_guided_curved_response_and_wrench(moving): def test_initial_open_interior_minimum_has_nonpenetration_certificate(monkeypatch): - from anysolver.general_contact import beam_hemisphere_cylinder as geometry + from anyfesolver.general_contact import beam_hemisphere_cylinder as geometry model, definition, settings, _ = fixture(False) bounds = [] original = geometry.curve_gap_lower @@ -268,7 +268,7 @@ def evaluate(q,factor): moment+=reaction[3:]+np.cross(positions[node-1],reaction[:3]) assert np.linalg.norm(force)/FORCE<=1e-6 assert np.linalg.norm(moment)/(FORCE*L)<=1e-6 - from anysolver.general_contact.beam_hemisphere_coupled_tool import CoupledHemisphereToolManager + from anyfesolver.general_contact.beam_hemisphere_coupled_tool import CoupledHemisphereToolManager manager=CoupledHemisphereToolManager(model,definition,settings) manager.set_path_factor(1.) _,tangent,_=manager.evaluate(result.displacements) diff --git a/tests/test_general_contact_curved_s3_q4_work.py b/tests/test_general_contact_curved_s3_q4_work.py index ff5a4d7c8..d633c3988 100644 --- a/tests/test_general_contact_curved_s3_q4_work.py +++ b/tests/test_general_contact_curved_s3_q4_work.py @@ -11,12 +11,12 @@ import numpy as np import pytest -from anysolver.corotational import _rotation_right_jacobian, rotation_matrix_from_vector -from anysolver.general_contact.curved_shell_skin import CurvedShellSkinMap, TOTAL_ROTATION_BOUND_RAD -from anysolver.general_contact.curved_s3_q4_work import CurvedS3Q4WorkProbe, CurvedContactWorkError -from anysolver.general_contact.overlap import PlanarFace -from anysolver.general_contact.q4_target_overlap import q4_target_overlap_integrals -from anysolver.general_contact.q4_s3_overlap_derivatives import UnsupportedQ4S3Branch +from anyfesolver.corotational import _rotation_right_jacobian, rotation_matrix_from_vector +from anyfesolver.general_contact.curved_shell_skin import CurvedShellSkinMap, TOTAL_ROTATION_BOUND_RAD +from anyfesolver.general_contact.curved_s3_q4_work import CurvedS3Q4WorkProbe, CurvedContactWorkError +from anyfesolver.general_contact.overlap import PlanarFace +from anyfesolver.general_contact.q4_target_overlap import q4_target_overlap_integrals +from anyfesolver.general_contact.q4_s3_overlap_derivatives import UnsupportedQ4S3Branch from examples.elastic_sphere_panel_contact_work import ( prepare_work_case, evaluate_case, first_discriminator, report_contact_work, physical_wrench, ) @@ -78,7 +78,7 @@ def test_signs_empty_overlap_and_unresolved_refusal(case, facet, near, monkeypat assert np.count_nonzero(empty.source_coordinate_work) == 0 def fail(*args, **kwargs): raise UnsupportedQ4S3Branch("deliberate unresolved clipping branch") - monkeypatch.setattr("anysolver.general_contact.curved_s3_q4_work._s3_q4_first_order_work", fail) + monkeypatch.setattr("anyfesolver.general_contact.curved_s3_q4_work._s3_q4_first_order_work", fail) with pytest.raises(UnsupportedQ4S3Branch, match="unresolved"): evaluate_case(case, "near", source_faces=(facet,)) diff --git a/tests/test_general_contact_curved_shell_skin.py b/tests/test_general_contact_curved_shell_skin.py index d4e8354d8..6575441a2 100644 --- a/tests/test_general_contact_curved_shell_skin.py +++ b/tests/test_general_contact_curved_shell_skin.py @@ -19,17 +19,17 @@ import numpy as np import pytest -from anysolver import BeamElement -from anysolver.corotational import ( +from anyfesolver import BeamElement +from anyfesolver.corotational import ( _rotation_right_jacobian, rotation_matrix_from_vector, ) -from anysolver.general_contact.curved_shell_skin import ( +from anyfesolver.general_contact.curved_shell_skin import ( CurvedShellSkinError, CurvedShellSkinMap, TOTAL_ROTATION_BOUND_RAD, ) -from anysolver.mesh_gen import InterpolatedBeamShellMPCElement +from anyfesolver.mesh_gen import InterpolatedBeamShellMPCElement from examples.elastic_sphere_stiffened_panel import ( PLATE_THICKNESS, diff --git a/tests/test_general_contact_cylinder.py b/tests/test_general_contact_cylinder.py index 8f6ec69aa..922552333 100644 --- a/tests/test_general_contact_cylinder.py +++ b/tests/test_general_contact_cylinder.py @@ -5,14 +5,14 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, DisplacementControl, LoadCase, RigidContactBody, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel -from anysolver.general_contact.sphere import _SphereShellManager +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.sphere import _SphereShellManager def _q4_cylinder(): diff --git a/tests/test_general_contact_cylinder_bending_response.py b/tests/test_general_contact_cylinder_bending_response.py index bd81e0df5..ad8ca0827 100644 --- a/tests/test_general_contact_cylinder_bending_response.py +++ b/tests/test_general_contact_cylinder_bending_response.py @@ -10,10 +10,10 @@ import pytest from scipy.integrate import quad from numpy.polynomial import Polynomial -from anysolver import (BoundaryCondition,ContactDefinition,ContactInteraction, +from anyfesolver import (BoundaryCondition,ContactDefinition,ContactInteraction, ContactSolverSettings,ContactSurface,RigidContactBody,LoadCase,solve_static_nonlinear) -from anysolver.fe_core import FEModel -from anysolver.elements import BeamElement,QuadraticBeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.elements import BeamElement,QuadraticBeamElement sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'docs/d1_review_support')) from d3_beam_foundation_reference import cantilever_foundation_reference diff --git a/tests/test_general_contact_cylinder_convergence.py b/tests/test_general_contact_cylinder_convergence.py index 179164456..fb012a25e 100644 --- a/tests/test_general_contact_cylinder_convergence.py +++ b/tests/test_general_contact_cylinder_convergence.py @@ -6,9 +6,9 @@ import pytest from scipy.optimize import brentq from scipy.integrate import quad -from anysolver import BoundaryCondition, LoadCase, solve_static_nonlinear -from anysolver.fe_core import FEModel -from anysolver.elements import BeamElement, QuadraticBeamElement +from anyfesolver import BoundaryCondition, LoadCase, solve_static_nonlinear +from anyfesolver.fe_core import FEModel +from anyfesolver.elements import BeamElement, QuadraticBeamElement from test_general_contact_hemisphere_cylinder_static import _support_case, _line_reference L=.2; EA=1.; A=.112; R=.11; P=.02; KE=1. diff --git a/tests/test_general_contact_d1_current_handoff.py b/tests/test_general_contact_d1_current_handoff.py index 9c3469eca..761e136c5 100644 --- a/tests/test_general_contact_d1_current_handoff.py +++ b/tests/test_general_contact_d1_current_handoff.py @@ -20,7 +20,7 @@ def test_null_restart_is_refused(tmp_path): def test_force_restart_refusal_preserves_global_sweep_method(kind,tmp_path,monkeypatch): import inspect from scripts import general_contact_d1_interior_press_dev as entry - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager fixture=json.loads(FIXTURE.read_text()) payload=copy.deepcopy(fixture) if kind=='null':payload={'restart_checkpoint':None} diff --git a/tests/test_general_contact_d1_development_recording.py b/tests/test_general_contact_d1_development_recording.py index cc3d16aac..3d69b66b2 100644 --- a/tests/test_general_contact_d1_development_recording.py +++ b/tests/test_general_contact_d1_development_recording.py @@ -33,7 +33,7 @@ def test_moving_clamp_controls_every_target_left_node(): assert equation.value == 0. assert [coefficient for _, coefficient in equation.coefficients] == [1., -1.] from scipy import sparse - from anysolver.assembly import build_constraint_transformation + from anyfesolver.assembly import build_constraint_transformation moving.apply_boundary_conditions() size = moving.mesh.dof_manager.total_dofs _, _, transform, offset, _, _ = build_constraint_transformation( @@ -127,7 +127,7 @@ def test_radial_postprocessing_failure_retains_mechanical_result(tmp_path, monke def test_invalid_rejected_geometry_is_reported_without_masking_failure(): - from anysolver.general_contact.semismooth_path import _proposal_gap_diagnostic + from anyfesolver.general_contact.semismooth_path import _proposal_gap_diagnostic def invalid(*args): raise ValueError("folded rejected proposal") manager = SimpleNamespace(_positions=lambda u: u, _gap_lower=invalid) diff --git a/tests/test_general_contact_d1_interior_profile.py b/tests/test_general_contact_d1_interior_profile.py index aa4c8d04c..bb4e1bce8 100644 --- a/tests/test_general_contact_d1_interior_profile.py +++ b/tests/test_general_contact_d1_interior_profile.py @@ -7,14 +7,14 @@ import numpy as np import pytest -from anysolver import BoundaryCondition, create_shell_element, solve_static_nonlinear -from anysolver.assembly import build_constraint_transformation -from anysolver.control import SolveCancelled -from anysolver.fe_core import FEModel -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.general_contact import semismooth_path -from anysolver.general_contact.semismooth import linearize -from anysolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver import BoundaryCondition, create_shell_element, solve_static_nonlinear +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.control import SolveCancelled +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact import semismooth_path +from anyfesolver.general_contact.semismooth import linearize +from anyfesolver.matrix_assembly import assemble_stiffness_matrix from examples.general_contact_d1_interior_controls_dev import ( _independent_projected_gap_bound, ) diff --git a/tests/test_general_contact_d1_overlap_gap_bound_dev.py b/tests/test_general_contact_d1_overlap_gap_bound_dev.py index 3189a8fc7..2db531ce1 100644 --- a/tests/test_general_contact_d1_overlap_gap_bound_dev.py +++ b/tests/test_general_contact_d1_overlap_gap_bound_dev.py @@ -6,14 +6,14 @@ import numpy as np -from anysolver import validate_general_contact -from anysolver.general_contact.q4_source_overlap import ( +from anyfesolver import validate_general_contact +from anyfesolver.general_contact.q4_source_overlap import ( q4_source_planar_overlap_gap_lower, q4_source_projected_gap_lower, q4_source_projected_swept_gap_lower, ) -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.general_contact.q4_overlap_local_bound import ( +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.q4_overlap_local_bound import ( overlap_local_lower, overlap_local_swept_lower, ) diff --git a/tests/test_general_contact_d1_path_normal_admission.py b/tests/test_general_contact_d1_path_normal_admission.py index fbf25b7f0..5c761a649 100644 --- a/tests/test_general_contact_d1_path_normal_admission.py +++ b/tests/test_general_contact_d1_path_normal_admission.py @@ -4,7 +4,7 @@ import numpy as np import pytest -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from scripts.general_contact_d1_interior_press_dev import build_interior_press diff --git a/tests/test_general_contact_d1_projected_refined_gap.py b/tests/test_general_contact_d1_projected_refined_gap.py index 34fd7ba02..f9b49809d 100644 --- a/tests/test_general_contact_d1_projected_refined_gap.py +++ b/tests/test_general_contact_d1_projected_refined_gap.py @@ -2,11 +2,11 @@ import numpy as np -from anysolver.general_contact import static_path -from anysolver.general_contact.q4_s3_overlap_derivatives import UnsupportedQ4S3Branch +from anyfesolver.general_contact import static_path +from anyfesolver.general_contact.q4_s3_overlap_derivatives import UnsupportedQ4S3Branch from scripts.general_contact_d1_coupled_refinement import build_case -from anysolver import solve_static_nonlinear, validate_general_contact +from anyfesolver import solve_static_nonlinear, validate_general_contact def test_refined_projected_patch_press_slide_open_recontact_with_tight_gap(): diff --git a/tests/test_general_contact_d1_radial_source_bin_work.py b/tests/test_general_contact_d1_radial_source_bin_work.py index c6d66e908..798f1a9bb 100644 --- a/tests/test_general_contact_d1_radial_source_bin_work.py +++ b/tests/test_general_contact_d1_radial_source_bin_work.py @@ -108,7 +108,7 @@ def test_warped_geometry_bins_obey_the_independent_two_sided_conversion_bound(): def test_warped_independent_bins_match_production_pair_work_before_assembly(): - from anysolver.general_contact.s3_patch_mortar_energy import ( + from anyfesolver.general_contact.s3_patch_mortar_energy import ( MovingS3PatchPrimalMortarPenalty, S3PatchFace, ) source, target, force = _faces(warped=True) diff --git a/tests/test_general_contact_d1_swept_coverage.py b/tests/test_general_contact_d1_swept_coverage.py index b69232f64..a9ebdd2d0 100644 --- a/tests/test_general_contact_d1_swept_coverage.py +++ b/tests/test_general_contact_d1_swept_coverage.py @@ -8,7 +8,7 @@ import numpy as np import pytest -from anysolver.general_contact.d1_interior_profile import ( +from anyfesolver.general_contact.d1_interior_profile import ( _bernstein_cross, _bernstein_dot, _interval_sub, swept_projected_coverage_admissible, ) @@ -206,7 +206,7 @@ def cross(x, y): def test_actual_eight_s3_captured_physical_skin_trial_is_covered(): # Reuse the actual preserved development geometry, without a coupled solve. - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from scripts.general_contact_d1_interior_press_dev import build_interior_press path = Path(__file__).resolve().parents[1] / ( diff --git a/tests/test_general_contact_d1_two_body_nonlinear_oracle.py b/tests/test_general_contact_d1_two_body_nonlinear_oracle.py index a73cb6d75..0b5857582 100644 --- a/tests/test_general_contact_d1_two_body_nonlinear_oracle.py +++ b/tests/test_general_contact_d1_two_body_nonlinear_oracle.py @@ -12,9 +12,8 @@ def test_clipping_signature_distinguishes_equal_vertex_counts_with_different_edges(): root = Path(__file__).resolve().parents[1] - sys.path.insert(0, str(root / "docs" / "d1_review_support")) - from d1_two_body_current_skin_quadrature import overlap_incidence - from d1_two_body_reference_oracle import _clip + sys.path.insert(0, str(root / "tests" / "fixtures")) + from d1_current_skin import overlap_incidence, _clip source = np.array(((0., 0.), (1., 0.), (1., 1.), (0., 1.))) lower_left = np.array(((0., 0.), (0.2, 0.), (0., 0.2))) @@ -28,18 +27,20 @@ def test_clipping_signature_distinguishes_equal_vertex_counts_with_different_edg != overlap_incidence(source, upper_right, second)) -def test_saved_slide_matches_independent_current_contact_kkt(): +def test_saved_slide_matches_independent_current_contact_kkt(tmp_path): root = Path(__file__).resolve().parents[1] environment = os.environ.copy() environment["PYTHONPATH"] = os.pathsep.join(( - str(root / "src"), str(root), str(root / "docs" / "d1_review_support"), + str(root / "src"), str(root / "packages/results/src"), str(root), )) completed = subprocess.run( - [sys.executable, str(root / "docs" / "d1_review_support" - / "d1_two_body_nonlinear_kkt_compare.py")], + [sys.executable, str(root / "tests" / "fixtures" + / "d1_nonlinear_kkt.py")], cwd=root, env=environment, capture_output=True, text=True, - check=True, timeout=120, + check=False, timeout=120, ) + assert completed.returncode == 0, completed.stderr + (tmp_path / "d1_kkt_comparison.json").write_text(completed.stdout, encoding="utf-8") result = json.loads(completed.stdout) assert result["status"] == "development_independent_contact_nonlinear_kkt" assert result["active_pressure_modes"] == [3, 8] @@ -79,14 +80,15 @@ def test_active_contact_work_is_exactly_independent_of_control_dofs(): root = Path(__file__).resolve().parents[1] environment = os.environ.copy() environment["PYTHONPATH"] = os.pathsep.join(( - str(root / "src"), str(root), str(root / "docs" / "d1_review_support"), + str(root / "src"), str(root / "packages/results/src"), str(root), )) completed = subprocess.run( - [sys.executable, str(root / "docs" / "d1_review_support" - / "d1_two_body_control_reaction_route_probe.py")], + [sys.executable, str(root / "tests" / "fixtures" + / "d1_control_reaction.py")], cwd=root, env=environment, capture_output=True, text=True, - check=True, timeout=120, + check=False, timeout=120, ) + assert completed.returncode == 0, completed.stderr result = json.loads(completed.stdout) assert result["status"] == "development_control_reaction_route_probe" assert result["active_pressure_modes"] == [3, 8] @@ -110,12 +112,12 @@ def test_active_contact_work_is_exactly_independent_of_control_dofs(): assert result["external_control_n"] == [0.0, 0.0] -@pytest.mark.parametrize("script", ["d1_two_body_nonlinear_kkt_compare.py", "d1_two_body_displacement_compare.py"]) +@pytest.mark.parametrize("script", ["tests/fixtures/d1_nonlinear_kkt.py", "docs/d1_review_support/d1_two_body_displacement_compare.py"]) def test_oracle_source_identity_does_not_attribute_an_enclosing_checkout(monkeypatch,tmp_path,script): # Extract this metadata-only helper without running the nonlinear fixture. # Its negative cases protect exported/installed-source provenance. import ast - source=Path(__file__).resolve().parents[1]/'docs/d1_review_support'/script + source=Path(__file__).resolve().parents[1]/script tree=ast.parse(source.read_text(encoding='utf-8')) node=next(n for n in tree.body if isinstance(n,ast.FunctionDef) and n.name=='_checkout_commit') namespace=dict(Path=Path,subprocess=subprocess) diff --git a/tests/test_general_contact_deformable_b3_s3_static.py b/tests/test_general_contact_deformable_b3_s3_static.py index 6171d841a..684a67e8d 100644 --- a/tests/test_general_contact_deformable_b3_s3_static.py +++ b/tests/test_general_contact_deformable_b3_s3_static.py @@ -4,10 +4,10 @@ import numpy as np from scipy.integrate import quad from scipy.optimize import root -from anysolver import BoundaryCondition, LoadCase, solve_static_nonlinear -from anysolver.elements import QuadraticBeamElement -from anysolver.matrix_assembly import assemble_stiffness_matrix -from anysolver.general_contact.deformable_beam_s3_static import DeformableBeamS3Manager +from anyfesolver import BoundaryCondition, LoadCase, solve_static_nonlinear +from anyfesolver.elements import QuadraticBeamElement +from anyfesolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.general_contact.deformable_beam_s3_static import DeformableBeamS3Manager from s3_von_karman_oracle import model_triangle_von_karman diff --git a/tests/test_general_contact_deformable_beam_s3.py b/tests/test_general_contact_deformable_beam_s3.py index 0d79cbe41..b7b890eec 100644 --- a/tests/test_general_contact_deformable_beam_s3.py +++ b/tests/test_general_contact_deformable_beam_s3.py @@ -3,7 +3,7 @@ import pytest from scipy.integrate import quad -from anysolver.general_contact.deformable_beam_s3_line import DeformableBeamS3Line +from anyfesolver.general_contact.deformable_beam_s3_line import DeformableBeamS3Line def fixture(count=3): diff --git a/tests/test_general_contact_deformable_beam_s3_caps.py b/tests/test_general_contact_deformable_beam_s3_caps.py index 08fac7e3d..1386a167c 100644 --- a/tests/test_general_contact_deformable_beam_s3_caps.py +++ b/tests/test_general_contact_deformable_beam_s3_caps.py @@ -7,11 +7,11 @@ import pytest from scipy.integrate import quad from scipy.optimize import root -from anysolver import (BoundaryCondition, LoadCase, DisplacementControl, CancellationToken, +from anyfesolver import (BoundaryCondition, LoadCase, DisplacementControl, CancellationToken, SolveCancelled, solve_static_nonlinear, validate_general_contact) -from anysolver.elements import BeamElement, QuadraticBeamElement -from anysolver.general_contact.beam_hemisphere_s3_support import hemisphere_s3_work -from anysolver.general_contact.deformable_beam_s3_caps import DeformableBeamS3CapManager, PROFILE +from anyfesolver.elements import BeamElement, QuadraticBeamElement +from anyfesolver.general_contact.beam_hemisphere_s3_support import hemisphere_s3_work +from anyfesolver.general_contact.deformable_beam_s3_caps import DeformableBeamS3CapManager, PROFILE from test_general_contact_deformable_beam_s3_static import fixture as line_fixture, constraints from test_general_contact_deformable_beam_s3_static import independent_contact_gradient as line_oracle from test_general_contact_hemisphere_plane import scalar_gap @@ -153,7 +153,7 @@ def coupled_fixture(): def test_actual_deforming_target_coupled_force_displacement_oracle_and_restart(): - from anysolver.matrix_assembly import assemble_stiffness_matrix + from anyfesolver.matrix_assembly import assemble_stiffness_matrix model,definition,settings,load=coupled_fixture() common=dict(contact=definition,contact_settings=settings,num_steps=4,max_iterations=25, tolerance=1e-10,emit_restart_checkpoint=True) @@ -281,7 +281,7 @@ def test_true_material_ends_and_explicit_admission(): def test_runnable_moving_skin_example_and_unaccepted_capability(): from examples.general_contact_deformable_s3_caps import run, build - from anysolver import report_general_contact_capability + from anyfesolver import report_general_contact_capability result=run();assert result.status=='completed' assert result.info['general_contact']['profile']==PROFILE model,definition,settings,_=build() diff --git a/tests/test_general_contact_deformable_beam_s3_static.py b/tests/test_general_contact_deformable_beam_s3_static.py index 4e5f54867..991da6175 100644 --- a/tests/test_general_contact_deformable_beam_s3_static.py +++ b/tests/test_general_contact_deformable_beam_s3_static.py @@ -7,13 +7,13 @@ from scipy.integrate import quad from scipy.optimize import root -from anysolver import (BoundaryCondition, ContactDefinition, ContactSurface, ContactInteraction, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactSurface, ContactInteraction, ContactSolverSettings, LoadCase, create_shell_element, solve_static_nonlinear, validate_general_contact) -from anysolver.fe_core import FEModel -from anysolver.elements import BeamElement -from anysolver.general_contact.deformable_beam_s3_static import DeformableBeamS3Manager, PROFILE -from anysolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.fe_core import FEModel +from anyfesolver.elements import BeamElement +from anyfesolver.general_contact.deformable_beam_s3_static import DeformableBeamS3Manager, PROFILE +from anyfesolver.matrix_assembly import assemble_stiffness_matrix def fixture(): diff --git a/tests/test_general_contact_descriptor_directional_rates.py b/tests/test_general_contact_descriptor_directional_rates.py index 9e2fd7c3c..59fa2431e 100644 --- a/tests/test_general_contact_descriptor_directional_rates.py +++ b/tests/test_general_contact_descriptor_directional_rates.py @@ -8,13 +8,13 @@ import pytest from scipy import sparse -from anysolver import ( +from anyfesolver import ( ContactNodalLoadHistory, ContactTransientSolverControls, LoadCase, TransientConfig, solve_transient_contact, ) -from anysolver.general_contact.descriptor_rates import directional_descriptor_rate -from anysolver.general_contact.core import active_contact_manager -import anysolver.general_contact.transient as driver +from anyfesolver.general_contact.descriptor_rates import directional_descriptor_rate +from anyfesolver.general_contact.core import active_contact_manager +import anyfesolver.general_contact.transient as driver from test_general_contact_transient_plane import _guided_s3_descriptor_impact, _uniform_s3_normal_load diff --git a/tests/test_general_contact_displacement_augmented.py b/tests/test_general_contact_displacement_augmented.py index 528978d8c..bfb22a677 100644 --- a/tests/test_general_contact_displacement_augmented.py +++ b/tests/test_general_contact_displacement_augmented.py @@ -4,7 +4,7 @@ import numpy as np -from anysolver import ( +from anyfesolver import ( BoundaryCondition, DisplacementControl, LoadCase, solve_static_nonlinear, ) from test_general_contact_s3_patch_augmented import _augmented_case diff --git a/tests/test_general_contact_eccentric_source_director.py b/tests/test_general_contact_eccentric_source_director.py index 07a20201f..ebe371a18 100644 --- a/tests/test_general_contact_eccentric_source_director.py +++ b/tests/test_general_contact_eccentric_source_director.py @@ -3,15 +3,15 @@ import numpy as np from scipy import sparse -from anysolver.general_contact.core import suspend_contact -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.general_contact.semismooth import ( +from anyfesolver.general_contact.core import suspend_contact +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.semismooth import ( complementarity, linearize, reference_nodal_support, ) -from anysolver.general_contact.semismooth_path import ( +from anyfesolver.general_contact.semismooth_path import ( _assemble_direct_matrix, _coupled_contact_blocks, ) -from anysolver.nonlinear_static import ( +from anyfesolver.nonlinear_static import ( _assemble_nonlinear_system, _discard_nonlinear_state_candidate, ) from scripts.general_contact_d1_eccentric_source_director import ( diff --git a/tests/test_general_contact_enriched_cold_predictor.py b/tests/test_general_contact_enriched_cold_predictor.py index 942e6fef0..3d16e6677 100644 --- a/tests/test_general_contact_enriched_cold_predictor.py +++ b/tests/test_general_contact_enriched_cold_predictor.py @@ -3,14 +3,14 @@ from types import SimpleNamespace import numpy as np import pytest -from anysolver import FEModel,BoundaryCondition,create_shell_element -from anysolver.control import SolveCancelled -from anysolver.e4_pl_enriched import EnrichedProfileError -from anysolver.general_contact import enriched_cold_predictor as predictor -from anysolver.general_contact import enriched_nonlinear as nonlinear -from anysolver.general_contact.enriched_static import EnrichedStaticSystem,MixedCriteria,IterationControl -from anysolver.general_contact.enriched_nonlinear import NonlinearEnrichedSystem,PairDefinition -from anysolver.general_contact.enriched_overlap import QuadraturePolicy +from anyfesolver import FEModel,BoundaryCondition,create_shell_element +from anyfesolver.control import SolveCancelled +from anyfesolver.e4_pl_enriched import EnrichedProfileError +from anyfesolver.general_contact import enriched_cold_predictor as predictor +from anyfesolver.general_contact import enriched_nonlinear as nonlinear +from anyfesolver.general_contact.enriched_static import EnrichedStaticSystem,MixedCriteria,IterationControl +from anyfesolver.general_contact.enriched_nonlinear import NonlinearEnrichedSystem,PairDefinition +from anyfesolver.general_contact.enriched_overlap import QuadraturePolicy def certify(h,g,gap,r,z,d,p): diff --git a/tests/test_general_contact_enriched_moment_batch.py b/tests/test_general_contact_enriched_moment_batch.py index 3faca103e..b770721ea 100644 --- a/tests/test_general_contact_enriched_moment_batch.py +++ b/tests/test_general_contact_enriched_moment_batch.py @@ -3,16 +3,16 @@ import time import numpy as np import pytest -from anysolver import FEModel,BoundaryCondition,create_shell_element -from anysolver.control import SolveCancelled -from anysolver._ge_beam3_mixed_ad import Jet2,sqrt as old_sqrt -from anysolver.e4_pl_enriched import EnrichedProfileError -from anysolver.general_contact.enriched_overlap import ( +from anyfesolver import FEModel,BoundaryCondition,create_shell_element +from anyfesolver.control import SolveCancelled +from anyfesolver._ge_beam3_mixed_ad import Jet2,sqrt as old_sqrt +from anyfesolver.e4_pl_enriched import EnrichedProfileError +from anyfesolver.general_contact.enriched_overlap import ( moments as old_moments,QuadraturePolicy,EnrichedGeometryError) -from anysolver.general_contact.enriched_union import selected_pair_moments as old_selected -from anysolver.general_contact import enriched_moment_batch as kernel -from anysolver.general_contact.moment_batch_ad import PointJet,sqrt as batch_sqrt,choose -from anysolver.general_contact.enriched_nonlinear import ( +from anyfesolver.general_contact.enriched_union import selected_pair_moments as old_selected +from anyfesolver.general_contact import enriched_moment_batch as kernel +from anyfesolver.general_contact.moment_batch_ad import PointJet,sqrt as batch_sqrt,choose +from anyfesolver.general_contact.enriched_nonlinear import ( NonlinearEnrichedSystem,PairDefinition,MixedCriteria,IterationControl) POLICY=QuadraturePolicy(1e-10,1e-8,1e-5,14144) diff --git a/tests/test_general_contact_enriched_multitarget.py b/tests/test_general_contact_enriched_multitarget.py index 4144f8e32..70b185b60 100644 --- a/tests/test_general_contact_enriched_multitarget.py +++ b/tests/test_general_contact_enriched_multitarget.py @@ -6,12 +6,12 @@ from pathlib import Path import numpy as np import pytest -from anysolver.control import SolveCancelled -from anysolver.e4_pl_enriched import EnrichedProfileError -from anysolver.general_contact.enriched_overlap import EnrichedGeometryError -from anysolver.general_contact.enriched_multitarget_topology import disk_topology,certify_disk -from anysolver.general_contact.enriched_multitarget import MultiTargetSystem -from anysolver.general_contact.enriched_path import EnrichedPathOwner +from anyfesolver.control import SolveCancelled +from anyfesolver.e4_pl_enriched import EnrichedProfileError +from anyfesolver.general_contact.enriched_overlap import EnrichedGeometryError +from anyfesolver.general_contact.enriched_multitarget_topology import disk_topology,certify_disk +from anyfesolver.general_contact.enriched_multitarget import MultiTargetSystem +from anyfesolver.general_contact.enriched_path import EnrichedPathOwner from examples.general_contact_enriched_d1_path import build @@ -32,9 +32,9 @@ def test_explicit_multiedge_disk_and_nonmanifold_refusals(): def test_new_selected_operator_preserves_ordinary_full37_value_gradient_hessian(record_property): - from anysolver.general_contact.enriched_overlap import QuadraturePolicy - from anysolver.general_contact.enriched_moment_batch import batch_moments - from anysolver.general_contact.enriched_multitarget_moments import selected_batch_moments + from anyfesolver.general_contact.enriched_overlap import QuadraturePolicy + from anyfesolver.general_contact.enriched_moment_batch import batch_moments + from anyfesolver.general_contact.enriched_multitarget_moments import selected_batch_moments ref=np.array(((-.5,-.5,0.),(.5,-.5,0.),(.5,.5,0.),(-.5,.5,0.))) source=ref.copy();source[:,2]=(.001,-.002,.0015,-.0005) mid=source.copy();target=np.array(((-3.,-3.,-.2),(0.,4.,-.21),(4.,-3.,-.19))) @@ -60,7 +60,7 @@ def test_new_selected_operator_preserves_ordinary_full37_value_gradient_hessian( def test_registered_layout_affine_lift_all8_and_legacy_unchanged(layouts,record_property,tmp_path): - from anysolver.general_contact.enriched_nonlinear import NonlinearEnrichedSystem + from anyfesolver.general_contact.enriched_nonlinear import NonlinearEnrichedSystem measured={} for mode,(model,definition,owner,descriptor) in layouts.items(): template=owner.template;c=template._control_matrix;t=template.transform diff --git a/tests/test_general_contact_enriched_multitarget_cost.py b/tests/test_general_contact_enriched_multitarget_cost.py index de36ec21e..41b1bc87b 100644 --- a/tests/test_general_contact_enriched_multitarget_cost.py +++ b/tests/test_general_contact_enriched_multitarget_cost.py @@ -3,20 +3,20 @@ import numpy as np import pytest -from anysolver.control import SolveCancelled -from anysolver.matrix_assembly import AssemblyError -from anysolver.element_capabilities import ElementCapabilityError -from anysolver.e4_pl_enriched import EnrichedProfileError -from anysolver.general_contact.enriched_overlap import QuadraturePolicy, EnrichedGeometryError -from anysolver.general_contact.enriched_multitarget import MultiTargetSystem -from anysolver.general_contact._enriched_multitarget_trial import AcceptedTrial -from anysolver.general_contact.enriched_static import MixedCriteria, IterationControl +from anyfesolver.control import SolveCancelled +from anyfesolver.matrix_assembly import AssemblyError +from anyfesolver.element_capabilities import ElementCapabilityError +from anyfesolver.e4_pl_enriched import EnrichedProfileError +from anyfesolver.general_contact.enriched_overlap import QuadraturePolicy, EnrichedGeometryError +from anyfesolver.general_contact.enriched_multitarget import MultiTargetSystem +from anyfesolver.general_contact._enriched_multitarget_trial import AcceptedTrial +from anyfesolver.general_contact.enriched_static import MixedCriteria, IterationControl def fixture(): # Real protected nonlinear assembly, all explicit B4 modes, real public S3. - from anysolver import FEModel,BoundaryCondition,create_shell_element - from anysolver.general_contact.enriched_nonlinear import NonlinearEnrichedSystem,PairDefinition + from anyfesolver import FEModel,BoundaryCondition,create_shell_element + from anyfesolver.general_contact.enriched_nonlinear import NonlinearEnrichedSystem,PairDefinition model=FEModel('multitarget_reuse_real_elastic') model.add_material('elastic',1e5,.3,density=1.) source=((-0.5,-0.5,0.),(.5,-.5,0.),(.5,.5,0.),(-.5,.5,0.)) @@ -46,8 +46,8 @@ def fixture(): def test_bounded_value_graph_matches_scalar_jet_and_exception_fallback(): - from anysolver._ge_beam3_mixed_ad import Jet2 as Full, sqrt as full_sqrt - from anysolver.general_contact._enriched_multitarget_empty import Jet2 as Bound, sqrt + from anyfesolver._ge_beam3_mixed_ad import Jet2 as Full, sqrt as full_sqrt + from anyfesolver.general_contact._enriched_multitarget_empty import Jet2 as Bound, sqrt for value in (.125, 1., 3.5): gradient = np.linspace(-.3, .4, 37) hessian = np.outer(gradient, gradient) @@ -62,8 +62,8 @@ def test_bounded_value_graph_matches_scalar_jet_and_exception_fallback(): def test_empty_full37_values_signatures_guards_and_nonempty_fallback(record_property): - from anysolver.general_contact._enriched_multitarget_empty import empty_preflight - from anysolver.general_contact.enriched_multitarget_moments import ( + from anyfesolver.general_contact._enriched_multitarget_empty import empty_preflight + from anyfesolver.general_contact.enriched_multitarget_moments import ( selected_batch_moments, _selected_batch_moments_full) ref = np.array(((-.5,-.5,0.),(.5,-.5,0.),(.5,.5,0.),(-.5,.5,0.))) target = np.array(((3.,3.,-.2),(3.,4.,-.2),(4.,3.,-.2))) @@ -107,7 +107,7 @@ def test_actual_trial_reuse_matches_recomputed_equations(monkeypatch,record_prop def test_actual_interiteration_cancel_mutation_nested_and_cache_refusals(monkeypatch,record_property): - from anysolver.general_contact.runtime import _ACTIVE_CONTACT + from anyfesolver.general_contact.runtime import _ACTIVE_CONTACT original = AcceptedTrial.consume reached = {} for mode in ('cancel','model','nested'): diff --git a/tests/test_general_contact_enriched_nonlinear.py b/tests/test_general_contact_enriched_nonlinear.py index 2665ea321..3f47409ac 100644 --- a/tests/test_general_contact_enriched_nonlinear.py +++ b/tests/test_general_contact_enriched_nonlinear.py @@ -9,13 +9,13 @@ import numpy as np import pytest -from anysolver import FEModel,BoundaryCondition,create_shell_element -from anysolver.control import SolveCancelled -from anysolver.e4_pl_enriched import EnrichedProfileError -from anysolver.e4_pl_enriched_nonlinear import compile_nonlinear_cell,FORMULATION -from anysolver.e4_pl_element import _source_fields,_coefficients -from anysolver.general_contact.enriched_overlap import QuadraturePolicy,EnrichedGeometryError -from anysolver.general_contact.enriched_nonlinear import ( +from anyfesolver import FEModel,BoundaryCondition,create_shell_element +from anyfesolver.control import SolveCancelled +from anyfesolver.e4_pl_enriched import EnrichedProfileError +from anyfesolver.e4_pl_enriched_nonlinear import compile_nonlinear_cell,FORMULATION +from anyfesolver.e4_pl_element import _source_fields,_coefficients +from anyfesolver.general_contact.enriched_overlap import QuadraturePolicy,EnrichedGeometryError +from anyfesolver.general_contact.enriched_nonlinear import ( NonlinearEnrichedSystem,PairDefinition,MixedCriteria,IterationControl, ) @@ -95,7 +95,7 @@ def independent_difference(cell,q): def actual_assembly(model,u): - from anysolver.nonlinear_static import (_prepare_initial_states, + from anyfesolver.nonlinear_static import (_prepare_initial_states, _prepare_qualified_q4_states_for_nonlinear_solve,_activate_nonlinear_state_storage, _assemble_nonlinear_system,_discard_nonlinear_state_candidate) zero=np.zeros(model.mesh.dof_manager.total_dofs);info={} @@ -174,8 +174,8 @@ def test_all_four_bubbles_and_complete_current_normal_chain_tangent(record_prope def test_affine_physical_offset_map_matches_original_both_body_helpers(record_property): - from anysolver.general_contact.q4_skin_work import Q4SkinWorkAdapter - from anysolver.general_contact.s3_skin_work import S3SkinWorkAdapter + from anyfesolver.general_contact.q4_skin_work import Q4SkinWorkAdapter + from anyfesolver.general_contact.s3_skin_work import S3SkinWorkAdapter model,_=small() source=Q4SkinWorkAdapter.from_model(model,1,1,'bottom') target=S3SkinWorkAdapter.from_model(model,2,2,'top') @@ -277,7 +277,7 @@ def test_union_external_nonconforming_and_folded_domains_refuse(): # Put the first source edge on the actual shared line x+y=0. for x,_,_ in mapping: x[:12]=np.array(((-.5,.5,-.025),(.5,-.5,-.025),(.5,.5,-.025),(-.5,1.5,-.025))).ravel() - from anysolver.general_contact.enriched_union import certify_union + from anyfesolver.general_contact.enriched_union import certify_union with pytest.raises(EnrichedGeometryError,match='collinearity'): certify_union(pairs[0],pairs[1],mapping[0],mapping[1]) diff --git a/tests/test_general_contact_enriched_path.py b/tests/test_general_contact_enriched_path.py index eecf59e9d..bb760d545 100644 --- a/tests/test_general_contact_enriched_path.py +++ b/tests/test_general_contact_enriched_path.py @@ -5,8 +5,8 @@ from pathlib import Path import numpy as np import pytest -from anysolver.e4_pl_enriched import EnrichedProfileError -from anysolver.control import SolveCancelled +from anyfesolver.e4_pl_enriched import EnrichedProfileError +from anyfesolver.control import SolveCancelled from scripts.general_contact_enriched_path_run import equal_tree,complete_paths diff --git a/tests/test_general_contact_enriched_reference.py b/tests/test_general_contact_enriched_reference.py index 8bbd99256..5f6d93aee 100644 --- a/tests/test_general_contact_enriched_reference.py +++ b/tests/test_general_contact_enriched_reference.py @@ -88,7 +88,7 @@ def test_complete238_work_inventory_and_live_mutation_cancellation(monkeypatch): with pytest.raises(ReferenceRefused, match='mutated'): oracle.evaluate(oracle.base_pose) oracle.model.mesh.nodes[1].z = 0. - from anysolver.control import SolveCancelled + from anyfesolver.control import SolveCancelled oracle.cancel = lambda: True with pytest.raises(SolveCancelled): oracle.evaluate(oracle.base_pose) diff --git a/tests/test_general_contact_enriched_reference_polynomial.py b/tests/test_general_contact_enriched_reference_polynomial.py index 28d11b410..1142bce48 100644 --- a/tests/test_general_contact_enriched_reference_polynomial.py +++ b/tests/test_general_contact_enriched_reference_polynomial.py @@ -162,7 +162,7 @@ def test_control_variate_refusal_actual_pose_rebuild_mutation_and_cancel(monkeyp finally: base.model.mesh.nodes[1].z = old assert abs(oracle.evaluate(trial)['work']-changed['work']) <= 1e-13 - from anysolver.control import SolveCancelled + from anyfesolver.control import SolveCancelled from scripts import general_contact_enriched_reference as reference # The requested full_work callback must remain authoritative when a prior # oracle (whose own callback is false) supplies an exact cached pose. diff --git a/tests/test_general_contact_enriched_skin.py b/tests/test_general_contact_enriched_skin.py index 6723a503f..b418cc89d 100644 --- a/tests/test_general_contact_enriched_skin.py +++ b/tests/test_general_contact_enriched_skin.py @@ -9,9 +9,9 @@ import pytest from examples.general_contact_enriched_patch import build -from anysolver.control import SolveCancelled -from anysolver.e4_pl_enriched import EnrichedProfileError -from anysolver.general_contact.enriched_static import MixedCriteria, IterationControl +from anyfesolver.control import SolveCancelled +from anyfesolver.e4_pl_enriched import EnrichedProfileError +from anyfesolver.general_contact.enriched_static import MixedCriteria, IterationControl @pytest.fixture(scope="module") diff --git a/tests/test_general_contact_enriched_small_cut.py b/tests/test_general_contact_enriched_small_cut.py index 8479e6c5d..c1da58b38 100644 --- a/tests/test_general_contact_enriched_small_cut.py +++ b/tests/test_general_contact_enriched_small_cut.py @@ -4,14 +4,14 @@ from fractions import Fraction import numpy as np import pytest -from anysolver._ge_beam3_mixed_ad import Jet2 -from anysolver.control import SolveCancelled -from anysolver.e4_pl_enriched import EnrichedProfileError -from anysolver.general_contact.enriched_overlap import QuadraturePolicy,EnrichedGeometryError -from anysolver.general_contact import enriched_small_cut as smallcut -from anysolver.general_contact import enriched_moment_batch as kernel -from anysolver.general_contact import enriched_union as scalar -from anysolver.general_contact.moment_batch_ad import PointJet +from anyfesolver._ge_beam3_mixed_ad import Jet2 +from anyfesolver.control import SolveCancelled +from anyfesolver.e4_pl_enriched import EnrichedProfileError +from anyfesolver.general_contact.enriched_overlap import QuadraturePolicy,EnrichedGeometryError +from anyfesolver.general_contact import enriched_small_cut as smallcut +from anyfesolver.general_contact import enriched_moment_batch as kernel +from anyfesolver.general_contact import enriched_union as scalar +from anyfesolver.general_contact.moment_batch_ad import PointJet POLICY=QuadraturePolicy(1e-10,1e-8,1e-5,14144) @@ -148,8 +148,8 @@ def test_input_topology_rounding_reconstruction_and_cancellation_refuse_without_ assert all(v==0 for row in coordinate.hessian for v in row) def _small(): - from anysolver import FEModel,BoundaryCondition,create_shell_element - from anysolver.general_contact.enriched_nonlinear import NonlinearEnrichedSystem,PairDefinition + from anyfesolver import FEModel,BoundaryCondition,create_shell_element + from anyfesolver.general_contact.enriched_nonlinear import NonlinearEnrichedSystem,PairDefinition model=FEModel('small_cut_ordinary_C0_oracle');model.add_material('elastic',1e5,.3,density=1.) source=((-0.5,-0.5,0.),(.5,-.5,0.),(.5,.5,0.),(-.5,.5,0.)) target=((-2.,-2.,-.2),(2.,-2.,-.2),(2.,2.,-.2),(-2.,2.,-.2)) @@ -214,7 +214,7 @@ def observed(*args,**kw): record_property('saved_capture_sha256',data['provenance_sha256']) def test_actual_owner_cancellation_mutation_and_accepted_checkpoint_are_atomic(monkeypatch): - from anysolver.general_contact.enriched_nonlinear import MixedCriteria,IterationControl + from anyfesolver.general_contact.enriched_nonlinear import MixedCriteria,IterationControl model,system=_small();system.solve(np.zeros(system.offset.size),criteria=MixedCriteria(.04,1e-6,1e-8),control=IterationControl(1,1)) accepted=system._accepted;checkpoint=system.checkpoint();entered=[];actual=kernel.selected_batch_moments def cancelled(*a,**kw): diff --git a/tests/test_general_contact_event_subdivision.py b/tests/test_general_contact_event_subdivision.py index fa2bd2409..8af39e479 100644 --- a/tests/test_general_contact_event_subdivision.py +++ b/tests/test_general_contact_event_subdivision.py @@ -7,9 +7,9 @@ import numpy as np import pytest -from anysolver.dynamics import TransientConfig -from anysolver.general_contact.event_subdivision import EventNeedsCutback, localize_branch_event -from anysolver.general_contact.transient import ContactNodalLoadHistory, ContactTransientSolverControls, solve_transient_contact +from anyfesolver.dynamics import TransientConfig +from anyfesolver.general_contact.event_subdivision import EventNeedsCutback, localize_branch_event +from anyfesolver.general_contact.transient import ContactNodalLoadHistory, ContactTransientSolverControls, solve_transient_contact from test_general_contact_transient_plane import _guided_s3_descriptor_impact, _uniform_s3_normal_load @@ -27,7 +27,7 @@ ((0,),1e-12,2e-10,0), ]) def test_resolved_boundary_requires_membership_and_both_dimensional_budgets(boundary,gap,elapsed,expected): - from anysolver.general_contact.transient import _event_continuation_segments + from anyfesolver.general_contact.transient import _event_continuation_segments first = SimpleNamespace(end=elapsed,active=(False,False)) second = SimpleNamespace(end=1.,active=(True,False)) path = SimpleNamespace(segments=(first,second)) @@ -39,8 +39,8 @@ def test_resolved_boundary_requires_membership_and_both_dimensional_budgets(boun @pytest.mark.parametrize('boundary', [[True],[0,0],[1,0],[-1],[3],'0']) def test_restart_rejects_malformed_boundary_even_with_valid_integrity(boundary): - from anysolver.general_contact.transient import _new_restart_checkpoint, _read_restart_checkpoint - from anysolver.nonlinear_restart import analysis_configuration_fingerprint + from anyfesolver.general_contact.transient import _new_restart_checkpoint, _read_restart_checkpoint + from anyfesolver.nonlinear_restart import analysis_configuration_fingerprint checkpoint = _new_restart_checkpoint('model','analysis',.01,[0.],[0.],[0.],1, path_terminal_active=(False,False,False),event_boundary_support=()) checkpoint['state']['event_boundary_support'] = boundary @@ -188,7 +188,7 @@ def solve(stop,checkpoint=None,emit=False): def test_restart_rejects_a_boundary_inconsistent_with_its_restored_geometry(): - from anysolver.nonlinear_restart import analysis_configuration_fingerprint + from anyfesolver.nonlinear_restart import analysis_configuration_fingerprint _,direct = _solve(.016) _,prefix = _solve(direct.localized_contact_event_times[0],emit=True) checkpoint = deepcopy(prefix.restart_checkpoint) @@ -208,7 +208,7 @@ def test_event_option_requires_path_and_dimensioned_budgets(): def test_exact_isolated_point_departure_is_not_discarded(monkeypatch): - import anysolver.general_contact.event_subdivision as events + import anyfesolver.general_contact.event_subdivision as events # Independent cubic roots .5,.75,1; exercise the isolator's exact-point # interface without relying on accidental floating-point subdivision ties. monkeypatch.setattr(events,'_root_intervals',lambda *a: ((.5,.5),(.75,.75),(1.,1.))) @@ -287,9 +287,9 @@ def test_public_event_history_preserves_independent_newmark_and_affine_load_work @pytest.mark.parametrize('cancel',[False,True]) def test_event_failure_or_cancellation_keeps_pre_event_commit_boundary(monkeypatch,cancel): - import anysolver.general_contact.transient as driver - from anysolver.control import CancellationToken, SolveCancelled - from anysolver.general_contact.core import active_contact_manager + import anyfesolver.general_contact.transient as driver + from anyfesolver.control import CancellationToken, SolveCancelled + from anyfesolver.general_contact.core import active_contact_manager commits = [] original = driver.commit_state_candidate def commit(*args,**kwargs): diff --git a/tests/test_general_contact_exact_seam_schur.py b/tests/test_general_contact_exact_seam_schur.py index 9b4278667..7f6e3365f 100644 --- a/tests/test_general_contact_exact_seam_schur.py +++ b/tests/test_general_contact_exact_seam_schur.py @@ -7,11 +7,11 @@ import numpy as np import pytest -from anysolver.general_contact import linearized_pivot -from anysolver.general_contact.linearized_pivot import ( +from anyfesolver.general_contact import linearized_pivot +from anyfesolver.general_contact.linearized_pivot import ( _exact_artificial_seam_gap_gradient, _jet2_integral_gradients, ) -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from scripts.general_contact_d1_coupled_refinement import build_case diff --git a/tests/test_general_contact_finite_automatic_selection_variants.py b/tests/test_general_contact_finite_automatic_selection_variants.py index d8aa5229e..70af08808 100644 --- a/tests/test_general_contact_finite_automatic_selection_variants.py +++ b/tests/test_general_contact_finite_automatic_selection_variants.py @@ -7,7 +7,7 @@ from dataclasses import replace from pathlib import Path -from anysolver.general_contact import ( +from anyfesolver.general_contact import ( AutomaticContactDomain, AutomaticContactDomainError, AutomaticContactParticipant, AutomaticContactResolution, ContactInteraction, RigidContactBody, resolve_automatic_contact_domain, verify_automatic_contact_resolution, diff --git a/tests/test_general_contact_finite_automatic_shell.py b/tests/test_general_contact_finite_automatic_shell.py index 7b4eaf64c..d93a0739d 100644 --- a/tests/test_general_contact_finite_automatic_shell.py +++ b/tests/test_general_contact_finite_automatic_shell.py @@ -7,11 +7,11 @@ import pytest import examples.general_contact_finite_automatic_shell as public from examples.general_contact_finite_automatic_shell import build,solve,rigid_pose,report_result -from anysolver.general_contact.automatic_domain import (AutomaticContactResolution,AutomaticContactDomain, +from anyfesolver.general_contact.automatic_domain import (AutomaticContactResolution,AutomaticContactDomain, AutomaticContactDomainError,resolve_automatic_contact_domain,verify_automatic_contact_resolution) -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.general_contact.semismooth import linearize,complementarity,reference_nodal_support -from anysolver.general_contact.finite_v2d_state import COORDINATES,owner_contract,prepare_v2d_states +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.semismooth import linearize,complementarity,reference_nodal_support +from anyfesolver.general_contact.finite_v2d_state import COORDINATES,owner_contract,prepare_v2d_states FREF=MREF=1e-4 def canonical(value):return json.loads(json.dumps(value)) @@ -27,7 +27,7 @@ def emit(name,value): def workflow_fresh(root):return json.loads((root/'fresh.json').read_text()) def require_saved_fixture(saved,model,domain,settings,resolution,program): - from anysolver.nonlinear_restart import model_configuration_fingerprint + from anyfesolver.nonlinear_restart import model_configuration_fingerprint public.require_report_identity(saved,model,domain,settings,resolution,program) assert saved['status']=='completed' assert saved['checkpoint']['model_fingerprint']==model_configuration_fingerprint(model) @@ -74,7 +74,7 @@ def test_resolution_refuses_tampering_even_resealed(kind): with pytest.raises(AutomaticContactDomainError):AutomaticContactResolution.from_dict(value) def test_existing_nonpositive_node_labels_refused_by_patch_admission(): - from anysolver import FEModel,create_shell_element + from anyfesolver import FEModel,create_shell_element original,domain,settings,_,_=build();model=FEModel('integer-label-copy') model.add_material('elastic',1e5,.3,density=1.) labels={nid:nid-5 for nid in original.mesh.nodes} @@ -175,7 +175,7 @@ def test_saved_complete_workflow_independent_skin_gap(): @pytest.mark.skipif(not os.environ.get('FINITE_AUTOMATIC_WORKFLOW'), reason='archived workflow input FINITE_AUTOMATIC_WORKFLOW absent: saved-fixture replay requires the original delivery root') def test_saved_actual_scaled_equilibrium_wrench_ncp_and_integration(): - from anysolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate + from anyfesolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate oracle=get_oracle() root=Path(os.environ['FINITE_AUTOMATIC_WORKFLOW']);saved=workflow_fresh(root) model,domain,settings,resolution,program=build();definition=resolution.definition;model.apply_boundary_conditions() @@ -277,11 +277,11 @@ def test_automatic_actual_cancellation_after_material_contact_trial(monkeypatch) model,domain,settings,resolution,program=build(saved_domain=prefix['automatic_domain'],saved_resolution=prefix['automatic_resolution']);definition=resolution.definition # Cancel only after actual structural/material AND contact trial work. # No response values, laws, state coordinates or controls are mocked. - from anysolver import CancellationToken,SolveCancelled + from anyfesolver import CancellationToken,SolveCancelled from examples.general_contact_finite_v2d_pair import json_value - import anysolver.general_contact.semismooth_path as increment - from anysolver.general_contact.runtime import _ACTIVE_CONTACT - from anysolver.nonlinear_restart import model_configuration_fingerprint + import anyfesolver.general_contact.semismooth_path as increment + from anyfesolver.general_contact.runtime import _ACTIVE_CONTACT + from anyfesolver.nonlinear_restart import model_configuration_fingerprint token=CancellationToken();captured={};input_bytes=json.dumps(prefix,sort_keys=True) before_model=model_configuration_fingerprint(model);before_context=_ACTIVE_CONTACT.get() assemble=increment._assemble_nonlinear_system;contact_call=increment.linearize @@ -411,7 +411,7 @@ def test_paired_checkpoint_refuses_different_fixed_automatic_selection(tmp_path) original=Path(os.environ['FINITE_AUTOMATIC_PAIRED_PREFIX']) paired=json.loads(original.read_text());before=original.read_bytes() model,domain,settings,resolution,program=build() - from anysolver.nonlinear_restart import model_configuration_fingerprint + from anyfesolver.nonlinear_restart import model_configuration_fingerprint assert paired['checkpoint']['model_fingerprint']==model_configuration_fingerprint(model) bare=tmp_path/'paired-checkpoint.json';domain_file=tmp_path/'domain.json';selection_file=tmp_path/'selection.json' bare.write_text(json.dumps(paired['checkpoint'],allow_nan=False)) diff --git a/tests/test_general_contact_finite_q4_v2d.py b/tests/test_general_contact_finite_q4_v2d.py index fc34ccfa2..e7ca4d60c 100644 --- a/tests/test_general_contact_finite_q4_v2d.py +++ b/tests/test_general_contact_finite_q4_v2d.py @@ -10,12 +10,12 @@ import pytest from importlib.util import spec_from_file_location,module_from_spec from examples.general_contact_finite_q4_v2d import build, solve, rigid_pose -from anysolver.general_contact.finite_mixed_state import ( +from anyfesolver.general_contact.finite_mixed_state import ( PROFILE, STATIC_PROFILE, COORDINATES, owner_contract, admitted_definition, mixed_state_contract, prepare_mixed_states, seal_mixed_states, ) -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.general_contact.semismooth import linearize, complementarity, reference_nodal_support +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.semismooth import linearize, complementarity, reference_nodal_support FREF=1e-4;MREF=1e-4 @@ -29,7 +29,7 @@ def get_oracle(): def require_saved_fixture(saved,model,definition,settings,program): from examples.general_contact_finite_q4_v2d import SCHEMA - from anysolver.nonlinear_restart import model_configuration_fingerprint + from anyfesolver.nonlinear_restart import model_configuration_fingerprint canonical=lambda v:json.loads(json.dumps(v)) assert saved['schema']==SCHEMA and saved['status']=='completed' fixture=saved['fixture'] @@ -101,14 +101,14 @@ def test_typed_contract_refuses_mutation(change): @pytest.mark.parametrize('change',('linear_skin','native_companion','orphan','shared_nodes','selected_pressure')) def test_mixed_admission_refuses_scope_change(change): - from anysolver import create_shell_element + from anyfesolver import create_shell_element model,definition,settings,_=build() if change=='linear_skin':settings=replace(settings,shell_skin_kinematics='reference_linear') elif change=='selected_pressure':settings=replace(settings,q4_source_pressure_basis='selected_q1_knots_dev',q4_source_pressure_knot_columns=(0,1)) elif change=='orphan':definition=replace(definition,surfaces=(definition.surfaces[0],replace(definition.surfaces[1],element_ids=(3,)))) elif change=='shared_nodes':model.mesh.elements[3].node_ids=(1,8,10) else: - from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement + from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement model.mesh.elements[3]=QualifiedE4PLS3ShellElement(3,(7,8,10),'elastic',thickness=.05, reference_normal=(0.,0.,1.)) assert type(model.mesh.elements[3]) is QualifiedE4PLS3ShellElement @@ -137,7 +137,7 @@ def test_in_cap_spatial_spin_is_not_additive_chart_work(): def test_actual_both_body_contact_and_structural_q_z_tangent(): - from anysolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate + from anyfesolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate model,definition,settings,_=build();manager=GeneralS3PatchManager(model,definition,settings) q=rigid_pose(model,.6);normal=np.array((math.sin(.6),0.,math.cos(.6))) for nid in range(1,7):q[model.mesh.dof_manager.get_node_dofs(nid)[:3]]-=2e-6*normal @@ -172,7 +172,7 @@ def structural(at,tangent): def test_typed_actual_owner_roundtrip_and_mutation(): - from anysolver.corotational import corotational_element_response + from anyfesolver.corotational import corotational_element_response model,*_=build();q=rigid_pose(model,.6);states={} for eid,element in model.mesh.elements.items(): dofs=element.get_dof_mapping(model.mesh) @@ -198,7 +198,7 @@ def test_typed_actual_owner_roundtrip_and_mutation(): def test_triangle_whole_path_refuses_crossing_and_preserves_state(): - from anysolver.general_contact.finite_rotation_sweep import finite_q4_path_admissible + from anyfesolver.general_contact.finite_rotation_sweep import finite_q4_path_admissible model,definition,settings,_=build();manager=GeneralS3PatchManager(model,definition,settings) start=np.zeros(60);end=start.copy() for nid in range(1,7):end[model.mesh.dof_manager.get_node_dofs(nid)[2]]=-1e-4 @@ -210,7 +210,7 @@ def test_triangle_whole_path_refuses_crossing_and_preserves_state(): def test_legacy_q4_profile_keeps_its_actual_manager(): from examples.general_contact_tilted_relative_sliding import build as old_build - from anysolver.general_contact.s3_patch_static import FINITE_Q4_Q4_MONOLITHIC_PROFILE + from anyfesolver.general_contact.s3_patch_static import FINITE_Q4_Q4_MONOLITHIC_PROFILE model,_,settings,resolution,_=old_build() manager=GeneralS3PatchManager(model,resolution.definition,settings) assert manager.profile==FINITE_Q4_Q4_MONOLITHIC_PROFILE @@ -218,7 +218,7 @@ def test_legacy_q4_profile_keeps_its_actual_manager(): def test_internal_diagonal_tie_retains_full_tangent_refusal(): - from anysolver.general_contact.q4_s3_overlap_derivatives import UnsupportedQ4S3Branch + from anyfesolver.general_contact.q4_s3_overlap_derivatives import UnsupportedQ4S3Branch model,definition,settings,_=build() for nid in range(1,7):model.mesh.nodes[nid].y-=.03 manager=GeneralS3PatchManager(model,definition,settings) @@ -257,7 +257,7 @@ def test_saved_complete_workflow_independent_skin_gap(): or not (Path(os.environ['FINITE_MIXED_WORKFLOW'])/'fresh.json').is_file(), reason='archived fresh.json workflow under FINITE_MIXED_WORKFLOW absent: saved scaled equilibrium/NCP/integration replay requires the saved poses and history') def test_saved_actual_scaled_equilibrium_wrench_ncp_and_integration(): - from anysolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate + from anyfesolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate oracle=get_oracle() root=Path(os.environ['FINITE_MIXED_WORKFLOW']);saved=json.loads((root/'fresh.json').read_text()) model,definition,settings,program=build();model.apply_boundary_conditions() @@ -361,11 +361,11 @@ def test_mixed_actual_cancellation_after_material_contact_trial(monkeypatch): model,definition,settings,program=build() # Cancel only after actual structural/material AND contact trial work. # No response values, laws, state coordinates or controls are mocked. - from anysolver import CancellationToken,SolveCancelled + from anyfesolver import CancellationToken,SolveCancelled from examples.general_contact_finite_q4_v2d import json_value - import anysolver.general_contact.semismooth_path as increment - from anysolver.general_contact.runtime import _ACTIVE_CONTACT - from anysolver.nonlinear_restart import model_configuration_fingerprint + import anyfesolver.general_contact.semismooth_path as increment + from anyfesolver.general_contact.runtime import _ACTIVE_CONTACT + from anyfesolver.nonlinear_restart import model_configuration_fingerprint token=CancellationToken();captured={};input_bytes=json.dumps(prefix,sort_keys=True) before_model=model_configuration_fingerprint(model);before_context=_ACTIVE_CONTACT.get() assemble=increment._assemble_nonlinear_system;contact_call=increment.linearize @@ -469,7 +469,7 @@ def validate_owner_records(checkpoint): reason='archived current-prefix15.json/fresh.json under FINITE_LEGACY_EVIDENCE absent: legacy installed suffix requires the saved legacy checkpoints') def test_legacy_q4_actual_installed_suffix(): from examples.general_contact_tilted_relative_sliding import build as legacy_build,solve as legacy_solve - from anysolver.general_contact.finite_rotation_state import COORDINATES as legacy_coordinates + from anyfesolver.general_contact.finite_rotation_state import COORDINATES as legacy_coordinates root=Path(os.environ['FINITE_LEGACY_EVIDENCE']) prefix=json.loads((root/'current-prefix15.json').read_text());fresh=json.loads((root/'fresh.json').read_text()) assert prefix['status']==fresh['status']=='completed' diff --git a/tests/test_general_contact_finite_rotation_shell_work.py b/tests/test_general_contact_finite_rotation_shell_work.py index 6692f0985..4ee8570dc 100644 --- a/tests/test_general_contact_finite_rotation_shell_work.py +++ b/tests/test_general_contact_finite_rotation_shell_work.py @@ -7,8 +7,8 @@ import numpy as np import pytest from examples.general_contact_finite_rotation_shell_work import build,solve,rigid_pose -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.general_contact.semismooth import linearize,complementarity,reference_nodal_support +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.semismooth import linearize,complementarity,reference_nodal_support FREF=1e-4;MREF=1e-4 def save(data): @@ -32,9 +32,9 @@ def decimal_director(theta,dref): def test_director_work_and_coupled_chart_jacobian(): - from anysolver.corotational import rotation_matrix_from_vector,_rotation_right_jacobian - from anysolver.general_contact.finite_rotation_skin import director_jets,director_value_error - from anysolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate + from anyfesolver.corotational import rotation_matrix_from_vector,_rotation_right_jacobian + from anyfesolver.general_contact.finite_rotation_skin import director_jets,director_value_error + from anyfesolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate model,domain,settings,res,program=build();manager=GeneralS3PatchManager(model,res.definition,settings) q=rigid_pose(model,math.pi/6.);normal=np.array((.5,0.,math.sqrt(3.)/2)) for n in range(1,7):q[model.mesh.dof_manager.get_node_dofs(n)[:3]]-=2e-6*normal @@ -64,7 +64,7 @@ def test_director_work_and_coupled_chart_jacobian(): work_error=abs(float(pulled@virtual-f.ravel()@(pose.coordinate_map@delta))) assert work_error<=1e-13 # Right multiplication by an axial reference drill leaves material skins. - from anysolver.corotational import rotation_vector_from_matrix + from anyfesolver.corotational import rotation_vector_from_matrix drill=q.copy() for i,dofs in enumerate(skin.dofs): qi=rotation_matrix_from_vector(q[dofs[3:]]) @@ -93,7 +93,7 @@ def structural(at,tangent): def test_nonaffine_path_curvature_and_unsafe_chord(): - from anysolver.general_contact.finite_rotation_skin import curvature_radius,director_norm_upper + from anyfesolver.general_contact.finite_rotation_skin import curvature_radius,director_norm_upper model,domain,settings,res,program=build();manager=GeneralS3PatchManager(model,res.definition,settings) a=np.zeros(manager.n_dof);safe=rigid_pose(model,math.pi/36.);unsafe=rigid_pose(model,math.pi/3.) skin=manager.finite_skin @@ -114,8 +114,8 @@ def test_nonaffine_path_curvature_and_unsafe_chord(): n=cross(sub(s[1],s[0]),sub(s[3],s[0]));numerator=dot(sub(s[0],t[0]),n) assert numerator<0 and numerator*numerator>F(float(5e-5))**2*dot(n,n) assert not manager._swept_admissible(a,unsafe) - from anysolver.general_contact.finite_rotation_sweep import finite_whole_pair_lower - from anysolver.general_contact.q4_q4_swept_bound import q4_q4_whole_pair_swept_lower + from anyfesolver.general_contact.finite_rotation_sweep import finite_whole_pair_lower + from anyfesolver.general_contact.q4_q4_swept_bound import q4_q4_whole_pair_swept_lower from examples.general_contact_finite_rotation_shell_work import rotation square=np.array(((0.,0.,0.),(1.,0.,0.),(1.,1.,0.),(0.,1.,0.))) r=rotation(math.pi/4.);tn=square@r.T;sn=tn-45e-6*(r@np.array((0.,0.,1.))) @@ -138,9 +138,9 @@ def test_installed_finite_path(monkeypatch): previous={1:None,4:1,8:4,12:8,13:12,14:13,15:14}[step] if stage=='run-1': import time,functools - import anysolver.general_contact.semismooth_path as owner - import anysolver.general_contact.static_path as path_owner - from anysolver.general_contact.s3_patch_augmented import MovingS3PatchProjectedNormal + import anyfesolver.general_contact.semismooth_path as owner + import anyfesolver.general_contact.static_path as path_owner + from anyfesolver.general_contact.s3_patch_augmented import MovingS3PatchProjectedNormal counters={};accepted=[];last={} diagnostic=Path(os.environ['AUTOMATIC_RUNTIME_RESULT']).with_name('diagnostic.json') def flush(): @@ -197,7 +197,7 @@ def snapshot(*args,**kw): reason='installed finite stage input FINITE_STAGE absent: saved finite-pose proof requires the original staged report and stage selection') def test_saved_finite_poses_independent_physical_gates(): from importlib.util import spec_from_file_location,module_from_spec - from anysolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate + from anyfesolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate spec=spec_from_file_location('_finite_pose_oracle',Path(__file__).parents[1]/'docs/d1_review_support/contact_finite_rotation_shell_work_20261008/oracle.py') oracle=module_from_spec(spec);spec.loader.exec_module(oracle) stage=os.environ['FINITE_STAGE'].removeprefix('proof-') @@ -268,10 +268,10 @@ def test_saved_finite_poses_independent_physical_gates(): def test_finite_state_and_translation_seed(): from scipy.sparse import eye - from anysolver.general_contact.finite_rotation_predictor import finite_rigid_seed - from anysolver.general_contact.finite_rotation_state import owner_local_coordinates,seal_finite_states,prepare_finite_states,finite_state_contract,COORDINATES,PROFILE - from anysolver.general_contact.static_path import ContactPathControl,ContactPathProgram - from anysolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate + from anyfesolver.general_contact.finite_rotation_predictor import finite_rigid_seed + from anyfesolver.general_contact.finite_rotation_state import owner_local_coordinates,seal_finite_states,prepare_finite_states,finite_state_contract,COORDINATES,PROFILE + from anyfesolver.general_contact.static_path import ContactPathControl,ContactPathProgram + from anyfesolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate model,domain,settings,res,program=build();n=model.mesh.dof_manager.total_dofs controls=tuple(ContactPathControl(((1,name,1.),),coordinate_profile='finite_shell_spin_chart_dev') for name in ('ux','uy','uz','rx','ry','rz')) shift=np.array((.001,-.002,.003));target=np.r_[shift,[0.,0.,0.]] @@ -287,7 +287,7 @@ def test_finite_state_and_translation_seed(): q=rigid_pose(model,math.pi/36.) r,k,trial=_assemble_nonlinear_system(model,q,{},5,tangent=False,kinematics='corotational',corotational_tangent='consistent',require_full_coordinates=True) # Materialize the actual owner's trial record using the normal state-store API. - from anysolver.nonlinear_static import _materialize_final_nonlinear_states + from anyfesolver.nonlinear_static import _materialize_final_nonlinear_states states=_materialize_final_nonlinear_states(trial,{}) info={};sealed=seal_finite_states(model,q,states,5,info) assert info['element_state_coordinates']==COORDINATES @@ -307,13 +307,13 @@ def test_finite_state_and_translation_seed(): def test_admission_and_restart_safety(monkeypatch): - from anysolver import CancellationToken,SolveCancelled + from anyfesolver import CancellationToken,SolveCancelled model,domain,settings,res,program=build();before=repr(model) token=CancellationToken();token.cancel('finite precancel') with pytest.raises(SolveCancelled):solve(model,settings,res,program,cancellation_token=token) assert repr(model)==before - from anysolver import BoundaryCondition - import anysolver.general_contact.static_path as path_owner + from anyfesolver import BoundaryCondition + import anyfesolver.general_contact.static_path as path_owner partial,_,ps,pr,pp=build() partial.add_boundary_condition(BoundaryCondition('unsupported-partial-spin',(3,),{'rx':0.})) material_calls=[] @@ -323,15 +323,15 @@ def no_material(*args,**kwargs):material_calls.append(True);raise AssertionError with pytest.raises(ValueError,match='all three constrained or all three free'): solve(partial,ps,pr,pp,max_load_factor=1/15.) assert not material_calls - from anysolver.general_contact.finite_rotation_state import prepare_finite_states,finite_state_contract,COORDINATES,PROFILE + from anyfesolver.general_contact.finite_rotation_state import prepare_finite_states,finite_state_contract,COORDINATES,PROFILE assert not finite_state_contract(dict(profile='unrelated',element_state_coordinates='another_coordinate_contract')) with pytest.raises(ValueError,match='exact named'):finite_state_contract(dict(profile='unrelated',element_state_coordinates=COORDINATES)) with pytest.raises(ValueError,match='coordinate/profile'):finite_state_contract(dict(profile=PROFILE,element_state_coordinates='global_q')) # Actual admitted legacy multi-beam public transient branch, before allocation. from examples.general_contact_multiple_beam_s3_transient import build as dynamic - from anysolver.dynamics import TransientConfig - from anysolver.general_contact.transient import solve_transient_contact,_admit,ContactTransientSolverControls - import anysolver.general_contact.multiple_beam_s3_transient as owner + from anyfesolver.dynamics import TransientConfig + from anyfesolver.general_contact.transient import solve_transient_contact,_admit,ContactTransientSolverControls + import anyfesolver.general_contact.multiple_beam_s3_transient as owner dm,dd,ds,velocity=dynamic();controls=ContactTransientSolverControls(allow_multiple_deformable_beam_s3_dev=True) assert _admit(dm,dd,ds,controls)==owner.PROFILE calls=[] @@ -346,7 +346,7 @@ def forbidden(*args,**kwargs):calls.append(True);raise AssertionError('allocatio @pytest.mark.skipif(not os.environ.get('AUTOMATIC_WORKFLOW_EVIDENCE') or not (Path(os.environ['AUTOMATIC_WORKFLOW_EVIDENCE'])/'run-1.json').is_file(), reason='archived finite input AUTOMATIC_WORKFLOW_EVIDENCE/run-1.json absent: restart-safety replay requires the original staged checkpoint') def test_archive_checkpoint_restart_safety(): - from anysolver.nonlinear_restart import _sha256,_checkpoint_without_hash + from anyfesolver.nonlinear_restart import _sha256,_checkpoint_without_hash model,domain,settings,res,program=build();stored=read('run-1');checkpoint=stored['checkpoint'];before=repr(model) changed=replace(program,waypoints=tuple([program.waypoints[0]]+[tuple(v+1e-8 if i==0 else v for i,v in enumerate(w)) for w in program.waypoints[1:]])) with pytest.raises(ValueError,match='incompatible'):solve(model,settings,res,changed,restart_checkpoint=checkpoint,max_load_factor=1/15.) @@ -363,7 +363,7 @@ def test_archive_checkpoint_restart_safety(): reason='archived legacy cycle output contact_q4_pair_monolithic_cycle_20261008/outputs/full.json absent: legacy identity checkpoint replay requires the original saved run') def test_legacy_default_identity_checkpoint(): from examples.general_contact_q4_pair_monolithic_cycle import build as legacy,solve as legacy_solve - from anysolver.general_contact.core import _contact_settings_contract + from anyfesolver.general_contact.core import _contact_settings_contract path=Path('C:/ANYworkspaceWork/contact_q4_pair_monolithic_cycle_20261008/outputs/full.json') stored=json.loads(path.read_text());model,domain,settings,res,program=legacy() assert res.identity==stored['identity'] and 'shell_skin_kinematics' not in _contact_settings_contract(settings) @@ -377,14 +377,14 @@ def test_legacy_default_identity_checkpoint(): reason='archived finite input AUTOMATIC_WORKFLOW_EVIDENCE/run-1.json absent: local-state binding replay requires the original staged checkpoint') def test_local_state_checkpoint_binding_discriminator(monkeypatch): model,domain,settings,res,program=build();checkpoint=copy.deepcopy(read('run-1')['checkpoint']) - from anysolver.nonlinear_restart import _sha256,_checkpoint_without_hash + from anyfesolver.nonlinear_restart import _sha256,_checkpoint_without_hash dof=model.mesh.dof_manager.get_node_dofs(3)[2] fixed=[model.mesh.dof_manager.get_node_dofs(n)[1] for n in (7,9)] free=np.setdiff1d(np.arange(model.mesh.dof_manager.total_dofs),fixed) checkpoint['displacements'][dof]+=1e-4 checkpoint['path_state']['reduced_coordinates'][int(np.flatnonzero(free==dof)[0])]+=1e-4 checkpoint['checkpoint_sha256']=_sha256(_checkpoint_without_hash(checkpoint)) - import anysolver.general_contact.static_path as owner + import anyfesolver.general_contact.static_path as owner calls=[] def forbidden(*args,**kwargs):calls.append(True);raise AssertionError('material activation before invalid local record refusal') monkeypatch.setattr(owner,'_activate_nonlinear_state_storage',forbidden) diff --git a/tests/test_general_contact_finite_v2d_pair.py b/tests/test_general_contact_finite_v2d_pair.py index 72daabe9b..4ecbd001d 100644 --- a/tests/test_general_contact_finite_v2d_pair.py +++ b/tests/test_general_contact_finite_v2d_pair.py @@ -10,12 +10,12 @@ import pytest from importlib.util import spec_from_file_location,module_from_spec from examples.general_contact_finite_v2d_pair import build, solve, rigid_pose -from anysolver.general_contact.finite_v2d_state import ( +from anyfesolver.general_contact.finite_v2d_state import ( PROFILE, STATIC_PROFILE, COORDINATES, owner_contract, admitted_definition, v2d_state_contract, prepare_v2d_states, seal_v2d_states, ) -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.general_contact.semismooth import linearize, complementarity, reference_nodal_support +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.semismooth import linearize, complementarity, reference_nodal_support FREF=1e-4;MREF=1e-4 @@ -33,7 +33,7 @@ def workflow_fresh(root): def require_saved_fixture(saved,model,definition,settings,program): from examples.general_contact_finite_v2d_pair import SCHEMA - from anysolver.nonlinear_restart import model_configuration_fingerprint + from anyfesolver.nonlinear_restart import model_configuration_fingerprint canonical=lambda v:json.loads(json.dumps(v)) assert saved['schema']==SCHEMA and saved['status']=='completed' fixture=saved['fixture'] @@ -106,14 +106,14 @@ def test_typed_contract_refuses_mutation(change): @pytest.mark.parametrize('change',('linear_skin','native_companion','orphan','shared_nodes','selected_pressure')) def test_mixed_admission_refuses_scope_change(change): - from anysolver import create_shell_element + from anyfesolver import create_shell_element model,definition,settings,_=build() if change=='linear_skin':settings=replace(settings,shell_skin_kinematics='reference_linear') elif change=='selected_pressure':settings=replace(settings,q4_source_pressure_basis='selected_q1_knots_dev',q4_source_pressure_knot_columns=(0,1)) elif change=='orphan':definition=replace(definition,surfaces=(definition.surfaces[0],replace(definition.surfaces[1],element_ids=(3,)))) elif change=='shared_nodes':model.mesh.elements[3].node_ids=(1,6,8) else: - from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement + from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement model.mesh.elements[3]=QualifiedE4PLS3ShellElement(3,(5,6,8),'elastic',thickness=.05, reference_normal=(0.,0.,1.)) assert type(model.mesh.elements[3]) is QualifiedE4PLS3ShellElement @@ -152,7 +152,7 @@ def test_in_cap_spatial_spin_is_not_additive_chart_work(): def test_actual_both_body_contact_and_structural_q_z_tangent(): - from anysolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate + from anyfesolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate model,definition,settings,_=build();manager=GeneralS3PatchManager(model,definition,settings) q=rigid_pose(model,.6);normal=np.array((math.sin(.6),0.,math.cos(.6))) for nid in range(1,5):q[model.mesh.dof_manager.get_node_dofs(nid)[:3]]-=2e-6*normal @@ -187,7 +187,7 @@ def structural(at,tangent): def test_typed_actual_owner_roundtrip_and_mutation(): - from anysolver.corotational import corotational_element_response + from anyfesolver.corotational import corotational_element_response model,*_=build();q=rigid_pose(model,.6);states={} for eid,element in model.mesh.elements.items(): dofs=element.get_dof_mapping(model.mesh) @@ -213,7 +213,7 @@ def test_typed_actual_owner_roundtrip_and_mutation(): def test_triangle_whole_path_refuses_crossing_and_preserves_state(): - from anysolver.general_contact.finite_rotation_sweep import finite_q4_path_admissible + from anyfesolver.general_contact.finite_rotation_sweep import finite_q4_path_admissible model,definition,settings,_=build();manager=GeneralS3PatchManager(model,definition,settings) start=np.zeros(48);end=start.copy() for nid in range(1,5):end[model.mesh.dof_manager.get_node_dofs(nid)[2]]=-1e-4 @@ -225,7 +225,7 @@ def test_triangle_whole_path_refuses_crossing_and_preserves_state(): def test_legacy_q4_profile_keeps_its_actual_manager(): from examples.general_contact_tilted_relative_sliding import build as old_build - from anysolver.general_contact.s3_patch_static import FINITE_Q4_Q4_MONOLITHIC_PROFILE + from anyfesolver.general_contact.s3_patch_static import FINITE_Q4_Q4_MONOLITHIC_PROFILE model,_,settings,resolution,_=old_build() manager=GeneralS3PatchManager(model,resolution.definition,settings) assert manager.profile==FINITE_Q4_Q4_MONOLITHIC_PROFILE @@ -233,7 +233,7 @@ def test_legacy_q4_profile_keeps_its_actual_manager(): def test_internal_diagonal_tie_retains_full_tangent_refusal(): - from anysolver.general_contact.s3_overlap_derivatives import UnsupportedOverlapBranch + from anyfesolver.general_contact.s3_overlap_derivatives import UnsupportedOverlapBranch model,definition,settings,_=build() for nid in range(1,5):model.mesh.nodes[nid].y-=.03 manager=GeneralS3PatchManager(model,definition,settings) @@ -270,7 +270,7 @@ def test_saved_complete_workflow_independent_skin_gap(): @pytest.mark.skipif(not os.environ.get('FINITE_V2D_WORKFLOW'), reason='archived workflow input FINITE_V2D_WORKFLOW absent: saved-fixture replay requires the original delivery root') def test_saved_actual_scaled_equilibrium_wrench_ncp_and_integration(): - from anysolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate + from anyfesolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate oracle=get_oracle() root=Path(os.environ['FINITE_V2D_WORKFLOW']);saved=workflow_fresh(root) model,definition,settings,program=build();model.apply_boundary_conditions() @@ -373,11 +373,11 @@ def test_mixed_actual_cancellation_after_material_contact_trial(monkeypatch): model,definition,settings,program=build() # Cancel only after actual structural/material AND contact trial work. # No response values, laws, state coordinates or controls are mocked. - from anysolver import CancellationToken,SolveCancelled + from anyfesolver import CancellationToken,SolveCancelled from examples.general_contact_finite_v2d_pair import json_value - import anysolver.general_contact.semismooth_path as increment - from anysolver.general_contact.runtime import _ACTIVE_CONTACT - from anysolver.nonlinear_restart import model_configuration_fingerprint + import anyfesolver.general_contact.semismooth_path as increment + from anyfesolver.general_contact.runtime import _ACTIVE_CONTACT + from anyfesolver.nonlinear_restart import model_configuration_fingerprint token=CancellationToken();captured={};input_bytes=json.dumps(prefix,sort_keys=True) before_model=model_configuration_fingerprint(model);before_context=_ACTIVE_CONTACT.get() assemble=increment._assemble_nonlinear_system;contact_call=increment.linearize @@ -486,7 +486,7 @@ def test_saved_release_strict_positive_physical_opening(): def test_nonaffine_triangle_sweep_refuses_hidden_director_crossing(): - from anysolver.general_contact.finite_rotation_sweep import finite_q4_path_admissible + from anyfesolver.general_contact.finite_rotation_sweep import finite_q4_path_admissible model,definition,settings,_=build();manager=GeneralS3PatchManager(model,definition,settings) alpha=.09;h=-.035;initial_gap=2e-7;end_gap=2e-5 # Both endpoints are prescribed safe analytically; the bottom skin has its @@ -508,7 +508,7 @@ def test_nonaffine_triangle_sweep_refuses_hidden_director_crossing(): def test_affected_mixed_profile_admission_unchanged(): from examples.general_contact_finite_q4_v2d import build as old_build - from anysolver.general_contact.finite_mixed_state import STATIC_PROFILE as old_profile + from anyfesolver.general_contact.finite_mixed_state import STATIC_PROFILE as old_profile model,definition,settings,_=old_build();manager=GeneralS3PatchManager(model,definition,settings) assert manager.profile==old_profile @@ -517,7 +517,7 @@ def test_affected_mixed_profile_admission_unchanged(): reason='archived legacy evidence input FINITE_V2D_LEGACY_EVIDENCE absent: installed legacy suffix replay requires the original evidence root') def test_affected_q4_v2d_actual_installed_suffix(): from examples.general_contact_finite_q4_v2d import build as old_build,solve as old_solve,report_result - from anysolver.general_contact.finite_mixed_state import COORDINATES as old_coordinates,prepare_mixed_states,owner_contract as old_owners + from anyfesolver.general_contact.finite_mixed_state import COORDINATES as old_coordinates,prepare_mixed_states,owner_contract as old_owners root=Path(os.environ['FINITE_V2D_LEGACY_EVIDENCE']) prefix=json.loads((root/'prefix.json').read_text());fresh=json.loads((root/'fresh.json').read_text()) assert prefix['status']==fresh['status']=='completed' @@ -580,7 +580,7 @@ def enclosed(manager,positions,*,endpoint_errors=None): @pytest.mark.parametrize('lower',(-float('inf'),float('inf'),float('nan'),1.25e-5)) def test_unresolved_gap_diagnostic_retains_strict_json_refusal(lower): from types import SimpleNamespace - from anysolver.general_contact.semismooth_path import _proposal_gap_diagnostic + from anyfesolver.general_contact.semismooth_path import _proposal_gap_diagnostic manager=SimpleNamespace(point_gap_lower=lambda displacement:lower) diagnostic=_proposal_gap_diagnostic(manager,np.zeros(48)) payload=json.loads(json.dumps(dict(status='NONPASS',contact_failure=diagnostic),allow_nan=False)) diff --git a/tests/test_general_contact_finite_v2d_rigid_patch.py b/tests/test_general_contact_finite_v2d_rigid_patch.py index 28a4bda4c..e91020912 100644 --- a/tests/test_general_contact_finite_v2d_rigid_patch.py +++ b/tests/test_general_contact_finite_v2d_rigid_patch.py @@ -5,8 +5,8 @@ import numpy as np import pytest from examples.general_contact_finite_v2d_rigid_patch import build,solve,fixture,json_value,report_result -from anysolver.general_contact.finite_rigid_patch import FiniteRigidPatchManager,PROFILE,admitted_definition -from anysolver.general_contact.finite_rigid_support import slab_support_and_ownership,tool_normal_gap_lower +from anyfesolver.general_contact.finite_rigid_patch import FiniteRigidPatchManager,PROFILE,admitted_definition +from anyfesolver.general_contact.finite_rigid_support import slab_support_and_ownership,tool_normal_gap_lower def oracle(): @@ -36,7 +36,7 @@ def test_refuse_unsupported_owner_or_settings(kind): from dataclasses import replace m,d,s,p,q=build() if kind=='native': - from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement + from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement old=m.mesh.elements[1] m.mesh.elements[1]=QualifiedE4PLS3ShellElement(1,old.node_ids,'elastic',thickness=.05,reference_normal=(0.,0.,1.)) elif kind=='affine':s=replace(s,shell_skin_kinematics='reference_linear') @@ -116,7 +116,7 @@ def fresh(): or not Path(os.environ['FINITE_RIGID_FRESH']).is_file(), reason='archived fresh run under FINITE_RIGID_FRESH absent: saved gap/wrench/penalty/integration assessment requires the saved accepted suffix and history') def test_saved_independent_gap_equilibrium_wrench_penalty_and_integration(): - from anysolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate,_weighted_external_load_system + from anyfesolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate,_weighted_external_load_system m,d,s,p,seed=build();m.apply_boundary_conditions();data=fresh();assert data['fixture']==json_value(fixture(m,d,s,p,seed)) poses=data['accepted_suffix'];rows=data['history'];assert len(poses)==len(rows)>0 assert [v['step_index'] for v in poses]==[v['step_index'] for v in rows]==list(range(1,len(poses)+1)) @@ -165,7 +165,7 @@ def test_saved_independent_gap_equilibrium_wrench_penalty_and_integration(): @pytest.mark.parametrize('prefix_name,start_factor',(('active-prefix2.json',2.),('open-prefix.json',3.))) def test_actual_active_and_open_restart(prefix_name,start_factor): - from anysolver.general_contact.finite_v2d_state import prepare_v2d_states + from anyfesolver.general_contact.finite_v2d_state import prepare_v2d_states from examples.general_contact_finite_v2d_rigid_patch import main fresh_path=os.environ.get('FINITE_RIGID_FRESH') if not fresh_path or not Path(fresh_path).is_file(): @@ -248,9 +248,9 @@ def test_exact_artificial_diagonal_touch_stays_visible_conservative_refusal(): or not (Path(os.environ['FINITE_RIGID_WORKFLOW'])/'open-prefix.json').is_file(), reason='archived open-prefix.json under FINITE_RIGID_WORKFLOW absent: material/contact cancellation rollback requires the saved prefix checkpoint') def test_actual_cancellation_after_contact_and_material_trial(monkeypatch): - from anysolver import CancellationToken,SolveCancelled - import anysolver.nonlinear_static as driver - from anysolver.general_contact.core import _ACTIVE_CONTACT + from anyfesolver import CancellationToken,SolveCancelled + import anyfesolver.nonlinear_static as driver + from anyfesolver.general_contact.core import _ACTIVE_CONTACT root=Path(os.environ['FINITE_RIGID_WORKFLOW']);prefix=json.loads((root/'open-prefix.json').read_text()) m,d,s,p,q=build();token=CancellationToken();before=json.dumps(prefix,sort_keys=True);context=_ACTIVE_CONTACT.get();observed={} assembly=driver._assemble_nonlinear_system_unchecked;evaluate=FiniteRigidPatchManager.evaluate @@ -276,13 +276,13 @@ def contact(manager,*args,**kwargs): or not Path(os.environ['FINITE_RIGID_FRESH']).is_file(), reason='archived fresh run under FINITE_RIGID_FRESH absent: owner-mutation and corrupt rich checkpoint refusals require the saved checkpoint and fixture') def test_actual_checkpoint_owner_mutation_and_null_input_refused(monkeypatch,tmp_path): - from anysolver.general_contact.finite_v2d_state import prepare_v2d_states + from anyfesolver.general_contact.finite_v2d_state import prepare_v2d_states from examples.general_contact_finite_v2d_rigid_patch import main,SCHEMA data=fresh();m,d,s,p,q=build();cp=data['checkpoint'];states={v['element_id']:copy.deepcopy(v['state']) for v in cp['element_states']} states[1]['committed_total_u'][0]+=1e-4 with pytest.raises((ValueError,TypeError)):prepare_v2d_states(m,np.asarray(cp['displacements']),states,5,{},restart=True) - import anysolver.nonlinear_static as driver - from anysolver.general_contact.core import _ACTIVE_CONTACT + import anyfesolver.nonlinear_static as driver + from anyfesolver.general_contact.core import _ACTIVE_CONTACT context=_ACTIVE_CONTACT.get();assembly=driver._assemble_nonlinear_system_unchecked corrupted=copy.deepcopy(data);corrupted['checkpoint']['element_states'][0]['state']['committed_total_u'][0]+=1e-4 bad_owner=tmp_path/'corrupt-owner.json';bad_owner.write_text(json.dumps(corrupted,allow_nan=False)) @@ -331,8 +331,8 @@ def test_spatial_spin_additive_chart_work_counterexample_one_radian(): def test_actual_public_entry_selects_only_admitted_ordinary_finite_profile(monkeypatch): - import anysolver.nonlinear_static as driver - from anysolver.general_contact.core import active_contact_manager + import anyfesolver.nonlinear_static as driver + from anyfesolver.general_contact.core import active_contact_manager from dataclasses import replace m,d,s,p,q=build();seen=[] class ReachedOrdinaryOwner(Exception):pass diff --git a/tests/test_general_contact_fixed_projection_active_path.py b/tests/test_general_contact_fixed_projection_active_path.py index 61c002c5a..a3bb6df5d 100644 --- a/tests/test_general_contact_fixed_projection_active_path.py +++ b/tests/test_general_contact_fixed_projection_active_path.py @@ -5,8 +5,8 @@ import numpy as np import pytest -from anysolver import solve_static_nonlinear, validate_general_contact -from anysolver.general_contact.s3_patch_static import ( +from anyfesolver import solve_static_nonlinear, validate_general_contact +from anyfesolver.general_contact.s3_patch_static import ( REFINED_Q4_S3_GRAPH_AUGMENTED_PROFILE, ) from examples.general_contact_fixed_projection_skew import ( diff --git a/tests/test_general_contact_fixed_projection_graph.py b/tests/test_general_contact_fixed_projection_graph.py index b1fbb0cf1..94f8eaaff 100644 --- a/tests/test_general_contact_fixed_projection_graph.py +++ b/tests/test_general_contact_fixed_projection_graph.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver.general_contact.fixed_projection_graph import ( +from anyfesolver.general_contact.fixed_projection_graph import ( fixed_projection_graph_swept_certificate, ) diff --git a/tests/test_general_contact_fixed_projection_route.py b/tests/test_general_contact_fixed_projection_route.py index 2645f49e1..c0dae1fe8 100644 --- a/tests/test_general_contact_fixed_projection_route.py +++ b/tests/test_general_contact_fixed_projection_route.py @@ -6,14 +6,14 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactPathControl, ContactPathProgram, solve_static_nonlinear, validate_general_contact, ) -from anysolver.general_contact.s3_patch_static import ( +from anyfesolver.general_contact.s3_patch_static import ( GeneralS3PatchManager, REFINED_Q4_S3_GRAPH_AUGMENTED_PROFILE, ) -from anysolver.general_contact.static_path import ( +from anyfesolver.general_contact.static_path import ( GENERAL_Q4_S3_PATCH_REFINED_GRAPH_AUGMENTED_PROFILE, ) from test_general_contact_skew_partial_work import _case diff --git a/tests/test_general_contact_fixed_projection_s3_events.py b/tests/test_general_contact_fixed_projection_s3_events.py index 6d29ffbe0..26c1c3599 100644 --- a/tests/test_general_contact_fixed_projection_s3_events.py +++ b/tests/test_general_contact_fixed_projection_s3_events.py @@ -4,11 +4,11 @@ import numpy as np import pytest from scipy import sparse -from anysolver import FEModel,create_shell_element,ContactSurface,ContactDefinition,ContactInteraction -from anysolver.general_contact.core import ContactSolverSettings -from anysolver.general_contact.fixed_projection_s3_events import prepare_fixed_projection_s3_events -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.general_contact.shell_pair_hermite_sweep import shell_pair_hermite_lower +from anyfesolver import FEModel,create_shell_element,ContactSurface,ContactDefinition,ContactInteraction +from anyfesolver.general_contact.core import ContactSolverSettings +from anyfesolver.general_contact.fixed_projection_s3_events import prepare_fixed_projection_s3_events +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.shell_pair_hermite_sweep import shell_pair_hermite_lower GAP=.0002;KN=3.e8 SUPPORT=np.array([1/3,1/6,1/3,1/6]) diff --git a/tests/test_general_contact_force_augmented.py b/tests/test_general_contact_force_augmented.py index 52e139d60..90fa3cbfb 100644 --- a/tests/test_general_contact_force_augmented.py +++ b/tests/test_general_contact_force_augmented.py @@ -4,7 +4,7 @@ import numpy as np -from anysolver import BoundaryCondition, LoadCase, solve_static_nonlinear +from anyfesolver import BoundaryCondition, LoadCase, solve_static_nonlinear from test_general_contact_s3_patch_augmented import _augmented_case diff --git a/tests/test_general_contact_friction_point.py b/tests/test_general_contact_friction_point.py index 9624a4f72..5bae4df7d 100644 --- a/tests/test_general_contact_friction_point.py +++ b/tests/test_general_contact_friction_point.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver.general_contact.friction_point import ( +from anyfesolver.general_contact.friction_point import ( FrictionPointState, initial_friction_point, objective_relative_tangent_increment, trial_coulomb_point, trial_coulomb_point_directional, @@ -18,7 +18,7 @@ def test_frame_validation_reuse_rechecks_changed_bytes_and_does_not_share_arrays(): - from anysolver.general_contact.friction_point import _frame3, _validate_frame_bytes + from anyfesolver.general_contact.friction_point import _frame3, _validate_frame_bytes _validate_frame_bytes.cache_clear() frame=np.eye(3) assert _frame3(frame) is frame diff --git a/tests/test_general_contact_guided_pair_transient_geometry.py b/tests/test_general_contact_guided_pair_transient_geometry.py index f552e7ac3..1bad5c2e5 100644 --- a/tests/test_general_contact_guided_pair_transient_geometry.py +++ b/tests/test_general_contact_guided_pair_transient_geometry.py @@ -7,13 +7,13 @@ import pytest from scipy import sparse -from anysolver import create_shell_element -from anysolver.fe_core import FEModel -from anysolver.general_contact.core import ( +from anyfesolver import create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.core import ( ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, ) -from anysolver.general_contact.pair import _PlanarShellPairManager -from anysolver.general_contact.guided_pair_transient_geometry import ( +from anyfesolver.general_contact.pair import _PlanarShellPairManager +from anyfesolver.general_contact.guided_pair_transient_geometry import ( guided_shell_pair_path_minimum_gap, prepare_guided_shell_pair_transient, ) diff --git a/tests/test_general_contact_hemisphere_cylinder_motion.py b/tests/test_general_contact_hemisphere_cylinder_motion.py index 6585f5b9c..99a176115 100644 --- a/tests/test_general_contact_hemisphere_cylinder_motion.py +++ b/tests/test_general_contact_hemisphere_cylinder_motion.py @@ -5,10 +5,10 @@ import numpy as np import pytest from scipy.optimize import root -from anysolver import (LoadCase, DisplacementControl, CancellationToken, SolveCancelled, +from anyfesolver import (LoadCase, DisplacementControl, CancellationToken, SolveCancelled, solve_static_nonlinear, validate_general_contact, report_general_contact_capability) -from anysolver.general_contact.beam_hemisphere_cylinder import HemisphereCylinderManager -from anysolver.general_contact.beam_hemisphere_cylinder_motion import ( +from anyfesolver.general_contact.beam_hemisphere_cylinder import HemisphereCylinderManager +from anyfesolver.general_contact.beam_hemisphere_cylinder_motion import ( TranslatingHemisphereCylinderManager, PROFILE) from test_general_contact_hemisphere_cylinder_static import ( _bar_case, _support_case, _line_reference, _potential) diff --git a/tests/test_general_contact_hemisphere_cylinder_static.py b/tests/test_general_contact_hemisphere_cylinder_static.py index 6975ebe5c..b96ca4504 100644 --- a/tests/test_general_contact_hemisphere_cylinder_static.py +++ b/tests/test_general_contact_hemisphere_cylinder_static.py @@ -18,15 +18,15 @@ from scipy.integrate import quad from scipy.optimize import brentq, root -from anysolver import (BoundaryCondition, CancellationToken, DisplacementControl, +from anyfesolver import (BoundaryCondition, CancellationToken, DisplacementControl, LoadCase, RigidContactBody, SolveCancelled, report_general_contact_capability, solve_static_nonlinear, validate_general_contact) -from anysolver.elements import QuadraticBeamElement -from anysolver.general_contact.beam_hemisphere_cylinder import ( +from anyfesolver.elements import QuadraticBeamElement +from anyfesolver.general_contact.beam_hemisphere_cylinder import ( HemisphereCylinderManager, PROFILE, ) -from anysolver.general_contact.beam_radial_ends import PROFILE as LEGACY_PROFILE +from anyfesolver.general_contact.beam_radial_ends import PROFILE as LEGACY_PROFILE from test_general_contact_hemisphere_cylinder_work import _reference from test_general_contact_radial_beam_ends import _case, _static @@ -331,7 +331,7 @@ def test_explicit_profile_fixed_descriptor_and_no_application_admission(): assert not capability.tested and not capability.independently_accepted and not capability.released assert validate_general_contact(model, definition, replace(settings, beam_end_cap_work="owned_point")).profile == LEGACY_PROFILE moving = replace(definition, rigid_bodies=(replace(definition.rigid_bodies[0], path_translation=(0.001, 0., 0.)),)) - from anysolver.general_contact.beam_hemisphere_cylinder_motion import PROFILE as MOVING_PROFILE + from anyfesolver.general_contact.beam_hemisphere_cylinder_motion import PROFILE as MOVING_PROFILE assert validate_general_contact(model, moving, settings).profile == MOVING_PROFILE assert validate_general_contact(model, moving, settings).valid with pytest.raises(ValueError, match="fixed infinite cylinder|unsupported"): diff --git a/tests/test_general_contact_hemisphere_cylinder_work.py b/tests/test_general_contact_hemisphere_cylinder_work.py index cb163024d..0ebbc94ee 100644 --- a/tests/test_general_contact_hemisphere_cylinder_work.py +++ b/tests/test_general_contact_hemisphere_cylinder_work.py @@ -12,10 +12,10 @@ from numpy.testing import assert_allclose from scipy.optimize import minimize_scalar -from anysolver.general_contact.beam_hemisphere_cylinder_work import ( +from anyfesolver.general_contact.beam_hemisphere_cylinder_work import ( hemisphere_cylinder_work, ) -from anysolver.general_contact.beam_hemisphere_support import ( +from anyfesolver.general_contact.beam_hemisphere_support import ( HemispherePlaneGeometryError, ) diff --git a/tests/test_general_contact_hemisphere_plane.py b/tests/test_general_contact_hemisphere_plane.py index c10bce994..eafecd89a 100644 --- a/tests/test_general_contact_hemisphere_plane.py +++ b/tests/test_general_contact_hemisphere_plane.py @@ -4,10 +4,10 @@ import numpy as np import pytest from scipy.optimize import brentq -from anysolver import (BoundaryCondition, LoadCase, solve_static_nonlinear, +from anyfesolver import (BoundaryCondition, LoadCase, solve_static_nonlinear, validate_general_contact, DisplacementControl, CancellationToken, SolveCancelled) -from anysolver.general_contact.beam_hemisphere_support import hemisphere_plane_work -from anysolver.general_contact.beam_hemisphere_plane import HemispherePlaneManager, PROFILE +from anyfesolver.general_contact.beam_hemisphere_support import hemisphere_plane_work +from anyfesolver.general_contact.beam_hemisphere_plane import HemispherePlaneManager, PROFILE from test_general_contact_beam_plane import _model @@ -294,9 +294,9 @@ def test_common_rigid_transform_and_connectivity_invariance(quadratic): def test_runnable_example_capability_and_transient_rejection(): from examples.general_contact_hemisphere_plane import run - from anysolver import report_general_contact_capability - from anysolver.dynamics import TransientConfig - from anysolver.general_contact.transient import solve_transient_contact, ContactTransientSolverControls + from anyfesolver import report_general_contact_capability + from anyfesolver.dynamics import TransientConfig + from anyfesolver.general_contact.transient import solve_transient_contact, ContactTransientSolverControls result=run() assert result.status=='completed' and result.info['general_contact']['profile']==PROFILE model,definition,settings=_support_model() diff --git a/tests/test_general_contact_hemisphere_sphere.py b/tests/test_general_contact_hemisphere_sphere.py index dc7a12ea8..f8de08da2 100644 --- a/tests/test_general_contact_hemisphere_sphere.py +++ b/tests/test_general_contact_hemisphere_sphere.py @@ -7,17 +7,17 @@ import numpy as np import pytest from scipy.optimize import minimize_scalar, brentq -from anysolver import (BoundaryCondition, LoadCase, DisplacementControl, +from anyfesolver import (BoundaryCondition, LoadCase, DisplacementControl, CancellationToken, SolveCancelled, solve_static_nonlinear, validate_general_contact, report_general_contact_capability) -from anysolver.general_contact.beam_hemisphere_sphere_work import hemisphere_sphere_work -from anysolver.general_contact.beam_hemisphere_sphere import HemisphereSphereManager, PROFILE -from anysolver.general_contact.beam_radial_ends import BeamRadialEndManager +from anyfesolver.general_contact.beam_hemisphere_sphere_work import hemisphere_sphere_work +from anyfesolver.general_contact.beam_hemisphere_sphere import HemisphereSphereManager, PROFILE +from anyfesolver.general_contact.beam_radial_ends import BeamRadialEndManager from test_general_contact_radial_beam_ends import _case, _static def test_full_radius_bound_preserves_exact_sum_of_literal_radii(): - from anysolver.general_contact.beam_end_radial_geometry import curve_gap_lower + from anyfesolver.general_contact.beam_end_radial_geometry import curve_gap_lower f=Fraction.from_float radius=f(.01)+f(.1);point=f(.11) lower=curve_gap_lower(((point,point),(Fraction(0),Fraction(0)),(Fraction(0),Fraction(0))),radius,1e-6,16) @@ -156,7 +156,7 @@ def test_active_seam_sweep_keeps_complete_cap_work_and_legacy_rejection(): def test_material_junction_and_b3_midnode_are_not_caps(): - from anysolver.elements import QuadraticBeamElement + from anyfesolver.elements import QuadraticBeamElement model,definition,settings=support_case(True) model.add_node(10,.112,-.1,0.);model.add_node(11,.112,.1,0.) model.add_element(2,QuadraticBeamElement(2,(10,1,11),'elastic', @@ -232,7 +232,7 @@ def balance(delta): second=replace(definition.rigid_bodies[0],name='other',point=(1.,0.,0.)) multi=replace(definition,rigid_bodies=(*definition.rigid_bodies,second),interactions=( *definition.interactions,replace(definition.interactions[0],name='other pair',target='other'))) - from anysolver.general_contact.multiple_beam_rigid import PROFILE_SUPPORT_ANALYTIC, MultipleBeamRigidManager + from anyfesolver.general_contact.multiple_beam_rigid import PROFILE_SUPPORT_ANALYTIC, MultipleBeamRigidManager assert validate_general_contact(model,multi,settings).profile==PROFILE_SUPPORT_ANALYTIC assert all(isinstance(child,HemisphereSphereManager) for _,child in MultipleBeamRigidManager(model,multi,settings).pairs) record=os.environ.get('CONTACT_APP_RESULT_RECORD') diff --git a/tests/test_general_contact_hermite_exact_split.py b/tests/test_general_contact_hermite_exact_split.py index 900e11de2..97e1f34b1 100644 --- a/tests/test_general_contact_hermite_exact_split.py +++ b/tests/test_general_contact_hermite_exact_split.py @@ -14,7 +14,7 @@ from fractions import Fraction -from anysolver.general_contact.shell_pair_hermite_sweep import ( +from anyfesolver.general_contact.shell_pair_hermite_sweep import ( _split, shell_pair_hermite_lower) @@ -84,7 +84,7 @@ def test_split_recursive_tree_matches_oracle(): target_v0=np.full((4, 3), .02), target_v1=np.full((4, 3), -.02), dt=0.013) # Build the same flat polynomial tuple the sweep subdivides. - from anysolver.general_contact import shell_pair_hermite_sweep as module + from anyfesolver.general_contact import shell_pair_hermite_sweep as module coords = lambda v: tuple(tuple(Fraction(float(x)) for x in row) for row in v) a = module._nodes(coords(a0), coords(a1), coords(data['source_v0']), coords(data['source_v1']), Fraction(0.013)) @@ -171,7 +171,7 @@ def subdividing_path(): def test_sweep_result_is_unchanged_on_subdividing_case(monkeypatch): """Compare the complete caller certificate with original arithmetic.""" - import anysolver.general_contact.shell_pair_hermite_sweep as sweep + import anyfesolver.general_contact.shell_pair_hermite_sweep as sweep data = subdividing_path() result = sweep.shell_pair_hermite_lower(gap_tolerance_m=0., **data) assert result.success and result.visited_panels > 1 @@ -181,7 +181,7 @@ def test_sweep_result_is_unchanged_on_subdividing_case(monkeypatch): def test_sweep_cancellation_and_budget_refusals_are_unchanged(monkeypatch): - import anysolver.general_contact.shell_pair_hermite_sweep as sweep + import anyfesolver.general_contact.shell_pair_hermite_sweep as sweep data = subdividing_path() cancelled = sweep.shell_pair_hermite_lower(cancel=lambda: True, **data) assert cancelled.status == 'cancelled' and not cancelled.success diff --git a/tests/test_general_contact_initial_seed_admission_capture.py b/tests/test_general_contact_initial_seed_admission_capture.py index 20e7e93e0..b0117ae52 100644 --- a/tests/test_general_contact_initial_seed_admission_capture.py +++ b/tests/test_general_contact_initial_seed_admission_capture.py @@ -29,9 +29,9 @@ import numpy as np import pytest -from anysolver.control import SolveCancelled -from anysolver.general_contact import semismooth_path -from anysolver.general_contact.core import _contact_settings_contract +from anyfesolver.control import SolveCancelled +from anyfesolver.general_contact import semismooth_path +from anyfesolver.general_contact.core import _contact_settings_contract from test_general_contact_admission_globalization_driver_small_patch import ( _case, diff --git a/tests/test_general_contact_initial_seed_coupled_prefix.py b/tests/test_general_contact_initial_seed_coupled_prefix.py index 64a4fb9c0..a13420817 100644 --- a/tests/test_general_contact_initial_seed_coupled_prefix.py +++ b/tests/test_general_contact_initial_seed_coupled_prefix.py @@ -32,7 +32,7 @@ import numpy as np import pytest -from anysolver.control import SolveCancelled +from anyfesolver.control import SolveCancelled from test_general_contact_admission_globalization_driver_small_patch import ( _CHECKPOINT_HASH_KEY, diff --git a/tests/test_general_contact_initial_seed_eligibility.py b/tests/test_general_contact_initial_seed_eligibility.py index 300d1e198..44262a1ea 100644 --- a/tests/test_general_contact_initial_seed_eligibility.py +++ b/tests/test_general_contact_initial_seed_eligibility.py @@ -26,15 +26,15 @@ import pytest -from anysolver import ( +from anyfesolver import ( ContactDefinition, ContactInteraction, ContactSurface, validate_general_contact, ) -from anysolver.general_contact import static_path -from anysolver.general_contact.s3_patch_static import ( +from anyfesolver.general_contact import static_path +from anyfesolver.general_contact.s3_patch_static import ( REFINED_Q4_S3_OVERLAP_LOCAL_AUGMENTED_PROFILE, ) -from anysolver.general_contact.s3_sliding_friction import ( +from anyfesolver.general_contact.s3_sliding_friction import ( S3MovingNormalFrictionSettings, ) diff --git a/tests/test_general_contact_initial_seed_example_contract.py b/tests/test_general_contact_initial_seed_example_contract.py index d7501072f..2b90c4bcf 100644 --- a/tests/test_general_contact_initial_seed_example_contract.py +++ b/tests/test_general_contact_initial_seed_example_contract.py @@ -24,8 +24,8 @@ import numpy as np -from anysolver import validate_general_contact -from anysolver.general_contact.core import _contact_settings_contract +from anyfesolver import validate_general_contact +from anyfesolver.general_contact.core import _contact_settings_contract from test_general_contact_admission_globalization_driver_small_patch import ( _ANCHOR_NODES, diff --git a/tests/test_general_contact_initial_seed_gap_witness_capture.py b/tests/test_general_contact_initial_seed_gap_witness_capture.py index 93b7e325f..70819e800 100644 --- a/tests/test_general_contact_initial_seed_gap_witness_capture.py +++ b/tests/test_general_contact_initial_seed_gap_witness_capture.py @@ -39,9 +39,9 @@ import numpy as np import pytest -from anysolver.control import SolveCancelled -from anysolver.general_contact import s3_patch_static, semismooth_path -from anysolver.general_contact.core import _contact_settings_contract +from anyfesolver.control import SolveCancelled +from anyfesolver.general_contact import s3_patch_static, semismooth_path +from anyfesolver.general_contact.core import _contact_settings_contract from test_general_contact_admission_globalization_driver_small_patch import ( _case, diff --git a/tests/test_general_contact_initial_seed_oracle.py b/tests/test_general_contact_initial_seed_oracle.py index 913d2a261..462a02b22 100644 --- a/tests/test_general_contact_initial_seed_oracle.py +++ b/tests/test_general_contact_initial_seed_oracle.py @@ -20,7 +20,7 @@ import numpy as np from scipy import sparse -from anysolver.general_contact.initial_contact_seed import ( +from anyfesolver.general_contact.initial_contact_seed import ( InitialContactSeedRefusal, MAXIMUM_SEED_PRESSURE_MODES, propose_linearized_kkt_seed, diff --git a/tests/test_general_contact_initial_seed_origin_capture.py b/tests/test_general_contact_initial_seed_origin_capture.py index 5f2c541d2..6f47d8da9 100644 --- a/tests/test_general_contact_initial_seed_origin_capture.py +++ b/tests/test_general_contact_initial_seed_origin_capture.py @@ -25,9 +25,9 @@ import numpy as np import pytest -from anysolver.control import SolveCancelled -from anysolver.general_contact import semismooth_path -from anysolver.general_contact.initial_contact_seed import ( +from anyfesolver.control import SolveCancelled +from anyfesolver.general_contact import semismooth_path +from anyfesolver.general_contact.initial_contact_seed import ( propose_linearized_kkt_seed, ) diff --git a/tests/test_general_contact_initial_seed_public_example.py b/tests/test_general_contact_initial_seed_public_example.py index 19154a518..09026e80a 100644 --- a/tests/test_general_contact_initial_seed_public_example.py +++ b/tests/test_general_contact_initial_seed_public_example.py @@ -35,7 +35,7 @@ def _snapshot_site(): with open(install, encoding="utf-8") as handle: record = json.load(handle) site = record.get("site") - if site and os.path.isdir(os.path.join(site, "anysolver")): + if site and os.path.isdir(os.path.join(site, "anyfesolver")): return site return None diff --git a/tests/test_general_contact_initial_seed_settings.py b/tests/test_general_contact_initial_seed_settings.py index cde078ce3..2450aa4db 100644 --- a/tests/test_general_contact_initial_seed_settings.py +++ b/tests/test_general_contact_initial_seed_settings.py @@ -11,12 +11,12 @@ import pytest -from anysolver import ContactSolverSettings, validate_general_contact -from anysolver.general_contact.core import ( +from anyfesolver import ContactSolverSettings, validate_general_contact +from anyfesolver.general_contact.core import ( _INITIAL_CONTACT_SEED_REVISION, _contact_settings_contract, ) -from anysolver.general_contact.request_identity import ( +from anyfesolver.general_contact.request_identity import ( identify_general_contact_request, ) diff --git a/tests/test_general_contact_jet2_candidate_budget.py b/tests/test_general_contact_jet2_candidate_budget.py index 0800e5f85..fd1146c76 100644 --- a/tests/test_general_contact_jet2_candidate_budget.py +++ b/tests/test_general_contact_jet2_candidate_budget.py @@ -5,8 +5,8 @@ import numpy as np import pytest -from anysolver.general_contact.s3_patch_augmented import MovingS3PatchProjectedNormal -from anysolver.general_contact.s3_patch_mortar_energy import ( +from anyfesolver.general_contact.s3_patch_augmented import MovingS3PatchProjectedNormal +from anyfesolver.general_contact.s3_patch_mortar_energy import ( MovingS3PatchPrimalMortarPenalty, S3PatchFace, ) diff --git a/tests/test_general_contact_lazy_import.py b/tests/test_general_contact_lazy_import.py index b96f1cae2..6b14fb4c7 100644 --- a/tests/test_general_contact_lazy_import.py +++ b/tests/test_general_contact_lazy_import.py @@ -19,24 +19,24 @@ def test_no_contact_static_route_leaves_contact_kernel_unloaded(): from pathlib import Path import sys - import anysolver + import anyfesolver source = Path(os.environ["ANYSOLVER_TEST_SOURCE"]).resolve() - assert Path(anysolver.__file__).resolve().is_relative_to(source) - assert "anysolver.general_contact" not in sys.modules + assert Path(anyfesolver.__file__).resolve().is_relative_to(source) + assert "anyfesolver.general_contact" not in sys.modules - from anysolver.boundary import LoadCase - from anysolver.mesh_gen import generate_beam_mesh + from anyfesolver.boundary import LoadCase + from anyfesolver.mesh_gen import generate_beam_mesh model = generate_beam_mesh(1.0, num_divisions=1) load = LoadCase("axial") load.add_nodal_load(2, [10.0, 0.0, 0.0, 0.0, 0.0, 0.0]) - result = anysolver.solve_static_nonlinear( + result = anyfesolver.solve_static_nonlinear( model, load, num_steps=1, max_iterations=5, ) assert result.status == "completed", result.failure_reason - assert "anysolver.general_contact.core" not in sys.modules + assert "anyfesolver.general_contact.core" not in sys.modules - import anysolver.general_contact as package - from anysolver.general_contact import core, runtime + import anyfesolver.general_contact as package + from anyfesolver.general_contact import core, runtime for name in ( "ContactDefinition", "ContactInteraction", "ContactPathControl", "ContactPathNodalForce", "ContactPathProgram", "ContactResults", @@ -46,7 +46,7 @@ def test_no_contact_static_route_leaves_contact_kernel_unloaded(): "TransientContactResults", "TransientContactSettings", "solve_transient_contact", "validate_general_contact", ): - assert getattr(anysolver, name) is getattr(package, name), name + assert getattr(anyfesolver, name) is getattr(package, name), name assert core._ACTIVE_CONTACT is runtime._ACTIVE_CONTACT assert core.active_contact_manager is runtime.active_contact_manager assert core.suspend_contact is runtime.suspend_contact diff --git a/tests/test_general_contact_linear_patch_oracle.py b/tests/test_general_contact_linear_patch_oracle.py index ce2f6bbf4..9cf545b59 100644 --- a/tests/test_general_contact_linear_patch_oracle.py +++ b/tests/test_general_contact_linear_patch_oracle.py @@ -8,7 +8,7 @@ import numpy as np from dataclasses import replace -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, @@ -19,8 +19,8 @@ solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel -from anysolver.general_contact.core import contact_scope +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.core import contact_scope def _case_and_local_check(*, target_left_x=-0.2): diff --git a/tests/test_general_contact_linearized_pivot_patch.py b/tests/test_general_contact_linearized_pivot_patch.py index ab6918bb8..21e0d4031 100644 --- a/tests/test_general_contact_linearized_pivot_patch.py +++ b/tests/test_general_contact_linearized_pivot_patch.py @@ -4,8 +4,8 @@ from scipy import sparse from scipy.optimize import root -from anysolver.general_contact import linearized_pivot -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact import linearized_pivot +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from test_general_contact_q4_s3_refined_patch import _two_q4_two_s3 diff --git a/tests/test_general_contact_linearized_pivot_support.py b/tests/test_general_contact_linearized_pivot_support.py index 0f63bb8c0..c616f2161 100644 --- a/tests/test_general_contact_linearized_pivot_support.py +++ b/tests/test_general_contact_linearized_pivot_support.py @@ -5,7 +5,7 @@ import numpy as np from scipy import sparse -from anysolver.general_contact import linearized_pivot +from anyfesolver.general_contact import linearized_pivot class _MovingSupportGeometry: diff --git a/tests/test_general_contact_macro_pressure_state.py b/tests/test_general_contact_macro_pressure_state.py index 5647ae043..951c32163 100644 --- a/tests/test_general_contact_macro_pressure_state.py +++ b/tests/test_general_contact_macro_pressure_state.py @@ -6,20 +6,20 @@ from types import SimpleNamespace from scipy import sparse -from anysolver import validate_general_contact -from anysolver.general_contact import linearized_pivot -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver import validate_general_contact +from anyfesolver.general_contact import linearized_pivot +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from test_general_contact_q4_s3_jet2_static_owner import _settings from test_general_contact_q4_s3_refined_patch import _two_q4_two_s3 from scripts.general_contact_d1_mixed_mesh_jet2_schur_press import build_case -from anysolver.general_contact.pressure_basis import ( +from anyfesolver.general_contact.pressure_basis import ( build_q4_source_macro_q1_pair_basis, ) -from anysolver.general_contact.s3_patch_augmented import ( +from anyfesolver.general_contact.s3_patch_augmented import ( MovingS3PatchProjectedNormal, ) -from anysolver.general_contact.s3_patch_mortar_energy import ( +from anyfesolver.general_contact.s3_patch_mortar_energy import ( MovingS3PatchPrimalMortarPenalty, S3PatchFace, ) diff --git a/tests/test_general_contact_mixed_assembly_cache_lifecycle.py b/tests/test_general_contact_mixed_assembly_cache_lifecycle.py index 66f59643a..a182e09ae 100644 --- a/tests/test_general_contact_mixed_assembly_cache_lifecycle.py +++ b/tests/test_general_contact_mixed_assembly_cache_lifecycle.py @@ -7,9 +7,9 @@ import numpy as np import pytest -from anysolver import FEModel, create_shell_element -from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement -from anysolver.matrix_assembly import AssemblyError, assemble_stiffness_matrix +from anyfesolver import FEModel, create_shell_element +from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement +from anyfesolver.matrix_assembly import AssemblyError, assemble_stiffness_matrix def model(): diff --git a/tests/test_general_contact_mixed_ordinary_augmented.py b/tests/test_general_contact_mixed_ordinary_augmented.py index 9d2d6228d..fcebfb19c 100644 --- a/tests/test_general_contact_mixed_ordinary_augmented.py +++ b/tests/test_general_contact_mixed_ordinary_augmented.py @@ -4,7 +4,7 @@ import numpy as np -from anysolver import ( +from anyfesolver import ( BoundaryCondition, DisplacementControl, LoadCase, solve_static_nonlinear, validate_general_contact, ) diff --git a/tests/test_general_contact_mixed_path.py b/tests/test_general_contact_mixed_path.py index 3a00cc60c..bfd0a7089 100644 --- a/tests/test_general_contact_mixed_path.py +++ b/tests/test_general_contact_mixed_path.py @@ -6,14 +6,14 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( ContactPathControl, ContactPathNodalForce, ContactPathProgram, solve_static_nonlinear, ) from examples.general_contact_refined_q4_s3_mixed_path import ( GAP_BUDGET_M, make_case, solve_case, ) -from anysolver.general_contact.core import contact_scope +from anyfesolver.general_contact.core import contact_scope from scripts.general_contact_d1_mixed_jet2_schur_probe import make_candidate diff --git a/tests/test_general_contact_monolithic_block_direction.py b/tests/test_general_contact_monolithic_block_direction.py index 3e6c563d2..d569dc661 100644 --- a/tests/test_general_contact_monolithic_block_direction.py +++ b/tests/test_general_contact_monolithic_block_direction.py @@ -7,8 +7,8 @@ from scipy import sparse from scipy.sparse.linalg import spsolve -from anysolver import solve_static_nonlinear -from anysolver.general_contact.semismooth_block import prepare_frozen_block_response +from anyfesolver import solve_static_nonlinear +from anyfesolver.general_contact.semismooth_block import prepare_frozen_block_response from scripts.general_contact_d1_mixed_mesh_jet2_schur_press import build_case diff --git a/tests/test_general_contact_monolithic_cycle_restart.py b/tests/test_general_contact_monolithic_cycle_restart.py index 3dbef4de9..12bd7c055 100644 --- a/tests/test_general_contact_monolithic_cycle_restart.py +++ b/tests/test_general_contact_monolithic_cycle_restart.py @@ -5,11 +5,11 @@ import numpy as np import pytest -from anysolver import solve_static_nonlinear -from anysolver.general_contact.core import suspend_contact -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.general_contact.semismooth import linearize -from anysolver.nonlinear_static import _assemble_nonlinear_system +from anyfesolver import solve_static_nonlinear +from anyfesolver.general_contact.core import suspend_contact +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.semismooth import linearize +from anyfesolver.nonlinear_static import _assemble_nonlinear_system from scripts.general_contact_d1_free_target_press_probe import ( build_free_target_case, ) diff --git a/tests/test_general_contact_monolithic_exact_seam.py b/tests/test_general_contact_monolithic_exact_seam.py index 71d3a99b9..6a69943b7 100644 --- a/tests/test_general_contact_monolithic_exact_seam.py +++ b/tests/test_general_contact_monolithic_exact_seam.py @@ -7,12 +7,12 @@ import numpy as np import pytest -from anysolver import ContactPathNodalForce, solve_static_nonlinear -from anysolver.assembly import build_constraint_transformation -from anysolver.general_contact.q4_s3_overlap_derivatives import UnsupportedQ4S3Branch -from anysolver.general_contact import s3_patch_augmented -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver import ContactPathNodalForce, solve_static_nonlinear +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.general_contact.q4_s3_overlap_derivatives import UnsupportedQ4S3Branch +from anyfesolver.general_contact import s3_patch_augmented +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.matrix_assembly import assemble_stiffness_matrix from scripts.general_contact_d1_coupled_refinement import build_case diff --git a/tests/test_general_contact_monolithic_ordinary_displacement.py b/tests/test_general_contact_monolithic_ordinary_displacement.py index 861db3396..652894bb4 100644 --- a/tests/test_general_contact_monolithic_ordinary_displacement.py +++ b/tests/test_general_contact_monolithic_ordinary_displacement.py @@ -6,14 +6,14 @@ import pytest from scipy import sparse -from anysolver import solve_static_nonlinear -from anysolver.assembly import build_constraint_transformation -from anysolver.boundary import BoundaryCondition -from anysolver.matrix_assembly import assemble_stiffness_matrix -from anysolver.nonlinear_static import DisplacementControl -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.general_contact.semismooth import linearize -from anysolver.general_contact.static_path import ( +from anyfesolver import solve_static_nonlinear +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.boundary import BoundaryCondition +from anyfesolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.nonlinear_static import DisplacementControl +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.semismooth import linearize +from anyfesolver.general_contact.static_path import ( ContactPathControl, ContactPathProgram, _elastic_displacement_force_predictor, solve_static_contact_path, ) @@ -272,7 +272,7 @@ def test_ordinary_displacement_rejects_unphysical_force_scale(monkeypatch): model, definition, settings, control = _case() # The monolithic route keeps the strict predictor default; the spy # observes allow_zero=False while the original refusal is retained. - import anysolver.general_contact.static_path as path_driver + import anyfesolver.general_contact.static_path as path_driver real = path_driver._elastic_displacement_force_predictor seen = [] def spy(*args, **kwargs): diff --git a/tests/test_general_contact_monolithic_ordinary_force.py b/tests/test_general_contact_monolithic_ordinary_force.py index 3dfed12b8..5f6e1bdb4 100644 --- a/tests/test_general_contact_monolithic_ordinary_force.py +++ b/tests/test_general_contact_monolithic_ordinary_force.py @@ -5,8 +5,8 @@ import numpy as np import pytest -from anysolver import solve_static_nonlinear -from anysolver.boundary import BoundaryCondition, LoadCase +from anyfesolver import solve_static_nonlinear +from anyfesolver.boundary import BoundaryCondition, LoadCase from scripts.general_contact_d1_free_target_press_probe import build_free_target_case from scripts.general_contact_d1_mixed_mesh_jet2_schur_press import build_case diff --git a/tests/test_general_contact_monolithic_restart.py b/tests/test_general_contact_monolithic_restart.py index f63e7d223..e855be5eb 100644 --- a/tests/test_general_contact_monolithic_restart.py +++ b/tests/test_general_contact_monolithic_restart.py @@ -6,11 +6,11 @@ import numpy as np import pytest -from anysolver import solve_static_nonlinear -from anysolver.control import SolveCancelled -from anysolver.general_contact import semismooth_path -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.nonlinear_restart import _checkpoint_without_hash, _sha256 +from anyfesolver import solve_static_nonlinear +from anyfesolver.control import SolveCancelled +from anyfesolver.general_contact import semismooth_path +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.nonlinear_restart import _checkpoint_without_hash, _sha256 from scripts.general_contact_d1_mixed_mesh_jet2_schur_press import build_case diff --git a/tests/test_general_contact_monolithic_work.py b/tests/test_general_contact_monolithic_work.py index b5ef89e90..dba33ab0d 100644 --- a/tests/test_general_contact_monolithic_work.py +++ b/tests/test_general_contact_monolithic_work.py @@ -2,11 +2,11 @@ import numpy as np -from anysolver import solve_static_nonlinear -from anysolver.nonlinear_static import _assemble_nonlinear_system -from anysolver.general_contact.core import suspend_contact -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.general_contact.semismooth import ( +from anyfesolver import solve_static_nonlinear +from anyfesolver.nonlinear_static import _assemble_nonlinear_system +from anyfesolver.general_contact.core import suspend_contact +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.semismooth import ( linearize, raw_certificate, reference_nodal_support, ) from scripts.general_contact_d1_mixed_mesh_jet2_schur_press import build_case diff --git a/tests/test_general_contact_moving.py b/tests/test_general_contact_moving.py index 0f5fefd87..2f0c78228 100644 --- a/tests/test_general_contact_moving.py +++ b/tests/test_general_contact_moving.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver.general_contact.moving import ( +from anyfesolver.general_contact.moving import ( TranslatedPairMortar, moving_mortar_state, moving_mortar_translation_residual, @@ -11,7 +11,7 @@ certify_moving_mortar_gap, bound_swept_moving_mortar_gap, ) -from anysolver.general_contact.overlap import PlanarFace +from anyfesolver.general_contact.overlap import PlanarFace def _square(feature, x0, y0, z=0.0): diff --git a/tests/test_general_contact_multiple_beam_ends.py b/tests/test_general_contact_multiple_beam_ends.py index 71f6647f4..cec8a0583 100644 --- a/tests/test_general_contact_multiple_beam_ends.py +++ b/tests/test_general_contact_multiple_beam_ends.py @@ -5,12 +5,12 @@ import numpy as np import pytest from scipy.optimize import brentq -from anysolver import (ContactDefinition,ContactSurface,ContactInteraction,ContactSolverSettings, +from anyfesolver import (ContactDefinition,ContactSurface,ContactInteraction,ContactSolverSettings, RigidContactBody,RigidCappedCylinder,BoundaryCondition,LoadCase,DisplacementControl, solve_static_nonlinear,validate_general_contact,report_general_contact_capability) -from anysolver.fe_core import FEModel -from anysolver.elements import QuadraticBeamElement -from anysolver.general_contact.multiple_beam_rigid import MultipleBeamRigidManager,PROFILE_ENDS +from anyfesolver.fe_core import FEModel +from anyfesolver.elements import QuadraticBeamElement +from anyfesolver.general_contact.multiple_beam_rigid import MultipleBeamRigidManager,PROFILE_ENDS def fixture(kind='sphere'): diff --git a/tests/test_general_contact_multiple_beam_rigid.py b/tests/test_general_contact_multiple_beam_rigid.py index 3d353581c..6cb61d2af 100644 --- a/tests/test_general_contact_multiple_beam_rigid.py +++ b/tests/test_general_contact_multiple_beam_rigid.py @@ -9,12 +9,12 @@ import pytest from scipy.integrate import quad -from anysolver import (BoundaryCondition, ContactDefinition, ContactInteraction, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, DisplacementControl, LoadCase, RigidContactBody, solve_static_nonlinear, validate_general_contact) -from anysolver.elements import QuadraticBeamElement -from anysolver.fe_core import FEModel -from anysolver.general_contact.multiple_beam_rigid import MultipleBeamRigidManager, PROFILE +from anyfesolver.elements import QuadraticBeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.multiple_beam_rigid import MultipleBeamRigidManager, PROFILE def fixture(*, cylinder=False): diff --git a/tests/test_general_contact_multiple_beam_s3_caps.py b/tests/test_general_contact_multiple_beam_s3_caps.py index 73c020d1b..aa6f3c82b 100644 --- a/tests/test_general_contact_multiple_beam_s3_caps.py +++ b/tests/test_general_contact_multiple_beam_s3_caps.py @@ -7,14 +7,14 @@ import pytest from scipy.optimize import root -from anysolver import (ContactSurface, ContactInteraction, RigidContactBody, DisplacementControl, +from anyfesolver import (ContactSurface, ContactInteraction, RigidContactBody, DisplacementControl, CancellationToken, SolveCancelled, solve_static_nonlinear, validate_general_contact, report_general_contact_capability) -from anysolver.elements import BeamElement, QuadraticBeamElement -from anysolver.general_contact.multiple_beam_s3_caps import MultipleBeamS3CapManager, PROFILE -from anysolver.general_contact.deformable_beam_s3_caps import DeformableBeamS3CapManager -from anysolver.general_contact.beam_hemisphere_plane import HemispherePlaneManager -from anysolver.general_contact.beam_hemisphere_sphere import HemisphereSphereManager +from anyfesolver.elements import BeamElement, QuadraticBeamElement +from anyfesolver.general_contact.multiple_beam_s3_caps import MultipleBeamS3CapManager, PROFILE +from anyfesolver.general_contact.deformable_beam_s3_caps import DeformableBeamS3CapManager +from anyfesolver.general_contact.beam_hemisphere_plane import HemispherePlaneManager +from anyfesolver.general_contact.beam_hemisphere_sphere import HemisphereSphereManager from examples.general_contact_multiple_beam_s3_caps import build, run from test_general_contact_deformable_beam_s3_caps import scalar_total from s3_von_karman_oracle import model_triangle_von_karman @@ -116,7 +116,7 @@ def test_two_deforming_skins_independent_shared_beam_work_full_hessian_and_coupl def test_actual_four_coordinate_response_both_targets_controls_and_split_restart(): - from anysolver.matrix_assembly import assemble_stiffness_matrix + from anyfesolver.matrix_assembly import assemble_stiffness_matrix model, definition, settings, load = fixture() common = dict(contact=definition, contact_settings=settings, num_steps=4, max_iterations=25, tolerance=1e-10, emit_restart_checkpoint=True) diff --git a/tests/test_general_contact_multiple_beam_s3_transient.py b/tests/test_general_contact_multiple_beam_s3_transient.py index a6b834296..1a2f82baf 100644 --- a/tests/test_general_contact_multiple_beam_s3_transient.py +++ b/tests/test_general_contact_multiple_beam_s3_transient.py @@ -9,10 +9,10 @@ import numpy as np import pytest from examples.general_contact_multiple_beam_s3_transient import build,run -from anysolver.dynamics import TransientConfig -from anysolver.general_contact.transient import (ContactTransientSolverControls, +from anyfesolver.dynamics import TransientConfig +from anyfesolver.general_contact.transient import (ContactTransientSolverControls, solve_transient_contact) -from anysolver.general_contact.multiple_beam_s3_transient import ( +from anyfesolver.general_contact.multiple_beam_s3_transient import ( PROFILE,MultipleBeamS3TransientManager,multiple_hermite_gap_bounds,pair_definitions) FORCE_SCALE=.0025 @@ -65,10 +65,10 @@ def reference(times): def physical_body_balance(model,result): """Shared shell counted once, actual inertia/support/structural residual.""" - from anysolver.assembly import assemble_mass_matrix - from anysolver.nonlinear_static import _assemble_nonlinear_system - from anysolver.nonlinear_state import discard_active_state_candidate - from anysolver.general_contact.runtime import suspend_contact + from anyfesolver.assembly import assemble_mass_matrix + from anyfesolver.nonlinear_static import _assemble_nonlinear_system + from anyfesolver.nonlinear_state import discard_active_state_candidate + from anyfesolver.general_contact.runtime import suspend_contact M,_=assemble_mass_matrix(model);errors=[] for index in (0,int(np.argmin([r.minimum_gap for r in result.contact])),len(result.times)-1): u=result.displacements[index];inertia=np.asarray(M@result.accelerations[index]).reshape(-1) @@ -260,8 +260,8 @@ def test_complete_model_section_skin_and_dof_binding_refusal(monkeypatch): def test_rejected_path_exception_and_cancellation_cleanup(monkeypatch): # Use the actual shared solver boundary, with a single failed proof, then # check it retries from unchanged accepted u/v and releases runtime state. - from anysolver.general_contact import multiple_beam_s3_transient as aggregate - from anysolver.general_contact.runtime import _ACTIVE_CONTACT + from anyfesolver.general_contact import multiple_beam_s3_transient as aggregate + from anyfesolver.general_contact.runtime import _ACTIVE_CONTACT original=aggregate.multiple_hermite_gap_bounds;seen=[];rejected=[] def active_start(owner,start): child=owner.pairs[0][1] @@ -288,10 +288,10 @@ def fail(owner,start,*args,**kwargs): def test_inflight_cancel_preserves_accepted_origin(monkeypatch): - from anysolver.control import CancellationToken,SolveCancelled - import anysolver.general_contact.transient as driver - from anysolver.general_contact import multiple_beam_s3_transient as aggregate - from anysolver.general_contact.runtime import _ACTIVE_CONTACT + from anyfesolver.control import CancellationToken,SolveCancelled + import anyfesolver.general_contact.transient as driver + from anyfesolver.general_contact import multiple_beam_s3_transient as aggregate + from anyfesolver.general_contact.runtime import _ACTIVE_CONTACT token=CancellationToken();commits=[];calls=0 commit=driver.commit_state_candidate;path=aggregate.multiple_hermite_gap_bounds def saved(origin,trial): diff --git a/tests/test_general_contact_multiple_beam_sphere_lifecycle.py b/tests/test_general_contact_multiple_beam_sphere_lifecycle.py index 5fcb5fb71..91b437d15 100644 --- a/tests/test_general_contact_multiple_beam_sphere_lifecycle.py +++ b/tests/test_general_contact_multiple_beam_sphere_lifecycle.py @@ -4,9 +4,9 @@ import numpy as np import pytest from scipy.integrate import quad -from anysolver import LoadCase, RigidContactBody, solve_static_nonlinear -from anysolver.control import CancellationToken, SolveCancelled -from anysolver.general_contact.multiple_beam_rigid import MultipleBeamRigidManager +from anyfesolver import LoadCase, RigidContactBody, solve_static_nonlinear +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver.general_contact.multiple_beam_rigid import MultipleBeamRigidManager from test_general_contact_multiple_beam_rigid import fixture as two_plane_fixture diff --git a/tests/test_general_contact_multiple_hemisphere_analytic.py b/tests/test_general_contact_multiple_hemisphere_analytic.py index 2cbae6ca3..3d157fa7a 100644 --- a/tests/test_general_contact_multiple_hemisphere_analytic.py +++ b/tests/test_general_contact_multiple_hemisphere_analytic.py @@ -6,14 +6,14 @@ import pytest from scipy.integrate import quad from scipy.optimize import brentq -from anysolver import (ContactDefinition, ContactSurface, RigidContactBody, +from anyfesolver import (ContactDefinition, ContactSurface, RigidContactBody, LoadCase, DisplacementControl, CancellationToken, SolveCancelled, solve_static_nonlinear, validate_general_contact, report_general_contact_capability) -from anysolver.elements import QuadraticBeamElement -from anysolver.general_contact.multiple_beam_rigid import (MultipleBeamRigidManager, +from anyfesolver.elements import QuadraticBeamElement +from anyfesolver.general_contact.multiple_beam_rigid import (MultipleBeamRigidManager, PROFILE_SUPPORT, PROFILE_SUPPORT_ANALYTIC) -from anysolver.general_contact.beam_hemisphere_sphere import HemisphereSphereManager -from anysolver.general_contact.beam_hemisphere_plane import HemispherePlaneManager +from anyfesolver.general_contact.beam_hemisphere_sphere import HemisphereSphereManager +from anyfesolver.general_contact.beam_hemisphere_plane import HemispherePlaneManager from test_general_contact_multiple_hemisphere_planes import orthogonal, positions, bars as plane_bars from test_general_contact_hemisphere_plane import scalar_gap from test_general_contact_hemisphere_sphere import angular_oracle @@ -168,7 +168,7 @@ def test_common_gap_fraction_and_admission_limits_preserve_old_plane_identity(): duplicate=replace(definition,interactions=(*definition.interactions,replace(definition.interactions[0],name='alias'))) assert not validate_general_contact(model,duplicate,settings).valid assert not validate_general_contact(model,definition,replace(settings,maximum_candidate_pairs=1)).valid - from anysolver.general_contact.multiple_beam_rigid import PROFILE_SUPPORT_CYLINDER + from anyfesolver.general_contact.multiple_beam_rigid import PROFILE_SUPPORT_CYLINDER cylinder=replace(definition.rigid_bodies[1],kind='cylinder',normal=(0.,0.,1.)) cylinder_definition=replace(definition,rigid_bodies=(definition.rigid_bodies[0],cylinder)) assert validate_general_contact(model,cylinder_definition,settings).profile==PROFILE_SUPPORT_CYLINDER diff --git a/tests/test_general_contact_multiple_hemisphere_cylinders.py b/tests/test_general_contact_multiple_hemisphere_cylinders.py index 6e828c2c7..1f2814f51 100644 --- a/tests/test_general_contact_multiple_hemisphere_cylinders.py +++ b/tests/test_general_contact_multiple_hemisphere_cylinders.py @@ -4,11 +4,11 @@ import numpy as np import pytest from scipy.optimize import brentq -from anysolver import (RigidContactBody, solve_static_nonlinear, +from anyfesolver import (RigidContactBody, solve_static_nonlinear, validate_general_contact, report_general_contact_capability) -from anysolver.general_contact.multiple_beam_rigid import ( +from anyfesolver.general_contact.multiple_beam_rigid import ( MultipleBeamRigidManager, PROFILE_SUPPORT_CYLINDER) -from anysolver.general_contact.beam_hemisphere_cylinder import HemisphereCylinderManager +from anyfesolver.general_contact.beam_hemisphere_cylinder import HemisphereCylinderManager from test_general_contact_multiple_beam_ends import fixture diff --git a/tests/test_general_contact_multiple_hemisphere_planes.py b/tests/test_general_contact_multiple_hemisphere_planes.py index 5d9707e44..79c9784f7 100644 --- a/tests/test_general_contact_multiple_hemisphere_planes.py +++ b/tests/test_general_contact_multiple_hemisphere_planes.py @@ -6,13 +6,13 @@ import pytest from scipy.integrate import quad from scipy.optimize import brentq -from anysolver import (BoundaryCondition, ContactDefinition, ContactSurface, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactSurface, ContactInteraction, ContactSolverSettings, RigidContactBody, LoadCase, DisplacementControl, CancellationToken, SolveCancelled, solve_static_nonlinear, validate_general_contact) -from anysolver.elements import BeamElement, QuadraticBeamElement -from anysolver.fe_core import FEModel -from anysolver.general_contact.multiple_beam_rigid import MultipleBeamRigidManager, PROFILE_SUPPORT +from anyfesolver.elements import BeamElement, QuadraticBeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.multiple_beam_rigid import MultipleBeamRigidManager, PROFILE_SUPPORT from test_general_contact_hemisphere_plane import scalar_gap from test_general_contact_multiple_beam_rigid import fixture as orthogonal_fixture from test_general_contact_multiple_beam_ends import fixture as old_bar @@ -149,7 +149,7 @@ def test_one_child_gap_gate_common_fraction_and_duplicate_resource_rejection(): duplicate=replace(definition,interactions=definition.interactions+(replace(definition.interactions[0],name='duplicate'),)) assert not validate_general_contact(model,duplicate,settings).valid assert not validate_general_contact(model,definition,replace(settings,maximum_candidate_pairs=1)).valid - from anysolver.general_contact.multiple_beam_rigid import PROFILE_SUPPORT_CYLINDER + from anyfesolver.general_contact.multiple_beam_rigid import PROFILE_SUPPORT_CYLINDER cylinder=replace(definition.rigid_bodies[0],kind='cylinder',normal=(0.,0.,1.),radius=.01) cylinder_definition=replace(definition,rigid_bodies=(cylinder,definition.rigid_bodies[1])) assert validate_general_contact(model,cylinder_definition,settings).profile==PROFILE_SUPPORT_CYLINDER @@ -165,7 +165,7 @@ def test_one_child_gap_gate_common_fraction_and_duplicate_resource_rejection(): @pytest.mark.parametrize('cancel',(False,True)) def test_actual_aggregate_second_child_failure_or_cancel_restores_static_origin(cancel,monkeypatch): - from anysolver.general_contact.beam_hemisphere_plane import HemispherePlaneManager + from anyfesolver.general_contact.beam_hemisphere_plane import HemispherePlaneManager model,definition,settings,load=bars() common=dict(contact=definition,contact_settings=settings,num_steps=4,max_iterations=20, tolerance=1e-10,emit_restart_checkpoint=True) @@ -216,7 +216,7 @@ def test_true_junction_caps_and_shared_body_reactions(): def test_runnable_multi_plane_example_and_capability_remains_unaccepted(): from examples.general_contact_multiple_hemisphere_planes import run - from anysolver import report_general_contact_capability + from anyfesolver import report_general_contact_capability result=run();assert result.status=='completed' assert result.info['general_contact']['profile']==PROFILE_SUPPORT model,definition,settings,load=bars() diff --git a/tests/test_general_contact_multiple_projected_pairs.py b/tests/test_general_contact_multiple_projected_pairs.py index 6664312e2..d681be593 100644 --- a/tests/test_general_contact_multiple_projected_pairs.py +++ b/tests/test_general_contact_multiple_projected_pairs.py @@ -5,15 +5,15 @@ import pytest from scipy import sparse -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathProgram, ContactSurface, FEModel, create_shell_element, DisplacementControl, LoadCase, solve_static_nonlinear, validate_general_contact, ) -from anysolver.general_contact.multiple_projected_pairs import ( +from anyfesolver.general_contact.multiple_projected_pairs import ( MultipleProjectedPairManager, MultiplePairResults, PROFILE, ) -from anysolver.nonlinear_restart import canonical_checkpoint_json_bytes, load_nonlinear_checkpoint +from anyfesolver.nonlinear_restart import canonical_checkpoint_json_bytes, load_nonlinear_checkpoint from test_general_contact_projected_penalty import _candidate @@ -138,7 +138,7 @@ def test_nested_numpy_scalar_certificates_export_with_standard_json(): def test_actual_analysis_control_is_forwarded_to_composite_admission(): - from anysolver.general_contact.core import contact_scope + from anyfesolver.general_contact.core import contact_scope model,definition,settings,_=build() assert validate_general_contact(model,definition,settings).valid report=validate_general_contact(model,definition,settings,analysis_control="arc_length") diff --git a/tests/test_general_contact_multiple_shell_planes.py b/tests/test_general_contact_multiple_shell_planes.py index 79b2dbe75..7f8dd6332 100644 --- a/tests/test_general_contact_multiple_shell_planes.py +++ b/tests/test_general_contact_multiple_shell_planes.py @@ -7,12 +7,12 @@ import pytest from scipy import sparse -from anysolver import ( +from anyfesolver import ( ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, FEModel, RigidContactBody, create_shell_element, validate_general_contact, ) -from anysolver.general_contact.core import contact_scope -from anysolver.general_contact.multiple_shell_planes import ( +from anyfesolver.general_contact.core import contact_scope +from anyfesolver.general_contact.multiple_shell_planes import ( PROFILE, MultipleShellPlaneManager, validate_multiple_shell_planes, ) diff --git a/tests/test_general_contact_native_active_budget.py b/tests/test_general_contact_native_active_budget.py index da2ce434b..43d488e5c 100644 --- a/tests/test_general_contact_native_active_budget.py +++ b/tests/test_general_contact_native_active_budget.py @@ -1,8 +1,8 @@ """Explicit budget policy preserves default identity and certified support.""" import numpy as np import pytest -from anysolver._ge_beam3_p5_seeded.core import sha -import anysolver.general_contact.native_curved_s3_work as module +from anyfesolver._ge_beam3_p5_seeded.core import sha +import anyfesolver.general_contact.native_curved_s3_work as module from test_general_contact_native_curved_s3_work import _case diff --git a/tests/test_general_contact_native_anchored_enclosure.py b/tests/test_general_contact_native_anchored_enclosure.py index 9654e5879..f27649881 100644 --- a/tests/test_general_contact_native_anchored_enclosure.py +++ b/tests/test_general_contact_native_anchored_enclosure.py @@ -1,7 +1,7 @@ """Anchored root gradients preserve mass difference and signed variation.""" import numpy as np import pytest -from anysolver.general_contact.native_curved_s3_work import ( +from anyfesolver.general_contact.native_curved_s3_work import ( _anchored_root_leading_difference_bound,_root_component_gradient_bounds, NativeCurvedMaterialS3Work) from test_general_contact_native_curved_s3_work import _case diff --git a/tests/test_general_contact_native_candidate_reuse.py b/tests/test_general_contact_native_candidate_reuse.py index 959323f06..bcd4f48af 100644 --- a/tests/test_general_contact_native_candidate_reuse.py +++ b/tests/test_general_contact_native_candidate_reuse.py @@ -4,7 +4,7 @@ from dataclasses import replace import numpy as np import pytest -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_p5_seeded.core import canonical from test_general_contact_native_curved_s3_static import _analysis def fixture(): diff --git a/tests/test_general_contact_native_checkpoint_results.py b/tests/test_general_contact_native_checkpoint_results.py index 5d7b06e10..2159fb36e 100644 --- a/tests/test_general_contact_native_checkpoint_results.py +++ b/tests/test_general_contact_native_checkpoint_results.py @@ -45,7 +45,7 @@ def _same(left, right): def test_portable_native_producer_public_consumer(): already_imported=set(sys.modules) - from anysolver.general_contact import read_native_contact_checkpoint_results + from anyfesolver.general_contact import read_native_contact_checkpoint_results from examples.general_contact_native_checkpoint_results import read_portable raw = FIXTURE.read_bytes() expected = json.loads(raw) @@ -56,8 +56,8 @@ def test_portable_native_producer_public_consumer(): assert result.identity == expected['identity'] assert read_portable(FIXTURE).to_bytes() == raw forbidden = [name for name in sys.modules if name not in already_imported and name in ( - 'anysolver.general_contact.native_retained_pair_static', - 'anysolver.general_contact.native_fibre_context')] + 'anyfesolver.general_contact.native_retained_pair_static', + 'anyfesolver.general_contact.native_fibre_context')] assert forbidden == [] output = os.environ.get('CONTACT_APP_RESULT_RECORD') if output: @@ -74,13 +74,13 @@ def test_portable_native_consumer_cold_import_excludes_mechanics(): # test order. Preserve the same real capsule and exact-byte round trip. code="""import sys from pathlib import Path -from anysolver.general_contact import read_native_contact_checkpoint_results +from anyfesolver.general_contact import read_native_contact_checkpoint_results from examples.general_contact_native_checkpoint_results import read_portable raw=Path(sys.argv[1]).read_bytes() assert read_native_contact_checkpoint_results(raw).to_bytes()==raw assert read_portable(Path(sys.argv[1])).to_bytes()==raw -for name in ('anysolver.general_contact.native_retained_pair_static', - 'anysolver.general_contact.native_fibre_context'): +for name in ('anyfesolver.general_contact.native_retained_pair_static', + 'anyfesolver.general_contact.native_fibre_context'): assert name not in sys.modules, name """ result=subprocess.run([sys.executable,'-c',code,str(FIXTURE)], @@ -89,7 +89,7 @@ def test_portable_native_consumer_cold_import_excludes_mechanics(): def test_native_detachment_and_numeric_bits(): - from anysolver.general_contact import read_native_contact_checkpoint_results + from anyfesolver.general_contact import read_native_contact_checkpoint_results value = json.loads(FIXTURE.read_bytes()) value['records'][0]['mechanical']['position_low'][0][0] = -0.0 value['records'][0]['mechanical']['position_low'][0][1] = float.fromhex('0x0.0000000000001p-1022') @@ -104,7 +104,7 @@ def test_native_detachment_and_numeric_bits(): def test_native_closed_roles_integrity_and_refusals(): - from anysolver.general_contact import (read_native_contact_checkpoint_results, + from anyfesolver.general_contact import (read_native_contact_checkpoint_results, NativeContactCheckpointResultError) raw = FIXTURE.read_bytes() for mutate in ( @@ -141,7 +141,7 @@ def test_native_closed_roles_integrity_and_refusals(): def test_native_preparse_resource_and_type_limits(): - from anysolver.general_contact import (read_native_contact_checkpoint_results, + from anyfesolver.general_contact import (read_native_contact_checkpoint_results, NativeContactCheckpointResultError) raw = FIXTURE.read_bytes() for cap in (len(raw)-1, 0, True, 2*1024*1024+1): @@ -154,8 +154,8 @@ def test_native_preparse_resource_and_type_limits(): def test_public_example_bounded_file_read(tmp_path): - from anysolver.general_contact.native_checkpoint_results import MAX_BYTES - from anysolver.general_contact import NativeContactCheckpointResultError + from anyfesolver.general_contact.native_checkpoint_results import MAX_BYTES + from anyfesolver.general_contact import NativeContactCheckpointResultError from examples.general_contact_native_checkpoint_results import read_portable original = FIXTURE.read_bytes() assert read_portable(FIXTURE).to_bytes() == original diff --git a/tests/test_general_contact_native_component_enclosure.py b/tests/test_general_contact_native_component_enclosure.py index 86696084b..df822b0a3 100644 --- a/tests/test_general_contact_native_component_enclosure.py +++ b/tests/test_general_contact_native_component_enclosure.py @@ -1,7 +1,7 @@ """Whole-band component envelopes retain complete mapped gradient work.""" import numpy as np import pytest -from anysolver.general_contact.native_curved_s3_work import ( +from anyfesolver.general_contact.native_curved_s3_work import ( _component_root_leading_difference_bound,_root_component_gradient_bounds, NativeCurvedMaterialS3Work) from test_general_contact_native_curved_s3_work import _case diff --git a/tests/test_general_contact_native_construction_reuse.py b/tests/test_general_contact_native_construction_reuse.py index 464341ebe..e185e8e5e 100644 --- a/tests/test_general_contact_native_construction_reuse.py +++ b/tests/test_general_contact_native_construction_reuse.py @@ -2,7 +2,7 @@ import numpy as np import pytest -from anysolver.control import CancellationToken +from anyfesolver.control import CancellationToken from test_general_contact_native_curved_s3_static import _analysis diff --git a/tests/test_general_contact_native_curve_union.py b/tests/test_general_contact_native_curve_union.py index 9f56206af..2ba3924e2 100644 --- a/tests/test_general_contact_native_curve_union.py +++ b/tests/test_general_contact_native_curve_union.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver.general_contact.native_curve_union import NativeTwoCellUnionSearch +from anyfesolver.general_contact.native_curve_union import NativeTwoCellUnionSearch def _line(first, last, y): @@ -161,7 +161,7 @@ def test_source_interval_gap_lower_matches_original_polynomial_oracle(): endpoint geometries, and no sampled certificate.""" from scipy.optimize import brentq from fractions import Fraction - from anysolver.general_contact.beam_curve_pair import ( + from anyfesolver.general_contact.beam_curve_pair import ( _positions, _source_interval_target_gap_lower, ) @@ -203,7 +203,7 @@ def oracle_squared_length(vector): return result def oracle_bound(source, left, right, target, radius): - from anysolver.general_contact.beam_curve_pair import _curve + from anyfesolver.general_contact.beam_curve_pair import _curve start = _curve(source, left)[0] end = _curve(source, right)[0] middle = _curve(source, 0.5 * (left + right))[0] @@ -326,7 +326,7 @@ def test_coef_sub_helper_matches_numpy_polyutils_sub_exactly(): trailing coefficients unchanged.""" import math from numpy.polynomial import polyutils as pu - from anysolver.general_contact.beam_curve_pair import _coef_sub + from anyfesolver.general_contact.beam_curve_pair import _coef_sub # the repaired defect direction, as an explicit canary assert _coef_sub((1.0,), (2.0, 3.0)) == (-1.0, -3.0) diff --git a/tests/test_general_contact_native_curved_fibre_pair_static.py b/tests/test_general_contact_native_curved_fibre_pair_static.py index 6871b90dc..831ef34b5 100644 --- a/tests/test_general_contact_native_curved_fibre_pair_static.py +++ b/tests/test_general_contact_native_curved_fibre_pair_static.py @@ -39,8 +39,8 @@ def _saved_curved_fixture(): def test_saved_curved_fixture_provisional_provenance_and_response_are_exact(): """All four-profile record bytes and response fields remain explicitly bound.""" - from anysolver._ge_beam3_p5_seeded.codec import _load - from anysolver._ge_beam3_p5_seeded.core import canonical, sha + from anyfesolver._ge_beam3_p5_seeded.codec import _load + from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha raw, response = _saved_curved_fixture() capsule = _load(raw.decode('ascii')) assert capsule['completed_targets'] == len(capsule['records']) == 1 @@ -73,7 +73,7 @@ def _curved_owner(line_stiffness=4000.,initial_trial=None): def test_actual_curved_reference_and_restart_bind_opt_in(): owner=_curved_owner() - from anysolver._ge_beam3_p5_seeded.codec import _load + from anyfesolver._ge_beam3_p5_seeded.codec import _load frozen,_=_saved_curved_fixture() assert owner.identity==_load(frozen.decode())['identity'] for curve in owner.contact.reference_curves: @@ -213,7 +213,7 @@ def _normal_enforcement_sensitivity(*,use_saved_trial=False): if use_saved_trial: # Extract mechanical coordinates only. This is a virgin-origin solve, # never restoration of a checkpoint with a different contact law. - from anysolver._ge_beam3_p5_seeded.codec import _load + from anyfesolver._ge_beam3_p5_seeded.codec import _load mechanical=_load(capsule.decode())['records'][-1]['mechanical'] template=_curved_owner(8000.) initial_trial=dict(native_model=template.context.identity,mechanical=mechanical) diff --git a/tests/test_general_contact_native_curved_gap.py b/tests/test_general_contact_native_curved_gap.py index 129b4b55d..839486af9 100644 --- a/tests/test_general_contact_native_curved_gap.py +++ b/tests/test_general_contact_native_curved_gap.py @@ -9,8 +9,8 @@ import pytest from dataclasses import replace from scipy.optimize import minimize_scalar -from anysolver.control import CancellationToken -from anysolver.general_contact.native_curve_union import resolved_physical_gap_lower +from anyfesolver.control import CancellationToken +from anyfesolver.general_contact.native_curve_union import resolved_physical_gap_lower from test_general_contact_native_curved_pair_ownership import _physical_curves, _scalar_projection, _point diff --git a/tests/test_general_contact_native_curved_pair_lifecycle.py b/tests/test_general_contact_native_curved_pair_lifecycle.py index 314595a58..72e895bc4 100644 --- a/tests/test_general_contact_native_curved_pair_lifecycle.py +++ b/tests/test_general_contact_native_curved_pair_lifecycle.py @@ -11,11 +11,11 @@ import numpy as np import pytest -from anysolver._ge_beam3_p5_seeded.codec import _load -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver.control import CancellationToken +from anyfesolver._ge_beam3_p5_seeded.codec import _load +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.control import CancellationToken from test_general_contact_native_fibre_s3 import _independent_material_history -from anysolver.general_contact.native_replay_diagnostics import replay_difference_message +from anyfesolver.general_contact.native_replay_diagnostics import replay_difference_message ROOT=Path(__file__).parents[1] EVIDENCE=Path(os.environ.get('CONTACT_NATIVE_CURVED_LIFECYCLE_EVIDENCE', diff --git a/tests/test_general_contact_native_curved_pair_ownership.py b/tests/test_general_contact_native_curved_pair_ownership.py index e6911d27c..3a7ed7a2e 100644 --- a/tests/test_general_contact_native_curved_pair_ownership.py +++ b/tests/test_general_contact_native_curved_pair_ownership.py @@ -9,16 +9,16 @@ import json from pathlib import Path -from anysolver._ge_beam3_centered_reference import ( +from anyfesolver._ge_beam3_centered_reference import ( CenteredCurvedBeam3ReferenceGeometry, ) -from anysolver.general_contact.beam_curve_pair import _curve, closest_on_b3 -from anysolver.general_contact.native_retained_whole_pair import ( +from anyfesolver.general_contact.beam_curve_pair import _curve, closest_on_b3 +from anyfesolver.general_contact.native_retained_whole_pair import ( NativeRetainedWholeCurvePair, _CurvedOwnershipUnionSearch, _joined_owned_pieces, _active_gap_correspondence_upper, _exact_tiny_cell_omission_bound, ) -from anysolver.general_contact.native_curved_pair_partition import ( +from anyfesolver.general_contact.native_curved_pair_partition import ( curved_ownership_partition, physical_point_map, _near_junction_band, ) @@ -83,7 +83,7 @@ def test_exact_open_strip_has_zero_energy_work_and_tangent_bound(): def test_any_rounded_open_jet_discards_partial_rule_and_preserves_analytic_work(monkeypatch): from dataclasses import replace - import anysolver.general_contact.native_retained_whole_pair as product + import anyfesolver.general_contact.native_retained_whole_pair as product a, b = _reference(.09999, (0., 1., 2.24)), _reference(0., (0., 1.12, 2.24)) kernel = _kernel(a, b, certify_open_intervals=True, certify_curved_ownership=True) actual = product.b3_distance_jet @@ -112,7 +112,7 @@ def test_saved_curved_pose_quadrature_inventory(monkeypatch): import runpy import sys import time - import anysolver.general_contact.native_retained_whole_pair as product + import anyfesolver.general_contact.native_retained_whole_pair as product saved = json.loads(Path(os.environ["CONTACT_CURVED_SAVED_POSE"]).read_text()) builder = runpy.run_path(str(Path(__file__).parents[1]/"examples" /"general_contact_native_retained_whole_pair.py"))["analysis"] diff --git a/tests/test_general_contact_native_curved_pair_trial_seed.py b/tests/test_general_contact_native_curved_pair_trial_seed.py index edfdb668a..706232142 100644 --- a/tests/test_general_contact_native_curved_pair_trial_seed.py +++ b/tests/test_general_contact_native_curved_pair_trial_seed.py @@ -5,11 +5,11 @@ import numpy as np import pytest -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_p5_seeded.codec import _load -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver.control import CancellationToken -from anysolver.general_contact.native_retained_pair_static import NativeRetainedRoundPairAnalysis +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_p5_seeded.codec import _load +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.control import CancellationToken +from anyfesolver.general_contact.native_retained_pair_static import NativeRetainedRoundPairAnalysis from test_general_contact_native_curved_fibre_pair_static import _curved_owner diff --git a/tests/test_general_contact_native_curved_path.py b/tests/test_general_contact_native_curved_path.py index ab32984b0..5a50522de 100644 --- a/tests/test_general_contact_native_curved_path.py +++ b/tests/test_general_contact_native_curved_path.py @@ -7,18 +7,18 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver.control import CancellationToken,SolveCancelled -from anysolver.general_contact.native_curved_plane_work import NativeCurvedMaterialPlaneWork -from anysolver.general_contact.native_curved_geometry import curved_patch_geometry_control -from anysolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule -from anysolver.general_contact.native_surface_normal import StraightNormalIntegrationSettings -from anysolver.general_contact.native_surface_s3_friction import NativeS3MaterialConfiguration +from anyfesolver.control import CancellationToken,SolveCancelled +from anyfesolver.general_contact.native_curved_plane_work import NativeCurvedMaterialPlaneWork +from anyfesolver.general_contact.native_curved_geometry import curved_patch_geometry_control +from anyfesolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule +from anyfesolver.general_contact.native_surface_normal import StraightNormalIntegrationSettings +from anyfesolver.general_contact.native_surface_s3_friction import NativeS3MaterialConfiguration from test_general_contact_native_retained_station import _reference from test_general_contact_native_surface_bounds import _independent_point def test_projected_zero_roll_bounds_cover_independent_planar_derivatives(): - from anysolver.general_contact.native_curved_geometry import _reference_plane_derivative_bounds + from anyfesolver.general_contact.native_curved_geometry import _reference_plane_derivative_bounds reference=_reference(True);K=np.array(((0.,-1.,0.),(1.,0.,0.),(0.,0.,0.))) for U in (np.eye(3),Rotation.from_rotvec((.3,-.2,.4)).as_matrix()): for n in (U@np.array((0.,0.,1.)),U@np.array((1e-8,-2e-8,1.)),np.array((.2,.3,.7))): @@ -36,8 +36,8 @@ def test_projected_zero_roll_bounds_cover_independent_planar_derivatives(): def test_projected_bounds_nonzero_roll_fallback_and_clipping_ownership(): - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry - from anysolver.general_contact.native_curved_geometry import ( + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry + from anyfesolver.general_contact.native_curved_geometry import ( _reference_plane_derivative_bounds,_reference_norm_bounds, _reference_second_bound,_reference_unclipped_interval) ref=_reference(True);frames=[] @@ -54,7 +54,7 @@ def test_projected_bounds_nonzero_roll_fallback_and_clipping_ownership(): def test_root_band_without_interior_float_reports_parameter_resolution(): - from anysolver.general_contact.native_curved_plane_work import _root_band_station + from anyfesolver.general_contact.native_curved_plane_work import _root_band_station law=_law();p=law.reference.coordinates;U=np.tile(np.eye(3),(2,1,1)) with pytest.raises(ValueError,match='root-band parameter resolution exhausted'): _root_band_station(law.rule,p,np.zeros((3,3)),U,1,.5,np.nextafter(.5,np.inf), @@ -211,8 +211,8 @@ def test_curved_positive_rotating_path_subdivision_limits_cancellation_and_ident def test_root_band_angular_union_keeps_sub_resolution_endpoint_arc(): from decimal import Decimal - from anysolver.general_contact.native_normal_angles import PreciseNormalAngles - from anysolver.general_contact.native_curved_plane_work import _negative_arc_width_bound + from anyfesolver.general_contact.native_normal_angles import PreciseNormalAngles + from anyfesolver.general_contact.native_curved_plane_work import _negative_arc_width_bound # An acos seed rounds this genuine endpoint root onto zero. Midpoint-only # arc classification used to return zero; unresolved ownership must keep it. tiny=PreciseNormalAngles(Decimal('-1e-30'),0.,0.,0.,1.) @@ -231,8 +231,8 @@ def test_root_band_angular_union_keeps_sub_resolution_endpoint_arc(): def test_root_band_grazing_gauss_node_charges_full_fallback_measure(): from decimal import Decimal,localcontext from numpy.polynomial.legendre import leggauss - from anysolver.general_contact.native_normal_angles import PreciseNormalAngles,_sincos,PRECISION - from anysolver.general_contact.native_curved_plane_work import ( + from anyfesolver.general_contact.native_normal_angles import PreciseNormalAngles,_sincos,PRECISION + from anyfesolver.general_contact.native_curved_plane_work import ( _active_angular_rule,_negative_arc_width_bound,_root_band_measure_bound) points,weights=leggauss(16);al,ar=.2,5.8 angle=Decimal((al+ar)/2)+Decimal((ar-al)/2)*Decimal(float(points[8])) diff --git a/tests/test_general_contact_native_curved_path_work_separation.py b/tests/test_general_contact_native_curved_path_work_separation.py index 5c0385fbd..a2ac298e6 100644 --- a/tests/test_general_contact_native_curved_path_work_separation.py +++ b/tests/test_general_contact_native_curved_path_work_separation.py @@ -1,7 +1,7 @@ """Curved path checks own geometry; equilibrium owns endpoint integration.""" import numpy as np import pytest -from anysolver.control import CancellationToken,SolveCancelled +from anyfesolver.control import CancellationToken,SolveCancelled from test_general_contact_native_curved_s3_static import _analysis def test_curved_zero_path_uses_complete_geometry_control_not_force_quadrature(monkeypatch): @@ -42,7 +42,7 @@ def reject(*args,**kwargs):raise MemoryError('owned endpoint integration failure def test_authoritative_caller_endpoint_matches_certified_path(monkeypatch): - from anysolver.general_contact.native_surface_path import material_path_pose + from anyfesolver.general_contact.native_surface_path import material_path_pose owner=_analysis(physical_fibres=True,plastic_fibres=True) start=owner.initial.mechanical;u=owner.initial.shell_displacement;work=owner.pairs[0].work step=np.zeros(owner.context.count+len(u));step[8]=1e-6;step[14]=2e-6 diff --git a/tests/test_general_contact_native_curved_plane_work.py b/tests/test_general_contact_native_curved_plane_work.py index 201b67f8c..9c232d59b 100644 --- a/tests/test_general_contact_native_curved_plane_work.py +++ b/tests/test_general_contact_native_curved_plane_work.py @@ -9,10 +9,10 @@ from scipy.integrate import quad from numpy.polynomial.legendre import leggauss -from anysolver.general_contact.native_curved_geometry import curved_patch_geometry_control -from anysolver.general_contact.native_curved_plane_work import NativeCurvedMaterialPlaneWork -from anysolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule -from anysolver.general_contact.native_surface_normal import StraightNormalIntegrationSettings +from anyfesolver.general_contact.native_curved_geometry import curved_patch_geometry_control +from anyfesolver.general_contact.native_curved_plane_work import NativeCurvedMaterialPlaneWork +from anyfesolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule +from anyfesolver.general_contact.native_surface_normal import StraightNormalIntegrationSettings from test_general_contact_native_retained_station import _reference from test_general_contact_native_surface_bounds import _independent_point @@ -247,7 +247,7 @@ def test_curved_broad_contact_cannot_hide_second_thin_axial_pocket(): def test_curved_uniform_active_minimum_does_not_hide_angular_endpoint_crossing(): - from anysolver.general_contact.native_curved_plane_work import _rectangle_support + from anyfesolver.general_contact.native_curved_plane_work import _rectangle_support ref=_reference(False);radius=.03;epsilon=1e-8 rule=NativeRoundSurfaceRule(7,ref,radius,xi_range=(1e-8,.9), angle_range=(0.,np.pi),axial_order=1,angular_order=1) @@ -265,7 +265,7 @@ def test_curved_uniform_active_minimum_does_not_hide_angular_endpoint_crossing() def test_curved_partial_scalar_field_large_tangential_origin_invariance(): - from anysolver.general_contact.native_curved_plane_work import _station_field + from anyfesolver.general_contact.native_curved_plane_work import _station_field normal=np.array((1.,-1.,0.))/np.sqrt(2.) high=np.tile((1.011,1.,0.),(3,1));low=np.zeros((3,3)) first=_station_field(high,low,0,.5,np.zeros(3),np.eye(3),np.eye(3),.03, @@ -354,8 +354,8 @@ def test_curved_axial_front_reference_area_complete_work(): def test_curved_reference_second_bound_against_independent_planar_twist_derivatives(): - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry - from anysolver.general_contact.native_curved_geometry import ( + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry + from anyfesolver.general_contact.native_curved_geometry import ( _reference_second_bound,_reference_unclipped_interval) Kz=np.array(((0.,-1.,0.),(1.,0.,0.),(0.,0.,0.))) Kx=np.array(((0.,0.,0.),(0.,0.,-1.),(0.,1.,0.))) @@ -380,10 +380,10 @@ def test_curved_reference_second_bound_against_independent_planar_twist_derivati def test_curved_exact_binary_curvature_literal_cancellation_regression(): - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry - from anysolver.general_contact.native_curved_geometry import ( + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry + from anyfesolver.general_contact.native_curved_geometry import ( _reference_curvature_coefficients,_reference_curvature_norm,_reference_second_bound) - from anysolver.general_contact.native_curved_plane_work import ( + from anyfesolver.general_contact.native_curved_plane_work import ( _projected_center_derivative,_projected_center_second) x=np.array((9007199254740991.,9007199254740994.,9007199254740996.)) assert x[0]-2*x[1]+x[2]==0. # Literal defect in the discarded arithmetic. @@ -404,7 +404,7 @@ def test_curved_exact_binary_curvature_literal_cancellation_regression(): def test_projected_gap_literal_origin_counterexample_and_resolution_guard(): - from anysolver.general_contact.native_curved_plane_work import _projected_gap + from anyfesolver.general_contact.native_curved_plane_work import _projected_gap n=np.array((1.,-1.,0.))/np.sqrt(2.) p=np.tile(np.array((1.011,.961,0.)),(3,1)) arm=-.03*n @@ -427,8 +427,8 @@ def test_curved_reference_measure_underflow_fails_explicitly(): def test_whole_orientation_rejects_between_sample_inversion(): - from anysolver.general_contact.native_surface_quadrature import surface_geometry - from anysolver.general_contact.native_retained_station import NativeRetainedRoundStation + from anyfesolver.general_contact.native_surface_quadrature import surface_geometry + from anyfesolver.general_contact.native_retained_station import NativeRetainedRoundStation ref=_reference(True) rule=NativeRoundSurfaceRule(7,ref,1e-4,xi_range=(-.95,-.05),angle_range=(.2,5.8), axial_order=1,angular_order=1) @@ -463,8 +463,8 @@ def test_curved_work_common_rigid_transform_and_numerical_limits(): def test_curved_reference_derivative_interval_bound_with_twist(): - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry - from anysolver.general_contact.native_curved_geometry import _reference_norm_bounds + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry + from anyfesolver.general_contact.native_curved_geometry import _reference_norm_bounds base=_reference(True);frames=base.nodal_triads.copy() for i,roll in enumerate((.1,.4,-.2)): frames[i]=frames[i]@Rotation.from_rotvec((roll,0.,0.)).as_matrix() @@ -480,7 +480,7 @@ def test_curved_reference_derivative_interval_bound_with_twist(): def test_twisted_curved_material_reference_measure_and_work(): - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry law,p,low,U=_case() frames=law.reference.nodal_triads.copy() for i,roll in enumerate((.1,.4,-.2)): diff --git a/tests/test_general_contact_native_curved_s3_restart.py b/tests/test_general_contact_native_curved_s3_restart.py index c2d36c582..15bfdd5f2 100644 --- a/tests/test_general_contact_native_curved_s3_restart.py +++ b/tests/test_general_contact_native_curved_s3_restart.py @@ -32,7 +32,7 @@ def test_curved_s3_active_restart_opens_and_preserves_prefix(): @pytest.mark.parametrize('cancelled',(False,True)) def test_curved_s3_active_prefix_survives_precommit_failure(cancelled): - from anysolver.control import CancellationToken + from anyfesolver.control import CancellationToken raw=_canonical_fixture_payload(ACTIVE);owner=_analysis();record=owner._record;token=CancellationToken() def injected(target,*args): staged=record(target,*args) diff --git a/tests/test_general_contact_native_curved_s3_static.py b/tests/test_general_contact_native_curved_s3_static.py index acfb40af1..b611b8440 100644 --- a/tests/test_general_contact_native_curved_s3_static.py +++ b/tests/test_general_contact_native_curved_s3_static.py @@ -3,7 +3,7 @@ from pathlib import Path import numpy as np import pytest -from anysolver.general_contact.native_multi_s3_static import CURVED_MATERIAL_PROFILE +from anyfesolver.general_contact.native_multi_s3_static import CURVED_MATERIAL_PROFILE def _analysis(**kwargs): @@ -46,7 +46,7 @@ def test_curved_s3_active_checkpoint_for_bounded_three_target_continuation(): def test_curved_s3_driver_forwards_cancellation_and_preserves_initial_prefix(): - from anysolver.control import CancellationToken + from anyfesolver.control import CancellationToken owner=_analysis(targets=(1.,));token=CancellationToken() initial=owner._checkpoint(()) owner._assemble=lambda *args:(np.zeros(owner.context.count+len(owner.initial.shell_displacement)), @@ -63,7 +63,7 @@ def injected(*args,**kwargs): def test_curved_s3_owner_uses_authoritative_path_increment_columns(): - from anysolver.control import CancellationToken,SolveCancelled + from anyfesolver.control import CancellationToken,SolveCancelled owner=_analysis(targets=(1.,));start=owner.initial.mechanical;u=owner.initial.shell_displacement step=np.zeros(owner.context.count+len(u));step[12:15]=(.001,-.002,.001) step[owner.context.count:]=np.linspace(.001,-.002,len(u)) @@ -82,7 +82,7 @@ def captured(pose,translations,angular,shell_increment,**kwargs): def test_shared_swept_wrapper_preserves_historical_subclass_dispatch(): - from anysolver.general_contact.native_multi_s3_static import NativeRetainedMultiS3Analysis + from anyfesolver.general_contact.native_multi_s3_static import NativeRetainedMultiS3Analysis # Exact wrapper contract check; historical subclass need not accept a token. class Historical: _curved_mode=False @@ -94,8 +94,8 @@ def _swept_admissible(self,*args): def test_curved_s3_checkpoint_binding_field_classification_and_valid_restore(): from hashlib import sha256 - from anysolver._ge_beam3_p5_seeded.core import canonical, sha - from anysolver._ge_beam3_p5_seeded.codec import _load + from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha + from anyfesolver._ge_beam3_p5_seeded.codec import _load owner=_analysis(targets=(1.,));initial=owner._checkpoint(()) # Matching valid checkpoint restore through the real caller: no target # trajectory is needed, the initial checkpoint already suffices. diff --git a/tests/test_general_contact_native_curved_s3_work.py b/tests/test_general_contact_native_curved_s3_work.py index d7b6cc06f..78b890c43 100644 --- a/tests/test_general_contact_native_curved_s3_work.py +++ b/tests/test_general_contact_native_curved_s3_work.py @@ -7,13 +7,13 @@ from numpy.polynomial.legendre import leggauss from scipy.spatial.transform import Rotation -from anysolver import create_shell_element -from anysolver.fe_core import FEModel -from anysolver.general_contact.s3_skin_work import S3SkinWorkAdapter -from anysolver.general_contact.native_material_s3 import NativeMaterialS3Patch -from anysolver.general_contact.native_curved_s3_work import NativeCurvedMaterialS3Work,PROFILE -from anysolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule -from anysolver.general_contact.native_surface_normal import StraightNormalIntegrationSettings +from anyfesolver import create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.s3_skin_work import S3SkinWorkAdapter +from anyfesolver.general_contact.native_material_s3 import NativeMaterialS3Patch +from anyfesolver.general_contact.native_curved_s3_work import NativeCurvedMaterialS3Work,PROFILE +from anyfesolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule +from anyfesolver.general_contact.native_surface_normal import StraightNormalIntegrationSettings from test_general_contact_native_retained_station import _reference from test_general_contact_native_surface_bounds import _independent_point @@ -119,8 +119,8 @@ def test_curved_s3_rejects_rim_inversion_mutation_and_unadmitted_path(): def test_curved_s3_whole_moving_path_and_endpoint_safe_hidden_target_collapse(): - from anysolver.general_contact.native_surface_s3_friction import NativeS3MaterialConfiguration - from anysolver.general_contact.native_surface_path import material_path_pose + from anyfesolver.general_contact.native_surface_s3_friction import NativeS3MaterialConfiguration + from anyfesolver.general_contact.native_surface_path import material_path_pose work,p,low,U,u=_case();start=NativeS3MaterialConfiguration(p,low,U,u) move=np.tile((.001,-.002,.001),(3,1));spin=np.array(((.002,-.001,.001),(-.001,.001,-.002))) du=np.linspace(.001,-.002,len(u)) @@ -142,8 +142,8 @@ def test_curved_s3_whole_moving_path_and_endpoint_safe_hidden_target_collapse(): def test_curved_s3_hidden_rim_crossing_gap_failure_caps_and_cancellation(): - from anysolver.general_contact.native_surface_s3_friction import NativeS3MaterialConfiguration - from anysolver.control import CancellationToken + from anyfesolver.general_contact.native_surface_s3_friction import NativeS3MaterialConfiguration + from anyfesolver.control import CancellationToken work,p,low,U,u=_case();start=NativeS3MaterialConfiguration(p,low,U,u) move=np.tile((0.,10.,0.),(3,1)) value=work.certify_path(start,move,np.zeros((2,3)),np.zeros_like(u), @@ -159,7 +159,7 @@ def test_curved_s3_hidden_rim_crossing_gap_failure_caps_and_cancellation(): def test_curved_s3_moving_normal_lever_preserves_exact_partition_at_large_origin(): - from anysolver.general_contact.native_curved_s3_work import _relative_center,_S3CandidateIntegration + from anyfesolver.general_contact.native_curved_s3_work import _relative_center,_S3CandidateIntegration work,p,low,U,u=_case();corners=work.shell.reference_positions.copy() candidate=_S3CandidateIntegration(work,corners) p=np.array(((0.,0.,-.06),(0.,0.,-.06),(1.,0.,-.06))) @@ -201,10 +201,10 @@ def test_curved_s3_axial_front_complete_target_work_and_independent_partition(): def test_curved_s3_complete_scaled_root_enclosure_with_large_tangential_lever(): - from anysolver.general_contact.native_curved_s3_work import _S3CandidateIntegration - from anysolver.general_contact.native_curved_geometry import curved_patch_geometry_control - from anysolver.general_contact.native_curved_plane_work import _projected_gap - from anysolver.general_contact.native_surface_quadrature import _prepare_reference_area + from anyfesolver.general_contact.native_curved_s3_work import _S3CandidateIntegration + from anyfesolver.general_contact.native_curved_geometry import curved_patch_geometry_control + from anyfesolver.general_contact.native_curved_plane_work import _projected_gap + from anyfesolver.general_contact.native_surface_quadrature import _prepare_reference_area work,p,low,U,u=_case() # Algebraic enclosure stress, deliberately OUTSIDE the finite facet. This # does not admit such a contact; its complete normal work must still bound. @@ -242,7 +242,7 @@ def test_curved_s3_complete_scaled_root_enclosure_with_large_tangential_lever(): def test_declared_arc_gradient_enclosure_endpoints_interior_and_cancellation(): - from anysolver.general_contact.native_curved_s3_work import _declared_arc_gradient_bound + from anyfesolver.general_contact.native_curved_s3_work import _declared_arc_gradient_bound # Independent scalar maximum: cancellation at the arc midpoint. delta=.3 bound=_declared_arc_gradient_bound(np.array([1.]),np.array([[1.,0.]]),(pi-delta,pi+delta)) @@ -265,7 +265,7 @@ def test_declared_arc_gradient_enclosure_endpoints_interior_and_cancellation(): def test_psd_difference_enclosure_noncommuting_and_general_remainder(): - from anysolver.general_contact.native_curved_s3_work import _psd_root_tangent_difference_bound + from anyfesolver.general_contact.native_curved_s3_work import _psd_root_tangent_difference_bound # Rank-one projections do not commute. Both are bounded by I, but their # difference is indefinite; eigenvalue order proves the common norm bound. A=np.array(((1.,0.),(0.,0.))) @@ -290,8 +290,8 @@ def test_psd_difference_enclosure_noncommuting_and_general_remainder(): def test_exact_axial_candidate_reuse_preserves_cancellation_and_cleanup(monkeypatch): from fractions import Fraction as F - from anysolver.general_contact.native_curved_s3_work import _S3CandidateIntegration - from anysolver.general_contact.native_curved_plane_work import NativeCurvedMaterialPlaneWork + from anyfesolver.general_contact.native_curved_s3_work import _S3CandidateIntegration + from anyfesolver.general_contact.native_curved_plane_work import NativeCurvedMaterialPlaneWork work,p,low,U,u=_case();candidate=_S3CandidateIntegration(work,work.shell.reference_positions) p+=np.array((1e12,-2e12,3e12));candidate.origin=np.array((1e12,-2e12,3e12)) low[:]=np.array((2e-9,-3e-8,7e-10)) @@ -318,7 +318,7 @@ def fake_evaluation(self,*args): def test_candidate_exact_reuse_bitwise_full_work_and_tangent_parity(monkeypatch): - from anysolver.general_contact.native_curved_s3_work import _S3CandidateIntegration,_relative_center + from anyfesolver.general_contact.native_curved_s3_work import _S3CandidateIntegration,_relative_center work,p,low,U,u=_case() cached=work.evaluate(p,low,U,u) monkeypatch.setattr(_S3CandidateIntegration,'_candidate_relative_center', diff --git a/tests/test_general_contact_native_curved_static.py b/tests/test_general_contact_native_curved_static.py index e55566afc..2a29e8e77 100644 --- a/tests/test_general_contact_native_curved_static.py +++ b/tests/test_general_contact_native_curved_static.py @@ -5,7 +5,7 @@ import pytest import numpy as np -from anysolver.general_contact.native_retained_static import CURVED_MATERIAL_PROFILE +from anyfesolver.general_contact.native_retained_static import CURVED_MATERIAL_PROFILE from examples.general_contact_native_curved_material_plane import analysis @@ -117,7 +117,7 @@ def test_curved_material_press_open_recontact(): def test_curved_material_authentic_split_restart_and_atomic_failure(): - from anysolver.control import CancellationToken + from anyfesolver.control import CancellationToken reference=Path(__file__).parent/'data/general_contact_native_curved_plane_v7.checkpoint' full=_canonical_fixture_payload(reference) owner=_analysis((1.,0.,1.));prefix=owner.solve(stop_after=1) diff --git a/tests/test_general_contact_native_deadline_scale.py b/tests/test_general_contact_native_deadline_scale.py index 8e886cba3..d2a5ef8aa 100644 --- a/tests/test_general_contact_native_deadline_scale.py +++ b/tests/test_general_contact_native_deadline_scale.py @@ -10,12 +10,12 @@ """ import pytest -import anysolver._ge_beam3_retained_fibre_state as fibre_state -from anysolver._ge_beam3_effective_deadline import ( +import anyfesolver._ge_beam3_retained_fibre_state as fibre_state +from anyfesolver._ge_beam3_effective_deadline import ( SCALE_VARIABLE, deadline_scale, effective_deadline_seconds) -from anysolver._ge_beam3_retained_fibre_state import Context -from anysolver._ge_beam3_seeded_load_program import ForceProgram -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver._ge_beam3_retained_fibre_state import Context +from anyfesolver._ge_beam3_seeded_load_program import ForceProgram +from anyfesolver.control import CancellationToken, SolveCancelled from test_ge_beam3_retained_fibre import make_model diff --git a/tests/test_general_contact_native_enforcement.py b/tests/test_general_contact_native_enforcement.py index a9a55685f..1dc66902a 100644 --- a/tests/test_general_contact_native_enforcement.py +++ b/tests/test_general_contact_native_enforcement.py @@ -6,10 +6,10 @@ import time import numpy as np import pytest -from anysolver.general_contact.native_s3_swept import native_s3_swept_admissible +from anyfesolver.general_contact.native_s3_swept import native_s3_swept_admissible from test_general_contact_native_multiple_s3_static import _example, rebuild, independent_energy -from anysolver.control import CancellationToken -from anysolver.general_contact import NativeContactActivationSettings +from anyfesolver.control import CancellationToken +from anyfesolver.general_contact import NativeContactActivationSettings def candidate(*, activation=False, beams=1, stiffness=1.2e6, targets=(.25,.5,.75,1.), activation_gap=1e-7): diff --git a/tests/test_general_contact_native_event_polynomial.py b/tests/test_general_contact_native_event_polynomial.py index 4ec5eedba..5968f662b 100644 --- a/tests/test_general_contact_native_event_polynomial.py +++ b/tests/test_general_contact_native_event_polynomial.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from anysolver.general_contact.native_event_polynomial import MaterialTimeNumerator, material_time_numerator +from anyfesolver.general_contact.native_event_polynomial import MaterialTimeNumerator, material_time_numerator from test_general_contact_native_surface_event_sequence import pulse @@ -55,7 +55,7 @@ def test_bad_time_range_refuses(): def test_affine_deformable_triangle_area_and_translating_round_surface(): - from anysolver.general_contact.native_surface_history import NativeSurfaceMotionSegment + from anyfesolver.general_contact.native_surface_history import NativeSurfaceMotionSegment field,pair,_history,_segment=pulse() corners=pair.target.adapter.current_positions(field.initial.shell_displacement) kx,ky,vz=.11,-.07,.001 @@ -88,7 +88,7 @@ def test_literal_target_material_weights_are_not_replaced_by_a_plane_corner(pert from decimal import localcontext from types import SimpleNamespace from dataclasses import replace - from anysolver.general_contact.s3_friction_point import S3SkinMaterialPoint + from anyfesolver.general_contact.s3_friction_point import S3SkinMaterialPoint field,pair,_history,segment=pulse() offset=.2 work=pair.target.adapter.work_map.toarray() diff --git a/tests/test_general_contact_native_fibre_pair_static.py b/tests/test_general_contact_native_fibre_pair_static.py index ba7be8d1b..3de545a21 100644 --- a/tests/test_general_contact_native_fibre_pair_static.py +++ b/tests/test_general_contact_native_fibre_pair_static.py @@ -4,9 +4,9 @@ import json,os,runpy import numpy as np import pytest -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver.control import CancellationToken -from anysolver.general_contact.native_retained_pair_static import FIBRE_WHOLE_PROFILE +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.control import CancellationToken +from anyfesolver.general_contact.native_retained_pair_static import FIBRE_WHOLE_PROFILE from test_general_contact_native_fibre_s3 import _independent_material_history @@ -43,7 +43,7 @@ def test_fibre_pair_family_binding_and_empty_restart(): def test_gap_step_control_affine_event_and_restart_binding(): - from anysolver.general_contact.native_retained_pair_static import _gap_limited_fraction + from anyfesolver.general_contact.native_retained_pair_static import _gap_limited_fraction # Exact scalar affine gap is independent of native search/force kernels. tolerance=5e-5;g0=.001;alpha=.5;gtrial=g0-.00556805556*alpha fraction=_gap_limited_fraction(alpha,g0,gtrial,tolerance) @@ -66,7 +66,7 @@ def test_gap_step_control_affine_event_and_restart_binding(): @pytest.mark.parametrize('gap_step_control',(False,True)) def test_gap_geometry_query_observes_cancellation_before_consumption(monkeypatch,gap_step_control): - from anysolver.control import SolveCancelled + from anyfesolver.control import SolveCancelled owner=_owner(gap_step_control=gap_step_control);token=CancellationToken() before=canonical(owner.initial.histories);raw=owner._checkpoint(()) def cancel_inside_geometry(*args,**kwargs): @@ -120,7 +120,7 @@ def test_saved_active_pair_gap_query_matches_mechanical_result(): reason='explicit saved candidate global chord certificate discriminator') def test_saved_active_pair_global_chord_gap_certificate(): import time - from anysolver.general_contact.beam_curve_pair import _source_interval_target_gap_lower + from anyfesolver.general_contact.beam_curve_pair import _source_interval_target_gap_lower raw=Path(os.environ['CONTACT_PAIR_SAVED_TRIAL']).read_bytes() owner=_owner(line_stiffness=4000.,gap_step_control=True) state=owner.context.make(json.loads(raw)) diff --git a/tests/test_general_contact_native_fibre_plastic_restart.py b/tests/test_general_contact_native_fibre_plastic_restart.py index a995a665a..f80dc9295 100644 --- a/tests/test_general_contact_native_fibre_plastic_restart.py +++ b/tests/test_general_contact_native_fibre_plastic_restart.py @@ -4,8 +4,8 @@ import json,os import numpy as np import pytest -from anysolver.control import CancellationToken -from anysolver._ge_beam3_p5_seeded.core import canonical,sha +from anyfesolver.control import CancellationToken +from anyfesolver._ge_beam3_p5_seeded.core import canonical,sha from test_general_contact_native_curved_s3_static import _analysis from test_general_contact_native_fibre_s3 import _independent_material_history diff --git a/tests/test_general_contact_native_fibre_results.py b/tests/test_general_contact_native_fibre_results.py index 8fcb91c63..dc815bfe8 100644 --- a/tests/test_general_contact_native_fibre_results.py +++ b/tests/test_general_contact_native_fibre_results.py @@ -5,8 +5,8 @@ import json,os import numpy as np import pytest -from anysolver.control import CancellationToken,SolveCancelled -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.control import CancellationToken,SolveCancelled +from anyfesolver._ge_beam3_p5_seeded.core import canonical from test_general_contact_native_curved_s3_static import _analysis from test_ge_beam3_fibre_section import exact_array,exact_pair,rational_fibre,integral @@ -106,7 +106,7 @@ def interrupted(self,*args,**kwargs): def test_cancellation_at_result_publication_returns_no_partial_report(monkeypatch): - import anysolver.general_contact.native_fibre_results as results + import anyfesolver.general_contact.native_fibre_results as results raw=_checkpoint();owner=_analysis(physical_fibres=True,plastic_fibres=True) token=CancellationToken();serialize=results.canonical;attempted=False initial=canonical(owner.initial.native_histories) @@ -122,7 +122,7 @@ def before_publication(value): def test_example_recovers_material_json_without_solving_new_target(monkeypatch,tmp_path,capsys): import examples.general_contact_native_curved_material_s3 as example - from anysolver.general_contact.native_multi_s3_static import NativeRetainedMultiS3Analysis + from anyfesolver.general_contact.native_multi_s3_static import NativeRetainedMultiS3Analysis source=Path(__file__).parent/'data/general_contact_native_fibre_s3_plastic_open_v1.checkpoint' output=tmp_path/'material.json' def forbidden_solve(*args,**kwargs):raise AssertionError('recovery must not advance the contact path') diff --git a/tests/test_general_contact_native_fibre_s3.py b/tests/test_general_contact_native_fibre_s3.py index d4639b98a..efb91e96e 100644 --- a/tests/test_general_contact_native_fibre_s3.py +++ b/tests/test_general_contact_native_fibre_s3.py @@ -4,8 +4,8 @@ import json,os import numpy as np import pytest -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver.general_contact.native_multi_s3_static import FIBRE_CURVED_MATERIAL_PROFILE +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.general_contact.native_multi_s3_static import FIBRE_CURVED_MATERIAL_PROFILE from test_general_contact_native_curved_s3_static import _analysis from test_general_contact_native_curved_static import _canonical_fixture_payload @@ -152,8 +152,8 @@ def test_fibre_contact_guards_consumed_caches(cache): def test_fibre_contact_expired_context_is_explicit_resource_failure(monkeypatch): - import anysolver._ge_beam3_retained_fibre_state as backend - from anysolver._ge_beam3_effective_deadline import effective_deadline_seconds + import anyfesolver._ge_beam3_retained_fibre_state as backend + from anyfesolver._ge_beam3_effective_deadline import effective_deadline_seconds owner=_analysis(targets=(1.,),physical_fibres=True) initial=owner.initial histories=canonical(initial.native_histories) @@ -167,7 +167,7 @@ def test_fibre_contact_expired_context_is_explicit_resource_failure(monkeypatch) @pytest.mark.parametrize('cancelled',(False,True)) def test_fibre_material_candidate_exception_and_cancellation_preserve_origin(monkeypatch,cancelled): - from anysolver.control import CancellationToken + from anyfesolver.control import CancellationToken owner=_analysis(targets=(1.,),physical_fibres=True);token=CancellationToken() before=owner._checkpoint(());history=canonical(owner.initial.native_histories) probe=owner.context._backend.probes[0];original=type(probe).evaluate @@ -184,7 +184,7 @@ def interrupted(self,*args,**kwargs): def test_fibre_contact_precancel_returns_unchanged_initial_state(): - from anysolver.control import CancellationToken + from anyfesolver.control import CancellationToken owner=_analysis(targets=(1.,),physical_fibres=True);before=owner._checkpoint(()) token=CancellationToken();token.cancel() run=owner.solve(cancellation_token=token) diff --git a/tests/test_general_contact_native_fine_lifecycle.py b/tests/test_general_contact_native_fine_lifecycle.py index 8f9550f3d..6d2ca485c 100644 --- a/tests/test_general_contact_native_fine_lifecycle.py +++ b/tests/test_general_contact_native_fine_lifecycle.py @@ -4,7 +4,7 @@ import json,os import numpy as np import pytest -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_p5_seeded.core import canonical from test_general_contact_native_curved_s3_static import _analysis from test_general_contact_native_fibre_s3 import _independent_material_history from test_general_contact_native_fibre_enforcement import _gap diff --git a/tests/test_general_contact_native_front_work_refinement.py b/tests/test_general_contact_native_front_work_refinement.py index 74cad67e7..49c6d66d5 100644 --- a/tests/test_general_contact_native_front_work_refinement.py +++ b/tests/test_general_contact_native_front_work_refinement.py @@ -22,14 +22,14 @@ import pytest from numpy.polynomial.legendre import leggauss -from anysolver.general_contact.native_curved_geometry import curved_patch_geometry_control -from anysolver.general_contact.native_curved_plane_work import NativeCurvedMaterialPlaneWork -from anysolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule -from anysolver.general_contact.native_surface_normal import StraightNormalIntegrationSettings +from anyfesolver.general_contact.native_curved_geometry import curved_patch_geometry_control +from anyfesolver.general_contact.native_curved_plane_work import NativeCurvedMaterialPlaneWork +from anyfesolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule +from anyfesolver.general_contact.native_surface_normal import StraightNormalIntegrationSettings from test_general_contact_native_retained_station import _reference from test_general_contact_native_surface_bounds import _independent_point -from anysolver.general_contact.native_curved_s3_work import _S3CandidateIntegration -from anysolver.general_contact.native_surface_quadrature import _prepare_reference_area +from anyfesolver.general_contact.native_curved_s3_work import _S3CandidateIntegration +from anyfesolver.general_contact.native_surface_quadrature import _prepare_reference_area from test_general_contact_native_curved_s3_static import _analysis RADIUS=.03 diff --git a/tests/test_general_contact_native_gap_jet_preparation.py b/tests/test_general_contact_native_gap_jet_preparation.py index 656fc2904..cdb451351 100644 --- a/tests/test_general_contact_native_gap_jet_preparation.py +++ b/tests/test_general_contact_native_gap_jet_preparation.py @@ -5,8 +5,8 @@ from pathlib import Path import numpy as np import pytest -from anysolver.general_contact import native_replay_arithmetic as arithmetic -from anysolver.general_contact import native_curved_s3_work as contact +from anyfesolver.general_contact import native_replay_arithmetic as arithmetic +from anyfesolver.general_contact import native_curved_s3_work as contact from test_general_contact_native_curved_s3_work import _case, _corners REFERENCE = Path(__file__).parent / 'fixtures' / 'native_gap_jet_reference' diff --git a/tests/test_general_contact_native_initial_guess.py b/tests/test_general_contact_native_initial_guess.py index 14421db29..9d27989e0 100644 --- a/tests/test_general_contact_native_initial_guess.py +++ b/tests/test_general_contact_native_initial_guess.py @@ -5,8 +5,8 @@ import json,os import numpy as np import pytest -from anysolver.control import CancellationToken -from anysolver._ge_beam3_p5_seeded.core import canonical,sha +from anyfesolver.control import CancellationToken +from anyfesolver._ge_beam3_p5_seeded.core import canonical,sha from test_general_contact_native_curved_s3_static import _analysis diff --git a/tests/test_general_contact_native_material_activation.py b/tests/test_general_contact_native_material_activation.py index 0525f3bce..51bc7a4b2 100644 --- a/tests/test_general_contact_native_material_activation.py +++ b/tests/test_general_contact_native_material_activation.py @@ -5,8 +5,8 @@ from pathlib import Path import numpy as np import pytest -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver.general_contact.native_activation_static import NativeContactActivationSettings +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.general_contact.native_activation_static import NativeContactActivationSettings from test_general_contact_native_material_s3 import _analysis, _accumulated, _two_analysis @@ -100,7 +100,7 @@ def test_yielding_full_load_cycle_and_exact_split_restart(): @pytest.mark.parametrize('cancel',(False,True)) def test_activation_query_exhaustion_or_cancellation_preserves_virgin_prefix(cancel,monkeypatch): - from anysolver.control import CancellationToken + from anyfesolver.control import CancellationToken owner=_analysis(native_yield=1e-5,stiffness=1e7, activation_settings=NativeContactActivationSettings(1e-6,256 if cancel else 1)) capsule=owner._checkpoint(());before=canonical(owner.initial.native_histories) @@ -137,9 +137,9 @@ def test_material_radius_hidden_crossing_limits_internal_rotation(): def test_multiple_pair_activation_uses_second_retained_block(): - from anysolver.general_contact import create_native_contact_analysis + from anyfesolver.general_contact import create_native_contact_analysis base=_two_analysis(targets=(.5,1.)) - from anysolver._ge_beam3_native_definition import NativeBeamDefinition + from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition owner=create_native_contact_analysis(tuple(NativeBeamDefinition(raw) for raw in base.native._definitions), tuple(base.native.model.boundary_conditions),base.program,base.shell_model,base.pairs, equilibrium_tolerance=1e-10,activation_settings=NativeContactActivationSettings(1e-6,256)) @@ -176,9 +176,9 @@ def test_activation_budget_must_lie_inside_physical_gap_tolerance(gap): def test_multiple_material_facets_activation_cycle_and_staged_rollback(monkeypatch): - from anysolver.general_contact import create_native_contact_analysis - from anysolver._ge_beam3_native_definition import NativeBeamDefinition - from anysolver.control import CancellationToken + from anyfesolver.general_contact import create_native_contact_analysis + from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition + from anyfesolver.control import CancellationToken base=_two_analysis(facets=2) def make(): return create_native_contact_analysis(tuple(NativeBeamDefinition(raw) for raw in base.native._definitions), diff --git a/tests/test_general_contact_native_material_plane.py b/tests/test_general_contact_native_material_plane.py index dee1acab8..900410d04 100644 --- a/tests/test_general_contact_native_material_plane.py +++ b/tests/test_general_contact_native_material_plane.py @@ -12,14 +12,14 @@ from scipy.optimize import brentq from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_retained_nodal_loading import NodalDeadForces,Program -from anysolver.general_contact.native_material_plane import NativeRoundMaterialPlane,PROFILE -from anysolver.general_contact.native_retained_static import NativeRetainedRoundPlaneAnalysis -from anysolver.general_contact.native_surface_normal import StraightNormalIntegrationSettings -from anysolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_retained_nodal_loading import NodalDeadForces,Program +from anyfesolver.general_contact.native_material_plane import NativeRoundMaterialPlane,PROFILE +from anyfesolver.general_contact.native_retained_static import NativeRetainedRoundPlaneAnalysis +from anyfesolver.general_contact.native_surface_normal import StraightNormalIntegrationSettings +from anyfesolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule from test_general_contact_native_retained_station import _reference from test_ge_beam3_native_generalized_modal import make @@ -137,7 +137,7 @@ def test_material_patch_moves_at_fixed_external_nodes_and_rejects_wrong_geometry def test_shared_s3_normal_route_preserves_both_body_work_and_tangent(): - from anysolver.general_contact.native_surface_normal import integrate_straight_normal + from anyfesolver.general_contact.native_surface_normal import integrate_straight_normal from test_general_contact_native_surface_s3_friction import _case,_moved _,pair,pose,_=_case();kernel=_kernel() plane=kernel.evaluate(pose.positions,pose.position_low,pose.cell_rotations) @@ -220,7 +220,7 @@ def test_swept_material_radius_detects_hidden_rotational_gap_pulse(): def test_unresolved_angular_grazing_fails_before_quadrature(monkeypatch): from fractions import Fraction from math import hypot - import anysolver.general_contact.native_material_plane as module + import anyfesolver.general_contact.native_material_plane as module owner=_analysis();kernel=NativeRoundMaterialPlane(owner.contact.rule, plane_origin_m=(0.,0.,-.05),plane_normal=(0.,0.,1.), normal_stiffness_Pa_per_m=1e7,integration_settings=_settings()) @@ -246,7 +246,7 @@ def test_explicit_area_penalty_sensitivity_reduces_independent_gap(): for stiffness in (1e6,1e7): owner=_analysis(normal_stiffness=stiffness);run=owner.solve() if run.status!='completed' and os.environ.get('CONTACT_MATERIAL_PENALTY_RECORD'): - from anysolver._ge_beam3_p5_seeded.core import canonical + from anyfesolver._ge_beam3_p5_seeded.core import canonical Path(os.environ['CONTACT_MATERIAL_PENALTY_RECORD']).write_bytes(canonical(dict( scope='failed declared penalty sensitivity; no acceptance',prior_rows=rows, status=run.status,failure=run.failure,normal_stiffness_Pa_per_m=stiffness, @@ -264,7 +264,7 @@ def test_explicit_area_penalty_sensitivity_reduces_independent_gap(): def test_common_rigid_transform_preserves_material_surface_work(): - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry original=_kernel();positions=original.reference.coordinates.copy();positions[:,2]-=.02 rotations=np.tile(np.eye(3),(2,1,1));rotations[0]=Rotation.from_rotvec((.02,-.03,.01)).as_matrix() value=original.evaluate(positions,np.zeros((3,3)),rotations) @@ -285,7 +285,7 @@ def test_common_rigid_transform_preserves_material_surface_work(): @pytest.mark.parametrize('cancel',(False,True)) def test_precommit_exception_and_cancellation_preserve_accepted_material_origin(cancel): - from anysolver.control import CancellationToken + from anyfesolver.control import CancellationToken first=_analysis().solve(stop_after=1);assert first.status=='paused',first.failure owner=_analysis();record=owner._record;token=CancellationToken() def failing(target,*args): diff --git a/tests/test_general_contact_native_material_plane_diagnosis.py b/tests/test_general_contact_native_material_plane_diagnosis.py index ab0a7412e..1d22ce436 100644 --- a/tests/test_general_contact_native_material_plane_diagnosis.py +++ b/tests/test_general_contact_native_material_plane_diagnosis.py @@ -43,7 +43,7 @@ def observed_sweep(start,increment,end,first,last): path=os.environ.get('CONTACT_MATERIAL_DIAGNOSIS_RECORD') assert path and records # JSON-safe native canonical payload, including full failed state for review. - from anysolver._ge_beam3_p5_seeded.core import canonical + from anyfesolver._ge_beam3_p5_seeded.core import canonical Path(path).write_bytes(canonical(dict(scope='diagnosis, not accepted equilibrium', status=run.status,failure=run.failure,accepted_targets=run.accepted.completed_targets, gap_tolerance_m=owner.gap_tolerance,fd_errors=fd_errors,records=records,swept=swept))) diff --git a/tests/test_general_contact_native_material_plane_front_diagnosis.py b/tests/test_general_contact_native_material_plane_front_diagnosis.py index a0fdc45f6..c3431b99f 100644 --- a/tests/test_general_contact_native_material_plane_front_diagnosis.py +++ b/tests/test_general_contact_native_material_plane_front_diagnosis.py @@ -5,8 +5,8 @@ import numpy as np import pytest from numpy.polynomial.legendre import leggauss -from anysolver._ge_beam3_mixed_ad import Jet2 -from anysolver.general_contact.native_surface_normal import _material_cell_normal_data +from anyfesolver._ge_beam3_mixed_ad import Jet2 +from anyfesolver.general_contact.native_surface_normal import _material_cell_normal_data from test_general_contact_native_material_plane import _analysis diff --git a/tests/test_general_contact_native_material_s3.py b/tests/test_general_contact_native_material_s3.py index 00bef9abb..a37e16248 100644 --- a/tests/test_general_contact_native_material_s3.py +++ b/tests/test_general_contact_native_material_s3.py @@ -10,19 +10,19 @@ from scipy.optimize import brentq from scipy.spatial.transform import Rotation from numpy.testing import assert_allclose -from anysolver import create_shell_element -from anysolver.boundary import BoundaryCondition,FixedSupport -from anysolver.fe_core import FEModel -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_retained_nodal_loading import NodalDeadForces,Program -from anysolver.general_contact.native_material_s3 import ( +from anyfesolver import create_shell_element +from anyfesolver.boundary import BoundaryCondition,FixedSupport +from anyfesolver.fe_core import FEModel +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_retained_nodal_loading import NodalDeadForces,Program +from anyfesolver.general_contact.native_material_s3 import ( NativeMaterialS3Patch,NativeRetainedMaterialS3Work,PROFILE) -from anysolver.general_contact.native_retained_s3_static import NativeRetainedRoundS3Analysis -from anysolver.general_contact.native_surface_normal import StraightNormalIntegrationSettings -from anysolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule -from anysolver.general_contact.s3_skin_work import S3SkinWorkAdapter +from anyfesolver.general_contact.native_retained_s3_static import NativeRetainedRoundS3Analysis +from anyfesolver.general_contact.native_surface_normal import StraightNormalIntegrationSettings +from anyfesolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule +from anyfesolver.general_contact.s3_skin_work import S3SkinWorkAdapter from test_ge_beam3_native_generalized_modal import make @@ -42,7 +42,7 @@ def _two_analysis(**kwargs): def test_multiple_material_facets_complete_work_and_retained_response(): - from anysolver.general_contact.native_multi_s3_static import MATERIAL_MULTIPATCH_PROFILE + from anyfesolver.general_contact.native_multi_s3_static import MATERIAL_MULTIPATCH_PROFILE owner=_two_analysis(facets=2,targets=(.25,.5,.75,1.));n=owner.context.count assert n==84 and owner.shell_stiffness.shape==(36,36) and len(owner.pairs)==3 step=np.zeros(n) @@ -169,7 +169,7 @@ def energy(mechanical,displacement): def test_two_native_material_patches_shared_deformable_target(): - from anysolver.general_contact.native_multi_s3_static import MATERIAL_PROFILE + from anyfesolver.general_contact.native_multi_s3_static import MATERIAL_PROFILE owner=_two_analysis(targets=(.25,.5,.75,1.));run=owner.solve() assert run.status=='completed',run.failure assert run.profile==MATERIAL_PROFILE and owner.context.count==84 @@ -243,8 +243,8 @@ def test_second_material_patch_hidden_rotation_uses_its_own_retained_block(): def test_material_multi_profile_explicit_activation_and_rejects_mixed_or_legacy_controller(): - from anysolver.general_contact import create_native_contact_analysis,NativeS3ContactPair - from anysolver.general_contact.native_activation_static import NativeActivationMultiS3Analysis,NativeContactActivationSettings + from anyfesolver.general_contact import create_native_contact_analysis,NativeS3ContactPair + from anyfesolver.general_contact.native_activation_static import NativeActivationMultiS3Analysis,NativeContactActivationSettings from test_general_contact_native_retained_s3_static import _analysis as legacy owner=_two_analysis(targets=(.5,1.));args=(tuple(NativeBeamDefinition(raw) for raw in owner.native._definitions), tuple(owner.native.model.boundary_conditions),owner.program,owner.shell_model) @@ -262,8 +262,8 @@ def test_material_multi_profile_explicit_activation_and_rejects_mixed_or_legacy_ @pytest.mark.parametrize('cancel',(False,True)) def test_two_material_owner_staging_and_incompatible_restart(cancel): from dataclasses import replace - from anysolver.control import CancellationToken - from anysolver.general_contact import create_native_contact_analysis + from anyfesolver.control import CancellationToken + from anyfesolver.general_contact import create_native_contact_analysis first=_two_analysis(targets=(.25,.5,.75,1.)).solve(stop_after=1) assert first.status=='paused',first.failure owner=_two_analysis(targets=(.25,.5,.75,1.));checkpoint=owner._checkpoint;token=CancellationToken() @@ -317,8 +317,8 @@ def _analysis(*,force=-.005,targets=(.5,1.),stiffness=1e6,radius=.05, native,_,inertias=make(False,clamped=True,coupled=False) element=native.mesh.elements[1] if native_yield!=1e6: - from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection - from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement + from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection + from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement law=EllipsoidalGeneralizedSection(element.section.elastic,element.section.metric,native_yield, element.section.hardening) element=NativeGeneralizedStaticElement(1,(1,2,3),element.operator.reference,law,order=4) @@ -375,7 +375,7 @@ def test_material_skin_rejects_unadmitted_negative_director_polarity(): def _accumulated(history): - from anysolver._ge_beam3_p5_seeded.core import canonical + from anyfesolver._ge_beam3_p5_seeded.core import canonical def values(value): if isinstance(value,dict): if 'accumulated' in value:return [sum(value['accumulated'])] @@ -387,7 +387,7 @@ def values(value): @pytest.mark.parametrize('stiffness',(1e6,1e7)) def test_yielding_fixture_failure_preserves_last_accepted_state(stiffness): - from anysolver._ge_beam3_p5_seeded.core import canonical + from anyfesolver._ge_beam3_p5_seeded.core import canonical kwargs=dict(targets=(.25,.5,.75,1.),native_yield=1e-5,stiffness=stiffness) owner=_analysis(**kwargs);run=owner.solve() assert run.status=='failed' and 'line-search/gap limit' in run.failure @@ -422,7 +422,7 @@ def test_yielding_fixture_failure_preserves_last_accepted_state(stiffness): def test_plastic_branch_complete_owner_tangent_and_disposable_history(): - from anysolver._ge_beam3_p5_seeded.core import canonical + from anyfesolver._ge_beam3_p5_seeded.core import canonical owner=_analysis(native_yield=1e-5,shell_z=-.05001) origins=owner.initial.native_histories;captured=canonical(origins) step=np.zeros(42);step[8]=-2e-5;step[14]=-3e-5 @@ -452,7 +452,7 @@ def test_plastic_branch_complete_owner_tangent_and_disposable_history(): def test_bounded_plastic_unload_reload_history_and_split_restart(): - from anysolver._ge_beam3_p5_seeded.core import canonical + from anyfesolver._ge_beam3_p5_seeded.core import canonical kwargs=dict(targets=(.25,.5,.75,0.,.25,.5,.75),native_yield=1e-5,stiffness=1e6) owner=_analysis(**kwargs);run=owner.solve() output=os.environ.get('CONTACT_MATERIAL_PLASTIC_RECORD') @@ -650,7 +650,7 @@ def test_fixed_nodes_hidden_rotational_gap_requires_material_radius_bound(): g0,r0=query(start);g1,r1=query(end) assert g0>0. and g1>0. and query(owner.context.advance(start,.5*step[:42]))[0]>0. assert query(owner.context.advance(start,.25*step[:42]))[0]<-owner.gap_tolerance - from anysolver.general_contact.native_s3_swept import native_s3_swept_admissible + from anyfesolver.general_contact.native_s3_swept import native_s3_swept_admissible # Reproduce the zero-motion bound defect in an isolated helper call. assert native_s3_swept_admissible(owner.context,owner.contact,0,owner.gap_tolerance,128, owner._recoverable_trial_error,start,u,step,end,u,g0,g1,r0,r1, @@ -673,7 +673,7 @@ def test_hidden_rotation_crosses_finite_target_edge_with_open_normal_gap(): def test_reference_orientation_hidden_inversion_is_not_start_normal_admission(): from types import SimpleNamespace as NS - from anysolver.general_contact.native_s3_swept import native_s3_swept_admissible + from anyfesolver.general_contact.native_s3_swept import native_s3_swept_admissible first=np.array(((0.,0.,0.),(0.,1.,0.),(-3/16,0.,1.))) last=np.array(((0.,0.,0.),(1.,1.,0.),(13/16,1.,1.))) def cross(t): @@ -698,8 +698,8 @@ def cross(t): def test_normal_material_owner_rejects_existing_friction_bridge(): - from anysolver.general_contact.native_surface_contributor import NativeS3MaterialContributor - from anysolver.general_contact.native_surface_s3_friction import NativeS3MaterialPointFriction + from anyfesolver.general_contact.native_surface_contributor import NativeS3MaterialContributor + from anyfesolver.general_contact.native_surface_s3_friction import NativeS3MaterialPointFriction from test_general_contact_native_retained_s3_static import _analysis as legacy owner=_analysis();work=owner.contact pair=NativeS3MaterialPointFriction(work.contact.rule.samples[0].station,work.target, @@ -716,7 +716,7 @@ def test_normal_material_owner_rejects_existing_friction_bridge(): @pytest.mark.parametrize('cancel',(False,True)) def test_staging_failure_preserves_native_and_deformable_shell_prefix(cancel): - from anysolver.control import CancellationToken + from anyfesolver.control import CancellationToken first=_analysis().solve(stop_after=1);assert first.status=='paused',first.failure owner=_analysis();checkpoint=owner._checkpoint;token=CancellationToken() def staged(records): diff --git a/tests/test_general_contact_native_multiple_s3_static.py b/tests/test_general_contact_native_multiple_s3_static.py index 3ef1dd4c6..80e044ac7 100644 --- a/tests/test_general_contact_native_multiple_s3_static.py +++ b/tests/test_general_contact_native_multiple_s3_static.py @@ -9,11 +9,11 @@ import numpy as np import pytest from scipy.integrate import quad -from anysolver._ge_beam3_p5_seeded.core import sha -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver.general_contact import create_native_contact_analysis -from anysolver.general_contact.native_s3_swept import native_s3_swept_admissible -from anysolver.control import CancellationToken +from anyfesolver._ge_beam3_p5_seeded.core import sha +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver.general_contact import create_native_contact_analysis +from anyfesolver.general_contact.native_s3_swept import native_s3_swept_admissible +from anyfesolver.control import CancellationToken _path = Path(__file__).resolve().parents[1]/'examples/general_contact_native_multiple_s3_static.py' _spec = importlib.util.spec_from_file_location('native_multiple_s3_example', _path) @@ -157,7 +157,7 @@ def test_consumed_map_and_resources_are_bound(): def test_new_factory_lazy_public_exports(): - from anysolver.general_contact import NativeS3ContactPair + from anyfesolver.general_contact import NativeS3ContactPair assert NativeS3ContactPair is type(_example.analysis().pairs[0]) @@ -245,19 +245,19 @@ def test_runnable_two_beam_example(capsys): def test_ordinary_static_route_keeps_new_native_owner_unloaded(): code='''import os, sys from pathlib import Path -import anysolver -assert Path(anysolver.__file__).resolve().is_relative_to(Path(os.environ['CONTACT_SOLVER_EXPECTED_ROOT'])) -assert 'anysolver.general_contact' not in sys.modules -from anysolver.boundary import LoadCase -from anysolver.mesh_gen import generate_beam_mesh +import anyfesolver +assert Path(anyfesolver.__file__).resolve().is_relative_to(Path(os.environ['CONTACT_SOLVER_EXPECTED_ROOT'])) +assert 'anyfesolver.general_contact' not in sys.modules +from anyfesolver.boundary import LoadCase +from anyfesolver.mesh_gen import generate_beam_mesh model=generate_beam_mesh(1.,num_divisions=1) load=LoadCase('axial');load.add_nodal_load(2,[10.,0.,0.,0.,0.,0.]) -run=anysolver.solve_static_nonlinear(model,load,num_steps=1,max_iterations=5) +run=anyfesolver.solve_static_nonlinear(model,load,num_steps=1,max_iterations=5) assert run.status=='completed',run.failure_reason -assert 'anysolver.general_contact.native_multi_s3_static' not in sys.modules +assert 'anyfesolver.general_contact.native_multi_s3_static' not in sys.modules ''' env=os.environ.copy() - env.setdefault('CONTACT_SOLVER_EXPECTED_ROOT',str(Path(__file__).resolve().parents[1]/'src/anysolver')) + env.setdefault('CONTACT_SOLVER_EXPECTED_ROOT',str(Path(__file__).resolve().parents[1]/'src/anyfesolver')) env.setdefault('PYTHONPATH',str(Path(__file__).resolve().parents[1]/'src')) run=subprocess.run([sys.executable,'-c',code],env=env,capture_output=True,text=True,timeout=30) assert run.returncode==0,run.stdout+run.stderr diff --git a/tests/test_general_contact_native_normal_angles.py b/tests/test_general_contact_native_normal_angles.py index 2dc604f8b..714a0f214 100644 --- a/tests/test_general_contact_native_normal_angles.py +++ b/tests/test_general_contact_native_normal_angles.py @@ -6,7 +6,7 @@ import json import pytest import numpy as np -from anysolver.general_contact.native_normal_angles import PreciseNormalAngles +from anyfesolver.general_contact.native_normal_angles import PreciseNormalAngles @pytest.mark.parametrize('slope',(0.,1e-20,-1e-20)) @@ -44,8 +44,8 @@ def test_constant_angular_gap_does_not_create_roots(): def test_positive_quadrature_measure_underflow_cannot_report_zero_work(): - from anysolver._ge_beam3_mixed_ad import Jet2 - from anysolver.general_contact.native_surface_normal import ( + from anyfesolver._ge_beam3_mixed_ad import Jet2 + from anyfesolver.general_contact.native_surface_normal import ( StraightNormalIntegrationSettings, _integrate_material_normal_data) minimum=float(np.nextafter(0.,1.)) with localcontext() as ctx: diff --git a/tests/test_general_contact_native_normal_angles_kernel.py b/tests/test_general_contact_native_normal_angles_kernel.py index ea5999c81..ef1fc9f79 100644 --- a/tests/test_general_contact_native_normal_angles_kernel.py +++ b/tests/test_general_contact_native_normal_angles_kernel.py @@ -4,7 +4,7 @@ from math import pi from pathlib import Path import pytest -from anysolver.general_contact import native_normal_angles as angles +from anyfesolver.general_contact import native_normal_angles as angles def _reference_sincos(angle): @@ -319,7 +319,7 @@ def test_certified_early_completion_engages_and_directed_modes_never_certify(): def test_fresh_source_import_raises_no_flags_or_traps_in_adversarial_contexts(): from decimal import (Clamped, DivisionByZero, FloatOperation, Overflow, Rounded, Subnormal, Underflow) - source = (Path(__file__).resolve().parents[1]/'src'/'anysolver' + source = (Path(__file__).resolve().parents[1]/'src'/'anyfesolver' /'general_contact'/'native_normal_angles.py').read_text(encoding='utf-8') all_traps = (Inexact, Rounded, Underflow, Subnormal, Clamped, Overflow, DivisionByZero, InvalidOperation, FloatOperation) diff --git a/tests/test_general_contact_native_pair_gap_geometry.py b/tests/test_general_contact_native_pair_gap_geometry.py index a817bf28f..b8032266f 100644 --- a/tests/test_general_contact_native_pair_gap_geometry.py +++ b/tests/test_general_contact_native_pair_gap_geometry.py @@ -4,11 +4,11 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_centered_reference import ( +from anyfesolver._ge_beam3_centered_reference import ( CenteredCurvedBeam3ReferenceGeometry, ) -from anysolver.general_contact import native_retained_whole_pair as pair_module -from anysolver.general_contact.native_retained_whole_pair import ( +from anyfesolver.general_contact import native_retained_whole_pair as pair_module +from anyfesolver.general_contact.native_retained_whole_pair import ( NativeRetainedWholeCurvePair, ) diff --git a/tests/test_general_contact_native_pooled_budget.py b/tests/test_general_contact_native_pooled_budget.py index 5a1522fb4..65ec6754c 100644 --- a/tests/test_general_contact_native_pooled_budget.py +++ b/tests/test_general_contact_native_pooled_budget.py @@ -7,16 +7,16 @@ import numpy as np import pytest -from anysolver.general_contact.native_pair_error_budget import PooledQuadratureBudget, within_reserve -from anysolver.general_contact.native_retained_whole_pair import ( +from anyfesolver.general_contact.native_pair_error_budget import PooledQuadratureBudget, within_reserve +from anyfesolver.general_contact.native_retained_whole_pair import ( NativeRetainedWholeCurvePair, _exact_tiny_cell_omission_bound, _private_factored_gap, _pooled_connected_junction_partition, _pooled_interval_open, _pooled_endpoint_feature_inventory, _vertex_fixed_projection_feature, ) -from anysolver.general_contact.native_retained_body_projection import strict_projection_station, charged_junction_omission -from anysolver.general_contact.beam_curve_pair import b3_distance_jet, _b3_distance_jet_at_station -from anysolver.general_contact.native_curved_pair_partition import physical_point_map -from anysolver._ge_beam3_connected_dynamic import _RetainedMidpointAssembly +from anyfesolver.general_contact.native_retained_body_projection import strict_projection_station, charged_junction_omission +from anyfesolver.general_contact.beam_curve_pair import b3_distance_jet, _b3_distance_jet_at_station +from anyfesolver.general_contact.native_curved_pair_partition import physical_point_map +from anyfesolver._ge_beam3_connected_dynamic import _RetainedMidpointAssembly from examples.general_contact_native_pair_impact_dev import build, config @@ -179,7 +179,7 @@ def test_saved_arbitrary_stage_exact_vertex_kkt_discriminator(): This passes only exact inventory/provenance checks, not the unmet FD gate. A genuine two-interior label explicitly preserves mature fallback needs. """ - from anysolver.general_contact.native_retained_body_projection import endpoint_projection_bands + from anyfesolver.general_contact.native_retained_body_projection import endpoint_projection_bands inventory = _oracle_inventory owner = build(); accepted = owner.initialize(physical_velocity=config(owner).initial_velocity) direction = np.sin(np.arange(owner.size)+.3); direction[list(owner.p)] *= 100. diff --git a/tests/test_general_contact_native_replay_arithmetic.py b/tests/test_general_contact_native_replay_arithmetic.py index bded61009..3bc7d23b4 100644 --- a/tests/test_general_contact_native_replay_arithmetic.py +++ b/tests/test_general_contact_native_replay_arithmetic.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from anysolver.general_contact import native_replay_arithmetic as arithmetic +from anyfesolver.general_contact import native_replay_arithmetic as arithmetic @pytest.mark.parametrize('fallback', [False, True]) @@ -78,7 +78,7 @@ def unavailable(*args, **kwargs): @pytest.mark.parametrize('station', [0., .37, 1.]) def test_curve_position_and_derivatives_use_fixed_fused_chain(station): - from anysolver.general_contact.beam_curve_pair import _curve + from anyfesolver.general_contact.beam_curve_pair import _curve epsilon = 2.**-27 positions = np.array(((1.+epsilon, -1., 0.), (-1., 1.-epsilon, 2.**-1022), @@ -103,7 +103,7 @@ def test_curve_position_and_derivatives_use_fixed_fused_chain(station): def test_endpoint_projection_cuts_use_fixed_coefficient_reductions(): from decimal import Decimal, localcontext - from anysolver.general_contact.beam_curve_pair import _curve, _endpoint_projection_cuts + from anyfesolver.general_contact.beam_curve_pair import _curve, _endpoint_projection_cuts source = np.array(((0., .11, .01), (1., .1101, .011), (2., .11, .01))) target = np.array(((1., 0., 0.), (2., .01, .002), (3., 0., 0.))) linear = -3*source[0]+4*source[1]-source[2] diff --git a/tests/test_general_contact_native_replay_diagnostics.py b/tests/test_general_contact_native_replay_diagnostics.py index 1056a1765..2221bf922 100644 --- a/tests/test_general_contact_native_replay_diagnostics.py +++ b/tests/test_general_contact_native_replay_diagnostics.py @@ -11,8 +11,8 @@ import pytest -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver.general_contact.native_replay_diagnostics import ( +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.general_contact.native_replay_diagnostics import ( LEAF_COUNT_LIMIT, PATH_LIMIT, PLAIN_COMPONENT_LIMIT, diff --git a/tests/test_general_contact_native_retained_body_junction.py b/tests/test_general_contact_native_retained_body_junction.py index 7a980efd9..ccfeb06d4 100644 --- a/tests/test_general_contact_native_retained_body_junction.py +++ b/tests/test_general_contact_native_retained_body_junction.py @@ -14,7 +14,7 @@ def test_first_newton_trial_descriptor(): candidate=owner.context.advance(state,step) report={'mechanical':candidate.descriptor(),'initial_metrics':metrics, 'step_norm':float(np.linalg.norm(step)),'correction':float(correction)} - from anysolver.general_contact.native_retained_pair_static import _gap_limited_fraction + from anyfesolver.general_contact.native_retained_pair_static import _gap_limited_fraction fraction=1. for _ in range(2): candidate=owner.context.advance(state,fraction*step) @@ -34,7 +34,7 @@ def test_first_newton_trial_descriptor(): @pytest.mark.skipif(os.environ.get("CONTACT_NATIVE_BODY_DIAGNOSTIC")!="1",reason="explicit bounded evidence selector") def test_saved_trial_junction_stationarity_inventory(): - from anysolver.general_contact.native_curved_pair_partition import _exact_curve,_dot + from anyfesolver.general_contact.native_curved_pair_partition import _exact_curve,_dot owner=analysis() raw=json.loads(((Path(__file__).parent/'data/general_contact_native_retained_body_trial_v1.json')).read_text()) pose=owner.context.make(raw['mechanical']);states=owner.contact._states(pose) @@ -53,8 +53,8 @@ def test_saved_trial_junction_stationarity_inventory(): @pytest.mark.skipif(os.environ.get("CONTACT_NATIVE_BODY_DIAGNOSTIC")!="1",reason="explicit bounded evidence selector") def test_saved_candidate_independent_projection_and_bounds(): - from anysolver.general_contact.native_retained_whole_pair import _active_gap_correspondence_upper,_exact_tiny_cell_omission_bound - from anysolver.general_contact.beam_curve_pair import _source_interval_target_gap_lower + from anyfesolver.general_contact.native_retained_whole_pair import _active_gap_correspondence_upper,_exact_tiny_cell_omission_bound + from anyfesolver.general_contact.beam_curve_pair import _source_interval_target_gap_lower owner=analysis();raw=json.loads((Path(__file__).parent/'data/general_contact_native_retained_body_trial_v1.json').read_text()) pose=owner.context.make(raw['mechanical']);states=owner.contact._states(pose) source=states[owner.contact.chains[0][0]].positions;target=states[owner.contact.chains[1][0]].positions @@ -102,8 +102,8 @@ def test_saved_trial_complete_contact_after_open_proof(): @pytest.mark.skipif(os.environ.get('CONTACT_NATIVE_BODY_DIAGNOSTIC')!='1',reason='explicit bounded evidence selector') def test_saved_front_exact_gap_resolution(): - from anysolver.general_contact.native_curved_pair_partition import _exact_curve,_dot,_convexity_lower - from anysolver.general_contact.beam_curve_pair import b3_distance_jet,closest_on_b3,_curve,_bezier_controls + from anyfesolver.general_contact.native_curved_pair_partition import _exact_curve,_dot,_convexity_lower + from anyfesolver.general_contact.beam_curve_pair import b3_distance_jet,closest_on_b3,_curve,_bezier_controls from fractions import Fraction owner=analysis();raw=json.loads((Path(__file__).parent/'data/general_contact_native_retained_body_trial_v1.json').read_text()) pose=owner.context.make(raw['mechanical']);states=owner.contact._states(pose) @@ -120,13 +120,13 @@ def test_saved_front_exact_gap_resolution(): rows.append(dict(station=s,float_gap=b3_distance_jet(source,target,s,.1,source_is_a=True).gap,robust_feasible_gap=robust,stationarity_distance_surplus=surplus)) Path(os.environ['CONTACT_APP_RESULT_RECORD']).write_text(json.dumps(rows,indent=2)) assert all(row['stationarity_distance_surplus']<1e-27 for row in rows) - from anysolver.general_contact.native_retained_whole_pair import _private_interval_open + from anyfesolver.general_contact.native_retained_whole_pair import _private_interval_open assert all(_private_interval_open(source,states[cell].positions,.4456420884005717,.44564208840057173,.1) for cell in owner.contact.chains[1][:2]) @pytest.mark.skipif(os.environ.get('CONTACT_NATIVE_BODY_DIAGNOSTIC')!='1',reason='explicit bounded evidence selector') def test_factored_gap_independent_straight_law(): - from anysolver.general_contact.native_retained_whole_pair import _private_factored_gap + from anyfesolver.general_contact.native_retained_whole_pair import _private_factored_gap source=np.array(((0.,0.,0.),(.5,0.,0.),(1.,0.,0.))) for delta in (-2e-5,-1e-10,1e-10,2e-5): target=source.copy();target[:,1]=.1+delta @@ -137,7 +137,7 @@ def test_factored_gap_independent_straight_law(): def test_factored_offstation_lower_encloses_true_minimum(): - from anysolver.general_contact.native_retained_whole_pair import _private_factored_gap + from anyfesolver.general_contact.native_retained_whole_pair import _private_factored_gap source=np.array(((0.,0.,0.),(.5,0.,0.),(1.,0.,0.))) target=source.copy();target[:,1]=.09998 lower,upper,_=_private_factored_gap(source,target,.37,.1,target_station=.3701) diff --git a/tests/test_general_contact_native_retained_body_pair.py b/tests/test_general_contact_native_retained_body_pair.py index 582bf471b..8063126fa 100644 --- a/tests/test_general_contact_native_retained_body_pair.py +++ b/tests/test_general_contact_native_retained_body_pair.py @@ -6,8 +6,8 @@ import numpy as np import pytest from examples.general_contact_native_retained_body_pair import analysis -from anysolver.general_contact.native_retained_body_pair import omitted_cell_dominated -from anysolver.general_contact.native_replay_diagnostics import replay_difference_message +from anyfesolver.general_contact.native_retained_body_pair import omitted_cell_dominated +from anyfesolver.general_contact.native_replay_diagnostics import replay_difference_message def test_complete_line_potential_work_crossblocks_and_refusals(): @@ -44,7 +44,7 @@ def test_endpoint_plateau_refusal_and_internal_motion(): def test_default_saved_curved_energy_and_identity(): from test_general_contact_native_curved_fibre_pair_static import _curved_owner, _saved_curved_fixture - from anysolver._ge_beam3_p5_seeded.codec import _load + from anyfesolver._ge_beam3_p5_seeded.codec import _load owner=_curved_owner() raw,_=_saved_curved_fixture() capsule=_load(raw.decode('ascii')) @@ -56,7 +56,7 @@ def test_default_saved_curved_energy_and_identity(): mechanical=owner.context.make(record['mechanical'],decoded=True) _,replayed=owner._record(record['target'],mechanical,owner.initial.histories, record['previous_sha256']) - from anysolver._ge_beam3_p5_seeded.core import canonical + from anyfesolver._ge_beam3_p5_seeded.core import canonical assert canonical(record)==canonical(replayed), replay_difference_message(record, replayed, 'full record') state,records=owner._restore(raw,sha256(raw).hexdigest()) assert state.contact.potential_j>0 @@ -76,8 +76,8 @@ def test_default_saved_curved_energy_and_identity(): def test_saved_curved_full_record_replay_is_exact(): """CI4 requires every saved field and the unchanged production restore.""" from test_general_contact_native_curved_fibre_pair_static import _curved_owner, _saved_curved_fixture - from anysolver._ge_beam3_p5_seeded.codec import _load - from anysolver._ge_beam3_p5_seeded.core import canonical + from anyfesolver._ge_beam3_p5_seeded.codec import _load + from anyfesolver._ge_beam3_p5_seeded.core import canonical owner = _curved_owner() raw, _ = _saved_curved_fixture() capsule = _load(raw.decode('ascii')) diff --git a/tests/test_general_contact_native_retained_body_projection.py b/tests/test_general_contact_native_retained_body_projection.py index 4263140e2..33779404f 100644 --- a/tests/test_general_contact_native_retained_body_projection.py +++ b/tests/test_general_contact_native_retained_body_projection.py @@ -10,12 +10,12 @@ import sys if __name__ == '__main__': - _path = Path(__file__).parents[1]/'src/anysolver/general_contact/native_retained_body_projection.py' + _path = Path(__file__).parents[1]/'src/anyfesolver/general_contact/native_retained_body_projection.py' _spec = importlib.util.spec_from_file_location('body_projection_inventory',_path) _module = importlib.util.module_from_spec(_spec) _spec.loader.exec_module(_module) else: - from anysolver.general_contact import native_retained_body_projection as _module + from anyfesolver.general_contact import native_retained_body_projection as _module class EndpointProjectionInventory(unittest.TestCase): @@ -35,7 +35,7 @@ def test_complete_junction_omission_accounting_and_refusal(self): def test_private_omission_keeps_legacy_midpoint_branch(self): import ast,inspect - from anysolver.general_contact.native_retained_whole_pair import NativeRetainedWholeCurvePair + from anyfesolver.general_contact.native_retained_whole_pair import NativeRetainedWholeCurvePair import textwrap tree = ast.parse(textwrap.dedent(inspect.getsource(NativeRetainedWholeCurvePair.evaluate))) band_loop = next(node for node in ast.walk(tree) if isinstance(node,ast.For) @@ -64,7 +64,7 @@ def save(): from examples.general_contact_native_retained_body_pair import analysis report.update(phase='construction',pools=threadpool_info(),numba_jit_disabled=os.environ['NUMBA_DISABLE_JIT'], imports={n:str(Path(m.__file__).resolve()) for n,m in tuple(sys.modules.items()) - if n.startswith('anysolver') and getattr(m,'__file__',None)}) + if n.startswith('anyfesolver') and getattr(m,'__file__',None)}) save() owner = analysis(separation=.101,reference_rise_m=.001) positions = owner.initial.mechanical.positions.copy() @@ -117,7 +117,7 @@ def test_independent_near_endpoint_interior_jet(self): sys.modules[spec.name] = beam spec.loader.exec_module(beam) else: - from anysolver.general_contact import beam_curve_pair as beam + from anyfesolver.general_contact import beam_curve_pair as beam height, x = .09998, 5e-11 target = np.array(((0.,height,0.),(.5,height,0.),(1.,height,0.))) source = np.array(((x,0.,0.),(.5+x,0.,0.),(1.+x,0.,0.))) diff --git a/tests/test_general_contact_native_retained_cell_pair.py b/tests/test_general_contact_native_retained_cell_pair.py index 729a6589a..e81d580a2 100644 --- a/tests/test_general_contact_native_retained_cell_pair.py +++ b/tests/test_general_contact_native_retained_cell_pair.py @@ -4,10 +4,10 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_centered_reference import ( +from anyfesolver._ge_beam3_centered_reference import ( CenteredCurvedBeam3ReferenceGeometry, ) -from anysolver.general_contact.native_retained_cell_pair import ( +from anyfesolver.general_contact.native_retained_cell_pair import ( NativeRetainedSelectedCellPair, ) diff --git a/tests/test_general_contact_native_retained_curve_cell.py b/tests/test_general_contact_native_retained_curve_cell.py index 0d520efba..ae3085d49 100644 --- a/tests/test_general_contact_native_retained_curve_cell.py +++ b/tests/test_general_contact_native_retained_curve_cell.py @@ -4,7 +4,7 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver.general_contact.native_retained_curve_cell import ( +from anyfesolver.general_contact.native_retained_curve_cell import ( NativeRetainedCurveCell, ) from test_general_contact_native_retained_station import _reference diff --git a/tests/test_general_contact_native_retained_line_plane.py b/tests/test_general_contact_native_retained_line_plane.py index 518162ca9..65b5fe18c 100644 --- a/tests/test_general_contact_native_retained_line_plane.py +++ b/tests/test_general_contact_native_retained_line_plane.py @@ -5,7 +5,7 @@ from scipy.integrate import quad from scipy.spatial.transform import Rotation -from anysolver.general_contact.native_retained_line_plane import ( +from anyfesolver.general_contact.native_retained_line_plane import ( NativeRetainedRoundLinePlane, ) from test_general_contact_native_retained_station import _reference diff --git a/tests/test_general_contact_native_retained_line_s3.py b/tests/test_general_contact_native_retained_line_s3.py index be6282080..129656283 100644 --- a/tests/test_general_contact_native_retained_line_s3.py +++ b/tests/test_general_contact_native_retained_line_s3.py @@ -5,13 +5,13 @@ from scipy.integrate import quad from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_centered_reference import ( +from anyfesolver._ge_beam3_centered_reference import ( CenteredCurvedBeam3ReferenceGeometry, ) -from anysolver.general_contact.native_retained_line_s3 import ( +from anyfesolver.general_contact.native_retained_line_s3 import ( NativeRetainedRoundLineS3Interior, ) -from anysolver.general_contact.overlap import PlanarFace +from anyfesolver.general_contact.overlap import PlanarFace def _case(*, curved=False, maximum_integration_intervals=100): diff --git a/tests/test_general_contact_native_retained_line_s3_work.py b/tests/test_general_contact_native_retained_line_s3_work.py index 9777d049f..16a1617f2 100644 --- a/tests/test_general_contact_native_retained_line_s3_work.py +++ b/tests/test_general_contact_native_retained_line_s3_work.py @@ -5,19 +5,19 @@ import numpy as np import pytest -from anysolver import create_shell_element -from anysolver._ge_beam3_centered_reference import ( +from anyfesolver import create_shell_element +from anyfesolver._ge_beam3_centered_reference import ( CenteredCurvedBeam3ReferenceGeometry, ) -from anysolver.fe_core import FEModel -from anysolver.general_contact.native_retained_line_s3 import ( +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.native_retained_line_s3 import ( NativeRetainedRoundLineS3Interior, ) -from anysolver.general_contact.native_retained_line_s3_work import ( +from anyfesolver.general_contact.native_retained_line_s3_work import ( NativeRetainedLineS3Work, ) -from anysolver.general_contact.overlap import reference_shell_face -from anysolver.general_contact.s3_skin_work import S3SkinWorkAdapter +from anyfesolver.general_contact.overlap import reference_shell_face +from anyfesolver.general_contact.s3_skin_work import S3SkinWorkAdapter def _case(): diff --git a/tests/test_general_contact_native_retained_pair_static.py b/tests/test_general_contact_native_retained_pair_static.py index b625466a0..c64849c50 100644 --- a/tests/test_general_contact_native_retained_pair_static.py +++ b/tests/test_general_contact_native_retained_pair_static.py @@ -6,25 +6,25 @@ import numpy as np import pytest -from anysolver._ge_beam3_centered_reference import ( +from anyfesolver._ge_beam3_centered_reference import ( CenteredCurvedBeam3ReferenceGeometry, ) -from anysolver._ge_beam3_generalized_ellipsoid_section import ( +from anyfesolver._ge_beam3_generalized_ellipsoid_section import ( EllipsoidalGeneralizedSection, ) -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_native_generalized_element import ( +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_native_generalized_element import ( NativeGeneralizedStaticElement, ) -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_retained_nodal_loading import NodalDeadForces, Program -from anysolver._ge_beam3_p5_seeded.core import canonical, sha -from anysolver.boundary import BoundaryCondition -from anysolver.general_contact.native_retained_cell_pair import ( +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_retained_nodal_loading import NodalDeadForces, Program +from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha +from anyfesolver.boundary import BoundaryCondition +from anyfesolver.general_contact.native_retained_cell_pair import ( NativeRetainedSelectedCellPair, ) -from anysolver.general_contact.native_retained_pair_static import ( +from anyfesolver.general_contact.native_retained_pair_static import ( NativeRetainedRoundPairAnalysis, ) from test_general_contact_native_retained_cell_pair import _references diff --git a/tests/test_general_contact_native_retained_s3_static.py b/tests/test_general_contact_native_retained_s3_static.py index 151ab86ec..e02395e27 100644 --- a/tests/test_general_contact_native_retained_s3_static.py +++ b/tests/test_general_contact_native_retained_s3_static.py @@ -6,25 +6,25 @@ import numpy as np import pytest -from anysolver import create_shell_element -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_retained_nodal_loading import NodalDeadForces, Program -from anysolver._ge_beam3_p5_seeded.core import canonical, sha -from anysolver.boundary import BoundaryCondition, FixedSupport -from anysolver.fe_core import FEModel -from anysolver.general_contact.native_retained_line_s3 import ( +from anyfesolver import create_shell_element +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_retained_nodal_loading import NodalDeadForces, Program +from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha +from anyfesolver.boundary import BoundaryCondition, FixedSupport +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.native_retained_line_s3 import ( NativeRetainedRoundLineS3Interior, ) -from anysolver.general_contact.native_retained_line_s3_work import ( +from anyfesolver.general_contact.native_retained_line_s3_work import ( NativeRetainedLineS3Work, ) -from anysolver.general_contact.native_retained_s3_static import ( +from anyfesolver.general_contact.native_retained_s3_static import ( NativeRetainedRoundS3Analysis, ) -from anysolver.general_contact.overlap import reference_shell_face -from anysolver.general_contact.s3_skin_work import S3SkinWorkAdapter +from anyfesolver.general_contact.overlap import reference_shell_face +from anyfesolver.general_contact.s3_skin_work import S3SkinWorkAdapter from test_ge_beam3_native_generalized_modal import make diff --git a/tests/test_general_contact_native_retained_static.py b/tests/test_general_contact_native_retained_static.py index e1137c06e..e3aa4e0c0 100644 --- a/tests/test_general_contact_native_retained_static.py +++ b/tests/test_general_contact_native_retained_static.py @@ -6,15 +6,15 @@ import numpy as np import pytest -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_retained_nodal_loading import NodalDeadForces, Program -from anysolver._ge_beam3_p5_seeded.core import canonical, sha -from anysolver.general_contact.native_retained_line_plane import ( +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_retained_nodal_loading import NodalDeadForces, Program +from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha +from anyfesolver.general_contact.native_retained_line_plane import ( NativeRetainedRoundLinePlane, ) -from anysolver.general_contact.native_retained_static import ( +from anyfesolver.general_contact.native_retained_static import ( NativeRetainedRoundPlaneAnalysis, ) from test_ge_beam3_native_generalized_modal import make diff --git a/tests/test_general_contact_native_retained_station.py b/tests/test_general_contact_native_retained_station.py index c8e4814bf..2b12894ef 100644 --- a/tests/test_general_contact_native_retained_station.py +++ b/tests/test_general_contact_native_retained_station.py @@ -4,11 +4,11 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_centered_reference import ( +from anyfesolver._ge_beam3_centered_reference import ( CenteredCurvedBeam3ReferenceGeometry, ) -from anysolver._ge_beam3_fibre_line_work import evaluate as native_line_work -from anysolver.general_contact.native_retained_station import ( +from anyfesolver._ge_beam3_fibre_line_work import evaluate as native_line_work +from anyfesolver.general_contact.native_retained_station import ( NativeRetainedRoundStation, ) @@ -145,7 +145,7 @@ def test_native_round_station_rejects_ambiguous_or_invalid_geometry(): @pytest.mark.parametrize('xi,angle',[(-.47,.3),(.63,2*np.pi-2.4)]) def test_exact_spatial_exponential_variations_match_independent_jet2(curved,xi,angle): from scipy.spatial.transform import Rotation - from anysolver._ge_beam3_mixed_ad import Jet2,so3_exp,matmul,constant_matrix + from anyfesolver._ge_beam3_mixed_ad import Jet2,so3_exp,matmul,constant_matrix reference=_reference(curved) station=NativeRetainedRoundStation(7,reference,xi,.03,angle) positions=reference.coordinates.copy();low=np.zeros((3,3)) diff --git a/tests/test_general_contact_native_retained_whole_pair.py b/tests/test_general_contact_native_retained_whole_pair.py index 1e470c11b..91de17e33 100644 --- a/tests/test_general_contact_native_retained_whole_pair.py +++ b/tests/test_general_contact_native_retained_whole_pair.py @@ -6,11 +6,11 @@ from scipy.optimize import brentq, minimize_scalar from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_centered_reference import ( +from anyfesolver._ge_beam3_centered_reference import ( CenteredCurvedBeam3ReferenceGeometry, ) -from anysolver.general_contact.native_curve_union import NativeTwoCellUnionSearch -from anysolver.general_contact.native_retained_whole_pair import ( +from anyfesolver.general_contact.native_curve_union import NativeTwoCellUnionSearch +from anyfesolver.general_contact.native_retained_whole_pair import ( NativeRetainedWholeCurvePair, _straight_join_owner, _straight_join_partitions, diff --git a/tests/test_general_contact_native_retained_whole_pair_static.py b/tests/test_general_contact_native_retained_whole_pair_static.py index 29c28382e..b9ec96e0e 100644 --- a/tests/test_general_contact_native_retained_whole_pair_static.py +++ b/tests/test_general_contact_native_retained_whole_pair_static.py @@ -6,24 +6,24 @@ import pytest from scipy.integrate import quad -from anysolver._ge_beam3_centered_reference import ( +from anyfesolver._ge_beam3_centered_reference import ( CenteredCurvedBeam3ReferenceGeometry, ) -from anysolver._ge_beam3_generalized_ellipsoid_section import ( +from anyfesolver._ge_beam3_generalized_ellipsoid_section import ( EllipsoidalGeneralizedSection, ) -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._ge_beam3_native_generalized_element import ( +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._ge_beam3_native_generalized_element import ( NativeGeneralizedStaticElement, ) -from anysolver._ge_beam3_native_generalized_loading import DistributedPattern -from anysolver._ge_beam3_native_line_loading import LinePattern -from anysolver._ge_beam3_retained_nodal_loading import NodalDeadForces, Program -from anysolver.boundary import BoundaryCondition -from anysolver.general_contact.native_retained_pair_static import ( +from anyfesolver._ge_beam3_native_generalized_loading import DistributedPattern +from anyfesolver._ge_beam3_native_line_loading import LinePattern +from anyfesolver._ge_beam3_retained_nodal_loading import NodalDeadForces, Program +from anyfesolver.boundary import BoundaryCondition +from anyfesolver.general_contact.native_retained_pair_static import ( NativeRetainedRoundPairAnalysis, WHOLE_PROFILE, WHOLE_CHECKPOINT_SCHEMA, ) -from anysolver.general_contact.native_retained_whole_pair import ( +from anyfesolver.general_contact.native_retained_whole_pair import ( NativeRetainedWholeCurvePair, ) diff --git a/tests/test_general_contact_native_surface_activation.py b/tests/test_general_contact_native_surface_activation.py index c4af16474..20760f82a 100644 --- a/tests/test_general_contact_native_surface_activation.py +++ b/tests/test_general_contact_native_surface_activation.py @@ -6,7 +6,7 @@ from scipy.optimize import brentq from scipy.spatial.transform import Rotation -from anysolver.general_contact.native_surface_activation import evaluate_first_touch +from anyfesolver.general_contact.native_surface_activation import evaluate_first_touch from test_general_contact_native_surface_s3_friction import _case @@ -100,8 +100,8 @@ def test_first_touch_rejects_changed_bound_definition_before_history_evaluation( @pytest.mark.parametrize('size',(16,30)) def test_prepared_event_rotation_derivatives_match_uncached_jet_algebra(size): - import anysolver.general_contact.native_surface_activation as module - from anysolver._ge_beam3_mixed_ad import Jet2,so3_exp,so3_log,matmul,constant_matrix + import anyfesolver.general_contact.native_surface_activation as module + from anyfesolver._ge_beam3_mixed_ad import Jet2,so3_exp,so3_log,matmul,constant_matrix for vector in ((0.,0.,0.),(.03,-.02,.01),(-.2,.1,.3)): rotation=Rotation.from_rotvec(vector).as_matrix() entries=tuple(rotation.ravel()) @@ -118,8 +118,8 @@ def test_prepared_event_rotation_derivatives_match_uncached_jet_algebra(size): def test_prepared_mixed_rotation_matches_uncached_virtual_work_map(): - import anysolver.general_contact.native_surface_activation as module - from anysolver._ge_beam3_mixed_ad import Jet2,so3_exp,matmul + import anyfesolver.general_contact.native_surface_activation as module + from anyfesolver._ge_beam3_mixed_ad import Jet2,so3_exp,matmul q=[Jet2.variable(0.,3+i,30) for i in range(3)] v=[Jet2.variable(0.,18+i,30) for i in range(3)] exact=matmul(so3_exp(v),so3_exp(q)) diff --git a/tests/test_general_contact_native_surface_bounds.py b/tests/test_general_contact_native_surface_bounds.py index c42c3cffe..c5de61bbb 100644 --- a/tests/test_general_contact_native_surface_bounds.py +++ b/tests/test_general_contact_native_surface_bounds.py @@ -3,10 +3,10 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry -from anysolver.general_contact.native_surface_bounds import native_round_patch_bounds -from anysolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule -from anysolver.general_contact.contact_search import ContactAABBIndex +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry +from anyfesolver.general_contact.native_surface_bounds import native_round_patch_bounds +from anyfesolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule +from anyfesolver.general_contact.contact_search import ContactAABBIndex from test_general_contact_native_retained_station import _reference @@ -81,7 +81,7 @@ def test_restricted_curved_box_transform_and_compensated_low_parts(): G=Rotation.from_rotvec((.3,-.4,.2)).as_matrix() offset=np.array((2.**30,-2.**29,2.**28)) # Preserve the given binary values through normalized high/low pairs. - from anysolver._ge_beam3_p5.compensated_coordinates import split_sum + from anyfesolver._ge_beam3_p5.compensated_coordinates import split_sum actual=p@G.T high=np.empty_like(p);small=np.empty_like(p) for i in range(3): @@ -152,7 +152,7 @@ def test_swept_search_detects_hidden_interior_rotation_and_keeps_path_limit(): @pytest.mark.parametrize('stretch',(-2e-12,2e-12)) def test_reference_transport_gain_covers_admitted_nonorthogonal_nodes(stretch): - from anysolver.general_contact.native_surface_bounds import _reference_radial_gain + from anyfesolver.general_contact.native_surface_bounds import _reference_radial_gain reference=_reference(True) frames=reference.nodal_triads.copy() frames[:,:,0]*=1+stretch @@ -165,7 +165,7 @@ def test_reference_transport_gain_covers_admitted_nonorthogonal_nodes(stretch): @pytest.mark.parametrize('stretch',(-1e-13,1e-13)) def test_transport_gain_near_frozen_turn_with_nonorthogonal_nodes(stretch): - from anysolver.general_contact.native_surface_bounds import _reference_radial_gain + from anyfesolver.general_contact.native_surface_bounds import _reference_radial_gain reference=_near_turn_reference(stretch) gain=_reference_radial_gain(reference) for xi in np.linspace(-1,1,2001): @@ -188,14 +188,14 @@ def _near_turn_reference(stretch): @pytest.mark.parametrize('stretch',(-2e-12,2e-12)) def test_near_turn_distorted_frames_keep_original_owner_rejection(stretch): - from anysolver.ge_beam3_curved_reference import GeBeam3CurvedFrameError + from anyfesolver.ge_beam3_curved_reference import GeBeam3CurvedFrameError with pytest.raises(GeBeam3CurvedFrameError,match='frozen shortest-transport roll map'): _near_turn_reference(stretch) def test_q2_restriction_retains_sub_ulp_material_parameter_shift(): from fractions import Fraction as F - from anysolver.general_contact.native_surface_bounds import _restrict_q2 + from anyfesolver.general_contact.native_surface_bounds import _restrict_q2 # xi near zero maps to t just below one; float(xi+1) would erase the shift. left=1-F(1,2**60);right=1-F(1,2**61) restricted=_restrict_q2(((F(0),F(1),F(2)),),left,right)[0] diff --git a/tests/test_general_contact_native_surface_closed_sequence.py b/tests/test_general_contact_native_surface_closed_sequence.py index 41539ef8b..f1be69e4f 100644 --- a/tests/test_general_contact_native_surface_closed_sequence.py +++ b/tests/test_general_contact_native_surface_closed_sequence.py @@ -3,10 +3,10 @@ import numpy as np import pytest from scipy.spatial.transform import Rotation -from anysolver.general_contact.native_retained_station import NativeRetainedRoundStation -from anysolver.general_contact.native_surface_s3_friction import NativeS3MaterialPointFriction -from anysolver.general_contact.native_surface_event_sequence import evaluate_closed_event_sequence -from anysolver.general_contact.friction_point import trial_coulomb_point +from anyfesolver.general_contact.native_retained_station import NativeRetainedRoundStation +from anyfesolver.general_contact.native_surface_s3_friction import NativeS3MaterialPointFriction +from anyfesolver.general_contact.native_surface_event_sequence import evaluate_closed_event_sequence +from anyfesolver.general_contact.friction_point import trial_coulomb_point from test_general_contact_native_surface_s3_friction import _case @@ -112,8 +112,8 @@ def test_closed_sequence_independent_discrete_work_and_deforming_target(): def test_closed_sequence_reports_actual_history_calls(monkeypatch): - import anysolver.general_contact.native_surface_activation as activation - import anysolver.general_contact.native_surface_event_sequence as sequence + import anyfesolver.general_contact.native_surface_activation as activation + import anyfesolver.general_contact.native_surface_event_sequence as sequence original=activation.trial_coulomb_point;calls=[] def counted(*args,**kwargs): calls.append(1) @@ -129,7 +129,7 @@ def counted(*args,**kwargs): def test_initially_open_three_events_preserve_completed_window_and_final_force(): from scipy.optimize import brentq - from anysolver.general_contact.friction_point import initial_friction_point + from anyfesolver.general_contact.friction_point import initial_friction_point _,old,start,_=_case() source=NativeRetainedRoundStation(7,old.source.reference,-.5,.03,0.) pair=NativeS3MaterialPointFriction(source,old.target,reference_weight_m2=.01, diff --git a/tests/test_general_contact_native_surface_contributor.py b/tests/test_general_contact_native_surface_contributor.py index dd55197aa..78b9a3f65 100644 --- a/tests/test_general_contact_native_surface_contributor.py +++ b/tests/test_general_contact_native_surface_contributor.py @@ -3,11 +3,11 @@ import numpy as np import pytest -from anysolver.general_contact.friction_point import initial_friction_point -from anysolver.general_contact.native_retained_station import NativeRetainedRoundStation -from anysolver.general_contact.native_surface_s3_friction import NativeS3MaterialPointFriction -from anysolver.general_contact.native_surface_contributor import NativeS3MaterialContributor -from anysolver.general_contact.s3_friction_point import S3SkinMaterialPoint +from anyfesolver.general_contact.friction_point import initial_friction_point +from anyfesolver.general_contact.native_retained_station import NativeRetainedRoundStation +from anyfesolver.general_contact.native_surface_s3_friction import NativeS3MaterialPointFriction +from anyfesolver.general_contact.native_surface_contributor import NativeS3MaterialContributor +from anyfesolver.general_contact.s3_friction_point import S3SkinMaterialPoint from test_general_contact_native_retained_s3_static import _analysis diff --git a/tests/test_general_contact_native_surface_crossing.py b/tests/test_general_contact_native_surface_crossing.py index 017c24b34..f60a3644a 100644 --- a/tests/test_general_contact_native_surface_crossing.py +++ b/tests/test_general_contact_native_surface_crossing.py @@ -3,8 +3,8 @@ import pytest -from anysolver.general_contact.native_surface_crossing import GapSlabEnclosure,certify_single_crossing -from anysolver.general_contact.native_surface_support import SupportIntervalBudget +from anyfesolver.general_contact.native_surface_crossing import GapSlabEnclosure,certify_single_crossing +from anyfesolver.general_contact.native_surface_support import SupportIntervalBudget def rotating_family(phase,travel,level): @@ -98,8 +98,8 @@ def test_invalid_enclosures_rejected(values): @pytest.mark.parametrize('phase,travel,expected',[(-.4,2.,True),(-1.2,2.4,False)]) def test_actual_retained_geometry_single_crossing_and_hidden_pulse(phase,travel,expected): import numpy as np - from anysolver.general_contact.native_surface_history import NativeSurfaceMotionSegment - from anysolver.general_contact.native_surface_support import segment_gap_slab_enclosure,history_endpoint_support_certified + from anyfesolver.general_contact.native_surface_history import NativeSurfaceMotionSegment + from anyfesolver.general_contact.native_surface_support import segment_gap_slab_enclosure,history_endpoint_support_certified from test_general_contact_native_surface_support import _field segment=NativeSurfaceMotionSegment(np.zeros((3,3)),np.array(((travel,0.,0.),(0.,0.,0.))),np.zeros(18)) press=NativeSurfaceMotionSegment(np.tile((0.,0.,-.029),(3,1)),np.zeros((2,3)),np.zeros(18)) @@ -122,8 +122,8 @@ def test_actual_retained_geometry_single_crossing_and_hidden_pulse(phase,travel, def test_actual_slab_adapter_rejects_wrong_half_cell(): import numpy as np - from anysolver.general_contact.native_surface_history import NativeSurfaceMotionSegment - from anysolver.general_contact.native_surface_support import segment_gap_slab_enclosure + from anyfesolver.general_contact.native_surface_history import NativeSurfaceMotionSegment + from anyfesolver.general_contact.native_surface_support import segment_gap_slab_enclosure from test_general_contact_native_surface_support import _field field=_field(segments=(NativeSurfaceMotionSegment(np.zeros((3,3)),np.zeros((2,3)),np.zeros(18)),)) with pytest.raises(ValueError,match='half-cell'): @@ -132,8 +132,8 @@ def test_actual_slab_adapter_rejects_wrong_half_cell(): def test_deforming_target_subslab_uses_original_time_derivative(): import numpy as np - from anysolver.general_contact.native_surface_history import NativeSurfaceMotionSegment - from anysolver.general_contact.native_surface_support import segment_gap_slab_enclosure + from anyfesolver.general_contact.native_surface_history import NativeSurfaceMotionSegment + from anyfesolver.general_contact.native_surface_support import segment_gap_slab_enclosure from test_general_contact_native_surface_support import _field shell=np.zeros(18);shell[8]=.01;shell[14]=-.006;shell[12]=.025 translations=np.tile((.015,0.,-.002),(3,1));omega=.2 @@ -171,11 +171,11 @@ def test_convex_origin_thin_translated_target_against_high_precision(translation from decimal import Decimal,localcontext import numpy as np from scipy.spatial.transform import Rotation - from anysolver.general_contact.native_surface_history import NativeSurfaceHistoryField,NativeSurfaceMotionSegment - from anysolver.general_contact.native_surface_patch import NativeS3MaterialSurfacePatch - from anysolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule - from anysolver.general_contact.native_surface_support import segment_gap_slab_enclosure,_convex_support_origin - from anysolver.general_contact.s3_friction_point import S3SkinMaterialPoint + from anyfesolver.general_contact.native_surface_history import NativeSurfaceHistoryField,NativeSurfaceMotionSegment + from anyfesolver.general_contact.native_surface_patch import NativeS3MaterialSurfacePatch + from anyfesolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule + from anyfesolver.general_contact.native_surface_support import segment_gap_slab_enclosure,_convex_support_origin + from anyfesolver.general_contact.s3_friction_point import S3SkinMaterialPoint from test_general_contact_native_surface_support import _field base=_field() # Dyadic vertices and translations preserve this represented thin geometry. diff --git a/tests/test_general_contact_native_surface_event_sequence.py b/tests/test_general_contact_native_surface_event_sequence.py index ebee996d0..84723b8e8 100644 --- a/tests/test_general_contact_native_surface_event_sequence.py +++ b/tests/test_general_contact_native_surface_event_sequence.py @@ -5,9 +5,9 @@ import numpy as np import pytest -from anysolver.general_contact.friction_point import initial_friction_point -from anysolver.general_contact.native_surface_event_sequence import locate_material_event_sequence,evaluate_open_event_sequence -from anysolver.general_contact.native_surface_history import NativeSurfaceMotionSegment +from anyfesolver.general_contact.friction_point import initial_friction_point +from anyfesolver.general_contact.native_surface_event_sequence import locate_material_event_sequence,evaluate_open_event_sequence +from anyfesolver.general_contact.native_surface_history import NativeSurfaceMotionSegment from test_general_contact_native_surface_support import _field @@ -48,8 +48,8 @@ def test_analytical_two_event_roots_and_discrete_history_work(): def test_sequence_counts_actual_coulomb_evaluations(monkeypatch): - from anysolver.general_contact import native_surface_event_sequence as sequence_module - from anysolver.general_contact import native_surface_activation as activation_module + from anyfesolver.general_contact import native_surface_event_sequence as sequence_module + from anyfesolver.general_contact import native_surface_activation as activation_module original=sequence_module.trial_coulomb_point;calls=[] def counted(*args,**kwargs): calls.append(1) @@ -64,8 +64,8 @@ def counted(*args,**kwargs): def test_explicit_sequence_policy_routes_full_saved_query_and_binds_identity(): import json from pathlib import Path - from anysolver.general_contact.native_surface_history import NativeSurfaceHistoryField,NativeSurfaceReplayBudget - from anysolver.general_contact.native_surface_s3_friction import NativeS3MaterialConfiguration + from anyfesolver.general_contact.native_surface_history import NativeSurfaceHistoryField,NativeSurfaceReplayBudget + from anyfesolver.general_contact.native_surface_s3_friction import NativeS3MaterialConfiguration from test_general_contact_native_surface_replay_owner import _replay_patch,_patch,normal_settings,friction_settings _,bridge=_patch(activation_policy='transverse_event_sequence',gap_check='straight_patch', normal_integration='straight_segmented',normal_integration_settings=normal_settings(), @@ -95,7 +95,7 @@ def test_sequence_budget_and_tangency_remain_explicit_non_success(): def test_two_chart_admitted_segments_accumulate_physical_history(): - from anysolver.general_contact.native_surface_path import material_path_pose + from anyfesolver.general_contact.native_surface_path import material_path_pose field,pair,history,segment=pulse() first=evaluate_open_event_sequence(pair,field.initial,history,segment.translations,segment.angular,segment.shell_increment) endpoint=material_path_pose(field.initial,segment.translations,segment.angular,segment.shell_increment,1.) @@ -113,9 +113,9 @@ def test_two_chart_admitted_segments_accumulate_physical_history(): def test_saved_two_event_point_replays_closed_window(tmp_path): import json,os from pathlib import Path - from anysolver.general_contact.native_surface_history import NativeSurfaceHistoryField - from anysolver.general_contact.native_surface_s3_friction import NativeS3MaterialConfiguration - from anysolver.general_contact.native_surface_path import material_path_pose + from anyfesolver.general_contact.native_surface_history import NativeSurfaceHistoryField + from anyfesolver.general_contact.native_surface_s3_friction import NativeS3MaterialConfiguration + from anyfesolver.general_contact.native_surface_path import material_path_pose from test_general_contact_native_surface_replay_owner import _replay_patch folder=Path(__file__).parents[1]/'docs/d1_review_support/contact_c5_native_surface_point_20261002' saved=json.loads((folder/'replay_owner_second_load_rejected_path.json').read_text()) @@ -148,8 +148,8 @@ def test_saved_two_event_point_replays_closed_window(tmp_path): def _saved_front_field(): import json from pathlib import Path - from anysolver.general_contact.native_surface_history import NativeSurfaceHistoryField - from anysolver.general_contact.native_surface_s3_friction import NativeS3MaterialConfiguration + from anyfesolver.general_contact.native_surface_history import NativeSurfaceHistoryField + from anyfesolver.general_contact.native_surface_s3_friction import NativeS3MaterialConfiguration from test_general_contact_native_surface_replay_owner import _replay_patch saved=json.loads((Path(__file__).parents[1] /'docs/d1_review_support/contact_c5_native_surface_point_20261002' @@ -162,7 +162,7 @@ def _saved_front_field(): def _saved_front_second_segment_state(field,xi,angle): - from anysolver.general_contact.native_surface_path import material_path_pose + from anyfesolver.general_contact.native_surface_path import material_path_pose pair=field.pair_at(xi,angle);pose=field.initial state=initial_friction_point(pair.target.physical_pose(pose.shell_displacement).material_frame) segment=field.segments[0] @@ -188,8 +188,8 @@ def test_saved_front_point_schedule_certifies_closed_end_below_binary64_resoluti def test_saved_front_point_certified_closed_endpoint_completes_with_corrected_primal(): - from anysolver.general_contact.native_event_polynomial import certified_material_gap - from anysolver.general_contact.native_surface_history import NativeSurfaceReplayBudget + from anyfesolver.general_contact.native_event_polynomial import certified_material_gap + from anyfesolver.general_contact.native_surface_history import NativeSurfaceReplayBudget field=_saved_front_field() xi,angle=.7999999999999998,3.323806549199672 pair,pose,state,segment=_saved_front_second_segment_state(field,xi,angle) @@ -227,8 +227,8 @@ def test_saved_front_point_certified_closed_endpoint_completes_with_corrected_pr def test_certified_endpoint_primal_contract(): - from anysolver._ge_beam3_mixed_ad import Jet2 - from anysolver.general_contact.native_surface_activation import _certified_endpoint_primal + from anyfesolver._ge_beam3_mixed_ad import Jet2 + from anyfesolver.general_contact.native_surface_activation import _certified_endpoint_primal padding=512*np.finfo(float).eps*150. g=Jet2.variable(5.06e-18,0,4) corrected=_certified_endpoint_primal(g,padding,-3.87e-18) @@ -251,7 +251,7 @@ def test_certified_endpoint_primal_contract(): def test_saved_front_point_certified_gap_refusals_preserve_rollback(monkeypatch): - from anysolver.general_contact import native_event_polynomial as polynomial + from anyfesolver.general_contact import native_event_polynomial as polynomial field=_saved_front_field() pair,pose,state,segment=_saved_front_second_segment_state(field, .7999999999999998,3.323806549199672) @@ -270,7 +270,7 @@ def test_saved_front_point_certified_gap_refusals_preserve_rollback(monkeypatch) def test_certified_material_gap_requires_resolved_certified_sign(monkeypatch): - from anysolver.general_contact import native_event_polynomial as polynomial + from anyfesolver.general_contact import native_event_polynomial as polynomial monkeypatch.setattr(polynomial.MaterialTimeNumerator,'sign',lambda self,t:0) field,pair,history,segment=pulse() with pytest.raises(ValueError,match='resolved precise sign'): @@ -279,7 +279,7 @@ def test_certified_material_gap_requires_resolved_certified_sign(monkeypatch): def test_saved_front_neighbor_certified_open_endpoint_rounds_negative_and_completes(): - from anysolver.general_contact.native_surface_history import NativeSurfaceReplayBudget + from anyfesolver.general_contact.native_surface_history import NativeSurfaceReplayBudget field=_saved_front_field() pair,pose,state,segment=_saved_front_second_segment_state(field,.7999999999999994,3.3238065491996722) sequence=locate_material_event_sequence(pair,pose,segment.translations,segment.angular, @@ -300,7 +300,7 @@ def test_saved_front_neighbor_certified_open_endpoint_rounds_negative_and_comple def test_certified_endpoint_state_resolution_contract(): - from anysolver.general_contact.native_surface_event_sequence import _resolve_endpoint_state + from anyfesolver.general_contact.native_surface_event_sequence import _resolve_endpoint_state padding=512*np.finfo(float).eps*150. assert _resolve_endpoint_state(1e-3,0,padding)==1 assert _resolve_endpoint_state(-1e-3,0,padding)==-1 diff --git a/tests/test_general_contact_native_surface_extrema.py b/tests/test_general_contact_native_surface_extrema.py index 7c2659066..4e0939dd6 100644 --- a/tests/test_general_contact_native_surface_extrema.py +++ b/tests/test_general_contact_native_surface_extrema.py @@ -8,11 +8,11 @@ from scipy.optimize import differential_evolution from scipy.spatial.transform import Rotation -from anysolver.general_contact.native_surface_extrema import straight_patch_plane_extrema,straight_patch_s3_gap -from anysolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule -from anysolver.general_contact.native_retained_station import NativeRetainedRoundStation -from anysolver.general_contact.native_surface_s3_friction import NativeS3MaterialConfiguration -from anysolver.general_contact.native_surface_transaction import NativeS3MaterialTransaction +from anyfesolver.general_contact.native_surface_extrema import straight_patch_plane_extrema,straight_patch_s3_gap +from anyfesolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule +from anyfesolver.general_contact.native_retained_station import NativeRetainedRoundStation +from anyfesolver.general_contact.native_surface_s3_friction import NativeS3MaterialConfiguration +from anyfesolver.general_contact.native_surface_transaction import NativeS3MaterialTransaction from test_general_contact_native_surface_s3_friction import _case from test_general_contact_native_surface_patch import _patch from test_general_contact_native_retained_station import _reference diff --git a/tests/test_general_contact_native_surface_friction_integral.py b/tests/test_general_contact_native_surface_friction_integral.py index 82c38cab5..cf5d0babd 100644 --- a/tests/test_general_contact_native_surface_friction_integral.py +++ b/tests/test_general_contact_native_surface_friction_integral.py @@ -4,9 +4,9 @@ import numpy as np import pytest -from anysolver.general_contact.native_surface_friction_integral import ( +from anyfesolver.general_contact.native_surface_friction_integral import ( NativeSurfaceFrictionIntegrationSettings,integrate_material_friction) -from anysolver.general_contact.native_surface_history import NativeSurfaceHistoryField +from anyfesolver.general_contact.native_surface_history import NativeSurfaceHistoryField from test_general_contact_native_surface_history import _origin,_segment from test_general_contact_native_surface_patch import _patch @@ -52,9 +52,9 @@ def test_integral_enforces_aggregate_query_and_memory_caps(): def test_integral_rejects_hidden_temporal_pulse_before_quadrature(): from dataclasses import replace - from anysolver.general_contact.native_surface_history import NativeSurfaceMotionSegment - from anysolver.general_contact.native_surface_friction_integral import NativeFrictionIntegrationLimit - from anysolver._ge_beam3_p5_seeded.core import sha + from anyfesolver.general_contact.native_surface_history import NativeSurfaceMotionSegment + from anyfesolver.general_contact.native_surface_friction_integral import NativeFrictionIntegrationLimit + from anyfesolver._ge_beam3_p5_seeded.core import sha from test_general_contact_native_surface_support import _field as support_field segment=NativeSurfaceMotionSegment(np.zeros((3,3)),np.array(((1.6,0.,0.),(0.,0.,0.))),np.zeros(18)) field=support_field(height=.025,rotation=-.8,segments=(segment,)) @@ -78,7 +78,7 @@ def test_integral_rejects_hidden_temporal_pulse_before_quadrature(): def test_resolved_hidden_temporal_pulse_preserves_independent_release_work(): from math import cos, fsum - from anysolver.general_contact.native_surface_history import NativeSurfaceMotionSegment + from anyfesolver.general_contact.native_surface_history import NativeSurfaceMotionSegment from test_general_contact_native_surface_support import _field as support_field segment=NativeSurfaceMotionSegment(np.zeros((3,3)),np.array(((1.6,0.,0.),(0.,0.,0.))),np.zeros(18)) field=support_field(height=.025,rotation=-.8,segments=(segment,)) diff --git a/tests/test_general_contact_native_surface_front.py b/tests/test_general_contact_native_surface_front.py index 4e5a8d483..6314cca35 100644 --- a/tests/test_general_contact_native_surface_front.py +++ b/tests/test_general_contact_native_surface_front.py @@ -4,15 +4,15 @@ import numpy as np import pytest from scipy.optimize import brentq -from anysolver.general_contact.native_surface_front import axial_contact_front -from anysolver.general_contact.native_surface_history import NativeSurfaceHistoryField,NativeSurfaceMotionSegment -from anysolver.general_contact.native_surface_s3_friction import NativeS3MaterialConfiguration -from anysolver.general_contact.native_surface_path import material_path_pose +from anyfesolver.general_contact.native_surface_front import axial_contact_front +from anyfesolver.general_contact.native_surface_history import NativeSurfaceHistoryField,NativeSurfaceMotionSegment +from anyfesolver.general_contact.native_surface_s3_friction import NativeS3MaterialConfiguration +from anyfesolver.general_contact.native_surface_path import material_path_pose from test_general_contact_native_surface_replay_owner import _replay_patch def test_front_nonfinite_derived_values_reject(): - from anysolver.general_contact.native_surface_front import AxialContactFront + from anyfesolver.general_contact.native_surface_front import AxialContactFront from dataclasses import replace front=AxialContactFront(1e308,1e-308,1.,1.,1.,1.,1.) with pytest.raises(ValueError,match='nonfinite'):front.axial_coordinate() @@ -24,8 +24,8 @@ def test_front_nonfinite_derived_values_reject(): def test_whole_angular_stationary_branch_matches_analytic_geometry(): from dataclasses import replace from test_general_contact_native_surface_support import _field - from anysolver.general_contact.native_surface_front import stationary_front_angular_cover,stationary_front_slab,stationary_front_partition - from anysolver.general_contact.native_surface_support import SupportIntervalBudget + from anyfesolver.general_contact.native_surface_front import stationary_front_angular_cover,stationary_front_slab,stationary_front_partition + from anyfesolver.general_contact.native_surface_support import SupportIntervalBudget segment=NativeSurfaceMotionSegment(np.zeros((3,3)),np.array(((1.6,0.,0.),(0.,0.,0.))),np.zeros(18)) original=_field(height=.035,rotation=-.8,segments=(segment,)) positions=original.initial.positions.copy();positions[:,2]+=.01*positions[:,0] @@ -50,7 +50,7 @@ def test_whole_angular_stationary_branch_matches_analytic_geometry(): @pytest.mark.parametrize('case',['two_roots','wide_point_b','endpoint','singular']) def test_isolation_independent_polynomial_controls(monkeypatch,case): - from anysolver.general_contact import native_surface_front as module + from anyfesolver.general_contact import native_surface_front as module def coefficient(t): if case=='endpoint':return module.AxialContactFront(.5*t*t,1.,t,0.,1.,0.,1.) return module.AxialContactFront(t**3/3-t*t/2+.16*t, @@ -113,7 +113,7 @@ def test_saved_stationary_front_geometry_and_derivatives(tmp_path): assert (front.a+front.b*coordinate)/front.plane_area==pytest.approx(gap,abs=2e-16) assert xi==pytest.approx(.7244843413242318,abs=2e-9) assert abs(front.stationary_numerator)<1e-14 - from anysolver.general_contact.native_surface_front import stationary_front_slab,stationary_front_partition + from anyfesolver.general_contact.native_surface_front import stationary_front_slab,stationary_front_partition bounds=stationary_front_slab(field,1,1,angle,0.,1.) for t in np.linspace(0.,1.,9): sample=get(float(t)) @@ -144,8 +144,8 @@ def test_rotating_round_surface_angular_coefficients_and_tight_bounds(): # Independent cross-products at a directly integrated rigid rotation. from scipy.spatial.transform import Rotation from test_general_contact_native_surface_support import _field - from anysolver.general_contact.native_surface_front_boundary import stationary_angular_coefficients - from anysolver.general_contact.native_surface_front import stationary_front_slab + from anyfesolver.general_contact.native_surface_front_boundary import stationary_angular_coefficients + from anyfesolver.general_contact.native_surface_front import stationary_front_slab segment=NativeSurfaceMotionSegment(np.zeros((3,3)),np.array(((1.6,0.,0.),(0.,0.,0.))),np.zeros(18)) field=_field(height=.035,rotation=-.8,segments=(segment,)) corners=field.patch.target.adapter.current_positions(field.initial.shell_displacement) diff --git a/tests/test_general_contact_native_surface_front_precision.py b/tests/test_general_contact_native_surface_front_precision.py index 1296be563..80d1265fe 100644 --- a/tests/test_general_contact_native_surface_front_precision.py +++ b/tests/test_general_contact_native_surface_front_precision.py @@ -11,17 +11,17 @@ import numpy as np import pytest -from anysolver.general_contact.native_surface_front import (axial_contact_front, +from anyfesolver.general_contact.native_surface_front import (axial_contact_front, stationary_front_angular_cover, prepare_stationary_band, stationary_front_partition_prepared) -from anysolver.general_contact.native_surface_front_boundary import stationary_endpoint_angular_partition -from anysolver.general_contact.native_surface_friction_integral import _final_segment_depth -from anysolver.general_contact.native_surface_front_precision import (PrefixReplayField, +from anyfesolver.general_contact.native_surface_front_boundary import stationary_endpoint_angular_partition +from anyfesolver.general_contact.native_surface_friction_integral import _final_segment_depth +from anyfesolver.general_contact.native_surface_front_precision import (PrefixReplayField, contact_side_turning, final_segment_strip_work_bound) -from anysolver.general_contact.native_surface_front_work import _segment_motion_bounds -from anysolver.general_contact.native_surface_history import (NativeSurfaceHistoryField, +from anyfesolver.general_contact.native_surface_front_work import _segment_motion_bounds +from anyfesolver.general_contact.native_surface_history import (NativeSurfaceHistoryField, NativeSurfaceMotionSegment, NativeSurfaceReplayBudget) -from anysolver.general_contact.native_surface_s3_friction import NativeS3MaterialConfiguration -from anysolver.general_contact.native_surface_support import SupportIntervalBudget +from anyfesolver.general_contact.native_surface_s3_friction import NativeS3MaterialConfiguration +from anyfesolver.general_contact.native_surface_support import SupportIntervalBudget from test_general_contact_native_surface_normal import _settings as normal_settings from test_general_contact_native_surface_patch import _patch from test_general_contact_native_surface_friction_integral import _settings as friction_settings @@ -171,7 +171,7 @@ def test_quiet_final_segment_preserves_nonzero_prefix_dissipation(): def test_material_node_rounding_keeps_tiny_interval_and_refuses_no_interior(): - from anysolver.general_contact.native_surface_friction_integral import _interior_material_coordinate + from anyfesolver.general_contact.native_surface_friction_integral import _interior_material_coordinate left,right=.7999999999999997,.8 for node in np.polynomial.legendre.leggauss(5)[0]: actual=_interior_material_coordinate(left,right,node,allow_rounding=True) diff --git a/tests/test_general_contact_native_surface_history.py b/tests/test_general_contact_native_surface_history.py index bf4e2c3c2..c648d7ce1 100644 --- a/tests/test_general_contact_native_surface_history.py +++ b/tests/test_general_contact_native_surface_history.py @@ -5,12 +5,12 @@ import numpy as np import pytest -from anysolver._ge_beam3_p5_seeded.core import sha -from anysolver.general_contact.friction_point import initial_friction_point -from anysolver.general_contact.native_surface_history import ( +from anyfesolver._ge_beam3_p5_seeded.core import sha +from anyfesolver.general_contact.friction_point import initial_friction_point +from anyfesolver.general_contact.native_surface_history import ( NativeSurfaceHistoryField,NativeSurfaceMotionSegment,NativeSurfaceReplayBudget) -from anysolver.general_contact.native_surface_s3_friction import NativeS3MaterialConfiguration -from anysolver.general_contact.native_surface_transaction import NativeS3MaterialTransaction +from anyfesolver.general_contact.native_surface_s3_friction import NativeS3MaterialConfiguration +from anyfesolver.general_contact.native_surface_transaction import NativeS3MaterialTransaction from test_general_contact_native_surface_patch import _patch from test_general_contact_native_surface_normal import _settings @@ -26,9 +26,9 @@ def _segment(x,z): def test_exact_path_pose_reuse_preserves_arithmetic_refusal_and_mutation_isolation(): - from anysolver.general_contact.native_surface_path import material_path_pose, _PATH_POSES - from anysolver._ge_beam3_p5.compensated_coordinates import advance - from anysolver._ge_beam3_p5.algebra import rotation + from anyfesolver.general_contact.native_surface_path import material_path_pose, _PATH_POSES + from anyfesolver._ge_beam3_p5.compensated_coordinates import advance + from anyfesolver._ge_beam3_p5.algebra import rotation owner, _ = _patch(activation_policy='transverse_events', gap_check='straight_patch') start = _origin(owner) translations = np.arange(9, dtype=float).reshape(3, 3)*.00013 @@ -131,7 +131,7 @@ def test_history_snapshot_from_coupled_transaction_and_restored_path(): 'unexpected constitutive defect']) def test_ordinary_resolution_request_uses_certified_replay_but_other_errors_remain_fatal(monkeypatch,reason): from test_general_contact_native_surface_support import _field - from anysolver.general_contact.native_surface_s3_friction import NativeS3MaterialPointFriction + from anyfesolver.general_contact.native_surface_s3_friction import NativeS3MaterialPointFriction motion=NativeSurfaceMotionSegment(np.zeros((3,3)), np.array(((1.6,0.,0.),(0.,0.,0.))),np.zeros(18)) field=_field(height=.025,rotation=-.8,segments=(motion,)) @@ -182,8 +182,8 @@ def observed(*args,**kwargs): def test_complete_schedule_replay_keeps_constitutive_refusal(monkeypatch): from test_general_contact_native_surface_support import _field - from anysolver.general_contact.native_surface_s3_friction import NativeS3MaterialPointFriction - import anysolver.general_contact.native_surface_activation as activation + from anyfesolver.general_contact.native_surface_s3_friction import NativeS3MaterialPointFriction + import anyfesolver.general_contact.native_surface_activation as activation motion=NativeSurfaceMotionSegment(np.zeros((3,3)),np.array(((1.6,0.,0.),(0.,0.,0.))),np.zeros(18)) field=_field(height=.025,rotation=-.8,segments=(motion,)) def ordinary(*args,**kwargs):raise AssertionError('ordinary certificate should not be duplicated') @@ -200,8 +200,8 @@ def constitutive(*args,**kwargs):raise ValueError('unexpected constitutive defec def test_bound_whole_patch_ownership_reuses_only_the_same_point_path(): - from anysolver.general_contact.native_surface_support import history_target_ownership_certified,SupportIntervalBudget - from anysolver.general_contact.native_surface_path import certify_material_ownership + from anyfesolver.general_contact.native_surface_support import history_target_ownership_certified,SupportIntervalBudget + from anyfesolver.general_contact.native_surface_path import certify_material_ownership owner,bridge=_patch(activation_policy='transverse_events',gap_check='straight_patch') motion=_segment(.004,-.004) field=NativeSurfaceHistoryField(bridge.pair,_origin(owner),(motion,)) @@ -219,7 +219,7 @@ def test_bound_whole_patch_ownership_reuses_only_the_same_point_path(): def test_whole_history_proof_cannot_issue_for_a_foreign_replay_motion(): - from anysolver.general_contact.native_surface_support import history_target_ownership_certified,SupportIntervalBudget + from anyfesolver.general_contact.native_surface_support import history_target_ownership_certified,SupportIntervalBudget owner,bridge=_patch(activation_policy='transverse_events',gap_check='straight_patch') field=NativeSurfaceHistoryField(bridge.pair,_origin(owner),(_segment(.004,-.004),)) assert history_target_ownership_certified(field,budget=SupportIntervalBudget(128)) diff --git a/tests/test_general_contact_native_surface_local_fronts.py b/tests/test_general_contact_native_surface_local_fronts.py index 79099130f..d698b04ec 100644 --- a/tests/test_general_contact_native_surface_local_fronts.py +++ b/tests/test_general_contact_native_surface_local_fronts.py @@ -3,10 +3,10 @@ import os import numpy as np import pytest -from anysolver.general_contact.native_surface_history import NativeSurfaceHistoryField,NativeSurfaceMotionSegment -from anysolver.general_contact.native_surface_front import stationary_front_angular_cover,stationary_front_angular_envelopes -from anysolver.general_contact.native_surface_support import SupportIntervalBudget,_minimum -from anysolver.general_contact.native_surface_friction_integral import integrate_event_friction_fronts +from anyfesolver.general_contact.native_surface_history import NativeSurfaceHistoryField,NativeSurfaceMotionSegment +from anyfesolver.general_contact.native_surface_front import stationary_front_angular_cover,stationary_front_angular_envelopes +from anyfesolver.general_contact.native_surface_support import SupportIntervalBudget,_minimum +from anyfesolver.general_contact.native_surface_friction_integral import integrate_event_friction_fronts from test_general_contact_native_surface_support import _field from test_general_contact_native_surface_friction_integral import _settings @@ -91,7 +91,7 @@ def test_no_stationary_branch_does_not_discard_closed_material(): def test_variable_front_route_keeps_closed_no_stationary_surface_force(): from scipy.integrate import quad - from anysolver.general_contact.native_surface_friction_integral import integrate_variable_event_friction_fronts + from anyfesolver.general_contact.native_surface_friction_integral import integrate_variable_event_friction_fronts value=_mixed(height=.024,slope=.001,rotation=.2) result=integrate_variable_event_friction_fronts(value,_settings(),maximum_axial_uncertainty=1e-7) expected=.03*.3*1000*.6*quad(lambda delta:.03*np.cos(-.6+delta)-.0235,-.02,.02,epsabs=1e-14)[0] @@ -103,8 +103,8 @@ def test_variable_front_route_keeps_closed_no_stationary_surface_force(): def test_multisegment_strip_bound_uses_actual_branch_start(): from math import acos,sin,cos,fsum - from anysolver.general_contact.native_surface_path import material_path_pose - from anysolver.general_contact.native_surface_front_work import open_front_strip_work_bound + from anyfesolver.general_contact.native_surface_path import material_path_pose + from anyfesolver.general_contact.native_surface_front_work import open_front_strip_work_bound value=_three_segment_pulse();prefix=value.segments[0] start=material_path_pose(value.initial,prefix.translations,prefix.angular,prefix.shell_increment,1.) middle=NativeSurfaceHistoryField(value.patch,start,(value.segments[1],)) @@ -183,10 +183,10 @@ def independent_work(xi): def _saved_local_front_field(): import json from pathlib import Path - from anysolver.general_contact.native_surface_patch import NativeS3MaterialSurfacePatch - from anysolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule - from anysolver.general_contact.native_surface_s3_friction import NativeS3MaterialConfiguration - from anysolver.general_contact.native_surface_friction_integral import NativeSurfaceFrictionIntegrationSettings + from anyfesolver.general_contact.native_surface_patch import NativeS3MaterialSurfacePatch + from anyfesolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule + from anyfesolver.general_contact.native_surface_s3_friction import NativeS3MaterialConfiguration + from anyfesolver.general_contact.native_surface_friction_integral import NativeSurfaceFrictionIntegrationSettings from test_general_contact_native_surface_replay_owner import _replay_patch source=Path(__file__).parents[1]/'docs/d1_review_support/contact_c5_native_surface_point_20261002/replay_owner_second_load_rejected_path.json' saved=json.loads(source.read_text());_,bridge=_replay_patch('transverse_event_sequence') @@ -245,9 +245,9 @@ def test_saved_second_load_local_front_window(tmp_path): def test_history_work_cap_covers_inherited_elastic_state_during_unloading(): - from anysolver.general_contact.native_surface_front import prepare_stationary_band - from anysolver.general_contact.native_surface_front_work import history_front_strip_work_bound - from anysolver.general_contact.native_surface_history import NativeSurfaceReplayBudget + from anyfesolver.general_contact.native_surface_front import prepare_stationary_band + from anyfesolver.general_contact.native_surface_front_work import history_front_strip_work_bound + from anyfesolver.general_contact.native_surface_history import NativeSurfaceReplayBudget original=_mixed(rotation=0.) def move(dy,dz): translation=np.tile((0.,dy,dz),(3,1)) @@ -277,7 +277,7 @@ def test_deferred_directional_controls_match_eager_refined_integral(tmp_path,mon import json,os,time from pathlib import Path from types import SimpleNamespace - from anysolver.general_contact.native_surface_friction_integral import integrate_material_friction + from anyfesolver.general_contact.native_surface_friction_integral import integrate_material_friction value=_mixed(height=.024,slope=.001,rotation=.2) # Actual geometry, proof/cache and adaptive integration; replace only the # expensive material law with an independent degree-eight polynomial. @@ -326,10 +326,10 @@ def polynomial_query(self,xi,angle,*,budget): def test_complete_history_envelopes_bound_boundary_endpoint_and_stored_work(): - from anysolver.general_contact.native_surface_front_boundary import stationary_endpoint_angular_partition - from anysolver.general_contact.native_surface_front import prepare_stationary_band,axial_contact_front - from anysolver.general_contact.native_surface_front_work import history_front_strip_work_bound - from anysolver.general_contact.native_surface_history import NativeSurfaceReplayBudget + from anyfesolver.general_contact.native_surface_front_boundary import stationary_endpoint_angular_partition + from anyfesolver.general_contact.native_surface_front import prepare_stationary_band,axial_contact_front + from anyfesolver.general_contact.native_surface_front_work import history_front_strip_work_bound + from anyfesolver.general_contact.native_surface_history import NativeSurfaceReplayBudget value=_mixed(rotation=.8);budget=SupportIntervalBudget(128) partition=stationary_endpoint_angular_partition(value,0,value.patch.rule.definition['angle_range'],budget=budget) saw_closed=False @@ -370,7 +370,7 @@ def test_boundary_ending_front_retains_integrated_force_tangent_and_work(tmp_pat import json,time from pathlib import Path from scipy.integrate import quad - from anysolver.general_contact.native_surface_friction_integral import integrate_variable_event_friction_fronts + from anyfesolver.general_contact.native_surface_friction_integral import integrate_variable_event_friction_fronts value=_mixed(rotation=.8);folder=Path(os.environ.get('RUNNER_TEMP',str(tmp_path))) folder.mkdir(parents=True,exist_ok=True);start=time.perf_counter() try: @@ -412,7 +412,7 @@ def test_variable_route_rules_match_advertised_polynomial_moments(): production-kernel oracle. """ from numpy.polynomial.legendre import leggauss - from anysolver.general_contact.native_surface_friction_integral import ( + from anyfesolver.general_contact.native_surface_friction_integral import ( _square_cubature_degree7_angular_groups) nodes, weights = leggauss(3) assert len(nodes) == 3 and np.all(weights > 0.) @@ -460,7 +460,7 @@ def test_variable_route_gauss34_smooth_front_accuracy_tangent_and_refinement(tmp import json, os from pathlib import Path from scipy.integrate import quad - from anysolver.general_contact.native_surface_friction_integral import ( + from anyfesolver.general_contact.native_surface_friction_integral import ( integrate_variable_event_friction_fronts) value = _mixed(height=.024, slope=.001, rotation=.2) result = integrate_variable_event_friction_fronts(value, _settings(), maximum_axial_uncertainty=1e-7) @@ -567,11 +567,11 @@ def test_captured_front_motion_detector_selects_only_moving_front_saved_paths(): """ import json from pathlib import Path - from anysolver.general_contact.native_surface_friction_integral import ( + from anyfesolver.general_contact.native_surface_friction_integral import ( _captured_fronts_move_between_poses) - from anysolver.general_contact.native_surface_history import ( + from anyfesolver.general_contact.native_surface_history import ( NativeSurfaceHistoryField, NativeSurfaceMotionSegment) - from anysolver.general_contact.native_surface_s3_friction import NativeS3MaterialConfiguration + from anyfesolver.general_contact.native_surface_s3_friction import NativeS3MaterialConfiguration from test_general_contact_native_surface_patch import _patch from test_general_contact_native_surface_normal import _settings as normal_settings expected = { @@ -600,9 +600,9 @@ def _saved_locator_field(): """Saved second-load window covering the theta 3.0973 interface bracket.""" import json from pathlib import Path - from anysolver.general_contact.native_surface_patch import NativeS3MaterialSurfacePatch - from anysolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule - from anysolver.general_contact.native_surface_s3_friction import NativeS3MaterialConfiguration + from anyfesolver.general_contact.native_surface_patch import NativeS3MaterialSurfacePatch + from anyfesolver.general_contact.native_surface_quadrature import NativeRoundSurfaceRule + from anyfesolver.general_contact.native_surface_s3_friction import NativeS3MaterialConfiguration from test_general_contact_native_surface_replay_owner import _replay_patch source=Path(__file__).parents[1]/'docs/d1_review_support/contact_c5_native_surface_point_20261002/replay_owner_second_load_rejected_path.json' saved=json.loads(source.read_text());_,bridge=_replay_patch('transverse_event_sequence') @@ -630,7 +630,7 @@ def test_safeguarded_locator_resolves_stagnating_curved_margin_counterexample(): wide bracket midpoint near .55 as a cut after 12 calls. The safeguarded locator must resolve the true root .1 with an explicit tight bracket. """ - from anysolver.general_contact.native_surface_friction_integral import _safeguarded_branch_refinement + from anyfesolver.general_contact.native_surface_friction_integral import _safeguarded_branch_refinement def probe(x): margin=x*x-.01 return ('stick' if margin>=0. else 'slip',margin) @@ -646,7 +646,7 @@ def probe(x): def test_exhausted_locator_returns_labelled_hint_never_wide_midpoint(): - from anysolver.general_contact.native_surface_friction_integral import _safeguarded_branch_refinement + from anyfesolver.general_contact.native_surface_friction_integral import _safeguarded_branch_refinement def probe(x): margin=x*x-.01 return ('stick' if margin>=0. else 'slip',margin) @@ -665,7 +665,7 @@ def test_equal_endpoint_branches_make_hidden_transition_limitation_explicit(): what endpoint sampling can decide; the locator must report the limitation explicitly instead of certifying a transition-free edge. """ - from anysolver.general_contact.native_surface_friction_integral import _safeguarded_branch_refinement + from anyfesolver.general_contact.native_surface_friction_integral import _safeguarded_branch_refinement def probe(x): return ('slip' if .4=8 - from anysolver.general_contact.s3_skin_work import S3SkinWorkAdapter + from anyfesolver.general_contact.s3_skin_work import S3SkinWorkAdapter adapter=S3SkinWorkAdapter.from_model(shell[0].model,7,22,'top') skin=adapter.current_positions(subset_state.shell_displacement[:24]);budget=AggregateWorkBudget(1,1,1) original(adapter,skin,skin,0,budget,None) @@ -145,9 +145,21 @@ def test_public_coupled_two_step_multiple_body_response_and_both_path_legs(): def test_genuine_split_restart_chain_and_authenticated_translation_work_tamper(): + def forge_initial(owner, checkpoint): + # Use the prefix producer inside its original construction lifetime. + # The independent restart and full solves can outlive that owner. + changed=json.loads(checkpoint);record=changed['body']['controller']['initial'] + record['state']['shell_displacement'][owner.shell_p[0]]+=1e-6 + candidate=owner._state(record['state']);record['state_sha256']=sha(candidate) + record['accounting']=json.loads(canonical(owner._evaluate(candidate)[-1])) + changed['checkpoint_sha256']=sha(changed['body']) + return canonical(changed) + replay=os.environ.get('NMS8_RESTART_REPLAY') if replay is None: - owner,prefix=run(steps=1);resumed_owner,resumed=run(checkpoint=prefix.checkpoint);full_owner,full=run() + owner,prefix=run(steps=1) + forged_initial=forge_initial(owner,prefix.checkpoint) + resumed_owner,resumed=run(checkpoint=prefix.checkpoint);full_owner,full=run() prefix_state=owner.current;resumed_state=resumed_owner.current;full_state=full_owner.current else: # Only guarded immutable authentic PUBLIC producer artifacts. Ordinary @@ -161,6 +173,7 @@ def saved(label): return SimpleNamespace(checkpoint=capsule,to_dict=lambda:payload) prefix=saved('prefix');resumed=saved('resumed');full=saved('full');owner=build() assert binding['candidate_identity']==owner.identity + forged_initial=forge_initial(owner,prefix.checkpoint) prefix_state=owner._state(prefix.to_dict()['final']['state']) resumed_state=owner._state(resumed.to_dict()['final']['state']);full_state=owner._state(full.to_dict()['final']['state']) assert prefix.to_dict()['accepted_steps']==1 and resumed.to_dict()['accepted_steps']==2 @@ -172,11 +185,7 @@ def saved(label): with pytest.raises(NativeTransientError,match='native contact path/work journal mismatch'): solve_native_transient_multi_shell(fresh,config(fresh),checkpoint=raw,expected_sha256=sha256(raw).hexdigest(),max_steps=64,max_cutbacks=8,minimum_dt=.003/256) assert fresh.current is None and not fresh._candidates - changed=json.loads(prefix.checkpoint);record=changed['body']['controller']['initial'] - record['state']['shell_displacement'][owner.shell_p[0]]+=1e-6 - candidate=owner._state(record['state']);record['state_sha256']=sha(candidate) - record['accounting']=json.loads(canonical(owner._evaluate(candidate)[-1])) - changed['checkpoint_sha256']=sha(changed['body']);raw=canonical(changed);fresh=build() + raw=forged_initial;fresh=build() with pytest.raises(NativeTransientError,match='initial physical contract mismatch'): solve_native_transient_multi_shell(fresh,config(fresh),checkpoint=raw,expected_sha256=sha256(raw).hexdigest(),max_steps=64,max_cutbacks=8,minimum_dt=.003/256) assert fresh.current is None @@ -233,7 +242,7 @@ def test_topology_duplicate_pair_model_alias_and_definition_mutation_refusals(mo owner=build();state=_initial(owner);owner.shell_bodies[0].model.materials['elastic'].elastic_modulus*=2 with pytest.raises(ValueError):owner.trial(state,dt=.003) assert owner.current is state and not owner._candidates - from anysolver._ge_beam3_native_definition import NativeBeamDefinition + from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition native,shell,pairs=selections() too_many=tuple(replace(native[0],body_id=i) for i in (1,)+tuple(range(100,119))) def forbidden(*args):raise AssertionError('native preparation reached before global cap') diff --git a/tests/test_general_contact_native_transient_pair.py b/tests/test_general_contact_native_transient_pair.py index 32bcc291b..fbdb63ab1 100644 --- a/tests/test_general_contact_native_transient_pair.py +++ b/tests/test_general_contact_native_transient_pair.py @@ -11,12 +11,12 @@ from pathlib import Path import numpy as np import pytest -from anysolver._ge_beam3_connected_dynamic import _RetainedMidpointAssembly -from anysolver._ge_beam3_native_pair_contact import PATH_FAILURE, PROFILE -from anysolver._ge_beam3_native_transient import NativeTransientError -from anysolver._ge_beam3_p5_seeded.core import canonical, sha -from anysolver.control import CancellationToken, SolveCancelled -from anysolver.general_contact import solve_native_transient_pair +from anyfesolver._ge_beam3_connected_dynamic import _RetainedMidpointAssembly +from anyfesolver._ge_beam3_native_pair_contact import PATH_FAILURE, PROFILE +from anyfesolver._ge_beam3_native_transient import NativeTransientError +from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver.general_contact import solve_native_transient_pair from examples.general_contact_native_pair_impact_dev import build, config, run @@ -92,7 +92,7 @@ def observed(*poses,**kwargs): return evaluate(*poses,**kwargs) except Exception as failure: if os.environ.get('C8_JOB_DIR'): - from anysolver.general_contact.native_retained_whole_pair import _private_interval_open, _private_factored_gap + from anyfesolver.general_contact.native_retained_whole_pair import _private_interval_open, _private_factored_gap if 'source_curve' in diagnostics: source,target = diagnostics['source_curve'],diagnostics['target_curve'] left,right = diagnostics['interval'] @@ -246,8 +246,8 @@ def test_native_contact_identity_change_and_event_budget_refuse(): build(maximum_penetration_m=.1) with pytest.raises(ValueError): build(maximum_swept_intervals=4097) - from anysolver._ge_beam3_native_pair_contact import NativePairContactAnalysis, ENDPOINT_POLICY - from anysolver.general_contact.native_retained_whole_pair import NativeRetainedWholeCurvePair + from anyfesolver._ge_beam3_native_pair_contact import NativePairContactAnalysis, ENDPOINT_POLICY + from anyfesolver.general_contact.native_retained_whole_pair import NativeRetainedWholeCurvePair from examples.general_contact_native_pair_impact_dev import definitions curved = definitions(separation=.2,rise=.01) a,_ = curved[0].instantiate(); b,_ = curved[1].instantiate() diff --git a/tests/test_general_contact_native_transient_shell.py b/tests/test_general_contact_native_transient_shell.py index dc1102cac..05d459527 100644 --- a/tests/test_general_contact_native_transient_shell.py +++ b/tests/test_general_contact_native_transient_shell.py @@ -5,12 +5,12 @@ import json import numpy as np import pytest -from anysolver import create_native_transient_shell_analysis, solve_native_transient_shell -from anysolver._ge_beam3_connected_dynamic import _RetainedMidpointAssembly -from anysolver._ge_beam3_native_shell_contact import PATH_FAILURE, PROFILE, SHELL_P, SHELL_Z -from anysolver._ge_beam3_native_transient import NativeTransientError -from anysolver._ge_beam3_p5_seeded.core import canonical, sha -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver import create_native_transient_shell_analysis, solve_native_transient_shell +from anyfesolver._ge_beam3_connected_dynamic import _RetainedMidpointAssembly +from anyfesolver._ge_beam3_native_shell_contact import PATH_FAILURE, PROFILE, SHELL_P, SHELL_Z +from anyfesolver._ge_beam3_native_transient import NativeTransientError +from anyfesolver._ge_beam3_p5_seeded.core import canonical, sha +from anyfesolver.control import CancellationToken, SolveCancelled from examples.general_contact_native_shell_impact_dev import build, config, run diff --git a/tests/test_general_contact_native_two_fibre_s3.py b/tests/test_general_contact_native_two_fibre_s3.py index 24b9ad3d2..1679b9f5e 100644 --- a/tests/test_general_contact_native_two_fibre_s3.py +++ b/tests/test_general_contact_native_two_fibre_s3.py @@ -6,7 +6,7 @@ import pytest from test_general_contact_native_curved_s3_static import _analysis from test_general_contact_native_fibre_s3 import _independent_material_history -from anysolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver._ge_beam3_p5_seeded.core import canonical def _owner(two_facets=False): @@ -61,7 +61,7 @@ def test_two_fibre_beams_shared_target_complete_local_work(two_facets): assert sha256(raw).hexdigest()=='98d22bd2aff840df5d7b1034298891b179ed438ec9246a9f76b89445a7a15347' source=json.loads(raw)['records'][0];saved=source['mechanical'] data={key:np.array(value,copy=True) for key,value in owner.initial.mechanical.descriptor().items()} - from anysolver._ge_beam3_p5.compensated_coordinates import split_sum + from anyfesolver._ge_beam3_p5.compensated_coordinates import split_sum for i,nodes in enumerate(owner.context.nodes): for local,node in enumerate(nodes): for axis in range(3): diff --git a/tests/test_general_contact_nodal_force_linearization.py b/tests/test_general_contact_nodal_force_linearization.py index b538a66d4..e3b50c745 100644 --- a/tests/test_general_contact_nodal_force_linearization.py +++ b/tests/test_general_contact_nodal_force_linearization.py @@ -2,8 +2,8 @@ import numpy as np -from anysolver.general_contact.s3_patch_augmented import MovingS3PatchProjectedNormal -from anysolver.general_contact.s3_patch_mortar_energy import ( +from anyfesolver.general_contact.s3_patch_augmented import MovingS3PatchProjectedNormal +from anyfesolver.general_contact.s3_patch_mortar_energy import ( MovingS3PatchPrimalMortarPenalty, S3PatchFace, ) diff --git a/tests/test_general_contact_ordinary_supported_schur.py b/tests/test_general_contact_ordinary_supported_schur.py index 8a78a955c..5fc831252 100644 --- a/tests/test_general_contact_ordinary_supported_schur.py +++ b/tests/test_general_contact_ordinary_supported_schur.py @@ -6,12 +6,12 @@ import numpy as np import pytest -from anysolver import solve_static_nonlinear -from anysolver.control import CancellationToken -from anysolver.element_capabilities import ElementCapabilityError -from anysolver.general_contact import linearized_pivot -from anysolver.general_contact.core import contact_scope -from anysolver.general_contact.supported_schur import SupportedSchurProposal +from anyfesolver import solve_static_nonlinear +from anyfesolver.control import CancellationToken +from anyfesolver.element_capabilities import ElementCapabilityError +from anyfesolver.general_contact import linearized_pivot +from anyfesolver.general_contact.core import contact_scope +from anyfesolver.general_contact.supported_schur import SupportedSchurProposal from scripts.general_contact_d1_finite_area_load import build_case diff --git a/tests/test_general_contact_original_workflow_first_increment.py b/tests/test_general_contact_original_workflow_first_increment.py index 4e4e78d8f..0c69b9543 100644 --- a/tests/test_general_contact_original_workflow_first_increment.py +++ b/tests/test_general_contact_original_workflow_first_increment.py @@ -40,8 +40,8 @@ import numpy as np import pytest -from anysolver import solve_static_nonlinear -from anysolver.general_contact import semismooth_path +from anyfesolver import solve_static_nonlinear +from anyfesolver.general_contact import semismooth_path REPOSITORY_ROOT = Path(__file__).resolve().parents[1] SEED_DECISION_MODULE = (Path(__file__).resolve().parent diff --git a/tests/test_general_contact_original_workflow_qp_mechanism.py b/tests/test_general_contact_original_workflow_qp_mechanism.py index 50e98d8e0..d4a22de17 100644 --- a/tests/test_general_contact_original_workflow_qp_mechanism.py +++ b/tests/test_general_contact_original_workflow_qp_mechanism.py @@ -34,9 +34,9 @@ import numpy as np import pytest -from anysolver import solve_static_nonlinear -from anysolver.control import SolveCancelled -from anysolver.general_contact import initial_contact_seed, semismooth_path +from anyfesolver import solve_static_nonlinear +from anyfesolver.control import SolveCancelled +from anyfesolver.general_contact import initial_contact_seed, semismooth_path FIXTURE_DIR = Path("C:/ANYworkspaceWork/contact_joint_dual_full8_20261010") DESCRIPTOR_PATH = FIXTURE_DIR / "force-full.json" diff --git a/tests/test_general_contact_original_workflow_seed_decision.py b/tests/test_general_contact_original_workflow_seed_decision.py index f4d36e6a7..ab186a269 100644 --- a/tests/test_general_contact_original_workflow_seed_decision.py +++ b/tests/test_general_contact_original_workflow_seed_decision.py @@ -40,10 +40,10 @@ import pytest import scipy -from anysolver import solve_static_nonlinear -from anysolver.control import SolveCancelled -from anysolver.general_contact import semismooth_path -from anysolver.general_contact.core import _contact_settings_contract +from anyfesolver import solve_static_nonlinear +from anyfesolver.control import SolveCancelled +from anyfesolver.general_contact import semismooth_path +from anyfesolver.general_contact.core import _contact_settings_contract FIXTURE_DIR = Path("C:/ANYworkspaceWork/contact_joint_dual_full8_20261010") DESCRIPTOR_PATH = FIXTURE_DIR / "force-full.json" @@ -429,7 +429,7 @@ def test_first_actual_v2_proposal_refusal_is_explicit(): program_contract_before = program.contract() boundary_before = repr(model.boundary_conditions) constraints_before = repr(model.constraint_equations) - from anysolver.general_contact.initial_contact_seed import ( + from anyfesolver.general_contact.initial_contact_seed import ( InitialContactSeedRefusal) original_propose = semismooth_path.propose_linearized_kkt_seed @@ -560,7 +560,7 @@ def __exit__(self, *exc): assert np.all(np.asarray(payload["origin_q"]) == 0.0) assert np.all(np.asarray(payload["origin_nodal_forces"]) == 0.0) - from anysolver.general_contact.initial_contact_seed import ( + from anyfesolver.general_contact.initial_contact_seed import ( InitialContactSeedRefusal) original_propose = semismooth_path.propose_linearized_kkt_seed diff --git a/tests/test_general_contact_overlap.py b/tests/test_general_contact_overlap.py index 89fa4ee08..d5ca23d4e 100644 --- a/tests/test_general_contact_overlap.py +++ b/tests/test_general_contact_overlap.py @@ -3,9 +3,9 @@ import numpy as np import pytest -from anysolver import create_shell_element -from anysolver.fe_core import FEModel -from anysolver.general_contact.overlap import ( +from anyfesolver import create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.overlap import ( PlanarFace, current_planar_shell_face, planar_projected_overlap, diff --git a/tests/test_general_contact_overlap_dual_certificate.py b/tests/test_general_contact_overlap_dual_certificate.py index b0b3edf82..af703b5bb 100644 --- a/tests/test_general_contact_overlap_dual_certificate.py +++ b/tests/test_general_contact_overlap_dual_certificate.py @@ -7,7 +7,7 @@ import numpy as np import pytest -from anysolver.general_contact import q4_overlap_local_bound as bounds +from anyfesolver.general_contact import q4_overlap_local_bound as bounds def controls(values, count): diff --git a/tests/test_general_contact_overlap_dual_integration.py b/tests/test_general_contact_overlap_dual_integration.py index 5c1ef33cb..2e0a0e060 100644 --- a/tests/test_general_contact_overlap_dual_integration.py +++ b/tests/test_general_contact_overlap_dual_integration.py @@ -6,8 +6,8 @@ import numpy as np import pytest -from anysolver.general_contact.core import ContactSolverSettings, _contact_settings_contract -from anysolver.general_contact import s3_patch_static as owner +from anyfesolver.general_contact.core import ContactSolverSettings, _contact_settings_contract +from anyfesolver.general_contact import s3_patch_static as owner from test_general_contact_predictor_compatibility import legacy_settings @@ -101,7 +101,7 @@ def test_enabled_actual_caller_refuses_unresolved_and_preserves_exceptions(monke def test_default_public_request_settings_preserve_original_asdict_shape(): from test_general_contact_q4_s3_patch_static import _case - from anysolver import identify_general_contact_request, ContactPathControl, ContactPathProgram + from anyfesolver import identify_general_contact_request, ContactPathControl, ContactPathProgram model, definition, config = _case() assert config.q4_source_overlap_dual_dev is False program = ContactPathProgram((ContactPathControl.node(1, 'uz'),), ((0.,), (-.01,))) @@ -118,7 +118,7 @@ def test_default_public_request_settings_preserve_original_asdict_shape(): def test_enabled_actual_dispatch_refuses_reversed_body_family(): from test_general_contact_q4_s3_patch_static import _case - from anysolver import validate_general_contact + from anyfesolver import validate_general_contact model, definition, _ = _case() pair = replace(definition.interactions[0], surface='s3_target', target='q4_source') incompatible = replace(definition, interactions=(pair,)) diff --git a/tests/test_general_contact_overlap_local_swept_roundoff.py b/tests/test_general_contact_overlap_local_swept_roundoff.py index e4827da70..f6cf9d635 100644 --- a/tests/test_general_contact_overlap_local_swept_roundoff.py +++ b/tests/test_general_contact_overlap_local_swept_roundoff.py @@ -7,10 +7,10 @@ import numpy as np import pytest -from anysolver.general_contact.q4_overlap_local_bound import ( +from anyfesolver.general_contact.q4_overlap_local_bound import ( _normal_controls_interval, overlap_local_swept_lower, ) -from anysolver.general_contact.s3_patch_static import ( +from anyfesolver.general_contact.s3_patch_static import ( GeneralS3PatchManager, _affine_midpoint_with_error, ) from scripts.general_contact_d1_interior_press_dev import build_interior_press diff --git a/tests/test_general_contact_pair.py b/tests/test_general_contact_pair.py index 4b1a7cde2..0a2f2be09 100644 --- a/tests/test_general_contact_pair.py +++ b/tests/test_general_contact_pair.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, @@ -15,9 +15,9 @@ solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel -from anysolver.general_contact.pair import _PlanarShellPairManager -from anysolver.general_contact.patch_sliding import _RestrictedSlidingPatchFEManager +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.pair import _PlanarShellPairManager +from anyfesolver.general_contact.patch_sliding import _RestrictedSlidingPatchFEManager def _guided_pair(*, split_target=False, target_shift=0.0, @@ -439,8 +439,8 @@ def test_restricted_sliding_s3_source_solves_with_physical_offset(): def test_restricted_swept_bound_uses_fixed_overlap_endpoint_certificate(): - from anysolver.general_contact.moving import bound_swept_moving_mortar_gap - from anysolver.general_contact.sliding import _RestrictedSlidingPairFEManager + from anyfesolver.general_contact.moving import bound_swept_moving_mortar_gap + from anyfesolver.general_contact.sliding import _RestrictedSlidingPairFEManager model, _load, original, source_nodes = _guided_mixed_pair( "Q4", "S3", source_shift=(0.15, 0.1), diff --git a/tests/test_general_contact_paired_pressure_response.py b/tests/test_general_contact_paired_pressure_response.py index 026f55581..54a8c88cd 100644 --- a/tests/test_general_contact_paired_pressure_response.py +++ b/tests/test_general_contact_paired_pressure_response.py @@ -5,12 +5,12 @@ from pathlib import Path import numpy as np import pytest -from anysolver import FEModel, BoundaryCondition, create_shell_element -from anysolver.general_contact import ContactSurface, ContactInteraction, resolve_automatic_contact_domain -from anysolver.general_contact.static_path import ContactPathControl, ContactPathProgram, ContactPathNodalForce -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.general_contact.semismooth import linearize, complementarity, reference_nodal_support -from anysolver.general_contact.pressure_diagnostics import PressureResponseScales, paired_pressure_response, finite_pressure_pose +from anyfesolver import FEModel, BoundaryCondition, create_shell_element +from anyfesolver.general_contact import ContactSurface, ContactInteraction, resolve_automatic_contact_domain +from anyfesolver.general_contact.static_path import ContactPathControl, ContactPathProgram, ContactPathNodalForce +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.semismooth import linearize, complementarity, reference_nodal_support +from anyfesolver.general_contact.pressure_diagnostics import PressureResponseScales, paired_pressure_response, finite_pressure_pose from examples.general_contact_tilted_relative_sliding import build as base_build, solve, rotation, rigid_pose ROOT=Path(__file__).parents[1] @@ -91,7 +91,7 @@ def bind_response(report,k,g,b): def physical_gates(model,settings,res,program,meta,pose): - from anysolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate + from anyfesolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate manager=GeneralS3PatchManager(model,res.definition,settings);free,rows=selectors(model,program) q=np.asarray(pose['u']);z=np.asarray(pose['z']);manager.require_finite_deformation(q);skin=manager.finite_skin.pose(q) independent=np.array([manager.finite_skin.reference[i]+q[d[:3]]+manager.finite_skin.offsets[i]*prior.decimal_director(q[d[3:]],manager.finite_skin.directors[i]) for i,d in enumerate(manager.finite_skin.dofs)]) @@ -149,7 +149,7 @@ def test_manufactured_paired_and_rectangular_nullspace(): @pytest.mark.skipif(not BASE.is_file(), reason='archived BASE pose run-14.json absent (C:/ANYworkspaceWork/contact_tilted_relative_sliding_20261008/outputs/v3/run-14.json): authenticated sixty-degree paired response requires the saved sha-pinned BASE pose') def test_authenticated_base_sixty_degree_paired_response(): - from anysolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate + from anyfesolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate assert hashlib.sha256(BASE.read_bytes()).hexdigest()==BASE_SHA stored=json.loads(BASE.read_text());model,domain,settings,res,program,meta=fixture();assert res.identity==stored['identity'] pose=stored['poses'][-1];assert pose['step']==14 and pose['u']==stored['checkpoint']['displacements'] and pose['z']==stored['checkpoint']['path_state']['normal_forces'] @@ -228,13 +228,13 @@ def test_saved_refinement_physical_response_and_modes(): or not Path('C:/ANYworkspaceWork/contact_tilted_relative_sliding_20261008/current-install.json').is_file(), reason='archived base.json diagnostic under AUTOMATIC_WORKFLOW_EVIDENCE, BASE run-14.json, or current-install.json absent: installed saved-matrix consumer requires the saved matrices and install manifest') def test_installed_saved_matrix_consumer_and_refusals(monkeypatch): - import anysolver - import anysolver.nonlinear_static as structural_owner + import anyfesolver + import anyfesolver.nonlinear_static as structural_owner saved=read('base')['diagnostic'];data=saved['matrix_inputs'];moment=np.array(saved['free_dofs'])%6>=3 current=paired_pressure_response(data['constrained_tangent'],data['gap_chart'],data['force_spin'],saved['support'],moment,scales=SCALES,active_modes=np.isin(np.arange(len(saved['support'])),saved['active_mode_indices'])) for key in ('force_detection','gap_response','active_gap_response'): np.testing.assert_array_equal(current[key]['singular_values'],saved[key]['singular_values']) - site=Path(anysolver.__file__).resolve().parent.parent;manifest=json.loads((site.parent/'install.json').read_text()) + site=Path(anyfesolver.__file__).resolve().parent.parent;manifest=json.loads((site.parent/'install.json').read_text()) old=json.loads(Path('C:/ANYworkspaceWork/contact_tilted_relative_sliding_20261008/current-install.json').read_text()) assert all(manifest['payload_sha256'][name]==digest for name,digest in old['payload_sha256'].items()) model,_,settings,res,program,_=fixture();manager=GeneralS3PatchManager(model,res.definition,settings);free,_=selectors(model,program);pose=json.loads(BASE.read_text())['poses'][-1] diff --git a/tests/test_general_contact_partial_swept_enclosure.py b/tests/test_general_contact_partial_swept_enclosure.py index 3041da4ea..494f076c2 100644 --- a/tests/test_general_contact_partial_swept_enclosure.py +++ b/tests/test_general_contact_partial_swept_enclosure.py @@ -3,7 +3,7 @@ import numpy as np -from anysolver.general_contact import s3_patch_static as owner +from anyfesolver.general_contact import s3_patch_static as owner from test_general_contact_projected_penalty import _candidate diff --git a/tests/test_general_contact_patch_broadphase.py b/tests/test_general_contact_patch_broadphase.py index f5b3ded39..b10938d28 100644 --- a/tests/test_general_contact_patch_broadphase.py +++ b/tests/test_general_contact_patch_broadphase.py @@ -3,9 +3,9 @@ import numpy as np import pytest -from anysolver.general_contact.overlap import PlanarFace, planar_projected_overlap -from anysolver.general_contact.patch_mortar import MovingPatchMortar, PatchFace -from anysolver.general_contact.pointwise_patch import PointwisePatchPenalty +from anyfesolver.general_contact.overlap import PlanarFace, planar_projected_overlap +from anyfesolver.general_contact.patch_mortar import MovingPatchMortar, PatchFace +from anyfesolver.general_contact.pointwise_patch import PointwisePatchPenalty def _grid(body, origin_x, subdivisions=4): diff --git a/tests/test_general_contact_patch_mortar.py b/tests/test_general_contact_patch_mortar.py index 0b6e42a0a..25c1c37c1 100644 --- a/tests/test_general_contact_patch_mortar.py +++ b/tests/test_general_contact_patch_mortar.py @@ -3,11 +3,11 @@ import numpy as np import pytest -from anysolver.general_contact.moving import ( +from anyfesolver.general_contact.moving import ( moving_mortar_state, moving_mortar_translation_residual, ) -from anysolver.general_contact.overlap import PlanarFace -from anysolver.general_contact.patch_mortar import MovingPatchMortar, PatchFace +from anyfesolver.general_contact.overlap import PlanarFace +from anyfesolver.general_contact.patch_mortar import MovingPatchMortar, PatchFace def _quad(feature, x0, x1, y0=0.0, y1=1.0): diff --git a/tests/test_general_contact_patch_pressure_resolution.py b/tests/test_general_contact_patch_pressure_resolution.py index 5649e5e7a..7b98f36fc 100644 --- a/tests/test_general_contact_patch_pressure_resolution.py +++ b/tests/test_general_contact_patch_pressure_resolution.py @@ -9,8 +9,8 @@ import numpy as np import pytest -from anysolver.general_contact.overlap import PlanarFace -from anysolver.general_contact.patch_mortar import MovingPatchMortar, PatchFace +from anyfesolver.general_contact.overlap import PlanarFace +from anyfesolver.general_contact.patch_mortar import MovingPatchMortar, PatchFace _STIFFNESS = 4.0e6 # Pa/m diff --git a/tests/test_general_contact_patch_refinement.py b/tests/test_general_contact_patch_refinement.py index 2d6e0685e..ba4e5b638 100644 --- a/tests/test_general_contact_patch_refinement.py +++ b/tests/test_general_contact_patch_refinement.py @@ -6,14 +6,14 @@ import pytest from numpy.polynomial.legendre import leggauss -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, LoadCase, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel -from anysolver.general_contact.patch_sliding import _RestrictedSlidingPatchFEManager -from anysolver.nonlinear_static import _assemble_nonlinear_system_unchecked +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.patch_sliding import _RestrictedSlidingPatchFEManager +from anyfesolver.nonlinear_static import _assemble_nonlinear_system_unchecked @pytest.fixture(scope="module") diff --git a/tests/test_general_contact_patch_sliding.py b/tests/test_general_contact_patch_sliding.py index 8c18fe630..242f90763 100644 --- a/tests/test_general_contact_patch_sliding.py +++ b/tests/test_general_contact_patch_sliding.py @@ -3,14 +3,14 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, DisplacementControl, LoadCase, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel -from anysolver.general_contact.patch_sliding import _RestrictedSlidingPatchFEManager -from anysolver.general_contact.static_path import ( +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.patch_sliding import _RestrictedSlidingPatchFEManager +from anyfesolver.general_contact.static_path import ( ContactPathControl, ContactPathProgram, ) diff --git a/tests/test_general_contact_planar_overlap_gap.py b/tests/test_general_contact_planar_overlap_gap.py index 3c8657c26..b7541a5e8 100644 --- a/tests/test_general_contact_planar_overlap_gap.py +++ b/tests/test_general_contact_planar_overlap_gap.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver.general_contact.q4_source_overlap import ( +from anyfesolver.general_contact.q4_source_overlap import ( q4_source_planar_overlap_gap_lower, ) diff --git a/tests/test_general_contact_plane.py b/tests/test_general_contact_plane.py index 3faebee3e..8aa197457 100644 --- a/tests/test_general_contact_plane.py +++ b/tests/test_general_contact_plane.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, @@ -16,8 +16,8 @@ solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel -from anysolver.general_contact.core import ( +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.core import ( _PlanarQ4PlaneManager, active_contact_manager, contact_scope, diff --git a/tests/test_general_contact_plane_end_ownership.py b/tests/test_general_contact_plane_end_ownership.py index 9669a1622..5b379366c 100644 --- a/tests/test_general_contact_plane_end_ownership.py +++ b/tests/test_general_contact_plane_end_ownership.py @@ -6,8 +6,8 @@ import numpy as np import pytest from scipy.optimize import brentq -from anysolver import BoundaryCondition,LoadCase,solve_static_nonlinear -from anysolver.general_contact.beam_plane import _BeamPlaneManager +from anyfesolver import BoundaryCondition,LoadCase,solve_static_nonlinear +from anyfesolver.general_contact.beam_plane import _BeamPlaneManager from test_general_contact_beam_plane import _model diff --git a/tests/test_general_contact_plane_event_front_controls.py b/tests/test_general_contact_plane_event_front_controls.py index 71b05b0f8..2ae094f69 100644 --- a/tests/test_general_contact_plane_event_front_controls.py +++ b/tests/test_general_contact_plane_event_front_controls.py @@ -4,12 +4,12 @@ import runpy import numpy as np import pytest -from anysolver import ContactTransientSolverControls,TransientConfig -from anysolver.general_contact.transient import _restart_analysis_contract -from anysolver.general_contact.multiple_shell_planes import MultipleShellPlaneManager -from anysolver.general_contact.core import ContactSolverSettings -from anysolver.general_contact.plane_newmark_events import localize_endpoint_event -from anysolver.general_contact.event_subdivision import EventNeedsCutback +from anyfesolver import ContactTransientSolverControls,TransientConfig +from anyfesolver.general_contact.transient import _restart_analysis_contract +from anyfesolver.general_contact.multiple_shell_planes import MultipleShellPlaneManager +from anyfesolver.general_contact.core import ContactSolverSettings +from anyfesolver.general_contact.plane_newmark_events import localize_endpoint_event +from anyfesolver.general_contact.event_subdivision import EventNeedsCutback @pytest.mark.parametrize('controls',[ @@ -36,7 +36,7 @@ def contract(c):return _restart_analysis_contract(transient,c,manager, stripped=dict(on['controls']) del stripped['batch_plane_event_fronts_dev'];del stripped['plane_event_front_revision'] assert stripped==off['controls'] - from anysolver.nonlinear_restart import analysis_configuration_fingerprint + from anyfesolver.nonlinear_restart import analysis_configuration_fingerprint assert analysis_configuration_fingerprint(on)!=analysis_configuration_fingerprint(off) diff --git a/tests/test_general_contact_plane_motion.py b/tests/test_general_contact_plane_motion.py index c953eaa38..9f1dac205 100644 --- a/tests/test_general_contact_plane_motion.py +++ b/tests/test_general_contact_plane_motion.py @@ -5,15 +5,15 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, DisplacementControl, LoadCase, NonlinearConvergenceSettings, RigidContactBody, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel -from anysolver.general_contact.core import _PlanarQ4PlaneManager +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.core import _PlanarQ4PlaneManager def _moving_plane(): diff --git a/tests/test_general_contact_plane_newmark_events.py b/tests/test_general_contact_plane_newmark_events.py index 919190583..a13b0da10 100644 --- a/tests/test_general_contact_plane_newmark_events.py +++ b/tests/test_general_contact_plane_newmark_events.py @@ -6,8 +6,8 @@ import numpy as np import pytest -from anysolver.general_contact.event_subdivision import EventNeedsCutback -from anysolver.general_contact.plane_newmark_events import ( +from anyfesolver.general_contact.event_subdivision import EventNeedsCutback +from anyfesolver.general_contact.plane_newmark_events import ( branch_path_admissible, hermite_branch_extrema, localize_endpoint_event, ) diff --git a/tests/test_general_contact_point_budget_decision.py b/tests/test_general_contact_point_budget_decision.py index aa9177611..9dc5f14de 100644 --- a/tests/test_general_contact_point_budget_decision.py +++ b/tests/test_general_contact_point_budget_decision.py @@ -3,7 +3,7 @@ from unittest.mock import Mock import numpy as np import pytest -from anysolver.general_contact import s3_patch_static as owner +from anyfesolver.general_contact import s3_patch_static as owner def fixture(targets=2): source=np.array(((0,0,0),(1,0,0),(1,1,0),(0,1,0)),float) diff --git a/tests/test_general_contact_pointwise_patch.py b/tests/test_general_contact_pointwise_patch.py index 885e070f5..42adcf9c7 100644 --- a/tests/test_general_contact_pointwise_patch.py +++ b/tests/test_general_contact_pointwise_patch.py @@ -3,9 +3,9 @@ import numpy as np import pytest -from anysolver.general_contact.overlap import PlanarFace -from anysolver.general_contact.patch_mortar import MovingPatchMortar, PatchFace -from anysolver.general_contact.pointwise_patch import PointwisePatchPenalty +from anyfesolver.general_contact.overlap import PlanarFace +from anyfesolver.general_contact.patch_mortar import MovingPatchMortar, PatchFace +from anyfesolver.general_contact.pointwise_patch import PointwisePatchPenalty def _face(identity, xy, node_ids): diff --git a/tests/test_general_contact_polynomial_roots.py b/tests/test_general_contact_polynomial_roots.py index c9274a9f4..be81f3d2a 100644 --- a/tests/test_general_contact_polynomial_roots.py +++ b/tests/test_general_contact_polynomial_roots.py @@ -7,7 +7,7 @@ import numpy as np import pytest -from anysolver.general_contact.polynomial_roots import near_real_roots +from anyfesolver.general_contact.polynomial_roots import near_real_roots def _decimal_real_root(coefficients, initial): @@ -120,7 +120,7 @@ def test_small_nonzero_real_part_of_admitted_conjugates(): def test_algebraic_cutoff_equality_and_nonreal_common_factor(): - from anysolver.general_contact.polynomial_roots import _algebraic_sign, _isolate + from anyfesolver.general_contact.polynomial_roots import _algebraic_sign, _isolate # p=(x-1)(x^2+1), q=(x-1)(3x+1) share the sole real root exactly. root = _isolate((-1, 1, -1, 1))[0] assert _algebraic_sign(root, (Fraction(-1), Fraction(-2), Fraction(3))) == 0 @@ -136,7 +136,7 @@ def test_exact_imaginary_threshold_and_rejected_complex_pair(): def test_captured_cross_host_coefficients_and_projection(monkeypatch): - from anysolver.general_contact.beam_curve_pair import closest_on_b3 + from anyfesolver.general_contact.beam_curve_pair import closest_on_b3 coefficients = [float.fromhex(x) for x in ( '0x1.f204e4472b959p-1', '-0x1.0000000000000p+0', '-0x1.c43308c4b6156p-25', '-0x1.a3debef364c7ep-15')] diff --git a/tests/test_general_contact_polynomial_roots_reuse.py b/tests/test_general_contact_polynomial_roots_reuse.py index 7abecacf6..b68274321 100644 --- a/tests/test_general_contact_polynomial_roots_reuse.py +++ b/tests/test_general_contact_polynomial_roots_reuse.py @@ -9,7 +9,7 @@ import pytest -import anysolver.general_contact.polynomial_roots as roots +import anyfesolver.general_contact.polynomial_roots as roots @pytest.fixture diff --git a/tests/test_general_contact_predictor_compatibility.py b/tests/test_general_contact_predictor_compatibility.py index 25571b986..d7f810b9b 100644 --- a/tests/test_general_contact_predictor_compatibility.py +++ b/tests/test_general_contact_predictor_compatibility.py @@ -74,7 +74,7 @@ def legacy_settings(settings): def test_actual_manager_contract_matches_pre_selector_schema(kind,monkeypatch): if kind=='caps': from examples.general_contact_multiple_beam_s3_caps import build - from anysolver.general_contact import multiple_beam_s3_caps as module + from anyfesolver.general_contact import multiple_beam_s3_caps as module model,definition,settings,_=build() manager=module.MultipleBeamS3CapManager(model,definition,settings) contract=manager.restart_contract() @@ -84,7 +84,7 @@ def test_actual_manager_contract_matches_pre_selector_schema(kind,monkeypatch): assert manager.restart_contract()==contract elif kind=='transient': from examples.general_contact_multiple_beam_s3_transient import build - from anysolver.general_contact import multiple_beam_s3_transient as module + from anyfesolver.general_contact import multiple_beam_s3_transient as module model,definition,settings,_=build() manager=module.MultipleBeamS3TransientManager(model,definition,settings) contract=manager.restart_contract() @@ -93,7 +93,7 @@ def test_actual_manager_contract_matches_pre_selector_schema(kind,monkeypatch): assert manager.restart_contract()==contract else: from examples.general_contact_triangulated_rigid import case - from anysolver.general_contact import triangulated_rigid_static as module + from anyfesolver.general_contact import triangulated_rigid_static as module manager=module.TriangulatedRigidManager(*case()) contract=manager._contract_bytes() assert 'path_predictor' not in json.loads(contract)['settings'] @@ -103,9 +103,9 @@ def test_actual_manager_contract_matches_pre_selector_schema(kind,monkeypatch): def test_common_settings_contract_keeps_optin_and_all_prior_fields(): - from anysolver import ContactSolverSettings - from anysolver.general_contact.core import _contact_settings_contract - from anysolver.general_contact.automatic_domain import _settings_contract + from anyfesolver import ContactSolverSettings + from anyfesolver.general_contact.core import _contact_settings_contract + from anyfesolver.general_contact.automatic_domain import _settings_contract settings=ContactSolverSettings(path_predictor='control_projection_dev',maximum_swept_subdivisions=9) expected={**legacy_settings(settings),'path_predictor':'control_projection_dev'} assert _contact_settings_contract(settings)==expected==_settings_contract(settings) @@ -116,7 +116,7 @@ def test_common_settings_contract_keeps_optin_and_all_prior_fields(): def test_public_optin_request_identity_then_actual_first_press(): - from anysolver import identify_general_contact_request,verify_general_contact_request,LoadCase,ContactRequestIdentityError + from anyfesolver import identify_general_contact_request,verify_general_contact_request,LoadCase,ContactRequestIdentityError from examples.general_contact_automatic_domain import build_projected_shell_pair,solve_shell_pair model,domain,settings,resolution,path=build_projected_shell_pair(lifecycle=True, path_predictor='control_projection_dev') diff --git a/tests/test_general_contact_preparation_reuse.py b/tests/test_general_contact_preparation_reuse.py index 1450aa5cb..04fe5ed24 100644 --- a/tests/test_general_contact_preparation_reuse.py +++ b/tests/test_general_contact_preparation_reuse.py @@ -5,10 +5,10 @@ import numpy as np import pytest -from anysolver.general_contact import s3_patch_static as owner -from anysolver.general_contact.q4_overlap_local_bound import overlap_local_lower -from anysolver.general_contact.q4_source_overlap import q4_source_projected_gap_lower -from anysolver.general_contact.s3_patch_mortar_energy import MovingS3PatchPrimalMortarPenalty +from anyfesolver.general_contact import s3_patch_static as owner +from anyfesolver.general_contact.q4_overlap_local_bound import overlap_local_lower +from anyfesolver.general_contact.q4_source_overlap import q4_source_projected_gap_lower +from anyfesolver.general_contact.s3_patch_mortar_energy import MovingS3PatchPrimalMortarPenalty from test_general_contact_jet2_candidate_budget import _scene from test_general_contact_q4_s3_refined_patch import _two_q4_two_s3 from test_general_contact_q4_s3_jet2_static_owner import _settings diff --git a/tests/test_general_contact_pressure_basis.py b/tests/test_general_contact_pressure_basis.py index 868934e24..f1ca2f342 100644 --- a/tests/test_general_contact_pressure_basis.py +++ b/tests/test_general_contact_pressure_basis.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from anysolver.general_contact.pressure_basis import ( +from anyfesolver.general_contact.pressure_basis import ( MACRO_Q1_PAIR_VERSION, SELECTED_Q1_KNOTS_VERSION, PressureBasis, diff --git a/tests/test_general_contact_pressure_overlay.py b/tests/test_general_contact_pressure_overlay.py index 812d1fc45..e31dbf473 100644 --- a/tests/test_general_contact_pressure_overlay.py +++ b/tests/test_general_contact_pressure_overlay.py @@ -4,10 +4,10 @@ import pytest from scipy import sparse -from anysolver.general_contact.pressure_overlay import subdivide_q4_pressure_faces -from anysolver.general_contact.s3_patch_augmented import MovingS3PatchProjectedNormal -from anysolver.general_contact.s3_patch_mortar_energy import S3PatchFace -from anysolver.general_contact.s3_patch_mortar_energy import ( +from anyfesolver.general_contact.pressure_overlay import subdivide_q4_pressure_faces +from anyfesolver.general_contact.s3_patch_augmented import MovingS3PatchProjectedNormal +from anyfesolver.general_contact.s3_patch_mortar_energy import S3PatchFace +from anyfesolver.general_contact.s3_patch_mortar_energy import ( MovingS3PatchPrimalMortarPenalty, ) diff --git a/tests/test_general_contact_pressure_space.py b/tests/test_general_contact_pressure_space.py index 332f2b4bf..2d6d86b9d 100644 --- a/tests/test_general_contact_pressure_space.py +++ b/tests/test_general_contact_pressure_space.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver.general_contact.pressure_space import supported_pressure_gram +from anyfesolver.general_contact.pressure_space import supported_pressure_gram def test_area_scaling_does_not_destroy_an_independent_pressure_mode(): diff --git a/tests/test_general_contact_projected_penalty.py b/tests/test_general_contact_projected_penalty.py index ef2c8f438..9b25fec8a 100644 --- a/tests/test_general_contact_projected_penalty.py +++ b/tests/test_general_contact_projected_penalty.py @@ -3,8 +3,8 @@ from scipy import sparse import numpy as np import pytest -from anysolver import validate_general_contact -from anysolver.general_contact.s3_patch_static import ( +from anyfesolver import validate_general_contact +from anyfesolver.general_contact.s3_patch_static import ( GeneralS3PatchManager, REFINED_Q4_S3_PROJECTED_PENALTY_PROFILE, ) from test_general_contact_q4_s3_refined_patch import _two_q4_two_s3 @@ -137,8 +137,8 @@ def test_smooth_both_body_skin_directional_tangent_interval(): def test_ordinary_scope_rejects_unsupported_control_before_mutation(): - from anysolver.general_contact.core import contact_scope - from anysolver import solve_static_nonlinear + from anyfesolver.general_contact.core import contact_scope + from anyfesolver import solve_static_nonlinear model, definition, settings = _candidate() with pytest.raises(ValueError, match="unsupported projected penalty"): with contact_scope(model, definition, settings, analysis_control="arc_length"): @@ -151,7 +151,7 @@ def test_ordinary_scope_rejects_unsupported_control_before_mutation(): def test_ordinary_rejects_unadmitted_finite_rotation_work_map(): - from anysolver import solve_static_nonlinear + from anyfesolver import solve_static_nonlinear model, definition, settings = _candidate() with pytest.raises(ValueError, match="small-rotation kinematics"): solve_static_nonlinear(model, contact=definition, contact_settings=settings, diff --git a/tests/test_general_contact_public_friction_settings.py b/tests/test_general_contact_public_friction_settings.py index 54b7a6c6d..555681985 100644 --- a/tests/test_general_contact_public_friction_settings.py +++ b/tests/test_general_contact_public_friction_settings.py @@ -10,9 +10,9 @@ def test_public_friction_settings_export_identity_and_listing(): - import anysolver.general_contact as package - from anysolver.general_contact import S3SlidingFrictionSettings - from anysolver.general_contact import s3_sliding_friction + import anyfesolver.general_contact as package + from anyfesolver.general_contact import S3SlidingFrictionSettings + from anyfesolver.general_contact import s3_sliding_friction assert "S3SlidingFrictionSettings" in package.__all__ assert "S3SlidingFrictionSettings" in dir(package) @@ -21,7 +21,7 @@ def test_public_friction_settings_export_identity_and_listing(): def test_keyword_construction_matches_positional_and_validates(): - from anysolver.general_contact import S3SlidingFrictionSettings + from anyfesolver.general_contact import S3SlidingFrictionSettings keyword = S3SlidingFrictionSettings(friction_coefficient=.3, tangential_stiffness_Pa_per_m=1000., steps_by_dof=(2e-7,)*60, @@ -61,13 +61,13 @@ def test_public_friction_settings_export_stays_lazy(): from pathlib import Path import sys - import anysolver + import anyfesolver source = Path(os.environ["ANYSOLVER_TEST_SOURCE"]).resolve() - assert Path(anysolver.__file__).resolve().is_relative_to(source) - assert "anysolver.general_contact" not in sys.modules + assert Path(anyfesolver.__file__).resolve().is_relative_to(source) + assert "anyfesolver.general_contact" not in sys.modules - from anysolver.general_contact import S3SlidingFrictionSettings - from anysolver.general_contact import s3_sliding_friction + from anyfesolver.general_contact import S3SlidingFrictionSettings + from anyfesolver.general_contact import s3_sliding_friction assert S3SlidingFrictionSettings is s3_sliding_friction.S3SlidingFrictionSettings settings = S3SlidingFrictionSettings(friction_coefficient=.3, tangential_stiffness_Pa_per_m=1000., steps_by_dof=(2e-7,)*60, diff --git a/tests/test_general_contact_q4_material_checkpoint.py b/tests/test_general_contact_q4_material_checkpoint.py index 9f64cb8e3..8d7ab8194 100644 --- a/tests/test_general_contact_q4_material_checkpoint.py +++ b/tests/test_general_contact_q4_material_checkpoint.py @@ -6,15 +6,15 @@ import numpy as np import pytest -from anysolver import FEModel, create_shell_element -from anysolver.e4_pl_element import QualifiedE4PLShellElement -from anysolver.e4_pl_s3_state import canonical_sha256 -from anysolver.element_capabilities import ElementCapabilityError -from anysolver.general_contact.q4_material_checkpoint import ( +from anyfesolver import FEModel, create_shell_element +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement +from anyfesolver.e4_pl_s3_state import canonical_sha256 +from anyfesolver.element_capabilities import ElementCapabilityError +from anyfesolver.general_contact.q4_material_checkpoint import ( prepare_q4_material_checkpoint, restore_q4_material_checkpoint, ) -from anysolver.material_curves import DNVC208MaterialCurve -from anysolver.nonlinear_restart import ( +from anyfesolver.material_curves import DNVC208MaterialCurve +from anyfesolver.nonlinear_restart import ( analysis_configuration_fingerprint, canonical_checkpoint_json_bytes, ) @@ -111,7 +111,7 @@ def test_restored_history_produces_same_next_constitutive_update(): def test_actual_assembler_compact_candidate_keeps_accepted_algorithmic_parent(): - from anysolver.nonlinear_static import _assemble_nonlinear_system + from anyfesolver.nonlinear_static import _assemble_nonlinear_system model, full, parents = _yielded() next_pose = full*1.1 _, _, candidate = _assemble_nonlinear_system(model, next_pose, parents, 3, tangent=True) @@ -264,7 +264,7 @@ def test_nonfinite_coordinates_and_activity_state_are_rejected(): for invalid in (np.full(24, np.inf), np.zeros((4, 6)), np.zeros(23)): with pytest.raises(ValueError): prepare_q4_material_checkpoint(model, invalid, states) - from anysolver.activity import ElementActivity + from anyfesolver.activity import ElementActivity model.set_element_activity(ElementActivity([1])) with pytest.raises(ValueError, match="activity"): prepare_q4_material_checkpoint(model, full, states) @@ -293,7 +293,7 @@ def test_only_exact_q4_and_finite_reference_geometry_are_admitted(): model.mesh.nodes[2].x = float("nan") with pytest.raises(ValueError): prepare_q4_material_checkpoint(model, full, states) - from anysolver.elements import ShellElement + from anyfesolver.elements import ShellElement model, full, states = _yielded() model.add_element(1, ShellElement(1, (1, 2, 3, 4), "plastic", thickness=.02)) with pytest.raises(ValueError, match="exact qualified Q4"): diff --git a/tests/test_general_contact_q4_pair_bending.py b/tests/test_general_contact_q4_pair_bending.py index 964e1152c..187c2dbc5 100644 --- a/tests/test_general_contact_q4_pair_bending.py +++ b/tests/test_general_contact_q4_pair_bending.py @@ -77,7 +77,7 @@ def shapes(ids): def linear_reference(model,load): - from anysolver.matrix_assembly import assemble_stiffness_matrix + from anyfesolver.matrix_assembly import assemble_stiffness_matrix K=assemble_stiffness_matrix(model)[0].toarray();free=free_dofs(model);kf=K[np.ix_(free,free)] s,g,g0=independent_linear_contact(model);gf=g[:,free];force=load.get_load_vector(model.mesh,model.mesh.dof_manager) cf=np.linalg.solve(kf,gf.T);A=gf@cf;scaled=A/np.sqrt(s[:,None]*s[None,:]);eig,vec=np.linalg.eigh(scaled) @@ -116,8 +116,8 @@ def exact_pose_gap(points): def test_reference_skin_signed_response_and_linearized_operator(): - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager - from anysolver.general_contact.q4_q4_overlap_derivatives import q4_q4_overlap_derivatives + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.q4_q4_overlap_derivatives import q4_q4_overlap_derivatives model,domain,settings,resolution,load=build();ref=linear_reference(model,load);manager=GeneralS3PatchManager(model,resolution.definition,settings) zero=np.zeros(manager.n_dof);source,target=manager._positions(zero) local=np.zeros((6,manager.map.shape[0]));support=np.zeros(6) @@ -144,8 +144,8 @@ def test_reference_skin_signed_response_and_linearized_operator(): @pytest.mark.skipif(not os.environ.get('BENDING_STAGE'), reason='installed bending stage input BENDING_STAGE absent: staged bending solve requires the original workflow stage selection') def test_installed_bending_stage(): - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager - from anysolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate stage=os.environ['BENDING_STAGE'].split('-')[0];evidence=Path(os.environ['AUTOMATIC_WORKFLOW_EVIDENCE']) model,domain,settings,resolution,load=build();options={} if stage=='prefix':options['max_load_factor']=.5 @@ -194,7 +194,7 @@ def test_installed_bending_stage(): @pytest.mark.skipif(not os.environ.get('AUTOMATIC_WORKFLOW_EVIDENCE') or not (Path(os.environ['AUTOMATIC_WORKFLOW_EVIDENCE'])/'full-accuracy.json').is_file(), reason='archived bending input AUTOMATIC_WORKFLOW_EVIDENCE/full-accuracy.json absent: saved-pose replay requires the original evidence root') def test_exact_saved_pose_and_inventory(): - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager evidence=Path(os.environ['AUTOMATIC_WORKFLOW_EVIDENCE']);path=evidence/'full-accuracy.json';report=json.loads(path.read_text());assert report['verified'] assert report['snapshot_inventory']==[.5,1.] model,domain,settings,resolution,load=build();manager=GeneralS3PatchManager(model,resolution.definition,settings) @@ -205,7 +205,7 @@ def test_exact_saved_pose_and_inventory(): def test_actual_restart_refusal_and_precancel(): - from anysolver import CancellationToken,SolveCancelled + from anyfesolver import CancellationToken,SolveCancelled model,domain,settings,resolution,load=build();before=repr(model) token=CancellationToken();token.cancel('bending public precancel') with pytest.raises(SolveCancelled):solve(model,settings,resolution,load,cancellation_token=token) @@ -217,7 +217,7 @@ def test_actual_restart_refusal_and_precancel(): reason='archived bending input AUTOMATIC_WORKFLOW_EVIDENCE/prefix.json absent: restart-refusal replay requires the original staged checkpoint') def test_actual_archive_checkpoint_restart_refusals(): from dataclasses import replace - from anysolver.general_contact.automatic_domain import resolve_automatic_contact_domain + from anyfesolver.general_contact.automatic_domain import resolve_automatic_contact_domain evidence=Path(os.environ['AUTOMATIC_WORKFLOW_EVIDENCE']);path=evidence/'prefix.json';prefix=json.loads(path.read_text());assert prefix['verified'] model,domain,settings,resolution,load=build();before=repr(model) changed=replace(domain,name='bending-provenance-refusal');changed_resolution=resolve_automatic_contact_domain(model,changed,settings,analysis_control='force') diff --git a/tests/test_general_contact_q4_pair_measured_cost.py b/tests/test_general_contact_q4_pair_measured_cost.py index a182d9406..7986b31cf 100644 --- a/tests/test_general_contact_q4_pair_measured_cost.py +++ b/tests/test_general_contact_q4_pair_measured_cost.py @@ -8,8 +8,8 @@ reason='archived baseline input AUTOMATIC_WORKFLOW_EVIDENCE/full-baseline-1.json absent: saved-candidate replay requires the original evidence root') def test_saved_candidate_profile(): from examples.general_contact_automatic_q4_pair import build - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager - from anysolver.general_contact.q4_q4_overlap_derivatives import q4_q4_overlap_derivatives + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.q4_q4_overlap_derivatives import q4_q4_overlap_derivatives model,domain,settings,resolution,path=build() manager=GeneralS3PatchManager(model,resolution.definition,settings) root=Path(os.environ['AUTOMATIC_WORKFLOW_EVIDENCE']) @@ -29,12 +29,12 @@ def test_saved_candidate_profile(): reason='archived baseline inputs AUTOMATIC_WORKFLOW_EVIDENCE install.json/outputs/full-baseline-1.json absent: baseline-peer parity replay requires the original evidence root') def test_smooth_parity_and_real_both_body_work(monkeypatch): import importlib.util,sys - from anysolver.general_contact import q4_q4_overlap_derivatives as current + from anyfesolver.general_contact import q4_q4_overlap_derivatives as current raw=Path(os.environ['AUTOMATIC_WORKFLOW_EVIDENCE']).parent install=json.loads((raw/'install.json').read_text()) module_name='_measured_cost_baseline' - spec=importlib.util.spec_from_file_location(module_name,Path(install['site'])/'anysolver/general_contact/q4_q4_overlap_derivatives.py') - baseline=importlib.util.module_from_spec(spec);baseline.__package__='anysolver.general_contact';sys.modules[module_name]=baseline;spec.loader.exec_module(baseline) + spec=importlib.util.spec_from_file_location(module_name,Path(install['site'])/'anyfesolver/general_contact/q4_q4_overlap_derivatives.py') + baseline=importlib.util.module_from_spec(spec);baseline.__package__='anyfesolver.general_contact';sys.modules[module_name]=baseline;spec.loader.exec_module(baseline) from examples.general_contact_automatic_q4_pair import build model,domain,settings,resolution,path=build() controls=dict(area_tolerance=settings.q4_source_area_tolerance,weighted_gap_tolerance=settings.q4_source_weighted_gap_tolerance,maximum_triangles=512,support_gradient_tolerance=settings.q4_source_support_gradient_tolerance,support_hessian_tolerance=settings.q4_source_support_hessian_tolerance,weighted_gap_gradient_tolerance=settings.q4_source_weighted_gap_gradient_tolerance,weighted_gap_hessian_tolerance=settings.q4_source_weighted_gap_hessian_tolerance) @@ -57,7 +57,7 @@ def test_smooth_parity_and_real_both_body_work(monkeypatch): assert old.branch_signature==new.branch_signature and old.integration_triangles==new.integration_triangles assert abs(old.overlap_area-new.overlap_area)<=1e-13 report.append(dict(case=name,scaled_errors=errors,integration_triangles=new.integration_triangles,branch_equal=True)) - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager manager=GeneralS3PatchManager(model,resolution.definition,settings) pose=np.array(json.loads((raw/'outputs/full-baseline-1.json').read_text())['displacements']) optimized=current.q4_q4_overlap_derivatives @@ -76,8 +76,8 @@ def test_smooth_parity_and_real_both_body_work(monkeypatch): def test_actual_q4_backend_scope_and_legacy_dispatch(monkeypatch): - import anysolver.general_contact.q4_s3_overlap_derivatives as helper - from anysolver.general_contact.q4_q4_overlap_derivatives import q4_q4_overlap_derivatives + import anyfesolver.general_contact.q4_s3_overlap_derivatives as helper + from anyfesolver.general_contact.q4_q4_overlap_derivatives import q4_q4_overlap_derivatives calls=[] def compiled21(av,ag,ah,bv,bg,bh): assert ag.shape[1]==bg.shape[1]==21,'24-coordinate Q4 route reached compiled backend' diff --git a/tests/test_general_contact_q4_pair_monolithic.py b/tests/test_general_contact_q4_pair_monolithic.py index 8c446d674..0e877c1e8 100644 --- a/tests/test_general_contact_q4_pair_monolithic.py +++ b/tests/test_general_contact_q4_pair_monolithic.py @@ -21,7 +21,7 @@ def save(data): def hard_reference(model,load): - from anysolver.matrix_assembly import assemble_stiffness_matrix + from anyfesolver.matrix_assembly import assemble_stiffness_matrix K=assemble_stiffness_matrix(model)[0].toarray();free=free_dofs(model);kf=K[np.ix_(free,free)] s,g,g0=independent_linear_contact(model);gf=g[:,free];f=load.get_load_vector(model.mesh,model.mesh.dof_manager) A=gf@np.linalg.solve(kf,gf.T);q=g0+gf@np.linalg.solve(kf,f[free]);solutions=[] @@ -37,9 +37,9 @@ def hard_reference(model,load): def test_independent_reference_and_full_coupled_directional_jacobian(): - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager,REFINED_Q4_Q4_MONOLITHIC_AUGMENTED_PROFILE - from anysolver.general_contact.semismooth import linearize,complementarity,reference_nodal_support - from anysolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager,REFINED_Q4_Q4_MONOLITHIC_AUGMENTED_PROFILE + from anyfesolver.general_contact.semismooth import linearize,complementarity,reference_nodal_support + from anyfesolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate model,domain,settings,res,load=build();reference=hard_reference(model,load);manager=GeneralS3PatchManager(model,res.definition,settings) assert manager.profile==REFINED_Q4_Q4_MONOLITHIC_AUGMENTED_PROFILE zero=np.zeros(manager.n_dof);raw0=linearize(manager,zero,np.zeros(6),tangent=True) @@ -80,9 +80,9 @@ def structural(at,tangent): @pytest.mark.skipif(not os.environ.get('MONOLITHIC_STAGE'), reason='installed monolithic stage input MONOLITHIC_STAGE absent: staged monolithic solve requires the original workflow stage selection') def test_installed_force_bending_stage(): - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager - from anysolver.general_contact.semismooth import linearize,complementarity,reference_nodal_support - from anysolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.semismooth import linearize,complementarity,reference_nodal_support + from anyfesolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate stage=os.environ['MONOLITHIC_STAGE'];evidence=Path(os.environ['AUTOMATIC_WORKFLOW_EVIDENCE']);kwargs={} model,domain,settings,res,load=build(regularization=2000. if stage=='alternate-c' else 1000.) if stage=='prefix':kwargs['max_load_factor']=.5 @@ -115,9 +115,9 @@ def test_installed_force_bending_stage(): def test_actual_restart_enforcement_and_route_refusal(monkeypatch): - from anysolver import CancellationToken,SolveCancelled,solve_static_nonlinear,solve_static_arc_length,ArcLengthControl,validate_general_contact - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager - import anysolver.general_contact.static_path as path_owner + from anyfesolver import CancellationToken,SolveCancelled,solve_static_nonlinear,solve_static_arc_length,ArcLengthControl,validate_general_contact + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager + import anyfesolver.general_contact.static_path as path_owner model,domain,settings,res,load=build();before=repr(model) token=CancellationToken();token.cancel('monolithic public precancel') with pytest.raises(SolveCancelled):solve(model,settings,res,load,cancellation_token=token) @@ -140,9 +140,9 @@ def forbidden(*args,**kwargs):committed.append(True);raise AssertionError('physi if rejected.restart_checkpoint is not None:assert rejected.restart_checkpoint['path_state']['accepted_step']==0 assert repr(model)==before from examples.general_contact_multiple_beam_s3_transient import build as transient_build - from anysolver.dynamics import TransientConfig - from anysolver.general_contact.transient import solve_transient_contact,_admit,ContactTransientSolverControls - import anysolver.general_contact.multiple_beam_s3_transient as transient_owner + from anyfesolver.dynamics import TransientConfig + from anyfesolver.general_contact.transient import solve_transient_contact,_admit,ContactTransientSolverControls + import anyfesolver.general_contact.multiple_beam_s3_transient as transient_owner tm,td,ts,velocity=transient_build();controls=ContactTransientSolverControls(allow_multiple_deformable_beam_s3_dev=True);assert _admit(tm,td,ts,controls)==transient_owner.PROFILE prior=repr(tm);allocation=[] def allocate(*args,**kwargs):allocation.append(True);raise AssertionError('transient allocation before selector refusal') @@ -156,8 +156,8 @@ def allocate(*args,**kwargs):allocation.append(True);raise AssertionError('trans @pytest.mark.skipif(not os.environ.get('AUTOMATIC_WORKFLOW_EVIDENCE') or not (Path(os.environ['AUTOMATIC_WORKFLOW_EVIDENCE'])/'prefix.json').is_file(), reason='archived monolithic input AUTOMATIC_WORKFLOW_EVIDENCE/prefix.json absent: restart-enforcement replay requires the original staged checkpoint') def test_actual_archive_checkpoint_restart_enforcement(): - from anysolver import solve_static_nonlinear - from anysolver.general_contact.automatic_domain import resolve_automatic_contact_domain + from anyfesolver import solve_static_nonlinear + from anyfesolver.general_contact.automatic_domain import resolve_automatic_contact_domain evidence=Path(os.environ['AUTOMATIC_WORKFLOW_EVIDENCE']);prefix=json.loads((evidence/'prefix.json').read_text());assert prefix['verified'] model,domain,settings,res,load=build();before=repr(model) changed=replace(domain,name='monolithic-changed-provenance');changed_res=resolve_automatic_contact_domain(model,changed,settings,analysis_control='force') diff --git a/tests/test_general_contact_q4_pair_monolithic_cycle.py b/tests/test_general_contact_q4_pair_monolithic_cycle.py index 20499418c..33f140f14 100644 --- a/tests/test_general_contact_q4_pair_monolithic_cycle.py +++ b/tests/test_general_contact_q4_pair_monolithic_cycle.py @@ -23,8 +23,8 @@ def report_sha(stage):return hashlib.sha256((Path(os.environ['AUTOMATIC_WORKFLOW def test_simple_exact_oracle_and_initial_clearance_reference(): - from anysolver import LoadCase - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver import LoadCase + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager model,domain,settings,res,program=build();manager=GeneralS3PatchManager(model,res.definition,settings) points=np.concatenate(manager._positions(np.zeros(manager.n_dof)));np.testing.assert_allclose(points,skin(model,np.zeros(manager.n_dof))[0],atol=1e-13,rtol=0) certificate=_oracle.strict_separation(points);assert certificate['strict_positive'] and certificate['source_normal_gap_lower_m']>0 @@ -69,10 +69,10 @@ def test_installed_cycle_solver_saved_inventory(): @pytest.mark.skipif(not os.environ.get('CYCLE_STAGE'), reason='installed cycle stage input CYCLE_STAGE absent: saved mechanical proof requires the original staged report and stage selection') def test_saved_cycle_mechanical_proof(): - from anysolver import LoadCase - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager - from anysolver.general_contact.semismooth import linearize,complementarity,reference_nodal_support - from anysolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate + from anyfesolver import LoadCase + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.semismooth import linearize,complementarity,reference_nodal_support + from anyfesolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate stage=os.environ['CYCLE_STAGE'].removeprefix('proof-');source=read_report(stage);assert source['solver_completed'] and source['inventory_verified'] model,domain,settings,res,program=build();assert source['identity']==res.identity and source['program']==program.contract() manager=GeneralS3PatchManager(model,res.definition,settings);reports=[];reference_cache={} @@ -112,7 +112,7 @@ def test_saved_cycle_mechanical_proof(): def test_actual_cycle_definition_content_and_precancel_refusal(): - from anysolver import CancellationToken,SolveCancelled + from anyfesolver import CancellationToken,SolveCancelled model,domain,settings,res,program=build();before=repr(model) token=CancellationToken();token.cancel('cycle public precancel') with pytest.raises(SolveCancelled):solve(model,settings,res,program,cancellation_token=token) @@ -121,8 +121,8 @@ def test_actual_cycle_definition_content_and_precancel_refusal(): def test_actual_empty_control_admission_and_dependent_control_refusal(): - from anysolver import CancellationToken,SolveCancelled - from anysolver.general_contact.static_path import ContactPathProgram,ContactPathControl + from anyfesolver import CancellationToken,SolveCancelled + from anyfesolver.general_contact.static_path import ContactPathProgram,ContactPathControl model,domain,settings,res,program=build();before=repr(model) # The legitimate pure-force programme has zero controls: the preflight # rank of its empty control matrix is zero, so the actual driver must @@ -153,7 +153,7 @@ def test_actual_empty_control_admission_and_dependent_control_refusal(): @pytest.mark.skipif(not os.environ.get('AUTOMATIC_WORKFLOW_EVIDENCE') or not all((Path(os.environ['AUTOMATIC_WORKFLOW_EVIDENCE'])/(name+'.json')).is_file() for name in ('prefix','proof-prefix')), reason='archived cycle inputs AUTOMATIC_WORKFLOW_EVIDENCE prefix.json/proof-prefix.json absent: restart-binding replay requires the original evidence root') def test_actual_archive_cycle_checkpoint_restart_refusals(): - from anysolver.general_contact import resolve_automatic_contact_domain + from anyfesolver.general_contact import resolve_automatic_contact_domain model,domain,settings,res,program=build();prefix=read_report('prefix');proof=read_report('proof-prefix');assert proof['verified'] and proof['opening_verified'] and proof['source_sha256']==report_sha('prefix');before=repr(model) changed_forces=list(program.nodal_forces);changed_forces[0]=replace(changed_forces[0],values_n=(0.,-5e-5,+5e-5,-4e-5));changed=replace(program,nodal_forces=tuple(changed_forces)) with pytest.raises(ValueError,match='incompatible'):solve(model,settings,res,changed,restart_checkpoint=prefix['checkpoint']) diff --git a/tests/test_general_contact_q4_partial_pressure.py b/tests/test_general_contact_q4_partial_pressure.py index c2183cb39..d51174fa3 100644 --- a/tests/test_general_contact_q4_partial_pressure.py +++ b/tests/test_general_contact_q4_partial_pressure.py @@ -4,8 +4,8 @@ import numpy as np -from anysolver.general_contact.q4_source_overlap import q4_source_overlap_integrals -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.q4_source_overlap import q4_source_overlap_integrals +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from test_general_contact_q4_q4_augmented import _augmented_case diff --git a/tests/test_general_contact_q4_physical_orientation.py b/tests/test_general_contact_q4_physical_orientation.py index 71bd9a297..755f48add 100644 --- a/tests/test_general_contact_q4_physical_orientation.py +++ b/tests/test_general_contact_q4_physical_orientation.py @@ -20,10 +20,10 @@ def sha(stage):return hashlib.sha256((Path(os.environ['AUTOMATIC_WORKFLOW_EVIDEN def label_signs(label):return tuple(1 if c=='p' else -1 for c in label) def test_independent_q4_atlas_work_and_coupled_directional(): - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager,_adapters,_selected - from anysolver.general_contact.semismooth import linearize,complementarity,reference_nodal_support - from anysolver.matrix_assembly import assemble_stiffness_matrix - from anysolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager,_adapters,_selected + from anyfesolver.general_contact.semismooth import linearize,complementarity,reference_nodal_support + from anyfesolver.matrix_assembly import assemble_stiffness_matrix + from anyfesolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate base=build();m0=GeneralS3PatchManager(base[0],base[3].definition,base[2]);K0=assemble_stiffness_matrix(base[0])[0].toarray() a0=_adapters(base[0],_selected(base[3].definition)[:2],orientation=base[2].shell_pair_orientation) rng=np.random.default_rng(61);u=rng.normal(size=m0.n_dof)*1e-7;u[np.setdiff1d(np.arange(m0.n_dof),_cycle.free_dofs(base[0]))]=0. @@ -103,8 +103,8 @@ def test_saved_orientation_physical_proof(monkeypatch): _cycle.test_saved_cycle_mechanical_proof() def test_public_orientation_restart_and_unused_route_refusals(monkeypatch): - from anysolver import CancellationToken,SolveCancelled,validate_general_contact - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver import CancellationToken,SolveCancelled,validate_general_contact + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager model,domain,settings,res,program=build(signs=(-1,-1));before=repr(model) wrong=replace(settings,enforcement_solver='nested_augmented',complementarity_force_scale_n=None) with pytest.raises(ValueError,match='physical_sides_dev'):GeneralS3PatchManager(model,res.definition,wrong) @@ -123,12 +123,12 @@ def test_public_orientation_restart_and_unused_route_refusals(monkeypatch): or not Path(os.environ['Q4_ORIENTATION_LEGACY_FULL']).is_file(), reason='archived orientation inputs AUTOMATIC_WORKFLOW_EVIDENCE/{prefix-mm,proof-prefix-mm,prefix-pp}.json and Q4_ORIENTATION_LEGACY_FULL absent: restart-binding replay requires the original evidence root') def test_public_orientation_archive_restart_binding_and_legacy_identity(monkeypatch): - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager - from anysolver.general_contact.core import _contact_settings_contract + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.core import _contact_settings_contract model,domain,settings,res,program=build(signs=(-1,-1));prefix=read('prefix-mm');proof=read('proof-prefix-mm');assert proof['verified'] and proof['opening_verified'] and proof['source_sha256']==sha('prefix-mm');before=repr(model) pm,pd,ps,pr,pp=build();plusprefix=read('prefix-pp') with pytest.raises(ValueError,match='incompatible'):solve(pm,replace(ps,shell_pair_orientation='legacy'),pr,pp,restart_checkpoint=plusprefix['checkpoint']) - from anysolver.general_contact import resolve_automatic_contact_domain + from anyfesolver.general_contact import resolve_automatic_contact_domain changed=resolve_automatic_contact_domain(model,replace(domain,name='changed-coherent-q4-orientation'),settings,analysis_control='contact_path') with pytest.raises(ValueError,match='incompatible'):solve(model,settings,changed,program,restart_checkpoint=prefix['checkpoint']) damaged=copy.deepcopy(prefix['checkpoint']);damaged['path_state']['normal_forces'][0]+=1e-6 @@ -146,9 +146,9 @@ def test_public_orientation_archive_restart_binding_and_legacy_identity(monkeypa def test_actual_ordinary_force_selector_refusal(monkeypatch): - from anysolver import LoadCase,solve_static_nonlinear - import anysolver.general_contact.static_path as path_owner - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver import LoadCase,solve_static_nonlinear + import anyfesolver.general_contact.static_path as path_owner + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager model,domain,settings,res,program=build(signs=(-1,-1));load=LoadCase('same first-press forces') for node in (3,6):load.add_nodal_load(node,forces=(0.,0.,-5e-5)) before=repr(model);calls=[] diff --git a/tests/test_general_contact_q4_projected_profile.py b/tests/test_general_contact_q4_projected_profile.py index 89ddcb286..ae8bda59a 100644 --- a/tests/test_general_contact_q4_projected_profile.py +++ b/tests/test_general_contact_q4_projected_profile.py @@ -4,11 +4,11 @@ import numpy as np -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactPathControl, ContactPathProgram, DisplacementControl, solve_static_nonlinear, validate_general_contact, ) -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from test_general_contact_q4_q4_augmented import _augmented_case, _ordinary_case from test_general_contact_q4_s3_patch_static import _case as q4_s3_case diff --git a/tests/test_general_contact_q4_q4_augmented.py b/tests/test_general_contact_q4_q4_augmented.py index 484639ee8..3399b77bd 100644 --- a/tests/test_general_contact_q4_q4_augmented.py +++ b/tests/test_general_contact_q4_q4_augmented.py @@ -5,14 +5,14 @@ import numpy as np from scipy import sparse -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactPathControl, ContactPathProgram, DisplacementControl, LoadCase, NonlinearConvergenceSettings, solve_static_nonlinear, validate_general_contact, ) -from anysolver.general_contact.s3_patch_augmented import MovingS3PatchProjectedNormal -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.s3_patch_augmented import MovingS3PatchProjectedNormal +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from test_general_contact_q4_q4_static import _case diff --git a/tests/test_general_contact_q4_q4_static.py b/tests/test_general_contact_q4_q4_static.py index ffc12c729..94f74ea62 100644 --- a/tests/test_general_contact_q4_q4_static.py +++ b/tests/test_general_contact_q4_q4_static.py @@ -2,14 +2,14 @@ import numpy as np -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathProgram, ContactSolverSettings, ContactSurface, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager def _case(): diff --git a/tests/test_general_contact_q4_q4_swept_enclosure.py b/tests/test_general_contact_q4_q4_swept_enclosure.py index 246a46e2d..03e0ed664 100644 --- a/tests/test_general_contact_q4_q4_swept_enclosure.py +++ b/tests/test_general_contact_q4_q4_swept_enclosure.py @@ -4,7 +4,7 @@ import json, os import numpy as np import pytest -from anysolver.general_contact.q4_q4_swept_bound import q4_q4_whole_pair_swept_lower as lower +from anyfesolver.general_contact.q4_q4_swept_bound import q4_q4_whole_pair_swept_lower as lower def sub(a,b):return tuple(x-y for x,y in zip(a,b)) @@ -79,13 +79,13 @@ def test_exact_whole_time_controls_and_errors(): ref=np.array([[0.,0.,0.],[1.+eps,1.,0.],[2.,2.,0.],[1.,1.-eps,0.]]) refaxis=cross(sub(exact(ref)[1],exact(ref)[0]),sub(exact(ref)[3],exact(ref)[0])) assert refaxis[2]==-F(eps)**2 - from anysolver.general_contact.q4_overlap_local_bound import _normal_controls_interval + from anyfesolver.general_contact.q4_overlap_local_bound import _normal_controls_interval enclosure=_normal_controls_interval(ref,ref,0) assert F(enclosure[0][0,2])<=refaxis[2]<=F(enclosure[1][0,2]) - from anysolver.general_contact.q4_q4_overlap_derivatives import q4_q4_swept_chart_admissible + from anyfesolver.general_contact.q4_q4_overlap_derivatives import q4_q4_swept_chart_admissible assert not q4_q4_swept_chart_admissible(quad(),quad(),quad(),quad(),ref,reference) # Rounded midpoint encloses original exact binary arithmetic, not a chord reset. - from anysolver.general_contact.s3_patch_static import _affine_midpoint_with_error + from anyfesolver.general_contact.s3_patch_static import _affine_midpoint_with_error left=(np.array([[2.**30,1.,-1.]]),);right=(np.nextafter(left[0],np.inf),) error=(np.full((1,3),2.**-24),) middle,me=_affine_midpoint_with_error(left,right,error,error) @@ -98,9 +98,9 @@ def test_exact_whole_time_controls_and_errors(): def test_actual_manager_errors_cutback_and_endpoint_guard(monkeypatch): - import anysolver.general_contact.q4_q4_swept_bound as module - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager - from anysolver.general_contact import resolve_automatic_contact_domain + import anyfesolver.general_contact.q4_q4_swept_bound as module + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact import resolve_automatic_contact_domain from examples.general_contact_automatic_q4_pair import build model,domain,settings,resolution,program=build() manager=GeneralS3PatchManager(model,resolution.definition,settings) @@ -118,7 +118,7 @@ def observed(*args,**kwargs): fraction=manager.admissible_step_fraction(zero,unsafe);assert 01 else None - import anysolver.general_contact.static_path as driver + import anyfesolver.general_contact.static_path as driver original=driver.create_s3_friction_manager if hasattr(driver,'create_s3_friction_manager') else None - import anysolver.general_contact.s3_friction_static as factory + import anyfesolver.general_contact.s3_friction_static as factory original=factory.create_s3_friction_manager;captured=[] def make(*args): a=original(*args);commit=a.commit;restore=a.restore @@ -99,7 +99,7 @@ def restored(*args,**kwargs): checkpoint=result.to_restart_checkpoint();assert checkpoint['path_state']['accepted_step']==step save(dict(status=result.status,checkpoint=checkpoint,info=result.info,verification='saved before independent physical assertions')) snap=result.snapshots[-1];u=np.array(checkpoint['displacements']);a=captured[-1] - from anysolver.matrix_assembly import assemble_stiffness_matrix + from anyfesolver.matrix_assembly import assemble_stiffness_matrix K=assemble_stiffness_matrix(m)[0];contact=a.saved_force+a.saved_normal phase=checkpoint['path_state']['history'][-1];reaction=np.array(phase['reaction_generalized']);res=K@u+contact res[np.asarray(m.mesh.dof_manager.get_node_dofs(1))[[0,2]]]-=reaction @@ -165,7 +165,7 @@ def test_birth(): def test_prepared_uniform(monkeypatch): - from anysolver.general_contact.s3_friction_prepared_path import prepare_s3_plane_pressure_path,PreparedS3PlanePressurePath + from anyfesolver.general_contact.s3_friction_prepared_path import prepare_s3_plane_pressure_path,PreparedS3PlanePressurePath case=build_case();a=owner(case);m=case[0] x=mode(m,(1,2,3),0);z=mode(m,(1,2,3),2) tx=mode(m,(5,6,7),0) @@ -205,8 +205,8 @@ def test_prepared_uniform(monkeypatch): @pytest.mark.skipif(os.environ.get('ATOMIC_KIND')=='trial' and (not os.environ.get('AUTOMATIC_WORKFLOW_EVIDENCE') or not (Path(os.environ['AUTOMATIC_WORKFLOW_EVIDENCE'])/'A2.json').is_file()), reason='archived rim input AUTOMATIC_WORKFLOW_EVIDENCE/A2.json absent: trial-branch atomic replay requires the original staged checkpoint') def test_atomic(monkeypatch): - from anysolver.control import CancellationToken - import anysolver.general_contact.s3_friction_static as factory + from anyfesolver.control import CancellationToken + import anyfesolver.general_contact.s3_friction_static as factory import copy case=build_case();m=case[0];kind=os.environ.get('ATOMIC_KIND','commit');incoming=json.loads((root()/'A2.json').read_text())['checkpoint'] if kind=='trial' else None before=copy.deepcopy(incoming);declared=repr((m.boundary_conditions,m.constraint_equations,m.load_cases));nodes=[(n.x,n.y,n.z) for n in m.mesh.nodes.values()] @@ -232,7 +232,7 @@ def restored(*args,**kwargs):restore(*args,**kwargs);arm() with pytest.raises(Exception) as error:solve_case(case,3 if kind=='trial' else 1,incoming,token) assert fault and 'injected rim' in str(error.value),repr(error.value) if kind=='cancel': - from anysolver.control import SolveCancelled + from anyfesolver.control import SolveCancelled assert isinstance(error.value,SolveCancelled) assert captured[0].checkpoint_state()==expected[0] assert incoming==before and repr((m.boundary_conditions,m.constraint_equations,m.load_cases))==declared @@ -303,7 +303,7 @@ def test_proof(): @pytest.mark.skipif(not os.environ.get('AUTOMATIC_WORKFLOW_EVIDENCE') or not all((Path(os.environ['AUTOMATIC_WORKFLOW_EVIDENCE'])/(name+'.json')).is_file() for name in ('A2','A3')), reason='archived rim inputs AUTOMATIC_WORKFLOW_EVIDENCE A2.json/A3.json absent: facet replay requires the original staged checkpoints') def test_facet(monkeypatch): - import anysolver.general_contact.s3_friction_static as factory + import anyfesolver.general_contact.s3_friction_static as factory original=factory.create_s3_friction_manager;captured=[] def make(*args):a=original(*args);captured.append(a);return a monkeypatch.setattr(factory,'create_s3_friction_manager',make) diff --git a/tests/test_general_contact_s3_patch_augmented.py b/tests/test_general_contact_s3_patch_augmented.py index a838c95d4..193764681 100644 --- a/tests/test_general_contact_s3_patch_augmented.py +++ b/tests/test_general_contact_s3_patch_augmented.py @@ -5,11 +5,11 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactPathControl, ContactPathProgram, solve_static_nonlinear, validate_general_contact, ) -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from test_general_contact_s3_patch_static import _case diff --git a/tests/test_general_contact_s3_patch_mortar_energy.py b/tests/test_general_contact_s3_patch_mortar_energy.py index 200f7f429..d5c9c4b4a 100644 --- a/tests/test_general_contact_s3_patch_mortar_energy.py +++ b/tests/test_general_contact_s3_patch_mortar_energy.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver.general_contact.s3_patch_mortar_energy import ( +from anyfesolver.general_contact.s3_patch_mortar_energy import ( MovingS3PatchPrimalMortarPenalty, S3PatchFace, ) diff --git a/tests/test_general_contact_s3_patch_refined.py b/tests/test_general_contact_s3_patch_refined.py index 563c744b3..b78bce46a 100644 --- a/tests/test_general_contact_s3_patch_refined.py +++ b/tests/test_general_contact_s3_patch_refined.py @@ -3,19 +3,19 @@ import numpy as np from dataclasses import replace -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathProgram, ContactSolverSettings, ContactSurface, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel -from anysolver.general_contact.s3_patch_augmented import MovingS3PatchProjectedNormal -from anysolver.general_contact.s3_patch_mortar_energy import ( +from anyfesolver.general_contact.s3_patch_augmented import MovingS3PatchProjectedNormal +from anyfesolver.general_contact.s3_patch_mortar_energy import ( MovingS3PatchPrimalMortarPenalty, S3PatchFace, ) -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from test_general_contact_s3_patch_augmented import _augmented_case diff --git a/tests/test_general_contact_s3_patch_static.py b/tests/test_general_contact_s3_patch_static.py index 14d5f9482..fe9338530 100644 --- a/tests/test_general_contact_s3_patch_static.py +++ b/tests/test_general_contact_s3_patch_static.py @@ -3,14 +3,14 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathProgram, ContactSolverSettings, ContactSurface, DisplacementControl, LoadCase, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager def _case(): diff --git a/tests/test_general_contact_s3_physical_orientation.py b/tests/test_general_contact_s3_physical_orientation.py index f67e1835c..989f21e85 100644 --- a/tests/test_general_contact_s3_physical_orientation.py +++ b/tests/test_general_contact_s3_physical_orientation.py @@ -5,7 +5,7 @@ from pathlib import Path import numpy as np import pytest -from anysolver.general_contact import ContactInteraction,resolve_automatic_contact_domain as resolve +from anyfesolver.general_contact import ContactInteraction,resolve_automatic_contact_domain as resolve @@ -79,8 +79,8 @@ def turn(a,b,c):return (b[0]-a[0])*(c[1]-a[1])-(b[1]-a[1])*(c[0]-a[0]) def _footprint(model,resolution,settings,u): - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager - from anysolver.general_contact.overlap import PlanarFace,planar_projected_overlap + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.overlap import PlanarFace,planar_projected_overlap manager=GeneralS3PatchManager(model,resolution.definition,settings);source,target=manager._positions(u) pairs=[] for si in manager.law.source_face_indices: @@ -97,10 +97,10 @@ def _footprint(model,resolution,settings,u): reason='bounded installed refined automatic deformable lifecycle') def test_installed_s3_physical_orientation_stage(): """One guarded stage per invocation, sharing only retained JSON evidence.""" - import anysolver,numba + import anyfesolver,numba from threadpoolctl import threadpool_info - from anysolver import ContactDefinition,solve_static_nonlinear - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver import ContactDefinition,solve_static_nonlinear + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from examples.general_contact_s3_physical_orientation import build_orientation_pair,solve_shell_pair stage=os.environ['S3_PHYSICAL_ORIENTATION_STAGE'].split('-')[0] evidence=Path(os.environ['AUTOMATIC_WORKFLOW_EVIDENCE']) @@ -119,7 +119,7 @@ def test_installed_s3_physical_orientation_stage(): physical_inputs=dict(integration_role='lower_coarser',controlled_physical_body='upper',source_work_labels='physical_upper_not_integration_role',upper_actuator_midplane_z_m=.055,upper_physical_bottom_offset_m=-.025,lower_pressure_midplane_z_m=0., lower_physical_top_offset_m=float(.025-.01),upper_director=(0.,0.,director_z),lower_director=(0.,0.,director_z), path=path.contract()), - runtime_before_solve=dict(anysolver_path=anysolver.__file__, + runtime_before_solve=dict(anyfesolver_path=anyfesolver.__file__, automatic_domain_path=__import__('inspect').getfile(resolve), jit_disabled=bool(numba.config.DISABLE_JIT),numba_threads=int(numba.get_num_threads()), pools=threadpool_info())) @@ -226,7 +226,7 @@ def save(): assert abs(result.displacements[target_dof])>1e-10 manager=GeneralS3PatchManager(model,resolution.definition,settings) residual,_,contact_result=manager.evaluate(result.displacements,tangent=False) - from anysolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate + from anyfesolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate structural,_,states=_assemble_nonlinear_system(model,result.displacements,result.element_states, 5,tangent=False,kinematics='von_karman') _discard_nonlinear_state_candidate(states) @@ -308,8 +308,8 @@ def save(): def test_reference_orientation_scalar_work_covariance_and_directional_tangent(): from examples.general_contact_s3_physical_orientation import build_orientation_pair - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager,_adapters,_selected - from anysolver.general_contact.s3_overlap_derivatives import s3_overlap_derivatives + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager,_adapters,_selected + from anyfesolver.general_contact.s3_overlap_derivatives import s3_overlap_derivatives from scipy import sparse pairs=[build_orientation_pair(director_z=sign) for sign in (1,-1)] managers=[GeneralS3PatchManager(m,res.definition,st) for m,dom,st,res,path in pairs] @@ -356,9 +356,9 @@ def test_reference_orientation_scalar_work_covariance_and_directional_tangent(): def test_default_contract_identity_and_unused_routes(): - from anysolver import CancellationToken,SolveCancelled,validate_general_contact,solve_static_nonlinear - from anysolver.general_contact.core import _contact_settings_contract - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver import CancellationToken,SolveCancelled,validate_general_contact,solve_static_nonlinear + from anyfesolver.general_contact.core import _contact_settings_contract + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from examples.general_contact_s3_physical_orientation import build_orientation_pair,solve_shell_pair model,domain,settings,res,path=build_orientation_pair(director_z=-1,orientation='legacy') assert 'shell_pair_orientation' not in _contact_settings_contract(settings) @@ -436,9 +436,9 @@ def test_retained_minus_prefix_matching_phase_parity(): def test_public_multiple_beam_transient_refuses_physical_orientation_before_allocation(monkeypatch): from examples.general_contact_multiple_beam_s3_transient import build - from anysolver.dynamics import TransientConfig - from anysolver.general_contact.transient import solve_transient_contact,_admit,ContactTransientSolverControls - import anysolver.general_contact.multiple_beam_s3_transient as owner + from anyfesolver.dynamics import TransientConfig + from anyfesolver.general_contact.transient import solve_transient_contact,_admit,ContactTransientSolverControls + import anyfesolver.general_contact.multiple_beam_s3_transient as owner model,definition,settings,velocity=build() controls=ContactTransientSolverControls(allow_multiple_deformable_beam_s3_dev=True) before=repr(model) diff --git a/tests/test_general_contact_s3_plane.py b/tests/test_general_contact_s3_plane.py index c0e120227..5865b8d05 100644 --- a/tests/test_general_contact_s3_plane.py +++ b/tests/test_general_contact_s3_plane.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, @@ -14,8 +14,8 @@ solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel -from anysolver.general_contact.core import _PlanarQ4PlaneManager +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.core import _PlanarQ4PlaneManager def _guided_s3_plane(director=(0.0, 0.0, 1.0)): diff --git a/tests/test_general_contact_s3_pressure_refinement_ownership.py b/tests/test_general_contact_s3_pressure_refinement_ownership.py index 389d15e52..e07a67b80 100644 --- a/tests/test_general_contact_s3_pressure_refinement_ownership.py +++ b/tests/test_general_contact_s3_pressure_refinement_ownership.py @@ -1,6 +1,6 @@ """Independent positive-gap path with unrelated clipped support.""" import numpy as np -from anysolver.general_contact.s3_pressure_hermite_bounds import s3_pressure_hermite_bounds +from anyfesolver.general_contact.s3_pressure_hermite_bounds import s3_pressure_hermite_bounds def test_temporal_gap_proof_does_not_spend_space_on_unrelated_clipped_modes(monkeypatch): @@ -19,7 +19,7 @@ def evaluate(): start,end,target,target,v0,v1,np.zeros((3,3)),np.zeros((3,3)),1., active=(False,)*6,gap_tolerance_m=1e-10, maximum_time_panels=8,maximum_spatial_cells=64,maximum_depth=4) - from anysolver.general_contact.s3_pressure_hermite_bounds import _SpatialPartition + from anyfesolver.general_contact.s3_pressure_hermite_bounds import _SpatialPartition selected=_SpatialPartition.pop with monkeypatch.context() as patch: patch.setattr(_SpatialPartition,"pop",lambda self,violations=None:selected(self)) diff --git a/tests/test_general_contact_s3_projected_penalty.py b/tests/test_general_contact_s3_projected_penalty.py index b68b244ea..de5402ae3 100644 --- a/tests/test_general_contact_s3_projected_penalty.py +++ b/tests/test_general_contact_s3_projected_penalty.py @@ -14,8 +14,8 @@ import pytest from scipy import sparse -from anysolver import BoundaryCondition, create_shell_element, validate_general_contact -from anysolver.general_contact.s3_patch_static import ( +from anyfesolver import BoundaryCondition, create_shell_element, validate_general_contact +from anyfesolver.general_contact.s3_patch_static import ( GeneralS3PatchManager, S3_PROJECTED_PENALTY_PROFILE, ) from test_general_contact_s3_patch_static import _case @@ -255,8 +255,8 @@ def test_unsupported_enforcement_and_geometry_fail_closed(change): def test_admission_rejects_single_pair_wrong_formulation_and_control(): - from anysolver.general_contact.core import contact_scope - from anysolver import solve_static_nonlinear + from anyfesolver.general_contact.core import contact_scope + from anyfesolver import solve_static_nonlinear model, definition, settings = _candidate() single = replace(definition, surfaces=(replace(definition.surfaces[0], element_ids=(1,)), replace(definition.surfaces[1], element_ids=(3,)))) @@ -292,7 +292,7 @@ def test_refined_four_s3_source_two_s3_target_uses_same_profile_and_resource_cap def test_inherited_exact_clipping_vertex_branch_fails_closed(): - from anysolver.general_contact.s3_overlap_derivatives import UnsupportedOverlapBranch + from anyfesolver.general_contact.s3_overlap_derivatives import UnsupportedOverlapBranch model, definition, settings = _case() definition = replace(definition, interactions=(replace( definition.interactions[0], normal_law="projected_penalty"),)) @@ -328,7 +328,7 @@ def _roundoff_10nm_candidate(): def test_s3_roundoff_positive_perrow_budget_is_coordinate_scaled_not_gap_scaled(): - from anysolver.general_contact.s3_patch_augmented import _s3_gap_operand_roundoff + from anyfesolver.general_contact.s3_patch_augmented import _s3_gap_operand_roundoff source = np.array([[.1, .1, .015-1e-8], [1.1, .1, .015-1e-8], [.1, 1.1, .015-1e-8]]) target = np.array([[0., 0., .015], [1., 0., .015], [0., 1., .015]]) support = np.array([.03, .12, .21]) @@ -368,7 +368,7 @@ def test_s3_roundoff_10nm_translated_full_projected_work(): def test_s3_roundoff_admitted_perrow_value_budget_propagates_to_shared_assembly(monkeypatch): - import anysolver.general_contact.s3_patch_augmented as kernel + import anyfesolver.general_contact.s3_patch_augmented as kernel _, manager, u = _roundoff_10nm_candidate() original_derivatives, original_bound = kernel.s3_overlap_derivatives, kernel._s3_gap_operand_roundoff admitted, retries = [], [] @@ -395,7 +395,7 @@ def track_retry(source, target, support): def test_s3_roundoff_material_weighted_gap_error_still_rejects(monkeypatch): - import anysolver.general_contact.s3_patch_augmented as kernel + import anyfesolver.general_contact.s3_patch_augmented as kernel _, manager, u = _roundoff_10nm_candidate() original_derivatives, original_bound = kernel.s3_overlap_derivatives, kernel._s3_gap_operand_roundoff retries = [] @@ -417,8 +417,8 @@ def track_retry(source, target, support): @pytest.mark.parametrize("case", ["far_origin", "ill_source", "ill_target", "degenerate_source", "degenerate_target"]) def test_s3_roundoff_unresolved_origin_or_frame_rejects_directly(case): - from anysolver.general_contact.s3_patch_augmented import _s3_gap_operand_roundoff - from anysolver.general_contact.s3_overlap_derivatives import UnsupportedOverlapBranch + from anyfesolver.general_contact.s3_patch_augmented import _s3_gap_operand_roundoff + from anyfesolver.general_contact.s3_overlap_derivatives import UnsupportedOverlapBranch source = np.array([[.1, .1, .015-1e-8], [1.1, .1, .015-1e-8], [.1, 1.1, .015-1e-8]]) target = np.array([[0., 0., .015], [1., 0., .015], [0., 1., .015]]) if case == "far_origin": diff --git a/tests/test_general_contact_s3_q4_gap_resolution.py b/tests/test_general_contact_s3_q4_gap_resolution.py index e919abae3..4bcc33b50 100644 --- a/tests/test_general_contact_s3_q4_gap_resolution.py +++ b/tests/test_general_contact_s3_q4_gap_resolution.py @@ -4,8 +4,8 @@ import numpy as np import pytest -from anysolver.general_contact.s3_overlap_derivatives import UnsupportedOverlapBranch -from anysolver.general_contact.s3_q4_gap_resolution import s3_q4_gap_operand_allowance +from anyfesolver.general_contact.s3_overlap_derivatives import UnsupportedOverlapBranch +from anyfesolver.general_contact.s3_q4_gap_resolution import s3_q4_gap_operand_allowance SOURCE = np.array(((.1, .1, .04), (.9, .1, .04), (.1, .9, .04))) @@ -178,7 +178,7 @@ def test_invalid_resolution_metadata_rejects(kwargs): def test_directed_enclosure_boundary_comparison(): - from anysolver.general_contact.s3_q4_gap_resolution import _enclosure_fits + from anyfesolver.general_contact.s3_q4_gap_resolution import _enclosure_fits # Exact binary64 boundary must be rejected after directed comparison. assert not _enclosure_fits(1., 1., 2., 1.) assert _enclosure_fits(1., .5, 2., 1.) @@ -186,7 +186,7 @@ def test_directed_enclosure_boundary_comparison(): def test_directed_normalized_cap_boundary_comparison(): - from anysolver.general_contact.s3_q4_gap_resolution import _within_cap + from anyfesolver.general_contact.s3_q4_gap_resolution import _within_cap support = np.ones(3) assert not _within_cap(np.full(3, 1e-9), support, 1.) assert _within_cap(np.full(3, .5e-9), support, 1.) diff --git a/tests/test_general_contact_s3_q4_overlap_derivatives.py b/tests/test_general_contact_s3_q4_overlap_derivatives.py index c3a60edf8..86e8d3858 100644 --- a/tests/test_general_contact_s3_q4_overlap_derivatives.py +++ b/tests/test_general_contact_s3_q4_overlap_derivatives.py @@ -6,10 +6,10 @@ from scipy.linalg import block_diag from scipy.spatial.transform import Rotation -from anysolver.general_contact.overlap import PlanarFace -from anysolver.general_contact.q4_target_overlap import q4_target_overlap_integrals -from anysolver.general_contact.q4_s3_overlap_derivatives import UnsupportedQ4S3Branch -from anysolver.general_contact.s3_q4_overlap_derivatives import s3_q4_overlap_derivatives +from anyfesolver.general_contact.overlap import PlanarFace +from anyfesolver.general_contact.q4_target_overlap import q4_target_overlap_integrals +from anyfesolver.general_contact.q4_s3_overlap_derivatives import UnsupportedQ4S3Branch +from anyfesolver.general_contact.s3_q4_overlap_derivatives import s3_q4_overlap_derivatives CONTROLS = dict(support_tolerance=1e-12, weighted_gap_tolerance=1e-13, diff --git a/tests/test_general_contact_s3_q4_patch_augmented.py b/tests/test_general_contact_s3_q4_patch_augmented.py index 4567fadd2..319d16dd4 100644 --- a/tests/test_general_contact_s3_q4_patch_augmented.py +++ b/tests/test_general_contact_s3_q4_patch_augmented.py @@ -4,11 +4,11 @@ import numpy as np -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactPathControl, ContactPathProgram, solve_static_nonlinear, validate_general_contact, ) -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from test_general_contact_s3_q4_patch_static import _case from test_general_contact_q4_s3_patch_static import _case as _q4_source_case from test_general_contact_q4_q4_static import _case as _q4_pair_case diff --git a/tests/test_general_contact_s3_q4_patch_static.py b/tests/test_general_contact_s3_q4_patch_static.py index aadbcd11f..eafa38f81 100644 --- a/tests/test_general_contact_s3_q4_patch_static.py +++ b/tests/test_general_contact_s3_q4_patch_static.py @@ -2,14 +2,14 @@ import numpy as np -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactPathControl, ContactPathProgram, ContactSolverSettings, ContactSurface, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager def _case(): diff --git a/tests/test_general_contact_s3_q4_seam_work.py b/tests/test_general_contact_s3_q4_seam_work.py index 6c7323ae9..14fa5f00b 100644 --- a/tests/test_general_contact_s3_q4_seam_work.py +++ b/tests/test_general_contact_s3_q4_seam_work.py @@ -6,11 +6,11 @@ import numpy as np import pytest -from anysolver.general_contact.curved_s3_q4_work import INTEGRATION_CONTROLS -from anysolver.general_contact.overlap import PlanarFace -from anysolver.general_contact.q4_target_overlap import q4_target_overlap_integrals -from anysolver.general_contact.q4_s3_overlap_derivatives import UnsupportedQ4S3Branch -from anysolver.general_contact.s3_q4_overlap_derivatives import ( +from anyfesolver.general_contact.curved_s3_q4_work import INTEGRATION_CONTROLS +from anyfesolver.general_contact.overlap import PlanarFace +from anyfesolver.general_contact.q4_target_overlap import q4_target_overlap_integrals +from anyfesolver.general_contact.q4_s3_overlap_derivatives import UnsupportedQ4S3Branch +from anyfesolver.general_contact.s3_q4_overlap_derivatives import ( s3_q4_overlap_derivatives, _s3_q4_first_order_work, ) diff --git a/tests/test_general_contact_s3_q4_static_dev.py b/tests/test_general_contact_s3_q4_static_dev.py index 7e42d62be..4f064a38b 100644 --- a/tests/test_general_contact_s3_q4_static_dev.py +++ b/tests/test_general_contact_s3_q4_static_dev.py @@ -2,13 +2,13 @@ from dataclasses import replace import numpy as np import pytest -from anysolver import (FEModel, create_shell_element, BoundaryCondition, ContactSurface, +from anyfesolver import (FEModel, create_shell_element, BoundaryCondition, ContactSurface, ContactInteraction, ContactDefinition, ContactPathControl, ContactPathProgram, validate_general_contact, solve_static_nonlinear) -from anysolver.general_contact.s3_patch_static import ( +from anyfesolver.general_contact.s3_patch_static import ( GeneralS3PatchManager, S3_Q4_PROJECTED_PENALTY_PROFILE, ) -from anysolver.general_contact.s3_q4_swept import s3_q4_affine_lower +from anyfesolver.general_contact.s3_q4_swept import s3_q4_affine_lower from test_general_contact_projected_penalty import _candidate @@ -104,7 +104,7 @@ def test_existing_path_press_slide_open_recontact_and_target_motion(tmp_path): assert all(item['contact']['gap_tolerance_met'] for item in history) assert result.restart_checkpoint is not None assert result.info['contact_path']['profile']=='S3_Q4_PROJECTED_FINITE_PENALTY_PATH_STATIC_DEV_V0' - from anysolver.nonlinear_restart import canonical_checkpoint_json_bytes, load_nonlinear_checkpoint + from anyfesolver.nonlinear_restart import canonical_checkpoint_json_bytes, load_nonlinear_checkpoint model,definition,settings=build() opened=solve_static_nonlinear(model,contact=definition,contact_settings=settings, contact_path_program=program,max_load_factor=.75,emit_restart_checkpoint=True) @@ -148,8 +148,8 @@ def test_rotated_negative_gap_bound_against_independent_decimal_corners(): def test_structurally_deforming_target_against_independent_fixed_geometry_kkt(load): from itertools import product from math import factorial - from anysolver.matrix_assembly import assemble_stiffness_matrix - from anysolver.general_contact.static_path import ContactPathNodalForce + from anyfesolver.matrix_assembly import assemble_stiffness_matrix + from anyfesolver.general_contact.static_path import ContactPathNodalForce model,definition,settings=build(target_rigid_normal=False) # Reduce the registered clearance to1um and press1.3um. This limits the # von Karman vs linear reference discrepancy; no stiffness/gap relaxation. @@ -224,7 +224,7 @@ def moment(indices): def test_zero_predictor_keeps_legacy_and_uncontrolled_mechanism_rejection(): from scipy import sparse - from anysolver.general_contact.static_path import _elastic_displacement_force_predictor + from anyfesolver.general_contact.static_path import _elastic_displacement_force_predictor stiffness=sparse.diags((0.,2.),format='csr') transform=sparse.eye(2,format='csr');row=np.array(((1.,0.),));target=np.array(((.1,),)) with pytest.raises(ValueError,match='unresolved'): @@ -237,8 +237,8 @@ def test_zero_predictor_keeps_legacy_and_uncontrolled_mechanism_rejection(): def test_zero_predictor_tiny_positive_controlled_null_and_injection_refusals(monkeypatch): from types import SimpleNamespace from scipy import sparse - import anysolver.general_contact.static_path as path_driver - from anysolver.general_contact.static_path import _elastic_displacement_force_predictor + import anyfesolver.general_contact.static_path as path_driver + from anyfesolver.general_contact.static_path import _elastic_displacement_force_predictor transform=sparse.eye(2,format='csr');row=np.array(((1.,0.),));target=np.array(((.5,),)) # A tiny positive diagonal reaction stays positive and exact under both # allowance values; no floor or snapping replaces it. diff --git a/tests/test_general_contact_s3_replay_ordinary_refusal.py b/tests/test_general_contact_s3_replay_ordinary_refusal.py index 2184995ac..76f735098 100644 --- a/tests/test_general_contact_s3_replay_ordinary_refusal.py +++ b/tests/test_general_contact_s3_replay_ordinary_refusal.py @@ -14,8 +14,8 @@ import numpy as np import pytest -from anysolver.general_contact.s3_friction_replay import S3ReplayFrictionManager -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.s3_friction_replay import S3ReplayFrictionManager +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from test_general_contact_s3_friction_replay import _case from test_general_contact_s3_friction_static import _mode diff --git a/tests/test_general_contact_s3_skin_work.py b/tests/test_general_contact_s3_skin_work.py index aecff5a7c..ac6ee92ca 100644 --- a/tests/test_general_contact_s3_skin_work.py +++ b/tests/test_general_contact_s3_skin_work.py @@ -4,16 +4,16 @@ import pytest from scipy import sparse -from anysolver import create_shell_element -from anysolver.fe_core import FEModel -from anysolver.general_contact.overlap import current_planar_shell_face -from anysolver.general_contact.friction_point import ( +from anyfesolver import create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.overlap import current_planar_shell_face +from anyfesolver.general_contact.friction_point import ( objective_relative_tangent_increment, objective_relative_tangent_variation, ) -from anysolver.general_contact.s3_friction_point import S3SkinMaterialPoint -from anysolver.general_contact.s3_skin_work import S3SkinWorkAdapter -from anysolver.general_contact.triangle_pair_energy import MovingS3PairPenalty +from anyfesolver.general_contact.s3_friction_point import S3SkinMaterialPoint +from anyfesolver.general_contact.s3_skin_work import S3SkinWorkAdapter +from anyfesolver.general_contact.triangle_pair_energy import MovingS3PairPenalty def _model(): diff --git a/tests/test_general_contact_s3_sliding_friction.py b/tests/test_general_contact_s3_sliding_friction.py index 1529e88eb..7b3d72f8d 100644 --- a/tests/test_general_contact_s3_sliding_friction.py +++ b/tests/test_general_contact_s3_sliding_friction.py @@ -6,10 +6,10 @@ import pytest from scipy import sparse -from anysolver import BoundaryCondition, solve_static_nonlinear -from anysolver.general_contact import ContactPathControl, ContactPathProgram -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.general_contact.s3_sliding_friction import ( +from anyfesolver import BoundaryCondition, solve_static_nonlinear +from anyfesolver.general_contact import ContactPathControl, ContactPathProgram +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.s3_sliding_friction import ( S3SlidingFrictionSettings, S3SlidingFrictionManager, ) from test_general_contact_s3_friction_static import _case, _mode diff --git a/tests/test_general_contact_s3_vk_path.py b/tests/test_general_contact_s3_vk_path.py index d25be071e..c694cb40a 100644 --- a/tests/test_general_contact_s3_vk_path.py +++ b/tests/test_general_contact_s3_vk_path.py @@ -7,8 +7,8 @@ sys.path.insert(0, str(Path(__file__).parent)) import test_general_contact_event_subdivision as events # noqa: E402 -from anysolver.dynamics import TransientConfig # noqa: E402 -from anysolver.general_contact import transient as driver # noqa: E402 +from anyfesolver.dynamics import TransientConfig # noqa: E402 +from anyfesolver.general_contact import transient as driver # noqa: E402 def _tilted(stop=.012): diff --git a/tests/test_general_contact_s3_vk_path_guards.py b/tests/test_general_contact_s3_vk_path_guards.py index 6a81e8785..92a75a092 100644 --- a/tests/test_general_contact_s3_vk_path_guards.py +++ b/tests/test_general_contact_s3_vk_path_guards.py @@ -9,9 +9,9 @@ sys.path.insert(0, str(Path(__file__).parent)) import test_general_contact_event_subdivision as events # noqa: E402 -from anysolver.dynamics import TransientConfig # noqa: E402 -from anysolver.general_contact import transient as driver # noqa: E402 -from anysolver.general_contact.algebraic_path import affine_descriptor_path # noqa: E402 +from anyfesolver.dynamics import TransientConfig # noqa: E402 +from anyfesolver.general_contact import transient as driver # noqa: E402 +from anyfesolver.general_contact.algebraic_path import affine_descriptor_path # noqa: E402 CONTROLS = SimpleNamespace(s3_path_position_tolerance_m=1e-10, s3_path_rotation_tolerance_rad=1e-9, equilibrium_tolerance=1e-8) diff --git a/tests/test_general_contact_same_side_broad_phase.py b/tests/test_general_contact_same_side_broad_phase.py index c036583e2..825765b6b 100644 --- a/tests/test_general_contact_same_side_broad_phase.py +++ b/tests/test_general_contact_same_side_broad_phase.py @@ -3,9 +3,9 @@ import numpy as np import pytest -from anysolver.general_contact.overlap import PlanarFace, planar_projected_overlap -from anysolver.general_contact.q4_source_overlap import projected_q4_source_face -from anysolver.general_contact.s3_patch_mortar_energy import ( +from anyfesolver.general_contact.overlap import PlanarFace, planar_projected_overlap +from anyfesolver.general_contact.q4_source_overlap import projected_q4_source_face +from anyfesolver.general_contact.s3_patch_mortar_energy import ( MovingS3PatchPrimalMortarPenalty, ) diff --git a/tests/test_general_contact_schur_active_epoch.py b/tests/test_general_contact_schur_active_epoch.py index 256f384cc..793fb6258 100644 --- a/tests/test_general_contact_schur_active_epoch.py +++ b/tests/test_general_contact_schur_active_epoch.py @@ -2,7 +2,7 @@ import numpy as np -from anysolver import solve_static_nonlinear +from anyfesolver import solve_static_nonlinear from scripts.general_contact_d1_coupled_refinement import build_case diff --git a/tests/test_general_contact_schur_backtrack_settings.py b/tests/test_general_contact_schur_backtrack_settings.py index ccd5dd67d..a7f6f6f98 100644 --- a/tests/test_general_contact_schur_backtrack_settings.py +++ b/tests/test_general_contact_schur_backtrack_settings.py @@ -4,8 +4,8 @@ import pytest -from anysolver import ContactSolverSettings -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver import ContactSolverSettings +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from scripts.general_contact_d1_free_target_press_probe import build_free_target_case diff --git a/tests/test_general_contact_schur_jet2_response.py b/tests/test_general_contact_schur_jet2_response.py index 657cf3b1b..6ad0d0071 100644 --- a/tests/test_general_contact_schur_jet2_response.py +++ b/tests/test_general_contact_schur_jet2_response.py @@ -6,8 +6,8 @@ from scipy import sparse from scipy.optimize import root -from anysolver.general_contact.linearized_pivot import _constrained_gap_response -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.linearized_pivot import _constrained_gap_response +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from test_general_contact_q4_s3_refined_patch import _two_q4_two_s3 diff --git a/tests/test_general_contact_search_adapter.py b/tests/test_general_contact_search_adapter.py index 0f051cf4d..9cd13b9a5 100644 --- a/tests/test_general_contact_search_adapter.py +++ b/tests/test_general_contact_search_adapter.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver.general_contact.contact_search import ContactAABBIndex +from anyfesolver.general_contact.contact_search import ContactAABBIndex def _exhaustive(keys, boxes, window, padding=0.0): diff --git a/tests/test_general_contact_search_start_certificate.py b/tests/test_general_contact_search_start_certificate.py index 4e1bbf7a0..59474fa17 100644 --- a/tests/test_general_contact_search_start_certificate.py +++ b/tests/test_general_contact_search_start_certificate.py @@ -4,8 +4,8 @@ import numpy as np import pytest from scipy import sparse -from anysolver.general_contact.core import ContactSolverSettings -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.core import ContactSolverSettings +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager def manager(): diff --git a/tests/test_general_contact_seed_gap_reference.py b/tests/test_general_contact_seed_gap_reference.py index bb3bd4200..66e34cfa2 100644 --- a/tests/test_general_contact_seed_gap_reference.py +++ b/tests/test_general_contact_seed_gap_reference.py @@ -1,7 +1,7 @@ """Independent checks for the literal seed-gap reference. These checks are deliberately self-contained: the reference module is -stdlib-only, no ``anysolver`` module is imported and no production +stdlib-only, no ``anyfesolver`` module is imported and no production gap/witness kernel is called for any oracle value. The certified scope is the single literal captured Q4/S3 pair path; nothing here asserts anything about other faces, poses or the whole solver path. diff --git a/tests/test_general_contact_seed_path_record_diagnosis.py b/tests/test_general_contact_seed_path_record_diagnosis.py index c040d6e79..17dedab40 100644 --- a/tests/test_general_contact_seed_path_record_diagnosis.py +++ b/tests/test_general_contact_seed_path_record_diagnosis.py @@ -82,8 +82,8 @@ def _production_stages(record): certificate, and the expensive matching/overlap-local schedules are recorded as skipped-known-admitted. """ - from anysolver.general_contact import q4_overlap_local_bound as bounds - from anysolver.general_contact.q4_source_overlap import ( + from anyfesolver.general_contact import q4_overlap_local_bound as bounds + from anyfesolver.general_contact.q4_source_overlap import ( q4_source_projected_gap_lower, ) a0, a1, b0, b1, errors, tolerance = _arrays(record) diff --git a/tests/test_general_contact_semismooth_merit_direction.py b/tests/test_general_contact_semismooth_merit_direction.py index 3af0b7402..26192791f 100644 --- a/tests/test_general_contact_semismooth_merit_direction.py +++ b/tests/test_general_contact_semismooth_merit_direction.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver.general_contact.semismooth_path import ( +from anyfesolver.general_contact.semismooth_path import ( _current_merit_slope, _original_direction_event_fraction, ) @@ -108,7 +108,7 @@ def _caller(monkeypatch, *, gaps, forces, gradient, directions, certificates): """Controlled linear responses exercise production selection/cleanup only.""" from types import SimpleNamespace from scipy import sparse - import anysolver.general_contact.semismooth_path as owner + import anyfesolver.general_contact.semismooth_path as owner modes = len(gaps) origin = {7: {'origin': 11}} seen_origins, proposals, candidate_poses, discards = [], [], [], [] diff --git a/tests/test_general_contact_shell_pair_hermite_sweep.py b/tests/test_general_contact_shell_pair_hermite_sweep.py index a39a3dfc2..94cf436e0 100644 --- a/tests/test_general_contact_shell_pair_hermite_sweep.py +++ b/tests/test_general_contact_shell_pair_hermite_sweep.py @@ -4,7 +4,7 @@ import numpy as np import pytest -from anysolver.general_contact.shell_pair_hermite_sweep import shell_pair_hermite_lower +from anyfesolver.general_contact.shell_pair_hermite_sweep import shell_pair_hermite_lower TRIANGLE = np.array([[0., 0., 0.], [1., 0., 0.], [0., 1., 0.]]) diff --git a/tests/test_general_contact_shell_sphere_temporal_bounds.py b/tests/test_general_contact_shell_sphere_temporal_bounds.py index 287103e49..1ca3874de 100644 --- a/tests/test_general_contact_shell_sphere_temporal_bounds.py +++ b/tests/test_general_contact_shell_sphere_temporal_bounds.py @@ -8,12 +8,12 @@ import numpy as np import pytest -from anysolver.general_contact.beam_temporal_bounds import BeamHermiteGapBoundsError -from anysolver.general_contact.shell_sphere_temporal_bounds import ( +from anyfesolver.general_contact.beam_temporal_bounds import BeamHermiteGapBoundsError +from anyfesolver.general_contact.shell_sphere_temporal_bounds import ( _face_controls, _split_tensor, _squared_controls, q4_sphere_hermite_gap_bounds, ) -from anysolver.general_contact.sphere import _SphereFace +from anyfesolver.general_contact.sphere import _SphereFace def _shape(r, s): @@ -287,10 +287,10 @@ def test_unsupported_or_invalid_geometry_is_rejected(invalid): def test_real_q4_sphere_manager_physical_skin_agrees_with_analytic_gap(): - from anysolver import (ContactDefinition, ContactInteraction, ContactSolverSettings, + from anyfesolver import (ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, RigidContactBody, create_shell_element) - from anysolver.fe_core import FEModel - from anysolver.general_contact.sphere import _SphereShellManager + from anyfesolver.fe_core import FEModel + from anyfesolver.general_contact.sphere import _SphereShellManager model = FEModel("represented_q4_sphere") model.add_material("elastic", 1.e5, .3, density=1.) for node, (x, y) in enumerate(((-1., -1.), (1., -1.), (1., 1.), (-1., 1.)), 1): diff --git a/tests/test_general_contact_skew_partial_work.py b/tests/test_general_contact_skew_partial_work.py index 5dc666d89..f72a187ed 100644 --- a/tests/test_general_contact_skew_partial_work.py +++ b/tests/test_general_contact_skew_partial_work.py @@ -3,12 +3,12 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, create_shell_element, ) -from anysolver.fe_core import FEModel -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager _TARGET = ((.2, -.1), (.92, 0.), (.86, 1.15), (.15, .95)) diff --git a/tests/test_general_contact_skin_geometry.py b/tests/test_general_contact_skin_geometry.py index a98b71899..a21579e61 100644 --- a/tests/test_general_contact_skin_geometry.py +++ b/tests/test_general_contact_skin_geometry.py @@ -3,10 +3,10 @@ import pytest from dataclasses import replace -from anysolver import ContactSkinGeometryError, recover_general_contact_shell_skins +from anyfesolver import ContactSkinGeometryError, recover_general_contact_shell_skins from test_general_contact_q4_s3_patch_static import _case -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver import ContactDefinition, ContactSurface, create_shell_element +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver import ContactDefinition, ContactSurface, create_shell_element def _pose(model): diff --git a/tests/test_general_contact_sliding_map.py b/tests/test_general_contact_sliding_map.py index ad043d246..1cae607fb 100644 --- a/tests/test_general_contact_sliding_map.py +++ b/tests/test_general_contact_sliding_map.py @@ -3,14 +3,14 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( ContactDefinition, ContactInteraction, ContactSurface, create_shell_element, ) -from anysolver.fe_core import FEModel -from anysolver.general_contact.sliding import _RestrictedSlidingPairFEManager +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.sliding import _RestrictedSlidingPairFEManager def _two_q4_faces(director=None): diff --git a/tests/test_general_contact_sliding_static.py b/tests/test_general_contact_sliding_static.py index cf4882d3e..3e2ae1dd6 100644 --- a/tests/test_general_contact_sliding_static.py +++ b/tests/test_general_contact_sliding_static.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, @@ -15,7 +15,7 @@ solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel +from anyfesolver.fe_core import FEModel def test_restricted_sliding_pair_runs_through_nonlinear_static(): @@ -106,11 +106,11 @@ def test_restricted_sliding_pair_runs_through_nonlinear_static(): def test_overlap_aware_swept_gap_excludes_distant_deep_source_nodes(): """Independent linear height field is safe throughout nonzero sliding.""" - from anysolver.general_contact.overlap import PlanarFace - from anysolver.general_contact.moving import ( + from anyfesolver.general_contact.overlap import PlanarFace + from anyfesolver.general_contact.moving import ( bound_swept_moving_mortar_gap, certify_swept_moving_mortar_gap, ) - from anysolver.general_contact.sliding import _RestrictedSlidingPairFEManager + from anyfesolver.general_contact.sliding import _RestrictedSlidingPairFEManager source = PlanarFace((1, 1), np.array( ((0., 0., 0.), (2., 0., 0.), (2., 1., 0.), (0., 1., 0.)))) @@ -155,8 +155,8 @@ def test_overlap_aware_swept_gap_excludes_distant_deep_source_nodes(): def test_overlap_aware_swept_gap_refuses_hidden_temporal_penetration(): - from anysolver.general_contact.overlap import PlanarFace - from anysolver.general_contact.moving import ( + from anyfesolver.general_contact.overlap import PlanarFace + from anyfesolver.general_contact.moving import ( certify_moving_mortar_gap, certify_swept_moving_mortar_gap, ) source = PlanarFace((1, 1), np.array( @@ -179,8 +179,8 @@ def test_overlap_aware_swept_gap_refuses_hidden_temporal_penetration(): def test_overlap_aware_swept_gap_keeps_nonaffine_q4_and_s3_interpolation(): - from anysolver.general_contact.overlap import PlanarFace - from anysolver.general_contact.moving import certify_swept_moving_mortar_gap + from anyfesolver.general_contact.overlap import PlanarFace + from anyfesolver.general_contact.moving import certify_swept_moving_mortar_gap source = PlanarFace((1, 1), np.array( ((0., 0., 0.), (2., 0., 0.), (2.5, 1., 0.), (0., 1., 0.)))) target = PlanarFace((2, 1), np.array( @@ -198,8 +198,8 @@ def test_overlap_aware_swept_gap_keeps_nonaffine_q4_and_s3_interpolation(): def test_overlap_aware_swept_gap_budget_exhaustion_is_non_success(): - from anysolver.general_contact.overlap import PlanarFace - from anysolver.general_contact.moving import certify_swept_moving_mortar_gap + from anyfesolver.general_contact.overlap import PlanarFace + from anyfesolver.general_contact.moving import certify_swept_moving_mortar_gap face = PlanarFace((1, 1), np.array( ((0., 0., 0.), (1., 0., 0.), (1., 1., 0.), (0., 1., 0.)))) zero = np.zeros(3) @@ -216,8 +216,8 @@ def test_overlap_aware_swept_gap_budget_exhaustion_is_non_success(): def test_swept_gap_fast_path_refuses_catastrophic_normal_cancellation(): - from anysolver.general_contact.overlap import PlanarFace - from anysolver.general_contact.moving import ( + from anyfesolver.general_contact.overlap import PlanarFace + from anyfesolver.general_contact.moving import ( bound_swept_moving_mortar_gap, certify_swept_moving_mortar_gap, ) xy = np.array(((0., 0.), (1., 0.), (1., 1.), (0., 1.))) @@ -235,8 +235,8 @@ def test_swept_gap_fast_path_refuses_catastrophic_normal_cancellation(): def test_swept_gap_fast_path_refuses_tiny_closing_overlap(): - from anysolver.general_contact.overlap import PlanarFace - from anysolver.general_contact.moving import ( + from anyfesolver.general_contact.overlap import PlanarFace + from anyfesolver.general_contact.moving import ( bound_swept_moving_mortar_gap, certify_swept_moving_mortar_gap, ) right = 1e-4 diff --git a/tests/test_general_contact_sphere.py b/tests/test_general_contact_sphere.py index cf9a44572..40535ae12 100644 --- a/tests/test_general_contact_sphere.py +++ b/tests/test_general_contact_sphere.py @@ -3,14 +3,14 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, DisplacementControl, LoadCase, RigidContactBody, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel -from anysolver.general_contact.sphere import ( +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.sphere import ( _GapCertificateLimitError, _SphereShellManager, ) diff --git a/tests/test_general_contact_sphere_temporal_bounds.py b/tests/test_general_contact_sphere_temporal_bounds.py index 6d687d0b0..c9478f86e 100644 --- a/tests/test_general_contact_sphere_temporal_bounds.py +++ b/tests/test_general_contact_sphere_temporal_bounds.py @@ -8,9 +8,9 @@ import numpy as np import pytest -from anysolver.general_contact.beam_temporal_bounds import BeamHermiteGapBoundsError -from anysolver.general_contact.sphere_temporal_bounds import beam_sphere_hermite_gap_bounds -from anysolver.general_contact.sphere_temporal_bounds import _squared_controls +from anyfesolver.general_contact.beam_temporal_bounds import BeamHermiteGapBoundsError +from anyfesolver.general_contact.sphere_temporal_bounds import beam_sphere_hermite_gap_bounds +from anyfesolver.general_contact.sphere_temporal_bounds import _squared_controls def _manager(points, radius=.25): diff --git a/tests/test_general_contact_static_results_archive.py b/tests/test_general_contact_static_results_archive.py index 655912634..7a6431f98 100644 --- a/tests/test_general_contact_static_results_archive.py +++ b/tests/test_general_contact_static_results_archive.py @@ -4,10 +4,10 @@ from pathlib import Path import numpy as np import pytest -from anysolver.nonlinear_static import NonlinearStaticResult, NonlinearStaticStep, NonlinearIncrementSnapshot -from anysolver.general_contact import (StaticContactArchiveError as Error, +from anyfesolver.nonlinear_static import NonlinearStaticResult, NonlinearStaticStep, NonlinearIncrementSnapshot +from anyfesolver.general_contact import (StaticContactArchiveError as Error, serialize_static_contact_results as serialize, read_static_contact_results as read) -from anysolver.general_contact import transient_results_archive as codec +from anyfesolver.general_contact import transient_results_archive as codec def sample(): @@ -40,7 +40,7 @@ def test_exact_detached_and_refusal(): def test_active_store_rejected_before_callback(monkeypatch): - from anysolver.nonlinear_state import NonlinearStateStore + from anyfesolver.nonlinear_state import NonlinearStateStore store=NonlinearStateStore() monkeypatch.setattr(NonlinearStateStore,'has_active_trial',property(lambda self:True)) monkeypatch.setattr(NonlinearStateStore,'materialize_owned',lambda self:pytest.fail('copy callback')) @@ -54,14 +54,15 @@ def test_active_store_rejected_before_callback(monkeypatch): def assert_producer_data(expected, actual): """Independent preservation oracle; no archive encode/decode helpers.""" - from anysolver.nonlinear_state import NonlinearStateStore + from anyfesolver.nonlinear_state import NonlinearStateStore if type(expected) is NonlinearStateStore: assert not expected.has_active_trial expected = expected.materialize_owned() if is_dataclass(expected) and not isinstance(expected, type): assert type(actual) is dict assert set(actual) == {'record_type', 'fields', 'summary'} - assert actual['record_type'] == type(expected).__module__ + '.' + type(expected).__qualname__ + module = type(expected).__module__.replace('anyfesolver.', 'anysolver.', 1) + assert actual['record_type'] == module + '.' + type(expected).__qualname__ assert_producer_data({field.name:getattr(expected,field.name) for field in fields(expected)}, actual['fields']) summary = expected.to_dict() if hasattr(expected, 'to_dict') else None @@ -129,7 +130,7 @@ def test_closed_roles_and_wire_compatibility(): assert baseline and Path(baseline).resolve()==Path(expected_baseline).resolve() if baseline: import importlib.util - spec=importlib.util.spec_from_file_location('anysolver.general_contact._legacy_archive',baseline) + spec=importlib.util.spec_from_file_location('anyfesolver.general_contact._legacy_archive',baseline) module=importlib.util.module_from_spec(spec) import sys sys.modules[spec.name]=module;spec.loader.exec_module(module) diff --git a/tests/test_general_contact_structural_state_bridge.py b/tests/test_general_contact_structural_state_bridge.py index 9f4d386bf..6e0ae98f6 100644 --- a/tests/test_general_contact_structural_state_bridge.py +++ b/tests/test_general_contact_structural_state_bridge.py @@ -7,7 +7,7 @@ import numpy as np import pytest -from anysolver.general_contact.structural_state_bridge import TwoBodyStateBridge +from anyfesolver.general_contact.structural_state_bridge import TwoBodyStateBridge from examples.elastic_sphere_panel_state_bridge import prepare_bridge_case, report_state_bridge from examples.elastic_sphere_panel_continuation import _model_snapshot, _states_equal diff --git a/tests/test_general_contact_supported_schur.py b/tests/test_general_contact_supported_schur.py index f812c6d7e..fd764e2b9 100644 --- a/tests/test_general_contact_supported_schur.py +++ b/tests/test_general_contact_supported_schur.py @@ -5,8 +5,8 @@ import json from pathlib import Path -from anysolver.general_contact import supported_schur -from anysolver.general_contact.supported_schur import propose_supported_schur_step +from anyfesolver.general_contact import supported_schur +from anyfesolver.general_contact.supported_schur import propose_supported_schur_step def test_nineteen_supported_active_modes_take_a_bounded_projected_root_step(): diff --git a/tests/test_general_contact_supported_schur_backtrack.py b/tests/test_general_contact_supported_schur_backtrack.py index 10ca31c12..33ffea73b 100644 --- a/tests/test_general_contact_supported_schur_backtrack.py +++ b/tests/test_general_contact_supported_schur_backtrack.py @@ -7,7 +7,7 @@ import numpy as np import pytest -from anysolver.general_contact.supported_schur import ( +from anyfesolver.general_contact.supported_schur import ( SupportedSchurBacktrackData, SupportedSchurProposal, propose_supported_schur_backtrack, diff --git a/tests/test_general_contact_supported_schur_path.py b/tests/test_general_contact_supported_schur_path.py index 05a61ba9a..54b99109f 100644 --- a/tests/test_general_contact_supported_schur_path.py +++ b/tests/test_general_contact_supported_schur_path.py @@ -6,12 +6,12 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactPathControl, ContactPathProgram, solve_static_nonlinear, validate_general_contact, ) -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.general_contact import static_path, supported_schur +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact import static_path, supported_schur from test_general_contact_q4_s3_refined_patch import _two_q4_two_s3 diff --git a/tests/test_general_contact_swept_patch_broadphase.py b/tests/test_general_contact_swept_patch_broadphase.py index 9c998834a..c0e84c372 100644 --- a/tests/test_general_contact_swept_patch_broadphase.py +++ b/tests/test_general_contact_swept_patch_broadphase.py @@ -3,10 +3,10 @@ import numpy as np import pytest -from anysolver.general_contact.overlap import planar_projected_overlap, PlanarFace -from anysolver.general_contact.q4_overlap_local_bound import overlap_local_swept_lower -from anysolver.general_contact.q4_source_overlap import projected_q4_source_face -from anysolver.general_contact.swept_patch_broadphase import conservative_swept_pair_indices +from anyfesolver.general_contact.overlap import planar_projected_overlap, PlanarFace +from anyfesolver.general_contact.q4_overlap_local_bound import overlap_local_swept_lower +from anyfesolver.general_contact.q4_source_overlap import projected_q4_source_face +from anyfesolver.general_contact.swept_patch_broadphase import conservative_swept_pair_indices Q4 = np.array(((0., 0., 0.), (1., 0., 0.), (1., 1., 0.), (0., 1., 0.))) diff --git a/tests/test_general_contact_swept_search_owner.py b/tests/test_general_contact_swept_search_owner.py index 8bcfc450c..a351833e7 100644 --- a/tests/test_general_contact_swept_search_owner.py +++ b/tests/test_general_contact_swept_search_owner.py @@ -1,8 +1,8 @@ """The owner must preserve swept rejection, exhaustive fallback and identity.""" import numpy as np import pytest -from anysolver.general_contact import swept_patch_broadphase as search -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact import swept_patch_broadphase as search +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager from test_general_contact_preparation_reuse import gap_fixture @@ -58,8 +58,8 @@ def test_prior_swept_revision_checkpoint_rejected_before_continuation(): import json from dataclasses import replace from pathlib import Path - from anysolver import solve_static_nonlinear - from anysolver.nonlinear_restart import NonlinearCheckpointError + from anyfesolver import solve_static_nonlinear + from anyfesolver.nonlinear_restart import NonlinearCheckpointError from scripts.general_contact_d1_interior_press_dev import build_interior_press path=Path(__file__).resolve().parents[1]/'docs/d1_review_support/d1_pressure_family4_moving_edge_cycle_v4_20260929.json' checkpoint=json.loads(path.read_text(encoding='utf-8'))['restart_checkpoint'] diff --git a/tests/test_general_contact_tilted_relative_sliding.py b/tests/test_general_contact_tilted_relative_sliding.py index 2d08f7297..7f06ec2a4 100644 --- a/tests/test_general_contact_tilted_relative_sliding.py +++ b/tests/test_general_contact_tilted_relative_sliding.py @@ -5,8 +5,8 @@ import numpy as np import pytest from examples.general_contact_tilted_relative_sliding import build,solve,rigid_pose,rotation -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.general_contact.semismooth import linearize,complementarity,reference_nodal_support +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.semismooth import linearize,complementarity,reference_nodal_support spec=importlib.util.spec_from_file_location('_tilted_finite_proof',Path(__file__).with_name('test_general_contact_finite_rotation_shell_work.py')) _finite_proof=importlib.util.module_from_spec(spec);spec.loader.exec_module(_finite_proof) decimal_director,save,read,sha=(_finite_proof.decimal_director,_finite_proof.save,_finite_proof.read,_finite_proof.sha) @@ -130,8 +130,8 @@ def rows_for(model,program): def test_independent_partition_seed_and_current_work_tangent(monkeypatch): from scipy.sparse import eye - from anysolver.general_contact.finite_rotation_predictor import per_surface_seed_descriptor,per_surface_rigid_seed - from anysolver.general_contact.finite_rotation_state import owner_local_coordinates + from anyfesolver.general_contact.finite_rotation_predictor import per_surface_seed_descriptor,per_surface_rigid_seed + from anyfesolver.general_contact.finite_rotation_state import owner_local_coordinates model,domain,settings,res,program=build();manager=GeneralS3PatchManager(model,res.definition,settings) desc=per_surface_seed_descriptor(model,res.definition,program);n=manager.n_dof;rows=rows_for(model,program) q=rigid_pose(model,math.pi/3.) @@ -184,7 +184,7 @@ def test_installed_relative_path(): @pytest.mark.skipif(not os.environ.get('AUTOMATIC_WORKFLOW_EVIDENCE'), reason='archived tilted inputs AUTOMATIC_WORKFLOW_EVIDENCE run-4..run-16.json absent: saved-pose physical-gate replay requires the original staged evidence root') def test_saved_relative_poses_independent_physical_gates(): - from anysolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate + from anyfesolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate spec=importlib.util.spec_from_file_location('_tilted_pose_oracle',Path(__file__).parents[1]/'docs/d1_review_support/contact_tilted_relative_sliding_20261008/oracle.py') oracle=importlib.util.module_from_spec(spec);spec.loader.exec_module(oracle) stages=['run-'+str(i) for i in (4,8,12,13,14,15,16)];chunks=[read(s) for s in stages] @@ -247,8 +247,8 @@ def test_saved_relative_poses_independent_physical_gates(): def test_relative_admission_and_restart_safety(monkeypatch): - from anysolver import CancellationToken,SolveCancelled,solve_static_nonlinear,validate_general_contact - from anysolver.general_contact.finite_rotation_predictor import finite_surface_partitions,per_surface_seed_descriptor,per_surface_rigid_seed + from anyfesolver import CancellationToken,SolveCancelled,solve_static_nonlinear,validate_general_contact + from anyfesolver.general_contact.finite_rotation_predictor import finite_surface_partitions,per_surface_seed_descriptor,per_surface_rigid_seed from scipy.sparse import eye model,domain,settings,res,program=build();before=repr(model) token=CancellationToken();token.cancel('tilted relative precancel') @@ -276,9 +276,9 @@ def test_relative_admission_and_restart_safety(monkeypatch): descriptors=per_surface_seed_descriptor(model,res.definition,program);rows=rows_for(model,program);q=rigid_pose(model,math.pi/3.);target=program.target_at(14).copy();target[0]+=1e-4 with pytest.raises(ValueError,match='consistent reference frame'):per_surface_rigid_seed(model,program,target,eye(manager_n:=len(q),format='csr'),np.zeros(manager_n),q,rows,descriptors) from examples.general_contact_multiple_beam_s3_transient import build as dynamic - from anysolver.dynamics import TransientConfig - from anysolver.general_contact.transient import solve_transient_contact,_admit,ContactTransientSolverControls - import anysolver.general_contact.multiple_beam_s3_transient as owner + from anyfesolver.dynamics import TransientConfig + from anyfesolver.general_contact.transient import solve_transient_contact,_admit,ContactTransientSolverControls + import anyfesolver.general_contact.multiple_beam_s3_transient as owner dm,dd,ds,velocity=dynamic();controls=ContactTransientSolverControls(allow_multiple_deformable_beam_s3_dev=True);assert _admit(dm,dd,ds,controls)==owner.PROFILE class WrongSettings:finite_frame_seed='per_surface_reference_frames_dev' with pytest.raises(ValueError,match='requires exact contact definitions/settings'):_admit(dm,dd,WrongSettings(),controls) @@ -288,9 +288,9 @@ def forbidden(*args,**kwargs):calls.append(True);raise AssertionError('allocatio with pytest.raises(ValueError,match='finite_frame_seed'): solve_transient_contact(dm,dd,TransientConfig(dt=1e-5,t_end=1e-5,initial_velocity=velocity),contact_settings=replace(ds,finite_frame_seed='per_surface_reference_frames_dev'),solver_controls=controls) assert not calls - from anysolver import LoadCase,ArcLengthControl,solve_static_arc_length + from anyfesolver import LoadCase,ArcLengthControl,solve_static_arc_length from examples.general_contact_triangulated_rigid_patch import case - import anysolver.general_contact.arc_contact as arc_owner + import anyfesolver.general_contact.arc_contact as arc_owner am,ad,aset=case();assert validate_general_contact(am,ad,aset,analysis_control='arc_length').valid load=LoadCase('unused-independent-frame');load.add_nodal_load(2,forces=(0.,0.,-.01));arc_before=repr(am) arc_calls=[] @@ -324,7 +324,7 @@ def test_relative_archive_checkpoint_restart_refusals(): reason='archived legacy checkpoint contact_finite_rotation_shell_work_20261008/outputs/run-15.json absent: legacy default continuation replay requires the original saved run') def test_legacy_default_finite_checkpoint_continuation(): from examples.general_contact_finite_rotation_shell_work import build as prior,solve as prior_solve - from anysolver.general_contact.core import _contact_settings_contract + from anyfesolver.general_contact.core import _contact_settings_contract path=Path('C:/ANYworkspaceWork/contact_finite_rotation_shell_work_20261008/outputs/run-15.json');stored=json.loads(path.read_text()) model,domain,settings,res,program=prior();assert settings.finite_frame_seed=='common_reference_frame_dev' assert 'finite_frame_seed' not in _contact_settings_contract(settings) and res.identity==stored['identity'] @@ -337,7 +337,7 @@ def test_legacy_default_finite_checkpoint_continuation(): @pytest.mark.skipif(not os.environ.get('AUTOMATIC_WORKFLOW_EVIDENCE'), reason='archived tilted inputs AUTOMATIC_WORKFLOW_EVIDENCE run-4..run-16.json absent: equilibrium discriminator replay requires the original staged evidence root') def test_saved_equilibrium_discriminator(): - from anysolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate + from anyfesolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate model,domain,settings,res,program=build();manager=GeneralS3PatchManager(model,res.definition,settings);C=rows_for(model,program) fixed=[model.mesh.dof_manager.get_node_dofs(9)[1]];free=np.setdiff1d(np.arange(manager.n_dof),fixed);names=dict(ux=0,uy=1,uz=2,rx=3,ry=4,rz=5);rows=[] for stage in ('run-4','run-8','run-12','run-13','run-14','run-15','run-16'): diff --git a/tests/test_general_contact_touching_bounds.py b/tests/test_general_contact_touching_bounds.py index 6e9242620..cbfe0313e 100644 --- a/tests/test_general_contact_touching_bounds.py +++ b/tests/test_general_contact_touching_bounds.py @@ -7,15 +7,15 @@ import numpy as np import pytest -from anysolver.general_contact.overlap import PlanarFace -from anysolver.general_contact.s3_patch_augmented import _touching_projected_boundaries +from anyfesolver.general_contact.overlap import PlanarFace +from anyfesolver.general_contact.s3_patch_augmented import _touching_projected_boundaries def _old_touch(): # Extract only the exact prepatch predicate; do not import another kernel. path = Path(__file__).parents[1] / "docs/d1_review_support/d1_touch_bounds_prepatch_20260930.py.txt" raw = path.read_bytes() - # Byte-identical to 590d7a42^:src/anysolver/general_contact/s3_patch_augmented.py. + # Byte-identical to 590d7a42^:src/anyfesolver/general_contact/s3_patch_augmented.py. # The former digest did not identify this committed prepatch source. assert hashlib.sha256(raw).hexdigest() == "e5e885bfdc10469d476f86db60376ed9ef165d3cae7b351f76fee2715fa2d4e3" node = next(n for n in ast.parse(raw).body diff --git a/tests/test_general_contact_transient_beam_plane.py b/tests/test_general_contact_transient_beam_plane.py index 4f039eac5..6e2673967 100644 --- a/tests/test_general_contact_transient_beam_plane.py +++ b/tests/test_general_contact_transient_beam_plane.py @@ -4,10 +4,10 @@ import numpy as np import pytest -from anysolver import BoundaryCondition, LoadCase -from anysolver.dynamics import TransientConfig -from anysolver.general_contact.core import active_contact_manager -from anysolver.general_contact.transient import ( +from anyfesolver import BoundaryCondition, LoadCase +from anyfesolver.dynamics import TransientConfig +from anyfesolver.general_contact.core import active_contact_manager +from anyfesolver.general_contact.transient import ( ContactNodalLoadHistory,ContactTransientSolverControls,solve_transient_contact, ) from test_general_contact_beam_plane import _model @@ -167,9 +167,9 @@ def test_deformable_b3_partial_impact_retains_rotary_motion_and_normal_momentum( @pytest.mark.parametrize('cancel',[False,True]) def test_beam_path_failure_or_cancellation_preserves_commit_boundary(monkeypatch,cancel): - import anysolver.general_contact.transient as driver - import anysolver.general_contact.beam_temporal_bounds as geometry - from anysolver.control import CancellationToken, SolveCancelled + import anyfesolver.general_contact.transient as driver + import anyfesolver.general_contact.beam_temporal_bounds as geometry + from anyfesolver.control import CancellationToken, SolveCancelled token = CancellationToken() commits,calls = [],[] commit,bounds = driver.commit_state_candidate,geometry.beam_hermite_gap_bounds diff --git a/tests/test_general_contact_transient_cancellation.py b/tests/test_general_contact_transient_cancellation.py index 97c9c383d..a57666f5b 100644 --- a/tests/test_general_contact_transient_cancellation.py +++ b/tests/test_general_contact_transient_cancellation.py @@ -3,10 +3,10 @@ import numpy as np import pytest -from anysolver.control import CancellationToken, SolveCancelled -from anysolver import TransientConfig, solve_transient_contact -import anysolver.general_contact.transient as driver -from anysolver.general_contact.core import active_contact_manager, _PlanarQ4PlaneManager +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver import TransientConfig, solve_transient_contact +import anyfesolver.general_contact.transient as driver +from anyfesolver.general_contact.core import active_contact_manager, _PlanarQ4PlaneManager from test_general_contact_transient_plane import _guided_plate, _constant_q4_load diff --git a/tests/test_general_contact_transient_clipped_s3.py b/tests/test_general_contact_transient_clipped_s3.py index 0d0fc74d5..999f41413 100644 --- a/tests/test_general_contact_transient_clipped_s3.py +++ b/tests/test_general_contact_transient_clipped_s3.py @@ -11,13 +11,13 @@ import numpy as np import pytest from scipy.optimize import root -from anysolver import TransientConfig,solve_transient_contact -from anysolver.general_contact.s3_pressure_hermite_bounds import s3_pressure_hermite_bounds -from anysolver.matrix_assembly import assemble_stiffness_matrix -from anysolver.assembly import assemble_mass_matrix -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.general_contact.runtime import active_contact_manager -from anysolver.nonlinear_restart import model_configuration_fingerprint +from anyfesolver import TransientConfig,solve_transient_contact +from anyfesolver.general_contact.s3_pressure_hermite_bounds import s3_pressure_hermite_bounds +from anyfesolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.assembly import assemble_mass_matrix +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.runtime import active_contact_manager +from anyfesolver.nonlinear_restart import model_configuration_fingerprint from s3_von_karman_oracle import p1_von_karman_membrane demo=runpy.run_path(str(Path(__file__).parents[1]/'examples/general_contact_deforming_s3_impact_dev.py')) @@ -152,7 +152,7 @@ def jacobian(value): @pytest.mark.parametrize('columns',(1,8)) def test_clipped_structural_reference_matches_adopted_s3_von_karman(columns): - from anysolver.nonlinear_static import _assemble_nonlinear_system + from anyfesolver.nonlinear_static import _assemble_nonlinear_system model,_,modes=demo['build_model'](target_xy=TARGET_XY,source_columns=columns) xy,_,_,initial=layout(columns) K=modes.T@assemble_stiffness_matrix(model)[0]@modes diff --git a/tests/test_general_contact_transient_constraint_reactions.py b/tests/test_general_contact_transient_constraint_reactions.py index 1b10cd09c..332bcf4f1 100644 --- a/tests/test_general_contact_transient_constraint_reactions.py +++ b/tests/test_general_contact_transient_constraint_reactions.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver import (ContactTransientSolverControls, ContactNodalLoadHistory, +from anyfesolver import (ContactTransientSolverControls, ContactNodalLoadHistory, LoadCase, TransientConfig, solve_transient_contact) from test_general_contact_transient_plane import _guided_plate, _constant_q4_load diff --git a/tests/test_general_contact_transient_deforming_q4_planes.py b/tests/test_general_contact_transient_deforming_q4_planes.py index a3e818d18..30a27f759 100644 --- a/tests/test_general_contact_transient_deforming_q4_planes.py +++ b/tests/test_general_contact_transient_deforming_q4_planes.py @@ -6,10 +6,10 @@ import numpy as np import pytest from dataclasses import replace -from anysolver import TransientConfig,solve_transient_contact -from anysolver.assembly import assemble_mass_matrix -from anysolver.general_contact.core import ContactSolverSettings -from anysolver.general_contact.multiple_shell_planes import MultipleShellPlaneManager +from anyfesolver import TransientConfig,solve_transient_contact +from anyfesolver.assembly import assemble_mass_matrix +from anyfesolver.general_contact.core import ContactSolverSettings +from anyfesolver.general_contact.multiple_shell_planes import MultipleShellPlaneManager example=runpy.run_path(str(Path(__file__).parents[1]/'examples/general_contact_deforming_q4_planes_dev.py')) H,RHO,E,NU=.05,1.,1.e5,.3 @@ -92,7 +92,7 @@ def test_opposing_physical_skin_work_and_pressure_resolution_before_impact(): def reference(times): # Bounded independent Newton solves a strictly convex two-mode discrete work. - # No ANYsolver contact/material/geometry/equilibrium calls. + # No ANYfeSolver contact/material/geometry/equilibrium calls. q=np.zeros(2);v=np.array([.002,.05]);a=np.zeros(2) rows=[(q.copy(),v.copy(),a.copy())] for left,right in zip(times,times[1:]): diff --git a/tests/test_general_contact_transient_deforming_s3.py b/tests/test_general_contact_transient_deforming_s3.py index c21c12764..260e59c15 100644 --- a/tests/test_general_contact_transient_deforming_s3.py +++ b/tests/test_general_contact_transient_deforming_s3.py @@ -13,14 +13,14 @@ import pytest from scipy.optimize import root from scipy.integrate import solve_ivp -from anysolver import TransientConfig, ContactTransientSolverControls, solve_transient_contact -from anysolver.assembly import assemble_mass_matrix -from anysolver.matrix_assembly import assemble_stiffness_matrix -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.general_contact.normal_s3_skin_path import prepare_normal_s3_skin_path -from anysolver.general_contact.shell_pair_hermite_sweep import shell_pair_hermite_lower -from anysolver.general_contact.runtime import active_contact_manager -from anysolver.nonlinear_restart import analysis_configuration_fingerprint, model_configuration_fingerprint +from anyfesolver import TransientConfig, ContactTransientSolverControls, solve_transient_contact +from anyfesolver.assembly import assemble_mass_matrix +from anyfesolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.normal_s3_skin_path import prepare_normal_s3_skin_path +from anyfesolver.general_contact.shell_pair_hermite_sweep import shell_pair_hermite_lower +from anyfesolver.general_contact.runtime import active_contact_manager +from anyfesolver.nonlinear_restart import analysis_configuration_fingerprint, model_configuration_fingerprint example = runpy.run_path(str(Path(__file__).parents[1]/'examples/general_contact_nonuniform_s3_impact_dev.py')) GAP,KN,SUPPORT = (example[key] for key in ('GAP','KN','SUPPORT')) @@ -116,7 +116,7 @@ def test_actual_source_deformation_has_independent_pressure_work_and_tangent(q): np.testing.assert_allclose(np.array(result.integration_moment)+result.target_moment,0.,atol=1.e-7) path.require_motion(modes@q) with pytest.raises(ValueError,match='uniform'): - from anysolver.general_contact.fixed_projection_s3_events import prepare_fixed_projection_s3_events + from anyfesolver.general_contact.fixed_projection_s3_events import prepare_fixed_projection_s3_events prepare_fixed_projection_s3_events(model,manager,modes) @@ -317,7 +317,7 @@ def test_normal_v15_active_restart_binds_method_features_and_physical_budgets(): def test_normal_unresolved_matched_physical_proof_cuts_back_before_commit(monkeypatch): - from anysolver.general_contact import normal_s3_skin_path as module + from anyfesolver.general_contact import normal_s3_skin_path as module original = module.NormalS3SkinPath.overlap_sweep calls = 0 def failed(self,*args,**kwargs): @@ -348,7 +348,7 @@ def test_normal_v15_open_restart_continues_after_contact_release(): def test_normal_unresolved_pressure_proof_cuts_back_before_commit(monkeypatch): - from anysolver.general_contact import normal_s3_skin_path as module + from anyfesolver.general_contact import normal_s3_skin_path as module original=module.NormalS3SkinPath.pressure_sweep calls=0 def failed(self,*args,**kwargs): @@ -366,7 +366,7 @@ def failed(self,*args,**kwargs): def test_normal_cutback_reports_rejected_endpoint_and_stage_work(monkeypatch): - from anysolver.general_contact import normal_s3_skin_path as module + from anyfesolver.general_contact import normal_s3_skin_path as module original=module.NormalS3SkinPath.pressure_sweep injected=False def failed(self,manager,start,end,v0,v1,dt,**kwargs): @@ -388,8 +388,8 @@ def failed(self,manager,start,end,v0,v1,dt,**kwargs): def test_normal_pressure_proof_cancellation_restores_context(monkeypatch): - from anysolver.control import CancellationToken,SolveCancelled - from anysolver.general_contact import normal_s3_skin_path as module + from anyfesolver.control import CancellationToken,SolveCancelled + from anyfesolver.general_contact import normal_s3_skin_path as module token=CancellationToken() original=module.NormalS3SkinPath.pressure_sweep def cancelled(self,*args,**kwargs): @@ -441,8 +441,8 @@ def test_event_tolerance_refinement_improves_localized_energy_balance(): def test_normal_cancellation_inside_physical_proof_restores_model_and_owner(monkeypatch): - from anysolver.control import CancellationToken,SolveCancelled - from anysolver.general_contact import normal_s3_skin_path as module + from anyfesolver.control import CancellationToken,SolveCancelled + from anyfesolver.general_contact import normal_s3_skin_path as module model,definition,modes = build() fingerprint = model_configuration_fingerprint(model) token = CancellationToken();original = module.s3_overlap_hermite_gap_bounds diff --git a/tests/test_general_contact_transient_free_shell_sphere.py b/tests/test_general_contact_transient_free_shell_sphere.py index e2ded8e4c..3f7bca959 100644 --- a/tests/test_general_contact_transient_free_shell_sphere.py +++ b/tests/test_general_contact_transient_free_shell_sphere.py @@ -4,13 +4,13 @@ import numpy as np import pytest -from anysolver import (BoundaryCondition,ContactDefinition,ContactSurface,ContactInteraction, +from anyfesolver import (BoundaryCondition,ContactDefinition,ContactSurface,ContactInteraction, ContactSolverSettings,RigidContactBody,FEModel,LoadCase,create_shell_element) -from anysolver.dynamics import TransientConfig -from anysolver.general_contact.free_rigid import (ContactFreeRigidBody,_FreeSphereManager, +from anyfesolver.dynamics import TransientConfig +from anyfesolver.general_contact.free_rigid import (ContactFreeRigidBody,_FreeSphereManager, FREE_SHELL_SPHERE_PROFILE,FREE_SHELL_SPHERE_HISTORY_PROFILE) -from anysolver.general_contact.sphere import _SphereShellManager -from anysolver.general_contact.transient import (ContactNodalLoadHistory, +from anyfesolver.general_contact.sphere import _SphereShellManager +from anyfesolver.general_contact.transient import (ContactNodalLoadHistory, ContactTransientSolverControls,solve_transient_contact) @@ -98,8 +98,8 @@ def test_free_shell_sphere_opt_in_and_constraint_admission(): def test_selected_side_is_checked_over_entire_path_even_when_sphere_is_distant(): - from anysolver.general_contact.transient import _free_shell_sphere_path_on_selected_side - from anysolver.general_contact.shell_sphere_temporal_bounds import q4_sphere_hermite_gap_bounds + from anyfesolver.general_contact.transient import _free_shell_sphere_path_on_selected_side + from anyfesolver.general_contact.shell_sphere_temporal_bounds import q4_sphere_hermite_gap_bounds model,definition,settings=model_data() definition=replace(definition, surfaces=(replace(definition.surfaces[0],side='top'),), @@ -121,15 +121,15 @@ def test_selected_side_is_checked_over_entire_path_even_when_sphere_is_distant() v0[2:24:6]=3.;v1[2:24:6]=-3. positive,splits=_free_shell_sphere_path_on_selected_side(owner,q,q,v0,v1,1.,128,lambda *_:None) assert positive and splits>0 - from anysolver.general_contact.beam_temporal_bounds import BeamHermiteGapBoundsError + from anyfesolver.general_contact.beam_temporal_bounds import BeamHermiteGapBoundsError with pytest.raises(BeamHermiteGapBoundsError,match='selected-side'): _free_shell_sphere_path_on_selected_side(owner,q,q,v0,v1,1.,0,lambda *_:None) def test_constraint_admission_checks_each_reduced_direction_and_rotated_normal(): from scipy import sparse - from anysolver.assembly import build_constraint_transformation - from anysolver.general_contact.transient import _admit_free_shell_coordinates + from anyfesolver.assembly import build_constraint_transformation + from anyfesolver.general_contact.transient import _admit_free_shell_coordinates model,_,_=model_data() model.boundary_conditions.clear() model.add_boundary_condition(BoundaryCondition('bad',[1,2,3,4], @@ -342,8 +342,8 @@ def test_coupled_q4_sphere_impact_keeps_both_body_momentum_and_restart(tmp_path) @pytest.mark.parametrize('cancel',(False,True)) def test_free_shell_sphere_trial_exception_keeps_definition_and_model_reusable(monkeypatch,cancel): - from anysolver.general_contact.core import active_contact_manager - from anysolver.control import CancellationToken,SolveCancelled + from anyfesolver.general_contact.core import active_contact_manager + from anyfesolver.control import CancellationToken,SolveCancelled token=CancellationToken() model,definition,settings=model_data() initial=np.zeros(model.mesh.dof_manager.total_dofs) diff --git a/tests/test_general_contact_transient_free_sphere.py b/tests/test_general_contact_transient_free_sphere.py index ec8f22665..049b4374f 100644 --- a/tests/test_general_contact_transient_free_sphere.py +++ b/tests/test_general_contact_transient_free_sphere.py @@ -5,15 +5,15 @@ import numpy as np import pytest -from anysolver import (BoundaryCondition, ContactDefinition, ContactInteraction, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, RigidContactBody, LoadCase) -from anysolver.dynamics import TransientConfig -from anysolver.elements import BeamElement, QuadraticBeamElement -from anysolver.fe_core import FEModel -from anysolver.general_contact.beam_radial import _BeamRadialManager -from anysolver.general_contact.core import active_contact_manager -from anysolver.general_contact.free_rigid import ContactFreeRigidBody, _FreeSphereManager -from anysolver.general_contact.transient import ContactNodalLoadHistory, ContactTransientSolverControls, solve_transient_contact +from anyfesolver.dynamics import TransientConfig +from anyfesolver.elements import BeamElement, QuadraticBeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.beam_radial import _BeamRadialManager +from anyfesolver.general_contact.core import active_contact_manager +from anyfesolver.general_contact.free_rigid import ContactFreeRigidBody, _FreeSphereManager +from anyfesolver.general_contact.transient import ContactNodalLoadHistory, ContactTransientSolverControls, solve_transient_contact CONTROLS = ContactTransientSolverControls(allow_classical_beam_dev=True, @@ -152,7 +152,7 @@ def test_complete_coupled_virtual_work_tangent_and_centre_wrench(quadratic): def test_active_restart_binds_inertia_spin_and_named_state(): import copy - from anysolver.nonlinear_restart import analysis_configuration_fingerprint + from anyfesolver.nonlinear_restart import analysis_configuration_fingerprint _, direct = impact() _, prefix = impact(end=.014, emit=True) assert prefix.restart_checkpoint['version'] == 6 @@ -239,8 +239,8 @@ def test_free_sphere_nodal_history_and_work_survive_active_restart(): @pytest.mark.parametrize('cancel', [False, True]) def test_free_body_candidate_failure_does_not_commit(monkeypatch, cancel): - import anysolver.general_contact.transient as driver - from anysolver.control import CancellationToken, SolveCancelled + import anyfesolver.general_contact.transient as driver + from anyfesolver.control import CancellationToken, SolveCancelled token = CancellationToken() commits, calls = [], [] commit, evaluate = driver.commit_state_candidate, _FreeSphereManager.evaluate diff --git a/tests/test_general_contact_transient_guided_shell_pair.py b/tests/test_general_contact_transient_guided_shell_pair.py index 72c3440b8..2e60aaa5d 100644 --- a/tests/test_general_contact_transient_guided_shell_pair.py +++ b/tests/test_general_contact_transient_guided_shell_pair.py @@ -5,12 +5,12 @@ import json,os,runpy import numpy as np import pytest -from anysolver import ContactTransientSolverControls,TransientConfig,solve_transient_contact -from anysolver.assembly import assemble_mass_matrix -from anysolver.general_contact.core import ContactSolverSettings -from anysolver.general_contact.pair import _PlanarShellPairManager -from anysolver.general_contact.runtime import active_contact_manager -from anysolver.nonlinear_restart import analysis_configuration_fingerprint +from anyfesolver import ContactTransientSolverControls,TransientConfig,solve_transient_contact +from anyfesolver.assembly import assemble_mass_matrix +from anyfesolver.general_contact.core import ContactSolverSettings +from anyfesolver.general_contact.pair import _PlanarShellPairManager +from anyfesolver.general_contact.runtime import active_contact_manager +from anyfesolver.nonlinear_restart import analysis_configuration_fingerprint example=runpy.run_path(str(Path(__file__).parents[1]/'examples/general_contact_guided_shell_pair_impact_dev.py')) MASS=np.diag([20.,14.4]);GAP=.0002;KN=3.e8;D=np.array([1.,-1.]) @@ -185,9 +185,9 @@ def test_pair_default_and_invalid_motion_rejected_before_integration(): def test_pair_public_cancellation_retains_model_and_no_partial_checkpoint(monkeypatch): - from anysolver.control import CancellationToken,SolveCancelled + from anyfesolver.control import CancellationToken,SolveCancelled model,definition,modes=example['build_model']() - from anysolver.nonlinear_restart import model_configuration_fingerprint + from anyfesolver.nonlinear_restart import model_configuration_fingerprint fingerprint=model_configuration_fingerprint(model) token=CancellationToken();calls=0 original=_PlanarShellPairManager.evaluate diff --git a/tests/test_general_contact_transient_multiple_beam_planes.py b/tests/test_general_contact_transient_multiple_beam_planes.py index d56ad97c5..0aa550ce5 100644 --- a/tests/test_general_contact_transient_multiple_beam_planes.py +++ b/tests/test_general_contact_transient_multiple_beam_planes.py @@ -4,14 +4,14 @@ import numpy as np import pytest -from anysolver import (BoundaryCondition, ContactDefinition, ContactInteraction, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, LoadCase, RigidContactBody) -from anysolver.dynamics import TransientConfig -from anysolver.elements import BeamElement, QuadraticBeamElement -from anysolver.fe_core import FEModel -from anysolver.general_contact.core import active_contact_manager -from anysolver.general_contact.multiple_beam_rigid import MultipleBeamRigidManager -from anysolver.general_contact.transient import ( +from anyfesolver.dynamics import TransientConfig +from anyfesolver.elements import BeamElement, QuadraticBeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.core import active_contact_manager +from anyfesolver.general_contact.multiple_beam_rigid import MultipleBeamRigidManager +from anyfesolver.general_contact.transient import ( ContactNodalLoadHistory, ContactTransientSolverControls, _beam_complete_path_gaps, solve_transient_contact, ) @@ -121,7 +121,7 @@ def test_multiple_active_history_restart_order_and_definition_binding(): def test_multiple_path_uses_pair_budgets_and_one_shared_split_cap(): - from anysolver.general_contact.beam_temporal_bounds import beam_hermite_gap_bounds, BeamHermiteGapBoundsError + from anyfesolver.general_contact.beam_temporal_bounds import beam_hermite_gap_bounds, BeamHermiteGapBoundsError model, definition, settings, initial = fixture(orthogonal=True, quadratic=True) definition = replace(definition, interactions=(replace(definition.interactions[0], gap_tolerance=.001), definition.interactions[1])) @@ -171,9 +171,9 @@ def test_multiple_admission_opt_in_duplicate_and_nonplane_rejection(): @pytest.mark.parametrize("cancel", [False, True]) def test_second_pair_path_failure_does_not_commit_partial_candidate(monkeypatch, cancel): - import anysolver.general_contact.transient as driver - import anysolver.general_contact.beam_temporal_bounds as geometry - from anysolver.control import CancellationToken, SolveCancelled + import anyfesolver.general_contact.transient as driver + import anyfesolver.general_contact.beam_temporal_bounds as geometry + from anyfesolver.control import CancellationToken, SolveCancelled token = CancellationToken() commits, calls = [], [] commit, bounds = driver.commit_state_candidate, geometry.beam_hermite_gap_bounds diff --git a/tests/test_general_contact_transient_multiple_shell_planes.py b/tests/test_general_contact_transient_multiple_shell_planes.py index 9f12b98cb..05bf7be9a 100644 --- a/tests/test_general_contact_transient_multiple_shell_planes.py +++ b/tests/test_general_contact_transient_multiple_shell_planes.py @@ -9,11 +9,11 @@ import numpy as np import pytest -from anysolver import (ContactNodalLoadHistory, ContactTransientSolverControls, LoadCase, +from anyfesolver import (ContactNodalLoadHistory, ContactTransientSolverControls, LoadCase, TransientConfig, solve_transient_contact) -from anysolver.assembly import assemble_mass_matrix -from anysolver.nonlinear_restart import analysis_configuration_fingerprint -from anysolver.general_contact.transient import _multiple_shell_plane_path_gaps +from anyfesolver.assembly import assemble_mass_matrix +from anyfesolver.nonlinear_restart import analysis_configuration_fingerprint +from anyfesolver.general_contact.transient import _multiple_shell_plane_path_gaps example=runpy.run_path(str(Path(__file__).parents[1]/'examples/general_contact_multiple_q4_planes_dev.py')) D=np.array([[1.,0.],[0.,1.],[.5,.5]]) diff --git a/tests/test_general_contact_transient_nonuniform_s3.py b/tests/test_general_contact_transient_nonuniform_s3.py index e513aa115..fc5813d56 100644 --- a/tests/test_general_contact_transient_nonuniform_s3.py +++ b/tests/test_general_contact_transient_nonuniform_s3.py @@ -12,12 +12,12 @@ import runpy import numpy as np import pytest -from anysolver import ContactTransientSolverControls, TransientConfig, solve_transient_contact -from anysolver.assembly import assemble_mass_matrix -from anysolver.matrix_assembly import assemble_stiffness_matrix -from anysolver.general_contact.runtime import active_contact_manager -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.nonlinear_restart import analysis_configuration_fingerprint, model_configuration_fingerprint +from anyfesolver import ContactTransientSolverControls, TransientConfig, solve_transient_contact +from anyfesolver.assembly import assemble_mass_matrix +from anyfesolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.general_contact.runtime import active_contact_manager +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.nonlinear_restart import analysis_configuration_fingerprint, model_configuration_fingerprint example = runpy.run_path(str(Path(__file__).parents[1]/'examples/general_contact_nonuniform_s3_impact_dev.py')) MASS, B, SUPPORT, KN, GAP = (example[key] for key in ('MASS','B','SUPPORT','KN','GAP')) @@ -221,7 +221,7 @@ def test_nonuniform_default_and_unrepresented_source_motion_rejected(): @pytest.mark.parametrize('failure',('cancel','exception')) def test_nonuniform_rejected_candidate_cleans_owner_without_partial_checkpoint(monkeypatch,failure): - from anysolver.control import CancellationToken,SolveCancelled + from anyfesolver.control import CancellationToken,SolveCancelled model,definition,modes = example['build_model']() fingerprint = model_configuration_fingerprint(model) token = CancellationToken(); calls = 0 @@ -249,7 +249,7 @@ def injected(manager,*args,**kwargs): def test_unresolved_physical_sweep_cuts_back_before_acceptance(monkeypatch): - from anysolver.general_contact import shell_pair_hermite_sweep as module + from anyfesolver.general_contact import shell_pair_hermite_sweep as module original = module.shell_pair_hermite_lower calls = 0 def bounded_failure(*args,**kwargs): @@ -270,8 +270,8 @@ def bounded_failure(*args,**kwargs): def test_cancellation_inside_physical_sweep_restores_owner(monkeypatch): - from anysolver.control import CancellationToken,SolveCancelled - from anysolver.general_contact import shell_pair_hermite_sweep as module + from anyfesolver.control import CancellationToken,SolveCancelled + from anyfesolver.general_contact import shell_pair_hermite_sweep as module model,definition,modes = example['build_model']() fingerprint = model_configuration_fingerprint(model) token = CancellationToken() diff --git a/tests/test_general_contact_transient_oblique_q4_plastic.py b/tests/test_general_contact_transient_oblique_q4_plastic.py index c6721acd9..b9ee26dd8 100644 --- a/tests/test_general_contact_transient_oblique_q4_plastic.py +++ b/tests/test_general_contact_transient_oblique_q4_plastic.py @@ -12,9 +12,9 @@ import numpy as np import pytest -from anysolver.assembly import assemble_mass_matrix -from anysolver import ContactTransientSolverControls, TransientConfig, solve_transient_contact -from anysolver.general_contact.core import ContactSolverSettings,_PlanarQ4PlaneManager +from anyfesolver.assembly import assemble_mass_matrix +from anyfesolver import ContactTransientSolverControls, TransientConfig, solve_transient_contact +from anyfesolver.general_contact.core import ContactSolverSettings,_PlanarQ4PlaneManager example=runpy.run_path(str(Path(__file__).parents[1]/'examples/general_contact_q4_oblique_plastic_impact_dev.py')) E,NU,H,RHO=1.e9,.3,.05,1.e4 diff --git a/tests/test_general_contact_transient_plane.py b/tests/test_general_contact_transient_plane.py index 2967442dc..e1a4b0da0 100644 --- a/tests/test_general_contact_transient_plane.py +++ b/tests/test_general_contact_transient_plane.py @@ -7,7 +7,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, @@ -21,15 +21,15 @@ create_shell_element, solve_transient_contact, ) -from anysolver.fe_core import FEModel -from anysolver.algebraic_dynamics import build_declared_algebraic_basis -from anysolver.assembly import assemble_mass_matrix, build_constraint_transformation -from anysolver.matrix_assembly import assemble_load_vector, assemble_stiffness_matrix -from anysolver.nonlinear_static import _assemble_nonlinear_system -from anysolver.general_contact.core import ( +from anyfesolver.fe_core import FEModel +from anyfesolver.algebraic_dynamics import build_declared_algebraic_basis +from anyfesolver.assembly import assemble_mass_matrix, build_constraint_transformation +from anyfesolver.matrix_assembly import assemble_load_vector, assemble_stiffness_matrix +from anyfesolver.nonlinear_static import _assemble_nonlinear_system +from anyfesolver.general_contact.core import ( _PlanarQ4PlaneManager, active_contact_manager, contact_scope, ) -from anysolver.general_contact.transient import _minimum_hermite_gap +from anyfesolver.general_contact.transient import _minimum_hermite_gap def _guided_plate(): diff --git a/tests/test_general_contact_transient_plane_events.py b/tests/test_general_contact_transient_plane_events.py index 205c89b07..bc2fd9972 100644 --- a/tests/test_general_contact_transient_plane_events.py +++ b/tests/test_general_contact_transient_plane_events.py @@ -5,9 +5,9 @@ import numpy as np import pytest -from anysolver.dynamics import TransientConfig -from anysolver.general_contact.transient import ContactTransientSolverControls,solve_transient_contact -from anysolver.nonlinear_restart import analysis_configuration_fingerprint +from anyfesolver.dynamics import TransientConfig +from anyfesolver.general_contact.transient import ContactTransientSolverControls,solve_transient_contact +from anyfesolver.nonlinear_restart import analysis_configuration_fingerprint from test_general_contact_transient_plane import _guided_plate from test_general_contact_transient_q4_plastic import (CONTROLS as PLASTIC_CONTROLS, run as plastic_run,physical,scalar_reference) @@ -66,8 +66,8 @@ def test_plane_event_budget_exhaustion_is_explicit_and_profile_is_opt_in(): def test_failed_endpoint_query_counts_and_cutback_preserves_equilibrium(monkeypatch): - import anysolver.general_contact.plane_newmark_events as events - from anysolver.general_contact.event_subdivision import EventNeedsCutback + import anyfesolver.general_contact.plane_newmark_events as events + from anyfesolver.general_contact.event_subdivision import EventNeedsCutback original=events.localize_endpoint_event attempts=0 failed=False @@ -98,10 +98,10 @@ def test_arbitrary_end_truncation_cannot_emit_event_checkpoint(end): def test_cancellation_in_event_family_after_yield_preserves_reusable_model(monkeypatch): - from anysolver.control import CancellationToken,SolveCancelled - from anysolver.general_contact.core import active_contact_manager - import anysolver.general_contact.q4_material_checkpoint as codec - import anysolver.general_contact.plane_newmark_events as events + from anyfesolver.control import CancellationToken,SolveCancelled + from anyfesolver.general_contact.core import active_contact_manager + import anyfesolver.general_contact.q4_material_checkpoint as codec + import anyfesolver.general_contact.plane_newmark_events as events from test_general_contact_transient_q4_plastic import fixture model,_,_,modes,definition=fixture() controls=replace(PLASTIC_CONTROLS,q4_plane_event_subdivision_dev=True) diff --git a/tests/test_general_contact_transient_q4_plastic.py b/tests/test_general_contact_transient_q4_plastic.py index 3e1910988..58073084e 100644 --- a/tests/test_general_contact_transient_q4_plastic.py +++ b/tests/test_general_contact_transient_q4_plastic.py @@ -10,15 +10,15 @@ import numpy as np import pytest -from anysolver import (BoundaryCondition, ContactDefinition, ContactInteraction, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactInteraction, ContactSurface, RigidContactBody, create_shell_element) -from anysolver.assembly import assemble_mass_matrix -from anysolver.dynamics import TransientConfig -from anysolver.fe_core import FEModel -from anysolver.general_contact.core import active_contact_manager -from anysolver.general_contact.transient import ContactTransientSolverControls, solve_transient_contact -from anysolver.material_curves import DNVC208MaterialCurve -from anysolver.nonlinear_restart import analysis_configuration_fingerprint +from anyfesolver.assembly import assemble_mass_matrix +from anyfesolver.dynamics import TransientConfig +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.core import active_contact_manager +from anyfesolver.general_contact.transient import ContactTransientSolverControls, solve_transient_contact +from anyfesolver.material_curves import DNVC208MaterialCurve +from anyfesolver.nonlinear_restart import analysis_configuration_fingerprint E, NU, H, RHO = 1.e5, .3, .05, 1. G, YIELD, KN, GAP = E/(2*(1+NU)), 20., 4.e7, .0008 @@ -171,10 +171,10 @@ def test_yielded_active_restart_preserves_return_map_origin_and_settings(complet @pytest.mark.parametrize('cancel',[False,True]) def test_failure_after_yield_leaves_model_and_contact_context_reusable(monkeypatch,cancel): - from anysolver.control import CancellationToken,SolveCancelled + from anyfesolver.control import CancellationToken,SolveCancelled model,_,_,modes,definition=fixture() token=CancellationToken() - import anysolver.general_contact.q4_material_checkpoint as codec + import anyfesolver.general_contact.q4_material_checkpoint as codec prepare=codec.prepare_q4_material_checkpoint observed=[] def fail_after_yield(model,full,states,**kwargs): @@ -203,8 +203,8 @@ def solve(): def test_cutback_from_yielded_parent_preserves_material_history(monkeypatch): - import anysolver.general_contact.transient as driver - import anysolver.general_contact.q4_material_checkpoint as codec + import anyfesolver.general_contact.transient as driver + import anyfesolver.general_contact.q4_material_checkpoint as codec prepare=codec.prepare_q4_material_checkpoint bounds=driver._minimum_hermite_gap yielded,rejected=False,False @@ -236,8 +236,8 @@ def reject_one(*args,**kwargs): ('tool_work_relative_tolerance',2e-8),('maximum_tool_work_subdivisions',65)]) def test_existing_moving_tool_restart_still_binds_work_controls(name,value): from types import SimpleNamespace - from anysolver.general_contact.rigid_translation import ContactRigidTranslationHistory - from anysolver.general_contact.transient import _restart_analysis_contract + from anyfesolver.general_contact.rigid_translation import ContactRigidTranslationHistory + from anyfesolver.general_contact.transient import _restart_analysis_contract tool=ContactRigidTranslationHistory('plane',((0.,0.,0.,0.),(.1,0.,0.,.01))) manager=SimpleNamespace(restart_contract=lambda:{'fixture':'existing-plane'}) transient=TransientConfig(.001,.1,initial_velocity=np.zeros(1)) @@ -251,9 +251,9 @@ def contract(selection): def test_plastic_profile_requires_explicit_supported_material_and_controls(): - from anysolver.general_contact.transient import _admit - from anysolver.general_contact.core import ContactSolverSettings - from anysolver.material_curves import LinearHardeningCurve + from anyfesolver.general_contact.transient import _admit + from anyfesolver.general_contact.core import ContactSolverSettings + from anyfesolver.material_curves import LinearHardeningCurve model,material,_,_,definition=fixture() with pytest.raises(ValueError,match='only isotropic elastic'): _admit(model,definition,ContactSolverSettings(),ContactTransientSolverControls()) diff --git a/tests/test_general_contact_transient_results_archive.py b/tests/test_general_contact_transient_results_archive.py index 2ee8ac99c..2b360150d 100644 --- a/tests/test_general_contact_transient_results_archive.py +++ b/tests/test_general_contact_transient_results_archive.py @@ -4,10 +4,10 @@ from pathlib import Path import numpy as np import pytest -from anysolver.general_contact import (TransientContactResults,ContactResults, +from anyfesolver.general_contact import (TransientContactResults,ContactResults, TransientContactArchiveError as Error,serialize_transient_contact_results as serialize, read_transient_contact_results as read) -from anysolver.general_contact.transient_results_archive import CONVENTIONS,MAX_BYTES,_types +from anyfesolver.general_contact.transient_results_archive import CONVENTIONS,MAX_BYTES,_types def sample(): @@ -79,7 +79,7 @@ def test_refusal_schema_integrity_dimensions_duplicates_and_resources(): def test_free_body_and_contact_variant_record_inventory(): - from anysolver.general_contact.free_rigid import FreeRigidBodyState + from anyfesolver.general_contact.free_rigid import FreeRigidBodyState state=FreeRigidBodyState((0.,0.,0.),(1.,0.,0.),(0.,0.,0.), ((1.,0.,0.),(0.,1.,0.),(0.,0.,1.)),(0.,0.,0.),(0.,0.,0.),.5,(1.,0.,0.),(0.,0.,0.)) value=replace(sample(),free_rigid_bodies=({'sphere':state},{'sphere':state})) @@ -127,7 +127,7 @@ def test_public_plane_impact_archive_release_reactions_and_restart_payload(): def variant_records(): - from anysolver.general_contact.transient import (_PairResults,_PatchResults,_BeamPlaneResults, + from anyfesolver.general_contact.transient import (_PairResults,_PatchResults,_BeamPlaneResults, _RadialResults,MultipleBeamRigidResults,MultipleShellPlaneResults) def simple(cls): values={} @@ -156,7 +156,8 @@ def simple(cls): def test_every_contact_variant_exact_fields_summary_and_nested_pairs(index): original=variant_records()[index] decoded=read(serialize(replace(sample(),contact=(original,original)))).to_dict()['contact'][0] - assert decoded['record_type']==type(original).__module__+'.'+type(original).__qualname__ + module = type(original).__module__.replace('anyfesolver.', 'anysolver.', 1) + assert decoded['record_type']==module+'.'+type(original).__qualname__ assert set(decoded['fields'])=={f.name for f in fields(original)} assert decoded['summary']==original.to_dict() for f in fields(original): @@ -170,8 +171,8 @@ def test_every_contact_variant_exact_fields_summary_and_nested_pairs(index): def test_preflight_before_summary_clone_and_unknown_deepcopy(monkeypatch): - from anysolver.general_contact.transient import _PatchResults - from anysolver.nonlinear_state import NonlinearStateStore + from anyfesolver.general_contact.transient import _PatchResults + from anyfesolver.nonlinear_state import NonlinearStateStore patch=next(x for x in variant_records() if type(x) is _PatchResults) patch=replace(patch,reference_support_m2=np.zeros(2_000_001)) monkeypatch.setattr(_PatchResults,'to_dict',lambda self:pytest.fail('summary ran before oversized fields refused')) @@ -194,7 +195,7 @@ def test_record_scalar_pressure_roles_and_astral_preflight(monkeypatch): ('active_pressure_dofs',1.),('gap_tolerance_met',1)): malformed=replace(sample().contact[0],**{field:value}) with pytest.raises(Error):serialize(replace(sample(),contact=(malformed,malformed))) - from anysolver.general_contact.transient import _PatchResults + from anyfesolver.general_contact.transient import _PatchResults patch=next(x for x in variant_records() if type(x) is _PatchResults) for field in ('numerical_pressure_pa','reference_support_m2','normalized_weighted_gap_m'): malformed=replace(patch,**{field:('not-a-number',)}) @@ -202,7 +203,7 @@ def test_record_scalar_pressure_roles_and_astral_preflight(monkeypatch): valid=replace(sample().contact[0],penalty_energy=np.float64(-.0), active_pressure_dofs=np.int64(0),gap_tolerance_met=np.bool_(True)) assert read(serialize(replace(sample(),contact=(valid,valid)))).to_dict()['contact'][0]['fields']['gap_tolerance_met'] - import anysolver.general_contact.transient_results_archive as codec + import anyfesolver.general_contact.transient_results_archive as codec monkeypatch.setattr(codec,'_canonical',lambda x:pytest.fail('canonical allocation before oversized Unicode refusal')) with pytest.raises(Error):serialize(replace(sample(),profile='\U0001f600'*1000),max_bytes=10_000) with pytest.raises(Error):codec._encode('\U0001f600'*1000,codec._Budget(11_000),{}) diff --git a/tests/test_general_contact_transient_rigid_translation.py b/tests/test_general_contact_transient_rigid_translation.py index cabbee0ab..4af87e02c 100644 --- a/tests/test_general_contact_transient_rigid_translation.py +++ b/tests/test_general_contact_transient_rigid_translation.py @@ -4,12 +4,12 @@ import numpy as np import pytest -from anysolver import BoundaryCondition, LoadCase -from anysolver.dynamics import TransientConfig -from anysolver.general_contact.beam_plane import _BeamPlaneManager -from anysolver.general_contact.core import active_contact_manager -from anysolver.general_contact.rigid_translation import ContactRigidTranslationHistory, _PlaneTranslations -from anysolver.general_contact.transient import ( +from anyfesolver import BoundaryCondition, LoadCase +from anyfesolver.dynamics import TransientConfig +from anyfesolver.general_contact.beam_plane import _BeamPlaneManager +from anyfesolver.general_contact.core import active_contact_manager +from anyfesolver.general_contact.rigid_translation import ContactRigidTranslationHistory, _PlaneTranslations +from anyfesolver.general_contact.transient import ( ContactNodalLoadHistory, ContactTransientSolverControls, solve_transient_contact, ) from test_general_contact_beam_plane import _model @@ -221,7 +221,7 @@ def test_deforming_b3_translation_preserves_normal_momentum_and_curved_gap(): def test_translation_admission_and_restart_history_binding(): import copy - from anysolver.nonlinear_restart import analysis_configuration_fingerprint + from anyfesolver.nonlinear_restart import analysis_configuration_fingerprint _, prefix, _ = impact(end=.0102, emit=True) with pytest.raises(ValueError, match="checkpoint analysis is incompatible"): impact(checkpoint=prefix.restart_checkpoint, @@ -243,7 +243,7 @@ def test_translation_admission_and_restart_history_binding(): def test_translating_plane_bounds_reproduce_relative_polynomial_extrema(): - from anysolver.general_contact.beam_temporal_bounds import beam_hermite_gap_bounds + from anyfesolver.general_contact.beam_temporal_bounds import beam_hermite_gap_bounds model, definition, settings = _model(quadratic=True) manager = _BeamPlaneManager(model, definition, settings) q0, q1, v0, v1 = [np.zeros(model.mesh.dof_manager.total_dofs) for _ in range(4)] @@ -303,8 +303,8 @@ def test_nearest_combined_knot_cannot_be_overridden_by_roundoff_snapping(near_te @pytest.mark.parametrize("cancel", [False, True]) def test_tool_work_failure_keeps_committed_state_and_cleans_scope(monkeypatch, cancel): - import anysolver.general_contact.transient as driver - from anysolver.control import CancellationToken, SolveCancelled + import anyfesolver.general_contact.transient as driver + from anyfesolver.control import CancellationToken, SolveCancelled token = CancellationToken() commits = [] commit = driver.commit_state_candidate diff --git a/tests/test_general_contact_transient_s3_history.py b/tests/test_general_contact_transient_s3_history.py index 00df1a01f..76731446b 100644 --- a/tests/test_general_contact_transient_s3_history.py +++ b/tests/test_general_contact_transient_s3_history.py @@ -5,15 +5,15 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( ContactNodalLoadHistory, ContactTransientSolverControls, LoadCase, TransientConfig, solve_transient_contact, ) -from anysolver.general_contact.core import active_contact_manager -from anysolver.algebraic_dynamics import build_declared_algebraic_basis -from anysolver.assembly import assemble_mass_matrix, build_constraint_transformation -from anysolver.matrix_assembly import assemble_stiffness_matrix -from anysolver.nonlinear_static import _assemble_nonlinear_system +from anyfesolver.general_contact.core import active_contact_manager +from anyfesolver.algebraic_dynamics import build_declared_algebraic_basis +from anyfesolver.assembly import assemble_mass_matrix, build_constraint_transformation +from anyfesolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.nonlinear_static import _assemble_nonlinear_system from test_general_contact_transient_plane import ( _guided_s3_descriptor_impact, _uniform_s3_normal_load, ) diff --git a/tests/test_general_contact_transient_s3_polygon.py b/tests/test_general_contact_transient_s3_polygon.py index 3d098821a..a9b8dc2da 100644 --- a/tests/test_general_contact_transient_s3_polygon.py +++ b/tests/test_general_contact_transient_s3_polygon.py @@ -4,10 +4,10 @@ import runpy import numpy as np import pytest -from anysolver import ContactTransientSolverControls -from anysolver.general_contact.normal_s3_skin_path import prepare_normal_s3_skin_path -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.general_contact.runtime import active_contact_manager +from anyfesolver import ContactTransientSolverControls +from anyfesolver.general_contact.normal_s3_skin_path import prepare_normal_s3_skin_path +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.runtime import active_contact_manager demo=runpy.run_path(str(Path(__file__).parents[1]/'examples/general_contact_deforming_s3_impact_dev.py')) CONTROLS=replace(demo['CONTROLS'],normal_s3_polygon_pressure_bounds_dev=True) @@ -37,7 +37,7 @@ def test_polygon_pressure_owner_retains_hidden_material_approach_guard(): def test_v16_active_restart_and_pressure_algorithm_identity(monkeypatch): - from anysolver.general_contact import normal_s3_skin_path as module + from anyfesolver.general_contact import normal_s3_skin_path as module original=module.NormalS3SkinPath.overlap_sweep;guards=[] def observed(self,*args,**kwargs): guards.append(kwargs['event_gap_tolerance_m']) diff --git a/tests/test_general_contact_triangle_mortar_energy.py b/tests/test_general_contact_triangle_mortar_energy.py index 7e26a4474..4dc7c8d76 100644 --- a/tests/test_general_contact_triangle_mortar_energy.py +++ b/tests/test_general_contact_triangle_mortar_energy.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver.general_contact.triangle_mortar_energy import ( +from anyfesolver.general_contact.triangle_mortar_energy import ( MovingS3PrimalMortarPenalty, ) diff --git a/tests/test_general_contact_triangle_pair_energy.py b/tests/test_general_contact_triangle_pair_energy.py index c444d0851..337977b71 100644 --- a/tests/test_general_contact_triangle_pair_energy.py +++ b/tests/test_general_contact_triangle_pair_energy.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver.general_contact.triangle_pair_energy import MovingS3PairPenalty +from anyfesolver.general_contact.triangle_pair_energy import MovingS3PairPenalty _SOURCE = np.array(((0.4, 0.2, 0.02), (0.9, 0.2, 0.02), diff --git a/tests/test_general_contact_triangulated_rigid.py b/tests/test_general_contact_triangulated_rigid.py index ea9760ea2..874e62d8b 100644 --- a/tests/test_general_contact_triangulated_rigid.py +++ b/tests/test_general_contact_triangulated_rigid.py @@ -5,9 +5,9 @@ import numpy as np import pytest from examples.general_contact_triangulated_rigid import case, analysis -from anysolver import (ContactPathProgram,ContactPathControl,LoadCase,solve_static_nonlinear,validate_general_contact) -from anysolver.general_contact import TriangulatedRigidContactBody -from anysolver.general_contact.triangulated_rigid_static import TriangulatedRigidManager +from anyfesolver import (ContactPathProgram,ContactPathControl,LoadCase,solve_static_nonlinear,validate_general_contact) +from anyfesolver.general_contact import TriangulatedRigidContactBody +from anyfesolver.general_contact.triangulated_rigid_static import TriangulatedRigidManager def test_complete_penalty_work_and_diagonal(): @@ -70,7 +70,7 @@ def test_finite_footprint_refusal_and_crossing(): def test_tilted_actual_path_and_normal_refusal(): - from anysolver.general_contact.s3_pair_static import _swept_gap_lower + from anyfesolver.general_contact.s3_pair_static import _swept_gap_lower model,definition,settings=case();manager=TriangulatedRigidManager(model,definition,settings) first=np.zeros(manager.n_dof);last=first.copy() last[model.mesh.dof_manager.get_node_dofs(2)[2]]=-4e-5 @@ -86,7 +86,7 @@ def test_tilted_actual_path_and_normal_refusal(): def test_ordinary_force_and_path_restart(monkeypatch): import importlib - solver=importlib.import_module('anysolver.nonlinear_static') + solver=importlib.import_module('anyfesolver.nonlinear_static') original=solver._support_reaction_resultants captured={} def reaction(model,imbalance,**kwargs): @@ -116,7 +116,7 @@ def reaction(model,imbalance,**kwargs): program=ContactPathProgram(controls=(ContactPathControl.node(2,'ux'),ContactPathControl.node(2,'uz')), waypoints=((0.,0.),(0.,-.00004),(0.,0.),(0.,-.00004)),steps_per_segment=1) # Remove the controlled ux from the guide, preserving all remaining constraints. - from anysolver import BoundaryCondition + from anyfesolver import BoundaryCondition model.boundary_conditions[0]=BoundaryCondition('guide',(1,2,3),{k:0. for k in ('uy','rx','ry','rz')}) model.add_boundary_condition(BoundaryCondition('xguide',(1,3),{'ux':0.})) common=dict(contact=definition,contact_settings=settings,contact_path_program=program,max_iterations=15) @@ -133,9 +133,9 @@ def reaction(model,imbalance,**kwargs): changed=replace(definition,rigid_bodies=(replace(definition.rigid_bodies[0],name='tool',vertices=((0.,0.,0.),(1.01,0.,0.),(1.,1.,0.),(0.,1.,0.))),)) with pytest.raises(ValueError): solve_static_nonlinear(model,restart_checkpoint=half.to_restart_checkpoint(),**{**common,'contact':changed}) - from anysolver.control import CancellationToken + from anyfesolver.control import CancellationToken token=CancellationToken();token.cancel('fixture cancellation') - from anysolver.control import SolveCancelled + from anyfesolver.control import SolveCancelled with pytest.raises(SolveCancelled): solve_static_nonlinear(model,cancellation_token=token,**common) if os.environ.get('TRIANGULATED_RIGID_RESULT'): diff --git a/tests/test_general_contact_triangulated_rigid_invariance.py b/tests/test_general_contact_triangulated_rigid_invariance.py index be25115f3..aa51ec3f5 100644 --- a/tests/test_general_contact_triangulated_rigid_invariance.py +++ b/tests/test_general_contact_triangulated_rigid_invariance.py @@ -6,12 +6,12 @@ import numpy as np -from anysolver import (BoundaryCondition, ContactDefinition, ContactInteraction, +from anyfesolver import (BoundaryCondition, ContactDefinition, ContactInteraction, ContactSurface, ContactSolverSettings, LoadCase, create_shell_element, solve_static_nonlinear) -from anysolver.fe_core import FEModel -from anysolver.general_contact import TriangulatedRigidContactBody -from anysolver.general_contact.triangulated_rigid_static import TriangulatedRigidManager +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact import TriangulatedRigidContactBody +from anyfesolver.general_contact.triangulated_rigid_static import TriangulatedRigidManager R = np.array(((0., 0., 1.), (1., 0., 0.), (0., 1., 0.))) SHIFT = np.array((1/8, -1/4, 1/2)) @@ -110,7 +110,7 @@ def test_connected_patch_reference_and_numbering_invariance(monkeypatch): mappings = [_map(baseline[0], entry[0], entry[3], entry[4]) for entry in variants] G = mappings[-1] from scipy import sparse - from anysolver.assembly import build_constraint_transformation + from anyfesolver.assembly import build_constraint_transformation charts = [] for model, *_ in variants: model.apply_boundary_conditions() @@ -119,7 +119,7 @@ def test_connected_patch_reference_and_numbering_invariance(monkeypatch): charts.append(T.toarray()) for mapping, chart in zip(mappings, charts): assert np.array_equal(chart@chart.T, mapping@charts[0]@charts[0].T@mapping.T) - solver = importlib.import_module('anysolver.nonlinear_static') + solver = importlib.import_module('anyfesolver.nonlinear_static') original_recovery = solver._support_reaction_resultants captured = {} def capture(owner, imbalance, **kwargs): diff --git a/tests/test_general_contact_triangulated_rigid_patch.py b/tests/test_general_contact_triangulated_rigid_patch.py index 76c506561..60296f313 100644 --- a/tests/test_general_contact_triangulated_rigid_patch.py +++ b/tests/test_general_contact_triangulated_rigid_patch.py @@ -6,9 +6,9 @@ import numpy as np import pytest from examples.general_contact_triangulated_rigid_patch import case,analysis -from anysolver import (BoundaryCondition,ContactPathControl,ContactPathProgram,solve_static_nonlinear) -from anysolver.matrix_assembly import assemble_stiffness_matrix -from anysolver.general_contact.triangulated_rigid_static import (TriangulatedRigidManager, +from anyfesolver import (BoundaryCondition,ContactPathControl,ContactPathProgram,solve_static_nonlinear) +from anyfesolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.general_contact.triangulated_rigid_static import (TriangulatedRigidManager, PATCH_PROFILE,_storage_guard,derivative_work_storage_bound,LOCAL_DERIVATIVE_WORK_LIMIT_BYTES,_source_overlap_guard) @@ -64,7 +64,7 @@ def test_patch_force_response_and_lifecycle_restart(monkeypatch): assert len(references)==1 reference,active,contact=references[0] import importlib - solver=importlib.import_module('anysolver.nonlinear_static');original=solver._support_reaction_resultants;captured={} + solver=importlib.import_module('anyfesolver.nonlinear_static');original=solver._support_reaction_resultants;captured={} def reaction(owner_model,imbalance,**kwargs): captured.update(model=owner_model,residual=np.array(imbalance,copy=True)) return original(owner_model,imbalance,**kwargs) diff --git a/tests/test_general_contact_two_body_mortar_reference.py b/tests/test_general_contact_two_body_mortar_reference.py index d3ff1b7c4..85e391feb 100644 --- a/tests/test_general_contact_two_body_mortar_reference.py +++ b/tests/test_general_contact_two_body_mortar_reference.py @@ -3,8 +3,8 @@ from pathlib import Path import numpy as np import pytest -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager -from anysolver.general_contact.semismooth import linearize +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.semismooth import linearize from examples.general_contact_tilted_relative_sliding import rotation,rigid_pose ROOT=Path(__file__).parents[1] @@ -122,7 +122,7 @@ def test_actual_loaded_pose_independent_work_and_bins(): @pytest.mark.skipif(not (RAW/'refined.json').is_file(), reason='archived mortar trace input MORTAR_EVIDENCE/refined.json absent: fixed-structure pressure-trace replay requires the original saved trace') def test_fixed_structure_pressure_trace_discriminator(): - from anysolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate + from anyfesolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate model,manager,program,meta,pose,q,z,provenance=posed(True) stored=json.loads((RAW/'refined.json').read_text());ref=stored['reference'];S=np.asarray(ref['support']);G=np.asarray(ref['gap_gradient']);spin=np.asarray(stored['spin_map']);chart=np.asarray(stored['chart_map']) free,_=old.selectors(model,program) @@ -185,7 +185,7 @@ def test_fixed_structure_pressure_trace_discriminator(): @pytest.mark.skipif(not BASE.is_file(), reason='archived mortar pose input contact_tilted_relative_sliding_20261008/outputs/v3/run-14.json absent: loaded directional-tangent replay requires the original saved pose') def test_independent_loaded_directional_tangent(): - from anysolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate + from anyfesolver.nonlinear_static import _assemble_nonlinear_system,_discard_nonlinear_state_candidate model,manager,program,meta,pose,q,z,provenance=posed(False) free,_=old.selectors(model,program);rng=np.random.default_rng(601420) dq=np.zeros(len(q));dq[free]=rng.normal(size=len(free));dq/=np.linalg.norm(dq) diff --git a/tests/test_general_contact_warped_q4_patch.py b/tests/test_general_contact_warped_q4_patch.py index 9f00b92f1..d5ea7014a 100644 --- a/tests/test_general_contact_warped_q4_patch.py +++ b/tests/test_general_contact_warped_q4_patch.py @@ -5,13 +5,13 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, LoadCase, RigidContactBody, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel -from anysolver.general_contact.warped_q4_static import WarpedQ4PlaneManager +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.warped_q4_static import WarpedQ4PlaneManager _POINTS = ((0.0, 0.0, 0.0), (0.5, 0.0, 0.0004), diff --git a/tests/test_general_contact_warped_q4_plane.py b/tests/test_general_contact_warped_q4_plane.py index 9233dacad..0f625dcb0 100644 --- a/tests/test_general_contact_warped_q4_plane.py +++ b/tests/test_general_contact_warped_q4_plane.py @@ -3,10 +3,10 @@ import numpy as np import pytest -from anysolver import create_shell_element -from anysolver.fe_core import FEModel -from anysolver.general_contact.warped_q4_plane import WarpedQ4PlaneMortar -from anysolver.general_contact.warped_q4_skin import WarpedQ4Skin +from anyfesolver import create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.warped_q4_plane import WarpedQ4PlaneMortar +from anyfesolver.general_contact.warped_q4_skin import WarpedQ4Skin _WARPED = np.array(((0.0, 0.0, 0.0), diff --git a/tests/test_general_contact_warped_q4_skin.py b/tests/test_general_contact_warped_q4_skin.py index c0aaabcc5..b9f394f6e 100644 --- a/tests/test_general_contact_warped_q4_skin.py +++ b/tests/test_general_contact_warped_q4_skin.py @@ -3,9 +3,9 @@ import numpy as np import pytest -from anysolver import create_shell_element -from anysolver.fe_core import FEModel -from anysolver.general_contact.warped_q4_skin import WarpedQ4Skin +from anyfesolver import create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.warped_q4_skin import WarpedQ4Skin _WARPED = np.array(((0.0, 0.0, 0.0), diff --git a/tests/test_general_contact_warped_q4_static.py b/tests/test_general_contact_warped_q4_static.py index 08d6570cd..7d46ade94 100644 --- a/tests/test_general_contact_warped_q4_static.py +++ b/tests/test_general_contact_warped_q4_static.py @@ -5,13 +5,13 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, ContactSolverSettings, ContactSurface, LoadCase, RigidContactBody, create_shell_element, solve_static_nonlinear, validate_general_contact, ) -from anysolver.fe_core import FEModel -from anysolver.general_contact.warped_q4_static import WarpedQ4PlaneManager +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.warped_q4_static import WarpedQ4PlaneManager _CORNERS = ((0.0, 0.0, 0.0), (1.0, 0.0, 0.08), diff --git a/tests/test_general_contact_zero_weight_derivatives.py b/tests/test_general_contact_zero_weight_derivatives.py index b8fbbebcd..194613e3b 100644 --- a/tests/test_general_contact_zero_weight_derivatives.py +++ b/tests/test_general_contact_zero_weight_derivatives.py @@ -86,8 +86,8 @@ def test_coupled_coordinate_force_direction_through_zero_weight_activation(): def test_complete_physical_skin_map_including_rotations_and_target_motion(): - from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager - from anysolver.general_contact.semismooth import linearize + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager + from anyfesolver.general_contact.semismooth import linearize from test_general_contact_q4_s3_refined_patch import _two_q4_two_s3 from test_general_contact_q4_s3_jet2_static_owner import _settings model,definition,settings=_two_q4_two_s3() diff --git a/tests/test_generalized_beam_sections.py b/tests/test_generalized_beam_sections.py index 3ebd765b3..e51c8c8f0 100644 --- a/tests/test_generalized_beam_sections.py +++ b/tests/test_generalized_beam_sections.py @@ -5,15 +5,15 @@ import numpy as np import pytest -from anysolver.beam_sections import ( +from anyfesolver.beam_sections import ( GENERALIZED_BEAM_RESULTANT_ORDER, GENERALIZED_BEAM_STRAIN_ORDER, GeneralizedBeamSection, GeneralizedBeamSectionContract, coerce_generalized_beam_section, ) -from anysolver.elements import BeamElement, QuadraticBeamElement -from anysolver.fe_core import FEModel +from anyfesolver.elements import BeamElement, QuadraticBeamElement +from anyfesolver.fe_core import FEModel def _stiffness() -> np.ndarray: diff --git a/tests/test_generalized_section_api_workflows.py b/tests/test_generalized_section_api_workflows.py index 73e4b861d..a7890f70d 100644 --- a/tests/test_generalized_section_api_workflows.py +++ b/tests/test_generalized_section_api_workflows.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( GENERALIZED_BEAM_RESULTANT_ORDER, GENERALIZED_BEAM_STRAIN_ORDER, GeneralizedBeamSection, @@ -15,18 +15,18 @@ validate_generalized_beam_section, validate_generalized_shell_section, ) -from anysolver.nonlinear_performance_bootstrap import ( +from anyfesolver.nonlinear_performance_bootstrap import ( clear_nonlinear_assembly_cache, get_nonlinear_assembly_plan, install_nonlinear_performance_optimizations, ) -from anysolver.e4_pl_element import QualifiedE4PLShellElement -from anysolver.e4_pl_s3_v2d_element import ( +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement +from anyfesolver.e4_pl_s3_v2d_element import ( FORMULATION_ID as S3_V2D_FORMULATION_ID, NativeParityE4PLS3V2DShellElement, ) -from anysolver.elements import LegacyShellElement -from anysolver.vectorized_nonlinear import shell_nonlinear_batch_eligible +from anyfesolver.elements import LegacyShellElement +from anyfesolver.vectorized_nonlinear import shell_nonlinear_batch_eligible def _shell_section(name: str = "laminate") -> GeneralizedShellSection: diff --git a/tests/test_generalized_section_mass_properties.py b/tests/test_generalized_section_mass_properties.py index 827a0e60a..deeab64fc 100644 --- a/tests/test_generalized_section_mass_properties.py +++ b/tests/test_generalized_section_mass_properties.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BeamElement, FEModel, GeneralizedBeamSection, diff --git a/tests/test_generalized_shell_sections.py b/tests/test_generalized_shell_sections.py index f199fd1aa..3fdd41489 100644 --- a/tests/test_generalized_shell_sections.py +++ b/tests/test_generalized_shell_sections.py @@ -7,7 +7,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( FEModel, LegacyQ4DeprecationWarning, LegacyShellElement, @@ -17,7 +17,7 @@ create_element, create_shell_element, ) -from anysolver.shell_sections import ( +from anyfesolver.shell_sections import ( GeneralizedShellSection, GeneralizedShellSectionProtocol, coerce_generalized_shell_section, diff --git a/tests/test_generalized_state_recovery.py b/tests/test_generalized_state_recovery.py index c14cf4f55..089c33a9c 100644 --- a/tests/test_generalized_state_recovery.py +++ b/tests/test_generalized_state_recovery.py @@ -7,7 +7,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BeamElement, FEModel, GeneralizedBeamSection, diff --git a/tests/test_generic_beam_lazy_public_export.py b/tests/test_generic_beam_lazy_public_export.py index 44f3daa34..63e11159c 100644 --- a/tests/test_generic_beam_lazy_public_export.py +++ b/tests/test_generic_beam_lazy_public_export.py @@ -11,38 +11,38 @@ def test_stiffened_shell_lazy_public_identity(access): # Use the actual already-selected installed/source artifact in a clean child. # A repository test must not fall back to a historical checkout. - import anysolver - source = str(Path(anysolver.__file__).resolve().parent.parent) + import anyfesolver + source = str(Path(anyfesolver.__file__).resolve().parent.parent) code = ''' import importlib, sys, types sys.path.insert(0, SOURCE) -import anysolver -assert 'stiffened_shell' in anysolver.__all__ -assert 'stiffened_shell' in dir(anysolver) -assert 'stiffened_shell' not in vars(anysolver) -assert 'anysolver.stiffened_shell' not in sys.modules +import anyfesolver +assert 'stiffened_shell' in anyfesolver.__all__ +assert 'stiffened_shell' in dir(anyfesolver) +assert 'stiffened_shell' not in vars(anyfesolver) +assert 'anyfesolver.stiffened_shell' not in sys.modules assert 'scipy.spatial.transform' not in sys.modules try: - anysolver._not_a_public_export + anyfesolver._not_a_public_export except AttributeError: pass else: raise AssertionError('unknown export accepted') if ACCESS == 'attribute': - module = anysolver.stiffened_shell + module = anyfesolver.stiffened_shell elif ACCESS == 'from_import': - from anysolver import stiffened_shell as module + from anyfesolver import stiffened_shell as module else: - module = importlib.import_module('anysolver.stiffened_shell') + module = importlib.import_module('anyfesolver.stiffened_shell') assert isinstance(module, types.ModuleType) -assert module is anysolver.stiffened_shell -assert module is sys.modules['anysolver.stiffened_shell'] -from anysolver import stiffened_shell +assert module is anyfesolver.stiffened_shell +assert module is sys.modules['anyfesolver.stiffened_shell'] +from anyfesolver import stiffened_shell assert stiffened_shell is module -assert importlib.import_module('anysolver.stiffened_shell') is module -assert vars(anysolver)['stiffened_shell'] is module -assert 'stiffened_shell' in dir(anysolver) -assert module.GEBeamLineAction is importlib.import_module('anysolver._stiffened_shell_ge_distributed_load').GEBeamLineAction +assert importlib.import_module('anyfesolver.stiffened_shell') is module +assert vars(anyfesolver)['stiffened_shell'] is module +assert 'stiffened_shell' in dir(anyfesolver) +assert module.GEBeamLineAction is importlib.import_module('anyfesolver._stiffened_shell_ge_distributed_load').GEBeamLineAction ''' code = 'SOURCE = ' + repr(source) + '\nACCESS = ' + repr(access) + '\n' + code env = os.environ.copy() diff --git a/tests/test_generic_beam_python_scatter.py b/tests/test_generic_beam_python_scatter.py index 012d1ed4e..84b902333 100644 --- a/tests/test_generic_beam_python_scatter.py +++ b/tests/test_generic_beam_python_scatter.py @@ -9,8 +9,8 @@ import numpy as np import pytest -from anysolver import nonlinear_performance as performance -from anysolver.elements import BeamElement, QuadraticBeamElement +from anyfesolver import nonlinear_performance as performance +from anyfesolver.elements import BeamElement, QuadraticBeamElement def original(values, positions, size): @@ -58,7 +58,7 @@ def test_selector_rechecks_jit_and_exact_family(monkeypatch): plan.shell_batches=(object(),) assert performance._generic_beam_scatter_kernel(plan) is performance._scatter_sum plan.shell_batches=() - from anysolver.general_contact.runtime import _ACTIVE_CONTACT, suspend_contact + from anyfesolver.general_contact.runtime import _ACTIVE_CONTACT, suspend_contact token=_ACTIVE_CONTACT.set(object()) try: assert performance._generic_beam_scatter_kernel(plan) is performance._scatter_sum_python_ordered @@ -76,7 +76,7 @@ def test_invalid_index_retains_refusal(): def beam_model(): - from anysolver.fe_core import FEModel + from anyfesolver.fe_core import FEModel model=FEModel('generic-beam-scatter') model.add_material('steel',210e9,0.3) for node_id in (1,2,3):model.add_node(node_id,float(node_id-1),0.,0.) @@ -86,7 +86,7 @@ def beam_model(): def test_actual_beam_assembly_exact_parity(monkeypatch, tmp_path): - from anysolver import nonlinear_static + from anyfesolver import nonlinear_static import numba # JIT-off must be selected before decorators and Numba overloads load. # Toggling it after an ordinary JIT-on import can corrupt cold overloads. @@ -130,7 +130,7 @@ def observed(*args):calls.append(True);return actual(*args) def test_beam_plan_invalidation(): - from anysolver.nonlinear_performance_bootstrap import get_nonlinear_assembly_plan + from anyfesolver.nonlinear_performance_bootstrap import get_nonlinear_assembly_plan model=beam_model() first=get_nonlinear_assembly_plan(model,5) assert get_nonlinear_assembly_plan(model,5) is first diff --git a/tests/test_geometry_panel.py b/tests/test_geometry_panel.py index 3fb373f64..4553022cc 100644 --- a/tests/test_geometry_panel.py +++ b/tests/test_geometry_panel.py @@ -4,7 +4,7 @@ import math from collections import Counter -from anysolver.runtime import ( +from anyfesolver.runtime import ( LightweightFEMConfig, build_generated_geometry, run_production_fem, diff --git a/tests/test_hht_alpha.py b/tests/test_hht_alpha.py index 0d0a8cafa..482a08677 100644 --- a/tests/test_hht_alpha.py +++ b/tests/test_hht_alpha.py @@ -5,19 +5,19 @@ import numpy as np import pytest -from anysolver.assembly import solve_linear -from anysolver.boundary import BoundaryCondition, LoadCase -from anysolver.contact import ( +from anyfesolver.assembly import solve_linear +from anyfesolver.boundary import BoundaryCondition, LoadCase +from anyfesolver.contact import ( NonlinearTransientConfig, RigidSphereImpact, SphereContactConfig, _verification_contact_panel, solve_transient_sphere_impact, ) -from anysolver.dynamics import TransientConfig, solve_transient_newmark -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEModel -from anysolver.material_curves import DNVC208MaterialCurve +from anyfesolver.dynamics import TransientConfig, solve_transient_newmark +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.material_curves import DNVC208MaterialCurve def test_hht_alpha_config_validation_and_parameter_derivation() -> None: diff --git a/tests/test_hill48_plane_stress_plasticity.py b/tests/test_hill48_plane_stress_plasticity.py index 4d379b4e8..aa0927d79 100644 --- a/tests/test_hill48_plane_stress_plasticity.py +++ b/tests/test_hill48_plane_stress_plasticity.py @@ -7,9 +7,9 @@ import numpy as np import pytest -from anysolver.material_curves import DNVC208MaterialCurve -from anysolver.materials import Hill48Yield -from anysolver.plasticity import ( +from anyfesolver.material_curves import DNVC208MaterialCurve +from anyfesolver.materials import Hill48Yield +from anyfesolver.plasticity import ( PlaneStressConvergenceError, hill48_plane_stress_equivalent_stress, hill48_plane_stress_numerical_tangent, diff --git a/tests/test_impact_coupled_convergence.py b/tests/test_impact_coupled_convergence.py index 5639211c0..9d1490ef7 100644 --- a/tests/test_impact_coupled_convergence.py +++ b/tests/test_impact_coupled_convergence.py @@ -1,10 +1,10 @@ """Public-route checks against a same-step two-mass Newmark oracle.""" import numpy as np import pytest -import anysolver as fs -from anysolver.contact import _verification_contact_panel -from anysolver.boundary import BoundaryCondition -from anysolver._impact_coupling import ImpactCoupledIteration +import anyfesolver as fs +from anyfesolver.contact import _verification_contact_panel +from anyfesolver.boundary import BoundaryCondition +from anyfesolver._impact_coupling import ImpactCoupledIteration def run_case(method="anderson", stiffness=40000., damping=0., deform=False, relaxation="aitken", end=.03, dt=.01, max_iterations=25, max_cutbacks=0, height=.205, token=None, callback=None, plastic=False, hht_alpha=0.): @@ -12,7 +12,7 @@ def run_case(method="anderson", stiffness=40000., damping=0., deform=False, rela if deform: model.add_boundary_condition(BoundaryCondition("pin-one-z", [1], {"uz": 0.})) if plastic: - from anysolver.material_curves import DNVC208MaterialCurve + from anyfesolver.material_curves import DNVC208MaterialCurve model.materials["soft"].hardening_curve = DNVC208MaterialCurve( sigma_prop=.008, sigma_yield=.01, sigma_yield_2=.012, eps_p_y1=1.e-5, eps_p_y2=1.e-3, K=.02, n=.1) @@ -240,7 +240,7 @@ def test_contact_newton_hht_damping_and_yielding_preserve_equations(): def test_numerical_contact_jacobian_preserves_nonsymmetric_derivative(): - from anysolver._impact_coupling import numerical_contact_jacobian + from anyfesolver._impact_coupling import numerical_contact_jacobian matrix=np.array([[3.,2.],[-7.,5.]]) coordinates=np.array([.03,.2]) original=coordinates.copy() @@ -252,7 +252,7 @@ def test_numerical_contact_jacobian_preserves_nonsymmetric_derivative(): def test_contact_jacobian_cancellation_propagates(monkeypatch): - import anysolver.contact as contact + import anyfesolver.contact as contact original=contact.cancellation_safe_point token=fs.CancellationToken() def cancel_during_probe(token_arg,phase): @@ -273,7 +273,7 @@ def test_contact_newton_honors_contact_relaxation_disable(): def test_numerical_contact_derivative_uses_physical_scale_under_origin_shift(): - from anysolver._impact_coupling import numerical_contact_jacobian + from anyfesolver._impact_coupling import numerical_contact_jacobian for origin in [0.,1.e9]: point=np.array([origin+.03]) local=point[0]-origin @@ -283,8 +283,8 @@ def test_numerical_contact_derivative_uses_physical_scale_under_origin_shift(): def test_contact_newton_large_translation_system_falls_back_to_anderson(): - from anysolver.fe_core import FEModel - from anysolver.elements import create_shell_element + from anyfesolver.fe_core import FEModel + from anyfesolver.elements import create_shell_element model=FEModel('contact-newton-dimension-cap') model.add_material('soft',1.e5,.3,density=20.) for j in range(5): diff --git a/tests/test_impact_elastic_baseline_cache.py b/tests/test_impact_elastic_baseline_cache.py index bcf9e6033..a3beb6f56 100644 --- a/tests/test_impact_elastic_baseline_cache.py +++ b/tests/test_impact_elastic_baseline_cache.py @@ -3,8 +3,8 @@ from contextlib import contextmanager import numpy as np import pytest -from anysolver import e4_pl_element as q4, vectorized_nonlinear as batch -from anysolver.control import SolveCancelled +from anyfesolver import e4_pl_element as q4, vectorized_nonlinear as batch +from anyfesolver.control import SolveCancelled from test_general_contact_c5_elastic_increment import case, pose @contextmanager diff --git a/tests/test_impact_reduced_assembly.py b/tests/test_impact_reduced_assembly.py index deca0c911..ed2872f0a 100644 --- a/tests/test_impact_reduced_assembly.py +++ b/tests/test_impact_reduced_assembly.py @@ -4,14 +4,14 @@ import pytest from scipy import sparse -import anysolver as fs -from anysolver import impact_reduced_assembly as impact_reduced_module -from anysolver import nonlinear_performance_bootstrap -from anysolver.contact import _verification_contact_panel -from anysolver.elements import BeamElement, QuadraticBeamElement -from anysolver.impact_reduced_assembly import prepare_impact_reduced_assembly -from anysolver.jit_compiler import JIT_DISABLED_REASON, JIT_ENABLED -from anysolver.nonlinear_reduced_assembly import ReducedAssemblyPlanLimit +import anyfesolver as fs +from anyfesolver import impact_reduced_assembly as impact_reduced_module +from anyfesolver import nonlinear_performance_bootstrap +from anyfesolver.contact import _verification_contact_panel +from anyfesolver.elements import BeamElement, QuadraticBeamElement +from anyfesolver.impact_reduced_assembly import prepare_impact_reduced_assembly +from anyfesolver.jit_compiler import JIT_DISABLED_REASON, JIT_ENABLED +from anyfesolver.nonlinear_reduced_assembly import ReducedAssemblyPlanLimit def _weighted_mpc_panel(): diff --git a/tests/test_impact_tangent_reuse.py b/tests/test_impact_tangent_reuse.py index 505e48944..fd16f0056 100644 --- a/tests/test_impact_tangent_reuse.py +++ b/tests/test_impact_tangent_reuse.py @@ -3,13 +3,13 @@ import numpy as np import pytest -import anysolver as fs -from anysolver.boundary import BoundaryCondition -from anysolver.contact import _verification_contact_panel -from anysolver.elements import create_element -from anysolver.fe_core import FEModel -from anysolver.impact_performance import ImpactTangentReuseController -from anysolver.material_curves import DNVC208MaterialCurve +import anyfesolver as fs +from anyfesolver.boundary import BoundaryCondition +from anyfesolver.contact import _verification_contact_panel +from anyfesolver.elements import create_element +from anyfesolver.fe_core import FEModel +from anyfesolver.impact_performance import ImpactTangentReuseController +from anyfesolver.material_curves import DNVC208MaterialCurve class _DummyHandle: diff --git a/tests/test_inertia_relief.py b/tests/test_inertia_relief.py index eaa2f26ed..1ef0fce19 100644 --- a/tests/test_inertia_relief.py +++ b/tests/test_inertia_relief.py @@ -4,9 +4,9 @@ import numpy as np import pytest -from anysolver import (BeamElement, FEModel, GeneralizedBeamSection, InertiaReliefError, +from anyfesolver import (BeamElement, FEModel, GeneralizedBeamSection, InertiaReliefError, LoadCase, solve_inertia_relief) -from anysolver.matrix_assembly import assemble_mass_matrix, assemble_stiffness_matrix +from anyfesolver.matrix_assembly import assemble_mass_matrix, assemble_stiffness_matrix def bar(n=3, consistent=True): diff --git a/tests/test_inertia_relief_integration.py b/tests/test_inertia_relief_integration.py index e5ee2f867..e51458974 100644 --- a/tests/test_inertia_relief_integration.py +++ b/tests/test_inertia_relief_integration.py @@ -4,12 +4,12 @@ import numpy as np import pytest -from anysolver import (AnalysisSession, BeamElement, CancellationToken, FEModel, FixedSupport, +from anyfesolver import (AnalysisSession, BeamElement, CancellationToken, FEModel, FixedSupport, InertiaReliefError, LoadCase, SolveCancelled, create_shell_element, solve_inertia_relief, solve_linear) -from anysolver.assembly import build_constraint_transformation -from anysolver.elements import CoupledBeamShellElement -from anysolver.matrix_assembly import assemble_mass_matrix, assemble_stiffness_matrix +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.elements import CoupledBeamShellElement +from anyfesolver.matrix_assembly import assemble_mass_matrix, assemble_stiffness_matrix def beam(): @@ -213,7 +213,7 @@ def test_original_free_free_refusal_and_supported_static_behavior_remain(): ("activity","activity",1.), ]) def test_distinct_activity_policies_and_session_updates(mass_policy,load_policy,ratio): - from anysolver.activity import ElementActivity, ElementActivityPolicy + from anyfesolver.activity import ElementActivity, ElementActivityPolicy model=beam() activity=ElementActivity([1],.375,policy=ElementActivityPolicy(mass=mass_policy,load=load_policy)) model.set_element_activity(activity) @@ -232,7 +232,7 @@ def test_distinct_activity_policies_and_session_updates(mass_policy,load_policy, def test_hard_deleted_stiffness_with_retained_mass_is_unresolved(): - from anysolver.activity import ElementActivity,ElementActivityPolicy + from anyfesolver.activity import ElementActivity,ElementActivityPolicy model=beam() activity=ElementActivity([1],0.,policy=ElementActivityPolicy(mass="retain")) model.set_element_activity(activity) @@ -261,7 +261,7 @@ def compute_mass_matrix(self,mesh,material): def test_lanczos_nonconvergence_fails_closed(monkeypatch): - import anysolver.inertia_relief as module + import anyfesolver.inertia_relief as module from scipy.sparse.linalg import ArpackNoConvergence def fail(*args,**kwargs): raise ArpackNoConvergence("forced nonconvergence",np.empty(0),np.empty((12,0))) @@ -309,7 +309,7 @@ def test_rigid_dominated_loads_are_invariant_to_density_scale(factor): def test_recovery_refuses_revision_and_direct_constraint_changes(): - from anysolver import ConstraintEquation + from anyfesolver import ConstraintEquation model=beam() result=solve_inertia_relief(model) assert result.converged @@ -326,7 +326,7 @@ def test_recovery_refuses_revision_and_direct_constraint_changes(): def test_nonfinite_operator_produces_typed_refusal_and_arpack_error_is_numerical(monkeypatch): - import anysolver.inertia_relief as module + import anyfesolver.inertia_relief as module from scipy.sparse import eye from scipy.sparse.linalg import ArpackError original=module.assemble_mass_matrix @@ -416,7 +416,7 @@ def test_default_linear_s3_reference_profile_and_semidefinite_mass(): def test_quadratic_beam_uses_its_consistent_mass_profile(): - from anysolver import QuadraticBeamElement + from anyfesolver import QuadraticBeamElement model=beam() model.set_node_coordinates(2,1.,0.,0.) model.add_node(3,2.,0.,0.) diff --git a/tests/test_initial_fields_and_staged_history.py b/tests/test_initial_fields_and_staged_history.py index 8bce4bf74..97e920e4a 100644 --- a/tests/test_initial_fields_and_staged_history.py +++ b/tests/test_initial_fields_and_staged_history.py @@ -5,12 +5,12 @@ import numpy as np import pytest -from anysolver.boundary import BoundaryCondition, FixedSupport, LoadCase -from anysolver.elements import BeamElement, create_shell_element -from anysolver.fe_core import FEModel -from anysolver.imperfections import ImperfectionField -from anysolver.material_curves import DNVC208MaterialCurve, FiberSectionPlasticityConfig -from anysolver.nonlinear_static import ( +from anyfesolver.boundary import BoundaryCondition, FixedSupport, LoadCase +from anyfesolver.elements import BeamElement, create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.imperfections import ImperfectionField +from anyfesolver.material_curves import DNVC208MaterialCurve, FiberSectionPlasticityConfig +from anyfesolver.nonlinear_static import ( BeamInitialField, DisplacementControl, NonlinearLoadProgram, @@ -144,7 +144,7 @@ def test_shell_bending_stress_and_prestrain_use_documented_layer_convention(): model = _membrane_patch() element = model.mesh.get_element(1) material = model.get_material("steel") - from anysolver.nonlinear_static import _prepare_initial_states + from anyfesolver.nonlinear_static import _prepare_initial_states states, _ = _prepare_initial_states( model, @@ -431,7 +431,7 @@ def test_fully_constrained_prescribed_model_without_restart_keeps_target_state() def test_field_bearing_restart_requires_matching_displacements(): model = _membrane_patch() - from anysolver.nonlinear_static import _prepare_initial_states + from anyfesolver.nonlinear_static import _prepare_initial_states states, _ = _prepare_initial_states( model, @@ -468,7 +468,7 @@ def test_initial_displacements_reject_nonfinite_values(): def test_replacing_initial_field_clears_old_components_and_rejects_alpha_history(): model = _membrane_patch() - from anysolver.nonlinear_static import _prepare_initial_states + from anyfesolver.nonlinear_static import _prepare_initial_states states, _ = _prepare_initial_states( model, @@ -521,7 +521,7 @@ def test_replacing_initial_field_clears_old_components_and_rejects_alpha_history def test_new_initial_field_and_tangent_qualification_symbols_are_root_exports(): - import anysolver + import anyfesolver for name in ( "BeamInitialField", @@ -530,8 +530,8 @@ def test_new_initial_field_and_tangent_qualification_symbols_are_root_exports(): "algorithmic_tangent_performance_metrics", "global_newton_tangent_benchmark_metrics", ): - assert name in anysolver.__all__ - assert getattr(anysolver, name) is not None + assert name in anyfesolver.__all__ + assert getattr(anyfesolver, name) is not None def test_shell_initial_field_survives_plastic_commit_and_unloading(): @@ -539,7 +539,7 @@ def test_shell_initial_field_survives_plastic_commit_and_unloading(): model.materials["steel"].hardening_curve = S355_CURVE element = model.mesh.get_element(1) material = model.get_material("steel") - from anysolver.nonlinear_static import _prepare_initial_states + from anyfesolver.nonlinear_static import _prepare_initial_states states, _ = _prepare_initial_states( model, @@ -552,7 +552,7 @@ def test_shell_initial_field_survives_plastic_commit_and_unloading(): # Owner decision 2026-10-23: plastic qualified Q4 outside the assumed-strain # route scope is refused (the compatible-strain plastic route with the # qualified correction is unstable once layers yield). - from anysolver._q4_assumed_strain_plasticity import UnsupportedQ4PlasticRouteError + from anyfesolver._q4_assumed_strain_plasticity import UnsupportedQ4PlasticRouteError with pytest.raises(UnsupportedQ4PlasticRouteError, match="active initial"): element.compute_nonlinear_response( model.mesh, material, loading, states[1], num_layers=3, tangent=True diff --git a/tests/test_instance_dict_descriptor_layout.py b/tests/test_instance_dict_descriptor_layout.py index df902e8f3..9be700a81 100644 --- a/tests/test_instance_dict_descriptor_layout.py +++ b/tests/test_instance_dict_descriptor_layout.py @@ -8,7 +8,7 @@ import sys import types -from anysolver.boundary import _SHARED_INSTANCE_DICT, _builtin_instance_dict_descriptor +from anyfesolver.boundary import _SHARED_INSTANCE_DICT, _builtin_instance_dict_descriptor class _Plain: diff --git a/tests/test_load_vector_guard_amortization.py b/tests/test_load_vector_guard_amortization.py index 912e6c6cb..abebcf0af 100644 --- a/tests/test_load_vector_guard_amortization.py +++ b/tests/test_load_vector_guard_amortization.py @@ -14,15 +14,15 @@ import numpy as np import pytest -import anysolver.current_state_tangent as current_state_tangent -from anysolver import boundary -from anysolver.boundary import LoadCase -from anysolver.e4_pl_element import QualifiedE4PLShellElement -from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement -from anysolver.element_capabilities import ElementCapabilityError -from anysolver.elements import BeamElement, create_shell_element -from anysolver.fe_core import FEModel -from anysolver.matrix_assembly import ( +import anyfesolver.current_state_tangent as current_state_tangent +from anyfesolver import boundary +from anyfesolver.boundary import LoadCase +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement +from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement +from anyfesolver.element_capabilities import ElementCapabilityError +from anyfesolver.elements import BeamElement, create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.matrix_assembly import ( AssemblyError, _assemble_load_vector_under_lease, _run_with_qualified_assembly_runtime_lease, @@ -383,7 +383,7 @@ def __float__(self): @pytest.mark.parametrize("kind", ["subclass", "dofs", "coordinate", "coords-provider"]) def test_foreign_node_state_refuses_owned_span(kind: str) -> None: - from anysolver.fe_core import Node + from anyfesolver.fe_core import Node model, ids = _model() case = _cases(ids)[1] @@ -434,7 +434,7 @@ def __float__(self): def test_activity_descriptor_cannot_return_before_complete_guard(monkeypatch: pytest.MonkeyPatch) -> None: - from anysolver.fe_core import FEMesh + from anyfesolver.fe_core import FEMesh model, ids = _model() observed = [] @@ -458,7 +458,7 @@ def operation(lease): def test_foreign_batch_iterator_is_guarded_before_next_case_kernel() -> None: - from anysolver.matrix_assembly import _assemble_load_matrix_under_lease + from anyfesolver.matrix_assembly import _assemble_load_matrix_under_lease model, ids = _model() seen = [] @@ -486,7 +486,7 @@ def __iter__(self): @pytest.mark.parametrize("kind", ["mesh-subclass", "mapping-subclass", "native-fibre", "mesh-hook", "node-descriptor"]) def test_runner_refuses_foreign_routing_and_native_fibre(kind: str, monkeypatch: pytest.MonkeyPatch) -> None: - from anysolver.fe_core import FEMesh, Node + from anyfesolver.fe_core import FEMesh, Node model, ids = _model() case = _cases(ids)[0] @@ -499,7 +499,7 @@ class ForeignMapping(dict): pass object.__getattribute__(model.mesh, "__dict__")["nodes"] = ForeignMapping(model.mesh.nodes) elif kind == "native-fibre": - native = type("Native", (), {"__module__": "anysolver._ge_beam3_native_fibre_static_element"})() + native = type("Native", (), {"__module__": "anyfesolver._ge_beam3_native_fibre_static_element"})() dict.__setitem__(model.mesh.elements, 9, native) elif kind == "mesh-hook": monkeypatch.setattr(FEMesh, "__getattr__", lambda self, name: None, raising=False) @@ -737,8 +737,8 @@ class Buffer(io.BytesIO): def test_acceleration_reaches_public_solve_linear_many(monkeypatch): - from anysolver.assembly import solve_linear_many, solve_linear - from anysolver.boundary import FixedSupport + from anyfesolver.assembly import solve_linear_many, solve_linear + from anyfesolver.boundary import FixedSupport model, ids = _model() model.add_boundary_condition(FixedSupport("root", [node_id for node_id in model.mesh.nodes if node_id != 4])) cases = [] @@ -828,7 +828,7 @@ def test_warning_handler_installed_before_import_is_not_self_authorized(): script = """import warnings seen = [] warnings.showwarning = lambda *args, **kwargs: seen.append('foreign') -import anysolver.boundary as boundary +import anyfesolver.boundary as boundary assert not boundary._numpy_error_routes_are_builtin() assert seen == [] """ @@ -877,7 +877,7 @@ def test_preimport_warning_providers_are_not_self_authorized(provider): patch = ("warnings.WarningMessage = type('WarningMessage', (), {'__init__': lambda *args, **kwargs: seen.append('foreign')})" if provider == "warning_message" else "import linecache; linecache.getline = lambda *args, **kwargs: seen.append('foreign') or ''") - script = "import warnings\nseen = []\n" + patch + "\nimport anysolver.boundary as boundary\nassert not boundary._numpy_error_routes_are_builtin()\nassert seen == []\n" + script = "import warnings\nseen = []\n" + patch + "\nimport anyfesolver.boundary as boundary\nassert not boundary._numpy_error_routes_are_builtin()\nassert seen == []\n" completed = subprocess.run([sys.executable, "-B", "-c", script], env=os.environ.copy(), capture_output=True, text=True, timeout=30) assert completed.returncode == 0, completed.stdout + completed.stderr @@ -924,7 +924,7 @@ def test_preimport_referent_provider_is_not_self_authorized(): script = """import gc seen = [] gc.get_referents = lambda *args: seen.append('foreign') or [] -import anysolver.boundary as boundary +import anyfesolver.boundary as boundary from types import MappingProxyType assert not boundary._plain_mass_input(MappingProxyType({})) assert not boundary._numpy_error_routes_are_builtin() diff --git a/tests/test_local_patch_transition.py b/tests/test_local_patch_transition.py index e867d0453..351bcc34c 100644 --- a/tests/test_local_patch_transition.py +++ b/tests/test_local_patch_transition.py @@ -19,7 +19,7 @@ import numpy as np import pytest -from anysolver.runtime import ( +from anyfesolver.runtime import ( LightweightFEMConfig, build_generated_geometry, run_production_fem, @@ -610,7 +610,7 @@ def test_axial_cylinder_stress_is_mesh_style_invariant() -> None: to turn the clustered graded end rings into a global bending moment (81-484 MPa), and true-surface node placement used to bulge the local patch proud of the chordal base facets (222-447 MPa stress dimple).""" - from anysolver import runtime as fs + from anyfesolver import runtime as fs captured = {} original = fs._backend_solve_linear @@ -701,7 +701,7 @@ def test_local_patch_buckling_has_no_spurious_flat_facet_modes() -> None: shell load factor (spiky single-element modes, LF ~3 vs classical ~7). With the curvature-adequate base ring + blended node placement the first buckling factor must stay at shell level, above the classical value.""" - from anysolver import runtime as fs + from anyfesolver import runtime as fs cylinder = { "geometry": "cylinder", @@ -744,7 +744,7 @@ def test_axial_flat_plate_stress_is_mesh_style_invariant() -> None: must leave flat panels exact. Unstiffened plate L=4 m, W=3 m, t=12 mm under 10 MN balanced axial force: sigma = F/(W t) = 277.8 MPa uniform and the plate stays exactly planar for every mesh style.""" - from anysolver import runtime as fs + from anyfesolver import runtime as fs captured = {} original = fs._backend_solve_linear @@ -821,7 +821,7 @@ def _stiffened_cylinder_style_outcome( ) -> tuple[str, dict[str, float]]: """Construct and solve one unchanged stiffened-cylinder mesh style.""" - from anysolver import runtime as fs + from anyfesolver import runtime as fs captured = {} original = fs._backend_solve_linear diff --git a/tests/test_marine_clock.py b/tests/test_marine_clock.py index b7bac2a10..f878f290a 100644 --- a/tests/test_marine_clock.py +++ b/tests/test_marine_clock.py @@ -3,11 +3,11 @@ import numpy as np import pytest from scipy.spatial.transform import Rotation -from anysolver.marine_rigid import RigidBody6D -from anysolver.marine_contributions import ( +from anyfesolver.marine_rigid import RigidBody6D +from anyfesolver.marine_contributions import ( ContributionResult, ContributionSet, DynamicContribution, MarineContributionsError, StepInformation) -from anysolver.marine_mechanical import ( +from anyfesolver.marine_mechanical import ( MarineMechanicalModel, MarineMechanicalRunSpec, solve_marine_mechanical) diff --git a/tests/test_marine_continuous_contact.py b/tests/test_marine_continuous_contact.py index e20b4178c..2070b8b9f 100644 --- a/tests/test_marine_continuous_contact.py +++ b/tests/test_marine_continuous_contact.py @@ -5,12 +5,12 @@ import numpy as np import pytest -from anysolver.marine_seabed import (SeabedContact, SeabedContactError, +from anyfesolver.marine_seabed import (SeabedContact, SeabedContactError, seabed_contact_force, API_VERSION, CONTINUOUS_API_VERSION) -from anysolver.marine_rigid import RigidBody6D -from anysolver.marine_mooring import (FixedEndpoint, DynamicLineNodeEndpoint, +from anyfesolver.marine_rigid import RigidBody6D +from anyfesolver.marine_mooring import (FixedEndpoint, DynamicLineNodeEndpoint, MooringNodeState, MooringLine, MooringLineAssembler) -from anysolver.marine_mechanical import (MarineMechanicalModel, +from anyfesolver.marine_mechanical import (MarineMechanicalModel, MarineMechanicalRunSpec, solve_marine_mechanical, model_to_dict, model_from_dict) diff --git a/tests/test_marine_contributions.py b/tests/test_marine_contributions.py index acb042e0d..caa10855b 100644 --- a/tests/test_marine_contributions.py +++ b/tests/test_marine_contributions.py @@ -9,9 +9,9 @@ from dataclasses import replace import pytest from scipy.spatial.transform import Rotation -from anysolver.marine_rigid import RigidBody6D -from anysolver.marine_link import MechanicalLink6D -from anysolver.marine_contributions import ( +from anyfesolver.marine_rigid import RigidBody6D +from anyfesolver.marine_link import MechanicalLink6D +from anyfesolver.marine_contributions import ( API_VERSION, BodyLayout, ChartMove, CommittedHistory, ContributionResult, ContributionSet, DryGravityContribution, DynamicContribution, HISTORY_CHART, HISTORY_PHYSICAL, MarineContributionsCancelled, diff --git a/tests/test_marine_coupled_equilibrium.py b/tests/test_marine_coupled_equilibrium.py index d5a81713f..1d559cd13 100644 --- a/tests/test_marine_coupled_equilibrium.py +++ b/tests/test_marine_coupled_equilibrium.py @@ -3,19 +3,19 @@ from importlib.util import find_spec import numpy as np import pytest -from anysolver.marine_rigid import RigidBody6D -from anysolver.marine_hydro_coordinates import EquilibriumHydroFrame -from anysolver.marine_potential_flow import (PotentialFlowDevelopmentData, +from anyfesolver.marine_rigid import RigidBody6D +from anyfesolver.marine_hydro_coordinates import EquilibriumHydroFrame +from anyfesolver.marine_potential_flow import (PotentialFlowDevelopmentData, PotentialFlowDevelopmentContribution,equilibrium_geometry_hash) -from anysolver.marine_contributions import (BodyLayout,CommittedHistory,WorldWrenchContribution, +from anyfesolver.marine_contributions import (BodyLayout,CommittedHistory,WorldWrenchContribution, DynamicContribution,ContributionResult) -from anysolver.marine_mechanical import MarineMechanicalModel -from anysolver.marine_link import MechanicalLink6D -from anysolver.marine_mooring import (MooringLine,MooringLineAssembler,FixedEndpoint as Anchor, +from anyfesolver.marine_mechanical import MarineMechanicalModel +from anyfesolver.marine_link import MechanicalLink6D +from anyfesolver.marine_mooring import (MooringLine,MooringLineAssembler,FixedEndpoint as Anchor, DynamicLineNodeEndpoint as Node,RigidBodyAttachmentEndpoint as Fairlead) -from anysolver.marine_coupled_equilibrium import (CoupledStaticSpec, +from anyfesolver.marine_coupled_equilibrium import (CoupledStaticSpec, solve_coupled_marine_equilibrium,evaluate_marine_static) -from anysolver.marine_equilibrium import MooringEquilibriumError,initialize_mooring_catenaries +from anyfesolver.marine_equilibrium import MooringEquilibriumError,initialize_mooring_catenaries def fixture(*, lines=False, members=False, finite=False, preload=True): @@ -50,7 +50,7 @@ def fixture(*, lines=False, members=False, finite=False, preload=True): if find_spec('anyloads') is None: pytest.importorskip('anyloads', reason='optional marine-morison provider is not installed') from anyloads.marine import AiryEnvironment,CurrentProfile,MorisonSection,HydrodynamicOwnership - from anysolver.marine_morison import MorisonMemberSetContribution,MorisonMember,MemberEndpoint + from anyfesolver.marine_morison import MorisonMemberSetContribution,MorisonMember,MemberEndpoint rods=tuple(MorisonMember('brace'+str(j),MemberEndpoint('a',(0.,0.,-.2-j*.1)), MemberEndpoint('b',(0.,0.,-.2-j*.1)),MorisonSection(.1,1.,1.), HydrodynamicOwnership(bem_included=False,buoyancy_owner='morison')) for j in range(2)) @@ -216,8 +216,8 @@ def test_malformed_static_state_model_and_nonstationary_rates_are_refused(): @pytest.mark.parametrize('bad',[None,{}, {'a':object(),'b':object()}]) def test_direct_public_static_methods_preserve_typed_admission(bad): - from anysolver.marine_potential_flow import MarinePotentialFlowError - from anysolver.marine_morison import MarineMorisonError + from anyfesolver.marine_potential_flow import MarinePotentialFlowError + from anyfesolver.marine_morison import MarineMorisonError model,states,_=fixture(members=True);layout=BodyLayout(model.body_ids) for c,error in ((model.contributions[0],MarinePotentialFlowError),(model.contributions[-1],MarineMorisonError)): with pytest.raises(error):c.evaluate_static(bad,layout) diff --git a/tests/test_marine_dry_blocks.py b/tests/test_marine_dry_blocks.py index da3ee0fea..b909913ee 100644 --- a/tests/test_marine_dry_blocks.py +++ b/tests/test_marine_dry_blocks.py @@ -8,7 +8,7 @@ import numpy as np import pytest from scipy.linalg import expm, expm_frechet -from anysolver.marine_rigid import RigidBody6D +from anyfesolver.marine_rigid import RigidBody6D I = ((3., .2, .1), (.2, 4., .3), (.1, .3, 5.)) Z = ((math.cos(.4), -math.sin(.4), 0.), diff --git a/tests/test_marine_equilibrium.py b/tests/test_marine_equilibrium.py index 7b0156ab6..cfcf542d2 100644 --- a/tests/test_marine_equilibrium.py +++ b/tests/test_marine_equilibrium.py @@ -5,13 +5,13 @@ import numpy as np import pytest from scipy.integrate import quad -from anysolver.marine_equilibrium import (elastic_catenary, initialize_mooring_catenaries, +from anyfesolver.marine_equilibrium import (elastic_catenary, initialize_mooring_catenaries, solve_mooring_equilibrium, MooringStaticSpec, MooringEquilibriumError) -from anysolver.marine_mooring import (MooringLine, MooringLineAssembler, MooringNodeState, +from anyfesolver.marine_mooring import (MooringLine, MooringLineAssembler, MooringNodeState, FixedEndpoint as Anchor, DynamicLineNodeEndpoint as Node, RigidBodyAttachmentEndpoint as Fairlead) -from anysolver.marine_seabed import SeabedContact -from anysolver.marine_rigid import RigidBody6D +from anyfesolver.marine_seabed import SeabedContact +from anyfesolver.marine_rigid import RigidBody6D def model_case(count=8, *, contact=False, current=False, body=False): @@ -179,7 +179,7 @@ def cancel():calls[0]+=1;return calls[0]>=3 def test_unrepresentable_contact_merit_retains_residual_route(monkeypatch): - import anysolver.marine_equilibrium as equilibrium + import anyfesolver.marine_equilibrium as equilibrium model,states=model_case(contact=True) def overflow(*args): raise OverflowError('injected unrepresentable potential summation') diff --git a/tests/test_marine_excitation_series.py b/tests/test_marine_excitation_series.py index 4c03e4aa7..1b4743527 100644 --- a/tests/test_marine_excitation_series.py +++ b/tests/test_marine_excitation_series.py @@ -13,11 +13,11 @@ from anyhydro.fixtures import make_two_body_fixture from anyloads import (JonswapSpectrum, WaveRealization, DirectionalSpectrum, MorisonSection, HydrodynamicOwnership) -from anysolver.marine_potential_flow import (data_to_dict,data_from_dict, +from anyfesolver.marine_potential_flow import (data_to_dict,data_from_dict, PotentialFlowDevelopmentContribution,MarinePotentialFlowError) -from anysolver.marine_morison import MemberEndpoint, MorisonMember, MorisonMemberSetContribution -from anysolver.marine_contributions import ContributionSet, StepInformation, MarineContributionsError -from anysolver.marine_mechanical import MarineMechanicalModel, MarineMechanicalRunSpec, solve_marine_mechanical +from anyfesolver.marine_morison import MemberEndpoint, MorisonMember, MorisonMemberSetContribution +from anyfesolver.marine_contributions import ContributionSet, StepInformation, MarineContributionsError +from anyfesolver.marine_mechanical import MarineMechanicalModel, MarineMechanicalRunSpec, solve_marine_mechanical from test_marine_potential_flow import fixture,frame,body,states_for @@ -55,7 +55,7 @@ def test_series_work_pullback_and_diagnostics(): states=states_for(frames,True);owner=ContributionSet(('a','b'),(p,)) step=owner.prepare_step(StepInformation(0,.1,'initialization')) trial=owner.evaluate_trial(step,states);diag=trial.diagnostics[p.contribution_id] - from anysolver.marine_hydro_coordinates import evaluate_coupled + from anyfesolver.marine_hydro_coordinates import evaluate_coupled mapped=evaluate_coupled(frames,states) expected=np.zeros(12);expected[0]=.4-.1 np.testing.assert_allclose(diag['components']['excitation'],mapped.jacobian.T@expected,rtol=1e-12,atol=1e-12) @@ -104,7 +104,7 @@ def test_series_cancellation_preserves_accepted_memory(): def shared_model(): - from anysolver.marine_hydro_coordinates import EquilibriumHydroFrame + from anyfesolver.marine_hydro_coordinates import EquilibriumHydroFrame ds=make_two_body_fixture() frames=tuple(EquilibriumHydroFrame(str(b),tuple(ds.rotation_center.values[i]), np.eye(3),np.eye(3),(0.,)*3) for i,b in enumerate(ds.body.values)) diff --git a/tests/test_marine_hydro_coordinates.py b/tests/test_marine_hydro_coordinates.py index 6c6b8276e..98bd6f42c 100644 --- a/tests/test_marine_hydro_coordinates.py +++ b/tests/test_marine_hydro_coordinates.py @@ -5,8 +5,8 @@ import pytest from scipy.linalg import expm from scipy.spatial.transform import Rotation -from anysolver.marine_rigid import RigidBodyState -from anysolver.marine_hydro_coordinates import ( +from anyfesolver.marine_rigid import RigidBodyState +from anyfesolver.marine_hydro_coordinates import ( EquilibriumHydroFrame, MarineHydroCoordinatesError, evaluate_coupled, ForcePullback, InertiaPullback, CoupledHydroEvaluation) diff --git a/tests/test_marine_line_hydrodynamics.py b/tests/test_marine_line_hydrodynamics.py index e548ca04f..996ece119 100644 --- a/tests/test_marine_line_hydrodynamics.py +++ b/tests/test_marine_line_hydrodynamics.py @@ -8,10 +8,10 @@ pytest.importorskip('anyloads', reason='optional line-hydrodynamics provider is not installed') from anyloads.marine import AiryEnvironment,AiryComponent,CurrentProfile from anyloads.marine_line import LineHydrodynamics -from anysolver.marine_mooring import (MooringLineError,data_to_dict,data_from_dict,HYDRO_API_VERSION) -from anysolver.marine_mechanical import (MarineMechanicalModel,MarineMechanicalRunSpec, +from anyfesolver.marine_mooring import (MooringLineError,data_to_dict,data_from_dict,HYDRO_API_VERSION) +from anyfesolver.marine_mechanical import (MarineMechanicalModel,MarineMechanicalRunSpec, MarineMechanicalInputError,solve_marine_mechanical,model_to_dict,model_from_dict,result_to_dict) -from anysolver.marine_contributions import WorldWrenchContribution +from anyfesolver.marine_contributions import WorldWrenchContribution from test_marine_mooring import coupled_case,fixed_case,perturb from test_marine_mooring_driver import case as driver_case @@ -83,7 +83,7 @@ def test_public_model_reserves_mooring_diagnostic_namespace(cid): def test_same_physical_line_identity_refuses_duplicate_morison_provider(): from anyloads.marine import MorisonSection,HydrodynamicOwnership - from anysolver.marine_morison import MemberEndpoint,MorisonMember,MorisonMemberSetContribution + from anyfesolver.marine_morison import MemberEndpoint,MorisonMember,MorisonMemberSetContribution model,states,nodes=driver_case() s=section();env=AiryEnvironment(20.) lines=tuple(replace(line,hydrodynamics=(s,s)) for line in model.mooring.lines) diff --git a/tests/test_marine_linear.py b/tests/test_marine_linear.py index f0d0affaf..878d68b6d 100644 --- a/tests/test_marine_linear.py +++ b/tests/test_marine_linear.py @@ -18,8 +18,8 @@ import pytest from scipy.integrate import solve_ivp -from anysolver.control import CancellationToken -from anysolver.marine_linear import ( +from anyfesolver.control import CancellationToken +from anyfesolver.marine_linear import ( NEWMARK_BETA, NEWMARK_GAMMA, MarineLinearInputError, @@ -397,7 +397,7 @@ def cancel_after_three() -> bool: assert immediate.n_accepted == 1 np.testing.assert_array_equal(immediate.times, full.times[:1]) - # anysolver.control.CancellationToken is accepted directly. + # anyfesolver.control.CancellationToken is accepted directly. token = CancellationToken() token.cancel("demo stop") by_token = solve_marine_linear(spec, cancel=token) diff --git a/tests/test_marine_link.py b/tests/test_marine_link.py index 75e21d92f..0647348d3 100644 --- a/tests/test_marine_link.py +++ b/tests/test_marine_link.py @@ -7,8 +7,8 @@ import numpy as np import pytest from scipy.spatial.transform import Rotation -from anysolver.marine_rigid import RigidBody6D, RigidBodyState -from anysolver.marine_link import MechanicalLink6D, MarineLinkError +from anyfesolver.marine_rigid import RigidBody6D, RigidBodyState +from anyfesolver.marine_link import MechanicalLink6D, MarineLinkError def close(actual, expected, tol=1e-10): diff --git a/tests/test_marine_mechanical.py b/tests/test_marine_mechanical.py index db557c1e6..46de49c08 100644 --- a/tests/test_marine_mechanical.py +++ b/tests/test_marine_mechanical.py @@ -8,10 +8,10 @@ import numpy as np import pytest from scipy.spatial.transform import Rotation -from anysolver.marine_rigid import RigidBody6D -from anysolver.marine_link import MechanicalLink6D -from anysolver.marine_contributions import DynamicContribution, ContributionResult, HISTORY_CHART -from anysolver.marine_mechanical import ( +from anyfesolver.marine_rigid import RigidBody6D +from anyfesolver.marine_link import MechanicalLink6D +from anyfesolver.marine_contributions import DynamicContribution, ContributionResult, HISTORY_CHART +from anyfesolver.marine_mechanical import ( MarineMechanicalModel, MarineMechanicalRunSpec, MarineMechanicalSolveError, solve_marine_mechanical) diff --git a/tests/test_marine_mooring.py b/tests/test_marine_mooring.py index 2dfa2d26c..2cf7c7bde 100644 --- a/tests/test_marine_mooring.py +++ b/tests/test_marine_mooring.py @@ -5,12 +5,12 @@ import pytest from scipy import sparse -from anysolver.marine_mooring import ( +from anyfesolver.marine_mooring import ( DynamicLineNodeEndpoint as Node, FixedEndpoint as Anchor, RigidBodyAttachmentEndpoint as Fairlead, MooringLine, MooringLineAssembler, MooringLineError, MooringNodeState, ) -from anysolver.marine_rigid import RigidBody6D, CHART_BRANCH_MARGIN +from anyfesolver.marine_rigid import RigidBody6D, CHART_BRANCH_MARGIN def line(endpoints, *, rest=.8, ea=100., damping=4., mass=2., area=.001): diff --git a/tests/test_marine_mooring_contact.py b/tests/test_marine_mooring_contact.py index c0d6161df..331e6509d 100644 --- a/tests/test_marine_mooring_contact.py +++ b/tests/test_marine_mooring_contact.py @@ -5,11 +5,11 @@ import numpy as np import pytest from scipy import sparse -from anysolver.marine_seabed import SeabedContact -from anysolver.marine_mooring import (MooringLineError,MooringNodeState, +from anyfesolver.marine_seabed import SeabedContact +from anyfesolver.marine_mooring import (MooringLineError,MooringNodeState, CONTACT_API_VERSION,data_to_dict,data_from_dict) -from anysolver.marine_rigid import RigidBody6D -from anysolver.marine_mechanical import (MarineMechanicalModel,MarineMechanicalRunSpec, +from anyfesolver.marine_rigid import RigidBody6D +from anyfesolver.marine_mechanical import (MarineMechanicalModel,MarineMechanicalRunSpec, MarineMechanicalSolveError,solve_marine_mechanical,model_to_dict,model_from_dict,result_to_dict) from test_marine_mooring import coupled_case,fixed_case,perturb @@ -160,7 +160,7 @@ def test_failed_combined_contact_trial_preserves_last_body_node_history_and_evid pytest.importorskip('anyloads', reason='optional marine-morison provider is not installed') from anyloads.marine import AiryEnvironment from anyloads.marine_line import LineHydrodynamics - from anysolver.marine_contributions import DynamicContribution,ContributionResult,HISTORY_CHART + from anyfesolver.marine_contributions import DynamicContribution,ContributionResult,HISTORY_CHART model,states,nodes=contact_oscillator(0.) class Memory(DynamicContribution): contribution_id='memory';ownership_key='contact-test-memory';history_basis=HISTORY_CHART diff --git a/tests/test_marine_mooring_driver.py b/tests/test_marine_mooring_driver.py index 6c26ef8c5..d7cadcdab 100644 --- a/tests/test_marine_mooring_driver.py +++ b/tests/test_marine_mooring_driver.py @@ -5,12 +5,12 @@ import numpy as np import pytest -from anysolver.marine_mooring import (MooringLine,MooringLineAssembler,MooringNodeState, +from anyfesolver.marine_mooring import (MooringLine,MooringLineAssembler,MooringNodeState, FixedEndpoint,DynamicLineNodeEndpoint as Node,RigidBodyAttachmentEndpoint as Fairlead) -from anysolver.marine_rigid import RigidBody6D -from anysolver.marine_contributions import (WorldWrenchContribution,DynamicContribution, +from anyfesolver.marine_rigid import RigidBody6D +from anyfesolver.marine_contributions import (WorldWrenchContribution,DynamicContribution, ContributionResult,HISTORY_CHART) -from anysolver.marine_mechanical import (MarineMechanicalModel,MarineMechanicalRunSpec, +from anyfesolver.marine_mechanical import (MarineMechanicalModel,MarineMechanicalRunSpec, MarineMechanicalInputError,MarineMechanicalSolveError,solve_marine_mechanical, model_to_dict,model_from_dict,result_to_dict,MOORING_API_VERSION,API_VERSION) @@ -106,7 +106,7 @@ def test_named_model_roundtrip_and_old_schema_cannot_erase_lines(): old=model_to_dict(replace(model,mooring=None)) assert old['api_version']==API_VERSION and 'mooring' not in old assert model_to_dict(model_from_dict(old))==old - from anysolver.marine_mooring import data_from_dict,MooringLineError + from anyfesolver.marine_mooring import data_from_dict,MooringLineError with pytest.raises(MooringLineError):data_from_dict(encoded['mooring'],('invalid',)) diff --git a/tests/test_marine_morison.py b/tests/test_marine_morison.py index 946c99ab1..fd9ec88ac 100644 --- a/tests/test_marine_morison.py +++ b/tests/test_marine_morison.py @@ -6,11 +6,11 @@ pytest.importorskip('anyloads.marine',reason='optional native Morison ANYloads API is not installed') from anyloads.marine import (AiryComponent,AiryEnvironment,CurrentProfile, MorisonSection,HydrodynamicOwnership) -from anysolver.marine_rigid import RigidBody6D,RigidBodyState,rotation_matrix -from anysolver.marine_contributions import BodyLayout,CommittedHistory,StepInformation,ContributionSet -from anysolver.marine_morison import (MemberEndpoint,MorisonMember,MorisonMemberSetContribution, +from anyfesolver.marine_rigid import RigidBody6D,RigidBodyState,rotation_matrix +from anyfesolver.marine_contributions import BodyLayout,CommittedHistory,StepInformation,ContributionSet +from anyfesolver.marine_morison import (MemberEndpoint,MorisonMember,MorisonMemberSetContribution, MarineMorisonError,data_to_dict,data_from_dict) -from anysolver.marine_mechanical import (MarineMechanicalModel,MarineMechanicalRunSpec, +from anyfesolver.marine_mechanical import (MarineMechanicalModel,MarineMechanicalRunSpec, MarineMechanicalInputError,model_to_dict,model_from_dict,solve_marine_mechanical) def body(name='a'): @@ -160,7 +160,7 @@ def test_native_driver_initial_added_mass_and_three_step_history_cancellation(): p,states=simple(current=(0.,0.,0.)) section=replace(p.members[0].section,drag_coefficient=0.) p=replace(p,members=(replace(p.members[0],section=section),)) - from anysolver.marine_contributions import WorldWrenchContribution + from anyfesolver.marine_contributions import WorldWrenchContribution wrench=WorldWrenchContribution('push',p.bodies[0],(0.,0.,0.),(0.,2.,0.)) model=MarineMechanicalModel(p.bodies,contributions=(p,wrench)) states={'a':RigidBodyState((0.,0.,-2.))} @@ -210,8 +210,8 @@ class Unknown(MorisonMemberSetContribution):pass def test_native_coupled_fixture_plus_omitted_member_and_drag_correction(): """Explicit synthetic BEM fixture; does not prove mesh/source exclusion.""" from test_marine_potential_flow import fixture - from anysolver.marine_hydro_coordinates import EquilibriumHydroFrame - from anysolver.marine_potential_flow import PotentialFlowDevelopmentContribution + from anyfesolver.marine_hydro_coordinates import EquilibriumHydroFrame + from anyfesolver.marine_potential_flow import PotentialFlowDevelopmentContribution p,states=simple() frame=EquilibriumHydroFrame('a',(0.,0.,-2.),np.eye(3),np.eye(3),(0.,0.,0.)) data=fixture((frame,));data=replace(data,dt=.01) @@ -229,9 +229,9 @@ def test_native_coupled_fixture_plus_omitted_member_and_drag_correction(): def test_mid_trial_cancel_preserves_accepted_fluid_history_and_member_prefix(monkeypatch): """Cancel inside the second-step fluid sampling, before any trial commit.""" from test_marine_potential_flow import fixture - from anysolver.marine_hydro_coordinates import EquilibriumHydroFrame - from anysolver.marine_potential_flow import PotentialFlowDevelopmentContribution - from anysolver.marine_mechanical import result_to_dict + from anyfesolver.marine_hydro_coordinates import EquilibriumHydroFrame + from anyfesolver.marine_potential_flow import PotentialFlowDevelopmentContribution + from anyfesolver.marine_mechanical import result_to_dict p,states=simple() frame=EquilibriumHydroFrame('a',(0.,0.,-2.),np.eye(3),np.eye(3),(0.,0.,0.)) fluid=PotentialFlowDevelopmentContribution(replace(fixture((frame,)),dt=.01)) diff --git a/tests/test_marine_potential_flow.py b/tests/test_marine_potential_flow.py index 90b237c36..3cf4926ca 100644 --- a/tests/test_marine_potential_flow.py +++ b/tests/test_marine_potential_flow.py @@ -6,13 +6,13 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver.marine_rigid import RigidBody6D, RigidBodyState -from anysolver.marine_hydro_coordinates import EquilibriumHydroFrame, evaluate_coupled -from anysolver.marine_contributions import (BodyLayout, CommittedHistory, ContributionSet, +from anyfesolver.marine_rigid import RigidBody6D, RigidBodyState +from anyfesolver.marine_hydro_coordinates import EquilibriumHydroFrame, evaluate_coupled +from anyfesolver.marine_contributions import (BodyLayout, CommittedHistory, ContributionSet, MarineContributionsError, StepInformation) -from anysolver.marine_mechanical import (MarineMechanicalModel, MarineMechanicalRunSpec, +from anyfesolver.marine_mechanical import (MarineMechanicalModel, MarineMechanicalRunSpec, solve_marine_mechanical) -from anysolver.marine_potential_flow import (PotentialFlowDevelopmentData, +from anyfesolver.marine_potential_flow import (PotentialFlowDevelopmentData, PotentialFlowDevelopmentContribution, MarinePotentialFlowError, equilibrium_geometry_hash) diff --git a/tests/test_marine_potential_flow_serde.py b/tests/test_marine_potential_flow_serde.py index 3244afc13..b59f67094 100644 --- a/tests/test_marine_potential_flow_serde.py +++ b/tests/test_marine_potential_flow_serde.py @@ -5,9 +5,9 @@ import numpy as np import pytest from test_marine_potential_flow import fixture, body, frame -from anysolver.marine_potential_flow import (PotentialFlowDevelopmentContribution, +from anyfesolver.marine_potential_flow import (PotentialFlowDevelopmentContribution, PotentialFlowDevelopmentData, MarinePotentialFlowError, data_to_dict, data_from_dict) -from anysolver.marine_mechanical import (MarineMechanicalModel, MarineMechanicalInputError, +from anyfesolver.marine_mechanical import (MarineMechanicalModel, MarineMechanicalInputError, model_to_dict, model_from_dict, model_to_json, model_from_json) pytestmark=pytest.mark.serde diff --git a/tests/test_marine_protocol_failures.py b/tests/test_marine_protocol_failures.py index d48794402..b39363871 100644 --- a/tests/test_marine_protocol_failures.py +++ b/tests/test_marine_protocol_failures.py @@ -6,9 +6,9 @@ import numpy as np import pytest from scipy.spatial.transform import Rotation -from anysolver.marine_rigid import RigidBody6D -from anysolver.marine_contributions import DynamicContribution, ContributionResult, HISTORY_CHART -from anysolver.marine_mechanical import ( +from anyfesolver.marine_rigid import RigidBody6D +from anyfesolver.marine_contributions import DynamicContribution, ContributionResult, HISTORY_CHART +from anyfesolver.marine_mechanical import ( MarineMechanicalModel, MarineMechanicalRunSpec, MarineMechanicalSolveError, solve_marine_mechanical) diff --git a/tests/test_marine_rigid.py b/tests/test_marine_rigid.py index 1c04aaffa..a6dbf38cb 100644 --- a/tests/test_marine_rigid.py +++ b/tests/test_marine_rigid.py @@ -4,7 +4,7 @@ import numpy as np import pytest from scipy.spatial.transform import Rotation -from anysolver.marine_rigid import (RigidBody6D, RigidBodyState, +from anyfesolver.marine_rigid import (RigidBody6D, RigidBodyState, MarineRigidInputError, rotation_matrix, left_jacobian, left_jacobian_rate) def close(actual, expected, tol=1e-10): @@ -187,7 +187,7 @@ def perturb_qdd(sign, j): @pytest.mark.parametrize('theta', [(0., 0., 0.), (1e-9, 2e-9, -1e-9), (.019, 0., 0.), (.021, 0., 0.), (.49, 0., -.3), (.5, .1, .2), (1.2, -.8, .4)]) def test_left_jacobian_second_rate_matches_fd_and_symmetry(theta): - from anysolver.marine_rigid import left_jacobian_second_rate + from anyfesolver.marine_rigid import left_jacobian_second_rate a = np.array([.3, -.7, .5]) e = np.array([-.2, .4, .6]) # Small theta makes the closed-form (1-cos)/t^2 cancellation the FD noise diff --git a/tests/test_marine_seabed.py b/tests/test_marine_seabed.py index 73e7b1701..8774ca474 100644 --- a/tests/test_marine_seabed.py +++ b/tests/test_marine_seabed.py @@ -3,7 +3,7 @@ from dataclasses import FrozenInstanceError import numpy as np import pytest -from anysolver.marine_seabed import SeabedContact,SeabedContactError,seabed_contact_force +from anyfesolver.marine_seabed import SeabedContact,SeabedContactError,seabed_contact_force def test_closed_form_branches_energy_and_no_tensile_contact(): diff --git a/tests/test_material_history_recovery.py b/tests/test_material_history_recovery.py index 30e59c5b8..61d45214c 100644 --- a/tests/test_material_history_recovery.py +++ b/tests/test_material_history_recovery.py @@ -7,7 +7,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BeamElement, BoundaryCondition, DNVC208MaterialCurve, diff --git a/tests/test_mesh_load_bc_verification.py b/tests/test_mesh_load_bc_verification.py index 496c1eb9e..1c069a62a 100644 --- a/tests/test_mesh_load_bc_verification.py +++ b/tests/test_mesh_load_bc_verification.py @@ -7,7 +7,7 @@ import sys from pathlib import Path -from anysolver import ( +from anyfesolver import ( mesh_load_bc_manifest_cases, run_mesh_load_bc_verification, write_mesh_load_bc_verification_report, diff --git a/tests/test_mesher_improvements.py b/tests/test_mesher_improvements.py index a866d104d..9e78c84d3 100644 --- a/tests/test_mesher_improvements.py +++ b/tests/test_mesher_improvements.py @@ -1,12 +1,12 @@ -"""ANYsolver integration tests for meshes now owned by ANYmesher.""" +"""ANYfeSolver integration tests for meshes now owned by ANYmesher.""" from __future__ import annotations import numpy as np import anymesher -import anysolver.mesh_gen as mesh_gen -from anysolver.elements import BeamElement, ShellElement +import anyfesolver.mesh_gen as mesh_gen +from anyfesolver.elements import BeamElement, ShellElement def _panel() -> mesh_gen.PanelGeometry: diff --git a/tests/test_mixed_shell_quadrature_grouping.py b/tests/test_mixed_shell_quadrature_grouping.py index d7f970651..58cc9b410 100644 --- a/tests/test_mixed_shell_quadrature_grouping.py +++ b/tests/test_mixed_shell_quadrature_grouping.py @@ -7,9 +7,9 @@ import numpy as np import pytest -import anysolver.matrix_assembly as matrix_assembly_module -import anysolver.nonlinear_performance as nonlinear_performance_module -from anysolver import ( +import anyfesolver.matrix_assembly as matrix_assembly_module +import anyfesolver.nonlinear_performance as nonlinear_performance_module +from anyfesolver import ( FEModel, GeneralizedShellSection, QualifiedE4PLS3ShellElement, @@ -17,10 +17,10 @@ assemble_mass_matrix, assemble_stiffness_matrix, ) -from anysolver.activity import ElementActivity -from anysolver.element_capabilities import ElementCapabilityError -from anysolver.elements import LegacyShellElement, ShellElement -from anysolver.matrix_assembly import ( +from anyfesolver.activity import ElementActivity +from anyfesolver.element_capabilities import ElementCapabilityError +from anyfesolver.elements import LegacyShellElement, ShellElement +from anyfesolver.matrix_assembly import ( assemble_external_load_tangent, assemble_geometric_stiffness_matrix, assemble_load_vector, diff --git a/tests/test_modal_rigid_classification.py b/tests/test_modal_rigid_classification.py index 2e38fa19a..2dfee6199 100644 --- a/tests/test_modal_rigid_classification.py +++ b/tests/test_modal_rigid_classification.py @@ -11,14 +11,14 @@ import numpy as np import pytest -import anysolver.modal as modal_module -from anysolver import ( +import anyfesolver.modal as modal_module +from anyfesolver import ( BoundaryCondition, FEModel, FixedSupport, solve_free_vibration, ) -from anysolver.elements import BeamElement +from anyfesolver.elements import BeamElement def _free_free_beam_model(density: float = 2.0) -> FEModel: diff --git a/tests/test_namespace_migration.py b/tests/test_namespace_migration.py new file mode 100644 index 000000000..fccd08f06 --- /dev/null +++ b/tests/test_namespace_migration.py @@ -0,0 +1,46 @@ +"""Read data emitted by the solver immediately before the public namespace move.""" + +import hashlib +import json +from pathlib import Path + +import pytest + +from anyfesolver.general_contact import ( + read_arc_contact_results, + read_static_contact_results, + read_transient_contact_results, +) +from anyfesolver.nonlinear_static import solve_static_nonlinear +from test_nonlinear_restart_checkpoint import _model, _static_kwargs + + +FIXTURES = Path(__file__).parent / "data" / "namespace_migration" +MANIFEST = json.loads((FIXTURES / "manifest.json").read_bytes()) + + +def historical_bytes(name): + data = (FIXTURES / name).read_bytes() + assert hashlib.sha256(data).hexdigest() == MANIFEST["sha256"][name] + return data + + +@pytest.mark.parametrize(("name", "reader"), [ + ("static.json", read_static_contact_results), + ("arc.json", read_arc_contact_results), + ("transient.json", read_transient_contact_results), +]) +def test_detached_archive_preserves_historical_wire_bytes(name, reader): + payload = historical_bytes(name) + assert reader(payload).to_bytes() == payload + + +def test_resume_pre_rename_checkpoint_matches_original_continuation(): + model, load = _model(activity=0.5) + result = solve_static_nonlinear( + model, load, max_load_factor=0.30, num_steps=2, + restart_checkpoint=historical_bytes("restart.json"), **_static_kwargs(), + ) + assert result.status == "completed" + assert result.displacements.tobytes().hex() == MANIFEST["uninterrupted_displacement_hex"] + assert hashlib.sha256(result.restart_checkpoint_bytes()).hexdigest() == MANIFEST["uninterrupted_checkpoint_sha256"] diff --git a/tests/test_namespace_neutral_deepcopy.py b/tests/test_namespace_neutral_deepcopy.py index b06942e27..854cad455 100644 --- a/tests/test_namespace_neutral_deepcopy.py +++ b/tests/test_namespace_neutral_deepcopy.py @@ -9,18 +9,18 @@ import numpy as np import pytest -from anysolver import FEModel -from anysolver.elements import BeamElement, Element, ShellElement -from anysolver.imperfections import ImperfectionField, apply_imperfection -from anysolver.e4_pl_s3_state import resolved_material_descriptor -from anysolver.nonlinear_restart import ( +from anyfesolver import FEModel +from anyfesolver.elements import BeamElement, Element, ShellElement +from anyfesolver.imperfections import ImperfectionField, apply_imperfection +from anyfesolver.e4_pl_s3_state import resolved_material_descriptor +from anyfesolver.nonlinear_restart import ( analysis_configuration_fingerprint, canonical_checkpoint_json_bytes, load_nonlinear_checkpoint, model_configuration_descriptor, model_configuration_fingerprint, ) -from anysolver.shell_sections import GeneralizedShellSection +from anyfesolver.shell_sections import GeneralizedShellSection class _SlottedBeamElement(BeamElement): diff --git a/tests/test_native_affinity_fallback.py b/tests/test_native_affinity_fallback.py index de00b2772..b8835a5cf 100644 --- a/tests/test_native_affinity_fallback.py +++ b/tests/test_native_affinity_fallback.py @@ -2,11 +2,11 @@ from importlib.util import find_spec import numpy as np import pytest -from anysolver import (BoundaryCondition,FixedSupport,LoadCase,PatternCase,RecoveryConfig,ResourceConfig, +from anyfesolver import (BoundaryCondition,FixedSupport,LoadCase,PatternCase,RecoveryConfig,ResourceConfig, PreparedStaticCapabilityError,prepare_static_response_evaluator,export_recovery_capsule,export_recovery_capsule_to_sink) -from anysolver.fe_core import FEModel -from anysolver.elements import BeamElement -from anysolver.prepared_static_numeric import NumericCase +from anyfesolver.fe_core import FEModel +from anyfesolver.elements import BeamElement +from anyfesolver.prepared_static_numeric import NumericCase from test_result_capsule_numeric import assert_identical from test_result_capsule_replay import capsule_component @@ -91,7 +91,7 @@ def test_opt_in_is_restricted_to_library(): def test_opt_in_probe_collector_never_admits_other_failures(monkeypatch,failure): # This private classifier test uses controlled records only to discriminate # refusal branches; it supplies no source evaluator/certification authority. - import anysolver.prepared_static_response as response + import anyfesolver.prepared_static_response as response primitives=('axial_stress','bending_stress_y','bending_stress_z','shear_stress_y','shear_stress_z','torsional_stress') zero={name:np.float64(0.) for name in primitives};zero.update(von_mises=np.float64(0.),tag='fixed') schema=response._library_schema(7,zero) @@ -124,7 +124,7 @@ def test_callback_mutation_refuses_normal_archive_publication(tmp_path,monkeypat if find_spec("anypost") is None: pytest.importorskip("anypost") import anypost - import anysolver.prepared_static_response as response + import anyfesolver.prepared_static_response as response path=tmp_path/'existing.h5';previous=b'previous destination preserved';path.write_bytes(previous) with prepare(False,numerical_affinity_fallback=True) as evaluator: class CallerSink: @@ -152,8 +152,8 @@ def capsule_failed(self,record):return self.native.capsule_failed(record) @pytest.mark.parametrize('execution',['auto','records']) def test_native_cancel_is_outside_owned_scope_and_no_valid_archive(tmp_path,execution): - from anysolver import SolveCancelled - from anysolver.prepared_static_recovery import _OWNED_RECOVERY_SCOPE + from anyfesolver import SolveCancelled + from anyfesolver.prepared_static_recovery import _OWNED_RECOVERY_SCOPE if find_spec("anypost") is None: pytest.importorskip("anypost") import anypost @@ -177,7 +177,7 @@ def test_public_cancel_never_replaces_previous_destination(tmp_path,execution,at if find_spec("anypost") is None: pytest.importorskip("anypost") import anypost - from anysolver import CancellationToken,SolveCancelled + from anyfesolver import CancellationToken,SolveCancelled token=CancellationToken();path=tmp_path/'previous.h5';path.write_bytes(b'previous') with prepare(False,numerical_affinity_fallback=True) as evaluator: native=anypost.ArchiveSink(path) @@ -204,7 +204,7 @@ def capsule_stored(self,*args): @pytest.mark.parametrize('execution',['auto','records']) def test_memory_export_observes_its_token_not_preparation_token(execution): - from anysolver import CancellationToken,SolveCancelled + from anyfesolver import CancellationToken,SolveCancelled prep=CancellationToken();export=CancellationToken() with prepare(False,numerical_affinity_fallback=True,cancellation_token=prep) as evaluator: prep.cancel('preparation token is not retained') @@ -219,7 +219,7 @@ def test_export_token_cannot_mutate_response_authority(tmp_path): if find_spec("anypost") is None: pytest.importorskip("anypost") import anypost - from anysolver.prepared_static_recovery import _OWNED_RECOVERY_SCOPE + from anyfesolver.prepared_static_recovery import _OWNED_RECOVERY_SCOPE with prepare(False,numerical_affinity_fallback=True) as evaluator: class Token: def raise_if_cancelled(self,stage): @@ -256,7 +256,7 @@ def test_actual_unrelated_shell_basis_survives_beam_native_namespace(): def test_native_metadata_and_numeric_workspace_obey_resource_policy(tmp_path): - from anysolver.recovery import ResourcePolicyError + from anyfesolver.recovery import ResourcePolicyError if find_spec("anypost") is None: pytest.importorskip("anypost") import anypost @@ -273,8 +273,8 @@ def test_source_principal_refusal_and_public_extreme_certification_refusal(tmp_p if find_spec("anypost") is None: pytest.importorskip("anypost") import anypost,json - from anysolver.prepared_static_numeric import source_fields - from anysolver.prepared_static_loads import PreparedStaticError + from anyfesolver.prepared_static_numeric import source_fields + from anyfesolver.prepared_static_loads import PreparedStaticError from test_result_capsule_export import _rotated_shell_model from test_prepared_static_evaluator import _shell_case names=('membrane_xx','membrane_yy','membrane_xy','bending_xx','bending_yy','bending_xy','shear_xz','shear_yz') @@ -332,7 +332,7 @@ def test_actual_archive_sink_native_complete_rows_roundtrip(tmp_path,mixed): def test_conditional_equivalent_namespace_is_stored_when_vm_is_stored(): - from anysolver.result_capsule import _CapsuleExport + from anyfesolver.result_capsule import _CapsuleExport with prepare(True,numerical_affinity_fallback=True) as evaluator: export=_CapsuleExport(evaluator,[PatternCase('a',{})],model_identity='m',mesh_identity='s') # Private descriptor discriminator, not admission of a partial-input @@ -348,7 +348,7 @@ def test_conditional_equivalent_namespace_is_stored_when_vm_is_stored(): def test_native_mapping_detached_and_accounting_is_conservative(): - from anysolver.prepared_static_response import _library_storage_bytes + from anyfesolver.prepared_static_response import _library_storage_bytes with prepare(False,numerical_affinity_fallback=True) as evaluator: native=evaluator._native_affinity_fallbacks[4808] mapping=evaluator._snapshot.recovery_compilation.elements[4808].dof_mapping @@ -426,9 +426,9 @@ def test_public_export_mixed_batch_two_auto_records_and_actual_native_work(selec def test_missing_native_selected_field_chains_typed_helper_refusal(): - from anysolver.prepared_static_numeric import prepare_numeric_plan,recover_numeric_cases - from anysolver.prepared_static_response import _native_affinity_record - from anysolver.prepared_static_loads import PreparedStaticError + from anyfesolver.prepared_static_numeric import prepare_numeric_plan,recover_numeric_cases + from anyfesolver.prepared_static_response import _native_affinity_record + from anyfesolver.prepared_static_loads import PreparedStaticError with prepare(False,numerical_affinity_fallback=True) as evaluator: snapshot=evaluator._snapshot plan=prepare_numeric_plan(snapshot,evaluator._element_library,evaluator._recovery,evaluator._native_affinity_fallbacks) diff --git a/tests/test_native_authority_dag.py b/tests/test_native_authority_dag.py index 0d62a678e..ac4c4e6f6 100644 --- a/tests/test_native_authority_dag.py +++ b/tests/test_native_authority_dag.py @@ -2,9 +2,9 @@ from importlib.util import find_spec import types import pytest -from anysolver.boundary import _callable_authority, _callable_authority_matches -from anysolver._native_authority_dag import intern_facts, matches -from anysolver import prepared_static_loads as loads +from anyfesolver.boundary import _callable_authority, _callable_authority_matches +from anyfesolver._native_authority_dag import intern_facts, matches +from anyfesolver import prepared_static_loads as loads def fact(f): @@ -67,7 +67,7 @@ def cyclic():return cyclic def test_generation_counter_exception_matches_literal_type_rule(): accepted_generation=1 def require():return accepted_generation - require=types.FunctionType(require.__code__,{'__name__':'anysolver._qualified_authority_epoch'},closure=require.__closure__) + require=types.FunctionType(require.__code__,{'__name__':'anyfesolver._qualified_authority_epoch'},closure=require.__closure__) require.__qualname__='_AuthorityEpochManager.bind..require' captured=fact(require) cell=require.__closure__[0] @@ -77,7 +77,7 @@ def require():return accepted_generation @pytest.mark.parametrize('change',['alias','code','globals']) def test_optimized_matcher_is_validated_before_use(monkeypatch,change): - import anysolver._native_authority_dag as dag + import anyfesolver._native_authority_dag as dag if change=='alias':monkeypatch.setattr(loads,'_native_authority_matches',lambda *a:True) elif change=='code': def forged(member,authority,memo):return True @@ -87,14 +87,14 @@ def forged(member,authority,memo):return True def test_class_and_descriptor_mutation_is_still_checked(monkeypatch): - from anysolver.elements import BeamElement + from anyfesolver.elements import BeamElement loads.require_native_source_authority() monkeypatch.setattr(BeamElement,'native_dag_probe',property(lambda self:0),raising=False) with pytest.raises(loads.PreparedStaticCapabilityError,match='class executable'):loads.require_native_source_authority() def test_plan_replacement_refused_by_existing_response_binding(monkeypatch): - from anysolver.prepared_static_response import PreparedStaticResponseEvaluator,_require_response_authority + from anyfesolver.prepared_static_response import PreparedStaticResponseEvaluator,_require_response_authority owner=object.__new__(PreparedStaticResponseEvaluator) owner._numerical_affinity_fallback=owner._native_affinity_mode_binding=False owner._native_affinity_binding=None @@ -112,7 +112,7 @@ def test_globals_still_checked_each_guard(monkeypatch): @pytest.mark.parametrize('name',['id','type','all','len','zip','any']) def test_absent_builtin_shadow_refused_before_memo_use(monkeypatch,name): - import anysolver._native_authority_dag as dag + import anyfesolver._native_authority_dag as dag function=next(row[0] for row in loads._NATIVE_HELPER_FACTS[1:] if not row[0].__closure__) def forged(*args,**kwargs):return True monkeypatch.setattr(dag,name,lambda *args:0,raising=False) @@ -123,7 +123,7 @@ def forged(*args,**kwargs):return True @pytest.mark.parametrize('name',['id','type','all','len','zip','any']) def test_absent_builtin_shadow_alone_rejected_with_unchanged_function(monkeypatch,name): - import anysolver._native_authority_dag as dag + import anyfesolver._native_authority_dag as dag function,authority,_=loads._NATIVE_HELPER_FACTS[0] monkeypatch.setattr(dag,name,lambda *args:0,raising=False) assert _callable_authority_matches(function,authority) @@ -143,8 +143,8 @@ def test_callback_builtin_shadow_observed_at_original_guard(tmp_path,monkeypatch if find_spec("anypost") is None: pytest.importorskip("anypost") import anypost - import anysolver._native_authority_dag as dag - from anysolver import PatternCase,export_recovery_capsule_to_sink + import anyfesolver._native_authority_dag as dag + from anyfesolver import PatternCase,export_recovery_capsule_to_sink from test_native_affinity_fallback import prepare function=next(row[0] for row in loads._NATIVE_HELPER_FACTS[1:] if not row[0].__closure__) original_code=function.__code__ diff --git a/tests/test_native_boundary_backtrack_schedule.py b/tests/test_native_boundary_backtrack_schedule.py index b9cc13fb6..8b81824ce 100644 --- a/tests/test_native_boundary_backtrack_schedule.py +++ b/tests/test_native_boundary_backtrack_schedule.py @@ -11,8 +11,8 @@ import pytest from scipy import sparse -from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver -from anysolver._stiffened_shell_increment_control import FiniteIncrementFailure +from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver +from anyfesolver._stiffened_shell_increment_control import FiniteIncrementFailure # Observed equilibrium ratio of the saved failing prefix attempt; the exact # value only fixes the merit scale, no tolerance depends on it. diff --git a/tests/test_native_dyadic_interval_inertia.py b/tests/test_native_dyadic_interval_inertia.py index 209a68c32..706c61489 100644 --- a/tests/test_native_dyadic_interval_inertia.py +++ b/tests/test_native_dyadic_interval_inertia.py @@ -2,8 +2,8 @@ from fractions import Fraction import numpy as np import pytest -from anysolver import _native_dyadic_interval_inertia as dyadic -from anysolver import _native_exact_shift_inertia as exact +from anyfesolver import _native_dyadic_interval_inertia as dyadic +from anyfesolver import _native_exact_shift_inertia as exact from test_native_fraction_free_inertia import rational_inertia diff --git a/tests/test_native_dynamic_main_example.py b/tests/test_native_dynamic_main_example.py index e4dcbe019..8e38a0a2d 100644 --- a/tests/test_native_dynamic_main_example.py +++ b/tests/test_native_dynamic_main_example.py @@ -35,10 +35,10 @@ def capture(*args, **kwargs): assert provenance["production_qualified"] is False assert provenance["restart_supported"] is True assert provenance["profile_id"] == "GE_BEAM3_NATIVE_CONTACT_FREE_FINITE_VELOCITY_DEV_V2" - import anysolver.ge_beam3_native_dynamics as public - import anysolver._ge_beam3_native_dynamic_analysis as wrapper - import anysolver._ge_beam3_native_midpoint as midpoint - import anysolver._ge_beam3_dynamic_elastic_state as elastic - import anysolver._ge_beam3_centered_finite_inertia as inertia + import anyfesolver.ge_beam3_native_dynamics as public + import anyfesolver._ge_beam3_native_dynamic_analysis as wrapper + import anyfesolver._ge_beam3_native_midpoint as midpoint + import anyfesolver._ge_beam3_dynamic_elastic_state as elastic + import anyfesolver._ge_beam3_centered_finite_inertia as inertia for module in (public, wrapper, midpoint, elastic, inertia): - assert Path(module.__file__).resolve().parent == root / "src/anysolver" + assert Path(module.__file__).resolve().parent == root / "src/anyfesolver" diff --git a/tests/test_native_exact_shift_inertia.py b/tests/test_native_exact_shift_inertia.py index 6e5e7b661..0a84ee8e5 100644 --- a/tests/test_native_exact_shift_inertia.py +++ b/tests/test_native_exact_shift_inertia.py @@ -2,8 +2,8 @@ from fractions import Fraction import numpy as np import pytest -from anysolver._native_exact_shift_inertia import exact_inertia -from anysolver._native_exact_shift_chain_modes import inertia, brackets +from anyfesolver._native_exact_shift_inertia import exact_inertia +from anyfesolver._native_exact_shift_chain_modes import inertia, brackets @pytest.mark.parametrize('diagonal', [ diff --git a/tests/test_native_factor_chain_modes.py b/tests/test_native_factor_chain_modes.py index 8aa5ba65d..2b037ec7a 100644 --- a/tests/test_native_factor_chain_modes.py +++ b/tests/test_native_factor_chain_modes.py @@ -3,8 +3,8 @@ import numpy as np import pytest from scipy import linalg -from anysolver.control import CancellationToken, SolveCancelled -import anysolver._native_factor_chain_modes as kernel +from anyfesolver.control import CancellationToken, SolveCancelled +import anyfesolver._native_factor_chain_modes as kernel def solve(f,g,b,free,algebraic,**kw): diff --git a/tests/test_native_fibre_bl5_displacement.py b/tests/test_native_fibre_bl5_displacement.py index 973d9021a..7317e3f11 100644 --- a/tests/test_native_fibre_bl5_displacement.py +++ b/tests/test_native_fibre_bl5_displacement.py @@ -4,11 +4,11 @@ import json import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_displacement_checkpoint import decode_snapshot, encode_snapshot, identities, MAGIC -from anysolver._stiffened_shell_displacement_control import publish -from anysolver._stiffened_shell_affine_endpoint import is_native_point_material, uses_native_material_history +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_displacement_checkpoint import decode_snapshot, encode_snapshot, identities, MAGIC +from anyfesolver._stiffened_shell_displacement_control import publish +from anyfesolver._stiffened_shell_affine_endpoint import is_native_point_material, uses_native_material_history from examples.stiffened_shell_native_fibre_bl5_displacement import ACTIONS, CONTROL, OPTIONS, TARGETS from examples.stiffened_shell_native_fibre_bl5_material import definition @@ -105,7 +105,7 @@ def test_refusals_and_restore_are_atomic(request): untouched=owner(request) with pytest.raises(ValueError): untouched.restore(body+sha256(body).digest()) assert untouched._finite_driver is None and untouched._generation==0 - from anysolver._stiffened_shell_displacement_adaptive import MAGICS + from anyfesolver._stiffened_shell_displacement_adaptive import MAGICS for magic in MAGICS: untouched=owner(request) with pytest.raises(ValueError,match=r'^(?:bounded adaptive displacement checkpoint required|native material BL5 displacement excludes adaptive checkpoints)$'): untouched.restore(magic+saved) @@ -167,7 +167,7 @@ def test_fixed_origin_material_tangent(request,tmp_path): for j in range(len(control._beam_parts)): offset=control._shell_count+6*len(control._beam_ids)+24*j direction[offset+6:offset+24]=np.linspace(-1.,1.,18) - from anysolver._stiffened_shell_ge_finite_experimental import _fibre_recovery + from anyfesolver._stiffened_shell_ge_finite_experimental import _fibre_recovery def branches(st,ev): records,_=_fibre_recovery(control,st,beam,ev[5]) return tuple((f.branch,f.algorithmic_modulus) for row in records for f in row.fibres) diff --git a/tests/test_native_fibre_bl5_mixed_j2_displacement.py b/tests/test_native_fibre_bl5_mixed_j2_displacement.py index d3dc0c243..03c4d5b3c 100644 --- a/tests/test_native_fibre_bl5_mixed_j2_displacement.py +++ b/tests/test_native_fibre_bl5_mixed_j2_displacement.py @@ -6,15 +6,15 @@ import json import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken,SolveCancelled -from anysolver._stiffened_shell_displacement_checkpoint import identities,decode_snapshot +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken,SolveCancelled +from anyfesolver._stiffened_shell_displacement_checkpoint import identities,decode_snapshot from examples.stiffened_shell_native_fibre_bl5_mixed_j2_displacement import definition from examples.stiffened_shell_native_fibre_bl5_displacement import ACTIONS,CONTROL,OPTIONS,TARGETS def family_history(owner,result): """Model-declared families; native fibre rows never include generalized rows.""" - from anysolver._ge_beam3_fibre_section import PhysicalFibreSection + from anyfesolver._ge_beam3_fibre_section import PhysicalFibreSection _,arrays=decode_snapshot(owner,owner.checkpoint()) shell_records={r.element_id:(family,r) for family,records in (("Q4",result.shell_q4_material),("S3",result.shell_s3_material)) for r in records} @@ -104,7 +104,7 @@ def cancel_candidate(*args,**kwargs): patch.setattr(driver,'_advance',cancel_candidate) with pytest.raises(SolveCancelled):owner.solve(ACTIONS,TARGETS[2:],displacement_control=CONTROL,cancellation_token=token,**OPTIONS) assert owner.checkpoint()==saved - from anysolver._ge_beam3_retained_fibre import RetainedFibreOperator + from anyfesolver._ge_beam3_retained_fibre import RetainedFibreOperator with monkeypatch.context() as patch: def changed_material(_operator):raise ValueError('captured retained fibre inventory changed') patch.setattr(RetainedFibreOperator,'guard',changed_material) @@ -149,8 +149,8 @@ def test_yielded_assembled_tangent_and_material_capture(loaded,tmp_path): strain_errors.append(float(np.linalg.norm(deriv-expected)/max(np.linalg.norm(expected),1e-12))) assert max(errors)<=1e-5,errors assert max(strain_errors)<=1e-5,strain_errors - from anysolver._stiffened_shell_s3_material_event import boundary_amount - from anysolver._stiffened_shell_q4_material_event import boundary_amount as q4_boundary + from anyfesolver._stiffened_shell_s3_material_event import boundary_amount + from anyfesolver._stiffened_shell_q4_material_event import boundary_amount as q4_boundary for slots,trial in captured: function=boundary_amount if len(slots)==18 else q4_boundary assert function(trial,np.zeros(len(slots)),origin=trial.origin) is None @@ -158,7 +158,7 @@ def test_yielded_assembled_tangent_and_material_capture(loaded,tmp_path): with pytest.raises(ValueError):function(trial,np.zeros(len(slots)),origin=dict(trial.origin)) if len(slots)==18: changed=dict(trial.origin);changed['initial_generalized_prestrain']=np.asarray(changed['initial_generalized_prestrain']).copy();changed['initial_generalized_prestrain'][0,0]+=1e-6 - from anysolver._stiffened_shell_q4_material_event import _origin_values + from anyfesolver._stiffened_shell_q4_material_event import _origin_values assert _origin_values(changed)!=trial.origin_values assert owner.checkpoint()==saved owner.close() diff --git a/tests/test_native_fibre_boundary_proposal.py b/tests/test_native_fibre_boundary_proposal.py index b39220d78..f1736b58a 100644 --- a/tests/test_native_fibre_boundary_proposal.py +++ b/tests/test_native_fibre_boundary_proposal.py @@ -6,9 +6,9 @@ import numpy as np import pytest -from anysolver._ge_beam3_fibre_cell import FibreCellConjugate, FibreTrialState, CellHistory -from anysolver._ge_beam3_fibre_section import FlowCurve, canonical -from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver +from anyfesolver._ge_beam3_fibre_cell import FibreCellConjugate, FibreTrialState, CellHistory +from anyfesolver._ge_beam3_fibre_section import FlowCurve, canonical +from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver def one_fibre(strain=.49, derivative=.1, *, curve=None, z0=0., p0=0., force=1.): @@ -121,11 +121,11 @@ def test_driver_cache_state_origin_generation_and_legacy_dispatch(): def test_actual_cell_capture_preserves_legacy_response_bytes_and_origin(): - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss from examples.stiffened_shell_native_fibre_bl5_material import definition owner=ss.create_analysis(definition=definition()) try: - from anysolver._ge_beam3_retained_fibre import RetainedFibreOperator + from anyfesolver._ge_beam3_retained_fibre import RetainedFibreOperator element, _, origin=next(part for part in owner._beam_parts if type(part[0].operator) is RetainedFibreOperator) cell=element.operator.cell before=canonical(origin) @@ -141,7 +141,7 @@ def test_actual_cell_capture_preserves_legacy_response_bytes_and_origin(): # Capturing from a one-shot load iterable also owns the validated p. generated=cell.response(iter([0.]*18), origin, capture_trial=True)['_trial_state'] assert generated.resultants == (0.,)*18 - from anysolver._ge_beam3_retained_fibre import Evaluation, BoundaryEvaluation + from anyfesolver._ge_beam3_retained_fibre import Evaluation, BoundaryEvaluation operator=element.operator args=(operator.reference.coordinates, np.zeros((3,3)), operator.reference.nodal_triads, np.tile(np.eye(3),(2,1,1)), np.zeros(18)) diff --git a/tests/test_native_fraction_free_inertia.py b/tests/test_native_fraction_free_inertia.py index dbec6f320..faf95e7f5 100644 --- a/tests/test_native_fraction_free_inertia.py +++ b/tests/test_native_fraction_free_inertia.py @@ -6,7 +6,7 @@ from fractions import Fraction import numpy as np import pytest -from anysolver import _native_exact_shift_inertia as implementation +from anyfesolver import _native_exact_shift_inertia as implementation def rational_inertia(h, mass, shift): diff --git a/tests/test_native_guard_code_grammar.py b/tests/test_native_guard_code_grammar.py index 65c6e4bba..a54809d5f 100644 --- a/tests/test_native_guard_code_grammar.py +++ b/tests/test_native_guard_code_grammar.py @@ -3,12 +3,12 @@ import types import weakref import pytest -from anysolver import boundary, static_batch +from anyfesolver import boundary, static_batch from test_native_guard_cpp import plan, literal @pytest.fixture def native(): - return pytest.importorskip('anysolver._native_guard') + return pytest.importorskip('anyfesolver._native_guard') @pytest.mark.parametrize('mutation', ['code', 'default', 'closure', 'global', 'alias']) def test_admitted_code_still_observes_mutable_facts(native, mutation): diff --git a/tests/test_native_guard_cpp.py b/tests/test_native_guard_cpp.py index 6a2971f65..f20303ea6 100644 --- a/tests/test_native_guard_cpp.py +++ b/tests/test_native_guard_cpp.py @@ -4,12 +4,12 @@ import sys import types import pytest -from anysolver import boundary,static_batch,prepared_static_loads as loads -from anysolver import _native_authority_dag as dag,_native_guard_dispatch as dispatch +from anyfesolver import boundary,static_batch,prepared_static_loads as loads +from anyfesolver import _native_authority_dag as dag,_native_guard_dispatch as dispatch @pytest.fixture def native(): - return pytest.importorskip('anysolver._native_guard') + return pytest.importorskip('anyfesolver._native_guard') def plan(native,cls,functions=()): classes={cls:static_batch._class_state(cls)} @@ -32,7 +32,7 @@ def test_actual_all_original_facts(native): after=native.statistics() assert after['class_facts']-before['class_facts']==18 assert after['helper_facts']-before['helper_facts']==len(loads._NATIVE_HELPER_FACTS) - assert len(loads._NATIVE_HELPER_FACTS)-1==1274 + assert len(loads._NATIVE_HELPER_FACTS)-1==1304 @pytest.mark.parametrize('mutation',['code','defaults','keywords','closure','empty','method','property','mro']) def test_mutable_metadata_literal_differential(native,mutation): @@ -79,6 +79,28 @@ class A:pass assert literal(classes,helpers) assert native.compare(value,classes,helpers) is True +def test_class_inventory_uses_member_names_without_comparing_values(native): + class Member: + def __eq__(self,other):pytest.fail('member equality invoked') + def __lt__(self,other):pytest.fail('member ordering invoked') + class A: + zeta=Member() + alpha=Member() + value,classes,helpers=plan(native,A) + alpha=A.alpha + zeta=A.zeta + del A.zeta + A.zeta=zeta + assert native.compare(value,classes,helpers) is True + A.alpha=Member() + assert native.compare(value,classes,helpers) is False + A.alpha=alpha + A.extra=Member() + assert native.compare(value,classes,helpers) is False + del A.extra + del A.zeta + assert native.compare(value,classes,helpers) is False + def test_cycle_path_and_no_cache_across_guards(native): def factory(): def f():return g @@ -172,7 +194,7 @@ def test_dispatch_absent_builtin_shadow_refuses_without_body(native,monkeypatch) @pytest.mark.parametrize('owner',['modules','native']) def test_unknown_colliding_mapping_key_does_not_execute_equality(native,owner): calls=[] - name='anysolver._native_guard' if owner=='modules' else 'compare' + name='anyfesolver._native_guard' if owner=='modules' else 'compare' class Key: def __hash__(self):return hash(name) def __eq__(self,other):calls.append('eq');return False @@ -187,7 +209,7 @@ def test_owned_generation_current_classification_exact_int(native): def factory(): accepted_generation=1 def require():return accepted_generation - require.__module__='anysolver._qualified_authority_epoch' + require.__module__='anyfesolver._qualified_authority_epoch' require.__qualname__='_AuthorityEpochManager.bind..require' return require function=factory() diff --git a/tests/test_native_large_factor_modal.py b/tests/test_native_large_factor_modal.py index f301ecf81..a3d2852bf 100644 --- a/tests/test_native_large_factor_modal.py +++ b/tests/test_native_large_factor_modal.py @@ -2,13 +2,13 @@ from concurrent.futures import ThreadPoolExecutor import numpy as np import pytest -from anysolver import _native_modal_capacity as capacity -from anysolver import _native_large_factor_chain as large -from anysolver._dyadic_bilinear import _capture,_multiply,_transpose,_rounded -from anysolver._dyadic_factor_chain import reassemble_chain_exact_binary64 as chain -from anysolver._native_paired_factor_chain_modes import solve_paired_factor_chain_modes as old,apply_mode_map -from anysolver._ge_beam3_p5_seeded.core import canonical -from anysolver.control import CancellationToken,SolveCancelled +from anyfesolver import _native_modal_capacity as capacity +from anyfesolver import _native_large_factor_chain as large +from anyfesolver._dyadic_bilinear import _capture,_multiply,_transpose,_rounded +from anyfesolver._dyadic_factor_chain import reassemble_chain_exact_binary64 as chain +from anyfesolver._native_paired_factor_chain_modes import solve_paired_factor_chain_modes as old,apply_mode_map +from anyfesolver._ge_beam3_p5_seeded.core import canonical +from anyfesolver.control import CancellationToken,SolveCancelled @pytest.mark.parametrize('seed',(1,23,44)) diff --git a/tests/test_native_material_bl5_arc_same_origin_jacobian.py b/tests/test_native_material_bl5_arc_same_origin_jacobian.py index 061afa88a..e523c5a8f 100644 --- a/tests/test_native_material_bl5_arc_same_origin_jacobian.py +++ b/tests/test_native_material_bl5_arc_same_origin_jacobian.py @@ -12,12 +12,12 @@ import pytest from scipy import sparse -from anysolver import stiffened_shell as ss -from anysolver._stiffened_shell_arc_trial import correct, path_row -from anysolver._stiffened_shell_ge_finite_experimental import _fibre_recovery -from anysolver._stiffened_shell_beam_history import arrays as beam_arrays -from anysolver._stiffened_shell_q4_material_event import _origin_values -from anysolver.plasticity import _jit_consistency_residual_scalar +from anyfesolver import stiffened_shell as ss +from anyfesolver._stiffened_shell_arc_trial import correct, path_row +from anyfesolver._stiffened_shell_ge_finite_experimental import _fibre_recovery +from anyfesolver._stiffened_shell_beam_history import arrays as beam_arrays +from anyfesolver._stiffened_shell_q4_material_event import _origin_values +from anyfesolver.plasticity import _jit_consistency_residual_scalar from examples.stiffened_shell_native_fibre_bl5_mixed_j2_displacement import definition from examples.stiffened_shell_native_fibre_bl5_displacement import ACTIONS, CONTROL, OPTIONS, TARGETS from examples.stiffened_shell_native_material_bl5_arc import arc_control @@ -337,7 +337,7 @@ def test_authentic_old_loaded_checkpoint_current_owner_recovery(request, tmp_pat physical = {row.element_id for row in loaded.beam_fibre_material} generalized = {row.element_id for row in loaded.beam_generalized_material} assert physical and generalized and physical.isdisjoint(generalized) - from anysolver._stiffened_shell_displacement_checkpoint import decode_snapshot + from anyfesolver._stiffened_shell_displacement_checkpoint import decode_snapshot raw = owner.checkpoint() _, payload = decode_snapshot(owner, raw) for name, value in (('frames', loaded.beam_frames), ('cells', loaded.cell_frames), diff --git a/tests/test_native_reassembled_factor_modes.py b/tests/test_native_reassembled_factor_modes.py index e0d1578a9..dfeb7fdd0 100644 --- a/tests/test_native_reassembled_factor_modes.py +++ b/tests/test_native_reassembled_factor_modes.py @@ -3,8 +3,8 @@ import numpy as np import pytest from scipy import linalg -from anysolver.control import CancellationToken, SolveCancelled -import anysolver._native_reassembled_factor_modes as kernel +from anyfesolver.control import CancellationToken, SolveCancelled +import anyfesolver._native_reassembled_factor_modes as kernel def solve(f,g,b,free,algebraic,**kw): diff --git a/tests/test_native_reference_factor_spectrum.py b/tests/test_native_reference_factor_spectrum.py index dc20f5b9f..a8ecb2859 100644 --- a/tests/test_native_reference_factor_spectrum.py +++ b/tests/test_native_reference_factor_spectrum.py @@ -3,9 +3,9 @@ import numpy as np import pytest -from anysolver._native_reference_factor_spectrum import solve_reference_factor_spectrum as solve -from anysolver._native_stationary_spectrum import solve_stationary_spectrum -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver._native_reference_factor_spectrum import solve_reference_factor_spectrum as solve +from anyfesolver._native_stationary_spectrum import solve_stationary_spectrum +from anyfesolver.control import CancellationToken, SolveCancelled from docs.reference_cases.ge_beam3_slender_spectrum_probe import factors diff --git a/tests/test_native_rotation_state.py b/tests/test_native_rotation_state.py index 09eaab37c..74d6cb325 100644 --- a/tests/test_native_rotation_state.py +++ b/tests/test_native_rotation_state.py @@ -7,7 +7,7 @@ import numpy as np import pytest -from anysolver._native_rotation_state import ( +from anyfesolver._native_rotation_state import ( AcceptedConfigurationMismatchError, NativeRotationStateStore, NativeRotationTransactionError, @@ -17,14 +17,14 @@ rotation_exponential, validate_proper_rotation_matrices, ) -from anysolver.fe_core import FEModel -from anysolver.elements import ShellElement -from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement -from anysolver.e4_pl_s3_state import ( +from anyfesolver.fe_core import FEModel +from anyfesolver.elements import ShellElement +from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement +from anyfesolver.e4_pl_s3_state import ( reconstruct_director_triad, seal_committed_s3_state, ) -from anysolver.nonlinear_state import ( +from anyfesolver.nonlinear_state import ( NonlinearStateStore, StateMaterializationPolicy, begin_state_evaluation, diff --git a/tests/test_native_signed_factor_modes.py b/tests/test_native_signed_factor_modes.py index df4eb342b..ed4c82c45 100644 --- a/tests/test_native_signed_factor_modes.py +++ b/tests/test_native_signed_factor_modes.py @@ -3,8 +3,8 @@ import numpy as np import pytest from scipy import linalg -from anysolver._native_signed_factor_modes import solve_signed_factor_modes -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver._native_signed_factor_modes import solve_signed_factor_modes +from anyfesolver.control import CancellationToken, SolveCancelled def test_negative_high_contrast_mode_and_mass_normalized_eigenvector(): @@ -48,7 +48,7 @@ def test_signed_trace_elimination_and_modes_match_moderate_dense_pencil(): def test_cancelled_input_is_rejected_before_numerical_work(monkeypatch): token = CancellationToken(); token.cancel('test cancellation') - import anysolver._native_signed_factor_modes as kernel + import anyfesolver._native_signed_factor_modes as kernel monkeypatch.setattr(kernel, '_reduce', lambda *a: pytest.fail('numerics after cancellation')) with pytest.raises(SolveCancelled): kernel.solve_signed_factor_modes(np.eye(2), np.zeros((2, 2)), np.eye(2), (0, 1), (), @@ -67,7 +67,7 @@ def test_bad_inputs_fail_closed(mutation): def test_cancellation_inside_bracketing_stops_before_mode_extraction(monkeypatch): - import anysolver._native_signed_factor_modes as kernel + import anyfesolver._native_signed_factor_modes as kernel token = CancellationToken(); real = kernel._inertia; calls = [] def cancel(*a): calls.append(1) @@ -81,7 +81,7 @@ def cancel(*a): def test_cooperative_time_limit_stops_before_reduction(monkeypatch): - import anysolver._native_signed_factor_modes as kernel + import anyfesolver._native_signed_factor_modes as kernel times = iter((0., 601.)); monkeypatch.setattr(kernel, 'monotonic', lambda: next(times)) monkeypatch.setattr(kernel, '_reduce', lambda *a: pytest.fail('reduction after deadline')) with pytest.raises(ValueError, match='time limit'): @@ -90,7 +90,7 @@ def test_cooperative_time_limit_stops_before_reduction(monkeypatch): def test_caller_mutation_does_not_change_owned_snapshot(monkeypatch): - import anysolver._native_signed_factor_modes as kernel + import anyfesolver._native_signed_factor_modes as kernel f = np.diag([1., 2.]); g = np.zeros((2, 2)); m = np.eye(2); real = kernel._reduce def mutate(*a): f[:] = 100.; g[:] = -100.; m[:] = 0. diff --git a/tests/test_nodal_stress_recovery.py b/tests/test_nodal_stress_recovery.py index 5b4bd283f..0d5006285 100644 --- a/tests/test_nodal_stress_recovery.py +++ b/tests/test_nodal_stress_recovery.py @@ -5,15 +5,15 @@ import numpy as np import pytest -from anysolver.assembly import solve_linear -from anysolver.boundary import LoadCase -from anysolver.mesh_gen import generate_simple_panel_mesh -from anysolver.results import ( +from anyfesolver.assembly import solve_linear +from anyfesolver.boundary import LoadCase +from anyfesolver.mesh_gen import generate_simple_panel_mesh +from anyfesolver.results import ( _cached_gauss_to_node_extrapolation, _gauss_to_node_extrapolation, recover_nodal_stresses, ) -from anysolver.s4_validity import _membrane_displacement, _single_s4_model +from anyfesolver.s4_validity import _membrane_displacement, _single_s4_model def test_extrapolation_operator_reproduces_matching_polynomials_exactly() -> None: diff --git a/tests/test_nonlinear_analysis_diagnostics.py b/tests/test_nonlinear_analysis_diagnostics.py index 50425499d..589438917 100644 --- a/tests/test_nonlinear_analysis_diagnostics.py +++ b/tests/test_nonlinear_analysis_diagnostics.py @@ -5,11 +5,11 @@ from dataclasses import dataclass, field from typing import Any, Dict -from anysolver.corotational_performance import note_dense_consistent_rotation -from anysolver.nonlinear_analysis_diagnostics import ( +from anyfesolver.corotational_performance import note_dense_consistent_rotation +from anyfesolver.nonlinear_analysis_diagnostics import ( capture_nonlinear_analysis_diagnostics, ) -from anysolver.vectorized_hill48 import record_hill48_execution +from anyfesolver.vectorized_hill48 import record_hill48_execution @dataclass diff --git a/tests/test_nonlinear_beam_shell_coupling.py b/tests/test_nonlinear_beam_shell_coupling.py index 84f5bf177..429c2de97 100644 --- a/tests/test_nonlinear_beam_shell_coupling.py +++ b/tests/test_nonlinear_beam_shell_coupling.py @@ -18,7 +18,7 @@ import pytest from scipy import sparse -from anysolver import ( +from anyfesolver import ( BoundaryCondition, DisplacementControl, FEModel, @@ -26,12 +26,12 @@ create_shell_element, solve_static_nonlinear, ) -from anysolver.assembly import build_constraint_transformation -from anysolver.matrix_assembly import ( +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.matrix_assembly import ( assemble_load_vector, assemble_stiffness_matrix, ) -from anysolver.corotational import ( +from anyfesolver.corotational import ( _rotation_left_jacobian_inverse, _so3_weighted_mean, build_nonlinear_rotating_mpc_map, @@ -42,11 +42,11 @@ rotation_vector_from_matrix, spatial_moment_from_rotation_covector, ) -from anysolver.constraint_audit import constraint_residual_summary -from anysolver.elements import BeamElement, CoupledBeamShellElement -from anysolver.mesh_gen import InterpolatedBeamShellMPCElement -from anysolver.nonlinear_restart import model_configuration_fingerprint -from anysolver.nonlinear_static import _assemble_nonlinear_system +from anyfesolver.constraint_audit import constraint_residual_summary +from anyfesolver.elements import BeamElement, CoupledBeamShellElement +from anyfesolver.mesh_gen import InterpolatedBeamShellMPCElement +from anyfesolver.nonlinear_restart import model_configuration_fingerprint +from anyfesolver.nonlinear_static import _assemble_nonlinear_system def _build_coupled_cantilever( diff --git a/tests/test_nonlinear_beam_shell_slice3.py b/tests/test_nonlinear_beam_shell_slice3.py index 401b4cbc6..8acfa9c82 100644 --- a/tests/test_nonlinear_beam_shell_slice3.py +++ b/tests/test_nonlinear_beam_shell_slice3.py @@ -32,7 +32,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, DisplacementControl, FEModel, @@ -40,20 +40,20 @@ create_shell_element, solve_static_nonlinear, ) -from anysolver.assembly import build_constraint_transformation -from anysolver.corotational import ( +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.corotational import ( SO3MeanDomainError, _so3_weighted_mean, build_nonlinear_rotating_mpc_map, rotation_matrix_from_vector, ) -from anysolver.elements import BeamElement, CoupledBeamShellElement -from anysolver.matrix_assembly import ( +from anyfesolver.elements import BeamElement, CoupledBeamShellElement +from anyfesolver.matrix_assembly import ( assemble_load_vector, assemble_stiffness_matrix, ) -from anysolver.mesh_gen import InterpolatedBeamShellMPCElement -from anysolver.nonlinear_static import ( +from anyfesolver.mesh_gen import InterpolatedBeamShellMPCElement +from anyfesolver.nonlinear_static import ( ShellInitialField, _assemble_nonlinear_system, _weighted_external_load_system, @@ -780,8 +780,8 @@ def test_d1_displacement_control_augmented_factorization_declared_general( actual solve unchanged, so the regression is independent of optional PARDISO availability and does not count a bare SciPy pass as coverage. """ - import anysolver.nonlinear_static as nonlinear_static - from anysolver.linalg import MatrixClass + import anyfesolver.nonlinear_static as nonlinear_static + from anyfesolver.linalg import MatrixClass model, meta = _build_coupled_cantilever("eccentric") load = LoadCase("tip") @@ -825,18 +825,26 @@ def test_intrinsic_mean_two_master_independent_geodesic_and_differential() -> No thetas = [np.array([0.4, -0.2, 0.3]), np.array([-0.3, 0.5, 0.1])] weights = [0.35 * (1.0 + 1.0e-9), 0.65 * (1.0 + 1.0e-9)] - a, b = [Rotation.from_rotvec(t) for t in thetas] - expected = (a * Rotation.from_rotvec(0.65 * (a.inv() * b).as_rotvec())).as_rotvec() + def independent_geodesic(vectors): + a, b = [Rotation.from_rotvec(t) for t in vectors] + return (a * Rotation.from_rotvec(0.65 * (a.inv() * b).as_rotvec())).as_rotvec() + + expected = independent_geodesic(thetas) actual, blocks = _so3_weighted_mean(thetas, weights, "test") np.testing.assert_allclose(actual, expected, rtol=0.0, atol=2.0e-15) for i in range(2): fd = np.empty((3, 3)) for j in range(3): - plus, minus = [t.copy() for t in thetas], [t.copy() for t in thetas] - plus[i][j] += 1.0e-6 - minus[i][j] -= 1.0e-6 - fd[:, j] = (_so3_weighted_mean(plus, weights, "test")[0] - - _so3_weighted_mean(minus, weights, "test")[0]) / 2.0e-6 + # The centered four-point stencil balances O(h**4) truncation + # against O(eps/h) roundoff on the independent SciPy geodesic. + h = np.finfo(float).eps ** 0.2 + samples = [] + for step in (-2, -1, 1, 2): + displaced = [t.copy() for t in thetas] + displaced[i][j] += step * h + samples.append(independent_geodesic(displaced)) + fd[:, j] = ((samples[0] - samples[3]) + + 8.0 * (samples[2] - samples[1])) / (12.0 * h) np.testing.assert_allclose(blocks[i], fd, rtol=1.0e-8, atol=1.0e-10) @@ -852,7 +860,7 @@ def test_intrinsic_mean_ambiguous_or_unadmitted_domain_refused(thetas, weights, def test_dc_zero_span_failed_attempt_is_bounded_and_rolls_back(monkeypatch) -> None: - import anysolver.nonlinear_static as nonlinear_static + import anyfesolver.nonlinear_static as nonlinear_static model, meta = _build_coupled_cantilever("eccentric", nx=2, ny=1) tip = meta["grid"][(meta["nx"], 0)] @@ -891,7 +899,7 @@ def test_dc_accepted_subincrements_receive_independent_cutback_budget(monkeypatc intervals use the actual element assembly, tangent and state transaction. """ import inspect - import anysolver.nonlinear_static as nonlinear_static + import anyfesolver.nonlinear_static as nonlinear_static model, meta = _build_coupled_cantilever("eccentric", nx=2, ny=1) tip = meta["grid"][(meta["nx"], 0)] @@ -976,7 +984,7 @@ def test_dc_quadratic_search_reaches_small_descent_step_within_eight_trials( """ import inspect from scipy import sparse - import anysolver.nonlinear_static as nonlinear_static + import anyfesolver.nonlinear_static as nonlinear_static model, meta = _build_coupled_cantilever("eccentric", nx=2, ny=1) tip = meta["grid"][(meta["nx"], 0)] @@ -1048,7 +1056,7 @@ def test_dc_search_crosses_a_rising_constitutive_shoulder_within_eight_trials(mo """ import inspect from scipy import sparse - import anysolver.nonlinear_static as nonlinear_static + import anyfesolver.nonlinear_static as nonlinear_static model, meta = _build_coupled_cantilever("eccentric", nx=2, ny=1) tip = meta["grid"][(meta["nx"], 0)] dofs = model.mesh.dof_manager.get_node_dofs(tip) @@ -1126,7 +1134,7 @@ def test_dc_trial_domain_refusal_is_backtracked_not_aborted(monkeypatch) -> None must be refused, and the solve must return a classified failure with the committed state preserved, within the bounded subdivision budget. """ - import anysolver.nonlinear_static as nonlinear_static + import anyfesolver.nonlinear_static as nonlinear_static model, meta = _build_coupled_cantilever("interpolated", nx=2, ny=1) tip = meta["grid"][(meta["nx"], 0)] @@ -1182,7 +1190,7 @@ def overshooting_factorize(matrix, matrix_class, signature=None, **kwargs): @pytest.mark.parametrize("plastic_origin", ("elastic", "committed", "trial")) def test_dc_merit_search_requires_actual_trial_or_committed_plasticity(monkeypatch, plastic_origin): import inspect - import anysolver.nonlinear_static as ns + import anyfesolver.nonlinear_static as ns model, meta = _build_coupled_cantilever("eccentric", nx=2, ny=1) tip = meta["grid"][(meta["nx"], 0)] load = LoadCase("tip"); load.add_nodal_load(tip, forces=(0., 0., -100.)) @@ -1282,7 +1290,7 @@ def energy(u): def test_fiber_beam_elastic_limit_retains_objective_rigid_motion(): from test_nonlinear_beam_shell_slice3_continuation import _add_ep_material, CS - import anysolver.corotational as cr + import anyfesolver.corotational as cr model = FEModel("fiber_rigid_motion") _add_ep_material(model, 1.) model.add_node(1, 0., 0., 0.) @@ -1323,7 +1331,7 @@ def test_rotating_geometric_tangent_stencil_stays_in_admitted_domain(boundary): @pytest.mark.parametrize("control_mode", ("force", "force_plain", "displacement")) @pytest.mark.parametrize("refusal", ("once", "all", "unrelated")) def test_trial_domain_recovery_and_unrelated_error_propagation(monkeypatch, control_mode, refusal): - from anysolver.corotational import NonlinearRotatingMPCMap + from anyfesolver.corotational import NonlinearRotatingMPCMap model, meta = _build_coupled_cantilever("interpolated", nx=2, ny=1) tip = meta["grid"][(meta["nx"], 0)] @@ -1397,7 +1405,7 @@ def test_dc_line_search_no_improvement_is_classified_and_rolls_back( the attempt with a classified reason instead of committing a full step that sustains a Newton limit cycle; the committed state is preserved. """ - from anysolver.corotational import NonlinearRotatingMPCMap + from anyfesolver.corotational import NonlinearRotatingMPCMap model, meta = _build_coupled_cantilever("eccentric", nx=2, ny=1) tip = meta["grid"][(meta["nx"], 0)] @@ -1445,7 +1453,7 @@ def irreducible_residual(self, u, force): @pytest.mark.parametrize("refusal", ["none", "domain", "unrepresentable", "unrelated"]) def test_material_event_localization_is_bounded_pure_and_fails_closed(refusal): - from anysolver._nonlinear_events import MaterialEvents, crossed_material_event + from anyfesolver._nonlinear_events import MaterialEvents, crossed_material_event event = 6.4e-8 q = np.array([1.0e20 if refusal == "unrepresentable" else .1]) direction = np.ones(1) @@ -1478,7 +1486,7 @@ def evaluate(alpha): def test_material_event_indicators_match_actual_fiber_entry_and_copy_inputs(): - from anysolver._nonlinear_events import material_events + from anyfesolver._nonlinear_events import material_events from test_nonlinear_beam_shell_slice3_continuation import _build_ep_model model, *_ = _build_ep_model("direct") element = next(e for e in model.mesh.elements.values() if isinstance(e, BeamElement)) @@ -1518,9 +1526,9 @@ def test_dc_resolved_material_event_crossing_preserves_rollback_and_cancellation """A narrow resolved event is crossed, but no non-equilibrium state commits.""" import inspect from scipy import sparse - import anysolver.nonlinear_static as nonlinear_static - import anysolver._nonlinear_events as events - from anysolver.control import CancellationToken, SolveCancelled + import anyfesolver.nonlinear_static as nonlinear_static + import anyfesolver._nonlinear_events as events + from anyfesolver.control import CancellationToken, SolveCancelled model, meta = _build_coupled_cantilever("eccentric", nx=2, ny=1) tip = meta["grid"][(meta["nx"], 0)] dofs = model.mesh.dof_manager.get_node_dofs(tip) @@ -1574,7 +1582,7 @@ def solve(): def _return_band_fixture(kind, alpha_old): - from anysolver.material_curves import LinearHardeningCurve, PiecewiseLinearCurve + from anyfesolver.material_curves import LinearHardeningCurve, PiecewiseLinearCurve scale = 1.25 if kind == "constant": curve = LinearHardeningCurve(355e6/scale, 0.) @@ -1660,7 +1668,7 @@ def test_beam_return_map_keeps_yield_entry_and_closure_band_boundaries(kind, sig def _secant_seed_cubic(maximum_solves=20, *, evaluate_override=None, solve_override=None): - from anysolver._nonlinear_seed import secant_plane_seed + from anyfesolver._nonlinear_seed import secant_plane_seed q = np.array([1.]); previous = (np.array([0.]), 0.) calls = [] def evaluate(values, lam, tangent): @@ -1713,7 +1721,7 @@ def refused(*args): raise SO3MeanDomainError('synthetic seed chart') @pytest.mark.parametrize('exception', (ValueError('unrelated assembly error'), - __import__('anysolver.control', fromlist=['SolveCancelled']).SolveCancelled('cancel seed'))) + __import__('anyfesolver.control', fromlist=['SolveCancelled']).SolveCancelled('cancel seed'))) def test_uncommitted_secant_plane_seed_propagates_unrelated_error_and_cancellation(exception): def fail(*args): raise exception with pytest.raises(type(exception), match=str(exception)): @@ -1723,7 +1731,7 @@ def fail(*args): raise exception @pytest.mark.parametrize('retained_rows', (True, False)) def test_restart_reduction_inverts_affine_constraints_and_refuses_incompatible_state(retained_rows): from scipy import sparse - from anysolver.nonlinear_static import _reduced_coordinates + from anyfesolver.nonlinear_static import _reduced_coordinates T = sparse.csr_matrix([[1., 0.], [0., 1.], [.75, .25]] if retained_rows else [[2., 0.], [0., 3.], [.75, .25]]) diff --git a/tests/test_nonlinear_beam_shell_slice3_batch.py b/tests/test_nonlinear_beam_shell_slice3_batch.py index 79157e961..48ee8c016 100644 --- a/tests/test_nonlinear_beam_shell_slice3_batch.py +++ b/tests/test_nonlinear_beam_shell_slice3_batch.py @@ -4,8 +4,8 @@ import numpy as np import pytest -import anysolver.corotational as cr -from anysolver import _corotational_batch as batch +import anyfesolver.corotational as cr +from anyfesolver import _corotational_batch as batch from test_corotational_work_conjugate import ( _make_beam_model, _make_q4_shell_model, _make_s3_shell_model, _superimpose_se3_motion, diff --git a/tests/test_nonlinear_beam_shell_slice3_continuation.py b/tests/test_nonlinear_beam_shell_slice3_continuation.py index ddd15496f..166979cc1 100644 --- a/tests/test_nonlinear_beam_shell_slice3_continuation.py +++ b/tests/test_nonlinear_beam_shell_slice3_continuation.py @@ -40,7 +40,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, DisplacementControl, FEModel, @@ -48,17 +48,17 @@ create_shell_element, solve_static_nonlinear, ) -from anysolver.assembly import build_constraint_transformation -from anysolver.control import CancellationToken, SolveCancelled -from anysolver.constraint_audit import constraint_residual_summary -from anysolver.corotational import build_nonlinear_rotating_mpc_map -from anysolver.elements import BeamElement, CoupledBeamShellElement -from anysolver.matrix_assembly import ( +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver.constraint_audit import constraint_residual_summary +from anyfesolver.corotational import build_nonlinear_rotating_mpc_map +from anyfesolver.elements import BeamElement, CoupledBeamShellElement +from anyfesolver.matrix_assembly import ( assemble_load_vector, assemble_stiffness_matrix, ) -from anysolver.mesh_gen import InterpolatedBeamShellMPCElement -from anysolver.nonlinear_static import _assemble_nonlinear_system +from anyfesolver.mesh_gen import InterpolatedBeamShellMPCElement +from anyfesolver.nonlinear_static import _assemble_nonlinear_system L = 1.0 W = 0.24 @@ -102,7 +102,7 @@ def _cached(key, factory): def _add_ep_material(model: FEModel, scale: float) -> None: - from anysolver.material_curves import ( + from anyfesolver.material_curves import ( DNVC208MaterialCurve, dnv_c208_steel_curve, ) @@ -682,7 +682,7 @@ def test_preyield_plastic_matches_distinct_linear_elastic_material(coupling: str fiber_errors = {} stress_witnesses = {} # Compare physical stress responses, allowing distinct state schemas. - from anysolver.corotational import _corotational_cache, _corotational_deformation_state + from anyfesolver.corotational import _corotational_cache, _corotational_deformation_state for eid, element in elastic["model"].mesh.elements.items(): if isinstance(element, BeamElement): assert element._fiber_plasticity_config(elastic["model"].get_material("steel")) is None @@ -718,7 +718,7 @@ def test_preyield_plastic_matches_distinct_linear_elastic_material(coupling: str # The true elastic shell shortcut has no stored layer stresses. # Recover them directly from its own mapped displacement and the # isotropic elastic law; do not send it through return mapping. - from anysolver.plasticity import lobatto_layers + from anyfesolver.plasticity import lobatto_layers model = elastic["model"] shell = model.mesh.elements[eid] dofs = np.concatenate([model.mesh.dof_manager.get_node_dofs(n) for n in shell.node_ids]) @@ -731,7 +731,7 @@ def test_preyield_plastic_matches_distinct_linear_elastic_material(coupling: str # A plastic-capable qualified Q4 evaluates its layers at the hybrid # assumed strain (compatible strain + dE u); its elastic stress is # C times that strain. The oracle uses the same kinematics. - from anysolver import _q4_assumed_strain_plasticity as assumed_strain + from anyfesolver import _q4_assumed_strain_plasticity as assumed_strain pshell = plastic["model"].mesh.elements[eid] pmaterial = plastic["model"].get_material("steel") offsets = (assumed_strain.offset_operator(pshell, plastic["model"].mesh, pmaterial) @@ -771,12 +771,12 @@ def test_preyield_plastic_matches_distinct_linear_elastic_material(coupling: str def test_dc_full_target_plasticity_and_equilibrium(coupling: str, monkeypatch, tmp_path) -> None: # Persist accepted physical arrays before checking completion. A bounded # timeout must retain the actual path, not merely a pytest progress marker. - import anysolver.nonlinear_static as nonlinear_static + import anyfesolver.nonlinear_static as nonlinear_static real_snapshot = nonlinear_static._increment_snapshot accepted = [] real_factorize = nonlinear_static.factorize rhs_per_attempt = {} - import anysolver._nonlinear_seed as nonlinear_seed + import anyfesolver._nonlinear_seed as nonlinear_seed real_seed = nonlinear_seed.secant_plane_seed observed_failed_seed_origins = set() @@ -891,7 +891,7 @@ def raise_if_cancelled(self, location=''): def test_dc_seed_unrelated_linear_error_propagates_and_preserves_inputs(monkeypatch): - import anysolver.nonlinear_static as driver + import anyfesolver.nonlinear_static as driver half = _half_case('direct') model, load, probe, grid = _build_ep_model('direct'); _add_tip_load(model, load, grid) u = half['result'].displacements.copy(); states = copy.deepcopy(dict(half['result'].element_states)) @@ -1089,7 +1089,7 @@ def cancel_after_two_accepted(event) -> None: equilibrate_initial_state=False, record_increment_snapshots=True, ) - import anysolver.nonlinear_static as nonlinear_static + import anyfesolver.nonlinear_static as nonlinear_static real_snapshot = nonlinear_static._increment_snapshot observed_snapshots = [] diff --git a/tests/test_nonlinear_beam_shell_slice3_director_continuation.py b/tests/test_nonlinear_beam_shell_slice3_director_continuation.py index 1f54069e9..53b947222 100644 --- a/tests/test_nonlinear_beam_shell_slice3_director_continuation.py +++ b/tests/test_nonlinear_beam_shell_slice3_director_continuation.py @@ -14,9 +14,9 @@ import numpy as np import pytest -from anysolver import DisplacementControl, solve_static_nonlinear -from anysolver.control import CancellationToken, SolveCancelled -from anysolver.mesh_gen import InterpolatedBeamShellMPCElement +from anyfesolver import DisplacementControl, solve_static_nonlinear +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver.mesh_gen import InterpolatedBeamShellMPCElement _spec = importlib.util.spec_from_file_location( @@ -89,7 +89,7 @@ def test_director_cancelled_same_model_and_inputs_still_deliver(monkeypatch): before_u, before_states = u.copy(), copy.deepcopy(states) token = CancellationToken() events, snapshots = [], [] - import anysolver.nonlinear_static as ns + import anyfesolver.nonlinear_static as ns real_snapshot = ns._increment_snapshot def observe(*args, **kwargs): @@ -158,8 +158,8 @@ def test_director_incompatible_restart_refused_without_input_mutation(): def test_director_stopped_negative_run_excludes_rejected_history(monkeypatch): """Deliberately insufficient1/1 controls are a separate negative test.""" import inspect - import anysolver.nonlinear_static as ns - import anysolver.nonlinear_performance as performance + import anyfesolver.nonlinear_static as ns + import anyfesolver.nonlinear_performance as performance half = base._half_case('interp') model,load,probe,grid = _build('interp') diff --git a/tests/test_nonlinear_beam_shell_slice3_precision.py b/tests/test_nonlinear_beam_shell_slice3_precision.py index d6da7338b..5e52ee2b4 100644 --- a/tests/test_nonlinear_beam_shell_slice3_precision.py +++ b/tests/test_nonlinear_beam_shell_slice3_precision.py @@ -4,9 +4,9 @@ import numpy as np import pytest -from anysolver import FEModel -from anysolver.elements import BeamElement -import anysolver.corotational as cr +from anyfesolver import FEModel +from anyfesolver.elements import BeamElement +import anyfesolver.corotational as cr def _beam(origin): diff --git a/tests/test_nonlinear_checkpoint_guarded_normalization.py b/tests/test_nonlinear_checkpoint_guarded_normalization.py index 5628a5d14..62d229b0c 100644 --- a/tests/test_nonlinear_checkpoint_guarded_normalization.py +++ b/tests/test_nonlinear_checkpoint_guarded_normalization.py @@ -3,7 +3,7 @@ import pytest import numpy as np -from anysolver.nonlinear_restart import _normalize_json +from anyfesolver.nonlinear_restart import _normalize_json def test_custom_sequence_iteration_is_guarded_after_observation(): @@ -141,7 +141,7 @@ def guard(*a, **k): def test_explicit_array_cast_is_inert_only_for_exact_native_same_dtype(): - from anysolver.nonlinear_restart import _inert_array_conversion + from anyfesolver.nonlinear_restart import _inert_array_conversion for dtype in (np.float64, np.int64): assert _inert_array_conversion(np.ones(3, dtype=dtype), np.asarray, dtype) assert not _inert_array_conversion(np.ones(3, dtype=np.float32), np.asarray, np.float64) @@ -155,7 +155,7 @@ def test_explicit_array_cast_is_inert_only_for_exact_native_same_dtype(): def test_custom_numpy_module_lookup_is_not_an_inert_observation(monkeypatch): from types import ModuleType - from anysolver import nonlinear_restart as restart + from anyfesolver import nonlinear_restart as restart class CustomModule(ModuleType): def __getattribute__(self, name): return super().__getattribute__(name) @@ -167,7 +167,7 @@ def __getattribute__(self, name): def test_restoring_module_getter_cannot_hide_its_observation(monkeypatch): from types import ModuleType - from anysolver import nonlinear_restart as restart + from anyfesolver import nonlinear_restart as restart observed = [] class CustomModule(ModuleType): def __getattribute__(self, name): @@ -189,7 +189,7 @@ def guard(*a, **k): @pytest.mark.parametrize("attribute", ["asarray", "integer", "float64"]) def test_restoring_module_property_cannot_hide_its_observation(monkeypatch, attribute): from types import ModuleType - from anysolver import nonlinear_restart as restart + from anyfesolver import nonlinear_restart as restart observed = [] class CustomModule(ModuleType): pass @@ -217,7 +217,7 @@ def guard(*a, **k): def test_custom_module_metaclass_descriptor_is_rejected_without_observation(monkeypatch): from types import ModuleType - from anysolver import nonlinear_restart as restart + from anyfesolver import nonlinear_restart as restart observed = [] class Meta(type): @property @@ -235,7 +235,7 @@ class CustomModule(ModuleType, metaclass=Meta): def test_module_getattribute_descriptor_is_rejected_without_observation(): from types import ModuleType - from anysolver import nonlinear_restart as restart + from anyfesolver import nonlinear_restart as restart observed = [] class Descriptor: def __get__(self, instance, owner): diff --git a/tests/test_nonlinear_default_globalization.py b/tests/test_nonlinear_default_globalization.py index 948d35559..711b849eb 100644 --- a/tests/test_nonlinear_default_globalization.py +++ b/tests/test_nonlinear_default_globalization.py @@ -2,9 +2,9 @@ import numpy as np import pytest -import anysolver as fs -from anysolver.boundary import FixedSupport, LoadCase -from anysolver.elements import BeamElement +import anyfesolver as fs +from anyfesolver.boundary import FixedSupport, LoadCase +from anyfesolver.elements import BeamElement def _cantilever(elements, axis, load): diff --git a/tests/test_nonlinear_impact_plasticity.py b/tests/test_nonlinear_impact_plasticity.py index d2bf46d16..a435a941b 100644 --- a/tests/test_nonlinear_impact_plasticity.py +++ b/tests/test_nonlinear_impact_plasticity.py @@ -1,9 +1,9 @@ import numpy as np import pytest -import anysolver as fs -from anysolver.contact import _plastic_impact_damage_update, _verification_contact_panel -from anysolver.material_curves import DNVC208MaterialCurve +import anyfesolver as fs +from anyfesolver.contact import _plastic_impact_damage_update, _verification_contact_panel +from anyfesolver.material_curves import DNVC208MaterialCurve def test_nonlinear_impact_public_configs_are_exported(): @@ -84,8 +84,8 @@ def test_nonlinear_impact_commits_state_from_exact_accepted_newton_iterate( from scipy import sparse - from anysolver.boundary import LoadCase - from anysolver import nonlinear_static + from anyfesolver.boundary import LoadCase + from anyfesolver import nonlinear_static model = _verification_contact_panel() load = LoadCase("newton-state-identity") @@ -240,10 +240,10 @@ def test_corotational_nonlinear_impact_matches_von_karman_at_small_deformation() def test_plastic_impact_damage_erodes_beam_from_committed_state(): """PlasticImpactDamageConfig deletes beam elements from committed plastic state.""" - from anysolver.boundary import BoundaryCondition - from anysolver.contact import _plastic_impact_damage_update - from anysolver.elements import BeamElement - from anysolver.fe_core import FEModel + from anyfesolver.boundary import BoundaryCondition + from anyfesolver.contact import _plastic_impact_damage_update + from anyfesolver.elements import BeamElement + from anyfesolver.fe_core import FEModel model = FEModel("beam_plastic") model.add_material("steel", 2.1e11, 0.3, density=7850.0) @@ -270,7 +270,7 @@ def test_plastic_impact_damage_erodes_beam_from_committed_state(): def test_state_von_mises_envelope_reconstructs_return_mapped_stress(): """sigma = C_el (eps - eps_p) from the committed state, not E * eps.""" - from anysolver.nonlinear_static import state_von_mises_envelope + from anyfesolver.nonlinear_static import state_von_mises_envelope E, nu = 1.0e5, 0.3 # Uniaxial layered state: total strain 0.01, of which 0.008 is plastic. @@ -300,9 +300,9 @@ def test_state_von_mises_envelope_reconstructs_return_mapped_stress(): def _clamped_grid_panel(n: int = 4) -> "object": """1 m x 1 m clamped shell grid that can actually bend and yield.""" - from anysolver.boundary import BoundaryCondition - from anysolver.elements import create_shell_element - from anysolver.fe_core import FEModel + from anyfesolver.boundary import BoundaryCondition + from anyfesolver.elements import create_shell_element + from anyfesolver.fe_core import FEModel model = FEModel("yielding_panel") model.add_material("soft", 1.0e5, 0.3, density=20.0) @@ -341,7 +341,7 @@ def _clamped_grid_panel(n: int = 4) -> "object": def test_nonlinear_impact_state_von_mises_history_respects_material_curve(): """Recorded stress history stays on the hardening curve while an elastic recovery from the same displacements overshoots it.""" - from anysolver.assembly import compute_stresses + from anyfesolver.assembly import compute_stresses curve = DNVC208MaterialCurve( sigma_prop=800.0, @@ -389,7 +389,7 @@ def test_nonlinear_impact_state_von_mises_history_respects_material_curve(): def test_rtcl_triaxiality_weight_matches_published_anchor_points(): - from anysolver.fracture import rtcl_triaxiality_weight + from anyfesolver.fracture import rtcl_triaxiality_weight eta = np.array([-1.0, -1.0 / 3.0, 0.0, 1.0 / 3.0, 2.0 / 3.0]) weight = rtcl_triaxiality_weight(eta) @@ -413,8 +413,8 @@ def _layered_state(strain_rows, plastic_rows, alpha): def test_rtcl_damage_ignores_compression_but_deletes_in_tension(): """RTCL erosion: a compressed element accumulates no damage while a tension element with the same plastic strain softens and deletes.""" - from anysolver.contact import _plastic_impact_damage_update, _verification_contact_panel - from anysolver.elements import create_shell_element + from anyfesolver.contact import _plastic_impact_damage_update, _verification_contact_panel + from anyfesolver.elements import create_shell_element model = _verification_contact_panel() # second shell, same material, so both categories are in scope @@ -468,7 +468,7 @@ def test_rtcl_damage_ignores_compression_but_deletes_in_tension(): def test_rtcl_beam_fibers_damage_only_in_tension(): - from anysolver.fracture import state_rtcl_increment + from anyfesolver.fracture import state_rtcl_increment state = { "alpha": np.array([0.05, 0.05]), @@ -520,7 +520,7 @@ def test_rtcl_modified_scales_critical_strain_by_plane_strain_weight(): """rtcl_modified calibrates eps_cr so plane-strain tension fails exactly at the mesh-scaled GL limit: utilization is the plain-RTCL value divided by w_ps = exp(sqrt(3)/2 - 1/2) ~ 1.4424.""" - from anysolver.contact import _plastic_impact_damage_update, _verification_contact_panel + from anyfesolver.contact import _plastic_impact_damage_update, _verification_contact_panel tension = _layered_state( [[0.20, -0.06, 0.0], [0.20, -0.06, 0.0]], @@ -548,7 +548,7 @@ def test_rtcl_modified_scales_critical_strain_by_plane_strain_weight(): def test_nonlinear_impact_equilibrates_base_load_instead_of_step(): """A static base load must enter the transient as an equilibrium state, not a sudden step that rings the structure through the whole impact.""" - from anysolver.boundary import LoadCase + from anyfesolver.boundary import LoadCase def base_case(model, magnitude): case = LoadCase("preload") diff --git a/tests/test_nonlinear_performance.py b/tests/test_nonlinear_performance.py index 2ef07a036..aa2d1459e 100644 --- a/tests/test_nonlinear_performance.py +++ b/tests/test_nonlinear_performance.py @@ -5,24 +5,24 @@ import numpy as np -from anysolver.mesh_gen import generate_simple_panel_mesh -from anysolver import nonlinear_static -from anysolver import nonlinear_performance -from anysolver import nonlinear_performance_bootstrap -from anysolver.jit_compiler import JIT_ENABLED -from anysolver import nonlinear_performance_batch_c -from anysolver.material_curves import dnv_c208_steel_curve -from anysolver.elements import QuadraticBeamElement, create_element -from anysolver.fe_core import FEModel -from anysolver.e4_pl_element import QualifiedE4PLShellElement -from anysolver.nonlinear_performance_bootstrap import ( +from anyfesolver.mesh_gen import generate_simple_panel_mesh +from anyfesolver import nonlinear_static +from anyfesolver import nonlinear_performance +from anyfesolver import nonlinear_performance_bootstrap +from anyfesolver.jit_compiler import JIT_ENABLED +from anyfesolver import nonlinear_performance_batch_c +from anyfesolver.material_curves import dnv_c208_steel_curve +from anyfesolver.elements import QuadraticBeamElement, create_element +from anyfesolver.fe_core import FEModel +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement +from anyfesolver.nonlinear_performance_bootstrap import ( MAX_NONLINEAR_LAYER_PLANS_PER_MODEL, clear_nonlinear_assembly_cache, get_nonlinear_assembly_plan, nonlinear_assembly_diagnostics, nonlinear_performance_status, ) -from anysolver.nonlinear_static import ShellInitialField, _prepare_initial_states +from anyfesolver.nonlinear_static import ShellInitialField, _prepare_initial_states def _panel_model(): @@ -413,7 +413,7 @@ def test_deleted_q4_initial_field_override_is_scaled_and_frozen_exactly() -> Non # route scope is refused (the compatible-strain plastic route with the # qualified correction is unstable once layers yield). import pytest - from anysolver._q4_assumed_strain_plasticity import UnsupportedQ4PlasticRouteError + from anyfesolver._q4_assumed_strain_plasticity import UnsupportedQ4PlasticRouteError with pytest.raises(UnsupportedQ4PlasticRouteError, match="active initial"): legacy(model, displacement, committed, 3, **arguments) nonlinear_performance.clear_nonlinear_assembly_cache(model) diff --git a/tests/test_nonlinear_performance_batch_b.py b/tests/test_nonlinear_performance_batch_b.py index 395675675..35f483942 100644 --- a/tests/test_nonlinear_performance_batch_b.py +++ b/tests/test_nonlinear_performance_batch_b.py @@ -4,19 +4,19 @@ import pytest from types import SimpleNamespace -from anysolver import nonlinear_performance, nonlinear_static -from anysolver.boundary import FixedSupport, LoadCase -from anysolver.elements import create_element -from anysolver.fe_core import FEModel -from anysolver.jit_compiler import JIT_DISABLED_REASON, JIT_ENABLED, jit_diagnostics -from anysolver.mesh_gen import generate_simple_panel_mesh -from anysolver.nonlinear_performance_batch_b import batch_b_status -from anysolver.nonlinear_performance_bootstrap import ( +from anyfesolver import nonlinear_performance, nonlinear_static +from anyfesolver.boundary import FixedSupport, LoadCase +from anyfesolver.elements import create_element +from anyfesolver.fe_core import FEModel +from anyfesolver.jit_compiler import JIT_DISABLED_REASON, JIT_ENABLED, jit_diagnostics +from anyfesolver.mesh_gen import generate_simple_panel_mesh +from anyfesolver.nonlinear_performance_batch_b import batch_b_status +from anyfesolver.nonlinear_performance_bootstrap import ( clear_nonlinear_assembly_cache, get_nonlinear_assembly_plan, nonlinear_performance_status, ) -from anysolver.runtime import _runtime_display_stresses +from anyfesolver.runtime import _runtime_display_stresses pytestmark = pytest.mark.skipif( not JIT_ENABLED, @@ -45,7 +45,7 @@ def _legacy_tilted_shell_model() -> FEModel: model = _tilted_shell_model() element = model.mesh.elements[1] - from anysolver.elements import create_shell_element + from anyfesolver.elements import create_shell_element model.mesh.elements[1] = create_shell_element( 1, list(element.node_ids), element.material_name, thickness=element.thickness, @@ -61,7 +61,7 @@ def _legacy_panel(*args, **kwargs) -> FEModel: elastic fast path, so its coverage is exercised on legacy shells. """ - from anysolver.elements import create_shell_element + from anyfesolver.elements import create_shell_element model = generate_simple_panel_mesh(*args, **kwargs) for element_id, element in list(model.mesh.elements.items()): @@ -83,7 +83,7 @@ def test_planar_qualified_q4_uses_single_law_batch_not_batch_b() -> None: # Execution check: the single-law batch kernel body runs, and its result is # what the plan assembles (equal to the scalar element responses). import sys - from anysolver import _q4_assumed_strain_plasticity as assumed + from anyfesolver import _q4_assumed_strain_plasticity as assumed rng = np.random.default_rng(7) displacement = 1e-3 * rng.standard_normal(model.mesh.dof_manager.total_dofs) @@ -159,7 +159,7 @@ def test_elastic_batch_releases_history_work_arrays() -> None: def test_isotropic_batch_build_reuses_one_constitutive_matrix( monkeypatch: pytest.MonkeyPatch, ) -> None: - import anysolver.nonlinear_performance_batch_b as batch_b + import anyfesolver.nonlinear_performance_batch_b as batch_b model = _legacy_panel( 1.2, 0.8, 0.01, num_divisions_x=4, num_divisions_y=2 diff --git a/tests/test_nonlinear_performance_batch_c.py b/tests/test_nonlinear_performance_batch_c.py index 2caf31db7..558f495f3 100644 --- a/tests/test_nonlinear_performance_batch_c.py +++ b/tests/test_nonlinear_performance_batch_c.py @@ -7,26 +7,26 @@ import pytest from scipy import sparse -from anysolver import arc_length, nonlinear_performance_batch_c, nonlinear_static -from anysolver.arc_length import ArcLengthControl -from anysolver.boundary import BoundaryCondition, LoadCase -from anysolver.elements import Element -from anysolver.fe_core import FEModel -from anysolver.jit_compiler import JIT_DISABLED_REASON, JIT_ENABLED -from anysolver.mesh_gen import generate_simple_panel_mesh -from anysolver.nonlinear_performance_batch_c import ( +from anyfesolver import arc_length, nonlinear_performance_batch_c, nonlinear_static +from anyfesolver.arc_length import ArcLengthControl +from anyfesolver.boundary import BoundaryCondition, LoadCase +from anyfesolver.elements import Element +from anyfesolver.fe_core import FEModel +from anyfesolver.jit_compiler import JIT_DISABLED_REASON, JIT_ENABLED +from anyfesolver.mesh_gen import generate_simple_panel_mesh +from anyfesolver.nonlinear_performance_batch_c import ( assemble_reduced_system, batch_c_status, build_reduced_assembly_plan, reset_batch_c_counters, ) -from anysolver.nonlinear_performance_bootstrap import ( +from anyfesolver.nonlinear_performance_bootstrap import ( get_nonlinear_assembly_plan, install_nonlinear_performance_optimizations, uninstall_nonlinear_performance_optimizations, ) -from anysolver.nonlinear_static import DisplacementControl, solve_static_nonlinear -from anysolver.nonlinear_static import _ensure_nonlinear_acceleration +from anyfesolver.nonlinear_static import DisplacementControl, solve_static_nonlinear +from anyfesolver.nonlinear_static import _ensure_nonlinear_acceleration _ensure_nonlinear_acceleration() @@ -208,7 +208,7 @@ def test_direct_reduced_assembly_retains_batch_b_elastic_kernel(monkeypatch) -> # for it; it remains in use for legacy shells. Pin both facts, and keep the # Batch C retention check on the legacy panel (same retarget as # tests/test_nonlinear_performance_batch_b.py::_legacy_panel). - from anysolver.elements import create_shell_element + from anyfesolver.elements import create_shell_element qualified = generate_simple_panel_mesh( 1.0, 0.6, 0.01, num_divisions_x=2, num_divisions_y=1 @@ -774,7 +774,7 @@ def test_short_nonlinear_solve_skips_direct_reduction_setup(monkeypatch) -> None def test_lazy_install_updates_and_restores_prebound_consumer_aliases() -> None: """A caller may import either solver before the lazy installer runs.""" - consumer_name = "_anysolver_batch_c_prebound_consumer" + consumer_name = "_anyfesolver_batch_c_prebound_consumer" consumer = ModuleType(consumer_name) uninstall_nonlinear_performance_optimizations() original_static = nonlinear_static.solve_static_nonlinear diff --git a/tests/test_nonlinear_restart_checkpoint.py b/tests/test_nonlinear_restart_checkpoint.py index d8985a444..53b45f57d 100644 --- a/tests/test_nonlinear_restart_checkpoint.py +++ b/tests/test_nonlinear_restart_checkpoint.py @@ -6,20 +6,20 @@ import numpy as np import pytest -import anysolver.nonlinear_static as nonlinear_static_module -from anysolver.activity import ElementActivity -from anysolver.arc_length import ArcLengthControl, solve_static_arc_length -from anysolver.boundary import BoundaryCondition, LoadCase -from anysolver.elements import Element -from anysolver.fe_core import FEModel -from anysolver.nonlinear_restart import ( +import anyfesolver.nonlinear_static as nonlinear_static_module +from anyfesolver.activity import ElementActivity +from anyfesolver.arc_length import ArcLengthControl, solve_static_arc_length +from anyfesolver.boundary import BoundaryCondition, LoadCase +from anyfesolver.elements import Element +from anyfesolver.fe_core import FEModel +from anyfesolver.nonlinear_restart import ( NonlinearCheckpointError, canonical_checkpoint_json_bytes, create_nonlinear_checkpoint, load_nonlinear_checkpoint, validate_nonlinear_checkpoint, ) -from anysolver.nonlinear_static import DisplacementControl, solve_static_nonlinear +from anyfesolver.nonlinear_static import DisplacementControl, solve_static_nonlinear class _SofteningSpring(Element): @@ -445,7 +445,7 @@ def test_displacement_static_checkpoint_exact_split_continuation() -> None: def test_accelerated_displacement_dispatch_delegates_checkpoint_semantics(monkeypatch) -> None: - from anysolver import nonlinear_performance + from anyfesolver import nonlinear_performance nonlinear_performance.install_nonlinear_performance_optimizations() original = nonlinear_performance._ORIGINAL_DISPLACEMENT_SOLVER diff --git a/tests/test_nonlinear_speed_sweep.py b/tests/test_nonlinear_speed_sweep.py index a3b490539..9113b63ce 100644 --- a/tests/test_nonlinear_speed_sweep.py +++ b/tests/test_nonlinear_speed_sweep.py @@ -4,7 +4,7 @@ import numpy as np import pytest -from anysolver import nonlinear_static as ns +from anyfesolver import nonlinear_static as ns from test_nonlinear_static_armijo import _spring_model, _armijo_settings diff --git a/tests/test_nonlinear_state_batches.py b/tests/test_nonlinear_state_batches.py index 766e7b3d8..90621fc56 100644 --- a/tests/test_nonlinear_state_batches.py +++ b/tests/test_nonlinear_state_batches.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from anysolver.nonlinear_state import ( +from anyfesolver.nonlinear_state import ( ImmutableStateSidecarError, NonlinearStateStore, PersistentStateEligibilityError, @@ -289,9 +289,9 @@ def test_tokens_and_state_are_independent_between_solver_stores() -> None: def test_shell_batch_persistent_entry_point_is_exact_mapping_parity() -> None: - from anysolver.material_curves import dnv_c208_steel_curve - from anysolver.mesh_gen import generate_simple_panel_mesh - from anysolver.nonlinear_performance import NonlinearAssemblyPlan + from anyfesolver.material_curves import dnv_c208_steel_curve + from anyfesolver.mesh_gen import generate_simple_panel_mesh + from anyfesolver.nonlinear_performance import NonlinearAssemblyPlan model = generate_simple_panel_mesh( 1.2, diff --git a/tests/test_nonlinear_state_cleanup.py b/tests/test_nonlinear_state_cleanup.py index 3a7234468..d12cd57a2 100644 --- a/tests/test_nonlinear_state_cleanup.py +++ b/tests/test_nonlinear_state_cleanup.py @@ -2,7 +2,7 @@ import pytest -from anysolver.nonlinear_state import ( +from anyfesolver.nonlinear_state import ( NonlinearStateStore, StateTransactionError, _register_nonlinear_state_cleanup, _run_with_nonlinear_state_cleanup, ) diff --git a/tests/test_nonlinear_state_lifecycle.py b/tests/test_nonlinear_state_lifecycle.py index 38182c0a8..a5b5ca6fc 100644 --- a/tests/test_nonlinear_state_lifecycle.py +++ b/tests/test_nonlinear_state_lifecycle.py @@ -8,12 +8,12 @@ import numpy as np import pytest -from anysolver.arc_length import ArcLengthControl, solve_static_arc_length -from anysolver.boundary import BoundaryCondition, LoadCase -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEModel -from anysolver.material_curves import DNVC208MaterialCurve -from anysolver.nonlinear_static import ( +from anyfesolver.arc_length import ArcLengthControl, solve_static_arc_length +from anyfesolver.boundary import BoundaryCondition, LoadCase +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.material_curves import DNVC208MaterialCurve +from anyfesolver.nonlinear_static import ( DisplacementControl, NonlinearLoadProgram, NonlinearLoadStage, @@ -41,7 +41,7 @@ def _install_accelerated_assembly_before_ab_comparisons() -> None: # Keep the persistent/mapping comparisons on the same already-installed # Batch-C dispatch; installation is otherwise lazy on the first solve. - from anysolver.nonlinear_static import _ensure_nonlinear_acceleration + from anyfesolver.nonlinear_static import _ensure_nonlinear_acceleration _ensure_nonlinear_acceleration() diff --git a/tests/test_nonlinear_static_armijo.py b/tests/test_nonlinear_static_armijo.py index 043515fd6..70ac90520 100644 --- a/tests/test_nonlinear_static_armijo.py +++ b/tests/test_nonlinear_static_armijo.py @@ -3,12 +3,12 @@ import numpy as np import pytest -from anysolver import nonlinear_performance, nonlinear_static -from anysolver.boundary import BoundaryCondition, FixedSupport, LoadCase -from anysolver.elements import Element -from anysolver.fe_core import FEModel -from anysolver.material_curves import dnv_c208_steel_curve -from anysolver.nonlinear_static import ( +from anyfesolver import nonlinear_performance, nonlinear_static +from anyfesolver.boundary import BoundaryCondition, FixedSupport, LoadCase +from anyfesolver.elements import Element +from anyfesolver.fe_core import FEModel +from anyfesolver.material_curves import dnv_c208_steel_curve +from anyfesolver.nonlinear_static import ( NonlinearLoadProgram, NonlinearLoadStage, NonlinearConvergenceSettings, @@ -16,7 +16,7 @@ _armijo_residual_weights, solve_static_nonlinear, ) -from anysolver.plasticity import PlaneStressConvergenceError, plane_stress_return_map +from anyfesolver.plasticity import PlaneStressConvergenceError, plane_stress_return_map class _HardeningSpring(Element): diff --git a/tests/test_nonlinear_static_state_lifecycle.py b/tests/test_nonlinear_static_state_lifecycle.py index 5c2fb1e6f..a620d9642 100644 --- a/tests/test_nonlinear_static_state_lifecycle.py +++ b/tests/test_nonlinear_static_state_lifecycle.py @@ -6,15 +6,15 @@ import pytest from scipy import sparse -import anysolver.nonlinear_static as nonlinear_static -from anysolver import nonlinear_performance -from anysolver import nonlinear_performance_batch_c -from anysolver.control import SolveCancelled -from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement -from anysolver.elements import ShellElement -from anysolver.fe_core import FEModel -from anysolver.boundary import FixedSupport -from anysolver.nonlinear_state import ( +import anyfesolver.nonlinear_static as nonlinear_static +from anyfesolver import nonlinear_performance +from anyfesolver import nonlinear_performance_batch_c +from anyfesolver.control import SolveCancelled +from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement +from anyfesolver.elements import ShellElement +from anyfesolver.fe_core import FEModel +from anyfesolver.boundary import FixedSupport +from anyfesolver.nonlinear_state import ( NonlinearStateStore, begin_state_evaluation, finish_state_evaluation, diff --git a/tests/test_nonlinear_trusted_v2d_and_token.py b/tests/test_nonlinear_trusted_v2d_and_token.py index 05212c587..f22416057 100644 --- a/tests/test_nonlinear_trusted_v2d_and_token.py +++ b/tests/test_nonlinear_trusted_v2d_and_token.py @@ -15,25 +15,25 @@ import numpy as np import pytest -import anysolver.current_state_tangent as current_state_tangent -import anysolver.e4_pl_s3_v2d_element as v2d_module -import anysolver.jit_compiler as jit_compiler -import anysolver.nonlinear_static as nonlinear_static_module -from anysolver import elements as elements_module -from anysolver import plasticity, vectorized_nonlinear -from anysolver.boundary import BoundaryCondition, LoadCase -from anysolver.control import CancellationToken -from anysolver.e4_pl_element import QualifiedE4PLShellElement -from anysolver.e4_pl_s3_v2d_element import ( +import anyfesolver.current_state_tangent as current_state_tangent +import anyfesolver.e4_pl_s3_v2d_element as v2d_module +import anyfesolver.jit_compiler as jit_compiler +import anyfesolver.nonlinear_static as nonlinear_static_module +from anyfesolver import elements as elements_module +from anyfesolver import plasticity, vectorized_nonlinear +from anyfesolver.boundary import BoundaryCondition, LoadCase +from anyfesolver.control import CancellationToken +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement +from anyfesolver.e4_pl_s3_v2d_element import ( NativeParityCapabilityError, NativeParityE4PLS3V2DShellElement, ) -from anysolver.element_capabilities import ElementCapabilityError -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEModel -from anysolver.jit_compiler import JIT_ENABLED -from anysolver.matrix_assembly import AssemblyError -from anysolver.nonlinear_static import solve_static_nonlinear +from anyfesolver.element_capabilities import ElementCapabilityError +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.jit_compiler import JIT_ENABLED +from anyfesolver.matrix_assembly import AssemblyError +from anyfesolver.nonlinear_static import solve_static_nonlinear NEWTON_LOOP_CONTEXTS = ( diff --git a/tests/test_orthotropic_elements.py b/tests/test_orthotropic_elements.py index 867a943d7..3e7cc419b 100644 --- a/tests/test_orthotropic_elements.py +++ b/tests/test_orthotropic_elements.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BeamElement, DNVC208MaterialCurve, FEModel, @@ -19,11 +19,11 @@ recover_stress_result, validate_production_model, ) -from anysolver.elements import ( +from anyfesolver.elements import ( _shell_material_matrices, validate_initial_field_state, ) -from anysolver.nonlinear_static import states_von_mises_map +from anyfesolver.nonlinear_static import states_von_mises_map def _orthotropic( diff --git a/tests/test_orthotropic_material_contract.py b/tests/test_orthotropic_material_contract.py index 6430d65ca..942d8cb90 100644 --- a/tests/test_orthotropic_material_contract.py +++ b/tests/test_orthotropic_material_contract.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( FEModel, Hill48Yield, OrthotropicMaterial, diff --git a/tests/test_orthotropic_workflow_integration.py b/tests/test_orthotropic_workflow_integration.py index 56d7829c7..f0f7c17b3 100644 --- a/tests/test_orthotropic_workflow_integration.py +++ b/tests/test_orthotropic_workflow_integration.py @@ -6,7 +6,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, FixedSupport, FractureConfig, @@ -21,21 +21,21 @@ solve_transient_newmark, create_shell_element, ) -from anysolver.anystructure_fem_mode import build_fe_model_from_generated_geometry -from anysolver.contact import ( +from anyfesolver.anystructure_fem_mode import build_fe_model_from_generated_geometry +from anyfesolver.contact import ( RigidSphereImpact, SphereContactConfig, _require_user_capacity_for_orthotropic_linear_damage, material_characteristic_modulus, solve_transient_sphere_impact, ) -from anysolver.dynamics import TransientConfig -from anysolver.elements import BeamElement, ShellElement -from anysolver.external_references import write_calculix_input_deck -from anysolver.fe_core import FEModel -from anysolver.fracture import ImpactDamageConfig, state_rtcl_increment -from anysolver.material_curves import DNVC208MaterialCurve -from anysolver.runtime import _apply_material_curve_to_model +from anyfesolver.dynamics import TransientConfig +from anyfesolver.elements import BeamElement, ShellElement +from anyfesolver.external_references import write_calculix_input_deck +from anyfesolver.fe_core import FEModel +from anyfesolver.fracture import ImpactDamageConfig, state_rtcl_increment +from anyfesolver.material_curves import DNVC208MaterialCurve +from anyfesolver.runtime import _apply_material_curve_to_model ORTHOTROPIC_CONSTANTS = { diff --git a/tests/test_performance_improvements.py b/tests/test_performance_improvements.py index c7a36c3ae..e6ea7ea7b 100644 --- a/tests/test_performance_improvements.py +++ b/tests/test_performance_improvements.py @@ -7,17 +7,17 @@ import numpy as np import pytest -from anysolver.elements import LegacyShellElement, create_element -from anysolver.fe_core import FEModel -from anysolver.jit_compiler import JIT_DISABLED_REASON, JIT_ENABLED -from anysolver.kernel_warmup import warm_fe_solver_kernels -from anysolver.matrix_assembly import ( +from anyfesolver.elements import LegacyShellElement, create_element +from anyfesolver.fe_core import FEModel +from anyfesolver.jit_compiler import JIT_DISABLED_REASON, JIT_ENABLED +from anyfesolver.kernel_warmup import warm_fe_solver_kernels +from anyfesolver.matrix_assembly import ( assemble_geometric_stiffness_matrix, assemble_stiffness_matrix, ) -from anysolver.mesh_gen import generate_simple_panel_mesh -from anysolver.vectorized_stiffness import compute_shell_stiffness_matrices_jit -import anysolver.kernel_warmup as kernel_warmup +from anyfesolver.mesh_gen import generate_simple_panel_mesh +from anyfesolver.vectorized_stiffness import compute_shell_stiffness_matrices_jit +import anyfesolver.kernel_warmup as kernel_warmup def test_batched_s4_geometric_stiffness_matches_warped_scalar_and_reuses_geometry(): @@ -385,8 +385,8 @@ def test_vectorized_mass_matches_sequential_and_assembly_uses_batch(): """Batched shell mass kernel matches element.compute_mass_matrix and drives assemble_mass_matrix.""" from scipy import sparse - from anysolver.matrix_assembly import assemble_mass_matrix - from anysolver.vectorized_stiffness import compute_shell_mass_matrices_jit + from anyfesolver.matrix_assembly import assemble_mass_matrix + from anyfesolver.vectorized_stiffness import compute_shell_mass_matrices_jit model = FEModel("mass_test") model.add_material("steel", 210.0e9, 0.3, density=7850.0) @@ -450,7 +450,7 @@ def test_vectorized_mass_matches_sequential_and_assembly_uses_batch(): def test_q8r_mass_assembly_keeps_scalar_lumped_path(): """Reduced-integration S8R shells stay on the scalar lumped mass path.""" - from anysolver.matrix_assembly import assemble_mass_matrix + from anyfesolver.matrix_assembly import assemble_mass_matrix model = FEModel("q8r_mass_test") model.add_material("steel", 210.0e9, 0.3, density=7850.0) diff --git a/tests/test_phase2.py b/tests/test_phase2.py index ec6580e09..5ebc82e86 100644 --- a/tests/test_phase2.py +++ b/tests/test_phase2.py @@ -2,10 +2,10 @@ import pytest from scipy.sparse.linalg import spsolve -from anysolver.fe_core import FEModel -from anysolver.elements import BeamElement, create_shell_element -from anysolver.boundary import FixedSupport, LoadCase, BoundaryCondition -from anysolver.assembly import build_constraint_transformation, solve_linear +from anyfesolver.fe_core import FEModel +from anyfesolver.elements import BeamElement, create_shell_element +from anyfesolver.boundary import FixedSupport, LoadCase, BoundaryCondition +from anyfesolver.assembly import build_constraint_transformation, solve_linear def test_multilevel_mpc_cantilever(): @@ -180,7 +180,7 @@ def test_global_stress_recovery(): u[dofs[0]] = eps_xx * x # ux u[dofs[1]] = eps_yy * y # uy - from anysolver.assembly import compute_stresses + from anyfesolver.assembly import compute_stresses # Compute stresses with return_global=True stresses = compute_stresses(model, u, return_global=True) diff --git a/tests/test_plane_stress_analytical_tangent.py b/tests/test_plane_stress_analytical_tangent.py index 5ea676a5b..61992492c 100644 --- a/tests/test_plane_stress_analytical_tangent.py +++ b/tests/test_plane_stress_analytical_tangent.py @@ -5,13 +5,13 @@ import numpy as np import pytest -from anysolver.plasticity import ( +from anyfesolver.plasticity import ( PlaneStressConvergenceError, plane_stress_numerical_tangent, plane_stress_return_map, plane_stress_tangent_diagnostics, ) -from anysolver.plasticity_qualification import ( +from anyfesolver.plasticity_qualification import ( E_STEEL, NU_STEEL, algorithmic_tangent_path_metrics, @@ -168,7 +168,7 @@ def test_numerical_oracle_uses_representable_steps_near_stability_boundary() -> def test_invalid_analytical_tangent_mask_retains_guarded_fallback() -> None: - from anysolver.plasticity import _analytical_tangent_fallback_mask + from anyfesolver.plasticity import _analytical_tangent_fallback_mask tangent = np.eye(3, dtype=float)[None, :, :] tangent[0, 1, 1] = np.nan @@ -206,7 +206,7 @@ def test_safeguarded_local_solve_recovers_newton_iteration_exhaustion() -> None: def test_local_convergence_guard_fails_closed_on_invalid_status() -> None: - from anysolver.plasticity import _require_local_convergence + from anyfesolver.plasticity import _require_local_convergence with pytest.raises(PlaneStressConvergenceError, match="maximum scaled residual"): _require_local_convergence( diff --git a/tests/test_plane_stress_stopping_consistency.py b/tests/test_plane_stress_stopping_consistency.py index fe84980fc..44e37f8f9 100644 --- a/tests/test_plane_stress_stopping_consistency.py +++ b/tests/test_plane_stress_stopping_consistency.py @@ -4,8 +4,8 @@ import numpy as np import pytest -from anysolver.material_curves import DNVC208MaterialCurve -from anysolver.plasticity import plane_stress_return_map +from anyfesolver.material_curves import DNVC208MaterialCurve +from anyfesolver.plasticity import plane_stress_return_map @pytest.mark.parametrize('max_iterations', [2, 30]) diff --git a/tests/test_plate_edge_shear.py b/tests/test_plate_edge_shear.py index d09b37735..9f5fd0c64 100644 --- a/tests/test_plate_edge_shear.py +++ b/tests/test_plate_edge_shear.py @@ -2,9 +2,9 @@ import importlib.util,json,pathlib import numpy as np import pytest -from anysolver import solve_static_nonlinear -from anysolver.nonlinear_static import _assemble_nonlinear_system -from anysolver.corotational import _corotational_cache,_corotational_deformation_state,spatial_force_and_moment_resultants +from anyfesolver import solve_static_nonlinear +from anyfesolver.nonlinear_static import _assemble_nonlinear_system +from anyfesolver.corotational import _corotational_cache,_corotational_deformation_state,spatial_force_and_moment_resultants spec=importlib.util.spec_from_file_location('plate_fixture',pathlib.Path(__file__).parents[1]/'scripts/investigate_plate_edge_shear.py') fixture=importlib.util.module_from_spec(spec);spec.loader.exec_module(fixture) diff --git a/tests/test_plate_stability_continuation.py b/tests/test_plate_stability_continuation.py index b30692bb7..c7e249382 100644 --- a/tests/test_plate_stability_continuation.py +++ b/tests/test_plate_stability_continuation.py @@ -1,9 +1,9 @@ import importlib.util,pathlib import numpy as np import pytest -from anysolver import solve_static_nonlinear -from anysolver._plate_stability_continuation import trust_steps,segment_work,admit -from anysolver.nonlinear_static import _assemble_nonlinear_system +from anyfesolver import solve_static_nonlinear +from anyfesolver._plate_stability_continuation import trust_steps,segment_work,admit +from anyfesolver.nonlinear_static import _assemble_nonlinear_system spec=importlib.util.spec_from_file_location('plate_case',pathlib.Path(__file__).parents[1]/'scripts/investigate_plate_edge_shear.py');fixture=importlib.util.module_from_spec(spec);spec.loader.exec_module(fixture) @pytest.mark.parametrize('gradient',[np.zeros(3),np.array([1e-15,-2e-15,.1]),np.array([1e-30,-2e-30,.1]),np.array([.2,-.4,.3])]) @@ -58,7 +58,7 @@ def raise_if_cancelled(self,stage): solve_static_nonlinear(m,None,kinematics='corotational',corotational_tangent='work_conjugate',stability_control='plate_energy',**kwargs) def test_cancellation_during_work_propagates_and_preserves_reference_geometry(): - from anysolver.control import SolveCancelled,CancellationToken + from anyfesolver.control import SolveCancelled,CancellationToken m=fixture.plate(.01,True);original=[(n.x,n.y,n.z) for n in m.mesh.nodes.values()] class Token(CancellationToken): calls=0 @@ -84,7 +84,7 @@ def test_large_mesh_refuses_before_solving(): @pytest.mark.parametrize('binding',['trust_steps','eigh','np','math']) def test_callback_cannot_replace_stability_algorithm(monkeypatch,binding): - import anysolver._plate_stability_continuation as helper + import anyfesolver._plate_stability_continuation as helper m=fixture.plate(1e-6,True) def status(message):monkeypatch.setattr(helper,binding,lambda *a: [np.zeros(1)]) with pytest.raises(ValueError,match='authority changed'): @@ -92,7 +92,7 @@ def status(message):monkeypatch.setattr(helper,binding,lambda *a: [np.zeros(1)]) def test_callback_cannot_replace_algorithm_code(monkeypatch): - import anysolver._plate_stability_continuation as helper + import anyfesolver._plate_stability_continuation as helper m=fixture.plate(1e-6,True) def status(message): monkeypatch.setattr(helper.trust_steps,'__code__',(lambda *args: []). __code__) @@ -103,7 +103,7 @@ def status(message): @pytest.mark.parametrize('amplitude,delta_scale',[(.002,None),(.01,None),(.1,None),(.01,1e-9)]) def test_two_point_local_work_matches_three_point_reference(amplitude,delta_scale): import math - from anysolver.corotational import _corotational_cache,_corotational_deformation_state + from anyfesolver.corotational import _corotational_cache,_corotational_deformation_state m=fixture.plate(.01,True);rng=np.random.default_rng(918) size=m.mesh.dof_manager.total_dofs old=amplitude*rng.standard_normal(size);new=amplitude*rng.standard_normal(size) diff --git a/tests/test_prepared_recovery_staging.py b/tests/test_prepared_recovery_staging.py index b4d1d5e41..185ff8737 100644 --- a/tests/test_prepared_recovery_staging.py +++ b/tests/test_prepared_recovery_staging.py @@ -1,9 +1,9 @@ """Source staging copy/resource contracts; synthetic arrays are not certification.""" import numpy as np import pytest -from anysolver import ResourceConfig -from anysolver.recovery import MemoryEstimate,ResourcePolicyError -from anysolver.prepared_static_recovery import (_verification_storage_bytes, +from anyfesolver import ResourceConfig +from anyfesolver.recovery import MemoryEstimate,ResourcePolicyError +from anyfesolver.prepared_static_recovery import (_verification_storage_bytes, _freeze_verification_value,_check_verification_memory) @@ -39,7 +39,7 @@ def test_pending_copy_budget_refuses_before_copy_under_existing_policy(): def test_staging_accepts_original_mapping_and_float_array_type_families(): from collections import OrderedDict,UserDict from collections.abc import Mapping - from anysolver.prepared_static_recovery import _array_value,_plain_constant + from anyfesolver.prepared_static_recovery import _array_value,_plain_constant class NativeArray(np.ndarray): pass values=np.asfortranarray(np.array([[-0.,1.25],[3.,4.]],dtype=np.float32)).view(NativeArray) native=OrderedDict(field=values,constant=UserDict(label='native',axis=(1.,2.))) @@ -60,9 +60,9 @@ class NativeArray(np.ndarray): pass def test_midloop_scope_exit_authority_failure_clears_queue_and_is_global(monkeypatch): import sys,threading,time - from anysolver import RecoveryConfig,PreparedStaticCapabilityError,prepare_static_response_evaluator - from anysolver.elements import BeamElement - import anysolver.prepared_static_recovery as recovery + from anyfesolver import RecoveryConfig,PreparedStaticCapabilityError,prepare_static_response_evaluator + from anyfesolver.elements import BeamElement + import anyfesolver.prepared_static_recovery as recovery from test_prepared_static_response_preparation import _independent_beams model,load=_independent_beams(64) main_id=threading.get_ident() @@ -113,9 +113,9 @@ def selected_components(self): @pytest.mark.parametrize('action',['observe','cancel','source_helper','checker_code']) def test_public_staging_keeps_native_config_observations_outside_scope(monkeypatch,action): - from anysolver import (RecoveryConfig,PreparedStaticCapabilityError,SolveCancelled, + from anyfesolver import (RecoveryConfig,PreparedStaticCapabilityError,SolveCancelled, prepare_static_response_evaluator) - import anysolver.prepared_static_recovery as recovery + import anyfesolver.prepared_static_recovery as recovery from test_prepared_static_response_preparation import _independent_beams model,load=_independent_beams(2) observations=[] @@ -147,8 +147,8 @@ def foreign(*args,**kwargs): pytest.fail('changed owned helper must not execute' def test_staged_comparison_keeps_two_defects_without_promising_refusal_order(): - from anysolver import RecoveryConfig,prepare_static_response_evaluator - import anysolver.prepared_static_recovery as recovery + from anyfesolver import RecoveryConfig,prepare_static_response_evaluator + import anyfesolver.prepared_static_recovery as recovery from test_prepared_static_response_preparation import _independent_beams model,load=_independent_beams(2) with prepare_static_response_evaluator(model,{'p':load}, @@ -173,8 +173,8 @@ def test_staged_comparison_keeps_two_defects_without_promising_refusal_order(): def test_public_resource_config_reaches_pre_copy_staging_refusal(): - from anysolver import RecoveryConfig,prepare_static_response_evaluator - from anysolver.recovery import estimate_model_memory + from anyfesolver import RecoveryConfig,prepare_static_response_evaluator + from anyfesolver.recovery import estimate_model_memory from test_prepared_static_response_preparation import _independent_beams model,load=_independent_beams(2) recovery=RecoveryConfig(include_stresses=True,include_reactions=False) diff --git a/tests/test_prepared_static_accounting_cache.py b/tests/test_prepared_static_accounting_cache.py index cd6bb358a..28b8314db 100644 --- a/tests/test_prepared_static_accounting_cache.py +++ b/tests/test_prepared_static_accounting_cache.py @@ -2,7 +2,7 @@ import sys import numpy as np import pytest -from anysolver.prepared_static_envelopes import ( +from anyfesolver.prepared_static_envelopes import ( CanonicalEnvelopePlan, EnvelopeAccumulator, _storage) diff --git a/tests/test_prepared_static_contracts.py b/tests/test_prepared_static_contracts.py index 5625e2539..ca96245bc 100644 --- a/tests/test_prepared_static_contracts.py +++ b/tests/test_prepared_static_contracts.py @@ -2,11 +2,11 @@ import numpy as np import pytest from test_prepared_static_evaluator import _bar, _case, _shell_model, _shell_case -from anysolver import (AnalysisSession, RecoveryConfig, StaticCase, prepare_static_evaluator, +from anyfesolver import (AnalysisSession, RecoveryConfig, StaticCase, prepare_static_evaluator, solve_linear, PreparedStaticError, LoadCase) -from anysolver.recovery import recover_stress_result -from anysolver.prepared_static_loads import ingest_static_case, evaluate_load_vector -from anysolver.matrix_assembly import assemble_load_vector +from anyfesolver.recovery import recover_stress_result +from anyfesolver.prepared_static_loads import ingest_static_case, evaluate_load_vector +from anyfesolver.matrix_assembly import assemble_load_vector def test_factory_session_selection_and_iterator_cleanup(): @@ -69,7 +69,7 @@ def test_selected_derived_recovery_and_actual_full_load(): def test_production_s3_v2d_full_load_and_recovery(): - from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement + from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement model = _shell_model() for eid, old in tuple(model.mesh.elements.items()): model.mesh.elements[eid] = NativeParityE4PLS3V2DShellElement(eid, old.node_ids, 'steel', thickness=.01, reference_normal=(0., 0., 1.)) @@ -94,8 +94,8 @@ def test_production_s3_v2d_full_load_and_recovery(): def test_generalized_beam_availability_and_coupling_acceleration(): - from anysolver import FixedSupport, BoundaryCondition - from anysolver.elements import CoupledBeamShellElement + from anyfesolver import FixedSupport, BoundaryCondition + from anyfesolver.elements import CoupledBeamShellElement from test_generalized_state_recovery import _beam_model model, element = _beam_model() model.add_boundary_condition(FixedSupport('fixed', [1])) @@ -118,7 +118,7 @@ def test_generalized_beam_availability_and_coupling_acceleration(): def test_native_massless_coupling_gravity_full_F(): - from anysolver.elements import CoupledBeamShellElement + from anyfesolver.elements import CoupledBeamShellElement model = _bar() model.add_node(3, 0., 0., 0.) model.add_element(2, CoupledBeamShellElement(2, 3, 1, 'steel')) @@ -132,7 +132,7 @@ def test_native_massless_coupling_gravity_full_F(): def test_unknown_derived_component_is_explicitly_refused(): - from anysolver import PreparedStaticCapabilityError + from anyfesolver import PreparedStaticCapabilityError model = _bar() recovery = RecoveryConfig(include_stresses=True, components=['principal_1']) with pytest.raises(PreparedStaticCapabilityError, match='source-reviewed') as error: @@ -141,7 +141,7 @@ def test_unknown_derived_component_is_explicitly_refused(): def test_reaction_diagnostic_metadata_is_detached(): - from anysolver.prepared_static_recovery import constraint_force_diagnostics + from anyfesolver.prepared_static_recovery import constraint_force_diagnostics model = _bar() with prepare_static_evaluator(model) as owner: snap = owner._snapshot @@ -158,7 +158,7 @@ def test_finalizer_releases_abandoned_close_and_failure_once(monkeypatch): import gc import importlib import weakref - module = importlib.import_module('anysolver.prepared_static') + module = importlib.import_module('anyfesolver.prepared_static') releases = [] original = module.AutoSparseSolverBackend.release_pattern_slots def release(backend): @@ -203,8 +203,8 @@ def test_numpy_scalar_pressure_and_static_follower_full_F(): def test_in_place_native_recovery_code_mutation_refused(monkeypatch): - from anysolver.elements import BeamElement - from anysolver import PreparedStaticCapabilityError + from anyfesolver.elements import BeamElement + from anyfesolver import PreparedStaticCapabilityError model = _bar() function = BeamElement.compute_stresses changed = tuple(.25 if type(value) is float and value == .5 else value for value in function.__code__.co_consts) @@ -215,7 +215,7 @@ def test_in_place_native_recovery_code_mutation_refused(monkeypatch): def test_custom_material_not_qualified_by_random_probes(): from anymaterial import IsotropicMaterial - from anysolver.prepared_static_recovery import _recovery_admission + from anyfesolver.prepared_static_recovery import _recovery_admission class ForeignMaterial(IsotropicMaterial): pass model = _bar() @@ -228,7 +228,7 @@ class ForeignMaterial(IsotropicMaterial): def test_instance_helper_shadow_and_custom_numeric_refused(): - from anysolver.prepared_static_loads import exact_element_authority, native_material_section_authority + from anyfesolver.prepared_static_loads import exact_element_authority, native_material_section_authority model = _bar() element = model.mesh.elements[1] element._get_element_displacements = lambda *args: np.zeros(12) @@ -247,8 +247,8 @@ def test_packet_memory_checked_before_numeric_copy(): # Replacing a module function after import is outside the supported contract # (the response authority check refuses it), so the order is checked through # the policy's own 'before copy' refusal. - from anysolver import ResourceConfig - from anysolver.recovery import ResourcePolicyError + from anyfesolver import ResourceConfig + from anyfesolver.recovery import ResourcePolicyError model = _bar() case = _case(1) case.load_case.nodal_loads[99999] = np.zeros(200000) @@ -289,7 +289,7 @@ def source(): def test_memory_policy_splits_individually_fitting_variable_packets(): - from anysolver import ResourceConfig + from anyfesolver import ResourceConfig model = _bar() cases = [_case(0), _case(1)] for case in cases: @@ -301,7 +301,7 @@ def test_memory_policy_splits_individually_fitting_variable_packets(): def test_principal_measure_analytic_rotation_and_eigen_residual(): - from anysolver.prepared_static_measures import principal_stresses + from anyfesolver.prepared_static_measures import principal_stresses tensors = [np.diag([3., -2., 1.]), np.array([[0., 4., 0.], [4., 0., 0.], [0., 0., 0.]])] expected = [[3., 1., -2.], [4., 0., -4.]] angle = .713 @@ -316,8 +316,8 @@ def test_principal_measure_analytic_rotation_and_eigen_residual(): def test_principal_shell_public_path_and_beam_refusal(): - from anysolver.prepared_static_measures import SHELL_LINEAR_COMPONENTS - from anysolver import PreparedStaticCapabilityError + from anyfesolver.prepared_static_measures import SHELL_LINEAR_COMPONENTS + from anyfesolver import PreparedStaticCapabilityError model = _shell_model() case = _shell_case(0, pressure=2.) selection = ['principal_stresses_top', 'principal_stresses_bottom'] @@ -343,7 +343,7 @@ def test_principal_shell_public_path_and_beam_refusal(): def test_preparation_cancellation_preserves_type_and_reports_phases(): - from anysolver import CancellationToken, SolveCancelled + from anyfesolver import CancellationToken, SolveCancelled token = CancellationToken() token.cancel('before prepare') with pytest.raises(SolveCancelled): @@ -369,7 +369,7 @@ def close(self): closed.append(True) def test_shadowed_model_material_provider_refused_before_callback(): - from anysolver import PreparedStaticCapabilityError + from anyfesolver import PreparedStaticCapabilityError model = _bar() def forbidden(*args): raise AssertionError('foreign provider must not run') @@ -379,8 +379,8 @@ def forbidden(*args): def test_pressure_fast_span_uses_canonical_callback_free_proof(monkeypatch): - from anysolver.prepared_static_loads import _pressure_probes_are_package_only - import anysolver.boundary as boundary + from anyfesolver.prepared_static_loads import _pressure_probes_are_package_only + import anyfesolver.boundary as boundary model = _shell_model() assert _pressure_probes_are_package_only(model) monkeypatch.setattr(boundary, '_numpy_error_routes_are_builtin', lambda: False) @@ -391,7 +391,7 @@ def test_pressure_fast_span_uses_canonical_callback_free_proof(monkeypatch): def test_pressure_fast_span_uses_full_guards_with_activity_provider(): - from anysolver.prepared_static_loads import _pressure_probes_are_package_only + from anyfesolver.prepared_static_loads import _pressure_probes_are_package_only model = _shell_model() class Activity: def __getattr__(self, name): @@ -401,9 +401,9 @@ def __getattr__(self, name): def test_shadowed_mapping_items_never_runs_inside_pressure_trust(): - from anysolver.prepared_static_loads import _pressure_probes_are_package_only - from anysolver.e4_pl_element import _q4_trusted_operation_accepts - from anysolver.e4_pl_s3_element import _s3_trusted_operation_accepts + from anyfesolver.prepared_static_loads import _pressure_probes_are_package_only + from anyfesolver.e4_pl_element import _q4_trusted_operation_accepts + from anyfesolver.e4_pl_s3_element import _s3_trusted_operation_accepts model = _shell_model() observed = [] def shadow_items(): @@ -434,7 +434,7 @@ def test_returned_dof_headers_cannot_change_future_labels(): def test_owned_local_refinement_multiple_scales_and_source_gc(): import gc import weakref - from anysolver.prepared_static_recovery import apply_compiled_recovery + from anyfesolver.prepared_static_recovery import apply_compiled_recovery model = _shell_model() recovery = RecoveryConfig(include_stresses=True) owner = prepare_static_evaluator(model, recovery_config=recovery) @@ -461,8 +461,8 @@ def test_owned_local_refinement_multiple_scales_and_source_gc(): def test_owned_refinement_refuses_post_preparation_class_patch(monkeypatch): - from anysolver.prepared_static_recovery import _recover_owned_local - from anysolver.prepared_static_loads import PreparedStaticCapabilityError + from anyfesolver.prepared_static_recovery import _recover_owned_local + from anyfesolver.prepared_static_loads import PreparedStaticCapabilityError with prepare_static_evaluator(_shell_model(), recovery_config=RecoveryConfig(include_stresses=True)) as owner: recipe = next(iter(owner._snapshot.recovery_compilation.elements.values())).local_recipe element = recipe.execution_owner[0] diff --git a/tests/test_prepared_static_envelopes.py b/tests/test_prepared_static_envelopes.py index 88b0b5064..4c214717c 100644 --- a/tests/test_prepared_static_envelopes.py +++ b/tests/test_prepared_static_envelopes.py @@ -1,9 +1,9 @@ import numpy as np import pytest from test_prepared_static_evaluator import _bar, _case, _shell_model, _shell_case -from anysolver import prepare_static_evaluator, RecoveryConfig, StaticCase -from anysolver.prepared_static_loads import ingest_static_case, evaluate_load_vector -from anysolver.matrix_assembly import assemble_load_vector +from anyfesolver import prepare_static_evaluator, RecoveryConfig, StaticCase +from anyfesolver.prepared_static_loads import ingest_static_case, evaluate_load_vector +from anyfesolver.matrix_assembly import assemble_load_vector def test_canonical_load_staging_is_bitwise_for_pressure_and_added_mass(): @@ -71,9 +71,9 @@ def test_envelope_principal_associated_fields_are_same_sample(): def test_owned_scope_refuses_replaced_numpy_proof(monkeypatch): - import anysolver.boundary as boundary - from anysolver.prepared_static_recovery import owned_recovery_scope - from anysolver import PreparedStaticCapabilityError + import anyfesolver.boundary as boundary + from anyfesolver.prepared_static_recovery import owned_recovery_scope + from anyfesolver import PreparedStaticCapabilityError monkeypatch.setattr(boundary, '_numpy_error_routes_are_builtin', lambda: True) with pytest.raises(PreparedStaticCapabilityError, match='guard binding authority'): with owned_recovery_scope(()): @@ -115,7 +115,7 @@ def test_original_free_counterexamples_have_exact_load_displacement_and_envelope from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'scripts')) from benchmark_static_batches import mixed_free_model, free_cases, numeric_leaves - from anysolver import iter_linear_batches, EnvelopeReducer + from anyfesolver import iter_linear_batches, EnvelopeReducer from dataclasses import replace model, groups, balancing = mixed_free_model() cases = [StaticCase(name, load, instant) for name, instant, load in free_cases(model, groups, balancing, [0, 48, 576])] @@ -148,9 +148,9 @@ def test_original_free_counterexamples_have_exact_load_displacement_and_envelope @pytest.mark.parametrize('mutation', ['binding', 'code']) def test_owned_scope_pins_factories_before_lending_private_elements(monkeypatch, module_name, factory_name, mutation): import importlib - from anysolver.prepared_static_recovery import owned_recovery_scope - from anysolver import PreparedStaticCapabilityError - module = importlib.import_module('anysolver.' + module_name) + from anyfesolver.prepared_static_recovery import owned_recovery_scope + from anyfesolver import PreparedStaticCapabilityError + module = importlib.import_module('anyfesolver.' + module_name) factory = getattr(module, factory_name) observed = [] if mutation == 'binding': @@ -166,7 +166,7 @@ def test_owned_scope_pins_factories_before_lending_private_elements(monkeypatch, @pytest.mark.parametrize('phase', ['exhaustion', 'cleanup']) @pytest.mark.parametrize('action', ['close', 'cancel']) def test_envelope_exhaustion_and_cleanup_observations_cannot_certify_closed_or_cancelled(phase, action): - from anysolver import CancellationToken, SolveCancelled + from anyfesolver import CancellationToken, SolveCancelled config = RecoveryConfig(include_displacements=True, include_stresses=False, include_reactions=False) token = CancellationToken() owner = prepare_static_evaluator(_bar(), envelope_recovery_config=config) @@ -191,8 +191,8 @@ def close(self): def test_envelope_one_case_policy_counts_transaction_and_tile_before_factor(): # Replacing a module function after import is outside the supported contract # (the response authority check refuses it); the policy refusal is checked directly. - from anysolver import ResourceConfig - from anysolver.recovery import ResourcePolicyError + from anyfesolver import ResourceConfig + from anyfesolver.recovery import ResourcePolicyError config = RecoveryConfig(components=['axial_stress'], include_displacements=True, include_reactions=True) with prepare_static_evaluator(_bar(), envelope_recovery_config=config) as probe: snapshot = probe._snapshot diff --git a/tests/test_prepared_static_evaluator.py b/tests/test_prepared_static_evaluator.py index d238c324a..2d883d0d8 100644 --- a/tests/test_prepared_static_evaluator.py +++ b/tests/test_prepared_static_evaluator.py @@ -6,7 +6,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( AnalysisSession, BoundaryCondition, CancellationToken, @@ -22,10 +22,10 @@ prepare_static_evaluator, solve_linear, ) -from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel -from anysolver.recovery import ResourcePolicyError, recover_stress_result +from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.recovery import ResourcePolicyError, recover_stress_result def _bar(supported: bool = True): @@ -209,7 +209,7 @@ def test_compiled_stress_recovery_matches_live_oracle(): # through a second evaluator call with the displacement injected via # the affine structure: recovery of u is baseline + A @ u, verified # directly against the oracle here. - from anysolver.prepared_static_recovery import apply_compiled_recovery + from anyfesolver.prepared_static_recovery import apply_compiled_recovery compilation = evaluator.diagnostics() assert compilation["snapshot"]["recovery_compiled_elements"] == 2 snapshot = evaluator._snapshot @@ -265,7 +265,7 @@ class ForeignLoadCase(LoadCase): def test_unadmitted_stress_family_is_refused_at_preparation(): - from anysolver.materials import Hill48Yield + from anyfesolver.materials import Hill48Yield model = _shell_model() model.add_material("hill", 210.0e9, 0.3, density=100.0) diff --git a/tests/test_prepared_static_independent.py b/tests/test_prepared_static_independent.py index 4deeffab3..c0f202073 100644 --- a/tests/test_prepared_static_independent.py +++ b/tests/test_prepared_static_independent.py @@ -5,12 +5,12 @@ import numpy as np import pytest -from anysolver import (FEModel, LoadCase, FixedSupport, BoundaryCondition, +from anyfesolver import (FEModel, LoadCase, FixedSupport, BoundaryCondition, AnalysisSession, RecoveryConfig, StaticCase, solve_linear, compute_constraint_force_diagnostics, CancellationToken, SolveCancelled) -from anysolver.elements import BeamElement -from anysolver.prepared_static import prepare_static_evaluator +from anyfesolver.elements import BeamElement +from anyfesolver.prepared_static import prepare_static_evaluator def model(): @@ -140,7 +140,7 @@ def test_cancel_after_certified_block_and_close_iterator_releases_active_run(): np.testing.assert_allclose(again.displacements, [[.02]], rtol=1e-12, atol=1e-14) def test_preparation_rejects_raw_structural_change_without_revision_bump(monkeypatch): - import anysolver.prepared_static_snapshot as module + import anyfesolver.prepared_static_snapshot as module m = model() original = module.compile_canonical_load_maps def changing(*args, **kwargs): diff --git a/tests/test_prepared_static_mass_capture.py b/tests/test_prepared_static_mass_capture.py index 4b098327e..f8754d469 100644 --- a/tests/test_prepared_static_mass_capture.py +++ b/tests/test_prepared_static_mass_capture.py @@ -3,11 +3,11 @@ from collections import Counter import numpy as np import pytest -from anysolver import (LoadCase, StaticCase, RecoveryConfig, prepare_static_evaluator, +from anyfesolver import (LoadCase, StaticCase, RecoveryConfig, prepare_static_evaluator, PreparedStaticCapabilityError, CancellationToken, SolveCancelled) -from anysolver.elements import BeamElement, CoupledBeamShellElement -from anysolver.matrix_assembly import assemble_load_vector -from anysolver.prepared_static_loads import compile_canonical_load_maps, ingest_static_case, evaluate_load_vector +from anyfesolver.elements import BeamElement, CoupledBeamShellElement +from anyfesolver.matrix_assembly import assemble_load_vector +from anyfesolver.prepared_static_loads import compile_canonical_load_maps, ingest_static_case, evaluate_load_vector from test_prepared_static_evaluator import _bar, _case, _shell_model @@ -34,7 +34,7 @@ def observer(frame, event, arg): @pytest.mark.parametrize('factory', [_bar, _shell_model]) def test_full_F_exact_axes_general_added_mass_activity_and_snapshot_isolation(factory): - from anysolver.activity import ElementActivity, ElementActivityPolicy + from anyfesolver.activity import ElementActivity, ElementActivityPolicy model = factory() ids = tuple(model.mesh.elements) activity = ElementActivity(ids, .375, policy=ElementActivityPolicy(load='activity', mass='delete_only')) diff --git a/tests/test_prepared_static_pressure_verification.py b/tests/test_prepared_static_pressure_verification.py index a046c172a..8b16e8d48 100644 --- a/tests/test_prepared_static_pressure_verification.py +++ b/tests/test_prepared_static_pressure_verification.py @@ -2,9 +2,9 @@ import sys import pytest from test_prepared_static_evaluator import _shell_model -from anysolver import PreparedStaticCapabilityError -from anysolver import prepared_static_loads as loads -from anysolver import prepared_static_recovery as recovery +from anyfesolver import PreparedStaticCapabilityError +from anyfesolver import prepared_static_loads as loads +from anyfesolver import prepared_static_recovery as recovery def test_pressure_verification_uses_one_owned_authority_span(): @@ -58,7 +58,7 @@ def execution_owner(self): def test_owned_scope_postcheck_and_primary_error_precedence(monkeypatch): - from anysolver.elements import BeamElement + from anyfesolver.elements import BeamElement model = _shell_model() model.apply_boundary_conditions() maps = loads.compile_canonical_load_maps(model, families=('pressure',)) diff --git a/tests/test_prepared_static_q4.py b/tests/test_prepared_static_q4.py index d7b5ec121..5cbef4f19 100644 --- a/tests/test_prepared_static_q4.py +++ b/tests/test_prepared_static_q4.py @@ -1,11 +1,11 @@ """Focused correctness/activation checks; no timings or numerical campaign.""" import numpy as np import pytest -from anysolver import RecoveryConfig, prepare_static_evaluator, PreparedStaticCapabilityError -from anysolver.fe_core import FEModel -from anysolver.e4_pl_element import QualifiedE4PLShellElement -from anysolver.prepared_static_recovery import _capture_owned_local_recovery, _recover_owned_local, owned_recovery_scope -from anysolver import prepared_static_q4 as staged +from anyfesolver import RecoveryConfig, prepare_static_evaluator, PreparedStaticCapabilityError +from anyfesolver.fe_core import FEModel +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement +from anyfesolver.prepared_static_recovery import _capture_owned_local_recovery, _recover_owned_local, owned_recovery_scope +from anyfesolver import prepared_static_q4 as staged def _q4_model(sign=1, warped=False): @@ -109,7 +109,7 @@ def test_staged_q4_public_activation_fallback_and_source_deletion(batch_size): from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'scripts')) from benchmark_static_batches import mixed_free_model, free_cases - from anysolver import StaticCase, iter_linear_batches + from anyfesolver import StaticCase, iter_linear_batches model, groups, balancing = mixed_free_model() cases = [StaticCase(name, load, instant) for name, instant, load in free_cases(model, groups, balancing, [0,48])] * 16 config = RecoveryConfig(include_displacements=False, include_stresses=True, include_reactions=False) diff --git a/tests/test_prepared_static_q4_compensated_policy.py b/tests/test_prepared_static_q4_compensated_policy.py index 52208cc8f..9ce37c6a4 100644 --- a/tests/test_prepared_static_q4_compensated_policy.py +++ b/tests/test_prepared_static_q4_compensated_policy.py @@ -4,9 +4,9 @@ import numpy as np import pytest -from anysolver import prepared_static_q4 as staged -from anysolver.prepared_static_loads import PreparedStaticCapabilityError -from anysolver.prepared_static_recovery import ( +from anyfesolver import prepared_static_q4 as staged +from anyfesolver.prepared_static_loads import PreparedStaticCapabilityError +from anyfesolver.prepared_static_recovery import ( _AFFINITY_RELATIVE_TOLERANCE, _capture_owned_local_recovery, _recover_owned_local, owned_recovery_scope, trusted_capture_scope, ) @@ -18,8 +18,8 @@ def test_original_planar_coordinate_policy_parity_and_source_deletion(coordinate_type, revision, eligible, trusted): import gc import weakref - from anysolver.fe_core import FEModel - from anysolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.fe_core import FEModel + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement model = FEModel('original-coordinate-policy') model.add_material('steel', 210e9, .3, density=7800.) for number, point in enumerate(((0., 0., 0.), (2.4, .2, 0.), (2.1, 1.7, 0.), (-.1, 1., 0.)), 1): @@ -37,9 +37,9 @@ def test_original_planar_coordinate_policy_parity_and_source_deletion(coordinate for displacement in displacements: displacement[0::6] += .3 expected = [element.compute_stresses(model.mesh, displacement, material, return_global=False) for displacement in displacements] - from anysolver import RecoveryConfig, prepare_static_evaluator - from anysolver.prepared_static_loads import PreparedStaticError - from anysolver.matrix_assembly import AssemblyError + from anyfesolver import RecoveryConfig, prepare_static_evaluator + from anyfesolver.prepared_static_loads import PreparedStaticError + from anyfesolver.matrix_assembly import AssemblyError config = RecoveryConfig(include_displacements=False, include_stresses=True, include_reactions=False) public_owner = None if type(revision) is not int: diff --git a/tests/test_prepared_static_response.py b/tests/test_prepared_static_response.py index d0e6d6552..59ca05cdb 100644 --- a/tests/test_prepared_static_response.py +++ b/tests/test_prepared_static_response.py @@ -1,6 +1,6 @@ import numpy as np import pytest -from anysolver import (PatternCase, prepare_static_response_evaluator, prepare_static_evaluator, +from anyfesolver import (PatternCase, prepare_static_response_evaluator, prepare_static_evaluator, RecoveryConfig, ResourceConfig, StaticCase, LoadCase, PreparedStaticError, CancellationToken, SolveCancelled) from test_prepared_static_evaluator import _bar, _case, _shell_model, _shell_case @@ -79,7 +79,7 @@ def test_memory_batches_and_callback_cancel(): next(evaluator.iter_batches([PatternCase('x',{})],cancellation_token=token)) def test_dense_coefficients_and_execution_authority(monkeypatch): - from anysolver.prepared_static_response import PreparedStaticResponseEvaluator + from anyfesolver.prepared_static_response import PreparedStaticResponseEvaluator model = _bar() with prepare_static_response_evaluator(model,{'p':_case(1).load_case}) as evaluator: batches = list(evaluator.iter_batches([PatternCase('a',[2.]),PatternCase('b',np.array([2.]))])) @@ -102,7 +102,7 @@ def fail(*args,**kwargs): def test_nonzero_prescribed_offset_applied_once(): - from anysolver import BoundaryCondition + from anyfesolver import BoundaryCondition model = _bar() # Use the native boundary API for a nonzero support offset. model = _bar(False) @@ -133,7 +133,7 @@ def test_tiny_actual_source_discrepancy_still_replays(): assert evaluator.diagnostics()['source_response']['certification_fallback_cases'] == 1 def test_library_metadata_is_retained_and_budgeted(): - from anysolver.prepared_static_response import _library_storage_bytes + from anyfesolver.prepared_static_response import _library_storage_bytes with prepare_static_response_evaluator(_bar(),{'long_pattern_name'*100:_case(1).load_case}) as evaluator: info = evaluator.diagnostics()['source_response'] numeric = evaluator._force_columns.nbytes + evaluator._solution_columns.nbytes @@ -149,8 +149,8 @@ def test_library_metadata_is_retained_and_budgeted(): @pytest.mark.parametrize('stage', ['before_library','ready']) def test_preparation_token_never_runs_in_owned_scope_and_rechecks_authority(monkeypatch, stage): - import anysolver.prepared_static_response as response_module - import anysolver.prepared_static_recovery as recovery_module + import anyfesolver.prepared_static_response as response_module + import anyfesolver.prepared_static_recovery as recovery_module observed = [] class HostileToken: def raise_if_cancelled(self, where): @@ -163,7 +163,7 @@ def raise_if_cancelled(self, where): assert observed == [None] def test_pattern_label_memory_is_checked_before_ingestion(): - from anysolver.recovery import ResourcePolicyError + from anyfesolver.recovery import ResourcePolicyError with prepare_static_response_evaluator(_bar(),{'p':_case(1).load_case}, resource_config=ResourceConfig(memory_limit_bytes=200000)) as owner: with pytest.raises(ResourcePolicyError,match='before copy'): @@ -178,8 +178,8 @@ def __sizeof__(self): @pytest.mark.parametrize('kind',['base','response']) @pytest.mark.parametrize('hook',['_load_vector','_require_open']) def test_evaluator_subclasses_refused_before_trusted_preparation(kind,hook): - from anysolver import PreparedStaticEvaluator, PreparedStaticResponseEvaluator - from anysolver.prepared_static_response import _require_response_authority + from anyfesolver import PreparedStaticEvaluator, PreparedStaticResponseEvaluator + from anyfesolver.prepared_static_response import _require_response_authority parent = PreparedStaticEvaluator if kind == 'base' else PreparedStaticResponseEvaluator def foreign(*args,**kwargs): pytest.fail('foreign evaluator hook executed') @@ -192,8 +192,8 @@ def foreign(*args,**kwargs): @pytest.mark.parametrize('where',['class','instance','global']) @pytest.mark.parametrize('when',['before_iteration','during_input']) def test_native_base_hook_authority_before_owned_load_span(monkeypatch,where,when): - from anysolver import PreparedStaticEvaluator - import anysolver.prepared_static as base_module + from anyfesolver import PreparedStaticEvaluator + import anyfesolver.prepared_static as base_module owner = prepare_static_evaluator(_bar()) called = [] def foreign(*args,**kwargs): diff --git a/tests/test_prepared_static_response_accuracy.py b/tests/test_prepared_static_response_accuracy.py index 834e0cc55..389888b01 100644 --- a/tests/test_prepared_static_response_accuracy.py +++ b/tests/test_prepared_static_response_accuracy.py @@ -1,8 +1,8 @@ """Historical recovery arithmetic counterexamples on the source-response route.""" import numpy as np -from anysolver import PatternCase, RecoveryConfig, prepare_static_response_evaluator -from anysolver.recovery import recover_stress_result -from anysolver.prepared_static_measures import shell_surface_tensor +from anyfesolver import PatternCase, RecoveryConfig, prepare_static_response_evaluator +from anyfesolver.recovery import recover_stress_result +from anyfesolver.prepared_static_measures import shell_surface_tensor from test_prepared_static_evaluator import _shell_model, _shell_case @@ -30,7 +30,7 @@ def test_response_mixed_historical_roundoff_diagnostic(): from pathlib import Path sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'scripts')) from benchmark_static_batches import mixed_free_model,free_cases,numeric_leaves - from anysolver.prepared_static import PreparedStaticEvaluator + from anyfesolver.prepared_static import PreparedStaticEvaluator model,groups,balancing = mixed_free_model() patterns = {name:load for name,time,load in free_cases(model,groups,balancing,[0,48,576])} config = RecoveryConfig(element_ids=[1,4,5,6],include_stresses=True,include_reactions=False) diff --git a/tests/test_prepared_static_response_m11_independent.py b/tests/test_prepared_static_response_m11_independent.py index 8919b1f3d..05fdbe1c5 100644 --- a/tests/test_prepared_static_response_m11_independent.py +++ b/tests/test_prepared_static_response_m11_independent.py @@ -5,7 +5,7 @@ import pytest from scipy import sparse -from anysolver.assembly import _backward_error +from anyfesolver.assembly import _backward_error from prepared_static_response_m11_gate import GateRefusal, gate_enclosure diff --git a/tests/test_prepared_static_response_m16.py b/tests/test_prepared_static_response_m16.py index e8df8dd44..c8e2e8c6b 100644 --- a/tests/test_prepared_static_response_m16.py +++ b/tests/test_prepared_static_response_m16.py @@ -1,7 +1,7 @@ """M16 certified response route: behaviour (criterion C6) and development fixtures.""" import numpy as np import pytest -from anysolver import (PatternCase, prepare_static_response_evaluator, RecoveryConfig, +from anyfesolver import (PatternCase, prepare_static_response_evaluator, RecoveryConfig, PreparedStaticError, PreparedStaticCapabilityError, LoadCase) from test_prepared_static_evaluator import _bar, _case, _shell_model, _shell_case import prepared_static_response_m16_assessment as assessment @@ -79,7 +79,7 @@ def strict(*args): def test_nonaffine_recovery_refused(monkeypatch): - import anysolver.prepared_static_response as response_module + import anyfesolver.prepared_static_response as response_module zero = {'axial_stress': np.zeros(2), 'label': 'beam'} schema = response_module._library_schema(7, zero) monkeypatch.setattr(response_module, '_recover_owned_local', @@ -89,7 +89,7 @@ def test_nonaffine_recovery_refused(monkeypatch): def test_unreproducible_derived_measure_refused(monkeypatch): - import anysolver.prepared_static_response as response_module + import anyfesolver.prepared_static_response as response_module zero = {'axial_stress': np.zeros(2), 'von_mises': np.zeros(2)} schema = response_module._library_schema(8, zero) monkeypatch.setattr(response_module, '_recover_owned_local', @@ -100,8 +100,8 @@ def test_unreproducible_derived_measure_refused(monkeypatch): @pytest.mark.parametrize('stage', ['element_schema', 'element_library']) def test_library_token_never_runs_in_owned_scope(monkeypatch, stage): - import anysolver.prepared_static_response as response_module - import anysolver.prepared_static_recovery as recovery_module + import anyfesolver.prepared_static_response as response_module + import anyfesolver.prepared_static_recovery as recovery_module observed = [] class HostileToken: def raise_if_cancelled(self, where): @@ -129,7 +129,7 @@ def test_envelope_route_labels_and_close_releases_library(): def test_offsets_and_constrained_loads_once_in_library_route(): - from anysolver import BoundaryCondition, prepare_static_evaluator + from anyfesolver import BoundaryCondition, prepare_static_evaluator model = _bar(False) model.add_boundary_condition(BoundaryCondition('left', [1], {'ux': 0.001, 'uy': 0., 'uz': 0., 'rx': 0., 'ry': 0., 'rz': 0.})) model.add_boundary_condition(BoundaryCondition('right', [2], {'uy': 0., 'uz': 0., 'rx': 0., 'ry': 0., 'rz': 0.})) diff --git a/tests/test_prepared_static_response_m16_controls.py b/tests/test_prepared_static_response_m16_controls.py index 80b880267..7b6250d26 100644 --- a/tests/test_prepared_static_response_m16_controls.py +++ b/tests/test_prepared_static_response_m16_controls.py @@ -8,7 +8,7 @@ import json import numpy as np import prepared_static_response_m16_assessment as assessment -from anysolver import RecoveryConfig +from anyfesolver import RecoveryConfig from test_prepared_static_evaluator import _shell_model, _shell_case diff --git a/tests/test_prepared_static_response_m17.py b/tests/test_prepared_static_response_m17.py index 55d93da89..11bdf4ea3 100644 --- a/tests/test_prepared_static_response_m17.py +++ b/tests/test_prepared_static_response_m17.py @@ -2,7 +2,7 @@ import json import numpy as np import pytest -from anysolver import (PatternCase, prepare_static_response_evaluator, RecoveryConfig, +from anyfesolver import (PatternCase, prepare_static_response_evaluator, RecoveryConfig, PreparedStaticError, PreparedStaticCapabilityError) from test_prepared_static_evaluator import _bar, _case, _shell_model, _shell_case import prepared_static_response_m16_assessment as assessment @@ -77,8 +77,8 @@ def fail(*args, **kwargs): def test_vectorized_token_never_runs_in_owned_scope(monkeypatch): - import anysolver.prepared_static_response as response_module - import anysolver.prepared_static_recovery as recovery_module + import anyfesolver.prepared_static_response as response_module + import anyfesolver.prepared_static_recovery as recovery_module observed = [] class HostileToken: def raise_if_cancelled(self, where): @@ -92,7 +92,7 @@ def raise_if_cancelled(self, where): def test_nonaffine_vectorized_probe_refused(monkeypatch): - import anysolver.prepared_static_vectorized as vector_module + import anyfesolver.prepared_static_vectorized as vector_module monkeypatch.setattr(vector_module, '_recover_owned_local', lambda recipe, local: {'axial_stress': np.full(2, float(np.sum(local)) ** 2), 'label': 'beam'}) with pytest.raises(PreparedStaticCapabilityError, match='not affine'): diff --git a/tests/test_prepared_static_response_m20.py b/tests/test_prepared_static_response_m20.py index b1b75d225..3ff18e2ed 100644 --- a/tests/test_prepared_static_response_m20.py +++ b/tests/test_prepared_static_response_m20.py @@ -5,12 +5,12 @@ import numpy as np import pytest -from anysolver import (PatternCase, prepare_static_response_evaluator, prepare_static_evaluator, RecoveryConfig, +from anyfesolver import (PatternCase, prepare_static_response_evaluator, prepare_static_evaluator, RecoveryConfig, LoadCase, BoundaryCondition, PreparedStaticCapabilityError) -from anysolver.prepared_static_loads import ingest_static_case -from anysolver.prepared_static_recovery import constraint_force_diagnostics, constraint_force_maps -from anysolver.prepared_static_vectorized import make_metadata_copier, _structurally_identical -from anysolver.static_batch import StaticCase +from anyfesolver.prepared_static_loads import ingest_static_case +from anyfesolver.prepared_static_recovery import constraint_force_diagnostics, constraint_force_maps +from anyfesolver.prepared_static_vectorized import make_metadata_copier, _structurally_identical +from anyfesolver.static_batch import StaticCase from test_prepared_static_evaluator import _bar, _case, _shell_model, _shell_case from test_prepared_static_independent import model as independent_model import prepared_static_response_m16_assessment as assessment diff --git a/tests/test_prepared_static_response_m21.py b/tests/test_prepared_static_response_m21.py index 7d605bb7f..8ebb39f73 100644 --- a/tests/test_prepared_static_response_m21.py +++ b/tests/test_prepared_static_response_m21.py @@ -1,8 +1,8 @@ """M21: batched staged unit probes for the vectorized affine maps.""" import numpy as np -from anysolver import RecoveryConfig, prepare_static_response_evaluator -from anysolver.prepared_static_recovery import owned_recovery_scope, _recover_owned_local -from anysolver import prepared_static_vectorized as vector +from anyfesolver import RecoveryConfig, prepare_static_response_evaluator +from anyfesolver.prepared_static_recovery import owned_recovery_scope, _recover_owned_local +from anyfesolver import prepared_static_vectorized as vector import prepared_static_response_m16_assessment # noqa: F401 (adds scripts/ to sys.path) from benchmark_static_batches import mixed_free_model, free_cases diff --git a/tests/test_prepared_static_response_m22.py b/tests/test_prepared_static_response_m22.py index a2b0bbaa7..5b5f7fd2a 100644 --- a/tests/test_prepared_static_response_m22.py +++ b/tests/test_prepared_static_response_m22.py @@ -1,11 +1,11 @@ """M22: review repairs (F1-F4, F8) and output-identical speed-ups (S1, S2a, S5, S8).""" import numpy as np import pytest -from anysolver import (PatternCase, prepare_static_response_evaluator, prepare_static_evaluator, RecoveryConfig, +from anyfesolver import (PatternCase, prepare_static_response_evaluator, prepare_static_evaluator, RecoveryConfig, LoadCase, BoundaryCondition, PreparedStaticError, PreparedStaticCapabilityError) -from anysolver.prepared_static_recovery import (constraint_force_diagnostics, ReactionPlan, +from anyfesolver.prepared_static_recovery import (constraint_force_diagnostics, ReactionPlan, planned_constraint_force_diagnostics) -from anysolver.static_batch import StaticCase +from anyfesolver.static_batch import StaticCase from test_prepared_static_evaluator import _bar, _case, _shell_model, _shell_case from test_prepared_static_independent import model as independent_model import prepared_static_response_m16_assessment as assessment @@ -94,7 +94,7 @@ def test_compiled_disagreement_falls_back_with_native_load(): def test_new_bindings_are_pinned_by_response_guard(monkeypatch): - import anysolver.prepared_static_vectorized as vector_module + import anyfesolver.prepared_static_vectorized as vector_module patterns = {'p': _shell_case(0, pressure=2.).load_case} with prepare_static_response_evaluator(_shell_model(), patterns, recovery_config=STRESS, **VECTOR) as owner: monkeypatch.setattr(vector_module, 'evaluate_load_vector', lambda *args: pytest.fail('replaced helper executed')) @@ -103,7 +103,7 @@ def test_new_bindings_are_pinned_by_response_guard(monkeypatch): def test_vector_memory_checked_before_allocation(): - from anysolver import prepared_static_vectorized as vector + from anyfesolver import prepared_static_vectorized as vector with prepare_static_response_evaluator(_shell_model(), {'p': _shell_case(0, pressure=2.).load_case}, recovery_config=STRESS) as owner: union = owner._library_elements(owner._snapshot) diff --git a/tests/test_prepared_static_response_m24.py b/tests/test_prepared_static_response_m24.py index 13f78dc4e..c9b27021b 100644 --- a/tests/test_prepared_static_response_m24.py +++ b/tests/test_prepared_static_response_m24.py @@ -4,7 +4,7 @@ import numpy as np import pytest -from anysolver import PatternCase, prepare_static_response_evaluator, RecoveryConfig, PreparedStaticCapabilityError +from anyfesolver import PatternCase, prepare_static_response_evaluator, RecoveryConfig, PreparedStaticCapabilityError from test_prepared_static_evaluator import _bar, _case import prepared_static_response_m16_assessment as assessment diff --git a/tests/test_prepared_static_response_m25.py b/tests/test_prepared_static_response_m25.py index 67045fb5a..8f0881477 100644 --- a/tests/test_prepared_static_response_m25.py +++ b/tests/test_prepared_static_response_m25.py @@ -26,15 +26,15 @@ import numpy as np import pytest -from anysolver import PreparedStaticCapabilityError -from anysolver import e4_pl_element as q4_module -from anysolver import e4_pl_s3_element as s3_module -from anysolver import prepared_static_recovery as recovery -from anysolver.boundary import LoadCase -from anysolver.control import SolveCancelled -from anysolver.elements import BeamElement -from anysolver.fe_core import _QualifiedStateMapping -from anysolver.prepared_static_recovery import (_capture_owned_local_recovery, _recover_owned_local, +from anyfesolver import PreparedStaticCapabilityError +from anyfesolver import e4_pl_element as q4_module +from anyfesolver import e4_pl_s3_element as s3_module +from anyfesolver import prepared_static_recovery as recovery +from anyfesolver.boundary import LoadCase +from anyfesolver.control import SolveCancelled +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import _QualifiedStateMapping +from anyfesolver.prepared_static_recovery import (_capture_owned_local_recovery, _recover_owned_local, owned_recovery_scope) import prepared_static_response_m16_assessment # noqa: F401 (adds scripts/ to sys.path) from benchmark_static_batches import mixed_free_model @@ -254,7 +254,7 @@ def test_trusted_capture_equals_guarded_capture(kind, monkeypatch): import json, sys sys.path[:0] = json.loads(sys.argv[2]) import test_prepared_static_response_m25 as m25 -from anysolver import prepared_static_recovery as recovery +from anyfesolver import prepared_static_recovery as recovery made = [] with recovery.trusted_capture_scope(sys.argv[1] == 'trusted'): for kind in m25.KINDS: @@ -485,7 +485,7 @@ def test_rebound_scope_tables_are_refused_by_the_opt_in_capture(table, monkeypat import json, sys sys.path[:0] = json.loads(sys.argv[1]) import test_prepared_static_response_m25 as m25 -from anysolver import prepared_static_recovery as recovery +from anyfesolver import prepared_static_recovery as recovery model, element, _options, _staged = m25._case('q4_staged') with recovery.trusted_capture_scope(False): recipe = recovery._capture_owned_local_recovery(model, element) @@ -696,14 +696,14 @@ def tracer(frame, event, arg): def test_late_module_hook_is_pinned(monkeypatch): - """Blocker 2: the anysolver package's own __getattr__ is pinned after first use; a + """Blocker 2: the anyfesolver package's own __getattr__ is pinned after first use; a replacement that merely looks canonical (same globals, file name and function name) removes trust, and the module __file__ is never compared through __eq__.""" import types - import anysolver + import anyfesolver model, element, options, _staged = _case('q4_pressure') _capture_owned_local_recovery(model, element, **options) # pins the late hooks - namespace = vars(anysolver) + namespace = vars(anyfesolver) code = compile('def __getattr__(name):\n raise AttributeError(name)\n', namespace['__file__'], 'exec') lookalike = types.FunctionType(next(c for c in code.co_consts if isinstance(c, types.CodeType)), namespace, '__getattr__') compared = [] @@ -725,7 +725,7 @@ def test_span_module_prepared_static_q4_is_tracked(change, monkeypatch): """Blocker 4: the stage-compile module (imported after the old table) is tracked, for module hooks and for its sys.modules binding.""" import types - from anysolver import prepared_static_q4 as q4_kernels + from anyfesolver import prepared_static_q4 as q4_kernels model, element, _options, _staged = _case('q4_staged') if change == 'hook': def hook(name): @@ -836,7 +836,7 @@ def test_opt_in_is_revoked_in_contexts_copied_during_preparation(outcome): """Opt-in review: a context copied during an opted-in preparation must not keep the opt-in after that preparation ends (normally or by an exception).""" import contextvars - from anysolver import prepare_static_evaluator, RecoveryConfig + from anyfesolver import prepare_static_evaluator, RecoveryConfig every = RecoveryConfig(include_displacements=False, include_stresses=True, include_reactions=True) copied = [] @@ -851,7 +851,7 @@ def progress(event): with recovery.trusted_capture_scope(False): # no outer opt-in for this test if outcome == 'failure': - from anysolver import PreparedStaticError + from anyfesolver import PreparedStaticError with pytest.raises((Stop, PreparedStaticError)): # snapshot capture wraps the callback's error prepare_static_evaluator(mixed_free_model()[0], recovery_config=every, envelope_recovery_config=every, trusted_capture=True, progress_callback=progress) @@ -867,7 +867,7 @@ def progress(event): def test_evaluator_option_controls_trusted_capture_and_keeps_the_snapshot(): - from anysolver import prepare_static_evaluator, RecoveryConfig + from anyfesolver import prepare_static_evaluator, RecoveryConfig every = RecoveryConfig(include_displacements=False, include_stresses=True, include_reactions=True) made = {} for flag in (None, False, True): @@ -886,13 +886,13 @@ def test_evaluator_option_controls_trusted_capture_and_keeps_the_snapshot(): @pytest.mark.parametrize('value', [1, 0, 'yes', None, np.bool_(True)]) def test_trusted_capture_option_must_be_bool(value): - from anysolver import prepare_static_evaluator + from anyfesolver import prepare_static_evaluator with pytest.raises(ValueError, match='trusted_capture must be True or False'): prepare_static_evaluator(mixed_free_model()[0], trusted_capture=value) def test_response_evaluator_accepts_the_option(): - from anysolver import PatternCase, prepare_static_response_evaluator, RecoveryConfig + from anyfesolver import PatternCase, prepare_static_response_evaluator, RecoveryConfig patterns = assessment._shell_patterns() stress = RecoveryConfig(include_stresses=True, include_reactions=True, components=assessment.SHELL_COMPONENTS) for flag in (False, True): @@ -946,8 +946,8 @@ class Hostile: vars(hostile)[Key()] = 0 sys.modules['numpy.capture_probe'] = hostile sys.path[:0] = json.loads(sys.argv[1]) -import anysolver.prepared_static_response -from anysolver import prepared_static_recovery as recovery +import anyfesolver.prepared_static_response +from anyfesolver import prepared_static_recovery as recovery after_import = list(calls) # the default path (import) inspects nothing admissible = recovery._capture_modules_unhooked() # first opt-in admission builds the table print(json.dumps({'calls_after_import': after_import, 'calls': calls, 'opt_in_admissible': admissible})) @@ -985,7 +985,7 @@ def __dict__(self): _COLLIDING_SYS_MODULES_KEY = """ import json, sys calls = [] -target = 'anysolver.prepared_static_recovery' +target = 'anyfesolver.prepared_static_recovery' class Key(str): def __hash__(self): return hash(target) @@ -997,7 +997,7 @@ def __eq__(self, other): __ne__ = str.__ne__ sys.modules[Key('capture-probe-colliding-key')] = None sys.path[:0] = json.loads(sys.argv[1]) -import anysolver.prepared_static_response +import anyfesolver.prepared_static_response print(json.dumps({'calls_from_this_module': calls})) """ @@ -1025,8 +1025,8 @@ def __dict__(self): return plain.__get__(self) warnings.__class__ = HostileModule sys.path[:0] = json.loads(sys.argv[1]) -import anysolver.prepared_static_response -from anysolver import prepared_static_recovery as recovery +import anyfesolver.prepared_static_response +from anyfesolver import prepared_static_recovery as recovery after_import = list(calls) admissible = recovery._capture_modules_unhooked() during_check = list(calls) @@ -1048,8 +1048,8 @@ def test_capture_state_inspection_is_not_done_at_import(): _RELOAD_WITH_PLANTED_KEY = """ import dis, importlib, json, sys sys.path[:0] = json.loads(sys.argv[1]) -import anysolver.prepared_static_response -from anysolver import boundary, prepared_static_recovery as recovery +import anyfesolver.prepared_static_response +from anyfesolver import boundary, prepared_static_recovery as recovery calls, import_statements = [], [] def opname(frame): for instruction in dis.get_instructions(frame.f_code): diff --git a/tests/test_prepared_static_response_m26.py b/tests/test_prepared_static_response_m26.py index 49cb21c35..e38893cd1 100644 --- a/tests/test_prepared_static_response_m26.py +++ b/tests/test_prepared_static_response_m26.py @@ -7,11 +7,11 @@ import numpy as np import pytest -from anysolver import FEModel, FixedSupport, LoadCase, RecoveryConfig, prepare_static_response_evaluator -from anysolver import prepared_static_recovery as recovery_module -from anysolver import prepared_static_vectorized as vector -from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement -from anysolver.elements import BeamElement, create_shell_element +from anyfesolver import FEModel, FixedSupport, LoadCase, RecoveryConfig, prepare_static_response_evaluator +from anyfesolver import prepared_static_recovery as recovery_module +from anyfesolver import prepared_static_vectorized as vector +from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement +from anyfesolver.elements import BeamElement, create_shell_element STRESS = RecoveryConfig(include_displacements=False, include_stresses=True, include_reactions=True) diff --git a/tests/test_prepared_static_response_m30.py b/tests/test_prepared_static_response_m30.py index 8851cad5c..f24c8ee70 100644 --- a/tests/test_prepared_static_response_m30.py +++ b/tests/test_prepared_static_response_m30.py @@ -9,12 +9,12 @@ import pytest from scipy import sparse -from anysolver import RecoveryConfig, prepare_static_response_evaluator, prepare_static_evaluator -from anysolver import prepared_static_vectorized as vector_module -from anysolver.analysis_session import _immutable_array, _immutable_csr -from anysolver.assembly import _backward_error -from anysolver.prepared_static import _block_norm_data, _certified_backward_error, _operator_norm_data -from anysolver.prepared_static_recovery import _planned_compact +from anyfesolver import RecoveryConfig, prepare_static_response_evaluator, prepare_static_evaluator +from anyfesolver import prepared_static_vectorized as vector_module +from anyfesolver.analysis_session import _immutable_array, _immutable_csr +from anyfesolver.assembly import _backward_error +from anyfesolver.prepared_static import _block_norm_data, _certified_backward_error, _operator_norm_data +from anyfesolver.prepared_static_recovery import _planned_compact from test_prepared_static_response_m26 import _grid_model STRESS = RecoveryConfig(include_displacements=False, include_stresses=True, include_reactions=True) @@ -189,7 +189,7 @@ def injected(*args): def test_rebound_assembly_function_is_called_as_is(monkeypatch): # M31b (review): the original is the function captured at import, so a rebound # module attribute is an injected implementation like any other. - import anysolver.assembly as assembly_module + import anyfesolver.assembly as assembly_module a = _immutable_csr(sparse.csr_matrix(np.array([[2.0, 1.0], [1.0, 3.0]]))) monkeypatch.setattr(assembly_module, '_backward_error', lambda *args: 7.0) assert _certified_backward_error(a, np.ones(2), np.ones(2), _operator_norm_data(a), assembly_module._backward_error) == 7.0 @@ -200,7 +200,7 @@ def test_rebound_assembly_function_is_called_as_is(monkeypatch): # --------------------------------------------------------------------------- vector maps def _reference_evaluate_groups(vector, full): # pre-M30 - from anysolver.prepared_static_vectorized import PreparedStaticError, _split, derived_fields + from anyfesolver.prepared_static_vectorized import PreparedStaticError, _split, derived_fields columns = full.shape[1] outputs = [] for group in vector.groups: @@ -282,9 +282,9 @@ def test_vector_maps_raise_and_warn_as_before(grid_owner, state, kind, monkeypat def test_certification_in_the_evaluator_equals_the_original(monkeypatch): # M31b (review): every certification equals assembly._backward_error at the time # of the call; the norm is computed per block (again after a canonical solve). - from anysolver import PatternCase - from anysolver import prepared_static as static_module - from anysolver import prepared_static_response as response_module + from anyfesolver import PatternCase + from anyfesolver import prepared_static as static_module + from anyfesolver import prepared_static_response as response_module agreed, norms, fail_once, used = [], {'static': 0, 'response': 0}, [True], [] for label, module in (('static', static_module), ('response', response_module)): certify, norm = module._certified_backward_error, module._block_norm_data @@ -338,7 +338,7 @@ def test_reinterpreted_parts_take_the_original(): def test_another_floating_point_environment_takes_the_original(monkeypatch): - from anysolver import prepared_static as static_module + from anyfesolver import prepared_static as static_module x, b = np.array([1.0, 2.0]), np.array([0.5, 7.0]) frozen = _immutable_csr(sparse.csr_matrix(np.array([[2.0, 1.0], [1.0, 3.0]]))) norm = _block_norm_data(frozen, _backward_error) diff --git a/tests/test_prepared_static_response_m31.py b/tests/test_prepared_static_response_m31.py index a4e0b1cf6..dc7ebfdf2 100644 --- a/tests/test_prepared_static_response_m31.py +++ b/tests/test_prepared_static_response_m31.py @@ -7,10 +7,10 @@ import numpy as np import pytest -from anysolver import LoadCase, RecoveryConfig, prepare_static_evaluator, prepare_static_response_evaluator -from anysolver.prepared_static import _plain_deepcopy -from anysolver.prepared_static_loads import load_packet_storage_bytes -from anysolver.static_batch import StaticCase +from anyfesolver import LoadCase, RecoveryConfig, prepare_static_evaluator, prepare_static_response_evaluator +from anyfesolver.prepared_static import _plain_deepcopy +from anyfesolver.prepared_static_loads import load_packet_storage_bytes +from anyfesolver.static_batch import StaticCase import prepared_static_response_m16_assessment # noqa: F401 (adds scripts/ to sys.path) from benchmark_static_batches import mixed_free_model from test_prepared_static_response_m26 import _grid_model @@ -133,7 +133,7 @@ def __deepcopy__(self, memo): # --------------------------------------------------------------------------- packet storage def _reference_storage(case): # pre-M31 walk - from anysolver.boundary import _exact_load_case_instance_namespace + from anyfesolver.boundary import _exact_load_case_instance_namespace if case.load_case is None: return 256 state = _exact_load_case_instance_namespace(case.load_case) diff --git a/tests/test_prepared_static_response_preparation.py b/tests/test_prepared_static_response_preparation.py index 80a0f4d33..a511d616a 100644 --- a/tests/test_prepared_static_response_preparation.py +++ b/tests/test_prepared_static_response_preparation.py @@ -1,17 +1,17 @@ """Bounded library scopes preserve source probes and caller authority boundaries.""" import numpy as np import pytest -from anysolver import (BoundaryCondition, FixedSupport, LoadCase, RecoveryConfig, +from anyfesolver import (BoundaryCondition, FixedSupport, LoadCase, RecoveryConfig, PreparedStaticCapabilityError, SolveCancelled, prepare_static_response_evaluator) -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel -from anysolver.prepared_static_recovery import _OWNED_RECOVERY_SCOPE +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.prepared_static_recovery import _OWNED_RECOVERY_SCOPE from test_prepared_static_evaluator import _shell_model, _shell_case def test_library_tiles_preserve_order_size_and_original_safe_point_positions(): - from anysolver.prepared_static_response import _library_tiles, _LIBRARY_SAFE_POINT_STRIDE + from anyfesolver.prepared_static_response import _library_tiles, _LIBRARY_SAFE_POINT_STRIDE entries={index:None for index in range(399,199,-1)} tiles=list(_library_tiles(entries)) assert [start for start,_ in tiles]==[0,64,128,192] @@ -46,8 +46,8 @@ def test_preparation_timing_counts_native_probes_columns_and_snapshot_phases(): def test_memory_base_is_cached_with_factor_state_aware_policy(monkeypatch): - from anysolver import ResourceConfig - from anysolver.recovery import ResourcePolicyError + from anyfesolver import ResourceConfig + from anyfesolver.recovery import ResourcePolicyError with prepare_static_response_evaluator(_shell_model(),{'p':_shell_case(1,pressure=2.).load_case}, recovery_config=RecoveryConfig(include_stresses=True,include_reactions=False), stress_execution='certified_library') as evaluator: @@ -80,8 +80,8 @@ def observed(snapshot): def test_memory_cache_accounts_operator_bytes_even_for_same_matrix_owner(): - from anysolver import ResourceConfig - from anysolver.recovery import ResourcePolicyError + from anyfesolver import ResourceConfig + from anyfesolver.recovery import ResourcePolicyError with prepare_static_response_evaluator(_shell_model(),{'p':_shell_case(1,pressure=2.).load_case}, recovery_config=RecoveryConfig(include_stresses=True,include_reactions=False), stress_execution='certified_library') as evaluator: @@ -104,8 +104,8 @@ def test_memory_cache_accounts_operator_bytes_even_for_same_matrix_owner(): def test_memory_cache_accounts_snapshot_csr_growth_for_same_snapshot_owner(): - from anysolver import ResourceConfig - from anysolver.recovery import ResourcePolicyError + from anyfesolver import ResourceConfig + from anyfesolver.recovery import ResourcePolicyError with prepare_static_response_evaluator(_shell_model(),{'p':_shell_case(1,pressure=2.).load_case}, recovery_config=RecoveryConfig(include_stresses=True,include_reactions=False), stress_execution='certified_library') as evaluator: @@ -145,7 +145,7 @@ def _independent_beams(count): @pytest.mark.parametrize('action',['cancel','source_helper','clock_alias']) def test_actual_second_caller_boundary_outside_scope_refuses_without_success(monkeypatch,action): - import anysolver.prepared_static_response as response + import anyfesolver.prepared_static_response as response model,load=_independent_beams(129) class CallerToken: schema_observations=0 diff --git a/tests/test_prepared_static_schema_scope.py b/tests/test_prepared_static_schema_scope.py index 4755b7cb3..5f3d3e624 100644 --- a/tests/test_prepared_static_schema_scope.py +++ b/tests/test_prepared_static_schema_scope.py @@ -2,9 +2,9 @@ import sys import numpy as np import pytest -from anysolver import RecoveryConfig, PreparedStaticCapabilityError -from anysolver import prepared_static_envelopes as envelopes -from anysolver import prepared_static_recovery as recovery +from anyfesolver import RecoveryConfig, PreparedStaticCapabilityError +from anyfesolver import prepared_static_envelopes as envelopes +from anyfesolver import prepared_static_recovery as recovery from test_prepared_static_evaluator import _shell_model @@ -54,7 +54,7 @@ def test_unknown_schema_component_refuses_and_revokes_scope(): def test_schema_source_mutation_refused_before_capture(monkeypatch): - from anysolver.elements import BeamElement + from anyfesolver.elements import BeamElement model = _shell_model() model.apply_boundary_conditions() seen = [] @@ -67,7 +67,7 @@ def test_schema_source_mutation_refused_before_capture(monkeypatch): @pytest.mark.parametrize('name', ['principal_stresses', 'shell_surface_tensor']) def test_schema_principal_helper_inplace_code_mutation_refused(monkeypatch, name): - from anysolver import prepared_static_measures as measures + from anyfesolver import prepared_static_measures as measures model = _shell_model() model.apply_boundary_conditions() def foreign(*args): diff --git a/tests/test_prepared_static_shared.py b/tests/test_prepared_static_shared.py index e54e8a173..d8a9020fb 100644 --- a/tests/test_prepared_static_shared.py +++ b/tests/test_prepared_static_shared.py @@ -1,7 +1,7 @@ """M4 shared truth, bounded winner tiles and copy-on-write publication.""" import numpy as np import pytest -from anysolver import prepare_static_evaluator, RecoveryConfig, PreparedStaticCapabilityError +from anyfesolver import prepare_static_evaluator, RecoveryConfig, PreparedStaticCapabilityError from test_prepared_static_evaluator import _bar, _case, _shell_model, _shell_case @@ -79,7 +79,7 @@ def test_transaction_copies_only_changed_modes_and_preserves_committed_arrays(): def test_shared_dispatch_rebinding_refused_before_receiving_owned_buffers(monkeypatch): - import anysolver.prepared_static_shared as shared + import anyfesolver.prepared_static_shared as shared with prepare_static_evaluator(_bar()) as owner: seen = [] monkeypatch.setattr(shared, 'recover_shared_block', lambda *args: seen.append(args)) @@ -90,7 +90,7 @@ def test_shared_dispatch_rebinding_refused_before_receiving_owned_buffers(monkey @pytest.mark.parametrize('observation', ['result', 'restart', 'resume']) def test_reducer_storage_helper_refused_before_owned_data_observation(monkeypatch, observation): - import anysolver.prepared_static_envelopes as envelopes + import anyfesolver.prepared_static_envelopes as envelopes config = RecoveryConfig(include_stresses=False) with prepare_static_evaluator(_bar(), envelope_recovery_config=config) as owner: iterator = owner.iter_batches([_case(0), _case(1)], batch_size=1) @@ -110,7 +110,7 @@ def test_reducer_storage_helper_refused_before_owned_data_observation(monkeypatc def test_driver_constructor_alias_refused_before_private_plan(monkeypatch): - import anysolver.prepared_static as driver + import anyfesolver.prepared_static as driver config = RecoveryConfig(include_stresses=False) with prepare_static_evaluator(_bar(), envelope_recovery_config=config) as owner: seen = [] @@ -124,8 +124,8 @@ def test_driver_constructor_alias_refused_before_private_plan(monkeypatch): def test_tile_failure_has_case_element_and_stage_without_publication(): - from anysolver import PreparedStaticError - from anysolver.prepared_static_shared import _fold_labeled + from anyfesolver import PreparedStaticError + from anyfesolver.prepared_static_shared import _fold_labeled config = RecoveryConfig(components=['axial_stress'], include_displacements=False, include_reactions=False) with prepare_static_evaluator(_bar(), envelope_recovery_config=config) as owner: scratch = owner._envelope.empty_subset(('stress',), 1) diff --git a/tests/test_production_readiness.py b/tests/test_production_readiness.py index d9a52d447..eda04313b 100644 --- a/tests/test_production_readiness.py +++ b/tests/test_production_readiness.py @@ -5,15 +5,15 @@ import json from pathlib import Path -from anysolver.elements import ShellElement -from anysolver.fe_core import FEModel -from anysolver.production_readiness import ( +from anyfesolver.elements import ShellElement +from anyfesolver.fe_core import FEModel +from anyfesolver.production_readiness import ( build_capability_matrix, build_verification_scope_statement, scope_statement_markdown, write_production_readiness_artifacts, ) -from anysolver.validation import validate_production_model +from anyfesolver.validation import validate_production_model def _fake_report() -> dict: diff --git a/tests/test_production_validation.py b/tests/test_production_validation.py index 739e25c1f..59d96744b 100644 --- a/tests/test_production_validation.py +++ b/tests/test_production_validation.py @@ -4,7 +4,7 @@ import pytest -from anysolver import ( +from anyfesolver import ( BoundaryCondition, CoupledBeamShellElement, FEModel, diff --git a/tests/test_q4_assumed_strain_plasticity.py b/tests/test_q4_assumed_strain_plasticity.py index ff546cf34..cf1dd8689 100644 --- a/tests/test_q4_assumed_strain_plasticity.py +++ b/tests/test_q4_assumed_strain_plasticity.py @@ -7,7 +7,7 @@ converged to spurious mechanisms (+203 mm at n=8, wrong sign at n=16, against about 35-39 mm from the legacy element and CalculiX). The route under test evaluates the return map at the hybrid's assumed strain; see -``anysolver._q4_assumed_strain_plasticity``. +``anyfesolver._q4_assumed_strain_plasticity``. """ from __future__ import annotations @@ -18,14 +18,14 @@ import numpy as np import pytest -import anysolver as fs -from anysolver import _q4_assumed_strain_plasticity as AS -from anysolver.boundary import FixedSupport, LoadCase -from anysolver.elements import create_shell_element -from anysolver.material_curves import DNVC208MaterialCurve -from anysolver.nonlinear_performance import NonlinearAssemblyPlan -from anysolver.nonlinear_static import _assemble_nonlinear_system -from anysolver.plasticity import plane_stress_elastic_matrix +import anyfesolver as fs +from anyfesolver import _q4_assumed_strain_plasticity as AS +from anyfesolver.boundary import FixedSupport, LoadCase +from anyfesolver.elements import create_shell_element +from anyfesolver.material_curves import DNVC208MaterialCurve +from anyfesolver.nonlinear_performance import NonlinearAssemblyPlan +from anyfesolver.nonlinear_static import _assemble_nonlinear_system +from anyfesolver.plasticity import plane_stress_elastic_matrix def _curve(): @@ -270,7 +270,7 @@ def test_owner_case_c1_step_and_mesh_sweep(n, steps): # --------------------------------------------------------------------------- def _hill_material(with_curve=True): - from anysolver.materials import Hill48Yield, OrthotropicMaterial + from anyfesolver.materials import Hill48Yield, OrthotropicMaterial shear = 3e7 / np.sqrt(3.0) return OrthotropicMaterial( @@ -284,8 +284,8 @@ def _hill_material(with_curve=True): @pytest.mark.parametrize("with_curve", [True, False], ids=["curve", "perfectly_plastic"]) def test_hill48_plastic_q4_is_refused_with_typed_error(with_curve): - from anysolver.e4_pl_element import QualifiedE4PLShellElement - from anysolver.fe_core import FEMesh + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.fe_core import FEMesh mesh = FEMesh() for index, (x, y) in enumerate(SQUARE): @@ -407,7 +407,7 @@ def test_fd_tangent_close_to_reversal_through_zero_plastic_strain(): def test_module_numpy_usage_is_inside_the_frozen_runtime_authority(): import ast import inspect - from anysolver import e4_pl_s3_state + from anyfesolver import e4_pl_s3_state tree = ast.parse(inspect.getsource(AS)) root, linalg = set(), set() @@ -479,7 +479,7 @@ def test_preyield_layer_stress_matches_independent_mixed_recovery(): differs exactly by the hybrid relief. """ - from anysolver.plasticity import lobatto_layers + from anyfesolver.plasticity import lobatto_layers model, element, material = _single(SQUARE) u = (_field(SQUARE, "hourglass", 2e-5) + _field(SQUARE, "stretch", 3e-5) diff --git a/tests/test_q4_native_material_event.py b/tests/test_q4_native_material_event.py index 079990684..3e0511036 100644 --- a/tests/test_q4_native_material_event.py +++ b/tests/test_q4_native_material_event.py @@ -4,8 +4,8 @@ import math import numpy as np import pytest -from anysolver._stiffened_shell_q4_material_event import Q4MaterialTrial,boundary_amount,_origin_values -from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver +from anyfesolver._stiffened_shell_q4_material_event import Q4MaterialTrial,boundary_amount,_origin_values +from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver def fixture(strain=.49,change=.1): origin=dict(plastic_strain=np.zeros((1,3)),alpha=np.zeros(1)) @@ -81,9 +81,9 @@ def test_driver_shell_binding_mutation_and_legacy_dispatch(): assert driver._native_boundary_amount(state,np.array(d)) is None def test_actual_q4_capture_preserves_three_response_fields(): - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss from examples.stiffened_shell_native_fibre_bl5_material import definition - from anysolver._stiffened_shell_q4_algorithmic_pullback import response + from anyfesolver._stiffened_shell_q4_algorithmic_pullback import response owner=ss.create_analysis(definition=definition()) try: driver=FinitePointDriver(owner) @@ -101,9 +101,9 @@ def test_actual_q4_capture_preserves_three_response_fields(): finally:owner.close() def test_nonzero_rotation_and_von_karman_layer_direction(): - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss from examples.stiffened_shell_native_fibre_bl5_material import definition - from anysolver._stiffened_shell_q4_algorithmic_pullback import response + from anyfesolver._stiffened_shell_q4_algorithmic_pullback import response owner=ss.create_analysis(definition=definition()) try: driver=FinitePointDriver(owner);eid,element,slots,_=owner._shell_parts[0];origin=driver._shell_origins[0] diff --git a/tests/test_q4_nodal_stress_order.py b/tests/test_q4_nodal_stress_order.py index 85a2c8e43..35e1f2a18 100644 --- a/tests/test_q4_nodal_stress_order.py +++ b/tests/test_q4_nodal_stress_order.py @@ -15,9 +15,9 @@ import numpy as np import pytest -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEModel -from anysolver.results import _operator_for_returned_rows, recover_nodal_stresses +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.results import _operator_for_returned_rows, recover_nodal_stresses G = 1.0 / np.sqrt(3.0) STIFFNESS_ORDER = np.array([[-G, -G], [G, -G], [G, G], [-G, G]]) diff --git a/tests/test_q4_projected_gap_lower.py b/tests/test_q4_projected_gap_lower.py index e03d51f8b..d53394c3c 100644 --- a/tests/test_q4_projected_gap_lower.py +++ b/tests/test_q4_projected_gap_lower.py @@ -3,7 +3,7 @@ import numpy as np from scipy.optimize import least_squares -from anysolver.general_contact.q4_source_overlap import ( +from anyfesolver.general_contact.q4_source_overlap import ( q4_source_gap_lower, q4_source_projected_gap_lower, q4_source_projected_swept_gap_lower, q4_source_swept_gap_lower, ) diff --git a/tests/test_quadratic_beam_nonlinear.py b/tests/test_quadratic_beam_nonlinear.py index 4b690a032..6dd303366 100644 --- a/tests/test_quadratic_beam_nonlinear.py +++ b/tests/test_quadratic_beam_nonlinear.py @@ -5,11 +5,11 @@ import numpy as np import pytest -from anysolver.boundary import BoundaryCondition, LoadCase -from anysolver.elements import BeamElement, QuadraticBeamElement -from anysolver.fe_core import FEModel -from anysolver.material_curves import dnv_c208_steel_curve -from anysolver.nonlinear_static import solve_static_nonlinear +from anyfesolver.boundary import BoundaryCondition, LoadCase +from anyfesolver.elements import BeamElement, QuadraticBeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.material_curves import dnv_c208_steel_curve +from anyfesolver.nonlinear_static import solve_static_nonlinear E_STEEL = 2.1e11 LENGTH = 1.0 diff --git a/tests/test_qualified_assembly_exception_precedence.py b/tests/test_qualified_assembly_exception_precedence.py index a1589fc56..a3a6287e3 100644 --- a/tests/test_qualified_assembly_exception_precedence.py +++ b/tests/test_qualified_assembly_exception_precedence.py @@ -4,9 +4,9 @@ import pytest -import anysolver.matrix_assembly as matrix_assembly -from anysolver.element_capabilities import ElementCapabilityError -from anysolver.matrix_assembly import AssemblyError +import anyfesolver.matrix_assembly as matrix_assembly +from anyfesolver.element_capabilities import ElementCapabilityError +from anyfesolver.matrix_assembly import AssemblyError def _install_rejecting_lease(monkeypatch: pytest.MonkeyPatch) -> None: diff --git a/tests/test_qualified_mutation_epoch.py b/tests/test_qualified_mutation_epoch.py index 6a297ad9c..24c67d1a3 100644 --- a/tests/test_qualified_mutation_epoch.py +++ b/tests/test_qualified_mutation_epoch.py @@ -7,14 +7,14 @@ import numpy as np import pytest -import anysolver.assembly as assembly_module -import anysolver.elements as elements_module -import anysolver.matrix_assembly as matrix_assembly_module -import anysolver.recovery_batches as recovery_batches_module -from anysolver.e4_pl_element import QualifiedE4PLShellElement -from anysolver.elements import BeamElement, QuadraticBeamElement -from anysolver.fe_core import FEModel, FEMesh -from anysolver.matrix_assembly import AssemblyError +import anyfesolver.assembly as assembly_module +import anyfesolver.elements as elements_module +import anyfesolver.matrix_assembly as matrix_assembly_module +import anyfesolver.recovery_batches as recovery_batches_module +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement +from anyfesolver.elements import BeamElement, QuadraticBeamElement +from anyfesolver.fe_core import FEModel, FEMesh +from anyfesolver.matrix_assembly import AssemblyError def _qualified_q4_model() -> tuple[FEModel, QualifiedE4PLShellElement]: diff --git a/tests/test_qualified_q4_assembly_authority.py b/tests/test_qualified_q4_assembly_authority.py index d7bfe821a..c0274128b 100644 --- a/tests/test_qualified_q4_assembly_authority.py +++ b/tests/test_qualified_q4_assembly_authority.py @@ -6,12 +6,12 @@ import pytest from scipy import sparse -import anysolver.e4_pl_element as e4_pl_module -import anysolver.matrix_assembly as matrix_assembly_module -from anysolver import FEModel, assemble_stiffness_matrix -from anysolver.e4_pl_element import QualifiedE4PLShellElement -from anysolver.fe_core import _QualifiedStateMapping -from anysolver.matrix_assembly import AssemblyError +import anyfesolver.e4_pl_element as e4_pl_module +import anyfesolver.matrix_assembly as matrix_assembly_module +from anyfesolver import FEModel, assemble_stiffness_matrix +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement +from anyfesolver.fe_core import _QualifiedStateMapping +from anyfesolver.matrix_assembly import AssemblyError def _model() -> tuple[FEModel, QualifiedE4PLShellElement]: diff --git a/tests/test_qualified_vector_identity.py b/tests/test_qualified_vector_identity.py index b3e60bead..d314ff924 100644 --- a/tests/test_qualified_vector_identity.py +++ b/tests/test_qualified_vector_identity.py @@ -15,19 +15,19 @@ import numpy as np import pytest -from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement -from anysolver.fe_core import ( +from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement +from anyfesolver.fe_core import ( FEModel, _freeze_qualified_element_vector_inputs, _is_canonical_qualified_vector, ) -from anysolver.matrix_assembly import assemble_stiffness_matrix -from anysolver.recovery import ( +from anyfesolver.matrix_assembly import assemble_stiffness_matrix +from anyfesolver.recovery import ( RecoveryConfig, ResourceConfig, recover_element_stresses_with_report, ) -from anysolver.s3_reference_batch import MIN_REFERENCE_S3_RECOVERY_GROUP +from anyfesolver.s3_reference_batch import MIN_REFERENCE_S3_RECOVERY_GROUP def _canonical_bytes_vector(values: tuple[float, ...]) -> np.ndarray: diff --git a/tests/test_r8_b2_assembly_metrics_dev.py b/tests/test_r8_b2_assembly_metrics_dev.py index 26eaa5147..b881cecdc 100644 --- a/tests/test_r8_b2_assembly_metrics_dev.py +++ b/tests/test_r8_b2_assembly_metrics_dev.py @@ -5,9 +5,9 @@ import numpy as np import pytest from scipy import sparse -from anysolver import stiffened_shell as api -from anysolver.control import CancellationToken -from anysolver._stiffened_shell_b2_assembly_diagnostics import ( +from anyfesolver import stiffened_shell as api +from anyfesolver.control import CancellationToken +from anyfesolver._stiffened_shell_b2_assembly_diagnostics import ( Inventory,Capture,DiagnosticRefusal,capture_assembly,active_capture,ASSEMBLY) from examples.stiffened_shell_b2_physical_rigid_footprint import definition,preload @@ -99,7 +99,7 @@ def forbidden(*args):raise AssertionError('default inventory reached') def test_inventory_error_is_not_mechanics_success(monkeypatch): - import anysolver._stiffened_shell_b2_q4_panel_experimental as product + import anyfesolver._stiffened_shell_b2_q4_panel_experimental as product def refuse(*args):raise DiagnosticRefusal('deliberate inventory') monkeypatch.setattr(Capture,'prefactor',refuse) with pytest.raises(DiagnosticRefusal,match='deliberate'): diff --git a/tests/test_r8_b2_assembly_series_dev.py b/tests/test_r8_b2_assembly_series_dev.py index 0615bd8d9..f14cca95a 100644 --- a/tests/test_r8_b2_assembly_series_dev.py +++ b/tests/test_r8_b2_assembly_series_dev.py @@ -19,7 +19,7 @@ def test_deterministic_load_support(self): def test_frozen_full_identity(self):self.assertEqual(s.sha(s.FULL),s.FULL_SHA) def test_source_scatter_proof(self): import ast - tree=ast.parse((ROOT/'src/anysolver/_stiffened_shell_b2_q4_panel_experimental.py').read_text()) + tree=ast.parse((ROOT/'src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py').read_text()) fn=next(x for x in tree.body if isinstance(x,ast.FunctionDef) and x.name=='_scatter') calls=[x for x in ast.walk(fn) if isinstance(x,ast.Call) and isinstance(x.func,ast.Attribute) and x.func.attr=='extend'] self.assertEqual(len(calls),3);self.assertEqual({x.func.value.id for x in calls},{'rows','columns','values'}) diff --git a/tests/test_r8_b2_assembly_series_v2_dev.py b/tests/test_r8_b2_assembly_series_v2_dev.py index 4881b534a..e54bfc261 100644 --- a/tests/test_r8_b2_assembly_series_v2_dev.py +++ b/tests/test_r8_b2_assembly_series_v2_dev.py @@ -19,7 +19,7 @@ def test_deterministic_load_support(self): def test_frozen_full_identity(self):self.assertEqual(s.sha(s.FULL),s.FULL_SHA) def test_source_scatter_proof(self): import ast - tree=ast.parse((ROOT/'src/anysolver/_stiffened_shell_b2_q4_panel_experimental.py').read_text()) + tree=ast.parse((ROOT/'src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py').read_text()) fn=next(x for x in tree.body if isinstance(x,ast.FunctionDef) and x.name=='_scatter') calls=[x for x in ast.walk(fn) if isinstance(x,ast.Call) and isinstance(x.func,ast.Attribute) and x.func.attr=='extend'] self.assertEqual(len(calls),3);self.assertEqual({x.func.value.id for x in calls},{'rows','columns','values'}) diff --git a/tests/test_r8_b2_assembly_series_v3_dev.py b/tests/test_r8_b2_assembly_series_v3_dev.py index f59671ba9..a72db71ca 100644 --- a/tests/test_r8_b2_assembly_series_v3_dev.py +++ b/tests/test_r8_b2_assembly_series_v3_dev.py @@ -19,7 +19,7 @@ def test_deterministic_load_support(self): def test_frozen_full_identity(self):self.assertEqual(s.sha(s.FULL),s.FULL_SHA) def test_source_scatter_proof(self): import ast - tree=ast.parse((ROOT/'src/anysolver/_stiffened_shell_b2_q4_panel_experimental.py').read_text()) + tree=ast.parse((ROOT/'src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py').read_text()) fn=next(x for x in tree.body if isinstance(x,ast.FunctionDef) and x.name=='_scatter') calls=[x for x in ast.walk(fn) if isinstance(x,ast.Call) and isinstance(x.func,ast.Attribute) and x.func.attr=='extend'] self.assertEqual(len(calls),3);self.assertEqual({x.func.value.id for x in calls},{'rows','columns','values'}) diff --git a/tests/test_r8_b2_assembly_series_v4_dev.py b/tests/test_r8_b2_assembly_series_v4_dev.py index cfacdaebc..ebd65ec77 100644 --- a/tests/test_r8_b2_assembly_series_v4_dev.py +++ b/tests/test_r8_b2_assembly_series_v4_dev.py @@ -29,7 +29,7 @@ def test_frozen_full_identity(self): self.assertEqual(s.PHASES[:3],('controls','validate-install','public-smoke')) def test_source_scatter_proof(self): import ast - tree=ast.parse((ROOT/'src/anysolver/_stiffened_shell_b2_q4_panel_experimental.py').read_text()) + tree=ast.parse((ROOT/'src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py').read_text()) fn=next(x for x in tree.body if isinstance(x,ast.FunctionDef) and x.name=='_scatter') calls=[x for x in ast.walk(fn) if isinstance(x,ast.Call) and isinstance(x.func,ast.Attribute) and x.func.attr=='extend'] self.assertEqual(len(calls),3);self.assertEqual({x.func.value.id for x in calls},{'rows','columns','values'}) diff --git a/tests/test_r8_b2_assembly_series_v5_dev.py b/tests/test_r8_b2_assembly_series_v5_dev.py index 32b5e3b64..dc61d4fb9 100644 --- a/tests/test_r8_b2_assembly_series_v5_dev.py +++ b/tests/test_r8_b2_assembly_series_v5_dev.py @@ -33,7 +33,7 @@ def test_frozen_full_identity(self): self.assertTrue(any(isinstance(n,ast.Constant) and n.value=='installed-post-close.json' for n in ast.walk(fn))) def test_source_scatter_proof(self): import ast - tree=ast.parse((ROOT/'src/anysolver/_stiffened_shell_b2_q4_panel_experimental.py').read_text()) + tree=ast.parse((ROOT/'src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py').read_text()) fn=next(x for x in tree.body if isinstance(x,ast.FunctionDef) and x.name=='_scatter') calls=[x for x in ast.walk(fn) if isinstance(x,ast.Call) and isinstance(x.func,ast.Attribute) and x.func.attr=='extend'] self.assertEqual(len(calls),3);self.assertEqual({x.func.value.id for x in calls},{'rows','columns','values'}) diff --git a/tests/test_r8_b2_assembly_series_v6_dev.py b/tests/test_r8_b2_assembly_series_v6_dev.py index 8fe28b95c..cb7a95253 100644 --- a/tests/test_r8_b2_assembly_series_v6_dev.py +++ b/tests/test_r8_b2_assembly_series_v6_dev.py @@ -53,7 +53,7 @@ def test_frozen_full_identity(self): def test_source_scatter_proof(self): import ast - tree=ast.parse((ROOT/'src/anysolver/_stiffened_shell_b2_q4_panel_experimental.py').read_text()) + tree=ast.parse((ROOT/'src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py').read_text()) fn=next(x for x in tree.body if isinstance(x,ast.FunctionDef) and x.name=='_scatter') calls=[x for x in ast.walk(fn) if isinstance(x,ast.Call) and isinstance(x.func,ast.Attribute) and x.func.attr=='extend'] self.assertEqual(len(calls),3);self.assertEqual({x.func.value.id for x in calls},{'rows','columns','values'}) diff --git a/tests/test_r8_b2_assembly_series_v7_dev.py b/tests/test_r8_b2_assembly_series_v7_dev.py index 8f87912ac..c043d8632 100644 --- a/tests/test_r8_b2_assembly_series_v7_dev.py +++ b/tests/test_r8_b2_assembly_series_v7_dev.py @@ -60,7 +60,7 @@ def test_frozen_full_identity(self): def test_source_scatter_proof(self): import ast - tree=ast.parse((ROOT/'src/anysolver/_stiffened_shell_b2_q4_panel_experimental.py').read_text()) + tree=ast.parse((ROOT/'src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py').read_text()) fn=next(x for x in tree.body if isinstance(x,ast.FunctionDef) and x.name=='_scatter') calls=[x for x in ast.walk(fn) if isinstance(x,ast.Call) and isinstance(x.func,ast.Attribute) and x.func.attr=='extend'] self.assertEqual(len(calls),3);self.assertEqual({x.func.value.id for x in calls},{'rows','columns','values'}) diff --git a/tests/test_r8_b2_assembly_series_v8_dev.py b/tests/test_r8_b2_assembly_series_v8_dev.py index e7ed382b1..65f5bb81a 100644 --- a/tests/test_r8_b2_assembly_series_v8_dev.py +++ b/tests/test_r8_b2_assembly_series_v8_dev.py @@ -60,7 +60,7 @@ def test_frozen_full_identity(self): def test_source_scatter_proof(self): import ast - tree=ast.parse((ROOT/'src/anysolver/_stiffened_shell_b2_q4_panel_experimental.py').read_text()) + tree=ast.parse((ROOT/'src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py').read_text()) fn=next(x for x in tree.body if isinstance(x,ast.FunctionDef) and x.name=='_scatter') calls=[x for x in ast.walk(fn) if isinstance(x,ast.Call) and isinstance(x.func,ast.Attribute) and x.func.attr=='extend'] self.assertEqual(len(calls),3);self.assertEqual({x.func.value.id for x in calls},{'rows','columns','values'}) diff --git a/tests/test_r8_b2_assembly_series_v9_dev.py b/tests/test_r8_b2_assembly_series_v9_dev.py index 092614b0f..7afad4c09 100644 --- a/tests/test_r8_b2_assembly_series_v9_dev.py +++ b/tests/test_r8_b2_assembly_series_v9_dev.py @@ -60,7 +60,7 @@ def test_frozen_full_identity(self): def test_source_scatter_proof(self): import ast - tree=ast.parse((ROOT/'src/anysolver/_stiffened_shell_b2_q4_panel_experimental.py').read_text()) + tree=ast.parse((ROOT/'src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py').read_text()) fn=next(x for x in tree.body if isinstance(x,ast.FunctionDef) and x.name=='_scatter') calls=[x for x in ast.walk(fn) if isinstance(x,ast.Call) and isinstance(x.func,ast.Attribute) and x.func.attr=='extend'] self.assertEqual(len(calls),3);self.assertEqual({x.func.value.id for x in calls},{'rows','columns','values'}) @@ -240,7 +240,7 @@ def test_public_caller_provenance_precedes_imports(self): class Boundary(Exception):pass original=builtins.__import__;product_imports=[] def import_boundary(name,*args,**kwargs): - if name.split('.')[0] in ('numpy','anysolver','anyfem'): + if name.split('.')[0] in ('numpy','anyfesolver','anyfem'): product_imports.append(name);raise Boundary('import boundary') return original(name,*args,**kwargs) with patch.object(s,'execution_authority',return_value={}),patch.object(s.sys,'path',list(s.sys.path)): diff --git a/tests/test_r8_b2_attachment_elimination_dev.py b/tests/test_r8_b2_attachment_elimination_dev.py index 316018b3a..1bc07ecb7 100644 --- a/tests/test_r8_b2_attachment_elimination_dev.py +++ b/tests/test_r8_b2_attachment_elimination_dev.py @@ -3,10 +3,10 @@ import numpy as np import pytest from scipy import sparse -from anysolver import stiffened_shell as api -from anysolver.control import CancellationToken -from anysolver._b2_attachment_elimination_dev import prepare_attachment_elimination -import anysolver._b2_attachment_elimination_dev as elimination +from anyfesolver import stiffened_shell as api +from anyfesolver.control import CancellationToken +from anyfesolver._b2_attachment_elimination_dev import prepare_attachment_elimination +import anyfesolver._b2_attachment_elimination_dev as elimination def raw_fixture(*, groups=1, nodes=3, nonsymmetric=False): diff --git a/tests/test_r8_b2_coo_scratch_cleanup_dev.py b/tests/test_r8_b2_coo_scratch_cleanup_dev.py index fe409a426..8cf00ecfd 100644 --- a/tests/test_r8_b2_coo_scratch_cleanup_dev.py +++ b/tests/test_r8_b2_coo_scratch_cleanup_dev.py @@ -2,9 +2,9 @@ import numpy as np import pytest from scipy import sparse -from anysolver import stiffened_shell as api -from anysolver._stiffened_shell_b2_q4_panel_experimental import _scatter,_release_coo_scratch -from anysolver._stiffened_shell_b2_assembly_diagnostics import Capture,DiagnosticRefusal,capture_assembly +from anyfesolver import stiffened_shell as api +from anyfesolver._stiffened_shell_b2_q4_panel_experimental import _scatter,_release_coo_scratch +from anyfesolver._stiffened_shell_b2_assembly_diagnostics import Capture,DiagnosticRefusal,capture_assembly from examples.stiffened_shell_b2_physical_rigid_footprint import definition,preload def test_direct_csr_order_values_survive_default_release(): diff --git a/tests/test_r8_b2_original_operator_20261010.py b/tests/test_r8_b2_original_operator_20261010.py index 6ac88fde1..c1cfb023e 100644 --- a/tests/test_r8_b2_original_operator_20261010.py +++ b/tests/test_r8_b2_original_operator_20261010.py @@ -8,9 +8,9 @@ import pytest from scipy import sparse, linalg -from anysolver import stiffened_shell as api -from anysolver.control import CancellationToken -from anysolver._stiffened_shell_b2_q4_panel_experimental import ( +from anyfesolver import stiffened_shell as api +from anyfesolver.control import CancellationToken +from anyfesolver._stiffened_shell_b2_q4_panel_experimental import ( ExperimentalB2Q4PanelAnalysis, _NumericalFailure, ) from examples.stiffened_shell_b2_physical_rigid_footprint import definition, preload diff --git a/tests/test_r8_b2_physical_footprint_static_foundation_dev.py b/tests/test_r8_b2_physical_footprint_static_foundation_dev.py index d935cd027..e1dd86f91 100644 --- a/tests/test_r8_b2_physical_footprint_static_foundation_dev.py +++ b/tests/test_r8_b2_physical_footprint_static_foundation_dev.py @@ -5,7 +5,7 @@ import numpy as np import pytest from scipy import sparse,linalg -from anysolver import stiffened_shell as api +from anyfesolver import stiffened_shell as api from examples.stiffened_shell_b2_physical_rigid_footprint import definition pytestmark=pytest.mark.skipif('B2_FOUNDATION_OUTPUT' not in os.environ or 'B2_FOUNDATION_SUPERVISED' not in os.environ, diff --git a/tests/test_r8_b2_q4_lifetime_dev.py b/tests/test_r8_b2_q4_lifetime_dev.py index 00b2bd56e..9aa9fcc9c 100644 --- a/tests/test_r8_b2_q4_lifetime_dev.py +++ b/tests/test_r8_b2_q4_lifetime_dev.py @@ -3,11 +3,11 @@ import weakref import numpy as np import pytest -from anysolver import stiffened_shell as api -from anysolver.control import CancellationToken -import anysolver._stiffened_shell_b2_q4_panel_experimental as product -from anysolver.e4_pl_element import _retire_q4_private_mesh_caches -from anysolver._stiffened_shell_b2_assembly_diagnostics import Capture,DiagnosticRefusal,capture_assembly,active_capture +from anyfesolver import stiffened_shell as api +from anyfesolver.control import CancellationToken +import anyfesolver._stiffened_shell_b2_q4_panel_experimental as product +from anyfesolver.e4_pl_element import _retire_q4_private_mesh_caches +from anyfesolver._stiffened_shell_b2_assembly_diagnostics import Capture,DiagnosticRefusal,capture_assembly,active_capture from examples.stiffened_shell_b2_physical_rigid_footprint import definition,preload diff --git a/tests/test_r8_b2_remaining_scale_dev.py b/tests/test_r8_b2_remaining_scale_dev.py index 4b7fed2af..3bb817ea6 100644 --- a/tests/test_r8_b2_remaining_scale_dev.py +++ b/tests/test_r8_b2_remaining_scale_dev.py @@ -56,12 +56,12 @@ def test_conditional_beam_predecessors(self): def test_product_namespace_package_only(self): inventory=json.loads(INVENTORY.read_text()) package=r.product_package(inventory) - expected={n for n in inventory['files'] if n.startswith(('anysolver/','anyfem/'))} + expected={n for n in inventory['files'] if n.startswith(('anyfesolver/','anyfem/'))} self.assertEqual(set(package),expected) self.assertTrue(package and all('.dist-info' not in n and not n.startswith('bin/') for n in package)) original=original_target() - for name in original.B2_FILES:self.assertIn('anysolver/'+name,package) - self.assertIn('anysolver/stiffened_shell.py',package) + for name in original.B2_FILES:self.assertIn('anyfesolver/'+name,package) + self.assertIn('anyfesolver/stiffened_shell.py',package) self.assertIn('anyfem/solve/stiffened_shell_b2.py',package) def test_execute_installed_reused_not_duplicated(self): @@ -102,17 +102,17 @@ def test_execute_installed_reused_not_duplicated(self): def test_graph_mismatch_closure(self): with tempfile.TemporaryDirectory() as tmp: - site=Path(tmp);(site/'anysolver').mkdir();(site/'anysolver'/'__init__.py').write_text('x') - inventory=dict(files={'anysolver/__init__.py':'sha','anysolver/extra.py':'sha'}) + site=Path(tmp);(site/'anyfesolver').mkdir();(site/'anyfesolver'/'__init__.py').write_text('x') + inventory=dict(files={'anyfesolver/__init__.py':'sha','anyfesolver/extra.py':'sha'}) self.assertEqual(sorted(r.graph_mismatch(site,inventory)), - ['bytes anysolver/__init__.py','missing anysolver/extra.py']) - (site/'anysolver'/'extra.py').write_text('y');(site/'stray.txt').write_text('z') + ['bytes anyfesolver/__init__.py','missing anyfesolver/extra.py']) + (site/'anyfesolver'/'extra.py').write_text('y');(site/'stray.txt').write_text('z') problems=r.graph_mismatch(site,inventory) self.assertTrue(any(p.startswith('extra ') for p in problems)) - (site/'anysolver'/'extra.py').unlink();(site/'stray.txt').unlink() + (site/'anyfesolver'/'extra.py').unlink();(site/'stray.txt').unlink() import hashlib good=hashlib.sha256(b'x').hexdigest() - self.assertEqual(r.graph_mismatch(site,dict(files={'anysolver/__init__.py':good})),[]) + self.assertEqual(r.graph_mismatch(site,dict(files={'anyfesolver/__init__.py':good})),[]) def test_matrix_contracts_adopted(self): contracts=r.matrix_contracts();original=original_target() @@ -132,7 +132,7 @@ def test_prepared_bindings_if_present(self): if not prepared.is_file():self.skipTest('PREPARED.json not yet generated') p=json.loads(prepared.read_text()) self.assertEqual(p['status'],'PREPARED_SLOT_HELD') - self.assertTrue(all(n.startswith(('anysolver/','anyfem/')) for n in p['package'])) + self.assertTrue(all(n.startswith(('anyfesolver/','anyfem/')) for n in p['package'])) graph=p['installed_graph'] self.assertEqual(graph['files'],761) self.assertTrue(graph['reused_v9_verified_graph']) diff --git a/tests/test_r8_b2_s3_physical_footprint_dev.py b/tests/test_r8_b2_s3_physical_footprint_dev.py index 606d54b17..1349022ca 100644 --- a/tests/test_r8_b2_s3_physical_footprint_dev.py +++ b/tests/test_r8_b2_s3_physical_footprint_dev.py @@ -3,8 +3,8 @@ import os import numpy as np import pytest -from anysolver import stiffened_shell as api -from anysolver.control import CancellationToken +from anyfesolver import stiffened_shell as api +from anyfesolver.control import CancellationToken from test_r8_b2_physical_footprint_static_foundation_dev import ( definition as q4_definition, case_definition as q4_case, independent_rows, oracle, verify, load, SELECT, save) @@ -143,7 +143,7 @@ def test_patch_admission_owned_inputs_and_legacy_policy(): def test_spectral_refusal_cancellation_close(monkeypatch): d=definition();owner=api.create_analysis(definition=d) def forbidden(*a,**k):raise AssertionError('Q4 chart helper entered for S3 physical family') - import anysolver._stiffened_shell_b2_physical_rigid_footprint as physical + import anyfesolver._stiffened_shell_b2_physical_rigid_footprint as physical monkeypatch.setattr(physical,'q4_exp_director_chart_correction',forbidden) try: assert not owner.physical_footprint_buckling_capabilities.eligible @@ -185,8 +185,8 @@ def test_connected_s3_q4_cell_union_patch(): @pytest.mark.parametrize('polarity',(-1,1)) def test_native_polarity_rotated_frame_reversed_winding(polarity): - from anysolver.fe_core import FEModel - from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement + from anyfesolver.fe_core import FEModel + from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement model=FEModel('independent-native-director') for i,x in enumerate(((0.,0.,0.),(0.,0.,1.),(0.,1.,0.)),1):model.add_node(i,*x) model.add_material('mat',1000.,.3) diff --git a/tests/test_r8_bl5_actual_mref_dev.py b/tests/test_r8_bl5_actual_mref_dev.py index 1c8b1a5d0..f3eff7850 100644 --- a/tests/test_r8_bl5_actual_mref_dev.py +++ b/tests/test_r8_bl5_actual_mref_dev.py @@ -7,7 +7,7 @@ import pytest from scipy import sparse -from anysolver import stiffened_shell as api +from anyfesolver import stiffened_shell as api from scripts.b3_e4_bl5_coherent_aggregation_dev import model as coherent_model from scripts.b3_e4_bl5_riesz_controls_dev import beam_norm, shell_scalar from scripts.r8_bl5_actual_mref_dev import ( diff --git a/tests/test_r8_bl5_actual_primal_work_dev.py b/tests/test_r8_bl5_actual_primal_work_dev.py index 7145ec5f1..66e87034f 100644 --- a/tests/test_r8_bl5_actual_primal_work_dev.py +++ b/tests/test_r8_bl5_actual_primal_work_dev.py @@ -4,7 +4,7 @@ import numpy as np import pytest -from anysolver import stiffened_shell as api +from anyfesolver import stiffened_shell as api from scripts.r8_bl5_actual_primal_work_dev import actual_flat_primal_work from test_stiffened_shell_bl5_affine_supports import candidate from test_stiffened_shell_l1_assembly_experimental import _bl5_joint_mesh_definition diff --git a/tests/test_r8_bl5_density_reference_dev.py b/tests/test_r8_bl5_density_reference_dev.py index 65fdfe397..cc3eab7b5 100644 --- a/tests/test_r8_bl5_density_reference_dev.py +++ b/tests/test_r8_bl5_density_reference_dev.py @@ -31,7 +31,7 @@ sys.path.insert(0, sys.argv[1]) from scripts import r8_bl5_density_reference_dev as reference -FORBIDDEN_ROOTS = ('anysolver', 'openseespy', 'openseespywin') +FORBIDDEN_ROOTS = ('anyfesolver', 'openseespy', 'openseespywin') class ForbiddenImport(importlib.abc.MetaPathFinder): diff --git a/tests/test_r8_bl5_matched_native_reference.py b/tests/test_r8_bl5_matched_native_reference.py index e664a9b15..5adc88745 100644 --- a/tests/test_r8_bl5_matched_native_reference.py +++ b/tests/test_r8_bl5_matched_native_reference.py @@ -5,10 +5,10 @@ import sys import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver._ge_beam3_retained_generalized_state import Mechanical -from anysolver._ge_beam3_p5.algebra import rotation -from anysolver._ge_beam3_pose_joint import _exp_terms +from anyfesolver import stiffened_shell as ss +from anyfesolver._ge_beam3_retained_generalized_state import Mechanical +from anyfesolver._ge_beam3_p5.algebra import rotation +from anyfesolver._ge_beam3_pose_joint import _exp_terms from scripts import r8_bl5_matched_native_reference as tool @@ -22,12 +22,12 @@ def owner(): def test_actual_installed_runtime(): if 'ANYSOLVER_MATCHED_INSTALLED' not in os.environ: pytest.skip('ANYSOLVER_MATCHED_INSTALLED installed-runtime binding absent') - import anysolver, numba + import anyfesolver, numba from threadpoolctl import threadpool_info expected=Path(os.environ['ANYSOLVER_MATCHED_INSTALLED']).resolve() - assert Path(anysolver.__file__).resolve().is_relative_to(expected) + assert Path(anyfesolver.__file__).resolve().is_relative_to(expected) assert all(Path(m.__file__).resolve().is_relative_to(expected) for n,m in sys.modules.items() - if n.startswith('anysolver.') and getattr(m,'__file__',None)) + if n.startswith('anyfesolver.') and getattr(m,'__file__',None)) assert numba.config.DISABLE_JIT and numba.get_num_threads()==1 assert all(p['num_threads']==1 for p in threadpool_info()) @@ -158,8 +158,8 @@ def test_free_normal_spin_and_independent_supported_transverse_shear(owner): for native,eg,*_ in tool.global_correspondence(owner,shear,model,field): np.testing.assert_allclose(native,0.,atol=1e-15); np.testing.assert_allclose(eg,0.,atol=1e-15) # Actual retained compensated chord, not a normal-reconstructed director. - from anysolver import _ge_beam3_mixed_ad as ad - from anysolver._ge_beam3_p5.compensated import compensated_strain + from anyfesolver import _ge_beam3_mixed_ad as ad + from anyfesolver._ge_beam3_p5.compensated import compensated_strain for element,*_ in owner._beam_parts: ref=element.operator.reference.coordinates; current=ref.copy(); current[:,2]+=.2*ref[:,0] jets=[ad.Jet2.constant(0.,36) for _ in range(36)] diff --git a/tests/test_r8_bl5_mixed_shell_h1_dev.py b/tests/test_r8_bl5_mixed_shell_h1_dev.py index cda2c1e58..193c6e55d 100644 --- a/tests/test_r8_bl5_mixed_shell_h1_dev.py +++ b/tests/test_r8_bl5_mixed_shell_h1_dev.py @@ -107,7 +107,7 @@ def test_flat_embedding_has_only_five_physical_fields_per_node(): def test_actual_mixed_bl5_owner_keeps_supported_offline_shell_fields(): """The physical trace has zero off-line columns, but its H1 norm does not.""" - from anysolver import stiffened_shell as api + from anyfesolver import stiffened_shell as api from test_stiffened_shell_l1_assembly_experimental import _bl5_joint_mesh_definition base = _bl5_joint_mesh_definition(4, 4, 1) diff --git a/tests/test_r8_bl5_projected_native_beta_dev.py b/tests/test_r8_bl5_projected_native_beta_dev.py index 893a3f580..6729b6af2 100644 --- a/tests/test_r8_bl5_projected_native_beta_dev.py +++ b/tests/test_r8_bl5_projected_native_beta_dev.py @@ -48,14 +48,14 @@ def test_complete_historical_graph_rejects_site_and_wheel_mutation(tmp_path): import zipfile site = tmp_path/'site' - package = site/'anysolver' + package = site/'anyfesolver' package.mkdir(parents=True) wheel = tmp_path/'historical.whl' payload = b'# frozen historical module\n' modules = {} with zipfile.ZipFile(wheel, 'w') as archive: for i in range(417): - name = f'anysolver/module_{i}.py' + name = f'anyfesolver/module_{i}.py' archive.writestr(name, payload) (site/name).write_bytes(payload) modules[name] = hashlib.sha256(payload).hexdigest() @@ -190,6 +190,6 @@ def observe(condition, message): def test_installed_graph_rejects_incomplete_historical_modules(tmp_path): wheel = tmp_path/'wheel'; wheel.write_bytes(b'frozen') - summary = dict(wheel_sha256=envelope.sha(wheel), module_sha256={'anysolver/a.py': 'wrong'}) + summary = dict(wheel_sha256=envelope.sha(wheel), module_sha256={'anyfesolver/a.py': 'wrong'}) with pytest.raises(ValueError, match='417-module'): candidate.installed_graph(tmp_path, wheel, summary) diff --git a/tests/test_r8_bl5_weak_continuum_reference.py b/tests/test_r8_bl5_weak_continuum_reference.py index 39bfb00e6..834b3996e 100644 --- a/tests/test_r8_bl5_weak_continuum_reference.py +++ b/tests/test_r8_bl5_weak_continuum_reference.py @@ -4,7 +4,7 @@ from pathlib import Path import numpy as np import pytest -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from scripts import r8_bl5_weak_continuum_reference as tool CHECKED=set() diff --git a/tests/test_r8_e01_native_polar_work.py b/tests/test_r8_e01_native_polar_work.py index 5a550a250..2fc37fa73 100644 --- a/tests/test_r8_e01_native_polar_work.py +++ b/tests/test_r8_e01_native_polar_work.py @@ -9,12 +9,12 @@ import numpy as np import pytest -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry -from anysolver._ge_beam3_p5.compensated_coordinates import split_sum -from anysolver._ge_beam3_retained_generalized_state import Context, Mechanical -from anysolver._stiffened_shell_l1_local_experimental import NativeHalfCellPort -from anysolver._ge_beam3_mixed_ad import rotation_exponential -from anysolver import _ge_beam3_mixed_ad as ad +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry +from anyfesolver._ge_beam3_p5.compensated_coordinates import split_sum +from anyfesolver._ge_beam3_retained_generalized_state import Context, Mechanical +from anyfesolver._stiffened_shell_l1_local_experimental import NativeHalfCellPort +from anyfesolver._ge_beam3_mixed_ad import rotation_exponential +from anyfesolver import _ge_beam3_mixed_ad as ad from scripts import r8_e01_native_polar_work as native from scripts import r8_e01_objective_polar_trace as polar diff --git a/tests/test_r8_e01_objective_polar_trace.py b/tests/test_r8_e01_objective_polar_trace.py index 46965aaa5..63bb1c725 100644 --- a/tests/test_r8_e01_objective_polar_trace.py +++ b/tests/test_r8_e01_objective_polar_trace.py @@ -5,7 +5,7 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_mixed_ad import rotation_exponential +from anyfesolver._ge_beam3_mixed_ad import rotation_exponential from scripts import r8_e01_objective_polar_trace as trace from scripts.r8_e01_material_frame_work import rectangular_patch, shell_material_frame_map diff --git a/tests/test_r8_f03_c2_signed_family_step_dev.py b/tests/test_r8_f03_c2_signed_family_step_dev.py index 47a20e99c..f602ba269 100644 --- a/tests/test_r8_f03_c2_signed_family_step_dev.py +++ b/tests/test_r8_f03_c2_signed_family_step_dev.py @@ -5,14 +5,14 @@ import pytest from scipy import linalg, sparse from pathlib import Path -import anysolver +import anyfesolver from scripts.b3_e4_bl5_coherent_aggregation_dev import model from scripts import r8_f03_c2_signed_family_step_dev as step def test_current_worktree_product_import(): - assert Path(anysolver.__file__).resolve().is_relative_to((step.WORKTREE/'src').resolve()) + assert Path(anyfesolver.__file__).resolve().is_relative_to((step.WORKTREE/'src').resolve()) provenance = step.product_provenance() assert all(Path(item['path']).is_file() for item in provenance.values()) assert all(len(item['sha256'])==64 for item in provenance.values()) diff --git a/tests/test_r8_f03_current_family_physical_bridge_dev.py b/tests/test_r8_f03_current_family_physical_bridge_dev.py index f268e87d2..55794f639 100644 --- a/tests/test_r8_f03_current_family_physical_bridge_dev.py +++ b/tests/test_r8_f03_current_family_physical_bridge_dev.py @@ -121,7 +121,7 @@ def test_nonzero_exerted_convention_and_caller(tmp_path,monkeypatch): from scripts import r8_f03_current_family_physical_bridge_dev as module from scripts import b3_e4_bl5_coherent_aggregation_dev as provider from scripts import r8_bl5_actual_primal_work_dev as normative - from anysolver import stiffened_shell + from anyfesolver import stiffened_shell from scripts.r8_f03_sparse_signed_family_dev import sha_matrix k=sparse.eye(3,format='csr');c=sparse.csr_matrix(np.array(((1.,2.,-1.),)));lam=np.diag((.4,));lm=np.array((3.,));q=np.array((.1,.2,.3)) loads=-np.asarray(c.T@lam) diff --git a/tests/test_r8_f03_current_owner_parity_dev.py b/tests/test_r8_f03_current_owner_parity_dev.py index 0ecf0f793..ac6bf83b7 100644 --- a/tests/test_r8_f03_current_owner_parity_dev.py +++ b/tests/test_r8_f03_current_owner_parity_dev.py @@ -66,14 +66,14 @@ def test_representative_git_drift_inventory(self): *parity.SOURCE_FILES], cwd=ROOT, check=True, capture_output=True, text=True).stdout.split() self.assertEqual(sorted(changed), [ - "src/anysolver/_stiffened_shell_ge_experimental.py", - "src/anysolver/_stiffened_shell_l1_assembly_experimental.py"]) + "src/anyfesolver/_stiffened_shell_ge_experimental.py", + "src/anyfesolver/_stiffened_shell_l1_assembly_experimental.py"]) old_owner = subprocess.run( ["git", "show", - f"{parity.OLD_PRODUCT}:src/anysolver/_stiffened_shell_ge_experimental.py"], + f"{parity.OLD_PRODUCT}:src/anyfesolver/_stiffened_shell_ge_experimental.py"], cwd=ROOT, check=True, capture_output=True).stdout current_owner = (ROOT / - "src/anysolver/_stiffened_shell_ge_experimental.py").read_bytes() + "src/anyfesolver/_stiffened_shell_ge_experimental.py").read_bytes() self.assertEqual(parity.function_ast_hash(old_owner, "_assemble_beam"), parity.function_ast_hash(current_owner, "_assemble_beam")) diff --git a/tests/test_r8_f03_finite_certificate_dev.py b/tests/test_r8_f03_finite_certificate_dev.py index 1c824ad03..97ed13f71 100644 --- a/tests/test_r8_f03_finite_certificate_dev.py +++ b/tests/test_r8_f03_finite_certificate_dev.py @@ -40,7 +40,7 @@ def setUpClass(cls): cls.work = cls.inventory['shell_work'] def test_01_source_stationary_and_completion(self): - from anysolver import e4_pl_element as source + from anyfesolver import e4_pl_element as source xyz = floating([[-self.a, -self.b], [self.a, -self.b], [self.a, self.b], [-self.a, self.b]]) coefficients = source._coefficients(xyz) station, coupling, gram = source._stationary_blocks(xyz, coefficients, floating(self.c)) @@ -128,11 +128,11 @@ def test_05_completion_removal_refuses_material_proof(self): with self.assertRaises(local.Unresolved): local.rectangle_work(self.a, self.b, self.ell, self.c, self.drill, self.budget, pl=F()) def test_06_native_actual_kinematics_and_LOCAL18(self): - from anysolver._ge_beam3_mixed_ad import Jet2, constant_matrix, so3_exp - from anysolver._ge_beam3_p5.compensated import compensated_strain - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry - from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection - from anysolver._ge_beam3_retained_generalized import RetainedGeneralizedOperator + from anyfesolver._ge_beam3_mixed_ad import Jet2, constant_matrix, so3_exp + from anyfesolver._ge_beam3_p5.compensated import compensated_strain + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry + from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection + from anyfesolver._ge_beam3_retained_generalized import RetainedGeneralizedOperator length = F(1); rows = local.native_member_rows(length, self.ell, self.budget) xyz = np.array(((0., 0., .0675), (.5, 0., .0675), (1., 0., .0675))) variables = [Jet2.variable(0., i, 24) for i in range(24)] @@ -176,10 +176,10 @@ def test_06_native_actual_kinematics_and_LOCAL18(self): MEASUREMENTS['native_source_negative_complementary_block'] = '-D retained; exact resultant-only stationary identity' def test_07_actual_BL5_P0_yaw_row_with_reference_lifts(self): - from anysolver._stiffened_shell_l1_local_experimental import NativeHalfCellPort - from anysolver._stiffened_shell_bl5_local_experimental import BL5LocalOperator - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry - from anysolver._ge_beam3_retained_generalized_state import Mechanical + from anyfesolver._stiffened_shell_l1_local_experimental import NativeHalfCellPort + from anyfesolver._stiffened_shell_bl5_local_experimental import BL5LocalOperator + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry + from anyfesolver._ge_beam3_retained_generalized_state import Mechanical xyz = np.array(((0., 0., .0675), (.5, 0., .0675), (1., 0., .0675))) triads = np.tile(np.eye(3), (3, 1, 1)) ref = CenteredCurvedBeam3ReferenceGeometry(xyz, triads) @@ -221,7 +221,7 @@ def test_08_yaw_blind_and_caps_fail_closed(self): def test_17_fixed_GX_sparse_source_norm_parity(self): from scripts.r8_bl5_mixed_shell_h1_dev import scalar_mixed_h1 from scripts.b3_e4_bl5_riesz_controls_dev import beam_norm - from anysolver import e4_pl_element as source + from anyfesolver import e4_pl_element as source nodes = np.array([(x, y) for x in (0., .5, 1.) for y in (0., .2)]) cells = ((0, 2, 3, 1), (2, 4, 5, 3)) scalar, area = scalar_mixed_h1(nodes, cells, float(self.ell)) diff --git a/tests/test_r8_f03_sparse_signed_family_dev.py b/tests/test_r8_f03_sparse_signed_family_dev.py index 279794c5a..eae024f4f 100644 --- a/tests/test_r8_f03_sparse_signed_family_dev.py +++ b/tests/test_r8_f03_sparse_signed_family_dev.py @@ -190,7 +190,7 @@ def mock_solve(*args): return NS(status='completed',shell_displacement=np.ones(2),beam_coordinates=np.ones(2),multipliers=np.ones(1)) owner=NS(_beam_ids=tuple(range(101,118)),solve_linear=mock_solve,close=lambda:closed.append(True),_accepted=(None,np.ones(4))) monkeypatch.setitem(sys.modules,'scripts.b3_e4_bl5_coherent_aggregation_dev',NS(model=mock_model)) - monkeypatch.setitem(sys.modules,'anysolver',NS(stiffened_shell=NS(create_analysis=lambda **kwargs:owner,NodalAction=lambda *args:args))) + monkeypatch.setitem(sys.modules,'anyfesolver',NS(stiffened_shell=NS(create_analysis=lambda **kwargs:owner,NodalAction=lambda *args:args))) monkeypatch.setattr(module,'construction_provenance',lambda model:dict(mock='no real model/fixture execution')) monkeypatch.setattr(module,'extract_owner',lambda *args:snapshot) def mock_prepare(s): @@ -243,7 +243,7 @@ def model(*args): return object(),{} def create(**kw):raise Refused('MOCK_OWNER_CONSTRUCTION_REFUSAL') monkeypatch.setitem(sys.modules,'scripts.b3_e4_bl5_coherent_aggregation_dev',NS(model=model)) - monkeypatch.setitem(sys.modules,'anysolver',NS(stiffened_shell=NS(create_analysis=create))) + monkeypatch.setitem(sys.modules,'anyfesolver',NS(stiffened_shell=NS(create_analysis=create))) monkeypatch.setattr(module,'construction_provenance',lambda model:{'mock':'no model/owner execution'}) out=tmp_path/'failed-construction' with pytest.raises(Refused,match='MOCK'):module.family_case(32,out) diff --git a/tests/test_r8_f03_supported_work_20261010.py b/tests/test_r8_f03_supported_work_20261010.py index 79ca0db26..903928772 100644 --- a/tests/test_r8_f03_supported_work_20261010.py +++ b/tests/test_r8_f03_supported_work_20261010.py @@ -2,8 +2,8 @@ import numpy as np import pytest -from anysolver._stiffened_shell_l1_assembly_experimental import compile_supported_shell_work -from anysolver._stiffened_shell_l1_supported_work_experimental import SupportedShellWorkMap +from anyfesolver._stiffened_shell_l1_assembly_experimental import compile_supported_shell_work +from anyfesolver._stiffened_shell_l1_supported_work_experimental import SupportedShellWorkMap def test_effective_bounded_numerical_runtime(): diff --git a/tests/test_r8_f06_adaptive_material_dev.py b/tests/test_r8_f06_adaptive_material_dev.py index 2df916ac7..cddfffebb 100644 --- a/tests/test_r8_f06_adaptive_material_dev.py +++ b/tests/test_r8_f06_adaptive_material_dev.py @@ -7,9 +7,9 @@ def test_source_admission(): from scripts.r8_f06_adaptive_material_dev import cyclic,programme from scripts.r8_f06_native_material_breadth_dev import definition - from anysolver import stiffened_shell as ss - from anysolver._stiffened_shell_increment_control import AdaptiveIncrementControl - from anysolver._stiffened_shell_ge_finite_experimental import supports_paired_fibre_adaptive + from anyfesolver import stiffened_shell as ss + from anyfesolver._stiffened_shell_increment_control import AdaptiveIncrementControl + from anyfesolver._stiffened_shell_ge_finite_experimental import supports_paired_fibre_adaptive owner=ss.create_analysis(definition=cyclic.definition('bend-z')) try: assert supports_paired_fibre_adaptive(owner) @@ -33,11 +33,11 @@ def test_source_lifecycle(): import numpy as np from dataclasses import replace,asdict from scripts.r8_f06_adaptive_material_dev import cyclic,programme,PREFIX,write,sha - from anysolver import stiffened_shell as ss - from anysolver._stiffened_shell_increment_control import AdaptiveIncrementControl,decode_control,encode_control - from anysolver._stiffened_shell_staged_load_experimental import decode_checkpoint,encode_checkpoint - from anysolver._stiffened_shell_ge_checkpoint_binary import decode_compensated,encode_compensated - from anysolver._ge_beam3_p5_seeded.core import canonical + from anyfesolver import stiffened_shell as ss + from anyfesolver._stiffened_shell_increment_control import AdaptiveIncrementControl,decode_control,encode_control + from anyfesolver._stiffened_shell_staged_load_experimental import decode_checkpoint,encode_checkpoint + from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode_compensated,encode_compensated + from anyfesolver._ge_beam3_p5_seeded.core import canonical out=Path(os.environ['F06_ADAPTIVE_OUTPUT']);model=cyclic.definition('bend-z') owner=ss.create_analysis(definition=model) try: @@ -94,9 +94,9 @@ def test_primary(): from dataclasses import asdict from scripts.r8_f06_adaptive_material_dev import paired_value,persist_accepted from scripts.r8_f06_adaptive_material_dev import cyclic,programme,PREFIX,write,sha - from anysolver import stiffened_shell as ss - from anysolver._stiffened_shell_increment_control import AdaptiveIncrementControl,AdaptiveIncrementExhausted,FiniteIncrementFailure - from anysolver._stiffened_shell_beam_history import arrays as history_arrays + from anyfesolver import stiffened_shell as ss + from anyfesolver._stiffened_shell_increment_control import AdaptiveIncrementControl,AdaptiveIncrementExhausted,FiniteIncrementFailure + from anyfesolver._stiffened_shell_beam_history import arrays as history_arrays out=Path(os.environ['F06_ADAPTIVE_OUTPUT']);owner=ss.create_analysis(definition=cyclic.definition('bend-z')) try: raw=PREFIX.read_bytes();owner.restore(raw);assert owner.checkpoint()==raw @@ -156,7 +156,7 @@ def observe(result): def test_source_exact_pair(): import math,json,numpy as np from scripts.r8_f06_adaptive_material_dev import paired_value,persist_accepted,cyclic,PREFIX,write - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss out=Path(os.environ['F06_ADAPTIVE_OUTPUT']);owner=ss.create_analysis(definition=cyclic.definition('bend-z')) try: owner.restore(PREFIX.read_bytes());d=owner._finite_driver;raw=owner.checkpoint() @@ -186,13 +186,13 @@ def test_installed_lifecycle(): import numpy as np,json from dataclasses import replace from scripts.r8_f06_adaptive_material_dev import DOC,cyclic,programme,write,persist_accepted,paired_value - from anysolver import stiffened_shell as ss - from anysolver._stiffened_shell_increment_control import AdaptiveIncrementControl,AdaptiveIncrementExhausted,decode_control,encode_control - from anysolver._stiffened_shell_staged_load_experimental import decode_checkpoint,encode_checkpoint - from anysolver._stiffened_shell_ge_checkpoint_binary import decode_compensated,encode_compensated,decode_chart,encode_chart,decode,encode - from anysolver._stiffened_shell_beam_history import shapes - from anysolver._ge_beam3_p5_seeded.core import canonical - from anysolver.control import CancellationToken,SolveCancelled + from anyfesolver import stiffened_shell as ss + from anyfesolver._stiffened_shell_increment_control import AdaptiveIncrementControl,AdaptiveIncrementExhausted,decode_control,encode_control + from anyfesolver._stiffened_shell_staged_load_experimental import decode_checkpoint,encode_checkpoint + from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode_compensated,encode_compensated,decode_chart,encode_chart,decode,encode + from anyfesolver._stiffened_shell_beam_history import shapes + from anyfesolver._ge_beam3_p5_seeded.core import canonical + from anyfesolver.control import CancellationToken,SolveCancelled out=Path(os.environ['F06_ADAPTIVE_OUTPUT']);model=cyclic.definition('bend-z');completed=[] def progress(label):completed.append(label);write(out/'progress.json',completed) pending=(DOC/'attempt-primary2/accepted-00.bin').read_bytes() @@ -295,8 +295,8 @@ def observe(result): def test_installed_continuation(): import json from scripts.r8_f06_adaptive_material_dev import DOC,cyclic,programme,write,persist_accepted,paired_value - from anysolver import stiffened_shell as ss - from anysolver._stiffened_shell_increment_control import AdaptiveIncrementControl,AdaptiveIncrementExhausted + from anyfesolver import stiffened_shell as ss + from anyfesolver._stiffened_shell_increment_control import AdaptiveIncrementControl,AdaptiveIncrementExhausted out=Path(os.environ['F06_ADAPTIVE_OUTPUT']);completed=[] def progress(label):completed.append(label);write(out/'progress.json',completed) owner=ss.create_analysis(definition=cyclic.definition('bend-z')) diff --git a/tests/test_r8_f06_compensated_state_checkpoint_repair_dev.py b/tests/test_r8_f06_compensated_state_checkpoint_repair_dev.py index aa8e78dc3..69638adaa 100644 --- a/tests/test_r8_f06_compensated_state_checkpoint_repair_dev.py +++ b/tests/test_r8_f06_compensated_state_checkpoint_repair_dev.py @@ -7,33 +7,33 @@ SHAPES=(('q_low',(1,)),('frames_low',(1,3,3)),('cells_low',(1,2,3,3)),('resultants_low',(1,18))) def raw_header(payload,tail=b'',declared=None): - from anysolver._stiffened_shell_ge_checkpoint_binary import COMPENSATED_MAGIC + from anyfesolver._stiffened_shell_ge_checkpoint_binary import COMPENSATED_MAGIC header=payload if type(payload) is bytes else json.dumps(payload,separators=(',',':')).encode('ascii') body=COMPENSATED_MAGIC+(len(header) if declared is None else declared).to_bytes(4,'little')+header+tail return body+hashlib.sha256(body).digest() @pytest.mark.parametrize('root',[None,0,1,1.2,'schema',[],[{}],True,False,{}]) def test_checkpoint_repair_valid_digest_nonobject_and_malformed_root(root): - from anysolver._stiffened_shell_ge_checkpoint_binary import decode_compensated + from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode_compensated with pytest.raises(ValueError,match='model identity'):decode_compensated(raw_header(root),MODEL,SHAPES) @pytest.mark.parametrize('header',[b'\xff',b'{']) def test_checkpoint_repair_expected_parse_errors(header): - from anysolver._stiffened_shell_ge_checkpoint_binary import decode_compensated + from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode_compensated with pytest.raises(ValueError,match='invalid compensated metadata'):decode_compensated(raw_header(header),MODEL,SHAPES) @pytest.mark.parametrize('declared',[0,8193,20]) def test_checkpoint_repair_bounded_metadata_slices(declared): - from anysolver._stiffened_shell_ge_checkpoint_binary import decode_compensated + from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode_compensated with pytest.raises(ValueError,match='bounded compensated metadata'):decode_compensated(raw_header(b'null',declared=declared),MODEL,SHAPES) def test_checkpoint_repair_bounded_inner_slice(): - from anysolver._stiffened_shell_ge_checkpoint_binary import decode_compensated,COMPENSATED_SCHEMA + from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode_compensated,COMPENSATED_SCHEMA metadata=dict(schema=COMPENSATED_SCHEMA,model=MODEL,inner_bytes=10**100,fields=[]) with pytest.raises(ValueError,match='bounded inner checkpoint'):decode_compensated(raw_header(metadata),MODEL,SHAPES) def test_checkpoint_repair_memoryerror_propagates(monkeypatch): - import anysolver._stiffened_shell_ge_checkpoint_binary as binary + import anyfesolver._stiffened_shell_ge_checkpoint_binary as binary raw=raw_header(None);failure=MemoryError('injected parser allocation failure') def fail(*args,**kwargs):raise failure monkeypatch.setattr(binary.json,'loads',fail) @@ -41,7 +41,7 @@ def fail(*args,**kwargs):raise failure assert caught.value is failure def test_checkpoint_repair_exact_compensated_roundtrip(): - from anysolver._stiffened_shell_ge_checkpoint_binary import encode_compensated,decode_compensated + from anyfesolver._stiffened_shell_ge_checkpoint_binary import encode_compensated,decode_compensated values={name:np.arange(np.prod(shape),dtype=np.float64).reshape(shape)/100 for name,shape in SHAPES} raw=encode_compensated(b'owned inner bytes',MODEL,values) inner,got=decode_compensated(raw,MODEL,SHAPES) @@ -51,7 +51,7 @@ def test_checkpoint_repair_exact_compensated_roundtrip(): assert encode_compensated(inner,MODEL,got)==raw def test_checkpoint_repair_affected_legacy_binary_metadata(): - from anysolver._stiffened_shell_ge_checkpoint_binary import encode,decode + from anyfesolver._stiffened_shell_ge_checkpoint_binary import encode,decode shapes=(('q',(2,)),('multipliers',(1,)),('load',(2,))) values=tuple((name,np.arange(np.prod(shape),dtype=np.float64).reshape(shape)) for name,shape in shapes) raw=encode('linear',MODEL,1,values) diff --git a/tests/test_r8_f06_compensated_state_dev.py b/tests/test_r8_f06_compensated_state_dev.py index 3457bd4da..3fe033a03 100644 --- a/tests/test_r8_f06_compensated_state_dev.py +++ b/tests/test_r8_f06_compensated_state_dev.py @@ -6,7 +6,7 @@ pytestmark=pytest.mark.skipif('F06_COMPENSATED_OUTPUT' not in os.environ,reason='bounded supervisor only') def test_control_error_free_owned_accumulation_and_refusal(): - from anysolver._stiffened_shell_f06_increment_arithmetic import Pair,add_state,validate_frames,validate_pairs,Jet,log + from anyfesolver._stiffened_shell_f06_increment_arithmetic import Pair,add_state,validate_frames,validate_pairs,Jet,log high=np.array([1.]);low=np.zeros(1);delta=np.array([2.**-55]) h,l=add_state(high,low,delta) assert h[0]==1. and l[0]==delta[0] and high[0]==1. and low[0]==0. @@ -25,8 +25,8 @@ def test_control_direct_material_resultant_boundary(): assert cell.virgin()==origin def test_control_point_transpose_work_and_moving_rows(): - from anysolver._ge_beam3_pose_joint import RigidPoseJoint - from anysolver._stiffened_shell_f06_increment_arithmetic import updated_rotation + from anyfesolver._ge_beam3_pose_joint import RigidPoseJoint + from anyfesolver._stiffened_shell_f06_increment_arithmetic import updated_rotation joint=RigidPoseJoint(np.array([[0.,0.,0.],[1.,0.,0.]]),np.tile(np.eye(3),(2,1,1))) x=np.array([[0.,0.,0.],[1.,0.,0.]]) low=np.zeros((2,3));low[1,1]=2.**-55 @@ -51,9 +51,9 @@ def test_actual_original_full48_updater_and_evaluator(): def test_lifecycle_public_accepted_correction_cancel_rebase_and_cold_restore(): from scripts.r8_f06_compensated_state_route_dev import owner,definition,SAVED - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss from test_stiffened_shell_ge_finite_experimental import _actions - from anysolver._stiffened_shell_ge_checkpoint_binary import COMPENSATED_MAGIC + from anyfesolver._stiffened_shell_ge_checkpoint_binary import COMPENSATED_MAGIC o=owner();d=o._finite_driver try: old=o.checkpoint() @@ -86,7 +86,7 @@ def test_lifecycle_public_accepted_correction_cancel_rebase_and_cold_restore(): try: rebased.restore(raw);assert rebased.checkpoint()==raw finally:rebased.close() - from anysolver._stiffened_shell_ge_checkpoint_binary import decode_compensated,encode_compensated + from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode_compensated,encode_compensated shapes=(('q_low',state.q.shape),('frames_low',state.frames.shape),('cells_low',state.cells.shape),('resultants_low',state.resultants.shape)) inner,lows=decode_compensated(saved,o._identity,shapes) lows['q_low'][o._shell_count]=1. @@ -99,7 +99,7 @@ def test_lifecycle_public_accepted_correction_cancel_rebase_and_cold_restore(): with pytest.raises(ValueError,match='spectra'):fresh.modes(None) with pytest.raises(ValueError,match='controllers'):fresh.solve(_actions(),(.1,),increment_control=object()) finally:fresh.close() - from anysolver.control import CancellationToken,SolveCancelled + from anyfesolver.control import CancellationToken,SolveCancelled class CancelAfterCandidate(CancellationToken): calls=0 def raise_if_cancelled(self,stage=''): @@ -119,17 +119,17 @@ def raise_if_cancelled(self,stage=''): def test_legacy_affected_definition_default_pose_retained_and_checkpoint_controls(): from scripts.r8_f06_quiet_caller_repair_dev import definition as original from scripts.r8_f06_compensated_state_route_dev import definition,SAVED - from anysolver import stiffened_shell as ss - from anysolver._ge_beam3_native_definition import NativeBeamDefinition,STABLE_SO3_SCHEMA,COMPENSATED_SCHEMA - from anysolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement - from anysolver._ge_beam3_centered_so3_strain import POLICY as STABLE_POLICY - from anysolver._ge_beam3_pose_joint import RigidPoseJoint + from anyfesolver import stiffened_shell as ss + from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition,STABLE_SO3_SCHEMA,COMPENSATED_SCHEMA + from anyfesolver._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement + from anyfesolver._ge_beam3_centered_so3_strain import POLICY as STABLE_POLICY + from anyfesolver._ge_beam3_pose_joint import RigidPoseJoint import json default=original().beams[0];element,inertia=default.instantiate();op=element.operator assert op.arithmetic_policy is None assert NativeBeamDefinition.capture(element,inertia).raw==default.raw for policy,schema in ((STABLE_POLICY,STABLE_SO3_SCHEMA), - (__import__('anysolver._stiffened_shell_f06_increment_arithmetic',fromlist=['POLICY']).POLICY,COMPENSATED_SCHEMA)): + (__import__('anyfesolver._stiffened_shell_f06_increment_arithmetic',fromlist=['POLICY']).POLICY,COMPENSATED_SCHEMA)): made=NativeGeneralizedStaticElement(element.element_id,element.node_ids,op.reference,op.section, order=op.order,arithmetic_policy=policy) capture=NativeBeamDefinition.capture(made,inertia) diff --git a/tests/test_r8_f06_coupled_direction_dev.py b/tests/test_r8_f06_coupled_direction_dev.py index cc5913b32..7424586b3 100644 --- a/tests/test_r8_f06_coupled_direction_dev.py +++ b/tests/test_r8_f06_coupled_direction_dev.py @@ -12,10 +12,10 @@ def test_direction(): from scipy import sparse from scripts.r8_f06_coupled_direction_dev import INPUT,write from scripts.r8_f06_cyclic_material_dev import definition,actions - from anysolver import stiffened_shell as ss - from anysolver._stiffened_shell_increment_control import FiniteIncrementFailure - from anysolver._stiffened_shell_beam_history import arrays as history_arrays - import anysolver._stiffened_shell_ge_finite_experimental as finite + from anyfesolver import stiffened_shell as ss + from anyfesolver._stiffened_shell_increment_control import FiniteIncrementFailure + from anyfesolver._stiffened_shell_beam_history import arrays as history_arrays + import anyfesolver._stiffened_shell_ge_finite_experimental as finite out=Path(os.environ['F06_COUPLED_DIRECTION_OUTPUT']);owner=ss.create_analysis(definition=definition('coupled')) state_fields=('q','q_low','frames','frames_low','cells','cells_low','resultants','resultants_low','multipliers','shell_anchors') originals={};d=None diff --git a/tests/test_r8_f06_coupled_history_unblock_dev.py b/tests/test_r8_f06_coupled_history_unblock_dev.py index 144e0e1c7..8978b869b 100644 --- a/tests/test_r8_f06_coupled_history_unblock_dev.py +++ b/tests/test_r8_f06_coupled_history_unblock_dev.py @@ -12,10 +12,10 @@ def test_direction(): from scipy import sparse from scripts.r8_f06_coupled_history_unblock_dev import INPUT,write from scripts.r8_f06_cyclic_material_dev import definition,actions - from anysolver import stiffened_shell as ss - from anysolver._stiffened_shell_increment_control import FiniteIncrementFailure - from anysolver._stiffened_shell_beam_history import arrays as history_arrays - import anysolver._stiffened_shell_ge_finite_experimental as finite + from anyfesolver import stiffened_shell as ss + from anyfesolver._stiffened_shell_increment_control import FiniteIncrementFailure + from anyfesolver._stiffened_shell_beam_history import arrays as history_arrays + import anyfesolver._stiffened_shell_ge_finite_experimental as finite out=Path(os.environ['F06_COUPLED_HISTORY_UNBLOCK_OUTPUT']);owner=ss.create_analysis(definition=definition('coupled')) state_fields=('q','q_low','frames','frames_low','cells','cells_low','resultants','resultants_low','multipliers','shell_anchors') originals={};d=None @@ -165,11 +165,11 @@ def test_local_chain(): from scipy import sparse from scripts.r8_f06_coupled_history_unblock_dev import DOC,INPUT,write from scripts.r8_f06_cyclic_material_dev import definition - from anysolver import stiffened_shell as ss - from anysolver._ge_beam3_variational_shell import deformation - from anysolver._ge_beam3_pose_joint import _exp_terms - from anysolver._stiffened_shell_algorithmic_pullback import spatial_response - import anysolver.plasticity as pl + from anyfesolver import stiffened_shell as ss + from anyfesolver._ge_beam3_variational_shell import deformation + from anyfesolver._ge_beam3_pose_joint import _exp_terms + from anyfesolver._stiffened_shell_algorithmic_pullback import spatial_response + import anyfesolver.plasticity as pl out=Path(os.environ['F06_COUPLED_HISTORY_UNBLOCK_OUTPUT']);saved=DOC/'attempt-diagnostic1' owner=ss.create_analysis(definition=definition('coupled'));original_kernel=pl._jit_plane_stress_return_map;calls=[] try: diff --git a/tests/test_r8_f06_coupled_resume_dev.py b/tests/test_r8_f06_coupled_resume_dev.py index 410053cac..5e506fd83 100644 --- a/tests/test_r8_f06_coupled_resume_dev.py +++ b/tests/test_r8_f06_coupled_resume_dev.py @@ -6,7 +6,7 @@ def capture(owner): import numpy as np - from anysolver._stiffened_shell_beam_history import arrays + from anyfesolver._stiffened_shell_beam_history import arrays d=owner._finite_driver;s=d._state values=dict(arrays(owner._beam_parts,d._beam_predecessors,'origin')+arrays(owner._beam_parts,d._beam_origins,'accepted')) for label,histories in (('origin',d._shell_predecessors),('accepted',d._shell_origins)): @@ -68,7 +68,7 @@ def test_history(): from dataclasses import asdict from scripts.r8_f06_coupled_resume_dev import DOC,PREFIX,write from scripts.r8_f06_cyclic_material_dev import definition,actions - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss out=Path(os.environ['F06_COUPLED_RESUME_OUTPUT']);unload=os.environ['F06_COUPLED_RESUME_STAGE'].endswith('unload') model=definition('coupled');owner=ss.create_analysis(definition=model) source=PREFIX if unload else DOC/'attempt-installed-unload1/accepted.bin';target=.2 if unload else .41 @@ -127,11 +127,11 @@ def test_controls_rollback(): import numpy as np from scripts.r8_f06_coupled_resume_dev import DOC,PREFIX,write from scripts.r8_f06_cyclic_material_dev import definition,actions - from anysolver import stiffened_shell as ss - from anysolver.control import CancellationToken,SolveCancelled - from anysolver._stiffened_shell_increment_control import FiniteIncrementFailure,AdaptiveIncrementControl - from anysolver._stiffened_shell_ge_checkpoint_binary import decode_compensated,encode_compensated,decode,encode - from anysolver._stiffened_shell_beam_history import shapes + from anyfesolver import stiffened_shell as ss + from anyfesolver.control import CancellationToken,SolveCancelled + from anyfesolver._stiffened_shell_increment_control import FiniteIncrementFailure,AdaptiveIncrementControl + from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode_compensated,encode_compensated,decode,encode + from anyfesolver._stiffened_shell_beam_history import shapes out=Path(os.environ['F06_COUPLED_RESUME_OUTPUT']);model=definition('coupled');owner=ss.create_analysis(definition=model) try: owner.restore((DOC/'attempt-installed-reload1/accepted.bin').read_bytes());d=owner._finite_driver;before=identity(owner) @@ -161,9 +161,9 @@ def test_controls_tamper(): import numpy as np from scripts.r8_f06_coupled_resume_dev import DOC,PREFIX,write from scripts.r8_f06_cyclic_material_dev import definition - from anysolver import stiffened_shell as ss - from anysolver._stiffened_shell_ge_checkpoint_binary import decode_compensated,encode_compensated,decode,encode - from anysolver._stiffened_shell_beam_history import shapes + from anyfesolver import stiffened_shell as ss + from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode_compensated,encode_compensated,decode,encode + from anyfesolver._stiffened_shell_beam_history import shapes out=Path(os.environ['F06_COUPLED_RESUME_OUTPUT']);model=definition('coupled');owner=ss.create_analysis(definition=model) try: owner.restore((DOC/'attempt-installed-reload1/accepted.bin').read_bytes());d=owner._finite_driver;before=identity(owner) diff --git a/tests/test_r8_f06_coupled_staged_dev.py b/tests/test_r8_f06_coupled_staged_dev.py index 0083374e4..ee3f1058b 100644 --- a/tests/test_r8_f06_coupled_staged_dev.py +++ b/tests/test_r8_f06_coupled_staged_dev.py @@ -12,7 +12,7 @@ def test_history(): from dataclasses import asdict from scripts.r8_f06_coupled_staged_dev import DOC,INPUT,write from scripts.r8_f06_cyclic_material_dev import definition,actions - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss out=Path(os.environ['F06_COUPLED_STAGED_OUTPUT']);peak=os.environ['F06_COUPLED_STAGED_STAGE'].endswith('peak') source=INPUT if peak else DOC/'attempt-installed-peak1/accepted.bin';target=.4 if peak else .41 model=definition('coupled');owner=ss.create_analysis(definition=model) @@ -63,9 +63,9 @@ def test_rollback(): from dataclasses import asdict from scripts.r8_f06_coupled_staged_dev import DOC,write from scripts.r8_f06_cyclic_material_dev import definition,actions - from anysolver import stiffened_shell as ss - from anysolver.control import CancellationToken,SolveCancelled - from anysolver._stiffened_shell_increment_control import FiniteIncrementFailure,AdaptiveIncrementControl + from anyfesolver import stiffened_shell as ss + from anyfesolver.control import CancellationToken,SolveCancelled + from anyfesolver._stiffened_shell_increment_control import FiniteIncrementFailure,AdaptiveIncrementControl out=Path(os.environ['F06_COUPLED_STAGED_OUTPUT']);owner=ss.create_analysis(definition=definition('coupled')) try: owner.restore((DOC/'attempt-installed-peak1/accepted.bin').read_bytes());before=identity(owner) @@ -92,7 +92,7 @@ def raise_if_cancelled(self,stage=''): def test_tamper(): from scripts.r8_f06_coupled_staged_dev import DOC,write from scripts.r8_f06_cyclic_material_dev import definition - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss out=Path(os.environ['F06_COUPLED_STAGED_OUTPUT']);raw=(DOC/'attempt-installed-reload1/accepted.bin').read_bytes() fresh=ss.create_analysis(definition=definition('coupled')) try: diff --git a/tests/test_r8_f06_cyclic_material_dev.py b/tests/test_r8_f06_cyclic_material_dev.py index ec8a6f322..7d8c9c774 100644 --- a/tests/test_r8_f06_cyclic_material_dev.py +++ b/tests/test_r8_f06_cyclic_material_dev.py @@ -8,8 +8,8 @@ def test_installed_framing_only(): import numpy as np from scripts.r8_f06_cyclic_material_dev import definition,DOC - from anysolver import stiffened_shell as ss - from anysolver._stiffened_shell_ge_checkpoint_binary import encode_compensated + from anyfesolver import stiffened_shell as ss + from anyfesolver._stiffened_shell_ge_checkpoint_binary import encode_compensated raw=(DOC/'attempt-source-bend-z2/failure-state.bin').read_bytes() owner=ss.create_analysis(definition=definition('bend-z')) try: @@ -32,8 +32,8 @@ def test_installed_framing_only(): def test_public_cyclic_material(): import numpy as np from scripts.r8_f06_cyclic_material_dev import definition,actions,DOC - from anysolver import stiffened_shell as ss - from anysolver._ge_beam3_p5_seeded.core import canonical + from anyfesolver import stiffened_shell as ss + from anyfesolver._ge_beam3_p5_seeded.core import canonical case=os.environ['F06_CYCLIC_CASE'];out=Path(os.environ['F06_CYCLIC_OUTPUT']) model=definition(case);owner=ss.create_analysis(definition=model) programme=ss.StagedDeadLoadProgramme(owner.preflight()['identity'], @@ -76,8 +76,8 @@ def mask(response):return np.concatenate([a['alpha']>b['alpha'] for a,b in zip(r assert max(derivative_errors.values())<1e-6,derivative_errors # Replay the true accepted state before checkpoint/recovery capture. evaluate(driver._state) - from anysolver._stiffened_shell_beam_history import shapes - from anysolver._stiffened_shell_ge_checkpoint_binary import decode_compensated,encode_compensated,decode,encode + from anyfesolver._stiffened_shell_beam_history import shapes + from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode_compensated,encode_compensated,decode,encode state=driver._state;lows=('q_low','frames_low','cells_low','resultants_low') inner,corrections=decode_compensated(raw,owner._identity,tuple((k,getattr(state,k).shape) for k in lows)) layout=tuple((k,v.shape) for k,v in (('q',state.q),('frames',state.frames),('cells',state.cells),('resultants',state.resultants), @@ -141,7 +141,7 @@ def mask(response):return np.concatenate([a['alpha']>b['alpha'] for a,b in zip(r after=owner.checkpoint();phase('continued-or-reversed') final=DOC/(case+'-final-prefix.bin') if not final.exists():final.write_bytes(after) - from anysolver.control import CancellationToken,SolveCancelled + from anyfesolver.control import CancellationToken,SolveCancelled class Cancel(CancellationToken): visits=0 def raise_if_cancelled(self,stage=''): @@ -152,7 +152,7 @@ def raise_if_cancelled(self,stage=''): cancel=Cancel() with pytest.raises(SolveCancelled):owner.solve(load,(continued+.01,),cancellation_token=cancel) assert cancel.visits==2 and owner.checkpoint()==after - from anysolver._stiffened_shell_increment_control import FiniteIncrementFailure + from anyfesolver._stiffened_shell_increment_control import FiniteIncrementFailure with pytest.raises(FiniteIncrementFailure):owner.solve(load,((3.9 if programme is not None else 1.2),),max_iterations=1,max_backtracks=0) assert owner.checkpoint()==after (out/'metrics.json').write_text(json.dumps(dict(status='PASS',case=case, @@ -167,12 +167,12 @@ def test_installed_material_continuation(): """Current isolated artifact continues a provenance-bound true public prefix.""" import numpy as np from scripts.r8_f06_cyclic_material_dev import definition,actions,DOC - from anysolver import stiffened_shell as ss - from anysolver._ge_beam3_p5_seeded.core import canonical - from anysolver._stiffened_shell_ge_checkpoint_binary import decode_compensated - from anysolver.control import CancellationToken,SolveCancelled + from anyfesolver import stiffened_shell as ss + from anyfesolver._ge_beam3_p5_seeded.core import canonical + from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode_compensated + from anyfesolver.control import CancellationToken,SolveCancelled case=os.environ['F06_CYCLIC_CASE'];out=Path(os.environ['F06_CYCLIC_OUTPUT']);model=definition(case) - import anysolver._stiffened_shell_f06_increment_arithmetic as arithmetic + import anyfesolver._stiffened_shell_f06_increment_arithmetic as arithmetic original=arithmetic.full_log_coefficients;native_cosines=[] def capture(c): import sys @@ -228,7 +228,7 @@ def capture(c): with pytest.raises(ValueError):fresh.restore(inner) assert fresh._finite_driver is None else: - from anysolver._stiffened_shell_staged_load_experimental import decode_checkpoint + from anyfesolver._stiffened_shell_staged_load_experimental import decode_checkpoint _,_,inner=decode_checkpoint(after) with pytest.raises(ValueError):fresh.restore(inner) assert fresh._finite_driver is None @@ -243,7 +243,7 @@ def raise_if_cancelled(self,stage=''): token=Cancel() with pytest.raises(SolveCancelled):owner.solve(load,(target+.01,),cancellation_token=token) assert token.visits==2 and owner.checkpoint()==after - from anysolver._stiffened_shell_increment_control import FiniteIncrementFailure + from anyfesolver._stiffened_shell_increment_control import FiniteIncrementFailure with pytest.raises(FiniteIncrementFailure):owner.solve(load,((2.2 if programme is not None else .8),),max_iterations=1,max_backtracks=0) assert owner.checkpoint()==after assert native_cosines and min(native_cosines)<1.-1e-7,'ordinary principal Log must reach retained evaluation' diff --git a/tests/test_r8_f06_direction_fallback_dev.py b/tests/test_r8_f06_direction_fallback_dev.py index eef838cfd..9727fcb1f 100644 --- a/tests/test_r8_f06_direction_fallback_dev.py +++ b/tests/test_r8_f06_direction_fallback_dev.py @@ -9,10 +9,10 @@ def test_controls(mode): import numpy as np from scripts.r8_f06_direction_fallback_dev import INPUTS,write from scripts.r8_f06_adaptive_material_dev import cyclic,programme - from anysolver import stiffened_shell as ss - from anysolver.control import CancellationToken,SolveCancelled - from anysolver._stiffened_shell_increment_control import AdaptiveIncrementControl,FiniteIncrementFailure,AdaptiveIncrementExhausted - from anysolver._stiffened_shell_ge_finite_experimental import _RotationStepTooLarge,BL5TrialDomainError + from anyfesolver import stiffened_shell as ss + from anyfesolver.control import CancellationToken,SolveCancelled + from anyfesolver._stiffened_shell_increment_control import AdaptiveIncrementControl,FiniteIncrementFailure,AdaptiveIncrementExhausted + from anyfesolver._stiffened_shell_ge_finite_experimental import _RotationStepTooLarge,BL5TrialDomainError out=Path(os.environ['F06_FALLBACK_OUTPUT'])/mode;out.mkdir();owner=ss.create_analysis(definition=cyclic.definition('bend-z')) try: owner.restore(INPUTS['reversed' if mode in ('fixed','budget-zero') else 'pending'].read_bytes());d=owner._finite_driver @@ -73,9 +73,9 @@ def test_route(): from dataclasses import asdict from scripts.r8_f06_direction_fallback_dev import INPUTS,write,sha from scripts.r8_f06_adaptive_material_dev import cyclic,programme,persist_accepted,paired_value - from anysolver import stiffened_shell as ss - from anysolver._stiffened_shell_increment_control import AdaptiveIncrementControl,FiniteIncrementFailure - from anysolver._stiffened_shell_beam_history import arrays as history_arrays + from anyfesolver import stiffened_shell as ss + from anyfesolver._stiffened_shell_increment_control import AdaptiveIncrementControl,FiniteIncrementFailure + from anyfesolver._stiffened_shell_beam_history import arrays as history_arrays out=Path(os.environ['F06_FALLBACK_OUTPUT']);case=os.environ['F06_FALLBACK_CASE'];target={'pending':2.5,'reversed':2.51}[case] owner=ss.create_analysis(definition=cyclic.definition('bend-z')) try: diff --git a/tests/test_r8_f06_fibre_log_domain_dev.py b/tests/test_r8_f06_fibre_log_domain_dev.py index 53c7d3f4d..1f35b8b0f 100644 --- a/tests/test_r8_f06_fibre_log_domain_dev.py +++ b/tests/test_r8_f06_fibre_log_domain_dev.py @@ -7,8 +7,8 @@ def test_legacy_definition_and_policy(): import numpy as np from scripts.r8_f06_fibre_log_domain_dev import element - from anysolver._ge_beam3_native_definition import NativeBeamDefinition,SCHEMA,COMPENSATED_SCHEMA - from anysolver._ge_beam3_retained_fibre import RetainedFibreOperator + from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition,SCHEMA,COMPENSATED_SCHEMA + from anyfesolver._ge_beam3_retained_fibre import RetainedFibreOperator for paired,schema in ((False,SCHEMA),(True,COMPENSATED_SCHEMA)): e=element(paired=paired);d=NativeBeamDefinition.capture(e,np.eye(6)) assert json.loads(d.raw)['schema']==schema @@ -58,8 +58,8 @@ def test_active_paired_resultant_law_and_recovery(): def test_active_spatial_derivative(): import numpy as np from scripts.r8_f06_fibre_log_domain_dev import element - from anysolver._stiffened_shell_f06_increment_arithmetic import updated_rotation,Pair - from anysolver._ge_beam3_generalized_static_boundary import spatial_jacobian + from anyfesolver._stiffened_shell_f06_increment_arithmetic import updated_rotation,Pair + from anyfesolver._ge_beam3_generalized_static_boundary import spatial_jacobian e=element();op=e.operator;x=op.reference.coordinates.copy();xl=np.zeros_like(x) q=np.tile(np.eye(3),(3,1,1));ql=np.zeros_like(q);u=np.tile(np.eye(3),(2,1,1));ul=np.zeros_like(u) for i in range(3):q[i],ql[i]=updated_rotation(q[i],ql[i],np.array([0.,.03*i,.01*i])) @@ -84,13 +84,13 @@ def at(h): def test_public_active_fibre_lifecycle(): import numpy as np from scripts.r8_f06_fibre_log_domain_dev import definition,actions,DOC - from anysolver import stiffened_shell as ss - from anysolver.control import CancellationToken,SolveCancelled - from anysolver._ge_beam3_p5_seeded.core import canonical - from anysolver._stiffened_shell_beam_history import shapes - from anysolver._stiffened_shell_ge_checkpoint_binary import decode_compensated,encode_compensated,decode,encode,SCHEMAS - from anysolver._stiffened_shell_f06_increment_arithmetic import Pair - import anysolver._stiffened_shell_f06_increment_arithmetic as arithmetic + from anyfesolver import stiffened_shell as ss + from anyfesolver.control import CancellationToken,SolveCancelled + from anyfesolver._ge_beam3_p5_seeded.core import canonical + from anyfesolver._stiffened_shell_beam_history import shapes + from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode_compensated,encode_compensated,decode,encode,SCHEMAS + from anyfesolver._stiffened_shell_f06_increment_arithmetic import Pair + import anyfesolver._stiffened_shell_f06_increment_arithmetic as arithmetic out=Path(os.environ['F06_FIBRE_OUTPUT']);owner=ss.create_analysis(definition=definition()) calls=[];original=arithmetic.full_log_coefficients def capture(c):calls.append(c.scalar());return original(c) @@ -166,7 +166,7 @@ def raise_if_cancelled(self,stage=''): cancel=Cancel() with pytest.raises(SolveCancelled):owner.solve(actions(),(.42,),cancellation_token=cancel) assert cancel.visits==2 and owner.checkpoint()==after - from anysolver._stiffened_shell_increment_control import FiniteIncrementFailure + from anyfesolver._stiffened_shell_increment_control import FiniteIncrementFailure with pytest.raises(FiniteIncrementFailure):owner.solve(actions(),(1.2,),max_iterations=1,max_backtracks=0) assert owner.checkpoint()==after write=dict(status='PASS',family='axial',prefix_reused=prefix,ordinary_calls=len(calls),minimum_cosine=min(calls), diff --git a/tests/test_r8_f06_log_domain_dev.py b/tests/test_r8_f06_log_domain_dev.py index a702da784..14fff76bf 100644 --- a/tests/test_r8_f06_log_domain_dev.py +++ b/tests/test_r8_f06_log_domain_dev.py @@ -6,15 +6,15 @@ @pytest.mark.parametrize('angle',[.0006,.4,1.7,2.7]) def test_control_full_coefficients_independent_series(angle): from scripts.r8_f06_log_domain_route_dev import coefficient_oracle - from anysolver._stiffened_shell_f06_increment_arithmetic import Pair,full_log_coefficients + from anyfesolver._stiffened_shell_f06_increment_arithmetic import Pair,full_log_coefficients high=float(np.cos(angle));low=2.**-60 got=full_log_coefficients(Pair(high,low));want=coefficient_oracle(high,low) np.testing.assert_allclose([p.scalar() for p in got],want,rtol=5e-13,atol=5e-13) @pytest.mark.parametrize('low',[2.**-80,0.,-2.**-80]) def test_control_physical_pair_branch_and_cutoff(low,monkeypatch): - import anysolver._stiffened_shell_f06_increment_arithmetic as a - from anysolver._ge_beam3_mixed_ad import math_cos_limit,RotationDomainError + import anyfesolver._stiffened_shell_f06_increment_arithmetic as a + from anyfesolver._ge_beam3_mixed_ad import math_cos_limit,RotationDomainError c=a.Pair(1.-1e-7,low);calls=[];original=a.full_log_coefficients def capture(c):calls.append(c);return original(c) monkeypatch.setattr(a,'full_log_coefficients',capture) @@ -29,7 +29,7 @@ def capture(c):calls.append(c);return original(c) @pytest.mark.parametrize('angle',[.0003,.0006,.7,2.7]) def test_control_axis_equivalence_and_left_jacobian(angle): from scipy.spatial.transform import Rotation - from anysolver._stiffened_shell_f06_increment_arithmetic import Jet,exp,mm,const,log + from anyfesolver._stiffened_shell_f06_increment_arithmetic import Jet,exp,mm,const,log axis=np.array([2.,-1.,3.]);axis/=np.linalg.norm(axis);phi=angle*axis r=Rotation.from_rotvec(phi).as_matrix();w=[Jet.variable(0.,i,3) for i in range(3)] values=log(mm(exp(w),const(r,np.zeros((3,3)),3))) @@ -43,7 +43,7 @@ def test_control_axis_equivalence_and_left_jacobian(angle): def test_control_off_so3_affine_gradient_hessian(): from scripts.r8_f06_log_domain_route_dev import coefficient_oracle from scipy.spatial.transform import Rotation - from anysolver._stiffened_shell_f06_increment_arithmetic import Jet,Pair,log + from anyfesolver._stiffened_shell_f06_increment_arithmetic import Jet,Pair,log high=Rotation.from_rotvec([.4,-.2,.3]).as_matrix();high[1,1]+=3e-13 low=np.zeros((3,3));low[0,0]=2.**-58 D=np.array([[.7,.2,-.3],[-.1,-.4,.8],[.4,-.6,.2]]) @@ -57,8 +57,8 @@ def test_control_off_so3_affine_gradient_hessian(): def test_control_native_active_fixed_origin_spatial_work_and_objectivity(): from scripts.r8_f06_log_domain_route_dev import definition from scipy.spatial.transform import Rotation - from anysolver._stiffened_shell_f06_increment_arithmetic import add_state,updated_rotation - from anysolver._ge_beam3_generalized_static_boundary import spatial_jacobian + from anyfesolver._stiffened_shell_f06_increment_arithmetic import add_state,updated_rotation + from anyfesolver._ge_beam3_generalized_static_boundary import spatial_jacobian e,_=definition().beams[0].instantiate();op=e.operator;x=op.reference.coordinates.copy();x[2]+=[.03,.02,.01] q=Rotation.from_rotvec([[.4,-.1,.2],[.2,.3,-.1],[.7,.1,.2]]).as_matrix() u=Rotation.from_rotvec([[.1,.15,-.05],[.2,-.1,.15]]).as_matrix() @@ -95,8 +95,8 @@ def test_route_public_active_ordinary_lifecycle(): def test_control_point_ordinary_spatial_derivative_work_objectivity(): from scipy.spatial.transform import Rotation - from anysolver._ge_beam3_pose_joint import RigidPoseJoint - from anysolver._stiffened_shell_f06_increment_arithmetic import add_state,updated_rotation + from anyfesolver._ge_beam3_pose_joint import RigidPoseJoint + from anyfesolver._stiffened_shell_f06_increment_arithmetic import add_state,updated_rotation x0=np.array([[0.,0.,0.],[.3,-.2,.1]]);q0=np.tile(np.eye(3),(2,1,1)) joint=RigidPoseJoint(x0,q0);x=x0+np.array([[.01,.02,0.],[-.01,.03,.04]]) q=Rotation.from_rotvec([[.3,-.2,.1],[-.2,.4,.5]]).as_matrix();lam=np.array([2.,-3.,4.,7.,-5.,6.]) @@ -123,7 +123,7 @@ def test_control_point_ordinary_spatial_derivative_work_objectivity(): def test_control_paired_coefficient_low_parts(angle): from decimal import Decimal,localcontext from scripts.r8_f06_log_domain_route_dev import coefficient_oracle - from anysolver._stiffened_shell_f06_increment_arithmetic import Pair,full_log_coefficients + from anyfesolver._stiffened_shell_f06_increment_arithmetic import Pair,full_log_coefficients high=float(np.cos(angle));low=float(np.spacing(abs(high)))/4. expected=coefficient_oracle(high,low,decimal=True) actual=full_log_coefficients(Pair(high,low)) @@ -142,10 +142,10 @@ def test_control_historical_compensated_checkpoint_encoding(): from dataclasses import replace from types import SimpleNamespace from scripts.r8_f06_log_domain_route_dev import definition - from anysolver import stiffened_shell as ss - from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver - from anysolver._stiffened_shell_ge_checkpoint_binary import decode_compensated,decode - from anysolver._stiffened_shell_q4_algorithmic_pullback import HISTORICAL_POLICY + from anyfesolver import stiffened_shell as ss + from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver + from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode_compensated,decode + from anyfesolver._stiffened_shell_q4_algorithmic_pullback import HISTORICAL_POLICY owner=ss.create_analysis(definition=replace(definition(),q4_pullback_policy=HISTORICAL_POLICY)) try: driver=FinitePointDriver(owner);assert driver._compensated and driver._stable_q4 diff --git a/tests/test_r8_f06_mixed_adaptive_dev.py b/tests/test_r8_f06_mixed_adaptive_dev.py index 2e3b7c4b0..da60949c6 100644 --- a/tests/test_r8_f06_mixed_adaptive_dev.py +++ b/tests/test_r8_f06_mixed_adaptive_dev.py @@ -10,9 +10,9 @@ def test_controls_admission(): from dataclasses import replace from scripts.r8_f06_cyclic_material_dev import definition,actions from scripts.r8_f06_native_material_breadth_dev import definition as breadth - from anysolver import stiffened_shell as ss - from anysolver._stiffened_shell_increment_control import AdaptiveIncrementControl - from anysolver._stiffened_shell_ge_finite_experimental import supports_mixed_material_adaptive,supports_paired_fibre_adaptive + from anyfesolver import stiffened_shell as ss + from anyfesolver._stiffened_shell_increment_control import AdaptiveIncrementControl + from anyfesolver._stiffened_shell_ge_finite_experimental import supports_mixed_material_adaptive,supports_paired_fibre_adaptive models=(definition('coupled'),breadth('mixed'),definition('bend-z')) for i,model in enumerate(models): o=ss.create_analysis(definition=model) @@ -35,11 +35,11 @@ def test_controls_framing(): from dataclasses import replace from scripts.r8_f06_mixed_adaptive_dev import INPUT,write from scripts.r8_f06_cyclic_material_dev import definition,actions - from anysolver import stiffened_shell as ss - from anysolver._stiffened_shell_increment_control import AdaptiveIncrementControl,_AdaptiveState,IncrementAttempt,encode_control,decode_control,validate_control - from anysolver._stiffened_shell_ge_checkpoint_binary import decode_compensated,encode_compensated,decode_chart,encode_chart,decode,encode - from anysolver._stiffened_shell_beam_history import shapes - from anysolver.control import CancellationToken,SolveCancelled + from anyfesolver import stiffened_shell as ss + from anyfesolver._stiffened_shell_increment_control import AdaptiveIncrementControl,_AdaptiveState,IncrementAttempt,encode_control,decode_control,validate_control + from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode_compensated,encode_compensated,decode_chart,encode_chart,decode,encode + from anyfesolver._stiffened_shell_beam_history import shapes + from anyfesolver.control import CancellationToken,SolveCancelled out=Path(os.environ['F06_MIXED_ADAPTIVE_OUTPUT']);model=definition('coupled');o=ss.create_analysis(definition=model) try: o.restore(INPUT.read_bytes());d=o._finite_driver;original=capture(o);key=o._identity @@ -97,10 +97,10 @@ def test_controls_generated_cache(): import numpy as np from scripts.r8_f06_mixed_adaptive_dev import DOC,write from scripts.r8_f06_cyclic_material_dev import definition - from anysolver import stiffened_shell as ss - from anysolver._stiffened_shell_ge_checkpoint_binary import decode_compensated - from anysolver._stiffened_shell_increment_control import MAGIC,decode_control - from anysolver.control import CancellationToken,SolveCancelled + from anyfesolver import stiffened_shell as ss + from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode_compensated + from anyfesolver._stiffened_shell_increment_control import MAGIC,decode_control + from anyfesolver.control import CancellationToken,SolveCancelled out=Path(os.environ['F06_MIXED_ADAPTIVE_OUTPUT']);raw=(DOC/'recovered-cached-prefix.bin').read_bytes() original=DOC/'attempt-installed-path1';model=definition('coupled');o=ss.create_analysis(definition=model) try: @@ -144,8 +144,8 @@ def test_physical(): from dataclasses import asdict from scripts.r8_f06_mixed_adaptive_dev import DOC,INPUT,write from scripts.r8_f06_cyclic_material_dev import definition,actions - from anysolver import stiffened_shell as ss - from anysolver._stiffened_shell_increment_control import AdaptiveIncrementControl,AdaptiveIncrementExhausted,FiniteIncrementFailure + from anyfesolver import stiffened_shell as ss + from anyfesolver._stiffened_shell_increment_control import AdaptiveIncrementControl,AdaptiveIncrementExhausted,FiniteIncrementFailure out=Path(os.environ['F06_MIXED_ADAPTIVE_OUTPUT']);model=definition('coupled');owner=ss.create_analysis(definition=model) accepted=[];rejected=[];completed=[];targets=(.41,);request=AdaptiveIncrementControl(4,12);trace=out/'trace.jsonl' class AcceptedStop(Exception):pass diff --git a/tests/test_r8_f06_native_material_breadth_dev.py b/tests/test_r8_f06_native_material_breadth_dev.py index 09e2d325f..8a5b32de1 100644 --- a/tests/test_r8_f06_native_material_breadth_dev.py +++ b/tests/test_r8_f06_native_material_breadth_dev.py @@ -6,8 +6,8 @@ def test_family_classifier_and_partial_policy(): from scripts.r8_f06_native_material_breadth_dev import definition,actions - from anysolver import stiffened_shell as ss - from anysolver._stiffened_shell_beam_history import compensated_kind + from anyfesolver import stiffened_shell as ss + from anyfesolver._stiffened_shell_beam_history import compensated_kind for case,kind in (('axial','fibre'),('biaxial','fibre'),('mixed','mixed')): owner=ss.create_analysis(definition=definition(case)) try: @@ -26,8 +26,8 @@ def test_family_classifier_and_partial_policy(): def test_biaxial_defining_law_and_spatial_derivative(monkeypatch): from scripts.r8_f06_native_material_breadth_dev import definition from scripts import r8_f06_fibre_log_domain_dev as old - from anysolver._ge_beam3_native_fibre_static_element import NativeFibreStaticElement - from anysolver._stiffened_shell_f06_increment_arithmetic import POLICY + from anyfesolver._ge_beam3_native_fibre_static_element import NativeFibreStaticElement + from anyfesolver._stiffened_shell_f06_increment_arithmetic import POLICY import test_r8_f06_fibre_log_domain_dev as controls e,_=definition('biaxial').beams[0].instantiate() def physical(*,paired=True): @@ -40,14 +40,14 @@ def physical(*,paired=True): def test_public_material_lifecycle(): import numpy as np from scripts.r8_f06_native_material_breadth_dev import definition,actions,DOC - from anysolver import stiffened_shell as ss - from anysolver.control import CancellationToken,SolveCancelled - from anysolver._ge_beam3_p5_seeded.core import canonical - from anysolver._ge_beam3_fibre_section import PhysicalFibreSection - from anysolver._stiffened_shell_beam_history import shapes,compensated_kind - from anysolver._stiffened_shell_ge_checkpoint_binary import decode_compensated,encode_compensated,decode,encode,SCHEMAS - from anysolver._stiffened_shell_f06_increment_arithmetic import Pair - import anysolver._stiffened_shell_f06_increment_arithmetic as arithmetic + from anyfesolver import stiffened_shell as ss + from anyfesolver.control import CancellationToken,SolveCancelled + from anyfesolver._ge_beam3_p5_seeded.core import canonical + from anyfesolver._ge_beam3_fibre_section import PhysicalFibreSection + from anyfesolver._stiffened_shell_beam_history import shapes,compensated_kind + from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode_compensated,encode_compensated,decode,encode,SCHEMAS + from anyfesolver._stiffened_shell_f06_increment_arithmetic import Pair + import anyfesolver._stiffened_shell_f06_increment_arithmetic as arithmetic case=os.environ['F06_BREADTH_CASE'];out=Path(os.environ['F06_BREADTH_OUTPUT']) model=definition(case);owner=ss.create_analysis(definition=model);calls=[];native_calls=[];original=arithmetic.full_log_coefficients def phase(name):(out/'progress.json').write_text(json.dumps(dict(phase=name))) @@ -120,7 +120,7 @@ def refuse(payload): assert canonical(driver._beam_origins)==accepted and canonical(driver._beam_predecessors)==predecessor for n,v in saved_lows.items():np.testing.assert_array_equal(getattr(driver._state,n),v) rebased=owner.checkpoint();phase('rebase-passed') - from anysolver._stiffened_shell_ge_checkpoint_binary import decode_chart,encode_chart + from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode_chart,encode_chart chart,chart_corrections=decode_compensated(rebased,owner._identity,correction_shapes) event,anchors,witness,numeric=decode_chart(chart,owner._identity,len(owner._shell_ids)) chart_kind,steps,chart_values=decode(numeric,owner._identity,lambda k,g:base_shapes+shapes(owner._beam_parts,'origin')+shapes(owner._beam_parts,'accepted')) @@ -150,7 +150,7 @@ def raise_if_cancelled(self,stage=''): cancel=Cancel() with pytest.raises(SolveCancelled):owner.solve(actions(case),(.42,),cancellation_token=cancel) assert cancel.visits==2 and owner.checkpoint()==after - from anysolver._stiffened_shell_increment_control import FiniteIncrementFailure + from anyfesolver._stiffened_shell_increment_control import FiniteIncrementFailure with pytest.raises(FiniteIncrementFailure):owner.solve(actions(case),(1.2,),max_iterations=1,max_backtracks=0) assert owner.checkpoint()==after metrics=dict(status='PASS',case=case,kind=expected,reused_prefix=prefix,material=material, diff --git a/tests/test_r8_f06_paired_displacement_dev.py b/tests/test_r8_f06_paired_displacement_dev.py index f50d1c0c4..8979495b4 100644 --- a/tests/test_r8_f06_paired_displacement_dev.py +++ b/tests/test_r8_f06_paired_displacement_dev.py @@ -8,7 +8,7 @@ def inputs(): from scripts.r8_f06_paired_displacement_dev import DOC,INPUT,INPUT_SHA,write from scripts.r8_f06_cyclic_material_dev import definition,actions - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss plan=json.loads((DOC/'PHYSICAL_ROUTE.json').read_text());owner=ss.create_analysis(definition=definition('coupled')) return owner,actions('coupled'),ss.DisplacementControl('shell',2,1,force_seed_sha256=INPUT_SHA),plan['target'],INPUT,DOC,write @@ -49,8 +49,8 @@ def visit(value,path): def test_source_options_and_refusals(): import numpy as np from dataclasses import replace - from anysolver import stiffened_shell as ss - from anysolver._stiffened_shell_displacement_checkpoint import identities,_layout,PAIRED_KIND + from anyfesolver import stiffened_shell as ss + from anyfesolver._stiffened_shell_displacement_checkpoint import identities,_layout,PAIRED_KIND owner,loads,control,target,path,doc,write=inputs();out=Path(os.environ['F06_PAIRED_DISPLACEMENT_OUTPUT']) try: for value in ('',True,'A'*64,'g'*64,[]): @@ -70,7 +70,7 @@ def test_source_options_and_refusals(): @pytest.mark.parametrize('visit',(1,2)) def test_source_actual_trial_cancellation(visit): - from anysolver.control import CancellationToken,SolveCancelled + from anyfesolver.control import CancellationToken,SolveCancelled owner,loads,control,target,path,doc,write=inputs();out=Path(os.environ['F06_PAIRED_DISPLACEMENT_OUTPUT']) class Cancel(CancellationToken): def __init__(self):super().__init__();self.visits=0 @@ -89,11 +89,11 @@ def raise_if_cancelled(self,stage=''): def test_history(): import numpy as np,sys from dataclasses import asdict - from anysolver._stiffened_shell_displacement_checkpoint import decode_snapshot + from anyfesolver._stiffened_shell_displacement_checkpoint import decode_snapshot owner,loads,control,target,path,doc,write=inputs();out=Path(os.environ['F06_PAIRED_DISPLACEMENT_OUTPUT']);accepted=[] try: owner.restore(path.read_bytes());before=identity(owner);controller=owner._finite_driver._adaptive_state;initial=save(out,'initial',owner) - import anysolver._stiffened_shell_displacement_control as dc + import anyfesolver._stiffened_shell_displacement_control as dc original_encode=dc.encode_snapshot def persisted(*args,**kwargs): # Preserve the complete prospective result before publication/replay assertions. @@ -126,10 +126,10 @@ def on_accepted(result): def test_installed_restore_rebase_and_refusals(): import numpy as np - from anysolver import stiffened_shell as ss - from anysolver.control import CancellationToken,SolveCancelled - from anysolver._stiffened_shell_displacement_checkpoint import decode_snapshot,encode_snapshot - from anysolver._stiffened_shell_displacement_control import publish + from anyfesolver import stiffened_shell as ss + from anyfesolver.control import CancellationToken,SolveCancelled + from anyfesolver._stiffened_shell_displacement_checkpoint import decode_snapshot,encode_snapshot + from anyfesolver._stiffened_shell_displacement_control import publish from scripts.r8_f06_cyclic_material_dev import definition owner,loads,control,target,path,doc,write=inputs();out=Path(os.environ['F06_PAIRED_DISPLACEMENT_OUTPUT']);raw=(doc/'attempt-installed-history1/accepted.bin').read_bytes() try: diff --git a/tests/test_r8_f06_paired_loaded_x_dev.py b/tests/test_r8_f06_paired_loaded_x_dev.py index 660d391dd..0d3662184 100644 --- a/tests/test_r8_f06_paired_loaded_x_dev.py +++ b/tests/test_r8_f06_paired_loaded_x_dev.py @@ -22,7 +22,7 @@ def atomic(owner,before): def loaded_inputs(): from scripts.r8_f06_paired_loaded_x_dev import DOC,INPUT,INPUT_SHA,write from scripts.r8_f06_cyclic_material_dev import definition,actions - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss target=json.loads((DOC/'attempt-installed-witness1/witness.json').read_text())['target'] return ss.create_analysis(definition=definition('coupled')),actions('coupled'),ss.DisplacementControl('shell',2,0,force_seed_sha256=INPUT_SHA),target,INPUT,DOC,write @@ -46,9 +46,9 @@ def test_witness(): from scipy.sparse.linalg import spsolve from dataclasses import asdict from decimal import Decimal as D,localcontext - from anysolver import stiffened_shell as ss - from anysolver._stiffened_shell_beam_history import arrays - from anysolver.plasticity import plane_stress_elastic_matrix,_jit_flow_stress + from anyfesolver import stiffened_shell as ss + from anyfesolver._stiffened_shell_beam_history import arrays + from anyfesolver.plasticity import plane_stress_elastic_matrix,_jit_flow_stress from scripts.r8_f06_cyclic_material_dev import definition,actions from scripts.r8_f06_paired_loaded_x_dev import DOC,INPUT,INPUT_SHA,write,sha out=Path(os.environ['F06_LOADED_X_OUTPUT']);owner=ss.create_analysis(definition=definition('coupled'));before=None diff --git a/tests/test_r8_f06_paired_role_assessment_dev.py b/tests/test_r8_f06_paired_role_assessment_dev.py index b143cc42e..0f7dca2ce 100644 --- a/tests/test_r8_f06_paired_role_assessment_dev.py +++ b/tests/test_r8_f06_paired_role_assessment_dev.py @@ -160,7 +160,7 @@ def test_source_exact_artifact_delta_adoption_refuses_drift(): assert a.check_artifact_delta([row],decision) with pytest.raises(ValueError,match='drift'):a.check_artifact_delta([{**row,'new_sha256':'c'*64}],decision) with pytest.raises(ValueError,match='adoption'):a.check_artifact_delta([row],{**decision,'status':'PROPOSED'}) - altered={**row,'path':'src/anysolver/_ge_beam3_fibre_cell.py'} + altered={**row,'path':'src/anyfesolver/_ge_beam3_fibre_cell.py'} with pytest.raises(ValueError,match='B2'):a.check_artifact_delta([altered],{**decision,'current_source_deltas':[altered]}) diff --git a/tests/test_r8_f06_pending_direction_dev.py b/tests/test_r8_f06_pending_direction_dev.py index 0b2c9063f..3c51cadbf 100644 --- a/tests/test_r8_f06_pending_direction_dev.py +++ b/tests/test_r8_f06_pending_direction_dev.py @@ -10,10 +10,10 @@ def test_same_parent_directions(): from dataclasses import asdict from scripts.r8_f06_pending_direction_dev import INPUT,HISTORY,PACKAGE,write,runtime from scripts.r8_f06_adaptive_material_dev import cyclic,programme - from anysolver import stiffened_shell as ss - from anysolver.control import CancellationToken,SolveCancelled - from anysolver._stiffened_shell_increment_control import AdaptiveIncrementControl - from anysolver._stiffened_shell_beam_history import arrays as history_arrays + from anyfesolver import stiffened_shell as ss + from anyfesolver.control import CancellationToken,SolveCancelled + from anyfesolver._stiffened_shell_increment_control import AdaptiveIncrementControl + from anyfesolver._stiffened_shell_beam_history import arrays as history_arrays out=Path(os.environ['F06_PENDING_DIRECTION_OUTPUT']);owner=ss.create_analysis(definition=cyclic.definition('bend-z')) fields=('q','q_low','frames','frames_low','cells','cells_low','resultants','resultants_low','multipliers','shell_anchors') try: diff --git a/tests/test_r8_f06_pending_resume_dev.py b/tests/test_r8_f06_pending_resume_dev.py index df7eda1d9..ffa45afd4 100644 --- a/tests/test_r8_f06_pending_resume_dev.py +++ b/tests/test_r8_f06_pending_resume_dev.py @@ -9,11 +9,11 @@ def test_installed_partial_restore(): from dataclasses import replace,asdict from scripts.r8_f06_pending_resume_dev import DOC,PACKAGE,write,runtime from scripts.r8_f06_adaptive_material_dev import cyclic - from anysolver import stiffened_shell as ss - from anysolver._stiffened_shell_beam_history import arrays as history_arrays - from anysolver._stiffened_shell_staged_load_experimental import decode_checkpoint,encode_checkpoint - from anysolver._stiffened_shell_ge_checkpoint_binary import decode_compensated,encode_compensated - from anysolver._stiffened_shell_increment_control import decode_control,encode_control + from anyfesolver import stiffened_shell as ss + from anyfesolver._stiffened_shell_beam_history import arrays as history_arrays + from anyfesolver._stiffened_shell_staged_load_experimental import decode_checkpoint,encode_checkpoint + from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode_compensated,encode_compensated + from anyfesolver._stiffened_shell_increment_control import decode_control,encode_control out=Path(os.environ['F06_PENDING_OUTPUT']);owner=ss.create_analysis(definition=cyclic.definition('bend-z')) try: raw=(DOC/'partial-accepted-2_3125.bin').read_bytes();owner.restore(raw);d=owner._finite_driver @@ -58,11 +58,11 @@ def test_installed_material_pending_resume(): from dataclasses import asdict from scripts.r8_f06_pending_resume_dev import INPUT,ORACLE,write,sha from scripts.r8_f06_adaptive_material_dev import cyclic,programme,persist_accepted,paired_value - from anysolver import stiffened_shell as ss - from anysolver.control import CancellationToken,SolveCancelled - from anysolver._stiffened_shell_increment_control import AdaptiveIncrementControl,FiniteIncrementFailure - from anysolver._stiffened_shell_beam_history import arrays as history_arrays - from anysolver._ge_beam3_p5_seeded.core import canonical + from anyfesolver import stiffened_shell as ss + from anyfesolver.control import CancellationToken,SolveCancelled + from anyfesolver._stiffened_shell_increment_control import AdaptiveIncrementControl,FiniteIncrementFailure + from anyfesolver._stiffened_shell_beam_history import arrays as history_arrays + from anyfesolver._ge_beam3_p5_seeded.core import canonical out=Path(os.environ['F06_PENDING_OUTPUT']);owner=ss.create_analysis(definition=cyclic.definition('bend-z')) try: raw=INPUT.read_bytes();owner.restore(raw);d=owner._finite_driver;load=programme(owner) diff --git a/tests/test_r8_f06_reversal_dev.py b/tests/test_r8_f06_reversal_dev.py index e892b013e..9adc1767c 100644 --- a/tests/test_r8_f06_reversal_dev.py +++ b/tests/test_r8_f06_reversal_dev.py @@ -8,8 +8,8 @@ def test_paired_event_witness_and_actual_update(): from dataclasses import replace from decimal import Decimal as D,localcontext from pathlib import Path - from anysolver import stiffened_shell as ss - from anysolver._ge_beam3_fibre_cell import PairedFibreTrialState + from anyfesolver import stiffened_shell as ss + from anyfesolver._ge_beam3_fibre_cell import PairedFibreTrialState from scripts import r8_f06_cyclic_material_dev as cyclic from scripts.r8_f06_log_domain_check_dev import write doc=cyclic.DOC.parent/'reversal-v1' diff --git a/tests/test_r8_f13_dependency_repair_dev.py b/tests/test_r8_f13_dependency_repair_dev.py index 547273f44..600deffd2 100644 --- a/tests/test_r8_f13_dependency_repair_dev.py +++ b/tests/test_r8_f13_dependency_repair_dev.py @@ -6,8 +6,8 @@ import numpy as np import pytest from scipy import sparse -from anysolver import stiffened_shell as api -from anysolver._stiffened_shell_b2_q4_panel_experimental import ExperimentalB2Q4PanelAnalysis +from anyfesolver import stiffened_shell as api +from anyfesolver._stiffened_shell_b2_q4_panel_experimental import ExperimentalB2Q4PanelAnalysis from scripts import r8_f13_static_feasibility as frozen ROOT = Path(__file__).resolve().parents[1] diff --git a/tests/test_r8_ge_merit_history_entrypoint_dev.py b/tests/test_r8_ge_merit_history_entrypoint_dev.py index f6529dca0..7a2eba9cf 100644 --- a/tests/test_r8_ge_merit_history_entrypoint_dev.py +++ b/tests/test_r8_ge_merit_history_entrypoint_dev.py @@ -22,8 +22,8 @@ def test_source_history_entrypoint_guard_refusal(tmp_path,monkeypatch): runner.installed_history(tmp_path) def test_source_history_control_injection_seam(tmp_path,monkeypatch): - from anysolver import stiffened_shell as ss - from anysolver._stiffened_shell_displacement_corrector import PAIRED_FIXED_WORK_QUADRATIC_V1 + from anyfesolver import stiffened_shell as ss + from anyfesolver._stiffened_shell_displacement_corrector import PAIRED_FIXED_WORK_QUADRATIC_V1 from scripts import r8_ge_merit_interpolation_execution_dev as runner from scripts import r8_ge_paired_adaptive_dev as adaptive from scripts.r8_ge_coupled_cycle_dev import IDENTITIES,SEED diff --git a/tests/test_r8_ge_merit_interpolation_candidate_dev.py b/tests/test_r8_ge_merit_interpolation_candidate_dev.py index 6d836dff7..fc55feb8a 100644 --- a/tests/test_r8_ge_merit_interpolation_candidate_dev.py +++ b/tests/test_r8_ge_merit_interpolation_candidate_dev.py @@ -6,12 +6,12 @@ import numpy as np import pytest from scipy.sparse import eye,diags -from anysolver import _stiffened_shell_displacement_corrector as corrector -from anysolver import _stiffened_shell_displacement_control as fixed -from anysolver import _stiffened_shell_displacement_adaptive as adaptive -from anysolver import _stiffened_shell_affine_endpoint as endpoint -from anysolver import stiffened_shell as ss -from anysolver._stiffened_shell_ge_checkpoint_binary import COMPENSATED_MAGIC +from anyfesolver import _stiffened_shell_displacement_corrector as corrector +from anyfesolver import _stiffened_shell_displacement_control as fixed +from anyfesolver import _stiffened_shell_displacement_adaptive as adaptive +from anyfesolver import _stiffened_shell_affine_endpoint as endpoint +from anyfesolver import stiffened_shell as ss +from anyfesolver._stiffened_shell_ge_checkpoint_binary import COMPENSATED_MAGIC POLICY='PAIRED_FIXED_WORK_QUADRATIC_V1' SEED=COMPENSATED_MAGIC+b'injected original seed' @@ -72,7 +72,7 @@ def test_source_corrector_actual_acceptance_full_first_and_default(monkeypatch): assert caught.value.detail.evaluations==10 def test_source_domain_fallback_and_exception_propagation(monkeypatch): - from anysolver._stiffened_shell_ge_finite_experimental import _RotationStepTooLarge + from anyfesolver._stiffened_shell_ge_finite_experimental import _RotationStepTooLarge owner,driver,amounts=fixture(monkeypatch);original=driver._advance def domain(s,d,t): if t==1.: @@ -89,7 +89,7 @@ def broken(*a,error=error):raise error assert owner._generation==9 and not amounts def test_source_cancellation_and_stale_corrector(monkeypatch): - from anysolver.control import CancellationToken,SolveCancelled + from anyfesolver.control import CancellationToken,SolveCancelled owner,driver,amounts=fixture(monkeypatch) token=CancellationToken();token.cancel('prepared cancellation') with pytest.raises(SolveCancelled):run(driver,POLICY,cancellation_token=token) @@ -121,8 +121,8 @@ def entered(*a,**k):calls.append(k);raise Reached() legacy=replace(control,merit_globalization=None) with pytest.raises(Reached):fixed.solve(owner,(),(-1.,),legacy,max_iterations=20,max_backtracks=8) assert 'merit_globalization' not in calls[-1] - from anysolver._stiffened_shell_ge_experimental import ExperimentalGEAnalysis - from anysolver._stiffened_shell_f06_increment_arithmetic import POLICY as ARITHMETIC + from anyfesolver._stiffened_shell_ge_experimental import ExperimentalGEAnalysis + from anyfesolver._stiffened_shell_f06_increment_arithmetic import POLICY as ARITHMETIC owner._beam_parts=((NS(operator=NS(arithmetic_policy=ARITHMETIC)),None,None),) owner._require_open=lambda:None;owner._require_stateful_scope=lambda:None owner._require_distributing_reference_only=lambda *a:None @@ -164,7 +164,7 @@ def test_source_pending_restart_policy_refusal(monkeypatch): assert owner._displacement_adaptive is before and owner._generation==9 and not amounts def test_source_public_restore_selected_dispatch(monkeypatch): - from anysolver._stiffened_shell_ge_experimental import ExperimentalGEAnalysis + from anyfesolver._stiffened_shell_ge_experimental import ExperimentalGEAnalysis owner,driver,amounts=fixture(monkeypatch) owner._require_open=lambda:None;owner._require_stateful_scope=lambda:None;owner._unsupported_modes=() raw=adaptive.encode(owner._identity,context(owner,POLICY),SEED,paired=True) @@ -175,7 +175,7 @@ def test_source_public_restore_selected_dispatch(monkeypatch): assert calls[0][0]==(owner,raw) and owner._finite_driver is None monkeypatch.undo() owner,driver,amounts=fixture(monkeypatch) - from anysolver.control import CancellationToken,SolveCancelled + from anyfesolver.control import CancellationToken,SolveCancelled from dataclasses import dataclass @dataclass(frozen=True) class Result: diff --git a/tests/test_r8_ge_paired_adaptive_dev.py b/tests/test_r8_ge_paired_adaptive_dev.py index fa6e5f3d7..579491ca8 100644 --- a/tests/test_r8_ge_paired_adaptive_dev.py +++ b/tests/test_r8_ge_paired_adaptive_dev.py @@ -5,11 +5,11 @@ from types import SimpleNamespace as NS import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver import _stiffened_shell_displacement_adaptive as adaptive -from anysolver import _stiffened_shell_affine_endpoint as endpoint -from anysolver import _stiffened_shell_displacement_control as fixed -from anysolver._stiffened_shell_ge_checkpoint_binary import COMPENSATED_MAGIC +from anyfesolver import stiffened_shell as ss +from anyfesolver import _stiffened_shell_displacement_adaptive as adaptive +from anyfesolver import _stiffened_shell_affine_endpoint as endpoint +from anyfesolver import _stiffened_shell_displacement_control as fixed +from anyfesolver._stiffened_shell_ge_checkpoint_binary import COMPENSATED_MAGIC SEED=COMPENSATED_MAGIC+b'injected original seed' DIGEST=sha256(SEED).hexdigest() @@ -63,7 +63,7 @@ def test_source_paired_identity_and_legacy_header(owner,monkeypatch): # Golden bytes come from the immutable original wheel's encode function, # rather than reconstructing expected bytes with this candidate's encoder. from scripts.r8_ge_paired_adaptive_dev import BASE_DOC as DOC - from anysolver._stiffened_shell_ge_checkpoint_binary import MAGIC as FORCE_MAGIC + from anyfesolver._stiffened_shell_ge_checkpoint_binary import MAGIC as FORCE_MAGIC inner=FORCE_MAGIC+b'golden-inner-framing-only' digests={'legacy':'e02fa7e466ff996f259b0aa4dd818b1302fb912f822f31e1f6dc2677bca5f20e', 'native':'4eb46e0f4ef4005c02a4933606e468341cf3e486aa2e90d3bcd521371775e374', @@ -119,7 +119,7 @@ def test_source_typed_cutback_and_durable_limit(owner,monkeypatch): assert owner.recover().status=='accepted_prefix' def test_source_cancellation_and_untyped_failures_not_cutback(owner,monkeypatch): - from anysolver.control import CancellationToken,SolveCancelled + from anyfesolver.control import CancellationToken,SolveCancelled token=CancellationToken();token.cancel('injected cancellation') for failure in (ValueError('admission'),reject(owner).__class__('missing detail')): def fail(*a,**k):raise failure @@ -149,7 +149,7 @@ def restore(self,inner): source=FakeOwner();self._finite_driver=source._finite_driver return source.recover() monkeypatch.setattr(FakeOwner,'restore',restore,raising=False) - from anysolver.control import CancellationToken,SolveCancelled + from anyfesolver.control import CancellationToken,SolveCancelled token=CancellationToken();token.cancel('before restore') with pytest.raises(SolveCancelled):adaptive.restore_paired(owner,raw,cancellation_token=token) assert owner._finite_driver is None and owner._generation==9 @@ -172,7 +172,7 @@ def raise_if_cancelled(self,stage=''): assert result.status=='accepted_prefix' and owner.checkpoint()==raw def test_source_public_restore_dispatch_before_legacy(owner,monkeypatch): - from anysolver._stiffened_shell_ge_experimental import ExperimentalGEAnalysis + from anyfesolver._stiffened_shell_ge_experimental import ExperimentalGEAnalysis owner._finite_driver=None;owner._unsupported_modes=() owner._require_open=lambda:None;owner._require_stateful_scope=lambda:None raw=adaptive.encode(owner._identity,context(FakeOwner()),SEED,paired=True) @@ -192,7 +192,7 @@ def restore(self,inner): patch.setattr(endpoint,'is_paired_displacement',lambda o:False) with pytest.raises(ValueError):ExperimentalGEAnalysis.restore.__wrapped__(owner,raw) assert owner._finite_driver is None and owner._displacement_adaptive is None - from anysolver.control import CancellationToken + from anyfesolver.control import CancellationToken with pytest.raises(ValueError,match='cancellation'): ExperimentalGEAnalysis.restore.__wrapped__(owner,b'legacy unsupported',cancellation_token=CancellationToken()) assert owner._finite_driver is None and owner._displacement_adaptive is None @@ -200,8 +200,8 @@ def restore(self,inner): assert owner.checkpoint()==raw def test_source_public_solve_adaptive_dispatch(owner,monkeypatch): - from anysolver._stiffened_shell_ge_experimental import ExperimentalGEAnalysis - from anysolver._stiffened_shell_f06_increment_arithmetic import POLICY + from anyfesolver._stiffened_shell_ge_experimental import ExperimentalGEAnalysis + from anyfesolver._stiffened_shell_f06_increment_arithmetic import POLICY owner._beam_parts=((NS(operator=NS(arithmetic_policy=POLICY)),None,None),) for name in ('_require_open','_require_stateful_scope'):setattr(owner,name,lambda:None) owner._require_distributing_reference_only=lambda *a:None diff --git a/tests/test_r8_ge_paired_fixed_diagnostic_dev.py b/tests/test_r8_ge_paired_fixed_diagnostic_dev.py index 52daedcde..f0ac2acf5 100644 --- a/tests/test_r8_ge_paired_fixed_diagnostic_dev.py +++ b/tests/test_r8_ge_paired_fixed_diagnostic_dev.py @@ -23,7 +23,7 @@ def test_source_inner_selection_and_corruption(): def test_source_outer_cannot_be_fixed_entry(): with pytest.raises(ValueError,match='pending adaptive'):d.require_fixed_entry(d.OUTER.read_bytes()) h,_=d.require_fixed_entry(d.INNER.read_bytes());assert h['control_dof']==6 and h['seed_sha256']==d.SEED - body=(d.ROOT/'src/anysolver/_stiffened_shell_displacement_control.py').read_text() + body=(d.ROOT/'src/anyfesolver/_stiffened_shell_displacement_control.py').read_text() assert 'pending adaptive displacement controls must match' in body @SOURCE diff --git a/tests/test_r8_ge_saved_merit_remainder_dev.py b/tests/test_r8_ge_saved_merit_remainder_dev.py index 9601d5d10..502aa4148 100644 --- a/tests/test_r8_ge_saved_merit_remainder_dev.py +++ b/tests/test_r8_ge_saved_merit_remainder_dev.py @@ -36,5 +36,5 @@ def test_source_inventory_no_mechanics(): assert len(d.SOURCE_NAMES)==4 and set(d.SOURCE_NAMES)==functions forbidden={'spsolve','solve','inv','pinv','evaluate','correct','_assemble','_advance','rotation','restore_ge_checkpoint_binary','solve_ge_displacement'} assert not any(isinstance(n,ast.Call) and isinstance(n.func,ast.Attribute) and n.func.attr in forbidden for n in ast.walk(tree)) - assert not any(isinstance(n,(ast.Import,ast.ImportFrom)) and any(part in ast.unparse(n) for part in ('numpy','scipy','anysolver')) for n in ast.walk(tree)) + assert not any(isinstance(n,(ast.Import,ast.ImportFrom)) and any(part in ast.unparse(n) for part in ('numpy','scipy','anyfesolver')) for n in ast.walk(tree)) assert 'endpoint_tangent_trapezoid_remainder' in source and 'one finite pair/trapezoid cannot prove' in source diff --git a/tests/test_recovery_batches.py b/tests/test_recovery_batches.py index 55bfe22b1..94a277e1a 100644 --- a/tests/test_recovery_batches.py +++ b/tests/test_recovery_batches.py @@ -3,8 +3,8 @@ import numpy as np import pytest -from anysolver import RecoveryConfig, ResourceConfig, generate_simple_panel_mesh -from anysolver.recovery import ( +from anyfesolver import RecoveryConfig, ResourceConfig, generate_simple_panel_mesh +from anyfesolver.recovery import ( _compute_one_element_stress, recover_element_stresses_with_report, ) @@ -42,7 +42,7 @@ def test_chunked_scalar_recovery_preserves_order_and_exact_values( recovery = RecoveryConfig( components=["von_mises"], ) - monkeypatch.setattr("anysolver.recovery.JIT_ENABLED", False) + monkeypatch.setattr("anyfesolver.recovery.JIT_ENABLED", False) serial, serial_report = recover_element_stresses_with_report( model, diff --git a/tests/test_recovery_qualification.py b/tests/test_recovery_qualification.py index d0b17b3a4..c4b4945e6 100644 --- a/tests/test_recovery_qualification.py +++ b/tests/test_recovery_qualification.py @@ -7,7 +7,7 @@ import numpy as np import pytest -from anysolver import ( +from anyfesolver import ( FEModel, LegacyQ4DeprecationWarning, LegacyShellElement, @@ -18,7 +18,7 @@ recover_shell_patch_stresses, recover_stress_result, ) -from anysolver.corotational import rotation_matrix_from_vector +from anyfesolver.corotational import rotation_matrix_from_vector _SURFACE_COMPONENTS = ("xx", "yy", "zz", "xy", "yz", "xz") diff --git a/tests/test_recovery_shell_frames.py b/tests/test_recovery_shell_frames.py index 9b3e0a823..b0c49371f 100644 --- a/tests/test_recovery_shell_frames.py +++ b/tests/test_recovery_shell_frames.py @@ -1,8 +1,8 @@ from types import MethodType import numpy as np import pytest -from anysolver import FEModel,Material,ShellElement,RecoveryConfig,recover_stress_result -from anysolver.recovery_shell_frames import native_recovery_frames +from anyfesolver import FEModel,Material,ShellElement,RecoveryConfig,recover_stress_result +from anyfesolver.recovery_shell_frames import native_recovery_frames def model8(warp=False): @@ -26,7 +26,7 @@ def same(actual,expected): @pytest.mark.parametrize('warp',[False,True]) @pytest.mark.parametrize('global_output',[False,True]) def test_q8_recovery_complete_scalar_oracle_and_mutations(monkeypatch,warp,global_output): - import anysolver.recovery_shell_frames as frames + import anyfesolver.recovery_shell_frames as frames model,element,u=model8(warp) batch=frames.native_recovery_frames for change in ('initial','material','node','displacement','thickness'): diff --git a/tests/test_reference_oblique_q4_plateau.py b/tests/test_reference_oblique_q4_plateau.py index 83acbc204..89a483e83 100644 --- a/tests/test_reference_oblique_q4_plateau.py +++ b/tests/test_reference_oblique_q4_plateau.py @@ -25,7 +25,7 @@ def test_reference_source_has_no_solver_material_or_builder_imports(): modules = [node.module for node in ast.walk(tree) if isinstance(node, ast.ImportFrom)] modules += [alias.name for node in ast.walk(tree) if isinstance(node, ast.Import) for alias in node.names] - assert all(not name.startswith(('anysolver', 'anymaterial', 'tests', 'examples')) for name in modules) + assert all(not name.startswith(('anyfesolver', 'anymaterial', 'tests', 'examples')) for name in modules) @pytest.mark.parametrize('method', ['exponential', 'dop853']) diff --git a/tests/test_relative_reference_svd.py b/tests/test_relative_reference_svd.py index 649e1ab81..8cfe69c93 100644 --- a/tests/test_relative_reference_svd.py +++ b/tests/test_relative_reference_svd.py @@ -5,8 +5,8 @@ import numpy as np import pytest -import anysolver._relative_reference_svd as driver -from anysolver._native_relative_reference_factor_spectrum import solve_relative_reference_factor_spectrum +import anyfesolver._relative_reference_svd as driver +from anyfesolver._native_relative_reference_factor_spectrum import solve_relative_reference_factor_spectrum @pytest.mark.parametrize('amplitude', [1., 1e8, 1e16]) diff --git a/tests/test_release_046_bounded.py b/tests/test_release_046_bounded.py index e93aa01b3..7c80fdee1 100644 --- a/tests/test_release_046_bounded.py +++ b/tests/test_release_046_bounded.py @@ -8,8 +8,8 @@ import pytest -from anysolver import b3_ge -from anysolver.elements import QuadraticBeamElement, create_element +from anyfesolver import b3_ge +from anyfesolver.elements import QuadraticBeamElement, create_element from scripts import verify_release_046 as gate @@ -35,7 +35,8 @@ def test_release_archive_contains_only_current_user_documents() -> None: if line.startswith("include docs/") } assert included_docs == gate.RELEASE_DOCS | { - "docs/releases/ANYsolver_0.4.7.md", "docs/NATIVE_SOURCE_AUTHORITY.md" + "docs/releases/ANYsolver_0.4.7.md", "docs/releases/ANYfeSolver_0.5.0.md", + "docs/NATIVE_SOURCE_AUTHORITY.md" } assert { "prune docs", diff --git a/tests/test_result_capsule_export.py b/tests/test_result_capsule_export.py index 4af077cff..a05d6487b 100644 --- a/tests/test_result_capsule_export.py +++ b/tests/test_result_capsule_export.py @@ -2,17 +2,17 @@ import numpy as np import pytest -from anysolver import (FixedSupport, PatternCase, RecoveryConfig, RecoveryCapsuleError, +from anyfesolver import (FixedSupport, PatternCase, RecoveryConfig, RecoveryCapsuleError, export_recovery_capsule, prepare_static_evaluator, prepare_static_response_evaluator) -from anysolver_results import derive_field, reconstruct_response, validate_capsule +from anyfesolver_results import derive_field, reconstruct_response, validate_capsule from test_prepared_static_evaluator import _bar, _case, _shell_case, _shell_model @pytest.mark.parametrize('callback_fails', [False, True]) def test_source_export_failure_reports_original_diagnostics_and_never_ends(callback_fails): import json - from anysolver import export_recovery_capsule_to_sink, PreparedStaticError + from anyfesolver import export_recovery_capsule_to_sink, PreparedStaticError cases = [PatternCase('a', {'p': 1.}), PatternCase('b', {'missing': 2.})] class Sink: def __init__(self): @@ -47,8 +47,8 @@ def capsule_failed(self, record): def test_failure_diagnostics_keep_nonfinite_values_as_explicit_json_tags(): import json - from anysolver import PreparedStaticError - from anysolver.result_capsule import _report_export_failure + from anyfesolver import PreparedStaticError + from anyfesolver.result_capsule import _report_export_failure errors = [] class Sink: def capsule_failed(self, record): errors.append(record) @@ -106,7 +106,7 @@ def test_public_capsule_is_an_immutable_owned_snapshot(): def test_failed_record_keeps_source_diagnostics_without_certifying_fields(): - from anysolver.result_capsule import _CapsuleExport + from anyfesolver.result_capsule import _CapsuleExport cases = [PatternCase('failed-case', {'p': 1.0})] failed = { 'status': 'failed', @@ -415,7 +415,7 @@ def test_source_envelope_ties_keep_exact_earliest_input_index(): capsule's ``tie_policy`` descriptor label and per-case ``input_index`` refer to exactly this contract. """ - from anysolver.static_envelopes import EnvelopeReducer + from anyfesolver.static_envelopes import EnvelopeReducer reducer = EnvelopeReducer() for index in (3, 1, 2, 0): # reversed traversal order reducer.update({'v': -5.0}, case_id=f'c{index}', input_index=index) @@ -433,7 +433,7 @@ def test_source_envelope_ties_keep_exact_earliest_input_index(): # The prepared canonical accumulator keeps the same policy across tile # folding and reduced-subset merging, in either traversal order. from types import SimpleNamespace - from anysolver.prepared_static_envelopes import EnvelopeAccumulator + from anyfesolver.prepared_static_envelopes import EnvelopeAccumulator def accumulator(): recipe = SimpleNamespace(staged_kernel=None, staged_fallback_reason='tie-test') @@ -479,8 +479,8 @@ def _rotated_shell_model(): def rotated(x, y, z): return (x, y * cos - z * sin, y * sin + z * cos) - from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement - from anysolver.fe_core import FEModel + from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement + from anyfesolver.fe_core import FEModel model = FEModel('prepared-static-shell-rotated') model.add_material('steel', 210.0e9, 0.3, density=100.0) coordinates = {1: rotated(0.0, 0.0, 0.0), 2: rotated(1.0, 0.0, 0.0), @@ -639,7 +639,7 @@ def test_geometry_and_solver_identity_passthrough(): capsule = export_recovery_capsule(evaluator, [PatternCase('a', {'p': 1.0})], model_identity='m', mesh_identity='x', geometry={'positions': positions}, - solver_identity={'solver': 'ANYsolver', 'build': 'test'}) + solver_identity={'solver': 'ANYfeSolver', 'build': 'test'}) np.testing.assert_array_equal(capsule['geometry']['positions'], positions) assert capsule['solver_identity']['build'] == 'test' assert capsule['solver_identity']['stress_execution'] == 'canonical' diff --git a/tests/test_result_capsule_metadata.py b/tests/test_result_capsule_metadata.py index d2c8d1e3f..658eb2d92 100644 --- a/tests/test_result_capsule_metadata.py +++ b/tests/test_result_capsule_metadata.py @@ -4,12 +4,12 @@ import numpy as np import pytest -from anysolver import (BoundaryCondition, FixedSupport, LoadCase, PatternCase, +from anyfesolver import (BoundaryCondition, FixedSupport, LoadCase, PatternCase, RecoveryConfig, export_recovery_capsule, export_recovery_capsule_to_sink, prepare_static_response_evaluator) -from anysolver.elements import QuadraticBeamElement -from anysolver.fe_core import FEModel -from anysolver_results import CapsuleValidationError, validate_capsule +from anyfesolver.elements import QuadraticBeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver_results import CapsuleValidationError, validate_capsule from test_prepared_static_evaluator import _bar, _case, _shell_case, _shell_model from test_result_capsule_export import _rotated_shell_model @@ -34,7 +34,7 @@ def test_rotated_s3_local_frame_orthonormal_and_source_exact(): capsule = export_recovery_capsule(evaluator, [PatternCase('a', {'p': 1.25})], model_identity='rotated-shell', mesh_identity='rotated-shell-mesh') - from anysolver.e4_pl_s3_element import triangle_frame + from anyfesolver.e4_pl_s3_element import triangle_frame expected = {} for element_id in (1, 2): element, mesh, _material = _owner_of(evaluator, element_id) @@ -96,7 +96,7 @@ def test_beam2_frame_and_explicit_section_scalar_rule(): capsule = export_recovery_capsule(evaluator, cases, model_identity='bar', mesh_identity='bar-mesh') element, mesh, _material = _owner_of(evaluator, 1) - from anysolver.elements import _beam_rotation_matrix + from anyfesolver.elements import _beam_rotation_matrix coordinates = np.asarray(element.get_node_coordinates(mesh), dtype=np.float64) axis = coordinates[1] - coordinates[0] expected = _beam_rotation_matrix(axis / np.linalg.norm(axis), element._orientation) @@ -172,8 +172,8 @@ def test_quadratic_beam_local_frame_is_end_chord_source_exact(): def test_beam_sampling_rules_match_native_recovery_field_shapes(): - from anysolver.beam_sections import GeneralizedBeamSection - from anysolver.elements import BeamElement + from anyfesolver.beam_sections import GeneralizedBeamSection + from anyfesolver.elements import BeamElement from test_generalized_beam_sections import _stiffness configurations = [ diff --git a/tests/test_result_capsule_numeric.py b/tests/test_result_capsule_numeric.py index 887696812..591bb2fe2 100644 --- a/tests/test_result_capsule_numeric.py +++ b/tests/test_result_capsule_numeric.py @@ -4,20 +4,20 @@ import numpy as np import pytest -from anysolver import (PatternCase, RecoveryConfig, FixedSupport, BoundaryCondition, +from anyfesolver import (PatternCase, RecoveryConfig, FixedSupport, BoundaryCondition, prepare_static_response_evaluator, export_recovery_capsule, export_recovery_capsule_to_sink) -from anysolver.prepared_static_numeric import NumericCase, float_bits_equal +from anyfesolver.prepared_static_numeric import NumericCase, float_bits_equal from test_prepared_static_evaluator import _bar, _case, _shell_case from test_result_capsule_export import _rotated_shell_model from test_generalized_beam_sections import _model, _stiffness -from anysolver.beam_sections import GeneralizedBeamSection -from anysolver.elements import QuadraticBeamElement +from anyfesolver.beam_sections import GeneralizedBeamSection +from anyfesolver.elements import QuadraticBeamElement @pytest.mark.parametrize('indices',[[],[1,3],[3,1],[1,2,3]]) def test_source_vector_publication_calls_original_complete_oracle_once_per_element(indices): - from anysolver.prepared_static_numeric import source_vectors - from anysolver.prepared_static_response import PreparedStaticResponseEvaluator,_PatternPacket + from anyfesolver.prepared_static_numeric import source_vectors + from anyfesolver.prepared_static_response import PreparedStaticResponseEvaluator,_PatternPacket random=np.random.default_rng(916) matrices=[np.asfortranarray(random.uniform(-1e100,1e100,(7,4))) for _ in range(3)] packet=_PatternPacket(np.asarray(indices,dtype=np.intp),np.array([.125,-3.,2.][:len(indices)]),None) @@ -96,8 +96,8 @@ def test_numeric_float_admission_includes_signed_zero(): def test_numeric_source_authority_and_interrupted_sink(monkeypatch): - from anysolver import PreparedStaticCapabilityError - from anysolver import prepared_static_numeric as numeric + from anyfesolver import PreparedStaticCapabilityError + from anyfesolver import prepared_static_numeric as numeric cases=[PatternCase('a',{'p':1.})] with prepare_static_response_evaluator(_bar(),{'p':_case(1).load_case},recovery_config=RecoveryConfig(include_stresses=True),stress_execution='certified_library') as evaluator: with monkeypatch.context() as patch: @@ -120,7 +120,7 @@ def capsule_failed(self,payload): self.failures.append(payload) def test_numeric_cancellation_and_live_model_mutation_keep_owned_state(): - from anysolver import CancellationToken, SolveCancelled + from anyfesolver import CancellationToken, SolveCancelled model = _bar() cases = [PatternCase('a',{'p':1.}),PatternCase('b',{'p':2.})] with prepare_static_response_evaluator(model,{'p':_case(1).load_case},recovery_config=RecoveryConfig(include_stresses=True),stress_execution='certified_library') as evaluator: @@ -137,8 +137,8 @@ def test_numeric_cancellation_and_live_model_mutation_keep_owned_state(): def test_numeric_extra_workspace_refuses_under_source_resource_policy(): - from anysolver import ResourceConfig - from anysolver.recovery import ResourcePolicyError + from anyfesolver import ResourceConfig + from anyfesolver.recovery import ResourcePolicyError cases=[PatternCase('a',{'p':1.})] with prepare_static_response_evaluator(_bar(),{'p':_case(1).load_case},recovery_config=RecoveryConfig(include_stresses=True,include_reactions=False),stress_execution='certified_library') as evaluator: estimate=next(evaluator.iter_batches(cases,batch_size=1)).diagnostics['estimated_block_bytes'] @@ -165,15 +165,15 @@ def test_numeric_extra_workspace_refuses_under_source_resource_policy(): @pytest.mark.parametrize('coefficient',[float('nan'),float('inf')]) def test_numeric_nonfinite_input_refuses_without_success(coefficient): - from anysolver import PreparedStaticError + from anyfesolver import PreparedStaticError with prepare_static_response_evaluator(_bar(),{'p':_case(1).load_case},recovery_config=RecoveryConfig(include_stresses=True),stress_execution='certified_library') as evaluator: with pytest.raises(PreparedStaticError,match='finite'): export_recovery_capsule(evaluator,[PatternCase('bad',{'p':coefficient})],model_identity='m',mesh_identity='x') def test_numeric_tile_caller_observation_outside_owned_scope(monkeypatch): - from anysolver.prepared_static_recovery import _OWNED_RECOVERY_SCOPE - from anysolver import PreparedStaticCapabilityError, prepared_static_numeric as numeric + from anyfesolver.prepared_static_recovery import _OWNED_RECOVERY_SCOPE + from anyfesolver import PreparedStaticCapabilityError, prepared_static_numeric as numeric class Token: observed = 0 def raise_if_cancelled(self,stage): diff --git a/tests/test_result_capsule_replay.py b/tests/test_result_capsule_replay.py index 389b26ef5..1ce0cb5b9 100644 --- a/tests/test_result_capsule_replay.py +++ b/tests/test_result_capsule_replay.py @@ -2,7 +2,7 @@ import copy import numpy as np import pytest -from anysolver_results import (reconstruct_response,prepare_response,reconstruct_prepared_response, +from anyfesolver_results import (reconstruct_response,prepare_response,reconstruct_prepared_response, validate_capsule,derive_field,ReconstructionError,CapsuleValidationError) ORDERED='ordered_float64/1' @@ -47,13 +47,17 @@ def test_legacy_public_defaults_and_ordered_signed_zero_overflow_refusals(): def test_confirmed_f2_input_ordered_tiles_and_prepared_exact_bits(): - # Recreate the frozen synthetic input, checking its published byte identity. - # This is an arithmetic discriminator, not a physical solver certificate. + # NumPy's lognormal exponential varies by platform. Replay the original + # Windows F2 basis and the 20 weights drawn immediately afterward. import hashlib - rng=np.random.default_rng(72319) - basis=np.ascontiguousarray(rng.normal(size=(1307,21))*rng.lognormal(0,4,size=(1307,1))) + from pathlib import Path + with np.load(Path(__file__).parent/'data/confirmed_f2_replay.npz',allow_pickle=False) as fixture: + basis=fixture['basis'] + weights=fixture['weights'] + assert basis.shape==(1307,21) and weights.shape==(20,) + assert basis.dtype==weights.dtype==np.dtype('=4096*3 else 1) - assert not any(t.name.startswith('anysolver-principal') for t in threading.enumerate()) + assert not any(t.name.startswith('anyfesolver-principal') for t in threading.enumerate()) def test_public_derived_parallel_field_matches_original_tensor(): @@ -61,4 +61,4 @@ def test_parallel_refusals_preserve_original_validation(kind): else:value=value[:,:2,:2] with pytest.raises(ValueError) as reference:original(value) with pytest.raises(ValueError,match=str(reference.value)):principal_stresses(value,workers=2) - assert not any(t.name.startswith('anysolver-principal') for t in threading.enumerate()) + assert not any(t.name.startswith('anyfesolver-principal') for t in threading.enumerate()) diff --git a/tests/test_results_principal_axes.py b/tests/test_results_principal_axes.py index fdfe84c2a..5a0881d29 100644 --- a/tests/test_results_principal_axes.py +++ b/tests/test_results_principal_axes.py @@ -2,8 +2,8 @@ import threading import numpy as np import pytest -from anysolver_results.formulas import principal_stresses -from anysolver_results.principals import principal_axes +from anyfesolver_results.formulas import principal_stresses +from anyfesolver_results.principals import principal_axes def test_rotated_axes_preserve_canonical_values_residuals_and_input(): @@ -64,7 +64,7 @@ def test_noncontiguous_input_and_broadcast_basis_are_not_modified(): def test_cancellation_before_admission_and_between_blocks(monkeypatch): - import anysolver_results.principals as module + import anyfesolver_results.principals as module event=threading.Event();event.set() with pytest.raises(InterruptedError):principal_axes(np.eye(3),cancel_event=event) class BetweenBlocks: @@ -83,7 +83,7 @@ def counted(value): @pytest.mark.parametrize('huge', [False,True]) def test_working_cap_precedes_conversion_even_for_huge_virtual_shape(monkeypatch,huge): - import anysolver_results.principals as module + import anyfesolver_results.principals as module calls=[] class HugeVirtualArray(np.ndarray): @property @@ -111,7 +111,7 @@ def shape(self):calls.append(True);return dimensions @pytest.mark.parametrize('dimensions', [(1,3,3),(2,3),(3,2),(3,3,1)]) def test_malformed_or_oversized_basis_refuses_before_conversion(monkeypatch,dimensions): - import anysolver_results.principals as module + import anyfesolver_results.principals as module calls=[] class VirtualBasis(np.ndarray): @property @@ -134,7 +134,7 @@ def shape(self):calls.append(True);raise AssertionError('shape override executed def test_invalid_actual_tensor_shape_refuses_before_conversion(monkeypatch): - import anysolver_results.principals as module + import anyfesolver_results.principals as module calls=[] class VirtualArray(np.ndarray): @property diff --git a/tests/test_results_principal_output.py b/tests/test_results_principal_output.py index 5c44f8f31..ad9c78af2 100644 --- a/tests/test_results_principal_output.py +++ b/tests/test_results_principal_output.py @@ -3,8 +3,8 @@ from threading import enumerate as threads import numpy as np import pytest -from anysolver_results import derive_field,DerivationError -from anysolver_results.formulas import principal_stresses,SHELL_LINEAR_COMPONENTS +from anyfesolver_results import derive_field,DerivationError +from anyfesolver_results.formulas import principal_stresses,SHELL_LINEAR_COMPONENTS @pytest.mark.parametrize('workers',[1,2]) @@ -15,7 +15,7 @@ def test_actual_extreme_finite_tensor_never_returns_nonfinite_eigenvalues(worker else:tensor[:,0,1]=tensor[:,1,0]=1e308 with np.errstate(over='ignore',invalid='ignore'),pytest.raises((ValueError,np.linalg.LinAlgError)): principal_stresses(tensor,workers=workers) - assert not any(t.name.startswith('anysolver-principal') for t in threads()) + assert not any(t.name.startswith('anyfesolver-principal') for t in threads()) @pytest.mark.parametrize('workers',[1,2]) @@ -23,7 +23,7 @@ def test_nonfinite_lapack_return_is_explicit_value_error_and_workers_join(monkey tensor=np.zeros((4096 if workers==2 else 1,3,3)) monkeypatch.setattr(np.linalg,'eigvalsh',lambda value:np.full(value.shape[:-1],np.nan)) with pytest.raises(ValueError,match='eigenvalues must be finite'):principal_stresses(tensor,workers=workers) - assert not any(t.name.startswith('anysolver-principal') for t in threads()) + assert not any(t.name.startswith('anyfesolver-principal') for t in threads()) @pytest.mark.parametrize('workers',[1,2]) @@ -47,4 +47,4 @@ def test_derived_and_reader_nonfinite_or_floating_error_is_chained(tmp_path,work assert isinstance(public.value.__cause__,DerivationError) assert isinstance(public.value.__cause__.__cause__,FloatingPointError if numpy_error=='raise' else (ValueError,np.linalg.LinAlgError)) assert public.value.case_id=='a' and public.value.component_key=='principal' - assert not any(t.name.startswith('anysolver-principal') for t in threads()) + assert not any(t.name.startswith('anyfesolver-principal') for t in threads()) diff --git a/tests/test_results_principal_validation.py b/tests/test_results_principal_validation.py index d94c0dbe3..2ef1117b8 100644 --- a/tests/test_results_principal_validation.py +++ b/tests/test_results_principal_validation.py @@ -3,8 +3,8 @@ from concurrent.futures import CancelledError import numpy as np import pytest -from anysolver_results import derive_field,DerivationError -from anysolver_results.formulas import principal_stresses +from anyfesolver_results import derive_field,DerivationError +from anyfesolver_results.formulas import principal_stresses def original(tensor): @@ -33,7 +33,7 @@ def test_exact_symmetric_signed_zero_shortcut_preserves_words_boundary_and_metad actual=principal_stresses(tensor,workers=2,execution=execution) np.testing.assert_array_equal(actual.view('u8'),expected.view('u8')) assert execution=={'workers':2 if count==4096 else 1,'tensors':count} - assert not any(t.name.startswith('anysolver-principal') for t in threads()) + assert not any(t.name.startswith('anyfesolver-principal') for t in threads()) @pytest.mark.parametrize('value',[np.inf,np.nan,-np.inf]) @@ -59,7 +59,7 @@ def eigen(tensor): with pytest.raises(DerivationError,match='principal') as error:derive_field(spec,inputs,workers=2,execution=execution) assert isinstance(error.value.__cause__,np.linalg.LinAlgError) and peer_finished.is_set() assert execution=={'workers':2,'tensors':4096} - assert not any(t.name.startswith('anysolver-principal') for t in threads()) + assert not any(t.name.startswith('anyfesolver-principal') for t in threads()) @pytest.mark.parametrize('workers',[1,2]) @@ -67,12 +67,12 @@ def test_finite_input_overflow_is_typed_and_refusal_metadata_stays_serial(worker spec,inputs=spec_inputs(4096);inputs['membrane_xx'].fill(1.7e308);inputs['bending_xx'].fill(1.7e308);execution={} with np.errstate(over='ignore'),pytest.raises(DerivationError) as error:derive_field(spec,inputs,workers=workers,execution=execution) assert isinstance(error.value.__cause__,ValueError) and execution=={'workers':1} - assert not any(t.name.startswith('anysolver-principal') for t in threads()) + assert not any(t.name.startswith('anyfesolver-principal') for t in threads()) @pytest.mark.parametrize('kind',[MemoryError,CancelledError,TypeError]) def test_resource_cancellation_programmer_errors_keep_original_type(monkeypatch,kind): spec,inputs=spec_inputs(1) def fail(*_args,**_kwargs):raise kind('original') - monkeypatch.setattr('anysolver_results.registry.formulas.shell_principal_stresses',fail) + monkeypatch.setattr('anyfesolver_results.registry.formulas.shell_principal_stresses',fail) with pytest.raises(kind,match='original'):derive_field(spec,inputs) diff --git a/tests/test_results_surface_component.py b/tests/test_results_surface_component.py index 6c29bf5c1..606b03467 100644 --- a/tests/test_results_surface_component.py +++ b/tests/test_results_surface_component.py @@ -2,7 +2,7 @@ import numpy as np import pytest -from anysolver_results import shell_surface_component +from anyfesolver_results import shell_surface_component @pytest.mark.parametrize('surface', ['top', 'bottom']) diff --git a/tests/test_runtime_api.py b/tests/test_runtime_api.py index 721ed3253..e3dd33f89 100644 --- a/tests/test_runtime_api.py +++ b/tests/test_runtime_api.py @@ -4,12 +4,12 @@ import json from types import SimpleNamespace -import anysolver +import anyfesolver import numpy as np import pytest -from anysolver import runtime -from anysolver import anystructure_fem_mode -from anysolver import arc_length +from anyfesolver import runtime +from anyfesolver import anystructure_fem_mode +from anyfesolver import arc_length def _flat_geometry() -> dict[str, object]: @@ -244,11 +244,11 @@ def test_root_exports_arc_length_and_generic_generated_geometry_api() -> None: "run_generated_geometry_fem", } - assert expected_root_names <= set(anysolver.__all__) - assert anysolver.ArcLengthControl is arc_length.ArcLengthControl - assert anysolver.ArcLengthResult is arc_length.ArcLengthResult - assert anysolver.ArcLengthStep is arc_length.ArcLengthStep - assert anysolver.solve_static_arc_length is arc_length.solve_static_arc_length + assert expected_root_names <= set(anyfesolver.__all__) + assert anyfesolver.ArcLengthControl is arc_length.ArcLengthControl + assert anyfesolver.ArcLengthResult is arc_length.ArcLengthResult + assert anyfesolver.ArcLengthStep is arc_length.ArcLengthStep + assert anyfesolver.solve_static_arc_length is arc_length.solve_static_arc_length def test_generic_generated_geometry_aliases_match_historical_api() -> None: @@ -259,9 +259,9 @@ def test_generic_generated_geometry_aliases_match_historical_api() -> None: } assert generic_names <= set(anystructure_fem_mode.__all__) - assert anysolver.GeneratedGeometryFEMConfig is anysolver.AnyStructureFEMConfig - assert anysolver.GeneratedGeometryFEMResult is anysolver.AnyStructureFEMResult - assert anysolver.run_generated_geometry_fem is anysolver.run_anystructure_fem_mode + assert anyfesolver.GeneratedGeometryFEMConfig is anyfesolver.AnyStructureFEMConfig + assert anyfesolver.GeneratedGeometryFEMResult is anyfesolver.AnyStructureFEMResult + assert anyfesolver.run_generated_geometry_fem is anyfesolver.run_anystructure_fem_mode assert ( anystructure_fem_mode.GeneratedGeometryFEMConfig diff --git a/tests/test_s3_angle_element.py b/tests/test_s3_angle_element.py index cef2e7d38..2af54b3ff 100644 --- a/tests/test_s3_angle_element.py +++ b/tests/test_s3_angle_element.py @@ -34,11 +34,11 @@ shape_family, triangle_from_angles, ) -from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement -from anysolver.e4_pl_s3_state import qualified_s3_triangle_frame -from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement -from anysolver.elements import DEFAULT_S3_FORMULATION, create_shell_element -from anysolver.fe_core import FEMesh +from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement +from anyfesolver.e4_pl_s3_state import qualified_s3_triangle_frame +from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement +from anyfesolver.elements import DEFAULT_S3_FORMULATION, create_shell_element +from anyfesolver.fe_core import FEMesh BANDS = ANGLE_BANDS_DEG + DIAGNOSTIC_BANDS_DEG[-1:] diff --git a/tests/test_s3_angle_models.py b/tests/test_s3_angle_models.py index 55deb1f26..5ac08beb3 100644 --- a/tests/test_s3_angle_models.py +++ b/tests/test_s3_angle_models.py @@ -17,8 +17,8 @@ sys.path.insert(0, str(ROOT / "scripts")) import qualify_s3_angles as campaign # noqa: E402 -from anysolver import LoadCase, assemble_load_vector # noqa: E402 -from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement # noqa: E402 +from anyfesolver import LoadCase, assemble_load_vector # noqa: E402 +from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement # noqa: E402 @pytest.mark.parametrize("angle", (20.0, 15.0)) @@ -126,10 +126,10 @@ def test_corotational_restart_is_bitwise_equivalent_on_a_15_degree_mesh() -> Non """Restart/identity: V2D state carries no geometry-admission field, so a reduced-angle model must checkpoint and resume exactly like any other.""" - from anysolver import FEModel, create_shell_element - from anysolver.boundary import FixedSupport - from anysolver.e4_pl_s3_v2d_state import canonical_json_bytes - from anysolver.nonlinear_static import solve_static_nonlinear + from anyfesolver import FEModel, create_shell_element + from anyfesolver.boundary import FixedSupport + from anyfesolver.e4_pl_s3_v2d_state import canonical_json_bytes + from anyfesolver.nonlinear_static import solve_static_nonlinear # Two 15/75/90 triangles: restart checkpoint normalization currently runs # a model-wide lifecycle guard per JSON node (quadratic in model size, see diff --git a/tests/test_s3_overlap_hermite_gap.py b/tests/test_s3_overlap_hermite_gap.py index 8e58feebe..49f68ed98 100644 --- a/tests/test_s3_overlap_hermite_gap.py +++ b/tests/test_s3_overlap_hermite_gap.py @@ -1,9 +1,9 @@ """Independent affine-plane extrema and mapped cubic gap discriminators.""" import numpy as np import pytest -from anysolver.general_contact.s3_overlap_hermite_gap import s3_overlap_hermite_gap_bounds -from anysolver.general_contact.s3_pressure_hermite_bounds import s3_pressure_hermite_bounds -from anysolver.general_contact.shell_pair_hermite_sweep import shell_pair_hermite_lower +from anyfesolver.general_contact.s3_overlap_hermite_gap import s3_overlap_hermite_gap_bounds +from anyfesolver.general_contact.s3_pressure_hermite_bounds import s3_pressure_hermite_bounds +from anyfesolver.general_contact.shell_pair_hermite_sweep import shell_pair_hermite_lower SOURCE=np.array([[0.,0.,0.],[1.,0.,0.],[0.,1.,0.]]) TARGET=np.array([[-1.,0.,0.],[2.,0.,0.],[-1.,3.,0.]]) diff --git a/tests/test_s3_prepared_overlap.py b/tests/test_s3_prepared_overlap.py index 92f0bd0af..1311b1650 100644 --- a/tests/test_s3_prepared_overlap.py +++ b/tests/test_s3_prepared_overlap.py @@ -5,11 +5,11 @@ import runpy import numpy as np import pytest -from anysolver.general_contact.s3_pressure_hermite_bounds import ( +from anyfesolver.general_contact.s3_pressure_hermite_bounds import ( _PreparationCache,s3_pressure_hermite_bounds) -from anysolver.general_contact.s3_overlap_hermite_gap import s3_overlap_hermite_gap_bounds -from anysolver.general_contact.normal_s3_skin_path import prepare_normal_s3_skin_path -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.s3_overlap_hermite_gap import s3_overlap_hermite_gap_bounds +from anyfesolver.general_contact.normal_s3_skin_path import prepare_normal_s3_skin_path +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager def inputs(): diff --git a/tests/test_s3_pressure_hermite_bounds.py b/tests/test_s3_pressure_hermite_bounds.py index c6f7eef0d..0fedaefe1 100644 --- a/tests/test_s3_pressure_hermite_bounds.py +++ b/tests/test_s3_pressure_hermite_bounds.py @@ -5,9 +5,9 @@ import runpy import numpy as np import pytest -from anysolver.general_contact.s3_pressure_hermite_bounds import s3_pressure_hermite_bounds -from anysolver.general_contact.normal_s3_skin_path import prepare_normal_s3_skin_path -from anysolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.s3_pressure_hermite_bounds import s3_pressure_hermite_bounds +from anyfesolver.general_contact.normal_s3_skin_path import prepare_normal_s3_skin_path +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager SOURCE=np.array([[0.,0.,0.],[1.,0.,0.],[0.,1.,0.]]) LARGE=np.array([[-2.,-2.,0.],[5.,-2.,0.],[-2.,5.,0.]]) diff --git a/tests/test_s3_pressure_partition.py b/tests/test_s3_pressure_partition.py index de4c28ac5..30e3814b1 100644 --- a/tests/test_s3_pressure_partition.py +++ b/tests/test_s3_pressure_partition.py @@ -3,7 +3,7 @@ from types import SimpleNamespace import numpy as np import pytest -from anysolver.general_contact import s3_pressure_hermite_bounds as module +from anyfesolver.general_contact import s3_pressure_hermite_bounds as module class RecomputedPartition: diff --git a/tests/test_s3_pressure_polygon_bounds.py b/tests/test_s3_pressure_polygon_bounds.py index 955f4831b..13f85aa04 100644 --- a/tests/test_s3_pressure_polygon_bounds.py +++ b/tests/test_s3_pressure_polygon_bounds.py @@ -2,9 +2,9 @@ from fractions import Fraction as Q import numpy as np import pytest -from anysolver.general_contact.s3_pressure_hermite_bounds import ( +from anyfesolver.general_contact.s3_pressure_hermite_bounds import ( _ROOT,_prepare_overlap,_factor,s3_pressure_hermite_bounds) -from anysolver.general_contact.s3_pressure_polygon_bounds import _integral,_signed_integral,_polygon_cell +from anyfesolver.general_contact.s3_pressure_polygon_bounds import _integral,_signed_integral,_polygon_cell SOURCE=np.array([[0.,0.,0.],[.6,0.,0.],[0.,.4,0.]]) TARGET=np.array([[-.2,-.2,0.],[.3,-.2,0.],[.3,.9,0.]]) diff --git a/tests/test_s3_r1_qualification_regression.py b/tests/test_s3_r1_qualification_regression.py index 2f6ea0a0e..4709574a9 100644 --- a/tests/test_s3_r1_qualification_regression.py +++ b/tests/test_s3_r1_qualification_regression.py @@ -8,12 +8,12 @@ with warnings.catch_warnings(): warnings.simplefilter('ignore', pytest.PytestUnknownMarkWarning) slow = pytest.mark.slow -import anysolver as fs -from anysolver import _compensated_native as native_contractions -from anysolver import _compensated_contractions as contractions -from anysolver.elements import create_shell_element -from anysolver.boundary import FixedSupport,LoadCase -from anysolver.material_curves import DNVC208MaterialCurve +import anyfesolver as fs +from anyfesolver import _compensated_native as native_contractions +from anyfesolver import _compensated_contractions as contractions +from anyfesolver.elements import create_shell_element +from anyfesolver.boundary import FixedSupport,LoadCase +from anyfesolver.material_curves import DNVC208MaterialCurve def plate(c): m=fs.FEModel('p');n=c['n'];t=c['t'];form=c['form'] curve=DNVC208MaterialCurve(sigma_prop=3e7,sigma_yield=3.2e7,sigma_yield_2=3.4e7,eps_p_y1=.005,eps_p_y2=.01,K=4e8,n=.2) diff --git a/tests/test_s3_v2d_default_activation.py b/tests/test_s3_v2d_default_activation.py index da83f1d16..b50d14adf 100644 --- a/tests/test_s3_v2d_default_activation.py +++ b/tests/test_s3_v2d_default_activation.py @@ -9,7 +9,7 @@ import pytest -from anysolver import ( +from anyfesolver import ( AnyStructureFEMConfig, LegacyS3MigrationWarning, LegacyShellElement, @@ -206,8 +206,8 @@ def test_activation_candidate_binds_accepted_v6w_and_unchanged_q4() -> None: assert len(data) == record["bytes"] assert hashlib.sha256(data).hexdigest().upper() == record["sha256"] - q4_blob = _git_blob(ROOT / "src" / "anysolver" / "e4_pl_element.py") - s3_blob = _git_blob(ROOT / "src" / "anysolver" / "e4_pl_s3_element.py") + q4_blob = _git_blob(ROOT / "src" / "anyfesolver" / "e4_pl_element.py") + s3_blob = _git_blob(ROOT / "src" / "anyfesolver" / "e4_pl_s3_element.py") hotfix = _q4_replay_hotfix() successor = _q4_replay_canonicalization() runtime_successor = _qualified_shell_runtime_guard_successor() @@ -255,8 +255,8 @@ def test_integration_repair_preserves_qualification_and_q4_boundary() -> None: assert len(activation_data) == activation["bytes"] assert hashlib.sha256(activation_data).hexdigest().upper() == activation["sha256"] - q4_blob = _git_blob(ROOT / "src" / "anysolver" / "e4_pl_element.py") - s3_blob = _git_blob(ROOT / "src" / "anysolver" / "e4_pl_s3_element.py") + q4_blob = _git_blob(ROOT / "src" / "anyfesolver" / "e4_pl_element.py") + s3_blob = _git_blob(ROOT / "src" / "anyfesolver" / "e4_pl_s3_element.py") hotfix = _q4_replay_hotfix() successor = _q4_replay_canonicalization() runtime_successor = _qualified_shell_runtime_guard_successor() diff --git a/tests/test_s3_vk_element_oracle.py b/tests/test_s3_vk_element_oracle.py index 4c6833c6b..882001e9d 100644 --- a/tests/test_s3_vk_element_oracle.py +++ b/tests/test_s3_vk_element_oracle.py @@ -2,8 +2,8 @@ import numpy as np import pytest -from anysolver import create_shell_element -from anysolver.fe_core import FEModel +from anyfesolver import create_shell_element +from anyfesolver.fe_core import FEModel from s3_vk_element_oracle import S3VonKarmanExcess # Complex-step: force = dU/du and tangent = dF/du to 1e-12 of their scale (observed ~1e-15). diff --git a/tests/test_s4_candidate_a_open_qualification.py b/tests/test_s4_candidate_a_open_qualification.py index e843f6877..7746b14d1 100644 --- a/tests/test_s4_candidate_a_open_qualification.py +++ b/tests/test_s4_candidate_a_open_qualification.py @@ -217,7 +217,7 @@ def test_open_oracle_recomputes_both_exact_certificates_independently() -> None: if isinstance(node, (ast.Import, ast.ImportFrom)) for alias in node.names } - forbidden = ("anysolver", "numpy", "scipy", "mpmath") + forbidden = ("anyfesolver", "numpy", "scipy", "mpmath") assert not any(name == item or name.startswith(item + ".") for name in imported for item in forbidden) diff --git a/tests/test_s4_candidate_c_quotient_qualification.py b/tests/test_s4_candidate_c_quotient_qualification.py index a2f750bf9..38be81dac 100644 --- a/tests/test_s4_candidate_c_quotient_qualification.py +++ b/tests/test_s4_candidate_c_quotient_qualification.py @@ -119,7 +119,7 @@ def test_candidate_c_oracle_is_stdlib_only_and_byte_repeatable() -> None: if isinstance(node, (ast.Import, ast.ImportFrom)) for alias in node.names } - forbidden = ("anysolver", "numpy", "scipy", "mpmath", "sympy") + forbidden = ("anyfesolver", "numpy", "scipy", "mpmath", "sympy") assert not any( name == item or name.startswith(item + ".") for name in imported diff --git a/tests/test_s4_candidate_e0_source_gate.py b/tests/test_s4_candidate_e0_source_gate.py index 016bd2c0d..b715f7ea0 100644 --- a/tests/test_s4_candidate_e0_source_gate.py +++ b/tests/test_s4_candidate_e0_source_gate.py @@ -130,7 +130,7 @@ def test_e0_oracle_is_stdlib_only_and_emits_exact_contract() -> None: assert node.module is not None imports.add(node.module.split(".")[0]) assert imports <= {"__future__", "argparse", "hashlib", "json", "pathlib", "sys"} - assert "anysolver" not in imports + assert "anyfesolver" not in imports result = _run("--emit-contract") assert result.returncode == 0 and result.stderr == b"" assert result.stdout == CONTRACT.read_bytes() @@ -256,4 +256,4 @@ def test_e0_extent_is_qualification_only_and_has_no_production_import() -> None: assert not any(path.startswith(("src/", "pyproject.toml", ".github/")) for path in candidate_paths) source = ORACLE.read_text(encoding="utf-8") - assert "import anysolver" not in source and "from anysolver" not in source + assert "import anyfesolver" not in source and "from anyfesolver" not in source diff --git a/tests/test_s4_candidate_e1_closeout.py b/tests/test_s4_candidate_e1_closeout.py index 968177ac8..e06cccd1b 100644 --- a/tests/test_s4_candidate_e1_closeout.py +++ b/tests/test_s4_candidate_e1_closeout.py @@ -149,23 +149,23 @@ } PRODUCTION = { - "src/anysolver/__init__.py": ( + "src/anyfesolver/__init__.py": ( 24779, "0C782CCE93C1346F8A9B6DB832156A4F2689B33460C58F5966E9DE2169C2B8F0", ), - "src/anysolver/anystructure_fem_mode.py": ( + "src/anyfesolver/anystructure_fem_mode.py": ( 60057, "2FEACAAFD2A516B8ACCD919124A18614B0C3096EC0EEAF02DF6BC4280A80616E", ), - "src/anysolver/elements.py": ( + "src/anyfesolver/elements.py": ( 190422, "5D0AF716CD2E466EB831B1896553DE06236AC1BA80A84BD1B09C7E4CEBBDE670", ), - "src/anysolver/fe_core.py": ( + "src/anyfesolver/fe_core.py": ( 17364, "553CE5A7C6FE86CD10D562A1B7683AF2CC84A7E43E77D201823651F3047B9EFD", ), - "src/anysolver/shell_sections.py": ( + "src/anyfesolver/shell_sections.py": ( 11530, "C9ECF93AB0E0A9B2A0D57A0252A21C4BF2A885551D5C96C64C1E2D3167919456", ), @@ -392,7 +392,7 @@ def test_s4_candidate_e1_closeout_is_exact_separate_and_production_safe() -> Non relative: _canonical_lf(ROOT / relative, size, digest) for relative, (size, digest) in PRODUCTION.items() } - elements_text = source_text["src/anysolver/elements.py"] + elements_text = source_text["src/anyfesolver/elements.py"] elements_tree = ast.parse(elements_text) shell = [ node @@ -431,7 +431,7 @@ def test_s4_candidate_e1_closeout_is_exact_separate_and_production_safe() -> Non assert 'getattr(self, "drilling_stabilization", 1.0e-3)' in shell_text assert "B_d.T @ (drilling_stiffness * np.eye(1)) @ B_d" in shell_text - package_tree = ast.parse(source_text["src/anysolver/__init__.py"]) + package_tree = ast.parse(source_text["src/anyfesolver/__init__.py"]) exports = set(ast.literal_eval(_assignment(package_tree, "__all__").value)) assert not any("E1" in name or "candidate_e1" in name.lower() for name in exports) diff --git a/tests/test_s4_director_field.py b/tests/test_s4_director_field.py index 341960744..c4d888e8c 100644 --- a/tests/test_s4_director_field.py +++ b/tests/test_s4_director_field.py @@ -7,8 +7,8 @@ import numpy as np import pytest -import anysolver.shell_formulations.director_field as director_field_module -from anysolver.shell_formulations.director_field import ( +import anyfesolver.shell_formulations.director_field as director_field_module +from anyfesolver.shell_formulations.director_field import ( DIRECTOR_PROVENANCE_NUMERIC_CODE, DirectorProvenanceCode, DirectorValidationLimits, @@ -18,7 +18,7 @@ reconstruct_corner_directors, validate_element_corner_directors, ) -from anysolver.shell_formulations.mitc4_plus_d_quality import ( +from anyfesolver.shell_formulations.mitc4_plus_d_quality import ( numeric_payload_fingerprint, q4_geometry_quality, ) diff --git a/tests/test_s4_drill_constraint_derivation.py b/tests/test_s4_drill_constraint_derivation.py index 8a92be657..eca208d1c 100644 --- a/tests/test_s4_drill_constraint_derivation.py +++ b/tests/test_s4_drill_constraint_derivation.py @@ -49,7 +49,7 @@ def _oracle_module() -> types.ModuleType: def _load_numeric_reference() -> tuple[types.ModuleType, list[str]]: - source = ROOT / "src" / "anysolver" / "shell_formulations" + source = ROOT / "src" / "anyfesolver" / "shell_formulations" package = "_s4_drill_numeric" shell_package = f"{package}.shell_formulations" created: list[str] = [] @@ -256,7 +256,7 @@ def test_whole_matrix_eq21_eq25_binary64_agreement_and_stored_packet() -> None: sys.modules.pop(name, None) -def test_oracle_source_has_no_anysolver_import() -> None: +def test_oracle_source_has_no_anyfesolver_import() -> None: source = ORACLE.read_text(encoding="utf-8") - assert "import anysolver" not in source - assert "from anysolver" not in source + assert "import anyfesolver" not in source + assert "from anyfesolver" not in source diff --git a/tests/test_s4_e2_a_closeout.py b/tests/test_s4_e2_a_closeout.py index 8a13e04b8..ce128dfe3 100644 --- a/tests/test_s4_e2_a_closeout.py +++ b/tests/test_s4_e2_a_closeout.py @@ -103,15 +103,15 @@ } PRODUCTION = { - "src/anysolver/__init__.py": ( + "src/anyfesolver/__init__.py": ( 24779, "0C782CCE93C1346F8A9B6DB832156A4F2689B33460C58F5966E9DE2169C2B8F0", ), - "src/anysolver/anystructure_fem_mode.py": ( + "src/anyfesolver/anystructure_fem_mode.py": ( 60057, "2FEACAAFD2A516B8ACCD919124A18614B0C3096EC0EEAF02DF6BC4280A80616E", ), - "src/anysolver/elements.py": ( + "src/anyfesolver/elements.py": ( 190422, "5D0AF716CD2E466EB831B1896553DE06236AC1BA80A84BD1B09C7E4CEBBDE670", ), diff --git a/tests/test_s4_eq21_eq25_reference.py b/tests/test_s4_eq21_eq25_reference.py index 9d50c0370..a31019722 100644 --- a/tests/test_s4_eq21_eq25_reference.py +++ b/tests/test_s4_eq21_eq25_reference.py @@ -9,7 +9,7 @@ import pytest from numpy.typing import NDArray -from anysolver.shell_formulations.mitc4_plus_d_reference import ( +from anyfesolver.shell_formulations.mitc4_plus_d_reference import ( _assumed_mitc4_plus_membrane_2017_eq27_reference, _assumed_mitc4_plus_membrane_2025_eq25, _drill_membrane_operator, @@ -20,15 +20,15 @@ generalized_strain_operators, local_strain_operator, ) -from anysolver.shell_formulations.mitc4_plus_d_scalar import ( +from anyfesolver.shell_formulations.mitc4_plus_d_scalar import ( consistent_mass, generalized_strain_at, isotropic_plane_stress_constitutive, linear_stiffness, strain_at, ) -from anysolver.shell_formulations.protocol import Q4ReferenceData -from anysolver.shell_formulations.q4_common import deterministic_signature +from anyfesolver.shell_formulations.protocol import Q4ReferenceData +from anyfesolver.shell_formulations.q4_common import deterministic_signature FloatArray = NDArray[np.float64] @@ -526,8 +526,8 @@ def test_invalid_mapping_fails_closed_and_sources_have_no_geometry_dependency() directors = _directors(coordinates) with pytest.raises(ValueError, match="reverse|positive"): build_reference_data(coordinates[[0, 3, 2, 1]], directors, 0.2) - import anysolver.shell_formulations.mitc4_plus_d_reference as reference_module - import anysolver.shell_formulations.mitc4_plus_d_scalar as scalar_module + import anyfesolver.shell_formulations.mitc4_plus_d_reference as reference_module + import anyfesolver.shell_formulations.mitc4_plus_d_scalar as scalar_module for module in (reference_module, scalar_module): source = inspect.getsource(module).lower() assert "import anygeometry" not in source diff --git a/tests/test_s4_geometry_handoff.py b/tests/test_s4_geometry_handoff.py index 05cd2e7d5..e7a777b61 100644 --- a/tests/test_s4_geometry_handoff.py +++ b/tests/test_s4_geometry_handoff.py @@ -13,7 +13,7 @@ import numpy as np import pytest -from anysolver.shell_formulations.geometry_provenance import ( +from anyfesolver.shell_formulations.geometry_provenance import ( FORWARD_GEOMETRY_SCHEMA, SUPPORTED_ANYGEOMETRY_API, CompactSourceHandle, @@ -379,7 +379,7 @@ def test_session_fingerprint_changes_for_geometry_numeric_or_mapping_revision() def test_production_handoff_modules_have_no_geometry_package_imports() -> None: - root = Path("src/anysolver/shell_formulations") + root = Path("src/anyfesolver/shell_formulations") for name in ("geometry_provenance.py", "director_field.py", "mitc4_plus_d_quality.py"): tree = ast.parse((root / name).read_text(encoding="utf-8"), filename=name) imported_roots: set[str] = set() diff --git a/tests/test_s4_improved_qualification_closeout.py b/tests/test_s4_improved_qualification_closeout.py index adc24a1cc..33bbfc910 100644 --- a/tests/test_s4_improved_qualification_closeout.py +++ b/tests/test_s4_improved_qualification_closeout.py @@ -41,15 +41,15 @@ } SOURCE_IDENTITIES = { - ROOT / "src/anysolver/elements.py": ( + ROOT / "src/anyfesolver/elements.py": ( 190422, "5D0AF716CD2E466EB831B1896553DE06236AC1BA80A84BD1B09C7E4CEBBDE670", ), - ROOT / "src/anysolver/__init__.py": ( + ROOT / "src/anyfesolver/__init__.py": ( 24779, "0C782CCE93C1346F8A9B6DB832156A4F2689B33460C58F5966E9DE2169C2B8F0", ), - ROOT / "src/anysolver/anystructure_fem_mode.py": ( + ROOT / "src/anyfesolver/anystructure_fem_mode.py": ( 60057, "2FEACAAFD2A516B8ACCD919124A18614B0C3096EC0EEAF02DF6BC4280A80616E", ), @@ -202,7 +202,7 @@ def test_s4_improved_qualification_closeout_is_canonical_and_fail_closed() -> No path: _canonical_lf(path, expected_bytes, digest) for path, (expected_bytes, digest) in SOURCE_IDENTITIES.items() } - elements_tree = ast.parse(source_bytes[ROOT / "src/anysolver/elements.py"].decode("utf-8")) + elements_tree = ast.parse(source_bytes[ROOT / "src/anyfesolver/elements.py"].decode("utf-8")) shell_class = [ node for node in elements_tree.body @@ -250,7 +250,7 @@ def test_s4_improved_qualification_closeout_is_canonical_and_fail_closed() -> No "s6", } - package_tree = ast.parse(source_bytes[ROOT / "src/anysolver/__init__.py"].decode("utf-8")) + package_tree = ast.parse(source_bytes[ROOT / "src/anyfesolver/__init__.py"].decode("utf-8")) exports = set(ast.literal_eval(_assignment(package_tree, "__all__").value)) assert "ShellElement" in exports assert exports.isdisjoint( @@ -263,7 +263,7 @@ def test_s4_improved_qualification_closeout_is_canonical_and_fail_closed() -> No ) mode_tree = ast.parse( - source_bytes[ROOT / "src/anysolver/anystructure_fem_mode.py"].decode("utf-8") + source_bytes[ROOT / "src/anyfesolver/anystructure_fem_mode.py"].decode("utf-8") ) production_calls = [ node diff --git a/tests/test_s4_nullspace_semantics_proof.py b/tests/test_s4_nullspace_semantics_proof.py index 68aa50b71..c78f2395c 100644 --- a/tests/test_s4_nullspace_semantics_proof.py +++ b/tests/test_s4_nullspace_semantics_proof.py @@ -201,11 +201,11 @@ def _check_environment_manifest_and_same_environment_snapshots() -> None: def _check_synthetic_loader_binds_exact_six_and_hashes_sources() -> None: modules = ORACLE.load_numeric_modules() - expected = {"anysolver", "anysolver.shell_formulations"} - expected.update(f"anysolver.shell_formulations.{Path(name).stem}" for name in ORACLE.SOURCE_ORDER) + expected = {"anyfesolver", "anyfesolver.shell_formulations"} + expected.update(f"anyfesolver.shell_formulations.{Path(name).stem}" for name in ORACLE.SOURCE_ORDER) assert set(modules) == expected for filename, digest in ORACLE.SOURCE_HASHES.items(): - path = REPOSITORY / "src" / "anysolver" / "shell_formulations" / filename + path = REPOSITORY / "src" / "anyfesolver" / "shell_formulations" / filename assert ORACLE._canonical_source_hash(path) == digest @@ -226,7 +226,7 @@ def _check_hostile_constraints_and_model_indices_fail_early() -> None: raise AssertionError(f"hostile constraint unexpectedly accepted: {specification['id']}") -def _check_preloaded_anysolver_module_is_rejected_in_isolated_process() -> None: +def _check_preloaded_anyfesolver_module_is_rejected_in_isolated_process() -> None: script = ( "import importlib.util,pathlib,sys,types;" f"p=pathlib.Path({str(ORACLE_PATH)!r});" @@ -294,19 +294,19 @@ def _check_full_registered_proof_catalog_and_byte_repeatability() -> None: _check_environment_manifest_and_same_environment_snapshots, _check_synthetic_loader_binds_exact_six_and_hashes_sources, _check_hostile_constraints_and_model_indices_fail_early, - _check_preloaded_anysolver_module_is_rejected_in_isolated_process, + _check_preloaded_anyfesolver_module_is_rejected_in_isolated_process, _check_numbering_topology_deletion_and_threshold_sensitive_evidence, _check_full_registered_proof_catalog_and_byte_repeatability, ) def _worker_main() -> int: - """Run all gates in a clean process before NumPy or ANYsolver imports.""" + """Run all gates in a clean process before NumPy or ANYfeSolver imports.""" global ORACLE, NP assert "numpy" not in sys.modules assert not any( - name.casefold() == "anysolver" or name.casefold().startswith("anysolver.") + name.casefold() == "anyfesolver" or name.casefold().startswith("anyfesolver.") for name in sys.modules ) specification = importlib.util.spec_from_file_location( diff --git a/tests/test_s4_restricted_activity.py b/tests/test_s4_restricted_activity.py index d782421c9..503f5b471 100644 --- a/tests/test_s4_restricted_activity.py +++ b/tests/test_s4_restricted_activity.py @@ -7,12 +7,12 @@ import numpy as np -from anysolver.activity import ElementActivity +from anyfesolver.activity import ElementActivity ROOT = Path(__file__).resolve().parents[1] CONTRACT_PATH = ROOT / "docs" / "reference_cases" / "s4_restricted_release_contract.json" -POLICY_PATH = ROOT / "src" / "anysolver" / "shell_formulations" / "s4_restricted_policy.py" +POLICY_PATH = ROOT / "src" / "anyfesolver" / "shell_formulations" / "s4_restricted_policy.py" def _normalized_git_blob_id(path: Path) -> str: diff --git a/tests/test_s4_restricted_integration.py b/tests/test_s4_restricted_integration.py index f97026fb4..8ed17c5f9 100644 --- a/tests/test_s4_restricted_integration.py +++ b/tests/test_s4_restricted_integration.py @@ -5,9 +5,9 @@ import json from pathlib import Path -import anysolver -from anysolver.elements import ShellElement -from anysolver.shell_formulations import s4_restricted_policy as policy +import anyfesolver +from anyfesolver.elements import ShellElement +from anyfesolver.shell_formulations import s4_restricted_policy as policy ROOT = Path(__file__).resolve().parents[1] @@ -96,8 +96,8 @@ def test_legacy_shell_defaults_and_root_exports_are_unchanged() -> None: "S4RestrictedReleaseStatus", "s4_restricted_policy", } - assert forbidden.isdisjoint(anysolver.__all__) - assert all(not hasattr(anysolver, name) for name in forbidden) + assert forbidden.isdisjoint(anyfesolver.__all__) + assert all(not hasattr(anyfesolver, name) for name in forbidden) def test_policy_is_stdlib_only_and_not_wired_to_hot_paths() -> None: @@ -117,11 +117,11 @@ def test_policy_is_stdlib_only_and_not_wired_to_hot_paths() -> None: assert imports <= {"__future__", "dataclasses"} for relative in ( - "src/anysolver/elements.py", - "src/anysolver/assembly.py", - "src/anysolver/matrix_assembly.py", - "src/anysolver/fe_core.py", - "src/anysolver/activity.py", + "src/anyfesolver/elements.py", + "src/anyfesolver/assembly.py", + "src/anyfesolver/matrix_assembly.py", + "src/anyfesolver/fe_core.py", + "src/anyfesolver/activity.py", ): source = (ROOT / relative).read_text(encoding="utf-8") assert "s4_restricted_policy" not in source diff --git a/tests/test_s4_stage_m_candidate_a_discretization.py b/tests/test_s4_stage_m_candidate_a_discretization.py index 4983b4536..f4c848a41 100644 --- a/tests/test_s4_stage_m_candidate_a_discretization.py +++ b/tests/test_s4_stage_m_candidate_a_discretization.py @@ -106,7 +106,7 @@ def test_candidate_a_oracle_is_independent_and_deterministic() -> None: if isinstance(node, (ast.Import, ast.ImportFrom)) for alias in node.names } - assert not any(name == "anysolver" or name.startswith("anysolver.") for name in imported) + assert not any(name == "anyfesolver" or name.startswith("anyfesolver.") for name in imported) emitted = _run("--emit-contract") assert emitted.returncode == 0, emitted.stderr.decode() diff --git a/tests/test_sesam_fem.py b/tests/test_sesam_fem.py index 133ef44ea..3cb25bed3 100644 --- a/tests/test_sesam_fem.py +++ b/tests/test_sesam_fem.py @@ -1,4 +1,4 @@ -"""ANYfileIO-to-ANYsolver SESAM adapter integration tests.""" +"""ANYfileIO-to-ANYfeSolver SESAM adapter integration tests.""" from __future__ import annotations @@ -7,8 +7,8 @@ import pytest -from anysolver.elements import LegacyShellElement, ShellElement -from anysolver.sesam_fem import import_sesam_fem +from anyfesolver.elements import LegacyShellElement, ShellElement +from anyfesolver.sesam_fem import import_sesam_fem def _work_dir() -> Path: @@ -22,7 +22,7 @@ def _mixed_shell_fem() -> str: [ "IDENT 100 1", "DATE 2026 6 23", - " Generated by ANYsolver test", + " Generated by ANYfeSolver test", "UNITS 1 1 1", "MISOSEL 1 2.100000D+11 3.000000D-01 7.850000D+03", "TDMATER 1 S355 steel", diff --git a/tests/test_sestra_deep_diagnostics.py b/tests/test_sestra_deep_diagnostics.py index 6364fd0dc..d3c64584b 100644 --- a/tests/test_sestra_deep_diagnostics.py +++ b/tests/test_sestra_deep_diagnostics.py @@ -2,14 +2,14 @@ from pathlib import Path import json import pytest -from anysolver.sestra_deep_diagnostics import prepare_stage1,load_case_manifest,STAGE1 -from anysolver.sestra_verification import Unsupported,identity +from anyfesolver.sestra_deep_diagnostics import prepare_stage1,load_case_manifest,STAGE1 +from anyfesolver.sestra_verification import Unsupported,identity from anyfileio.sesam import read_sesam_fem_document @pytest.fixture def base(tmp_path,monkeypatch): from anyfileio.sesam.records import FemRawRecord,records_to_text - import anysolver.sestra_deep_diagnostics as diagnostic + import anyfesolver.sestra_deep_diagnostics as diagnostic specs=[('IDENT',(1,1,3,0)),('UNITS',(5,1,1,1,1)),('MISOSEL',(1,210000003000,.300000012,7850,.03,.000012,1,355)),('GELTH',(1,.0199999996)),('GUNIVEC',(1,0,0,1)),('GBEAMG',(2,.001,8.333333e-7,8.333333e-9,3.123335e-8,0,0,0,0,0,.0006666666,.0006666666)),('GBARM',(2,.1,.01)),('IEND',(0,0,0,0))] p=tmp_path/'seed.FEM';p.write_bytes(records_to_text([FemRawRecord(n,tuple(map(float,v)),(),0,0,()) for n,v in specs]).encode('ascii'));monkeypatch.setattr(diagnostic,'BASELINE_SHA',identity(p)['sha256']);return p @@ -32,7 +32,7 @@ def test_changed_source_refuses(tmp_path,base): with pytest.raises(Unsupported):load_case_manifest(p) def test_stage2_refinement_and_source_driven_underplate_geometry(tmp_path,base): - from anysolver.sestra_deep_diagnostics import prepare_stage2,STAGE2 + from anyfesolver.sestra_deep_diagnostics import prepare_stage2,STAGE2 s=prepare_stage2(base,tmp_path/'stage2');assert tuple(s['order'])==STAGE2 for name,entry in s['cases'].items(): m=load_case_manifest(entry['manifest']);d=read_sesam_fem_document(m['fem'],strict=True) @@ -43,7 +43,7 @@ def test_stage2_refinement_and_source_driven_underplate_geometry(tmp_path,base): def test_offset_serialization_identity_does_not_allow_physical_shift(tmp_path,base): from dataclasses import replace - from anysolver.sestra_deep_diagnostics import prepare_stage2,assert_deep_reference_identity + from anyfesolver.sestra_deep_diagnostics import prepare_stage2,assert_deep_reference_identity s=prepare_stage2(base,tmp_path/'offset');m=load_case_manifest(s['cases']['combined_regular20_underplate']['manifest']);d=read_sesam_fem_document(m['fem'],strict=True) value=d.eccentricities[1];rounded=tuple(float(__import__('numpy').float32(x)) for x in value) assert_deep_reference_identity(d,replace(d,eccentricities={1:rounded}),m) diff --git a/tests/test_sestra_mixed_mechanics.py b/tests/test_sestra_mixed_mechanics.py index 621b43004..58d9c8da7 100644 --- a/tests/test_sestra_mixed_mechanics.py +++ b/tests/test_sestra_mixed_mechanics.py @@ -1,8 +1,8 @@ """Independent linear centroidal force/rigid-arm controls.""" import numpy as np import pytest -from anysolver.fe_core import FEModel -from anysolver.elements import BeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.elements import BeamElement def beam(offsets=None): m=FEModel('beam controls');m.add_node(1,0,0,0);m.add_node(2,2,0,0) @@ -52,7 +52,7 @@ def test_legacy_zero_offset_mass_is_unchanged(): b.set_linear_nodal_offsets([(0,0,0),(-2,0,0)]);b.compute_stiffness_matrix(m.mesh,mat) def test_rectangular_admission_rounding_bound_has_length_units(): - from anysolver.sestra_mixed_verification import rectangular_serialization_admission + from anyfesolver.sestra_mixed_verification import rectangular_serialization_admission xyz=np.array([[1.,1,0],[2,1,0],[2,2,0],[1,2,0]]) xyz[2,0]+=1e-7 assert rectangular_serialization_admission(xyz)[0] @@ -60,7 +60,7 @@ def test_rectangular_admission_rounding_bound_has_length_units(): assert not rectangular_serialization_admission(xyz)[0] def shell(distorted=True): - from anysolver.elements import create_shell_element + from anyfesolver.elements import create_shell_element m=FEModel('sampling controls');xy=[(0,0),(2,0),(2.2 if distorted else 2,1),(0,1)] for nid,(x,y) in enumerate(xy,1):m.add_node(nid,x,y,0) e=create_shell_element(1,[1,2,3,4],thickness=.02);m.add_element(1,e) @@ -81,7 +81,7 @@ def test_custom_qualified_points_match_affine_membrane_and_symmetric_bending(): np.testing.assert_array_equal(e.gauss_points,saved) def test_explicit_default_points_bitwise_equivalent_and_bad_points_refuse(): - from anysolver.e4_pl_element import _GAUSS + from anyfesolver.e4_pl_element import _GAUSS m,e,mat=shell();u=np.arange(24)*1e-8 default=e.compute_stresses(m.mesh,u,mat,return_global=True) explicit=e.compute_stresses(m.mesh,u,mat,return_global=True,natural_points=_GAUSS) @@ -91,8 +91,8 @@ def test_explicit_default_points_bitwise_equivalent_and_bad_points_refuse(): with pytest.raises(ValueError,match='natural stress points'):e.compute_stresses(m.mesh,u,mat,natural_points=points) def test_custom_points_refuse_warped_and_generalized_routes(): - from anysolver.elements import create_shell_element - from anysolver.shell_sections import GeneralizedShellSection + from anyfesolver.elements import create_shell_element + from anyfesolver.shell_sections import GeneralizedShellSection m,e,mat=shell();m.mesh.nodes[3].z=.2 with pytest.raises(ValueError,match='warped'):e.compute_stresses(m.mesh,np.zeros(24),mat,natural_points=[[0,0]]) m,e,mat=shell(False) diff --git a/tests/test_sestra_structure_benchmarks.py b/tests/test_sestra_structure_benchmarks.py index 0bf597855..063241b50 100644 --- a/tests/test_sestra_structure_benchmarks.py +++ b/tests/test_sestra_structure_benchmarks.py @@ -3,8 +3,8 @@ from pathlib import Path import numpy as np import pytest -from anysolver.sestra_structure_benchmarks import prepare_suite,read_manifest,admit,native_solution,frame_oracle -from anysolver.sestra_verification import Unsupported +from anyfesolver.sestra_structure_benchmarks import prepare_suite,read_manifest,admit,native_solution,frame_oracle +from anyfesolver.sestra_verification import Unsupported @pytest.fixture(scope='module') def suite(tmp_path_factory):return prepare_suite(tmp_path_factory.mktemp('structures')/'cases') @@ -44,7 +44,7 @@ def test_no_existing_case_overwrite(suite): def test_load_result_serialization_is_bounded_and_does_not_mutate_source(suite): from dataclasses import replace - from anysolver.sestra_structure_benchmarks import assert_structure_reference_identity + from anyfesolver.sestra_structure_benchmarks import assert_structure_reference_identity m=read_manifest(suite['cases']['inclined_frame_4']['manifest']);imp,_=admit(m);d=imp.document;r=next(x for x in d.load_records if x.record_name=='BNLOAD');rounded=tuple(r.raw_values[:6])+tuple(float(np.float32(v)) for v in r.raw_values[6:]) def changed(v):return replace(d,load_records=tuple(replace(x,raw_values=tuple(v)) if x is r else x for x in d.load_records)) evidence=assert_structure_reference_identity(d,changed(rounded),m) diff --git a/tests/test_sestra_three_case.py b/tests/test_sestra_three_case.py index 74dde8f27..99b2da099 100644 --- a/tests/test_sestra_three_case.py +++ b/tests/test_sestra_three_case.py @@ -3,7 +3,7 @@ from pathlib import Path import numpy as np import pytest -from anysolver.sestra_three_case import prepare_three_cases,read_manifest,solve_case,compare_suite,Unsupported +from anyfesolver.sestra_three_case import prepare_three_cases,read_manifest,solve_case,compare_suite,Unsupported BASELINE=Path(__file__).resolve().parent/'fixtures/sestra_three_case/20261008_140714_T1.FEM' @@ -28,7 +28,7 @@ def test_no_reference_is_not_executed_and_source_mutation_refused(tmp_path): with pytest.raises(Unsupported,match='criteria'):read_manifest(path) def test_public_importer_refuses_new_nodal_multi_case_aggregation(tmp_path): - from anysolver.sesam_fem import import_sesam_fem + from anyfesolver.sesam_fem import import_sesam_fem from anyfileio.sesam.records import read_raw_records,FemRawRecord,records_to_text suite=prepare_three_cases(BASELINE,tmp_path/'cases');path=Path(suite['cases']['flatbar']['fem']['path']);records=list(read_raw_records(path)) records.insert(-1,FemRawRecord('BNLOAD',(2.,1.,0.,0.,21.,6.,0.,0.,-1000.,0.,0.,0.),(),0,0,())) @@ -37,7 +37,7 @@ def test_public_importer_refuses_new_nodal_multi_case_aggregation(tmp_path): @pytest.mark.parametrize('mutation',['orientation','dimension','area']) def test_named_flatbar_regime_refuses_changed_axes_and_section(tmp_path,mutation): - from anysolver.sestra_three_case import admit_case + from anyfesolver.sestra_three_case import admit_case from anyfileio.sesam.records import read_raw_records,records_to_text from dataclasses import replace suite=prepare_three_cases(BASELINE,tmp_path/'cases');m=read_manifest(suite['cases']['flatbar']['manifest']);path=Path(m['fem']);records=[] diff --git a/tests/test_sestra_verification.py b/tests/test_sestra_verification.py index 60ad31e12..7b232b68d 100644 --- a/tests/test_sestra_verification.py +++ b/tests/test_sestra_verification.py @@ -7,7 +7,7 @@ import numpy as np import pytest -from anysolver.sestra_verification import (COMPONENTS, METRIC, Unsupported, admit, compare, +from anyfesolver.sestra_verification import (COMPONENTS, METRIC, Unsupported, admit, compare, execute_reference, load_manifest, native_stresses, run_verification, generate_hanging_shell, validate_execution_fem) @@ -23,7 +23,8 @@ def fixture(tmp_path): "GELMNT1 100 1 24 0 1 2 3 4", "GELREF1 100 1 0 0 0 0 0 0 1 0 0 0", "BNBCD 1 6 0 0 1 1 1 1", "BNBCD 2 6 0 0 1 1 1 1", "BNBCD 3 6 0 1 1 1 1 1", "BNBCD 4 6 1 1 1 1 1 1", "TDLOAD 4 1 103 0 LC1", "BGRAV 1 0 0 0 0 -10 0", "IEND 0 0 0 0"] - fem = tmp_path/"case.FEM"; fem.write_text('\n'.join(map(formatted,lines))+'\n') + fem = tmp_path/"case.FEM" + fem.write_bytes(('\r\n'.join(map(formatted,lines))+'\r\n').encode('ascii')) manifest = tmp_path/"case.json" m = {"schema_version":1,"case_id":"synthetic_harness_only","fem":"case.FEM","load_case":1, "units":"SI","frame":"GLOBAL","observable":METRIC,"element_ids":[100], @@ -52,7 +53,7 @@ def test_native_axial_gravity_and_synthetic_sif(tmp_path): def test_prepare_does_not_solve_or_execute(tmp_path,monkeypatch): path,_ = fixture(tmp_path) - monkeypatch.setattr("anysolver.sestra_verification.native_stresses",lambda _: pytest.fail("unexpected solve")) + monkeypatch.setattr("anyfesolver.sestra_verification.native_stresses",lambda _: pytest.fail("unexpected solve")) report = run_verification(path,tmp_path/"reports") assert report["status"] == "not_executed" assert report["admission"] == "admitted" @@ -114,7 +115,7 @@ def test_comparison_is_complete_and_absolute_plus_relative(tmp_path): def test_unconverged_native_is_refused(tmp_path,monkeypatch): path,_=fixture(tmp_path); imported=admit(load_manifest(path)) - monkeypatch.setattr("anysolver.assembly.solve_linear",lambda *a,**kw:(np.zeros(24),{"convergence_info":{"status":"failed"}})) + monkeypatch.setattr("anyfesolver.assembly.solve_linear",lambda *a,**kw:(np.zeros(24),{"convergence_info":{"status":"failed"}})) with pytest.raises(Unsupported,match="did not converge"): native_stresses(imported) @@ -128,7 +129,7 @@ def test_reference_source_binding_required(tmp_path): def test_execution_failure_and_timeout_keep_evidence(tmp_path,action,status): path,_=fixture(tmp_path); m=load_manifest(path) template=tmp_path/"control.inp"; template.write_text("INAM {prefix}\nRNAM {prefix} FORMATTED\n") - m["execution"]={"argv":[sys.executable,"-c",action],"timeout_seconds":.3, + m["execution"]={"argv":[sys.executable,"-c",action],"timeout_seconds":.3 if status=="timeout" else 5, "prefix":"test","control_template":str(template)} case=tmp_path/"run";case.mkdir() _, evidence=execute_reference(m,case) diff --git a/tests/test_sol_ultra_comparison_script.py b/tests/test_sol_ultra_comparison_script.py index accc2e743..7949c2b29 100644 --- a/tests/test_sol_ultra_comparison_script.py +++ b/tests/test_sol_ultra_comparison_script.py @@ -50,7 +50,7 @@ def _case(*, warm_seconds: float) -> dict[str, Any]: def _benchmark_artifacts() -> tuple[dict[str, Any], dict[str, Any]]: baseline = { - "schema_name": "anysolver.sol_ultra.benchmark", + "schema_name": "anyfesolver.sol_ultra.benchmark", "schema_version": 1, "report_kind": "baseline", "revision": { diff --git a/tests/test_sol_ultra_numerical_verification.py b/tests/test_sol_ultra_numerical_verification.py index f108234f3..450f7b608 100644 --- a/tests/test_sol_ultra_numerical_verification.py +++ b/tests/test_sol_ultra_numerical_verification.py @@ -18,7 +18,7 @@ @pytest.fixture(scope="module") def harness(): spec = importlib.util.spec_from_file_location( - "anysolver_sol_ultra_verification_harness", + "anyfesolver_sol_ultra_verification_harness", SCRIPT, ) assert spec is not None and spec.loader is not None diff --git a/tests/test_solid_submodel.py b/tests/test_solid_submodel.py index bdb025b5d..68e2302ff 100644 --- a/tests/test_solid_submodel.py +++ b/tests/test_solid_submodel.py @@ -18,18 +18,18 @@ anysolid_backend = pytest.importorskip("anysolid.backend") from anysolid.mesh import SolidMesh # noqa: E402 -from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement # noqa: E402 -from anysolver.elements import create_shell_element # noqa: E402 -from anysolver.fe_core import FEModel # noqa: E402 -from anysolver import BoundaryCondition # noqa: E402 -from anysolver.solid_submodel import ( # noqa: E402 +from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement # noqa: E402 +from anyfesolver.elements import create_shell_element # noqa: E402 +from anyfesolver.fe_core import FEModel # noqa: E402 +from anyfesolver import BoundaryCondition # noqa: E402 +from anyfesolver.solid_submodel import ( # noqa: E402 ATTRIBUTION_RULE, SolidSubmodelCancelled, SolidSubmodelError, evaluate_shell_displacement, solve_shell_driven_solid, ) -from anysolver.submodel_transfer import element_interpolation_weights # noqa: E402 +from anyfesolver.submodel_transfer import element_interpolation_weights # noqa: E402 E, NU, T = 210.0e9, 0.3, 0.01 LZ = 0.2 diff --git a/tests/test_solver_control_contracts.py b/tests/test_solver_control_contracts.py index a768e868b..6214ef1ab 100644 --- a/tests/test_solver_control_contracts.py +++ b/tests/test_solver_control_contracts.py @@ -6,7 +6,7 @@ import pytest from scipy import sparse -from anysolver import ( +from anyfesolver import ( AnyStructureFEMResult, CancellationToken, ConstraintEquation, @@ -24,19 +24,19 @@ solve_outcome, solve_nonlinear_load_stepping, ) -from anysolver.assembly import ( +from anyfesolver.assembly import ( build_constraint_transformation, build_reduced_rigid_body_modes, reconstruct_full_solution, ) -from anysolver.boundary import BoundaryCondition, FixedSupport, LoadCase -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel -from anysolver.buckling import BucklingMode, BucklingResult -from anysolver.modal import ModalMode, ModalResult -from anysolver.nonlinear_static import NonlinearStaticResult, solve_static_nonlinear -from anysolver.recovery import StressRecoveryProvenance, StressRecoveryResult -from anysolver.results import FEResult +from anyfesolver.boundary import BoundaryCondition, FixedSupport, LoadCase +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.buckling import BucklingMode, BucklingResult +from anyfesolver.modal import ModalMode, ModalResult +from anyfesolver.nonlinear_static import NonlinearStaticResult, solve_static_nonlinear +from anyfesolver.recovery import StressRecoveryProvenance, StressRecoveryResult +from anyfesolver.results import FEResult def _elastic_cantilever() -> tuple[FEModel, LoadCase]: @@ -724,7 +724,7 @@ def test_public_workflow_result_families_have_exact_type_outcomes() -> None: spoof_type = type( "NonlinearStaticResult", (), - {"__module__": "anysolver.nonlinear_static"}, + {"__module__": "anyfesolver.nonlinear_static"}, ) with pytest.raises(TypeError): solve_outcome(spoof_type()) diff --git a/tests/test_source_field_observer.py b/tests/test_source_field_observer.py index d85984a02..779f75827 100644 --- a/tests/test_source_field_observer.py +++ b/tests/test_source_field_observer.py @@ -3,9 +3,9 @@ import json import numpy as np import pytest -from anysolver import (PatternCase,RecoveryConfig,ResourceConfig,prepare_static_response_evaluator, +from anyfesolver import (PatternCase,RecoveryConfig,ResourceConfig,prepare_static_response_evaluator, export_recovery_capsule_to_sink,CancellationToken,SolveCancelled,PreparedStaticError) -from anysolver.result_capsule import _MemorySink,_CapsuleExport,RecoveryCapsuleError +from anyfesolver.result_capsule import _MemorySink,_CapsuleExport,RecoveryCapsuleError from test_prepared_static_evaluator import _bar,_case,_shell_case from test_result_capsule_export import _rotated_shell_model from test_native_affinity_fallback import prepare as native_prepare @@ -142,7 +142,7 @@ def observer(payload): assert json.loads(next(tmp_path.glob('*.failure.json')).read_text())['error_type']=='FatalObserver' def test_observer_resource_check_precedes_snapshot_allocation(): - from anysolver.recovery import ResourcePolicyError + from anyfesolver.recovery import ResourcePolicyError with prepare_static_response_evaluator(_bar(),{'p':_case(1).load_case},stress_execution='certified_library') as evaluator: required=evaluator._preparation_memory_peak_required_bytes cfg=ResourceConfig(memory_limit_bytes=int(required)+32768) @@ -154,8 +154,8 @@ def test_observer_resource_check_precedes_snapshot_allocation(): def test_metadata_reuse_keeps_values_fresh_and_never_retains_history(): - from anysolver.result_capsule import _Layout - from anysolver.prepared_static_numeric import NumericCase,NumericField + from anyfesolver.result_capsule import _Layout + from anyfesolver.prepared_static_numeric import NumericCase,NumericField with prepare_static_response_evaluator(_bar(),{'p':_case(1).load_case},stress_execution='certified_library', recovery_config=RecoveryConfig(include_stresses=True,include_displacements=True,include_reactions=False)) as evaluator: cases=[PatternCase('a',{'p':1.}),PatternCase('b',{'p':2.})] @@ -184,7 +184,7 @@ def test_metadata_reuse_keeps_values_fresh_and_never_retains_history(): @pytest.mark.parametrize('name',['id','type']) def test_observer_builtin_shadow_injection_refuses_before_next_snapshot(name): - import anysolver.result_capsule as module + import anyfesolver.result_capsule as module calls=[] def observer(payload): calls.append(payload) @@ -224,8 +224,8 @@ def observer(payload):payload['fields']['displacement:UX'][name].strides=(0,) assert list(tmp_path.glob('*.failure.json')) def test_cached_static_stride_mutation_refuses_before_reuse(): - from anysolver.result_capsule import _Layout - from anysolver.prepared_static_numeric import NumericCase,NumericField + from anyfesolver.result_capsule import _Layout + from anyfesolver.prepared_static_numeric import NumericCase,NumericField with prepare_static_response_evaluator(_bar(),{'p':_case(1).load_case},stress_execution='certified_library') as evaluator: exporter=_CapsuleExport(evaluator,[PatternCase('a',{'p':1.})],model_identity='m',mesh_identity='g',source_field_observer=lambda p:None) layout=_Layout();layout.add(1,2) @@ -237,7 +237,7 @@ def test_cached_static_stride_mutation_refuses_before_reuse(): @pytest.mark.parametrize('target',['_observer_freeze','MappingProxyType','_require_observer_environment','_observer_layout', '_observer_array_facts','_require_observer_array_facts']) def test_new_observer_executable_binding_mutations_refuse(target): - import anysolver.result_capsule as rc + import anyfesolver.result_capsule as rc owner=rc._CapsuleExport if target=='_observer_layout' else rc original=getattr(owner,target);calls=[] def observer(payload): @@ -254,13 +254,13 @@ def test_large_intermediate_backing_remains_alive_during_validation(): # crash the pytest process when an OS-sized backing allocation is released. import subprocess,sys from pathlib import Path - import anysolver.result_capsule as rc + import anyfesolver.result_capsule as rc package_root=str(Path(rc.__file__).resolve().parent.parent) code=r''' import gc,sys sys.path.insert(0,sys.argv[1]) import numpy as np -from anysolver.result_capsule import (_observer_freeze,_observer_array_facts, +from anyfesolver.result_capsule import (_observer_freeze,_observer_array_facts, _require_observer_array_facts,RecoveryCapsuleError) view=_observer_freeze(np.arange(262144,dtype=np.float64)) expected=float(view.sum()) @@ -299,7 +299,7 @@ def observer(payload):token.cancel('secondary');raise primary assert any('SolveCancelled' in note for note in primary.__notes__) def test_batch_ledger_counts_python_containers_and_scalar_records(): - from anysolver.result_capsule import _observer_numeric_bytes + from anyfesolver.result_capsule import _observer_numeric_bytes record={'nodes':{i:[float(i)]*6 for i in range(32)},'provenance':['source']*32} assert _observer_numeric_bytes(record)>32*6*8 @@ -347,8 +347,8 @@ def observer(payload): @pytest.mark.parametrize('name',['associations','native_ordinals']) def test_cached_intermediate_base_replacement_refuses_before_reuse(name): - from anysolver.result_capsule import _Layout - from anysolver.prepared_static_numeric import NumericCase,NumericField + from anyfesolver.result_capsule import _Layout + from anyfesolver.prepared_static_numeric import NumericCase,NumericField with prepare_static_response_evaluator(_bar(),{'p':_case(1).load_case},stress_execution='certified_library') as evaluator: exporter=_CapsuleExport(evaluator,[PatternCase('a',{'p':1.})],model_identity='m',mesh_identity='g',source_field_observer=lambda p:None) layout=_Layout();layout.add(1,2) diff --git a/tests/test_spectral_medium_fine_benchmark.py b/tests/test_spectral_medium_fine_benchmark.py index faffe6130..7f00d4a5a 100644 --- a/tests/test_spectral_medium_fine_benchmark.py +++ b/tests/test_spectral_medium_fine_benchmark.py @@ -13,7 +13,7 @@ # Complete process-tree accounting is a research-runner capability. psutil is -# intentionally not an ANYsolver runtime dependency, so environments without +# intentionally not an ANYfeSolver runtime dependency, so environments without # it skip this runner-specific module instead of failing test collection. pytest.importorskip("psutil") diff --git a/tests/test_spectral_noop_checkpoints.py b/tests/test_spectral_noop_checkpoints.py index c0f923c65..63af9526d 100644 --- a/tests/test_spectral_noop_checkpoints.py +++ b/tests/test_spectral_noop_checkpoints.py @@ -4,12 +4,12 @@ import pytest -import anysolver.buckling as buckling_module -import anysolver.modal as modal_module -from anysolver.boundary import BoundaryCondition, FixedSupport -from anysolver.control import CancellationToken -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel +import anyfesolver.buckling as buckling_module +import anyfesolver.modal as modal_module +from anyfesolver.boundary import BoundaryCondition, FixedSupport +from anyfesolver.control import CancellationToken +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel def _modal_model() -> FEModel: diff --git a/tests/test_spectral_validation_preparation.py b/tests/test_spectral_validation_preparation.py index b0eddfe75..ebc4165f6 100644 --- a/tests/test_spectral_validation_preparation.py +++ b/tests/test_spectral_validation_preparation.py @@ -5,11 +5,11 @@ import pytest -import anysolver.current_state_tangent as tangent -from anysolver import QualifiedE4PLShellElement -from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement -from anysolver.element_capabilities import ElementCapabilityError -from anysolver.elements import ShellElement, create_shell_element +import anyfesolver.current_state_tangent as tangent +from anyfesolver import QualifiedE4PLShellElement +from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement +from anyfesolver.element_capabilities import ElementCapabilityError +from anyfesolver.elements import ShellElement, create_shell_element def _q4(element_id: int) -> QualifiedE4PLShellElement: diff --git a/tests/test_standard_edge_beam_shell_nonlinear_contact.py b/tests/test_standard_edge_beam_shell_nonlinear_contact.py index 48c5ae8d2..cc8e6c4d5 100644 --- a/tests/test_standard_edge_beam_shell_nonlinear_contact.py +++ b/tests/test_standard_edge_beam_shell_nonlinear_contact.py @@ -103,7 +103,7 @@ import pytest from scipy import sparse -from anysolver import ( +from anyfesolver import ( BoundaryCondition, ContactDefinition, ContactInteraction, @@ -113,31 +113,31 @@ create_shell_element, solve_static_nonlinear, ) -from anysolver.assembly import build_constraint_transformation -from anysolver.control import CancellationToken, SolveCancelled -from anysolver.elements import BeamElement, CoupledBeamShellElement -from anysolver.fe_core import FEModel -from anysolver.general_contact.core import ( +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver.elements import BeamElement, CoupledBeamShellElement +from anyfesolver.fe_core import FEModel +from anyfesolver.general_contact.core import ( active_contact_manager, contact_scope, ) -from anysolver.mesh_gen import InterpolatedBeamShellMPCElement -from anysolver.nonlinear_performance_bootstrap import ( +from anyfesolver.mesh_gen import InterpolatedBeamShellMPCElement +from anyfesolver.nonlinear_performance_bootstrap import ( clear_nonlinear_assembly_cache, get_nonlinear_assembly_plan, install_nonlinear_performance_optimizations, ) -from anysolver.nonlinear_reduced_assembly import ( +from anyfesolver.nonlinear_reduced_assembly import ( assemble_reduced_system, build_reduced_assembly_plan, ) -from anysolver.nonlinear_static import ( +from anyfesolver.nonlinear_static import ( NonlinearLoadProgram, NonlinearLoadStage, _assemble_nonlinear_system, ) -from anysolver.nonlinear_state import NonlinearStateStore -from anysolver.validation import mpc_constraint_residuals +from anyfesolver.nonlinear_state import NonlinearStateStore +from anyfesolver.validation import mpc_constraint_residuals ATOL = 1.0e-10 TRANSLATION_SCALE = 1.0 @@ -1093,7 +1093,7 @@ def test_terminal_failure_causes_are_distinct_and_cause_coherent( claims completion, and both retain exactly the accepted step. No physical parameter combination is searched. """ - import anysolver.nonlinear_static as nonlinear_static + import anyfesolver.nonlinear_static as nonlinear_static def solve_with_injection(inject_after_accepted_step): model, meta = _cantilever("shared") @@ -1194,7 +1194,7 @@ def test_cancellation_after_accepted_step_preserves_committed_state( _reference_model, _reference_meta, reference = _press_reference(route) assert reference.status == "completed" - import anysolver.nonlinear_static as nonlinear_static + import anyfesolver.nonlinear_static as nonlinear_static original_commit = nonlinear_static._commit_nonlinear_state_candidate commits = [] diff --git a/tests/test_standard_edge_beam_shell_transfer.py b/tests/test_standard_edge_beam_shell_transfer.py index a4c7b715c..420f1b1b3 100644 --- a/tests/test_standard_edge_beam_shell_transfer.py +++ b/tests/test_standard_edge_beam_shell_transfer.py @@ -27,23 +27,23 @@ import pytest from scipy import sparse -from anysolver import audit_constraints -from anysolver.analysis_session import AnalysisSession -from anysolver.assembly import ( +from anyfesolver import audit_constraints +from anyfesolver.analysis_session import AnalysisSession +from anyfesolver.assembly import ( build_constraint_transformation, compute_constraint_force_diagnostics, reconstruct_full_solution, ) -from anysolver.boundary import FixedSupport, LoadCase -from anysolver.constraint_audit import require_valid_constraints -from anysolver.elements import BeamElement, CoupledBeamShellElement -from anysolver.fe_core import FEModel -from anysolver.mesh_gen import ( +from anyfesolver.boundary import FixedSupport, LoadCase +from anyfesolver.constraint_audit import require_valid_constraints +from anyfesolver.elements import BeamElement, CoupledBeamShellElement +from anyfesolver.fe_core import FEModel +from anyfesolver.mesh_gen import ( COUPLING_PARTITION_OF_UNITY_ATOL, InterpolatedBeamShellMPCElement, generate_simple_panel_mesh, ) -from anysolver.validation import mpc_constraint_residuals +from anyfesolver.validation import mpc_constraint_residuals ATOL = 1.0e-10 TRANSLATION_SCALE = 1.0 diff --git a/tests/test_static_batch.py b/tests/test_static_batch.py index c1f412659..e01a91a1b 100644 --- a/tests/test_static_batch.py +++ b/tests/test_static_batch.py @@ -3,13 +3,13 @@ import numpy as np import pytest -from anysolver import (AnalysisSession, BoundaryCondition, FixedSupport, LoadCase, +from anyfesolver import (AnalysisSession, BoundaryCondition, FixedSupport, LoadCase, StaticCase, StaticBatchError, iter_linear_batches, RecoveryConfig, ResourceConfig, CancellationToken, SolveCancelled, solve_linear, compute_constraint_force_diagnostics) -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel -from anysolver.recovery import ResourcePolicyError -from anysolver.linalg import backend_operation_counts +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.recovery import ResourcePolicyError +from anyfesolver.linalg import backend_operation_counts def _bar(supported=True): @@ -69,7 +69,7 @@ def test_selected_output_and_prepared_reactions_match_ordinary(monkeypatch): dof = model.mesh.nodes[2].dofs[0] recovery = RecoveryConfig(node_ids=[1, 2], element_ids=[1], components=["axial_stress"]) # Prepared reactions must not reassemble the stiffness or load per case. - import anysolver.assembly as assembly + import anyfesolver.assembly as assembly def refuse(*args, **kwargs): raise AssertionError("prepared reaction route reassembled system") monkeypatch.setattr(assembly, "assemble_system", refuse) @@ -135,7 +135,7 @@ def inputs(): def test_cancellation_and_owned_session_close(monkeypatch): model = _bar() created = [] - import anysolver.static_batch as module + import anyfesolver.static_batch as module original = module.AnalysisSession def make(model): session = original(model) @@ -249,7 +249,7 @@ def __float__(self): def test_single_session_free_free_and_collecting_nullspace_share_augmented_factor(): - from anysolver import solve_linear_many + from anyfesolver import solve_linear_many model = _bar(False) cases = [_case(0, 1, True), _case(1, -2, True)] with AnalysisSession(model) as session: @@ -323,9 +323,9 @@ def cases(): @pytest.mark.parametrize("kind", ["q4", "qualified_s3"]) def test_compiled_recovery_is_used_by_stream_and_reused(kind, monkeypatch): - from anysolver import generate_simple_panel_mesh - from anysolver.recovery import _compute_one_element_stress - import anysolver.recovery as module + from anyfesolver import generate_simple_panel_mesh + from anyfesolver.recovery import _compute_one_element_stress + import anyfesolver.recovery as module import numba workers = 2 if module.JIT_ENABLED and numba.config.NUMBA_NUM_THREADS >= 2 else 1 observed_workers = [] @@ -370,9 +370,9 @@ def observe_kernel(*args, **kwargs): @pytest.mark.parametrize("fail_load", [False, True]) def test_phase_thread_policy_restores_before_foreign_boundaries(monkeypatch, fail_load): import numba - import anysolver.jit_compiler as jit - import anysolver.matrix_assembly as assembly - from anysolver.threading_policy import current_solver_threads + import anyfesolver.jit_compiler as jit + import anyfesolver.matrix_assembly as assembly + from anyfesolver.threading_policy import current_solver_threads from threadpoolctl import threadpool_info initial = numba.get_num_threads() workers = 2 if jit.JIT_ENABLED and numba.config.NUMBA_NUM_THREADS >= 2 else 1 @@ -437,8 +437,8 @@ def corrupt_second_column(handle, rhs): def test_collecting_nullspace_honors_external_cache_and_refuses_conflicting_session(): - from anysolver import solve_linear_many - from anysolver.linalg import FactorizationCache + from anyfesolver import solve_linear_many + from anyfesolver.linalg import FactorizationCache model = _bar(False) cache = FactorizationCache(name="caller nullspace", max_entries=2) try: @@ -460,8 +460,8 @@ def test_collecting_nullspace_honors_external_cache_and_refuses_conflicting_sess def test_default_v2d_recovery_preserves_public_scalar_outputs(): - from anysolver import create_shell_element - from anysolver.recovery import recover_stress_result + from anyfesolver import create_shell_element + from anyfesolver.recovery import recover_stress_result model = FEModel("v2d_stream") model.add_material("steel", 100.0, 0.3) for node_id, coords in enumerate([(0, 0, 0), (1, 0, 0), (0, 1, 0)], 1): @@ -481,8 +481,8 @@ def test_default_v2d_recovery_preserves_public_scalar_outputs(): @pytest.mark.parametrize("cancel", [False, True]) @pytest.mark.parametrize("stage", ["stress", "reaction"]) def test_recovery_failure_identifies_case_and_preserves_cancellation(monkeypatch, cancel, stage): - import anysolver.recovery as recovery - import anysolver.assembly as assembly + import anyfesolver.recovery as recovery + import anyfesolver.assembly as assembly target, name = ((recovery, "recover_stress_result") if stage == "stress" else (assembly, "_compute_constraint_force_diagnostics_under_lease")) original = getattr(target, name) @@ -521,12 +521,12 @@ def close(session): def test_recovery_scope_entries_scale_with_blocks_not_cases(monkeypatch): import contextlib import numba - import anysolver.assembly as assembly_module - import anysolver.jit_compiler as jit - import anysolver.matrix_assembly as matrix_assembly - import anysolver.recovery as recovery_module - import anysolver.threading_policy as policy - from anysolver.threading_policy import current_solver_threads + import anyfesolver.assembly as assembly_module + import anyfesolver.jit_compiler as jit + import anyfesolver.matrix_assembly as matrix_assembly + import anyfesolver.recovery as recovery_module + import anyfesolver.threading_policy as policy + from anyfesolver.threading_policy import current_solver_threads from threadpoolctl import threadpool_info workers = 2 if jit.JIT_ENABLED and numba.config.NUMBA_NUM_THREADS >= 2 else 1 diff --git a/tests/test_static_batch_activity.py b/tests/test_static_batch_activity.py index d3f3766a4..d084c9404 100644 --- a/tests/test_static_batch_activity.py +++ b/tests/test_static_batch_activity.py @@ -3,11 +3,11 @@ import numpy as np import pytest -from anysolver import AnalysisSession, BoundaryCondition, FixedSupport, LoadCase, solve_linear -from anysolver.activity import ContributionPolicy, ElementActivity, ElementActivityPolicy -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel -from anysolver.matrix_assembly import assemble_mass_matrix, assemble_stiffness_matrix +from anyfesolver import AnalysisSession, BoundaryCondition, FixedSupport, LoadCase, solve_linear +from anyfesolver.activity import ContributionPolicy, ElementActivity, ElementActivityPolicy +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.matrix_assembly import assemble_mass_matrix, assemble_stiffness_matrix def _bar() -> FEModel: @@ -131,7 +131,7 @@ def test_unchanged_epoch_does_not_rescan_scales_and_prescribed_values_reuse(monk solve_linear(model, load, session=session) old_k, old_m = session.stiffness_plan(), session.mass_plan() old_constraint = session.constraint_plan() - import anysolver.matrix_assembly as assembly + import anyfesolver.matrix_assembly as assembly original = assembly._activity_scales calls = [] def observe(model, quantity): diff --git a/tests/test_static_batch_backend_counts.py b/tests/test_static_batch_backend_counts.py index d8a1a691b..518095ddb 100644 --- a/tests/test_static_batch_backend_counts.py +++ b/tests/test_static_batch_backend_counts.py @@ -2,7 +2,7 @@ import pytest from scipy import sparse -from anysolver.linalg import (FactorizationCache, MatrixClass, +from anyfesolver.linalg import (FactorizationCache, MatrixClass, PyPardisoSolverBackend, SparseSolverBackend, backend_operation_counts, _HAS_PYPARDISO) diff --git a/tests/test_static_batch_coupled_acceleration_guards.py b/tests/test_static_batch_coupled_acceleration_guards.py index 3ea41b31f..3466ef4af 100644 --- a/tests/test_static_batch_coupled_acceleration_guards.py +++ b/tests/test_static_batch_coupled_acceleration_guards.py @@ -19,14 +19,14 @@ import numpy as np import pytest -import anysolver.current_state_tangent as current_state_tangent -from anysolver import boundary -from anysolver.boundary import LoadCase -from anysolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement -from anysolver.elements import BeamElement, CoupledBeamShellElement -from anysolver.element_capabilities import ElementCapabilityError -from anysolver.fe_core import FEModel, FEMesh -from anysolver.matrix_assembly import assemble_load_matrix, assemble_load_vector +import anyfesolver.current_state_tangent as current_state_tangent +from anyfesolver import boundary +from anyfesolver.boundary import LoadCase +from anyfesolver.e4_pl_s3_element import QualifiedE4PLS3ShellElement +from anyfesolver.elements import BeamElement, CoupledBeamShellElement +from anyfesolver.element_capabilities import ElementCapabilityError +from anyfesolver.fe_core import FEModel, FEMesh +from anyfesolver.matrix_assembly import assemble_load_matrix, assemble_load_vector _GUARD_ERRORS = (Exception,) diff --git a/tests/test_static_batch_inertia_relief.py b/tests/test_static_batch_inertia_relief.py index 46bf1aef0..0235dedd5 100644 --- a/tests/test_static_batch_inertia_relief.py +++ b/tests/test_static_batch_inertia_relief.py @@ -4,13 +4,13 @@ import numpy as np import pytest -from anysolver import (AnalysisSession, CancellationToken, CoupledBeamShellElement, +from anyfesolver import (AnalysisSession, CancellationToken, CoupledBeamShellElement, BeamElement, FixedSupport, LoadCase, RecoveryConfig, ResourceConfig, SolveCancelled, StaticBatchError, StaticCase, iter_linear_batches, solve_inertia_relief, solve_linear) -from anysolver.matrix_assembly import assemble_mass_matrix, assemble_stiffness_matrix -from anysolver.assembly import build_constraint_transformation -from anysolver.recovery import ResourcePolicyError +from anyfesolver.matrix_assembly import assemble_mass_matrix, assemble_stiffness_matrix +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.recovery import ResourcePolicyError from test_inertia_relief import bar, rigid, load_vector from test_inertia_relief_integration import panel @@ -42,7 +42,7 @@ def assert_stress_values(actual, expected): @pytest.mark.parametrize("consistent", [False, True]) def test_multiple_rhs_blocks_reuse_preparation_and_match_scalar(consistent, monkeypatch): - import anysolver.inertia_relief as module + import anyfesolver.inertia_relief as module model = bar(consistent=consistent) model.mesh.point_masses[2] = .7 inputs = cases(model) @@ -104,7 +104,7 @@ def test_selected_output_rigid_acceleration_and_zero_columns_are_analytical(): def test_scalar_and_batch_share_plan_mechanism_and_factorization_across_reference_changes(monkeypatch): - import anysolver.inertia_relief as module + import anyfesolver.inertia_relief as module model = bar() case = cases(model)[0] with AnalysisSession(model) as session: @@ -205,7 +205,7 @@ def callback(event): @pytest.mark.parametrize("stage", ["static_batch.start", "inertia_relief.mechanism_iteration", "static_batch.before_solve", "static_batch.before_yield"]) def test_cancellation_propagates_and_owned_session_closes(stage, monkeypatch): - import anysolver.static_batch as module + import anyfesolver.static_batch as module model = bar() made = [] original = module.AnalysisSession @@ -221,7 +221,7 @@ def raise_if_cancelled(self, at=""): def test_numerical_non_success_never_yields_and_closes_session(monkeypatch): - import anysolver.inertia_relief as module + import anyfesolver.inertia_relief as module model = bar() monkeypatch.setattr(module, "_mechanism_check", lambda *args: {"status": "unresolved", "error": "test nonconvergence"}) with AnalysisSession(model) as session: @@ -293,7 +293,7 @@ def test_nullspace_default_refusal_and_legacy_opt_in_are_unchanged(): @pytest.mark.parametrize("mode", ["auto", "nullspace"]) def test_collecting_fast_path_relief_and_nullspace_auto(mode): - from anysolver import solve_linear_many + from anyfesolver import solve_linear_many model = bar() inputs = cases(model)[:3] with AnalysisSession(model) as session: @@ -316,7 +316,7 @@ def test_collecting_fast_path_relief_and_nullspace_auto(mode): @pytest.mark.parametrize("mass_policy,load_policy,ratio", [("delete_only", "activity", .375), ("activity", "delete_only", 1./.375), ("activity", "activity", 1.)]) def test_activity_policies_and_invalidation_are_preserved(mass_policy, load_policy, ratio): - from anysolver.activity import ElementActivity, ElementActivityPolicy + from anyfesolver.activity import ElementActivity, ElementActivityPolicy model = bar(n=1) activity = ElementActivity([1], .375, policy=ElementActivityPolicy(mass=mass_policy, load=load_policy)) model.set_element_activity(activity) @@ -352,7 +352,7 @@ def test_direct_constraint_change_does_not_reuse_physical_plan(): def test_generator_close_releases_owned_session_and_input(monkeypatch): - import anysolver.static_batch as module + import anyfesolver.static_batch as module model = bar() closed = [] made = [] @@ -370,8 +370,8 @@ def inputs(): def test_collecting_relief_external_cache_and_conflict(): - from anysolver import solve_linear_many - from anysolver.linalg import FactorizationCache + from anyfesolver import solve_linear_many + from anyfesolver.linalg import FactorizationCache model = bar() cache = FactorizationCache(name="relief caller", max_entries=2) try: @@ -387,8 +387,8 @@ def test_collecting_relief_external_cache_and_conflict(): def test_memory_preflight_accounts_for_krylov_workspace_before_certification(monkeypatch): - import anysolver.inertia_relief as module - from anysolver.recovery import estimate_model_memory + import anyfesolver.inertia_relief as module + from anyfesolver.recovery import estimate_model_memory model = bar(n=20) n = model.mesh.dof_manager.total_dofs recovery = RecoveryConfig(include_displacements=False, include_stresses=False, include_reactions=False) @@ -457,7 +457,7 @@ def drift(self, rhs): def test_admitted_mpc_structure_change_rebuilds_and_recertifies(monkeypatch): - import anysolver.inertia_relief as module + import anyfesolver.inertia_relief as module model = bar() count = [] original = module._mechanism_check @@ -488,7 +488,7 @@ def test_scalar_zero_load_has_zero_acceleration_with_reused_plan(): @pytest.mark.parametrize("kind,code", [("support", "unsupported_constraints"), ("disconnected", "disconnected_body")]) def test_empty_inputs_do_not_skip_model_admission(kind, code): - from anysolver import solve_linear_many + from anyfesolver import solve_linear_many model = bar() if kind == "support": model.add_boundary_condition(FixedSupport("fixed", [1])) else: model.add_node(99, 10., 0., 0.) @@ -515,7 +515,7 @@ def test_non_success_mechanism_details_are_detached_from_session_cache(): def test_collecting_refuses_solid_protocol_before_downstream_dispatch(): - from anysolver import InertiaReliefError, solve_linear_many + from anyfesolver import InertiaReliefError, solve_linear_many class Solid: _solid_model_protocol = True with pytest.raises(InertiaReliefError) as error: diff --git a/tests/test_static_batch_recovery_lease_scope.py b/tests/test_static_batch_recovery_lease_scope.py index e385fed28..c3e0c1713 100644 --- a/tests/test_static_batch_recovery_lease_scope.py +++ b/tests/test_static_batch_recovery_lease_scope.py @@ -13,20 +13,20 @@ import numpy as np import pytest -from anysolver import (BoundaryCondition, LoadCase, StaticCase, StaticBatchError, +from anyfesolver import (BoundaryCondition, LoadCase, StaticCase, StaticBatchError, iter_linear_batches, RecoveryConfig, SolveCancelled, solve_linear, compute_constraint_force_diagnostics) -from anysolver.matrix_assembly import AssemblyError -from anysolver.recovery import recover_stress_result +from anyfesolver.matrix_assembly import AssemblyError +from anyfesolver.recovery import recover_stress_result -import anysolver.recovery as recovery_module -import anysolver.recovery_batches as recovery_batches_module +import anyfesolver.recovery as recovery_module +import anyfesolver.recovery_batches as recovery_batches_module from test_static_batch import _bar, _case def _panel(num_divisions: int = 2): - from anysolver import generate_simple_panel_mesh + from anyfesolver import generate_simple_panel_mesh model = generate_simple_panel_mesh(1.0, 1.0, 0.01, num_divisions_x=num_divisions, num_divisions_y=num_divisions) model.boundary_conditions.clear() @@ -130,7 +130,7 @@ def test_borrowed_block_outputs_match_public_recovery_exactly(): def test_foreign_edit_inside_borrowed_operation_fails_with_case_identity( monkeypatch, ): - import anysolver.matrix_assembly as matrix_assembly_module + import anyfesolver.matrix_assembly as matrix_assembly_module model = _panel() recovery = RecoveryConfig(include_displacements=False, include_reactions=False, components=["von_mises"]) @@ -279,7 +279,7 @@ def run_in_copied_context(): @pytest.mark.parametrize("cancel", [False, True]) def test_recovery_failure_and_cancel_restore_scope_state(monkeypatch, cancel): - from anysolver.e4_pl_element import _q4_trusted_operation_accepts + from anyfesolver.e4_pl_element import _q4_trusted_operation_accepts model = _panel() recovery = RecoveryConfig(include_displacements=False, include_reactions=False, components=["von_mises"]) @@ -396,7 +396,7 @@ def test_prescribed_mpc_reactions_match_public_under_borrowed_block(): def _s3_triangle(): """One prescribed-displacement S3 triangle for token lifetime tests.""" - from anysolver import FEModel, QualifiedE4PLS3ShellElement + from anyfesolver import FEModel, QualifiedE4PLS3ShellElement model = FEModel("s3-operation-token-lifetime") model.add_material("steel", 210.0e9, 0.3, density=7850.0) coordinates = ((0.0, 0.0, 0.0), (1.0, 0.0, 0.0), @@ -415,14 +415,14 @@ def _s3_triangle(): def _trusted_operation_case(family): """Return (element, scope, accepts) for the Q4 or S3 trusted scope.""" if family == "q4": - from anysolver.e4_pl_element import ( + from anyfesolver.e4_pl_element import ( _q4_trusted_operation_accepts as accepts, _q4_trusted_operation_scope as scope, ) model = _panel(1) element = next(iter(model.mesh.elements.values())) else: - from anysolver.e4_pl_s3_element import ( + from anyfesolver.e4_pl_s3_element import ( _s3_trusted_operation_accepts as accepts, _s3_trusted_operation_scope as scope, ) @@ -434,7 +434,7 @@ def _trusted_operation_case(family): def test_copied_context_cannot_retain_q4_operation_token_after_close( monkeypatch, ): - from anysolver.e4_pl_element import _q4_trusted_operation_accepts + from anyfesolver.e4_pl_element import _q4_trusted_operation_accepts model = _panel(1) recovery = RecoveryConfig(include_displacements=False, include_reactions=False, components=["von_mises"]) @@ -467,7 +467,7 @@ def context_copying_recover(*args: Any, **kwargs: Any) -> Any: def test_copied_context_cannot_retain_s3_operation_token_after_close( monkeypatch, ): - from anysolver.e4_pl_s3_element import _s3_trusted_operation_accepts + from anyfesolver.e4_pl_s3_element import _s3_trusted_operation_accepts model = _s3_triangle() recovery = RecoveryConfig(element_ids=[1], include_displacements=False, include_reactions=False) diff --git a/tests/test_static_envelopes.py b/tests/test_static_envelopes.py index 356e0e4e3..4791263ce 100644 --- a/tests/test_static_envelopes.py +++ b/tests/test_static_envelopes.py @@ -1,7 +1,7 @@ import numpy as np import pytest -from anysolver.static_envelopes import EnvelopeReducer +from anyfesolver.static_envelopes import EnvelopeReducer def test_signed_extrema_ties_and_repeated_case_labels(): diff --git a/tests/test_stiffened_shell_accepted_observer_experimental.py b/tests/test_stiffened_shell_accepted_observer_experimental.py index cbffd92ae..a80e243d2 100644 --- a/tests/test_stiffened_shell_accepted_observer_experimental.py +++ b/tests/test_stiffened_shell_accepted_observer_experimental.py @@ -6,11 +6,11 @@ import numpy as np import pytest -from anysolver import stiffened_shell -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver -from anysolver._stiffened_shell_ge_checkpoint_binary import MAGIC as BINARY_MAGIC, decode -from anysolver._stiffened_shell_increment_control import decode_control +from anyfesolver import stiffened_shell +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver +from anyfesolver._stiffened_shell_ge_checkpoint_binary import MAGIC as BINARY_MAGIC, decode +from anyfesolver._stiffened_shell_increment_control import decode_control from test_stiffened_shell_ge_experimental import _panel from test_stiffened_shell_ge_finite_experimental import _q4_shell_j2_panel diff --git a/tests/test_stiffened_shell_admissible_polish_candidate.py b/tests/test_stiffened_shell_admissible_polish_candidate.py index 459758d45..092c8bf5e 100644 --- a/tests/test_stiffened_shell_admissible_polish_candidate.py +++ b/tests/test_stiffened_shell_admissible_polish_candidate.py @@ -9,8 +9,8 @@ import pytest from scipy import sparse -from anysolver.control import SolveCancelled -from anysolver import _stiffened_shell_ge_finite_experimental as finite +from anyfesolver.control import SolveCancelled +from anyfesolver import _stiffened_shell_ge_finite_experimental as finite def _driver(monkeypatch, responses, *, selected=True): @@ -114,7 +114,7 @@ def test_worst_work_publishes_inside_the_replay_ceiling(monkeypatch): # budget. The bounded reserve stops the last optional improvement and # publishes the re-verified retained state exactly at the controller # replay ceiling; the exact counters replay cleanly. - from anysolver._stiffened_shell_increment_control import ( + from anyfesolver._stiffened_shell_increment_control import ( AdaptiveIncrementControl, _AdaptiveState, validate_control) max_iterations, max_backtracks = 2, 1 driver, seen, published = _driver(monkeypatch, [ @@ -171,7 +171,7 @@ def test_private_checkpoint_identity_does_not_change_default(monkeypatch): @pytest.mark.parametrize('staged,adaptive', [(False, False), (True, True)]) def test_selected_real_owner_checkpoint_round_trip_and_atomic_refusal(request, staged, adaptive): - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss from test_stiffened_shell_native_plastic_chart import definition, programme model = definition() diff --git a/tests/test_stiffened_shell_arc_chart.py b/tests/test_stiffened_shell_arc_chart.py index bfff26c7f..32d814354 100644 --- a/tests/test_stiffened_shell_arc_chart.py +++ b/tests/test_stiffened_shell_arc_chart.py @@ -4,10 +4,10 @@ import numpy as np import pytest from scipy import sparse -from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver, _State -from anysolver._stiffened_shell_arc_trial import path_row -from anysolver._stiffened_shell_arc_metric import PhysicalChordMetric -from anysolver._ge_beam3_p5.algebra import rotation +from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver, _State +from anyfesolver._stiffened_shell_arc_trial import path_row +from anyfesolver._stiffened_shell_arc_metric import PhysicalChordMetric +from anyfesolver._ge_beam3_p5.algebra import rotation @pytest.mark.parametrize('plane',(False,True)) @@ -32,7 +32,7 @@ def test_actual_shell_anchor_and_beam_multiplicative_row(plane): assert (plus-minus)/(2*h)==pytest.approx(row@direction,rel=1e-8) assert np.count_nonzero(row[12:])==0 # A genuine shell chart rebase preserves physical distance, not q rotations. - from anysolver._stiffened_shell_rotation_charts import physical_frames + from anyfesolver._stiffened_shell_rotation_charts import physical_frames rebased=state.q.copy();rebased[3:6]=0. state2=replace(state,q=rebased,shell_anchors=physical_frames(state.q[:6],anchors)) assert path_row(driver,state2,parent,metric,normal)[0]==pytest.approx(value,rel=1e-13) @@ -40,7 +40,7 @@ def test_actual_shell_anchor_and_beam_multiplicative_row(plane): def test_stale_owner_and_unrepresentable_radius_rejected(): from threading import RLock - from anysolver._stiffened_shell_arc_trial import correct + from anyfesolver._stiffened_shell_arc_trial import correct owner=SimpleNamespace(_K=sparse.eye(12),_shell_count=6,_beam_ids=(1,), _bl5_shell_material=True,_free=np.arange(12),_commit_lock=RLock(), _finite_driver=object()) diff --git a/tests/test_stiffened_shell_arc_selection.py b/tests/test_stiffened_shell_arc_selection.py index 0d0839955..af14d8524 100644 --- a/tests/test_stiffened_shell_arc_selection.py +++ b/tests/test_stiffened_shell_arc_selection.py @@ -3,9 +3,9 @@ from types import SimpleNamespace import numpy as np import pytest -from anysolver.control import CancellationToken,SolveCancelled -from anysolver import _stiffened_shell_arc_trial as arc -from anysolver._stiffened_shell_arc_metric import PhysicalChordMetric +from anyfesolver.control import CancellationToken,SolveCancelled +from anyfesolver import _stiffened_shell_arc_trial as arc +from anyfesolver._stiffened_shell_arc_metric import PhysicalChordMetric def context(): @@ -47,7 +47,7 @@ def append(self,row): def test_unit_physical_normal_has_unit_origin_derivative(): - from anysolver._ge_beam3_p5.algebra import rotation + from anyfesolver._ge_beam3_p5.algebra import rotation metric=PhysicalChordMetric([.3,.7],2.) translations=np.array([[.3,.1,.2],[-.2,.4,.1]]) spins=np.array([[.2,-.1,.3],[.1,.2,-.4]]) diff --git a/tests/test_stiffened_shell_arc_trial.py b/tests/test_stiffened_shell_arc_trial.py index 364bb02b6..e3c702293 100644 --- a/tests/test_stiffened_shell_arc_trial.py +++ b/tests/test_stiffened_shell_arc_trial.py @@ -3,13 +3,13 @@ import numpy as np import pytest from scipy import sparse -from anysolver._ge_beam3_p5.algebra import rotation -from anysolver._stiffened_shell_arc_metric import PhysicalChordMetric -from anysolver._stiffened_shell_displacement_corrector import bordered_path_correction +from anyfesolver._ge_beam3_p5.algebra import rotation +from anyfesolver._stiffened_shell_arc_metric import PhysicalChordMetric +from anyfesolver._stiffened_shell_displacement_corrector import bordered_path_correction def test_physical_chord_gradient_units_frame_and_ownership(): - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss class AlteredMetric(PhysicalChordMetric):pass with pytest.raises(ValueError,match='explicit physical arc metric'): ss.ArcLengthControl('beam',105,2,AlteredMetric([1.],1.),1e-5) @@ -49,8 +49,8 @@ def test_native_arc_trial_preserves_accepted_owner(request,tmp_path): from test_stiffened_shell_bl5_coupled_material import coupled from test_stiffened_shell_bl5_material import make from test_stiffened_shell_bl5_finite import _action - from anysolver._stiffened_shell_arc_trial import correct,select_trial - from anysolver.control import CancellationToken,SolveCancelled + from anyfesolver._stiffened_shell_arc_trial import correct,select_trial + from anyfesolver.control import CancellationToken,SolveCancelled owner=make(request,coupled()) seed=(Path(__file__).parent/'data/stiffened_shell_event_excursion/force-seed.bin').read_bytes() owner.restore(seed);driver=owner._finite_driver @@ -87,8 +87,8 @@ def test_native_arc_trial_preserves_accepted_owner(request,tmp_path): with pytest.raises(SolveCancelled):correct(driver,**args,cancellation_token=token) assert owner.checkpoint()==seed from hashlib import sha256 - from anysolver._stiffened_shell_arc_checkpoint import from_selection,decode_snapshot,encode_snapshot - from anysolver._stiffened_shell_arc_publication import publish + from anyfesolver._stiffened_shell_arc_checkpoint import from_selection,decode_snapshot,encode_snapshot + from anyfesolver._stiffened_shell_arc_publication import publish raw=from_selection(owner,selected,seed_generation=owner._generation, seed_sha256=sha256(seed).hexdigest()) metadata,arrays=decode_snapshot(owner,raw) @@ -117,12 +117,12 @@ def test_native_arc_trial_preserves_accepted_owner(request,tmp_path): def test_public_arc_cancel_restart_and_absolute_load(request,tmp_path,monkeypatch): from dataclasses import replace - from anysolver import stiffened_shell as ss - from anysolver.control import CancellationToken,SolveCancelled + from anyfesolver import stiffened_shell as ss + from anyfesolver.control import CancellationToken,SolveCancelled from test_stiffened_shell_bl5_coupled_material import coupled from test_stiffened_shell_bl5_material import make from test_stiffened_shell_bl5_finite import _action - from anysolver._stiffened_shell_arc_checkpoint import decode_snapshot,encode_snapshot + from anyfesolver._stiffened_shell_arc_checkpoint import decode_snapshot,encode_snapshot owner=make(request,coupled()) seed=(Path(__file__).parent/'data/stiffened_shell_event_excursion/force-seed.bin').read_bytes() owner.restore(seed) diff --git a/tests/test_stiffened_shell_b2_affine_resolution.py b/tests/test_stiffened_shell_b2_affine_resolution.py index 8cb4bfa71..94acb3c58 100644 --- a/tests/test_stiffened_shell_b2_affine_resolution.py +++ b/tests/test_stiffened_shell_b2_affine_resolution.py @@ -5,10 +5,10 @@ import numpy as np import pytest from scipy import sparse -from anysolver import stiffened_shell as api -from anysolver import _stiffened_shell_b2_affine_resolution as proof -from anysolver import _stiffened_shell_b2_q4_panel_experimental as panel -from anysolver._b2_physical_linear_batch_dev import B2NumericalSolveFailure +from anyfesolver import stiffened_shell as api +from anyfesolver import _stiffened_shell_b2_affine_resolution as proof +from anyfesolver import _stiffened_shell_b2_q4_panel_experimental as panel +from anyfesolver._b2_physical_linear_batch_dev import B2NumericalSolveFailure from examples.stiffened_shell_b2_physical_rigid_footprint import definition diff --git a/tests/test_stiffened_shell_b2_body_acceleration.py b/tests/test_stiffened_shell_b2_body_acceleration.py index 527166149..a2f5eb0a6 100644 --- a/tests/test_stiffened_shell_b2_body_acceleration.py +++ b/tests/test_stiffened_shell_b2_body_acceleration.py @@ -5,10 +5,10 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver import stiffened_shell as api -from anysolver.control import CancellationToken -from anysolver._stiffened_shell_b2_q4_panel_experimental import ExperimentalB2Q4PanelError -from anysolver._b2_physical_flexibility_linear import RepresentabilityError +from anyfesolver import stiffened_shell as api +from anyfesolver.control import CancellationToken +from anyfesolver._stiffened_shell_b2_q4_panel_experimental import ExperimentalB2Q4PanelError +from anyfesolver._b2_physical_flexibility_linear import RepresentabilityError from test_stiffened_shell_b2_mixed_panel_experimental import _definition diff --git a/tests/test_stiffened_shell_b2_definition_copy_protocol.py b/tests/test_stiffened_shell_b2_definition_copy_protocol.py index d78515601..38e98c111 100644 --- a/tests/test_stiffened_shell_b2_definition_copy_protocol.py +++ b/tests/test_stiffened_shell_b2_definition_copy_protocol.py @@ -11,7 +11,7 @@ import pytest from scipy import sparse -from anysolver._stiffened_shell_b2_definition_ownership import ( +from anyfesolver._stiffened_shell_b2_definition_ownership import ( _Array, _CSR, _Coordinates, ) @@ -148,7 +148,7 @@ def test_coordinates_copy_and_deepcopy_are_identity_stable(): def test_definition_deepcopy_preserves_owned_views_and_admission(): from dataclasses import replace from test_stiffened_shell_b2_mixed_panel_experimental import _definition, _load - from anysolver import stiffened_shell as api + from anyfesolver import stiffened_shell as api base, _ = _definition('q4') cloned = copy.deepcopy(base) assert cloned is not base diff --git a/tests/test_stiffened_shell_b2_definition_ownership.py b/tests/test_stiffened_shell_b2_definition_ownership.py index 119041fc7..7364ee7fd 100644 --- a/tests/test_stiffened_shell_b2_definition_ownership.py +++ b/tests/test_stiffened_shell_b2_definition_ownership.py @@ -4,7 +4,7 @@ import numpy as np import pytest from scipy import sparse -from anysolver import stiffened_shell as api +from anyfesolver import stiffened_shell as api from test_stiffened_shell_b2_mixed_panel_experimental import _definition, _load from test_stiffened_shell_b2_experimental import _members from examples.stiffened_shell_b2_physical_rigid_footprint import definition as physical_definition diff --git a/tests/test_stiffened_shell_b2_experimental.py b/tests/test_stiffened_shell_b2_experimental.py index c81d2ffcb..4a5261b31 100644 --- a/tests/test_stiffened_shell_b2_experimental.py +++ b/tests/test_stiffened_shell_b2_experimental.py @@ -4,12 +4,12 @@ import pytest from scipy import sparse -from anysolver import stiffened_shell +from anyfesolver import stiffened_shell -from anysolver._stiffened_shell_b2_experimental import ( +from anyfesolver._stiffened_shell_b2_experimental import ( ExperimentalB2Error, create_experimental_b2_analysis, ) -from anysolver.control import CancellationToken +from anyfesolver.control import CancellationToken from test_b2_physical_linear_oriented_graph import _members, _solve diff --git a/tests/test_stiffened_shell_b2_footprint_reference_modes.py b/tests/test_stiffened_shell_b2_footprint_reference_modes.py index 2744ec257..bf3713c60 100644 --- a/tests/test_stiffened_shell_b2_footprint_reference_modes.py +++ b/tests/test_stiffened_shell_b2_footprint_reference_modes.py @@ -12,11 +12,11 @@ from scipy import linalg, sparse from scipy.sparse.linalg import ArpackNoConvergence -from anysolver import stiffened_shell as api -from anysolver.control import CancellationToken -from anysolver._b2_f10_f11_point_attachment import compile_reference_point -from anysolver._stiffened_shell_physical_q4_mass import physical_mass -import anysolver._stiffened_shell_b2_q4_panel_experimental as modal_owner +from anyfesolver import stiffened_shell as api +from anyfesolver.control import CancellationToken +from anyfesolver._b2_f10_f11_point_attachment import compile_reference_point +from anyfesolver._stiffened_shell_physical_q4_mass import physical_mass +import anyfesolver._stiffened_shell_b2_q4_panel_experimental as modal_owner from test_stiffened_shell_b2_nodal_rigid_footprint import ( _definition as _static_definition, _independent, _load, _owner, ) diff --git a/tests/test_stiffened_shell_b2_free_reference_modes.py b/tests/test_stiffened_shell_b2_free_reference_modes.py index 109c1d14e..6ef26fb8b 100644 --- a/tests/test_stiffened_shell_b2_free_reference_modes.py +++ b/tests/test_stiffened_shell_b2_free_reference_modes.py @@ -7,9 +7,9 @@ from scipy.sparse.linalg import ArpackNoConvergence from scipy.spatial.transform import Rotation -from anysolver import stiffened_shell as api -from anysolver.control import CancellationToken -import anysolver._stiffened_shell_b2_q4_panel_experimental as owner_module +from anyfesolver import stiffened_shell as api +from anyfesolver.control import CancellationToken +import anyfesolver._stiffened_shell_b2_q4_panel_experimental as owner_module from test_stiffened_shell_b2_mixed_reference_modes import _definition, _dense_mass from test_stiffened_shell_b2_mixed_panel_experimental import _dense_operators @@ -202,7 +202,7 @@ def test_explicit_free_policy_rejects_unsupported_definitions(bad): elif bad == "missing-mass": definition = replace(definition, members=(replace(definition.members[0], mass=None),)+definition.members[1:]) elif bad == "prestress": - from anysolver._b2_physical_linear_definition import GeometricMetadata + from anyfesolver._b2_physical_linear_definition import GeometricMetadata metadata = GeometricMetadata("geometry", (0., 0., 0.), (0., 0., 0.), (0., 0., 0.)) definition = replace(definition, members=(replace(definition.members[0], geometric=metadata),)+definition.members[1:]) with pytest.raises(ValueError): diff --git a/tests/test_stiffened_shell_b2_mixed_panel_experimental.py b/tests/test_stiffened_shell_b2_mixed_panel_experimental.py index 942774391..c9f8d9582 100644 --- a/tests/test_stiffened_shell_b2_mixed_panel_experimental.py +++ b/tests/test_stiffened_shell_b2_mixed_panel_experimental.py @@ -5,16 +5,16 @@ import pytest from scipy import sparse -from anysolver import stiffened_shell as api -from anysolver._b2_f10_f11_point_attachment import compile_reference_point, LAW_ID, S3_LAW_ID -from anysolver.control import CancellationToken -from anysolver.elements import create_shell_element -from anysolver.e4_pl_element import FORMULATION_ID as Q4_ID -from anysolver.e4_pl_s3_v2d_element import ( +from anyfesolver import stiffened_shell as api +from anyfesolver._b2_f10_f11_point_attachment import compile_reference_point, LAW_ID, S3_LAW_ID +from anyfesolver.control import CancellationToken +from anyfesolver.elements import create_shell_element +from anyfesolver.e4_pl_element import FORMULATION_ID as Q4_ID +from anyfesolver.e4_pl_s3_v2d_element import ( FORMULATION_ID as S3_ID, NativeParityCapabilityError, ) -from anysolver.fe_core import FEModel -import anysolver._stiffened_shell_b2_q4_panel_experimental as owner_module +from anyfesolver.fe_core import FEModel +import anyfesolver._stiffened_shell_b2_q4_panel_experimental as owner_module def _definition(kind="mixed"): diff --git a/tests/test_stiffened_shell_b2_mixed_reference_modes.py b/tests/test_stiffened_shell_b2_mixed_reference_modes.py index b1d3a4b95..90e6a180b 100644 --- a/tests/test_stiffened_shell_b2_mixed_reference_modes.py +++ b/tests/test_stiffened_shell_b2_mixed_reference_modes.py @@ -7,12 +7,12 @@ from scipy.sparse.linalg import ArpackNoConvergence from scipy.spatial.transform import Rotation -from anysolver import stiffened_shell as api -from anysolver.control import CancellationToken -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEModel -from anysolver._stiffened_shell_physical_q4_mass import POLICY as Q4_MASS_POLICY -import anysolver._stiffened_shell_b2_q4_panel_experimental as owner_module +from anyfesolver import stiffened_shell as api +from anyfesolver.control import CancellationToken +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver._stiffened_shell_physical_q4_mass import POLICY as Q4_MASS_POLICY +import anyfesolver._stiffened_shell_b2_q4_panel_experimental as owner_module from test_stiffened_shell_b2_mixed_panel_experimental import ( _definition as _static_definition, _dense_operators, ) @@ -222,7 +222,7 @@ def test_modal_definition_rejects_unsupported_inputs(bad): elif bad == "policy": definition = replace(definition, inertia_policy="invented") elif bad == "no-policy": definition = replace(definition, inertia_policy=None) elif bad == "geometric": - from anysolver._b2_physical_linear_definition import GeometricMetadata + from anyfesolver._b2_physical_linear_definition import GeometricMetadata geometry = GeometricMetadata("geometry", (0., 0., 0.), (0., 0., 0.), (0., 0., 0.)) definition = replace(definition, members=(replace(definition.members[0], geometric=geometry),)+definition.members[1:]) with pytest.raises(ValueError): api.create_analysis(definition=definition) diff --git a/tests/test_stiffened_shell_b2_nodal_rigid_footprint.py b/tests/test_stiffened_shell_b2_nodal_rigid_footprint.py index 3633b33a8..0ed1546bc 100644 --- a/tests/test_stiffened_shell_b2_nodal_rigid_footprint.py +++ b/tests/test_stiffened_shell_b2_nodal_rigid_footprint.py @@ -5,15 +5,15 @@ import pytest from scipy import sparse -from anysolver import stiffened_shell as api -from anysolver.control import CancellationToken -from anysolver.e4_pl_element import QualifiedE4PLShellElement -from anysolver.fe_core import FEModel -from anysolver._stiffened_shell_b2_nodal_footprint import ( +from anyfesolver import stiffened_shell as api +from anyfesolver.control import CancellationToken +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement +from anyfesolver.fe_core import FEModel +from anyfesolver._stiffened_shell_b2_nodal_footprint import ( LAW_ID, _Incidence, compile_footprints, reference_shell_matrix, selected_wrenches, ) -from anysolver._ge_beam3_pose_joint import RigidPoseJoint +from anyfesolver._ge_beam3_pose_joint import RigidPoseJoint def _definition(*, cells=2, points=False, affine=False, selected_only=False): @@ -268,7 +268,7 @@ def test_selected_batches_one_factor_and_no_unselected_recovery(request, monkeyp np.testing.assert_allclose(case.selected_displacements, (first.displacements[-5]*(i+1),), rtol=1e-8, atol=1e-12) assert len(case.footprint_wrenches) == 1 - import anysolver._stiffened_shell_b2_q4_panel_experimental as panel + import anyfesolver._stiffened_shell_b2_q4_panel_experimental as panel def forbidden(*args): raise AssertionError("unselected group recovery materialized") monkeypatch.setattr(panel, "selected_wrenches", forbidden) diff --git a/tests/test_stiffened_shell_b2_physical_equilibrium_refinement.py b/tests/test_stiffened_shell_b2_physical_equilibrium_refinement.py index 98c421518..4c63e8224 100644 --- a/tests/test_stiffened_shell_b2_physical_equilibrium_refinement.py +++ b/tests/test_stiffened_shell_b2_physical_equilibrium_refinement.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from anysolver import stiffened_shell as api +from anyfesolver import stiffened_shell as api from examples.stiffened_shell_b2_physical_rigid_footprint import definition as physical_definition diff --git a/tests/test_stiffened_shell_b2_physical_footprint_batch.py b/tests/test_stiffened_shell_b2_physical_footprint_batch.py index 8a0739a2a..1e3ced541 100644 --- a/tests/test_stiffened_shell_b2_physical_footprint_batch.py +++ b/tests/test_stiffened_shell_b2_physical_footprint_batch.py @@ -4,8 +4,8 @@ import numpy as np import pytest from scipy.spatial.transform import Rotation -from anysolver import stiffened_shell as api -from anysolver.control import CancellationToken +from anyfesolver import stiffened_shell as api +from anyfesolver.control import CancellationToken from examples.stiffened_shell_b2_physical_rigid_footprint import definition,preload,batch_workflow SELECT=api.B2PhysicalRigidFootprintSelection(("physical-left",)) @@ -61,7 +61,7 @@ def test_public_batch_counts_selected_outputs_and_envelopes(owner,count): def test_no_unselected_recovery_and_first_case_tie(owner,monkeypatch): - import anysolver._stiffened_shell_b2_q4_panel_experimental as module + import anyfesolver._stiffened_shell_b2_q4_panel_experimental as module def forbidden(*args,**kwargs):raise AssertionError("unselected wrench recovered") monkeypatch.setattr(module,"physical_selected_wrenches",forbidden) for _,(member,_) in owner._members:monkeypatch.setattr(type(member.operator),"recover_sections",forbidden) @@ -180,7 +180,7 @@ def test_invalid_later_load_and_recovery_prevalidate_without_factor(owner): def test_factory_factor_failure_with_offset_propagates(monkeypatch): - import anysolver._stiffened_shell_b2_q4_panel_experimental as module + import anyfesolver._stiffened_shell_b2_q4_panel_experimental as module d=definition();offset=np.array(d.prescribed_offset);offset[36]=.1 calls=[] def failed(*args,**kwargs):calls.append(1);raise RuntimeError("deliberate factorization failure") @@ -192,7 +192,7 @@ def failed(*args,**kwargs):calls.append(1);raise RuntimeError("deliberate factor def test_nonfirst_disjoint_pad_compact_global_provenance(monkeypatch): from scipy import sparse - import anysolver._stiffened_shell_b2_q4_panel_experimental as module + import anyfesolver._stiffened_shell_b2_q4_panel_experimental as module d=definition();nodes={1+i:(float(i),0.,0.) for i in range(4)};nodes.update({5+i:(float(i),1.,0.) for i in range(4)}) shells=tuple(api.Q4PanelShell(f"s-{i}",(i+1,i+2,i+6,i+5),1000.,.3,.15) for i in range(3)) members=tuple(api.PhysicalB2Member(f"b-{i}",f"src-{i}",(10+i,11+i),((.5+i,.5,0.),(1.5+i,.5,0.)),(0.,1.,0.),"square",d.members[0].section) for i in range(3)) diff --git a/tests/test_stiffened_shell_b2_physical_footprint_compile_sparse.py b/tests/test_stiffened_shell_b2_physical_footprint_compile_sparse.py index dc3b943b4..6b9ed8412 100644 --- a/tests/test_stiffened_shell_b2_physical_footprint_compile_sparse.py +++ b/tests/test_stiffened_shell_b2_physical_footprint_compile_sparse.py @@ -5,7 +5,7 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver._stiffened_shell_b2_physical_rigid_footprint import ( +from anyfesolver._stiffened_shell_b2_physical_rigid_footprint import ( B2PhysicalRigidFootprint, _node, compile_physical_footprints, ) diff --git a/tests/test_stiffened_shell_b2_physical_rigid_footprint.py b/tests/test_stiffened_shell_b2_physical_rigid_footprint.py index 7b46abacc..3b879d3eb 100644 --- a/tests/test_stiffened_shell_b2_physical_rigid_footprint.py +++ b/tests/test_stiffened_shell_b2_physical_rigid_footprint.py @@ -5,9 +5,9 @@ import pytest from scipy import sparse,linalg from scipy.spatial.transform import Rotation -from anysolver import stiffened_shell as api -from anysolver.control import CancellationToken -from anysolver._stiffened_shell_b2_reference_buckling import compile_geometric +from anyfesolver import stiffened_shell as api +from anyfesolver.control import CancellationToken +from anyfesolver._stiffened_shell_b2_reference_buckling import compile_geometric from examples.stiffened_shell_b2_physical_rigid_footprint import definition,preload,workflow,traction_sources @pytest.fixture @@ -58,7 +58,7 @@ def test_finite_rigid_motion_gradient_acceleration(owner): assert abs(v@h@v+g@a)<=1e-10*bound def test_tangent_basis_covariance_and_owned_arrays(owner): - from anysolver._stiffened_shell_b2_physical_rigid_footprint import _node + from anyfesolver._stiffened_shell_b2_physical_rigid_footprint import _node group=definition().physical_footprints[0];orth=np.array(((0.,-1.),(1.,0.))) changed=replace(group,tangent_basis=group.tangent_basis@orth) for old in owner._footprint_incidence: @@ -108,8 +108,8 @@ def test_public_default_workflow(): def test_native_physical_first_work_and_exp_chart_scalar(owner): - from anysolver._stiffened_shell_b2_physical_rigid_footprint import q4_exp_director_chart_correction - from anysolver.e4_pl_element import _compatible,_coefficients + from anyfesolver._stiffened_shell_b2_physical_rigid_footprint import q4_exp_director_chart_correction + from anyfesolver.e4_pl_element import _compatible,_coefficients shell,element,material_id,slots=owner._buckling_shells[0] mesh=owner._buckling_model.mesh;material=owner._buckling_model.get_material(material_id) displacement=np.array((.01,.02,.03,.04,-.02,.07,-.03,.02,-.01,.03,.05,-.04,.04,-.01,.02,-.05,.03,.06,-.02,.03,.04,.02,-.04,-.03)) @@ -137,7 +137,7 @@ def scalar(t): def test_midassembly_cancellation_no_identity(owner,monkeypatch): - import anysolver._stiffened_shell_b2_reference_buckling as service + import anyfesolver._stiffened_shell_b2_reference_buckling as service token=CancellationToken();original=service.compile_geometric def interrupted(model,request,pre,safe): def checkpoint(stage): @@ -150,7 +150,7 @@ def checkpoint(stage): def test_full_shell_frozen_green_scalar_second_variation(owner): - from anysolver._stiffened_shell_b2_physical_rigid_footprint import q4_exp_director_chart_correction + from anyfesolver._stiffened_shell_b2_physical_rigid_footprint import q4_exp_director_chart_correction shell,element,mid,slots=owner._buckling_shells[0];mesh=owner._buckling_model.mesh;material=owner._buckling_model.get_material(mid) coords=np.array([definition().shell_nodes_m[i] for i in shell.node_ids]) u=np.zeros((4,6));u[:,2]=-.5*coords[:,0]*coords[:,1];u[:,3]=-.5*coords[:,0];u[:,4]=.5*coords[:,1] @@ -181,7 +181,7 @@ def scalar(t): def test_rigid_geometry_covariance_director_reversal(owner): - from anysolver._stiffened_shell_b2_physical_rigid_footprint import _node + from anyfesolver._stiffened_shell_b2_physical_rigid_footprint import _node group=definition().physical_footprints[0];r=Rotation.from_rotvec((.3,-.2,.4)).as_matrix();lam=np.array((2.,-3.,4.,.7,-.9));block=sparse.block_diag((r,r,r,r)).toarray() for old in owner._footprint_incidence: changed=replace(group,reference_director=r@group.reference_director,tangent_basis=r@group.tangent_basis) @@ -195,7 +195,7 @@ def test_rigid_geometry_covariance_director_reversal(owner): def test_nonzero_director_multiplier_combined_shell_pad_chart(owner): - from anysolver._stiffened_shell_b2_physical_rigid_footprint import q4_exp_director_chart_correction + from anyfesolver._stiffened_shell_b2_physical_rigid_footprint import q4_exp_director_chart_correction shell,element,mid,slots=owner._buckling_shells[0];mesh=owner._buckling_model.mesh;material=owner._buckling_model.get_material(mid) coords=np.array([definition().shell_nodes_m[i] for i in shell.node_ids]) u=np.zeros((4,6));u[:,2]=-.5*coords[:,0]*coords[:,1];u[:,3]=-.5*coords[:,0];u[:,4]=.5*coords[:,1] @@ -226,7 +226,7 @@ def test_nonzero_director_multiplier_combined_shell_pad_chart(owner): def test_new_family_point_coexistence_and_selection_refuse(): d=definition() - from anysolver._stiffened_shell_b2_q4_panel_experimental import ExperimentalB2Q4PanelAnalysis + from anyfesolver._stiffened_shell_b2_q4_panel_experimental import ExperimentalB2Q4PanelAnalysis with pytest.raises(ValueError,match="separate physical footprint static family required"): ExperimentalB2Q4PanelAnalysis(d.shell_nodes_m,d.shells,d.members,(api.Q4B2Point("p","shell-1","beam-right",0.),),transformation=d.transformation,prescribed_offset=d.prescribed_offset,physical_footprints=d.physical_footprints) with pytest.raises(ValueError,match="sequence"): @@ -235,9 +235,9 @@ def test_new_family_point_coexistence_and_selection_refuse(): @pytest.mark.parametrize("reverse",(False,True)) def test_distorted_skew_frozen_shell_tensor_frame_and_scalar_work(owner,reverse): - from anysolver._stiffened_shell_b2_physical_rigid_footprint import q4_kernel_frame_resultants,_exp_director_covector_hessian - from anysolver.e4_pl_element import QualifiedE4PLShellElement - from anysolver.fe_core import FEModel + from anyfesolver._stiffened_shell_b2_physical_rigid_footprint import q4_kernel_frame_resultants,_exp_director_covector_hessian + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.fe_core import FEModel r=Rotation.from_rotvec((.3,-.2,.4)).as_matrix() plane=np.array(((0.,0.,0.),(1.3,.2,0.),(1.7,1.1,0.),(.1,.8,0.))) coords=plane@r.T;n=r[:,2]*(-1. if reverse else 1.) diff --git a/tests/test_stiffened_shell_b2_physical_work_identity.py b/tests/test_stiffened_shell_b2_physical_work_identity.py index ff338fa62..4f391e436 100644 --- a/tests/test_stiffened_shell_b2_physical_work_identity.py +++ b/tests/test_stiffened_shell_b2_physical_work_identity.py @@ -9,8 +9,8 @@ import pytest from threadpoolctl import threadpool_info -from anysolver import stiffened_shell as api -from anysolver.control import CancellationToken +from anyfesolver import stiffened_shell as api +from anyfesolver.control import CancellationToken from examples.stiffened_shell_b2_physical_rigid_footprint import definition, preload diff --git a/tests/test_stiffened_shell_b2_q4_panel_experimental.py b/tests/test_stiffened_shell_b2_q4_panel_experimental.py index 12a9cf4c0..7a0bac73c 100644 --- a/tests/test_stiffened_shell_b2_q4_panel_experimental.py +++ b/tests/test_stiffened_shell_b2_q4_panel_experimental.py @@ -7,21 +7,21 @@ from types import SimpleNamespace from scipy import sparse from scipy.linalg import null_space -from anysolver import stiffened_shell +from anyfesolver import stiffened_shell -from anysolver._b2_f10_f11_point_attachment import compile_reference_point -from anysolver._b2_physical_flexibility_linear import LinearSection -from anysolver._b2_physical_linear_definition import PhysicalB2Member -from anysolver.control import CancellationToken -from anysolver._stiffened_shell_b2_q4_panel_experimental import ( +from anyfesolver._b2_f10_f11_point_attachment import compile_reference_point +from anyfesolver._b2_physical_flexibility_linear import LinearSection +from anyfesolver._b2_physical_linear_definition import PhysicalB2Member +from anyfesolver.control import CancellationToken +from anyfesolver._stiffened_shell_b2_q4_panel_experimental import ( ExperimentalB2Q4PanelAnalysis, ExperimentalB2Q4PanelError, Q4B2Point, Q4PanelShell, _NumericalFailure, _require_independent_supported_point_rows, _scaled_point_kkt, ) -from anysolver.e4_pl_element import QualifiedE4PLShellElement -from anysolver.fe_core import FEModel -from anysolver.linalg import MatrixClass, factorize_cached +from anyfesolver.e4_pl_element import QualifiedE4PLShellElement +from anyfesolver.fe_core import FEModel +from anyfesolver.linalg import MatrixClass, factorize_cached from test_b2_f09_physical_off_axis_elbow import ( _high_precision_rounded_matrix_solve, _physical_section, ) diff --git a/tests/test_stiffened_shell_b2_q4_point_experimental.py b/tests/test_stiffened_shell_b2_q4_point_experimental.py index 940924289..7e56d866f 100644 --- a/tests/test_stiffened_shell_b2_q4_point_experimental.py +++ b/tests/test_stiffened_shell_b2_q4_point_experimental.py @@ -6,11 +6,11 @@ from scipy.linalg import null_space from types import SimpleNamespace -from anysolver._stiffened_shell_b2_q4_point_experimental import ( +from anyfesolver._stiffened_shell_b2_q4_point_experimental import ( create_experimental_b2_q4_point_analysis, _NumericalFailure, ) -from anysolver import stiffened_shell +from anyfesolver import stiffened_shell from test_b2_f10_f11_point_attachment import VERTICES, specimen diff --git a/tests/test_stiffened_shell_b2_reference_buckling.py b/tests/test_stiffened_shell_b2_reference_buckling.py index feddc7f63..3939ab8b2 100644 --- a/tests/test_stiffened_shell_b2_reference_buckling.py +++ b/tests/test_stiffened_shell_b2_reference_buckling.py @@ -6,9 +6,9 @@ import pytest from scipy.linalg import eig from scipy.spatial.transform import Rotation -from anysolver import stiffened_shell as api -from anysolver.control import CancellationToken -from anysolver._stiffened_shell_b2_reference_buckling import ( +from anyfesolver import stiffened_shell as api +from anyfesolver.control import CancellationToken +from anyfesolver._stiffened_shell_b2_reference_buckling import ( beam_reference_derivatives,member_green_hessian,point_green_hessian,compile_geometric, ) @@ -74,8 +74,8 @@ def finite(q): assert sum(error<=1. for error in first_errors)>=2,first_errors def test_full_point_curvature_matches_objective_polar_and_beam_pose_work(): - from anysolver._ge_beam3_pose_joint import RigidPoseJoint - from anysolver._b2_f10_f11_point_attachment import compile_reference_point + from anyfesolver._ge_beam3_pose_joint import RigidPoseJoint + from anyfesolver._b2_f10_f11_point_attachment import compile_reference_point owner=api.create_analysis(definition=example.definition()) try: member,_=owner._members[0][1] @@ -317,7 +317,7 @@ def test_finite_common_rigid_path_includes_gradient_acceleration_work(): finally: owner.close() def test_midassembly_cancellation_publishes_no_spectral_identity(monkeypatch): - import anysolver._stiffened_shell_b2_reference_buckling as module + import anyfesolver._stiffened_shell_b2_reference_buckling as module owner=api.create_analysis(definition=example.definition()) try: load=np.zeros(54);load[[12,30]]=-1. diff --git a/tests/test_stiffened_shell_b2_reference_modes.py b/tests/test_stiffened_shell_b2_reference_modes.py index 2fa875500..5c93d0d2a 100644 --- a/tests/test_stiffened_shell_b2_reference_modes.py +++ b/tests/test_stiffened_shell_b2_reference_modes.py @@ -8,13 +8,13 @@ from scipy import sparse, linalg from scipy.sparse.linalg import ArpackNoConvergence -from anysolver import stiffened_shell -from anysolver.control import CancellationToken -from anysolver._stiffened_shell_physical_q4_mass import physical_mass -from anysolver._stiffened_shell_b2_q4_panel_experimental import ( +from anyfesolver import stiffened_shell +from anyfesolver.control import CancellationToken +from anyfesolver._stiffened_shell_physical_q4_mass import physical_mass +from anyfesolver._stiffened_shell_b2_q4_panel_experimental import ( ExperimentalB2Q4PanelAnalysis, ExperimentalB2Q4PanelError, ) -import anysolver._stiffened_shell_b2_q4_panel_experimental as owner +import anyfesolver._stiffened_shell_b2_q4_panel_experimental as owner from test_stiffened_shell_b2_q4_panel_experimental import _panel, _independent_dense diff --git a/tests/test_stiffened_shell_b2_resolution_certificate.py b/tests/test_stiffened_shell_b2_resolution_certificate.py index 7275ab78d..eaca1f118 100644 --- a/tests/test_stiffened_shell_b2_resolution_certificate.py +++ b/tests/test_stiffened_shell_b2_resolution_certificate.py @@ -7,9 +7,9 @@ import pytest from scipy import sparse -from anysolver import stiffened_shell as api -from anysolver import _stiffened_shell_b2_q4_panel_experimental as panel -from anysolver._b2_physical_linear_batch_dev import B2NumericalSolveFailure +from anyfesolver import stiffened_shell as api +from anyfesolver import _stiffened_shell_b2_q4_panel_experimental as panel +from anyfesolver._b2_physical_linear_batch_dev import B2NumericalSolveFailure def _rigid_tip_definition(): diff --git a/tests/test_stiffened_shell_bl5_affine_supports.py b/tests/test_stiffened_shell_bl5_affine_supports.py index ba1fe66ed..18c22307a 100644 --- a/tests/test_stiffened_shell_bl5_affine_supports.py +++ b/tests/test_stiffened_shell_bl5_affine_supports.py @@ -7,9 +7,9 @@ import numpy as np import pytest -from anysolver import b3_ge, stiffened_shell as api -from anysolver._ge_beam3_retained_generalized_state import Mechanical -from anysolver._stiffened_shell_l1_assembly_experimental import _sample_rows +from anyfesolver import b3_ge, stiffened_shell as api +from anyfesolver._ge_beam3_retained_generalized_state import Mechanical +from anyfesolver._stiffened_shell_l1_assembly_experimental import _sample_rows from test_stiffened_shell_l1_assembly_experimental import _bl5_joint_mesh_definition @@ -241,7 +241,7 @@ def test_same_row_count_cannot_restore_p0_checkpoint_as_affine(): def test_affine_multiplier_curvature_through_actual_state_update(): - from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver + from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver definition = replace(candidate(4, 4), q4_pullback_policy=api.Q4_ALGORITHMIC_PULLBACK_V1) owner = api.create_analysis(definition=definition) try: diff --git a/tests/test_stiffened_shell_bl5_aggregation.py b/tests/test_stiffened_shell_bl5_aggregation.py index 810b24e13..b478b12dd 100644 --- a/tests/test_stiffened_shell_bl5_aggregation.py +++ b/tests/test_stiffened_shell_bl5_aggregation.py @@ -3,8 +3,8 @@ import numpy as np import pytest from scipy import sparse -from anysolver import stiffened_shell -from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver +from anyfesolver import stiffened_shell +from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver from test_stiffened_shell_l1_assembly_experimental import _bl5_joint_mesh_definition diff --git a/tests/test_stiffened_shell_bl5_coupled_material.py b/tests/test_stiffened_shell_bl5_coupled_material.py index 72fa492c7..09eb1b72d 100644 --- a/tests/test_stiffened_shell_bl5_coupled_material.py +++ b/tests/test_stiffened_shell_bl5_coupled_material.py @@ -5,8 +5,8 @@ import numpy as np import pytest from anymaterial import DNVC208MaterialCurve -from anysolver import stiffened_shell as ss -from anysolver._stiffened_shell_beam_history import arrays as native_history_arrays +from anyfesolver import stiffened_shell as ss +from anyfesolver._stiffened_shell_beam_history import arrays as native_history_arrays from test_stiffened_shell_bl5_material import model, make from test_stiffened_shell_bl5_finite import _action @@ -103,8 +103,8 @@ def active(response): def _coupled_history_roundtrip(request,monkeypatch,tmp_path,basis,*,reversal): - from anysolver.control import CancellationToken,SolveCancelled - from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver + from anyfesolver.control import CancellationToken,SolveCancelled + from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver definition=coupled(basis, simultaneous_yield_fixture=True);a=make(request,definition) assert "shell J2 plastic" not in a.capabilities["excluded"] programme=ss.StagedDeadLoadProgramme(a.preflight()["identity"], diff --git a/tests/test_stiffened_shell_bl5_distributed.py b/tests/test_stiffened_shell_bl5_distributed.py index 1886c80f8..690f8297b 100644 --- a/tests/test_stiffened_shell_bl5_distributed.py +++ b/tests/test_stiffened_shell_bl5_distributed.py @@ -2,9 +2,9 @@ from dataclasses import replace import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver from test_stiffened_shell_bl5_finite import _model from test_stiffened_shell_ge_distributed_load import balance diff --git a/tests/test_stiffened_shell_bl5_finite.py b/tests/test_stiffened_shell_bl5_finite.py index 731acffeb..da28a37a0 100644 --- a/tests/test_stiffened_shell_bl5_finite.py +++ b/tests/test_stiffened_shell_bl5_finite.py @@ -2,11 +2,11 @@ from dataclasses import replace import numpy as np import pytest -from anysolver import stiffened_shell -from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver -from anysolver._stiffened_shell_rotation_charts import owned_anchors, physical_frames -from anysolver._ge_beam3_p5.algebra import rotation -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver import stiffened_shell +from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver +from anyfesolver._stiffened_shell_rotation_charts import owned_anchors, physical_frames +from anyfesolver._ge_beam3_p5.algebra import rotation +from anyfesolver.control import CancellationToken, SolveCancelled from test_stiffened_shell_l1_assembly_experimental import _bl5_nonmatching_definition @@ -123,7 +123,7 @@ def test_line_rejection_preserves_accepted_prefix_and_new_schema_is_required(mon owner.solve(_action(),targets=(1.,),max_iterations=1) assert owner._generation==generation and owner.checkpoint()==saved import json - from anysolver._stiffened_shell_ge_checkpoint_binary import decode,encode,SCHEMAS + from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode,encode,SCHEMAS kind,gen,arrays=decode(saved,owner._identity,lambda _,g:tuple( (k,v.shape) for k,v in {"q":owner._finite_driver._state.q, "frames":owner._finite_driver._state.frames,"cells":owner._finite_driver._state.cells, @@ -141,7 +141,7 @@ def test_line_rejection_preserves_accepted_prefix_and_new_schema_is_required(mon def test_finite_line_adaptive_cancel_restore_and_resume(monkeypatch): - import anysolver._stiffened_shell_ge_finite_experimental as finite + import anyfesolver._stiffened_shell_ge_finite_experimental as finite definition=_model(); owner=stiffened_shell.create_analysis(definition=definition) original=finite.cancellation_safe_point; token=CancellationToken() control=stiffened_shell.AdaptiveIncrementControl(2,8) @@ -163,7 +163,7 @@ def cancel(value,stage): def test_typed_line_domain_failure_backtracks_but_programming_error_propagates(monkeypatch): - from anysolver._stiffened_shell_bl5_local_experimental import BL5LocalOperator,BL5TrialDomainError + from anyfesolver._stiffened_shell_bl5_local_experimental import BL5LocalOperator,BL5TrialDomainError original=BL5LocalOperator.evaluate_spatial; rejected=[] def candidate_failure(self,total,frames,state,multiplier): if not rejected and np.any(multiplier): @@ -185,7 +185,7 @@ def invalid(*args,**kwargs): def test_cancel_line_before_publish_keeps_fresh_owner(monkeypatch): - import anysolver._stiffened_shell_ge_finite_experimental as finite + import anyfesolver._stiffened_shell_ge_finite_experimental as finite owner=stiffened_shell.create_analysis(definition=_model()); token=CancellationToken() original=finite.cancellation_safe_point def cancel(value,stage): diff --git a/tests/test_stiffened_shell_bl5_local_experimental.py b/tests/test_stiffened_shell_bl5_local_experimental.py index 9021a11f5..218b7f4b2 100644 --- a/tests/test_stiffened_shell_bl5_local_experimental.py +++ b/tests/test_stiffened_shell_bl5_local_experimental.py @@ -6,8 +6,8 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver._stiffened_shell_bl5_local_experimental import BL5LocalOperator -from anysolver._stiffened_shell_l1_local_experimental import ( +from anyfesolver._stiffened_shell_bl5_local_experimental import BL5LocalOperator +from anyfesolver._stiffened_shell_l1_local_experimental import ( L1LocalOperator, NativeHalfCellPort, ) from scripts._b3_e4_f03_native_fixture import build diff --git a/tests/test_stiffened_shell_bl5_material.py b/tests/test_stiffened_shell_bl5_material.py index e09b20a63..8c1bcf9be 100644 --- a/tests/test_stiffened_shell_bl5_material.py +++ b/tests/test_stiffened_shell_bl5_material.py @@ -2,9 +2,9 @@ from dataclasses import replace import numpy as np import pytest -from anysolver import b3_ge, stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver +from anyfesolver import b3_ge, stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver from test_stiffened_shell_bl5_finite import _model, _action diff --git a/tests/test_stiffened_shell_bl5_projected_density.py b/tests/test_stiffened_shell_bl5_projected_density.py index 00063afcc..3656c2679 100644 --- a/tests/test_stiffened_shell_bl5_projected_density.py +++ b/tests/test_stiffened_shell_bl5_projected_density.py @@ -8,9 +8,9 @@ import numpy as np import pytest -from anysolver import b3_ge, stiffened_shell as api -from anysolver._ge_beam3_retained_generalized_state import Mechanical -from anysolver._stiffened_shell_l1_assembly_experimental import _sample_rows +from anyfesolver import b3_ge, stiffened_shell as api +from anyfesolver._ge_beam3_retained_generalized_state import Mechanical +from anyfesolver._stiffened_shell_l1_assembly_experimental import _sample_rows from test_stiffened_shell_bl5_affine_supports import candidate from test_stiffened_shell_l1_assembly_experimental import _bl5_joint_mesh_definition @@ -180,7 +180,7 @@ def test_physical_cell_means_all_channels_and_common_row_projection(nonuniform): def test_projected_multiplier_curvature_through_actual_state_update(): - from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver + from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver definition = replace(projected_definition(), q4_pullback_policy=api.Q4_ALGORITHMIC_PULLBACK_V1) owner = api.create_analysis(definition=definition) diff --git a/tests/test_stiffened_shell_bl5_staged_loads.py b/tests/test_stiffened_shell_bl5_staged_loads.py index ba366e70a..df584648a 100644 --- a/tests/test_stiffened_shell_bl5_staged_loads.py +++ b/tests/test_stiffened_shell_bl5_staged_loads.py @@ -3,8 +3,8 @@ import pytest from dataclasses import replace -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled from test_stiffened_shell_bl5_finite import _model, _action diff --git a/tests/test_stiffened_shell_consumer_capabilities.py b/tests/test_stiffened_shell_consumer_capabilities.py index d9c6e504a..b8f6314bf 100644 --- a/tests/test_stiffened_shell_consumer_capabilities.py +++ b/tests/test_stiffened_shell_consumer_capabilities.py @@ -8,17 +8,17 @@ import pytest from scipy import sparse -from anysolver import stiffened_shell -from anysolver import _stiffened_shell_consumer_capabilities as consumer -from anysolver._stiffened_shell_b2_experimental import ExperimentalB2Capabilities -from anysolver._stiffened_shell_b2_q4_panel_experimental import ( +from anyfesolver import stiffened_shell +from anyfesolver import _stiffened_shell_consumer_capabilities as consumer +from anyfesolver._stiffened_shell_b2_experimental import ExperimentalB2Capabilities +from anyfesolver._stiffened_shell_b2_q4_panel_experimental import ( ExperimentalB2MixedReferenceModalCapabilities, ExperimentalB2Q4FootprintCapabilities, B2PhysicalRigidFootprintCapabilities, ) -from anysolver._stiffened_shell_b2_nodal_footprint import ( +from anyfesolver._stiffened_shell_b2_nodal_footprint import ( B2NodalRigidFootprint, LAW_ID as NODAL_LAW, ) -from anysolver._stiffened_shell_b2_physical_rigid_footprint import ( +from anyfesolver._stiffened_shell_b2_physical_rigid_footprint import ( B2PhysicalRigidFootprint, LAW_ID as PHYSICAL_LAW, ) diff --git a/tests/test_stiffened_shell_coordinate_support_work_oracle.py b/tests/test_stiffened_shell_coordinate_support_work_oracle.py index 221b93cfc..bc51a77e6 100644 --- a/tests/test_stiffened_shell_coordinate_support_work_oracle.py +++ b/tests/test_stiffened_shell_coordinate_support_work_oracle.py @@ -8,7 +8,7 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver._stiffened_shell_coordinate_support import reactions +from anyfesolver._stiffened_shell_coordinate_support import reactions @pytest.mark.parametrize("anchor_vector", [(0., 0., 0.), (.2, -.1, .05)]) diff --git a/tests/test_stiffened_shell_coupled_convergence_repair.py b/tests/test_stiffened_shell_coupled_convergence_repair.py index 1fa445f7a..7b06732f9 100644 --- a/tests/test_stiffened_shell_coupled_convergence_repair.py +++ b/tests/test_stiffened_shell_coupled_convergence_repair.py @@ -28,12 +28,12 @@ import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver._ge_beam3_p5.algebra import rotation -from anysolver._ge_beam3_retained_generalized_state import Mechanical -from anysolver._stiffened_shell_ge_finite_experimental import ( +from anyfesolver import stiffened_shell as ss +from anyfesolver._ge_beam3_p5.algebra import rotation +from anyfesolver._ge_beam3_retained_generalized_state import Mechanical +from anyfesolver._stiffened_shell_ge_finite_experimental import ( FinitePointDriver, _State, _owned) -from anysolver._stiffened_shell_rotation_charts import physical_frames +from anyfesolver._stiffened_shell_rotation_charts import physical_frames from test_stiffened_shell_bl5_coupled_material import coupled from test_stiffened_shell_bl5_finite import _action diff --git a/tests/test_stiffened_shell_coupled_predictor_accounting.py b/tests/test_stiffened_shell_coupled_predictor_accounting.py index 89b7c71f3..3612a6cc1 100644 --- a/tests/test_stiffened_shell_coupled_predictor_accounting.py +++ b/tests/test_stiffened_shell_coupled_predictor_accounting.py @@ -3,10 +3,10 @@ import numpy as np import pytest from scipy import sparse -from anysolver._stiffened_shell_increment_control import ( +from anyfesolver._stiffened_shell_increment_control import ( AdaptiveIncrementControl, FiniteIncrementFailure, IncrementAttempt, _AdaptiveState, validate_control) -from anysolver._stiffened_shell_ge_finite_experimental import ( +from anyfesolver._stiffened_shell_ge_finite_experimental import ( FinitePointDriver, _RotationStepTooLarge, BL5TrialDomainError, DistributingPoseDomainError) @@ -243,7 +243,7 @@ def merit(amount): def test_cancellation_is_observed_around_the_probe_without_partial_commit(): - from anysolver.control import SolveCancelled + from anyfesolver.control import SolveCancelled class Token: def __init__(self, stage): diff --git a/tests/test_stiffened_shell_coupled_probe_window.py b/tests/test_stiffened_shell_coupled_probe_window.py index 50edc4464..df6f932af 100644 --- a/tests/test_stiffened_shell_coupled_probe_window.py +++ b/tests/test_stiffened_shell_coupled_probe_window.py @@ -16,9 +16,9 @@ import pytest from scipy import sparse -from anysolver.control import SolveCancelled -from anysolver._stiffened_shell_increment_control import FiniteIncrementFailure -from anysolver._stiffened_shell_ge_finite_experimental import ( +from anyfesolver.control import SolveCancelled +from anyfesolver._stiffened_shell_increment_control import FiniteIncrementFailure +from anyfesolver._stiffened_shell_ge_finite_experimental import ( FinitePointDriver, BL5TrialDomainError) OLD = 0.06382978723404312 diff --git a/tests/test_stiffened_shell_curved_arc.py b/tests/test_stiffened_shell_curved_arc.py index aed87e276..ec467e5b8 100644 --- a/tests/test_stiffened_shell_curved_arc.py +++ b/tests/test_stiffened_shell_curved_arc.py @@ -1,13 +1,13 @@ """Elastic curved point arc lifecycle; not roof capacity qualification.""" import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled from test_stiffened_shell_curved_reference_seam import curved_panel def test_curved_elastic_arc_cancel_restore_continue(request, tmp_path): - from anysolver._stiffened_shell_arc_checkpoint import decode_snapshot, encode_snapshot + from anyfesolver._stiffened_shell_arc_checkpoint import decode_snapshot, encode_snapshot def make(): owner=ss.create_analysis(definition=curved_panel()) request.addfinalizer(owner.close) diff --git a/tests/test_stiffened_shell_curved_material.py b/tests/test_stiffened_shell_curved_material.py index 77f345735..04fa45f1d 100644 --- a/tests/test_stiffened_shell_curved_material.py +++ b/tests/test_stiffened_shell_curved_material.py @@ -3,15 +3,15 @@ import numpy as np import pytest from scipy.spatial.transform import Rotation -from anysolver import stiffened_shell as ss -from anysolver.fe_core import FEModel -from anysolver.elements import create_shell_element -from anysolver.e4_pl_s3_state import canonical_json_bytes -from anysolver._stiffened_shell_q4_algorithmic_pullback import response,local_coordinates +from anyfesolver import stiffened_shell as ss +from anyfesolver.fe_core import FEModel +from anyfesolver.elements import create_shell_element +from anyfesolver.e4_pl_s3_state import canonical_json_bytes +from anyfesolver._stiffened_shell_q4_algorithmic_pullback import response,local_coordinates from test_stiffened_shell_q4_algorithmic_pullback import yielded,_local,_rigid from test_stiffened_shell_ge_finite_experimental import _q4_shell_j2_panel,_actions from test_stiffened_shell_curved_reference_seam import curved_panel -from anysolver.control import CancellationToken,SolveCancelled +from anyfesolver.control import CancellationToken,SolveCancelled def assert_generalized_records_equal(left,right): @@ -101,9 +101,9 @@ def test_old_curved_material_guards_and_new_policy_limits(request): owner.continue_arc_length(_actions(),control) with pytest.raises(ValueError,match='curved material displacement control'): owner.solve(_actions(),(.1,),displacement_control=object()) - from anysolver._stiffened_shell_arc_checkpoint import MAGIC as ARC_MAGIC - from anysolver._stiffened_shell_displacement_checkpoint import MAGIC as DISPLACEMENT_MAGIC - from anysolver._stiffened_shell_displacement_adaptive import MAGIC as ADAPTIVE_MAGIC,EVENT_MAGIC + from anyfesolver._stiffened_shell_arc_checkpoint import MAGIC as ARC_MAGIC + from anyfesolver._stiffened_shell_displacement_checkpoint import MAGIC as DISPLACEMENT_MAGIC + from anyfesolver._stiffened_shell_displacement_adaptive import MAGIC as ADAPTIVE_MAGIC,EVENT_MAGIC with pytest.raises(ValueError,match='arc snapshot'): owner.restore(ARC_MAGIC) assert cap['displacement_control']=='experimental_curved_material_point_translation_v1' diff --git a/tests/test_stiffened_shell_curved_material_arc.py b/tests/test_stiffened_shell_curved_material_arc.py index 501b899d3..4bdeada0b 100644 --- a/tests/test_stiffened_shell_curved_material_arc.py +++ b/tests/test_stiffened_shell_curved_material_arc.py @@ -3,8 +3,8 @@ import json import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled from test_stiffened_shell_curved_material import ( curved_material_panel, make_owner, _actions, assert_generalized_records_equal) @@ -18,7 +18,7 @@ def control_for(owner, orientation): @pytest.mark.parametrize('orientation',[-1,1]) def test_material_arc_prefix_restart(request,tmp_path,monkeypatch,orientation): - from anysolver._stiffened_shell_arc_checkpoint import decode_snapshot,encode_snapshot + from anyfesolver._stiffened_shell_arc_checkpoint import decode_snapshot,encode_snapshot d=curved_material_panel();owner=make_owner(request,d) seed=owner.solve(_actions(),(.5,1.),max_iterations=20,max_backtracks=12) seed_checkpoint=owner.checkpoint() @@ -67,7 +67,7 @@ def stop(result): encode_snapshot(owner,dict(m,policy='B3_GE_CURVED_ELASTIC_POINT_TANGENT_PLANE_V1_DEV'),a) with pytest.raises(ValueError,match='arc history'):owner.solve(_actions()) # Candidate validation finishes, but cancellation before commit is atomic. - from anysolver import _stiffened_shell_arc_publication as publication + from anyfesolver import _stiffened_shell_arc_publication as publication prefix=owner.checkpoint();generation=owner._generation;cancel=CancellationToken() safe_point=publication.cancellation_safe_point def cancel_at_commit(token,where): @@ -90,7 +90,7 @@ def cancel_at_commit(token,where): def test_material_arc_without_shell_j2(request): - from anysolver._stiffened_shell_arc_checkpoint import decode_snapshot + from anyfesolver._stiffened_shell_arc_checkpoint import decode_snapshot d=curved_material_panel();d=replace(d,shell=replace(d.shell,j2_curve=None)) owner=make_owner(request,d);owner.solve(_actions(),(.5,1.),max_iterations=20,max_backtracks=12) result=owner.continue_arc_length(_actions(),control_for(owner,-1)) diff --git a/tests/test_stiffened_shell_curved_material_checkpoint.py b/tests/test_stiffened_shell_curved_material_checkpoint.py index 8c94eaed9..7b204031e 100644 --- a/tests/test_stiffened_shell_curved_material_checkpoint.py +++ b/tests/test_stiffened_shell_curved_material_checkpoint.py @@ -4,9 +4,9 @@ from math import fsum import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver._stiffened_shell_ge_checkpoint_binary import MAGIC,decode,encode -from anysolver._stiffened_shell_ge_finite_experimental import _position_pair +from anyfesolver import stiffened_shell as ss +from anyfesolver._stiffened_shell_ge_checkpoint_binary import MAGIC,decode,encode +from anyfesolver._stiffened_shell_ge_finite_experimental import _position_pair from test_stiffened_shell_curved_material import ( curved_material_panel,_actions,make_owner,assert_generalized_records_equal, ) diff --git a/tests/test_stiffened_shell_curved_material_displacement.py b/tests/test_stiffened_shell_curved_material_displacement.py index 8a169601a..83a7e326f 100644 --- a/tests/test_stiffened_shell_curved_material_displacement.py +++ b/tests/test_stiffened_shell_curved_material_displacement.py @@ -3,8 +3,8 @@ import json import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken,SolveCancelled +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken,SolveCancelled from test_stiffened_shell_curved_material import ( curved_material_panel,make_owner,_actions,assert_generalized_records_equal) @@ -20,8 +20,8 @@ def material_equal(a,b): @pytest.mark.parametrize('sign',[-1,1]) def test_curved_displacement_active_prefix_restart_and_force_parity(request,monkeypatch,tmp_path,sign): - from anysolver._stiffened_shell_displacement_checkpoint import decode_snapshot,encode_snapshot - from anysolver import _stiffened_shell_displacement_control as publication + from anyfesolver._stiffened_shell_displacement_checkpoint import decode_snapshot,encode_snapshot + from anyfesolver import _stiffened_shell_displacement_control as publication d=replace(curved_material_panel(),retained_scale_policy='native_force_moment_roles_v1') owner=make_owner(request,d) seed=owner.solve(_actions(),(.5,1.),max_iterations=20,max_backtracks=12) @@ -87,7 +87,7 @@ def before_commit(token,where): def test_curved_displacement_elastic_shell_event_and_chart_restart(request): - from anysolver._stiffened_shell_displacement_checkpoint import decode_snapshot + from anyfesolver._stiffened_shell_displacement_checkpoint import decode_snapshot d=curved_material_panel();d=replace(d,shell=replace(d.shell,j2_curve=None)) owner=make_owner(request,d);owner.solve(_actions(),(.5,1.),max_iterations=20,max_backtracks=12) dof=owner._shell_count+6*owner._beam_index[105]+2 diff --git a/tests/test_stiffened_shell_curved_material_scaling.py b/tests/test_stiffened_shell_curved_material_scaling.py index 7c156246d..d53fdf098 100644 --- a/tests/test_stiffened_shell_curved_material_scaling.py +++ b/tests/test_stiffened_shell_curved_material_scaling.py @@ -2,7 +2,7 @@ from dataclasses import replace import numpy as np import pytest -from anysolver import stiffened_shell as ss,b3_ge +from anyfesolver import stiffened_shell as ss,b3_ge from test_stiffened_shell_curved_material import ( curved_material_panel,make_owner,_actions,assert_generalized_records_equal) from test_stiffened_shell_curved_material_arc import control_for diff --git a/tests/test_stiffened_shell_curved_material_staged.py b/tests/test_stiffened_shell_curved_material_staged.py index 22312e83b..826613912 100644 --- a/tests/test_stiffened_shell_curved_material_staged.py +++ b/tests/test_stiffened_shell_curved_material_staged.py @@ -2,8 +2,8 @@ from dataclasses import replace import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken,SolveCancelled +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken,SolveCancelled from test_stiffened_shell_curved_material import curved_material_panel,make_owner,_actions from test_stiffened_shell_curved_material_displacement import material_equal @@ -92,8 +92,8 @@ def test_curved_staged_profile_and_progress_failures_are_atomic(request): # Reframe a valid binary endpoint with valid digests: mechanical checks, # not checksum failure, must reject changed applied loads/predecessors. import json - from anysolver._stiffened_shell_staged_load_experimental import decode_checkpoint,encode_checkpoint - from anysolver._stiffened_shell_ge_checkpoint_binary import MAGIC,decode,encode + from anyfesolver._stiffened_shell_staged_load_experimental import decode_checkpoint,encode_checkpoint + from anyfesolver._stiffened_shell_ge_checkpoint_binary import MAGIC,decode,encode descriptor,position,inner=decode_checkpoint(raw) start=len(MAGIC)+4;length=int.from_bytes(inner[len(MAGIC):start],'little') header=json.loads(inner[start:start+length]) @@ -113,7 +113,7 @@ def test_curved_staged_profile_and_progress_failures_are_atomic(request): def test_curved_staged_rebase_and_before_publish_cancellation(request,monkeypatch): - from anysolver import _stiffened_shell_ge_finite_experimental as finite + from anyfesolver import _stiffened_shell_ge_finite_experimental as finite owner=make_owner(request,curved_material_panel());plan=programme(owner) previous=owner.solve(plan,(.5,1.),**OPTIONS) before=owner.checkpoint();generation=owner._generation;token=CancellationToken() diff --git a/tests/test_stiffened_shell_curved_material_staged_reversal.py b/tests/test_stiffened_shell_curved_material_staged_reversal.py index 42c3a938d..abe7bbfdb 100644 --- a/tests/test_stiffened_shell_curved_material_staged_reversal.py +++ b/tests/test_stiffened_shell_curved_material_staged_reversal.py @@ -2,7 +2,7 @@ from dataclasses import replace import json import numpy as np -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from test_stiffened_shell_curved_material import curved_material_panel,make_owner,_actions from test_stiffened_shell_curved_material_staged import OPTIONS from test_stiffened_shell_curved_material_displacement import material_equal diff --git a/tests/test_stiffened_shell_curved_reference_seam.py b/tests/test_stiffened_shell_curved_reference_seam.py index d81d8c1b9..2eedd5bd4 100644 --- a/tests/test_stiffened_shell_curved_reference_seam.py +++ b/tests/test_stiffened_shell_curved_reference_seam.py @@ -1,10 +1,10 @@ """Tilted-facet and point-pose foundation; public curved admission stays closed.""" import numpy as np from scipy.spatial.transform import Rotation -from anysolver.fe_core import FEModel -from anysolver.elements import create_shell_element -from anysolver._stiffened_shell_q4_algorithmic_pullback import response,local_coordinates -from anysolver._ge_beam3_pose_joint import RigidPoseJoint +from anyfesolver.fe_core import FEModel +from anyfesolver.elements import create_shell_element +from anyfesolver._stiffened_shell_q4_algorithmic_pullback import response,local_coordinates +from anyfesolver._ge_beam3_pose_joint import RigidPoseJoint from docs.reference_cases.stiffened_shell_e04_roof import build import pytest @@ -73,7 +73,7 @@ def test_curved_point_reference_pose_is_incremental_not_facet_normal(): def test_curved_policy_rejects_physical_fibres(): from dataclasses import replace - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss from test_stiffened_shell_ge_physical_fibre_linear import _definition definition = replace(_definition(), q4_pullback_policy=ss.Q4_ALGORITHMIC_PULLBACK_V1, @@ -84,7 +84,7 @@ def test_curved_policy_rejects_physical_fibres(): def curved_panel(): from dataclasses import replace - from anysolver import b3_ge,stiffened_shell as ss + from anyfesolver import b3_ge,stiffened_shell as ss from test_stiffened_shell_ge_experimental import _panel base=_panel();xyz=np.array(base.shell.coordinates_m,copy=True) xyz[:,2]+=.02*xyz[:,0]**2 @@ -104,7 +104,7 @@ def curved_panel(): @pytest.mark.parametrize('curved',(False,True)) def test_explicit_curved_point_owner_reference_finite_restart(request,force,curved,tmp_path): from dataclasses import replace - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss definition=curved_panel() if not curved: from test_stiffened_shell_ge_experimental import _panel @@ -121,7 +121,7 @@ def make(d=definition): action=(ss.NodalAction('beam',105,(0.,0.,-force,0.,0.,0.)),) result=linear.solve_linear(action) assert result.free_equilibrium_ratio<=1e-8 - from anysolver._stiffened_shell_increment_control import FiniteIncrementFailure + from anyfesolver._stiffened_shell_increment_control import FiniteIncrementFailure from dataclasses import asdict try:a=owner.solve(action,(.1,.2)) except FiniteIncrementFailure as error: @@ -145,7 +145,7 @@ def make(d=definition): raw_linear['load'][3]=1. with pytest.raises(ValueError,match='translational load'): make().restore(json.dumps(raw_linear).encode()) - from anysolver._stiffened_shell_ge_body_load import MAGIC + from anyfesolver._stiffened_shell_ge_body_load import MAGIC with pytest.raises(ValueError,match='external load checkpoints'):make().restore(MAGIC+b'invalid') assert not owner.capabilities['body_acceleration'] assert not owner.capabilities['shell_pressure_loads'] diff --git a/tests/test_stiffened_shell_curved_s3_point.py b/tests/test_stiffened_shell_curved_s3_point.py index 716e7b4af..92d83e639 100644 --- a/tests/test_stiffened_shell_curved_s3_point.py +++ b/tests/test_stiffened_shell_curved_s3_point.py @@ -6,11 +6,11 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver import stiffened_shell as ss -from anysolver._ge_beam3_pose_joint import _exp_terms -from anysolver._ge_beam3_variational_shell import deformation, response -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEModel +from anyfesolver import stiffened_shell as ss +from anyfesolver._ge_beam3_pose_joint import _exp_terms +from anyfesolver._ge_beam3_variational_shell import deformation, response +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEModel from test_stiffened_shell_curved_reference_seam import curved_panel diff --git a/tests/test_stiffened_shell_displacement_adaptive.py b/tests/test_stiffened_shell_displacement_adaptive.py index bc524de98..fd0d66a9c 100644 --- a/tests/test_stiffened_shell_displacement_adaptive.py +++ b/tests/test_stiffened_shell_displacement_adaptive.py @@ -1,7 +1,7 @@ """Adaptive signed displacement: rejected work and accepted-prefix restart.""" import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken,SolveCancelled +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken,SolveCancelled from test_stiffened_shell_bl5_coupled_material import coupled from test_stiffened_shell_bl5_material import make from test_stiffened_shell_bl5_finite import _action @@ -18,7 +18,7 @@ def test_cutback_cancel_restart_preserves_attempts(request,monkeypatch,policy): initial=float(owner._finite_driver._state.q[dof]);targets=(initial*1.01,initial*1.02) control=ss.DisplacementControl("beam",105,2,trial_policy=policy);limits=ss.AdaptiveIncrementControl(2,8) kw=dict(displacement_control=control,increment_control=limits,max_iterations=20,max_backtracks=12) - import anysolver._stiffened_shell_displacement_control as module + import anyfesolver._stiffened_shell_displacement_control as module original=module.correct;first=True def fail_once(driver,**args): nonlocal first diff --git a/tests/test_stiffened_shell_displacement_checkpoint.py b/tests/test_stiffened_shell_displacement_checkpoint.py index 0208be6aa..940d03bf2 100644 --- a/tests/test_stiffened_shell_displacement_checkpoint.py +++ b/tests/test_stiffened_shell_displacement_checkpoint.py @@ -1,7 +1,7 @@ """Controller framing only; physical restoration remains a separate requirement.""" import numpy as np import pytest -from anysolver._stiffened_shell_displacement_checkpoint import ( +from anyfesolver._stiffened_shell_displacement_checkpoint import ( _layout,encode_snapshot,decode_snapshot) from test_stiffened_shell_bl5_coupled_material import coupled from test_stiffened_shell_bl5_material import make @@ -50,8 +50,8 @@ def test_inconsistent_controller_snapshot_rejected(request,fault): def test_event_snapshot_zero_work_identity_and_strict_fields(request): from hashlib import sha256 import json - from anysolver._stiffened_shell_displacement_checkpoint import MAGIC,EVENT_POLICY - from anysolver._stiffened_shell_branch_event_trial import POLICY as TRIAL + from anyfesolver._stiffened_shell_displacement_checkpoint import MAGIC,EVENT_POLICY + from anyfesolver._stiffened_shell_branch_event_trial import POLICY as TRIAL owner,_,args=fixture(request) raw=encode_snapshot(owner,**args,trial_policy=TRIAL) m,_=decode_snapshot(owner,raw) diff --git a/tests/test_stiffened_shell_displacement_corrector.py b/tests/test_stiffened_shell_displacement_corrector.py index e32ad2cce..43c5cdf24 100644 --- a/tests/test_stiffened_shell_displacement_corrector.py +++ b/tests/test_stiffened_shell_displacement_corrector.py @@ -2,7 +2,7 @@ import numpy as np import pytest from scipy import sparse -from anysolver._stiffened_shell_displacement_corrector import bordered_correction +from anyfesolver._stiffened_shell_displacement_corrector import bordered_correction @pytest.mark.parametrize("coupling",(0.,3.)) @@ -24,10 +24,10 @@ def test_fixed_control_rejected(): def test_coupled_displacement_trial_preserves_owner_and_predecessor(request,monkeypatch): - from anysolver import stiffened_shell as ss - from anysolver.control import CancellationToken,SolveCancelled - from anysolver._stiffened_shell_displacement_corrector import correct - from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver + from anyfesolver import stiffened_shell as ss + from anyfesolver.control import CancellationToken,SolveCancelled + from anyfesolver._stiffened_shell_displacement_corrector import correct + from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver from test_stiffened_shell_bl5_coupled_material import coupled from test_stiffened_shell_bl5_material import make from test_stiffened_shell_bl5_finite import _action @@ -50,9 +50,9 @@ def test_coupled_displacement_trial_preserves_owner_and_predecessor(request,monk assert np.max([np.max(s["alpha"]) for s in trial.evaluation[4]])>0. assert owner.checkpoint()==saved from hashlib import sha256 - from anysolver._stiffened_shell_displacement_checkpoint import encode_snapshot,validate_endpoint - from anysolver._stiffened_shell_ge_finite_experimental import _material_arrays,_shell_material_arrays - from anysolver._stiffened_shell_rotation_charts import physical_frames + from anyfesolver._stiffened_shell_displacement_checkpoint import encode_snapshot,validate_endpoint + from anyfesolver._stiffened_shell_ge_finite_experimental import _material_arrays,_shell_material_arrays + from anyfesolver._stiffened_shell_rotation_charts import physical_frames state=trial.state anchors=(np.tile(np.eye(3),(len(owner._shell_ids),1,1)) if state.shell_anchors is None else state.shell_anchors) diff --git a/tests/test_stiffened_shell_displacement_increment.py b/tests/test_stiffened_shell_displacement_increment.py index 366464ec3..b1afd33ff 100644 --- a/tests/test_stiffened_shell_displacement_increment.py +++ b/tests/test_stiffened_shell_displacement_increment.py @@ -3,8 +3,8 @@ import math from copy import deepcopy import pytest -from anysolver._stiffened_shell_displacement_increment import DisplacementIncrementState as State,DisplacementIncrementLimit -from anysolver._stiffened_shell_increment_control import AdaptiveIncrementControl +from anyfesolver._stiffened_shell_displacement_increment import DisplacementIncrementState as State,DisplacementIncrementLimit +from anyfesolver._stiffened_shell_increment_control import AdaptiveIncrementControl def record(state,accepted): diff --git a/tests/test_stiffened_shell_displacement_public.py b/tests/test_stiffened_shell_displacement_public.py index 5ef9d3bf9..51ea98cca 100644 --- a/tests/test_stiffened_shell_displacement_public.py +++ b/tests/test_stiffened_shell_displacement_public.py @@ -1,8 +1,8 @@ """Experimental displacement workflow, including accepted-prefix persistence.""" import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken,SolveCancelled +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken,SolveCancelled from test_stiffened_shell_bl5_coupled_material import coupled from test_stiffened_shell_bl5_material import make from test_stiffened_shell_bl5_finite import _action @@ -43,7 +43,7 @@ def observe(result): restored=make(request,coupled());restored.restore(saved) assert restored.checkpoint()==saved np.testing.assert_array_equal(restored.recover().shell_displacement,prefix.shell_displacement) - import anysolver._stiffened_shell_displacement_control as module + import anyfesolver._stiffened_shell_displacement_control as module def broken(*args,**kwargs):raise RuntimeError("injected prepublication failure") with monkeypatch.context() as patch: patch.setattr(module,"prepare",broken) @@ -54,7 +54,7 @@ def broken(*args,**kwargs):raise RuntimeError("injected prepublication failure") owner.solve(_action(50.),(1.,)) with pytest.raises(ValueError,match="match restart"): owner.solve(_action(51.),(targets[1],),**kw) - import anysolver._stiffened_shell_displacement_corrector as corrector + import anyfesolver._stiffened_shell_displacement_corrector as corrector def no_step(matrix,*args):return np.zeros(matrix.shape[0]),0. with monkeypatch.context() as patch: patch.setattr(corrector,"bordered_correction",no_step) diff --git a/tests/test_stiffened_shell_displacement_rebase.py b/tests/test_stiffened_shell_displacement_rebase.py index f9608ce04..8ad42e8de 100644 --- a/tests/test_stiffened_shell_displacement_rebase.py +++ b/tests/test_stiffened_shell_displacement_rebase.py @@ -1,9 +1,9 @@ """Displacement chart events preserve accepted history and pending control.""" import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_displacement_checkpoint import decode_snapshot, POLICY, CHART_POLICY, EVENT_POLICY, encode_snapshot +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_displacement_checkpoint import decode_snapshot, POLICY, CHART_POLICY, EVENT_POLICY, encode_snapshot from test_stiffened_shell_bl5_coupled_material import coupled from test_stiffened_shell_bl5_material import make from test_stiffened_shell_bl5_finite import _action @@ -27,7 +27,7 @@ def test_chart_event_pending_adaptive_restart(request, monkeypatch,policy): m,a=decode_snapshot(owner,owner._displacement_snapshot[0]);assert m["policy"]==(POLICY if policy is None else EVENT_POLICY) with pytest.raises(ValueError,match="generation"): owner.rebase_rotations(before.generation-1) - import anysolver._stiffened_shell_displacement_control as control + import anyfesolver._stiffened_shell_displacement_control as control original=control.cancellation_safe_point def cancel_before_commit(token,point): if point=="stiffened-shell.displacement.publish":token.cancel("precommit") @@ -74,7 +74,7 @@ def cancel_before_commit(token,point): np.testing.assert_allclose(final.support_reactions,baseline.support_reactions,rtol=1e-8,atol=1e-8) np.testing.assert_allclose(final.shell_layer_alpha,baseline.shell_layer_alpha,rtol=1e-9,atol=1e-14) np.testing.assert_allclose(final.beam_station_accumulated,baseline.beam_station_accumulated,rtol=1e-9,atol=1e-14) - from anysolver._stiffened_shell_ge_finite_experimental import _material_arrays, _shell_material_arrays + from anyfesolver._stiffened_shell_ge_finite_experimental import _material_arrays, _shell_material_arrays _,accepted=decode_snapshot(owner,owner._displacement_snapshot[0]) for actual,expected in zip(_material_arrays(owner._finite_driver._beam_origins), (accepted["beam_plastic"],accepted["beam_accumulated"])): diff --git a/tests/test_stiffened_shell_displacement_s3_checkpoint_binary.py b/tests/test_stiffened_shell_displacement_s3_checkpoint_binary.py index d398df2cd..247ea0575 100644 --- a/tests/test_stiffened_shell_displacement_s3_checkpoint_binary.py +++ b/tests/test_stiffened_shell_displacement_s3_checkpoint_binary.py @@ -3,7 +3,7 @@ from hashlib import sha256 import numpy as np import pytest -from anysolver._stiffened_shell_ge_checkpoint_binary import ( +from anyfesolver._stiffened_shell_ge_checkpoint_binary import ( encode_s3, decode_s3, NATIVE_SHELL_DISPLACEMENT_MAGIC) @@ -64,7 +64,7 @@ def test_displacement_s3_rejects_incompatible_configuration(options, states): def test_shared_s3_replay_rejects_incomplete_accepted_history(): from types import SimpleNamespace - from anysolver._stiffened_shell_ge_finite_experimental import _require_native_s3_replay + from anyfesolver._stiffened_shell_ge_finite_experimental import _require_native_s3_replay owner = SimpleNamespace(_shell_parts=(object(),)) with pytest.raises(ValueError, match='complete accepted shell'): _require_native_s3_replay(owner, None, (), ()) @@ -73,7 +73,7 @@ def test_shared_s3_replay_rejects_incomplete_accepted_history(): @pytest.mark.parametrize('bad_support', (False, True)) def test_shared_s3_restore_rejects_bad_predecessor_before_deserialization(bad_support): from types import SimpleNamespace - from anysolver._stiffened_shell_ge_finite_experimental import _restore_native_s3_histories + from anyfesolver._stiffened_shell_ge_finite_experimental import _restore_native_s3_histories owner = SimpleNamespace(_definition=SimpleNamespace(shell=SimpleNamespace( q4_elements=(), s3_elements=(object(),))), _shell_count=6, _shell_ids=(1,), _fixed=np.array((0,))) diff --git a/tests/test_stiffened_shell_distributed_material_history.py b/tests/test_stiffened_shell_distributed_material_history.py index 347390a37..e66cd0ac5 100644 --- a/tests/test_stiffened_shell_distributed_material_history.py +++ b/tests/test_stiffened_shell_distributed_material_history.py @@ -2,9 +2,9 @@ import json import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_increment_control import FiniteIncrementFailure +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_increment_control import FiniteIncrementFailure from examples.stiffened_shell_coupled_plastic_history import definition, activity, OPTIONS, CONTROL diff --git a/tests/test_stiffened_shell_distributed_programme_material_history.py b/tests/test_stiffened_shell_distributed_programme_material_history.py index 8270f338a..a64a8ac0d 100644 --- a/tests/test_stiffened_shell_distributed_programme_material_history.py +++ b/tests/test_stiffened_shell_distributed_programme_material_history.py @@ -2,8 +2,8 @@ import numpy as np import pytest from dataclasses import replace -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled from examples.stiffened_shell_coupled_plastic_history import definition, activity, OPTIONS, CONTROL diff --git a/tests/test_stiffened_shell_distributing_adaptive.py b/tests/test_stiffened_shell_distributing_adaptive.py index e061d7d69..4e943a9b8 100644 --- a/tests/test_stiffened_shell_distributing_adaptive.py +++ b/tests/test_stiffened_shell_distributing_adaptive.py @@ -4,10 +4,10 @@ import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver -from anysolver._stiffened_shell_increment_control import decode_control, encode_control +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver +from anyfesolver._stiffened_shell_increment_control import decode_control, encode_control from test_stiffened_shell_ge_distributing_finite_public import definition as elastic_definition, actions as elastic_actions from test_stiffened_shell_ge_distributing_material import definition as material_definition, actions as material_actions diff --git a/tests/test_stiffened_shell_distributing_cyclic.py b/tests/test_stiffened_shell_distributing_cyclic.py index 433138361..e102fb26d 100644 --- a/tests/test_stiffened_shell_distributing_cyclic.py +++ b/tests/test_stiffened_shell_distributing_cyclic.py @@ -5,10 +5,10 @@ import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_increment_control import encode_control, _AdaptiveState -from anysolver._stiffened_shell_ge_checkpoint_binary import decode, encode +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_increment_control import encode_control, _AdaptiveState +from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode, encode from test_stiffened_shell_ge_distributing_material import definition as base_definition, actions HISTORY = (.25, .5, .75, 1., .75, .5, .25, 0., -.25, -.5, -.75, -1., -.5, 0., .5, 1.) @@ -59,7 +59,7 @@ def shapes(kind, generation): # Reuse this bounded fixture's validated metadata only to recover # its exact arrays for canonical tampering, not production decode. import json - from anysolver._stiffened_shell_ge_checkpoint_binary import MAGIC + from anyfesolver._stiffened_shell_ge_checkpoint_binary import MAGIC start = len(MAGIC)+4 size = int.from_bytes(raw[len(MAGIC):start], "little") header = json.loads(raw[start:start+size]) diff --git a/tests/test_stiffened_shell_distributing_footprint.py b/tests/test_stiffened_shell_distributing_footprint.py index d8c544c2f..014970d36 100644 --- a/tests/test_stiffened_shell_distributing_footprint.py +++ b/tests/test_stiffened_shell_distributing_footprint.py @@ -5,8 +5,8 @@ import numpy as np import pytest -from anysolver import _stiffened_shell_distributing_footprint as footprint -from anysolver._stiffened_shell_b2_nodal_footprint import reference_shell_matrix +from anyfesolver import _stiffened_shell_distributing_footprint as footprint +from anyfesolver._stiffened_shell_b2_nodal_footprint import reference_shell_matrix def fixture(): diff --git a/tests/test_stiffened_shell_distributing_native_material.py b/tests/test_stiffened_shell_distributing_native_material.py index 4331f64c9..b89ffa0bf 100644 --- a/tests/test_stiffened_shell_distributing_native_material.py +++ b/tests/test_stiffened_shell_distributing_native_material.py @@ -10,9 +10,9 @@ import pytest from anymaterial import DNVC208MaterialCurve -from anysolver import b3_ge, stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_ge_checkpoint_binary import MAGIC, decode, encode +from anyfesolver import b3_ge, stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_ge_checkpoint_binary import MAGIC, decode, encode from test_stiffened_shell_ge_distributing_finite_public import definition as elastic_definition @@ -210,7 +210,7 @@ def observe(result): def test_mixed_biaxial_yield_and_cancel_after_recovery_before_publication(monkeypatch): - from anysolver import _stiffened_shell_ge_finite_experimental as finite + from anyfesolver import _stiffened_shell_ge_finite_experimental as finite model = definition(mixed=True, yielding="biaxial", biaxial=True) owner = ss.create_analysis(definition=model) resumed = ss.create_analysis(definition=model) diff --git a/tests/test_stiffened_shell_distributing_native_reverse_flow.py b/tests/test_stiffened_shell_distributing_native_reverse_flow.py index 61c285452..9887a0ffc 100644 --- a/tests/test_stiffened_shell_distributing_native_reverse_flow.py +++ b/tests/test_stiffened_shell_distributing_native_reverse_flow.py @@ -4,7 +4,7 @@ import numpy as np -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from test_stiffened_shell_distributing_native_material import definition, checks diff --git a/tests/test_stiffened_shell_distributing_native_tangent.py b/tests/test_stiffened_shell_distributing_native_tangent.py index a5ccfafdc..9829d98b3 100644 --- a/tests/test_stiffened_shell_distributing_native_tangent.py +++ b/tests/test_stiffened_shell_distributing_native_tangent.py @@ -5,8 +5,8 @@ import numpy as np import pytest -from anysolver import b3_ge, stiffened_shell as ss -from anysolver._stiffened_shell_beam_history import arrays as native_history_arrays +from anyfesolver import b3_ge, stiffened_shell as ss +from anyfesolver._stiffened_shell_beam_history import arrays as native_history_arrays from test_stiffened_shell_distributing_native_material import definition, packed diff --git a/tests/test_stiffened_shell_distributing_pose.py b/tests/test_stiffened_shell_distributing_pose.py index 5f6e49166..f3e0fa4fd 100644 --- a/tests/test_stiffened_shell_distributing_pose.py +++ b/tests/test_stiffened_shell_distributing_pose.py @@ -3,14 +3,14 @@ import pytest from scipy import sparse -from anysolver import _stiffened_shell_distributing_footprint as reference -from anysolver._stiffened_shell_distributing_pose import ( +from anyfesolver import _stiffened_shell_distributing_footprint as reference +from anyfesolver._stiffened_shell_distributing_pose import ( FiniteDistributingPose, DistributingPoseDomainError, ) -from anysolver._ge_beam3_mixed_ad import rotation_exponential as exp -from anysolver._ge_beam3_mixed_ad import RotationDomainError -from anysolver._ge_beam3_pose_joint import _exp_terms -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver._ge_beam3_mixed_ad import rotation_exponential as exp +from anyfesolver._ge_beam3_mixed_ad import RotationDomainError +from anyfesolver._ge_beam3_pose_joint import _exp_terms +from anyfesolver.control import CancellationToken, SolveCancelled def fixture(nx=2,ny=1): @@ -227,7 +227,7 @@ def test_explicit_physical_domain_failures(kind): def test_compensated_positions_ownership_and_cancellation(): c,p,x,Q,rb,Qb=fixture();lam=np.ones(6) - from anysolver._ge_beam3_p5.compensated_coordinates import split_sum + from anyfesolver._ge_beam3_p5.compensated_coordinates import split_sum shift=np.array((1e12,-2e12,3e12));correction=np.array((1e-9,-2e-9,3e-9)) low=np.empty_like(x);bl=np.empty_like(rb) for i,j in np.ndindex(x.shape):x[i,j],low[i,j]=split_sum((float(x[i,j]),float(shift[j]))) diff --git a/tests/test_stiffened_shell_e03_coarse_screen.py b/tests/test_stiffened_shell_e03_coarse_screen.py index f99e43495..bc8989432 100644 --- a/tests/test_stiffened_shell_e03_coarse_screen.py +++ b/tests/test_stiffened_shell_e03_coarse_screen.py @@ -19,10 +19,10 @@ def prepared(tmp_path, monkeypatch): monkeypatch.setattr(screen, "MODULE_MANIFEST", "modules.json") case = reference.build_case(0, 1) provider = tmp_path/"site" - origin = provider/"anysolver/__init__.py" + origin = provider/"anyfesolver/__init__.py" origin.parent.mkdir(parents=True) origin.write_bytes(b"synthetic installed origin") - (tmp_path/"modules.json").write_text(json.dumps({"source_modules":{"anysolver/__init__.py":sha(origin.read_bytes())}})) + (tmp_path/"modules.json").write_text(json.dumps({"source_modules":{"anyfesolver/__init__.py":sha(origin.read_bytes())}})) resource = tmp_path/"resource.json" resource.write_bytes(b'{"status":"synthetic"}') bindings = dict(phase="native", case_id=case["case_id"], source_root=str(tmp_path), @@ -44,8 +44,8 @@ def prepared(tmp_path, monkeypatch): "command", "wheel_sha256", "source_sha256", "module_manifest_sha256")} receipt.update(deck_sha256=json.loads((folder/"metadata.json").read_text())["deck_sha256"], exit_code=0, timed_out=False, process_wall_seconds=.01, resource_receipt_path=str(resource), - resource_receipt_sha256=sha(resource.read_bytes()), anysolver_origin=str(origin), - anysolver_origin_sha256=sha(origin.read_bytes())) + resource_receipt_sha256=sha(resource.read_bytes()), anyfesolver_origin=str(origin), + anyfesolver_origin_sha256=sha(origin.read_bytes())) return folder, receipt, result @@ -160,7 +160,7 @@ def test_nonfinite_receipt_preserves_raw(prepared): def test_actual_child_origin_hash_mismatch(prepared): - prepared[1]["anysolver_origin_sha256"] = "wrong" + prepared[1]["anyfesolver_origin_sha256"] = "wrong" with pytest.raises(ValueError, match="origin must match"): finish(prepared) assert (prepared[0]/"received/native_result.raw").is_file() diff --git a/tests/test_stiffened_shell_e03_reference.py b/tests/test_stiffened_shell_e03_reference.py index 5a9282b33..8eec556f9 100644 --- a/tests/test_stiffened_shell_e03_reference.py +++ b/tests/test_stiffened_shell_e03_reference.py @@ -59,7 +59,7 @@ def test_fitted_port_transpose_work_and_world_wrench(sign): @pytest.mark.parametrize("sign", (-1, 1)) def test_native_b2_world_rows_and_dual_multiplier_map(sign): # Local reference-law control only: no owner compilation or global solve. - from anysolver._b2_f10_f11_point_attachment import compile_reference_point + from anyfesolver._b2_f10_f11_point_attachment import compile_reference_point case = ref.build_case(0, sign) definition, _, _, _ = native.b2_definition(case) diff --git a/tests/test_stiffened_shell_e04_geometry.py b/tests/test_stiffened_shell_e04_geometry.py index 8ee55ec22..d1784bda6 100644 --- a/tests/test_stiffened_shell_e04_geometry.py +++ b/tests/test_stiffened_shell_e04_geometry.py @@ -28,7 +28,7 @@ def test_roof_reference_geometry_and_measures(size): with pytest.raises(ValueError):c.shell_positions.setflags(write=True) # The present owner must keep rejecting a curved reference until the local # frame/pullback/attachment extension is implemented and verified. - from anysolver._stiffened_shell_ge_experimental import _shell_reference,ShellPanel + from anyfesolver._stiffened_shell_ge_experimental import _shell_reference,ShellPanel panel=ShellPanel(node_ids=tuple(range(1,n+1)),coordinates_m=c.shell_positions, q4_elements=tuple(tuple(int(i)+1 for i in q) for q in c.quads), young_pa=c.young,poisson=c.poisson,thickness_m=c.thickness,density_kg_m3=1.) @@ -52,7 +52,7 @@ def test_reference_metric_converges_for_affine_physical_translation(): def test_roof_public_definition_preserves_geometry_and_centroidal_section(): from docs.reference_cases.stiffened_shell_e04_roof import definition - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss c=build(4,4);d=definition(c,density_kg_m3=1.) assert d.shell_reference_policy==ss.CURVED_Q4_POINT_REFERENCE_V1 assert len(d.points)==len(c.point_pairs) diff --git a/tests/test_stiffened_shell_e04_material.py b/tests/test_stiffened_shell_e04_material.py index aba0b9ec7..4258040eb 100644 --- a/tests/test_stiffened_shell_e04_material.py +++ b/tests/test_stiffened_shell_e04_material.py @@ -2,7 +2,7 @@ import numpy as np import pytest from anymaterial import DNVC208MaterialCurve -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from docs.reference_cases.stiffened_shell_e04_roof import build,definition,material_definition LIMITS=(500.,300.,300.,1.,2.,.5) diff --git a/tests/test_stiffened_shell_event_material_excursion.py b/tests/test_stiffened_shell_event_material_excursion.py index 445ae53e3..baacf8763 100644 --- a/tests/test_stiffened_shell_event_material_excursion.py +++ b/tests/test_stiffened_shell_event_material_excursion.py @@ -4,7 +4,7 @@ from decimal import Decimal,localcontext from math import fsum import numpy as np -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from test_stiffened_shell_bl5_coupled_material import coupled from test_stiffened_shell_bl5_material import make from test_stiffened_shell_bl5_finite import _action diff --git a/tests/test_stiffened_shell_f05_assembled_plastic.py b/tests/test_stiffened_shell_f05_assembled_plastic.py index 5c2c7b58a..534734cab 100644 --- a/tests/test_stiffened_shell_f05_assembled_plastic.py +++ b/tests/test_stiffened_shell_f05_assembled_plastic.py @@ -8,9 +8,9 @@ import pytest from scipy.sparse.linalg import spsolve -from anysolver import stiffened_shell -from anysolver._stiffened_shell_ge_finite_experimental import _material_arrays -from anysolver.e4_pl_s3_state import canonical_json_bytes +from anyfesolver import stiffened_shell +from anyfesolver._stiffened_shell_ge_finite_experimental import _material_arrays +from anyfesolver.e4_pl_s3_state import canonical_json_bytes from test_stiffened_shell_ge_finite_experimental import _actions from test_stiffened_shell_q4_pullback_owner import _definition diff --git a/tests/test_stiffened_shell_fibre_chart_boundary_comparison.py b/tests/test_stiffened_shell_fibre_chart_boundary_comparison.py index 10444b5c2..0cab56b14 100644 --- a/tests/test_stiffened_shell_fibre_chart_boundary_comparison.py +++ b/tests/test_stiffened_shell_fibre_chart_boundary_comparison.py @@ -56,12 +56,12 @@ import numpy as np import pytest -from anysolver._ge_beam3_fibre_cell import CellHistory -from anysolver._ge_beam3_fibre_section import ( +from anyfesolver._ge_beam3_fibre_cell import CellHistory +from anyfesolver._ge_beam3_fibre_section import ( Fibre, FibreHistory, FlowCurve, PhysicalFibreSection) -from anysolver._ge_beam3_retained_fibre import RetainedFibreOperator -from anysolver._ge_beam3_station_resultant_cell import history_row, pair -from anysolver._stiffened_shell_ge_finite_experimental import ( +from anyfesolver._ge_beam3_retained_fibre import RetainedFibreOperator +from anyfesolver._ge_beam3_station_resultant_cell import history_row, pair +from anyfesolver._stiffened_shell_ge_finite_experimental import ( BeamFibreEnergyRecovery, BeamFibreStationRecovery) from test_stiffened_shell_staged_material_history import _material_close diff --git a/tests/test_stiffened_shell_fit_precision.py b/tests/test_stiffened_shell_fit_precision.py index bffdcede3..863e45da9 100644 --- a/tests/test_stiffened_shell_fit_precision.py +++ b/tests/test_stiffened_shell_fit_precision.py @@ -1,7 +1,7 @@ """Physical small-rotation precision and differentiated normalization.""" import numpy as np import pytest -from anysolver._ge_beam3_variational_shell import _quaternion_jets,deformation +from anyfesolver._ge_beam3_variational_shell import _quaternion_jets,deformation @pytest.mark.parametrize('angle',[0.,1e-12,-1e-12,1e-7,-1e-7,.5,np.pi/2,2.]) def test_stable_fit_analytic_rotation_and_normalization(angle): @@ -36,7 +36,7 @@ def test_stable_fit_derivatives_at_finite_rotation_and_deformation(count): @pytest.mark.parametrize('width',[1.,1e-5,1e-6]) def test_stable_fit_repeated_lower_spectrum_and_existing_top_gap(width): - from anysolver._ge_beam3_variational_shell import _davenport + from anyfesolver._ge_beam3_variational_shell import _davenport ref=np.array([[-1.,-width,0.],[1.,-width,0.],[1.,width,0.],[-1.,width,0.]]) if width==1e-6: with pytest.raises(ValueError,match='nonunique'):_quaternion_jets(ref,None,displacement=np.zeros_like(ref)) diff --git a/tests/test_stiffened_shell_footprint_increment_charts.py b/tests/test_stiffened_shell_footprint_increment_charts.py index 3252d8bde..9eaf13716 100644 --- a/tests/test_stiffened_shell_footprint_increment_charts.py +++ b/tests/test_stiffened_shell_footprint_increment_charts.py @@ -6,10 +6,10 @@ import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver import _stiffened_shell_ge_finite_experimental as finite -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_rotation_charts import physical_frames +from anyfesolver import stiffened_shell as ss +from anyfesolver import _stiffened_shell_ge_finite_experimental as finite +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_rotation_charts import physical_frames from test_stiffened_shell_nodal_rigid_footprint import _definition, _owner, _group_checks @@ -192,7 +192,7 @@ def test_loaded_origin_chart_actual_update_derivative(request, record_property, @pytest.mark.parametrize("mixed", (False, True, "all-s3")) def test_current_chart_corruption_and_cross_policy_restore_reject_atomically(request, mixed): - from anysolver._stiffened_shell_ge_checkpoint_binary import decode_chart, encode_chart + from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode_chart, encode_chart owner = _owner(request, _charted_definition(mixed)) legacy = _owner(request, _definition(mixed)) actions = (ss.NodalAction("beam", 105, (0., 0., 10., 0., 0., 0.)),) diff --git a/tests/test_stiffened_shell_ge_body_load.py b/tests/test_stiffened_shell_ge_body_load.py index 980bdff7d..b84bdf511 100644 --- a/tests/test_stiffened_shell_ge_body_load.py +++ b/tests/test_stiffened_shell_ge_body_load.py @@ -6,7 +6,7 @@ import pytest from scipy import sparse -from anysolver._stiffened_shell_ge_body_load import GEBodyLoad, encode_checkpoint, decode_checkpoint +from anyfesolver._stiffened_shell_ge_body_load import GEBodyLoad, encode_checkpoint, decode_checkpoint from test_stiffened_shell_native_gravity import reference, inertia diff --git a/tests/test_stiffened_shell_ge_coordinate_support.py b/tests/test_stiffened_shell_ge_coordinate_support.py index 6444ec820..f7c75b09b 100644 --- a/tests/test_stiffened_shell_ge_coordinate_support.py +++ b/tests/test_stiffened_shell_ge_coordinate_support.py @@ -6,11 +6,11 @@ import pytest from scipy import sparse from scipy.spatial.transform import Rotation -from anysolver import stiffened_shell as api -from anysolver import _stiffened_shell_coordinate_support as support -from anysolver._ge_beam3_pose_joint import _exp_terms -from anysolver._stiffened_shell_ge_checkpoint_binary import decode_chart,encode_chart -from anysolver.control import CancellationToken,SolveCancelled +from anyfesolver import stiffened_shell as api +from anyfesolver import _stiffened_shell_coordinate_support as support +from anyfesolver._ge_beam3_pose_joint import _exp_terms +from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode_chart,encode_chart +from anyfesolver.control import CancellationToken,SolveCancelled from test_stiffened_shell_ge_experimental import _panel from test_stiffened_shell_ge_finite_experimental import _actions from test_stiffened_shell_ge_owned_rebase import _poses @@ -139,7 +139,7 @@ def test_local_counterexample_dual_and_complete_residual_curvature(): def test_physical_equilibrium_guard_is_not_a_chart_covector_norm(): - from anysolver._stiffened_shell_ge_experimental import _linear_equilibrium + from anyfesolver._stiffened_shell_ge_experimental import _linear_equilibrium q=np.zeros(6);q[3]=np.pi-2e-7;fixed=np.array([],dtype=int) applied=np.array([0,0,1.,0,0,0]);spatial=np.array([0,0,0,0,2.2e-8,0]) r,_,f,_,physical,physical_f=support.pullback(q,None,6,fixed,spatial,sparse.csc_matrix((6,6)),applied) @@ -185,7 +185,7 @@ def test_operation_and_private_context_refusal_before_work(monkeypatch): lambda:o.solve(_actions(),increment_control=object()),lambda:o.solve(_actions(),displacement_control=object()), lambda:o.solve((api.NodalAction('beam',105,(0,0,1,1,0,0)),))): with pytest.raises(ValueError):call() - from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver + from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver o._external_context=object() with pytest.raises(ValueError,match='contexts'):FinitePointDriver(o) finally:o.close() diff --git a/tests/test_stiffened_shell_ge_dense_assembly_oracle.py b/tests/test_stiffened_shell_ge_dense_assembly_oracle.py index 8db792882..0d16d00e9 100644 --- a/tests/test_stiffened_shell_ge_dense_assembly_oracle.py +++ b/tests/test_stiffened_shell_ge_dense_assembly_oracle.py @@ -5,16 +5,16 @@ import numpy as np import pytest -from anysolver._ge_beam3_generalized_static_boundary import spatial_jacobian -from anysolver._ge_beam3_pose_joint import RigidPoseJoint -from anysolver._ge_beam3_variational_shell import response as variational_shell_response -from anysolver._stiffened_shell_ge_experimental import ( +from anyfesolver._ge_beam3_generalized_static_boundary import spatial_jacobian +from anyfesolver._ge_beam3_pose_joint import RigidPoseJoint +from anyfesolver._ge_beam3_variational_shell import response as variational_shell_response +from anyfesolver._stiffened_shell_ge_experimental import ( ExperimentalGEAnalysis, NodalAction, ) -from anysolver._stiffened_shell_ge_finite_experimental import ( +from anyfesolver._stiffened_shell_ge_finite_experimental import ( FinitePointDriver, _position_pair, ) -from anysolver.corotational import corotational_element_response +from anyfesolver.corotational import corotational_element_response from test_stiffened_shell_ge_experimental import _panel diff --git a/tests/test_stiffened_shell_ge_director_pressure.py b/tests/test_stiffened_shell_ge_director_pressure.py index 2b0392a32..10414cc34 100644 --- a/tests/test_stiffened_shell_ge_director_pressure.py +++ b/tests/test_stiffened_shell_ge_director_pressure.py @@ -3,10 +3,10 @@ import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver -from anysolver._stiffened_shell_ge_pressure_load import ( +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver +from anyfesolver._stiffened_shell_ge_pressure_load import ( DIRECTOR_CONFIGURATION, DIRECTOR_LOAD_POLICY, POLICY, VECTOR_EQUILIBRIUM_POLICY, decode_checkpoint, ) from test_stiffened_shell_ge_pressure_owner import owner, balance, load @@ -101,7 +101,7 @@ def test_q4_rejects_s3_specific_surface(request): def test_policy_substitution_and_mixed_surface_reporting(request): from hashlib import sha256 - from anysolver._stiffened_shell_ge_pressure_load import MAGIC, _canonical, _json + from anyfesolver._stiffened_shell_ge_pressure_load import MAGIC, _canonical, _json a = owner(request, 's3') action = director_load(a) payload = action.to_payload() diff --git a/tests/test_stiffened_shell_ge_distributed_curved.py b/tests/test_stiffened_shell_ge_distributed_curved.py index 14d7f5f5f..ea5f0d427 100644 --- a/tests/test_stiffened_shell_ge_distributed_curved.py +++ b/tests/test_stiffened_shell_ge_distributed_curved.py @@ -1,9 +1,9 @@ """Nonzero curved-force derivative through actual mixed-owner coordinates.""" from dataclasses import replace import numpy as np -from anysolver import b3_ge, stiffened_shell as ss -from anysolver._ge_beam3_p5.algebra import rotation -from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver +from anyfesolver import b3_ge, stiffened_shell as ss +from anyfesolver._ge_beam3_p5.algebra import rotation +from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver from test_stiffened_shell_ge_experimental import _panel from test_stiffened_shell_ge_distributed_load import owner, load diff --git a/tests/test_stiffened_shell_ge_distributed_load.py b/tests/test_stiffened_shell_ge_distributed_load.py index 8678d0abe..180c55573 100644 --- a/tests/test_stiffened_shell_ge_distributed_load.py +++ b/tests/test_stiffened_shell_ge_distributed_load.py @@ -2,10 +2,10 @@ from dataclasses import replace import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_ge_distributed_load import decode_checkpoint, encode_checkpoint -from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_ge_distributed_load import decode_checkpoint, encode_checkpoint +from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver from test_stiffened_shell_ge_experimental import _panel @@ -22,7 +22,7 @@ def load(a, force=(0.,0.,-100.), couple=(3.,5.,2.)): def test_compiled_stage_density_scatter_reuses_geometry(request,monkeypatch): from types import SimpleNamespace - import anysolver._stiffened_shell_native_distributed_load as native + import anyfesolver._stiffened_shell_native_distributed_load as native a=owner(request);context=load(a).compile(a) state=SimpleNamespace(q=np.zeros(context.count), cells=np.tile(np.eye(3),(context.beam_count,2,1,1))) @@ -123,7 +123,7 @@ def broken(self,*args,**kwargs): def test_global_load_derivative_has_no_couple_chart_skew(request): - from anysolver._ge_beam3_p5.algebra import rotation + from anyfesolver._ge_beam3_p5.algebra import rotation a=owner(request);driver=FinitePointDriver(a) pattern,_=driver._prepare_load(load(a),(.1,)) with pytest.raises(ValueError):driver._prepare_load(load(a,couple=(3.,5.,3.)),(.1,)) @@ -173,8 +173,8 @@ def cancel(result):token.cancel('complete distributed prefix') def test_nonsequential_ids_partial_loading_independent_scatter(request): - from anysolver import b3_ge - from anysolver._stiffened_shell_native_distributed_load import compile_native_distributed + from anyfesolver import b3_ge + from anyfesolver._stiffened_shell_native_distributed_load import compile_native_distributed base=_panel();beams=[] for old,newid in zip(base.beams,(71,13)): element,inertia=old.instantiate();ref=element.operator.reference diff --git a/tests/test_stiffened_shell_ge_distributed_programme.py b/tests/test_stiffened_shell_ge_distributed_programme.py index eb80519ce..1444e0fb8 100644 --- a/tests/test_stiffened_shell_ge_distributed_programme.py +++ b/tests/test_stiffened_shell_ge_distributed_programme.py @@ -4,10 +4,10 @@ import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_ge_distributed_programme import decode_checkpoint -from anysolver._stiffened_shell_increment_control import FiniteIncrementFailure +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_ge_distributed_programme import decode_checkpoint +from anyfesolver._stiffened_shell_increment_control import FiniteIncrementFailure from test_stiffened_shell_ge_distributed_load import owner, balance, load @@ -22,7 +22,7 @@ def test_descriptor_and_density_interpolation(request,monkeypatch): assert ss.GEBeamDistributedProgramme.deserialize(p.serialize())==p c=p.compile(a) state=SimpleNamespace(q=np.zeros(c.template.count),cells=np.tile(np.eye(3),(c.template.beam_count,2,1,1))) - import anysolver._stiffened_shell_native_distributed_load as native + import anyfesolver._stiffened_shell_native_distributed_load as native def forbidden(*args,**kwargs):raise AssertionError('recompiled load geometry') monkeypatch.setattr(native,'compile_native_distributed',forbidden) for at,density in ((0,0),(.5,50),(1,100),(1.5,50),(2,0),(2.5,-50),(3,-100)): diff --git a/tests/test_stiffened_shell_ge_distributing_displacement.py b/tests/test_stiffened_shell_ge_distributing_displacement.py index 430656903..5c2a42554 100644 --- a/tests/test_stiffened_shell_ge_distributing_displacement.py +++ b/tests/test_stiffened_shell_ge_distributing_displacement.py @@ -4,12 +4,12 @@ import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_displacement_checkpoint import ( +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_displacement_checkpoint import ( decode_snapshot, encode_snapshot, DISTRIBUTING_KIND, DISTRIBUTING_POLICY, ) -from anysolver._stiffened_shell_displacement_control import prepare, publish +from anyfesolver._stiffened_shell_displacement_control import prepare, publish from test_stiffened_shell_ge_distributing_finite_public import definition, actions @@ -234,9 +234,9 @@ def test_canonical_but_inconsistent_endpoint_is_not_published(seed): def test_cancel_before_publication_and_domain_failure_preserve_seed(seed, monkeypatch): - import anysolver._stiffened_shell_displacement_control as controller - from anysolver._stiffened_shell_displacement_corrector import DisplacementCorrectorFailure - from anysolver._stiffened_shell_distributing_pose import DistributingPoseDomainError + import anyfesolver._stiffened_shell_displacement_control as controller + from anyfesolver._stiffened_shell_displacement_corrector import DisplacementCorrectorFailure + from anyfesolver._stiffened_shell_distributing_pose import DistributingPoseDomainError owner = _restored(seed) token = CancellationToken() original = controller.prepare @@ -334,7 +334,7 @@ def test_actual_material_histories_and_restart(profile, monkeypatch): with pytest.raises(ValueError, match="stored seed force factor"): prepare(restored, forged_base) assert restored.checkpoint() == raw - import anysolver._stiffened_shell_displacement_control as controller + import anyfesolver._stiffened_shell_displacement_control as controller original_prepare = controller.prepare token = CancellationToken() def cancel_after_material_prepare(*args): diff --git a/tests/test_stiffened_shell_ge_distributing_displacement_cyclic.py b/tests/test_stiffened_shell_ge_distributing_displacement_cyclic.py index 808f8592f..47cbcbec1 100644 --- a/tests/test_stiffened_shell_ge_distributing_displacement_cyclic.py +++ b/tests/test_stiffened_shell_ge_distributing_displacement_cyclic.py @@ -9,8 +9,8 @@ import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver._stiffened_shell_displacement_checkpoint import ( +from anyfesolver import stiffened_shell as ss +from anyfesolver._stiffened_shell_displacement_checkpoint import ( decode_snapshot, identities, DISTRIBUTING_KIND, DISTRIBUTING_POLICY, ) from test_stiffened_shell_distributing_cyclic import definition, actions diff --git a/tests/test_stiffened_shell_ge_distributing_finite.py b/tests/test_stiffened_shell_ge_distributing_finite.py index 45f449bfe..a22b59f41 100644 --- a/tests/test_stiffened_shell_ge_distributing_finite.py +++ b/tests/test_stiffened_shell_ge_distributing_finite.py @@ -6,10 +6,10 @@ from scipy import sparse from scipy.sparse import linalg as spla -from anysolver._ge_beam3_pose_joint import _exp_terms -from anysolver._stiffened_shell_ge_distributing_finite import PreparedFiniteDistributingAttachment -from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver -from anysolver._stiffened_shell_ge_experimental import ExperimentalGEAnalysis +from anyfesolver._ge_beam3_pose_joint import _exp_terms +from anyfesolver._stiffened_shell_ge_distributing_finite import PreparedFiniteDistributingAttachment +from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver +from anyfesolver._stiffened_shell_ge_experimental import ExperimentalGEAnalysis from test_stiffened_shell_ge_distributing_reference import _multi_definition, _multi_selection @@ -160,7 +160,7 @@ def test_closed_owner_rejected_without_changing_public_admission(): def test_unrepresentable_recovery_is_typed_and_does_not_publish(model,monkeypatch): - from anysolver._stiffened_shell_distributing_pose import FiniteDistributingPose, DistributingPoseDomainError + from anyfesolver._stiffened_shell_distributing_pose import FiniteDistributingPose, DistributingPoseDomainError owner,adapter,driver=model original=FiniteDistributingPose.evaluate def overflow(self,*args,**kwargs): diff --git a/tests/test_stiffened_shell_ge_distributing_finite_public.py b/tests/test_stiffened_shell_ge_distributing_finite_public.py index 523d93119..f0718ad2c 100644 --- a/tests/test_stiffened_shell_ge_distributing_finite_public.py +++ b/tests/test_stiffened_shell_ge_distributing_finite_public.py @@ -3,11 +3,11 @@ import numpy as np import pytest -from anysolver import b3_ge, stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_distributing_pose import DistributingPoseDomainError -from anysolver._stiffened_shell_ge_distributing_finite import PreparedFiniteDistributingAttachment -from anysolver._stiffened_shell_ge_checkpoint_binary import MAGIC, encode +from anyfesolver import b3_ge, stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_distributing_pose import DistributingPoseDomainError +from anyfesolver._stiffened_shell_ge_distributing_finite import PreparedFiniteDistributingAttachment +from anyfesolver._stiffened_shell_ge_checkpoint_binary import MAGIC, encode from test_stiffened_shell_ge_distributing_reference import _definition, _selection, _multi_definition, _multi_selection @@ -105,7 +105,7 @@ def broken(self,actual,state,multipliers,**kwargs): def test_multihost_finite_owner_and_preparation_reuse(monkeypatch): owner=ss.create_analysis(definition=definition(True)) try: - import anysolver._stiffened_shell_ge_distributing_reference as reference + import anyfesolver._stiffened_shell_ge_distributing_reference as reference def forbidden(*args,**kwargs):raise AssertionError("reference search repeated during solve") monkeypatch.setattr(reference,"_compile_reference_geometry",forbidden) result=owner.solve(actions(),(.25,.5)) diff --git a/tests/test_stiffened_shell_ge_distributing_material.py b/tests/test_stiffened_shell_ge_distributing_material.py index 4a0dd989f..2640f0514 100644 --- a/tests/test_stiffened_shell_ge_distributing_material.py +++ b/tests/test_stiffened_shell_ge_distributing_material.py @@ -4,10 +4,10 @@ import numpy as np import pytest -from anysolver import b3_ge, stiffened_shell as ss +from anyfesolver import b3_ge, stiffened_shell as ss from anymaterial import DNVC208MaterialCurve -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_ge_checkpoint_binary import MAGIC, decode, encode +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_ge_checkpoint_binary import MAGIC, decode, encode from test_stiffened_shell_ge_distributing_finite_public import definition as elastic_definition @@ -224,8 +224,8 @@ def on_accepted(result): @pytest.mark.parametrize("failure", (RuntimeError, MemoryError)) def test_candidate_and_checkpoint_failure_preserve_all_domains(completed, monkeypatch, failure): - from anysolver._stiffened_shell_ge_distributing_finite import PreparedFiniteDistributingAttachment - import anysolver._stiffened_shell_ge_finite_experimental as finite + from anyfesolver._stiffened_shell_ge_distributing_finite import PreparedFiniteDistributingAttachment + import anyfesolver._stiffened_shell_ge_finite_experimental as finite model, accepted, _ = completed owner = ss.create_analysis(definition=model) try: @@ -255,7 +255,7 @@ def failed_encoding(*args, **kwargs): def test_cancel_during_prepared_snapshot_preserves_yielded_prefix(completed, monkeypatch): - import anysolver._stiffened_shell_ge_finite_experimental as finite + import anyfesolver._stiffened_shell_ge_finite_experimental as finite model, accepted, _ = completed owner = ss.create_analysis(definition=model) token = CancellationToken() diff --git a/tests/test_stiffened_shell_ge_distributing_owner.py b/tests/test_stiffened_shell_ge_distributing_owner.py index 04c73dac7..37913593a 100644 --- a/tests/test_stiffened_shell_ge_distributing_owner.py +++ b/tests/test_stiffened_shell_ge_distributing_owner.py @@ -10,11 +10,11 @@ import pytest from scipy import sparse -from anysolver import stiffened_shell as api -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_ge_checkpoint_binary import MAGIC, CHART_MAGIC, S3_MAGIC, encode -from anysolver._stiffened_shell_ge_experimental import CHECKPOINT, FINITE_CHECKPOINT -from anysolver._stiffened_shell_ge_distributing_reference import bind_reference +from anyfesolver import stiffened_shell as api +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_ge_checkpoint_binary import MAGIC, CHART_MAGIC, S3_MAGIC, encode +from anyfesolver._stiffened_shell_ge_experimental import CHECKPOINT, FINITE_CHECKPOINT +from anyfesolver._stiffened_shell_ge_distributing_reference import bind_reference from test_stiffened_shell_ge_distributing_reference import ( _definition, _selection, _load, _solve, _relative, _multi_definition, _multi_selection, ) @@ -193,9 +193,9 @@ def test_legacy_empty_field_identity_capabilities_and_checkpoint_parity(prepared def test_owner_methods_and_common_load_spectral_admission_reject_before_work(prepared): - from anysolver._stiffened_shell_ge_reference_modal import _admit - from anysolver._stiffened_shell_ge_body_load import admits_owner as admits_body - from anysolver._stiffened_shell_ge_distributed_load import admits_owner as admits_distributed + from anyfesolver._stiffened_shell_ge_reference_modal import _admit + from anyfesolver._stiffened_shell_ge_body_load import admits_owner as admits_body + from anyfesolver._stiffened_shell_ge_distributed_load import admits_owner as admits_distributed owner = prepared["mixed"] # Point presence must not reopen unverified wrappers. before = owner.checkpoint() for call in (lambda: owner.solve(_actions()), diff --git a/tests/test_stiffened_shell_ge_distributing_reference.py b/tests/test_stiffened_shell_ge_distributing_reference.py index d419a45b2..717979684 100644 --- a/tests/test_stiffened_shell_ge_distributing_reference.py +++ b/tests/test_stiffened_shell_ge_distributing_reference.py @@ -14,17 +14,17 @@ from scipy import sparse from scipy.sparse import linalg as spla -from anysolver import b3_ge -from anysolver._b2_physical_linear_batch_dev import _accurate_sparse_residual -from anysolver._ge_beam3_generalized_static_boundary import spatial_jacobian -from anysolver._stiffened_shell_b2_nodal_footprint import reference_shell_matrix -from anysolver._stiffened_shell_distributing_footprint import DistributingFootprintDefinition -from anysolver._stiffened_shell_ge_distributing_reference import bind_reference -from anysolver._stiffened_shell_ge_experimental import ( +from anyfesolver import b3_ge +from anyfesolver._b2_physical_linear_batch_dev import _accurate_sparse_residual +from anyfesolver._ge_beam3_generalized_static_boundary import spatial_jacobian +from anyfesolver._stiffened_shell_b2_nodal_footprint import reference_shell_matrix +from anyfesolver._stiffened_shell_distributing_footprint import DistributingFootprintDefinition +from anyfesolver._stiffened_shell_ge_distributing_reference import bind_reference +from anyfesolver._stiffened_shell_ge_experimental import ( ExperimentalGEAnalysis, FixedCoordinate, PointConnection, Q4_ALGORITHMIC_PULLBACK_V1, _linear_equilibrium, _scaled_constraint_gap, ) -from anysolver._stiffened_shell_nodal_footprint import NodalRigidFootprint +from anyfesolver._stiffened_shell_nodal_footprint import NodalRigidFootprint from test_stiffened_shell_ge_experimental import _panel diff --git a/tests/test_stiffened_shell_ge_experimental.py b/tests/test_stiffened_shell_ge_experimental.py index a8aa00513..9ad6479a3 100644 --- a/tests/test_stiffened_shell_ge_experimental.py +++ b/tests/test_stiffened_shell_ge_experimental.py @@ -1,6 +1,6 @@ """Integrated experimental Q4/native-B3 point-panel checks.""" -import anysolver +import anyfesolver from hashlib import sha256 import json import numpy as np @@ -8,14 +8,14 @@ from dataclasses import replace from scipy import sparse -from anysolver import b3_ge -from anysolver import _stiffened_shell_ge_experimental as ge_experimental -from anysolver._stiffened_shell_ge_checkpoint_binary import ( +from anyfesolver import b3_ge +from anyfesolver import _stiffened_shell_ge_experimental as ge_experimental +from anyfesolver._stiffened_shell_ge_checkpoint_binary import ( MAGIC as BINARY_CHECKPOINT_MAGIC, decode as decode_binary_checkpoint, encode as encode_binary_checkpoint, ) -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_ge_experimental import ( +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_ge_experimental import ( PROFILE, ExperimentalGEAnalysis, FixedCoordinate, LinearDefinition, NodalAction, PointConnection, ShellPanel, ) @@ -49,7 +49,7 @@ def _panel(): def test_sparse_mixed_panel_solve_recovery_and_restart(): definition = _panel() - analysis = anysolver.stiffened_shell.create_analysis(definition=definition) + analysis = anyfesolver.stiffened_shell.create_analysis(definition=definition) assert analysis.capabilities["attachment"] == ("reference point pose",) legacy_identity = sha256(json.dumps({ "profile": PROFILE, "shell_ids": definition.shell.node_ids, @@ -128,8 +128,8 @@ def test_compiled_panel_owns_mutable_caller_geometry_and_connectivity(): cells = [list(cell) for cell in original.shell.q4_elements] shell = replace(original.shell, coordinates_m=coordinates, q4_elements=cells) caller_definition = replace(original, shell=shell) - owned = anysolver.stiffened_shell.create_analysis(definition=caller_definition) - control = anysolver.stiffened_shell.create_analysis(definition=original) + owned = anyfesolver.stiffened_shell.create_analysis(definition=caller_definition) + control = anyfesolver.stiffened_shell.create_analysis(definition=original) identity = owned._identity # Mutation after compilation must not change the assembled operator, @@ -309,7 +309,7 @@ def solve(self, rhs): @pytest.mark.parametrize("failure", ["cancel", "cancel_second", "numerical", "programming"]) def test_linear_refinement_failure_preserves_accepted_snapshot(monkeypatch, failure): - from anysolver import _b2_physical_linear_batch_dev as residual_service + from anyfesolver import _b2_physical_linear_batch_dev as residual_service analysis = ExperimentalGEAnalysis(_panel()) action = (NodalAction("beam", 105, (0., 0., 100., 0., 0., 0.)),) accepted = analysis.solve_linear(action) diff --git a/tests/test_stiffened_shell_ge_finite_experimental.py b/tests/test_stiffened_shell_ge_finite_experimental.py index b21cc5b55..2fd90cfcc 100644 --- a/tests/test_stiffened_shell_ge_finite_experimental.py +++ b/tests/test_stiffened_shell_ge_finite_experimental.py @@ -5,17 +5,17 @@ from dataclasses import replace from anymaterial import DNVC208MaterialCurve -from anysolver import b3_ge -from anysolver._stiffened_shell_ge_experimental import ( +from anyfesolver import b3_ge +from anyfesolver._stiffened_shell_ge_experimental import ( ExperimentalGEAnalysis, NodalAction, ) -from anysolver import _stiffened_shell_ge_finite_experimental as finite_experimental -from anysolver._stiffened_shell_ge_checkpoint_binary import ( +from anyfesolver import _stiffened_shell_ge_finite_experimental as finite_experimental +from anyfesolver._stiffened_shell_ge_checkpoint_binary import ( MAGIC as BINARY_CHECKPOINT_MAGIC, encode as encode_binary_checkpoint, S3_MAGIC as S3_BINARY_CHECKPOINT_MAGIC, decode_s3, encode_s3, ) -from anysolver.e4_pl_s3_v2d_state import seal_v2d_state -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver.e4_pl_s3_v2d_state import seal_v2d_state +from anyfesolver.control import CancellationToken, SolveCancelled from test_stiffened_shell_ge_experimental import _panel @@ -959,7 +959,7 @@ def test_failed_first_finite_attempt_does_not_select_mode_or_load_pattern(): def test_rotation_chart_limit_uses_backtracking_before_exhaustion(monkeypatch): analysis = ExperimentalGEAnalysis(_panel()) - from anysolver._stiffened_shell_ge_finite_experimental import ( + from anyfesolver._stiffened_shell_ge_finite_experimental import ( FinitePointDriver, _RotationStepTooLarge, ) original = FinitePointDriver._advance @@ -979,7 +979,7 @@ def chart_limited(self, state, increment, amount): def test_partial_first_solve_keeps_accepted_prefix(monkeypatch): analysis = ExperimentalGEAnalysis(_panel()) - from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver + from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver original = FinitePointDriver._assemble def fail_second(self, state, factor, *args, **kwargs): diff --git a/tests/test_stiffened_shell_ge_footprint_gravity.py b/tests/test_stiffened_shell_ge_footprint_gravity.py index 65155ea61..027603261 100644 --- a/tests/test_stiffened_shell_ge_footprint_gravity.py +++ b/tests/test_stiffened_shell_ge_footprint_gravity.py @@ -7,13 +7,13 @@ import numpy as np import pytest -from anysolver import b3_ge, stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled -from anysolver import _stiffened_shell_ge_finite_experimental as finite -from anysolver._stiffened_shell_ge_body_load import admits_owner -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._stiffened_shell_rotation_charts import physical_frames -from anysolver._stiffened_shell_nodal_footprint import CHART_ADMISSION_POLICY +from anyfesolver import b3_ge, stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver import _stiffened_shell_ge_finite_experimental as finite +from anyfesolver._stiffened_shell_ge_body_load import admits_owner +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._stiffened_shell_rotation_charts import physical_frames +from anyfesolver._stiffened_shell_nodal_footprint import CHART_ADMISSION_POLICY from test_stiffened_shell_nodal_rigid_footprint import _definition as footprint_definition from test_stiffened_shell_native_gravity import inertia from test_stiffened_shell_footprint_increment_charts import _histories, _signature diff --git a/tests/test_stiffened_shell_ge_free_reference_modal_oracle.py b/tests/test_stiffened_shell_ge_free_reference_modal_oracle.py index d52b59bc5..6b0323bc5 100644 --- a/tests/test_stiffened_shell_ge_free_reference_modal_oracle.py +++ b/tests/test_stiffened_shell_ge_free_reference_modal_oracle.py @@ -9,7 +9,7 @@ import numpy as np import pytest from scipy import linalg -from anysolver import stiffened_shell as api +from anyfesolver import stiffened_shell as api from test_stiffened_shell_ge_reference_modal_oracle import ( _definition, _independent_mass, _cross, PARTICLES, WEIGHTS) diff --git a/tests/test_stiffened_shell_ge_free_reference_modes.py b/tests/test_stiffened_shell_ge_free_reference_modes.py index a53455e8a..0be5af03b 100644 --- a/tests/test_stiffened_shell_ge_free_reference_modes.py +++ b/tests/test_stiffened_shell_ge_free_reference_modes.py @@ -3,9 +3,9 @@ import numpy as np import pytest -from anysolver import stiffened_shell as public -from anysolver import _stiffened_shell_ge_reference_modal as modal -from anysolver.control import CancellationToken +from anyfesolver import stiffened_shell as public +from anyfesolver import _stiffened_shell_ge_reference_modal as modal +from anyfesolver.control import CancellationToken from test_stiffened_shell_ge_reference_modal import _definition diff --git a/tests/test_stiffened_shell_ge_gravity_owner.py b/tests/test_stiffened_shell_ge_gravity_owner.py index 9c144e197..54ecb5002 100644 --- a/tests/test_stiffened_shell_ge_gravity_owner.py +++ b/tests/test_stiffened_shell_ge_gravity_owner.py @@ -2,11 +2,11 @@ from dataclasses import replace import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled from test_stiffened_shell_ge_experimental import _panel -from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver -from anysolver._stiffened_shell_ge_body_load import encode_checkpoint, decode_checkpoint +from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver +from anyfesolver._stiffened_shell_ge_body_load import encode_checkpoint, decode_checkpoint def owner(request): @@ -98,7 +98,7 @@ def broken(self, *args, **kwargs): def test_eccentric_native_load_scatter_matches_actual_update_derivative(request): from test_stiffened_shell_ge_reference_modal import _definition - from anysolver._ge_beam3_p5.algebra import rotation + from anyfesolver._ge_beam3_p5.algebra import rotation analysis = ss.create_analysis(definition=replace(_definition(), q4_pullback_policy=ss.Q4_ALGORITHMIC_PULLBACK_V1)) request.addfinalizer(analysis.close) driver = FinitePointDriver(analysis) diff --git a/tests/test_stiffened_shell_ge_line_buckling.py b/tests/test_stiffened_shell_ge_line_buckling.py index 9ac052663..2950f13fb 100644 --- a/tests/test_stiffened_shell_ge_line_buckling.py +++ b/tests/test_stiffened_shell_ge_line_buckling.py @@ -6,15 +6,15 @@ import numpy as np import pytest from scipy.linalg import eig -from anysolver import stiffened_shell as public -from anysolver import _stiffened_shell_ge_point_buckling as buckling -from anysolver._ge_beam3_pose_joint import _exp_terms -from anysolver._ge_beam3_retained_generalized_state import Mechanical -from anysolver._stiffened_shell_ge_finite_experimental import _position_pair -from anysolver.control import CancellationToken -from anysolver import _ge_beam3_mixed_ad as ad -from anysolver._stiffened_shell_rotation_charts import physical_frames -from anysolver._stiffened_shell_bl5_local_experimental import BL5LocalOperator +from anyfesolver import stiffened_shell as public +from anyfesolver import _stiffened_shell_ge_point_buckling as buckling +from anyfesolver._ge_beam3_pose_joint import _exp_terms +from anyfesolver._ge_beam3_retained_generalized_state import Mechanical +from anyfesolver._stiffened_shell_ge_finite_experimental import _position_pair +from anyfesolver.control import CancellationToken +from anyfesolver import _ge_beam3_mixed_ad as ad +from anyfesolver._stiffened_shell_rotation_charts import physical_frames +from anyfesolver._stiffened_shell_bl5_local_experimental import BL5LocalOperator from test_stiffened_shell_bl5_finite import _model from test_stiffened_shell_ge_point_buckling import dense_full_hessian, _MockInverse diff --git a/tests/test_stiffened_shell_ge_mixed_buckling.py b/tests/test_stiffened_shell_ge_mixed_buckling.py index 48edce352..b4d32a232 100644 --- a/tests/test_stiffened_shell_ge_mixed_buckling.py +++ b/tests/test_stiffened_shell_ge_mixed_buckling.py @@ -7,16 +7,16 @@ import numpy as np import pytest from scipy.linalg import eig -from anysolver import stiffened_shell as public -from anysolver import _stiffened_shell_ge_point_buckling as buckling -from anysolver._stiffened_shell_ge_finite_experimental import _position_pair -from anysolver._ge_beam3_variational_shell import deformation, response as shell_response -from anysolver._ge_beam3_pose_joint import _exp_terms -from anysolver._ge_beam3_mixed_ad import Jet2, constant_matrix, matmul, matvec, transpose, so3_exp, so3_log -from anysolver._ge_beam3_retained_fibre import RetainedFibreOperator -from anysolver.b3_ge import FlowCurve -from anysolver._ge_beam3_fibre_section import FibreHistory -from anysolver.control import CancellationToken +from anyfesolver import stiffened_shell as public +from anyfesolver import _stiffened_shell_ge_point_buckling as buckling +from anyfesolver._stiffened_shell_ge_finite_experimental import _position_pair +from anyfesolver._ge_beam3_variational_shell import deformation, response as shell_response +from anyfesolver._ge_beam3_pose_joint import _exp_terms +from anyfesolver._ge_beam3_mixed_ad import Jet2, constant_matrix, matmul, matvec, transpose, so3_exp, so3_log +from anyfesolver._ge_beam3_retained_fibre import RetainedFibreOperator +from anyfesolver.b3_ge import FlowCurve +from anyfesolver._ge_beam3_fibre_section import FibreHistory +from anyfesolver.control import CancellationToken from test_stiffened_shell_ge_point_buckling import _MockInverse from test_stiffened_shell_ge_experimental import _panel from test_stiffened_shell_ge_physical_fibre_linear import _definition @@ -52,7 +52,7 @@ def test_full_retained_split_and_actual_s3_spatial_parity(accepted_owner): np.testing.assert_allclose((packet.material+packet.geometric)[free,:][:,free].toarray(), h[np.ix_(free,free)],rtol=1e-11,atol=2e-6) assert packet.primal_count==owner._shell_count+6*len(owner._beam_ids)+24*len(owner._beam_parts) - from anysolver._stiffened_shell_s3_conservative_buckling import conservative_components + from anyfesolver._stiffened_shell_s3_conservative_buckling import conservative_components for (_,element,slots,_),origin in zip(owner._shell_parts,pickle.loads(packet.snapshot.shell_origins),strict=True): if len(slots)!=18: continue anchors=None if packet.snapshot.shell_anchors is None else packet.snapshot.shell_anchors[slots[::6]//6] diff --git a/tests/test_stiffened_shell_ge_mixed_reference_modal.py b/tests/test_stiffened_shell_ge_mixed_reference_modal.py index 1d7e27b1f..3b4ca2d64 100644 --- a/tests/test_stiffened_shell_ge_mixed_reference_modal.py +++ b/tests/test_stiffened_shell_ge_mixed_reference_modal.py @@ -3,9 +3,9 @@ import numpy as np import pytest from scipy.linalg import eig -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken -from anysolver import _stiffened_shell_ge_reference_modal as modal +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken +from anyfesolver import _stiffened_shell_ge_reference_modal as modal from examples.stiffened_shell_ge_mixed_reference_modes import definition @@ -141,8 +141,8 @@ def test_new_free_boundary_six_rigid_fields(shell,beams): def test_independent_curved_centered_lift_kinetic_work(): - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry - from anysolver._stiffened_shell_ge_mixed_modal_mass import native_physical_mass + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry + from anyfesolver._stiffened_shell_ge_mixed_modal_mass import native_physical_mass from test_stiffened_shell_ge_reference_modal import _definition as eccentric_definition inertia=eccentric_definition().beams[0].instantiate()[1] nodes=np.array(((0.,0.,0.),(.5,.2,.1),(1.,0.,0.))) @@ -228,8 +228,8 @@ def test_actual_single_p0_bl5_support_retains_existing_mechanism_refusal(): def test_native_kinetic_only_matches_preserved_evaluator_and_straight_work(): - from anysolver._ge_beam3_p5_centered.mass import reference_kinetic_factors - from anysolver._stiffened_shell_ge_mixed_modal_mass import native_physical_mass + from anyfesolver._ge_beam3_p5_centered.mass import reference_kinetic_factors + from anyfesolver._stiffened_shell_ge_mixed_modal_mass import native_physical_mass from test_stiffened_shell_ge_reference_modal import _definition as eccentric_definition owner = ss.create_analysis(definition=eccentric_definition()) try: diff --git a/tests/test_stiffened_shell_ge_one_shell_parity.py b/tests/test_stiffened_shell_ge_one_shell_parity.py index ec96ade97..25cb428ff 100644 --- a/tests/test_stiffened_shell_ge_one_shell_parity.py +++ b/tests/test_stiffened_shell_ge_one_shell_parity.py @@ -4,8 +4,8 @@ import pytest from scipy import sparse -from anysolver._ge_beam3_native_definition import NativeBeamDefinition -from anysolver._stiffened_shell_ge_experimental import ( +from anyfesolver._ge_beam3_native_definition import NativeBeamDefinition +from anyfesolver._stiffened_shell_ge_experimental import ( PROFILE, ExperimentalGEAnalysis, FixedCoordinate, LinearDefinition, NodalAction, PointConnection, ShellPanel, ) diff --git a/tests/test_stiffened_shell_ge_owned_rebase.py b/tests/test_stiffened_shell_ge_owned_rebase.py index dfa8f0ecc..6cc5f798b 100644 --- a/tests/test_stiffened_shell_ge_owned_rebase.py +++ b/tests/test_stiffened_shell_ge_owned_rebase.py @@ -8,13 +8,13 @@ from scipy.sparse.linalg import spsolve from anymaterial import DNVC208MaterialCurve -from anysolver import stiffened_shell -from anysolver._stiffened_shell_ge_experimental import FixedCoordinate -from anysolver._stiffened_shell_ge_checkpoint_binary import ( +from anyfesolver import stiffened_shell +from anyfesolver._stiffened_shell_ge_experimental import FixedCoordinate +from anyfesolver._stiffened_shell_ge_checkpoint_binary import ( CHART_MAGIC, decode_chart, encode_chart, ) -from anysolver._stiffened_shell_rotation_charts import total_coordinates -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_rotation_charts import total_coordinates +from anyfesolver.control import CancellationToken, SolveCancelled from test_stiffened_shell_ge_experimental import _panel from test_stiffened_shell_ge_finite_experimental import _actions, _q4_shell_j2_panel @@ -226,7 +226,7 @@ def test_rebase_preserves_rejected_increment_prefix(monkeypatch): # A physical .55 increment need not fail on every admitted numerical # platform. Exercise deterministic chart rejection after forming an actual # candidate, rather than requiring an old observed convergence failure. - from anysolver._stiffened_shell_ge_finite_experimental import ( + from anyfesolver._stiffened_shell_ge_finite_experimental import ( FinitePointDriver, _RotationStepTooLarge, ) advance=FinitePointDriver._advance diff --git a/tests/test_stiffened_shell_ge_physical_fibre_finite.py b/tests/test_stiffened_shell_ge_physical_fibre_finite.py index 988541872..c870bdf4c 100644 --- a/tests/test_stiffened_shell_ge_physical_fibre_finite.py +++ b/tests/test_stiffened_shell_ge_physical_fibre_finite.py @@ -3,16 +3,16 @@ import json import warnings -import anysolver +import anyfesolver import numpy as np import pytest -from anysolver import b3_ge -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_increment_control import FiniteIncrementFailure -from anysolver._stiffened_shell_ge_experimental import NodalAction -from anysolver._stiffened_shell_ge_checkpoint_binary import decode, encode, SCHEMAS -from anysolver._stiffened_shell_beam_history import arrays, histories, shapes +from anyfesolver import b3_ge +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_increment_control import FiniteIncrementFailure +from anyfesolver._stiffened_shell_ge_experimental import NodalAction +from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode, encode, SCHEMAS +from anyfesolver._stiffened_shell_beam_history import arrays, histories, shapes from test_stiffened_shell_ge_physical_fibre_linear import _definition @@ -38,7 +38,7 @@ def _yielding_definition(mixed=False, triangles=False): @pytest.mark.parametrize('mixed,triangles', ((False,False),(True,False),(True,True))) def test_finite_native_response_restart_and_predecessor(mixed, triangles): definition = _definition(mixed, triangles) - owner = anysolver.stiffened_shell.create_analysis(definition=definition) + owner = anyfesolver.stiffened_shell.create_analysis(definition=definition) actions = (NodalAction('beam',105,(0.,0.,1000.,0.,0.,0.)),) first = owner.solve(actions, targets=(.5,1.)) assert first.generation == 2 @@ -47,7 +47,7 @@ def test_finite_native_response_restart_and_predecessor(mixed, triangles): assert all(not record.strain.flags.writeable for record in first.beam_fibre_material) driver = owner._finite_driver saved = owner.checkpoint() - resumed = anysolver.stiffened_shell.create_analysis(definition=definition) + resumed = anyfesolver.stiffened_shell.create_analysis(definition=definition) restored = resumed.restore(saved) assert resumed.checkpoint() == saved for name in ('beam_positions','beam_frames','cell_frames','cell_resultants', @@ -69,7 +69,7 @@ def expected(kind, generation): json_payload = json.dumps({'schema': SCHEMAS[kind], 'model': owner._identity, 'generation': generation, **{name:value.tolist() for name,value in values.items()}}).encode() - json_owner = anysolver.stiffened_shell.create_analysis(definition=definition) + json_owner = anyfesolver.stiffened_shell.create_analysis(definition=definition) with pytest.raises(ValueError,match='requires binary framing'): json_owner.restore(json_payload) assert json_owner._generation == 0 @@ -77,7 +77,7 @@ def expected(kind, generation): changed = {name: np.array(value,copy=True) for name,value in values.items()} changed['accepted_fibres'][0,2] += 1e-6 corrupt = encode(kind,owner._identity,generation,tuple(changed.items())) - untouched = anysolver.stiffened_shell.create_analysis(definition=definition) + untouched = anyfesolver.stiffened_shell.create_analysis(definition=definition) with pytest.raises(ValueError,match='update disagrees with accepted history'): untouched.restore(corrupt) assert untouched._generation == 0 and untouched._finite_driver is None @@ -85,7 +85,7 @@ def expected(kind, generation): if not triangles: forged = encode('finite_native_material_stable',owner._identity, generation,tuple(values.items())) - ineligible = anysolver.stiffened_shell.create_analysis(definition=definition) + ineligible = anyfesolver.stiffened_shell.create_analysis(definition=definition) try: with pytest.raises(ValueError,match='requires S3 elements'): ineligible.restore(forged) @@ -106,7 +106,7 @@ def expected(kind, generation): if triangles: rebased = owner.rebase_rotations(expected_generation=oracle.generation) charted = owner.checkpoint() - chart_owner = anysolver.stiffened_shell.create_analysis(definition=definition) + chart_owner = anyfesolver.stiffened_shell.create_analysis(definition=definition) try: chart_result = chart_owner.restore(charted) assert chart_owner._finite_driver._stable_s3 @@ -121,7 +121,7 @@ def expected(kind, generation): @pytest.mark.parametrize('mixed,triangles', ((False,False),(True,False))) def test_native_yield_unload_reject_cancel_and_restore(mixed,triangles): definition = _yielding_definition(mixed,triangles) - owner = anysolver.stiffened_shell.create_analysis(definition=definition) + owner = anyfesolver.stiffened_shell.create_analysis(definition=definition) actions = (NodalAction('beam',105,(0.,0.,1000.,0.,0.,0.)),) first = owner.solve(actions,targets=(.5,1.), max_iterations=18,max_backtracks=8) @@ -136,7 +136,7 @@ def test_native_yield_unload_reject_cancel_and_restore(mixed,triangles): with pytest.raises(SolveCancelled): owner.solve(actions,targets=(1.5,),cancellation_token=token) assert owner.checkpoint() == saved - resumed = anysolver.stiffened_shell.create_analysis(definition=definition) + resumed = anyfesolver.stiffened_shell.create_analysis(definition=definition) restored = resumed.restore(saved) assert resumed.checkpoint() == saved assert any(sum(f.plastic_increment) != 0. for record in restored.beam_fibre_material @@ -150,8 +150,8 @@ def test_native_yield_unload_reject_cancel_and_restore(mixed,triangles): def test_native_cancel_after_material_recovery_preserves_accepted_state(monkeypatch): - from anysolver import _stiffened_shell_ge_finite_experimental as finite - owner = anysolver.stiffened_shell.create_analysis(definition=_yielding_definition()) + from anyfesolver import _stiffened_shell_ge_finite_experimental as finite + owner = anyfesolver.stiffened_shell.create_analysis(definition=_yielding_definition()) actions = (NodalAction('beam',105,(0.,0.,1000.,0.,0.,0.)),) first = owner.solve(actions,targets=(.5,)) saved = owner.checkpoint() @@ -178,7 +178,7 @@ def test_pure_fibre_s3_monotonic_completion_and_restart(yielding, monkeypatch): Earlier failures stay in immutable evidence; full G3 remains unqualified. """ definition = (_yielding_definition(False,True) if yielding else _definition(False,True)) - owner = anysolver.stiffened_shell.create_analysis(definition=definition) + owner = anyfesolver.stiffened_shell.create_analysis(definition=definition) actions = (NodalAction('beam',105,(0.,0.,1000.,0.,0.,0.)),) try: result = owner.solve(actions,targets=(.5,1.)) @@ -197,7 +197,7 @@ def test_pure_fibre_s3_monotonic_completion_and_restart(yielding, monkeypatch): assert np.linalg.norm(moment+np.cross(result.beam_positions[-1],applied))/( np.linalg.norm(applied)*owner._reference_length)<1e-8 saved = owner.checkpoint() - resumed = anysolver.stiffened_shell.create_analysis(definition=definition) + resumed = anyfesolver.stiffened_shell.create_analysis(definition=definition) try: restored = resumed.restore(saved) assert resumed.checkpoint() == saved diff --git a/tests/test_stiffened_shell_ge_physical_fibre_linear.py b/tests/test_stiffened_shell_ge_physical_fibre_linear.py index dda3c8a3c..9df1218c5 100644 --- a/tests/test_stiffened_shell_ge_physical_fibre_linear.py +++ b/tests/test_stiffened_shell_ge_physical_fibre_linear.py @@ -2,20 +2,20 @@ from dataclasses import replace import json -import anysolver +import anyfesolver import numpy as np import pytest -from anysolver import b3_ge -from anysolver.b3_ge import Fibre, FlowCurve, PhysicalFibreSection -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_ge_experimental import ( +from anyfesolver import b3_ge +from anyfesolver.b3_ge import Fibre, FlowCurve, PhysicalFibreSection +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_ge_experimental import ( FINITE_CHECKPOINT, NodalAction, ) -from anysolver._stiffened_shell_ge_checkpoint_binary import ( +from anyfesolver._stiffened_shell_ge_checkpoint_binary import ( CHART_MAGIC, S3_MAGIC, encode, ) -from anysolver._stiffened_shell_l1_assembly_experimental import ExperimentalL1Line, SPACE_A +from anyfesolver._stiffened_shell_l1_assembly_experimental import ExperimentalL1Line, SPACE_A from test_stiffened_shell_ge_experimental import _panel @@ -48,7 +48,7 @@ def _definition(mixed=False, triangles=False): def test_physical_fibre_linear_panel_matches_elastic_section_and_restarts(mixed, triangles): definition = _definition(mixed, triangles) baseline = replace(_panel(), shell=definition.shell) - analysis = anysolver.stiffened_shell.create_analysis(definition=definition) + analysis = anyfesolver.stiffened_shell.create_analysis(definition=definition) oracle = b3_ge.create_stiffened_shell_analysis(formulation='b3-ge', definition=baseline) assert analysis.capabilities['status'] == 'EXPERIMENTAL_NOT_QUALIFIED' assert analysis.capabilities['analysis'] == ( @@ -75,7 +75,7 @@ def test_physical_fibre_linear_panel_matches_elastic_section_and_restarts(mixed, applied_moment = np.asarray(actions[0].wrench[3:])+np.cross((2.,-.5,.1),actions[0].wrench[:3]) np.testing.assert_allclose(moment,-applied_moment,atol=1e-5) saved = analysis.checkpoint() - resumed = anysolver.stiffened_shell.create_analysis(definition=definition) + resumed = anyfesolver.stiffened_shell.create_analysis(definition=definition) restored = resumed.restore(saved) np.testing.assert_array_equal(restored.beam_coordinates,result.beam_coordinates) twice = tuple(replace(action,wrench=tuple(2*v for v in action.wrench)) for action in actions) @@ -90,7 +90,7 @@ def test_physical_fibre_linear_panel_matches_elastic_section_and_restarts(mixed, @pytest.mark.parametrize('kind', ('json','binary','chart','s3')) def test_physical_fibre_legacy_finite_checkpoints_reject_without_state_change(kind): - owner = anysolver.stiffened_shell.create_analysis(definition=_definition(mixed=True)) + owner = anyfesolver.stiffened_shell.create_analysis(definition=_definition(mixed=True)) actions = (NodalAction('beam',105,(0.,0.,100.,0.,0.,0.)),) owner.solve_linear(actions) saved = owner.checkpoint() @@ -101,7 +101,7 @@ def test_physical_fibre_legacy_finite_checkpoints_reject_without_state_change(ki raw = (json.dumps(payload).encode() if kind == 'json' else encode('finite',owner._identity,1,(('q',np.asarray(payload['q'])),)) if kind == 'binary' else CHART_MAGIC if kind == 'chart' else S3_MAGIC) - fresh = anysolver.stiffened_shell.create_analysis(definition=_definition(mixed=True)) + fresh = anyfesolver.stiffened_shell.create_analysis(definition=_definition(mixed=True)) with pytest.raises(ValueError,match='reference-linear checkpoints only|digest mismatch|checkpoint'): fresh.restore(raw) assert fresh._accepted is None and fresh._finite_driver is None @@ -114,18 +114,18 @@ def test_physical_fibre_line_admission_rejects_before_mapping(): line = ExperimentalL1Line((1,2,3,4,5), ((0,0),(0,1),(1,0),(1,1)), SPACE_A) definition = replace(_definition(), lines=(line,)) with pytest.raises(ValueError,match='point attachments only'): - anysolver.stiffened_shell.create_analysis(definition=definition) + anyfesolver.stiffened_shell.create_analysis(definition=definition) def test_physical_fibre_binary_restart_and_cancel_preserve_prefix(monkeypatch): - from anysolver import _stiffened_shell_ge_experimental as owner_module + from anyfesolver import _stiffened_shell_ge_experimental as owner_module monkeypatch.setattr(owner_module,'MAX_JSON_CHECKPOINT_VALUES',1) definition = _definition(mixed=True) - owner = anysolver.stiffened_shell.create_analysis(definition=definition) + owner = anyfesolver.stiffened_shell.create_analysis(definition=definition) actions = (NodalAction('beam',105,(0.,0.,100.,0.,0.,0.)),) result = owner.solve_linear(actions) saved = owner.checkpoint() - fresh = anysolver.stiffened_shell.create_analysis(definition=definition) + fresh = anyfesolver.stiffened_shell.create_analysis(definition=definition) restored = fresh.restore(saved) np.testing.assert_array_equal(restored.beam_coordinates,result.beam_coordinates) token = CancellationToken() diff --git a/tests/test_stiffened_shell_ge_point_buckling.py b/tests/test_stiffened_shell_ge_point_buckling.py index e14f0367b..92b02f678 100644 --- a/tests/test_stiffened_shell_ge_point_buckling.py +++ b/tests/test_stiffened_shell_ge_point_buckling.py @@ -10,14 +10,14 @@ from scipy.linalg import eig from scipy.sparse.linalg import ArpackNoConvergence -from anysolver import stiffened_shell as public -from anysolver import _stiffened_shell_ge_point_buckling as buckling -from anysolver._stiffened_shell_ge_experimental import ExperimentalGEAnalysis, NodalAction, FixedCoordinate -from anysolver._stiffened_shell_ge_finite_experimental import _position_pair -from anysolver._ge_beam3_variational_shell import deformation -from anysolver._ge_beam3_pose_joint import _exp_terms -from anysolver._ge_beam3_mixed_ad import Jet2, constant_matrix, matmul, matvec, transpose, so3_exp, so3_log -from anysolver.control import CancellationToken +from anyfesolver import stiffened_shell as public +from anyfesolver import _stiffened_shell_ge_point_buckling as buckling +from anyfesolver._stiffened_shell_ge_experimental import ExperimentalGEAnalysis, NodalAction, FixedCoordinate +from anyfesolver._stiffened_shell_ge_finite_experimental import _position_pair +from anyfesolver._ge_beam3_variational_shell import deformation +from anyfesolver._ge_beam3_pose_joint import _exp_terms +from anyfesolver._ge_beam3_mixed_ad import Jet2, constant_matrix, matmul, matvec, transpose, so3_exp, so3_log +from anyfesolver.control import CancellationToken from test_stiffened_shell_ge_experimental import _panel diff --git a/tests/test_stiffened_shell_ge_pressure_context.py b/tests/test_stiffened_shell_ge_pressure_context.py index 1ca9c46eb..c91228f7c 100644 --- a/tests/test_stiffened_shell_ge_pressure_context.py +++ b/tests/test_stiffened_shell_ge_pressure_context.py @@ -6,10 +6,10 @@ import pytest from scipy import sparse -from anysolver.boundary import LoadCase -from anysolver._ge_beam3_p5.algebra import rotation -from anysolver._stiffened_shell_ge_experimental import ShellPanel, _shell_reference -from anysolver._stiffened_shell_ge_pressure_load import ( +from anyfesolver.boundary import LoadCase +from anyfesolver._ge_beam3_p5.algebra import rotation +from anyfesolver._stiffened_shell_ge_experimental import ShellPanel, _shell_reference +from anyfesolver._stiffened_shell_ge_pressure_load import ( GEShellPressureAction as Action, GEShellPressureLoad as Request, decode_checkpoint, ) diff --git a/tests/test_stiffened_shell_ge_pressure_owner.py b/tests/test_stiffened_shell_ge_pressure_owner.py index f70550ba7..737fb56f2 100644 --- a/tests/test_stiffened_shell_ge_pressure_owner.py +++ b/tests/test_stiffened_shell_ge_pressure_owner.py @@ -3,10 +3,10 @@ from copy import copy import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver -from anysolver._stiffened_shell_ge_pressure_load import encode_checkpoint,decode_checkpoint,VECTOR_EQUILIBRIUM_POLICY +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver +from anyfesolver._stiffened_shell_ge_pressure_load import encode_checkpoint,decode_checkpoint,VECTOR_EQUILIBRIUM_POLICY from test_stiffened_shell_ge_experimental import _panel @@ -114,7 +114,7 @@ def test_pressure_external_tangent_through_actual_owner_update(request,kind): def test_follower_decrease_can_advance_newton_without_false_commit(request): - from anysolver._stiffened_shell_increment_control import FiniteIncrementFailure + from anyfesolver._stiffened_shell_increment_control import FiniteIncrementFailure a=owner(request) # The first full step decreases the parent's frozen merit, but its current # active-row ratio is still far above equilibrium. It must not be published. @@ -123,7 +123,7 @@ def test_follower_decrease_can_advance_newton_without_false_commit(request): assert a._generation==0 and a._accepted is None and a._finite_driver is None def test_pressure_trial_work_norm_units_extremes_and_zero_load(): - from anysolver._stiffened_shell_ge_finite_experimental import _trial_work_ratio + from anyfesolver._stiffened_shell_ge_finite_experimental import _trial_work_ratio expected=np.sqrt(52.)/10. assert _trial_work_ratio(np.array([3.,4.]),np.array([0.,10.]),np.array([2.,1.]))==pytest.approx(expected) assert _trial_work_ratio(np.array([3.,4000.]),np.array([0.,10000.]),np.array([2000.,1.]))==pytest.approx(expected) @@ -136,8 +136,8 @@ def test_pressure_trial_work_norm_units_extremes_and_zero_load(): def test_pressure_trial_merit_does_not_replace_component_acceptance(): - from anysolver._stiffened_shell_ge_finite_experimental import _trial_work_ratio - from anysolver._stiffened_shell_ge_experimental import _linear_equilibrium + from anyfesolver._stiffened_shell_ge_finite_experimental import _trial_work_ratio + from anyfesolver._stiffened_shell_ge_experimental import _linear_equilibrium applied=np.array([10.,1e-10]);parent=.5*applied;candidate=np.array([1e-12,1e-10]) assert _trial_work_ratio(candidate,applied,np.ones(2))<_trial_work_ratio(parent,applied,np.ones(2)) assert _trial_work_ratio(candidate,applied,np.ones(2))<1e-8 @@ -145,7 +145,7 @@ def test_pressure_trial_merit_does_not_replace_component_acceptance(): def test_equilibrated_pressure_trial_is_rechecked_despite_frozen_merit(request, monkeypatch): - import anysolver._stiffened_shell_ge_finite_experimental as finite + import anyfesolver._stiffened_shell_ge_finite_experimental as finite original_assemble = finite.FinitePointDriver._assemble latest = {'equilibrated': False, 'obstructed': 0, 'certificates': 0, 'assembling': False} diff --git a/tests/test_stiffened_shell_ge_pressure_vector_equilibrium.py b/tests/test_stiffened_shell_ge_pressure_vector_equilibrium.py index 479d7db0a..d5af48274 100644 --- a/tests/test_stiffened_shell_ge_pressure_vector_equilibrium.py +++ b/tests/test_stiffened_shell_ge_pressure_vector_equilibrium.py @@ -4,12 +4,12 @@ import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_ge_finite_experimental import ( +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_ge_finite_experimental import ( FinitePointDriver, _pressure_vector_equilibrium, _trial_work_ratio, ) -from anysolver._stiffened_shell_ge_pressure_load import ( +from anyfesolver._stiffened_shell_ge_pressure_load import ( VECTOR_EQUILIBRIUM_POLICY, decode_checkpoint, ) from test_stiffened_shell_ge_director_pressure import director_load diff --git a/tests/test_stiffened_shell_ge_reference_modal.py b/tests/test_stiffened_shell_ge_reference_modal.py index 725e5dee9..f102817ed 100644 --- a/tests/test_stiffened_shell_ge_reference_modal.py +++ b/tests/test_stiffened_shell_ge_reference_modal.py @@ -5,9 +5,9 @@ import numpy as np import pytest -from anysolver import b3_ge, stiffened_shell as public -from anysolver.control import CancellationToken -from anysolver import _stiffened_shell_ge_reference_modal as modal +from anyfesolver import b3_ge, stiffened_shell as public +from anyfesolver.control import CancellationToken +from anyfesolver import _stiffened_shell_ge_reference_modal as modal def _definition(inertia=None): diff --git a/tests/test_stiffened_shell_ge_reference_modal_oracle.py b/tests/test_stiffened_shell_ge_reference_modal_oracle.py index ba10ca925..2fc8d860e 100644 --- a/tests/test_stiffened_shell_ge_reference_modal_oracle.py +++ b/tests/test_stiffened_shell_ge_reference_modal_oracle.py @@ -13,8 +13,8 @@ from scipy import linalg from scipy.spatial.transform import Rotation -from anysolver import b3_ge, stiffened_shell -from anysolver._stiffened_shell_ge_reference_modal import _assemble_mass +from anyfesolver import b3_ge, stiffened_shell +from anyfesolver._stiffened_shell_ge_reference_modal import _assemble_mass from test_stiffened_shell_ge_experimental import _panel diff --git a/tests/test_stiffened_shell_ge_rigid_motion.py b/tests/test_stiffened_shell_ge_rigid_motion.py index 78787fede..74125665c 100644 --- a/tests/test_stiffened_shell_ge_rigid_motion.py +++ b/tests/test_stiffened_shell_ge_rigid_motion.py @@ -7,8 +7,8 @@ from scipy.spatial.transform import Rotation from anymaterial import DNVC208MaterialCurve -from anysolver._stiffened_shell_ge_experimental import ExperimentalGEAnalysis -from anysolver._stiffened_shell_ge_finite_experimental import ( +from anyfesolver._stiffened_shell_ge_experimental import ExperimentalGEAnalysis +from anyfesolver._stiffened_shell_ge_finite_experimental import ( FinitePointDriver, _State, _position_pair, ) diff --git a/tests/test_stiffened_shell_ge_s3_checkpoint_binary.py b/tests/test_stiffened_shell_ge_s3_checkpoint_binary.py index 39a5369e9..5e7c81d05 100644 --- a/tests/test_stiffened_shell_ge_s3_checkpoint_binary.py +++ b/tests/test_stiffened_shell_ge_s3_checkpoint_binary.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from anysolver._stiffened_shell_ge_checkpoint_binary import ( +from anyfesolver._stiffened_shell_ge_checkpoint_binary import ( MAGIC, S3_MAGIC, decode_s3, encode_s3, ) diff --git a/tests/test_stiffened_shell_ge_selective_rebase.py b/tests/test_stiffened_shell_ge_selective_rebase.py index c41c69016..02ad3cfdf 100644 --- a/tests/test_stiffened_shell_ge_selective_rebase.py +++ b/tests/test_stiffened_shell_ge_selective_rebase.py @@ -6,11 +6,11 @@ import numpy as np import pytest from scipy.spatial.transform import Rotation -from anysolver import stiffened_shell -from anysolver._stiffened_shell_ge_experimental import FixedCoordinate -from anysolver._stiffened_shell_ge_checkpoint_binary import decode_chart,encode_chart -from anysolver.control import CancellationToken,SolveCancelled -from anysolver._stiffened_shell_q4_algorithmic_pullback import POLICY as Q4_POLICY +from anyfesolver import stiffened_shell +from anyfesolver._stiffened_shell_ge_experimental import FixedCoordinate +from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode_chart,encode_chart +from anyfesolver.control import CancellationToken,SolveCancelled +from anyfesolver._stiffened_shell_q4_algorithmic_pullback import POLICY as Q4_POLICY from test_stiffened_shell_ge_experimental import _panel from test_stiffened_shell_ge_finite_experimental import _actions from test_stiffened_shell_ge_owned_rebase import _poses @@ -159,8 +159,8 @@ def forbidden(*a,**k):raise AssertionError('excluded dispatcher forwarded flag') def test_main_capability_metadata_does_not_modify_spectral_delegates(monkeypatch): - from anysolver import _stiffened_shell_ge_reference_modal as modal - from anysolver import _stiffened_shell_ge_point_buckling as buckling + from anyfesolver import _stiffened_shell_ge_reference_modal as modal + from anyfesolver import _stiffened_shell_ge_point_buckling as buckling owner=stiffened_shell.create_analysis(definition=replace(_panel(),q4_pullback_policy=Q4_POLICY)) calls=[] def delegated(target,**kwargs):calls.append((target,kwargs));return {'delegated':kwargs} diff --git a/tests/test_stiffened_shell_generalized_recovery_records.py b/tests/test_stiffened_shell_generalized_recovery_records.py index 33a95c1c2..9cf9c5f12 100644 --- a/tests/test_stiffened_shell_generalized_recovery_records.py +++ b/tests/test_stiffened_shell_generalized_recovery_records.py @@ -4,10 +4,10 @@ import numpy as np import pytest -from anysolver._ge_beam3_generalized_cell import GeneralizedCellConjugate -from anysolver._ge_beam3_fibre_section import canonical -from anysolver._ge_beam3_retained_generalized import RetainedGeneralizedOperator -from anysolver._stiffened_shell_generalized_recovery import build +from anyfesolver._ge_beam3_generalized_cell import GeneralizedCellConjugate +from anyfesolver._ge_beam3_fibre_section import canonical +from anyfesolver._ge_beam3_retained_generalized import RetainedGeneralizedOperator +from anyfesolver._stiffened_shell_generalized_recovery import build from test_stiffened_shell_bl5_material import model diff --git a/tests/test_stiffened_shell_increment_control.py b/tests/test_stiffened_shell_increment_control.py index 837468793..0bd91f547 100644 --- a/tests/test_stiffened_shell_increment_control.py +++ b/tests/test_stiffened_shell_increment_control.py @@ -3,17 +3,17 @@ from hashlib import sha256 import json -import anysolver +import anyfesolver import numpy as np import pytest -from anysolver.stiffened_shell import ( +from anyfesolver.stiffened_shell import ( AdaptiveIncrementControl, AdaptiveIncrementExhausted, FiniteIncrementFailure, IncrementAttempt, NodalAction, ) -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver -from anysolver._stiffened_shell_increment_control import decode_control, encode_control, MAGIC +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver +from anyfesolver._stiffened_shell_increment_control import decode_control, encode_control, MAGIC from test_stiffened_shell_ge_physical_fibre_linear import _definition @@ -39,8 +39,8 @@ def fixed(driver, actions, targets, **kwargs): def test_cutbacks_use_committed_origins_and_match_fixed_increment_oracle(monkeypatch): observed = _bounded_increment(monkeypatch) control = AdaptiveIncrementControl(max_cutbacks=3,max_attempts=12) - owner = anysolver.stiffened_shell.create_analysis(definition=_definition()) - oracle = anysolver.stiffened_shell.create_analysis(definition=_definition()) + owner = anyfesolver.stiffened_shell.create_analysis(definition=_definition()) + oracle = anyfesolver.stiffened_shell.create_analysis(definition=_definition()) try: result = owner.solve(ACTIONS,targets=(1.,),increment_control=control) assert result.status == 'completed' @@ -62,11 +62,11 @@ def test_cutbacks_use_committed_origins_and_match_fixed_increment_oracle(monkeyp def test_cancelled_prefix_restores_pending_cursor_and_chart(monkeypatch): _bounded_increment(monkeypatch) - import anysolver._stiffened_shell_ge_finite_experimental as finite + import anyfesolver._stiffened_shell_ge_finite_experimental as finite original = finite.cancellation_safe_point token = CancellationToken() - owner = anysolver.stiffened_shell.create_analysis(definition=_definition(False,True)) - resumed = anysolver.stiffened_shell.create_analysis(definition=_definition(False,True)) + owner = anyfesolver.stiffened_shell.create_analysis(definition=_definition(False,True)) + resumed = anyfesolver.stiffened_shell.create_analysis(definition=_definition(False,True)) control = AdaptiveIncrementControl(3,12) def cancel(token_value,stage): if owner._generation == 1 and stage == 'stiffened-shell.finite.increment': @@ -92,7 +92,7 @@ def cancel(token_value,stage): header=json.dumps(json.loads(saved[start:start+size]),indent=2).encode() noncanonical=MAGIC+len(header).to_bytes(4,'little')+header+saved[start+size:-32] noncanonical += sha256(noncanonical).digest() - untouched = anysolver.stiffened_shell.create_analysis(definition=_definition(False,True)) + untouched = anyfesolver.stiffened_shell.create_analysis(definition=_definition(False,True)) try: with pytest.raises(ValueError,match='noncanonical'): untouched.restore(noncanonical) @@ -107,7 +107,7 @@ def cancel(token_value,stage): targets=(1.,),increment_control=control) assert resumed.checkpoint() == saved bad = encode_control(owner._identity,replace(state,cursor=1),inner) - untouched = anysolver.stiffened_shell.create_analysis(definition=_definition(False,True)) + untouched = anyfesolver.stiffened_shell.create_analysis(definition=_definition(False,True)) try: with pytest.raises(ValueError,match='cursor disagrees'): untouched.restore(bad) @@ -124,7 +124,7 @@ def cancel(token_value,stage): def test_exhaustion_is_not_equilibrium(monkeypatch): _bounded_increment(monkeypatch) - owner = anysolver.stiffened_shell.create_analysis(definition=_definition()) + owner = anyfesolver.stiffened_shell.create_analysis(definition=_definition()) try: with pytest.raises(AdaptiveIncrementExhausted,match='cutback limit') as caught: owner.solve(ACTIONS,targets=(1.,),increment_control=AdaptiveIncrementControl(1,12)) @@ -138,8 +138,8 @@ def test_exhaustion_is_not_equilibrium(monkeypatch): def test_checkpoint_resource_failure_precedes_atomic_publish(monkeypatch): - import anysolver._stiffened_shell_increment_control as control_module - owner = anysolver.stiffened_shell.create_analysis(definition=_definition()) + import anyfesolver._stiffened_shell_increment_control as control_module + owner = anyfesolver.stiffened_shell.create_analysis(definition=_definition()) try: first = owner.solve(ACTIONS,targets=(.25,)) saved = owner.checkpoint() @@ -154,8 +154,8 @@ def test_checkpoint_resource_failure_precedes_atomic_publish(monkeypatch): def test_attempt_budget_keeps_durable_prefix_and_is_terminal(monkeypatch): _bounded_increment(monkeypatch) control = AdaptiveIncrementControl(3,3) - owner = anysolver.stiffened_shell.create_analysis(definition=_definition()) - resumed = anysolver.stiffened_shell.create_analysis(definition=_definition()) + owner = anyfesolver.stiffened_shell.create_analysis(definition=_definition()) + resumed = anyfesolver.stiffened_shell.create_analysis(definition=_definition()) try: with pytest.raises(AdaptiveIncrementExhausted,match='attempt limit') as caught: owner.solve(ACTIONS,targets=(1.,),increment_control=control) @@ -171,7 +171,7 @@ def test_attempt_budget_keeps_durable_prefix_and_is_terminal(monkeypatch): def test_cancelled_prepared_controller_snapshot_is_not_published(monkeypatch): - import anysolver._stiffened_shell_ge_finite_experimental as finite + import anyfesolver._stiffened_shell_ge_finite_experimental as finite original = finite.cancellation_safe_point token = CancellationToken() def cancel(token_value,stage): @@ -179,7 +179,7 @@ def cancel(token_value,stage): token.cancel('prepared checkpoint') return original(token_value,stage) monkeypatch.setattr(finite,'cancellation_safe_point',cancel) - owner = anysolver.stiffened_shell.create_analysis(definition=_definition()) + owner = anyfesolver.stiffened_shell.create_analysis(definition=_definition()) try: with pytest.raises(SolveCancelled,match='prepared checkpoint'): owner.solve(ACTIONS,targets=(.25,),increment_control=AdaptiveIncrementControl(), @@ -198,7 +198,7 @@ def fail(*args,**kwargs): calls.append(1) raise error monkeypatch.setattr(FinitePointDriver,'_solve_fixed',fail) - owner = anysolver.stiffened_shell.create_analysis(definition=_definition()) + owner = anyfesolver.stiffened_shell.create_analysis(definition=_definition()) try: with pytest.raises(type(error)) as caught: owner.solve(ACTIONS,increment_control=AdaptiveIncrementControl()) diff --git a/tests/test_stiffened_shell_l1_assembly_experimental.py b/tests/test_stiffened_shell_l1_assembly_experimental.py index 7a878f341..08be9f100 100644 --- a/tests/test_stiffened_shell_l1_assembly_experimental.py +++ b/tests/test_stiffened_shell_l1_assembly_experimental.py @@ -6,11 +6,11 @@ import numpy as np import pytest -from anysolver import b3_ge, stiffened_shell -from anysolver._ge_beam3_retained_generalized_state import Mechanical -from anysolver._stiffened_shell_ge_checkpoint_binary import encode -from anysolver._stiffened_shell_ge_experimental import FINITE_CHECKPOINT -from anysolver._stiffened_shell_l1_assembly_experimental import SPACE_A, SPACE_B +from anyfesolver import b3_ge, stiffened_shell +from anyfesolver._ge_beam3_retained_generalized_state import Mechanical +from anyfesolver._stiffened_shell_ge_checkpoint_binary import encode +from anyfesolver._stiffened_shell_ge_experimental import FINITE_CHECKPOINT +from anyfesolver._stiffened_shell_l1_assembly_experimental import SPACE_A, SPACE_B def _definition(space=SPACE_A, *, expected_offset=(0., 0., 0.)): @@ -538,7 +538,7 @@ def test_bl5_supported_p0_rows_match_dropped_yaw_l1_locally( resolution. It does not compare the existing asymmetric L1 spaces or establish stability, locking, or physical fidelity of either policy. """ - from anysolver._stiffened_shell_l1_local_experimental import L1LocalOperator + from anyfesolver._stiffened_shell_l1_local_experimental import L1LocalOperator definition = _bl5_nonmatching_definition(shell_edges, span) owner = stiffened_shell.create_analysis(definition=definition) diff --git a/tests/test_stiffened_shell_l1_local_experimental.py b/tests/test_stiffened_shell_l1_local_experimental.py index da978e591..7af8fc840 100644 --- a/tests/test_stiffened_shell_l1_local_experimental.py +++ b/tests/test_stiffened_shell_l1_local_experimental.py @@ -4,7 +4,7 @@ import pytest from dataclasses import replace -from anysolver._stiffened_shell_l1_local_experimental import ( +from anyfesolver._stiffened_shell_l1_local_experimental import ( L1LocalOperator, NativeHalfCellPort, ) from scripts._b3_e4_f03_native_fixture import build diff --git a/tests/test_stiffened_shell_material_reference.py b/tests/test_stiffened_shell_material_reference.py index 7052ae14c..3d3c1f994 100644 --- a/tests/test_stiffened_shell_material_reference.py +++ b/tests/test_stiffened_shell_material_reference.py @@ -3,8 +3,8 @@ import numpy as np import pytest from scipy.spatial.transform import Rotation -from anysolver import b3_ge,stiffened_shell as ss -from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver +from anyfesolver import b3_ge,stiffened_shell as ss +from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver from test_stiffened_shell_curved_material import ( curved_material_panel,make_owner,_actions,assert_generalized_records_equal, ) diff --git a/tests/test_stiffened_shell_material_rotation_numerics.py b/tests/test_stiffened_shell_material_rotation_numerics.py index 298bd8700..303c0cdcd 100644 --- a/tests/test_stiffened_shell_material_rotation_numerics.py +++ b/tests/test_stiffened_shell_material_rotation_numerics.py @@ -1,9 +1,9 @@ """Numerical evaluation regressions; no new connection/material law.""" import numpy as np import pytest -from anysolver import _ge_beam3_g3c_so3_numerics as stable -from anysolver import _ge_beam3_variational_shell as shell -from anysolver._ge_beam3_mixed_ad import Jet2 +from anyfesolver import _ge_beam3_g3c_so3_numerics as stable +from anyfesolver import _ge_beam3_variational_shell as shell +from anyfesolver._ge_beam3_mixed_ad import Jet2 from test_ge_beam3_g3c_elementary_diagnostic import oracle @@ -38,7 +38,7 @@ def forbidden(*args):raise AssertionError("historical rotation dispatch") def test_selected_spatial_chart_preserves_historical_dispatch(monkeypatch): - from anysolver import _stiffened_shell_algorithmic_pullback as pullback + from anyfesolver import _stiffened_shell_algorithmic_pullback as pullback u = np.zeros(24);u[3:6] = [.00062, .00125, .00045] force = np.arange(24.) def forbidden(*args):raise AssertionError("historical chart dispatch") @@ -52,7 +52,7 @@ def forbidden(*args):raise AssertionError("historical chart dispatch") def test_pre_stable_material_checkpoint_rejected_without_commit(): from pathlib import Path - from anysolver import stiffened_shell as ss + from anyfesolver import stiffened_shell as ss from test_stiffened_shell_ge_distributing_material import definition owner = ss.create_analysis(definition=definition()) try: diff --git a/tests/test_stiffened_shell_native_arc.py b/tests/test_stiffened_shell_native_arc.py index 6114af65d..74ddad95e 100644 --- a/tests/test_stiffened_shell_native_arc.py +++ b/tests/test_stiffened_shell_native_arc.py @@ -2,9 +2,9 @@ from pathlib import Path import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken,SolveCancelled -from anysolver._stiffened_shell_arc_checkpoint import decode_snapshot,encode_snapshot,identities,NATIVE_CHART_POLICY +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken,SolveCancelled +from anyfesolver._stiffened_shell_arc_checkpoint import decode_snapshot,encode_snapshot,identities,NATIVE_CHART_POLICY from test_stiffened_shell_native_point_displacement import owner,native_state from test_stiffened_shell_native_generalized_adaptive_history import exact from test_stiffened_shell_q4_pullback_owner import _definition @@ -45,7 +45,7 @@ def test_native_arc_fixed_predecessor_restart_and_cancel(request,monkeypatch,fam if rebase:analysis.rebase_rotations(analysis._generation) seed_raw=analysis.checkpoint();generation=analysis._generation # Native generalized/fibre increments must bypass BL5 event-cell selection. - import anysolver._stiffened_shell_branch_event_trial as events + import anyfesolver._stiffened_shell_branch_event_trial as events def forbidden(*args,**kwargs):raise AssertionError('native arc used BL5 event fractions') monkeypatch.setattr(events,'trial_fraction',forbidden) token=CancellationToken();seen=[] @@ -73,7 +73,7 @@ def stop(result):seen.append(result);token.cancel('accepted native prefix') assert final.free_equilibrium_ratio<=1e-8 and final.constraint_max<=1e-9 assert not final.production_qualified # Cancellation after isolated preparation leaves the live endpoint intact. - import anysolver._stiffened_shell_arc_publication as publication + import anyfesolver._stiffened_shell_arc_publication as publication prefix=analysis.checkpoint();driver=analysis._finite_driver;token=CancellationToken() safe=publication.cancellation_safe_point def cancel_at_commit(value,stage): @@ -114,8 +114,8 @@ def test_native_arc_corrupted_replay_is_atomic(request,family): def test_stable_elastic_s3_force_seed_arc_and_historical_rejection(request,monkeypatch): from test_stiffened_shell_native_fibre_s3_displacement import fibre_model from test_stiffened_shell_native_point_displacement import OPTIONS,DIRECTION - from anysolver._stiffened_shell_ge_checkpoint_binary import decode,encode - from anysolver._stiffened_shell_beam_history import shapes + from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode,encode + from anyfesolver._stiffened_shell_beam_history import shapes model=fibre_model();analysis=owner(request,model);legacy=owner(request,model) zero=(ss.NodalAction('beam',105,(0.,0.,0.,0.,0.,0.)),) analysis.solve(zero,(1.,),**OPTIONS) @@ -139,8 +139,8 @@ def layout(kind,generation): resumed=owner(request,model);restored=resumed.restore(analysis.checkpoint()) compare_arc(result,restored) assert resumed._finite_driver._stable_s3 and resumed.checkpoint()==analysis.checkpoint() - from anysolver import _stiffened_shell_arc_control as controller - from anysolver._stiffened_shell_arc_trial import correct + from anyfesolver import _stiffened_shell_arc_control as controller + from anyfesolver._stiffened_shell_arc_trial import correct def forbidden(*args,**kwargs):raise AssertionError('historical S3 arc seed reached trial or assembly') with monkeypatch.context() as patch: patch.setattr(controller,'select_trial',forbidden) diff --git a/tests/test_stiffened_shell_native_arc_progress.py b/tests/test_stiffened_shell_native_arc_progress.py index 6fb695067..50d409ec5 100644 --- a/tests/test_stiffened_shell_native_arc_progress.py +++ b/tests/test_stiffened_shell_native_arc_progress.py @@ -4,17 +4,17 @@ import numpy as np import pytest from scipy import sparse -from anysolver._stiffened_shell_arc_metric import PhysicalChordMetric -from anysolver._stiffened_shell_arc_trial import correct,select_trial,ArcTrialFailure,ArcSelectionFailure -from anysolver._stiffened_shell_arc_checkpoint import identities +from anyfesolver._stiffened_shell_arc_metric import PhysicalChordMetric +from anyfesolver._stiffened_shell_arc_trial import correct,select_trial,ArcTrialFailure,ArcSelectionFailure +from anyfesolver._stiffened_shell_arc_checkpoint import identities def planar_driver(monkeypatch,endpoint,orientation=1,legacy=False): # q(s)=(-orientation*s**2,s), with both coordinates in one physical node. # This exact oracle snaps only roundoff close to the known endpoint. The # residual, tangent, plane, Newton/backtracking and cutbacks remain actual. - import anysolver._stiffened_shell_affine_endpoint as affine - import anysolver._stiffened_shell_arc_checkpoint as checkpoint + import anyfesolver._stiffened_shell_affine_endpoint as affine + import anyfesolver._stiffened_shell_arc_checkpoint as checkpoint monkeypatch.setattr(affine,'is_native_point_material',lambda owner:True) monkeypatch.setattr(checkpoint,'require_native_seed',lambda owner,driver:None) a=.25;parent_q=np.zeros(6);parent_q[:2]=(-orientation*a*a,-a) diff --git a/tests/test_stiffened_shell_native_beam_rebase_predecessor.py b/tests/test_stiffened_shell_native_beam_rebase_predecessor.py index 08c690c14..e8f4760ee 100644 --- a/tests/test_stiffened_shell_native_beam_rebase_predecessor.py +++ b/tests/test_stiffened_shell_native_beam_rebase_predecessor.py @@ -12,8 +12,8 @@ import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled from test_stiffened_shell_native_plastic_chart import ( definition, programme, same, has_flow, PREFIX, OPTIONS, CONTROL, ) diff --git a/tests/test_stiffened_shell_native_capacity.py b/tests/test_stiffened_shell_native_capacity.py index bdd2ecb4c..19ab3d3aa 100644 --- a/tests/test_stiffened_shell_native_capacity.py +++ b/tests/test_stiffened_shell_native_capacity.py @@ -9,8 +9,8 @@ import numpy as np import pytest -from anysolver import b3_ge, stiffened_shell as ss -from anysolver.control import CancellationToken +from anyfesolver import b3_ge, stiffened_shell as ss +from anyfesolver.control import CancellationToken from examples import stiffened_shell_native_capacity as capacity diff --git a/tests/test_stiffened_shell_native_coupled_displacement.py b/tests/test_stiffened_shell_native_coupled_displacement.py index ffe6b2817..b8cadfe6c 100644 --- a/tests/test_stiffened_shell_native_coupled_displacement.py +++ b/tests/test_stiffened_shell_native_coupled_displacement.py @@ -2,9 +2,9 @@ from math import fsum import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken,SolveCancelled -from anysolver._stiffened_shell_displacement_checkpoint import decode_snapshot,encode_snapshot +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken,SolveCancelled +from anyfesolver._stiffened_shell_displacement_checkpoint import decode_snapshot,encode_snapshot from examples.stiffened_shell_coupled_plastic_history import definition,OPTIONS from test_stiffened_shell_native_point_displacement import owner,compare,native_state @@ -55,7 +55,7 @@ def observe(result): bad=encode_snapshot(analysis,arrays=changed,**metadata) with pytest.raises(ValueError):untouched.restore(bad) assert untouched._generation==0 and untouched._finite_driver is None - import anysolver._stiffened_shell_displacement_corrector as corrector + import anyfesolver._stiffened_shell_displacement_corrector as corrector with monkeypatch.context() as patch: patch.setattr(corrector,'bordered_correction',lambda matrix,*args:(np.zeros(matrix.shape[0]),0.)) with pytest.raises(ss.DisplacementCorrectorFailure): diff --git a/tests/test_stiffened_shell_native_coupled_material.py b/tests/test_stiffened_shell_native_coupled_material.py index 8f1f43e3c..d324c81ed 100644 --- a/tests/test_stiffened_shell_native_coupled_material.py +++ b/tests/test_stiffened_shell_native_coupled_material.py @@ -1,18 +1,18 @@ """Atomic native beam / shell J2 state, not complete G3 qualification.""" from dataclasses import replace -import anysolver +import anyfesolver from anymaterial import DNVC208MaterialCurve import numpy as np import pytest -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_ge_experimental import NodalAction -from anysolver._stiffened_shell_ge_checkpoint_binary import ( +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_ge_experimental import NodalAction +from anyfesolver._stiffened_shell_ge_checkpoint_binary import ( NATIVE_SHELL_MAGIC, decode_s3, encode_s3, ) -from anysolver._stiffened_shell_ge_finite_experimental import native_shell_checkpoint_shapes -from anysolver.e4_pl_s3_v2d_state import seal_v2d_state +from anyfesolver._stiffened_shell_ge_finite_experimental import native_shell_checkpoint_shapes +from anyfesolver.e4_pl_s3_v2d_state import seal_v2d_state from test_stiffened_shell_ge_physical_fibre_finite import _yielding_definition from test_stiffened_shell_ge_physical_fibre_linear import _definition @@ -28,9 +28,9 @@ def definition_for(mixed=False, triangles=False): @pytest.mark.parametrize('mixed,triangles', ((False,False),(True,False),(True,True))) def test_coupled_material_update_restart_and_rejection(mixed, triangles, monkeypatch): definition = definition_for(mixed, triangles) - owner = anysolver.stiffened_shell.create_analysis(definition=definition) - resumed = anysolver.stiffened_shell.create_analysis(definition=definition) - bad = anysolver.stiffened_shell.create_analysis(definition=definition) + owner = anyfesolver.stiffened_shell.create_analysis(definition=definition) + resumed = anyfesolver.stiffened_shell.create_analysis(definition=definition) + bad = anyfesolver.stiffened_shell.create_analysis(definition=definition) actions = (NodalAction('beam',105,(0.,0.,1000.,0.,0.,0.)),) targets = (.05,) if triangles else (.5,1.) following = .055 if triangles else .5 @@ -87,7 +87,7 @@ def test_coupled_material_update_restart_and_rejection(mixed, triangles, monkeyp with pytest.raises(RuntimeError): owner.solve(actions, targets=(following,), max_iterations=1,max_backtracks=0) assert owner.checkpoint() == saved - from anysolver import _stiffened_shell_ge_finite_experimental as finite + from anyfesolver import _stiffened_shell_ge_finite_experimental as finite original = finite.cancellation_safe_point token = CancellationToken() def cancel(token_value, stage): @@ -108,7 +108,7 @@ def cancel(token_value, stage): if triangles: owner.rebase_rotations(expected_generation=direct.generation) chart_saved = owner.checkpoint() - chart_owner = anysolver.stiffened_shell.create_analysis(definition=definition) + chart_owner = anyfesolver.stiffened_shell.create_analysis(definition=definition) try: chart_owner.restore(chart_saved) assert chart_owner.checkpoint() == chart_saved diff --git a/tests/test_stiffened_shell_native_director_arc_metric.py b/tests/test_stiffened_shell_native_director_arc_metric.py index d08a2d7f1..be3158c00 100644 --- a/tests/test_stiffened_shell_native_director_arc_metric.py +++ b/tests/test_stiffened_shell_native_director_arc_metric.py @@ -8,14 +8,14 @@ from types import SimpleNamespace import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver._ge_beam3_p5.algebra import rotation -from anysolver._stiffened_shell_arc_metric import ( +from anyfesolver import stiffened_shell as ss +from anyfesolver._ge_beam3_p5.algebra import rotation +from anyfesolver._stiffened_shell_arc_metric import ( NativeDirectorChordMetric, PhysicalChordMetric, ChordDomainError, DIRECTOR_METRIC_ID, require_metric_owner, require_director_chart) -from anysolver._stiffened_shell_arc_trial import path_row -from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver, _State -from anysolver._stiffened_shell_rotation_charts import physical_frames +from anyfesolver._stiffened_shell_arc_trial import path_row +from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver, _State +from anyfesolver._stiffened_shell_rotation_charts import physical_frames def poses(): @@ -42,7 +42,7 @@ class ChangedMetric(NativeDirectorChordMetric):pass for weights,length in (([],1.),([0.],1.),([np.nan],1.),([1.],0.), ([1.],1e-200),([1.],1e200)): with pytest.raises(ValueError):NativeDirectorChordMetric(weights,length,1) - import anysolver._stiffened_shell_affine_endpoint as endpoint + import anyfesolver._stiffened_shell_affine_endpoint as endpoint definition=SimpleNamespace(shell_reference_policy='flat',points=(),footprints=(), distributing_footprints=(),finite_distributing_footprints=()) owner=SimpleNamespace(_shell_ids=(1,),_beam_ids=(2,),_definition=definition) @@ -151,7 +151,7 @@ def test_actual_advance_chart_rows_leave_retained_and_multipliers_unmeasured(pla path_row(driver,state,parent,metric,normal) np.testing.assert_array_equal(state.q,before_q);np.testing.assert_array_equal(state.frames,before_frames) # Pullback uses the actual exp-chart J, rather than treating chart entries as spatial spin. - from anysolver._ge_beam3_pose_joint import _exp_terms + from anyfesolver._ge_beam3_pose_joint import _exp_terms normal_spin=physical_frames(state.q[:6],anchors)[0,:,2] drill=np.zeros(38);drill[3:6]=np.linalg.solve(_exp_terms(state.q[3:6])[1],normal_spin) assert row@drill==pytest.approx(0.,abs=1e-14) @@ -197,9 +197,9 @@ def synthetic_corrector(monkeypatch): """Actual _advance with a controlled equilibrium/predictor oracle.""" from threading import RLock from scipy import sparse - from anysolver import _stiffened_shell_arc_trial as arc - from anysolver import _stiffened_shell_arc_checkpoint as checkpoint - from anysolver import _stiffened_shell_affine_endpoint as endpoint + from anyfesolver import _stiffened_shell_arc_trial as arc + from anyfesolver import _stiffened_shell_arc_checkpoint as checkpoint + from anyfesolver import _stiffened_shell_affine_endpoint as endpoint definition=SimpleNamespace(shell_reference_policy='flat',points=(),footprints=(), distributing_footprints=(),finite_distributing_footprints=()) owner=SimpleNamespace(_shell_ids=(1,),_shell_count=6,_beam_ids=(2,),_beam_parts=(), @@ -280,11 +280,11 @@ def test_public_director_history_restart_and_atomic_refusals(request,tmp_path,mo from examples.stiffened_shell_native_fibre_bl5_mixed_j2_displacement import definition from examples.stiffened_shell_native_fibre_bl5_displacement import ACTIONS from examples.stiffened_shell_native_material_bl5_arc import arc_control - from anysolver.control import CancellationToken,SolveCancelled - from anysolver._stiffened_shell_arc_trial import ArcSelectionFailure - from anysolver import _stiffened_shell_arc_control as controller - from anysolver import _stiffened_shell_arc_publication as publication - from anysolver._stiffened_shell_arc_checkpoint import ( + from anyfesolver.control import CancellationToken,SolveCancelled + from anyfesolver._stiffened_shell_arc_trial import ArcSelectionFailure + from anyfesolver import _stiffened_shell_arc_control as controller + from anyfesolver import _stiffened_shell_arc_publication as publication + from anyfesolver._stiffened_shell_arc_checkpoint import ( decode_snapshot,encode_snapshot,director_policy,metric_from_snapshot,requires_coordinate_progress) def capture(owner): driver=owner._finite_driver diff --git a/tests/test_stiffened_shell_native_displacement_adaptive.py b/tests/test_stiffened_shell_native_displacement_adaptive.py index 7e567a99e..5802ee8b7 100644 --- a/tests/test_stiffened_shell_native_displacement_adaptive.py +++ b/tests/test_stiffened_shell_native_displacement_adaptive.py @@ -3,11 +3,11 @@ from pathlib import Path import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken,SolveCancelled -from anysolver._stiffened_shell_displacement_adaptive import ( +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken,SolveCancelled +from anyfesolver._stiffened_shell_displacement_adaptive import ( Context,NATIVE_MAGIC,MAGIC,encode,decode,validate_progress,direction_hash) -from anysolver._stiffened_shell_displacement_increment import DisplacementIncrementState +from anyfesolver._stiffened_shell_displacement_increment import DisplacementIncrementState from test_stiffened_shell_native_point_displacement import owner,ACTIONS,DIRECTION,CONTROL,OPTIONS from test_stiffened_shell_native_plastic_s3_displacement import definition,compare from test_stiffened_shell_displacement_increment import assert_single_cutback_history @@ -26,7 +26,7 @@ def test_native_adaptive_actual_s3_cutback_cancel_restart(request,monkeypatch): targets=(initial*1.01,initial*1.02) limits=ss.AdaptiveIncrementControl(2,8) kw=dict(OPTIONS,displacement_control=CONTROL,increment_control=limits) - import anysolver._stiffened_shell_displacement_control as module + import anyfesolver._stiffened_shell_displacement_control as module original=module.correct;first=True def once(driver,**args): nonlocal first @@ -73,7 +73,7 @@ def test_native_mixed_rejected_work_is_durable_and_seed_guards(request,monkeypat analysis=owner(request,model);restored=owner(request,model) raw=(Path(__file__).parent/'data/native_mixed_j2_displacement/quarter-prefix-v1.bin').read_bytes() prefix=analysis.restore(raw) - import anysolver._stiffened_shell_displacement_control as module + import anyfesolver._stiffened_shell_displacement_control as module kw=dict(OPTIONS,displacement_control=CONTROL,increment_control=ss.AdaptiveIncrementControl(0,1)) with monkeypatch.context() as patch: patch.setattr(module,'correct',reject) @@ -107,7 +107,7 @@ def test_native_mixed_rejected_work_is_durable_and_seed_guards(request,monkeypat seed_resumed.solve(DIRECTION,context.state.targets,**kw) with pytest.raises(ValueError,match='nested'): encode(seed._identity,context,seed_saved,native=True) - from anysolver._stiffened_shell_increment_control import MAGIC as FORCE_MAGIC + from anyfesolver._stiffened_shell_increment_control import MAGIC as FORCE_MAGIC with pytest.raises(ValueError,match='nested'): encode(seed._identity,context,FORCE_MAGIC+seed_raw,native=True) seed._finite_driver._adaptive_state=object() @@ -121,7 +121,7 @@ def test_native_mixed_rejected_work_is_durable_and_seed_guards(request,monkeypat seed._finite_driver._external=None seed._finite_driver._state=replace(seed._finite_driver._state, shell_anchors=np.tile(np.eye(3),(len(seed._shell_ids),1,1))) - from anysolver._stiffened_shell_ge_checkpoint_binary import CHART_MAGIC + from anyfesolver._stiffened_shell_ge_checkpoint_binary import CHART_MAGIC # Identity chart framing is still a nested chart, not an ordinary force seed. with pytest.raises(ValueError,match='nested'): encode(seed._identity,context,CHART_MAGIC+seed_raw,native=True) diff --git a/tests/test_stiffened_shell_native_displacement_chart.py b/tests/test_stiffened_shell_native_displacement_chart.py index 53cab48bd..387e890bd 100644 --- a/tests/test_stiffened_shell_native_displacement_chart.py +++ b/tests/test_stiffened_shell_native_displacement_chart.py @@ -3,10 +3,10 @@ import numpy as np import pytest from scipy.spatial.transform import Rotation -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken,SolveCancelled -from anysolver._stiffened_shell_displacement_checkpoint import decode_snapshot,encode_snapshot,identities -from anysolver._stiffened_shell_displacement_adaptive import decode +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken,SolveCancelled +from anyfesolver._stiffened_shell_displacement_checkpoint import decode_snapshot,encode_snapshot,identities +from anyfesolver._stiffened_shell_displacement_adaptive import decode from test_stiffened_shell_native_point_displacement import owner,OPTIONS,native_state from test_stiffened_shell_native_generalized_adaptive_history import exact from test_stiffened_shell_q4_pullback_owner import _definition @@ -30,7 +30,7 @@ def test_native_material_chart_rebase_atomic_continue(request,monkeypatch,family with pytest.raises(SolveCancelled):analysis.rebase_rotations(previous.generation,cancellation_token=token) assert analysis.checkpoint()==raw and analysis._finite_driver is driver # Cancellation after isolated replay, immediately before locked publication. - import anysolver._stiffened_shell_displacement_control as displacement + import anyfesolver._stiffened_shell_displacement_control as displacement safe=displacement.cancellation_safe_point;token=CancellationToken() def cancel_before_publish(value,stage): if stage=='stiffened-shell.displacement.publish':token.cancel('prepared native chart') diff --git a/tests/test_stiffened_shell_native_distributed_load.py b/tests/test_stiffened_shell_native_distributed_load.py index 433d2abb8..463f0be27 100644 --- a/tests/test_stiffened_shell_native_distributed_load.py +++ b/tests/test_stiffened_shell_native_distributed_load.py @@ -4,12 +4,12 @@ import numpy as np import pytest -from anysolver._ge_beam3_fibre_line_work import evaluate as ad_work -from anysolver._ge_beam3_p5.algebra import rotation, skew -from anysolver._ge_beam3_retained_fibre import RetainedFibreOperator -from anysolver._ge_beam3_retained_generalized import RetainedGeneralizedOperator -from anysolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection -from anysolver._stiffened_shell_native_distributed_load import compile_native_distributed +from anyfesolver._ge_beam3_fibre_line_work import evaluate as ad_work +from anyfesolver._ge_beam3_p5.algebra import rotation, skew +from anyfesolver._ge_beam3_retained_fibre import RetainedFibreOperator +from anyfesolver._ge_beam3_retained_generalized import RetainedGeneralizedOperator +from anyfesolver._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection +from anyfesolver._stiffened_shell_native_distributed_load import compile_native_distributed from test_ge_beam3_fibre_section import section as fibre_section from test_stiffened_shell_native_gravity import reference, state @@ -58,7 +58,7 @@ def test_reusable_density_rejects_invalid_inputs(bad): def test_reusable_density_preserves_resolution_failures(): - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference op = operator() ref = Reference(op.reference.coordinates*1e-3, op.reference.nodal_triads) small = RetainedGeneralizedOperator(ref, op.section, order=4) @@ -85,9 +85,9 @@ def test_same_rule_ad_force_and_existing_cell_couple(kind, order, curved): actual = kernel.evaluate(x, low, u) expected = ad_work(op.reference, x, low, u, force, order=order) if kind == 'fibre': - from anysolver._ge_beam3_fibre_distributed_couples import cell_couple_load + from anyfesolver._ge_beam3_fibre_distributed_couples import cell_couple_load else: - from anysolver._ge_beam3_generalized_static_boundary import cell_couple_load + from anyfesolver._ge_beam3_generalized_static_boundary import cell_couple_load applied = cell_couple_load(op, couple) np.testing.assert_allclose(actual.external_force, expected.gradient+applied, rtol=4e-14, atol=1e-14) spatial = expected.hessian.copy() @@ -195,7 +195,7 @@ def test_rejects_wrong_operator_nonfinite_complex_and_unrepresentable_values(): kernel.evaluate(np.full((3, 3), np.nan), low, u) with pytest.raises(ValueError): kernel.evaluate(x, low, np.zeros((2, 3, 3))) - from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference + from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference small_ref = Reference(op.reference.coordinates*1e-3, op.reference.nodal_triads) small_op = RetainedGeneralizedOperator(small_ref, op.section, order=4) # Short reference shape measures cannot represent this nonzero force. diff --git a/tests/test_stiffened_shell_native_fibre_bl5.py b/tests/test_stiffened_shell_native_fibre_bl5.py index 6c5be5e5d..a5264deae 100644 --- a/tests/test_stiffened_shell_native_fibre_bl5.py +++ b/tests/test_stiffened_shell_native_fibre_bl5.py @@ -5,15 +5,15 @@ import pickle import pytest from scipy.linalg import eig -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled -from anysolver import _stiffened_shell_ge_point_buckling as buckling +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver import _stiffened_shell_ge_point_buckling as buckling from examples.stiffened_shell_native_fibre_bl5 import definition, workflow from test_stiffened_shell_ge_line_buckling import line_oracle, direct_line_ad from test_stiffened_shell_ge_mixed_buckling import dense_mixed_oracle -from anysolver._ge_beam3_pose_joint import _exp_terms -from anysolver._ge_beam3_retained_generalized_state import Mechanical -from anysolver._stiffened_shell_ge_finite_experimental import _position_pair +from anyfesolver._ge_beam3_pose_joint import _exp_terms +from anyfesolver._ge_beam3_retained_generalized_state import Mechanical +from anyfesolver._stiffened_shell_ge_finite_experimental import _position_pair ACTIONS = (ss.NodalAction('beam',105,(-1000.,0.,100.,0.,0.,0.)),) diff --git a/tests/test_stiffened_shell_native_fibre_bl5_material.py b/tests/test_stiffened_shell_native_fibre_bl5_material.py index 6751c0a87..0564ab514 100644 --- a/tests/test_stiffened_shell_native_fibre_bl5_material.py +++ b/tests/test_stiffened_shell_native_fibre_bl5_material.py @@ -3,9 +3,9 @@ import json import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver from examples.stiffened_shell_native_fibre_bl5_material import definition, ACTIONS, CONTROLS @@ -22,7 +22,7 @@ def test_policy_admission_and_force_only_refusals(request): assert 'shell J2 plastic' not in a.capabilities['excluded'] assert a.capabilities['retained_coordinate_scale_policy'] == 'native_force_moment_roles_v1' start = a._shell_count+6*len(a._beam_ids) - from anysolver._stiffened_shell_ge_experimental import _reference_section_tangent + from anyfesolver._stiffened_shell_ge_experimental import _reference_section_tangent for i, (element, _, _) in enumerate(a._beam_parts): scale = np.abs(_reference_section_tangent(element.section))@np.r_[np.ones(3), np.ones(3)/a._reference_length] expected = np.r_[np.tile(scale[:3], 2), np.tile(scale[3:], 4)] @@ -47,10 +47,10 @@ def test_policy_admission_and_force_only_refusals(request): def test_policy_restore_load_and_envelope_refusals_are_atomic(request): - from anysolver._stiffened_shell_ge_experimental import CHECKPOINT, CHART_CHECKPOINT_MAGIC - from anysolver._stiffened_shell_staged_load_experimental import MAGIC as STAGED_MAGIC - from anysolver._stiffened_shell_ge_distributed_load import MAGIC as DISTRIBUTED_MAGIC - from anysolver._stiffened_shell_ge_distributed_programme import MAGIC as PROGRAMME_MAGIC + from anyfesolver._stiffened_shell_ge_experimental import CHECKPOINT, CHART_CHECKPOINT_MAGIC + from anyfesolver._stiffened_shell_staged_load_experimental import MAGIC as STAGED_MAGIC + from anyfesolver._stiffened_shell_ge_distributed_load import MAGIC as DISTRIBUTED_MAGIC + from anyfesolver._stiffened_shell_ge_distributed_programme import MAGIC as PROGRAMME_MAGIC model = definition(shell_material=False) a = make(request, model) zero = dict(schema=CHECKPOINT, model=a.preflight()['identity'], generation=1, @@ -95,7 +95,7 @@ def test_public_partial_fibre_workflow(): def test_public_partial_report_matches_final_accepted_state(monkeypatch, tmp_path): - from anysolver._stiffened_shell_ge_experimental import ExperimentalGEAnalysis + from anyfesolver._stiffened_shell_ge_experimental import ExperimentalGEAnalysis from examples.stiffened_shell_native_fibre_bl5_material import workflow observed = [] original = ExperimentalGEAnalysis.solve @@ -125,7 +125,7 @@ def capture(self, *args, **kwargs): def test_partial_material_trial_rejection_cancel_and_restore_atomicity(request, monkeypatch): - from anysolver._stiffened_shell_increment_control import FiniteIncrementFailure + from anyfesolver._stiffened_shell_increment_control import FiniteIncrementFailure model = definition() a = make(request, model) prefix = a.solve(ACTIONS, (.01, .1, .2), **CONTROLS) @@ -268,7 +268,7 @@ def cancel_trial(self, *args, **kwargs): with pytest.raises(SolveCancelled): a.solve(ACTIONS, (1.1,), cancellation_token=midtrial, **CONTROLS) assert a.checkpoint() == saved - from anysolver._stiffened_shell_increment_control import FiniteIncrementFailure + from anyfesolver._stiffened_shell_increment_control import FiniteIncrementFailure with pytest.raises(FiniteIncrementFailure) as rejected: a.solve(ACTIONS, (1.1,), max_iterations=1, max_backtracks=0) assert rejected.value.attempt.status == 'rejected' @@ -281,7 +281,7 @@ def failed_trial(self, *args, **kwargs): with pytest.raises(RuntimeError, match='injected local'): a.solve(ACTIONS, (1.1,), **CONTROLS) assert a.checkpoint() == saved - from anysolver._ge_beam3_retained_fibre import RetainedFibreOperator + from anyfesolver._ge_beam3_retained_fibre import RetainedFibreOperator calls = [] def refuse_mutated_inventory(self): calls.append(1) diff --git a/tests/test_stiffened_shell_native_fibre_bl5_s3.py b/tests/test_stiffened_shell_native_fibre_bl5_s3.py index a55f9af65..31d03071c 100644 --- a/tests/test_stiffened_shell_native_fibre_bl5_s3.py +++ b/tests/test_stiffened_shell_native_fibre_bl5_s3.py @@ -2,13 +2,13 @@ from dataclasses import replace import numpy as np import pytest -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from examples.stiffened_shell_native_fibre_bl5 import definition,workflow from test_stiffened_shell_native_fibre_bl5 import ( ACTIONS,test_public_recovery_fresh_restart_continue_and_spectrum as _public, test_full42_and_direct_bl5_scalar_curvature_oracle as _oracle, test_public_refusals_atomic_corruption_cancel_mutation as _refusals) -from anysolver import _stiffened_shell_ge_point_buckling as buckling +from anyfesolver import _stiffened_shell_ge_point_buckling as buckling @pytest.fixture(scope='module',params=(('s3','biaxial','fibre','p0'), diff --git a/tests/test_stiffened_shell_native_fibre_chart_transport_exact.py b/tests/test_stiffened_shell_native_fibre_chart_transport_exact.py index d9028c2d8..7154b858c 100644 --- a/tests/test_stiffened_shell_native_fibre_chart_transport_exact.py +++ b/tests/test_stiffened_shell_native_fibre_chart_transport_exact.py @@ -16,7 +16,7 @@ import numpy as np -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from test_stiffened_shell_native_plastic_chart import ( PREFIX, definition, has_flow, programme, diff --git a/tests/test_stiffened_shell_native_fibre_energy.py b/tests/test_stiffened_shell_native_fibre_energy.py index 05f97cb40..7507380d1 100644 --- a/tests/test_stiffened_shell_native_fibre_energy.py +++ b/tests/test_stiffened_shell_native_fibre_energy.py @@ -4,12 +4,12 @@ """ from decimal import Decimal as D, localcontext -import anysolver +import anyfesolver import numpy as np import pytest -from anysolver._ge_beam3_fibre_section import canonical -from anysolver._stiffened_shell_ge_experimental import NodalAction +from anyfesolver._ge_beam3_fibre_section import canonical +from anyfesolver._stiffened_shell_ge_experimental import NodalAction from test_ge_beam3_fibre_cell import model from test_ge_beam3_retained_fibre import make_model from test_ge_beam3_retained_plastic import args @@ -84,8 +84,8 @@ def test_legacy_station_recovery_and_new_material_recovery_agree(): @pytest.mark.parametrize('mixed', (False,True)) def test_material_energy_survives_atomic_restore_and_unload(mixed): definition = _yielding_definition(mixed) - owner = anysolver.stiffened_shell.create_analysis(definition=definition) - resumed = anysolver.stiffened_shell.create_analysis(definition=definition) + owner = anyfesolver.stiffened_shell.create_analysis(definition=definition) + resumed = anyfesolver.stiffened_shell.create_analysis(definition=definition) try: actions = (NodalAction('beam',105,(0.,0.,1000.,0.,0.,0.)),) first = owner.solve(actions,targets=(.5,1.),max_iterations=18) diff --git a/tests/test_stiffened_shell_native_fibre_s3_displacement.py b/tests/test_stiffened_shell_native_fibre_s3_displacement.py index 99eac37b6..bf00a4d8d 100644 --- a/tests/test_stiffened_shell_native_fibre_s3_displacement.py +++ b/tests/test_stiffened_shell_native_fibre_s3_displacement.py @@ -3,11 +3,11 @@ from math import fsum import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_displacement_checkpoint import decode_snapshot -from anysolver._stiffened_shell_ge_checkpoint_binary import decode, encode -from anysolver._stiffened_shell_beam_history import shapes +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_displacement_checkpoint import decode_snapshot +from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode, encode +from anyfesolver._stiffened_shell_beam_history import shapes from test_stiffened_shell_native_point_displacement import ( model, owner, compare, ACTIONS, DIRECTION, CONTROL, OPTIONS, HISTORICAL_POLICY) from test_stiffened_shell_native_s3_displacement_admission import compare_generalized @@ -51,7 +51,7 @@ def accepted(result): if family == 'mixed': compare_generalized(prefix.beam_generalized_material, restored.beam_generalized_material) (tmp_path/'fibre-s3-prefix.checkpoint').write_bytes(saved) - import anysolver._stiffened_shell_displacement_corrector as corrector + import anyfesolver._stiffened_shell_displacement_corrector as corrector with monkeypatch.context() as patch: patch.setattr(corrector, 'bordered_correction', lambda matrix, *args: (np.zeros(matrix.shape[0]), 0.)) with pytest.raises(ss.DisplacementCorrectorFailure): @@ -91,7 +91,7 @@ def layout(kind, generation): legacy.restore(historical) assert legacy.checkpoint() == historical and not legacy._finite_driver._stable_s3 before = legacy.recover() - import anysolver._stiffened_shell_displacement_control as control_module + import anyfesolver._stiffened_shell_displacement_control as control_module def forbidden(*args, **kwargs): raise AssertionError('incompatible seed reached checkpoint capture or trial') with monkeypatch.context() as patch: diff --git a/tests/test_stiffened_shell_native_fibre_s3_displacement_identity.py b/tests/test_stiffened_shell_native_fibre_s3_displacement_identity.py index e3b5a5010..73644b546 100644 --- a/tests/test_stiffened_shell_native_fibre_s3_displacement_identity.py +++ b/tests/test_stiffened_shell_native_fibre_s3_displacement_identity.py @@ -3,10 +3,10 @@ import json import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver._stiffened_shell_displacement_checkpoint import MAGIC, decode_snapshot -from anysolver._stiffened_shell_ge_checkpoint_binary import decode, encode -from anysolver._stiffened_shell_beam_history import shapes +from anyfesolver import stiffened_shell as ss +from anyfesolver._stiffened_shell_displacement_checkpoint import MAGIC, decode_snapshot +from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode, encode +from anyfesolver._stiffened_shell_beam_history import shapes from test_stiffened_shell_native_point_displacement import owner, ACTIONS, DIRECTION, CONTROL, OPTIONS from test_stiffened_shell_native_fibre_s3_displacement import fibre_model @@ -64,7 +64,7 @@ def layout(kind, generation): historical = encode('finite_native_material', analysis._identity, generation, tuple(values.items())) legacy.restore(historical) before = legacy.recover() - from anysolver._stiffened_shell_displacement_corrector import correct + from anyfesolver._stiffened_shell_displacement_corrector import correct def forbidden(*args, **kwargs): raise AssertionError('incompatible numerical policy reached assembly') monkeypatch.setattr(legacy._finite_driver, '_assemble', forbidden) @@ -75,8 +75,8 @@ def forbidden(*args, **kwargs): assert legacy.recover() is before and legacy._generation == generation assert legacy.checkpoint() == historical and not legacy._finite_driver._stable_s3 # A native adaptive envelope cannot smuggle the same incompatible force seed. - from anysolver._stiffened_shell_displacement_adaptive import Context,encode as envelope,direction_hash - from anysolver._stiffened_shell_displacement_increment import DisplacementIncrementState + from anyfesolver._stiffened_shell_displacement_adaptive import Context,encode as envelope,direction_hash + from anyfesolver._stiffened_shell_displacement_increment import DisplacementIncrementState context=Context(DisplacementIncrementState(ss.AdaptiveIncrementControl(),(.001,),0.), CONTROL.dof(legacy),direction_hash(legacy._finite_driver._load(DIRECTION)),0,20,12) fresh=owner(request,definition) diff --git a/tests/test_stiffened_shell_native_fold_local_diagnostic.py b/tests/test_stiffened_shell_native_fold_local_diagnostic.py index 187a052ea..f513194ab 100644 --- a/tests/test_stiffened_shell_native_fold_local_diagnostic.py +++ b/tests/test_stiffened_shell_native_fold_local_diagnostic.py @@ -6,8 +6,8 @@ import numpy as np import pytest -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._ge_beam3_mixed_ad import Jet2, so3_exp, so3_log +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._ge_beam3_mixed_ad import Jet2, so3_exp, so3_log from examples import stiffened_shell_native_fold_local_diagnostic as local diff --git a/tests/test_stiffened_shell_native_generalized_adaptive_history.py b/tests/test_stiffened_shell_native_generalized_adaptive_history.py index e219a2c56..db3953bbe 100644 --- a/tests/test_stiffened_shell_native_generalized_adaptive_history.py +++ b/tests/test_stiffened_shell_native_generalized_adaptive_history.py @@ -4,8 +4,8 @@ from math import fsum import numpy as np import pytest -from anysolver import b3_ge,stiffened_shell as ss -from anysolver.control import CancellationToken,SolveCancelled +from anyfesolver import b3_ge,stiffened_shell as ss +from anyfesolver.control import CancellationToken,SolveCancelled from test_stiffened_shell_native_point_displacement import model,owner,native_state,compare,OPTIONS,CONTROL,DIRECTION diff --git a/tests/test_stiffened_shell_native_generalized_q4_j2_history.py b/tests/test_stiffened_shell_native_generalized_q4_j2_history.py index d693cb9c7..433a81d9a 100644 --- a/tests/test_stiffened_shell_native_generalized_q4_j2_history.py +++ b/tests/test_stiffened_shell_native_generalized_q4_j2_history.py @@ -3,12 +3,12 @@ from math import fsum import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken,SolveCancelled +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken,SolveCancelled from test_stiffened_shell_q4_pullback_owner import _definition from test_stiffened_shell_native_point_displacement import owner,native_state,OPTIONS,CONTROL,DIRECTION from test_stiffened_shell_native_generalized_adaptive_history import exact -from anysolver._stiffened_shell_displacement_adaptive import decode +from anyfesolver._stiffened_shell_displacement_adaptive import decode def test_generalized_q4_j2_adaptive_reload_exact_restart(request): diff --git a/tests/test_stiffened_shell_native_gravity.py b/tests/test_stiffened_shell_native_gravity.py index b836f4658..e954b6be3 100644 --- a/tests/test_stiffened_shell_native_gravity.py +++ b/tests/test_stiffened_shell_native_gravity.py @@ -3,9 +3,9 @@ import numpy as np import pytest -from anysolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference -from anysolver._ge_beam3_p5.algebra import rotation, skew -from anysolver._stiffened_shell_native_gravity import compile_native_gravity +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference +from anyfesolver._ge_beam3_p5.algebra import rotation, skew +from anyfesolver._stiffened_shell_native_gravity import compile_native_gravity def reference(curved=False): @@ -94,7 +94,7 @@ def test_straight_eccentric_first_moment_actual_left_update_and_chart_hessian(): @pytest.mark.parametrize('order', [4, 8]) def test_curved_centered_parity_with_independent_line_work_ad(order): - from anysolver._ge_beam3_fibre_line_work import evaluate + from anyfesolver._ge_beam3_fibre_line_work import evaluate ref = reference(curved=True) x, low, u, g = state(ref) @@ -106,7 +106,7 @@ def test_curved_centered_parity_with_independent_line_work_ad(order): def test_order24_rigid_acceleration_matches_same_station_current_rest_mass(): - from anysolver._ge_beam3_p5_centered.mass import current_rest_mass + from anyfesolver._ge_beam3_p5_centered.mass import current_rest_mass ref = reference(curved=True) tensor = inertia(offset=(.1, .2, -.15)) @@ -237,7 +237,7 @@ def test_eccentric_torque_underflow_fails_without_losing_representable_nodal_for def test_underflow_boundary_allows_exact_cancellation_and_recovers_subnormal_sum(): - from anysolver._stiffened_shell_native_gravity import _resolve_zero_underflow + from anyfesolver._stiffened_shell_native_gravity import _resolve_zero_underflow smallest = float(np.nextafter(0., 1.)) assert _resolve_zero_underflow(0., ((smallest, .25), (-smallest, .25))) == 0. diff --git a/tests/test_stiffened_shell_native_material_bl5_arc.py b/tests/test_stiffened_shell_native_material_bl5_arc.py index 4ad945e0f..0365a428e 100644 --- a/tests/test_stiffened_shell_native_material_bl5_arc.py +++ b/tests/test_stiffened_shell_native_material_bl5_arc.py @@ -3,11 +3,11 @@ import numpy as np import pytest from scipy.spatial.transform import Rotation -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken,SolveCancelled -from anysolver._stiffened_shell_arc_checkpoint import ( +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken,SolveCancelled +from anyfesolver._stiffened_shell_arc_checkpoint import ( identities,decode_snapshot,encode_snapshot,NATIVE_BL5_CHART_POLICY) -from anysolver._stiffened_shell_beam_history import arrays as beam_arrays +from anyfesolver._stiffened_shell_beam_history import arrays as beam_arrays from examples.stiffened_shell_native_fibre_bl5_mixed_j2_displacement import definition from examples.stiffened_shell_native_fibre_bl5_displacement import ACTIONS,CONTROL,OPTIONS,TARGETS from examples.stiffened_shell_native_material_bl5_arc import arc_control @@ -63,7 +63,7 @@ def test_native_material_bl5_arc_restart_histories_and_retained_state(request,mo # Matched mixed/biaxial/P1 fixture: actual gen3 loaded endpoint yields S3. # Other force or P0 cases have no simultaneous-yield premise. assert any(np.any(row.alpha>0.) for row in owner.recover().shell_s3_material) - import anysolver._stiffened_shell_branch_event_trial as events + import anyfesolver._stiffened_shell_branch_event_trial as events def forbidden(*args,**kwargs):raise AssertionError('native arc reached generalized event-cell selection') monkeypatch.setattr(events,'trial_fraction',forbidden) seen=[];result=owner.continue_arc_length(ACTIONS,control,on_accepted=seen.append) @@ -95,8 +95,8 @@ def test_atomic_cancel_failure_and_prefix(request,monkeypatch): token=CancellationToken();token.cancel('before arc') with pytest.raises(SolveCancelled):owner.continue_arc_length(ACTIONS,control,cancellation_token=token) assert owner.checkpoint()==before and owner._finite_driver is driver - import anysolver._stiffened_shell_arc_control as controller - from anysolver._stiffened_shell_arc_trial import ArcSelectionFailure + import anyfesolver._stiffened_shell_arc_control as controller + from anyfesolver._stiffened_shell_arc_trial import ArcSelectionFailure def fail(*args,**kwargs):raise ArcSelectionFailure('injected bounded selection failure',()) with monkeypatch.context() as patch: patch.setattr(controller,'select_trial',fail) @@ -107,7 +107,7 @@ def stop(result):prefix.append(owner.checkpoint());token.cancel('after prefix') with pytest.raises(SolveCancelled): owner.continue_arc_length(ACTIONS,control,steps=2,cancellation_token=token,on_accepted=stop) assert len(prefix)==1 and owner.checkpoint()==prefix[0] - import anysolver._stiffened_shell_arc_publication as publication + import anyfesolver._stiffened_shell_arc_publication as publication before=owner.checkpoint();driver=owner._finite_driver;token=CancellationToken() safe=publication.cancellation_safe_point def cancel_at_commit(value,stage): @@ -158,8 +158,8 @@ def test_older_q4_native_material_identity_and_history_layout(request): def test_unadmitted_native_history_flag_does_not_admit_arc(request): model=definition();owner=analysis(request,model) - from anysolver._stiffened_shell_affine_endpoint import is_native_material_bl5_arc - from anysolver._stiffened_shell_arc_checkpoint import identities as arc_identities + from anyfesolver._stiffened_shell_affine_endpoint import is_native_material_bl5_arc + from anyfesolver._stiffened_shell_arc_checkpoint import identities as arc_identities assert is_native_material_bl5_arc(owner) owner._finite_bl5=False assert not is_native_material_bl5_arc(owner) @@ -180,8 +180,8 @@ def test_full_frame_metric_measures_normal_spin_and_is_objective(): def test_actual_update_path_row_and_full_retained_border(request): - from anysolver._stiffened_shell_arc_trial import path_row - from anysolver._stiffened_shell_displacement_corrector import bordered_path_correction + from anyfesolver._stiffened_shell_arc_trial import path_row + from anyfesolver._stiffened_shell_displacement_corrector import bordered_path_correction _,owner,control=seeded(request,seed='force');driver=owner._finite_driver parent=driver._state;n=len(parent.q);size=n+len(parent.multipliers) free=np.r_[owner._free,np.arange(n,size)] diff --git a/tests/test_stiffened_shell_native_mixed_j2_displacement_snapshot.py b/tests/test_stiffened_shell_native_mixed_j2_displacement_snapshot.py index 678507fc5..6a02ecaa2 100644 --- a/tests/test_stiffened_shell_native_mixed_j2_displacement_snapshot.py +++ b/tests/test_stiffened_shell_native_mixed_j2_displacement_snapshot.py @@ -2,8 +2,8 @@ from pathlib import Path import numpy as np import pytest -from anysolver.control import CancellationToken,SolveCancelled -from anysolver._stiffened_shell_displacement_checkpoint import decode_snapshot,encode_snapshot +from anyfesolver.control import CancellationToken,SolveCancelled +from anyfesolver._stiffened_shell_displacement_checkpoint import decode_snapshot,encode_snapshot from test_stiffened_shell_native_plastic_s3_displacement import definition,compare from test_stiffened_shell_native_point_displacement import owner,DIRECTION,CONTROL,OPTIONS diff --git a/tests/test_stiffened_shell_native_plastic_chart.py b/tests/test_stiffened_shell_native_plastic_chart.py index b932a2f82..f6d4bee5a 100644 --- a/tests/test_stiffened_shell_native_plastic_chart.py +++ b/tests/test_stiffened_shell_native_plastic_chart.py @@ -7,8 +7,8 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver import b3_ge, stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver import b3_ge, stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled from test_stiffened_shell_ge_physical_fibre_linear import _definition from test_stiffened_shell_staged_material_history import _capture, _same, _canonical from test_stiffened_shell_fibre_chart_boundary_comparison import ( diff --git a/tests/test_stiffened_shell_native_plastic_s3_displacement.py b/tests/test_stiffened_shell_native_plastic_s3_displacement.py index 0f3707d4a..a8370f70e 100644 --- a/tests/test_stiffened_shell_native_plastic_s3_displacement.py +++ b/tests/test_stiffened_shell_native_plastic_s3_displacement.py @@ -3,15 +3,15 @@ import numpy as np import pytest from anymaterial import DNVC208MaterialCurve -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_displacement_checkpoint import decode_snapshot, encode_snapshot -from anysolver._stiffened_shell_q4_algorithmic_pullback import HISTORICAL_POLICY +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_displacement_checkpoint import decode_snapshot, encode_snapshot +from anyfesolver._stiffened_shell_q4_algorithmic_pullback import HISTORICAL_POLICY from test_stiffened_shell_ge_experimental import _panel from test_stiffened_shell_native_point_displacement import owner, DIRECTION, CONTROL, OPTIONS from test_stiffened_shell_native_coupled_material import definition_for from test_stiffened_shell_native_s3_displacement_admission import compare_generalized -from anysolver.e4_pl_s3_v2d_state import seal_v2d_state +from anyfesolver.e4_pl_s3_v2d_state import seal_v2d_state def definition(fibre=False, mixed_shell=False): @@ -135,7 +135,7 @@ def test_mixed_j2_s3_binding_and_rejected_nominal_target(request,tmp_path): seed=failed.checkpoint() kw=dict(OPTIONS,displacement_control=CONTROL) # Frozen large-target failure is used solely as a rollback oracle. - from anysolver._stiffened_shell_displacement_corrector import DisplacementCorrectorFailure + from anyfesolver._stiffened_shell_displacement_corrector import DisplacementCorrectorFailure with pytest.raises(DisplacementCorrectorFailure,match='backtrack budget exhausted'): failed.solve(DIRECTION,(nominal*1.01,),**kw) assert failed.checkpoint()==seed and getattr(failed,'_displacement_snapshot',None) is None diff --git a/tests/test_stiffened_shell_native_point_displacement.py b/tests/test_stiffened_shell_native_point_displacement.py index 360887994..2695eb7e8 100644 --- a/tests/test_stiffened_shell_native_point_displacement.py +++ b/tests/test_stiffened_shell_native_point_displacement.py @@ -3,12 +3,12 @@ from math import fsum import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken,SolveCancelled -from anysolver._stiffened_shell_displacement_checkpoint import ( +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken,SolveCancelled +from anyfesolver._stiffened_shell_displacement_checkpoint import ( decode_snapshot,encode_snapshot,identities) -from anysolver._stiffened_shell_beam_history import arrays -from anysolver._stiffened_shell_q4_algorithmic_pullback import HISTORICAL_POLICY +from anyfesolver._stiffened_shell_beam_history import arrays +from anyfesolver._stiffened_shell_q4_algorithmic_pullback import HISTORICAL_POLICY from test_stiffened_shell_ge_experimental import _panel from test_stiffened_shell_ge_physical_fibre_finite import _yielding_definition @@ -88,7 +88,7 @@ def committed(result): with pytest.raises(SolveCancelled): control.solve(DIRECTION,(targets[1],),**kw,cancellation_token=cancelled) assert control.checkpoint()==saved - import anysolver._stiffened_shell_displacement_corrector as corrector + import anyfesolver._stiffened_shell_displacement_corrector as corrector with monkeypatch.context() as patch: patch.setattr(corrector,'bordered_correction',lambda matrix,*args:(np.zeros(matrix.shape[0]),0.)) with pytest.raises(ss.DisplacementCorrectorFailure): @@ -111,7 +111,7 @@ def committed(result): untouched.restore(bad) assert untouched._generation==0 and untouched._finite_driver is None assert fresh.checkpoint()==saved - from anysolver._stiffened_shell_displacement_control import publish + from anyfesolver._stiffened_shell_displacement_control import publish with pytest.raises(ValueError,match='stale displacement publication'): publish(control,saved,expected_driver=control._finite_driver, expected_generation=control._generation+1) diff --git a/tests/test_stiffened_shell_native_point_precision_policy.py b/tests/test_stiffened_shell_native_point_precision_policy.py index 01727bb1a..ff8310b33 100644 --- a/tests/test_stiffened_shell_native_point_precision_policy.py +++ b/tests/test_stiffened_shell_native_point_precision_policy.py @@ -9,9 +9,9 @@ import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled -from anysolver import _stiffened_shell_ge_finite_experimental as finite +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver import _stiffened_shell_ge_finite_experimental as finite from test_stiffened_shell_native_plastic_chart import definition, programme from test_stiffened_shell_ge_physical_fibre_linear import _definition as _fibre_panel diff --git a/tests/test_stiffened_shell_native_proportional_capacity.py b/tests/test_stiffened_shell_native_proportional_capacity.py index 73bb3fdaf..d5ea4894f 100644 --- a/tests/test_stiffened_shell_native_proportional_capacity.py +++ b/tests/test_stiffened_shell_native_proportional_capacity.py @@ -11,8 +11,8 @@ import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import SolveCancelled +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import SolveCancelled from examples import stiffened_shell_native_capacity as capacity diff --git a/tests/test_stiffened_shell_native_s3_displacement.py b/tests/test_stiffened_shell_native_s3_displacement.py index 6f6f957f4..32dd437fc 100644 --- a/tests/test_stiffened_shell_native_s3_displacement.py +++ b/tests/test_stiffened_shell_native_s3_displacement.py @@ -4,9 +4,9 @@ from hashlib import sha256 import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_displacement_checkpoint import ( +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_displacement_checkpoint import ( MAGIC, ELASTIC_S3_POLICY, STABLE_ELASTIC_S3_POLICY, decode_snapshot, identities, replay_s3_stable) from test_stiffened_shell_native_point_displacement import ( @@ -77,7 +77,7 @@ def accepted(result): assert resumed.checkpoint() == saved compare(prefix, restored) (tmp_path/'s3-prefix.checkpoint').write_bytes(saved) - import anysolver._stiffened_shell_displacement_corrector as corrector + import anyfesolver._stiffened_shell_displacement_corrector as corrector with monkeypatch.context() as patch: patch.setattr(corrector, 'bordered_correction', lambda matrix, *args: (np.zeros(matrix.shape[0]), 0.)) with pytest.raises(ss.DisplacementCorrectorFailure): diff --git a/tests/test_stiffened_shell_native_s3_displacement_admission.py b/tests/test_stiffened_shell_native_s3_displacement_admission.py index 2224cfe9d..54138dd78 100644 --- a/tests/test_stiffened_shell_native_s3_displacement_admission.py +++ b/tests/test_stiffened_shell_native_s3_displacement_admission.py @@ -2,7 +2,7 @@ from dataclasses import fields, replace import numpy as np import pytest -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from test_stiffened_shell_native_point_displacement import ( model, owner, ACTIONS, DIRECTION, CONTROL, OPTIONS, HISTORICAL_POLICY) from test_stiffened_shell_ge_finite_experimental import _q4_shell_j2_panel diff --git a/tests/test_stiffened_shell_native_s3_fibre_chart.py b/tests/test_stiffened_shell_native_s3_fibre_chart.py index 57828269f..f63e292fa 100644 --- a/tests/test_stiffened_shell_native_s3_fibre_chart.py +++ b/tests/test_stiffened_shell_native_s3_fibre_chart.py @@ -8,14 +8,14 @@ import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver._stiffened_shell_displacement_adaptive import decode -from anysolver._stiffened_shell_displacement_checkpoint import decode_snapshot -from anysolver._stiffened_shell_beam_history import ( +from anyfesolver import stiffened_shell as ss +from anyfesolver._stiffened_shell_displacement_adaptive import decode +from anyfesolver._stiffened_shell_displacement_checkpoint import decode_snapshot +from anyfesolver._stiffened_shell_beam_history import ( arrays as native_history_arrays, histories as native_histories, ) -from anysolver._stiffened_shell_ge_experimental import NodalAction -from anysolver._ge_beam3_fibre_section import PhysicalFibreSection +from anyfesolver._stiffened_shell_ge_experimental import NodalAction +from anyfesolver._ge_beam3_fibre_section import PhysicalFibreSection from examples.stiffened_shell_coupled_s3_adaptive_history import ( CONTROL, DIRECTION, OPTIONS, definition, ) diff --git a/tests/test_stiffened_shell_native_s3_fibre_reversal.py b/tests/test_stiffened_shell_native_s3_fibre_reversal.py index 7da3c3960..e2bac7445 100644 --- a/tests/test_stiffened_shell_native_s3_fibre_reversal.py +++ b/tests/test_stiffened_shell_native_s3_fibre_reversal.py @@ -3,10 +3,10 @@ import math import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken,SolveCancelled -from anysolver._stiffened_shell_displacement_adaptive import decode,encode -from anysolver._stiffened_shell_displacement_checkpoint import decode_snapshot,encode_snapshot +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken,SolveCancelled +from anyfesolver._stiffened_shell_displacement_adaptive import decode,encode +from anyfesolver._stiffened_shell_displacement_checkpoint import decode_snapshot,encode_snapshot from examples.stiffened_shell_coupled_s3_adaptive_history import definition,activity,DIRECTION,CONTROL,OPTIONS from test_stiffened_shell_native_point_displacement import owner from test_stiffened_shell_native_plastic_s3_displacement import compare diff --git a/tests/test_stiffened_shell_native_s3_replay_rounding.py b/tests/test_stiffened_shell_native_s3_replay_rounding.py index 146bbe43b..3e2afd2e4 100644 --- a/tests/test_stiffened_shell_native_s3_replay_rounding.py +++ b/tests/test_stiffened_shell_native_s3_replay_rounding.py @@ -13,8 +13,8 @@ import numpy as np import pytest -from anysolver._stiffened_shell_ge_finite_experimental import _require_native_s3_replay -from anysolver.e4_pl_s3_v2d_state import seal_v2d_state +from anyfesolver._stiffened_shell_ge_finite_experimental import _require_native_s3_replay +from anyfesolver.e4_pl_s3_v2d_state import seal_v2d_state from test_stiffened_shell_native_point_displacement import owner from test_stiffened_shell_native_plastic_s3_displacement import definition diff --git a/tests/test_stiffened_shell_nodal_rigid_footprint.py b/tests/test_stiffened_shell_nodal_rigid_footprint.py index 733677a85..0ac2616f7 100644 --- a/tests/test_stiffened_shell_nodal_rigid_footprint.py +++ b/tests/test_stiffened_shell_nodal_rigid_footprint.py @@ -8,12 +8,12 @@ from scipy.spatial.transform import Rotation from types import SimpleNamespace -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled -from anysolver import _stiffened_shell_ge_finite_experimental as finite -from anysolver._ge_beam3_variational_shell import deformation -from anysolver._stiffened_shell_rotation_charts import physical_frames -from anysolver._stiffened_shell_nodal_footprint import selected_wrenches +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver import _stiffened_shell_ge_finite_experimental as finite +from anyfesolver._ge_beam3_variational_shell import deformation +from anyfesolver._stiffened_shell_rotation_charts import physical_frames +from anyfesolver._stiffened_shell_nodal_footprint import selected_wrenches from test_stiffened_shell_ge_experimental import _panel from test_stiffened_shell_ge_finite_experimental import _q4_shell_j2_panel from test_stiffened_shell_ge_physical_fibre_finite import _yielding_definition @@ -378,7 +378,7 @@ def test_empty_footprints_preserve_legacy_identity_recovery_and_json_checkpoint( assert owner.preflight()["identity"] == identity q = np.r_[result.shell_displacement, result.beam_coordinates] load = owner._accepted[1] - from anysolver._stiffened_shell_ge_experimental import CHECKPOINT + from anyfesolver._stiffened_shell_ge_experimental import CHECKPOINT expected = json.dumps(dict(schema=CHECKPOINT, model=identity, generation=result.generation, q=q.tolist(), multipliers=result.multipliers.tolist(), load=load.tolist()), sort_keys=True,separators=(",", ":"),allow_nan=False).encode("ascii") @@ -445,9 +445,9 @@ def test_loaded_stable_s3_complete_assembly_actual_update_derivative(request, re @pytest.mark.parametrize("mixed", (True, "all-s3")) def test_stable_footprint_complete_generalized_history_and_atomic_corrupt_restore(request, mixed): - from anysolver._stiffened_shell_ge_checkpoint_binary import decode, encode, MAGIC - from anysolver._stiffened_shell_beam_history import shapes, histories - from anysolver._stiffened_shell_nodal_footprint import ( + from anyfesolver._stiffened_shell_ge_checkpoint_binary import decode, encode, MAGIC + from anyfesolver._stiffened_shell_beam_history import shapes, histories + from anyfesolver._stiffened_shell_nodal_footprint import ( stable_s3_policy_descriptor, retained_scale_policy_descriptor, chart_admission_policy_descriptor) @@ -530,7 +530,7 @@ def test_stable_policy_is_absent_for_q4_footprint_and_empty_generalized_s3(reque def test_unequal_section_scales_follow_retained_roles_and_work_conjugate_units(): - from anysolver import _stiffened_shell_ge_experimental as ge + from anyfesolver import _stiffened_shell_ge_experimental as ge xyz = np.array(((0., 0., 0.), (2., 0., 0.))) nodes = {i: (np.array((float(i-1), 0., .1)), np.eye(3)) for i in (1, 2, 3)} elastic = np.diag((2., 3., 5., 7., 11., 13.)) @@ -581,7 +581,7 @@ def test_unequal_section_scales_follow_retained_roles_and_work_conjugate_units() def test_q4_footprint_rejects_provisional_retained_scale_identity(request): - from anysolver._stiffened_shell_nodal_footprint import ( + from anyfesolver._stiffened_shell_nodal_footprint import ( retained_scale_policy_descriptor, chart_admission_policy_descriptor) definition = _definition(); panel = definition.shell owner = _owner(request, definition) @@ -612,9 +612,9 @@ def test_q4_footprint_rejects_provisional_retained_scale_identity(request): @pytest.mark.parametrize("mixed", (False, True, "all-s3")) def test_footprint_rebase_and_current_model_chart_restore_reject_atomically(request, mixed): - from anysolver._stiffened_shell_ge_checkpoint_binary import encode, encode_chart, decode_chart - from anysolver._stiffened_shell_beam_history import arrays as history_arrays - from anysolver._stiffened_shell_nodal_footprint import chart_admission_policy_descriptor + from anyfesolver._stiffened_shell_ge_checkpoint_binary import encode, encode_chart, decode_chart + from anyfesolver._stiffened_shell_beam_history import arrays as history_arrays + from anyfesolver._stiffened_shell_nodal_footprint import chart_admission_policy_descriptor definition = _definition(mixed); owner = _owner(request, definition) actions = (ss.NodalAction("beam", 105, (0., 0., 10., 0., 0., 0.)),) accepted = owner.solve(actions, (.25, .5), max_iterations=20, max_backtracks=12) diff --git a/tests/test_stiffened_shell_physical_fibre_j2_history.py b/tests/test_stiffened_shell_physical_fibre_j2_history.py index 06ac4b599..dec6ff36e 100644 --- a/tests/test_stiffened_shell_physical_fibre_j2_history.py +++ b/tests/test_stiffened_shell_physical_fibre_j2_history.py @@ -3,10 +3,10 @@ import math import numpy as np from scipy.spatial.transform import Rotation -from anysolver import b3_ge, stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled -from anysolver import _stiffened_shell_ge_finite_experimental as finite -from anysolver._stiffened_shell_beam_history import arrays as history_arrays +from anyfesolver import b3_ge, stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver import _stiffened_shell_ge_finite_experimental as finite +from anyfesolver._stiffened_shell_beam_history import arrays as history_arrays import pytest from examples.stiffened_shell_coupled_plastic_history import ( definition, programme, activity, OPTIONS, CONTROL, ENDPOINT_FORCES_N, diff --git a/tests/test_stiffened_shell_physical_q4_mass.py b/tests/test_stiffened_shell_physical_q4_mass.py index f7fa47aeb..a12239950 100644 --- a/tests/test_stiffened_shell_physical_q4_mass.py +++ b/tests/test_stiffened_shell_physical_q4_mass.py @@ -4,7 +4,7 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver._stiffened_shell_physical_q4_mass import physical_mass +from anyfesolver._stiffened_shell_physical_q4_mass import physical_mass VERTICES = np.array(((0., 0., 0.), (1.2, 0., 0.), diff --git a/tests/test_stiffened_shell_physical_s3_mass.py b/tests/test_stiffened_shell_physical_s3_mass.py index 630923238..4a35b052b 100644 --- a/tests/test_stiffened_shell_physical_s3_mass.py +++ b/tests/test_stiffened_shell_physical_s3_mass.py @@ -1,7 +1,7 @@ """Independent barycentric/thickness kinetic work for the declared S3 field.""" import numpy as np import pytest -from anysolver._stiffened_shell_physical_s3_mass import physical_mass +from anyfesolver._stiffened_shell_physical_s3_mass import physical_mass def test_barycentric_thickness_kinetic_work_and_exact_normal_spin(): diff --git a/tests/test_stiffened_shell_point_recovery.py b/tests/test_stiffened_shell_point_recovery.py index 977cf78b9..0140467a0 100644 --- a/tests/test_stiffened_shell_point_recovery.py +++ b/tests/test_stiffened_shell_point_recovery.py @@ -6,11 +6,11 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver import b3_ge, stiffened_shell -from anysolver._ge_beam3_pose_joint import RigidPoseJoint -from anysolver import _stiffened_shell_ge_experimental as ge_experimental -from anysolver._stiffened_shell_point_recovery import point_record -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver import b3_ge, stiffened_shell +from anyfesolver._ge_beam3_pose_joint import RigidPoseJoint +from anyfesolver import _stiffened_shell_ge_experimental as ge_experimental +from anyfesolver._stiffened_shell_point_recovery import point_record +from anyfesolver.control import CancellationToken, SolveCancelled from test_stiffened_shell_ge_experimental import _panel diff --git a/tests/test_stiffened_shell_q4_algorithmic_pullback.py b/tests/test_stiffened_shell_q4_algorithmic_pullback.py index 65e34c59b..e8b0b6617 100644 --- a/tests/test_stiffened_shell_q4_algorithmic_pullback.py +++ b/tests/test_stiffened_shell_q4_algorithmic_pullback.py @@ -4,11 +4,11 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver._stiffened_shell_q4_algorithmic_pullback import local_coordinates, response -from anysolver.e4_pl_s3_state import canonical_json_bytes -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEModel -from anysolver.material_curves import DNVC208MaterialCurve +from anyfesolver._stiffened_shell_q4_algorithmic_pullback import local_coordinates, response +from anyfesolver.e4_pl_s3_state import canonical_json_bytes +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.material_curves import DNVC208MaterialCurve @pytest.fixture(scope="module") diff --git a/tests/test_stiffened_shell_q4_correction_reuse.py b/tests/test_stiffened_shell_q4_correction_reuse.py index fe6d2b78b..f17078e3b 100644 --- a/tests/test_stiffened_shell_q4_correction_reuse.py +++ b/tests/test_stiffened_shell_q4_correction_reuse.py @@ -4,11 +4,11 @@ import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver -from anysolver._stiffened_shell_q4_algorithmic_pullback import response -from anysolver.e4_pl_s3_state import canonical_json_bytes -from anysolver.e4_pl_element import _lookup_prepared_q4_correction +from anyfesolver import stiffened_shell as ss +from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver +from anyfesolver._stiffened_shell_q4_algorithmic_pullback import response +from anyfesolver.e4_pl_s3_state import canonical_json_bytes +from anyfesolver.e4_pl_element import _lookup_prepared_q4_correction from scripts.experimental_stiffened_ge_multi_member_panel import make_definition, actions_for from test_corotational import _single_shell_model from test_stiffened_shell_q4_algorithmic_pullback import yielded diff --git a/tests/test_stiffened_shell_q4_pullback_owner.py b/tests/test_stiffened_shell_q4_pullback_owner.py index 6b8f6f9cc..bc2a73e3e 100644 --- a/tests/test_stiffened_shell_q4_pullback_owner.py +++ b/tests/test_stiffened_shell_q4_pullback_owner.py @@ -5,8 +5,8 @@ import numpy as np import pytest -from anysolver import stiffened_shell -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver import stiffened_shell +from anyfesolver.control import CancellationToken, SolveCancelled from test_stiffened_shell_ge_experimental import _panel from test_stiffened_shell_ge_finite_experimental import _actions, _q4_shell_j2_panel from test_stiffened_shell_ge_owned_rebase import _compare_physical @@ -21,7 +21,7 @@ def _definition(plastic=False, mixed=False): def test_selected_q4_reference_map_and_checkpoint_identity(monkeypatch): - from anysolver import _stiffened_shell_ge_experimental as implementation + from anyfesolver import _stiffened_shell_ge_experimental as implementation definition = _definition() evaluations = [] original = implementation.q4_algorithmic_response diff --git a/tests/test_stiffened_shell_q4_reference_reuse.py b/tests/test_stiffened_shell_q4_reference_reuse.py index 15f8e7de1..d8bf72140 100644 --- a/tests/test_stiffened_shell_q4_reference_reuse.py +++ b/tests/test_stiffened_shell_q4_reference_reuse.py @@ -6,14 +6,14 @@ import pytest from anymaterial import DNVC208MaterialCurve -from anysolver import stiffened_shell as ss -from anysolver import _stiffened_shell_ge_experimental as ge -from anysolver._stiffened_shell_q4_reference import elastic_reference_response -from anysolver.corotational import corotational_element_response -from anysolver.corotational_performance import ( +from anyfesolver import stiffened_shell as ss +from anyfesolver import _stiffened_shell_ge_experimental as ge +from anyfesolver._stiffened_shell_q4_reference import elastic_reference_response +from anyfesolver.corotational import corotational_element_response +from anyfesolver.corotational_performance import ( corotational_performance_status, reset_corotational_performance_status, ) -from anysolver.fe_core import FEMesh +from anyfesolver.fe_core import FEMesh from test_stiffened_shell_ge_experimental import _panel @@ -249,7 +249,7 @@ def _check_owner_history(monkeypatch, cleanup): def test_other_shell_routes_do_not_use_reference_reuse(monkeypatch, policy): definition = _panel() if policy == "algorithmic": - from anysolver._stiffened_shell_q4_algorithmic_pullback import POLICY + from anyfesolver._stiffened_shell_q4_algorithmic_pullback import POLICY definition = replace(definition, q4_pullback_policy=POLICY) else: definition = replace(definition, shell=replace(definition.shell, diff --git a/tests/test_stiffened_shell_q4_rotation_arithmetic.py b/tests/test_stiffened_shell_q4_rotation_arithmetic.py index 54b70c1ab..3d8692f59 100644 --- a/tests/test_stiffened_shell_q4_rotation_arithmetic.py +++ b/tests/test_stiffened_shell_q4_rotation_arithmetic.py @@ -11,10 +11,10 @@ from scipy.sparse.linalg import spsolve from scipy.spatial.transform import Rotation -from anysolver import corotational as cr, stiffened_shell as ss -from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver -from anysolver._stiffened_shell_ge_checkpoint_binary import encode -from anysolver._stiffened_shell_q4_algorithmic_pullback import POLICY +from anyfesolver import corotational as cr, stiffened_shell as ss +from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver +from anyfesolver._stiffened_shell_ge_checkpoint_binary import encode +from anyfesolver._stiffened_shell_q4_algorithmic_pullback import POLICY from scripts.experimental_stiffened_ge_multi_member_panel import make_definition, actions_for from test_corotational import _single_shell_model, _rigid_rotation_field from test_stiffened_shell_ge_experimental import _panel @@ -156,7 +156,7 @@ def test_other_pullbacks_keep_their_arithmetic(kind): @pytest.mark.parametrize("material_kind", (False, True)) def test_stable_chart_snapshot_and_cancelled_successor_preserve_prefix(material_kind): - from anysolver.control import CancellationToken, SolveCancelled + from anyfesolver.control import CancellationToken, SolveCancelled with ExitStack() as cleanup: owner = ss.create_analysis(definition=_panel()) cleanup.callback(owner.close) diff --git a/tests/test_stiffened_shell_s3_algorithmic_pullback.py b/tests/test_stiffened_shell_s3_algorithmic_pullback.py index 6d6da72e5..5944231c8 100644 --- a/tests/test_stiffened_shell_s3_algorithmic_pullback.py +++ b/tests/test_stiffened_shell_s3_algorithmic_pullback.py @@ -4,13 +4,13 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_variational_shell import deformation, response as elastic_response -from anysolver._stiffened_shell_s3_algorithmic_pullback import ( +from anyfesolver._ge_beam3_variational_shell import deformation, response as elastic_response +from anyfesolver._stiffened_shell_s3_algorithmic_pullback import ( local_coordinates, response, ) -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEModel -from anysolver.material_curves import DNVC208MaterialCurve +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.material_curves import DNVC208MaterialCurve def _fixture(): diff --git a/tests/test_stiffened_shell_s3_dead_work_candidate.py b/tests/test_stiffened_shell_s3_dead_work_candidate.py index c7dd86aa4..b0ca2b406 100644 --- a/tests/test_stiffened_shell_s3_dead_work_candidate.py +++ b/tests/test_stiffened_shell_s3_dead_work_candidate.py @@ -3,9 +3,9 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_pose_joint import _exp_terms -from anysolver._stiffened_shell_ge_experimental import ShellPanel, _shell_reference -from anysolver._stiffened_shell_s3_dead_work_candidate import evaluate +from anyfesolver._ge_beam3_pose_joint import _exp_terms +from anyfesolver._stiffened_shell_ge_experimental import ShellPanel, _shell_reference +from anyfesolver._stiffened_shell_s3_dead_work_candidate import evaluate def fixture(pressure=2.5): diff --git a/tests/test_stiffened_shell_s3_displacement_arc_policy_binding.py b/tests/test_stiffened_shell_s3_displacement_arc_policy_binding.py index 888d8e8b9..eb9a76116 100644 --- a/tests/test_stiffened_shell_s3_displacement_arc_policy_binding.py +++ b/tests/test_stiffened_shell_s3_displacement_arc_policy_binding.py @@ -15,16 +15,16 @@ import numpy as np import pytest -from anysolver import stiffened_shell as public -from anysolver import _stiffened_shell_ge_finite_experimental as finite_module -from anysolver._stiffened_shell_displacement_checkpoint import ( +from anyfesolver import stiffened_shell as public +from anyfesolver import _stiffened_shell_ge_finite_experimental as finite_module +from anyfesolver._stiffened_shell_displacement_checkpoint import ( ELASTIC_S3_CHART_POLICY, ELASTIC_S3_POLICY, STABLE_ELASTIC_S3_CHART_POLICY, STABLE_ELASTIC_S3_POLICY, admitted_s3_policies, decode_snapshot as decode_displacement, encode_snapshot as encode_displacement, generalized_stable_live, identities as displacement_identities, replay_s3_stable, ) -from anysolver._stiffened_shell_arc_checkpoint import ( +from anyfesolver._stiffened_shell_arc_checkpoint import ( _replay_s3_stable, _s3_arc_policies, decode_snapshot as decode_arc, ) from test_stiffened_shell_ge_experimental import _panel @@ -275,7 +275,7 @@ def test_replay_binding_guards_and_identity_classification(): foreign = public.create_analysis(definition=_q4_generalized_definition()) assert replay_s3_stable(foreign, STABLE_ELASTIC_S3_POLICY) is None assert _replay_s3_stable(foreign, STABLE_ARC_V2) is None - from anysolver._stiffened_shell_affine_endpoint import validate_arrays + from anyfesolver._stiffened_shell_affine_endpoint import validate_arrays with pytest.raises(ValueError, match='numerical policy mismatch'): validate_arrays(foreign, arrays, s3_stable=True) with pytest.raises(ValueError, match='numerical policy mismatch'): diff --git a/tests/test_stiffened_shell_s3_generalized_stable_policy.py b/tests/test_stiffened_shell_s3_generalized_stable_policy.py index 39083b974..1c5aae7f2 100644 --- a/tests/test_stiffened_shell_s3_generalized_stable_policy.py +++ b/tests/test_stiffened_shell_s3_generalized_stable_policy.py @@ -12,17 +12,17 @@ import numpy as np import pytest -from anysolver import stiffened_shell as public -from anysolver import _stiffened_shell_ge_point_buckling as buckling -from anysolver import _stiffened_shell_ge_finite_experimental as finite_module -from anysolver._stiffened_shell_ge_finite_experimental import ( +from anyfesolver import stiffened_shell as public +from anyfesolver import _stiffened_shell_ge_point_buckling as buckling +from anyfesolver import _stiffened_shell_ge_finite_experimental as finite_module +from anyfesolver._stiffened_shell_ge_finite_experimental import ( FinitePointDriver, supports_generalized_stable_s3, ) -from anysolver._stiffened_shell_ge_checkpoint_binary import ( +from anyfesolver._stiffened_shell_ge_checkpoint_binary import ( SCHEMAS, STABLE_NATIVE_SCHEMA, decode, encode, ) -from anysolver._stiffened_shell_beam_history import shapes -from anysolver._ge_beam3_variational_shell import deformation, response +from anyfesolver._stiffened_shell_beam_history import shapes +from anyfesolver._ge_beam3_variational_shell import deformation, response from test_stiffened_shell_ge_experimental import _panel from test_stiffened_shell_ge_physical_fibre_linear import _definition from test_stiffened_shell_ge_mixed_buckling import ( @@ -112,7 +112,7 @@ def test_displacement_seed_policy_admits_both_arithmetics_exactly(accepted_owner """The exact generalized stable domain admits legacy False and new True seeds; a restored legacy False seed is never upgraded, and nonboolean flags are refused.""" - from anysolver._stiffened_shell_affine_endpoint import ( + from anyfesolver._stiffened_shell_affine_endpoint import ( require_native_displacement_policy) owner = accepted_owner driver = owner._finite_driver @@ -133,7 +133,7 @@ def test_displacement_seed_policy_admits_both_arithmetics_exactly(accepted_owner def test_displacement_seed_policy_keeps_existing_guards_for_other_owners(): - from anysolver._stiffened_shell_affine_endpoint import ( + from anyfesolver._stiffened_shell_affine_endpoint import ( require_native_displacement_policy) # (definition, admitted constructor seed, refused forged seed) cases = ((_definition(mixed=False, triangles=True), True, False), diff --git a/tests/test_stiffened_shell_s3_stable_elastic.py b/tests/test_stiffened_shell_s3_stable_elastic.py index 4585bc035..b70680867 100644 --- a/tests/test_stiffened_shell_s3_stable_elastic.py +++ b/tests/test_stiffened_shell_s3_stable_elastic.py @@ -3,9 +3,9 @@ import pytest from scipy.spatial.transform import Rotation -from anysolver._ge_beam3_variational_shell import deformation, response -from anysolver._ge_beam3_fibre_section import canonical -from anysolver._stiffened_shell_ge_experimental import ExperimentalGEAnalysis +from anyfesolver._ge_beam3_variational_shell import deformation, response +from anyfesolver._ge_beam3_fibre_section import canonical +from anyfesolver._stiffened_shell_ge_experimental import ExperimentalGEAnalysis from test_stiffened_shell_ge_physical_fibre_linear import _definition diff --git a/tests/test_stiffened_shell_same_parent_trial.py b/tests/test_stiffened_shell_same_parent_trial.py index ec31cd426..e63346c26 100644 --- a/tests/test_stiffened_shell_same_parent_trial.py +++ b/tests/test_stiffened_shell_same_parent_trial.py @@ -3,10 +3,10 @@ import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver -from anysolver._stiffened_shell_same_parent_trial import FixedTrialHandoff -from anysolver.control import SolveCancelled +from anyfesolver import stiffened_shell as ss +from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver +from anyfesolver._stiffened_shell_same_parent_trial import FixedTrialHandoff +from anyfesolver.control import SolveCancelled from scripts.experimental_stiffened_ge_multi_member_panel import make_definition, actions_for @@ -165,7 +165,7 @@ def raise_if_cancelled(self, stage): @pytest.mark.parametrize('target', ('module', 'code')) def test_changed_dispatch_invalidates_completed_payload(assembled, monkeypatch, target): _owner, driver, trial, pattern, _result, handoff = assembled - from anysolver import _stiffened_shell_ge_finite_experimental as module + from anyfesolver import _stiffened_shell_ge_finite_experimental as module if target == 'module': monkeypatch.setattr(module, 'q4_algorithmic_response', lambda *a, **kw: None) else: @@ -205,13 +205,13 @@ def test_arithmetic_observers_remain_on_full_evaluation_path(assembled, mode): def test_nested_admitted_dispatch_invalidates_payload(assembled, monkeypatch, target): _owner, driver, trial, pattern, _result, handoff = assembled if target == 'compensated': - from anysolver._ge_beam3_p5 import compensated + from anyfesolver._ge_beam3_p5 import compensated monkeypatch.setattr(compensated, 'sum_jets', lambda *a: None) elif target == 'spatial': - from anysolver import _ge_beam3_generalized_static_boundary as module + from anyfesolver import _ge_beam3_generalized_static_boundary as module monkeypatch.setattr(module, '_array', lambda *a: None) else: - from anysolver._ge_beam3_mixed_ad import Jet2 + from anyfesolver._ge_beam3_mixed_ad import Jet2 monkeypatch.setattr(Jet2, '__mul__', lambda *a: None) assert handoff.take(driver, trial, .01, pattern) is None diff --git a/tests/test_stiffened_shell_selected_recovery.py b/tests/test_stiffened_shell_selected_recovery.py index 527f86e8e..6f53c3a97 100644 --- a/tests/test_stiffened_shell_selected_recovery.py +++ b/tests/test_stiffened_shell_selected_recovery.py @@ -1,7 +1,7 @@ """Selected finite recovery must be detached, ordered and replay-free.""" import numpy as np import pytest -from anysolver import stiffened_shell as ss +from anyfesolver import stiffened_shell as ss from test_stiffened_shell_bl5_coupled_material import coupled from test_stiffened_shell_bl5_material import make from test_stiffened_shell_bl5_finite import _action @@ -56,7 +56,7 @@ def test_cached_ordered_recovery_after_displacement_restart(request, monkeypatch resumed = make(request, coupled()); resumed.restore(snapshot) def forbidden(*args, **kwargs): raise AssertionError("selected recovery must not evaluate mechanics") - from anysolver._ge_beam3_generalized_cell import GeneralizedCellConjugate + from anyfesolver._ge_beam3_generalized_cell import GeneralizedCellConjugate monkeypatch.setattr(GeneralizedCellConjugate,"response",forbidden) for current in (owner, resumed): monkeypatch.setattr(current._finite_driver, "_assemble", forbidden) diff --git a/tests/test_stiffened_shell_staged_load_definition_experimental.py b/tests/test_stiffened_shell_staged_load_definition_experimental.py index 342f863c7..fbbbf61cb 100644 --- a/tests/test_stiffened_shell_staged_load_definition_experimental.py +++ b/tests/test_stiffened_shell_staged_load_definition_experimental.py @@ -7,8 +7,8 @@ import numpy as np import pytest -from anysolver._stiffened_shell_ge_experimental import NodalAction -from anysolver import _stiffened_shell_staged_load_experimental as staged +from anyfesolver._stiffened_shell_ge_experimental import NodalAction +from anyfesolver import _stiffened_shell_staged_load_experimental as staged MODEL = "ab" * 32 diff --git a/tests/test_stiffened_shell_staged_load_owner_experimental.py b/tests/test_stiffened_shell_staged_load_owner_experimental.py index b9aac10dd..9aca1c9fc 100644 --- a/tests/test_stiffened_shell_staged_load_owner_experimental.py +++ b/tests/test_stiffened_shell_staged_load_owner_experimental.py @@ -4,10 +4,10 @@ import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled -from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver -from anysolver._stiffened_shell_staged_load_experimental import ( +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver +from anyfesolver._stiffened_shell_staged_load_experimental import ( decode_checkpoint, encode_checkpoint, ) from test_stiffened_shell_ge_experimental import _panel @@ -34,7 +34,7 @@ def _numeric_checkpoint(owner, raw): Stable Q4 snapshots are binary; the historical JSON path remains supported. Do not infer layout from untrusted snapshot metadata for corruption tests. """ - from anysolver import _stiffened_shell_ge_checkpoint_binary as binary + from anyfesolver import _stiffened_shell_ge_checkpoint_binary as binary if not raw.startswith(binary.MAGIC): return json.loads(raw), lambda value:json.dumps(value,sort_keys=True, separators=(',',':')).encode('ascii') diff --git a/tests/test_stiffened_shell_staged_material_history.py b/tests/test_stiffened_shell_staged_material_history.py index 4b95825c8..2260d0edb 100644 --- a/tests/test_stiffened_shell_staged_material_history.py +++ b/tests/test_stiffened_shell_staged_material_history.py @@ -6,10 +6,10 @@ import numpy as np import pytest from scipy.spatial.transform import Rotation -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled -from anysolver import _stiffened_shell_ge_finite_experimental as finite -from anysolver._stiffened_shell_beam_history import arrays as history_arrays +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled +from anyfesolver import _stiffened_shell_ge_finite_experimental as finite +from anyfesolver._stiffened_shell_beam_history import arrays as history_arrays from test_stiffened_shell_native_coupled_material import definition_for from test_stiffened_shell_ge_finite_experimental import _q4_shell_j2_panel diff --git a/tests/test_stiffened_shell_staged_zero_reference.py b/tests/test_stiffened_shell_staged_zero_reference.py index ca6421eff..2d4d147c7 100644 --- a/tests/test_stiffened_shell_staged_zero_reference.py +++ b/tests/test_stiffened_shell_staged_zero_reference.py @@ -8,11 +8,11 @@ import numpy as np import pytest -from anysolver import stiffened_shell as ss -from anysolver import _stiffened_shell_staged_load_experimental as staged -from anysolver._stiffened_shell_ge_experimental import _linear_equilibrium, PROFILE -from anysolver._stiffened_shell_beam_history import arrays as native_history_arrays -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver import stiffened_shell as ss +from anyfesolver import _stiffened_shell_staged_load_experimental as staged +from anyfesolver._stiffened_shell_ge_experimental import _linear_equilibrium, PROFILE +from anyfesolver._stiffened_shell_beam_history import arrays as native_history_arrays +from anyfesolver.control import CancellationToken, SolveCancelled from test_stiffened_shell_staged_load_definition_experimental import ( MODEL, _load, _owner as compiler_owner, _programme, _unframe, _frame, _canonical) from test_stiffened_shell_ge_physical_fibre_finite import _yielding_definition @@ -114,7 +114,7 @@ def test_zero_reference_equivalent_work_units_preserve_small_component_checks(): def test_first_zero_stage_uses_prepared_reference_without_precommit_mutation(request,monkeypatch): from test_stiffened_shell_staged_load_owner_experimental import _owner,_actions - from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver + from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver owner = _owner(request) programme = ss.StagedDeadLoadProgramme(owner._identity,((),_actions()), zero_load_reference_endpoint=2) @@ -181,7 +181,7 @@ def observe(result): failed.solve(programme,(1.5,2.),cancellation_token=token,**options) assert failed.checkpoint() == loaded_checkpoint with monkeypatch.context() as patch: - from anysolver import _stiffened_shell_ge_finite_experimental as finite + from anyfesolver import _stiffened_shell_ge_finite_experimental as finite patch.setattr(finite.spla,'spsolve',lambda matrix,rhs:np.zeros_like(rhs)) with pytest.raises(RuntimeError): failed.solve(programme,(2.,),max_iterations=1,max_backtracks=0) @@ -212,7 +212,7 @@ def observe(result): assert descriptor == programme and position == 2. other_reference = replace(programme,zero_load_reference_endpoint=3) other = make() - from anysolver._stiffened_shell_ge_finite_experimental import FinitePointDriver + from anyfesolver._stiffened_shell_ge_finite_experimental import FinitePointDriver forged = staged.encode_checkpoint(other_reference.compile(other,FinitePointDriver(other)._load),2.,inner) with pytest.raises(ValueError): other.restore(forged) diff --git a/tests/test_stiffened_shell_stress_free_reference.py b/tests/test_stiffened_shell_stress_free_reference.py index 6d9c57252..999a963f4 100644 --- a/tests/test_stiffened_shell_stress_free_reference.py +++ b/tests/test_stiffened_shell_stress_free_reference.py @@ -4,8 +4,8 @@ import numpy as np import pytest from scipy.spatial.transform import Rotation -from anysolver import stiffened_shell as ss -from anysolver.control import CancellationToken, SolveCancelled +from anyfesolver import stiffened_shell as ss +from anyfesolver.control import CancellationToken, SolveCancelled from test_stiffened_shell_curved_reference_seam import curved_panel @@ -67,7 +67,7 @@ def test_zero_change_and_owned_pose_data(): def test_zero_change_material_reference_retains_material_policy(): - from anysolver._stiffened_shell_stress_free_reference import MATERIAL_POLICY + from anyfesolver._stiffened_shell_stress_free_reference import MATERIAL_POLICY from test_stiffened_shell_curved_material import curved_material_panel source = curved_material_panel() @@ -121,7 +121,7 @@ def test_cancel_after_target_compile_closes_both_owners(monkeypatch): def tracked(**kwargs): value=actual(**kwargs);created.append(value);return value monkeypatch.setattr(ss,'create_analysis',tracked) - from anysolver import _stiffened_shell_stress_free_reference as reference + from anyfesolver import _stiffened_shell_stress_free_reference as reference safe=reference.cancellation_safe_point token=CancellationToken() def cancelling(value,where): @@ -141,7 +141,7 @@ def cancelling(value,where): def test_native_policy_and_reference_tolerances_are_preserved(): - from anysolver._ge_beam3_precise_geometric_work import POLICY + from anyfesolver._ge_beam3_precise_geometric_work import POLICY source=curved_panel();beams=[] for raw in source.beams: element,inertia=raw.instantiate();ref=element.operator.reference diff --git a/tests/test_stiffened_shell_yield_limits.py b/tests/test_stiffened_shell_yield_limits.py index 06154e184..06ed24f01 100644 --- a/tests/test_stiffened_shell_yield_limits.py +++ b/tests/test_stiffened_shell_yield_limits.py @@ -27,13 +27,13 @@ import numpy as np import pytest -from anysolver import _stiffened_shell_q4_algorithmic_pullback as q4 -from anysolver import _stiffened_shell_s3_algorithmic_pullback as s3 -from anysolver.e4_pl_s3_state import canonical_json_bytes -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEModel -from anysolver.material_curves import DNVC208MaterialCurve -from anysolver.plasticity import plane_stress_return_map +from anyfesolver import _stiffened_shell_q4_algorithmic_pullback as q4 +from anyfesolver import _stiffened_shell_s3_algorithmic_pullback as s3 +from anyfesolver.e4_pl_s3_state import canonical_json_bytes +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.material_curves import DNVC208MaterialCurve +from anyfesolver.plasticity import plane_stress_return_map @dataclass(frozen=True) diff --git a/tests/test_storage_prediction_source.py b/tests/test_storage_prediction_source.py index f5a260a2f..f3637b3e6 100644 --- a/tests/test_storage_prediction_source.py +++ b/tests/test_storage_prediction_source.py @@ -3,9 +3,9 @@ from copy import deepcopy import numpy as np import pytest -from anysolver import (PatternCase,LoadCase,RecoveryConfig,ResourceConfig,prepare_static_response_evaluator, +from anyfesolver import (PatternCase,LoadCase,RecoveryConfig,ResourceConfig,prepare_static_response_evaluator, export_recovery_capsule,export_recovery_capsule_to_sink) -from anysolver_results import validate_storage_prediction,CapsuleValidationError,validate_capsule +from anyfesolver_results import validate_storage_prediction,CapsuleValidationError,validate_capsule from test_native_affinity_fallback import original_fixture,prepare def test_dense_twenty_pattern_source_actual_rows_and_metadata(tmp_path): @@ -53,7 +53,7 @@ def test_storage_allocation_refused_before_numeric_plan_or_publication(tmp_path) if find_spec("anypost") is None: pytest.importorskip("anypost") from anypost import ArchiveSink - from anysolver.recovery import ResourcePolicyError + from anyfesolver.recovery import ResourcePolicyError with prepare(True,numerical_affinity_fallback=True) as evaluator: evaluator._resource_config=ResourceConfig(memory_limit_bytes=1) path=tmp_path/'previous.h5';path.write_bytes(b'previous') @@ -64,8 +64,8 @@ def test_storage_allocation_refused_before_numeric_plan_or_publication(tmp_path) assert sink.diagnostics['state']=='aborted' def test_storage_validator_entrypoint_mutation_from_real_callback_refuses(tmp_path,monkeypatch): - import anysolver_results as runtime - from anysolver.prepared_static_loads import PreparedStaticError + import anyfesolver_results as runtime + from anyfesolver.prepared_static_loads import PreparedStaticError if find_spec("anypost") is None: pytest.importorskip("anypost") from anypost import ArchiveSink @@ -85,7 +85,7 @@ def capsule_begin(self,header): assert path.read_bytes()==b'previous' and native.diagnostics['state']=='aborted' def test_cancel_after_new_codec_stored_callback_retains_previous_target(tmp_path): - from anysolver import CancellationToken,SolveCancelled + from anyfesolver import CancellationToken,SolveCancelled if find_spec("anypost") is None: pytest.importorskip("anypost") from anypost import ArchiveSink @@ -129,7 +129,7 @@ def test_all_failed_public_input_aborts_without_success_archive(tmp_path): if find_spec("anypost") is None: pytest.importorskip("anypost") from anypost import ArchiveSink - from anysolver import PreparedStaticError + from anyfesolver import PreparedStaticError with prepare(True,numerical_affinity_fallback=True) as evaluator: path=tmp_path/'previous.h5';path.write_bytes(b'previous') with pytest.raises(PreparedStaticError),ArchiveSink(path) as sink: @@ -139,7 +139,7 @@ def test_all_failed_public_input_aborts_without_success_archive(tmp_path): assert json.loads(open(sink.diagnostic_path).read())['input_case_ids']==['failed'] def test_failed_dto_unused_role_has_no_fabricated_stored_fields(): - from anysolver.result_capsule import _CapsuleExport + from anyfesolver.result_capsule import _CapsuleExport with prepare(True,numerical_affinity_fallback=True) as evaluator: exporter=_CapsuleExport(evaluator,[PatternCase('failed',{})],model_identity='m',mesh_identity='s') record,_=exporter._process_case(0,{'status':'failed','error':'source refusal','solver_info':{'status':'failed'}}) diff --git a/tests/test_submodel_transfer.py b/tests/test_submodel_transfer.py index d12ab31b7..8ea1cfba7 100644 --- a/tests/test_submodel_transfer.py +++ b/tests/test_submodel_transfer.py @@ -1,5 +1,5 @@ """Submodel transfer (docs/SUBMODEL_TRANSFER_CONTRACT.md): interpolation, driven trace, -interface forces and error allowance on small ANYsolver-only shell models. +interface forces and error allowance on small ANYfeSolver-only shell models. Oracles are closed-form affine and rigid fields and hand-derived multiplier relations; no result is compared with another run of the same code. @@ -10,13 +10,13 @@ import numpy as np import pytest -from anysolver import BoundaryCondition, LoadCase, solve_linear -from anysolver.analysis_session import AnalysisSession -from anysolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement -from anysolver.elements import ShellElement, create_shell_element -from anysolver.fe_core import FEModel -from anysolver.mesh_gen import InterpolatedBeamShellMPCElement -from anysolver.submodel_transfer import ( +from anyfesolver import BoundaryCondition, LoadCase, solve_linear +from anyfesolver.analysis_session import AnalysisSession +from anyfesolver.e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement +from anyfesolver.elements import ShellElement, create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.mesh_gen import InterpolatedBeamShellMPCElement +from anyfesolver.submodel_transfer import ( DOF_NAMES, SubmodelTransferError, TransferPoint, @@ -180,7 +180,7 @@ def test_contract_mpc_example_trace_and_multipliers(): assert node_values(model, u, m2)[0] == pytest.approx(2 * values[s][0] - values[m1][0], abs=1e-18) forces = interface_forces(model, u, case, trace) - from anysolver.matrix_assembly import assemble_load_vector + from anyfesolver.matrix_assembly import assemble_load_vector with AnalysisSession(model) as session: k = session.stiffness_plan().matrix f = np.asarray(assemble_load_vector(model, case)[0]) @@ -512,7 +512,7 @@ def test_support_coupled_through_mpc_gets_the_right_reaction(): model, {node: g_field(coords(model, node)) for node in cut}, policy="drive_all")) u, _ = solve_linear(model, case) forces = interface_forces(model, u, case, trace) - from anysolver.matrix_assembly import assemble_load_vector + from anyfesolver.matrix_assembly import assemble_load_vector with AnalysisSession(model) as session: k = session.stiffness_plan().matrix r = k @ u - np.asarray(assemble_load_vector(model, case)[0]) @@ -740,7 +740,7 @@ def test_junction_threshold_order_is_enforced(): # ---------------------------------------------------------------------- # review round 4 additions # ---------------------------------------------------------------------- -import anysolver.submodel_transfer as transfer_module +import anyfesolver.submodel_transfer as transfer_module def free_body(model, grid, n, forces, case): diff --git a/tests/test_supported_rigid_mode_memory.py b/tests/test_supported_rigid_mode_memory.py index 3b2f1c76f..3aeae55d9 100644 --- a/tests/test_supported_rigid_mode_memory.py +++ b/tests/test_supported_rigid_mode_memory.py @@ -6,10 +6,10 @@ import numpy as np import pytest from scipy import sparse -from anysolver import BoundaryCondition,FixedSupport -from anysolver.fe_core import FEModel -from anysolver.elements import BeamElement -import anysolver.assembly as assembly +from anyfesolver import BoundaryCondition,FixedSupport +from anyfesolver.fe_core import FEModel +from anyfesolver.elements import BeamElement +import anyfesolver.assembly as assembly def model(count, supported): result=FEModel('supported-mode-storage') @@ -30,13 +30,13 @@ def model(count, supported): def legacy(): path=os.environ.get('RIGID_LEGACY_WHEEL') if not path:pytest.skip('Independent archived-wheel comparator needs RIGID_LEGACY_WHEEL') - with zipfile.ZipFile(path) as archive:source=archive.read('anysolver/assembly.py').decode() + with zipfile.ZipFile(path) as archive:source=archive.read('anyfesolver/assembly.py').decode() tree=ast.parse(source) names={'_rigid_body_modes_full','_orthonormalize_columns','build_reduced_rigid_body_modes'} selected=[node for node in tree.body if isinstance(node,(ast.FunctionDef,ast.ImportFrom)) and (getattr(node,'name','') in names or isinstance(node,ast.ImportFrom) and node.module=='__future__')] assert len([node for node in selected if isinstance(node,ast.FunctionDef)])==3 namespace=dict(vars(assembly)) - exec(compile(ast.Module(body=selected,type_ignores=[]),str(Path(path)/'anysolver/assembly.py'),'exec'),namespace) + exec(compile(ast.Module(body=selected,type_ignores=[]),str(Path(path)/'anyfesolver/assembly.py'),'exec'),namespace) return namespace @pytest.mark.parametrize('supported',[(),(0,),(1,),(0,1)]) diff --git a/tests/test_threading_policy.py b/tests/test_threading_policy.py index be4eb7a9a..66e0cbd4d 100644 --- a/tests/test_threading_policy.py +++ b/tests/test_threading_policy.py @@ -6,15 +6,15 @@ import pytest from scipy import sparse -import anysolver.threading_policy as policy_module -import anysolver.linalg as linalg_module -from anysolver.jit_compiler import JIT_ENABLED, numba_thread_scope -from anysolver.linalg import MatrixClass, factorize -from anysolver.assembly import solve_linear -from anysolver.boundary import LoadCase -from anysolver.mesh_gen import generate_beam_mesh -from anysolver.recovery import ResourceConfig -from anysolver.threading_policy import native_thread_scope +import anyfesolver.threading_policy as policy_module +import anyfesolver.linalg as linalg_module +from anyfesolver.jit_compiler import JIT_ENABLED, numba_thread_scope +from anyfesolver.linalg import MatrixClass, factorize +from anyfesolver.assembly import solve_linear +from anyfesolver.boundary import LoadCase +from anyfesolver.mesh_gen import generate_beam_mesh +from anyfesolver.recovery import ResourceConfig +from anyfesolver.threading_policy import native_thread_scope def pool_counts(pools): diff --git a/tests/test_transient_reduced_output.py b/tests/test_transient_reduced_output.py index 29ee9c353..b26318e85 100644 --- a/tests/test_transient_reduced_output.py +++ b/tests/test_transient_reduced_output.py @@ -2,11 +2,11 @@ import numpy as np -from anysolver import AnalysisSession, BoundaryCondition, FixedSupport, LoadCase -from anysolver.dynamics import TransientConfig, solve_transient_newmark -from anysolver.elements import BeamElement -from anysolver.fe_core import FEModel -from anysolver.recovery import RecoveryConfig +from anyfesolver import AnalysisSession, BoundaryCondition, FixedSupport, LoadCase +from anyfesolver.dynamics import TransientConfig, solve_transient_newmark +from anyfesolver.elements import BeamElement +from anyfesolver.fe_core import FEModel +from anyfesolver.recovery import RecoveryConfig def _model_and_load() -> tuple[FEModel, LoadCase]: diff --git a/tests/test_vectorized_hill48.py b/tests/test_vectorized_hill48.py index 791c25f3a..9cf3c2b95 100644 --- a/tests/test_vectorized_hill48.py +++ b/tests/test_vectorized_hill48.py @@ -8,28 +8,28 @@ import numpy as np import pytest -from anysolver.material_curves import ( +from anyfesolver.material_curves import ( DNVC208MaterialCurve, LinearHardeningCurve, PiecewiseLinearCurve, PowerLawHardeningCurve, ) -from anysolver.materials import Hill48Yield -from anysolver.arc_length import ArcLengthControl, solve_static_arc_length -from anysolver.boundary import BoundaryCondition, LoadCase -from anysolver.elements import create_element -from anysolver.fe_core import FEModel -from anysolver.nonlinear_state import ShellStateBatch, ShellStateLayout -from anysolver.nonlinear_static import solve_static_nonlinear -from anysolver.plasticity import ( +from anyfesolver.materials import Hill48Yield +from anyfesolver.arc_length import ArcLengthControl, solve_static_arc_length +from anyfesolver.boundary import BoundaryCondition, LoadCase +from anyfesolver.elements import create_element +from anyfesolver.fe_core import FEModel +from anyfesolver.nonlinear_state import ShellStateBatch, ShellStateLayout +from anyfesolver.nonlinear_static import solve_static_nonlinear +from anyfesolver.plasticity import ( PlaneStressConvergenceError, _hill48_plane_stress_metric, _hill48_reference_flow, _hill48_return_map_core, hill48_plane_stress_return_map, ) -from anysolver import vectorized_hill48 -from anysolver.vectorized_hill48 import ( +from anyfesolver import vectorized_hill48 +from anyfesolver.vectorized_hill48 import ( hill48_vectorized_diagnostics, pack_hill48_curve, reset_hill48_vectorized_diagnostics, diff --git a/tests/test_wave_surface_regions.py b/tests/test_wave_surface_regions.py index 9fa77094b..6db696814 100644 --- a/tests/test_wave_surface_regions.py +++ b/tests/test_wave_surface_regions.py @@ -1,10 +1,10 @@ import numpy as np import pytest -from anysolver.boundary import LoadCase -from anysolver.elements import create_shell_element -from anysolver.fe_core import FEModel -from anysolver.pressure_regions import PressureRegionError, add_region_load, region_wrench, wet_region_load +from anyfesolver.boundary import LoadCase +from anyfesolver.elements import create_shell_element +from anyfesolver.fe_core import FEModel +from anyfesolver.pressure_regions import PressureRegionError, add_region_load, region_wrench, wet_region_load RHO_G = 1000. @@ -98,7 +98,7 @@ def test_refinement_total_force_is_conservative_for_linear_field(): @pytest.mark.parametrize('points,corners', [(triangle_vertical(6), 3), (rectangle(8), 4)]) def test_full_element_kernel_equals_fully_wet_region_load_and_full_area(points, corners): - from anysolver.pressure_regions import element_kernel + from anyfesolver.pressure_regions import element_kernel mesh, element = build(points) pressure = np.array([3., 5., 7., 11.][:corners]) kernel, area, corner_areas = element_kernel(element, mesh) @@ -110,9 +110,9 @@ def test_full_element_kernel_equals_fully_wet_region_load_and_full_area(points, def test_qualified_formulations_match_their_native_dead_pressure_or_are_refused(): - from anysolver.e4_pl_element import QualifiedE4PLShellElement - from anysolver.e4_pl_element import QualifiedE4PLShellElement - from anysolver.pressure_regions import element_kernel + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.e4_pl_element import QualifiedE4PLShellElement + from anyfesolver.pressure_regions import element_kernel model = FEModel('qualified') model.add_material('m', 210e9, .3) points = [(0., 0., 0.), (2., 0., 0.), (2., 1., 0.), (0., 1., 0.)] @@ -126,7 +126,7 @@ def test_qualified_formulations_match_their_native_dead_pressure_or_are_refused( def v2d(points, normal): - from anysolver import create_shell_element + from anyfesolver import create_shell_element model = FEModel('v2d') model.add_material('m', 210e9, .3) for index, point in enumerate(points, 1): @@ -138,7 +138,7 @@ def v2d(points, normal): def test_current_default_v2d_uniform_region_reproduces_all_native_components_including_moments(): - from anysolver.pressure_regions import element_kernel + from anyfesolver.pressure_regions import element_kernel tilted = [(0., 0., 0.), (2., .3, .1), (.4, 1.5, -.2)] facet = np.cross(np.subtract(tilted[1], tilted[0]), np.subtract(tilted[2], tilted[0])) mesh, element = v2d(tilted, tuple(facet / np.linalg.norm(facet))) # reference normal = the actual facet normal diff --git a/tools/marine_w6/runner.py b/tools/marine_w6/runner.py index c3cd50cd6..fab8991cb 100644 --- a/tools/marine_w6/runner.py +++ b/tools/marine_w6/runner.py @@ -92,7 +92,7 @@ def run_case(self, case_id, function): # Product failures may carry their immutable accepted prefix. partial = getattr(error, 'partial', None) if partial is not None: - from anysolver.marine_mechanical import result_to_dict + from anyfesolver.marine_mechanical import result_to_dict save(path/'accepted-prefix.json', result_to_dict(partial)) save(path/'record.json', record) self.summary() @@ -111,11 +111,11 @@ def summary(self): application_replay_inventory=self.c['application_replay_inventory'])) def static(self, record, path, name, segments, *, displacement=None, translation=None, body=False): - from anysolver.marine_equilibrium import MooringStaticSpec, solve_mooring_equilibrium - from anysolver.marine_mooring import (FixedEndpoint, DynamicLineNodeEndpoint, + from anyfesolver.marine_equilibrium import MooringStaticSpec, solve_mooring_equilibrium + from anyfesolver.marine_mooring import (FixedEndpoint, DynamicLineNodeEndpoint, RigidBodyAttachmentEndpoint, MooringLine, MooringLineAssembler, data_to_dict) - from anysolver.marine_rigid import RigidBody6D - from anysolver.marine_seabed import SeabedContact + from anyfesolver.marine_rigid import RigidBody6D + from anyfesolver.marine_seabed import SeabedContact inputs = {**self.c['static'], **self.c['static_case_inputs'][name]} first, last = np.array(inputs['first'], float), np.array(inputs['last'], float) if displacement is not None: @@ -220,10 +220,10 @@ def translation(self, record, path): self.predicate(record, 'translation_geometry_m', inf(np.array(b['positions'])-np.array(a['positions'])-spec['vector']), spec['position_atol']) def dynamics(self, record, path, name, dt, damping=None): - from anysolver.marine_mooring import FixedEndpoint, DynamicLineNodeEndpoint, MooringNodeState, MooringLine, MooringLineAssembler - from anysolver.marine_rigid import RigidBody6D - from anysolver.marine_seabed import SeabedContact - from anysolver.marine_mechanical import MarineMechanicalModel, MarineMechanicalRunSpec, solve_marine_mechanical, model_to_dict, result_to_dict + from anyfesolver.marine_mooring import FixedEndpoint, DynamicLineNodeEndpoint, MooringNodeState, MooringLine, MooringLineAssembler + from anyfesolver.marine_rigid import RigidBody6D + from anyfesolver.marine_seabed import SeabedContact + from anyfesolver.marine_mechanical import MarineMechanicalModel, MarineMechanicalRunSpec, solve_marine_mechanical, model_to_dict, result_to_dict common, fixture = self.c['dynamic_fixture'], self.c[name] b = RigidBody6D(common['body_id'], common['body_mass'], (0., 0., 0.), np.diag(common['body_inertia_diagonal'])) state = b.state(position=common['body_position']) @@ -345,7 +345,7 @@ def dynamics(self, record, path, name, dt, damping=None): record['metrics'] = dict(energy_defect=defect, steps=steps, accepted=len(result.accepted), position_scale=scale) def point_contact(self, record, path): - from anysolver.marine_seabed import SeabedContact, seabed_contact_force + from anyfesolver.marine_seabed import SeabedContact, seabed_contact_force f = self.c['contact_point_passivity'] contact = SeabedContact(0., f['pressure_stiffness'], f['pressure_damping'],activation_depth_m=f.get('activation_depth_m')) gaps, velocities = np.meshgrid(f['gaps'], f['velocities']) @@ -369,8 +369,8 @@ def point_contact(self, record, path): def harmonic(self, record, path, prescribed=False): from anyloads.marine import AiryEnvironment, AiryComponent, CurrentProfile from anyloads.marine_line import LineHydrodynamics - from anysolver.marine_mooring import FixedEndpoint, RigidBodyAttachmentEndpoint, DynamicLineNodeEndpoint, MooringNodeState, MooringLine, MooringLineAssembler - from anysolver.marine_rigid import RigidBody6D + from anyfesolver.marine_mooring import FixedEndpoint, RigidBodyAttachmentEndpoint, DynamicLineNodeEndpoint, MooringNodeState, MooringLine, MooringLineAssembler + from anyfesolver.marine_rigid import RigidBody6D f = self.c['harmonic'] kinematics = self.c['prescribed_kinematics'] heading = kinematics['heading_degrees'] if prescribed else f['heading_degrees'] @@ -431,8 +431,8 @@ def main(): parser.error('internal deadline must retain at least five seconds of process reserve') args.out.mkdir(parents=True, exist_ok=False) packages = {} - import anysolver, anyloads - for name, module in [('anysolver', anysolver), ('anyloads', anyloads)]: + import anyfesolver, anyloads + for name, module in [('anyfesolver', anyfesolver), ('anyloads', anyloads)]: base = Path(module.__file__).resolve().parent if 'site-packages' not in str(base).lower(): raise RuntimeError(f'{name} must be installed, found {base}') From 4fba61673b3594ae41fd3892bf41f80b3fc7a018 Mon Sep 17 00:00:00 2001 From: Audun Arnesen Nyhus Date: Wed, 11 Nov 2026 20:58:19 +0100 Subject: [PATCH 02/15] Preserve Git byte handling for renamed scientific sources and historical fixtures --- .gitattributes | 167 +- src/anyfesolver/_compensated_contractions.py | 994 +- .../_ge_beam3_dynamic_elastic_state.py | 796 +- src/anyfesolver/_ge_beam3_fibre_cell.py | 492 +- .../_ge_beam3_native_fibre_static_element.py | 382 +- src/anyfesolver/_ge_beam3_native_midpoint.py | 842 +- src/anyfesolver/_ge_beam3_retained_fibre.py | 274 +- .../_ge_beam3_variational_shell.py | 356 +- .../_stiffened_shell_algorithmic_pullback.py | 60 +- .../_stiffened_shell_arc_checkpoint.py | 336 +- .../_stiffened_shell_arc_control.py | 180 +- .../_stiffened_shell_arc_publication.py | 188 +- src/anyfesolver/_stiffened_shell_arc_trial.py | 510 +- ...fened_shell_b2_physical_rigid_footprint.py | 392 +- ...tiffened_shell_b2_q4_panel_experimental.py | 4516 +++--- .../_stiffened_shell_b2_reference_buckling.py | 824 +- .../_stiffened_shell_beam_history.py | 178 +- ...tiffened_shell_f06_increment_arithmetic.py | 410 +- .../_stiffened_shell_ge_checkpoint_binary.py | 14 +- .../_stiffened_shell_ge_distributed_load.py | 414 +- ..._stiffened_shell_ge_distributing_finite.py | 464 +- .../_stiffened_shell_ge_pressure_load.py | 270 +- .../_stiffened_shell_ge_reference_modal.py | 950 +- .../_stiffened_shell_increment_control.py | 374 +- ...stiffened_shell_q4_algorithmic_pullback.py | 176 +- .../_stiffened_shell_q4_material_event.py | 228 +- ...stiffened_shell_s3_algorithmic_pullback.py | 96 +- ...tiffened_shell_staged_load_experimental.py | 624 +- src/anyfesolver/elements.py | 12454 ++++++++-------- src/anyfesolver/vectorized_nonlinear.py | 720 +- tests/data/namespace_migration/manifest.json | 22 +- 31 files changed, 14352 insertions(+), 14351 deletions(-) diff --git a/.gitattributes b/.gitattributes index 0f84dcbd8..ea3959360 100644 --- a/.gitattributes +++ b/.gitattributes @@ -152,8 +152,8 @@ tests/test_r8_bl5_density_subspace_dev.py -text scripts/r8_bl5_density_reference_dev.py -text tests/test_r8_bl5_density_reference_dev.py -text .qualification/b3-ge-e4-pl/r8-bl5-projected-assessment-dev-20261003-v1/density-reference/** -text -src/anysolver/_stiffened_shell_b2_q4_panel_experimental.py -text -src/anysolver/stiffened_shell.py -text +src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py -text +src/anyfesolver/stiffened_shell.py -text tests/test_stiffened_shell_b2_free_reference_modes.py -text tests/test_stiffened_shell_b2_mixed_reference_modes.py -text docs/agent_plans/development/r8-b2-free-reference-modes-20261004/** -text @@ -172,19 +172,19 @@ tests/test_r8_bl5_regional_action_dev.py -text scripts/r8_bl5_positive_part_gram_dev.py -text tests/test_r8_bl5_positive_part_gram_dev.py -text .qualification/b3-ge-e4-pl/r8-bl5-projected-assessment-dev-20261003-v1/positive-part-gram/** -text -src/anysolver/_stiffened_shell_distributing_footprint.py -text +src/anyfesolver/_stiffened_shell_distributing_footprint.py -text tests/test_stiffened_shell_distributing_footprint.py -text docs/agent_plans/development/r8-distributing-reference-linear-20261004/** -text .qualification/b3-ge-e4-pl/r8-distributing-reference-linear-dev-20261004-v1/** -text -src/anysolver/_stiffened_shell_ge_distributing_reference.py -text +src/anyfesolver/_stiffened_shell_ge_distributing_reference.py -text tests/test_stiffened_shell_ge_distributing_reference.py -text .qualification/b3-ge-e4-pl/r8-distributing-ge-reference-dev-20261004-v1/** -text -src/anysolver/_stiffened_shell_ge_experimental.py -text -src/anysolver/stiffened_shell.py -text -src/anysolver/_stiffened_shell_ge_body_load.py -text -src/anysolver/_stiffened_shell_ge_distributed_load.py -text -src/anysolver/_stiffened_shell_ge_pressure_load.py -text -src/anysolver/_stiffened_shell_ge_reference_modal.py -text +src/anyfesolver/_stiffened_shell_ge_experimental.py -text +src/anyfesolver/stiffened_shell.py -text +src/anyfesolver/_stiffened_shell_ge_body_load.py -text +src/anyfesolver/_stiffened_shell_ge_distributed_load.py -text +src/anyfesolver/_stiffened_shell_ge_pressure_load.py -text +src/anyfesolver/_stiffened_shell_ge_reference_modal.py -text tests/test_stiffened_shell_ge_distributing_owner.py -text examples/stiffened_shell_ge_distributing_reference.py -text .qualification/b3-ge-e4-pl/r8-distributing-ge-owner-dev-20261004-v1/** -text @@ -199,15 +199,15 @@ tests/test_r8_e02_distributing_feasibility.py -text # Immutable external fixed-width outputs and failed logs retain their whitespace. .qualification/b3-ge-e4-pl/r8-e02-distributing-area-feasibility-dev-20261004-v1/** -text -whitespace .qualification/b3-ge-e4-pl/r8-distributing-multihost-dev-20261004-v1/** -text -whitespace -src/anysolver/_stiffened_shell_distributing_pose.py -text +src/anyfesolver/_stiffened_shell_distributing_pose.py -text tests/test_stiffened_shell_distributing_pose.py -text .qualification/b3-ge-e4-pl/r8-distributing-finite-pose-dev-20261004-v1/** -text -whitespace -src/anysolver/_stiffened_shell_ge_distributing_finite.py -text +src/anyfesolver/_stiffened_shell_ge_distributing_finite.py -text tests/test_stiffened_shell_ge_distributing_finite.py -text # Final tested finite owner and raw development evidence retain exact bytes. -src/anysolver/_stiffened_shell_ge_checkpoint_binary.py -text +src/anyfesolver/_stiffened_shell_ge_checkpoint_binary.py -text tests/test_stiffened_shell_ge_distributing_finite_public.py -text examples/stiffened_shell_ge_distributing_finite.py -text docs/agent_plans/development/r8-distributing-reference-linear-20261004/active-before-public-finite-owner-20261004.md -text @@ -218,16 +218,16 @@ tests/test_r8_e02_distributing_thickness.py -text scripts/r8_e02_distributing_my.py -text tests/test_r8_e02_distributing_my.py -text .qualification/b3-ge-e4-pl/r8-distributing-my-dev-20261004-v1/** -text -whitespace -src/anysolver/_stiffened_shell_ge_finite_experimental.py -text +src/anyfesolver/_stiffened_shell_ge_finite_experimental.py -text tests/test_stiffened_shell_ge_distributing_material.py -text examples/stiffened_shell_ge_distributing_material.py -text .qualification/b3-ge-e4-pl/r8-distributing-material-dev-20261004-v1/** -text -whitespace -src/anysolver/_ge_beam3_variational_shell.py -text +src/anyfesolver/_ge_beam3_variational_shell.py -text -src/anysolver/_stiffened_shell_algorithmic_pullback.py -text +src/anyfesolver/_stiffened_shell_algorithmic_pullback.py -text -src/anysolver/_stiffened_shell_q4_algorithmic_pullback.py -text +src/anyfesolver/_stiffened_shell_q4_algorithmic_pullback.py -text tests/test_stiffened_shell_material_rotation_numerics.py -text @@ -236,7 +236,7 @@ tests/data/stiffened_shell_material_pre_stable_rotation.bin -text scripts/r8_e02_double_output.py -text tests/test_r8_e02_double_output.py -text .qualification/b3-ge-e4-pl/r8-e02-double-output-dev-20261004-v1/** -text -whitespace -src/anysolver/_stiffened_shell_increment_control.py -text +src/anyfesolver/_stiffened_shell_increment_control.py -text tests/test_stiffened_shell_accepted_observer_experimental.py -text tests/test_stiffened_shell_distributing_adaptive.py -text .qualification/b3-ge-e4-pl/r8-distributing-adaptive-dev-20261004-v1/** -text -whitespace @@ -256,7 +256,7 @@ tests/test_stiffened_shell_native_plastic_chart.py -text .qualification/b3-ge-e4-pl/r8-native-plastic-chart-dev-20261004-v1/** -text -whitespace .qualification/b3-ge-e4-pl/r8-native-coupled-chart-dev-20261004-v1/** -text -whitespace .qualification/b3-ge-e4-pl/r8-point-zero-reference-dev-20261004-v1/** -text -whitespace -src/anysolver/_stiffened_shell_staged_load_experimental.py -text +src/anyfesolver/_stiffened_shell_staged_load_experimental.py -text tests/test_stiffened_shell_staged_load_owner_experimental.py -text tests/test_stiffened_shell_staged_zero_reference.py -text examples/stiffened_shell_ge_point_zero_unload.py -text @@ -265,10 +265,10 @@ docs/agent_plans/B3_GE_E4_PL_ACTIVE_STATE.md -text docs/agent_plans/B3_GE_E4_PL_REVISION_8_GOAL.md -text docs/agent_plans/B3_GE_E4_PL_REVISION_8_PLAN.md -text .qualification/b3-ge-e4-pl/r8-native-point-displacement-dev-20261004-v1/** -text -whitespace -src/anysolver/_stiffened_shell_affine_endpoint.py -text -src/anysolver/_stiffened_shell_displacement_checkpoint.py -text -src/anysolver/_stiffened_shell_displacement_control.py -text -src/anysolver/_stiffened_shell_displacement_corrector.py -text +src/anyfesolver/_stiffened_shell_affine_endpoint.py -text +src/anyfesolver/_stiffened_shell_displacement_checkpoint.py -text +src/anyfesolver/_stiffened_shell_displacement_control.py -text +src/anyfesolver/_stiffened_shell_displacement_corrector.py -text tests/test_stiffened_shell_native_point_displacement.py -text examples/stiffened_shell_ge_point_displacement.py -text docs/stiffened_shell_native_displacement_development.md -text @@ -280,8 +280,8 @@ examples/stiffened_shell_native_coupled_displacement.py -text tests/test_stiffened_shell_native_s3_displacement.py -text tests/test_stiffened_shell_native_s3_displacement_admission.py -text examples/stiffened_shell_native_s3_displacement.py -text -src/anysolver/_stiffened_shell_ge_checkpoint_binary.py -text -src/anysolver/_stiffened_shell_ge_experimental.py -text +src/anyfesolver/_stiffened_shell_ge_checkpoint_binary.py -text +src/anyfesolver/_stiffened_shell_ge_experimental.py -text .qualification/b3-ge-e4-pl/r8-native-s3-displacement-dev-20261005-v1/** -text -whitespace tests/test_stiffened_shell_native_fibre_s3_displacement.py -text @@ -299,7 +299,7 @@ tests/test_stiffened_shell_native_mixed_j2_displacement_snapshot.py -text tests/data/native_mixed_j2_displacement/** -text .qualification/b3-ge-e4-pl/r8-native-mixed-j2-displacement-diagnosis-20261005-v1/** -text -whitespace -src/anysolver/_stiffened_shell_displacement_adaptive.py -text +src/anyfesolver/_stiffened_shell_displacement_adaptive.py -text tests/test_stiffened_shell_native_displacement_adaptive.py -text tests/test_stiffened_shell_native_fibre_s3_displacement_identity.py -text tests/test_stiffened_shell_native_point_displacement.py -text @@ -324,10 +324,10 @@ tests/data/native_s3_fibre_history/** -text /tests/test_stiffened_shell_native_arc.py -text /examples/stiffened_shell_native_arc.py -text /.qualification/b3-ge-e4-pl/r8-native-arc-dev-20261005-v1/** -text -whitespace -/src/anysolver/_stiffened_shell_arc_control.py -text -/src/anysolver/_stiffened_shell_arc_trial.py -text -/src/anysolver/_stiffened_shell_arc_checkpoint.py -text -/src/anysolver/_stiffened_shell_arc_publication.py -text +/src/anyfesolver/_stiffened_shell_arc_control.py -text +/src/anyfesolver/_stiffened_shell_arc_trial.py -text +/src/anyfesolver/_stiffened_shell_arc_checkpoint.py -text +/src/anyfesolver/_stiffened_shell_arc_publication.py -text /docs/stiffened_shell_arc_development.md -text /tests/test_stiffened_shell_native_arc_progress.py -text @@ -347,8 +347,8 @@ tests/data/native_s3_fibre_history/** -text /docs/agent_plans/history/PRE_CCX_INVERSE_20261005.md -text /docs/agent_plans/history/PRE_BL5_BUCKLING_20261005.md -text /docs/agent_plans/history/PRE_MIXED_BUCKLING_20261005.md -text -/src/anysolver/_stiffened_shell_ge_point_buckling.py -text -/src/anysolver/_stiffened_shell_s3_conservative_buckling.py -text +/src/anyfesolver/_stiffened_shell_ge_point_buckling.py -text +/src/anyfesolver/_stiffened_shell_s3_conservative_buckling.py -text /tests/test_stiffened_shell_ge_mixed_buckling.py -text /examples/stiffened_shell_ge_mixed_buckling.py -text /scripts/r8_ge_mixed_buckling_dev.py -text @@ -373,7 +373,7 @@ tests/data/native_s3_fibre_history/** -text /.qualification/b3-ge-e4-pl/r8-native-fibre-bl5-dev-20261005-v1/** -text -whitespace /docs/agent_plans/history/PRE_NATIVE_BL5_DELIVERY_20261005.md -text -/src/anysolver/_stiffened_shell_bl5_native_elastic.py -text +/src/anyfesolver/_stiffened_shell_bl5_native_elastic.py -text /tests/test_stiffened_shell_native_fibre_bl5.py -text /examples/stiffened_shell_native_fibre_bl5.py -text @@ -404,11 +404,11 @@ tests/data/native_s3_fibre_history/** -text /examples/stiffened_shell_native_fibre_bl5_material.py -text whitespace=cr-at-eol /tests/test_stiffened_shell_native_fibre_bl5_material.py -text whitespace=cr-at-eol /docs/reference_cases/stiffened_shell_native_fibre_bl5_material.md -text whitespace=cr-at-eol -/src/anysolver/_ge_beam3_fibre_cell.py -text whitespace=cr-at-eol -/src/anysolver/_ge_beam3_retained_fibre.py -text whitespace=cr-at-eol +/src/anyfesolver/_ge_beam3_fibre_cell.py -text whitespace=cr-at-eol +/src/anyfesolver/_ge_beam3_retained_fibre.py -text whitespace=cr-at-eol /tests/test_native_fibre_boundary_proposal.py -text whitespace=cr-at-eol /docs/agent_plans/history/PRE_J2_UNBLOCK_SHORTENING_20261006.md -text -/src/anysolver/_stiffened_shell_q4_material_event.py -text whitespace=cr-at-eol +/src/anyfesolver/_stiffened_shell_q4_material_event.py -text whitespace=cr-at-eol /tests/test_q4_native_material_event.py -text whitespace=cr-at-eol /.qualification/b3-ge-e4-pl/r8-native-fibre-bl5-displacement-dev-20261006-v1/** -text -whitespace /examples/stiffened_shell_native_fibre_bl5_displacement.py -text whitespace=cr-at-eol @@ -423,11 +423,11 @@ tests/data/native_s3_fibre_history/** -text /tests/test_r8_bl5_body_port_twofold_workflow.py -text whitespace=cr-at-eol,-blank-at-eof /docs/reference_cases/stiffened_shell_bl5_body_port_twofold_workflow.md -text whitespace=cr-at-eol /.qualification/b3-ge-e4-pl/r8-bl5-body-port-twofold-slot-repair-dev-20261006-v1/** -text -whitespace -/src/anysolver/_stiffened_shell_ge_reference_modal.py -text whitespace=cr-at-eol,-blank-at-eof -/src/anysolver/_stiffened_shell_ge_experimental.py -text whitespace=cr-at-eol,-blank-at-eof -/src/anysolver/stiffened_shell.py -text whitespace=cr-at-eol,-blank-at-eof -/src/anysolver/_stiffened_shell_ge_mixed_modal_mass.py -text whitespace=cr-at-eol,-blank-at-eof -/src/anysolver/_stiffened_shell_physical_s3_mass.py -text whitespace=cr-at-eol,-blank-at-eof +/src/anyfesolver/_stiffened_shell_ge_reference_modal.py -text whitespace=cr-at-eol,-blank-at-eof +/src/anyfesolver/_stiffened_shell_ge_experimental.py -text whitespace=cr-at-eol,-blank-at-eof +/src/anyfesolver/stiffened_shell.py -text whitespace=cr-at-eol,-blank-at-eof +/src/anyfesolver/_stiffened_shell_ge_mixed_modal_mass.py -text whitespace=cr-at-eol,-blank-at-eof +/src/anyfesolver/_stiffened_shell_physical_s3_mass.py -text whitespace=cr-at-eol,-blank-at-eof /tests/test_stiffened_shell_ge_mixed_reference_modal.py -text whitespace=cr-at-eol,-blank-at-eof /tests/test_stiffened_shell_physical_s3_mass.py -text whitespace=cr-at-eol,-blank-at-eof /examples/stiffened_shell_ge_mixed_reference_modes.py -text whitespace=cr-at-eol,-blank-at-eof @@ -435,14 +435,14 @@ tests/data/native_s3_fibre_history/** -text /.qualification/b3-ge-e4-pl/r8-ge-mixed-reference-modal-dev-20261006-v1/** -text -whitespace /.qualification/b3-ge-e4-pl/r8-ge-mixed-reference-modal-installed-dev-20261006-v1/** -text -whitespace .qualification/b3-ge-e4-pl/r8-b2-reference-buckling-dev-20261006-v1/** -text -whitespace -/src/anysolver/_stiffened_shell_b2_reference_buckling.py -text whitespace=cr-at-eol,-blank-at-eof -/src/anysolver/_stiffened_shell_b2_q4_panel_experimental.py -text whitespace=cr-at-eol,-blank-at-eof +/src/anyfesolver/_stiffened_shell_b2_reference_buckling.py -text whitespace=cr-at-eol,-blank-at-eof +/src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py -text whitespace=cr-at-eol,-blank-at-eof /tests/test_stiffened_shell_b2_reference_buckling.py -text whitespace=cr-at-eol,-blank-at-eof /examples/stiffened_shell_b2_reference_buckling.py -text whitespace=cr-at-eol,-blank-at-eof /docs/reference_cases/stiffened_shell_b2_reference_buckling.md -text whitespace=cr-at-eol,-blank-at-eof /.qualification/b3-ge-e4-pl/r8-b2-reference-buckling-installed-dev-20261006-v1/** -text -whitespace /.qualification/b3-ge-e4-pl/r8-b2-physical-rigid-footprint-dev-20261006-v1/** -text -whitespace -/src/anysolver/_stiffened_shell_b2_physical_rigid_footprint.py -text whitespace=cr-at-eol,-blank-at-eof +/src/anyfesolver/_stiffened_shell_b2_physical_rigid_footprint.py -text whitespace=cr-at-eol,-blank-at-eof /tests/test_stiffened_shell_b2_physical_rigid_footprint.py -text whitespace=cr-at-eol,-blank-at-eof /examples/stiffened_shell_b2_physical_rigid_footprint.py -text whitespace=cr-at-eol,-blank-at-eof /docs/reference_cases/stiffened_shell_b2_physical_rigid_footprint.md -text whitespace=cr-at-eol,-blank-at-eof @@ -454,9 +454,9 @@ tests/test_stiffened_shell_b2_physical_footprint_batch.py -text whitespace=cr-at .qualification/b3-ge-e4-pl/r8-b2-physical-footprint-batch-installed-dev-20261006-v1/** -text -whitespace -/src/anysolver/_stiffened_shell_displacement_corrector.py -text whitespace=cr-at-eol,-blank-at-eof -/src/anysolver/_stiffened_shell_s3_algorithmic_pullback.py -text whitespace=cr-at-eol,-blank-at-eof -/src/anysolver/_stiffened_shell_s3_material_event.py -text whitespace=cr-at-eol,-blank-at-eof +/src/anyfesolver/_stiffened_shell_displacement_corrector.py -text whitespace=cr-at-eol,-blank-at-eof +/src/anyfesolver/_stiffened_shell_s3_algorithmic_pullback.py -text whitespace=cr-at-eol,-blank-at-eof +/src/anyfesolver/_stiffened_shell_s3_material_event.py -text whitespace=cr-at-eol,-blank-at-eof /examples/stiffened_shell_native_fibre_bl5_mixed_j2_displacement.py -text whitespace=cr-at-eol,-blank-at-eof /tests/test_native_fibre_bl5_mixed_j2_displacement.py -text whitespace=cr-at-eol,-blank-at-eof /docs/stiffened_shell_native_bl5_mixed_j2_development.md -text whitespace=cr-at-eol,-blank-at-eof @@ -470,7 +470,7 @@ tests/test_stiffened_shell_b2_physical_footprint_batch.py -text whitespace=cr-at /.qualification/b3-ge-e4-pl/r8-native-material-bl5-arc-dev-20261006-v1/** -text -whitespace tests/test_native_material_bl5_arc_same_origin_jacobian.py -text whitespace=cr-at-eol -src/anysolver/_stiffened_shell_arc_metric.py -text whitespace=cr-at-eol +src/anyfesolver/_stiffened_shell_arc_metric.py -text whitespace=cr-at-eol tests/test_stiffened_shell_native_director_arc_metric.py -text whitespace=cr-at-eol examples/stiffened_shell_native_director_arc_metric.py -text whitespace=cr-at-eol docs/development/stiffened_shell_native_director_arc_metric.md -text whitespace=cr-at-eol @@ -506,10 +506,10 @@ docs/d1_review_support/d2_s3_projected_penalty*20260930*.log -text docs/d1_review_support/d2_s3_projected_penalty*20260930*.xml -text docs/d1_review_support/d2_s3_manufactured*20260930*.json -text docs/d1_review_support/d2_s3_manufactured*20260930*.log -text -src/anysolver/general_contact/core.py text eol=lf -src/anysolver/general_contact/s3_patch_static.py text eol=lf -src/anysolver/general_contact/s3_patch_augmented.py text eol=lf -src/anysolver/general_contact/static_path.py text eol=lf +src/anyfesolver/general_contact/core.py text eol=lf +src/anyfesolver/general_contact/s3_patch_static.py text eol=lf +src/anyfesolver/general_contact/s3_patch_augmented.py text eol=lf +src/anyfesolver/general_contact/static_path.py text eol=lf tests/test_general_contact_s3_projected_penalty.py text eol=lf docs/d1_review_support/d2_s3_projected_penalty_coupled_dev.py text eol=lf docs/d1_review_support/d2_s3_deformable*20260930*.json -text @@ -605,11 +605,11 @@ docs/d1_review_support/GENERAL_CONTACT_RESTART_HISTORY_20261001_PART25.md -text # Exact opt-in native dynamics integration and API evidence bytes. docs/d1_review_support/native_dynamic*_20261001.* -text -whitespace -src/anysolver/_ge_beam3_centered_finite_inertia.py -text whitespace=cr-at-eol -src/anysolver/_ge_beam3_dynamic_elastic_state.py -text whitespace=cr-at-eol -src/anysolver/_ge_beam3_native_midpoint.py -text whitespace=cr-at-eol -src/anysolver/_ge_beam3_native_dynamic_analysis.py -text whitespace=cr-at-eol -src/anysolver/ge_beam3_native_dynamics.py -text whitespace=cr-at-eol +src/anyfesolver/_ge_beam3_centered_finite_inertia.py -text whitespace=cr-at-eol +src/anyfesolver/_ge_beam3_dynamic_elastic_state.py -text whitespace=cr-at-eol +src/anyfesolver/_ge_beam3_native_midpoint.py -text whitespace=cr-at-eol +src/anyfesolver/_ge_beam3_native_dynamic_analysis.py -text whitespace=cr-at-eol +src/anyfesolver/ge_beam3_native_dynamics.py -text whitespace=cr-at-eol examples/native_contact_free_finite_velocity_dev.py -text whitespace=cr-at-eol tests/test_native_dynamic_main_example.py -text whitespace=cr-at-eol docs/d1_review_support/GENERAL_CONTACT_RESTART_HISTORY_20261001_PART26.md -text -whitespace @@ -621,7 +621,7 @@ tests/test_general_contact_deformable_b3_s3_static.py -text whitespace=cr-at-eol docs/d1_review_support/d3_multiple_beam_sphere_lifecycle*_20261001.* -text -whitespace tests/test_general_contact_multiple_beam_sphere_lifecycle.py -text whitespace=cr-at-eol -src/anysolver/_ge_beam3_native_dynamic_restart.py -text whitespace=cr-at-eol +src/anyfesolver/_ge_beam3_native_dynamic_restart.py -text whitespace=cr-at-eol tests/test_ge_beam3_native_dynamic_restart.py -text whitespace=cr-at-eol @@ -653,8 +653,8 @@ docs/d1_review_support/anystructure_contact_slice_baseline_20261001.json -text - docs/d1_review_support/GENERAL_CONTACT_RESTART_HISTORY_20261001_PART35.md -text -whitespace docs/d1_review_support/native_inertia_batch* -text -whitespace docs/d1_review_support/native_principal_spin* -text -whitespace -src/anysolver/_ge_beam3_centered_batched_finite_inertia.py text eol=lf -src/anysolver/_ge_beam3_centered_finite_inertia.py text eol=lf +src/anyfesolver/_ge_beam3_centered_batched_finite_inertia.py text eol=lf +src/anyfesolver/_ge_beam3_centered_finite_inertia.py text eol=lf docs/d1_review_support/GENERAL_CONTACT_RESTART_HISTORY_20261001_PART36.md -text -whitespace docs/d1_review_support/native_finite_spin_temporal_refinement* -text -whitespace @@ -760,10 +760,10 @@ docs/agent_plans/development/r8-ge-selective-rebase-20261009/** -text -whitespac .development/r8-ge-coordinate-support-20261009/** -text -whitespace docs/agent_plans/development/r8-ge-coordinate-support-20261009/** -text -whitespace -src/anysolver/_stiffened_shell_coordinate_support.py -text -src/anysolver/_stiffened_shell_ge_experimental.py -text -src/anysolver/_stiffened_shell_ge_finite_experimental.py -text -src/anysolver/stiffened_shell.py -text +src/anyfesolver/_stiffened_shell_coordinate_support.py -text +src/anyfesolver/_stiffened_shell_ge_experimental.py -text +src/anyfesolver/_stiffened_shell_ge_finite_experimental.py -text +src/anyfesolver/stiffened_shell.py -text tests/test_stiffened_shell_ge_coordinate_support.py -text tests/test_stiffened_shell_coordinate_support_work_oracle.py -text @@ -810,11 +810,11 @@ tests/test_r8_f03_physical_contract_20261010.py -text tests/test_r8_f06_cell_moment_oracle_dev.py -text docs/agent_plans/development/r8-f06-compensated-state-20261010/** -text docs/agent_plans/development/r8-f03-common-density-20261010/** -text -src/anysolver/_ge_beam3_generalized_cell.py -text -src/anysolver/_ge_beam3_native_definition.py -text -src/anysolver/_ge_beam3_pose_joint.py -text -src/anysolver/_ge_beam3_retained_generalized.py -text -src/anysolver/_stiffened_shell_f06_increment_arithmetic.py -text +src/anyfesolver/_ge_beam3_generalized_cell.py -text +src/anyfesolver/_ge_beam3_native_definition.py -text +src/anyfesolver/_ge_beam3_pose_joint.py -text +src/anyfesolver/_ge_beam3_retained_generalized.py -text +src/anyfesolver/_stiffened_shell_f06_increment_arithmetic.py -text scripts/r8_f06_compensated_state_route_dev.py -text scripts/r8_f06_compensated_state_check_dev.py -text scripts/r8_f06_compensated_state_checkpoint_repair_check_dev.py -text @@ -830,7 +830,7 @@ scripts/r8_f06_log_domain_check_dev.py -text scripts/r8_b2_original_operator_dev.py -text tests/test_r8_f06_log_domain_dev.py -text tests/test_r8_b2_original_operator_20261010.py -text -src/anysolver/_b2_attachment_elimination_dev.py -text +src/anyfesolver/_b2_attachment_elimination_dev.py -text scripts/r8_b2_attachment_elimination_dev.py -text scripts/r8_b2_original_operator_prediction_dev.py -text scripts/r8_f03_common_density_response_dev.py -text @@ -840,12 +840,12 @@ tests/test_r8_f03_common_density_response_dev.py -text .development/r8-active-state-before-saved-feedback-20261010.md -text .development/r8-f07-structural-note-original-bytes/REPORT.md -text .development/r8-f07-structural-note-original-bytes/CHECKPOINT.md -text -src/anysolver/_ge_beam3_native_fibre_static_element.py -text +src/anyfesolver/_ge_beam3_native_fibre_static_element.py -text scripts/r8_f06_fibre_log_domain_dev.py -text tests/test_r8_f06_fibre_log_domain_dev.py -text docs/agent_plans/development/r8-f06-log-domain-20261010/fibre-v1/** -text docs/agent_plans/development/r8-f07-block-descriptor-20261009/finite-supplement-v1/** -text -src/anysolver/_stiffened_shell_beam_history.py -text +src/anyfesolver/_stiffened_shell_beam_history.py -text scripts/r8_f06_native_material_breadth_dev.py -text tests/test_r8_f06_native_material_breadth_dev.py -text docs/agent_plans/development/r8-f06-log-domain-20261010/material-breadth-v1/** -text @@ -937,7 +937,7 @@ scripts/r8_b2_assembly_series_dev.py -text tests/test_r8_b2_assembly_series_dev.py -text scripts/r8_f06_paired_role_assessment_dev.py -text tests/test_r8_f06_paired_role_assessment_dev.py -text -src/anysolver/_stiffened_shell_b2_assembly_diagnostics.py -text +src/anyfesolver/_stiffened_shell_b2_assembly_diagnostics.py -text docs/agent_plans/development/r8-b2-assembly-metrics-20261010/** -text -whitespace docs/agent_plans/development/r8-b2-assembly-series-20261010/** -text -whitespace docs/agent_plans/development/r8-b2-coo-scratch-cleanup-20261010/** -text -whitespace @@ -990,7 +990,7 @@ tests/test_r8_ge_paired_fixed_diagnostic_dev.py -text whitespace=blank-at-eol,-b docs/agent_plans/development/r8-b2-q4-lifetime-20261010/** -text -whitespace -src/anysolver/e4_pl_element.py -text +src/anyfesolver/e4_pl_element.py -text scripts/r8_b2_q4_lifetime_dev.py -text tests/test_r8_b2_q4_lifetime_dev.py -text whitespace=blank-at-eol,-blank-at-eof,space-before-tab,cr-at-eol @@ -998,11 +998,11 @@ scripts/r8_ge_paired_trial_derivative_dev.py -text tests/test_r8_ge_paired_trial_derivative_dev.py -text whitespace=blank-at-eol,-blank-at-eof,space-before-tab,cr-at-eol # Preserve frozen Mistral candidate source bytes across checkout. -src/anysolver/_stiffened_shell_displacement_corrector.py -text whitespace=blank-at-eol,-blank-at-eof,space-before-tab,cr-at-eol -src/anysolver/_stiffened_shell_displacement_control.py -text whitespace=blank-at-eol,-blank-at-eof,space-before-tab,cr-at-eol -src/anysolver/_stiffened_shell_displacement_adaptive.py -text whitespace=blank-at-eol,-blank-at-eof,space-before-tab,cr-at-eol -src/anysolver/_stiffened_shell_ge_experimental.py -text whitespace=blank-at-eol,-blank-at-eof,space-before-tab,cr-at-eol -src/anysolver/stiffened_shell.py -text whitespace=blank-at-eol,-blank-at-eof,space-before-tab,cr-at-eol +src/anyfesolver/_stiffened_shell_displacement_corrector.py -text whitespace=blank-at-eol,-blank-at-eof,space-before-tab,cr-at-eol +src/anyfesolver/_stiffened_shell_displacement_control.py -text whitespace=blank-at-eol,-blank-at-eof,space-before-tab,cr-at-eol +src/anyfesolver/_stiffened_shell_displacement_adaptive.py -text whitespace=blank-at-eol,-blank-at-eof,space-before-tab,cr-at-eol +src/anyfesolver/_stiffened_shell_ge_experimental.py -text whitespace=blank-at-eol,-blank-at-eof,space-before-tab,cr-at-eol +src/anyfesolver/stiffened_shell.py -text whitespace=blank-at-eol,-blank-at-eof,space-before-tab,cr-at-eol scripts/r8_ge_merit_interpolation_candidate_dev.py -text whitespace=blank-at-eol,-blank-at-eof,space-before-tab,cr-at-eol scripts/r8_ge_merit_interpolation_execution_dev.py -text whitespace=blank-at-eol,-blank-at-eof,space-before-tab,cr-at-eol tests/test_r8_ge_merit_interpolation_candidate_dev.py -text whitespace=blank-at-eol,-blank-at-eof,space-before-tab,cr-at-eol @@ -1041,9 +1041,9 @@ tests/data/general_contact_native_curved_pair_lifecycle_press_v1.checkpoint -tex tests/data/general_contact_native_curved_pair_lifecycle_press_v1_provenance.json -text # Preserve exact qualified Q4 dependency, evidence and mutation-oracle bytes. -src/anysolver/elements.py -text whitespace=blank-at-eol,-blank-at-eof,space-before-tab,cr-at-eol -src/anysolver/vectorized_nonlinear.py -text whitespace=blank-at-eol,-blank-at-eof,space-before-tab,cr-at-eol -src/anysolver/_compensated_contractions.py -text whitespace=blank-at-eol,-blank-at-eof,space-before-tab,cr-at-eol +src/anyfesolver/elements.py -text whitespace=blank-at-eol,-blank-at-eof,space-before-tab,cr-at-eol +src/anyfesolver/vectorized_nonlinear.py -text whitespace=blank-at-eol,-blank-at-eof,space-before-tab,cr-at-eol +src/anyfesolver/_compensated_contractions.py -text whitespace=blank-at-eol,-blank-at-eof,space-before-tab,cr-at-eol docs/reference_cases/e4_pl_q4_source_binding_20261016.json -text whitespace=blank-at-eol,-blank-at-eof,space-before-tab,cr-at-eol tests/test_general_contact_c5_elastic_increment.py -text whitespace=blank-at-eol,-blank-at-eof,space-before-tab,cr-at-eol tests/test_general_contact_c5_numpy_coordinate_admission.py -text whitespace=blank-at-eol,-blank-at-eof,space-before-tab,cr-at-eol @@ -1065,7 +1065,8 @@ docs/reference_cases/e4_pl_q4_source_binding_20261019.json -text docs/reference_cases/Q4_SOURCE_BINDING_REVIEW_20261019.md text eol=lf docs/main-housecleaning-20261019/C5_SCOPED_ACCEPTANCE_20261016.json -text # New source-only binding includes the already committed fe_core carrier bytes. -src/anysolver/fe_core.py -text whitespace=blank-at-eol,-blank-at-eof,space-before-tab,cr-at-eol +src/anyfesolver/fe_core.py -text whitespace=blank-at-eol,-blank-at-eof,space-before-tab,cr-at-eol # One exact candidate configuration is shared by both host checkouts. scripts/contact_candidate_slice2.json text eol=lf +/tests/data/namespace_migration/*.json -text diff --git a/src/anyfesolver/_compensated_contractions.py b/src/anyfesolver/_compensated_contractions.py index 6f0bce4a3..e82e10b1f 100644 --- a/src/anyfesolver/_compensated_contractions.py +++ b/src/anyfesolver/_compensated_contractions.py @@ -1,497 +1,497 @@ -"""Finite, fixed-order element-local contractions (no BLAS dispatch). - -Products are split on normalized binary64 mantissas with Dekker's transform; -both parts are accumulated with ``math.fsum`` in ascending index order. -No exact-rounding claim is made: scaling a residual into the subnormal range -can lose at most one minimum subnormal per product, and fsum has its documented -platform double-rounding limitation. Exact cancellation/empty sums give +0. -Nonfinite inputs and overflowing individual products or sums are refused, -even when a wider exact accumulator could cancel an intermediate overflow. -There is no precision option, persistent result cache or fallback that changes -a value. Optional compiled kernels (``_compensated_native``, Numba) execute the -same arithmetic bit for bit; they are enabled only when Numba is present and a -known-answer self-check at import reproduces the numpy path bitwise (it guards -against fused multiply-add contraction). Any refusal replays the numpy path so -the reference exception is raised. -""" -from math import frexp as _frexp, fsum as _fsum, isfinite as _isfinite, ldexp as _ldexp - -import os -from types import MappingProxyType as _MappingProxyType - -import numpy as np - -from . import _compensated_native as _native - -# Compiled kernels run the identical arithmetic (see _compensated_native); a -# nonzero kernel status replays the vectorised path, which raises the reference -# exception. ANYSOLVER_NATIVE_CONTRACTIONS=0 forces the numpy path. -_USE_NATIVE = _native.AVAILABLE and os.environ.get("ANYSOLVER_NATIVE_CONTRACTIONS", "1") != "0" -# The fused element kernels additionally need their own known-answer match -# (checked at import below); ANYSOLVER_NATIVE_CONTRACTIONS=0 disables both. -_USE_FUSED = _USE_NATIVE - - -def _product_parts(a, b): - if not _isfinite(a) or not _isfinite(b): - raise ValueError("compensated contraction requires finite inputs") - product = a * b - if not _isfinite(product): - raise OverflowError("compensated product overflow") - if a == 0.0 or b == 0.0: - return product, 0.0 - x, ex = _frexp(a) - y, ey = _frexp(b) - split = 134217729.0 - cx, cy = split * x, split * y - xh, yh = cx - (cx - x), cy - (cy - y) - xl, yl = x - xh, y - yh - high = x * y - low = ((xh * yh - high) + xh * yl + xl * yh) + xl * yl - # In the normal range power-of-two scaling is exact. In the subnormal - # range the rounded product need not equal a doubly rounded scaled high; - # the contract allows that lost half-ulp and scaled-low rounding (<= one - # minimum subnormal together), rather than claiming an exact expansion. - return product, _ldexp(low, ex + ey) - - -_SPLIT = 134217729.0 - - -def _vector_parts(a, b): - """Elementwise ``_product_parts`` for finite broadcastable arrays. - - Same IEEE operations in the same order as the scalar routine, so the - (product, residual) pairs are bitwise identical. Refuses nonfinite inputs - and overflowing products with the scalar routine's exceptions. - """ - with np.errstate(all="ignore"): - product = a * b - if not (np.all(np.isfinite(a)) and np.all(np.isfinite(b)) - and np.all(np.isfinite(product))): - # Rare error path: reproduce the scalar first-failure semantics. - for x, y in zip(np.broadcast_to(a, product.shape).ravel().tolist(), - np.broadcast_to(b, product.shape).ravel().tolist()): - _product_parts(x, y) - x, ex = np.frexp(a) - y, ey = np.frexp(b) - cx, cy = _SPLIT * x, _SPLIT * y - xh, yh = cx - (cx - x), cy - (cy - y) - xl, yl = x - xh, y - yh - high = x * y - low = ((xh * yh - high) + xh * yl + xl * yh) + xl * yl - low = np.ldexp(low, ex + ey) - low = np.where((a == 0.0) | (b == 0.0), 0.0, low) - return product, low - - -def _interleave_sum(product, low): - """fsum of ``[p0, l0, p1, l1, ...]`` along the last axis, as the scalar dot.""" - lead = product.shape[:-1] - count = product.shape[-1] - parts = np.empty((product.size // max(count, 1), 2 * count), dtype=float) - parts[:, 0::2] = product.reshape(-1, count) - parts[:, 1::2] = low.reshape(-1, count) - values = np.array(list(map(_fsum, parts.tolist())), dtype=float) - if not np.all(np.isfinite(values)): - raise OverflowError("compensated sum overflow") - return values.reshape(lead) - - -def dot(left, right): - if len(left) != len(right): - raise ValueError("compensated dot shape mismatch") - a = np.array([float(v) for v in left], dtype=float) - b = np.array([float(v) for v in right], dtype=float) - if a.size == 0: - return 0.0 - product, low = _vector_parts(a, b) - return float(_interleave_sum(product, low)) - - -def product(left, right): - """Matrix/matrix or matrix/vector product; each dot uses the same policy.""" - a, b = np.asarray(left, dtype=float), np.asarray(right, dtype=float) - if a.ndim != 2 or b.ndim not in (1, 2) or a.shape[1] != b.shape[0]: - raise ValueError("compensated product shape mismatch") - vector = b.ndim == 1 - columns = b.reshape((-1, 1)) if vector else b - if _USE_NATIVE: - # The kernel refuses nonfinite input itself; any refusal falls through - # to the checks below, which raise the reference exception. - native = np.empty((a.shape[0], columns.shape[1]), dtype=float) - if _native.contract_product(np.ascontiguousarray(a), np.ascontiguousarray(columns), - native, _native.POW2) == 0: - return native[:, 0] if vector else native - if not np.all(np.isfinite(a)) or not np.all(np.isfinite(b)): - raise ValueError("compensated product requires finite inputs") - result = np.zeros((a.shape[0], columns.shape[1]), dtype=float) - # Terms with an all-zero operand slice are exact zeros in every dot and - # cannot change an exactly rounded sum. - keep = np.any(a != 0.0, axis=0) & np.any(columns != 0.0, axis=1) - # Overflow in a pruned term would still be refused by the scalar policy - # only if both factors were nonzero, so pruning never hides an error. - if keep.any(): - a, columns = a[:, keep], columns[keep] - prod, low = _vector_parts(a[:, None, :], columns.T[None, :, :]) - result = _interleave_sum(prod, low) - return result[:, 0] if vector else result - - -def sum_arrays(terms): - """Fixed-order componentwise sum of already represented equal-shape terms.""" - arrays = [np.asarray(term, dtype=float) for term in terms] - if not arrays or any(a.shape != arrays[0].shape for a in arrays): - raise ValueError("compensated array sum requires equal nonempty shapes") - shape = arrays[0].shape - if _USE_NATIVE: - # contract_sum refuses overflow only; nonfinite input is screened here - # on the single stacked array instead of once per term. - stack = np.ascontiguousarray(np.stack(arrays).reshape(len(arrays), -1)) - if np.isfinite(stack).all(): - native = np.empty(stack.shape[1], dtype=float) - if _native.contract_sum(stack, native) == 0: - return native.reshape(shape) - if any(not np.all(np.isfinite(a)) for a in arrays): - raise ValueError("compensated array sum requires finite inputs") - rows = np.stack(arrays).reshape(len(arrays), -1).T.tolist() - result = np.array(list(map(_fsum, rows)), dtype=float).reshape(shape) - if not np.all(np.isfinite(result)): - raise OverflowError("compensated array sum overflow") - return result - - -def weighted_sum(terms, weights): - """Quadrature reduction including compensation of each weight product.""" - arrays = [np.asarray(term, dtype=float) for term in terms] - if not arrays or len(arrays) != len(weights) or any(a.shape != arrays[0].shape for a in arrays): - raise ValueError("compensated weighted sum shape mismatch") - shape = arrays[0].shape - try: - if _USE_NATIVE: - flat = np.ascontiguousarray(np.stack(arrays).reshape(len(arrays), -1)) - w = np.array([float(v) for v in weights], dtype=float) - native = np.empty(flat.shape[1], dtype=float) - if _native.contract_weighted(flat, w, native, _native.POW2) == 0: - return native.reshape(shape) - stacked = np.stack(arrays).reshape(len(arrays), -1).T - w = np.array([float(v) for v in weights], dtype=float) - prod, low = _vector_parts(stacked, w[None, :]) - return _interleave_sum(prod, low).reshape(shape) - except (ValueError, OverflowError): - # Refused input: replay index by index so the first failure (and its - # exception type) is the one the scalar policy reports. - result = np.empty(shape, dtype=float) - for index in np.ndindex(shape): - result[index] = _scalar_dot([a[index] for a in arrays], weights) - return result - - -def _scalar_dot(left, right): - parts = [] - for a, b in zip(left, right): - parts.extend(_product_parts(float(a), float(b))) - result = _fsum(parts) - if not _isfinite(result): - raise OverflowError("compensated sum overflow") - return result - - -def _shell_zero_tangent_reference(geometry, membrane, bending, shear, drill): - """Contract independently supplied elastic coefficients on frozen geometry.""" - terms, weights = [], [] - for bm, bb, bd, weight in zip(geometry["B_m_all"], geometry["B_b_all"], - geometry["B_d_all"], geometry["detw_all"]): - terms.append(sum_arrays((product(product(bm.T, membrane), bm), - product(product(bb.T, bending), bb), - product(bd.T, drill * bd)))) - weights.append(weight) - for bs, weight in zip(geometry["B_s_all"], geometry["detw_shear_all"]): - terms.append(product(product(bs.T, shear), bs)) - weights.append(weight) - local = weighted_sum(terms, weights) - transform = geometry["T0"] - return product(product(transform.T, local), transform) - - -def _increment(u_elem, geometry, constitutive_factory, tangent, use_kernel): - """Elastic von-Karman increment: the reference evaluation order, optionally fused. - - Order (identical for both routes): read ``T0``; the displacement product - (its result ``u`` is computed once and reused); one coefficient evaluation; - only then, at the moment of choosing, the numpy error policy is read and the - compiled kernel is tried with ``u`` and the cached coefficients. A policy - that is not default-or-ignore, non-conforming input or any kernel refusal - falls through to the reference loop below with the same ``u``/coefficients. - """ - transform = geometry["T0"] - u = product(transform, u_elem) - constitutive = constitutive_factory() - if use_kernel and _fused_policy_allows(): - fused = _increment_fused(transform, u, geometry, constitutive, tangent) - if fused is not None: - return fused - force = np.zeros(u.size, dtype=float) - material = np.zeros((u.size, u.size), dtype=float) - geometric = np.zeros((u.size, u.size), dtype=float) - forces, materials, geometrics = [], [], [] - weights = [] - for B, G, weight in zip(geometry["B_m_all"], geometry["Gw_all"], - geometry["detw_all"]): - theta = product(G, u) - eta = np.array((0.5 * theta[0]**2, 0.5 * theta[1]**2, - theta[0] * theta[1]), dtype=float) - H = np.vstack((theta[0] * G[0], theta[1] * G[1], - theta[0] * G[1] + theta[1] * G[0])) - linear_stress = product(constitutive, product(B, u)) - nonlinear_stress = product(constitutive, eta) - forces.append(sum_arrays((product(B.T, nonlinear_stress), - product(H.T, linear_stress), - product(H.T, nonlinear_stress)))) - weights.append(weight) - if tangent: - materials.append(sum_arrays((product(product(B.T, constitutive), H), - product(product(H.T, constitutive), B), - product(product(H.T, constitutive), H)))) - stress = sum_arrays((linear_stress, nonlinear_stress)) - geometrics.append(sum_arrays((stress[0] * np.outer(G[0], G[0]), - stress[1] * np.outer(G[1], G[1]), - stress[2] * np.outer(G[0], G[1]), - stress[2] * np.outer(G[1], G[0])))) - if forces: - force = weighted_sum(forces, weights) - if tangent and materials: - material = weighted_sum(materials, weights) - geometric = weighted_sum(geometrics, weights) - return (product(transform.T, force), product(product(transform.T, material), transform), - product(product(transform.T, geometric), transform)) - - -def elastic_increment_reference(u_elem, geometry, constitutive_factory, tangent): - """Reference (numpy-level) elastic von-Karman increment; see vectorized_nonlinear.""" - return _increment(u_elem, geometry, constitutive_factory, tangent, False) - - -def elastic_increment(u_elem, geometry, constitutive_factory, tangent): - """The same increment with the compiled kernel tried after the coefficient evaluation.""" - return _increment(u_elem, geometry, constitutive_factory, tangent, True) - - -def _fused_array(value, shape_tail): - """Writable C float64 array of exactly ``1 + len(shape_tail)`` dims, or ``None``.""" - if (type(value) is not np.ndarray or value.dtype != np.float64 - or value.ndim != len(shape_tail) + 1 or value.shape[1:] != shape_tail): - return None - if value.flags.c_contiguous and value.flags.writeable: - return value - return np.array(value, dtype=np.float64, order="C") - - -# Exact mapping types the qualified route supplies (frozen geometry is a mappingproxy). -_GEOMETRY_TYPES = (dict, _MappingProxyType) - - -def _fused_matrix(value, shape): - """Writable C float64 copy-or-view of an exact ndarray with exactly ``shape``, or ``None``.""" - if type(value) is not np.ndarray or value.dtype != np.float64 or value.shape != shape: - return None - if value.flags.c_contiguous and value.flags.writeable: - return value - return np.array(value, dtype=np.float64, order="C") - - -def _fused_scalar(value): - if type(value) in (float, np.float64): - return float(value) - return None - - -def _fused_policy_allows(): - """Fused kernels run only under numpy's default-or-ignore floating-point policy. - - The reference performs plain numpy multiplies (e.g. ``drill * bd``) for which - numpy may warn, raise or call back on underflow; the compiled multiplies - cannot. Overflow/invalid always make the kernel refuse (the nonfinite value - reaches a compensated product or sum), so the reference replays and reports - them itself. Any other policy runs the reference. - """ - if not (_USE_NATIVE and _USE_FUSED): - return False - policy = np.geterr() - return (policy["under"] == "ignore" - and all(policy[kind] in ("ignore", "warn") for kind in ("over", "divide", "invalid"))) - - -def _zero_tangent_args(geometry, membrane, bending, shear, drill): - """Kernel arguments for ``shell_zero_tangent``, or ``None`` for any non-conforming input.""" - try: - if type(geometry) not in _GEOMETRY_TYPES: - return None - t0 = geometry["T0"] - n = t0.shape[0] if type(t0) is np.ndarray and t0.ndim == 2 else -1 - if n <= 0: - return None - arrays = (_fused_array(geometry["B_m_all"], (3, n)), _fused_array(geometry["B_b_all"], (3, n)), - _fused_array(geometry["B_d_all"], (1, n)), _fused_array(geometry["detw_all"], ()), - _fused_array(geometry["B_s_all"], (2, n)), _fused_array(geometry["detw_shear_all"], ()), - _fused_matrix(t0, (n, n)), _fused_matrix(membrane, (3, 3)), - _fused_matrix(bending, (3, 3)), _fused_matrix(shear, (2, 2))) - drill_value = _fused_scalar(drill) - if (drill_value is None or any(a is None for a in arrays) - or not len(arrays[0]) == len(arrays[1]) == len(arrays[2]) == len(arrays[3]) - or len(arrays[4]) != len(arrays[5]) or len(arrays[0]) + len(arrays[4]) == 0): - return None - return (arrays[0], arrays[1], arrays[2], arrays[3], arrays[4], arrays[5], - arrays[6], arrays[7], arrays[8], arrays[9], drill_value) - except Exception: # noqa: BLE001 - anything unexpected is the reference's to report - return None - - -def _zero_tangent_fused(geometry, membrane, bending, shear, drill): - """Run the compiled kernel; ``None`` when not applicable or refused.""" - args = _zero_tangent_args(geometry, membrane, bending, shear, drill) - if args is None: - return None - out = np.empty((args[6].shape[0],) * 2, dtype=np.float64) - if _native.fused_shell_zero_tangent(*args, out, _native.POW2) != 0: - return None - return out - - -def shell_zero_tangent(geometry, membrane, bending, shear, drill): - """Contract independently supplied elastic coefficients on frozen geometry. - - One compiled call per element when the inputs have the expected float64 - layout; anything else, or any refusal, runs the reference implementation. - """ - if _fused_policy_allows(): - fused = _zero_tangent_fused(geometry, membrane, bending, shear, drill) - if fused is not None: - return fused - return _shell_zero_tangent_reference(geometry, membrane, bending, shear, drill) - - -def _increment_fused(transform, u, geometry, constitutive, tangent): - """Run the compiled increment kernel on the already computed ``u``; ``None`` if not applicable.""" - try: - if type(geometry) not in _GEOMETRY_TYPES or type(tangent) is not bool: - return None - n = transform.shape[0] if type(transform) is np.ndarray and transform.ndim == 2 else -1 - if n <= 0: - return None - arrays = (_fused_matrix(transform, (n, n)), _fused_matrix(u, (n,)), - _fused_matrix(constitutive, (3, 3)), _fused_array(geometry["B_m_all"], (3, n)), - _fused_array(geometry["Gw_all"], (2, n)), _fused_array(geometry["detw_all"], ())) - if (any(a is None for a in arrays) - or not len(arrays[3]) == len(arrays[4]) == len(arrays[5]) > 0): - return None - except Exception: # noqa: BLE001 - anything unexpected is the reference's to report - return None - force = np.empty(n, dtype=np.float64) - material = np.zeros((n, n), dtype=np.float64) - geometric = np.zeros((n, n), dtype=np.float64) - if _native.fused_elastic_increment( - arrays[0], arrays[1], arrays[2], arrays[3], arrays[4], arrays[5], tangent, - force, material, geometric, _native.POW2, 2.0) != 0: - return None - return force, material, geometric - - -def _native_known_answers_match(): - """Disable the compiled kernels unless they reproduce the numpy path bitwise.""" - global _USE_NATIVE - if not _USE_NATIVE: - return - rng = np.random.default_rng(20261022) - a = rng.standard_normal((7, 9)) * 2.0 ** rng.integers(-40, 40, (7, 9)) - b = rng.standard_normal((9, 6)) * 2.0 ** rng.integers(-40, 40, (9, 6)) - stack = rng.standard_normal((5, 11)) * 2.0 ** rng.integers(-40, 40, (5, 11)) * 1e8 - stack[1] = -stack[0] * (1.0 + 2.0 ** -40) - weights = rng.standard_normal(5) - results = [] - for use in (True, False): - _USE_NATIVE = use - try: - results.append((product(a, b).tobytes(), sum_arrays(list(stack)).tobytes(), - weighted_sum(list(stack), weights).tobytes())) - except Exception: # noqa: BLE001 - any failure disables the kernels - results.append(None) - _USE_NATIVE = results[0] is not None and results[0] == results[1] - - -_native_known_answers_match() - - -def _fused_cases(): - """Deterministic known-answer inputs (also exercised by the tests).""" - rng = np.random.default_rng(20261023) - for case in range(3): - n, ng, ns = 24, 4, 4 - scale = (1.0, 2.0 ** 20, 2.0 ** -30)[case] - - def rnd(*shape): - return rng.standard_normal(shape) * 2.0 ** rng.integers(-3, 4, shape) * scale - - geometry = {"B_m_all": rnd(ng, 3, n), "B_b_all": rnd(ng, 3, n), "B_d_all": rnd(ng, 1, n), - "Gw_all": rnd(ng, 2, n), "B_s_all": rnd(ns, 2, n), "T0": rnd(n, n), - "detw_all": np.abs(rnd(ng)) + 0.1, "detw_shear_all": np.abs(rnd(ns)) + 0.1} - yield (geometry, rnd(3, 3), rnd(3, 3), rnd(2, 2), float(rnd(1)[0]), - rnd(n) * 1e-2, rnd(3, 3) * 1e3) - # Squares where libm pow differs from x * x: for identity-like Gw rows theta - # equals u exactly, so the kernel's scalar square is exercised on them. - hits = [float(v) for v in np.random.default_rng(7).uniform(1.0, 2.0, 60000) - if np.float64(v) ** 2 != v * v][:4] - n = 6 - geometry = {"B_m_all": np.ones((1, 3, n)), "B_b_all": np.ones((1, 3, n)), "B_d_all": np.ones((1, 1, n)), - "Gw_all": np.zeros((1, 2, n)), "B_s_all": np.ones((1, 2, n)), "T0": np.eye(n), - "detw_all": np.ones(1), "detw_shear_all": np.ones(1)} - geometry["Gw_all"][0, 0, 0] = geometry["Gw_all"][0, 1, 1] = 1.0 - for x in hits or [1.5]: - u = np.zeros(n) - u[0], u[1] = x, x - yield geometry, np.eye(3), np.eye(3), np.eye(2), 0.5, u, np.eye(3) * 1e3 - - -def _fused_check(zero_kernel, increment_kernel): - """True iff the given compiled kernels reproduce the reference bitwise *and run*. - - Calls the kernels directly (never the fallback-capable wrappers), so a - kernel that always refuses fails the check. - """ - try: - for geometry, membrane, bending, shear, drill, u_elem, constitutive in _fused_cases(): - args = _zero_tangent_args(geometry, membrane, bending, shear, drill) - if args is None: - return False - out = np.empty((args[6].shape[0],) * 2) - if zero_kernel(*args, out, _native.POW2) != 0: - return False - if out.tobytes() != _shell_zero_tangent_reference( - geometry, membrane, bending, shear, drill).tobytes(): - return False - u = product(geometry["T0"], u_elem) - for tangent in (True, False): - n = geometry["T0"].shape[0] - f, m, g = np.empty(n), np.zeros((n, n)), np.zeros((n, n)) - if increment_kernel(geometry["T0"], u, constitutive, geometry["B_m_all"], - geometry["Gw_all"], geometry["detw_all"], tangent, - f, m, g, _native.POW2, 2.0) != 0: - return False - ref = elastic_increment_reference(u_elem, geometry, lambda: constitutive, tangent) - if any(x.tobytes() != y.tobytes() for x, y in zip((f, m, g), ref)): - return False - return True - except Exception: # noqa: BLE001 - any failure disables the fused kernels - return False - - -def _fused_known_answers_match(): - """Disable the fused element kernels unless they reproduce the reference bitwise.""" - global _USE_FUSED - if not _USE_FUSED: - return - with np.errstate(all="ignore"): - _USE_FUSED = _fused_check(_native.fused_shell_zero_tangent, _native.fused_elastic_increment) - - -_fused_known_answers_match() +"""Finite, fixed-order element-local contractions (no BLAS dispatch). + +Products are split on normalized binary64 mantissas with Dekker's transform; +both parts are accumulated with ``math.fsum`` in ascending index order. +No exact-rounding claim is made: scaling a residual into the subnormal range +can lose at most one minimum subnormal per product, and fsum has its documented +platform double-rounding limitation. Exact cancellation/empty sums give +0. +Nonfinite inputs and overflowing individual products or sums are refused, +even when a wider exact accumulator could cancel an intermediate overflow. +There is no precision option, persistent result cache or fallback that changes +a value. Optional compiled kernels (``_compensated_native``, Numba) execute the +same arithmetic bit for bit; they are enabled only when Numba is present and a +known-answer self-check at import reproduces the numpy path bitwise (it guards +against fused multiply-add contraction). Any refusal replays the numpy path so +the reference exception is raised. +""" +from math import frexp as _frexp, fsum as _fsum, isfinite as _isfinite, ldexp as _ldexp + +import os +from types import MappingProxyType as _MappingProxyType + +import numpy as np + +from . import _compensated_native as _native + +# Compiled kernels run the identical arithmetic (see _compensated_native); a +# nonzero kernel status replays the vectorised path, which raises the reference +# exception. ANYSOLVER_NATIVE_CONTRACTIONS=0 forces the numpy path. +_USE_NATIVE = _native.AVAILABLE and os.environ.get("ANYSOLVER_NATIVE_CONTRACTIONS", "1") != "0" +# The fused element kernels additionally need their own known-answer match +# (checked at import below); ANYSOLVER_NATIVE_CONTRACTIONS=0 disables both. +_USE_FUSED = _USE_NATIVE + + +def _product_parts(a, b): + if not _isfinite(a) or not _isfinite(b): + raise ValueError("compensated contraction requires finite inputs") + product = a * b + if not _isfinite(product): + raise OverflowError("compensated product overflow") + if a == 0.0 or b == 0.0: + return product, 0.0 + x, ex = _frexp(a) + y, ey = _frexp(b) + split = 134217729.0 + cx, cy = split * x, split * y + xh, yh = cx - (cx - x), cy - (cy - y) + xl, yl = x - xh, y - yh + high = x * y + low = ((xh * yh - high) + xh * yl + xl * yh) + xl * yl + # In the normal range power-of-two scaling is exact. In the subnormal + # range the rounded product need not equal a doubly rounded scaled high; + # the contract allows that lost half-ulp and scaled-low rounding (<= one + # minimum subnormal together), rather than claiming an exact expansion. + return product, _ldexp(low, ex + ey) + + +_SPLIT = 134217729.0 + + +def _vector_parts(a, b): + """Elementwise ``_product_parts`` for finite broadcastable arrays. + + Same IEEE operations in the same order as the scalar routine, so the + (product, residual) pairs are bitwise identical. Refuses nonfinite inputs + and overflowing products with the scalar routine's exceptions. + """ + with np.errstate(all="ignore"): + product = a * b + if not (np.all(np.isfinite(a)) and np.all(np.isfinite(b)) + and np.all(np.isfinite(product))): + # Rare error path: reproduce the scalar first-failure semantics. + for x, y in zip(np.broadcast_to(a, product.shape).ravel().tolist(), + np.broadcast_to(b, product.shape).ravel().tolist()): + _product_parts(x, y) + x, ex = np.frexp(a) + y, ey = np.frexp(b) + cx, cy = _SPLIT * x, _SPLIT * y + xh, yh = cx - (cx - x), cy - (cy - y) + xl, yl = x - xh, y - yh + high = x * y + low = ((xh * yh - high) + xh * yl + xl * yh) + xl * yl + low = np.ldexp(low, ex + ey) + low = np.where((a == 0.0) | (b == 0.0), 0.0, low) + return product, low + + +def _interleave_sum(product, low): + """fsum of ``[p0, l0, p1, l1, ...]`` along the last axis, as the scalar dot.""" + lead = product.shape[:-1] + count = product.shape[-1] + parts = np.empty((product.size // max(count, 1), 2 * count), dtype=float) + parts[:, 0::2] = product.reshape(-1, count) + parts[:, 1::2] = low.reshape(-1, count) + values = np.array(list(map(_fsum, parts.tolist())), dtype=float) + if not np.all(np.isfinite(values)): + raise OverflowError("compensated sum overflow") + return values.reshape(lead) + + +def dot(left, right): + if len(left) != len(right): + raise ValueError("compensated dot shape mismatch") + a = np.array([float(v) for v in left], dtype=float) + b = np.array([float(v) for v in right], dtype=float) + if a.size == 0: + return 0.0 + product, low = _vector_parts(a, b) + return float(_interleave_sum(product, low)) + + +def product(left, right): + """Matrix/matrix or matrix/vector product; each dot uses the same policy.""" + a, b = np.asarray(left, dtype=float), np.asarray(right, dtype=float) + if a.ndim != 2 or b.ndim not in (1, 2) or a.shape[1] != b.shape[0]: + raise ValueError("compensated product shape mismatch") + vector = b.ndim == 1 + columns = b.reshape((-1, 1)) if vector else b + if _USE_NATIVE: + # The kernel refuses nonfinite input itself; any refusal falls through + # to the checks below, which raise the reference exception. + native = np.empty((a.shape[0], columns.shape[1]), dtype=float) + if _native.contract_product(np.ascontiguousarray(a), np.ascontiguousarray(columns), + native, _native.POW2) == 0: + return native[:, 0] if vector else native + if not np.all(np.isfinite(a)) or not np.all(np.isfinite(b)): + raise ValueError("compensated product requires finite inputs") + result = np.zeros((a.shape[0], columns.shape[1]), dtype=float) + # Terms with an all-zero operand slice are exact zeros in every dot and + # cannot change an exactly rounded sum. + keep = np.any(a != 0.0, axis=0) & np.any(columns != 0.0, axis=1) + # Overflow in a pruned term would still be refused by the scalar policy + # only if both factors were nonzero, so pruning never hides an error. + if keep.any(): + a, columns = a[:, keep], columns[keep] + prod, low = _vector_parts(a[:, None, :], columns.T[None, :, :]) + result = _interleave_sum(prod, low) + return result[:, 0] if vector else result + + +def sum_arrays(terms): + """Fixed-order componentwise sum of already represented equal-shape terms.""" + arrays = [np.asarray(term, dtype=float) for term in terms] + if not arrays or any(a.shape != arrays[0].shape for a in arrays): + raise ValueError("compensated array sum requires equal nonempty shapes") + shape = arrays[0].shape + if _USE_NATIVE: + # contract_sum refuses overflow only; nonfinite input is screened here + # on the single stacked array instead of once per term. + stack = np.ascontiguousarray(np.stack(arrays).reshape(len(arrays), -1)) + if np.isfinite(stack).all(): + native = np.empty(stack.shape[1], dtype=float) + if _native.contract_sum(stack, native) == 0: + return native.reshape(shape) + if any(not np.all(np.isfinite(a)) for a in arrays): + raise ValueError("compensated array sum requires finite inputs") + rows = np.stack(arrays).reshape(len(arrays), -1).T.tolist() + result = np.array(list(map(_fsum, rows)), dtype=float).reshape(shape) + if not np.all(np.isfinite(result)): + raise OverflowError("compensated array sum overflow") + return result + + +def weighted_sum(terms, weights): + """Quadrature reduction including compensation of each weight product.""" + arrays = [np.asarray(term, dtype=float) for term in terms] + if not arrays or len(arrays) != len(weights) or any(a.shape != arrays[0].shape for a in arrays): + raise ValueError("compensated weighted sum shape mismatch") + shape = arrays[0].shape + try: + if _USE_NATIVE: + flat = np.ascontiguousarray(np.stack(arrays).reshape(len(arrays), -1)) + w = np.array([float(v) for v in weights], dtype=float) + native = np.empty(flat.shape[1], dtype=float) + if _native.contract_weighted(flat, w, native, _native.POW2) == 0: + return native.reshape(shape) + stacked = np.stack(arrays).reshape(len(arrays), -1).T + w = np.array([float(v) for v in weights], dtype=float) + prod, low = _vector_parts(stacked, w[None, :]) + return _interleave_sum(prod, low).reshape(shape) + except (ValueError, OverflowError): + # Refused input: replay index by index so the first failure (and its + # exception type) is the one the scalar policy reports. + result = np.empty(shape, dtype=float) + for index in np.ndindex(shape): + result[index] = _scalar_dot([a[index] for a in arrays], weights) + return result + + +def _scalar_dot(left, right): + parts = [] + for a, b in zip(left, right): + parts.extend(_product_parts(float(a), float(b))) + result = _fsum(parts) + if not _isfinite(result): + raise OverflowError("compensated sum overflow") + return result + + +def _shell_zero_tangent_reference(geometry, membrane, bending, shear, drill): + """Contract independently supplied elastic coefficients on frozen geometry.""" + terms, weights = [], [] + for bm, bb, bd, weight in zip(geometry["B_m_all"], geometry["B_b_all"], + geometry["B_d_all"], geometry["detw_all"]): + terms.append(sum_arrays((product(product(bm.T, membrane), bm), + product(product(bb.T, bending), bb), + product(bd.T, drill * bd)))) + weights.append(weight) + for bs, weight in zip(geometry["B_s_all"], geometry["detw_shear_all"]): + terms.append(product(product(bs.T, shear), bs)) + weights.append(weight) + local = weighted_sum(terms, weights) + transform = geometry["T0"] + return product(product(transform.T, local), transform) + + +def _increment(u_elem, geometry, constitutive_factory, tangent, use_kernel): + """Elastic von-Karman increment: the reference evaluation order, optionally fused. + + Order (identical for both routes): read ``T0``; the displacement product + (its result ``u`` is computed once and reused); one coefficient evaluation; + only then, at the moment of choosing, the numpy error policy is read and the + compiled kernel is tried with ``u`` and the cached coefficients. A policy + that is not default-or-ignore, non-conforming input or any kernel refusal + falls through to the reference loop below with the same ``u``/coefficients. + """ + transform = geometry["T0"] + u = product(transform, u_elem) + constitutive = constitutive_factory() + if use_kernel and _fused_policy_allows(): + fused = _increment_fused(transform, u, geometry, constitutive, tangent) + if fused is not None: + return fused + force = np.zeros(u.size, dtype=float) + material = np.zeros((u.size, u.size), dtype=float) + geometric = np.zeros((u.size, u.size), dtype=float) + forces, materials, geometrics = [], [], [] + weights = [] + for B, G, weight in zip(geometry["B_m_all"], geometry["Gw_all"], + geometry["detw_all"]): + theta = product(G, u) + eta = np.array((0.5 * theta[0]**2, 0.5 * theta[1]**2, + theta[0] * theta[1]), dtype=float) + H = np.vstack((theta[0] * G[0], theta[1] * G[1], + theta[0] * G[1] + theta[1] * G[0])) + linear_stress = product(constitutive, product(B, u)) + nonlinear_stress = product(constitutive, eta) + forces.append(sum_arrays((product(B.T, nonlinear_stress), + product(H.T, linear_stress), + product(H.T, nonlinear_stress)))) + weights.append(weight) + if tangent: + materials.append(sum_arrays((product(product(B.T, constitutive), H), + product(product(H.T, constitutive), B), + product(product(H.T, constitutive), H)))) + stress = sum_arrays((linear_stress, nonlinear_stress)) + geometrics.append(sum_arrays((stress[0] * np.outer(G[0], G[0]), + stress[1] * np.outer(G[1], G[1]), + stress[2] * np.outer(G[0], G[1]), + stress[2] * np.outer(G[1], G[0])))) + if forces: + force = weighted_sum(forces, weights) + if tangent and materials: + material = weighted_sum(materials, weights) + geometric = weighted_sum(geometrics, weights) + return (product(transform.T, force), product(product(transform.T, material), transform), + product(product(transform.T, geometric), transform)) + + +def elastic_increment_reference(u_elem, geometry, constitutive_factory, tangent): + """Reference (numpy-level) elastic von-Karman increment; see vectorized_nonlinear.""" + return _increment(u_elem, geometry, constitutive_factory, tangent, False) + + +def elastic_increment(u_elem, geometry, constitutive_factory, tangent): + """The same increment with the compiled kernel tried after the coefficient evaluation.""" + return _increment(u_elem, geometry, constitutive_factory, tangent, True) + + +def _fused_array(value, shape_tail): + """Writable C float64 array of exactly ``1 + len(shape_tail)`` dims, or ``None``.""" + if (type(value) is not np.ndarray or value.dtype != np.float64 + or value.ndim != len(shape_tail) + 1 or value.shape[1:] != shape_tail): + return None + if value.flags.c_contiguous and value.flags.writeable: + return value + return np.array(value, dtype=np.float64, order="C") + + +# Exact mapping types the qualified route supplies (frozen geometry is a mappingproxy). +_GEOMETRY_TYPES = (dict, _MappingProxyType) + + +def _fused_matrix(value, shape): + """Writable C float64 copy-or-view of an exact ndarray with exactly ``shape``, or ``None``.""" + if type(value) is not np.ndarray or value.dtype != np.float64 or value.shape != shape: + return None + if value.flags.c_contiguous and value.flags.writeable: + return value + return np.array(value, dtype=np.float64, order="C") + + +def _fused_scalar(value): + if type(value) in (float, np.float64): + return float(value) + return None + + +def _fused_policy_allows(): + """Fused kernels run only under numpy's default-or-ignore floating-point policy. + + The reference performs plain numpy multiplies (e.g. ``drill * bd``) for which + numpy may warn, raise or call back on underflow; the compiled multiplies + cannot. Overflow/invalid always make the kernel refuse (the nonfinite value + reaches a compensated product or sum), so the reference replays and reports + them itself. Any other policy runs the reference. + """ + if not (_USE_NATIVE and _USE_FUSED): + return False + policy = np.geterr() + return (policy["under"] == "ignore" + and all(policy[kind] in ("ignore", "warn") for kind in ("over", "divide", "invalid"))) + + +def _zero_tangent_args(geometry, membrane, bending, shear, drill): + """Kernel arguments for ``shell_zero_tangent``, or ``None`` for any non-conforming input.""" + try: + if type(geometry) not in _GEOMETRY_TYPES: + return None + t0 = geometry["T0"] + n = t0.shape[0] if type(t0) is np.ndarray and t0.ndim == 2 else -1 + if n <= 0: + return None + arrays = (_fused_array(geometry["B_m_all"], (3, n)), _fused_array(geometry["B_b_all"], (3, n)), + _fused_array(geometry["B_d_all"], (1, n)), _fused_array(geometry["detw_all"], ()), + _fused_array(geometry["B_s_all"], (2, n)), _fused_array(geometry["detw_shear_all"], ()), + _fused_matrix(t0, (n, n)), _fused_matrix(membrane, (3, 3)), + _fused_matrix(bending, (3, 3)), _fused_matrix(shear, (2, 2))) + drill_value = _fused_scalar(drill) + if (drill_value is None or any(a is None for a in arrays) + or not len(arrays[0]) == len(arrays[1]) == len(arrays[2]) == len(arrays[3]) + or len(arrays[4]) != len(arrays[5]) or len(arrays[0]) + len(arrays[4]) == 0): + return None + return (arrays[0], arrays[1], arrays[2], arrays[3], arrays[4], arrays[5], + arrays[6], arrays[7], arrays[8], arrays[9], drill_value) + except Exception: # noqa: BLE001 - anything unexpected is the reference's to report + return None + + +def _zero_tangent_fused(geometry, membrane, bending, shear, drill): + """Run the compiled kernel; ``None`` when not applicable or refused.""" + args = _zero_tangent_args(geometry, membrane, bending, shear, drill) + if args is None: + return None + out = np.empty((args[6].shape[0],) * 2, dtype=np.float64) + if _native.fused_shell_zero_tangent(*args, out, _native.POW2) != 0: + return None + return out + + +def shell_zero_tangent(geometry, membrane, bending, shear, drill): + """Contract independently supplied elastic coefficients on frozen geometry. + + One compiled call per element when the inputs have the expected float64 + layout; anything else, or any refusal, runs the reference implementation. + """ + if _fused_policy_allows(): + fused = _zero_tangent_fused(geometry, membrane, bending, shear, drill) + if fused is not None: + return fused + return _shell_zero_tangent_reference(geometry, membrane, bending, shear, drill) + + +def _increment_fused(transform, u, geometry, constitutive, tangent): + """Run the compiled increment kernel on the already computed ``u``; ``None`` if not applicable.""" + try: + if type(geometry) not in _GEOMETRY_TYPES or type(tangent) is not bool: + return None + n = transform.shape[0] if type(transform) is np.ndarray and transform.ndim == 2 else -1 + if n <= 0: + return None + arrays = (_fused_matrix(transform, (n, n)), _fused_matrix(u, (n,)), + _fused_matrix(constitutive, (3, 3)), _fused_array(geometry["B_m_all"], (3, n)), + _fused_array(geometry["Gw_all"], (2, n)), _fused_array(geometry["detw_all"], ())) + if (any(a is None for a in arrays) + or not len(arrays[3]) == len(arrays[4]) == len(arrays[5]) > 0): + return None + except Exception: # noqa: BLE001 - anything unexpected is the reference's to report + return None + force = np.empty(n, dtype=np.float64) + material = np.zeros((n, n), dtype=np.float64) + geometric = np.zeros((n, n), dtype=np.float64) + if _native.fused_elastic_increment( + arrays[0], arrays[1], arrays[2], arrays[3], arrays[4], arrays[5], tangent, + force, material, geometric, _native.POW2, 2.0) != 0: + return None + return force, material, geometric + + +def _native_known_answers_match(): + """Disable the compiled kernels unless they reproduce the numpy path bitwise.""" + global _USE_NATIVE + if not _USE_NATIVE: + return + rng = np.random.default_rng(20261022) + a = rng.standard_normal((7, 9)) * 2.0 ** rng.integers(-40, 40, (7, 9)) + b = rng.standard_normal((9, 6)) * 2.0 ** rng.integers(-40, 40, (9, 6)) + stack = rng.standard_normal((5, 11)) * 2.0 ** rng.integers(-40, 40, (5, 11)) * 1e8 + stack[1] = -stack[0] * (1.0 + 2.0 ** -40) + weights = rng.standard_normal(5) + results = [] + for use in (True, False): + _USE_NATIVE = use + try: + results.append((product(a, b).tobytes(), sum_arrays(list(stack)).tobytes(), + weighted_sum(list(stack), weights).tobytes())) + except Exception: # noqa: BLE001 - any failure disables the kernels + results.append(None) + _USE_NATIVE = results[0] is not None and results[0] == results[1] + + +_native_known_answers_match() + + +def _fused_cases(): + """Deterministic known-answer inputs (also exercised by the tests).""" + rng = np.random.default_rng(20261023) + for case in range(3): + n, ng, ns = 24, 4, 4 + scale = (1.0, 2.0 ** 20, 2.0 ** -30)[case] + + def rnd(*shape): + return rng.standard_normal(shape) * 2.0 ** rng.integers(-3, 4, shape) * scale + + geometry = {"B_m_all": rnd(ng, 3, n), "B_b_all": rnd(ng, 3, n), "B_d_all": rnd(ng, 1, n), + "Gw_all": rnd(ng, 2, n), "B_s_all": rnd(ns, 2, n), "T0": rnd(n, n), + "detw_all": np.abs(rnd(ng)) + 0.1, "detw_shear_all": np.abs(rnd(ns)) + 0.1} + yield (geometry, rnd(3, 3), rnd(3, 3), rnd(2, 2), float(rnd(1)[0]), + rnd(n) * 1e-2, rnd(3, 3) * 1e3) + # Squares where libm pow differs from x * x: for identity-like Gw rows theta + # equals u exactly, so the kernel's scalar square is exercised on them. + hits = [float(v) for v in np.random.default_rng(7).uniform(1.0, 2.0, 60000) + if np.float64(v) ** 2 != v * v][:4] + n = 6 + geometry = {"B_m_all": np.ones((1, 3, n)), "B_b_all": np.ones((1, 3, n)), "B_d_all": np.ones((1, 1, n)), + "Gw_all": np.zeros((1, 2, n)), "B_s_all": np.ones((1, 2, n)), "T0": np.eye(n), + "detw_all": np.ones(1), "detw_shear_all": np.ones(1)} + geometry["Gw_all"][0, 0, 0] = geometry["Gw_all"][0, 1, 1] = 1.0 + for x in hits or [1.5]: + u = np.zeros(n) + u[0], u[1] = x, x + yield geometry, np.eye(3), np.eye(3), np.eye(2), 0.5, u, np.eye(3) * 1e3 + + +def _fused_check(zero_kernel, increment_kernel): + """True iff the given compiled kernels reproduce the reference bitwise *and run*. + + Calls the kernels directly (never the fallback-capable wrappers), so a + kernel that always refuses fails the check. + """ + try: + for geometry, membrane, bending, shear, drill, u_elem, constitutive in _fused_cases(): + args = _zero_tangent_args(geometry, membrane, bending, shear, drill) + if args is None: + return False + out = np.empty((args[6].shape[0],) * 2) + if zero_kernel(*args, out, _native.POW2) != 0: + return False + if out.tobytes() != _shell_zero_tangent_reference( + geometry, membrane, bending, shear, drill).tobytes(): + return False + u = product(geometry["T0"], u_elem) + for tangent in (True, False): + n = geometry["T0"].shape[0] + f, m, g = np.empty(n), np.zeros((n, n)), np.zeros((n, n)) + if increment_kernel(geometry["T0"], u, constitutive, geometry["B_m_all"], + geometry["Gw_all"], geometry["detw_all"], tangent, + f, m, g, _native.POW2, 2.0) != 0: + return False + ref = elastic_increment_reference(u_elem, geometry, lambda: constitutive, tangent) + if any(x.tobytes() != y.tobytes() for x, y in zip((f, m, g), ref)): + return False + return True + except Exception: # noqa: BLE001 - any failure disables the fused kernels + return False + + +def _fused_known_answers_match(): + """Disable the fused element kernels unless they reproduce the reference bitwise.""" + global _USE_FUSED + if not _USE_FUSED: + return + with np.errstate(all="ignore"): + _USE_FUSED = _fused_check(_native.fused_shell_zero_tangent, _native.fused_elastic_increment) + + +_fused_known_answers_match() diff --git a/src/anyfesolver/_ge_beam3_dynamic_elastic_state.py b/src/anyfesolver/_ge_beam3_dynamic_elastic_state.py index 967a93509..464a45c3d 100644 --- a/src/anyfesolver/_ge_beam3_dynamic_elastic_state.py +++ b/src/anyfesolver/_ge_beam3_dynamic_elastic_state.py @@ -1,37 +1,37 @@ -"""Private single centered generalized elastic structural/material work owner. - -Admits zero supports or the reviewed full clamp without any static equilibrium -genesis inverse. No mass, velocity, time method, static-guard override or contact. -""" -from contextlib import contextmanager -from dataclasses import dataclass -import json -from threading import Lock, get_ident -from time import monotonic -import numpy as np - -from ._ge_beam3_native_analysis import NativeBeamAnalysis -from ._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement -from ._ge_beam3_retained_generalized import RetainedGeneralizedOperator -from ._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry -from ._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection -from ._ge_beam3_retained_generalized_state import Mechanical -from ._ge_beam3_native_generalized_restart import _history -from ._ge_beam3_native_generalized_loading import DistributedPattern -from ._ge_beam3_native_line_loading import LinePattern -from ._ge_beam3_fibre_line_work import evaluate as line_work -from ._ge_beam3_generalized_static_boundary import cell_couple_load, spatial_jacobian +"""Private single centered generalized elastic structural/material work owner. + +Admits zero supports or the reviewed full clamp without any static equilibrium +genesis inverse. No mass, velocity, time method, static-guard override or contact. +""" +from contextlib import contextmanager +from dataclasses import dataclass +import json +from threading import Lock, get_ident +from time import monotonic +import numpy as np + +from ._ge_beam3_native_analysis import NativeBeamAnalysis +from ._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement +from ._ge_beam3_retained_generalized import RetainedGeneralizedOperator +from ._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry +from ._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection +from ._ge_beam3_retained_generalized_state import Mechanical +from ._ge_beam3_native_generalized_restart import _history +from ._ge_beam3_native_generalized_loading import DistributedPattern +from ._ge_beam3_native_line_loading import LinePattern +from ._ge_beam3_fibre_line_work import evaluate as line_work +from ._ge_beam3_generalized_static_boundary import cell_couple_load, spatial_jacobian from ._ge_beam3_operator_validation_scope import operator_call from . import _ge_beam3_operator_validation_scope as _operator_validation -from ._ge_beam3_p5.arrays import _array, _frames -from ._ge_beam3_p5.algebra import rotation -from ._ge_beam3_p5.compensated_coordinates import validate_pair -from ._ge_beam3_p5_seeded.core import canonical, sha -from ._native_reference_modal import _owned -from .control import cancellation_safe_point - -IMPLEMENTATION_ID = 'DEVELOPMENT_C7_SINGLE_CENTERED_DYNAMIC_ELASTIC_STATE_V1' -PHYSICAL_DOFS = (0, 1, 2, 6, 7, 8, 12, 13, 14, 18, 19, 20, 21, 22, 23) +from ._ge_beam3_p5.arrays import _array, _frames +from ._ge_beam3_p5.algebra import rotation +from ._ge_beam3_p5.compensated_coordinates import validate_pair +from ._ge_beam3_p5_seeded.core import canonical, sha +from ._native_reference_modal import _owned +from .control import cancellation_safe_point + +IMPLEMENTATION_ID = 'DEVELOPMENT_C7_SINGLE_CENTERED_DYNAMIC_ELASTIC_STATE_V1' +PHYSICAL_DOFS = (0, 1, 2, 6, 7, 8, 12, 13, 14, 18, 19, 20, 21, 22, 23) ALGEBRAIC_DOFS = (3, 4, 5, 9, 10, 11, 15, 16, 17, *range(24, 42)) @@ -45,156 +45,156 @@ def _admit_runtime_limit(value): if not np.isfinite(duration) or not 0. < duration <= 900.: raise ValueError('positive finite native dynamic runtime limit at most900 seconds required') return duration - - -@dataclass(frozen=True) -class DynamicElasticState: - mechanical: Mechanical - origins: tuple - histories: tuple - context_sha256: str - - -@dataclass(frozen=True) -class ElasticWorkEvaluation: - state: DynamicElasticState - residual: np.ndarray - spatial_jacobian: np.ndarray - conservative_value: float - mixed_potential: float - line_work: float - applied_couple42: np.ndarray + + +@dataclass(frozen=True) +class DynamicElasticState: + mechanical: Mechanical + origins: tuple + histories: tuple + context_sha256: str + + +@dataclass(frozen=True) +class ElasticWorkEvaluation: + state: DynamicElasticState + residual: np.ndarray + spatial_jacobian: np.ndarray + conservative_value: float + mixed_potential: float + line_work: float + applied_couple42: np.ndarray material_sha256: str load_sha256: str external_load42: np.ndarray external_spatial_jacobian42: np.ndarray conservative_potential: bool - production_qualified: bool = False - - -@dataclass(frozen=True) -class AlgebraicConsistency: - state: DynamicElasticState - work: ElasticWorkEvaluation - iterations: int - backtracks: int - residual_norm: float - correction_norm: float - algebraic_rank: int - algebraic_sigma_min: float - algebraic_sigma_max: float - algebraic_condition: float - - -class AlgebraicRankError(ValueError): - def __init__(self, singular, vector42, rank): - super().__init__('fixed-physical algebraic block is singular; no temporal slice admitted') - self.singular_values = _owned(singular) - self.null_vector42 = _owned(vector42) - self.rank = int(rank) - - -class ElasticWorkSession: - """Authenticated same-thread disposable work scope; not state acceptance.""" - def __init__(self, context): - self._context = context - self._thread = get_ident() - self._active = True - self._issued = {} - - def _check(self): - context = self._context - if (not self._active or get_ident() != self._thread - or context._active_session is not self): - raise ValueError('active same-thread owner-bound elastic work session required') - context._guard() - - def make(self, mechanical): - self._check() - return self._context._make(mechanical) - - def trial_state(self, mechanical, *, origins=None): - self._check() - context = self._context - state = context._issue(mechanical, context.origins if origins is None else origins) - context._evaluate(state, None, 0.) - return state - - def evaluate(self, state, *, pattern=None, parameter=0., cancellation_token=None): - self._check() - return self._context._evaluate(state, pattern, parameter, cancellation_token) - - def work(self, mechanical, *, origins=None, pattern=None, parameter=0., cancellation_token=None): - """Issue and validate one transient evaluation without duplicate work.""" - self._check() - context = self._context - state = context._issue(mechanical, context.origins if origins is None else origins) - return context._evaluate(state, pattern, parameter, cancellation_token) - - def consistent(self, state, *, pattern=None, parameter=0., cancellation_token=None): - self._check() - return self._context._consistent(state, pattern, parameter, cancellation_token) - - -class DynamicElasticContext: - """Exact-analysis-bound immutable elastic work and algebraic consistency. - - State issuance is not time/history acceptance. The material origin is the - captured virgin elastic state; all evaluations must preserve it exactly. - """ + production_qualified: bool = False + + +@dataclass(frozen=True) +class AlgebraicConsistency: + state: DynamicElasticState + work: ElasticWorkEvaluation + iterations: int + backtracks: int + residual_norm: float + correction_norm: float + algebraic_rank: int + algebraic_sigma_min: float + algebraic_sigma_max: float + algebraic_condition: float + + +class AlgebraicRankError(ValueError): + def __init__(self, singular, vector42, rank): + super().__init__('fixed-physical algebraic block is singular; no temporal slice admitted') + self.singular_values = _owned(singular) + self.null_vector42 = _owned(vector42) + self.rank = int(rank) + + +class ElasticWorkSession: + """Authenticated same-thread disposable work scope; not state acceptance.""" + def __init__(self, context): + self._context = context + self._thread = get_ident() + self._active = True + self._issued = {} + + def _check(self): + context = self._context + if (not self._active or get_ident() != self._thread + or context._active_session is not self): + raise ValueError('active same-thread owner-bound elastic work session required') + context._guard() + + def make(self, mechanical): + self._check() + return self._context._make(mechanical) + + def trial_state(self, mechanical, *, origins=None): + self._check() + context = self._context + state = context._issue(mechanical, context.origins if origins is None else origins) + context._evaluate(state, None, 0.) + return state + + def evaluate(self, state, *, pattern=None, parameter=0., cancellation_token=None): + self._check() + return self._context._evaluate(state, pattern, parameter, cancellation_token) + + def work(self, mechanical, *, origins=None, pattern=None, parameter=0., cancellation_token=None): + """Issue and validate one transient evaluation without duplicate work.""" + self._check() + context = self._context + state = context._issue(mechanical, context.origins if origins is None else origins) + return context._evaluate(state, pattern, parameter, cancellation_token) + + def consistent(self, state, *, pattern=None, parameter=0., cancellation_token=None): + self._check() + return self._context._consistent(state, pattern, parameter, cancellation_token) + + +class DynamicElasticContext: + """Exact-analysis-bound immutable elastic work and algebraic consistency. + + State issuance is not time/history acceptance. The material origin is the + captured virgin elastic state; all evaluations must preserve it exactly. + """ def __init__(self, analysis, *, max_iterations=12, max_backtracks=8, runtime_limit_seconds=120.): - if type(analysis) is not NativeBeamAnalysis: - raise ValueError('exact standalone native analysis required') - if (type(max_iterations) is not int or not 1 <= max_iterations <= 12 - or type(max_backtracks) is not int or not 0 <= max_backtracks <= 8): - raise ValueError('bounded exact elastic consistency settings') + if type(analysis) is not NativeBeamAnalysis: + raise ValueError('exact standalone native analysis required') + if (type(max_iterations) is not int or not 1 <= max_iterations <= 12 + or type(max_backtracks) is not int or not 0 <= max_backtracks <= 8): + raise ValueError('bounded exact elastic consistency settings') duration = _admit_runtime_limit(runtime_limit_seconds) with analysis._operation(): - elements = analysis._elements - nodes = tuple(sorted(analysis.model.mesh.nodes)) - if (len(elements) != 1 or type(elements[0]) is not NativeGeneralizedStaticElement - or type(elements[0].operator) is not RetainedGeneralizedOperator - or type(elements[0].section) is not EllipsoidalGeneralizedSection - or type(elements[0].operator.reference) is not CenteredCurvedBeam3ReferenceGeometry - or len(nodes) != 3 or analysis.model.mesh.dof_manager.total_dofs != 18 - or elements[0].node_ids != nodes - or tuple(elements[0].get_dof_mapping(analysis.model.mesh)) != tuple(range(18))): - raise ValueError('exact one centered generalized element/canonical full42 order required') - fixed = analysis._admit_boundaries() - if fixed not in ((), tuple(range(6))): - raise ValueError('zero supports or homogeneous first-node full clamp required') - self.analysis = analysis - self.element = elements[0] - self.fixed = fixed - self.free = tuple(i for i in range(42) if i not in fixed) - self.physical_free = tuple(i for i in PHYSICAL_DOFS if i in self.free) - self.algebraic_free = tuple(i for i in ALGEBRAIC_DOFS if i in self.free) - self.reference_positions = _owned(self.element.operator.reference.coordinates) - self.reference_frames = _owned(self.element.operator.reference.nodal_triads) - self.origins = (self.element.operator.cell.virgin(),) - self.max_iterations, self.max_backtracks = max_iterations, max_backtracks + elements = analysis._elements + nodes = tuple(sorted(analysis.model.mesh.nodes)) + if (len(elements) != 1 or type(elements[0]) is not NativeGeneralizedStaticElement + or type(elements[0].operator) is not RetainedGeneralizedOperator + or type(elements[0].section) is not EllipsoidalGeneralizedSection + or type(elements[0].operator.reference) is not CenteredCurvedBeam3ReferenceGeometry + or len(nodes) != 3 or analysis.model.mesh.dof_manager.total_dofs != 18 + or elements[0].node_ids != nodes + or tuple(elements[0].get_dof_mapping(analysis.model.mesh)) != tuple(range(18))): + raise ValueError('exact one centered generalized element/canonical full42 order required') + fixed = analysis._admit_boundaries() + if fixed not in ((), tuple(range(6))): + raise ValueError('zero supports or homogeneous first-node full clamp required') + self.analysis = analysis + self.element = elements[0] + self.fixed = fixed + self.free = tuple(i for i in range(42) if i not in fixed) + self.physical_free = tuple(i for i in PHYSICAL_DOFS if i in self.free) + self.algebraic_free = tuple(i for i in ALGEBRAIC_DOFS if i in self.free) + self.reference_positions = _owned(self.element.operator.reference.coordinates) + self.reference_frames = _owned(self.element.operator.reference.nodal_triads) + self.origins = (self.element.operator.cell.virgin(),) + self.max_iterations, self.max_backtracks = max_iterations, max_backtracks self.started = monotonic() self._captured_started = self.started self.runtime_limit_seconds = duration self._captured_runtime_limit = duration - self._identity = sha(self._definition()) - self._issued = {} - self._lock = Lock() - self._active_session = None - mechanical = self._make(dict(positions=self.reference_positions, - position_low=np.zeros((3, 3)), nodal_frames=self.reference_frames, - cell_rotations=np.tile(np.eye(3), (1, 2, 1, 1)), resultants=np.zeros((1, 18)))) - state = DynamicElasticState(mechanical, self.origins, self.origins, self._identity) - self._reference = state - self._issued[id(state)] = (state, canonical(state)) - - def _definition(self): + self._identity = sha(self._definition()) + self._issued = {} + self._lock = Lock() + self._active_session = None + mechanical = self._make(dict(positions=self.reference_positions, + position_low=np.zeros((3, 3)), nodal_frames=self.reference_frames, + cell_rotations=np.tile(np.eye(3), (1, 2, 1, 1)), resultants=np.zeros((1, 18)))) + state = DynamicElasticState(mechanical, self.origins, self.origins, self._identity) + self._reference = state + self._issued[id(state)] = (state, canonical(state)) + + def _definition(self): data = dict(implementation=IMPLEMENTATION_ID, analysis=self.analysis.identity, - element=self.element.identity, operator=self.element.operator.identity, - fixed=self.fixed, free=self.free, physical=self.physical_free, - algebraic=self.algebraic_free, reference_positions=self.reference_positions, - reference_frames=self.reference_frames, origins=self.origins, + element=self.element.identity, operator=self.element.operator.identity, + fixed=self.fixed, free=self.free, physical=self.physical_free, + algebraic=self.algebraic_free, reference_positions=self.reference_positions, + reference_frames=self.reference_frames, origins=self.origins, iterations=self.max_iterations, backtracks=self.max_backtracks) if self.runtime_limit_seconds != 120.: data['runtime_limit_seconds'] = self.runtime_limit_seconds @@ -207,7 +207,7 @@ def _guard_runtime_limit(self): raise ValueError('dynamic elastic captured runtime/clock changed') if self.runtime_limit_seconds != 120. and _operator_validation._ACTIVE.get() is not None: raise ValueError('extended dynamic runtime excludes optional operator validation scope') - + def _guard_deadline(self): self._guard_runtime_limit() if monotonic()-self._captured_started > self._captured_runtime_limit: @@ -216,141 +216,141 @@ def _guard_deadline(self): def _guard(self, token=None, stage='dynamic-elastic.guard'): cancellation_safe_point(token, stage) self._guard_deadline() - self.analysis._guard() - if (sha(self._definition()) != self._identity - or self.analysis._elements != (self.element,) - or self.analysis._admit_boundaries() != self.fixed): - raise ValueError('dynamic elastic frozen definition/supports changed') - - @contextmanager - def _operation(self): - if not self._lock.acquire(blocking=False): - raise ValueError('dynamic elastic context is already in use') - old = None - try: - try: - with self.analysis._operation(): - old = self._issued.copy() - self._guard() - yield - self._guard() - except BaseException: - if old is not None: - self._issued = old - raise - finally: - self._lock.release() - - @contextmanager - def session(self): - if not self._lock.acquire(blocking=False): - raise ValueError('dynamic elastic context is already in use') - token = None - old = None - try: - try: - with self.analysis._operation(): - old = self._issued.copy() - self._guard() - token = ElasticWorkSession(self) - self._active_session = token - try: - yield token - token._check() - finally: - # No standalone issuance is evicted. Scoped work states - # cease to authenticate before the native exit guard. - token._active = False - token._issued.clear() - self._active_session = None - self._guard() - except BaseException: - if old is not None: - self._issued = old - raise - finally: - if token is not None: - token._active = False - token._issued.clear() - self._active_session = None - self._lock.release() - - def _make(self, data): - if type(data) is Mechanical: - data = data.descriptor() - if type(data) is not dict or set(data) != set(Mechanical.__dataclass_fields__): - raise ValueError('complete exact retained mechanical fields required') - high = _array(data['positions'], (3, 3), 'physical positions') - low = _array(data['position_low'], (3, 3), 'physical low positions') - for h, l in zip(high.flat, low.flat): - validate_pair(float(h), float(l)) - nodal = _frames(data['nodal_frames'], 3, 'algebraic nodal frames') - cells = np.asarray(data['cell_rotations']) - if cells.shape != (1, 2, 3, 3): - raise ValueError('exact one-element physical cell frames') - cells = _frames(cells.reshape(2, 3, 3), 2, 'physical cell frames').reshape(1, 2, 3, 3) - resultants = _array(data['resultants'], (1, 18), 'algebraic resultants') - for dof in self.fixed: - node, axis = divmod(dof, 6) - if axis < 3: - if high[node, axis] != self.reference_positions[node, axis] or low[node, axis] != 0.: - raise ValueError('prescribed physical translation changed') - elif not np.array_equal(nodal[node], self.reference_frames[node]): - raise ValueError('prescribed algebraic frame changed') - return Mechanical(*map(_owned, (high, low, nodal, cells, resultants))) - - def _origins(self, origins): - if type(origins) is not tuple or len(origins) != 1: - raise ValueError('complete one-element material origins required') - validated = (_history(json.loads(canonical(origins[0])), self.element),) - if canonical(validated) != canonical(self.origins): - raise ValueError('first dynamic elastic slice requires captured virgin origins') - return validated - - def _require(self, state): - record = self._issued.get(id(state)) - if record is None and self._active_session is not None: - self._active_session._check() - record = self._active_session._issued.get(id(state)) - if (type(state) is not DynamicElasticState or record is None or record[0] is not state - or state.context_sha256 != self._identity or canonical(state) != record[1]): - raise ValueError('issued immutable analysis-bound elastic state required') - return state - - def _issue(self, mechanical, origins): - registry = self._issued - if self._active_session is not None: - self._active_session._check() - registry = self._active_session._issued - if len(registry) >= 128: - raise ValueError('bounded elastic trial-state capacity') - state = DynamicElasticState(self._make(mechanical), self._origins(origins), - self._origins(origins), self._identity) - registry[id(state)] = (state, canonical(state)) - return state - - def reference_state(self): - with self._operation(): - return self._require(self._reference) - - def trial_state(self, mechanical, *, origins=None): - with self._operation(): - state = self._issue(mechanical, self.origins if origins is None else origins) - self._evaluate(state, None, 0.) - return state - - def _evaluate(self, state, pattern, parameter, token=None): - self._guard(token, 'dynamic-elastic.evaluate') - self._require(state) - if pattern is None: - pattern = DistributedPattern(LinePattern(()), ()) - if type(pattern) is not DistributedPattern or type(parameter) is not float or not np.isfinite(parameter): - raise ValueError('typed finite native distributed load required') - pattern.require(self.analysis.model.mesh) - captured_load = canonical(dict(pattern=pattern, parameter=parameter)) - m = self._make(state.mechanical) - origins = self._origins(state.origins) - op = self.element.operator + self.analysis._guard() + if (sha(self._definition()) != self._identity + or self.analysis._elements != (self.element,) + or self.analysis._admit_boundaries() != self.fixed): + raise ValueError('dynamic elastic frozen definition/supports changed') + + @contextmanager + def _operation(self): + if not self._lock.acquire(blocking=False): + raise ValueError('dynamic elastic context is already in use') + old = None + try: + try: + with self.analysis._operation(): + old = self._issued.copy() + self._guard() + yield + self._guard() + except BaseException: + if old is not None: + self._issued = old + raise + finally: + self._lock.release() + + @contextmanager + def session(self): + if not self._lock.acquire(blocking=False): + raise ValueError('dynamic elastic context is already in use') + token = None + old = None + try: + try: + with self.analysis._operation(): + old = self._issued.copy() + self._guard() + token = ElasticWorkSession(self) + self._active_session = token + try: + yield token + token._check() + finally: + # No standalone issuance is evicted. Scoped work states + # cease to authenticate before the native exit guard. + token._active = False + token._issued.clear() + self._active_session = None + self._guard() + except BaseException: + if old is not None: + self._issued = old + raise + finally: + if token is not None: + token._active = False + token._issued.clear() + self._active_session = None + self._lock.release() + + def _make(self, data): + if type(data) is Mechanical: + data = data.descriptor() + if type(data) is not dict or set(data) != set(Mechanical.__dataclass_fields__): + raise ValueError('complete exact retained mechanical fields required') + high = _array(data['positions'], (3, 3), 'physical positions') + low = _array(data['position_low'], (3, 3), 'physical low positions') + for h, l in zip(high.flat, low.flat): + validate_pair(float(h), float(l)) + nodal = _frames(data['nodal_frames'], 3, 'algebraic nodal frames') + cells = np.asarray(data['cell_rotations']) + if cells.shape != (1, 2, 3, 3): + raise ValueError('exact one-element physical cell frames') + cells = _frames(cells.reshape(2, 3, 3), 2, 'physical cell frames').reshape(1, 2, 3, 3) + resultants = _array(data['resultants'], (1, 18), 'algebraic resultants') + for dof in self.fixed: + node, axis = divmod(dof, 6) + if axis < 3: + if high[node, axis] != self.reference_positions[node, axis] or low[node, axis] != 0.: + raise ValueError('prescribed physical translation changed') + elif not np.array_equal(nodal[node], self.reference_frames[node]): + raise ValueError('prescribed algebraic frame changed') + return Mechanical(*map(_owned, (high, low, nodal, cells, resultants))) + + def _origins(self, origins): + if type(origins) is not tuple or len(origins) != 1: + raise ValueError('complete one-element material origins required') + validated = (_history(json.loads(canonical(origins[0])), self.element),) + if canonical(validated) != canonical(self.origins): + raise ValueError('first dynamic elastic slice requires captured virgin origins') + return validated + + def _require(self, state): + record = self._issued.get(id(state)) + if record is None and self._active_session is not None: + self._active_session._check() + record = self._active_session._issued.get(id(state)) + if (type(state) is not DynamicElasticState or record is None or record[0] is not state + or state.context_sha256 != self._identity or canonical(state) != record[1]): + raise ValueError('issued immutable analysis-bound elastic state required') + return state + + def _issue(self, mechanical, origins): + registry = self._issued + if self._active_session is not None: + self._active_session._check() + registry = self._active_session._issued + if len(registry) >= 128: + raise ValueError('bounded elastic trial-state capacity') + state = DynamicElasticState(self._make(mechanical), self._origins(origins), + self._origins(origins), self._identity) + registry[id(state)] = (state, canonical(state)) + return state + + def reference_state(self): + with self._operation(): + return self._require(self._reference) + + def trial_state(self, mechanical, *, origins=None): + with self._operation(): + state = self._issue(mechanical, self.origins if origins is None else origins) + self._evaluate(state, None, 0.) + return state + + def _evaluate(self, state, pattern, parameter, token=None): + self._guard(token, 'dynamic-elastic.evaluate') + self._require(state) + if pattern is None: + pattern = DistributedPattern(LinePattern(()), ()) + if type(pattern) is not DistributedPattern or type(parameter) is not float or not np.isfinite(parameter): + raise ValueError('typed finite native distributed load required') + pattern.require(self.analysis.model.mesh) + captured_load = canonical(dict(pattern=pattern, parameter=parameter)) + m = self._make(state.mechanical) + origins = self._origins(state.origins) + op = self.element.operator arguments = (m.positions, m.position_low, m.nodal_frames, m.cell_rotations[0], m.resultants[0]) if self.runtime_limit_seconds == 120.: response = operator_call(op, 'evaluate', self._guard, self.started, @@ -360,102 +360,102 @@ def _evaluate(self, state, pattern, parameter, token=None): # contract. Extended owners reject that combination in the guard and # retain the ordinary full-model callback at every operator check. response = op.evaluate(*arguments, check=self._guard, origin=origins[0]) - material = json.loads(response.material) - if (canonical(response.history) != canonical(origins[0]) - or any(row['branch'] != 'ELASTIC' - or any(v != 0. for pair in row['dissipation'] for v in pair) - for row in material['stations'])): - raise ValueError('strict elastic unchanged material histories required') - work = line_work(op.reference, m.positions, m.position_low, m.cell_rotations[0], - parameter*pattern.force(self.element.element_id), order=op.order) - conservative = response.residual-work.gradient - couple = cell_couple_load(op, parameter*pattern.density(self.element.element_id)) - residual = conservative-couple - tangent = spatial_jacobian(conservative, response.hessian+response.hessian_low-work.hessian) - self._guard(token, 'dynamic-elastic.evaluated') - if canonical(dict(pattern=pattern, parameter=parameter)) != captured_load: - raise ValueError('elastic trial load changed') + material = json.loads(response.material) + if (canonical(response.history) != canonical(origins[0]) + or any(row['branch'] != 'ELASTIC' + or any(v != 0. for pair in row['dissipation'] for v in pair) + for row in material['stations'])): + raise ValueError('strict elastic unchanged material histories required') + work = line_work(op.reference, m.positions, m.position_low, m.cell_rotations[0], + parameter*pattern.force(self.element.element_id), order=op.order) + conservative = response.residual-work.gradient + couple = cell_couple_load(op, parameter*pattern.density(self.element.element_id)) + residual = conservative-couple + tangent = spatial_jacobian(conservative, response.hessian+response.hessian_low-work.hessian) + self._guard(token, 'dynamic-elastic.evaluated') + if canonical(dict(pattern=pattern, parameter=parameter)) != captured_load: + raise ValueError('elastic trial load changed') return ElasticWorkEvaluation(state, _owned(residual), tangent, float(response.potential-work.value), float(response.potential), float(work.value), _owned(couple), sha(material), sha(json.loads(captured_load)), _owned(work.gradient+couple), spatial_jacobian(work.gradient, work.hessian), not bool(np.any(couple))) - - def evaluate(self, state, *, pattern=None, parameter=0., cancellation_token=None): - with self._operation(): - return self._evaluate(state, pattern, parameter, cancellation_token) - - def _algebraic_rank(self, tangent): - z = list(self.algebraic_free) - _, singular, vh = np.linalg.svd(tangent[np.ix_(z, z)]) - tolerance = 64*np.finfo(float).eps*len(z)*singular[0] - rank = int(np.count_nonzero(singular > tolerance)) - if rank != len(z): - null = np.zeros(42) - null[z] = vh[-1] - raise AlgebraicRankError(singular, null, rank) - return len(z), float(singular[-1]), float(singular[0]), float(singular[0]/singular[-1]) - - def algebraic_rank(self, state, *, cancellation_token=None): - with self._operation(): - work = self._evaluate(state, None, 0., cancellation_token) - rank, minimum, maximum, condition = self._algebraic_rank(work.spatial_jacobian) - return dict(rank=rank, sigma_min=minimum, sigma_max=maximum, condition=condition) - - def _algebraic_move(self, state, step): - # Physical positions and cell rotations are carried through bit-exactly. - m = state.mechanical - frames = np.array(m.nodal_frames, copy=True) - for node in range(3): - frames[node] = rotation(step[6*node+3:6*node+6])@m.nodal_frames[node] - resultants = m.resultants+step[24:].reshape(1, 18) - return self._issue(dict(positions=m.positions, position_low=m.position_low, - nodal_frames=frames, cell_rotations=m.cell_rotations, resultants=resultants), state.origins) - - def consistent(self, state, *, pattern=None, parameter=0., cancellation_token=None): - with self._operation(): - return self._consistent(state, pattern, parameter, cancellation_token) - - def _consistent(self, state, pattern, parameter, cancellation_token): - self._require(state) - z = list(self.algebraic_free) - source_positions = state.mechanical.positions - source_low = state.mechanical.position_low - source_cells = state.mechanical.cell_rotations - backtracks = 0 - length = float(np.linalg.norm(self.reference_positions[-1]-self.reference_positions[0])) - for iteration in range(self.max_iterations+1): - work = self._evaluate(state, pattern, parameter, cancellation_token) - rank, minimum, maximum, condition = self._algebraic_rank(work.spatial_jacobian) - step = np.zeros(42) - step[z] = np.linalg.solve(work.spatial_jacobian[np.ix_(z, z)], -work.residual[z]) - # Same retained row convention: nodal moment residual / length; - # axial/first-cell compatibility rows / length, remaining rows1. - scales = np.ones(42) - for node in range(3): - scales[6*node+3:6*node+6] = length - scales[18:30] = length - norm = float(np.linalg.norm((work.residual/scales)[z])) - correction = max(float(np.linalg.norm(step[[i for i in z if i < 24]])), - float(np.linalg.norm(step[24:]))/max(1., float(np.linalg.norm(state.mechanical.resultants)))) - if norm <= 1e-11 and correction <= 1e-11: - if (not np.array_equal(state.mechanical.positions, source_positions) - or not np.array_equal(state.mechanical.position_low, source_low) - or not np.array_equal(state.mechanical.cell_rotations, source_cells)): - raise ValueError('algebraic consistency changed physical coordinates') - return AlgebraicConsistency(state, work, iteration, backtracks, norm, correction, - rank, minimum, maximum, condition) - if iteration == self.max_iterations: - raise ValueError('dynamic elastic algebraic iteration limit') - for cut in range(self.max_backtracks+1): - self._guard(cancellation_token, 'dynamic-elastic.algebraic.trial') - proposed = self._algebraic_move(state, step*(2.**(-cut))) - trial = self._evaluate(proposed, pattern, parameter, cancellation_token) - trial_norm = float(np.linalg.norm((trial.residual/scales)[z])) - if trial_norm < norm: - state = proposed - backtracks += cut - break - else: - raise ValueError('dynamic elastic algebraic backtracking failed') - raise AssertionError('bounded algebraic loop') + + def evaluate(self, state, *, pattern=None, parameter=0., cancellation_token=None): + with self._operation(): + return self._evaluate(state, pattern, parameter, cancellation_token) + + def _algebraic_rank(self, tangent): + z = list(self.algebraic_free) + _, singular, vh = np.linalg.svd(tangent[np.ix_(z, z)]) + tolerance = 64*np.finfo(float).eps*len(z)*singular[0] + rank = int(np.count_nonzero(singular > tolerance)) + if rank != len(z): + null = np.zeros(42) + null[z] = vh[-1] + raise AlgebraicRankError(singular, null, rank) + return len(z), float(singular[-1]), float(singular[0]), float(singular[0]/singular[-1]) + + def algebraic_rank(self, state, *, cancellation_token=None): + with self._operation(): + work = self._evaluate(state, None, 0., cancellation_token) + rank, minimum, maximum, condition = self._algebraic_rank(work.spatial_jacobian) + return dict(rank=rank, sigma_min=minimum, sigma_max=maximum, condition=condition) + + def _algebraic_move(self, state, step): + # Physical positions and cell rotations are carried through bit-exactly. + m = state.mechanical + frames = np.array(m.nodal_frames, copy=True) + for node in range(3): + frames[node] = rotation(step[6*node+3:6*node+6])@m.nodal_frames[node] + resultants = m.resultants+step[24:].reshape(1, 18) + return self._issue(dict(positions=m.positions, position_low=m.position_low, + nodal_frames=frames, cell_rotations=m.cell_rotations, resultants=resultants), state.origins) + + def consistent(self, state, *, pattern=None, parameter=0., cancellation_token=None): + with self._operation(): + return self._consistent(state, pattern, parameter, cancellation_token) + + def _consistent(self, state, pattern, parameter, cancellation_token): + self._require(state) + z = list(self.algebraic_free) + source_positions = state.mechanical.positions + source_low = state.mechanical.position_low + source_cells = state.mechanical.cell_rotations + backtracks = 0 + length = float(np.linalg.norm(self.reference_positions[-1]-self.reference_positions[0])) + for iteration in range(self.max_iterations+1): + work = self._evaluate(state, pattern, parameter, cancellation_token) + rank, minimum, maximum, condition = self._algebraic_rank(work.spatial_jacobian) + step = np.zeros(42) + step[z] = np.linalg.solve(work.spatial_jacobian[np.ix_(z, z)], -work.residual[z]) + # Same retained row convention: nodal moment residual / length; + # axial/first-cell compatibility rows / length, remaining rows1. + scales = np.ones(42) + for node in range(3): + scales[6*node+3:6*node+6] = length + scales[18:30] = length + norm = float(np.linalg.norm((work.residual/scales)[z])) + correction = max(float(np.linalg.norm(step[[i for i in z if i < 24]])), + float(np.linalg.norm(step[24:]))/max(1., float(np.linalg.norm(state.mechanical.resultants)))) + if norm <= 1e-11 and correction <= 1e-11: + if (not np.array_equal(state.mechanical.positions, source_positions) + or not np.array_equal(state.mechanical.position_low, source_low) + or not np.array_equal(state.mechanical.cell_rotations, source_cells)): + raise ValueError('algebraic consistency changed physical coordinates') + return AlgebraicConsistency(state, work, iteration, backtracks, norm, correction, + rank, minimum, maximum, condition) + if iteration == self.max_iterations: + raise ValueError('dynamic elastic algebraic iteration limit') + for cut in range(self.max_backtracks+1): + self._guard(cancellation_token, 'dynamic-elastic.algebraic.trial') + proposed = self._algebraic_move(state, step*(2.**(-cut))) + trial = self._evaluate(proposed, pattern, parameter, cancellation_token) + trial_norm = float(np.linalg.norm((trial.residual/scales)[z])) + if trial_norm < norm: + state = proposed + backtracks += cut + break + else: + raise ValueError('dynamic elastic algebraic backtracking failed') + raise AssertionError('bounded algebraic loop') diff --git a/src/anyfesolver/_ge_beam3_fibre_cell.py b/src/anyfesolver/_ge_beam3_fibre_cell.py index 3e8914bd7..c1761a4ec 100644 --- a/src/anyfesolver/_ge_beam3_fibre_cell.py +++ b/src/anyfesolver/_ge_beam3_fibre_cell.py @@ -1,30 +1,30 @@ -"""Private simultaneous station/fibre Legendre problem for two beam cells. - -Psi*(p) = sup_x [p.L^T.x - sum_j w_j W(S_j.x; origin_j)]. -The full physical-fibre potential, not an elastic tangent substitution, is -reevaluated at fixed origin throughout the coupled solve. Not a public route. -""" -from dataclasses import dataclass -from decimal import Decimal as D, localcontext +"""Private simultaneous station/fibre Legendre problem for two beam cells. + +Psi*(p) = sup_x [p.L^T.x - sum_j w_j W(S_j.x; origin_j)]. +The full physical-fibre potential, not an elastic tangent substitution, is +reevaluated at fixed origin throughout the coupled solve. Not a public route. +""" +from dataclasses import dataclass +from decimal import Decimal as D, localcontext import hashlib from math import isfinite, nextafter, ulp -from time import monotonic - -from ._ge_beam3_fibre_section import ( - PhysicalFibreSection, FibreHistory, FibreRecovery, canonical, _scalar_pair, -) -from ._ge_beam3_station_resultant_cell import ( - zero, tr, mul, mv, dot, dec, pair, solve, cholesky, frozen, -) -from ._ge_beam3_effective_deadline import effective_deadline_seconds - - -POLICY = 'GE_BEAM3_COUPLED_PHYSICAL_FIBRE_CELL_CONJUGATE_V1' - - -@dataclass(frozen=True) +from time import monotonic + +from ._ge_beam3_fibre_section import ( + PhysicalFibreSection, FibreHistory, FibreRecovery, canonical, _scalar_pair, +) +from ._ge_beam3_station_resultant_cell import ( + zero, tr, mul, mv, dot, dec, pair, solve, cholesky, frozen, +) +from ._ge_beam3_effective_deadline import effective_deadline_seconds + + +POLICY = 'GE_BEAM3_COUPLED_PHYSICAL_FIBRE_CELL_CONJUGATE_V1' + + +@dataclass(frozen=True) class CellHistory: - cell_identity: str + cell_identity: str stations: tuple @@ -43,153 +43,153 @@ class PairedFibreTrialState(FibreTrialState): """Actual paired input and smooth current branch; not a global affine law.""" resultants_low: tuple smooth: bool - - -def _section_response(section, strain, origins, check, *, include_energy=False): - """Decimal first/second variations and recovery of the declared potential.""" - stress = mv(section._background, strain) - tangent = [list(row) for row in section._background] - potential = dot(strain, stress)/2 - stored = potential; previous_hardening = D(0); dissipation = D(0) - proposed = []; recovered = [] - for fibre, (z0, p0) in zip(section.fibres, origins): - check(); b = section._map(fibre); area = D.from_float(fibre.area); young = D.from_float(fibre.young) - ef = dot(b, strain); delta, et, branch = fibre.curve._return(young, ef, z0, p0) - z = z0+delta; p = p0+abs(delta); elastic = ef-z; sigma = young*elastic - potential += area*(young*elastic*elastic/2+fibre.curve._integral(p0, p)) - if include_energy: - y0 = D.from_float(fibre.curve.flow_stress[0]) - stored += area*(young*elastic*elastic/2+ - fibre.curve._integral(D(0), p)-y0*p) - previous_hardening += area*(fibre.curve._integral(D(0), p0)-y0*p0) - dissipation += area*y0*abs(delta) - for i in range(6): - stress[i] += area*b[i]*sigma - for j in range(6): tangent[i][j] += area*et*b[i]*b[j] - zh, zl = _scalar_pair(z); ph, pl = _scalar_pair(p) - proposed.append((zh, zl, ph, pl)) - recovered.append(FibreRecovery(fibre.fibre_id, _scalar_pair(ef), _scalar_pair(elastic), - _scalar_pair(sigma), _scalar_pair(et), _scalar_pair(delta), branch)) - fields = potential, stress, tangent, tuple(proposed), tuple(recovered) - return fields + (stored, previous_hardening, dissipation) if include_energy else fields - - -class FibreCellConjugate: - __slots__ = ('section', 'stations', 'identity', 'load_map', 'size', '_elastic', '_sealed') - - def __setattr__(self, name, value): - if getattr(self, '_sealed', False): raise AttributeError('captured fibre cell is immutable') - object.__setattr__(self, name, value) - - def __init__(self, section, stations): - if type(section) is not PhysicalFibreSection or len(section.fibres) > 32: - raise ValueError('explicit bounded physical fibre section required') - if type(stations) not in (list, tuple) or not 4 <= len(stations) <= 32: - raise ValueError('bounded station inventory required') - started = monotonic() - def check(): - if monotonic()-started > effective_deadline_seconds(60.): raise TimeoutError('fibre cell compiler deadline') - self.section = section; self.size = 6+3*len(stations) - rows = []; capture = [] - with localcontext() as context: - context.prec = 80 - load = zero(self.size, 18); elastic = zero(self.size, self.size) - for i in range(6): load[i][i] = D(1) - c = [list(row) for row in section._background] - for fibre in section.fibres: - b = section._map(fibre); weight = dec(fibre.area)*dec(fibre.young) - for i in range(6): - for j in range(6): c[i][j] += weight*b[i]*b[j] - for station, row in enumerate(stations): - check() - if type(row) is not dict or set(row) != {'cell', 't', 'weight', 'v'}: - raise ValueError('exact cell station schema required') - cell = row['cell']; t = dec(row['t']); weight = dec(row['weight']) - if type(cell) is not int or cell not in (0, 1) or weight <= 0 or not 0 < t < 1: - raise ValueError('positive interior half-cell station required') - v = [[dec(x) for x in r] for r in row['v']] - if len(v) != 3 or any(len(r) != 3 for r in v): raise ValueError('three by three station map required') - mapping = zero(6, 6) - for i in range(3): - mapping[i][:3] = v[i] - mapping[3+i][3+i] = D(1) - load[6+3*station+i][6+6*cell+i] = weight*(1-t) - load[6+3*station+i][9+6*cell+i] = weight*t - indices = tuple(range(3*cell, 3*cell+3))+tuple(range(6+3*station, 9+3*station)) - block = mul(mul(tr(mapping), c), mapping) - for i, a in enumerate(indices): - for j, b in enumerate(indices): elastic[a][b] += weight*block[i][j] - rows.append((cell, weight, frozen(mapping), indices)) - capture.append(dict(cell=cell, t=float(t), weight=float(weight), v=[[float(x) for x in r] for r in v])) - if {row[0] for row in rows} != {0, 1}: raise ValueError('both half-cells must be represented') - if any(len({row['t'] for row in capture if row['cell'] == cell}) < 2 for cell in (0, 1)): - raise ValueError('two distinct stations per half-cell required for endpoint moment work') - cholesky(elastic) - self.load_map = frozen(load); self._elastic = frozen(elastic); self.stations = tuple(rows) - self.identity = hashlib.sha256(canonical(dict(policy=POLICY, section=section.identity, - stations=capture))).hexdigest() - check(); self._sealed = True - - def virgin(self): - return CellHistory(self.identity, tuple(self.section.virgin() for _ in self.stations)) - - def _origins(self, origin): - if (type(origin) is not CellHistory or origin.cell_identity != self.identity - or type(origin.stations) is not tuple or len(origin.stations) != len(self.stations)): - raise ValueError('complete immutable cell-bound fibre history required') - return tuple(self.section._origins(h) for h in origin.stations) - - def _evaluate(self, x, load, origins, check): - residual = [-value for value in load]; tangent = zero(self.size, self.size) - material_potential = D(0); fields = [] - for (_, weight, mapping, indices), history in zip(self.stations, origins): - check(); strain = mv(mapping, [x[i] for i in indices]) - potential, stress, modulus, proposed, recovery = _section_response(self.section, strain, history, check) - material_potential += weight*potential - vector = mv(tr(mapping), stress); block = mul(mul(tr(mapping), modulus), mapping) - for i, a in enumerate(indices): - residual[a] += weight*vector[i] - for j, b in enumerate(indices): tangent[a][b] += weight*block[i][j] - fields.append((strain, stress, proposed, recovery)) - return material_potential-dot(x, load), material_potential, residual, tangent, fields - - def _line_minimum(self, x, direction, residual, load, origins, check): - """Minimize the actual convex piecewise-quadratic potential on [0,1]. - - Every yield/table-knot crossing is known from the affine fibre strain. - This prevents geometric backtracking from crawling across narrow - elastic intervals at high material contrast. No constitutive tuning. - """ - cuts = {D(0), D(1)} - for (_, _, mapping, indices), history in zip(self.stations, origins): - strain = mv(mapping, [x[i] for i in indices]) - change = mv(mapping, [direction[i] for i in indices]) - for fibre, (z0, p0) in zip(self.section.fibres, history): - check(); b = self.section._map(fibre); ef = dot(b, strain); de = dot(b, change) - if de == 0: continue - young = dec(fibre.young) - levels = (p0,)+tuple(D.from_float(k) for k in fibre.curve.plastic_strain if D.from_float(k) > p0) - for accumulated in levels: - check() - flow = fibre.curve._at(accumulated)[0] - for sign in (-1, 1): - boundary = z0+sign*(accumulated-p0+flow/young) - alpha = (boundary-ef)/de - if 0 < alpha < 1: cuts.add(alpha) - if len(cuts) > 4096: raise ValueError('coupled fibre line-partition limit') - ordered = sorted(cuts); slope = dot(residual, direction) - evaluations = 0 - for left, right in zip(ordered, ordered[1:]): - check(); midpoint = (left+right)/2 - point = [v+midpoint*d for v, d in zip(x, direction)] - tangent = self._evaluate(point, load, origins, check)[3]; evaluations += 1 - curvature = dot(direction, mv(tangent, direction)) - if curvature <= 0: raise ValueError('nonpositive fibre line curvature; strict conjugate unavailable') - root = left-slope/curvature - if left <= root <= right: return root, evaluations - slope += curvature*(right-left) - return D(1), evaluations - + + +def _section_response(section, strain, origins, check, *, include_energy=False): + """Decimal first/second variations and recovery of the declared potential.""" + stress = mv(section._background, strain) + tangent = [list(row) for row in section._background] + potential = dot(strain, stress)/2 + stored = potential; previous_hardening = D(0); dissipation = D(0) + proposed = []; recovered = [] + for fibre, (z0, p0) in zip(section.fibres, origins): + check(); b = section._map(fibre); area = D.from_float(fibre.area); young = D.from_float(fibre.young) + ef = dot(b, strain); delta, et, branch = fibre.curve._return(young, ef, z0, p0) + z = z0+delta; p = p0+abs(delta); elastic = ef-z; sigma = young*elastic + potential += area*(young*elastic*elastic/2+fibre.curve._integral(p0, p)) + if include_energy: + y0 = D.from_float(fibre.curve.flow_stress[0]) + stored += area*(young*elastic*elastic/2+ + fibre.curve._integral(D(0), p)-y0*p) + previous_hardening += area*(fibre.curve._integral(D(0), p0)-y0*p0) + dissipation += area*y0*abs(delta) + for i in range(6): + stress[i] += area*b[i]*sigma + for j in range(6): tangent[i][j] += area*et*b[i]*b[j] + zh, zl = _scalar_pair(z); ph, pl = _scalar_pair(p) + proposed.append((zh, zl, ph, pl)) + recovered.append(FibreRecovery(fibre.fibre_id, _scalar_pair(ef), _scalar_pair(elastic), + _scalar_pair(sigma), _scalar_pair(et), _scalar_pair(delta), branch)) + fields = potential, stress, tangent, tuple(proposed), tuple(recovered) + return fields + (stored, previous_hardening, dissipation) if include_energy else fields + + +class FibreCellConjugate: + __slots__ = ('section', 'stations', 'identity', 'load_map', 'size', '_elastic', '_sealed') + + def __setattr__(self, name, value): + if getattr(self, '_sealed', False): raise AttributeError('captured fibre cell is immutable') + object.__setattr__(self, name, value) + + def __init__(self, section, stations): + if type(section) is not PhysicalFibreSection or len(section.fibres) > 32: + raise ValueError('explicit bounded physical fibre section required') + if type(stations) not in (list, tuple) or not 4 <= len(stations) <= 32: + raise ValueError('bounded station inventory required') + started = monotonic() + def check(): + if monotonic()-started > effective_deadline_seconds(60.): raise TimeoutError('fibre cell compiler deadline') + self.section = section; self.size = 6+3*len(stations) + rows = []; capture = [] + with localcontext() as context: + context.prec = 80 + load = zero(self.size, 18); elastic = zero(self.size, self.size) + for i in range(6): load[i][i] = D(1) + c = [list(row) for row in section._background] + for fibre in section.fibres: + b = section._map(fibre); weight = dec(fibre.area)*dec(fibre.young) + for i in range(6): + for j in range(6): c[i][j] += weight*b[i]*b[j] + for station, row in enumerate(stations): + check() + if type(row) is not dict or set(row) != {'cell', 't', 'weight', 'v'}: + raise ValueError('exact cell station schema required') + cell = row['cell']; t = dec(row['t']); weight = dec(row['weight']) + if type(cell) is not int or cell not in (0, 1) or weight <= 0 or not 0 < t < 1: + raise ValueError('positive interior half-cell station required') + v = [[dec(x) for x in r] for r in row['v']] + if len(v) != 3 or any(len(r) != 3 for r in v): raise ValueError('three by three station map required') + mapping = zero(6, 6) + for i in range(3): + mapping[i][:3] = v[i] + mapping[3+i][3+i] = D(1) + load[6+3*station+i][6+6*cell+i] = weight*(1-t) + load[6+3*station+i][9+6*cell+i] = weight*t + indices = tuple(range(3*cell, 3*cell+3))+tuple(range(6+3*station, 9+3*station)) + block = mul(mul(tr(mapping), c), mapping) + for i, a in enumerate(indices): + for j, b in enumerate(indices): elastic[a][b] += weight*block[i][j] + rows.append((cell, weight, frozen(mapping), indices)) + capture.append(dict(cell=cell, t=float(t), weight=float(weight), v=[[float(x) for x in r] for r in v])) + if {row[0] for row in rows} != {0, 1}: raise ValueError('both half-cells must be represented') + if any(len({row['t'] for row in capture if row['cell'] == cell}) < 2 for cell in (0, 1)): + raise ValueError('two distinct stations per half-cell required for endpoint moment work') + cholesky(elastic) + self.load_map = frozen(load); self._elastic = frozen(elastic); self.stations = tuple(rows) + self.identity = hashlib.sha256(canonical(dict(policy=POLICY, section=section.identity, + stations=capture))).hexdigest() + check(); self._sealed = True + + def virgin(self): + return CellHistory(self.identity, tuple(self.section.virgin() for _ in self.stations)) + + def _origins(self, origin): + if (type(origin) is not CellHistory or origin.cell_identity != self.identity + or type(origin.stations) is not tuple or len(origin.stations) != len(self.stations)): + raise ValueError('complete immutable cell-bound fibre history required') + return tuple(self.section._origins(h) for h in origin.stations) + + def _evaluate(self, x, load, origins, check): + residual = [-value for value in load]; tangent = zero(self.size, self.size) + material_potential = D(0); fields = [] + for (_, weight, mapping, indices), history in zip(self.stations, origins): + check(); strain = mv(mapping, [x[i] for i in indices]) + potential, stress, modulus, proposed, recovery = _section_response(self.section, strain, history, check) + material_potential += weight*potential + vector = mv(tr(mapping), stress); block = mul(mul(tr(mapping), modulus), mapping) + for i, a in enumerate(indices): + residual[a] += weight*vector[i] + for j, b in enumerate(indices): tangent[a][b] += weight*block[i][j] + fields.append((strain, stress, proposed, recovery)) + return material_potential-dot(x, load), material_potential, residual, tangent, fields + + def _line_minimum(self, x, direction, residual, load, origins, check): + """Minimize the actual convex piecewise-quadratic potential on [0,1]. + + Every yield/table-knot crossing is known from the affine fibre strain. + This prevents geometric backtracking from crawling across narrow + elastic intervals at high material contrast. No constitutive tuning. + """ + cuts = {D(0), D(1)} + for (_, _, mapping, indices), history in zip(self.stations, origins): + strain = mv(mapping, [x[i] for i in indices]) + change = mv(mapping, [direction[i] for i in indices]) + for fibre, (z0, p0) in zip(self.section.fibres, history): + check(); b = self.section._map(fibre); ef = dot(b, strain); de = dot(b, change) + if de == 0: continue + young = dec(fibre.young) + levels = (p0,)+tuple(D.from_float(k) for k in fibre.curve.plastic_strain if D.from_float(k) > p0) + for accumulated in levels: + check() + flow = fibre.curve._at(accumulated)[0] + for sign in (-1, 1): + boundary = z0+sign*(accumulated-p0+flow/young) + alpha = (boundary-ef)/de + if 0 < alpha < 1: cuts.add(alpha) + if len(cuts) > 4096: raise ValueError('coupled fibre line-partition limit') + ordered = sorted(cuts); slope = dot(residual, direction) + evaluations = 0 + for left, right in zip(ordered, ordered[1:]): + check(); midpoint = (left+right)/2 + point = [v+midpoint*d for v, d in zip(x, direction)] + tangent = self._evaluate(point, load, origins, check)[3]; evaluations += 1 + curvature = dot(direction, mv(tangent, direction)) + if curvature <= 0: raise ValueError('nonpositive fibre line curvature; strict conjugate unavailable') + root = left-slope/curvature + if left <= root <= right: return root, evaluations + slope += curvature*(right-left) + return D(1), evaluations + def boundary_amount(self, trial, direction, *, origin, check=None): """First fixed-origin yield/table crossing, guarded for binary64 updates. @@ -308,14 +308,14 @@ def response(self, resultants, origin=None, *, check=None, include_energy=False, raise ValueError('explicit native energy recovery policy required') if type(capture_trial) is not bool: raise ValueError('explicit fibre trial capture policy required') - started = monotonic() - def guard(): - if check is not None: check() - if monotonic()-started > effective_deadline_seconds(60.): raise TimeoutError('coupled fibre cell deadline') - guard() - origin = self.virgin() if origin is None else origin - with localcontext() as context: - context.prec = 80 + started = monotonic() + def guard(): + if check is not None: check() + if monotonic()-started > effective_deadline_seconds(60.): raise TimeoutError('coupled fibre cell deadline') + guard() + origin = self.virgin() if origin is None else origin + with localcontext() as context: + context.prec = 80 p = [dec(x) for x in resultants] if len(p) != 18: raise ValueError('18 retained resultants required') if resultants_low is not None: @@ -326,53 +326,53 @@ def guard(): for high, correction in zip(resultants, resultants_low): validate_pair(high, correction) p = [high+correction for high, correction in zip(p, low)] - origins = self._origins(origin); load = mv(self.load_map, p) - # Virgin tangent is only a predictor. Origin plastic strains enter - # its linear term; all actual trial states use the nonlinear law. - predictor = list(load) - for (_, weight, mapping, indices), history in zip(self.stations, origins): - s = [D(0)]*6 - for fibre, (z0, _) in zip(self.section.fibres, history): - b = self.section._map(fibre); scale = dec(fibre.area)*dec(fibre.young)*z0 - for i in range(6): s[i] += scale*b[i] - for i, value in zip(indices, mv(tr(mapping), s)): predictor[i] += weight*value - x = [row[0] for row in solve([list(row) for row in self._elastic], [[v] for v in predictor], guard)] - threshold = D('1e-28')*max(D(1), *(abs(v) for v in load)) - evaluations = 0; line_trials = 0 - for iteration in range(49): - guard(); objective, material, residual, tangent, fields = self._evaluate(x, load, origins, guard) - evaluations += 1 - if max(abs(v) for v in residual) <= threshold: break - if iteration == 48: raise ValueError('coupled fibre Newton update limit') - # No pseudo-inverse, shift, stiffness floor or invented yield strength. - try: cholesky(tangent) - except ValueError as error: raise ValueError('nonpositive current fibre cell tangent; strict conjugate unavailable') from error - direction = [row[0] for row in solve(tangent, [[-v] for v in residual], guard)] - slope = dot(residual, direction) - if slope >= 0: raise ValueError('nondecreasing coupled fibre Newton direction') - alpha, count = self._line_minimum(x, direction, residual, load, origins, guard) - proposed = [v+alpha*d for v, d in zip(x, direction)] - candidate = self._evaluate(proposed, load, origins, guard)[0] - evaluations += count+1; line_trials += count - if alpha <= 0 or candidate >= objective: - raise ValueError('nondecreasing exact-partition fibre line step') - x = proposed - try: cholesky(tangent) - except ValueError as error: raise ValueError('nonpositive accepted fibre cell tangent; smooth compliance unavailable') from error + origins = self._origins(origin); load = mv(self.load_map, p) + # Virgin tangent is only a predictor. Origin plastic strains enter + # its linear term; all actual trial states use the nonlinear law. + predictor = list(load) + for (_, weight, mapping, indices), history in zip(self.stations, origins): + s = [D(0)]*6 + for fibre, (z0, _) in zip(self.section.fibres, history): + b = self.section._map(fibre); scale = dec(fibre.area)*dec(fibre.young)*z0 + for i in range(6): s[i] += scale*b[i] + for i, value in zip(indices, mv(tr(mapping), s)): predictor[i] += weight*value + x = [row[0] for row in solve([list(row) for row in self._elastic], [[v] for v in predictor], guard)] + threshold = D('1e-28')*max(D(1), *(abs(v) for v in load)) + evaluations = 0; line_trials = 0 + for iteration in range(49): + guard(); objective, material, residual, tangent, fields = self._evaluate(x, load, origins, guard) + evaluations += 1 + if max(abs(v) for v in residual) <= threshold: break + if iteration == 48: raise ValueError('coupled fibre Newton update limit') + # No pseudo-inverse, shift, stiffness floor or invented yield strength. + try: cholesky(tangent) + except ValueError as error: raise ValueError('nonpositive current fibre cell tangent; strict conjugate unavailable') from error + direction = [row[0] for row in solve(tangent, [[-v] for v in residual], guard)] + slope = dot(residual, direction) + if slope >= 0: raise ValueError('nondecreasing coupled fibre Newton direction') + alpha, count = self._line_minimum(x, direction, residual, load, origins, guard) + proposed = [v+alpha*d for v, d in zip(x, direction)] + candidate = self._evaluate(proposed, load, origins, guard)[0] + evaluations += count+1; line_trials += count + if alpha <= 0 or candidate >= objective: + raise ValueError('nondecreasing exact-partition fibre line step') + x = proposed + try: cholesky(tangent) + except ValueError as error: raise ValueError('nonpositive accepted fibre cell tangent; smooth compliance unavailable') from error strain_compliance = solve(tangent, [list(row) for row in self.load_map], guard) compliance = mul(tr(self.load_map), strain_compliance) - gradient = mv(tr(self.load_map), x) - history = CellHistory(self.identity, tuple(FibreHistory(self.section.identity, row[2]) for row in fields)) - self._origins(history) - station_rows = [dict(strain=pair(strain), resultants=pair(stress), fibres=recovery) - for strain, stress, _, recovery in fields] - boundary = any(f.branch in ('YIELD_BOUNDARY', 'HARDENING_KNOT') for row in fields for f in row[3]) - response = dict(policy=POLICY, cell_identity=self.identity, origin=origin, history=history, - potential=pair([-objective]), material_potential=pair([material]), gradient=pair(gradient), - hessian=[pair(row) for row in compliance], stations=station_rows, - iterations=iteration, evaluations=evaluations, line_trials=line_trials, - residual=str(max(abs(v) for v in residual)), - derivative_kind='SEMISMOOTH_BRANCH_SELECTION' if boundary else 'CLASSICAL_SMOOTH_BRANCH', + gradient = mv(tr(self.load_map), x) + history = CellHistory(self.identity, tuple(FibreHistory(self.section.identity, row[2]) for row in fields)) + self._origins(history) + station_rows = [dict(strain=pair(strain), resultants=pair(stress), fibres=recovery) + for strain, stress, _, recovery in fields] + boundary = any(f.branch in ('YIELD_BOUNDARY', 'HARDENING_KNOT') for row in fields for f in row[3]) + response = dict(policy=POLICY, cell_identity=self.identity, origin=origin, history=history, + potential=pair([-objective]), material_potential=pair([material]), gradient=pair(gradient), + hessian=[pair(row) for row in compliance], stations=station_rows, + iterations=iteration, evaluations=evaluations, line_trials=line_trials, + residual=str(max(abs(v) for v in residual)), + derivative_kind='SEMISMOOTH_BRANCH_SELECTION' if boundary else 'CLASSICAL_SMOOTH_BRANCH', production_qualified=False) if capture_trial: response['_trial_state'] = FibreTrialState(self.identity, origin, tuple(float(v) for v in p), @@ -384,25 +384,25 @@ def guard(): response['_trial_state'] = PairedFibreTrialState(self.identity, origin, tuple(float(v) for v in resultants), old.strains, old.strain_compliances, tuple(float(v) for v in resultants_low), not boundary) - if include_energy: - stored = D(0); previous_hardening = D(0); dissipation = D(0) - for (_, weight, _, _), predecessor, fields_row, station in zip( - self.stations, origins, fields, station_rows): - strain, stress, proposed, recovery = fields_row - repeated = _section_response(self.section, strain, predecessor, - guard, include_energy=True) - if (repeated[1] != stress or repeated[3] != proposed or - repeated[4] != recovery): - raise ValueError('native energy recovery changed accepted station response') - stored += weight*repeated[5] - previous_hardening += weight*repeated[6] - dissipation += weight*repeated[7] - station['stored_energy_per_length'] = _scalar_pair(repeated[5]) - station['previous_hardening_per_length'] = _scalar_pair(repeated[6]) - station['incremental_dissipation_per_length'] = _scalar_pair(repeated[7]) - response['stored_energy'] = _scalar_pair(stored) - response['previous_hardening_energy'] = _scalar_pair(previous_hardening) - response['incremental_dissipation'] = _scalar_pair(dissipation) - response['energy_recovery_station_updates'] = len(fields) - guard() - return response + if include_energy: + stored = D(0); previous_hardening = D(0); dissipation = D(0) + for (_, weight, _, _), predecessor, fields_row, station in zip( + self.stations, origins, fields, station_rows): + strain, stress, proposed, recovery = fields_row + repeated = _section_response(self.section, strain, predecessor, + guard, include_energy=True) + if (repeated[1] != stress or repeated[3] != proposed or + repeated[4] != recovery): + raise ValueError('native energy recovery changed accepted station response') + stored += weight*repeated[5] + previous_hardening += weight*repeated[6] + dissipation += weight*repeated[7] + station['stored_energy_per_length'] = _scalar_pair(repeated[5]) + station['previous_hardening_per_length'] = _scalar_pair(repeated[6]) + station['incremental_dissipation_per_length'] = _scalar_pair(repeated[7]) + response['stored_energy'] = _scalar_pair(stored) + response['previous_hardening_energy'] = _scalar_pair(previous_hardening) + response['incremental_dissipation'] = _scalar_pair(dissipation) + response['energy_recovery_station_updates'] = len(fields) + guard() + return response diff --git a/src/anyfesolver/_ge_beam3_native_fibre_static_element.py b/src/anyfesolver/_ge_beam3_native_fibre_static_element.py index 3cc460492..28c7536db 100644 --- a/src/anyfesolver/_ge_beam3_native_fibre_static_element.py +++ b/src/anyfesolver/_ge_beam3_native_fibre_static_element.py @@ -1,193 +1,193 @@ -"""Private physical-fibre static adapter using actual native state tokens. - -No public selector or dynamic route is registered. Existing beam mechanics -are not inherited. The 24 internal static coordinates remain explicit state. -""" -from copy import deepcopy -from decimal import localcontext -from fractions import Fraction -import numpy as np -from scipy import linalg -from .elements import Element -from ._native_material_protocol import PROTOCOL,NativeMaterialContext,NativeMaterialValidator -from ._ge_beam3_retained_fibre import RetainedFibreOperator -from ._ge_beam3_fibre_static_boundary import solve_static,StaticTrial,POLICY as STATIC_POLICY -from ._ge_beam3_p5.chart import pullback -from ._ge_beam3_p5.arrays import _array,_frames -from ._ge_beam3_p5_seeded.core import canonical,sha -from ._native_reference_modal import _owned - -FORMULATION='CANDIDATE_GE_BEAM3_NATIVE_PHYSICAL_FIBRE_STATIC_V1' -SCHEMA='GE_BEAM3_NATIVE_PHYSICAL_FIBRE_STATIC_STATE_V1' - - -def seal(value): - body={k:v for k,v in value.items() if k!='state_sha256'} - return {**body,'state_sha256':sha(body)} - - -class NativeFibreStaticElement(Element): - num_nodes=3 - dofs_per_node=6 - formulation_id=FORMULATION - formulation_native_total_lagrangian=True - native_material_state_protocol=PROTOCOL - production_qualified=False - +"""Private physical-fibre static adapter using actual native state tokens. + +No public selector or dynamic route is registered. Existing beam mechanics +are not inherited. The 24 internal static coordinates remain explicit state. +""" +from copy import deepcopy +from decimal import localcontext +from fractions import Fraction +import numpy as np +from scipy import linalg +from .elements import Element +from ._native_material_protocol import PROTOCOL,NativeMaterialContext,NativeMaterialValidator +from ._ge_beam3_retained_fibre import RetainedFibreOperator +from ._ge_beam3_fibre_static_boundary import solve_static,StaticTrial,POLICY as STATIC_POLICY +from ._ge_beam3_p5.chart import pullback +from ._ge_beam3_p5.arrays import _array,_frames +from ._ge_beam3_p5_seeded.core import canonical,sha +from ._native_reference_modal import _owned + +FORMULATION='CANDIDATE_GE_BEAM3_NATIVE_PHYSICAL_FIBRE_STATIC_V1' +SCHEMA='GE_BEAM3_NATIVE_PHYSICAL_FIBRE_STATIC_STATE_V1' + + +def seal(value): + body={k:v for k,v in value.items() if k!='state_sha256'} + return {**body,'state_sha256':sha(body)} + + +class NativeFibreStaticElement(Element): + num_nodes=3 + dofs_per_node=6 + formulation_id=FORMULATION + formulation_native_total_lagrangian=True + native_material_state_protocol=PROTOCOL + production_qualified=False + def __init__(self,element_id,node_ids,reference,section,*,order=4,arithmetic_policy=None): - if type(element_id) is not int or element_id<=0 or type(node_ids) is not tuple or len(node_ids)!=3 or len(set(node_ids))!=3 or any(type(i) is not int or i<=0 for i in node_ids): - raise ValueError('explicit native fibre element/node identities') - super().__init__(element_id,node_ids,'private-native-fibre-'+str(element_id)) + if type(element_id) is not int or element_id<=0 or type(node_ids) is not tuple or len(node_ids)!=3 or len(set(node_ids))!=3 or any(type(i) is not int or i<=0 for i in node_ids): + raise ValueError('explicit native fibre element/node identities') + super().__init__(element_id,node_ids,'private-native-fibre-'+str(element_id)) self.operator=RetainedFibreOperator(reference,section,order=order,arithmetic_policy=arithmetic_policy); self.section=section - self.identity=sha(dict(formulation=FORMULATION,element_id=element_id,nodes=node_ids,operator=self.operator.identity)) - self._mapping=None; self._mesh=None; self._validator=None - - def _check(self,mesh): - if type(self) is not NativeFibreStaticElement or mesh.elements.get(self.element_id) is not self: - raise ValueError('exact native fibre element ownership') - if self._mesh is None: self._mesh=mesh - elif self._mesh is not mesh: raise ValueError('native fibre element belongs to another mesh') - if any(type(e) is not NativeFibreStaticElement for e in mesh.elements.values()): raise ValueError('private standalone native fibre adapter only') - self.operator.guard() - if self.section is not self.operator.section or self.formulation_id!=FORMULATION or self.production_qualified is not False or self.num_nodes!=3 or self.dofs_per_node!=6: - raise ValueError('native fibre formulation/section changed') - if sha(dict(formulation=FORMULATION,element_id=self.element_id,nodes=self.node_ids,operator=self.operator.identity))!=self.identity: - raise ValueError('native fibre identity changed') - if not np.array_equal(self.get_node_coordinates(mesh),self.operator.reference.coordinates): raise ValueError('native reference coordinates changed') - mapping=tuple(self.get_dof_mapping(mesh)) - if len(mapping)!=18 or len(set(mapping))!=18: raise ValueError('eighteen native external DOFs required') - if self._mapping is None: self._mapping=mapping - elif mapping!=self._mapping: raise ValueError('native fibre DOF ownership changed') - - def get_node_coordinates(self,mesh): - return np.array([mesh.nodes[i].coords() for i in self.node_ids]) - - def native_reference_directors(self,mesh): - self._check(mesh); return self.operator.reference.nodal_triads[:,:,2].copy() - - def to_dict(self): - return dict(formulation_id=FORMULATION,state_schema=SCHEMA,element_id=self.element_id,node_ids=self.node_ids, - operator=self.operator.identity,reference=self.operator.reference.fingerprint(),section=self.section.identity, - quadrature=self.operator.order,reduction='STATIC_ONLY_24_INTERNAL_COORDINATES',production_qualified=False) - - def _coordinates(self,total): - total=_array(total,(18,),'native total displacement'); reference=self.operator.reference.coordinates - high=reference+total.reshape(3,6)[:,:3]; low=np.empty((3,3)) - for i in range(3): - for j in range(3): low[i,j]=float(Fraction(float(reference[i,j]))+Fraction(float(total[6*i+j]))-Fraction(float(high[i,j]))) - return _owned(high),_owned(low) - - def _state(self,epoch,total,operators,origin,seed_u,seed_p,response,previous): - positions,low=self._coordinates(total) - return seal(dict(schema=SCHEMA,element_identity=self.identity,epoch=epoch,previous_state_sha256=previous, - committed_total_u=_owned(total),committed_nodal_rotation_matrices=_owned(operators),positions=positions,position_low=low, - origins=origin,seed_rotations=_owned(seed_u),seed_resultants=_owned(seed_p),response=response)) - - def _validate(self,mesh,state,expected=None): - self._check(mesh) - keys={'schema','element_identity','epoch','previous_state_sha256','committed_total_u','committed_nodal_rotation_matrices', - 'positions','position_low','origins','seed_rotations','seed_resultants','response','state_sha256'} - if type(state) is not dict or set(state)!=keys or state['schema']!=SCHEMA or state['element_identity']!=self.identity or seal(state)['state_sha256']!=state['state_sha256']: - raise ValueError('native fibre state schema/identity/hash') - epoch=state['epoch'] - if type(epoch) is not int or epoch<0: raise ValueError('native fibre state epoch') - previous_hash=state['previous_state_sha256'] - if epoch and (type(previous_hash) is not str or len(previous_hash)!=64 or any(c not in '0123456789abcdef' for c in previous_hash)): - raise ValueError('native fibre predecessor hash') - total=_array(state['committed_total_u'],(18,),'native fibre state displacement') - if expected is not None and not np.array_equal(total,expected): raise ValueError('native fibre displacement mismatch') - positions,low=self._coordinates(total) - if not np.array_equal(positions,state['positions']) or not np.array_equal(low,state['position_low']): raise ValueError('native compensated position mismatch') - operators=_frames(state['committed_nodal_rotation_matrices'],3,'native fibre operators') - response=state['response'] - if type(response) is not StaticTrial: raise ValueError('exact native fibre static response') - with localcontext() as context: - context.prec=80; self.operator.cell._origins(state['origins']) - if epoch==0 and (state['previous_state_sha256'] is not None or np.any(total) or not np.array_equal(operators,np.tile(np.eye(3),(3,1,1))) or canonical(state['origins'])!=canonical(self.operator.cell.virgin())): - raise ValueError('native fibre virgin state mismatch') - seed_u=_frames(state['seed_rotations'],2,'native seed rotations'); seed_p=_array(state['seed_resultants'],(18,),'native seed resultants') - q=operators@self.operator.reference.nodal_triads - input_id=sha(dict(policy=STATIC_POLICY,operator=self.operator.identity,positions=positions,position_low=low, - nodal_frames=q,origin=state['origins'],line_force=np.zeros(3),initial_rotations=seed_u,initial_resultants=seed_p)) - if response.input_sha256!=input_id or type(response.iterations) is not int or not 0<=response.iterations<=24 or response.production_qualified or response.dynamic_reduction_authorized: - raise ValueError('native fibre response provenance') - replay=self.operator.evaluate(positions,low,q,response.rotations,response.resultants,origin=state['origins']) - h=replay.hessian+replay.hessian_low - condensed=h[:18,:18]-h[:18,18:]@linalg.solve(h[18:,18:],h[18:,:18],assume_a='gen',check_finite=True) - length=float(np.linalg.norm(self.operator.reference.coordinates[-1]-self.operator.reference.coordinates[0])) - error=float(np.linalg.norm(replay.residual[18:]/np.r_[np.full(12,length),np.ones(12)])) - expected_response=StaticTrial(response.rotations,response.resultants,replay.residual[:18],condensed, - replay.residual,h,replay.history,replay.potential,error,response.iterations,input_id) - if error>1e-11 or canonical(expected_response)!=canonical(response): raise ValueError('native fibre static/history replay mismatch') - return state - - def _pose(self,state,view,*,committed): - coordinates=view.committed_coordinates if committed else view.trial_coordinates - operators=view.committed_rotation_matrices if committed else view.trial_rotation_matrices - rotations=view.committed_rotation_coordinates if committed else view.trial_rotation_coordinates - if not np.array_equal(state['positions'],coordinates) or not np.array_equal(state['committed_nodal_rotation_matrices'],operators) or not np.array_equal(state['committed_total_u'].reshape(3,6)[:,3:],rotations): - raise ValueError('native fibre material/pose mismatch') - - def init_model_bound_nonlinear_state(self,mesh,material,num_layers): - self._arguments(mesh,material,num_layers) - total=np.zeros(18); operators=np.tile(np.eye(3),(3,1,1)); seed_u=np.tile(np.eye(3),(2,1,1)); seed_p=np.zeros(18) - positions,low=self._coordinates(total); origin=self.operator.cell.virgin() - response=solve_static(self.operator,positions,low,operators@self.operator.reference.nodal_triads,origin=origin, - initial_rotations=seed_u,initial_resultants=seed_p,spatial_line_force=np.zeros(3)) - return self._state(0,total,operators,origin,seed_u,seed_p,response,None) - - def _arguments(self,mesh,material,num_layers): - self._check(mesh) - if material is not self.section or type(num_layers) is not int or num_layers!=1: raise ValueError('native fibre section/layer authority') - - def validate_model_bound_nonlinear_state(self,mesh,material,state,num_layers,*,expected_committed_total_u=None): - self._arguments(mesh,material,num_layers); self._validate(mesh,state,expected_committed_total_u); return deepcopy(state) - - def create_native_material_validator(self,mesh): - self._check(mesh) - if self._validator is not None: return self._validator - def validate(state,*,previous_state,native_view,displacement,phase): - self._validate(mesh,state,displacement) - if phase=='committed': - if previous_state is not None: raise ValueError('native fibre committed validation phase') - self._pose(state,native_view,committed=True) - elif phase=='trial': - previous=self._validate(mesh,previous_state); self._pose(previous,native_view,committed=True); self._pose(state,native_view,committed=False) - if state['epoch']!=previous['epoch']+1 or state['previous_state_sha256']!=previous['state_sha256'] or canonical(state['origins'])!=canonical(previous['response'].history): raise ValueError('native fibre accepted-origin linkage') - if not np.array_equal(state['seed_rotations'],previous['response'].rotations) or not np.array_equal(state['seed_resultants'],previous['response'].resultants): raise ValueError('native fibre internal seed linkage') - else: raise ValueError('native fibre validation phase') - self._validator=NativeMaterialValidator(validate) - return self._validator - - def _live(self,context,view,state,*,check_state=True): - if type(context) is not NativeMaterialContext or context.element_id!=self.element_id: raise ValueError('live native fibre material context required') - context.require_view(view) - # This private adapter explicitly binds the actual store's validator, - # not only a numerically identical pose from a different model. - binding=context.store._native_element_bindings.get(self.element_id) - if self._validator is None or binding is None or binding.material_validator is not self._validator: - raise ValueError('foreign native fibre material-store binding') - if check_state and canonical(context.store[self.element_id])!=canonical(state): - raise ValueError('native fibre input is not the current store state') - - def compute_nonlinear_response(self,mesh,material,displacement,state=None,num_layers=1,tangent=True,*,native_rotation_trial=None,native_material_context=None): - self._arguments(mesh,material,num_layers); context=native_material_context; view=native_rotation_trial - self._live(context,view,state); previous=self._validate(mesh,state); self._pose(previous,view,committed=True) - total=_array(displacement,(18,),'native fibre trial displacement'); positions,low=self._coordinates(total) - if not np.array_equal(positions,view.trial_coordinates) or not np.array_equal(total.reshape(3,6)[:,3:],view.trial_rotation_coordinates): raise ValueError('native fibre trial pose mismatch') - seed=previous['response']; origin=seed.history - response=solve_static(self.operator,positions,low,view.trial_rotation_matrices@self.operator.reference.nodal_triads, - origin=origin,initial_rotations=seed.rotations,initial_resultants=seed.resultants,spatial_line_force=np.zeros(3),check=lambda: self._live(context,view,state,check_state=False)) - force,matrix,_=pullback(response.residual,response.hessian,view.rotation_coordinate_increment) - self._live(context,view,state) - candidate=self._state(previous['epoch']+1,total,view.trial_rotation_matrices,origin,seed.rotations,seed.resultants,response,previous['state_sha256']) - return force.copy(),matrix.copy() if tangent else None,candidate - - def compute_stiffness_matrix(self,mesh,material): - return self.init_model_bound_nonlinear_state(mesh,material,1)['response'].hessian.copy() - - def _unsupported(self,*args,**kwargs): raise ValueError('private native fibre static adapter: workflow not qualified') - compute_mass_matrix=_unsupported - compute_geometric_stiffness_matrix=_unsupported - compute_internal_forces=_unsupported - compute_stresses=_unsupported + self.identity=sha(dict(formulation=FORMULATION,element_id=element_id,nodes=node_ids,operator=self.operator.identity)) + self._mapping=None; self._mesh=None; self._validator=None + + def _check(self,mesh): + if type(self) is not NativeFibreStaticElement or mesh.elements.get(self.element_id) is not self: + raise ValueError('exact native fibre element ownership') + if self._mesh is None: self._mesh=mesh + elif self._mesh is not mesh: raise ValueError('native fibre element belongs to another mesh') + if any(type(e) is not NativeFibreStaticElement for e in mesh.elements.values()): raise ValueError('private standalone native fibre adapter only') + self.operator.guard() + if self.section is not self.operator.section or self.formulation_id!=FORMULATION or self.production_qualified is not False or self.num_nodes!=3 or self.dofs_per_node!=6: + raise ValueError('native fibre formulation/section changed') + if sha(dict(formulation=FORMULATION,element_id=self.element_id,nodes=self.node_ids,operator=self.operator.identity))!=self.identity: + raise ValueError('native fibre identity changed') + if not np.array_equal(self.get_node_coordinates(mesh),self.operator.reference.coordinates): raise ValueError('native reference coordinates changed') + mapping=tuple(self.get_dof_mapping(mesh)) + if len(mapping)!=18 or len(set(mapping))!=18: raise ValueError('eighteen native external DOFs required') + if self._mapping is None: self._mapping=mapping + elif mapping!=self._mapping: raise ValueError('native fibre DOF ownership changed') + + def get_node_coordinates(self,mesh): + return np.array([mesh.nodes[i].coords() for i in self.node_ids]) + + def native_reference_directors(self,mesh): + self._check(mesh); return self.operator.reference.nodal_triads[:,:,2].copy() + + def to_dict(self): + return dict(formulation_id=FORMULATION,state_schema=SCHEMA,element_id=self.element_id,node_ids=self.node_ids, + operator=self.operator.identity,reference=self.operator.reference.fingerprint(),section=self.section.identity, + quadrature=self.operator.order,reduction='STATIC_ONLY_24_INTERNAL_COORDINATES',production_qualified=False) + + def _coordinates(self,total): + total=_array(total,(18,),'native total displacement'); reference=self.operator.reference.coordinates + high=reference+total.reshape(3,6)[:,:3]; low=np.empty((3,3)) + for i in range(3): + for j in range(3): low[i,j]=float(Fraction(float(reference[i,j]))+Fraction(float(total[6*i+j]))-Fraction(float(high[i,j]))) + return _owned(high),_owned(low) + + def _state(self,epoch,total,operators,origin,seed_u,seed_p,response,previous): + positions,low=self._coordinates(total) + return seal(dict(schema=SCHEMA,element_identity=self.identity,epoch=epoch,previous_state_sha256=previous, + committed_total_u=_owned(total),committed_nodal_rotation_matrices=_owned(operators),positions=positions,position_low=low, + origins=origin,seed_rotations=_owned(seed_u),seed_resultants=_owned(seed_p),response=response)) + + def _validate(self,mesh,state,expected=None): + self._check(mesh) + keys={'schema','element_identity','epoch','previous_state_sha256','committed_total_u','committed_nodal_rotation_matrices', + 'positions','position_low','origins','seed_rotations','seed_resultants','response','state_sha256'} + if type(state) is not dict or set(state)!=keys or state['schema']!=SCHEMA or state['element_identity']!=self.identity or seal(state)['state_sha256']!=state['state_sha256']: + raise ValueError('native fibre state schema/identity/hash') + epoch=state['epoch'] + if type(epoch) is not int or epoch<0: raise ValueError('native fibre state epoch') + previous_hash=state['previous_state_sha256'] + if epoch and (type(previous_hash) is not str or len(previous_hash)!=64 or any(c not in '0123456789abcdef' for c in previous_hash)): + raise ValueError('native fibre predecessor hash') + total=_array(state['committed_total_u'],(18,),'native fibre state displacement') + if expected is not None and not np.array_equal(total,expected): raise ValueError('native fibre displacement mismatch') + positions,low=self._coordinates(total) + if not np.array_equal(positions,state['positions']) or not np.array_equal(low,state['position_low']): raise ValueError('native compensated position mismatch') + operators=_frames(state['committed_nodal_rotation_matrices'],3,'native fibre operators') + response=state['response'] + if type(response) is not StaticTrial: raise ValueError('exact native fibre static response') + with localcontext() as context: + context.prec=80; self.operator.cell._origins(state['origins']) + if epoch==0 and (state['previous_state_sha256'] is not None or np.any(total) or not np.array_equal(operators,np.tile(np.eye(3),(3,1,1))) or canonical(state['origins'])!=canonical(self.operator.cell.virgin())): + raise ValueError('native fibre virgin state mismatch') + seed_u=_frames(state['seed_rotations'],2,'native seed rotations'); seed_p=_array(state['seed_resultants'],(18,),'native seed resultants') + q=operators@self.operator.reference.nodal_triads + input_id=sha(dict(policy=STATIC_POLICY,operator=self.operator.identity,positions=positions,position_low=low, + nodal_frames=q,origin=state['origins'],line_force=np.zeros(3),initial_rotations=seed_u,initial_resultants=seed_p)) + if response.input_sha256!=input_id or type(response.iterations) is not int or not 0<=response.iterations<=24 or response.production_qualified or response.dynamic_reduction_authorized: + raise ValueError('native fibre response provenance') + replay=self.operator.evaluate(positions,low,q,response.rotations,response.resultants,origin=state['origins']) + h=replay.hessian+replay.hessian_low + condensed=h[:18,:18]-h[:18,18:]@linalg.solve(h[18:,18:],h[18:,:18],assume_a='gen',check_finite=True) + length=float(np.linalg.norm(self.operator.reference.coordinates[-1]-self.operator.reference.coordinates[0])) + error=float(np.linalg.norm(replay.residual[18:]/np.r_[np.full(12,length),np.ones(12)])) + expected_response=StaticTrial(response.rotations,response.resultants,replay.residual[:18],condensed, + replay.residual,h,replay.history,replay.potential,error,response.iterations,input_id) + if error>1e-11 or canonical(expected_response)!=canonical(response): raise ValueError('native fibre static/history replay mismatch') + return state + + def _pose(self,state,view,*,committed): + coordinates=view.committed_coordinates if committed else view.trial_coordinates + operators=view.committed_rotation_matrices if committed else view.trial_rotation_matrices + rotations=view.committed_rotation_coordinates if committed else view.trial_rotation_coordinates + if not np.array_equal(state['positions'],coordinates) or not np.array_equal(state['committed_nodal_rotation_matrices'],operators) or not np.array_equal(state['committed_total_u'].reshape(3,6)[:,3:],rotations): + raise ValueError('native fibre material/pose mismatch') + + def init_model_bound_nonlinear_state(self,mesh,material,num_layers): + self._arguments(mesh,material,num_layers) + total=np.zeros(18); operators=np.tile(np.eye(3),(3,1,1)); seed_u=np.tile(np.eye(3),(2,1,1)); seed_p=np.zeros(18) + positions,low=self._coordinates(total); origin=self.operator.cell.virgin() + response=solve_static(self.operator,positions,low,operators@self.operator.reference.nodal_triads,origin=origin, + initial_rotations=seed_u,initial_resultants=seed_p,spatial_line_force=np.zeros(3)) + return self._state(0,total,operators,origin,seed_u,seed_p,response,None) + + def _arguments(self,mesh,material,num_layers): + self._check(mesh) + if material is not self.section or type(num_layers) is not int or num_layers!=1: raise ValueError('native fibre section/layer authority') + + def validate_model_bound_nonlinear_state(self,mesh,material,state,num_layers,*,expected_committed_total_u=None): + self._arguments(mesh,material,num_layers); self._validate(mesh,state,expected_committed_total_u); return deepcopy(state) + + def create_native_material_validator(self,mesh): + self._check(mesh) + if self._validator is not None: return self._validator + def validate(state,*,previous_state,native_view,displacement,phase): + self._validate(mesh,state,displacement) + if phase=='committed': + if previous_state is not None: raise ValueError('native fibre committed validation phase') + self._pose(state,native_view,committed=True) + elif phase=='trial': + previous=self._validate(mesh,previous_state); self._pose(previous,native_view,committed=True); self._pose(state,native_view,committed=False) + if state['epoch']!=previous['epoch']+1 or state['previous_state_sha256']!=previous['state_sha256'] or canonical(state['origins'])!=canonical(previous['response'].history): raise ValueError('native fibre accepted-origin linkage') + if not np.array_equal(state['seed_rotations'],previous['response'].rotations) or not np.array_equal(state['seed_resultants'],previous['response'].resultants): raise ValueError('native fibre internal seed linkage') + else: raise ValueError('native fibre validation phase') + self._validator=NativeMaterialValidator(validate) + return self._validator + + def _live(self,context,view,state,*,check_state=True): + if type(context) is not NativeMaterialContext or context.element_id!=self.element_id: raise ValueError('live native fibre material context required') + context.require_view(view) + # This private adapter explicitly binds the actual store's validator, + # not only a numerically identical pose from a different model. + binding=context.store._native_element_bindings.get(self.element_id) + if self._validator is None or binding is None or binding.material_validator is not self._validator: + raise ValueError('foreign native fibre material-store binding') + if check_state and canonical(context.store[self.element_id])!=canonical(state): + raise ValueError('native fibre input is not the current store state') + + def compute_nonlinear_response(self,mesh,material,displacement,state=None,num_layers=1,tangent=True,*,native_rotation_trial=None,native_material_context=None): + self._arguments(mesh,material,num_layers); context=native_material_context; view=native_rotation_trial + self._live(context,view,state); previous=self._validate(mesh,state); self._pose(previous,view,committed=True) + total=_array(displacement,(18,),'native fibre trial displacement'); positions,low=self._coordinates(total) + if not np.array_equal(positions,view.trial_coordinates) or not np.array_equal(total.reshape(3,6)[:,3:],view.trial_rotation_coordinates): raise ValueError('native fibre trial pose mismatch') + seed=previous['response']; origin=seed.history + response=solve_static(self.operator,positions,low,view.trial_rotation_matrices@self.operator.reference.nodal_triads, + origin=origin,initial_rotations=seed.rotations,initial_resultants=seed.resultants,spatial_line_force=np.zeros(3),check=lambda: self._live(context,view,state,check_state=False)) + force,matrix,_=pullback(response.residual,response.hessian,view.rotation_coordinate_increment) + self._live(context,view,state) + candidate=self._state(previous['epoch']+1,total,view.trial_rotation_matrices,origin,seed.rotations,seed.resultants,response,previous['state_sha256']) + return force.copy(),matrix.copy() if tangent else None,candidate + + def compute_stiffness_matrix(self,mesh,material): + return self.init_model_bound_nonlinear_state(mesh,material,1)['response'].hessian.copy() + + def _unsupported(self,*args,**kwargs): raise ValueError('private native fibre static adapter: workflow not qualified') + compute_mass_matrix=_unsupported + compute_geometric_stiffness_matrix=_unsupported + compute_internal_forces=_unsupported + compute_stresses=_unsupported diff --git a/src/anyfesolver/_ge_beam3_native_midpoint.py b/src/anyfesolver/_ge_beam3_native_midpoint.py index f803cdf16..bc3c0f555 100644 --- a/src/anyfesolver/_ge_beam3_native_midpoint.py +++ b/src/anyfesolver/_ge_beam3_native_midpoint.py @@ -1,75 +1,75 @@ -"""Private single-element elastic native midpoint development owner. - -No public finite-speed admission, static codec mutation or physical condensation. -Algebraic nodal-frame velocity slots are inertial placeholders only: stage and -endpoint nodal frames are independent solved coordinates and generally move. -""" -from dataclasses import dataclass -from contextlib import contextmanager -import json +"""Private single-element elastic native midpoint development owner. + +No public finite-speed admission, static codec mutation or physical condensation. +Algebraic nodal-frame velocity slots are inertial placeholders only: stage and +endpoint nodal frames are independent solved coordinates and generally move. +""" +from dataclasses import dataclass +from contextlib import contextmanager +import json from threading import Lock, get_ident -import numpy as np - -from ._ge_beam3_native_analysis import NativeBeamAnalysis -from ._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement -from ._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection -from ._ge_beam3_retained_generalized_state import Context, Program, Mechanical +import numpy as np + +from ._ge_beam3_native_analysis import NativeBeamAnalysis +from ._ge_beam3_native_generalized_element import NativeGeneralizedStaticElement +from ._ge_beam3_generalized_ellipsoid_section import EllipsoidalGeneralizedSection +from ._ge_beam3_retained_generalized_state import Context, Program, Mechanical from ._ge_beam3_dynamic_elastic_state import DynamicElasticContext, _admit_runtime_limit -from ._ge_beam3_native_generalized_loading import DistributedPattern -from ._ge_beam3_native_line_loading import LinePattern -from ._ge_beam3_centered_finite_inertia import ( - evaluate_centered_finite_inertia, PHYSICAL_DOFS, ALGEBRAIC_DOFS) -from ._ge_beam3_p5.algebra import rotation -from ._ge_beam3_p5.chart import exp_chart_terms -from ._ge_beam3_p5.compensated_coordinates import split_sum, validate_pair -from ._ge_beam3_p5_seeded.core import canonical, sha -from ._native_reference_modal import _owned -from .control import cancellation_safe_point - -IMPLEMENTATION_ID = 'DEVELOPMENT_C7_SINGLE_CENTERED_NATIVE_MIDPOINT_V1' - - -@dataclass(frozen=True) -class MidpointState: - mechanical: Mechanical - origins: tuple - histories: tuple - physical_velocity24: np.ndarray - physical_acceleration24: np.ndarray - time: float - epoch: int - predecessor_sha256: str - context_sha256: str - - -@dataclass(frozen=True) -class StageEvaluation: - mechanical: Mechanical - residual: np.ndarray - jacobian: np.ndarray - configuration_map: np.ndarray - physical_velocity24: np.ndarray - physical_acceleration24: np.ndarray - structural_residual: np.ndarray - structural_jacobian: np.ndarray - inertia: object - material_sha256: str - - -@dataclass(frozen=True) -class MidpointCandidate: - endpoint: MidpointState - stage: StageEvaluation - unknown42: np.ndarray - dt: float - predecessor_sha256: str - iterations: int - backtracks: int - stage_residual_norm: float - endpoint_algebraic_norm: float - endpoint_reaction42: np.ndarray - - +from ._ge_beam3_native_generalized_loading import DistributedPattern +from ._ge_beam3_native_line_loading import LinePattern +from ._ge_beam3_centered_finite_inertia import ( + evaluate_centered_finite_inertia, PHYSICAL_DOFS, ALGEBRAIC_DOFS) +from ._ge_beam3_p5.algebra import rotation +from ._ge_beam3_p5.chart import exp_chart_terms +from ._ge_beam3_p5.compensated_coordinates import split_sum, validate_pair +from ._ge_beam3_p5_seeded.core import canonical, sha +from ._native_reference_modal import _owned +from .control import cancellation_safe_point + +IMPLEMENTATION_ID = 'DEVELOPMENT_C7_SINGLE_CENTERED_NATIVE_MIDPOINT_V1' + + +@dataclass(frozen=True) +class MidpointState: + mechanical: Mechanical + origins: tuple + histories: tuple + physical_velocity24: np.ndarray + physical_acceleration24: np.ndarray + time: float + epoch: int + predecessor_sha256: str + context_sha256: str + + +@dataclass(frozen=True) +class StageEvaluation: + mechanical: Mechanical + residual: np.ndarray + jacobian: np.ndarray + configuration_map: np.ndarray + physical_velocity24: np.ndarray + physical_acceleration24: np.ndarray + structural_residual: np.ndarray + structural_jacobian: np.ndarray + inertia: object + material_sha256: str + + +@dataclass(frozen=True) +class MidpointCandidate: + endpoint: MidpointState + stage: StageEvaluation + unknown42: np.ndarray + dt: float + predecessor_sha256: str + iterations: int + backtracks: int + stage_residual_norm: float + endpoint_algebraic_norm: float + endpoint_reaction42: np.ndarray + + @dataclass(frozen=True) class CandidateStageAudit: """Immutable evidence snapshot; never a state/session acceptance credential.""" @@ -92,16 +92,16 @@ class CandidateStageAudit: @dataclass(frozen=True) class EndpointAccounting: - state_sha256: str - time: float - epoch: int - linear_momentum: np.ndarray - linear_momentum_low: np.ndarray - angular_momentum: np.ndarray - angular_momentum_low: np.ndarray - kinetic_energy: float - elastic_energy: float - total_energy: float + state_sha256: str + time: float + epoch: int + linear_momentum: np.ndarray + linear_momentum_low: np.ndarray + angular_momentum: np.ndarray + angular_momentum_low: np.ndarray + kinetic_energy: float + elastic_energy: float + total_energy: float elastic_consistency_witness: float resultant_compatibility18: np.ndarray rank_mass_checks: bytes @@ -120,31 +120,31 @@ class PhysicalLoadAccounting: momentum_origin_high: np.ndarray momentum_origin_low: np.ndarray has_nonpotential_couple: bool - - -class MidpointContext: - """Immutable issued states, ephemeral trials, and atomic accepted replacement. - - Every external operation runs under the exact analysis operation lock. One - homogeneous six-component clamp remains the default legacy route. The - explicit dynamic elastic route also admits zero supports, with the same - spatial stage equations and a disposable shared structural work session. + + +class MidpointContext: + """Immutable issued states, ephemeral trials, and atomic accepted replacement. + + Every external operation runs under the exact analysis operation lock. One + homogeneous six-component clamp remains the default legacy route. The + explicit dynamic elastic route also admits zero supports, with the same + spatial stage equations and a disposable shared structural work session. Legacy/default owners retain120s; explicit dynamic owners capture one bounded duration at construction. No operation resets that clock. - """ - def __init__(self, analysis, *, inertia_order=24, max_iterations=12, + """ + def __init__(self, analysis, *, inertia_order=24, max_iterations=12, max_backtracks=8, structural_owner='legacy_clamp', momentum_origin_high=(0., 0., 0.), momentum_origin_low=(0., 0., 0.), load_pattern=None, stage_residual_tolerance=1e-11, stage_coordinates='increment', runtime_limit_seconds=120.): - if type(analysis) is not NativeBeamAnalysis: - raise ValueError('exact standalone native analysis required') - if (type(inertia_order) is not int or inertia_order not in (4, 8, 24) - or type(max_iterations) is not int or not 1 <= max_iterations <= 12 - or type(max_backtracks) is not int or not 0 <= max_backtracks <= 8): - raise ValueError('bounded exact midpoint settings') - if type(structural_owner) is not str or structural_owner not in ('legacy_clamp', 'dynamic_elastic'): - raise ValueError('explicit private midpoint structural owner required') + if type(analysis) is not NativeBeamAnalysis: + raise ValueError('exact standalone native analysis required') + if (type(inertia_order) is not int or inertia_order not in (4, 8, 24) + or type(max_iterations) is not int or not 1 <= max_iterations <= 12 + or type(max_backtracks) is not int or not 0 <= max_backtracks <= 8): + raise ValueError('bounded exact midpoint settings') + if type(structural_owner) is not str or structural_owner not in ('legacy_clamp', 'dynamic_elastic'): + raise ValueError('explicit private midpoint structural owner required') if type(stage_residual_tolerance) not in (int, float): raise ValueError('positive finite midpoint stage residual tolerance required') try: @@ -165,28 +165,28 @@ def __init__(self, analysis, *, inertia_order=24, max_iterations=12, if structural_owner != 'dynamic_elastic' and self.runtime_limit_seconds != 120.: raise ValueError('extended runtime requires the dynamic elastic owner') self.structural_owner = structural_owner - self._selected_owner = structural_owner - self.momentum_origin_high = _owned(momentum_origin_high) - self.momentum_origin_low = _owned(momentum_origin_low) - if self.momentum_origin_high.shape != (3,) or self.momentum_origin_low.shape != (3,): - raise ValueError('complete momentum origin pairs required') - for high, low in zip(self.momentum_origin_high, self.momentum_origin_low): - validate_pair(float(high), float(low)) - if structural_owner == 'legacy_clamp' and (np.any(self.momentum_origin_high) or np.any(self.momentum_origin_low)): - raise ValueError('legacy midpoint retains its zero momentum origin') + self._selected_owner = structural_owner + self.momentum_origin_high = _owned(momentum_origin_high) + self.momentum_origin_low = _owned(momentum_origin_low) + if self.momentum_origin_high.shape != (3,) or self.momentum_origin_low.shape != (3,): + raise ValueError('complete momentum origin pairs required') + for high, low in zip(self.momentum_origin_high, self.momentum_origin_low): + validate_pair(float(high), float(low)) + if structural_owner == 'legacy_clamp' and (np.any(self.momentum_origin_high) or np.any(self.momentum_origin_low)): + raise ValueError('legacy midpoint retains its zero momentum origin') self._dynamic = (DynamicElasticContext(analysis, max_iterations=max_iterations, max_backtracks=max_backtracks, runtime_limit_seconds=self.runtime_limit_seconds) if structural_owner == 'dynamic_elastic' else None) - self._work_session = None - with analysis._operation(): - elements = analysis._elements - if (len(elements) != 1 or type(elements[0]) is not NativeGeneralizedStaticElement - or type(elements[0].section) is not EllipsoidalGeneralizedSection - or len(analysis.model.mesh.nodes) != 3 - or analysis.model.mesh.dof_manager.total_dofs != 18): - raise ValueError('one centered generalized element/full 42 order required') - if structural_owner == 'legacy_clamp' and analysis._admit_boundaries() != tuple(range(6)): - raise ValueError('explicit homogeneous full clamp on first ordered node required') + self._work_session = None + with analysis._operation(): + elements = analysis._elements + if (len(elements) != 1 or type(elements[0]) is not NativeGeneralizedStaticElement + or type(elements[0].section) is not EllipsoidalGeneralizedSection + or len(analysis.model.mesh.nodes) != 3 + or analysis.model.mesh.dof_manager.total_dofs != 18): + raise ValueError('one centered generalized element/full 42 order required') + if structural_owner == 'legacy_clamp' and analysis._admit_boundaries() != tuple(range(6)): + raise ValueError('explicit homogeneous full clamp on first ordered node required') self.analysis = analysis self.element = elements[0] if load_pattern is not None and (structural_owner != 'dynamic_elastic' @@ -204,40 +204,40 @@ def __init__(self, analysis, *, inertia_order=24, max_iterations=12, raise ValueError('supplied constant physical load changed during ownership') self.load_pattern.require(analysis.model.mesh) self._captured_load = canonical(self.load_pattern) - self.inertia_order = inertia_order - self.max_iterations = max_iterations - self.max_backtracks = max_backtracks - self._static = None - if structural_owner == 'legacy_clamp': - self._static = Context(analysis.model, Program((0.,), - DistributedPattern(LinePattern(()), ()))) - if (self._static.count != 42 or self._static.slots != [list(range(42))] - or self._static.nodal_count != 18): - raise ValueError('exact one-element canonical mixed ordering required') - free = self._static.free - self.fixed = self._static.fixed - self._reference_mechanical = self._static.initial.mechanical - self._reference_origins = self._static.initial.histories - self.scale = self._static.scale - self.length = self._static.length + self.inertia_order = inertia_order + self.max_iterations = max_iterations + self.max_backtracks = max_backtracks + self._static = None + if structural_owner == 'legacy_clamp': + self._static = Context(analysis.model, Program((0.,), + DistributedPattern(LinePattern(()), ()))) + if (self._static.count != 42 or self._static.slots != [list(range(42))] + or self._static.nodal_count != 18): + raise ValueError('exact one-element canonical mixed ordering required') + free = self._static.free + self.fixed = self._static.fixed + self._reference_mechanical = self._static.initial.mechanical + self._reference_origins = self._static.initial.histories + self.scale = self._static.scale + self.length = self._static.length else: free = self._dynamic.free self.fixed = self._dynamic.fixed self._reference_mechanical = self._dynamic._reference.mechanical self._reference_origins = self._dynamic.origins self.scale, self.length = self._gate_inputs() - self.free = np.frombuffer(np.asarray(free, dtype=int).tobytes(), dtype=int) - self.physical_free = tuple(i for i in PHYSICAL_DOFS if i in self.free) - self.algebraic_free = tuple(i for i in ALGEBRAIC_DOFS if i in self.free) - expected = (15, 27) if not self.fixed else (12, 24) - if (len(self.physical_free), len(self.algebraic_free)) != expected: - raise ValueError('explicit physical/algebraic supported partition required') - self._identity = sha(self._identity_data()) - self._current = None - self._visible_current = None - self._current_bytes = None - self._issued = {} - self._candidates = {} + self.free = np.frombuffer(np.asarray(free, dtype=int).tobytes(), dtype=int) + self.physical_free = tuple(i for i in PHYSICAL_DOFS if i in self.free) + self.algebraic_free = tuple(i for i in ALGEBRAIC_DOFS if i in self.free) + expected = (15, 27) if not self.fixed else (12, 24) + if (len(self.physical_free), len(self.algebraic_free)) != expected: + raise ValueError('explicit physical/algebraic supported partition required') + self._identity = sha(self._identity_data()) + self._current = None + self._visible_current = None + self._current_bytes = None + self._issued = {} + self._candidates = {} self._initial_checks = None self._transaction_lock = Lock() self._restore_checks = None @@ -246,27 +246,27 @@ def __init__(self, analysis, *, inertia_order=24, max_iterations=12, from ._ge_beam3_native_dynamic_restart import contract self._restart_contract = canonical(contract(self)) self._captured_restart_contract = self._restart_contract - - @property - def initial_checks(self): - return None if self._initial_checks is None else json.loads(self._initial_checks) - - @property + + @property + def initial_checks(self): + return None if self._initial_checks is None else json.loads(self._initial_checks) + + @property def current(self): return self._visible_current @property def restore_checks(self): return None if self._restore_checks is None else json.loads(self._restore_checks) - + def _identity_data(self): - # The default route's payload is unchanged from its frozen V3 owner. - data = dict(implementation=IMPLEMENTATION_ID, - analysis=self.analysis.identity, inertia_order=self.inertia_order, - iterations=self.max_iterations, backtracks=self.max_backtracks, - physical=self.physical_free, algebraic=self.algebraic_free, free=self.free) - if self.structural_owner == 'legacy_clamp': - data['static_context'] = self._static.identity + # The default route's payload is unchanged from its frozen V3 owner. + data = dict(implementation=IMPLEMENTATION_ID, + analysis=self.analysis.identity, inertia_order=self.inertia_order, + iterations=self.max_iterations, backtracks=self.max_backtracks, + physical=self.physical_free, algebraic=self.algebraic_free, free=self.free) + if self.structural_owner == 'legacy_clamp': + data['static_context'] = self._static.identity else: data.update(structural_owner='dynamic_elastic', dynamic_context=self._dynamic._identity, momentum_origin_high=self.momentum_origin_high, momentum_origin_low=self.momentum_origin_low) @@ -296,32 +296,32 @@ def _gate_inputs(self): scales[6*node+3:6*node+6] = length scales[18:30] = length return _owned(scales), length - - @contextmanager - def _work_operation(self): - if self.structural_owner == 'legacy_clamp': - with self.analysis._operation(): - yield - else: - with self._dynamic.session() as session: - self._work_session = session - try: - yield - finally: - self._work_session = None - - @contextmanager - def _atomic_operation(self): - # The analysis exit guard runs after the operation body. Keep tentative - # publication private until that guard succeeds; restore all issuance - # bookkeeping if it fails. A separate nonblocking lock prevents another - # midpoint operation entering between analysis-lock release and rollback. - if not self._transaction_lock.acquire(blocking=False): - raise ValueError('midpoint context is already in use') - snapshot = None - try: - try: - with self._work_operation(): + + @contextmanager + def _work_operation(self): + if self.structural_owner == 'legacy_clamp': + with self.analysis._operation(): + yield + else: + with self._dynamic.session() as session: + self._work_session = session + try: + yield + finally: + self._work_session = None + + @contextmanager + def _atomic_operation(self): + # The analysis exit guard runs after the operation body. Keep tentative + # publication private until that guard succeeds; restore all issuance + # bookkeeping if it fails. A separate nonblocking lock prevents another + # midpoint operation entering between analysis-lock release and rollback. + if not self._transaction_lock.acquire(blocking=False): + raise ValueError('midpoint context is already in use') + snapshot = None + try: + try: + with self._work_operation(): snapshot = (self._current, self._visible_current, self._current_bytes, self._issued.copy(), self._candidates.copy(), self._initial_checks, self._restore_checks) @@ -330,7 +330,7 @@ def _atomic_operation(self): if self._selected_owner == 'dynamic_elastic': from ._ge_beam3_native_dynamic_restart import require_contract require_contract(self) - yield + yield # A setting mutation during native/session exit cannot publish # a state under the former numerical acceptance contract. self._guard_stage_residual_tolerance() @@ -345,15 +345,15 @@ def _atomic_operation(self): self._guard_runtime_limit() self._dynamic._guard_deadline() self._visible_current = self._current - except BaseException: - if snapshot is not None: + except BaseException: + if snapshot is not None: (self._current, self._visible_current, self._current_bytes, self._issued, self._candidates, self._initial_checks, self._restore_checks) = snapshot - raise - finally: - self._transaction_lock.release() - + raise + finally: + self._transaction_lock.release() + def _guard_stage_residual_tolerance(self): if (type(self.stage_residual_tolerance) is not float or not np.isfinite(self.stage_residual_tolerance) or self.stage_residual_tolerance <= 0. @@ -381,9 +381,9 @@ def _guard(self, token=None, stage='midpoint.guard'): self._guard_stage_coordinates() self._guard_runtime_limit() if self.structural_owner != self._selected_owner: - raise ValueError('midpoint structural route changed') - if self.structural_owner == 'legacy_clamp': - self._static.guard() + raise ValueError('midpoint structural route changed') + if self.structural_owner == 'legacy_clamp': + self._static.guard() else: self._dynamic._guard() if self.load_pattern is not None: @@ -395,32 +395,32 @@ def _guard(self, token=None, stage='midpoint.guard'): scale, length = self._gate_inputs() if canonical(dict(scale=self.scale, length=self.length)) != canonical(dict(scale=scale, length=length)): raise ValueError('midpoint acceptance scale/length changed') - expected = sha(self._identity_data()) - if self._identity != expected or self.analysis._elements != (self.element,): - raise ValueError('midpoint context definition/settings changed') - - def _require_current(self, state): - record = self._issued.get(id(state)) - if (type(state) is not MidpointState or state is not self.current - or record is None or record[0] is not state - or canonical(state) != record[1] or record[1] != self._current_bytes - or state.context_sha256 != self._identity): - raise ValueError('current issued immutable midpoint predecessor required') - return sha(state) - + expected = sha(self._identity_data()) + if self._identity != expected or self.analysis._elements != (self.element,): + raise ValueError('midpoint context definition/settings changed') + + def _require_current(self, state): + record = self._issued.get(id(state)) + if (type(state) is not MidpointState or state is not self.current + or record is None or record[0] is not state + or canonical(state) != record[1] or record[1] != self._current_bytes + or state.context_sha256 != self._identity): + raise ValueError('current issued immutable midpoint predecessor required') + return sha(state) + def _structural(self, mechanical, origins): if self.structural_owner == 'dynamic_elastic': work = self._loaded_work(mechanical, origins) return work.residual, work.spatial_jacobian, work.material_sha256 - r, j, _, responses, _ = self._static.assemble(mechanical, 0., origins) - for response, origin in zip(responses, origins): - material = json.loads(response.material) - if canonical(response.history) != canonical(origin): - raise ValueError('midpoint first slice requires unchanged elastic history') - if any(row['branch'] != 'ELASTIC' - or any(value != 0. for pair in row['dissipation'] for value in pair) - for row in material['stations']): - raise ValueError('midpoint first slice requires strictly elastic stations') + r, j, _, responses, _ = self._static.assemble(mechanical, 0., origins) + for response, origin in zip(responses, origins): + material = json.loads(response.material) + if canonical(response.history) != canonical(origin): + raise ValueError('midpoint first slice requires unchanged elastic history') + if any(row['branch'] != 'ELASTIC' + or any(value != 0. for pair in row['dissipation'] for value in pair) + for row in material['stations']): + raise ValueError('midpoint first slice requires strictly elastic stations') return r, j, sha([response.material.decode() for response in responses]) def _loaded_work(self, mechanical, origins): @@ -431,105 +431,105 @@ def _loaded_work(self, mechanical, origins): or np.any(work.external_spatial_jacobian42[:, a])): raise ValueError('physical loading must have exactly zero algebraic work/tangent') return work - - def _inertia(self, mechanical, velocity, acceleration): - kwargs = {} - if self.structural_owner == 'dynamic_elastic': - kwargs = dict(momentum_origin_high=self.momentum_origin_high, - momentum_origin_low=self.momentum_origin_low) - result = evaluate_centered_finite_inertia(self.element.operator.reference, - self.analysis._inertias[self.element.element_id], - mechanical.positions, mechanical.position_low, - mechanical.cell_rotations[0], velocity, acceleration, - order=self.inertia_order, **kwargs) - a = list(ALGEBRAIC_DOFS) - for matrix in (result.mixed_mass, result.mixed_velocity_derivative, - result.mixed_configuration_derivative): - if np.any(matrix[a, :]) or np.any(matrix[:, a]): - raise ValueError('algebraic inertia derivative must be exactly zero') - if np.any(result.mixed_inertia[a]) or np.any(result.mixed_generalized_momentum[a]): - raise ValueError('algebraic inertia must be exactly zero') - return result - - def _block_checks(self, j, inertia): - z = list(self.algebraic_free) - p = list(self.physical_free) - cz = j[np.ix_(z, z)] - singular = np.linalg.svd(cz, compute_uv=False) - tolerance = 64*np.finfo(float).eps*len(z)*singular[0] - if not np.isfinite(singular).all() or singular[-1] <= tolerance: - raise ValueError('endpoint algebraic C_z singular: no time step admitted') - mass = inertia.mixed_mass[np.ix_(p, p)] - if np.linalg.norm(mass-mass.T) > 64*np.finfo(float).eps*np.linalg.norm(mass): - raise ValueError('physical mass symmetry contract failed') - np.linalg.cholesky((mass+mass.T)/2) - eigenvalues = np.linalg.eigvalsh((mass+mass.T)/2) - return dict(algebraic_rank=len(z), algebraic_sigma_min=float(singular[-1]), - algebraic_sigma_max=float(singular[0]), - algebraic_condition=float(singular[0]/singular[-1]), - physical_mass_min_eigenvalue=float(eigenvalues[0]), - physical_mass_max_eigenvalue=float(eigenvalues[-1]), - physical_mass_condition=float(eigenvalues[-1]/eigenvalues[0])) - + + def _inertia(self, mechanical, velocity, acceleration): + kwargs = {} + if self.structural_owner == 'dynamic_elastic': + kwargs = dict(momentum_origin_high=self.momentum_origin_high, + momentum_origin_low=self.momentum_origin_low) + result = evaluate_centered_finite_inertia(self.element.operator.reference, + self.analysis._inertias[self.element.element_id], + mechanical.positions, mechanical.position_low, + mechanical.cell_rotations[0], velocity, acceleration, + order=self.inertia_order, **kwargs) + a = list(ALGEBRAIC_DOFS) + for matrix in (result.mixed_mass, result.mixed_velocity_derivative, + result.mixed_configuration_derivative): + if np.any(matrix[a, :]) or np.any(matrix[:, a]): + raise ValueError('algebraic inertia derivative must be exactly zero') + if np.any(result.mixed_inertia[a]) or np.any(result.mixed_generalized_momentum[a]): + raise ValueError('algebraic inertia must be exactly zero') + return result + + def _block_checks(self, j, inertia): + z = list(self.algebraic_free) + p = list(self.physical_free) + cz = j[np.ix_(z, z)] + singular = np.linalg.svd(cz, compute_uv=False) + tolerance = 64*np.finfo(float).eps*len(z)*singular[0] + if not np.isfinite(singular).all() or singular[-1] <= tolerance: + raise ValueError('endpoint algebraic C_z singular: no time step admitted') + mass = inertia.mixed_mass[np.ix_(p, p)] + if np.linalg.norm(mass-mass.T) > 64*np.finfo(float).eps*np.linalg.norm(mass): + raise ValueError('physical mass symmetry contract failed') + np.linalg.cholesky((mass+mass.T)/2) + eigenvalues = np.linalg.eigvalsh((mass+mass.T)/2) + return dict(algebraic_rank=len(z), algebraic_sigma_min=float(singular[-1]), + algebraic_sigma_max=float(singular[0]), + algebraic_condition=float(singular[0]/singular[-1]), + physical_mass_min_eigenvalue=float(eigenvalues[0]), + physical_mass_max_eigenvalue=float(eigenvalues[-1]), + physical_mass_condition=float(eigenvalues[-1]/eigenvalues[0])) + def _norm(self, residual, indices): scale, _ = self._gate_inputs() return float(np.linalg.norm((residual/scale)[list(indices)])) - + def _correction(self, mechanical, step): _, length = self._gate_inputs() nodal = step[:18].reshape(3, 6) return max(float(np.linalg.norm(nodal[:, :3]))/length, - float(np.linalg.norm(nodal[:, 3:])), float(np.linalg.norm(step[18:24])), - float(np.linalg.norm(step[24:]))/max(1., float(np.linalg.norm(mechanical.resultants)))) - - def _solve_algebraic(self, mechanical, origins, token): - if self.structural_owner == 'dynamic_elastic': + float(np.linalg.norm(nodal[:, 3:])), float(np.linalg.norm(step[18:24])), + float(np.linalg.norm(step[24:]))/max(1., float(np.linalg.norm(mechanical.resultants)))) + + def _solve_algebraic(self, mechanical, origins, token): + if self.structural_owner == 'dynamic_elastic': state = self._work_session.trial_state(mechanical, origins=origins) result = self._work_session.consistent(state, pattern=self.load_pattern, parameter=0. if self.load_pattern is None else 1., cancellation_token=token) - return (result.state.mechanical, result.work.residual, - result.work.spatial_jacobian, result.residual_norm, result.work.material_sha256) - z = list(self.algebraic_free) - for iteration in range(self.max_iterations+1): - self._guard(token, 'midpoint.algebraic') - r, j, material = self._structural(mechanical, origins) - inertia = self._inertia(mechanical, np.zeros(24), np.zeros(24)) - self._block_checks(j, inertia) - step = np.zeros(42) - step[z] = np.linalg.solve(j[np.ix_(z, z)], -r[z]) - norm = self._norm(r, z) - if norm <= 1e-11 and self._correction(mechanical, step) <= 1e-11: - return mechanical, r, j, norm, material - if iteration == self.max_iterations: - raise ValueError('endpoint algebraic iteration limit') - for cut in range(self.max_backtracks+1): - self._guard(token, 'midpoint.algebraic.trial') - proposed = self._static.advance(mechanical, step*(2.**(-cut))) - rt, _, _ = self._structural(proposed, origins) - if self._norm(rt, z) < norm: - mechanical = proposed - break - else: - raise ValueError('endpoint algebraic residual backtracking failed') - raise AssertionError('bounded algebraic loop') - - def _endpoint_acceleration(self, mechanical, origins, velocity): - r, j, _ = self._structural(mechanical, origins) - inertia = self._inertia(mechanical, velocity, np.zeros(24)) - checks = self._block_checks(j, inertia) - p = list(self.physical_free) - acceleration = np.zeros(24) - acceleration[p] = np.linalg.solve(inertia.mixed_mass[np.ix_(p, p)], - -(r+inertia.mixed_inertia)[p]) - dynamic = self._inertia(mechanical, velocity, acceleration) - reaction = r+dynamic.mixed_inertia - if self._norm(reaction, p) > 1e-11: - raise ValueError('endpoint physical acceleration residual failed') - return _owned(acceleration), _owned(reaction), checks - - def initialize(self, mechanical=None, physical_velocity24=None, *, time=0., - cancellation_token=None): - with self._atomic_operation(): + return (result.state.mechanical, result.work.residual, + result.work.spatial_jacobian, result.residual_norm, result.work.material_sha256) + z = list(self.algebraic_free) + for iteration in range(self.max_iterations+1): + self._guard(token, 'midpoint.algebraic') + r, j, material = self._structural(mechanical, origins) + inertia = self._inertia(mechanical, np.zeros(24), np.zeros(24)) + self._block_checks(j, inertia) + step = np.zeros(42) + step[z] = np.linalg.solve(j[np.ix_(z, z)], -r[z]) + norm = self._norm(r, z) + if norm <= 1e-11 and self._correction(mechanical, step) <= 1e-11: + return mechanical, r, j, norm, material + if iteration == self.max_iterations: + raise ValueError('endpoint algebraic iteration limit') + for cut in range(self.max_backtracks+1): + self._guard(token, 'midpoint.algebraic.trial') + proposed = self._static.advance(mechanical, step*(2.**(-cut))) + rt, _, _ = self._structural(proposed, origins) + if self._norm(rt, z) < norm: + mechanical = proposed + break + else: + raise ValueError('endpoint algebraic residual backtracking failed') + raise AssertionError('bounded algebraic loop') + + def _endpoint_acceleration(self, mechanical, origins, velocity): + r, j, _ = self._structural(mechanical, origins) + inertia = self._inertia(mechanical, velocity, np.zeros(24)) + checks = self._block_checks(j, inertia) + p = list(self.physical_free) + acceleration = np.zeros(24) + acceleration[p] = np.linalg.solve(inertia.mixed_mass[np.ix_(p, p)], + -(r+inertia.mixed_inertia)[p]) + dynamic = self._inertia(mechanical, velocity, acceleration) + reaction = r+dynamic.mixed_inertia + if self._norm(reaction, p) > 1e-11: + raise ValueError('endpoint physical acceleration residual failed') + return _owned(acceleration), _owned(reaction), checks + + def initialize(self, mechanical=None, physical_velocity24=None, *, time=0., + cancellation_token=None): + with self._atomic_operation(): return self._initialize_state(mechanical, physical_velocity24, time=time, cancellation_token=cancellation_token) @@ -583,11 +583,11 @@ def _require_prepared_origin(self, state): or canonical(state) != record[1] or record[1] != self._current_bytes or state.context_sha256 != self._identity): raise ValueError('issued immutable prepared native origin required') - + def _stage(self, accepted, u, h, token=None): - self._guard(token, 'midpoint.stage') - self._require_current(accepted) - u = np.asarray(u) + self._guard(token, 'midpoint.stage') + self._require_current(accepted) + u = np.asarray(u) if u.shape != (42,) or u.dtype != np.float64 or not np.isfinite(u).all() or np.any(u[list(self.fixed)]): raise ValueError('supported finite binary64 midpoint unknown42 required') p = list(self.physical_free) @@ -598,10 +598,10 @@ def _stage(self, accepted, u, h, token=None): if acceleration_chart: physical_increment[p] = h*accepted.physical_velocity24[p]+(.5*h*h)*u[p] s = {k: v.copy() for k, v in accepted.mechanical.descriptor().items()} - a = np.eye(42) - for node in range(3): - first = 6*node - for axis in range(3): + a = np.eye(42) + for node in range(3): + first = 6*node + for axis in range(3): terms = (float(s['positions'][node, axis]), float(s['position_low'][node, axis])) if acceleration_chart: terms += (.5*h*float(accepted.physical_velocity24[first+axis]), @@ -609,20 +609,20 @@ def _stage(self, accepted, u, h, token=None): else: terms += (.5*float(u[first+axis]),) s['positions'][node, axis], s['position_low'][node, axis] = split_sum(terms) - a[first:first+3, first:first+3] *= .5 - eta = u[first+3:first+6] - s['nodal_frames'][node] = rotation(eta)@accepted.mechanical.nodal_frames[node] - a[first+3:first+6, first+3:first+6] = exp_chart_terms(eta)[0] - for cell in (0, 1): - first = 18+3*cell + a[first:first+3, first:first+3] *= .5 + eta = u[first+3:first+6] + s['nodal_frames'][node] = rotation(eta)@accepted.mechanical.nodal_frames[node] + a[first+3:first+6, first+3:first+6] = exp_chart_terms(eta)[0] + for cell in (0, 1): + first = 18+3*cell half = .5*physical_increment[first:first+3] - s['cell_rotations'][0, cell] = rotation(half)@accepted.mechanical.cell_rotations[0, cell] + s['cell_rotations'][0, cell] = rotation(half)@accepted.mechanical.cell_rotations[0, cell] a[first:first+3, first:first+3] = .5*exp_chart_terms(half)[0] if acceleration_chart: a[:, p] *= .5*h*h - s['resultants'][0] += u[24:] - mechanical = self._make(s) - velocity = np.zeros(24) + s['resultants'][0] += u[24:] + mechanical = self._make(s) + velocity = np.zeros(24) acceleration = np.zeros(24) if acceleration_chart: velocity[p] = accepted.physical_velocity24[p]+(.5*h)*u[p] @@ -630,46 +630,46 @@ def _stage(self, accepted, u, h, token=None): else: velocity[p] = u[p]/h acceleration[p] = 2*(velocity[p]-accepted.physical_velocity24[p])/h - r, j, material = self._structural(mechanical, accepted.histories) - inertia = self._inertia(mechanical, velocity, acceleration) - vmap = np.zeros((42, 42)) - bmap = np.zeros((42, 42)) + r, j, material = self._structural(mechanical, accepted.histories) + inertia = self._inertia(mechanical, velocity, acceleration) + vmap = np.zeros((42, 42)) + bmap = np.zeros((42, 42)) vmap[p, p] = .5*h if acceleration_chart else 1/h bmap[p, p] = 1. if acceleration_chart else 2/h**2 - jacobian = (j+inertia.mixed_configuration_derivative)@a - jacobian += inertia.mixed_velocity_derivative@vmap+inertia.mixed_mass@bmap - residual = r+inertia.mixed_inertia - if not np.isfinite(jacobian).all() or not np.isfinite(residual).all(): - raise ValueError('nonfinite midpoint stage') - return StageEvaluation(mechanical, _owned(residual), _owned(jacobian), _owned(a), - _owned(velocity), _owned(acceleration), _owned(r), _owned(j), inertia, material) - + jacobian = (j+inertia.mixed_configuration_derivative)@a + jacobian += inertia.mixed_velocity_derivative@vmap+inertia.mixed_mass@bmap + residual = r+inertia.mixed_inertia + if not np.isfinite(jacobian).all() or not np.isfinite(residual).all(): + raise ValueError('nonfinite midpoint stage') + return StageEvaluation(mechanical, _owned(residual), _owned(jacobian), _owned(a), + _owned(velocity), _owned(acceleration), _owned(r), _owned(j), inertia, material) + def evaluate_stage(self, accepted, unknown42, *, dt, cancellation_token=None): """Evaluate the selected chart; physical slots are a_m or increments. Algebraic slots remain frame/resultant increments in both charts. The returned Jacobian differentiates the actual selected unknown42. """ - with self._atomic_operation(): - self._time_step(dt) - return self._stage(accepted, unknown42, dt, cancellation_token) - - @staticmethod - def _time_step(h): - if (type(h) is not float or not np.isfinite(h) or h <= 0. - or h*h == 0. or not np.isfinite(2/(h*h))): - raise ValueError('positive finite typed midpoint dt required') - + with self._atomic_operation(): + self._time_step(dt) + return self._stage(accepted, unknown42, dt, cancellation_token) + + @staticmethod + def _time_step(h): + if (type(h) is not float or not np.isfinite(h) or h <= 0. + or h*h == 0. or not np.isfinite(2/(h*h))): + raise ValueError('positive finite typed midpoint dt required') + def trial(self, accepted, *, dt, cancellation_token=None): with self._atomic_operation(): return self._trial_state(accepted, dt, cancellation_token) def _trial_state(self, accepted, dt, cancellation_token): - self._time_step(dt) - self._guard(cancellation_token, 'midpoint.trial') - predecessor = self._require_current(accepted) - free = list(map(int, self.free)) - p = list(self.physical_free) + self._time_step(dt) + self._guard(cancellation_token, 'midpoint.trial') + predecessor = self._require_current(accepted) + free = list(map(int, self.free)) + p = list(self.physical_free) u = np.zeros(42) acceleration_chart = self.stage_coordinates == 'acceleration' u[p] = (accepted.physical_acceleration24[p] if acceleration_chart @@ -684,37 +684,37 @@ def _trial_state(self, accepted, dt, cancellation_token): # including iterations which reuse that disposable stage. self._guard(cancellation_token, 'midpoint.stage') self._require_current(accepted) - step = np.zeros(42) - step[free] = np.linalg.solve(stage.jacobian[np.ix_(free, free)], -stage.residual[free]) - norm = self._norm(stage.residual, free) + step = np.zeros(42) + step[free] = np.linalg.solve(stage.jacobian[np.ix_(free, free)], -stage.residual[free]) + norm = self._norm(stage.residual, free) correction_step = np.array(step, copy=True) if acceleration_chart: correction_step[p] *= .5*dt*dt if norm <= self.stage_residual_tolerance and self._correction(stage.mechanical, correction_step) <= 1e-11: - break - if iteration == self.max_iterations: - raise ValueError('midpoint stage iteration limit') - for cut in range(self.max_backtracks+1): - self._guard(cancellation_token, 'midpoint.stage.trial') - proposed = u+2.**(-cut)*step - next_stage = self._stage(accepted, proposed, dt, cancellation_token) - backtracks += int(cut > 0) + break + if iteration == self.max_iterations: + raise ValueError('midpoint stage iteration limit') + for cut in range(self.max_backtracks+1): + self._guard(cancellation_token, 'midpoint.stage.trial') + proposed = u+2.**(-cut)*step + next_stage = self._stage(accepted, proposed, dt, cancellation_token) + backtracks += int(cut > 0) if self._norm(next_stage.residual, free) < norm: u = proposed stage = next_stage break - else: - raise ValueError('midpoint stage residual backtracking failed') + else: + raise ValueError('midpoint stage residual backtracking failed') endpoint_step = np.zeros(42) endpoint_step[p] = (dt*accepted.physical_velocity24[p]+(.5*dt*dt)*u[p] if acceleration_chart else u[p]) - if self.structural_owner == 'legacy_clamp': - endpoint_mechanical = self._static.advance(accepted.mechanical, endpoint_step) - else: - high = np.array(accepted.mechanical.positions, copy=True) - low = np.array(accepted.mechanical.position_low, copy=True) - for node in range(3): - for axis in range(3): + if self.structural_owner == 'legacy_clamp': + endpoint_mechanical = self._static.advance(accepted.mechanical, endpoint_step) + else: + high = np.array(accepted.mechanical.positions, copy=True) + low = np.array(accepted.mechanical.position_low, copy=True) + for node in range(3): + for axis in range(3): terms = (float(high[node, axis]), float(low[node, axis])) if acceleration_chart: terms += (dt*float(accepted.physical_velocity24[6*node+axis]), @@ -723,35 +723,35 @@ def _trial_state(self, accepted, dt, cancellation_token): terms += (float(u[6*node+axis]),) high[node, axis], low[node, axis] = split_sum(terms) cells = np.array([rotation(endpoint_step[18+3*c:21+3*c])@accepted.mechanical.cell_rotations[0, c] - for c in (0, 1)]).reshape(1, 2, 3, 3) - endpoint_mechanical = self._make(dict(positions=high, position_low=low, - nodal_frames=accepted.mechanical.nodal_frames, cell_rotations=cells, - resultants=accepted.mechanical.resultants)) - # Stage algebraics are a starting guess, not accepted endpoint data. - endpoint_mechanical = self._make(dict( - positions=endpoint_mechanical.positions, position_low=endpoint_mechanical.position_low, - nodal_frames=stage.mechanical.nodal_frames, - cell_rotations=endpoint_mechanical.cell_rotations, - resultants=stage.mechanical.resultants)) - endpoint_mechanical, _, _, alg_norm, _ = self._solve_algebraic( - endpoint_mechanical, accepted.histories, cancellation_token) - velocity = np.zeros(24) + for c in (0, 1)]).reshape(1, 2, 3, 3) + endpoint_mechanical = self._make(dict(positions=high, position_low=low, + nodal_frames=accepted.mechanical.nodal_frames, cell_rotations=cells, + resultants=accepted.mechanical.resultants)) + # Stage algebraics are a starting guess, not accepted endpoint data. + endpoint_mechanical = self._make(dict( + positions=endpoint_mechanical.positions, position_low=endpoint_mechanical.position_low, + nodal_frames=stage.mechanical.nodal_frames, + cell_rotations=endpoint_mechanical.cell_rotations, + resultants=stage.mechanical.resultants)) + endpoint_mechanical, _, _, alg_norm, _ = self._solve_algebraic( + endpoint_mechanical, accepted.histories, cancellation_token) + velocity = np.zeros(24) velocity[p] = (accepted.physical_velocity24[p]+dt*u[p] if acceleration_chart else 2*stage.physical_velocity24[p]-accepted.physical_velocity24[p]) - acceleration, reaction, _ = self._endpoint_acceleration( - endpoint_mechanical, accepted.histories, velocity) - if not np.isfinite(accepted.time+dt) or accepted.time+dt <= accepted.time: - raise ValueError('midpoint time increment is not representable') - endpoint = MidpointState(endpoint_mechanical, accepted.histories, accepted.histories, - _owned(velocity), acceleration, accepted.time+dt, accepted.epoch+1, - predecessor, self._identity) - candidate = MidpointCandidate(endpoint, stage, _owned(u), dt, predecessor, - iteration, backtracks, norm, alg_norm, reaction) - self._guard(cancellation_token, 'midpoint.trial.ready') - self._require_current(accepted) - self._candidates[id(candidate)] = (candidate, canonical(candidate)) - return candidate - + acceleration, reaction, _ = self._endpoint_acceleration( + endpoint_mechanical, accepted.histories, velocity) + if not np.isfinite(accepted.time+dt) or accepted.time+dt <= accepted.time: + raise ValueError('midpoint time increment is not representable') + endpoint = MidpointState(endpoint_mechanical, accepted.histories, accepted.histories, + _owned(velocity), acceleration, accepted.time+dt, accepted.epoch+1, + predecessor, self._identity) + candidate = MidpointCandidate(endpoint, stage, _owned(u), dt, predecessor, + iteration, backtracks, norm, alg_norm, reaction) + self._guard(cancellation_token, 'midpoint.trial.ready') + self._require_current(accepted) + self._candidates[id(candidate)] = (candidate, canonical(candidate)) + return candidate + def _prepare_trial(self, accepted, *, dt, cancellation_token=None, prepare): """Trusted internal receipt; not a user callback or candidate commit.""" with self._atomic_operation(): @@ -822,18 +822,18 @@ def commit(self, candidate, *, cancellation_token=None): self._guard(cancellation_token, 'midpoint.before_commit') self._require_candidate(candidate) state = candidate.endpoint - self._issued[id(state)] = (state, canonical(state)) - self._current = state - self._current_bytes = canonical(state) - self._candidates.clear() - return state - + self._issued[id(state)] = (state, canonical(state)) + self._current = state + self._current_bytes = canonical(state) + self._candidates.clear() + return state + def discard(self, candidate): - with self._atomic_operation(): - self._guard() - record = self._candidates.get(id(candidate)) - if record is None or record[0] is not candidate or canonical(candidate) != record[1]: - raise ValueError('issued immutable midpoint candidate required') + with self._atomic_operation(): + self._guard() + record = self._candidates.get(id(candidate)) + if record is None or record[0] is not candidate or canonical(candidate) != record[1]: + raise ValueError('issued immutable midpoint candidate required') del self._candidates[id(candidate)] def create_checkpoint(self, *, cancellation_token=None): @@ -908,17 +908,17 @@ def _prepare_restore(self, raw, *, expected_sha256, cancellation_token, prepare) self._guard(cancellation_token, 'midpoint.trajectory_restore.ready') self._require_prepared_origin(state) return state, prepared - - def _make(self, data): - if self.structural_owner == 'legacy_clamp': - return self._static.make(data) - return self._work_session.make(data) - - def endpoint_accounting(self, state): - """Actual endpoint invariants, not instantaneous derivative surrogates.""" - with self._atomic_operation(): - self._guard() - self._require_current(state) + + def _make(self, data): + if self.structural_owner == 'legacy_clamp': + return self._static.make(data) + return self._work_session.make(data) + + def endpoint_accounting(self, state): + """Actual endpoint invariants, not instantaneous derivative surrogates.""" + with self._atomic_operation(): + self._guard() + self._require_current(state) return self._endpoint_accounting(state) def _endpoint_accounting(self, state): diff --git a/src/anyfesolver/_ge_beam3_retained_fibre.py b/src/anyfesolver/_ge_beam3_retained_fibre.py index 37a740ecb..8c6e6cd65 100644 --- a/src/anyfesolver/_ge_beam3_retained_fibre.py +++ b/src/anyfesolver/_ge_beam3_retained_fibre.py @@ -1,36 +1,36 @@ -"""Private finite-rotation retained physical-fibre beam potential. - -Pi(q,p;origin)=p.k(q)-Psi*(p;origin). The geometry is the preserved centered -two-cell kinematic map; material comes from the coupled physical-fibre cell. -No history commit, hidden static condensation or public routing occurs here. -""" -from dataclasses import dataclass -from math import fsum -import numpy as np - -from ._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference -from ._ge_beam3_fibre_cell import FibreCellConjugate, CellHistory -from ._ge_beam3_fibre_section import PhysicalFibreSection -from ._ge_beam3_mixed_ad import Jet2, constant_matrix, matmul, transpose, so3_exp, so3_log -from ._ge_beam3_p5.compensated import compensated_strain -from ._ge_beam3_p5.compensated_coordinates import validate_pair -from ._ge_beam3_p5.algebra import HALVES -from ._ge_beam3_p5.arrays import _array, _frames -from ._native_reference_modal import _owned -from ._ge_beam3_p5_seeded.core import canonical, sha - - -POLICY = 'CANDIDATE_GE_BEAM3_RETAINED_PHYSICAL_FIBRE_V1' - - -@dataclass(frozen=True) -class Evaluation: - potential: float - residual: np.ndarray - hessian: np.ndarray - hessian_low: np.ndarray - kinematics: np.ndarray - history: CellHistory +"""Private finite-rotation retained physical-fibre beam potential. + +Pi(q,p;origin)=p.k(q)-Psi*(p;origin). The geometry is the preserved centered +two-cell kinematic map; material comes from the coupled physical-fibre cell. +No history commit, hidden static condensation or public routing occurs here. +""" +from dataclasses import dataclass +from math import fsum +import numpy as np + +from ._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry as Reference +from ._ge_beam3_fibre_cell import FibreCellConjugate, CellHistory +from ._ge_beam3_fibre_section import PhysicalFibreSection +from ._ge_beam3_mixed_ad import Jet2, constant_matrix, matmul, transpose, so3_exp, so3_log +from ._ge_beam3_p5.compensated import compensated_strain +from ._ge_beam3_p5.compensated_coordinates import validate_pair +from ._ge_beam3_p5.algebra import HALVES +from ._ge_beam3_p5.arrays import _array, _frames +from ._native_reference_modal import _owned +from ._ge_beam3_p5_seeded.core import canonical, sha + + +POLICY = 'CANDIDATE_GE_BEAM3_RETAINED_PHYSICAL_FIBRE_V1' + + +@dataclass(frozen=True) +class Evaluation: + potential: float + residual: np.ndarray + hessian: np.ndarray + hessian_low: np.ndarray + kinematics: np.ndarray + history: CellHistory material: bytes production_qualified: bool = False @@ -39,72 +39,72 @@ class Evaluation: class BoundaryEvaluation(Evaluation): """New-policy-only owned payload; historical Evaluation schema stays fixed.""" trial_material: object = None - - -@dataclass(frozen=True) -class MaterialRecovery: - """Native beam material quantities in J, not the mixed saddle potential.""" - stations: tuple - history: CellHistory - stored_energy: tuple[float, float] - previous_hardening_energy: tuple[float, float] - incremental_dissipation: tuple[float, float] - material_potential: tuple[float, float] - energy_recovery_station_updates: int - - -class RetainedFibreOperator: + + +@dataclass(frozen=True) +class MaterialRecovery: + """Native beam material quantities in J, not the mixed saddle potential.""" + stations: tuple + history: CellHistory + stored_energy: tuple[float, float] + previous_hardening_energy: tuple[float, float] + incremental_dissipation: tuple[float, float] + material_potential: tuple[float, float] + energy_recovery_station_updates: int + + +class RetainedFibreOperator: __slots__ = ('reference', 'section', 'order', 'cell', 'stations', 'identity', '_reference_identity', '_sealed', 'arithmetic_policy', '_arithmetic_capture') - - def __setattr__(self, name, value): - if getattr(self, '_sealed', False): raise AttributeError('retained fibre operator is immutable') - object.__setattr__(self, name, value) - + + def __setattr__(self, name, value): + if getattr(self, '_sealed', False): raise AttributeError('retained fibre operator is immutable') + object.__setattr__(self, name, value) + def __init__(self, reference, section, *, order, arithmetic_policy=None): from ._stiffened_shell_f06_increment_arithmetic import POLICY as compensated if arithmetic_policy is not None and (type(arithmetic_policy) is not str or arithmetic_policy != compensated): raise ValueError('explicit physical fibre arithmetic policy required') - if type(reference) is not Reference or type(section) is not PhysicalFibreSection: - raise ValueError('explicit centered reference and native physical fibre section required') - if type(order) is not int or order not in (4, 8): - raise ValueError('private retained fibre entry supports explicit quadrature order 4 or 8') - self.reference = Reference(reference.coordinates, reference.nodal_triads, - regularity_relative_tolerance=reference._regularity_relative_tolerance, - rotation_tolerance=reference._rotation_tolerance, frame_tolerance=reference._frame_tolerance) - self.section = section; self.order = order - points, weights = np.polynomial.legendre.leggauss(order) - data = []; stations = [] - for cell in (0, 1): - for index, (point, weight) in enumerate(zip(points, weights)): - t = float((point+1)/2); xi = cell-1+t; jacobian = self.reference.jacobian(xi) - measure = float(weight*jacobian/2); frame = _owned(self.reference.frame(xi)) - data.append(dict(cell=cell, t=t, weight=measure, v=(frame.T/jacobian).tolist())) - stations.append((cell, index, xi, measure, frame)) - self.cell = FibreCellConjugate(section, data); self.stations = tuple(stations) - self._reference_identity = self.reference.fingerprint() + if type(reference) is not Reference or type(section) is not PhysicalFibreSection: + raise ValueError('explicit centered reference and native physical fibre section required') + if type(order) is not int or order not in (4, 8): + raise ValueError('private retained fibre entry supports explicit quadrature order 4 or 8') + self.reference = Reference(reference.coordinates, reference.nodal_triads, + regularity_relative_tolerance=reference._regularity_relative_tolerance, + rotation_tolerance=reference._rotation_tolerance, frame_tolerance=reference._frame_tolerance) + self.section = section; self.order = order + points, weights = np.polynomial.legendre.leggauss(order) + data = []; stations = [] + for cell in (0, 1): + for index, (point, weight) in enumerate(zip(points, weights)): + t = float((point+1)/2); xi = cell-1+t; jacobian = self.reference.jacobian(xi) + measure = float(weight*jacobian/2); frame = _owned(self.reference.frame(xi)) + data.append(dict(cell=cell, t=t, weight=measure, v=(frame.T/jacobian).tolist())) + stations.append((cell, index, xi, measure, frame)) + self.cell = FibreCellConjugate(section, data); self.stations = tuple(stations) + self._reference_identity = self.reference.fingerprint() self.identity = sha(dict(formulation_id=POLICY, section=section.identity, reference=self._reference_identity, quadrature=order, cell=self.cell.identity)) self.arithmetic_policy = arithmetic_policy if arithmetic_policy is not None: self.identity = sha(dict(source_operator=self.identity, arithmetic_policy=arithmetic_policy)) self._arithmetic_capture = (self.arithmetic_policy, self.identity) - self._sealed = True - + self._sealed = True + def guard(self): if (self.arithmetic_policy, self.identity) != self._arithmetic_capture: raise ValueError('captured fibre arithmetic policy changed') - if self.reference.fingerprint() != self._reference_identity: - raise ValueError('captured retained fibre reference changed') - + if self.reference.fingerprint() != self._reference_identity: + raise ValueError('captured retained fibre reference changed') + def evaluate(self, positions, position_low, vertices, rotations, resultants, *, origin=None, increment=None, check=None, capture_trial=False, vertices_low=None, rotations_low=None, resultants_low=None): if type(capture_trial) is not bool: raise ValueError('explicit fibre trial capture policy required') - self.guard() - if check is not None: check() - x = _array(positions, (3, 3), 'fibre positions'); low = _array(position_low, (3, 3), 'fibre low positions') - for h, l in zip(x.flat, low.flat): validate_pair(float(h), float(l)) - q = _frames(vertices, 3, 'fibre nodal frames'); u = _frames(rotations, 2, 'fibre cell rotations') + self.guard() + if check is not None: check() + x = _array(positions, (3, 3), 'fibre positions'); low = _array(position_low, (3, 3), 'fibre low positions') + for h, l in zip(x.flat, low.flat): validate_pair(float(h), float(l)) + q = _frames(vertices, 3, 'fibre nodal frames'); u = _frames(rotations, 2, 'fibre cell rotations') p = _array(resultants, (18,), 'fibre retained resultants') if self.arithmetic_policy is not None: if increment is not None: @@ -122,40 +122,40 @@ def evaluate(self, positions, position_low, vertices, rotations, resultants, *, return BoundaryEvaluation(*fields, trial_material=trial_material) if capture_trial else Evaluation(*fields) if any(v is not None for v in (vertices_low, rotations_low, resultants_low)): raise ValueError('native corrections require selected durable compensated policy') - delta = np.zeros(42) if increment is None else _array(increment, (42,), 'fibre chart increment') - angular = [delta[6*n+3:6*n+6] for n in range(3)]+[delta[18+3*c:21+3*c] for c in (0, 1)] - if max(np.linalg.norm(v) for v in angular) >= .9*np.pi: - raise ValueError('retained fibre rotation chart requires cutback') - variables = [Jet2.variable(value, i, 24) for i, value in enumerate(delta[:24])] - made_q = [matmul(so3_exp(variables[6*n+3:6*n+6]), constant_matrix(q[n], 24)) for n in range(3)] - z = []; ell = [] - for cell, (left, right) in enumerate(HALVES): - made_u = matmul(so3_exp(variables[18+3*cell:21+3*cell]), constant_matrix(u[cell], 24)) - z.extend(compensated_strain(made_u, self.reference.coordinates, x, low, variables, left, right)) - for node, sign in ((left, -1), (right, 1)): - frame = matmul(made_u, constant_matrix(self.reference.nodal_triads[node], 24)) - ell.extend(sign*v for v in so3_log(matmul(transpose(frame), made_q[node]))) - values = z+ell; k = np.array([v.value for v in values]); j = np.array([v.gradient for v in values]) - p = p+delta[24:] + delta = np.zeros(42) if increment is None else _array(increment, (42,), 'fibre chart increment') + angular = [delta[6*n+3:6*n+6] for n in range(3)]+[delta[18+3*c:21+3*c] for c in (0, 1)] + if max(np.linalg.norm(v) for v in angular) >= .9*np.pi: + raise ValueError('retained fibre rotation chart requires cutback') + variables = [Jet2.variable(value, i, 24) for i, value in enumerate(delta[:24])] + made_q = [matmul(so3_exp(variables[6*n+3:6*n+6]), constant_matrix(q[n], 24)) for n in range(3)] + z = []; ell = [] + for cell, (left, right) in enumerate(HALVES): + made_u = matmul(so3_exp(variables[18+3*cell:21+3*cell]), constant_matrix(u[cell], 24)) + z.extend(compensated_strain(made_u, self.reference.coordinates, x, low, variables, left, right)) + for node, sign in ((left, -1), (right, 1)): + frame = matmul(made_u, constant_matrix(self.reference.nodal_triads[node], 24)) + ell.extend(sign*v for v in so3_log(matmul(transpose(frame), made_q[node]))) + values = z+ell; k = np.array([v.value for v in values]); j = np.array([v.gradient for v in values]) + p = p+delta[24:] response = self.cell.response(p.tolist(), origin, check=check, **({'capture_trial': True} if capture_trial else {})) trial_material = response.pop('_trial_state', None) - gh, gl = response['gradient'] - compatibility = [fsum((float(v), -h, -l)) for v, h, l in zip(k, gh, gl)] - residual = np.r_[j.T@p, compatibility] - geometric = sum((v.hessian*force for v, force in zip(values, p)), np.zeros((24, 24))) - ch = np.array([row[0] for row in response['hessian']]); cl = np.array([row[1] for row in response['hessian']]) - hessian = np.block([[geometric, j.T], [j, -ch]]) - hessian_low = np.zeros((42, 42)); hessian_low[24:, 24:] = -cl - potential = fsum([*(float(a)*float(b) for a, b in zip(p, k)), - -response['potential'][0][0], -response['potential'][1][0]]) - if not np.isfinite(potential): raise ValueError('finite retained fibre potential required') - self.guard() - if check is not None: check() + gh, gl = response['gradient'] + compatibility = [fsum((float(v), -h, -l)) for v, h, l in zip(k, gh, gl)] + residual = np.r_[j.T@p, compatibility] + geometric = sum((v.hessian*force for v, force in zip(values, p)), np.zeros((24, 24))) + ch = np.array([row[0] for row in response['hessian']]); cl = np.array([row[1] for row in response['hessian']]) + hessian = np.block([[geometric, j.T], [j, -ch]]) + hessian_low = np.zeros((42, 42)); hessian_low[24:, 24:] = -cl + potential = fsum([*(float(a)*float(b) for a, b in zip(p, k)), + -response['potential'][0][0], -response['potential'][1][0]]) + if not np.isfinite(potential): raise ValueError('finite retained fibre potential required') + self.guard() + if check is not None: check() fields = (potential, _owned(residual), _owned(hessian), _owned(hessian_low), _owned(k), response['history'], canonical(response)) return BoundaryEvaluation(*fields, trial_material=trial_material) if capture_trial else Evaluation(*fields) - + def _recovery_input(self, rotations, resultants, rotations_low, resultants_low): u = _frames(rotations, 2, 'retained fibre recovery rotations') p = _array(resultants, (18,), 'retained fibre recovery resultants') @@ -175,35 +175,35 @@ def recover(self, rotations, resultants, *, origin=None, check=None, rotations_l self.guard() u, p, extra = self._recovery_input(rotations, resultants, rotations_low, resultants_low) response = self.cell.response(p.tolist(), origin, check=check, **extra) - rows = self._recovery_rows(u, response) - self.guard() - if check is not None: check() - return rows - - def _recovery_rows(self, u, response): - rows = [] - for (cell, index, xi, weight, ref), fields, history in zip(self.stations, response['stations'], response['history'].stations): - rows.append(dict(cell=cell, station=index, xi=xi, measure=weight, - strain=_owned(fields['strain'][0]), strain_low=_owned(fields['strain'][1]), - resultants=_owned(fields['resultants'][0]), resultants_low=_owned(fields['resultants'][1]), - fibres=fields['fibres'], history=history, reference_frame=ref, - current_frame=_owned(u[cell]@ref), formulation_id=POLICY, - recovery_policy='PAIRED_PHYSICAL_FIBRE_RETAINED_FIELDS_V1')) - return tuple(rows) - + rows = self._recovery_rows(u, response) + self.guard() + if check is not None: check() + return rows + + def _recovery_rows(self, u, response): + rows = [] + for (cell, index, xi, weight, ref), fields, history in zip(self.stations, response['stations'], response['history'].stations): + rows.append(dict(cell=cell, station=index, xi=xi, measure=weight, + strain=_owned(fields['strain'][0]), strain_low=_owned(fields['strain'][1]), + resultants=_owned(fields['resultants'][0]), resultants_low=_owned(fields['resultants'][1]), + fibres=fields['fibres'], history=history, reference_frame=ref, + current_frame=_owned(u[cell]@ref), formulation_id=POLICY, + recovery_policy='PAIRED_PHYSICAL_FIBRE_RETAINED_FIELDS_V1')) + return tuple(rows) + def recover_material(self, rotations, resultants, *, origin=None, check=None, rotations_low=None, resultants_low=None): - """One local solve plus final accepted return-map energy capture. - - Default evaluate/recover payloads and their identities remain unchanged. - The supplied origin is the last accepted material predecessor. - """ + """One local solve plus final accepted return-map energy capture. + + Default evaluate/recover payloads and their identities remain unchanged. + The supplied origin is the last accepted material predecessor. + """ self.guard() u, p, extra = self._recovery_input(rotations, resultants, rotations_low, resultants_low) response = self.cell.response(p.tolist(), origin, check=check, include_energy=True, **extra) - rows = self._recovery_rows(u, response) - self.guard() - if check is not None: check() - return MaterialRecovery(rows, response['history'], response['stored_energy'], - response['previous_hardening_energy'], response['incremental_dissipation'], - tuple(value[0] for value in response['material_potential']), - response['energy_recovery_station_updates']) + rows = self._recovery_rows(u, response) + self.guard() + if check is not None: check() + return MaterialRecovery(rows, response['history'], response['stored_energy'], + response['previous_hardening_energy'], response['incremental_dissipation'], + tuple(value[0] for value in response['material_potential']), + response['energy_recovery_station_updates']) diff --git a/src/anyfesolver/_ge_beam3_variational_shell.py b/src/anyfesolver/_ge_beam3_variational_shell.py index 2aaf2a8fd..289b14b60 100644 --- a/src/anyfesolver/_ge_beam3_variational_shell.py +++ b/src/anyfesolver/_ge_beam3_variational_shell.py @@ -1,57 +1,57 @@ -"""Private conservative shell pullback for the GE-B3 connection successor. - -Unchanged local Q4/S3 operators supply forces, material history and tangent. -The new connection policy differentiates the COMPLETE deformational map, not -just its rigid rotation. It neither replaces the existing corotational route -nor grants production qualification. See GE_BEAM3_VARIATIONAL_SHELL_MAP.md. -""" -import numpy as np - -from ._ge_beam3_mixed_ad import Jet2, constant_matrix, matmul, matvec, transpose, so3_exp, so3_log -from ._ge_beam3_pose_joint import _exp_terms - -POLICY = 'GE_BEAM3_PROCRUSTES_VARIATIONAL_SHELL_PULLBACK_V2' - - -def _davenport(c): - trace = np.trace(c) - z = np.array([c[2, 1]-c[1, 2], c[0, 2]-c[2, 0], c[1, 0]-c[0, 1]]) - return np.block([[np.array([[trace]]), z[None, :]], - [z[:, None], c+c.T-trace*np.eye(3)]]) - - -def _quaternion_jets(reference, current, *, displacement=None): - """Equal nodal-weight proper Procrustes fit and analytic two derivatives. - -Centered vectors retain their lengths (no unit-vector normalization). The -normalized largest quaternion eigenpair is differentiated implicitly. Only -the top eigenvalue must be simple; repeated lower eigenvalues are harmless. -""" - ref = np.asarray(reference, dtype=float) - x = np.asarray(current if displacement is None else displacement, dtype=float) - if (ref.ndim != 2 or ref.shape[1:] != (3,) or len(ref) not in (3, 4) - or x.shape != ref.shape or not np.isfinite(ref).all() or not np.isfinite(x).all()): - raise ValueError('finite three/four-node shell fit required') - ref = ref-ref.mean(axis=0) - x = x-x.mean(axis=0) - n = 6*len(ref) - # Constant reference scaling improves eigenspace conditioning without - # introducing a displacement-dependent coefficient into differentiation. - scale = np.linalg.norm(ref) - if not np.isfinite(scale) or scale == 0.: - raise ValueError('degenerate reference shell fit') - ref = ref/scale - if displacement is None: - matrix = _davenport((x/scale).T@ref) - else: - # Algebraically the same centered covariance, without forming ref+u. - # Build the linear Davenport contributions separately: subtracting - # O(1) covariance entries would erase tiny antisymmetric increments. - matrix = _davenport(ref.T@ref)+_davenport((x/scale).T@ref) - eigenvalues, vectors = np.linalg.eigh(matrix) - gap = eigenvalues[-1]-eigenvalues[-2] - if not gap > 1e-11*max(np.finfo(float).tiny, np.max(np.abs(eigenvalues))): - raise ValueError('nonunique proper shell fit; refine or cut back') +"""Private conservative shell pullback for the GE-B3 connection successor. + +Unchanged local Q4/S3 operators supply forces, material history and tangent. +The new connection policy differentiates the COMPLETE deformational map, not +just its rigid rotation. It neither replaces the existing corotational route +nor grants production qualification. See GE_BEAM3_VARIATIONAL_SHELL_MAP.md. +""" +import numpy as np + +from ._ge_beam3_mixed_ad import Jet2, constant_matrix, matmul, matvec, transpose, so3_exp, so3_log +from ._ge_beam3_pose_joint import _exp_terms + +POLICY = 'GE_BEAM3_PROCRUSTES_VARIATIONAL_SHELL_PULLBACK_V2' + + +def _davenport(c): + trace = np.trace(c) + z = np.array([c[2, 1]-c[1, 2], c[0, 2]-c[2, 0], c[1, 0]-c[0, 1]]) + return np.block([[np.array([[trace]]), z[None, :]], + [z[:, None], c+c.T-trace*np.eye(3)]]) + + +def _quaternion_jets(reference, current, *, displacement=None): + """Equal nodal-weight proper Procrustes fit and analytic two derivatives. + +Centered vectors retain their lengths (no unit-vector normalization). The +normalized largest quaternion eigenpair is differentiated implicitly. Only +the top eigenvalue must be simple; repeated lower eigenvalues are harmless. +""" + ref = np.asarray(reference, dtype=float) + x = np.asarray(current if displacement is None else displacement, dtype=float) + if (ref.ndim != 2 or ref.shape[1:] != (3,) or len(ref) not in (3, 4) + or x.shape != ref.shape or not np.isfinite(ref).all() or not np.isfinite(x).all()): + raise ValueError('finite three/four-node shell fit required') + ref = ref-ref.mean(axis=0) + x = x-x.mean(axis=0) + n = 6*len(ref) + # Constant reference scaling improves eigenspace conditioning without + # introducing a displacement-dependent coefficient into differentiation. + scale = np.linalg.norm(ref) + if not np.isfinite(scale) or scale == 0.: + raise ValueError('degenerate reference shell fit') + ref = ref/scale + if displacement is None: + matrix = _davenport((x/scale).T@ref) + else: + # Algebraically the same centered covariance, without forming ref+u. + # Build the linear Davenport contributions separately: subtracting + # O(1) covariance entries would erase tiny antisymmetric increments. + matrix = _davenport(ref.T@ref)+_davenport((x/scale).T@ref) + eigenvalues, vectors = np.linalg.eigh(matrix) + gap = eigenvalues[-1]-eigenvalues[-2] + if not gap > 1e-11*max(np.finfo(float).tiny, np.max(np.abs(eigenvalues))): + raise ValueError('nonunique proper shell fit; refine or cut back') q = vectors[:, -1] if displacement is None: inverse = (vectors[:, :-1]/(eigenvalues[-1]-eigenvalues[:-1]))@vectors[:, :-1].T @@ -75,137 +75,137 @@ def _quaternion_jets(reference, current, *, displacement=None): bordered = np.block([[eigenvalue*np.eye(4)-matrix, q[:, None]], [q[None, :], np.zeros((1, 1))]]) inverse = np.linalg.solve(bordered, np.vstack((np.eye(4), np.zeros((1, 4)))))[:4] - derivatives = np.zeros((n, 4, 4)) - derivative_reference = ref if displacement is None else ref-ref.mean(axis=0) - for node, r in enumerate(derivative_reference): - for axis in range(3): - dc = np.zeros((3, 3)); dc[axis] = r/scale - derivatives[6*node+axis] = _davenport(dc) - dq = np.einsum('ab,jbc,c->aj', inverse, derivatives, q) - dl = np.einsum('a,jab,b->j', q, derivatives, q) - reduced = derivatives-dl[:, None, None]*np.eye(4) - rhs = np.einsum('jab,bk->ajk', reduced, dq) - ddq = np.einsum('ab,bjk->ajk', inverse, rhs+rhs.transpose(0, 2, 1)) - ddq -= q[:, None, None]*(dq.T@dq)[None, :, :] - return [Jet2(q[i], dq[i], ddq[i]) for i in range(4)] - - -def rotation_jets(reference, current): - """Proper Procrustes rotation with the historical two-argument contract.""" - w, a, b, d = _quaternion_jets(reference, current) - return [[w*w+a*a-b*b-d*d, 2*(a*b-w*d), 2*(a*d+w*b)], - [2*(a*b+w*d), w*w-a*a+b*b-d*d, 2*(b*d-w*a)], - [2*(a*d-w*b), 2*(b*d+w*a), w*w-a*a-b*b+d*d]] - - + derivatives = np.zeros((n, 4, 4)) + derivative_reference = ref if displacement is None else ref-ref.mean(axis=0) + for node, r in enumerate(derivative_reference): + for axis in range(3): + dc = np.zeros((3, 3)); dc[axis] = r/scale + derivatives[6*node+axis] = _davenport(dc) + dq = np.einsum('ab,jbc,c->aj', inverse, derivatives, q) + dl = np.einsum('a,jab,b->j', q, derivatives, q) + reduced = derivatives-dl[:, None, None]*np.eye(4) + rhs = np.einsum('jab,bk->ajk', reduced, dq) + ddq = np.einsum('ab,bjk->ajk', inverse, rhs+rhs.transpose(0, 2, 1)) + ddq -= q[:, None, None]*(dq.T@dq)[None, :, :] + return [Jet2(q[i], dq[i], ddq[i]) for i in range(4)] + + +def rotation_jets(reference, current): + """Proper Procrustes rotation with the historical two-argument contract.""" + w, a, b, d = _quaternion_jets(reference, current) + return [[w*w+a*a-b*b-d*d, 2*(a*b-w*d), 2*(a*d+w*b)], + [2*(a*b+w*d), w*w-a*a+b*b-d*d, 2*(b*d-w*a)], + [2*(a*d-w*b), 2*(b*d+w*a), w*w-a*a-b*b+d*d]] + + def deformation(reference, displacement, *, stable_translation=False, rotation_anchors=None, stable_rotation=False): - """Value, differential and Hessian of all corotated nodal coordinates.""" - ref = np.asarray(reference, dtype=float) + """Value, differential and Hessian of all corotated nodal coordinates.""" + ref = np.asarray(reference, dtype=float) u = np.asarray(displacement, dtype=float) if type(stable_rotation) is not bool: raise ValueError('typed shell rotation numerical selection required') exponential, logarithm = so3_exp, so3_log if stable_rotation: from ._ge_beam3_g3c_so3_numerics import so3_exp as exponential, so3_log as logarithm - if u.shape != (6*len(ref),) or not np.isfinite(u).all(): - raise ValueError('finite complete shell coordinates required') - n = len(u) - if rotation_anchors is not None: - from ._stiffened_shell_rotation_charts import owned_anchors - rotation_anchors = owned_anchors(rotation_anchors, len(ref)) - if stable_translation: - w, a, b, d = _quaternion_jets( - ref, None, displacement=u.reshape(-1, 6)[:, :3]) - # Unit-quaternion R-I, including its full two derivatives. Avoid - # subtracting one from a near-unit diagonal after rotation evaluation. - increment = [[-2*(b*b+d*d), 2*(a*b-w*d), 2*(a*d+w*b)], - [2*(a*b+w*d), -2*(a*a+d*d), 2*(b*d-w*a)], - [2*(a*d-w*b), 2*(b*d+w*a), -2*(a*a+b*b)]] - rotation = [[increment[i][j]+float(i == j) for j in range(3)] - for i in range(3)] - else: - current = ref+u.reshape(-1, 6)[:, :3] - rotation = rotation_jets(ref, current) - rt = transpose(rotation) - jets = [[Jet2.variable(u[6*i+j], 6*i+j, n) for j in range(6)] for i in range(len(ref))] - x = [[jets[i][j]+(0. if stable_translation else ref[i, j]) - for j in range(3)] for i in range(len(ref))] - centre = [sum(row[j] for row in x)/len(x) for j in range(3)] - refc = ref-ref.mean(axis=0) - values = [] - for i in range(len(ref)): - local = matvec(rt, [x[i][j]-centre[j] for j in range(3)]) - if stable_translation: - rotated_reference = [sum(increment[k][j]*refc[i, k] - for k in range(3)) for j in range(3)] - values.extend(local[j]+rotated_reference[j] for j in range(3)) - else: - values.extend(local[j]-refc[i, j] for j in range(3)) + if u.shape != (6*len(ref),) or not np.isfinite(u).all(): + raise ValueError('finite complete shell coordinates required') + n = len(u) + if rotation_anchors is not None: + from ._stiffened_shell_rotation_charts import owned_anchors + rotation_anchors = owned_anchors(rotation_anchors, len(ref)) + if stable_translation: + w, a, b, d = _quaternion_jets( + ref, None, displacement=u.reshape(-1, 6)[:, :3]) + # Unit-quaternion R-I, including its full two derivatives. Avoid + # subtracting one from a near-unit diagonal after rotation evaluation. + increment = [[-2*(b*b+d*d), 2*(a*b-w*d), 2*(a*d+w*b)], + [2*(a*b+w*d), -2*(a*a+d*d), 2*(b*d-w*a)], + [2*(a*d-w*b), 2*(b*d+w*a), -2*(a*a+b*b)]] + rotation = [[increment[i][j]+float(i == j) for j in range(3)] + for i in range(3)] + else: + current = ref+u.reshape(-1, 6)[:, :3] + rotation = rotation_jets(ref, current) + rt = transpose(rotation) + jets = [[Jet2.variable(u[6*i+j], 6*i+j, n) for j in range(6)] for i in range(len(ref))] + x = [[jets[i][j]+(0. if stable_translation else ref[i, j]) + for j in range(3)] for i in range(len(ref))] + centre = [sum(row[j] for row in x)/len(x) for j in range(3)] + refc = ref-ref.mean(axis=0) + values = [] + for i in range(len(ref)): + local = matvec(rt, [x[i][j]-centre[j] for j in range(3)]) + if stable_translation: + rotated_reference = [sum(increment[k][j]*refc[i, k] + for k in range(3)) for j in range(3)] + values.extend(local[j]+rotated_reference[j] for j in range(3)) + else: + values.extend(local[j]-refc[i, j] for j in range(3)) physical = exponential(jets[i][3:]) - if rotation_anchors is not None: - physical = matmul(physical, constant_matrix(rotation_anchors[i], n)) + if rotation_anchors is not None: + physical = matmul(physical, constant_matrix(rotation_anchors[i], n)) values.extend(logarithm(matmul(rt, physical))) - return (np.array([v.value for v in values]), - np.array([v.gradient for v in values]), - np.array([v.hessian for v in values])) - - -def response(model, element, displacement, origin, layers, *, split=False, - rotation_anchors=None, stable_translation=False): - """Spatial wrench rows, additive columns, and unchanged local trial state. - -g=D.T f; H=D.T K D + sum(f_i Hess(d_i)). Spatial rows then follow -P.T r=g and P.T J=H-dP.T r. No post-hoc symmetrization is performed. -""" - if type(stable_translation) is not bool: - raise ValueError('explicit shell translation arithmetic policy required') - ref = np.array([model.mesh.nodes[i].coords() for i in element.node_ids]) - u = np.asarray(displacement, dtype=float) - local, differential, second = deformation(ref, u, rotation_anchors=rotation_anchors, - stable_translation=stable_translation) - material = model.get_material(element.material_name) - # This successor currently owns virgin elastic shells only. Do not imply - # a conservative potential for active plastic/unsupported section states. - if material.yield_stress != 0. or material.hardening_curve is not None or element.shell_section is not None: - raise ValueError('variational shell successor requires its owned elastic section') - if split and element.num_nodes == 4: - f, k, candidate, components = element.compute_nonlinear_response(model.mesh, material, - local, origin, layers, True, _return_tangent_components=True) - km, kg = components['material'], components['geometric'] - else: - f, k, candidate = element.compute_nonlinear_response(model.mesh, material, - local, origin, layers, True) - # The admitted elastic S3 V2D local strains are linear in local_u. - # Its finite geometric variation belongs entirely to this pullback. - km, kg = k, np.zeros_like(k) - f, k = np.asarray(f), np.asarray(k) - if not np.isfinite(f).all() or not np.isfinite(k).all(): - raise ValueError('nonfinite local shell response') - if np.linalg.norm(k-k.T) > 1e-11*max(1., np.linalg.norm(k)): - raise ValueError('nonconservative local shell tangent') - g = differential.T@f - h = differential.T@k@differential+np.einsum('i,ijk->jk', f, second) - p = np.eye(len(u)); blocks = [] - for node, row in enumerate(u.reshape(-1, 6)): - _, a, da = _exp_terms(row[3:]) - singular = np.linalg.svd(a, compute_uv=False) - if singular[-1] <= 1e-11*max(1., singular[0]): - raise ValueError('singular additive shell chart; owner rebase required') - s = slice(6*node+3, 6*node+6) - p[s, s] = a; blocks.append((s, da)) - residual = np.linalg.solve(p.T, g) - correction = np.zeros_like(h) - for s, da in blocks: - correction[s, s] = np.einsum('ijk,i->jk', da, residual[s]) - tangent = np.linalg.solve(p.T, h-correction) - if split: - inverse = np.linalg.solve(p, np.eye(len(u))) - b = differential@inverse - material = b.T@km@b - geometric = np.linalg.solve(p.T, differential.T@kg@differential - +np.einsum('i,ijk->jk', f, second)-correction)@inverse - if np.linalg.norm(material+geometric-tangent@inverse) > 1e-11*max(1., np.linalg.norm(tangent@inverse)): - raise ValueError('shell variational material/geometric split mismatch') - return residual, tangent, candidate, material, geometric - return residual, tangent, candidate + return (np.array([v.value for v in values]), + np.array([v.gradient for v in values]), + np.array([v.hessian for v in values])) + + +def response(model, element, displacement, origin, layers, *, split=False, + rotation_anchors=None, stable_translation=False): + """Spatial wrench rows, additive columns, and unchanged local trial state. + +g=D.T f; H=D.T K D + sum(f_i Hess(d_i)). Spatial rows then follow +P.T r=g and P.T J=H-dP.T r. No post-hoc symmetrization is performed. +""" + if type(stable_translation) is not bool: + raise ValueError('explicit shell translation arithmetic policy required') + ref = np.array([model.mesh.nodes[i].coords() for i in element.node_ids]) + u = np.asarray(displacement, dtype=float) + local, differential, second = deformation(ref, u, rotation_anchors=rotation_anchors, + stable_translation=stable_translation) + material = model.get_material(element.material_name) + # This successor currently owns virgin elastic shells only. Do not imply + # a conservative potential for active plastic/unsupported section states. + if material.yield_stress != 0. or material.hardening_curve is not None or element.shell_section is not None: + raise ValueError('variational shell successor requires its owned elastic section') + if split and element.num_nodes == 4: + f, k, candidate, components = element.compute_nonlinear_response(model.mesh, material, + local, origin, layers, True, _return_tangent_components=True) + km, kg = components['material'], components['geometric'] + else: + f, k, candidate = element.compute_nonlinear_response(model.mesh, material, + local, origin, layers, True) + # The admitted elastic S3 V2D local strains are linear in local_u. + # Its finite geometric variation belongs entirely to this pullback. + km, kg = k, np.zeros_like(k) + f, k = np.asarray(f), np.asarray(k) + if not np.isfinite(f).all() or not np.isfinite(k).all(): + raise ValueError('nonfinite local shell response') + if np.linalg.norm(k-k.T) > 1e-11*max(1., np.linalg.norm(k)): + raise ValueError('nonconservative local shell tangent') + g = differential.T@f + h = differential.T@k@differential+np.einsum('i,ijk->jk', f, second) + p = np.eye(len(u)); blocks = [] + for node, row in enumerate(u.reshape(-1, 6)): + _, a, da = _exp_terms(row[3:]) + singular = np.linalg.svd(a, compute_uv=False) + if singular[-1] <= 1e-11*max(1., singular[0]): + raise ValueError('singular additive shell chart; owner rebase required') + s = slice(6*node+3, 6*node+6) + p[s, s] = a; blocks.append((s, da)) + residual = np.linalg.solve(p.T, g) + correction = np.zeros_like(h) + for s, da in blocks: + correction[s, s] = np.einsum('ijk,i->jk', da, residual[s]) + tangent = np.linalg.solve(p.T, h-correction) + if split: + inverse = np.linalg.solve(p, np.eye(len(u))) + b = differential@inverse + material = b.T@km@b + geometric = np.linalg.solve(p.T, differential.T@kg@differential + +np.einsum('i,ijk->jk', f, second)-correction)@inverse + if np.linalg.norm(material+geometric-tangent@inverse) > 1e-11*max(1., np.linalg.norm(tangent@inverse)): + raise ValueError('shell variational material/geometric split mismatch') + return residual, tangent, candidate, material, geometric + return residual, tangent, candidate diff --git a/src/anyfesolver/_stiffened_shell_algorithmic_pullback.py b/src/anyfesolver/_stiffened_shell_algorithmic_pullback.py index 86994d58d..2be72e2cf 100644 --- a/src/anyfesolver/_stiffened_shell_algorithmic_pullback.py +++ b/src/anyfesolver/_stiffened_shell_algorithmic_pullback.py @@ -1,38 +1,38 @@ -"""Spatial rows for a complete, fixed-predecessor shell algorithmic pullback.""" - -import numpy as np - -from ._ge_beam3_pose_joint import _exp_terms - - +"""Spatial rows for a complete, fixed-predecessor shell algorithmic pullback.""" + +import numpy as np + +from ._ge_beam3_pose_joint import _exp_terms + + def spatial_response(displacement, force, tangent, differential, second, *, stable_rotation=False): - """Convert D.T f and its complete derivative through the actual chart. - - A consistent material derivative is not an assertion of a plastic energy - potential. No symmetry repair is applied to the algorithmic operator. - """ + """Convert D.T f and its complete derivative through the actual chart. + + A consistent material derivative is not an assertion of a plastic energy + potential. No symmetry repair is applied to the algorithmic operator. + """ u = np.asarray(displacement, dtype=float) if type(stable_rotation) is not bool: raise ValueError('typed shell rotation numerical selection required') exp_terms = _exp_terms if stable_rotation: from ._ge_beam3_g3c_stable.joint import _exp_terms as exp_terms - covector = differential.T@force - derivative = differential.T@tangent@differential+np.einsum( - "i,ijk->jk", force, second) - chart = np.eye(len(u)) - chart_derivatives = [] - for node, row in enumerate(u.reshape(-1, 6)): + covector = differential.T@force + derivative = differential.T@tangent@differential+np.einsum( + "i,ijk->jk", force, second) + chart = np.eye(len(u)) + chart_derivatives = [] + for node, row in enumerate(u.reshape(-1, 6)): _, jacobian, curvature = exp_terms(row[3:]) - singular = np.linalg.svd(jacobian, compute_uv=False) - if singular[-1] <= 1e-11*max(1., singular[0]): - raise ValueError("singular additive shell chart; owner rebase required") - slots = slice(6*node+3, 6*node+6) - chart[slots, slots] = jacobian - chart_derivatives.append((slots, curvature)) - residual = np.linalg.solve(chart.T, covector) - correction = np.zeros((len(u), len(u))) - for slots, curvature in chart_derivatives: - correction[slots, slots] = np.einsum("ijk,i->jk", curvature, residual[slots]) - spatial_tangent = np.linalg.solve(chart.T, derivative-correction) - return residual, spatial_tangent + singular = np.linalg.svd(jacobian, compute_uv=False) + if singular[-1] <= 1e-11*max(1., singular[0]): + raise ValueError("singular additive shell chart; owner rebase required") + slots = slice(6*node+3, 6*node+6) + chart[slots, slots] = jacobian + chart_derivatives.append((slots, curvature)) + residual = np.linalg.solve(chart.T, covector) + correction = np.zeros((len(u), len(u))) + for slots, curvature in chart_derivatives: + correction[slots, slots] = np.einsum("ijk,i->jk", curvature, residual[slots]) + spatial_tangent = np.linalg.solve(chart.T, derivative-correction) + return residual, spatial_tangent diff --git a/src/anyfesolver/_stiffened_shell_arc_checkpoint.py b/src/anyfesolver/_stiffened_shell_arc_checkpoint.py index d60ec948a..8e475a8ec 100644 --- a/src/anyfesolver/_stiffened_shell_arc_checkpoint.py +++ b/src/anyfesolver/_stiffened_shell_arc_checkpoint.py @@ -1,19 +1,19 @@ -"""Experimental arc endpoint framing, distinct from force/displacement history. - -Checksums and controller consistency do not authenticate a loading history. -Mechanical restoration uses the common fixed-predecessor endpoint validator. -""" -import json -from hashlib import sha256 -from dataclasses import asdict -import numpy as np +"""Experimental arc endpoint framing, distinct from force/displacement history. + +Checksums and controller consistency do not authenticate a loading history. +Mechanical restoration uses the common fixed-predecessor endpoint validator. +""" +import json +from hashlib import sha256 +from dataclasses import asdict +import numpy as np from ._stiffened_shell_ge_checkpoint_binary import encode,decode,encode_s3,decode_s3,MAX_CHECKPOINT_BYTES from ._stiffened_shell_arc_metric import (PhysicalChordMetric, NativeDirectorChordMetric, DIRECTOR_METRIC_ID, require_metric_owner, require_director_chart) -from ._stiffened_shell_rotation_charts import physical_frames - -MAGIC=b'ANYSSARC1' -KIND='finite_arc_bl5_coupled' +from ._stiffened_shell_rotation_charts import physical_frames + +MAGIC=b'ANYSSARC1' +KIND='finite_arc_bl5_coupled' POLICY='B3_GE_BL5_PHYSICAL_TANGENT_PLANE_V1_DEV' NATIVE_CHART_POLICY='B3_GE_NATIVE_POINT_ARC_FIXED_SHELL_CHART_V1_DEV' NATIVE_BL5_CHART_POLICY='B3_GE_NATIVE_FIBRE_BL5_ARC_UNREBASED_SHELL_CHART_V1_DEV' @@ -114,11 +114,11 @@ def identities(owner, *, native_version=2): policy.replace('DISPLACEMENT_','TANGENT_PLANE_').replace('_V1_DEV',f'_V{native_version}_DEV')) if getattr(owner, '_curved_material', False): return 'finite_arc_curved_material', 'B3_GE_CURVED_MATERIAL_POINT_TANGENT_PLANE_V1_DEV' - if getattr(owner, '_curved_reference', False): - return 'finite_arc_curved_points', 'B3_GE_CURVED_ELASTIC_POINT_TANGENT_PLANE_V1_DEV' - if owner._bl5_shell_material: - return KIND, POLICY - raise ValueError('admitted material or curved elastic point arc owner required') + if getattr(owner, '_curved_reference', False): + return 'finite_arc_curved_points', 'B3_GE_CURVED_ELASTIC_POINT_TANGENT_PLANE_V1_DEV' + if owner._bl5_shell_material: + return KIND, POLICY + raise ValueError('admitted material or curved elastic point arc owner required') def director_policy(owner): @@ -155,64 +155,64 @@ def metric_from_snapshot(owner,metadata,arrays): metric=PhysicalChordMetric(arrays['metric_weights'],metadata['metric_length']) require_metric_owner(owner,metric) return metric - - -CONTROL_LIMITS=(('max_cutbacks',0,8),('max_attempts',1,64), - ('max_iterations',1,24),('max_backtracks',0,12)) -ATTEMPT_GROUP_KEYS={'requested_radius','amplitude_origin','attempts', - *(name for name,_,_ in CONTROL_LIMITS)} - - -def _validate_attempt_group(group): - if (type(group) is not dict or set(group)!=ATTEMPT_GROUP_KEYS - or any(type(group[k]) is not int or not low<=group[k]<=high - for k,low,high in CONTROL_LIMITS) - or type(group['amplitude_origin']) not in (float,int) - or not np.isfinite(group['amplitude_origin'])): - raise ValueError('arc step controller contract') - requested=group['requested_radius'] - if (type(requested) not in (float,int) or not np.isfinite(requested) - or requested<=0. or not np.isfinite(requested*requested) or requested*requested<=0.): - raise ValueError('arc requested radius') - attempts=group['attempts'] - keys={'radius','accepted','evaluations','linear_solves','rejected_trials','event_cell_evaluations','failure'} - if type(attempts) is not list or not 1<=len(attempts)<=min(group['max_cutbacks']+1,group['max_attempts']): - raise ValueError('bounded arc step attempts required') - for i,row in enumerate(attempts): - if (type(row) is not dict or set(row)!=keys or type(row['accepted']) is not bool - or row['accepted']!=(i==len(attempts)-1) - or type(row['radius']) not in (float,int) or row['radius']!=requested*.5**i - or not np.isfinite(row['radius']*row['radius']) or row['radius']*row['radius']<=0. - or any(type(row[k]) is not int or not 0<=row[k]<=2**63-1 for k in - ('evaluations','linear_solves','rejected_trials','event_cell_evaluations')) - or row['evaluations']<1 or row['linear_solves']<1 - or row['linear_solves']>group['max_iterations']+1 - or row['rejected_trials']>group['max_iterations']*(group['max_backtracks']+1) - or row['evaluations']>2+group['max_iterations']*(group['max_backtracks']+1) - or (row['accepted'] and row['failure'] is not None) - or (not row['accepted'] and (type(row['failure']) is not str or not row['failure'] or len(row['failure'])>256))): - raise ValueError('inconsistent arc attempt inventory') - return attempts - - + + +CONTROL_LIMITS=(('max_cutbacks',0,8),('max_attempts',1,64), + ('max_iterations',1,24),('max_backtracks',0,12)) +ATTEMPT_GROUP_KEYS={'requested_radius','amplitude_origin','attempts', + *(name for name,_,_ in CONTROL_LIMITS)} + + +def _validate_attempt_group(group): + if (type(group) is not dict or set(group)!=ATTEMPT_GROUP_KEYS + or any(type(group[k]) is not int or not low<=group[k]<=high + for k,low,high in CONTROL_LIMITS) + or type(group['amplitude_origin']) not in (float,int) + or not np.isfinite(group['amplitude_origin'])): + raise ValueError('arc step controller contract') + requested=group['requested_radius'] + if (type(requested) not in (float,int) or not np.isfinite(requested) + or requested<=0. or not np.isfinite(requested*requested) or requested*requested<=0.): + raise ValueError('arc requested radius') + attempts=group['attempts'] + keys={'radius','accepted','evaluations','linear_solves','rejected_trials','event_cell_evaluations','failure'} + if type(attempts) is not list or not 1<=len(attempts)<=min(group['max_cutbacks']+1,group['max_attempts']): + raise ValueError('bounded arc step attempts required') + for i,row in enumerate(attempts): + if (type(row) is not dict or set(row)!=keys or type(row['accepted']) is not bool + or row['accepted']!=(i==len(attempts)-1) + or type(row['radius']) not in (float,int) or row['radius']!=requested*.5**i + or not np.isfinite(row['radius']*row['radius']) or row['radius']*row['radius']<=0. + or any(type(row[k]) is not int or not 0<=row[k]<=2**63-1 for k in + ('evaluations','linear_solves','rejected_trials','event_cell_evaluations')) + or row['evaluations']<1 or row['linear_solves']<1 + or row['linear_solves']>group['max_iterations']+1 + or row['rejected_trials']>group['max_iterations']*(group['max_backtracks']+1) + or row['evaluations']>2+group['max_iterations']*(group['max_backtracks']+1) + or (row['accepted'] and row['failure'] is not None) + or (not row['accepted'] and (type(row['failure']) is not str or not row['failure'] or len(row['failure'])>256))): + raise ValueError('inconsistent arc attempt inventory') + return attempts + + def layout(owner,steps): - # Reuse only the existing mechanical array layout, not its control fields. + # Reuse only the existing mechanical array layout, not its control fields. from ._stiffened_shell_displacement_checkpoint import _layout from ._stiffened_shell_affine_endpoint import has_shell_material - mechanical=tuple((name,shape) for name,shape in _layout(owner,steps) - if name not in ('seed','history') and + mechanical=tuple((name,shape) for name,shape in _layout(owner,steps) + if name not in ('seed','history') and (has_shell_material(owner) or name not in - ('shell_plastic','shell_alpha','shell_origin_plastic','shell_origin_alpha'))) - nodes=len(owner._shell_ids)+len(owner._beam_ids) - return mechanical+(("history",(steps,2)),("metric_weights",(nodes,)), - ("normal_translations",(nodes,3)),("normal_spins",(nodes,3)), - ("origin_translations",(nodes,3)),("origin_frames",(nodes,3,3))) - - -def canonical(value): - return json.dumps(value,sort_keys=True,separators=(',',':'),allow_nan=False).encode('ascii') - - + ('shell_plastic','shell_alpha','shell_origin_plastic','shell_origin_alpha'))) + nodes=len(owner._shell_ids)+len(owner._beam_ids) + return mechanical+(("history",(steps,2)),("metric_weights",(nodes,)), + ("normal_translations",(nodes,3)),("normal_spins",(nodes,3)), + ("origin_translations",(nodes,3)),("origin_frames",(nodes,3,3))) + + +def canonical(value): + return json.dumps(value,sort_keys=True,separators=(',',':'),allow_nan=False).encode('ascii') + + def encode_snapshot(owner,metadata,arrays): from ._stiffened_shell_affine_endpoint import has_native_s3_material,is_native_point_material s3=has_native_s3_material(owner) @@ -231,30 +231,30 @@ def encode_snapshot(owner,metadata,arrays): inner=(encode_s3(owner._identity,metadata['generation'],numeric,arrays['s3_states'], native_material=True,displacement=True) if s3 else encode(kind,owner._identity,metadata['generation'],numeric)) - content=MAGIC+len(header).to_bytes(4,'little')+header+inner - if len(content)+32>MAX_CHECKPOINT_BYTES:raise ValueError('arc snapshot size limit') - raw=content+sha256(content).digest() - decode_snapshot(owner,raw) - return raw - - + content=MAGIC+len(header).to_bytes(4,'little')+header+inner + if len(content)+32>MAX_CHECKPOINT_BYTES:raise ValueError('arc snapshot size limit') + raw=content+sha256(content).digest() + decode_snapshot(owner,raw) + return raw + + def decode_snapshot(owner,raw): from ._stiffened_shell_affine_endpoint import is_native_point_material,has_native_s3_material native=_native_owner(owner);point=is_native_point_material(owner);s3=has_native_s3_material(owner) - identities(owner) - if (type(raw) is not bytes - or not raw.startswith(MAGIC) or not len(MAGIC)+36=len(raw)-32: - raise ValueError('arc metadata size') - if sha256(memoryview(raw)[:-32]).digest()!=raw[-32:]:raise ValueError('arc snapshot digest') - header=raw[start:start+length] - try:m=json.loads(header.decode('ascii')) - except (ValueError,UnicodeError,RecursionError) as e:raise ValueError('arc metadata') from e - keys={'policy','model','generation','seed_generation','seed_sha256','steps', - 'metric_length','predictor_dof','orientation','requested_radius','attempts', - 'max_cutbacks','max_attempts','max_iterations','max_backtracks', + identities(owner) + if (type(raw) is not bytes + or not raw.startswith(MAGIC) or not len(MAGIC)+36=len(raw)-32: + raise ValueError('arc metadata size') + if sha256(memoryview(raw)[:-32]).digest()!=raw[-32:]:raise ValueError('arc snapshot digest') + header=raw[start:start+length] + try:m=json.loads(header.decode('ascii')) + except (ValueError,UnicodeError,RecursionError) as e:raise ValueError('arc metadata') from e + keys={'policy','model','generation','seed_generation','seed_sha256','steps', + 'metric_length','predictor_dof','orientation','requested_radius','attempts', + 'max_cutbacks','max_attempts','max_iterations','max_backtracks', 'amplitude_origin','attempt_history','predecessor_sha256'} if native:keys.add('native_chart_policy') from ._stiffened_shell_affine_endpoint import is_native_material_bl5_arc @@ -278,25 +278,25 @@ def decode_snapshot(owner,raw): if director and (m['metric_kind']!=DIRECTOR_METRIC_ID or type(m['metric_shell_nodes']) is not int or m['metric_shell_nodes']!=len(owner._shell_ids)): raise ValueError('incompatible arc director metric layout') - if (any(type(m[k]) is not int for k in ('generation','seed_generation','steps','predictor_dof','orientation')) - or not 1<=m['steps']<=1024 or not 1<=m['seed_generation']=3 or dof not in owner._free: - raise ValueError('arc physical orientation coordinate') - for name in ('seed_sha256','predecessor_sha256'): - digest=m[name] - if type(digest) is not str or len(digest)!=64 or any(c not in '0123456789abcdef' for c in digest): - raise ValueError('arc predecessor/seed identity') - if m['steps']==1 and m['predecessor_sha256']!=m['seed_sha256']: - raise ValueError('first arc predecessor must be its seed') - if type(m['requested_radius']) not in (float,int) or not np.isfinite(m['requested_radius']) or m['requested_radius']<=0.: - raise ValueError('arc requested radius') - if (type(m['metric_length']) not in (float,int) or - any(type(m[k]) is not int or not low<=m[k]<=high for k,low,high in - (('max_cutbacks',0,8),('max_attempts',1,64),('max_iterations',1,24),('max_backtracks',0,12)))): - raise ValueError('arc controller/scaling contract') + if (any(type(m[k]) is not int for k in ('generation','seed_generation','steps','predictor_dof','orientation')) + or not 1<=m['steps']<=1024 or not 1<=m['seed_generation']=3 or dof not in owner._free: + raise ValueError('arc physical orientation coordinate') + for name in ('seed_sha256','predecessor_sha256'): + digest=m[name] + if type(digest) is not str or len(digest)!=64 or any(c not in '0123456789abcdef' for c in digest): + raise ValueError('arc predecessor/seed identity') + if m['steps']==1 and m['predecessor_sha256']!=m['seed_sha256']: + raise ValueError('first arc predecessor must be its seed') + if type(m['requested_radius']) not in (float,int) or not np.isfinite(m['requested_radius']) or m['requested_radius']<=0.: + raise ValueError('arc requested radius') + if (type(m['metric_length']) not in (float,int) or + any(type(m[k]) is not int or not low<=m[k]<=high for k,low,high in + (('max_cutbacks',0,8),('max_attempts',1,64),('max_iterations',1,24),('max_backtracks',0,12)))): + raise ValueError('arc controller/scaling contract') def shapes(kind,generation): expected=identities(owner)[0] if native: @@ -314,28 +314,28 @@ def s3_shapes(generation): a['s3_states']=states else:_,_,a=decode(raw[start+length:-32],owner._identity,shapes) metric=metric_from_snapshot(owner,m,a) - groups=m['attempt_history'] - if type(groups) is not list or len(groups)!=m['steps']: - raise ValueError('complete arc attempt history required') - for index,group in enumerate(groups): - rows=_validate_attempt_group(group) - if ((index==0 and group['amplitude_origin']!=0.) or - any(group[key]!=m[key] for key in - ('requested_radius','max_cutbacks','max_attempts','max_iterations','max_backtracks'))): - raise ValueError('arc frozen controller/history mismatch') - if rows[-1]['radius']!=a['history'][index,0]: - raise ValueError('arc step radius/history mismatch') - if index and group['amplitude_origin']!=a['history'][index-1,1]: - raise ValueError('arc amplitude origin/history mismatch') - if groups[-1]!={key:m[key] for key in ATTEMPT_GROUP_KEYS}: - raise ValueError('arc final controls/history mismatch') - attempts=m['attempts'] - radius,amplitude=a['history'][-1] - if np.any(a['history'][:,0]<=0.) or radius!=attempts[-1]['radius']: - raise ValueError('arc accepted radius/history mismatch') - if not np.array_equal(a['base_load']+amplitude*a['load_direction'],a['applied_load']): - raise ValueError('arc affine load mismatch') - translations=a['normal_translations'];spins=a['normal_spins'] + groups=m['attempt_history'] + if type(groups) is not list or len(groups)!=m['steps']: + raise ValueError('complete arc attempt history required') + for index,group in enumerate(groups): + rows=_validate_attempt_group(group) + if ((index==0 and group['amplitude_origin']!=0.) or + any(group[key]!=m[key] for key in + ('requested_radius','max_cutbacks','max_attempts','max_iterations','max_backtracks'))): + raise ValueError('arc frozen controller/history mismatch') + if rows[-1]['radius']!=a['history'][index,0]: + raise ValueError('arc step radius/history mismatch') + if index and group['amplitude_origin']!=a['history'][index-1,1]: + raise ValueError('arc amplitude origin/history mismatch') + if groups[-1]!={key:m[key] for key in ATTEMPT_GROUP_KEYS}: + raise ValueError('arc final controls/history mismatch') + attempts=m['attempts'] + radius,amplitude=a['history'][-1] + if np.any(a['history'][:,0]<=0.) or radius!=attempts[-1]['radius']: + raise ValueError('arc accepted radius/history mismatch') + if not np.array_equal(a['base_load']+amplitude*a['load_direction'],a['applied_load']): + raise ValueError('arc affine load mismatch') + translations=a['normal_translations'];spins=a['normal_spins'] if director: require_director_chart(a['q'][:owner._shell_count]) if 'shell_origin_q' in a:require_director_chart(a['shell_origin_q']) @@ -343,40 +343,40 @@ def s3_shapes(generation): else: norm=np.sum(metric.weights*(np.sum((translations/metric.length)**2,axis=1)+np.sum(spins*spins,axis=1))) if not np.isfinite(norm) or abs(norm-1.)>1e-10:raise ValueError('arc physical normal is not unit') - frames=np.concatenate((physical_frames(a['q'][:owner._shell_count],a['shell_anchors']),a['frames'])) - delta=a['q'][:nodes*6].reshape(-1,6)[:,:3]-a['origin_translations'] + frames=np.concatenate((physical_frames(a['q'][:owner._shell_count],a['shell_anchors']),a['frames'])) + delta=a['q'][:nodes*6].reshape(-1,6)[:,:3]-a['origin_translations'] if native and ((m['policy'] in _s3_arc_policies()[1:] if supports_generalized_stable_s3(owner) else m['policy']==identities(owner)[1]) or director): progress=m['orientation']*delta[dof//6,dof%6] if not progress>0.:raise ValueError('native arc selected coordinate made no oriented progress') - distance,_,_=metric.plane(delta,frames,a['origin_frames'],translations,spins) - if abs(distance-radius)/radius>1e-9:raise ValueError('arc path endpoint mismatch') - return m,a - - + distance,_,_=metric.plane(delta,frames,a['origin_frames'],translations,spins) + if abs(distance-radius)/radius>1e-9:raise ValueError('arc path endpoint mismatch') + return m,a + + def from_selection(owner,selection,*,seed_generation,seed_sha256,history=(),attempt_history=()): from ._stiffened_shell_ge_finite_experimental import _material_arrays,_shell_material_arrays from ._stiffened_shell_affine_endpoint import has_shell_material,is_native_point_material,has_native_s3_material trial=selection.trial;state=trial.state;parent=trial.predecessor_state require_metric_owner(owner,trial.metric) - with owner._commit_lock: - driver=owner._finite_driver - if (driver is None or owner._generation!=trial.accepted_generation - or driver._state is not parent or driver._shell_origins is not trial.shell_predecessor - or driver._beam_origins is not trial.beam_predecessor): - raise ValueError('stale arc checkpoint predecessor') - predecessor_sha256=sha256(owner.checkpoint()).hexdigest() - nodes=len(owner._shell_ids)+len(owner._beam_ids) - anchors=np.tile(np.eye(3),(len(owner._shell_ids),1,1)) if state.shell_anchors is None else state.shell_anchors - arrays={k:getattr(state,k) for k in ('q','frames','cells','resultants','multipliers')} - arrays.update(shell_anchors=anchors,shell_frames=physical_frames(state.q[:owner._shell_count],anchors), - base_load=trial.base_load,load_direction=trial.load_direction, - applied_load=trial.base_load+trial.amplitude*trial.load_direction, - history=np.asarray(tuple(history)+((trial.radius,trial.amplitude),)), - metric_weights=trial.metric.weights,normal_translations=trial.normal_translations, - normal_spins=trial.normal_spins,origin_translations=parent.q[:nodes*6].reshape(-1,6)[:,:3], - origin_frames=np.concatenate((physical_frames(parent.q[:owner._shell_count],parent.shell_anchors),parent.frames))) + with owner._commit_lock: + driver=owner._finite_driver + if (driver is None or owner._generation!=trial.accepted_generation + or driver._state is not parent or driver._shell_origins is not trial.shell_predecessor + or driver._beam_origins is not trial.beam_predecessor): + raise ValueError('stale arc checkpoint predecessor') + predecessor_sha256=sha256(owner.checkpoint()).hexdigest() + nodes=len(owner._shell_ids)+len(owner._beam_ids) + anchors=np.tile(np.eye(3),(len(owner._shell_ids),1,1)) if state.shell_anchors is None else state.shell_anchors + arrays={k:getattr(state,k) for k in ('q','frames','cells','resultants','multipliers')} + arrays.update(shell_anchors=anchors,shell_frames=physical_frames(state.q[:owner._shell_count],anchors), + base_load=trial.base_load,load_direction=trial.load_direction, + applied_load=trial.base_load+trial.amplitude*trial.load_direction, + history=np.asarray(tuple(history)+((trial.radius,trial.amplitude),)), + metric_weights=trial.metric.weights,normal_translations=trial.normal_translations, + normal_spins=trial.normal_spins,origin_translations=parent.q[:nodes*6].reshape(-1,6)[:,:3], + origin_frames=np.concatenate((physical_frames(parent.q[:owner._shell_count],parent.shell_anchors),parent.frames))) native=_native_owner(owner);s3=has_native_s3_material(owner) if native: from ._stiffened_shell_beam_history import arrays as native_arrays @@ -399,24 +399,24 @@ def from_selection(owner,selection,*,seed_generation,seed_sha256,history=(),atte arrays['shell_origin_q']=parent.q[:owner._shell_count] arrays['shell_origin_anchors']=(np.tile(np.eye(3),(len(owner._shell_ids),1,1)) if parent.shell_anchors is None else parent.shell_anchors) - group=dict(requested_radius=selection.requested_radius,amplitude_origin=trial.amplitude_origin, - attempts=[asdict(row) for row in selection.attempts], - max_cutbacks=selection.max_cutbacks,max_attempts=selection.max_attempts, - max_iterations=selection.max_iterations,max_backtracks=selection.max_backtracks) + group=dict(requested_radius=selection.requested_radius,amplitude_origin=trial.amplitude_origin, + attempts=[asdict(row) for row in selection.attempts], + max_cutbacks=selection.max_cutbacks,max_attempts=selection.max_attempts, + max_iterations=selection.max_iterations,max_backtracks=selection.max_backtracks) m=dict(policy=active_policy(owner,trial.metric),model=owner._identity,generation=trial.accepted_generation+1, - seed_generation=seed_generation,seed_sha256=seed_sha256,steps=len(history)+1, - metric_length=trial.metric.length,predictor_dof=trial.predictor_dof,orientation=trial.orientation, - predecessor_sha256=predecessor_sha256, + seed_generation=seed_generation,seed_sha256=seed_sha256,steps=len(history)+1, + metric_length=trial.metric.length,predictor_dof=trial.predictor_dof,orientation=trial.orientation, + predecessor_sha256=predecessor_sha256, attempt_history=list(attempt_history)+[group],**group) if native:m['native_chart_policy']=_chart_policy(owner) if type(trial.metric) is NativeDirectorChordMetric: m.update(metric_kind=DIRECTOR_METRIC_ID,metric_shell_nodes=trial.metric.shell_nodes) return encode_snapshot(owner,m,arrays) - - + + def validate_endpoint(owner,raw): from ._stiffened_shell_affine_endpoint import validate_arrays,is_native_point_material - metadata,arrays=decode_snapshot(owner,raw) + metadata,arrays=decode_snapshot(owner,raw) return metadata,arrays,*validate_arrays(owner,arrays, native_chart=is_native_point_material(owner), s3_stable=_replay_s3_stable(owner,metadata['policy'])) diff --git a/src/anyfesolver/_stiffened_shell_arc_control.py b/src/anyfesolver/_stiffened_shell_arc_control.py index fde07e35a..fe30796d4 100644 --- a/src/anyfesolver/_stiffened_shell_arc_control.py +++ b/src/anyfesolver/_stiffened_shell_arc_control.py @@ -1,57 +1,57 @@ -"""Experimental fixed-mesh physical tangent-plane continuation. - -The requested count is a count of accepted steps, not a requested total distance. -Cutbacks reduce actual travelled distance and remain visible in history. This -local controller does not establish stability, a limit point or branch uniqueness. -""" -from copy import deepcopy -from dataclasses import dataclass,replace -from hashlib import sha256 -import numpy as np -from .control import cancellation_safe_point +"""Experimental fixed-mesh physical tangent-plane continuation. + +The requested count is a count of accepted steps, not a requested total distance. +Cutbacks reduce actual travelled distance and remain visible in history. This +local controller does not establish stability, a limit point or branch uniqueness. +""" +from copy import deepcopy +from dataclasses import dataclass,replace +from hashlib import sha256 +import numpy as np +from .control import cancellation_safe_point from ._stiffened_shell_arc_metric import (PhysicalChordMetric, NativeDirectorChordMetric, require_metric_owner, DIRECTOR_METRIC_ID) -from ._stiffened_shell_arc_trial import select_trial -from ._stiffened_shell_arc_checkpoint import from_selection -from ._stiffened_shell_arc_publication import publish -from ._stiffened_shell_displacement_control import DisplacementControl - - -@dataclass(frozen=True) -class ArcLengthControl: - """Fixed mesh weights follow compiled shell nodes, then beam nodes. - - The chosen free translation orients the tangent at each step. It must remain - a usable local branch coordinate; no automatic branch switching is provided. - Weights and characteristic length are explicit and frozen across restart. - """ - domain: str - node: int - component: int +from ._stiffened_shell_arc_trial import select_trial +from ._stiffened_shell_arc_checkpoint import from_selection +from ._stiffened_shell_arc_publication import publish +from ._stiffened_shell_displacement_control import DisplacementControl + + +@dataclass(frozen=True) +class ArcLengthControl: + """Fixed mesh weights follow compiled shell nodes, then beam nodes. + + The chosen free translation orients the tangent at each step. It must remain + a usable local branch coordinate; no automatic branch switching is provided. + Weights and characteristic length are explicit and frozen across restart. + """ + domain: str + node: int + component: int metric: PhysicalChordMetric | NativeDirectorChordMetric - radius: float - orientation: int = 1 - max_cutbacks: int = 4 - max_attempts: int = 5 - max_iterations: int = 20 - max_backtracks: int = 12 - - def __post_init__(self): + radius: float + orientation: int = 1 + max_cutbacks: int = 4 + max_attempts: int = 5 + max_iterations: int = 20 + max_backtracks: int = 12 + + def __post_init__(self): if type(self.metric) not in (PhysicalChordMetric, NativeDirectorChordMetric): - raise ValueError('explicit physical arc metric required') - if (type(self.radius) not in (int,float) or not np.isfinite(self.radius) - or self.radius<=0. or type(self.orientation) is not int or self.orientation not in (-1,1)): - raise ValueError('positive arc radius and signed orientation required') - for name,low,high in (('max_cutbacks',0,8),('max_attempts',1,64), - ('max_iterations',1,24),('max_backtracks',0,12)): - if type(getattr(self,name)) is not int or not low<=getattr(self,name)<=high: - raise ValueError('bounded arc controls required') - - -def solve(owner,actions,control,*,steps=1,cancellation_token=None,on_accepted=None): - if not isinstance(control,ArcLengthControl) or type(steps) is not int or not 1<=steps<=1024: - raise ValueError('arc control and bounded accepted-step count required') - if on_accepted is not None and not callable(on_accepted):raise ValueError('accepted observer must be callable') + raise ValueError('explicit physical arc metric required') + if (type(self.radius) not in (int,float) or not np.isfinite(self.radius) + or self.radius<=0. or type(self.orientation) is not int or self.orientation not in (-1,1)): + raise ValueError('positive arc radius and signed orientation required') + for name,low,high in (('max_cutbacks',0,8),('max_attempts',1,64), + ('max_iterations',1,24),('max_backtracks',0,12)): + if type(getattr(self,name)) is not int or not low<=getattr(self,name)<=high: + raise ValueError('bounded arc controls required') + + +def solve(owner,actions,control,*,steps=1,cancellation_token=None,on_accepted=None): + if not isinstance(control,ArcLengthControl) or type(steps) is not int or not 1<=steps<=1024: + raise ValueError('arc control and bounded accepted-step count required') + if on_accepted is not None and not callable(on_accepted):raise ValueError('accepted observer must be callable') driver=owner._finite_driver require_metric_owner(owner,control.metric) from ._stiffened_shell_affine_endpoint import is_native_point_material,is_native_material_bl5_arc @@ -61,48 +61,48 @@ def solve(owner,actions,control,*,steps=1,cancellation_token=None,on_accepted=No if native: from ._stiffened_shell_arc_checkpoint import require_native_seed require_native_seed(owner,driver) - if getattr(owner,'_external_context',None) is not None or driver._external is not None: - raise ValueError('arc continuation admits affine nodal dead translations only') - adaptive=getattr(owner,'_displacement_adaptive',None) - if adaptive is not None: - raise ValueError('finish displacement history and use its endpoint checkpoint before arc continuation') - dof=DisplacementControl(control.domain,control.node,control.component).dof(owner) - direction=driver._load(actions) - saved=getattr(owner,'_arc_snapshot',None) - knobs={name:getattr(control,name) for name in - ('max_cutbacks','max_attempts','max_iterations','max_backtracks')} - if saved is None: - seed_generation=owner._generation;seed_sha256=sha256(owner.checkpoint()).hexdigest() - base=None;amplitude=0.;history=();attempt_history=() - else: + if getattr(owner,'_external_context',None) is not None or driver._external is not None: + raise ValueError('arc continuation admits affine nodal dead translations only') + adaptive=getattr(owner,'_displacement_adaptive',None) + if adaptive is not None: + raise ValueError('finish displacement history and use its endpoint checkpoint before arc continuation') + dof=DisplacementControl(control.domain,control.node,control.component).dof(owner) + direction=driver._load(actions) + saved=getattr(owner,'_arc_snapshot',None) + knobs={name:getattr(control,name) for name in + ('max_cutbacks','max_attempts','max_iterations','max_backtracks')} + if saved is None: + seed_generation=owner._generation;seed_sha256=sha256(owner.checkpoint()).hexdigest() + base=None;amplitude=0.;history=();attempt_history=() + else: _,m,a=saved director=type(control.metric) is NativeDirectorChordMetric if (m.get('metric_kind')!=(DIRECTOR_METRIC_ID if director else None) or m.get('metric_shell_nodes')!=(control.metric.shell_nodes if director else None)): raise ValueError('arc metric identity differs from accepted history') - if (m['predictor_dof']!=dof or m['orientation']!=control.orientation - or m['requested_radius']!=control.radius or m['metric_length']!=control.metric.length - or not np.array_equal(a['metric_weights'],control.metric.weights) - or not np.array_equal(a['load_direction'],direction) - or any(m[name]!=value for name,value in knobs.items())): - raise ValueError('arc controller/load/metric differs from accepted history') - seed_generation=m['seed_generation'];seed_sha256=m['seed_sha256'] - base=a['base_load'];history=tuple(map(tuple,a['history']));amplitude=float(history[-1][1]) - attempt_history=tuple(m['attempt_history']) - if len(history)+steps>1024:raise ValueError('arc accepted history limit') - for _ in range(steps): - cancellation_safe_point(cancellation_token,'stiffened-shell.arc.step') - driver=owner._finite_driver;generation=owner._generation - selection=select_trial(driver,load_direction=direction,metric=control.metric, - radius=control.radius,predictor_dof=dof,orientation=control.orientation, - load_base=base,amplitude_origin=amplitude,cancellation_token=cancellation_token,**knobs) - raw=from_selection(owner,selection,seed_generation=seed_generation, - seed_sha256=seed_sha256,history=history,attempt_history=attempt_history) - result=publish(owner,raw,expected_driver=driver,expected_generation=generation, - cancellation_token=cancellation_token) - _,m,a=owner._arc_snapshot - base=a['base_load'];history=result.history;amplitude=result.amplitude - attempt_history=tuple(m['attempt_history']) - if on_accepted is not None:on_accepted(deepcopy(result)) - # Owner/restore retain an accepted prefix, independently of this call's goal. - return replace(result,status='completed') + if (m['predictor_dof']!=dof or m['orientation']!=control.orientation + or m['requested_radius']!=control.radius or m['metric_length']!=control.metric.length + or not np.array_equal(a['metric_weights'],control.metric.weights) + or not np.array_equal(a['load_direction'],direction) + or any(m[name]!=value for name,value in knobs.items())): + raise ValueError('arc controller/load/metric differs from accepted history') + seed_generation=m['seed_generation'];seed_sha256=m['seed_sha256'] + base=a['base_load'];history=tuple(map(tuple,a['history']));amplitude=float(history[-1][1]) + attempt_history=tuple(m['attempt_history']) + if len(history)+steps>1024:raise ValueError('arc accepted history limit') + for _ in range(steps): + cancellation_safe_point(cancellation_token,'stiffened-shell.arc.step') + driver=owner._finite_driver;generation=owner._generation + selection=select_trial(driver,load_direction=direction,metric=control.metric, + radius=control.radius,predictor_dof=dof,orientation=control.orientation, + load_base=base,amplitude_origin=amplitude,cancellation_token=cancellation_token,**knobs) + raw=from_selection(owner,selection,seed_generation=seed_generation, + seed_sha256=seed_sha256,history=history,attempt_history=attempt_history) + result=publish(owner,raw,expected_driver=driver,expected_generation=generation, + cancellation_token=cancellation_token) + _,m,a=owner._arc_snapshot + base=a['base_load'];history=result.history;amplitude=result.amplitude + attempt_history=tuple(m['attempt_history']) + if on_accepted is not None:on_accepted(deepcopy(result)) + # Owner/restore retain an accepted prefix, independently of this call's goal. + return replace(result,status='completed') diff --git a/src/anyfesolver/_stiffened_shell_arc_publication.py b/src/anyfesolver/_stiffened_shell_arc_publication.py index 73618aa29..80177e190 100644 --- a/src/anyfesolver/_stiffened_shell_arc_publication.py +++ b/src/anyfesolver/_stiffened_shell_arc_publication.py @@ -1,54 +1,54 @@ -"""Atomic endpoint publication behind the experimental public arc controller.""" +"""Atomic endpoint publication behind the experimental public arc controller.""" from dataclasses import dataclass,replace -from math import fsum -from hashlib import sha256 -import numpy as np -from scipy.spatial.transform import Rotation -from .control import cancellation_safe_point -from ._stiffened_shell_arc_checkpoint import validate_endpoint +from math import fsum +from hashlib import sha256 +import numpy as np +from scipy.spatial.transform import Rotation +from .control import cancellation_safe_point +from ._stiffened_shell_arc_checkpoint import validate_endpoint from ._stiffened_shell_arc_trial import ArcAttempt from ._stiffened_shell_affine_endpoint import has_shell_material,uses_native_material_history,has_native_s3_material - - -@dataclass(frozen=True) -class ArcResult: - status: str - amplitude: float - arc_position: float - history: tuple - generation: int - shell_displacement: np.ndarray - beam_positions: np.ndarray - beam_frames: np.ndarray - cell_frames: np.ndarray - cell_resultants: np.ndarray - multipliers: np.ndarray - support_reactions: np.ndarray - applied_dead_load: np.ndarray - free_equilibrium_ratio: float - constraint_max: float - shell_frames: np.ndarray - shell_chart_coordinates: np.ndarray - shell_rotation_anchors: np.ndarray - shell_q4_material: tuple - beam_station_accumulated: tuple - shell_layer_alpha: tuple - beam_shell_line_work: tuple - point_wrenches: tuple - beam_generalized_material: tuple - increment_attempts: tuple - attempt_history: tuple + + +@dataclass(frozen=True) +class ArcResult: + status: str + amplitude: float + arc_position: float + history: tuple + generation: int + shell_displacement: np.ndarray + beam_positions: np.ndarray + beam_frames: np.ndarray + cell_frames: np.ndarray + cell_resultants: np.ndarray + multipliers: np.ndarray + support_reactions: np.ndarray + applied_dead_load: np.ndarray + free_equilibrium_ratio: float + constraint_max: float + shell_frames: np.ndarray + shell_chart_coordinates: np.ndarray + shell_rotation_anchors: np.ndarray + shell_q4_material: tuple + beam_station_accumulated: tuple + shell_layer_alpha: tuple + beam_shell_line_work: tuple + point_wrenches: tuple + beam_generalized_material: tuple + increment_attempts: tuple + attempt_history: tuple production_qualified: bool = False beam_fibre_material: tuple = () beam_fibre_energy: tuple = () shell_s3_material: tuple = () - - -def prepare(owner,raw): - from ._stiffened_shell_ge_finite_experimental import ( - _owned,_accepted_shell_material_origins,_shell_q4_recovery, - _material_observables,_material_histories) - m,a,driver,state,evaluation,shell_parent,beam_parent=validate_endpoint(owner,raw) + + +def prepare(owner,raw): + from ._stiffened_shell_ge_finite_experimental import ( + _owned,_accepted_shell_material_origins,_shell_q4_recovery, + _material_observables,_material_histories) + m,a,driver,state,evaluation,shell_parent,beam_parent=validate_endpoint(owner,raw) residual,_,relative,gap,shell_next,beam_next=evaluation native=uses_native_material_history(owner);s3=has_native_s3_material(owner) count=len(owner._definition.shell.q4_elements) @@ -60,22 +60,22 @@ def prepare(owner,raw): from ._stiffened_shell_beam_history import histories beam_next=histories(owner._beam_parts,a,'beam') else:beam_next=_material_histories(owner,a['beam_plastic'],a['beam_accumulated']) - history=tuple(tuple(float(x) for x in row) for row in a['history']) - support=np.zeros(owner._K.shape[0]);support[owner._fixed]=residual[owner._fixed] - local=_owned(state.q[:owner._shell_count]);display=local.copy().reshape(-1,6) - display[:,3:]=Rotation.from_matrix(a['shell_frames']).as_rotvec() - result=ArcResult('accepted_prefix',history[-1][1],fsum(row[0] for row in history), - history,m['generation'],_owned(display.ravel()),_owned(driver._beam_positions(state)), - state.frames,state.cells,state.resultants,state.multipliers,_owned(support), - a['applied_load'],relative,gap,a['shell_frames'],local,a['shell_anchors'], + history=tuple(tuple(float(x) for x in row) for row in a['history']) + support=np.zeros(owner._K.shape[0]);support[owner._fixed]=residual[owner._fixed] + local=_owned(state.q[:owner._shell_count]);display=local.copy().reshape(-1,6) + display[:,3:]=Rotation.from_matrix(a['shell_frames']).as_rotvec() + result=ArcResult('accepted_prefix',history[-1][1],fsum(row[0] for row in history), + history,m['generation'],_owned(display.ravel()),_owned(driver._beam_positions(state)), + state.frames,state.cells,state.resultants,state.multipliers,_owned(support), + a['applied_load'],relative,gap,a['shell_frames'],local,a['shell_anchors'], (_shell_q4_recovery(owner._shell_parts[:count],shell_next[:count]) if s3 else _shell_q4_recovery(owner._shell_parts,shell_next) if has_shell_material(owner) else ()),_material_observables(beam_next), - (tuple(tuple(float(v) for v in row['alpha']) for row in shell_next) if has_shell_material(owner) else ()), - driver._line_trial_recovery[1],driver._point_records(state), + (tuple(tuple(float(v) for v in row['alpha']) for row in shell_next) if has_shell_material(owner) else ()), + driver._line_trial_recovery[1],driver._point_records(state), driver._generalized_records(state,beam_parent,beam_next,include_native=native), - tuple(ArcAttempt(**row) for row in m['attempts']), - tuple(tuple(ArcAttempt(**row) for row in group['attempts']) for group in m['attempt_history'])) - driver._state=state;driver._shell_predecessors=shell_parent;driver._beam_predecessors=beam_parent + tuple(ArcAttempt(**row) for row in m['attempts']), + tuple(tuple(ArcAttempt(**row) for row in group['attempts']) for group in m['attempt_history'])) + driver._state=state;driver._shell_predecessors=shell_parent;driver._beam_predecessors=beam_parent if native: from ._stiffened_shell_ge_finite_experimental import _fibre_recovery records,energies=_fibre_recovery(owner,state,beam_parent,beam_next) @@ -84,17 +84,17 @@ def prepare(owner,raw): from ._stiffened_shell_ge_finite_experimental import _shell_s3_recovery result=replace(result,shell_s3_material=_shell_s3_recovery(owner._shell_parts[count:],shell_next[count:])) driver._shell_origins=(shell_next if s3 else _accepted_shell_material_origins(owner,state,shell_next) - if has_shell_material(owner) else shell_next) - driver._beam_origins=beam_next;driver._accepted=result - driver._arc_applied_load=a['applied_load'] - return m,a,driver,result - - + if has_shell_material(owner) else shell_next) + driver._beam_origins=beam_next;driver._accepted=result + driver._arc_applied_load=a['applied_load'] + return m,a,driver,result + + def _bind_predecessor(owner,m,a,live,expected_generation): - from ._stiffened_shell_ge_finite_experimental import _material_arrays,_shell_material_arrays - from ._stiffened_shell_rotation_charts import physical_frames + from ._stiffened_shell_ge_finite_experimental import _material_arrays,_shell_material_arrays + from ._stiffened_shell_rotation_charts import physical_frames if (live is None or m['generation']!=expected_generation+1 - or m['predecessor_sha256']!=sha256(owner.checkpoint()).hexdigest()): + or m['predecessor_sha256']!=sha256(owner.checkpoint()).hexdigest()): raise ValueError('arc endpoint has a different accepted predecessor') saved=getattr(owner,'_arc_snapshot',None) if saved is not None: @@ -105,12 +105,12 @@ def _bind_predecessor(owner,m,a,live,expected_generation): native=uses_native_material_history(owner);s3=has_native_s3_material(owner) count=len(owner._definition.shell.q4_elements) shell=(_shell_material_arrays(live._shell_origins[:count] if s3 else live._shell_origins) if has_shell_material(owner) else ()) - frames=np.concatenate((physical_frames(live._state.q[:owner._shell_count], - live._state.shell_anchors),live._state.frames)) - applied=getattr(live,'_arc_applied_load',None) - if applied is None:applied=getattr(live,'_displacement_applied_load',None) - if applied is None: - applied=live._applied_load if live._programme is not None else live._load_factor*live._pattern + frames=np.concatenate((physical_frames(live._state.q[:owner._shell_count], + live._state.shell_anchors),live._state.frames)) + applied=getattr(live,'_arc_applied_load',None) + if applied is None:applied=getattr(live,'_displacement_applied_load',None) + if applied is None: + applied=live._applied_load if live._programme is not None else live._load_factor*live._pattern witnesses=(('origin_translations',live._state.q[:nodes*6].reshape(-1,6)[:,:3]), ('origin_frames',frames)) if native: @@ -129,25 +129,25 @@ def _bind_predecessor(owner,m,a,live,expected_generation): blobs=tuple(element.serialize_nonlinear_state(owner._shell_model.mesh,material,origin,3) for (_,element,_,_),origin in zip(owner._shell_parts[count:],live._shell_origins[count:])) if a['s3_states'][len(blobs):]!=blobs:raise ValueError('arc S3 predecessor mismatch') - if (any(not np.array_equal(a[name],value) for name,value in witnesses) - or not np.array_equal(a['base_load']+m['amplitude_origin']*a['load_direction'],applied)): - raise ValueError('arc physical/material predecessor mismatch') - - -def publish(owner,raw,*,expected_driver,expected_generation,cancellation_token=None,restoring=False): - m,a,driver,result=prepare(owner,raw) - cancellation_safe_point(cancellation_token,'stiffened-shell.arc.publish') - with owner._commit_lock: - owner._require_open() - if owner._generation!=expected_generation or owner._finite_driver is not expected_driver: - raise ValueError('stale arc publication') - if restoring: - if expected_driver is not None or owner._accepted is not None or expected_generation!=0: - raise ValueError('arc restore requires a fresh owner') - else: - _bind_predecessor(owner,m,a,expected_driver,expected_generation) - cancellation_safe_point(cancellation_token,'stiffened-shell.arc.commit') - driver.owner=owner;owner._finite_driver=driver;owner._generation=result.generation - owner._arc_snapshot=(raw,m,a) - owner._displacement_snapshot=None;owner._displacement_adaptive=None - return result + if (any(not np.array_equal(a[name],value) for name,value in witnesses) + or not np.array_equal(a['base_load']+m['amplitude_origin']*a['load_direction'],applied)): + raise ValueError('arc physical/material predecessor mismatch') + + +def publish(owner,raw,*,expected_driver,expected_generation,cancellation_token=None,restoring=False): + m,a,driver,result=prepare(owner,raw) + cancellation_safe_point(cancellation_token,'stiffened-shell.arc.publish') + with owner._commit_lock: + owner._require_open() + if owner._generation!=expected_generation or owner._finite_driver is not expected_driver: + raise ValueError('stale arc publication') + if restoring: + if expected_driver is not None or owner._accepted is not None or expected_generation!=0: + raise ValueError('arc restore requires a fresh owner') + else: + _bind_predecessor(owner,m,a,expected_driver,expected_generation) + cancellation_safe_point(cancellation_token,'stiffened-shell.arc.commit') + driver.owner=owner;owner._finite_driver=driver;owner._generation=result.generation + owner._arc_snapshot=(raw,m,a) + owner._displacement_snapshot=None;owner._displacement_adaptive=None + return result diff --git a/src/anyfesolver/_stiffened_shell_arc_trial.py b/src/anyfesolver/_stiffened_shell_arc_trial.py index 6b3f7a3f1..f2aa7eff0 100644 --- a/src/anyfesolver/_stiffened_shell_arc_trial.py +++ b/src/anyfesolver/_stiffened_shell_arc_trial.py @@ -1,158 +1,158 @@ -"""Uncommitted local tangent-plane continuation of coupled BL5/J2 equilibria. - -Experimental fixed mesh, explicit frozen physical weights and affine -translational dead loads. The public controller owns commit; no capacity claim. -""" -from dataclasses import dataclass -import numpy as np -from .control import cancellation_safe_point -from ._ge_beam3_pose_joint import _exp_terms -from ._stiffened_shell_rotation_charts import physical_frames +"""Uncommitted local tangent-plane continuation of coupled BL5/J2 equilibria. + +Experimental fixed mesh, explicit frozen physical weights and affine +translational dead loads. The public controller owns commit; no capacity claim. +""" +from dataclasses import dataclass +import numpy as np +from .control import cancellation_safe_point +from ._ge_beam3_pose_joint import _exp_terms +from ._stiffened_shell_rotation_charts import physical_frames from ._stiffened_shell_arc_metric import (PhysicalChordMetric, NativeDirectorChordMetric, ChordDomainError, _owned, require_metric_owner, require_director_chart) -from ._stiffened_shell_displacement_corrector import ( - bordered_correction, bordered_path_correction, DisplacementCorrectorFailure) - - -@dataclass(frozen=True) -class ArcTrial: - state: object - amplitude: float - evaluation: tuple - accepted_generation: int - predecessor_state: object - shell_predecessor: object - beam_predecessor: object - radius: float - path_error: float - evaluations: int - linear_solves: int - rejected_trials: int - event_cell_evaluations: int - base_load: np.ndarray - load_direction: np.ndarray - normal_translations: np.ndarray - normal_spins: np.ndarray +from ._stiffened_shell_displacement_corrector import ( + bordered_correction, bordered_path_correction, DisplacementCorrectorFailure) + + +@dataclass(frozen=True) +class ArcTrial: + state: object + amplitude: float + evaluation: tuple + accepted_generation: int + predecessor_state: object + shell_predecessor: object + beam_predecessor: object + radius: float + path_error: float + evaluations: int + linear_solves: int + rejected_trials: int + event_cell_evaluations: int + base_load: np.ndarray + load_direction: np.ndarray + normal_translations: np.ndarray + normal_spins: np.ndarray metric: PhysicalChordMetric | NativeDirectorChordMetric - predictor_dof: int - orientation: int - amplitude_origin: float - - -class ArcTrialFailure(DisplacementCorrectorFailure): - """Failed uncommitted candidate and work, retained for a caller's cutback.""" - def __init__(self,message,trial): - super().__init__(message) - self.trial=trial - - -@dataclass(frozen=True) -class ArcAttempt: - radius: float - accepted: bool - evaluations: int - linear_solves: int - rejected_trials: int - event_cell_evaluations: int - failure: str | None - - -@dataclass(frozen=True) -class ArcSelection: - """One selected, uncommitted step; not completion of a requested path.""" - requested_radius: float - trial: ArcTrial - attempts: tuple - max_cutbacks: int - max_attempts: int - max_iterations: int - max_backtracks: int - - -class ArcSelectionFailure(RuntimeError): - def __init__(self,message,attempts): - super().__init__(message) - self.attempts=tuple(attempts) - - -def select_trial(driver, *, radius, max_cutbacks=4, max_attempts=5, - attempt_records=None, **kwargs): - """Bounded cutback from one unchanged accepted predecessor. - - Retry only the explicitly typed Newton/backtrack failures emitted below. - Cancellation, stale ownership, programming errors and unclassified numerical - failures propagate. The caller still owns atomic publication and path control. - """ - if (type(max_cutbacks) is not int or not 0<=max_cutbacks<=8 - or type(max_attempts) is not int or not 1<=max_attempts<=64 - or not np.isfinite(radius) or radius<=0.): - raise ValueError("bounded arc selection controls required") - owner=driver.owner - with owner._commit_lock: - generation=owner._generation;parent=driver._state - shell=driver._shell_origins;beam=driver._beam_origins - kwargs=dict(kwargs) - kwargs['load_direction']=np.array(kwargs['load_direction'],dtype=float,copy=True) - if kwargs.get('load_base') is not None: - kwargs['load_base']=_owned(kwargs['load_base']) - attempts=[] - def current(): - if (owner._finite_driver is not driver or owner._generation!=generation - or driver._state is not parent or driver._shell_origins is not shell - or driver._beam_origins is not beam): - raise ValueError("stale arc selection predecessor") - cancellation_safe_point(kwargs.get('cancellation_token'),"stiffened-shell.arc.selection") - for depth in range(min(max_attempts,max_cutbacks+1)): - current() - actual=float(radius)*(.5**depth) - if not np.isfinite(actual*actual) or actual*actual<=0.: - raise ArcSelectionFailure("arc radius no longer representable",attempts) - failure=None - try: - trial=correct(driver,radius=actual,**kwargs) - except ArcTrialFailure as error: - trial=error.trial;failure=str(error) - with owner._commit_lock:current() - row=ArcAttempt(actual,failure is None,trial.evaluations,trial.linear_solves, - trial.rejected_trials,trial.event_cell_evaluations,failure) - attempts.append(row) - if attempt_records is not None:attempt_records.append(row) - if failure is None: - with owner._commit_lock: - current() - return ArcSelection(float(radius),trial,tuple(attempts),max_cutbacks,max_attempts, - kwargs.get('max_iterations',20),kwargs.get('max_backtracks',12)) - raise ArcSelectionFailure("arc cutback/attempt limit",attempts) - - -def path_row(driver,state,parent,metric,normal=None): - """Squared physical chord and row in the driver's actual update columns.""" + predictor_dof: int + orientation: int + amplitude_origin: float + + +class ArcTrialFailure(DisplacementCorrectorFailure): + """Failed uncommitted candidate and work, retained for a caller's cutback.""" + def __init__(self,message,trial): + super().__init__(message) + self.trial=trial + + +@dataclass(frozen=True) +class ArcAttempt: + radius: float + accepted: bool + evaluations: int + linear_solves: int + rejected_trials: int + event_cell_evaluations: int + failure: str | None + + +@dataclass(frozen=True) +class ArcSelection: + """One selected, uncommitted step; not completion of a requested path.""" + requested_radius: float + trial: ArcTrial + attempts: tuple + max_cutbacks: int + max_attempts: int + max_iterations: int + max_backtracks: int + + +class ArcSelectionFailure(RuntimeError): + def __init__(self,message,attempts): + super().__init__(message) + self.attempts=tuple(attempts) + + +def select_trial(driver, *, radius, max_cutbacks=4, max_attempts=5, + attempt_records=None, **kwargs): + """Bounded cutback from one unchanged accepted predecessor. + + Retry only the explicitly typed Newton/backtrack failures emitted below. + Cancellation, stale ownership, programming errors and unclassified numerical + failures propagate. The caller still owns atomic publication and path control. + """ + if (type(max_cutbacks) is not int or not 0<=max_cutbacks<=8 + or type(max_attempts) is not int or not 1<=max_attempts<=64 + or not np.isfinite(radius) or radius<=0.): + raise ValueError("bounded arc selection controls required") + owner=driver.owner + with owner._commit_lock: + generation=owner._generation;parent=driver._state + shell=driver._shell_origins;beam=driver._beam_origins + kwargs=dict(kwargs) + kwargs['load_direction']=np.array(kwargs['load_direction'],dtype=float,copy=True) + if kwargs.get('load_base') is not None: + kwargs['load_base']=_owned(kwargs['load_base']) + attempts=[] + def current(): + if (owner._finite_driver is not driver or owner._generation!=generation + or driver._state is not parent or driver._shell_origins is not shell + or driver._beam_origins is not beam): + raise ValueError("stale arc selection predecessor") + cancellation_safe_point(kwargs.get('cancellation_token'),"stiffened-shell.arc.selection") + for depth in range(min(max_attempts,max_cutbacks+1)): + current() + actual=float(radius)*(.5**depth) + if not np.isfinite(actual*actual) or actual*actual<=0.: + raise ArcSelectionFailure("arc radius no longer representable",attempts) + failure=None + try: + trial=correct(driver,radius=actual,**kwargs) + except ArcTrialFailure as error: + trial=error.trial;failure=str(error) + with owner._commit_lock:current() + row=ArcAttempt(actual,failure is None,trial.evaluations,trial.linear_solves, + trial.rejected_trials,trial.event_cell_evaluations,failure) + attempts.append(row) + if attempt_records is not None:attempt_records.append(row) + if failure is None: + with owner._commit_lock: + current() + return ArcSelection(float(radius),trial,tuple(attempts),max_cutbacks,max_attempts, + kwargs.get('max_iterations',20),kwargs.get('max_backtracks',12)) + raise ArcSelectionFailure("arc cutback/attempt limit",attempts) + + +def path_row(driver,state,parent,metric,normal=None): + """Squared physical chord and row in the driver's actual update columns.""" owner=driver.owner nodal=owner._shell_count+6*len(owner._beam_ids) if type(metric) is NativeDirectorChordMetric: require_director_chart(parent.q[:owner._shell_count]) require_director_chart(state.q[:owner._shell_count]) - reference=np.concatenate((physical_frames(parent.q[:owner._shell_count],parent.shell_anchors),parent.frames)) - frames=np.concatenate((physical_frames(state.q[:owner._shell_count],state.shell_anchors),state.frames)) - displacement=(state.q[:nodal]-parent.q[:nodal]).reshape(-1,6)[:,:3] - value,translations,spins=(metric.evaluate(displacement,frames,reference) if normal is None - else metric.plane(displacement,frames,reference,*normal)) - gradient=np.zeros(len(state.q)+len(state.multipliers)) - rows=gradient[:nodal].reshape(-1,6) - rows[:,:3]=translations;rows[:,3:]=spins - for i,chart in enumerate(state.q[:owner._shell_count].reshape(-1,6)): - rows[i,3:]=_exp_terms(chart[3:])[1].T@spins[i] - return value,gradient - - -def correct(driver, *, load_direction, metric, radius, predictor_dof, - orientation, max_iterations=20, max_backtracks=12, - cancellation_token=None, iteration_records=None, - load_base=None, amplitude_origin=0.): - """Return a candidate; all trial material updates share one predecessor.""" - from ._stiffened_shell_ge_finite_experimental import _RotationStepTooLarge - from ._stiffened_shell_bl5_local_experimental import BL5TrialDomainError - from ._stiffened_shell_branch_event_trial import trial_fraction + reference=np.concatenate((physical_frames(parent.q[:owner._shell_count],parent.shell_anchors),parent.frames)) + frames=np.concatenate((physical_frames(state.q[:owner._shell_count],state.shell_anchors),state.frames)) + displacement=(state.q[:nodal]-parent.q[:nodal]).reshape(-1,6)[:,:3] + value,translations,spins=(metric.evaluate(displacement,frames,reference) if normal is None + else metric.plane(displacement,frames,reference,*normal)) + gradient=np.zeros(len(state.q)+len(state.multipliers)) + rows=gradient[:nodal].reshape(-1,6) + rows[:,:3]=translations;rows[:,3:]=spins + for i,chart in enumerate(state.q[:owner._shell_count].reshape(-1,6)): + rows[i,3:]=_exp_terms(chart[3:])[1].T@spins[i] + return value,gradient + + +def correct(driver, *, load_direction, metric, radius, predictor_dof, + orientation, max_iterations=20, max_backtracks=12, + cancellation_token=None, iteration_records=None, + load_base=None, amplitude_origin=0.): + """Return a candidate; all trial material updates share one predecessor.""" + from ._stiffened_shell_ge_finite_experimental import _RotationStepTooLarge + from ._stiffened_shell_bl5_local_experimental import BL5TrialDomainError + from ._stiffened_shell_branch_event_trial import trial_fraction owner=driver.owner n=owner._K.shape[0]; nodal=owner._shell_count+6*len(owner._beam_ids) from ._stiffened_shell_affine_endpoint import is_native_point_material,is_native_material_bl5_arc @@ -163,95 +163,95 @@ def correct(driver, *, load_direction, metric, radius, predictor_dof, if native: from ._stiffened_shell_arc_checkpoint import require_native_seed require_native_seed(owner,driver) - size=n+len(driver._state.multipliers) + size=n+len(driver._state.multipliers) if (len(metric.weights)!=nodal//6 or not (owner._bl5_shell_material or getattr(owner,"_curved_reference",False) or native) or driver._accepted is None - or driver._external is not None): - raise ValueError("accepted admitted arc owner with fixed physical metric required") - if (not np.isfinite(radius) or radius<=0. or type(orientation) is not int or orientation not in (-1,1) - or type(predictor_dof) is not int or predictor_dof not in owner._free - or not 0<=predictor_dof=3 - or type(max_iterations) is not int or not 1<=max_iterations<=24 - or type(max_backtracks) is not int or not 0<=max_backtracks<=12): - raise ValueError("bounded radius, orientation and physical predictor required") - radius2=float(radius)*float(radius) - if not np.isfinite(radius2) or radius2<=0.: - raise ValueError("representable squared radius required") - pattern=np.array(load_direction,dtype=float,copy=True) - allowed=np.zeros(n,dtype=bool) - for start in range(0,nodal,6):allowed[start:start+3]=True - if (pattern.shape!=(n,) or not np.isfinite(pattern).all() - or np.any(pattern[~allowed]) or not np.any(pattern[owner._free])): - raise ValueError("finite free translational dead-load direction required") - with owner._commit_lock: - if owner._finite_driver is not driver: - raise ValueError("stale continuation driver") - generation=owner._generation;parent=driver._state - shell=driver._shell_origins;beam=driver._beam_origins - accepted_load=getattr(driver,"_arc_applied_load",None) - if accepted_load is None:accepted_load=getattr(driver,"_displacement_applied_load",None) - if accepted_load is None: - accepted_load=driver._applied_load if driver._programme is not None else driver._load_factor*driver._pattern - base=_owned(accepted_load if load_base is None else load_base) - if (not isinstance(amplitude_origin,(float,int,np.floating,np.integer)) - or isinstance(amplitude_origin,(bool,np.bool_)) or not np.isfinite(amplitude_origin) - or base.shape!=(n,) or not np.isfinite(base).all() or np.any(base[~allowed]) - or not np.array_equal(base+float(amplitude_origin)*pattern,accepted_load)): - raise ValueError("affine arc load must start at the accepted endpoint") - pattern=_owned(pattern) - free=np.r_[owner._free,np.arange(n,size)] - direction=np.r_[pattern,np.zeros(size-n)] - energy=float(np.max((abs(owner._K)@owner._coordinate_scale)*owner._coordinate_scale)) - if not np.isfinite(energy) or energy<=0.:raise ValueError("positive reference work scale required") - weights=np.r_[owner._coordinate_scale,energy/owner._constraint_scale]/energy - evaluations=solves=rejected=0; events=[] - - def current(): - if (owner._finite_driver is not driver or owner._generation!=generation or driver._state is not parent - or driver._shell_origins is not shell or driver._beam_origins is not beam): - raise ValueError("stale continuation predecessor") - cancellation_safe_point(cancellation_token,"stiffened-shell.arc.trial") - - def evaluate(state,amplitude): - nonlocal evaluations - current();evaluations+=1 - return driver._assemble(state,0.,shell,beam,applied_load=base+amplitude*pattern) - - def path(state): - value,gradient=path_row(driver,state,parent,metric,normal) - return value-radius,gradient - - def merit(state,evaluation): - gap,_=path(state) - return float(np.hypot(np.linalg.norm(evaluation[0][free]*weights[free]),gap)) - - state=driver._increment_origin(parent);amplitude=float(amplitude_origin);evaluation=evaluate(state,amplitude) - # Homogeneous equilibrium tangent, oriented by a physical free translation. - # Retained entries follow that tangent but do not determine its norm. - step,delta=bordered_correction(evaluation[1],np.zeros(size),direction, - predictor_dof,-orientation*metric.length,free);solves+=1 - translations=step[:nodal].reshape(-1,6)[:,:3].copy() - spins=step[:nodal].reshape(-1,6)[:,3:].copy() - for i,chart in enumerate(state.q[:owner._shell_count].reshape(-1,6)): - spins[i]=_exp_terms(chart[3:])[1]@spins[i] + or driver._external is not None): + raise ValueError("accepted admitted arc owner with fixed physical metric required") + if (not np.isfinite(radius) or radius<=0. or type(orientation) is not int or orientation not in (-1,1) + or type(predictor_dof) is not int or predictor_dof not in owner._free + or not 0<=predictor_dof=3 + or type(max_iterations) is not int or not 1<=max_iterations<=24 + or type(max_backtracks) is not int or not 0<=max_backtracks<=12): + raise ValueError("bounded radius, orientation and physical predictor required") + radius2=float(radius)*float(radius) + if not np.isfinite(radius2) or radius2<=0.: + raise ValueError("representable squared radius required") + pattern=np.array(load_direction,dtype=float,copy=True) + allowed=np.zeros(n,dtype=bool) + for start in range(0,nodal,6):allowed[start:start+3]=True + if (pattern.shape!=(n,) or not np.isfinite(pattern).all() + or np.any(pattern[~allowed]) or not np.any(pattern[owner._free])): + raise ValueError("finite free translational dead-load direction required") + with owner._commit_lock: + if owner._finite_driver is not driver: + raise ValueError("stale continuation driver") + generation=owner._generation;parent=driver._state + shell=driver._shell_origins;beam=driver._beam_origins + accepted_load=getattr(driver,"_arc_applied_load",None) + if accepted_load is None:accepted_load=getattr(driver,"_displacement_applied_load",None) + if accepted_load is None: + accepted_load=driver._applied_load if driver._programme is not None else driver._load_factor*driver._pattern + base=_owned(accepted_load if load_base is None else load_base) + if (not isinstance(amplitude_origin,(float,int,np.floating,np.integer)) + or isinstance(amplitude_origin,(bool,np.bool_)) or not np.isfinite(amplitude_origin) + or base.shape!=(n,) or not np.isfinite(base).all() or np.any(base[~allowed]) + or not np.array_equal(base+float(amplitude_origin)*pattern,accepted_load)): + raise ValueError("affine arc load must start at the accepted endpoint") + pattern=_owned(pattern) + free=np.r_[owner._free,np.arange(n,size)] + direction=np.r_[pattern,np.zeros(size-n)] + energy=float(np.max((abs(owner._K)@owner._coordinate_scale)*owner._coordinate_scale)) + if not np.isfinite(energy) or energy<=0.:raise ValueError("positive reference work scale required") + weights=np.r_[owner._coordinate_scale,energy/owner._constraint_scale]/energy + evaluations=solves=rejected=0; events=[] + + def current(): + if (owner._finite_driver is not driver or owner._generation!=generation or driver._state is not parent + or driver._shell_origins is not shell or driver._beam_origins is not beam): + raise ValueError("stale continuation predecessor") + cancellation_safe_point(cancellation_token,"stiffened-shell.arc.trial") + + def evaluate(state,amplitude): + nonlocal evaluations + current();evaluations+=1 + return driver._assemble(state,0.,shell,beam,applied_load=base+amplitude*pattern) + + def path(state): + value,gradient=path_row(driver,state,parent,metric,normal) + return value-radius,gradient + + def merit(state,evaluation): + gap,_=path(state) + return float(np.hypot(np.linalg.norm(evaluation[0][free]*weights[free]),gap)) + + state=driver._increment_origin(parent);amplitude=float(amplitude_origin);evaluation=evaluate(state,amplitude) + # Homogeneous equilibrium tangent, oriented by a physical free translation. + # Retained entries follow that tangent but do not determine its norm. + step,delta=bordered_correction(evaluation[1],np.zeros(size),direction, + predictor_dof,-orientation*metric.length,free);solves+=1 + translations=step[:nodal].reshape(-1,6)[:,:3].copy() + spins=step[:nodal].reshape(-1,6)[:,3:].copy() + for i,chart in enumerate(state.q[:owner._shell_count].reshape(-1,6)): + spins[i]=_exp_terms(chart[3:])[1]@spins[i] if type(metric) is NativeDirectorChordMetric: reference=np.concatenate((physical_frames(parent.q[:owner._shell_count],parent.shell_anchors),parent.frames)) norm=float(np.sqrt(metric.tangent_norm_squared(reference,translations,spins))) else: norm=float(np.sqrt(np.sum(metric.weights*(np.sum((translations/metric.length)**2,axis=1) +np.sum(spins*spins,axis=1))))) - if not np.isfinite(norm) or norm<=0.: - raise DisplacementCorrectorFailure("unmeasured physical continuation tangent") - normal=(translations/norm,spins/norm) - step*=radius/norm;delta*=radius/norm - if (not np.isfinite(normal[0]).all() or not np.isfinite(normal[1]).all() - or not np.isfinite(step).all() or not np.isfinite(delta)): - raise DisplacementCorrectorFailure("continuation tangent normalization not representable") + if not np.isfinite(norm) or norm<=0.: + raise DisplacementCorrectorFailure("unmeasured physical continuation tangent") + normal=(translations/norm,spins/norm) + step*=radius/norm;delta*=radius/norm + if (not np.isfinite(normal[0]).all() or not np.isfinite(normal[1]).all() + or not np.isfinite(step).all() or not np.isfinite(delta)): + raise DisplacementCorrectorFailure("continuation tangent normalization not representable") def trial_snapshot(): - gap,_=path(state) - return ArcTrial(state,amplitude,evaluation,generation,parent,shell,beam, - float(radius),float(gap/radius),evaluations,solves,rejected, - sum(row['cell_evaluations'] for row in events),_owned(base),_owned(pattern), + gap,_=path(state) + return ArcTrial(state,amplitude,evaluation,generation,parent,shell,beam, + float(radius),float(gap/radius),evaluations,solves,rejected, + sum(row['cell_evaluations'] for row in events),_owned(base),_owned(pattern), _owned(normal[0]),_owned(normal[1]),metric,predictor_dof,orientation,float(amplitude_origin)) if type(metric) is NativeDirectorChordMetric: # Refuse an invalid accepted chart before assembly above. A predictor @@ -267,17 +267,17 @@ def trial_snapshot(): else: state=driver._advance(state,step,1.);amplitude+=delta evaluation=evaluate(state,amplitude) - for iteration in range(max_iterations+1): - gap,gradient=path(state) - if iteration_records is not None: - iteration_records.append(dict(iteration=iteration,amplitude=amplitude, - equilibrium=float(evaluation[2]),constraint=float(evaluation[3]), - path_error=float(gap/radius),evaluations=evaluations, - solves=solves,rejected=rejected, - events=sum(row['cell_evaluations'] for row in events))) - if evaluation[2]<=1e-8 and evaluation[3]<=1e-9 and abs(gap)/radius<=1e-9: - with owner._commit_lock: - current() + for iteration in range(max_iterations+1): + gap,gradient=path(state) + if iteration_records is not None: + iteration_records.append(dict(iteration=iteration,amplitude=amplitude, + equilibrium=float(evaluation[2]),constraint=float(evaluation[3]), + path_error=float(gap/radius),evaluations=evaluations, + solves=solves,rejected=rejected, + events=sum(row['cell_evaluations'] for row in events))) + if evaluation[2]<=1e-8 and evaluation[3]<=1e-9 and abs(gap)/radius<=1e-9: + with owner._commit_lock: + current() trial=trial_snapshot() from ._stiffened_shell_arc_checkpoint import requires_coordinate_progress if requires_coordinate_progress(owner): @@ -285,26 +285,26 @@ def trial_snapshot(): if not progress>0.: raise ArcTrialFailure("native arc selected coordinate made no oriented progress",trial) return trial - if iteration==max_iterations: - raise ArcTrialFailure("local arc Newton limit",trial_snapshot()) - step,delta=bordered_path_correction(evaluation[1],evaluation[0],direction,gradient,gap,free);solves+=1 - record=dict(cell_evaluations=0);events.append(record) + if iteration==max_iterations: + raise ArcTrialFailure("local arc Newton limit",trial_snapshot()) + step,delta=bordered_path_correction(evaluation[1],evaluation[0],direction,gradient,gap,free);solves+=1 + record=dict(cell_evaluations=0);events.append(record) initial=1. if not native:initial,_=trial_fraction(driver,state,step,beam,current,record) - old=merit(state,evaluation) - for backtrack in range(max_backtracks+1): - amount=initial*.5**backtrack - try: + old=merit(state,evaluation) + for backtrack in range(max_backtracks+1): + amount=initial*.5**backtrack + try: candidate=driver._advance(state,step,amount) if type(metric) is NativeDirectorChordMetric: path_row(driver,candidate,parent,metric,normal) value=amplitude+amount*delta - changed=evaluate(candidate,value) - improved=merit(candidate,changed)eps or np.max(abs(e.T@e-np.eye(2)))>eps or np.max(abs(e.T@n))>eps: - raise ValueError("unit physical director and orthonormal owned tangent basis required") - object.__setattr__(self,"reference_director",n);object.__setattr__(self,"tangent_basis",e) - - def descriptor(self): - return dict(law=LAW_ID,footprint_id=self.footprint_id,shell_nodes=self.shell_nodes,beam_node=self.beam_node, - patch_cells=self.patch_cells,semantics="complete_selected_cell_patch" if self.patch_cells else "selected_nodes_only", - configuration="reference_linear_static_with_objective_spectral_continuation",rows_per_node=5,normal_spin="independent", - director=tuple(self.reference_director),tangent_basis=tuple(tuple(row) for row in self.tangent_basis),production_qualified=False) - -@dataclass(frozen=True) -class B2PhysicalRigidFootprintSelection: - footprint_ids: tuple - def __post_init__(self): - if isinstance(self.footprint_ids,(str,bytes)): raise ValueError("explicit physical footprint recovery sequence required") - values=tuple(self.footprint_ids) - if not values or any(type(v)is not str or not v for v in values) or len(set(values))!=len(values): - raise ValueError("distinct physical footprint selection IDs required") - object.__setattr__(self,"footprint_ids",values) - -@dataclass(frozen=True) -class PhysicalFootprintNode: - footprint_id: str - shell_node: int - beam_node: int - row_start: int - shell_slots: tuple - beam_slots: tuple - shell_position: tuple - beam_position: tuple - director: np.ndarray - tangent_basis: np.ndarray - constraint: np.ndarray - constraint_hessians: np.ndarray - row_count: int = 5 - - @property - def shell_matrix(self): return self.constraint[:,:6] - @property - def beam_matrix(self): return self.constraint[:,6:] - - def functional(self,shell_pose,beam_pose): - shell=_owned(shell_pose,(6,));beam=_owned(beam_pose,(6,)) + if not self.patch_cells: raise ValueError("physical rigid footprint requires complete patch_cells") + n=_owned(self.reference_director,(3,));e=_owned(self.tangent_basis,(3,2)) + eps=128*np.finfo(float).eps + if abs(n@n-1.)>eps or np.max(abs(e.T@e-np.eye(2)))>eps or np.max(abs(e.T@n))>eps: + raise ValueError("unit physical director and orthonormal owned tangent basis required") + object.__setattr__(self,"reference_director",n);object.__setattr__(self,"tangent_basis",e) + + def descriptor(self): + return dict(law=LAW_ID,footprint_id=self.footprint_id,shell_nodes=self.shell_nodes,beam_node=self.beam_node, + patch_cells=self.patch_cells,semantics="complete_selected_cell_patch" if self.patch_cells else "selected_nodes_only", + configuration="reference_linear_static_with_objective_spectral_continuation",rows_per_node=5,normal_spin="independent", + director=tuple(self.reference_director),tangent_basis=tuple(tuple(row) for row in self.tangent_basis),production_qualified=False) + +@dataclass(frozen=True) +class B2PhysicalRigidFootprintSelection: + footprint_ids: tuple + def __post_init__(self): + if isinstance(self.footprint_ids,(str,bytes)): raise ValueError("explicit physical footprint recovery sequence required") + values=tuple(self.footprint_ids) + if not values or any(type(v)is not str or not v for v in values) or len(set(values))!=len(values): + raise ValueError("distinct physical footprint selection IDs required") + object.__setattr__(self,"footprint_ids",values) + +@dataclass(frozen=True) +class PhysicalFootprintNode: + footprint_id: str + shell_node: int + beam_node: int + row_start: int + shell_slots: tuple + beam_slots: tuple + shell_position: tuple + beam_position: tuple + director: np.ndarray + tangent_basis: np.ndarray + constraint: np.ndarray + constraint_hessians: np.ndarray + row_count: int = 5 + + @property + def shell_matrix(self): return self.constraint[:,:6] + @property + def beam_matrix(self): return self.constraint[:,6:] + + def functional(self,shell_pose,beam_pose): + shell=_owned(shell_pose,(6,));beam=_owned(beam_pose,(6,)) qb=Rotation.from_rotvec(beam[3:].copy()).as_matrix();qs=Rotation.from_rotvec(shell[3:].copy()).as_matrix() - relative=qb.T@qs@self.director - if self.director@relative<=0.: raise ValueError("physical footprint director left positive hemisphere") - arm=np.array([fsum(_difference(float(a),float(b))) for a,b in zip(self.shell_position,self.beam_position)]) - return np.r_[qb.T@(arm+shell[:3]-beam[:3])-arm,self.tangent_basis.T@relative] - - def multiplier_hessian(self,multiplier): - lam=_owned(multiplier,(5,)) - return np.einsum('i,iab->ab',lam,self.constraint_hessians) - -def _node(group,item,row_start): - n=group.reference_director;e=group.tangent_basis - arm=np.array([fsum(_difference(float(a),float(b))) for a,b in zip(item.shell_position,item.beam_position)]) - c=np.zeros((5,12));c[:3,:3]=np.eye(3);c[:3,6:9]=-np.eye(3);c[:3,9:]=_skew(arm) - c[3:,3:6]=-e.T@_skew(n);c[3:,9:]=e.T@_skew(n) + relative=qb.T@qs@self.director + if self.director@relative<=0.: raise ValueError("physical footprint director left positive hemisphere") + arm=np.array([fsum(_difference(float(a),float(b))) for a,b in zip(self.shell_position,self.beam_position)]) + return np.r_[qb.T@(arm+shell[:3]-beam[:3])-arm,self.tangent_basis.T@relative] + + def multiplier_hessian(self,multiplier): + lam=_owned(multiplier,(5,)) + return np.einsum('i,iab->ab',lam,self.constraint_hessians) + +def _node(group,item,row_start): + n=group.reference_director;e=group.tangent_basis + arm=np.array([fsum(_difference(float(a),float(b))) for a,b in zip(item.shell_position,item.beam_position)]) + c=np.zeros((5,12));c[:3,:3]=np.eye(3);c[:3,6:9]=-np.eye(3);c[:3,9:]=_skew(arm) + c[3:,3:6]=-e.T@_skew(n);c[3:,9:]=e.T@_skew(n) h=np.zeros((5,12,12));basis=np.eye(3) arm_cross=np.cross(basis,arm);director_cross=np.cross(basis,n) for i in range(3): @@ -113,12 +113,12 @@ def _node(group,item,row_start): h[3:,3+i,9+j]=e.T@(-np.cross(basis[j],director_cross[i])) h[3:,9+j,3+i]=h[3:,3+i,9+j] h[3:,9+i,9+j]=e.T@(.5*(np.cross(basis[i],director_cross[j])+np.cross(basis[j],director_cross[i]))) - return PhysicalFootprintNode(group.footprint_id,item.shell_node,item.beam_node,row_start,item.shell_slots,item.beam_slots, - item.shell_position,item.beam_position,n,e,_owned(c,(5,12)),_owned(h,(5,12,12))) - -def compile_physical_footprints(groups,positions,shells,beam_positions,shell_index,beam_index,points): - groups=tuple(groups) - if any(type(g)is not B2PhysicalRigidFootprint for g in groups):raise ValueError("typed physical rigid footprints required") + return PhysicalFootprintNode(group.footprint_id,item.shell_node,item.beam_node,row_start,item.shell_slots,item.beam_slots, + item.shell_position,item.beam_position,n,e,_owned(c,(5,12)),_owned(h,(5,12,12))) + +def compile_physical_footprints(groups,positions,shells,beam_positions,shell_index,beam_index,points): + groups=tuple(groups) + if any(type(g)is not B2PhysicalRigidFootprint for g in groups):raise ValueError("typed physical rigid footprints required") # Reconstruct owned records, independently of the legacy six-row/Q4 policy. groups=tuple(B2PhysicalRigidFootprint(g.footprint_id,g.shell_nodes,g.beam_node, g.reference_director,g.tangent_basis,g.patch_cells) for g in groups) @@ -130,108 +130,108 @@ def compile_physical_footprints(groups,positions,shells,beam_positions,shell_ind for shell in shells: for node in dict.fromkeys(shell.node_ids): shells_by_node.setdefault(node,[]).append(shell) - for group in groups: - n=group.reference_director;base=np.asarray(positions[group.shell_nodes[0]]) - for node in group.shell_nodes: - d=np.asarray(positions[node])-base - if abs(d@n)>eps*(abs(d)@abs(n)):raise ValueError("physical footprint selected nodes must be coplanar with owned director") + for group in groups: + n=group.reference_director;base=np.asarray(positions[group.shell_nodes[0]]) + for node in group.shell_nodes: + d=np.asarray(positions[node])-base + if abs(d@n)>eps*(abs(d)@abs(n)):raise ValueError("physical footprint selected nodes must be coplanar with owned director") for shell in shells_by_node.get(node,()): if np.max(abs(np.asarray(shell.reference_normal)-n))>eps: - raise ValueError("physical footprint ambiguous director seam") - made=tuple(_node(by_id[item.footprint_id],item,6*len(points)+5*i) for i,item in enumerate(old)) - return groups,made - -def checked_selection(selection,groups): - if selection is None:return () - if type(selection)is not B2PhysicalRigidFootprintSelection:raise ValueError("typed physical footprint selection required") - if any(name not in {g.footprint_id for g in groups} for name in selection.footprint_ids):raise ValueError("physical footprint selection not compiled") - return selection.footprint_ids - -@dataclass(frozen=True) -class PhysicalFootprintNodeAction: - shell_node_id: int - beam_node_id: int - row_start: int - shell_force_N: tuple - shell_direct_couple_Nm: tuple - beam_force_N: tuple - beam_direct_couple_Nm: tuple - gap: tuple - -@dataclass(frozen=True) -class B2PhysicalRigidFootprintWrench: - footprint_id: str - common_reference_origin_m: tuple - shell_force_N: tuple - shell_moment_Nm: tuple - beam_force_N: tuple - beam_moment_Nm: tuple - node_actions: tuple - law_id: str = LAW_ID - production_qualified: bool = False - -def selected_wrenches(incidences,selected,multipliers,gaps): - made=[] - for name in selected: - sf=[];sm=[];bf=[];bm=[];actions=[];origin=None - for item in incidences: - if item.footprint_id!=name:continue - origin=item.beam_position;lam=np.asarray(multipliers[item.row_start:item.row_start+5]) - actual=-item.constraint.T@lam;s=actual[:6];b=actual[6:] - arm=[_difference(float(a),float(b)) for a,b in zip(item.shell_position,origin)] - moment=np.array([fsum((float(s[i+3]),arm[(i+1)%3][0]*s[(i+2)%3],arm[(i+1)%3][1]*s[(i+2)%3],-arm[(i+2)%3][0]*s[(i+1)%3],-arm[(i+2)%3][1]*s[(i+1)%3])) for i in range(3)]) - sf.append(s[:3]);sm.append(moment);bf.append(b[:3]);bm.append(b[3:]) - actions.append(PhysicalFootprintNodeAction(item.shell_node,item.beam_node,item.row_start, - tuple(s[:3]),tuple(s[3:]),tuple(b[:3]),tuple(b[3:]),tuple(gaps[item.row_start:item.row_start+5]))) - vectors=tuple(tuple(fsum(float(v[i]) for v in rows) for i in range(3)) for rows in (sf,sm,bf,bm)) - if origin is None or not np.isfinite(vectors).all():raise ValueError("finite physical footprint wrench required") - made.append(B2PhysicalRigidFootprintWrench(name,origin,*vectors,tuple(actions))) - return tuple(made) - - -def q4_exp_director_chart_correction(element,mesh,material,displacement): - """Native physical first-work pullback from linear director to Exp chart. - - PL/drilling fields are excluded by the native stationary physical covector. - Only the flat, strict-zero-shear new spectral operation calls this helper. - """ - recovered=element._recover_planar_mixed_fields(mesh,displacement,material,element.gauss_points) - local_force=recovered["stationary_coupling"]@recovered["stationary_parameters"] - frame=recovered["frame"];n=frame[:,2] - moments=np.array([frame@local_force[6*node+3:6*node+6] for node in range(4)]) - return _exp_director_covector_hessian(n,moments) - - -def _exp_director_covector_hessian(n,moments): - correction=np.zeros((24,24));axes=np.eye(3) - for node,m in enumerate(moments): - for a in range(3): - for b in range(3): - second=.5*(np.cross(axes[a],np.cross(axes[b],n))+np.cross(axes[b],np.cross(axes[a],n))) - correction[6*node+3+a,6*node+3+b]=m@np.cross(n,second) - if not np.isfinite(correction).all():raise ValueError("physical Q4 Exp-director chart work not representable") - return correction - - -def q4_kernel_frame_resultants(element,mesh,material,displacement,resultants): - """Express native physical N/M in each inherited kernel GP frame. - - M is a director-odd first stress moment; N and H are director-even. - No changes are made to the element equations or recovered source data. - """ - native=element._recover_planar_mixed_fields(mesh,displacement,material,element.gauss_points) - physical=element._physical_director_context(native["frame"])[0] - coordinates=element.get_node_coordinates(mesh) - output=np.empty((len(element.gauss_points),6)) - for k,(xi,eta) in enumerate(element.gauss_points): - _,dxi,deta=element.compute_shape_functions(float(xi),float(eta)) - kernel,*_=element._local_frame_and_derivatives(coordinates,dxi,deta) - rotation=kernel[:,:2].T@physical[:,:2] - polarity=float(kernel[:,2]@physical[:,2]) - if abs(abs(polarity)-1.)>128*np.finfo(float).eps:raise ValueError("flat Q4 physical / kernel director mismatch") - for start,sign in ((0,1.),(3,polarity)): - x,y,xy=resultants[k,start:start+3] - transformed=sign*(rotation@np.array(((x,xy),(xy,y)))@rotation.T) - output[k,start:start+3]=(transformed[0,0],transformed[1,1],transformed[0,1]) - if not np.isfinite(output).all():raise ValueError("Q4 physical stress frame transformation not representable") - return output + raise ValueError("physical footprint ambiguous director seam") + made=tuple(_node(by_id[item.footprint_id],item,6*len(points)+5*i) for i,item in enumerate(old)) + return groups,made + +def checked_selection(selection,groups): + if selection is None:return () + if type(selection)is not B2PhysicalRigidFootprintSelection:raise ValueError("typed physical footprint selection required") + if any(name not in {g.footprint_id for g in groups} for name in selection.footprint_ids):raise ValueError("physical footprint selection not compiled") + return selection.footprint_ids + +@dataclass(frozen=True) +class PhysicalFootprintNodeAction: + shell_node_id: int + beam_node_id: int + row_start: int + shell_force_N: tuple + shell_direct_couple_Nm: tuple + beam_force_N: tuple + beam_direct_couple_Nm: tuple + gap: tuple + +@dataclass(frozen=True) +class B2PhysicalRigidFootprintWrench: + footprint_id: str + common_reference_origin_m: tuple + shell_force_N: tuple + shell_moment_Nm: tuple + beam_force_N: tuple + beam_moment_Nm: tuple + node_actions: tuple + law_id: str = LAW_ID + production_qualified: bool = False + +def selected_wrenches(incidences,selected,multipliers,gaps): + made=[] + for name in selected: + sf=[];sm=[];bf=[];bm=[];actions=[];origin=None + for item in incidences: + if item.footprint_id!=name:continue + origin=item.beam_position;lam=np.asarray(multipliers[item.row_start:item.row_start+5]) + actual=-item.constraint.T@lam;s=actual[:6];b=actual[6:] + arm=[_difference(float(a),float(b)) for a,b in zip(item.shell_position,origin)] + moment=np.array([fsum((float(s[i+3]),arm[(i+1)%3][0]*s[(i+2)%3],arm[(i+1)%3][1]*s[(i+2)%3],-arm[(i+2)%3][0]*s[(i+1)%3],-arm[(i+2)%3][1]*s[(i+1)%3])) for i in range(3)]) + sf.append(s[:3]);sm.append(moment);bf.append(b[:3]);bm.append(b[3:]) + actions.append(PhysicalFootprintNodeAction(item.shell_node,item.beam_node,item.row_start, + tuple(s[:3]),tuple(s[3:]),tuple(b[:3]),tuple(b[3:]),tuple(gaps[item.row_start:item.row_start+5]))) + vectors=tuple(tuple(fsum(float(v[i]) for v in rows) for i in range(3)) for rows in (sf,sm,bf,bm)) + if origin is None or not np.isfinite(vectors).all():raise ValueError("finite physical footprint wrench required") + made.append(B2PhysicalRigidFootprintWrench(name,origin,*vectors,tuple(actions))) + return tuple(made) + + +def q4_exp_director_chart_correction(element,mesh,material,displacement): + """Native physical first-work pullback from linear director to Exp chart. + + PL/drilling fields are excluded by the native stationary physical covector. + Only the flat, strict-zero-shear new spectral operation calls this helper. + """ + recovered=element._recover_planar_mixed_fields(mesh,displacement,material,element.gauss_points) + local_force=recovered["stationary_coupling"]@recovered["stationary_parameters"] + frame=recovered["frame"];n=frame[:,2] + moments=np.array([frame@local_force[6*node+3:6*node+6] for node in range(4)]) + return _exp_director_covector_hessian(n,moments) + + +def _exp_director_covector_hessian(n,moments): + correction=np.zeros((24,24));axes=np.eye(3) + for node,m in enumerate(moments): + for a in range(3): + for b in range(3): + second=.5*(np.cross(axes[a],np.cross(axes[b],n))+np.cross(axes[b],np.cross(axes[a],n))) + correction[6*node+3+a,6*node+3+b]=m@np.cross(n,second) + if not np.isfinite(correction).all():raise ValueError("physical Q4 Exp-director chart work not representable") + return correction + + +def q4_kernel_frame_resultants(element,mesh,material,displacement,resultants): + """Express native physical N/M in each inherited kernel GP frame. + + M is a director-odd first stress moment; N and H are director-even. + No changes are made to the element equations or recovered source data. + """ + native=element._recover_planar_mixed_fields(mesh,displacement,material,element.gauss_points) + physical=element._physical_director_context(native["frame"])[0] + coordinates=element.get_node_coordinates(mesh) + output=np.empty((len(element.gauss_points),6)) + for k,(xi,eta) in enumerate(element.gauss_points): + _,dxi,deta=element.compute_shape_functions(float(xi),float(eta)) + kernel,*_=element._local_frame_and_derivatives(coordinates,dxi,deta) + rotation=kernel[:,:2].T@physical[:,:2] + polarity=float(kernel[:,2]@physical[:,2]) + if abs(abs(polarity)-1.)>128*np.finfo(float).eps:raise ValueError("flat Q4 physical / kernel director mismatch") + for start,sign in ((0,1.),(3,polarity)): + x,y,xy=resultants[k,start:start+3] + transformed=sign*(rotation@np.array(((x,xy),(xy,y)))@rotation.T) + output[k,start:start+3]=(transformed[0,0],transformed[1,1],transformed[0,1]) + if not np.isfinite(output).all():raise ValueError("Q4 physical stress frame transformation not representable") + return output diff --git a/src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py b/src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py index daef41df5..204c937bb 100644 --- a/src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py +++ b/src/anyfesolver/_stiffened_shell_b2_q4_panel_experimental.py @@ -1,1123 +1,1123 @@ -"""Small elastic multi-Q4/multi-B2 panel with existing F10 point joints. - -This is an experimental reference-linear owner. Shell and beam node identities -are explicit and separate. Reference modes require explicit physical mass. -Explicit nodal footprints have a distinct reference-linear law; virgin supported -modes retain its normal-spin locking and incomplete mechanical qualification. -No line, geometric stiffness, nonlinear state or qualification is inferred. -""" - -from __future__ import annotations - -from functools import wraps -from dataclasses import dataclass, field -from hashlib import sha256 -from math import fsum, isfinite -from numbers import Real -from typing import Callable, Mapping, Sequence - -import numpy as np -from scipy import sparse -from scipy.sparse.linalg import LinearOperator, eigs, ArpackError -from scipy.sparse.csgraph import maximum_bipartite_matching - -from ._b2_f10_f11_point_attachment import LAW_ID, compile_reference_point -from ._stiffened_shell_b2_nodal_footprint import ( - LAW_ID as FOOTPRINT_LAW_ID, B2NodalRigidFootprint, - B2NodalRigidFootprintSelection, B2NodalRigidFootprintWrench, - compile_footprints, checked_selection, selected_wrenches, -) -from ._stiffened_shell_b2_physical_rigid_footprint import ( - LAW_ID as PHYSICAL_FOOTPRINT_LAW_ID, B2PhysicalRigidFootprint, - B2PhysicalRigidFootprintSelection, B2PhysicalRigidFootprintWrench, - compile_physical_footprints, checked_selection as checked_physical_selection, - selected_wrenches as physical_selected_wrenches, -) -from ._b2_physical_linear_definition import ( - PROFILE_ID, CompiledPhysicalB2Member, PhysicalB2Member, - PhysicalB2OperatorCache, -) -from ._b2_physical_linear_batch_dev import ( - _load_value_snapshot, _checked_affine_projection as _project_affine_work, - _accurate_sparse_residual, B2NumericalSolveFailure, -) -from .control import CancellationToken, SolveCancelled -from ._stiffened_shell_physical_q4_mass import physical_mass, POLICY as Q4_MASS_POLICY -from .e4_pl_s3_v2d_element import ( - MASS_POLICY_ID as S3_V2D_TRANSLATIONAL_LUMPED_SECTION_AREAL_MASS_V1, - FORMULATION_ID as S3_V2D_FORMULATION_ID, -) -from ._b2_physical_flexibility_linear import RepresentabilityError +"""Small elastic multi-Q4/multi-B2 panel with existing F10 point joints. + +This is an experimental reference-linear owner. Shell and beam node identities +are explicit and separate. Reference modes require explicit physical mass. +Explicit nodal footprints have a distinct reference-linear law; virgin supported +modes retain its normal-spin locking and incomplete mechanical qualification. +No line, geometric stiffness, nonlinear state or qualification is inferred. +""" + +from __future__ import annotations + +from functools import wraps +from dataclasses import dataclass, field +from hashlib import sha256 +from math import fsum, isfinite +from numbers import Real +from typing import Callable, Mapping, Sequence + +import numpy as np +from scipy import sparse +from scipy.sparse.linalg import LinearOperator, eigs, ArpackError +from scipy.sparse.csgraph import maximum_bipartite_matching + +from ._b2_f10_f11_point_attachment import LAW_ID, compile_reference_point +from ._stiffened_shell_b2_nodal_footprint import ( + LAW_ID as FOOTPRINT_LAW_ID, B2NodalRigidFootprint, + B2NodalRigidFootprintSelection, B2NodalRigidFootprintWrench, + compile_footprints, checked_selection, selected_wrenches, +) +from ._stiffened_shell_b2_physical_rigid_footprint import ( + LAW_ID as PHYSICAL_FOOTPRINT_LAW_ID, B2PhysicalRigidFootprint, + B2PhysicalRigidFootprintSelection, B2PhysicalRigidFootprintWrench, + compile_physical_footprints, checked_selection as checked_physical_selection, + selected_wrenches as physical_selected_wrenches, +) +from ._b2_physical_linear_definition import ( + PROFILE_ID, CompiledPhysicalB2Member, PhysicalB2Member, + PhysicalB2OperatorCache, +) +from ._b2_physical_linear_batch_dev import ( + _load_value_snapshot, _checked_affine_projection as _project_affine_work, + _accurate_sparse_residual, B2NumericalSolveFailure, +) +from .control import CancellationToken, SolveCancelled +from ._stiffened_shell_physical_q4_mass import physical_mass, POLICY as Q4_MASS_POLICY +from .e4_pl_s3_v2d_element import ( + MASS_POLICY_ID as S3_V2D_TRANSLATIONAL_LUMPED_SECTION_AREAL_MASS_V1, + FORMULATION_ID as S3_V2D_FORMULATION_ID, +) +from ._b2_physical_flexibility_linear import RepresentabilityError from ._b2_loaded_point_trace_dev import LoadedPointMember, checked_sparse_action from ._stiffened_shell_b2_affine_resolution import certify_affine from ._b2_attachment_elimination_dev import prepare_attachment_elimination -from .e4_pl_element import _retire_q4_private_mesh_caches -from ._stiffened_shell_b2_assembly_diagnostics import active_capture, DiagnosticRefusal -from .elements import create_shell_element -from .fe_core import FEModel -from .linalg import MatrixClass, factorize_cached - -B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV = "B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV" - -class ExperimentalB2Q4PanelError(RuntimeError): - """The experimental panel cannot be prepared or used.""" - - -class _NumericalFailure(RuntimeError): - """A checked sparse panel solution failed numerically.""" - - -_MAX_DENSE_AUDIT_ROWS = 48 -_MAX_DENSE_AUDIT_VALUES = 16_384 - - -def _bounded_accurate_residual(matrix, solution, rhs): - """Stored-equation residual and outward bound using exact products. - - Only selected explicitly loaded rows use this exceptional path. Fraction - products/summation avoid FMA/fsum portability and underflow assumptions. - Conversion to binary64 is correctly rounded; a full ULP and outward final - rounding conservatively enclose the absolute rational residual. This does - not certify element/assembly rounding or forward displacement accuracy. - """ - if (not np.isfinite(matrix.data).all() or not np.isfinite(solution).all() or - not np.isfinite(rhs).all()): - raise B2NumericalSolveFailure("physical B2 residual is not representable") - defect = _accurate_sparse_residual(matrix, solution, rhs, exact_products=True) - magnitude = np.abs(defect) - with np.errstate(over="ignore", under="ignore", invalid="ignore"): - rounding = np.nextafter(magnitude, np.inf)-magnitude - upper = np.nextafter(magnitude+rounding, np.inf) - return defect, upper - - -def _checked_affine_projection(rows, multi, singles, values: np.ndarray) -> np.ndarray: - """Keep the panel's failure identity while sharing checked affine work.""" - return _project_affine_work(rows, multi, singles, values, - failure_type=_NumericalFailure, label="panel") - - -def _scaled_point_kkt(reduced_k: sparse.spmatrix, - reduced_c: sparse.spmatrix, - multiplier_compliance: sparse.spmatrix | None = None) -> tuple[sparse.csc_matrix, np.ndarray]: - """Representable congruence for the elastic point-constrained KKT. - - A zero-energy primal coordinate is valid when a constraint anchors it; - its scale then follows that constraint column. This owner admits no - negative-energy primal diagonal or unanchored zero-energy coordinate. - """ - diagonal = reduced_k.diagonal() - if not np.isfinite(diagonal).all() or np.any(diagonal < 0.): - raise ExperimentalB2Q4PanelError( - "panel factorization requires nonnegative finite primal diagonal") - primal_scale = np.empty(len(diagonal)) - positive = diagonal > 0. - with np.errstate(over="ignore", under="ignore", divide="ignore", - invalid="ignore"): - primal_scale[positive] = 1./np.sqrt(diagonal[positive]) - if np.any(~positive): - # For a positive-semidefinite elastic K, a zero diagonal has a - # zero row. An off-diagonal term instead signals invalid data. - zero_rows = reduced_k.tocsr()[np.flatnonzero(~positive)] - if np.any(zero_rows.data != 0.): - raise ExperimentalB2Q4PanelError( - "zero-energy primal row has nonzero stiffness coupling") - column_max = np.asarray( - abs(reduced_c).max(axis=0).toarray()).reshape(-1) - if (not np.isfinite(column_max[~positive]).all() or - np.any(column_max[~positive] <= 0.)): - raise ExperimentalB2Q4PanelError( - "unanchored zero-energy primal coordinate") - primal_scale[~positive] = 1./column_max[~positive] - if (not np.isfinite(primal_scale).all() or - np.any(primal_scale <= 0.)): - raise ExperimentalB2Q4PanelError( - "panel factorization scaling is not representable") - scaled_rows = reduced_c @ sparse.diags(primal_scale) - row_max = np.asarray(abs(scaled_rows).max(axis=1).toarray()).reshape(-1) - if multiplier_compliance is not None: - diagonal_h = multiplier_compliance.diagonal() - if (multiplier_compliance.shape != (reduced_c.shape[0],)*2 or - not np.isfinite(multiplier_compliance.data).all() or - np.any(diagonal_h < 0.)): - raise ExperimentalB2Q4PanelError("finite nonnegative point compliance required") - row_max = np.maximum(row_max, np.sqrt(diagonal_h)) - multiplier_scale = 1./row_max - factor_scale = np.r_[primal_scale, multiplier_scale] - kkt = sparse.bmat( - ((reduced_k, reduced_c.T), (reduced_c, None if multiplier_compliance is None - else -multiplier_compliance)), format="csc") - scaling = sparse.diags(factor_scale, format="csc") - scaled_kkt = (scaling @ kkt @ scaling).tocsc() - kkt.sort_indices() - scaled_kkt.sort_indices() - if (not np.isfinite(factor_scale).all() or - np.any(factor_scale <= 0.) or - not np.isfinite(scaled_kkt.data).all() or - kkt.nnz != scaled_kkt.nnz or - not np.array_equal(kkt.indptr, scaled_kkt.indptr) or - not np.array_equal(kkt.indices, scaled_kkt.indices) or - np.any((kkt.data != 0.) & (scaled_kkt.data == 0.))): - raise ExperimentalB2Q4PanelError( - "panel factorization scaling is not representable") - return scaled_kkt, factor_scale - - -def _require_independent_supported_point_rows(reduced_c: sparse.spmatrix) -> None: - """Bound the dense audit; defer large numerical rank to KKT factorization. - - A matching proves only structural rank. The subsequent sparse KKT - factorization must still reject numerical row dependence for larger models. - """ - rows, columns = reduced_c.shape - if rows > columns or not np.isfinite(reduced_c.data).all(): - raise ValueError("independent supported point rows required") - if rows <= _MAX_DENSE_AUDIT_ROWS and rows*columns <= _MAX_DENSE_AUDIT_VALUES: - if np.linalg.matrix_rank(reduced_c.toarray()) != rows: - raise ValueError("independent supported point rows required") - return - pattern = reduced_c.tocsr(copy=True) - pattern.eliminate_zeros() - matching = maximum_bipartite_matching(pattern, perm_type="column") - if np.any(matching < 0): - raise ValueError("structurally independent supported point rows required") - - -@dataclass(frozen=True) -class Q4PanelShell: - shell_id: str - node_ids: tuple[int, int, int, int] - E: float - nu: float - thickness_m: float - reference_normal: tuple[float, float, float] = (0., 0., 1.) - density_kg_m3: float | None = None - - -@dataclass(frozen=True) -class Q4B2Point: - point_id: str - shell_id: str - member_id: str - station: float - offset_local_m: tuple[float, float, float] = (0., 0., 0.) - - -@dataclass(frozen=True) -class S3V2DPanelShell: - """Explicit native S3 V2D elastic facet; reference mass requires modal opt-in.""" - - shell_id: str - node_ids: tuple[int, int, int] - E: float - nu: float - thickness_m: float - reference_normal: tuple[float, float, float] - density_kg_m3: float | None = None - - -@dataclass(frozen=True) -class ExperimentalB2Q4PanelCapabilities: - profile_id: str = PROFILE_ID - point_law_id: str = LAW_ID - status: str = "experimental" - production_qualified: bool = False - shell_domain: str = "multiple flat elastic Q4" - beam_domain: str = "multiple physical B2 members" - attachment: str = "F10 reference points only" - operations: tuple[str, ...] = ("solve_linear", "solve_linear_many", "close") - spectral_domain: str = "unavailable without explicit physical mass" - body_load_domain: str = "unavailable without complete physical density/mass" - point_trace_policy: str | None = None - - -@dataclass(frozen=True) -class ExperimentalB2LoadedPointCapabilities(ExperimentalB2Q4PanelCapabilities): - point_trace_policy: str = B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV - spectral_domain: str = "unsupported: loaded point trace inertia unverified" - - -@dataclass(frozen=True, eq=False) -class B2ReferenceBodyLoad: - """Owned reference-linear body load; six global coordinates per node. - - Shell nodes precede beam nodes, each in the returned ID order. Acceleration - is global in m/s2. This is a reference load, not finite-configuration gravity. - """ - - acceleration_m_s2: tuple[float, float, float] - shell_node_ids: tuple[int, ...] - beam_node_ids: tuple[int, ...] - load: np.ndarray - model_identity: str = "" - policy: str = field(default="B2_E4_PL_REFERENCE_BODY_ACCELERATION_V1", init=False) - production_qualified: bool = field(default=False, init=False) - member_recovery: str = field(default="pass typed load for particular-load equilibrated fields; .load alone retains nodal-state constitutive recovery", init=False) - - def __post_init__(self): - # Bytes-backed storage cannot be made writable, and never aliases the - # owner's compiled map or the caller's acceleration. - values = np.asarray(self.load, dtype=np.float64) - object.__setattr__(self, "load", np.frombuffer(values.tobytes(), dtype=np.float64)) - object.__setattr__(self, "acceleration_m_s2", tuple(self.acceleration_m_s2)) - object.__setattr__(self, "shell_node_ids", tuple(self.shell_node_ids)) - object.__setattr__(self, "beam_node_ids", tuple(self.beam_node_ids)) - - -@dataclass(frozen=True) -class B2LoadedMemberSections: - """Static admissible section fields; not a new loaded kinematic state.""" - - member_id: str - stations: tuple[float, ...] - resultants_left: tuple[tuple[float, ...], ...] - resultants_right: tuple[tuple[float, ...], ...] - strains_left: tuple[tuple[float, ...], ...] - strains_right: tuple[tuple[float, ...], ...] - endpoint_tractions_local: tuple[float, ...] - policy: str = field(default="B2_REFERENCE_EQUILIBRATED_MEMBER_FIELDS_V1_DEV", init=False) - production_qualified: bool = field(default=False, init=False) - - -def _beam_body_map(member: CompiledPhysicalB2Member, frame: np.ndarray) -> np.ndarray: - """Integrate physical section action before any rotary-mass cancellation.""" - section = member.definition.mass.matrix_at_reference_axis()[:, :3] - abscissae, weights = np.polynomial.legendre.leggauss(4) - stations = tuple(float((x+1.)/2.) for x in abscissae) - trace = member.operator.trace(np.zeros(12), stations=stations) - local = np.zeros((12, 3)) - with np.errstate(over="ignore", invalid="ignore"): - for weight, jacobian in zip(weights, trace.jacobian): - local += member.definition.length_m*(weight/2.)*(jacobian.T@section) - result = frame.T@local@frame[:3, :3] - if not np.isfinite(result).all(): - raise RepresentabilityError("physical B2 body-load map is not representable") - return result - - -@dataclass(frozen=True) -class ExperimentalB2Q4FootprintCapabilities(ExperimentalB2Q4PanelCapabilities): - footprint_law_id: str = FOOTPRINT_LAW_ID - footprints: tuple[B2NodalRigidFootprint, ...] = () - -@dataclass(frozen=True) -class B2PhysicalRigidFootprintCapabilities(ExperimentalB2Q4PanelCapabilities): - footprint_law_id: str = PHYSICAL_FOOTPRINT_LAW_ID - footprints: tuple[B2PhysicalRigidFootprint, ...] = () - normal_spin: str = "independent; normal torque through noncollinear translation arms" - - -@dataclass(frozen=True) -class ExperimentalB2MixedPanelCapabilities(ExperimentalB2Q4PanelCapabilities): - shell_domain: str = "explicit flat elastic Q4/native S3 V2D panel" - point_law_id: tuple[str, ...] = () - shell_formulations: tuple[tuple[str, str], ...] = () - point_laws: tuple[tuple[str, str], ...] = () - footprint_law_id: str | None = None - footprints: tuple[B2NodalRigidFootprint, ...] = () - - -@dataclass(frozen=True) -class ExperimentalB2MixedReferenceModalCapabilities(ExperimentalB2MixedPanelCapabilities): - inertia_policy: str = S3_V2D_TRANSLATIONAL_LUMPED_SECTION_AREAL_MASS_V1 - shell_mass_policies: tuple[tuple[str, str], ...] = () - s3_rotary_inertia: str = "omitted by S3 facet contributions; shared nodes may retain Q4 director inertia" - beam_mass_policy: str = "declared physical B2 sectional inertia through the station trace" - boundary_policy: str | None = None - - -B2_FREE_FREE_MODAL_ONLY_V1 = "B2_FREE_FREE_MODAL_ONLY_V1" - - -@dataclass(frozen=True) -class B2ReferenceModesRequest: - """Elastic finite reference pairs; boundary policy belongs to the definition.""" - - count: int = 3 - shift_hz: float = 1. - max_iterations: int = 600 - - def __post_init__(self): - if (type(self.count) is not int or self.count <= 0 or - type(self.max_iterations) is not int or self.max_iterations <= 0 or - isinstance(self.shift_hz, (bool, np.bool_)) or - not isinstance(self.shift_hz, (int, float, np.floating)) or - not np.isfinite(self.shift_hz) or self.shift_hz <= 0.): - raise ValueError("positive finite reference-mode controls required") - - -@dataclass(frozen=True) -class B2ReferenceModesResult: - status: str - frequencies_hz: tuple[float, ...] = () - physical_modes: tuple[tuple[float, ...], ...] = () - point_multiplier_modes: tuple[tuple[float, ...], ...] = () - equation_residuals: tuple[float, ...] = () - constraint_residuals: tuple[float, ...] = () - factorization_count: int = 0 - solve_count: int = 0 - failure_reason: str | None = None - production_qualified: bool = False - - -@dataclass(frozen=True) -class B2FreeReferenceModesResult: - """Six verified physical rigid fields and selected finite flexible pairs. - - This does not certify complete nullity or an eigenvalue error bound. - All returned numerical collections own immutable scalar tuples. - """ - - status: str - flexible: B2ReferenceModesResult - rigid_origin_m: tuple[float, ...] = () - canonical_rigid_modes: tuple[tuple[float, ...], ...] = () - rigid_modes: tuple[tuple[float, ...], ...] = () - rigid_multiplier_modes: tuple[tuple[float, ...], ...] = () - rigid_kinetic_gram: tuple[tuple[float, ...], ...] = () - rigid_equation_residuals: tuple[float, ...] = () - rigid_constraint_residuals: tuple[float, ...] = () - rigid_flexible_mass_overlap: float = 0. - spectral_shift_rad2_s2: float = 0. - failure_reason: str | None = None - policy: str = B2_FREE_FREE_MODAL_ONLY_V1 - production_qualified: bool = False - - -@dataclass(frozen=True) -class B2ModalConstraintRow: - """Immutable provenance for one actual physical constraint/multiplier row. - - Rows follow C. Footprint gaps are global; point translation gaps use the - master shell reference frame and point rotational gaps use the beam - reference frame. Multipliers are work-conjugate covectors, not display-ready - global wrenches. Frame columns give the actual basis in global coordinates. - """ - - row_index: int - component: str - point_id: str | None = None - footprint_id: str | None = None - shell_node_id: int | None = None - beam_node_id: int | None = None - coordinate_frame: str = "global" - reference_frame_columns: tuple[tuple[float, ...], ...] = ( - (1., 0., 0.), (0., 1., 0.), (0., 0., 1.)) - - -@dataclass(frozen=True) -class B2FootprintReferenceModesResult(B2ReferenceModesResult): - """Virgin descriptor modes of the reference-linear, normal-spin locked law. - - All multipliers follow constraint_rows. Inherited point_multiplier_modes - contain only the true point prefix, never footprint multipliers. - """ - - footprint_law_id: str = FOOTPRINT_LAW_ID - footprint_ids: tuple[str, ...] = () - constraint_multiplier_modes: tuple[tuple[float, ...], ...] = () - constraint_rows: tuple[B2ModalConstraintRow, ...] = () - normal_spin: str = "locked" - mechanical_qualification: str = "incomplete" - - -@dataclass(frozen=True) -class ExperimentalB2Q4PanelResult: - status: str - displacements: tuple[float, ...] = () - point_multipliers: tuple[tuple[str, tuple[float, ...]], ...] = () - affine_reactions: tuple[float, ...] = () - point_gaps: tuple[tuple[str, tuple[float, ...]], ...] = () - beam_resultants_local: tuple[tuple[str, tuple[tuple[float, ...], ...]], ...] = () - internal_strain_energy: float | None = None - factorization_count: int | None = None - solve_count: int | None = None - failure_reason: str | None = None - production_qualified: bool = False - - -@dataclass(frozen=True) -class ExperimentalB2Q4PanelSelectedCase: - case_id: str - selected_displacements: tuple[float, ...] - selected_affine_reactions: tuple[float, ...] - point_multipliers: tuple[tuple[str, tuple[float, ...]], ...] - point_gaps: tuple[tuple[str, tuple[float, ...]], ...] - beam_resultants_local: tuple[tuple[str, tuple[tuple[float, ...], ...]], ...] - internal_strain_energy: float - - -@dataclass(frozen=True) -class ExperimentalB2Q4PanelResponseEnvelope: - """One selected physical coordinate's signed complete-case extrema. - - Displacements retain m/rad and affine reactions N/Nm according to the - selected DOF. Equal extrema are governed by the first submitted case. - """ - - selected_dof: int - minimum: float - minimum_case_id: str - maximum: float - maximum_case_id: str - - -@dataclass(frozen=True) -class ExperimentalB2Q4PanelMemberResultantEnvelope: - """Signed local sectional-resultant extrema at one requested station. - - Components are N, Qy, Qz, Mx, My, Mz in the member's local frame. - Station indices distinguish repeated normalized station coordinates. - """ - - member_id: str - station_index: int - station_normalized: float - component: str - minimum: float - minimum_case_id: str - maximum: float - maximum_case_id: str - - -@dataclass(frozen=True) -class ExperimentalB2Q4PanelBatchResult: - status: str - selected_dofs: tuple[int, ...] - selected_points: tuple[str, ...] - cases: tuple[ExperimentalB2Q4PanelSelectedCase, ...] - factorization_count: int - solve_count: int - maximum_rhs_chunk: int = 1 - failure_reason: str | None = None - production_qualified: bool = False - displacement_envelopes: tuple[ExperimentalB2Q4PanelResponseEnvelope, ...] = () - affine_reaction_envelopes: tuple[ExperimentalB2Q4PanelResponseEnvelope, ...] = () - member_resultant_envelopes: tuple[ExperimentalB2Q4PanelMemberResultantEnvelope, ...] = () - - -@dataclass(frozen=True) -class ExperimentalB2Q4FootprintResult(ExperimentalB2Q4PanelResult): - footprint_ids: tuple[str, ...] = () - footprint_wrenches: tuple[B2NodalRigidFootprintWrench, ...] = () - footprint_law_id: str = FOOTPRINT_LAW_ID - -@dataclass(frozen=True) -class B2PhysicalRigidFootprintResult(ExperimentalB2Q4PanelResult): - footprint_ids: tuple[str, ...] = () - footprint_wrenches: tuple[B2PhysicalRigidFootprintWrench, ...] = () - constraint_multipliers: tuple = () - constraint_gaps: tuple = () - constraint_rows: tuple = () - footprint_law_id: str = PHYSICAL_FOOTPRINT_LAW_ID - - -@dataclass(frozen=True) -class B2PhysicalRigidFootprintSelectedCase(ExperimentalB2Q4PanelSelectedCase): - """Only requested physical outputs from one complete batch case.""" - footprint_wrenches: tuple[B2PhysicalRigidFootprintWrench, ...] = () - constraint_multipliers: tuple[float, ...] = () - constraint_gaps: tuple[float, ...] = () - footprint_law_id: str = PHYSICAL_FOOTPRINT_LAW_ID - - -@dataclass(frozen=True) -class B2PhysicalRigidFootprintBatchResult(ExperimentalB2Q4PanelBatchResult): - selected_footprints: tuple[str, ...] = () - constraint_rows: tuple = () - footprint_law_id: str = PHYSICAL_FOOTPRINT_LAW_ID - - -@dataclass(frozen=True) -class ExperimentalB2Q4FootprintSelectedCase(ExperimentalB2Q4PanelSelectedCase): - footprint_wrenches: tuple[B2NodalRigidFootprintWrench, ...] = () - - -@dataclass(frozen=True) -class ExperimentalB2Q4FootprintBatchResult(ExperimentalB2Q4PanelBatchResult): - selected_footprints: tuple[str, ...] = () - footprint_law_id: str = FOOTPRINT_LAW_ID - - -@dataclass(frozen=True) -class B2BodyLoadedPanelResult(ExperimentalB2Q4PanelResult): - body_model_identity: str = "" - body_acceleration_m_s2: tuple[float, ...] = () - equilibrated_sections: tuple[B2LoadedMemberSections, ...] = () - - -@dataclass(frozen=True) -class B2BodyLoadedFootprintResult(ExperimentalB2Q4FootprintResult): - body_model_identity: str = "" - body_acceleration_m_s2: tuple[float, ...] = () - equilibrated_sections: tuple[B2LoadedMemberSections, ...] = () - - -@dataclass(frozen=True) -class B2BodyLoadedPanelSelectedCase(ExperimentalB2Q4PanelSelectedCase): - body_model_identity: str = "" - body_acceleration_m_s2: tuple[float, ...] = () - equilibrated_sections: tuple[B2LoadedMemberSections, ...] = () - - -@dataclass(frozen=True) -class B2BodyLoadedFootprintSelectedCase(ExperimentalB2Q4FootprintSelectedCase): - body_model_identity: str = "" - body_acceleration_m_s2: tuple[float, ...] = () - equilibrated_sections: tuple[B2LoadedMemberSections, ...] = () - - -@dataclass(frozen=True) -class B2LoadedMemberPoses: - member_id: str - stations: tuple[float, ...] - poses_local: tuple[tuple[float, ...], ...] - point_trace_policy: str = field(default=B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV, init=False) - production_qualified: bool = field(default=False, init=False) - - -@dataclass(frozen=True) -class B2LoadedPointPanelResult(B2BodyLoadedPanelResult): - loaded_member_poses: tuple[B2LoadedMemberPoses, ...] = () - loaded_strain_energy: float | None = None - point_trace_policy: str = field(default=B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV, init=False) - - -@dataclass(frozen=True) -class B2LoadedPointPanelSelectedCase(B2BodyLoadedPanelSelectedCase): - loaded_member_poses: tuple[B2LoadedMemberPoses, ...] = () - loaded_strain_energy: float | None = None - point_trace_policy: str = field(default=B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV, init=False) - - -def _unique_ids(items, name): - ids = [getattr(item, name) for item in items] - if any(not isinstance(value, str) or not value.strip() for value in ids): - raise ValueError(f"nonempty {name} required") - if len(set(ids)) != len(ids): - raise ValueError(f"unique {name} required") - - -def _checked_recovery(recover_members, available): - if recover_members is None: - return None - if not isinstance(recover_members, Mapping): - raise ValueError("selected physical B2 recovery mapping required") - selected = {} - for member_id, requested in recover_members.items(): - if member_id not in available: - raise ValueError("selected physical B2 member is not compiled") - try: - stations = np.asarray(requested, dtype=float).copy() - except (TypeError, ValueError, OverflowError) as exc: - raise ValueError("finite normalized recovery stations required") from exc - if (stations.ndim != 1 or not len(stations) or - not np.isfinite(stations).all() or - np.any((stations < 0.) | (stations > 1.))): - raise ValueError("finite normalized recovery stations required") - selected[member_id] = tuple(float(value) for value in stations) - return selected - - -def _flat_vertices(vertices): - base = vertices[0] - normal = np.cross(vertices[1]-base, vertices[3]-base) - diameter = max(np.linalg.norm(a-b) for a in vertices for b in vertices) - magnitude = np.linalg.norm(normal) - if (not isfinite(diameter) or diameter <= 0. or - magnitude <= 1e-12*diameter**2 or - abs((vertices[2]-base) @ normal) > 1e-10*diameter*magnitude): - raise ValueError("nondegenerate flat Q4 shell required") - - -def _require_connected_panel(shells, members, points, footprints=()): - """Check physical incidence without forming a numerical constraint matrix.""" - neighbours = {(0, shell.shell_id): set() for shell in shells} - neighbours.update({(1, member.member_id): set() for member in members}) - - def join(a, b): - neighbours[a].add(b) - neighbours[b].add(a) - - for kind, entities in ((0, shells), (1, members)): - owners = {} - for entity in entities: - key = (kind, entity.shell_id if kind == 0 else entity.member_id) - shell_count = 3 if type(entity) is S3V2DPanelShell else 4 - if (kind == 0 and (type(entity.node_ids) is not tuple or - len(entity.node_ids) != shell_count or - any(type(node_id) is not int for node_id in entity.node_ids))): - raise ValueError("three integer S3 V2D nodes required" if shell_count == 3 - else "four integer Q4 nodes required") - for node_id in entity.node_ids: - previous = owners.setdefault(node_id, key) - join(key, previous) - for point in points: - shell_key, member_key = (0, point.shell_id), (1, point.member_id) - if shell_key not in neighbours or member_key not in neighbours: - raise ValueError("point host IDs must identify declared elements") - join(shell_key, member_key) - for group in footprints: - shell_hosts = [s for s in shells if set(s.node_ids) & set(group.shell_nodes)] - beam_hosts = [m for m in members if group.beam_node in m.node_ids] - if (not beam_hosts or set(group.shell_nodes) - - {n for s in shell_hosts for n in s.node_ids}): - raise ValueError("known shell nodes and physical B2 endpoint required") - for shell in shell_hosts: - for member in beam_hosts: - join((0, shell.shell_id), (1, member.member_id)) - first = next(iter(neighbours)) - visited = {first} - pending = [first] - while pending: - for other in neighbours[pending.pop()]-visited: - visited.add(other) - pending.append(other) - if len(visited) != len(neighbours): - raise ValueError("connected shell/beam point panel required") - - -def _supports_all_panel_rigid_fields(transformation, shell_positions, beam_positions): - """Detect all six physical rigid fields using only fixed coordinate rows. - - The constructor requires one connected physical incidence graph, so this - is its one component's necessary support check, not a stiffness/kernel or - mechanical qualification claim. u=a+w cross (X-origin), theta=w. Translate - and scale its origin/length to keep rank independent of coordinate units. - Stream at most six support rows through a 6x6 QR; no global dense rigid, - stiffness, constraint or nullspace matrix is assembled. - """ - selector = transformation.copy() - selector.eliminate_zeros() - fixed = np.flatnonzero(np.diff(selector.indptr) == 0) - if len(fixed) < 6: - return False - xyz = tuple(shell_positions[n] for n in sorted(shell_positions))+tuple( - beam_positions[n] for n in sorted(beam_positions)) - supported_nodes = np.unique(fixed//6) - origin = np.asarray(xyz[int(supported_nodes[0])], dtype=float) - length = 0. - with np.errstate(over="ignore", invalid="ignore"): - for node in supported_nodes: - arm = np.asarray(xyz[int(node)], dtype=float)-origin - if not np.isfinite(arm).all(): - return False - length = max(length, float(np.max(abs(arm)))) - length = length or 1. - reduced = np.zeros((6, 6)) - start = 0 - for node in supported_nodes: - stop = start - while stop < len(fixed) and fixed[stop]//6 == node: - stop += 1 - arm = (np.asarray(xyz[int(node)], dtype=float)-origin)/length - x, y, z = arm - cross = np.array(((0., -z, y), (z, 0., -x), (-y, x, 0.))) - rigid = np.block([[np.eye(3), -cross], [np.zeros((3, 3)), np.eye(3)]]) - reduced = np.linalg.qr(np.vstack((reduced, rigid[fixed[start:stop] % 6])), - mode="r") - start = stop - scales = np.linalg.norm(reduced, axis=0) - if not np.isfinite(reduced).all() or np.any(scales == 0.): - return False - singular = np.linalg.svd(reduced/scales, compute_uv=False) - return bool(singular[-1] > 64*np.finfo(float).eps*max(6, len(fixed))*singular[0]) - - -def _retire_private_q4_mesh(owner): - mesh = owner._private_q4_mesh - for element in owner._private_q4_elements: - _retire_q4_private_mesh_caches(element, mesh) - owner._private_q4_elements.clear() - owner._private_q4_mesh = None - - -def _private_q4_constructor_lifetime(initialize): - @wraps(initialize) - def guarded(owner, *args, **kwargs): - owner._private_q4_mesh = None - owner._private_q4_elements = [] - try: - return initialize(owner, *args, **kwargs) - except BaseException as original: - try: - _retire_private_q4_mesh(owner) - except BaseException as cleanup: - original.add_note("private Q4 retirement failed: " + repr(cleanup)) - raise - return guarded - - -class ExperimentalB2Q4PanelAnalysis: - """Own one connected reference-linear panel and its sparse factorization. - - The coordinate order is sorted shell node IDs, then sorted beam node IDs, - six global translations/rotations for each. Affine ``T/u0`` is supplied - in that order. Reactions are affine reactions; they are support reactions - only when the affine plan fixes coordinates without other MPCs. - """ - - _mixed_shells = False - - @_private_q4_constructor_lifetime - def __init__(self, shell_nodes_m: Mapping[int, Sequence[float]], - shells: Sequence[Q4PanelShell], - members: Sequence[PhysicalB2Member | CompiledPhysicalB2Member], - points: Sequence[Q4B2Point], *, - transformation: sparse.spmatrix, prescribed_offset, - footprints: Sequence[B2NodalRigidFootprint] = (), - reference_inertia_policy: str | None = None, - reference_boundary_policy: str | None = None, - point_trace_policy: str | None = None, - physical_footprints: Sequence[B2PhysicalRigidFootprint] = ()): - diagnostic = active_capture() - if diagnostic is not None: - diagnostic.begin() - if not physical_footprints or points or footprints or reference_inertia_policy is not None or reference_boundary_policy is not None or point_trace_policy is not None: - raise DiagnosticRefusal("capture admits physical static footprint compilation only") - shells = tuple(shells) - supplied_members = tuple(members) - points = tuple(points) - footprints = tuple(footprints) - physical_footprints = tuple(physical_footprints) - self._physical_footprint_law = bool(physical_footprints) - if physical_footprints: +from .e4_pl_element import _retire_q4_private_mesh_caches +from ._stiffened_shell_b2_assembly_diagnostics import active_capture, DiagnosticRefusal +from .elements import create_shell_element +from .fe_core import FEModel +from .linalg import MatrixClass, factorize_cached + +B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV = "B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV" + +class ExperimentalB2Q4PanelError(RuntimeError): + """The experimental panel cannot be prepared or used.""" + + +class _NumericalFailure(RuntimeError): + """A checked sparse panel solution failed numerically.""" + + +_MAX_DENSE_AUDIT_ROWS = 48 +_MAX_DENSE_AUDIT_VALUES = 16_384 + + +def _bounded_accurate_residual(matrix, solution, rhs): + """Stored-equation residual and outward bound using exact products. + + Only selected explicitly loaded rows use this exceptional path. Fraction + products/summation avoid FMA/fsum portability and underflow assumptions. + Conversion to binary64 is correctly rounded; a full ULP and outward final + rounding conservatively enclose the absolute rational residual. This does + not certify element/assembly rounding or forward displacement accuracy. + """ + if (not np.isfinite(matrix.data).all() or not np.isfinite(solution).all() or + not np.isfinite(rhs).all()): + raise B2NumericalSolveFailure("physical B2 residual is not representable") + defect = _accurate_sparse_residual(matrix, solution, rhs, exact_products=True) + magnitude = np.abs(defect) + with np.errstate(over="ignore", under="ignore", invalid="ignore"): + rounding = np.nextafter(magnitude, np.inf)-magnitude + upper = np.nextafter(magnitude+rounding, np.inf) + return defect, upper + + +def _checked_affine_projection(rows, multi, singles, values: np.ndarray) -> np.ndarray: + """Keep the panel's failure identity while sharing checked affine work.""" + return _project_affine_work(rows, multi, singles, values, + failure_type=_NumericalFailure, label="panel") + + +def _scaled_point_kkt(reduced_k: sparse.spmatrix, + reduced_c: sparse.spmatrix, + multiplier_compliance: sparse.spmatrix | None = None) -> tuple[sparse.csc_matrix, np.ndarray]: + """Representable congruence for the elastic point-constrained KKT. + + A zero-energy primal coordinate is valid when a constraint anchors it; + its scale then follows that constraint column. This owner admits no + negative-energy primal diagonal or unanchored zero-energy coordinate. + """ + diagonal = reduced_k.diagonal() + if not np.isfinite(diagonal).all() or np.any(diagonal < 0.): + raise ExperimentalB2Q4PanelError( + "panel factorization requires nonnegative finite primal diagonal") + primal_scale = np.empty(len(diagonal)) + positive = diagonal > 0. + with np.errstate(over="ignore", under="ignore", divide="ignore", + invalid="ignore"): + primal_scale[positive] = 1./np.sqrt(diagonal[positive]) + if np.any(~positive): + # For a positive-semidefinite elastic K, a zero diagonal has a + # zero row. An off-diagonal term instead signals invalid data. + zero_rows = reduced_k.tocsr()[np.flatnonzero(~positive)] + if np.any(zero_rows.data != 0.): + raise ExperimentalB2Q4PanelError( + "zero-energy primal row has nonzero stiffness coupling") + column_max = np.asarray( + abs(reduced_c).max(axis=0).toarray()).reshape(-1) + if (not np.isfinite(column_max[~positive]).all() or + np.any(column_max[~positive] <= 0.)): + raise ExperimentalB2Q4PanelError( + "unanchored zero-energy primal coordinate") + primal_scale[~positive] = 1./column_max[~positive] + if (not np.isfinite(primal_scale).all() or + np.any(primal_scale <= 0.)): + raise ExperimentalB2Q4PanelError( + "panel factorization scaling is not representable") + scaled_rows = reduced_c @ sparse.diags(primal_scale) + row_max = np.asarray(abs(scaled_rows).max(axis=1).toarray()).reshape(-1) + if multiplier_compliance is not None: + diagonal_h = multiplier_compliance.diagonal() + if (multiplier_compliance.shape != (reduced_c.shape[0],)*2 or + not np.isfinite(multiplier_compliance.data).all() or + np.any(diagonal_h < 0.)): + raise ExperimentalB2Q4PanelError("finite nonnegative point compliance required") + row_max = np.maximum(row_max, np.sqrt(diagonal_h)) + multiplier_scale = 1./row_max + factor_scale = np.r_[primal_scale, multiplier_scale] + kkt = sparse.bmat( + ((reduced_k, reduced_c.T), (reduced_c, None if multiplier_compliance is None + else -multiplier_compliance)), format="csc") + scaling = sparse.diags(factor_scale, format="csc") + scaled_kkt = (scaling @ kkt @ scaling).tocsc() + kkt.sort_indices() + scaled_kkt.sort_indices() + if (not np.isfinite(factor_scale).all() or + np.any(factor_scale <= 0.) or + not np.isfinite(scaled_kkt.data).all() or + kkt.nnz != scaled_kkt.nnz or + not np.array_equal(kkt.indptr, scaled_kkt.indptr) or + not np.array_equal(kkt.indices, scaled_kkt.indices) or + np.any((kkt.data != 0.) & (scaled_kkt.data == 0.))): + raise ExperimentalB2Q4PanelError( + "panel factorization scaling is not representable") + return scaled_kkt, factor_scale + + +def _require_independent_supported_point_rows(reduced_c: sparse.spmatrix) -> None: + """Bound the dense audit; defer large numerical rank to KKT factorization. + + A matching proves only structural rank. The subsequent sparse KKT + factorization must still reject numerical row dependence for larger models. + """ + rows, columns = reduced_c.shape + if rows > columns or not np.isfinite(reduced_c.data).all(): + raise ValueError("independent supported point rows required") + if rows <= _MAX_DENSE_AUDIT_ROWS and rows*columns <= _MAX_DENSE_AUDIT_VALUES: + if np.linalg.matrix_rank(reduced_c.toarray()) != rows: + raise ValueError("independent supported point rows required") + return + pattern = reduced_c.tocsr(copy=True) + pattern.eliminate_zeros() + matching = maximum_bipartite_matching(pattern, perm_type="column") + if np.any(matching < 0): + raise ValueError("structurally independent supported point rows required") + + +@dataclass(frozen=True) +class Q4PanelShell: + shell_id: str + node_ids: tuple[int, int, int, int] + E: float + nu: float + thickness_m: float + reference_normal: tuple[float, float, float] = (0., 0., 1.) + density_kg_m3: float | None = None + + +@dataclass(frozen=True) +class Q4B2Point: + point_id: str + shell_id: str + member_id: str + station: float + offset_local_m: tuple[float, float, float] = (0., 0., 0.) + + +@dataclass(frozen=True) +class S3V2DPanelShell: + """Explicit native S3 V2D elastic facet; reference mass requires modal opt-in.""" + + shell_id: str + node_ids: tuple[int, int, int] + E: float + nu: float + thickness_m: float + reference_normal: tuple[float, float, float] + density_kg_m3: float | None = None + + +@dataclass(frozen=True) +class ExperimentalB2Q4PanelCapabilities: + profile_id: str = PROFILE_ID + point_law_id: str = LAW_ID + status: str = "experimental" + production_qualified: bool = False + shell_domain: str = "multiple flat elastic Q4" + beam_domain: str = "multiple physical B2 members" + attachment: str = "F10 reference points only" + operations: tuple[str, ...] = ("solve_linear", "solve_linear_many", "close") + spectral_domain: str = "unavailable without explicit physical mass" + body_load_domain: str = "unavailable without complete physical density/mass" + point_trace_policy: str | None = None + + +@dataclass(frozen=True) +class ExperimentalB2LoadedPointCapabilities(ExperimentalB2Q4PanelCapabilities): + point_trace_policy: str = B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV + spectral_domain: str = "unsupported: loaded point trace inertia unverified" + + +@dataclass(frozen=True, eq=False) +class B2ReferenceBodyLoad: + """Owned reference-linear body load; six global coordinates per node. + + Shell nodes precede beam nodes, each in the returned ID order. Acceleration + is global in m/s2. This is a reference load, not finite-configuration gravity. + """ + + acceleration_m_s2: tuple[float, float, float] + shell_node_ids: tuple[int, ...] + beam_node_ids: tuple[int, ...] + load: np.ndarray + model_identity: str = "" + policy: str = field(default="B2_E4_PL_REFERENCE_BODY_ACCELERATION_V1", init=False) + production_qualified: bool = field(default=False, init=False) + member_recovery: str = field(default="pass typed load for particular-load equilibrated fields; .load alone retains nodal-state constitutive recovery", init=False) + + def __post_init__(self): + # Bytes-backed storage cannot be made writable, and never aliases the + # owner's compiled map or the caller's acceleration. + values = np.asarray(self.load, dtype=np.float64) + object.__setattr__(self, "load", np.frombuffer(values.tobytes(), dtype=np.float64)) + object.__setattr__(self, "acceleration_m_s2", tuple(self.acceleration_m_s2)) + object.__setattr__(self, "shell_node_ids", tuple(self.shell_node_ids)) + object.__setattr__(self, "beam_node_ids", tuple(self.beam_node_ids)) + + +@dataclass(frozen=True) +class B2LoadedMemberSections: + """Static admissible section fields; not a new loaded kinematic state.""" + + member_id: str + stations: tuple[float, ...] + resultants_left: tuple[tuple[float, ...], ...] + resultants_right: tuple[tuple[float, ...], ...] + strains_left: tuple[tuple[float, ...], ...] + strains_right: tuple[tuple[float, ...], ...] + endpoint_tractions_local: tuple[float, ...] + policy: str = field(default="B2_REFERENCE_EQUILIBRATED_MEMBER_FIELDS_V1_DEV", init=False) + production_qualified: bool = field(default=False, init=False) + + +def _beam_body_map(member: CompiledPhysicalB2Member, frame: np.ndarray) -> np.ndarray: + """Integrate physical section action before any rotary-mass cancellation.""" + section = member.definition.mass.matrix_at_reference_axis()[:, :3] + abscissae, weights = np.polynomial.legendre.leggauss(4) + stations = tuple(float((x+1.)/2.) for x in abscissae) + trace = member.operator.trace(np.zeros(12), stations=stations) + local = np.zeros((12, 3)) + with np.errstate(over="ignore", invalid="ignore"): + for weight, jacobian in zip(weights, trace.jacobian): + local += member.definition.length_m*(weight/2.)*(jacobian.T@section) + result = frame.T@local@frame[:3, :3] + if not np.isfinite(result).all(): + raise RepresentabilityError("physical B2 body-load map is not representable") + return result + + +@dataclass(frozen=True) +class ExperimentalB2Q4FootprintCapabilities(ExperimentalB2Q4PanelCapabilities): + footprint_law_id: str = FOOTPRINT_LAW_ID + footprints: tuple[B2NodalRigidFootprint, ...] = () + +@dataclass(frozen=True) +class B2PhysicalRigidFootprintCapabilities(ExperimentalB2Q4PanelCapabilities): + footprint_law_id: str = PHYSICAL_FOOTPRINT_LAW_ID + footprints: tuple[B2PhysicalRigidFootprint, ...] = () + normal_spin: str = "independent; normal torque through noncollinear translation arms" + + +@dataclass(frozen=True) +class ExperimentalB2MixedPanelCapabilities(ExperimentalB2Q4PanelCapabilities): + shell_domain: str = "explicit flat elastic Q4/native S3 V2D panel" + point_law_id: tuple[str, ...] = () + shell_formulations: tuple[tuple[str, str], ...] = () + point_laws: tuple[tuple[str, str], ...] = () + footprint_law_id: str | None = None + footprints: tuple[B2NodalRigidFootprint, ...] = () + + +@dataclass(frozen=True) +class ExperimentalB2MixedReferenceModalCapabilities(ExperimentalB2MixedPanelCapabilities): + inertia_policy: str = S3_V2D_TRANSLATIONAL_LUMPED_SECTION_AREAL_MASS_V1 + shell_mass_policies: tuple[tuple[str, str], ...] = () + s3_rotary_inertia: str = "omitted by S3 facet contributions; shared nodes may retain Q4 director inertia" + beam_mass_policy: str = "declared physical B2 sectional inertia through the station trace" + boundary_policy: str | None = None + + +B2_FREE_FREE_MODAL_ONLY_V1 = "B2_FREE_FREE_MODAL_ONLY_V1" + + +@dataclass(frozen=True) +class B2ReferenceModesRequest: + """Elastic finite reference pairs; boundary policy belongs to the definition.""" + + count: int = 3 + shift_hz: float = 1. + max_iterations: int = 600 + + def __post_init__(self): + if (type(self.count) is not int or self.count <= 0 or + type(self.max_iterations) is not int or self.max_iterations <= 0 or + isinstance(self.shift_hz, (bool, np.bool_)) or + not isinstance(self.shift_hz, (int, float, np.floating)) or + not np.isfinite(self.shift_hz) or self.shift_hz <= 0.): + raise ValueError("positive finite reference-mode controls required") + + +@dataclass(frozen=True) +class B2ReferenceModesResult: + status: str + frequencies_hz: tuple[float, ...] = () + physical_modes: tuple[tuple[float, ...], ...] = () + point_multiplier_modes: tuple[tuple[float, ...], ...] = () + equation_residuals: tuple[float, ...] = () + constraint_residuals: tuple[float, ...] = () + factorization_count: int = 0 + solve_count: int = 0 + failure_reason: str | None = None + production_qualified: bool = False + + +@dataclass(frozen=True) +class B2FreeReferenceModesResult: + """Six verified physical rigid fields and selected finite flexible pairs. + + This does not certify complete nullity or an eigenvalue error bound. + All returned numerical collections own immutable scalar tuples. + """ + + status: str + flexible: B2ReferenceModesResult + rigid_origin_m: tuple[float, ...] = () + canonical_rigid_modes: tuple[tuple[float, ...], ...] = () + rigid_modes: tuple[tuple[float, ...], ...] = () + rigid_multiplier_modes: tuple[tuple[float, ...], ...] = () + rigid_kinetic_gram: tuple[tuple[float, ...], ...] = () + rigid_equation_residuals: tuple[float, ...] = () + rigid_constraint_residuals: tuple[float, ...] = () + rigid_flexible_mass_overlap: float = 0. + spectral_shift_rad2_s2: float = 0. + failure_reason: str | None = None + policy: str = B2_FREE_FREE_MODAL_ONLY_V1 + production_qualified: bool = False + + +@dataclass(frozen=True) +class B2ModalConstraintRow: + """Immutable provenance for one actual physical constraint/multiplier row. + + Rows follow C. Footprint gaps are global; point translation gaps use the + master shell reference frame and point rotational gaps use the beam + reference frame. Multipliers are work-conjugate covectors, not display-ready + global wrenches. Frame columns give the actual basis in global coordinates. + """ + + row_index: int + component: str + point_id: str | None = None + footprint_id: str | None = None + shell_node_id: int | None = None + beam_node_id: int | None = None + coordinate_frame: str = "global" + reference_frame_columns: tuple[tuple[float, ...], ...] = ( + (1., 0., 0.), (0., 1., 0.), (0., 0., 1.)) + + +@dataclass(frozen=True) +class B2FootprintReferenceModesResult(B2ReferenceModesResult): + """Virgin descriptor modes of the reference-linear, normal-spin locked law. + + All multipliers follow constraint_rows. Inherited point_multiplier_modes + contain only the true point prefix, never footprint multipliers. + """ + + footprint_law_id: str = FOOTPRINT_LAW_ID + footprint_ids: tuple[str, ...] = () + constraint_multiplier_modes: tuple[tuple[float, ...], ...] = () + constraint_rows: tuple[B2ModalConstraintRow, ...] = () + normal_spin: str = "locked" + mechanical_qualification: str = "incomplete" + + +@dataclass(frozen=True) +class ExperimentalB2Q4PanelResult: + status: str + displacements: tuple[float, ...] = () + point_multipliers: tuple[tuple[str, tuple[float, ...]], ...] = () + affine_reactions: tuple[float, ...] = () + point_gaps: tuple[tuple[str, tuple[float, ...]], ...] = () + beam_resultants_local: tuple[tuple[str, tuple[tuple[float, ...], ...]], ...] = () + internal_strain_energy: float | None = None + factorization_count: int | None = None + solve_count: int | None = None + failure_reason: str | None = None + production_qualified: bool = False + + +@dataclass(frozen=True) +class ExperimentalB2Q4PanelSelectedCase: + case_id: str + selected_displacements: tuple[float, ...] + selected_affine_reactions: tuple[float, ...] + point_multipliers: tuple[tuple[str, tuple[float, ...]], ...] + point_gaps: tuple[tuple[str, tuple[float, ...]], ...] + beam_resultants_local: tuple[tuple[str, tuple[tuple[float, ...], ...]], ...] + internal_strain_energy: float + + +@dataclass(frozen=True) +class ExperimentalB2Q4PanelResponseEnvelope: + """One selected physical coordinate's signed complete-case extrema. + + Displacements retain m/rad and affine reactions N/Nm according to the + selected DOF. Equal extrema are governed by the first submitted case. + """ + + selected_dof: int + minimum: float + minimum_case_id: str + maximum: float + maximum_case_id: str + + +@dataclass(frozen=True) +class ExperimentalB2Q4PanelMemberResultantEnvelope: + """Signed local sectional-resultant extrema at one requested station. + + Components are N, Qy, Qz, Mx, My, Mz in the member's local frame. + Station indices distinguish repeated normalized station coordinates. + """ + + member_id: str + station_index: int + station_normalized: float + component: str + minimum: float + minimum_case_id: str + maximum: float + maximum_case_id: str + + +@dataclass(frozen=True) +class ExperimentalB2Q4PanelBatchResult: + status: str + selected_dofs: tuple[int, ...] + selected_points: tuple[str, ...] + cases: tuple[ExperimentalB2Q4PanelSelectedCase, ...] + factorization_count: int + solve_count: int + maximum_rhs_chunk: int = 1 + failure_reason: str | None = None + production_qualified: bool = False + displacement_envelopes: tuple[ExperimentalB2Q4PanelResponseEnvelope, ...] = () + affine_reaction_envelopes: tuple[ExperimentalB2Q4PanelResponseEnvelope, ...] = () + member_resultant_envelopes: tuple[ExperimentalB2Q4PanelMemberResultantEnvelope, ...] = () + + +@dataclass(frozen=True) +class ExperimentalB2Q4FootprintResult(ExperimentalB2Q4PanelResult): + footprint_ids: tuple[str, ...] = () + footprint_wrenches: tuple[B2NodalRigidFootprintWrench, ...] = () + footprint_law_id: str = FOOTPRINT_LAW_ID + +@dataclass(frozen=True) +class B2PhysicalRigidFootprintResult(ExperimentalB2Q4PanelResult): + footprint_ids: tuple[str, ...] = () + footprint_wrenches: tuple[B2PhysicalRigidFootprintWrench, ...] = () + constraint_multipliers: tuple = () + constraint_gaps: tuple = () + constraint_rows: tuple = () + footprint_law_id: str = PHYSICAL_FOOTPRINT_LAW_ID + + +@dataclass(frozen=True) +class B2PhysicalRigidFootprintSelectedCase(ExperimentalB2Q4PanelSelectedCase): + """Only requested physical outputs from one complete batch case.""" + footprint_wrenches: tuple[B2PhysicalRigidFootprintWrench, ...] = () + constraint_multipliers: tuple[float, ...] = () + constraint_gaps: tuple[float, ...] = () + footprint_law_id: str = PHYSICAL_FOOTPRINT_LAW_ID + + +@dataclass(frozen=True) +class B2PhysicalRigidFootprintBatchResult(ExperimentalB2Q4PanelBatchResult): + selected_footprints: tuple[str, ...] = () + constraint_rows: tuple = () + footprint_law_id: str = PHYSICAL_FOOTPRINT_LAW_ID + + +@dataclass(frozen=True) +class ExperimentalB2Q4FootprintSelectedCase(ExperimentalB2Q4PanelSelectedCase): + footprint_wrenches: tuple[B2NodalRigidFootprintWrench, ...] = () + + +@dataclass(frozen=True) +class ExperimentalB2Q4FootprintBatchResult(ExperimentalB2Q4PanelBatchResult): + selected_footprints: tuple[str, ...] = () + footprint_law_id: str = FOOTPRINT_LAW_ID + + +@dataclass(frozen=True) +class B2BodyLoadedPanelResult(ExperimentalB2Q4PanelResult): + body_model_identity: str = "" + body_acceleration_m_s2: tuple[float, ...] = () + equilibrated_sections: tuple[B2LoadedMemberSections, ...] = () + + +@dataclass(frozen=True) +class B2BodyLoadedFootprintResult(ExperimentalB2Q4FootprintResult): + body_model_identity: str = "" + body_acceleration_m_s2: tuple[float, ...] = () + equilibrated_sections: tuple[B2LoadedMemberSections, ...] = () + + +@dataclass(frozen=True) +class B2BodyLoadedPanelSelectedCase(ExperimentalB2Q4PanelSelectedCase): + body_model_identity: str = "" + body_acceleration_m_s2: tuple[float, ...] = () + equilibrated_sections: tuple[B2LoadedMemberSections, ...] = () + + +@dataclass(frozen=True) +class B2BodyLoadedFootprintSelectedCase(ExperimentalB2Q4FootprintSelectedCase): + body_model_identity: str = "" + body_acceleration_m_s2: tuple[float, ...] = () + equilibrated_sections: tuple[B2LoadedMemberSections, ...] = () + + +@dataclass(frozen=True) +class B2LoadedMemberPoses: + member_id: str + stations: tuple[float, ...] + poses_local: tuple[tuple[float, ...], ...] + point_trace_policy: str = field(default=B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV, init=False) + production_qualified: bool = field(default=False, init=False) + + +@dataclass(frozen=True) +class B2LoadedPointPanelResult(B2BodyLoadedPanelResult): + loaded_member_poses: tuple[B2LoadedMemberPoses, ...] = () + loaded_strain_energy: float | None = None + point_trace_policy: str = field(default=B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV, init=False) + + +@dataclass(frozen=True) +class B2LoadedPointPanelSelectedCase(B2BodyLoadedPanelSelectedCase): + loaded_member_poses: tuple[B2LoadedMemberPoses, ...] = () + loaded_strain_energy: float | None = None + point_trace_policy: str = field(default=B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV, init=False) + + +def _unique_ids(items, name): + ids = [getattr(item, name) for item in items] + if any(not isinstance(value, str) or not value.strip() for value in ids): + raise ValueError(f"nonempty {name} required") + if len(set(ids)) != len(ids): + raise ValueError(f"unique {name} required") + + +def _checked_recovery(recover_members, available): + if recover_members is None: + return None + if not isinstance(recover_members, Mapping): + raise ValueError("selected physical B2 recovery mapping required") + selected = {} + for member_id, requested in recover_members.items(): + if member_id not in available: + raise ValueError("selected physical B2 member is not compiled") + try: + stations = np.asarray(requested, dtype=float).copy() + except (TypeError, ValueError, OverflowError) as exc: + raise ValueError("finite normalized recovery stations required") from exc + if (stations.ndim != 1 or not len(stations) or + not np.isfinite(stations).all() or + np.any((stations < 0.) | (stations > 1.))): + raise ValueError("finite normalized recovery stations required") + selected[member_id] = tuple(float(value) for value in stations) + return selected + + +def _flat_vertices(vertices): + base = vertices[0] + normal = np.cross(vertices[1]-base, vertices[3]-base) + diameter = max(np.linalg.norm(a-b) for a in vertices for b in vertices) + magnitude = np.linalg.norm(normal) + if (not isfinite(diameter) or diameter <= 0. or + magnitude <= 1e-12*diameter**2 or + abs((vertices[2]-base) @ normal) > 1e-10*diameter*magnitude): + raise ValueError("nondegenerate flat Q4 shell required") + + +def _require_connected_panel(shells, members, points, footprints=()): + """Check physical incidence without forming a numerical constraint matrix.""" + neighbours = {(0, shell.shell_id): set() for shell in shells} + neighbours.update({(1, member.member_id): set() for member in members}) + + def join(a, b): + neighbours[a].add(b) + neighbours[b].add(a) + + for kind, entities in ((0, shells), (1, members)): + owners = {} + for entity in entities: + key = (kind, entity.shell_id if kind == 0 else entity.member_id) + shell_count = 3 if type(entity) is S3V2DPanelShell else 4 + if (kind == 0 and (type(entity.node_ids) is not tuple or + len(entity.node_ids) != shell_count or + any(type(node_id) is not int for node_id in entity.node_ids))): + raise ValueError("three integer S3 V2D nodes required" if shell_count == 3 + else "four integer Q4 nodes required") + for node_id in entity.node_ids: + previous = owners.setdefault(node_id, key) + join(key, previous) + for point in points: + shell_key, member_key = (0, point.shell_id), (1, point.member_id) + if shell_key not in neighbours or member_key not in neighbours: + raise ValueError("point host IDs must identify declared elements") + join(shell_key, member_key) + for group in footprints: + shell_hosts = [s for s in shells if set(s.node_ids) & set(group.shell_nodes)] + beam_hosts = [m for m in members if group.beam_node in m.node_ids] + if (not beam_hosts or set(group.shell_nodes) - + {n for s in shell_hosts for n in s.node_ids}): + raise ValueError("known shell nodes and physical B2 endpoint required") + for shell in shell_hosts: + for member in beam_hosts: + join((0, shell.shell_id), (1, member.member_id)) + first = next(iter(neighbours)) + visited = {first} + pending = [first] + while pending: + for other in neighbours[pending.pop()]-visited: + visited.add(other) + pending.append(other) + if len(visited) != len(neighbours): + raise ValueError("connected shell/beam point panel required") + + +def _supports_all_panel_rigid_fields(transformation, shell_positions, beam_positions): + """Detect all six physical rigid fields using only fixed coordinate rows. + + The constructor requires one connected physical incidence graph, so this + is its one component's necessary support check, not a stiffness/kernel or + mechanical qualification claim. u=a+w cross (X-origin), theta=w. Translate + and scale its origin/length to keep rank independent of coordinate units. + Stream at most six support rows through a 6x6 QR; no global dense rigid, + stiffness, constraint or nullspace matrix is assembled. + """ + selector = transformation.copy() + selector.eliminate_zeros() + fixed = np.flatnonzero(np.diff(selector.indptr) == 0) + if len(fixed) < 6: + return False + xyz = tuple(shell_positions[n] for n in sorted(shell_positions))+tuple( + beam_positions[n] for n in sorted(beam_positions)) + supported_nodes = np.unique(fixed//6) + origin = np.asarray(xyz[int(supported_nodes[0])], dtype=float) + length = 0. + with np.errstate(over="ignore", invalid="ignore"): + for node in supported_nodes: + arm = np.asarray(xyz[int(node)], dtype=float)-origin + if not np.isfinite(arm).all(): + return False + length = max(length, float(np.max(abs(arm)))) + length = length or 1. + reduced = np.zeros((6, 6)) + start = 0 + for node in supported_nodes: + stop = start + while stop < len(fixed) and fixed[stop]//6 == node: + stop += 1 + arm = (np.asarray(xyz[int(node)], dtype=float)-origin)/length + x, y, z = arm + cross = np.array(((0., -z, y), (z, 0., -x), (-y, x, 0.))) + rigid = np.block([[np.eye(3), -cross], [np.zeros((3, 3)), np.eye(3)]]) + reduced = np.linalg.qr(np.vstack((reduced, rigid[fixed[start:stop] % 6])), + mode="r") + start = stop + scales = np.linalg.norm(reduced, axis=0) + if not np.isfinite(reduced).all() or np.any(scales == 0.): + return False + singular = np.linalg.svd(reduced/scales, compute_uv=False) + return bool(singular[-1] > 64*np.finfo(float).eps*max(6, len(fixed))*singular[0]) + + +def _retire_private_q4_mesh(owner): + mesh = owner._private_q4_mesh + for element in owner._private_q4_elements: + _retire_q4_private_mesh_caches(element, mesh) + owner._private_q4_elements.clear() + owner._private_q4_mesh = None + + +def _private_q4_constructor_lifetime(initialize): + @wraps(initialize) + def guarded(owner, *args, **kwargs): + owner._private_q4_mesh = None + owner._private_q4_elements = [] + try: + return initialize(owner, *args, **kwargs) + except BaseException as original: + try: + _retire_private_q4_mesh(owner) + except BaseException as cleanup: + original.add_note("private Q4 retirement failed: " + repr(cleanup)) + raise + return guarded + + +class ExperimentalB2Q4PanelAnalysis: + """Own one connected reference-linear panel and its sparse factorization. + + The coordinate order is sorted shell node IDs, then sorted beam node IDs, + six global translations/rotations for each. Affine ``T/u0`` is supplied + in that order. Reactions are affine reactions; they are support reactions + only when the affine plan fixes coordinates without other MPCs. + """ + + _mixed_shells = False + + @_private_q4_constructor_lifetime + def __init__(self, shell_nodes_m: Mapping[int, Sequence[float]], + shells: Sequence[Q4PanelShell], + members: Sequence[PhysicalB2Member | CompiledPhysicalB2Member], + points: Sequence[Q4B2Point], *, + transformation: sparse.spmatrix, prescribed_offset, + footprints: Sequence[B2NodalRigidFootprint] = (), + reference_inertia_policy: str | None = None, + reference_boundary_policy: str | None = None, + point_trace_policy: str | None = None, + physical_footprints: Sequence[B2PhysicalRigidFootprint] = ()): + diagnostic = active_capture() + if diagnostic is not None: + diagnostic.begin() + if not physical_footprints or points or footprints or reference_inertia_policy is not None or reference_boundary_policy is not None or point_trace_policy is not None: + raise DiagnosticRefusal("capture admits physical static footprint compilation only") + shells = tuple(shells) + supplied_members = tuple(members) + points = tuple(points) + footprints = tuple(footprints) + physical_footprints = tuple(physical_footprints) + self._physical_footprint_law = bool(physical_footprints) + if physical_footprints: if points or footprints or reference_inertia_policy is not None or reference_boundary_policy is not None or point_trace_policy is not None: raise ValueError("separate physical footprint static family required") - footprints = physical_footprints - modal_mass = reference_inertia_policy is not None - if reference_boundary_policy is not None and ( - type(reference_boundary_policy) is not str or - reference_boundary_policy != B2_FREE_FREE_MODAL_ONLY_V1 or - not modal_mass): - raise ValueError("explicit mixed free-free modal-only boundary policy required") - self._modal_only = reference_boundary_policy is not None - self._reference_boundary_policy = reference_boundary_policy - if modal_mass and (not self._mixed_shells or - type(reference_inertia_policy) is not str or - reference_inertia_policy != S3_V2D_TRANSLATIONAL_LUMPED_SECTION_AREAL_MASS_V1 or - footprints): - raise ValueError("explicit native-S3 reference inertia policy without footprints required") - has_s3 = any(type(shell) is S3V2DPanelShell for shell in shells) - if point_trace_policy is not None and ( - type(point_trace_policy) is not str or - point_trace_policy != B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV or - self._mixed_shells or has_s3 or footprints or modal_mass): - raise ValueError("explicit Q4-only fixed-end loaded point trace without footprints or modes required") - self._point_trace_policy = point_trace_policy + footprints = physical_footprints + modal_mass = reference_inertia_policy is not None + if reference_boundary_policy is not None and ( + type(reference_boundary_policy) is not str or + reference_boundary_policy != B2_FREE_FREE_MODAL_ONLY_V1 or + not modal_mass): + raise ValueError("explicit mixed free-free modal-only boundary policy required") + self._modal_only = reference_boundary_policy is not None + self._reference_boundary_policy = reference_boundary_policy + if modal_mass and (not self._mixed_shells or + type(reference_inertia_policy) is not str or + reference_inertia_policy != S3_V2D_TRANSLATIONAL_LUMPED_SECTION_AREAL_MASS_V1 or + footprints): + raise ValueError("explicit native-S3 reference inertia policy without footprints required") + has_s3 = any(type(shell) is S3V2DPanelShell for shell in shells) + if point_trace_policy is not None and ( + type(point_trace_policy) is not str or + point_trace_policy != B2_FIXED_END_LOADED_POINT_TRACE_V1_DEV or + self._mixed_shells or has_s3 or footprints or modal_mass): + raise ValueError("explicit Q4-only fixed-end loaded point trace without footprints or modes required") + self._point_trace_policy = point_trace_policy if has_s3 and footprints and not self._physical_footprint_law: - raise ValueError("S3 mixed-panel nodal footprints are unsupported") - admitted_shells = ((Q4PanelShell, S3V2DPanelShell) if self._mixed_shells - else (Q4PanelShell,)) - footprint_type = B2PhysicalRigidFootprint if self._physical_footprint_law else B2NodalRigidFootprint - if any(type(g) is not footprint_type for g in footprints): - raise ValueError("typed experimental B2 nodal footprints required") - if (len(shells) < 2 or len(supplied_members) < 2 or not (points or footprints) or - any((type(shell) not in admitted_shells if self._mixed_shells else - not isinstance(shell, Q4PanelShell)) for shell in shells) or - any(not isinstance(member, (PhysicalB2Member, - CompiledPhysicalB2Member)) - for member in supplied_members) or - any(not isinstance(point, Q4B2Point) for point in points)): - raise ValueError("multi-Q4/S3/multi-B2 physical point panel required" if - self._mixed_shells else - "multi-Q4/multi-B2 physical point panel required") - _unique_ids(shells, "shell_id") - _unique_ids(points, "point_id") + raise ValueError("S3 mixed-panel nodal footprints are unsupported") + admitted_shells = ((Q4PanelShell, S3V2DPanelShell) if self._mixed_shells + else (Q4PanelShell,)) + footprint_type = B2PhysicalRigidFootprint if self._physical_footprint_law else B2NodalRigidFootprint + if any(type(g) is not footprint_type for g in footprints): + raise ValueError("typed experimental B2 nodal footprints required") + if (len(shells) < 2 or len(supplied_members) < 2 or not (points or footprints) or + any((type(shell) not in admitted_shells if self._mixed_shells else + not isinstance(shell, Q4PanelShell)) for shell in shells) or + any(not isinstance(member, (PhysicalB2Member, + CompiledPhysicalB2Member)) + for member in supplied_members) or + any(not isinstance(point, Q4B2Point) for point in points)): + raise ValueError("multi-Q4/S3/multi-B2 physical point panel required" if + self._mixed_shells else + "multi-Q4/multi-B2 physical point panel required") + _unique_ids(shells, "shell_id") + _unique_ids(points, "point_id") definitions = tuple(member.definition if isinstance( member, CompiledPhysicalB2Member) else member for member in supplied_members) if diagnostic is not None and (any(shell.density_kg_m3 is not None for shell in shells) or any(member.mass is not None for member in definitions)): raise DiagnosticRefusal("capture of physical mass/body-map storage is not admitted") - if modal_mass: - for shell in shells: - density = shell.density_kg_m3 - if isinstance(density, (bool, np.bool_)) or not isinstance(density, Real): - raise ValueError("mixed reference modes require complete positive finite shell density") - try: - density_value = float(density) - except OverflowError as exc: - raise ValueError("mixed reference modes require representable shell density") from exc - if not isfinite(density_value) or density_value <= 0.: - raise ValueError("mixed reference modes require complete positive finite shell density") - if any(member.mass is None for member in definitions): - raise ValueError("mixed reference modes require complete declared physical B2 mass") - if any(member.geometric is not None for member in definitions): - raise ValueError("mixed reference modes are virgin elastic; prestress/geometric metadata unsupported") - _unique_ids(definitions, "member_id") - _require_connected_panel(shells, definitions, points, footprints) - cache = PhysicalB2OperatorCache() - if diagnostic is not None: diagnostic.mark("member_compilation") - compiled = tuple( - member if isinstance(member, CompiledPhysicalB2Member) - else member.compile_local(operator_cache=cache) - for member in supplied_members) - if diagnostic is not None: diagnostic.mark("topology_mapping") - shell_ids = tuple(sorted(shell_nodes_m)) - if any(type(node_id) is not int for node_id in shell_ids): - raise ValueError("integer shell node IDs required") - positions = {} - for node_id in shell_ids: - vector = np.array(shell_nodes_m[node_id], dtype=float, copy=True) - if vector.shape != (3,) or not np.isfinite(vector).all(): - raise ValueError("finite shell node coordinates required") - positions[node_id] = vector - used_shell_nodes = {node_id for shell in shells for node_id in shell.node_ids} - if used_shell_nodes != set(shell_ids): - raise ValueError("every declared shell node must belong to a Q4/S3" if self._mixed_shells - else "every declared shell node must belong to a Q4") - shell_index = {node_id: i for i, node_id in enumerate(shell_ids)} - beam_positions = {} - for member in definitions: - for node_id, point in zip(member.node_ids, member.reference_points_m): - old = beam_positions.setdefault(node_id, point) - if old != point: - raise ValueError("shared B2 node has inconsistent position") - beam_ids = tuple(sorted(beam_positions)) - beam_index = {node_id: i+len(shell_ids) - for i, node_id in enumerate(beam_ids)} - footprint_compiler = compile_physical_footprints if self._physical_footprint_law else compile_footprints - footprints, footprint_incidence = footprint_compiler( - footprints, positions, shells, beam_positions, - shell_index, beam_index, points) - total = 6*(len(shell_ids)+len(beam_ids)) - for shell in shells: - density = shell.density_kg_m3 - if density is not None: - if isinstance(density, (bool, np.bool_)) or not isinstance(density, Real): - raise ValueError("positive finite shell density required when supplied") - try: - density_value = float(density) - except (ValueError, TypeError, OverflowError) as exc: - raise ValueError("representable positive shell density required") from exc - if not isfinite(density_value) or density_value <= 0.: - raise ValueError("positive finite shell density required when supplied") - complete_body_mass = (all(shell.density_kg_m3 is not None for shell in shells) - and all(member.definition.mass is not None for member in compiled)) - body_map = np.zeros((total, 3)) if complete_body_mass else None - body_masses = [] - if diagnostic is not None: diagnostic.mark("shell_model_setup") - model = FEModel("experimental-multi-Q4-B2-point") - self._private_q4_mesh = model.mesh - for node_id in shell_ids: - model.add_node(node_id, *positions[node_id]) - rows, columns, values = [], [], [] - mass_rows, mass_columns, mass_values = [], [], [] - complete_mass = (not has_s3 or modal_mass) and all(shell.density_kg_m3 is not None for shell in shells) - complete_mass = complete_mass and all(member.definition.mass is not None - for member in compiled) - shell_lookup = {} - pieces = [] - for index, shell in enumerate(shells, 1): - count = 3 if type(shell) is S3V2DPanelShell else 4 - if (len(shell.node_ids) != count or len(set(shell.node_ids)) != count or - any(node_id not in shell_index for node_id in shell.node_ids)): - raise ValueError("distinct declared Q4/S3 nodes required" if self._mixed_shells - else "four declared Q4 nodes required") - vertices = np.array([positions[node_id] for node_id in shell.node_ids]) - if count == 4: - _flat_vertices(vertices) - material_id = f"panel-material-{index}" - if modal_mass: - model.add_material(material_id, shell.E, shell.nu, density=shell.density_kg_m3) - else: - model.add_material(material_id, shell.E, shell.nu) - if self._mixed_shells: - element = create_shell_element( - index, list(shell.node_ids), material_id, - formulation="e4-pl-s3-v2d" if count == 3 else "e4-pl", - thickness=shell.thickness_m, - reference_normal=np.asarray(shell.reference_normal, dtype=float)) - else: - element = create_shell_element( - index, shell.node_ids, material_id, formulation="e4-pl", thickness=shell.thickness_m, - reference_normal=np.asarray(shell.reference_normal, dtype=float)) - if count == 4: - self._private_q4_elements.append(element) - model.add_element(index, element) - pieces.append((shell, vertices, element, material_id, count)) - # Native S3 scope validation must see the complete shell registry. - if diagnostic is not None: diagnostic.mark("shell_response_scatter") - for shell, vertices, element, material_id, count in pieces: - local = element.compute_stiffness_matrix( - model.mesh, model.get_material(material_id)) - if local.shape != (6*count, 6*count) or not np.isfinite(local).all(): - raise ExperimentalB2Q4PanelError("finite Q4/S3 stiffness required" if self._mixed_shells - else "finite Q4 stiffness required") - slots = np.array([6*shell_index[node_id]+component - for node_id in shell.node_ids - for component in range(6)]) - _scatter(rows, columns, values, slots, local) - if count == 4 and shell.density_kg_m3 is not None: - local_mass = physical_mass( - vertices, density_kg_m3=shell.density_kg_m3, - thickness_m=shell.thickness_m, - reference_normal=shell.reference_normal) - if complete_mass: - _scatter(mass_rows, mass_columns, mass_values, slots, local_mass) - if body_map is not None: - translations = np.zeros((24, 3)) - for i in range(4): - translations[6*i:6*i+3] = np.eye(3) - local_body = local_mass@translations - body_map[slots] += local_body - body_masses.append(fsum(float(v) for v in local_body[::6, 0])) - elif count == 3 and modal_mass: - local_mass = element.compute_mass_matrix(model.mesh, model.get_material(material_id)) - angular = np.array([6*i+j for i in range(3) for j in (3, 4, 5)]) - translation = np.array([6*i+j for i in range(3) for j in (0, 1, 2)]) - if (local_mass.shape != (18, 18) or not np.isfinite(local_mass).all() - or np.any(np.diag(local_mass)[translation] <= 0.) - or np.any(local_mass[angular, :] != 0.) - or np.any(local_mass[:, angular] != 0.)): - raise ValueError("native S3 translational mass is not representable with zero angular inertia") - _scatter(mass_rows, mass_columns, mass_values, slots, local_mass) - if count == 3 and body_map is not None: - density = shell.density_kg_m3 - area = .5*float(np.linalg.norm(np.cross(vertices[1]-vertices[0], vertices[2]-vertices[0]))) - weight = float(density)*shell.thickness_m*area/3. - if not isfinite(weight) or weight <= 0.: - raise RepresentabilityError("S3 reference body load is not representable") - for i in range(3): - body_map[slots[6*i:6*i+3]] += weight*np.eye(3) - body_masses.append(3.*weight) - shell_lookup[shell.shell_id] = (vertices, slots) - if diagnostic is not None: diagnostic.mark("beam_response_scatter") - member_lookup = {} - for member in compiled: - frame = member.local_dof_map() - local = frame.T @ member.operator.evaluate(np.zeros(12)).tangent @ frame - if local.shape != (12, 12) or not np.isfinite(local).all(): - raise ExperimentalB2Q4PanelError("finite physical B2 stiffness required") - slots = np.array([6*beam_index[node_id]+component - for node_id in member.definition.node_ids - for component in range(6)]) - _scatter(rows, columns, values, slots, local) - if complete_mass: - local_mass = frame.T@member.local_candidate_mass_matrix()@frame - if not np.isfinite(local_mass).all(): - raise ValueError("physical B2 mass assembly is not representable") - if modal_mass and np.any(np.diag(local_mass)[[0, 1, 2, 6, 7, 8]] <= 0.): - raise ValueError("physical B2 translational mass is not representable") - _scatter(mass_rows, mass_columns, mass_values, slots, local_mass) - if body_map is not None: - body_map[slots] += _beam_body_map(member, frame) - body_masses.append(member.definition.length_m*member.definition.mass.matrix_per_m[0][0]) - member_lookup[member.definition.member_id] = (member, slots) - if diagnostic is not None: diagnostic.mark("K_CSR") - K = sparse.coo_matrix((values, (rows, columns)), - shape=(total, total)).tocsr() - _release_coo_scratch(rows, columns, values, diagnostic, "K_CSR") - if diagnostic is not None: diagnostic.mark("attachment_rows") - constraint_rows, constraint_cols, constraint_values = [], [], [] - point_reference_frames = [] - point_laws = [] - buckling_points = [] - section_point_actions = {} - loaded_point_entries = {} - for point_index, point in enumerate(points): - if (point.shell_id not in shell_lookup or - point.member_id not in member_lookup): - raise ValueError("point host IDs must identify declared elements") - vertices, shell_slots = shell_lookup[point.shell_id] - member, beam_slots = member_lookup[point.member_id] - law = compile_reference_point( - member.definition, vertices, station=point.station, - offset_local_m=point.offset_local_m) - point_laws.append((point.point_id, law.law_id)) - buckling_points.append((point, law, vertices.copy(), member, - np.r_[shell_slots, beam_slots])) - if point_trace_policy is not None: - port_constraint = (law.beam_constraint_differential @ - np.kron(np.eye(2), member.definition.local_frame_rows().T)) - loaded_point_entries.setdefault(point.member_id, []).append( - (point_index, float(point.station), tuple(point.offset_local_m), port_constraint)) - if 0. < point.station < 1.: - d = np.array(point.offset_local_m, dtype=float, copy=True) - shift = np.eye(6) - shift[3:, :3] = ((0., -d[2], d[1]), (d[2], 0., -d[0]), (-d[1], d[0], 0.)) - pullback = shift@np.kron(np.eye(2), member.definition.local_frame_rows())@(-law.beam_constraint_differential.T) - pullback.setflags(write=False) - section_point_actions.setdefault(point.member_id, []).append( - (point_index, float(point.station), pullback)) - if footprints: - point_reference_frames.append(tuple( - tuple(tuple(map(float, row)) for row in frame) - for frame in law.reference_frames)) - slots = np.r_[shell_slots, beam_slots] - for local_row in range(6): - for local_col, slot in enumerate(slots): - constraint_rows.append(6*point_index+local_row) - constraint_cols.append(int(slot)) - constraint_values.append(law.constraint[local_row, local_col]) - for item in footprint_incidence: - slots = item.shell_slots+item.beam_slots - width = getattr(item, "row_count", 6) - local = np.column_stack((item.shell_matrix, getattr(item, "beam_matrix", np.eye(6)))) - for local_row in range(width): - for local_col, slot in enumerate(slots): - constraint_rows.append(item.row_start+local_row) - constraint_cols.append(slot) - constraint_values.append(local[local_row, local_col]) - if diagnostic is not None: diagnostic.mark("C_CSR") - C = sparse.coo_matrix( - (constraint_values, (constraint_rows, constraint_cols)), - shape=(6*len(points)+sum(getattr(item,"row_count",6) for item in footprint_incidence), total)).tocsr() - _release_coo_scratch(constraint_rows, constraint_cols, constraint_values, diagnostic, "C_CSR") - if diagnostic is not None: diagnostic.mark("support_reduction_scaling_elimination") - loaded_members = {} - H = None - if point_trace_policy is not None: - h_rows, h_columns, h_values = [], [], [] - for member_id, (member, _) in member_lookup.items(): - compiled_load = LoadedPointMember(member, loaded_point_entries.get(member_id, ()), - body_enabled=body_map is not None) - loaded_members[member_id] = compiled_load - slots = np.array([6*index+channel for index in compiled_load.point_indices - for channel in range(6)]) - _scatter(h_rows, h_columns, h_values, slots, compiled_load.constraint_compliance) - H = sparse.coo_matrix((h_values, (h_rows, h_columns)), shape=(C.shape[0],)*2).tocsr() - # Stored analytical zeros carry no numerical information. Remove - # them before congruence so underflow checks compare nonzero patterns. - H.eliminate_zeros() - try: - T = transformation.tocsr(copy=True) - u0 = np.array(prescribed_offset, dtype=float, copy=True) - except (AttributeError, TypeError, ValueError) as exc: - raise ValueError("finite sparse panel affine plan required") from exc - minimum_columns = C.shape[0] if point_trace_policy is None else 0 - if (T.shape[0] != total or T.shape[1] <= minimum_columns or - u0.shape != (total,) or not np.isfinite(T.data).all() or - not np.isfinite(u0).all()): - raise ValueError("finite sparse panel affine plan required") - if modal_mass: - if np.any(u0 != 0.): - raise ValueError("virgin mixed reference modes require zero prescribed offset") - selector = T.copy() - selector.eliminate_zeros() - if (np.any(np.diff(selector.tocsc().indptr) != 1) or - np.any(np.diff(selector.indptr) > 1)): - raise ValueError("mixed reference modes require coordinate supports without MPCs") - if self._modal_only: - delta = (T-sparse.eye(total, format="csr")) if T.shape == (total, total) else None - if delta is None or np.any(delta.data != 0.): - raise ValueError("free-free modal-only policy requires identity transformation without supports") - elif not _supports_all_panel_rigid_fields(T, positions, beam_positions): - raise ValueError("mixed reference modes require supports detecting all six rigid fields; free-free unsupported") - reduced_c = (C @ T).tocsc() - if point_trace_policy is None: - _require_independent_supported_point_rows(reduced_c) - elif not np.isfinite(reduced_c.data).all(): - raise ValueError("finite supported loaded-point rows required") - # Loaded fixed-end compliance can anchor a multiplier row even when - # its free-coordinate trace vanishes. Independence is therefore a - # property of the complete [K, C.T; C, -H] factorization on this route. - reduced_k = (T.T @ K @ T).tocsc() - # Congruence scaling changes factorization coordinates only. The - # physical displacement and multiplier are both restored after solve. - # Without this, a valid slender B2 section can leave point gaps above - # the physical acceptance tolerance despite a sound local operator. + if modal_mass: + for shell in shells: + density = shell.density_kg_m3 + if isinstance(density, (bool, np.bool_)) or not isinstance(density, Real): + raise ValueError("mixed reference modes require complete positive finite shell density") + try: + density_value = float(density) + except OverflowError as exc: + raise ValueError("mixed reference modes require representable shell density") from exc + if not isfinite(density_value) or density_value <= 0.: + raise ValueError("mixed reference modes require complete positive finite shell density") + if any(member.mass is None for member in definitions): + raise ValueError("mixed reference modes require complete declared physical B2 mass") + if any(member.geometric is not None for member in definitions): + raise ValueError("mixed reference modes are virgin elastic; prestress/geometric metadata unsupported") + _unique_ids(definitions, "member_id") + _require_connected_panel(shells, definitions, points, footprints) + cache = PhysicalB2OperatorCache() + if diagnostic is not None: diagnostic.mark("member_compilation") + compiled = tuple( + member if isinstance(member, CompiledPhysicalB2Member) + else member.compile_local(operator_cache=cache) + for member in supplied_members) + if diagnostic is not None: diagnostic.mark("topology_mapping") + shell_ids = tuple(sorted(shell_nodes_m)) + if any(type(node_id) is not int for node_id in shell_ids): + raise ValueError("integer shell node IDs required") + positions = {} + for node_id in shell_ids: + vector = np.array(shell_nodes_m[node_id], dtype=float, copy=True) + if vector.shape != (3,) or not np.isfinite(vector).all(): + raise ValueError("finite shell node coordinates required") + positions[node_id] = vector + used_shell_nodes = {node_id for shell in shells for node_id in shell.node_ids} + if used_shell_nodes != set(shell_ids): + raise ValueError("every declared shell node must belong to a Q4/S3" if self._mixed_shells + else "every declared shell node must belong to a Q4") + shell_index = {node_id: i for i, node_id in enumerate(shell_ids)} + beam_positions = {} + for member in definitions: + for node_id, point in zip(member.node_ids, member.reference_points_m): + old = beam_positions.setdefault(node_id, point) + if old != point: + raise ValueError("shared B2 node has inconsistent position") + beam_ids = tuple(sorted(beam_positions)) + beam_index = {node_id: i+len(shell_ids) + for i, node_id in enumerate(beam_ids)} + footprint_compiler = compile_physical_footprints if self._physical_footprint_law else compile_footprints + footprints, footprint_incidence = footprint_compiler( + footprints, positions, shells, beam_positions, + shell_index, beam_index, points) + total = 6*(len(shell_ids)+len(beam_ids)) + for shell in shells: + density = shell.density_kg_m3 + if density is not None: + if isinstance(density, (bool, np.bool_)) or not isinstance(density, Real): + raise ValueError("positive finite shell density required when supplied") + try: + density_value = float(density) + except (ValueError, TypeError, OverflowError) as exc: + raise ValueError("representable positive shell density required") from exc + if not isfinite(density_value) or density_value <= 0.: + raise ValueError("positive finite shell density required when supplied") + complete_body_mass = (all(shell.density_kg_m3 is not None for shell in shells) + and all(member.definition.mass is not None for member in compiled)) + body_map = np.zeros((total, 3)) if complete_body_mass else None + body_masses = [] + if diagnostic is not None: diagnostic.mark("shell_model_setup") + model = FEModel("experimental-multi-Q4-B2-point") + self._private_q4_mesh = model.mesh + for node_id in shell_ids: + model.add_node(node_id, *positions[node_id]) + rows, columns, values = [], [], [] + mass_rows, mass_columns, mass_values = [], [], [] + complete_mass = (not has_s3 or modal_mass) and all(shell.density_kg_m3 is not None for shell in shells) + complete_mass = complete_mass and all(member.definition.mass is not None + for member in compiled) + shell_lookup = {} + pieces = [] + for index, shell in enumerate(shells, 1): + count = 3 if type(shell) is S3V2DPanelShell else 4 + if (len(shell.node_ids) != count or len(set(shell.node_ids)) != count or + any(node_id not in shell_index for node_id in shell.node_ids)): + raise ValueError("distinct declared Q4/S3 nodes required" if self._mixed_shells + else "four declared Q4 nodes required") + vertices = np.array([positions[node_id] for node_id in shell.node_ids]) + if count == 4: + _flat_vertices(vertices) + material_id = f"panel-material-{index}" + if modal_mass: + model.add_material(material_id, shell.E, shell.nu, density=shell.density_kg_m3) + else: + model.add_material(material_id, shell.E, shell.nu) + if self._mixed_shells: + element = create_shell_element( + index, list(shell.node_ids), material_id, + formulation="e4-pl-s3-v2d" if count == 3 else "e4-pl", + thickness=shell.thickness_m, + reference_normal=np.asarray(shell.reference_normal, dtype=float)) + else: + element = create_shell_element( + index, shell.node_ids, material_id, formulation="e4-pl", thickness=shell.thickness_m, + reference_normal=np.asarray(shell.reference_normal, dtype=float)) + if count == 4: + self._private_q4_elements.append(element) + model.add_element(index, element) + pieces.append((shell, vertices, element, material_id, count)) + # Native S3 scope validation must see the complete shell registry. + if diagnostic is not None: diagnostic.mark("shell_response_scatter") + for shell, vertices, element, material_id, count in pieces: + local = element.compute_stiffness_matrix( + model.mesh, model.get_material(material_id)) + if local.shape != (6*count, 6*count) or not np.isfinite(local).all(): + raise ExperimentalB2Q4PanelError("finite Q4/S3 stiffness required" if self._mixed_shells + else "finite Q4 stiffness required") + slots = np.array([6*shell_index[node_id]+component + for node_id in shell.node_ids + for component in range(6)]) + _scatter(rows, columns, values, slots, local) + if count == 4 and shell.density_kg_m3 is not None: + local_mass = physical_mass( + vertices, density_kg_m3=shell.density_kg_m3, + thickness_m=shell.thickness_m, + reference_normal=shell.reference_normal) + if complete_mass: + _scatter(mass_rows, mass_columns, mass_values, slots, local_mass) + if body_map is not None: + translations = np.zeros((24, 3)) + for i in range(4): + translations[6*i:6*i+3] = np.eye(3) + local_body = local_mass@translations + body_map[slots] += local_body + body_masses.append(fsum(float(v) for v in local_body[::6, 0])) + elif count == 3 and modal_mass: + local_mass = element.compute_mass_matrix(model.mesh, model.get_material(material_id)) + angular = np.array([6*i+j for i in range(3) for j in (3, 4, 5)]) + translation = np.array([6*i+j for i in range(3) for j in (0, 1, 2)]) + if (local_mass.shape != (18, 18) or not np.isfinite(local_mass).all() + or np.any(np.diag(local_mass)[translation] <= 0.) + or np.any(local_mass[angular, :] != 0.) + or np.any(local_mass[:, angular] != 0.)): + raise ValueError("native S3 translational mass is not representable with zero angular inertia") + _scatter(mass_rows, mass_columns, mass_values, slots, local_mass) + if count == 3 and body_map is not None: + density = shell.density_kg_m3 + area = .5*float(np.linalg.norm(np.cross(vertices[1]-vertices[0], vertices[2]-vertices[0]))) + weight = float(density)*shell.thickness_m*area/3. + if not isfinite(weight) or weight <= 0.: + raise RepresentabilityError("S3 reference body load is not representable") + for i in range(3): + body_map[slots[6*i:6*i+3]] += weight*np.eye(3) + body_masses.append(3.*weight) + shell_lookup[shell.shell_id] = (vertices, slots) + if diagnostic is not None: diagnostic.mark("beam_response_scatter") + member_lookup = {} + for member in compiled: + frame = member.local_dof_map() + local = frame.T @ member.operator.evaluate(np.zeros(12)).tangent @ frame + if local.shape != (12, 12) or not np.isfinite(local).all(): + raise ExperimentalB2Q4PanelError("finite physical B2 stiffness required") + slots = np.array([6*beam_index[node_id]+component + for node_id in member.definition.node_ids + for component in range(6)]) + _scatter(rows, columns, values, slots, local) + if complete_mass: + local_mass = frame.T@member.local_candidate_mass_matrix()@frame + if not np.isfinite(local_mass).all(): + raise ValueError("physical B2 mass assembly is not representable") + if modal_mass and np.any(np.diag(local_mass)[[0, 1, 2, 6, 7, 8]] <= 0.): + raise ValueError("physical B2 translational mass is not representable") + _scatter(mass_rows, mass_columns, mass_values, slots, local_mass) + if body_map is not None: + body_map[slots] += _beam_body_map(member, frame) + body_masses.append(member.definition.length_m*member.definition.mass.matrix_per_m[0][0]) + member_lookup[member.definition.member_id] = (member, slots) + if diagnostic is not None: diagnostic.mark("K_CSR") + K = sparse.coo_matrix((values, (rows, columns)), + shape=(total, total)).tocsr() + _release_coo_scratch(rows, columns, values, diagnostic, "K_CSR") + if diagnostic is not None: diagnostic.mark("attachment_rows") + constraint_rows, constraint_cols, constraint_values = [], [], [] + point_reference_frames = [] + point_laws = [] + buckling_points = [] + section_point_actions = {} + loaded_point_entries = {} + for point_index, point in enumerate(points): + if (point.shell_id not in shell_lookup or + point.member_id not in member_lookup): + raise ValueError("point host IDs must identify declared elements") + vertices, shell_slots = shell_lookup[point.shell_id] + member, beam_slots = member_lookup[point.member_id] + law = compile_reference_point( + member.definition, vertices, station=point.station, + offset_local_m=point.offset_local_m) + point_laws.append((point.point_id, law.law_id)) + buckling_points.append((point, law, vertices.copy(), member, + np.r_[shell_slots, beam_slots])) + if point_trace_policy is not None: + port_constraint = (law.beam_constraint_differential @ + np.kron(np.eye(2), member.definition.local_frame_rows().T)) + loaded_point_entries.setdefault(point.member_id, []).append( + (point_index, float(point.station), tuple(point.offset_local_m), port_constraint)) + if 0. < point.station < 1.: + d = np.array(point.offset_local_m, dtype=float, copy=True) + shift = np.eye(6) + shift[3:, :3] = ((0., -d[2], d[1]), (d[2], 0., -d[0]), (-d[1], d[0], 0.)) + pullback = shift@np.kron(np.eye(2), member.definition.local_frame_rows())@(-law.beam_constraint_differential.T) + pullback.setflags(write=False) + section_point_actions.setdefault(point.member_id, []).append( + (point_index, float(point.station), pullback)) + if footprints: + point_reference_frames.append(tuple( + tuple(tuple(map(float, row)) for row in frame) + for frame in law.reference_frames)) + slots = np.r_[shell_slots, beam_slots] + for local_row in range(6): + for local_col, slot in enumerate(slots): + constraint_rows.append(6*point_index+local_row) + constraint_cols.append(int(slot)) + constraint_values.append(law.constraint[local_row, local_col]) + for item in footprint_incidence: + slots = item.shell_slots+item.beam_slots + width = getattr(item, "row_count", 6) + local = np.column_stack((item.shell_matrix, getattr(item, "beam_matrix", np.eye(6)))) + for local_row in range(width): + for local_col, slot in enumerate(slots): + constraint_rows.append(item.row_start+local_row) + constraint_cols.append(slot) + constraint_values.append(local[local_row, local_col]) + if diagnostic is not None: diagnostic.mark("C_CSR") + C = sparse.coo_matrix( + (constraint_values, (constraint_rows, constraint_cols)), + shape=(6*len(points)+sum(getattr(item,"row_count",6) for item in footprint_incidence), total)).tocsr() + _release_coo_scratch(constraint_rows, constraint_cols, constraint_values, diagnostic, "C_CSR") + if diagnostic is not None: diagnostic.mark("support_reduction_scaling_elimination") + loaded_members = {} + H = None + if point_trace_policy is not None: + h_rows, h_columns, h_values = [], [], [] + for member_id, (member, _) in member_lookup.items(): + compiled_load = LoadedPointMember(member, loaded_point_entries.get(member_id, ()), + body_enabled=body_map is not None) + loaded_members[member_id] = compiled_load + slots = np.array([6*index+channel for index in compiled_load.point_indices + for channel in range(6)]) + _scatter(h_rows, h_columns, h_values, slots, compiled_load.constraint_compliance) + H = sparse.coo_matrix((h_values, (h_rows, h_columns)), shape=(C.shape[0],)*2).tocsr() + # Stored analytical zeros carry no numerical information. Remove + # them before congruence so underflow checks compare nonzero patterns. + H.eliminate_zeros() + try: + T = transformation.tocsr(copy=True) + u0 = np.array(prescribed_offset, dtype=float, copy=True) + except (AttributeError, TypeError, ValueError) as exc: + raise ValueError("finite sparse panel affine plan required") from exc + minimum_columns = C.shape[0] if point_trace_policy is None else 0 + if (T.shape[0] != total or T.shape[1] <= minimum_columns or + u0.shape != (total,) or not np.isfinite(T.data).all() or + not np.isfinite(u0).all()): + raise ValueError("finite sparse panel affine plan required") + if modal_mass: + if np.any(u0 != 0.): + raise ValueError("virgin mixed reference modes require zero prescribed offset") + selector = T.copy() + selector.eliminate_zeros() + if (np.any(np.diff(selector.tocsc().indptr) != 1) or + np.any(np.diff(selector.indptr) > 1)): + raise ValueError("mixed reference modes require coordinate supports without MPCs") + if self._modal_only: + delta = (T-sparse.eye(total, format="csr")) if T.shape == (total, total) else None + if delta is None or np.any(delta.data != 0.): + raise ValueError("free-free modal-only policy requires identity transformation without supports") + elif not _supports_all_panel_rigid_fields(T, positions, beam_positions): + raise ValueError("mixed reference modes require supports detecting all six rigid fields; free-free unsupported") + reduced_c = (C @ T).tocsc() + if point_trace_policy is None: + _require_independent_supported_point_rows(reduced_c) + elif not np.isfinite(reduced_c.data).all(): + raise ValueError("finite supported loaded-point rows required") + # Loaded fixed-end compliance can anchor a multiplier row even when + # its free-coordinate trace vanishes. Independence is therefore a + # property of the complete [K, C.T; C, -H] factorization on this route. + reduced_k = (T.T @ K @ T).tocsc() + # Congruence scaling changes factorization coordinates only. The + # physical displacement and multiplier are both restored after solve. + # Without this, a valid slender B2 section can leave point gaps above + # the physical acceptance tolerance despite a sound local operator. handle = factor_scale = None attachment_maps = None attachment_reason = "not_physical_static_family" @@ -1136,7 +1136,7 @@ def __init__(self, shell_nodes_m: Mapping[int, Sequence[float]], scaled_kkt=scaled_kkt,factor_scale=factor_scale,attachment_maps=attachment_maps, model=model,positions=positions,beam_positions=beam_positions,shell_index=shell_index, beam_index=beam_index,shell_lookup=shell_lookup,member_lookup=member_lookup, - footprint_incidence=footprint_incidence,compiled=compiled,cache=cache, + footprint_incidence=footprint_incidence,compiled=compiled,cache=cache, private_q4_elements=self._private_q4_elements), dict(rows=rows,columns=columns,values=values,constraint_rows=constraint_rows, constraint_cols=constraint_cols,constraint_values=constraint_values, @@ -1145,131 +1145,131 @@ def __init__(self, shell_nodes_m: Mapping[int, Sequence[float]], *(m for m in supplied_members if isinstance(m,CompiledPhysicalB2Member)))) handle = (attachment_maps.factorize() if attachment_maps is not None else factorize_cached(scaled_kkt, MatrixClass.SYMMETRIC_INDEFINITE)) - if handle.status != "ok": - raise ExperimentalB2Q4PanelError( - "panel factorization failed: " + str(handle.failure_reason)) - if diagnostic is not None: - try: diagnostic.mark("owner_publication") - except BaseException: - if handle is not None: - try: handle.close() - except BaseException: pass - raise - self._modal_positions = (np.array( - [positions[i] for i in shell_ids]+[beam_positions[i] for i in beam_ids], - dtype=float, copy=True) if self._modal_only else None) - self.shell_node_ids = shell_ids - self.beam_node_ids = beam_ids - self.point_ids = tuple(point.point_id for point in points) - self._has_s3 = has_s3 - self._reference_inertia_policy = reference_inertia_policy - self._shell_formulations = tuple((shell.shell_id, element.formulation_id) - for shell, _, element, _, _ in pieces) - self._point_laws = tuple(point_laws) - self._point_reference_frames = tuple(point_reference_frames) - self.footprints = footprints - self.footprint_ids = tuple(g.footprint_id for g in footprints) - self._footprint_incidence = footprint_incidence - self._members = tuple(member_lookup.items()) - self._section_point_actions = {key: tuple(value) for key, value in section_point_actions.items()} - self._loaded_members = loaded_members - self._H = H - self._abs_H = None if H is None else abs(H) - self._K = K - # Spectral-only captures reuse the exact prepared reference operators; - # no accepted state or nonlinear material history is manufactured. - self._buckling_model = model - self._buckling_shells = tuple((shell, element, material_id, - shell_lookup[shell.shell_id][1]) for shell, _, element, material_id, _ in pieces) - self._buckling_points = tuple(buckling_points) - if body_map is not None and not np.isfinite(body_map).all(): - raise RepresentabilityError("reference body-load map is not representable") - self._body_map = body_map - self._body_mass = None - if self._body_map is not None: - try: - self._body_mass = fsum(body_masses) - except OverflowError as exc: - raise RepresentabilityError("total reference body mass is not representable") from exc - if not isfinite(self._body_mass) or self._body_mass <= 0.: - raise RepresentabilityError("total reference body mass is not representable") - self._body_map.setflags(write=False) - self._M = (sparse.coo_matrix((mass_values, (mass_rows, mass_columns)), - shape=(total, total)).tocsr() - if complete_mass else None) - if self._M is not None and not np.isfinite(self._M.data).all(): - raise ValueError("physical panel mass assembly is not representable") - self._C = C - # Freeze a translation scale from the physical reference geometry; - # rotation constraints remain in radians. Origin shifts do not alter it. - self._compatibility_length = None - if footprints: - reference = np.asarray(tuple(positions.values())+tuple(beam_positions.values())) - relative = reference-reference[0] - radius = np.linalg.norm(relative-np.mean(relative, axis=0), axis=1) - self._compatibility_length = 2.*float(np.max(radius)) - if not isfinite(self._compatibility_length) or self._compatibility_length <= 0.: - raise ValueError("representable physical reference length required") - self._T = T - self._Tt = T.T.tocsr() - self._projection_multi = np.flatnonzero( - np.diff(self._Tt.indptr) > 1) - self._projection_single = np.flatnonzero( - np.diff(self._Tt.indptr) == 1) - # Reuse the immutable CSR patterns; only the absolute values need - # separate storage for repeated RHS validation. - self._abs_K = sparse.csr_matrix( - (np.abs(K.data), K.indices, K.indptr), shape=K.shape, copy=False) - self._abs_C = sparse.csr_matrix( - (np.abs(C.data), C.indices, C.indptr), shape=C.shape, copy=False) - self._abs_Ct = abs(C.T.tocsr()) - self._abs_Tt = abs(T.T.tocsr()) - self._u0 = u0 - # One compilation-time binding covers the numerical model and physical - # member data used by body action/recovery. Never hash the model per case. - identity = sha256(b"B2_REFERENCE_BODY_LOAD_BINDING_V1_DEV") - if self._modal_only: - identity.update(reference_boundary_policy.encode("ascii")) - identity.update(repr((shell_ids, beam_ids, tuple((i, tuple(positions[i])) for i in shell_ids), self._shell_formulations, - tuple(point_laws), reference_inertia_policy)).encode("utf-8")) - for matrix in (K, C, T): - data = matrix.tocsr() - identity.update(repr(data.shape).encode("ascii")) - for array in (data.indptr, data.indices): - identity.update(np.asarray(array, dtype=" 1) + self._projection_single = np.flatnonzero( + np.diff(self._Tt.indptr) == 1) + # Reuse the immutable CSR patterns; only the absolute values need + # separate storage for repeated RHS validation. + self._abs_K = sparse.csr_matrix( + (np.abs(K.data), K.indices, K.indptr), shape=K.shape, copy=False) + self._abs_C = sparse.csr_matrix( + (np.abs(C.data), C.indices, C.indptr), shape=C.shape, copy=False) + self._abs_Ct = abs(C.T.tocsr()) + self._abs_Tt = abs(T.T.tocsr()) + self._u0 = u0 + # One compilation-time binding covers the numerical model and physical + # member data used by body action/recovery. Never hash the model per case. + identity = sha256(b"B2_REFERENCE_BODY_LOAD_BINDING_V1_DEV") + if self._modal_only: + identity.update(reference_boundary_policy.encode("ascii")) + identity.update(repr((shell_ids, beam_ids, tuple((i, tuple(positions[i])) for i in shell_ids), self._shell_formulations, + tuple(point_laws), reference_inertia_policy)).encode("utf-8")) + for matrix in (K, C, T): + data = matrix.tocsr() + identity.update(repr(data.shape).encode("ascii")) + for array in (data.indptr, data.indices): + identity.update(np.asarray(array, dtype=" 0.) - ratios[(tolerance == 0.) & (projected == 0.)] = 0. - return float(np.max(ratios)) - - def _physical_work_ratio(self, answer, applied): - """Check one explicit physical load against homogeneous-constraint work.""" - if np.any(self._u0 != 0.): - return 0. - q = answer[:-len(self._cu0)] - u = np.asarray(self._T @ q).reshape(-1) - with np.errstate(over="ignore", under="ignore", invalid="ignore"): - internal = float(u @ (self._K @ u)) - external = float(u @ applied) - if not isfinite(internal) or not isfinite(external): - raise _NumericalFailure("panel physical footprint work is not representable") - defect = abs(internal-external) - # The physical-footprint family admits no points, body-load driver or - # nonzero constraint RHS. Keep the registered work absolute allowance. - tolerance = 1e-12 + 1e-8*abs(external) - return defect/tolerance - + self._closed = False + if diagnostic is not None: + try: diagnostic.finish() + except BaseException: + try: self.close() + except BaseException: pass + raise + + def _physical_equilibrium_ratio(self, answer, applied): + """Measure the existing per-row equilibrium check before recovery.""" + q, lam = answer[:-len(self._cu0)], answer[-len(self._cu0):] + u = np.asarray(self._T @ q).reshape(-1)+self._u0 + force = np.asarray(self._K @ u).reshape(-1) + constraint_force = np.asarray(self._C.T @ lam).reshape(-1) + projected = self._project(force+constraint_force-applied) + physical_force_scale = np.asarray( + self._abs_K @ np.abs(u)+self._abs_Ct @ np.abs(lam)+ + np.abs(applied)).reshape(-1) + equilibrium_scale = np.asarray(self._abs_Tt @ physical_force_scale).reshape(-1) + by_node = physical_force_scale.reshape(-1, 6) + physical_roundoff = np.tile( + (float(np.max(by_node[:, :3])),)*3+ + (float(np.max(by_node[:, 3:])),)*3, len(by_node)) + projected_roundoff = np.asarray(self._abs_Tt @ physical_roundoff).reshape(-1) + tolerance = (1e-9*equilibrium_scale+ + len(answer)*np.finfo(float).eps*projected_roundoff) + if (not np.isfinite(projected).all() or + not np.isfinite(tolerance).all() or np.any(tolerance < 0.)): + raise _NumericalFailure("panel equilibrium correction is not representable") + with np.errstate(divide="ignore", invalid="ignore"): + ratios = np.divide(np.abs(projected), tolerance, + out=np.full_like(projected, np.inf), + where=tolerance > 0.) + ratios[(tolerance == 0.) & (projected == 0.)] = 0. + return float(np.max(ratios)) + + def _physical_work_ratio(self, answer, applied): + """Check one explicit physical load against homogeneous-constraint work.""" + if np.any(self._u0 != 0.): + return 0. + q = answer[:-len(self._cu0)] + u = np.asarray(self._T @ q).reshape(-1) + with np.errstate(over="ignore", under="ignore", invalid="ignore"): + internal = float(u @ (self._K @ u)) + external = float(u @ applied) + if not isfinite(internal) or not isfinite(external): + raise _NumericalFailure("panel physical footprint work is not representable") + defect = abs(internal-external) + # The physical-footprint family admits no points, body-load driver or + # nonzero constraint RHS. Keep the registered work absolute allowance. + tolerance = 1e-12 + 1e-8*abs(external) + return defect/tolerance + @staticmethod def _structural_physical_singletons(C, T, u0): """Admit only a single product with individually zero offset terms. @@ -1437,9 +1437,9 @@ def _correct_physical_equilibrium(self, scaled_answer, scaled_rhs, applied): Physical equation/work/compatibility acceptance remains unchanged. """ answer = self._restore_physical_singletons(self._factor_scale*scaled_answer) - original_ratio = self._physical_equilibrium_ratio(answer, applied) - original_work_ratio = self._physical_work_ratio(answer, applied) - original_score = max(original_ratio, original_work_ratio) + original_ratio = self._physical_equilibrium_ratio(answer, applied) + original_work_ratio = self._physical_work_ratio(answer, applied) + original_score = max(original_ratio, original_work_ratio) if original_score <= 1.: return answer original_target = self._physical_original_residual(answer, applied) @@ -1447,37 +1447,37 @@ def _correct_physical_equilibrium(self, scaled_answer, scaled_rhs, applied): correction_rhs = -self._factor_scale*original_target if (not np.isfinite(correction_rhs).all() or np.any((original_target != 0.) & (correction_rhs == 0.))): - raise _NumericalFailure("panel equilibrium correction is not representable") - try: - delta = np.asarray(self._handle.solve(correction_rhs), dtype=float) - except RuntimeError as exc: - raise _NumericalFailure("panel equilibrium correction failed: " + str(exc)) from exc + raise _NumericalFailure("panel equilibrium correction is not representable") + try: + delta = np.asarray(self._handle.solve(correction_rhs), dtype=float) + except RuntimeError as exc: + raise _NumericalFailure("panel equilibrium correction failed: " + str(exc)) from exc with np.errstate(over="ignore", under="ignore", invalid="ignore"): candidate = answer+self._factor_scale*delta if candidate.shape != answer.shape or not np.isfinite(candidate).all(): raise _NumericalFailure("finite panel equilibrium correction required") candidate = self._restore_physical_singletons(candidate) - candidate_score = max(self._physical_equilibrium_ratio(candidate, applied), - self._physical_work_ratio(candidate, applied)) - if candidate_score >= original_score: - raise _NumericalFailure("panel equilibrium correction did not improve") - return candidate - + candidate_score = max(self._physical_equilibrium_ratio(candidate, applied), + self._physical_work_ratio(candidate, applied)) + if candidate_score >= original_score: + raise _NumericalFailure("panel equilibrium correction did not improve") + return candidate + def _explicit_load_resolved(self, answer, rhs, explicit_rhs, *, applied=None, reconstructed=None) -> bool: - """Certify active stored KKT rows without a model-wide force floor. - + """Certify active stored KKT rows without a model-wide force floor. + Pure unit selectors retain the stored KKT certificate. Zero-offset footprint affine maps certify exact physical virtual equilibrium and the actual reconstruction error from original sparse operators/load. Nonzero offsets and loaded-point affine maps remain ineligible. This resolves net projected loads only, not cancelling individual actions. All existing physical equilibrium/compatibility checks still apply. - """ - if (np.any(self._u0 != 0.) or not np.isfinite(answer).all() or - not np.isfinite(rhs).all()): - return False - selector = self._T.tocsc(copy=True) - selector.eliminate_zeros() + """ + if (np.any(self._u0 != 0.) or not np.isfinite(answer).all() or + not np.isfinite(rhs).all()): + return False + selector = self._T.tocsc(copy=True) + selector.eliminate_zeros() if (np.any(np.diff(selector.indptr) != 1) or np.any(selector.data != 1.) or len(np.unique(selector.indices)) != selector.shape[1]): @@ -1488,960 +1488,960 @@ def _explicit_load_resolved(self, answer, rhs, explicit_rhs, *, applied=None, re return certify_affine(self._K,self._C,self._T,answer,applied,reconstructed,self._affine_resolution_cache) except B2NumericalSolveFailure: return False - active = np.flatnonzero(explicit_rhs > 0.) - with np.errstate(over="ignore", under="ignore", invalid="ignore"): - cap = np.nextafter(1e-9*explicit_rhs[active], 0.) - if not len(active) or np.any(cap <= 0.) or not np.isfinite(cap).all(): - return False - if self._resolution_kkt is None: - columns = selector.indices - rk = self._K.tocsr()[columns][:, columns] - rc = self._C.tocsr()[:, columns] - self._resolution_kkt = sparse.bmat( - ((rk, rc.T), (rc, None if self._point_trace_policy is None else -self._H)), format="csr") - try: - _, upper = _bounded_accurate_residual( - self._resolution_kkt[active], answer[:, None], rhs[active, None]) - except B2NumericalSolveFailure: - return False - return bool(np.isfinite(upper).all() and np.all(upper[:, 0] <= cap)) - - def _project(self, values: np.ndarray) -> np.ndarray: - return _checked_affine_projection( - self._Tt, self._projection_multi, self._projection_single, values) - - def _footprint_gap_tolerance(self, u, gap_scale, roundoff_fraction): - """Quiet-channel solve admission, bounded by reference compatibility. - + active = np.flatnonzero(explicit_rhs > 0.) + with np.errstate(over="ignore", under="ignore", invalid="ignore"): + cap = np.nextafter(1e-9*explicit_rhs[active], 0.) + if not len(active) or np.any(cap <= 0.) or not np.isfinite(cap).all(): + return False + if self._resolution_kkt is None: + columns = selector.indices + rk = self._K.tocsr()[columns][:, columns] + rc = self._C.tocsr()[:, columns] + self._resolution_kkt = sparse.bmat( + ((rk, rc.T), (rc, None if self._point_trace_policy is None else -self._H)), format="csr") + try: + _, upper = _bounded_accurate_residual( + self._resolution_kkt[active], answer[:, None], rhs[active, None]) + except B2NumericalSolveFailure: + return False + return bool(np.isfinite(upper).all() and np.all(upper[:, 0] <= cap)) + + def _project(self, values: np.ndarray) -> np.ndarray: + return _checked_affine_projection( + self._Tt, self._projection_multi, self._projection_single, values) + + def _footprint_gap_tolerance(self, u, gap_scale, roundoff_fraction): + """Quiet-channel solve admission, bounded by reference compatibility. + Called only after explicit-load certification for unit selectors or proved general-affine footprint maps, with zero offsets. This is a solve/compatibility convention, not a bound on - rounding in C@u. Translation and rotation amplitudes stay separate; - actual row coefficients include eccentric lever arms. Historical point - rows retain their original check. Every footprint row also stays below - the independent reference-geometry 1e-9 compatibility cap. - """ - tolerance = 1e-9*gap_scale - poses = np.abs(u).reshape(-1, 6) - amplitude = np.tile((float(np.max(poses[:, :3])),)*3+ - (float(np.max(poses[:, 3:])),)*3, len(poses)) - allowance = roundoff_fraction*np.asarray(self._abs_C@amplitude).reshape(-1) - if not np.isfinite(allowance).all(): - raise _NumericalFailure("footprint compatibility allowance is not representable") - for item in self._footprint_incidence: - width = getattr(item,"row_count",6) - rows = slice(item.row_start, item.row_start+width) - cap = 1e-9*np.array((self._compatibility_length,)*3+(1.,)*(width-3)) - tolerance[rows] = np.minimum(tolerance[rows]+allowance[rows], cap) - return tolerance - - @property - def capabilities(self) -> ExperimentalB2Q4PanelCapabilities: - if self._physical_footprint_law: - return B2PhysicalRigidFootprintCapabilities( - attachment="physical rigid-region translations and director tangents; five rows per selected node", + rounding in C@u. Translation and rotation amplitudes stay separate; + actual row coefficients include eccentric lever arms. Historical point + rows retain their original check. Every footprint row also stays below + the independent reference-geometry 1e-9 compatibility cap. + """ + tolerance = 1e-9*gap_scale + poses = np.abs(u).reshape(-1, 6) + amplitude = np.tile((float(np.max(poses[:, :3])),)*3+ + (float(np.max(poses[:, 3:])),)*3, len(poses)) + allowance = roundoff_fraction*np.asarray(self._abs_C@amplitude).reshape(-1) + if not np.isfinite(allowance).all(): + raise _NumericalFailure("footprint compatibility allowance is not representable") + for item in self._footprint_incidence: + width = getattr(item,"row_count",6) + rows = slice(item.row_start, item.row_start+width) + cap = 1e-9*np.array((self._compatibility_length,)*3+(1.,)*(width-3)) + tolerance[rows] = np.minimum(tolerance[rows]+allowance[rows], cap) + return tolerance + + @property + def capabilities(self) -> ExperimentalB2Q4PanelCapabilities: + if self._physical_footprint_law: + return B2PhysicalRigidFootprintCapabilities( + attachment="physical rigid-region translations and director tangents; five rows per selected node", operations=(("solve_linear","solve_linear_many","close") if self._has_s3 else ("solve_linear","solve_linear_many","buckling","close")), spectral_domain=("S3/mixed physical footprint modes and buckling unsupported" if self._has_s3 else "explicit physical-footprint conservative reference buckling request; modes unavailable without mass contract"), - footprints=self.footprints) - if self._modal_only: - return ExperimentalB2Q4PanelCapabilities( - operations=("modes", "close"), - body_load_domain="unsupported by free-free modal-only policy", - spectral_domain="experimental connected free-free reference descriptor; six verified physical rigid fields and selected finite flexible pairs; completeness unqualified") - body_operations = (("body_acceleration_load",) if self._body_map is not None else ()) - body_domain = ("experimental reference-linear uniform global acceleration; typed loads give separate equilibrated section fields including interior point actions; raw vectors retain nodal constitutive recovery; loaded interior pose and finite gravity unsupported" - if self._body_map is not None else "unavailable without complete physical density/mass") - if self._point_trace_policy is not None: - return ExperimentalB2LoadedPointCapabilities( - attachment="explicit fixed-end loaded finite-vertex point trace", - operations=("solve_linear", "solve_linear_many", "close") + body_operations, - body_load_domain=("typed reference body acceleration and multiplier-dependent fixed-end bubbles; " - "raw arrays are nodal loads; finite gravity unsupported" if self._body_map is not None - else body_domain)) - if self.footprints: - admitted = (self._M is not None and self._coordinate_modal_supports() - and not np.any(self._u0 != 0.) and self._footprint_rigid_supported) - return ExperimentalB2Q4FootprintCapabilities( - attachment="explicit reference-linear selected-node rigid footprints and finite-vertex points", - operations=(("solve_linear", "solve_linear_many", "modes", "close") - if admitted else ("solve_linear", "solve_linear_many", "close")) + body_operations, - body_load_domain=body_domain, - spectral_domain=("experimental virgin supported reference modes; normal-spin locked; " - "mechanical qualification incomplete; prestress unsupported" - if admitted else - "reference modes require complete physical mass, coordinate supports detecting all six rigid fields and zero offset; " - "normal-spin locked; mechanical qualification incomplete; prestress unsupported"), - footprints=self.footprints) - if self._M is None: - return ExperimentalB2Q4PanelCapabilities( - operations=("solve_linear", "solve_linear_many", "close") + body_operations, - body_load_domain=body_domain) - return ExperimentalB2Q4PanelCapabilities( - operations=("solve_linear", "solve_linear_many", "modes", "close") + body_operations, - body_load_domain=body_domain, - spectral_domain="experimental reference B2/Q4 finite pairs with coordinate supports; completeness unqualified") - - def body_acceleration_load(self, acceleration_m_s2) -> B2ReferenceBodyLoad: - """Prepare an owned dead-load vector without assembling or factoring. - - f = integral D.T rho a uses the compiled physical trace and mass origin. - Pass ``result.load`` to the existing static or compatible batch route. - """ - if self._closed: - raise ExperimentalB2Q4PanelError("experimental panel is closed") - if self._modal_only: - raise ValueError("free-free modal-only policy does not admit body loads") - if self._body_map is None: - raise ValueError("complete physical density/mass required for reference body load") - raw = np.asarray(acceleration_m_s2, dtype=object) - if (raw.shape != (3,) or any(isinstance(v, (bool, np.bool_)) or - not isinstance(v, Real) for v in raw.flat)): - raise ValueError("three finite real global acceleration components required") - try: - acceleration = np.array(raw, dtype=float, copy=True) - except (ValueError, TypeError, OverflowError) as exc: - raise ValueError("three finite real global acceleration components required") from exc - if not np.isfinite(acceleration).all(): - raise ValueError("three finite real global acceleration components required") - with np.errstate(over="ignore", invalid="ignore", under="ignore"): - applied = self._body_map@acceleration - if not np.isfinite(applied).all(): - raise RepresentabilityError("reference body acceleration load is not representable") - # A finite vector can still lose a required force through underflow or - # cancellation. Test rigid-translation work against integrated physical - # mass without adding an absolute load floor or changing solver criteria. - for axis, component in enumerate(acceleration): - if component == 0.: - continue - expected = self._body_mass*float(component) - try: - actual = fsum(float(v) for v in applied[axis::6]) - except OverflowError as exc: - raise RepresentabilityError("reference body force is not representable") from exc - if (not isfinite(expected) or expected == 0. or not isfinite(actual) - or abs(actual/expected-1.) > 1e-9): - raise RepresentabilityError("required reference body force is not representable") - return B2ReferenceBodyLoad(tuple(float(v) for v in acceleration), - self.shell_node_ids, self.beam_node_ids, applied, - self._body_model_identity) - - def _body_load_snapshot(self, load): - if isinstance(load, B2ReferenceBodyLoad): - if (load.model_identity != self._body_model_identity or - load.shell_node_ids != self.shell_node_ids or load.beam_node_ids != self.beam_node_ids): - raise ValueError("body load belongs to a different compiled model") - expected = self.body_acceleration_load(load.acceleration_m_s2) - if not np.array_equal(load.load, expected.load): - raise ValueError("body load values disagree with its physical acceleration") - snapshot, fingerprint = _load_value_snapshot(load.load, self._u0.shape) - metadata = sha256(fingerprint) - metadata.update(load.model_identity.encode("utf-8")) - metadata.update(repr((load.shell_node_ids, load.beam_node_ids)).encode("utf-8")) - metadata.update(np.asarray(load.acceleration_m_s2, dtype=" bool: - selector = self._T.copy() - selector.eliminate_zeros() - return not (np.any(np.diff(selector.tocsc().indptr) != 1) or - np.any(np.diff(selector.indptr) > 1)) - - def _reference_modes_result(self, status, frequencies=(), physical=(), - multipliers=(), equations=(), constraints=(), - factorization_count=0, solve_count=0, - failure_reason=None): - args = (status, frequencies, physical, multipliers, equations, constraints, - factorization_count, solve_count, failure_reason) - if not self.footprints: - return B2ReferenceModesResult(*args) - components = ("ux", "uy", "uz", "rx", "ry", "rz") - provenance = [B2ModalConstraintRow( - 6*i+j, component, point_id=point_id, - coordinate_frame=("point_master_shell_reference" if j < 3 - else "point_beam_reference"), - reference_frame_columns=self._point_reference_frames[i][0 if j < 3 else 1]) - for i, point_id in enumerate(self.point_ids) - for j, component in enumerate(components)] - for item in self._footprint_incidence: - provenance.extend(B2ModalConstraintRow( - item.row_start+j, component, footprint_id=item.footprint_id, - shell_node_id=item.shell_node, beam_node_id=item.beam_node) - for j, component in enumerate(components)) - point_modes = (tuple(mode[:6*len(self.point_ids)] for mode in multipliers) - if self.point_ids else ()) - return B2FootprintReferenceModesResult( - status, frequencies, physical, point_modes, equations, constraints, - factorization_count, solve_count, failure_reason, - footprint_ids=self.footprint_ids, - constraint_multiplier_modes=multipliers, constraint_rows=tuple(provenance)) - - @property - def physical_footprint_buckling_capabilities(self): - from ._stiffened_shell_b2_reference_buckling import physical_footprint_capabilities - return physical_footprint_capabilities(self) - - @property - def reference_buckling_capabilities(self): - from ._stiffened_shell_b2_reference_buckling import capabilities - return capabilities(self) - - def buckling(self, request, *, cancellation=None): - """Explicit experimental reference-preload conservative spectral route.""" - from ._stiffened_shell_b2_reference_buckling import solve - return solve(self, request, cancellation=cancellation) - - def modes(self, request: B2ReferenceModesRequest, *, - cancellation: CancellationToken | None = None - ) -> B2ReferenceModesResult | B2FreeReferenceModesResult: - """Sparse descriptor modes with physical inertia and massless multipliers. - - Reuse compiled K/C/T and mass, never a global nullspace or dense inverse. - A shifted general inverse-product is not Euclidean symmetric, so use - eigs rather than eigsh. Explicit free-free owners project verified rigid - fields in the physical mass metric; loaded/prestressed modes remain out. - """ - if self._physical_footprint_law: - raise ValueError("physical footprint reference modes require a separately adopted mass contract") - if self._closed: - raise ExperimentalB2Q4PanelError("experimental panel is closed") - if self._point_trace_policy is not None: - raise ValueError("loaded point trace reference modes unsupported: shape inertia unverified") - if self._has_s3 and self._reference_inertia_policy is None: - raise ValueError("native S3 V2D physical mass and reference modes are deferred") - if type(request) is not B2ReferenceModesRequest: - raise ValueError("typed reference-mode request required") - if self._M is None: - raise ValueError("explicit shell density and beam physical mass required") - if not self._coordinate_modal_supports(): - raise ValueError("reference modes currently require coordinate supports without MPCs") - if self.footprints and np.any(self._u0 != 0.): - raise ValueError("virgin nodal-footprint reference modes require zero prescribed offset") - if self.footprints and not self._footprint_rigid_supported: - raise ValueError("nodal-footprint reference modes require coordinate supports detecting all six physical rigid fields; free-free and under-supported modes unsupported") - if cancellation is not None and not isinstance(cancellation, CancellationToken): - raise ValueError("CancellationToken required") - n = self._T.shape[1] - rows = self._C.shape[0] - if request.count >= min(n-rows-(6 if self._modal_only else 0), n+rows-1): - raise ValueError("reference mode count exceeds supported sparse spectrum") - with np.errstate(over="ignore", under="ignore", invalid="ignore"): - sigma = -float(np.square(2.*np.pi*np.float64(request.shift_hz))) - if not np.isfinite(sigma) or sigma == 0.: - raise ValueError("reference mode shift is not representable") - - def safe_point(stage): - if cancellation is not None: - cancellation.checkpoint(stage) - - handle = None - rigid = None - overlap = 0. - - def finish(*args, **kwargs): - flexible = self._reference_modes_result(*args, **kwargs) - if not self._modal_only: - return flexible - data = {} - if flexible.status == "ok": - data = dict(rigid_origin_m=rigid["origin"], - canonical_rigid_modes=tuple(tuple(map(float, x)) for x in rigid["canonical"].T), - rigid_modes=tuple(tuple(map(float, x)) for x in rigid["normalized"].T), - rigid_multiplier_modes=tuple((0.,)*rows for _ in range(6)), - rigid_kinetic_gram=tuple(tuple(map(float, x)) for x in rigid["gram"]), - rigid_equation_residuals=rigid["equations"], - rigid_constraint_residuals=rigid["gaps"], - rigid_flexible_mass_overlap=overlap) - return B2FreeReferenceModesResult(flexible.status, flexible, - spectral_shift_rad2_s2=sigma, failure_reason=flexible.failure_reason, **data) - - try: - safe_point("reference modes before factorization") - k = (self._T.T@self._K@self._T).tocsc() - m = (self._T.T@self._M@self._T).tocsc() - c = (self._C@self._T).tocsc() - a = sparse.bmat(((k, c.T), (c, None)), format="csc") - b = sparse.block_diag((m, sparse.csc_matrix((rows, rows))), format="csc") - try: - shifted, scale = _scaled_point_kkt(k-sigma*m, c) - except ExperimentalB2Q4PanelError as exc: - raise _NumericalFailure("reference modal scaling failed: "+str(exc)) from exc - scaling = sparse.diags(scale, format="csc") - bs = (scaling@b@scaling).tocsc() - b.eliminate_zeros(); b.sort_indices() - bs.eliminate_zeros(); bs.sort_indices() - if (not np.isfinite(bs.data).all() or b.nnz != bs.nnz or - not np.array_equal(b.indptr, bs.indptr) or - not np.array_equal(b.indices, bs.indices) or - np.any((b.data != 0.) & (bs.data == 0.))): - raise _NumericalFailure("reference modal mass scaling is not representable") - if self._modal_only: - rigid = _free_b2_rigid_space(self, scale, bs, safe_point) - - def project(vector): - if not self._modal_only: - return vector - return vector-rigid["scaled"]@(rigid["scaled"].T@(bs@vector)) - - handle = factorize_cached(shifted, MatrixClass.GENERAL) - safe_point("reference modes after factorization") - if handle.status != "ok": - raise _NumericalFailure("reference modal factorization failed: "+str(handle.failure_reason)) - - def action(vector): - safe_point("reference modal iteration") - try: - answer = np.asarray(handle.solve(bs@project(vector)), dtype=float) - except RuntimeError as exc: - # These are explicit numerical failures of the shared - # backend. Unclassified/programming errors still propagate. - if (str(exc) == "Sparse solve produced NaN/Inf values" or - str(exc).startswith("Cannot solve with failed factorization:")): - raise _NumericalFailure("reference modal sparse solve failed: "+str(exc)) from exc - raise - if not np.isfinite(answer).all(): - raise _NumericalFailure("finite reference modal inverse action required") - safe_point("reference modal iteration completed") - return project(answer) - - operator = LinearOperator(a.shape, matvec=action, dtype=float) - values, vectors = eigs(operator, k=request.count, which="LM", - v0=np.sin(np.arange(a.shape[0])+.23), - tol=1e-11, maxiter=request.max_iterations) - safe_point("reference modes after eigensolve") - abs_a, abs_b, abs_c = abs(a), abs(b), abs(c) - recovered = [] - for mu, y in zip(values, vectors.T): - if (not np.isfinite(mu) or abs(mu.imag) > 1e-9*abs(mu.real) or - mu.real <= 0. or not np.isfinite(y).all() or - np.linalg.norm(y.imag) > 1e-9*np.linalg.norm(y.real)): - raise _NumericalFailure("nonphysical or unresolved finite modal pair") - lam = sigma+1./mu.real - if self._modal_only: - # Resolution screen, not a certified eigenvalue error bound. - screen = 64*np.finfo(float).eps*a.shape[0]*(abs(sigma)+abs(1./mu.real)) - if not np.isfinite(screen) or lam <= screen: - raise _NumericalFailure("extra mechanism or unresolved near-zero flexible pair") - x = scale*y.real - mass_norm = float(x@b@x) - if not np.isfinite(lam) or lam <= 0. or not np.isfinite(mass_norm) or mass_norm <= 0.: - raise _NumericalFailure("positive finite supported mode and physical inertia required") - x /= np.sqrt(mass_norm) - physical = np.asarray(self._T@x[:n]) - if not np.isfinite(x).all() or not np.isfinite(physical).all(): - raise _NumericalFailure("physical mode normalization is not representable") - residual = a@x-lam*(b@x) - bound = abs_a@abs(x)+abs(lam)*(abs_b@abs(x)) - equation = _modal_scaled_residual(residual, bound, scale) - constraint = _modal_scaled_residual(c@x[:n], abs_c@abs(x[:n]), scale[n:]) - physical_gap = _modal_scaled_residual( - self._C@physical, abs(self._C)@abs(physical), scale[n:]) - physical_balance = self._K@physical+self._C.T@x[n:]-lam*(self._M@physical) - physical_bound = (abs(self._K)@abs(physical)+abs(self._C.T)@abs(x[n:])+ - abs(lam)*(abs(self._M)@abs(physical))) - physical_equation = _modal_scaled_residual( - self._project(physical_balance), abs(self._T.T)@physical_bound, scale[:n]) - equation = max(equation, physical_equation) - constraint = max(constraint, physical_gap) - if equation > 1e-8 or constraint > 1e-9: - raise _NumericalFailure("reference modal equation or constraint residual failed") - recovered.append((float(np.sqrt(lam)/(2.*np.pi)), - tuple(physical), tuple(x[n:]), - equation, constraint)) - recovered.sort(key=lambda mode: mode[0]) - primal = np.array([mode[1] for mode in recovered]).T - modal_gram = primal.T@self._M@primal - if (not np.isfinite(modal_gram).all() or - np.max(abs(modal_gram-np.eye(request.count))) > 1e-7): - raise _NumericalFailure("modal physical-mass orthogonality failed") - if self._modal_only: - overlap = float(np.max(abs(rigid["normalized"].T@self._M@primal))) - if not np.isfinite(overlap) or overlap > 1e-7: - raise _NumericalFailure("rigid/flexible physical-mass overlap failed") - safe_point("reference modes before publication") - return finish( - "ok", tuple(mode[0] for mode in recovered), - tuple(mode[1] for mode in recovered), tuple(mode[2] for mode in recovered), - tuple(mode[3] for mode in recovered), tuple(mode[4] for mode in recovered), - handle.factorization_count, handle.solve_count) - except SolveCancelled as exc: - return finish( - "cancelled", factorization_count=handle.factorization_count if handle else 0, - solve_count=handle.solve_count if handle else 0, failure_reason=str(exc)) - except (ArpackError, _NumericalFailure) as exc: - return finish( - "failed", factorization_count=handle.factorization_count if handle else 0, - solve_count=handle.solve_count if handle else 0, failure_reason=str(exc)) - finally: - # Do not retain a numerical factor through an exception traceback. - handle = None - - def _panel_result(self, *args, **kwargs): - if self._physical_footprint_law: - return B2PhysicalRigidFootprintResult(*args,footprint_ids=self.footprint_ids,**kwargs) - if self._point_trace_policy is not None: - return B2LoadedPointPanelResult(*args, **kwargs) - if "body_model_identity" in kwargs: - result_type = B2BodyLoadedFootprintResult if self.footprints else B2BodyLoadedPanelResult - if self.footprints: - kwargs["footprint_ids"] = self.footprint_ids - return result_type(*args, **kwargs) - if self.footprints: - return ExperimentalB2Q4FootprintResult( - *args, footprint_ids=self.footprint_ids, **kwargs) - return ExperimentalB2Q4PanelResult(*args, **kwargs) - - def solve_linear(self, load, *, recover_members=None, - selected_footprints: B2NodalRigidFootprintSelection | B2PhysicalRigidFootprintSelection | None = None - ) -> ExperimentalB2Q4PanelResult: - if self._closed: - raise ExperimentalB2Q4PanelError("experimental panel is closed") - if self._modal_only: - raise ValueError("free-free modal-only policy does not admit static solves") - selector = checked_physical_selection if self._physical_footprint_law else checked_selection - chosen_footprints = selector(selected_footprints, self.footprints) - if self._physical_footprint_law and isinstance(load,B2ReferenceBodyLoad): - raise ValueError("physical footprint body-load driver not admitted") - recovery = _checked_recovery( - recover_members, {member_id for member_id, _ in self._members}) - try: - applied, _ = self._body_load_snapshot(load) - except (TypeError, ValueError, OverflowError) as exc: - if isinstance(load, B2ReferenceBodyLoad): - raise - raise ValueError("finite panel load vector required") from exc - if applied.shape != self._u0.shape or not np.isfinite(applied).all(): - raise ValueError("finite panel load vector required") - acceleration = load.acceleration_m_s2 if isinstance(load, B2ReferenceBodyLoad) else None - body_gap = body_gap_scale = None - try: - rhs = np.r_[self._project(applied-self._ku0), -self._cu0] - if self._point_trace_policy is not None: - body_gap = np.zeros(len(self._cu0)) - body_gap_scale = np.zeros(len(self._cu0)) - for compiled_load in self._loaded_members.values(): - values, scales = compiled_load.body_constraint(acceleration) - slots = [6*index+channel for index in compiled_load.point_indices for channel in range(6)] - body_gap[slots] = values - body_gap_scale[slots] = scales - rhs[-len(self._cu0):] -= body_gap - except (_NumericalFailure, RepresentabilityError) as exc: - return self._panel_result( - "failed", factorization_count=self._handle.factorization_count, - solve_count=self._handle.solve_count, failure_reason=str(exc)) - with np.errstate(over="ignore", under="ignore", invalid="ignore"): - scaled_rhs = self._factor_scale*rhs - if (not np.isfinite(scaled_rhs).all() or - np.any((rhs != 0.) & (scaled_rhs == 0.))): - return self._panel_result( - "failed", factorization_count=self._handle.factorization_count, - solve_count=self._handle.solve_count, - failure_reason="panel right-hand side scaling is not representable") - try: - scaled_answer = np.asarray(self._handle.solve(scaled_rhs), dtype=float) - answer = self._factor_scale*scaled_answer - if self._physical_footprint_law and answer.shape == rhs.shape and np.isfinite(answer).all(): - answer = self._correct_physical_equilibrium( - scaled_answer, scaled_rhs, applied) - if self._physical_work_ratio(answer, applied) > 1.: - raise _NumericalFailure("panel physical footprint work consistency failed") - except (RuntimeError, _NumericalFailure) as exc: - return self._panel_result( - "failed", factorization_count=self._handle.factorization_count, - solve_count=self._handle.solve_count, failure_reason=str(exc)) - try: - if answer.shape != rhs.shape or not np.isfinite(answer).all(): - raise _NumericalFailure("finite panel solution required") - q, lam = answer[:-len(self._cu0)], answer[-len(self._cu0):] - u = np.asarray(self._T @ q).reshape(-1)+self._u0 - if not np.isfinite(u).all(): - raise _NumericalFailure("finite panel solution required") - gap = np.asarray(self._C @ u).reshape(-1) - compliance_gap_scale = None - if self._point_trace_policy is not None: - compliance_gap, compliance_gap_scale = checked_sparse_action(self._H, lam) - gap = gap+body_gap-compliance_gap - force = np.asarray(self._K @ u).reshape(-1) - constraint_force = np.asarray(self._C.T @ lam).reshape(-1) - reaction = force+constraint_force-applied - projected = self._project(reaction) - # Each row uses the absolute contribution sum in its own physical - # work unit. A 1 N floor would mask a failed micro-/nano-load; - # a single mixed force/moment norm would depend on chosen units. - gap_scale = np.asarray(self._abs_C @ np.abs(u)).reshape(-1) - if self._point_trace_policy is not None: - gap_scale += body_gap_scale+compliance_gap_scale - physical_force_scale = np.asarray( - self._abs_K @ np.abs(u)+self._abs_Ct @ np.abs(lam)+ - np.abs(applied)).reshape(-1) - equilibrium_scale = np.asarray( - self._abs_Tt @ physical_force_scale).reshape(-1) - # Sparse factorization can leave roundoff in a locally quiet DOF. - # Its allowance follows the current force and moment magnitudes, - # separately, then maps through the affine transpose; it has no - # fixed N, Nm, m or rad floor. - by_node = physical_force_scale.reshape(-1, 6) - force_roundoff = float(np.max(by_node[:, :3])) - moment_roundoff = float(np.max(by_node[:, 3:])) - physical_roundoff = np.tile( - (force_roundoff,)*3+(moment_roundoff,)*3, - len(by_node)) - projected_roundoff = np.asarray( - self._abs_Tt @ physical_roundoff).reshape(-1) - roundoff_fraction = len(rhs)*np.finfo(float).eps - if roundoff_fraction >= 1e-9: - raise _NumericalFailure("panel equilibrium resolution insufficient") - explicit_rhs = np.abs(self._project(applied)) - resolution_floor = roundoff_fraction*projected_roundoff - # Prescribed offsets can induce reduced loads much smaller than - # the model-wide reaction scale. Their physical effect is checked - # by the full equilibrium/compatibility test below. This extra - # small-load resolution guard applies to explicit applied work, - # so a superposed tiny external load cannot disappear silently. - active = explicit_rhs > 0. - certified = False - if np.any(resolution_floor[active] > - 1e-9*explicit_rhs[active]): - certified = (bool(self.footprints) or self._point_trace_policy is not None) and self._explicit_load_resolved( + footprints=self.footprints) + if self._modal_only: + return ExperimentalB2Q4PanelCapabilities( + operations=("modes", "close"), + body_load_domain="unsupported by free-free modal-only policy", + spectral_domain="experimental connected free-free reference descriptor; six verified physical rigid fields and selected finite flexible pairs; completeness unqualified") + body_operations = (("body_acceleration_load",) if self._body_map is not None else ()) + body_domain = ("experimental reference-linear uniform global acceleration; typed loads give separate equilibrated section fields including interior point actions; raw vectors retain nodal constitutive recovery; loaded interior pose and finite gravity unsupported" + if self._body_map is not None else "unavailable without complete physical density/mass") + if self._point_trace_policy is not None: + return ExperimentalB2LoadedPointCapabilities( + attachment="explicit fixed-end loaded finite-vertex point trace", + operations=("solve_linear", "solve_linear_many", "close") + body_operations, + body_load_domain=("typed reference body acceleration and multiplier-dependent fixed-end bubbles; " + "raw arrays are nodal loads; finite gravity unsupported" if self._body_map is not None + else body_domain)) + if self.footprints: + admitted = (self._M is not None and self._coordinate_modal_supports() + and not np.any(self._u0 != 0.) and self._footprint_rigid_supported) + return ExperimentalB2Q4FootprintCapabilities( + attachment="explicit reference-linear selected-node rigid footprints and finite-vertex points", + operations=(("solve_linear", "solve_linear_many", "modes", "close") + if admitted else ("solve_linear", "solve_linear_many", "close")) + body_operations, + body_load_domain=body_domain, + spectral_domain=("experimental virgin supported reference modes; normal-spin locked; " + "mechanical qualification incomplete; prestress unsupported" + if admitted else + "reference modes require complete physical mass, coordinate supports detecting all six rigid fields and zero offset; " + "normal-spin locked; mechanical qualification incomplete; prestress unsupported"), + footprints=self.footprints) + if self._M is None: + return ExperimentalB2Q4PanelCapabilities( + operations=("solve_linear", "solve_linear_many", "close") + body_operations, + body_load_domain=body_domain) + return ExperimentalB2Q4PanelCapabilities( + operations=("solve_linear", "solve_linear_many", "modes", "close") + body_operations, + body_load_domain=body_domain, + spectral_domain="experimental reference B2/Q4 finite pairs with coordinate supports; completeness unqualified") + + def body_acceleration_load(self, acceleration_m_s2) -> B2ReferenceBodyLoad: + """Prepare an owned dead-load vector without assembling or factoring. + + f = integral D.T rho a uses the compiled physical trace and mass origin. + Pass ``result.load`` to the existing static or compatible batch route. + """ + if self._closed: + raise ExperimentalB2Q4PanelError("experimental panel is closed") + if self._modal_only: + raise ValueError("free-free modal-only policy does not admit body loads") + if self._body_map is None: + raise ValueError("complete physical density/mass required for reference body load") + raw = np.asarray(acceleration_m_s2, dtype=object) + if (raw.shape != (3,) or any(isinstance(v, (bool, np.bool_)) or + not isinstance(v, Real) for v in raw.flat)): + raise ValueError("three finite real global acceleration components required") + try: + acceleration = np.array(raw, dtype=float, copy=True) + except (ValueError, TypeError, OverflowError) as exc: + raise ValueError("three finite real global acceleration components required") from exc + if not np.isfinite(acceleration).all(): + raise ValueError("three finite real global acceleration components required") + with np.errstate(over="ignore", invalid="ignore", under="ignore"): + applied = self._body_map@acceleration + if not np.isfinite(applied).all(): + raise RepresentabilityError("reference body acceleration load is not representable") + # A finite vector can still lose a required force through underflow or + # cancellation. Test rigid-translation work against integrated physical + # mass without adding an absolute load floor or changing solver criteria. + for axis, component in enumerate(acceleration): + if component == 0.: + continue + expected = self._body_mass*float(component) + try: + actual = fsum(float(v) for v in applied[axis::6]) + except OverflowError as exc: + raise RepresentabilityError("reference body force is not representable") from exc + if (not isfinite(expected) or expected == 0. or not isfinite(actual) + or abs(actual/expected-1.) > 1e-9): + raise RepresentabilityError("required reference body force is not representable") + return B2ReferenceBodyLoad(tuple(float(v) for v in acceleration), + self.shell_node_ids, self.beam_node_ids, applied, + self._body_model_identity) + + def _body_load_snapshot(self, load): + if isinstance(load, B2ReferenceBodyLoad): + if (load.model_identity != self._body_model_identity or + load.shell_node_ids != self.shell_node_ids or load.beam_node_ids != self.beam_node_ids): + raise ValueError("body load belongs to a different compiled model") + expected = self.body_acceleration_load(load.acceleration_m_s2) + if not np.array_equal(load.load, expected.load): + raise ValueError("body load values disagree with its physical acceleration") + snapshot, fingerprint = _load_value_snapshot(load.load, self._u0.shape) + metadata = sha256(fingerprint) + metadata.update(load.model_identity.encode("utf-8")) + metadata.update(repr((load.shell_node_ids, load.beam_node_ids)).encode("utf-8")) + metadata.update(np.asarray(load.acceleration_m_s2, dtype=" bool: + selector = self._T.copy() + selector.eliminate_zeros() + return not (np.any(np.diff(selector.tocsc().indptr) != 1) or + np.any(np.diff(selector.indptr) > 1)) + + def _reference_modes_result(self, status, frequencies=(), physical=(), + multipliers=(), equations=(), constraints=(), + factorization_count=0, solve_count=0, + failure_reason=None): + args = (status, frequencies, physical, multipliers, equations, constraints, + factorization_count, solve_count, failure_reason) + if not self.footprints: + return B2ReferenceModesResult(*args) + components = ("ux", "uy", "uz", "rx", "ry", "rz") + provenance = [B2ModalConstraintRow( + 6*i+j, component, point_id=point_id, + coordinate_frame=("point_master_shell_reference" if j < 3 + else "point_beam_reference"), + reference_frame_columns=self._point_reference_frames[i][0 if j < 3 else 1]) + for i, point_id in enumerate(self.point_ids) + for j, component in enumerate(components)] + for item in self._footprint_incidence: + provenance.extend(B2ModalConstraintRow( + item.row_start+j, component, footprint_id=item.footprint_id, + shell_node_id=item.shell_node, beam_node_id=item.beam_node) + for j, component in enumerate(components)) + point_modes = (tuple(mode[:6*len(self.point_ids)] for mode in multipliers) + if self.point_ids else ()) + return B2FootprintReferenceModesResult( + status, frequencies, physical, point_modes, equations, constraints, + factorization_count, solve_count, failure_reason, + footprint_ids=self.footprint_ids, + constraint_multiplier_modes=multipliers, constraint_rows=tuple(provenance)) + + @property + def physical_footprint_buckling_capabilities(self): + from ._stiffened_shell_b2_reference_buckling import physical_footprint_capabilities + return physical_footprint_capabilities(self) + + @property + def reference_buckling_capabilities(self): + from ._stiffened_shell_b2_reference_buckling import capabilities + return capabilities(self) + + def buckling(self, request, *, cancellation=None): + """Explicit experimental reference-preload conservative spectral route.""" + from ._stiffened_shell_b2_reference_buckling import solve + return solve(self, request, cancellation=cancellation) + + def modes(self, request: B2ReferenceModesRequest, *, + cancellation: CancellationToken | None = None + ) -> B2ReferenceModesResult | B2FreeReferenceModesResult: + """Sparse descriptor modes with physical inertia and massless multipliers. + + Reuse compiled K/C/T and mass, never a global nullspace or dense inverse. + A shifted general inverse-product is not Euclidean symmetric, so use + eigs rather than eigsh. Explicit free-free owners project verified rigid + fields in the physical mass metric; loaded/prestressed modes remain out. + """ + if self._physical_footprint_law: + raise ValueError("physical footprint reference modes require a separately adopted mass contract") + if self._closed: + raise ExperimentalB2Q4PanelError("experimental panel is closed") + if self._point_trace_policy is not None: + raise ValueError("loaded point trace reference modes unsupported: shape inertia unverified") + if self._has_s3 and self._reference_inertia_policy is None: + raise ValueError("native S3 V2D physical mass and reference modes are deferred") + if type(request) is not B2ReferenceModesRequest: + raise ValueError("typed reference-mode request required") + if self._M is None: + raise ValueError("explicit shell density and beam physical mass required") + if not self._coordinate_modal_supports(): + raise ValueError("reference modes currently require coordinate supports without MPCs") + if self.footprints and np.any(self._u0 != 0.): + raise ValueError("virgin nodal-footprint reference modes require zero prescribed offset") + if self.footprints and not self._footprint_rigid_supported: + raise ValueError("nodal-footprint reference modes require coordinate supports detecting all six physical rigid fields; free-free and under-supported modes unsupported") + if cancellation is not None and not isinstance(cancellation, CancellationToken): + raise ValueError("CancellationToken required") + n = self._T.shape[1] + rows = self._C.shape[0] + if request.count >= min(n-rows-(6 if self._modal_only else 0), n+rows-1): + raise ValueError("reference mode count exceeds supported sparse spectrum") + with np.errstate(over="ignore", under="ignore", invalid="ignore"): + sigma = -float(np.square(2.*np.pi*np.float64(request.shift_hz))) + if not np.isfinite(sigma) or sigma == 0.: + raise ValueError("reference mode shift is not representable") + + def safe_point(stage): + if cancellation is not None: + cancellation.checkpoint(stage) + + handle = None + rigid = None + overlap = 0. + + def finish(*args, **kwargs): + flexible = self._reference_modes_result(*args, **kwargs) + if not self._modal_only: + return flexible + data = {} + if flexible.status == "ok": + data = dict(rigid_origin_m=rigid["origin"], + canonical_rigid_modes=tuple(tuple(map(float, x)) for x in rigid["canonical"].T), + rigid_modes=tuple(tuple(map(float, x)) for x in rigid["normalized"].T), + rigid_multiplier_modes=tuple((0.,)*rows for _ in range(6)), + rigid_kinetic_gram=tuple(tuple(map(float, x)) for x in rigid["gram"]), + rigid_equation_residuals=rigid["equations"], + rigid_constraint_residuals=rigid["gaps"], + rigid_flexible_mass_overlap=overlap) + return B2FreeReferenceModesResult(flexible.status, flexible, + spectral_shift_rad2_s2=sigma, failure_reason=flexible.failure_reason, **data) + + try: + safe_point("reference modes before factorization") + k = (self._T.T@self._K@self._T).tocsc() + m = (self._T.T@self._M@self._T).tocsc() + c = (self._C@self._T).tocsc() + a = sparse.bmat(((k, c.T), (c, None)), format="csc") + b = sparse.block_diag((m, sparse.csc_matrix((rows, rows))), format="csc") + try: + shifted, scale = _scaled_point_kkt(k-sigma*m, c) + except ExperimentalB2Q4PanelError as exc: + raise _NumericalFailure("reference modal scaling failed: "+str(exc)) from exc + scaling = sparse.diags(scale, format="csc") + bs = (scaling@b@scaling).tocsc() + b.eliminate_zeros(); b.sort_indices() + bs.eliminate_zeros(); bs.sort_indices() + if (not np.isfinite(bs.data).all() or b.nnz != bs.nnz or + not np.array_equal(b.indptr, bs.indptr) or + not np.array_equal(b.indices, bs.indices) or + np.any((b.data != 0.) & (bs.data == 0.))): + raise _NumericalFailure("reference modal mass scaling is not representable") + if self._modal_only: + rigid = _free_b2_rigid_space(self, scale, bs, safe_point) + + def project(vector): + if not self._modal_only: + return vector + return vector-rigid["scaled"]@(rigid["scaled"].T@(bs@vector)) + + handle = factorize_cached(shifted, MatrixClass.GENERAL) + safe_point("reference modes after factorization") + if handle.status != "ok": + raise _NumericalFailure("reference modal factorization failed: "+str(handle.failure_reason)) + + def action(vector): + safe_point("reference modal iteration") + try: + answer = np.asarray(handle.solve(bs@project(vector)), dtype=float) + except RuntimeError as exc: + # These are explicit numerical failures of the shared + # backend. Unclassified/programming errors still propagate. + if (str(exc) == "Sparse solve produced NaN/Inf values" or + str(exc).startswith("Cannot solve with failed factorization:")): + raise _NumericalFailure("reference modal sparse solve failed: "+str(exc)) from exc + raise + if not np.isfinite(answer).all(): + raise _NumericalFailure("finite reference modal inverse action required") + safe_point("reference modal iteration completed") + return project(answer) + + operator = LinearOperator(a.shape, matvec=action, dtype=float) + values, vectors = eigs(operator, k=request.count, which="LM", + v0=np.sin(np.arange(a.shape[0])+.23), + tol=1e-11, maxiter=request.max_iterations) + safe_point("reference modes after eigensolve") + abs_a, abs_b, abs_c = abs(a), abs(b), abs(c) + recovered = [] + for mu, y in zip(values, vectors.T): + if (not np.isfinite(mu) or abs(mu.imag) > 1e-9*abs(mu.real) or + mu.real <= 0. or not np.isfinite(y).all() or + np.linalg.norm(y.imag) > 1e-9*np.linalg.norm(y.real)): + raise _NumericalFailure("nonphysical or unresolved finite modal pair") + lam = sigma+1./mu.real + if self._modal_only: + # Resolution screen, not a certified eigenvalue error bound. + screen = 64*np.finfo(float).eps*a.shape[0]*(abs(sigma)+abs(1./mu.real)) + if not np.isfinite(screen) or lam <= screen: + raise _NumericalFailure("extra mechanism or unresolved near-zero flexible pair") + x = scale*y.real + mass_norm = float(x@b@x) + if not np.isfinite(lam) or lam <= 0. or not np.isfinite(mass_norm) or mass_norm <= 0.: + raise _NumericalFailure("positive finite supported mode and physical inertia required") + x /= np.sqrt(mass_norm) + physical = np.asarray(self._T@x[:n]) + if not np.isfinite(x).all() or not np.isfinite(physical).all(): + raise _NumericalFailure("physical mode normalization is not representable") + residual = a@x-lam*(b@x) + bound = abs_a@abs(x)+abs(lam)*(abs_b@abs(x)) + equation = _modal_scaled_residual(residual, bound, scale) + constraint = _modal_scaled_residual(c@x[:n], abs_c@abs(x[:n]), scale[n:]) + physical_gap = _modal_scaled_residual( + self._C@physical, abs(self._C)@abs(physical), scale[n:]) + physical_balance = self._K@physical+self._C.T@x[n:]-lam*(self._M@physical) + physical_bound = (abs(self._K)@abs(physical)+abs(self._C.T)@abs(x[n:])+ + abs(lam)*(abs(self._M)@abs(physical))) + physical_equation = _modal_scaled_residual( + self._project(physical_balance), abs(self._T.T)@physical_bound, scale[:n]) + equation = max(equation, physical_equation) + constraint = max(constraint, physical_gap) + if equation > 1e-8 or constraint > 1e-9: + raise _NumericalFailure("reference modal equation or constraint residual failed") + recovered.append((float(np.sqrt(lam)/(2.*np.pi)), + tuple(physical), tuple(x[n:]), + equation, constraint)) + recovered.sort(key=lambda mode: mode[0]) + primal = np.array([mode[1] for mode in recovered]).T + modal_gram = primal.T@self._M@primal + if (not np.isfinite(modal_gram).all() or + np.max(abs(modal_gram-np.eye(request.count))) > 1e-7): + raise _NumericalFailure("modal physical-mass orthogonality failed") + if self._modal_only: + overlap = float(np.max(abs(rigid["normalized"].T@self._M@primal))) + if not np.isfinite(overlap) or overlap > 1e-7: + raise _NumericalFailure("rigid/flexible physical-mass overlap failed") + safe_point("reference modes before publication") + return finish( + "ok", tuple(mode[0] for mode in recovered), + tuple(mode[1] for mode in recovered), tuple(mode[2] for mode in recovered), + tuple(mode[3] for mode in recovered), tuple(mode[4] for mode in recovered), + handle.factorization_count, handle.solve_count) + except SolveCancelled as exc: + return finish( + "cancelled", factorization_count=handle.factorization_count if handle else 0, + solve_count=handle.solve_count if handle else 0, failure_reason=str(exc)) + except (ArpackError, _NumericalFailure) as exc: + return finish( + "failed", factorization_count=handle.factorization_count if handle else 0, + solve_count=handle.solve_count if handle else 0, failure_reason=str(exc)) + finally: + # Do not retain a numerical factor through an exception traceback. + handle = None + + def _panel_result(self, *args, **kwargs): + if self._physical_footprint_law: + return B2PhysicalRigidFootprintResult(*args,footprint_ids=self.footprint_ids,**kwargs) + if self._point_trace_policy is not None: + return B2LoadedPointPanelResult(*args, **kwargs) + if "body_model_identity" in kwargs: + result_type = B2BodyLoadedFootprintResult if self.footprints else B2BodyLoadedPanelResult + if self.footprints: + kwargs["footprint_ids"] = self.footprint_ids + return result_type(*args, **kwargs) + if self.footprints: + return ExperimentalB2Q4FootprintResult( + *args, footprint_ids=self.footprint_ids, **kwargs) + return ExperimentalB2Q4PanelResult(*args, **kwargs) + + def solve_linear(self, load, *, recover_members=None, + selected_footprints: B2NodalRigidFootprintSelection | B2PhysicalRigidFootprintSelection | None = None + ) -> ExperimentalB2Q4PanelResult: + if self._closed: + raise ExperimentalB2Q4PanelError("experimental panel is closed") + if self._modal_only: + raise ValueError("free-free modal-only policy does not admit static solves") + selector = checked_physical_selection if self._physical_footprint_law else checked_selection + chosen_footprints = selector(selected_footprints, self.footprints) + if self._physical_footprint_law and isinstance(load,B2ReferenceBodyLoad): + raise ValueError("physical footprint body-load driver not admitted") + recovery = _checked_recovery( + recover_members, {member_id for member_id, _ in self._members}) + try: + applied, _ = self._body_load_snapshot(load) + except (TypeError, ValueError, OverflowError) as exc: + if isinstance(load, B2ReferenceBodyLoad): + raise + raise ValueError("finite panel load vector required") from exc + if applied.shape != self._u0.shape or not np.isfinite(applied).all(): + raise ValueError("finite panel load vector required") + acceleration = load.acceleration_m_s2 if isinstance(load, B2ReferenceBodyLoad) else None + body_gap = body_gap_scale = None + try: + rhs = np.r_[self._project(applied-self._ku0), -self._cu0] + if self._point_trace_policy is not None: + body_gap = np.zeros(len(self._cu0)) + body_gap_scale = np.zeros(len(self._cu0)) + for compiled_load in self._loaded_members.values(): + values, scales = compiled_load.body_constraint(acceleration) + slots = [6*index+channel for index in compiled_load.point_indices for channel in range(6)] + body_gap[slots] = values + body_gap_scale[slots] = scales + rhs[-len(self._cu0):] -= body_gap + except (_NumericalFailure, RepresentabilityError) as exc: + return self._panel_result( + "failed", factorization_count=self._handle.factorization_count, + solve_count=self._handle.solve_count, failure_reason=str(exc)) + with np.errstate(over="ignore", under="ignore", invalid="ignore"): + scaled_rhs = self._factor_scale*rhs + if (not np.isfinite(scaled_rhs).all() or + np.any((rhs != 0.) & (scaled_rhs == 0.))): + return self._panel_result( + "failed", factorization_count=self._handle.factorization_count, + solve_count=self._handle.solve_count, + failure_reason="panel right-hand side scaling is not representable") + try: + scaled_answer = np.asarray(self._handle.solve(scaled_rhs), dtype=float) + answer = self._factor_scale*scaled_answer + if self._physical_footprint_law and answer.shape == rhs.shape and np.isfinite(answer).all(): + answer = self._correct_physical_equilibrium( + scaled_answer, scaled_rhs, applied) + if self._physical_work_ratio(answer, applied) > 1.: + raise _NumericalFailure("panel physical footprint work consistency failed") + except (RuntimeError, _NumericalFailure) as exc: + return self._panel_result( + "failed", factorization_count=self._handle.factorization_count, + solve_count=self._handle.solve_count, failure_reason=str(exc)) + try: + if answer.shape != rhs.shape or not np.isfinite(answer).all(): + raise _NumericalFailure("finite panel solution required") + q, lam = answer[:-len(self._cu0)], answer[-len(self._cu0):] + u = np.asarray(self._T @ q).reshape(-1)+self._u0 + if not np.isfinite(u).all(): + raise _NumericalFailure("finite panel solution required") + gap = np.asarray(self._C @ u).reshape(-1) + compliance_gap_scale = None + if self._point_trace_policy is not None: + compliance_gap, compliance_gap_scale = checked_sparse_action(self._H, lam) + gap = gap+body_gap-compliance_gap + force = np.asarray(self._K @ u).reshape(-1) + constraint_force = np.asarray(self._C.T @ lam).reshape(-1) + reaction = force+constraint_force-applied + projected = self._project(reaction) + # Each row uses the absolute contribution sum in its own physical + # work unit. A 1 N floor would mask a failed micro-/nano-load; + # a single mixed force/moment norm would depend on chosen units. + gap_scale = np.asarray(self._abs_C @ np.abs(u)).reshape(-1) + if self._point_trace_policy is not None: + gap_scale += body_gap_scale+compliance_gap_scale + physical_force_scale = np.asarray( + self._abs_K @ np.abs(u)+self._abs_Ct @ np.abs(lam)+ + np.abs(applied)).reshape(-1) + equilibrium_scale = np.asarray( + self._abs_Tt @ physical_force_scale).reshape(-1) + # Sparse factorization can leave roundoff in a locally quiet DOF. + # Its allowance follows the current force and moment magnitudes, + # separately, then maps through the affine transpose; it has no + # fixed N, Nm, m or rad floor. + by_node = physical_force_scale.reshape(-1, 6) + force_roundoff = float(np.max(by_node[:, :3])) + moment_roundoff = float(np.max(by_node[:, 3:])) + physical_roundoff = np.tile( + (force_roundoff,)*3+(moment_roundoff,)*3, + len(by_node)) + projected_roundoff = np.asarray( + self._abs_Tt @ physical_roundoff).reshape(-1) + roundoff_fraction = len(rhs)*np.finfo(float).eps + if roundoff_fraction >= 1e-9: + raise _NumericalFailure("panel equilibrium resolution insufficient") + explicit_rhs = np.abs(self._project(applied)) + resolution_floor = roundoff_fraction*projected_roundoff + # Prescribed offsets can induce reduced loads much smaller than + # the model-wide reaction scale. Their physical effect is checked + # by the full equilibrium/compatibility test below. This extra + # small-load resolution guard applies to explicit applied work, + # so a superposed tiny external load cannot disappear silently. + active = explicit_rhs > 0. + certified = False + if np.any(resolution_floor[active] > + 1e-9*explicit_rhs[active]): + certified = (bool(self.footprints) or self._point_trace_policy is not None) and self._explicit_load_resolved( answer, rhs, explicit_rhs, applied=applied, reconstructed=u) - if not certified: - raise _NumericalFailure("panel mixed-load resolution insufficient") - equilibrium_tolerance = (1e-9*equilibrium_scale+ - roundoff_fraction*projected_roundoff) - gap_tolerance = 1e-9*gap_scale - if (self.footprints and np.any(np.abs(gap) > gap_tolerance) and + if not certified: + raise _NumericalFailure("panel mixed-load resolution insufficient") + equilibrium_tolerance = (1e-9*equilibrium_scale+ + roundoff_fraction*projected_roundoff) + gap_tolerance = 1e-9*gap_scale + if (self.footprints and np.any(np.abs(gap) > gap_tolerance) and (certified or self._explicit_load_resolved(answer, rhs, explicit_rhs, applied=applied, reconstructed=u))): - gap_tolerance = self._footprint_gap_tolerance(u, gap_scale, roundoff_fraction) - for item in self._footprint_incidence: - width=getattr(item,"row_count",6) - rows = slice(item.row_start, item.row_start+width) - cap = 1e-9*np.array((self._compatibility_length,)*3+(1.,)*(width-3)) - gap_tolerance[rows] = np.minimum(gap_tolerance[rows], cap) - if (not np.isfinite(reaction).all() or - not np.isfinite(gap).all() or not np.isfinite(projected).all() or - not np.isfinite(gap_scale).all() or - not np.isfinite(equilibrium_tolerance).all() or - not np.isfinite(gap_tolerance).all() or - np.any(np.abs(gap) > gap_tolerance) or - np.any(np.abs(projected) > equilibrium_tolerance)): - raise _NumericalFailure("panel point gap or equilibrium failed") - except (_NumericalFailure, RepresentabilityError) as exc: - return self._panel_result( - "failed", factorization_count=self._handle.factorization_count, - solve_count=self._handle.solve_count, failure_reason=str(exc)) - recovered = [] - equilibrated = [] - loaded_poses = [] - loaded_states = {} - if self._point_trace_policy is not None: - try: - loaded_states = {member_id: compiled_load.bubble_state(acceleration, lam) - for member_id, compiled_load in self._loaded_members.items()} - except RepresentabilityError as exc: - return self._panel_result("failed", factorization_count=self._handle.factorization_count, - solve_count=self._handle.solve_count, failure_reason=str(exc)) - for member_id, (member, slots) in self._members: - if recovery is not None and member_id not in recovery: - continue - local = member.local_dof_map() @ u[slots] - if not np.isfinite(local).all(): - return self._panel_result( - "failed", factorization_count=self._handle.factorization_count, - solve_count=self._handle.solve_count, - failure_reason="finite physical B2 recovery coordinates required") - result = member.operator.recover_sections( - local, stations=(0., .5, 1.) if recovery is None - else recovery[member_id]) - if (not np.isfinite(result.resultants).all() or - not np.isfinite(result.strains).all()): - return self._panel_result( - "failed", factorization_count=self._handle.factorization_count, - solve_count=self._handle.solve_count, - failure_reason="finite physical B2 recovery required") - recovered.append((member_id, tuple( - tuple(map(float, row)) for row in result.resultants))) - if isinstance(load, B2ReferenceBodyLoad) or self._point_trace_policy is not None: - try: - if self._point_trace_policy is not None: - compiled_load = self._loaded_members[member_id] - uniform, point_wrenches, _ = loaded_states[member_id] - actions = compiled_load.section_actions(point_wrenches) - poses = compiled_load.recover_pose(local, result.stations, uniform, point_wrenches) - loaded_poses.append(B2LoadedMemberPoses(member_id, tuple(map(float, result.stations)), - tuple(tuple(map(float, row)) for row in poses))) - else: - with np.errstate(over="ignore", invalid="ignore"): - uniform = (member.definition.mass.matrix_at_reference_axis()[:, :3]@ - member.definition.local_frame_rows()@np.asarray(load.acceleration_m_s2)) - actions = tuple((station, pullback@lam[6*i:6*i+6]) for i, station, pullback in - self._section_point_actions.get(member_id, ())) - if (not np.isfinite(uniform).all() or - any(not np.isfinite(wrench).all() for _, wrench in actions)): - raise RepresentabilityError("physical section actions are not representable") - fields = member.operator.recover_equilibrated_sections(local, - uniform_wrench=uniform, point_actions=actions, stations=result.stations) - except RepresentabilityError as exc: - return self._panel_result("failed", factorization_count=self._handle.factorization_count, - solve_count=self._handle.solve_count, failure_reason=str(exc)) - rows = lambda values: tuple(tuple(map(float, row)) for row in values) - equilibrated.append(B2LoadedMemberSections(member_id, tuple(map(float, fields.stations)), - rows(fields.resultants_left), rows(fields.resultants_right), - rows(fields.strains_left), rows(fields.strains_right), - tuple(map(float, fields.endpoint_tractions)))) - energy = .5*float(u @ force) - if not isfinite(energy): - return self._panel_result( - "failed", factorization_count=self._handle.factorization_count, - solve_count=self._handle.solve_count, - failure_reason="finite panel strain energy required") - extra = {} - if self._physical_footprint_law: - extra.update(constraint_multipliers=tuple(map(float,lam)),constraint_gaps=tuple(map(float,gap)), - constraint_rows=tuple((item.row_start+j,item.footprint_id,item.shell_node,item.beam_node,component) - for item in self._footprint_incidence for j,component in enumerate(("translation_x","translation_y","translation_z","director_1","director_2")))) - if isinstance(load, B2ReferenceBodyLoad): - extra.update(body_model_identity=load.model_identity, - body_acceleration_m_s2=load.acceleration_m_s2, - equilibrated_sections=tuple(equilibrated)) - if self._point_trace_policy is not None: - try: - loaded_energy = fsum((energy, *(state[2] for state in loaded_states.values()))) - except OverflowError: - loaded_energy = float("inf") - if not isfinite(loaded_energy) or loaded_energy < 0.: - return self._panel_result("failed", factorization_count=self._handle.factorization_count, - solve_count=self._handle.solve_count, failure_reason="loaded strain energy is not representable") - extra.update(equilibrated_sections=tuple(equilibrated), loaded_member_poses=tuple(loaded_poses), - loaded_strain_energy=loaded_energy) - if chosen_footprints: - try: - wrench_recovery = physical_selected_wrenches if self._physical_footprint_law else selected_wrenches - extra["footprint_wrenches"] = wrench_recovery( - self._footprint_incidence, chosen_footprints, lam, gap) - except (ValueError, OverflowError) as exc: - return self._panel_result( - "failed", factorization_count=self._handle.factorization_count, - solve_count=self._handle.solve_count, failure_reason=str(exc)) - return self._panel_result( - "completed", tuple(map(float, u)), - tuple((point_id, tuple(map(float, lam[6*i:6*i+6]))) - for i, point_id in enumerate(self.point_ids)), - tuple(map(float, reaction)), - tuple((point_id, tuple(map(float, gap[6*i:6*i+6]))) - for i, point_id in enumerate(self.point_ids)), - tuple(recovered), energy, self._handle.factorization_count, - self._handle.solve_count, **extra) - - def solve_linear_many( - self, cases: Sequence[tuple[str, object]], *, - selected_dofs: Sequence[int], - selected_points: Sequence[str] = (), - selected_footprints: B2NodalRigidFootprintSelection | B2PhysicalRigidFootprintSelection | None = None, - recover_members: Mapping[str, Sequence[float]] | None = None, - cancellation_token: CancellationToken | None = None, - on_case: Callable[[str], None] | None = None, - ) -> ExperimentalB2Q4PanelBatchResult: - """Solve ordered cases with one factorization and bounded case storage. - - Each result is complete before it joins the returned prefix. Numerical - failure, cooperative cancellation or owner closure stops further cases. - Closing from a completion callback preserves the complete prefix; a - final-case closure still returns completed. Callback and programming - errors propagate. This development route uses one RHS at a - time, avoiding full displacement/reaction batches for large panels. - Selected displacement, reaction and local member-resultant envelopes - describe only complete cases in the returned prefix, with the first - submitted case governing ties. - """ - if self._closed: - raise ExperimentalB2Q4PanelError("experimental panel is closed") - if self._modal_only: - raise ValueError("free-free modal-only policy does not admit static solves") - selector = checked_physical_selection if self._physical_footprint_law else checked_selection - chosen_footprints = selector(selected_footprints, self.footprints) - try: - chosen = tuple(selected_dofs) - chosen_points = tuple(selected_points) - submitted = tuple(cases) - except TypeError as exc: - raise ValueError("ordered B2 panel cases and selection required") from exc - if (not chosen or any(type(value) is not int or - not 0 <= value < len(self._u0) - for value in chosen) or - len(set(chosen)) != len(chosen)): - raise ValueError("unique selected panel coordinate indices required") - if (any(type(point_id) is not str or - point_id not in self.point_ids for point_id in chosen_points) or - len(set(chosen_points)) != len(chosen_points)): - raise ValueError("unique selected panel point IDs required") - if (not submitted or - any(type(item) not in (tuple, list) or len(item) != 2 or - type(item[0]) is not str or not item[0].strip() - for item in submitted) or - len({item[0] for item in submitted}) != len(submitted)): - raise ValueError("unique nonempty ordered B2 panel case IDs required") - # Caller-owned list pairs may be changed by a completion callback. - # Snapshot their inventory/references now; later load-value mutation - # remains checked by the existing bounded fingerprints below. - submitted = tuple((case_id, load) for case_id, load in submitted) - if self._physical_footprint_law and any(isinstance(load,B2ReferenceBodyLoad) for _,load in submitted): - raise ValueError("physical footprint body-load driver not admitted") - selected_rows = tuple((item.row_start+j,item.footprint_id,item.shell_node,item.beam_node,component) - for item in self._footprint_incidence if item.footprint_id in chosen_footprints - for j,component in enumerate(("translation_x","translation_y","translation_z","director_1","director_2"))) if self._physical_footprint_law else () - if cancellation_token is not None and not isinstance( - cancellation_token, CancellationToken): - raise TypeError("B2 panel cancellation token required") - if on_case is not None and not callable(on_case): - raise TypeError("B2 panel case callback required") - recovery = _checked_recovery( - {} if recover_members is None else recover_members, - {member_id for member_id, _ in self._members}) - # Counts outlive a callback closing the owner, without retaining its - # factor in this operation or a propagated callback-error traceback. - factorization_count = self._handle.factorization_count - solve_count = self._handle.solve_count - fingerprints = [] - for _case_id, load in submitted: - if cancellation_token is not None and cancellation_token.is_cancelled: - break - snapshot, fingerprint = self._body_load_snapshot(load) - fingerprints.append(fingerprint) - del snapshot - completed = [] - - def envelopes(attribute): - if not completed: - return () - extrema = [] - for index, dof in enumerate(chosen): - # min/max preserve the first case on exact ties. No rounding, - # absolute envelope or physical-unit conversion is introduced. - minimum = min(completed, key=lambda case: getattr(case, attribute)[index]) - maximum = max(completed, key=lambda case: getattr(case, attribute)[index]) - extrema.append(ExperimentalB2Q4PanelResponseEnvelope( - dof, getattr(minimum, attribute)[index], minimum.case_id, - getattr(maximum, attribute)[index], maximum.case_id)) - return tuple(extrema) - - def member_envelopes(): - if not completed or not recovery: - return () - sections = tuple((case.case_id, dict(case.beam_resultants_local)) - for case in completed) - extrema = [] - for member_id, stations in recovery.items(): - if any(member_id not in rows or len(rows[member_id]) != len(stations) - for _, rows in sections): - raise RuntimeError("incomplete selected B2 member recovery") - for station_index, station in enumerate(stations): - for component_index, component in enumerate( - ("N", "Qy", "Qz", "Mx", "My", "Mz")): - values = tuple((case_id, rows[member_id][station_index][component_index]) - for case_id, rows in sections) - minimum = min(values, key=lambda item: item[1]) - maximum = max(values, key=lambda item: item[1]) - extrema.append(ExperimentalB2Q4PanelMemberResultantEnvelope( - member_id, station_index, station, component, - minimum[1], minimum[0], maximum[1], maximum[0])) - return tuple(extrema) - - def finish(status, failure_reason=None): - result_type = (ExperimentalB2Q4FootprintBatchResult if self.footprints - else ExperimentalB2Q4PanelBatchResult) - extra = {"selected_footprints": chosen_footprints} if self.footprints else {} - if self._physical_footprint_law: - result_type = B2PhysicalRigidFootprintBatchResult - extra["constraint_rows"] = selected_rows - return result_type( - status, chosen, chosen_points, tuple(completed), - factorization_count, solve_count, - failure_reason=failure_reason, - displacement_envelopes=envelopes("selected_displacements"), - affine_reaction_envelopes=envelopes("selected_affine_reactions"), - member_resultant_envelopes=member_envelopes(), **extra) - - for index, (case_id, load) in enumerate(submitted): - if self._closed or (cancellation_token is not None and - cancellation_token.is_cancelled): - break - snapshot, fingerprint = self._body_load_snapshot(load) - if fingerprint != fingerprints[index]: - raise ValueError("B2 panel load case changed after submission") - result = self.solve_linear(load if isinstance(load, B2ReferenceBodyLoad) else snapshot, recover_members=recovery, - selected_footprints=selected_footprints) - factorization_count = result.factorization_count - solve_count = result.solve_count - if result.status != "completed": - return finish("failed", f"{case_id}: {result.failure_reason}") - point_multipliers = dict(result.point_multipliers) - point_gaps = dict(result.point_gaps) - case_type = (ExperimentalB2Q4FootprintSelectedCase if self.footprints - else ExperimentalB2Q4PanelSelectedCase) - extra = {"footprint_wrenches": result.footprint_wrenches} if self.footprints else {} - if self._physical_footprint_law: - case_type = B2PhysicalRigidFootprintSelectedCase - row_indices = tuple(row[0] for row in selected_rows) - extra.update(constraint_multipliers=tuple(result.constraint_multipliers[i] for i in row_indices), - constraint_gaps=tuple(result.constraint_gaps[i] for i in row_indices)) - if isinstance(load, B2ReferenceBodyLoad): - case_type = B2BodyLoadedFootprintSelectedCase if self.footprints else B2BodyLoadedPanelSelectedCase - extra.update(body_model_identity=result.body_model_identity, - body_acceleration_m_s2=result.body_acceleration_m_s2, - equilibrated_sections=result.equilibrated_sections) - if self._point_trace_policy is not None: - case_type = B2LoadedPointPanelSelectedCase - extra.update(equilibrated_sections=result.equilibrated_sections, - loaded_member_poses=result.loaded_member_poses, - loaded_strain_energy=result.loaded_strain_energy) - completed.append(case_type( - case_id, - tuple(result.displacements[index] for index in chosen), - tuple(result.affine_reactions[index] for index in chosen), - tuple((point_id, point_multipliers[point_id]) - for point_id in chosen_points), - tuple((point_id, point_gaps[point_id]) - for point_id in chosen_points), - result.beam_resultants_local, - result.internal_strain_energy, **extra)) - if on_case is not None: - on_case(case_id) - return finish( - "cancelled" if len(completed) != len(submitted) else "completed", - failure_reason=("experimental panel closed" + - (" after " + completed[-1].case_id if completed else "") - if self._closed and len(completed) != len(submitted) - else None)) - + gap_tolerance = self._footprint_gap_tolerance(u, gap_scale, roundoff_fraction) + for item in self._footprint_incidence: + width=getattr(item,"row_count",6) + rows = slice(item.row_start, item.row_start+width) + cap = 1e-9*np.array((self._compatibility_length,)*3+(1.,)*(width-3)) + gap_tolerance[rows] = np.minimum(gap_tolerance[rows], cap) + if (not np.isfinite(reaction).all() or + not np.isfinite(gap).all() or not np.isfinite(projected).all() or + not np.isfinite(gap_scale).all() or + not np.isfinite(equilibrium_tolerance).all() or + not np.isfinite(gap_tolerance).all() or + np.any(np.abs(gap) > gap_tolerance) or + np.any(np.abs(projected) > equilibrium_tolerance)): + raise _NumericalFailure("panel point gap or equilibrium failed") + except (_NumericalFailure, RepresentabilityError) as exc: + return self._panel_result( + "failed", factorization_count=self._handle.factorization_count, + solve_count=self._handle.solve_count, failure_reason=str(exc)) + recovered = [] + equilibrated = [] + loaded_poses = [] + loaded_states = {} + if self._point_trace_policy is not None: + try: + loaded_states = {member_id: compiled_load.bubble_state(acceleration, lam) + for member_id, compiled_load in self._loaded_members.items()} + except RepresentabilityError as exc: + return self._panel_result("failed", factorization_count=self._handle.factorization_count, + solve_count=self._handle.solve_count, failure_reason=str(exc)) + for member_id, (member, slots) in self._members: + if recovery is not None and member_id not in recovery: + continue + local = member.local_dof_map() @ u[slots] + if not np.isfinite(local).all(): + return self._panel_result( + "failed", factorization_count=self._handle.factorization_count, + solve_count=self._handle.solve_count, + failure_reason="finite physical B2 recovery coordinates required") + result = member.operator.recover_sections( + local, stations=(0., .5, 1.) if recovery is None + else recovery[member_id]) + if (not np.isfinite(result.resultants).all() or + not np.isfinite(result.strains).all()): + return self._panel_result( + "failed", factorization_count=self._handle.factorization_count, + solve_count=self._handle.solve_count, + failure_reason="finite physical B2 recovery required") + recovered.append((member_id, tuple( + tuple(map(float, row)) for row in result.resultants))) + if isinstance(load, B2ReferenceBodyLoad) or self._point_trace_policy is not None: + try: + if self._point_trace_policy is not None: + compiled_load = self._loaded_members[member_id] + uniform, point_wrenches, _ = loaded_states[member_id] + actions = compiled_load.section_actions(point_wrenches) + poses = compiled_load.recover_pose(local, result.stations, uniform, point_wrenches) + loaded_poses.append(B2LoadedMemberPoses(member_id, tuple(map(float, result.stations)), + tuple(tuple(map(float, row)) for row in poses))) + else: + with np.errstate(over="ignore", invalid="ignore"): + uniform = (member.definition.mass.matrix_at_reference_axis()[:, :3]@ + member.definition.local_frame_rows()@np.asarray(load.acceleration_m_s2)) + actions = tuple((station, pullback@lam[6*i:6*i+6]) for i, station, pullback in + self._section_point_actions.get(member_id, ())) + if (not np.isfinite(uniform).all() or + any(not np.isfinite(wrench).all() for _, wrench in actions)): + raise RepresentabilityError("physical section actions are not representable") + fields = member.operator.recover_equilibrated_sections(local, + uniform_wrench=uniform, point_actions=actions, stations=result.stations) + except RepresentabilityError as exc: + return self._panel_result("failed", factorization_count=self._handle.factorization_count, + solve_count=self._handle.solve_count, failure_reason=str(exc)) + rows = lambda values: tuple(tuple(map(float, row)) for row in values) + equilibrated.append(B2LoadedMemberSections(member_id, tuple(map(float, fields.stations)), + rows(fields.resultants_left), rows(fields.resultants_right), + rows(fields.strains_left), rows(fields.strains_right), + tuple(map(float, fields.endpoint_tractions)))) + energy = .5*float(u @ force) + if not isfinite(energy): + return self._panel_result( + "failed", factorization_count=self._handle.factorization_count, + solve_count=self._handle.solve_count, + failure_reason="finite panel strain energy required") + extra = {} + if self._physical_footprint_law: + extra.update(constraint_multipliers=tuple(map(float,lam)),constraint_gaps=tuple(map(float,gap)), + constraint_rows=tuple((item.row_start+j,item.footprint_id,item.shell_node,item.beam_node,component) + for item in self._footprint_incidence for j,component in enumerate(("translation_x","translation_y","translation_z","director_1","director_2")))) + if isinstance(load, B2ReferenceBodyLoad): + extra.update(body_model_identity=load.model_identity, + body_acceleration_m_s2=load.acceleration_m_s2, + equilibrated_sections=tuple(equilibrated)) + if self._point_trace_policy is not None: + try: + loaded_energy = fsum((energy, *(state[2] for state in loaded_states.values()))) + except OverflowError: + loaded_energy = float("inf") + if not isfinite(loaded_energy) or loaded_energy < 0.: + return self._panel_result("failed", factorization_count=self._handle.factorization_count, + solve_count=self._handle.solve_count, failure_reason="loaded strain energy is not representable") + extra.update(equilibrated_sections=tuple(equilibrated), loaded_member_poses=tuple(loaded_poses), + loaded_strain_energy=loaded_energy) + if chosen_footprints: + try: + wrench_recovery = physical_selected_wrenches if self._physical_footprint_law else selected_wrenches + extra["footprint_wrenches"] = wrench_recovery( + self._footprint_incidence, chosen_footprints, lam, gap) + except (ValueError, OverflowError) as exc: + return self._panel_result( + "failed", factorization_count=self._handle.factorization_count, + solve_count=self._handle.solve_count, failure_reason=str(exc)) + return self._panel_result( + "completed", tuple(map(float, u)), + tuple((point_id, tuple(map(float, lam[6*i:6*i+6]))) + for i, point_id in enumerate(self.point_ids)), + tuple(map(float, reaction)), + tuple((point_id, tuple(map(float, gap[6*i:6*i+6]))) + for i, point_id in enumerate(self.point_ids)), + tuple(recovered), energy, self._handle.factorization_count, + self._handle.solve_count, **extra) + + def solve_linear_many( + self, cases: Sequence[tuple[str, object]], *, + selected_dofs: Sequence[int], + selected_points: Sequence[str] = (), + selected_footprints: B2NodalRigidFootprintSelection | B2PhysicalRigidFootprintSelection | None = None, + recover_members: Mapping[str, Sequence[float]] | None = None, + cancellation_token: CancellationToken | None = None, + on_case: Callable[[str], None] | None = None, + ) -> ExperimentalB2Q4PanelBatchResult: + """Solve ordered cases with one factorization and bounded case storage. + + Each result is complete before it joins the returned prefix. Numerical + failure, cooperative cancellation or owner closure stops further cases. + Closing from a completion callback preserves the complete prefix; a + final-case closure still returns completed. Callback and programming + errors propagate. This development route uses one RHS at a + time, avoiding full displacement/reaction batches for large panels. + Selected displacement, reaction and local member-resultant envelopes + describe only complete cases in the returned prefix, with the first + submitted case governing ties. + """ + if self._closed: + raise ExperimentalB2Q4PanelError("experimental panel is closed") + if self._modal_only: + raise ValueError("free-free modal-only policy does not admit static solves") + selector = checked_physical_selection if self._physical_footprint_law else checked_selection + chosen_footprints = selector(selected_footprints, self.footprints) + try: + chosen = tuple(selected_dofs) + chosen_points = tuple(selected_points) + submitted = tuple(cases) + except TypeError as exc: + raise ValueError("ordered B2 panel cases and selection required") from exc + if (not chosen or any(type(value) is not int or + not 0 <= value < len(self._u0) + for value in chosen) or + len(set(chosen)) != len(chosen)): + raise ValueError("unique selected panel coordinate indices required") + if (any(type(point_id) is not str or + point_id not in self.point_ids for point_id in chosen_points) or + len(set(chosen_points)) != len(chosen_points)): + raise ValueError("unique selected panel point IDs required") + if (not submitted or + any(type(item) not in (tuple, list) or len(item) != 2 or + type(item[0]) is not str or not item[0].strip() + for item in submitted) or + len({item[0] for item in submitted}) != len(submitted)): + raise ValueError("unique nonempty ordered B2 panel case IDs required") + # Caller-owned list pairs may be changed by a completion callback. + # Snapshot their inventory/references now; later load-value mutation + # remains checked by the existing bounded fingerprints below. + submitted = tuple((case_id, load) for case_id, load in submitted) + if self._physical_footprint_law and any(isinstance(load,B2ReferenceBodyLoad) for _,load in submitted): + raise ValueError("physical footprint body-load driver not admitted") + selected_rows = tuple((item.row_start+j,item.footprint_id,item.shell_node,item.beam_node,component) + for item in self._footprint_incidence if item.footprint_id in chosen_footprints + for j,component in enumerate(("translation_x","translation_y","translation_z","director_1","director_2"))) if self._physical_footprint_law else () + if cancellation_token is not None and not isinstance( + cancellation_token, CancellationToken): + raise TypeError("B2 panel cancellation token required") + if on_case is not None and not callable(on_case): + raise TypeError("B2 panel case callback required") + recovery = _checked_recovery( + {} if recover_members is None else recover_members, + {member_id for member_id, _ in self._members}) + # Counts outlive a callback closing the owner, without retaining its + # factor in this operation or a propagated callback-error traceback. + factorization_count = self._handle.factorization_count + solve_count = self._handle.solve_count + fingerprints = [] + for _case_id, load in submitted: + if cancellation_token is not None and cancellation_token.is_cancelled: + break + snapshot, fingerprint = self._body_load_snapshot(load) + fingerprints.append(fingerprint) + del snapshot + completed = [] + + def envelopes(attribute): + if not completed: + return () + extrema = [] + for index, dof in enumerate(chosen): + # min/max preserve the first case on exact ties. No rounding, + # absolute envelope or physical-unit conversion is introduced. + minimum = min(completed, key=lambda case: getattr(case, attribute)[index]) + maximum = max(completed, key=lambda case: getattr(case, attribute)[index]) + extrema.append(ExperimentalB2Q4PanelResponseEnvelope( + dof, getattr(minimum, attribute)[index], minimum.case_id, + getattr(maximum, attribute)[index], maximum.case_id)) + return tuple(extrema) + + def member_envelopes(): + if not completed or not recovery: + return () + sections = tuple((case.case_id, dict(case.beam_resultants_local)) + for case in completed) + extrema = [] + for member_id, stations in recovery.items(): + if any(member_id not in rows or len(rows[member_id]) != len(stations) + for _, rows in sections): + raise RuntimeError("incomplete selected B2 member recovery") + for station_index, station in enumerate(stations): + for component_index, component in enumerate( + ("N", "Qy", "Qz", "Mx", "My", "Mz")): + values = tuple((case_id, rows[member_id][station_index][component_index]) + for case_id, rows in sections) + minimum = min(values, key=lambda item: item[1]) + maximum = max(values, key=lambda item: item[1]) + extrema.append(ExperimentalB2Q4PanelMemberResultantEnvelope( + member_id, station_index, station, component, + minimum[1], minimum[0], maximum[1], maximum[0])) + return tuple(extrema) + + def finish(status, failure_reason=None): + result_type = (ExperimentalB2Q4FootprintBatchResult if self.footprints + else ExperimentalB2Q4PanelBatchResult) + extra = {"selected_footprints": chosen_footprints} if self.footprints else {} + if self._physical_footprint_law: + result_type = B2PhysicalRigidFootprintBatchResult + extra["constraint_rows"] = selected_rows + return result_type( + status, chosen, chosen_points, tuple(completed), + factorization_count, solve_count, + failure_reason=failure_reason, + displacement_envelopes=envelopes("selected_displacements"), + affine_reaction_envelopes=envelopes("selected_affine_reactions"), + member_resultant_envelopes=member_envelopes(), **extra) + + for index, (case_id, load) in enumerate(submitted): + if self._closed or (cancellation_token is not None and + cancellation_token.is_cancelled): + break + snapshot, fingerprint = self._body_load_snapshot(load) + if fingerprint != fingerprints[index]: + raise ValueError("B2 panel load case changed after submission") + result = self.solve_linear(load if isinstance(load, B2ReferenceBodyLoad) else snapshot, recover_members=recovery, + selected_footprints=selected_footprints) + factorization_count = result.factorization_count + solve_count = result.solve_count + if result.status != "completed": + return finish("failed", f"{case_id}: {result.failure_reason}") + point_multipliers = dict(result.point_multipliers) + point_gaps = dict(result.point_gaps) + case_type = (ExperimentalB2Q4FootprintSelectedCase if self.footprints + else ExperimentalB2Q4PanelSelectedCase) + extra = {"footprint_wrenches": result.footprint_wrenches} if self.footprints else {} + if self._physical_footprint_law: + case_type = B2PhysicalRigidFootprintSelectedCase + row_indices = tuple(row[0] for row in selected_rows) + extra.update(constraint_multipliers=tuple(result.constraint_multipliers[i] for i in row_indices), + constraint_gaps=tuple(result.constraint_gaps[i] for i in row_indices)) + if isinstance(load, B2ReferenceBodyLoad): + case_type = B2BodyLoadedFootprintSelectedCase if self.footprints else B2BodyLoadedPanelSelectedCase + extra.update(body_model_identity=result.body_model_identity, + body_acceleration_m_s2=result.body_acceleration_m_s2, + equilibrated_sections=result.equilibrated_sections) + if self._point_trace_policy is not None: + case_type = B2LoadedPointPanelSelectedCase + extra.update(equilibrated_sections=result.equilibrated_sections, + loaded_member_poses=result.loaded_member_poses, + loaded_strain_energy=result.loaded_strain_energy) + completed.append(case_type( + case_id, + tuple(result.displacements[index] for index in chosen), + tuple(result.affine_reactions[index] for index in chosen), + tuple((point_id, point_multipliers[point_id]) + for point_id in chosen_points), + tuple((point_id, point_gaps[point_id]) + for point_id in chosen_points), + result.beam_resultants_local, + result.internal_strain_energy, **extra)) + if on_case is not None: + on_case(case_id) + return finish( + "cancelled" if len(completed) != len(submitted) else "completed", + failure_reason=("experimental panel closed" + + (" after " + completed[-1].case_id if completed else "") + if self._closed and len(completed) != len(submitted) + else None)) + def close(self) -> None: - self._closed = True - try: - _retire_private_q4_mesh(self) - finally: - self._handle = None - self._physical_scaled_kkt = None - self._attachment_elimination = None - if self._point_trace_policy is not None: - for compiled_load in self._loaded_members.values(): - compiled_load._recovery_maps.clear() - self._loaded_members.clear() - self._H = self._abs_H = self._resolution_kkt = None - self._resolution_kkt = None - self._affine_resolution_cache = None - self._buckling_model = None - self._buckling_shells = () - - -def _release_coo_scratch(rows, columns, values, diagnostic, phase): - # CSR owns its arrays; these compiler lists have no later mechanics use. - counts = tuple(map(len, (rows, columns, values))) if diagnostic is not None else None - rows.clear() - columns.clear() - values.clear() - if diagnostic is not None: - diagnostic.record_coo_release(phase, counts) - - -def _scatter(rows, columns, values, slots, local): - width = len(slots) - rows.extend(np.repeat(slots, width)) - columns.extend(np.tile(slots, width)) - values.extend(np.asarray(local).ravel()) - - -def _modal_scaled_residual(residual, bound, row_scale): - """Infinity backward error in the fixed congruence row representation. - - Near-zero components of an uncoupled mode are not separate relative-error - denominators. Scaling the rows before the norm keeps their units consistent - with the factorization coordinates without an arbitrary physical floor. - """ - residual, bound = np.asarray(residual), np.asarray(bound) - if not np.isfinite(residual).all() or not np.isfinite(bound).all(): - return float("inf") - numerator = np.max(abs(residual)*row_scale, initial=0.) - denominator = np.max(bound*row_scale, initial=0.) - if not np.isfinite(numerator) or not np.isfinite(denominator): - return float("inf") - if denominator == 0.: - return 0. if numerator == 0. else float("inf") - return float(numerator/denominator) - - -def _free_b2_rigid_space(owner, scale, scaled_mass, safe_point): - """Common physical velocities, with only a bounded six-by-six Gram solve.""" - origin = owner._modal_positions[:len(owner.shell_node_ids)].mean(axis=0) - canonical = np.zeros((owner._K.shape[0], 6)) - for i, position in enumerate(owner._modal_positions): - slots = slice(6*i, 6*i+3) - canonical[slots, :3] = np.eye(3) - for j in range(3): - canonical[slots, 3+j] = np.cross(np.eye(3)[j], position-origin) - canonical[6*i+3:6*i+6, 3:] = np.eye(3) - n = owner._K.shape[0] - equations, gaps = [], [] - for column in canonical.T: - safe_point("reference modes rigid field") - equation = _modal_scaled_residual(owner._K@column, - abs(owner._K)@abs(column), scale[:n]) - gap = _modal_scaled_residual(owner._C@column, - abs(owner._C)@abs(column), scale[n:]) - if equation > 1e-8 or gap > 1e-9: - raise _NumericalFailure("canonical free-free rigid field violates physical K or point C") - equations.append(equation); gaps.append(gap) - gram = canonical.T@owner._M@canonical - if (not np.isfinite(gram).all() or - np.max(abs(gram-gram.T)) > 1e-10*np.max(abs(gram))): - raise _NumericalFailure("canonical rigid kinetic Gram symmetry unresolved") - try: - lower = np.linalg.cholesky(gram) - normalized = canonical@np.linalg.solve(lower.T, np.eye(6)) - except np.linalg.LinAlgError as exc: - raise _NumericalFailure("six physical rigid fields require positive kinetic Gram") from exc - if (not np.isfinite(normalized).all() or - np.max(abs(normalized.T@owner._M@normalized-np.eye(6))) > 1e-7): - raise _NumericalFailure("rigid kinetic normalization unresolved") - scaled = np.vstack((normalized, np.zeros((owner._C.shape[0], 6))))/scale[:, None] - if (not np.isfinite(scaled).all() or - np.max(abs(scaled.T@scaled_mass@scaled-np.eye(6))) > 1e-7): - raise _NumericalFailure("rigid congruence reconstruction unresolved") - return dict(origin=tuple(map(float, origin)), canonical=canonical, - normalized=normalized, scaled=scaled, gram=gram, - equations=tuple(equations), gaps=tuple(gaps)) - - -class ExperimentalB2MixedPanelAnalysis(ExperimentalB2Q4PanelAnalysis): - """Explicit mixed-shell admission using the existing static sparse owner.""" - - _mixed_shells = True - - @property - def capabilities(self) -> ExperimentalB2MixedPanelCapabilities: - existing = super().capabilities - capability_type = (ExperimentalB2MixedReferenceModalCapabilities if - self._reference_inertia_policy is not None else ExperimentalB2MixedPanelCapabilities) - extra = ({"shell_mass_policies": tuple((shell_id, - S3_V2D_TRANSLATIONAL_LUMPED_SECTION_AREAL_MASS_V1 if formulation == - S3_V2D_FORMULATION_ID else Q4_MASS_POLICY) - for shell_id, formulation in self._shell_formulations)} - if self._reference_inertia_policy is not None else {}) - if self._reference_inertia_policy is not None: - extra["boundary_policy"] = self._reference_boundary_policy - return capability_type( - point_law_id=tuple(dict.fromkeys(law for _, law in self._point_laws)), - attachment=existing.attachment, - operations=existing.operations, - body_load_domain=existing.body_load_domain, + self._closed = True + try: + _retire_private_q4_mesh(self) + finally: + self._handle = None + self._physical_scaled_kkt = None + self._attachment_elimination = None + if self._point_trace_policy is not None: + for compiled_load in self._loaded_members.values(): + compiled_load._recovery_maps.clear() + self._loaded_members.clear() + self._H = self._abs_H = self._resolution_kkt = None + self._resolution_kkt = None + self._affine_resolution_cache = None + self._buckling_model = None + self._buckling_shells = () + + +def _release_coo_scratch(rows, columns, values, diagnostic, phase): + # CSR owns its arrays; these compiler lists have no later mechanics use. + counts = tuple(map(len, (rows, columns, values))) if diagnostic is not None else None + rows.clear() + columns.clear() + values.clear() + if diagnostic is not None: + diagnostic.record_coo_release(phase, counts) + + +def _scatter(rows, columns, values, slots, local): + width = len(slots) + rows.extend(np.repeat(slots, width)) + columns.extend(np.tile(slots, width)) + values.extend(np.asarray(local).ravel()) + + +def _modal_scaled_residual(residual, bound, row_scale): + """Infinity backward error in the fixed congruence row representation. + + Near-zero components of an uncoupled mode are not separate relative-error + denominators. Scaling the rows before the norm keeps their units consistent + with the factorization coordinates without an arbitrary physical floor. + """ + residual, bound = np.asarray(residual), np.asarray(bound) + if not np.isfinite(residual).all() or not np.isfinite(bound).all(): + return float("inf") + numerator = np.max(abs(residual)*row_scale, initial=0.) + denominator = np.max(bound*row_scale, initial=0.) + if not np.isfinite(numerator) or not np.isfinite(denominator): + return float("inf") + if denominator == 0.: + return 0. if numerator == 0. else float("inf") + return float(numerator/denominator) + + +def _free_b2_rigid_space(owner, scale, scaled_mass, safe_point): + """Common physical velocities, with only a bounded six-by-six Gram solve.""" + origin = owner._modal_positions[:len(owner.shell_node_ids)].mean(axis=0) + canonical = np.zeros((owner._K.shape[0], 6)) + for i, position in enumerate(owner._modal_positions): + slots = slice(6*i, 6*i+3) + canonical[slots, :3] = np.eye(3) + for j in range(3): + canonical[slots, 3+j] = np.cross(np.eye(3)[j], position-origin) + canonical[6*i+3:6*i+6, 3:] = np.eye(3) + n = owner._K.shape[0] + equations, gaps = [], [] + for column in canonical.T: + safe_point("reference modes rigid field") + equation = _modal_scaled_residual(owner._K@column, + abs(owner._K)@abs(column), scale[:n]) + gap = _modal_scaled_residual(owner._C@column, + abs(owner._C)@abs(column), scale[n:]) + if equation > 1e-8 or gap > 1e-9: + raise _NumericalFailure("canonical free-free rigid field violates physical K or point C") + equations.append(equation); gaps.append(gap) + gram = canonical.T@owner._M@canonical + if (not np.isfinite(gram).all() or + np.max(abs(gram-gram.T)) > 1e-10*np.max(abs(gram))): + raise _NumericalFailure("canonical rigid kinetic Gram symmetry unresolved") + try: + lower = np.linalg.cholesky(gram) + normalized = canonical@np.linalg.solve(lower.T, np.eye(6)) + except np.linalg.LinAlgError as exc: + raise _NumericalFailure("six physical rigid fields require positive kinetic Gram") from exc + if (not np.isfinite(normalized).all() or + np.max(abs(normalized.T@owner._M@normalized-np.eye(6))) > 1e-7): + raise _NumericalFailure("rigid kinetic normalization unresolved") + scaled = np.vstack((normalized, np.zeros((owner._C.shape[0], 6))))/scale[:, None] + if (not np.isfinite(scaled).all() or + np.max(abs(scaled.T@scaled_mass@scaled-np.eye(6))) > 1e-7): + raise _NumericalFailure("rigid congruence reconstruction unresolved") + return dict(origin=tuple(map(float, origin)), canonical=canonical, + normalized=normalized, scaled=scaled, gram=gram, + equations=tuple(equations), gaps=tuple(gaps)) + + +class ExperimentalB2MixedPanelAnalysis(ExperimentalB2Q4PanelAnalysis): + """Explicit mixed-shell admission using the existing static sparse owner.""" + + _mixed_shells = True + + @property + def capabilities(self) -> ExperimentalB2MixedPanelCapabilities: + existing = super().capabilities + capability_type = (ExperimentalB2MixedReferenceModalCapabilities if + self._reference_inertia_policy is not None else ExperimentalB2MixedPanelCapabilities) + extra = ({"shell_mass_policies": tuple((shell_id, + S3_V2D_TRANSLATIONAL_LUMPED_SECTION_AREAL_MASS_V1 if formulation == + S3_V2D_FORMULATION_ID else Q4_MASS_POLICY) + for shell_id, formulation in self._shell_formulations)} + if self._reference_inertia_policy is not None else {}) + if self._reference_inertia_policy is not None: + extra["boundary_policy"] = self._reference_boundary_policy + return capability_type( + point_law_id=tuple(dict.fromkeys(law for _, law in self._point_laws)), + attachment=existing.attachment, + operations=existing.operations, + body_load_domain=existing.body_load_domain, spectral_domain=(existing.spectral_domain if self._modal_only or self._physical_footprint_law else - "experimental virgin supported finite descriptor pairs; heterogeneous Q4 director and native S3 lumped translation inertia; S3 rotary inertia omitted; completeness unqualified; prestress unsupported" - if self._reference_inertia_policy is not None else - "native S3 V2D physical mass and modes deferred" if self._has_s3 - else existing.spectral_domain), - shell_formulations=self._shell_formulations, - point_laws=self._point_laws, + "experimental virgin supported finite descriptor pairs; heterogeneous Q4 director and native S3 lumped translation inertia; S3 rotary inertia omitted; completeness unqualified; prestress unsupported" + if self._reference_inertia_policy is not None else + "native S3 V2D physical mass and modes deferred" if self._has_s3 + else existing.spectral_domain), + shell_formulations=self._shell_formulations, + point_laws=self._point_laws, footprint_law_id=existing.footprint_law_id if self._physical_footprint_law else FOOTPRINT_LAW_ID if self.footprints else None, - footprints=self.footprints, **extra) - - -def create_experimental_b2_q4_panel_analysis(*args, **kwargs): - return ExperimentalB2Q4PanelAnalysis(*args, **kwargs) + footprints=self.footprints, **extra) + + +def create_experimental_b2_q4_panel_analysis(*args, **kwargs): + return ExperimentalB2Q4PanelAnalysis(*args, **kwargs) diff --git a/src/anyfesolver/_stiffened_shell_b2_reference_buckling.py b/src/anyfesolver/_stiffened_shell_b2_reference_buckling.py index 15dc5ff57..c9ce408b9 100644 --- a/src/anyfesolver/_stiffened_shell_b2_reference_buckling.py +++ b/src/anyfesolver/_stiffened_shell_b2_reference_buckling.py @@ -1,413 +1,413 @@ -"""Experimental conservative reference buckling of the physical B2 panel. - -Spectral kinematics are deliberately separate from the affine static owner. -Section tractions are supplied physical data, never reconstructed from stiffness. -""" -from dataclasses import dataclass -import hashlib -import numpy as np -from scipy import sparse -from scipy.sparse.linalg import LinearOperator, eigs, ArpackError - -POLICY = "B2_PHYSICAL_REFERENCE_GREEN_POINT_BUCKLING_V1_DEV" -PORT_POLICY = "B2_GEODESIC_MIDFRAME_PROPER_POLAR_SECOND_VARIATION_V1_DEV" -Q4_KERNEL_POLICY = "Q4_QUALIFIED_REFERENCE_RECOVERED_N_M_HOMOGENEOUS_SECOND_MOMENT_PHYSICAL_TO_GP_FRAME_V2_DEV" -S3_KERNEL_POLICY = "S3_V2D_FROZEN_THIN_UNIFORM_MEMBRANE_OMITS_PHYSICAL_SECOND_MOMENT" - -class _BucklingNumericalFailure(RuntimeError): - """A deliberately classified failed numerical spectral operation.""" - -def _sealed(value, shape, label): - a = np.asarray(value, dtype=float) - if a.shape != shape or not np.isfinite(a).all(): - raise ValueError(f"finite {label} with shape {shape} required") - return np.frombuffer(a.tobytes(), dtype=float).reshape(shape) - -def _cross_matrix(v): - return np.array(((0.,-v[2],v[1]),(v[2],0.,-v[0]),(-v[1],v[0],0.))) - -@dataclass(frozen=True) -class B2SectionTractionQuadrature: - """Physical traction source about the member reference axis, in its frame. - - ``traction_map[k] @ [N,Qy,Qz,Mx,My,Mz]`` gives S11,S12,S13. - Transverse stresses are zero under this declared beam idealization. - """ - member_id: str - source_id: str - coordinates_yz_m: tuple - area_weights_m2: tuple - traction_map: tuple - datum: str = "member_reference_axis_local_yz" - - def __post_init__(self): - if type(self.member_id) is not str or type(self.source_id) is not str or not self.member_id or not self.source_id or self.datum != "member_reference_axis_local_yz": - raise ValueError("explicit source and member reference-axis datum required") - n = len(self.area_weights_m2) - yz = _sealed(self.coordinates_yz_m,(n,2),"section coordinates") - w = _sealed(self.area_weights_m2,(n,),"section area weights") - t = _sealed(self.traction_map,(n,3,6),"section traction reconstruction") - if n < 3 or np.any(w <= 0.): - raise ValueError("positive physical section area quadrature required") - length=float(np.max(abs(yz))) - if not np.isfinite(length) or length <= 0.: raise ValueError("nonzero physical section length required") - result = np.zeros((6,6)); scale = np.zeros((6,6)) - for xy, weight, mapping in zip(yz,w,t): - rho = np.r_[0.,xy/length] - action = np.vstack((np.eye(3),_cross_matrix(rho))) - # D R D^-1, with D=diag(I, I/length): dimensionless force / - # moment virtual-work certificate in the declared physical datum. - normalized=mapping.copy();normalized[:,3:]*=length - with np.errstate(over="ignore",invalid="ignore"): - result += weight*action@normalized - scale += weight*abs(action)@abs(normalized) - if not np.isfinite(result).all() or not np.isfinite(scale).all(): - raise ValueError("section six-resultant arithmetic not representable") - # Elementwise backward work certificate; cancellation is measured, not hidden. - error = abs(result-np.eye(6)) - if np.any(error > 128*np.finfo(float).eps*(scale+np.eye(6))): - raise ValueError("section source does not reproduce six physical resultants") - if np.max(np.sum(error,axis=1)) > 1e-10: - raise ValueError("section source forward six-resultant identity failed") - object.__setattr__(self,"coordinates_yz_m",yz) - object.__setattr__(self,"area_weights_m2",w) - object.__setattr__(self,"traction_map",t) - - @property - def identity(self): - h = hashlib.sha256((self.member_id+"\0"+self.source_id+"\0"+self.datum).encode()) - for a in (self.coordinates_yz_m,self.area_weights_m2,self.traction_map): h.update(a.tobytes()) - return h.hexdigest() - -@dataclass(frozen=True) -class B2ReferenceBucklingRequest: - preload: tuple - section_tractions: tuple - count: int = 1 - shift: float = 0. - max_iterations: int = 1000 - - def __post_init__(self): - p = np.asarray(self.preload,dtype=float) - if p.ndim != 1 or not np.isfinite(p).all(): raise ValueError("finite dead nodal force vector required") - object.__setattr__(self,"preload",tuple(map(float,p))) - sources = tuple(self.section_tractions) - if any(type(s) is not B2SectionTractionQuadrature for s in sources): raise ValueError("typed physical traction sources required") - if len({s.member_id for s in sources}) != len(sources): raise ValueError("one source per member required") - object.__setattr__(self,"section_tractions",sources) - if type(self.count) is not int or self.count < 1: raise ValueError("positive buckling count required") - if not np.isfinite(self.shift) or self.shift < 0.: raise ValueError("finite nonnegative load-factor shift required") - if type(self.max_iterations) is not int or self.max_iterations < 1: raise ValueError("positive iteration bound required") - -@dataclass(frozen=True) -class B2ReferenceBucklingCapabilities: - eligible: bool - reasons: tuple = () - policy: str = POLICY - production_qualified: bool = False - scope: str = "zero-prescription Cartesian dead-force endpoint POINT Q4 / uniform-membrane S3" - remaining: tuple = ("general S3 bending/director second moment/shear", "Q4 shear prestress", "interior loaded ports", "weak lines", "footprints", "prescribed prestress", "dead-couple potential", "full F12/B14 qualification") - shell_kernel_policies: tuple = () - -@dataclass(frozen=True) -class B2ReferenceBucklingResult: - status: str - load_factors: tuple = () - modes: tuple = () - multiplier_modes: tuple = () - equation_residuals: tuple = () - constraint_residuals: tuple = () - preload_result: object = None - identity: str = "" - failure_reason: str | None = None - policy: str = POLICY - production_qualified: bool = False - -def beam_reference_derivatives(operator, station): - """Position/rotation derivatives of the objective geodesic-midframe trace. - - Return first derivatives and coordinate Hessians, plus reference-length - derivatives. Coordinates are the existing twelve additive physical slots. - """ - length = float(operator.length) - poly = operator._trace_polynomials - maps = np.array([[sum(float(c)*station**d for d,c in enumerate(p)) for p in row] for row in poly]) - slope = np.array([[sum(d*float(c)*station**(d-1)/length for d,c in enumerate(p) if d) for p in row] for row in poly]) - eye = np.eye(12) - omega = .5*(eye[3:6]+eye[9:12]).T - mean = .5*(eye[:3]+eye[6:9]).T - first = np.zeros((12,12)); second = np.zeros((12,12,12)) - for node, pos in ((0,np.array((-length/2,0.,0.))),(1,np.array((length/2,0.,0.)))): - base = 6*node - delta = eye[base:base+3].T-mean - theta = eye[base+3:base+6].T - first[base:base+3] = (delta-np.cross(omega,pos)).T - first[base+3:base+6] = (theta-omega).T - for a in range(12): - for b in range(12): - second[base:base+3,a,b] = (-np.cross(omega[a],delta[b])-np.cross(omega[b],delta[a]) - +.5*(np.cross(omega[a],np.cross(omega[b],pos))+np.cross(omega[b],np.cross(omega[a],pos)))) - second[base+3:base+6,a,b] = -.5*(np.cross(omega[a],theta[b])+np.cross(omega[b],theta[a])) - d = maps@first; ds = slope@first - h = np.einsum('ij,jab->iab',maps,second) - hs = np.einsum('ij,jab->iab',slope,second) - pos = np.array(((station-.5)*length,0.,0.)); axis=np.array((1.,0.,0.)) - for a in range(12): - for b in range(12): - h[:3,a,b] += .5*(np.cross(omega[a],np.cross(omega[b],pos))+np.cross(omega[b],np.cross(omega[a],pos)))+np.cross(omega[a],d[:3,b])+np.cross(omega[b],d[:3,a]) - hs[:3,a,b] += .5*(np.cross(omega[a],np.cross(omega[b],axis))+np.cross(omega[b],np.cross(omega[a],axis)))+np.cross(omega[a],ds[:3,b])+np.cross(omega[b],ds[:3,a]) - h[3:,a,b] += .5*(np.cross(omega[a],d[3:,b])+np.cross(omega[b],d[3:,a])) - hs[3:,a,b] += .5*(np.cross(omega[a],ds[3:,b])+np.cross(omega[b],ds[3:,a])) - actual = d.copy(); actual[:3] += mean.T+np.cross(omega,pos).T;actual[3:] += omega.T - actual_s = ds.copy();actual_s[:3] += np.cross(omega,axis).T - if not np.allclose(actual,maps,rtol=0.,atol=128*np.finfo(float).eps*max(1.,abs(maps).max())): - raise ValueError("objective beam continuation does not reproduce reference trace") - return maps,slope,h,hs - -def member_green_hessian(member, displacement, source): - """Full S11/S12/S13 Green sectional initial-stress work, tension sign.""" - operator=member.operator; length=float(operator.length) - nodes, weights=np.polynomial.legendre.leggauss(4) - stations=(nodes+1.)/2; result=operator.recover_sections(displacement,stations=stations).resultants - made=np.zeros((12,12)); virtual=np.zeros(12) - for s,w,resultants in zip(stations,weights,result): - j,js,h,hs=beam_reference_derivatives(operator,float(s)) - for yz,area,traction_map in zip(source.coordinates_yz_m,source.area_weights_m2,source.traction_map): - rho=np.r_[0.,yz]; stress=traction_map@resultants - xs=js[:3].T+np.cross(js[3:].T,rho) - dy=np.cross(j[3:].T,(0.,1.,0.)); dz=np.cross(j[3:].T,(0.,0.,1.)) - e11=xs[:,0]; g12=xs[:,1]+dy[:,0];g13=xs[:,2]+dz[:,0] - virtual += w*length/2*area*(stress[0]*e11+stress[1]*g12+stress[2]*g13) - for a in range(12): - for b in range(12): - xsh=hs[:3,a,b]+np.cross(hs[3:,a,b],rho)+.5*( - np.cross(js[3:,a],np.cross(j[3:,b],rho))+np.cross(j[3:,a],np.cross(js[3:,b],rho))+ - np.cross(js[3:,b],np.cross(j[3:,a],rho))+np.cross(j[3:,b],np.cross(js[3:,a],rho))) - dyh=np.cross(h[3:,a,b],(0.,1.,0.))+.5*(np.cross(j[3:,a],dy[b])+np.cross(j[3:,b],dy[a])) - dzh=np.cross(h[3:,a,b],(0.,0.,1.))+.5*(np.cross(j[3:,a],dz[b])+np.cross(j[3:,b],dz[a])) - v=(stress[0]*(xs[a]@xs[b]+xsh[0])+stress[1]*(xs[a]@dy[b]+xs[b]@dy[a]+xsh[1]+dyh[0])+ - stress[2]*(xs[a]@dz[b]+xs[b]@dz[a]+xsh[2]+dzh[0])) - made[a,b] += w*length/2*area*v - force=np.asarray(operator.evaluate(displacement).force) - force=force.copy();virtual=virtual.copy() - force.reshape(2,6)[:,3:]/=length;virtual.reshape(2,6)[:,3:]/=length - if not np.isfinite(force).all() or not np.isfinite(virtual).all(): - raise ValueError("normalized sectional virtual work not representable") - magnitude=max(float(np.max(abs(force))),float(np.max(abs(virtual)))) - # One common magnitude keeps all norms finite and introduces no unit floor. - f=force/magnitude if magnitude else force;v=virtual/magnitude if magnitude else virtual - denominator=np.linalg.norm(f)+np.linalg.norm(v) - if np.linalg.norm(f-v) > 1e-10*denominator: - raise ValueError("sectional first virtual work disagrees with physical force-flexibility trace") - return made - -def point_green_hessian(law, vertices, member, station, offset, multiplier): - from ._ge_beam3_pose_joint import RigidPoseJoint - width=law.shell_port.shape[1]; r=vertices-vertices.mean(axis=0) - gram=sum((_cross_matrix(x).T@_cross_matrix(x) for x in r),np.zeros((3,3))) - shell_h=np.zeros((6,width,width)); eye=np.eye(width) - omega=law.shell_port[3:].T - translations=np.stack([eye[6*i:6*i+3].T for i in range(len(r))]) - translations-=translations.mean(axis=0) - for a in range(width): - for b in range(width): - rhs=np.zeros(3) - for i,x in enumerate(r): - rhs += np.cross(np.cross(omega[a],x),translations[i,b])+np.cross(np.cross(omega[b],x),translations[i,a]) - rhs += np.cross(.5*(np.cross(omega[a],np.cross(omega[b],x))+np.cross(omega[b],np.cross(omega[a],x))),x) - shell_h[3:,a,b]=np.linalg.solve(gram,rhs) - j,_,h,_=beam_reference_derivatives(member.operator,float(station)) - d=np.asarray(offset,dtype=float); local_h=h.copy() - for a in range(12): - for b in range(12): - local_h[:3,a,b] += np.cross(h[3:,a,b],d)+.5*(np.cross(j[3:,a],np.cross(j[3:,b],d))+np.cross(j[3:,b],np.cross(j[3:,a],d))) - frame=member.definition.local_frame_rows().T; transform=member.local_dof_map() - beam_h=np.einsum('ij,jab,ak,bl->ikl',np.kron(np.eye(2),frame),local_h,transform,transform) - port=np.zeros((12,width+12));port[:6,:width]=law.shell_port;port[6:,width:]=law.beam_port - curvature=np.zeros((12,width+12,width+12));curvature[:6,:width,:width]=shell_h;curvature[6:,width:,width:]=beam_h - joint=RigidPoseJoint(np.stack((law.shell_reference_m,law.beam_reference_m)),law.reference_frames) - response=joint.evaluate(np.stack((law.shell_reference_m,law.beam_reference_m)),law.reference_frames,np.asarray(multiplier)) - return port.T@response.chart_hessian[:12,:12]@port+np.einsum('i,iab->ab',response.residual[:12],curvature) - -@dataclass(frozen=True) -class B2PhysicalFootprintBucklingRequest(B2ReferenceBucklingRequest): - """Opt-in five-row Q4 physical rigid-footprint spectral operation.""" - -@dataclass(frozen=True) -class B2PhysicalFootprintBucklingResult(B2ReferenceBucklingResult): - policy: str = "B2_PHYSICAL_RIGID_FOOTPRINT_GREEN_BUCKLING_V1_DEV" - -def physical_footprint_capabilities(owner): - from ._stiffened_shell_b2_physical_rigid_footprint import BUCKLING_POLICY - reasons=[] - if not getattr(owner,"_physical_footprint_law",False): reasons.append("physical footprint family required") - if owner._closed: reasons.append("owner closed") - if owner.point_ids: reasons.append("mixed POINT / physical footprint spectral operation unavailable") - if np.any(owner._u0 != 0.): reasons.append("prescribed prestress split unavailable") +"""Experimental conservative reference buckling of the physical B2 panel. + +Spectral kinematics are deliberately separate from the affine static owner. +Section tractions are supplied physical data, never reconstructed from stiffness. +""" +from dataclasses import dataclass +import hashlib +import numpy as np +from scipy import sparse +from scipy.sparse.linalg import LinearOperator, eigs, ArpackError + +POLICY = "B2_PHYSICAL_REFERENCE_GREEN_POINT_BUCKLING_V1_DEV" +PORT_POLICY = "B2_GEODESIC_MIDFRAME_PROPER_POLAR_SECOND_VARIATION_V1_DEV" +Q4_KERNEL_POLICY = "Q4_QUALIFIED_REFERENCE_RECOVERED_N_M_HOMOGENEOUS_SECOND_MOMENT_PHYSICAL_TO_GP_FRAME_V2_DEV" +S3_KERNEL_POLICY = "S3_V2D_FROZEN_THIN_UNIFORM_MEMBRANE_OMITS_PHYSICAL_SECOND_MOMENT" + +class _BucklingNumericalFailure(RuntimeError): + """A deliberately classified failed numerical spectral operation.""" + +def _sealed(value, shape, label): + a = np.asarray(value, dtype=float) + if a.shape != shape or not np.isfinite(a).all(): + raise ValueError(f"finite {label} with shape {shape} required") + return np.frombuffer(a.tobytes(), dtype=float).reshape(shape) + +def _cross_matrix(v): + return np.array(((0.,-v[2],v[1]),(v[2],0.,-v[0]),(-v[1],v[0],0.))) + +@dataclass(frozen=True) +class B2SectionTractionQuadrature: + """Physical traction source about the member reference axis, in its frame. + + ``traction_map[k] @ [N,Qy,Qz,Mx,My,Mz]`` gives S11,S12,S13. + Transverse stresses are zero under this declared beam idealization. + """ + member_id: str + source_id: str + coordinates_yz_m: tuple + area_weights_m2: tuple + traction_map: tuple + datum: str = "member_reference_axis_local_yz" + + def __post_init__(self): + if type(self.member_id) is not str or type(self.source_id) is not str or not self.member_id or not self.source_id or self.datum != "member_reference_axis_local_yz": + raise ValueError("explicit source and member reference-axis datum required") + n = len(self.area_weights_m2) + yz = _sealed(self.coordinates_yz_m,(n,2),"section coordinates") + w = _sealed(self.area_weights_m2,(n,),"section area weights") + t = _sealed(self.traction_map,(n,3,6),"section traction reconstruction") + if n < 3 or np.any(w <= 0.): + raise ValueError("positive physical section area quadrature required") + length=float(np.max(abs(yz))) + if not np.isfinite(length) or length <= 0.: raise ValueError("nonzero physical section length required") + result = np.zeros((6,6)); scale = np.zeros((6,6)) + for xy, weight, mapping in zip(yz,w,t): + rho = np.r_[0.,xy/length] + action = np.vstack((np.eye(3),_cross_matrix(rho))) + # D R D^-1, with D=diag(I, I/length): dimensionless force / + # moment virtual-work certificate in the declared physical datum. + normalized=mapping.copy();normalized[:,3:]*=length + with np.errstate(over="ignore",invalid="ignore"): + result += weight*action@normalized + scale += weight*abs(action)@abs(normalized) + if not np.isfinite(result).all() or not np.isfinite(scale).all(): + raise ValueError("section six-resultant arithmetic not representable") + # Elementwise backward work certificate; cancellation is measured, not hidden. + error = abs(result-np.eye(6)) + if np.any(error > 128*np.finfo(float).eps*(scale+np.eye(6))): + raise ValueError("section source does not reproduce six physical resultants") + if np.max(np.sum(error,axis=1)) > 1e-10: + raise ValueError("section source forward six-resultant identity failed") + object.__setattr__(self,"coordinates_yz_m",yz) + object.__setattr__(self,"area_weights_m2",w) + object.__setattr__(self,"traction_map",t) + + @property + def identity(self): + h = hashlib.sha256((self.member_id+"\0"+self.source_id+"\0"+self.datum).encode()) + for a in (self.coordinates_yz_m,self.area_weights_m2,self.traction_map): h.update(a.tobytes()) + return h.hexdigest() + +@dataclass(frozen=True) +class B2ReferenceBucklingRequest: + preload: tuple + section_tractions: tuple + count: int = 1 + shift: float = 0. + max_iterations: int = 1000 + + def __post_init__(self): + p = np.asarray(self.preload,dtype=float) + if p.ndim != 1 or not np.isfinite(p).all(): raise ValueError("finite dead nodal force vector required") + object.__setattr__(self,"preload",tuple(map(float,p))) + sources = tuple(self.section_tractions) + if any(type(s) is not B2SectionTractionQuadrature for s in sources): raise ValueError("typed physical traction sources required") + if len({s.member_id for s in sources}) != len(sources): raise ValueError("one source per member required") + object.__setattr__(self,"section_tractions",sources) + if type(self.count) is not int or self.count < 1: raise ValueError("positive buckling count required") + if not np.isfinite(self.shift) or self.shift < 0.: raise ValueError("finite nonnegative load-factor shift required") + if type(self.max_iterations) is not int or self.max_iterations < 1: raise ValueError("positive iteration bound required") + +@dataclass(frozen=True) +class B2ReferenceBucklingCapabilities: + eligible: bool + reasons: tuple = () + policy: str = POLICY + production_qualified: bool = False + scope: str = "zero-prescription Cartesian dead-force endpoint POINT Q4 / uniform-membrane S3" + remaining: tuple = ("general S3 bending/director second moment/shear", "Q4 shear prestress", "interior loaded ports", "weak lines", "footprints", "prescribed prestress", "dead-couple potential", "full F12/B14 qualification") + shell_kernel_policies: tuple = () + +@dataclass(frozen=True) +class B2ReferenceBucklingResult: + status: str + load_factors: tuple = () + modes: tuple = () + multiplier_modes: tuple = () + equation_residuals: tuple = () + constraint_residuals: tuple = () + preload_result: object = None + identity: str = "" + failure_reason: str | None = None + policy: str = POLICY + production_qualified: bool = False + +def beam_reference_derivatives(operator, station): + """Position/rotation derivatives of the objective geodesic-midframe trace. + + Return first derivatives and coordinate Hessians, plus reference-length + derivatives. Coordinates are the existing twelve additive physical slots. + """ + length = float(operator.length) + poly = operator._trace_polynomials + maps = np.array([[sum(float(c)*station**d for d,c in enumerate(p)) for p in row] for row in poly]) + slope = np.array([[sum(d*float(c)*station**(d-1)/length for d,c in enumerate(p) if d) for p in row] for row in poly]) + eye = np.eye(12) + omega = .5*(eye[3:6]+eye[9:12]).T + mean = .5*(eye[:3]+eye[6:9]).T + first = np.zeros((12,12)); second = np.zeros((12,12,12)) + for node, pos in ((0,np.array((-length/2,0.,0.))),(1,np.array((length/2,0.,0.)))): + base = 6*node + delta = eye[base:base+3].T-mean + theta = eye[base+3:base+6].T + first[base:base+3] = (delta-np.cross(omega,pos)).T + first[base+3:base+6] = (theta-omega).T + for a in range(12): + for b in range(12): + second[base:base+3,a,b] = (-np.cross(omega[a],delta[b])-np.cross(omega[b],delta[a]) + +.5*(np.cross(omega[a],np.cross(omega[b],pos))+np.cross(omega[b],np.cross(omega[a],pos)))) + second[base+3:base+6,a,b] = -.5*(np.cross(omega[a],theta[b])+np.cross(omega[b],theta[a])) + d = maps@first; ds = slope@first + h = np.einsum('ij,jab->iab',maps,second) + hs = np.einsum('ij,jab->iab',slope,second) + pos = np.array(((station-.5)*length,0.,0.)); axis=np.array((1.,0.,0.)) + for a in range(12): + for b in range(12): + h[:3,a,b] += .5*(np.cross(omega[a],np.cross(omega[b],pos))+np.cross(omega[b],np.cross(omega[a],pos)))+np.cross(omega[a],d[:3,b])+np.cross(omega[b],d[:3,a]) + hs[:3,a,b] += .5*(np.cross(omega[a],np.cross(omega[b],axis))+np.cross(omega[b],np.cross(omega[a],axis)))+np.cross(omega[a],ds[:3,b])+np.cross(omega[b],ds[:3,a]) + h[3:,a,b] += .5*(np.cross(omega[a],d[3:,b])+np.cross(omega[b],d[3:,a])) + hs[3:,a,b] += .5*(np.cross(omega[a],ds[3:,b])+np.cross(omega[b],ds[3:,a])) + actual = d.copy(); actual[:3] += mean.T+np.cross(omega,pos).T;actual[3:] += omega.T + actual_s = ds.copy();actual_s[:3] += np.cross(omega,axis).T + if not np.allclose(actual,maps,rtol=0.,atol=128*np.finfo(float).eps*max(1.,abs(maps).max())): + raise ValueError("objective beam continuation does not reproduce reference trace") + return maps,slope,h,hs + +def member_green_hessian(member, displacement, source): + """Full S11/S12/S13 Green sectional initial-stress work, tension sign.""" + operator=member.operator; length=float(operator.length) + nodes, weights=np.polynomial.legendre.leggauss(4) + stations=(nodes+1.)/2; result=operator.recover_sections(displacement,stations=stations).resultants + made=np.zeros((12,12)); virtual=np.zeros(12) + for s,w,resultants in zip(stations,weights,result): + j,js,h,hs=beam_reference_derivatives(operator,float(s)) + for yz,area,traction_map in zip(source.coordinates_yz_m,source.area_weights_m2,source.traction_map): + rho=np.r_[0.,yz]; stress=traction_map@resultants + xs=js[:3].T+np.cross(js[3:].T,rho) + dy=np.cross(j[3:].T,(0.,1.,0.)); dz=np.cross(j[3:].T,(0.,0.,1.)) + e11=xs[:,0]; g12=xs[:,1]+dy[:,0];g13=xs[:,2]+dz[:,0] + virtual += w*length/2*area*(stress[0]*e11+stress[1]*g12+stress[2]*g13) + for a in range(12): + for b in range(12): + xsh=hs[:3,a,b]+np.cross(hs[3:,a,b],rho)+.5*( + np.cross(js[3:,a],np.cross(j[3:,b],rho))+np.cross(j[3:,a],np.cross(js[3:,b],rho))+ + np.cross(js[3:,b],np.cross(j[3:,a],rho))+np.cross(j[3:,b],np.cross(js[3:,a],rho))) + dyh=np.cross(h[3:,a,b],(0.,1.,0.))+.5*(np.cross(j[3:,a],dy[b])+np.cross(j[3:,b],dy[a])) + dzh=np.cross(h[3:,a,b],(0.,0.,1.))+.5*(np.cross(j[3:,a],dz[b])+np.cross(j[3:,b],dz[a])) + v=(stress[0]*(xs[a]@xs[b]+xsh[0])+stress[1]*(xs[a]@dy[b]+xs[b]@dy[a]+xsh[1]+dyh[0])+ + stress[2]*(xs[a]@dz[b]+xs[b]@dz[a]+xsh[2]+dzh[0])) + made[a,b] += w*length/2*area*v + force=np.asarray(operator.evaluate(displacement).force) + force=force.copy();virtual=virtual.copy() + force.reshape(2,6)[:,3:]/=length;virtual.reshape(2,6)[:,3:]/=length + if not np.isfinite(force).all() or not np.isfinite(virtual).all(): + raise ValueError("normalized sectional virtual work not representable") + magnitude=max(float(np.max(abs(force))),float(np.max(abs(virtual)))) + # One common magnitude keeps all norms finite and introduces no unit floor. + f=force/magnitude if magnitude else force;v=virtual/magnitude if magnitude else virtual + denominator=np.linalg.norm(f)+np.linalg.norm(v) + if np.linalg.norm(f-v) > 1e-10*denominator: + raise ValueError("sectional first virtual work disagrees with physical force-flexibility trace") + return made + +def point_green_hessian(law, vertices, member, station, offset, multiplier): + from ._ge_beam3_pose_joint import RigidPoseJoint + width=law.shell_port.shape[1]; r=vertices-vertices.mean(axis=0) + gram=sum((_cross_matrix(x).T@_cross_matrix(x) for x in r),np.zeros((3,3))) + shell_h=np.zeros((6,width,width)); eye=np.eye(width) + omega=law.shell_port[3:].T + translations=np.stack([eye[6*i:6*i+3].T for i in range(len(r))]) + translations-=translations.mean(axis=0) + for a in range(width): + for b in range(width): + rhs=np.zeros(3) + for i,x in enumerate(r): + rhs += np.cross(np.cross(omega[a],x),translations[i,b])+np.cross(np.cross(omega[b],x),translations[i,a]) + rhs += np.cross(.5*(np.cross(omega[a],np.cross(omega[b],x))+np.cross(omega[b],np.cross(omega[a],x))),x) + shell_h[3:,a,b]=np.linalg.solve(gram,rhs) + j,_,h,_=beam_reference_derivatives(member.operator,float(station)) + d=np.asarray(offset,dtype=float); local_h=h.copy() + for a in range(12): + for b in range(12): + local_h[:3,a,b] += np.cross(h[3:,a,b],d)+.5*(np.cross(j[3:,a],np.cross(j[3:,b],d))+np.cross(j[3:,b],np.cross(j[3:,a],d))) + frame=member.definition.local_frame_rows().T; transform=member.local_dof_map() + beam_h=np.einsum('ij,jab,ak,bl->ikl',np.kron(np.eye(2),frame),local_h,transform,transform) + port=np.zeros((12,width+12));port[:6,:width]=law.shell_port;port[6:,width:]=law.beam_port + curvature=np.zeros((12,width+12,width+12));curvature[:6,:width,:width]=shell_h;curvature[6:,width:,width:]=beam_h + joint=RigidPoseJoint(np.stack((law.shell_reference_m,law.beam_reference_m)),law.reference_frames) + response=joint.evaluate(np.stack((law.shell_reference_m,law.beam_reference_m)),law.reference_frames,np.asarray(multiplier)) + return port.T@response.chart_hessian[:12,:12]@port+np.einsum('i,iab->ab',response.residual[:12],curvature) + +@dataclass(frozen=True) +class B2PhysicalFootprintBucklingRequest(B2ReferenceBucklingRequest): + """Opt-in five-row Q4 physical rigid-footprint spectral operation.""" + +@dataclass(frozen=True) +class B2PhysicalFootprintBucklingResult(B2ReferenceBucklingResult): + policy: str = "B2_PHYSICAL_RIGID_FOOTPRINT_GREEN_BUCKLING_V1_DEV" + +def physical_footprint_capabilities(owner): + from ._stiffened_shell_b2_physical_rigid_footprint import BUCKLING_POLICY + reasons=[] + if not getattr(owner,"_physical_footprint_law",False): reasons.append("physical footprint family required") + if owner._closed: reasons.append("owner closed") + if owner.point_ids: reasons.append("mixed POINT / physical footprint spectral operation unavailable") + if np.any(owner._u0 != 0.): reasons.append("prescribed prestress split unavailable") if any(len(shell.node_ids)!=4 for shell,*_ in owner._buckling_shells): reasons.append("S3/mixed physical footprint buckling unsupported; Q4 director chart required") - return B2ReferenceBucklingCapabilities(not reasons,tuple(reasons),policy=BUCKLING_POLICY, - scope="zero-prescription Cartesian dead-force Q4 endpoint complete physical rigid footprints",shell_kernel_policies=(Q4_KERNEL_POLICY+":NATIVE_PHYSICAL_EXP_DIRECTOR_FIRST_WORK_PULLBACK",)) - -def capabilities(owner): - reasons=[] - if owner._closed: reasons.append("owner closed") - if owner._modal_only: reasons.append("modal-only boundary") - if owner.footprints: reasons.append("footprint second variation unavailable") - if owner._point_trace_policy is not None: reasons.append("loaded point trace unavailable") - if np.any(owner._u0 != 0.): reasons.append("prescribed prestress split unavailable") - if any(point.station not in (0.,1.) for point,*_ in owner._buckling_points): reasons.append("interior loaded port unavailable") - kernels=tuple(sorted({S3_KERNEL_POLICY if len(shell.node_ids)==3 else Q4_KERNEL_POLICY for shell,*_ in owner._buckling_shells})) - return B2ReferenceBucklingCapabilities(not reasons,tuple(reasons),shell_kernel_policies=kernels) - -def _shell_resultants(owner, element, material, displacement, count): - mesh=owner._buckling_model.mesh - if count == 3: - recovered=element.compute_variational_resultants(mesh,displacement,material) - else: - recovered=element.compute_stresses(mesh,displacement,material) - return np.column_stack((recovered["membrane_resultants"],recovered["bending_resultants"],recovered["transverse_shear_resultants"])) - -def compile_geometric(owner, request, preload, safe_point=lambda stage: None): - """Assemble tensile-sign G; all constraint coordinates remain algebraic.""" - from ._stiffened_shell_b2_q4_panel_experimental import _scatter - displacement=np.asarray(preload.displacements); multipliers=dict(preload.point_multipliers) - sources={source.member_id:source for source in request.section_tractions} - rows=[];cols=[];values=[];provenance=[] - for member_id,(member,slots) in owner._members: - safe_point("buckling member initial stress") - transform=member.local_dof_map() - local=member_green_hessian(member,transform@displacement[slots],sources[member_id]) - _scatter(rows,cols,values,slots,transform.T@local@transform) - provenance.append((member_id,sources[member_id].identity)) - for shell,element,material_id,slots in owner._buckling_shells: - safe_point("buckling shell preload recovery") - material=owner._buckling_model.get_material(material_id) - count=len(shell.node_ids); local_u=displacement[slots] - recovered=_shell_resultants(owner,element,material,local_u,count) - if not np.isfinite(recovered).all(): raise ValueError("nonfinite shell preload recovery") - # Initially require exact zero forbidden resultants; no dimensional - # floors or specimen-adjusted arithmetic tolerance conceal prestress. - if np.any(recovered[:,6:] != 0.): raise ValueError("shell transverse-shear prestress unsupported") - if count == 3: - if np.any(recovered[:,3:6] != 0.): raise ValueError("S3 bending prestress unsupported") - if not np.array_equal(recovered[:,:3],np.broadcast_to(recovered[0,:3],recovered[:,:3].shape)): - raise ValueError("S3 nonuniform membrane preload unsupported") - state={"membrane_compression":-recovered[0,:3]} - kernel_policy=S3_KERNEL_POLICY - else: - from ._stiffened_shell_b2_physical_rigid_footprint import q4_kernel_frame_resultants - kernel_resultants=q4_kernel_frame_resultants(element,owner._buckling_model.mesh,material,local_u,recovered) - state={"membrane_compression_at_gauss":-kernel_resultants[:,:3], - "bending_compression_at_gauss":-kernel_resultants[:,3:6], - "stress_second_moment_at_gauss":-kernel_resultants[:,:3]*shell.thickness_m**2/12.} - kernel_policy=Q4_KERNEL_POLICY - # Existing shell KG uses compression positive; convert exactly once. - local=-element.compute_geometric_stiffness_matrix(owner._buckling_model.mesh,material,state) - if getattr(owner,"_physical_footprint_law",False): - from ._stiffened_shell_b2_physical_rigid_footprint import q4_exp_director_chart_correction - local=local+q4_exp_director_chart_correction(element,owner._buckling_model.mesh,material,local_u) - kernel_policy += ":NATIVE_PHYSICAL_EXP_DIRECTOR_FIRST_WORK_PULLBACK" - _scatter(rows,cols,values,slots,local) - provenance.append((shell.shell_id,kernel_policy,hashlib.sha256(recovered.tobytes()).hexdigest())) - for point,law,vertices,member,slots in owner._buckling_points: - safe_point("buckling point multiplier curvature") - local=point_green_hessian(law,vertices,member,point.station,point.offset_local_m,multipliers[point.point_id]) - _scatter(rows,cols,values,slots,local) - if getattr(owner,"_physical_footprint_law",False): - all_lambda=np.asarray(preload.constraint_multipliers) - for item in owner._footprint_incidence: - safe_point("buckling physical footprint multiplier curvature") - slots=tuple(item.shell_slots)+tuple(item.beam_slots) - local=item.multiplier_hessian(all_lambda[item.row_start:item.row_start+5]) - _scatter(rows,cols,values,slots,local) - provenance.append((item.footprint_id,item.shell_node,"physical_director_five_row",hashlib.sha256(item.constraint_hessians.tobytes()).hexdigest())) - g=sparse.coo_matrix((values,(rows,cols)),shape=owner._K.shape).tocsr() - if not np.isfinite(g.data).all(): raise ValueError("initial-stress assembly not representable") - digest=hashlib.sha256((POLICY+PORT_POLICY+repr(provenance)).encode()) - digest.update(owner._body_model_identity.encode()) - for matrix in (owner._K,owner._C,owner._T,g): - for a in (matrix.indptr,matrix.indices,matrix.data): digest.update(a.tobytes()) - digest.update(np.asarray(request.preload).tobytes()) - return g,digest.hexdigest() - -def solve(owner, request, *, cancellation=None): - from .control import CancellationToken,SolveCancelled - from .linalg import factorize_cached,MatrixClass - from ._stiffened_shell_b2_q4_panel_experimental import _scaled_point_kkt,_modal_scaled_residual - physical=type(request) is B2PhysicalFootprintBucklingRequest - if type(request) not in (B2ReferenceBucklingRequest,B2PhysicalFootprintBucklingRequest): raise ValueError("typed physical B2 reference-buckling request required") - result_type=B2PhysicalFootprintBucklingResult if physical else B2ReferenceBucklingResult - admission=physical_footprint_capabilities(owner) if physical else capabilities(owner) - if not admission.eligible: raise ValueError("; ".join(admission.reasons)) - load=np.asarray(request.preload) - if load.shape != owner._u0.shape or np.any(load.reshape(-1,6)[:,3:] != 0.): raise ValueError("Cartesian dead nodal forces only; rotational couples unsupported") - if {s.member_id for s in request.section_tractions} != {m for m,_ in owner._members}: raise ValueError("explicit physical traction source for every member required") - if cancellation is not None and not isinstance(cancellation,CancellationToken): raise ValueError("CancellationToken required") - n=owner._T.shape[1];q=owner._C.shape[0] - if request.count >= min(n-q,n+q-1): raise ValueError("buckling count exceeds supported sparse spectrum") - def safe(stage): - if cancellation is not None: cancellation.checkpoint(stage) - preload=None;identity="" - try: - safe("buckling before reference preload") - preload=owner.solve_linear(load) - safe("buckling after reference preload") - if preload.status != "completed": - return result_type("failed",preload_result=preload, - failure_reason="reference preload status "+str(preload.status)+": "+str(preload.failure_reason)) - g,identity=compile_geometric(owner,request,preload,safe) - k=(owner._T.T@owner._K@owner._T).tocsc(); c=(owner._C@owner._T).tocsc() - destabilizing=-(owner._T.T@g@owner._T).tocsc() - a=sparse.bmat(((k,c.T),(c,None)),format="csc") - b=sparse.block_diag((destabilizing,sparse.csc_matrix((q,q))),format="csc") - # Positive coordinate normalization belongs to reference K/C only. - # A valid shifted indefinite pencil must never face the static guard. - _,scale=_scaled_point_kkt(k,c) - b.eliminate_zeros();b.sort_indices() - scaling=sparse.diags(scale,format="csc");bs=(scaling@b@scaling).tocsc();bs.eliminate_zeros();bs.sort_indices() - if (not np.isfinite(bs.data).all() or b.nnz != bs.nnz or - not np.array_equal(b.indptr,bs.indptr) or not np.array_equal(b.indices,bs.indices) or - np.any((b.data != 0.) & (bs.data == 0.))): raise _BucklingNumericalFailure("buckling scaling loses nonzero entries") - raw_shifted=(a-request.shift*b).tocsc();raw_shifted.eliminate_zeros();raw_shifted.sort_indices() - shifted=(scaling@raw_shifted@scaling).tocsc();shifted.eliminate_zeros();shifted.sort_indices() - if (not np.isfinite(shifted.data).all() or shifted.nnz!=raw_shifted.nnz or - not np.array_equal(shifted.indptr,raw_shifted.indptr) or not np.array_equal(shifted.indices,raw_shifted.indices) or - np.any((raw_shifted.data!=0.)&(shifted.data==0.))): - raise _BucklingNumericalFailure("shifted buckling scaling loses nonzero entries") - safe("buckling before factorization") - handle=factorize_cached(shifted,MatrixClass.GENERAL) - if handle.status != "ok": raise _BucklingNumericalFailure("buckling factorization failed: "+str(handle.failure_reason)) - def action(v): - safe("buckling iteration") - try: - answer=np.asarray(handle.solve(bs@v)) - except RuntimeError as exc: - if (str(exc) == "Sparse solve produced NaN/Inf values" or - str(exc).startswith("Cannot solve with failed factorization:")): - raise _BucklingNumericalFailure("buckling sparse solve failed: "+str(exc)) from exc - raise - if not np.isfinite(answer).all(): raise _BucklingNumericalFailure("nonfinite buckling inverse action") - return answer - eigvalues,vectors=eigs(LinearOperator(a.shape,matvec=action,dtype=float),k=request.count,which="LM",v0=np.sin(np.arange(a.shape[0])+.23),tol=1e-11,maxiter=request.max_iterations) - modes=[] - for mu,y in zip(eigvalues,vectors.T): - if not np.isfinite(mu) or abs(mu.imag)>1e-9*abs(mu.real) or mu.real == 0. or np.linalg.norm(y.imag)>1e-9*np.linalg.norm(y.real): raise _BucklingNumericalFailure("unresolved buckling pair") - lam=request.shift+1./mu.real - if not np.isfinite(lam) or lam <= 0.: raise _BucklingNumericalFailure("requested shift selected nonpositive buckling factor") - x=scale*y.real;physical=np.asarray(owner._T@x[:n]);norm=np.linalg.norm(physical) - if not np.isfinite(norm) or norm == 0.: raise _BucklingNumericalFailure("invalid physical buckling mode") - x/=norm;physical/=norm - residual=a@x-lam*(b@x);bound=abs(a)@abs(x)+abs(lam)*(abs(b)@abs(x)) - equation=_modal_scaled_residual(residual,bound,scale) - constraint=_modal_scaled_residual(owner._C@physical,abs(owner._C)@abs(physical),scale[n:]) - balance=owner._K@physical+owner._C.T@x[n:]+lam*(g@physical) - physical_bound=abs(owner._K)@abs(physical)+abs(owner._C.T)@abs(x[n:])+abs(lam)*(abs(g)@abs(physical)) - equation=max(equation,_modal_scaled_residual(owner._project(balance),abs(owner._T.T)@physical_bound,scale[:n])) - if equation>1e-8 or constraint>1e-9: raise _BucklingNumericalFailure("buckling physical equation or constraint residual failed") - modes.append((float(lam),tuple(physical),tuple(x[n:]),equation,constraint)) - modes.sort(key=lambda item:item[0]);safe("buckling before publication") - return result_type("ok",*(tuple(m[i] for m in modes) for i in range(5)),preload,identity) - except SolveCancelled as exc: - return result_type("cancelled",preload_result=preload,identity=identity,failure_reason=str(exc)) - except (ArpackError,_BucklingNumericalFailure) as exc: - return result_type("failed",preload_result=preload,identity=identity,failure_reason=str(exc)) + return B2ReferenceBucklingCapabilities(not reasons,tuple(reasons),policy=BUCKLING_POLICY, + scope="zero-prescription Cartesian dead-force Q4 endpoint complete physical rigid footprints",shell_kernel_policies=(Q4_KERNEL_POLICY+":NATIVE_PHYSICAL_EXP_DIRECTOR_FIRST_WORK_PULLBACK",)) + +def capabilities(owner): + reasons=[] + if owner._closed: reasons.append("owner closed") + if owner._modal_only: reasons.append("modal-only boundary") + if owner.footprints: reasons.append("footprint second variation unavailable") + if owner._point_trace_policy is not None: reasons.append("loaded point trace unavailable") + if np.any(owner._u0 != 0.): reasons.append("prescribed prestress split unavailable") + if any(point.station not in (0.,1.) for point,*_ in owner._buckling_points): reasons.append("interior loaded port unavailable") + kernels=tuple(sorted({S3_KERNEL_POLICY if len(shell.node_ids)==3 else Q4_KERNEL_POLICY for shell,*_ in owner._buckling_shells})) + return B2ReferenceBucklingCapabilities(not reasons,tuple(reasons),shell_kernel_policies=kernels) + +def _shell_resultants(owner, element, material, displacement, count): + mesh=owner._buckling_model.mesh + if count == 3: + recovered=element.compute_variational_resultants(mesh,displacement,material) + else: + recovered=element.compute_stresses(mesh,displacement,material) + return np.column_stack((recovered["membrane_resultants"],recovered["bending_resultants"],recovered["transverse_shear_resultants"])) + +def compile_geometric(owner, request, preload, safe_point=lambda stage: None): + """Assemble tensile-sign G; all constraint coordinates remain algebraic.""" + from ._stiffened_shell_b2_q4_panel_experimental import _scatter + displacement=np.asarray(preload.displacements); multipliers=dict(preload.point_multipliers) + sources={source.member_id:source for source in request.section_tractions} + rows=[];cols=[];values=[];provenance=[] + for member_id,(member,slots) in owner._members: + safe_point("buckling member initial stress") + transform=member.local_dof_map() + local=member_green_hessian(member,transform@displacement[slots],sources[member_id]) + _scatter(rows,cols,values,slots,transform.T@local@transform) + provenance.append((member_id,sources[member_id].identity)) + for shell,element,material_id,slots in owner._buckling_shells: + safe_point("buckling shell preload recovery") + material=owner._buckling_model.get_material(material_id) + count=len(shell.node_ids); local_u=displacement[slots] + recovered=_shell_resultants(owner,element,material,local_u,count) + if not np.isfinite(recovered).all(): raise ValueError("nonfinite shell preload recovery") + # Initially require exact zero forbidden resultants; no dimensional + # floors or specimen-adjusted arithmetic tolerance conceal prestress. + if np.any(recovered[:,6:] != 0.): raise ValueError("shell transverse-shear prestress unsupported") + if count == 3: + if np.any(recovered[:,3:6] != 0.): raise ValueError("S3 bending prestress unsupported") + if not np.array_equal(recovered[:,:3],np.broadcast_to(recovered[0,:3],recovered[:,:3].shape)): + raise ValueError("S3 nonuniform membrane preload unsupported") + state={"membrane_compression":-recovered[0,:3]} + kernel_policy=S3_KERNEL_POLICY + else: + from ._stiffened_shell_b2_physical_rigid_footprint import q4_kernel_frame_resultants + kernel_resultants=q4_kernel_frame_resultants(element,owner._buckling_model.mesh,material,local_u,recovered) + state={"membrane_compression_at_gauss":-kernel_resultants[:,:3], + "bending_compression_at_gauss":-kernel_resultants[:,3:6], + "stress_second_moment_at_gauss":-kernel_resultants[:,:3]*shell.thickness_m**2/12.} + kernel_policy=Q4_KERNEL_POLICY + # Existing shell KG uses compression positive; convert exactly once. + local=-element.compute_geometric_stiffness_matrix(owner._buckling_model.mesh,material,state) + if getattr(owner,"_physical_footprint_law",False): + from ._stiffened_shell_b2_physical_rigid_footprint import q4_exp_director_chart_correction + local=local+q4_exp_director_chart_correction(element,owner._buckling_model.mesh,material,local_u) + kernel_policy += ":NATIVE_PHYSICAL_EXP_DIRECTOR_FIRST_WORK_PULLBACK" + _scatter(rows,cols,values,slots,local) + provenance.append((shell.shell_id,kernel_policy,hashlib.sha256(recovered.tobytes()).hexdigest())) + for point,law,vertices,member,slots in owner._buckling_points: + safe_point("buckling point multiplier curvature") + local=point_green_hessian(law,vertices,member,point.station,point.offset_local_m,multipliers[point.point_id]) + _scatter(rows,cols,values,slots,local) + if getattr(owner,"_physical_footprint_law",False): + all_lambda=np.asarray(preload.constraint_multipliers) + for item in owner._footprint_incidence: + safe_point("buckling physical footprint multiplier curvature") + slots=tuple(item.shell_slots)+tuple(item.beam_slots) + local=item.multiplier_hessian(all_lambda[item.row_start:item.row_start+5]) + _scatter(rows,cols,values,slots,local) + provenance.append((item.footprint_id,item.shell_node,"physical_director_five_row",hashlib.sha256(item.constraint_hessians.tobytes()).hexdigest())) + g=sparse.coo_matrix((values,(rows,cols)),shape=owner._K.shape).tocsr() + if not np.isfinite(g.data).all(): raise ValueError("initial-stress assembly not representable") + digest=hashlib.sha256((POLICY+PORT_POLICY+repr(provenance)).encode()) + digest.update(owner._body_model_identity.encode()) + for matrix in (owner._K,owner._C,owner._T,g): + for a in (matrix.indptr,matrix.indices,matrix.data): digest.update(a.tobytes()) + digest.update(np.asarray(request.preload).tobytes()) + return g,digest.hexdigest() + +def solve(owner, request, *, cancellation=None): + from .control import CancellationToken,SolveCancelled + from .linalg import factorize_cached,MatrixClass + from ._stiffened_shell_b2_q4_panel_experimental import _scaled_point_kkt,_modal_scaled_residual + physical=type(request) is B2PhysicalFootprintBucklingRequest + if type(request) not in (B2ReferenceBucklingRequest,B2PhysicalFootprintBucklingRequest): raise ValueError("typed physical B2 reference-buckling request required") + result_type=B2PhysicalFootprintBucklingResult if physical else B2ReferenceBucklingResult + admission=physical_footprint_capabilities(owner) if physical else capabilities(owner) + if not admission.eligible: raise ValueError("; ".join(admission.reasons)) + load=np.asarray(request.preload) + if load.shape != owner._u0.shape or np.any(load.reshape(-1,6)[:,3:] != 0.): raise ValueError("Cartesian dead nodal forces only; rotational couples unsupported") + if {s.member_id for s in request.section_tractions} != {m for m,_ in owner._members}: raise ValueError("explicit physical traction source for every member required") + if cancellation is not None and not isinstance(cancellation,CancellationToken): raise ValueError("CancellationToken required") + n=owner._T.shape[1];q=owner._C.shape[0] + if request.count >= min(n-q,n+q-1): raise ValueError("buckling count exceeds supported sparse spectrum") + def safe(stage): + if cancellation is not None: cancellation.checkpoint(stage) + preload=None;identity="" + try: + safe("buckling before reference preload") + preload=owner.solve_linear(load) + safe("buckling after reference preload") + if preload.status != "completed": + return result_type("failed",preload_result=preload, + failure_reason="reference preload status "+str(preload.status)+": "+str(preload.failure_reason)) + g,identity=compile_geometric(owner,request,preload,safe) + k=(owner._T.T@owner._K@owner._T).tocsc(); c=(owner._C@owner._T).tocsc() + destabilizing=-(owner._T.T@g@owner._T).tocsc() + a=sparse.bmat(((k,c.T),(c,None)),format="csc") + b=sparse.block_diag((destabilizing,sparse.csc_matrix((q,q))),format="csc") + # Positive coordinate normalization belongs to reference K/C only. + # A valid shifted indefinite pencil must never face the static guard. + _,scale=_scaled_point_kkt(k,c) + b.eliminate_zeros();b.sort_indices() + scaling=sparse.diags(scale,format="csc");bs=(scaling@b@scaling).tocsc();bs.eliminate_zeros();bs.sort_indices() + if (not np.isfinite(bs.data).all() or b.nnz != bs.nnz or + not np.array_equal(b.indptr,bs.indptr) or not np.array_equal(b.indices,bs.indices) or + np.any((b.data != 0.) & (bs.data == 0.))): raise _BucklingNumericalFailure("buckling scaling loses nonzero entries") + raw_shifted=(a-request.shift*b).tocsc();raw_shifted.eliminate_zeros();raw_shifted.sort_indices() + shifted=(scaling@raw_shifted@scaling).tocsc();shifted.eliminate_zeros();shifted.sort_indices() + if (not np.isfinite(shifted.data).all() or shifted.nnz!=raw_shifted.nnz or + not np.array_equal(shifted.indptr,raw_shifted.indptr) or not np.array_equal(shifted.indices,raw_shifted.indices) or + np.any((raw_shifted.data!=0.)&(shifted.data==0.))): + raise _BucklingNumericalFailure("shifted buckling scaling loses nonzero entries") + safe("buckling before factorization") + handle=factorize_cached(shifted,MatrixClass.GENERAL) + if handle.status != "ok": raise _BucklingNumericalFailure("buckling factorization failed: "+str(handle.failure_reason)) + def action(v): + safe("buckling iteration") + try: + answer=np.asarray(handle.solve(bs@v)) + except RuntimeError as exc: + if (str(exc) == "Sparse solve produced NaN/Inf values" or + str(exc).startswith("Cannot solve with failed factorization:")): + raise _BucklingNumericalFailure("buckling sparse solve failed: "+str(exc)) from exc + raise + if not np.isfinite(answer).all(): raise _BucklingNumericalFailure("nonfinite buckling inverse action") + return answer + eigvalues,vectors=eigs(LinearOperator(a.shape,matvec=action,dtype=float),k=request.count,which="LM",v0=np.sin(np.arange(a.shape[0])+.23),tol=1e-11,maxiter=request.max_iterations) + modes=[] + for mu,y in zip(eigvalues,vectors.T): + if not np.isfinite(mu) or abs(mu.imag)>1e-9*abs(mu.real) or mu.real == 0. or np.linalg.norm(y.imag)>1e-9*np.linalg.norm(y.real): raise _BucklingNumericalFailure("unresolved buckling pair") + lam=request.shift+1./mu.real + if not np.isfinite(lam) or lam <= 0.: raise _BucklingNumericalFailure("requested shift selected nonpositive buckling factor") + x=scale*y.real;physical=np.asarray(owner._T@x[:n]);norm=np.linalg.norm(physical) + if not np.isfinite(norm) or norm == 0.: raise _BucklingNumericalFailure("invalid physical buckling mode") + x/=norm;physical/=norm + residual=a@x-lam*(b@x);bound=abs(a)@abs(x)+abs(lam)*(abs(b)@abs(x)) + equation=_modal_scaled_residual(residual,bound,scale) + constraint=_modal_scaled_residual(owner._C@physical,abs(owner._C)@abs(physical),scale[n:]) + balance=owner._K@physical+owner._C.T@x[n:]+lam*(g@physical) + physical_bound=abs(owner._K)@abs(physical)+abs(owner._C.T)@abs(x[n:])+abs(lam)*(abs(g)@abs(physical)) + equation=max(equation,_modal_scaled_residual(owner._project(balance),abs(owner._T.T)@physical_bound,scale[:n])) + if equation>1e-8 or constraint>1e-9: raise _BucklingNumericalFailure("buckling physical equation or constraint residual failed") + modes.append((float(lam),tuple(physical),tuple(x[n:]),equation,constraint)) + modes.sort(key=lambda item:item[0]);safe("buckling before publication") + return result_type("ok",*(tuple(m[i] for m in modes) for i in range(5)),preload,identity) + except SolveCancelled as exc: + return result_type("cancelled",preload_result=preload,identity=identity,failure_reason=str(exc)) + except (ArpackError,_BucklingNumericalFailure) as exc: + return result_type("failed",preload_result=preload,identity=identity,failure_reason=str(exc)) diff --git a/src/anyfesolver/_stiffened_shell_beam_history.py b/src/anyfesolver/_stiffened_shell_beam_history.py index a8df57bf5..122044a5d 100644 --- a/src/anyfesolver/_stiffened_shell_beam_history.py +++ b/src/anyfesolver/_stiffened_shell_beam_history.py @@ -1,20 +1,20 @@ -"""Model-bound native beam histories for the experimental mixed owner. - -Offsets and identities come only from compiled beam cells. Both halves of -every compensated history value are preserved; no constitutive update occurs -while packing or reconstructing a history. -""" -from decimal import localcontext - -import numpy as np - -from ._ge_beam3_fibre_cell import CellHistory -from ._ge_beam3_fibre_section import FibreHistory, PhysicalFibreSection -from ._ge_beam3_generalized_cell import GeneralizedCellHistory +"""Model-bound native beam histories for the experimental mixed owner. + +Offsets and identities come only from compiled beam cells. Both halves of +every compensated history value are preserved; no constitutive update occurs +while packing or reconstructing a history. +""" +from decimal import localcontext + +import numpy as np + +from ._ge_beam3_fibre_cell import CellHistory +from ._ge_beam3_fibre_section import FibreHistory, PhysicalFibreSection +from ._ge_beam3_generalized_cell import GeneralizedCellHistory from ._ge_beam3_generalized_ellipsoid_section import GeneralizedHistory, EllipsoidalGeneralizedSection -def compensated_kind(parts, *, coupled=False): +def compensated_kind(parts, *, coupled=False): """Exact compiled member families; the owner identity binds their order/laws.""" from ._stiffened_shell_f06_increment_arithmetic import POLICY families = [] @@ -30,78 +30,78 @@ def compensated_kind(parts, *, coupled=False): if not families: raise ValueError('complete compensated native member inventory required') family = families[0] if len(set(families)) == 1 else 'mixed' - return 'finite_compensated_'+family+('_coupled' if coupled else '_material') - - -def shapes(parts, prefix): - generalized = sum(len(e.operator.cell.stations) for e, _, _ in parts - if type(e.section) is not PhysicalFibreSection) - fibres = sum(len(e.operator.cell.stations)*len(e.section.fibres) - for e, _, _ in parts if type(e.section) is PhysicalFibreSection) - return ((prefix+"_plastic", (generalized, 6, 2)), - (prefix+"_accumulated", (generalized, 2)), - (prefix+"_fibres", (fibres, 4))) - - -def arrays(parts, histories, prefix): - if type(histories) is not tuple or len(histories) != len(parts): - raise ValueError("complete native beam histories required") - result = {name: np.empty(shape) for name, shape in shapes(parts, prefix)} - gi = fi = 0 - with localcontext() as context: - context.prec = 80 - for (element, _, _), history in zip(parts, histories): - element.operator.cell._origins(history) - for station in history.stations: - if type(element.section) is PhysicalFibreSection: - count = len(element.section.fibres) - result[prefix+"_fibres"][fi:fi+count] = station.rows - fi += count - else: - result[prefix+"_plastic"][gi] = station.plastic - result[prefix+"_accumulated"][gi] = station.accumulated - gi += 1 - return tuple(result.items()) - - -def histories(parts, values, prefix): - captured = {} - for name, shape in shapes(parts, prefix): - value = np.array(values[name], dtype=float, copy=True) - if value.shape != shape or not np.isfinite(value).all(): - raise ValueError("complete finite model-bound native history required") - captured[name] = value - gi = fi = 0 - result = [] - with localcontext() as context: - context.prec = 80 - for element, _, _ in parts: - cell = element.operator.cell - stations = [] - physical = type(element.section) is PhysicalFibreSection - for _ in cell.stations: - if physical: - count = len(element.section.fibres) - rows = tuple(tuple(map(float, row)) for row in - captured[prefix+"_fibres"][fi:fi+count]) - stations.append(FibreHistory(element.section.identity, rows)) - fi += count - else: - stations.append(GeneralizedHistory(element.section.identity, - tuple(tuple(map(float, row)) for row in - captured[prefix+"_plastic"][gi]), - tuple(map(float, captured[prefix+"_accumulated"][gi])))) - gi += 1 - history = (CellHistory if physical else GeneralizedCellHistory)( - cell.identity, tuple(stations)) - cell._origins(history) - result.append(history) - return tuple(result) - - -def observables(histories): - """Generalized accumulated strain, or maximum fibre accumulation per station.""" - return tuple(tuple( - max((float(row[2]+row[3]) for row in station.rows), default=0.) - if type(station) is FibreHistory else float(sum(station.accumulated)) - for station in history.stations) for history in histories) + return 'finite_compensated_'+family+('_coupled' if coupled else '_material') + + +def shapes(parts, prefix): + generalized = sum(len(e.operator.cell.stations) for e, _, _ in parts + if type(e.section) is not PhysicalFibreSection) + fibres = sum(len(e.operator.cell.stations)*len(e.section.fibres) + for e, _, _ in parts if type(e.section) is PhysicalFibreSection) + return ((prefix+"_plastic", (generalized, 6, 2)), + (prefix+"_accumulated", (generalized, 2)), + (prefix+"_fibres", (fibres, 4))) + + +def arrays(parts, histories, prefix): + if type(histories) is not tuple or len(histories) != len(parts): + raise ValueError("complete native beam histories required") + result = {name: np.empty(shape) for name, shape in shapes(parts, prefix)} + gi = fi = 0 + with localcontext() as context: + context.prec = 80 + for (element, _, _), history in zip(parts, histories): + element.operator.cell._origins(history) + for station in history.stations: + if type(element.section) is PhysicalFibreSection: + count = len(element.section.fibres) + result[prefix+"_fibres"][fi:fi+count] = station.rows + fi += count + else: + result[prefix+"_plastic"][gi] = station.plastic + result[prefix+"_accumulated"][gi] = station.accumulated + gi += 1 + return tuple(result.items()) + + +def histories(parts, values, prefix): + captured = {} + for name, shape in shapes(parts, prefix): + value = np.array(values[name], dtype=float, copy=True) + if value.shape != shape or not np.isfinite(value).all(): + raise ValueError("complete finite model-bound native history required") + captured[name] = value + gi = fi = 0 + result = [] + with localcontext() as context: + context.prec = 80 + for element, _, _ in parts: + cell = element.operator.cell + stations = [] + physical = type(element.section) is PhysicalFibreSection + for _ in cell.stations: + if physical: + count = len(element.section.fibres) + rows = tuple(tuple(map(float, row)) for row in + captured[prefix+"_fibres"][fi:fi+count]) + stations.append(FibreHistory(element.section.identity, rows)) + fi += count + else: + stations.append(GeneralizedHistory(element.section.identity, + tuple(tuple(map(float, row)) for row in + captured[prefix+"_plastic"][gi]), + tuple(map(float, captured[prefix+"_accumulated"][gi])))) + gi += 1 + history = (CellHistory if physical else GeneralizedCellHistory)( + cell.identity, tuple(stations)) + cell._origins(history) + result.append(history) + return tuple(result) + + +def observables(histories): + """Generalized accumulated strain, or maximum fibre accumulation per station.""" + return tuple(tuple( + max((float(row[2]+row[3]) for row in station.rows), default=0.) + if type(station) is FibreHistory else float(sum(station.accumulated)) + for station in history.stations) for history in histories) diff --git a/src/anyfesolver/_stiffened_shell_f06_increment_arithmetic.py b/src/anyfesolver/_stiffened_shell_f06_increment_arithmetic.py index bbba9aff5..7e3f7b757 100644 --- a/src/anyfesolver/_stiffened_shell_f06_increment_arithmetic.py +++ b/src/anyfesolver/_stiffened_shell_f06_increment_arithmetic.py @@ -1,205 +1,205 @@ -"""Opt-in binary64 expansion arithmetic for durable native state and work. - -Two components retain roundoff information; no decimal/extended-precision -backend, projection, altered mechanical equation or empirical stabilization. -""" -import math -import numpy as np -POLICY='GE_BEAM3_DURABLE_COMPENSATED_NATIVE_STATE_V1_DEV' -MAGIC=b'ANYF06DD1\0' - - -def two_sum(a,b): - h=a+b;v=h-a - return h,(a-(h-v))+(b-v) - -def two_product(a,b): - h=a*b;split=134217729. - ca=split*a;cb=split*b - ah=ca-(ca-a);al=a-ah;bh=cb-(cb-b);bl=b-bh - return h,((ah*bh-h)+ah*bl+al*bh)+al*bl - -class Pair: - __array_priority__=1000 - def __init__(self,high,low=0.): - self.high,self.low=two_sum(np.asarray(high,dtype=float),np.asarray(low,dtype=float)) - if not np.isfinite(self.high).all() or not np.isfinite(self.low).all(): - raise ValueError('finite representable compensated native values required') - @staticmethod - def make(value):return value if isinstance(value,Pair) else Pair(value) - def __add__(self,other): - b=self.make(other);h,l=two_sum(self.high,b.high) - return Pair(h,l+self.low+b.low) - __radd__=__add__ - def __neg__(self):return Pair(-self.high,-self.low) - def __sub__(self,other):return self+-self.make(other) - def __rsub__(self,other):return self.make(other)+-self - def __mul__(self,other): - b=self.make(other);h,l=two_product(self.high,b.high) - return Pair(h,l+self.high*b.low+self.low*b.high+self.low*b.low) - __rmul__=__mul__ - def reciprocal(self): - if np.any(self.high==0.):raise ValueError('singular compensated native reciprocal') - q=Pair(1./self.high) - return q+(1.-self*q)*(1./self.high) - def __truediv__(self,other):return self*self.make(other).reciprocal() - def __rtruediv__(self,other):return self.make(other)*self.reciprocal() - def __getitem__(self,index):return Pair(self.high[index],self.low[index]) - @property - def T(self):return Pair(self.high.T,self.low.T) - def rounded(self):return self.high+self.low - def scalar(self):return float(self.high)+float(self.low) - -def outer(a,b):return Pair(a.high[:,None],a.low[:,None])*Pair(b.high[None,:],b.low[None,:]) - -class Jet: - def __init__(self,value,gradient,hessian): - self.value=Pair.make(value);self.gradient=Pair.make(gradient);self.hessian=Pair.make(hessian) - @classmethod - def constant(cls,value,size):return cls(value,Pair(np.zeros(size)),Pair(np.zeros((size,size)))) - @classmethod - def variable(cls,value,index,size): - g=np.zeros(size);g[index]=1. - return cls(value,Pair(g),Pair(np.zeros((size,size)))) - def make(self,value):return value if isinstance(value,Jet) else Jet.constant(value,self.gradient.high.size) - def __add__(self,other): - b=self.make(other);return Jet(self.value+b.value,self.gradient+b.gradient,self.hessian+b.hessian) - __radd__=__add__ - def __neg__(self):return Jet(-self.value,-self.gradient,-self.hessian) - def __sub__(self,other):return self+-self.make(other) - def __rsub__(self,other):return self.make(other)+-self - def __mul__(self,other): - b=self.make(other) - return Jet(self.value*b.value,self.gradient*b.value+self.value*b.gradient, - self.hessian*b.value+self.value*b.hessian+outer(self.gradient,b.gradient)+outer(b.gradient,self.gradient)) - __rmul__=__mul__ - def __truediv__(self,other): - if isinstance(other,Jet): - r=other.value.reciprocal();return self*unary(other,r,-r*r,2*r*r*r) - return self*Pair.make(other).reciprocal() - -def unary(j,v,d,dd):return Jet(v,j.gradient*d,j.hessian*d+outer(j.gradient,j.gradient)*dd) -def transpose(a):return [list(row) for row in zip(*a)] -def mm(a,b):return [[sum(x*y for x,y in zip(row,col)) for col in zip(*b)] for row in a] -def mv(a,b):return [sum(x*y for x,y in zip(row,b)) for row in a] -def const(a,low,size): - return [[Jet.constant(Pair(a[i,j],low[i,j]),size) for j in range(3)] for i in range(3)] -def exp(w): - n=w[0].gradient.high.size;z=Jet.constant(0.,n);t=sum((v*v for v in w),z) - if math.sqrt(max(0.,t.value.scalar()))>=.9*math.pi:raise ValueError('native increment requires cutback') - # Entire-function Rodrigues coefficients, evaluated from their defining - # series. 32 terms cover the unchanged native chart radius. - a=Jet.constant(1.,n);b=Jet.constant(.5,n);ta=a;tb=b - stop=2 if t.value.scalar()==0. and not np.any(t.gradient.high) and not np.any(t.gradient.low) else 33 - for k in range(1,stop): - ta=-ta*t/((2*k)*(2*k+1));tb=-tb*t/((2*k+1)*(2*k+2));a=a+ta;b=b+tb - S=[[z,-w[2],w[1]],[w[2],z,-w[0]],[-w[1],w[0],z]];SS=mm(S,S) - return [[Jet.constant(float(i==j),n)+a*S[i][j]+b*SS[i][j] for j in range(3)] for i in range(3)] -def greater_scalar(value,bound): - """Compare authoritative normalized scalar parts without rounding the low.""" - return bool(value.high>bound or (value.high==bound and value.low>0.)) - -def pair_sqrt(value): - value=Pair.make(value) - if not greater_scalar(value,0.):raise ValueError('positive compensated square root required') - root=Pair(float(np.sqrt(value.high))) - for _ in range(2):root=root+(value-root*root)/(2.*root) - return root - -def pair_sin_cos(value): - """Bounded principal-angle entire series in binary64 expansions.""" - value=Pair.make(value);t=value*value - sine=value;cosine=Pair(1.);a=value;b=Pair(1.) - for k in range(1,33): - a=-a*t/((2*k)*(2*k+1));b=-b*t/((2*k-1)*(2*k)) - sine=sine+a;cosine=cosine+b - return sine,cosine - -def full_log_coefficients(cosine): - """Same principal acos(c)/sqrt(1-c*c) and its first two derivatives. - - Acos is seeded at the high component, then corrected using the defining - cosine equation in the same binary64 expansion arithmetic. The recurrences - (1-c*c) f' = c*f-1 and (1-c*c) f'' = f+3*c*f' avoid introducing a new law. - """ - from ._ge_beam3_mixed_ad import RotationDomainError,math_cos_limit - c=Pair.make(cosine) - if not greater_scalar(c,math_cos_limit()) or greater_scalar(c,1.) or (c.high==1. and c.low==0.): - raise RotationDomainError('relative rotation must remain below 0.9*pi; refine or cut back') - t=1.-c*c;sine=pair_sqrt(t);angle=Pair(float(np.arccos(c.high))) - for _ in range(2): - sn,cs=pair_sin_cos(angle);angle=angle+(cs-c)/sn - value=angle/sine;first=(c*value-1.)/t;second=(value+3.*c*first)/t - return value,first,second - -def log(a): - n=a[0][0].gradient.high.size;c=(a[0][0]+a[1][1]+a[2][2]-1.)/2. - if greater_scalar(c.value,1.-1e-7): - d=1.-c;f=1.+d/3.+2.*d*d/15.+2.*d*d*d/35. - else: - f=unary(c,*full_log_coefficients(c.value)) - return [f*(a[2][1]-a[1][2])/2.,f*(a[0][2]-a[2][0])/2.,f*(a[1][0]-a[0][1])/2.] - -def updated_rotation(high,low,angle): - w=[Jet.constant(float(v),1) for v in angle];e=exp(w);made=mm(e,const(high,low,1)) - return (np.array([[v.value.high for v in row] for row in made]), - np.array([[v.value.low for v in row] for row in made])) - -def add_state(high,low,delta): - p=Pair(high,low)+Pair(delta) - return p.high.copy(),p.low.copy() - - -def retained_evaluation(reference,x,low,q,q_low,u,u_low,p,p_low,material): - size=24;variables=[Jet.variable(0.,i,size) for i in range(size)] - made_q=[mm(exp(variables[6*n+3:6*n+6]),const(q[n],q_low[n],size)) for n in range(3)] - z=[];ell=[] - for cell,(left,right) in enumerate(((0,1),(1,2))): - made_u=mm(exp(variables[18+3*cell:21+3*cell]),const(u[cell],u_low[cell],size)) - chord=[Jet.constant(Pair(x[right,i],low[right,i])-Pair(x[left,i],low[left,i]),size) - +variables[6*right+i]-variables[6*left+i] for i in range(3)] - local=mv(transpose(made_u),chord) - z.extend(v-Pair(reference.coordinates[right,i])+Pair(reference.coordinates[left,i]) for i,v in enumerate(local)) - for node,sign in ((left,-1),(right,1)): - frame=mm(made_u,const(reference.nodal_triads[node],np.zeros((3,3)),size)) - ell.extend(sign*v for v in log(mm(transpose(frame),made_q[node]))) - values=z+ell;forces=Pair(p,p_low);gradient=Pair(np.zeros(24));geometric=Pair(np.zeros((24,24))) - potential=Pair(0.) - for v,ph,pl in zip(values,forces.high,forces.low): - f=Pair(ph,pl);gradient=gradient+v.gradient*f;geometric=geometric+v.hessian*f;potential=potential+v.value*f - gh,gl=material['gradient'];compatibility=[v.value-Pair(h,l) for v,h,l in zip(values,gh,gl)] - jh=np.array([v.gradient.high for v in values]);jl=np.array([v.gradient.low for v in values]) - ch=np.array([r[0] for r in material['hessian']]);cl=np.array([r[1] for r in material['hessian']]) - high=np.block([[geometric.high,jh.T],[jh,-ch]]) - lowh=np.block([[geometric.low,jl.T],[jl,-cl]]) - residual=np.r_[gradient.rounded(),[v.scalar() for v in compatibility]] - potential=potential-Pair(material['potential'][0][0],material['potential'][1][0]) - return potential.scalar(),residual,high,lowh,np.array([v.value.scalar() for v in values]) - - -def validate_pairs(high,low,label): - p=Pair(high,low) - if not np.array_equal(p.high,high) or not np.array_equal(p.low,low): - raise ValueError('normalized compensated '+label+' required') - return p - -def validate_frames(high,low,label): - validate_pairs(high,low,label) - for h,l in zip(np.asarray(high).reshape(-1,3,3),np.asarray(low).reshape(-1,3,3)): - m=[[Pair(h[i,j],l[i,j]) for j in range(3)] for i in range(3)] - product=mm(transpose(m),m) - error=np.array([[v.scalar()-float(i==j) for j,v in enumerate(row)] for i,row in enumerate(product)]) - physical=h+l - if np.linalg.norm(error)>1e-11 or abs(np.linalg.det(physical)-1.)>1e-11: - raise ValueError('proper physical compensated '+label+' required') - -def pose_evaluation(x,low,frames,frames_low,multipliers,offset,relative): - size=18;variables=[Jet.variable(0.,i,size) for i in range(12)] - variables+=[Jet.variable(float(v),12+i,size) for i,v in enumerate(multipliers)] - made=[mm(exp(variables[6*n+3:6*n+6]),const(frames[n],frames_low[n],size)) for n in range(2)] - distance=[Jet.constant(Pair(x[1,i],low[1,i])-Pair(x[0,i],low[0,i]),size)+variables[6+i]-variables[i] for i in range(3)] - ct=[v-float(e) for v,e in zip(mv(transpose(made[0]),distance),offset)] - rel=mm(const(relative.T,np.zeros((3,3)),size),mm(transpose(made[0]),made[1])) - constraints=ct+log(rel);potential=sum((v*variables[12+i] for i,v in enumerate(constraints)),Jet.constant(0.,size)) - return (potential.value.scalar(),np.array([v.value.scalar() for v in constraints]), - np.array([v.gradient.rounded()[:12] for v in constraints]),potential.gradient.rounded(),potential.hessian.rounded()) +"""Opt-in binary64 expansion arithmetic for durable native state and work. + +Two components retain roundoff information; no decimal/extended-precision +backend, projection, altered mechanical equation or empirical stabilization. +""" +import math +import numpy as np +POLICY='GE_BEAM3_DURABLE_COMPENSATED_NATIVE_STATE_V1_DEV' +MAGIC=b'ANYF06DD1\0' + + +def two_sum(a,b): + h=a+b;v=h-a + return h,(a-(h-v))+(b-v) + +def two_product(a,b): + h=a*b;split=134217729. + ca=split*a;cb=split*b + ah=ca-(ca-a);al=a-ah;bh=cb-(cb-b);bl=b-bh + return h,((ah*bh-h)+ah*bl+al*bh)+al*bl + +class Pair: + __array_priority__=1000 + def __init__(self,high,low=0.): + self.high,self.low=two_sum(np.asarray(high,dtype=float),np.asarray(low,dtype=float)) + if not np.isfinite(self.high).all() or not np.isfinite(self.low).all(): + raise ValueError('finite representable compensated native values required') + @staticmethod + def make(value):return value if isinstance(value,Pair) else Pair(value) + def __add__(self,other): + b=self.make(other);h,l=two_sum(self.high,b.high) + return Pair(h,l+self.low+b.low) + __radd__=__add__ + def __neg__(self):return Pair(-self.high,-self.low) + def __sub__(self,other):return self+-self.make(other) + def __rsub__(self,other):return self.make(other)+-self + def __mul__(self,other): + b=self.make(other);h,l=two_product(self.high,b.high) + return Pair(h,l+self.high*b.low+self.low*b.high+self.low*b.low) + __rmul__=__mul__ + def reciprocal(self): + if np.any(self.high==0.):raise ValueError('singular compensated native reciprocal') + q=Pair(1./self.high) + return q+(1.-self*q)*(1./self.high) + def __truediv__(self,other):return self*self.make(other).reciprocal() + def __rtruediv__(self,other):return self.make(other)*self.reciprocal() + def __getitem__(self,index):return Pair(self.high[index],self.low[index]) + @property + def T(self):return Pair(self.high.T,self.low.T) + def rounded(self):return self.high+self.low + def scalar(self):return float(self.high)+float(self.low) + +def outer(a,b):return Pair(a.high[:,None],a.low[:,None])*Pair(b.high[None,:],b.low[None,:]) + +class Jet: + def __init__(self,value,gradient,hessian): + self.value=Pair.make(value);self.gradient=Pair.make(gradient);self.hessian=Pair.make(hessian) + @classmethod + def constant(cls,value,size):return cls(value,Pair(np.zeros(size)),Pair(np.zeros((size,size)))) + @classmethod + def variable(cls,value,index,size): + g=np.zeros(size);g[index]=1. + return cls(value,Pair(g),Pair(np.zeros((size,size)))) + def make(self,value):return value if isinstance(value,Jet) else Jet.constant(value,self.gradient.high.size) + def __add__(self,other): + b=self.make(other);return Jet(self.value+b.value,self.gradient+b.gradient,self.hessian+b.hessian) + __radd__=__add__ + def __neg__(self):return Jet(-self.value,-self.gradient,-self.hessian) + def __sub__(self,other):return self+-self.make(other) + def __rsub__(self,other):return self.make(other)+-self + def __mul__(self,other): + b=self.make(other) + return Jet(self.value*b.value,self.gradient*b.value+self.value*b.gradient, + self.hessian*b.value+self.value*b.hessian+outer(self.gradient,b.gradient)+outer(b.gradient,self.gradient)) + __rmul__=__mul__ + def __truediv__(self,other): + if isinstance(other,Jet): + r=other.value.reciprocal();return self*unary(other,r,-r*r,2*r*r*r) + return self*Pair.make(other).reciprocal() + +def unary(j,v,d,dd):return Jet(v,j.gradient*d,j.hessian*d+outer(j.gradient,j.gradient)*dd) +def transpose(a):return [list(row) for row in zip(*a)] +def mm(a,b):return [[sum(x*y for x,y in zip(row,col)) for col in zip(*b)] for row in a] +def mv(a,b):return [sum(x*y for x,y in zip(row,b)) for row in a] +def const(a,low,size): + return [[Jet.constant(Pair(a[i,j],low[i,j]),size) for j in range(3)] for i in range(3)] +def exp(w): + n=w[0].gradient.high.size;z=Jet.constant(0.,n);t=sum((v*v for v in w),z) + if math.sqrt(max(0.,t.value.scalar()))>=.9*math.pi:raise ValueError('native increment requires cutback') + # Entire-function Rodrigues coefficients, evaluated from their defining + # series. 32 terms cover the unchanged native chart radius. + a=Jet.constant(1.,n);b=Jet.constant(.5,n);ta=a;tb=b + stop=2 if t.value.scalar()==0. and not np.any(t.gradient.high) and not np.any(t.gradient.low) else 33 + for k in range(1,stop): + ta=-ta*t/((2*k)*(2*k+1));tb=-tb*t/((2*k+1)*(2*k+2));a=a+ta;b=b+tb + S=[[z,-w[2],w[1]],[w[2],z,-w[0]],[-w[1],w[0],z]];SS=mm(S,S) + return [[Jet.constant(float(i==j),n)+a*S[i][j]+b*SS[i][j] for j in range(3)] for i in range(3)] +def greater_scalar(value,bound): + """Compare authoritative normalized scalar parts without rounding the low.""" + return bool(value.high>bound or (value.high==bound and value.low>0.)) + +def pair_sqrt(value): + value=Pair.make(value) + if not greater_scalar(value,0.):raise ValueError('positive compensated square root required') + root=Pair(float(np.sqrt(value.high))) + for _ in range(2):root=root+(value-root*root)/(2.*root) + return root + +def pair_sin_cos(value): + """Bounded principal-angle entire series in binary64 expansions.""" + value=Pair.make(value);t=value*value + sine=value;cosine=Pair(1.);a=value;b=Pair(1.) + for k in range(1,33): + a=-a*t/((2*k)*(2*k+1));b=-b*t/((2*k-1)*(2*k)) + sine=sine+a;cosine=cosine+b + return sine,cosine + +def full_log_coefficients(cosine): + """Same principal acos(c)/sqrt(1-c*c) and its first two derivatives. + + Acos is seeded at the high component, then corrected using the defining + cosine equation in the same binary64 expansion arithmetic. The recurrences + (1-c*c) f' = c*f-1 and (1-c*c) f'' = f+3*c*f' avoid introducing a new law. + """ + from ._ge_beam3_mixed_ad import RotationDomainError,math_cos_limit + c=Pair.make(cosine) + if not greater_scalar(c,math_cos_limit()) or greater_scalar(c,1.) or (c.high==1. and c.low==0.): + raise RotationDomainError('relative rotation must remain below 0.9*pi; refine or cut back') + t=1.-c*c;sine=pair_sqrt(t);angle=Pair(float(np.arccos(c.high))) + for _ in range(2): + sn,cs=pair_sin_cos(angle);angle=angle+(cs-c)/sn + value=angle/sine;first=(c*value-1.)/t;second=(value+3.*c*first)/t + return value,first,second + +def log(a): + n=a[0][0].gradient.high.size;c=(a[0][0]+a[1][1]+a[2][2]-1.)/2. + if greater_scalar(c.value,1.-1e-7): + d=1.-c;f=1.+d/3.+2.*d*d/15.+2.*d*d*d/35. + else: + f=unary(c,*full_log_coefficients(c.value)) + return [f*(a[2][1]-a[1][2])/2.,f*(a[0][2]-a[2][0])/2.,f*(a[1][0]-a[0][1])/2.] + +def updated_rotation(high,low,angle): + w=[Jet.constant(float(v),1) for v in angle];e=exp(w);made=mm(e,const(high,low,1)) + return (np.array([[v.value.high for v in row] for row in made]), + np.array([[v.value.low for v in row] for row in made])) + +def add_state(high,low,delta): + p=Pair(high,low)+Pair(delta) + return p.high.copy(),p.low.copy() + + +def retained_evaluation(reference,x,low,q,q_low,u,u_low,p,p_low,material): + size=24;variables=[Jet.variable(0.,i,size) for i in range(size)] + made_q=[mm(exp(variables[6*n+3:6*n+6]),const(q[n],q_low[n],size)) for n in range(3)] + z=[];ell=[] + for cell,(left,right) in enumerate(((0,1),(1,2))): + made_u=mm(exp(variables[18+3*cell:21+3*cell]),const(u[cell],u_low[cell],size)) + chord=[Jet.constant(Pair(x[right,i],low[right,i])-Pair(x[left,i],low[left,i]),size) + +variables[6*right+i]-variables[6*left+i] for i in range(3)] + local=mv(transpose(made_u),chord) + z.extend(v-Pair(reference.coordinates[right,i])+Pair(reference.coordinates[left,i]) for i,v in enumerate(local)) + for node,sign in ((left,-1),(right,1)): + frame=mm(made_u,const(reference.nodal_triads[node],np.zeros((3,3)),size)) + ell.extend(sign*v for v in log(mm(transpose(frame),made_q[node]))) + values=z+ell;forces=Pair(p,p_low);gradient=Pair(np.zeros(24));geometric=Pair(np.zeros((24,24))) + potential=Pair(0.) + for v,ph,pl in zip(values,forces.high,forces.low): + f=Pair(ph,pl);gradient=gradient+v.gradient*f;geometric=geometric+v.hessian*f;potential=potential+v.value*f + gh,gl=material['gradient'];compatibility=[v.value-Pair(h,l) for v,h,l in zip(values,gh,gl)] + jh=np.array([v.gradient.high for v in values]);jl=np.array([v.gradient.low for v in values]) + ch=np.array([r[0] for r in material['hessian']]);cl=np.array([r[1] for r in material['hessian']]) + high=np.block([[geometric.high,jh.T],[jh,-ch]]) + lowh=np.block([[geometric.low,jl.T],[jl,-cl]]) + residual=np.r_[gradient.rounded(),[v.scalar() for v in compatibility]] + potential=potential-Pair(material['potential'][0][0],material['potential'][1][0]) + return potential.scalar(),residual,high,lowh,np.array([v.value.scalar() for v in values]) + + +def validate_pairs(high,low,label): + p=Pair(high,low) + if not np.array_equal(p.high,high) or not np.array_equal(p.low,low): + raise ValueError('normalized compensated '+label+' required') + return p + +def validate_frames(high,low,label): + validate_pairs(high,low,label) + for h,l in zip(np.asarray(high).reshape(-1,3,3),np.asarray(low).reshape(-1,3,3)): + m=[[Pair(h[i,j],l[i,j]) for j in range(3)] for i in range(3)] + product=mm(transpose(m),m) + error=np.array([[v.scalar()-float(i==j) for j,v in enumerate(row)] for i,row in enumerate(product)]) + physical=h+l + if np.linalg.norm(error)>1e-11 or abs(np.linalg.det(physical)-1.)>1e-11: + raise ValueError('proper physical compensated '+label+' required') + +def pose_evaluation(x,low,frames,frames_low,multipliers,offset,relative): + size=18;variables=[Jet.variable(0.,i,size) for i in range(12)] + variables+=[Jet.variable(float(v),12+i,size) for i,v in enumerate(multipliers)] + made=[mm(exp(variables[6*n+3:6*n+6]),const(frames[n],frames_low[n],size)) for n in range(2)] + distance=[Jet.constant(Pair(x[1,i],low[1,i])-Pair(x[0,i],low[0,i]),size)+variables[6+i]-variables[i] for i in range(3)] + ct=[v-float(e) for v,e in zip(mv(transpose(made[0]),distance),offset)] + rel=mm(const(relative.T,np.zeros((3,3)),size),mm(transpose(made[0]),made[1])) + constraints=ct+log(rel);potential=sum((v*variables[12+i] for i,v in enumerate(constraints)),Jet.constant(0.,size)) + return (potential.value.scalar(),np.array([v.value.scalar() for v in constraints]), + np.array([v.gradient.rounded()[:12] for v in constraints]),potential.gradient.rounded(),potential.hessian.rounded()) diff --git a/src/anyfesolver/_stiffened_shell_ge_checkpoint_binary.py b/src/anyfesolver/_stiffened_shell_ge_checkpoint_binary.py index b907fc501..b0b30dc6b 100644 --- a/src/anyfesolver/_stiffened_shell_ge_checkpoint_binary.py +++ b/src/anyfesolver/_stiffened_shell_ge_checkpoint_binary.py @@ -85,13 +85,13 @@ "finite_native_material_stable": STABLE_NATIVE_SCHEMA, "finite_chart_native_material_stable": "B3_GE_E4_PL_STIFFENED_SHELL_EXPERIMENTAL_ANCHORED_STABLE_S3_NATIVE_MATERIAL_V9", } - -# Distinct shell-J2 domain: historical material kinds remain elastic-shell only. -COMPENSATED_COUPLED_KINDS = tuple('finite_compensated_'+family+'_coupled' - for family in ('generalized', 'fibre', 'mixed')) -for _family, _kind in zip(('GENERALIZED', 'PHYSICAL_FIBRE', 'MIXED_NATIVE'), COMPENSATED_COUPLED_KINDS): - SCHEMAS[_kind] = 'GE_COMPENSATED_'+_family+'_POINT_COUPLED_J2_STATE_V1_DEV' - SCHEMAS[_kind.replace('finite', 'finite_chart', 1)] = 'GE_ANCHORED_COMPENSATED_'+_family+'_POINT_COUPLED_J2_STATE_V1_DEV' + +# Distinct shell-J2 domain: historical material kinds remain elastic-shell only. +COMPENSATED_COUPLED_KINDS = tuple('finite_compensated_'+family+'_coupled' + for family in ('generalized', 'fibre', 'mixed')) +for _family, _kind in zip(('GENERALIZED', 'PHYSICAL_FIBRE', 'MIXED_NATIVE'), COMPENSATED_COUPLED_KINDS): + SCHEMAS[_kind] = 'GE_COMPENSATED_'+_family+'_POINT_COUPLED_J2_STATE_V1_DEV' + SCHEMAS[_kind.replace('finite', 'finite_chart', 1)] = 'GE_ANCHORED_COMPENSATED_'+_family+'_POINT_COUPLED_J2_STATE_V1_DEV' CURVED_POINT_MATERIAL_KINDS = ("finite_curved_points_material", "finite_curved_points_coupled") FINITE_DISTRIBUTING_NATIVE_KINDS = ("finite_distributing_cyclic_native_material", diff --git a/src/anyfesolver/_stiffened_shell_ge_distributed_load.py b/src/anyfesolver/_stiffened_shell_ge_distributed_load.py index 13053c615..f4a19c85c 100644 --- a/src/anyfesolver/_stiffened_shell_ge_distributed_load.py +++ b/src/anyfesolver/_stiffened_shell_ge_distributed_load.py @@ -1,210 +1,210 @@ -"""Explicit native force/couple densities, per reference arclength. - -Fixed spatial force work is conservative; fixed spatial couples have no scalar -potential. Full native cell rotations and actual element quadrature are retained. -New load identity binds objective Q4 / stable elastic S3 finite arithmetic. -""" -from dataclasses import dataclass, field -from hashlib import sha256 -from types import SimpleNamespace -import numpy as np -from scipy import sparse -from ._stiffened_shell_staged_load_experimental import _canonical, _identity, _number, _json -from ._stiffened_shell_ge_checkpoint_binary import MAX_CHECKPOINT_BYTES -from ._stiffened_shell_native_gravity import _owned, _sum, _product, _finite_array -from ._ge_beam3_p5.compensated_coordinates import split_sum - -POLICY='STIFFENED_SHELL_GE_NATIVE_DISTRIBUTED_LOAD_V1_DEV' -MAGIC=b'ANYSGE_LINE1\0' -MAX_METADATA_BYTES=1024*1024 -MAX_ACTIONS=16384 - - +"""Explicit native force/couple densities, per reference arclength. + +Fixed spatial force work is conservative; fixed spatial couples have no scalar +potential. Full native cell rotations and actual element quadrature are retained. +New load identity binds objective Q4 / stable elastic S3 finite arithmetic. +""" +from dataclasses import dataclass, field +from hashlib import sha256 +from types import SimpleNamespace +import numpy as np +from scipy import sparse +from ._stiffened_shell_staged_load_experimental import _canonical, _identity, _number, _json +from ._stiffened_shell_ge_checkpoint_binary import MAX_CHECKPOINT_BYTES +from ._stiffened_shell_native_gravity import _owned, _sum, _product, _finite_array +from ._ge_beam3_p5.compensated_coordinates import split_sum + +POLICY='STIFFENED_SHELL_GE_NATIVE_DISTRIBUTED_LOAD_V1_DEV' +MAGIC=b'ANYSGE_LINE1\0' +MAX_METADATA_BYTES=1024*1024 +MAX_ACTIONS=16384 + + def admits_owner(owner): """Attachment scope shared by public capabilities and load compilation.""" - if owner._definition.distributing_footprints or owner._definition.finite_distributing_footprints: + if owner._definition.distributing_footprints or owner._definition.finite_distributing_footprints: return False - if owner._definition.footprints: - return False - if owner._line_samples: - from ._stiffened_shell_q4_algorithmic_pullback import POLICY - return bool(owner._finite_bl5 and owner._definition.q4_pullback_policy == POLICY) - return bool(owner._definition.points) - - -def _vector(value): - if np.shape(value)!=(3,): raise ValueError('three finite load density components required') - return tuple(_number(v) for v in value) - - -@dataclass(frozen=True) -class GEBeamLineAction: - element_id: int - force_N_per_reference_m: tuple=(0.,0.,0.) - couple_Nm_per_reference_m: tuple=(0.,0.,0.) - - def __post_init__(self): - if type(self.element_id) is not int or self.element_id<=0: - raise ValueError('positive native element identifier required') - for name in ('force_N_per_reference_m','couple_Nm_per_reference_m'): - object.__setattr__(self,name,_vector(getattr(self,name))) - if not any(self.force_N_per_reference_m+self.couple_Nm_per_reference_m): - raise ValueError('each native distributed action must be nonzero') - - def payload(self): - return dict(element_id=self.element_id,force_N_per_reference_m=list(self.force_N_per_reference_m), - couple_Nm_per_reference_m=list(self.couple_Nm_per_reference_m)) - - -@dataclass(frozen=True) -class GEBeamDistributedLoad: - model_identity: str - actions: tuple[GEBeamLineAction,...] - identity: str=field(init=False) - - def __post_init__(self): - object.__setattr__(self,'model_identity',_identity(self.model_identity)) - if type(self.actions) is not tuple or not 0MAX_METADATA_BYTES:raise ValueError('bounded distributed descriptor required') - - def _core(self): - return dict(policy=POLICY,model_identity=self.model_identity,actions=[a.payload() for a in self.actions]) - - def to_payload(self):return dict(self._core(),identity=self.identity) - def serialize(self):return _canonical(self.to_payload()) - - @classmethod - def from_payload(cls,value): - if type(value) is not dict or set(value)!={'policy','model_identity','actions','identity'} or value['policy']!=POLICY or type(value['actions']) is not list: - raise ValueError('strict distributed load descriptor required') - if not 0MAX_METADATA_BYTES or len(MAGIC)+4+len(header)+len(inner)+32>MAX_CHECKPOINT_BYTES: - raise ValueError('distributed checkpoint byte bound exceeded') - content=MAGIC+len(header).to_bytes(4,'little')+header+inner - return content+sha256(content).digest() - - -def decode_checkpoint(raw): - if type(raw) is not bytes or not raw.startswith(MAGIC) or not len(MAGIC)+4+32=len(raw)-32 or sha256(memoryview(raw)[:-32]).digest()!=raw[-32:]: - raise ValueError('distributed checkpoint bound/digest mismatch') - header_raw=raw[start:start+size];header=_json(header_raw) - if type(header) is not dict or set(header)!={'policy','request','inner_sha256'} or header['policy']!=POLICY or _canonical(header)!=header_raw: - raise ValueError('strict distributed checkpoint metadata required') - request=GEBeamDistributedLoad.from_payload(header['request']);inner=raw[start+size:-32] - if sha256(inner).hexdigest()!=header['inner_sha256']:raise ValueError('distributed inner checkpoint mismatch') - return request,inner + if owner._definition.footprints: + return False + if owner._line_samples: + from ._stiffened_shell_q4_algorithmic_pullback import POLICY + return bool(owner._finite_bl5 and owner._definition.q4_pullback_policy == POLICY) + return bool(owner._definition.points) + + +def _vector(value): + if np.shape(value)!=(3,): raise ValueError('three finite load density components required') + return tuple(_number(v) for v in value) + + +@dataclass(frozen=True) +class GEBeamLineAction: + element_id: int + force_N_per_reference_m: tuple=(0.,0.,0.) + couple_Nm_per_reference_m: tuple=(0.,0.,0.) + + def __post_init__(self): + if type(self.element_id) is not int or self.element_id<=0: + raise ValueError('positive native element identifier required') + for name in ('force_N_per_reference_m','couple_Nm_per_reference_m'): + object.__setattr__(self,name,_vector(getattr(self,name))) + if not any(self.force_N_per_reference_m+self.couple_Nm_per_reference_m): + raise ValueError('each native distributed action must be nonzero') + + def payload(self): + return dict(element_id=self.element_id,force_N_per_reference_m=list(self.force_N_per_reference_m), + couple_Nm_per_reference_m=list(self.couple_Nm_per_reference_m)) + + +@dataclass(frozen=True) +class GEBeamDistributedLoad: + model_identity: str + actions: tuple[GEBeamLineAction,...] + identity: str=field(init=False) + + def __post_init__(self): + object.__setattr__(self,'model_identity',_identity(self.model_identity)) + if type(self.actions) is not tuple or not 0MAX_METADATA_BYTES:raise ValueError('bounded distributed descriptor required') + + def _core(self): + return dict(policy=POLICY,model_identity=self.model_identity,actions=[a.payload() for a in self.actions]) + + def to_payload(self):return dict(self._core(),identity=self.identity) + def serialize(self):return _canonical(self.to_payload()) + + @classmethod + def from_payload(cls,value): + if type(value) is not dict or set(value)!={'policy','model_identity','actions','identity'} or value['policy']!=POLICY or type(value['actions']) is not list: + raise ValueError('strict distributed load descriptor required') + if not 0MAX_METADATA_BYTES or len(MAGIC)+4+len(header)+len(inner)+32>MAX_CHECKPOINT_BYTES: + raise ValueError('distributed checkpoint byte bound exceeded') + content=MAGIC+len(header).to_bytes(4,'little')+header+inner + return content+sha256(content).digest() + + +def decode_checkpoint(raw): + if type(raw) is not bytes or not raw.startswith(MAGIC) or not len(MAGIC)+4+32=len(raw)-32 or sha256(memoryview(raw)[:-32]).digest()!=raw[-32:]: + raise ValueError('distributed checkpoint bound/digest mismatch') + header_raw=raw[start:start+size];header=_json(header_raw) + if type(header) is not dict or set(header)!={'policy','request','inner_sha256'} or header['policy']!=POLICY or _canonical(header)!=header_raw: + raise ValueError('strict distributed checkpoint metadata required') + request=GEBeamDistributedLoad.from_payload(header['request']);inner=raw[start+size:-32] + if sha256(inner).hexdigest()!=header['inner_sha256']:raise ValueError('distributed inner checkpoint mismatch') + return request,inner diff --git a/src/anyfesolver/_stiffened_shell_ge_distributing_finite.py b/src/anyfesolver/_stiffened_shell_ge_distributing_finite.py index 81a6de7d8..3f6179116 100644 --- a/src/anyfesolver/_stiffened_shell_ge_distributing_finite.py +++ b/src/anyfesolver/_stiffened_shell_ge_distributing_finite.py @@ -1,179 +1,179 @@ -"""Experimental physical-pose assembly and recovery for finite area coupling. - -Prepare reference correspondence once from the existing GE owner. Keep its -spatial rows and pull shell increment columns only. This adapter owns no state, -changes no owner flags, and cannot publish a trial or authorize a checkpoint. -""" -from dataclasses import dataclass -from math import fsum -import weakref - -import numpy as np -from scipy import sparse - -from ._ge_beam3_pose_joint import _exp_terms -from ._ge_beam3_mixed_ad import RotationDomainError -from ._stiffened_shell_distributing_pose import ( - LAW, FiniteDistributingPose, DistributingPoseDomainError, _owned, _frozen_sparse, -) -from ._stiffened_shell_distributing_footprint import DistributingFootprintDefinition -from ._stiffened_shell_ge_distributing_reference import _compile_reference_geometry, _reference_owner -from ._stiffened_shell_rotation_charts import physical_frames - - -@dataclass(frozen=True) -class FiniteDistributingFootprintDefinition: - """Explicit opt-in finite law; never upgrades a reference-only record.""" - footprint: DistributingFootprintDefinition - - def __post_init__(self): - if type(self.footprint) is not DistributingFootprintDefinition: - raise ValueError("typed reference footprint geometry required") - g = self.footprint - object.__setattr__(self, "footprint", DistributingFootprintDefinition( - g.footprint_id, g.host_element_ids, g.beam_node_id, g.bounds_xy_m)) - - -@dataclass(frozen=True) -class FiniteDistributingFootprintWrench: - """Evaluated exerted spatial actions, measured at physical port origins. - - The shell origin is the fixed-reference-area-weighted current position. - Area is a reference measure; this is not a rigid or pointwise welded patch. - """ - footprint_id: str - model_identity: str - compiled_identity: str - host_element_ids: tuple[int, ...] - shell_node_ids: tuple[int, ...] - beam_node_id: int - centroid_m: np.ndarray - centroid_low_m: np.ndarray - beam_position_m: np.ndarray - beam_position_low_m: np.ndarray - area_reference_m2: float - shell_node_positions_m: np.ndarray - shell_node_position_low_m: np.ndarray - shell_node_actions: np.ndarray - shell_action: np.ndarray - beam_action: np.ndarray - gap: np.ndarray - generation: int - configuration: str - - @property - def law(self): - return LAW - - @property - def production_qualified(self): - return False - - def __post_init__(self): - count = len(self.shell_node_ids) - for name, shape in (("centroid_m", (3,)), ("centroid_low_m", (3,)), - ("beam_position_m", (3,)), ("beam_position_low_m", (3,)), - ("shell_node_positions_m", (count,3)), ("shell_node_position_low_m", (count,3)), - ("shell_node_actions", (count,6)), ("shell_action", (6,)), - ("beam_action", (6,)), ("gap", (6,))): - array = np.asarray(getattr(self, name)) - if array.shape != shape or not np.isfinite(array).all(): - raise DistributingPoseDomainError("finite owned distributing recovery required") - object.__setattr__(self, name, _owned(array)) - - -def wrench_record(assembly, reference, generation): - return FiniteDistributingFootprintWrench(reference.definition.footprint_id, - assembly.model_identity, assembly.candidate_identity, reference.host_element_ids, - reference.shell_node_ids, reference.beam_node_id, assembly.centroid, - assembly.centroid_low, assembly.beam_position, assembly.beam_position_low, - reference.area_m2, assembly.shell_positions, assembly.shell_position_low, - assembly.shell_node_actions, assembly.shell_action, assembly.beam_action, - assembly.gap, generation, "current") - - - -@dataclass(frozen=True) -class FiniteDistributingAssembly: - """Owned candidate work, local saddle block and explicit global scatter.""" - model_identity: str - candidate_identity: str - generation: int - slots: np.ndarray - residual: np.ndarray - tangent: sparse.csr_matrix - gap: np.ndarray - shell_positions: np.ndarray - shell_position_low: np.ndarray - beam_position: np.ndarray - beam_position_low: np.ndarray - shell_action: np.ndarray - beam_action: np.ndarray - shell_node_actions: np.ndarray - centroid: np.ndarray - centroid_low: np.ndarray - production_qualified: bool = False - owner_binding_authorized: bool = False - - def scatter(self, global_dimension): - if (type(global_dimension) is not int or global_dimension <= 0 or - self.slots.max() >= global_dimension): - raise ValueError("complete declared extended global dimension required") - matrix = self.tangent.tocoo() - tangent = sparse.coo_matrix((matrix.data, - (self.slots[matrix.row], self.slots[matrix.col])), - shape=(global_dimension, global_dimension)).tocsr() - residual = np.zeros(global_dimension) - np.add.at(residual, self.slots, self.residual) - return _owned(residual), _frozen_sparse(tangent) - - -class PreparedFiniteDistributingAttachment: - """Private reusable local operator compiled from an unadvanced owner. - - Current trial state is supplied explicitly, using the existing owner's - additive shell chart and spatial beam update. No model-wide hash/search - occurs during evaluation. A different/closed/recompiled owner is rejected. - """ - __slots__ = ("reference", "pose", "model_identity", "_owner", "_K", - "_shell_parts", "_count", "_shell_nodes", "_beam_node", "_sealed") - - def __setattr__(self, name, value): - if getattr(self, "_sealed", False): - raise AttributeError("prepared finite attachment is immutable") - object.__setattr__(self, name, value) - - def __init__(self, owner, definition): - _reference_owner(owner) - reference = _compile_reference_geometry(definition, - shell_parts=owner._shell_parts, shell_index=owner._shell_index, - shell_xyz=owner._shell_xyz, beam_index=owner._beam_index, - beam_nodes=owner._beam_nodes, shell_count=owner._shell_count, - global_dimension=owner._K.shape[0]) - self._bind(owner, reference, FiniteDistributingPose(reference)) - - @classmethod +"""Experimental physical-pose assembly and recovery for finite area coupling. + +Prepare reference correspondence once from the existing GE owner. Keep its +spatial rows and pull shell increment columns only. This adapter owns no state, +changes no owner flags, and cannot publish a trial or authorize a checkpoint. +""" +from dataclasses import dataclass +from math import fsum +import weakref + +import numpy as np +from scipy import sparse + +from ._ge_beam3_pose_joint import _exp_terms +from ._ge_beam3_mixed_ad import RotationDomainError +from ._stiffened_shell_distributing_pose import ( + LAW, FiniteDistributingPose, DistributingPoseDomainError, _owned, _frozen_sparse, +) +from ._stiffened_shell_distributing_footprint import DistributingFootprintDefinition +from ._stiffened_shell_ge_distributing_reference import _compile_reference_geometry, _reference_owner +from ._stiffened_shell_rotation_charts import physical_frames + + +@dataclass(frozen=True) +class FiniteDistributingFootprintDefinition: + """Explicit opt-in finite law; never upgrades a reference-only record.""" + footprint: DistributingFootprintDefinition + + def __post_init__(self): + if type(self.footprint) is not DistributingFootprintDefinition: + raise ValueError("typed reference footprint geometry required") + g = self.footprint + object.__setattr__(self, "footprint", DistributingFootprintDefinition( + g.footprint_id, g.host_element_ids, g.beam_node_id, g.bounds_xy_m)) + + +@dataclass(frozen=True) +class FiniteDistributingFootprintWrench: + """Evaluated exerted spatial actions, measured at physical port origins. + + The shell origin is the fixed-reference-area-weighted current position. + Area is a reference measure; this is not a rigid or pointwise welded patch. + """ + footprint_id: str + model_identity: str + compiled_identity: str + host_element_ids: tuple[int, ...] + shell_node_ids: tuple[int, ...] + beam_node_id: int + centroid_m: np.ndarray + centroid_low_m: np.ndarray + beam_position_m: np.ndarray + beam_position_low_m: np.ndarray + area_reference_m2: float + shell_node_positions_m: np.ndarray + shell_node_position_low_m: np.ndarray + shell_node_actions: np.ndarray + shell_action: np.ndarray + beam_action: np.ndarray + gap: np.ndarray + generation: int + configuration: str + + @property + def law(self): + return LAW + + @property + def production_qualified(self): + return False + + def __post_init__(self): + count = len(self.shell_node_ids) + for name, shape in (("centroid_m", (3,)), ("centroid_low_m", (3,)), + ("beam_position_m", (3,)), ("beam_position_low_m", (3,)), + ("shell_node_positions_m", (count,3)), ("shell_node_position_low_m", (count,3)), + ("shell_node_actions", (count,6)), ("shell_action", (6,)), + ("beam_action", (6,)), ("gap", (6,))): + array = np.asarray(getattr(self, name)) + if array.shape != shape or not np.isfinite(array).all(): + raise DistributingPoseDomainError("finite owned distributing recovery required") + object.__setattr__(self, name, _owned(array)) + + +def wrench_record(assembly, reference, generation): + return FiniteDistributingFootprintWrench(reference.definition.footprint_id, + assembly.model_identity, assembly.candidate_identity, reference.host_element_ids, + reference.shell_node_ids, reference.beam_node_id, assembly.centroid, + assembly.centroid_low, assembly.beam_position, assembly.beam_position_low, + reference.area_m2, assembly.shell_positions, assembly.shell_position_low, + assembly.shell_node_actions, assembly.shell_action, assembly.beam_action, + assembly.gap, generation, "current") + + + +@dataclass(frozen=True) +class FiniteDistributingAssembly: + """Owned candidate work, local saddle block and explicit global scatter.""" + model_identity: str + candidate_identity: str + generation: int + slots: np.ndarray + residual: np.ndarray + tangent: sparse.csr_matrix + gap: np.ndarray + shell_positions: np.ndarray + shell_position_low: np.ndarray + beam_position: np.ndarray + beam_position_low: np.ndarray + shell_action: np.ndarray + beam_action: np.ndarray + shell_node_actions: np.ndarray + centroid: np.ndarray + centroid_low: np.ndarray + production_qualified: bool = False + owner_binding_authorized: bool = False + + def scatter(self, global_dimension): + if (type(global_dimension) is not int or global_dimension <= 0 or + self.slots.max() >= global_dimension): + raise ValueError("complete declared extended global dimension required") + matrix = self.tangent.tocoo() + tangent = sparse.coo_matrix((matrix.data, + (self.slots[matrix.row], self.slots[matrix.col])), + shape=(global_dimension, global_dimension)).tocsr() + residual = np.zeros(global_dimension) + np.add.at(residual, self.slots, self.residual) + return _owned(residual), _frozen_sparse(tangent) + + +class PreparedFiniteDistributingAttachment: + """Private reusable local operator compiled from an unadvanced owner. + + Current trial state is supplied explicitly, using the existing owner's + additive shell chart and spatial beam update. No model-wide hash/search + occurs during evaluation. A different/closed/recompiled owner is rejected. + """ + __slots__ = ("reference", "pose", "model_identity", "_owner", "_K", + "_shell_parts", "_count", "_shell_nodes", "_beam_node", "_sealed") + + def __setattr__(self, name, value): + if getattr(self, "_sealed", False): + raise AttributeError("prepared finite attachment is immutable") + object.__setattr__(self, name, value) + + def __init__(self, owner, definition): + _reference_owner(owner) + reference = _compile_reference_geometry(definition, + shell_parts=owner._shell_parts, shell_index=owner._shell_index, + shell_xyz=owner._shell_xyz, beam_index=owner._beam_index, + beam_nodes=owner._beam_nodes, shell_count=owner._shell_count, + global_dimension=owner._K.shape[0]) + self._bind(owner, reference, FiniteDistributingPose(reference)) + + @classmethod def _from_compiled(cls, owner, reference, pose): """Reuse the owner's own prepared map and pose without a second search.""" _reference_owner(owner, allow_finite_material=True) - if pose.reference_identity != reference.identity: - raise ValueError("matching finite pose and reference correspondence required") - instance = object.__new__(cls) - instance._bind(owner, reference, pose) - return instance - - def _bind(self, owner, reference, pose): - self.reference, self.pose = reference, pose - self.model_identity = owner._identity - self._owner = weakref.ref(owner) - self._K = owner._K - self._shell_parts = owner._shell_parts - self._count = owner._K.shape[0] - self._shell_nodes = _owned(np.array( - [owner._shell_index[node] for node in self.reference.shell_node_ids], dtype=np.int64)) - self._beam_node = owner._beam_index[self.reference.beam_node_id] - self._sealed = True - + if pose.reference_identity != reference.identity: + raise ValueError("matching finite pose and reference correspondence required") + instance = object.__new__(cls) + instance._bind(owner, reference, pose) + return instance + + def _bind(self, owner, reference, pose): + self.reference, self.pose = reference, pose + self.model_identity = owner._identity + self._owner = weakref.ref(owner) + self._K = owner._K + self._shell_parts = owner._shell_parts + self._count = owner._K.shape[0] + self._shell_nodes = _owned(np.array( + [owner._shell_index[node] for node in self.reference.shell_node_ids], dtype=np.int64)) + self._beam_node = owner._beam_index[self.reference.beam_node_id] + self._sealed = True + def descriptor(self): owner = self._owner() admitted = bool(owner is not None and owner._finite_distributing) @@ -181,62 +181,62 @@ def descriptor(self): scatter="LOCAL_SPARSE_SADDLE_BLOCK", accepted_state_owned=False, public_admission=admitted, owner_binding_authorized=admitted, checkpoint_admission=admitted) - - def evaluate(self, owner, state, multipliers, *, multiplier_row_start=0): - from ._stiffened_shell_ge_finite_experimental import _State, _position_pair - if (self._owner() is not owner or owner._identity != self.model_identity or - owner._K is not self._K or owner._shell_parts is not self._shell_parts): - raise ValueError("stale or different finite attachment owner") - owner._require_open() - if (type(state) is not _State or state.q.shape != (self._count,) or - state.frames.shape != (len(owner._beam_ids), 3, 3) or - type(multiplier_row_start) is not int or multiplier_row_start < 0): - raise ValueError("complete owner trial and explicit multiplier row start required") - nodes = self._shell_nodes - local_q = state.q[:owner._shell_count].reshape(-1, 6)[nodes] - anchors = (None if state.shell_anchors is None else state.shell_anchors[nodes]) - frames = physical_frames(local_q.ravel(), anchors) - pairs = [_position_pair(owner._shell_xyz[node], q[:3]) for node, q in zip(nodes, local_q)] - positions, low = np.array([v[0] for v in pairs]), np.array([v[1] for v in pairs]) - start = owner._shell_count+6*self._beam_node - beam, beam_low = _position_pair(owner._beam_nodes[self.reference.beam_node_id][0], state.q[start:start+3]) - try: - result = self.pose.evaluate(positions, frames, beam, state.frames[self._beam_node], - multipliers, shell_position_low=low, beam_position_low=beam_low) - except RotationDomainError as error: - raise DistributingPoseDomainError("finite distributing relative rotation requires cutback") from error - blocks = [] - for q in local_q: - left = _exp_terms(q[3:])[1] - if np.linalg.svd(left, compute_uv=False)[-1] <= 1e-11: - raise DistributingPoseDomainError("singular distributing shell chart; owner must rebase") - blocks.append(sparse.block_diag((np.eye(3), left), format="csr")) - blocks.append(sparse.eye(6, format="csr")) - columns = sparse.block_diag(blocks, format="csr") - C = sparse.csr_matrix(result.constraint_jacobian) - tangent = sparse.bmat(((result.spatial_jacobian@columns, C.T), - (C@columns, sparse.csr_matrix((6, 6)))), format="csr") - slots = np.r_[self.reference.gather_slots, - self._count+multiplier_row_start+np.arange(6, dtype=np.int64)] - # Exerted physical actions are minus the evaluated spatial work rows; - # raw Log multipliers are not recovered display moments. - action = -result.residual.reshape(-1, 6) - arms = np.array([[fsum((float(x[j]),float(xl[j]), - -float(result.shell_position[j]),-float(result.shell_position_low[j]))) - for j in range(3)] for x,xl in zip(positions,low)]) - with np.errstate(over="ignore", invalid="ignore"): - couples = np.cross(arms, action[:-1,:3])+action[:-1,3:] - if not np.isfinite(arms).all() or not np.isfinite(couples).all(): - raise DistributingPoseDomainError("unrepresentable distributing recovery moment") - try: - shell_action = np.array([fsum(float(v) for v in column) - for column in np.c_[action[:-1,:3], couples].T]) - except OverflowError as error: - raise DistributingPoseDomainError("unrepresentable distributing recovery resultant") from error - if not np.isfinite(shell_action).all(): - raise DistributingPoseDomainError("unrepresentable distributing recovery resultant") - return FiniteDistributingAssembly(self.model_identity, self.pose.identity, owner._generation, - _owned(slots), _owned(np.r_[result.residual,result.constraints]), _frozen_sparse(tangent), - result.constraints, _owned(positions), _owned(low), _owned(beam), _owned(beam_low), - _owned(shell_action), _owned(action[-1]), _owned(action[:-1]), - result.shell_position, result.shell_position_low) + + def evaluate(self, owner, state, multipliers, *, multiplier_row_start=0): + from ._stiffened_shell_ge_finite_experimental import _State, _position_pair + if (self._owner() is not owner or owner._identity != self.model_identity or + owner._K is not self._K or owner._shell_parts is not self._shell_parts): + raise ValueError("stale or different finite attachment owner") + owner._require_open() + if (type(state) is not _State or state.q.shape != (self._count,) or + state.frames.shape != (len(owner._beam_ids), 3, 3) or + type(multiplier_row_start) is not int or multiplier_row_start < 0): + raise ValueError("complete owner trial and explicit multiplier row start required") + nodes = self._shell_nodes + local_q = state.q[:owner._shell_count].reshape(-1, 6)[nodes] + anchors = (None if state.shell_anchors is None else state.shell_anchors[nodes]) + frames = physical_frames(local_q.ravel(), anchors) + pairs = [_position_pair(owner._shell_xyz[node], q[:3]) for node, q in zip(nodes, local_q)] + positions, low = np.array([v[0] for v in pairs]), np.array([v[1] for v in pairs]) + start = owner._shell_count+6*self._beam_node + beam, beam_low = _position_pair(owner._beam_nodes[self.reference.beam_node_id][0], state.q[start:start+3]) + try: + result = self.pose.evaluate(positions, frames, beam, state.frames[self._beam_node], + multipliers, shell_position_low=low, beam_position_low=beam_low) + except RotationDomainError as error: + raise DistributingPoseDomainError("finite distributing relative rotation requires cutback") from error + blocks = [] + for q in local_q: + left = _exp_terms(q[3:])[1] + if np.linalg.svd(left, compute_uv=False)[-1] <= 1e-11: + raise DistributingPoseDomainError("singular distributing shell chart; owner must rebase") + blocks.append(sparse.block_diag((np.eye(3), left), format="csr")) + blocks.append(sparse.eye(6, format="csr")) + columns = sparse.block_diag(blocks, format="csr") + C = sparse.csr_matrix(result.constraint_jacobian) + tangent = sparse.bmat(((result.spatial_jacobian@columns, C.T), + (C@columns, sparse.csr_matrix((6, 6)))), format="csr") + slots = np.r_[self.reference.gather_slots, + self._count+multiplier_row_start+np.arange(6, dtype=np.int64)] + # Exerted physical actions are minus the evaluated spatial work rows; + # raw Log multipliers are not recovered display moments. + action = -result.residual.reshape(-1, 6) + arms = np.array([[fsum((float(x[j]),float(xl[j]), + -float(result.shell_position[j]),-float(result.shell_position_low[j]))) + for j in range(3)] for x,xl in zip(positions,low)]) + with np.errstate(over="ignore", invalid="ignore"): + couples = np.cross(arms, action[:-1,:3])+action[:-1,3:] + if not np.isfinite(arms).all() or not np.isfinite(couples).all(): + raise DistributingPoseDomainError("unrepresentable distributing recovery moment") + try: + shell_action = np.array([fsum(float(v) for v in column) + for column in np.c_[action[:-1,:3], couples].T]) + except OverflowError as error: + raise DistributingPoseDomainError("unrepresentable distributing recovery resultant") from error + if not np.isfinite(shell_action).all(): + raise DistributingPoseDomainError("unrepresentable distributing recovery resultant") + return FiniteDistributingAssembly(self.model_identity, self.pose.identity, owner._generation, + _owned(slots), _owned(np.r_[result.residual,result.constraints]), _frozen_sparse(tangent), + result.constraints, _owned(positions), _owned(low), _owned(beam), _owned(beam_low), + _owned(shell_action), _owned(action[-1]), _owned(action[:-1]), + result.shell_position, result.shell_position_low) diff --git a/src/anyfesolver/_stiffened_shell_ge_pressure_load.py b/src/anyfesolver/_stiffened_shell_ge_pressure_load.py index 3429dfa57..b5d594563 100644 --- a/src/anyfesolver/_stiffened_shell_ge_pressure_load.py +++ b/src/anyfesolver/_stiffened_shell_ge_pressure_load.py @@ -1,55 +1,55 @@ -"""Owned shell interpolation-surface pressure, using existing native kernels. - -Reference-dead V2D S3 loads retain enhanced rotational covectors and are admitted -only for reference-linear work. Current-surface loads act on translations, with -the existing generally nonsymmetric spatial Jacobian and no invented potential. +"""Owned shell interpolation-surface pressure, using existing native kernels. + +Reference-dead V2D S3 loads retain enhanced rotational covectors and are admitted +only for reference-linear work. Current-surface loads act on translations, with +the existing generally nonsymmetric spatial Jacobian and no invented potential. The Q4 current-surface admission rejects degenerate quadrature stations instead of inheriting the old generic kernel's silent skip. No legacy kernel is changed. An explicitly selected director-enhanced S3 dead surface is a separate elastic development law, not a reinterpretation of the native reference-dead vector. -""" -from dataclasses import dataclass, field -from hashlib import sha256 -from types import SimpleNamespace - -import numpy as np -from scipy import sparse - -from .boundary import LoadCase, _SMALL -from .e4_pl_element import QualifiedE4PLShellElement as Q4 -from .e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement as S3 -from ._stiffened_shell_staged_load_experimental import _canonical, _identity, _number, _json -from ._stiffened_shell_ge_checkpoint_binary import MAX_CHECKPOINT_BYTES -from ._stiffened_shell_native_gravity import _owned, _sum, _product, _finite_array - +""" +from dataclasses import dataclass, field +from hashlib import sha256 +from types import SimpleNamespace + +import numpy as np +from scipy import sparse + +from .boundary import LoadCase, _SMALL +from .e4_pl_element import QualifiedE4PLShellElement as Q4 +from .e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement as S3 +from ._stiffened_shell_staged_load_experimental import _canonical, _identity, _number, _json +from ._stiffened_shell_ge_checkpoint_binary import MAX_CHECKPOINT_BYTES +from ._stiffened_shell_native_gravity import _owned, _sum, _product, _finite_array + POLICY = 'STIFFENED_SHELL_GE_NATIVE_SHELL_PRESSURE_LOAD_V1_DEV' DIRECTOR_CONFIGURATION = 'reference_dead_director_v2' DIRECTOR_LOAD_POLICY = 'STIFFENED_SHELL_GE_DIRECTOR_PRESSURE_LOAD_V2_DEV' VECTOR_EQUILIBRIUM_POLICY = 'STIFFENED_SHELL_PRESSURE_VECTOR_EQUILIBRIUM_V1_DEV' -MAGIC = b'ANYSGE_PRESS1\0' -MAX_METADATA_BYTES = 1024*1024 -MAX_ACTIONS = 16384 - - -@dataclass(frozen=True) -class GEShellPressureAction: - element_id: int - pressure_pa: float - configuration: str = 'reference_dead' - - def __post_init__(self): - if type(self.element_id) is not int or self.element_id <= 0: - raise ValueError('positive shell element identifier required') - object.__setattr__(self, 'pressure_pa', _number(self.pressure_pa)) - if self.pressure_pa == 0.: - raise ValueError('nonzero signed shell pressure required') +MAGIC = b'ANYSGE_PRESS1\0' +MAX_METADATA_BYTES = 1024*1024 +MAX_ACTIONS = 16384 + + +@dataclass(frozen=True) +class GEShellPressureAction: + element_id: int + pressure_pa: float + configuration: str = 'reference_dead' + + def __post_init__(self): + if type(self.element_id) is not int or self.element_id <= 0: + raise ValueError('positive shell element identifier required') + object.__setattr__(self, 'pressure_pa', _number(self.pressure_pa)) + if self.pressure_pa == 0.: + raise ValueError('nonzero signed shell pressure required') if type(self.configuration) is not str or self.configuration not in ('reference_dead', 'current_surface', DIRECTOR_CONFIGURATION): raise ValueError('explicit admitted shell pressure configuration required') - - def payload(self): - return dict(element_id=self.element_id, pressure_pa=self.pressure_pa, configuration=self.configuration) - - + + def payload(self): + return dict(element_id=self.element_id, pressure_pa=self.pressure_pa, configuration=self.configuration) + + @dataclass(frozen=True) class GEShellPressureLoad: """Owned pressure request with optional, checkpoint-bound finite assessment. @@ -62,21 +62,21 @@ class GEShellPressureLoad: actions: tuple[GEShellPressureAction,...] equilibrium_policy: str | None = None identity: str=field(init=False) - - def __post_init__(self): - object.__setattr__(self,'model_identity',_identity(self.model_identity)) + + def __post_init__(self): + object.__setattr__(self,'model_identity',_identity(self.model_identity)) if type(self.actions) is not tuple or not 0MAX_METADATA_BYTES:raise ValueError('bounded pressure descriptor required') - + ids=[a.element_id for a in self.actions] + if len(set(ids))!=len(ids):raise ValueError('duplicate shell pressure action element') + object.__setattr__(self,'actions',tuple(sorted(self.actions,key=lambda a:a.element_id))) + object.__setattr__(self,'identity',sha256(_canonical(self._core())).hexdigest()) + if len(self.serialize())>MAX_METADATA_BYTES:raise ValueError('bounded pressure descriptor required') + @property def policy(self): return (DIRECTOR_LOAD_POLICY if any(a.configuration == DIRECTOR_CONFIGURATION for a in self.actions) @@ -87,55 +87,55 @@ def _core(self): if self.equilibrium_policy is not None: core['equilibrium_policy'] = self.equilibrium_policy return core - - def to_payload(self):return dict(self._core(),identity=self.identity) - def serialize(self):return _canonical(self.to_payload()) - - @classmethod - def from_payload(cls,value): + + def to_payload(self):return dict(self._core(),identity=self.identity) + def serialize(self):return _canonical(self.to_payload()) + + @classmethod + def from_payload(cls,value): if (type(value) is not dict or set(value) not in ({'policy','model_identity','actions','identity'}, {'policy','model_identity','actions','identity','equilibrium_policy'}) or value['policy'] not in (POLICY, DIRECTOR_LOAD_POLICY) or type(value['actions']) is not list): - raise ValueError('strict pressure load descriptor required') - if not 0= owner._shell_count) - or not np.array_equal(slots.reshape(nodes, 6), slots[::6, None]+np.arange(6)) - or np.any(slots[::6] % 6) or len(set(slots.tolist())) != len(slots)): - raise ValueError('strict shell pressure coordinate mapping required') - xyz = _owned(shell_xyz[slots[::6]//6]) - binding = _binding(element, mesh) - native_xyz = _coordinates(element, mesh) - if not np.array_equal(xyz, native_xyz): - raise ValueError('pressure shell reference mapping mismatch') - load = LoadCase('GE shell pressure native kernel') - dead = None + slots = np.asarray(raw_slots) + nodes = len(element.node_ids) + if (slots.shape != (6*nodes,) or not np.issubdtype(slots.dtype, np.integer) + or np.any(slots < 0) or np.any(slots >= owner._shell_count) + or not np.array_equal(slots.reshape(nodes, 6), slots[::6, None]+np.arange(6)) + or np.any(slots[::6] % 6) or len(set(slots.tolist())) != len(slots)): + raise ValueError('strict shell pressure coordinate mapping required') + xyz = _owned(shell_xyz[slots[::6]//6]) + binding = _binding(element, mesh) + native_xyz = _coordinates(element, mesh) + if not np.array_equal(xyz, native_xyz): + raise ValueError('pressure shell reference mapping mismatch') + load = LoadCase('GE shell pressure native kernel') + dead = None if action.configuration in ('reference_dead', DIRECTOR_CONFIGURATION): - dead = _owned(_finite_array(load._consistent_pressure_load(element, mesh, action.pressure_pa), - (6*nodes,), 'native reference pressure covector')) - patch = _PressurePatch(action, element, mesh, tuple(int(v) for v in slots), xyz, binding, dead) - patches.append(patch) - identity = sha256(_canonical(dict(model=self.model_identity, pressure_load=self.identity))).hexdigest() - context = GEPressureContext(self, identity, count, tuple(patches)) - force, _, recovery = context.evaluate(SimpleNamespace(q=np.zeros(count))) - object.__setattr__(context, 'reference_gradient', force) - object.__setattr__(context, 'reference_recovery', recovery) - return context - - + dead = _owned(_finite_array(load._consistent_pressure_load(element, mesh, action.pressure_pa), + (6*nodes,), 'native reference pressure covector')) + patch = _PressurePatch(action, element, mesh, tuple(int(v) for v in slots), xyz, binding, dead) + patches.append(patch) + identity = sha256(_canonical(dict(model=self.model_identity, pressure_load=self.identity))).hexdigest() + context = GEPressureContext(self, identity, count, tuple(patches)) + force, _, recovery = context.evaluate(SimpleNamespace(q=np.zeros(count))) + object.__setattr__(context, 'reference_gradient', force) + object.__setattr__(context, 'reference_recovery', recovery) + return context + + def _coordinates(element, mesh): values = element._coordinates(mesh) if type(element) is S3 else element.get_node_coordinates(mesh) return _finite_array(values, (len(element.node_ids), 3), 'native pressure reference coordinates') @@ -341,26 +341,26 @@ def evaluate(self, state): def encode_checkpoint(context,inner): - if type(context) is not GEPressureContext or type(inner) is not bytes or not inner: - raise ValueError('compiled pressure context and checkpoint required') + if type(context) is not GEPressureContext or type(inner) is not bytes or not inner: + raise ValueError('compiled pressure context and checkpoint required') header=_canonical(dict(policy=context.request.policy,request=context.request.to_payload(),inner_sha256=sha256(inner).hexdigest())) - if len(header)>MAX_METADATA_BYTES or len(MAGIC)+4+len(header)+len(inner)+32>MAX_CHECKPOINT_BYTES: - raise ValueError('pressure checkpoint byte bound exceeded') - content=MAGIC+len(header).to_bytes(4,'little')+header+inner - return content+sha256(content).digest() - - -def decode_checkpoint(raw): - if type(raw) is not bytes or not raw.startswith(MAGIC) or not len(MAGIC)+4+32=len(raw)-32 or sha256(memoryview(raw)[:-32]).digest()!=raw[-32:]: - raise ValueError('pressure checkpoint bound/digest mismatch') - header_raw=raw[start:start+size];header=_json(header_raw) + if len(header)>MAX_METADATA_BYTES or len(MAGIC)+4+len(header)+len(inner)+32>MAX_CHECKPOINT_BYTES: + raise ValueError('pressure checkpoint byte bound exceeded') + content=MAGIC+len(header).to_bytes(4,'little')+header+inner + return content+sha256(content).digest() + + +def decode_checkpoint(raw): + if type(raw) is not bytes or not raw.startswith(MAGIC) or not len(MAGIC)+4+32=len(raw)-32 or sha256(memoryview(raw)[:-32]).digest()!=raw[-32:]: + raise ValueError('pressure checkpoint bound/digest mismatch') + header_raw=raw[start:start+size];header=_json(header_raw) if type(header) is not dict or set(header)!={'policy','request','inner_sha256'} or header['policy'] not in (POLICY, DIRECTOR_LOAD_POLICY) or _canonical(header)!=header_raw: - raise ValueError('strict pressure checkpoint metadata required') + raise ValueError('strict pressure checkpoint metadata required') request=GEShellPressureLoad.from_payload(header['request']);inner=raw[start+size:-32] if header['policy'] != request.policy: raise ValueError('pressure checkpoint work-law policy mismatch') - if sha256(inner).hexdigest()!=header['inner_sha256']:raise ValueError('pressure inner checkpoint mismatch') - return request,inner + if sha256(inner).hexdigest()!=header['inner_sha256']:raise ValueError('pressure inner checkpoint mismatch') + return request,inner diff --git a/src/anyfesolver/_stiffened_shell_ge_reference_modal.py b/src/anyfesolver/_stiffened_shell_ge_reference_modal.py index 9215bc715..840c2a910 100644 --- a/src/anyfesolver/_stiffened_shell_ge_reference_modal.py +++ b/src/anyfesolver/_stiffened_shell_ge_reference_modal.py @@ -1,72 +1,72 @@ -"""Experimental supported virgin Q4/native-GE point descriptor modes. - -The full mixed pencil is retained. Physical half-cell rotations have inertia; -nodal beam rotation traces, eighteen resultants/member, Q4 normal spin and point -multipliers do not. No static/Guyan reduction, tangent averaging or mass floor. -Requested pairs are nearest the declared shift, not a complete lowest spectrum. -""" -from dataclasses import dataclass -from hashlib import sha256 - -import numpy as np -from scipy import sparse -from scipy.sparse.linalg import LinearOperator, eigs, ArpackError - -from .control import CancellationToken, SolveCancelled, cancellation_safe_point -from .linalg import MatrixClass, factorize_cached -from ._native_reference_modal import _owned -from ._ge_beam3_p5_centered.mass import reference_kinetic_factors +"""Experimental supported virgin Q4/native-GE point descriptor modes. + +The full mixed pencil is retained. Physical half-cell rotations have inertia; +nodal beam rotation traces, eighteen resultants/member, Q4 normal spin and point +multipliers do not. No static/Guyan reduction, tangent averaging or mass floor. +Requested pairs are nearest the declared shift, not a complete lowest spectrum. +""" +from dataclasses import dataclass +from hashlib import sha256 + +import numpy as np +from scipy import sparse +from scipy.sparse.linalg import LinearOperator, eigs, ArpackError + +from .control import CancellationToken, SolveCancelled, cancellation_safe_point +from .linalg import MatrixClass, factorize_cached +from ._native_reference_modal import _owned +from ._ge_beam3_p5_centered.mass import reference_kinetic_factors from ._stiffened_shell_physical_q4_mass import physical_mass from ._stiffened_shell_physical_s3_mass import physical_mass as s3_physical_mass from ._stiffened_shell_ge_mixed_modal_mass import native_physical_mass -from ._stiffened_shell_b2_q4_panel_experimental import _modal_scaled_residual - -POLICY = "GE_Q4_POINT_SUPPORTED_VIRGIN_FULL_DESCRIPTOR_REFERENCE_MODES_V1_EXPERIMENTAL" -MASS_POLICY = "Q4_DIRECTOR_AND_CENTERED_NATIVE_FULL_CELL_INERTIA_24_POINT_V1" +from ._stiffened_shell_b2_q4_panel_experimental import _modal_scaled_residual + +POLICY = "GE_Q4_POINT_SUPPORTED_VIRGIN_FULL_DESCRIPTOR_REFERENCE_MODES_V1_EXPERIMENTAL" +MASS_POLICY = "Q4_DIRECTOR_AND_CENTERED_NATIVE_FULL_CELL_INERTIA_24_POINT_V1" GE_FREE_FREE_MODAL_ONLY_V1 = "GE_CONNECTED_Q4_POINT_FREE_FREE_MODAL_ONLY_V1_EXPERIMENTAL" MIXED_POLICY = "GE_FLAT_Q4_S3_NATIVE_VIRGIN_FULL_DESCRIPTOR_REFERENCE_MODES_V1_EXPERIMENTAL" MIXED_MASS_POLICY = "Q4_DIRECTOR_S3_LINEAR_NODAL_DIRECTOR_CENTERED_NATIVE_FULL_CELL_INERTIA_24_POINT_V1" GE_MIXED_FREE_FREE_MODAL_ONLY_V1 = "GE_FLAT_Q4_S3_POINT_FREE_FREE_MODAL_ONLY_V1_EXPERIMENTAL" - - -@dataclass(frozen=True) -class GEReferenceModesRequest: - count: int = 3 - shift_hz: float = 1. - max_iterations: int = 600 - - def __post_init__(self): - if (type(self.count) is not int or self.count <= 0 or - type(self.max_iterations) is not int or self.max_iterations <= 0 or - type(self.shift_hz) not in (int, float) or - not np.isfinite(self.shift_hz) or self.shift_hz <= 0.): - raise ValueError("positive finite GE reference-mode controls required") - - -@dataclass(frozen=True) + + +@dataclass(frozen=True) +class GEReferenceModesRequest: + count: int = 3 + shift_hz: float = 1. + max_iterations: int = 600 + + def __post_init__(self): + if (type(self.count) is not int or self.count <= 0 or + type(self.max_iterations) is not int or self.max_iterations <= 0 or + type(self.shift_hz) not in (int, float) or + not np.isfinite(self.shift_hz) or self.shift_hz <= 0.): + raise ValueError("positive finite GE reference-mode controls required") + + +@dataclass(frozen=True) class GEReferenceModesResult: - status: str - model_identity: str - mass_identity: str = "" - frequencies_hz: tuple[float, ...] = () - eigenvalues_rad2_s2: tuple[float, ...] = () - full_coordinates: tuple[np.ndarray, ...] = () - shell_modes: tuple[np.ndarray, ...] = () - beam_modes: tuple[np.ndarray, ...] = () - multiplier_modes: tuple[np.ndarray, ...] = () - support_reactions: tuple[np.ndarray, ...] = () - equation_residuals: tuple[float, ...] = () - constraint_residuals: tuple[float, ...] = () - physical_equation_residuals: tuple[float, ...] = () - zero_inertia_dofs: tuple[int, ...] = () - inverse_eigenvalues: tuple[complex, ...] = () - factorization_count: int = 0 - solve_count: int = 0 - shift_hz: float = 0. - failure_reason: str | None = None - policy: str = POLICY - mass_policy: str = MASS_POLICY - selection: str = "requested finite pairs nearest shift; completeness unqualified" + status: str + model_identity: str + mass_identity: str = "" + frequencies_hz: tuple[float, ...] = () + eigenvalues_rad2_s2: tuple[float, ...] = () + full_coordinates: tuple[np.ndarray, ...] = () + shell_modes: tuple[np.ndarray, ...] = () + beam_modes: tuple[np.ndarray, ...] = () + multiplier_modes: tuple[np.ndarray, ...] = () + support_reactions: tuple[np.ndarray, ...] = () + equation_residuals: tuple[float, ...] = () + constraint_residuals: tuple[float, ...] = () + physical_equation_residuals: tuple[float, ...] = () + zero_inertia_dofs: tuple[int, ...] = () + inverse_eigenvalues: tuple[complex, ...] = () + factorization_count: int = 0 + solve_count: int = 0 + shift_hz: float = 0. + failure_reason: str | None = None + policy: str = POLICY + mass_policy: str = MASS_POLICY + selection: str = "requested finite pairs nearest shift; completeness unqualified" production_qualified: bool = False @@ -85,48 +85,48 @@ def __post_init__(self): class GEMixedReferenceModesResult(GEReferenceModesResult): policy: str = MIXED_POLICY mass_policy: str = MIXED_MASS_POLICY - - -@dataclass(frozen=True) -class GEFreeReferenceModesResult: - """Separate zero-mode space and flexible requested pairs; no legacy schema change.""" - status: str - model_identity: str - flexible: GEReferenceModesResult - rigid_origin_m: tuple[float, float, float] = () - canonical_rigid_coordinates: tuple[np.ndarray, ...] = () - rigid_coordinates: tuple[np.ndarray, ...] = () - rigid_multipliers: tuple[np.ndarray, ...] = () - rigid_kinetic_gram: np.ndarray | None = None - rigid_equation_residuals: tuple[float, ...] = () - rigid_constraint_residuals: tuple[float, ...] = () - rigid_flexible_mass_overlap: float = 0. - spectral_shift_rad2_s2: float = 0. - failure_reason: str | None = None - policy: str = GE_FREE_FREE_MODAL_ONLY_V1 - selection: str = "six verified canonical rigid fields and flexible pairs nearest negative shift; completeness unqualified" - production_qualified: bool = False - - -class _ModalFailure(RuntimeError): - pass - - + + +@dataclass(frozen=True) +class GEFreeReferenceModesResult: + """Separate zero-mode space and flexible requested pairs; no legacy schema change.""" + status: str + model_identity: str + flexible: GEReferenceModesResult + rigid_origin_m: tuple[float, float, float] = () + canonical_rigid_coordinates: tuple[np.ndarray, ...] = () + rigid_coordinates: tuple[np.ndarray, ...] = () + rigid_multipliers: tuple[np.ndarray, ...] = () + rigid_kinetic_gram: np.ndarray | None = None + rigid_equation_residuals: tuple[float, ...] = () + rigid_constraint_residuals: tuple[float, ...] = () + rigid_flexible_mass_overlap: float = 0. + spectral_shift_rad2_s2: float = 0. + failure_reason: str | None = None + policy: str = GE_FREE_FREE_MODAL_ONLY_V1 + selection: str = "six verified canonical rigid fields and flexible pairs nearest negative shift; completeness unqualified" + production_qualified: bool = False + + +class _ModalFailure(RuntimeError): + pass + + def _admit(owner, *, mixed=False): owner._require_open() - if owner._definition.distributing_footprints or owner._definition.finite_distributing_footprints: + if owner._definition.distributing_footprints or owner._definition.finite_distributing_footprints: raise ValueError('spectral operations exclude reference-linear distributing footprints') if getattr(owner,"_curved_reference",False): raise ValueError("curved reference spectra are not admitted") definition = owner._definition if not mixed and definition.modal_boundary_policy == GE_MIXED_FREE_FREE_MODAL_ONLY_V1: raise ValueError("mixed free-free boundary requires GEMixedReferenceModesRequest") - if (owner._accepted is not None or owner._finite_driver is not None or - owner._generation != 0): - raise ValueError("GE reference modes require a fresh virgin owner without accepted histories") + if (owner._accepted is not None or owner._finite_driver is not None or + owner._generation != 0): + raise ValueError("GE reference modes require a fresh virgin owner without accepted histories") if not mixed and (definition.lines or definition.footprints or definition.shell.s3_elements or - definition.shell.j2_curve is not None or owner._has_physical_fibre or - not definition.points or (not definition.fixed and not owner._modal_only)): + definition.shell.j2_curve is not None or owner._has_physical_fibre or + not definition.points or (not definition.fixed and not owner._modal_only)): raise ValueError("virgin elastic Q4/generalized-GE six-pose points required; lines, footprints, S3 and materials unsupported") if mixed: from ._stiffened_shell_l1_assembly_experimental import ExperimentalBL5Line @@ -140,118 +140,118 @@ def _admit(owner, *, mixed=False): if any(len(slots) == 18 and getattr(element, "formulation_id", None) != FORMULATION_ID for _, element, slots, _ in owner._shell_parts): raise ValueError("S3 linear nodal director mass requires actual direct18 V2D owner; bubble families unsupported") - if owner._unsupported_modes: - raise ValueError(owner._unsupported_modes[0]) - # The shell's compile seam already requires one connected cell graph. - # Native components use declared node identity, never coordinate merging. - neighbours = {node: set() for node in owner._beam_ids} - for element, _, _ in owner._beam_parts: - for node in element.node_ids: - neighbours[node].update(element.node_ids) + if owner._unsupported_modes: + raise ValueError(owner._unsupported_modes[0]) + # The shell's compile seam already requires one connected cell graph. + # Native components use declared node identity, never coordinate merging. + neighbours = {node: set() for node in owner._beam_ids} + for element, _, _ in owner._beam_parts: + for node in element.node_ids: + neighbours[node].update(element.node_ids) linked = {point.beam_node for point in definition.points} if mixed: for line in definition.lines: for member, _ in line.beam_halfcells: linked.update(owner._beam_parts[member][0].node_ids) - unseen = set(neighbours) - while unseen: - start = min(unseen) - component = {start}; pending = [start] - while pending: - for other in neighbours[pending.pop()]-component: - component.add(other); pending.append(other) - if not component.intersection(linked): - raise ValueError("connected reference-modal panel requires every native beam component linked by a six-pose point to the shell") - unseen.difference_update(component) - # Bounded six-column physical rigid-field detectability, not a global - # stiffness/kernel test. Reject partial/free supports in this first scope. - rigid = np.zeros((owner._K.shape[0], 6)) - for offset, xyz in ((0, owner._shell_xyz), - (owner._shell_count, np.array([owner._beam_nodes[i][0] - for i in owner._beam_ids]))): - for i, position in enumerate(xyz): - row = offset+6*i - rigid[row:row+3, :3] = np.eye(3) - for j in range(3): - rigid[row:row+3, 3+j] = np.cross(np.eye(3)[j], position) - rigid[row+3:row+6, 3:] = np.eye(3) - if not owner._modal_only: - supported = rigid[owner._fixed] - scales = np.linalg.norm(supported, axis=0) - if np.any(scales == 0.): - raise ValueError("all six physical rigid fields require supported detectability") - singular = np.linalg.svd(supported/scales, compute_uv=False) - if len(singular) < 6 or singular[-1] <= 64*np.finfo(float).eps*max(supported.shape)*singular[0]: - raise ValueError("all six physical rigid fields require supported detectability") - for inertia in owner._reference_modal_inertias: - _physical_spatial_inertia(inertia) - - -def _physical_spatial_inertia(matrix): - """New-operation physical spatial admission; never project legacy input. - - Relative 128-epsilon budgets cover the bounded 3x3 arithmetic and eigen - evaluation. This is binary64 spatial realizability, not a planar-section - geometry certificate. The captured native tensor is used without changes. - """ - a = np.asarray(matrix) - if a.shape != (6, 6) or not np.isfinite(a).all() or not np.array_equal(a, a.T): - raise ValueError("explicit symmetric physical spatial inertia required") - eps = 128*np.finfo(float).eps - with np.errstate(over="ignore", invalid="ignore"): - m = float(np.trace(a[:3, :3])/3.) - if not np.isfinite(m): - raise ValueError("physical spatial inertia scalar mass is not representable") - translation_scale = max(float(np.max(abs(a[:3, :3]))), abs(m)) - if m <= 0. or np.max(abs(a[:3, :3]-m*np.eye(3))) > eps*translation_scale: - raise ValueError("physical spatial inertia translation must equal positive mass times identity") - cross = a[:3, 3:] - cross_scale = float(np.max(abs(cross), initial=0.)) - if np.max(abs(cross+cross.T), initial=0.) > eps*cross_scale: - raise ValueError("physical spatial inertia requires skew first-moment coupling") - # cross=-[h]x. Do not symmetrize/project the supplied cross block. - h = np.array((cross[1, 2], cross[2, 0], cross[0, 1])) - with np.errstate(over="ignore", invalid="ignore", divide="ignore"): - c = h/m - if not np.isfinite(c).all(): - raise ValueError("physical spatial inertia centroid is not representable") - with np.errstate(over="ignore", invalid="ignore"): - parallel = m*((c@c)*np.eye(3)-np.outer(c, c)) - if not np.isfinite(parallel).all(): - raise ValueError("physical spatial inertia parallel-axis term is not representable") - with np.errstate(over="ignore", invalid="ignore"): - central = a[3:, 3:]-parallel - second = .5*np.trace(central)*np.eye(3)-central - if not np.isfinite(central).all() or not np.isfinite(second).all(): - raise ValueError("physical spatial inertia central second moment is not representable") - scale = max(float(np.linalg.norm(a[3:, 3:], 2)), - float(np.linalg.norm(parallel, 2))) - budget = eps*scale - eigenvalues = np.linalg.eigvalsh(second) - if not np.isfinite(budget) or not np.isfinite(eigenvalues).all(): - raise ValueError("physical spatial inertia realizability evaluation is not representable") - if eigenvalues[0] < -budget: - raise ValueError("physical spatial inertia violates central second-moment realizability") - return m, c, central - - + unseen = set(neighbours) + while unseen: + start = min(unseen) + component = {start}; pending = [start] + while pending: + for other in neighbours[pending.pop()]-component: + component.add(other); pending.append(other) + if not component.intersection(linked): + raise ValueError("connected reference-modal panel requires every native beam component linked by a six-pose point to the shell") + unseen.difference_update(component) + # Bounded six-column physical rigid-field detectability, not a global + # stiffness/kernel test. Reject partial/free supports in this first scope. + rigid = np.zeros((owner._K.shape[0], 6)) + for offset, xyz in ((0, owner._shell_xyz), + (owner._shell_count, np.array([owner._beam_nodes[i][0] + for i in owner._beam_ids]))): + for i, position in enumerate(xyz): + row = offset+6*i + rigid[row:row+3, :3] = np.eye(3) + for j in range(3): + rigid[row:row+3, 3+j] = np.cross(np.eye(3)[j], position) + rigid[row+3:row+6, 3:] = np.eye(3) + if not owner._modal_only: + supported = rigid[owner._fixed] + scales = np.linalg.norm(supported, axis=0) + if np.any(scales == 0.): + raise ValueError("all six physical rigid fields require supported detectability") + singular = np.linalg.svd(supported/scales, compute_uv=False) + if len(singular) < 6 or singular[-1] <= 64*np.finfo(float).eps*max(supported.shape)*singular[0]: + raise ValueError("all six physical rigid fields require supported detectability") + for inertia in owner._reference_modal_inertias: + _physical_spatial_inertia(inertia) + + +def _physical_spatial_inertia(matrix): + """New-operation physical spatial admission; never project legacy input. + + Relative 128-epsilon budgets cover the bounded 3x3 arithmetic and eigen + evaluation. This is binary64 spatial realizability, not a planar-section + geometry certificate. The captured native tensor is used without changes. + """ + a = np.asarray(matrix) + if a.shape != (6, 6) or not np.isfinite(a).all() or not np.array_equal(a, a.T): + raise ValueError("explicit symmetric physical spatial inertia required") + eps = 128*np.finfo(float).eps + with np.errstate(over="ignore", invalid="ignore"): + m = float(np.trace(a[:3, :3])/3.) + if not np.isfinite(m): + raise ValueError("physical spatial inertia scalar mass is not representable") + translation_scale = max(float(np.max(abs(a[:3, :3]))), abs(m)) + if m <= 0. or np.max(abs(a[:3, :3]-m*np.eye(3))) > eps*translation_scale: + raise ValueError("physical spatial inertia translation must equal positive mass times identity") + cross = a[:3, 3:] + cross_scale = float(np.max(abs(cross), initial=0.)) + if np.max(abs(cross+cross.T), initial=0.) > eps*cross_scale: + raise ValueError("physical spatial inertia requires skew first-moment coupling") + # cross=-[h]x. Do not symmetrize/project the supplied cross block. + h = np.array((cross[1, 2], cross[2, 0], cross[0, 1])) + with np.errstate(over="ignore", invalid="ignore", divide="ignore"): + c = h/m + if not np.isfinite(c).all(): + raise ValueError("physical spatial inertia centroid is not representable") + with np.errstate(over="ignore", invalid="ignore"): + parallel = m*((c@c)*np.eye(3)-np.outer(c, c)) + if not np.isfinite(parallel).all(): + raise ValueError("physical spatial inertia parallel-axis term is not representable") + with np.errstate(over="ignore", invalid="ignore"): + central = a[3:, 3:]-parallel + second = .5*np.trace(central)*np.eye(3)-central + if not np.isfinite(central).all() or not np.isfinite(second).all(): + raise ValueError("physical spatial inertia central second moment is not representable") + scale = max(float(np.linalg.norm(a[3:, 3:], 2)), + float(np.linalg.norm(parallel, 2))) + budget = eps*scale + eigenvalues = np.linalg.eigvalsh(second) + if not np.isfinite(budget) or not np.isfinite(eigenvalues).all(): + raise ValueError("physical spatial inertia realizability evaluation is not representable") + if eigenvalues[0] < -budget: + raise ValueError("physical spatial inertia violates central second-moment realizability") + return m, c, central + + def capabilities(owner): - """Separate explicit route descriptor; legacy capability schema is unchanged.""" - reason = None - try: - _admit(owner) - except (ValueError, RuntimeError) as exc: - reason = str(exc) - free = owner._modal_only - return dict(policy=GE_FREE_FREE_MODAL_ONLY_V1 if free else POLICY, mass_policy=MASS_POLICY, - status="EXPERIMENTAL_NOT_QUALIFIED", operation="modes", scope=("connected free-free virgin Q4/GE point panel modal-only" if free else "connected supported virgin Q4/GE point panel reference only"), - eligible=reason is None, ineligibility_reason=reason, - mass_source="explicit native definition inertia; explicit shell density and thickness", - mass_admission="binary64 physical 3D spatial inertia; planar section realizability unqualified", - inertia="nodal translations and six native half-cell rotations; tangential shell directors", - algebraic="native nodal rotation traces, eighteen resultants/member, Q4 normal spin and multipliers", - selection=("six canonical rigid fields and requested flexible pairs nearest negative shift; completeness unqualified" if free else "requested finite pairs nearest shift; completeness unqualified"), - excluded=(("static solve", "finite solve", "restore", "chart state writes") if free else ("free-free",))+("prestress", "buckling", "finite dynamics", "accepted material histories", "S3", "line", "footprint"), + """Separate explicit route descriptor; legacy capability schema is unchanged.""" + reason = None + try: + _admit(owner) + except (ValueError, RuntimeError) as exc: + reason = str(exc) + free = owner._modal_only + return dict(policy=GE_FREE_FREE_MODAL_ONLY_V1 if free else POLICY, mass_policy=MASS_POLICY, + status="EXPERIMENTAL_NOT_QUALIFIED", operation="modes", scope=("connected free-free virgin Q4/GE point panel modal-only" if free else "connected supported virgin Q4/GE point panel reference only"), + eligible=reason is None, ineligibility_reason=reason, + mass_source="explicit native definition inertia; explicit shell density and thickness", + mass_admission="binary64 physical 3D spatial inertia; planar section realizability unqualified", + inertia="nodal translations and six native half-cell rotations; tangential shell directors", + algebraic="native nodal rotation traces, eighteen resultants/member, Q4 normal spin and multipliers", + selection=("six canonical rigid fields and requested flexible pairs nearest negative shift; completeness unqualified" if free else "requested finite pairs nearest shift; completeness unqualified"), + excluded=(("static solve", "finite solve", "restore", "chart state writes") if free else ("free-free",))+("prestress", "buckling", "finite dynamics", "accepted material histories", "S3", "line", "footprint"), production_qualified=False) @@ -273,308 +273,308 @@ def mixed_capabilities(owner): excluded=("accepted histories", "prestress", "active plasticity", "shell J2", "material BL5", "chart state", "curved shell", "footprints"), production_qualified=False) - - + + def _assemble_mass(owner, check=lambda stage: None, *, mixed=False): - """Reuse physical local kinetic laws and the owner's authoritative slots.""" + """Reuse physical local kinetic laws and the owner's authoritative slots.""" cache_name = "_mixed_reference_modal_mass" if mixed else "_reference_modal_mass" cached = getattr(owner, cache_name, None) if cached is not None: check("cached_mass") return cached - rows = []; columns = []; values = [] - zero = {6*i+5 for i in range(len(owner._shell_ids))} - offset = owner._shell_count - zero.update(offset+6*i+j for i in range(len(owner._beam_ids)) for j in (3, 4, 5)) - def scatter(slots, matrix): - rows.extend(np.repeat(slots, len(slots))) - columns.extend(np.tile(slots, len(slots))) - values.extend(matrix.ravel()) - panel = owner._definition.shell - for _, _, slots, _ in owner._shell_parts: - check("shell_mass") - vertices = owner._shell_xyz[np.asarray(slots)[::6]//6] + rows = []; columns = []; values = [] + zero = {6*i+5 for i in range(len(owner._shell_ids))} + offset = owner._shell_count + zero.update(offset+6*i+j for i in range(len(owner._beam_ids)) for j in (3, 4, 5)) + def scatter(slots, matrix): + rows.extend(np.repeat(slots, len(slots))) + columns.extend(np.tile(slots, len(slots))) + values.extend(matrix.ravel()) + panel = owner._definition.shell + for _, _, slots, _ in owner._shell_parts: + check("shell_mass") + vertices = owner._shell_xyz[np.asarray(slots)[::6]//6] law = s3_physical_mass if mixed and len(slots) == 18 else physical_mass scatter(slots, law(vertices, density_kg_m3=panel.density_kg_m3, - thickness_m=panel.thickness_m)) - for inertia, (element, slots, _) in zip(owner._reference_modal_inertias, owner._beam_parts): - check("beam_mass") - _physical_spatial_inertia(inertia) + thickness_m=panel.thickness_m)) + for inertia, (element, slots, _) in zip(owner._reference_modal_inertias, owner._beam_parts): + check("beam_mass") + _physical_spatial_inertia(inertia) if mixed: local = native_physical_mass(element.operator.reference, inertia) else: factors = reference_kinetic_factors(element.operator.reference, element.section.elastic, inertia, order=24) local = factors.full.T@factors.full - if not np.isfinite(local).all(): - raise ValueError("finite explicit native reference inertia required") - # slots are beam-local global incidences; the first24 retain nodal18 - # and inertial cell6. The following eighteen resultants stay massless. - scatter(offset+slots[:24], local) - zero.update(int(offset+slot) for slot in slots[24:]) - mass = sparse.coo_matrix((values, (rows, columns)), shape=owner._K.shape).tocsr() - mass.sum_duplicates(); mass.eliminate_zeros(); mass.sort_indices() - zero = tuple(sorted(zero)) - if (not np.isfinite(mass.data).all() or mass[:, zero].nnz or mass[zero, :].nnz): - raise ValueError("declared reference algebraic inertia must be exactly absent") - if np.any(mass.diagonal()[[i for i in range(mass.shape[0]) if i not in zero]] <= 0.): - raise ValueError("positive physical reference coordinate inertia required") - digest = sha256() + if not np.isfinite(local).all(): + raise ValueError("finite explicit native reference inertia required") + # slots are beam-local global incidences; the first24 retain nodal18 + # and inertial cell6. The following eighteen resultants stay massless. + scatter(offset+slots[:24], local) + zero.update(int(offset+slot) for slot in slots[24:]) + mass = sparse.coo_matrix((values, (rows, columns)), shape=owner._K.shape).tocsr() + mass.sum_duplicates(); mass.eliminate_zeros(); mass.sort_indices() + zero = tuple(sorted(zero)) + if (not np.isfinite(mass.data).all() or mass[:, zero].nnz or mass[zero, :].nnz): + raise ValueError("declared reference algebraic inertia must be exactly absent") + if np.any(mass.diagonal()[[i for i in range(mass.shape[0]) if i not in zero]] <= 0.): + raise ValueError("positive physical reference coordinate inertia required") + digest = sha256() digest.update(owner._identity.encode("ascii")) digest.update((MIXED_MASS_POLICY if mixed else MASS_POLICY).encode("ascii")) - for array in (mass.indptr, mass.indices, mass.data): digest.update(array.tobytes()) - # Immutable byte-backed arrays; publication only after complete preparation. - for name in ("data", "indices", "indptr"): - array = getattr(mass, name) - setattr(mass, name, np.frombuffer(array.tobytes(), dtype=array.dtype)) - check("mass_publish") + for array in (mass.indptr, mass.indices, mass.data): digest.update(array.tobytes()) + # Immutable byte-backed arrays; publication only after complete preparation. + for name in ("data", "indices", "indptr"): + array = getattr(mass, name) + setattr(mass, name, np.frombuffer(array.tobytes(), dtype=array.dtype)) + check("mass_publish") result = (mass, zero, digest.hexdigest()) setattr(owner, cache_name, result) return result - - -def _congruence(owner, A, B): - # Reuse the established scale calculation with its correct native packing, - # exclusively for this new route. No legacy solve or stored scale changes. - from ._stiffened_shell_ge_experimental import _reference_scales - _, shell, beam = _reference_scales(owner._shell_xyz, owner._beam_nodes, - owner._beam_parts, owner._shell_count, owner._beam_count, - footprint_retained_roles=True) - primal = np.r_[shell, beam][owner._free] - Dp = sparse.diags(primal) - weighted = (Dp@owner._K[owner._free, :][:, owner._free]@Dp).tocsr() - work = float(np.max(np.abs(weighted.data), initial=0.)) - if not np.isfinite(work) or work <= 0.: - raise _ModalFailure("positive representable reference work scale required") - scale = np.r_[primal/np.sqrt(work), np.sqrt(work)/owner._constraint_scale] - if not np.isfinite(scale).all() or np.any(scale <= 0.): - raise _ModalFailure("reference modal congruence is not representable") - D = sparse.diags(scale) - As, Bs = (D@A@D).tocsc(), (D@B@D).tocsc() - for original, scaled in ((A, As), (B, Bs)): - old = original.copy(); old.eliminate_zeros(); old.sort_indices() - scaled.eliminate_zeros(); scaled.sort_indices() - if (not np.isfinite(scaled.data).all() or old.nnz != scaled.nnz or - not np.array_equal(old.indptr, scaled.indptr) or - not np.array_equal(old.indices, scaled.indices)): - raise _ModalFailure("modal matrix entries lost through congruence") - denominator = float(np.max(np.abs(scaled.data), initial=0.)) - delta = scaled-scaled.T - if denominator == 0. or np.max(np.abs(delta.data), initial=0.) > 1e-10*denominator: - raise _ModalFailure("conservative reference pencil symmetry unresolved; no averaging permitted") - return As, Bs, scale - - -def _free_rigid_space(owner, mass, scale, Bs, check): - """Six physical common-body velocities; only a bounded 6x6 Gram solve.""" - origin = owner._shell_xyz.mean(axis=0) - R = np.zeros((owner._K.shape[0], 6)) - for offset, xyz in ((0, owner._shell_xyz), - (owner._shell_count, np.array([owner._beam_nodes[i][0] - for i in owner._beam_ids]))): - for i, position in enumerate(xyz): - row = offset+6*i - R[row:row+3, :3] = np.eye(3) - for j in range(3): - R[row:row+3, 3+j] = np.cross(np.eye(3)[j], position-origin) - R[row+3:row+6, 3:] = np.eye(3) - for _, slots, _ in owner._beam_parts: - R[owner._shell_count+slots[18:21], 3:] = np.eye(3) - R[owner._shell_count+slots[21:24], 3:] = np.eye(3) - n = len(owner._free) - equations = []; gaps = [] - for column in R.T: - check("rigid_field") - equation = _modal_scaled_residual(owner._K@column, - abs(owner._K)@abs(column), scale[:n]) - gap = _modal_scaled_residual(owner._C@column, - abs(owner._C)@abs(column), scale[n:]) - if equation > 1e-8 or gap > 1e-9: - raise _ModalFailure("canonical free-free rigid field violates physical K or point C") - equations.append(equation); gaps.append(gap) - gram = R.T@mass@R - if (not np.isfinite(gram).all() or - np.max(abs(gram-gram.T)) > 1e-10*np.max(abs(gram))): - raise _ModalFailure("canonical rigid kinetic Gram symmetry unresolved") - try: - lower = np.linalg.cholesky(gram) - W = R@np.linalg.solve(lower.T, np.eye(6)) - except np.linalg.LinAlgError as exc: - raise _ModalFailure("six physical rigid fields require positive kinetic Gram") from exc - if (not np.isfinite(W).all() or - np.max(abs(W.T@mass@W-np.eye(6))) > 1e-7): - raise _ModalFailure("rigid kinetic normalization unresolved") - Ws = np.vstack((W, np.zeros((owner._C.shape[0], 6))))/scale[:, None] - if not np.isfinite(Ws).all() or np.max(abs(Ws.T@Bs@Ws-np.eye(6))) > 1e-7: - raise _ModalFailure("rigid congruence reconstruction unresolved") - return dict(origin=tuple(map(float, origin)), canonical=R, normalized=W, - scaled=Ws, gram=gram, equations=tuple(equations), gaps=tuple(gaps)) - - + + +def _congruence(owner, A, B): + # Reuse the established scale calculation with its correct native packing, + # exclusively for this new route. No legacy solve or stored scale changes. + from ._stiffened_shell_ge_experimental import _reference_scales + _, shell, beam = _reference_scales(owner._shell_xyz, owner._beam_nodes, + owner._beam_parts, owner._shell_count, owner._beam_count, + footprint_retained_roles=True) + primal = np.r_[shell, beam][owner._free] + Dp = sparse.diags(primal) + weighted = (Dp@owner._K[owner._free, :][:, owner._free]@Dp).tocsr() + work = float(np.max(np.abs(weighted.data), initial=0.)) + if not np.isfinite(work) or work <= 0.: + raise _ModalFailure("positive representable reference work scale required") + scale = np.r_[primal/np.sqrt(work), np.sqrt(work)/owner._constraint_scale] + if not np.isfinite(scale).all() or np.any(scale <= 0.): + raise _ModalFailure("reference modal congruence is not representable") + D = sparse.diags(scale) + As, Bs = (D@A@D).tocsc(), (D@B@D).tocsc() + for original, scaled in ((A, As), (B, Bs)): + old = original.copy(); old.eliminate_zeros(); old.sort_indices() + scaled.eliminate_zeros(); scaled.sort_indices() + if (not np.isfinite(scaled.data).all() or old.nnz != scaled.nnz or + not np.array_equal(old.indptr, scaled.indptr) or + not np.array_equal(old.indices, scaled.indices)): + raise _ModalFailure("modal matrix entries lost through congruence") + denominator = float(np.max(np.abs(scaled.data), initial=0.)) + delta = scaled-scaled.T + if denominator == 0. or np.max(np.abs(delta.data), initial=0.) > 1e-10*denominator: + raise _ModalFailure("conservative reference pencil symmetry unresolved; no averaging permitted") + return As, Bs, scale + + +def _free_rigid_space(owner, mass, scale, Bs, check): + """Six physical common-body velocities; only a bounded 6x6 Gram solve.""" + origin = owner._shell_xyz.mean(axis=0) + R = np.zeros((owner._K.shape[0], 6)) + for offset, xyz in ((0, owner._shell_xyz), + (owner._shell_count, np.array([owner._beam_nodes[i][0] + for i in owner._beam_ids]))): + for i, position in enumerate(xyz): + row = offset+6*i + R[row:row+3, :3] = np.eye(3) + for j in range(3): + R[row:row+3, 3+j] = np.cross(np.eye(3)[j], position-origin) + R[row+3:row+6, 3:] = np.eye(3) + for _, slots, _ in owner._beam_parts: + R[owner._shell_count+slots[18:21], 3:] = np.eye(3) + R[owner._shell_count+slots[21:24], 3:] = np.eye(3) + n = len(owner._free) + equations = []; gaps = [] + for column in R.T: + check("rigid_field") + equation = _modal_scaled_residual(owner._K@column, + abs(owner._K)@abs(column), scale[:n]) + gap = _modal_scaled_residual(owner._C@column, + abs(owner._C)@abs(column), scale[n:]) + if equation > 1e-8 or gap > 1e-9: + raise _ModalFailure("canonical free-free rigid field violates physical K or point C") + equations.append(equation); gaps.append(gap) + gram = R.T@mass@R + if (not np.isfinite(gram).all() or + np.max(abs(gram-gram.T)) > 1e-10*np.max(abs(gram))): + raise _ModalFailure("canonical rigid kinetic Gram symmetry unresolved") + try: + lower = np.linalg.cholesky(gram) + W = R@np.linalg.solve(lower.T, np.eye(6)) + except np.linalg.LinAlgError as exc: + raise _ModalFailure("six physical rigid fields require positive kinetic Gram") from exc + if (not np.isfinite(W).all() or + np.max(abs(W.T@mass@W-np.eye(6))) > 1e-7): + raise _ModalFailure("rigid kinetic normalization unresolved") + Ws = np.vstack((W, np.zeros((owner._C.shape[0], 6))))/scale[:, None] + if not np.isfinite(Ws).all() or np.max(abs(Ws.T@Bs@Ws-np.eye(6))) > 1e-7: + raise _ModalFailure("rigid congruence reconstruction unresolved") + return dict(origin=tuple(map(float, origin)), canonical=R, normalized=W, + scaled=Ws, gram=gram, equations=tuple(equations), gaps=tuple(gaps)) + + def solve(owner, request, *, cancellation_token=None): mixed = type(request) is GEMixedReferenceModesRequest _admit(owner, mixed=mixed) if type(request) not in (GEReferenceModesRequest, GEMixedReferenceModesRequest): - raise ValueError("typed GE reference-mode request required") - if cancellation_token is not None and not isinstance(cancellation_token, CancellationToken): - raise ValueError("CancellationToken required") - n = len(owner._free); r = owner._C.shape[0] - if request.count >= n+r-1: - raise ValueError("reference mode count must leave sparse Arnoldi room") - sigma = float((2*np.pi*request.shift_hz)**2) - if not np.isfinite(sigma) or sigma <= 0.: - raise ValueError("positive representable squared reference frequency required") - free = owner._modal_only - if free: sigma = -sigma - handle = None; raw = (); mass_id = ""; zero = () - rigid = None; overlap = 0. - def check(stage): - cancellation_safe_point(cancellation_token, "ge_reference_modes."+stage) - def finish(status, **kwargs): - if free: - kwargs.update(policy=GE_FREE_FREE_MODAL_ONLY_V1, - selection="flexible finite pairs nearest negative shift; completeness unqualified") + raise ValueError("typed GE reference-mode request required") + if cancellation_token is not None and not isinstance(cancellation_token, CancellationToken): + raise ValueError("CancellationToken required") + n = len(owner._free); r = owner._C.shape[0] + if request.count >= n+r-1: + raise ValueError("reference mode count must leave sparse Arnoldi room") + sigma = float((2*np.pi*request.shift_hz)**2) + if not np.isfinite(sigma) or sigma <= 0.: + raise ValueError("positive representable squared reference frequency required") + free = owner._modal_only + if free: sigma = -sigma + handle = None; raw = (); mass_id = ""; zero = () + rigid = None; overlap = 0. + def check(stage): + cancellation_safe_point(cancellation_token, "ge_reference_modes."+stage) + def finish(status, **kwargs): + if free: + kwargs.update(policy=GE_FREE_FREE_MODAL_ONLY_V1, + selection="flexible finite pairs nearest negative shift; completeness unqualified") if mixed: kwargs["policy"] = GE_MIXED_FREE_FREE_MODAL_ONLY_V1 if free else MIXED_POLICY result_type = GEMixedReferenceModesResult if mixed else GEReferenceModesResult flexible = result_type(status, owner._identity, mass_id, - zero_inertia_dofs=zero, inverse_eigenvalues=raw, - factorization_count=handle.factorization_count if handle else 0, - solve_count=handle.solve_count if handle else 0, - shift_hz=float(request.shift_hz), **kwargs) - if not free: return flexible - data = {} - if status == "completed": - data = dict(rigid_origin_m=rigid["origin"], - canonical_rigid_coordinates=tuple(_owned(x) for x in rigid["canonical"].T), - rigid_coordinates=tuple(_owned(x) for x in rigid["normalized"].T), - rigid_multipliers=tuple(_owned(np.zeros(r)) for _ in range(6)), - rigid_kinetic_gram=_owned(rigid["gram"]), - rigid_equation_residuals=rigid["equations"], - rigid_constraint_residuals=rigid["gaps"], - rigid_flexible_mass_overlap=overlap) + zero_inertia_dofs=zero, inverse_eigenvalues=raw, + factorization_count=handle.factorization_count if handle else 0, + solve_count=handle.solve_count if handle else 0, + shift_hz=float(request.shift_hz), **kwargs) + if not free: return flexible + data = {} + if status == "completed": + data = dict(rigid_origin_m=rigid["origin"], + canonical_rigid_coordinates=tuple(_owned(x) for x in rigid["canonical"].T), + rigid_coordinates=tuple(_owned(x) for x in rigid["normalized"].T), + rigid_multipliers=tuple(_owned(np.zeros(r)) for _ in range(6)), + rigid_kinetic_gram=_owned(rigid["gram"]), + rigid_equation_residuals=rigid["equations"], + rigid_constraint_residuals=rigid["gaps"], + rigid_flexible_mass_overlap=overlap) if mixed: data["policy"] = GE_MIXED_FREE_FREE_MODAL_ONLY_V1 return GEFreeReferenceModesResult(status, owner._identity, flexible, - spectral_shift_rad2_s2=sigma, failure_reason=flexible.failure_reason, **data) - try: - check("start") + spectral_shift_rad2_s2=sigma, failure_reason=flexible.failure_reason, **data) + try: + check("start") mass, zero, mass_id = _assemble_mass(owner, check, mixed=mixed) - B = sparse.block_diag((mass[owner._free, :][:, owner._free], - sparse.csc_matrix((r, r))), format="csc") - A = owner._A.copy() - As, Bs, scale = _congruence(owner, A, B) - if free: - rigid = _free_rigid_space(owner, mass, scale, Bs, check) - def project(vector): - if not free: return vector - return vector-rigid["scaled"]@(rigid["scaled"].T@(Bs@vector)) - check("before_factorization") - handle = factorize_cached((As-sigma*Bs).tocsc(), MatrixClass.GENERAL) - if handle.status != "ok": - raise _ModalFailure("reference modal factorization failed: "+str(handle.failure_reason)) - def action(vector): - check("iteration") - try: - answer = np.asarray(handle.solve(Bs@project(vector)), dtype=float) - except RuntimeError as exc: - if (str(exc) == "Sparse solve produced NaN/Inf values" or - str(exc).startswith("Cannot solve with failed factorization:")): - raise _ModalFailure("reference modal sparse solve failed: "+str(exc)) from exc - raise - if not np.isfinite(answer).all(): - raise _ModalFailure("finite reference modal inverse action required") - check("iteration_complete") - return project(answer) - values, vectors = eigs(LinearOperator(A.shape, matvec=action, dtype=float), - k=request.count, which="LM", tol=1e-10, maxiter=request.max_iterations, - v0=np.linspace(1., 2., A.shape[0])) - raw = tuple(map(complex, values)) - check("after_iteration") - abs_A, abs_B = abs(A), abs(B) - pairs = [] - for mu, vector in zip(values, vectors.T): - if (not np.isfinite(mu) or mu.real == 0. or - abs(mu.imag) > 1e-8*abs(mu.real) or - np.max(abs(vector.imag)) > 1e-8*np.max(abs(vector.real))): - raise _ModalFailure("nonphysical or unresolved finite reference pair") - eigenvalue = sigma+1./float(mu.real) - if free: - # Retain the separate shift/reconstruction cancellation guard. - roundoff_screen = 64*np.finfo(float).eps*A.shape[0]*(abs(sigma)+abs(1./float(mu.real))) - if not np.isfinite(roundoff_screen) or eigenvalue <= roundoff_screen: - raise _ModalFailure("extra mechanism or unresolved near-zero flexible pair") - x = scale*np.asarray(vector.real) - q = np.zeros(owner._K.shape[0]); q[owner._free] = x[:n] - if free: - # Physical quadratic-work resolution screen on the reconstructed - # candidate (the congruence inverse applied to the Krylov vector). - # The pair is resolvable only when its inertial quadratic work - # exceeds the abs-coefficient quadratic-work roundoff of this - # candidate's elastic and descriptor constraint work. Both sides - # are physical energy, so the decision is invariant under - # equivalent diagonal unit/coordinate rescalings. Absolute-entry - # bounds can vary under general frame rotations; this is a - # conservative resolution screen, not a frame-invariance proof. - # Its coefficient uncertainty uses no fitted eigenvalue or shift. Cancellation/roundoff - # screen only: not a certified Arnoldi/LU eigenvalue error bound - # or exactly-six nullity proof. - kinetic = float(q@mass@q) - work = eigenvalue*kinetic - uncertainty = 64*np.finfo(float).eps*A.shape[0]*( - float((abs(owner._K)@abs(q))@abs(q))+ - 2.*float((abs(owner._C).T@abs(x[n:]))@abs(q))) - if (not np.isfinite(work) or not np.isfinite(uncertainty) or - work <= uncertainty): - raise _ModalFailure("extra mechanism or unresolved near-zero flexible pair") - norm = float(q@mass@q) - if not np.isfinite(eigenvalue) or eigenvalue <= 0. or not np.isfinite(norm) or norm <= 0.: - raise _ModalFailure("positive finite eigenvalue and physical modal mass required") - x /= np.sqrt(norm); q /= np.sqrt(norm) - if not np.isfinite(x).all() or not np.isfinite(q).all(): - raise _ModalFailure("physical reference mode normalization is not representable") - # Sign uses physical inertial coordinates, not massless resultants. - physical_slots = np.setdiff1d(np.arange(len(q)), zero) - largest = physical_slots[int(np.argmax(np.abs(q[physical_slots])))] - if q[largest] < 0.: x = -x; q = -q - lam = x[n:] - residual = A@x-eigenvalue*(B@x) - bound = abs_A@abs(x)+abs(eigenvalue)*(abs_B@abs(x)) - equation = _modal_scaled_residual(residual, bound, scale) - gap = owner._C@q - constraint = _modal_scaled_residual(gap, abs(owner._C)@abs(q), scale[n:]) - reactions = owner._K@q+owner._C.T@lam-eigenvalue*(mass@q) - physical_bound = abs(owner._K)@abs(q)+abs(owner._C.T)@abs(lam)+abs(eigenvalue)*(abs(mass)@abs(q)) - physical = _modal_scaled_residual(reactions[owner._free], - physical_bound[owner._free], scale[:n]) - if equation > 1e-8 or physical > 1e-8 or constraint > 1e-9: - raise _ModalFailure("reference modal physical equation or constraint residual failed") - pairs.append((float(eigenvalue), _owned(q), _owned(lam), _owned(reactions), - equation, constraint, physical)) - pairs.sort(key=lambda item: item[0]) - modes = np.column_stack([pair[1] for pair in pairs]) - gram = modes.T@mass@modes - if not np.isfinite(gram).all() or np.max(abs(gram-np.eye(request.count))) > 1e-7: - raise _ModalFailure("physical reference modal mass orthogonality failed") - if free: - overlap = float(np.max(abs(rigid["normalized"].T@mass@modes))) - if not np.isfinite(overlap) or overlap > 1e-7: - raise _ModalFailure("rigid and flexible physical mode spaces not mass orthogonal") - check("publish") - return finish("completed", frequencies_hz=tuple(np.sqrt(p[0])/(2*np.pi) for p in pairs), - eigenvalues_rad2_s2=tuple(p[0] for p in pairs), - full_coordinates=tuple(p[1] for p in pairs), - shell_modes=tuple(_owned(p[1][:owner._shell_count]) for p in pairs), - beam_modes=tuple(_owned(p[1][owner._shell_count:]) for p in pairs), - multiplier_modes=tuple(p[2] for p in pairs), support_reactions=tuple(p[3] for p in pairs), - equation_residuals=tuple(p[4] for p in pairs), - constraint_residuals=tuple(p[5] for p in pairs), - physical_equation_residuals=tuple(p[6] for p in pairs)) - except SolveCancelled as exc: - return finish("cancelled", failure_reason=str(exc)) - except (ArpackError, _ModalFailure) as exc: - partial = getattr(exc, "eigenvalues", None) - if partial is not None: raw = tuple(map(complex, partial)) - return finish("failed", failure_reason=str(exc)) - finally: - # Do not retain a factor through an operation closure/error traceback. - handle = None + B = sparse.block_diag((mass[owner._free, :][:, owner._free], + sparse.csc_matrix((r, r))), format="csc") + A = owner._A.copy() + As, Bs, scale = _congruence(owner, A, B) + if free: + rigid = _free_rigid_space(owner, mass, scale, Bs, check) + def project(vector): + if not free: return vector + return vector-rigid["scaled"]@(rigid["scaled"].T@(Bs@vector)) + check("before_factorization") + handle = factorize_cached((As-sigma*Bs).tocsc(), MatrixClass.GENERAL) + if handle.status != "ok": + raise _ModalFailure("reference modal factorization failed: "+str(handle.failure_reason)) + def action(vector): + check("iteration") + try: + answer = np.asarray(handle.solve(Bs@project(vector)), dtype=float) + except RuntimeError as exc: + if (str(exc) == "Sparse solve produced NaN/Inf values" or + str(exc).startswith("Cannot solve with failed factorization:")): + raise _ModalFailure("reference modal sparse solve failed: "+str(exc)) from exc + raise + if not np.isfinite(answer).all(): + raise _ModalFailure("finite reference modal inverse action required") + check("iteration_complete") + return project(answer) + values, vectors = eigs(LinearOperator(A.shape, matvec=action, dtype=float), + k=request.count, which="LM", tol=1e-10, maxiter=request.max_iterations, + v0=np.linspace(1., 2., A.shape[0])) + raw = tuple(map(complex, values)) + check("after_iteration") + abs_A, abs_B = abs(A), abs(B) + pairs = [] + for mu, vector in zip(values, vectors.T): + if (not np.isfinite(mu) or mu.real == 0. or + abs(mu.imag) > 1e-8*abs(mu.real) or + np.max(abs(vector.imag)) > 1e-8*np.max(abs(vector.real))): + raise _ModalFailure("nonphysical or unresolved finite reference pair") + eigenvalue = sigma+1./float(mu.real) + if free: + # Retain the separate shift/reconstruction cancellation guard. + roundoff_screen = 64*np.finfo(float).eps*A.shape[0]*(abs(sigma)+abs(1./float(mu.real))) + if not np.isfinite(roundoff_screen) or eigenvalue <= roundoff_screen: + raise _ModalFailure("extra mechanism or unresolved near-zero flexible pair") + x = scale*np.asarray(vector.real) + q = np.zeros(owner._K.shape[0]); q[owner._free] = x[:n] + if free: + # Physical quadratic-work resolution screen on the reconstructed + # candidate (the congruence inverse applied to the Krylov vector). + # The pair is resolvable only when its inertial quadratic work + # exceeds the abs-coefficient quadratic-work roundoff of this + # candidate's elastic and descriptor constraint work. Both sides + # are physical energy, so the decision is invariant under + # equivalent diagonal unit/coordinate rescalings. Absolute-entry + # bounds can vary under general frame rotations; this is a + # conservative resolution screen, not a frame-invariance proof. + # Its coefficient uncertainty uses no fitted eigenvalue or shift. Cancellation/roundoff + # screen only: not a certified Arnoldi/LU eigenvalue error bound + # or exactly-six nullity proof. + kinetic = float(q@mass@q) + work = eigenvalue*kinetic + uncertainty = 64*np.finfo(float).eps*A.shape[0]*( + float((abs(owner._K)@abs(q))@abs(q))+ + 2.*float((abs(owner._C).T@abs(x[n:]))@abs(q))) + if (not np.isfinite(work) or not np.isfinite(uncertainty) or + work <= uncertainty): + raise _ModalFailure("extra mechanism or unresolved near-zero flexible pair") + norm = float(q@mass@q) + if not np.isfinite(eigenvalue) or eigenvalue <= 0. or not np.isfinite(norm) or norm <= 0.: + raise _ModalFailure("positive finite eigenvalue and physical modal mass required") + x /= np.sqrt(norm); q /= np.sqrt(norm) + if not np.isfinite(x).all() or not np.isfinite(q).all(): + raise _ModalFailure("physical reference mode normalization is not representable") + # Sign uses physical inertial coordinates, not massless resultants. + physical_slots = np.setdiff1d(np.arange(len(q)), zero) + largest = physical_slots[int(np.argmax(np.abs(q[physical_slots])))] + if q[largest] < 0.: x = -x; q = -q + lam = x[n:] + residual = A@x-eigenvalue*(B@x) + bound = abs_A@abs(x)+abs(eigenvalue)*(abs_B@abs(x)) + equation = _modal_scaled_residual(residual, bound, scale) + gap = owner._C@q + constraint = _modal_scaled_residual(gap, abs(owner._C)@abs(q), scale[n:]) + reactions = owner._K@q+owner._C.T@lam-eigenvalue*(mass@q) + physical_bound = abs(owner._K)@abs(q)+abs(owner._C.T)@abs(lam)+abs(eigenvalue)*(abs(mass)@abs(q)) + physical = _modal_scaled_residual(reactions[owner._free], + physical_bound[owner._free], scale[:n]) + if equation > 1e-8 or physical > 1e-8 or constraint > 1e-9: + raise _ModalFailure("reference modal physical equation or constraint residual failed") + pairs.append((float(eigenvalue), _owned(q), _owned(lam), _owned(reactions), + equation, constraint, physical)) + pairs.sort(key=lambda item: item[0]) + modes = np.column_stack([pair[1] for pair in pairs]) + gram = modes.T@mass@modes + if not np.isfinite(gram).all() or np.max(abs(gram-np.eye(request.count))) > 1e-7: + raise _ModalFailure("physical reference modal mass orthogonality failed") + if free: + overlap = float(np.max(abs(rigid["normalized"].T@mass@modes))) + if not np.isfinite(overlap) or overlap > 1e-7: + raise _ModalFailure("rigid and flexible physical mode spaces not mass orthogonal") + check("publish") + return finish("completed", frequencies_hz=tuple(np.sqrt(p[0])/(2*np.pi) for p in pairs), + eigenvalues_rad2_s2=tuple(p[0] for p in pairs), + full_coordinates=tuple(p[1] for p in pairs), + shell_modes=tuple(_owned(p[1][:owner._shell_count]) for p in pairs), + beam_modes=tuple(_owned(p[1][owner._shell_count:]) for p in pairs), + multiplier_modes=tuple(p[2] for p in pairs), support_reactions=tuple(p[3] for p in pairs), + equation_residuals=tuple(p[4] for p in pairs), + constraint_residuals=tuple(p[5] for p in pairs), + physical_equation_residuals=tuple(p[6] for p in pairs)) + except SolveCancelled as exc: + return finish("cancelled", failure_reason=str(exc)) + except (ArpackError, _ModalFailure) as exc: + partial = getattr(exc, "eigenvalues", None) + if partial is not None: raw = tuple(map(complex, partial)) + return finish("failed", failure_reason=str(exc)) + finally: + # Do not retain a factor through an operation closure/error traceback. + handle = None diff --git a/src/anyfesolver/_stiffened_shell_increment_control.py b/src/anyfesolver/_stiffened_shell_increment_control.py index 0958530b0..f841bcf14 100644 --- a/src/anyfesolver/_stiffened_shell_increment_control.py +++ b/src/anyfesolver/_stiffened_shell_increment_control.py @@ -1,152 +1,152 @@ -"""Bounded deterministic load-factor cutbacks; no constitutive approximation.""" - -from dataclasses import asdict, dataclass, replace -from hashlib import sha256 -import json -from math import isfinite - -from ._stiffened_shell_ge_checkpoint_binary import MAX_CHECKPOINT_BYTES - - -MAGIC = b"ANYSGECP10\0" -SCHEMA = "B3_GE_E4_PL_STIFFENED_SHELL_EXPERIMENTAL_INCREMENT_CONTROL_V10" -MAX_METADATA_BYTES = 256 * 1024 - - -@dataclass(frozen=True) -class AdaptiveIncrementControl: - """Halve failed intervals and hold that step until the requested target. - +"""Bounded deterministic load-factor cutbacks; no constitutive approximation.""" + +from dataclasses import asdict, dataclass, replace +from hashlib import sha256 +import json +from math import isfinite + +from ._stiffened_shell_ge_checkpoint_binary import MAX_CHECKPOINT_BYTES + + +MAGIC = b"ANYSGECP10\0" +SCHEMA = "B3_GE_E4_PL_STIFFENED_SHELL_EXPERIMENTAL_INCREMENT_CONTROL_V10" +MAX_METADATA_BYTES = 256 * 1024 + + +@dataclass(frozen=True) +class AdaptiveIncrementControl: + """Halve failed intervals and hold that step until the requested target. + Limits apply to each invocation, including work in its restored accepted checkpoint. Rejected attempts after the last acceptance are reported on exhaustion but are not durable; retrying that prefix may repeat them. - Defaults do not activate this optional experimental controller. - """ - max_cutbacks: int = 6 - max_attempts: int = 64 - - def __post_init__(self): - if (type(self.max_cutbacks) is not int or not 0 <= self.max_cutbacks <= 20 or - type(self.max_attempts) is not int or not 1 <= self.max_attempts <= 1024): - raise ValueError("bounded integer adaptive increment controls required") - - -@dataclass(frozen=True) -class IncrementAttempt: - factor: float - accepted_from: float - target: float - status: str - iterations: int - evaluations: int - linear_solves: int - rejected_trials: int - equilibrium_ratio: float - constraint_max: float - failure: str | None = None - - -class FiniteIncrementFailure(RuntimeError): - """Specifically retryable global Newton/backtrack exhaustion only.""" - def __init__(self, attempt): - super().__init__(attempt.failure) - self.attempt = attempt - - -class AdaptiveIncrementExhausted(RuntimeError): - """Requested sequence incomplete; physical accepted prefix remains owned.""" - def __init__(self, reason, state, accepted_factors): - super().__init__(reason) - self.attempts = state.attempts - self.requested_targets = state.targets - self.accepted_factors = accepted_factors - - -@dataclass(frozen=True) -class _AdaptiveState: - control: AdaptiveIncrementControl - targets: tuple[float, ...] - max_iterations: int - max_backtracks: int - cursor: int - origin: float - depth: int = 0 - attempts: tuple[IncrementAttempt, ...] = () - - @property - def completed(self): - return self.cursor == len(self.targets) - - def next_factor(self, accepted): - target = self.targets[self.cursor] - step = (target - self.origin) / (2**self.depth) - remaining = target - accepted - return target if abs(step) >= abs(remaining) else accepted + step - - def accepted(self, attempt): - finished = attempt.factor == self.targets[self.cursor] - return replace(self, attempts=self.attempts + (attempt,), - cursor=self.cursor + int(finished), - origin=attempt.factor if finished else self.origin, - depth=0 if finished else self.depth) - - def rejected(self, attempt): - return replace(self, attempts=self.attempts + (attempt,), depth=self.depth + 1) - - -def encode_control(model, state, inner): - header = json.dumps({"schema": SCHEMA, "model": model, "state": asdict(state)}, - sort_keys=True, separators=(",", ":"), allow_nan=False).encode("ascii") - if len(header) > MAX_METADATA_BYTES: - raise ValueError("adaptive checkpoint metadata exceeds resource envelope") - content = MAGIC + len(header).to_bytes(4, "little") + header + inner - if len(content) + 32 > MAX_CHECKPOINT_BYTES: - raise ValueError("adaptive checkpoint exceeds resource envelope") - return content + sha256(content).digest() - - -def _unique(pairs): - value = {} - for key, item in pairs: - if key in value: - raise ValueError("duplicate adaptive checkpoint metadata") - value[key] = item - return value - - -def decode_control(raw, model): - if (type(raw) is not bytes or not raw.startswith(MAGIC) or - not len(MAGIC) + 4 + 32 < len(raw) <= MAX_CHECKPOINT_BYTES or - sha256(raw[:-32]).digest() != raw[-32:]): - raise ValueError("invalid adaptive checkpoint framing") - start = len(MAGIC) + 4 - size = int.from_bytes(raw[len(MAGIC):start], "little") - if not 0 < size <= MAX_METADATA_BYTES or start + size >= len(raw) - 32: - raise ValueError("invalid adaptive checkpoint metadata bound") - try: - header = json.loads(raw[start:start+size], object_pairs_hook=_unique) - if (type(header) is not dict or set(header) != {"schema", "model", "state"} or - header["schema"] != SCHEMA or header["model"] != model): - raise ValueError("incompatible adaptive checkpoint") - if json.dumps(header,sort_keys=True,separators=(",", ":"), - allow_nan=False).encode("ascii") != raw[start:start+size]: - raise ValueError("noncanonical adaptive checkpoint metadata") - value = header["state"] - if type(value) is not dict or set(value) != set(_AdaptiveState.__dataclass_fields__): - raise ValueError("invalid adaptive controller fields") - if (type(value["control"]) is not dict or - set(value["control"]) != {"max_cutbacks", "max_attempts"} or - type(value["targets"]) is not list or type(value["attempts"]) is not list): - raise ValueError("invalid adaptive controller layout") - control = AdaptiveIncrementControl(**value["control"]) - state = _AdaptiveState(**{**value, "control": control, - "targets": tuple(value["targets"]), - "attempts": tuple(IncrementAttempt(**v) for v in value["attempts"])}) - except (TypeError, KeyError, UnicodeError, json.JSONDecodeError) as error: - raise ValueError("invalid adaptive checkpoint metadata") from error - return state, raw[start+size:-32] - - + Defaults do not activate this optional experimental controller. + """ + max_cutbacks: int = 6 + max_attempts: int = 64 + + def __post_init__(self): + if (type(self.max_cutbacks) is not int or not 0 <= self.max_cutbacks <= 20 or + type(self.max_attempts) is not int or not 1 <= self.max_attempts <= 1024): + raise ValueError("bounded integer adaptive increment controls required") + + +@dataclass(frozen=True) +class IncrementAttempt: + factor: float + accepted_from: float + target: float + status: str + iterations: int + evaluations: int + linear_solves: int + rejected_trials: int + equilibrium_ratio: float + constraint_max: float + failure: str | None = None + + +class FiniteIncrementFailure(RuntimeError): + """Specifically retryable global Newton/backtrack exhaustion only.""" + def __init__(self, attempt): + super().__init__(attempt.failure) + self.attempt = attempt + + +class AdaptiveIncrementExhausted(RuntimeError): + """Requested sequence incomplete; physical accepted prefix remains owned.""" + def __init__(self, reason, state, accepted_factors): + super().__init__(reason) + self.attempts = state.attempts + self.requested_targets = state.targets + self.accepted_factors = accepted_factors + + +@dataclass(frozen=True) +class _AdaptiveState: + control: AdaptiveIncrementControl + targets: tuple[float, ...] + max_iterations: int + max_backtracks: int + cursor: int + origin: float + depth: int = 0 + attempts: tuple[IncrementAttempt, ...] = () + + @property + def completed(self): + return self.cursor == len(self.targets) + + def next_factor(self, accepted): + target = self.targets[self.cursor] + step = (target - self.origin) / (2**self.depth) + remaining = target - accepted + return target if abs(step) >= abs(remaining) else accepted + step + + def accepted(self, attempt): + finished = attempt.factor == self.targets[self.cursor] + return replace(self, attempts=self.attempts + (attempt,), + cursor=self.cursor + int(finished), + origin=attempt.factor if finished else self.origin, + depth=0 if finished else self.depth) + + def rejected(self, attempt): + return replace(self, attempts=self.attempts + (attempt,), depth=self.depth + 1) + + +def encode_control(model, state, inner): + header = json.dumps({"schema": SCHEMA, "model": model, "state": asdict(state)}, + sort_keys=True, separators=(",", ":"), allow_nan=False).encode("ascii") + if len(header) > MAX_METADATA_BYTES: + raise ValueError("adaptive checkpoint metadata exceeds resource envelope") + content = MAGIC + len(header).to_bytes(4, "little") + header + inner + if len(content) + 32 > MAX_CHECKPOINT_BYTES: + raise ValueError("adaptive checkpoint exceeds resource envelope") + return content + sha256(content).digest() + + +def _unique(pairs): + value = {} + for key, item in pairs: + if key in value: + raise ValueError("duplicate adaptive checkpoint metadata") + value[key] = item + return value + + +def decode_control(raw, model): + if (type(raw) is not bytes or not raw.startswith(MAGIC) or + not len(MAGIC) + 4 + 32 < len(raw) <= MAX_CHECKPOINT_BYTES or + sha256(raw[:-32]).digest() != raw[-32:]): + raise ValueError("invalid adaptive checkpoint framing") + start = len(MAGIC) + 4 + size = int.from_bytes(raw[len(MAGIC):start], "little") + if not 0 < size <= MAX_METADATA_BYTES or start + size >= len(raw) - 32: + raise ValueError("invalid adaptive checkpoint metadata bound") + try: + header = json.loads(raw[start:start+size], object_pairs_hook=_unique) + if (type(header) is not dict or set(header) != {"schema", "model", "state"} or + header["schema"] != SCHEMA or header["model"] != model): + raise ValueError("incompatible adaptive checkpoint") + if json.dumps(header,sort_keys=True,separators=(",", ":"), + allow_nan=False).encode("ascii") != raw[start:start+size]: + raise ValueError("noncanonical adaptive checkpoint metadata") + value = header["state"] + if type(value) is not dict or set(value) != set(_AdaptiveState.__dataclass_fields__): + raise ValueError("invalid adaptive controller fields") + if (type(value["control"]) is not dict or + set(value["control"]) != {"max_cutbacks", "max_attempts"} or + type(value["targets"]) is not list or type(value["attempts"]) is not list): + raise ValueError("invalid adaptive controller layout") + control = AdaptiveIncrementControl(**value["control"]) + state = _AdaptiveState(**{**value, "control": control, + "targets": tuple(value["targets"]), + "attempts": tuple(IncrementAttempt(**v) for v in value["attempts"])}) + except (TypeError, KeyError, UnicodeError, json.JSONDecodeError) as error: + raise ValueError("invalid adaptive checkpoint metadata") from error + return state, raw[start+size:-32] + + def validate_control(state, factors, *, _allow_fibre_predictor=False, _allow_coupled_predictor=False): """Replay bounded controller decisions, never element/material history. @@ -163,30 +163,30 @@ def validate_control(state, factors, *, _allow_fibre_predictor=False, type(_allow_coupled_predictor) is not bool or (_allow_fibre_predictor and _allow_coupled_predictor) or type(state) is not _AdaptiveState or not state.targets or - any(type(v) is not float or not isfinite(v) or v <= 0. for v in state.targets) or - any(a == b for a, b in zip(state.targets, state.targets[1:])) or - type(state.max_iterations) is not int or not 1 <= state.max_iterations <= 24 or - type(state.max_backtracks) is not int or not 0 <= state.max_backtracks <= 12 or - type(state.cursor) is not int or not 0 <= state.cursor <= len(state.targets) or - type(state.depth) is not int or not 0 <= state.depth <= state.control.max_cutbacks or - type(state.origin) is not float or not isfinite(state.origin) or state.origin < 0. or - not 0 < len(state.attempts) <= state.control.max_attempts): - raise ValueError("invalid accepted adaptive controller state") - accepted = tuple(row.factor for row in state.attempts if row.status == "accepted") - if not accepted or tuple(factors[-len(accepted):]) != accepted: - raise ValueError("adaptive controller disagrees with accepted load history") - origin = float(factors[-len(accepted)-1]) if len(factors) > len(accepted) else 0. - replay = _AdaptiveState(state.control, state.targets, - state.max_iterations, state.max_backtracks, 0, origin) - previous = origin - for row in state.attempts: - if (replay.completed or row.factor != replay.next_factor(previous) or - row.accepted_from != previous or row.target != replay.targets[replay.cursor] or - any(type(v) is not float or not isfinite(v) for v in ( - row.factor, row.accepted_from, row.target, row.equilibrium_ratio, row.constraint_max)) or - min(row.equilibrium_ratio, row.constraint_max) < 0. or - any(type(v) is not int or v < 0 for v in ( - row.iterations, row.evaluations, row.linear_solves, row.rejected_trials)) or + any(type(v) is not float or not isfinite(v) or v <= 0. for v in state.targets) or + any(a == b for a, b in zip(state.targets, state.targets[1:])) or + type(state.max_iterations) is not int or not 1 <= state.max_iterations <= 24 or + type(state.max_backtracks) is not int or not 0 <= state.max_backtracks <= 12 or + type(state.cursor) is not int or not 0 <= state.cursor <= len(state.targets) or + type(state.depth) is not int or not 0 <= state.depth <= state.control.max_cutbacks or + type(state.origin) is not float or not isfinite(state.origin) or state.origin < 0. or + not 0 < len(state.attempts) <= state.control.max_attempts): + raise ValueError("invalid accepted adaptive controller state") + accepted = tuple(row.factor for row in state.attempts if row.status == "accepted") + if not accepted or tuple(factors[-len(accepted):]) != accepted: + raise ValueError("adaptive controller disagrees with accepted load history") + origin = float(factors[-len(accepted)-1]) if len(factors) > len(accepted) else 0. + replay = _AdaptiveState(state.control, state.targets, + state.max_iterations, state.max_backtracks, 0, origin) + previous = origin + for row in state.attempts: + if (replay.completed or row.factor != replay.next_factor(previous) or + row.accepted_from != previous or row.target != replay.targets[replay.cursor] or + any(type(v) is not float or not isfinite(v) for v in ( + row.factor, row.accepted_from, row.target, row.equilibrium_ratio, row.constraint_max)) or + min(row.equilibrium_ratio, row.constraint_max) < 0. or + any(type(v) is not int or v < 0 for v in ( + row.iterations, row.evaluations, row.linear_solves, row.rejected_trials)) or (not row.iterations <= row.linear_solves <= row.iterations + min( row.iterations, row.rejected_trials) if (_allow_fibre_predictor or _allow_coupled_predictor) else @@ -198,20 +198,20 @@ def validate_control(state, factors, *, _allow_fibre_predictor=False, row.rejected_trials > (state.max_backtracks + 1) * ( row.iterations if (_allow_fibre_predictor or _allow_coupled_predictor) else row.linear_solves)): - raise ValueError("invalid adaptive attempt or interval") - if row.status == "accepted": - if row.failure is not None or row.equilibrium_ratio > 1e-8 or row.constraint_max > 1e-9: - raise ValueError("invalid adaptive acceptance") - replay = replay.accepted(row) - previous = row.factor - elif row.status == "rejected": - if (row.failure not in ("finite mixed Newton iteration limit", - "finite mixed backtrack budget exhausted") or - replay.depth >= state.control.max_cutbacks): - raise ValueError("invalid adaptive rejection") - replay = replay.rejected(row) - else: - raise ValueError("invalid adaptive attempt status") - if (replay != state or state.attempts[-1].status != "accepted" or - previous != factors[-1]): - raise ValueError("adaptive cursor disagrees with physical checkpoint") + raise ValueError("invalid adaptive attempt or interval") + if row.status == "accepted": + if row.failure is not None or row.equilibrium_ratio > 1e-8 or row.constraint_max > 1e-9: + raise ValueError("invalid adaptive acceptance") + replay = replay.accepted(row) + previous = row.factor + elif row.status == "rejected": + if (row.failure not in ("finite mixed Newton iteration limit", + "finite mixed backtrack budget exhausted") or + replay.depth >= state.control.max_cutbacks): + raise ValueError("invalid adaptive rejection") + replay = replay.rejected(row) + else: + raise ValueError("invalid adaptive attempt status") + if (replay != state or state.attempts[-1].status != "accepted" or + previous != factors[-1]): + raise ValueError("adaptive cursor disagrees with physical checkpoint") diff --git a/src/anyfesolver/_stiffened_shell_q4_algorithmic_pullback.py b/src/anyfesolver/_stiffened_shell_q4_algorithmic_pullback.py index 745153220..518a7222e 100644 --- a/src/anyfesolver/_stiffened_shell_q4_algorithmic_pullback.py +++ b/src/anyfesolver/_stiffened_shell_q4_algorithmic_pullback.py @@ -1,88 +1,88 @@ -"""Explicit Q4 elastic/J2 full-map adapter; ordinary Q4 routes are unchanged.""" - -import numpy as np - -from ._ge_beam3_variational_shell import deformation -from ._stiffened_shell_algorithmic_pullback import spatial_response -from .e4_pl_element import FORMULATION_ID -from .material_curves import DNVC208MaterialCurve - - -POLICY = "STIFFENED_SHELL_Q4_ALGORITHMIC_PULLBACK_V1" -HISTORICAL_POLICY = "historical_corotational" - - -def local_coordinates(model, element, displacement, *, rotation_anchors=None): - reference = np.array([model.mesh.nodes[node].coords() for node in element.node_ids]) - return deformation(reference, displacement, stable_translation=True, - rotation_anchors=rotation_anchors)[0] - - -def response(model, element, displacement, origin, layers, *, rotation_anchors=None, - prepared_correction=None, stable_rotation=False, capture_material_trial=False): - """Differentiate the unchanged local update from one accepted predecessor.""" - if type(capture_material_trial) is not bool: - raise ValueError("explicit Q4 material trial capture policy required") - material = model.get_material(element.material_name) - curve = material.hardening_curve - if (getattr(element, "formulation_id", None) != FORMULATION_ID or - element.num_nodes != 4 or element.shell_section is not None or - (curve is not None and not isinstance(curve, DNVC208MaterialCurve)) or - (curve is None and material.yield_stress != 0.) or origin is None): - raise ValueError("experimental Q4 elastic/isotropic J2 accepted predecessor required") - reference = np.array([model.mesh.nodes[node].coords() for node in element.node_ids]) - u = np.asarray(displacement, dtype=float) - local, differential, second = deformation(reference, u, stable_translation=True, - rotation_anchors=rotation_anchors, - stable_rotation=stable_rotation) - if prepared_correction is None: - force, tangent, candidate = element.compute_nonlinear_response( - model.mesh, material, local, origin, layers, True) - else: - force, tangent, candidate = element._compute_prepared_nonlinear_response( - model.mesh, material, local, origin, layers, True, - prepared=prepared_correction) - force, tangent = np.asarray(force), np.asarray(tangent) - if (force.shape != (24,) or tangent.shape != (24, 24) or - not np.isfinite(force).all() or not np.isfinite(tangent).all() or - candidate is None): - raise ValueError("finite Q4 algorithmic trial required") - residual, spatial_tangent = spatial_response(u, force, tangent, differential, second, - stable_rotation=stable_rotation) - if capture_material_trial: - from ._stiffened_shell_q4_material_event import capture - payload = capture(model, element, u, local, differential, origin, candidate, layers) - return residual, spatial_tangent, candidate, payload - return residual, spatial_tangent, candidate - - -def conservative_components(model, element, displacement, origin, layers, *, - rotation_anchors=None, prepared_correction=None): - """Read-only elastic covector Hessian in the actual additive shell chart. - - Unlike a spatial-row tangent, these blocks are derivatives of one scalar - potential. The unchanged qualified linear correction contributes to both - material stiffness and the force contracted with deformation curvature. - """ - material = model.get_material(element.material_name) - if (getattr(element, 'formulation_id', None) != FORMULATION_ID or - element.num_nodes != 4 or element.shell_section is not None or - material.hardening_curve is not None or material.yield_stress != 0. or origin is None): - raise ValueError('conservative Q4 capture requires the owned elastic section') - reference = np.array([model.mesh.nodes[node].coords() for node in element.node_ids]) - local, differential, second = deformation(reference, displacement, - stable_translation=True, rotation_anchors=rotation_anchors) - if prepared_correction is None: - force, tangent, candidate, parts = element.compute_nonlinear_response( - model.mesh, material, local, origin, layers, True, _return_tangent_components=True) - else: - force, tangent, candidate, parts = element._compute_prepared_nonlinear_response( - model.mesh, material, local, origin, layers, True, - prepared=prepared_correction, _return_tangent_components=True) - km = differential.T @ parts['material'] @ differential - geometric = differential.T @ parts['geometric'] @ differential + np.einsum('i,ijk->jk', force, second) - hessian = differential.T @ tangent @ differential + np.einsum('i,ijk->jk', force, second) - covector = differential.T @ force - if not all(np.isfinite(a).all() for a in (km, geometric, hessian, covector)): - raise ValueError('finite conservative Q4 components required') - return covector, hessian, km, geometric, candidate +"""Explicit Q4 elastic/J2 full-map adapter; ordinary Q4 routes are unchanged.""" + +import numpy as np + +from ._ge_beam3_variational_shell import deformation +from ._stiffened_shell_algorithmic_pullback import spatial_response +from .e4_pl_element import FORMULATION_ID +from .material_curves import DNVC208MaterialCurve + + +POLICY = "STIFFENED_SHELL_Q4_ALGORITHMIC_PULLBACK_V1" +HISTORICAL_POLICY = "historical_corotational" + + +def local_coordinates(model, element, displacement, *, rotation_anchors=None): + reference = np.array([model.mesh.nodes[node].coords() for node in element.node_ids]) + return deformation(reference, displacement, stable_translation=True, + rotation_anchors=rotation_anchors)[0] + + +def response(model, element, displacement, origin, layers, *, rotation_anchors=None, + prepared_correction=None, stable_rotation=False, capture_material_trial=False): + """Differentiate the unchanged local update from one accepted predecessor.""" + if type(capture_material_trial) is not bool: + raise ValueError("explicit Q4 material trial capture policy required") + material = model.get_material(element.material_name) + curve = material.hardening_curve + if (getattr(element, "formulation_id", None) != FORMULATION_ID or + element.num_nodes != 4 or element.shell_section is not None or + (curve is not None and not isinstance(curve, DNVC208MaterialCurve)) or + (curve is None and material.yield_stress != 0.) or origin is None): + raise ValueError("experimental Q4 elastic/isotropic J2 accepted predecessor required") + reference = np.array([model.mesh.nodes[node].coords() for node in element.node_ids]) + u = np.asarray(displacement, dtype=float) + local, differential, second = deformation(reference, u, stable_translation=True, + rotation_anchors=rotation_anchors, + stable_rotation=stable_rotation) + if prepared_correction is None: + force, tangent, candidate = element.compute_nonlinear_response( + model.mesh, material, local, origin, layers, True) + else: + force, tangent, candidate = element._compute_prepared_nonlinear_response( + model.mesh, material, local, origin, layers, True, + prepared=prepared_correction) + force, tangent = np.asarray(force), np.asarray(tangent) + if (force.shape != (24,) or tangent.shape != (24, 24) or + not np.isfinite(force).all() or not np.isfinite(tangent).all() or + candidate is None): + raise ValueError("finite Q4 algorithmic trial required") + residual, spatial_tangent = spatial_response(u, force, tangent, differential, second, + stable_rotation=stable_rotation) + if capture_material_trial: + from ._stiffened_shell_q4_material_event import capture + payload = capture(model, element, u, local, differential, origin, candidate, layers) + return residual, spatial_tangent, candidate, payload + return residual, spatial_tangent, candidate + + +def conservative_components(model, element, displacement, origin, layers, *, + rotation_anchors=None, prepared_correction=None): + """Read-only elastic covector Hessian in the actual additive shell chart. + + Unlike a spatial-row tangent, these blocks are derivatives of one scalar + potential. The unchanged qualified linear correction contributes to both + material stiffness and the force contracted with deformation curvature. + """ + material = model.get_material(element.material_name) + if (getattr(element, 'formulation_id', None) != FORMULATION_ID or + element.num_nodes != 4 or element.shell_section is not None or + material.hardening_curve is not None or material.yield_stress != 0. or origin is None): + raise ValueError('conservative Q4 capture requires the owned elastic section') + reference = np.array([model.mesh.nodes[node].coords() for node in element.node_ids]) + local, differential, second = deformation(reference, displacement, + stable_translation=True, rotation_anchors=rotation_anchors) + if prepared_correction is None: + force, tangent, candidate, parts = element.compute_nonlinear_response( + model.mesh, material, local, origin, layers, True, _return_tangent_components=True) + else: + force, tangent, candidate, parts = element._compute_prepared_nonlinear_response( + model.mesh, material, local, origin, layers, True, + prepared=prepared_correction, _return_tangent_components=True) + km = differential.T @ parts['material'] @ differential + geometric = differential.T @ parts['geometric'] @ differential + np.einsum('i,ijk->jk', force, second) + hessian = differential.T @ tangent @ differential + np.einsum('i,ijk->jk', force, second) + covector = differential.T @ force + if not all(np.isfinite(a).all() for a in (km, geometric, hessian, covector)): + raise ValueError('finite conservative Q4 components required') + return covector, hessian, km, geometric, candidate diff --git a/src/anyfesolver/_stiffened_shell_q4_material_event.py b/src/anyfesolver/_stiffened_shell_q4_material_event.py index 56caa3e60..34f8ccf0c 100644 --- a/src/anyfesolver/_stiffened_shell_q4_material_event.py +++ b/src/anyfesolver/_stiffened_shell_q4_material_event.py @@ -1,114 +1,114 @@ -"""Owned fixed-origin Q4 numerical-switch proposal, never acceptance/history.""" -from dataclasses import dataclass -from decimal import Decimal as D, localcontext -from inspect import signature -from math import isfinite, nextafter, ulp -import numpy as np -from .plasticity import plane_stress_elastic_matrix, plane_stress_return_map, _jit_flow_stress, lobatto_layers - -@dataclass(frozen=True) -class Q4MaterialTrial: - origin: object - origin_values: tuple - displacement: tuple - strain: tuple - strain_differential: tuple - elastic_matrix: tuple - flow: tuple - tolerance: float - -def _origin_values(origin): - def owned(value): - if isinstance(value,(tuple,list,np.ndarray)):return tuple(owned(x) for x in value) - return float(value) - offsets=tuple((key,owned(origin[key])) for key in ('initial_membrane_stress','initial_bending_stress', - 'initial_membrane_prestrain','initial_curvature_prestrain','initial_generalized_prestrain','initial_generalized_resultant') if key in origin) - return (tuple(tuple(float(x) for x in row) for row in origin['plastic_strain']),tuple(map(float,origin['alpha'])),offsets) - -def capture(model, element, displacement, local, differential, origin, candidate, layers): - material=model.get_material(element.material_name);curve=material.hardening_curve - if curve is None:return None - cache=element._nonlinear_geometry(model.mesh);u=cache['T0']@local; jacobian=[] - z,_=lobatto_layers(layers,element.thickness) - for gp in cache['gp']: - theta=gp['Gw']@u - nonlinear=np.vstack((theta[0]*gp['Gw'][0],theta[1]*gp['Gw'][1],theta[0]*gp['Gw'][1]+theta[1]*gp['Gw'][0])) - for level in z:jacobian.append((gp['B_m']+nonlinear+level*gp['B_b'])@cache['T0']@differential) - flow=_jit_flow_stress(np.asarray(origin['alpha'],dtype=float),*(float(getattr(curve,n)) for n in - ('sigma_prop','sigma_yield','sigma_yield_2','eps_p_y1','eps_p_y2','K','n','_power_offset'))) - return Q4MaterialTrial(origin,_origin_values(origin),tuple(map(float,displacement)), - tuple(tuple(map(float,row)) for row in candidate['layer_strain']), - tuple(tuple(tuple(map(float,row)) for row in layer) for layer in jacobian), - tuple(tuple(map(float,row)) for row in plane_stress_elastic_matrix(material.elastic_modulus,material.poisson_ratio)), - tuple(map(float,flow)),float(signature(plane_stress_return_map).parameters['tolerance'].default)) - -def boundary_amount(trial,direction,*,origin): - return _boundary_amount(trial,direction,origin=origin,coordinate_count=24) - -def _boundary_amount(trial,direction,*,origin,coordinate_count): - """Local predictor only: pose remainder and kernel/flow/dot rounding are - not certified by the outward affine-update margin. Actual merit decides. - """ - if type(trial) is not Q4MaterialTrial or trial.origin is not origin or trial.origin_values!=_origin_values(origin): - raise ValueError('current origin-bound Q4 material trial required') - values=tuple(direction) - if type(coordinate_count) is not int or coordinate_count not in (18,24): - raise ValueError('admitted shell coordinate dimension required') - if len(values)!=coordinate_count or any(isinstance(x,(bool,np.bool_)) or not isfinite(float(x)) for x in values): - raise ValueError('finite complete shell coordinate corrections required') - if (len(trial.displacement)!=coordinate_count or len(trial.strain)!=len(trial.flow) or - len(trial.strain)!=len(trial.origin_values[0]) or len(trial.strain)!=len(trial.origin_values[1]) or - any(len(r)!=3 for r in trial.origin_values[0]) or - len(trial.strain_differential)!=len(trial.strain) or len(trial.elastic_matrix)!=3 or - any(len(r)!=3 for r in trial.elastic_matrix) or any(len(r)!=3 for r in trial.strain) or - any(len(layer)!=3 or any(len(r)!=coordinate_count for r in layer) for layer in trial.strain_differential)): - raise ValueError('complete Q4 material trial shapes required') - scalars=(*trial.displacement,*trial.flow,trial.tolerance,*[x for r in trial.strain for x in r], - *[x for r in trial.elastic_matrix for x in r],*[x for layer in trial.strain_differential for r in layer for x in r], - *[x for r in trial.origin_values[0] for x in r],*trial.origin_values[1]) - if any(isinstance(x,(bool,np.bool_)) or not isfinite(float(x)) for x in scalars) or trial.tolerance<=0 or any(x<=0 for x in trial.flow): - raise ValueError('finite positive Q4 material trial data required') - with localcontext() as context: - context.prec=80;dec=lambda x:D.from_float(float(x));dp=tuple(map(dec,values)) - matrix=tuple(tuple(map(dec,r)) for r in trial.elastic_matrix) - def mv(m,x):return tuple(sum((a*b for a,b in zip(r,x)),D(0)) for r in m) - def phi(x):return (x[0]+x[1])**2/12+(x[0]-x[1])**2/4+x[2]**2 - first=None - for strain,jacobian,ep,flow in zip(trial.strain,trial.strain_differential,trial.origin_values[0],trial.flow): - jac=tuple(tuple(map(dec,r)) for r in jacobian) - stress=mv(matrix,tuple(dec(a)-dec(b) for a,b in zip(strain,ep)));change=mv(matrix,mv(jac,dp));sy=dec(flow) - a=phi(change);b=(stress[0]+stress[1])*(change[0]+change[1])/6+(stress[0]-stress[1])*(change[0]-change[1])/2+2*stress[2]*change[2] - c=phi(stress)-sy*sy/3-dec(trial.tolerance)*max(sy*sy,D(1));roots=[] - if a: - discriminant=b*b-4*a*c - if discriminant<=0:continue # tangent contact does not switch branch - q=-(b+(discriminant.sqrt() if b>=0 else -discriminant.sqrt()))/2 - roots=(q/a,c/q) if q else (D(0),) - elif b:roots=(-c/b,) - for root in roots: - if not 0=0 else -discriminant.sqrt()))/2 + roots=(q/a,c/q) if q else (D(0),) + elif b:roots=(-c/b,) + for root in roots: + if not 0 MAX_ACTIONS_PER_STAGE for row in self.endpoints): - raise ValueError("bounded tuple of actions at every stage required") - if sum(map(len, self.endpoints)) > MAX_ACTIONS: - raise ValueError("staged-load total action bound exceeded") - endpoints = [] - for row in self.endpoints: - normalized = tuple(_action(a) for a in row) - nodes = [(a.domain, a.node) for a in normalized] - if len(set(nodes)) != len(nodes): - raise ValueError("duplicate same-node staged actions are not admitted") - endpoints.append(normalized) + identity: str = field(init=False) + _serialized: bytes = field(init=False, repr=False, compare=False) + + def __post_init__(self): + model_identity = _identity(self.model_identity) + if type(self.endpoints) is not tuple or not 1 <= len(self.endpoints) <= MAX_STAGES: + raise ValueError("bounded nonempty tuple of staged endpoints required") + if any(type(row) is not tuple or len(row) > MAX_ACTIONS_PER_STAGE for row in self.endpoints): + raise ValueError("bounded tuple of actions at every stage required") + if sum(map(len, self.endpoints)) > MAX_ACTIONS: + raise ValueError("staged-load total action bound exceeded") + endpoints = [] + for row in self.endpoints: + normalized = tuple(_action(a) for a in row) + nodes = [(a.domain, a.node) for a in normalized] + if len(set(nodes)) != len(nodes): + raise ValueError("duplicate same-node staged actions are not admitted") + endpoints.append(normalized) object.__setattr__(self, "model_identity", model_identity) object.__setattr__(self, "endpoints", tuple(endpoints)) reference = self.zero_load_reference_endpoint @@ -135,44 +135,44 @@ def __post_init__(self): raise ValueError("zero-load reference must identify an existing endpoint") if not any(v != 0. for action in endpoints[reference-1] for v in action.wrench): raise ValueError("zero-load reference endpoint must be nonzero") - core = self._core_payload() - identity = sha256(_canonical(core)).hexdigest() - object.__setattr__(self, "identity", identity) - raw = _canonical({**core, "identity": identity}) - if len(raw) > MAX_METADATA_BYTES: - raise ValueError("staged-load descriptor metadata bound exceeded") - object.__setattr__(self, "_serialized", raw) - - @property + core = self._core_payload() + identity = sha256(_canonical(core)).hexdigest() + object.__setattr__(self, "identity", identity) + raw = _canonical({**core, "identity": identity}) + if len(raw) > MAX_METADATA_BYTES: + raise ValueError("staged-load descriptor metadata bound exceeded") + object.__setattr__(self, "_serialized", raw) + + @property def stage_count(self): return len(self.endpoints) @property def policy(self): return POLICY if self.zero_load_reference_endpoint is None else ZERO_REFERENCE_POLICY - - @property - def augmented_model_identity(self): + + @property + def augmented_model_identity(self): return sha256(_canonical(dict(policy=self.policy, model_identity=self.model_identity, - programme_identity=self.identity))).hexdigest() - - def _core_payload(self): + programme_identity=self.identity))).hexdigest() + + def _core_payload(self): value = dict(policy=self.policy, model_identity=self.model_identity, endpoints=[[dict(domain=a.domain, node=a.node, wrench=list(a.wrench)) for a in row] for row in self.endpoints]) if self.zero_load_reference_endpoint is not None: value["zero_load_reference_endpoint"] = self.zero_load_reference_endpoint return value - - def to_payload(self): - return {**self._core_payload(), "identity": self.identity} - - def serialize(self): - return self._serialized - - @classmethod - def from_payload(cls, value): - from ._stiffened_shell_ge_experimental import NodalAction + + def to_payload(self): + return {**self._core_payload(), "identity": self.identity} + + def serialize(self): + return self._serialized + + @classmethod + def from_payload(cls, value): + from ._stiffened_shell_ge_experimental import NodalAction if type(value) is not dict: raise ValueError("invalid staged-load descriptor fields/policy") required = {"policy", "model_identity", "endpoints", "identity"} @@ -180,41 +180,41 @@ def from_payload(cls, value): required.add("zero_load_reference_endpoint") if (set(value) != required or value.get("policy") not in (POLICY, ZERO_REFERENCE_POLICY) or type(value["endpoints"]) is not list - or not 1 <= len(value["endpoints"]) <= MAX_STAGES): - raise ValueError("invalid staged-load descriptor fields/policy") - rows = value["endpoints"] - if (any(type(row) is not list or len(row) > MAX_ACTIONS_PER_STAGE for row in rows) or - sum(map(len, rows)) > MAX_ACTIONS): - raise ValueError("staged-load descriptor action bound exceeded") - normalized = [] - for row in rows: - actions = [] - for action in row: - if type(action) is not dict or set(action) != {"domain", "node", "wrench"}: - raise ValueError("invalid staged-load action fields") - if type(action["node"]) is not int or type(action["wrench"]) is not list: - raise ValueError("invalid staged-load action types") - actions.append(NodalAction(action["domain"], action["node"], action["wrench"])) - normalized.append(tuple(actions)) + or not 1 <= len(value["endpoints"]) <= MAX_STAGES): + raise ValueError("invalid staged-load descriptor fields/policy") + rows = value["endpoints"] + if (any(type(row) is not list or len(row) > MAX_ACTIONS_PER_STAGE for row in rows) or + sum(map(len, rows)) > MAX_ACTIONS): + raise ValueError("staged-load descriptor action bound exceeded") + normalized = [] + for row in rows: + actions = [] + for action in row: + if type(action) is not dict or set(action) != {"domain", "node", "wrench"}: + raise ValueError("invalid staged-load action fields") + if type(action["node"]) is not int or type(action["wrench"]) is not list: + raise ValueError("invalid staged-load action types") + actions.append(NodalAction(action["domain"], action["node"], action["wrench"])) + normalized.append(tuple(actions)) programme = cls(value["model_identity"], tuple(normalized), zero_load_reference_endpoint=value.get("zero_load_reference_endpoint")) - if (_identity(value["identity"]) != programme.identity or - _canonical(value) != programme.serialize()): - raise ValueError("staged-load descriptor identity/canonical representation mismatch") - return programme - - @classmethod - def deserialize(cls, raw): - if type(raw) is not bytes or not 0 < len(raw) <= MAX_METADATA_BYTES: - raise ValueError("bounded staged-load descriptor bytes required") - programme = cls.from_payload(_json(raw)) - if raw != programme.serialize(): - raise ValueError("canonical staged-load descriptor bytes required") - return programme - + if (_identity(value["identity"]) != programme.identity or + _canonical(value) != programme.serialize()): + raise ValueError("staged-load descriptor identity/canonical representation mismatch") + return programme + + @classmethod + def deserialize(cls, raw): + if type(raw) is not bytes or not 0 < len(raw) <= MAX_METADATA_BYTES: + raise ValueError("bounded staged-load descriptor bytes required") + programme = cls.from_payload(_json(raw)) + if raw != programme.serialize(): + raise ValueError("canonical staged-load descriptor bytes required") + return programme + def compile(self, owner, load): - if getattr(owner, "_identity", None) != self.model_identity: - raise ValueError("staged-load programme belongs to a different model") + if getattr(owner, "_identity", None) != self.model_identity: + raise ValueError("staged-load programme belongs to a different model") if not callable(load): raise TypeError("staged-load compiler requires the owner load callable") if self.zero_load_reference_endpoint is not None: @@ -225,18 +225,18 @@ def compile(self, owner, load): definition.distributing_footprints or definition.finite_distributing_footprints or definition.shell_reference_policy != "flat"): raise ValueError("zero-load reference policy requires the admitted flat point GE owner") - shape = getattr(getattr(owner, "_K", None), "shape", None) - if (type(shape) is not tuple or len(shape) != 2 or shape[0] != shape[1] or - not isinstance(shape[0], (int, np.integer)) or shape[0] <= 0 or - (self.stage_count+1)*shape[0] > MAX_COMPILED_VALUES): - raise ValueError("staged-load compiled vector shape/storage bound exceeded") - # No compiler/loader exceptions are swallowed or converted to cutbacks. - vectors = [] - for row in ((),)+self.endpoints: - made = np.asarray(load(row), dtype=np.float64) - if made.shape != (shape[0],) or not np.isfinite(made).all(): - raise ValueError("staged-load compiler returned invalid vectors") - # Snapshot before the next call: loaders may reuse a work buffer. + shape = getattr(getattr(owner, "_K", None), "shape", None) + if (type(shape) is not tuple or len(shape) != 2 or shape[0] != shape[1] or + not isinstance(shape[0], (int, np.integer)) or shape[0] <= 0 or + (self.stage_count+1)*shape[0] > MAX_COMPILED_VALUES): + raise ValueError("staged-load compiled vector shape/storage bound exceeded") + # No compiler/loader exceptions are swallowed or converted to cutbacks. + vectors = [] + for row in ((),)+self.endpoints: + made = np.asarray(load(row), dtype=np.float64) + if made.shape != (shape[0],) or not np.isfinite(made).all(): + raise ValueError("staged-load compiler returned invalid vectors") + # Snapshot before the next call: loaders may reuse a work buffer. vectors.append(np.frombuffer(made.tobytes(), dtype=np.float64)) if self.zero_load_reference_endpoint is not None: reference = vectors[self.zero_load_reference_endpoint][owner._free] @@ -247,50 +247,50 @@ def compile(self, owner, load): np.any((reference != 0.) & (weighted == 0.)) or not np.any(weighted != 0.)): raise ValueError("representable nonzero free work required at the reference endpoint") return CompiledStagedDeadLoadProgramme(self, tuple(vectors)) - - -@dataclass(frozen=True) -class CompiledStagedDeadLoadProgramme: - programme: StagedDeadLoadProgramme - vectors: tuple[np.ndarray, ...] - - def __post_init__(self): - if (type(self.programme) is not StagedDeadLoadProgramme or type(self.vectors) is not tuple or - len(self.vectors) != self.programme.stage_count+1): - raise ValueError("complete typed staged-load compilation required") - shape = np.shape(self.vectors[0]) - if len(shape) != 1 or shape[0] <= 0 or len(self.vectors)*shape[0] > MAX_COMPILED_VALUES: - raise ValueError("staged-load compiled storage bound exceeded") - owned = [] - for vector in self.vectors: - made = np.asarray(vector, dtype=np.float64) - if made.shape != shape or not np.isfinite(made).all(): - raise ValueError("finite consistent staged-load vectors required") - owned.append(np.frombuffer(made.tobytes(), dtype=np.float64)) + + +@dataclass(frozen=True) +class CompiledStagedDeadLoadProgramme: + programme: StagedDeadLoadProgramme + vectors: tuple[np.ndarray, ...] + + def __post_init__(self): + if (type(self.programme) is not StagedDeadLoadProgramme or type(self.vectors) is not tuple or + len(self.vectors) != self.programme.stage_count+1): + raise ValueError("complete typed staged-load compilation required") + shape = np.shape(self.vectors[0]) + if len(shape) != 1 or shape[0] <= 0 or len(self.vectors)*shape[0] > MAX_COMPILED_VALUES: + raise ValueError("staged-load compiled storage bound exceeded") + owned = [] + for vector in self.vectors: + made = np.asarray(vector, dtype=np.float64) + if made.shape != shape or not np.isfinite(made).all(): + raise ValueError("finite consistent staged-load vectors required") + owned.append(np.frombuffer(made.tobytes(), dtype=np.float64)) if np.any(owned[0] != 0.): raise ValueError("implicit staged initial force must be zero") reference = self.programme.zero_load_reference_endpoint if reference is not None and not np.any(owned[reference] != 0.): raise ValueError("compiled zero-load reference endpoint must be nonzero") - object.__setattr__(self, "vectors", tuple(owned)) - - @property - def identity(self): - return self.programme.identity - - @property - def physical_model_identity(self): - return self.programme.model_identity - - @property - def augmented_model_identity(self): - return self.programme.augmented_model_identity - - @property - def model_identity(self): - return self.augmented_model_identity - - @property + object.__setattr__(self, "vectors", tuple(owned)) + + @property + def identity(self): + return self.programme.identity + + @property + def physical_model_identity(self): + return self.programme.model_identity + + @property + def augmented_model_identity(self): + return self.programme.augmented_model_identity + + @property + def model_identity(self): + return self.augmented_model_identity + + @property def stage_count(self): return self.programme.stage_count @@ -304,89 +304,89 @@ def equilibrium_load(self, applied): if reference is not None and not np.any(applied != 0.): return self.vectors[reference] return applied - - def progress_at(self, position): - _, cursor, fraction = _progress(self.stage_count, position) - return cursor, fraction - - def load_at(self, position): - _, cursor, fraction = _progress(self.stage_count, position) - if fraction == 0.: - return self.vectors[cursor] - a, b = self.vectors[cursor], self.vectors[cursor+1] - result = np.zeros_like(a) - wb = Fraction(fraction) - wa = 1-wb - # Only active spatial components need a bounded exact two-term dot. - # This avoids overflow-prone endpoint subtraction and false zero work. - for index in np.flatnonzero((a != 0.) | (b != 0.)): - if a[index] == b[index]: - result[index] = a[index] - continue - exact = wa*Fraction(float(a[index])) + wb*Fraction(float(b[index])) - try: - value = float(exact) - except OverflowError as exc: - raise StagedLoadResolutionError("staged force interpolation overflow") from exc - if (not isfinite(value) or (exact != 0 and value == 0.) or - (0. < abs(value) < np.finfo(float).tiny and Fraction(value) != exact)): - raise StagedLoadResolutionError("staged force interpolation is unresolved") - result[index] = value - return np.frombuffer(result.tobytes(), dtype=np.float64) - - def validate_targets(self, accepted_position, targets): - accepted, _, _ = _progress(self.stage_count, accepted_position) - if type(targets) is not tuple or not targets: - raise ValueError("nonempty tuple of staged positions required") - normalized = tuple(_progress(self.stage_count, p)[0] for p in targets) - if any(b <= a for a, b in zip((accepted,)+normalized, normalized)): - raise ValueError("staged positions must advance strictly forward") - required = set(range(floor(accepted)+1, floor(normalized[-1])+1)) - if not required.issubset(normalized): - raise ValueError("staged positions must include every crossed integer boundary") - return normalized - - -def encode_checkpoint(compiled, position, inner): - if type(compiled) is not CompiledStagedDeadLoadProgramme: - raise TypeError("typed compiled staged programme required") - position, cursor, fraction = _progress(compiled.stage_count, position) - if type(inner) is not bytes or not inner or len(inner) > MAX_CHECKPOINT_BYTES: - raise ValueError("bounded staged inner checkpoint bytes required") + + def progress_at(self, position): + _, cursor, fraction = _progress(self.stage_count, position) + return cursor, fraction + + def load_at(self, position): + _, cursor, fraction = _progress(self.stage_count, position) + if fraction == 0.: + return self.vectors[cursor] + a, b = self.vectors[cursor], self.vectors[cursor+1] + result = np.zeros_like(a) + wb = Fraction(fraction) + wa = 1-wb + # Only active spatial components need a bounded exact two-term dot. + # This avoids overflow-prone endpoint subtraction and false zero work. + for index in np.flatnonzero((a != 0.) | (b != 0.)): + if a[index] == b[index]: + result[index] = a[index] + continue + exact = wa*Fraction(float(a[index])) + wb*Fraction(float(b[index])) + try: + value = float(exact) + except OverflowError as exc: + raise StagedLoadResolutionError("staged force interpolation overflow") from exc + if (not isfinite(value) or (exact != 0 and value == 0.) or + (0. < abs(value) < np.finfo(float).tiny and Fraction(value) != exact)): + raise StagedLoadResolutionError("staged force interpolation is unresolved") + result[index] = value + return np.frombuffer(result.tobytes(), dtype=np.float64) + + def validate_targets(self, accepted_position, targets): + accepted, _, _ = _progress(self.stage_count, accepted_position) + if type(targets) is not tuple or not targets: + raise ValueError("nonempty tuple of staged positions required") + normalized = tuple(_progress(self.stage_count, p)[0] for p in targets) + if any(b <= a for a, b in zip((accepted,)+normalized, normalized)): + raise ValueError("staged positions must advance strictly forward") + required = set(range(floor(accepted)+1, floor(normalized[-1])+1)) + if not required.issubset(normalized): + raise ValueError("staged positions must include every crossed integer boundary") + return normalized + + +def encode_checkpoint(compiled, position, inner): + if type(compiled) is not CompiledStagedDeadLoadProgramme: + raise TypeError("typed compiled staged programme required") + position, cursor, fraction = _progress(compiled.stage_count, position) + if type(inner) is not bytes or not inner or len(inner) > MAX_CHECKPOINT_BYTES: + raise ValueError("bounded staged inner checkpoint bytes required") header = _canonical(dict(policy=compiled.programme.policy, programme=compiled.programme.to_payload(), - position=position, cursor=cursor, fraction=fraction, inner_sha256=sha256(inner).hexdigest())) - size = len(MAGIC)+4+len(header)+len(inner)+32 - if len(header) > MAX_METADATA_BYTES or size > MAX_CHECKPOINT_BYTES: - raise ValueError("staged checkpoint metadata/total byte bound exceeded") - content = MAGIC+len(header).to_bytes(4, "little")+header+inner - return content+sha256(content).digest() - - -def decode_checkpoint(raw): - if (type(raw) is not bytes or not raw.startswith(MAGIC) or - not len(MAGIC)+4+32 < len(raw) <= MAX_CHECKPOINT_BYTES): - raise ValueError("invalid bounded staged checkpoint framing") - start = len(MAGIC)+4 - size = int.from_bytes(raw[len(MAGIC):start], "little") - if not 0 < size <= MAX_METADATA_BYTES or start+size >= len(raw)-32: - raise ValueError("invalid staged checkpoint metadata bound") - if sha256(memoryview(raw)[:-32]).digest() != raw[-32:]: - raise ValueError("staged checkpoint content digest mismatch") - header_raw = raw[start:start+size] - header = _json(header_raw) - if (type(header) is not dict or set(header) != {"policy", "programme", "position", "cursor", "fraction", "inner_sha256"} + position=position, cursor=cursor, fraction=fraction, inner_sha256=sha256(inner).hexdigest())) + size = len(MAGIC)+4+len(header)+len(inner)+32 + if len(header) > MAX_METADATA_BYTES or size > MAX_CHECKPOINT_BYTES: + raise ValueError("staged checkpoint metadata/total byte bound exceeded") + content = MAGIC+len(header).to_bytes(4, "little")+header+inner + return content+sha256(content).digest() + + +def decode_checkpoint(raw): + if (type(raw) is not bytes or not raw.startswith(MAGIC) or + not len(MAGIC)+4+32 < len(raw) <= MAX_CHECKPOINT_BYTES): + raise ValueError("invalid bounded staged checkpoint framing") + start = len(MAGIC)+4 + size = int.from_bytes(raw[len(MAGIC):start], "little") + if not 0 < size <= MAX_METADATA_BYTES or start+size >= len(raw)-32: + raise ValueError("invalid staged checkpoint metadata bound") + if sha256(memoryview(raw)[:-32]).digest() != raw[-32:]: + raise ValueError("staged checkpoint content digest mismatch") + header_raw = raw[start:start+size] + header = _json(header_raw) + if (type(header) is not dict or set(header) != {"policy", "programme", "position", "cursor", "fraction", "inner_sha256"} or header["policy"] not in (POLICY, ZERO_REFERENCE_POLICY) or type(header["position"]) is not float - or type(header["fraction"]) is not float or type(header["cursor"]) is not int - or _canonical(header) != header_raw): - raise ValueError("invalid staged checkpoint fields/types/canonical metadata") + or type(header["fraction"]) is not float or type(header["cursor"]) is not int + or _canonical(header) != header_raw): + raise ValueError("invalid staged checkpoint fields/types/canonical metadata") programme = StagedDeadLoadProgramme.from_payload(header["programme"]) if header["policy"] != programme.policy: raise ValueError("staged checkpoint normalization policy mismatch") - position, cursor, fraction = _progress(programme.stage_count, header["position"]) - if (header["cursor"] != cursor or header["fraction"] != fraction or - _canonical({**header, "position": position, "cursor": cursor, "fraction": fraction}) != header_raw): - raise ValueError("staged checkpoint progress derivation mismatch") - inner = raw[start+size:-32] - if header["inner_sha256"] != sha256(inner).hexdigest(): - raise ValueError("staged checkpoint inner digest mismatch") - return programme, position, inner + position, cursor, fraction = _progress(programme.stage_count, header["position"]) + if (header["cursor"] != cursor or header["fraction"] != fraction or + _canonical({**header, "position": position, "cursor": cursor, "fraction": fraction}) != header_raw): + raise ValueError("staged checkpoint progress derivation mismatch") + inner = raw[start+size:-32] + if header["inner_sha256"] != sha256(inner).hexdigest(): + raise ValueError("staged checkpoint inner digest mismatch") + return programme, position, inner diff --git a/src/anyfesolver/elements.py b/src/anyfesolver/elements.py index beae44a0c..cd24e94b4 100644 --- a/src/anyfesolver/elements.py +++ b/src/anyfesolver/elements.py @@ -1,4435 +1,4435 @@ -""" -Finite Element Implementations - -This module contains element formulations for: -- ShellElement: 3/6-node triangular and 4/8-node quadrilateral Mindlin-Reissner shell element -- BeamElement: 2-node Timoshenko beam element with 6 DOF/node -- QuadraticBeamElement: 3-node quadratic Timoshenko beam element -- CoupledBeamShellElement: kinematic MPC element for eccentric beam-shell interaction - -Shell convention ----------------- -The shell element forms stiffness and stresses in an element-local orthonormal -basis at each integration point: - - local x = projected xi tangent direction - local y = in-surface direction perpendicular to local x - local z = shell normal - -Global nodal translations and rotations are transformed to this local basis -before the membrane, bending and transverse shear B-matrices are evaluated. - -Shell shear treatment ---------------------- -Membrane and bending always use full integration for the element topology. -Transverse shear depends on the topology: - - * 4-node: MITC4 assumed natural shear (covariant shear sampled at the four - edge midpoints and interpolated), integrated at the full 2x2 rule. This - avoids both shear locking and the spurious zero-energy w-hourglass mode - of one-point reduced shear integration. - * 3-node: centroidal edge-compatible assumed shear. This is the constant - shear part of the DSG/MITC3 family: transverse shear is evaluated from - the element-average shear gap in the centroid frame, preserving rigid - body motion and constant-shear patches without the locking-prone fully - integrated linear Mindlin shear term. - * 6-node: quadratic displacement interpolation with reduced three-point - triangular shear integration. - * 8-node: reduced 2x2 shear integration (S8R style). When full element - reduced integration is requested, a small nullspace-projection - hourglass stiffness stabilizes modes outside the six rigid-body modes. - -Beam section convention ------------------------ -Beam local axes are (x = member axis, y, z). ``Iy`` is the second moment of -area about the local y axis and governs bending that deflects the beam in -local z; ``Iz`` governs deflection in local y. ``shear_factor_y`` scales the -shear area for transverse shear force in local y, ``shear_factor_z`` for local -z. The optional ``cross_section["orientation"]`` vector prescribes the local -z direction (e.g. the stiffener web direction). Without it, a heuristic picks -local y close to global Y (or global Z for members nearly parallel to Y), -which leaves the section orientation unconstrained for asymmetric sections. - -Beam-shell coupling -------------------- -Beam-shell coupling is represented as a linear multi-point constraint (MPC), -not as a large penalty spring. For a beam node offset from a shell node by -vector r, the coupling relation is: - - u_beam = u_shell + theta_shell x r - theta_beam = theta_shell - -The assembly solver eliminates these slave beam DOFs through a transformation. -""" - -from __future__ import annotations - -from abc import ABC, abstractmethod -import copy -from types import FunctionType, MemberDescriptorType -import warnings -from typing import TYPE_CHECKING, Any, Callable, Dict, List, Mapping, Optional, Tuple - -import numpy as np -from anymaterial import IsotropicMaterial as _RecoveryIsotropicMaterial -from . import _compensated_contractions as _local_contractions - -from .beam_sections import ( - GENERALIZED_BEAM_RESULTANT_ORDER, - GENERALIZED_BEAM_STRAIN_ORDER, - generalized_beam_mass_matrix, - generalized_beam_stiffness, - resolve_generalized_beam_section, -) -from .jit_compiler import njit -from .material_curves import FiberSectionPlasticityConfig -from .materials import ( - beam_material_properties as _canonical_beam_material_properties, - elastic_compliance_matrix as _canonical_elastic_compliance, - material_symmetry as _canonical_material_symmetry, -) -from .plasticity import lobatto_layers, plane_stress_elastic_matrix, plane_stress_return_map -from .shell_sections import ( - SHELL_MEMBRANE_VOIGT_ORDER, - SHELL_TRANSVERSE_SHEAR_ORDER, - GeneralizedShellSection, - coerce_generalized_shell_section, -) - -if TYPE_CHECKING: - from .fe_core import FEMesh, Material - - -_SMALL = 1.0e-12 -_INITIAL_SHELL_STATE_KEYS = ( - "initial_membrane_stress", - "initial_bending_stress", - "initial_membrane_prestrain", - "initial_curvature_prestrain", - "initial_field_provenance", -) -_INITIAL_BEAM_STATE_KEYS = ( - "initial_fiber_stress", - "initial_fiber_prestrain", - "initial_field_provenance", -) - - -_OBSERVATION_MISSING = object() -_NO_ATTRIBUTE_DEFAULT = object() - - -def _run_post_observation_guard( - post_observation: Optional[Callable[[], None]], -) -> None: - """Recheck a caller-supplied exact authority lease after one observation.""" - - if post_observation is not None: - post_observation() - - -def _guarded_observe_attribute( - owner: Any, - name: str, - *, - default: Any = _NO_ATTRIBUTE_DEFAULT, - post_observation: Optional[Callable[[], None]] = None, -) -> Any: - """Read one external attribute and recheck before consuming its value.""" - - if default is _NO_ATTRIBUTE_DEFAULT: - value = getattr(owner, name) - else: - value = getattr(owner, name, default) - _run_post_observation_guard(post_observation) - return value - - -def _guarded_observe_call( - provider: Any, - *args: Any, - post_observation: Optional[Callable[[], None]] = None, - **kwargs: Any, -) -> Any: - """Invoke one external provider and recheck before consuming its result.""" - - value = provider(*args, **kwargs) - _run_post_observation_guard(post_observation) - return value - - -def _guarded_float( - value: Any, - *, - post_observation: Optional[Callable[[], None]] = None, -) -> float: - made = float(value) - if type(value) is not float: - _run_post_observation_guard(post_observation) - return made - - -def _guarded_array( - value: Any, - *, - dtype: Any = np.float64, - post_observation: Optional[Callable[[], None]] = None, -) -> np.ndarray: - made = np.asarray(value, dtype=dtype) - # Converting an exact numeric ndarray runs no foreign code. - pure = type(value) is np.ndarray and value.dtype.kind in "fiub" - if not pure: - _run_post_observation_guard(post_observation) - owned = np.array(made, dtype=dtype, order="C", copy=True) - if not pure: - _run_post_observation_guard(post_observation) - return owned - - -def _guarded_owned_mapping( - value: Any, - *, - label: str, - post_observation: Optional[Callable[[], None]] = None, -) -> Dict[str, Any]: - """Detach a string-keyed external mapping before later evaluation.""" - - items_provider = _guarded_observe_attribute( - value, - "items", - post_observation=post_observation, - ) - observed_items = _guarded_observe_call( - items_provider, - post_observation=post_observation, - ) - items = tuple(observed_items) - _run_post_observation_guard(post_observation) - owned: Dict[str, Any] = {} - for item in items: - if type(item) is not tuple or len(item) != 2 or type(item[0]) is not str: - raise TypeError(f"{label} must contain exact string keys") - key, member = item - if key in owned: - raise ValueError(f"{label} contains duplicate key {key!r}") - owned[key] = member - return owned - - -def _guarded_owned_plain_value( - value: Any, - *, - label: str, - post_observation: Optional[Callable[[], None]] = None, -) -> Any: - """Recursively detach caller-owned state before formulation mechanics.""" - - if value is None or type(value) in {bool, int, float, str, bytes}: - return value - if type(value) is np.ndarray: - return _guarded_array( - value, - dtype=value.dtype, - post_observation=post_observation, - ) - if isinstance(value, Mapping): - observed = _guarded_owned_mapping( - value, - label=label, - post_observation=post_observation, - ) - return { - key: _guarded_owned_plain_value( - member, - label=f"{label}.{key}", - post_observation=post_observation, - ) - for key, member in observed.items() - } - if type(value) in {list, tuple}: - observed = tuple(value) - _run_post_observation_guard(post_observation) - made = [ - _guarded_owned_plain_value( - member, - label=f"{label}[{index}]", - post_observation=post_observation, - ) - for index, member in enumerate(observed) - ] - return made if type(value) is list else tuple(made) - try: - return _guarded_array( - value, - post_observation=post_observation, - ) - except (TypeError, ValueError) as exc: - raise TypeError(f"{label} contains an unsupported external value") from exc - - -def _guarded_owned_generalized_shell_section( - section: Any, - *, - post_observation: Optional[Callable[[], None]] = None, - _section_class: type[GeneralizedShellSection] = GeneralizedShellSection, -) -> Optional[GeneralizedShellSection]: - """Coerce one section protocol to an exact solver-owned section.""" - - if section is None: - return None - if type(section) is _section_class: - return section - if isinstance(section, Mapping): - source = _guarded_owned_mapping( - section, - label="generalized shell section", - post_observation=post_observation, - ) - - def read(label: str, default: Any = None) -> Any: - return source[label] if label in source else default - - else: - - def read(label: str, default: Any = None) -> Any: - return _guarded_observe_attribute( - section, - label, - default=default, - post_observation=post_observation, - ) - - matrices: Dict[str, np.ndarray] = {} - for name in ("A", "B", "D", "As"): - raw = read(name, _OBSERVATION_MISSING) - if raw is _OBSERVATION_MISSING or raw is None: - raise TypeError( - "Generalized shell section must provide A, B, D and As; " - f"missing {name}" - ) - matrices[name] = _guarded_array( - raw, - post_observation=post_observation, - ) - raw_name = read("name", "") - name = str(raw_name) - _run_post_observation_guard(post_observation) - masses: Dict[str, Optional[float]] = {} - for field in ("mass_per_area", "rotary_inertia_per_area"): - raw = read(field, None) - masses[field] = ( - None - if raw is None - else _guarded_float(raw, post_observation=post_observation) - ) - return _section_class( - A=matrices["A"], - B=matrices["B"], - D=matrices["D"], - As=matrices["As"], - name=name, - mass_per_area=masses["mass_per_area"], - rotary_inertia_per_area=masses["rotary_inertia_per_area"], - ) - - -def _immutable_float64_array(value: Any) -> np.ndarray: - """Return a C-contiguous float64 array backed by immutable bytes. - - Shell quadrature tables are process-wide formulation inputs. A normal - ``setflags(write=False)`` array can be made writable again when it owns its - storage; a bytes-backed view cannot. This prevents one element or test - from silently changing the rule used by every other shell element. - """ - - contiguous = np.ascontiguousarray(value, dtype=np.float64) - return np.frombuffer( - contiguous.tobytes(order="C"), dtype=np.float64 - ).reshape(contiguous.shape) - - -def _copy_state_fields(state: Any, keys: Tuple[str, ...]) -> Dict[str, Any]: - if not isinstance(state, dict): - return {} - copied: Dict[str, Any] = {} - for key in keys: - if key not in state: - continue - value = state[key] - copied[key] = value.copy() if isinstance(value, np.ndarray) else value - return copied - - -def _shell_field_rows(value: Any, n_gp: int, name: str) -> np.ndarray: - """Broadcast a shell-local engineering vector to one row per Gauss point.""" - array = np.asarray(value, dtype=float) - if array.shape == (3,): - return np.broadcast_to(array, (n_gp, 3)).copy() - if array.shape == (1, 3): - return np.broadcast_to(array, (n_gp, 3)).copy() - if array.shape == (n_gp, 3): - return array.copy() - raise ValueError(f"{name} must have shape (3,) or ({n_gp}, 3); got {array.shape}") - - -def _beam_fiber_field( - value: Any, - total_fibers: int, - section_fibers: int, - name: str, -) -> np.ndarray: - """Broadcast a beam-fiber field over one or all integration sections.""" - array = np.asarray(value, dtype=float).reshape(-1) - if array.size == 1: - return np.full(total_fibers, float(array[0]), dtype=float) - if array.size == section_fibers and total_fibers % section_fibers == 0: - return np.tile(array, total_fibers // section_fibers) - if array.size == total_fibers: - return array.copy() - raise ValueError( - f"{name} must be scalar, have {section_fibers} section-fiber values, " - f"or {total_fibers} total values; got {array.size}" - ) - - -@njit -def _cross3(a: np.ndarray, b: np.ndarray) -> np.ndarray: - """Cross product of two 3-vectors without np.cross dispatch overhead.""" - return np.array( - [ - a[1] * b[2] - a[2] * b[1], - a[2] * b[0] - a[0] * b[2], - a[0] * b[1] - a[1] * b[0], - ], - ) - - -@njit -def _inv2(matrix: np.ndarray) -> Tuple[np.ndarray, float]: - """Inverse and determinant of a 2x2 matrix without LAPACK overhead.""" - det = matrix[0, 0] * matrix[1, 1] - matrix[0, 1] * matrix[1, 0] - if abs(det) < _SMALL: - raise np.linalg.LinAlgError("singular 2x2 matrix") - inv = np.array( - [[matrix[1, 1], -matrix[0, 1]], [-matrix[1, 0], matrix[0, 0]]], - ) / det - return inv, float(det) - - -def _section_orientation(cross_section: Dict[str, Any]) -> Optional[np.ndarray]: - """Return the prescribed local-z (web) direction from a cross-section dict.""" - value = cross_section.get("orientation", cross_section.get("web_direction")) - if value is None: - return None - vector = np.asarray(value, dtype=float).reshape(-1) - if vector.size < 3 or float(np.linalg.norm(vector[:3])) < _SMALL: - return None - return np.array(vector[:3], dtype=float) - - -def _beam_rotation_matrix(e1: np.ndarray, orientation: Optional[np.ndarray]) -> np.ndarray: - """Build the beam local frame [e1 e2 e3] with optional prescribed local z. - - ``orientation`` is the requested local z direction (section web direction). - It is projected perpendicular to the member axis; if it is (nearly) - parallel to the axis the heuristic fallback is used instead. - """ - if orientation is not None: - candidate = orientation - np.dot(orientation, e1) * e1 - norm = float(np.linalg.norm(candidate)) - if norm > 1.0e-6 * float(np.linalg.norm(orientation)): - e3 = candidate / norm - e2 = _cross3(e3, e1) - e2 /= np.linalg.norm(e2) - return np.column_stack((e1, e2, e3)) - trial = np.array([0.0, 1.0, 0.0]) - if abs(float(np.dot(e1, trial))) > 0.95: - trial = np.array([0.0, 0.0, 1.0]) - e2 = trial - np.dot(trial, e1) * e1 - e2 /= np.linalg.norm(e2) - e3 = _cross3(e1, e2) - e3 /= np.linalg.norm(e3) - return np.column_stack((e1, e2, e3)) - - -def _elastic_symmetry( - material: Any, - post_observation: Optional[Callable[[], None]] = None, -) -> str: - """Return the normalized elastic symmetry without inventing isotropic aliases.""" - - symmetry = _canonical_material_symmetry(material) - _run_post_observation_guard(post_observation) - if symmetry not in {"isotropic", "orthotropic"}: - raise ValueError( - f"Unsupported elastic symmetry {symmetry!r}; ANYfeSolver currently supports " - "only isotropic and orthotropic materials." - ) - return symmetry - - -def _elastic_compliance( - material: Any, - post_observation: Optional[Callable[[], None]] = None, -) -> np.ndarray: - """Engineering compliance in [11,22,33,23,13,12] order.""" - - if post_observation is None: - raw_compliance = _canonical_elastic_compliance(material) - else: - provider = _guarded_observe_attribute( - material, - "elastic_compliance_matrix", - default=None, - post_observation=post_observation, - ) - if callable(provider): - raw_compliance = _guarded_observe_call( - provider, - post_observation=post_observation, - ) - elif _elastic_symmetry(material, post_observation) == "isotropic": - elastic_modulus = _guarded_float( - _guarded_observe_attribute( - material, - "elastic_modulus", - post_observation=post_observation, - ), - post_observation=post_observation, - ) - poisson_ratio = _guarded_float( - _guarded_observe_attribute( - material, - "poisson_ratio", - post_observation=post_observation, - ), - post_observation=post_observation, - ) - shear_modulus = elastic_modulus / (2.0 * (1.0 + poisson_ratio)) - raw_compliance = np.array( - [ - [ - 1.0 / elastic_modulus, - -poisson_ratio / elastic_modulus, - -poisson_ratio / elastic_modulus, - 0.0, - 0.0, - 0.0, - ], - [ - -poisson_ratio / elastic_modulus, - 1.0 / elastic_modulus, - -poisson_ratio / elastic_modulus, - 0.0, - 0.0, - 0.0, - ], - [ - -poisson_ratio / elastic_modulus, - -poisson_ratio / elastic_modulus, - 1.0 / elastic_modulus, - 0.0, - 0.0, - 0.0, - ], - [0.0, 0.0, 0.0, 1.0 / shear_modulus, 0.0, 0.0], - [0.0, 0.0, 0.0, 0.0, 1.0 / shear_modulus, 0.0], - [0.0, 0.0, 0.0, 0.0, 0.0, 1.0 / shear_modulus], - ], - dtype=float, - ) - else: - raise ValueError( - "Structural material must provide elastic_compliance_matrix()" - ) - compliance = np.asarray(raw_compliance, dtype=float) - _run_post_observation_guard(post_observation) - if compliance.shape != (6, 6) or not np.all(np.isfinite(compliance)): - raise ValueError("elastic_compliance_matrix() must return a finite 6x6 matrix") - if not np.allclose(compliance, compliance.T, rtol=1.0e-10, atol=1.0e-18): - raise ValueError("elastic compliance matrix must be symmetric") - return 0.5 * (compliance + compliance.T) - - -def _shell_elastic_material_cache_fingerprint( - material: Any, - post_observation: Optional[Callable[[], None]] = None, -) -> Tuple[Any, ...]: - """Bind every elastic input consumed by ``_shell_material_matrices``. - - Material objects are intentionally public and may be edited in place. A - cache key based only on object identity therefore admits stale shell - mechanics. Keep the isotropic branch bit-for-bit aligned with the actual - scalar path, including an explicitly supplied shear modulus; use the - canonical compliance bytes for every other supported material protocol. - """ - - symmetry = _elastic_symmetry(material, post_observation) - raw_elastic_modulus = _guarded_observe_attribute( - material, - "elastic_modulus", - default=_OBSERVATION_MISSING, - post_observation=post_observation, - ) - raw_poisson_ratio = _guarded_observe_attribute( - material, - "poisson_ratio", - default=_OBSERVATION_MISSING, - post_observation=post_observation, - ) - if ( - symmetry == "isotropic" - and raw_elastic_modulus is not _OBSERVATION_MISSING - and raw_poisson_ratio is not _OBSERVATION_MISSING - ): - elastic_modulus = _guarded_float( - raw_elastic_modulus, - post_observation=post_observation, - ) - poisson_ratio = _guarded_float( - raw_poisson_ratio, - post_observation=post_observation, - ) - raw_shear_modulus = _guarded_observe_attribute( - material, - "shear_modulus", - default=elastic_modulus / (2.0 * (1.0 + poisson_ratio)), - post_observation=post_observation, - ) - shear_modulus = _guarded_float( - raw_shear_modulus, - post_observation=post_observation, - ) - return ( - "isotropic_scalar_path", - elastic_modulus, - poisson_ratio, - shear_modulus, - ) - compliance = np.ascontiguousarray( - _elastic_compliance(material, post_observation), - dtype=np.float64, - ) - _run_post_observation_guard(post_observation) - return ( - symmetry, - compliance.shape, - compliance.tobytes(order="C"), - ) - - -def _generalized_shell_section_cache_fingerprint( - section: Any, - post_observation: Optional[Callable[[], None]] = None, -) -> Optional[Tuple[Any, ...]]: - """Return the complete stiffness/mass identity of a generalized section.""" - - if section is None: - return None - matrices = [] - for name, shape in (("A", (3, 3)), ("B", (3, 3)), ("D", (3, 3)), ("As", (2, 2))): - raw = _guarded_observe_attribute( - section, - name, - post_observation=post_observation, - ) - value = _guarded_array( - raw, - post_observation=post_observation, - ) - if value.shape != shape or not np.all(np.isfinite(value)): - raise ValueError( - f"Generalized shell section {name} must remain a finite {shape} matrix" - ) - matrices.append((name, shape, value.tobytes(order="C"))) - raw_name = _guarded_observe_attribute( - section, - "name", - default="", - post_observation=post_observation, - ) - name = str(raw_name) - _run_post_observation_guard(post_observation) - mass_values = [] - for field in ("mass_per_area", "rotary_inertia_per_area"): - raw = _guarded_observe_attribute( - section, - field, - default=None, - post_observation=post_observation, - ) - mass_values.append( - None - if raw is None - else _guarded_float(raw, post_observation=post_observation) - ) - return ( - tuple(matrices), - name, - *mass_values, - ) - - -def _in_plane_transform_matrices(angle_rad: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: - """Engineering-strain, stress, and transverse-shear transforms. - - The material 1-axis is rotated by ``angle_rad`` from element-local x - toward local y about the positive shell normal. - """ - - c = float(np.cos(angle_rad)) - s = float(np.sin(angle_rad)) - axes = np.array([[c, -s], [s, c]], dtype=float) - strain_to_material = np.zeros((3, 3), dtype=float) - stress_to_local = np.zeros((3, 3), dtype=float) - for column in range(3): - engineering_strain = np.zeros(3, dtype=float) - engineering_strain[column] = 1.0 - local_tensor = np.array( - [ - [engineering_strain[0], 0.5 * engineering_strain[2]], - [0.5 * engineering_strain[2], engineering_strain[1]], - ], - dtype=float, - ) - material_tensor = axes.T @ local_tensor @ axes - strain_to_material[:, column] = ( - material_tensor[0, 0], - material_tensor[1, 1], - 2.0 * material_tensor[0, 1], - ) - material_stress = np.zeros(3, dtype=float) - material_stress[column] = 1.0 - stress_tensor = np.array( - [ - [material_stress[0], material_stress[2]], - [material_stress[2], material_stress[1]], - ], - dtype=float, - ) - local_stress = axes @ stress_tensor @ axes.T - stress_to_local[:, column] = ( - local_stress[0, 0], - local_stress[1, 1], - local_stress[0, 1], - ) - return strain_to_material, stress_to_local, axes - - -def _compensated_elastic_zero_tangent(element, mesh, material, post_observation=None): - """Scalar zero-state realization, called only after qualified elastic admission. - - Preserve scalar coefficient operations, including reciprocal-compliance - drill, independently of the batch coefficient construction. No state/cache - or caller eligibility is changed here. - """ - geometry = element._nonlinear_geometry(mesh) - membrane, shear, _strain, _stress = _shell_material_matrices( - material, element._material_angle(geometry["R0"]), post_observation) - modulus = 1.0 / float(_elastic_compliance(material, post_observation)[5, 5]) - h = element.thickness - result = _local_contractions.shell_zero_tangent( - geometry, h * membrane, h**3 / 12.0 * membrane, - shear * (5.0 / 6.0) * h, modulus * h * element.drilling_stabilization) - if post_observation is not None: - post_observation() - return result - - -def _shell_material_matrices( - material: Any, - angle_rad: float, - post_observation: Optional[Callable[[], None]] = None, -) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]: - """Return local plane-stress/shear matrices and material-axis transforms.""" - - symmetry = _elastic_symmetry(material, post_observation) - # Preserve the legacy isotropic arithmetic exactly. Forming and reducing - # the 3-D compliance is mathematically equivalent, but its final-bit - # roundoff can perturb tightly qualified eigenvalue thresholds. External - # protocol objects without the historical scalar fields still use the - # compliance path below. - raw_elastic_modulus = _guarded_observe_attribute( - material, - "elastic_modulus", - default=_OBSERVATION_MISSING, - post_observation=post_observation, - ) - raw_poisson_ratio = _guarded_observe_attribute( - material, - "poisson_ratio", - default=_OBSERVATION_MISSING, - post_observation=post_observation, - ) - if ( - symmetry == "isotropic" - and raw_elastic_modulus is not _OBSERVATION_MISSING - and raw_poisson_ratio is not _OBSERVATION_MISSING - ): - E = _guarded_float( - raw_elastic_modulus, - post_observation=post_observation, - ) - nu = _guarded_float( - raw_poisson_ratio, - post_observation=post_observation, - ) - raw_shear_modulus = _guarded_observe_attribute( - material, - "shear_modulus", - default=E / (2.0 * (1.0 + nu)), - post_observation=post_observation, - ) - G = _guarded_float( - raw_shear_modulus, - post_observation=post_observation, - ) - Q_material = E / (1.0 - nu**2) * np.array( - [ - [1.0, nu, 0.0], - [nu, 1.0, 0.0], - [0.0, 0.0, (1.0 - nu) / 2.0], - ], - dtype=float, - ) - return ( - Q_material, - G * np.eye(2, dtype=float), - np.eye(3, dtype=float), - np.eye(3, dtype=float), - ) - - compliance = _elastic_compliance(material, post_observation) - membrane_indices = np.array([0, 1, 5], dtype=np.intp) - shear_indices = np.array([4, 3], dtype=np.intp) # [13, 23] - Q_material = np.linalg.inv(compliance[np.ix_(membrane_indices, membrane_indices)]) - G_material = np.linalg.inv(compliance[np.ix_(shear_indices, shear_indices)]) - strain_to_material, stress_to_local, axes = _in_plane_transform_matrices(angle_rad) - Q_local = stress_to_local @ Q_material @ strain_to_material - G_local = axes @ G_material @ axes.T - return ( - 0.5 * (Q_local + Q_local.T), - 0.5 * (G_local + G_local.T), - strain_to_material, - stress_to_local, - ) - - -def _beam_material_properties(material: Any, cross_section: Dict[str, Any]) -> Tuple[float, float, float, float]: - """Return E1, G12, G13 and torsional rigidity for a beam.""" - - properties = _canonical_beam_material_properties(material) - E1 = float(properties.axial_modulus) - G12 = float(properties.shear_modulus_xy) - G13 = float(properties.shear_modulus_xz) - if _elastic_symmetry(material) == "orthotropic": - value = cross_section.get("torsional_rigidity") - try: - torsional_rigidity = float(value) - except (TypeError, ValueError): - torsional_rigidity = float("nan") - if not np.isfinite(torsional_rigidity) or torsional_rigidity <= 0.0: - raise ValueError( - "Orthotropic beam sections require a positive " - "cross_section['torsional_rigidity'] in N*m^2." - ) - else: - torsional_rigidity = G12 * float(cross_section.get("J", 1.0e-8)) - return E1, G12, G13, torsional_rigidity - - -def _beam2_basic_deformation_matrix(length: float) -> np.ndarray: - """Map local Beam2 DOFs to six work-conjugate basic deformations.""" - - L = float(length) - transform = np.zeros((6, 12), dtype=float) - # Axial extension and torsional rotation. - transform[0, 0], transform[0, 6] = -1.0, 1.0 - transform[1, 3], transform[1, 9] = -1.0, 1.0 - # Bending about y: rotations relative to the rigid chord rotation - # ry + (w2-w1)/L. - transform[2, 2], transform[2, 8], transform[2, 4] = ( - -1.0 / L, - 1.0 / L, - 1.0, - ) - transform[3, 2], transform[3, 8], transform[3, 10] = ( - -1.0 / L, - 1.0 / L, - 1.0, - ) - # Bending about z: rotations relative to the rigid chord rotation - # rz - (v2-v1)/L. - transform[4, 1], transform[4, 7], transform[4, 5] = ( - 1.0 / L, - -1.0 / L, - 1.0, - ) - transform[5, 1], transform[5, 7], transform[5, 11] = ( - 1.0 / L, - -1.0 / L, - 1.0, - ) - return transform - - -def _beam2_force_interpolation(length: float, xi: float) -> np.ndarray: - """Map Beam2 basic forces to equilibrium section resultants.""" - - L = float(length) - x_over_length = 0.5 * (float(xi) + 1.0) - interpolation = np.zeros((6, 6), dtype=float) - interpolation[0, 0] = 1.0 # N - interpolation[3, 1] = 1.0 # T - # q[2:4] are the two basic local-y bending rotations. - interpolation[2, 2:4] = 1.0 / L # Vz - interpolation[4, 2] = -1.0 + x_over_length # My - interpolation[4, 3] = x_over_length - # q[4:6] are the two basic local-z bending rotations. The sign of Vy - # follows gamma_xy = v' - rz. - interpolation[1, 4:6] = -1.0 / L # Vy - interpolation[5, 4] = -1.0 + x_over_length # Mz - interpolation[5, 5] = x_over_length - return interpolation - - -def _beam2_generalized_flexibility( - length: float, - section_stiffness: np.ndarray, -) -> Tuple[np.ndarray, np.ndarray]: - """Return exact constant-section basic flexibility and stiffness.""" - - L = float(length) - compliance = np.linalg.inv(np.asarray(section_stiffness, dtype=float)) - flexibility = np.zeros((6, 6), dtype=float) - points = (-np.sqrt(3.0 / 5.0), 0.0, np.sqrt(3.0 / 5.0)) - weights = (5.0 / 9.0, 8.0 / 9.0, 5.0 / 9.0) - for xi, weight in zip(points, weights): - interpolation = _beam2_force_interpolation(L, xi) - flexibility += ( - interpolation.T - @ compliance - @ interpolation - * (L / 2.0 * weight) - ) - return flexibility, np.linalg.inv(flexibility) - - -def _beam_generalized_strain_matrix_from_shape( - shape_functions: np.ndarray, - shape_derivatives: np.ndarray, -) -> np.ndarray: - """Build a generalized beam B-matrix from compatible shape functions.""" - - N = np.asarray(shape_functions, dtype=float).reshape(-1) - derivative = np.asarray(shape_derivatives, dtype=float).reshape(-1) - if derivative.size != N.size: - raise ValueError("beam shape function and derivative sizes must match") - B = np.zeros((6, 6 * N.size), dtype=float) - for i in range(N.size): - base = 6 * i - B[0, base + 0] = derivative[i] # eps_x - B[1, base + 1] = derivative[i] # gamma_xy = v' - rz - B[1, base + 5] = -N[i] - B[2, base + 2] = derivative[i] # gamma_xz = w' + ry - B[2, base + 4] = N[i] - B[3, base + 3] = derivative[i] # kappa_x - B[4, base + 4] = derivative[i] # kappa_y - B[5, base + 5] = derivative[i] # kappa_z - return B - - -def _generalized_beam_recovery( - strains: np.ndarray, - resultants: np.ndarray, - *, - stations: Optional[np.ndarray] = None, -) -> Dict[str, Any]: - """Build resultants-only recovery without inventing physical stresses.""" - - strain_values = np.asarray(strains, dtype=float) - resultant_values = np.asarray(resultants, dtype=float) - recovered: Dict[str, Any] = { - "generalized_strain": strain_values.copy(), - "generalized_resultant": resultant_values.copy(), - "generalized_strain_order": GENERALIZED_BEAM_STRAIN_ORDER, - "generalized_resultant_order": GENERALIZED_BEAM_RESULTANT_ORDER, - "recovery_scope": "section_resultants_only", - "physical_stress_available": False, - "resultant_frame": "beam_local", - "station_coordinate_system": "natural_xi", - } - for index, key in enumerate(GENERALIZED_BEAM_STRAIN_ORDER): - recovered[key] = ( - float(strain_values[index]) - if strain_values.ndim == 1 - else strain_values[:, index].copy() - ) - for index, key in enumerate(GENERALIZED_BEAM_RESULTANT_ORDER): - recovered[key] = ( - float(resultant_values[index]) - if resultant_values.ndim == 1 - else resultant_values[:, index].copy() - ) - descriptive_strains = ( - "axial_strain", - "shear_strain_xy", - "shear_strain_xz", - "twist_rate", - "curvature_y", - "curvature_z", - ) - descriptive_resultants = ( - "axial_force", - "shear_force_y", - "shear_force_z", - "torsional_moment", - "bending_moment_y", - "bending_moment_z", - ) - for index, key in enumerate(descriptive_strains): - recovered[key] = ( - float(strain_values[index]) - if strain_values.ndim == 1 - else strain_values[:, index].copy() - ) - for index, key in enumerate(descriptive_resultants): - recovered[key] = ( - float(resultant_values[index]) - if resultant_values.ndim == 1 - else resultant_values[:, index].copy() - ) - if stations is not None: - recovered["station_coordinates"] = np.asarray( - stations, - dtype=float, - ).copy() - return recovered - - -def _beam_flow_scale(material: Any, curve: Any) -> float: - """Scale a scalar hardening curve to the Hill longitudinal strength X. - - With no curve, the returned value is the constant perfect-plastic flow - stress. Otherwise it multiplies the curve so ``flow_stress(0) == X``. - """ - - if _elastic_symmetry(material) != "orthotropic": - return 1.0 - hill_yield = getattr(material, "hill_yield", None) - if hill_yield is None: - raise ValueError( - f"Orthotropic material {getattr(material, 'name', '')!r} " - "requires hill_yield for beam fiber plasticity." - ) - if curve is None: - return float(hill_yield.X) - reference = float(np.asarray(curve.flow_stress(np.array([0.0])), dtype=float)[0]) - if not np.isfinite(reference) or reference <= 0.0: - raise ValueError("hardening curve must provide a positive initial flow stress") - return float(hill_yield.X) / reference - - -def _rotation_vector_from_matrix(rotation: np.ndarray) -> np.ndarray: - """Return the axis-angle rotation vector for a proper 3x3 rotation matrix.""" - R = np.asarray(rotation, dtype=float).reshape(3, 3) - trace_value = float(np.trace(R)) - cos_angle = max(min((trace_value - 1.0) / 2.0, 1.0), -1.0) - angle = float(np.arccos(cos_angle)) - if angle < 1.0e-12: - return 0.5 * np.array( - [R[2, 1] - R[1, 2], R[0, 2] - R[2, 0], R[1, 0] - R[0, 1]], - dtype=float, - ) - if abs(np.pi - angle) < 1.0e-6: - axis = np.sqrt(np.maximum(np.diag(R) + 1.0, 0.0) / 2.0) - if R[2, 1] - R[1, 2] < 0.0: - axis[0] *= -1.0 - if R[0, 2] - R[2, 0] < 0.0: - axis[1] *= -1.0 - if R[1, 0] - R[0, 1] < 0.0: - axis[2] *= -1.0 - norm = float(np.linalg.norm(axis)) - if norm <= _SMALL: - return np.zeros(3, dtype=float) - return angle * axis / norm - axis = np.array( - [R[2, 1] - R[1, 2], R[0, 2] - R[2, 0], R[1, 0] - R[0, 1]], - dtype=float, - ) / (2.0 * np.sin(angle)) - return angle * axis - - -_STRICT_FLAT_S3_V2_CANDIDATE_ID = "CANDIDATE_E4_PL_S3_V2A_FLAT_LINEAR_V1" -_STRICT_FLAT_S3_V2B_CANDIDATE_ID = "CANDIDATE_E4_PL_S3_V2B_FLAT_LINEAR_V1" -_STRICT_FLAT_S3_V2C_CANDIDATE_ID = "CANDIDATE_E4_PL_S3_V2C_FLAT_LINEAR_PARITY_V1" -_S3_V2D_NATIVE_PARITY_CANDIDATE_ID = "CANDIDATE_E4_PL_S3_V2D_NATIVE_PARITY_V1" - - -def _reject_strict_flat_s3_v2_legacy_dispatch( - element: Any, operation: str -) -> None: - if ( - getattr(type(element), "_legacy_shell_dispatch_forbidden", None) - in { - _STRICT_FLAT_S3_V2_CANDIDATE_ID, - _STRICT_FLAT_S3_V2B_CANDIDATE_ID, - _STRICT_FLAT_S3_V2C_CANDIDATE_ID, - _S3_V2D_NATIVE_PARITY_CANDIDATE_ID, - } - ): - from .element_capabilities import ElementCapabilityError - - raise ElementCapabilityError( - "strict-flat S3 V2 forbids explicit legacy ShellElement dispatch: " - + operation - ) - - -class Element(ABC): - """Abstract base class for all FE elements.""" - - def __init__(self, element_id: int, node_ids: List[int], material_name: str = "default"): - self.element_id = element_id - self.node_ids = node_ids - self.material_name = material_name - self._stiffness_matrix: Optional[np.ndarray] = None - self._mass_matrix: Optional[np.ndarray] = None - self._internal_forces: Optional[np.ndarray] = None - - def __deepcopy__(self, memo: Dict[int, Any]) -> "Element": - """Copy instance state without asking ``copyreg`` about the class. - - The generic ``copy.deepcopy`` reconstruction path may lazily add a - ``__slotnames__`` cache to a class. Element class namespaces are part - of the qualified Q4/S3 runtime authority, so even copying a legacy - element must not mutate them. Build the uninitialised instance - directly, copy its instance dictionary, and explicitly copy any slots - declared anywhere in a concrete subclass hierarchy. - """ - - _reject_strict_flat_s3_v2_legacy_dispatch(self, "Element.__deepcopy__") - source_id = id(self) - if source_id in memo: - return memo[source_id] - - cls = type(self) - made = object.__new__(cls) - memo[source_id] = made - - try: - source_namespace = object.__getattribute__(self, "__dict__") - target_namespace = object.__getattribute__(made, "__dict__") - except AttributeError: - source_namespace = None - target_namespace = None - if source_namespace is not None and target_namespace is not None: - for name, value in source_namespace.items(): - target_namespace[name] = copy.deepcopy(value, memo) - - for owner in type.__getattribute__(cls, "__mro__"): - namespace = type.__getattribute__(owner, "__dict__") - for slot_name, descriptor in namespace.items(): - if type(descriptor) is not MemberDescriptorType: - continue - try: - value = object.__getattribute__(self, slot_name) - except AttributeError: - continue - object.__setattr__(made, slot_name, copy.deepcopy(value, memo)) - return made - - @property - @abstractmethod - def num_nodes(self) -> int: - raise NotImplementedError - - @property - @abstractmethod - def dofs_per_node(self) -> int: - raise NotImplementedError - - @property - def total_dofs(self) -> int: - return self.num_nodes * self.dofs_per_node - - @abstractmethod - def get_node_coordinates(self, mesh: "FEMesh") -> np.ndarray: - raise NotImplementedError - - @abstractmethod - def compute_stiffness_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: - raise NotImplementedError - - def compute_mass_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: - _reject_strict_flat_s3_v2_legacy_dispatch(self, "Element.compute_mass_matrix") - return np.zeros((self.total_dofs, self.total_dofs)) - - def compute_geometric_stiffness_matrix( - self, - mesh: "FEMesh", - material: "Material", - state: Optional[Any] = None, - ) -> np.ndarray: - _reject_strict_flat_s3_v2_legacy_dispatch( - self, "Element.compute_geometric_stiffness_matrix" - ) - return np.zeros((self.total_dofs, self.total_dofs)) - - def compute_internal_forces( - self, mesh: "FEMesh", displacements: np.ndarray, material: "Material" - ) -> np.ndarray: - _reject_strict_flat_s3_v2_legacy_dispatch( - self, "Element.compute_internal_forces" - ) - return np.zeros(self.total_dofs) - - def compute_nonlinear_response( - self, - mesh: "FEMesh", - material: "Material", - u_elem: np.ndarray, - state: Optional[Any] = None, - num_layers: int = 5, - tangent: bool = True, - ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: - """Internal force vector, tangent stiffness and trial state at u_elem. - - The default is linear elastic: F = K u with the constant stiffness as - tangent. Elements supporting geometric and/or material nonlinearity - override this. The returned state is a trial state; the incremental - solver commits it only when the load step converges. With - ``tangent=False`` the stiffness entry may be None (used by the line - search, which only needs residuals). - """ - _reject_strict_flat_s3_v2_legacy_dispatch( - self, "Element.compute_nonlinear_response" - ) - K = self._stiffness_matrix - if K is None: - K = self.compute_stiffness_matrix(mesh, material) - return K @ u_elem, (K if tangent else None), state - - def compute_stresses( - self, - mesh: "FEMesh", - displacements: np.ndarray, - material: "Material", - return_global: bool = False, - ) -> Dict[str, Any]: - _reject_strict_flat_s3_v2_legacy_dispatch(self, "Element.compute_stresses") - return {} - - def get_dof_mapping(self, mesh: "FEMesh") -> List[int]: - dof_mapping: List[int] = [] - for node_id in self.node_ids: - node = mesh.get_node(node_id) - if node: - dof_mapping.extend(node.dofs) - return dof_mapping - - def _get_element_displacements(self, mesh: "FEMesh", displacements: np.ndarray) -> np.ndarray: - u = np.asarray(displacements, dtype=float) - if u.size == self.total_dofs: - return u.copy() - dof_mapping = self.get_dof_mapping(mesh) - if not dof_mapping: - return np.zeros(self.total_dofs) - dof_indices = np.asarray(dof_mapping, dtype=np.intp) - if int(dof_indices.max()) >= u.size: - raise IndexError( - f"Displacement vector has length {u.size}, but element {self.element_id} " - f"requires global DOF {int(dof_indices.max())}." - ) - return u[dof_indices] - - def to_dict(self) -> Dict[str, Any]: - _reject_strict_flat_s3_v2_legacy_dispatch(self, "Element.to_dict") - return { - "element_id": self.element_id, - "type": self.__class__.__name__, - "node_ids": self.node_ids, - "material_name": self.material_name, - } - - -def _install_strict_flat_s3_v2_element_base_guards() -> None: - """Capture the V2 guard in Element routes exposed by explicit dispatch.""" - - from functools import wraps - from inspect import signature - - guard = _reject_strict_flat_s3_v2_legacy_dispatch - names = ( - "__deepcopy__", - "compute_mass_matrix", - "compute_geometric_stiffness_matrix", - "compute_internal_forces", - "compute_nonlinear_response", - "compute_stresses", - "to_dict", - ) - for name in names: - original = vars(Element)[name] - - @wraps(original) - def guarded( - self: Any, - *args: Any, - __name: str = name, - __original: Callable[..., Any] = original, - __guard: Callable[[Any, str], None] = guard, - **kwargs: Any, - ) -> Any: - __guard(self, f"Element.{__name}") - return __original(self, *args, **kwargs) - - guarded.__signature__ = signature(original) # type: ignore[attr-defined] - delattr(guarded, "__wrapped__") - setattr(Element, name, guarded) - - -_install_strict_flat_s3_v2_element_base_guards() -del _install_strict_flat_s3_v2_element_base_guards - - -@njit -def _jit_compute_4node_shape_functions(xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: - N = np.array( - [ - 0.25 * (1.0 - xi) * (1.0 - eta), - 0.25 * (1.0 + xi) * (1.0 - eta), - 0.25 * (1.0 + xi) * (1.0 + eta), - 0.25 * (1.0 - xi) * (1.0 + eta), - ], - ) - dN_dxi = np.array( - [ - -0.25 * (1.0 - eta), - 0.25 * (1.0 - eta), - 0.25 * (1.0 + eta), - -0.25 * (1.0 + eta), - ], - ) - dN_deta = np.array( - [ - -0.25 * (1.0 - xi), - -0.25 * (1.0 + xi), - 0.25 * (1.0 + xi), - 0.25 * (1.0 - xi), - ], - ) - return N, dN_dxi, dN_deta - - -@njit -def _jit_compute_8node_shape_functions(xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: - N = np.zeros(8, dtype=float) - N[0] = -0.25 * (1.0 - xi) * (1.0 - eta) * (1.0 + xi + eta) - N[1] = -0.25 * (1.0 + xi) * (1.0 - eta) * (1.0 - xi + eta) - N[2] = -0.25 * (1.0 + xi) * (1.0 + eta) * (1.0 - xi - eta) - N[3] = -0.25 * (1.0 - xi) * (1.0 + eta) * (1.0 + xi - eta) - N[4] = 0.5 * (1.0 - xi**2) * (1.0 - eta) - N[5] = 0.5 * (1.0 + xi) * (1.0 - eta**2) - N[6] = 0.5 * (1.0 - xi**2) * (1.0 + eta) - N[7] = 0.5 * (1.0 - xi) * (1.0 - eta**2) - - dN_dxi = np.zeros(8, dtype=float) - dN_dxi[0] = 0.25 * (1.0 - eta) * (1.0 + xi + eta) - 0.25 * (1.0 - xi) * (1.0 - eta) - dN_dxi[1] = -0.25 * (1.0 - eta) * (1.0 - xi + eta) + 0.25 * (1.0 + xi) * (1.0 - eta) - dN_dxi[2] = -0.25 * (1.0 + eta) * (1.0 - xi - eta) + 0.25 * (1.0 + xi) * (1.0 + eta) - dN_dxi[3] = 0.25 * (1.0 + eta) * (1.0 + xi - eta) - 0.25 * (1.0 - xi) * (1.0 + eta) - dN_dxi[4] = -xi * (1.0 - eta) - dN_dxi[5] = 0.5 * (1.0 - eta**2) - dN_dxi[6] = -xi * (1.0 + eta) - dN_dxi[7] = -0.5 * (1.0 - eta**2) - - dN_deta = np.zeros(8, dtype=float) - dN_deta[0] = 0.25 * (1.0 - xi) * (1.0 + xi + eta) - 0.25 * (1.0 - xi) * (1.0 - eta) - dN_deta[1] = 0.25 * (1.0 + xi) * (1.0 - xi + eta) - 0.25 * (1.0 + xi) * (1.0 - eta) - dN_deta[2] = -0.25 * (1.0 + xi) * (1.0 - xi - eta) + 0.25 * (1.0 + xi) * (1.0 + eta) - dN_deta[3] = -0.25 * (1.0 - xi) * (1.0 + xi - eta) + 0.25 * (1.0 - xi) * (1.0 + eta) - dN_deta[4] = -0.5 * (1.0 - xi**2) - dN_deta[5] = -eta * (1.0 + xi) - dN_deta[6] = 0.5 * (1.0 - xi**2) - dN_deta[7] = -eta * (1.0 - xi) - return N, dN_dxi, dN_deta - - -@njit -def _jit_compute_3node_shape_functions(r: float, s: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: - N = np.array([1.0 - r - s, r, s]) - dN_dr = np.array([-1.0, 1.0, 0.0]) - dN_ds = np.array([-1.0, 0.0, 1.0]) - return N, dN_dr, dN_ds - - -@njit -def _jit_compute_6node_shape_functions(r: float, s: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: - l1 = 1.0 - r - s - l2 = r - l3 = s - - N = np.zeros(6, dtype=float) - N[0] = l1 * (2.0 * l1 - 1.0) - N[1] = l2 * (2.0 * l2 - 1.0) - N[2] = l3 * (2.0 * l3 - 1.0) - N[3] = 4.0 * l1 * l2 - N[4] = 4.0 * l2 * l3 - N[5] = 4.0 * l3 * l1 - - dN_dr = np.zeros(6, dtype=float) - dN_dr[0] = 1.0 - 4.0 * l1 - dN_dr[1] = 4.0 * l2 - 1.0 - dN_dr[2] = 0.0 - dN_dr[3] = 4.0 * (l1 - l2) - dN_dr[4] = 4.0 * l3 - dN_dr[5] = -4.0 * l3 - - dN_ds = np.zeros(6, dtype=float) - dN_ds[0] = 1.0 - 4.0 * l1 - dN_ds[1] = 0.0 - dN_ds[2] = 4.0 * l3 - 1.0 - dN_ds[3] = -4.0 * l2 - dN_ds[4] = 4.0 * l2 - dN_ds[5] = 4.0 * (l1 - l3) - return N, dN_dr, dN_ds - - -@njit -def _jit_integrate_nonlinear_response( - u_loc: np.ndarray, - N_res: np.ndarray, - M_res: np.ndarray, - C0: np.ndarray, - C1: np.ndarray, - C2: np.ndarray, - B_m_all: np.ndarray, - B_b_all: np.ndarray, - B_d_all: np.ndarray, - Gw_all: np.ndarray, - detw_all: np.ndarray, - B_s_all: np.ndarray, - detw_shear_all: np.ndarray, - D_shear: np.ndarray, - drilling_stiffness: float, - tangent: bool, - has_plasticity: bool, - n_dof: int, -) -> Tuple[np.ndarray, np.ndarray]: - F_loc = np.zeros(n_dof) - K_loc = np.zeros((n_dof, n_dof)) - - n_gp = len(detw_all) - for g in range(n_gp): - detw = detw_all[g] - B_m = B_m_all[g] - B_b = B_b_all[g] - B_d = B_d_all[g] - Gw = Gw_all[g] - - # Calculate theta = Gw @ u_loc - theta_0 = 0.0 - theta_1 = 0.0 - for i in range(n_dof): - theta_0 += Gw[0, i] * u_loc[i] - theta_1 += Gw[1, i] * u_loc[i] - - # Calculate B_eff = B_m + B_nl - B_eff = np.zeros((3, n_dof)) - for i in range(n_dof): - B_eff[0, i] = B_m[0, i] + theta_0 * Gw[0, i] - B_eff[1, i] = B_m[1, i] + theta_1 * Gw[1, i] - B_eff[2, i] = B_m[2, i] + theta_0 * Gw[1, i] + theta_1 * Gw[0, i] - - # B_eff.T @ N_res[g] + B_b.T @ M_res[g] - N_g = N_res[g] - M_g = M_res[g] - B_eff_T_N = np.zeros(n_dof) - B_b_T_M = np.zeros(n_dof) - for i in range(n_dof): - B_eff_T_N[i] = B_eff[0, i] * N_g[0] + B_eff[1, i] * N_g[1] + B_eff[2, i] * N_g[2] - B_b_T_M[i] = B_b[0, i] * M_g[0] + B_b[1, i] * M_g[1] + B_b[2, i] * M_g[2] - - # B_d @ u_loc - Bd_u = 0.0 - for i in range(n_dof): - Bd_u += B_d[0, i] * u_loc[i] - - for i in range(n_dof): - F_loc[i] += (B_eff_T_N[i] + B_b_T_M[i]) * detw - F_loc[i] += B_d[0, i] * (drilling_stiffness * Bd_u) * detw - - if not tangent: - continue - - # K_loc += (B_eff.T @ C0[g] @ B_eff + B_b.T @ C2[g] @ B_b) * detw - C0_g = C0[g] - C2_g = C2[g] - - C0_B_eff = np.zeros((3, n_dof)) - C2_B_b = np.zeros((3, n_dof)) - for r in range(3): - for c in range(n_dof): - val0 = 0.0 - val2 = 0.0 - for k in range(3): - val0 += C0_g[r, k] * B_eff[k, c] - val2 += C2_g[r, k] * B_b[k, c] - C0_B_eff[r, c] = val0 - C2_B_b[r, c] = val2 - - for r in range(n_dof): - for c in range(n_dof): - val_eff = 0.0 - val_b = 0.0 - for k in range(3): - val_eff += B_eff[k, r] * C0_B_eff[k, c] - val_b += B_b[k, r] * C2_B_b[k, c] - K_loc[r, c] += (val_eff + val_b) * detw - - if has_plasticity: - # Membrane-bending coupling: - # B_eff.T @ C1 @ B_b + B_b.T @ C1.T @ B_eff. - # Layered material tangents make C1 symmetric, while a general - # pre-integrated section may legitimately supply a non-symmetric - # B coupling block in the symmetric [[A, B], [B.T, D]] law. - C1_g = C1[g] - C1_B_b = np.zeros((3, n_dof)) - C1_T_B_eff = np.zeros((3, n_dof)) - for r in range(3): - for c in range(n_dof): - val_b = 0.0 - val_eff = 0.0 - for k in range(3): - val_b += C1_g[r, k] * B_b[k, c] - val_eff += C1_g[k, r] * B_eff[k, c] - C1_B_b[r, c] = val_b - C1_T_B_eff[r, c] = val_eff - - for r in range(n_dof): - for c in range(n_dof): - forward = 0.0 - reverse = 0.0 - for k in range(3): - forward += B_eff[k, r] * C1_B_b[k, c] - reverse += B_b[k, r] * C1_T_B_eff[k, c] - K_loc[r, c] += (forward + reverse) * detw - - # Geometric initial stress stiffness - N00 = N_g[0] - N11 = N_g[1] - N01 = N_g[2] - - N_Gw_0 = N00 * Gw[0] + N01 * Gw[1] - N_Gw_1 = N01 * Gw[0] + N11 * Gw[1] - for r in range(n_dof): - for c in range(n_dof): - K_loc[r, c] += (Gw[0, r] * N_Gw_0[c] + Gw[1, r] * N_Gw_1[c]) * detw - K_loc[r, c] += B_d[0, r] * (drilling_stiffness * B_d[0, c]) * detw - - # Shear stiffness and force contribution - for g in range(len(detw_shear_all)): - detw_s = detw_shear_all[g] - B_s = B_s_all[g] - - # F_loc += K_s @ u_loc - Bs_u_0 = 0.0 - Bs_u_1 = 0.0 - for i in range(n_dof): - Bs_u_0 += B_s[0, i] * u_loc[i] - Bs_u_1 += B_s[1, i] * u_loc[i] - - f_s_0 = D_shear[0, 0] * Bs_u_0 + D_shear[0, 1] * Bs_u_1 - f_s_1 = D_shear[1, 0] * Bs_u_0 + D_shear[1, 1] * Bs_u_1 - - for i in range(n_dof): - F_loc[i] += (B_s[0, i] * f_s_0 + B_s[1, i] * f_s_1) * detw_s - - if not tangent: - continue - - # K_loc += K_s - C_s = np.zeros((2, n_dof)) - for r in range(2): - for c in range(n_dof): - C_s[r, c] = D_shear[r, 0] * B_s[0, c] + D_shear[r, 1] * B_s[1, c] - - for r in range(n_dof): - for c in range(n_dof): - K_loc[r, c] += (B_s[0, r] * C_s[0, c] + B_s[1, r] * C_s[1, c]) * detw_s - - return F_loc, K_loc - - -def _integrate_nonlinear_tangent_components( - u_loc: np.ndarray, - N_res: np.ndarray, - M_res: np.ndarray, - C0: np.ndarray, - C1: np.ndarray, - C2: np.ndarray, - B_m_all: np.ndarray, - B_b_all: np.ndarray, - B_d_all: np.ndarray, - Gw_all: np.ndarray, - detw_all: np.ndarray, - B_s_all: np.ndarray, - detw_shear_all: np.ndarray, - D_shear: np.ndarray, - drilling_stiffness: float, - has_membrane_bending_coupling: bool, - n_dof: int, -) -> Tuple[np.ndarray, np.ndarray]: - """Integrate constitutive and stress-Hessian tangents independently. - - The two calls deliberately reuse :func:`_jit_integrate_nonlinear_response` - rather than recovering one component as ``total - other``. The material - call carries the exact current algorithmic moduli, transverse shear and - drilling terms with zero resultants. The geometric call carries the exact - tension-positive membrane resultants with every constitutive/numerical - modulus set to zero. Consequently both pieces use the same Gauss order, - von-Karman ``B_eff`` construction and arithmetic kernel as the ordinary - nonlinear tangent. - """ - - zero_resultants = np.zeros_like(np.asarray(N_res, dtype=float)) - _unused_force, material = _jit_integrate_nonlinear_response( - np.asarray(u_loc, dtype=float), - zero_resultants, - np.zeros_like(np.asarray(M_res, dtype=float)), - np.asarray(C0, dtype=float), - np.asarray(C1, dtype=float), - np.asarray(C2, dtype=float), - np.asarray(B_m_all, dtype=float), - np.asarray(B_b_all, dtype=float), - np.asarray(B_d_all, dtype=float), - np.asarray(Gw_all, dtype=float), - np.asarray(detw_all, dtype=float), - np.asarray(B_s_all, dtype=float), - np.asarray(detw_shear_all, dtype=float), - np.asarray(D_shear, dtype=float), - float(drilling_stiffness), - True, - bool(has_membrane_bending_coupling), - int(n_dof), - ) - zero_C0 = np.zeros_like(np.asarray(C0, dtype=float)) - zero_C1 = np.zeros_like(np.asarray(C1, dtype=float)) - zero_C2 = np.zeros_like(np.asarray(C2, dtype=float)) - zero_shear = np.zeros_like(np.asarray(D_shear, dtype=float)) - _unused_force, geometric = _jit_integrate_nonlinear_response( - np.asarray(u_loc, dtype=float), - np.asarray(N_res, dtype=float), - np.asarray(M_res, dtype=float), - zero_C0, - zero_C1, - zero_C2, - np.asarray(B_m_all, dtype=float), - np.asarray(B_b_all, dtype=float), - np.asarray(B_d_all, dtype=float), - np.asarray(Gw_all, dtype=float), - np.asarray(detw_all, dtype=float), - np.asarray(B_s_all, dtype=float), - np.asarray(detw_shear_all, dtype=float), - zero_shear, - 0.0, - True, - False, - int(n_dof), - ) - return material, geometric - - -class ShellElement(Element): - """3/6-node triangular and 4/8-node quadrilateral Mindlin-Reissner shell element.""" - - TRI_GAUSS_POINTS_1 = _immutable_float64_array( - [[1.0 / 3.0, 1.0 / 3.0]] - ) - TRI_GAUSS_WEIGHTS_1 = _immutable_float64_array([0.5]) - - TRI_GAUSS_POINTS_3 = _immutable_float64_array( - [[1.0 / 6.0, 1.0 / 6.0], [2.0 / 3.0, 1.0 / 6.0], [1.0 / 6.0, 2.0 / 3.0]], - ) - TRI_GAUSS_WEIGHTS_3 = _immutable_float64_array( - [1.0 / 6.0, 1.0 / 6.0, 1.0 / 6.0] - ) - - _DUNAVANT_A1 = 0.059715871789770 - _DUNAVANT_B1 = 0.470142064105115 - _DUNAVANT_A2 = 0.797426985353087 - _DUNAVANT_B2 = 0.101286507323456 - TRI_GAUSS_POINTS_7 = _immutable_float64_array( - [ - [1.0 / 3.0, 1.0 / 3.0], - [_DUNAVANT_B1, _DUNAVANT_B1], - [_DUNAVANT_A1, _DUNAVANT_B1], - [_DUNAVANT_B1, _DUNAVANT_A1], - [_DUNAVANT_B2, _DUNAVANT_B2], - [_DUNAVANT_A2, _DUNAVANT_B2], - [_DUNAVANT_B2, _DUNAVANT_A2], - ], - ) - TRI_GAUSS_WEIGHTS_7 = _immutable_float64_array( - [ - 0.1125, - 0.066197076394253, - 0.066197076394253, - 0.066197076394253, - 0.062969590272414, - 0.062969590272414, - 0.062969590272414, - ], - ) - - GAUSS_POINTS_1x1 = _immutable_float64_array([[0.0, 0.0]]) - GAUSS_WEIGHTS_1x1 = _immutable_float64_array([4.0]) - - GAUSS_POINTS_2x2 = _immutable_float64_array( - np.asarray( - [[-1.0, -1.0], [1.0, -1.0], [-1.0, 1.0], [1.0, 1.0]], - dtype=np.float64, - ) - / np.sqrt(3.0) - ) - GAUSS_WEIGHTS_2x2 = _immutable_float64_array(np.ones(4, dtype=np.float64)) - - GAUSS_POINTS_3x3 = _immutable_float64_array( - [ - [-np.sqrt(3.0 / 5.0), -np.sqrt(3.0 / 5.0)], - [0.0, -np.sqrt(3.0 / 5.0)], - [np.sqrt(3.0 / 5.0), -np.sqrt(3.0 / 5.0)], - [-np.sqrt(3.0 / 5.0), 0.0], - [0.0, 0.0], - [np.sqrt(3.0 / 5.0), 0.0], - [-np.sqrt(3.0 / 5.0), np.sqrt(3.0 / 5.0)], - [0.0, np.sqrt(3.0 / 5.0)], - [np.sqrt(3.0 / 5.0), np.sqrt(3.0 / 5.0)], - ], - ) - GAUSS_WEIGHTS_3x3 = _immutable_float64_array( - [ - 25.0 / 81.0, - 40.0 / 81.0, - 25.0 / 81.0, - 40.0 / 81.0, - 64.0 / 81.0, - 40.0 / 81.0, - 25.0 / 81.0, - 40.0 / 81.0, - 25.0 / 81.0, - ], - ) - - def __init__( - self, - element_id: int, - node_ids: List[int], - material_name: str = "default", - thickness: float = 0.01, - drilling_stabilization: float = 1.0e-3, - reduced_integration: bool = False, - hourglass_stabilization: float = 1.0e-8, - material_direction: Optional[np.ndarray] = None, - material_angle_deg: float = 0.0, - shell_section: Optional[Any] = None, - ): - super().__init__(element_id, node_ids, material_name) - if len(set(node_ids)) != len(node_ids): - raise ValueError(f"Shell element {element_id} has repeated node ids") - if self.__class__ is ShellElement and len(node_ids) == 4: - warnings.warn( - "Legacy four-node ShellElement is a temporary rollback path; " - "use create_shell_element() or QualifiedE4PLShellElement. The " - "legacy Q4 implementation is available through the 0.4.x " - "burn-in line and is scheduled for removal no earlier than 0.5.0.", - LegacyQ4DeprecationWarning, - stacklevel=2, - ) - self.thickness = float(thickness) - self.drilling_stabilization = float(drilling_stabilization) - self.reduced_integration = reduced_integration - self.hourglass_stabilization = float(hourglass_stabilization) - self.material_angle_deg = float(material_angle_deg) - if not np.isfinite(self.material_angle_deg): - raise ValueError("material_angle_deg must be finite") - if material_direction is None: - self.material_direction = None - else: - direction = np.asarray(material_direction, dtype=float).reshape(-1) - if direction.size != 3 or not np.all(np.isfinite(direction)): - raise ValueError("material_direction must be a finite 3-vector") - if float(np.linalg.norm(direction)) <= _SMALL: - raise ValueError("material_direction must be non-zero") - self.material_direction = direction.copy() - self.shell_section = coerce_generalized_shell_section(shell_section) - self._is_3node = len(node_ids) == 3 - self._is_6node = len(node_ids) == 6 - self._is_8node = len(node_ids) == 8 - self._is_4node = len(node_ids) == 4 - self._is_triangular = self._is_3node or self._is_6node - self._is_quadrilateral = self._is_4node or self._is_8node - if not (self._is_triangular or self._is_quadrilateral): - raise ValueError(f"ShellElement requires 3, 4, 6 or 8 nodes, got {len(node_ids)}") - - def _material_angle(self, local_frame: np.ndarray) -> float: - """Material 1-axis angle in the supplied element-local frame.""" - - angle = np.deg2rad(self.material_angle_deg) - if self.material_direction is None: - return float(angle) - frame = np.asarray(local_frame, dtype=float).reshape(3, 3) - direction = np.asarray(self.material_direction, dtype=float) - components = np.array( - [float(np.dot(direction, frame[:, 0])), float(np.dot(direction, frame[:, 1]))], - dtype=float, - ) - norm = float(np.linalg.norm(components)) - if norm <= 1.0e-10 * max(float(np.linalg.norm(direction)), 1.0): - raise ValueError( - f"Shell element {self.element_id} material_direction is parallel to " - "the shell normal and cannot define an in-plane material axis." - ) - return float(np.arctan2(components[1], components[0]) + angle) - - def _generalized_section_in_frame( - self, - local_frame: np.ndarray, - ) -> Optional[GeneralizedShellSection]: - """Return the pre-integrated section rotated into shell-local axes.""" - - if self.shell_section is None: - return None - return self.shell_section.rotated(self._material_angle(local_frame)) - - def to_dict(self) -> Dict[str, Any]: - payload = super().to_dict() - payload.update( - { - "thickness": float(self.thickness), - "material_angle_deg": float(self.material_angle_deg), - "material_direction": ( - None - if self.material_direction is None - else np.asarray(self.material_direction, dtype=float).tolist() - ), - "shell_section": ( - None if self.shell_section is None else self.shell_section.to_dict() - ), - } - ) - return payload - - @property - def num_nodes(self) -> int: - return len(self.node_ids) - - @property - def dofs_per_node(self) -> int: - return 6 - - @property - def gauss_points(self) -> np.ndarray: - if self._is_3node: - return self.TRI_GAUSS_POINTS_3 - if self._is_6node: - return self.TRI_GAUSS_POINTS_7 - if self._is_8node and self.reduced_integration: - return self.GAUSS_POINTS_2x2 - return self.GAUSS_POINTS_3x3 if self._is_8node else self.GAUSS_POINTS_2x2 - - @property - def gauss_weights(self) -> np.ndarray: - if self._is_3node: - return self.TRI_GAUSS_WEIGHTS_3 - if self._is_6node: - return self.TRI_GAUSS_WEIGHTS_7 - if self._is_8node and self.reduced_integration: - return self.GAUSS_WEIGHTS_2x2 - return self.GAUSS_WEIGHTS_3x3 if self._is_8node else self.GAUSS_WEIGHTS_2x2 - - @property - def shear_gauss_points(self) -> np.ndarray: - if self._is_3node: - return self.TRI_GAUSS_POINTS_1 - if self._is_6node: - return self.TRI_GAUSS_POINTS_3 - return self.GAUSS_POINTS_2x2 if self._is_8node else self.GAUSS_POINTS_1x1 - - @property - def shear_gauss_weights(self) -> np.ndarray: - if self._is_3node: - return self.TRI_GAUSS_WEIGHTS_1 - if self._is_6node: - return self.TRI_GAUSS_WEIGHTS_3 - return self.GAUSS_WEIGHTS_2x2 if self._is_8node else self.GAUSS_WEIGHTS_1x1 - - def get_node_coordinates(self, mesh: "FEMesh") -> np.ndarray: - coords = np.zeros((self.num_nodes, 3), dtype=float) - for i, node_id in enumerate(self.node_ids): - node = mesh.get_node(node_id) - if node is None: - raise ValueError(f"Shell element {self.element_id} references missing node {node_id}") - coords[i] = node.coords() - return coords - - def compute_shape_functions(self, xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: - if self._is_3node: - return self._compute_3node_shape_functions(xi, eta) - if self._is_6node: - return self._compute_6node_shape_functions(xi, eta) - if self._is_4node: - return self._compute_4node_shape_functions(xi, eta) - return self._compute_8node_shape_functions(xi, eta) - - def _compute_3node_shape_functions(self, xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: - return _jit_compute_3node_shape_functions(xi, eta) - - def _compute_4node_shape_functions(self, xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: - return _jit_compute_4node_shape_functions(xi, eta) - - def _compute_6node_shape_functions(self, xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: - return _jit_compute_6node_shape_functions(xi, eta) - - def _compute_8node_shape_functions(self, xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: - return _jit_compute_8node_shape_functions(xi, eta) - - def compute_jacobian(self, coords: np.ndarray, dN_dxi: np.ndarray, dN_deta: np.ndarray) -> np.ndarray: - return np.array([coords.T @ dN_dxi, coords.T @ dN_deta], dtype=float) - - @staticmethod - def _normalize(vector: np.ndarray) -> Tuple[np.ndarray, float]: - norm = float(np.sqrt(vector @ vector)) - if norm < _SMALL: - return np.zeros(3, dtype=float), norm - return vector / norm, norm - - def _fallback_edge_direction(self, coords: np.ndarray, normal: np.ndarray) -> np.ndarray: - candidate_edges = [] - if coords.shape[0] >= 2: - candidate_edges.append(coords[1] - coords[0]) - if coords.shape[0] >= 3: - candidate_edges.append(coords[2] - coords[0]) - candidate_edges.append(coords[2] - coords[1]) - if coords.shape[0] >= 4: - candidate_edges.append(coords[2] - coords[3]) - candidate_edges.append(coords[3] - coords[0]) - candidate_edges.append(coords[2] - coords[1]) - for edge in candidate_edges: - projected = edge - np.dot(edge, normal) * normal - e1, n = self._normalize(projected) - if n > _SMALL: - return e1 - raise ValueError(f"Shell element {self.element_id} has no valid in-plane direction") - - def _local_frame_and_derivatives( - self, - coords: np.ndarray, - dN_dxi: np.ndarray, - dN_deta: np.ndarray, - ) -> Tuple[np.ndarray, np.ndarray, np.ndarray, float]: - J = self.compute_jacobian(coords, dN_dxi, dN_deta) - tangent_xi = J[0] - tangent_eta = J[1] - e3, det_j = self._normalize(_cross3(tangent_xi, tangent_eta)) - if det_j < _SMALL: - raise ValueError(f"Shell element {self.element_id} has a near-zero surface Jacobian") - - e1_raw = tangent_xi - np.dot(tangent_xi, e3) * e3 - e1, e1_norm = self._normalize(e1_raw) - if e1_norm < _SMALL: - e1 = self._fallback_edge_direction(coords, e3) - e2, e2_norm = self._normalize(_cross3(e3, e1)) - if e2_norm < _SMALL: - raise ValueError(f"Shell element {self.element_id} has an invalid local y direction") - e1, _ = self._normalize(_cross3(e2, e3)) - R = np.column_stack((e1, e2, e3)) - - J_local = np.array( - [ - [np.dot(tangent_xi, e1), np.dot(tangent_xi, e2)], - [np.dot(tangent_eta, e1), np.dot(tangent_eta, e2)], - ], - dtype=float, - ) - try: - inv_j_local, _ = _inv2(J_local) - except np.linalg.LinAlgError as exc: - raise ValueError(f"Shell element {self.element_id} has a singular local Jacobian") from exc - - dN_dx = inv_j_local[0, 0] * dN_dxi + inv_j_local[0, 1] * dN_deta - dN_dy = inv_j_local[1, 0] * dN_dxi + inv_j_local[1, 1] * dN_deta - return R, dN_dx, dN_dy, det_j - - def _local_dof_transform(self, R: np.ndarray) -> np.ndarray: - n_blocks = 2 * self.num_nodes - T = np.zeros((self.total_dofs, self.total_dofs), dtype=float) - blocks = T.reshape(n_blocks, 3, n_blocks, 3) - indices = np.arange(n_blocks) - blocks[indices, :, indices, :] = R.T - return T - - def _build_shell_b_matrices( - self, - N: np.ndarray, - dN_dx: np.ndarray, - dN_dy: np.ndarray, - ) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: - B_m = np.zeros((3, self.total_dofs), dtype=float) - B_b = np.zeros((3, self.total_dofs), dtype=float) - B_s = np.zeros((2, self.total_dofs), dtype=float) - - B_m[0, 0::6] = dN_dx - B_m[1, 1::6] = dN_dy - B_m[2, 0::6] = dN_dy - B_m[2, 1::6] = dN_dx - - B_b[0, 4::6] = dN_dx - B_b[1, 3::6] = -dN_dy - B_b[2, 4::6] = dN_dy - B_b[2, 3::6] = -dN_dx - - B_s[0, 2::6] = dN_dx - B_s[0, 4::6] = N - B_s[1, 2::6] = dN_dy - B_s[1, 3::6] = -N - return B_m, B_b, B_s - - def _build_drilling_b_matrix( - self, - N: np.ndarray, - dN_dx: np.ndarray, - dN_dy: np.ndarray, - ) -> np.ndarray: - """ - Build a small drilling stabilization strain. - - The stabilized quantity is theta_z - 0.5 * (dv/dx - du/dy), so a - physical rigid rotation about the shell normal has exactly zero energy. - """ - B_d = np.zeros((1, self.total_dofs), dtype=float) - B_d[0, 0::6] = 0.5 * dN_dy - B_d[0, 1::6] = -0.5 * dN_dx - B_d[0, 5::6] = N - return B_d - - def _reference_center(self) -> Tuple[float, float]: - if self._is_triangular: - return 1.0 / 3.0, 1.0 / 3.0 - return 0.0, 0.0 - - # MITC4 assumed natural transverse shear (4-node elements only). - # - # Covariant shear strains are sampled where they are exact for pure - # bending, at the edge midpoints A(0,-1), B(1,0), C(0,1), D(-1,0): - # - # gamma_xi(xi, eta) = (1-eta)/2 * gamma_xi|A + (1+eta)/2 * gamma_xi|C - # gamma_eta(xi, eta) = (1-xi)/2 * gamma_eta|D + (1+xi)/2 * gamma_eta|B - # - # with gamma_xi = dw/dxi + x_,xi * theta_y - y_,xi * theta_x in a fixed - # element-plane frame, then mapped to Cartesian shear through the inverse - # in-plane Jacobian at the integration point. The element geometry is - # treated as a flat facet in the frame evaluated at the element centre. - _MITC4_SAMPLE_POINTS = {"A": (0.0, -1.0), "B": (1.0, 0.0), "C": (0.0, 1.0), "D": (-1.0, 0.0)} - - def _center_frame(self, coords: np.ndarray) -> np.ndarray: - xi, eta = self._reference_center() - _, dN_dxi, dN_deta = self.compute_shape_functions(xi, eta) - R, _, _, _ = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) - return R - - def _tri3_assumed_shear_b_matrix(self, coords: np.ndarray, R: np.ndarray) -> Tuple[np.ndarray, float]: - """ - Constant assumed-shear field for the 3-node triangle. - - The row space is evaluated in the centroid frame and integrated once - over the triangular area. This is the constant shear-gap part used by - DSG3/MITC3-style triangles: rigid rotations satisfy - ``dw/dx + theta_y = 0`` and ``dw/dy - theta_x = 0`` exactly, while a - constant transverse-shear patch is reproduced without the locking-prone - fully integrated linear Mindlin shear interpolation. - """ - if not self._is_3node: - raise ValueError("_tri3_assumed_shear_b_matrix is only valid for 3-node shells") - planar = coords @ R[:, :2] - r, s = self._reference_center() - N, dN_dr, dN_ds = self.compute_shape_functions(r, s) - J2 = np.array( - [ - [float(dN_dr @ planar[:, 0]), float(dN_dr @ planar[:, 1])], - [float(dN_ds @ planar[:, 0]), float(dN_ds @ planar[:, 1])], - ], - dtype=float, - ) - try: - inv_j2, det_j = _inv2(J2) - except np.linalg.LinAlgError as exc: - raise ValueError(f"Shell element {self.element_id} has a singular triangular shear Jacobian") from exc - dN_dx = inv_j2[0, 0] * dN_dr + inv_j2[0, 1] * dN_ds - dN_dy = inv_j2[1, 0] * dN_dr + inv_j2[1, 1] * dN_ds - _, _, B_s = self._build_shell_b_matrices(N, dN_dx, dN_dy) - return B_s, abs(float(det_j)) - - def _mitc4_shear_samples(self, coords: np.ndarray, R: np.ndarray) -> Tuple[np.ndarray, Dict[str, Tuple[np.ndarray, np.ndarray]]]: - """Return in-plane node coordinates and covariant shear rows at A-D.""" - planar = coords @ R[:, :2] - samples: Dict[str, Tuple[np.ndarray, np.ndarray]] = {} - for name, (xi, eta) in self._MITC4_SAMPLE_POINTS.items(): - N, dN_dxi, dN_deta = self.compute_shape_functions(xi, eta) - x_xi = float(dN_dxi @ planar[:, 0]) - y_xi = float(dN_dxi @ planar[:, 1]) - x_eta = float(dN_deta @ planar[:, 0]) - y_eta = float(dN_deta @ planar[:, 1]) - row_xi = np.zeros(self.total_dofs, dtype=float) - row_eta = np.zeros(self.total_dofs, dtype=float) - row_xi[2::6] = dN_dxi - row_xi[3::6] = -N * y_xi - row_xi[4::6] = N * x_xi - row_eta[2::6] = dN_deta - row_eta[3::6] = -N * y_eta - row_eta[4::6] = N * x_eta - samples[name] = (row_xi, row_eta) - return planar, samples - - def _mitc4_shear_b_matrix( - self, - planar: np.ndarray, - samples: Dict[str, Tuple[np.ndarray, np.ndarray]], - xi: float, - eta: float, - ) -> Tuple[np.ndarray, float]: - """Assumed-shear B matrix (local Cartesian) and in-plane Jacobian det.""" - _, dN_dxi, dN_deta = self.compute_shape_functions(xi, eta) - J2 = np.array( - [ - [float(dN_dxi @ planar[:, 0]), float(dN_dxi @ planar[:, 1])], - [float(dN_deta @ planar[:, 0]), float(dN_deta @ planar[:, 1])], - ], - dtype=float, - ) - try: - inv_j2, det_j = _inv2(J2) - except np.linalg.LinAlgError as exc: - raise ValueError(f"Shell element {self.element_id} has a singular in-plane Jacobian") from exc - B_covariant = np.vstack( - [ - 0.5 * (1.0 - eta) * samples["A"][0] + 0.5 * (1.0 + eta) * samples["C"][0], - 0.5 * (1.0 - xi) * samples["D"][1] + 0.5 * (1.0 + xi) * samples["B"][1], - ] - ) - return inv_j2 @ B_covariant, det_j - - def _rigid_body_mode_matrix(self, coords: np.ndarray) -> np.ndarray: - modes = np.zeros((self.total_dofs, 6), dtype=float) - centroid = np.mean(coords, axis=0) - axes = np.eye(3, dtype=float) - - for local, coord in enumerate(coords): - base = local * 6 - r = coord - centroid - modes[base + 0, 0] = 1.0 - modes[base + 1, 1] = 1.0 - modes[base + 2, 2] = 1.0 - for axis_index, axis in enumerate(axes): - displacement = _cross3(axis, r) - modes[base : base + 3, 3 + axis_index] = displacement - modes[base + 3 : base + 6, 3 + axis_index] = axis - - q, rmat = np.linalg.qr(modes) - diag = np.abs(np.diag(rmat)) - if diag.size == 0: - return np.zeros((self.total_dofs, 0), dtype=float) - keep = diag > max(float(np.max(diag)) * 1.0e-10, _SMALL) - return q[:, keep] - - def _hourglass_stabilization_matrix(self, K_base: np.ndarray, coords: np.ndarray) -> np.ndarray: - """Small stiffness on non-rigid zero modes outside rigid motion.""" - coefficient = float(getattr(self, "hourglass_stabilization", 0.0)) - stabilized_topology = (self._is_8node and self.reduced_integration) or self._is_triangular - if not stabilized_topology or coefficient <= 0.0: - return np.zeros_like(K_base) - - K_sym = 0.5 * (K_base + K_base.T) - eigvals, eigvecs = np.linalg.eigh(K_sym) - max_eig = max(float(np.max(np.abs(eigvals))), 1.0) - zero_tol = 1.0e-9 * max_eig - zero_mask = np.abs(eigvals) < zero_tol - if int(np.sum(zero_mask)) <= 6: - return np.zeros_like(K_base) - - zero_space = eigvecs[:, zero_mask] - rigid = self._rigid_body_mode_matrix(coords) - if rigid.size: - zero_space = zero_space - rigid @ (rigid.T @ zero_space) - - u, singular_values, _ = np.linalg.svd(zero_space, full_matrices=False) - if singular_values.size == 0: - return np.zeros_like(K_base) - keep = singular_values > 1.0e-8 - if not np.any(keep): - return np.zeros_like(K_base) - - hourglass_modes = u[:, keep] - stiffness_scale = coefficient * max_eig - K_hg = stiffness_scale * (hourglass_modes @ hourglass_modes.T) - return 0.5 * (K_hg + K_hg.T) - - def compute_stiffness_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: - coords = self.get_node_coordinates(mesh) - generalized_section = self.shell_section is not None - h = self.thickness - if generalized_section: - drilling_modulus = None - else: - _elastic_symmetry(material) - compliance = _elastic_compliance(material) - drilling_modulus = 1.0 / float(compliance[5, 5]) - - K = np.zeros((self.total_dofs, self.total_dofs), dtype=float) - - for (xi, eta), weight in zip(self.gauss_points, self.gauss_weights): - N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) - R, dN_dx, dN_dy, det_j = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) - T = self._local_dof_transform(R) - B_m, B_b, _ = self._build_shell_b_matrices(N, dN_dx, dN_dy) - B_d = self._build_drilling_b_matrix(N, dN_dx, dN_dy) - if generalized_section: - section_local = self._generalized_section_in_frame(R) - assert section_local is not None - K_local = ( - B_m.T @ section_local.A @ B_m - + B_m.T @ section_local.B @ B_b - + B_b.T @ section_local.B.T @ B_m - + B_b.T @ section_local.D @ B_b - ) * det_j * weight - drilling_stiffness = ( - float(section_local.A[2, 2]) - * getattr(self, "drilling_stabilization", 1.0e-3) - ) - else: - Q_local, _G_local, _strain_transform, _stress_transform = ( - _shell_material_matrices( - material, - self._material_angle(R), - ) - ) - D_membrane = h * Q_local - D_bending = h**3 / 12.0 * Q_local - K_local = ( - B_m.T @ D_membrane @ B_m - + B_b.T @ D_bending @ B_b - ) * det_j * weight - drilling_stiffness = ( - float(drilling_modulus) - * h - * getattr(self, "drilling_stabilization", 1.0e-3) - ) - K_local += (B_d.T @ (drilling_stiffness * np.eye(1)) @ B_d) * det_j * weight - K += T.T @ K_local @ T - - if self._is_4node: - R = self._center_frame(coords) - if generalized_section: - section_local = self._generalized_section_in_frame(R) - assert section_local is not None - D_shear = section_local.As - else: - _Q_local, G_local, _strain_transform, _stress_transform = ( - _shell_material_matrices( - material, - self._material_angle(R), - ) - ) - D_shear = (5.0 / 6.0) * h * G_local - T = self._local_dof_transform(R) - planar, samples = self._mitc4_shear_samples(coords, R) - for (xi, eta), weight in zip(self.GAUSS_POINTS_2x2, self.GAUSS_WEIGHTS_2x2): - B_s, det_j = self._mitc4_shear_b_matrix(planar, samples, float(xi), float(eta)) - K_local = (B_s.T @ D_shear @ B_s) * det_j * weight - K += T.T @ K_local @ T - elif self._is_3node: - R = self._center_frame(coords) - if generalized_section: - section_local = self._generalized_section_in_frame(R) - assert section_local is not None - D_shear = section_local.As - else: - _Q_local, G_local, _strain_transform, _stress_transform = ( - _shell_material_matrices( - material, - self._material_angle(R), - ) - ) - D_shear = (5.0 / 6.0) * h * G_local - T = self._local_dof_transform(R) - B_s, det_j = self._tri3_assumed_shear_b_matrix(coords, R) - K_local = (B_s.T @ D_shear @ B_s) * det_j * float(np.sum(self.shear_gauss_weights)) - K += T.T @ K_local @ T - else: - for (xi, eta), weight in zip(self.shear_gauss_points, self.shear_gauss_weights): - N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) - R, dN_dx, dN_dy, det_j = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) - if generalized_section: - section_local = self._generalized_section_in_frame(R) - assert section_local is not None - D_shear = section_local.As - else: - _Q_local, G_local, _strain_transform, _stress_transform = ( - _shell_material_matrices( - material, - self._material_angle(R), - ) - ) - D_shear = (5.0 / 6.0) * h * G_local - T = self._local_dof_transform(R) - _, _, B_s = self._build_shell_b_matrices(N, dN_dx, dN_dy) - K_local = (B_s.T @ D_shear @ B_s) * det_j * weight - K += T.T @ K_local @ T - - self._hourglass_stiffness_matrix = self._hourglass_stabilization_matrix(K, coords) - K += self._hourglass_stiffness_matrix - - self._stiffness_matrix = K - return K - - def compute_mass_matrix( - self, - mesh: "FEMesh", - material: "Material", - *, - _qualified_runtime_post_observation: Optional[Callable[[], None]] = None, - ) -> np.ndarray: - coords = self.get_node_coordinates(mesh) - raw_density = _guarded_observe_attribute( - material, - "density", - post_observation=_qualified_runtime_post_observation, - ) - rho = _guarded_float( - raw_density, - post_observation=_qualified_runtime_post_observation, - ) - h = self.thickness - section_mass = ( - None - if self.shell_section is None - else _guarded_observe_attribute( - self.shell_section, - "mass_per_area", - post_observation=_qualified_runtime_post_observation, - ) - ) - mass_per_area = ( - _guarded_float( - section_mass, - post_observation=_qualified_runtime_post_observation, - ) - if section_mass is not None - else rho * h - ) - section_rotary_inertia = ( - None - if self.shell_section is None - else _guarded_observe_attribute( - self.shell_section, - "rotary_inertia_per_area", - post_observation=_qualified_runtime_post_observation, - ) - ) - rotary_inertia_per_area = ( - _guarded_float( - section_rotary_inertia, - post_observation=_qualified_runtime_post_observation, - ) - if section_rotary_inertia is not None - else rho * h**3 / 12.0 - ) - M = np.zeros((self.total_dofs, self.total_dofs), dtype=float) - if self._is_8node and self.reduced_integration: - area = 0.0 - for (xi, eta), weight in zip(self.gauss_points, self.gauss_weights): - _N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) - _R, _dN_dx, _dN_dy, det_j = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) - area += float(det_j) * float(weight) - translational = mass_per_area * max(area, 0.0) / max(self.num_nodes, 1) - rotational = ( - rotary_inertia_per_area - * max(area, 0.0) - / max(self.num_nodes, 1) - ) - for i in range(self.num_nodes): - base = 6 * i - M[base + 0, base + 0] = translational - M[base + 1, base + 1] = translational - M[base + 2, base + 2] = translational - M[base + 3, base + 3] = rotational - M[base + 4, base + 4] = rotational - M[base + 5, base + 5] = rotational - self._mass_matrix = M - return M - for (xi, eta), weight in zip(self.gauss_points, self.gauss_weights): - N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) - R, _, _, det_j = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) - T = self._local_dof_transform(R) - M_local = np.zeros_like(M) - outer_n = np.outer(N, N) * det_j * weight - translational = mass_per_area * outer_n - rotational = rotary_inertia_per_area * outer_n - for d in range(3): - M_local[d::6, d::6] += translational - M_local[3 + d::6, 3 + d::6] += rotational - M += T.T @ M_local @ T - self._mass_matrix = M - return M - - @staticmethod - def _membrane_compression_from_state(state: Optional[Any]) -> Tuple[float, float, float]: - """Return local membrane resultants with compression-positive convention.""" - if state is None or not isinstance(state, dict): - return 0.0, 0.0, 0.0 - - if "membrane_compression" in state: - values = np.asarray(state["membrane_compression"], dtype=float).reshape(-1) - if values.size >= 3: - return float(values[0]), float(values[1]), float(values[2]) - if "membrane_forces" in state: - values = np.asarray(state["membrane_forces"], dtype=float).reshape(-1) - if values.size >= 3: - return -float(values[0]), -float(values[1]), -float(values[2]) - - compression_x = state.get("membrane_compression_x", state.get("Nx_compression")) - compression_y = state.get("membrane_compression_y", state.get("Ny_compression")) - compression_xy = state.get("membrane_compression_xy", state.get("Nxy_compression")) - if compression_x is not None or compression_y is not None or compression_xy is not None: - return ( - float(compression_x or 0.0), - float(compression_y or 0.0), - float(compression_xy or 0.0), - ) - - force_x = state.get("membrane_force_x", state.get("Nx")) - force_y = state.get("membrane_force_y", state.get("Ny")) - force_xy = state.get("membrane_force_xy", state.get("Nxy")) - return ( - -float(force_x or 0.0), - -float(force_y or 0.0), - -float(force_xy or 0.0), - ) - - @classmethod - def _membrane_compression_samples( - cls, - state: Optional[Any], - count: int, - ) -> np.ndarray: - """Return compression-positive ``[Nx, Ny, Nxy]`` at integration points. - - Uniform legacy state keys remain supported. Spatially varying - prestress can be supplied as ``membrane_compression_at_gauss`` or - tension-positive ``membrane_forces_at_gauss`` with shape ``(n_gp, 3)``. - The shorter aliases ``membrane_compression`` and ``membrane_forces`` - also accept that two-dimensional form. - """ - if isinstance(state, dict): - compression_values = state.get( - "membrane_compression_at_gauss", - state.get("membrane_compression"), - ) - force_values = state.get( - "membrane_forces_at_gauss", - state.get("membrane_forces"), - ) - values = compression_values if compression_values is not None else force_values - if values is not None: - samples = np.asarray(values, dtype=float) - if samples.ndim == 2: - if samples.shape != (int(count), 3): - raise ValueError( - "Gauss-point membrane resultants must have shape " - f"({int(count)}, 3), got {samples.shape}." - ) - return samples.copy() if compression_values is not None else -samples - - uniform = np.asarray(cls._membrane_compression_from_state(state), dtype=float) - return np.repeat(uniform.reshape(1, 3), int(count), axis=0) - - @staticmethod - def _resultant_samples( - state: Optional[Any], - count: int, - *, - compression_keys: Tuple[str, ...], - tension_keys: Tuple[str, ...] = (), - ) -> np.ndarray: - """Read uniform or Gauss-point vector resultants with sign conversion.""" - if not isinstance(state, dict): - return np.zeros((int(count), 3), dtype=float) - values = None - compression_positive = True - for key in compression_keys: - if key in state: - values = state[key] - break - if values is None: - for key in tension_keys: - if key in state: - values = state[key] - compression_positive = False - break - if values is None: - return np.zeros((int(count), 3), dtype=float) - samples = np.asarray(values, dtype=float) - if samples.ndim == 1 and samples.size == 3: - samples = np.repeat(samples.reshape(1, 3), int(count), axis=0) - if samples.shape != (int(count), 3): - raise ValueError( - f"Initial-stress resultants must have shape (3,) or ({int(count)}, 3), " - f"got {samples.shape}." - ) - return samples.copy() if compression_positive else -samples - - @classmethod - def _bending_compression_samples( - cls, - state: Optional[Any], - count: int, - ) -> np.ndarray: - """Compression-positive first stress moments ``[Mx, My, Mxy]``.""" - return cls._resultant_samples( - state, - count, - compression_keys=( - "bending_compression_at_gauss", - "bending_compression", - "bending_compression_moments_at_gauss", - "bending_compression_moments", - ), - tension_keys=("bending_moments_at_gauss", "bending_moments"), - ) - - @classmethod - def _stress_second_moment_samples( - cls, - state: Optional[Any], - count: int, - membrane_compression: np.ndarray, - thickness: float, - ) -> np.ndarray: - """Compression-positive second stress moments, defaulting to ``N h²/12``.""" - explicit = cls._resultant_samples( - state, - count, - compression_keys=( - "stress_second_moment_at_gauss", - "stress_second_moment", - "membrane_compression_second_moment_at_gauss", - "membrane_compression_second_moment", - ), - ) - has_explicit = isinstance(state, dict) and any( - key in state - for key in ( - "stress_second_moment_at_gauss", - "stress_second_moment", - "membrane_compression_second_moment_at_gauss", - "membrane_compression_second_moment", - ) - ) - if has_explicit: - return explicit - return np.asarray(membrane_compression, dtype=float) * float(thickness) ** 2 / 12.0 - - def compute_geometric_stiffness_matrix( - self, - mesh: "FEMesh", - material: "Material", - state: Optional[Any] = None, - ) -> np.ndarray: - """ - Shell stress-stiffness matrix from membrane resultants. - - The state can supply either tension-positive membrane forces - (``membrane_force_x/y/xy`` or ``membrane_forces``) or - compression-positive values (``membrane_compression_x/y/xy``). The - returned matrix follows the package convention - ``K phi = lambda KG phi`` with compression destabilizing. - - The total-Lagrangian initial-stress operator uses the Mindlin director - field ``[u + z*ry, v - z*rx, w]``. Membrane resultants therefore act - on all translations, their second stress moment (``N*h**2/12`` for a - uniform through-thickness membrane stress) acts on ``rx``/``ry`` - gradients, and optional bending resultants provide the signed - translation-director coupling. Drilling ``rz`` has no director term. - """ - compression = self._membrane_compression_samples(state, len(self.gauss_points)) - bending_compression = self._bending_compression_samples(state, len(self.gauss_points)) - second_moment = self._stress_second_moment_samples( - state, - len(self.gauss_points), - compression, - self.thickness, - ) - if not np.any(compression) and not np.any(bending_compression) and not np.any(second_moment): - return np.zeros((self.total_dofs, self.total_dofs), dtype=float) - - coords = self.get_node_coordinates(mesh) - KG = np.zeros((self.total_dofs, self.total_dofs), dtype=float) - - for gp_index, ((xi, eta), weight) in enumerate(zip(self.gauss_points, self.gauss_weights)): - N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) - R, dN_dx, dN_dy, det_j = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) - T = self._local_dof_transform(R) - Nx, Ny, Nxy = compression[gp_index] - N_matrix = np.array([[Nx, Nxy], [Nxy, Ny]], dtype=float) - Mx, My, Mxy = bending_compression[gp_index] - M_matrix = np.array([[Mx, Mxy], [Mxy, My]], dtype=float) - Hx, Hy, Hxy = second_moment[gp_index] - H_matrix = np.array([[Hx, Hxy], [Hxy, Hy]], dtype=float) - KG_local = np.zeros((self.total_dofs, self.total_dofs), dtype=float) - translation_gradients = [] - for component in range(3): - G = np.zeros((2, self.total_dofs), dtype=float) - G[0, component::6] = dN_dx - G[1, component::6] = dN_dy - translation_gradients.append(G) - KG_local += G.T @ N_matrix @ G - G_rx = np.zeros((2, self.total_dofs), dtype=float) - G_ry = np.zeros((2, self.total_dofs), dtype=float) - G_rx[0, 3::6] = dN_dx - G_rx[1, 3::6] = dN_dy - G_ry[0, 4::6] = dN_dx - G_ry[1, 4::6] = dN_dy - KG_local += G_rx.T @ H_matrix @ G_rx - KG_local += G_ry.T @ H_matrix @ G_ry - # u(z)=u+z*ry and v(z)=v-z*rx. - coupling_u_ry = translation_gradients[0].T @ M_matrix @ G_ry - coupling_v_rx = translation_gradients[1].T @ M_matrix @ G_rx - KG_local += coupling_u_ry + coupling_u_ry.T - KG_local -= coupling_v_rx + coupling_v_rx.T - KG_local *= det_j * float(weight) - KG += T.T @ KG_local @ T - return KG - - # ------------------------------------------------------------------ - # Incremental nonlinear response: total-Lagrangian von Karman membrane - # kinematics in the flat-facet centre frame, layered J2 plane-stress - # plasticity through the thickness, elastic transverse shear (MITC4 for - # 4-node, reduced for 8-node) and elastic drilling stabilization. - # ------------------------------------------------------------------ - - def _nonlinear_geometry(self, mesh: "FEMesh") -> Dict[str, Any]: - """Reference-configuration data, computed once per element.""" - cache = getattr(self, "_nl_cache", None) - if cache is not None: - return cache - coords = self.get_node_coordinates(mesh) - R0 = self._center_frame(coords) - T0 = self._local_dof_transform(R0) - planar = coords @ R0[:, :2] - - gp_data = [] - for (xi, eta), weight in zip(self.gauss_points, self.gauss_weights): - N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) - J2 = np.array( - [ - [float(dN_dxi @ planar[:, 0]), float(dN_dxi @ planar[:, 1])], - [float(dN_deta @ planar[:, 0]), float(dN_deta @ planar[:, 1])], - ], - dtype=float, - ) - inv_j2, det_j = _inv2(J2) - dN_dx = inv_j2[0, 0] * dN_dxi + inv_j2[0, 1] * dN_deta - dN_dy = inv_j2[1, 0] * dN_dxi + inv_j2[1, 1] * dN_deta - B_m, B_b, B_s = self._build_shell_b_matrices(N, dN_dx, dN_dy) - B_d = self._build_drilling_b_matrix(N, dN_dx, dN_dy) - Gw = np.zeros((2, self.total_dofs), dtype=float) - Gw[0, 2::6] = dN_dx - Gw[1, 2::6] = dN_dy - gp_data.append( - { - "B_m": B_m, - "B_b": B_b, - "B_d": B_d, - "Gw": Gw, - "detw": abs(det_j) * float(weight), - } - ) - - shear_data = [] - if self._is_4node: - _, samples = self._mitc4_shear_samples(coords, R0) - for (xi, eta), weight in zip(self.GAUSS_POINTS_2x2, self.GAUSS_WEIGHTS_2x2): - B_s, det_j = self._mitc4_shear_b_matrix(planar, samples, float(xi), float(eta)) - shear_data.append({"B_s": B_s, "detw": abs(det_j) * float(weight)}) - elif self._is_3node: - B_s, det_j = self._tri3_assumed_shear_b_matrix(coords, R0) - shear_data.append({"B_s": B_s, "detw": det_j * float(np.sum(self.shear_gauss_weights))}) - else: - for (xi, eta), weight in zip(self.shear_gauss_points, self.shear_gauss_weights): - N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) - J2 = np.array( - [ - [float(dN_dxi @ planar[:, 0]), float(dN_dxi @ planar[:, 1])], - [float(dN_deta @ planar[:, 0]), float(dN_deta @ planar[:, 1])], - ], - dtype=float, - ) - inv_j2, det_j = _inv2(J2) - dN_dx = inv_j2[0, 0] * dN_dxi + inv_j2[0, 1] * dN_deta - dN_dy = inv_j2[1, 0] * dN_dxi + inv_j2[1, 1] * dN_deta - _, _, B_s = self._build_shell_b_matrices(N, dN_dx, dN_dy) - shear_data.append({"B_s": B_s, "detw": abs(det_j) * float(weight)}) - - n_gp = len(gp_data) - B_m_all = np.zeros((n_gp, 3, self.total_dofs)) - B_b_all = np.zeros((n_gp, 3, self.total_dofs)) - B_d_all = np.zeros((n_gp, 1, self.total_dofs)) - Gw_all = np.zeros((n_gp, 2, self.total_dofs)) - detw_all = np.zeros(n_gp) - for g, gp in enumerate(gp_data): - B_m_all[g] = gp["B_m"] - B_b_all[g] = gp["B_b"] - B_d_all[g] = gp["B_d"] - Gw_all[g] = gp["Gw"] - detw_all[g] = gp["detw"] - - n_shear = len(shear_data) - B_s_all = np.zeros((n_shear, 2, self.total_dofs)) - detw_shear_all = np.zeros(n_shear) - for g, sh in enumerate(shear_data): - B_s_all[g] = sh["B_s"] - detw_shear_all[g] = sh["detw"] - - cache = { - "R0": R0, - "T0": T0, - "gp": gp_data, - "shear": shear_data, - "B_m_all": B_m_all, - "B_b_all": B_b_all, - "B_d_all": B_d_all, - "Gw_all": Gw_all, - "detw_all": detw_all, - "B_s_all": B_s_all, - "detw_shear_all": detw_shear_all, - } - # This is a solver-owned derived cache. Qualified subclasses reserve - # the public assignment surface so callers cannot replace a warm - # nonlinear operator while preserving its cache key. - object.__setattr__(self, "_nl_cache", cache) - return cache - - def init_nonlinear_state(self, num_layers: int) -> Dict[str, Any]: - if self.shell_section is not None: - return {"generalized_section": True} - n_points = len(self.gauss_points) * num_layers - return { - "plastic_strain": np.zeros((n_points, 3), dtype=float), - "alpha": np.zeros(n_points, dtype=float), - } - - def _generalized_section_nonlinear_response( - self, - mesh: "FEMesh", - material: "Material", - u_elem: np.ndarray, - state: Optional[Any], - tangent: bool, - *, - _return_tangent_components: bool = False, - ) -> Any: - """Geometrically nonlinear response for a linear generalized section.""" - - if getattr(material, "hardening_curve", None) is not None or getattr( - material, - "hill_yield", - None, - ) is not None: - raise ValueError( - "Generalized shell sections are linear elastic and cannot use " - "material hardening or Hill plasticity; use a layered section " - "constitutive model for nonlinear laminate response." - ) - if isinstance(state, dict) and any(key in state for key in _INITIAL_SHELL_STATE_KEYS): - raise ValueError( - "Initial layer stress/prestrain fields are not defined for a " - "pre-integrated generalized shell section." - ) - - cache = self._nonlinear_geometry(mesh) - R0 = cache["R0"] - T0 = cache["T0"] - u_loc = T0 @ np.asarray(u_elem, dtype=float) - section = self._generalized_section_in_frame(R0) - assert section is not None - - n_gp = len(cache["gp"]) - membrane_strain = np.zeros((n_gp, 3), dtype=float) - curvature = np.zeros((n_gp, 3), dtype=float) - for index, gp in enumerate(cache["gp"]): - theta = gp["Gw"] @ u_loc - membrane_strain[index] = gp["B_m"] @ u_loc + np.array( - [ - 0.5 * theta[0] ** 2, - 0.5 * theta[1] ** 2, - theta[0] * theta[1], - ], - dtype=float, - ) - curvature[index] = gp["B_b"] @ u_loc - - membrane_resultants = ( - membrane_strain @ section.A.T + curvature @ section.B.T - ) - bending_resultants = ( - membrane_strain @ section.B + curvature @ section.D.T - ) - transverse_shear_strain = np.einsum( - "gij,j->gi", - cache["B_s_all"], - u_loc, - ) - transverse_shear_resultants = ( - transverse_shear_strain @ section.As.T - ) - C0 = np.broadcast_to(section.A, (n_gp, 3, 3)) - C1 = np.broadcast_to(section.B, (n_gp, 3, 3)) - C2 = np.broadcast_to(section.D, (n_gp, 3, 3)) - drilling_stiffness = ( - float(section.A[2, 2]) - * getattr(self, "drilling_stabilization", 1.0e-3) - ) - - F_loc, K_loc = _jit_integrate_nonlinear_response( - u_loc, - membrane_resultants, - bending_resultants, - C0, - C1, - C2, - cache["B_m_all"], - cache["B_b_all"], - cache["B_d_all"], - cache["Gw_all"], - cache["detw_all"], - cache["B_s_all"], - cache["detw_shear_all"], - section.As, - drilling_stiffness, - tangent, - True, - self.total_dofs, - ) - - K_hg = getattr(self, "_hourglass_stiffness_matrix", None) - if ( - self._is_8node - and self.reduced_integration - and float(getattr(self, "hourglass_stabilization", 0.0)) > 0.0 - and K_hg is None - ): - self.compute_stiffness_matrix(mesh, material) - K_hg = getattr(self, "_hourglass_stiffness_matrix", None) - - F_global = T0.T @ F_loc - if K_hg is not None: - F_global = F_global + K_hg @ np.asarray(u_elem, dtype=float) - K_global: Optional[np.ndarray] - if tangent: - K_global = T0.T @ K_loc @ T0 - if K_hg is not None: - K_global = K_global + K_hg - else: - K_global = None - - trial_state: Dict[str, Any] = { - "generalized_section": True, - "geometric_nonlinearity": "von_karman", - "membrane_strain": membrane_strain.copy(), - "curvature": curvature.copy(), - "transverse_shear_strain": transverse_shear_strain.copy(), - "membrane_resultants": membrane_resultants.copy(), - "bending_resultants": bending_resultants.copy(), - "transverse_shear_resultants": ( - transverse_shear_resultants.copy() - ), - "membrane_resultant_order": SHELL_MEMBRANE_VOIGT_ORDER, - "transverse_shear_resultant_order": ( - SHELL_TRANSVERSE_SHEAR_ORDER - ), - "recovery_scope": "section_resultants_only", - } - if _return_tangent_components: - if K_global is None: - raise ValueError( - "nonlinear tangent components require tangent=True" - ) - material_local, geometric_local = ( - _integrate_nonlinear_tangent_components( - u_loc, - membrane_resultants, - bending_resultants, - C0, - C1, - C2, - cache["B_m_all"], - cache["B_b_all"], - cache["B_d_all"], - cache["Gw_all"], - cache["detw_all"], - cache["B_s_all"], - cache["detw_shear_all"], - section.As, - drilling_stiffness, - True, - self.total_dofs, - ) - ) - material_global = T0.T @ material_local @ T0 - geometric_global = T0.T @ geometric_local @ T0 - if K_hg is not None: - material_global = material_global + K_hg - return F_global, K_global, trial_state, { - "material": material_global, - "geometric": geometric_global, - } - return F_global, K_global, trial_state - - def compute_nonlinear_response( - self, - mesh: "FEMesh", - material: "Material", - u_elem: np.ndarray, - state: Optional[Any] = None, - num_layers: int = 5, - tangent: bool = True, - *, - _return_tangent_components: bool = False, - _qualified_runtime_post_observation: Optional[Callable[[], None]] = None, - ) -> Any: - if _return_tangent_components and not tangent: - raise ValueError("nonlinear tangent components require tangent=True") - if self.shell_section is not None: - return self._generalized_section_nonlinear_response( - mesh, - material, - u_elem, - state, - tangent, - _return_tangent_components=_return_tangent_components, - ) - cache = self._nonlinear_geometry(mesh) - R0 = cache["R0"] - T0 = cache["T0"] - u_loc = T0 @ np.asarray(u_elem, dtype=float) - - symmetry = _elastic_symmetry( - material, - _qualified_runtime_post_observation, - ) - h = self.thickness - curve = _guarded_observe_attribute( - material, - "hardening_curve", - default=None, - post_observation=_qualified_runtime_post_observation, - ) - C_el, shear_elastic, strain_to_material, stress_to_local = _shell_material_matrices( - material, - self._material_angle(R0), - _qualified_runtime_post_observation, - ) - C_material, _shear_material, _identity_strain, _identity_stress = ( - _shell_material_matrices( - material, - 0.0, - _qualified_runtime_post_observation, - ) - ) - drilling_modulus = 1.0 / float( - _elastic_compliance( - material, - _qualified_runtime_post_observation, - )[5, 5] - ) - D_shear = shear_elastic * (5.0 / 6.0) * h - drilling_stiffness = ( - drilling_modulus - * h - * getattr(self, "drilling_stabilization", 1.0e-3) - ) - hill_yield = _guarded_observe_attribute( - material, - "hill_yield", - default=None, - post_observation=_qualified_runtime_post_observation, - ) - if symmetry == "orthotropic" and curve is not None and hill_yield is None: - raise ValueError( - f"Orthotropic material {getattr(material, 'name', '')!r} " - "requires hill_yield when hardening_curve is active." - ) - hill_plasticity = symmetry == "orthotropic" and hill_yield is not None - constitutive_plasticity = curve is not None or hill_plasticity - - n_gp = len(cache["gp"]) - z_layers, w_layers = lobatto_layers(num_layers, h) - - if state is None: - state = self.init_nonlinear_state(num_layers) - initial_state = _copy_state_fields(state, _INITIAL_SHELL_STATE_KEYS) - has_initial_field = any( - key in initial_state - for key in ( - "initial_membrane_stress", - "initial_bending_stress", - "initial_membrane_prestrain", - "initial_curvature_prestrain", - ) - ) - - # Membrane and bending strains at every integration point. - memb_strain = np.zeros((n_gp, 3), dtype=float) - curvature = np.zeros((n_gp, 3), dtype=float) - B_eff_list = [] - theta_list = [] - for g, gp in enumerate(cache["gp"]): - theta = gp["Gw"] @ u_loc # (2,) transverse deflection gradients - B_nl = np.vstack( - [ - theta[0] * gp["Gw"][0], - theta[1] * gp["Gw"][1], - theta[0] * gp["Gw"][1] + theta[1] * gp["Gw"][0], - ] - ) - B_eff = gp["B_m"] + B_nl - memb_strain[g] = gp["B_m"] @ u_loc + np.array( - [0.5 * theta[0] ** 2, 0.5 * theta[1] ** 2, theta[0] * theta[1]] - ) - curvature[g] = gp["B_b"] @ u_loc - B_eff_list.append(B_eff) - theta_list.append(theta) - - if not constitutive_plasticity and not has_initial_field: - # Elastic shortcut: resultants and integrated moduli in closed form. - trial_state = state - N_res = memb_strain @ (h * C_el).T - M_res = curvature @ (h**3 / 12.0 * C_el).T - C0 = np.broadcast_to(h * C_el, (n_gp, 3, 3)) - C1 = np.zeros((n_gp, 3, 3), dtype=float) - C2 = np.broadcast_to(h**3 / 12.0 * C_el, (n_gp, 3, 3)) - else: - # Layer strains for all (gp, layer) points at once. Prescribed - # residual stress is represented by its elastic strain offset and - # prestrain is subtracted as an eigenstrain. Both therefore enter - # the same return map as the kinematic strain and participate in - # yielding, hardening, unloading, and the geometric stiffness. - kinematic_layer_strain = ( - memb_strain[:, None, :] + z_layers[None, :, None] * curvature[:, None, :] - ) - zero_rows = np.zeros((n_gp, 3), dtype=float) - membrane_stress = _shell_field_rows( - initial_state.get("initial_membrane_stress", zero_rows), - n_gp, - "initial_membrane_stress", - ) - bending_stress = _shell_field_rows( - initial_state.get("initial_bending_stress", zero_rows), - n_gp, - "initial_bending_stress", - ) - membrane_prestrain = _shell_field_rows( - initial_state.get("initial_membrane_prestrain", zero_rows), - n_gp, - "initial_membrane_prestrain", - ) - curvature_prestrain = _shell_field_rows( - initial_state.get("initial_curvature_prestrain", zero_rows), - n_gp, - "initial_curvature_prestrain", - ) - initial_stress = ( - membrane_stress[:, None, :] - + (2.0 * z_layers[None, :, None] / h) * bending_stress[:, None, :] - ) - eigenstrain = ( - membrane_prestrain[:, None, :] - + z_layers[None, :, None] * curvature_prestrain[:, None, :] - ) - if symmetry == "orthotropic": - initial_stress_material = np.einsum( - "ij,glj->gli", - np.linalg.inv(stress_to_local), - initial_stress, - ) - kinematic_material = np.einsum( - "ij,glj->gli", - strain_to_material, - kinematic_layer_strain, - ) - eigenstrain_material = np.einsum( - "ij,glj->gli", - strain_to_material, - eigenstrain, - ) - stress_strain_offset = np.einsum( - "ij,glj->gli", - np.linalg.inv(C_material), - initial_stress_material, - ) - layer_strain_material = ( - kinematic_material - eigenstrain_material + stress_strain_offset - ).reshape(n_gp * num_layers, 3) - layer_strain = ( - kinematic_layer_strain - eigenstrain - + np.einsum( - "ij,glj->gli", - np.linalg.inv(C_el), - initial_stress, - ) - ).reshape(n_gp * num_layers, 3) - else: - stress_strain_offset = np.einsum( - "ij,glj->gli", - np.linalg.inv(C_el), - initial_stress, - ) - layer_strain = ( - kinematic_layer_strain - eigenstrain + stress_strain_offset - ).reshape(n_gp * num_layers, 3) - layer_strain_material = layer_strain - if not constitutive_plasticity: - sigma = layer_strain @ C_el.T - C_tan = np.broadcast_to(C_el, (n_gp * num_layers, 3, 3)).copy() - ep_new = np.zeros_like(layer_strain) - alpha_new = np.zeros(n_gp * num_layers, dtype=float) - if symmetry == "orthotropic": - sigma_material = layer_strain_material @ C_material.T - elif hill_plasticity: - from .plasticity import hill48_plane_stress_return_map - - sigma_material, C_tan_material, ep_new, alpha_new = ( - hill48_plane_stress_return_map( - layer_strain_material, - state["plastic_strain"], - state["alpha"], - C_material, - hill_yield, - curve, - compute_tangent=tangent, - ) - ) - sigma = sigma_material @ stress_to_local.T - C_tan = np.einsum( - "ij,njk,kl->nil", - stress_to_local, - C_tan_material, - strain_to_material, - ) - else: - sigma, C_tan, ep_new, alpha_new = plane_stress_return_map( - layer_strain, - state["plastic_strain"], - state["alpha"], - _guarded_float( - _guarded_observe_attribute( - material, - "elastic_modulus", - post_observation=_qualified_runtime_post_observation, - ), - post_observation=_qualified_runtime_post_observation, - ), - _guarded_float( - _guarded_observe_attribute( - material, - "poisson_ratio", - post_observation=_qualified_runtime_post_observation, - ), - post_observation=_qualified_runtime_post_observation, - ), - curve, - compute_tangent=tangent, - ) - trial_state = { - "plastic_strain": ep_new, - "alpha": alpha_new, - "layer_strain": layer_strain.copy(), - "layer_strain_material": layer_strain_material.copy(), - "kinematic_layer_strain": kinematic_layer_strain.reshape(n_gp * num_layers, 3).copy(), - **initial_state, - } - - sigma = sigma.reshape(n_gp, num_layers, 3) - C_tan = C_tan.reshape(n_gp, num_layers, 3, 3) - trial_state["layer_stress"] = sigma.reshape(n_gp * num_layers, 3).copy() - if symmetry == "orthotropic": - trial_state["layer_stress_material"] = sigma_material.reshape( - n_gp * num_layers, - 3, - ).copy() - trial_state["equivalent_stress_measure"] = ( - "hill48" if hill_yield is not None else "von_mises" - ) - - # Through-thickness resultants and integrated tangent moduli. - N_res = np.einsum("l,gli->gi", w_layers, sigma) - M_res = np.einsum("l,l,gli->gi", w_layers, z_layers, sigma) - C0 = np.einsum("l,glij->gij", w_layers, C_tan) - C1 = np.einsum("l,l,glij->gij", w_layers, z_layers, C_tan) - C2 = np.einsum("l,l,l,glij->gij", w_layers, z_layers, z_layers, C_tan) - - n_dof = self.total_dofs - F_loc, K_loc_temp = _jit_integrate_nonlinear_response( - u_loc, - N_res, - M_res, - C0, - C1, - C2, - cache["B_m_all"], - cache["B_b_all"], - cache["B_d_all"], - cache["Gw_all"], - cache["detw_all"], - cache["B_s_all"], - cache["detw_shear_all"], - D_shear, - drilling_stiffness, - tangent, - constitutive_plasticity, - n_dof, - ) - K_loc = K_loc_temp if tangent else None - - K_hg = getattr(self, "_hourglass_stiffness_matrix", None) - if self._is_8node and self.reduced_integration and float(getattr(self, "hourglass_stabilization", 0.0)) > 0.0: - if K_hg is None: - self.compute_stiffness_matrix(mesh, material) - K_hg = getattr(self, "_hourglass_stiffness_matrix", None) - - F_global = T0.T @ F_loc - if K_hg is not None: - u_global = np.asarray(u_elem, dtype=float) - F_global = F_global + K_hg @ u_global - - if not tangent: - return F_global, None, trial_state - K_global = T0.T @ K_loc @ T0 - if K_hg is not None: - K_global = K_global + K_hg - if _return_tangent_components: - material_local, geometric_local = ( - _integrate_nonlinear_tangent_components( - u_loc, - N_res, - M_res, - C0, - C1, - C2, - cache["B_m_all"], - cache["B_b_all"], - cache["B_d_all"], - cache["Gw_all"], - cache["detw_all"], - cache["B_s_all"], - cache["detw_shear_all"], - D_shear, - drilling_stiffness, - constitutive_plasticity, - n_dof, - ) - ) - material_global = T0.T @ material_local @ T0 - geometric_global = T0.T @ geometric_local @ T0 - if K_hg is not None: - material_global = material_global + K_hg - return F_global, K_global, trial_state, { - "material": material_global, - "geometric": geometric_global, - } - return F_global, K_global, trial_state - - def _compute_generalized_section_results( - self, - mesh: "FEMesh", - displacements: np.ndarray, - *, - return_global: bool, - ) -> Dict[str, Any]: - """Recover exact generalized strains and resultants. - - A/B/D/As do not contain enough information to reconstruct ply or - through-thickness surface stresses, so this path intentionally does - not report von Mises, Hill, or fabricated top/bottom stress fields. - """ - - coords = self.get_node_coordinates(mesh) - u_elem_global = self._get_element_displacements(mesh, displacements) - num_ip = len(self.gauss_points) - membrane_strain = np.zeros((num_ip, 3), dtype=float) - curvature = np.zeros((num_ip, 3), dtype=float) - transverse_shear_strain = np.zeros((num_ip, 2), dtype=float) - membrane_resultants = np.zeros((num_ip, 3), dtype=float) - bending_resultants = np.zeros((num_ip, 3), dtype=float) - transverse_shear_resultants = np.zeros((num_ip, 2), dtype=float) - - global_membrane = ( - np.zeros((num_ip, 3, 3), dtype=float) if return_global else None - ) - global_bending = ( - np.zeros((num_ip, 3, 3), dtype=float) if return_global else None - ) - global_shear = ( - np.zeros((num_ip, 3), dtype=float) if return_global else None - ) - - mitc_planar = None - mitc_samples = None - mitc_u_local = None - tri3_B_s = None - tri3_u_local = None - center_section = None - if self._is_4node: - R_center = self._center_frame(coords) - center_section = self._generalized_section_in_frame(R_center) - mitc_planar, mitc_samples = self._mitc4_shear_samples(coords, R_center) - mitc_u_local = self._local_dof_transform(R_center) @ u_elem_global - elif self._is_3node: - R_center = self._center_frame(coords) - center_section = self._generalized_section_in_frame(R_center) - tri3_B_s, _ = self._tri3_assumed_shear_b_matrix(coords, R_center) - tri3_u_local = self._local_dof_transform(R_center) @ u_elem_global - - for index, (xi, eta) in enumerate(self.gauss_points): - N, dN_dxi, dN_deta = self.compute_shape_functions( - float(xi), - float(eta), - ) - R, dN_dx, dN_dy, _ = self._local_frame_and_derivatives( - coords, - dN_dxi, - dN_deta, - ) - section = self._generalized_section_in_frame(R) - assert section is not None - T = self._local_dof_transform(R) - u_local = T @ u_elem_global - B_m, B_b, B_s = self._build_shell_b_matrices(N, dN_dx, dN_dy) - strain = B_m @ u_local - bend = B_b @ u_local - if self._is_4node: - B_s_mitc, _ = self._mitc4_shear_b_matrix( - mitc_planar, - mitc_samples, - float(xi), - float(eta), - ) - shear_strain = B_s_mitc @ mitc_u_local - shear_section = center_section - elif self._is_3node: - shear_strain = tri3_B_s @ tri3_u_local - shear_section = center_section - else: - shear_strain = B_s @ u_local - shear_section = section - assert shear_section is not None - - force = section.A @ strain + section.B @ bend - moment = section.B.T @ strain + section.D @ bend - shear_force = shear_section.As @ shear_strain - - membrane_strain[index] = strain - curvature[index] = bend - transverse_shear_strain[index] = shear_strain - membrane_resultants[index] = force - bending_resultants[index] = moment - transverse_shear_resultants[index] = shear_force - - if return_global: - force_tensor = np.array( - [ - [force[0], force[2], 0.0], - [force[2], force[1], 0.0], - [0.0, 0.0, 0.0], - ], - dtype=float, - ) - moment_tensor = np.array( - [ - [moment[0], moment[2], 0.0], - [moment[2], moment[1], 0.0], - [0.0, 0.0, 0.0], - ], - dtype=float, - ) - assert global_membrane is not None - assert global_bending is not None - assert global_shear is not None - global_membrane[index] = R @ force_tensor @ R.T - global_bending[index] = R @ moment_tensor @ R.T - global_shear[index] = ( - shear_force[0] * R[:, 0] + shear_force[1] * R[:, 1] - ) - - results: Dict[str, Any] = { - "generalized_stress_scope": "section_resultants_only", - "recovery_scope": "section_resultants_only", - "physical_stress_available": False, - "membrane_resultant_order": SHELL_MEMBRANE_VOIGT_ORDER, - "transverse_shear_resultant_order": SHELL_TRANSVERSE_SHEAR_ORDER, - "membrane_strain": membrane_strain, - "curvature": curvature, - "transverse_shear_strain": transverse_shear_strain, - "membrane_resultants": membrane_resultants, - "bending_resultants": bending_resultants, - "transverse_shear_resultants": transverse_shear_resultants, - } - if return_global: - results.update( - { - "global_membrane_resultant_tensors": global_membrane, - "global_bending_resultant_tensors": global_bending, - "global_transverse_shear_resultants": global_shear, - } - ) - return results - - def compute_stresses( - self, - mesh: "FEMesh", - displacements: np.ndarray, - material: "Material", - return_global: bool = False, - *, - natural_points=None, - ) -> Dict[str, Any]: - if self.shell_section is not None: - if natural_points is not None: - raise ValueError('custom stress points are unsupported for generalized shell sections') - return self._compute_generalized_section_results( - mesh, - displacements, - return_global=return_global, - ) - coords = self.get_node_coordinates(mesh) - u_elem_global = self._get_element_displacements(mesh, displacements) - symmetry = _elastic_symmetry(material) - h = self.thickness - kappa = 5.0 / 6.0 - - recovery_points=self.gauss_points if natural_points is None else np.asarray(natural_points,dtype=float) - if natural_points is not None and (recovery_points.ndim!=2 or recovery_points.shape[1]!=2 or len(recovery_points)==0 or not np.all(np.isfinite(recovery_points)) or np.any(np.abs(recovery_points)>1)): - raise ValueError('natural stress points must be nonempty finite Nx2 in [-1,1]') - num_ip = len(recovery_points) - stresses: Dict[str, np.ndarray] = { - "membrane_xx": np.zeros(num_ip), - "membrane_yy": np.zeros(num_ip), - "membrane_xy": np.zeros(num_ip), - "bending_xx": np.zeros(num_ip), - "bending_yy": np.zeros(num_ip), - "bending_xy": np.zeros(num_ip), - "shear_xz": np.zeros(num_ip), - "shear_yz": np.zeros(num_ip), - "von_mises": np.zeros(num_ip), - "equivalent_stress": np.zeros(num_ip), - "hill_utilization": np.zeros(num_ip), - } - stresses["equivalent_stress_measure"] = ( - "hill48" if symmetry == "orthotropic" and getattr(material, "hill_yield", None) is not None - else "von_mises" - ) - if return_global: - stresses.update({ - "local_xx_top": np.zeros(num_ip), - "local_yy_top": np.zeros(num_ip), - "local_zz_top": np.zeros(num_ip), - "local_xy_top": np.zeros(num_ip), - "local_yz_top": np.zeros(num_ip), - "local_xz_top": np.zeros(num_ip), - "local_xx_bot": np.zeros(num_ip), - "local_yy_bot": np.zeros(num_ip), - "local_zz_bot": np.zeros(num_ip), - "local_xy_bot": np.zeros(num_ip), - "local_yz_bot": np.zeros(num_ip), - "local_xz_bot": np.zeros(num_ip), - "global_xx_top": np.zeros(num_ip), - "global_yy_top": np.zeros(num_ip), - "global_zz_top": np.zeros(num_ip), - "global_xy_top": np.zeros(num_ip), - "global_yz_top": np.zeros(num_ip), - "global_xz_top": np.zeros(num_ip), - "global_xx_bot": np.zeros(num_ip), - "global_yy_bot": np.zeros(num_ip), - "global_zz_bot": np.zeros(num_ip), - "global_xy_bot": np.zeros(num_ip), - "global_yz_bot": np.zeros(num_ip), - "global_xz_bot": np.zeros(num_ip), - }) - - mitc_planar = None - mitc_samples = None - mitc_u_local = None - tri3_B_s = None - tri3_u_local = None - if self._is_4node: - R_center = self._center_frame(coords) - _Q_center, G_center, _strain_center, _stress_center = _shell_material_matrices( - material, - self._material_angle(R_center), - ) - mitc_planar, mitc_samples = self._mitc4_shear_samples(coords, R_center) - mitc_u_local = self._local_dof_transform(R_center) @ u_elem_global - elif self._is_3node: - R_center = self._center_frame(coords) - _Q_center, G_center, _strain_center, _stress_center = _shell_material_matrices( - material, - self._material_angle(R_center), - ) - tri3_B_s, _ = self._tri3_assumed_shear_b_matrix(coords, R_center) - tri3_u_local = self._local_dof_transform(R_center) @ u_elem_global - - from .recovery_shell_frames import native_recovery_frames - - frames = native_recovery_frames(self, coords, recovery_points, material) - for idx, (xi, eta) in enumerate(recovery_points): - if frames is None: - N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) - R, dN_dx, dN_dy, _ = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) - else: - N, R, dN_dx, dN_dy = frames[idx] - Q_local, G_local, _strain_to_material, stress_to_local = _shell_material_matrices( - material, - self._material_angle(R), - ) - T = self._local_dof_transform(R) - u_local = T @ u_elem_global - B_m, B_b, B_s = self._build_shell_b_matrices(N, dN_dx, dN_dy) - membrane_strain = B_m @ u_local - curvature = B_b @ u_local - if self._is_4node: - B_s_mitc, _ = self._mitc4_shear_b_matrix(mitc_planar, mitc_samples, float(xi), float(eta)) - shear_strain = B_s_mitc @ mitc_u_local - elif self._is_3node: - shear_strain = tri3_B_s @ tri3_u_local - else: - shear_strain = B_s @ u_local - - sigma_m = Q_local @ membrane_strain - moments = (h**3 / 12.0 * Q_local) @ curvature - sigma_b = 6.0 * moments / max(h**2, _SMALL) - shear_matrix = G_center if self._is_4node or self._is_3node else G_local - tau_s = kappa * shear_matrix @ shear_strain - - stresses["membrane_xx"][idx] = sigma_m[0] - stresses["membrane_yy"][idx] = sigma_m[1] - stresses["membrane_xy"][idx] = sigma_m[2] - stresses["bending_xx"][idx] = sigma_b[0] - stresses["bending_yy"][idx] = sigma_b[1] - stresses["bending_xy"][idx] = sigma_b[2] - stresses["shear_xz"][idx] = tau_s[0] - stresses["shear_yz"][idx] = tau_s[1] - - # Top surface (z = +h/2) - sigma_x_top = sigma_m[0] + sigma_b[0] - sigma_y_top = sigma_m[1] + sigma_b[1] - tau_xy_top = sigma_m[2] + sigma_b[2] - vm_top = np.sqrt( - sigma_x_top**2 + sigma_y_top**2 - sigma_x_top * sigma_y_top + 3.0 * (tau_xy_top**2 + tau_s[0]**2 + tau_s[1]**2) - ) - - # Bottom surface (z = -h/2) - sigma_x_bot = sigma_m[0] - sigma_b[0] - sigma_y_bot = sigma_m[1] - sigma_b[1] - tau_xy_bot = sigma_m[2] - sigma_b[2] - vm_bot = np.sqrt( - sigma_x_bot**2 + sigma_y_bot**2 - sigma_x_bot * sigma_y_bot + 3.0 * (tau_xy_bot**2 + tau_s[0]**2 + tau_s[1]**2) - ) - - stresses["von_mises"][idx] = max(vm_top, vm_bot) - hill_yield = getattr(material, "hill_yield", None) - if hill_yield is not None: - from .plasticity import hill48_plane_stress_equivalent_stress - - top_material = np.linalg.solve(stress_to_local, np.array( - [sigma_x_top, sigma_y_top, tau_xy_top], - dtype=float, - )) - bottom_material = np.linalg.solve(stress_to_local, np.array( - [sigma_x_bot, sigma_y_bot, tau_xy_bot], - dtype=float, - )) - hill_values = hill48_plane_stress_equivalent_stress( - np.vstack((top_material, bottom_material)), - hill_yield, - ) - equivalent = float(np.max(hill_values)) - stresses["equivalent_stress"][idx] = equivalent - stresses["hill_utilization"][idx] = equivalent / max(float(hill_yield.X), _SMALL) - else: - stresses["equivalent_stress"][idx] = stresses["von_mises"][idx] - - if return_global: - # Top local stress tensor - sigma_loc_top = np.array([ - [sigma_x_top, tau_xy_top, tau_s[0]], - [tau_xy_top, sigma_y_top, tau_s[1]], - [tau_s[0], tau_s[1], 0.0] - ], dtype=float) - sigma_glob_top = R @ sigma_loc_top @ R.T - - # Bottom local stress tensor - sigma_loc_bot = np.array([ - [sigma_x_bot, tau_xy_bot, tau_s[0]], - [tau_xy_bot, sigma_y_bot, tau_s[1]], - [tau_s[0], tau_s[1], 0.0] - ], dtype=float) - sigma_glob_bot = R @ sigma_loc_bot @ R.T - - # Store local components - stresses["local_xx_top"][idx] = sigma_x_top - stresses["local_yy_top"][idx] = sigma_y_top - stresses["local_zz_top"][idx] = 0.0 - stresses["local_xy_top"][idx] = tau_xy_top - stresses["local_xz_top"][idx] = tau_s[0] - stresses["local_yz_top"][idx] = tau_s[1] - - stresses["local_xx_bot"][idx] = sigma_x_bot - stresses["local_yy_bot"][idx] = sigma_y_bot - stresses["local_zz_bot"][idx] = 0.0 - stresses["local_xy_bot"][idx] = tau_xy_bot - stresses["local_xz_bot"][idx] = tau_s[0] - stresses["local_yz_bot"][idx] = tau_s[1] - - # Store global components - stresses["global_xx_top"][idx] = sigma_glob_top[0, 0] - stresses["global_yy_top"][idx] = sigma_glob_top[1, 1] - stresses["global_zz_top"][idx] = sigma_glob_top[2, 2] - stresses["global_xy_top"][idx] = sigma_glob_top[0, 1] - stresses["global_xz_top"][idx] = sigma_glob_top[0, 2] - stresses["global_yz_top"][idx] = sigma_glob_top[1, 2] - - stresses["global_xx_bot"][idx] = sigma_glob_bot[0, 0] - stresses["global_yy_bot"][idx] = sigma_glob_bot[1, 1] - stresses["global_zz_bot"][idx] = sigma_glob_bot[2, 2] - stresses["global_xy_bot"][idx] = sigma_glob_bot[0, 1] - stresses["global_xz_bot"][idx] = sigma_glob_bot[0, 2] - stresses["global_yz_bot"][idx] = sigma_glob_bot[1, 2] - return stresses - - -def _publish_shell_element_public_signatures() -> None: - """Hide private runtime-guard hooks from the stable public API surface.""" - - from inspect import signature - - mass_signature = signature(ShellElement.compute_mass_matrix) - ShellElement.compute_mass_matrix.__signature__ = mass_signature.replace( - parameters=tuple( - parameter - for parameter in mass_signature.parameters.values() - if parameter.name != "_qualified_runtime_post_observation" - ) - ) - nonlinear_signature = signature(ShellElement.compute_nonlinear_response) - public_nonlinear_return = signature( - Element.compute_nonlinear_response - ).return_annotation - ShellElement.compute_nonlinear_response.__signature__ = ( - nonlinear_signature.replace( - parameters=tuple( - parameter - for parameter in nonlinear_signature.parameters.values() - if parameter.name - not in { - "_return_tangent_components", - "_qualified_runtime_post_observation", - } - ), - return_annotation=public_nonlinear_return, - ) - ) - - -_publish_shell_element_public_signatures() -del _publish_shell_element_public_signatures - - -def _install_strict_flat_s3_v2_legacy_dispatch_guards() -> None: - """Reject explicit base-method bypasses on the Stage-1 V2 candidate.""" - - from functools import wraps - from inspect import signature - - guard = _reject_strict_flat_s3_v2_legacy_dispatch - allowed = {"__init__", "dofs_per_node", "get_node_coordinates", "num_nodes"} - for name, original in tuple(vars(ShellElement).items()): - if name in allowed or name.startswith("__"): - continue - - if type(original) is property: - def wrap_accessor( - accessor: Optional[Callable[..., Any]], - label: str, - _guard: Callable[[Any, str], None] = guard, - ) -> Optional[Callable[..., Any]]: - if accessor is None: - return None - - @wraps(accessor) - def guarded_accessor(self: Any, *args: Any, **kwargs: Any) -> Any: - _guard(self, f"ShellElement.{label}") - return accessor(self, *args, **kwargs) - - guarded_accessor.__signature__ = signature(accessor) # type: ignore[attr-defined] - delattr(guarded_accessor, "__wrapped__") - return guarded_accessor - - setattr( - ShellElement, - name, - property( - wrap_accessor(original.fget, name), - wrap_accessor(original.fset, name), - wrap_accessor(original.fdel, name), - original.__doc__, - ), - ) - continue - if type(original) is not FunctionType: - continue - - @wraps(original) - def guarded( - self: Any, - *args: Any, - __name: str = name, - __original: Callable[..., Any] = original, - __guard: Callable[[Any, str], None] = guard, - **kwargs: Any, - ) -> Any: - __guard(self, f"ShellElement.{__name}") - return __original(self, *args, **kwargs) - - guarded.__signature__ = signature(original) # type: ignore[attr-defined] - delattr(guarded, "__wrapped__") - setattr(ShellElement, name, guarded) - - -_install_strict_flat_s3_v2_legacy_dispatch_guards() -del _install_strict_flat_s3_v2_legacy_dispatch_guards - -# Exact dispatch surface for the recovery-only quadrature frame optimization. -# Subclasses and instance/class overrides retain their scalar dispatch. -_SHELL_RECOVERY_FRAME_METHODS = tuple(vars(ShellElement).items()) -_SHELL_RECOVERY_BASE_METHODS = tuple(vars(Element).items()) -_SHELL_RECOVERY_MATERIAL_METHODS = tuple(vars(_RecoveryIsotropicMaterial).items()) -_SHELL_RECOVERY_FRAME_HELPERS = tuple((name, globals()[name]) for name in ( - "_cross3", "_inv2", "_shell_material_matrices", "_elastic_symmetry", - "_canonical_material_symmetry", "_guarded_observe_attribute", "_guarded_float", - "_jit_compute_8node_shape_functions", -)) - - -class BeamElement(Element): - """2-node Timoshenko beam element with 6 DOF per node. - - ``section=`` opts into a coupled generalized section. The same object may - be supplied under ``cross_section["generalized_section"]``; a raw matrix - is accepted under ``cross_section["generalized_stiffness"]``. Legacy - scalar cross-section dictionaries retain their historical formulation. - A generalized stiffness matrix does not define centroidal geometry, so - its Wagner torsional geometric-stiffness term is omitted by default. - Supply ``cross_section["geometric_polar_radius_squared"]`` in m^2 to opt in - explicitly. - """ - - def __init__( - self, - element_id: int, - node_ids: List[int], - material_name: str = "default", - cross_section: Optional[Dict[str, Any]] = None, - section: Any = None, - ): - super().__init__(element_id, node_ids, material_name) - if len(node_ids) != 2: - raise ValueError(f"BeamElement requires 2 nodes, got {len(node_ids)}") - self.cross_section = cross_section or {} - self._A = self.cross_section.get("area", 0.01) - self._Iy = self.cross_section.get("Iy", 1.0e-8) - self._Iz = self.cross_section.get("Iz", 1.0e-8) - self._J = self.cross_section.get("J", 1.0e-8) - self._ky = self.cross_section.get("shear_factor_y", 5.0 / 6.0) - self._kz = self.cross_section.get("shear_factor_z", 5.0 / 6.0) - self._orientation = _section_orientation(self.cross_section) - self._fiber_plasticity = self.cross_section.get("fiber_plasticity") - self.generalized_section = resolve_generalized_beam_section( - self.cross_section, - section, - ) - if self.generalized_section is not None and self._fiber_plasticity is not None: - raise ValueError( - "Generalized beam sections do not support " - "cross_section['fiber_plasticity']; supply an elastic section " - "without fiber plasticity." - ) - if self.generalized_section is not None: - self._geometric_polar_radius_squared() - self._geometric_nonlinearity = str( - self.cross_section.get("geometric_nonlinearity", self.cross_section.get("geometry", "von_karman")) - ).lower() - # Optional exact stress-recovery data; estimated from A and I if absent. - self._c_y = self.cross_section.get("c_y") - self._c_z = self.cross_section.get("c_z") - self._torsion_modulus = self.cross_section.get("torsion_modulus") - - def set_linear_nodal_offsets(self, offsets) -> None: - """Global node-to-centroid rigid arms for the linear static route only.""" - values=np.asarray(offsets,dtype=float) - if self.num_nodes!=2 or values.shape!=(2,3) or not np.all(np.isfinite(values)): - raise ValueError('linear beam offsets require two finite global vectors') - self._linear_nodal_offsets=values.copy() - - def _linear_rigid_arm_map(self) -> np.ndarray: - arm=np.eye(12) - for i,d in enumerate(getattr(self,'_linear_nodal_offsets',np.zeros((2,3)))): - x,y,z=d - arm[i*6:i*6+3,i*6+3:i*6+6]=np.array([[0,z,-y],[-z,0,x],[y,-x,0]]) - return arm - - def recover_linear_section_forces(self, mesh, displacements, material, stations): - """Global force/moment on a positive local-x cut; no beam distributed loads.""" - stations=np.asarray(stations,dtype=float) - if stations.ndim!=2 or stations.shape[1]!=3 or len(stations)==0 or not np.all(np.isfinite(stations)): - raise ValueError('beam stations must be nonempty finite Nx3 coordinates') - coords=self.get_node_coordinates(mesh) - length,transform=self._beam_frame_and_transform(coords) - local=transform@self._get_element_displacements(mesh,displacements) - end=self._local_linear_stiffness(length,material)@local - rotation=_beam_rotation_matrix((coords[1]-coords[0])/length,self._orientation) - output=[] - for station in stations: - distance=float(np.dot(station-coords[0],rotation[:,0])) - if distance < -1e-6 or distance>length+1e-6 or np.linalg.norm(station-(coords[0]+distance*rotation[:,0]))>1e-6: - raise ValueError('beam result station is not on physical centroid line') - force=-end[:3] - moment=-end[3:6]+np.cross([distance,0,0],end[:3]) - output.append(np.r_[rotation@force,rotation@moment]) - return np.asarray(output) - - def _refuse_offset_route(self, route): - if np.any(getattr(self,'_linear_nodal_offsets',0)): - raise ValueError(f'offset beam {route} is not admitted; linear static only') - - def _fiber_distances(self) -> Tuple[float, float]: - """Extreme fiber distances (local y, local z), estimated when not given.""" - c_y = self._c_y - c_z = self._c_z - if c_y is None or c_y <= 0.0: - c_y = np.sqrt(abs(self._Iz) / max(self._A, _SMALL)) * 2.0 - if c_z is None or c_z <= 0.0: - c_z = np.sqrt(abs(self._Iy) / max(self._A, _SMALL)) * 2.0 - return max(float(c_y), _SMALL), max(float(c_z), _SMALL) - - def _torsion_section_modulus(self) -> float: - """Torsional section modulus Wt with tau = T / Wt, estimated when not given.""" - wt = self._torsion_modulus - if wt is None or wt <= 0.0: - wt = 2.0 * self._A - return max(float(wt), _SMALL) - - def _geometric_polar_radius_squared(self) -> float: - """Return the section polar radius squared used by the Wagner term. - - The legacy scalar section defines this quantity as ``(Iy + Iz) / A``. - A generalized 6x6 stiffness does not uniquely define any of those - geometric quantities, even when legacy keys happen to be present for - mass fallback or other workflows. Generalized sections therefore - require an explicitly named geometric value and otherwise omit the - Wagner term. - """ - if self.generalized_section is None: - return (self._Iy + self._Iz) / max(self._A, 1.0e-30) - - value = self.cross_section.get("geometric_polar_radius_squared") - if value is None: - return 0.0 - try: - polar_radius_squared = float(value) - except (TypeError, ValueError) as exc: - raise ValueError( - "cross_section['geometric_polar_radius_squared'] must be a " - "finite non-negative value in m^2 for a generalized beam " - "section." - ) from exc - if ( - not np.isfinite(polar_radius_squared) - or polar_radius_squared < 0.0 - ): - raise ValueError( - "cross_section['geometric_polar_radius_squared'] must be a " - "finite non-negative value in m^2 for a generalized beam " - "section." - ) - return polar_radius_squared - - @property - def num_nodes(self) -> int: - return 2 - - @property - def dofs_per_node(self) -> int: - return 6 - - def get_node_coordinates(self, mesh: "FEMesh") -> np.ndarray: - coords = np.zeros((2, 3), dtype=float) - for i, node_id in enumerate(self.node_ids): - node = mesh.get_node(node_id) - if node is None: - raise ValueError(f"Beam element {self.element_id} references missing node {node_id}") - coords[i] = node.coords() - return coords+getattr(self,'_linear_nodal_offsets',0) - - def _beam_frame_and_transform(self, coords: np.ndarray) -> Tuple[float, np.ndarray]: - length = float(np.linalg.norm(coords[1] - coords[0])) - if length < _SMALL: - raise ValueError(f"Beam element {self.element_id} has near-zero length") - e1 = (coords[1] - coords[0]) / length - R = _beam_rotation_matrix(e1, self._orientation) - T = np.zeros((12, 12), dtype=float) - Rt = R.T - for i in range(2): - b = i * 6 - T[b:b + 3, b:b + 3] = Rt - T[b + 3:b + 6, b + 3:b + 6] = Rt - return length, T@self._linear_rigid_arm_map() - - def _local_linear_stiffness(self, length: float, material: "Material", include_axial: bool = True) -> np.ndarray: - L = float(length) - if self.generalized_section is not None: - section_stiffness = generalized_beam_stiffness( - self.generalized_section - ) - basic_transform = _beam2_basic_deformation_matrix(L) - if not include_axial: - basic_transform = basic_transform.copy() - basic_transform[0, :] = 0.0 - _flexibility, basic_stiffness = ( - _beam2_generalized_flexibility(L, section_stiffness) - ) - # Force-based integration satisfies beam equilibrium exactly and - # avoids shear locking. For a diagonal section matrix this - # reduces to the historical closed-form Timoshenko stiffness; - # off-diagonal terms retain all generalized couplings. - return ( - basic_transform.T - @ basic_stiffness - @ basic_transform - ) - E, G12, G13, GJ = _beam_material_properties(material, self.cross_section) - EA = E * self._A - EIy = E * self._Iy - EIz = E * self._Iz - K = np.zeros((12, 12), dtype=float) - if include_axial: - K[0, 0] = K[6, 6] = EA / L - K[0, 6] = K[6, 0] = -EA / L - - # Bending about local y: deflection w (local z), rotation ry, EIy, - # Timoshenko shear parameter from the local-z shear area. - phi_w = 12.0 * EIy / max(G13 * self._A * self._kz * L**2, _SMALL) - K[2, 2] = K[8, 8] = 12.0 * EIy / (L**3 * (1.0 + phi_w)) - K[2, 8] = K[8, 2] = -K[2, 2] - K[2, 4] = K[4, 2] = -6.0 * EIy / (L**2 * (1.0 + phi_w)) - K[2, 10] = K[10, 2] = K[2, 4] - K[8, 4] = K[4, 8] = -K[2, 4] - K[8, 10] = K[10, 8] = -K[2, 4] - K[4, 4] = K[10, 10] = (4.0 + phi_w) * EIy / (L * (1.0 + phi_w)) - K[4, 10] = K[10, 4] = (2.0 - phi_w) * EIy / (L * (1.0 + phi_w)) - - # Bending about local z: deflection v (local y), rotation rz, EIz, - # Timoshenko shear parameter from the local-y shear area. - phi_v = 12.0 * EIz / max(G12 * self._A * self._ky * L**2, _SMALL) - K[1, 1] = K[7, 7] = 12.0 * EIz / (L**3 * (1.0 + phi_v)) - K[1, 7] = K[7, 1] = -K[1, 1] - K[1, 5] = K[5, 1] = 6.0 * EIz / (L**2 * (1.0 + phi_v)) - K[1, 11] = K[11, 1] = 6.0 * EIz / (L**2 * (1.0 + phi_v)) - K[7, 5] = K[5, 7] = -6.0 * EIz / (L**2 * (1.0 + phi_v)) - K[7, 11] = K[11, 7] = -6.0 * EIz / (L**2 * (1.0 + phi_v)) - K[5, 5] = K[11, 11] = (4.0 + phi_v) * EIz / (L * (1.0 + phi_v)) - K[5, 11] = K[11, 5] = (2.0 - phi_v) * EIz / (L * (1.0 + phi_v)) - - K[3, 3] = K[9, 9] = GJ / L - K[3, 9] = K[9, 3] = -GJ / L - return K - - def compute_stiffness_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: - coords = self.get_node_coordinates(mesh) - try: - L, T = self._beam_frame_and_transform(coords) - except ValueError: - if np.any(getattr(self,'_linear_nodal_offsets',0)): - raise - return np.zeros((self.total_dofs, self.total_dofs)) - K = self._local_linear_stiffness(L, material) - K_global = T.T @ K @ T - self._stiffness_matrix = K_global - return K_global - - def compute_mass_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: - self._refuse_offset_route('mass/dynamics') - coords = self.get_node_coordinates(mesh) - try: - L, T = self._beam_frame_and_transform(coords) - except ValueError: - return np.zeros((self.total_dofs, self.total_dofs)) - generalized_mass = ( - None - if self.generalized_section is None - else generalized_beam_mass_matrix(self.generalized_section) - ) - if generalized_mass is not None: - # Exact consistent integration of the linear interpolation. A - # full sectional inertia matrix may include centre-of-mass or - # product-of-inertia translation/rotation coupling, so diagonal - # lumping would discard part of the supplied constitutive data. - interpolation_mass = np.array( - [[1.0 / 3.0, 1.0 / 6.0], [1.0 / 6.0, 1.0 / 3.0]], - dtype=float, - ) - M = np.zeros((12, 12), dtype=float) - for i in range(2): - for j in range(2): - M[ - i * 6 : (i + 1) * 6, - j * 6 : (j + 1) * 6, - ] = interpolation_mass[i, j] * L * generalized_mass - M_global = T.T @ M @ T - self._mass_matrix = M_global - return M_global - rho = material.density - M = np.zeros((12, 12), dtype=float) - if bool(self.cross_section.get("consistent_mass", False)): - # Consistent mass on the element's own linear interpolation, - # mirroring the 3-node quadratic beam: N_i N_j blocks for the - # translations (rho A) and for each rotation with its matching - # section inertia (polar Iy+Iz for torsion). Rigid-body - # translational and rotational inertia are exact, so no lumped - # bar-length correction terms are needed. - coupling = np.array([[1.0 / 3.0, 1.0 / 6.0], [1.0 / 6.0, 1.0 / 3.0]], dtype=float) - rotary_density = ( - rho * (self._Iy + self._Iz), # rx (torsion) - rho * self._Iy, # ry - rho * self._Iz, # rz - ) - for i in range(2): - for j in range(2): - factor = coupling[i, j] * L - for d in range(3): - M[i * 6 + d, j * 6 + d] = rho * self._A * factor - M[i * 6 + 3 + d, j * 6 + 3 + d] = rotary_density[d] * factor - M_global = T.T @ M @ T - self._mass_matrix = M_global - return M_global - mass_per_node = rho * self._A * L / 2.0 - # Lumped rotary inertia: bending rotations carry the rigid-bar term - # rho*A*L^3/24 plus the section rotatory term rho*I*L/2; the torsion - # DOF carries the polar section inertia rho*(Iy+Iz)*L/2, not a - # bar-length term, because spinning about the member axis does not - # translate the distributed mass. - rotary_bar = mass_per_node * L**2 / 12.0 - rotary = ( - rho * (self._Iy + self._Iz) * L / 2.0, # rx (torsion) - rotary_bar + rho * self._Iy * L / 2.0, # ry - rotary_bar + rho * self._Iz * L / 2.0, # rz - ) - for i in range(2): - b = i * 6 - for d in range(3): - M[b + d, b + d] = mass_per_node - M[b + 3 + d, b + 3 + d] = rotary[d] - M_global = T.T @ M @ T - self._mass_matrix = M_global - return M_global - - @staticmethod - def _axial_compression_from_state(state: Optional[Any]) -> float: - """Return positive compression from a user/reference element state.""" - if state is None: - return 0.0 - if isinstance(state, (int, float, np.number)): - return float(state) - if not isinstance(state, dict): - return 0.0 - - for key in ("axial_compression", "compression", "N_compression"): - if key in state: - return float(state[key]) - - for key in ("axial_force", "N", "reference_axial_force"): - if key in state: - # Stress recovery uses positive axial strain/stress in tension, - # so a negative axial force is destabilizing compression. - return -float(state[key]) - return 0.0 - - def compute_geometric_stiffness_matrix( - self, - mesh: "FEMesh", - material: "Material", - state: Optional[Any] = None, - ) -> np.ndarray: - """ - Beam-column geometric stiffness for an axial reference compression. - - The returned matrix follows ``K phi = lambda KG phi``. A positive - ``axial_compression`` in ``state`` therefore produces a positive - destabilizing ``KG``. - """ - self._refuse_offset_route('geometric stiffness') - axial_compression = self._axial_compression_from_state(state) - if axial_compression == 0.0: - return np.zeros((self.total_dofs, self.total_dofs), dtype=float) - - coords = self.get_node_coordinates(mesh) - try: - L, T = self._beam_frame_and_transform(coords) - except ValueError: - return np.zeros((self.total_dofs, self.total_dofs), dtype=float) - - factor = axial_compression / (30.0 * L) - L2 = L * L - g_standard = factor * np.array( - [ - [36.0, 3.0 * L, -36.0, 3.0 * L], - [3.0 * L, 4.0 * L2, -3.0 * L, -L2], - [-36.0, -3.0 * L, 36.0, -3.0 * L], - [3.0 * L, -L2, -3.0 * L, 4.0 * L2], - ], - dtype=float, - ) - - K_geo = np.zeros((12, 12), dtype=float) - v_rz = [1, 5, 7, 11] - w_ry = [2, 4, 8, 10] - sign_w = np.diag([1.0, -1.0, 1.0, -1.0]) - g_w = sign_w @ g_standard @ sign_w - - for i, row in enumerate(v_rz): - for j, col in enumerate(v_rz): - K_geo[row, col] += g_standard[i, j] - for i, row in enumerate(w_ry): - for j, col in enumerate(w_ry): - K_geo[row, col] += g_w[i, j] - - # Wagner term: axial compression destabilizes twist about the shear - # center, enabling torsional and flexural-torsional column modes - # (stiffener tripping under axial stress). The shear center is taken - # at the centroid and warping is neglected, consistent with the - # element's St. Venant torsion treatment, so the torsional critical - # load is G*J*A/Ip. - polar_ratio = self._geometric_polar_radius_squared() - g_torsion = axial_compression * polar_ratio / L - K_geo[3, 3] += g_torsion - K_geo[3, 9] -= g_torsion - K_geo[9, 3] -= g_torsion - K_geo[9, 9] += g_torsion - - return T.T @ K_geo @ T - - def _fiber_plasticity_config(self, material: "Material") -> Optional[FiberSectionPlasticityConfig]: - config = self._fiber_plasticity - if config is None: - return None - if isinstance(config, dict): - config = FiberSectionPlasticityConfig(**config) - elif config is True: - config = FiberSectionPlasticityConfig() - elif not isinstance(config, FiberSectionPlasticityConfig): - raise TypeError("cross_section['fiber_plasticity'] must be a FiberSectionPlasticityConfig, dict or True") - curve = config.material_curve or getattr(material, "hardening_curve", None) - if curve is None: - if ( - _elastic_symmetry(material) == "orthotropic" - and getattr(material, "hill_yield", None) is not None - ): - # Hill X supplies an elastic-perfectly-plastic longitudinal - # fiber law when no scalar hardening curve is provided. - return config - return None - if config.material_curve is curve: - return config - return FiberSectionPlasticityConfig(config.num_y, config.num_z, curve) - - def _fiber_section_grid(self, config: FiberSectionPlasticityConfig) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: - cross = self.cross_section if isinstance(getattr(self, "cross_section", None), dict) else {} - web_height = float(cross.get("web_height") or 0.0) - web_thickness = float(cross.get("web_thickness") or 0.0) - flange_width = float(cross.get("flange_width") or 0.0) - flange_thickness = float(cross.get("flange_thickness") or 0.0) - shaped = ( - web_height > 0.0 - and web_thickness > 0.0 - and flange_width > 0.0 - and flange_thickness > 0.0 - ) - key = ( - "fiber_grid", - int(config.num_y), - int(config.num_z), - float(self._A), - float(self._Iy), - float(self._Iz), - round(web_height, 12), - round(web_thickness, 12), - round(flange_width, 12), - round(flange_thickness, 12), - ) - cache = getattr(self, "_fiber_grid_cache", None) - if cache is not None and cache.get("key") == key: - return cache["y"], cache["z"], cache["weights"] - - if shaped: - # Profile-true fiber layout: web and flange strips follow the real - # T/L section geometry so the plastification order (flange tips vs - # web) is captured. The coordinates and weights are afterwards - # recentred and rescaled to reproduce the section constants - # A/Iy/Iz exactly, keeping the elastic response identical to the - # section-property idealization. Flanges are laid out symmetric - # in y also for L profiles (the section constants carry no product - # of inertia). - n_web = max(int(config.num_z), 3) - n_flange = max(int(config.num_y), 3) - web_z = (np.arange(n_web, dtype=float) + 0.5) * (web_height / n_web) - y_parts = [np.zeros(n_web)] - z_parts = [web_z] - weight_parts = [np.full(n_web, web_height * web_thickness / n_web)] - flange_y = (np.arange(n_flange, dtype=float) + 0.5) * (flange_width / n_flange) - 0.5 * flange_width - for z_level in (web_height + 0.25 * flange_thickness, web_height + 0.75 * flange_thickness): - y_parts.append(flange_y.copy()) - z_parts.append(np.full(n_flange, z_level)) - weight_parts.append(np.full(n_flange, flange_width * flange_thickness / (2 * n_flange))) - y = np.concatenate(y_parts) - z = np.concatenate(z_parts) - weights = np.concatenate(weight_parts) - total = float(np.sum(weights)) - if total > _SMALL and self._A > 0.0: - weights *= float(self._A) / total - area = float(np.sum(weights)) - if area > _SMALL: - y = y - float(np.sum(weights * y)) / area - z = z - float(np.sum(weights * z)) / area - else: - raw_y = np.linspace(-1.0, 1.0, int(config.num_y)) if config.num_y > 1 else np.zeros(1) - raw_z = np.linspace(-1.0, 1.0, int(config.num_z)) if config.num_z > 1 else np.zeros(1) - yy, zz = np.meshgrid(raw_y, raw_z, indexing="ij") - y = yy.reshape(-1) - z = zz.reshape(-1) - weights = np.full(y.size, float(self._A) / max(y.size, 1), dtype=float) - - denom_y = float(np.sum(weights * y * y)) - denom_z = float(np.sum(weights * z * z)) - if denom_y > _SMALL and self._Iz > 0.0: - y *= np.sqrt(float(self._Iz) / denom_y) - else: - y *= 0.0 - if denom_z > _SMALL and self._Iy > 0.0: - z *= np.sqrt(float(self._Iy) / denom_z) - else: - z *= 0.0 - - self._fiber_grid_cache = {"key": key, "y": y, "z": z, "weights": weights} - return y, z, weights - - @staticmethod - def _uniaxial_return_map( - strain: np.ndarray, - state: Optional[Any], - E: float, - curve: Any, - flow_scale: float = 1.0, - ) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]: - strain = np.asarray(strain, dtype=float).reshape(-1) - n = strain.size - if isinstance(state, dict) and np.asarray(state.get("plastic_strain", [])).size == n: - plastic_old = np.asarray(state["plastic_strain"], dtype=float).reshape(-1) - alpha_old = np.asarray(state.get("alpha", np.zeros(n)), dtype=float).reshape(-1) - if alpha_old.size == 1: - alpha_old = np.full(n, float(alpha_old[0]), dtype=float) - elif alpha_old.size != n: - raise ValueError( - f"Beam fiber alpha has {alpha_old.size} entries; expected 1 or {n}" - ) - else: - plastic_old = np.zeros(n, dtype=float) - alpha_old = np.zeros(n, dtype=float) - - trial = E * (strain - plastic_old) - abs_trial = np.abs(trial) - scale = float(flow_scale) - if not np.isfinite(scale) or scale <= 0.0: - raise ValueError("beam fiber flow_scale must be positive") - flow_old = ( - np.full(n, scale, dtype=float) - if curve is None - else scale * curve.flow_stress(alpha_old) - ) - yielding = abs_trial > flow_old + 1.0e-9 * np.maximum(flow_old, 1.0) - - stress = trial.copy() - tangent = np.full(n, E, dtype=float) - plastic_new = plastic_old.copy() - alpha_new = alpha_old.copy() - if not np.any(yielding): - return stress, tangent, plastic_new, alpha_new - - indices = np.where(yielding)[0] - for idx in indices: - sign = 1.0 if trial[idx] >= 0.0 else -1.0 - dgamma = 0.0 - lower = 0.0 - upper = abs_trial[idx] / E - H = ( - 0.0 - if curve is None - else scale - * float( - curve.hardening_modulus(np.array([alpha_old[idx]]))[0] - ) - ) - converged = False - for _ in range(30): - alpha_trial = alpha_old[idx] + dgamma - if curve is None: - sy = scale - H = 0.0 - else: - sy = scale * float( - curve.flow_stress(np.array([alpha_trial]))[0] - ) - H = scale * float( - curve.hardening_modulus(np.array([alpha_trial]))[0] - ) - residual = abs_trial[idx] - E * dgamma - sy - # At very large trial strains, ``abs_trial - E * dgamma`` - # loses several hundred pascals to floating-point cancellation. - # Do not demand a residual below the resolution of the terms - # being subtracted. The physical tolerance remains governing - # for ordinary structural strain ranges. - roundoff_tolerance = 16.0 * np.finfo(float).eps * max( - abs_trial[idx], abs(E * dgamma), abs(sy), 1.0 - ) - convergence_tolerance = max( - 1.0e-8 * max(abs(sy), 1.0), roundoff_tolerance - ) +""" +Finite Element Implementations + +This module contains element formulations for: +- ShellElement: 3/6-node triangular and 4/8-node quadrilateral Mindlin-Reissner shell element +- BeamElement: 2-node Timoshenko beam element with 6 DOF/node +- QuadraticBeamElement: 3-node quadratic Timoshenko beam element +- CoupledBeamShellElement: kinematic MPC element for eccentric beam-shell interaction + +Shell convention +---------------- +The shell element forms stiffness and stresses in an element-local orthonormal +basis at each integration point: + + local x = projected xi tangent direction + local y = in-surface direction perpendicular to local x + local z = shell normal + +Global nodal translations and rotations are transformed to this local basis +before the membrane, bending and transverse shear B-matrices are evaluated. + +Shell shear treatment +--------------------- +Membrane and bending always use full integration for the element topology. +Transverse shear depends on the topology: + + * 4-node: MITC4 assumed natural shear (covariant shear sampled at the four + edge midpoints and interpolated), integrated at the full 2x2 rule. This + avoids both shear locking and the spurious zero-energy w-hourglass mode + of one-point reduced shear integration. + * 3-node: centroidal edge-compatible assumed shear. This is the constant + shear part of the DSG/MITC3 family: transverse shear is evaluated from + the element-average shear gap in the centroid frame, preserving rigid + body motion and constant-shear patches without the locking-prone fully + integrated linear Mindlin shear term. + * 6-node: quadratic displacement interpolation with reduced three-point + triangular shear integration. + * 8-node: reduced 2x2 shear integration (S8R style). When full element + reduced integration is requested, a small nullspace-projection + hourglass stiffness stabilizes modes outside the six rigid-body modes. + +Beam section convention +----------------------- +Beam local axes are (x = member axis, y, z). ``Iy`` is the second moment of +area about the local y axis and governs bending that deflects the beam in +local z; ``Iz`` governs deflection in local y. ``shear_factor_y`` scales the +shear area for transverse shear force in local y, ``shear_factor_z`` for local +z. The optional ``cross_section["orientation"]`` vector prescribes the local +z direction (e.g. the stiffener web direction). Without it, a heuristic picks +local y close to global Y (or global Z for members nearly parallel to Y), +which leaves the section orientation unconstrained for asymmetric sections. + +Beam-shell coupling +------------------- +Beam-shell coupling is represented as a linear multi-point constraint (MPC), +not as a large penalty spring. For a beam node offset from a shell node by +vector r, the coupling relation is: + + u_beam = u_shell + theta_shell x r + theta_beam = theta_shell + +The assembly solver eliminates these slave beam DOFs through a transformation. +""" + +from __future__ import annotations + +from abc import ABC, abstractmethod +import copy +from types import FunctionType, MemberDescriptorType +import warnings +from typing import TYPE_CHECKING, Any, Callable, Dict, List, Mapping, Optional, Tuple + +import numpy as np +from anymaterial import IsotropicMaterial as _RecoveryIsotropicMaterial +from . import _compensated_contractions as _local_contractions + +from .beam_sections import ( + GENERALIZED_BEAM_RESULTANT_ORDER, + GENERALIZED_BEAM_STRAIN_ORDER, + generalized_beam_mass_matrix, + generalized_beam_stiffness, + resolve_generalized_beam_section, +) +from .jit_compiler import njit +from .material_curves import FiberSectionPlasticityConfig +from .materials import ( + beam_material_properties as _canonical_beam_material_properties, + elastic_compliance_matrix as _canonical_elastic_compliance, + material_symmetry as _canonical_material_symmetry, +) +from .plasticity import lobatto_layers, plane_stress_elastic_matrix, plane_stress_return_map +from .shell_sections import ( + SHELL_MEMBRANE_VOIGT_ORDER, + SHELL_TRANSVERSE_SHEAR_ORDER, + GeneralizedShellSection, + coerce_generalized_shell_section, +) + +if TYPE_CHECKING: + from .fe_core import FEMesh, Material + + +_SMALL = 1.0e-12 +_INITIAL_SHELL_STATE_KEYS = ( + "initial_membrane_stress", + "initial_bending_stress", + "initial_membrane_prestrain", + "initial_curvature_prestrain", + "initial_field_provenance", +) +_INITIAL_BEAM_STATE_KEYS = ( + "initial_fiber_stress", + "initial_fiber_prestrain", + "initial_field_provenance", +) + + +_OBSERVATION_MISSING = object() +_NO_ATTRIBUTE_DEFAULT = object() + + +def _run_post_observation_guard( + post_observation: Optional[Callable[[], None]], +) -> None: + """Recheck a caller-supplied exact authority lease after one observation.""" + + if post_observation is not None: + post_observation() + + +def _guarded_observe_attribute( + owner: Any, + name: str, + *, + default: Any = _NO_ATTRIBUTE_DEFAULT, + post_observation: Optional[Callable[[], None]] = None, +) -> Any: + """Read one external attribute and recheck before consuming its value.""" + + if default is _NO_ATTRIBUTE_DEFAULT: + value = getattr(owner, name) + else: + value = getattr(owner, name, default) + _run_post_observation_guard(post_observation) + return value + + +def _guarded_observe_call( + provider: Any, + *args: Any, + post_observation: Optional[Callable[[], None]] = None, + **kwargs: Any, +) -> Any: + """Invoke one external provider and recheck before consuming its result.""" + + value = provider(*args, **kwargs) + _run_post_observation_guard(post_observation) + return value + + +def _guarded_float( + value: Any, + *, + post_observation: Optional[Callable[[], None]] = None, +) -> float: + made = float(value) + if type(value) is not float: + _run_post_observation_guard(post_observation) + return made + + +def _guarded_array( + value: Any, + *, + dtype: Any = np.float64, + post_observation: Optional[Callable[[], None]] = None, +) -> np.ndarray: + made = np.asarray(value, dtype=dtype) + # Converting an exact numeric ndarray runs no foreign code. + pure = type(value) is np.ndarray and value.dtype.kind in "fiub" + if not pure: + _run_post_observation_guard(post_observation) + owned = np.array(made, dtype=dtype, order="C", copy=True) + if not pure: + _run_post_observation_guard(post_observation) + return owned + + +def _guarded_owned_mapping( + value: Any, + *, + label: str, + post_observation: Optional[Callable[[], None]] = None, +) -> Dict[str, Any]: + """Detach a string-keyed external mapping before later evaluation.""" + + items_provider = _guarded_observe_attribute( + value, + "items", + post_observation=post_observation, + ) + observed_items = _guarded_observe_call( + items_provider, + post_observation=post_observation, + ) + items = tuple(observed_items) + _run_post_observation_guard(post_observation) + owned: Dict[str, Any] = {} + for item in items: + if type(item) is not tuple or len(item) != 2 or type(item[0]) is not str: + raise TypeError(f"{label} must contain exact string keys") + key, member = item + if key in owned: + raise ValueError(f"{label} contains duplicate key {key!r}") + owned[key] = member + return owned + + +def _guarded_owned_plain_value( + value: Any, + *, + label: str, + post_observation: Optional[Callable[[], None]] = None, +) -> Any: + """Recursively detach caller-owned state before formulation mechanics.""" + + if value is None or type(value) in {bool, int, float, str, bytes}: + return value + if type(value) is np.ndarray: + return _guarded_array( + value, + dtype=value.dtype, + post_observation=post_observation, + ) + if isinstance(value, Mapping): + observed = _guarded_owned_mapping( + value, + label=label, + post_observation=post_observation, + ) + return { + key: _guarded_owned_plain_value( + member, + label=f"{label}.{key}", + post_observation=post_observation, + ) + for key, member in observed.items() + } + if type(value) in {list, tuple}: + observed = tuple(value) + _run_post_observation_guard(post_observation) + made = [ + _guarded_owned_plain_value( + member, + label=f"{label}[{index}]", + post_observation=post_observation, + ) + for index, member in enumerate(observed) + ] + return made if type(value) is list else tuple(made) + try: + return _guarded_array( + value, + post_observation=post_observation, + ) + except (TypeError, ValueError) as exc: + raise TypeError(f"{label} contains an unsupported external value") from exc + + +def _guarded_owned_generalized_shell_section( + section: Any, + *, + post_observation: Optional[Callable[[], None]] = None, + _section_class: type[GeneralizedShellSection] = GeneralizedShellSection, +) -> Optional[GeneralizedShellSection]: + """Coerce one section protocol to an exact solver-owned section.""" + + if section is None: + return None + if type(section) is _section_class: + return section + if isinstance(section, Mapping): + source = _guarded_owned_mapping( + section, + label="generalized shell section", + post_observation=post_observation, + ) + + def read(label: str, default: Any = None) -> Any: + return source[label] if label in source else default + + else: + + def read(label: str, default: Any = None) -> Any: + return _guarded_observe_attribute( + section, + label, + default=default, + post_observation=post_observation, + ) + + matrices: Dict[str, np.ndarray] = {} + for name in ("A", "B", "D", "As"): + raw = read(name, _OBSERVATION_MISSING) + if raw is _OBSERVATION_MISSING or raw is None: + raise TypeError( + "Generalized shell section must provide A, B, D and As; " + f"missing {name}" + ) + matrices[name] = _guarded_array( + raw, + post_observation=post_observation, + ) + raw_name = read("name", "") + name = str(raw_name) + _run_post_observation_guard(post_observation) + masses: Dict[str, Optional[float]] = {} + for field in ("mass_per_area", "rotary_inertia_per_area"): + raw = read(field, None) + masses[field] = ( + None + if raw is None + else _guarded_float(raw, post_observation=post_observation) + ) + return _section_class( + A=matrices["A"], + B=matrices["B"], + D=matrices["D"], + As=matrices["As"], + name=name, + mass_per_area=masses["mass_per_area"], + rotary_inertia_per_area=masses["rotary_inertia_per_area"], + ) + + +def _immutable_float64_array(value: Any) -> np.ndarray: + """Return a C-contiguous float64 array backed by immutable bytes. + + Shell quadrature tables are process-wide formulation inputs. A normal + ``setflags(write=False)`` array can be made writable again when it owns its + storage; a bytes-backed view cannot. This prevents one element or test + from silently changing the rule used by every other shell element. + """ + + contiguous = np.ascontiguousarray(value, dtype=np.float64) + return np.frombuffer( + contiguous.tobytes(order="C"), dtype=np.float64 + ).reshape(contiguous.shape) + + +def _copy_state_fields(state: Any, keys: Tuple[str, ...]) -> Dict[str, Any]: + if not isinstance(state, dict): + return {} + copied: Dict[str, Any] = {} + for key in keys: + if key not in state: + continue + value = state[key] + copied[key] = value.copy() if isinstance(value, np.ndarray) else value + return copied + + +def _shell_field_rows(value: Any, n_gp: int, name: str) -> np.ndarray: + """Broadcast a shell-local engineering vector to one row per Gauss point.""" + array = np.asarray(value, dtype=float) + if array.shape == (3,): + return np.broadcast_to(array, (n_gp, 3)).copy() + if array.shape == (1, 3): + return np.broadcast_to(array, (n_gp, 3)).copy() + if array.shape == (n_gp, 3): + return array.copy() + raise ValueError(f"{name} must have shape (3,) or ({n_gp}, 3); got {array.shape}") + + +def _beam_fiber_field( + value: Any, + total_fibers: int, + section_fibers: int, + name: str, +) -> np.ndarray: + """Broadcast a beam-fiber field over one or all integration sections.""" + array = np.asarray(value, dtype=float).reshape(-1) + if array.size == 1: + return np.full(total_fibers, float(array[0]), dtype=float) + if array.size == section_fibers and total_fibers % section_fibers == 0: + return np.tile(array, total_fibers // section_fibers) + if array.size == total_fibers: + return array.copy() + raise ValueError( + f"{name} must be scalar, have {section_fibers} section-fiber values, " + f"or {total_fibers} total values; got {array.size}" + ) + + +@njit +def _cross3(a: np.ndarray, b: np.ndarray) -> np.ndarray: + """Cross product of two 3-vectors without np.cross dispatch overhead.""" + return np.array( + [ + a[1] * b[2] - a[2] * b[1], + a[2] * b[0] - a[0] * b[2], + a[0] * b[1] - a[1] * b[0], + ], + ) + + +@njit +def _inv2(matrix: np.ndarray) -> Tuple[np.ndarray, float]: + """Inverse and determinant of a 2x2 matrix without LAPACK overhead.""" + det = matrix[0, 0] * matrix[1, 1] - matrix[0, 1] * matrix[1, 0] + if abs(det) < _SMALL: + raise np.linalg.LinAlgError("singular 2x2 matrix") + inv = np.array( + [[matrix[1, 1], -matrix[0, 1]], [-matrix[1, 0], matrix[0, 0]]], + ) / det + return inv, float(det) + + +def _section_orientation(cross_section: Dict[str, Any]) -> Optional[np.ndarray]: + """Return the prescribed local-z (web) direction from a cross-section dict.""" + value = cross_section.get("orientation", cross_section.get("web_direction")) + if value is None: + return None + vector = np.asarray(value, dtype=float).reshape(-1) + if vector.size < 3 or float(np.linalg.norm(vector[:3])) < _SMALL: + return None + return np.array(vector[:3], dtype=float) + + +def _beam_rotation_matrix(e1: np.ndarray, orientation: Optional[np.ndarray]) -> np.ndarray: + """Build the beam local frame [e1 e2 e3] with optional prescribed local z. + + ``orientation`` is the requested local z direction (section web direction). + It is projected perpendicular to the member axis; if it is (nearly) + parallel to the axis the heuristic fallback is used instead. + """ + if orientation is not None: + candidate = orientation - np.dot(orientation, e1) * e1 + norm = float(np.linalg.norm(candidate)) + if norm > 1.0e-6 * float(np.linalg.norm(orientation)): + e3 = candidate / norm + e2 = _cross3(e3, e1) + e2 /= np.linalg.norm(e2) + return np.column_stack((e1, e2, e3)) + trial = np.array([0.0, 1.0, 0.0]) + if abs(float(np.dot(e1, trial))) > 0.95: + trial = np.array([0.0, 0.0, 1.0]) + e2 = trial - np.dot(trial, e1) * e1 + e2 /= np.linalg.norm(e2) + e3 = _cross3(e1, e2) + e3 /= np.linalg.norm(e3) + return np.column_stack((e1, e2, e3)) + + +def _elastic_symmetry( + material: Any, + post_observation: Optional[Callable[[], None]] = None, +) -> str: + """Return the normalized elastic symmetry without inventing isotropic aliases.""" + + symmetry = _canonical_material_symmetry(material) + _run_post_observation_guard(post_observation) + if symmetry not in {"isotropic", "orthotropic"}: + raise ValueError( + f"Unsupported elastic symmetry {symmetry!r}; ANYfeSolver currently supports " + "only isotropic and orthotropic materials." + ) + return symmetry + + +def _elastic_compliance( + material: Any, + post_observation: Optional[Callable[[], None]] = None, +) -> np.ndarray: + """Engineering compliance in [11,22,33,23,13,12] order.""" + + if post_observation is None: + raw_compliance = _canonical_elastic_compliance(material) + else: + provider = _guarded_observe_attribute( + material, + "elastic_compliance_matrix", + default=None, + post_observation=post_observation, + ) + if callable(provider): + raw_compliance = _guarded_observe_call( + provider, + post_observation=post_observation, + ) + elif _elastic_symmetry(material, post_observation) == "isotropic": + elastic_modulus = _guarded_float( + _guarded_observe_attribute( + material, + "elastic_modulus", + post_observation=post_observation, + ), + post_observation=post_observation, + ) + poisson_ratio = _guarded_float( + _guarded_observe_attribute( + material, + "poisson_ratio", + post_observation=post_observation, + ), + post_observation=post_observation, + ) + shear_modulus = elastic_modulus / (2.0 * (1.0 + poisson_ratio)) + raw_compliance = np.array( + [ + [ + 1.0 / elastic_modulus, + -poisson_ratio / elastic_modulus, + -poisson_ratio / elastic_modulus, + 0.0, + 0.0, + 0.0, + ], + [ + -poisson_ratio / elastic_modulus, + 1.0 / elastic_modulus, + -poisson_ratio / elastic_modulus, + 0.0, + 0.0, + 0.0, + ], + [ + -poisson_ratio / elastic_modulus, + -poisson_ratio / elastic_modulus, + 1.0 / elastic_modulus, + 0.0, + 0.0, + 0.0, + ], + [0.0, 0.0, 0.0, 1.0 / shear_modulus, 0.0, 0.0], + [0.0, 0.0, 0.0, 0.0, 1.0 / shear_modulus, 0.0], + [0.0, 0.0, 0.0, 0.0, 0.0, 1.0 / shear_modulus], + ], + dtype=float, + ) + else: + raise ValueError( + "Structural material must provide elastic_compliance_matrix()" + ) + compliance = np.asarray(raw_compliance, dtype=float) + _run_post_observation_guard(post_observation) + if compliance.shape != (6, 6) or not np.all(np.isfinite(compliance)): + raise ValueError("elastic_compliance_matrix() must return a finite 6x6 matrix") + if not np.allclose(compliance, compliance.T, rtol=1.0e-10, atol=1.0e-18): + raise ValueError("elastic compliance matrix must be symmetric") + return 0.5 * (compliance + compliance.T) + + +def _shell_elastic_material_cache_fingerprint( + material: Any, + post_observation: Optional[Callable[[], None]] = None, +) -> Tuple[Any, ...]: + """Bind every elastic input consumed by ``_shell_material_matrices``. + + Material objects are intentionally public and may be edited in place. A + cache key based only on object identity therefore admits stale shell + mechanics. Keep the isotropic branch bit-for-bit aligned with the actual + scalar path, including an explicitly supplied shear modulus; use the + canonical compliance bytes for every other supported material protocol. + """ + + symmetry = _elastic_symmetry(material, post_observation) + raw_elastic_modulus = _guarded_observe_attribute( + material, + "elastic_modulus", + default=_OBSERVATION_MISSING, + post_observation=post_observation, + ) + raw_poisson_ratio = _guarded_observe_attribute( + material, + "poisson_ratio", + default=_OBSERVATION_MISSING, + post_observation=post_observation, + ) + if ( + symmetry == "isotropic" + and raw_elastic_modulus is not _OBSERVATION_MISSING + and raw_poisson_ratio is not _OBSERVATION_MISSING + ): + elastic_modulus = _guarded_float( + raw_elastic_modulus, + post_observation=post_observation, + ) + poisson_ratio = _guarded_float( + raw_poisson_ratio, + post_observation=post_observation, + ) + raw_shear_modulus = _guarded_observe_attribute( + material, + "shear_modulus", + default=elastic_modulus / (2.0 * (1.0 + poisson_ratio)), + post_observation=post_observation, + ) + shear_modulus = _guarded_float( + raw_shear_modulus, + post_observation=post_observation, + ) + return ( + "isotropic_scalar_path", + elastic_modulus, + poisson_ratio, + shear_modulus, + ) + compliance = np.ascontiguousarray( + _elastic_compliance(material, post_observation), + dtype=np.float64, + ) + _run_post_observation_guard(post_observation) + return ( + symmetry, + compliance.shape, + compliance.tobytes(order="C"), + ) + + +def _generalized_shell_section_cache_fingerprint( + section: Any, + post_observation: Optional[Callable[[], None]] = None, +) -> Optional[Tuple[Any, ...]]: + """Return the complete stiffness/mass identity of a generalized section.""" + + if section is None: + return None + matrices = [] + for name, shape in (("A", (3, 3)), ("B", (3, 3)), ("D", (3, 3)), ("As", (2, 2))): + raw = _guarded_observe_attribute( + section, + name, + post_observation=post_observation, + ) + value = _guarded_array( + raw, + post_observation=post_observation, + ) + if value.shape != shape or not np.all(np.isfinite(value)): + raise ValueError( + f"Generalized shell section {name} must remain a finite {shape} matrix" + ) + matrices.append((name, shape, value.tobytes(order="C"))) + raw_name = _guarded_observe_attribute( + section, + "name", + default="", + post_observation=post_observation, + ) + name = str(raw_name) + _run_post_observation_guard(post_observation) + mass_values = [] + for field in ("mass_per_area", "rotary_inertia_per_area"): + raw = _guarded_observe_attribute( + section, + field, + default=None, + post_observation=post_observation, + ) + mass_values.append( + None + if raw is None + else _guarded_float(raw, post_observation=post_observation) + ) + return ( + tuple(matrices), + name, + *mass_values, + ) + + +def _in_plane_transform_matrices(angle_rad: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + """Engineering-strain, stress, and transverse-shear transforms. + + The material 1-axis is rotated by ``angle_rad`` from element-local x + toward local y about the positive shell normal. + """ + + c = float(np.cos(angle_rad)) + s = float(np.sin(angle_rad)) + axes = np.array([[c, -s], [s, c]], dtype=float) + strain_to_material = np.zeros((3, 3), dtype=float) + stress_to_local = np.zeros((3, 3), dtype=float) + for column in range(3): + engineering_strain = np.zeros(3, dtype=float) + engineering_strain[column] = 1.0 + local_tensor = np.array( + [ + [engineering_strain[0], 0.5 * engineering_strain[2]], + [0.5 * engineering_strain[2], engineering_strain[1]], + ], + dtype=float, + ) + material_tensor = axes.T @ local_tensor @ axes + strain_to_material[:, column] = ( + material_tensor[0, 0], + material_tensor[1, 1], + 2.0 * material_tensor[0, 1], + ) + material_stress = np.zeros(3, dtype=float) + material_stress[column] = 1.0 + stress_tensor = np.array( + [ + [material_stress[0], material_stress[2]], + [material_stress[2], material_stress[1]], + ], + dtype=float, + ) + local_stress = axes @ stress_tensor @ axes.T + stress_to_local[:, column] = ( + local_stress[0, 0], + local_stress[1, 1], + local_stress[0, 1], + ) + return strain_to_material, stress_to_local, axes + + +def _compensated_elastic_zero_tangent(element, mesh, material, post_observation=None): + """Scalar zero-state realization, called only after qualified elastic admission. + + Preserve scalar coefficient operations, including reciprocal-compliance + drill, independently of the batch coefficient construction. No state/cache + or caller eligibility is changed here. + """ + geometry = element._nonlinear_geometry(mesh) + membrane, shear, _strain, _stress = _shell_material_matrices( + material, element._material_angle(geometry["R0"]), post_observation) + modulus = 1.0 / float(_elastic_compliance(material, post_observation)[5, 5]) + h = element.thickness + result = _local_contractions.shell_zero_tangent( + geometry, h * membrane, h**3 / 12.0 * membrane, + shear * (5.0 / 6.0) * h, modulus * h * element.drilling_stabilization) + if post_observation is not None: + post_observation() + return result + + +def _shell_material_matrices( + material: Any, + angle_rad: float, + post_observation: Optional[Callable[[], None]] = None, +) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]: + """Return local plane-stress/shear matrices and material-axis transforms.""" + + symmetry = _elastic_symmetry(material, post_observation) + # Preserve the legacy isotropic arithmetic exactly. Forming and reducing + # the 3-D compliance is mathematically equivalent, but its final-bit + # roundoff can perturb tightly qualified eigenvalue thresholds. External + # protocol objects without the historical scalar fields still use the + # compliance path below. + raw_elastic_modulus = _guarded_observe_attribute( + material, + "elastic_modulus", + default=_OBSERVATION_MISSING, + post_observation=post_observation, + ) + raw_poisson_ratio = _guarded_observe_attribute( + material, + "poisson_ratio", + default=_OBSERVATION_MISSING, + post_observation=post_observation, + ) + if ( + symmetry == "isotropic" + and raw_elastic_modulus is not _OBSERVATION_MISSING + and raw_poisson_ratio is not _OBSERVATION_MISSING + ): + E = _guarded_float( + raw_elastic_modulus, + post_observation=post_observation, + ) + nu = _guarded_float( + raw_poisson_ratio, + post_observation=post_observation, + ) + raw_shear_modulus = _guarded_observe_attribute( + material, + "shear_modulus", + default=E / (2.0 * (1.0 + nu)), + post_observation=post_observation, + ) + G = _guarded_float( + raw_shear_modulus, + post_observation=post_observation, + ) + Q_material = E / (1.0 - nu**2) * np.array( + [ + [1.0, nu, 0.0], + [nu, 1.0, 0.0], + [0.0, 0.0, (1.0 - nu) / 2.0], + ], + dtype=float, + ) + return ( + Q_material, + G * np.eye(2, dtype=float), + np.eye(3, dtype=float), + np.eye(3, dtype=float), + ) + + compliance = _elastic_compliance(material, post_observation) + membrane_indices = np.array([0, 1, 5], dtype=np.intp) + shear_indices = np.array([4, 3], dtype=np.intp) # [13, 23] + Q_material = np.linalg.inv(compliance[np.ix_(membrane_indices, membrane_indices)]) + G_material = np.linalg.inv(compliance[np.ix_(shear_indices, shear_indices)]) + strain_to_material, stress_to_local, axes = _in_plane_transform_matrices(angle_rad) + Q_local = stress_to_local @ Q_material @ strain_to_material + G_local = axes @ G_material @ axes.T + return ( + 0.5 * (Q_local + Q_local.T), + 0.5 * (G_local + G_local.T), + strain_to_material, + stress_to_local, + ) + + +def _beam_material_properties(material: Any, cross_section: Dict[str, Any]) -> Tuple[float, float, float, float]: + """Return E1, G12, G13 and torsional rigidity for a beam.""" + + properties = _canonical_beam_material_properties(material) + E1 = float(properties.axial_modulus) + G12 = float(properties.shear_modulus_xy) + G13 = float(properties.shear_modulus_xz) + if _elastic_symmetry(material) == "orthotropic": + value = cross_section.get("torsional_rigidity") + try: + torsional_rigidity = float(value) + except (TypeError, ValueError): + torsional_rigidity = float("nan") + if not np.isfinite(torsional_rigidity) or torsional_rigidity <= 0.0: + raise ValueError( + "Orthotropic beam sections require a positive " + "cross_section['torsional_rigidity'] in N*m^2." + ) + else: + torsional_rigidity = G12 * float(cross_section.get("J", 1.0e-8)) + return E1, G12, G13, torsional_rigidity + + +def _beam2_basic_deformation_matrix(length: float) -> np.ndarray: + """Map local Beam2 DOFs to six work-conjugate basic deformations.""" + + L = float(length) + transform = np.zeros((6, 12), dtype=float) + # Axial extension and torsional rotation. + transform[0, 0], transform[0, 6] = -1.0, 1.0 + transform[1, 3], transform[1, 9] = -1.0, 1.0 + # Bending about y: rotations relative to the rigid chord rotation + # ry + (w2-w1)/L. + transform[2, 2], transform[2, 8], transform[2, 4] = ( + -1.0 / L, + 1.0 / L, + 1.0, + ) + transform[3, 2], transform[3, 8], transform[3, 10] = ( + -1.0 / L, + 1.0 / L, + 1.0, + ) + # Bending about z: rotations relative to the rigid chord rotation + # rz - (v2-v1)/L. + transform[4, 1], transform[4, 7], transform[4, 5] = ( + 1.0 / L, + -1.0 / L, + 1.0, + ) + transform[5, 1], transform[5, 7], transform[5, 11] = ( + 1.0 / L, + -1.0 / L, + 1.0, + ) + return transform + + +def _beam2_force_interpolation(length: float, xi: float) -> np.ndarray: + """Map Beam2 basic forces to equilibrium section resultants.""" + + L = float(length) + x_over_length = 0.5 * (float(xi) + 1.0) + interpolation = np.zeros((6, 6), dtype=float) + interpolation[0, 0] = 1.0 # N + interpolation[3, 1] = 1.0 # T + # q[2:4] are the two basic local-y bending rotations. + interpolation[2, 2:4] = 1.0 / L # Vz + interpolation[4, 2] = -1.0 + x_over_length # My + interpolation[4, 3] = x_over_length + # q[4:6] are the two basic local-z bending rotations. The sign of Vy + # follows gamma_xy = v' - rz. + interpolation[1, 4:6] = -1.0 / L # Vy + interpolation[5, 4] = -1.0 + x_over_length # Mz + interpolation[5, 5] = x_over_length + return interpolation + + +def _beam2_generalized_flexibility( + length: float, + section_stiffness: np.ndarray, +) -> Tuple[np.ndarray, np.ndarray]: + """Return exact constant-section basic flexibility and stiffness.""" + + L = float(length) + compliance = np.linalg.inv(np.asarray(section_stiffness, dtype=float)) + flexibility = np.zeros((6, 6), dtype=float) + points = (-np.sqrt(3.0 / 5.0), 0.0, np.sqrt(3.0 / 5.0)) + weights = (5.0 / 9.0, 8.0 / 9.0, 5.0 / 9.0) + for xi, weight in zip(points, weights): + interpolation = _beam2_force_interpolation(L, xi) + flexibility += ( + interpolation.T + @ compliance + @ interpolation + * (L / 2.0 * weight) + ) + return flexibility, np.linalg.inv(flexibility) + + +def _beam_generalized_strain_matrix_from_shape( + shape_functions: np.ndarray, + shape_derivatives: np.ndarray, +) -> np.ndarray: + """Build a generalized beam B-matrix from compatible shape functions.""" + + N = np.asarray(shape_functions, dtype=float).reshape(-1) + derivative = np.asarray(shape_derivatives, dtype=float).reshape(-1) + if derivative.size != N.size: + raise ValueError("beam shape function and derivative sizes must match") + B = np.zeros((6, 6 * N.size), dtype=float) + for i in range(N.size): + base = 6 * i + B[0, base + 0] = derivative[i] # eps_x + B[1, base + 1] = derivative[i] # gamma_xy = v' - rz + B[1, base + 5] = -N[i] + B[2, base + 2] = derivative[i] # gamma_xz = w' + ry + B[2, base + 4] = N[i] + B[3, base + 3] = derivative[i] # kappa_x + B[4, base + 4] = derivative[i] # kappa_y + B[5, base + 5] = derivative[i] # kappa_z + return B + + +def _generalized_beam_recovery( + strains: np.ndarray, + resultants: np.ndarray, + *, + stations: Optional[np.ndarray] = None, +) -> Dict[str, Any]: + """Build resultants-only recovery without inventing physical stresses.""" + + strain_values = np.asarray(strains, dtype=float) + resultant_values = np.asarray(resultants, dtype=float) + recovered: Dict[str, Any] = { + "generalized_strain": strain_values.copy(), + "generalized_resultant": resultant_values.copy(), + "generalized_strain_order": GENERALIZED_BEAM_STRAIN_ORDER, + "generalized_resultant_order": GENERALIZED_BEAM_RESULTANT_ORDER, + "recovery_scope": "section_resultants_only", + "physical_stress_available": False, + "resultant_frame": "beam_local", + "station_coordinate_system": "natural_xi", + } + for index, key in enumerate(GENERALIZED_BEAM_STRAIN_ORDER): + recovered[key] = ( + float(strain_values[index]) + if strain_values.ndim == 1 + else strain_values[:, index].copy() + ) + for index, key in enumerate(GENERALIZED_BEAM_RESULTANT_ORDER): + recovered[key] = ( + float(resultant_values[index]) + if resultant_values.ndim == 1 + else resultant_values[:, index].copy() + ) + descriptive_strains = ( + "axial_strain", + "shear_strain_xy", + "shear_strain_xz", + "twist_rate", + "curvature_y", + "curvature_z", + ) + descriptive_resultants = ( + "axial_force", + "shear_force_y", + "shear_force_z", + "torsional_moment", + "bending_moment_y", + "bending_moment_z", + ) + for index, key in enumerate(descriptive_strains): + recovered[key] = ( + float(strain_values[index]) + if strain_values.ndim == 1 + else strain_values[:, index].copy() + ) + for index, key in enumerate(descriptive_resultants): + recovered[key] = ( + float(resultant_values[index]) + if resultant_values.ndim == 1 + else resultant_values[:, index].copy() + ) + if stations is not None: + recovered["station_coordinates"] = np.asarray( + stations, + dtype=float, + ).copy() + return recovered + + +def _beam_flow_scale(material: Any, curve: Any) -> float: + """Scale a scalar hardening curve to the Hill longitudinal strength X. + + With no curve, the returned value is the constant perfect-plastic flow + stress. Otherwise it multiplies the curve so ``flow_stress(0) == X``. + """ + + if _elastic_symmetry(material) != "orthotropic": + return 1.0 + hill_yield = getattr(material, "hill_yield", None) + if hill_yield is None: + raise ValueError( + f"Orthotropic material {getattr(material, 'name', '')!r} " + "requires hill_yield for beam fiber plasticity." + ) + if curve is None: + return float(hill_yield.X) + reference = float(np.asarray(curve.flow_stress(np.array([0.0])), dtype=float)[0]) + if not np.isfinite(reference) or reference <= 0.0: + raise ValueError("hardening curve must provide a positive initial flow stress") + return float(hill_yield.X) / reference + + +def _rotation_vector_from_matrix(rotation: np.ndarray) -> np.ndarray: + """Return the axis-angle rotation vector for a proper 3x3 rotation matrix.""" + R = np.asarray(rotation, dtype=float).reshape(3, 3) + trace_value = float(np.trace(R)) + cos_angle = max(min((trace_value - 1.0) / 2.0, 1.0), -1.0) + angle = float(np.arccos(cos_angle)) + if angle < 1.0e-12: + return 0.5 * np.array( + [R[2, 1] - R[1, 2], R[0, 2] - R[2, 0], R[1, 0] - R[0, 1]], + dtype=float, + ) + if abs(np.pi - angle) < 1.0e-6: + axis = np.sqrt(np.maximum(np.diag(R) + 1.0, 0.0) / 2.0) + if R[2, 1] - R[1, 2] < 0.0: + axis[0] *= -1.0 + if R[0, 2] - R[2, 0] < 0.0: + axis[1] *= -1.0 + if R[1, 0] - R[0, 1] < 0.0: + axis[2] *= -1.0 + norm = float(np.linalg.norm(axis)) + if norm <= _SMALL: + return np.zeros(3, dtype=float) + return angle * axis / norm + axis = np.array( + [R[2, 1] - R[1, 2], R[0, 2] - R[2, 0], R[1, 0] - R[0, 1]], + dtype=float, + ) / (2.0 * np.sin(angle)) + return angle * axis + + +_STRICT_FLAT_S3_V2_CANDIDATE_ID = "CANDIDATE_E4_PL_S3_V2A_FLAT_LINEAR_V1" +_STRICT_FLAT_S3_V2B_CANDIDATE_ID = "CANDIDATE_E4_PL_S3_V2B_FLAT_LINEAR_V1" +_STRICT_FLAT_S3_V2C_CANDIDATE_ID = "CANDIDATE_E4_PL_S3_V2C_FLAT_LINEAR_PARITY_V1" +_S3_V2D_NATIVE_PARITY_CANDIDATE_ID = "CANDIDATE_E4_PL_S3_V2D_NATIVE_PARITY_V1" + + +def _reject_strict_flat_s3_v2_legacy_dispatch( + element: Any, operation: str +) -> None: + if ( + getattr(type(element), "_legacy_shell_dispatch_forbidden", None) + in { + _STRICT_FLAT_S3_V2_CANDIDATE_ID, + _STRICT_FLAT_S3_V2B_CANDIDATE_ID, + _STRICT_FLAT_S3_V2C_CANDIDATE_ID, + _S3_V2D_NATIVE_PARITY_CANDIDATE_ID, + } + ): + from .element_capabilities import ElementCapabilityError + + raise ElementCapabilityError( + "strict-flat S3 V2 forbids explicit legacy ShellElement dispatch: " + + operation + ) + + +class Element(ABC): + """Abstract base class for all FE elements.""" + + def __init__(self, element_id: int, node_ids: List[int], material_name: str = "default"): + self.element_id = element_id + self.node_ids = node_ids + self.material_name = material_name + self._stiffness_matrix: Optional[np.ndarray] = None + self._mass_matrix: Optional[np.ndarray] = None + self._internal_forces: Optional[np.ndarray] = None + + def __deepcopy__(self, memo: Dict[int, Any]) -> "Element": + """Copy instance state without asking ``copyreg`` about the class. + + The generic ``copy.deepcopy`` reconstruction path may lazily add a + ``__slotnames__`` cache to a class. Element class namespaces are part + of the qualified Q4/S3 runtime authority, so even copying a legacy + element must not mutate them. Build the uninitialised instance + directly, copy its instance dictionary, and explicitly copy any slots + declared anywhere in a concrete subclass hierarchy. + """ + + _reject_strict_flat_s3_v2_legacy_dispatch(self, "Element.__deepcopy__") + source_id = id(self) + if source_id in memo: + return memo[source_id] + + cls = type(self) + made = object.__new__(cls) + memo[source_id] = made + + try: + source_namespace = object.__getattribute__(self, "__dict__") + target_namespace = object.__getattribute__(made, "__dict__") + except AttributeError: + source_namespace = None + target_namespace = None + if source_namespace is not None and target_namespace is not None: + for name, value in source_namespace.items(): + target_namespace[name] = copy.deepcopy(value, memo) + + for owner in type.__getattribute__(cls, "__mro__"): + namespace = type.__getattribute__(owner, "__dict__") + for slot_name, descriptor in namespace.items(): + if type(descriptor) is not MemberDescriptorType: + continue + try: + value = object.__getattribute__(self, slot_name) + except AttributeError: + continue + object.__setattr__(made, slot_name, copy.deepcopy(value, memo)) + return made + + @property + @abstractmethod + def num_nodes(self) -> int: + raise NotImplementedError + + @property + @abstractmethod + def dofs_per_node(self) -> int: + raise NotImplementedError + + @property + def total_dofs(self) -> int: + return self.num_nodes * self.dofs_per_node + + @abstractmethod + def get_node_coordinates(self, mesh: "FEMesh") -> np.ndarray: + raise NotImplementedError + + @abstractmethod + def compute_stiffness_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: + raise NotImplementedError + + def compute_mass_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: + _reject_strict_flat_s3_v2_legacy_dispatch(self, "Element.compute_mass_matrix") + return np.zeros((self.total_dofs, self.total_dofs)) + + def compute_geometric_stiffness_matrix( + self, + mesh: "FEMesh", + material: "Material", + state: Optional[Any] = None, + ) -> np.ndarray: + _reject_strict_flat_s3_v2_legacy_dispatch( + self, "Element.compute_geometric_stiffness_matrix" + ) + return np.zeros((self.total_dofs, self.total_dofs)) + + def compute_internal_forces( + self, mesh: "FEMesh", displacements: np.ndarray, material: "Material" + ) -> np.ndarray: + _reject_strict_flat_s3_v2_legacy_dispatch( + self, "Element.compute_internal_forces" + ) + return np.zeros(self.total_dofs) + + def compute_nonlinear_response( + self, + mesh: "FEMesh", + material: "Material", + u_elem: np.ndarray, + state: Optional[Any] = None, + num_layers: int = 5, + tangent: bool = True, + ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: + """Internal force vector, tangent stiffness and trial state at u_elem. + + The default is linear elastic: F = K u with the constant stiffness as + tangent. Elements supporting geometric and/or material nonlinearity + override this. The returned state is a trial state; the incremental + solver commits it only when the load step converges. With + ``tangent=False`` the stiffness entry may be None (used by the line + search, which only needs residuals). + """ + _reject_strict_flat_s3_v2_legacy_dispatch( + self, "Element.compute_nonlinear_response" + ) + K = self._stiffness_matrix + if K is None: + K = self.compute_stiffness_matrix(mesh, material) + return K @ u_elem, (K if tangent else None), state + + def compute_stresses( + self, + mesh: "FEMesh", + displacements: np.ndarray, + material: "Material", + return_global: bool = False, + ) -> Dict[str, Any]: + _reject_strict_flat_s3_v2_legacy_dispatch(self, "Element.compute_stresses") + return {} + + def get_dof_mapping(self, mesh: "FEMesh") -> List[int]: + dof_mapping: List[int] = [] + for node_id in self.node_ids: + node = mesh.get_node(node_id) + if node: + dof_mapping.extend(node.dofs) + return dof_mapping + + def _get_element_displacements(self, mesh: "FEMesh", displacements: np.ndarray) -> np.ndarray: + u = np.asarray(displacements, dtype=float) + if u.size == self.total_dofs: + return u.copy() + dof_mapping = self.get_dof_mapping(mesh) + if not dof_mapping: + return np.zeros(self.total_dofs) + dof_indices = np.asarray(dof_mapping, dtype=np.intp) + if int(dof_indices.max()) >= u.size: + raise IndexError( + f"Displacement vector has length {u.size}, but element {self.element_id} " + f"requires global DOF {int(dof_indices.max())}." + ) + return u[dof_indices] + + def to_dict(self) -> Dict[str, Any]: + _reject_strict_flat_s3_v2_legacy_dispatch(self, "Element.to_dict") + return { + "element_id": self.element_id, + "type": self.__class__.__name__, + "node_ids": self.node_ids, + "material_name": self.material_name, + } + + +def _install_strict_flat_s3_v2_element_base_guards() -> None: + """Capture the V2 guard in Element routes exposed by explicit dispatch.""" + + from functools import wraps + from inspect import signature + + guard = _reject_strict_flat_s3_v2_legacy_dispatch + names = ( + "__deepcopy__", + "compute_mass_matrix", + "compute_geometric_stiffness_matrix", + "compute_internal_forces", + "compute_nonlinear_response", + "compute_stresses", + "to_dict", + ) + for name in names: + original = vars(Element)[name] + + @wraps(original) + def guarded( + self: Any, + *args: Any, + __name: str = name, + __original: Callable[..., Any] = original, + __guard: Callable[[Any, str], None] = guard, + **kwargs: Any, + ) -> Any: + __guard(self, f"Element.{__name}") + return __original(self, *args, **kwargs) + + guarded.__signature__ = signature(original) # type: ignore[attr-defined] + delattr(guarded, "__wrapped__") + setattr(Element, name, guarded) + + +_install_strict_flat_s3_v2_element_base_guards() +del _install_strict_flat_s3_v2_element_base_guards + + +@njit +def _jit_compute_4node_shape_functions(xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + N = np.array( + [ + 0.25 * (1.0 - xi) * (1.0 - eta), + 0.25 * (1.0 + xi) * (1.0 - eta), + 0.25 * (1.0 + xi) * (1.0 + eta), + 0.25 * (1.0 - xi) * (1.0 + eta), + ], + ) + dN_dxi = np.array( + [ + -0.25 * (1.0 - eta), + 0.25 * (1.0 - eta), + 0.25 * (1.0 + eta), + -0.25 * (1.0 + eta), + ], + ) + dN_deta = np.array( + [ + -0.25 * (1.0 - xi), + -0.25 * (1.0 + xi), + 0.25 * (1.0 + xi), + 0.25 * (1.0 - xi), + ], + ) + return N, dN_dxi, dN_deta + + +@njit +def _jit_compute_8node_shape_functions(xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + N = np.zeros(8, dtype=float) + N[0] = -0.25 * (1.0 - xi) * (1.0 - eta) * (1.0 + xi + eta) + N[1] = -0.25 * (1.0 + xi) * (1.0 - eta) * (1.0 - xi + eta) + N[2] = -0.25 * (1.0 + xi) * (1.0 + eta) * (1.0 - xi - eta) + N[3] = -0.25 * (1.0 - xi) * (1.0 + eta) * (1.0 + xi - eta) + N[4] = 0.5 * (1.0 - xi**2) * (1.0 - eta) + N[5] = 0.5 * (1.0 + xi) * (1.0 - eta**2) + N[6] = 0.5 * (1.0 - xi**2) * (1.0 + eta) + N[7] = 0.5 * (1.0 - xi) * (1.0 - eta**2) + + dN_dxi = np.zeros(8, dtype=float) + dN_dxi[0] = 0.25 * (1.0 - eta) * (1.0 + xi + eta) - 0.25 * (1.0 - xi) * (1.0 - eta) + dN_dxi[1] = -0.25 * (1.0 - eta) * (1.0 - xi + eta) + 0.25 * (1.0 + xi) * (1.0 - eta) + dN_dxi[2] = -0.25 * (1.0 + eta) * (1.0 - xi - eta) + 0.25 * (1.0 + xi) * (1.0 + eta) + dN_dxi[3] = 0.25 * (1.0 + eta) * (1.0 + xi - eta) - 0.25 * (1.0 - xi) * (1.0 + eta) + dN_dxi[4] = -xi * (1.0 - eta) + dN_dxi[5] = 0.5 * (1.0 - eta**2) + dN_dxi[6] = -xi * (1.0 + eta) + dN_dxi[7] = -0.5 * (1.0 - eta**2) + + dN_deta = np.zeros(8, dtype=float) + dN_deta[0] = 0.25 * (1.0 - xi) * (1.0 + xi + eta) - 0.25 * (1.0 - xi) * (1.0 - eta) + dN_deta[1] = 0.25 * (1.0 + xi) * (1.0 - xi + eta) - 0.25 * (1.0 + xi) * (1.0 - eta) + dN_deta[2] = -0.25 * (1.0 + xi) * (1.0 - xi - eta) + 0.25 * (1.0 + xi) * (1.0 + eta) + dN_deta[3] = -0.25 * (1.0 - xi) * (1.0 + xi - eta) + 0.25 * (1.0 - xi) * (1.0 + eta) + dN_deta[4] = -0.5 * (1.0 - xi**2) + dN_deta[5] = -eta * (1.0 + xi) + dN_deta[6] = 0.5 * (1.0 - xi**2) + dN_deta[7] = -eta * (1.0 - xi) + return N, dN_dxi, dN_deta + + +@njit +def _jit_compute_3node_shape_functions(r: float, s: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + N = np.array([1.0 - r - s, r, s]) + dN_dr = np.array([-1.0, 1.0, 0.0]) + dN_ds = np.array([-1.0, 0.0, 1.0]) + return N, dN_dr, dN_ds + + +@njit +def _jit_compute_6node_shape_functions(r: float, s: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + l1 = 1.0 - r - s + l2 = r + l3 = s + + N = np.zeros(6, dtype=float) + N[0] = l1 * (2.0 * l1 - 1.0) + N[1] = l2 * (2.0 * l2 - 1.0) + N[2] = l3 * (2.0 * l3 - 1.0) + N[3] = 4.0 * l1 * l2 + N[4] = 4.0 * l2 * l3 + N[5] = 4.0 * l3 * l1 + + dN_dr = np.zeros(6, dtype=float) + dN_dr[0] = 1.0 - 4.0 * l1 + dN_dr[1] = 4.0 * l2 - 1.0 + dN_dr[2] = 0.0 + dN_dr[3] = 4.0 * (l1 - l2) + dN_dr[4] = 4.0 * l3 + dN_dr[5] = -4.0 * l3 + + dN_ds = np.zeros(6, dtype=float) + dN_ds[0] = 1.0 - 4.0 * l1 + dN_ds[1] = 0.0 + dN_ds[2] = 4.0 * l3 - 1.0 + dN_ds[3] = -4.0 * l2 + dN_ds[4] = 4.0 * l2 + dN_ds[5] = 4.0 * (l1 - l3) + return N, dN_dr, dN_ds + + +@njit +def _jit_integrate_nonlinear_response( + u_loc: np.ndarray, + N_res: np.ndarray, + M_res: np.ndarray, + C0: np.ndarray, + C1: np.ndarray, + C2: np.ndarray, + B_m_all: np.ndarray, + B_b_all: np.ndarray, + B_d_all: np.ndarray, + Gw_all: np.ndarray, + detw_all: np.ndarray, + B_s_all: np.ndarray, + detw_shear_all: np.ndarray, + D_shear: np.ndarray, + drilling_stiffness: float, + tangent: bool, + has_plasticity: bool, + n_dof: int, +) -> Tuple[np.ndarray, np.ndarray]: + F_loc = np.zeros(n_dof) + K_loc = np.zeros((n_dof, n_dof)) + + n_gp = len(detw_all) + for g in range(n_gp): + detw = detw_all[g] + B_m = B_m_all[g] + B_b = B_b_all[g] + B_d = B_d_all[g] + Gw = Gw_all[g] + + # Calculate theta = Gw @ u_loc + theta_0 = 0.0 + theta_1 = 0.0 + for i in range(n_dof): + theta_0 += Gw[0, i] * u_loc[i] + theta_1 += Gw[1, i] * u_loc[i] + + # Calculate B_eff = B_m + B_nl + B_eff = np.zeros((3, n_dof)) + for i in range(n_dof): + B_eff[0, i] = B_m[0, i] + theta_0 * Gw[0, i] + B_eff[1, i] = B_m[1, i] + theta_1 * Gw[1, i] + B_eff[2, i] = B_m[2, i] + theta_0 * Gw[1, i] + theta_1 * Gw[0, i] + + # B_eff.T @ N_res[g] + B_b.T @ M_res[g] + N_g = N_res[g] + M_g = M_res[g] + B_eff_T_N = np.zeros(n_dof) + B_b_T_M = np.zeros(n_dof) + for i in range(n_dof): + B_eff_T_N[i] = B_eff[0, i] * N_g[0] + B_eff[1, i] * N_g[1] + B_eff[2, i] * N_g[2] + B_b_T_M[i] = B_b[0, i] * M_g[0] + B_b[1, i] * M_g[1] + B_b[2, i] * M_g[2] + + # B_d @ u_loc + Bd_u = 0.0 + for i in range(n_dof): + Bd_u += B_d[0, i] * u_loc[i] + + for i in range(n_dof): + F_loc[i] += (B_eff_T_N[i] + B_b_T_M[i]) * detw + F_loc[i] += B_d[0, i] * (drilling_stiffness * Bd_u) * detw + + if not tangent: + continue + + # K_loc += (B_eff.T @ C0[g] @ B_eff + B_b.T @ C2[g] @ B_b) * detw + C0_g = C0[g] + C2_g = C2[g] + + C0_B_eff = np.zeros((3, n_dof)) + C2_B_b = np.zeros((3, n_dof)) + for r in range(3): + for c in range(n_dof): + val0 = 0.0 + val2 = 0.0 + for k in range(3): + val0 += C0_g[r, k] * B_eff[k, c] + val2 += C2_g[r, k] * B_b[k, c] + C0_B_eff[r, c] = val0 + C2_B_b[r, c] = val2 + + for r in range(n_dof): + for c in range(n_dof): + val_eff = 0.0 + val_b = 0.0 + for k in range(3): + val_eff += B_eff[k, r] * C0_B_eff[k, c] + val_b += B_b[k, r] * C2_B_b[k, c] + K_loc[r, c] += (val_eff + val_b) * detw + + if has_plasticity: + # Membrane-bending coupling: + # B_eff.T @ C1 @ B_b + B_b.T @ C1.T @ B_eff. + # Layered material tangents make C1 symmetric, while a general + # pre-integrated section may legitimately supply a non-symmetric + # B coupling block in the symmetric [[A, B], [B.T, D]] law. + C1_g = C1[g] + C1_B_b = np.zeros((3, n_dof)) + C1_T_B_eff = np.zeros((3, n_dof)) + for r in range(3): + for c in range(n_dof): + val_b = 0.0 + val_eff = 0.0 + for k in range(3): + val_b += C1_g[r, k] * B_b[k, c] + val_eff += C1_g[k, r] * B_eff[k, c] + C1_B_b[r, c] = val_b + C1_T_B_eff[r, c] = val_eff + + for r in range(n_dof): + for c in range(n_dof): + forward = 0.0 + reverse = 0.0 + for k in range(3): + forward += B_eff[k, r] * C1_B_b[k, c] + reverse += B_b[k, r] * C1_T_B_eff[k, c] + K_loc[r, c] += (forward + reverse) * detw + + # Geometric initial stress stiffness + N00 = N_g[0] + N11 = N_g[1] + N01 = N_g[2] + + N_Gw_0 = N00 * Gw[0] + N01 * Gw[1] + N_Gw_1 = N01 * Gw[0] + N11 * Gw[1] + for r in range(n_dof): + for c in range(n_dof): + K_loc[r, c] += (Gw[0, r] * N_Gw_0[c] + Gw[1, r] * N_Gw_1[c]) * detw + K_loc[r, c] += B_d[0, r] * (drilling_stiffness * B_d[0, c]) * detw + + # Shear stiffness and force contribution + for g in range(len(detw_shear_all)): + detw_s = detw_shear_all[g] + B_s = B_s_all[g] + + # F_loc += K_s @ u_loc + Bs_u_0 = 0.0 + Bs_u_1 = 0.0 + for i in range(n_dof): + Bs_u_0 += B_s[0, i] * u_loc[i] + Bs_u_1 += B_s[1, i] * u_loc[i] + + f_s_0 = D_shear[0, 0] * Bs_u_0 + D_shear[0, 1] * Bs_u_1 + f_s_1 = D_shear[1, 0] * Bs_u_0 + D_shear[1, 1] * Bs_u_1 + + for i in range(n_dof): + F_loc[i] += (B_s[0, i] * f_s_0 + B_s[1, i] * f_s_1) * detw_s + + if not tangent: + continue + + # K_loc += K_s + C_s = np.zeros((2, n_dof)) + for r in range(2): + for c in range(n_dof): + C_s[r, c] = D_shear[r, 0] * B_s[0, c] + D_shear[r, 1] * B_s[1, c] + + for r in range(n_dof): + for c in range(n_dof): + K_loc[r, c] += (B_s[0, r] * C_s[0, c] + B_s[1, r] * C_s[1, c]) * detw_s + + return F_loc, K_loc + + +def _integrate_nonlinear_tangent_components( + u_loc: np.ndarray, + N_res: np.ndarray, + M_res: np.ndarray, + C0: np.ndarray, + C1: np.ndarray, + C2: np.ndarray, + B_m_all: np.ndarray, + B_b_all: np.ndarray, + B_d_all: np.ndarray, + Gw_all: np.ndarray, + detw_all: np.ndarray, + B_s_all: np.ndarray, + detw_shear_all: np.ndarray, + D_shear: np.ndarray, + drilling_stiffness: float, + has_membrane_bending_coupling: bool, + n_dof: int, +) -> Tuple[np.ndarray, np.ndarray]: + """Integrate constitutive and stress-Hessian tangents independently. + + The two calls deliberately reuse :func:`_jit_integrate_nonlinear_response` + rather than recovering one component as ``total - other``. The material + call carries the exact current algorithmic moduli, transverse shear and + drilling terms with zero resultants. The geometric call carries the exact + tension-positive membrane resultants with every constitutive/numerical + modulus set to zero. Consequently both pieces use the same Gauss order, + von-Karman ``B_eff`` construction and arithmetic kernel as the ordinary + nonlinear tangent. + """ + + zero_resultants = np.zeros_like(np.asarray(N_res, dtype=float)) + _unused_force, material = _jit_integrate_nonlinear_response( + np.asarray(u_loc, dtype=float), + zero_resultants, + np.zeros_like(np.asarray(M_res, dtype=float)), + np.asarray(C0, dtype=float), + np.asarray(C1, dtype=float), + np.asarray(C2, dtype=float), + np.asarray(B_m_all, dtype=float), + np.asarray(B_b_all, dtype=float), + np.asarray(B_d_all, dtype=float), + np.asarray(Gw_all, dtype=float), + np.asarray(detw_all, dtype=float), + np.asarray(B_s_all, dtype=float), + np.asarray(detw_shear_all, dtype=float), + np.asarray(D_shear, dtype=float), + float(drilling_stiffness), + True, + bool(has_membrane_bending_coupling), + int(n_dof), + ) + zero_C0 = np.zeros_like(np.asarray(C0, dtype=float)) + zero_C1 = np.zeros_like(np.asarray(C1, dtype=float)) + zero_C2 = np.zeros_like(np.asarray(C2, dtype=float)) + zero_shear = np.zeros_like(np.asarray(D_shear, dtype=float)) + _unused_force, geometric = _jit_integrate_nonlinear_response( + np.asarray(u_loc, dtype=float), + np.asarray(N_res, dtype=float), + np.asarray(M_res, dtype=float), + zero_C0, + zero_C1, + zero_C2, + np.asarray(B_m_all, dtype=float), + np.asarray(B_b_all, dtype=float), + np.asarray(B_d_all, dtype=float), + np.asarray(Gw_all, dtype=float), + np.asarray(detw_all, dtype=float), + np.asarray(B_s_all, dtype=float), + np.asarray(detw_shear_all, dtype=float), + zero_shear, + 0.0, + True, + False, + int(n_dof), + ) + return material, geometric + + +class ShellElement(Element): + """3/6-node triangular and 4/8-node quadrilateral Mindlin-Reissner shell element.""" + + TRI_GAUSS_POINTS_1 = _immutable_float64_array( + [[1.0 / 3.0, 1.0 / 3.0]] + ) + TRI_GAUSS_WEIGHTS_1 = _immutable_float64_array([0.5]) + + TRI_GAUSS_POINTS_3 = _immutable_float64_array( + [[1.0 / 6.0, 1.0 / 6.0], [2.0 / 3.0, 1.0 / 6.0], [1.0 / 6.0, 2.0 / 3.0]], + ) + TRI_GAUSS_WEIGHTS_3 = _immutable_float64_array( + [1.0 / 6.0, 1.0 / 6.0, 1.0 / 6.0] + ) + + _DUNAVANT_A1 = 0.059715871789770 + _DUNAVANT_B1 = 0.470142064105115 + _DUNAVANT_A2 = 0.797426985353087 + _DUNAVANT_B2 = 0.101286507323456 + TRI_GAUSS_POINTS_7 = _immutable_float64_array( + [ + [1.0 / 3.0, 1.0 / 3.0], + [_DUNAVANT_B1, _DUNAVANT_B1], + [_DUNAVANT_A1, _DUNAVANT_B1], + [_DUNAVANT_B1, _DUNAVANT_A1], + [_DUNAVANT_B2, _DUNAVANT_B2], + [_DUNAVANT_A2, _DUNAVANT_B2], + [_DUNAVANT_B2, _DUNAVANT_A2], + ], + ) + TRI_GAUSS_WEIGHTS_7 = _immutable_float64_array( + [ + 0.1125, + 0.066197076394253, + 0.066197076394253, + 0.066197076394253, + 0.062969590272414, + 0.062969590272414, + 0.062969590272414, + ], + ) + + GAUSS_POINTS_1x1 = _immutable_float64_array([[0.0, 0.0]]) + GAUSS_WEIGHTS_1x1 = _immutable_float64_array([4.0]) + + GAUSS_POINTS_2x2 = _immutable_float64_array( + np.asarray( + [[-1.0, -1.0], [1.0, -1.0], [-1.0, 1.0], [1.0, 1.0]], + dtype=np.float64, + ) + / np.sqrt(3.0) + ) + GAUSS_WEIGHTS_2x2 = _immutable_float64_array(np.ones(4, dtype=np.float64)) + + GAUSS_POINTS_3x3 = _immutable_float64_array( + [ + [-np.sqrt(3.0 / 5.0), -np.sqrt(3.0 / 5.0)], + [0.0, -np.sqrt(3.0 / 5.0)], + [np.sqrt(3.0 / 5.0), -np.sqrt(3.0 / 5.0)], + [-np.sqrt(3.0 / 5.0), 0.0], + [0.0, 0.0], + [np.sqrt(3.0 / 5.0), 0.0], + [-np.sqrt(3.0 / 5.0), np.sqrt(3.0 / 5.0)], + [0.0, np.sqrt(3.0 / 5.0)], + [np.sqrt(3.0 / 5.0), np.sqrt(3.0 / 5.0)], + ], + ) + GAUSS_WEIGHTS_3x3 = _immutable_float64_array( + [ + 25.0 / 81.0, + 40.0 / 81.0, + 25.0 / 81.0, + 40.0 / 81.0, + 64.0 / 81.0, + 40.0 / 81.0, + 25.0 / 81.0, + 40.0 / 81.0, + 25.0 / 81.0, + ], + ) + + def __init__( + self, + element_id: int, + node_ids: List[int], + material_name: str = "default", + thickness: float = 0.01, + drilling_stabilization: float = 1.0e-3, + reduced_integration: bool = False, + hourglass_stabilization: float = 1.0e-8, + material_direction: Optional[np.ndarray] = None, + material_angle_deg: float = 0.0, + shell_section: Optional[Any] = None, + ): + super().__init__(element_id, node_ids, material_name) + if len(set(node_ids)) != len(node_ids): + raise ValueError(f"Shell element {element_id} has repeated node ids") + if self.__class__ is ShellElement and len(node_ids) == 4: + warnings.warn( + "Legacy four-node ShellElement is a temporary rollback path; " + "use create_shell_element() or QualifiedE4PLShellElement. The " + "legacy Q4 implementation is available through the 0.4.x " + "burn-in line and is scheduled for removal no earlier than 0.5.0.", + LegacyQ4DeprecationWarning, + stacklevel=2, + ) + self.thickness = float(thickness) + self.drilling_stabilization = float(drilling_stabilization) + self.reduced_integration = reduced_integration + self.hourglass_stabilization = float(hourglass_stabilization) + self.material_angle_deg = float(material_angle_deg) + if not np.isfinite(self.material_angle_deg): + raise ValueError("material_angle_deg must be finite") + if material_direction is None: + self.material_direction = None + else: + direction = np.asarray(material_direction, dtype=float).reshape(-1) + if direction.size != 3 or not np.all(np.isfinite(direction)): + raise ValueError("material_direction must be a finite 3-vector") + if float(np.linalg.norm(direction)) <= _SMALL: + raise ValueError("material_direction must be non-zero") + self.material_direction = direction.copy() + self.shell_section = coerce_generalized_shell_section(shell_section) + self._is_3node = len(node_ids) == 3 + self._is_6node = len(node_ids) == 6 + self._is_8node = len(node_ids) == 8 + self._is_4node = len(node_ids) == 4 + self._is_triangular = self._is_3node or self._is_6node + self._is_quadrilateral = self._is_4node or self._is_8node + if not (self._is_triangular or self._is_quadrilateral): + raise ValueError(f"ShellElement requires 3, 4, 6 or 8 nodes, got {len(node_ids)}") + + def _material_angle(self, local_frame: np.ndarray) -> float: + """Material 1-axis angle in the supplied element-local frame.""" + + angle = np.deg2rad(self.material_angle_deg) + if self.material_direction is None: + return float(angle) + frame = np.asarray(local_frame, dtype=float).reshape(3, 3) + direction = np.asarray(self.material_direction, dtype=float) + components = np.array( + [float(np.dot(direction, frame[:, 0])), float(np.dot(direction, frame[:, 1]))], + dtype=float, + ) + norm = float(np.linalg.norm(components)) + if norm <= 1.0e-10 * max(float(np.linalg.norm(direction)), 1.0): + raise ValueError( + f"Shell element {self.element_id} material_direction is parallel to " + "the shell normal and cannot define an in-plane material axis." + ) + return float(np.arctan2(components[1], components[0]) + angle) + + def _generalized_section_in_frame( + self, + local_frame: np.ndarray, + ) -> Optional[GeneralizedShellSection]: + """Return the pre-integrated section rotated into shell-local axes.""" + + if self.shell_section is None: + return None + return self.shell_section.rotated(self._material_angle(local_frame)) + + def to_dict(self) -> Dict[str, Any]: + payload = super().to_dict() + payload.update( + { + "thickness": float(self.thickness), + "material_angle_deg": float(self.material_angle_deg), + "material_direction": ( + None + if self.material_direction is None + else np.asarray(self.material_direction, dtype=float).tolist() + ), + "shell_section": ( + None if self.shell_section is None else self.shell_section.to_dict() + ), + } + ) + return payload + + @property + def num_nodes(self) -> int: + return len(self.node_ids) + + @property + def dofs_per_node(self) -> int: + return 6 + + @property + def gauss_points(self) -> np.ndarray: + if self._is_3node: + return self.TRI_GAUSS_POINTS_3 + if self._is_6node: + return self.TRI_GAUSS_POINTS_7 + if self._is_8node and self.reduced_integration: + return self.GAUSS_POINTS_2x2 + return self.GAUSS_POINTS_3x3 if self._is_8node else self.GAUSS_POINTS_2x2 + + @property + def gauss_weights(self) -> np.ndarray: + if self._is_3node: + return self.TRI_GAUSS_WEIGHTS_3 + if self._is_6node: + return self.TRI_GAUSS_WEIGHTS_7 + if self._is_8node and self.reduced_integration: + return self.GAUSS_WEIGHTS_2x2 + return self.GAUSS_WEIGHTS_3x3 if self._is_8node else self.GAUSS_WEIGHTS_2x2 + + @property + def shear_gauss_points(self) -> np.ndarray: + if self._is_3node: + return self.TRI_GAUSS_POINTS_1 + if self._is_6node: + return self.TRI_GAUSS_POINTS_3 + return self.GAUSS_POINTS_2x2 if self._is_8node else self.GAUSS_POINTS_1x1 + + @property + def shear_gauss_weights(self) -> np.ndarray: + if self._is_3node: + return self.TRI_GAUSS_WEIGHTS_1 + if self._is_6node: + return self.TRI_GAUSS_WEIGHTS_3 + return self.GAUSS_WEIGHTS_2x2 if self._is_8node else self.GAUSS_WEIGHTS_1x1 + + def get_node_coordinates(self, mesh: "FEMesh") -> np.ndarray: + coords = np.zeros((self.num_nodes, 3), dtype=float) + for i, node_id in enumerate(self.node_ids): + node = mesh.get_node(node_id) + if node is None: + raise ValueError(f"Shell element {self.element_id} references missing node {node_id}") + coords[i] = node.coords() + return coords + + def compute_shape_functions(self, xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + if self._is_3node: + return self._compute_3node_shape_functions(xi, eta) + if self._is_6node: + return self._compute_6node_shape_functions(xi, eta) + if self._is_4node: + return self._compute_4node_shape_functions(xi, eta) + return self._compute_8node_shape_functions(xi, eta) + + def _compute_3node_shape_functions(self, xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + return _jit_compute_3node_shape_functions(xi, eta) + + def _compute_4node_shape_functions(self, xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + return _jit_compute_4node_shape_functions(xi, eta) + + def _compute_6node_shape_functions(self, xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + return _jit_compute_6node_shape_functions(xi, eta) + + def _compute_8node_shape_functions(self, xi: float, eta: float) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + return _jit_compute_8node_shape_functions(xi, eta) + + def compute_jacobian(self, coords: np.ndarray, dN_dxi: np.ndarray, dN_deta: np.ndarray) -> np.ndarray: + return np.array([coords.T @ dN_dxi, coords.T @ dN_deta], dtype=float) + + @staticmethod + def _normalize(vector: np.ndarray) -> Tuple[np.ndarray, float]: + norm = float(np.sqrt(vector @ vector)) + if norm < _SMALL: + return np.zeros(3, dtype=float), norm + return vector / norm, norm + + def _fallback_edge_direction(self, coords: np.ndarray, normal: np.ndarray) -> np.ndarray: + candidate_edges = [] + if coords.shape[0] >= 2: + candidate_edges.append(coords[1] - coords[0]) + if coords.shape[0] >= 3: + candidate_edges.append(coords[2] - coords[0]) + candidate_edges.append(coords[2] - coords[1]) + if coords.shape[0] >= 4: + candidate_edges.append(coords[2] - coords[3]) + candidate_edges.append(coords[3] - coords[0]) + candidate_edges.append(coords[2] - coords[1]) + for edge in candidate_edges: + projected = edge - np.dot(edge, normal) * normal + e1, n = self._normalize(projected) + if n > _SMALL: + return e1 + raise ValueError(f"Shell element {self.element_id} has no valid in-plane direction") + + def _local_frame_and_derivatives( + self, + coords: np.ndarray, + dN_dxi: np.ndarray, + dN_deta: np.ndarray, + ) -> Tuple[np.ndarray, np.ndarray, np.ndarray, float]: + J = self.compute_jacobian(coords, dN_dxi, dN_deta) + tangent_xi = J[0] + tangent_eta = J[1] + e3, det_j = self._normalize(_cross3(tangent_xi, tangent_eta)) + if det_j < _SMALL: + raise ValueError(f"Shell element {self.element_id} has a near-zero surface Jacobian") + + e1_raw = tangent_xi - np.dot(tangent_xi, e3) * e3 + e1, e1_norm = self._normalize(e1_raw) + if e1_norm < _SMALL: + e1 = self._fallback_edge_direction(coords, e3) + e2, e2_norm = self._normalize(_cross3(e3, e1)) + if e2_norm < _SMALL: + raise ValueError(f"Shell element {self.element_id} has an invalid local y direction") + e1, _ = self._normalize(_cross3(e2, e3)) + R = np.column_stack((e1, e2, e3)) + + J_local = np.array( + [ + [np.dot(tangent_xi, e1), np.dot(tangent_xi, e2)], + [np.dot(tangent_eta, e1), np.dot(tangent_eta, e2)], + ], + dtype=float, + ) + try: + inv_j_local, _ = _inv2(J_local) + except np.linalg.LinAlgError as exc: + raise ValueError(f"Shell element {self.element_id} has a singular local Jacobian") from exc + + dN_dx = inv_j_local[0, 0] * dN_dxi + inv_j_local[0, 1] * dN_deta + dN_dy = inv_j_local[1, 0] * dN_dxi + inv_j_local[1, 1] * dN_deta + return R, dN_dx, dN_dy, det_j + + def _local_dof_transform(self, R: np.ndarray) -> np.ndarray: + n_blocks = 2 * self.num_nodes + T = np.zeros((self.total_dofs, self.total_dofs), dtype=float) + blocks = T.reshape(n_blocks, 3, n_blocks, 3) + indices = np.arange(n_blocks) + blocks[indices, :, indices, :] = R.T + return T + + def _build_shell_b_matrices( + self, + N: np.ndarray, + dN_dx: np.ndarray, + dN_dy: np.ndarray, + ) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + B_m = np.zeros((3, self.total_dofs), dtype=float) + B_b = np.zeros((3, self.total_dofs), dtype=float) + B_s = np.zeros((2, self.total_dofs), dtype=float) + + B_m[0, 0::6] = dN_dx + B_m[1, 1::6] = dN_dy + B_m[2, 0::6] = dN_dy + B_m[2, 1::6] = dN_dx + + B_b[0, 4::6] = dN_dx + B_b[1, 3::6] = -dN_dy + B_b[2, 4::6] = dN_dy + B_b[2, 3::6] = -dN_dx + + B_s[0, 2::6] = dN_dx + B_s[0, 4::6] = N + B_s[1, 2::6] = dN_dy + B_s[1, 3::6] = -N + return B_m, B_b, B_s + + def _build_drilling_b_matrix( + self, + N: np.ndarray, + dN_dx: np.ndarray, + dN_dy: np.ndarray, + ) -> np.ndarray: + """ + Build a small drilling stabilization strain. + + The stabilized quantity is theta_z - 0.5 * (dv/dx - du/dy), so a + physical rigid rotation about the shell normal has exactly zero energy. + """ + B_d = np.zeros((1, self.total_dofs), dtype=float) + B_d[0, 0::6] = 0.5 * dN_dy + B_d[0, 1::6] = -0.5 * dN_dx + B_d[0, 5::6] = N + return B_d + + def _reference_center(self) -> Tuple[float, float]: + if self._is_triangular: + return 1.0 / 3.0, 1.0 / 3.0 + return 0.0, 0.0 + + # MITC4 assumed natural transverse shear (4-node elements only). + # + # Covariant shear strains are sampled where they are exact for pure + # bending, at the edge midpoints A(0,-1), B(1,0), C(0,1), D(-1,0): + # + # gamma_xi(xi, eta) = (1-eta)/2 * gamma_xi|A + (1+eta)/2 * gamma_xi|C + # gamma_eta(xi, eta) = (1-xi)/2 * gamma_eta|D + (1+xi)/2 * gamma_eta|B + # + # with gamma_xi = dw/dxi + x_,xi * theta_y - y_,xi * theta_x in a fixed + # element-plane frame, then mapped to Cartesian shear through the inverse + # in-plane Jacobian at the integration point. The element geometry is + # treated as a flat facet in the frame evaluated at the element centre. + _MITC4_SAMPLE_POINTS = {"A": (0.0, -1.0), "B": (1.0, 0.0), "C": (0.0, 1.0), "D": (-1.0, 0.0)} + + def _center_frame(self, coords: np.ndarray) -> np.ndarray: + xi, eta = self._reference_center() + _, dN_dxi, dN_deta = self.compute_shape_functions(xi, eta) + R, _, _, _ = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) + return R + + def _tri3_assumed_shear_b_matrix(self, coords: np.ndarray, R: np.ndarray) -> Tuple[np.ndarray, float]: + """ + Constant assumed-shear field for the 3-node triangle. + + The row space is evaluated in the centroid frame and integrated once + over the triangular area. This is the constant shear-gap part used by + DSG3/MITC3-style triangles: rigid rotations satisfy + ``dw/dx + theta_y = 0`` and ``dw/dy - theta_x = 0`` exactly, while a + constant transverse-shear patch is reproduced without the locking-prone + fully integrated linear Mindlin shear interpolation. + """ + if not self._is_3node: + raise ValueError("_tri3_assumed_shear_b_matrix is only valid for 3-node shells") + planar = coords @ R[:, :2] + r, s = self._reference_center() + N, dN_dr, dN_ds = self.compute_shape_functions(r, s) + J2 = np.array( + [ + [float(dN_dr @ planar[:, 0]), float(dN_dr @ planar[:, 1])], + [float(dN_ds @ planar[:, 0]), float(dN_ds @ planar[:, 1])], + ], + dtype=float, + ) + try: + inv_j2, det_j = _inv2(J2) + except np.linalg.LinAlgError as exc: + raise ValueError(f"Shell element {self.element_id} has a singular triangular shear Jacobian") from exc + dN_dx = inv_j2[0, 0] * dN_dr + inv_j2[0, 1] * dN_ds + dN_dy = inv_j2[1, 0] * dN_dr + inv_j2[1, 1] * dN_ds + _, _, B_s = self._build_shell_b_matrices(N, dN_dx, dN_dy) + return B_s, abs(float(det_j)) + + def _mitc4_shear_samples(self, coords: np.ndarray, R: np.ndarray) -> Tuple[np.ndarray, Dict[str, Tuple[np.ndarray, np.ndarray]]]: + """Return in-plane node coordinates and covariant shear rows at A-D.""" + planar = coords @ R[:, :2] + samples: Dict[str, Tuple[np.ndarray, np.ndarray]] = {} + for name, (xi, eta) in self._MITC4_SAMPLE_POINTS.items(): + N, dN_dxi, dN_deta = self.compute_shape_functions(xi, eta) + x_xi = float(dN_dxi @ planar[:, 0]) + y_xi = float(dN_dxi @ planar[:, 1]) + x_eta = float(dN_deta @ planar[:, 0]) + y_eta = float(dN_deta @ planar[:, 1]) + row_xi = np.zeros(self.total_dofs, dtype=float) + row_eta = np.zeros(self.total_dofs, dtype=float) + row_xi[2::6] = dN_dxi + row_xi[3::6] = -N * y_xi + row_xi[4::6] = N * x_xi + row_eta[2::6] = dN_deta + row_eta[3::6] = -N * y_eta + row_eta[4::6] = N * x_eta + samples[name] = (row_xi, row_eta) + return planar, samples + + def _mitc4_shear_b_matrix( + self, + planar: np.ndarray, + samples: Dict[str, Tuple[np.ndarray, np.ndarray]], + xi: float, + eta: float, + ) -> Tuple[np.ndarray, float]: + """Assumed-shear B matrix (local Cartesian) and in-plane Jacobian det.""" + _, dN_dxi, dN_deta = self.compute_shape_functions(xi, eta) + J2 = np.array( + [ + [float(dN_dxi @ planar[:, 0]), float(dN_dxi @ planar[:, 1])], + [float(dN_deta @ planar[:, 0]), float(dN_deta @ planar[:, 1])], + ], + dtype=float, + ) + try: + inv_j2, det_j = _inv2(J2) + except np.linalg.LinAlgError as exc: + raise ValueError(f"Shell element {self.element_id} has a singular in-plane Jacobian") from exc + B_covariant = np.vstack( + [ + 0.5 * (1.0 - eta) * samples["A"][0] + 0.5 * (1.0 + eta) * samples["C"][0], + 0.5 * (1.0 - xi) * samples["D"][1] + 0.5 * (1.0 + xi) * samples["B"][1], + ] + ) + return inv_j2 @ B_covariant, det_j + + def _rigid_body_mode_matrix(self, coords: np.ndarray) -> np.ndarray: + modes = np.zeros((self.total_dofs, 6), dtype=float) + centroid = np.mean(coords, axis=0) + axes = np.eye(3, dtype=float) + + for local, coord in enumerate(coords): + base = local * 6 + r = coord - centroid + modes[base + 0, 0] = 1.0 + modes[base + 1, 1] = 1.0 + modes[base + 2, 2] = 1.0 + for axis_index, axis in enumerate(axes): + displacement = _cross3(axis, r) + modes[base : base + 3, 3 + axis_index] = displacement + modes[base + 3 : base + 6, 3 + axis_index] = axis + + q, rmat = np.linalg.qr(modes) + diag = np.abs(np.diag(rmat)) + if diag.size == 0: + return np.zeros((self.total_dofs, 0), dtype=float) + keep = diag > max(float(np.max(diag)) * 1.0e-10, _SMALL) + return q[:, keep] + + def _hourglass_stabilization_matrix(self, K_base: np.ndarray, coords: np.ndarray) -> np.ndarray: + """Small stiffness on non-rigid zero modes outside rigid motion.""" + coefficient = float(getattr(self, "hourglass_stabilization", 0.0)) + stabilized_topology = (self._is_8node and self.reduced_integration) or self._is_triangular + if not stabilized_topology or coefficient <= 0.0: + return np.zeros_like(K_base) + + K_sym = 0.5 * (K_base + K_base.T) + eigvals, eigvecs = np.linalg.eigh(K_sym) + max_eig = max(float(np.max(np.abs(eigvals))), 1.0) + zero_tol = 1.0e-9 * max_eig + zero_mask = np.abs(eigvals) < zero_tol + if int(np.sum(zero_mask)) <= 6: + return np.zeros_like(K_base) + + zero_space = eigvecs[:, zero_mask] + rigid = self._rigid_body_mode_matrix(coords) + if rigid.size: + zero_space = zero_space - rigid @ (rigid.T @ zero_space) + + u, singular_values, _ = np.linalg.svd(zero_space, full_matrices=False) + if singular_values.size == 0: + return np.zeros_like(K_base) + keep = singular_values > 1.0e-8 + if not np.any(keep): + return np.zeros_like(K_base) + + hourglass_modes = u[:, keep] + stiffness_scale = coefficient * max_eig + K_hg = stiffness_scale * (hourglass_modes @ hourglass_modes.T) + return 0.5 * (K_hg + K_hg.T) + + def compute_stiffness_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: + coords = self.get_node_coordinates(mesh) + generalized_section = self.shell_section is not None + h = self.thickness + if generalized_section: + drilling_modulus = None + else: + _elastic_symmetry(material) + compliance = _elastic_compliance(material) + drilling_modulus = 1.0 / float(compliance[5, 5]) + + K = np.zeros((self.total_dofs, self.total_dofs), dtype=float) + + for (xi, eta), weight in zip(self.gauss_points, self.gauss_weights): + N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) + R, dN_dx, dN_dy, det_j = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) + T = self._local_dof_transform(R) + B_m, B_b, _ = self._build_shell_b_matrices(N, dN_dx, dN_dy) + B_d = self._build_drilling_b_matrix(N, dN_dx, dN_dy) + if generalized_section: + section_local = self._generalized_section_in_frame(R) + assert section_local is not None + K_local = ( + B_m.T @ section_local.A @ B_m + + B_m.T @ section_local.B @ B_b + + B_b.T @ section_local.B.T @ B_m + + B_b.T @ section_local.D @ B_b + ) * det_j * weight + drilling_stiffness = ( + float(section_local.A[2, 2]) + * getattr(self, "drilling_stabilization", 1.0e-3) + ) + else: + Q_local, _G_local, _strain_transform, _stress_transform = ( + _shell_material_matrices( + material, + self._material_angle(R), + ) + ) + D_membrane = h * Q_local + D_bending = h**3 / 12.0 * Q_local + K_local = ( + B_m.T @ D_membrane @ B_m + + B_b.T @ D_bending @ B_b + ) * det_j * weight + drilling_stiffness = ( + float(drilling_modulus) + * h + * getattr(self, "drilling_stabilization", 1.0e-3) + ) + K_local += (B_d.T @ (drilling_stiffness * np.eye(1)) @ B_d) * det_j * weight + K += T.T @ K_local @ T + + if self._is_4node: + R = self._center_frame(coords) + if generalized_section: + section_local = self._generalized_section_in_frame(R) + assert section_local is not None + D_shear = section_local.As + else: + _Q_local, G_local, _strain_transform, _stress_transform = ( + _shell_material_matrices( + material, + self._material_angle(R), + ) + ) + D_shear = (5.0 / 6.0) * h * G_local + T = self._local_dof_transform(R) + planar, samples = self._mitc4_shear_samples(coords, R) + for (xi, eta), weight in zip(self.GAUSS_POINTS_2x2, self.GAUSS_WEIGHTS_2x2): + B_s, det_j = self._mitc4_shear_b_matrix(planar, samples, float(xi), float(eta)) + K_local = (B_s.T @ D_shear @ B_s) * det_j * weight + K += T.T @ K_local @ T + elif self._is_3node: + R = self._center_frame(coords) + if generalized_section: + section_local = self._generalized_section_in_frame(R) + assert section_local is not None + D_shear = section_local.As + else: + _Q_local, G_local, _strain_transform, _stress_transform = ( + _shell_material_matrices( + material, + self._material_angle(R), + ) + ) + D_shear = (5.0 / 6.0) * h * G_local + T = self._local_dof_transform(R) + B_s, det_j = self._tri3_assumed_shear_b_matrix(coords, R) + K_local = (B_s.T @ D_shear @ B_s) * det_j * float(np.sum(self.shear_gauss_weights)) + K += T.T @ K_local @ T + else: + for (xi, eta), weight in zip(self.shear_gauss_points, self.shear_gauss_weights): + N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) + R, dN_dx, dN_dy, det_j = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) + if generalized_section: + section_local = self._generalized_section_in_frame(R) + assert section_local is not None + D_shear = section_local.As + else: + _Q_local, G_local, _strain_transform, _stress_transform = ( + _shell_material_matrices( + material, + self._material_angle(R), + ) + ) + D_shear = (5.0 / 6.0) * h * G_local + T = self._local_dof_transform(R) + _, _, B_s = self._build_shell_b_matrices(N, dN_dx, dN_dy) + K_local = (B_s.T @ D_shear @ B_s) * det_j * weight + K += T.T @ K_local @ T + + self._hourglass_stiffness_matrix = self._hourglass_stabilization_matrix(K, coords) + K += self._hourglass_stiffness_matrix + + self._stiffness_matrix = K + return K + + def compute_mass_matrix( + self, + mesh: "FEMesh", + material: "Material", + *, + _qualified_runtime_post_observation: Optional[Callable[[], None]] = None, + ) -> np.ndarray: + coords = self.get_node_coordinates(mesh) + raw_density = _guarded_observe_attribute( + material, + "density", + post_observation=_qualified_runtime_post_observation, + ) + rho = _guarded_float( + raw_density, + post_observation=_qualified_runtime_post_observation, + ) + h = self.thickness + section_mass = ( + None + if self.shell_section is None + else _guarded_observe_attribute( + self.shell_section, + "mass_per_area", + post_observation=_qualified_runtime_post_observation, + ) + ) + mass_per_area = ( + _guarded_float( + section_mass, + post_observation=_qualified_runtime_post_observation, + ) + if section_mass is not None + else rho * h + ) + section_rotary_inertia = ( + None + if self.shell_section is None + else _guarded_observe_attribute( + self.shell_section, + "rotary_inertia_per_area", + post_observation=_qualified_runtime_post_observation, + ) + ) + rotary_inertia_per_area = ( + _guarded_float( + section_rotary_inertia, + post_observation=_qualified_runtime_post_observation, + ) + if section_rotary_inertia is not None + else rho * h**3 / 12.0 + ) + M = np.zeros((self.total_dofs, self.total_dofs), dtype=float) + if self._is_8node and self.reduced_integration: + area = 0.0 + for (xi, eta), weight in zip(self.gauss_points, self.gauss_weights): + _N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) + _R, _dN_dx, _dN_dy, det_j = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) + area += float(det_j) * float(weight) + translational = mass_per_area * max(area, 0.0) / max(self.num_nodes, 1) + rotational = ( + rotary_inertia_per_area + * max(area, 0.0) + / max(self.num_nodes, 1) + ) + for i in range(self.num_nodes): + base = 6 * i + M[base + 0, base + 0] = translational + M[base + 1, base + 1] = translational + M[base + 2, base + 2] = translational + M[base + 3, base + 3] = rotational + M[base + 4, base + 4] = rotational + M[base + 5, base + 5] = rotational + self._mass_matrix = M + return M + for (xi, eta), weight in zip(self.gauss_points, self.gauss_weights): + N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) + R, _, _, det_j = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) + T = self._local_dof_transform(R) + M_local = np.zeros_like(M) + outer_n = np.outer(N, N) * det_j * weight + translational = mass_per_area * outer_n + rotational = rotary_inertia_per_area * outer_n + for d in range(3): + M_local[d::6, d::6] += translational + M_local[3 + d::6, 3 + d::6] += rotational + M += T.T @ M_local @ T + self._mass_matrix = M + return M + + @staticmethod + def _membrane_compression_from_state(state: Optional[Any]) -> Tuple[float, float, float]: + """Return local membrane resultants with compression-positive convention.""" + if state is None or not isinstance(state, dict): + return 0.0, 0.0, 0.0 + + if "membrane_compression" in state: + values = np.asarray(state["membrane_compression"], dtype=float).reshape(-1) + if values.size >= 3: + return float(values[0]), float(values[1]), float(values[2]) + if "membrane_forces" in state: + values = np.asarray(state["membrane_forces"], dtype=float).reshape(-1) + if values.size >= 3: + return -float(values[0]), -float(values[1]), -float(values[2]) + + compression_x = state.get("membrane_compression_x", state.get("Nx_compression")) + compression_y = state.get("membrane_compression_y", state.get("Ny_compression")) + compression_xy = state.get("membrane_compression_xy", state.get("Nxy_compression")) + if compression_x is not None or compression_y is not None or compression_xy is not None: + return ( + float(compression_x or 0.0), + float(compression_y or 0.0), + float(compression_xy or 0.0), + ) + + force_x = state.get("membrane_force_x", state.get("Nx")) + force_y = state.get("membrane_force_y", state.get("Ny")) + force_xy = state.get("membrane_force_xy", state.get("Nxy")) + return ( + -float(force_x or 0.0), + -float(force_y or 0.0), + -float(force_xy or 0.0), + ) + + @classmethod + def _membrane_compression_samples( + cls, + state: Optional[Any], + count: int, + ) -> np.ndarray: + """Return compression-positive ``[Nx, Ny, Nxy]`` at integration points. + + Uniform legacy state keys remain supported. Spatially varying + prestress can be supplied as ``membrane_compression_at_gauss`` or + tension-positive ``membrane_forces_at_gauss`` with shape ``(n_gp, 3)``. + The shorter aliases ``membrane_compression`` and ``membrane_forces`` + also accept that two-dimensional form. + """ + if isinstance(state, dict): + compression_values = state.get( + "membrane_compression_at_gauss", + state.get("membrane_compression"), + ) + force_values = state.get( + "membrane_forces_at_gauss", + state.get("membrane_forces"), + ) + values = compression_values if compression_values is not None else force_values + if values is not None: + samples = np.asarray(values, dtype=float) + if samples.ndim == 2: + if samples.shape != (int(count), 3): + raise ValueError( + "Gauss-point membrane resultants must have shape " + f"({int(count)}, 3), got {samples.shape}." + ) + return samples.copy() if compression_values is not None else -samples + + uniform = np.asarray(cls._membrane_compression_from_state(state), dtype=float) + return np.repeat(uniform.reshape(1, 3), int(count), axis=0) + + @staticmethod + def _resultant_samples( + state: Optional[Any], + count: int, + *, + compression_keys: Tuple[str, ...], + tension_keys: Tuple[str, ...] = (), + ) -> np.ndarray: + """Read uniform or Gauss-point vector resultants with sign conversion.""" + if not isinstance(state, dict): + return np.zeros((int(count), 3), dtype=float) + values = None + compression_positive = True + for key in compression_keys: + if key in state: + values = state[key] + break + if values is None: + for key in tension_keys: + if key in state: + values = state[key] + compression_positive = False + break + if values is None: + return np.zeros((int(count), 3), dtype=float) + samples = np.asarray(values, dtype=float) + if samples.ndim == 1 and samples.size == 3: + samples = np.repeat(samples.reshape(1, 3), int(count), axis=0) + if samples.shape != (int(count), 3): + raise ValueError( + f"Initial-stress resultants must have shape (3,) or ({int(count)}, 3), " + f"got {samples.shape}." + ) + return samples.copy() if compression_positive else -samples + + @classmethod + def _bending_compression_samples( + cls, + state: Optional[Any], + count: int, + ) -> np.ndarray: + """Compression-positive first stress moments ``[Mx, My, Mxy]``.""" + return cls._resultant_samples( + state, + count, + compression_keys=( + "bending_compression_at_gauss", + "bending_compression", + "bending_compression_moments_at_gauss", + "bending_compression_moments", + ), + tension_keys=("bending_moments_at_gauss", "bending_moments"), + ) + + @classmethod + def _stress_second_moment_samples( + cls, + state: Optional[Any], + count: int, + membrane_compression: np.ndarray, + thickness: float, + ) -> np.ndarray: + """Compression-positive second stress moments, defaulting to ``N h²/12``.""" + explicit = cls._resultant_samples( + state, + count, + compression_keys=( + "stress_second_moment_at_gauss", + "stress_second_moment", + "membrane_compression_second_moment_at_gauss", + "membrane_compression_second_moment", + ), + ) + has_explicit = isinstance(state, dict) and any( + key in state + for key in ( + "stress_second_moment_at_gauss", + "stress_second_moment", + "membrane_compression_second_moment_at_gauss", + "membrane_compression_second_moment", + ) + ) + if has_explicit: + return explicit + return np.asarray(membrane_compression, dtype=float) * float(thickness) ** 2 / 12.0 + + def compute_geometric_stiffness_matrix( + self, + mesh: "FEMesh", + material: "Material", + state: Optional[Any] = None, + ) -> np.ndarray: + """ + Shell stress-stiffness matrix from membrane resultants. + + The state can supply either tension-positive membrane forces + (``membrane_force_x/y/xy`` or ``membrane_forces``) or + compression-positive values (``membrane_compression_x/y/xy``). The + returned matrix follows the package convention + ``K phi = lambda KG phi`` with compression destabilizing. + + The total-Lagrangian initial-stress operator uses the Mindlin director + field ``[u + z*ry, v - z*rx, w]``. Membrane resultants therefore act + on all translations, their second stress moment (``N*h**2/12`` for a + uniform through-thickness membrane stress) acts on ``rx``/``ry`` + gradients, and optional bending resultants provide the signed + translation-director coupling. Drilling ``rz`` has no director term. + """ + compression = self._membrane_compression_samples(state, len(self.gauss_points)) + bending_compression = self._bending_compression_samples(state, len(self.gauss_points)) + second_moment = self._stress_second_moment_samples( + state, + len(self.gauss_points), + compression, + self.thickness, + ) + if not np.any(compression) and not np.any(bending_compression) and not np.any(second_moment): + return np.zeros((self.total_dofs, self.total_dofs), dtype=float) + + coords = self.get_node_coordinates(mesh) + KG = np.zeros((self.total_dofs, self.total_dofs), dtype=float) + + for gp_index, ((xi, eta), weight) in enumerate(zip(self.gauss_points, self.gauss_weights)): + N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) + R, dN_dx, dN_dy, det_j = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) + T = self._local_dof_transform(R) + Nx, Ny, Nxy = compression[gp_index] + N_matrix = np.array([[Nx, Nxy], [Nxy, Ny]], dtype=float) + Mx, My, Mxy = bending_compression[gp_index] + M_matrix = np.array([[Mx, Mxy], [Mxy, My]], dtype=float) + Hx, Hy, Hxy = second_moment[gp_index] + H_matrix = np.array([[Hx, Hxy], [Hxy, Hy]], dtype=float) + KG_local = np.zeros((self.total_dofs, self.total_dofs), dtype=float) + translation_gradients = [] + for component in range(3): + G = np.zeros((2, self.total_dofs), dtype=float) + G[0, component::6] = dN_dx + G[1, component::6] = dN_dy + translation_gradients.append(G) + KG_local += G.T @ N_matrix @ G + G_rx = np.zeros((2, self.total_dofs), dtype=float) + G_ry = np.zeros((2, self.total_dofs), dtype=float) + G_rx[0, 3::6] = dN_dx + G_rx[1, 3::6] = dN_dy + G_ry[0, 4::6] = dN_dx + G_ry[1, 4::6] = dN_dy + KG_local += G_rx.T @ H_matrix @ G_rx + KG_local += G_ry.T @ H_matrix @ G_ry + # u(z)=u+z*ry and v(z)=v-z*rx. + coupling_u_ry = translation_gradients[0].T @ M_matrix @ G_ry + coupling_v_rx = translation_gradients[1].T @ M_matrix @ G_rx + KG_local += coupling_u_ry + coupling_u_ry.T + KG_local -= coupling_v_rx + coupling_v_rx.T + KG_local *= det_j * float(weight) + KG += T.T @ KG_local @ T + return KG + + # ------------------------------------------------------------------ + # Incremental nonlinear response: total-Lagrangian von Karman membrane + # kinematics in the flat-facet centre frame, layered J2 plane-stress + # plasticity through the thickness, elastic transverse shear (MITC4 for + # 4-node, reduced for 8-node) and elastic drilling stabilization. + # ------------------------------------------------------------------ + + def _nonlinear_geometry(self, mesh: "FEMesh") -> Dict[str, Any]: + """Reference-configuration data, computed once per element.""" + cache = getattr(self, "_nl_cache", None) + if cache is not None: + return cache + coords = self.get_node_coordinates(mesh) + R0 = self._center_frame(coords) + T0 = self._local_dof_transform(R0) + planar = coords @ R0[:, :2] + + gp_data = [] + for (xi, eta), weight in zip(self.gauss_points, self.gauss_weights): + N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) + J2 = np.array( + [ + [float(dN_dxi @ planar[:, 0]), float(dN_dxi @ planar[:, 1])], + [float(dN_deta @ planar[:, 0]), float(dN_deta @ planar[:, 1])], + ], + dtype=float, + ) + inv_j2, det_j = _inv2(J2) + dN_dx = inv_j2[0, 0] * dN_dxi + inv_j2[0, 1] * dN_deta + dN_dy = inv_j2[1, 0] * dN_dxi + inv_j2[1, 1] * dN_deta + B_m, B_b, B_s = self._build_shell_b_matrices(N, dN_dx, dN_dy) + B_d = self._build_drilling_b_matrix(N, dN_dx, dN_dy) + Gw = np.zeros((2, self.total_dofs), dtype=float) + Gw[0, 2::6] = dN_dx + Gw[1, 2::6] = dN_dy + gp_data.append( + { + "B_m": B_m, + "B_b": B_b, + "B_d": B_d, + "Gw": Gw, + "detw": abs(det_j) * float(weight), + } + ) + + shear_data = [] + if self._is_4node: + _, samples = self._mitc4_shear_samples(coords, R0) + for (xi, eta), weight in zip(self.GAUSS_POINTS_2x2, self.GAUSS_WEIGHTS_2x2): + B_s, det_j = self._mitc4_shear_b_matrix(planar, samples, float(xi), float(eta)) + shear_data.append({"B_s": B_s, "detw": abs(det_j) * float(weight)}) + elif self._is_3node: + B_s, det_j = self._tri3_assumed_shear_b_matrix(coords, R0) + shear_data.append({"B_s": B_s, "detw": det_j * float(np.sum(self.shear_gauss_weights))}) + else: + for (xi, eta), weight in zip(self.shear_gauss_points, self.shear_gauss_weights): + N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) + J2 = np.array( + [ + [float(dN_dxi @ planar[:, 0]), float(dN_dxi @ planar[:, 1])], + [float(dN_deta @ planar[:, 0]), float(dN_deta @ planar[:, 1])], + ], + dtype=float, + ) + inv_j2, det_j = _inv2(J2) + dN_dx = inv_j2[0, 0] * dN_dxi + inv_j2[0, 1] * dN_deta + dN_dy = inv_j2[1, 0] * dN_dxi + inv_j2[1, 1] * dN_deta + _, _, B_s = self._build_shell_b_matrices(N, dN_dx, dN_dy) + shear_data.append({"B_s": B_s, "detw": abs(det_j) * float(weight)}) + + n_gp = len(gp_data) + B_m_all = np.zeros((n_gp, 3, self.total_dofs)) + B_b_all = np.zeros((n_gp, 3, self.total_dofs)) + B_d_all = np.zeros((n_gp, 1, self.total_dofs)) + Gw_all = np.zeros((n_gp, 2, self.total_dofs)) + detw_all = np.zeros(n_gp) + for g, gp in enumerate(gp_data): + B_m_all[g] = gp["B_m"] + B_b_all[g] = gp["B_b"] + B_d_all[g] = gp["B_d"] + Gw_all[g] = gp["Gw"] + detw_all[g] = gp["detw"] + + n_shear = len(shear_data) + B_s_all = np.zeros((n_shear, 2, self.total_dofs)) + detw_shear_all = np.zeros(n_shear) + for g, sh in enumerate(shear_data): + B_s_all[g] = sh["B_s"] + detw_shear_all[g] = sh["detw"] + + cache = { + "R0": R0, + "T0": T0, + "gp": gp_data, + "shear": shear_data, + "B_m_all": B_m_all, + "B_b_all": B_b_all, + "B_d_all": B_d_all, + "Gw_all": Gw_all, + "detw_all": detw_all, + "B_s_all": B_s_all, + "detw_shear_all": detw_shear_all, + } + # This is a solver-owned derived cache. Qualified subclasses reserve + # the public assignment surface so callers cannot replace a warm + # nonlinear operator while preserving its cache key. + object.__setattr__(self, "_nl_cache", cache) + return cache + + def init_nonlinear_state(self, num_layers: int) -> Dict[str, Any]: + if self.shell_section is not None: + return {"generalized_section": True} + n_points = len(self.gauss_points) * num_layers + return { + "plastic_strain": np.zeros((n_points, 3), dtype=float), + "alpha": np.zeros(n_points, dtype=float), + } + + def _generalized_section_nonlinear_response( + self, + mesh: "FEMesh", + material: "Material", + u_elem: np.ndarray, + state: Optional[Any], + tangent: bool, + *, + _return_tangent_components: bool = False, + ) -> Any: + """Geometrically nonlinear response for a linear generalized section.""" + + if getattr(material, "hardening_curve", None) is not None or getattr( + material, + "hill_yield", + None, + ) is not None: + raise ValueError( + "Generalized shell sections are linear elastic and cannot use " + "material hardening or Hill plasticity; use a layered section " + "constitutive model for nonlinear laminate response." + ) + if isinstance(state, dict) and any(key in state for key in _INITIAL_SHELL_STATE_KEYS): + raise ValueError( + "Initial layer stress/prestrain fields are not defined for a " + "pre-integrated generalized shell section." + ) + + cache = self._nonlinear_geometry(mesh) + R0 = cache["R0"] + T0 = cache["T0"] + u_loc = T0 @ np.asarray(u_elem, dtype=float) + section = self._generalized_section_in_frame(R0) + assert section is not None + + n_gp = len(cache["gp"]) + membrane_strain = np.zeros((n_gp, 3), dtype=float) + curvature = np.zeros((n_gp, 3), dtype=float) + for index, gp in enumerate(cache["gp"]): + theta = gp["Gw"] @ u_loc + membrane_strain[index] = gp["B_m"] @ u_loc + np.array( + [ + 0.5 * theta[0] ** 2, + 0.5 * theta[1] ** 2, + theta[0] * theta[1], + ], + dtype=float, + ) + curvature[index] = gp["B_b"] @ u_loc + + membrane_resultants = ( + membrane_strain @ section.A.T + curvature @ section.B.T + ) + bending_resultants = ( + membrane_strain @ section.B + curvature @ section.D.T + ) + transverse_shear_strain = np.einsum( + "gij,j->gi", + cache["B_s_all"], + u_loc, + ) + transverse_shear_resultants = ( + transverse_shear_strain @ section.As.T + ) + C0 = np.broadcast_to(section.A, (n_gp, 3, 3)) + C1 = np.broadcast_to(section.B, (n_gp, 3, 3)) + C2 = np.broadcast_to(section.D, (n_gp, 3, 3)) + drilling_stiffness = ( + float(section.A[2, 2]) + * getattr(self, "drilling_stabilization", 1.0e-3) + ) + + F_loc, K_loc = _jit_integrate_nonlinear_response( + u_loc, + membrane_resultants, + bending_resultants, + C0, + C1, + C2, + cache["B_m_all"], + cache["B_b_all"], + cache["B_d_all"], + cache["Gw_all"], + cache["detw_all"], + cache["B_s_all"], + cache["detw_shear_all"], + section.As, + drilling_stiffness, + tangent, + True, + self.total_dofs, + ) + + K_hg = getattr(self, "_hourglass_stiffness_matrix", None) + if ( + self._is_8node + and self.reduced_integration + and float(getattr(self, "hourglass_stabilization", 0.0)) > 0.0 + and K_hg is None + ): + self.compute_stiffness_matrix(mesh, material) + K_hg = getattr(self, "_hourglass_stiffness_matrix", None) + + F_global = T0.T @ F_loc + if K_hg is not None: + F_global = F_global + K_hg @ np.asarray(u_elem, dtype=float) + K_global: Optional[np.ndarray] + if tangent: + K_global = T0.T @ K_loc @ T0 + if K_hg is not None: + K_global = K_global + K_hg + else: + K_global = None + + trial_state: Dict[str, Any] = { + "generalized_section": True, + "geometric_nonlinearity": "von_karman", + "membrane_strain": membrane_strain.copy(), + "curvature": curvature.copy(), + "transverse_shear_strain": transverse_shear_strain.copy(), + "membrane_resultants": membrane_resultants.copy(), + "bending_resultants": bending_resultants.copy(), + "transverse_shear_resultants": ( + transverse_shear_resultants.copy() + ), + "membrane_resultant_order": SHELL_MEMBRANE_VOIGT_ORDER, + "transverse_shear_resultant_order": ( + SHELL_TRANSVERSE_SHEAR_ORDER + ), + "recovery_scope": "section_resultants_only", + } + if _return_tangent_components: + if K_global is None: + raise ValueError( + "nonlinear tangent components require tangent=True" + ) + material_local, geometric_local = ( + _integrate_nonlinear_tangent_components( + u_loc, + membrane_resultants, + bending_resultants, + C0, + C1, + C2, + cache["B_m_all"], + cache["B_b_all"], + cache["B_d_all"], + cache["Gw_all"], + cache["detw_all"], + cache["B_s_all"], + cache["detw_shear_all"], + section.As, + drilling_stiffness, + True, + self.total_dofs, + ) + ) + material_global = T0.T @ material_local @ T0 + geometric_global = T0.T @ geometric_local @ T0 + if K_hg is not None: + material_global = material_global + K_hg + return F_global, K_global, trial_state, { + "material": material_global, + "geometric": geometric_global, + } + return F_global, K_global, trial_state + + def compute_nonlinear_response( + self, + mesh: "FEMesh", + material: "Material", + u_elem: np.ndarray, + state: Optional[Any] = None, + num_layers: int = 5, + tangent: bool = True, + *, + _return_tangent_components: bool = False, + _qualified_runtime_post_observation: Optional[Callable[[], None]] = None, + ) -> Any: + if _return_tangent_components and not tangent: + raise ValueError("nonlinear tangent components require tangent=True") + if self.shell_section is not None: + return self._generalized_section_nonlinear_response( + mesh, + material, + u_elem, + state, + tangent, + _return_tangent_components=_return_tangent_components, + ) + cache = self._nonlinear_geometry(mesh) + R0 = cache["R0"] + T0 = cache["T0"] + u_loc = T0 @ np.asarray(u_elem, dtype=float) + + symmetry = _elastic_symmetry( + material, + _qualified_runtime_post_observation, + ) + h = self.thickness + curve = _guarded_observe_attribute( + material, + "hardening_curve", + default=None, + post_observation=_qualified_runtime_post_observation, + ) + C_el, shear_elastic, strain_to_material, stress_to_local = _shell_material_matrices( + material, + self._material_angle(R0), + _qualified_runtime_post_observation, + ) + C_material, _shear_material, _identity_strain, _identity_stress = ( + _shell_material_matrices( + material, + 0.0, + _qualified_runtime_post_observation, + ) + ) + drilling_modulus = 1.0 / float( + _elastic_compliance( + material, + _qualified_runtime_post_observation, + )[5, 5] + ) + D_shear = shear_elastic * (5.0 / 6.0) * h + drilling_stiffness = ( + drilling_modulus + * h + * getattr(self, "drilling_stabilization", 1.0e-3) + ) + hill_yield = _guarded_observe_attribute( + material, + "hill_yield", + default=None, + post_observation=_qualified_runtime_post_observation, + ) + if symmetry == "orthotropic" and curve is not None and hill_yield is None: + raise ValueError( + f"Orthotropic material {getattr(material, 'name', '')!r} " + "requires hill_yield when hardening_curve is active." + ) + hill_plasticity = symmetry == "orthotropic" and hill_yield is not None + constitutive_plasticity = curve is not None or hill_plasticity + + n_gp = len(cache["gp"]) + z_layers, w_layers = lobatto_layers(num_layers, h) + + if state is None: + state = self.init_nonlinear_state(num_layers) + initial_state = _copy_state_fields(state, _INITIAL_SHELL_STATE_KEYS) + has_initial_field = any( + key in initial_state + for key in ( + "initial_membrane_stress", + "initial_bending_stress", + "initial_membrane_prestrain", + "initial_curvature_prestrain", + ) + ) + + # Membrane and bending strains at every integration point. + memb_strain = np.zeros((n_gp, 3), dtype=float) + curvature = np.zeros((n_gp, 3), dtype=float) + B_eff_list = [] + theta_list = [] + for g, gp in enumerate(cache["gp"]): + theta = gp["Gw"] @ u_loc # (2,) transverse deflection gradients + B_nl = np.vstack( + [ + theta[0] * gp["Gw"][0], + theta[1] * gp["Gw"][1], + theta[0] * gp["Gw"][1] + theta[1] * gp["Gw"][0], + ] + ) + B_eff = gp["B_m"] + B_nl + memb_strain[g] = gp["B_m"] @ u_loc + np.array( + [0.5 * theta[0] ** 2, 0.5 * theta[1] ** 2, theta[0] * theta[1]] + ) + curvature[g] = gp["B_b"] @ u_loc + B_eff_list.append(B_eff) + theta_list.append(theta) + + if not constitutive_plasticity and not has_initial_field: + # Elastic shortcut: resultants and integrated moduli in closed form. + trial_state = state + N_res = memb_strain @ (h * C_el).T + M_res = curvature @ (h**3 / 12.0 * C_el).T + C0 = np.broadcast_to(h * C_el, (n_gp, 3, 3)) + C1 = np.zeros((n_gp, 3, 3), dtype=float) + C2 = np.broadcast_to(h**3 / 12.0 * C_el, (n_gp, 3, 3)) + else: + # Layer strains for all (gp, layer) points at once. Prescribed + # residual stress is represented by its elastic strain offset and + # prestrain is subtracted as an eigenstrain. Both therefore enter + # the same return map as the kinematic strain and participate in + # yielding, hardening, unloading, and the geometric stiffness. + kinematic_layer_strain = ( + memb_strain[:, None, :] + z_layers[None, :, None] * curvature[:, None, :] + ) + zero_rows = np.zeros((n_gp, 3), dtype=float) + membrane_stress = _shell_field_rows( + initial_state.get("initial_membrane_stress", zero_rows), + n_gp, + "initial_membrane_stress", + ) + bending_stress = _shell_field_rows( + initial_state.get("initial_bending_stress", zero_rows), + n_gp, + "initial_bending_stress", + ) + membrane_prestrain = _shell_field_rows( + initial_state.get("initial_membrane_prestrain", zero_rows), + n_gp, + "initial_membrane_prestrain", + ) + curvature_prestrain = _shell_field_rows( + initial_state.get("initial_curvature_prestrain", zero_rows), + n_gp, + "initial_curvature_prestrain", + ) + initial_stress = ( + membrane_stress[:, None, :] + + (2.0 * z_layers[None, :, None] / h) * bending_stress[:, None, :] + ) + eigenstrain = ( + membrane_prestrain[:, None, :] + + z_layers[None, :, None] * curvature_prestrain[:, None, :] + ) + if symmetry == "orthotropic": + initial_stress_material = np.einsum( + "ij,glj->gli", + np.linalg.inv(stress_to_local), + initial_stress, + ) + kinematic_material = np.einsum( + "ij,glj->gli", + strain_to_material, + kinematic_layer_strain, + ) + eigenstrain_material = np.einsum( + "ij,glj->gli", + strain_to_material, + eigenstrain, + ) + stress_strain_offset = np.einsum( + "ij,glj->gli", + np.linalg.inv(C_material), + initial_stress_material, + ) + layer_strain_material = ( + kinematic_material - eigenstrain_material + stress_strain_offset + ).reshape(n_gp * num_layers, 3) + layer_strain = ( + kinematic_layer_strain - eigenstrain + + np.einsum( + "ij,glj->gli", + np.linalg.inv(C_el), + initial_stress, + ) + ).reshape(n_gp * num_layers, 3) + else: + stress_strain_offset = np.einsum( + "ij,glj->gli", + np.linalg.inv(C_el), + initial_stress, + ) + layer_strain = ( + kinematic_layer_strain - eigenstrain + stress_strain_offset + ).reshape(n_gp * num_layers, 3) + layer_strain_material = layer_strain + if not constitutive_plasticity: + sigma = layer_strain @ C_el.T + C_tan = np.broadcast_to(C_el, (n_gp * num_layers, 3, 3)).copy() + ep_new = np.zeros_like(layer_strain) + alpha_new = np.zeros(n_gp * num_layers, dtype=float) + if symmetry == "orthotropic": + sigma_material = layer_strain_material @ C_material.T + elif hill_plasticity: + from .plasticity import hill48_plane_stress_return_map + + sigma_material, C_tan_material, ep_new, alpha_new = ( + hill48_plane_stress_return_map( + layer_strain_material, + state["plastic_strain"], + state["alpha"], + C_material, + hill_yield, + curve, + compute_tangent=tangent, + ) + ) + sigma = sigma_material @ stress_to_local.T + C_tan = np.einsum( + "ij,njk,kl->nil", + stress_to_local, + C_tan_material, + strain_to_material, + ) + else: + sigma, C_tan, ep_new, alpha_new = plane_stress_return_map( + layer_strain, + state["plastic_strain"], + state["alpha"], + _guarded_float( + _guarded_observe_attribute( + material, + "elastic_modulus", + post_observation=_qualified_runtime_post_observation, + ), + post_observation=_qualified_runtime_post_observation, + ), + _guarded_float( + _guarded_observe_attribute( + material, + "poisson_ratio", + post_observation=_qualified_runtime_post_observation, + ), + post_observation=_qualified_runtime_post_observation, + ), + curve, + compute_tangent=tangent, + ) + trial_state = { + "plastic_strain": ep_new, + "alpha": alpha_new, + "layer_strain": layer_strain.copy(), + "layer_strain_material": layer_strain_material.copy(), + "kinematic_layer_strain": kinematic_layer_strain.reshape(n_gp * num_layers, 3).copy(), + **initial_state, + } + + sigma = sigma.reshape(n_gp, num_layers, 3) + C_tan = C_tan.reshape(n_gp, num_layers, 3, 3) + trial_state["layer_stress"] = sigma.reshape(n_gp * num_layers, 3).copy() + if symmetry == "orthotropic": + trial_state["layer_stress_material"] = sigma_material.reshape( + n_gp * num_layers, + 3, + ).copy() + trial_state["equivalent_stress_measure"] = ( + "hill48" if hill_yield is not None else "von_mises" + ) + + # Through-thickness resultants and integrated tangent moduli. + N_res = np.einsum("l,gli->gi", w_layers, sigma) + M_res = np.einsum("l,l,gli->gi", w_layers, z_layers, sigma) + C0 = np.einsum("l,glij->gij", w_layers, C_tan) + C1 = np.einsum("l,l,glij->gij", w_layers, z_layers, C_tan) + C2 = np.einsum("l,l,l,glij->gij", w_layers, z_layers, z_layers, C_tan) + + n_dof = self.total_dofs + F_loc, K_loc_temp = _jit_integrate_nonlinear_response( + u_loc, + N_res, + M_res, + C0, + C1, + C2, + cache["B_m_all"], + cache["B_b_all"], + cache["B_d_all"], + cache["Gw_all"], + cache["detw_all"], + cache["B_s_all"], + cache["detw_shear_all"], + D_shear, + drilling_stiffness, + tangent, + constitutive_plasticity, + n_dof, + ) + K_loc = K_loc_temp if tangent else None + + K_hg = getattr(self, "_hourglass_stiffness_matrix", None) + if self._is_8node and self.reduced_integration and float(getattr(self, "hourglass_stabilization", 0.0)) > 0.0: + if K_hg is None: + self.compute_stiffness_matrix(mesh, material) + K_hg = getattr(self, "_hourglass_stiffness_matrix", None) + + F_global = T0.T @ F_loc + if K_hg is not None: + u_global = np.asarray(u_elem, dtype=float) + F_global = F_global + K_hg @ u_global + + if not tangent: + return F_global, None, trial_state + K_global = T0.T @ K_loc @ T0 + if K_hg is not None: + K_global = K_global + K_hg + if _return_tangent_components: + material_local, geometric_local = ( + _integrate_nonlinear_tangent_components( + u_loc, + N_res, + M_res, + C0, + C1, + C2, + cache["B_m_all"], + cache["B_b_all"], + cache["B_d_all"], + cache["Gw_all"], + cache["detw_all"], + cache["B_s_all"], + cache["detw_shear_all"], + D_shear, + drilling_stiffness, + constitutive_plasticity, + n_dof, + ) + ) + material_global = T0.T @ material_local @ T0 + geometric_global = T0.T @ geometric_local @ T0 + if K_hg is not None: + material_global = material_global + K_hg + return F_global, K_global, trial_state, { + "material": material_global, + "geometric": geometric_global, + } + return F_global, K_global, trial_state + + def _compute_generalized_section_results( + self, + mesh: "FEMesh", + displacements: np.ndarray, + *, + return_global: bool, + ) -> Dict[str, Any]: + """Recover exact generalized strains and resultants. + + A/B/D/As do not contain enough information to reconstruct ply or + through-thickness surface stresses, so this path intentionally does + not report von Mises, Hill, or fabricated top/bottom stress fields. + """ + + coords = self.get_node_coordinates(mesh) + u_elem_global = self._get_element_displacements(mesh, displacements) + num_ip = len(self.gauss_points) + membrane_strain = np.zeros((num_ip, 3), dtype=float) + curvature = np.zeros((num_ip, 3), dtype=float) + transverse_shear_strain = np.zeros((num_ip, 2), dtype=float) + membrane_resultants = np.zeros((num_ip, 3), dtype=float) + bending_resultants = np.zeros((num_ip, 3), dtype=float) + transverse_shear_resultants = np.zeros((num_ip, 2), dtype=float) + + global_membrane = ( + np.zeros((num_ip, 3, 3), dtype=float) if return_global else None + ) + global_bending = ( + np.zeros((num_ip, 3, 3), dtype=float) if return_global else None + ) + global_shear = ( + np.zeros((num_ip, 3), dtype=float) if return_global else None + ) + + mitc_planar = None + mitc_samples = None + mitc_u_local = None + tri3_B_s = None + tri3_u_local = None + center_section = None + if self._is_4node: + R_center = self._center_frame(coords) + center_section = self._generalized_section_in_frame(R_center) + mitc_planar, mitc_samples = self._mitc4_shear_samples(coords, R_center) + mitc_u_local = self._local_dof_transform(R_center) @ u_elem_global + elif self._is_3node: + R_center = self._center_frame(coords) + center_section = self._generalized_section_in_frame(R_center) + tri3_B_s, _ = self._tri3_assumed_shear_b_matrix(coords, R_center) + tri3_u_local = self._local_dof_transform(R_center) @ u_elem_global + + for index, (xi, eta) in enumerate(self.gauss_points): + N, dN_dxi, dN_deta = self.compute_shape_functions( + float(xi), + float(eta), + ) + R, dN_dx, dN_dy, _ = self._local_frame_and_derivatives( + coords, + dN_dxi, + dN_deta, + ) + section = self._generalized_section_in_frame(R) + assert section is not None + T = self._local_dof_transform(R) + u_local = T @ u_elem_global + B_m, B_b, B_s = self._build_shell_b_matrices(N, dN_dx, dN_dy) + strain = B_m @ u_local + bend = B_b @ u_local + if self._is_4node: + B_s_mitc, _ = self._mitc4_shear_b_matrix( + mitc_planar, + mitc_samples, + float(xi), + float(eta), + ) + shear_strain = B_s_mitc @ mitc_u_local + shear_section = center_section + elif self._is_3node: + shear_strain = tri3_B_s @ tri3_u_local + shear_section = center_section + else: + shear_strain = B_s @ u_local + shear_section = section + assert shear_section is not None + + force = section.A @ strain + section.B @ bend + moment = section.B.T @ strain + section.D @ bend + shear_force = shear_section.As @ shear_strain + + membrane_strain[index] = strain + curvature[index] = bend + transverse_shear_strain[index] = shear_strain + membrane_resultants[index] = force + bending_resultants[index] = moment + transverse_shear_resultants[index] = shear_force + + if return_global: + force_tensor = np.array( + [ + [force[0], force[2], 0.0], + [force[2], force[1], 0.0], + [0.0, 0.0, 0.0], + ], + dtype=float, + ) + moment_tensor = np.array( + [ + [moment[0], moment[2], 0.0], + [moment[2], moment[1], 0.0], + [0.0, 0.0, 0.0], + ], + dtype=float, + ) + assert global_membrane is not None + assert global_bending is not None + assert global_shear is not None + global_membrane[index] = R @ force_tensor @ R.T + global_bending[index] = R @ moment_tensor @ R.T + global_shear[index] = ( + shear_force[0] * R[:, 0] + shear_force[1] * R[:, 1] + ) + + results: Dict[str, Any] = { + "generalized_stress_scope": "section_resultants_only", + "recovery_scope": "section_resultants_only", + "physical_stress_available": False, + "membrane_resultant_order": SHELL_MEMBRANE_VOIGT_ORDER, + "transverse_shear_resultant_order": SHELL_TRANSVERSE_SHEAR_ORDER, + "membrane_strain": membrane_strain, + "curvature": curvature, + "transverse_shear_strain": transverse_shear_strain, + "membrane_resultants": membrane_resultants, + "bending_resultants": bending_resultants, + "transverse_shear_resultants": transverse_shear_resultants, + } + if return_global: + results.update( + { + "global_membrane_resultant_tensors": global_membrane, + "global_bending_resultant_tensors": global_bending, + "global_transverse_shear_resultants": global_shear, + } + ) + return results + + def compute_stresses( + self, + mesh: "FEMesh", + displacements: np.ndarray, + material: "Material", + return_global: bool = False, + *, + natural_points=None, + ) -> Dict[str, Any]: + if self.shell_section is not None: + if natural_points is not None: + raise ValueError('custom stress points are unsupported for generalized shell sections') + return self._compute_generalized_section_results( + mesh, + displacements, + return_global=return_global, + ) + coords = self.get_node_coordinates(mesh) + u_elem_global = self._get_element_displacements(mesh, displacements) + symmetry = _elastic_symmetry(material) + h = self.thickness + kappa = 5.0 / 6.0 + + recovery_points=self.gauss_points if natural_points is None else np.asarray(natural_points,dtype=float) + if natural_points is not None and (recovery_points.ndim!=2 or recovery_points.shape[1]!=2 or len(recovery_points)==0 or not np.all(np.isfinite(recovery_points)) or np.any(np.abs(recovery_points)>1)): + raise ValueError('natural stress points must be nonempty finite Nx2 in [-1,1]') + num_ip = len(recovery_points) + stresses: Dict[str, np.ndarray] = { + "membrane_xx": np.zeros(num_ip), + "membrane_yy": np.zeros(num_ip), + "membrane_xy": np.zeros(num_ip), + "bending_xx": np.zeros(num_ip), + "bending_yy": np.zeros(num_ip), + "bending_xy": np.zeros(num_ip), + "shear_xz": np.zeros(num_ip), + "shear_yz": np.zeros(num_ip), + "von_mises": np.zeros(num_ip), + "equivalent_stress": np.zeros(num_ip), + "hill_utilization": np.zeros(num_ip), + } + stresses["equivalent_stress_measure"] = ( + "hill48" if symmetry == "orthotropic" and getattr(material, "hill_yield", None) is not None + else "von_mises" + ) + if return_global: + stresses.update({ + "local_xx_top": np.zeros(num_ip), + "local_yy_top": np.zeros(num_ip), + "local_zz_top": np.zeros(num_ip), + "local_xy_top": np.zeros(num_ip), + "local_yz_top": np.zeros(num_ip), + "local_xz_top": np.zeros(num_ip), + "local_xx_bot": np.zeros(num_ip), + "local_yy_bot": np.zeros(num_ip), + "local_zz_bot": np.zeros(num_ip), + "local_xy_bot": np.zeros(num_ip), + "local_yz_bot": np.zeros(num_ip), + "local_xz_bot": np.zeros(num_ip), + "global_xx_top": np.zeros(num_ip), + "global_yy_top": np.zeros(num_ip), + "global_zz_top": np.zeros(num_ip), + "global_xy_top": np.zeros(num_ip), + "global_yz_top": np.zeros(num_ip), + "global_xz_top": np.zeros(num_ip), + "global_xx_bot": np.zeros(num_ip), + "global_yy_bot": np.zeros(num_ip), + "global_zz_bot": np.zeros(num_ip), + "global_xy_bot": np.zeros(num_ip), + "global_yz_bot": np.zeros(num_ip), + "global_xz_bot": np.zeros(num_ip), + }) + + mitc_planar = None + mitc_samples = None + mitc_u_local = None + tri3_B_s = None + tri3_u_local = None + if self._is_4node: + R_center = self._center_frame(coords) + _Q_center, G_center, _strain_center, _stress_center = _shell_material_matrices( + material, + self._material_angle(R_center), + ) + mitc_planar, mitc_samples = self._mitc4_shear_samples(coords, R_center) + mitc_u_local = self._local_dof_transform(R_center) @ u_elem_global + elif self._is_3node: + R_center = self._center_frame(coords) + _Q_center, G_center, _strain_center, _stress_center = _shell_material_matrices( + material, + self._material_angle(R_center), + ) + tri3_B_s, _ = self._tri3_assumed_shear_b_matrix(coords, R_center) + tri3_u_local = self._local_dof_transform(R_center) @ u_elem_global + + from .recovery_shell_frames import native_recovery_frames + + frames = native_recovery_frames(self, coords, recovery_points, material) + for idx, (xi, eta) in enumerate(recovery_points): + if frames is None: + N, dN_dxi, dN_deta = self.compute_shape_functions(float(xi), float(eta)) + R, dN_dx, dN_dy, _ = self._local_frame_and_derivatives(coords, dN_dxi, dN_deta) + else: + N, R, dN_dx, dN_dy = frames[idx] + Q_local, G_local, _strain_to_material, stress_to_local = _shell_material_matrices( + material, + self._material_angle(R), + ) + T = self._local_dof_transform(R) + u_local = T @ u_elem_global + B_m, B_b, B_s = self._build_shell_b_matrices(N, dN_dx, dN_dy) + membrane_strain = B_m @ u_local + curvature = B_b @ u_local + if self._is_4node: + B_s_mitc, _ = self._mitc4_shear_b_matrix(mitc_planar, mitc_samples, float(xi), float(eta)) + shear_strain = B_s_mitc @ mitc_u_local + elif self._is_3node: + shear_strain = tri3_B_s @ tri3_u_local + else: + shear_strain = B_s @ u_local + + sigma_m = Q_local @ membrane_strain + moments = (h**3 / 12.0 * Q_local) @ curvature + sigma_b = 6.0 * moments / max(h**2, _SMALL) + shear_matrix = G_center if self._is_4node or self._is_3node else G_local + tau_s = kappa * shear_matrix @ shear_strain + + stresses["membrane_xx"][idx] = sigma_m[0] + stresses["membrane_yy"][idx] = sigma_m[1] + stresses["membrane_xy"][idx] = sigma_m[2] + stresses["bending_xx"][idx] = sigma_b[0] + stresses["bending_yy"][idx] = sigma_b[1] + stresses["bending_xy"][idx] = sigma_b[2] + stresses["shear_xz"][idx] = tau_s[0] + stresses["shear_yz"][idx] = tau_s[1] + + # Top surface (z = +h/2) + sigma_x_top = sigma_m[0] + sigma_b[0] + sigma_y_top = sigma_m[1] + sigma_b[1] + tau_xy_top = sigma_m[2] + sigma_b[2] + vm_top = np.sqrt( + sigma_x_top**2 + sigma_y_top**2 - sigma_x_top * sigma_y_top + 3.0 * (tau_xy_top**2 + tau_s[0]**2 + tau_s[1]**2) + ) + + # Bottom surface (z = -h/2) + sigma_x_bot = sigma_m[0] - sigma_b[0] + sigma_y_bot = sigma_m[1] - sigma_b[1] + tau_xy_bot = sigma_m[2] - sigma_b[2] + vm_bot = np.sqrt( + sigma_x_bot**2 + sigma_y_bot**2 - sigma_x_bot * sigma_y_bot + 3.0 * (tau_xy_bot**2 + tau_s[0]**2 + tau_s[1]**2) + ) + + stresses["von_mises"][idx] = max(vm_top, vm_bot) + hill_yield = getattr(material, "hill_yield", None) + if hill_yield is not None: + from .plasticity import hill48_plane_stress_equivalent_stress + + top_material = np.linalg.solve(stress_to_local, np.array( + [sigma_x_top, sigma_y_top, tau_xy_top], + dtype=float, + )) + bottom_material = np.linalg.solve(stress_to_local, np.array( + [sigma_x_bot, sigma_y_bot, tau_xy_bot], + dtype=float, + )) + hill_values = hill48_plane_stress_equivalent_stress( + np.vstack((top_material, bottom_material)), + hill_yield, + ) + equivalent = float(np.max(hill_values)) + stresses["equivalent_stress"][idx] = equivalent + stresses["hill_utilization"][idx] = equivalent / max(float(hill_yield.X), _SMALL) + else: + stresses["equivalent_stress"][idx] = stresses["von_mises"][idx] + + if return_global: + # Top local stress tensor + sigma_loc_top = np.array([ + [sigma_x_top, tau_xy_top, tau_s[0]], + [tau_xy_top, sigma_y_top, tau_s[1]], + [tau_s[0], tau_s[1], 0.0] + ], dtype=float) + sigma_glob_top = R @ sigma_loc_top @ R.T + + # Bottom local stress tensor + sigma_loc_bot = np.array([ + [sigma_x_bot, tau_xy_bot, tau_s[0]], + [tau_xy_bot, sigma_y_bot, tau_s[1]], + [tau_s[0], tau_s[1], 0.0] + ], dtype=float) + sigma_glob_bot = R @ sigma_loc_bot @ R.T + + # Store local components + stresses["local_xx_top"][idx] = sigma_x_top + stresses["local_yy_top"][idx] = sigma_y_top + stresses["local_zz_top"][idx] = 0.0 + stresses["local_xy_top"][idx] = tau_xy_top + stresses["local_xz_top"][idx] = tau_s[0] + stresses["local_yz_top"][idx] = tau_s[1] + + stresses["local_xx_bot"][idx] = sigma_x_bot + stresses["local_yy_bot"][idx] = sigma_y_bot + stresses["local_zz_bot"][idx] = 0.0 + stresses["local_xy_bot"][idx] = tau_xy_bot + stresses["local_xz_bot"][idx] = tau_s[0] + stresses["local_yz_bot"][idx] = tau_s[1] + + # Store global components + stresses["global_xx_top"][idx] = sigma_glob_top[0, 0] + stresses["global_yy_top"][idx] = sigma_glob_top[1, 1] + stresses["global_zz_top"][idx] = sigma_glob_top[2, 2] + stresses["global_xy_top"][idx] = sigma_glob_top[0, 1] + stresses["global_xz_top"][idx] = sigma_glob_top[0, 2] + stresses["global_yz_top"][idx] = sigma_glob_top[1, 2] + + stresses["global_xx_bot"][idx] = sigma_glob_bot[0, 0] + stresses["global_yy_bot"][idx] = sigma_glob_bot[1, 1] + stresses["global_zz_bot"][idx] = sigma_glob_bot[2, 2] + stresses["global_xy_bot"][idx] = sigma_glob_bot[0, 1] + stresses["global_xz_bot"][idx] = sigma_glob_bot[0, 2] + stresses["global_yz_bot"][idx] = sigma_glob_bot[1, 2] + return stresses + + +def _publish_shell_element_public_signatures() -> None: + """Hide private runtime-guard hooks from the stable public API surface.""" + + from inspect import signature + + mass_signature = signature(ShellElement.compute_mass_matrix) + ShellElement.compute_mass_matrix.__signature__ = mass_signature.replace( + parameters=tuple( + parameter + for parameter in mass_signature.parameters.values() + if parameter.name != "_qualified_runtime_post_observation" + ) + ) + nonlinear_signature = signature(ShellElement.compute_nonlinear_response) + public_nonlinear_return = signature( + Element.compute_nonlinear_response + ).return_annotation + ShellElement.compute_nonlinear_response.__signature__ = ( + nonlinear_signature.replace( + parameters=tuple( + parameter + for parameter in nonlinear_signature.parameters.values() + if parameter.name + not in { + "_return_tangent_components", + "_qualified_runtime_post_observation", + } + ), + return_annotation=public_nonlinear_return, + ) + ) + + +_publish_shell_element_public_signatures() +del _publish_shell_element_public_signatures + + +def _install_strict_flat_s3_v2_legacy_dispatch_guards() -> None: + """Reject explicit base-method bypasses on the Stage-1 V2 candidate.""" + + from functools import wraps + from inspect import signature + + guard = _reject_strict_flat_s3_v2_legacy_dispatch + allowed = {"__init__", "dofs_per_node", "get_node_coordinates", "num_nodes"} + for name, original in tuple(vars(ShellElement).items()): + if name in allowed or name.startswith("__"): + continue + + if type(original) is property: + def wrap_accessor( + accessor: Optional[Callable[..., Any]], + label: str, + _guard: Callable[[Any, str], None] = guard, + ) -> Optional[Callable[..., Any]]: + if accessor is None: + return None + + @wraps(accessor) + def guarded_accessor(self: Any, *args: Any, **kwargs: Any) -> Any: + _guard(self, f"ShellElement.{label}") + return accessor(self, *args, **kwargs) + + guarded_accessor.__signature__ = signature(accessor) # type: ignore[attr-defined] + delattr(guarded_accessor, "__wrapped__") + return guarded_accessor + + setattr( + ShellElement, + name, + property( + wrap_accessor(original.fget, name), + wrap_accessor(original.fset, name), + wrap_accessor(original.fdel, name), + original.__doc__, + ), + ) + continue + if type(original) is not FunctionType: + continue + + @wraps(original) + def guarded( + self: Any, + *args: Any, + __name: str = name, + __original: Callable[..., Any] = original, + __guard: Callable[[Any, str], None] = guard, + **kwargs: Any, + ) -> Any: + __guard(self, f"ShellElement.{__name}") + return __original(self, *args, **kwargs) + + guarded.__signature__ = signature(original) # type: ignore[attr-defined] + delattr(guarded, "__wrapped__") + setattr(ShellElement, name, guarded) + + +_install_strict_flat_s3_v2_legacy_dispatch_guards() +del _install_strict_flat_s3_v2_legacy_dispatch_guards + +# Exact dispatch surface for the recovery-only quadrature frame optimization. +# Subclasses and instance/class overrides retain their scalar dispatch. +_SHELL_RECOVERY_FRAME_METHODS = tuple(vars(ShellElement).items()) +_SHELL_RECOVERY_BASE_METHODS = tuple(vars(Element).items()) +_SHELL_RECOVERY_MATERIAL_METHODS = tuple(vars(_RecoveryIsotropicMaterial).items()) +_SHELL_RECOVERY_FRAME_HELPERS = tuple((name, globals()[name]) for name in ( + "_cross3", "_inv2", "_shell_material_matrices", "_elastic_symmetry", + "_canonical_material_symmetry", "_guarded_observe_attribute", "_guarded_float", + "_jit_compute_8node_shape_functions", +)) + + +class BeamElement(Element): + """2-node Timoshenko beam element with 6 DOF per node. + + ``section=`` opts into a coupled generalized section. The same object may + be supplied under ``cross_section["generalized_section"]``; a raw matrix + is accepted under ``cross_section["generalized_stiffness"]``. Legacy + scalar cross-section dictionaries retain their historical formulation. + A generalized stiffness matrix does not define centroidal geometry, so + its Wagner torsional geometric-stiffness term is omitted by default. + Supply ``cross_section["geometric_polar_radius_squared"]`` in m^2 to opt in + explicitly. + """ + + def __init__( + self, + element_id: int, + node_ids: List[int], + material_name: str = "default", + cross_section: Optional[Dict[str, Any]] = None, + section: Any = None, + ): + super().__init__(element_id, node_ids, material_name) + if len(node_ids) != 2: + raise ValueError(f"BeamElement requires 2 nodes, got {len(node_ids)}") + self.cross_section = cross_section or {} + self._A = self.cross_section.get("area", 0.01) + self._Iy = self.cross_section.get("Iy", 1.0e-8) + self._Iz = self.cross_section.get("Iz", 1.0e-8) + self._J = self.cross_section.get("J", 1.0e-8) + self._ky = self.cross_section.get("shear_factor_y", 5.0 / 6.0) + self._kz = self.cross_section.get("shear_factor_z", 5.0 / 6.0) + self._orientation = _section_orientation(self.cross_section) + self._fiber_plasticity = self.cross_section.get("fiber_plasticity") + self.generalized_section = resolve_generalized_beam_section( + self.cross_section, + section, + ) + if self.generalized_section is not None and self._fiber_plasticity is not None: + raise ValueError( + "Generalized beam sections do not support " + "cross_section['fiber_plasticity']; supply an elastic section " + "without fiber plasticity." + ) + if self.generalized_section is not None: + self._geometric_polar_radius_squared() + self._geometric_nonlinearity = str( + self.cross_section.get("geometric_nonlinearity", self.cross_section.get("geometry", "von_karman")) + ).lower() + # Optional exact stress-recovery data; estimated from A and I if absent. + self._c_y = self.cross_section.get("c_y") + self._c_z = self.cross_section.get("c_z") + self._torsion_modulus = self.cross_section.get("torsion_modulus") + + def set_linear_nodal_offsets(self, offsets) -> None: + """Global node-to-centroid rigid arms for the linear static route only.""" + values=np.asarray(offsets,dtype=float) + if self.num_nodes!=2 or values.shape!=(2,3) or not np.all(np.isfinite(values)): + raise ValueError('linear beam offsets require two finite global vectors') + self._linear_nodal_offsets=values.copy() + + def _linear_rigid_arm_map(self) -> np.ndarray: + arm=np.eye(12) + for i,d in enumerate(getattr(self,'_linear_nodal_offsets',np.zeros((2,3)))): + x,y,z=d + arm[i*6:i*6+3,i*6+3:i*6+6]=np.array([[0,z,-y],[-z,0,x],[y,-x,0]]) + return arm + + def recover_linear_section_forces(self, mesh, displacements, material, stations): + """Global force/moment on a positive local-x cut; no beam distributed loads.""" + stations=np.asarray(stations,dtype=float) + if stations.ndim!=2 or stations.shape[1]!=3 or len(stations)==0 or not np.all(np.isfinite(stations)): + raise ValueError('beam stations must be nonempty finite Nx3 coordinates') + coords=self.get_node_coordinates(mesh) + length,transform=self._beam_frame_and_transform(coords) + local=transform@self._get_element_displacements(mesh,displacements) + end=self._local_linear_stiffness(length,material)@local + rotation=_beam_rotation_matrix((coords[1]-coords[0])/length,self._orientation) + output=[] + for station in stations: + distance=float(np.dot(station-coords[0],rotation[:,0])) + if distance < -1e-6 or distance>length+1e-6 or np.linalg.norm(station-(coords[0]+distance*rotation[:,0]))>1e-6: + raise ValueError('beam result station is not on physical centroid line') + force=-end[:3] + moment=-end[3:6]+np.cross([distance,0,0],end[:3]) + output.append(np.r_[rotation@force,rotation@moment]) + return np.asarray(output) + + def _refuse_offset_route(self, route): + if np.any(getattr(self,'_linear_nodal_offsets',0)): + raise ValueError(f'offset beam {route} is not admitted; linear static only') + + def _fiber_distances(self) -> Tuple[float, float]: + """Extreme fiber distances (local y, local z), estimated when not given.""" + c_y = self._c_y + c_z = self._c_z + if c_y is None or c_y <= 0.0: + c_y = np.sqrt(abs(self._Iz) / max(self._A, _SMALL)) * 2.0 + if c_z is None or c_z <= 0.0: + c_z = np.sqrt(abs(self._Iy) / max(self._A, _SMALL)) * 2.0 + return max(float(c_y), _SMALL), max(float(c_z), _SMALL) + + def _torsion_section_modulus(self) -> float: + """Torsional section modulus Wt with tau = T / Wt, estimated when not given.""" + wt = self._torsion_modulus + if wt is None or wt <= 0.0: + wt = 2.0 * self._A + return max(float(wt), _SMALL) + + def _geometric_polar_radius_squared(self) -> float: + """Return the section polar radius squared used by the Wagner term. + + The legacy scalar section defines this quantity as ``(Iy + Iz) / A``. + A generalized 6x6 stiffness does not uniquely define any of those + geometric quantities, even when legacy keys happen to be present for + mass fallback or other workflows. Generalized sections therefore + require an explicitly named geometric value and otherwise omit the + Wagner term. + """ + if self.generalized_section is None: + return (self._Iy + self._Iz) / max(self._A, 1.0e-30) + + value = self.cross_section.get("geometric_polar_radius_squared") + if value is None: + return 0.0 + try: + polar_radius_squared = float(value) + except (TypeError, ValueError) as exc: + raise ValueError( + "cross_section['geometric_polar_radius_squared'] must be a " + "finite non-negative value in m^2 for a generalized beam " + "section." + ) from exc + if ( + not np.isfinite(polar_radius_squared) + or polar_radius_squared < 0.0 + ): + raise ValueError( + "cross_section['geometric_polar_radius_squared'] must be a " + "finite non-negative value in m^2 for a generalized beam " + "section." + ) + return polar_radius_squared + + @property + def num_nodes(self) -> int: + return 2 + + @property + def dofs_per_node(self) -> int: + return 6 + + def get_node_coordinates(self, mesh: "FEMesh") -> np.ndarray: + coords = np.zeros((2, 3), dtype=float) + for i, node_id in enumerate(self.node_ids): + node = mesh.get_node(node_id) + if node is None: + raise ValueError(f"Beam element {self.element_id} references missing node {node_id}") + coords[i] = node.coords() + return coords+getattr(self,'_linear_nodal_offsets',0) + + def _beam_frame_and_transform(self, coords: np.ndarray) -> Tuple[float, np.ndarray]: + length = float(np.linalg.norm(coords[1] - coords[0])) + if length < _SMALL: + raise ValueError(f"Beam element {self.element_id} has near-zero length") + e1 = (coords[1] - coords[0]) / length + R = _beam_rotation_matrix(e1, self._orientation) + T = np.zeros((12, 12), dtype=float) + Rt = R.T + for i in range(2): + b = i * 6 + T[b:b + 3, b:b + 3] = Rt + T[b + 3:b + 6, b + 3:b + 6] = Rt + return length, T@self._linear_rigid_arm_map() + + def _local_linear_stiffness(self, length: float, material: "Material", include_axial: bool = True) -> np.ndarray: + L = float(length) + if self.generalized_section is not None: + section_stiffness = generalized_beam_stiffness( + self.generalized_section + ) + basic_transform = _beam2_basic_deformation_matrix(L) + if not include_axial: + basic_transform = basic_transform.copy() + basic_transform[0, :] = 0.0 + _flexibility, basic_stiffness = ( + _beam2_generalized_flexibility(L, section_stiffness) + ) + # Force-based integration satisfies beam equilibrium exactly and + # avoids shear locking. For a diagonal section matrix this + # reduces to the historical closed-form Timoshenko stiffness; + # off-diagonal terms retain all generalized couplings. + return ( + basic_transform.T + @ basic_stiffness + @ basic_transform + ) + E, G12, G13, GJ = _beam_material_properties(material, self.cross_section) + EA = E * self._A + EIy = E * self._Iy + EIz = E * self._Iz + K = np.zeros((12, 12), dtype=float) + if include_axial: + K[0, 0] = K[6, 6] = EA / L + K[0, 6] = K[6, 0] = -EA / L + + # Bending about local y: deflection w (local z), rotation ry, EIy, + # Timoshenko shear parameter from the local-z shear area. + phi_w = 12.0 * EIy / max(G13 * self._A * self._kz * L**2, _SMALL) + K[2, 2] = K[8, 8] = 12.0 * EIy / (L**3 * (1.0 + phi_w)) + K[2, 8] = K[8, 2] = -K[2, 2] + K[2, 4] = K[4, 2] = -6.0 * EIy / (L**2 * (1.0 + phi_w)) + K[2, 10] = K[10, 2] = K[2, 4] + K[8, 4] = K[4, 8] = -K[2, 4] + K[8, 10] = K[10, 8] = -K[2, 4] + K[4, 4] = K[10, 10] = (4.0 + phi_w) * EIy / (L * (1.0 + phi_w)) + K[4, 10] = K[10, 4] = (2.0 - phi_w) * EIy / (L * (1.0 + phi_w)) + + # Bending about local z: deflection v (local y), rotation rz, EIz, + # Timoshenko shear parameter from the local-y shear area. + phi_v = 12.0 * EIz / max(G12 * self._A * self._ky * L**2, _SMALL) + K[1, 1] = K[7, 7] = 12.0 * EIz / (L**3 * (1.0 + phi_v)) + K[1, 7] = K[7, 1] = -K[1, 1] + K[1, 5] = K[5, 1] = 6.0 * EIz / (L**2 * (1.0 + phi_v)) + K[1, 11] = K[11, 1] = 6.0 * EIz / (L**2 * (1.0 + phi_v)) + K[7, 5] = K[5, 7] = -6.0 * EIz / (L**2 * (1.0 + phi_v)) + K[7, 11] = K[11, 7] = -6.0 * EIz / (L**2 * (1.0 + phi_v)) + K[5, 5] = K[11, 11] = (4.0 + phi_v) * EIz / (L * (1.0 + phi_v)) + K[5, 11] = K[11, 5] = (2.0 - phi_v) * EIz / (L * (1.0 + phi_v)) + + K[3, 3] = K[9, 9] = GJ / L + K[3, 9] = K[9, 3] = -GJ / L + return K + + def compute_stiffness_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: + coords = self.get_node_coordinates(mesh) + try: + L, T = self._beam_frame_and_transform(coords) + except ValueError: + if np.any(getattr(self,'_linear_nodal_offsets',0)): + raise + return np.zeros((self.total_dofs, self.total_dofs)) + K = self._local_linear_stiffness(L, material) + K_global = T.T @ K @ T + self._stiffness_matrix = K_global + return K_global + + def compute_mass_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: + self._refuse_offset_route('mass/dynamics') + coords = self.get_node_coordinates(mesh) + try: + L, T = self._beam_frame_and_transform(coords) + except ValueError: + return np.zeros((self.total_dofs, self.total_dofs)) + generalized_mass = ( + None + if self.generalized_section is None + else generalized_beam_mass_matrix(self.generalized_section) + ) + if generalized_mass is not None: + # Exact consistent integration of the linear interpolation. A + # full sectional inertia matrix may include centre-of-mass or + # product-of-inertia translation/rotation coupling, so diagonal + # lumping would discard part of the supplied constitutive data. + interpolation_mass = np.array( + [[1.0 / 3.0, 1.0 / 6.0], [1.0 / 6.0, 1.0 / 3.0]], + dtype=float, + ) + M = np.zeros((12, 12), dtype=float) + for i in range(2): + for j in range(2): + M[ + i * 6 : (i + 1) * 6, + j * 6 : (j + 1) * 6, + ] = interpolation_mass[i, j] * L * generalized_mass + M_global = T.T @ M @ T + self._mass_matrix = M_global + return M_global + rho = material.density + M = np.zeros((12, 12), dtype=float) + if bool(self.cross_section.get("consistent_mass", False)): + # Consistent mass on the element's own linear interpolation, + # mirroring the 3-node quadratic beam: N_i N_j blocks for the + # translations (rho A) and for each rotation with its matching + # section inertia (polar Iy+Iz for torsion). Rigid-body + # translational and rotational inertia are exact, so no lumped + # bar-length correction terms are needed. + coupling = np.array([[1.0 / 3.0, 1.0 / 6.0], [1.0 / 6.0, 1.0 / 3.0]], dtype=float) + rotary_density = ( + rho * (self._Iy + self._Iz), # rx (torsion) + rho * self._Iy, # ry + rho * self._Iz, # rz + ) + for i in range(2): + for j in range(2): + factor = coupling[i, j] * L + for d in range(3): + M[i * 6 + d, j * 6 + d] = rho * self._A * factor + M[i * 6 + 3 + d, j * 6 + 3 + d] = rotary_density[d] * factor + M_global = T.T @ M @ T + self._mass_matrix = M_global + return M_global + mass_per_node = rho * self._A * L / 2.0 + # Lumped rotary inertia: bending rotations carry the rigid-bar term + # rho*A*L^3/24 plus the section rotatory term rho*I*L/2; the torsion + # DOF carries the polar section inertia rho*(Iy+Iz)*L/2, not a + # bar-length term, because spinning about the member axis does not + # translate the distributed mass. + rotary_bar = mass_per_node * L**2 / 12.0 + rotary = ( + rho * (self._Iy + self._Iz) * L / 2.0, # rx (torsion) + rotary_bar + rho * self._Iy * L / 2.0, # ry + rotary_bar + rho * self._Iz * L / 2.0, # rz + ) + for i in range(2): + b = i * 6 + for d in range(3): + M[b + d, b + d] = mass_per_node + M[b + 3 + d, b + 3 + d] = rotary[d] + M_global = T.T @ M @ T + self._mass_matrix = M_global + return M_global + + @staticmethod + def _axial_compression_from_state(state: Optional[Any]) -> float: + """Return positive compression from a user/reference element state.""" + if state is None: + return 0.0 + if isinstance(state, (int, float, np.number)): + return float(state) + if not isinstance(state, dict): + return 0.0 + + for key in ("axial_compression", "compression", "N_compression"): + if key in state: + return float(state[key]) + + for key in ("axial_force", "N", "reference_axial_force"): + if key in state: + # Stress recovery uses positive axial strain/stress in tension, + # so a negative axial force is destabilizing compression. + return -float(state[key]) + return 0.0 + + def compute_geometric_stiffness_matrix( + self, + mesh: "FEMesh", + material: "Material", + state: Optional[Any] = None, + ) -> np.ndarray: + """ + Beam-column geometric stiffness for an axial reference compression. + + The returned matrix follows ``K phi = lambda KG phi``. A positive + ``axial_compression`` in ``state`` therefore produces a positive + destabilizing ``KG``. + """ + self._refuse_offset_route('geometric stiffness') + axial_compression = self._axial_compression_from_state(state) + if axial_compression == 0.0: + return np.zeros((self.total_dofs, self.total_dofs), dtype=float) + + coords = self.get_node_coordinates(mesh) + try: + L, T = self._beam_frame_and_transform(coords) + except ValueError: + return np.zeros((self.total_dofs, self.total_dofs), dtype=float) + + factor = axial_compression / (30.0 * L) + L2 = L * L + g_standard = factor * np.array( + [ + [36.0, 3.0 * L, -36.0, 3.0 * L], + [3.0 * L, 4.0 * L2, -3.0 * L, -L2], + [-36.0, -3.0 * L, 36.0, -3.0 * L], + [3.0 * L, -L2, -3.0 * L, 4.0 * L2], + ], + dtype=float, + ) + + K_geo = np.zeros((12, 12), dtype=float) + v_rz = [1, 5, 7, 11] + w_ry = [2, 4, 8, 10] + sign_w = np.diag([1.0, -1.0, 1.0, -1.0]) + g_w = sign_w @ g_standard @ sign_w + + for i, row in enumerate(v_rz): + for j, col in enumerate(v_rz): + K_geo[row, col] += g_standard[i, j] + for i, row in enumerate(w_ry): + for j, col in enumerate(w_ry): + K_geo[row, col] += g_w[i, j] + + # Wagner term: axial compression destabilizes twist about the shear + # center, enabling torsional and flexural-torsional column modes + # (stiffener tripping under axial stress). The shear center is taken + # at the centroid and warping is neglected, consistent with the + # element's St. Venant torsion treatment, so the torsional critical + # load is G*J*A/Ip. + polar_ratio = self._geometric_polar_radius_squared() + g_torsion = axial_compression * polar_ratio / L + K_geo[3, 3] += g_torsion + K_geo[3, 9] -= g_torsion + K_geo[9, 3] -= g_torsion + K_geo[9, 9] += g_torsion + + return T.T @ K_geo @ T + + def _fiber_plasticity_config(self, material: "Material") -> Optional[FiberSectionPlasticityConfig]: + config = self._fiber_plasticity + if config is None: + return None + if isinstance(config, dict): + config = FiberSectionPlasticityConfig(**config) + elif config is True: + config = FiberSectionPlasticityConfig() + elif not isinstance(config, FiberSectionPlasticityConfig): + raise TypeError("cross_section['fiber_plasticity'] must be a FiberSectionPlasticityConfig, dict or True") + curve = config.material_curve or getattr(material, "hardening_curve", None) + if curve is None: + if ( + _elastic_symmetry(material) == "orthotropic" + and getattr(material, "hill_yield", None) is not None + ): + # Hill X supplies an elastic-perfectly-plastic longitudinal + # fiber law when no scalar hardening curve is provided. + return config + return None + if config.material_curve is curve: + return config + return FiberSectionPlasticityConfig(config.num_y, config.num_z, curve) + + def _fiber_section_grid(self, config: FiberSectionPlasticityConfig) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + cross = self.cross_section if isinstance(getattr(self, "cross_section", None), dict) else {} + web_height = float(cross.get("web_height") or 0.0) + web_thickness = float(cross.get("web_thickness") or 0.0) + flange_width = float(cross.get("flange_width") or 0.0) + flange_thickness = float(cross.get("flange_thickness") or 0.0) + shaped = ( + web_height > 0.0 + and web_thickness > 0.0 + and flange_width > 0.0 + and flange_thickness > 0.0 + ) + key = ( + "fiber_grid", + int(config.num_y), + int(config.num_z), + float(self._A), + float(self._Iy), + float(self._Iz), + round(web_height, 12), + round(web_thickness, 12), + round(flange_width, 12), + round(flange_thickness, 12), + ) + cache = getattr(self, "_fiber_grid_cache", None) + if cache is not None and cache.get("key") == key: + return cache["y"], cache["z"], cache["weights"] + + if shaped: + # Profile-true fiber layout: web and flange strips follow the real + # T/L section geometry so the plastification order (flange tips vs + # web) is captured. The coordinates and weights are afterwards + # recentred and rescaled to reproduce the section constants + # A/Iy/Iz exactly, keeping the elastic response identical to the + # section-property idealization. Flanges are laid out symmetric + # in y also for L profiles (the section constants carry no product + # of inertia). + n_web = max(int(config.num_z), 3) + n_flange = max(int(config.num_y), 3) + web_z = (np.arange(n_web, dtype=float) + 0.5) * (web_height / n_web) + y_parts = [np.zeros(n_web)] + z_parts = [web_z] + weight_parts = [np.full(n_web, web_height * web_thickness / n_web)] + flange_y = (np.arange(n_flange, dtype=float) + 0.5) * (flange_width / n_flange) - 0.5 * flange_width + for z_level in (web_height + 0.25 * flange_thickness, web_height + 0.75 * flange_thickness): + y_parts.append(flange_y.copy()) + z_parts.append(np.full(n_flange, z_level)) + weight_parts.append(np.full(n_flange, flange_width * flange_thickness / (2 * n_flange))) + y = np.concatenate(y_parts) + z = np.concatenate(z_parts) + weights = np.concatenate(weight_parts) + total = float(np.sum(weights)) + if total > _SMALL and self._A > 0.0: + weights *= float(self._A) / total + area = float(np.sum(weights)) + if area > _SMALL: + y = y - float(np.sum(weights * y)) / area + z = z - float(np.sum(weights * z)) / area + else: + raw_y = np.linspace(-1.0, 1.0, int(config.num_y)) if config.num_y > 1 else np.zeros(1) + raw_z = np.linspace(-1.0, 1.0, int(config.num_z)) if config.num_z > 1 else np.zeros(1) + yy, zz = np.meshgrid(raw_y, raw_z, indexing="ij") + y = yy.reshape(-1) + z = zz.reshape(-1) + weights = np.full(y.size, float(self._A) / max(y.size, 1), dtype=float) + + denom_y = float(np.sum(weights * y * y)) + denom_z = float(np.sum(weights * z * z)) + if denom_y > _SMALL and self._Iz > 0.0: + y *= np.sqrt(float(self._Iz) / denom_y) + else: + y *= 0.0 + if denom_z > _SMALL and self._Iy > 0.0: + z *= np.sqrt(float(self._Iy) / denom_z) + else: + z *= 0.0 + + self._fiber_grid_cache = {"key": key, "y": y, "z": z, "weights": weights} + return y, z, weights + + @staticmethod + def _uniaxial_return_map( + strain: np.ndarray, + state: Optional[Any], + E: float, + curve: Any, + flow_scale: float = 1.0, + ) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]: + strain = np.asarray(strain, dtype=float).reshape(-1) + n = strain.size + if isinstance(state, dict) and np.asarray(state.get("plastic_strain", [])).size == n: + plastic_old = np.asarray(state["plastic_strain"], dtype=float).reshape(-1) + alpha_old = np.asarray(state.get("alpha", np.zeros(n)), dtype=float).reshape(-1) + if alpha_old.size == 1: + alpha_old = np.full(n, float(alpha_old[0]), dtype=float) + elif alpha_old.size != n: + raise ValueError( + f"Beam fiber alpha has {alpha_old.size} entries; expected 1 or {n}" + ) + else: + plastic_old = np.zeros(n, dtype=float) + alpha_old = np.zeros(n, dtype=float) + + trial = E * (strain - plastic_old) + abs_trial = np.abs(trial) + scale = float(flow_scale) + if not np.isfinite(scale) or scale <= 0.0: + raise ValueError("beam fiber flow_scale must be positive") + flow_old = ( + np.full(n, scale, dtype=float) + if curve is None + else scale * curve.flow_stress(alpha_old) + ) + yielding = abs_trial > flow_old + 1.0e-9 * np.maximum(flow_old, 1.0) + + stress = trial.copy() + tangent = np.full(n, E, dtype=float) + plastic_new = plastic_old.copy() + alpha_new = alpha_old.copy() + if not np.any(yielding): + return stress, tangent, plastic_new, alpha_new + + indices = np.where(yielding)[0] + for idx in indices: + sign = 1.0 if trial[idx] >= 0.0 else -1.0 + dgamma = 0.0 + lower = 0.0 + upper = abs_trial[idx] / E + H = ( + 0.0 + if curve is None + else scale + * float( + curve.hardening_modulus(np.array([alpha_old[idx]]))[0] + ) + ) + converged = False + for _ in range(30): + alpha_trial = alpha_old[idx] + dgamma + if curve is None: + sy = scale + H = 0.0 + else: + sy = scale * float( + curve.flow_stress(np.array([alpha_trial]))[0] + ) + H = scale * float( + curve.hardening_modulus(np.array([alpha_trial]))[0] + ) + residual = abs_trial[idx] - E * dgamma - sy + # At very large trial strains, ``abs_trial - E * dgamma`` + # loses several hundred pascals to floating-point cancellation. + # Do not demand a residual below the resolution of the terms + # being subtracted. The physical tolerance remains governing + # for ordinary structural strain ranges. + roundoff_tolerance = 16.0 * np.finfo(float).eps * max( + abs_trial[idx], abs(E * dgamma), abs(sy), 1.0 + ) + convergence_tolerance = max( + 1.0e-8 * max(abs(sy), 1.0), roundoff_tolerance + ) # Yield entry is tighter than the closure tolerance. A point # admitted as yielding must take a positive return update # before reporting a plastic tangent; otherwise its unchanged # elastic stress has derivative E, not E*H/(E+H). if dgamma > 0.0 and abs(residual) <= convergence_tolerance: - converged = True - break - if residual > 0.0: - lower = dgamma - else: - upper = dgamma - newton = dgamma + residual / max(E + H, _SMALL) - if ( - not np.isfinite(newton) - or newton <= lower - or newton >= upper - ): - newton = 0.5 * (lower + upper) - dgamma = newton - if not converged: - raise RuntimeError( - "Beam fiber return mapping did not converge after 30 iterations" - ) - stress[idx] = sign * max(abs_trial[idx] - E * dgamma, 0.0) - plastic_new[idx] = plastic_old[idx] + sign * dgamma - alpha_new[idx] = alpha_old[idx] + dgamma - tangent[idx] = E * H / max(E + H, _SMALL) - return stress, tangent, plastic_new, alpha_new - - def _compute_fiber_nonlinear_response( - self, - mesh: "FEMesh", - material: "Material", - u_elem: np.ndarray, - state: Optional[Any], - config: FiberSectionPlasticityConfig, - tangent: bool, - ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: - coords = self.get_node_coordinates(mesh) - L, T = self._beam_frame_and_transform(coords) - u_loc = T @ np.asarray(u_elem, dtype=float) - E, G12, G13, GJ = _beam_material_properties(material, self.cross_section) - y, z, weights = self._fiber_section_grid(config) - - du = u_loc[6] - u_loc[0] - dv = u_loc[7] - u_loc[1] - dw = u_loc[8] - u_loc[2] - eps0 = du / L + (dv**2 + dw**2) / (2.0 * L**2) - kappa_y = (u_loc[10] - u_loc[4]) / L - kappa_z = (u_loc[11] - u_loc[5]) / L - fiber_strain = eps0 + z * kappa_y + y * kappa_z - initial_state = _copy_state_fields(state, _INITIAL_BEAM_STATE_KEYS) - initial_stress = _beam_fiber_field( - initial_state.get("initial_fiber_stress", 0.0), - fiber_strain.size, - fiber_strain.size, - "initial_fiber_stress", - ) - initial_prestrain = _beam_fiber_field( - initial_state.get("initial_fiber_prestrain", 0.0), - fiber_strain.size, - fiber_strain.size, - "initial_fiber_prestrain", - ) - constitutive_fiber_strain = fiber_strain - initial_prestrain + initial_stress / E - stress, Et, plastic_new, alpha_new = self._uniaxial_return_map( - constitutive_fiber_strain, - state, - E, - config.material_curve, - _beam_flow_scale(material, config.material_curve), - ) - - B = np.zeros((fiber_strain.size, 12), dtype=float) - B[:, 0] = -1.0 / L - B[:, 6] = 1.0 / L - B[:, 1] = -dv / L**2 - B[:, 7] = dv / L**2 - B[:, 2] = -dw / L**2 - B[:, 8] = dw / L**2 - B[:, 4] = -z / L - B[:, 10] = z / L - B[:, 5] = -y / L - B[:, 11] = y / L - - F_loc = L * np.einsum("i,i,ij->j", weights, stress, B) - K_loc = None - if tangent: - K_loc = L * np.einsum("i,i,ij,ik->jk", weights, Et, B, B) - - N_force = float(np.sum(weights * stress)) - if tangent: - string = N_force / L - for a, b in ((1, 7), (2, 8)): - K_loc[a, a] += string - K_loc[b, b] += string - K_loc[a, b] -= string - K_loc[b, a] -= string - - B_shear_y = np.zeros(12, dtype=float) - B_shear_y[1], B_shear_y[7] = -1.0 / L, 1.0 / L - B_shear_y[5], B_shear_y[11] = -0.5, -0.5 - B_shear_z = np.zeros(12, dtype=float) - B_shear_z[2], B_shear_z[8] = -1.0 / L, 1.0 / L - B_shear_z[4], B_shear_z[10] = 0.5, 0.5 - B_torsion = np.zeros(12, dtype=float) - B_torsion[3], B_torsion[9] = -1.0 / L, 1.0 / L + converged = True + break + if residual > 0.0: + lower = dgamma + else: + upper = dgamma + newton = dgamma + residual / max(E + H, _SMALL) + if ( + not np.isfinite(newton) + or newton <= lower + or newton >= upper + ): + newton = 0.5 * (lower + upper) + dgamma = newton + if not converged: + raise RuntimeError( + "Beam fiber return mapping did not converge after 30 iterations" + ) + stress[idx] = sign * max(abs_trial[idx] - E * dgamma, 0.0) + plastic_new[idx] = plastic_old[idx] + sign * dgamma + alpha_new[idx] = alpha_old[idx] + dgamma + tangent[idx] = E * H / max(E + H, _SMALL) + return stress, tangent, plastic_new, alpha_new + + def _compute_fiber_nonlinear_response( + self, + mesh: "FEMesh", + material: "Material", + u_elem: np.ndarray, + state: Optional[Any], + config: FiberSectionPlasticityConfig, + tangent: bool, + ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: + coords = self.get_node_coordinates(mesh) + L, T = self._beam_frame_and_transform(coords) + u_loc = T @ np.asarray(u_elem, dtype=float) + E, G12, G13, GJ = _beam_material_properties(material, self.cross_section) + y, z, weights = self._fiber_section_grid(config) + + du = u_loc[6] - u_loc[0] + dv = u_loc[7] - u_loc[1] + dw = u_loc[8] - u_loc[2] + eps0 = du / L + (dv**2 + dw**2) / (2.0 * L**2) + kappa_y = (u_loc[10] - u_loc[4]) / L + kappa_z = (u_loc[11] - u_loc[5]) / L + fiber_strain = eps0 + z * kappa_y + y * kappa_z + initial_state = _copy_state_fields(state, _INITIAL_BEAM_STATE_KEYS) + initial_stress = _beam_fiber_field( + initial_state.get("initial_fiber_stress", 0.0), + fiber_strain.size, + fiber_strain.size, + "initial_fiber_stress", + ) + initial_prestrain = _beam_fiber_field( + initial_state.get("initial_fiber_prestrain", 0.0), + fiber_strain.size, + fiber_strain.size, + "initial_fiber_prestrain", + ) + constitutive_fiber_strain = fiber_strain - initial_prestrain + initial_stress / E + stress, Et, plastic_new, alpha_new = self._uniaxial_return_map( + constitutive_fiber_strain, + state, + E, + config.material_curve, + _beam_flow_scale(material, config.material_curve), + ) + + B = np.zeros((fiber_strain.size, 12), dtype=float) + B[:, 0] = -1.0 / L + B[:, 6] = 1.0 / L + B[:, 1] = -dv / L**2 + B[:, 7] = dv / L**2 + B[:, 2] = -dw / L**2 + B[:, 8] = dw / L**2 + B[:, 4] = -z / L + B[:, 10] = z / L + B[:, 5] = -y / L + B[:, 11] = y / L + + F_loc = L * np.einsum("i,i,ij->j", weights, stress, B) + K_loc = None + if tangent: + K_loc = L * np.einsum("i,i,ij,ik->jk", weights, Et, B, B) + + N_force = float(np.sum(weights * stress)) + if tangent: + string = N_force / L + for a, b in ((1, 7), (2, 8)): + K_loc[a, a] += string + K_loc[b, b] += string + K_loc[a, b] -= string + K_loc[b, a] -= string + + B_shear_y = np.zeros(12, dtype=float) + B_shear_y[1], B_shear_y[7] = -1.0 / L, 1.0 / L + B_shear_y[5], B_shear_y[11] = -0.5, -0.5 + B_shear_z = np.zeros(12, dtype=float) + B_shear_z[2], B_shear_z[8] = -1.0 / L, 1.0 / L + B_shear_z[4], B_shear_z[10] = 0.5, 0.5 + B_torsion = np.zeros(12, dtype=float) + B_torsion[3], B_torsion[9] = -1.0 / L, 1.0 / L # The one-section fiber state resolves constant curvature. The # remaining elastic curvature/shear compliance must be condensed just # as in _local_linear_stiffness: 1/S_eff = 1/S + L^2/(12*EI). @@ -4441,978 +4441,978 @@ def _compute_fiber_nonlinear_response( phi_z = 12.0 * E * self._Iy / max(G13 * self._A * self._kz * L**2, _SMALL) shear_y = 12.0 * E * self._Iz / (L**2 * (1.0 + phi_y)) shear_z = 12.0 * E * self._Iy / (L**2 * (1.0 + phi_z)) - K_aux = L * ( + K_aux = L * ( shear_y * np.outer(B_shear_y, B_shear_y) + shear_z * np.outer(B_shear_z, B_shear_z) - + GJ * np.outer(B_torsion, B_torsion) - ) - F_loc += K_aux @ u_loc - if tangent: - K_loc += K_aux - - trial_state = { - "plastic_strain": plastic_new, - "alpha": alpha_new, - "fiber_strain": constitutive_fiber_strain.copy(), - "kinematic_fiber_strain": fiber_strain.copy(), - "fiber_stress": stress.copy(), - "axial_force": N_force, - "equivalent_stress_measure": ( - "hill48" if _elastic_symmetry(material) == "orthotropic" else "von_mises" - ), - **initial_state, - } - if not tangent: - return T.T @ F_loc, None, trial_state - return T.T @ F_loc, T.T @ K_loc @ T, trial_state - - def _current_beam_frame_and_transform(self, coords: np.ndarray, u_elem: np.ndarray) -> Tuple[float, np.ndarray, np.ndarray, np.ndarray]: - current = coords.copy() - current[0] += np.asarray(u_elem[0:3], dtype=float) - current[1] += np.asarray(u_elem[6:9], dtype=float) - length = float(np.linalg.norm(current[1] - current[0])) - if length < _SMALL: - raise ValueError(f"Beam element {self.element_id} has near-zero current length") - e1 = (current[1] - current[0]) / length - R = _beam_rotation_matrix(e1, self._orientation) - T = np.zeros((12, 12), dtype=float) - Rt = R.T - for i in range(2): - b = i * 6 - T[b:b + 3, b:b + 3] = Rt - T[b + 3:b + 6, b + 3:b + 6] = Rt - return length, T, R, current - - def _compute_corotational_nonlinear_response( - self, - mesh: "FEMesh", - material: "Material", - u_elem: np.ndarray, - state: Optional[Any], - tangent: bool, - ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: - """Elastic 2-node corotational beam response. - - The element frame follows the current chord. Rigid-body chord rotation - is subtracted from nodal rotations, so a finite rigid rotation with - matching nodal rotation vectors produces near-zero internal force. - """ - coords = self.get_node_coordinates(mesh) - L0, _T0 = self._beam_frame_and_transform(coords) - Lc, Tc, Rc, _current = self._current_beam_frame_and_transform(coords, np.asarray(u_elem, dtype=float)) - R0 = _beam_rotation_matrix((coords[1] - coords[0]) / L0, self._orientation) - rigid_rotation = _rotation_vector_from_matrix(Rc @ R0.T) - - u_global = np.asarray(u_elem, dtype=float).reshape(12) - q = np.zeros(12, dtype=float) - q[6] = Lc - L0 - q[3:6] = Rc.T @ (u_global[3:6] - rigid_rotation) - q[9:12] = Rc.T @ (u_global[9:12] - rigid_rotation) - - K_loc = self._local_linear_stiffness(L0, material) - F_loc = K_loc @ q - F_global = Tc.T @ F_loc - trial_state = { - "geometric_nonlinearity": "corotational", - "initial_length": float(L0), - "current_length": float(Lc), - "axial_extension": float(Lc - L0), - "rigid_rotation_vector": rigid_rotation.copy(), - "basic_deformation_norm": float(np.linalg.norm(q)), - } - if self.generalized_section is not None: - section_stiffness = generalized_beam_stiffness( - self.generalized_section - ) - basic_deformation = ( - _beam2_basic_deformation_matrix(L0) @ q - ) - _flexibility, basic_stiffness = ( - _beam2_generalized_flexibility( - L0, - section_stiffness, - ) - ) - basic_force = basic_stiffness @ basic_deformation - stations = np.array((-1.0, 0.0, 1.0), dtype=float) - generalized_resultant = np.asarray( - [ - _beam2_force_interpolation(L0, xi) @ basic_force - for xi in stations - ], - dtype=float, - ) - generalized_strain = ( - generalized_resultant - @ np.linalg.inv(section_stiffness).T - ) - trial_state.update( - { - "generalized_section": True, - "generalized_strain": generalized_strain.copy(), - "generalized_resultant": generalized_resultant.copy(), - "generalized_station_coordinates": stations, - "generalized_strain_order": GENERALIZED_BEAM_STRAIN_ORDER, - "generalized_resultant_order": ( - GENERALIZED_BEAM_RESULTANT_ORDER - ), - "axial_force": float( - np.mean(generalized_resultant[:, 0]) - ), - "recovery_scope": "section_resultants_only", - } - ) - if not tangent: - return F_global, None, trial_state - K_global = Tc.T @ K_loc @ Tc - return F_global, K_global, trial_state - - def _compute_generalized_von_karman_response( - self, - mesh: "FEMesh", - u_elem: np.ndarray, - state: Optional[Any], - tangent: bool, - ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: - """Coupled generalized-section response from one strain-energy law.""" - - coords = self.get_node_coordinates(mesh) - L, T = self._beam_frame_and_transform(coords) - u_loc = T @ np.asarray(u_elem, dtype=float) - basic_transform = _beam2_basic_deformation_matrix(L) - basic_deformation = basic_transform @ u_loc - dv = float(u_loc[7] - u_loc[1]) - dw = float(u_loc[8] - u_loc[2]) - basic_deformation[0] += (dv**2 + dw**2) / (2.0 * L) - basic_tangent = basic_transform.copy() - basic_tangent[0, 1], basic_tangent[0, 7] = -dv / L, dv / L - basic_tangent[0, 2], basic_tangent[0, 8] = -dw / L, dw / L - - section_stiffness = generalized_beam_stiffness( - self.generalized_section - ) - _flexibility, basic_stiffness = _beam2_generalized_flexibility( - L, - section_stiffness, - ) - basic_force = basic_stiffness @ basic_deformation - F_loc = basic_tangent.T @ basic_force - stations = np.array((-1.0, 0.0, 1.0), dtype=float) - generalized_resultant = np.asarray( - [ - _beam2_force_interpolation(L, xi) @ basic_force - for xi in stations - ], - dtype=float, - ) - generalized_strain = ( - generalized_resultant @ np.linalg.inv(section_stiffness).T - ) - trial_state = { - **(dict(state) if isinstance(state, dict) else {}), - "generalized_section": True, - "geometric_nonlinearity": "von_karman", - "generalized_strain": generalized_strain.copy(), - "generalized_resultant": generalized_resultant.copy(), - "generalized_station_coordinates": stations, - "generalized_strain_order": GENERALIZED_BEAM_STRAIN_ORDER, - "generalized_resultant_order": GENERALIZED_BEAM_RESULTANT_ORDER, - "axial_force": float(np.mean(generalized_resultant[:, 0])), - "recovery_scope": "section_resultants_only", - } - if not tangent: - return T.T @ F_loc, None, trial_state - - K_loc = basic_tangent.T @ basic_stiffness @ basic_tangent - # Hessian of the von Karman axial extension, multiplied by N. - string = float(basic_force[0]) / L - for a, b in ((1, 7), (2, 8)): - K_loc[a, a] += string - K_loc[b, b] += string - K_loc[a, b] -= string - K_loc[b, a] -= string - return T.T @ F_loc, T.T @ K_loc @ T, trial_state - - def compute_nonlinear_response( - self, - mesh: "FEMesh", - material: "Material", - u_elem: np.ndarray, - state: Optional[Any] = None, - num_layers: int = 5, - tangent: bool = True, - ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: - """Elastic beam-column response with von Karman axial coupling. - - The axial strain includes the transverse-displacement rotation terms - - eps = (u2-u1)/L + ((v2-v1)^2 + (w2-w1)^2) / (2 L^2) - - which gives the P-delta string effect consistently (internal force - and tangent from the same potential). Bending, shear and torsion - remain linear elastic unless ``cross_section["fiber_plasticity"]`` is - provided, in which case axial/bending response is integrated over a - uniaxial fiber section using the material hardening curve. - """ - self._refuse_offset_route('nonlinear response') - if self._geometric_nonlinearity in {"corotational", "co_rotational", "corot"}: - return self._compute_corotational_nonlinear_response( - mesh, material, u_elem, state, tangent - ) - - if self.generalized_section is not None: - return self._compute_generalized_von_karman_response( - mesh, - u_elem, - state, - tangent, - ) - - fiber_config = self._fiber_plasticity_config(material) - if fiber_config is not None: - return self._compute_fiber_nonlinear_response( - mesh, material, u_elem, state, fiber_config, tangent - ) - - cache = getattr(self, "_nl_cache", None) - if cache is None: - coords = self.get_node_coordinates(mesh) - L, T = self._beam_frame_and_transform(coords) - K_global = self.compute_stiffness_matrix(mesh, material) - K_loc = T @ K_global @ T.T - # Remove the linear axial block; the von Karman axial response - # replaces it entirely. - for i in (0, 6): - K_loc[i, :] = 0.0 - K_loc[:, i] = 0.0 - E1, _G12, _G13, _GJ = _beam_material_properties( - material, - self.cross_section, - ) - cache = {"L": L, "T": T, "K_noax": K_loc, "EA": E1 * self._A} - self._nl_cache = cache - - L = cache["L"] - T = cache["T"] - EA = cache["EA"] - u_loc = T @ np.asarray(u_elem, dtype=float) - - du = u_loc[6] - u_loc[0] - dv = u_loc[7] - u_loc[1] - dw = u_loc[8] - u_loc[2] - eps = du / L + (dv**2 + dw**2) / (2.0 * L**2) - N_force = EA * eps - - d_eps = np.zeros(12, dtype=float) - d_eps[0], d_eps[6] = -1.0 / L, 1.0 / L - d_eps[1], d_eps[7] = -dv / L**2, dv / L**2 - d_eps[2], d_eps[8] = -dw / L**2, dw / L**2 - - F_loc = cache["K_noax"] @ u_loc + N_force * L * d_eps - if not tangent: - return T.T @ F_loc, None, state - K_loc = cache["K_noax"] + EA * L * np.outer(d_eps, d_eps) - string = N_force / L - for a, b in ((1, 7), (2, 8)): - K_loc[a, a] += string - K_loc[b, b] += string - K_loc[a, b] -= string - K_loc[b, a] -= string - - return T.T @ F_loc, T.T @ K_loc @ T, state - - def _end_displacements(self, u_local: np.ndarray) -> Tuple[np.ndarray, np.ndarray]: - """Local DOF vectors of the two geometric end nodes.""" - return u_local[0:6], u_local[6:12] - - def compute_stresses( - self, - mesh: "FEMesh", - displacements: np.ndarray, - material: "Material", - return_global: bool = False, - ) -> Dict[str, Any]: - coords = self.get_node_coordinates(mesh) - try: - L, T = self._beam_frame_and_transform(coords) - except ValueError: - return {} - u_local = T @ self._get_element_displacements(mesh, displacements) - if self.generalized_section is not None: - section_stiffness = generalized_beam_stiffness( - self.generalized_section - ) - if isinstance(self, QuadraticBeamElement): - strain_rows = [] - for xi in self.GAUSS_POINTS: - shape, derivative_xi = self.compute_shape_functions( - float(xi) - ) - B = _beam_generalized_strain_matrix_from_shape( - shape, - derivative_xi * 2.0 / L, - ) - strain_rows.append(B @ u_local) - generalized_strain = np.asarray(strain_rows, dtype=float) - generalized_resultant = ( - generalized_strain @ section_stiffness.T - ) - return _generalized_beam_recovery( - generalized_strain, - generalized_resultant, - stations=np.asarray(self.GAUSS_POINTS, dtype=float), - ) - basic_transform = _beam2_basic_deformation_matrix(L) - basic_deformation = basic_transform @ u_local - _flexibility, basic_stiffness = ( - _beam2_generalized_flexibility(L, section_stiffness) - ) - basic_force = basic_stiffness @ basic_deformation - compliance = np.linalg.inv(section_stiffness) - stations = np.array((-1.0, 0.0, 1.0), dtype=float) - generalized_resultant = np.asarray( - [ - _beam2_force_interpolation(L, xi) @ basic_force - for xi in stations - ], - dtype=float, - ) - generalized_strain = generalized_resultant @ compliance.T - return _generalized_beam_recovery( - generalized_strain, - generalized_resultant, - stations=stations, - ) - E, G12, G13, GJ = _beam_material_properties(material, self.cross_section) - end_a, end_b = self._end_displacements(u_local) - u1, v1, w1, rx1, ry1, rz1 = end_a - u2, v2, w2, rx2, ry2, rz2 = end_b - sigma_axial = E * (u2 - u1) / L - kappa_z = (rz2 - rz1) / L - kappa_y = (ry2 - ry1) / L - M_z = E * self._Iz * kappa_z - M_y = E * self._Iy * kappa_y - c_y, c_z = self._fiber_distances() - sigma_bending_y = M_y * c_z / max(self._Iy, _SMALL) - sigma_bending_z = M_z * c_y / max(self._Iz, _SMALL) - gamma_xy = (v2 - v1) / L - 0.5 * (rz1 + rz2) - gamma_xz = (w2 - w1) / L + 0.5 * (ry1 + ry2) - tau_y = G12 * self._ky * gamma_xy - tau_z = G13 * self._kz * gamma_xz - tau_torsion = GJ * (rx2 - rx1) / L / self._torsion_section_modulus() - sigma_x = sigma_axial + sigma_bending_y + sigma_bending_z - von_mises = np.sqrt(sigma_x**2 + 3.0 * (tau_y**2 + tau_z**2 + tau_torsion**2)) - recovered = { - "axial_stress": sigma_axial, - "bending_stress_y": sigma_bending_y, - "bending_stress_z": sigma_bending_z, - "shear_stress_y": tau_y, - "shear_stress_z": tau_z, - "torsional_stress": tau_torsion, - "von_mises": von_mises, - } - hill_yield = getattr(material, "hill_yield", None) - if hill_yield is not None: - from .plasticity import hill48_equivalent_stress - - # Section recovery supplies envelopes rather than a resolved - # perimeter stress point. Include both directional transverse - # shears, and conservatively combine the torsional envelope with - # either x-y or x-z shear. - candidates = np.array( - [ - [sigma_x, 0.0, 0.0, 0.0, tau_z, tau_y], - [sigma_x, 0.0, 0.0, 0.0, tau_z, tau_y + tau_torsion], - [sigma_x, 0.0, 0.0, 0.0, tau_z, tau_y - tau_torsion], - [sigma_x, 0.0, 0.0, 0.0, tau_z + tau_torsion, tau_y], - [sigma_x, 0.0, 0.0, 0.0, tau_z - tau_torsion, tau_y], - ], - dtype=float, - ) - equivalent = float( - np.max(hill48_equivalent_stress(candidates, hill_yield)) - ) - recovered["equivalent_stress"] = equivalent - recovered["equivalent_stress_measure"] = "hill48" - recovered["hill_utilization"] = equivalent / max(float(hill_yield.X), _SMALL) - recovered["equivalent_stress_scope"] = ( - "conservative beam-local axial/shear/torsion envelope" - ) - else: - recovered["equivalent_stress"] = von_mises - recovered["equivalent_stress_measure"] = "von_mises" - return recovered - - -class QuadraticBeamElement(BeamElement): - """3-node quadratic Timoshenko beam element with 6 DOF per node.""" - - GAUSS_POINTS = np.array([-np.sqrt(3.0 / 5.0), 0.0, np.sqrt(3.0 / 5.0)], dtype=float) - GAUSS_WEIGHTS = np.array([5.0 / 9.0, 8.0 / 9.0, 5.0 / 9.0], dtype=float) - - def __init__( - self, - element_id: int, - node_ids: List[int], - material_name: str = "default", - cross_section: Optional[Dict[str, Any]] = None, - eccentricity: Optional[np.ndarray] = None, - section: Any = None, - ): - Element.__init__(self, element_id, node_ids, material_name) - if len(node_ids) != 3: - raise ValueError(f"QuadraticBeamElement requires 3 nodes, got {len(node_ids)}") - self.cross_section = cross_section or {} - self._A = self.cross_section.get("area", 0.01) - self._Iy = self.cross_section.get("Iy", 1.0e-8) - self._Iz = self.cross_section.get("Iz", 1.0e-8) - self._J = self.cross_section.get("J", 1.0e-8) - self._ky = self.cross_section.get("shear_factor_y", 5.0 / 6.0) - self._kz = self.cross_section.get("shear_factor_z", 5.0 / 6.0) - self._orientation = _section_orientation(self.cross_section) - self._c_y = self.cross_section.get("c_y") - self._c_z = self.cross_section.get("c_z") - self._torsion_modulus = self.cross_section.get("torsion_modulus") - self._fiber_plasticity = self.cross_section.get("fiber_plasticity") - self._geometric_nonlinearity = str( - self.cross_section.get( - "geometric_nonlinearity", - self.cross_section.get("geometry", "von_karman"), - ) - ).lower() - self.generalized_section = resolve_generalized_beam_section( - self.cross_section, - section, - ) - if self.generalized_section is not None and self._fiber_plasticity is not None: - raise ValueError( - "Generalized beam sections do not support " - "cross_section['fiber_plasticity']; supply an elastic section " - "without fiber plasticity." - ) - if self.generalized_section is not None: - self._geometric_polar_radius_squared() - if self.generalized_section is not None and self._geometric_nonlinearity in { - "corotational", - "co_rotational", - "corot", - }: - raise ValueError( - "QuadraticBeamElement does not support corotational kinematics " - "with a generalized beam section; use BeamElement or " - "geometric_nonlinearity='von_karman'." - ) - self.eccentricity = np.zeros(3, dtype=float) if eccentricity is None else np.asarray(eccentricity, dtype=float) - - def _end_displacements(self, u_local: np.ndarray) -> Tuple[np.ndarray, np.ndarray]: - # Geometric end nodes are 0 and 2; node 1 is the midside node. The - # end-difference over the full length equals the quadratic shape - # function derivative evaluated at the element centre. - return u_local[0:6], u_local[12:18] - - def _compute_generalized_von_karman_response_quadratic( - self, - length: float, - transform: np.ndarray, - u_local: np.ndarray, - state: Optional[Any], - tangent: bool, - ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: - """Quadratic coupled-section response and exact energy tangent.""" - - L = float(length) - section_stiffness = generalized_beam_stiffness( - self.generalized_section - ) - F_loc = np.zeros(18, dtype=float) - K_loc = np.zeros((18, 18), dtype=float) if tangent else None - strain_rows = [] - resultant_rows = [] - for xi, weight in zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS): - shape, derivative_xi = self.compute_shape_functions(float(xi)) - derivative_x = derivative_xi * 2.0 / L - B_linear = _beam_generalized_strain_matrix_from_shape( - shape, - derivative_x, - ) - B_v = np.zeros(18, dtype=float) - B_w = np.zeros(18, dtype=float) - for i in range(3): - B_v[i * 6 + 1] = derivative_x[i] - B_w[i * 6 + 2] = derivative_x[i] - v_gradient = float(B_v @ u_local) - w_gradient = float(B_w @ u_local) - - generalized_strain = B_linear @ u_local - generalized_strain[0] += 0.5 * ( - v_gradient**2 + w_gradient**2 - ) - B_tangent = B_linear.copy() - B_tangent[0, :] += ( - v_gradient * B_v + w_gradient * B_w - ) - generalized_resultant = ( - section_stiffness @ generalized_strain - ) - jacobian_weight = L / 2.0 * float(weight) - F_loc += ( - jacobian_weight - * (B_tangent.T @ generalized_resultant) - ) - if tangent: - K_loc += jacobian_weight * ( - B_tangent.T @ section_stiffness @ B_tangent - + float(generalized_resultant[0]) - * (np.outer(B_v, B_v) + np.outer(B_w, B_w)) - ) - strain_rows.append(generalized_strain.copy()) - resultant_rows.append(generalized_resultant.copy()) - - generalized_strains = np.asarray(strain_rows, dtype=float) - generalized_resultants = np.asarray(resultant_rows, dtype=float) - trial_state = { - **(dict(state) if isinstance(state, dict) else {}), - "generalized_section": True, - "geometric_nonlinearity": "von_karman", - "generalized_strain": generalized_strains, - "generalized_resultant": generalized_resultants, - "generalized_station_coordinates": np.asarray( - self.GAUSS_POINTS, - dtype=float, - ).copy(), - "generalized_strain_order": GENERALIZED_BEAM_STRAIN_ORDER, - "generalized_resultant_order": GENERALIZED_BEAM_RESULTANT_ORDER, - "axial_force": float( - np.mean(generalized_resultants[:, 0]) - ), - "recovery_scope": "section_resultants_only", - } - if not tangent: - return transform.T @ F_loc, None, trial_state - return ( - transform.T @ F_loc, - transform.T @ K_loc @ transform, - trial_state, - ) - - def compute_nonlinear_response( - self, - mesh: "FEMesh", - material: "Material", - u_elem: np.ndarray, - state: Optional[Any] = None, - num_layers: int = 5, - tangent: bool = True, - ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: - """Gauss-point von Karman beam-column response on the quadratic interpolation. - - At each integration point the axial strain includes the transverse - gradient coupling - - eps = u' + (v'^2 + w'^2) / 2 - - with all gradients from the quadratic shape functions, giving internal - force and consistent tangent (including the string/geometric term) from - the same potential. With ``cross_section["fiber_plasticity"]`` the - axial/bending response is integrated over the uniaxial fiber grid per - Gauss point using the material hardening curve; shear and torsion stay - linear elastic, matching the 2-node beam formulation. - """ - coords = self.get_node_coordinates(mesh) - try: - L, T = self._beam_frame_and_transform(coords) - except ValueError: - return Element.compute_nonlinear_response( - self, mesh, material, u_elem, state, num_layers, tangent - ) - u_loc = T @ np.asarray(u_elem, dtype=float) - if self.generalized_section is not None: - return self._compute_generalized_von_karman_response_quadratic( - L, - T, - u_loc, - state, - tangent, - ) - E, G12, G13, GJ = _beam_material_properties(material, self.cross_section) - EA = E * self._A - EIy = E * self._Iy - EIz = E * self._Iz - GA_y = G12 * self._A * self._ky - GA_z = G13 * self._A * self._kz - - fiber_config = self._fiber_plasticity_config(material) - num_gp = len(self.GAUSS_POINTS) - if fiber_config is not None: - y_f, z_f, w_f = self._fiber_section_grid(fiber_config) - n_fibers = y_f.size - fiber_strain_all = np.zeros(num_gp * n_fibers, dtype=float) - B_fiber_all = np.zeros((num_gp * n_fibers, 18), dtype=float) - - F_loc = np.zeros(18, dtype=float) - K_loc = np.zeros((18, 18), dtype=float) if tangent else None - gp_data = [] - axial_forces = [] - for gp_index, (xi, weight) in enumerate(zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS)): - N, dN_dxi = self.compute_shape_functions(float(xi)) - dN_dx = dN_dxi * 2.0 / L - jac = L / 2.0 * float(weight) - - B_ax = np.zeros(18, dtype=float) - B_v = np.zeros(18, dtype=float) - B_w = np.zeros(18, dtype=float) - B_ry = np.zeros(18, dtype=float) - B_rz = np.zeros(18, dtype=float) - B_torsion = np.zeros(18, dtype=float) - B_shear_xy = np.zeros(18, dtype=float) - B_shear_xz = np.zeros(18, dtype=float) - for i in range(3): - b = i * 6 - B_ax[b + 0] = dN_dx[i] - B_v[b + 1] = dN_dx[i] - B_w[b + 2] = dN_dx[i] - B_torsion[b + 3] = dN_dx[i] - B_ry[b + 4] = dN_dx[i] - B_rz[b + 5] = dN_dx[i] - B_shear_xy[b + 1] = dN_dx[i] - B_shear_xy[b + 5] = -N[i] - B_shear_xz[b + 2] = dN_dx[i] - B_shear_xz[b + 4] = N[i] - - v_grad = float(B_v @ u_loc) - w_grad = float(B_w @ u_loc) - eps0 = float(B_ax @ u_loc) + 0.5 * (v_grad**2 + w_grad**2) - kappa_y = float(B_ry @ u_loc) - kappa_z = float(B_rz @ u_loc) - B_membrane = B_ax + v_grad * B_v + w_grad * B_w - - # linear shear and torsion at every integration point - gamma_xy = float(B_shear_xy @ u_loc) - gamma_xz = float(B_shear_xz @ u_loc) - twist = float(B_torsion @ u_loc) - F_loc += jac * (GA_y * gamma_xy * B_shear_xy + GA_z * gamma_xz * B_shear_xz + GJ * twist * B_torsion) - if tangent: - K_loc += jac * ( - GA_y * np.outer(B_shear_xy, B_shear_xy) - + GA_z * np.outer(B_shear_xz, B_shear_xz) - + GJ * np.outer(B_torsion, B_torsion) - ) - - if fiber_config is not None: - rows = slice(gp_index * n_fibers, (gp_index + 1) * n_fibers) - fiber_strain_all[rows] = eps0 + z_f * kappa_y + y_f * kappa_z - B_fiber_all[rows] = ( - B_membrane[None, :] + z_f[:, None] * B_ry[None, :] + y_f[:, None] * B_rz[None, :] - ) - gp_data.append((jac, B_v, B_w, rows)) - else: - axial_force = EA * eps0 - axial_forces.append(axial_force) - F_loc += jac * (axial_force * B_membrane + EIy * kappa_y * B_ry + EIz * kappa_z * B_rz) - if tangent: - K_loc += jac * ( - EA * np.outer(B_membrane, B_membrane) - + axial_force * (np.outer(B_v, B_v) + np.outer(B_w, B_w)) - + EIy * np.outer(B_ry, B_ry) - + EIz * np.outer(B_rz, B_rz) - ) - - trial_state: Optional[Any] = state - if fiber_config is not None: - initial_state = _copy_state_fields(state, _INITIAL_BEAM_STATE_KEYS) - initial_stress = _beam_fiber_field( - initial_state.get("initial_fiber_stress", 0.0), - fiber_strain_all.size, - n_fibers, - "initial_fiber_stress", - ) - initial_prestrain = _beam_fiber_field( - initial_state.get("initial_fiber_prestrain", 0.0), - fiber_strain_all.size, - n_fibers, - "initial_fiber_prestrain", - ) - constitutive_fiber_strain = ( - fiber_strain_all - initial_prestrain + initial_stress / E - ) - stress, Et, plastic_new, alpha_new = self._uniaxial_return_map( - constitutive_fiber_strain, - state, - E, - fiber_config.material_curve, - _beam_flow_scale(material, fiber_config.material_curve), - ) - for jac, B_v, B_w, rows in gp_data: - weights_gp = w_f - stress_gp = stress[rows] - F_loc += jac * np.einsum("f,f,fj->j", weights_gp, stress_gp, B_fiber_all[rows]) - axial_force = float(np.sum(weights_gp * stress_gp)) - axial_forces.append(axial_force) - if tangent: - K_loc += jac * np.einsum("f,f,fj,fk->jk", weights_gp, Et[rows], B_fiber_all[rows], B_fiber_all[rows]) - K_loc += jac * axial_force * (np.outer(B_v, B_v) + np.outer(B_w, B_w)) - trial_state = { - "plastic_strain": plastic_new, - "alpha": alpha_new, - "fiber_strain": constitutive_fiber_strain.copy(), - "kinematic_fiber_strain": fiber_strain_all.copy(), - "fiber_stress": stress.copy(), - "axial_force": float(np.mean(axial_forces)) if axial_forces else 0.0, - "equivalent_stress_measure": ( - "hill48" - if _elastic_symmetry(material) == "orthotropic" - else "von_mises" - ), - **initial_state, - } - - if not tangent: - return T.T @ F_loc, None, trial_state - return T.T @ F_loc, T.T @ K_loc @ T, trial_state - - @property - def num_nodes(self) -> int: - return 3 - - @property - def dofs_per_node(self) -> int: - return 6 - - @property - def total_dofs(self) -> int: - return 18 - - def get_node_coordinates(self, mesh: "FEMesh") -> np.ndarray: - coords = np.zeros((3, 3), dtype=float) - for i, node_id in enumerate(self.node_ids): - node = mesh.get_node(node_id) - if node is None: - raise ValueError(f"Quadratic beam element {self.element_id} references missing node {node_id}") - coords[i] = node.coords() - chord = coords[2] - coords[0] - length = float(np.linalg.norm(chord)) - if length > _SMALL: - midpoint_error = float(np.linalg.norm(coords[1] - 0.5 * (coords[0] + coords[2]))) - if midpoint_error > max(1.0e-8 * length, 1.0e-12): - raise ValueError( - f"Quadratic beam element {self.element_id} is curved or has a non-midpoint middle node. " - "The current B3 formulation is straight-sided; use two-node beam segments for curved geometry." - ) - return coords - - def compute_shape_functions(self, xi: float) -> Tuple[np.ndarray, np.ndarray]: - N = np.array([xi * (xi - 1.0) / 2.0, 1.0 - xi**2, xi * (xi + 1.0) / 2.0], dtype=float) - dN_dxi = np.array([xi - 0.5, -2.0 * xi, xi + 0.5], dtype=float) - return N, dN_dxi - - def _beam_frame_and_transform(self, coords: np.ndarray) -> Tuple[float, np.ndarray]: - length = float(np.linalg.norm(coords[2] - coords[0])) - if length < _SMALL: - raise ValueError(f"Quadratic beam element {self.element_id} has near-zero length") - e1 = (coords[2] - coords[0]) / length - R = _beam_rotation_matrix(e1, self._orientation) - T = np.zeros((18, 18), dtype=float) - Rt = R.T - for i in range(3): - b = i * 6 - T[b:b + 3, b:b + 3] = Rt - T[b + 3:b + 6, b + 3:b + 6] = Rt - return length, T - - def compute_stiffness_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: - coords = self.get_node_coordinates(mesh) - try: - L, T = self._beam_frame_and_transform(coords) - except ValueError: - return np.zeros((18, 18), dtype=float) - if self.generalized_section is not None: - section_stiffness = generalized_beam_stiffness( - self.generalized_section - ) - K = np.zeros((18, 18), dtype=float) - for xi, weight in zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS): - shape, derivative_xi = self.compute_shape_functions(float(xi)) - B = _beam_generalized_strain_matrix_from_shape( - shape, - derivative_xi * 2.0 / L, - ) - K += ( - B.T - @ section_stiffness - @ B - * (L / 2.0 * float(weight)) - ) - K_global = T.T @ K @ T - self._stiffness_matrix = K_global - return K_global - E, G12, G13, GJ = _beam_material_properties(material, self.cross_section) - EA = E * self._A - EIy = E * self._Iy - EIz = E * self._Iz - GA_y = G12 * self._A * self._ky - GA_z = G13 * self._A * self._kz - K = np.zeros((18, 18), dtype=float) - for xi, weight in zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS): - N, dN_dxi = self.compute_shape_functions(float(xi)) - dN_dx = dN_dxi * 2.0 / L - B_axial = np.zeros((1, 18), dtype=float) - B_torsion = np.zeros((1, 18), dtype=float) - B_shear_xz = np.zeros((1, 18), dtype=float) - B_shear_xy = np.zeros((1, 18), dtype=float) - B_bend_y = np.zeros((1, 18), dtype=float) - B_bend_z = np.zeros((1, 18), dtype=float) - for i in range(3): - b = i * 6 - B_axial[0, b + 0] = dN_dx[i] - B_torsion[0, b + 3] = dN_dx[i] - B_shear_xz[0, b + 2] = dN_dx[i] - B_shear_xz[0, b + 4] = N[i] - B_shear_xy[0, b + 1] = dN_dx[i] - B_shear_xy[0, b + 5] = -N[i] - B_bend_y[0, b + 4] = dN_dx[i] - B_bend_z[0, b + 5] = dN_dx[i] - jac = L / 2.0 * weight - K += B_axial.T @ (EA * np.eye(1)) @ B_axial * jac - K += B_torsion.T @ (GJ * np.eye(1)) @ B_torsion * jac - K += B_shear_xz.T @ (GA_z * np.eye(1)) @ B_shear_xz * jac - K += B_shear_xy.T @ (GA_y * np.eye(1)) @ B_shear_xy * jac - K += B_bend_y.T @ (EIy * np.eye(1)) @ B_bend_y * jac - K += B_bend_z.T @ (EIz * np.eye(1)) @ B_bend_z * jac - K_global = T.T @ K @ T - self._stiffness_matrix = K_global - return K_global - - def compute_mass_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: - coords = self.get_node_coordinates(mesh) - try: - L, T = self._beam_frame_and_transform(coords) - except ValueError: - return np.zeros((18, 18), dtype=float) - M = np.zeros((18, 18), dtype=float) - generalized_mass = ( - None - if self.generalized_section is None - else generalized_beam_mass_matrix(self.generalized_section) - ) - if generalized_mass is not None: - for xi, weight in zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS): - N, _ = self.compute_shape_functions(float(xi)) - jacobian_weight = float(weight) * L / 2.0 - for i in range(3): - for j in range(3): - M[ - i * 6 : (i + 1) * 6, - j * 6 : (j + 1) * 6, - ] += ( - N[i] - * N[j] - * jacobian_weight - * generalized_mass - ) - M_global = T.T @ M @ T - self._mass_matrix = M_global - return M_global - rho = material.density - # Consistent rotary inertia per rotation axis: polar (Iy+Iz) for - # torsion, the matching section inertia for each bending rotation. - rotary_inertia = (rho * (self._Iy + self._Iz), rho * self._Iy, rho * self._Iz) - for xi, weight in zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS): - N, _ = self.compute_shape_functions(float(xi)) - for i in range(3): - for j in range(3): - translational = N[i] * N[j] * rho * self._A * weight * L / 2.0 - for d in range(3): - M[i * 6 + d, j * 6 + d] += translational - M[i * 6 + 3 + d, j * 6 + 3 + d] += N[i] * N[j] * rotary_inertia[d] * weight * L / 2.0 - M_global = T.T @ M @ T - self._mass_matrix = M_global - return M_global - - def compute_geometric_stiffness_matrix( - self, - mesh: "FEMesh", - material: "Material", - state: Optional[Any] = None, - ) -> np.ndarray: - """ - Beam-column stress stiffness from the lateral displacement gradient: - - KG = N_compression * integral (dN/dx)^T (dN/dx) dx - - applied to both transverse deflections. This is the same - destabilizing-gradient theory as the shell membrane KG and follows the - package convention ``K phi = lambda KG phi`` with compression positive. - The higher-order rotation-gradient term is omitted, which makes the - predicted critical loads slightly conservative on coarse meshes. - """ - axial_compression = self._axial_compression_from_state(state) - if axial_compression == 0.0: - return np.zeros((self.total_dofs, self.total_dofs), dtype=float) - - coords = self.get_node_coordinates(mesh) - try: - L, T = self._beam_frame_and_transform(coords) - except ValueError: - return np.zeros((self.total_dofs, self.total_dofs), dtype=float) - - KG = np.zeros((18, 18), dtype=float) - # Wagner term factor: see BeamElement.compute_geometric_stiffness_matrix. - polar_ratio = self._geometric_polar_radius_squared() - for xi, weight in zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS): - _, dN_dxi = self.compute_shape_functions(float(xi)) - dN_dx = dN_dxi * 2.0 / L - G_matrix = np.zeros((2, 18), dtype=float) - twist_gradient = np.zeros((1, 18), dtype=float) - for i in range(3): - b = i * 6 - G_matrix[0, b + 1] = dN_dx[i] - G_matrix[1, b + 2] = dN_dx[i] - twist_gradient[0, b + 3] = dN_dx[i] - KG += axial_compression * (G_matrix.T @ G_matrix) * (L / 2.0 * weight) - KG += axial_compression * polar_ratio * (twist_gradient.T @ twist_gradient) * (L / 2.0 * weight) - return T.T @ KG @ T - - -class CoupledBeamShellElement(Element): - """Kinematic MPC coupling between one eccentric beam node and one shell node.""" - - def __init__( - self, - element_id: int, - beam_node_id: int, - shell_node_id: int, - material_name: str = "default", - coupling_stiffness: float = 0.0, - eccentricity: Optional[np.ndarray] = None, + + GJ * np.outer(B_torsion, B_torsion) + ) + F_loc += K_aux @ u_loc + if tangent: + K_loc += K_aux + + trial_state = { + "plastic_strain": plastic_new, + "alpha": alpha_new, + "fiber_strain": constitutive_fiber_strain.copy(), + "kinematic_fiber_strain": fiber_strain.copy(), + "fiber_stress": stress.copy(), + "axial_force": N_force, + "equivalent_stress_measure": ( + "hill48" if _elastic_symmetry(material) == "orthotropic" else "von_mises" + ), + **initial_state, + } + if not tangent: + return T.T @ F_loc, None, trial_state + return T.T @ F_loc, T.T @ K_loc @ T, trial_state + + def _current_beam_frame_and_transform(self, coords: np.ndarray, u_elem: np.ndarray) -> Tuple[float, np.ndarray, np.ndarray, np.ndarray]: + current = coords.copy() + current[0] += np.asarray(u_elem[0:3], dtype=float) + current[1] += np.asarray(u_elem[6:9], dtype=float) + length = float(np.linalg.norm(current[1] - current[0])) + if length < _SMALL: + raise ValueError(f"Beam element {self.element_id} has near-zero current length") + e1 = (current[1] - current[0]) / length + R = _beam_rotation_matrix(e1, self._orientation) + T = np.zeros((12, 12), dtype=float) + Rt = R.T + for i in range(2): + b = i * 6 + T[b:b + 3, b:b + 3] = Rt + T[b + 3:b + 6, b + 3:b + 6] = Rt + return length, T, R, current + + def _compute_corotational_nonlinear_response( + self, + mesh: "FEMesh", + material: "Material", + u_elem: np.ndarray, + state: Optional[Any], + tangent: bool, + ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: + """Elastic 2-node corotational beam response. + + The element frame follows the current chord. Rigid-body chord rotation + is subtracted from nodal rotations, so a finite rigid rotation with + matching nodal rotation vectors produces near-zero internal force. + """ + coords = self.get_node_coordinates(mesh) + L0, _T0 = self._beam_frame_and_transform(coords) + Lc, Tc, Rc, _current = self._current_beam_frame_and_transform(coords, np.asarray(u_elem, dtype=float)) + R0 = _beam_rotation_matrix((coords[1] - coords[0]) / L0, self._orientation) + rigid_rotation = _rotation_vector_from_matrix(Rc @ R0.T) + + u_global = np.asarray(u_elem, dtype=float).reshape(12) + q = np.zeros(12, dtype=float) + q[6] = Lc - L0 + q[3:6] = Rc.T @ (u_global[3:6] - rigid_rotation) + q[9:12] = Rc.T @ (u_global[9:12] - rigid_rotation) + + K_loc = self._local_linear_stiffness(L0, material) + F_loc = K_loc @ q + F_global = Tc.T @ F_loc + trial_state = { + "geometric_nonlinearity": "corotational", + "initial_length": float(L0), + "current_length": float(Lc), + "axial_extension": float(Lc - L0), + "rigid_rotation_vector": rigid_rotation.copy(), + "basic_deformation_norm": float(np.linalg.norm(q)), + } + if self.generalized_section is not None: + section_stiffness = generalized_beam_stiffness( + self.generalized_section + ) + basic_deformation = ( + _beam2_basic_deformation_matrix(L0) @ q + ) + _flexibility, basic_stiffness = ( + _beam2_generalized_flexibility( + L0, + section_stiffness, + ) + ) + basic_force = basic_stiffness @ basic_deformation + stations = np.array((-1.0, 0.0, 1.0), dtype=float) + generalized_resultant = np.asarray( + [ + _beam2_force_interpolation(L0, xi) @ basic_force + for xi in stations + ], + dtype=float, + ) + generalized_strain = ( + generalized_resultant + @ np.linalg.inv(section_stiffness).T + ) + trial_state.update( + { + "generalized_section": True, + "generalized_strain": generalized_strain.copy(), + "generalized_resultant": generalized_resultant.copy(), + "generalized_station_coordinates": stations, + "generalized_strain_order": GENERALIZED_BEAM_STRAIN_ORDER, + "generalized_resultant_order": ( + GENERALIZED_BEAM_RESULTANT_ORDER + ), + "axial_force": float( + np.mean(generalized_resultant[:, 0]) + ), + "recovery_scope": "section_resultants_only", + } + ) + if not tangent: + return F_global, None, trial_state + K_global = Tc.T @ K_loc @ Tc + return F_global, K_global, trial_state + + def _compute_generalized_von_karman_response( + self, + mesh: "FEMesh", + u_elem: np.ndarray, + state: Optional[Any], + tangent: bool, + ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: + """Coupled generalized-section response from one strain-energy law.""" + + coords = self.get_node_coordinates(mesh) + L, T = self._beam_frame_and_transform(coords) + u_loc = T @ np.asarray(u_elem, dtype=float) + basic_transform = _beam2_basic_deformation_matrix(L) + basic_deformation = basic_transform @ u_loc + dv = float(u_loc[7] - u_loc[1]) + dw = float(u_loc[8] - u_loc[2]) + basic_deformation[0] += (dv**2 + dw**2) / (2.0 * L) + basic_tangent = basic_transform.copy() + basic_tangent[0, 1], basic_tangent[0, 7] = -dv / L, dv / L + basic_tangent[0, 2], basic_tangent[0, 8] = -dw / L, dw / L + + section_stiffness = generalized_beam_stiffness( + self.generalized_section + ) + _flexibility, basic_stiffness = _beam2_generalized_flexibility( + L, + section_stiffness, + ) + basic_force = basic_stiffness @ basic_deformation + F_loc = basic_tangent.T @ basic_force + stations = np.array((-1.0, 0.0, 1.0), dtype=float) + generalized_resultant = np.asarray( + [ + _beam2_force_interpolation(L, xi) @ basic_force + for xi in stations + ], + dtype=float, + ) + generalized_strain = ( + generalized_resultant @ np.linalg.inv(section_stiffness).T + ) + trial_state = { + **(dict(state) if isinstance(state, dict) else {}), + "generalized_section": True, + "geometric_nonlinearity": "von_karman", + "generalized_strain": generalized_strain.copy(), + "generalized_resultant": generalized_resultant.copy(), + "generalized_station_coordinates": stations, + "generalized_strain_order": GENERALIZED_BEAM_STRAIN_ORDER, + "generalized_resultant_order": GENERALIZED_BEAM_RESULTANT_ORDER, + "axial_force": float(np.mean(generalized_resultant[:, 0])), + "recovery_scope": "section_resultants_only", + } + if not tangent: + return T.T @ F_loc, None, trial_state + + K_loc = basic_tangent.T @ basic_stiffness @ basic_tangent + # Hessian of the von Karman axial extension, multiplied by N. + string = float(basic_force[0]) / L + for a, b in ((1, 7), (2, 8)): + K_loc[a, a] += string + K_loc[b, b] += string + K_loc[a, b] -= string + K_loc[b, a] -= string + return T.T @ F_loc, T.T @ K_loc @ T, trial_state + + def compute_nonlinear_response( + self, + mesh: "FEMesh", + material: "Material", + u_elem: np.ndarray, + state: Optional[Any] = None, + num_layers: int = 5, + tangent: bool = True, + ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: + """Elastic beam-column response with von Karman axial coupling. + + The axial strain includes the transverse-displacement rotation terms + + eps = (u2-u1)/L + ((v2-v1)^2 + (w2-w1)^2) / (2 L^2) + + which gives the P-delta string effect consistently (internal force + and tangent from the same potential). Bending, shear and torsion + remain linear elastic unless ``cross_section["fiber_plasticity"]`` is + provided, in which case axial/bending response is integrated over a + uniaxial fiber section using the material hardening curve. + """ + self._refuse_offset_route('nonlinear response') + if self._geometric_nonlinearity in {"corotational", "co_rotational", "corot"}: + return self._compute_corotational_nonlinear_response( + mesh, material, u_elem, state, tangent + ) + + if self.generalized_section is not None: + return self._compute_generalized_von_karman_response( + mesh, + u_elem, + state, + tangent, + ) + + fiber_config = self._fiber_plasticity_config(material) + if fiber_config is not None: + return self._compute_fiber_nonlinear_response( + mesh, material, u_elem, state, fiber_config, tangent + ) + + cache = getattr(self, "_nl_cache", None) + if cache is None: + coords = self.get_node_coordinates(mesh) + L, T = self._beam_frame_and_transform(coords) + K_global = self.compute_stiffness_matrix(mesh, material) + K_loc = T @ K_global @ T.T + # Remove the linear axial block; the von Karman axial response + # replaces it entirely. + for i in (0, 6): + K_loc[i, :] = 0.0 + K_loc[:, i] = 0.0 + E1, _G12, _G13, _GJ = _beam_material_properties( + material, + self.cross_section, + ) + cache = {"L": L, "T": T, "K_noax": K_loc, "EA": E1 * self._A} + self._nl_cache = cache + + L = cache["L"] + T = cache["T"] + EA = cache["EA"] + u_loc = T @ np.asarray(u_elem, dtype=float) + + du = u_loc[6] - u_loc[0] + dv = u_loc[7] - u_loc[1] + dw = u_loc[8] - u_loc[2] + eps = du / L + (dv**2 + dw**2) / (2.0 * L**2) + N_force = EA * eps + + d_eps = np.zeros(12, dtype=float) + d_eps[0], d_eps[6] = -1.0 / L, 1.0 / L + d_eps[1], d_eps[7] = -dv / L**2, dv / L**2 + d_eps[2], d_eps[8] = -dw / L**2, dw / L**2 + + F_loc = cache["K_noax"] @ u_loc + N_force * L * d_eps + if not tangent: + return T.T @ F_loc, None, state + K_loc = cache["K_noax"] + EA * L * np.outer(d_eps, d_eps) + string = N_force / L + for a, b in ((1, 7), (2, 8)): + K_loc[a, a] += string + K_loc[b, b] += string + K_loc[a, b] -= string + K_loc[b, a] -= string + + return T.T @ F_loc, T.T @ K_loc @ T, state + + def _end_displacements(self, u_local: np.ndarray) -> Tuple[np.ndarray, np.ndarray]: + """Local DOF vectors of the two geometric end nodes.""" + return u_local[0:6], u_local[6:12] + + def compute_stresses( + self, + mesh: "FEMesh", + displacements: np.ndarray, + material: "Material", + return_global: bool = False, + ) -> Dict[str, Any]: + coords = self.get_node_coordinates(mesh) + try: + L, T = self._beam_frame_and_transform(coords) + except ValueError: + return {} + u_local = T @ self._get_element_displacements(mesh, displacements) + if self.generalized_section is not None: + section_stiffness = generalized_beam_stiffness( + self.generalized_section + ) + if isinstance(self, QuadraticBeamElement): + strain_rows = [] + for xi in self.GAUSS_POINTS: + shape, derivative_xi = self.compute_shape_functions( + float(xi) + ) + B = _beam_generalized_strain_matrix_from_shape( + shape, + derivative_xi * 2.0 / L, + ) + strain_rows.append(B @ u_local) + generalized_strain = np.asarray(strain_rows, dtype=float) + generalized_resultant = ( + generalized_strain @ section_stiffness.T + ) + return _generalized_beam_recovery( + generalized_strain, + generalized_resultant, + stations=np.asarray(self.GAUSS_POINTS, dtype=float), + ) + basic_transform = _beam2_basic_deformation_matrix(L) + basic_deformation = basic_transform @ u_local + _flexibility, basic_stiffness = ( + _beam2_generalized_flexibility(L, section_stiffness) + ) + basic_force = basic_stiffness @ basic_deformation + compliance = np.linalg.inv(section_stiffness) + stations = np.array((-1.0, 0.0, 1.0), dtype=float) + generalized_resultant = np.asarray( + [ + _beam2_force_interpolation(L, xi) @ basic_force + for xi in stations + ], + dtype=float, + ) + generalized_strain = generalized_resultant @ compliance.T + return _generalized_beam_recovery( + generalized_strain, + generalized_resultant, + stations=stations, + ) + E, G12, G13, GJ = _beam_material_properties(material, self.cross_section) + end_a, end_b = self._end_displacements(u_local) + u1, v1, w1, rx1, ry1, rz1 = end_a + u2, v2, w2, rx2, ry2, rz2 = end_b + sigma_axial = E * (u2 - u1) / L + kappa_z = (rz2 - rz1) / L + kappa_y = (ry2 - ry1) / L + M_z = E * self._Iz * kappa_z + M_y = E * self._Iy * kappa_y + c_y, c_z = self._fiber_distances() + sigma_bending_y = M_y * c_z / max(self._Iy, _SMALL) + sigma_bending_z = M_z * c_y / max(self._Iz, _SMALL) + gamma_xy = (v2 - v1) / L - 0.5 * (rz1 + rz2) + gamma_xz = (w2 - w1) / L + 0.5 * (ry1 + ry2) + tau_y = G12 * self._ky * gamma_xy + tau_z = G13 * self._kz * gamma_xz + tau_torsion = GJ * (rx2 - rx1) / L / self._torsion_section_modulus() + sigma_x = sigma_axial + sigma_bending_y + sigma_bending_z + von_mises = np.sqrt(sigma_x**2 + 3.0 * (tau_y**2 + tau_z**2 + tau_torsion**2)) + recovered = { + "axial_stress": sigma_axial, + "bending_stress_y": sigma_bending_y, + "bending_stress_z": sigma_bending_z, + "shear_stress_y": tau_y, + "shear_stress_z": tau_z, + "torsional_stress": tau_torsion, + "von_mises": von_mises, + } + hill_yield = getattr(material, "hill_yield", None) + if hill_yield is not None: + from .plasticity import hill48_equivalent_stress + + # Section recovery supplies envelopes rather than a resolved + # perimeter stress point. Include both directional transverse + # shears, and conservatively combine the torsional envelope with + # either x-y or x-z shear. + candidates = np.array( + [ + [sigma_x, 0.0, 0.0, 0.0, tau_z, tau_y], + [sigma_x, 0.0, 0.0, 0.0, tau_z, tau_y + tau_torsion], + [sigma_x, 0.0, 0.0, 0.0, tau_z, tau_y - tau_torsion], + [sigma_x, 0.0, 0.0, 0.0, tau_z + tau_torsion, tau_y], + [sigma_x, 0.0, 0.0, 0.0, tau_z - tau_torsion, tau_y], + ], + dtype=float, + ) + equivalent = float( + np.max(hill48_equivalent_stress(candidates, hill_yield)) + ) + recovered["equivalent_stress"] = equivalent + recovered["equivalent_stress_measure"] = "hill48" + recovered["hill_utilization"] = equivalent / max(float(hill_yield.X), _SMALL) + recovered["equivalent_stress_scope"] = ( + "conservative beam-local axial/shear/torsion envelope" + ) + else: + recovered["equivalent_stress"] = von_mises + recovered["equivalent_stress_measure"] = "von_mises" + return recovered + + +class QuadraticBeamElement(BeamElement): + """3-node quadratic Timoshenko beam element with 6 DOF per node.""" + + GAUSS_POINTS = np.array([-np.sqrt(3.0 / 5.0), 0.0, np.sqrt(3.0 / 5.0)], dtype=float) + GAUSS_WEIGHTS = np.array([5.0 / 9.0, 8.0 / 9.0, 5.0 / 9.0], dtype=float) + + def __init__( + self, + element_id: int, + node_ids: List[int], + material_name: str = "default", + cross_section: Optional[Dict[str, Any]] = None, + eccentricity: Optional[np.ndarray] = None, + section: Any = None, + ): + Element.__init__(self, element_id, node_ids, material_name) + if len(node_ids) != 3: + raise ValueError(f"QuadraticBeamElement requires 3 nodes, got {len(node_ids)}") + self.cross_section = cross_section or {} + self._A = self.cross_section.get("area", 0.01) + self._Iy = self.cross_section.get("Iy", 1.0e-8) + self._Iz = self.cross_section.get("Iz", 1.0e-8) + self._J = self.cross_section.get("J", 1.0e-8) + self._ky = self.cross_section.get("shear_factor_y", 5.0 / 6.0) + self._kz = self.cross_section.get("shear_factor_z", 5.0 / 6.0) + self._orientation = _section_orientation(self.cross_section) + self._c_y = self.cross_section.get("c_y") + self._c_z = self.cross_section.get("c_z") + self._torsion_modulus = self.cross_section.get("torsion_modulus") + self._fiber_plasticity = self.cross_section.get("fiber_plasticity") + self._geometric_nonlinearity = str( + self.cross_section.get( + "geometric_nonlinearity", + self.cross_section.get("geometry", "von_karman"), + ) + ).lower() + self.generalized_section = resolve_generalized_beam_section( + self.cross_section, + section, + ) + if self.generalized_section is not None and self._fiber_plasticity is not None: + raise ValueError( + "Generalized beam sections do not support " + "cross_section['fiber_plasticity']; supply an elastic section " + "without fiber plasticity." + ) + if self.generalized_section is not None: + self._geometric_polar_radius_squared() + if self.generalized_section is not None and self._geometric_nonlinearity in { + "corotational", + "co_rotational", + "corot", + }: + raise ValueError( + "QuadraticBeamElement does not support corotational kinematics " + "with a generalized beam section; use BeamElement or " + "geometric_nonlinearity='von_karman'." + ) + self.eccentricity = np.zeros(3, dtype=float) if eccentricity is None else np.asarray(eccentricity, dtype=float) + + def _end_displacements(self, u_local: np.ndarray) -> Tuple[np.ndarray, np.ndarray]: + # Geometric end nodes are 0 and 2; node 1 is the midside node. The + # end-difference over the full length equals the quadratic shape + # function derivative evaluated at the element centre. + return u_local[0:6], u_local[12:18] + + def _compute_generalized_von_karman_response_quadratic( + self, + length: float, + transform: np.ndarray, + u_local: np.ndarray, + state: Optional[Any], + tangent: bool, + ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: + """Quadratic coupled-section response and exact energy tangent.""" + + L = float(length) + section_stiffness = generalized_beam_stiffness( + self.generalized_section + ) + F_loc = np.zeros(18, dtype=float) + K_loc = np.zeros((18, 18), dtype=float) if tangent else None + strain_rows = [] + resultant_rows = [] + for xi, weight in zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS): + shape, derivative_xi = self.compute_shape_functions(float(xi)) + derivative_x = derivative_xi * 2.0 / L + B_linear = _beam_generalized_strain_matrix_from_shape( + shape, + derivative_x, + ) + B_v = np.zeros(18, dtype=float) + B_w = np.zeros(18, dtype=float) + for i in range(3): + B_v[i * 6 + 1] = derivative_x[i] + B_w[i * 6 + 2] = derivative_x[i] + v_gradient = float(B_v @ u_local) + w_gradient = float(B_w @ u_local) + + generalized_strain = B_linear @ u_local + generalized_strain[0] += 0.5 * ( + v_gradient**2 + w_gradient**2 + ) + B_tangent = B_linear.copy() + B_tangent[0, :] += ( + v_gradient * B_v + w_gradient * B_w + ) + generalized_resultant = ( + section_stiffness @ generalized_strain + ) + jacobian_weight = L / 2.0 * float(weight) + F_loc += ( + jacobian_weight + * (B_tangent.T @ generalized_resultant) + ) + if tangent: + K_loc += jacobian_weight * ( + B_tangent.T @ section_stiffness @ B_tangent + + float(generalized_resultant[0]) + * (np.outer(B_v, B_v) + np.outer(B_w, B_w)) + ) + strain_rows.append(generalized_strain.copy()) + resultant_rows.append(generalized_resultant.copy()) + + generalized_strains = np.asarray(strain_rows, dtype=float) + generalized_resultants = np.asarray(resultant_rows, dtype=float) + trial_state = { + **(dict(state) if isinstance(state, dict) else {}), + "generalized_section": True, + "geometric_nonlinearity": "von_karman", + "generalized_strain": generalized_strains, + "generalized_resultant": generalized_resultants, + "generalized_station_coordinates": np.asarray( + self.GAUSS_POINTS, + dtype=float, + ).copy(), + "generalized_strain_order": GENERALIZED_BEAM_STRAIN_ORDER, + "generalized_resultant_order": GENERALIZED_BEAM_RESULTANT_ORDER, + "axial_force": float( + np.mean(generalized_resultants[:, 0]) + ), + "recovery_scope": "section_resultants_only", + } + if not tangent: + return transform.T @ F_loc, None, trial_state + return ( + transform.T @ F_loc, + transform.T @ K_loc @ transform, + trial_state, + ) + + def compute_nonlinear_response( + self, + mesh: "FEMesh", + material: "Material", + u_elem: np.ndarray, + state: Optional[Any] = None, + num_layers: int = 5, + tangent: bool = True, + ) -> Tuple[np.ndarray, Optional[np.ndarray], Optional[Any]]: + """Gauss-point von Karman beam-column response on the quadratic interpolation. + + At each integration point the axial strain includes the transverse + gradient coupling + + eps = u' + (v'^2 + w'^2) / 2 + + with all gradients from the quadratic shape functions, giving internal + force and consistent tangent (including the string/geometric term) from + the same potential. With ``cross_section["fiber_plasticity"]`` the + axial/bending response is integrated over the uniaxial fiber grid per + Gauss point using the material hardening curve; shear and torsion stay + linear elastic, matching the 2-node beam formulation. + """ + coords = self.get_node_coordinates(mesh) + try: + L, T = self._beam_frame_and_transform(coords) + except ValueError: + return Element.compute_nonlinear_response( + self, mesh, material, u_elem, state, num_layers, tangent + ) + u_loc = T @ np.asarray(u_elem, dtype=float) + if self.generalized_section is not None: + return self._compute_generalized_von_karman_response_quadratic( + L, + T, + u_loc, + state, + tangent, + ) + E, G12, G13, GJ = _beam_material_properties(material, self.cross_section) + EA = E * self._A + EIy = E * self._Iy + EIz = E * self._Iz + GA_y = G12 * self._A * self._ky + GA_z = G13 * self._A * self._kz + + fiber_config = self._fiber_plasticity_config(material) + num_gp = len(self.GAUSS_POINTS) + if fiber_config is not None: + y_f, z_f, w_f = self._fiber_section_grid(fiber_config) + n_fibers = y_f.size + fiber_strain_all = np.zeros(num_gp * n_fibers, dtype=float) + B_fiber_all = np.zeros((num_gp * n_fibers, 18), dtype=float) + + F_loc = np.zeros(18, dtype=float) + K_loc = np.zeros((18, 18), dtype=float) if tangent else None + gp_data = [] + axial_forces = [] + for gp_index, (xi, weight) in enumerate(zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS)): + N, dN_dxi = self.compute_shape_functions(float(xi)) + dN_dx = dN_dxi * 2.0 / L + jac = L / 2.0 * float(weight) + + B_ax = np.zeros(18, dtype=float) + B_v = np.zeros(18, dtype=float) + B_w = np.zeros(18, dtype=float) + B_ry = np.zeros(18, dtype=float) + B_rz = np.zeros(18, dtype=float) + B_torsion = np.zeros(18, dtype=float) + B_shear_xy = np.zeros(18, dtype=float) + B_shear_xz = np.zeros(18, dtype=float) + for i in range(3): + b = i * 6 + B_ax[b + 0] = dN_dx[i] + B_v[b + 1] = dN_dx[i] + B_w[b + 2] = dN_dx[i] + B_torsion[b + 3] = dN_dx[i] + B_ry[b + 4] = dN_dx[i] + B_rz[b + 5] = dN_dx[i] + B_shear_xy[b + 1] = dN_dx[i] + B_shear_xy[b + 5] = -N[i] + B_shear_xz[b + 2] = dN_dx[i] + B_shear_xz[b + 4] = N[i] + + v_grad = float(B_v @ u_loc) + w_grad = float(B_w @ u_loc) + eps0 = float(B_ax @ u_loc) + 0.5 * (v_grad**2 + w_grad**2) + kappa_y = float(B_ry @ u_loc) + kappa_z = float(B_rz @ u_loc) + B_membrane = B_ax + v_grad * B_v + w_grad * B_w + + # linear shear and torsion at every integration point + gamma_xy = float(B_shear_xy @ u_loc) + gamma_xz = float(B_shear_xz @ u_loc) + twist = float(B_torsion @ u_loc) + F_loc += jac * (GA_y * gamma_xy * B_shear_xy + GA_z * gamma_xz * B_shear_xz + GJ * twist * B_torsion) + if tangent: + K_loc += jac * ( + GA_y * np.outer(B_shear_xy, B_shear_xy) + + GA_z * np.outer(B_shear_xz, B_shear_xz) + + GJ * np.outer(B_torsion, B_torsion) + ) + + if fiber_config is not None: + rows = slice(gp_index * n_fibers, (gp_index + 1) * n_fibers) + fiber_strain_all[rows] = eps0 + z_f * kappa_y + y_f * kappa_z + B_fiber_all[rows] = ( + B_membrane[None, :] + z_f[:, None] * B_ry[None, :] + y_f[:, None] * B_rz[None, :] + ) + gp_data.append((jac, B_v, B_w, rows)) + else: + axial_force = EA * eps0 + axial_forces.append(axial_force) + F_loc += jac * (axial_force * B_membrane + EIy * kappa_y * B_ry + EIz * kappa_z * B_rz) + if tangent: + K_loc += jac * ( + EA * np.outer(B_membrane, B_membrane) + + axial_force * (np.outer(B_v, B_v) + np.outer(B_w, B_w)) + + EIy * np.outer(B_ry, B_ry) + + EIz * np.outer(B_rz, B_rz) + ) + + trial_state: Optional[Any] = state + if fiber_config is not None: + initial_state = _copy_state_fields(state, _INITIAL_BEAM_STATE_KEYS) + initial_stress = _beam_fiber_field( + initial_state.get("initial_fiber_stress", 0.0), + fiber_strain_all.size, + n_fibers, + "initial_fiber_stress", + ) + initial_prestrain = _beam_fiber_field( + initial_state.get("initial_fiber_prestrain", 0.0), + fiber_strain_all.size, + n_fibers, + "initial_fiber_prestrain", + ) + constitutive_fiber_strain = ( + fiber_strain_all - initial_prestrain + initial_stress / E + ) + stress, Et, plastic_new, alpha_new = self._uniaxial_return_map( + constitutive_fiber_strain, + state, + E, + fiber_config.material_curve, + _beam_flow_scale(material, fiber_config.material_curve), + ) + for jac, B_v, B_w, rows in gp_data: + weights_gp = w_f + stress_gp = stress[rows] + F_loc += jac * np.einsum("f,f,fj->j", weights_gp, stress_gp, B_fiber_all[rows]) + axial_force = float(np.sum(weights_gp * stress_gp)) + axial_forces.append(axial_force) + if tangent: + K_loc += jac * np.einsum("f,f,fj,fk->jk", weights_gp, Et[rows], B_fiber_all[rows], B_fiber_all[rows]) + K_loc += jac * axial_force * (np.outer(B_v, B_v) + np.outer(B_w, B_w)) + trial_state = { + "plastic_strain": plastic_new, + "alpha": alpha_new, + "fiber_strain": constitutive_fiber_strain.copy(), + "kinematic_fiber_strain": fiber_strain_all.copy(), + "fiber_stress": stress.copy(), + "axial_force": float(np.mean(axial_forces)) if axial_forces else 0.0, + "equivalent_stress_measure": ( + "hill48" + if _elastic_symmetry(material) == "orthotropic" + else "von_mises" + ), + **initial_state, + } + + if not tangent: + return T.T @ F_loc, None, trial_state + return T.T @ F_loc, T.T @ K_loc @ T, trial_state + + @property + def num_nodes(self) -> int: + return 3 + + @property + def dofs_per_node(self) -> int: + return 6 + + @property + def total_dofs(self) -> int: + return 18 + + def get_node_coordinates(self, mesh: "FEMesh") -> np.ndarray: + coords = np.zeros((3, 3), dtype=float) + for i, node_id in enumerate(self.node_ids): + node = mesh.get_node(node_id) + if node is None: + raise ValueError(f"Quadratic beam element {self.element_id} references missing node {node_id}") + coords[i] = node.coords() + chord = coords[2] - coords[0] + length = float(np.linalg.norm(chord)) + if length > _SMALL: + midpoint_error = float(np.linalg.norm(coords[1] - 0.5 * (coords[0] + coords[2]))) + if midpoint_error > max(1.0e-8 * length, 1.0e-12): + raise ValueError( + f"Quadratic beam element {self.element_id} is curved or has a non-midpoint middle node. " + "The current B3 formulation is straight-sided; use two-node beam segments for curved geometry." + ) + return coords + + def compute_shape_functions(self, xi: float) -> Tuple[np.ndarray, np.ndarray]: + N = np.array([xi * (xi - 1.0) / 2.0, 1.0 - xi**2, xi * (xi + 1.0) / 2.0], dtype=float) + dN_dxi = np.array([xi - 0.5, -2.0 * xi, xi + 0.5], dtype=float) + return N, dN_dxi + + def _beam_frame_and_transform(self, coords: np.ndarray) -> Tuple[float, np.ndarray]: + length = float(np.linalg.norm(coords[2] - coords[0])) + if length < _SMALL: + raise ValueError(f"Quadratic beam element {self.element_id} has near-zero length") + e1 = (coords[2] - coords[0]) / length + R = _beam_rotation_matrix(e1, self._orientation) + T = np.zeros((18, 18), dtype=float) + Rt = R.T + for i in range(3): + b = i * 6 + T[b:b + 3, b:b + 3] = Rt + T[b + 3:b + 6, b + 3:b + 6] = Rt + return length, T + + def compute_stiffness_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: + coords = self.get_node_coordinates(mesh) + try: + L, T = self._beam_frame_and_transform(coords) + except ValueError: + return np.zeros((18, 18), dtype=float) + if self.generalized_section is not None: + section_stiffness = generalized_beam_stiffness( + self.generalized_section + ) + K = np.zeros((18, 18), dtype=float) + for xi, weight in zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS): + shape, derivative_xi = self.compute_shape_functions(float(xi)) + B = _beam_generalized_strain_matrix_from_shape( + shape, + derivative_xi * 2.0 / L, + ) + K += ( + B.T + @ section_stiffness + @ B + * (L / 2.0 * float(weight)) + ) + K_global = T.T @ K @ T + self._stiffness_matrix = K_global + return K_global + E, G12, G13, GJ = _beam_material_properties(material, self.cross_section) + EA = E * self._A + EIy = E * self._Iy + EIz = E * self._Iz + GA_y = G12 * self._A * self._ky + GA_z = G13 * self._A * self._kz + K = np.zeros((18, 18), dtype=float) + for xi, weight in zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS): + N, dN_dxi = self.compute_shape_functions(float(xi)) + dN_dx = dN_dxi * 2.0 / L + B_axial = np.zeros((1, 18), dtype=float) + B_torsion = np.zeros((1, 18), dtype=float) + B_shear_xz = np.zeros((1, 18), dtype=float) + B_shear_xy = np.zeros((1, 18), dtype=float) + B_bend_y = np.zeros((1, 18), dtype=float) + B_bend_z = np.zeros((1, 18), dtype=float) + for i in range(3): + b = i * 6 + B_axial[0, b + 0] = dN_dx[i] + B_torsion[0, b + 3] = dN_dx[i] + B_shear_xz[0, b + 2] = dN_dx[i] + B_shear_xz[0, b + 4] = N[i] + B_shear_xy[0, b + 1] = dN_dx[i] + B_shear_xy[0, b + 5] = -N[i] + B_bend_y[0, b + 4] = dN_dx[i] + B_bend_z[0, b + 5] = dN_dx[i] + jac = L / 2.0 * weight + K += B_axial.T @ (EA * np.eye(1)) @ B_axial * jac + K += B_torsion.T @ (GJ * np.eye(1)) @ B_torsion * jac + K += B_shear_xz.T @ (GA_z * np.eye(1)) @ B_shear_xz * jac + K += B_shear_xy.T @ (GA_y * np.eye(1)) @ B_shear_xy * jac + K += B_bend_y.T @ (EIy * np.eye(1)) @ B_bend_y * jac + K += B_bend_z.T @ (EIz * np.eye(1)) @ B_bend_z * jac + K_global = T.T @ K @ T + self._stiffness_matrix = K_global + return K_global + + def compute_mass_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: + coords = self.get_node_coordinates(mesh) + try: + L, T = self._beam_frame_and_transform(coords) + except ValueError: + return np.zeros((18, 18), dtype=float) + M = np.zeros((18, 18), dtype=float) + generalized_mass = ( + None + if self.generalized_section is None + else generalized_beam_mass_matrix(self.generalized_section) + ) + if generalized_mass is not None: + for xi, weight in zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS): + N, _ = self.compute_shape_functions(float(xi)) + jacobian_weight = float(weight) * L / 2.0 + for i in range(3): + for j in range(3): + M[ + i * 6 : (i + 1) * 6, + j * 6 : (j + 1) * 6, + ] += ( + N[i] + * N[j] + * jacobian_weight + * generalized_mass + ) + M_global = T.T @ M @ T + self._mass_matrix = M_global + return M_global + rho = material.density + # Consistent rotary inertia per rotation axis: polar (Iy+Iz) for + # torsion, the matching section inertia for each bending rotation. + rotary_inertia = (rho * (self._Iy + self._Iz), rho * self._Iy, rho * self._Iz) + for xi, weight in zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS): + N, _ = self.compute_shape_functions(float(xi)) + for i in range(3): + for j in range(3): + translational = N[i] * N[j] * rho * self._A * weight * L / 2.0 + for d in range(3): + M[i * 6 + d, j * 6 + d] += translational + M[i * 6 + 3 + d, j * 6 + 3 + d] += N[i] * N[j] * rotary_inertia[d] * weight * L / 2.0 + M_global = T.T @ M @ T + self._mass_matrix = M_global + return M_global + + def compute_geometric_stiffness_matrix( + self, + mesh: "FEMesh", + material: "Material", + state: Optional[Any] = None, + ) -> np.ndarray: + """ + Beam-column stress stiffness from the lateral displacement gradient: + + KG = N_compression * integral (dN/dx)^T (dN/dx) dx + + applied to both transverse deflections. This is the same + destabilizing-gradient theory as the shell membrane KG and follows the + package convention ``K phi = lambda KG phi`` with compression positive. + The higher-order rotation-gradient term is omitted, which makes the + predicted critical loads slightly conservative on coarse meshes. + """ + axial_compression = self._axial_compression_from_state(state) + if axial_compression == 0.0: + return np.zeros((self.total_dofs, self.total_dofs), dtype=float) + + coords = self.get_node_coordinates(mesh) + try: + L, T = self._beam_frame_and_transform(coords) + except ValueError: + return np.zeros((self.total_dofs, self.total_dofs), dtype=float) + + KG = np.zeros((18, 18), dtype=float) + # Wagner term factor: see BeamElement.compute_geometric_stiffness_matrix. + polar_ratio = self._geometric_polar_radius_squared() + for xi, weight in zip(self.GAUSS_POINTS, self.GAUSS_WEIGHTS): + _, dN_dxi = self.compute_shape_functions(float(xi)) + dN_dx = dN_dxi * 2.0 / L + G_matrix = np.zeros((2, 18), dtype=float) + twist_gradient = np.zeros((1, 18), dtype=float) + for i in range(3): + b = i * 6 + G_matrix[0, b + 1] = dN_dx[i] + G_matrix[1, b + 2] = dN_dx[i] + twist_gradient[0, b + 3] = dN_dx[i] + KG += axial_compression * (G_matrix.T @ G_matrix) * (L / 2.0 * weight) + KG += axial_compression * polar_ratio * (twist_gradient.T @ twist_gradient) * (L / 2.0 * weight) + return T.T @ KG @ T + + +class CoupledBeamShellElement(Element): + """Kinematic MPC coupling between one eccentric beam node and one shell node.""" + + def __init__( + self, + element_id: int, + beam_node_id: int, + shell_node_id: int, + material_name: str = "default", + coupling_stiffness: float = 0.0, + eccentricity: Optional[np.ndarray] = None, *, rotating_eccentricity: bool = True, - ): + ): if type(rotating_eccentricity) is not bool: raise TypeError("rotating_eccentricity must be a bool") - super().__init__(element_id, [beam_node_id, shell_node_id], material_name) + super().__init__(element_id, [beam_node_id, shell_node_id], material_name) self.rotating_eccentricity = rotating_eccentricity - self.beam_node_id = beam_node_id - self.shell_node_id = shell_node_id - self.coupling_stiffness = coupling_stiffness - self.eccentricity = None if eccentricity is None else np.asarray(eccentricity, dtype=float) + self.beam_node_id = beam_node_id + self.shell_node_id = shell_node_id + self.coupling_stiffness = coupling_stiffness + self.eccentricity = None if eccentricity is None else np.asarray(eccentricity, dtype=float) if self.eccentricity is not None: self._validate_eccentricity_shape(self.eccentricity) - - @property - def num_nodes(self) -> int: - return 2 - - @property - def dofs_per_node(self) -> int: - return 6 - - def get_node_coordinates(self, mesh: "FEMesh") -> np.ndarray: - beam_node = mesh.get_node(self.beam_node_id) - shell_node = mesh.get_node(self.shell_node_id) - if beam_node is None or shell_node is None: - raise ValueError(f"Coupling element {self.element_id} references a missing node") - return np.array([beam_node.coords(), shell_node.coords()], dtype=float) - + + @property + def num_nodes(self) -> int: + return 2 + + @property + def dofs_per_node(self) -> int: + return 6 + + def get_node_coordinates(self, mesh: "FEMesh") -> np.ndarray: + beam_node = mesh.get_node(self.beam_node_id) + shell_node = mesh.get_node(self.shell_node_id) + if beam_node is None or shell_node is None: + raise ValueError(f"Coupling element {self.element_id} references a missing node") + return np.array([beam_node.coords(), shell_node.coords()], dtype=float) + def _validate_eccentricity_shape(self, eccentricity: np.ndarray) -> np.ndarray: eccentricity = np.asarray(eccentricity, dtype=float) if eccentricity.shape != (3,): @@ -5426,32 +5426,32 @@ def _validate_eccentricity_shape(self, eccentricity: np.ndarray) -> np.ndarray: ) return eccentricity - def _eccentricity_vector(self, mesh: "FEMesh") -> np.ndarray: - if self.eccentricity is not None: + def _eccentricity_vector(self, mesh: "FEMesh") -> np.ndarray: + if self.eccentricity is not None: r = np.asarray(self.eccentricity, dtype=float) else: coords = self.get_node_coordinates(mesh) r = np.asarray(coords[0] - coords[1], dtype=float) return self._validate_eccentricity_shape(r) - - def compute_stiffness_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: - # Coupling is enforced exactly by assembly.build_constraint_transformation(). - # Returning zero avoids penalty-stiffness pollution. - K = np.zeros((self.total_dofs, self.total_dofs), dtype=float) - self._stiffness_matrix = K - return K - - def get_mpc_constraints(self, mesh: "FEMesh") -> List[Dict[str, Any]]: - """ - Return slave/master constraints for the eccentric beam-shell relation. - - Beam node DOFs are slaves. Shell node DOFs are masters: - u_b = u_s + theta_s x r - theta_b = theta_s - where r points from shell node to beam node. - """ - beam_node = mesh.get_node(self.beam_node_id) - shell_node = mesh.get_node(self.shell_node_id) + + def compute_stiffness_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: + # Coupling is enforced exactly by assembly.build_constraint_transformation(). + # Returning zero avoids penalty-stiffness pollution. + K = np.zeros((self.total_dofs, self.total_dofs), dtype=float) + self._stiffness_matrix = K + return K + + def get_mpc_constraints(self, mesh: "FEMesh") -> List[Dict[str, Any]]: + """ + Return slave/master constraints for the eccentric beam-shell relation. + + Beam node DOFs are slaves. Shell node DOFs are masters: + u_b = u_s + theta_s x r + theta_b = theta_s + where r points from shell node to beam node. + """ + beam_node = mesh.get_node(self.beam_node_id) + shell_node = mesh.get_node(self.shell_node_id) if beam_node is None: raise ValueError( f"Coupling element {self.element_id} references missing beam node " @@ -5462,35 +5462,35 @@ def get_mpc_constraints(self, mesh: "FEMesh") -> List[Dict[str, Any]]: f"Coupling element {self.element_id} references missing shell node " f"{self.shell_node_id}" ) - - b = beam_node.dofs - s = shell_node.dofs - rx, ry, rz = self._eccentricity_vector(mesh) - - return [ - { - "slave": b[0], - "masters": {s[0]: 1.0, s[4]: rz, s[5]: -ry}, - "value": 0.0, - "label": f"beam_shell_ecc_u_x_{self.element_id}", - }, - { - "slave": b[1], - "masters": {s[1]: 1.0, s[3]: -rz, s[5]: rx}, - "value": 0.0, - "label": f"beam_shell_ecc_u_y_{self.element_id}", - }, - { - "slave": b[2], - "masters": {s[2]: 1.0, s[3]: ry, s[4]: -rx}, - "value": 0.0, - "label": f"beam_shell_ecc_u_z_{self.element_id}", - }, - {"slave": b[3], "masters": {s[3]: 1.0}, "value": 0.0, "label": f"beam_shell_ecc_rx_{self.element_id}"}, - {"slave": b[4], "masters": {s[4]: 1.0}, "value": 0.0, "label": f"beam_shell_ecc_ry_{self.element_id}"}, - {"slave": b[5], "masters": {s[5]: 1.0}, "value": 0.0, "label": f"beam_shell_ecc_rz_{self.element_id}"}, - ] - + + b = beam_node.dofs + s = shell_node.dofs + rx, ry, rz = self._eccentricity_vector(mesh) + + return [ + { + "slave": b[0], + "masters": {s[0]: 1.0, s[4]: rz, s[5]: -ry}, + "value": 0.0, + "label": f"beam_shell_ecc_u_x_{self.element_id}", + }, + { + "slave": b[1], + "masters": {s[1]: 1.0, s[3]: -rz, s[5]: rx}, + "value": 0.0, + "label": f"beam_shell_ecc_u_y_{self.element_id}", + }, + { + "slave": b[2], + "masters": {s[2]: 1.0, s[3]: ry, s[4]: -rx}, + "value": 0.0, + "label": f"beam_shell_ecc_u_z_{self.element_id}", + }, + {"slave": b[3], "masters": {s[3]: 1.0}, "value": 0.0, "label": f"beam_shell_ecc_rx_{self.element_id}"}, + {"slave": b[4], "masters": {s[4]: 1.0}, "value": 0.0, "label": f"beam_shell_ecc_ry_{self.element_id}"}, + {"slave": b[5], "masters": {s[5]: 1.0}, "value": 0.0, "label": f"beam_shell_ecc_rz_{self.element_id}"}, + ] + def get_nonlinear_mpc_descriptor(self, mesh: "FEMesh") -> Optional[Dict[str, Any]]: """Return the finite-rotation master-slave descriptor for corotational solves. @@ -5538,790 +5538,790 @@ def get_nonlinear_mpc_descriptor(self, mesh: "FEMesh") -> Optional[Dict[str, Any "label_prefix": f"beam_shell_ecc_{self.element_id}", } - def compute_mass_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: - return np.zeros((self.total_dofs, self.total_dofs), dtype=float) - - - -def validate_initial_field_state( - element: Element, - material: "Material", - state: Dict[str, Any], - num_layers: int, - mesh: Optional["FEMesh"] = None, -) -> None: - """Validate that a prescribed initial stress is locally admissible. - - Residual-stress input specifies the stress *at the initialized reference - state*; it is not a request for the solver to reconstruct an unknown - manufacturing load path. For nonlinear materials the supplied stress - must therefore lie on or inside the flow surface associated with the - supplied hardening state. - """ - tolerance = 1.0e-9 - if isinstance(element, ShellElement) and ( - "initial_membrane_stress" in state or "initial_bending_stress" in state - ): - symmetry = _elastic_symmetry(material) - curve = getattr(material, "hardening_curve", None) - hill_yield = getattr(material, "hill_yield", None) - if symmetry == "orthotropic" and curve is not None and hill_yield is None: - raise ValueError( - f"Orthotropic material {getattr(material, 'name', '')!r} " - "requires hill_yield when hardening_curve is active." - ) - if curve is None and hill_yield is None: - return - n_gp = len(element.gauss_points) - z_layers, _weights = lobatto_layers(num_layers, element.thickness) - zero = np.zeros((n_gp, 3), dtype=float) - membrane = _shell_field_rows( - state.get("initial_membrane_stress", zero), - n_gp, - "initial_membrane_stress", - ) - bending = _shell_field_rows( - state.get("initial_bending_stress", zero), - n_gp, - "initial_bending_stress", - ) - stress = ( - membrane[:, None, :] - + (2.0 * z_layers[None, :, None] / element.thickness) * bending[:, None, :] - ).reshape(n_gp * num_layers, 3) - alpha = np.asarray(state.get("alpha", np.zeros(stress.shape[0])), dtype=float).reshape(-1) - if alpha.size != stress.shape[0]: - raise ValueError( - f"Shell initial alpha has {alpha.size} entries; expected {stress.shape[0]}" - ) - if np.any(~np.isfinite(alpha)) or np.any(alpha < 0.0): - raise ValueError("Shell initial alpha must be finite and non-negative") - if symmetry == "orthotropic": - from .plasticity import hill48_plane_stress_equivalent_stress - - if mesh is None: - if element.material_direction is not None: - raise ValueError( - "mesh is required to validate an oriented orthotropic " - "shell initial stress" - ) - material_angle = np.deg2rad(element.material_angle_deg) - else: - coordinates = element.get_node_coordinates(mesh) - material_angle = element._material_angle( - element._center_frame(coordinates) - ) - _Q, _G, _strain_to_material, stress_to_local = ( - _shell_material_matrices(material, material_angle) - ) - stress_material = np.einsum( - "ij,nj->ni", - np.linalg.inv(stress_to_local), - stress, - ) - equivalent = hill48_plane_stress_equivalent_stress( - stress_material, - hill_yield, - ) - if curve is None: - flow = np.full(equivalent.shape, float(hill_yield.X)) - else: - reference = float( - np.asarray(curve.flow_stress(np.array([0.0])), dtype=float)[0] - ) - flow = ( - float(hill_yield.X) - * np.asarray(curve.flow_stress(alpha), dtype=float) - / reference - ) - else: - equivalent = np.sqrt( - np.maximum( - stress[:, 0] ** 2 - - stress[:, 0] * stress[:, 1] - + stress[:, 1] ** 2 - + 3.0 * stress[:, 2] ** 2, - 0.0, - ) - ) - flow = np.asarray(curve.flow_stress(alpha), dtype=float) - excess = equivalent - flow - if np.any(excess > tolerance * np.maximum(flow, 1.0)): - index = int(np.argmax(excess)) - raise ValueError( - f"Initial shell stress on element {element.element_id} is outside the supplied " - f"hardening-state flow surface at point {index}: " - f"sigma_eq={equivalent[index]:.6g}, flow={flow[index]:.6g}. " - "Supply an admissible stress or compatible alpha history." - ) - if isinstance(element, (BeamElement, QuadraticBeamElement)) and "initial_fiber_stress" in state: - config = element._fiber_plasticity_config(material) - if config is None: - return - curve = config.material_curve - y, _z, _weights = element._fiber_section_grid(config) - section_fibers = y.size - total_fibers = section_fibers * ( - len(element.GAUSS_POINTS) if isinstance(element, QuadraticBeamElement) else 1 - ) - stress = _beam_fiber_field( - state["initial_fiber_stress"], - total_fibers, - section_fibers, - "initial_fiber_stress", - ) - alpha = np.asarray(state.get("alpha", np.zeros(total_fibers)), dtype=float).reshape(-1) - if alpha.size not in {1, total_fibers}: - raise ValueError( - f"Beam initial alpha has {alpha.size} entries; expected 1 or {total_fibers}" - ) - if alpha.size == 1: - alpha = np.full(total_fibers, float(alpha[0]), dtype=float) - if np.any(~np.isfinite(alpha)) or np.any(alpha < 0.0): - raise ValueError("Beam initial alpha must be finite and non-negative") - scale = _beam_flow_scale(material, curve) - flow = ( - np.full(alpha.shape, scale, dtype=float) - if curve is None - else scale * np.asarray(curve.flow_stress(alpha), dtype=float) - ) - excess = np.abs(stress) - flow - if np.any(excess > tolerance * np.maximum(flow, 1.0)): - index = int(np.argmax(excess)) - raise ValueError( - f"Initial beam-fiber stress on element {element.element_id} is outside the supplied " - f"hardening-state flow surface at fiber {index}: " - f"|sigma|={abs(stress[index]):.6g}, flow={flow[index]:.6g}. " - "Supply an admissible stress or compatible alpha history." - ) - - -ELEMENT_TYPES = { - "shell": ShellElement, - "shell3": ShellElement, - "tri3": ShellElement, - "tria3": ShellElement, - "t3": ShellElement, - "s3": ShellElement, - "shell6": ShellElement, - "tri6": ShellElement, - "tria6": ShellElement, - "t6": ShellElement, - "s6": ShellElement, - "beam": BeamElement, - "quadratic_beam": QuadraticBeamElement, - "coupled": CoupledBeamShellElement, -} - - -DEFAULT_Q4_FORMULATION = "e4-pl" -# New/current-policy three-node shells use the V2D companion accepted by the -# V6W qualification. Historical records without formulation identity still -# deserialize explicitly as ``legacy-s3`` below, and direct -# ``ShellElement(...)`` construction remains the documented legacy API. -DEFAULT_S3_FORMULATION = "e4-pl-s3-v2d" -LEGACY_Q4_AVAILABLE_THROUGH = "0.4.x" -LEGACY_Q4_REMOVAL_TARGET = "0.5.0" - - -class LegacyQ4DeprecationWarning(DeprecationWarning): - """Warning emitted when the temporary legacy four-node rollback is used.""" - - -class LegacyS3MigrationWarning(UserWarning): - """Warning emitted when a missing-ID historical TRI3 loads as legacy.""" - - -LegacyShellElement = ShellElement - - -def _normalized_shell_formulation( - node_count: int, - formulation: Optional[str], -) -> str: - if formulation is None: - resolved = ( - DEFAULT_Q4_FORMULATION - if node_count == 4 - else DEFAULT_S3_FORMULATION - if node_count == 3 - else "legacy" - ) - else: - resolved = str(formulation) - raw_resolved = resolved.strip().lower() - resolved = raw_resolved.replace("_", "-") - exact_s3_v2_selectors = {"e4-pl-s3-v2", "qualified-s3-v2"} - exact_s3_v2b_selectors = {"e4-pl-s3-v2b", "qualified-s3-v2b"} - exact_s3_v2c_selectors = {"e4-pl-s3-v2c", "qualified-s3-v2c"} - exact_s3_v2d_selectors = {"e4-pl-s3-v2d", "qualified-s3-v2d"} - if resolved in exact_s3_v2_selectors and raw_resolved not in exact_s3_v2_selectors: - raise ValueError( - "strict-flat E4-PL S3 V2 requires the canonical e4-pl-s3-v2 selector" - ) - if resolved in exact_s3_v2b_selectors and raw_resolved not in exact_s3_v2b_selectors: - raise ValueError( - "strict-flat E4-PL S3 V2B requires the canonical e4-pl-s3-v2b selector" - ) - if resolved in exact_s3_v2c_selectors and raw_resolved not in exact_s3_v2c_selectors: - raise ValueError( - "strict-flat E4-PL S3 V2C requires the canonical e4-pl-s3-v2c selector" - ) - if resolved in exact_s3_v2d_selectors and raw_resolved not in exact_s3_v2d_selectors: - raise ValueError( - "native-parity E4-PL S3 V2D requires the canonical e4-pl-s3-v2d selector" - ) - if resolved == "default": - resolved = ( - DEFAULT_Q4_FORMULATION - if node_count == 4 - else DEFAULT_S3_FORMULATION - if node_count == 3 - else "legacy" - ) - e4_aliases = {"e4-pl", "qualified-s4"} - s3_aliases = {"e4-pl-s3", "qualified-s3"} - s3_v2_aliases = exact_s3_v2_selectors - s3_v2b_aliases = exact_s3_v2b_selectors - s3_v2c_aliases = exact_s3_v2c_selectors - s3_v2d_aliases = exact_s3_v2d_selectors - legacy_aliases = {"legacy", "legacy-shell", "legacy-s4"} - if node_count == 4 and resolved in e4_aliases: - return "e4-pl" - if node_count == 3 and resolved in s3_aliases: - return "e4-pl-s3-v2d" - if node_count == 3 and resolved in s3_v2_aliases: - return "e4-pl-s3-v2" - if node_count == 3 and resolved in s3_v2b_aliases: - return "e4-pl-s3-v2b" - if node_count == 3 and resolved in s3_v2c_aliases: - return "e4-pl-s3-v2c" - if node_count == 3 and resolved in s3_v2d_aliases: - return "e4-pl-s3-v2d" - if resolved == "legacy-s3": - if node_count != 3: - raise ValueError("legacy-s3 is available only for three-node shell topology") - return "legacy-s3" - if resolved in legacy_aliases: - return "legacy" - if resolved in e4_aliases: - raise ValueError("E4-PL is available only for four-node shell topology") - if resolved in s3_aliases: - raise ValueError("qualified E4-PL S3 is available only for three-node shell topology") - if resolved in s3_v2_aliases: - raise ValueError( - "strict-flat E4-PL S3 V2 is available only for three-node shell topology" - ) - if resolved in s3_v2b_aliases: - raise ValueError( - "strict-flat E4-PL S3 V2B is available only for three-node shell topology" - ) - if resolved in s3_v2c_aliases: - raise ValueError( - "strict-flat E4-PL S3 V2C is available only for three-node shell topology" - ) - if resolved in s3_v2d_aliases: - raise ValueError( - "native-parity E4-PL S3 V2D is available only for three-node shell topology" - ) - raise ValueError(f"Unknown shell formulation: {formulation}") - - -def shell_formulation_diagnostics( - *, - node_count: int = 4, - formulation: Optional[str] = None, -) -> Dict[str, Any]: - """Describe shell selection and the temporary legacy-Q4 rollback state. - - This helper performs no element construction or mechanics. It is intended - for migration tooling, logs, and support diagnostics. - """ - - count = int(node_count) - if count not in {3, 4, 6, 8}: - raise ValueError("shell node_count must be one of 3, 4, 6 or 8") - selected = _normalized_shell_formulation(count, formulation) - normalized_request = ( - None - if formulation is None - else str(formulation).strip().lower().replace("_", "-") - ) - return { - "schema": "anysolver.shell-formulation-diagnostics-v1", - "node_count": count, - "requested_formulation": normalized_request, - "selected_formulation": selected, - "production_default": formulation is None and count in {3, 4}, - "topology_policy": ( - "QUALIFIED_E4_PL_Q4" - if count == 4 and selected == "e4-pl" - else ( - "DEPRECATED_LEGACY_Q4_ROLLBACK" - if count == 4 - else ( - "QUALIFIED_E4_PL_S3_OPT_IN" - if count == 3 and selected == "e4-pl-s3" - else ( - "STRICT_FLAT_LINEAR_E4_PL_S3_V2_OPT_IN" - if count == 3 and selected == "e4-pl-s3-v2" - else ( - "STRICT_FLAT_LINEAR_E4_PL_S3_V2B_OPT_IN" - if count == 3 and selected == "e4-pl-s3-v2b" - else ( - "STRICT_FLAT_LINEAR_E4_PL_S3_V2C_OPT_IN" - if count == 3 and selected == "e4-pl-s3-v2c" - else ( - "NATIVE_PARITY_E4_PL_S3_V2D_DEFAULT" - if count == 3 and selected == "e4-pl-s3-v2d" - else "PRESERVED_LEGACY_NON_Q4" - ) - ) - ) - ) - ) - ) - ), - "legacy_q4": { - "state": "DEPRECATED_BURN_IN_ROLLBACK", - "available_through": LEGACY_Q4_AVAILABLE_THROUGH, - "removal_not_before": LEGACY_Q4_REMOVAL_TARGET, - "selector": "legacy", - "warning": "LegacyQ4DeprecationWarning", - }, - } - - -def create_shell_element( - element_id: int, - node_ids: List[int], - material_name: str = "default", - *, - formulation: Optional[str] = None, - **kwargs: Any, -) -> ShellElement: - """Create a topology-selected shell while retaining explicit rollbacks. - - Four-node and three-node shells select their qualified E4-PL formulations - by default. Higher-order shell topologies retain - :class:`LegacyShellElement`. Passing ``formulation="legacy-s3"`` is the - documented three-node rollback; an explicit ``e4-pl`` request remains - Q4-only. - """ - - resolved = _normalized_shell_formulation(len(node_ids), formulation) - if resolved == "e4-pl": - from .e4_pl_element import QualifiedE4PLShellElement - - return QualifiedE4PLShellElement( - element_id, - node_ids, - material_name, - **kwargs, - ) - if resolved == "e4-pl-s3": - from .e4_pl_s3_element import QualifiedE4PLS3ShellElement - - return QualifiedE4PLS3ShellElement( - element_id, - node_ids, - material_name, - **kwargs, - ) - if resolved == "e4-pl-s3-v2": - from .e4_pl_s3_v2_element import StrictFlatLinearE4PLS3V2ShellElement - - return StrictFlatLinearE4PLS3V2ShellElement( - element_id, - node_ids, - material_name, - **kwargs, - ) - if resolved == "e4-pl-s3-v2b": - from .e4_pl_s3_v2b_element import StrictFlatLinearE4PLS3V2BShellElement - - return StrictFlatLinearE4PLS3V2BShellElement( - element_id, - node_ids, - material_name, - **kwargs, - ) - if resolved == "e4-pl-s3-v2c": - from .e4_pl_s3_v2c_element import StrictFlatLinearE4PLS3V2CShellElement - - return StrictFlatLinearE4PLS3V2CShellElement( - element_id, - node_ids, - material_name, - **kwargs, - ) - if resolved == "e4-pl-s3-v2d": - from .e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement - - if kwargs.get("reference_normal") is None: - raise ValueError( - "qualified S3 V2D requires authoritative reference_normal; " - "use formulation='legacy-s3' for historical connectivity-only input" - ) - - return NativeParityE4PLS3V2DShellElement( - element_id, - node_ids, - material_name, - **kwargs, - ) - if resolved in {"legacy", "legacy-s3"}: - return LegacyShellElement(element_id, node_ids, material_name, **kwargs) - raise AssertionError(f"unreachable shell formulation selection: {resolved}") - - -def shell_element_from_dict(payload: Mapping[str, Any]) -> ShellElement: - """Deserialize a shell without guessing a qualified formulation. - - Historical three-node records without ``formulation_id`` remain legacy. - Qualified records are dispatched by their exact identity and unknown - identities fail closed. - """ - - if not isinstance(payload, Mapping): - raise TypeError("serialized shell element must be a mapping") - data = dict(payload) - node_ids = [int(value) for value in data.get("node_ids", ())] - formulation_id = data.get("formulation_id") - if formulation_id is not None: - from .e4_pl_s3_v2_element import ( - FORMULATION_ID as S3_V2_FORMULATION_ID, - StrictFlatLinearCapabilityError, - ) - from .e4_pl_s3_v2b_element import ( - FORMULATION_ID as S3_V2B_FORMULATION_ID, - StrictFlatLinearCapabilityError as StrictFlatLinearV2BCapabilityError, - ) - from .e4_pl_s3_v2c_element import ( - FORMULATION_ID as S3_V2C_FORMULATION_ID, - StrictFlatLinearE4PLS3V2CShellElement, - ) - from .e4_pl_s3_v2d_element import ( - FORMULATION_ID as S3_V2D_FORMULATION_ID, - NativeParityE4PLS3V2DShellElement, - ) - - if formulation_id == S3_V2_FORMULATION_ID: - raise StrictFlatLinearCapabilityError( - "strict-flat S3 V2 serialization/restart is outside the " - "authorized Stage-1 surface" - ) - if formulation_id == S3_V2B_FORMULATION_ID: - raise StrictFlatLinearV2BCapabilityError( - "strict-flat S3 V2B serialization/restart is outside the " - "authorized production-parity surface" - ) - if formulation_id == S3_V2C_FORMULATION_ID: - return StrictFlatLinearE4PLS3V2CShellElement.from_dict(data) - if formulation_id == S3_V2D_FORMULATION_ID: - return NativeParityE4PLS3V2DShellElement.from_dict(data) - from .e4_pl_element import ( - FORMULATION_ID as Q4_FORMULATION_ID, - QualifiedE4PLShellElement, - _PLANAR_FORMULATION_ID, - ) - from .e4_pl_s3_element import ( - FORMULATION_ID as S3_FORMULATION_ID, - QualifiedE4PLS3ShellElement, - ) - - if formulation_id in {Q4_FORMULATION_ID, _PLANAR_FORMULATION_ID}: - return QualifiedE4PLShellElement.from_dict(data) - if formulation_id == S3_FORMULATION_ID: - return QualifiedE4PLS3ShellElement.from_dict(data) - raise ValueError(f"unknown serialized shell formulation_id: {formulation_id}") - def normalize_candidate_fingerprint(value: Any) -> str: - return str(value).strip().lower().replace("_", "-") - - normalized_serialized_type = normalize_candidate_fingerprint( - data.get("type", "") - ) - if normalized_serialized_type in { - "qualifiede4plshellelement", - "qualifiede4pls3shellelement", - "strictflatlineare4pls3v2shellelement", - "strictflatlineare4pls3v2bshellelement", - "strictflatlineare4pls3v2cshellelement", - "nativeparitye4pls3v2dshellelement", - "e4-pl", - "e4-pl-s3", - "e4-pl-s3-v2", - "e4-pl-s3-v2b", - "e4-pl-s3-v2c", - "e4-pl-s3-v2d", - "qualified-s3-v2", - "qualified-s3-v2b", - "qualified-s3-v2c", - "qualified-s3-v2d", - "qualified-s3", - }: - raise ValueError("serialized qualified shell is missing formulation_id") - qualified_s3_markers = frozenset( - { - "algebraic_coordinate_policy", - "bubble_convention", - "dynamic_reduction_policy", - "director_polarity", - "director_polarity_policy_id", - "director_reversal_transform_id", - "formulation_schema", - "geometric_stiffness_policy", - "mass_moment_id", - "quadrature_id", - "quadrature_authority_id", - "reference_normal", - "reference_surface_offset", - "reference_surface_offset_policy_id", - "reference_surface_strain_transform_id", - "reference_surface_mass_shift_id", - "recovery_policy_id", - "state_layout_id", - } - ) - strict_s3_v2_unique_markers = frozenset( - { - "director_policy_id", - "equation_map_sha256", - "pl_completion_policy_id", - "primary_source_sha256", - "resultant_policy_id", - "section_policy_id", - "source_contract_schema", - "source_contract_sha256", - "strict_flat_linear_scope_id", - } - ) - qualified_q4_markers = frozenset( - { - "activity_disposition_schema_id", - "current_state_binding_schema_id", - "current_state_algorithmic_origin_schema_id", - "current_state_projection_policy_id", - "current_state_tangent_decomposition_policy_id", - "deleted_frozen_policy_id", - "director_polarity", - "director_polarity_policy_id", - "director_reversal_transform_id", - "implementation_id", - "quadrature_authority_id", - "failed_state_policy_id", - "recovery_policy_id", - "reference_normal", - "stationary_solve_policy_id", - } - ) - strict_s3_v2_marker_set = set(strict_s3_v2_unique_markers & data.keys()) - serialized_selector = data.get("selector") - if isinstance(serialized_selector, str) and normalize_candidate_fingerprint( - serialized_selector - ) in { - "e4-pl-s3-v2", - "e4-pl-s3-v2b", - "e4-pl-s3-v2c", - "e4-pl-s3-v2d", - "qualified-s3-v2", - "qualified-s3-v2b", - "qualified-s3-v2c", - "qualified-s3-v2d", - }: - strict_s3_v2_marker_set.add("selector") - if normalize_candidate_fingerprint(data.get("implementation_id", "")) == ( - "e4-pl-s3-v2-dkmt-eq12-41-cst-pl-hammer3-v1" - ): - strict_s3_v2_marker_set.add("implementation_id") - if normalize_candidate_fingerprint(data.get("implementation_id", "")) == ( - "e4-pl-s3-v2c-min3-relaxed-uhm-cst-pl-parity-v1" - ): - strict_s3_v2_marker_set.add("implementation_id") - if normalize_candidate_fingerprint(data.get("implementation_id", "")) == ( - "e4-pl-s3-v2d-min3-native-section-linear-gate-v1" - ): - strict_s3_v2_marker_set.add("implementation_id") - if normalize_candidate_fingerprint(data.get("implementation_id", "")) == ( - "e4-pl-s3-v2b-min3-relaxed-uhm-cst-pl-hammer3-v1" - ): - strict_s3_v2_marker_set.add("implementation_id") - if normalize_candidate_fingerprint(data.get("formulation_schema", "")) == ( - "anysolver.e4-pl-s3-v2-strict-flat-linear-element-v1" - ): - strict_s3_v2_marker_set.add("formulation_schema") - if normalize_candidate_fingerprint(data.get("formulation_schema", "")) == ( - "anysolver.e4-pl-s3-v2c-flat-linear-parity-element-v1" - ): - strict_s3_v2_marker_set.add("formulation_schema") - if normalize_candidate_fingerprint(data.get("formulation_schema", "")) == ( - "anysolver.e4-pl-s3-v2d-native-parity-element-v1" - ): - strict_s3_v2_marker_set.add("formulation_schema") - if normalize_candidate_fingerprint(data.get("formulation_schema", "")) == ( - "anysolver.e4-pl-s3-v2b-strict-flat-linear-element-v1" - ): - strict_s3_v2_marker_set.add("formulation_schema") - if normalize_candidate_fingerprint( - data.get("quadrature_authority_id", "") - ) == "s3-v2-dkmt-hammer3-degree2-exact-v1": - strict_s3_v2_marker_set.add("quadrature_authority_id") - if strict_s3_v2_marker_set: - raise ValueError( - "serialized shell retains strict-flat S3 V2 fingerprint markers " - "but is missing formulation_id: " - + ", ".join(sorted(strict_s3_v2_marker_set)) - ) - retained_s3_marker_set = set(qualified_s3_markers & data.keys()) - retained_s3_markers = tuple(sorted(retained_s3_marker_set)) - if len(node_ids) == 3 and retained_s3_markers: - raise ValueError( - "serialized three-node shell retains qualified S3 fingerprint " - "markers but is missing formulation_id: " - + ", ".join(retained_s3_markers) - ) - retained_q4_markers = tuple(sorted(qualified_q4_markers & data.keys())) - if len(node_ids) == 4 and retained_q4_markers: - raise ValueError( - "serialized four-node shell retains qualified Q4 fingerprint " - "markers but is missing formulation_id: " - + ", ".join(retained_q4_markers) - ) - if len(node_ids) not in {3, 4, 6, 8}: - raise ValueError("serialized legacy shell requires 3, 4, 6 or 8 nodes") - element = create_shell_element( - element_id=int(data["element_id"]), - node_ids=node_ids, - material_name=str(data.get("material_name", "default")), - formulation="legacy-s3" if len(node_ids) == 3 else "legacy", - thickness=float(data.get("thickness", 0.01)), - drilling_stabilization=float(data.get("drilling_stabilization", 1.0e-3)), - reduced_integration=bool(data.get("reduced_integration", False)), - hourglass_stabilization=float(data.get("hourglass_stabilization", 1.0e-8)), - material_direction=data.get("material_direction"), - material_angle_deg=float(data.get("material_angle_deg", 0.0)), - shell_section=data.get("shell_section"), - ) - if len(node_ids) == 3: - warnings.warn( - "LEGACY_S3_MISSING_FORMULATION_ID: historical three-node shell " - "record loaded as legacy-s3; qualified-s3 was not inferred; " - "qualified-s3 hot restart is forbidden without full load-history " - "replay", - LegacyS3MigrationWarning, - stacklevel=2, - ) - return element - - -def create_element( - element_type: str, - element_id: int, - node_ids: List[int], - material_name: str = "default", - **kwargs: Any, -) -> Element: - normalized_type = str(element_type).lower() - if normalized_type == "ge-beam3": - # The qualified geometrically exact three-node beam is deliberately - # kept out of ``ELEMENT_TYPES``. That registry also feeds legacy - # beam dispatch and batching paths, while GE-B3 has its own rotation - # transaction and state contract. Keep this one exact opt-in route - # local so no existing beam spelling changes meaning. - from .ge_beam3_element import GeometricallyExactBeam3D3NElement - - return GeometricallyExactBeam3D3NElement( - element_id, - node_ids, - material_name, - **kwargs, - ) - if normalized_type in {"e4-pl-s3-v2d", "qualified-s3-v2d"}: - return create_shell_element( - element_id, - node_ids, - material_name, - formulation="e4-pl-s3-v2d", - **kwargs, - ) - if normalized_type in {"e4-pl-s3-v2c", "qualified-s3-v2c"}: - return create_shell_element( - element_id, - node_ids, - material_name, - formulation="e4-pl-s3-v2c", - **kwargs, - ) - if normalized_type in {"e4-pl-s3-v2b", "qualified-s3-v2b"}: - return create_shell_element( - element_id, - node_ids, - material_name, - formulation="e4-pl-s3-v2b", - **kwargs, - ) - if normalized_type in {"e4-pl-s3-v2", "qualified-s3-v2"}: - return create_shell_element( - element_id, - node_ids, - material_name, - formulation="e4-pl-s3-v2", - **kwargs, - ) - if normalized_type in {"e4-pl-s3", "e4_pl_s3", "qualified-s3", "qualified_s3"}: - return create_shell_element( - element_id, - node_ids, - material_name, - formulation="e4-pl-s3", - **kwargs, - ) - if normalized_type in {"legacy-s3", "legacy_s3"}: - return create_shell_element( - element_id, - node_ids, - material_name, - formulation="legacy-s3", - **kwargs, - ) - if normalized_type in {"e4-pl", "e4_pl", "qualified_s4"}: - return create_shell_element( - element_id, - node_ids, - material_name, - formulation="e4-pl", - **kwargs, - ) - if normalized_type in {"legacy-shell", "legacy_shell", "legacy-s4", "legacy_s4"}: - return create_shell_element( - element_id, - node_ids, - material_name, - formulation="legacy", - **kwargs, - ) - if normalized_type == "shell": - formulation = kwargs.pop("formulation", None) - return create_shell_element( - element_id, - node_ids, - material_name, - formulation=formulation, - **kwargs, - ) - if normalized_type in {"shell3", "tri3", "tria3", "t3", "s3"}: - formulation = kwargs.pop("formulation", None) - return create_shell_element( - element_id, - node_ids, - material_name, - formulation=formulation, - **kwargs, - ) - if normalized_type not in ELEMENT_TYPES: - raise ValueError(f"Unknown element type: {element_type}") - if normalized_type == "coupled": - if len(node_ids) != 2: - raise ValueError("CoupledBeamShellElement factory requires [beam_node_id, shell_node_id]") - return CoupledBeamShellElement(element_id, node_ids[0], node_ids[1], material_name, **kwargs) - return ELEMENT_TYPES[normalized_type](element_id, node_ids, material_name, **kwargs) + def compute_mass_matrix(self, mesh: "FEMesh", material: "Material") -> np.ndarray: + return np.zeros((self.total_dofs, self.total_dofs), dtype=float) + + + +def validate_initial_field_state( + element: Element, + material: "Material", + state: Dict[str, Any], + num_layers: int, + mesh: Optional["FEMesh"] = None, +) -> None: + """Validate that a prescribed initial stress is locally admissible. + + Residual-stress input specifies the stress *at the initialized reference + state*; it is not a request for the solver to reconstruct an unknown + manufacturing load path. For nonlinear materials the supplied stress + must therefore lie on or inside the flow surface associated with the + supplied hardening state. + """ + tolerance = 1.0e-9 + if isinstance(element, ShellElement) and ( + "initial_membrane_stress" in state or "initial_bending_stress" in state + ): + symmetry = _elastic_symmetry(material) + curve = getattr(material, "hardening_curve", None) + hill_yield = getattr(material, "hill_yield", None) + if symmetry == "orthotropic" and curve is not None and hill_yield is None: + raise ValueError( + f"Orthotropic material {getattr(material, 'name', '')!r} " + "requires hill_yield when hardening_curve is active." + ) + if curve is None and hill_yield is None: + return + n_gp = len(element.gauss_points) + z_layers, _weights = lobatto_layers(num_layers, element.thickness) + zero = np.zeros((n_gp, 3), dtype=float) + membrane = _shell_field_rows( + state.get("initial_membrane_stress", zero), + n_gp, + "initial_membrane_stress", + ) + bending = _shell_field_rows( + state.get("initial_bending_stress", zero), + n_gp, + "initial_bending_stress", + ) + stress = ( + membrane[:, None, :] + + (2.0 * z_layers[None, :, None] / element.thickness) * bending[:, None, :] + ).reshape(n_gp * num_layers, 3) + alpha = np.asarray(state.get("alpha", np.zeros(stress.shape[0])), dtype=float).reshape(-1) + if alpha.size != stress.shape[0]: + raise ValueError( + f"Shell initial alpha has {alpha.size} entries; expected {stress.shape[0]}" + ) + if np.any(~np.isfinite(alpha)) or np.any(alpha < 0.0): + raise ValueError("Shell initial alpha must be finite and non-negative") + if symmetry == "orthotropic": + from .plasticity import hill48_plane_stress_equivalent_stress + + if mesh is None: + if element.material_direction is not None: + raise ValueError( + "mesh is required to validate an oriented orthotropic " + "shell initial stress" + ) + material_angle = np.deg2rad(element.material_angle_deg) + else: + coordinates = element.get_node_coordinates(mesh) + material_angle = element._material_angle( + element._center_frame(coordinates) + ) + _Q, _G, _strain_to_material, stress_to_local = ( + _shell_material_matrices(material, material_angle) + ) + stress_material = np.einsum( + "ij,nj->ni", + np.linalg.inv(stress_to_local), + stress, + ) + equivalent = hill48_plane_stress_equivalent_stress( + stress_material, + hill_yield, + ) + if curve is None: + flow = np.full(equivalent.shape, float(hill_yield.X)) + else: + reference = float( + np.asarray(curve.flow_stress(np.array([0.0])), dtype=float)[0] + ) + flow = ( + float(hill_yield.X) + * np.asarray(curve.flow_stress(alpha), dtype=float) + / reference + ) + else: + equivalent = np.sqrt( + np.maximum( + stress[:, 0] ** 2 + - stress[:, 0] * stress[:, 1] + + stress[:, 1] ** 2 + + 3.0 * stress[:, 2] ** 2, + 0.0, + ) + ) + flow = np.asarray(curve.flow_stress(alpha), dtype=float) + excess = equivalent - flow + if np.any(excess > tolerance * np.maximum(flow, 1.0)): + index = int(np.argmax(excess)) + raise ValueError( + f"Initial shell stress on element {element.element_id} is outside the supplied " + f"hardening-state flow surface at point {index}: " + f"sigma_eq={equivalent[index]:.6g}, flow={flow[index]:.6g}. " + "Supply an admissible stress or compatible alpha history." + ) + if isinstance(element, (BeamElement, QuadraticBeamElement)) and "initial_fiber_stress" in state: + config = element._fiber_plasticity_config(material) + if config is None: + return + curve = config.material_curve + y, _z, _weights = element._fiber_section_grid(config) + section_fibers = y.size + total_fibers = section_fibers * ( + len(element.GAUSS_POINTS) if isinstance(element, QuadraticBeamElement) else 1 + ) + stress = _beam_fiber_field( + state["initial_fiber_stress"], + total_fibers, + section_fibers, + "initial_fiber_stress", + ) + alpha = np.asarray(state.get("alpha", np.zeros(total_fibers)), dtype=float).reshape(-1) + if alpha.size not in {1, total_fibers}: + raise ValueError( + f"Beam initial alpha has {alpha.size} entries; expected 1 or {total_fibers}" + ) + if alpha.size == 1: + alpha = np.full(total_fibers, float(alpha[0]), dtype=float) + if np.any(~np.isfinite(alpha)) or np.any(alpha < 0.0): + raise ValueError("Beam initial alpha must be finite and non-negative") + scale = _beam_flow_scale(material, curve) + flow = ( + np.full(alpha.shape, scale, dtype=float) + if curve is None + else scale * np.asarray(curve.flow_stress(alpha), dtype=float) + ) + excess = np.abs(stress) - flow + if np.any(excess > tolerance * np.maximum(flow, 1.0)): + index = int(np.argmax(excess)) + raise ValueError( + f"Initial beam-fiber stress on element {element.element_id} is outside the supplied " + f"hardening-state flow surface at fiber {index}: " + f"|sigma|={abs(stress[index]):.6g}, flow={flow[index]:.6g}. " + "Supply an admissible stress or compatible alpha history." + ) + + +ELEMENT_TYPES = { + "shell": ShellElement, + "shell3": ShellElement, + "tri3": ShellElement, + "tria3": ShellElement, + "t3": ShellElement, + "s3": ShellElement, + "shell6": ShellElement, + "tri6": ShellElement, + "tria6": ShellElement, + "t6": ShellElement, + "s6": ShellElement, + "beam": BeamElement, + "quadratic_beam": QuadraticBeamElement, + "coupled": CoupledBeamShellElement, +} + + +DEFAULT_Q4_FORMULATION = "e4-pl" +# New/current-policy three-node shells use the V2D companion accepted by the +# V6W qualification. Historical records without formulation identity still +# deserialize explicitly as ``legacy-s3`` below, and direct +# ``ShellElement(...)`` construction remains the documented legacy API. +DEFAULT_S3_FORMULATION = "e4-pl-s3-v2d" +LEGACY_Q4_AVAILABLE_THROUGH = "0.4.x" +LEGACY_Q4_REMOVAL_TARGET = "0.5.0" + + +class LegacyQ4DeprecationWarning(DeprecationWarning): + """Warning emitted when the temporary legacy four-node rollback is used.""" + + +class LegacyS3MigrationWarning(UserWarning): + """Warning emitted when a missing-ID historical TRI3 loads as legacy.""" + + +LegacyShellElement = ShellElement + + +def _normalized_shell_formulation( + node_count: int, + formulation: Optional[str], +) -> str: + if formulation is None: + resolved = ( + DEFAULT_Q4_FORMULATION + if node_count == 4 + else DEFAULT_S3_FORMULATION + if node_count == 3 + else "legacy" + ) + else: + resolved = str(formulation) + raw_resolved = resolved.strip().lower() + resolved = raw_resolved.replace("_", "-") + exact_s3_v2_selectors = {"e4-pl-s3-v2", "qualified-s3-v2"} + exact_s3_v2b_selectors = {"e4-pl-s3-v2b", "qualified-s3-v2b"} + exact_s3_v2c_selectors = {"e4-pl-s3-v2c", "qualified-s3-v2c"} + exact_s3_v2d_selectors = {"e4-pl-s3-v2d", "qualified-s3-v2d"} + if resolved in exact_s3_v2_selectors and raw_resolved not in exact_s3_v2_selectors: + raise ValueError( + "strict-flat E4-PL S3 V2 requires the canonical e4-pl-s3-v2 selector" + ) + if resolved in exact_s3_v2b_selectors and raw_resolved not in exact_s3_v2b_selectors: + raise ValueError( + "strict-flat E4-PL S3 V2B requires the canonical e4-pl-s3-v2b selector" + ) + if resolved in exact_s3_v2c_selectors and raw_resolved not in exact_s3_v2c_selectors: + raise ValueError( + "strict-flat E4-PL S3 V2C requires the canonical e4-pl-s3-v2c selector" + ) + if resolved in exact_s3_v2d_selectors and raw_resolved not in exact_s3_v2d_selectors: + raise ValueError( + "native-parity E4-PL S3 V2D requires the canonical e4-pl-s3-v2d selector" + ) + if resolved == "default": + resolved = ( + DEFAULT_Q4_FORMULATION + if node_count == 4 + else DEFAULT_S3_FORMULATION + if node_count == 3 + else "legacy" + ) + e4_aliases = {"e4-pl", "qualified-s4"} + s3_aliases = {"e4-pl-s3", "qualified-s3"} + s3_v2_aliases = exact_s3_v2_selectors + s3_v2b_aliases = exact_s3_v2b_selectors + s3_v2c_aliases = exact_s3_v2c_selectors + s3_v2d_aliases = exact_s3_v2d_selectors + legacy_aliases = {"legacy", "legacy-shell", "legacy-s4"} + if node_count == 4 and resolved in e4_aliases: + return "e4-pl" + if node_count == 3 and resolved in s3_aliases: + return "e4-pl-s3-v2d" + if node_count == 3 and resolved in s3_v2_aliases: + return "e4-pl-s3-v2" + if node_count == 3 and resolved in s3_v2b_aliases: + return "e4-pl-s3-v2b" + if node_count == 3 and resolved in s3_v2c_aliases: + return "e4-pl-s3-v2c" + if node_count == 3 and resolved in s3_v2d_aliases: + return "e4-pl-s3-v2d" + if resolved == "legacy-s3": + if node_count != 3: + raise ValueError("legacy-s3 is available only for three-node shell topology") + return "legacy-s3" + if resolved in legacy_aliases: + return "legacy" + if resolved in e4_aliases: + raise ValueError("E4-PL is available only for four-node shell topology") + if resolved in s3_aliases: + raise ValueError("qualified E4-PL S3 is available only for three-node shell topology") + if resolved in s3_v2_aliases: + raise ValueError( + "strict-flat E4-PL S3 V2 is available only for three-node shell topology" + ) + if resolved in s3_v2b_aliases: + raise ValueError( + "strict-flat E4-PL S3 V2B is available only for three-node shell topology" + ) + if resolved in s3_v2c_aliases: + raise ValueError( + "strict-flat E4-PL S3 V2C is available only for three-node shell topology" + ) + if resolved in s3_v2d_aliases: + raise ValueError( + "native-parity E4-PL S3 V2D is available only for three-node shell topology" + ) + raise ValueError(f"Unknown shell formulation: {formulation}") + + +def shell_formulation_diagnostics( + *, + node_count: int = 4, + formulation: Optional[str] = None, +) -> Dict[str, Any]: + """Describe shell selection and the temporary legacy-Q4 rollback state. + + This helper performs no element construction or mechanics. It is intended + for migration tooling, logs, and support diagnostics. + """ + + count = int(node_count) + if count not in {3, 4, 6, 8}: + raise ValueError("shell node_count must be one of 3, 4, 6 or 8") + selected = _normalized_shell_formulation(count, formulation) + normalized_request = ( + None + if formulation is None + else str(formulation).strip().lower().replace("_", "-") + ) + return { + "schema": "anysolver.shell-formulation-diagnostics-v1", + "node_count": count, + "requested_formulation": normalized_request, + "selected_formulation": selected, + "production_default": formulation is None and count in {3, 4}, + "topology_policy": ( + "QUALIFIED_E4_PL_Q4" + if count == 4 and selected == "e4-pl" + else ( + "DEPRECATED_LEGACY_Q4_ROLLBACK" + if count == 4 + else ( + "QUALIFIED_E4_PL_S3_OPT_IN" + if count == 3 and selected == "e4-pl-s3" + else ( + "STRICT_FLAT_LINEAR_E4_PL_S3_V2_OPT_IN" + if count == 3 and selected == "e4-pl-s3-v2" + else ( + "STRICT_FLAT_LINEAR_E4_PL_S3_V2B_OPT_IN" + if count == 3 and selected == "e4-pl-s3-v2b" + else ( + "STRICT_FLAT_LINEAR_E4_PL_S3_V2C_OPT_IN" + if count == 3 and selected == "e4-pl-s3-v2c" + else ( + "NATIVE_PARITY_E4_PL_S3_V2D_DEFAULT" + if count == 3 and selected == "e4-pl-s3-v2d" + else "PRESERVED_LEGACY_NON_Q4" + ) + ) + ) + ) + ) + ) + ), + "legacy_q4": { + "state": "DEPRECATED_BURN_IN_ROLLBACK", + "available_through": LEGACY_Q4_AVAILABLE_THROUGH, + "removal_not_before": LEGACY_Q4_REMOVAL_TARGET, + "selector": "legacy", + "warning": "LegacyQ4DeprecationWarning", + }, + } + + +def create_shell_element( + element_id: int, + node_ids: List[int], + material_name: str = "default", + *, + formulation: Optional[str] = None, + **kwargs: Any, +) -> ShellElement: + """Create a topology-selected shell while retaining explicit rollbacks. + + Four-node and three-node shells select their qualified E4-PL formulations + by default. Higher-order shell topologies retain + :class:`LegacyShellElement`. Passing ``formulation="legacy-s3"`` is the + documented three-node rollback; an explicit ``e4-pl`` request remains + Q4-only. + """ + + resolved = _normalized_shell_formulation(len(node_ids), formulation) + if resolved == "e4-pl": + from .e4_pl_element import QualifiedE4PLShellElement + + return QualifiedE4PLShellElement( + element_id, + node_ids, + material_name, + **kwargs, + ) + if resolved == "e4-pl-s3": + from .e4_pl_s3_element import QualifiedE4PLS3ShellElement + + return QualifiedE4PLS3ShellElement( + element_id, + node_ids, + material_name, + **kwargs, + ) + if resolved == "e4-pl-s3-v2": + from .e4_pl_s3_v2_element import StrictFlatLinearE4PLS3V2ShellElement + + return StrictFlatLinearE4PLS3V2ShellElement( + element_id, + node_ids, + material_name, + **kwargs, + ) + if resolved == "e4-pl-s3-v2b": + from .e4_pl_s3_v2b_element import StrictFlatLinearE4PLS3V2BShellElement + + return StrictFlatLinearE4PLS3V2BShellElement( + element_id, + node_ids, + material_name, + **kwargs, + ) + if resolved == "e4-pl-s3-v2c": + from .e4_pl_s3_v2c_element import StrictFlatLinearE4PLS3V2CShellElement + + return StrictFlatLinearE4PLS3V2CShellElement( + element_id, + node_ids, + material_name, + **kwargs, + ) + if resolved == "e4-pl-s3-v2d": + from .e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement + + if kwargs.get("reference_normal") is None: + raise ValueError( + "qualified S3 V2D requires authoritative reference_normal; " + "use formulation='legacy-s3' for historical connectivity-only input" + ) + + return NativeParityE4PLS3V2DShellElement( + element_id, + node_ids, + material_name, + **kwargs, + ) + if resolved in {"legacy", "legacy-s3"}: + return LegacyShellElement(element_id, node_ids, material_name, **kwargs) + raise AssertionError(f"unreachable shell formulation selection: {resolved}") + + +def shell_element_from_dict(payload: Mapping[str, Any]) -> ShellElement: + """Deserialize a shell without guessing a qualified formulation. + + Historical three-node records without ``formulation_id`` remain legacy. + Qualified records are dispatched by their exact identity and unknown + identities fail closed. + """ + + if not isinstance(payload, Mapping): + raise TypeError("serialized shell element must be a mapping") + data = dict(payload) + node_ids = [int(value) for value in data.get("node_ids", ())] + formulation_id = data.get("formulation_id") + if formulation_id is not None: + from .e4_pl_s3_v2_element import ( + FORMULATION_ID as S3_V2_FORMULATION_ID, + StrictFlatLinearCapabilityError, + ) + from .e4_pl_s3_v2b_element import ( + FORMULATION_ID as S3_V2B_FORMULATION_ID, + StrictFlatLinearCapabilityError as StrictFlatLinearV2BCapabilityError, + ) + from .e4_pl_s3_v2c_element import ( + FORMULATION_ID as S3_V2C_FORMULATION_ID, + StrictFlatLinearE4PLS3V2CShellElement, + ) + from .e4_pl_s3_v2d_element import ( + FORMULATION_ID as S3_V2D_FORMULATION_ID, + NativeParityE4PLS3V2DShellElement, + ) + + if formulation_id == S3_V2_FORMULATION_ID: + raise StrictFlatLinearCapabilityError( + "strict-flat S3 V2 serialization/restart is outside the " + "authorized Stage-1 surface" + ) + if formulation_id == S3_V2B_FORMULATION_ID: + raise StrictFlatLinearV2BCapabilityError( + "strict-flat S3 V2B serialization/restart is outside the " + "authorized production-parity surface" + ) + if formulation_id == S3_V2C_FORMULATION_ID: + return StrictFlatLinearE4PLS3V2CShellElement.from_dict(data) + if formulation_id == S3_V2D_FORMULATION_ID: + return NativeParityE4PLS3V2DShellElement.from_dict(data) + from .e4_pl_element import ( + FORMULATION_ID as Q4_FORMULATION_ID, + QualifiedE4PLShellElement, + _PLANAR_FORMULATION_ID, + ) + from .e4_pl_s3_element import ( + FORMULATION_ID as S3_FORMULATION_ID, + QualifiedE4PLS3ShellElement, + ) + + if formulation_id in {Q4_FORMULATION_ID, _PLANAR_FORMULATION_ID}: + return QualifiedE4PLShellElement.from_dict(data) + if formulation_id == S3_FORMULATION_ID: + return QualifiedE4PLS3ShellElement.from_dict(data) + raise ValueError(f"unknown serialized shell formulation_id: {formulation_id}") + def normalize_candidate_fingerprint(value: Any) -> str: + return str(value).strip().lower().replace("_", "-") + + normalized_serialized_type = normalize_candidate_fingerprint( + data.get("type", "") + ) + if normalized_serialized_type in { + "qualifiede4plshellelement", + "qualifiede4pls3shellelement", + "strictflatlineare4pls3v2shellelement", + "strictflatlineare4pls3v2bshellelement", + "strictflatlineare4pls3v2cshellelement", + "nativeparitye4pls3v2dshellelement", + "e4-pl", + "e4-pl-s3", + "e4-pl-s3-v2", + "e4-pl-s3-v2b", + "e4-pl-s3-v2c", + "e4-pl-s3-v2d", + "qualified-s3-v2", + "qualified-s3-v2b", + "qualified-s3-v2c", + "qualified-s3-v2d", + "qualified-s3", + }: + raise ValueError("serialized qualified shell is missing formulation_id") + qualified_s3_markers = frozenset( + { + "algebraic_coordinate_policy", + "bubble_convention", + "dynamic_reduction_policy", + "director_polarity", + "director_polarity_policy_id", + "director_reversal_transform_id", + "formulation_schema", + "geometric_stiffness_policy", + "mass_moment_id", + "quadrature_id", + "quadrature_authority_id", + "reference_normal", + "reference_surface_offset", + "reference_surface_offset_policy_id", + "reference_surface_strain_transform_id", + "reference_surface_mass_shift_id", + "recovery_policy_id", + "state_layout_id", + } + ) + strict_s3_v2_unique_markers = frozenset( + { + "director_policy_id", + "equation_map_sha256", + "pl_completion_policy_id", + "primary_source_sha256", + "resultant_policy_id", + "section_policy_id", + "source_contract_schema", + "source_contract_sha256", + "strict_flat_linear_scope_id", + } + ) + qualified_q4_markers = frozenset( + { + "activity_disposition_schema_id", + "current_state_binding_schema_id", + "current_state_algorithmic_origin_schema_id", + "current_state_projection_policy_id", + "current_state_tangent_decomposition_policy_id", + "deleted_frozen_policy_id", + "director_polarity", + "director_polarity_policy_id", + "director_reversal_transform_id", + "implementation_id", + "quadrature_authority_id", + "failed_state_policy_id", + "recovery_policy_id", + "reference_normal", + "stationary_solve_policy_id", + } + ) + strict_s3_v2_marker_set = set(strict_s3_v2_unique_markers & data.keys()) + serialized_selector = data.get("selector") + if isinstance(serialized_selector, str) and normalize_candidate_fingerprint( + serialized_selector + ) in { + "e4-pl-s3-v2", + "e4-pl-s3-v2b", + "e4-pl-s3-v2c", + "e4-pl-s3-v2d", + "qualified-s3-v2", + "qualified-s3-v2b", + "qualified-s3-v2c", + "qualified-s3-v2d", + }: + strict_s3_v2_marker_set.add("selector") + if normalize_candidate_fingerprint(data.get("implementation_id", "")) == ( + "e4-pl-s3-v2-dkmt-eq12-41-cst-pl-hammer3-v1" + ): + strict_s3_v2_marker_set.add("implementation_id") + if normalize_candidate_fingerprint(data.get("implementation_id", "")) == ( + "e4-pl-s3-v2c-min3-relaxed-uhm-cst-pl-parity-v1" + ): + strict_s3_v2_marker_set.add("implementation_id") + if normalize_candidate_fingerprint(data.get("implementation_id", "")) == ( + "e4-pl-s3-v2d-min3-native-section-linear-gate-v1" + ): + strict_s3_v2_marker_set.add("implementation_id") + if normalize_candidate_fingerprint(data.get("implementation_id", "")) == ( + "e4-pl-s3-v2b-min3-relaxed-uhm-cst-pl-hammer3-v1" + ): + strict_s3_v2_marker_set.add("implementation_id") + if normalize_candidate_fingerprint(data.get("formulation_schema", "")) == ( + "anysolver.e4-pl-s3-v2-strict-flat-linear-element-v1" + ): + strict_s3_v2_marker_set.add("formulation_schema") + if normalize_candidate_fingerprint(data.get("formulation_schema", "")) == ( + "anysolver.e4-pl-s3-v2c-flat-linear-parity-element-v1" + ): + strict_s3_v2_marker_set.add("formulation_schema") + if normalize_candidate_fingerprint(data.get("formulation_schema", "")) == ( + "anysolver.e4-pl-s3-v2d-native-parity-element-v1" + ): + strict_s3_v2_marker_set.add("formulation_schema") + if normalize_candidate_fingerprint(data.get("formulation_schema", "")) == ( + "anysolver.e4-pl-s3-v2b-strict-flat-linear-element-v1" + ): + strict_s3_v2_marker_set.add("formulation_schema") + if normalize_candidate_fingerprint( + data.get("quadrature_authority_id", "") + ) == "s3-v2-dkmt-hammer3-degree2-exact-v1": + strict_s3_v2_marker_set.add("quadrature_authority_id") + if strict_s3_v2_marker_set: + raise ValueError( + "serialized shell retains strict-flat S3 V2 fingerprint markers " + "but is missing formulation_id: " + + ", ".join(sorted(strict_s3_v2_marker_set)) + ) + retained_s3_marker_set = set(qualified_s3_markers & data.keys()) + retained_s3_markers = tuple(sorted(retained_s3_marker_set)) + if len(node_ids) == 3 and retained_s3_markers: + raise ValueError( + "serialized three-node shell retains qualified S3 fingerprint " + "markers but is missing formulation_id: " + + ", ".join(retained_s3_markers) + ) + retained_q4_markers = tuple(sorted(qualified_q4_markers & data.keys())) + if len(node_ids) == 4 and retained_q4_markers: + raise ValueError( + "serialized four-node shell retains qualified Q4 fingerprint " + "markers but is missing formulation_id: " + + ", ".join(retained_q4_markers) + ) + if len(node_ids) not in {3, 4, 6, 8}: + raise ValueError("serialized legacy shell requires 3, 4, 6 or 8 nodes") + element = create_shell_element( + element_id=int(data["element_id"]), + node_ids=node_ids, + material_name=str(data.get("material_name", "default")), + formulation="legacy-s3" if len(node_ids) == 3 else "legacy", + thickness=float(data.get("thickness", 0.01)), + drilling_stabilization=float(data.get("drilling_stabilization", 1.0e-3)), + reduced_integration=bool(data.get("reduced_integration", False)), + hourglass_stabilization=float(data.get("hourglass_stabilization", 1.0e-8)), + material_direction=data.get("material_direction"), + material_angle_deg=float(data.get("material_angle_deg", 0.0)), + shell_section=data.get("shell_section"), + ) + if len(node_ids) == 3: + warnings.warn( + "LEGACY_S3_MISSING_FORMULATION_ID: historical three-node shell " + "record loaded as legacy-s3; qualified-s3 was not inferred; " + "qualified-s3 hot restart is forbidden without full load-history " + "replay", + LegacyS3MigrationWarning, + stacklevel=2, + ) + return element + + +def create_element( + element_type: str, + element_id: int, + node_ids: List[int], + material_name: str = "default", + **kwargs: Any, +) -> Element: + normalized_type = str(element_type).lower() + if normalized_type == "ge-beam3": + # The qualified geometrically exact three-node beam is deliberately + # kept out of ``ELEMENT_TYPES``. That registry also feeds legacy + # beam dispatch and batching paths, while GE-B3 has its own rotation + # transaction and state contract. Keep this one exact opt-in route + # local so no existing beam spelling changes meaning. + from .ge_beam3_element import GeometricallyExactBeam3D3NElement + + return GeometricallyExactBeam3D3NElement( + element_id, + node_ids, + material_name, + **kwargs, + ) + if normalized_type in {"e4-pl-s3-v2d", "qualified-s3-v2d"}: + return create_shell_element( + element_id, + node_ids, + material_name, + formulation="e4-pl-s3-v2d", + **kwargs, + ) + if normalized_type in {"e4-pl-s3-v2c", "qualified-s3-v2c"}: + return create_shell_element( + element_id, + node_ids, + material_name, + formulation="e4-pl-s3-v2c", + **kwargs, + ) + if normalized_type in {"e4-pl-s3-v2b", "qualified-s3-v2b"}: + return create_shell_element( + element_id, + node_ids, + material_name, + formulation="e4-pl-s3-v2b", + **kwargs, + ) + if normalized_type in {"e4-pl-s3-v2", "qualified-s3-v2"}: + return create_shell_element( + element_id, + node_ids, + material_name, + formulation="e4-pl-s3-v2", + **kwargs, + ) + if normalized_type in {"e4-pl-s3", "e4_pl_s3", "qualified-s3", "qualified_s3"}: + return create_shell_element( + element_id, + node_ids, + material_name, + formulation="e4-pl-s3", + **kwargs, + ) + if normalized_type in {"legacy-s3", "legacy_s3"}: + return create_shell_element( + element_id, + node_ids, + material_name, + formulation="legacy-s3", + **kwargs, + ) + if normalized_type in {"e4-pl", "e4_pl", "qualified_s4"}: + return create_shell_element( + element_id, + node_ids, + material_name, + formulation="e4-pl", + **kwargs, + ) + if normalized_type in {"legacy-shell", "legacy_shell", "legacy-s4", "legacy_s4"}: + return create_shell_element( + element_id, + node_ids, + material_name, + formulation="legacy", + **kwargs, + ) + if normalized_type == "shell": + formulation = kwargs.pop("formulation", None) + return create_shell_element( + element_id, + node_ids, + material_name, + formulation=formulation, + **kwargs, + ) + if normalized_type in {"shell3", "tri3", "tria3", "t3", "s3"}: + formulation = kwargs.pop("formulation", None) + return create_shell_element( + element_id, + node_ids, + material_name, + formulation=formulation, + **kwargs, + ) + if normalized_type not in ELEMENT_TYPES: + raise ValueError(f"Unknown element type: {element_type}") + if normalized_type == "coupled": + if len(node_ids) != 2: + raise ValueError("CoupledBeamShellElement factory requires [beam_node_id, shell_node_id]") + return CoupledBeamShellElement(element_id, node_ids[0], node_ids[1], material_name, **kwargs) + return ELEMENT_TYPES[normalized_type](element_id, node_ids, material_name, **kwargs) diff --git a/src/anyfesolver/vectorized_nonlinear.py b/src/anyfesolver/vectorized_nonlinear.py index 656c7baa0..b2ed521ff 100644 --- a/src/anyfesolver/vectorized_nonlinear.py +++ b/src/anyfesolver/vectorized_nonlinear.py @@ -1,360 +1,360 @@ -import numpy as np -from typing import Tuple, Optional, Any, Dict - -from .jit_compiler import njit -from .plasticity import plane_stress_return_map -from .elements import lobatto_layers, plane_stress_elastic_matrix -from . import _compensated_contractions as _contractions - - -def compensated_elastic_batch_zero(geometry, E, nu, G_mod, h, drilling): - """Batch coefficient realization, independent of scalar compliance/drill.""" - constitutive = plane_stress_elastic_matrix(E, nu) - return _contractions.shell_zero_tangent( - geometry, h * constitutive, h**3 / 12.0 * constitutive, - G_mod * (5.0 / 6.0) * h * np.eye(2), G_mod * h * drilling) - - -def elastic_shell_nonlinear_increment(u_elem, geometry, E, nu, h, *, tangent=True): - """Direct elastic von-Karman increment over the reference linear shell. - - Admission and input lifetime belong to the qualified caller. No state or - geometry is retained. Linear bending, shear and drill are supplied by that - caller's baseline; the geometric tangent uses the *full* membrane stress. - - The arithmetic is the reference loop in ``_compensated_contractions``; for - well-formed float64 input one fused compiled call evaluates it bit for bit, - and any refusal or unexpected layout runs the reference (and its exceptions). - """ - return _contractions.elastic_increment( - u_elem, geometry, lambda: h * plane_stress_elastic_matrix(E, nu), tangent) - - -@njit -def _jit_batch_integrate_nonlinear_response( - u_loc_batch: np.ndarray, - N_res_batch: np.ndarray, - M_res_batch: np.ndarray, - C0_batch: np.ndarray, - C1_batch: np.ndarray, - C2_batch: np.ndarray, - B_m_all_batch: np.ndarray, - B_b_all_batch: np.ndarray, - B_d_all_batch: np.ndarray, - Gw_all_batch: np.ndarray, - detw_all_batch: np.ndarray, - B_s_all_batch: np.ndarray, - detw_shear_all_batch: np.ndarray, - D_shear: np.ndarray, - drilling_stiffness: float, - tangent: bool, - has_plasticity: bool, - n_dof: int, -) -> Tuple[np.ndarray, np.ndarray]: - n_elem = u_loc_batch.shape[0] - F_loc_batch = np.zeros((n_elem, n_dof)) - K_loc_batch = np.zeros((n_elem, n_dof, n_dof)) - - n_gp = detw_all_batch.shape[1] - - for e in range(n_elem): - u_loc = u_loc_batch[e] - detw_all = detw_all_batch[e] - B_m_all = B_m_all_batch[e] - B_b_all = B_b_all_batch[e] - B_d_all = B_d_all_batch[e] - Gw_all = Gw_all_batch[e] - N_res = N_res_batch[e] - M_res = M_res_batch[e] - C0 = C0_batch[e] - C1 = C1_batch[e] - C2 = C2_batch[e] - - for g in range(n_gp): - detw = detw_all[g] - B_m = B_m_all[g] - B_b = B_b_all[g] - B_d = B_d_all[g] - Gw = Gw_all[g] - - theta_0 = 0.0 - theta_1 = 0.0 - for i in range(n_dof): - theta_0 += Gw[0, i] * u_loc[i] - theta_1 += Gw[1, i] * u_loc[i] - - B_eff = np.zeros((3, n_dof)) - for i in range(n_dof): - B_eff[0, i] = B_m[0, i] + theta_0 * Gw[0, i] - B_eff[1, i] = B_m[1, i] + theta_1 * Gw[1, i] - B_eff[2, i] = B_m[2, i] + theta_0 * Gw[1, i] + theta_1 * Gw[0, i] - - N_g = N_res[g] - M_g = M_res[g] - B_eff_T_N = np.zeros(n_dof) - B_b_T_M = np.zeros(n_dof) - for i in range(n_dof): - B_eff_T_N[i] = B_eff[0, i] * N_g[0] + B_eff[1, i] * N_g[1] + B_eff[2, i] * N_g[2] - B_b_T_M[i] = B_b[0, i] * M_g[0] + B_b[1, i] * M_g[1] + B_b[2, i] * M_g[2] - - Bd_u = 0.0 - for i in range(n_dof): - Bd_u += B_d[0, i] * u_loc[i] - - for i in range(n_dof): - F_loc_batch[e, i] += (B_eff_T_N[i] + B_b_T_M[i]) * detw - F_loc_batch[e, i] += B_d[0, i] * (drilling_stiffness * Bd_u) * detw - - if not tangent: - continue - - C0_g = C0[g] - C2_g = C2[g] - - C0_B_eff = np.zeros((3, n_dof)) - C2_B_b = np.zeros((3, n_dof)) - for r in range(3): - for c in range(n_dof): - val0 = 0.0 - val2 = 0.0 - for k in range(3): - val0 += C0_g[r, k] * B_eff[k, c] - val2 += C2_g[r, k] * B_b[k, c] - C0_B_eff[r, c] = val0 - C2_B_b[r, c] = val2 - - for r in range(n_dof): - for c in range(n_dof): - val_eff = 0.0 - val_b = 0.0 - for k in range(3): - val_eff += B_eff[k, r] * C0_B_eff[k, c] - val_b += B_b[k, r] * C2_B_b[k, c] - K_loc_batch[e, r, c] += (val_eff + val_b) * detw - - if has_plasticity: - C1_g = C1[g] - C1_B_b = np.zeros((3, n_dof)) - C1_B_eff = np.zeros((3, n_dof)) - for r in range(3): - for c in range(n_dof): - val_b = 0.0 - val_eff = 0.0 - for k in range(3): - val_b += C1_g[r, k] * B_b[k, c] - val_eff += C1_g[r, k] * B_eff[k, c] - C1_B_b[r, c] = val_b - C1_B_eff[r, c] = val_eff - - for r in range(n_dof): - for c in range(n_dof): - forward = 0.0 - reverse = 0.0 - for k in range(3): - forward += B_eff[k, r] * C1_B_b[k, c] - reverse += B_b[k, r] * C1_B_eff[k, c] - K_loc_batch[e, r, c] += (forward + reverse) * detw - - N00 = N_g[0] - N11 = N_g[1] - N01 = N_g[2] - - N_Gw_0 = N00 * Gw[0] + N01 * Gw[1] - N_Gw_1 = N01 * Gw[0] + N11 * Gw[1] - for r in range(n_dof): - for c in range(n_dof): - K_loc_batch[e, r, c] += (Gw[0, r] * N_Gw_0[c] + Gw[1, r] * N_Gw_1[c]) * detw - K_loc_batch[e, r, c] += B_d[0, r] * (drilling_stiffness * B_d[0, c]) * detw - - n_shear = detw_shear_all_batch.shape[1] - detw_shear_all = detw_shear_all_batch[e] - B_s_all = B_s_all_batch[e] - - for g in range(n_shear): - detw_s = detw_shear_all[g] - B_s = B_s_all[g] - - Bs_u_0 = 0.0 - Bs_u_1 = 0.0 - for i in range(n_dof): - Bs_u_0 += B_s[0, i] * u_loc[i] - Bs_u_1 += B_s[1, i] * u_loc[i] - - f_s_0 = D_shear[0, 0] * Bs_u_0 + D_shear[0, 1] * Bs_u_1 - f_s_1 = D_shear[1, 0] * Bs_u_0 + D_shear[1, 1] * Bs_u_1 - - for i in range(n_dof): - F_loc_batch[e, i] += (B_s[0, i] * f_s_0 + B_s[1, i] * f_s_1) * detw_s - - if not tangent: - continue - - C_s = np.zeros((2, n_dof)) - for r in range(2): - for c in range(n_dof): - C_s[r, c] = D_shear[r, 0] * B_s[0, c] + D_shear[r, 1] * B_s[1, c] - - for r in range(n_dof): - for c in range(n_dof): - K_loc_batch[e, r, c] += (B_s[0, r] * C_s[0, c] + B_s[1, r] * C_s[1, c]) * detw_s - - return F_loc_batch, K_loc_batch - - -def batch_shell_nonlinear_response( - u_elem_batch: np.ndarray, - T0_batch: np.ndarray, - B_m_all_batch: np.ndarray, - B_b_all_batch: np.ndarray, - B_d_all_batch: np.ndarray, - Gw_all_batch: np.ndarray, - detw_all_batch: np.ndarray, - B_s_all_batch: np.ndarray, - detw_shear_all_batch: np.ndarray, - E: float, - nu: float, - G_mod: float, - h: float, - drilling_stabilization: float, - tangent: bool, - curve: Any, - plastic_strain_batch: np.ndarray, - alpha_batch: np.ndarray, - num_layers: int, -) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray]: - """Computes nonlinear response for a batch of elements.""" - n_elem = u_elem_batch.shape[0] - n_dof = u_elem_batch.shape[1] - - u_loc_batch = (T0_batch @ u_elem_batch[:, :, None]).squeeze(-1) - - C_el = plane_stress_elastic_matrix(E, nu) - D_shear = G_mod * (5.0 / 6.0) * h * np.eye(2, dtype=float) - drilling_stiffness = G_mod * h * drilling_stabilization - - n_gp = detw_all_batch.shape[1] - - theta_batch = (Gw_all_batch @ u_loc_batch[:, None, :, None]).squeeze(-1) - memb_strain_batch = (B_m_all_batch @ u_loc_batch[:, None, :, None]).squeeze(-1) - memb_strain_batch += np.stack([ - 0.5 * theta_batch[..., 0]**2, - 0.5 * theta_batch[..., 1]**2, - theta_batch[..., 0] * theta_batch[..., 1] - ], axis=-1) - - curvature_batch = (B_b_all_batch @ u_loc_batch[:, None, :, None]).squeeze(-1) - - z_layers, w_layers = lobatto_layers(num_layers, h) - layer_strain = ( - memb_strain_batch[:, :, None, :] + z_layers[None, None, :, None] * curvature_batch[:, :, None, :] - ).reshape(n_elem * n_gp * num_layers, 3) - - has_plasticity = curve is not None - if not has_plasticity: - N_res_batch = memb_strain_batch @ (h * C_el).T - M_res_batch = curvature_batch @ (h**3 / 12.0 * C_el).T - C0_batch = np.broadcast_to(h * C_el, (n_elem, n_gp, 3, 3)) - C1_batch = np.zeros((n_elem, n_gp, 3, 3), dtype=float) - C2_batch = np.broadcast_to(h**3 / 12.0 * C_el, (n_elem, n_gp, 3, 3)) - ep_new = plastic_strain_batch - alpha_new = alpha_batch - else: - sigma, C_tan, ep_new, alpha_new = plane_stress_return_map( - layer_strain, - plastic_strain_batch.reshape(n_elem * n_gp * num_layers, 3), - alpha_batch.reshape(n_elem * n_gp * num_layers), - E, - nu, - curve, - compute_tangent=tangent, - ) - - ep_new = ep_new.reshape(n_elem, n_gp * num_layers, 3) - alpha_new = alpha_new.reshape(n_elem, n_gp * num_layers) - - sigma = sigma.reshape(n_elem, n_gp, num_layers, 3) - C_tan = C_tan.reshape(n_elem, n_gp, num_layers, 3, 3) - - N_res_batch, M_res_batch, C0_batch, C1_batch, C2_batch = _jit_integrate_layers( - sigma, C_tan, w_layers, z_layers, tangent - ) - - F_loc_batch, K_loc_batch = _jit_batch_integrate_nonlinear_response( - u_loc_batch, - N_res_batch, - M_res_batch, - C0_batch, - C1_batch, - C2_batch, - B_m_all_batch, - B_b_all_batch, - B_d_all_batch, - Gw_all_batch, - detw_all_batch, - B_s_all_batch, - detw_shear_all_batch, - D_shear, - drilling_stiffness, - tangent, - has_plasticity, - n_dof, - ) - - F_int_batch = (T0_batch.transpose(0, 2, 1) @ F_loc_batch[:, :, None]).squeeze(-1) - if tangent: - K_T_batch = T0_batch.transpose(0, 2, 1) @ K_loc_batch @ T0_batch - else: - K_T_batch = np.zeros((n_elem, 0, 0)) - - return F_int_batch, K_T_batch, ep_new, alpha_new, layer_strain - - -def shell_nonlinear_batch_eligible(element: Any) -> bool: - """Return whether the vectorized kernel matches the scalar shell response.""" - - return bool( - getattr(element, "legacy_nonlinear_batch_eligible", True) - and getattr(element, "_is_quadrilateral", False) - and getattr(element, "shell_section", None) is None - and not ( - getattr(element, "_is_8node", False) - and bool(getattr(element, "reduced_integration", False)) - ) - ) - - -@njit -def _jit_integrate_layers( - sigma: np.ndarray, - C_tan: np.ndarray, - w_layers: np.ndarray, - z_layers: np.ndarray, - tangent: bool, -) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray]: - n_elem, n_gp, num_layers, _ = sigma.shape - N_res_batch = np.zeros((n_elem, n_gp, 3)) - M_res_batch = np.zeros((n_elem, n_gp, 3)) - C0_batch = np.zeros((n_elem, n_gp, 3, 3)) - C1_batch = np.zeros((n_elem, n_gp, 3, 3)) - C2_batch = np.zeros((n_elem, n_gp, 3, 3)) - - for e in range(n_elem): - for g in range(n_gp): - for l in range(num_layers): - w = w_layers[l] - z = z_layers[l] - wz = w * z - wz2 = wz * z - for i in range(3): - N_res_batch[e, g, i] += w * sigma[e, g, l, i] - M_res_batch[e, g, i] += wz * sigma[e, g, l, i] - - if tangent: - for i in range(3): - for j in range(3): - val = C_tan[e, g, l, i, j] - C0_batch[e, g, i, j] += w * val - C1_batch[e, g, i, j] += wz * val - C2_batch[e, g, i, j] += wz2 * val - - return N_res_batch, M_res_batch, C0_batch, C1_batch, C2_batch +import numpy as np +from typing import Tuple, Optional, Any, Dict + +from .jit_compiler import njit +from .plasticity import plane_stress_return_map +from .elements import lobatto_layers, plane_stress_elastic_matrix +from . import _compensated_contractions as _contractions + + +def compensated_elastic_batch_zero(geometry, E, nu, G_mod, h, drilling): + """Batch coefficient realization, independent of scalar compliance/drill.""" + constitutive = plane_stress_elastic_matrix(E, nu) + return _contractions.shell_zero_tangent( + geometry, h * constitutive, h**3 / 12.0 * constitutive, + G_mod * (5.0 / 6.0) * h * np.eye(2), G_mod * h * drilling) + + +def elastic_shell_nonlinear_increment(u_elem, geometry, E, nu, h, *, tangent=True): + """Direct elastic von-Karman increment over the reference linear shell. + + Admission and input lifetime belong to the qualified caller. No state or + geometry is retained. Linear bending, shear and drill are supplied by that + caller's baseline; the geometric tangent uses the *full* membrane stress. + + The arithmetic is the reference loop in ``_compensated_contractions``; for + well-formed float64 input one fused compiled call evaluates it bit for bit, + and any refusal or unexpected layout runs the reference (and its exceptions). + """ + return _contractions.elastic_increment( + u_elem, geometry, lambda: h * plane_stress_elastic_matrix(E, nu), tangent) + + +@njit +def _jit_batch_integrate_nonlinear_response( + u_loc_batch: np.ndarray, + N_res_batch: np.ndarray, + M_res_batch: np.ndarray, + C0_batch: np.ndarray, + C1_batch: np.ndarray, + C2_batch: np.ndarray, + B_m_all_batch: np.ndarray, + B_b_all_batch: np.ndarray, + B_d_all_batch: np.ndarray, + Gw_all_batch: np.ndarray, + detw_all_batch: np.ndarray, + B_s_all_batch: np.ndarray, + detw_shear_all_batch: np.ndarray, + D_shear: np.ndarray, + drilling_stiffness: float, + tangent: bool, + has_plasticity: bool, + n_dof: int, +) -> Tuple[np.ndarray, np.ndarray]: + n_elem = u_loc_batch.shape[0] + F_loc_batch = np.zeros((n_elem, n_dof)) + K_loc_batch = np.zeros((n_elem, n_dof, n_dof)) + + n_gp = detw_all_batch.shape[1] + + for e in range(n_elem): + u_loc = u_loc_batch[e] + detw_all = detw_all_batch[e] + B_m_all = B_m_all_batch[e] + B_b_all = B_b_all_batch[e] + B_d_all = B_d_all_batch[e] + Gw_all = Gw_all_batch[e] + N_res = N_res_batch[e] + M_res = M_res_batch[e] + C0 = C0_batch[e] + C1 = C1_batch[e] + C2 = C2_batch[e] + + for g in range(n_gp): + detw = detw_all[g] + B_m = B_m_all[g] + B_b = B_b_all[g] + B_d = B_d_all[g] + Gw = Gw_all[g] + + theta_0 = 0.0 + theta_1 = 0.0 + for i in range(n_dof): + theta_0 += Gw[0, i] * u_loc[i] + theta_1 += Gw[1, i] * u_loc[i] + + B_eff = np.zeros((3, n_dof)) + for i in range(n_dof): + B_eff[0, i] = B_m[0, i] + theta_0 * Gw[0, i] + B_eff[1, i] = B_m[1, i] + theta_1 * Gw[1, i] + B_eff[2, i] = B_m[2, i] + theta_0 * Gw[1, i] + theta_1 * Gw[0, i] + + N_g = N_res[g] + M_g = M_res[g] + B_eff_T_N = np.zeros(n_dof) + B_b_T_M = np.zeros(n_dof) + for i in range(n_dof): + B_eff_T_N[i] = B_eff[0, i] * N_g[0] + B_eff[1, i] * N_g[1] + B_eff[2, i] * N_g[2] + B_b_T_M[i] = B_b[0, i] * M_g[0] + B_b[1, i] * M_g[1] + B_b[2, i] * M_g[2] + + Bd_u = 0.0 + for i in range(n_dof): + Bd_u += B_d[0, i] * u_loc[i] + + for i in range(n_dof): + F_loc_batch[e, i] += (B_eff_T_N[i] + B_b_T_M[i]) * detw + F_loc_batch[e, i] += B_d[0, i] * (drilling_stiffness * Bd_u) * detw + + if not tangent: + continue + + C0_g = C0[g] + C2_g = C2[g] + + C0_B_eff = np.zeros((3, n_dof)) + C2_B_b = np.zeros((3, n_dof)) + for r in range(3): + for c in range(n_dof): + val0 = 0.0 + val2 = 0.0 + for k in range(3): + val0 += C0_g[r, k] * B_eff[k, c] + val2 += C2_g[r, k] * B_b[k, c] + C0_B_eff[r, c] = val0 + C2_B_b[r, c] = val2 + + for r in range(n_dof): + for c in range(n_dof): + val_eff = 0.0 + val_b = 0.0 + for k in range(3): + val_eff += B_eff[k, r] * C0_B_eff[k, c] + val_b += B_b[k, r] * C2_B_b[k, c] + K_loc_batch[e, r, c] += (val_eff + val_b) * detw + + if has_plasticity: + C1_g = C1[g] + C1_B_b = np.zeros((3, n_dof)) + C1_B_eff = np.zeros((3, n_dof)) + for r in range(3): + for c in range(n_dof): + val_b = 0.0 + val_eff = 0.0 + for k in range(3): + val_b += C1_g[r, k] * B_b[k, c] + val_eff += C1_g[r, k] * B_eff[k, c] + C1_B_b[r, c] = val_b + C1_B_eff[r, c] = val_eff + + for r in range(n_dof): + for c in range(n_dof): + forward = 0.0 + reverse = 0.0 + for k in range(3): + forward += B_eff[k, r] * C1_B_b[k, c] + reverse += B_b[k, r] * C1_B_eff[k, c] + K_loc_batch[e, r, c] += (forward + reverse) * detw + + N00 = N_g[0] + N11 = N_g[1] + N01 = N_g[2] + + N_Gw_0 = N00 * Gw[0] + N01 * Gw[1] + N_Gw_1 = N01 * Gw[0] + N11 * Gw[1] + for r in range(n_dof): + for c in range(n_dof): + K_loc_batch[e, r, c] += (Gw[0, r] * N_Gw_0[c] + Gw[1, r] * N_Gw_1[c]) * detw + K_loc_batch[e, r, c] += B_d[0, r] * (drilling_stiffness * B_d[0, c]) * detw + + n_shear = detw_shear_all_batch.shape[1] + detw_shear_all = detw_shear_all_batch[e] + B_s_all = B_s_all_batch[e] + + for g in range(n_shear): + detw_s = detw_shear_all[g] + B_s = B_s_all[g] + + Bs_u_0 = 0.0 + Bs_u_1 = 0.0 + for i in range(n_dof): + Bs_u_0 += B_s[0, i] * u_loc[i] + Bs_u_1 += B_s[1, i] * u_loc[i] + + f_s_0 = D_shear[0, 0] * Bs_u_0 + D_shear[0, 1] * Bs_u_1 + f_s_1 = D_shear[1, 0] * Bs_u_0 + D_shear[1, 1] * Bs_u_1 + + for i in range(n_dof): + F_loc_batch[e, i] += (B_s[0, i] * f_s_0 + B_s[1, i] * f_s_1) * detw_s + + if not tangent: + continue + + C_s = np.zeros((2, n_dof)) + for r in range(2): + for c in range(n_dof): + C_s[r, c] = D_shear[r, 0] * B_s[0, c] + D_shear[r, 1] * B_s[1, c] + + for r in range(n_dof): + for c in range(n_dof): + K_loc_batch[e, r, c] += (B_s[0, r] * C_s[0, c] + B_s[1, r] * C_s[1, c]) * detw_s + + return F_loc_batch, K_loc_batch + + +def batch_shell_nonlinear_response( + u_elem_batch: np.ndarray, + T0_batch: np.ndarray, + B_m_all_batch: np.ndarray, + B_b_all_batch: np.ndarray, + B_d_all_batch: np.ndarray, + Gw_all_batch: np.ndarray, + detw_all_batch: np.ndarray, + B_s_all_batch: np.ndarray, + detw_shear_all_batch: np.ndarray, + E: float, + nu: float, + G_mod: float, + h: float, + drilling_stabilization: float, + tangent: bool, + curve: Any, + plastic_strain_batch: np.ndarray, + alpha_batch: np.ndarray, + num_layers: int, +) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray]: + """Computes nonlinear response for a batch of elements.""" + n_elem = u_elem_batch.shape[0] + n_dof = u_elem_batch.shape[1] + + u_loc_batch = (T0_batch @ u_elem_batch[:, :, None]).squeeze(-1) + + C_el = plane_stress_elastic_matrix(E, nu) + D_shear = G_mod * (5.0 / 6.0) * h * np.eye(2, dtype=float) + drilling_stiffness = G_mod * h * drilling_stabilization + + n_gp = detw_all_batch.shape[1] + + theta_batch = (Gw_all_batch @ u_loc_batch[:, None, :, None]).squeeze(-1) + memb_strain_batch = (B_m_all_batch @ u_loc_batch[:, None, :, None]).squeeze(-1) + memb_strain_batch += np.stack([ + 0.5 * theta_batch[..., 0]**2, + 0.5 * theta_batch[..., 1]**2, + theta_batch[..., 0] * theta_batch[..., 1] + ], axis=-1) + + curvature_batch = (B_b_all_batch @ u_loc_batch[:, None, :, None]).squeeze(-1) + + z_layers, w_layers = lobatto_layers(num_layers, h) + layer_strain = ( + memb_strain_batch[:, :, None, :] + z_layers[None, None, :, None] * curvature_batch[:, :, None, :] + ).reshape(n_elem * n_gp * num_layers, 3) + + has_plasticity = curve is not None + if not has_plasticity: + N_res_batch = memb_strain_batch @ (h * C_el).T + M_res_batch = curvature_batch @ (h**3 / 12.0 * C_el).T + C0_batch = np.broadcast_to(h * C_el, (n_elem, n_gp, 3, 3)) + C1_batch = np.zeros((n_elem, n_gp, 3, 3), dtype=float) + C2_batch = np.broadcast_to(h**3 / 12.0 * C_el, (n_elem, n_gp, 3, 3)) + ep_new = plastic_strain_batch + alpha_new = alpha_batch + else: + sigma, C_tan, ep_new, alpha_new = plane_stress_return_map( + layer_strain, + plastic_strain_batch.reshape(n_elem * n_gp * num_layers, 3), + alpha_batch.reshape(n_elem * n_gp * num_layers), + E, + nu, + curve, + compute_tangent=tangent, + ) + + ep_new = ep_new.reshape(n_elem, n_gp * num_layers, 3) + alpha_new = alpha_new.reshape(n_elem, n_gp * num_layers) + + sigma = sigma.reshape(n_elem, n_gp, num_layers, 3) + C_tan = C_tan.reshape(n_elem, n_gp, num_layers, 3, 3) + + N_res_batch, M_res_batch, C0_batch, C1_batch, C2_batch = _jit_integrate_layers( + sigma, C_tan, w_layers, z_layers, tangent + ) + + F_loc_batch, K_loc_batch = _jit_batch_integrate_nonlinear_response( + u_loc_batch, + N_res_batch, + M_res_batch, + C0_batch, + C1_batch, + C2_batch, + B_m_all_batch, + B_b_all_batch, + B_d_all_batch, + Gw_all_batch, + detw_all_batch, + B_s_all_batch, + detw_shear_all_batch, + D_shear, + drilling_stiffness, + tangent, + has_plasticity, + n_dof, + ) + + F_int_batch = (T0_batch.transpose(0, 2, 1) @ F_loc_batch[:, :, None]).squeeze(-1) + if tangent: + K_T_batch = T0_batch.transpose(0, 2, 1) @ K_loc_batch @ T0_batch + else: + K_T_batch = np.zeros((n_elem, 0, 0)) + + return F_int_batch, K_T_batch, ep_new, alpha_new, layer_strain + + +def shell_nonlinear_batch_eligible(element: Any) -> bool: + """Return whether the vectorized kernel matches the scalar shell response.""" + + return bool( + getattr(element, "legacy_nonlinear_batch_eligible", True) + and getattr(element, "_is_quadrilateral", False) + and getattr(element, "shell_section", None) is None + and not ( + getattr(element, "_is_8node", False) + and bool(getattr(element, "reduced_integration", False)) + ) + ) + + +@njit +def _jit_integrate_layers( + sigma: np.ndarray, + C_tan: np.ndarray, + w_layers: np.ndarray, + z_layers: np.ndarray, + tangent: bool, +) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray]: + n_elem, n_gp, num_layers, _ = sigma.shape + N_res_batch = np.zeros((n_elem, n_gp, 3)) + M_res_batch = np.zeros((n_elem, n_gp, 3)) + C0_batch = np.zeros((n_elem, n_gp, 3, 3)) + C1_batch = np.zeros((n_elem, n_gp, 3, 3)) + C2_batch = np.zeros((n_elem, n_gp, 3, 3)) + + for e in range(n_elem): + for g in range(n_gp): + for l in range(num_layers): + w = w_layers[l] + z = z_layers[l] + wz = w * z + wz2 = wz * z + for i in range(3): + N_res_batch[e, g, i] += w * sigma[e, g, l, i] + M_res_batch[e, g, i] += wz * sigma[e, g, l, i] + + if tangent: + for i in range(3): + for j in range(3): + val = C_tan[e, g, l, i, j] + C0_batch[e, g, i, j] += w * val + C1_batch[e, g, i, j] += wz * val + C2_batch[e, g, i, j] += wz2 * val + + return N_res_batch, M_res_batch, C0_batch, C1_batch, C2_batch diff --git a/tests/data/namespace_migration/manifest.json b/tests/data/namespace_migration/manifest.json index 71c8398bc..edfcc6b9f 100644 --- a/tests/data/namespace_migration/manifest.json +++ b/tests/data/namespace_migration/manifest.json @@ -1,11 +1,11 @@ -{ - "producer_commit": "e0c5f32ab40e9548ba0ea8981cf5e288ed375a1c", - "sha256": { - "static.json": "4c3ae5f1ec636130916c626522c2123c7d6f48bfebc600727794d29f473ccae9", - "arc.json": "62dbec0a59476617349c4348a22360426f6cffa2d0e29f6de8d74aeb2cad7652", - "transient.json": "28bba5feb7536a3fc8cfce195dffb801784c9ec6047259262ce8f9147e4c6711", - "restart.json": "04922b27524704e1244a40c9d37325c543e90a36a00d3863bacafb1a17d8ad68" - }, - "uninterrupted_checkpoint_sha256": "ac5cc9c72f106c5f7d4bbb1a48c3a20c178a1f38aac0bc1fbe84607591013adc", - "uninterrupted_displacement_hex": "333333333333c33f00000000000000000000000000000000000000000000000000000000000000000000000000000000" -} +{ + "producer_commit": "e0c5f32ab40e9548ba0ea8981cf5e288ed375a1c", + "sha256": { + "static.json": "4c3ae5f1ec636130916c626522c2123c7d6f48bfebc600727794d29f473ccae9", + "arc.json": "62dbec0a59476617349c4348a22360426f6cffa2d0e29f6de8d74aeb2cad7652", + "transient.json": "28bba5feb7536a3fc8cfce195dffb801784c9ec6047259262ce8f9147e4c6711", + "restart.json": "04922b27524704e1244a40c9d37325c543e90a36a00d3863bacafb1a17d8ad68" + }, + "uninterrupted_checkpoint_sha256": "ac5cc9c72f106c5f7d4bbb1a48c3a20c178a1f38aac0bc1fbe84607591013adc", + "uninterrupted_displacement_hex": "333333333333c33f00000000000000000000000000000000000000000000000000000000000000000000000000000000" +} From cf32d3a64191fa2f66775baa10b97aee27ce92a9 Mon Sep 17 00:00:00 2001 From: Audun Arnesen Nyhus Date: Wed, 11 Nov 2026 21:03:19 +0100 Subject: [PATCH 03/15] Verify the renamed artifact pairs and promote the original TestPyPI bytes --- .github/workflows/contact-candidate.yml | 14 +- .github/workflows/publish.yml | 405 ++++++++++++++++-- docs/GENERAL_CONTACT_STATIC_CANDIDATE.md | 2 +- docs/releases/ANYfeSolver_0.5.0.md | 138 ++++++ scripts/build_static_contact_candidate.py | 26 +- scripts/check_static_contact_candidate.py | 16 +- scripts/contact_candidate_050.json | 215 ++++++++++ tests/test_anyfileio_version_compatibility.py | 284 ++++++++---- tests/test_anymesher_version_compatibility.py | 18 +- tests/test_extracted_package_wiring.py | 30 +- tests/test_release_047_bounded.py | 21 +- tests/test_release_050.py | 252 +++++++++++ tests/test_static_contact_candidate_tools.py | 62 ++- 13 files changed, 1300 insertions(+), 183 deletions(-) create mode 100644 docs/releases/ANYfeSolver_0.5.0.md create mode 100644 scripts/contact_candidate_050.json create mode 100644 tests/test_release_050.py diff --git a/.github/workflows/contact-candidate.yml b/.github/workflows/contact-candidate.yml index 92aec39ed..b09b0e11e 100644 --- a/.github/workflows/contact-candidate.yml +++ b/.github/workflows/contact-candidate.yml @@ -8,26 +8,32 @@ on: - scripts/build_static_contact_candidate.py - scripts/check_static_contact_candidate.py - scripts/contact_candidate_slice2.json + - scripts/contact_candidate_050.json - tests/test_static_contact_candidate_tools.py - docs/GENERAL_CONTACT_STATIC_CANDIDATE.md - - src/anysolver/** + - src/anyfesolver/** - packages/results/pyproject.toml + - packages/results/src/** - pyproject.toml - - examples/** - tests/test_general_contact_*.py + - tests/test_elastic_sphere_*.py + - examples/** pull_request: paths: - .github/workflows/contact-candidate.yml - scripts/build_static_contact_candidate.py - scripts/check_static_contact_candidate.py - scripts/contact_candidate_slice2.json + - scripts/contact_candidate_050.json - tests/test_static_contact_candidate_tools.py - docs/GENERAL_CONTACT_STATIC_CANDIDATE.md - - src/anysolver/** + - src/anyfesolver/** - packages/results/pyproject.toml + - packages/results/src/** - pyproject.toml - - examples/** - tests/test_general_contact_*.py + - tests/test_elastic_sphere_*.py + - examples/** workflow_dispatch: env: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index cbb53b501..a639a30d0 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,102 +1,443 @@ name: Publish +# Tag v0.5.0 publishes ANYfeSolver-results 2.2.0 and ANYfeSolver 0.5.0. +# STAGE: workflow_dispatch on the release tag builds once, verifies, and uploads +# those exact bytes to TestPyPI (results first). The verified bytes stay as the +# run artifact `release-050-distributions` (retention below). +# PROMOTE: a published GitHub release on the same tag never rebuilds. The `stage` +# job fetches the artifact of the successful dispatch run for the same SHA, +# re-verifies it, and the `pypi` job (protected environment) uploads those exact +# bytes. sdists are not byte-reproducible, so a rebuild would conflict with what +# TestPyPI already holds; there is deliberately no rebuild path to production. +# Every upload is planned per file against the index SHA-256: only absent files +# are uploaded, a digest conflict or foreign file fails closed. +# If the stage run is missing, failed, from another SHA/ref/repository, or its +# artifact has expired, promotion fails closed; stage again (see the release note). + on: workflow_dispatch: release: types: [published] +permissions: + contents: read + +concurrency: + group: publish-${{ github.ref }} + cancel-in-progress: false + +env: + RELEASE_TAG: v0.5.0 + SOLVER_VERSION: "0.5.0" + RESULTS_VERSION: "2.2.0" + jobs: + validate: + name: Validate release tag, version, ref and CI + runs-on: ubuntu-latest + permissions: + contents: read + actions: read + outputs: + sha: ${{ steps.identity.outputs.sha }} + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 + with: + fetch-depth: 0 + persist-credentials: false + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 + with: + python-version: "3.13" + - name: Require the release tag, its versions and a main-branch commit + id: identity + env: + REF_TYPE: ${{ github.ref_type }} + REF_NAME: ${{ github.ref_name }} + EVENT_NAME: ${{ github.event_name }} + EVENT_SHA: ${{ github.sha }} + RELEASE_DRAFT: ${{ github.event.release.draft }} + RELEASE_PRERELEASE: ${{ github.event.release.prerelease }} + RELEASE_TAG_NAME: ${{ github.event.release.tag_name }} + run: | + set -euo pipefail + [ "$REF_TYPE" = "tag" ] || { echo "publishing requires a tag ref, got $REF_TYPE"; exit 1; } + [ "$REF_NAME" = "$RELEASE_TAG" ] || { echo "tag $REF_NAME is not $RELEASE_TAG"; exit 1; } + if [ "$EVENT_NAME" = "release" ]; then + [ "$RELEASE_TAG_NAME" = "$RELEASE_TAG" ] || { echo "release tag mismatch"; exit 1; } + [ "$RELEASE_DRAFT" = "false" ] && [ "$RELEASE_PRERELEASE" = "false" ] || { echo "release is draft or prerelease"; exit 1; } + fi + sha="$(git rev-parse HEAD)" + [ "$sha" = "$EVENT_SHA" ] || { echo "checked-out commit differs from the event SHA"; exit 1; } + [ "$(git rev-parse "refs/tags/${RELEASE_TAG}^{commit}")" = "$sha" ] || { echo "tag does not resolve to the event SHA"; exit 1; } + git merge-base --is-ancestor "$sha" origin/main || { echo "release commit is not on main"; exit 1; } + python - <<'PY' + import os, tomllib + def version(path): + with open(path, "rb") as stream: + project = tomllib.load(stream)["project"] + return project["name"], project["version"] + assert version("pyproject.toml") == ("ANYfeSolver", os.environ.get("SOLVER_VERSION", "0.5.0")), version("pyproject.toml") + assert version("packages/results/pyproject.toml") == ("ANYfeSolver-results", os.environ.get("RESULTS_VERSION", "2.2.0")), version("packages/results/pyproject.toml") + assert os.environ["RELEASE_TAG"] == "v" + version("pyproject.toml")[1] + PY + echo "sha=$sha" >> "$GITHUB_OUTPUT" + - name: Require successful CI on the release SHA + env: + GH_TOKEN: ${{ github.token }} + SHA: ${{ steps.identity.outputs.sha }} + run: | + set -euo pipefail + # Only CI runs of this repository on main for exactly this SHA count. + # Pull-request runs and other events are never accepted as evidence. + gh api "repos/${GITHUB_REPOSITORY}/actions/workflows/ci.yml/runs?head_sha=${SHA}&status=completed&per_page=100" > ci-runs.json + python - <<'PY' + import json, os, sys + runs = json.load(open("ci-runs.json"))["workflow_runs"] + sha, repo = os.environ["SHA"], os.environ["GITHUB_REPOSITORY"] + trusted = [ + run for run in runs + if run["head_sha"] == sha + and run["event"] in ("push", "workflow_dispatch") + and run["head_branch"] == "main" + and (run.get("head_repository") or {}).get("full_name") == repo + ] + if not trusted: + sys.exit("no trusted CI run exists for the release SHA") + latest = max(trusted, key=lambda run: run["created_at"]) + if latest["conclusion"] != "success": + sys.exit(f"latest trusted CI run {latest['id']} concluded {latest['conclusion']}") + print(f"CI run {latest['id']} succeeded on {sha}") + PY + license-gate: name: Verify release licensing + needs: validate runs-on: ubuntu-latest steps: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 with: + ref: ${{ needs.validate.outputs.sha }} persist-credentials: false - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 with: - python-version: "3.x" + python-version: "3.13" - run: python scripts/check_license_compliance.py dependency-gate: name: Verify production sibling releases + needs: validate runs-on: ubuntu-latest steps: - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 with: - python-version: "3.x" - - name: Require compatible production packages before ANYsolver + python-version: "3.13" + - name: Require compatible production packages before ANYfeSolver run: | python -m pip install --upgrade pip python -m pip download --no-deps --dest sibling-distributions --index-url https://pypi.org/simple "ANYmaterial==0.2.0" "ANYgeometry==0.4.3" "ANYmesher==0.5.0" "ANYfileio==0.3.2" build: - needs: [dependency-gate, license-gate] + name: Build and verify the single artifact set (stage only) + if: github.event_name == 'workflow_dispatch' + needs: [validate, dependency-gate, license-gate] runs-on: ubuntu-latest steps: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 with: + ref: ${{ needs.validate.outputs.sha }} persist-credentials: false - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 with: - python-version: "3.x" + python-version: "3.13" - run: python -m pip install build twine - - run: python -m build - - run: python -m twine check dist/* - - name: Run the bounded 0.4.7 performance release gate + - name: Build both wheel/sdist pairs from this checkout + run: | + python -m build --outdir dist/results packages/results + python -m build --outdir dist/solver . + python -m twine check dist/results/* dist/solver/* + - name: Verify the pairs, sdist rebuilds, inventories and installed smoke + env: + EXPECTED_SHA: ${{ needs.validate.outputs.sha }} + run: >- + python scripts/verify_release_050.py + --solver-wheel dist/solver/anyfesolver-${SOLVER_VERSION}-py3-none-any.whl + --solver-sdist dist/solver/anyfesolver-${SOLVER_VERSION}.tar.gz + --results-wheel dist/results/anyfesolver_results-${RESULTS_VERSION}-py3-none-any.whl + --results-sdist dist/results/anyfesolver_results-${RESULTS_VERSION}.tar.gz + --expected-commit "$EXPECTED_SHA" + --output release-050-gate.json + - name: Check licence metadata of the built artifacts run: >- - python scripts/verify_release_047.py - --wheel dist/anysolver-0.4.7-py3-none-any.whl - --sdist dist/anysolver-0.4.7.tar.gz - --expected-commit ${{ github.sha }} - --output release-047-gate.json - - run: >- python scripts/check_license_compliance.py - --artifact dist/*.whl --artifact dist/*.tar.gz + --artifact dist/solver/*.whl --artifact dist/solver/*.tar.gz + --results-artifact dist/results/*.whl --results-artifact dist/results/*.tar.gz - name: Resolve the exact coordinated release graph run: >- python -m pip install --dry-run --only-binary=:all: - dist/*.whl ANYmaterial==0.2.0 ANYgeometry==0.4.3 + dist/solver/*.whl dist/results/*.whl ANYmaterial==0.2.0 ANYgeometry==0.4.3 ANYmesher==0.5.0 ANYfileio==0.3.2 + - name: Record the bytes that will be published + run: | + set -euo pipefail + [ "$(ls dist/results | wc -l)" = 2 ] && [ "$(ls dist/solver | wc -l)" = 2 ] + (cd dist && sha256sum results/* solver/*) > SHA256SUMS + cat SHA256SUMS - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 with: - name: python-package-distributions - path: dist/ - - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 - with: - name: release-047-gate - path: release-047-gate.json + name: release-050-distributions + path: | + dist/ + SHA256SUMS + release-050-gate.json + if-no-files-found: error + # Production promotion needs this artifact: a release published after + # this window fails closed and must be preceded by fresh staging. + retention-days: 30 testpypi: + name: Publish to TestPyPI (results first) if: github.event_name == 'workflow_dispatch' - needs: build + needs: [validate, build] runs-on: ubuntu-latest environment: name: testpypi - url: https://test.pypi.org/p/ANYsolver + url: https://test.pypi.org/p/ANYfeSolver permissions: + contents: read id-token: write steps: + # The release-SHA checkout supplies only the index-plan helper; the bytes + # to publish come exclusively from the artifact of this same run. + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 + with: + ref: ${{ needs.validate.outputs.sha }} + persist-credentials: false - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 with: - name: python-package-distributions - path: dist/ - - uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 + name: release-050-distributions + path: stage/ + - name: Re-verify the staged bytes and gate commit + env: + EXPECTED_SHA: ${{ needs.validate.outputs.sha }} + run: | + set -euo pipefail + (cd stage/dist && sha256sum -c ../SHA256SUMS) + python3 - <<'PY' + import json, os + gate = json.load(open("stage/release-050-gate.json")) + assert gate["candidate"]["commit"] == os.environ["EXPECTED_SHA"], "gate commit mismatch" + assert gate["terminal"].startswith("ANYFESOLVER_0_5_0_PACKAGING_GATE_PASSED") + PY + # Per project: compare each candidate file with the index by SHA-256, upload + # only files that are absent, and fail on any digest conflict or foreign + # file. Nothing is overwritten and no file is skipped by name alone. + - name: Plan the ANYfeSolver-results TestPyPI upload + id: plan_results + run: >- + python3 scripts/verify_release_050.py index-plan + --index https://test.pypi.org --name ANYfeSolver-results --version "$RESULTS_VERSION" + --dist-dir stage/dist/results --missing-dir plan/results --github-output "$GITHUB_OUTPUT" + - name: Publish missing ANYfeSolver-results files to TestPyPI + if: steps.plan_results.outputs.missing != '0' + uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 with: repository-url: https://test.pypi.org/legacy/ + packages-dir: plan/results/ + - name: Plan the ANYfeSolver TestPyPI upload + id: plan_solver + run: >- + python3 scripts/verify_release_050.py index-plan + --index https://test.pypi.org --name ANYfeSolver --version "$SOLVER_VERSION" + --dist-dir stage/dist/solver --missing-dir plan/solver --github-output "$GITHUB_OUTPUT" + - name: Publish missing ANYfeSolver files to TestPyPI + if: steps.plan_solver.outputs.missing != '0' + uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 + with: + repository-url: https://test.pypi.org/legacy/ + packages-dir: plan/solver/ + - name: Confirm TestPyPI serves every candidate file with the identical digest + run: | + set -euo pipefail + for project in "ANYfeSolver-results $RESULTS_VERSION results" "ANYfeSolver $SOLVER_VERSION solver"; do + set -- $project + for attempt in 1 2 3 4 5; do + rc=0 + python3 scripts/verify_release_050.py index-plan --index https://test.pypi.org --name "$1" --version "$2" --dist-dir "stage/dist/$3" --require-complete || rc=$? + [ "$rc" = 0 ] && break + [ "$rc" = 2 ] || exit 1 + [ "$attempt" = 5 ] && { echo "TestPyPI did not serve every file of $1"; exit 1; } + sleep 30 + done + done + + stage: + name: Retrieve and re-verify the staged bytes (promotion only) + if: github.event_name == 'release' + needs: [validate, dependency-gate, license-gate] + runs-on: ubuntu-latest + permissions: + contents: read + actions: read + steps: + - name: Find the successful dispatch stage run for this SHA and tag + id: find + env: + GH_TOKEN: ${{ github.token }} + SHA: ${{ needs.validate.outputs.sha }} + CURRENT_RUN_ID: ${{ github.run_id }} + run: | + set -euo pipefail + python3 - <<'PY' + import json, os, subprocess, sys + repo, sha, tag = os.environ["GITHUB_REPOSITORY"], os.environ["SHA"], os.environ["RELEASE_TAG"] + def api(path): + return json.loads(subprocess.check_output(["gh", "api", path], text=True)) + repo_id = api(f"repos/{repo}")["id"] + runs = api(f"repos/{repo}/actions/workflows/publish.yml/runs?event=workflow_dispatch&status=completed&head_sha={sha}&per_page=100")["workflow_runs"] + def trusted(run): + return ( + run["path"].split("@", 1)[0] == ".github/workflows/publish.yml" + and run["event"] == "workflow_dispatch" + and run["status"] == "completed" and run["conclusion"] == "success" + and run["head_sha"] == sha and run["head_branch"] == tag + and not run.get("pull_requests") + and run["repository"]["id"] == repo_id + and (run.get("head_repository") or {}).get("id") == repo_id + and not (run.get("head_repository") or {}).get("fork") + and str(run["id"]) != os.environ["CURRENT_RUN_ID"] + ) + candidates = [run for run in runs if trusted(run)] + if not candidates: + sys.exit("no successful same-repo dispatch stage run exists for this release SHA and tag; stage first") + run = max(candidates, key=lambda item: item["created_at"]) + jobs = api(f"repos/{repo}/actions/runs/{run['id']}/jobs?per_page=100")["jobs"] + staged = [job for job in jobs if job["name"].startswith("Publish to TestPyPI")] + if len(staged) != 1 or staged[0]["conclusion"] != "success": + sys.exit("the stage run did not complete its TestPyPI job successfully") + artifacts = api(f"repos/{repo}/actions/runs/{run['id']}/artifacts?name=release-050-distributions&per_page=100")["artifacts"] + if len(artifacts) != 1: + sys.exit("the stage run does not have exactly one release-050-distributions artifact") + artifact = artifacts[0] + if artifact["expired"]: + sys.exit("the staged artifact has expired; stage again before releasing") + origin = artifact["workflow_run"] + if (origin["id"] != run["id"] or origin["head_sha"] != sha or origin["head_branch"] != tag + or origin["head_repository_id"] != repo_id): + sys.exit("the staged artifact does not belong to the validated stage run") + with open(os.environ["GITHUB_OUTPUT"], "a") as stream: + stream.write(f"run_id={run['id']}\n") + print(f"using stage run {run['id']}, artifact {artifact['id']}") + PY + - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 + with: + name: release-050-distributions + path: staged/ + run-id: ${{ steps.find.outputs.run_id }} + github-token: ${{ github.token }} + - name: Re-verify the staged bytes and manifest + env: + EXPECTED_SHA: ${{ needs.validate.outputs.sha }} + run: | + set -euo pipefail + (cd staged/dist && sha256sum -c ../SHA256SUMS) + python3 - <<'PY' + import json, os + sha = os.environ["EXPECTED_SHA"] + solver, results = os.environ["SOLVER_VERSION"], os.environ["RESULTS_VERSION"] + gate = json.load(open("staged/release-050-gate.json")) + assert gate["candidate"]["commit"] == sha, "manifest commit mismatch" + assert gate["terminal"].startswith("ANYFESOLVER_0_5_0_PACKAGING_GATE_PASSED") + assert gate["versions"] == {"ANYfeSolver": solver, "ANYfeSolver-results": results} + expected = { + f"results/anyfesolver_results-{results}-py3-none-any.whl", + f"results/anyfesolver_results-{results}.tar.gz", + f"solver/anyfesolver-{solver}-py3-none-any.whl", + f"solver/anyfesolver-{solver}.tar.gz", + } + listed = {line.split(None, 1)[1].strip().lstrip("*") for line in open("staged/SHA256SUMS") if line.strip()} + assert listed == expected, listed + for key in ("solver", "results"): + wheel = gate["wheels"][key] + digests = {l.split()[1].lstrip("*"): l.split()[0] for l in open("staged/SHA256SUMS") if l.strip()} + assert digests[f"{key}/{wheel['name']}"] == wheel["sha256"], key + PY + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 + with: + name: release-050-promoted + path: staged/ + if-no-files-found: error + retention-days: 7 pypi: + name: Promote identical bytes to PyPI (results first) if: github.event_name == 'release' - needs: build + needs: [validate, license-gate, dependency-gate, stage] runs-on: ubuntu-latest environment: name: pypi - url: https://pypi.org/p/ANYsolver + url: https://pypi.org/p/ANYfeSolver permissions: + contents: read id-token: write steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 + with: + ref: ${{ needs.validate.outputs.sha }} + persist-credentials: false + # Same-run artifact written by the `stage` job after it re-verified the bytes. - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 with: - name: python-package-distributions - path: dist/ - - uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 + name: release-050-promoted + path: stage/ + - name: Re-verify the staged bytes and gate commit + env: + EXPECTED_SHA: ${{ needs.validate.outputs.sha }} + run: | + set -euo pipefail + (cd stage/dist && sha256sum -c ../SHA256SUMS) + python3 - <<'PY' + import json, os + gate = json.load(open("stage/release-050-gate.json")) + assert gate["candidate"]["commit"] == os.environ["EXPECTED_SHA"], "gate commit mismatch" + PY + - name: Require TestPyPI to already serve every candidate file with the identical digest + run: | + set -euo pipefail + python3 scripts/verify_release_050.py index-plan --index https://test.pypi.org --name ANYfeSolver-results --version "$RESULTS_VERSION" --dist-dir stage/dist/results --require-complete + python3 scripts/verify_release_050.py index-plan --index https://test.pypi.org --name ANYfeSolver --version "$SOLVER_VERSION" --dist-dir stage/dist/solver --require-complete + - name: Plan the ANYfeSolver-results PyPI upload + id: plan_results + run: >- + python3 scripts/verify_release_050.py index-plan + --index https://pypi.org --name ANYfeSolver-results --version "$RESULTS_VERSION" + --dist-dir stage/dist/results --missing-dir plan/results --github-output "$GITHUB_OUTPUT" + - name: Publish missing ANYfeSolver-results files to PyPI + if: steps.plan_results.outputs.missing != '0' + uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 + with: + packages-dir: plan/results/ + - name: Plan the ANYfeSolver PyPI upload + id: plan_solver + run: >- + python3 scripts/verify_release_050.py index-plan + --index https://pypi.org --name ANYfeSolver --version "$SOLVER_VERSION" + --dist-dir stage/dist/solver --missing-dir plan/solver --github-output "$GITHUB_OUTPUT" + - name: Publish missing ANYfeSolver files to PyPI + if: steps.plan_solver.outputs.missing != '0' + uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 + with: + packages-dir: plan/solver/ + - name: Confirm PyPI serves every candidate file with the identical digest + run: | + set -euo pipefail + for project in "ANYfeSolver-results $RESULTS_VERSION results" "ANYfeSolver $SOLVER_VERSION solver"; do + set -- $project + for attempt in 1 2 3 4 5; do + rc=0 + python3 scripts/verify_release_050.py index-plan --index https://pypi.org --name "$1" --version "$2" --dist-dir "stage/dist/$3" --require-complete || rc=$? + [ "$rc" = 0 ] && break + [ "$rc" = 2 ] || exit 1 + [ "$attempt" = 5 ] && { echo "PyPI did not serve every file of $1"; exit 1; } + sleep 30 + done + done diff --git a/docs/GENERAL_CONTACT_STATIC_CANDIDATE.md b/docs/GENERAL_CONTACT_STATIC_CANDIDATE.md index ce115949c..345b26417 100644 --- a/docs/GENERAL_CONTACT_STATIC_CANDIDATE.md +++ b/docs/GENERAL_CONTACT_STATIC_CANDIDATE.md @@ -75,7 +75,7 @@ Two supported routes: virtual environment: ```text - python -m pip install --find-links wheelhouse -r requirements-tested.txt "ANYfeSolver[general-contact]==0.4.7+contact.candidate.20261020.s5" "ANYfeSolver-results==2.1.1" "ANYmaterial==0.2.0" "ANYgeometry[planar]==0.4.3" "ANYmesher==0.5.0" "ANYfileio==0.3.2" + python -m pip install --find-links wheelhouse -r requirements-tested.txt "ANYfeSolver[general-contact]==0.5.0+contact.candidate.20261111.s7" "ANYfeSolver-results==2.2.0" "ANYmaterial==0.2.0" "ANYgeometry[planar]==0.4.3" "ANYmesher==0.5.0" "ANYfileio==0.3.2" ``` Numeric and Shapely dependencies resolve normally from their usual diff --git a/docs/releases/ANYfeSolver_0.5.0.md b/docs/releases/ANYfeSolver_0.5.0.md new file mode 100644 index 000000000..ad97f8e41 --- /dev/null +++ b/docs/releases/ANYfeSolver_0.5.0.md @@ -0,0 +1,138 @@ +# ANYfeSolver 0.5.0 and ANYfeSolver-results 2.2.0 + +This release renames the distributions and import packages and packages the +current `main`. It is **not** a rename-only delta: `main` is 2620 commits beyond +the `v0.4.7` tag, so the solver code differs from 0.4.7 by far more than names. +The changes since 0.4.7 are listed in `CHANGELOG.md`; this note does not +describe them and makes no claim that element equations, tolerances, default +formulations or performance match 0.4.7. + +No fresh scientific, accuracy or performance claim is made for 0.5.0. The only +checks described here are packaging checks (below). + +## Names + +| Before | From this release | +| --- | --- | +| PyPI `ANYsolver` 0.4.7 | PyPI `ANYfeSolver` 0.5.0 | +| `anysolver_results` runtime, development/source-only, never published on PyPI | PyPI `ANYfeSolver-results` 2.2.0 | +| `import anysolver` | `import anyfesolver` | +| `import anysolver_results` | `import anyfesolver_results` | + +There are **no compatibility aliases**: `import anysolver` and +`import anysolver_results` are not provided by either new distribution, and the +verifier fails if an old import tree is shipped or resolves after a clean +install. Existing code must change its imports. The published `ANYsolver` +0.4.7 project is not modified by this release. + +The supported historical wire formats (recovery capsule contracts v1 and v2) +are intended to remain readable by the renamed results runtime. This packaging +change does not itself test that; it is covered by the results tests run in CI. + +`ANYfeSolver` 0.5.0 requires `ANYfeSolver-results>=2.2,<3`. The other public +solver dependency bands (numpy, scipy, threadpoolctl, ANYmaterial, ANYmesher, +ANYfileio) and the optional extras are as declared in 0.4.7. +`ANYfeSolver-results` depends only on `numpy>=2.0`. Project URLs point to +`https://github.com/audunarn/ANYfeSolver`. + +## Packaging + +* Solver source: `src/anyfesolver`; results source: + `packages/results/src/anyfesolver_results`. Both are built from the same + commit; the results distribution is packaged and tested separately, and the + pytest path covers both source trees. +* The optional CPython 3.11 Windows guard builds as `anyfesolver._native_guard` + from the shipped C++ source, which keeps its existing + `ANYSOLVER_GUARD_SOURCE_SHA` macro. `ANYFESOLVER_BUILD_NATIVE_GUARD=0` + disables the build; the previous `ANYSOLVER_BUILD_NATIVE_GUARD` is honoured + only when the new variable is absent. Other hosts keep the pure-Python + package. +* Both distributions declare `MPL-2.0` and ship `LICENSE`, `COPYRIGHT` and + `THIRD_PARTY_NOTICES.md`. + +## Release gate + +`scripts/verify_release_050.py` records, for one candidate commit: + +* clean tracked tree and exact commit/tree identity; +* both wheel/sdist pairs equal the source trees byte for byte, with file + inventories and SHA-256 values, license files and metadata, and dependency + bands; +* each sdist is extracted in a fresh directory and rebuilt into a wheel whose + content matches the shipped wheel, and the rebuilt pair installs and imports; +* a clean `--target` install of the shipped wheels imports only the new names and + keeps the B3-GE opt-in, legacy B3 default and opt-in-only Armijo boundaries. + +The frozen 0.4.7 evidence files (G7 and performance) are re-hashed by the +unmodified `scripts/verify_release_047.py` and cited only as evidence bound to +the 0.4.7 identities. The 0.4.7 terminal is not reused. No scientific +requalification, broad numerical run or performance campaign of 0.5.0 is +performed or implied. The portable test suite is covered separately by CI, which +must succeed on the release commit. + +Terminal on success: + +`ANYFESOLVER_0_5_0_PACKAGING_GATE_PASSED_NOT_A_PUBLICATION_DECISION` + +It records packaging identity only; it neither approves nor publishes anything. + +## Publication + +`.github/workflows/publish.yml` runs only for tag `v0.5.0` (a dispatch on that +tag, or a published non-draft, non-prerelease GitHub release) on a commit +reachable from `main`, and requires a successful `push`/dispatch CI run on that +exact SHA. Pull-request runs are never used as evidence, and the only artifact +taken from another run is the validated stage artifact described below. + +### Stage, then promote the same bytes + +* **Stage** is a `workflow_dispatch` run on the tag. It has no production input. + It builds once, runs the gate, uploads to TestPyPI (`testpypi` environment) + and keeps the verified files as the run artifact `release-050-distributions`. +* **Promote** is a published GitHub release on the same tag. It **does not + rebuild**: source distributions are not byte-reproducible (two real builds + produced matching wheels but different sdists), so a rebuilt sdist would + conflict with the digest TestPyPI already holds. Instead the `stage` job + retrieves the artifact of the stage run and the protected `pypi` environment + uploads those exact bytes. +* The stage run is accepted only if it is a run of + `.github/workflows/publish.yml` in this same repository (not a fork, no pull + request), event `workflow_dispatch`, completed with success including its + TestPyPI job, for the same validated release SHA and on the same tag ref, and + its artifact is the single unexpired `release-050-distributions` of that run. + The files are re-hashed against `SHA256SUMS`, and the manifest must carry the + same commit, versions, terminal and wheel digests. + Release-time CI, licensing, dependency and tag/version checks still run. +* Uploads to either index are planned per file against the index's SHA-256: + absent files are uploaded, files present with the same digest are left alone, + and a differing digest or any foreign file for that version fails the run. + Nothing is overwritten and nothing is skipped by filename. + `ANYfeSolver-results` goes before `ANYfeSolver`. After uploading, each index is + checked up to five times, 30 seconds apart, then the run fails. +* The pure-Python gate runs on the Linux staging runner. The optional Windows + CPython 3.11 native guard is built and tested separately in CI; the staging + gate neither builds nor compares native binaries. + +### Retention, absent stage and re-staging + +The artifact is kept for 30 days (`retention-days: 30`). If the stage run is +absent, failed, for another SHA or ref, or its artifact has expired, promotion +fails closed and uploads nothing. + +* A transient failure in the stage run's TestPyPI job: use "re-run failed jobs" + on that same run. The retained, already verified bytes are reused; the build is + not repeated. Do not re-run the whole workflow or dispatch again after any file + has reached TestPyPI: that rebuilds, the new sdist digests differ, and the + per-file check fails by design. +* A stage that never uploaded anything, or an expired artifact before any upload, + can be staged afresh with a new dispatch on the tag. Once TestPyPI holds files + of a version, those names cannot be replaced, so an expired artifact after a + partial or full TestPyPI upload requires a new version and tag. +* A failure in the promotion run before or during the PyPI upload can be + re-run: files already on PyPI with the matching digest are left alone and only + missing ones are uploaded. + +The environment protections, the trusted-publisher registrations for both new +project names on both indexes and the `CHANGELOG.md` 0.5.0 section are +repository settings/content outside this file and must be in place before a +release is attempted. Workflow files were not executed here. diff --git a/scripts/build_static_contact_candidate.py b/scripts/build_static_contact_candidate.py index 6c9bf0497..01ac77a23 100644 --- a/scripts/build_static_contact_candidate.py +++ b/scripts/build_static_contact_candidate.py @@ -18,7 +18,9 @@ from pathlib import Path ROOT = Path(__file__).resolve().parents[1] -CONFIG_PATH = ROOT / "scripts" / "contact_candidate_slice2.json" +# Packaging-only 0.5.0 successor; the frozen predecessor +# scripts/contact_candidate_slice2.json is retained unchanged. +CONFIG_PATH = ROOT / "scripts" / "contact_candidate_050.json" IGNORE = shutil.ignore_patterns("__pycache__", "*.pyc", "*.egg-info") SOLVER_TOP_FILES = ("pyproject.toml", "README.md", "LICENSE", "COPYRIGHT", "THIRD_PARTY_NOTICES.md") @@ -51,7 +53,7 @@ def build_wheel(project_dir: Path, wheelhouse: Path) -> str: def stage_solver(checkout: Path, stage: Path, candidate_version: str) -> dict: """Stage a copy of the solver sources with only the version string changed.""" (stage / "src").mkdir(parents=True) - shutil.copytree(checkout / "src" / "anysolver", stage / "src" / "anysolver", + shutil.copytree(checkout / "src" / "anyfesolver", stage / "src" / "anyfesolver", ignore=IGNORE) for name in SOLVER_TOP_FILES: shutil.copy2(checkout / name, stage / name) @@ -63,7 +65,7 @@ def stage_solver(checkout: Path, stage: Path, candidate_version: str) -> dict: (stage / "pyproject.toml").write_text( pyproject.replace(old, f'version = "{candidate_version}"'), encoding="utf-8") files = {} - for path in sorted((stage / "src" / "anysolver").rglob("*")): + for path in sorted((stage / "src" / "anyfesolver").rglob("*")): if path.is_file() and "__pycache__" not in path.parts: files[str(path.relative_to(stage))] = sha256_file(path) for name in SOLVER_TOP_FILES: @@ -75,7 +77,7 @@ def stage_solver(checkout: Path, stage: Path, candidate_version: str) -> dict: def write_guide(bundle: Path, config: dict) -> None: version = config["candidate_version"] - bundle.joinpath("README.md").write_text(f"""# ANYsolver static-contact candidate + bundle.joinpath("README.md").write_text(f"""# ANYfeSolver static-contact candidate Private candidate wheels for the supported static-contact workflows. Version: `{version}` (stage version change only; solver sources identical to @@ -89,7 +91,7 @@ def write_guide(bundle: Path, config: dict) -> None: ``` python -m pip install --no-cache-dir -r requirements-tested.txt -python -m pip install --no-cache-dir --no-index --find-links wheelhouse "ANYsolver[general-contact]=={version}" anysolver-results==2.1.1 ANYmaterial==0.2.0 "ANYgeometry[planar]==0.4.3" ANYmesher==0.5.0 ANYfileio==0.3.2 +python -m pip install --no-cache-dir --no-index --find-links wheelhouse "ANYfeSolver[general-contact]=={version}" anyfesolver-results==2.2.0 ANYmaterial==0.2.0 "ANYgeometry[planar]==0.4.3" ANYmesher==0.5.0 ANYfileio==0.3.2 python -m pip check ``` @@ -189,7 +191,7 @@ def main(argv: list[str] | None = None) -> int: parser.add_argument("--reuse-wheelhouse", type=Path, help="existing wheelhouse with byte-identical private wheels") parser.add_argument("--results-root", type=Path, default=None, - help="anysolver-results project root (default: checkout/packages/results)") + help="anyfesolver-results project root (default: checkout/packages/results)") parser.add_argument("--sibling-root", type=Path, default=None, help="directory holding pinned sibling checkouts (default: checkout/.ecosystem)") args = parser.parse_args(argv) @@ -203,10 +205,10 @@ def main(argv: list[str] | None = None) -> int: results_root = (args.results_root or checkout / "packages" / "results").resolve() sibling_root = (args.sibling_root or checkout / ".ecosystem").resolve() wheels = [] - for package in ("anysolver-results", "ANYmaterial", "ANYgeometry", + for package in ("anyfesolver-results", "ANYmaterial", "ANYgeometry", "ANYmesher", "ANYfileio"): expected = config["wheel_files"][package] - source = (results_root if package == "anysolver-results" + source = (results_root if package == "anyfesolver-results" else sibling_root / config["sibling_dirs"][package]) reuse = args.reuse_wheelhouse / expected if args.reuse_wheelhouse else None if reuse and reuse.is_file(): @@ -223,13 +225,13 @@ def main(argv: list[str] | None = None) -> int: sha256=sha256_file(wheelhouse / expected), origin=origin)) import tempfile with tempfile.TemporaryDirectory(prefix="candidate-s2-stage-") as tmp: - stage = Path(tmp) / "ANYsolver" + stage = Path(tmp) / "ANYfeSolver" identity = stage_solver(checkout, stage, config["candidate_version"]) built = build_wheel(stage, wheelhouse) - expected = config["wheel_files"]["ANYsolver"] + expected = config["wheel_files"]["ANYfeSolver"] if built != expected: - raise SystemExit(f"ANYsolver: built {built}, expected {expected}") - wheels.append(dict(package="ANYsolver", file=expected, + raise SystemExit(f"ANYfeSolver: built {built}, expected {expected}") + wheels.append(dict(package="ANYfeSolver", file=expected, sha256=sha256_file(wheelhouse / expected), origin="built:current-checkout-staged")) delivered_examples = copy_delivered_examples(checkout, bundle, config) diff --git a/scripts/check_static_contact_candidate.py b/scripts/check_static_contact_candidate.py index dc434619d..d4df8c9b8 100644 --- a/scripts/check_static_contact_candidate.py +++ b/scripts/check_static_contact_candidate.py @@ -36,7 +36,9 @@ from pathlib import Path ROOT = Path(__file__).resolve().parents[1] -CONFIG_PATH = ROOT / "scripts" / "contact_candidate_slice2.json" +# Packaging-only 0.5.0 successor; the frozen predecessor +# scripts/contact_candidate_slice2.json is retained unchanged. +CONFIG_PATH = ROOT / "scripts" / "contact_candidate_050.json" THREAD_ENV = { "OMP_NUM_THREADS": "1", "OPENBLAS_NUM_THREADS": "1", "MKL_NUM_THREADS": "1", "NUMEXPR_NUM_THREADS": "1", "VECLIB_MAXIMUM_THREADS": "1", "NUMBA_NUM_THREADS": "1", @@ -44,9 +46,9 @@ "PYTEST_DISABLE_PLUGIN_AUTOLOAD": "1", "ANYMESHER_DISABLE_NATIVE": "1", "ANYMESHER_REQUIRE_NATIVE": "0", } -PRIVATE_PACKAGES = ("ANYsolver", "anysolver-results", "ANYmaterial", +PRIVATE_PACKAGES = ("ANYfeSolver", "anyfesolver-results", "ANYmaterial", "ANYgeometry", "ANYmesher", "ANYfileio") -PRIVATE_MODULES = ("anysolver", "anysolver_results", "anymaterial", +PRIVATE_MODULES = ("anyfesolver", "anyfesolver_results", "anymaterial", "anygeometry", "anymesher", "anyfileio") EXAMPLE_MODULES = ("general_contact_s3_physical_orientation", "general_contact_s3_friction_physical_path", @@ -104,18 +106,18 @@ def verify_worker_origins(job: dict) -> None: Must run before pytest loads ``tests/conftest.py``: the conftest inserts the checkout root at ``sys.path[0]``, which would otherwise redirect - ``anysolver`` and the delivered ``examples`` imports to the checkout. + ``anyfesolver`` and the delivered ``examples`` imports to the checkout. Preloading caches the installed/bundle modules in ``sys.modules`` and the explicit origin checks refuse any redirected or non-candidate origin. """ root = Path(job["root"]) checkout = Path(job["checkout"]).resolve() bundle_examples = (Path(job["bundle"]) / "examples").resolve() - solver = Path(__import__("anysolver").__file__).resolve() + solver = Path(__import__("anyfesolver").__file__).resolve() if not solver.is_relative_to(root): - raise SystemExit(f"anysolver origin outside install root: {solver}") + raise SystemExit(f"anyfesolver origin outside install root: {solver}") if checkout in solver.parents: - raise SystemExit(f"anysolver origin inside checkout: {solver}") + raise SystemExit(f"anyfesolver origin inside checkout: {solver}") import examples bundle_on_path = any(Path(p).resolve() == bundle_examples for p in getattr(examples, "__path__", [])) diff --git a/scripts/contact_candidate_050.json b/scripts/contact_candidate_050.json new file mode 100644 index 000000000..3b13f4ea0 --- /dev/null +++ b/scripts/contact_candidate_050.json @@ -0,0 +1,215 @@ +{ + "status": "SLICE2_S7_PACKAGING_ONLY_SUCCESSOR_NUMERICAL_FIELDS_EQUAL_PREDECESSOR", + "note": "Packaging-only successor of scripts/contact_candidate_slice2.json (frozen, unchanged). Only the candidate identity (ANYfeSolver / ANYfeSolver-results names, 0.5.0 base, results 2.2.0, 20261111 candidate version) differs; every numerical pin, selector, comparison, scale, cap and installed/private/production boundary is the predecessor's value. No numerical run was made for this successor and no authority, qualification or measurement of the predecessor is renewed or transferred: historical sampled results remain those of the predecessor candidate 0.4.7+contact.candidate.20261020.s7.", + "predecessor": { + "config": "scripts/contact_candidate_slice2.json", + "candidate_version": "0.4.7+contact.candidate.20261020.s7", + "authority_renewed": false, + "numerical_run_made": false + }, + "candidate_version": "0.5.0+contact.candidate.20261111.s7", + "repo_version": "0.5.0", + "private_versions": { + "ANYfeSolver": "0.5.0+contact.candidate.20261111.s7", + "anyfesolver-results": "2.2.0", + "ANYmaterial": "0.2.0", + "ANYgeometry": "0.4.3", + "ANYmesher": "0.5.0", + "ANYfileio": "0.3.2" + }, + "wheel_files": { + "ANYfeSolver": "anyfesolver-0.5.0+contact.candidate.20261111.s7-py3-none-any.whl", + "anyfesolver-results": "anyfesolver_results-2.2.0-py3-none-any.whl", + "ANYmaterial": "anymaterial-0.2.0-py3-none-any.whl", + "ANYgeometry": "anygeometry-0.4.3-py3-none-any.whl", + "ANYmesher": "anymesher-0.5.0-py3-none-any.whl", + "ANYfileio": "anyfileio-0.3.2-py3-none-any.whl" + }, + "sibling_dirs": { + "ANYmaterial": "ANYmaterial", + "ANYgeometry": "ANYgeometry", + "ANYmesher": "ANYmesh", + "ANYfileio": "ANYfileIO" + }, + "sibling_refs": { + "ANYmaterial": "d8a233ef4c5e38d25dbba0eb20e6cfa8d44ec5a2", + "ANYgeometry": "91846898b03fa02b029abde82508eddb981efdc0", + "ANYmesher": "2ccef378c3efb4ba3a9957b9ab896ac8fc454b9d", + "ANYfileio": "db73950018e1c87dab0ca618c25c965030ba08ce" + }, + "numerical_pins": [ + "numpy==2.5.4", + "scipy==1.18.1", + "threadpoolctl==3.7.0", + "numba==0.68.0", + "shapely==2.2.0", + "pytest>=8", + "psutil>=5.9" + ], + "numerical_pins_note": "numpy/scipy/threadpoolctl/numba are the versions from docs/contact-candidate-20261019/requirements-tested.txt (that historical file stays immutable). shapely==2.2.0 is pinned prospectively for the new cold runtime from the observed baseline CI install in ci-positive-binding-shard.log (successful 2026-10-19 job, shapely-2.2.0 wheel); the historical numerical environment never imported Shapely, so no historical Shapely testing is claimed. pytest/psutil are ordinary check tooling.", + "base_selectors": [ + "tests/test_general_contact_beam_pair.py::test_pair_force_control_and_split_restart_match_full_path", + "tests/test_general_contact_beam_pair.py::test_parallel_pair_has_analytic_line_work_balanced_wrench_and_tangent", + "tests/test_general_contact_beam_plane.py::test_b2_line_contact_runs_through_displacement_solver_and_checkpoint", + "tests/test_general_contact_beam_plane.py::test_b2_line_potential_force_tangent_and_gap_certificate", + "tests/test_general_contact_beam_plane.py::test_b3_deformed_curve_runs_through_static_solver", + "tests/test_general_contact_s3_friction_physical_path.py::test_canonical_material_work_and_whole_path", + "tests/test_general_contact_s3_friction_static.py::test_real_static_stick_slip_reversal_opening_and_split_restart", + "tests/test_general_contact_s3_plane.py::test_s3_plane_static_reaction_and_gap_use_physical_reference_offset", + "tests/test_general_contact_static_results_archive.py::test_actual_static_producer_consumer", + "tests/test_general_contact_static_results_archive.py::test_exact_detached_and_refusal", + "tests/test_general_contact_static_results_archive.py::test_independent_preservation_oracle", + "tests/test_general_contact_triangulated_rigid.py::test_complete_penalty_work_and_diagonal", + "tests/test_general_contact_triangulated_rigid.py::test_ordinary_force_and_path_restart", + "tests/test_general_contact_s3_friction_static.py::test_friction_invalid_candidate_and_cancel_restore_context", + "tests/test_general_contact_s3_friction_static.py::test_precancelled_entry_skips_assembly_predictor_and_keeps_context", + "tests/test_general_contact_s3_friction_cli.py::test_completed_direct_checkpoint_and_legacy_invocation_match", + "tests/test_general_contact_s3_friction_cli.py::test_noncompleted_writes_truthful_json_and_exits_nonzero", + "tests/test_general_contact_s3_friction_cli.py::test_path_collisions_refused_before_solving", + "tests/test_general_contact_s3_friction_cli.py::test_cancelled_and_refused_input_write_no_output", + "tests/test_general_contact_s3_friction_cli.py::test_hardlinked_existing_paths_refused_before_solving", + "tests/test_general_contact_s3_friction_cli.py::test_replacement_failure_after_temp_preserves_old_bytes", + "tests/test_general_contact_s3_friction_cli.py::test_checkpoint_write_failure_reports_published_output", + "tests/test_general_contact_s3_q4_static_dev.py::test_zero_predictor_tiny_positive_controlled_null_and_injection_refusals", + "tests/test_general_contact_s3_friction_static.py::test_uncancelled_legacy_friction_reports_zero_reaction_predictor", + "tests/test_general_contact_s3_friction_physical_path.py::test_uncancelled_sliding_friction_reports_zero_reaction_predictor", + "tests/test_general_contact_monolithic_ordinary_displacement.py::test_ordinary_displacement_rejects_unphysical_force_scale" + ], + "additional_selector_batches": { + "curved-skins": [ + "tests/test_general_contact_curved_shell_skin.py::test_actual_model_inventory_and_zero_pose_reference", + "tests/test_general_contact_curved_shell_skin.py::test_gravity_preloaded_panel_skin_recovery", + "tests/test_general_contact_curved_shell_skin.py::test_shared_node_work_accumulation", + "tests/test_general_contact_curved_shell_skin.py::test_shared_sphere_corner_distinctness", + "tests/test_general_contact_curved_shell_skin.py::test_rigid_translation_of_each_body", + "tests/test_general_contact_curved_shell_skin.py::test_rigid_rotation_virtual_work_of_each_body", + "tests/test_general_contact_curved_shell_skin.py::test_local_deformation_probe_of_each_body", + "tests/test_general_contact_curved_shell_skin.py::test_fixed_spatial_force_pullback_derivative", + "tests/test_general_contact_curved_shell_skin.py::test_physical_offsets_and_authoritative_dofs", + "tests/test_general_contact_curved_shell_skin.py::test_refusals_and_nonmutation", + "tests/test_general_contact_curved_shell_skin.py::test_wrong_map_pose_and_shape_refusals", + "tests/test_general_contact_curved_shell_skin.py::test_bound_identity_refuses_thickness_and_director_changes", + "tests/test_general_contact_curved_shell_skin.py::test_face_interpolation_and_normals" + ], + "elastic-initial-state": [ + "tests/test_elastic_sphere_stiffened_panel.py::test_fixed_sphere_case_data_topology", + "tests/test_elastic_sphere_stiffened_panel.py::test_initial_state_document_metadata", + "tests/test_elastic_sphere_stiffened_panel.py::test_exported_mesh_matches_model_geometry", + "tests/test_elastic_sphere_stiffened_panel.py::test_sphere_masses_match_faceted_reference", + "tests/test_elastic_sphere_stiffened_panel.py::test_panel_masses_match_declared_target", + "tests/test_elastic_sphere_stiffened_panel.py::test_panel_gravity_solve_completed", + "tests/test_elastic_sphere_stiffened_panel.py::test_global_equilibrium_balance_within_tolerances", + "tests/test_elastic_sphere_stiffened_panel.py::test_sphere_pose_and_placement", + "tests/test_elastic_sphere_stiffened_panel.py::test_impact_request_is_refused" + ] + }, + "friction_stages": [ + "full", + "active-prefix", + "prefix", + "active-resume", + "resume", + "rollback" + ], + "friction_lifecycle_node": "tests/test_general_contact_s3_friction_physical_path.py::test_public_installed_lifecycle_and_restart", + "friction_rollback_node": "tests/test_general_contact_s3_friction_physical_path.py::test_public_trial_exception_and_inflight_cancellation", + "orientation_stages": [ + "full-plus" + ], + "orientation_node": "tests/test_general_contact_s3_physical_orientation.py::test_installed_s3_physical_orientation_stage", + "bundle_examples": [ + "general_contact_automatic_s3_pair", + "general_contact_round_beam_pair", + "general_contact_round_beam_plane", + "general_contact_s3_friction_physical_path", + "general_contact_s3_physical_orientation", + "general_contact_s3_plane", + "general_contact_static_results_archive", + "general_contact_triangulated_rigid", + "elastic_sphere_stiffened_panel", + "elastic_sphere_stiffened_panel_mesh", + "elastic_sphere_panel_contact_skins" + ], + "bundle_examples_note": "Exactly the previously delivered public examples plus the elastic sphere stiffened-panel initial-state example, its fixed case-data module and the development-only curved contact-skins geometry example, plus the examples package marker; no experimental examples enter the bundle", + "example_commands": { + "normal": [ + "examples.general_contact_s3_physical_orientation" + ], + "friction": [ + "examples.general_contact_s3_friction_physical_path", + "--output", + "examples/friction.json" + ], + "archive": [ + "examples.general_contact_static_results_archive" + ], + "restart-partial": [ + "examples.general_contact_s3_friction_physical_path", + "--through-step", + "3", + "--output", + "examples/restart-partial.json", + "--checkpoint-output", + "examples/restart-checkpoint.json" + ], + "restart": [ + "examples.general_contact_s3_friction_physical_path", + "--through-step", + "7", + "--restart", + "examples/restart-checkpoint.json", + "--output", + "examples/restart.json" + ], + "contact-skins": [ + "examples.elastic_sphere_panel_contact_skins", + "--output", + "examples/contact-skins.json" + ] + }, + "timeouts": { + "case_seconds": 120, + "host_numerical_seconds": 600, + "rss_limit_mib": 953 + }, + "cross_host_bound": "maxabs(delta) <= 1e-9*maxabs(reference) + 1e-12*scale per declared quantity; exact non-numeric fields", + "cross_host_files": { + "friction_full": "friction/full.json", + "orientation_full": "orientation/full-plus.json", + "example_friction": "examples/friction.json" + }, + "cross_host_quantities": [ + ["friction_full", "displacements", "displacement_m", 1.0], + ["friction_full", "info.force_displacement_history[*].reaction_generalized[0]", "force_N", 0.02], + ["friction_full", "info.force_displacement_history[*].reaction_generalized[1]", "force_N", 0.02], + ["friction_full", "info.force_displacement_history[*].friction.dissipation_increment_j", "energy_J", 0.02], + ["friction_full", "poses[*].complete_contact_wrench.force", "dimensionless", 1.0], + ["friction_full", "poses[*].complete_contact_wrench.moment", "dimensionless", 1.0], + ["friction_full", "poses[*].coupled_equilibrium_normalized", "dimensionless", 1.0], + ["orientation_full", "target_node9_uz_m", "displacement_m", 1.0], + ["orientation_full", "upper_actuator_ux_m", "displacement_m", 1.0], + ["orientation_full", "phase_wrench_errors[*].force", "dimensionless", 1.0], + ["orientation_full", "phase_wrench_errors[*].moment", "dimensionless", 1.0], + ["orientation_full", "all_free_equilibrium_normalized_error", "dimensionless", 1.0], + ["example_friction", "phases[*].reaction_generalized[0]", "force_N", 0.02], + ["example_friction", "phases[*].friction.dissipation_increment_j", "energy_J", 0.02] + ], + "cross_host_exact": [ + ["friction_full", "status"], + ["friction_full", "snapshot_inventory"], + ["friction_full", "verified"], + ["friction_full", "info.force_displacement_history[*].friction.branch"], + ["orientation_full", "status"], + ["orientation_full", "stage"], + ["orientation_full", "identity"], + ["orientation_full", "selections"], + ["orientation_full", "settings"], + ["orientation_full", "criteria"], + ["orientation_full", "physical_inputs"], + ["orientation_full", "verified"], + ["orientation_full", "opening_verified"], + ["example_friction", "status"], + ["example_friction", "physical_scope"] + ], + "scale_provenance": "CASE_FREEZE.json W3_W4_W5_W6_W10 group (displacement_m 1, force_N 0.02, length_m 1, energy_J 0.02); dimensionless normalized diagnostics use scale 1" +} diff --git a/tests/test_anyfileio_version_compatibility.py b/tests/test_anyfileio_version_compatibility.py index ad04be99a..6bfd5e15f 100644 --- a/tests/test_anyfileio_version_compatibility.py +++ b/tests/test_anyfileio_version_compatibility.py @@ -54,7 +54,7 @@ def _source_fileio_requirements() -> list[str]: def _installed_fileio_requirements() -> list[str]: - requirements = metadata.requires("ANYsolver") or [] + requirements = metadata.requires("ANYfeSolver") or [] return [ item for item in requirements @@ -116,7 +116,7 @@ def _source_ledgers() -> tuple[dict[str, str], dict[str, str]] | None: versions = json.loads(raw_versions) roots = json.loads(raw_roots) expected = { - "anysolver", + "anyfesolver", "anymaterial", "anygeometry", "anymesher", @@ -165,9 +165,9 @@ def _assert_graph( ) edges.add((source, target)) required_edges = { - ("anysolver", "anymaterial"), - ("anysolver", "anymesher"), - ("anysolver", "anyfileio"), + ("anyfesolver", "anymaterial"), + ("anyfesolver", "anymesher"), + ("anyfesolver", "anyfileio"), ("anymesher", "anygeometry"), } assert required_edges <= edges @@ -176,18 +176,18 @@ def _assert_graph( def _assert_complete_source_graphs(roots: dict[str, str]) -> None: archives = Path(roots["anymaterial"]).resolve().parents[1] - solver_root = Path(roots["anysolver"]).resolve().parent + solver_root = Path(roots["anyfesolver"]).resolve().parent cells = { "coordinated": ( { - "anysolver": solver_root, + "anyfesolver": solver_root, "anymaterial": archives / "material-current", "anygeometry": archives / "geometry-current", "anymesher": archives / "mesh-current", "anyfileio": archives / "fileio-current", }, { - "anysolver": "0.4.7", + "anyfesolver": "0.5.0", "anymaterial": "0.2.0", "anygeometry": "0.4.3", "anymesher": "0.5.0", @@ -216,18 +216,18 @@ def probe_anyfileio_public_contract( import anygeometry import anymaterial import anymesher - import anysolver - from anysolver import external_references + import anyfesolver + from anyfesolver import external_references modules = { - "ANYsolver": anysolver, + "ANYfeSolver": anyfesolver, "ANYmaterial": anymaterial, "ANYgeometry": anygeometry, "ANYmesher": anymesher, "ANYfileio": anyfileio, } expected_variables = { - "ANYsolver": "EXPECTED_ANYSOLVER_VERSION", + "ANYfeSolver": "EXPECTED_ANYSOLVER_VERSION", "ANYmaterial": "EXPECTED_ANYMATERIAL_VERSION", "ANYgeometry": "EXPECTED_ANYGEOMETRY_VERSION", "ANYmesher": "EXPECTED_ANYMESHER_VERSION", @@ -262,9 +262,9 @@ def probe_anyfileio_public_contract( "merge_results", ) assert all(hasattr(anyfileio, name) for name in symbols) - assert anysolver.SesamFemDocument is anyfileio.SesamFemDocument - assert anysolver.FemRawRecord is anyfileio.FemRawRecord - assert anysolver.CalculixParsedResults is anyfileio.CalculixParsedResults + assert anyfesolver.SesamFemDocument is anyfileio.SesamFemDocument + assert anyfesolver.FemRawRecord is anyfileio.FemRawRecord + assert anyfesolver.CalculixParsedResults is anyfileio.CalculixParsedResults assert external_references.parse_calculix_frd is anyfileio.parse_frd assert external_references.parse_calculix_dat is anyfileio.parse_dat assert external_references.merge_calculix_results is anyfileio.merge_results @@ -290,8 +290,8 @@ def round_trip(root: Path) -> None: return { "anyfileio_version": anyfileio.__version__, "anyfileio_origin": str(origin), - "anysolver_version": anysolver.__version__, - "anysolver_origin": str(Path(anysolver.__file__).resolve()), + "anyfesolver_version": anyfesolver.__version__, + "anyfesolver_origin": str(Path(anyfesolver.__file__).resolve()), "anymaterial_version": anymaterial.__version__, "anymaterial_origin": str(Path(anymaterial.__file__).resolve()), "anygeometry_version": anygeometry.__version__, @@ -323,10 +323,10 @@ def test_current_source_origins_and_complete_graphs() -> None: import anygeometry import anymaterial import anymesher - import anysolver + import anyfesolver modules = { - "anysolver": anysolver, + "anyfesolver": anyfesolver, "anymaterial": anymaterial, "anygeometry": anygeometry, "anymesher": anymesher, @@ -337,7 +337,7 @@ def test_current_source_origins_and_complete_graphs() -> None: _assert_complete_source_graphs(roots) -def test_anyfileio_public_contract_used_by_anysolver(tmp_path: Path) -> None: +def test_anyfileio_public_contract_used_by_anyfesolver(tmp_path: Path) -> None: result = probe_anyfileio_public_contract( metadata_mode="source", temporary_root=tmp_path ) @@ -360,7 +360,7 @@ def test_workflows_pin_compatibility_graph_and_actions() -> None: "pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33", } combined = ci + publish - assert set(re.findall(r"(?m)^\s*- uses: (\S+)\s*$", combined)) == action_refs + assert set(re.findall(r"(?m)^\s*(?:- )?uses: (\S+)\s*$", combined)) == action_refs ci_header, ci_jobs = ci.split("jobs:\n", maxsplit=1) assert ci_header == ( @@ -377,16 +377,29 @@ def test_workflows_pin_compatibility_graph_and_actions() -> None: "numba", "pardiso", ] - publish_header, publish_jobs = publish.split("jobs:\n", maxsplit=1) - assert publish_header == ( - "name: Publish\n\non:\n workflow_dispatch:\n release:\n" - " types: [published]\n\n" + # The 0.5.0 publish workflow is a two-project (ANYfeSolver-results then + # ANYfeSolver) pipeline: validate -> gates -> one build -> TestPyPI -> PyPI. + publish_header, publish_jobs = publish.split("\njobs:\n", maxsplit=1) + assert publish_header.startswith("name: Publish\n") + assert ( + "\non:\n workflow_dispatch:\n release:\n types: [published]\n" + in publish_header ) + assert "\npermissions:\n contents: read\n" in publish_header + assert "cancel-in-progress: false" in publish_header + for line in ( + " RELEASE_TAG: v0.5.0\n", + ' SOLVER_VERSION: "0.5.0"\n', + ' RESULTS_VERSION: "2.2.0"\n', + ): + assert line in publish_header, line assert re.findall(r"(?m)^ ([a-z0-9-]+):\n", publish_jobs) == [ + "validate", "license-gate", "dependency-gate", "build", "testpypi", + "stage", "pypi", ] @@ -431,7 +444,7 @@ def job_block(workflow: str, name: str) -> str: ) def action_sequence(block: str) -> list[str]: - return re.findall(r"(?m)^ - uses: (\S+)\s*$", block) + return re.findall(r"(?m)^(?: - | )uses: (\S+)\s*$", block) assert action_sequence(job_block(ci, "license")) == [checkout_ref, setup_ref] assert action_sequence(job_block(ci, "resolver")) == [checkout_ref, setup_ref] @@ -458,6 +471,10 @@ def action_sequence(block: str) -> list[str]: assert action_sequence(job_block(ci, name)) == [checkout_ref] * 5 + [ setup_ref ] + assert action_sequence(job_block(publish, "validate")) == [ + checkout_ref, + setup_ref, + ] assert action_sequence(job_block(publish, "license-gate")) == [ checkout_ref, setup_ref, @@ -467,24 +484,34 @@ def action_sequence(block: str) -> list[str]: checkout_ref, setup_ref, upload_ref, - upload_ref, ] build_block = job_block(publish, "build") - assert build_block.index('python scripts/verify_release_047.py') < build_block.index(upload_ref) - assert '--wheel dist/anysolver-0.4.7-py3-none-any.whl' in build_block - assert '--sdist dist/anysolver-0.4.7.tar.gz' in build_block - assert 'name: release-047-gate' in build_block - assert action_sequence(job_block(publish, "testpypi")) == [ - download_ref, - publish_ref, - ] - assert action_sequence(job_block(publish, "pypi")) == [ - download_ref, - publish_ref, - ] + assert build_block.index("python scripts/verify_release_050.py") < build_block.index( + upload_ref + ) + for argument in ( + "--solver-wheel dist/solver/anyfesolver-${SOLVER_VERSION}-py3-none-any.whl", + "--solver-sdist dist/solver/anyfesolver-${SOLVER_VERSION}.tar.gz", + "--results-wheel dist/results/anyfesolver_results-${RESULTS_VERSION}-py3-none-any.whl", + "--results-sdist dist/results/anyfesolver_results-${RESULTS_VERSION}.tar.gz", + "--expected-commit", + "--output release-050-gate.json", + "python -m build --outdir dist/results packages/results", + "python -m build --outdir dist/solver .", + "sha256sum results/* solver/*", + ): + assert argument in build_block, argument + assert "name: release-050-distributions" in build_block + for stage in ("testpypi", "pypi"): + assert action_sequence(job_block(publish, stage)) == [ + checkout_ref, + download_ref, + publish_ref, + publish_ref, + ], stage checkout_pattern = re.compile( - rf"(?m)^ - uses: {re.escape(checkout_ref)}\n" + rf"(?m)^(?: - | )uses: {re.escape(checkout_ref)}\n" r" with:\n" r" repository: (\S+)\n" r" ref: (.+)\n" @@ -674,7 +701,7 @@ def probe_environment(block: str) -> str: assert probe_environment(mesh_job) == "\n".join( ( - ' EXPECTED_ANYSOLVER_VERSION: "0.4.7"', + ' EXPECTED_ANYSOLVER_VERSION: "0.5.0"', ' EXPECTED_ANYMATERIAL_VERSION: "0.2.0"', " EXPECTED_ANYMESHER_VERSION: ${{ matrix.anymesher-version }}", " EXPECTED_ANYGEOMETRY_VERSION: ${{ matrix.anygeometry-version }}", @@ -684,7 +711,7 @@ def probe_environment(block: str) -> str: ) assert probe_environment(fileio_job) == "\n".join( ( - ' EXPECTED_ANYSOLVER_VERSION: "0.4.7"', + ' EXPECTED_ANYSOLVER_VERSION: "0.5.0"', ' EXPECTED_ANYMATERIAL_VERSION: "0.2.0"', " EXPECTED_ANYFILEIO_VERSION: ${{ matrix.anyfileio-version }}", " EXPECTED_ANYMESHER_VERSION: ${{ matrix.anymesher-version }}", @@ -720,69 +747,158 @@ def job_preamble(block: str) -> str: assert separator return preamble - assert job_preamble(job_block(publish, "dependency-gate")) == ( - " dependency-gate:\n" - " name: Verify production sibling releases\n" - " runs-on: ubuntu-latest\n" - ) - assert job_preamble(job_block(publish, "build")) == ( - " build:\n" - " needs: [dependency-gate, license-gate]\n" - " runs-on: ubuntu-latest\n" - ) - assert job_preamble(job_block(publish, "testpypi")) == ( - " testpypi:\n" - " if: github.event_name == 'workflow_dispatch'\n" - " needs: build\n" - " runs-on: ubuntu-latest\n" - " environment:\n" - " name: testpypi\n" - " url: https://test.pypi.org/p/ANYsolver\n" - " permissions:\n" - " id-token: write\n" - ) - assert job_preamble(job_block(publish, "pypi")) == ( - " pypi:\n" - " if: github.event_name == 'release'\n" - " needs: build\n" - " runs-on: ubuntu-latest\n" - " environment:\n" - " name: pypi\n" - " url: https://pypi.org/p/ANYsolver\n" - " permissions:\n" - " id-token: write\n" + def preamble_keys(block: str) -> dict[str, str]: + """Top-level job keys (indent 4) with their inline value.""" + return { + key: value.strip() + for key, value in re.findall( + r"(?m)^ ([a-z][a-z-]*):(.*)$", job_preamble(block) + ) + } + + def nested_lines(block: str, key: str) -> list[str]: + match = re.search( + rf"(?m)^ {key}:\n((?:^ [^\n]*\n)+)", job_preamble(block) + ) + assert match is not None, key + return match.group(1).splitlines() + + expected_pre = { + "validate": {"runs-on": "ubuntu-latest"}, + "license-gate": {"needs": "validate", "runs-on": "ubuntu-latest"}, + "dependency-gate": {"needs": "validate", "runs-on": "ubuntu-latest"}, + "build": { + "needs": "[validate, dependency-gate, license-gate]", + "runs-on": "ubuntu-latest", + }, + } + for name, expected in expected_pre.items(): + actual = preamble_keys(job_block(publish, name)) + for key, value in expected.items(): + assert actual.get(key) == value, (name, key, actual) + if name == "build": + assert actual["if"] == "github.event_name == 'workflow_dispatch'" + else: + assert "if" not in actual, name + assert "environment" not in actual, name + assert preamble_keys(job_block(publish, "dependency-gate")).get("name") == ( + "Verify production sibling releases" ) + # Workflow_dispatch only stages to TestPyPI; production promotion happens + # only on a published release, behind the protected environment, after + # TestPyPI served the identical digests. + testpypi_pre = preamble_keys(job_block(publish, "testpypi")) + assert testpypi_pre["needs"] == "[validate, build]" + assert testpypi_pre["runs-on"] == "ubuntu-latest" + assert testpypi_pre["if"] == "github.event_name == 'workflow_dispatch'" + assert nested_lines(job_block(publish, "testpypi"), "environment") == [ + " name: testpypi", + " url: https://test.pypi.org/p/ANYfeSolver", + ] + pypi_pre = preamble_keys(job_block(publish, "pypi")) + assert pypi_pre["if"] == "github.event_name == 'release'" + assert pypi_pre["needs"] == "[validate, license-gate, dependency-gate, stage]" + assert pypi_pre["runs-on"] == "ubuntu-latest" + assert nested_lines(job_block(publish, "pypi"), "environment") == [ + " name: pypi", + " url: https://pypi.org/p/ANYfeSolver", + ] + dependency_job = job_block(publish, "dependency-gate") assert "TARGET_INDEX_URL" not in dependency_job assert "--index-url https://pypi.org/simple" in dependency_job testpypi_job = job_block(publish, "testpypi") pypi_job = job_block(publish, "pypi") + # One legacy-endpoint override per project upload step, TestPyPI only. assert testpypi_job.count( "repository-url: https://test.pypi.org/legacy/" - ) == 1 + ) == 2 assert "repository-url:" not in pypi_job - assert publish.count("repository-url:") == 1 + assert publish.count("repository-url:") == 2 - permission_bodies: list[str] = [] - for name in ("dependency-gate", "build", "testpypi", "pypi"): - block = job_block(publish, name) + # Results first, then the solver, per index; nothing is overwritten. + for job, index in ((testpypi_job, "https://test.pypi.org"), (pypi_job, "https://pypi.org")): + results_plan = job.index( + f'--index {index} --name ANYfeSolver-results --version "$RESULTS_VERSION"' + ) + solver_plan = job.index( + f'--index {index} --name ANYfeSolver --version "$SOLVER_VERSION"' + ) + assert results_plan < solver_plan + assert "packages-dir: plan/results/" in job + assert "packages-dir: plan/solver/" in job + assert job.index("packages-dir: plan/results/") < job.index( + "packages-dir: plan/solver/" + ) + assert "--require-complete" in job + assert "sha256sum -c ../SHA256SUMS" in job + assert "skip-existing" not in job + assert "--missing-dir plan/results" in job + assert "--missing-dir plan/solver" in job + assert ( + "--index https://test.pypi.org --name ANYfeSolver-results" + in pypi_job + ), "PyPI promotion must require TestPyPI to serve the identical digests" + + # Least privilege: workflow read-only; only validate adds actions: read and + # only the two index jobs add id-token: write. + def job_permissions(name: str) -> list[str] | None: match = re.search( - r"(?m)^ permissions:\n((?:^ [^\n]*\n)+)", block + r"(?m)^ permissions:\n((?:^ [^\n]*\n)+)", + job_block(publish, name), ) - if match is not None: - permission_bodies.append(match.group(1)) - assert permission_bodies == [" id-token: write\n"] * 2 - assert "permissions:" not in job_block(publish, "dependency-gate") - assert "permissions:" not in job_block(publish, "build") + return None if match is None else match.group(1).splitlines() + + assert job_permissions("validate") == [ + " contents: read", + " actions: read", + ] + assert job_permissions("stage") == job_permissions("validate") + assert job_permissions("testpypi") == [" contents: read", " id-token: write"] + assert job_permissions("pypi") == [" contents: read", " id-token: write"] + for name in ("license-gate", "dependency-gate", "build"): + assert job_permissions(name) is None, name + assert "permissions:" not in job_block(publish, name) + assert "id-token" not in job_block(publish, "validate") + + # The validate job binds the tag, versions, main ancestry and trusted CI. + validate_block = job_block(publish, "validate") + for fragment in ( + 'ANYfeSolver", os.environ.get("SOLVER_VERSION", "0.5.0")', + 'ANYfeSolver-results", os.environ.get("RESULTS_VERSION", "2.2.0")', + "git merge-base --is-ancestor", + "actions/workflows/ci.yml/runs?head_sha=", + 'run["head_branch"] == "main"', + ): + assert fragment in validate_block, fragment + assert "SIBLINGS" not in ci assert "git+https://" not in ci assert ci.count("python -m pip check") == 8 + # The CI resolver builds the same-checkout results wheel with the solver + # wheel and resolves the exact sibling graph. + resolver_block = job_block(ci, "resolver") + assert "./packages/results" in resolver_block + for pin in ( + "ANYmaterial==0.2.0", + "ANYgeometry==0.4.3", + "ANYmesher==0.5.0", + "ANYfileio==0.3.2", + ): + assert pin in resolver_block, pin assert '"ANYmaterial==0.2.0"' in publish assert '"ANYgeometry==0.4.3"' in publish assert '"ANYmesher==0.5.0"' in publish assert '"ANYfileio==0.3.2"' in publish assert "pip install --dry-run --only-binary=:all:" in publish + for pin in ( + "ANYmaterial==0.2.0", + "ANYgeometry==0.4.3", + "ANYmesher==0.5.0", + "ANYfileio==0.3.2", + ): + assert pin in build_block, pin def _main() -> int: diff --git a/tests/test_anymesher_version_compatibility.py b/tests/test_anymesher_version_compatibility.py index 12169152d..a7ef4c47a 100644 --- a/tests/test_anymesher_version_compatibility.py +++ b/tests/test_anymesher_version_compatibility.py @@ -31,7 +31,7 @@ def _assert_expected_anymesher_requirement(requirement: str) -> None: def _installed_anymesher_requirements() -> list[str]: - requirements = metadata.requires("ANYsolver") or [] + requirements = metadata.requires("ANYfeSolver") or [] return [ requirement for requirement in requirements @@ -83,7 +83,7 @@ def _assert_probe_identities( modules: dict[str, ModuleType], *, metadata_mode: str ) -> None: expected_variables = { - "ANYsolver": "EXPECTED_ANYSOLVER_VERSION", + "ANYfeSolver": "EXPECTED_ANYSOLVER_VERSION", "ANYmaterial": "EXPECTED_ANYMATERIAL_VERSION", "ANYgeometry": "EXPECTED_ANYGEOMETRY_VERSION", "ANYmesher": "EXPECTED_ANYMESHER_VERSION", @@ -122,16 +122,16 @@ def _metadata_requirement(metadata_mode: str) -> str: def probe_anymesher_public_contract( *, metadata_mode: str = "source" ) -> dict[str, Any]: - """Exercise the exact neutral-meshing surface consumed by ANYsolver.""" + """Exercise the exact neutral-meshing surface consumed by ANYfeSolver.""" import anyfileio import anygeometry import anymaterial import anymesher - import anysolver + import anyfesolver modules = { - "ANYsolver": anysolver, + "ANYfeSolver": anyfesolver, "ANYmaterial": anymaterial, "ANYgeometry": anygeometry, "ANYmesher": anymesher, @@ -149,7 +149,7 @@ def probe_anymesher_public_contract( "verify_mesh_quality", ) assert all(hasattr(anymesher, name) for name in required_names) - assert anysolver.StiffenerCrossSection is anymesher.StiffenerCrossSection + assert anyfesolver.StiffenerCrossSection is anymesher.StiffenerCrossSection panel = anymesher.StiffenedPanel( length=2.4, @@ -197,8 +197,8 @@ def probe_anymesher_public_contract( "anyfileio_origin": str(Path(anyfileio.__file__).resolve()), "anymaterial_version": anymaterial.__version__, "anymaterial_origin": str(Path(anymaterial.__file__).resolve()), - "anysolver_version": anysolver.__version__, - "anysolver_origin": str(Path(anysolver.__file__).resolve()), + "anyfesolver_version": anyfesolver.__version__, + "anyfesolver_origin": str(Path(anyfesolver.__file__).resolve()), "requirement": requirement, "metadata_mode": metadata_mode, "node_count": len(mesh.nodes), @@ -225,7 +225,7 @@ def test_installed_requirement_accepts_canonicalized_specifier_order() -> None: _assert_expected_anymesher_requirement("ANYmesher<0.6,>=0.4") -def test_anymesher_public_contract_used_by_anysolver() -> None: +def test_anymesher_public_contract_used_by_anyfesolver() -> None: result = probe_anymesher_public_contract() assert result["node_count"] > 0 assert result["quality_element_count"] > 0 diff --git a/tests/test_extracted_package_wiring.py b/tests/test_extracted_package_wiring.py index 822d24740..db315bea4 100644 --- a/tests/test_extracted_package_wiring.py +++ b/tests/test_extracted_package_wiring.py @@ -1,4 +1,4 @@ -"""Cross-package ownership and compatibility guarantees for ANYsolver 0.4.""" +"""Cross-package ownership and compatibility guarantees for ANYfeSolver 0.5.""" from __future__ import annotations @@ -6,35 +6,35 @@ import anymaterial import anymesher -import anysolver -from anysolver import external_references -from anysolver.mesh_gen import InterpolatedBeamShellMPCElement +import anyfesolver +from anyfesolver import external_references +from anyfesolver.mesh_gen import InterpolatedBeamShellMPCElement def test_material_public_api_is_canonical_anymaterial() -> None: - assert anysolver.Material is anymaterial.IsotropicMaterial - assert anysolver.OrthotropicMaterial is anymaterial.OrthotropicMaterial - assert anysolver.Hill48Yield is anymaterial.Hill48Yield - assert anysolver.DNVC208MaterialCurve is anymaterial.DNVC208MaterialCurve - assert anysolver.elastic_compliance_matrix is anymaterial.elastic_compliance_matrix + assert anyfesolver.Material is anymaterial.IsotropicMaterial + assert anyfesolver.OrthotropicMaterial is anymaterial.OrthotropicMaterial + assert anyfesolver.Hill48Yield is anymaterial.Hill48Yield + assert anyfesolver.DNVC208MaterialCurve is anymaterial.DNVC208MaterialCurve + assert anyfesolver.elastic_compliance_matrix is anymaterial.elastic_compliance_matrix def test_mesh_geometry_public_api_is_canonical_anymesher() -> None: - assert anysolver.StiffenerCrossSection is anymesher.StiffenerCrossSection + assert anyfesolver.StiffenerCrossSection is anymesher.StiffenerCrossSection def test_interpolated_beam_shell_mpc_is_available_from_the_root_api() -> None: - assert anysolver.InterpolatedBeamShellMPCElement is InterpolatedBeamShellMPCElement + assert anyfesolver.InterpolatedBeamShellMPCElement is InterpolatedBeamShellMPCElement def test_file_document_and_result_api_is_canonical_anyfileio() -> None: - assert anysolver.SesamFemDocument is anyfileio.SesamFemDocument - assert anysolver.FemRawRecord is anyfileio.FemRawRecord - assert anysolver.CalculixParsedResults is anyfileio.CalculixParsedResults + assert anyfesolver.SesamFemDocument is anyfileio.SesamFemDocument + assert anyfesolver.FemRawRecord is anyfileio.FemRawRecord + assert anyfesolver.CalculixParsedResults is anyfileio.CalculixParsedResults assert external_references.parse_calculix_frd is anyfileio.parse_frd assert external_references.parse_calculix_dat is anyfileio.parse_dat assert external_references.merge_calculix_results is anyfileio.merge_results def test_distribution_version_marks_the_extraction_boundary() -> None: - assert anysolver.__version__ == "0.4.7" + assert anyfesolver.__version__ == "0.5.0" diff --git a/tests/test_release_047_bounded.py b/tests/test_release_047_bounded.py index 7386aeac2..385f63100 100644 --- a/tests/test_release_047_bounded.py +++ b/tests/test_release_047_bounded.py @@ -8,8 +8,8 @@ import pytest -from anysolver import __version__, b3_ge -from anysolver.elements import QuadraticBeamElement, create_element +from anyfesolver import __version__, b3_ge +from anyfesolver.elements import QuadraticBeamElement, create_element from scripts import verify_release_047 as gate @@ -17,7 +17,8 @@ def test_release_identity_and_g7_boundary_are_exact() -> None: - assert __version__ == gate.VERSION == "0.4.7" + assert gate.VERSION == "0.4.7" + assert __version__ == "0.5.0" records = gate._validate_g7() assert set(records) == {"confirmation", "contract", "review", "status"} evidence = gate._validate_performance_evidence() @@ -43,7 +44,9 @@ def test_release_archive_contains_only_current_user_documents() -> None: for line in manifest if line.startswith("include docs/") } - assert included_docs == gate.RELEASE_DOCS | {"docs/NATIVE_SOURCE_AUTHORITY.md"} + assert included_docs == gate.RELEASE_DOCS | { + "docs/NATIVE_SOURCE_AUTHORITY.md", "docs/releases/ANYfeSolver_0.5.0.md" + } assert { "prune docs", "prune reports", @@ -69,13 +72,13 @@ def test_strict_json_rejects_malformed_evidence(tmp_path: Path, payload: str, me def test_publish_workflow_uses_bounded_gate_before_upload() -> None: workflow = (ROOT / ".github/workflows/publish.yml").read_text(encoding="utf-8") - command = "python scripts/verify_release_047.py" - upload = "name: python-package-distributions" + command = "python scripts/verify_release_050.py" + upload = "name: release-050-distributions" assert workflow.count(command) == 1 assert workflow.index(command) < workflow.index(upload) - assert "--wheel dist/anysolver-0.4.7-py3-none-any.whl" in workflow - assert "--sdist dist/anysolver-0.4.7.tar.gz" in workflow - assert "--expected-commit ${{ github.sha }}" in workflow + assert "--solver-wheel dist/solver/anyfesolver-${SOLVER_VERSION}-py3-none-any.whl" in workflow + assert "--solver-sdist dist/solver/anyfesolver-${SOLVER_VERSION}.tar.gz" in workflow + assert '--expected-commit "$EXPECTED_SHA"' in workflow def test_full_ci_can_be_dispatched_for_a_release_branch() -> None: diff --git a/tests/test_release_050.py b/tests/test_release_050.py new file mode 100644 index 000000000..c6a0baba6 --- /dev/null +++ b/tests/test_release_050.py @@ -0,0 +1,252 @@ +"""Focused static tests for the ANYfeSolver 0.5.0 / results 2.2.0 packaging. + +These tests read configuration only. They do not build, install or publish; +the full artifact gate is scripts/verify_release_050.py. +""" + +from __future__ import annotations + +import importlib.util +import io +import json +from pathlib import Path +import re +import tarfile +import tomllib + +import pytest + + +ROOT = Path(__file__).resolve().parents[1] + + +def _load(name: str, relative: str): + spec = importlib.util.spec_from_file_location(name, ROOT / relative) + assert spec is not None and spec.loader is not None + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +@pytest.fixture(scope="module") +def gate(): + return _load("_verify_release_050", "scripts/verify_release_050.py") + + +def _project(relative: str) -> dict: + with (ROOT / relative).open("rb") as stream: + return tomllib.load(stream) + + +def test_identities_and_dependency_bands(gate) -> None: + solver = _project("pyproject.toml")["project"] + results = _project("packages/results/pyproject.toml")["project"] + assert (solver["name"], solver["version"]) == ("ANYfeSolver", "0.5.0") + assert (results["name"], results["version"]) == ("ANYfeSolver-results", "2.2.0") + bands = dict(gate._split_requirement(item) for item in solver["dependencies"]) + assert bands == gate.EXPECTED_SOLVER_REQUIRES + assert bands["anyfesolver-results"] == frozenset({">=2.2", "<3"}) + assert results["dependencies"] == ["numpy>=2.0"] + assert "ANYsolver-results" not in json.dumps(solver) + + +def test_source_layout_has_no_old_import_trees() -> None: + assert (ROOT / "src" / "anyfesolver" / "__init__.py").is_file() + assert (ROOT / "packages" / "results" / "src" / "anyfesolver_results" / "__init__.py").is_file() + assert not (ROOT / "src" / "anysolver").exists() + assert not (ROOT / "src" / "anysolver_results").exists() + assert not (ROOT / "packages" / "results" / "src" / "anysolver_results").exists() + + +def test_setuptools_and_pytest_configuration() -> None: + solver = _project("pyproject.toml") + tool = solver["tool"] + assert tool["setuptools"]["package-dir"] == {"": "src"} + assert tool["setuptools"]["packages"]["find"]["include"] == ["anyfesolver", "anyfesolver.*"] + assert tool["setuptools"]["package-data"] == {"anyfesolver": ["_native_guard.cpp"]} + assert tool["pytest"]["ini_options"]["pythonpath"] == ["src", "packages/results/src"] + results = _project("packages/results/pyproject.toml")["tool"]["setuptools"] + assert results["package-dir"] == {"": "src"} + assert results["packages"]["find"]["where"] == ["src"] + assert results["packages"]["find"]["include"] == ["anyfesolver_results", "anyfesolver_results.*"] + setup = (ROOT / "setup.py").read_text(encoding="utf-8") + assert "src/anyfesolver/_native_guard.cpp" in setup + assert "anyfesolver._native_guard" in setup + assert "anysolver._native_guard" not in setup + + +def _setup_namespace(monkeypatch) -> dict: + """Execute setup.py without invoking setuptools.setup().""" + source = (ROOT / "setup.py").read_text(encoding="utf-8") + assert source.rstrip().endswith("setup(ext_modules=extensions)") + source = source.rstrip()[: -len("setup(ext_modules=extensions)")] + monkeypatch.chdir(ROOT) + namespace: dict = {"__name__": "setup_under_test"} + exec(compile(source, "setup.py", "exec"), namespace) + return namespace + + +def test_native_guard_macro_and_environment_names(monkeypatch) -> None: + cpp = (ROOT / "src" / "anyfesolver" / "_native_guard.cpp").read_text(encoding="utf-8") + setup = (ROOT / "setup.py").read_text(encoding="utf-8") + # The unchanged C++ reads the old macro name; setup.py must define exactly that one. + assert "#ifndef ANYSOLVER_GUARD_SOURCE_SHA" in cpp + assert "'ANYSOLVER_GUARD_SOURCE_SHA'" in setup + assert "ANYFESOLVER_GUARD_SOURCE_SHA" not in setup + enabled = _setup_namespace(monkeypatch)["native_guard_enabled"] + assert enabled({}) is True + assert enabled({"ANYFESOLVER_BUILD_NATIVE_GUARD": "0"}) is False + assert enabled({"ANYFESOLVER_BUILD_NATIVE_GUARD": "1"}) is True + assert enabled({"ANYSOLVER_BUILD_NATIVE_GUARD": "0"}) is False # old name honoured when new is absent + assert enabled({"ANYSOLVER_BUILD_NATIVE_GUARD": "1"}) is True + # The new name wins when both are present. + assert enabled({"ANYFESOLVER_BUILD_NATIVE_GUARD": "1", "ANYSOLVER_BUILD_NATIVE_GUARD": "0"}) is True + assert enabled({"ANYFESOLVER_BUILD_NATIVE_GUARD": "0", "ANYSOLVER_BUILD_NATIVE_GUARD": "1"}) is False + + +def test_project_urls_use_the_renamed_repository() -> None: + for relative in ("pyproject.toml", "packages/results/pyproject.toml"): + urls = _project(relative)["project"]["urls"] + assert urls + for value in urls.values(): + assert value.startswith("https://github.com/audunarn/ANYfeSolver"), value + assert "ANYsolver" not in value + + +def test_index_plan_fails_closed_on_conflicts(gate, tmp_path: Path) -> None: + from hashlib import sha256 + + dist = tmp_path / "dist" + dist.mkdir() + (dist / "a.whl").write_bytes(b"A") + (dist / "a.tar.gz").write_bytes(b"B") + digest = {n: sha256((dist / n).read_bytes()).hexdigest() for n in ("a.whl", "a.tar.gz")} + missing = tmp_path / "missing" + plan = gate.plan_upload({"a.whl": digest["a.whl"]}, dist, missing) + assert plan["missing"] == ["a.tar.gz"] + assert [p.name for p in missing.iterdir()] == ["a.tar.gz"] + assert gate.plan_upload(digest, dist, None)["missing"] == [] + with pytest.raises(gate.GateError): + gate.plan_upload({**digest, "a.whl": "0" * 64}, dist, None) + with pytest.raises(gate.GateError): + gate.plan_upload({**digest, "other.whl": "1" * 64}, dist, None) + + +def test_license_files_and_inventory_agree() -> None: + for relative in ("pyproject.toml", "packages/results/pyproject.toml"): + project = _project(relative)["project"] + assert project["license"] == "MPL-2.0" + assert set(project["license-files"]) == {"LICENSE", "COPYRIGHT", "THIRD_PARTY_NOTICES.md"} + base = Path(relative).parent + for notice in project["license-files"]: + assert (ROOT / base / notice).is_file(), (base, notice) + solver = _project("pyproject.toml")["project"] + inventory = json.loads((ROOT / "dependency-licenses.json").read_text(encoding="utf-8")) + assert (inventory["project"], inventory["release"]) == ("ANYfeSolver", "0.5.0") + recorded = {item["requirement"] for item in inventory["dependencies"]} + declared = set(solver["dependencies"]) + for group in solver["optional-dependencies"].values(): + declared.update(group) + assert declared == recorded + + +def test_manifest_ships_native_source_and_release_note() -> None: + manifest = (ROOT / "MANIFEST.in").read_text(encoding="utf-8").splitlines() + assert "include src/anyfesolver/_native_guard.cpp" in manifest + assert "include docs/releases/ANYfeSolver_0.5.0.md" in manifest + assert "prune packages" in manifest + assert "src/anysolver/" not in "\n".join(manifest) + assert (ROOT / "docs" / "releases" / "ANYfeSolver_0.5.0.md").is_file() + + +def test_historical_verifier_is_loadable_and_still_0_4_7() -> None: + historical = _load("_historical_047", "scripts/verify_release_047.py") + assert historical.VERSION == "0.4.7" + gate = _load("_gate_for_terminal", "scripts/verify_release_050.py") + assert gate.TERMINAL != historical.TERMINAL + assert "0_4_7" not in gate.TERMINAL + + +def test_runtime_comparison_detects_drift(gate) -> None: + source = {"anyfesolver/a.py": b"x = 1\n"} + gate._same_runtime(dict(source), source, "ok") + with pytest.raises(gate.GateError): + gate._same_runtime({"anyfesolver/a.py": b"x = 2\n"}, source, "changed") + with pytest.raises(gate.GateError): + gate._same_runtime({**source, "anyfesolver/b.py": b""}, source, "extra") + # A host-specific extension may be present without being in the source tree. + gate._same_runtime({**source, "anyfesolver/_native_guard.pyd": b"\0"}, source, "binary") + + +def test_sdist_extraction_refuses_traversal(gate, tmp_path: Path) -> None: + archive = tmp_path / "evil.tar.gz" + with tarfile.open(archive, "w:gz") as handle: + info = tarfile.TarInfo("pkg-1/../../escape.txt") + payload = b"no" + info.size = len(payload) + handle.addfile(info, io.BytesIO(payload)) + with pytest.raises(gate.GateError): + gate._extract(archive, tmp_path / "out") + assert not (tmp_path / "escape.txt").exists() + + +def test_publish_workflow_policy() -> None: + raw = (ROOT / ".github" / "workflows" / "publish.yml").read_text(encoding="utf-8") + # Judge executable YAML only: comment lines may mention forbidden words. + text = "\n".join(line for line in raw.splitlines() if not line.lstrip().startswith("#")) + assert re.search(r"^on:\s*$", text, re.M) + assert not re.search(r"^\s*pull_request(_target)?\s*:", text, re.M) + for action in re.findall(r"uses:\s*([^\s]+)", text): + assert re.fullmatch(r"[\w./-]+@[0-9a-f]{40}", action), action + assert "verify_release_050.py" in text and "verify_release_047" not in text + assert "ci.yml/runs?head_sha=" in text + assert text.index("Publish missing ANYfeSolver-results files to TestPyPI") < text.index( + "Publish missing ANYfeSolver files to TestPyPI") + assert text.index("Publish missing ANYfeSolver-results files to PyPI") < text.index( + "Publish missing ANYfeSolver files to PyPI") + def job(name: str, following: str | None) -> str: + start = text.index(f"\n {name}:") + return text[start:text.index(f"\n {following}:", start)] if following else text[start:] + + build, testpypi = job("build", "testpypi"), job("testpypi", "stage") + stage, pypi = job("stage", "pypi"), job("pypi", None) + # Staging: dispatch only. Promotion: release only, never a rebuild. + assert "if: github.event_name == 'workflow_dispatch'" in build + assert "if: github.event_name == 'workflow_dispatch'" in testpypi + assert "if: github.event_name == 'release'" in stage and "if: github.event_name == 'release'" in pypi + assert text.count("if: github.event_name == 'release'") == 2 + assert "needs: [validate, license-gate, dependency-gate, stage]" in pypi + for promotion in (stage, pypi): + assert "python -m build" not in promotion and "setup-python" not in promotion + assert "build" not in re.search(r"needs:\s*\[[^\]]*\]", promotion).group(0) + # No second-build equality gate: sdists are not byte-reproducible. + assert "SOURCE_DATE_EPOCH" not in text and "repro/" not in text and "reproducible" not in text + # Promotion retrieves exactly one trusted dispatch artifact by run id, in this repository. + assert text.count("run-id:") == 1 and text.count("github-token:") == 1 + assert "run-id:" in stage and "actions: read" in stage + for requirement in ('workflows/publish.yml"', 'run["event"] == "workflow_dispatch"', + 'run["conclusion"] == "success"', 'run["head_sha"] == sha', + 'run["head_branch"] == tag', "pull_requests", '"fork"', "repo_id", + 'artifact["expired"]', "exactly one release-050-distributions", + "manifest commit mismatch", "stage first", "stage again"): + assert requirement in stage, requirement + assert "release-050-promoted" in stage and "release-050-promoted" in pypi + assert "release-050-distributions" not in pypi + assert "retention-days: 30" in build + assert "sha256sum -c" in testpypi and "sha256sum -c" in stage and "sha256sum -c" in pypi + assert text.count("sha256sum -c") == 3 + # PyPI promotion still needs TestPyPI to serve identical digests (no sleep loop beyond 5 tries). + assert "--index https://test.pypi.org" in pypi and "--require-complete" in pypi + loops = re.findall(r"for attempt in ([\d ]+);", text) + assert loops and all(loop == "1 2 3 4 5" for loop in loops) + # A published file is never overwritten or skipped by name, and no other repository is read. + for forbidden in ("skip-existing", "skip_existing", "repository:"): + assert forbidden not in text, forbidden + # Uploads are always the planned missing files, never the full dist directories. + assert "packages-dir: stage/" not in text + assert text.count("packages-dir: plan/") == 4 + assert text.count("index-plan") >= 8 + # Separate protected environments; dispatch has no production input. + assert "name: testpypi" in testpypi and "name: pypi" in pypi + assert "environment:" not in stage and "id-token" not in stage + assert "inputs:" not in text diff --git a/tests/test_static_contact_candidate_tools.py b/tests/test_static_contact_candidate_tools.py index 6d2f106cb..0c15a8496 100644 --- a/tests/test_static_contact_candidate_tools.py +++ b/tests/test_static_contact_candidate_tools.py @@ -17,15 +17,24 @@ from scripts import check_static_contact_candidate as check ROOT = Path(__file__).resolve().parents[1] -CONFIG = json.loads((ROOT / "scripts" / "contact_candidate_slice2.json") - .read_text(encoding="utf-8")) +CONFIG_FILE = ROOT / "scripts" / "contact_candidate_050.json" +CONFIG = json.loads(CONFIG_FILE.read_text(encoding="utf-8")) + + +def test_tools_load_the_050_successor_config() -> None: + assert build.CONFIG_PATH == CONFIG_FILE + assert check.CONFIG_PATH == CONFIG_FILE def test_config_recipe_is_complete_and_matches_the_checkout() -> None: - assert CONFIG["candidate_version"] == "0.4.7+contact.candidate.20261020.s7" - assert CONFIG["private_versions"]["ANYsolver"] == CONFIG["candidate_version"] - assert CONFIG["wheel_files"]["ANYsolver"] == ( - "anysolver-" + CONFIG["candidate_version"] + "-py3-none-any.whl") + assert CONFIG["candidate_version"] == "0.5.0+contact.candidate.20261111.s7" + assert CONFIG["repo_version"] == "0.5.0" + assert CONFIG["private_versions"]["anyfesolver-results"] == "2.2.0" + assert CONFIG["wheel_files"]["anyfesolver-results"] == ( + "anyfesolver_results-2.2.0-py3-none-any.whl") + assert CONFIG["private_versions"]["ANYfeSolver"] == CONFIG["candidate_version"] + assert CONFIG["wheel_files"]["ANYfeSolver"] == ( + "anyfesolver-" + CONFIG["candidate_version"] + "-py3-none-any.whl") assert len(CONFIG["base_selectors"]) == 26 assert "elastic_sphere_panel_contact_skins" in CONFIG["bundle_examples"] assert CONFIG["example_commands"]["contact-skins"] == [ @@ -68,6 +77,39 @@ def test_config_recipe_is_complete_and_matches_the_checkout() -> None: assert CONFIG["private_versions"][package] in filename +IDENTITY_KEYS = {"status", "note", "predecessor", "candidate_version", + "repo_version", "private_versions", "wheel_files"} +PREDECESSOR_FILE = ROOT / "scripts" / "contact_candidate_slice2.json" + + +def test_successor_numerical_fields_equal_the_frozen_predecessor() -> None: + predecessor = json.loads(PREDECESSOR_FILE.read_text(encoding="utf-8")) + # The predecessor keeps every historical identity and scope. + assert predecessor["candidate_version"] == "0.4.7+contact.candidate.20261020.s7" + assert predecessor["repo_version"] == "0.4.7" + assert predecessor["private_versions"]["anysolver-results"] == "2.1.1" + assert CONFIG["predecessor"]["config"] == "scripts/contact_candidate_slice2.json" + assert CONFIG["predecessor"]["candidate_version"] == predecessor["candidate_version"] + assert CONFIG["predecessor"]["authority_renewed"] is False + assert CONFIG["predecessor"]["numerical_run_made"] is False + # Same key set; every non-identity field (pins, selectors, batches, stages, + # nodes, examples, caps, cross-host files/quantities/exact/bound, scales, + # sibling dirs and refs) is exactly equal. + assert set(CONFIG) - {"predecessor"} == set(predecessor) + for key in sorted(set(predecessor) - IDENTITY_KEYS): + assert CONFIG[key] == predecessor[key], key + # Identity differs exactly where intended. + assert CONFIG["candidate_version"] != predecessor["candidate_version"] + assert CONFIG["timeouts"] == dict(case_seconds=120, + host_numerical_seconds=600, + rss_limit_mib=953) + # Third-party private wheels keep the predecessor's versions and files. + for package in ("ANYmaterial", "ANYgeometry", "ANYmesher", "ANYfileio"): + assert CONFIG["private_versions"][package] == \ + predecessor["private_versions"][package] + assert CONFIG["wheel_files"][package] == predecessor["wheel_files"][package] + + def test_solver_staging_changes_only_the_version_string(tmp_path: Path) -> None: stage = tmp_path / "stage" identity = build.stage_solver(ROOT, stage, CONFIG["candidate_version"]) @@ -79,7 +121,7 @@ def test_solver_staging_changes_only_the_version_string(tmp_path: Path) -> None: assert identity["repo_version_unchanged"] and identity["version_change_only"] assert identity["staged_file_count"] > 100 assert len(identity["staged_source_digest"]) == 64 - assert (stage / "src" / "anysolver" / "general_contact").is_dir() + assert (stage / "src" / "anyfesolver" / "general_contact").is_dir() assert not list(stage.rglob("__pycache__")) @@ -224,8 +266,7 @@ def fake_bundle(tmp_path: Path) -> Path: manifest = dict(status="BUILT", wheels=sorted(wheels, key=lambda w: w["package"]), config_sha256=hashlib.sha256( - (ROOT / "scripts" / "contact_candidate_slice2.json") - .read_bytes()).hexdigest()) + CONFIG_FILE.read_bytes()).hexdigest()) (bundle / "manifest.json").write_text(json.dumps(manifest), encoding="utf-8") return bundle @@ -233,9 +274,10 @@ def fake_bundle(tmp_path: Path) -> Path: def test_verify_manifest_rejects_corrupted_or_incomplete_bundles(tmp_path: Path) -> None: bundle = fake_bundle(tmp_path) assert check.verify_manifest(bundle, CONFIG)["status"] == "BUILT" - (bundle / "wheelhouse" / CONFIG["wheel_files"]["ANYsolver"]).write_bytes(b"corrupt") + (bundle / "wheelhouse" / CONFIG["wheel_files"]["ANYfeSolver"]).write_bytes(b"corrupt") with pytest.raises(SystemExit, match="digest mismatch"): check.verify_manifest(bundle, CONFIG) + bundle = fake_bundle(tmp_path / "missing-wheel") (bundle / "wheelhouse" / CONFIG["wheel_files"]["ANYmesher"]).unlink() with pytest.raises(SystemExit, match="manifest wheel missing"): check.verify_manifest(bundle, CONFIG) From 2ebd6b3445a703b2e725e4ffbb2038542eac08e4 Mon Sep 17 00:00:00 2001 From: Audun Arnesen Nyhus Date: Wed, 11 Nov 2026 21:04:59 +0100 Subject: [PATCH 04/15] Pin ordinary solver CI to the tested SESAM reader --- .github/workflows/ci.yml | 2 +- tests/test_anyfileio_version_compatibility.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 047e1c701..4e83aa936 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -106,7 +106,7 @@ jobs: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 with: repository: audunarn/ANYfileIO - ref: 32f3bb65e3843d6fd7af6c4fdf76ce472a7f6555 + ref: 24072503398f5774e0b42e25c74443d1ed3413df path: .ecosystem/ANYfileIO persist-credentials: false - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 diff --git a/tests/test_anyfileio_version_compatibility.py b/tests/test_anyfileio_version_compatibility.py index 6bfd5e15f..30673b5e6 100644 --- a/tests/test_anyfileio_version_compatibility.py +++ b/tests/test_anyfileio_version_compatibility.py @@ -415,7 +415,7 @@ def test_workflows_pin_compatibility_graph_and_actions() -> None: "db73950018e1c87dab0ca618c25c965030ba08ce", "ebbe0e3b500a3f0cfcc62059c3dac4b0ac178b6c", "b6f7cf466865b1c4c34b8e5511ace97d00290f6c", - "32f3bb65e3843d6fd7af6c4fdf76ce472a7f6555", + "24072503398f5774e0b42e25c74443d1ed3413df", "06f3276d9207376316502aca651c3455db984104", } assert set(re.findall(r"\b[0-9a-f]{40}\b", publish)) == { @@ -582,7 +582,7 @@ def action_sequence(block: str) -> list[str]: current_checkouts[0], ("audunarn/ANYgeometry", "ebbe0e3b500a3f0cfcc62059c3dac4b0ac178b6c", ".ecosystem/ANYgeometry"), ("audunarn/ANYmesh", "b6f7cf466865b1c4c34b8e5511ace97d00290f6c", ".ecosystem/ANYmesh"), - ("audunarn/ANYfileIO", "32f3bb65e3843d6fd7af6c4fdf76ce472a7f6555", ".ecosystem/ANYfileIO"), + ("audunarn/ANYfileIO", "24072503398f5774e0b42e25c74443d1ed3413df", ".ecosystem/ANYfileIO"), ] assert checkout_pattern.findall(job_block(ci, "pytest")) == development_checkouts for name in ("wheel", "numba", "pardiso"): From b2b87fd01bf7e1e532e95c5318230ae88f720c6a Mon Sep 17 00:00:00 2001 From: Audun Arnesen Nyhus Date: Wed, 11 Nov 2026 21:19:59 +0100 Subject: [PATCH 05/15] Repair portable contact and historical audit checks on the renamed checkout --- .gitattributes | 1 + scripts/audit_beam_parity_matrix.py | 10 +-- scripts/d1_radial_scalar_trace.py | 82 +++++++++++++++++++ .../general_contact_d1_interior_press_dev.py | 2 +- ...eneral_contact_d1_development_recording.py | 14 +++- ...est_general_contact_radial_scalar_trace.py | 2 +- tests/test_prepared_static_response_m25.py | 30 ++++--- 7 files changed, 123 insertions(+), 18 deletions(-) create mode 100644 scripts/d1_radial_scalar_trace.py diff --git a/.gitattributes b/.gitattributes index ea3959360..4b2394dd8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1070,3 +1070,4 @@ src/anyfesolver/fe_core.py -text whitespace=blank-at-eol,-blank-at-eof,space-bef # One exact candidate configuration is shared by both host checkouts. scripts/contact_candidate_slice2.json text eol=lf /tests/data/namespace_migration/*.json -text +/scripts/contact_candidate_050.json text eol=lf diff --git a/scripts/audit_beam_parity_matrix.py b/scripts/audit_beam_parity_matrix.py index 5dbaa47d6..85aa54574 100644 --- a/scripts/audit_beam_parity_matrix.py +++ b/scripts/audit_beam_parity_matrix.py @@ -36,9 +36,9 @@ 'compute_stresses': ['P19', 'U05'], 'compute_internal_forces': ['U07'], 'to_dict': ['P18', 'U09'], } -EXTRA = ['src/anyfesolver/ge_beam3_element.py', 'src/anyfesolver/ge_beam3_native.py', - 'src/anyfesolver/_ge_beam3_native_analysis.py', - 'src/anyfesolver/_ge_beam3_durable_coupled.py', +EXTRA = ['src/anysolver/ge_beam3_element.py', 'src/anysolver/ge_beam3_native.py', + 'src/anysolver/_ge_beam3_native_analysis.py', + 'src/anysolver/_ge_beam3_durable_coupled.py', 'docs/GE_BEAM3_NATIVE_WORKFLOWS.md', 'docs/GE_BEAM3_DELIVERY_STATUS.md', 'docs/reference_cases/ge_beam3_final_delivery_independent_review.json'] @@ -125,7 +125,7 @@ def build_inventory(data): for ref in refs: if ref.startswith(path+'::') and ref.split('::')[1] not in definitions(raw): raise ValueError('missing test definition: '+ref) - elements = ast.parse(git('show', BASE+':src/anyfesolver/elements.py')) + elements = ast.parse(git('show', BASE+':src/anysolver/elements.py')) public = {} for node in elements.body: if isinstance(node, ast.ClassDef) and node.name in {'Element', 'BeamElement', 'QuadraticBeamElement'}: @@ -151,7 +151,7 @@ def build_inventory(data): def render(data, inventory): lines = ['# GE-B3 legacy parity matrix — frozen step 1', '', - 'Baseline: ANYfeSolver 0.4.3, commit `'+BASE+'`, tree `'+TREE+'`.', '', + 'Baseline: ANYsolver 0.4.3, commit `'+BASE+'`, tree `'+TREE+'`.', '', 'Status: **planning inventory frozen; no new mechanics qualification**. ' 'This step changes no runtime, default, dependency, source equation or historical evidence. ' 'No scientific test was executed. Test links identify source definitions, not fresh passes.', '', diff --git a/scripts/d1_radial_scalar_trace.py b/scripts/d1_radial_scalar_trace.py new file mode 100644 index 000000000..caf2644e8 --- /dev/null +++ b/scripts/d1_radial_scalar_trace.py @@ -0,0 +1,82 @@ +"""Disposable scalar observers for the development radial contact-path runner. + +The public contact-path API has no live observer. These wrappers delegate the +unchanged functions, record scalar cost/branch data, and restore bindings even +when the solve throws. They cannot advance or commit solver state. +""" +from contextlib import contextmanager +from functools import wraps +import json +from pathlib import Path +import time + +import numpy as np + + +@contextmanager +def radial_solver_trace(path): + from anyfesolver.general_contact import semismooth_path as driver + from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager + import anyfesolver + path = Path(path) + originals, counts = [], {} + started = time.perf_counter() + with path.open('x', encoding='utf-8') as stream: + def emit(event, **values): + stream.write(json.dumps(dict(event=event, + elapsed_seconds=time.perf_counter()-started, **values))+'\n') + stream.flush() + + def hook(owner, name, phase): + original = getattr(owner, name) + @wraps(original) + def observed(*args, **kwargs): + counts[phase] = counts.get(phase, 0)+1 + call = counts[phase] + details = {} + if phase == 'contact': + z = np.asarray(args[2]) + details = dict(positive_force_modes=int(np.count_nonzero(z > 0.)), + total_nodal_force_n=float(np.sum(z)), tangent=kwargs.get('tangent', True)) + elif phase == 'structural': + details = dict(tangent=kwargs.get('tangent', True)) + elif phase == 'factorization': + details = dict(shape=list(args[0].shape), nnz=getattr(args[0], 'nnz', None)) + emit(phase+'_begin', call=call, **details) + before = time.perf_counter() + try: + value = original(*args, **kwargs) + except BaseException as exc: + emit(phase+'_exception', call=call, + seconds=time.perf_counter()-before, reason=type(exc).__name__+': '+str(exc)) + raise + if phase == 'swept': + details = dict(admissible=bool(value)) + elif phase == 'contact': + details = dict(contact_residual_norm_n=float(np.linalg.norm(value.force)), + minimum_normalized_gap_m=float(np.min(value.state.normalized_gap)), + candidate_evaluations=int(value.evaluations)) + elif phase == 'complementarity': + details = dict(complementarity_l1_n=float(np.sum(abs(value[0]))), + active_modes=int(np.count_nonzero(value[1]))) + else: + details = {} + emit(phase+'_end', call=call, seconds=time.perf_counter()-before, **details) + return value + originals.append((owner, name, original)) + setattr(owner, name, observed) + + try: + emit('trace_begin', imported_source=anyfesolver.__file__, + scope='development observer only; no state or numerical setting changes') + hook(GeneralS3PatchManager, '__init__', 'preparation') + hook(GeneralS3PatchManager, '_swept_admissible', 'swept') + hook(driver, '_assemble_nonlinear_system', 'structural') + hook(driver, 'linearize', 'contact') + hook(driver, 'complementarity', 'complementarity') + hook(driver, 'factorize', 'factorization') + yield + finally: + for owner, name, original in reversed(originals): + setattr(owner, name, original) + emit('trace_end', calls=counts) diff --git a/scripts/general_contact_d1_interior_press_dev.py b/scripts/general_contact_d1_interior_press_dev.py index 8ac47fdc8..2a01889e0 100644 --- a/scripts/general_contact_d1_interior_press_dev.py +++ b/scripts/general_contact_d1_interior_press_dev.py @@ -1121,7 +1121,7 @@ def radial_solve(output: Path, *, target_cells=4, target_right_x_m=1.3): for path in (Path(anyfesolver.__file__).parent / "general_contact").glob("*.py")}, runner_sha256=hashlib.sha256(Path(__file__).read_bytes()).hexdigest()) try: - from docs.d1_review_support.d1_radial_scalar_trace import radial_solver_trace + from scripts.d1_radial_scalar_trace import radial_solver_trace trace_path = output.with_suffix('.trace.jsonl') record['scalar_trace'] = str(trace_path) with radial_solver_trace(trace_path): diff --git a/tests/test_general_contact_d1_development_recording.py b/tests/test_general_contact_d1_development_recording.py index 3d69b66b2..47000776e 100644 --- a/tests/test_general_contact_d1_development_recording.py +++ b/tests/test_general_contact_d1_development_recording.py @@ -1,6 +1,8 @@ """A stopped development run must retain its mechanical non-success.""" +import hashlib import json +from pathlib import Path from types import SimpleNamespace import numpy as np @@ -96,6 +98,9 @@ def _fake_radial_fixture(monkeypatch): def test_radial_solver_exception_retains_input_identity(tmp_path, monkeypatch): + import anyfesolver + from anyfesolver.general_contact import semismooth_path + _fake_radial_fixture(monkeypatch) def fail(*args, **kwargs): raise ValueError("injected geometry failure") @@ -105,8 +110,15 @@ def fail(*args, **kwargs): runner.radial_solve(output) record = json.loads(output.read_text()) assert record["status"] == "solver_exception" - assert record["changed_kernel_sha256"]["semismooth_path.py"] + assert record["failure_reason"] == "ValueError: injected geometry failure" + assert record["anyfesolver_module"] == str(Path(anyfesolver.__file__).resolve()) + assert record["changed_kernel_sha256"]["semismooth_path.py"] == hashlib.sha256( + Path(semismooth_path.__file__).read_bytes()).hexdigest() + assert record["runner_sha256"] == hashlib.sha256(Path(runner.__file__).read_bytes()).hexdigest() assert record["restart_checkpoint"] is None + trace = [json.loads(line) for line in Path(record["scalar_trace"]).read_text().splitlines()] + assert [row["event"] for row in trace] == ["trace_begin", "trace_end"] + assert Path(trace[0]["imported_source"]).resolve() == Path(anyfesolver.__file__).resolve() def test_radial_postprocessing_failure_retains_mechanical_result(tmp_path, monkeypatch): diff --git a/tests/test_general_contact_radial_scalar_trace.py b/tests/test_general_contact_radial_scalar_trace.py index 00b5ec593..e19207b3f 100644 --- a/tests/test_general_contact_radial_scalar_trace.py +++ b/tests/test_general_contact_radial_scalar_trace.py @@ -5,7 +5,7 @@ import pytest from anyfesolver.general_contact import semismooth_path as driver from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager -from docs.d1_review_support.d1_radial_scalar_trace import radial_solver_trace +from scripts.d1_radial_scalar_trace import radial_solver_trace def test_scalar_trace_preserves_values_inputs_and_restores_after_exception(tmp_path): diff --git a/tests/test_prepared_static_response_m25.py b/tests/test_prepared_static_response_m25.py index 8f0881477..ed3a8852b 100644 --- a/tests/test_prepared_static_response_m25.py +++ b/tests/test_prepared_static_response_m25.py @@ -184,9 +184,7 @@ def _clone_from_traceback(excinfo): return None -@pytest.mark.parametrize('kind', ['q4_staged', 'q4_warped', 's3', 'q4_pressure', 's3_pressure']) -def test_trusted_capture_runs_warmups_on_native_trusted_path(kind): - model, element, options, staged = _case(kind) +def _capture_with_guard_counts(model, element, **options): # Original-input policy admission precedes the private clone/trusted span, # and final policy revalidation follows it. Account for both real guard # costs separately; every clone warm-up guard is still counted. This does @@ -216,6 +214,13 @@ def observe(frame, event, _arg): assert sys.getprofile() is previous_profile assert policy_depth == 0 assert policy_calls == 2 * int(type(element) is Q4 and options.get('warm_stress', True)) + return recipe, counts, policy_counts + + +@pytest.mark.parametrize('kind', ['q4_staged', 'q4_warped', 's3', 'q4_pressure', 's3_pressure']) +def test_trusted_capture_runs_warmups_on_native_trusted_path(kind): + model, element, options, staged = _case(kind) + recipe, counts, policy_counts = _capture_with_guard_counts(model, element, **options) if kind == 'q4_staged': assert _calls(policy_counts, 'post_observation_guard') > 0 assert _calls(counts, 'post_observation_guard') == 0, counts @@ -562,20 +567,25 @@ def test_error_inside_capture_span_matches_guarded_route_and_revokes(kind): with pytest.raises(ValueError) as trusted_error: _capture_owned_local_recovery(model, element) clone = _clone_from_traceback(trusted_error) - assert clone is not None and not _accepts(clone) # the failed clone's lease was revoked + if kind == 'q4_staged': + # Original-input Q4 policy rejects collapsed diagonals before cloning. + assert clone is None and 'diagonals are degenerate' in str(trusted_error.value) + else: + assert clone is not None and not _accepts(clone) with _foreign_error_handler(): with pytest.raises(ValueError) as guarded_error: _capture_owned_local_recovery(model, element) assert (type(trusted_error.value), str(trusted_error.value)) == (type(guarded_error.value), str(guarded_error.value)) finally: third.x, third.y, third.z = saved - _recipe, counts = _profiled(lambda: _capture_owned_local_recovery(model, element)) + _recipe, counts, _policy_counts = _capture_with_guard_counts(model, element) assert _calls(counts, 'trusted_post_observation_guard') > 0 and _calls(counts, 'post_observation_guard') == 0 @pytest.mark.parametrize('kind', ['q4_staged', 'q4_warped', 's3']) -def test_cancellation_inside_capture_span_propagates_and_revokes(kind): - """A cancellation raised inside the span (injected at the stage compile) propagates +@pytest.mark.parametrize('failure', [SolveCancelled, ValueError]) +def test_cancellation_inside_capture_span_propagates_and_revokes(kind, failure): + """An exception raised inside the span (injected at the stage compile) propagates unchanged, the clone's lease is revoked, and a later capture is trusted again.""" model, element, _options, _staged = _case(kind) previous = sys.gettrace() @@ -586,19 +596,19 @@ def tracer(frame, event, arg): caller = frame.f_back owned = caller.f_locals.get('owned_element') if caller is not None else None inside.append(owned is not None and _accepts(owned)) - raise SolveCancelled('injected cancellation') + raise failure('injected capture failure') return None sys.settrace(tracer) try: - with pytest.raises(SolveCancelled, match='injected cancellation') as cancelled: + with pytest.raises(failure, match='injected capture failure') as cancelled: _capture_owned_local_recovery(model, element) finally: sys.settrace(previous) assert inside == [True] # the cancellation was raised inside the trusted span clone = _clone_from_traceback(cancelled) assert clone is not None and not _accepts(clone) - _recipe, counts = _profiled(lambda: _capture_owned_local_recovery(model, element)) + _recipe, counts, _policy_counts = _capture_with_guard_counts(model, element) assert _calls(counts, 'trusted_post_observation_guard') > 0 and _calls(counts, 'post_observation_guard') == 0 From fe84f718c38ebc4e13b672f8d09dc0fd58b18fd0 Mon Sep 17 00:00:00 2001 From: Audun Arnesen Nyhus Date: Wed, 11 Nov 2026 21:37:12 +0100 Subject: [PATCH 06/15] Authenticate relocated matched238 inputs against the original binding --- .../general_contact_enriched_reference_run.py | 90 +++++++++++++------ ...test_general_contact_enriched_reference.py | 20 ++++- 2 files changed, 84 insertions(+), 26 deletions(-) diff --git a/scripts/general_contact_enriched_reference_run.py b/scripts/general_contact_enriched_reference_run.py index 840687b1b..ed4b41b30 100644 --- a/scripts/general_contact_enriched_reference_run.py +++ b/scripts/general_contact_enriched_reference_run.py @@ -2,10 +2,12 @@ from __future__ import annotations import hashlib import json -from pathlib import Path +from pathlib import Path, PureWindowsPath W = Path('C:/ANYworkspaceWork/contact_trackB_dependency_repair_20261013/d1-polynomial-reference-work-v15') REPO = Path('C:/Github/ANYfeSolver/.worktrees/contact-portable-replay') +V15_SOURCE_ROOT = PureWindowsPath('C:/Github/ANYsolver/.worktrees/contact-portable-replay') +V15_BINDING_SHA256 = 'aa1be2f9dab42ccdf08d9ffd4864aad27a311933015924da19516f19e363dd85' OWNED_EXISTING = ('scripts/general_contact_enriched_reference.py', 'scripts/general_contact_enriched_reference_geometry.py', 'scripts/general_contact_enriched_reference_bounds.py', @@ -17,25 +19,53 @@ def sha(path): return hashlib.sha256(Path(path).read_bytes()).hexdigest() -def verify_binding(binding): +def _mapped_paths(rows, expected, directory): + """Locate historical files by logical name and authenticate their original bytes.""" from scripts.general_contact_enriched_reference_geometry import require - for path, digest in binding['files'].items(): - require(sha(path) == digest, 'exact source/input/producer binding: '+path) - baseline = json.loads(Path(binding['source_before']).read_bytes()) - fresh = {str(Path(p).resolve()): h for p, h in binding.get('source_exclusions', {}).items()} - if fresh: - require(set(fresh) == {str((REPO/name).resolve()) for name in OWNED_EXISTING}, + paths = {} + for row in rows: + name = row['name'] + require(name in expected and name not in paths, 'missing, duplicate or unknown bound input: '+name) + path = directory / row['resolved'] + require(row['sha256'] == expected[name] and sha(path) == expected[name], + 'exact historical source/input/producer binding: '+name) + paths[name] = path + require(paths.keys() == expected.keys(), 'incomplete historical input map') + return paths + + +def verify_binding(binding, *, resolved_inputs=None): + from scripts.general_contact_enriched_reference_geometry import require + files = binding['files'] + require(all(binding[key] in files for key in ('source_before', 'producer_raw', 'producer_closure')), + 'producer and baseline files must be bound') + if resolved_inputs is None: + direct = {p: Path(p) for p in files} + for name, path in direct.items(): + require(sha(path) == files[name], 'exact source/input/producer binding: '+name) + baseline = json.loads(direct[binding['source_before']].read_bytes()) + fresh = {Path(p).resolve(): h for p, h in binding.get('source_exclusions', {}).items()} + if fresh: + require(fresh.keys() == {(REPO/name).resolve() for name in OWNED_EXISTING}, + 'exact five prospective owned-source rebindings only') + require(all(sha(p) == h for p, h in fresh.items()), 'fresh owned reference source identities') + for name, digest in baseline['files'].items(): + path = (REPO/name).resolve() + require(sha(path) == fresh.get(path, digest), 'protected/fresh-owned source mutation: '+name) + else: + locator = Path(resolved_inputs) + mapped = json.loads(locator.read_bytes()) + require(set(mapped) == {'direct', 'sources'}, 'invalid historical input map') + direct = _mapped_paths(mapped['direct'], files, locator.parent) + baseline = json.loads(direct[binding['source_before']].read_bytes()) + fresh = {PureWindowsPath(p): h for p, h in binding['source_exclusions'].items()} + require(fresh.keys() == {V15_SOURCE_ROOT/name for name in OWNED_EXISTING}, 'exact five prospective owned-source rebindings only') - require(all(sha(p) == h for p, h in fresh.items()), 'fresh owned reference source identities') - for path, digest in baseline['files'].items(): - actual = Path(path) - if not actual.is_absolute(): - actual = REPO/actual - actual = actual.resolve() - expected = fresh.get(str(actual), digest) - require(sha(actual) == expected, 'protected/fresh-owned source mutation: '+str(actual)) - raw = json.loads(Path(binding['producer_raw']).read_bytes()) - closure = json.loads(Path(binding['producer_closure']).read_bytes()) + expected = {name: fresh.get(V15_SOURCE_ROOT/name, h) for name, h in baseline['files'].items()} + require(all(name in expected for name in OWNED_EXISTING), 'missing historical owned source') + _mapped_paths(mapped['sources'], expected, locator.parent) + raw = json.loads(direct[binding['producer_raw']].read_bytes()) + closure = json.loads(direct[binding['producer_closure']].read_bytes()) require(closure['status'] == 'PASS_SCOPED_DEVELOPMENT_CLOSED_NOT_QUALIFICATION' and closure['raw_pytest_exit'] == 0 and closure['verification']['active_raw_drift'] == 0, 'authenticated closed W13 development producer only') @@ -45,10 +75,13 @@ def verify_binding(binding): return raw -def run(output, binding_path=W/'INPUT_BINDING.json'): +def run(output, binding_path=W/'INPUT_BINDING.json', *, resolved_inputs=None): # Binding checks precede model construction; no saved accepted state is installed. - binding = json.loads(Path(binding_path).read_bytes()) - raw = verify_binding(binding) + binding_bytes = Path(binding_path).read_bytes() + if resolved_inputs is not None and hashlib.sha256(binding_bytes).hexdigest() != V15_BINDING_SHA256: + raise ValueError('resolved input map requires the exact V15 binding') + binding = json.loads(binding_bytes) + raw = verify_binding(binding, resolved_inputs=resolved_inputs) from examples.general_contact_enriched_matched import build from scripts.general_contact_enriched_reference import assess, publish, serial from scripts.general_contact_enriched_reference_geometry import require @@ -65,10 +98,11 @@ def progress(value): try: result = assess(model, system, load, descriptor, raw['coordinates'], raw['nodal_forces'], progress=progress) require(system._accepted is None, 'reference/shared structural trials never publish accepted state') - result['producer_raw_sha256'] = sha(binding['producer_raw']) + result['producer_raw_sha256'] = binding['files'][binding['producer_raw']] result['new_reference_seed'] = 'ZERO_UNLOADED' + require(Path(binding_path).read_bytes() == binding_bytes, 'reference input binding changed during assessment') + verify_binding(binding, resolved_inputs=resolved_inputs) publish(output/'ASSESSMENT.json', result) - verify_binding(binding) return result except BaseException as primary: try: @@ -80,5 +114,11 @@ def progress(value): if __name__ == '__main__': - import sys - raise SystemExit(0 if run(sys.argv[1])['status'] == 'PASS' else 1) + import argparse + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('output', type=Path) + parser.add_argument('--binding', type=Path, default=W/'INPUT_BINDING.json') + parser.add_argument('--resolved-inputs', type=Path) + args = parser.parse_args() + result = run(args.output, args.binding, resolved_inputs=args.resolved_inputs) + raise SystemExit(0 if result['status'] == 'PASS' else 1) diff --git a/tests/test_general_contact_enriched_reference.py b/tests/test_general_contact_enriched_reference.py index 5f6d93aee..c4992a3ce 100644 --- a/tests/test_general_contact_enriched_reference.py +++ b/tests/test_general_contact_enriched_reference.py @@ -135,9 +135,27 @@ def test_exact_producer_binding_original_controls_and_no_seed(tmp_path): reference.control_predicate(descriptor, u) +def test_relocated_source_map_binds_original_bytes_and_complete_inventory(tmp_path): + source = tmp_path/'relocated.py' + source.write_bytes(b'original source') + original = {'scripts/original.py': runner.sha(source)} + row = dict(name='scripts/original.py', sha256=runner.sha(source), resolved=source.name) + assert runner._mapped_paths([row], original, tmp_path) == {'scripts/original.py': source} + with pytest.raises(ReferenceRefused, match='incomplete'): + runner._mapped_paths([], original, tmp_path) + with pytest.raises(ReferenceRefused, match='duplicate'): + runner._mapped_paths([row, row], original, tmp_path) + source.write_bytes(b'wrong source') + with pytest.raises(ReferenceRefused, match='binding'): + runner._mapped_paths([dict(row, sha256=runner.sha(source))], original, tmp_path) + with pytest.raises(ValueError, match='exact V15 binding'): + runner.run(tmp_path/'output', source, resolved_inputs=tmp_path/'unused') + + def test_original_matched238_complete_independent_seven_gates(record_property, tmp_path): out = Path(os.environ.get('ENRICHED_REFERENCE_OUTPUT', tmp_path)) - result = runner.run(out/'reference') + binding = Path(os.environ.get('ENRICHED_REFERENCE_BINDING', runner.W/'INPUT_BINDING.json')) + result = runner.run(out/'reference', binding, resolved_inputs=os.environ.get('ENRICHED_REFERENCE_INPUT_MAP')) record_property('assessment_file', str(out/'reference/ASSESSMENT.json')) record_property('assessment_sha256', runner.sha(out/'reference/ASSESSMENT.json')) record_property('actual_seven', json.dumps(result['gates'], sort_keys=True)) From e1eb56baab85b14d044baf92989fbe849349e0a3 Mon Sep 17 00:00:00 2001 From: Audun Arnesen Nyhus Date: Wed, 11 Nov 2026 22:09:28 +0100 Subject: [PATCH 07/15] Bind the Q4 source review to the renamed checkout and original evidence --- .gitattributes | 3 + ...4_source_binding_20261019_as_reviewed.json | 1333 +++++++++++++++++ .../e4_pl_source_binding_20261111.json | 1 + scripts/build_q4_source_binding_20261111.py | 773 ++++++++++ tests/test_e4_pl_s3_mixed_mesh_manifest.py | 803 +++++++++- tests/test_s3_v2d_default_activation.py | 91 +- 6 files changed, 2954 insertions(+), 50 deletions(-) create mode 100644 docs/reference_cases/e4_pl_q4_source_binding_20261019_as_reviewed.json create mode 100644 docs/reference_cases/e4_pl_source_binding_20261111.json create mode 100644 scripts/build_q4_source_binding_20261111.py diff --git a/.gitattributes b/.gitattributes index 4b2394dd8..e5bcd5bea 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1071,3 +1071,6 @@ src/anyfesolver/fe_core.py -text whitespace=blank-at-eol,-blank-at-eof,space-bef scripts/contact_candidate_slice2.json text eol=lf /tests/data/namespace_migration/*.json -text /scripts/contact_candidate_050.json text eol=lf +# Restored original reader-pinned Q4 record: exact CRLF bytes (blob 99b59279..., +# SHA-256 64B07F...). Must follow the broad docs/reference_cases/e4_* rule above. +/docs/reference_cases/e4_pl_q4_source_binding_20261019_as_reviewed.json -text whitespace=blank-at-eol,blank-at-eof,space-before-tab,cr-at-eol diff --git a/docs/reference_cases/e4_pl_q4_source_binding_20261019_as_reviewed.json b/docs/reference_cases/e4_pl_q4_source_binding_20261019_as_reviewed.json new file mode 100644 index 000000000..99b59279e --- /dev/null +++ b/docs/reference_cases/e4_pl_q4_source_binding_20261019_as_reviewed.json @@ -0,0 +1,1333 @@ +{ + "C5_exception_transfer": false, + "CI_credit": false, + "external_arithmetic_dependencies": { + "_elastic_increment_module": { + "changed_this_slice": false, + "path": "src/anysolver/vectorized_nonlinear.py", + "sha256": "0510b93c71353c1631c642cc044dd93007fc16041a17c3543e752dc1e1264649", + "used_attributes": [ + "compensated_elastic_batch_zero", + "elastic_shell_nonlinear_increment" + ] + }, + "_elements_module": { + "changed_this_slice": false, + "path": "src/anysolver/elements.py", + "sha256": "fb3a3d82c0eb5b490399a6a856292389b26041b2937e55c33450f6cd1cf1285e", + "used_attributes": [ + "_compensated_elastic_zero_tangent" + ] + }, + "_local_contractions": { + "changed_this_slice": false, + "path": "src/anysolver/_compensated_contractions.py", + "sha256": "abed2ce18536e4854896c762c6c9745fcce63568a87f327f79821cb94d1d37bc", + "used_attributes": [ + "product", + "sum_arrays", + "weighted_sum" + ] + } + }, + "historical_authorities": { + "docs/reference_cases/e4_pl_q4_0_4_1_replay_hotfix.json": "A8ED4F41A6D609579F46B166909168CA795A7E7C38381DF0067964D908CE7340", + "docs/reference_cases/e4_pl_q4_0_4_2_replay_canonicalization.json": "C210BE974874D582D79B42D68FF27DFB3443FB3C690FC3D3BA58B03363953259", + "docs/reference_cases/e4_pl_s3_mixed_mesh_qualification_contract.json": "3F933786A334A876C1B53EF90891237F18C0970DE6B95F885CF5B775791E0A99" + }, + "historical_current_source_matches": false, + "historical_difference": { + "added_symbols": [ + "QualifiedE4PLShellElement._defining_class_input_snapshot_matches", + "QualifiedE4PLShellElement._elastic_increment_admitted", + "QualifiedE4PLShellElement._elastic_increment_response", + "QualifiedE4PLShellElement._is_compact_batch_constitutive_state", + "QualifiedE4PLShellElement._nonlinear_response_core", + "_Q4FastInputSnapshot", + "_Q4_COMPACT_REPLAY_MAX_ULPS", + "_Q4_FAST_COORDINATE_FLOAT64_TYPE", + "_Q4_FAST_ELEMENT_INPUT_NAMES", + "_Q4_FAST_ELEMENT_ITEMGETTER", + "_Q4_FAST_FORBIDDEN_INSTANCE_SHADOWS", + "_Q4_FAST_FORBIDDEN_MATERIAL_SHADOWS", + "_Q4_FAST_FORBIDDEN_MESH_SHADOWS", + "_Q4_FAST_MATERIAL_CLASS_ITEMGETTER", + "_Q4_FAST_MATERIAL_CLASS_NAMES", + "_Q4_FAST_MATERIAL_CLASS_VALUES", + "_Q4_FAST_MATERIAL_INPUT_NAMES", + "_Q4_FAST_MATERIAL_ITEMGETTER", + "_Q4_FAST_MATERIAL_TYPE", + "_Q4_FAST_MESH_TYPE", + "_Q4_FAST_NODE_ITEMGETTER", + "_Q4_FAST_NODE_TYPE", + "_Q4_FAST_OWNED_MESH_DERIVED_KEYS", + "_Q4_FAST_STATE_MAPPING_TYPE", + "_Q4_FAST_TOKEN_TYPE", + "_capture_q4_fast_array_authority", + "_capture_q4_fast_input_snapshot", + "_q4_compact_replay_last_place_equivalent", + "_require_q4_fast_array_authority", + "_require_q4_fast_base_authority" + ], + "changed_symbols": [ + "QualifiedE4PLShellElement._compute_committed_current_tangent_components_unchecked", + "QualifiedE4PLShellElement._recover_planar_mixed_fields", + "QualifiedE4PLShellElement._replay_accepted_algorithmic_response", + "QualifiedE4PLShellElement.compute_nonlinear_response", + "QualifiedE4PLShellElement.compute_stiffness_components", + "QualifiedE4PLShellElement.compute_stresses", + "_stationary_blocks" + ], + "removed_symbols": [] + }, + "mechanics": { + "edges": { + "DIRECTOR_POLARITY_POLICY_ID": [], + "DIRECTOR_REVERSAL_TRANSFORM_ID": [], + "FORMULATION_ID": [], + "IMPLEMENTATION_ID": [], + "Q4_ACTIVITY_DISPOSITION_SCHEMA_ID": [], + "Q4_CURRENT_STATE_ALGORITHMIC_ORIGIN_SCHEMA_ID": [], + "Q4_CURRENT_STATE_BINDING_SCHEMA_ID": [], + "Q4_CURRENT_STATE_PROJECTION_POLICY_ID": [], + "Q4_CURRENT_STATE_TANGENT_DECOMPOSITION_POLICY_ID": [], + "Q4_DELETED_FROZEN_POLICY_ID": [], + "Q4_FAILED_STATE_POLICY_ID": [], + "Q4_QUADRATURE_AUTHORITY_ID": [], + "QualifiedE4PLShellElement.GAUSS_POINTS_1x1": [ + "_Q4_QUADRATURE_CLASS_ARRAY_AUTHORITY" + ], + "QualifiedE4PLShellElement.GAUSS_POINTS_2x2": [ + "_Q4_QUADRATURE_CLASS_ARRAY_AUTHORITY" + ], + "QualifiedE4PLShellElement.GAUSS_WEIGHTS_1x1": [ + "_Q4_QUADRATURE_CLASS_ARRAY_AUTHORITY" + ], + "QualifiedE4PLShellElement.GAUSS_WEIGHTS_2x2": [ + "_Q4_QUADRATURE_CLASS_ARRAY_AUTHORITY" + ], + "QualifiedE4PLShellElement._MITC4_SAMPLE_POINTS": [], + "QualifiedE4PLShellElement._accepted_algorithmic_update_fingerprint": [ + "QualifiedE4PLShellElement._validated_algorithmic_origin", + "_Q4_CURRENT_STATE_ALGORITHMIC_ORIGIN_KEY", + "_qualified_q4_layer_count" + ], + "QualifiedE4PLShellElement._algorithmic_origin_payload": [ + "Q4_CURRENT_STATE_ALGORITHMIC_ORIGIN_SCHEMA_ID", + "QualifiedE4PLShellElement._requires_algorithmic_return_map_origin", + "_qualified_q4_layer_count" + ], + "QualifiedE4PLShellElement._bind_qualified_component_guard": [ + "Q4_QUADRATURE_AUTHORITY_ID" + ], + "QualifiedE4PLShellElement._committed_current_binding_payload": [ + "Q4_CURRENT_STATE_ALGORITHMIC_ORIGIN_SCHEMA_ID", + "Q4_CURRENT_STATE_BINDING_SCHEMA_ID", + "Q4_CURRENT_STATE_PROJECTION_POLICY_ID", + "Q4_CURRENT_STATE_TANGENT_DECOMPOSITION_POLICY_ID", + "QualifiedE4PLShellElement._accepted_algorithmic_update_fingerprint", + "QualifiedE4PLShellElement._stable_state_identity_payload", + "_binary64_vector_fingerprint", + "_q4_state_payload" + ], + "QualifiedE4PLShellElement._compute_committed_current_tangent_components_unchecked": [ + "Q4_CURRENT_STATE_ALGORITHMIC_ORIGIN_SCHEMA_ID", + "Q4_CURRENT_STATE_PROJECTION_POLICY_ID", + "Q4_CURRENT_STATE_TANGENT_DECOMPOSITION_POLICY_ID", + "QualifiedE4PLShellElement._elastic_increment_response", + "QualifiedE4PLShellElement._qualified_linear_correction", + "QualifiedE4PLShellElement._replay_accepted_algorithmic_response", + "QualifiedE4PLShellElement.validate_committed_current_tangent_state", + "_qualified_q4_layer_count" + ], + "QualifiedE4PLShellElement._constitutive_and_drill_stiffness": [ + "QualifiedE4PLShellElement._generalized_section_in_frame" + ], + "QualifiedE4PLShellElement._current_state_cache_transaction": [], + "QualifiedE4PLShellElement._defining_class_input_snapshot_matches": [ + "_Q4FastInputSnapshot", + "_Q4_FAST_COORDINATE_FLOAT64_TYPE", + "_Q4_FAST_ELEMENT_ITEMGETTER", + "_Q4_FAST_FORBIDDEN_MESH_SHADOWS", + "_Q4_FAST_MATERIAL_ITEMGETTER", + "_Q4_FAST_MATERIAL_TYPE", + "_Q4_FAST_MESH_TYPE", + "_Q4_FAST_NODE_ITEMGETTER", + "_Q4_FAST_NODE_TYPE", + "_Q4_FAST_STATE_MAPPING_TYPE", + "_Q4_FAST_TOKEN_TYPE" + ], + "QualifiedE4PLShellElement._elastic_increment_admitted": [ + "QualifiedE4PLShellElement._defining_class_input_snapshot_matches", + "QualifiedE4PLShellElement.get_node_coordinates", + "_Q4_FAST_MATERIAL_TYPE", + "_Q4_FAST_MESH_TYPE", + "_Q4_INITIAL_STATE_KEYS", + "_capture_q4_fast_input_snapshot", + "_require_q4_fast_base_authority", + "equation7_frame" + ], + "QualifiedE4PLShellElement._elastic_increment_response": [ + "QualifiedE4PLShellElement._defining_class_input_snapshot_matches", + "QualifiedE4PLShellElement._elastic_increment_admitted", + "QualifiedE4PLShellElement._nonlinear_geometry", + "QualifiedE4PLShellElement._validate_qualified_component_guard", + "QualifiedE4PLShellElement.compute_stiffness_matrix", + "_capture_q4_fast_input_snapshot" + ], + "QualifiedE4PLShellElement._generalized_section_in_frame": [ + "QualifiedE4PLShellElement._physical_director_context" + ], + "QualifiedE4PLShellElement._inverse_planar_jacobian": [ + "_characteristic_length" + ], + "QualifiedE4PLShellElement._is_compact_batch_constitutive_state": [ + "_Q4_ACTIVITY_DISPOSITION_KEY", + "_Q4_CURRENT_STATE_ALGORITHMIC_ORIGIN_KEY", + "_Q4_CURRENT_STATE_BINDING_KEY", + "_Q4_CURRENT_STATE_DIGEST_KEY" + ], + "QualifiedE4PLShellElement._local_frame_and_derivatives": [ + "_QUALIFIED_Q4_BASE_LOCAL_FRAME_KERNEL", + "_characteristic_length", + "_normalize" + ], + "QualifiedE4PLShellElement._mitc4_shear_b_matrix": [ + "QualifiedE4PLShellElement._inverse_planar_jacobian", + "_QUALIFIED_Q4_BASE_MITC4_SHEAR_KERNEL", + "_characteristic_length" + ], + "QualifiedE4PLShellElement._nonlinear_geometry": [ + "Q4_QUADRATURE_AUTHORITY_ID", + "QualifiedE4PLShellElement.GAUSS_POINTS_2x2", + "QualifiedE4PLShellElement.GAUSS_WEIGHTS_2x2", + "QualifiedE4PLShellElement._inverse_planar_jacobian", + "QualifiedE4PLShellElement._mitc4_shear_b_matrix", + "QualifiedE4PLShellElement.get_node_coordinates", + "_QUALIFIED_Q4_BASE_NONLINEAR_GEOMETRY", + "_freeze_qualified_component_cache", + "_validate_q4_quadrature_authority" + ], + "QualifiedE4PLShellElement._nonlinear_response_core": [ + "QualifiedE4PLShellElement._elastic_increment_response", + "QualifiedE4PLShellElement._qualified_linear_correction", + "QualifiedE4PLShellElement.attach_current_tangent_algorithmic_origin", + "_QUALIFIED_Q4_BASE_NONLINEAR_KERNEL", + "_qualified_q4_layer_count", + "_validate_q4_quadrature_authority" + ], + "QualifiedE4PLShellElement._physical_director_context": [ + "QualifiedE4PLShellElement.physical_reference_director" + ], + "QualifiedE4PLShellElement._qualified_linear_correction": [ + "QualifiedE4PLShellElement.compute_stiffness_matrix", + "QualifiedE4PLShellElement.get_node_coordinates", + "_QUALIFIED_Q4_BASE_NONLINEAR_KERNEL", + "equation7_frame" + ], + "QualifiedE4PLShellElement._qualified_stiffness_cache_key": [ + "DIRECTOR_POLARITY_POLICY_ID", + "DIRECTOR_REVERSAL_TRANSFORM_ID", + "IMPLEMENTATION_ID", + "QualifiedE4PLShellElement.get_node_coordinates", + "RECOVERY_POLICY_ID" + ], + "QualifiedE4PLShellElement._recover_planar_mixed_fields": [ + "QualifiedE4PLShellElement._constitutive_and_drill_stiffness", + "QualifiedE4PLShellElement._elastic_increment_admitted", + "QualifiedE4PLShellElement.get_node_coordinates", + "_GAUSS", + "_coefficients", + "_compatible", + "_global_transform", + "_jacobian", + "_local_jacobian_scale", + "_solve_stationary_system", + "_source_fields", + "_stationary_blocks", + "equation7_frame" + ], + "QualifiedE4PLShellElement._recover_warped_generalized_section": [ + "DIRECTOR_POLARITY_POLICY_ID", + "DIRECTOR_REVERSAL_TRANSFORM_ID", + "IMPLEMENTATION_ID", + "QualifiedE4PLShellElement._local_frame_and_derivatives", + "QualifiedE4PLShellElement._physical_director_context", + "QualifiedE4PLShellElement.get_node_coordinates", + "RECOVERY_POLICY_ID" + ], + "QualifiedE4PLShellElement._recover_warped_homogeneous_section": [ + "DIRECTOR_POLARITY_POLICY_ID", + "DIRECTOR_REVERSAL_TRANSFORM_ID", + "IMPLEMENTATION_ID", + "QualifiedE4PLShellElement._local_frame_and_derivatives", + "QualifiedE4PLShellElement._physical_director_context", + "QualifiedE4PLShellElement.get_node_coordinates", + "RECOVERY_POLICY_ID" + ], + "QualifiedE4PLShellElement._reject_noncurrent_activity_disposition": [ + "_FOREIGN_S3_ACTIVITY_DISPOSITION_KEY", + "_Q4_ACTIVITY_DISPOSITION_KEY" + ], + "QualifiedE4PLShellElement._replay_accepted_algorithmic_response": [ + "QualifiedE4PLShellElement._is_compact_batch_constitutive_state", + "QualifiedE4PLShellElement._validated_algorithmic_origin", + "_q4_compact_replay_last_place_equivalent", + "_qualified_q4_layer_count", + "_validate_q4_quadrature_authority" + ], + "QualifiedE4PLShellElement._requires_algorithmic_return_map_origin": [], + "QualifiedE4PLShellElement._stable_state_identity_payload": [ + "FORMULATION_ID", + "IMPLEMENTATION_ID", + "QualifiedE4PLShellElement.get_node_coordinates", + "QualifiedE4PLShellElement.to_dict", + "_binary64_vector_fingerprint" + ], + "QualifiedE4PLShellElement._validate_committed_current_kinematics": [ + "QualifiedE4PLShellElement._nonlinear_geometry" + ], + "QualifiedE4PLShellElement._validate_committed_state_at_configuration": [ + "QualifiedE4PLShellElement._committed_current_binding_payload", + "QualifiedE4PLShellElement._reject_noncurrent_activity_disposition", + "_Q4_CURRENT_STATE_BINDING_KEY", + "_Q4_CURRENT_STATE_DIGEST_KEY", + "_qualified_q4_layer_count" + ], + "QualifiedE4PLShellElement._validate_qualified_component_cache_identity": [], + "QualifiedE4PLShellElement._validate_qualified_component_guard": [ + "Q4_QUADRATURE_AUTHORITY_ID", + "QualifiedE4PLShellElement._qualified_stiffness_cache_key", + "QualifiedE4PLShellElement._validate_qualified_component_cache_identity", + "QualifiedE4PLShellElement.get_node_coordinates", + "_validate_q4_quadrature_authority" + ], + "QualifiedE4PLShellElement._validated_algorithmic_origin": [ + "Q4_CURRENT_STATE_ALGORITHMIC_ORIGIN_SCHEMA_ID", + "QualifiedE4PLShellElement._requires_algorithmic_return_map_origin", + "_Q4_CURRENT_STATE_ALGORITHMIC_ORIGIN_KEY", + "_Q4_INITIAL_STATE_KEYS", + "_qualified_q4_layer_count" + ], + "QualifiedE4PLShellElement._warped_generalized_drilling_correction": [ + "QualifiedE4PLShellElement._generalized_section_in_frame", + "QualifiedE4PLShellElement._local_frame_and_derivatives", + "_invariant_generalized_drilling_scale" + ], + "QualifiedE4PLShellElement.attach_current_tangent_algorithmic_origin": [ + "QualifiedE4PLShellElement._algorithmic_origin_payload", + "_Q4_CURRENT_STATE_ALGORITHMIC_ORIGIN_KEY" + ], + "QualifiedE4PLShellElement.compute_geometric_stiffness_matrix": [ + "_QUALIFIED_Q4_BASE_GEOMETRIC_KERNEL", + "_validate_q4_quadrature_authority" + ], + "QualifiedE4PLShellElement.compute_mass_matrix": [ + "_QUALIFIED_Q4_BASE_MASS_KERNEL", + "_validate_q4_quadrature_authority" + ], + "QualifiedE4PLShellElement.compute_nonlinear_response": [ + "QualifiedE4PLShellElement._nonlinear_response_core" + ], + "QualifiedE4PLShellElement.compute_stiffness_components": [ + "QualifiedE4PLShellElement._bind_qualified_component_guard", + "QualifiedE4PLShellElement._constitutive_and_drill_stiffness", + "QualifiedE4PLShellElement._elastic_increment_admitted", + "QualifiedE4PLShellElement._qualified_stiffness_cache_key", + "QualifiedE4PLShellElement._validate_qualified_component_cache_identity", + "QualifiedE4PLShellElement._warped_generalized_drilling_correction", + "QualifiedE4PLShellElement.get_node_coordinates", + "STATIONARY_SOLVE_POLICY_ID", + "_GAUSS", + "_QUALIFIED_Q4_BASE_STIFFNESS_KERNEL", + "_centre_taylor", + "_coefficients", + "_freeze_qualified_component_cache", + "_global_transform", + "_jacobian", + "_local_jacobian_scale", + "_residual_mode", + "_solve_stationary_system", + "_stationary_blocks", + "_validate_q4_quadrature_authority", + "equation7_frame" + ], + "QualifiedE4PLShellElement.compute_stiffness_matrix": [ + "QualifiedE4PLShellElement._bind_qualified_component_guard", + "QualifiedE4PLShellElement.compute_stiffness_components" + ], + "QualifiedE4PLShellElement.compute_stresses": [ + "DIRECTOR_POLARITY_POLICY_ID", + "DIRECTOR_REVERSAL_TRANSFORM_ID", + "IMPLEMENTATION_ID", + "QualifiedE4PLShellElement._physical_director_context", + "QualifiedE4PLShellElement._recover_planar_mixed_fields", + "QualifiedE4PLShellElement._recover_warped_generalized_section", + "QualifiedE4PLShellElement._recover_warped_homogeneous_section", + "QualifiedE4PLShellElement.get_node_coordinates", + "RECOVERY_POLICY_ID", + "_GAUSS", + "_validate_q4_quadrature_authority", + "equation7_frame" + ], + "QualifiedE4PLShellElement.get_node_coordinates": [ + "_QUALIFIED_Q4_COORDINATE_SCALAR_TYPES" + ], + "QualifiedE4PLShellElement.numerical_internal_force": [ + "QualifiedE4PLShellElement._validate_qualified_component_guard" + ], + "QualifiedE4PLShellElement.physical_reference_director": [], + "QualifiedE4PLShellElement.to_dict": [ + "DIRECTOR_POLARITY_POLICY_ID", + "DIRECTOR_REVERSAL_TRANSFORM_ID", + "FORMULATION_ID", + "IMPLEMENTATION_ID", + "Q4_ACTIVITY_DISPOSITION_SCHEMA_ID", + "Q4_CURRENT_STATE_ALGORITHMIC_ORIGIN_SCHEMA_ID", + "Q4_CURRENT_STATE_BINDING_SCHEMA_ID", + "Q4_CURRENT_STATE_PROJECTION_POLICY_ID", + "Q4_CURRENT_STATE_TANGENT_DECOMPOSITION_POLICY_ID", + "Q4_DELETED_FROZEN_POLICY_ID", + "Q4_FAILED_STATE_POLICY_ID", + "Q4_QUADRATURE_AUTHORITY_ID", + "RECOVERY_POLICY_ID", + "STATIONARY_SOLVE_POLICY_ID", + "_q4_serialized_output_boundary" + ], + "QualifiedE4PLShellElement.validate_committed_current_tangent_binding": [ + "QualifiedE4PLShellElement._reject_noncurrent_activity_disposition", + "QualifiedE4PLShellElement._validate_committed_state_at_configuration" + ], + "QualifiedE4PLShellElement.validate_committed_current_tangent_semantics": [ + "QualifiedE4PLShellElement._current_state_cache_transaction", + "QualifiedE4PLShellElement._replay_accepted_algorithmic_response", + "QualifiedE4PLShellElement._validate_committed_current_kinematics", + "QualifiedE4PLShellElement.validate_committed_current_tangent_binding", + "_qualified_q4_layer_count", + "_validate_q4_quadrature_authority" + ], + "QualifiedE4PLShellElement.validate_committed_current_tangent_state": [ + "QualifiedE4PLShellElement.validate_committed_current_tangent_semantics" + ], + "RECOVERY_POLICY_ID": [], + "STATIONARY_SOLVE_POLICY_ID": [], + "_FOREIGN_S3_ACTIVITY_DISPOSITION_KEY": [], + "_GAUSS": [ + "_Q4_STIFFNESS_STATION_AUTHORITY" + ], + "_PLANAR_FORMULATION_ID": [], + "_Q4FastInputSnapshot": [], + "_Q4_ACTIVITY_DISPOSITION_KEY": [], + "_Q4_COMPACT_REPLAY_MAX_ULPS": [], + "_Q4_CURRENT_STATE_ALGORITHMIC_ORIGIN_KEY": [], + "_Q4_CURRENT_STATE_BINDING_KEY": [], + "_Q4_CURRENT_STATE_DIGEST_KEY": [], + "_Q4_FAST_COORDINATE_FLOAT64_TYPE": [], + "_Q4_FAST_ELEMENT_INPUT_NAMES": [], + "_Q4_FAST_ELEMENT_ITEMGETTER": [ + "_Q4_FAST_ELEMENT_INPUT_NAMES" + ], + "_Q4_FAST_FORBIDDEN_INSTANCE_SHADOWS": [], + "_Q4_FAST_FORBIDDEN_MATERIAL_SHADOWS": [], + "_Q4_FAST_FORBIDDEN_MESH_SHADOWS": [], + "_Q4_FAST_MATERIAL_CLASS_ITEMGETTER": [ + "_Q4_FAST_MATERIAL_CLASS_NAMES" + ], + "_Q4_FAST_MATERIAL_CLASS_NAMES": [], + "_Q4_FAST_MATERIAL_CLASS_VALUES": [ + "_Q4_FAST_MATERIAL_CLASS_ITEMGETTER", + "_Q4_FAST_MATERIAL_TYPE" + ], + "_Q4_FAST_MATERIAL_INPUT_NAMES": [], + "_Q4_FAST_MATERIAL_ITEMGETTER": [ + "_Q4_FAST_MATERIAL_INPUT_NAMES" + ], + "_Q4_FAST_MATERIAL_TYPE": [], + "_Q4_FAST_MESH_TYPE": [], + "_Q4_FAST_NODE_ITEMGETTER": [], + "_Q4_FAST_NODE_TYPE": [], + "_Q4_FAST_OWNED_MESH_DERIVED_KEYS": [], + "_Q4_FAST_STATE_MAPPING_TYPE": [], + "_Q4_FAST_TOKEN_TYPE": [], + "_Q4_GENERALIZED_SECTION_NAMESPACE_AUTHORITY": [], + "_Q4_INITIAL_STATE_KEYS": [], + "_Q4_QUADRATURE_ARRAY_AUTHORITY": [], + "_Q4_QUADRATURE_CLASS_ARRAY_AUTHORITY": [ + "_owned_q4_quadrature_array" + ], + "_Q4_QUADRATURE_PROPERTY_AUTHORITY": [], + "_Q4_SERIALIZATION_CLASS_IDENTITY": [ + "DIRECTOR_POLARITY_POLICY_ID", + "DIRECTOR_REVERSAL_TRANSFORM_ID", + "FORMULATION_ID", + "IMPLEMENTATION_ID", + "Q4_ACTIVITY_DISPOSITION_SCHEMA_ID", + "Q4_CURRENT_STATE_ALGORITHMIC_ORIGIN_SCHEMA_ID", + "Q4_CURRENT_STATE_BINDING_SCHEMA_ID", + "Q4_CURRENT_STATE_PROJECTION_POLICY_ID", + "Q4_CURRENT_STATE_TANGENT_DECOMPOSITION_POLICY_ID", + "Q4_DELETED_FROZEN_POLICY_ID", + "Q4_FAILED_STATE_POLICY_ID", + "Q4_QUADRATURE_AUTHORITY_ID", + "RECOVERY_POLICY_ID", + "STATIONARY_SOLVE_POLICY_ID" + ], + "_Q4_SERIALIZATION_GLOBAL_IDENTITY": [ + "DIRECTOR_POLARITY_POLICY_ID", + "DIRECTOR_REVERSAL_TRANSFORM_ID", + "FORMULATION_ID", + "IMPLEMENTATION_ID", + "Q4_ACTIVITY_DISPOSITION_SCHEMA_ID", + "Q4_CURRENT_STATE_ALGORITHMIC_ORIGIN_SCHEMA_ID", + "Q4_CURRENT_STATE_BINDING_SCHEMA_ID", + "Q4_CURRENT_STATE_PROJECTION_POLICY_ID", + "Q4_CURRENT_STATE_TANGENT_DECOMPOSITION_POLICY_ID", + "Q4_DELETED_FROZEN_POLICY_ID", + "Q4_FAILED_STATE_POLICY_ID", + "Q4_QUADRATURE_AUTHORITY_ID", + "RECOVERY_POLICY_ID", + "STATIONARY_SOLVE_POLICY_ID", + "_PLANAR_FORMULATION_ID", + "_V5_IMPLEMENTATION_ID", + "_V6_CURRENT_STATE_BINDING_SCHEMA_ID", + "_V6_CURRENT_STATE_TANGENT_DECOMPOSITION_POLICY_ID", + "_V6_IMPLEMENTATION_ID" + ], + "_Q4_STIFFNESS_STATION_AUTHORITY": [], + "_QUALIFIED_Q4_BASE_ELEMENT_SERIALIZATION_KERNEL": [], + "_QUALIFIED_Q4_BASE_GEOMETRIC_KERNEL": [], + "_QUALIFIED_Q4_BASE_LOCAL_FRAME_KERNEL": [], + "_QUALIFIED_Q4_BASE_MASS_KERNEL": [], + "_QUALIFIED_Q4_BASE_MITC4_SHEAR_KERNEL": [], + "_QUALIFIED_Q4_BASE_NONLINEAR_GEOMETRY": [], + "_QUALIFIED_Q4_BASE_NONLINEAR_KERNEL": [], + "_QUALIFIED_Q4_BASE_SERIALIZATION_KERNEL": [], + "_QUALIFIED_Q4_BASE_STIFFNESS_KERNEL": [], + "_QUALIFIED_Q4_COORDINATE_SCALAR_TYPES": [], + "_STATIONARY_BACKWARD_ERROR_LIMIT": [], + "_STATIONARY_RUIZ_ITERATIONS": [], + "_STATIONARY_RUIZ_ROW_NORM_RATIO_LIMIT": [], + "_V5_IMPLEMENTATION_ID": [], + "_V6_CURRENT_STATE_BINDING_SCHEMA_ID": [], + "_V6_CURRENT_STATE_TANGENT_DECOMPOSITION_POLICY_ID": [], + "_V6_IMPLEMENTATION_ID": [], + "_WARPED_FORMULATIONS": [], + "_binary64_vector_fingerprint": [], + "_capture_q4_fast_array_authority": [], + "_capture_q4_fast_input_snapshot": [ + "_Q4FastInputSnapshot", + "_Q4_FAST_COORDINATE_FLOAT64_TYPE", + "_Q4_FAST_ELEMENT_INPUT_NAMES", + "_Q4_FAST_ELEMENT_ITEMGETTER", + "_Q4_FAST_FORBIDDEN_INSTANCE_SHADOWS", + "_Q4_FAST_FORBIDDEN_MATERIAL_SHADOWS", + "_Q4_FAST_FORBIDDEN_MESH_SHADOWS", + "_Q4_FAST_MATERIAL_INPUT_NAMES", + "_Q4_FAST_MATERIAL_ITEMGETTER", + "_Q4_FAST_MATERIAL_TYPE", + "_Q4_FAST_MESH_TYPE", + "_Q4_FAST_NODE_ITEMGETTER", + "_Q4_FAST_NODE_TYPE", + "_Q4_FAST_OWNED_MESH_DERIVED_KEYS", + "_Q4_FAST_STATE_MAPPING_TYPE", + "_Q4_FAST_TOKEN_TYPE", + "_capture_q4_fast_array_authority", + "_require_q4_fast_array_authority" + ], + "_centre_taylor": [], + "_characteristic_length": [], + "_coefficients": [], + "_compatible": [ + "_jacobian", + "_natural_shear", + "_shape_derivatives" + ], + "_freeze_qualified_component_cache": [], + "_global_transform": [], + "_invariant_generalized_drilling_scale": [], + "_jacobian": [], + "_local_jacobian_scale": [ + "_characteristic_length" + ], + "_natural_shear": [ + "_shape", + "_shape_derivatives" + ], + "_normalize": [], + "_owned_q4_quadrature_array": [], + "_q4_compact_replay_last_place_equivalent": [ + "_Q4_COMPACT_REPLAY_MAX_ULPS" + ], + "_q4_quadrature_epoch_guard": [ + "_q4_quadrature_epoch_manager", + "_validate_q4_quadrature_authority_exact" + ], + "_q4_quadrature_epoch_manager": [], + "_q4_serialized_output_boundary": [ + "_validate_q4_quadrature_authority", + "_validate_q4_serialization_authority" + ], + "_q4_state_payload": [ + "_Q4_CURRENT_STATE_BINDING_KEY", + "_Q4_CURRENT_STATE_DIGEST_KEY" + ], + "_qualified_q4_layer_count": [], + "_require_exact_readonly_float64_array": [], + "_require_q4_fast_array_authority": [], + "_require_q4_fast_base_authority": [ + "_Q4_FAST_MATERIAL_CLASS_ITEMGETTER", + "_Q4_FAST_MATERIAL_CLASS_VALUES", + "_Q4_FAST_MATERIAL_TYPE" + ], + "_require_q4_quadrature_instance_authority": [ + "_Q4_QUADRATURE_CLASS_ARRAY_AUTHORITY", + "_Q4_QUADRATURE_PROPERTY_AUTHORITY", + "_static_mro_attribute" + ], + "_require_q4_serialization_module_authority": [ + "_Q4_GENERALIZED_SECTION_NAMESPACE_AUTHORITY", + "_Q4_SERIALIZATION_CLASS_IDENTITY", + "_Q4_SERIALIZATION_GLOBAL_IDENTITY", + "_QUALIFIED_Q4_BASE_ELEMENT_SERIALIZATION_KERNEL", + "_QUALIFIED_Q4_BASE_SERIALIZATION_KERNEL", + "_static_mro_attribute" + ], + "_residual_mode": [], + "_shape": [], + "_shape_derivatives": [], + "_solve_stationary_system": [ + "_STATIONARY_BACKWARD_ERROR_LIMIT", + "_stationary_backward_error", + "_symmetric_ruiz_congruence" + ], + "_source_fields": [ + "_jacobian", + "_tensor_transform" + ], + "_static_mro_attribute": [], + "_stationary_backward_error": [], + "_stationary_blocks": [ + "_GAUSS", + "_compatible", + "_jacobian", + "_source_fields" + ], + "_symmetric_ruiz_congruence": [ + "STATIONARY_SOLVE_POLICY_ID", + "_STATIONARY_RUIZ_ITERATIONS", + "_STATIONARY_RUIZ_ROW_NORM_RATIO_LIMIT" + ], + "_tensor_transform": [], + "_validate_q4_quadrature_authority": [ + "Q4_QUADRATURE_AUTHORITY_ID", + "_q4_quadrature_epoch_guard", + "_require_q4_quadrature_instance_authority" + ], + "_validate_q4_quadrature_authority_exact": [ + "Q4_QUADRATURE_AUTHORITY_ID", + "_GAUSS", + "_Q4_QUADRATURE_ARRAY_AUTHORITY", + "_Q4_QUADRATURE_CLASS_ARRAY_AUTHORITY", + "_Q4_QUADRATURE_PROPERTY_AUTHORITY", + "_Q4_STIFFNESS_STATION_AUTHORITY", + "_require_exact_readonly_float64_array", + "_static_mro_attribute" + ], + "_validate_q4_serialization_authority": [ + "_Q4_GENERALIZED_SECTION_NAMESPACE_AUTHORITY", + "_Q4_SERIALIZATION_CLASS_IDENTITY", + "_Q4_SERIALIZATION_GLOBAL_IDENTITY", + "_QUALIFIED_Q4_BASE_ELEMENT_SERIALIZATION_KERNEL", + "_QUALIFIED_Q4_BASE_SERIALIZATION_KERNEL", + "_WARPED_FORMULATIONS", + "_require_q4_serialization_module_authority", + "_static_mro_attribute" + ], + "equation7_frame": [ + "_characteristic_length", + "_normalize" + ] + }, + "path": "src/anysolver/e4_pl_element.py", + "roots": [ + "QualifiedE4PLShellElement.GAUSS_POINTS_1x1", + "QualifiedE4PLShellElement.GAUSS_POINTS_2x2", + "QualifiedE4PLShellElement.GAUSS_WEIGHTS_1x1", + "QualifiedE4PLShellElement.GAUSS_WEIGHTS_2x2", + "QualifiedE4PLShellElement._MITC4_SAMPLE_POINTS", + "QualifiedE4PLShellElement._compute_committed_current_tangent_components_unchecked", + "QualifiedE4PLShellElement._constitutive_and_drill_stiffness", + "QualifiedE4PLShellElement._generalized_section_in_frame", + "QualifiedE4PLShellElement._inverse_planar_jacobian", + "QualifiedE4PLShellElement._local_frame_and_derivatives", + "QualifiedE4PLShellElement._mitc4_shear_b_matrix", + "QualifiedE4PLShellElement._nonlinear_geometry", + "QualifiedE4PLShellElement._qualified_linear_correction", + "QualifiedE4PLShellElement._recover_planar_mixed_fields", + "QualifiedE4PLShellElement._recover_warped_generalized_section", + "QualifiedE4PLShellElement._recover_warped_homogeneous_section", + "QualifiedE4PLShellElement._warped_generalized_drilling_correction", + "QualifiedE4PLShellElement.compute_geometric_stiffness_matrix", + "QualifiedE4PLShellElement.compute_mass_matrix", + "QualifiedE4PLShellElement.compute_nonlinear_response", + "QualifiedE4PLShellElement.compute_stiffness_components", + "QualifiedE4PLShellElement.compute_stresses", + "QualifiedE4PLShellElement.numerical_internal_force", + "_GAUSS", + "_STATIONARY_BACKWARD_ERROR_LIMIT", + "_STATIONARY_RUIZ_ITERATIONS", + "_STATIONARY_RUIZ_ROW_NORM_RATIO_LIMIT", + "_centre_taylor", + "_characteristic_length", + "_coefficients", + "_compatible", + "_global_transform", + "_invariant_generalized_drilling_scale", + "_jacobian", + "_local_jacobian_scale", + "_natural_shear", + "_normalize", + "_residual_mode", + "_shape", + "_shape_derivatives", + "_solve_stationary_system", + "_source_fields", + "_stationary_backward_error", + "_stationary_blocks", + "_symmetric_ruiz_congruence", + "_tensor_transform", + "equation7_frame" + ], + "schema": "anysolver.python-ast-mechanics-closure-v1", + "symbols": { + "DIRECTOR_POLARITY_POLICY_ID": "24FBADE6A782FD20EE5AE426D7B8F8ABADA60F9075B909EE3AB5F1FC13933EBD", + "DIRECTOR_REVERSAL_TRANSFORM_ID": "27EA36BE70DC524A0509D7C2AC14310EA94F4142CBBD0FC1199C9C8695E408D9", + "FORMULATION_ID": "68BC5D9067886BA4983FC3CDE61F239017C41E95853076C5E86AA6B2F0EF4624", + "IMPLEMENTATION_ID": "E6912AECE2496A69D6EC30C55003CA54A8A4B4398148C3DF8C80E910BE7805F2", + "Q4_ACTIVITY_DISPOSITION_SCHEMA_ID": "16022FDB7472160CED1A4D67BFE0643A92AB5242277B4D5C8CAB8B2C40BCF061", + "Q4_CURRENT_STATE_ALGORITHMIC_ORIGIN_SCHEMA_ID": "B792337D12AD1ED030D9A3E3DDFC58AA07E78B70CE18C0B41A7F24ABC54B8317", + "Q4_CURRENT_STATE_BINDING_SCHEMA_ID": "19EB2FA057D8FEDB2631389D39D1605B52B98970A793DD4FA635E3A1F1B37242", + "Q4_CURRENT_STATE_PROJECTION_POLICY_ID": "51B51EE54605793ED15AB7A640722FE859A7759566E3C1252CED478D729122A1", + "Q4_CURRENT_STATE_TANGENT_DECOMPOSITION_POLICY_ID": "93332FEFF5AE309A156131863D9B37B4B17EA52C50A3C9DF6874BB704FE8EDF8", + "Q4_DELETED_FROZEN_POLICY_ID": "98E986395C5C3919EAB74EC383AFF75BD61555C1BEFCEC122D3E2473F73B6C7A", + "Q4_FAILED_STATE_POLICY_ID": "8E221CFCCD0F85B9EC5703C9D7076BEFDF4AD19CC45F21860724536D2BA8A4B1", + "Q4_QUADRATURE_AUTHORITY_ID": "FFFCD6F866B0277BB4831D929752828CBFDAA4DA07ADDE04CC733E3711E6241D", + "QualifiedE4PLShellElement.GAUSS_POINTS_1x1": "582849F858244BBCA8B50DFD4F59C6358E2E2FECF7C30FE53516FB18F1285918", + "QualifiedE4PLShellElement.GAUSS_POINTS_2x2": "AE70D777343C1F5F2E2DE28F1541F1989F57D30FE7573D7F1A29DE302E6FC907", + "QualifiedE4PLShellElement.GAUSS_WEIGHTS_1x1": "35A34ABA963A04E387B2FB824010F778BEEB56B5BB5E0C4AF34D7A0F04521511", + "QualifiedE4PLShellElement.GAUSS_WEIGHTS_2x2": "802076F1F43C9F344DE27FE0316C51BD5586F75CA1ABDF76C16AB9FC30536839", + "QualifiedE4PLShellElement._MITC4_SAMPLE_POINTS": "0CFD68C57D7EB153B81B6DDB01404DAEAA82F0DD80E6F61FEAD82453C730B439", + "QualifiedE4PLShellElement._accepted_algorithmic_update_fingerprint": "DFAF1A4638A50EA0D3FA47D78BCF04ABD6A0581025E6A56CFE40C1662E90EF75", + "QualifiedE4PLShellElement._algorithmic_origin_payload": "86138089CF989621301D91E773B7A403ECE2726C88F39F61D17D86ABC4B8BE23", + "QualifiedE4PLShellElement._bind_qualified_component_guard": "71C2C7BB334FBFAE3C57B12A02877501C45E663FD56FFCD50F88ED8EF2758512", + "QualifiedE4PLShellElement._committed_current_binding_payload": "43825C13F7EA9550C23598C187528DEF9AF5B4CF6CD7DC921C7325C1DD224B35", + "QualifiedE4PLShellElement._compute_committed_current_tangent_components_unchecked": "BDD158A7D7DA065658C2841CD6164EDBF28E956413B83CF6DCE2E9E59041ECB8", + "QualifiedE4PLShellElement._constitutive_and_drill_stiffness": "80C01B8F97F0CF8361B527BF45D66B7DBD06DD99D4D0F4EA36EDEEA25AED201B", + "QualifiedE4PLShellElement._current_state_cache_transaction": "2E9C557CD7E6D9E4777E6A5B3AF101A99181DACF0434AB1970546E6C47F0AA58", + "QualifiedE4PLShellElement._defining_class_input_snapshot_matches": "BAFC2DC67DA81109295E392C7714D636919173BCE78272ECFDC623020D223DBD", + "QualifiedE4PLShellElement._elastic_increment_admitted": "181A231BEC8A4BC3DD2B9D83BE1CBCB9CA3572D353EB0216EBFB5562BDF70D52", + "QualifiedE4PLShellElement._elastic_increment_response": "0EFF9DB4DA6AB320DDAA8A440FA91EAD1A81B8C1145CEF9B8373CCF2C1761609", + "QualifiedE4PLShellElement._generalized_section_in_frame": "E39AA6C13BB205EF599749F8C4B600B10B91389F728C7431B959D26BFEE36952", + "QualifiedE4PLShellElement._inverse_planar_jacobian": "388CB635DD5922C031E82B2C5DC4322F06B404CA92482C58E3A6BB7ADBDE37DC", + "QualifiedE4PLShellElement._is_compact_batch_constitutive_state": "EF6AD7F9620B26FD5644914DF1A99518D81FF30D8AB82DC64334BD1319E661C8", + "QualifiedE4PLShellElement._local_frame_and_derivatives": "CDC56246DAFEF34AA9674130859EFFDCF88C92A3D97F4DFA2BE8E52B6A8CCD31", + "QualifiedE4PLShellElement._mitc4_shear_b_matrix": "8F60FB9797220A8280211067CCDDF0A30C1E965827DC94E0C64839C0D6630A1B", + "QualifiedE4PLShellElement._nonlinear_geometry": "7EA2A4BCE7E48995431A58E274B21628ABE5F1F55EB96118AC3F08DA3538AC13", + "QualifiedE4PLShellElement._nonlinear_response_core": "D8473FD05059C05B3383A4E13A6BF13D8B8D082A9A9514E0F841DA81B02AB2B6", + "QualifiedE4PLShellElement._physical_director_context": "1E4C769B2D017E25475613E26F7695484615047711D6A3FF52FC72D86EB877A6", + "QualifiedE4PLShellElement._qualified_linear_correction": "221228A0BD08F4F6B78BB86094C69EB015FEFE3C8285B890EFC22CA2B5249C53", + "QualifiedE4PLShellElement._qualified_stiffness_cache_key": "5D619CCE4A471CA2E4A300FCF0A6673B88032F0171947773BEE10C7727D39E1B", + "QualifiedE4PLShellElement._recover_planar_mixed_fields": "6F72D7DFFF5A52032756CF5D3C4DB721285CD3C91AA9AB5EFB3CFE5C338F0338", + "QualifiedE4PLShellElement._recover_warped_generalized_section": "53CFB1688CE4E6BF3D1BE40899C75F62A3D760CF7293E29D7B7A63DF67D984B2", + "QualifiedE4PLShellElement._recover_warped_homogeneous_section": "66B16D18DDB97EEAD4110540CA4F2322120820046C85B699810C1413F7BFBD4C", + "QualifiedE4PLShellElement._reject_noncurrent_activity_disposition": "2D72537BC89733A9C30EBF229254D6597EFDFB1552A2D8783E798C2B43D45D2E", + "QualifiedE4PLShellElement._replay_accepted_algorithmic_response": "7A4EBA41D14BDFDC9F5E7863D1508424A673449C50DB08DCD5E7D16CE4650640", + "QualifiedE4PLShellElement._requires_algorithmic_return_map_origin": "40B2D2D62BA5A3F3A3E558473513A0CEF2FA552E0AF6B3BAFB27C6C253A166F2", + "QualifiedE4PLShellElement._stable_state_identity_payload": "C9A1B751809BAEC87C86CC73C479294EC84C6F9678A0DC7B4A4A928C13323147", + "QualifiedE4PLShellElement._validate_committed_current_kinematics": "54AA5E42F9A863A22DB99777D9D1233F03DB2924A7E92DFD7FAE884A4EA09C17", + "QualifiedE4PLShellElement._validate_committed_state_at_configuration": "6C7DDE06F660E1679E3EEF3AF6B7B252D355B0311A494AE0FC236F8A5AECBE83", + "QualifiedE4PLShellElement._validate_qualified_component_cache_identity": "A48DF8CC73BB3234FD2CB43098D7C46C1889CB1155FA9DEFF3704F6AB7425169", + "QualifiedE4PLShellElement._validate_qualified_component_guard": "3F79E9E4B186336AEF1B00E0181A353225F81703C23DF9B1480520080102C44E", + "QualifiedE4PLShellElement._validated_algorithmic_origin": "876003B4A702F9B9B8C1A13AB789320CC559E7AE6913CF7BE6925FC6463E4D37", + "QualifiedE4PLShellElement._warped_generalized_drilling_correction": "7182F41C3B57D39B5BD438BD0A83BAE3D3479F59A1B82F71D78F858721DCEBEB", + "QualifiedE4PLShellElement.attach_current_tangent_algorithmic_origin": "BD236A34DFBED4B84933442DC213900AA9905CB26600462740F5069D26A6CD00", + "QualifiedE4PLShellElement.compute_geometric_stiffness_matrix": "ED88FB6EFBBFF2A7F3238674EE9590E2945674FCED5E5A8A11CDBE719063478B", + "QualifiedE4PLShellElement.compute_mass_matrix": "94B6935ACC4E5924DC700815849275F842C3AD3CBB85BD03E6511E36BCBF4C45", + "QualifiedE4PLShellElement.compute_nonlinear_response": "D51D6178E7FB64AD47A6167B941386EF7CAB759CAF295AB521C195984CE71849", + "QualifiedE4PLShellElement.compute_stiffness_components": "772395F696B7667B8E391D25E9E7DFC613E801986CEBCBC0FBC9B41431CBB00B", + "QualifiedE4PLShellElement.compute_stiffness_matrix": "011434A73322E826188C0F18D63318B25C29600C328A5CCCED876E2AA2478453", + "QualifiedE4PLShellElement.compute_stresses": "8CB8E6AB573F619CD7DE71CCD745ED67255BF74201FF2034498F5F9760AC2F01", + "QualifiedE4PLShellElement.get_node_coordinates": "0E461353A19DA39F78FEED144AB37050AF8D081EF32D370A5756D8356EA3503B", + "QualifiedE4PLShellElement.numerical_internal_force": "E7B50FB6E06654007803832D0ADBB3B599F300B0D0EE532011E9DCA43A620343", + "QualifiedE4PLShellElement.physical_reference_director": "DD651C0D60E6026B4BBA29A4AFA405999D62FFF136B82DE6B3FB776EF6935CEE", + "QualifiedE4PLShellElement.to_dict": "C92349ED5BDB27E763CAA1BFE9EE1513B09E7CB0CD3E5B7CE8A842366BE263D9", + "QualifiedE4PLShellElement.validate_committed_current_tangent_binding": "8000EFAB0CA5E81856A37CCBE3F59185C7972DE2266A95E3A1A6A935EEF1ADE0", + "QualifiedE4PLShellElement.validate_committed_current_tangent_semantics": "65B908DDEA6DF6739EF0E6F842E6F90A3D6250D754F8DAE9DB75E25D589D5138", + "QualifiedE4PLShellElement.validate_committed_current_tangent_state": "AA90AB1B5C893982F6712BF3009CAC85A1D62301730B81E422684159C708A487", + "RECOVERY_POLICY_ID": "47FE28010A4063852F3007409B5806350B62B3D71937C34789C971CFE8BE44BD", + "STATIONARY_SOLVE_POLICY_ID": "6B2CAED2AC65BF41E19E9E054FAC98F69463CDE6F54B6692E597804D44026112", + "_FOREIGN_S3_ACTIVITY_DISPOSITION_KEY": "FCF112A985F56AE95EFF16F746905A7A6F1894EFACFDB981DF75E38130A830BF", + "_GAUSS": "9B6472DC3D2567636D7E39654D2A109B45350DAD4AE5F3E8B55176B443A7DAC3", + "_PLANAR_FORMULATION_ID": "B7FC645DC4A439E1EDF59DB204E39B0BE28E67706A7C8CB4BE54239C11A2D724", + "_Q4FastInputSnapshot": "4EF9A28047874004FE3F6A765D39835AEE6BCE0FF1408EC4E2D3D8DB4B9F4FAD", + "_Q4_ACTIVITY_DISPOSITION_KEY": "1136DE34B6EA5F3734F602BE539B3CB0550497D6B80A1ABC851944347380EF44", + "_Q4_COMPACT_REPLAY_MAX_ULPS": "B21D58F9DC39ACEF52F395D5131B5BC99427A1FC23C710A9C627C568921C1DA8", + "_Q4_CURRENT_STATE_ALGORITHMIC_ORIGIN_KEY": "6343AEC622F063D75280ED3AA3ADA32AE4F6A46773A13A6FF9CC586E278BACFC", + "_Q4_CURRENT_STATE_BINDING_KEY": "D3300AF17D68C17911D0709CA8BE621FF762D8FAD6D94A4EB13804D4312F5F6D", + "_Q4_CURRENT_STATE_DIGEST_KEY": "420EB270766605589FF7B6F675D78C34622868709FF149B58C1D63E5E44CD366", + "_Q4_FAST_COORDINATE_FLOAT64_TYPE": "674605C5F6072EF923C201433BC21C7DD94F7FA971E6E47FC2F1E5E84DB331E4", + "_Q4_FAST_ELEMENT_INPUT_NAMES": "726C915EACF17E36BF5C4EA55776F6368EB312F2114B9C1D30396C8EE60E7518", + "_Q4_FAST_ELEMENT_ITEMGETTER": "A760DDF2E068B6FF5B19E1CB11D9A52C579BACAD3D45C983C8E03115200F0BAD", + "_Q4_FAST_FORBIDDEN_INSTANCE_SHADOWS": "21857076D104AD1C91F0CE34DFDB8A3453927853EDFF5E41F4165A8BD1989709", + "_Q4_FAST_FORBIDDEN_MATERIAL_SHADOWS": "27B8F905D0B0BF674E13934088A4C4851235AC4F1C1024C243029D236EA1D527", + "_Q4_FAST_FORBIDDEN_MESH_SHADOWS": "30B8B779C02FDB2B4464E3066716B671A1931C971D498FCA1A94411BF5F59601", + "_Q4_FAST_MATERIAL_CLASS_ITEMGETTER": "68A6068789D43167951D2C39B3C529A741930DCD09545EBDC0EF87555017DCC0", + "_Q4_FAST_MATERIAL_CLASS_NAMES": "396996CC8FAF306631356EE063DB0DBC5BFE1E46695358EFE8E267BB60848D54", + "_Q4_FAST_MATERIAL_CLASS_VALUES": "DBA4DCAE39C154237CD5347DE5587F28E1D584091DEE2B2055D9C5092ECE7EEA", + "_Q4_FAST_MATERIAL_INPUT_NAMES": "1A2FE539EC8F89A5470554434D655F4E9B62F3A9A248103A1A8569BF75D8FE90", + "_Q4_FAST_MATERIAL_ITEMGETTER": "93D3E7FA669B898F3BAEB49212A7B8598F5F0B44B4711DEE8DF896C071648F5D", + "_Q4_FAST_MATERIAL_TYPE": "ED1EE96EE54B9E76F2128E7CCEA26374D732326A0AEA8ADDC4CBDAF04E4EF774", + "_Q4_FAST_MESH_TYPE": "7CDBF56FB1268B5EE0ED44CEAE135935E39A665125EFF65030D1807336936F40", + "_Q4_FAST_NODE_ITEMGETTER": "5E5C48CAF56343EB4761F4D07561A33D3D95C56A1D1EB12F065A655A8E8753E5", + "_Q4_FAST_NODE_TYPE": "BB7F40C580F191A5FD9678344DE5FA342B9841B3FB49C13B66FC21278C3A7AF1", + "_Q4_FAST_OWNED_MESH_DERIVED_KEYS": "51897182E61993A94AB925A47A2880AA46A5C86EBCAB60238CEF698D1BBC6BDC", + "_Q4_FAST_STATE_MAPPING_TYPE": "D670F4495A5DE98993F12A07805EFF3C6EDD112960AB3A79BE67C22DB12A4359", + "_Q4_FAST_TOKEN_TYPE": "DFE37AF7FF4B3BDA7CBFF1ACE65D4C070C19A5D9C6F96C1C914881D60DB3764A", + "_Q4_GENERALIZED_SECTION_NAMESPACE_AUTHORITY": "44FEF651F69FE3FE15E87B16FFC7222DABDC90330DC1E1B172EEE79FB9371EAD", + "_Q4_INITIAL_STATE_KEYS": "84AD55758991E7BAC7B711F884E671875947ADD51C1A960DEB00281DC6B833CA", + "_Q4_QUADRATURE_ARRAY_AUTHORITY": "A6272E5189AFD5EF869C8A295BD58AC36CF4C75E02ECC390ACAC4E047C791F6D", + "_Q4_QUADRATURE_CLASS_ARRAY_AUTHORITY": "07D49AFB7399C5191C7583A28AE7E43F0E4C59BD2E61E1C6732632E2E603FD78", + "_Q4_QUADRATURE_PROPERTY_AUTHORITY": "C3BC148DDD36399D2CF47BFD387B0BCE6EF625EAF39B6C714AF32B132FD6D5F6", + "_Q4_SERIALIZATION_CLASS_IDENTITY": "FD53DB331E5FEF8494B911D1663EC76122EF883008BEBF9BA896B50641D58A5A", + "_Q4_SERIALIZATION_GLOBAL_IDENTITY": "BE69EFC9877E53294225A31782C1586D04AF9CC9C39735366918F57B9062A214", + "_Q4_STIFFNESS_STATION_AUTHORITY": "32985D259CB90A7E1FB069179C3D748505CDA06AAEF0EC03EF6841C7F89488BE", + "_QUALIFIED_Q4_BASE_ELEMENT_SERIALIZATION_KERNEL": "12F40B5AB048AB090BA4FB727A40D8E4593EB1766F602FACE3367B8F8AFED48B", + "_QUALIFIED_Q4_BASE_GEOMETRIC_KERNEL": "F17B9BD67900F025A3E94EFFBAFDF93DA10797964DAC7A49B3DAD88B883B7D30", + "_QUALIFIED_Q4_BASE_LOCAL_FRAME_KERNEL": "F0808412F80A90FA180C78931E83E79ACBD59995091B48BA0A922F7869457F42", + "_QUALIFIED_Q4_BASE_MASS_KERNEL": "6A01B07FFAF490ECD144202CE42576ACF2D7BD9B13D67032039EB407EF70946A", + "_QUALIFIED_Q4_BASE_MITC4_SHEAR_KERNEL": "DC10080C2FCD3F7E2CEFB4C47F52F6B15A4A1C8A054D3D8BDF8169E933FD509F", + "_QUALIFIED_Q4_BASE_NONLINEAR_GEOMETRY": "CD4B504B9635A6C5F384E684F13476C909C959B66DADB679C0A2DF588A2E788B", + "_QUALIFIED_Q4_BASE_NONLINEAR_KERNEL": "822592C43B5F709A6B2EE33DDC1E92E6FB739AD5BAD0180CBC2A24879FEA9AC6", + "_QUALIFIED_Q4_BASE_SERIALIZATION_KERNEL": "7C7E533C553A06818F510786EE16335EF8E51D6C170018EF226C1045134A9AE5", + "_QUALIFIED_Q4_BASE_STIFFNESS_KERNEL": "FF7AFE7DE78510D4F806234C4AD173BD7FA22DB78FDD6A46EB1A20863CCA6AD7", + "_QUALIFIED_Q4_COORDINATE_SCALAR_TYPES": "62BA61A537A3611C8841F2EEF8B33B8C914A206D179ACF825F3F54B3FA877F5B", + "_STATIONARY_BACKWARD_ERROR_LIMIT": "CE09EA360BDED7520D2722C54DE027C1328F919299FFF9D98CCAAF769DFFB7B2", + "_STATIONARY_RUIZ_ITERATIONS": "DA8C97F0871B7865261251B93AC3BA7384A53433088410D1E62C06FB588FE6A3", + "_STATIONARY_RUIZ_ROW_NORM_RATIO_LIMIT": "0C8A1814D94666987F7F4A357A769442DF9CC5F34FA64289043174C0BC381A46", + "_V5_IMPLEMENTATION_ID": "D3102C03F47451E5269063FD1EA0532ECB84D1A32C773D2EEB599639BB570397", + "_V6_CURRENT_STATE_BINDING_SCHEMA_ID": "F1DDF2007C3DEE0C0423365C4632BCAD515934EED1DB7AB11F31CA468006ADB4", + "_V6_CURRENT_STATE_TANGENT_DECOMPOSITION_POLICY_ID": "CB69EB62CBC093F08115092EBB1796F4DC8F3A2A33AF71C33014B4A4D653022C", + "_V6_IMPLEMENTATION_ID": "A90F3A4DD539701BB2ECF5DF2221AFE69956B22AFDB022D90D9E5C3F6CD27F0B", + "_WARPED_FORMULATIONS": "AE90097F6596CD53934268853370551A1D434953AC1DE368EB0A9C20D1476C8F", + "_binary64_vector_fingerprint": "DC1275A227F30113669555E8C0A4E3BA1651740D88B58A49D31ACEA8FD104BCD", + "_capture_q4_fast_array_authority": "D3F3B7EC895F8B4CC6E5F555E50D69DABF14CCBCBA32B1A4673D25C5CAEE6DBE", + "_capture_q4_fast_input_snapshot": "5BAFACE30522E87ED41B4F04D0CB7A40ECF8AA0075AAA928E454FED51D1E20B1", + "_centre_taylor": "A4EBEE30A1BB6745A4818172ABB5972CEFA55E3F2B41925EEA7844AC74BD96C9", + "_characteristic_length": "9C66185F09517C950280ED575A38A13AA1A948CBF1595F06399BA8816B0D4D49", + "_coefficients": "E107C7F3C6A78728D002F3D5AED65A138CBFE02778ED5AAAF5413FF533E7534C", + "_compatible": "C56107FFA80452E55C4703E5B4F1E98D6FE339A4904169695F31E66BF8056187", + "_freeze_qualified_component_cache": "95B54BAF4F4858C49D9AAF5ABEE2CBB029085C9B596A8F9F9BDB35D3A872AC63", + "_global_transform": "D0310FA446C683BDD4D0C2ABA265F678EFDC840725F29DB5594B7E84A86C48B6", + "_invariant_generalized_drilling_scale": "044E3482E303D0E0855B8EB212CDCB4D6CD61641DFE460AE04D015F2900EBB85", + "_jacobian": "93C774DE7BEE9FB2432EAB2F8AEC287A10DC65E8E93D2607C0C49A6AE89975C9", + "_local_jacobian_scale": "1EA41F721B1BC849BD1CBDE267CD0A5EB0DAD69E3B4218D22B76CF474C0A02D9", + "_natural_shear": "DF29EF11AC584B74ACD932185929AF1B64EB484B36BBDA0FB9A797C150090466", + "_normalize": "4DFDCA5835C16CA5E7D1FA690A1418FD84440B9E4E9AB427C32B8F1337990436", + "_owned_q4_quadrature_array": "7A66C3B5AB12D2D426323106F31ABA29962F3BEB3A4D53C2BD8C0CD30F40DD8D", + "_q4_compact_replay_last_place_equivalent": "44AADA3FE157A00B770A9A81E9929D0C8FAB928C2D93BCA126D9D0B9F4FFD1F0", + "_q4_quadrature_epoch_guard": "495E22E1412D7CAB967188B9930AC5C9910AA0E48CF2453CBAB16B5F0ECA9E60", + "_q4_quadrature_epoch_manager": "64C02A8828128030E338DD22F46F4ABC4FE2BAF1A6AB066EA9026C20E76725F7", + "_q4_serialized_output_boundary": "F4EBE89B79457105DDBD2309B5E14BE621CF5CCDE42B0205ED4BC846B6DAFA73", + "_q4_state_payload": "7B8DEB51D11C69281E5ADD7896B51B7B4A25EF5A14511C14FBCF47EB1D1B1B90", + "_qualified_q4_layer_count": "972E8A85FCDED26370F5A316C06C112F846BE8BCF432FD545A515563769F4171", + "_require_exact_readonly_float64_array": "8679573FA5508E0195CA910B66B9C086804947A32DC93C2C0CE9B72FEC1EFF8B", + "_require_q4_fast_array_authority": "EDA147C139DCEE9D320A6EFD422CAE93172207F7E31F142F3E24E25D7905F5A5", + "_require_q4_fast_base_authority": "9A8E5CE424B3DB702B8F4F4AE28A256BE3718481E44BE0B990F5C2B68992B948", + "_require_q4_quadrature_instance_authority": "E43066E9BEA1D78E1CFF9057A837651F73AA2E43AFD629BF9F639AE0D321E3A6", + "_require_q4_serialization_module_authority": "EED856FEF1FB691BF13EA5E40399BD3ACA8D74D1FBBA6E97FA3ED7AFCFB90741", + "_residual_mode": "6CCD74BF95E6A87F18C97C419BA2CB393DB618FB41CC7244345EDCD8F285E74B", + "_shape": "9C7DD808A791D9035CB6D318AB9D1001956D63D8AB843C536BB454EF9250BCC2", + "_shape_derivatives": "5A09095FDD5B020F013A73DBAD6E6C2ED37DCABBC41CE983DA94B6D979693A42", + "_solve_stationary_system": "E9241411C54893A71E59CD952EC986FE321DC252533E5BB03D85641D82CB2A3F", + "_source_fields": "4572342DEC864F1F5F0393ED36F603A6DEBD11A8F0D3E3BAD5CA3BD9FCFFAEA9", + "_static_mro_attribute": "6E050C13689DFFC3D23EC5D352E91237C3D8C0C48542025A0D87E4108A074BAC", + "_stationary_backward_error": "C0A4E32C0D7156EA1AE1B7DE80F558F036750E6AD4B28B0C724643BE91899D2F", + "_stationary_blocks": "D45393BFF0B769C9D74D0F7184262840961B243695FEF91A682EE120B182AC79", + "_symmetric_ruiz_congruence": "8A6461C35D944AFD566218A16B89AE9E9E0F34E6AC7E1D3B7761CF58F918888B", + "_tensor_transform": "B7C35BE1CDC8019B107044D3A8C43D47EAFBF5FCB12BB8977B0110C482EF6CB8", + "_validate_q4_quadrature_authority": "323F88B4FD89E5E44F893627AFA37FE626E695A9FBC69DCB3D300C6D5E521FAC", + "_validate_q4_quadrature_authority_exact": "C3828E97840760FB4D83458284CD7B8D1BF4CAB060A30BFB0EB872664576BCB3", + "_validate_q4_serialization_authority": "869C1DDA1AF7F52996CF4328A87A23D3D65DA98E20621A74B8493BDFAA57FCF9", + "equation7_frame": "33C7A8D30CDF8C226F309BCF9C415525E1976BAE70FDA94B4CDCD09B822CDF2E" + } + }, + "mechanics_aggregate_sha256": "996C94581594E958545D5D64F25D1864942941A5B766BE88A79A4991BD4DE95C", + "observed_focused_pre_reader_integration": { + "all_source_symbol_delta": { + "files": { + "src/anysolver/e4_pl_element.py": { + "added_symbols": { + "QualifiedE4PLShellElement._defining_class_input_snapshot_matches": [ + "A1E66144D9E9343DE45F74A5FC3494367B95D39EE03BA3433404DBEDD9779845" + ] + }, + "after_source_sha256": "3785607e88af2985bc702a908724d0d5cc23f3519583c1bf176b257dc3d1bcad", + "before_source_sha256": "cafaa89cd840c6d1b1b9b66cf890d0b5d3dd2f1b57c5e431760144530a942dcf", + "changed_symbols": { + "QualifiedE4PLShellElement": { + "after": [ + "FC8F9009150DC6B2090C5C0BA19BB6EC950ED205308C72DB550CD9EA91DA86E6" + ], + "before": [ + "E73427EA2AD6D3EA4F7ECDB09BCC196489F9B7B50AA347170C0095E13BADF034" + ] + }, + "QualifiedE4PLShellElement._compute_prepared_nonlinear_response": { + "after": [ + "52000ED290A7F0B0F51A1F56F7E8191AE728ACE5376E3B6F252545AF98FF35EB" + ], + "before": [ + "5EAD4BF4FF6B662A95EE350AA9674976B1070C5BADC383772E5B6948C88BF3AB" + ] + }, + "QualifiedE4PLShellElement._elastic_increment_admitted": { + "after": [ + "AF1CC82F1B049B3AF5650805D1379FE178E92C7DE0D0CB3ADD6AB939EF2DA8C4" + ], + "before": [ + "EF28AC85278BBAF47F8E72A85ABD3B64F8911DE8A1184570989F899FC79E28CA" + ] + }, + "QualifiedE4PLShellElement._elastic_increment_response": { + "after": [ + "78280014F13C27892FE471C8651C655610D1B019FCF37FC0FDBD94C0F3E72E79" + ], + "before": [ + "26D37A2958D4DD9F31A70E69D467B82826CF5950B7B23AE18E6871AC919A1703" + ] + }, + "QualifiedE4PLShellElement._prepare_nonlinear_linear_correction": { + "after": [ + "D939884E95AC82F865DADC33D613A1187478ED071480928BB85BF60EC16EA7DD" + ], + "before": [ + "03A22275FC67C5AE11955691AA1C1ACE3D19A398088EADF9150E5C0986A707FC" + ] + } + }, + "removed_symbols": {}, + "scope": "ALL source declarations/assignments, including symbols outside original qualification roots; containing ClassDef also changes when methods change" + }, + "tests/test_e4_pl_s3_mixed_mesh_manifest.py": { + "added_symbols": {}, + "after_source_sha256": "b28f9dc236583146d760ee3f9acddff4d78f2811da27a7bc7d42562ae2ebbef2", + "before_source_sha256": "5c70459c5279e5d4c5ee7be050673d27d690c445f3e7de0abe77d648c4bf721d", + "changed_symbols": { + "test_q4_mechanics_closure_binds_physical_director_dependency": { + "after": [ + "E8CF745176A2744D7F634618A57598A09975C4B7EFFEFBB22170298219EDE009" + ], + "before": [ + "D2D1720100DD061E2B7CBAC41FD9F4D8DE94E5814BB0AA4DC3D00773AB8F10E3" + ] + }, + "test_q4_mechanics_symbol_authority_rejects_missing_duplicate_and_change": { + "after": [ + "CC625AB6470EE15D36EEC5F5F9AF4C79289377309F895C312CD998F36392F0DD" + ], + "before": [ + "BC7E4C5BBE26B3F5254DED7AE18B58E5F2A092533838984CEEC6FC0F734C8444" + ] + } + }, + "removed_symbols": {}, + "scope": "ALL source declarations/assignments, including symbols outside original qualification roots; containing ClassDef also changes when methods change" + }, + "tests/test_general_contact_c5_elastic_increment.py": { + "added_symbols": {}, + "after_source_sha256": "cbb3b879ed4e9eb6d0d8e746f7bdcfd0f3d5af0988986955d1fdc1b8e1066668", + "before_source_sha256": "65844f0b4cbf5cd4b1fefc67a8095658890e43fa56329220ba55345a4555dd9f", + "changed_symbols": { + "test_original_snapshot_spans_every_preparation_boundary": { + "after": [ + "F9EFCE6A4824EE841F64099AF9339AC368310F0258F3CA0165DAF0D997FEC50C" + ], + "before": [ + "95F658C009864918BD8FF1E53A4ACD7CC4CE67418433F0EC333B5D3595E79434" + ] + } + }, + "removed_symbols": {}, + "scope": "ALL source declarations/assignments, including symbols outside original qualification roots; containing ClassDef also changes when methods change" + }, + "tests/test_general_contact_c5_numpy_coordinate_admission.py": { + "added_symbols": { + "test_defining_class_admission_authority_rebinding_refuses": [ + "1F604A68D64FD9639005514FA7CB33CBBE63204C21D761F8B9776D275A56E32A" + ], + "test_defining_class_cell_change_refuses_and_restores": [ + "B518D5CB024736B62155DF48875C09BE23061B394C1698322DC4B3FF9050689C" + ], + "test_defining_class_matcher_refuses_subclass_without_selectable_class": [ + "DBC541ACC16402978B93A1FFBF44F4B6F2D38D324E358936299D788C51E4E4E0" + ] + }, + "after_source_sha256": "6fef7b15c7fb7ea4560b45c62bbce91b10b9f12994d4965579b48720e91599c3", + "before_source_sha256": "7d32d02f0616891eac7c6061e81a7b569e5e99ad419e22edf08b32e537d910e8", + "changed_symbols": { + "test_numpy_coordinate_snapshot_detects_changes": { + "after": [ + "24E7699A676546BB1E2F87F2B3BCCD50C73281CF044DA38C368C0077C87664CC" + ], + "before": [ + "5DE74E53ABB8B8B6709F06F7D2303D00608DA108A0E6188AC47C75D181A09F15" + ] + }, + "test_raw_numpy_signed_zero_and_snapshot_identity_are_preserved": { + "after": [ + "6F850433C68158D70179DCF0FF812A3CF00F8E821E6E8E8FB079071936211CF7" + ], + "before": [ + "599DCC09D6D70501C10EE6EAC665B0CEBC83AFB3D161265670F883295845010A" + ] + } + }, + "removed_symbols": {}, + "scope": "ALL source declarations/assignments, including symbols outside original qualification roots; containing ClassDef also changes when methods change" + } + }, + "inventory_format": "SHA256_UTF8_AST_DUMP_ANNOTATED_FIELDS_WITHOUT_LOCATIONS_V1", + "no_arithmetic_source_edited": true, + "original_DAG_result_sha256": "f0d1bf4391a9e60e53a957b8dcc3ee4f29f4618fb5088cc4657974b6434ee8b1", + "original_DAG_reused_unchanged_source": true, + "qualification_accepted": false, + "status": "ACTUAL_ALL_SOURCE_SYMBOL_DELTA" + }, + "case_count": 41, + "charged_seconds": 36.976900837438734, + "child_sha256": "65d48c8ecfde84a4b495bbb8145f7f505c628e1660cc1cbff5e0c69585a16580", + "final_reader_test_bytes_not_covered_by_this_observation": true, + "inventory_sha256": "272cb4584ed3097a5b9de5ef2cae3dc190048a6251c463ad302f82ae65d9d241", + "native_sha256": "675095d92f72f0d2d6974657c5761ccc5468834ad693e75c01e2946c77ae8af1", + "phase_count": 123, + "result_sha256": "e6d51526ffceb7f1fdcdc286dcea5c5448034615af0e9b3508c7532d9a5c3f3f", + "status": "PASS" + }, + "original_collector_evidence": { + "actual_symbols": 159, + "closure_sha256": "01ebd604b86f3f595a69fb6e8842be605f98ce9b3b0a31fa1da25626e629cc6c", + "discriminator_sha256": "f0d1bf4391a9e60e53a957b8dcc3ee4f29f4618fb5088cc4657974b6434ee8b1", + "historical_symbols_actually_reachable": 129, + "result_sha256": "215a6de13549b6893e2046b070e0326e05ec83be7b996b1c5829ff1dbd63b7a6", + "roots": 47, + "scientific_acceptance": false + }, + "parent_closure_delta": { + "added_symbols": [ + "QualifiedE4PLShellElement._defining_class_input_snapshot_matches" + ], + "changed_symbols": [ + "QualifiedE4PLShellElement._elastic_increment_admitted", + "QualifiedE4PLShellElement._elastic_increment_response" + ], + "edge_delta": { + "QualifiedE4PLShellElement": { + "after": null, + "before": [ + "DIRECTOR_POLARITY_POLICY_ID", + "DIRECTOR_REVERSAL_TRANSFORM_ID", + "FORMULATION_ID", + "IMPLEMENTATION_ID", + "Q4_ACTIVITY_DISPOSITION_SCHEMA_ID", + "Q4_CURRENT_STATE_ALGORITHMIC_ORIGIN_SCHEMA_ID", + "Q4_CURRENT_STATE_BINDING_SCHEMA_ID", + "Q4_CURRENT_STATE_PROJECTION_POLICY_ID", + "Q4_CURRENT_STATE_TANGENT_DECOMPOSITION_POLICY_ID", + "Q4_DELETED_FROZEN_POLICY_ID", + "Q4_FAILED_STATE_POLICY_ID", + "Q4_QUADRATURE_AUTHORITY_ID", + "QualifiedE4PLShellElement.GAUSS_POINTS_2x2", + "QualifiedE4PLShellElement.GAUSS_WEIGHTS_2x2", + "QualifiedE4PLShellElement._accepted_algorithmic_update_fingerprint", + "QualifiedE4PLShellElement._algorithmic_origin_payload", + "QualifiedE4PLShellElement._bind_qualified_component_guard", + "QualifiedE4PLShellElement._canonicalize_compact_batch_constitutive_core", + "QualifiedE4PLShellElement._committed_current_binding_payload", + "QualifiedE4PLShellElement._compute_committed_current_tangent_components_unchecked", + "QualifiedE4PLShellElement._constitutive_and_drill_stiffness", + "QualifiedE4PLShellElement._current_state_cache_transaction", + "QualifiedE4PLShellElement._deleted_frozen_disposition_payload", + "QualifiedE4PLShellElement._elastic_increment_admitted", + "QualifiedE4PLShellElement._elastic_increment_response", + "QualifiedE4PLShellElement._failed_state_disposition_payload", + "QualifiedE4PLShellElement._generalized_section_in_frame", + "QualifiedE4PLShellElement._inverse_planar_jacobian", + "QualifiedE4PLShellElement._is_compact_batch_constitutive_state", + "QualifiedE4PLShellElement._local_frame_and_derivatives", + "QualifiedE4PLShellElement._mitc4_shear_b_matrix", + "QualifiedE4PLShellElement._nonlinear_geometry", + "QualifiedE4PLShellElement._nonlinear_response_core", + "QualifiedE4PLShellElement._physical_director_context", + "QualifiedE4PLShellElement._plan_invalidating_attributes", + "QualifiedE4PLShellElement._qualified_linear_correction", + "QualifiedE4PLShellElement._qualified_stiffness_cache_key", + "QualifiedE4PLShellElement._recover_planar_mixed_fields", + "QualifiedE4PLShellElement._recover_warped_generalized_section", + "QualifiedE4PLShellElement._recover_warped_homogeneous_section", + "QualifiedE4PLShellElement._reject_noncurrent_activity_disposition", + "QualifiedE4PLShellElement._replay_accepted_algorithmic_response", + "QualifiedE4PLShellElement._requires_algorithmic_return_map_origin", + "QualifiedE4PLShellElement._seal_committed_state_at_configuration", + "QualifiedE4PLShellElement._stable_state_identity_payload", + "QualifiedE4PLShellElement._validate_committed_current_kinematics", + "QualifiedE4PLShellElement._validate_committed_state_at_configuration", + "QualifiedE4PLShellElement._validate_qualified_component_cache_identity", + "QualifiedE4PLShellElement._validate_qualified_component_guard", + "QualifiedE4PLShellElement._validated_algorithmic_origin", + "QualifiedE4PLShellElement._warped_generalized_drilling_correction", + "QualifiedE4PLShellElement.attach_current_tangent_algorithmic_origin", + "QualifiedE4PLShellElement.compute_stiffness_components", + "QualifiedE4PLShellElement.compute_stiffness_matrix", + "QualifiedE4PLShellElement.get_node_coordinates", + "QualifiedE4PLShellElement.physical_reference_director", + "QualifiedE4PLShellElement.to_dict", + "QualifiedE4PLShellElement.validate_committed_current_tangent_binding", + "QualifiedE4PLShellElement.validate_committed_current_tangent_semantics", + "QualifiedE4PLShellElement.validate_committed_current_tangent_state", + "QualifiedQ4MigrationWarning", + "RECOVERY_POLICY_ID", + "STATIONARY_SOLVE_POLICY_ID", + "_FOREIGN_S3_ACTIVITY_DISPOSITION_KEY", + "_GAUSS", + "_PLANAR_FORMULATION_ID", + "_PreparedQ4LinearCorrection", + "_Q4_ACTIVITY_DISPOSITION_KEY", + "_Q4_CURRENT_STATE_ALGORITHMIC_ORIGIN_KEY", + "_Q4_CURRENT_STATE_BINDING_KEY", + "_Q4_CURRENT_STATE_DIGEST_KEY", + "_Q4_FAST_MATERIAL_TYPE", + "_Q4_FAST_MESH_TYPE", + "_Q4_INITIAL_STATE_KEYS", + "_Q4_QUADRATURE_CLASS_ARRAY_AUTHORITY", + "_QUALIFIED_Q4_BASE_GEOMETRIC_KERNEL", + "_QUALIFIED_Q4_BASE_LOCAL_FRAME_KERNEL", + "_QUALIFIED_Q4_BASE_MASS_KERNEL", + "_QUALIFIED_Q4_BASE_MITC4_SHEAR_KERNEL", + "_QUALIFIED_Q4_BASE_NONLINEAR_GEOMETRY", + "_QUALIFIED_Q4_BASE_NONLINEAR_KERNEL", + "_QUALIFIED_Q4_BASE_STIFFNESS_KERNEL", + "_QUALIFIED_Q4_COORDINATE_SCALAR_TYPES", + "_QUALIFIED_Q4_PROTECTED_CACHE_NAMES", + "_V5_IMPLEMENTATION_ID", + "_V6_CURRENT_STATE_BINDING_SCHEMA_ID", + "_V6_CURRENT_STATE_TANGENT_DECOMPOSITION_POLICY_ID", + "_V6_IMPLEMENTATION_ID", + "_WARPED_FORMULATIONS", + "_binary64_vector_fingerprint", + "_capture_q4_fast_input_snapshot", + "_centre_taylor", + "_characteristic_length", + "_coefficients", + "_compatible", + "_freeze_qualified_component_cache", + "_global_transform", + "_invariant_generalized_drilling_scale", + "_jacobian", + "_local_jacobian_scale", + "_normalize", + "_q4_compact_replay_last_place_equivalent", + "_q4_fast_input_snapshot_matches", + "_q4_serialized_input_boundary", + "_q4_serialized_output_boundary", + "_q4_state_payload", + "_qualified_q4_layer_count", + "_require_q4_fast_base_authority", + "_residual_mode", + "_solve_stationary_system", + "_source_fields", + "_stationary_blocks", + "_validate_q4_quadrature_authority", + "equation7_frame" + ] + }, + "QualifiedE4PLShellElement._canonicalize_compact_batch_constitutive_core": { + "after": null, + "before": [ + "QualifiedE4PLShellElement._is_compact_batch_constitutive_state" + ] + }, + "QualifiedE4PLShellElement._defining_class_input_snapshot_matches": { + "after": [ + "_Q4FastInputSnapshot", + "_Q4_FAST_COORDINATE_FLOAT64_TYPE", + "_Q4_FAST_ELEMENT_ITEMGETTER", + "_Q4_FAST_FORBIDDEN_MESH_SHADOWS", + "_Q4_FAST_MATERIAL_ITEMGETTER", + "_Q4_FAST_MATERIAL_TYPE", + "_Q4_FAST_MESH_TYPE", + "_Q4_FAST_NODE_ITEMGETTER", + "_Q4_FAST_NODE_TYPE", + "_Q4_FAST_STATE_MAPPING_TYPE", + "_Q4_FAST_TOKEN_TYPE" + ], + "before": null + }, + "QualifiedE4PLShellElement._deleted_frozen_disposition_payload": { + "after": null, + "before": [ + "Q4_ACTIVITY_DISPOSITION_SCHEMA_ID", + "Q4_DELETED_FROZEN_POLICY_ID", + "QualifiedE4PLShellElement._stable_state_identity_payload", + "_binary64_vector_fingerprint" + ] + }, + "QualifiedE4PLShellElement._elastic_increment_admitted": { + "after": [ + "QualifiedE4PLShellElement._defining_class_input_snapshot_matches", + "QualifiedE4PLShellElement.get_node_coordinates", + "_Q4_FAST_MATERIAL_TYPE", + "_Q4_FAST_MESH_TYPE", + "_Q4_INITIAL_STATE_KEYS", + "_capture_q4_fast_input_snapshot", + "_require_q4_fast_base_authority", + "equation7_frame" + ], + "before": [ + "QualifiedE4PLShellElement", + "QualifiedE4PLShellElement.get_node_coordinates", + "_Q4_FAST_MATERIAL_TYPE", + "_Q4_FAST_MESH_TYPE", + "_Q4_INITIAL_STATE_KEYS", + "_capture_q4_fast_input_snapshot", + "_q4_fast_input_snapshot_matches", + "_require_q4_fast_base_authority", + "equation7_frame" + ] + }, + "QualifiedE4PLShellElement._elastic_increment_response": { + "after": [ + "QualifiedE4PLShellElement._defining_class_input_snapshot_matches", + "QualifiedE4PLShellElement._elastic_increment_admitted", + "QualifiedE4PLShellElement._nonlinear_geometry", + "QualifiedE4PLShellElement._validate_qualified_component_guard", + "QualifiedE4PLShellElement.compute_stiffness_matrix", + "_capture_q4_fast_input_snapshot" + ], + "before": [ + "QualifiedE4PLShellElement._elastic_increment_admitted", + "QualifiedE4PLShellElement._nonlinear_geometry", + "QualifiedE4PLShellElement._validate_qualified_component_guard", + "QualifiedE4PLShellElement.compute_stiffness_matrix", + "_capture_q4_fast_input_snapshot", + "_q4_fast_input_snapshot_matches" + ] + }, + "QualifiedE4PLShellElement._failed_state_disposition_payload": { + "after": null, + "before": [ + "Q4_ACTIVITY_DISPOSITION_SCHEMA_ID", + "Q4_FAILED_STATE_POLICY_ID", + "QualifiedE4PLShellElement._stable_state_identity_payload", + "_binary64_vector_fingerprint", + "_q4_state_payload" + ] + }, + "QualifiedE4PLShellElement._plan_invalidating_attributes": { + "after": null, + "before": [] + }, + "QualifiedE4PLShellElement._seal_committed_state_at_configuration": { + "after": null, + "before": [ + "QualifiedE4PLShellElement._canonicalize_compact_batch_constitutive_core", + "QualifiedE4PLShellElement._committed_current_binding_payload", + "QualifiedE4PLShellElement._is_compact_batch_constitutive_state", + "QualifiedE4PLShellElement._reject_noncurrent_activity_disposition", + "QualifiedE4PLShellElement._replay_accepted_algorithmic_response", + "QualifiedE4PLShellElement._validate_committed_current_kinematics", + "_FOREIGN_S3_ACTIVITY_DISPOSITION_KEY", + "_Q4_CURRENT_STATE_BINDING_KEY", + "_Q4_CURRENT_STATE_DIGEST_KEY", + "_qualified_q4_layer_count" + ] + }, + "QualifiedQ4MigrationWarning": { + "after": null, + "before": [] + }, + "_PreparedQ4LinearCorrection": { + "after": null, + "before": [] + }, + "_QUALIFIED_Q4_PROTECTED_CACHE_NAMES": { + "after": null, + "before": [] + }, + "_q4_fast_input_snapshot_matches": { + "after": null, + "before": [ + "QualifiedE4PLShellElement", + "_Q4FastInputSnapshot", + "_Q4_FAST_COORDINATE_FLOAT64_TYPE", + "_Q4_FAST_ELEMENT_ITEMGETTER", + "_Q4_FAST_FORBIDDEN_MESH_SHADOWS", + "_Q4_FAST_MATERIAL_ITEMGETTER", + "_Q4_FAST_MATERIAL_TYPE", + "_Q4_FAST_MESH_TYPE", + "_Q4_FAST_NODE_ITEMGETTER", + "_Q4_FAST_NODE_TYPE", + "_Q4_FAST_STATE_MAPPING_TYPE", + "_Q4_FAST_TOKEN_TYPE" + ] + }, + "_q4_serialized_input_boundary": { + "after": null, + "before": [ + "_require_q4_serialization_module_authority", + "_validate_q4_quadrature_authority", + "_validate_q4_serialization_authority" + ] + } + }, + "interpretation": "14 edge-delta entries:11 removed nominal-ClassDef expansion/legacy-matcher nodes,1 added matcher,2 changed callers. No historical required symbol removed. Unchanged state/canonicalization/disposition/serialization methods retain their runtime roles; full raw file binding covers outside-root callers. Collector and DAG rules unchanged." + }, + "physical_acceptance_transfer": false, + "previous_source_binding": { + "path": "docs/reference_cases/e4_pl_q4_source_binding_20261016.json", + "sha256": "be903d0381248bec56b9c48e8ef90f119b0f15e133f1aebb9a5b89c341b8aa1b" + }, + "qualification_boundary": "SOURCE_BINDING_ONLY_NOT_SCIENTIFIC_QUALIFICATION", + "reader_identity_binding": "FINAL_READER_TEST_BYTES_SEPARATELY_ROOT_REVIEWED_AND_PINNED_BY_WHOLE_MODULE_CARRIER_NO_SELF_HASH_CYCLE", + "schema": "anysolver.q4-source-binding-successor-v1", + "source": { + "coverage": "FULL_RAW_FILE_INCLUDING_PREPARATION_AND_PREPARED_RESPONSE_CALLERS_OUTSIDE_ORIGINAL_CLOSURE", + "path": "src/anysolver/e4_pl_element.py", + "sha256": "3785607E88AF2985BC702A908724D0D5CC23F3519583C1BF176B257DC3D1BCAD" + }, + "source_binding_integration_review": { + "C5_exception_transfer": false, + "CI_credit": false, + "baseline_candidate": "e40298cc5f1fce3bc6a25b803874e32efb45dffd", + "changed_other_routes": "Beam yielding/condensed shear and finite rotating coupling are real changes; no whole-module/transitive numerical-equivalence claim.", + "changed_this_slice_semantics": "Metadata/reader-only slice; upstream carrier changes are explicitly recorded, not denied.", + "current_main": "4074eb8b163c1d04cd5e1faed742a237680c01fd", + "external_carrier_changed_since_predecessor": true, + "final_different_family_scientific_acceptance": "OPEN; supporting source review uses available OpenAI family", + "historical_41_case_observation": "Original pre-reader41cases/123phases and source/result identities retained from predecessor; not rerun, current science, or CI credit.", + "lifecycle_delta": { + "byte_reconciliation": "Exact committed LF bytes; previous CRLF working copy is LF-equal. No semantic change.", + "disposition": "Existing accepted immutable-vector identity/cache-lifecycle repair; review verifies exact current source identity. Not Q4 scientific qualification.", + "evidence": "docs/agent_plans/PR35_IMMUTABLE_VECTOR_SALVAGE_PLAN_20261016.md", + "path": "src/anysolver/fe_core.py", + "prior_windows_working_copy_sha256": "07549c53099a3f4b6ab91d3a4741bcda64a91126935450aa7e463ee0954932da", + "sha256": "2377a0b492113a6ac80b009cebc9849c83867f7ac367f0a7d5d15d6c26153c0a" + }, + "physical_acceptance_transfer": false, + "prior_elements_sha256": "293966acf50b06add3039905b5f1b682e17168fe832fae57d2b1c12efe602dde", + "product_edited_in_this_binding_slice": false, + "review_path": "docs/reference_cases/Q4_SOURCE_BINDING_REVIEW_20261019.md", + "review_sha256": "946dd42285a4b0eb9df5c143ea1c648fe75e19f8bd12e90e5edcd7b49f8f3449", + "unchanged_scope": "Exact47-root/159-symbol Q4 payload/edges/aggregate; entire Element/ShellElement classes; compensated helper and its relevant arithmetic declarations/imports; other two full raw carriers." + }, + "status": "ROOT_ADOPTED_PROSPECTIVE_SOURCE_BINDING_ONLY_20261019" +} diff --git a/docs/reference_cases/e4_pl_source_binding_20261111.json b/docs/reference_cases/e4_pl_source_binding_20261111.json new file mode 100644 index 000000000..e246e127d --- /dev/null +++ b/docs/reference_cases/e4_pl_source_binding_20261111.json @@ -0,0 +1 @@ +{"adoption":{"independent_review_required_outside_generating_invocation":true,"owner_adoption_recorded":false,"reviewer_approval_claimed":false,"status":"UNREVIEWED_CANDIDATE_RECORD"},"boundary_flags":{"C5_exception_transfer":false,"CI_credit":false,"historical_observation_rerun":false,"historical_records_modified":false,"new_physical_acceptance":false,"new_scientific_acceptance":false,"numerical_tolerances_changed":false,"physical_acceptance_transfer":false,"production_mechanics_changed_by_this_record":false},"carriers":{"_compensated_contractions.py":{"live_lf":{"bytes":23527,"git_blob":"6f0bce4a39de7a8ac74c7558978e346743719984","sha256":"43088D8059FE6481FAD64E63D7E20BA2DB32C223110F92BCC913BDD8C280B131"},"live_lf_after_reverse_spelling_map":{"bytes":23527,"git_blob":"6f0bce4a39de7a8ac74c7558978e346743719984","sha256":"43088D8059FE6481FAD64E63D7E20BA2DB32C223110F92BCC913BDD8C280B131"},"live_path":"src/anyfesolver/_compensated_contractions.py","live_raw":{"bytes":24024,"git_blob":"e82e10b1f74aeee44ccc9e3009444b668f1ed53d","sha256":"7C605295DFF6A63A5D2C3898F944B6CDC4E29D48CADDCFE6A62C5D1B60DD1BAD"},"module_symbols":{"added":[],"candidate_aggregate_sha256":"C572EDDEE22B4877A623772C91990392EA7F6B5514A9817A58093B05F7A8A376","changed":[],"removed":[],"upstream_aggregate_sha256":"C572EDDEE22B4877A623772C91990392EA7F6B5514A9817A58093B05F7A8A376"},"portable_text":false,"recorded_path":"src/anysolver/_compensated_contractions.py","reverse_spelling_map_reproduces_upstream_lf":true,"upstream_lf":{"bytes":23527,"git_blob":"6f0bce4a39de7a8ac74c7558978e346743719984","sha256":"43088D8059FE6481FAD64E63D7E20BA2DB32C223110F92BCC913BDD8C280B131"},"upstream_raw":{"bytes":24024,"git_blob":"e82e10b1f74aeee44ccc9e3009444b668f1ed53d","sha256":"7C605295DFF6A63A5D2C3898F944B6CDC4E29D48CADDCFE6A62C5D1B60DD1BAD"}},"_q4_assumed_strain_plasticity.py":{"live_lf":{"bytes":21262,"git_blob":"b78cf67beb8f11d1e0a239c05ee098417ecdfad7","sha256":"CDCA874F3572914C13C0AC710632714035322CDA0531A06B56B701FC0E240E0C"},"live_lf_after_reverse_spelling_map":{"bytes":21262,"git_blob":"b78cf67beb8f11d1e0a239c05ee098417ecdfad7","sha256":"CDCA874F3572914C13C0AC710632714035322CDA0531A06B56B701FC0E240E0C"},"live_path":"src/anyfesolver/_q4_assumed_strain_plasticity.py","module_symbols":{"added":[],"candidate_aggregate_sha256":"E74B41DCBCCA41F2581B6C7551DEE8D91951B4BF24B46D66A00D9B644C8F80FE","changed":[],"removed":[],"upstream_aggregate_sha256":"E74B41DCBCCA41F2581B6C7551DEE8D91951B4BF24B46D66A00D9B644C8F80FE"},"permitted_raw":{"crlf":{"bytes":21764,"git_blob":"68622a264aa806b5228d6c17839f1327cb170e03","sha256":"98BC1EB4DCBFF19A12C7F1EA3F4FED26A3CAB1146FD69393205644788420F636"},"lf":{"bytes":21262,"git_blob":"b78cf67beb8f11d1e0a239c05ee098417ecdfad7","sha256":"CDCA874F3572914C13C0AC710632714035322CDA0531A06B56B701FC0E240E0C"}},"portable_text":true,"recorded_path":"src/anysolver/_q4_assumed_strain_plasticity.py","reverse_spelling_map_reproduces_upstream_lf":true,"upstream_lf":{"bytes":21262,"git_blob":"b78cf67beb8f11d1e0a239c05ee098417ecdfad7","sha256":"CDCA874F3572914C13C0AC710632714035322CDA0531A06B56B701FC0E240E0C"},"upstream_raw":{"bytes":21262,"git_blob":"b78cf67beb8f11d1e0a239c05ee098417ecdfad7","sha256":"CDCA874F3572914C13C0AC710632714035322CDA0531A06B56B701FC0E240E0C"}},"e4_pl_element.py":{"live_lf":{"bytes":331362,"git_blob":"3ded2fff1472b8532f88223792232bf4aea2250e","sha256":"D597C84DDE8E3B280134C9DDF57CA5FF4F39FB748038C521AE50F2AEF5051E3E"},"live_lf_after_reverse_spelling_map":{"bytes":331358,"git_blob":"47efceacb07a9be0ab92542164e5dd3ca1ea0c63","sha256":"A1F7CE7E66BE66BA6E9CCEB80BE27D5D7EEEC38B01AD93673C264A4E008B00F4"},"live_lf_equals_v6_terminal":false,"live_path":"src/anyfesolver/e4_pl_element.py","live_raw":{"bytes":331362,"git_blob":"3ded2fff1472b8532f88223792232bf4aea2250e","sha256":"D597C84DDE8E3B280134C9DDF57CA5FF4F39FB748038C521AE50F2AEF5051E3E"},"module_symbols":{"added":[],"candidate_aggregate_sha256":"C08DE2F343056378B8A74A3D116475C5E131B1CA29C3BE6574B4654BF088BBB2","changed":["QualifiedE4PLShellElement","QualifiedE4PLShellElement.get_node_coordinates"],"removed":[],"upstream_aggregate_sha256":"397922BDDC46A6400C2936BEE55EC93010BC02156D80DB45CE258E233A3E7160"},"portable_text":false,"recorded_path":"src/anysolver/e4_pl_element.py","reverse_spelling_map_reproduces_upstream_lf":true,"upstream_lf":{"bytes":331358,"git_blob":"47efceacb07a9be0ab92542164e5dd3ca1ea0c63","sha256":"A1F7CE7E66BE66BA6E9CCEB80BE27D5D7EEEC38B01AD93673C264A4E008B00F4"},"upstream_raw":{"bytes":331358,"git_blob":"47efceacb07a9be0ab92542164e5dd3ca1ea0c63","sha256":"A1F7CE7E66BE66BA6E9CCEB80BE27D5D7EEEC38B01AD93673C264A4E008B00F4"},"v6_terminal_git_blob":"bd6c0dc2cb3661eb73942fc0fea56e527aa8d0b4"},"e4_pl_s3_element.py":{"live_lf":{"bytes":375685,"git_blob":"be978bd2beff2111166c754a35e911aa740196b8","sha256":"F56A3101A74333F35BA0A7162D221B491230E249899E5AB5A7D485ECE7D0ED1C"},"live_lf_after_reverse_spelling_map":{"bytes":375683,"git_blob":"8047c66f677be5214fb7457a0312492481fb7e93","sha256":"FAFCEDB3D19F2C4527F8FF9DD9A1B46FA4AF2971928AF437EB6AD9B0EB15B218"},"live_lf_equals_v6_terminal":false,"live_path":"src/anyfesolver/e4_pl_s3_element.py","module_symbols":{"added":[],"candidate_aggregate_sha256":"B5F79126F40BBCD82803647A6B8E4E1E4A31C26F785621DA5F9734A3C247DF16","changed":["QualifiedE4PLS3ShellElement","QualifiedE4PLS3ShellElement.get_node_coordinates"],"removed":[],"upstream_aggregate_sha256":"99D176BF8F531397A4E083E98667F405C3BAF33CE4D1D9422388EE9DC60BE046"},"permitted_raw":{"crlf":{"bytes":385437,"git_blob":"336cbf9673242908f4bc4b9250a58e55072181ed","sha256":"FF244CFD328968C0B30A3E64DC3CC9E08504E4767F90D2EA55E23DBBD1D5FFC2"},"lf":{"bytes":375685,"git_blob":"be978bd2beff2111166c754a35e911aa740196b8","sha256":"F56A3101A74333F35BA0A7162D221B491230E249899E5AB5A7D485ECE7D0ED1C"}},"portable_text":true,"recorded_path":"src/anysolver/e4_pl_s3_element.py","reverse_spelling_map_reproduces_upstream_lf":true,"upstream_lf":{"bytes":375683,"git_blob":"8047c66f677be5214fb7457a0312492481fb7e93","sha256":"FAFCEDB3D19F2C4527F8FF9DD9A1B46FA4AF2971928AF437EB6AD9B0EB15B218"},"upstream_raw":{"bytes":375683,"git_blob":"8047c66f677be5214fb7457a0312492481fb7e93","sha256":"FAFCEDB3D19F2C4527F8FF9DD9A1B46FA4AF2971928AF437EB6AD9B0EB15B218"},"v6_terminal_git_blob":"adc6562cbd3fb768d7f0d0ab69011f21ff7c9392"},"elements.py":{"live_lf":{"bytes":254394,"git_blob":"beae44a0c8beb310072c3e12556e249cbd739fc8","sha256":"47F3D2D8474ACCB4FB5DE75384A914FA643EBB0EC4CA0C15F89E15F038E98215"},"live_lf_after_reverse_spelling_map":{"bytes":254392,"git_blob":"a90a8da82c4f5603161eeb76f754babc3f4c243e","sha256":"91876A7162BF1B924D10C9F5C676CE1745966C8AC180165137C3A8EEA024EC02"},"live_path":"src/anyfesolver/elements.py","live_raw":{"bytes":260620,"git_blob":"cd24e94b4fbb8134d6e019b4cf7c45c96f72fc39","sha256":"0BECE4C5B5CE30D52111CED39AA3C3B1F74346BBF936EF680A08A68937FB5A3A"},"module_symbols":{"added":[],"candidate_aggregate_sha256":"72F1F0BC3356820710918E6FE979FF1BE4762320EE86DF60F1F6C4529851ED9C","changed":["_elastic_symmetry"],"removed":[],"upstream_aggregate_sha256":"BCCB5059D386D8DF9FF91657CA7F58A8AD626E9AA8FA21296D0C0FBBF35BC2E2"},"portable_text":false,"recorded_path":"src/anysolver/elements.py","reverse_spelling_map_reproduces_upstream_lf":true,"upstream_lf":{"bytes":254392,"git_blob":"a90a8da82c4f5603161eeb76f754babc3f4c243e","sha256":"91876A7162BF1B924D10C9F5C676CE1745966C8AC180165137C3A8EEA024EC02"},"upstream_raw":{"bytes":260618,"git_blob":"0654d419641bf591ee21ddbe9ddf0c98bc8890c8","sha256":"55515CDF1DDA318E54525E3511E992F12EB8BA013EADAFC2C0BDD810796D86B7"}},"vectorized_nonlinear.py":{"live_lf":{"bytes":12759,"git_blob":"656c7baa056660fced221c572be4760b9807e526","sha256":"13D0683F5C91CBFCB39DC36CCA0B9F978A59F09AF8E85270FBEE6DF574729EFC"},"live_lf_after_reverse_spelling_map":{"bytes":12759,"git_blob":"656c7baa056660fced221c572be4760b9807e526","sha256":"13D0683F5C91CBFCB39DC36CCA0B9F978A59F09AF8E85270FBEE6DF574729EFC"},"live_path":"src/anyfesolver/vectorized_nonlinear.py","live_raw":{"bytes":13119,"git_blob":"b2ed521ff2b16710d50b7ee7b407447eb455ec4e","sha256":"20E8A4D75EC2D0C68435F1C2559C4BA40BBB63A489014AFD9EF471DDCB034E59"},"module_symbols":{"added":[],"candidate_aggregate_sha256":"825D8E7A2E798245C3EB6BBD7F2A604BB7EE38BC21AB8FE867D802E3C66EA7C2","changed":[],"removed":[],"upstream_aggregate_sha256":"825D8E7A2E798245C3EB6BBD7F2A604BB7EE38BC21AB8FE867D802E3C66EA7C2"},"portable_text":false,"recorded_path":"src/anysolver/vectorized_nonlinear.py","reverse_spelling_map_reproduces_upstream_lf":true,"upstream_lf":{"bytes":12759,"git_blob":"656c7baa056660fced221c572be4760b9807e526","sha256":"13D0683F5C91CBFCB39DC36CCA0B9F978A59F09AF8E85270FBEE6DF574729EFC"},"upstream_raw":{"bytes":13119,"git_blob":"b2ed521ff2b16710d50b7ee7b407447eb455ec4e","sha256":"20E8A4D75EC2D0C68435F1C2559C4BA40BBB63A489014AFD9EF471DDCB034E59"}}},"historical_evidence_cited":{"oct19_nonacceptance_flags_retained":{"C5_exception_transfer":false,"CI_credit":false,"physical_acceptance_transfer":false},"oct19_observation_retained_historical_only":{"case_count":41,"phase_count":123,"rerun":false},"owner_decision":"Option A: public stress accepted with follow-up; elastic bit-identity waiver confined to qualified Q4; owner approved qualified S3 von Karman default subject to its gates","postmerge_confirmation":{"commit":"a0781c0bc8863a9190dc5647c32d263bdf4f581d","product_digest":"9db4a9abac478313a3000d67a286174e1999d9259df74b030fdbe5878e2feb7f","required_tests":26,"test_outcomes_matching_target":2679},"q4_r4_grade":{"commit":"5c34dc2e47f7f0114c2a5832d9515fc9ebc2dc13","exceptions":["W1 2.5% at n8","C4 1% same-mesh legacy and S8R-weighted band","A8 one route-count exception","H1 open HIGH untagged historical plastic state"],"grade":"READY-WITH-EXCEPTIONS","matrix_cells":"68/68","product_digest":"f2acc4da71e052fc4c8bee250963d012c80a5a6d95111d68ab2183e900d0780d","product_files":741},"report_sha256_cited":{"C:/ANYworkspaceWork/codex-q4-qual-notes/03_FINAL_REPORT.md":"3b0bfcf5fbf1499c9027d05b20af3404e21db73866e862fa085df61ed8f84f9e","C:/ANYworkspaceWork/codex-q4-qual-notes/04_POSTMERGE_REPORT.md":"4af246083c78245db61e00ca42314ccfa6551cb3d3efd2091e4ea6d80aac9d98","C:/ANYworkspaceWork/codex-q4-qual-notes/99_COORDINATOR_ACK.md":"fde1e77d52e92a850fac5f13bf8d34a57c58597f0d9c59d7c7f5a18d6197c504","C:/ANYworkspaceWork/codex-s3-notes/03_FINAL_REPORT.md":"3de04929016b7ebc764924dd99cc6043f911059256b0a2d9e8a815dce7b1730e","C:/ANYworkspaceWork/codex-s3-notes/99_COORDINATOR_ACK.md":"cac0ed2eacf957ee76a90621e60e9423109917d30cf93ad4bbfac875d2d1cd60","C:/ANYworkspaceWork/qualification-plan/DECISIONS_LOG.md":"f88475e28cc9802d8e898184652fa91fd73886a2fe00fdb8f0714cf8697ffead"},"s3_r1_grade":"READY with coordinator-granted exceptions and OPEN-LOW limitations","scope_statement":"Cited history only. Gives no credit to the current release source or any installed build."},"historical_files_sha256":{"docs/STATIC_RUNTIME_PERFORMANCE.md":"CBB92A59FDDDA847AA5953EDAA7A2ED6BE1EA64ED1995D415A59B72831BB31D1","docs/reference_cases/e4_pl_q4_0_4_1_replay_hotfix.json":"A8ED4F41A6D609579F46B166909168CA795A7E7C38381DF0067964D908CE7340","docs/reference_cases/e4_pl_q4_0_4_2_replay_canonicalization.json":"C210BE974874D582D79B42D68FF27DFB3443FB3C690FC3D3BA58B03363953259","docs/reference_cases/e4_pl_q4_source_binding_20261019.json":"06679901687621BD6696DB9C8777A80131EE08631BFCCA706FD03FA15042FB38","docs/reference_cases/e4_pl_q4_source_binding_20261019_as_reviewed.json":"64B07F1A535E6D6EFCEAE0B2EC01BA539DF69BE7956C03DBDA65C2ACF7C7E74F","docs/reference_cases/e4_pl_s3_mixed_mesh_qualification_contract.json":"3F933786A334A876C1B53EF90891237F18C0970DE6B95F885CF5B775791E0A99","docs/reference_cases/e4_pl_s3_v2d_default_activation_candidate.json":"E0E6773C89A3FB47275F9FC2BC9775C5DF630F18EED9C205F8151B3A8ABD7524","docs/reference_cases/e4_pl_s3_v2d_default_integration_repair.json":"DDCB1DEF659F613147E8DAB3756E438BFD2DB275E99F76D2950BB58D95B871EE","docs/reference_cases/qualified_shell_runtime_guard_performance_successor.json":"5B581DF27B008FE5CB2203560806DE888A52B809DD30DF623D9CF0EDC16397FF"},"historical_gaps_of_current_historical_record":[{"check":"source","historical_gap":true,"historical_leaf":"source/sha256","live_lf":{"bytes":331362,"git_blob":"3ded2fff1472b8532f88223792232bf4aea2250e","sha256":"D597C84DDE8E3B280134C9DDF57CA5FF4F39FB748038C521AE50F2AEF5051E3E"},"live_lf_matches_recorded":false,"live_lf_sha256":"D597C84DDE8E3B280134C9DDF57CA5FF4F39FB748038C521AE50F2AEF5051E3E","live_path":"src/anyfesolver/e4_pl_element.py","live_raw":{"bytes":331362,"git_blob":"3ded2fff1472b8532f88223792232bf4aea2250e","sha256":"D597C84DDE8E3B280134C9DDF57CA5FF4F39FB748038C521AE50F2AEF5051E3E"},"recorded_path":"src/anysolver/e4_pl_element.py","recorded_sha256":"3785607E88AF2985BC702A908724D0D5CC23F3519583C1BF176B257DC3D1BCAD"},{"check":"lifecycle_delta","historical_gap":true,"historical_leaf":"source_binding_integration_review/lifecycle_delta/sha256","live_lf":{"bytes":31854,"git_blob":"c0886377091ed5cc20bc132c6f3bb18c7e5170b1","sha256":"7850DB89C453D61936A2F20906B2A5682008AEA3FF694BF4A907F1B169F75A96"},"live_lf_matches_recorded":false,"live_lf_sha256":"7850DB89C453D61936A2F20906B2A5682008AEA3FF694BF4A907F1B169F75A96","live_path":"src/anyfesolver/fe_core.py","live_raw":{"bytes":31854,"git_blob":"c0886377091ed5cc20bc132c6f3bb18c7e5170b1","sha256":"7850DB89C453D61936A2F20906B2A5682008AEA3FF694BF4A907F1B169F75A96"},"recorded_path":"src/anysolver/fe_core.py","recorded_sha256":"2377A0B492113A6AC80B009CEBC9849C83867F7AC367F0A7D5D15D6C26153C0A"},{"check":"external__elements_module","historical_gap":true,"historical_leaf":"external_arithmetic_dependencies/_elements_module/sha256","live_lf":{"bytes":254394,"git_blob":"beae44a0c8beb310072c3e12556e249cbd739fc8","sha256":"47F3D2D8474ACCB4FB5DE75384A914FA643EBB0EC4CA0C15F89E15F038E98215"},"live_lf_matches_recorded":false,"live_lf_sha256":"47F3D2D8474ACCB4FB5DE75384A914FA643EBB0EC4CA0C15F89E15F038E98215","live_path":"src/anyfesolver/elements.py","live_raw":{"bytes":260620,"git_blob":"cd24e94b4fbb8134d6e019b4cf7c45c96f72fc39","sha256":"0BECE4C5B5CE30D52111CED39AA3C3B1F74346BBF936EF680A08A68937FB5A3A"},"recorded_path":"src/anysolver/elements.py","recorded_sha256":"5DB6625CC04669A90FB2D4BCE9CBB445754DC12B5B4B71F84ECB9636D07D6289"},{"check":"observed_tests/test_general_contact_c5_elastic_increment.py","historical_gap":true,"historical_leaf":"observed_focused_pre_reader_integration/all_source_symbol_delta/files/tests/test_general_contact_c5_elastic_increment.py/after_source_sha256","live_lf":{"bytes":14987,"git_blob":"5db644a6e4a38e70c27ff8b70e6f2d96cbe28562","sha256":"6C20F0AD33C269A0EFDD9EEF4AE83A1A0D3B38C06321FD4D4292AF9BDC0797A2"},"live_lf_matches_recorded":false,"live_lf_sha256":"6C20F0AD33C269A0EFDD9EEF4AE83A1A0D3B38C06321FD4D4292AF9BDC0797A2","live_path":"tests/test_general_contact_c5_elastic_increment.py","live_raw":{"bytes":14987,"git_blob":"5db644a6e4a38e70c27ff8b70e6f2d96cbe28562","sha256":"6C20F0AD33C269A0EFDD9EEF4AE83A1A0D3B38C06321FD4D4292AF9BDC0797A2"},"recorded_path":"tests/test_general_contact_c5_elastic_increment.py","recorded_sha256":"CBB3B879ED4E9EB6D0D8E746F7BDCFD0F3D5AF0988986955D1FDC1B8E1066668"},{"check":"observed_tests/test_general_contact_c5_numpy_coordinate_admission.py","historical_gap":true,"historical_leaf":"observed_focused_pre_reader_integration/all_source_symbol_delta/files/tests/test_general_contact_c5_numpy_coordinate_admission.py/after_source_sha256","live_lf":{"bytes":13731,"git_blob":"6992e4cc7831f3b40ad67c9bff8d693247918046","sha256":"A755296198D33640D5307B035CD346E942FF27538CA4C85A42829347C2DC89B8"},"live_lf_matches_recorded":false,"live_lf_sha256":"A755296198D33640D5307B035CD346E942FF27538CA4C85A42829347C2DC89B8","live_path":"tests/test_general_contact_c5_numpy_coordinate_admission.py","live_raw":{"bytes":13732,"git_blob":"8236e30c2a80daa27b0ac77bfbba3e94d4858c81","sha256":"055A7CC9F701A59B953D6B5EF61C9B4078280C079BB57E21217F911420C79E97"},"recorded_path":"tests/test_general_contact_c5_numpy_coordinate_admission.py","recorded_sha256":"6FEF7B15C7FB7EA4560B45C62BBCE91B10B9F12994D4965579B48720E91599C3"}],"historical_record_lineage":{"anchor":"e0c5f32ab40e9548ba0ea8981cf5e288ed375a1c","chain_sha256":"C75FA5607256A911999174EE7475B07FDE691ECD5A935F725E2B9F93F06E3BA5","lineage_json_sha256":"1CEF66AEDCD866ED1FEAA1EE28497F30A96966A78D01E1CB472EA5D58DBBD7AC","nodes":[{"blob":"fc61d1cb69156d950aa35c6318153dfa06ddb006","commit":"af0344922b565fe8424e2c98dd28280d01339eda","length":71693,"parents":[{"blob":null,"commit":"4074eb8b163c1d04cd5e1faed742a237680c01fd"}],"sha256":"77577D7945CCA71A10856706E4E4F5CFF0BA3BAEC7E4802FA852FED59C34D57B"},{"blob":"99b59279e9702b509a84f1932874e2b24680adcc","commit":"36a5d5d8c1ae3816fe98d9049e79dec7b39787e9","length":71924,"parents":[{"blob":"fc61d1cb69156d950aa35c6318153dfa06ddb006","changes":{"source_binding_integration_review/lifecycle_delta":{"after":{"byte_reconciliation":"Exact committed LF bytes; previous CRLF working copy is LF-equal. No semantic change.","disposition":"Existing accepted immutable-vector identity/cache-lifecycle repair; review verifies exact current source identity. Not Q4 scientific qualification.","evidence":"docs/agent_plans/PR35_IMMUTABLE_VECTOR_SALVAGE_PLAN_20261016.md","path":"src/anysolver/fe_core.py","prior_windows_working_copy_sha256":"07549c53099a3f4b6ab91d3a4741bcda64a91126935450aa7e463ee0954932da","sha256":"2377a0b492113a6ac80b009cebc9849c83867f7ac367f0a7d5d15d6c26153c0a"},"before":{"disposition":"Existing accepted immutable-vector identity/cache-lifecycle repair; review verifies exact current source identity. Not Q4 scientific qualification.","evidence":"docs/agent_plans/PR35_IMMUTABLE_VECTOR_SALVAGE_PLAN_20261016.md","path":"src/anysolver/fe_core.py","sha256":"07549c53099a3f4b6ab91d3a4741bcda64a91126935450aa7e463ee0954932da"}},"source_binding_integration_review/review_sha256":{"after":"946dd42285a4b0eb9df5c143ea1c648fe75e19f8bd12e90e5edcd7b49f8f3449","before":"c63be84bc2e4fa8d59cf3ee1176a8c6159e645c008bebfb81d400616a39cb177"}},"commit":"af0344922b565fe8424e2c98dd28280d01339eda"}],"sha256":"64B07F1A535E6D6EFCEAE0B2EC01BA539DF69BE7956C03DBDA65C2ACF7C7E74F"},{"blob":"7024980f2f8e2b917aaa0626a375da9a2fd43e0b","commit":"f75aed6a4188cc0f86cefcaf6e15af806e3ea108","length":70591,"parents":[{"blob":"99b59279e9702b509a84f1932874e2b24680adcc","changes":{"external_arithmetic_dependencies/_local_contractions/sha256":{"after":"885311e774f7c8dc689151fe49f26b912d38196cbcca25876d8341d268cb9f76","before":"abed2ce18536e4854896c762c6c9745fcce63568a87f327f79821cb94d1d37bc"}},"commit":"57dd01f047a4ea4e26d518aeddbf03997c3bd641"}],"sha256":"EF6437AE99E1806167B0D75E7EA2F7ACDE62000879DC9B35F76FC10B1594DEC7"},{"blob":"7b46c036dfdece1f96e7f81a273143cbddd963a9","commit":"842c38926890521efbdbe33e9c5c72222fa37596","length":70591,"parents":[{"blob":"7024980f2f8e2b917aaa0626a375da9a2fd43e0b","changes":{"external_arithmetic_dependencies/_elastic_increment_module/sha256":{"after":"ab95c7108c81153037a0dada7e78ab5255e2aeff0eac4d0865e07fe486423010","before":"0510b93c71353c1631c642cc044dd93007fc16041a17c3543e752dc1e1264649"},"external_arithmetic_dependencies/_local_contractions/sha256":{"after":"80bb7389278a8449a3d24a2f939f8bec12d2ea5a17759efdd7cef0a30e5b0336","before":"885311e774f7c8dc689151fe49f26b912d38196cbcca25876d8341d268cb9f76"}},"commit":"f6a9de9f815c684e883e73212571764ae6b07665"}],"sha256":"59523F281DCDC48F76838C8E794D5CF5A4A66FF1FE9BDF0B74BC4C88E010354E"},{"blob":"249fb5e38917dd1ba77c6d18a34cba7868d82cde","commit":"a42dc0a5c94c40f59ba781306aee833aa9d4a3ff","length":70591,"parents":[{"blob":"7b46c036dfdece1f96e7f81a273143cbddd963a9","changes":{"external_arithmetic_dependencies/_local_contractions/sha256":{"after":"7e3266e7258eed17f818d5ae962e31d9548cee48da1cc62e339bbaf3ff8ed949","before":"80bb7389278a8449a3d24a2f939f8bec12d2ea5a17759efdd7cef0a30e5b0336"}},"commit":"842c38926890521efbdbe33e9c5c72222fa37596"}],"sha256":"078C26FF0B13C002E7C1353FF2D6A4CF80B622835C56B4C108C325811C4D42AD"},{"blob":"0ffb6689d5a4ddfef15ff7de2ea872a3eec1e170","commit":"504dfb6578c2aacef31d66c6e48fb2f0d3a42af7","length":70591,"parents":[{"blob":"249fb5e38917dd1ba77c6d18a34cba7868d82cde","changes":{"external_arithmetic_dependencies/_elastic_increment_module/sha256":{"after":"20e8a4d75ec2d0c68435f1c2559c4ba40bbb63a489014afd9ef471ddcb034e59","before":"ab95c7108c81153037a0dada7e78ab5255e2aeff0eac4d0865e07fe486423010"},"external_arithmetic_dependencies/_local_contractions/sha256":{"after":"56a7a2ed0e5db4cf62dfaa45bdb085304f7525f0e8a171c4f522ec7227e748b0","before":"7e3266e7258eed17f818d5ae962e31d9548cee48da1cc62e339bbaf3ff8ed949"}},"commit":"a42dc0a5c94c40f59ba781306aee833aa9d4a3ff"}],"sha256":"B6119608B5E63652F4A741D5C6285E582288E3164FC6B978978E22B51DE04965"},{"blob":"6b8b616559f53f1af2339a5f981e14f086eec3fd","commit":"b7863d9d864a6df2f8a15ae9ca91791b390627c0","length":70591,"parents":[{"blob":"0ffb6689d5a4ddfef15ff7de2ea872a3eec1e170","changes":{"external_arithmetic_dependencies/_local_contractions/sha256":{"after":"7c605295dff6a63a5d2c3898f944b6cdc4e29d48caddcfe6a62c5d1b60dd1bad","before":"56a7a2ed0e5db4cf62dfaa45bdb085304f7525f0e8a171c4f522ec7227e748b0"}},"commit":"504dfb6578c2aacef31d66c6e48fb2f0d3a42af7"}],"sha256":"ADE418D3CFB45040D5C5B668F9DE35283387185F76FAED60CAB3FD9B0C1B14DA"},{"blob":"3052505a185198142ffeee60fbee8ad46b3d968c","commit":"cb33056a44c22486843473964a51045cabf1ab68","length":70591,"parents":[{"blob":"6b8b616559f53f1af2339a5f981e14f086eec3fd","changes":{"external_arithmetic_dependencies/_elements_module/sha256":{"after":"5db6625cc04669a90fb2d4bce9cbb445754dc12b5b4b71f84ecb9636d07d6289","before":"fb3a3d82c0eb5b490399a6a856292389b26041b2937e55c33450f6cd1cf1285e"}},"commit":"b7863d9d864a6df2f8a15ae9ca91791b390627c0"}],"sha256":"06679901687621BD6696DB9C8777A80131EE08631BFCCA706FD03FA15042FB38"},{"blob":"3052505a185198142ffeee60fbee8ad46b3d968c","commit":"5842caf6c9384009f1d9e3b1308ffd77e61a626a","length":70591,"parents":[{"blob":"3052505a185198142ffeee60fbee8ad46b3d968c","changes":{},"commit":"953d189a379ddc56cb4fbddc33d7ae6945e50eb8"},{"blob":"7024980f2f8e2b917aaa0626a375da9a2fd43e0b","changes":{"external_arithmetic_dependencies/_elastic_increment_module/sha256":{"after":"20e8a4d75ec2d0c68435f1c2559c4ba40bbb63a489014afd9ef471ddcb034e59","before":"0510b93c71353c1631c642cc044dd93007fc16041a17c3543e752dc1e1264649"},"external_arithmetic_dependencies/_elements_module/sha256":{"after":"5db6625cc04669a90fb2d4bce9cbb445754dc12b5b4b71f84ecb9636d07d6289","before":"fb3a3d82c0eb5b490399a6a856292389b26041b2937e55c33450f6cd1cf1285e"},"external_arithmetic_dependencies/_local_contractions/sha256":{"after":"7c605295dff6a63a5d2c3898f944b6cdc4e29d48caddcfe6a62c5d1b60dd1bad","before":"885311e774f7c8dc689151fe49f26b912d38196cbcca25876d8341d268cb9f76"}},"commit":"0758b87c98a95c27fdf0e912300865feb8f6ec7e"}],"sha256":"06679901687621BD6696DB9C8777A80131EE08631BFCCA706FD03FA15042FB38"}],"pin_node":{"blob":"99b59279e9702b509a84f1932874e2b24680adcc","commit":"36a5d5d8c1ae3816fe98d9049e79dec7b39787e9","length":71924,"sha256":"64B07F1A535E6D6EFCEAE0B2EC01BA539DF69BE7956C03DBDA65C2ACF7C7E74F"},"readme_sha256":"0605298D0EC64B1F005E0139513DA7A588CAB256E58B36AB3140D04295BEF523","scientific_transfer_endorsed":false},"links":{"L1_OCT19_AND_V6_TERMINAL_TO_QUALIFIED_Q4_R4":{"external_kernel_added":"_q4_assumed_strain_plasticity.py","mechanics_changed":true,"oct19_closure":{"aggregate_sha256":"996C94581594E958545D5D64F25D1864942941A5B766BE88A79A4991BD4DE95C","symbol_count":159},"oct19_external_dependencies":{"_elastic_increment_module":{"path":"src/anysolver/vectorized_nonlinear.py","sha256":"0510B93C71353C1631C642CC044DD93007FC16041A17C3543E752DC1E1264649","used_attributes":["compensated_elastic_batch_zero","elastic_shell_nonlinear_increment"]},"_elements_module":{"path":"src/anysolver/elements.py","sha256":"FB3A3D82C0EB5B490399A6A856292389B26041B2937E55C33450F6CD1CF1285E","used_attributes":["_compensated_elastic_zero_tangent"]},"_local_contractions":{"path":"src/anysolver/_compensated_contractions.py","sha256":"ABED2CE18536E4854896C762C6C9745FCCE63568A87F327F79821CB94D1D37BC","used_attributes":["product","sum_arrays","weighted_sum"]}},"qualified_target_closure":{"aggregate_sha256":"CF0026B4621EA9180B0DFCE1A483AFB8A762A218CB5CC3F538517C1A8D0843AA","symbol_count":161},"symbol_delta_oct19_to_qualified_target":{"added":["QualifiedE4PLShellElement._assumed_strain_kernel","_initial_offsets_or_none"],"changed":["QualifiedE4PLShellElement._compute_committed_current_tangent_components_unchecked","QualifiedE4PLShellElement._elastic_increment_response","QualifiedE4PLShellElement._nonlinear_response_core","QualifiedE4PLShellElement._replay_accepted_algorithmic_response"],"removed":[]},"v6_terminal_blobs":{"e4_pl_element.py":"bd6c0dc2cb3661eb73942fc0fea56e527aa8d0b4","e4_pl_s3_element.py":"adc6562cbd3fb768d7f0d0ab69011f21ff7c9392"},"v6_terminal_mechanics_unchanged_claim_extended":false},"L2_UPSTREAM_E0C5F32AB_TO_RELEASE_CANDIDATE":{"claim":"SIX_CARRIER_SPELLING_ONLY_AFTER_REVERSE_MAP_NOT_EXTENDED_TO_OTHER_PATHS","symbol_delta_upstream_to_candidate":{"added":[],"changed":["QualifiedE4PLShellElement.get_node_coordinates"],"removed":[]},"unbound_scope":"Other runtime and packaging paths that differ from 5c34dc2e4 to e0c5f32ab (37 in the comparison) and transitive imports of the carriers are not bound by this record."}},"mechanics":{"aggregate_sha256":"8F7841580C5A835C18BE351161DBF714F2D048A4F00203FE656EEEBD81E9C480","logical_path":"src/anysolver/e4_pl_element.py","roots":["QualifiedE4PLShellElement.GAUSS_POINTS_1x1","QualifiedE4PLShellElement.GAUSS_POINTS_2x2","QualifiedE4PLShellElement.GAUSS_WEIGHTS_1x1","QualifiedE4PLShellElement.GAUSS_WEIGHTS_2x2","QualifiedE4PLShellElement._MITC4_SAMPLE_POINTS","QualifiedE4PLShellElement._compute_committed_current_tangent_components_unchecked","QualifiedE4PLShellElement._constitutive_and_drill_stiffness","QualifiedE4PLShellElement._generalized_section_in_frame","QualifiedE4PLShellElement._inverse_planar_jacobian","QualifiedE4PLShellElement._local_frame_and_derivatives","QualifiedE4PLShellElement._mitc4_shear_b_matrix","QualifiedE4PLShellElement._nonlinear_geometry","QualifiedE4PLShellElement._qualified_linear_correction","QualifiedE4PLShellElement._recover_planar_mixed_fields","QualifiedE4PLShellElement._recover_warped_generalized_section","QualifiedE4PLShellElement._recover_warped_homogeneous_section","QualifiedE4PLShellElement._warped_generalized_drilling_correction","QualifiedE4PLShellElement.compute_geometric_stiffness_matrix","QualifiedE4PLShellElement.compute_mass_matrix","QualifiedE4PLShellElement.compute_nonlinear_response","QualifiedE4PLShellElement.compute_stiffness_components","QualifiedE4PLShellElement.compute_stresses","QualifiedE4PLShellElement.numerical_internal_force","_GAUSS","_STATIONARY_BACKWARD_ERROR_LIMIT","_STATIONARY_RUIZ_ITERATIONS","_STATIONARY_RUIZ_ROW_NORM_RATIO_LIMIT","_centre_taylor","_characteristic_length","_coefficients","_compatible","_global_transform","_invariant_generalized_drilling_scale","_jacobian","_local_jacobian_scale","_natural_shear","_normalize","_residual_mode","_shape","_shape_derivatives","_solve_stationary_system","_source_fields","_stationary_backward_error","_stationary_blocks","_symmetric_ruiz_congruence","_tensor_transform","equation7_frame"],"schema":"anysolver.python-ast-mechanics-closure-v1","symbol_count":161,"symbols":{"DIRECTOR_POLARITY_POLICY_ID":"24FBADE6A782FD20EE5AE426D7B8F8ABADA60F9075B909EE3AB5F1FC13933EBD","DIRECTOR_REVERSAL_TRANSFORM_ID":"27EA36BE70DC524A0509D7C2AC14310EA94F4142CBBD0FC1199C9C8695E408D9","FORMULATION_ID":"68BC5D9067886BA4983FC3CDE61F239017C41E95853076C5E86AA6B2F0EF4624","IMPLEMENTATION_ID":"E6912AECE2496A69D6EC30C55003CA54A8A4B4398148C3DF8C80E910BE7805F2","Q4_ACTIVITY_DISPOSITION_SCHEMA_ID":"16022FDB7472160CED1A4D67BFE0643A92AB5242277B4D5C8CAB8B2C40BCF061","Q4_CURRENT_STATE_ALGORITHMIC_ORIGIN_SCHEMA_ID":"B792337D12AD1ED030D9A3E3DDFC58AA07E78B70CE18C0B41A7F24ABC54B8317","Q4_CURRENT_STATE_BINDING_SCHEMA_ID":"19EB2FA057D8FEDB2631389D39D1605B52B98970A793DD4FA635E3A1F1B37242","Q4_CURRENT_STATE_PROJECTION_POLICY_ID":"51B51EE54605793ED15AB7A640722FE859A7759566E3C1252CED478D729122A1","Q4_CURRENT_STATE_TANGENT_DECOMPOSITION_POLICY_ID":"93332FEFF5AE309A156131863D9B37B4B17EA52C50A3C9DF6874BB704FE8EDF8","Q4_DELETED_FROZEN_POLICY_ID":"98E986395C5C3919EAB74EC383AFF75BD61555C1BEFCEC122D3E2473F73B6C7A","Q4_FAILED_STATE_POLICY_ID":"8E221CFCCD0F85B9EC5703C9D7076BEFDF4AD19CC45F21860724536D2BA8A4B1","Q4_QUADRATURE_AUTHORITY_ID":"FFFCD6F866B0277BB4831D929752828CBFDAA4DA07ADDE04CC733E3711E6241D","QualifiedE4PLShellElement.GAUSS_POINTS_1x1":"582849F858244BBCA8B50DFD4F59C6358E2E2FECF7C30FE53516FB18F1285918","QualifiedE4PLShellElement.GAUSS_POINTS_2x2":"AE70D777343C1F5F2E2DE28F1541F1989F57D30FE7573D7F1A29DE302E6FC907","QualifiedE4PLShellElement.GAUSS_WEIGHTS_1x1":"35A34ABA963A04E387B2FB824010F778BEEB56B5BB5E0C4AF34D7A0F04521511","QualifiedE4PLShellElement.GAUSS_WEIGHTS_2x2":"802076F1F43C9F344DE27FE0316C51BD5586F75CA1ABDF76C16AB9FC30536839","QualifiedE4PLShellElement._MITC4_SAMPLE_POINTS":"0CFD68C57D7EB153B81B6DDB01404DAEAA82F0DD80E6F61FEAD82453C730B439","QualifiedE4PLShellElement._accepted_algorithmic_update_fingerprint":"DFAF1A4638A50EA0D3FA47D78BCF04ABD6A0581025E6A56CFE40C1662E90EF75","QualifiedE4PLShellElement._algorithmic_origin_payload":"86138089CF989621301D91E773B7A403ECE2726C88F39F61D17D86ABC4B8BE23","QualifiedE4PLShellElement._assumed_strain_kernel":"CB1630039C9BA2E97C97CC510DA2DD45A7814374455BD5DC19F39AB62E364B5C","QualifiedE4PLShellElement._bind_qualified_component_guard":"71C2C7BB334FBFAE3C57B12A02877501C45E663FD56FFCD50F88ED8EF2758512","QualifiedE4PLShellElement._committed_current_binding_payload":"43825C13F7EA9550C23598C187528DEF9AF5B4CF6CD7DC921C7325C1DD224B35","QualifiedE4PLShellElement._compute_committed_current_tangent_components_unchecked":"F20B11931487F2CFC78B711CA65CB4A199CC143D02E4797E47B34A979EF5FDFC","QualifiedE4PLShellElement._constitutive_and_drill_stiffness":"80C01B8F97F0CF8361B527BF45D66B7DBD06DD99D4D0F4EA36EDEEA25AED201B","QualifiedE4PLShellElement._current_state_cache_transaction":"2E9C557CD7E6D9E4777E6A5B3AF101A99181DACF0434AB1970546E6C47F0AA58","QualifiedE4PLShellElement._defining_class_input_snapshot_matches":"BAFC2DC67DA81109295E392C7714D636919173BCE78272ECFDC623020D223DBD","QualifiedE4PLShellElement._elastic_increment_admitted":"181A231BEC8A4BC3DD2B9D83BE1CBCB9CA3572D353EB0216EBFB5562BDF70D52","QualifiedE4PLShellElement._elastic_increment_response":"27C5D2D1374F193F8F77A3C92E871BD3F6CBB92ABE0BB4493CEF33C91CF64F02","QualifiedE4PLShellElement._generalized_section_in_frame":"E39AA6C13BB205EF599749F8C4B600B10B91389F728C7431B959D26BFEE36952","QualifiedE4PLShellElement._inverse_planar_jacobian":"388CB635DD5922C031E82B2C5DC4322F06B404CA92482C58E3A6BB7ADBDE37DC","QualifiedE4PLShellElement._is_compact_batch_constitutive_state":"EF6AD7F9620B26FD5644914DF1A99518D81FF30D8AB82DC64334BD1319E661C8","QualifiedE4PLShellElement._local_frame_and_derivatives":"CDC56246DAFEF34AA9674130859EFFDCF88C92A3D97F4DFA2BE8E52B6A8CCD31","QualifiedE4PLShellElement._mitc4_shear_b_matrix":"8F60FB9797220A8280211067CCDDF0A30C1E965827DC94E0C64839C0D6630A1B","QualifiedE4PLShellElement._nonlinear_geometry":"7EA2A4BCE7E48995431A58E274B21628ABE5F1F55EB96118AC3F08DA3538AC13","QualifiedE4PLShellElement._nonlinear_response_core":"E2D4E0CAB389E1902E8EF14403C12CF87163489D80F2B4DFCDE189233CAB9013","QualifiedE4PLShellElement._physical_director_context":"1E4C769B2D017E25475613E26F7695484615047711D6A3FF52FC72D86EB877A6","QualifiedE4PLShellElement._qualified_linear_correction":"221228A0BD08F4F6B78BB86094C69EB015FEFE3C8285B890EFC22CA2B5249C53","QualifiedE4PLShellElement._qualified_stiffness_cache_key":"5D619CCE4A471CA2E4A300FCF0A6673B88032F0171947773BEE10C7727D39E1B","QualifiedE4PLShellElement._recover_planar_mixed_fields":"6F72D7DFFF5A52032756CF5D3C4DB721285CD3C91AA9AB5EFB3CFE5C338F0338","QualifiedE4PLShellElement._recover_warped_generalized_section":"53CFB1688CE4E6BF3D1BE40899C75F62A3D760CF7293E29D7B7A63DF67D984B2","QualifiedE4PLShellElement._recover_warped_homogeneous_section":"66B16D18DDB97EEAD4110540CA4F2322120820046C85B699810C1413F7BFBD4C","QualifiedE4PLShellElement._reject_noncurrent_activity_disposition":"2D72537BC89733A9C30EBF229254D6597EFDFB1552A2D8783E798C2B43D45D2E","QualifiedE4PLShellElement._replay_accepted_algorithmic_response":"F51167318599C3BC059AD69204CB9F931989CFECF1C81F2FC45BF4FC095FC134","QualifiedE4PLShellElement._requires_algorithmic_return_map_origin":"40B2D2D62BA5A3F3A3E558473513A0CEF2FA552E0AF6B3BAFB27C6C253A166F2","QualifiedE4PLShellElement._stable_state_identity_payload":"C9A1B751809BAEC87C86CC73C479294EC84C6F9678A0DC7B4A4A928C13323147","QualifiedE4PLShellElement._validate_committed_current_kinematics":"54AA5E42F9A863A22DB99777D9D1233F03DB2924A7E92DFD7FAE884A4EA09C17","QualifiedE4PLShellElement._validate_committed_state_at_configuration":"6C7DDE06F660E1679E3EEF3AF6B7B252D355B0311A494AE0FC236F8A5AECBE83","QualifiedE4PLShellElement._validate_qualified_component_cache_identity":"A48DF8CC73BB3234FD2CB43098D7C46C1889CB1155FA9DEFF3704F6AB7425169","QualifiedE4PLShellElement._validate_qualified_component_guard":"3F79E9E4B186336AEF1B00E0181A353225F81703C23DF9B1480520080102C44E","QualifiedE4PLShellElement._validated_algorithmic_origin":"876003B4A702F9B9B8C1A13AB789320CC559E7AE6913CF7BE6925FC6463E4D37","QualifiedE4PLShellElement._warped_generalized_drilling_correction":"7182F41C3B57D39B5BD438BD0A83BAE3D3479F59A1B82F71D78F858721DCEBEB","QualifiedE4PLShellElement.attach_current_tangent_algorithmic_origin":"BD236A34DFBED4B84933442DC213900AA9905CB26600462740F5069D26A6CD00","QualifiedE4PLShellElement.compute_geometric_stiffness_matrix":"ED88FB6EFBBFF2A7F3238674EE9590E2945674FCED5E5A8A11CDBE719063478B","QualifiedE4PLShellElement.compute_mass_matrix":"94B6935ACC4E5924DC700815849275F842C3AD3CBB85BD03E6511E36BCBF4C45","QualifiedE4PLShellElement.compute_nonlinear_response":"D51D6178E7FB64AD47A6167B941386EF7CAB759CAF295AB521C195984CE71849","QualifiedE4PLShellElement.compute_stiffness_components":"772395F696B7667B8E391D25E9E7DFC613E801986CEBCBC0FBC9B41431CBB00B","QualifiedE4PLShellElement.compute_stiffness_matrix":"011434A73322E826188C0F18D63318B25C29600C328A5CCCED876E2AA2478453","QualifiedE4PLShellElement.compute_stresses":"8CB8E6AB573F619CD7DE71CCD745ED67255BF74201FF2034498F5F9760AC2F01","QualifiedE4PLShellElement.get_node_coordinates":"6FC74C81D65FC995D39228C343FE767A1099C9CE842D57D81CE48E96A470543D","QualifiedE4PLShellElement.numerical_internal_force":"E7B50FB6E06654007803832D0ADBB3B599F300B0D0EE532011E9DCA43A620343","QualifiedE4PLShellElement.physical_reference_director":"DD651C0D60E6026B4BBA29A4AFA405999D62FFF136B82DE6B3FB776EF6935CEE","QualifiedE4PLShellElement.to_dict":"C92349ED5BDB27E763CAA1BFE9EE1513B09E7CB0CD3E5B7CE8A842366BE263D9","QualifiedE4PLShellElement.validate_committed_current_tangent_binding":"8000EFAB0CA5E81856A37CCBE3F59185C7972DE2266A95E3A1A6A935EEF1ADE0","QualifiedE4PLShellElement.validate_committed_current_tangent_semantics":"65B908DDEA6DF6739EF0E6F842E6F90A3D6250D754F8DAE9DB75E25D589D5138","QualifiedE4PLShellElement.validate_committed_current_tangent_state":"AA90AB1B5C893982F6712BF3009CAC85A1D62301730B81E422684159C708A487","RECOVERY_POLICY_ID":"47FE28010A4063852F3007409B5806350B62B3D71937C34789C971CFE8BE44BD","STATIONARY_SOLVE_POLICY_ID":"6B2CAED2AC65BF41E19E9E054FAC98F69463CDE6F54B6692E597804D44026112","_FOREIGN_S3_ACTIVITY_DISPOSITION_KEY":"FCF112A985F56AE95EFF16F746905A7A6F1894EFACFDB981DF75E38130A830BF","_GAUSS":"9B6472DC3D2567636D7E39654D2A109B45350DAD4AE5F3E8B55176B443A7DAC3","_PLANAR_FORMULATION_ID":"B7FC645DC4A439E1EDF59DB204E39B0BE28E67706A7C8CB4BE54239C11A2D724","_Q4FastInputSnapshot":"4EF9A28047874004FE3F6A765D39835AEE6BCE0FF1408EC4E2D3D8DB4B9F4FAD","_Q4_ACTIVITY_DISPOSITION_KEY":"1136DE34B6EA5F3734F602BE539B3CB0550497D6B80A1ABC851944347380EF44","_Q4_COMPACT_REPLAY_MAX_ULPS":"B21D58F9DC39ACEF52F395D5131B5BC99427A1FC23C710A9C627C568921C1DA8","_Q4_CURRENT_STATE_ALGORITHMIC_ORIGIN_KEY":"6343AEC622F063D75280ED3AA3ADA32AE4F6A46773A13A6FF9CC586E278BACFC","_Q4_CURRENT_STATE_BINDING_KEY":"D3300AF17D68C17911D0709CA8BE621FF762D8FAD6D94A4EB13804D4312F5F6D","_Q4_CURRENT_STATE_DIGEST_KEY":"420EB270766605589FF7B6F675D78C34622868709FF149B58C1D63E5E44CD366","_Q4_FAST_COORDINATE_FLOAT64_TYPE":"674605C5F6072EF923C201433BC21C7DD94F7FA971E6E47FC2F1E5E84DB331E4","_Q4_FAST_ELEMENT_INPUT_NAMES":"726C915EACF17E36BF5C4EA55776F6368EB312F2114B9C1D30396C8EE60E7518","_Q4_FAST_ELEMENT_ITEMGETTER":"A760DDF2E068B6FF5B19E1CB11D9A52C579BACAD3D45C983C8E03115200F0BAD","_Q4_FAST_FORBIDDEN_INSTANCE_SHADOWS":"21857076D104AD1C91F0CE34DFDB8A3453927853EDFF5E41F4165A8BD1989709","_Q4_FAST_FORBIDDEN_MATERIAL_SHADOWS":"27B8F905D0B0BF674E13934088A4C4851235AC4F1C1024C243029D236EA1D527","_Q4_FAST_FORBIDDEN_MESH_SHADOWS":"30B8B779C02FDB2B4464E3066716B671A1931C971D498FCA1A94411BF5F59601","_Q4_FAST_MATERIAL_CLASS_ITEMGETTER":"68A6068789D43167951D2C39B3C529A741930DCD09545EBDC0EF87555017DCC0","_Q4_FAST_MATERIAL_CLASS_NAMES":"396996CC8FAF306631356EE063DB0DBC5BFE1E46695358EFE8E267BB60848D54","_Q4_FAST_MATERIAL_CLASS_VALUES":"DBA4DCAE39C154237CD5347DE5587F28E1D584091DEE2B2055D9C5092ECE7EEA","_Q4_FAST_MATERIAL_INPUT_NAMES":"1A2FE539EC8F89A5470554434D655F4E9B62F3A9A248103A1A8569BF75D8FE90","_Q4_FAST_MATERIAL_ITEMGETTER":"93D3E7FA669B898F3BAEB49212A7B8598F5F0B44B4711DEE8DF896C071648F5D","_Q4_FAST_MATERIAL_TYPE":"ED1EE96EE54B9E76F2128E7CCEA26374D732326A0AEA8ADDC4CBDAF04E4EF774","_Q4_FAST_MESH_TYPE":"7CDBF56FB1268B5EE0ED44CEAE135935E39A665125EFF65030D1807336936F40","_Q4_FAST_NODE_ITEMGETTER":"5E5C48CAF56343EB4761F4D07561A33D3D95C56A1D1EB12F065A655A8E8753E5","_Q4_FAST_NODE_TYPE":"BB7F40C580F191A5FD9678344DE5FA342B9841B3FB49C13B66FC21278C3A7AF1","_Q4_FAST_OWNED_MESH_DERIVED_KEYS":"51897182E61993A94AB925A47A2880AA46A5C86EBCAB60238CEF698D1BBC6BDC","_Q4_FAST_STATE_MAPPING_TYPE":"D670F4495A5DE98993F12A07805EFF3C6EDD112960AB3A79BE67C22DB12A4359","_Q4_FAST_TOKEN_TYPE":"DFE37AF7FF4B3BDA7CBFF1ACE65D4C070C19A5D9C6F96C1C914881D60DB3764A","_Q4_GENERALIZED_SECTION_NAMESPACE_AUTHORITY":"44FEF651F69FE3FE15E87B16FFC7222DABDC90330DC1E1B172EEE79FB9371EAD","_Q4_INITIAL_STATE_KEYS":"84AD55758991E7BAC7B711F884E671875947ADD51C1A960DEB00281DC6B833CA","_Q4_QUADRATURE_ARRAY_AUTHORITY":"A6272E5189AFD5EF869C8A295BD58AC36CF4C75E02ECC390ACAC4E047C791F6D","_Q4_QUADRATURE_CLASS_ARRAY_AUTHORITY":"07D49AFB7399C5191C7583A28AE7E43F0E4C59BD2E61E1C6732632E2E603FD78","_Q4_QUADRATURE_PROPERTY_AUTHORITY":"C3BC148DDD36399D2CF47BFD387B0BCE6EF625EAF39B6C714AF32B132FD6D5F6","_Q4_SERIALIZATION_CLASS_IDENTITY":"FD53DB331E5FEF8494B911D1663EC76122EF883008BEBF9BA896B50641D58A5A","_Q4_SERIALIZATION_GLOBAL_IDENTITY":"BE69EFC9877E53294225A31782C1586D04AF9CC9C39735366918F57B9062A214","_Q4_STIFFNESS_STATION_AUTHORITY":"32985D259CB90A7E1FB069179C3D748505CDA06AAEF0EC03EF6841C7F89488BE","_QUALIFIED_Q4_BASE_ELEMENT_SERIALIZATION_KERNEL":"12F40B5AB048AB090BA4FB727A40D8E4593EB1766F602FACE3367B8F8AFED48B","_QUALIFIED_Q4_BASE_GEOMETRIC_KERNEL":"F17B9BD67900F025A3E94EFFBAFDF93DA10797964DAC7A49B3DAD88B883B7D30","_QUALIFIED_Q4_BASE_LOCAL_FRAME_KERNEL":"F0808412F80A90FA180C78931E83E79ACBD59995091B48BA0A922F7869457F42","_QUALIFIED_Q4_BASE_MASS_KERNEL":"6A01B07FFAF490ECD144202CE42576ACF2D7BD9B13D67032039EB407EF70946A","_QUALIFIED_Q4_BASE_MITC4_SHEAR_KERNEL":"DC10080C2FCD3F7E2CEFB4C47F52F6B15A4A1C8A054D3D8BDF8169E933FD509F","_QUALIFIED_Q4_BASE_NONLINEAR_GEOMETRY":"CD4B504B9635A6C5F384E684F13476C909C959B66DADB679C0A2DF588A2E788B","_QUALIFIED_Q4_BASE_NONLINEAR_KERNEL":"822592C43B5F709A6B2EE33DDC1E92E6FB739AD5BAD0180CBC2A24879FEA9AC6","_QUALIFIED_Q4_BASE_SERIALIZATION_KERNEL":"7C7E533C553A06818F510786EE16335EF8E51D6C170018EF226C1045134A9AE5","_QUALIFIED_Q4_BASE_STIFFNESS_KERNEL":"FF7AFE7DE78510D4F806234C4AD173BD7FA22DB78FDD6A46EB1A20863CCA6AD7","_QUALIFIED_Q4_COORDINATE_SCALAR_TYPES":"62BA61A537A3611C8841F2EEF8B33B8C914A206D179ACF825F3F54B3FA877F5B","_STATIONARY_BACKWARD_ERROR_LIMIT":"CE09EA360BDED7520D2722C54DE027C1328F919299FFF9D98CCAAF769DFFB7B2","_STATIONARY_RUIZ_ITERATIONS":"DA8C97F0871B7865261251B93AC3BA7384A53433088410D1E62C06FB588FE6A3","_STATIONARY_RUIZ_ROW_NORM_RATIO_LIMIT":"0C8A1814D94666987F7F4A357A769442DF9CC5F34FA64289043174C0BC381A46","_V5_IMPLEMENTATION_ID":"D3102C03F47451E5269063FD1EA0532ECB84D1A32C773D2EEB599639BB570397","_V6_CURRENT_STATE_BINDING_SCHEMA_ID":"F1DDF2007C3DEE0C0423365C4632BCAD515934EED1DB7AB11F31CA468006ADB4","_V6_CURRENT_STATE_TANGENT_DECOMPOSITION_POLICY_ID":"CB69EB62CBC093F08115092EBB1796F4DC8F3A2A33AF71C33014B4A4D653022C","_V6_IMPLEMENTATION_ID":"A90F3A4DD539701BB2ECF5DF2221AFE69956B22AFDB022D90D9E5C3F6CD27F0B","_WARPED_FORMULATIONS":"AE90097F6596CD53934268853370551A1D434953AC1DE368EB0A9C20D1476C8F","_binary64_vector_fingerprint":"DC1275A227F30113669555E8C0A4E3BA1651740D88B58A49D31ACEA8FD104BCD","_capture_q4_fast_array_authority":"D3F3B7EC895F8B4CC6E5F555E50D69DABF14CCBCBA32B1A4673D25C5CAEE6DBE","_capture_q4_fast_input_snapshot":"5BAFACE30522E87ED41B4F04D0CB7A40ECF8AA0075AAA928E454FED51D1E20B1","_centre_taylor":"A4EBEE30A1BB6745A4818172ABB5972CEFA55E3F2B41925EEA7844AC74BD96C9","_characteristic_length":"9C66185F09517C950280ED575A38A13AA1A948CBF1595F06399BA8816B0D4D49","_coefficients":"E107C7F3C6A78728D002F3D5AED65A138CBFE02778ED5AAAF5413FF533E7534C","_compatible":"C56107FFA80452E55C4703E5B4F1E98D6FE339A4904169695F31E66BF8056187","_freeze_qualified_component_cache":"95B54BAF4F4858C49D9AAF5ABEE2CBB029085C9B596A8F9F9BDB35D3A872AC63","_global_transform":"D0310FA446C683BDD4D0C2ABA265F678EFDC840725F29DB5594B7E84A86C48B6","_initial_offsets_or_none":"78FB89BC4FE01FF56270BCCA44101D7B0A29CA26A91BF818182BE4367BB5E702","_invariant_generalized_drilling_scale":"044E3482E303D0E0855B8EB212CDCB4D6CD61641DFE460AE04D015F2900EBB85","_jacobian":"93C774DE7BEE9FB2432EAB2F8AEC287A10DC65E8E93D2607C0C49A6AE89975C9","_local_jacobian_scale":"1EA41F721B1BC849BD1CBDE267CD0A5EB0DAD69E3B4218D22B76CF474C0A02D9","_natural_shear":"DF29EF11AC584B74ACD932185929AF1B64EB484B36BBDA0FB9A797C150090466","_normalize":"4DFDCA5835C16CA5E7D1FA690A1418FD84440B9E4E9AB427C32B8F1337990436","_owned_q4_quadrature_array":"7A66C3B5AB12D2D426323106F31ABA29962F3BEB3A4D53C2BD8C0CD30F40DD8D","_q4_compact_replay_last_place_equivalent":"44AADA3FE157A00B770A9A81E9929D0C8FAB928C2D93BCA126D9D0B9F4FFD1F0","_q4_quadrature_epoch_guard":"495E22E1412D7CAB967188B9930AC5C9910AA0E48CF2453CBAB16B5F0ECA9E60","_q4_quadrature_epoch_manager":"64C02A8828128030E338DD22F46F4ABC4FE2BAF1A6AB066EA9026C20E76725F7","_q4_serialized_output_boundary":"F4EBE89B79457105DDBD2309B5E14BE621CF5CCDE42B0205ED4BC846B6DAFA73","_q4_state_payload":"7B8DEB51D11C69281E5ADD7896B51B7B4A25EF5A14511C14FBCF47EB1D1B1B90","_qualified_q4_layer_count":"972E8A85FCDED26370F5A316C06C112F846BE8BCF432FD545A515563769F4171","_require_exact_readonly_float64_array":"8679573FA5508E0195CA910B66B9C086804947A32DC93C2C0CE9B72FEC1EFF8B","_require_q4_fast_array_authority":"EDA147C139DCEE9D320A6EFD422CAE93172207F7E31F142F3E24E25D7905F5A5","_require_q4_fast_base_authority":"9A8E5CE424B3DB702B8F4F4AE28A256BE3718481E44BE0B990F5C2B68992B948","_require_q4_quadrature_instance_authority":"E43066E9BEA1D78E1CFF9057A837651F73AA2E43AFD629BF9F639AE0D321E3A6","_require_q4_serialization_module_authority":"EED856FEF1FB691BF13EA5E40399BD3ACA8D74D1FBBA6E97FA3ED7AFCFB90741","_residual_mode":"6CCD74BF95E6A87F18C97C419BA2CB393DB618FB41CC7244345EDCD8F285E74B","_shape":"9C7DD808A791D9035CB6D318AB9D1001956D63D8AB843C536BB454EF9250BCC2","_shape_derivatives":"5A09095FDD5B020F013A73DBAD6E6C2ED37DCABBC41CE983DA94B6D979693A42","_solve_stationary_system":"E9241411C54893A71E59CD952EC986FE321DC252533E5BB03D85641D82CB2A3F","_source_fields":"4572342DEC864F1F5F0393ED36F603A6DEBD11A8F0D3E3BAD5CA3BD9FCFFAEA9","_static_mro_attribute":"6E050C13689DFFC3D23EC5D352E91237C3D8C0C48542025A0D87E4108A074BAC","_stationary_backward_error":"C0A4E32C0D7156EA1AE1B7DE80F558F036750E6AD4B28B0C724643BE91899D2F","_stationary_blocks":"D45393BFF0B769C9D74D0F7184262840961B243695FEF91A682EE120B182AC79","_symmetric_ruiz_congruence":"8A6461C35D944AFD566218A16B89AE9E9E0F34E6AC7E1D3B7761CF58F918888B","_tensor_transform":"B7C35BE1CDC8019B107044D3A8C43D47EAFBF5FCB12BB8977B0110C482EF6CB8","_validate_q4_quadrature_authority":"323F88B4FD89E5E44F893627AFA37FE626E695A9FBC69DCB3D300C6D5E521FAC","_validate_q4_quadrature_authority_exact":"C3828E97840760FB4D83458284CD7B8D1BF4CAB060A30BFB0EB872664576BCB3","_validate_q4_serialization_authority":"869C1DDA1AF7F52996CF4328A87A23D3D65DA98E20621A74B8493BDFAA57FCF9","equation7_frame":"33C7A8D30CDF8C226F309BCF9C415525E1976BAE70FDA94B4CDCD09B822CDF2E"}},"predecessor":{"current_historical_describes_current_execution":false,"current_historical_equals_as_reviewed":false,"oct19_as_reviewed":{"bytes":71924,"git_blob":"99b59279e9702b509a84f1932874e2b24680adcc","path":"docs/reference_cases/e4_pl_q4_source_binding_20261019_as_reviewed.json","sha256":"64B07F1A535E6D6EFCEAE0B2EC01BA539DF69BE7956C03DBDA65C2ACF7C7E74F"},"oct19_current_historical":{"bytes":70591,"git_blob":"3052505a185198142ffeee60fbee8ad46b3d968c","path":"docs/reference_cases/e4_pl_q4_source_binding_20261019.json","sha256":"06679901687621BD6696DB9C8777A80131EE08631BFCCA706FD03FA15042FB38"},"v6_runtime_guard_successor_commit":"c31a223fe63f886a1a9b0b47c926bbe748ad4554"},"qualification_boundary":"SOURCE_BINDING_ONLY_NOT_SCIENTIFIC_QUALIFICATION","recorded_to_live_spelling_map":{"applies":"source resolution only; recorded bytes and recorded logical paths are never rewritten","path_map":{"src/anysolver/_compensated_contractions.py":"src/anyfesolver/_compensated_contractions.py","src/anysolver/_q4_assumed_strain_plasticity.py":"src/anyfesolver/_q4_assumed_strain_plasticity.py","src/anysolver/e4_pl_element.py":"src/anyfesolver/e4_pl_element.py","src/anysolver/e4_pl_s3_element.py":"src/anyfesolver/e4_pl_s3_element.py","src/anysolver/elements.py":"src/anyfesolver/elements.py","src/anysolver/vectorized_nonlinear.py":"src/anyfesolver/vectorized_nonlinear.py"},"text_live_to_recorded":[["ANYfeSolver","ANYsolver"],["anyfesolver","anysolver"]]},"revisions":{"5c34dc2e4":"5c34dc2e47f7f0114c2a5832d9515fc9ebc2dc13","a0781c0bc":"a0781c0bc8863a9190dc5647c32d263bdf4f581d","c31a223f":"c31a223fe63f886a1a9b0b47c926bbe748ad4554","e0c5f32ab":"e0c5f32ab40e9548ba0ea8981cf5e288ed375a1c"},"schema":"anyfesolver.q4-source-binding-successor-v2","sibling_imports_of_entry_module":[{"bound_name":"AuthorityEpochMeta","file":"_qualified_authority_epoch.py","imported":"AuthorityEpochMeta","kind":"name","live_lf":{"bytes":19244,"git_blob":"8f9f3c3af4c84bbc8b3ed34d6cab6c275da5ae58","sha256":"232916EE836801118206F639F893DA97222B278884A7AB08612725A5BE630979"},"live_path":"src/anyfesolver/_qualified_authority_epoch.py","permitted_raw":{"crlf":{"bytes":19805,"git_blob":"858ea4bcf3cfc716e7e8800427046987374da7b2","sha256":"6F541AB16AC84355E76FA778DE0CEED820E1A4F73A7F8E0752EEE763652EE02F"},"lf":{"bytes":19244,"git_blob":"8f9f3c3af4c84bbc8b3ed34d6cab6c275da5ae58","sha256":"232916EE836801118206F639F893DA97222B278884A7AB08612725A5BE630979"}},"portable_text":true,"recorded_path":"src/anysolver/_qualified_authority_epoch.py","relative_level":1,"used_attributes":[],"used_in_closure":false},{"bound_name":"Element","file":"elements.py","imported":"Element","kind":"name","live_lf":{"bytes":254394,"git_blob":"beae44a0c8beb310072c3e12556e249cbd739fc8","sha256":"47F3D2D8474ACCB4FB5DE75384A914FA643EBB0EC4CA0C15F89E15F038E98215"},"live_path":"src/anyfesolver/elements.py","live_raw":{"bytes":260620,"git_blob":"cd24e94b4fbb8134d6e019b4cf7c45c96f72fc39","sha256":"0BECE4C5B5CE30D52111CED39AA3C3B1F74346BBF936EF680A08A68937FB5A3A"},"portable_text":false,"recorded_path":"src/anysolver/elements.py","relative_level":1,"used_attributes":[],"used_in_closure":true},{"bound_name":"GeneralizedShellSection","file":"shell_sections.py","imported":"GeneralizedShellSection","kind":"name","live_lf":{"bytes":14223,"git_blob":"39e39e53b3eb90189ff34b73b806fa0da8100001","sha256":"D3715C71D38F5D29F10B21DAC2EE3DB9ECA98160543CFE2966C4C1AD86FC9F7D"},"live_path":"src/anyfesolver/shell_sections.py","permitted_raw":{"crlf":{"bytes":14617,"git_blob":"02ae80867f196ce81a3b83e3f27db7fbcbff95ae","sha256":"37BE5D2EDAC7B1FEB6D83DE3717326DC6F60C642417CE27252F9EB4DB8FB0C8E"},"lf":{"bytes":14223,"git_blob":"39e39e53b3eb90189ff34b73b806fa0da8100001","sha256":"D3715C71D38F5D29F10B21DAC2EE3DB9ECA98160543CFE2966C4C1AD86FC9F7D"}},"portable_text":true,"recorded_path":"src/anysolver/shell_sections.py","relative_level":1,"used_attributes":[],"used_in_closure":true},{"bound_name":"Node","file":"fe_core.py","imported":"Node","kind":"name","live_lf":{"bytes":31854,"git_blob":"c0886377091ed5cc20bc132c6f3bb18c7e5170b1","sha256":"7850DB89C453D61936A2F20906B2A5682008AEA3FF694BF4A907F1B169F75A96"},"live_path":"src/anyfesolver/fe_core.py","live_raw":{"bytes":31854,"git_blob":"c0886377091ed5cc20bc132c6f3bb18c7e5170b1","sha256":"7850DB89C453D61936A2F20906B2A5682008AEA3FF694BF4A907F1B169F75A96"},"portable_text":false,"recorded_path":"src/anysolver/fe_core.py","relative_level":1,"used_attributes":[],"used_in_closure":true},{"bound_name":"SHELL_MEMBRANE_VOIGT_ORDER","file":"shell_sections.py","imported":"SHELL_MEMBRANE_VOIGT_ORDER","kind":"name","live_lf":{"bytes":14223,"git_blob":"39e39e53b3eb90189ff34b73b806fa0da8100001","sha256":"D3715C71D38F5D29F10B21DAC2EE3DB9ECA98160543CFE2966C4C1AD86FC9F7D"},"live_path":"src/anyfesolver/shell_sections.py","permitted_raw":{"crlf":{"bytes":14617,"git_blob":"02ae80867f196ce81a3b83e3f27db7fbcbff95ae","sha256":"37BE5D2EDAC7B1FEB6D83DE3717326DC6F60C642417CE27252F9EB4DB8FB0C8E"},"lf":{"bytes":14223,"git_blob":"39e39e53b3eb90189ff34b73b806fa0da8100001","sha256":"D3715C71D38F5D29F10B21DAC2EE3DB9ECA98160543CFE2966C4C1AD86FC9F7D"}},"portable_text":true,"recorded_path":"src/anysolver/shell_sections.py","relative_level":1,"used_attributes":[],"used_in_closure":true},{"bound_name":"SHELL_TRANSVERSE_SHEAR_ORDER","file":"shell_sections.py","imported":"SHELL_TRANSVERSE_SHEAR_ORDER","kind":"name","live_lf":{"bytes":14223,"git_blob":"39e39e53b3eb90189ff34b73b806fa0da8100001","sha256":"D3715C71D38F5D29F10B21DAC2EE3DB9ECA98160543CFE2966C4C1AD86FC9F7D"},"live_path":"src/anyfesolver/shell_sections.py","permitted_raw":{"crlf":{"bytes":14617,"git_blob":"02ae80867f196ce81a3b83e3f27db7fbcbff95ae","sha256":"37BE5D2EDAC7B1FEB6D83DE3717326DC6F60C642417CE27252F9EB4DB8FB0C8E"},"lf":{"bytes":14223,"git_blob":"39e39e53b3eb90189ff34b73b806fa0da8100001","sha256":"D3715C71D38F5D29F10B21DAC2EE3DB9ECA98160543CFE2966C4C1AD86FC9F7D"}},"portable_text":true,"recorded_path":"src/anysolver/shell_sections.py","relative_level":1,"used_attributes":[],"used_in_closure":true},{"bound_name":"ShellElement","file":"elements.py","imported":"ShellElement","kind":"name","live_lf":{"bytes":254394,"git_blob":"beae44a0c8beb310072c3e12556e249cbd739fc8","sha256":"47F3D2D8474ACCB4FB5DE75384A914FA643EBB0EC4CA0C15F89E15F038E98215"},"live_path":"src/anyfesolver/elements.py","live_raw":{"bytes":260620,"git_blob":"cd24e94b4fbb8134d6e019b4cf7c45c96f72fc39","sha256":"0BECE4C5B5CE30D52111CED39AA3C3B1F74346BBF936EF680A08A68937FB5A3A"},"portable_text":false,"recorded_path":"src/anysolver/elements.py","relative_level":1,"used_attributes":[],"used_in_closure":true},{"bound_name":"_capture_authority_array_metadata","file":"e4_pl_s3_state.py","imported":"_capture_authority_array_metadata","kind":"name","live_lf":{"bytes":187347,"git_blob":"640b5a3edaa51aaaf2407bc67921c9035f694ecc","sha256":"9BD8916C1ED7F53F8B8C3EFAEA77E91A330A0E470D8694810BB727CB9F6EBD41"},"live_path":"src/anyfesolver/e4_pl_s3_state.py","permitted_raw":{"crlf":{"bytes":192070,"git_blob":"0f1007d3a31d5174c269ccafef6c99721cd9372b","sha256":"70D3E26C0521CC8803C447102E859F3C0E50C04CC70FFC4EBC2B3E97E3975F25"},"lf":{"bytes":187347,"git_blob":"640b5a3edaa51aaaf2407bc67921c9035f694ecc","sha256":"9BD8916C1ED7F53F8B8C3EFAEA77E91A330A0E470D8694810BB727CB9F6EBD41"}},"portable_text":true,"recorded_path":"src/anysolver/e4_pl_s3_state.py","relative_level":1,"used_attributes":[],"used_in_closure":true},{"bound_name":"_elastic_increment_module","file":"vectorized_nonlinear.py","imported":"vectorized_nonlinear","kind":"module","live_lf":{"bytes":12759,"git_blob":"656c7baa056660fced221c572be4760b9807e526","sha256":"13D0683F5C91CBFCB39DC36CCA0B9F978A59F09AF8E85270FBEE6DF574729EFC"},"live_path":"src/anyfesolver/vectorized_nonlinear.py","live_raw":{"bytes":13119,"git_blob":"b2ed521ff2b16710d50b7ee7b407447eb455ec4e","sha256":"20E8A4D75EC2D0C68435F1C2559C4BA40BBB63A489014AFD9EF471DDCB034E59"},"portable_text":false,"recorded_path":"src/anysolver/vectorized_nonlinear.py","relative_level":1,"used_attributes":["compensated_elastic_batch_zero","elastic_shell_nonlinear_increment"],"used_in_closure":true},{"bound_name":"_elements_module","file":"elements.py","imported":"elements","kind":"module","live_lf":{"bytes":254394,"git_blob":"beae44a0c8beb310072c3e12556e249cbd739fc8","sha256":"47F3D2D8474ACCB4FB5DE75384A914FA643EBB0EC4CA0C15F89E15F038E98215"},"live_path":"src/anyfesolver/elements.py","live_raw":{"bytes":260620,"git_blob":"cd24e94b4fbb8134d6e019b4cf7c45c96f72fc39","sha256":"0BECE4C5B5CE30D52111CED39AA3C3B1F74346BBF936EF680A08A68937FB5A3A"},"portable_text":false,"recorded_path":"src/anysolver/elements.py","relative_level":1,"used_attributes":["_compensated_elastic_zero_tangent"],"used_in_closure":true},{"bound_name":"_fe_core_module","file":"fe_core.py","imported":"fe_core","kind":"module","live_lf":{"bytes":31854,"git_blob":"c0886377091ed5cc20bc132c6f3bb18c7e5170b1","sha256":"7850DB89C453D61936A2F20906B2A5682008AEA3FF694BF4A907F1B169F75A96"},"live_path":"src/anyfesolver/fe_core.py","live_raw":{"bytes":31854,"git_blob":"c0886377091ed5cc20bc132c6f3bb18c7e5170b1","sha256":"7850DB89C453D61936A2F20906B2A5682008AEA3FF694BF4A907F1B169F75A96"},"portable_text":false,"recorded_path":"src/anysolver/fe_core.py","relative_level":1,"used_attributes":["FEMesh","Material","_QualifiedMutationEpoch","_QualifiedStateMapping"],"used_in_closure":true},{"bound_name":"_generalized_shell_section_cache_fingerprint","file":"elements.py","imported":"_generalized_shell_section_cache_fingerprint","kind":"name","live_lf":{"bytes":254394,"git_blob":"beae44a0c8beb310072c3e12556e249cbd739fc8","sha256":"47F3D2D8474ACCB4FB5DE75384A914FA643EBB0EC4CA0C15F89E15F038E98215"},"live_path":"src/anyfesolver/elements.py","live_raw":{"bytes":260620,"git_blob":"cd24e94b4fbb8134d6e019b4cf7c45c96f72fc39","sha256":"0BECE4C5B5CE30D52111CED39AA3C3B1F74346BBF936EF680A08A68937FB5A3A"},"portable_text":false,"recorded_path":"src/anysolver/elements.py","relative_level":1,"used_attributes":[],"used_in_closure":true},{"bound_name":"_guarded_observe_attribute","file":"elements.py","imported":"_guarded_observe_attribute","kind":"name","live_lf":{"bytes":254394,"git_blob":"beae44a0c8beb310072c3e12556e249cbd739fc8","sha256":"47F3D2D8474ACCB4FB5DE75384A914FA643EBB0EC4CA0C15F89E15F038E98215"},"live_path":"src/anyfesolver/elements.py","live_raw":{"bytes":260620,"git_blob":"cd24e94b4fbb8134d6e019b4cf7c45c96f72fc39","sha256":"0BECE4C5B5CE30D52111CED39AA3C3B1F74346BBF936EF680A08A68937FB5A3A"},"portable_text":false,"recorded_path":"src/anysolver/elements.py","relative_level":1,"used_attributes":[],"used_in_closure":true},{"bound_name":"_guarded_observe_call","file":"elements.py","imported":"_guarded_observe_call","kind":"name","live_lf":{"bytes":254394,"git_blob":"beae44a0c8beb310072c3e12556e249cbd739fc8","sha256":"47F3D2D8474ACCB4FB5DE75384A914FA643EBB0EC4CA0C15F89E15F038E98215"},"live_path":"src/anyfesolver/elements.py","live_raw":{"bytes":260620,"git_blob":"cd24e94b4fbb8134d6e019b4cf7c45c96f72fc39","sha256":"0BECE4C5B5CE30D52111CED39AA3C3B1F74346BBF936EF680A08A68937FB5A3A"},"portable_text":false,"recorded_path":"src/anysolver/elements.py","relative_level":1,"used_attributes":[],"used_in_closure":true},{"bound_name":"_guarded_owned_generalized_shell_section","file":"elements.py","imported":"_guarded_owned_generalized_shell_section","kind":"name","live_lf":{"bytes":254394,"git_blob":"beae44a0c8beb310072c3e12556e249cbd739fc8","sha256":"47F3D2D8474ACCB4FB5DE75384A914FA643EBB0EC4CA0C15F89E15F038E98215"},"live_path":"src/anyfesolver/elements.py","live_raw":{"bytes":260620,"git_blob":"cd24e94b4fbb8134d6e019b4cf7c45c96f72fc39","sha256":"0BECE4C5B5CE30D52111CED39AA3C3B1F74346BBF936EF680A08A68937FB5A3A"},"portable_text":false,"recorded_path":"src/anysolver/elements.py","relative_level":1,"used_attributes":[],"used_in_closure":false},{"bound_name":"_guarded_owned_mapping","file":"elements.py","imported":"_guarded_owned_mapping","kind":"name","live_lf":{"bytes":254394,"git_blob":"beae44a0c8beb310072c3e12556e249cbd739fc8","sha256":"47F3D2D8474ACCB4FB5DE75384A914FA643EBB0EC4CA0C15F89E15F038E98215"},"live_path":"src/anyfesolver/elements.py","live_raw":{"bytes":260620,"git_blob":"cd24e94b4fbb8134d6e019b4cf7c45c96f72fc39","sha256":"0BECE4C5B5CE30D52111CED39AA3C3B1F74346BBF936EF680A08A68937FB5A3A"},"portable_text":false,"recorded_path":"src/anysolver/elements.py","relative_level":1,"used_attributes":[],"used_in_closure":true},{"bound_name":"_guarded_owned_plain_value","file":"elements.py","imported":"_guarded_owned_plain_value","kind":"name","live_lf":{"bytes":254394,"git_blob":"beae44a0c8beb310072c3e12556e249cbd739fc8","sha256":"47F3D2D8474ACCB4FB5DE75384A914FA643EBB0EC4CA0C15F89E15F038E98215"},"live_path":"src/anyfesolver/elements.py","live_raw":{"bytes":260620,"git_blob":"cd24e94b4fbb8134d6e019b4cf7c45c96f72fc39","sha256":"0BECE4C5B5CE30D52111CED39AA3C3B1F74346BBF936EF680A08A68937FB5A3A"},"portable_text":false,"recorded_path":"src/anysolver/elements.py","relative_level":1,"used_attributes":[],"used_in_closure":true},{"bound_name":"_local_contractions","file":"_compensated_contractions.py","imported":"_compensated_contractions","kind":"module","live_lf":{"bytes":23527,"git_blob":"6f0bce4a39de7a8ac74c7558978e346743719984","sha256":"43088D8059FE6481FAD64E63D7E20BA2DB32C223110F92BCC913BDD8C280B131"},"live_path":"src/anyfesolver/_compensated_contractions.py","live_raw":{"bytes":24024,"git_blob":"e82e10b1f74aeee44ccc9e3009444b668f1ed53d","sha256":"7C605295DFF6A63A5D2C3898F944B6CDC4E29D48CADDCFE6A62C5D1B60DD1BAD"},"portable_text":false,"recorded_path":"src/anysolver/_compensated_contractions.py","relative_level":1,"used_attributes":["product","sum_arrays","weighted_sum"],"used_in_closure":true},{"bound_name":"_module_authority_signature","file":"e4_pl_s3_state.py","imported":"_module_authority_signature","kind":"name","live_lf":{"bytes":187347,"git_blob":"640b5a3edaa51aaaf2407bc67921c9035f694ecc","sha256":"9BD8916C1ED7F53F8B8C3EFAEA77E91A330A0E470D8694810BB727CB9F6EBD41"},"live_path":"src/anyfesolver/e4_pl_s3_state.py","permitted_raw":{"crlf":{"bytes":192070,"git_blob":"0f1007d3a31d5174c269ccafef6c99721cd9372b","sha256":"70D3E26C0521CC8803C447102E859F3C0E50C04CC70FFC4EBC2B3E97E3975F25"},"lf":{"bytes":187347,"git_blob":"640b5a3edaa51aaaf2407bc67921c9035f694ecc","sha256":"9BD8916C1ED7F53F8B8C3EFAEA77E91A330A0E470D8694810BB727CB9F6EBD41"}},"portable_text":true,"recorded_path":"src/anysolver/e4_pl_s3_state.py","relative_level":1,"used_attributes":[],"used_in_closure":true},{"bound_name":"_plasticity_module","file":"plasticity.py","imported":"plasticity","kind":"module","live_lf":{"bytes":69069,"git_blob":"1e0b689bb28926223ab25dc5d8553be66cd9c78b","sha256":"72143D58AF3852868A264B749F06ACC6054A3E43BC8F6D364DBDAF9375819378"},"live_path":"src/anyfesolver/plasticity.py","permitted_raw":{"crlf":{"bytes":71156,"git_blob":"0ee67281a6f2a9f6a1085eee02d698629376415a","sha256":"63A77E150DED5A92BAEC8352D3D3F4D3D685748CB005DD7CF900BB5C046D0A0E"},"lf":{"bytes":69069,"git_blob":"1e0b689bb28926223ab25dc5d8553be66cd9c78b","sha256":"72143D58AF3852868A264B749F06ACC6054A3E43BC8F6D364DBDAF9375819378"}},"portable_text":true,"recorded_path":"src/anysolver/plasticity.py","relative_level":1,"used_attributes":["plane_stress_elastic_matrix"],"used_in_closure":true},{"bound_name":"_q4_assumed_strain","file":"_q4_assumed_strain_plasticity.py","imported":"_q4_assumed_strain_plasticity","kind":"module","live_lf":{"bytes":21262,"git_blob":"b78cf67beb8f11d1e0a239c05ee098417ecdfad7","sha256":"CDCA874F3572914C13C0AC710632714035322CDA0531A06B56B701FC0E240E0C"},"live_path":"src/anyfesolver/_q4_assumed_strain_plasticity.py","permitted_raw":{"crlf":{"bytes":21764,"git_blob":"68622a264aa806b5228d6c17839f1327cb170e03","sha256":"98BC1EB4DCBFF19A12C7F1EA3F4FED26A3CAB1146FD69393205644788420F636"},"lf":{"bytes":21262,"git_blob":"b78cf67beb8f11d1e0a239c05ee098417ecdfad7","sha256":"CDCA874F3572914C13C0AC710632714035322CDA0531A06B56B701FC0E240E0C"}},"portable_text":true,"recorded_path":"src/anysolver/_q4_assumed_strain_plasticity.py","relative_level":1,"used_attributes":["elastic_route","kernel_batch","layer_offsets","offset_operator","require_state_supported","require_supported"],"used_in_closure":true},{"bound_name":"_require_authority_array_metadata","file":"e4_pl_s3_state.py","imported":"_require_authority_array_metadata","kind":"name","live_lf":{"bytes":187347,"git_blob":"640b5a3edaa51aaaf2407bc67921c9035f694ecc","sha256":"9BD8916C1ED7F53F8B8C3EFAEA77E91A330A0E470D8694810BB727CB9F6EBD41"},"live_path":"src/anyfesolver/e4_pl_s3_state.py","permitted_raw":{"crlf":{"bytes":192070,"git_blob":"0f1007d3a31d5174c269ccafef6c99721cd9372b","sha256":"70D3E26C0521CC8803C447102E859F3C0E50C04CC70FFC4EBC2B3E97E3975F25"},"lf":{"bytes":187347,"git_blob":"640b5a3edaa51aaaf2407bc67921c9035f694ecc","sha256":"9BD8916C1ED7F53F8B8C3EFAEA77E91A330A0E470D8694810BB727CB9F6EBD41"}},"portable_text":true,"recorded_path":"src/anysolver/e4_pl_s3_state.py","relative_level":1,"used_attributes":[],"used_in_closure":false},{"bound_name":"_require_exact_numpy_runtime_module_identity","file":"e4_pl_s3_state.py","imported":"_require_exact_numpy_runtime_module_identity","kind":"name","live_lf":{"bytes":187347,"git_blob":"640b5a3edaa51aaaf2407bc67921c9035f694ecc","sha256":"9BD8916C1ED7F53F8B8C3EFAEA77E91A330A0E470D8694810BB727CB9F6EBD41"},"live_path":"src/anyfesolver/e4_pl_s3_state.py","permitted_raw":{"crlf":{"bytes":192070,"git_blob":"0f1007d3a31d5174c269ccafef6c99721cd9372b","sha256":"70D3E26C0521CC8803C447102E859F3C0E50C04CC70FFC4EBC2B3E97E3975F25"},"lf":{"bytes":187347,"git_blob":"640b5a3edaa51aaaf2407bc67921c9035f694ecc","sha256":"9BD8916C1ED7F53F8B8C3EFAEA77E91A330A0E470D8694810BB727CB9F6EBD41"}},"portable_text":true,"recorded_path":"src/anysolver/e4_pl_s3_state.py","relative_level":1,"used_attributes":[],"used_in_closure":false},{"bound_name":"_require_immutable_authority_data","file":"e4_pl_s3_state.py","imported":"_require_immutable_authority_data","kind":"name","live_lf":{"bytes":187347,"git_blob":"640b5a3edaa51aaaf2407bc67921c9035f694ecc","sha256":"9BD8916C1ED7F53F8B8C3EFAEA77E91A330A0E470D8694810BB727CB9F6EBD41"},"live_path":"src/anyfesolver/e4_pl_s3_state.py","permitted_raw":{"crlf":{"bytes":192070,"git_blob":"0f1007d3a31d5174c269ccafef6c99721cd9372b","sha256":"70D3E26C0521CC8803C447102E859F3C0E50C04CC70FFC4EBC2B3E97E3975F25"},"lf":{"bytes":187347,"git_blob":"640b5a3edaa51aaaf2407bc67921c9035f694ecc","sha256":"9BD8916C1ED7F53F8B8C3EFAEA77E91A330A0E470D8694810BB727CB9F6EBD41"}},"portable_text":true,"recorded_path":"src/anysolver/e4_pl_s3_state.py","relative_level":1,"used_attributes":[],"used_in_closure":false},{"bound_name":"_s3_state_module","file":"e4_pl_s3_state.py","imported":"e4_pl_s3_state","kind":"module","live_lf":{"bytes":187347,"git_blob":"640b5a3edaa51aaaf2407bc67921c9035f694ecc","sha256":"9BD8916C1ED7F53F8B8C3EFAEA77E91A330A0E470D8694810BB727CB9F6EBD41"},"live_path":"src/anyfesolver/e4_pl_s3_state.py","permitted_raw":{"crlf":{"bytes":192070,"git_blob":"0f1007d3a31d5174c269ccafef6c99721cd9372b","sha256":"70D3E26C0521CC8803C447102E859F3C0E50C04CC70FFC4EBC2B3E97E3975F25"},"lf":{"bytes":187347,"git_blob":"640b5a3edaa51aaaf2407bc67921c9035f694ecc","sha256":"9BD8916C1ED7F53F8B8C3EFAEA77E91A330A0E470D8694810BB727CB9F6EBD41"}},"portable_text":true,"recorded_path":"src/anysolver/e4_pl_s3_state.py","relative_level":1,"used_attributes":[],"used_in_closure":false},{"bound_name":"_shell_elastic_material_cache_fingerprint","file":"elements.py","imported":"_shell_elastic_material_cache_fingerprint","kind":"name","live_lf":{"bytes":254394,"git_blob":"beae44a0c8beb310072c3e12556e249cbd739fc8","sha256":"47F3D2D8474ACCB4FB5DE75384A914FA643EBB0EC4CA0C15F89E15F038E98215"},"live_path":"src/anyfesolver/elements.py","live_raw":{"bytes":260620,"git_blob":"cd24e94b4fbb8134d6e019b4cf7c45c96f72fc39","sha256":"0BECE4C5B5CE30D52111CED39AA3C3B1F74346BBF936EF680A08A68937FB5A3A"},"portable_text":false,"recorded_path":"src/anysolver/elements.py","relative_level":1,"used_attributes":[],"used_in_closure":true},{"bound_name":"_shell_material_matrices","file":"elements.py","imported":"_shell_material_matrices","kind":"name","live_lf":{"bytes":254394,"git_blob":"beae44a0c8beb310072c3e12556e249cbd739fc8","sha256":"47F3D2D8474ACCB4FB5DE75384A914FA643EBB0EC4CA0C15F89E15F038E98215"},"live_path":"src/anyfesolver/elements.py","live_raw":{"bytes":260620,"git_blob":"cd24e94b4fbb8134d6e019b4cf7c45c96f72fc39","sha256":"0BECE4C5B5CE30D52111CED39AA3C3B1F74346BBF936EF680A08A68937FB5A3A"},"portable_text":false,"recorded_path":"src/anysolver/elements.py","relative_level":1,"used_attributes":[],"used_in_closure":true},{"bound_name":"_shell_sections_module","file":"shell_sections.py","imported":"shell_sections","kind":"module","live_lf":{"bytes":14223,"git_blob":"39e39e53b3eb90189ff34b73b806fa0da8100001","sha256":"D3715C71D38F5D29F10B21DAC2EE3DB9ECA98160543CFE2966C4C1AD86FC9F7D"},"live_path":"src/anyfesolver/shell_sections.py","permitted_raw":{"crlf":{"bytes":14617,"git_blob":"02ae80867f196ce81a3b83e3f27db7fbcbff95ae","sha256":"37BE5D2EDAC7B1FEB6D83DE3717326DC6F60C642417CE27252F9EB4DB8FB0C8E"},"lf":{"bytes":14223,"git_blob":"39e39e53b3eb90189ff34b73b806fa0da8100001","sha256":"D3715C71D38F5D29F10B21DAC2EE3DB9ECA98160543CFE2966C4C1AD86FC9F7D"}},"portable_text":true,"recorded_path":"src/anysolver/shell_sections.py","relative_level":1,"used_attributes":[],"used_in_closure":false},{"bound_name":"_watch_exact_numpy_runtime_epoch","file":"e4_pl_s3_state.py","imported":"_watch_exact_numpy_runtime_epoch","kind":"name","live_lf":{"bytes":187347,"git_blob":"640b5a3edaa51aaaf2407bc67921c9035f694ecc","sha256":"9BD8916C1ED7F53F8B8C3EFAEA77E91A330A0E470D8694810BB727CB9F6EBD41"},"live_path":"src/anyfesolver/e4_pl_s3_state.py","permitted_raw":{"crlf":{"bytes":192070,"git_blob":"0f1007d3a31d5174c269ccafef6c99721cd9372b","sha256":"70D3E26C0521CC8803C447102E859F3C0E50C04CC70FFC4EBC2B3E97E3975F25"},"lf":{"bytes":187347,"git_blob":"640b5a3edaa51aaaf2407bc67921c9035f694ecc","sha256":"9BD8916C1ED7F53F8B8C3EFAEA77E91A330A0E470D8694810BB727CB9F6EBD41"}},"portable_text":true,"recorded_path":"src/anysolver/e4_pl_s3_state.py","relative_level":1,"used_attributes":[],"used_in_closure":false},{"bound_name":"canonical_json_bytes","file":"e4_pl_s3_state.py","imported":"canonical_json_bytes","kind":"name","live_lf":{"bytes":187347,"git_blob":"640b5a3edaa51aaaf2407bc67921c9035f694ecc","sha256":"9BD8916C1ED7F53F8B8C3EFAEA77E91A330A0E470D8694810BB727CB9F6EBD41"},"live_path":"src/anyfesolver/e4_pl_s3_state.py","permitted_raw":{"crlf":{"bytes":192070,"git_blob":"0f1007d3a31d5174c269ccafef6c99721cd9372b","sha256":"70D3E26C0521CC8803C447102E859F3C0E50C04CC70FFC4EBC2B3E97E3975F25"},"lf":{"bytes":187347,"git_blob":"640b5a3edaa51aaaf2407bc67921c9035f694ecc","sha256":"9BD8916C1ED7F53F8B8C3EFAEA77E91A330A0E470D8694810BB727CB9F6EBD41"}},"portable_text":true,"recorded_path":"src/anysolver/e4_pl_s3_state.py","relative_level":1,"used_attributes":[],"used_in_closure":true},{"bound_name":"canonical_sha256","file":"e4_pl_s3_state.py","imported":"canonical_sha256","kind":"name","live_lf":{"bytes":187347,"git_blob":"640b5a3edaa51aaaf2407bc67921c9035f694ecc","sha256":"9BD8916C1ED7F53F8B8C3EFAEA77E91A330A0E470D8694810BB727CB9F6EBD41"},"live_path":"src/anyfesolver/e4_pl_s3_state.py","permitted_raw":{"crlf":{"bytes":192070,"git_blob":"0f1007d3a31d5174c269ccafef6c99721cd9372b","sha256":"70D3E26C0521CC8803C447102E859F3C0E50C04CC70FFC4EBC2B3E97E3975F25"},"lf":{"bytes":187347,"git_blob":"640b5a3edaa51aaaf2407bc67921c9035f694ecc","sha256":"9BD8916C1ED7F53F8B8C3EFAEA77E91A330A0E470D8694810BB727CB9F6EBD41"}},"portable_text":true,"recorded_path":"src/anysolver/e4_pl_s3_state.py","relative_level":1,"used_attributes":[],"used_in_closure":true},{"bound_name":"coerce_generalized_shell_section","file":"shell_sections.py","imported":"coerce_generalized_shell_section","kind":"name","live_lf":{"bytes":14223,"git_blob":"39e39e53b3eb90189ff34b73b806fa0da8100001","sha256":"D3715C71D38F5D29F10B21DAC2EE3DB9ECA98160543CFE2966C4C1AD86FC9F7D"},"live_path":"src/anyfesolver/shell_sections.py","permitted_raw":{"crlf":{"bytes":14617,"git_blob":"02ae80867f196ce81a3b83e3f27db7fbcbff95ae","sha256":"37BE5D2EDAC7B1FEB6D83DE3717326DC6F60C642417CE27252F9EB4DB8FB0C8E"},"lf":{"bytes":14223,"git_blob":"39e39e53b3eb90189ff34b73b806fa0da8100001","sha256":"D3715C71D38F5D29F10B21DAC2EE3DB9ECA98160543CFE2966C4C1AD86FC9F7D"}},"portable_text":true,"recorded_path":"src/anysolver/shell_sections.py","relative_level":1,"used_attributes":[],"used_in_closure":false},{"bound_name":"hill48_plane_stress_equivalent_stress","file":"plasticity.py","imported":"hill48_plane_stress_equivalent_stress","kind":"name","live_lf":{"bytes":69069,"git_blob":"1e0b689bb28926223ab25dc5d8553be66cd9c78b","sha256":"72143D58AF3852868A264B749F06ACC6054A3E43BC8F6D364DBDAF9375819378"},"live_path":"src/anyfesolver/plasticity.py","permitted_raw":{"crlf":{"bytes":71156,"git_blob":"0ee67281a6f2a9f6a1085eee02d698629376415a","sha256":"63A77E150DED5A92BAEC8352D3D3F4D3D685748CB005DD7CF900BB5C046D0A0E"},"lf":{"bytes":69069,"git_blob":"1e0b689bb28926223ab25dc5d8553be66cd9c78b","sha256":"72143D58AF3852868A264B749F06ACC6054A3E43BC8F6D364DBDAF9375819378"}},"portable_text":true,"recorded_path":"src/anysolver/plasticity.py","relative_level":1,"used_attributes":[],"used_in_closure":true},{"bound_name":"lobatto_layers","file":"plasticity.py","imported":"lobatto_layers","kind":"name","live_lf":{"bytes":69069,"git_blob":"1e0b689bb28926223ab25dc5d8553be66cd9c78b","sha256":"72143D58AF3852868A264B749F06ACC6054A3E43BC8F6D364DBDAF9375819378"},"live_path":"src/anyfesolver/plasticity.py","permitted_raw":{"crlf":{"bytes":71156,"git_blob":"0ee67281a6f2a9f6a1085eee02d698629376415a","sha256":"63A77E150DED5A92BAEC8352D3D3F4D3D685748CB005DD7CF900BB5C046D0A0E"},"lf":{"bytes":69069,"git_blob":"1e0b689bb28926223ab25dc5d8553be66cd9c78b","sha256":"72143D58AF3852868A264B749F06ACC6054A3E43BC8F6D364DBDAF9375819378"}},"portable_text":true,"recorded_path":"src/anysolver/plasticity.py","relative_level":1,"used_attributes":[],"used_in_closure":true},{"bound_name":"make_authority_epoch_manager","file":"_qualified_authority_epoch.py","imported":"make_authority_epoch_manager","kind":"name","live_lf":{"bytes":19244,"git_blob":"8f9f3c3af4c84bbc8b3ed34d6cab6c275da5ae58","sha256":"232916EE836801118206F639F893DA97222B278884A7AB08612725A5BE630979"},"live_path":"src/anyfesolver/_qualified_authority_epoch.py","permitted_raw":{"crlf":{"bytes":19805,"git_blob":"858ea4bcf3cfc716e7e8800427046987374da7b2","sha256":"6F541AB16AC84355E76FA778DE0CEED820E1A4F73A7F8E0752EEE763652EE02F"},"lf":{"bytes":19244,"git_blob":"8f9f3c3af4c84bbc8b3ed34d6cab6c275da5ae58","sha256":"232916EE836801118206F639F893DA97222B278884A7AB08612725A5BE630979"}},"portable_text":true,"recorded_path":"src/anysolver/_qualified_authority_epoch.py","relative_level":1,"used_attributes":[],"used_in_closure":true},{"bound_name":"require_exact_numpy_runtime_authority","file":"e4_pl_s3_state.py","imported":"require_exact_numpy_runtime_authority","kind":"name","live_lf":{"bytes":187347,"git_blob":"640b5a3edaa51aaaf2407bc67921c9035f694ecc","sha256":"9BD8916C1ED7F53F8B8C3EFAEA77E91A330A0E470D8694810BB727CB9F6EBD41"},"live_path":"src/anyfesolver/e4_pl_s3_state.py","permitted_raw":{"crlf":{"bytes":192070,"git_blob":"0f1007d3a31d5174c269ccafef6c99721cd9372b","sha256":"70D3E26C0521CC8803C447102E859F3C0E50C04CC70FFC4EBC2B3E97E3975F25"},"lf":{"bytes":187347,"git_blob":"640b5a3edaa51aaaf2407bc67921c9035f694ecc","sha256":"9BD8916C1ED7F53F8B8C3EFAEA77E91A330A0E470D8694810BB727CB9F6EBD41"}},"portable_text":true,"recorded_path":"src/anysolver/e4_pl_s3_state.py","relative_level":1,"used_attributes":[],"used_in_closure":false},{"bound_name":"resolved_material_descriptor","file":"e4_pl_s3_state.py","imported":"resolved_material_descriptor","kind":"name","live_lf":{"bytes":187347,"git_blob":"640b5a3edaa51aaaf2407bc67921c9035f694ecc","sha256":"9BD8916C1ED7F53F8B8C3EFAEA77E91A330A0E470D8694810BB727CB9F6EBD41"},"live_path":"src/anyfesolver/e4_pl_s3_state.py","permitted_raw":{"crlf":{"bytes":192070,"git_blob":"0f1007d3a31d5174c269ccafef6c99721cd9372b","sha256":"70D3E26C0521CC8803C447102E859F3C0E50C04CC70FFC4EBC2B3E97E3975F25"},"lf":{"bytes":187347,"git_blob":"640b5a3edaa51aaaf2407bc67921c9035f694ecc","sha256":"9BD8916C1ED7F53F8B8C3EFAEA77E91A330A0E470D8694810BB727CB9F6EBD41"}},"portable_text":true,"recorded_path":"src/anysolver/e4_pl_s3_state.py","relative_level":1,"used_attributes":[],"used_in_closure":true}],"static_runtime_performance_report":{"bytes":4561,"path":"docs/STATIC_RUNTIME_PERFORMANCE.md","sha256":"CBB92A59FDDDA847AA5953EDAA7A2ED6BE1EA64ED1995D415A59B72831BB31D1"}} diff --git a/scripts/build_q4_source_binding_20261111.py b/scripts/build_q4_source_binding_20261111.py new file mode 100644 index 000000000..f51a227c7 --- /dev/null +++ b/scripts/build_q4_source_binding_20261111.py @@ -0,0 +1,773 @@ +#!/usr/bin/env python3 +"""Deterministic collector for the Q4 / V6 source-binding successor record. + +SOURCE BINDING ONLY. This script measures bytes, Git object ids and AST +symbol hashes. It runs no numerics, edits no production source, grants no CI, +scientific or physical acceptance, and cannot claim reviewer approval. + +Every digest in the output is either (a) computed here from live files or Git +objects, or (b) a cited constant from the independent comparison evidence +(q4-source-comparison.json) that is *asserted* against the computed value. Any +disagreement is reported as a problem and ``--write`` refuses to write. + +Usage (from the repository root, with the historical commits present): + + python scripts/build_q4_source_binding_20261111.py # dry run + python scripts/build_q4_source_binding_20261111.py --write # write record + python scripts/build_q4_source_binding_20261111.py --check # freshness + python scripts/build_q4_source_binding_20261111.py --verify-evidence-files + +Git is used read-only (cat-file / rev-parse) for historical objects only. +""" + +from __future__ import annotations + +import argparse +import ast +import hashlib +import json +import subprocess +import sys +from pathlib import Path +from typing import Any + +ROOT = Path(__file__).resolve().parents[1] +OUTPUT = ROOT / "docs" / "reference_cases" / "e4_pl_source_binding_20261111.json" +SCHEMA = "anyfesolver.q4-source-binding-successor-v2" +BOUNDARY = "SOURCE_BINDING_ONLY_NOT_SCIENTIFIC_QUALIFICATION" + +RECORDED_PREFIX = "src/anysolver/" +LIVE_PREFIX = "src/anyfesolver/" +TEXT_LIVE_TO_RECORDED = (("ANYfeSolver", "ANYsolver"), ("anyfesolver", "anysolver")) +ENTRY = "e4_pl_element.py" + +REVISIONS = { + "c31a223f": "c31a223fe63f886a1a9b0b47c926bbe748ad4554", + "5c34dc2e4": "5c34dc2e47f7f0114c2a5832d9515fc9ebc2dc13", + "a0781c0bc": "a0781c0bc8863a9190dc5647c32d263bdf4f581d", + "e0c5f32ab": "e0c5f32ab40e9548ba0ea8981cf5e288ed375a1c", +} +CARRIERS = ( + "e4_pl_element.py", + "e4_pl_s3_element.py", + "_q4_assumed_strain_plasticity.py", + "vectorized_nonlinear.py", + "elements.py", + "_compensated_contractions.py", +) +# Cited constants: independently measured Git ids (identical at 5c34dc2e4, +# a0781c0bc and e0c5f32ab) and the c31a223f terminal blobs. +UPSTREAM_BLOBS = { + "e4_pl_element.py": "47efceacb07a9be0ab92542164e5dd3ca1ea0c63", + "e4_pl_s3_element.py": "8047c66f677be5214fb7457a0312492481fb7e93", + "_q4_assumed_strain_plasticity.py": "b78cf67beb8f11d1e0a239c05ee098417ecdfad7", + "vectorized_nonlinear.py": "b2ed521ff2b16710d50b7ee7b407447eb455ec4e", + "elements.py": "0654d419641bf591ee21ddbe9ddf0c98bc8890c8", + "_compensated_contractions.py": "e82e10b1f74aeee44ccc9e3009444b668f1ed53d", +} +TERMINAL_BLOBS = { + "e4_pl_element.py": "bd6c0dc2cb3661eb73942fc0fea56e527aa8d0b4", + "e4_pl_s3_element.py": "adc6562cbd3fb768d7f0d0ab69011f21ff7c9392", +} +# Cited constants for the live candidate: (raw blob, LF blob, LF sha256, +# blob of LF bytes after the reverse spelling map). +EXPECTED_LIVE = { + "e4_pl_element.py": ( + "3ded2fff1472b8532f88223792232bf4aea2250e", + "3ded2fff1472b8532f88223792232bf4aea2250e", + "d597c84dde8e3b280134c9ddf57ca5ff4f39fb748038c521ae50f2aef5051e3e", + "47efceacb07a9be0ab92542164e5dd3ca1ea0c63", + ), + "e4_pl_s3_element.py": ( + "336cbf9673242908f4bc4b9250a58e55072181ed", + "be978bd2beff2111166c754a35e911aa740196b8", + "f56a3101a74333f35ba0a7162d221b491230e249899e5ab5a7d485ece7d0ed1c", + "8047c66f677be5214fb7457a0312492481fb7e93", + ), + "_q4_assumed_strain_plasticity.py": ( + "68622a264aa806b5228d6c17839f1327cb170e03", + "b78cf67beb8f11d1e0a239c05ee098417ecdfad7", + "cdca874f3572914c13c0ac710632714035322cda0531a06b56b701fc0e240e0c", + "b78cf67beb8f11d1e0a239c05ee098417ecdfad7", + ), + "vectorized_nonlinear.py": ( + "b2ed521ff2b16710d50b7ee7b407447eb455ec4e", + "656c7baa056660fced221c572be4760b9807e526", + "13d0683f5c91cbfcb39dc36cca0b9f978a59f09af8e85270fbee6df574729efc", + "656c7baa056660fced221c572be4760b9807e526", + ), + "elements.py": ( + "cd24e94b4fbb8134d6e019b4cf7c45c96f72fc39", + "beae44a0c8beb310072c3e12556e249cbd739fc8", + "47f3d2d8474accb4fb5de75384a914fa643ebb0ec4ca0c15f89e15f038e98215", + "a90a8da82c4f5603161eeb76f754babc3f4c243e", + ), + "_compensated_contractions.py": ( + "e82e10b1f74aeee44ccc9e3009444b668f1ed53d", + "6f0bce4a39de7a8ac74c7558978e346743719984", + "43088d8059fe6481fad64e63d7e20ba2db32c223110f92bcc913bdd8c280b131", + "6f0bce4a39de7a8ac74c7558978e346743719984", + ), +} +# Two authentic states of the October 19 record (exact Git genealogy in the +# cited lineage evidence). AS_REVIEWED is the original reader-pinned blob, +# restored byte-for-byte; OCT19_RECORD is the live in-place file whose only +# post-pin edits are six rebinds of external-dependency sha256 leaves. +OCT19_AS_REVIEWED = "docs/reference_cases/e4_pl_q4_source_binding_20261019_as_reviewed.json" +OCT19_AS_REVIEWED_SHA256 = "64B07F1A535E6D6EFCEAE0B2EC01BA539DF69BE7956C03DBDA65C2ACF7C7E74F" +OCT19_AS_REVIEWED_BLOB = "99b59279e9702b509a84f1932874e2b24680adcc" +OCT19_AS_REVIEWED_BYTES = 71924 +OCT19_RECORD = "docs/reference_cases/e4_pl_q4_source_binding_20261019.json" +OCT19_RECORD_SHA256 = "06679901687621BD6696DB9C8777A80131EE08631BFCCA706FD03FA15042FB38" +OCT19_RECORD_BLOB = "3052505a185198142ffeee60fbee8ad46b3d968c" +OCT19_RECORD_BYTES = 70591 +LEAF_PREFIX = "external_arithmetic_dependencies/" +# Auto-text sources (Git LF, Windows CRLF without an eol attribute). Identity is +# the canonical LF form; exactly two physical forms are permitted (uniform LF or +# uniform CRLF). Everything else, including -text carriers, keeps exact raw bytes. +PORTABLE_AUTO_TEXT = frozenset({ + "e4_pl_s3_element.py", "_q4_assumed_strain_plasticity.py", "_qualified_authority_epoch.py", + "shell_sections.py", "e4_pl_s3_state.py", "plasticity.py", +}) +# Independently audited inputs (whole-file SHA-256 of the supplied evidence). +LINEAGE_JSON_SHA256 = "1cef66aedcd866ed1feaa1ee28497f30a96966a78d01e1cb472ea5d58dbbd7ac" +LINEAGE_README_SHA256 = "0605298d0ec64b1f005e0139513da7a588cab256e58b36ab3140d04295bef523" +LINEAGE_DIR = Path("C:/ANYworkspaceWork/anyfesolver-rollout-20261111/evidence/q4-lineage") +HISTORICAL_FILES = ( + OCT19_AS_REVIEWED, + OCT19_RECORD, + "docs/reference_cases/qualified_shell_runtime_guard_performance_successor.json", + "docs/reference_cases/e4_pl_q4_0_4_1_replay_hotfix.json", + "docs/reference_cases/e4_pl_q4_0_4_2_replay_canonicalization.json", + "docs/reference_cases/e4_pl_s3_v2d_default_activation_candidate.json", + "docs/reference_cases/e4_pl_s3_v2d_default_integration_repair.json", + "docs/reference_cases/e4_pl_s3_mixed_mesh_qualification_contract.json", + "docs/STATIC_RUNTIME_PERFORMANCE.md", +) +CONTRACT = "docs/reference_cases/e4_pl_s3_mixed_mesh_qualification_contract.json" +STATIC_REPORT_SHA256 = "CBB92A59FDDDA847AA5953EDAA7A2ED6BE1EA64ED1995D415A59B72831BB31D1" +EXPECTED_CLOSURE = { + "oct19": (159, "996C94581594E958545D5D64F25D1864942941A5B766BE88A79A4991BD4DE95C"), + "upstream": (161, "CF0026B4621EA9180B0DFCE1A483AFB8A762A218CB5CC3F538517C1A8D0843AA"), + "candidate": (161, "8F7841580C5A835C18BE351161DBF714F2D048A4F00203FE656EEEBD81E9C480"), +} +EVIDENCE_REPORTS = { + "C:/ANYworkspaceWork/codex-q4-qual-notes/03_FINAL_REPORT.md": "3b0bfcf5fbf1499c9027d05b20af3404e21db73866e862fa085df61ed8f84f9e", + "C:/ANYworkspaceWork/codex-q4-qual-notes/04_POSTMERGE_REPORT.md": "4af246083c78245db61e00ca42314ccfa6551cb3d3efd2091e4ea6d80aac9d98", + "C:/ANYworkspaceWork/codex-q4-qual-notes/99_COORDINATOR_ACK.md": "fde1e77d52e92a850fac5f13bf8d34a57c58597f0d9c59d7c7f5a18d6197c504", + "C:/ANYworkspaceWork/qualification-plan/DECISIONS_LOG.md": "f88475e28cc9802d8e898184652fa91fd73886a2fe00fdb8f0714cf8697ffead", + "C:/ANYworkspaceWork/codex-s3-notes/03_FINAL_REPORT.md": "3de04929016b7ebc764924dd99cc6043f911059256b0a2d9e8a815dce7b1730e", + "C:/ANYworkspaceWork/codex-s3-notes/99_COORDINATOR_ACK.md": "cac0ed2eacf957ee76a90621e60e9423109917d30cf93ad4bbfac875d2d1cd60", +} + + +# ---------------------------------------------------------------- primitives +def sha256_upper(data: bytes) -> str: + return hashlib.sha256(data).hexdigest().upper() + + +def git_blob_id(data: bytes) -> str: + return hashlib.sha1(f"blob {len(data)}\0".encode("ascii") + data).hexdigest() + + +def lf(data: bytes) -> bytes: + return data.replace(b"\r\n", b"\n") + + +def identity(data: bytes) -> dict[str, Any]: + return {"bytes": len(data), "git_blob": git_blob_id(data), "sha256": sha256_upper(data)} + + +def reverse_spelling(data: bytes) -> bytes: + for live, recorded in TEXT_LIVE_TO_RECORDED: + data = data.replace(live.encode("ascii"), recorded.encode("ascii")) + return data + + +def canonical_bytes(value: object) -> bytes: + return ( + json.dumps(value, sort_keys=True, separators=(",", ":"), ensure_ascii=True, allow_nan=False).encode("utf-8") + + b"\n" + ) + + +def strict_json(raw: bytes) -> Any: + def pairs(items: list[tuple[str, Any]]) -> dict[str, Any]: + out: dict[str, Any] = {} + for key, value in items: + if key in out: + raise ValueError(f"duplicate key {key!r}") + out[key] = value + return out + + return json.loads(raw, object_pairs_hook=pairs) + + +def git_blob_at(rev: str, logical_path: str) -> bytes | None: + done = subprocess.run( + ["git", "cat-file", "blob", f"{rev}:{logical_path}"], cwd=ROOT, capture_output=True, check=False + ) + return done.stdout if done.returncode == 0 else None + + +# ------------------------------------------------------ AST closure (pure) +def canonical_ast(value: object) -> object: + if isinstance(value, ast.AST): + fields: list[list[object]] = [] + for name, item in ast.iter_fields(value): + if name == "type_comment" and item is None: + continue + if name == "type_params" and item == []: + continue + if ( + name == "body" + and isinstance(item, list) + and item + and isinstance(item[0], ast.Expr) + and isinstance(item[0].value, ast.Constant) + and isinstance(item[0].value.value, str) + ): + item = item[1:] + fields.append([name, canonical_ast(item)]) + return [type(value).__name__, fields] + if isinstance(value, (list, tuple)): + return [canonical_ast(item) for item in value] + if value is Ellipsis: + return ["Ellipsis"] + if value is None or isinstance(value, (str, int, float, bool)): + return value + if isinstance(value, bytes): + return ["bytes", value.hex()] + raise TypeError(f"unsupported AST field value {type(value).__name__}") + + +def symbol_nodes(source: str) -> dict[str, list[ast.AST]]: + nodes: dict[str, list[ast.AST]] = {} + + def visit(body: list[ast.stmt], prefix: str = "") -> None: + for node in body: + if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef, ast.ClassDef)): + name = f"{prefix}{node.name}" + nodes.setdefault(name, []).append(node) + if isinstance(node, ast.ClassDef): + visit(node.body, f"{name}.") + continue + targets: list[str] = [] + if isinstance(node, ast.Assign): + targets = [t.id for t in node.targets if isinstance(t, ast.Name)] + elif isinstance(node, ast.AnnAssign) and isinstance(node.target, ast.Name): + targets = [node.target.id] + for target in targets: + nodes.setdefault(f"{prefix}{target}", []).append(node) + + visit(ast.parse(source).body) + return nodes + + +def _digest(value: object) -> str: + return sha256_upper(json.dumps(value, sort_keys=True, separators=(",", ":"), ensure_ascii=True, allow_nan=False).encode("utf-8")) + + +def closure_payload(source: str, roots: set[str], required: set[str], schema: str, path: str) -> dict[str, Any]: + inventory = symbol_nodes(source) + need = roots | required + bad = sorted(n for n in need if len(inventory.get(n, ())) != 1) + if bad: + raise ValueError(f"missing or duplicate closure symbols: {bad}") + module_symbols = {n for n in inventory if "." not in n} + owners = {"QualifiedE4PLShellElement", "__class__", "cls", "self"} + + def deps(symbol: str) -> list[str]: + found: set[str] = set() + for item in ast.walk(inventory[symbol][0]): + if isinstance(item, ast.Name) and isinstance(item.ctx, ast.Load) and item.id in module_symbols: + found.add(item.id) + elif ( + isinstance(item, ast.Attribute) + and isinstance(item.ctx, ast.Load) + and isinstance(item.value, ast.Name) + and item.value.id in owners + and f"QualifiedE4PLShellElement.{item.attr}" in inventory + ): + found.add(f"QualifiedE4PLShellElement.{item.attr}") + found.discard(symbol) + return sorted(found) + + closure, pending, edges = set(roots), sorted(roots), {} + while pending: + symbol = pending.pop(0) + edges[symbol] = deps(symbol) + for dep in edges[symbol]: + if len(inventory.get(dep, ())) != 1: + raise ValueError(f"unresolved closure dependency {symbol} -> {dep}") + if dep not in closure: + closure.add(dep) + pending.append(dep) + pending.sort() + edges = {k: edges[k] for k in sorted(edges)} + symbols = {n: _digest(canonical_ast(inventory[n][0])) for n in sorted(edges)} + return {"edges": edges, "path": path, "roots": sorted(roots), "schema": schema, "symbols": symbols} + + +def aggregate(payload: dict[str, Any]) -> str: + return _digest(payload) + + +def module_symbol_hashes(source: str) -> dict[str, str]: + return {n: _digest([canonical_ast(x) for x in v]) for n, v in sorted(symbol_nodes(source).items())} + + +def internal_imports(source: str, closure_symbols: list[str]) -> list[dict[str, Any]]: + """Every sibling-package import of the entry module, with closure usage.""" + tree = ast.parse(source) + inventory = symbol_nodes(source) + rows: list[dict[str, Any]] = [] + for node in ast.walk(tree): + if not isinstance(node, ast.ImportFrom): + continue + absolute = node.level == 0 and node.module and node.module.split(".")[0] in ("anyfesolver", "anysolver") + if node.level == 0 and not absolute: + continue + parts = (node.module.split(".")[1:] if absolute else (node.module.split(".") if node.module else [])) + for alias in node.names: + file = ("/".join(parts) if parts else alias.name) + ".py" + rows.append( + { + "bound_name": alias.asname or alias.name, + "file": file if node.level <= 1 else None, + "imported": alias.name, + "kind": "name" if parts else "module", + "relative_level": node.level, + } + ) + for row in rows: + used: set[str] = set() + loaded = False + for symbol in closure_symbols: + for item in ast.walk(inventory[symbol][0]): + if isinstance(item, ast.Name) and isinstance(item.ctx, ast.Load) and item.id == row["bound_name"]: + loaded = True + if ( + isinstance(item, ast.Attribute) + and isinstance(item.value, ast.Name) + and item.value.id == row["bound_name"] + ): + used.add(item.attr) + row["used_attributes"] = sorted(used) if row["kind"] == "module" else [] + row["used_in_closure"] = loaded or bool(used) + return sorted(rows, key=lambda r: (r["bound_name"], str(r["file"]), r["imported"])) + + +# ---------------------------------------------------- historical lineage +def leaves(value: object, path: tuple[str, ...] = ()) -> dict[str, object]: + if isinstance(value, dict): + out: dict[str, object] = {} + for key in value: + out.update(leaves(value[key], path + (key,))) + return out + if isinstance(value, list): + out = {} + for index, item in enumerate(value): + out.update(leaves(item, path + (str(index),))) + return out + return {"/".join(path): value} + + +def physical(problems: list[str], name: str, raw: bytes) -> dict[str, Any]: + """Canonical LF identity plus the exactly permitted physical representations.""" + canonical = lf(raw) + out: dict[str, Any] = {"live_lf": identity(canonical), "portable_text": name in PORTABLE_AUTO_TEXT} + if out["portable_text"]: + crlf = canonical.replace(b"\n", b"\r\n") + if b"\r" in canonical or raw not in (canonical, crlf): + problems.append(f"{name}: raw is mixed-ending, double-CR or not uniform LF/CRLF") + out["permitted_raw"] = {"crlf": identity(crlf), "lf": identity(canonical)} + else: + out["live_raw"] = identity(raw) + return out + + +def git_text(*args: str) -> str | None: + done = subprocess.run(["git", *args], cwd=ROOT, capture_output=True, text=True, check=False) + return done.stdout.strip() if done.returncode == 0 else None + + +def verify_lineage_against_git(problems: list[str], nodes: list[dict[str, Any]]) -> None: + """Maintainer-only: every node, blob, digest and parent list must exist in Git.""" + for node in nodes: + commit = node["commit"] + data = git_blob_at(commit, OCT19_RECORD) + if data is None or (git_blob_id(data), sha256_upper(data), len(data)) != (node["blob"], node["sha256"], node["length"]): + problems.append(f"lineage node {commit}: record object differs from Git (or commit absent)") + listed = git_text("rev-list", "--parents", "-n", "1", commit) + if listed is None or listed.split()[1:] != [p["commit"] for p in node["parents"]]: + problems.append(f"lineage node {commit}: parent list differs from Git") + for parent in node["parents"]: + if git_text("rev-parse", f"{parent['commit']}:{OCT19_RECORD}") != parent["blob"]: + problems.append(f"lineage node {commit}: parent {parent['commit']} blob differs from Git") + + +def lineage_section(expect, problems: list[str], reviewed: Any, current: Any, lineage_dir: Path) -> dict[str, Any]: + """Static, Git-free copy of the measured six-edit lineage (for later tests).""" + lineage_file, readme_file = lineage_dir / "lineage.json", lineage_dir / "README.md" + if not (lineage_file.is_file() and readme_file.is_file()): + problems.append(f"lineage evidence missing under {lineage_dir}") + return {} + raw = lineage_file.read_bytes() + expect("lineage.json whole-file sha256 (vetted input)", hashlib.sha256(raw).hexdigest(), LINEAGE_JSON_SHA256) + expect("lineage README whole-file sha256 (vetted input)", hashlib.sha256(readme_file.read_bytes()).hexdigest(), LINEAGE_README_SHA256) + lineage = strict_json(raw) + nodes_all = [ + {key: node[key] for key in ("blob", "commit", "length", "parents", "sha256")} for node in lineage["nodes"] + ] + expect("lineage node count", len(nodes_all), 9) + verify_lineage_against_git(problems, nodes_all) + expect("lineage reader pin", lineage["original_reader_sha256"], OCT19_AS_REVIEWED_SHA256) + expect("lineage anchor", lineage["anchor"], REVISIONS["e0c5f32ab"]) + expect("lineage anchor blob", lineage["anchor_blob"], OCT19_RECORD_BLOB) + nodes = lineage["nodes"] + pin_index = next(i for i, n in enumerate(nodes) if n["blob"] == OCT19_AS_REVIEWED_BLOB) + pin = nodes[pin_index] + expect("lineage pin node", (pin["sha256"], pin["length"]), (OCT19_AS_REVIEWED_SHA256, OCT19_AS_REVIEWED_BYTES)) + state = leaves(reviewed) + previous_blob = OCT19_AS_REVIEWED_BLOB + transitions: list[dict[str, Any]] = [] + merge: dict[str, Any] | None = None + for node in nodes[pin_index + 1:]: + if len(node["parents"]) != 1: + merge = {"blob": node["blob"], "commit": node["commit"], "parents": node["parents"], "sha256": node["sha256"]} + expect("lineage merge blob", node["blob"], OCT19_RECORD_BLOB) + continue + parent = node["parents"][0] + expect(f"lineage continuity {node['commit'][:9]}", parent["blob"], previous_blob) + for leaf, change in parent["changes"].items(): + if not (leaf.startswith(LEAF_PREFIX) and leaf.endswith("/sha256")): + problems.append(f"unexpected changed leaf outside external sha256 leaves: {leaf}") + expect(f"lineage leaf chain {leaf}", state.get(leaf), change["before"]) + state[leaf] = change["after"] + transitions.append({ + "blob": node["blob"], "changes": parent["changes"], "commit": node["commit"], + "parent_blob": parent["blob"], "parent_commit": parent["commit"], + "sha256": node["sha256"], "length": node["length"], + }) + previous_blob = node["blob"] + expect("lineage transition count", len(transitions), 6) + expect("lineage ends at current record blob", previous_blob, OCT19_RECORD_BLOB) + expect("lineage replay reproduces current leaves", state == leaves(current), True) + if merge is not None: + for parent in merge["parents"]: + for leaf in parent["changes"]: + if not (leaf.startswith(LEAF_PREFIX) and leaf.endswith("/sha256")): + problems.append(f"unexpected merge-parent leaf: {leaf}") + return { + "anchor": lineage["anchor"], + "lineage_json_sha256": hashlib.sha256(raw).hexdigest().upper(), + "chain_sha256": _digest(nodes_all), + "nodes": nodes_all, + "pin_node": {"blob": pin["blob"], "commit": pin["commit"], "length": pin["length"], "sha256": pin["sha256"]}, + "readme_sha256": sha256_upper(readme_file.read_bytes()), + "scientific_transfer_endorsed": False, + } + + +def historical_gaps(current: Any) -> list[dict[str, Any]]: + """Whole-file comparisons of the current record that do not describe live bytes.""" + review = current["source_binding_integration_review"] + external = current["external_arithmetic_dependencies"]["_elements_module"] + checks = [ + ("source", current["source"]["path"], current["source"]["sha256"], "source/sha256"), + ("lifecycle_delta", review["lifecycle_delta"]["path"], review["lifecycle_delta"]["sha256"], + "source_binding_integration_review/lifecycle_delta/sha256"), + ("external__elements_module", external["path"], external["sha256"], + "external_arithmetic_dependencies/_elements_module/sha256"), + ] + for relative, row in sorted(current["observed_focused_pre_reader_integration"]["all_source_symbol_delta"]["files"].items()): + if relative.startswith("tests/test_general_contact_c5_"): + checks.append(( + f"observed_{relative}", relative, row["after_source_sha256"], + f"observed_focused_pre_reader_integration/all_source_symbol_delta/files/{relative}/after_source_sha256", + )) + gaps = [] + for check, recorded, digest, leaf in checks: + live = recorded.replace(RECORDED_PREFIX, LIVE_PREFIX, 1) + live_bytes = (ROOT / live).read_bytes() # protected (-text) carriers: raw is pinned too + live_sha = sha256_upper(lf(live_bytes)) + gaps.append({ + "historical_leaf": leaf, "live_raw": identity(live_bytes), "live_lf": identity(lf(live_bytes)), + "check": check, "historical_gap": True, "live_lf_sha256": live_sha, + "live_lf_matches_recorded": live_sha == digest.upper(), "live_path": live, + "recorded_path": recorded, "recorded_sha256": digest.upper(), + }) + return gaps + + +# ------------------------------------------------------------------ builder +def build(lineage_dir: Path = LINEAGE_DIR) -> tuple[dict[str, Any], list[str]]: + problems: list[str] = [] + + def expect(label: str, actual: object, expected: object) -> None: + if actual != expected: + problems.append(f"{label}: computed {actual!r} != cited {expected!r}") + + for key, full in REVISIONS.items(): + done = subprocess.run(["git", "cat-file", "-e", f"{full}^{{commit}}"], cwd=ROOT, capture_output=True, check=False) + if done.returncode != 0: + problems.append(f"revision {key} ({full}) is not present in this repository") + + contract = strict_json((ROOT / CONTRACT).read_bytes()) + authority = contract["candidate"]["qualified_q4_mechanics_authority"] + roots, required = set(authority["roots"]), set(authority["symbols"]) + schema, logical_entry = authority["schema"], authority["path"] + expect("contract entry path", logical_entry, RECORDED_PREFIX + ENTRY) + + historical_files = {} + for relative in HISTORICAL_FILES: + historical_files[relative] = sha256_upper((ROOT / relative).read_bytes()) + reviewed_raw = (ROOT / OCT19_AS_REVIEWED).read_bytes() + current_raw = (ROOT / OCT19_RECORD).read_bytes() + expect("as-reviewed record identity", (sha256_upper(reviewed_raw), git_blob_id(reviewed_raw), len(reviewed_raw)), + (OCT19_AS_REVIEWED_SHA256, OCT19_AS_REVIEWED_BLOB, OCT19_AS_REVIEWED_BYTES)) + expect("current historical record identity", (sha256_upper(current_raw), git_blob_id(current_raw), len(current_raw)), + (OCT19_RECORD_SHA256, OCT19_RECORD_BLOB, OCT19_RECORD_BYTES)) + expect("static performance report sha256", historical_files["docs/STATIC_RUNTIME_PERFORMANCE.md"], STATIC_REPORT_SHA256) + oct19 = strict_json(reviewed_raw) # the original reader semantic + current_record = strict_json(current_raw) + for key in ("mechanics", "mechanics_aggregate_sha256", "source_binding_integration_review", "observed_focused_pre_reader_integration"): + expect(f"current historical record keeps {key}", current_record[key], oct19[key]) + expect("Oct19 aggregate", oct19["mechanics_aggregate_sha256"], EXPECTED_CLOSURE["oct19"][1]) + expect("Oct19 symbol count", len(oct19["mechanics"]["symbols"]), EXPECTED_CLOSURE["oct19"][0]) + oct19_flags = { + key: oct19["source_binding_integration_review"][key] + for key in ("physical_acceptance_transfer", "C5_exception_transfer", "CI_credit") + } + expect("Oct19 nonacceptance flags", oct19_flags, {k: False for k in oct19_flags}) + observed = oct19["observed_focused_pre_reader_integration"] + expect("Oct19 observation", (observed["status"], observed["case_count"], observed["phase_count"]), ("PASS", 41, 123)) + + carriers: dict[str, Any] = {} + live_lf_sources: dict[str, str] = {} + for name in CARRIERS: + live_path = LIVE_PREFIX + name + recorded_path = RECORDED_PREFIX + name + raw = (ROOT / live_path).read_bytes() + live_lf = lf(raw) + reverse = reverse_spelling(live_lf) + raw_blob, lf_blob, lf_sha, reverse_blob = EXPECTED_LIVE[name] + if name not in PORTABLE_AUTO_TEXT: # portable files: canonical LF identity only + expect(f"{name} live raw blob", git_blob_id(raw), raw_blob) + expect(f"{name} live LF blob", git_blob_id(live_lf), lf_blob) + expect(f"{name} live LF sha256", sha256_upper(live_lf).lower(), lf_sha) + expect(f"{name} reverse-spelling blob", git_blob_id(reverse), reverse_blob) + upstream_raw = git_blob_at(REVISIONS["e0c5f32ab"], recorded_path) + entry: dict[str, Any] = { + "live_path": live_path, + "recorded_path": recorded_path, + **physical(problems, name, raw), + "live_lf_after_reverse_spelling_map": identity(reverse), + } + if upstream_raw is None: + problems.append(f"{name}: not readable at e0c5f32ab as {recorded_path}") + else: + expect(f"{name} upstream raw blob", git_blob_id(upstream_raw), UPSTREAM_BLOBS[name]) + for rev in ("5c34dc2e4", "a0781c0bc"): + other = git_blob_at(REVISIONS[rev], recorded_path) + expect(f"{name} blob at {rev}", None if other is None else git_blob_id(other), UPSTREAM_BLOBS[name]) + upstream_lf = lf(upstream_raw) + entry["upstream_raw"] = identity(upstream_raw) + entry["upstream_lf"] = identity(upstream_lf) + entry["reverse_spelling_map_reproduces_upstream_lf"] = reverse == upstream_lf + expect(f"{name} reverse map reproduces upstream LF", reverse == upstream_lf, True) + up_syms = module_symbol_hashes(upstream_lf.decode("utf-8")) + lv_syms = module_symbol_hashes(live_lf.decode("utf-8")) + entry["module_symbols"] = { + "added": sorted(set(lv_syms) - set(up_syms)), + "candidate_aggregate_sha256": _digest(lv_syms), + "changed": sorted(n for n in up_syms if n in lv_syms and up_syms[n] != lv_syms[n]), + "removed": sorted(set(up_syms) - set(lv_syms)), + "upstream_aggregate_sha256": _digest(up_syms), + } + if name in TERMINAL_BLOBS: + entry["v6_terminal_git_blob"] = TERMINAL_BLOBS[name] + entry["live_lf_equals_v6_terminal"] = git_blob_id(live_lf) == TERMINAL_BLOBS[name] + carriers[name] = entry + live_lf_sources[name] = live_lf.decode("utf-8") + + # Closure measurements, always with the recorded logical path. + candidate = closure_payload(live_lf_sources[ENTRY], roots, required, schema, logical_entry) + candidate_agg = aggregate(candidate) + expect("candidate closure", (len(candidate["symbols"]), candidate_agg), EXPECTED_CLOSURE["candidate"]) + upstream_source = git_blob_at(REVISIONS["e0c5f32ab"], RECORDED_PREFIX + ENTRY) + upstream_agg = "" + upstream_symbols: dict[str, str] = {} + if upstream_source is not None: + upstream = closure_payload(lf(upstream_source).decode("utf-8"), roots, required, schema, logical_entry) + upstream_agg = aggregate(upstream) + upstream_symbols = upstream["symbols"] + expect("upstream closure", (len(upstream_symbols), upstream_agg), EXPECTED_CLOSURE["upstream"]) + oct19_symbols = oct19["mechanics"]["symbols"] + + def delta(old: dict[str, str], new: dict[str, str]) -> dict[str, list[str]]: + return { + "added": sorted(set(new) - set(old)), + "changed": sorted(n for n in old if n in new and old[n] != new[n]), + "removed": sorted(set(old) - set(new)), + } + + imports = internal_imports(live_lf_sources[ENTRY], sorted(candidate["symbols"])) + for row in imports: + if row["file"] is None or row["relative_level"] > 1: + problems.append(f"unsupported internal import form: {row}") + continue + data = (ROOT / LIVE_PREFIX / row["file"]).read_bytes() + row["live_path"] = LIVE_PREFIX + row["file"] + row["recorded_path"] = RECORDED_PREFIX + row["file"] + row.update(physical(problems, row["file"], data)) + oct19_external = { + alias: {"path": v["path"], "used_attributes": v["used_attributes"], "sha256": v["sha256"].upper()} + for alias, v in oct19["external_arithmetic_dependencies"].items() + } + lineage = lineage_section(expect, problems, oct19, current_record, lineage_dir) + gaps = historical_gaps(current_record) + expect("historical gap count", len(gaps), 5) + for gap in gaps: + expect(f"gap {gap['check']} is a nonmatch", gap["live_lf_matches_recorded"], False) + + record: dict[str, Any] = { + "adoption": { + "independent_review_required_outside_generating_invocation": True, + "owner_adoption_recorded": False, + "reviewer_approval_claimed": False, + "status": "UNREVIEWED_CANDIDATE_RECORD", + }, + "boundary_flags": { + "C5_exception_transfer": False, + "CI_credit": False, + "historical_observation_rerun": False, + "historical_records_modified": False, + "new_physical_acceptance": False, + "new_scientific_acceptance": False, + "numerical_tolerances_changed": False, + "physical_acceptance_transfer": False, + "production_mechanics_changed_by_this_record": False, + }, + "carriers": carriers, + "historical_evidence_cited": { + "oct19_nonacceptance_flags_retained": oct19_flags, + "oct19_observation_retained_historical_only": {"case_count": 41, "phase_count": 123, "rerun": False}, + "owner_decision": "Option A: public stress accepted with follow-up; elastic bit-identity waiver confined to qualified Q4; owner approved qualified S3 von Karman default subject to its gates", + "postmerge_confirmation": { + "commit": REVISIONS["a0781c0bc"], + "product_digest": "9db4a9abac478313a3000d67a286174e1999d9259df74b030fdbe5878e2feb7f", + "required_tests": 26, + "test_outcomes_matching_target": 2679, + }, + "q4_r4_grade": { + "commit": REVISIONS["5c34dc2e4"], + "exceptions": ["W1 2.5% at n8", "C4 1% same-mesh legacy and S8R-weighted band", "A8 one route-count exception", "H1 open HIGH untagged historical plastic state"], + "grade": "READY-WITH-EXCEPTIONS", + "matrix_cells": "68/68", + "product_digest": "f2acc4da71e052fc4c8bee250963d012c80a5a6d95111d68ab2183e900d0780d", + "product_files": 741, + }, + "report_sha256_cited": {k: v for k, v in sorted(EVIDENCE_REPORTS.items())}, + "s3_r1_grade": "READY with coordinator-granted exceptions and OPEN-LOW limitations", + "scope_statement": "Cited history only. Gives no credit to the current release source or any installed build.", + }, + "historical_files_sha256": historical_files, + "links": { + "L1_OCT19_AND_V6_TERMINAL_TO_QUALIFIED_Q4_R4": { + "external_kernel_added": "_q4_assumed_strain_plasticity.py", + "mechanics_changed": True, + "oct19_external_dependencies": oct19_external, + "oct19_closure": {"aggregate_sha256": oct19["mechanics_aggregate_sha256"], "symbol_count": len(oct19_symbols)}, + "qualified_target_closure": {"aggregate_sha256": upstream_agg, "symbol_count": len(upstream_symbols)}, + "symbol_delta_oct19_to_qualified_target": delta(oct19_symbols, upstream_symbols), + "v6_terminal_blobs": TERMINAL_BLOBS, + "v6_terminal_mechanics_unchanged_claim_extended": False, + }, + "L2_UPSTREAM_E0C5F32AB_TO_RELEASE_CANDIDATE": { + "claim": "SIX_CARRIER_SPELLING_ONLY_AFTER_REVERSE_MAP_NOT_EXTENDED_TO_OTHER_PATHS", + "symbol_delta_upstream_to_candidate": delta(upstream_symbols, candidate["symbols"]), + "unbound_scope": "Other runtime and packaging paths that differ from 5c34dc2e4 to e0c5f32ab (37 in the comparison) and transitive imports of the carriers are not bound by this record.", + }, + }, + "mechanics": { + "aggregate_sha256": candidate_agg, + "logical_path": logical_entry, + "roots": candidate["roots"], + "schema": schema, + "symbol_count": len(candidate["symbols"]), + "symbols": candidate["symbols"], + }, + "predecessor": { + "oct19_as_reviewed": { + "bytes": OCT19_AS_REVIEWED_BYTES, "git_blob": OCT19_AS_REVIEWED_BLOB, + "path": OCT19_AS_REVIEWED, "sha256": OCT19_AS_REVIEWED_SHA256, + }, + "oct19_current_historical": { + "bytes": OCT19_RECORD_BYTES, "git_blob": OCT19_RECORD_BLOB, + "path": OCT19_RECORD, "sha256": OCT19_RECORD_SHA256, + }, + "current_historical_equals_as_reviewed": False, + "current_historical_describes_current_execution": False, + "v6_runtime_guard_successor_commit": REVISIONS["c31a223f"], + }, + "historical_gaps_of_current_historical_record": gaps, + "historical_record_lineage": lineage, + "qualification_boundary": BOUNDARY, + "recorded_to_live_spelling_map": { + "applies": "source resolution only; recorded bytes and recorded logical paths are never rewritten", + "path_map": {RECORDED_PREFIX + n: LIVE_PREFIX + n for n in CARRIERS}, + "text_live_to_recorded": [list(pair) for pair in TEXT_LIVE_TO_RECORDED], + }, + "revisions": REVISIONS, + "schema": SCHEMA, + "sibling_imports_of_entry_module": imports, + "static_runtime_performance_report": { + "bytes": 4561, + "path": "docs/STATIC_RUNTIME_PERFORMANCE.md", + "sha256": STATIC_REPORT_SHA256, + }, + } + return record, problems + + +def verify_evidence_files() -> list[str]: + out = [] + for path, expected in EVIDENCE_REPORTS.items(): + file = Path(path) + if not file.is_file(): + out.append(f"missing evidence file {path}") + elif hashlib.sha256(file.read_bytes()).hexdigest() != expected: + out.append(f"evidence file digest differs: {path}") + return out + + +def main(argv: list[str] | None = None) -> int: + parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + parser.add_argument("--write", action="store_true", help="write the record when there are no problems") + parser.add_argument("--check", action="store_true", help="fail unless the on-disk record is fresh") + parser.add_argument("--verify-evidence-files", action="store_true") + parser.add_argument("--lineage-dir", type=Path, default=LINEAGE_DIR, help="directory with lineage.json and README.md") + args = parser.parse_args(argv) + record, problems = build(args.lineage_dir) + if args.verify_evidence_files: + problems += verify_evidence_files() + data = canonical_bytes(record) + print(f"record sha256 (would-be bytes): {sha256_upper(data)} ({len(data)} bytes)") + for problem in problems: + print(f"PROBLEM: {problem}", file=sys.stderr) + if problems: + return 1 + if args.check: + if not OUTPUT.is_file() or OUTPUT.read_bytes() != data: + print("record missing or stale", file=sys.stderr) + return 1 + elif args.write: + OUTPUT.write_bytes(data) + print(f"wrote {OUTPUT.relative_to(ROOT).as_posix()}") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tests/test_e4_pl_s3_mixed_mesh_manifest.py b/tests/test_e4_pl_s3_mixed_mesh_manifest.py index 3e6b378e5..f6b65132e 100644 --- a/tests/test_e4_pl_s3_mixed_mesh_manifest.py +++ b/tests/test_e4_pl_s3_mixed_mesh_manifest.py @@ -49,8 +49,103 @@ ) +# Two authentic states of the October 19 record. The restored original is the +# only bytes the original reader pin 64B07F... describes; the live file at the +# original pathname carries six later in-place rebinds of external sha256 leaves +# (exact Git genealogy cited in the successor record). Neither is rewritten. +Q4_SOURCE_BINDING_AS_REVIEWED = ( + ROOT / 'docs' / 'reference_cases' / 'e4_pl_q4_source_binding_20261019_as_reviewed.json' +) +Q4_SOURCE_BINDING_AS_REVIEWED_SHA256 = '64B07F1A535E6D6EFCEAE0B2EC01BA539DF69BE7956C03DBDA65C2ACF7C7E74F' +Q4_SOURCE_BINDING_AS_REVIEWED_BLOB = '99b59279e9702b509a84f1932874e2b24680adcc' Q4_SOURCE_BINDING = ROOT / 'docs' / 'reference_cases' / 'e4_pl_q4_source_binding_20261019.json' -Q4_SOURCE_BINDING_SHA256 = '64B07F1A535E6D6EFCEAE0B2EC01BA539DF69BE7956C03DBDA65C2ACF7C7E74F' +Q4_SOURCE_BINDING_SHA256 = '06679901687621BD6696DB9C8777A80131EE08631BFCCA706FD03FA15042FB38' +Q4_SOURCE_BINDING_BLOB = '3052505a185198142ffeee60fbee8ad46b3d968c' +EXTERNAL_LEAVES = { + f'external_arithmetic_dependencies/{alias}/sha256' + for alias in ('_elastic_increment_module', '_local_contractions', '_elements_module') +} + +# Source-binding successor (2026-11-11). SOURCE BINDING ONLY: it grants no CI, +# scientific or physical acceptance and replaces no immutable record. The pin +# stays None until (1) the collector scripts/build_q4_source_binding_20261111.py +# has been run with the historical commits present and (2) an independent +# reviewer outside the generating invocation has reviewed the record, this +# reader and the collector. Do not fill it from the generating invocation. +Q4_SOURCE_BINDING_SUCCESSOR = ( + ROOT / 'docs' / 'reference_cases' / 'e4_pl_source_binding_20261111.json' +) +Q4_SOURCE_BINDING_SUCCESSOR_SHA256: str | None = '2716B80F2792574F4720CC282C4368E3E936E5C1353FFF8B63439E72B30F42B1' +SIX_CARRIERS = ( + 'e4_pl_element.py', + 'e4_pl_s3_element.py', + '_q4_assumed_strain_plasticity.py', + 'vectorized_nonlinear.py', + 'elements.py', + '_compensated_contractions.py', +) +# Explicit recorded-to-live map. Recorded bytes/paths are never rewritten; the +# map is applied only when resolving a recorded path to a live file. +RECORDED_TO_LIVE_PATH = { + f'src/anysolver/{name}': f'src/anyfesolver/{name}' for name in SIX_CARRIERS +} +TEXT_LIVE_TO_RECORDED = (('ANYfeSolver', 'ANYsolver'), ('anyfesolver', 'anysolver')) +LIVE_ENTRY = 'src/anyfesolver/e4_pl_element.py' +# Independently measured Git ids, identical at 5c34dc2e4, a0781c0bc and e0c5f32ab. +UPSTREAM_GIT_BLOBS = { + 'e4_pl_element.py': '47efceacb07a9be0ab92542164e5dd3ca1ea0c63', + 'e4_pl_s3_element.py': '8047c66f677be5214fb7457a0312492481fb7e93', + '_q4_assumed_strain_plasticity.py': 'b78cf67beb8f11d1e0a239c05ee098417ecdfad7', + 'vectorized_nonlinear.py': 'b2ed521ff2b16710d50b7ee7b407447eb455ec4e', + 'elements.py': '0654d419641bf591ee21ddbe9ddf0c98bc8890c8', + '_compensated_contractions.py': 'e82e10b1f74aeee44ccc9e3009444b668f1ed53d', +} +V6_TERMINAL_BLOBS = { + 'e4_pl_element.py': 'bd6c0dc2cb3661eb73942fc0fea56e527aa8d0b4', + 'e4_pl_s3_element.py': 'adc6562cbd3fb768d7f0d0ab69011f21ff7c9392', +} +OCT19_CLOSURE = (159, '996C94581594E958545D5D64F25D1864942941A5B766BE88A79A4991BD4DE95C') +UPSTREAM_CLOSURE = (161, 'CF0026B4621EA9180B0DFCE1A483AFB8A762A218CB5CC3F538517C1A8D0843AA') +# Auto-text sources (index LF, Windows working copy CRLF, no eol attribute). +# Identity is the canonical LF form; exactly two physical forms are permitted +# (uniform LF or uniform CRLF). -text carriers and everything else stay exact. +PORTABLE_AUTO_TEXT = frozenset({ + 'e4_pl_s3_element.py', '_q4_assumed_strain_plasticity.py', + '_qualified_authority_epoch.py', 'shell_sections.py', 'e4_pl_s3_state.py', + 'plasticity.py', +}) +LINEAGE_JSON_SHA256 = '1cef66aedcd866ed1feaa1ee28497f30a96966a78d01e1cb472ea5d58dbbd7ac' +LINEAGE_README_SHA256 = '0605298d0ec64b1f005e0139513da7a588cab256e58b36ab3140d04295bef523' +# Independently confirmed Git-free digest of the whole nine-node canonical payload +# (all nine records and ten parents, with blobs, digests, lengths and changes). +LINEAGE_CHAIN_SHA256 = 'C75FA5607256A911999174EE7475B07FDE691ECD5A935F725E2B9F93F06E3BA5' +# Independently audited topology of the nine nodes: (commit, record blob, parents). +LINEAGE_TOPOLOGY = ( + ('af0344922b565fe8424e2c98dd28280d01339eda', 'fc61d1cb69156d950aa35c6318153dfa06ddb006', + ('4074eb8b163c1d04cd5e1faed742a237680c01fd',)), + ('36a5d5d8c1ae3816fe98d9049e79dec7b39787e9', '99b59279e9702b509a84f1932874e2b24680adcc', + ('af0344922b565fe8424e2c98dd28280d01339eda',)), + ('f75aed6a4188cc0f86cefcaf6e15af806e3ea108', '7024980f2f8e2b917aaa0626a375da9a2fd43e0b', + ('57dd01f047a4ea4e26d518aeddbf03997c3bd641',)), + ('842c38926890521efbdbe33e9c5c72222fa37596', '7b46c036dfdece1f96e7f81a273143cbddd963a9', + ('f6a9de9f815c684e883e73212571764ae6b07665',)), + ('a42dc0a5c94c40f59ba781306aee833aa9d4a3ff', '249fb5e38917dd1ba77c6d18a34cba7868d82cde', + ('842c38926890521efbdbe33e9c5c72222fa37596',)), + ('504dfb6578c2aacef31d66c6e48fb2f0d3a42af7', '0ffb6689d5a4ddfef15ff7de2ea872a3eec1e170', + ('a42dc0a5c94c40f59ba781306aee833aa9d4a3ff',)), + ('b7863d9d864a6df2f8a15ae9ca91791b390627c0', '6b8b616559f53f1af2339a5f981e14f086eec3fd', + ('504dfb6578c2aacef31d66c6e48fb2f0d3a42af7',)), + ('cb33056a44c22486843473964a51045cabf1ab68', '3052505a185198142ffeee60fbee8ad46b3d968c', + ('b7863d9d864a6df2f8a15ae9ca91791b390627c0',)), + ('5842caf6c9384009f1d9e3b1308ffd77e61a626a', '3052505a185198142ffeee60fbee8ad46b3d968c', + ('953d189a379ddc56cb4fbddc33d7ae6945e50eb8', '0758b87c98a95c27fdf0e912300865feb8f6ec7e')), +) +SUCCESSOR_FLAG_KEYS = { + 'C5_exception_transfer', 'CI_credit', 'historical_observation_rerun', + 'historical_records_modified', 'new_physical_acceptance', + 'new_scientific_acceptance', 'numerical_tolerances_changed', + 'physical_acceptance_transfer', 'production_mechanics_changed_by_this_record', +} def _load_generator(): @@ -121,6 +216,8 @@ def _canonical_mechanics_ast(value: object) -> object: return ["Ellipsis"] if value is None or isinstance(value, (str, int, float, bool)): return value + if isinstance(value, bytes): + return ["bytes", value.hex()] raise TypeError(f"unsupported AST field value {type(value).__name__}") @@ -435,13 +532,19 @@ def test_qualification_contract_is_canonical_and_binds_connectivity() -> None: } -def _require_prospective_q4_source_binding( +def _require_historical_q4_source_binding_record( record_raw: bytes, - source_raw: bytes, - actual: dict[str, object], authority: dict[str, object], ) -> dict[str, object]: - assert hashlib.sha256(record_raw).hexdigest().upper() == Q4_SOURCE_BINDING_SHA256 + """Read the immutable October 19 record on its own recorded terms. + + The record binds one historical byte state; it is deliberately NOT compared + with live bytes here (``historical_current_source_matches`` is False). Live + bytes are bound only by the 2026-11-11 successor reader below. + """ + + assert hashlib.sha256(record_raw).hexdigest().upper() == Q4_SOURCE_BINDING_AS_REVIEWED_SHA256 + assert _blob_id(record_raw) == Q4_SOURCE_BINDING_AS_REVIEWED_BLOB record = _strict_json(record_raw) assert record['schema'] == 'anysolver.q4-source-binding-successor-v1' assert record['qualification_boundary'] == 'SOURCE_BINDING_ONLY_NOT_SCIENTIFIC_QUALIFICATION' @@ -454,17 +557,17 @@ def _require_prospective_q4_source_binding( assert integration['product_edited_in_this_binding_slice'] is False assert all(integration[key] is False for key in ('physical_acceptance_transfer', 'C5_exception_transfer', 'CI_credit')) assert hashlib.sha256((ROOT / integration['review_path']).read_bytes()).hexdigest() == integration['review_sha256'] + # The recorded fe_core lifecycle bytes are a whole-file carrier of the + # historical tree; they are a recorded historical gap, not a live check. lifecycle = integration['lifecycle_delta'] - assert hashlib.sha256((ROOT / lifecycle['path']).read_bytes()).hexdigest() == lifecycle['sha256'] - assert record['source']['path'] == QUALIFIED_Q4_MECHANICS.relative_to(ROOT).as_posix() - assert hashlib.sha256(source_raw).hexdigest().upper() == record['source']['sha256'] - source = source_raw.decode('utf-8') - assert actual['roots'] == authority['roots'] == record['mechanics']['roots'] - assert len(actual['roots']) == 47 - assert set(authority['symbols']) <= set(actual['symbols']) + assert lifecycle['path'] == 'src/anysolver/fe_core.py' and len(lifecycle['sha256']) == 64 + # Recorded spelling is src/anysolver/...; resolve through the explicit map. + assert _live_path(record['source']['path']) == QUALIFIED_Q4_MECHANICS.relative_to(ROOT).as_posix() + assert record['mechanics']['roots'] == authority['roots'] + assert len(record['mechanics']['roots']) == 47 + assert set(authority['symbols']) <= set(record['mechanics']['symbols']) assert len(authority['symbols']) == 129 - assert actual == record['mechanics'] - assert _q4_mechanics_aggregate(actual) == record['mechanics_aggregate_sha256'] + assert _q4_mechanics_aggregate(record['mechanics']) == record['mechanics_aggregate_sha256'] assert record['historical_current_source_matches'] is False for relative, digest in record['historical_authorities'].items(): assert hashlib.sha256((ROOT / relative).read_bytes()).hexdigest().upper() == digest @@ -473,7 +576,9 @@ def _require_prospective_q4_source_binding( Q4_REPLAY_HOTFIX.relative_to(ROOT).as_posix(), Q4_REPLAY_CANONICALIZATION.relative_to(ROOT).as_posix(), } - inventory = _mechanics_nodes(source) + # The three recorded aliases and their recorded (historical) paths are kept + # exactly; their recorded digests describe the October 19 bytes and are not + # compared with live bytes. Live bytes are checked by the successor reader. expected_external = { '_elastic_increment_module': 'src/anyfesolver/vectorized_nonlinear.py', '_local_contractions': 'src/anyfesolver/_compensated_contractions.py', @@ -482,36 +587,630 @@ def _require_prospective_q4_source_binding( assert set(record['external_arithmetic_dependencies']) == set(expected_external) for alias, relative in expected_external.items(): row = record['external_arithmetic_dependencies'][alias] - assert row['path'] == relative and row['changed_this_slice'] is False - assert hashlib.sha256((ROOT / relative).read_bytes()).hexdigest().upper() == row['sha256'].upper() - used = sorted({ - node.attr - for symbol in actual['symbols'] - for node in ast.walk(inventory[symbol][0]) - if isinstance(node, ast.Attribute) - and isinstance(node.value, ast.Name) and node.value.id == alias - }) - assert used == row['used_attributes'] + assert _live_path(row['path']) == relative and row['changed_this_slice'] is False + assert len(row['sha256']) == 64 observed = record['observed_focused_pre_reader_integration'] assert observed['status'] == 'PASS' assert observed['case_count'] == 41 and observed['phase_count'] == 123 - assert set(observed['all_source_symbol_delta']['files']) == { + assert { + _live_path(path) if path.startswith('src/') else path + for path in observed['all_source_symbol_delta']['files'] + } == { 'src/anyfesolver/e4_pl_element.py', 'tests/test_e4_pl_s3_mixed_mesh_manifest.py', 'tests/test_general_contact_c5_elastic_increment.py', 'tests/test_general_contact_c5_numpy_coordinate_admission.py', } - # The later reader-only test edit is independently pinned by its whole-module carrier. + # The two C5 test carriers' recorded whole-module digests describe the + # historical tree; they are historical gaps (see the successor record). for relative in ( 'tests/test_general_contact_c5_elastic_increment.py', 'tests/test_general_contact_c5_numpy_coordinate_admission.py', ): - assert hashlib.sha256((ROOT / relative).read_bytes()).hexdigest() == observed[ - 'all_source_symbol_delta' - ]['files'][relative]['after_source_sha256'] + assert len(observed['all_source_symbol_delta']['files'][relative]['after_source_sha256']) == 64 + return record + + +def _leaves(value: object, path: tuple[str, ...] = ()) -> dict[str, object]: + if isinstance(value, dict): + return {k: v for key in value for k, v in _leaves(value[key], path + (key,)).items()} + if isinstance(value, list): + return {k: v for i, item in enumerate(value) for k, v in _leaves(item, path + (str(i),)).items()} + return {'/'.join(path): value} + + +def _require_physical(path: str, raw: bytes, row: dict[str, object]) -> None: + """Canonical LF identity everywhere; raw exact unless explicitly auto-text.""" + + portable = path.rsplit('/', 1)[1] in PORTABLE_AUTO_TEXT + assert row['portable_text'] is portable + canonical = _lf(raw) + assert row['live_lf'] == _identity(canonical) + if portable: + assert 'live_raw' not in row + assert b'\r' not in canonical # no lone or doubled CR survives normalization + crlf = canonical.replace(b'\n', b'\r\n') + assert raw == canonical or raw == crlf # uniform LF or uniform CRLF only + assert row['permitted_raw'] == { + 'crlf': _identity(crlf), 'lf': _identity(canonical), + } + else: + assert 'permitted_raw' not in row + assert row['live_raw'] == _identity(raw) + + +def _authenticated_lineage_transitions(lineage: dict[str, object]) -> list[dict[str, object]]: + """Verify all nine nodes statically (no Git, no external files).""" + + nodes = lineage['nodes'] + assert lineage['lineage_json_sha256'].lower() == LINEAGE_JSON_SHA256 + assert lineage['readme_sha256'].lower() == LINEAGE_README_SHA256 + assert lineage['anchor'] == 'e0c5f32ab40e9548ba0ea8981cf5e288ed375a1c' + assert len(nodes) == 9 + assert all(set(n) == {'blob', 'commit', 'length', 'parents', 'sha256'} for n in nodes) + assert [ + (n['commit'], n['blob'], tuple(p['commit'] for p in n['parents'])) for n in nodes + ] == list(LINEAGE_TOPOLOGY) + # Bind the exact whole payload: restamping invented sha/length/blobs/changes + # cannot pass even when commit topology matches. + assert _digest_upper(nodes) == LINEAGE_CHAIN_SHA256 + assert lineage['chain_sha256'] == LINEAGE_CHAIN_SHA256 + assert (nodes[1]['blob'], nodes[1]['sha256']) == ( + Q4_SOURCE_BINDING_AS_REVIEWED_BLOB, Q4_SOURCE_BINDING_AS_REVIEWED_SHA256, + ) + assert all((n['blob'], n['sha256']) == (Q4_SOURCE_BINDING_BLOB, Q4_SOURCE_BINDING_SHA256) for n in nodes[7:]) + steps = [] + for node in nodes[2:8]: + assert len(node['parents']) == 1 and 'changes' in node['parents'][0] + parent = node['parents'][0] + steps.append({ + 'blob': node['blob'], 'changes': parent['changes'], + 'parent_blob': parent['blob'], 'sha256': node['sha256'], + }) + assert nodes[8]['parents'][0]['blob'] == Q4_SOURCE_BINDING_BLOB + assert nodes[8]['parents'][0]['changes'] == {} + return steps + + +def _require_current_historical_record( + current_raw: bytes, reviewed_raw: bytes, successor: dict[str, object], read +) -> None: + """Pin the live historical file independently of its predecessor. + + Cites the six measured in-place edits (external sha256 leaves only) and the + five whole-file comparisons that no longer describe live bytes. Endorses no + scientific transfer and does not equate the file with its predecessor or with + current execution. + """ + + assert hashlib.sha256(current_raw).hexdigest().upper() == Q4_SOURCE_BINDING_SHA256 + assert _blob_id(current_raw) == Q4_SOURCE_BINDING_BLOB + assert current_raw != reviewed_raw + reviewed, current = _leaves(_strict_json(reviewed_raw)), _leaves(_strict_json(current_raw)) + assert reviewed.keys() == current.keys() + assert {k for k in current if current[k] != reviewed[k]} == EXTERNAL_LEAVES + lineage = successor['historical_record_lineage'] + assert lineage['scientific_transfer_endorsed'] is False + state, previous = dict(reviewed), Q4_SOURCE_BINDING_AS_REVIEWED_BLOB + transitions = _authenticated_lineage_transitions(lineage) + assert len(transitions) == 6 + states = {Q4_SOURCE_BINDING_AS_REVIEWED_BLOB: dict(reviewed)} # exact state per blob + for step in transitions: + assert step['parent_blob'] == previous and set(step['changes']) <= EXTERNAL_LEAVES + for leaf, change in step['changes'].items(): + assert state[leaf] == change['before'] + state[leaf] = change['after'] + previous = step['blob'] + states[previous] = dict(state) + assert state == current and previous == Q4_SOURCE_BINDING_BLOB + # Merge: each parent's changes must equal its own replayed blob state -> current. + # (0758b87c is the object after the FIRST edit, not the original pin.) + for parent in lineage['nodes'][8]['parents']: + assert parent['blob'] in states + assert parent['changes'] == { + leaf: {'before': states[parent['blob']][leaf], 'after': current[leaf]} + for leaf in sorted(current) + if states[parent['blob']][leaf] != current[leaf] + } + assert set(parent['changes']) <= EXTERNAL_LEAVES + assert transitions[-1]['sha256'] == Q4_SOURCE_BINDING_SHA256 + assert lineage['pin_node']['sha256'] == Q4_SOURCE_BINDING_AS_REVIEWED_SHA256 + assert lineage['pin_node']['blob'] == Q4_SOURCE_BINDING_AS_REVIEWED_BLOB + + gaps = successor['historical_gaps_of_current_historical_record'] + integration = _strict_json(current_raw)['source_binding_integration_review'] + assert all(integration[k] is False for k in ('physical_acceptance_transfer', 'C5_exception_transfer', 'CI_credit')) + assert len(gaps) == 5 and len({g['check'] for g in gaps}) == 5 + for gap in gaps: + assert gap['historical_gap'] is True + assert gap['live_path'] == gap['recorded_path'].replace('src/anysolver/', 'src/anyfesolver/', 1) + gap_raw = read(gap['live_path']) + live = hashlib.sha256(_lf(gap_raw)).hexdigest().upper() + assert gap['live_lf_sha256'] == live + # Protected (-text) carriers: raw current bytes are pinned as well as LF. + assert gap['live_path'].rsplit('/', 1)[1] not in PORTABLE_AUTO_TEXT + assert gap['live_raw'] == _identity(gap_raw) + assert gap['live_lf'] == _identity(_lf(gap_raw)) + # Each exact historical leaf links to this observation. + assert str(current[gap['historical_leaf']]).upper() == gap['recorded_sha256'] + assert gap['live_lf_matches_recorded'] is (live == gap['recorded_sha256']) is False + assert gap['recorded_sha256'] in {str(v).upper() for v in current.values()} + + +def _live_path(recorded: str) -> str: + assert recorded in RECORDED_TO_LIVE_PATH, f"unmapped recorded path {recorded!r}" + return RECORDED_TO_LIVE_PATH[recorded] + + +def _read_live(relative: str) -> bytes: + return (ROOT / relative).read_bytes() + + +def _read_with(replacements: dict[str, bytes]): + def read(relative: str) -> bytes: + return replacements[relative] if relative in replacements else _read_live(relative) + + return read + + +def _lf(data: bytes) -> bytes: + return data.replace(b"\r\n", b"\n") + + +def _blob_id(data: bytes) -> str: + return hashlib.sha1(f"blob {len(data)}\0".encode("ascii") + data).hexdigest() + + +def _identity(data: bytes) -> dict[str, object]: + return { + "bytes": len(data), + "git_blob": _blob_id(data), + "sha256": hashlib.sha256(data).hexdigest().upper(), + } + + +def _reverse_spelling(data: bytes) -> bytes: + for live, recorded in TEXT_LIVE_TO_RECORDED: + data = data.replace(live.encode("ascii"), recorded.encode("ascii")) + return data + + +def _digest_upper(value: object) -> str: + return hashlib.sha256( + json.dumps( + value, sort_keys=True, separators=(",", ":"), ensure_ascii=True, allow_nan=False + ).encode("utf-8") + ).hexdigest().upper() + + +def _module_symbol_aggregate(source: str) -> str: + return _digest_upper({ + name: _digest_upper([_canonical_mechanics_ast(node) for node in nodes]) + for name, nodes in sorted(_mechanics_nodes(source).items()) + }) + + +def _internal_imports(source: str, closure_symbols: list[str]) -> list[dict[str, object]]: + """Independent scan of every sibling-package import of the entry module.""" + + inventory = _mechanics_nodes(source) + rows: list[dict[str, object]] = [] + for node in ast.walk(ast.parse(source)): + if not isinstance(node, ast.ImportFrom): + continue + absolute = bool(node.level == 0 and node.module) and node.module.split(".")[0] in ( + "anyfesolver", "anysolver", + ) + if node.level == 0 and not absolute: + continue + parts = node.module.split(".")[1:] if absolute else ( + node.module.split(".") if node.module else [] + ) + for alias in node.names: + bound = alias.asname or alias.name + used: set[str] = set() + loaded = False + for symbol in closure_symbols: + for item in ast.walk(inventory[symbol][0]): + if isinstance(item, ast.Name) and isinstance(item.ctx, ast.Load) and item.id == bound: + loaded = True + if ( + isinstance(item, ast.Attribute) + and isinstance(item.value, ast.Name) + and item.value.id == bound + ): + used.add(item.attr) + kind = "name" if parts else "module" + rows.append({ + "bound_name": bound, + "file": ("/".join(parts) if parts else alias.name) + ".py" + if node.level <= 1 else None, + "imported": alias.name, + "kind": kind, + "relative_level": node.level, + "used_attributes": sorted(used) if kind == "module" else [], + "used_in_closure": loaded or bool(used), + }) + return sorted(rows, key=lambda r: (r["bound_name"], str(r["file"]), r["imported"])) + + +def _require_pin() -> None: + if Q4_SOURCE_BINDING_SUCCESSOR_SHA256 is None: + pytest.fail( + "source-binding successor is not adopted: run " + "scripts/build_q4_source_binding_20261111.py --write, have the record, " + "this reader and the collector independently reviewed outside the " + "generating invocation, then pin Q4_SOURCE_BINDING_SUCCESSOR_SHA256", + pytrace=False, + ) + + +def _require_successor_mechanics(record, actual, authority) -> None: + mech = record["mechanics"] + assert actual["roots"] == authority["roots"] == mech["roots"] + assert len(actual["roots"]) == 47 + assert set(authority["symbols"]) <= set(actual["symbols"]) + assert len(authority["symbols"]) == 129 + assert actual["symbols"] == mech["symbols"] + assert mech["symbol_count"] == len(actual["symbols"]) + assert actual["path"] == mech["logical_path"] == authority["path"] + assert actual["schema"] == mech["schema"] == authority["schema"] + assert _q4_mechanics_aggregate(actual) == mech["aggregate_sha256"] + + +def _require_successor_imports(record, source: str, closure_symbols, read) -> None: + rows = record["sibling_imports_of_entry_module"] + recomputed = _internal_imports(source, sorted(closure_symbols)) + live_keys = { + "live_path", "recorded_path", "live_raw", "live_lf", "portable_text", "permitted_raw", + } + assert [ + {k: v for k, v in row.items() if k not in live_keys} for row in rows + ] == recomputed + for row in rows: + assert row["file"] is not None and row["relative_level"] <= 1 + assert row["live_path"] == f"src/anyfesolver/{row['file']}" + assert row["recorded_path"] == f"src/anysolver/{row['file']}" + _require_physical(row["live_path"], read(row["live_path"]), row) + # Preserve the October 19 external checks: each recorded alias still resolves + # (through the explicit map) to exactly one live import of that file. + oct19 = _strict_json(Q4_SOURCE_BINDING_AS_REVIEWED.read_bytes()) + for alias, old in oct19["external_arithmetic_dependencies"].items(): + matches = [row for row in rows if row["bound_name"] == alias] + assert len(matches) == 1 + assert matches[0]["live_path"] == _live_path(old["path"]) + assert matches[0]["used_in_closure"] is True + # The new assumed-strain runtime source is a bound dependency of the closure. + assert any( + row["file"] == "_q4_assumed_strain_plasticity.py" and row["used_in_closure"] + for row in rows + ) + + +def _require_q4_source_binding_successor( + record_raw: bytes, + read, + actual: dict[str, object], + authority: dict[str, object], +) -> dict[str, object]: + """Bind live (renamed) source to the immutable history; SOURCE BINDING ONLY.""" + + assert Q4_SOURCE_BINDING_SUCCESSOR_SHA256 is not None + assert hashlib.sha256(record_raw).hexdigest().upper() == Q4_SOURCE_BINDING_SUCCESSOR_SHA256 + record = _strict_json(record_raw) + assert record_raw == _canonical_bytes(record) + assert record["schema"] == "anyfesolver.q4-source-binding-successor-v2" + assert record["qualification_boundary"] == "SOURCE_BINDING_ONLY_NOT_SCIENTIFIC_QUALIFICATION" + adoption = record["adoption"] + assert adoption["reviewer_approval_claimed"] is False + assert adoption["owner_adoption_recorded"] is False + assert adoption["status"] == "UNREVIEWED_CANDIDATE_RECORD" + assert adoption["independent_review_required_outside_generating_invocation"] is True + flags = record["boundary_flags"] + assert set(flags) == SUCCESSOR_FLAG_KEYS + assert all(value is False for value in flags.values()) + + # Immutable predecessor, read on its own recorded terms. + reviewed_raw = Q4_SOURCE_BINDING_AS_REVIEWED.read_bytes() + predecessor = record["predecessor"] + assert predecessor["oct19_as_reviewed"] == { + "bytes": len(reviewed_raw), + "git_blob": Q4_SOURCE_BINDING_AS_REVIEWED_BLOB, + "path": Q4_SOURCE_BINDING_AS_REVIEWED.relative_to(ROOT).as_posix(), + "sha256": Q4_SOURCE_BINDING_AS_REVIEWED_SHA256, + } + current_raw = Q4_SOURCE_BINDING.read_bytes() + assert predecessor["oct19_current_historical"] == { + "bytes": len(current_raw), + "git_blob": Q4_SOURCE_BINDING_BLOB, + "path": Q4_SOURCE_BINDING.relative_to(ROOT).as_posix(), + "sha256": Q4_SOURCE_BINDING_SHA256, + } + assert predecessor["current_historical_equals_as_reviewed"] is False + assert predecessor["current_historical_describes_current_execution"] is False + historical = _require_historical_q4_source_binding_record(reviewed_raw, authority) + _require_current_historical_record(current_raw, reviewed_raw, record, read) + assert record["revisions"]["c31a223f"] == "c31a223fe63f886a1a9b0b47c926bbe748ad4554" + assert record["predecessor"]["v6_runtime_guard_successor_commit"] == record["revisions"]["c31a223f"] + cited = record["historical_evidence_cited"] + assert cited["oct19_nonacceptance_flags_retained"] == { + key: False for key in ("physical_acceptance_transfer", "C5_exception_transfer", "CI_credit") + } + assert all( + historical["source_binding_integration_review"][key] is False + for key in cited["oct19_nonacceptance_flags_retained"] + ) + assert cited["oct19_observation_retained_historical_only"] == { + "case_count": 41, "phase_count": 123, "rerun": False, + } + assert cited["q4_r4_grade"]["grade"] == "READY-WITH-EXCEPTIONS" + assert len(cited["q4_r4_grade"]["exceptions"]) == 4 + files = record["historical_files_sha256"] + assert files[Q4_SOURCE_BINDING.relative_to(ROOT).as_posix()] == Q4_SOURCE_BINDING_SHA256 + assert files[Q4_SOURCE_BINDING_AS_REVIEWED.relative_to(ROOT).as_posix()] == ( + Q4_SOURCE_BINDING_AS_REVIEWED_SHA256 + ) + assert { + QUALIFICATION_CONTRACT.relative_to(ROOT).as_posix(), + Q4_REPLAY_HOTFIX.relative_to(ROOT).as_posix(), + Q4_REPLAY_CANONICALIZATION.relative_to(ROOT).as_posix(), + "docs/reference_cases/qualified_shell_runtime_guard_performance_successor.json", + "docs/STATIC_RUNTIME_PERFORMANCE.md", + } <= set(files) + for relative, digest in files.items(): + assert hashlib.sha256((ROOT / relative).read_bytes()).hexdigest().upper() == digest + report = record["static_runtime_performance_report"] + assert report["path"] == "docs/STATIC_RUNTIME_PERFORMANCE.md" and report["bytes"] == 4561 + assert files[report["path"]] == report["sha256"] + + # Explicit recorded-to-live spelling map. + spelling = record["recorded_to_live_spelling_map"] + assert spelling["path_map"] == RECORDED_TO_LIVE_PATH + assert spelling["text_live_to_recorded"] == [list(pair) for pair in TEXT_LIVE_TO_RECORDED] + + # Six carriers: live raw/LF identity, upstream Git ids, reverse-map evidence. + carriers = record["carriers"] + assert set(carriers) == set(SIX_CARRIERS) + for name in SIX_CARRIERS: + row = carriers[name] + assert row["recorded_path"] == f"src/anysolver/{name}" + assert row["live_path"] == _live_path(row["recorded_path"]) + raw = read(row["live_path"]) + _require_physical(row["live_path"], raw, row) + reverse = _reverse_spelling(_lf(raw)) + assert row["live_lf_after_reverse_spelling_map"] == _identity(reverse) + assert row["upstream_raw"]["git_blob"] == UPSTREAM_GIT_BLOBS[name] + assert row["upstream_lf"] == _identity(reverse) + assert row["reverse_spelling_map_reproduces_upstream_lf"] is True + assert row["module_symbols"]["candidate_aggregate_sha256"] == _module_symbol_aggregate( + _lf(raw).decode("utf-8") + ) + if name in V6_TERMINAL_BLOBS: + assert row["v6_terminal_git_blob"] == V6_TERMINAL_BLOBS[name] + assert row["live_lf_equals_v6_terminal"] is ( + _blob_id(_lf(raw)) == V6_TERMINAL_BLOBS[name] + ) + + # Links: mechanics changed after October 19 / the V6 terminal; no extension. + link1 = record["links"]["L1_OCT19_AND_V6_TERMINAL_TO_QUALIFIED_Q4_R4"] + assert link1["mechanics_changed"] is True + assert link1["v6_terminal_mechanics_unchanged_claim_extended"] is False + assert link1["v6_terminal_blobs"] == V6_TERMINAL_BLOBS + assert link1["external_kernel_added"] == "_q4_assumed_strain_plasticity.py" + assert ( + link1["oct19_closure"]["symbol_count"], link1["oct19_closure"]["aggregate_sha256"] + ) == OCT19_CLOSURE + assert ( + link1["qualified_target_closure"]["symbol_count"], + link1["qualified_target_closure"]["aggregate_sha256"], + ) == UPSTREAM_CLOSURE + assert { + "QualifiedE4PLShellElement._assumed_strain_kernel", "_initial_offsets_or_none", + } <= set(link1["symbol_delta_oct19_to_qualified_target"]["added"]) + assert "unbound_scope" in record["links"]["L2_UPSTREAM_E0C5F32AB_TO_RELEASE_CANDIDATE"] + + _require_successor_mechanics(record, actual, authority) + source = _lf(read(LIVE_ENTRY)).decode("utf-8") + _require_successor_imports(record, source, actual["symbols"], read) return record +def test_historical_oct19_record_reads_on_its_own_terms() -> None: + authority = _strict_json(QUALIFICATION_CONTRACT.read_bytes())["candidate"][ + "qualified_q4_mechanics_authority" + ] + raw = Q4_SOURCE_BINDING_AS_REVIEWED.read_bytes() + record = _require_historical_q4_source_binding_record(raw, authority) + assert record["historical_current_source_matches"] is False + with pytest.raises(AssertionError): + _require_historical_q4_source_binding_record(raw + b" ", authority) + # The original pin is never attributed to the pathname's later bytes. + with pytest.raises(AssertionError): + _require_historical_q4_source_binding_record(Q4_SOURCE_BINDING.read_bytes(), authority) + with pytest.raises(AssertionError): + _live_path("src/anysolver/not_a_recorded_carrier.py") + + +def test_recorded_to_live_spelling_map_is_explicit_and_checked() -> None: + assert set(RECORDED_TO_LIVE_PATH) == {f"src/anysolver/{n}" for n in SIX_CARRIERS} + for recorded, live in RECORDED_TO_LIVE_PATH.items(): + assert (ROOT / live).is_file() + assert recorded != live and recorded.replace("anysolver", "anyfesolver", 1) == live + assert _reverse_spelling(b"ANYfeSolver anyfesolver.elements") == b"ANYsolver anysolver.elements" + + +def test_successor_record_binds_live_source_without_new_acceptance() -> None: + _require_pin() + authority = _strict_json(QUALIFICATION_CONTRACT.read_bytes())["candidate"][ + "qualified_q4_mechanics_authority" + ] + actual = _q4_mechanics_authority_payload( + _lf(_read_live(LIVE_ENTRY)).decode("utf-8"), set(authority["roots"]), + schema=authority["schema"], path=authority["path"], + required_symbols=set(authority["symbols"]), + ) + record = _require_q4_source_binding_successor( + Q4_SOURCE_BINDING_SUCCESSOR.read_bytes(), _read_live, actual, authority + ) + assert record["boundary_flags"]["CI_credit"] is False + + +GAP_PATHS = ( + "src/anyfesolver/e4_pl_element.py", + "src/anyfesolver/fe_core.py", + "src/anyfesolver/elements.py", + "tests/test_general_contact_c5_elastic_increment.py", + "tests/test_general_contact_c5_numpy_coordinate_admission.py", +) + + +def _successor_context(): + _require_pin() + authority = _strict_json(QUALIFICATION_CONTRACT.read_bytes())["candidate"][ + "qualified_q4_mechanics_authority" + ] + actual = _q4_mechanics_authority_payload( + _lf(_read_live(LIVE_ENTRY)).decode("utf-8"), set(authority["roots"]), + schema=authority["schema"], path=authority["path"], + required_symbols=set(authority["symbols"]), + ) + return authority, actual, Q4_SOURCE_BINDING_SUCCESSOR.read_bytes() + + +@pytest.mark.parametrize("relative", GAP_PATHS) +def test_successor_rejects_content_and_eol_only_mutation_of_protected_carriers( + relative: str, +) -> None: + authority, actual, record = _successor_context() + raw = _read_live(relative) + assert relative.rsplit("/", 1)[1] not in PORTABLE_AUTO_TEXT + eol_only = _lf(raw) if b"\r\n" in raw else _lf(raw).replace(b"\n", b"\r\n") + assert eol_only != raw and _lf(eol_only) == _lf(raw) + for mutated in (raw + b"\n# content mutation\n", eol_only): + with pytest.raises(AssertionError): + _require_q4_source_binding_successor( + record, _read_with({relative: mutated}), actual, authority + ) + + +@pytest.mark.parametrize("name", sorted(PORTABLE_AUTO_TEXT)) +def test_portable_auto_text_accepts_only_uniform_lf_or_crlf(name: str) -> None: + authority, actual, record = _successor_context() + relative = f"src/anyfesolver/{name}" + canonical = _lf(_read_live(relative)) + assert b"\r" not in canonical + crlf = canonical.replace(b"\n", b"\r\n") + for good in (canonical, crlf): + _require_q4_source_binding_successor( + record, _read_with({relative: good}), actual, authority + ) + first = canonical.index(b"\n") + 1 + for bad in ( + canonical[:first].replace(b"\n", b"\r\n") + canonical[first:], # mixed endings + canonical.replace(b"\n", b"\r\r\n"), # double CR conversion + canonical + b"# content mutation\n", + crlf + b"# content mutation\r\n", + ): + with pytest.raises(AssertionError): + _require_q4_source_binding_successor( + record, _read_with({relative: bad}), actual, authority + ) + + +def test_lineage_authentication_rejects_forged_intermediate_parents_and_missing_rows() -> None: + _require_pin() + lineage = _strict_json(Q4_SOURCE_BINDING_SUCCESSOR.read_bytes())["historical_record_lineage"] + assert len(_authenticated_lineage_transitions(lineage)) == 6 + + def forge(edit, *, restamp: bool = True) -> dict[str, object]: + copy = json.loads(json.dumps(lineage)) + edit(copy["nodes"]) + if restamp: # a forger who also recomputes the chain digest is still refused + copy["chain_sha256"] = _digest_upper(copy["nodes"]) + return copy + + edits = ( + lambda n: n[3].__setitem__("commit", "0" * 40), # forged intermediate commit + lambda n: n[4]["parents"][0].__setitem__("commit", "1" * 40), # wrong parent + lambda n: n[8]["parents"].pop(), # incomplete merge parents + lambda n: n.pop(5), # missing row + lambda n: n.reverse(), + ) + for edit in edits: + with pytest.raises(AssertionError): + _authenticated_lineage_transitions(forge(edit)) + # Invented sha/length/parent blob/changes with matching topology, restamped. + for invented in ( + lambda n: n[3].__setitem__("sha256", "0" * 64), + lambda n: n[3].__setitem__("length", n[3]["length"] + 1), + lambda n: n[3]["parents"][0].__setitem__("blob", "2" * 40), + lambda n: n[3]["parents"][0]["changes"].clear(), + ): + with pytest.raises(AssertionError): + _authenticated_lineage_transitions(forge(invented)) + with pytest.raises(AssertionError): # stale chain digest + _authenticated_lineage_transitions( + forge(lambda n: n[3].__setitem__("commit", "0" * 40), restamp=False) + ) + + +@pytest.mark.parametrize("name", SIX_CARRIERS) +def test_successor_rejects_any_unrecorded_carrier_file_mutation(name: str) -> None: + _require_pin() + authority = _strict_json(QUALIFICATION_CONTRACT.read_bytes())["candidate"][ + "qualified_q4_mechanics_authority" + ] + actual = _q4_mechanics_authority_payload( + _lf(_read_live(LIVE_ENTRY)).decode("utf-8"), set(authority["roots"]), + schema=authority["schema"], path=authority["path"], + required_symbols=set(authority["symbols"]), + ) + record = Q4_SOURCE_BINDING_SUCCESSOR.read_bytes() + relative = RECORDED_TO_LIVE_PATH[f"src/anysolver/{name}"] + read = _read_with({relative: _read_live(relative) + b"\n# unrecorded mutation\n"}) + with pytest.raises(AssertionError): + _require_q4_source_binding_successor(record, read, actual, authority) + + +def test_successor_mechanics_and_import_checks_reject_unrecorded_changes() -> None: + _require_pin() + authority = _strict_json(QUALIFICATION_CONTRACT.read_bytes())["candidate"][ + "qualified_q4_mechanics_authority" + ] + record = _strict_json(Q4_SOURCE_BINDING_SUCCESSOR.read_bytes()) + source = _lf(_read_live(LIVE_ENTRY)).decode("utf-8") + actual = _q4_mechanics_authority_payload( + source, set(authority["roots"]), schema=authority["schema"], + path=authority["path"], required_symbols=set(authority["symbols"]), + ) + _require_successor_mechanics(record, actual, authority) + _require_successor_imports(record, source, actual["symbols"], _read_live) + + # Symbol mutation inside the closure is visible. + sign = " sign = 1 if alignment > 0.0 else -1" + assert source.count(sign) == 1 + mutated = _q4_mechanics_authority_payload( + source.replace(sign, " sign = -1 if alignment > 0.0 else 1", 1), + set(authority["roots"]), schema=authority["schema"], path=authority["path"], + required_symbols=set(authority["symbols"]), + ) + with pytest.raises(AssertionError): + _require_successor_mechanics(record, mutated, authority) + + # A new, unrecorded sibling import is visible even if unused. + with pytest.raises(AssertionError): + _require_successor_imports( + record, source + "\nfrom . import fe_core as _unrecorded_dependency\n", + actual["symbols"], _read_live, + ) + + # Mutating any recorded sibling dependency file is visible. + for row in record["sibling_imports_of_entry_module"]: + read = _read_with({row["live_path"]: _read_live(row["live_path"]) + b"\n#x\n"}) + with pytest.raises(AssertionError): + _require_successor_imports(record, source, actual["symbols"], read) + + def test_qualification_contract_and_replay_hotfix_bind_q4_mechanics_symbols() -> None: contract = _strict_json(QUALIFICATION_CONTRACT.read_bytes()) candidate = contract["candidate"] @@ -534,7 +1233,8 @@ def test_qualification_contract_and_replay_hotfix_bind_q4_mechanics_symbols() -> "symbol_count", "symbols", } - assert authority["path"] == QUALIFIED_Q4_MECHANICS.relative_to(ROOT).as_posix() + # Frozen contract spelling is src/anysolver/...; resolve via the explicit map. + assert _live_path(authority["path"]) == QUALIFIED_Q4_MECHANICS.relative_to(ROOT).as_posix() assert authority["schema"] == Q4_MECHANICS_AUTHORITY_SCHEMA assert authority["canonicalization"] == Q4_MECHANICS_CANONICALIZATION roots = authority["roots"] @@ -594,17 +1294,36 @@ def test_qualification_contract_and_replay_hotfix_bind_q4_mechanics_symbols() -> assert _q4_mechanics_aggregate(actual) != successor_correction[ "current_mechanics_aggregate_sha256" ] - binding = _require_prospective_q4_source_binding( - Q4_SOURCE_BINDING.read_bytes(), QUALIFIED_Q4_MECHANICS.read_bytes(), actual, authority + _require_pin() + binding = _require_q4_source_binding_successor( + Q4_SOURCE_BINDING_SUCCESSOR.read_bytes(), _read_live, actual, authority ) - assert binding["historical_difference"] == { + # Original qualification contract (129 expected symbols) -> candidate live + # closure. This is NOT the October 19 -> qualified-R4 link (links.L1). The + # successor record has no historical_difference field; its candidate closure + # is binding["mechanics"]["symbols"], which the reader above already proved + # equal to the independently recomputed live `actual`. + record_symbols = binding["mechanics"]["symbols"] + assert record_symbols == actual["symbols"] + derived = { + "changed_symbols": sorted( + name for name, digest in expected.items() + if name in record_symbols and record_symbols[name] != digest + ), + "added_symbols": sorted(set(record_symbols) - set(expected)), + "removed_symbols": sorted(set(expected) - set(record_symbols)), + } + assert derived == { "changed_symbols": changed, "added_symbols": added, "removed_symbols": sorted(set(expected) - set(actual["symbols"])), } + assert derived["removed_symbols"] == [] # contract symbols all remain required + assert derived["changed_symbols"] and derived["added_symbols"] def test_prospective_q4_source_binding_rejects_unknown_record_and_outside_closure() -> None: + _require_pin() authority = _strict_json(QUALIFICATION_CONTRACT.read_bytes())["candidate"][ "qualified_q4_mechanics_authority" ] @@ -614,9 +1333,9 @@ def test_prospective_q4_source_binding_rejects_unknown_record_and_outside_closur source, set(authority["roots"]), schema=authority["schema"], path=authority["path"], required_symbols=set(authority["symbols"]), ) - record = Q4_SOURCE_BINDING.read_bytes() + record = Q4_SOURCE_BINDING_SUCCESSOR.read_bytes() with pytest.raises(AssertionError): - _require_prospective_q4_source_binding(record + b" ", raw, actual, authority) + _require_q4_source_binding_successor(record + b" ", _read_live, actual, authority) for field in ("roots", "symbols"): refused = _strict_json(json.dumps(actual).encode("utf-8")) if field == "roots": @@ -624,7 +1343,7 @@ def test_prospective_q4_source_binding_rejects_unknown_record_and_outside_closur else: refused[field].pop(next(iter(authority["symbols"]))) with pytest.raises(AssertionError): - _require_prospective_q4_source_binding(record, raw, refused, authority) + _require_q4_source_binding_successor(record, _read_live, refused, authority) outside = "QualifiedE4PLShellElement._compute_prepared_nonlinear_response" assert outside not in actual["symbols"] definition = " def _compute_prepared_nonlinear_response(" @@ -636,12 +1355,14 @@ def test_prospective_q4_source_binding_rejects_unknown_record_and_outside_closur ) assert unchanged_closure == actual with pytest.raises(AssertionError): - _require_prospective_q4_source_binding( - record, changed.encode("utf-8"), unchanged_closure, authority + _require_q4_source_binding_successor( + record, _read_with({LIVE_ENTRY: changed.encode("utf-8")}), + unchanged_closure, authority, ) def test_prospective_q4_source_binding_rejects_external_dependency_drift(monkeypatch) -> None: + _require_pin() authority = _strict_json(QUALIFICATION_CONTRACT.read_bytes())["candidate"][ "qualified_q4_mechanics_authority" ] @@ -650,7 +1371,7 @@ def test_prospective_q4_source_binding_rejects_external_dependency_drift(monkeyp raw.decode("utf-8"), set(authority["roots"]), schema=authority["schema"], path=authority["path"], required_symbols=set(authority["symbols"]), ) - record = Q4_SOURCE_BINDING.read_bytes() + record = Q4_SOURCE_BINDING_SUCCESSOR.read_bytes() dependency = ROOT / "src" / "anyfesolver" / "vectorized_nonlinear.py" original = Path.read_bytes def changed_bytes(path): @@ -658,7 +1379,7 @@ def changed_bytes(path): return value + b"\n# injected source drift\n" if path == dependency else value monkeypatch.setattr(Path, "read_bytes", changed_bytes) with pytest.raises(AssertionError): - _require_prospective_q4_source_binding(record, raw, actual, authority) + _require_q4_source_binding_successor(record, _read_live, actual, authority) def test_q4_mechanics_symbol_authority_rejects_missing_duplicate_and_change() -> None: contract = _strict_json(QUALIFICATION_CONTRACT.read_bytes()) diff --git a/tests/test_s3_v2d_default_activation.py b/tests/test_s3_v2d_default_activation.py index b50d14adf..7169b5e41 100644 --- a/tests/test_s3_v2d_default_activation.py +++ b/tests/test_s3_v2d_default_activation.py @@ -2,6 +2,7 @@ from __future__ import annotations +import ast import copy import hashlib import json @@ -193,7 +194,85 @@ def _git_blob(path: Path) -> str: return hashlib.sha1(f"blob {len(data)}\0".encode("ascii") + data).hexdigest() -def test_activation_candidate_binds_accepted_v6w_and_unchanged_q4() -> None: +Q4_SOURCE_BINDING_SUCCESSOR = ( + ROOT / "docs" / "reference_cases" / "e4_pl_source_binding_20261111.json" +) +MANIFEST_TEST = ROOT / "tests" / "test_e4_pl_s3_mixed_mesh_manifest.py" + + +def _adopted_successor_pin() -> str | None: + """Single source of truth: the pin assigned in the mixed-mesh manifest test.""" + + for node in ast.parse(MANIFEST_TEST.read_text(encoding="utf-8")).body: + if ( + isinstance(node, ast.AnnAssign) + and isinstance(node.target, ast.Name) + and node.target.id == "Q4_SOURCE_BINDING_SUCCESSOR_SHA256" + ): + return ast.literal_eval(node.value) + raise AssertionError("successor pin assignment not found") + + +def _q4_source_binding_successor() -> dict[str, object]: + pin = _adopted_successor_pin() + if pin is None: + pytest.fail( + "source-binding successor is not adopted: run " + "scripts/build_q4_source_binding_20261111.py --write, obtain independent " + "review outside the generating invocation, then pin it in " + "tests/test_e4_pl_s3_mixed_mesh_manifest.py", + pytrace=False, + ) + raw = Q4_SOURCE_BINDING_SUCCESSOR.read_bytes() + assert hashlib.sha256(raw).hexdigest().upper() == pin + payload = json.loads(raw, object_pairs_hook=_strict_object) + assert payload["qualification_boundary"] == ( + "SOURCE_BINDING_ONLY_NOT_SCIENTIFIC_QUALIFICATION" + ) + assert all(value is False for value in payload["boundary_flags"].values()) + return payload + + +def _assert_live_sources_bound_through_successor( + q4_blob: str, s3_blob: str, runtime_successor: dict[str, object] +) -> None: + """The V6 terminal blobs are historical; live bytes bind via the successor. + + This is a mechanics-CHANGED link (October 23 assumed-strain work lies between + the runtime-guard terminal and the live source). It does not extend the + terminal's "mechanics unchanged" assertion and grants no qualification. + """ + + record = _q4_source_binding_successor() + change = runtime_successor["change"] + for name, live_blob, key in ( + ("e4_pl_element.py", q4_blob, "e4_pl_element"), + ("e4_pl_s3_element.py", s3_blob, "e4_pl_s3_element"), + ): + row = record["carriers"][name] + assert row["live_path"] == f"src/anyfesolver/{name}" + assert row["live_lf"]["git_blob"] == live_blob + assert row["v6_terminal_git_blob"] == change[key]["current_git_blob"] + assert row["live_lf_equals_v6_terminal"] is ( + live_blob == change[key]["current_git_blob"] + ) + link = record["links"]["L1_OCT19_AND_V6_TERMINAL_TO_QUALIFIED_Q4_R4"] + assert link["mechanics_changed"] is True + assert link["v6_terminal_mechanics_unchanged_claim_extended"] is False + + +def test_successor_link_rejects_wrong_live_blob_and_unadopted_pin() -> None: + runtime_successor = _qualified_shell_runtime_guard_successor() + q4 = _git_blob(ROOT / "src" / "anyfesolver" / "e4_pl_element.py") + s3 = _git_blob(ROOT / "src" / "anyfesolver" / "e4_pl_s3_element.py") + _assert_live_sources_bound_through_successor(q4, s3, runtime_successor) + with pytest.raises(AssertionError): + _assert_live_sources_bound_through_successor("0" * 40, s3, runtime_successor) + with pytest.raises(AssertionError): + _assert_live_sources_bound_through_successor(q4, "0" * 40, runtime_successor) + + +def test_activation_candidate_binds_accepted_v6w_and_historical_q4_terminal() -> None: raw = ACTIVATION.read_bytes() payload = json.loads(raw, object_pairs_hook=_strict_object) assert raw == ( @@ -220,10 +299,7 @@ def test_activation_candidate_binds_accepted_v6w_and_unchanged_q4() -> None: assert successor["correction"]["e4_pl_element_blob"] == runtime_successor[ "change" ]["e4_pl_element"]["prior_git_blob"] - assert q4_blob == runtime_successor["change"]["e4_pl_element"]["current_git_blob"] - assert s3_blob == runtime_successor["change"]["e4_pl_s3_element"][ - "current_git_blob" - ] + _assert_live_sources_bound_through_successor(q4_blob, s3_blob, runtime_successor) assert runtime_successor["qualification_boundary"][ "mechanics_coefficients_or_operators_changed" ] is False @@ -269,10 +345,7 @@ def test_integration_repair_preserves_qualification_and_q4_boundary() -> None: assert successor["correction"]["e4_pl_element_blob"] == runtime_successor[ "change" ]["e4_pl_element"]["prior_git_blob"] - assert q4_blob == runtime_successor["change"]["e4_pl_element"]["current_git_blob"] - assert s3_blob == runtime_successor["change"]["e4_pl_s3_element"][ - "current_git_blob" - ] + _assert_live_sources_bound_through_successor(q4_blob, s3_blob, runtime_successor) assert runtime_successor["qualification_boundary"][ "mechanics_coefficients_or_operators_changed" ] is False From ed675e65e835b232aa5e92d5dc77bb22bfc61f2f Mon Sep 17 00:00:00 2001 From: Audun Arnesen Nyhus Date: Wed, 11 Nov 2026 22:16:09 +0100 Subject: [PATCH 08/15] Keep the 0.4.3 archive verifier bound to its original wheel names --- scripts/verify_release_runtime.py | 16 ++++++++-------- tests/test_release_043.py | 5 +++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/scripts/verify_release_runtime.py b/scripts/verify_release_runtime.py index 1b4b1df6e..81c6237d5 100644 --- a/scripts/verify_release_runtime.py +++ b/scripts/verify_release_runtime.py @@ -23,7 +23,7 @@ def runtime(z): if len(z.namelist()) != len(set(z.namelist())): raise ValueError('duplicate wheel entries') return {n: z.read(n).replace(b'\r\n', b'\n') for n in z.namelist() - if n.startswith('anyfesolver/') and not n.endswith('/')} + if n.startswith('anysolver/') and not n.endswith('/')} before, after = runtime(old), runtime(new) if before.keys() != after.keys(): raise ValueError('runtime path set mismatch') @@ -32,18 +32,18 @@ def runtime(z): a, b = before[name], after[name] if a == b: continue - if name != 'anyfesolver/__init__.py' or a.count(b'__version__ = "0.4.2"') != 1: + if name != 'anysolver/__init__.py' or a.count(b'__version__ = "0.4.2"') != 1: raise ValueError('runtime changed: ' + name) if a.replace(b'__version__ = "0.4.2"', b'__version__ = "0.4.3"') != b: raise ValueError('non-version runtime change') changes.append(name) - if changes != ['anyfesolver/__init__.py']: + if changes != ['anysolver/__init__.py']: raise ValueError('release version change missing') metadata = [n for n in new.namelist() if n.endswith('.dist-info/METADATA')] if len(metadata) != 1: raise ValueError('wheel metadata count') headers = BytesParser().parsebytes(new.read(metadata[0])) - if headers['Version'] != '0.4.3' or headers['Name'].lower() != 'anyfesolver': + if headers['Version'] != '0.4.3' or headers['Name'].lower() != 'anysolver': raise ValueError('release metadata mismatch') return dict(schema='anysolver.release-runtime-bridge.v1', accepted_wheel_sha256=ACCEPTED_SHA256, @@ -64,12 +64,12 @@ def compare_manifest(manifest: Path, release: Path) -> dict: with ZipFile(release) as wheel: if len(wheel.namelist()) != len(set(wheel.namelist())): raise ValueError('duplicate wheel entries') - paths = {n for n in wheel.namelist() if n.startswith('anyfesolver/') and not n.endswith('/')} + paths = {n for n in wheel.namelist() if n.startswith('anysolver/') and not n.endswith('/')} if paths != set(record['runtime']): raise ValueError('runtime path set mismatch') for name in sorted(paths): raw = wheel.read(name).replace(b'\r\n', b'\n') - if name == 'anyfesolver/__init__.py': + if name == 'anysolver/__init__.py': if raw.count(b'__version__ = "0.4.3"') != 1: raise ValueError('release version assignment mismatch') raw = raw.replace(b'__version__ = "0.4.3"', b'__version__ = "0.4.2"') @@ -79,14 +79,14 @@ def compare_manifest(manifest: Path, release: Path) -> dict: if len(names) != 1: raise ValueError('wheel metadata count') headers = BytesParser().parsebytes(wheel.read(names[0])) - if headers['Version'] != '0.4.3' or headers['Name'].lower() != 'anyfesolver': + if headers['Version'] != '0.4.3' or headers['Name'].lower() != 'anysolver': raise ValueError('release metadata mismatch') raw = release.read_bytes() return dict(schema='anysolver.release-runtime-bridge.v1', accepted_wheel_sha256=ACCEPTED_SHA256, release_wheel_sha256=sha256(raw).hexdigest(), release_wheel_bytes=len(raw), runtime_file_count=317, - normalized_changes=['anyfesolver/__init__.py'], version_only=True, + normalized_changes=['anysolver/__init__.py'], version_only=True, qualification_scope_unchanged=True, defaults_unchanged=True) diff --git a/tests/test_release_043.py b/tests/test_release_043.py index 885d0341f..474c3d539 100644 --- a/tests/test_release_043.py +++ b/tests/test_release_043.py @@ -15,11 +15,12 @@ def test_release_043_history_is_preserved_after_successor_release(): metadata = tomllib.loads((ROOT / 'pyproject.toml').read_text()) - tree = ast.parse((ROOT / 'src/anysolver/__init__.py').read_text()) + tree = ast.parse((ROOT / 'src/anyfesolver/__init__.py').read_text()) version = next(ast.literal_eval(n.value) for n in tree.body if isinstance(n, ast.Assign) and any(isinstance(t, ast.Name) and t.id == '__version__' for t in n.targets)) - assert metadata['project']['version'] == version == '0.4.7' + assert metadata['project']['name'] == 'ANYfeSolver' + assert metadata['project']['version'] == version == '0.5.0' assert json.loads((ROOT / 'dependency-licenses.json').read_text())['release'] == version assert '## 0.4.3 - 2026-09-09' in (ROOT / 'CHANGELOG.md').read_text() assert (ROOT / 'scripts/release_043_runtime.json').is_file() From 466afb746d62d739cf58628ab569970f167597fc Mon Sep 17 00:00:00 2001 From: Audun Arnesen Nyhus Date: Wed, 11 Nov 2026 22:17:46 +0100 Subject: [PATCH 09/15] Use canonical solver imports in live beam and contact reference callers --- scripts/d1_radial_source_bin_work.py | 484 ++++++++++++++ scripts/d1_reference_gap_work.py | 128 ++++ .../general_contact_d1_interior_press_dev.py | 4 +- .../d1_radial_linear_saved_assessment.py | 625 ++++++++++++++++++ .../d1_two_body_displacement_compare.py | 146 ++++ .../d1_two_body_displacement_oracle.py | 88 +++ .../ge_beam3_exact_inertia_benchmark.py | 73 ++ .../ge_beam3_plastic_cell_conjugate_probe.py | 119 ++++ .../ge_beam3_slender_spectrum_probe.py | 54 ++ ...t_ge_beam3_plastic_cell_conjugate_probe.py | 2 +- tests/test_ge_beam3_slender_spectrum_probe.py | 2 +- ...neral_contact_d1_radial_source_bin_work.py | 2 +- ...contact_d1_two_body_displacement_oracle.py | 10 +- ..._contact_radial_linear_saved_assessment.py | 2 +- tests/test_native_dyadic_interval_inertia.py | 2 +- tests/test_native_fraction_free_inertia.py | 4 +- .../test_native_reference_factor_spectrum.py | 2 +- 17 files changed, 1734 insertions(+), 13 deletions(-) create mode 100644 scripts/d1_radial_source_bin_work.py create mode 100644 scripts/d1_reference_gap_work.py create mode 100644 tests/fixtures/d1_radial_linear_saved_assessment.py create mode 100644 tests/fixtures/d1_two_body_displacement_compare.py create mode 100644 tests/fixtures/d1_two_body_displacement_oracle.py create mode 100644 tests/fixtures/reference_cases/ge_beam3_exact_inertia_benchmark.py create mode 100644 tests/fixtures/reference_cases/ge_beam3_plastic_cell_conjugate_probe.py create mode 100644 tests/fixtures/reference_cases/ge_beam3_slender_spectrum_probe.py diff --git a/scripts/d1_radial_source_bin_work.py b/scripts/d1_radial_source_bin_work.py new file mode 100644 index 000000000..4da6fcb0d --- /dev/null +++ b/scripts/d1_radial_source_bin_work.py @@ -0,0 +1,484 @@ +"""Saved-pose source-bin work for the flat-reference guided radial fixture. + +Independent geometry integration uses projected polygon clipping, a bilinear +inverse map and tensor Gauss/Duffy quadrature. It imports neither contact +clipping nor AD for that calculation. Optional production comparison sums +source pair gradients before nodal assembly, retaining moving normalization. +Quadrature differences are estimates, not certified interval error bounds. +No target-local-bin, moment, continuum accuracy or acceptance claim follows. +""" + +from __future__ import annotations + +from dataclasses import dataclass, replace +from fractions import Fraction +import math + +import numpy as np + +from docs.d1_review_support.d1_radial_reference_observables import ( + PRINCIPAL_BIN_EDGES, q1_reference_pressure_observables, +) + + +@dataclass(frozen=True) +class PhysicalSkinFace: + node_ids: tuple[int, ...] + reference_positions: np.ndarray + current_positions: np.ndarray + + def __post_init__(self): + if any(not isinstance(node, (int, np.integer)) or isinstance(node, bool) or node <= 0 + for node in self.node_ids): + raise ValueError("physical skin node IDs must be positive integers") + object.__setattr__(self, "node_ids", tuple(map(int, self.node_ids))) + object.__setattr__(self, "reference_positions", np.asarray(self.reference_positions, dtype=float)) + object.__setattr__(self, "current_positions", np.asarray(self.current_positions, dtype=float)) + + +def _cross2(a, b): + return a[..., 0]*b[..., 1]-a[..., 1]*b[..., 0] + + +def _clip(subject, triangle): + """Intersect CCW polygons without contact-library clipping dependencies.""" + polygon = list(np.asarray(subject, dtype=float)) + for a, b in zip(triangle, np.roll(triangle, -1, axis=0)): + result = [] + for start, end in zip(polygon, polygon[1:]+polygon[:1]): + first, last = _cross2(b-a, start-a), _cross2(b-a, end-a) + if (first >= 0.) != (last >= 0.): + result.append(start+(end-start)*(first/(first-last))) + if last >= 0.: + result.append(end) + polygon = result + if len(polygon) < 3: + return np.empty((0, 2)) + return np.asarray(polygon) + + +def vertical_gap_factor(source_slope, projection_slope, target_slope): + """Exact derivative of the implemented projected gap under source +z.""" + ss, s0, st = (np.asarray(value, dtype=float) for value in + (source_slope, projection_slope, target_slope)) + return (1.+np.sum(ss*s0, axis=-1))/(np.sqrt(1.+np.sum(ss*ss, axis=-1)) + *(1.+np.sum(st*s0, axis=-1))) + + +def conversion_bound(source_slope_max, target_slope_max): + """Conservative two-sided bound, including physical/projection mismatch.""" + s, t = float(source_slope_max), float(target_slope_max) + if not (math.isfinite(s) and math.isfinite(t) and 0. <= s < 1. and t >= 0.): + raise ValueError("source-bin slope bound requires s<1 and s*t<1") + sf, tf = Fraction.from_float(s), Fraction.from_float(t) + if sf*tf >= 1: + raise ValueError("source-bin slope bound requires s<1 and s*t<1") + # Exact arithmetic encloses the supplied binary-float slope bounds. The + # geometric quadrature estimates below are intentionally not certified. + cf = (1-sf*sf)/(1+sf*sf) + cosine = _round_lower(cf) + lower = _round_lower(cf/(1+sf*tf)) + upper = _sqrt_upper((1+sf*sf)/(1-sf*tf)**2) + alpha = np.nextafter(max(1.-lower, upper-1.), np.inf) + return dict(source_slope_max=s, target_slope_max=t, + physical_projection_cosine_lower=float(cosine), + kappa_lower=float(lower), kappa_upper=float(upper), + relative_conversion_bound=float(alpha)) + + +def _round_lower(value): + result = float(value) + while Fraction.from_float(result) > value: + result = math.nextafter(result, -math.inf) + return result + + +def _sqrt_upper(value): + result = math.sqrt(float(value)) + while Fraction.from_float(result)**2 < value: + result = math.nextafter(result, math.inf) + return result + + +def _exact_source_slope_bound(points): + q = [[Fraction.from_float(float(value)) for value in row] for row in points] + hx, hy = q[1][0]-q[0][0], q[3][1]-q[0][1] + gx = ((q[1][2]-q[0][2])/hx, (q[2][2]-q[3][2])/hx) + gy = ((q[3][2]-q[0][2])/hy, (q[2][2]-q[1][2])/hy) + # The physical gradient is affine in material coordinates, so its norm + # is bounded by the four corner norms. The corner projection is one of + # those normals and requires no additional unmeasured assumption. + return _sqrt_upper(max(x*x+y*y for x in gx for y in gy)) + + +def _exact_target_slope_bound(points): + q = [[Fraction.from_float(float(value)) for value in row] for row in points] + a = [q[1][i]-q[0][i] for i in range(3)] + b = [q[2][i]-q[0][i] for i in range(3)] + determinant = a[0]*b[1]-a[1]*b[0] + if determinant <= 0: + raise ValueError("target must be an upward, nondegenerate P1 graph") + gx, gy = (a[2]*b[1]-a[1]*b[2])/determinant, (a[0]*b[2]-a[2]*b[0])/determinant + return _sqrt_upper(gx*gx+gy*gy) + + +def _source_frame(points): + first, second = points[1]-points[0], points[3]-points[0] + normal = np.cross(first, second) + normal /= np.linalg.norm(normal) + tangent = first/np.linalg.norm(first) + return normal, tangent, np.cross(normal, tangent) + + +def _validate_faces(source_faces, target_faces, bin_edges): + if tuple(bin_edges) != PRINCIPAL_BIN_EDGES: + raise ValueError("source-bin scope requires principal edges (.1,.6,1.1)") + if not source_faces or not target_faces: + raise ValueError("source-bin scope needs both physical skins") + all_nodes, cells, bins, areas = {}, set(), [], [] + eps = 256*np.finfo(float).eps + for face_index, face in enumerate((*source_faces, *target_faces)): + reference, current = (np.asarray(value, dtype=float) for value in + (face.reference_positions, face.current_positions)) + count = 4 if face_index < len(source_faces) else 3 + if (reference.shape != (count, 3) or current.shape != reference.shape + or len(face.node_ids) != count or len(set(face.node_ids)) != count + or not np.all(np.isfinite(reference)) or not np.all(np.isfinite(current))): + raise ValueError("invalid physical source/target face") + if not np.array_equal(reference[:, :2], current[:, :2]): + raise ValueError("guided source-bin scope requires fixed physical XY") + for node, ref, point in zip(face.node_ids, reference, current): + if node in all_nodes and not (np.array_equal(all_nodes[node][0], ref) + and np.array_equal(all_nodes[node][1], point)): + raise ValueError("shared physical skin node is discontinuous") + all_nodes[node] = (ref, point) + source_nodes = {node for face in source_faces for node in face.node_ids} + target_nodes = {node for face in target_faces for node in face.node_ids} + if source_nodes & target_nodes: + raise ValueError("source and target skin nodes must be disjoint") + xs = np.unique([all_nodes[node][0][0] for node in source_nodes]) + ys = np.unique([all_nodes[node][0][1] for node in source_nodes]) + if not (np.array_equal(xs[[0, -1]], (.1, 1.1)) + and np.array_equal(ys[[0, -1]], (.1, 1.1))): + raise ValueError("source skin must span the radial reference rectangle") + for face in source_faces: + q = np.asarray(face.reference_positions) + xa, xb, ya, yb = q[0, 0], q[1, 0], q[0, 1], q[3, 1] + expected = np.array(((xa, ya), (xb, ya), (xb, yb), (xa, yb))) + if (xb <= xa or yb <= ya or not np.array_equal(q[:, :2], expected) + or np.any(q[:, 2] != q[0, 2])): + raise ValueError("source-bin scope needs flat-reference rectangular Q4s") + i, j = int(np.argmin(abs(xs-xa))), int(np.argmin(abs(ys-ya))) + if (i+1 >= len(xs) or j+1 >= len(ys) or xs[i+1] != xb + or ys[j+1] != yb or (i, j) in cells): + raise ValueError("source Q4s do not form one complete tensor grid") + cells.add((i, j)) + bix, biy = np.searchsorted(bin_edges, .5*(xa+xb))-1, np.searchsorted(bin_edges, .5*(ya+yb))-1 + if xa < bin_edges[bix] or xb > bin_edges[bix+1] or ( + ya < bin_edges[biy] or yb > bin_edges[biy+1]): + raise ValueError("principal bins must contain whole source faces") + bins.append((int(biy), int(bix))) + areas.append(float((xb-xa)*(yb-ya))) + if len(cells) != (len(xs)-1)*(len(ys)-1) or len(source_nodes) != len(xs)*len(ys): + raise ValueError("source tensor grid has missing faces or duplicate nodes") + # A target overlap cannot be traded against missing coverage. Check its + # XY graph for positive-area overlaps independently of the area sum. + for i, face in enumerate(target_faces): + tri = np.asarray(face.current_positions) + if _cross2(tri[1, :2]-tri[0, :2], tri[2, :2]-tri[0, :2]) <= 0.: + raise ValueError("target must be an upward, nondegenerate P1 graph") + for other in target_faces[:i]: + xy = np.asarray(other.current_positions)[:, :2] + if np.any(np.max(xy, axis=0) <= np.min(tri[:, :2], axis=0)) or np.any( + np.max(tri[:, :2], axis=0) <= np.min(xy, axis=0)): + continue + overlap = _clip(xy, tri[:, :2]) + if len(overlap) >= 3 and abs(np.sum(_cross2(overlap, np.roll(overlap, -1, axis=0))))/2 > eps: + raise ValueError("target P1 faces overlap") + return all_nodes, source_nodes, xs, ys, bins, areas + + +def _inverse_shape(xy, quad): + a, b, c = quad[1]-quad[0], quad[3]-quad[0], quad[2]-quad[1]-quad[3]+quad[0] + uv = (xy-quad[0]) @ np.linalg.inv(np.column_stack((a, b))).T + for _ in range(20): + u, v = uv.T + defect = quad[0]+u[:, None]*a+v[:, None]*b+(u*v)[:, None]*c-xy + ju, jv = a+v[:, None]*c, b+u[:, None]*c + det = _cross2(ju, jv) + if np.any(det <= 0.): + raise ValueError("projected Q4 inverse has nonpositive Jacobian") + change = np.column_stack((_cross2(defect, jv)/det, _cross2(ju, defect)/det)) + uv -= change + if np.max(abs(change)) < 64*np.finfo(float).eps: + break + else: + raise ValueError("independent projected Q4 inverse did not converge") + if np.any(uv < -1e-10) or np.any(uv > 1.+1e-10): + raise ValueError("independent overlap point is outside source Q4") + u, v = uv.T + shape = np.column_stack(((1-u)*(1-v), u*(1-v), u*v, (1-u)*v)) + return shape, u, v + + +def _coverage_scope(quad, triangles, target_faces): + """Reject boundary cuts and holes rather than rounding their area away.""" + for point in quad: + if not any(np.all(_cross2(np.roll(tri, -1, axis=0)-tri, point-tri) >= 0.) + for tri in triangles): + raise ValueError("source projected corner is outside target union") + edges = {} + for face_index, face in enumerate(target_faces): + for i in range(3): + edge = tuple(sorted((face.node_ids[i], face.node_ids[(i+1) % 3]))) + edges.setdefault(edge, []).append((face_index, i)) + for uses in edges.values(): + if len(uses) > 2: + raise ValueError("target union has a nonmanifold edge") + if len(uses) != 1: + continue + face_index, i = uses[0] + a, b = triangles[face_index][i], triangles[face_index][(i+1) % 3] + lo, hi = 0., 1. + for q, r in zip(quad, np.roll(quad, -1, axis=0)): + first, last = _cross2(r-q, a-q), _cross2(r-q, b-q) + if first <= 0. and last <= 0.: + lo = hi + break + if first < 0.: + lo = max(lo, first/(first-last)) + if last < 0.: + hi = min(hi, first/(first-last)) + if lo < hi: + middle = a+.5*(lo+hi)*(b-a) + if np.all(_cross2(np.roll(quad, -1, axis=0)-quad, middle-quad) > 0.): + raise ValueError("target boundary cuts a source face") + + +def _geometry_integrals(source_faces, target_faces, pressure, areas, bins, + force_tolerance, coverage_tolerance, maximum_triangles): + roots = [] + smax = max(_exact_source_slope_bound(face.current_positions) for face in source_faces) + target_normals = [np.cross(face.current_positions[1]-face.current_positions[0], + face.current_positions[2]-face.current_positions[0]) + for face in target_faces] + tmax = max(_exact_target_slope_bound(face.current_positions) for face in target_faces) + bound = conversion_bound(smax, tmax) + for source_index, face in enumerate(source_faces): + q = np.asarray(face.current_positions) + normal, tangent, binormal = _source_frame(q) + frame = np.column_stack((tangent, binormal)) + quad = (q-q[0]) @ frame + triangles = [(np.asarray(target.current_positions)-q[0]) @ frame + for target in target_faces] + _coverage_scope(quad, triangles, target_faces) + for tri, nt in zip(triangles, target_normals): + if np.any(np.max(tri, axis=0) < np.min(quad, axis=0)) or np.any( + np.max(quad, axis=0) < np.min(tri, axis=0)): + continue + if nt @ normal <= 0.: + raise ValueError("target faces away from source projection") + polygon = _clip(quad, tri) + for k in range(1, len(polygon)-1): + vertices = polygon[[0, k, k+1]] + if _cross2(vertices[1]-vertices[0], vertices[2]-vertices[0]) > 0.: + roots.append((source_index, vertices, q, quad, normal, nt)) + if not roots: + raise ValueError("source-bin scope has no projected overlap") + rules = {} + for order in (4, 8): + points, weights = np.polynomial.legendre.leggauss(order) + points, weights = .5*(points+1), .5*weights + u, v = np.meshgrid(points, points, indexing="ij") + wu, wv = np.meshgrid(weights, weights, indexing="ij") + rules[order] = (u.ravel(), v.ravel(), (wu*wv*(1-u)).ravel()) + values, errors = np.zeros((len(source_faces), 2)), np.zeros((len(source_faces), 2)) + visited = 0 + def integrate(root, vertices, tolerance): + nonlocal visited + visited += 1 + if visited > maximum_triangles: + raise MemoryError("independent source-bin triangle budget exhausted") + index, _, q, quad, normal, nt = root + a, b, c = vertices + determinant = _cross2(b-a, c-a) + results = [] + for order in (4, 8): + u, v, weights = rules[order] + xy = a+u[:, None]*(b-a)+((1-u)*v)[:, None]*(c-a) + shape, r, s = _inverse_shape(xy, quad) + cross_term = q[2]-q[1]-q[3]+q[0] + jr, js = q[1]-q[0]+s[:, None]*cross_term, q[3]-q[0]+r[:, None]*cross_term + cross = np.cross(jr, js) + jacobian = cross @ normal + physical_normal = cross/np.linalg.norm(cross, axis=1)[:, None] + kappa = (physical_normal @ normal)*nt[2]/(nt @ normal) + measure = determinant*weights*areas[index]/jacobian + p = shape @ np.array([pressure[node] for node in source_faces[index].node_ids]) + results.append(np.array((math.fsum(measure), math.fsum(measure*p*kappa)))) + error = (abs(results[1]-results[0]) + +512*np.finfo(float).eps*np.maximum(abs(results[0]), abs(results[1]))) + if np.all(error <= tolerance): + return results[1], error + ab, bc, ca = (a+b)/2, (b+c)/2, (c+a)/2 + result = np.zeros(2); error_sum = np.zeros(2) + for child in ((a, ab, ca), (ab, b, bc), (ca, bc, c), (ab, bc, ca)): + part, estimate = integrate(root, np.asarray(child), tolerance/4) + result += part; error_sum += estimate + return result, error_sum + tolerance = np.array((coverage_tolerance, force_tolerance))/len(roots) + for root in roots: + result, estimate = integrate(root, root[1], tolerance) + values[root[0]] += result + errors[root[0]] += estimate + if np.any(abs(values[:, 0]-areas)+errors[:, 0] > coverage_tolerance): + raise ValueError("target union does not wholly cover each source face") + binned, binned_error = np.zeros((2, 2)), np.zeros((2, 2)) + for index, cell in enumerate(bins): + binned[cell] += values[index, 1] + binned_error[cell] += errors[index, 1] + return binned, binned_error, bound, visited + + +def _production_pair_bins(geometry, source_faces, target_faces, force, bins, support, + coverage_tolerance): + """Use existing Jet2 pair gradients without changing production behavior.""" + from anyfesolver.general_contact.q4_s3_overlap_derivatives import q4_s3_overlap_derivatives + from anyfesolver.general_contact.s3_patch_augmented import MovingS3PatchProjectedNormal + if geometry.differentiation != "jet2_q4_s3": + raise ValueError("production comparison requires Q4/S3 Jet2 geometry") + for declared, actual in ((geometry.source_faces, source_faces), + (geometry.target_faces, target_faces)): + if len(declared) != len(actual) or any( + a.node_ids != b.node_ids or not np.array_equal(a.reference_positions, b.reference_positions) + for a, b in zip(declared, actual) + ): + raise ValueError("production geometry does not match saved physical skins") + current = {node: point for face in (*source_faces, *target_faces) + for node, point in zip(face.node_ids, face.current_positions)} + source = np.array([current[node] for node in geometry.source_node_ids]) + target = np.array([current[node] for node in geometry.target_node_ids]) + state = geometry.evaluate(source, target) + analytic_support = np.array([support[node] for node in geometry.source_node_ids]) + if np.max(abs(state.reference_support-analytic_support)) > coverage_tolerance: + raise ValueError("production shared support differs from complete-face support") + p = np.array([force[node] for node in geometry.source_node_ids])/state.reference_support + g = state.reference_weighted_gap/state.reference_support + result, normalization = np.zeros((2, 2)), np.zeros((2, 2)) + evaluations = sum(local is not None for local in state.pair_states) + base_evaluations = evaluations + derivative_evaluations = 0 + columns = (2, 5, 8, 11) + for pair, local in enumerate(state.pair_states): + if local is None or local.reference_overlap_area == 0.: + continue + i, j = divmod(pair, len(target_faces)) + evaluations += 1 + derivative_evaluations += 1 + geometry._check_energy_evaluation_budget(evaluations) + tolerances = geometry.q4_source_derivative_tolerances + derivative = q4_s3_overlap_derivatives( + source_faces[i].reference_positions, source_faces[i].current_positions, + target_faces[j].current_positions, allow_warped_source=True, + area_tolerance=geometry.q4_source_area_tolerance, + weighted_gap_tolerance=geometry.q4_source_weighted_gap_tolerance, + maximum_triangles=geometry.maximum_q4_source_integration_triangles, + support_gradient_tolerance=tolerances[0], support_hessian_tolerance=tolerances[1], + weighted_gap_gradient_tolerance=tolerances[2], weighted_gap_hessian_tolerance=tolerances[3]) + nodes = geometry.source_face_indices[i] + dw = np.sum(derivative.weighted_gap_gradient[:, columns], axis=1) + ds = np.sum(derivative.support_gradient[:, columns], axis=1) + term = float((p[nodes]*g[nodes]) @ ds) + normalization[bins[i]] += term + result[bins[i]] += float(p[nodes] @ dw)-term + # Validate the ordinary straight Jet2 work branch as well as accessing + # its pair gradients. Reuse the already evaluated same-pose float state; + # charge only the additional AD passes. Unsupported seam/tiny recovery is + # deliberately reported as a missing check, never assembled into bins. + geometry._check_energy_evaluation_budget(evaluations+derivative_evaluations) + normal = MovingS3PatchProjectedNormal(geometry) + work = normal._jet2_s3_work(source, target, replace(state, pressure=p, energy=0.), + tangent=False, nodal_force_mode=True) + evaluations += work.energy_evaluations-base_evaluations + geometry._check_energy_evaluation_budget(evaluations) + total = -float(np.sum(work.residual[:3*len(geometry.source_node_ids)].reshape(-1, 3)[:, 2])) + return dict(status="measured", source_pair_gradient_bins_n=result.tolist(), + moving_normalization_term_bins_n=normalization.tolist(), + pair_energy_evaluations=evaluations, straight_jet2_work_branch_validated=True, + validated_total_source_vertical_work_n=total, + sum_of_bins_minus_validated_total_n=float(np.sum(result)-total)) + + +def source_bin_geometry_work(source_faces, target_faces, nodal_contact_forces_n, *, + bin_edges=PRINCIPAL_BIN_EDGES, quadrature_tolerance_n, + maximum_triangles, coverage_tolerance_m2=1e-10, + production_geometry=None): + """Check one saved physical-skin pose; returned differences are evidence.""" + source_faces, target_faces = tuple(source_faces), tuple(target_faces) + if (not np.isfinite(quadrature_tolerance_n) or quadrature_tolerance_n <= 0. + or not np.isfinite(coverage_tolerance_m2) or coverage_tolerance_m2 <= 0. + or type(maximum_triangles) is not int or maximum_triangles < 1): + raise ValueError("source-bin quadrature controls must be positive") + nodes, source_ids, xs, ys, bins, areas = _validate_faces(source_faces, target_faces, bin_edges) + force = dict(nodal_contact_forces_n) + if set(force) != source_ids or any(not np.isfinite(value) or value < 0. for value in force.values()): + raise ValueError("nonnegative nodal forces must name every source node exactly") + support = dict.fromkeys(source_ids, 0.) + for face, area in zip(source_faces, areas): + for node in face.node_ids: + support[node] += area/4 + pressure = {node: float(force[node]/support[node]) for node in source_ids} + grid = np.full((len(ys), len(xs)), np.nan) + for node in source_ids: + x, y = nodes[node][0][:2] + cell = (int(np.argmin(abs(ys-y))), int(np.argmin(abs(xs-x)))) + if np.isfinite(grid[cell]): + raise ValueError("multiple source nodes occupy one grid point") + grid[cell] = pressure[node] + observable = q1_reference_pressure_observables(xs, ys, grid) + reference_bins = np.array([[item.force_n for item in row] for row in observable.bins]) + integral, error, bound, visited = _geometry_integrals( + source_faces, target_faces, pressure, areas, bins, quadrature_tolerance_n, + coverage_tolerance_m2, maximum_triangles) + result = dict(scope="guided flat-reference source whole-face vertical work bins; no target-bin or moment claim", + bin_edges=list(bin_edges), slope_conversion_bound=bound, + reference_pressure_bins_n=reference_bins.tolist(), + reference_pressure_estimated_error_bins_n=[ + [item.estimated_absolute_error[0] for item in row] + for row in observable.bins], + independent_geometry_work_bins_n=integral.tolist(), + estimated_quadrature_error_bins_n=error.tolist(), + conversion_allowance_bins_n=(bound["relative_conversion_bound"]*reference_bins).tolist(), + visited_triangles=visited, + production_comparison=dict(status="not_checked", reason="production geometry not supplied")) + if production_geometry is not None: + try: + comparison = _production_pair_bins(production_geometry, source_faces, target_faces, + force, bins, support, coverage_tolerance_m2) + except (ValueError, MemoryError) as exc: + comparison = dict(status="not_checked", reason=f"{type(exc).__name__}: {exc}") + if comparison["status"] == "measured": + comparison["gradient_minus_independent_bins_n"] = ( + np.asarray(comparison["source_pair_gradient_bins_n"])-integral).tolist() + result["production_comparison"] = comparison + return result + + +def check_guided_source_bins(model, definition, displacement, nodal_contact_forces_n, **options): + """Reconstruct physical skins through the installed shell work-map contract.""" + from anyfesolver.general_contact.s3_patch_static import _adapters, _selected + source, target, _ = _selected(definition) + adapters = _adapters(model, (source, target)) + u = np.asarray(displacement, dtype=float).reshape(-1) + if u.size != model.mesh.dof_manager.total_dofs or not np.all(np.isfinite(u)): + raise ValueError("saved displacement has invalid size or values") + for side in adapters: + for face in side: + for node in face.node_ids: + dofs = model.mesh.dof_manager.get_node_dofs(node) + if np.any(u[np.asarray(dofs)[(0, 1, 3, 4, 5),]] != 0.): + raise ValueError("guided source-bin scope requires fixed XY and directors") + faces = tuple(tuple(PhysicalSkinFace(face.node_ids, face.reference_positions, + face.current_positions(u)) for face in side) + for side in adapters) + return source_bin_geometry_work(*faces, nodal_contact_forces_n, **options) diff --git a/scripts/d1_reference_gap_work.py b/scripts/d1_reference_gap_work.py new file mode 100644 index 000000000..48ef75f42 --- /dev/null +++ b/scripts/d1_reference_gap_work.py @@ -0,0 +1,128 @@ +"""Frozen-footprint linear Q1/S3 gap quadrature for the saved-state assessment.""" + +from __future__ import annotations + +import numpy as np + + + +def _cross(a: np.ndarray, b: np.ndarray) -> float: + return float(a[0]*b[1] - a[1]*b[0]) + + +def _clip(polygon: np.ndarray, triangle: np.ndarray) -> np.ndarray: + """Intersect a convex XY polygon with a counterclockwise triangle.""" + output = [np.asarray(point, dtype=float) for point in polygon] + if _cross(triangle[1]-triangle[0], triangle[2]-triangle[0]) <= 0: + raise ValueError("oracle triangle must be counterclockwise") + for index in range(3): + start, end = triangle[index], triangle[(index+1) % 3] + edge = end-start + source = output + output = [] + if not source: + break + for first, second in zip(source, source[1:]+source[:1]): + first_side = _cross(edge, first-start) + second_side = _cross(edge, second-start) + first_inside = first_side >= -1e-14 + second_inside = second_side >= -1e-14 + if first_inside != second_inside: + fraction = first_side/(first_side-second_side) + output.append(first + fraction*(second-first)) + if second_inside: + output.append(second) + return np.asarray(output).reshape(-1, 2) + + +def _triangle_quadrature(vertices: np.ndarray): + """Integrate polynomials of sufficient degree via a tensor Gauss map.""" + roots, weights = np.polynomial.legendre.leggauss(4) + roots = 0.5*(roots+1) + weights = 0.5*weights + origin, first, second = vertices + jacobian = abs(_cross(first-origin, second-origin)) + for u, wu in zip(roots, weights): + for v, wv in zip(roots, weights): + point = origin+u*(first-origin)+(1-u)*v*(second-origin) + yield point, float(wu*wv*(1-u)*jacobian) + + +def _source_shape(point: np.ndarray, corners: np.ndarray) -> np.ndarray: + x0, y0 = corners[0] + y1 = corners[2, 1] + eta = (point[1]-y0)/(y1-y0) + left = (1-eta)*x0+eta*corners[3, 0] + right = (1-eta)*corners[1, 0]+eta*corners[2, 0] + xi = (point[0]-left)/(right-left) + return np.array(((1-xi)*(1-eta), xi*(1-eta), xi*eta, + (1-xi)*eta)) + + +def _target_shape(point: np.ndarray, triangle: np.ndarray) -> np.ndarray: + a, b, c = triangle + denominator = _cross(b-a, c-a) + beta = _cross(point-a, c-a)/denominator + gamma = _cross(b-a, point-a)/denominator + return np.array((1-beta-gamma, beta, gamma)) + + +def independent_gap_work(model, definition, source_shift_x: float, + target_skin_xy: dict[int, np.ndarray] | None = None, + source_skin_xy: dict[int, np.ndarray] | None = None): + """Return reference support and the full-coordinate weighted gap map.""" + source_ids = sorted({node for element_id in definition.surfaces[0].element_ids + for node in model.mesh.elements[element_id].node_ids}) + target_ids = sorted({node for element_id in definition.surfaces[1].element_ids + for node in model.mesh.elements[element_id].node_ids}) + index = {node: row for row, node in enumerate(source_ids)} + ndof = model.mesh.dof_manager.total_dofs + support = np.zeros(len(source_ids)) + work = np.zeros((len(source_ids), ndof)) + integrated_area = 0.0 + for source_element_id in definition.surfaces[0].element_ids: + source_element = model.mesh.elements[source_element_id] + source_nodes = tuple(source_element.node_ids) + source_xy = np.array([ + ((model.mesh.nodes[node].x+source_shift_x, + model.mesh.nodes[node].y) + if source_skin_xy is None else source_skin_xy[node]) + for node in source_nodes]) + if not (abs(source_xy[0, 1]-source_xy[1, 1]) < 1e-13 + and abs(source_xy[2, 1]-source_xy[3, 1]) < 1e-13): + raise ValueError("oracle admits horizontal Q4 rows only") + for target_element_id in definition.surfaces[1].element_ids: + target_element = model.mesh.elements[target_element_id] + target_nodes = tuple(target_element.node_ids) + target_xy = np.array([ + ((model.mesh.nodes[node].x, model.mesh.nodes[node].y) + if target_skin_xy is None else target_skin_xy[node]) + for node in target_nodes]) + polygon = _clip(source_xy, target_xy) + if len(polygon) < 3: + continue + for fan in range(1, len(polygon)-1): + triangle = np.asarray((polygon[0], polygon[fan], + polygon[fan+1])) + if abs(_cross(triangle[1]-triangle[0], + triangle[2]-triangle[0])) < 1e-16: + continue + for point, weight in _triangle_quadrature(triangle): + source_shape = _source_shape(point, source_xy) + target_shape = _target_shape(point, target_xy) + integrated_area += weight + for local_pressure, source_node in enumerate(source_nodes): + row = index[source_node] + mass = weight*source_shape[local_pressure] + support[row] += mass + for local_displacement, node in enumerate(source_nodes): + dof = model.mesh.dof_manager.get_node_dofs(node)[2] + work[row, dof] += mass*source_shape[local_displacement] + for local_displacement, node in enumerate(target_nodes): + dof = model.mesh.dof_manager.get_node_dofs(node)[2] + work[row, dof] -= mass*target_shape[local_displacement] + if np.min(support) <= 0.0: + raise ValueError("oracle needs positive support on every pressure node") + if abs(np.sum(support)-integrated_area) > 1e-12: + raise AssertionError("oracle partition of unity failed") + return tuple(source_ids), support, work, integrated_area diff --git a/scripts/general_contact_d1_interior_press_dev.py b/scripts/general_contact_d1_interior_press_dev.py index 2a01889e0..4dbd93504 100644 --- a/scripts/general_contact_d1_interior_press_dev.py +++ b/scripts/general_contact_d1_interior_press_dev.py @@ -767,7 +767,7 @@ def radial_linear_discriminator(output: Path, *, target_cells=4, from scipy import linalg, optimize from anyfesolver.assembly import build_constraint_transformation from anyfesolver.matrix_assembly import assemble_stiffness_matrix - from docs.d1_review_support.d1_two_body_reference_oracle import independent_gap_work + from scripts.d1_reference_gap_work import independent_gap_work started = time.perf_counter() model, definition, settings, program, reference, record = build_radial_guided_case( target_cells=target_cells, target_right_x_m=target_right_x_m) @@ -1046,7 +1046,7 @@ def radial_source_bin_check(output: Path, saved_path: Path): raise FileExistsError(output) from dataclasses import asdict from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager - from docs.d1_review_support.d1_radial_source_bin_work import check_guided_source_bins + from scripts.d1_radial_source_bin_work import check_guided_source_bins from docs.d1_review_support.d1_radial_reference_observables import uniform_disk_pressure_observables from docs.d1_review_support.d1_radial_bin_assessment import assess_physical_source_bins started = time.perf_counter() diff --git a/tests/fixtures/d1_radial_linear_saved_assessment.py b/tests/fixtures/d1_radial_linear_saved_assessment.py new file mode 100644 index 000000000..54fdb61a0 --- /dev/null +++ b/tests/fixtures/d1_radial_linear_saved_assessment.py @@ -0,0 +1,625 @@ +"""Reassemble a saved radial linear QP state; never optimize or solve contact. + +The contact map is the independent reference-XY polygon/quadrature oracle. +Results describe observed saved-state discrepancies, not a uniform nonlinear +model-error bound or a physical current-skin force/moment certificate. +""" + +from __future__ import annotations + +from dataclasses import asdict, dataclass +from fractions import Fraction +from itertools import product +import json +import math +import warnings + +import numpy as np +from scipy import linalg + +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.matrix_assembly import assemble_stiffness_matrix +from scripts.d1_reference_gap_work import ( + independent_gap_work, _source_shape, _target_shape, +) +from docs.d1_review_support.d1_radial_reference_observables import ( + q1_reference_pressure_observables, +) + + +SCOPE = "saved parallel-skin linear fixture; observed final-state discrepancy only" +POINTS = ((.6, .6), (.6, .85), (.6, 1.0)) +EXPECTED = { + "source_guided_shear_n_m": 1602.5641025641025, + "target_guided_shear_n_m": 3163.400547104653, + "target_phi_squared_range": (.39479238827866037, .3947923882786611), + "target_cells": 12, "target_right_x_m": 1.297, "target_y0_m": -.113, + "gap_m": 7.741263872132846e-6, "exact_force_n": .020435219974701022, +} +MAXIMUM_CORRECTION_DIMENSION = 512 + + +def _up(value): + return float(np.nextafter(value, np.inf)) + + +def _gamma(count): + value = count*np.finfo(float).eps + if value >= .01: + raise ValueError("saved correction arithmetic budget exceeded") + return _up(value/(1.-value)) + + +def _fraction_upper(value): + result = float(value) + return _up(result) if Fraction(result) < value else result + + +def _rational_clip(polygon, triangle): + def cross(a, b): + return a[0]*b[1]-a[1]*b[0] + output = list(polygon) + for start, end in zip(triangle, triangle[1:]+triangle[:1]): + source, output = output, [] + if not source: + break + edge = (end[0]-start[0], end[1]-start[1]) + for first, second in zip(source, source[1:]+source[:1]): + first_side = cross(edge, (first[0]-start[0], first[1]-start[1])) + second_side = cross(edge, (second[0]-start[0], second[1]-start[1])) + if (first_side >= 0) != (second_side >= 0): + fraction = first_side/(first_side-second_side) + output.append(tuple(first[j]+fraction*(second[j]-first[j]) for j in (0, 1))) + if second_side >= 0: + output.append(second) + return output + + +def _triangle_moments(vertices): + x, y = tuple(zip(*vertices)) + area = abs((x[1]-x[0])*(y[2]-y[0])-(y[1]-y[0])*(x[2]-x[0]))/2 + sx, sy = sum(x), sum(y) + moments = {(0, 0): area, (1, 0): area*sx/3, (0, 1): area*sy/3, + (1, 1): area*(sx*sy+sum(a*b for a, b in zip(x, y)))/12, + (2, 0): area*(sum(a*a for a in x)+sum(x[i]*x[j] for i in range(3) for j in range(i)))/6, + (0, 2): area*(sum(a*a for a in y)+sum(y[i]*y[j] for i in range(3) for j in range(i)))/6} + # Integral of a degree-three barycentric product: 2A*prod(c_i!)/5!. + for powers, values in (((2, 1), (x, x, y)), ((1, 2), (x, y, y))): + total = Fraction(0) + for indices in product(range(3), repeat=3): + weight = math.prod(math.factorial(indices.count(i)) for i in range(3)) + total += weight*math.prod(values[j][indices[j]] for j in range(3)) + moments[powers] = area*total/60 + return moments + + +def _target_polynomials(points): + a, b, c = points + bx, by, cx, cy = b[0]-a[0], b[1]-a[1], c[0]-a[0], c[1]-a[1] + determinant = bx*cy-by*cx + if determinant <= 0: + raise ValueError("rational audit requires counterclockwise target faces") + beta = { (0, 0): (-a[0]*cy+a[1]*cx)/determinant, + (1, 0): cy/determinant, (0, 1): -cx/determinant } + gamma = { (0, 0): (-bx*a[1]+by*a[0])/determinant, + (1, 0): -by/determinant, (0, 1): bx/determinant } + first = {key: (int(key == (0, 0))-beta[key]-gamma[key]) for key in beta} + return first, beta, gamma + + +def _audit_gap_coefficients(model, definition, prepared): + """Exact binary-coordinate Q1/P1 coefficient audit of this frozen footprint. + + Original oracle Q1*P1 degree is three; Duffy Jacobian adds one degree. + Four-point tensor Gauss therefore integrates it exactly mathematically. + This rational audit encloses the *floating* clipping/integration/support + differences, including the original oracle's tiny-polygon cutoff. + """ + source_row = {node: i for i, node in enumerate(prepared.source_ids)} + exact_work = {} + exact_support = [Fraction(0) for _ in prepared.source_ids] + targets = [] + for element_id in definition.surfaces[1].element_ids: + nodes = tuple(model.mesh.elements[element_id].node_ids) + points = [tuple(Fraction(float(v)) for v in (model.mesh.nodes[n].x, model.mesh.nodes[n].y)) for n in nodes] + targets.append((nodes, points, _target_polynomials(points))) + overlap_count = 0 + for element_id in definition.surfaces[0].element_ids: + nodes = tuple(model.mesh.elements[element_id].node_ids) + points = [tuple(Fraction(float(v)) for v in (model.mesh.nodes[n].x, model.mesh.nodes[n].y)) for n in nodes] + (x0, y0), (x1, _), (_, y1), _ = points + if points != [(x0, y0), (x1, y0), (x1, y1), (x0, y1)] or x1 <= x0 or y1 <= y0: + raise ValueError("rational audit requires axis-aligned Q1 rectangles") + hx, hy, area = x1-x0, y1-y0, (x1-x0)*(y1-y0) + bits = ((0, 0), (1, 0), (1, 1), (0, 1)) + polynomials = [] + for ix, iy in bits: + ax, bx = ((-x0/hx, 1/hx) if ix else (x1/hx, -1/hx)) + ay, by = ((-y0/hy, 1/hy) if iy else (y1/hy, -1/hy)) + polynomials.append({(0, 0): ax*ay, (1, 0): bx*ay, + (0, 1): ax*by, (1, 1): bx*by}) + covered = [Fraction(0)]*4 + for i, node in enumerate(nodes): + row = source_row[node] + exact_support[row] += area/4 + for j, other in enumerate(nodes): + key = row, model.mesh.dof_manager.get_node_dofs(other)[2] + mass = area/(3 if bits[i][0] == bits[j][0] else 6)/(3 if bits[i][1] == bits[j][1] else 6) + exact_work[key] = exact_work.get(key, Fraction(0))+mass + for target_nodes, triangle, target_poly in targets: + if (max(p[0] for p in triangle) < x0 or min(p[0] for p in triangle) > x1 + or max(p[1] for p in triangle) < y0 or min(p[1] for p in triangle) > y1): + continue + polygon = _rational_clip(points, triangle) + if len(polygon) < 3: + continue + overlap_count += 1 + for fan in range(1, len(polygon)-1): + moments = _triangle_moments((polygon[0], polygon[fan], polygon[fan+1])) + for i, poly in enumerate(polynomials): + covered[i] += sum(value*moments[key] for key, value in poly.items()) + row = source_row[nodes[i]] + for j, target in enumerate(target_nodes): + mass = sum(a*b*moments[(pa[0]+pb[0], pa[1]+pb[1])] + for pa, a in poly.items() for pb, b in target_poly[j].items()) + key = row, model.mesh.dof_manager.get_node_dofs(target)[2] + exact_work[key] = exact_work.get(key, Fraction(0))-mass + if any(value != area/4 for value in covered): + raise ValueError("rational target-union coverage does not equal the full source face") + support_error = np.asarray([_fraction_upper(abs(value-Fraction(float(stored)))) + for value, stored in zip(exact_support, prepared.support, strict=True)]) + gap_error = np.zeros_like(prepared.gap_map) + for row in range(len(exact_support)): + for column in np.flatnonzero(prepared.gap_map[row]): + gap_error[row, column] = abs(prepared.gap_map[row, column]) + for (row, column), value in exact_work.items(): + gap_error[row, column] = _fraction_upper(abs(value/exact_support[row] + -Fraction(float(prepared.gap_map[row, column])))) + return gap_error, support_error, dict( + kind="exact rational coefficient differences for supplied binary XY coordinates", + source_faces=len(definition.surfaces[0].element_ids), target_faces=len(targets), + clipped_pairs=overlap_count, maximum_normalized_gap_coefficient_error=float(np.max(gap_error)), + maximum_reference_support_error_m2=float(np.max(support_error)), + quadrature_scope="Q1 times P1 degree3; Duffy integrand degree at most4; Gauss4 is exact mathematically") + + +def _same(name, actual, expected): + actual = np.asarray(actual, dtype=float) + expected = np.asarray(expected, dtype=float) + if (actual.shape != expected.shape or not np.all(np.isfinite(actual)) + or not np.allclose(actual, expected, rtol=1e-12, atol=0.0)): + raise ValueError(f"saved radial fixture identity mismatch: {name}") + + +def _identity(reference, metadata, saved): + for name, expected in EXPECTED.items(): + if name not in metadata or name not in saved: + raise ValueError(f"missing saved radial fixture identity: {name}") + _same(name, metadata[name], expected) + _same(name, saved[name], metadata[name]) + for name, actual in (("source_guided_shear_n_m", reference.ds), + ("target_guided_shear_n_m", reference.dt), + ("gap_m", reference.gap_m), + ("exact_force_n", reference.force_n)): + _same(name, actual, metadata[name]) + _same("radial source load", reference.load_pa, .08) + _same("radial radii", (reference.radius_m, reference.contact_radius_m), (1., .35)) + + +@dataclass(frozen=True) +class _Prepared: + stiffness: object + transform: np.ndarray + free_map: np.ndarray + controls: np.ndarray + source_ids: tuple + support: np.ndarray + gap_map: np.ndarray + area: float + + +def _prepare(model, definition, program, reference): + if (len(definition.surfaces) != 2 or definition.surfaces[0].side != "bottom" + or definition.surfaces[1].side != "top"): + raise ValueError("saved radial assessment requires bottom/top parallel skins") + ids = [sorted({n for e in side.element_ids + for n in model.mesh.elements[e].node_ids}) for side in definition.surfaces] + if (len(ids[0]) != 169 or len(ids[1]) != 169 + or len(definition.surfaces[0].element_ids) != 144 + or len(definition.surfaces[1].element_ids) != 288): + raise ValueError("saved radial assessment requires the same 12/12 mesh") + target_xy = np.asarray([(model.mesh.nodes[n].x, model.mesh.nodes[n].y) for n in ids[1]]) + _same("target geometry extrema", (np.min(target_xy[:, 1]), np.max(target_xy[:, 0])), + (-.113, 1.297)) + heights = [] + for side_index, side in enumerate(definition.surfaces): + local_heights = [] + for element_id in side.element_ids: + element = model.mesh.elements[element_id] + normal = np.array(element.reference_normal, dtype=float, copy=True) + normal /= np.linalg.norm(normal) + if not np.allclose(normal, (0., 0., 1.), rtol=0., atol=1e-12): + raise ValueError("linear assessment requires flat upward reference skins") + offset = (-.5*element.thickness if side_index == 0 else + .5*element.thickness-element.reference_surface_offset) + local_heights.extend(model.mesh.nodes[n].z+offset for n in element.node_ids) + material = model.materials[element.material_name] + raw_shear = (5./6.)*element.thickness*material.shear_modulus + if side_index == 0: + _same("actual source guided shear", raw_shear, reference.ds) + if side_index == 1: + component = element.compute_stiffness_components( + model.mesh, material) + _same("actual target phi", component["phi_squared"], + EXPECTED["target_phi_squared_range"][0]) + _same("actual target guided shear", component["phi_squared"]*raw_shear, reference.dt) + if np.ptp(local_heights) > 1e-12: + raise ValueError("linear assessment requires constant reference skin heights") + heights.append(local_heights[0]) + if abs(heights[0]-heights[1]-reference.gap_m) > 1e-12: + raise ValueError("actual parallel-skin reference gap differs from saved fixture") + model.apply_boundary_conditions() + stiffness, _ = assemble_stiffness_matrix(model) + size = model.mesh.dof_manager.total_dofs + _, _, transform, offset, _, _ = build_constraint_transformation(stiffness, np.zeros(size), model) + if np.any(offset): + raise ValueError("saved linear assessment requires homogeneous structural constraints") + transform = transform.toarray() + normal_dofs = [model.mesh.dof_manager.get_node_dofs(n)[2] for side in ids for n in side] + others = np.ones(size, dtype=bool) + others[normal_dofs] = False + if np.any(transform[others]): + raise ValueError("linear assessment requires fixed XY and directors on both bodies") + controls = np.zeros((len(program.controls), size)) + if len(program.controls) != 2: + raise ValueError("linear assessment requires both body trace controls") + for row, control in enumerate(program.controls): + for node, name, coefficient in control.terms: + if name != "uz": + raise ValueError("linear assessment requires normal controls") + controls[row, model.mesh.dof_manager.get_node_dofs(node)[2]] += coefficient + reduced_controls = controls @ transform + if np.linalg.matrix_rank(reduced_controls) != 2: + raise ValueError("linear assessment requires independent body trace controls") + null = linalg.null_space(reduced_controls) + free_map = transform @ null + # This checks the original full joint normal space, not source-only work. + if (free_map.shape[1] != 242 or transform.shape[1] != 244 + or not all(np.any(free_map[np.asarray([ + model.mesh.dof_manager.get_node_dofs(n)[2] for n in side])]) for side in ids)): + raise ValueError("saved radial joint normal free/control span changed") + source_ids, support, work, area = independent_gap_work(model, definition, 0.) + if abs(area-1.) > 1e-12: + raise ValueError("saved radial independent contact footprint changed") + return _Prepared(stiffness, transform, free_map, controls, + source_ids, support, work/support[:, None], area) + + +def _samples(model, definition, displacement): + result = [] + for point in POINTS: + values = [] + for side_index, side in enumerate(definition.surfaces): + matches = [] + for element_id in side.element_ids: + nodes = tuple(model.mesh.elements[element_id].node_ids) + xy = np.asarray([(model.mesh.nodes[n].x, model.mesh.nodes[n].y) for n in nodes]) + shape = (_source_shape(np.asarray(point), xy) if side_index == 0 else + _target_shape(np.asarray(point), xy)) + if np.min(shape) >= -1e-12 and np.max(shape) <= 1.+1e-12: + uz = np.asarray([displacement[model.mesh.dof_manager.get_node_dofs(n)[2]] + for n in nodes]) + matches.append(float(shape @ uz)) + if not matches or np.ptp(matches) > 1e-12: + raise ValueError("saved radial sample is uncovered or not continuous") + values.append(matches[0]) + result.append({"xy_m": list(point), "source_uz_m": values[0], "target_uz_m": values[1]}) + return result + + +def _observables(model, prepared, z): + positions = [(model.mesh.nodes[n].x, model.mesh.nodes[n].y) for n in prepared.source_ids] + xs, ys = sorted({p[0] for p in positions}), sorted({p[1] for p in positions}) + if len(xs)*len(ys) != len(positions): + raise ValueError("reference pressure requires a complete Q1 tensor grid") + pressure = np.zeros((len(ys), len(xs))) + for (x, y), value in zip(positions, z/prepared.support, strict=True): + pressure[ys.index(y), xs.index(x)] = value + return {"source_x_nodes_m": xs, "source_y_nodes_m": ys, + "nodal_reference_pressure_pa": pressure.tolist(), + **asdict(q1_reference_pressure_observables(xs, ys, pressure))} + + +def _checked_inverse(matrix): + count = len(matrix) + if count > MAXIMUM_CORRECTION_DIMENSION or not np.all(np.isfinite(matrix)): + raise ValueError("active correction exceeds the finite dimension budget") + with warnings.catch_warnings(): + warnings.simplefilter("error", linalg.LinAlgWarning) + factor = linalg.lu_factor(matrix) + inverse = linalg.lu_solve(factor, np.eye(count)) + residual = np.abs(np.eye(count)-matrix @ inverse) + residual += _gamma(2*count+2)*(np.abs(matrix) @ np.abs(inverse)+np.eye(count)) + rho = _up(float(np.max(np.sum(residual, axis=1)))*(1.+_gamma(count))) + if not np.isfinite(rho) or rho >= .01: + raise ValueError("active KKT inverse residual is unresolved") + row_norm = np.sum(np.abs(inverse), axis=1)*(1.+_gamma(count)) + inverse_norm = _up(float(np.max(row_norm))/(1.-rho)) + return factor, inverse, rho, inverse_norm + + +def _coefficient_perturbation_envelope(base, eta): + # e <= b + |A^-1 E| e only bounds ||e|| by max(b)/(1-eta). + # Each component must allow transfer from the largest component of b. + return base+eta*float(np.max(base, initial=0.))/(1.-eta) + + +def _fixed_active_correction(prepared, u, z, external, targets, reference, gap_error): + active = z > 0. + reduced_controls = prepared.controls @ prepared.transform + coordinates = linalg.lstsq(prepared.transform, u)[0] + coordinates += reduced_controls.T @ np.linalg.solve( + reduced_controls @ reduced_controls.T, targets-reduced_controls @ coordinates) + base = prepared.transform @ coordinates + free = prepared.free_map + stiffness = prepared.stiffness + k = np.asarray(free.T @ stiffness @ free) + g = prepared.gap_map @ free + count, modes = k.shape[0], int(np.count_nonzero(active)) + matrix = np.block([[k*reference.gap_m/reference.load_pa, -g[active].T], + [g[active], np.zeros((modes, modes))]]) + factor, inverse, rho, inverse_norm = _checked_inverse(matrix) + stationarity = free.T @ (stiffness @ base-external-prepared.gap_map.T @ z) + active_gap = (reference.gap_m+prepared.gap_map @ base)[active] + rhs = np.r_[stationarity/reference.load_pa, active_gap/reference.gap_m] + delta = linalg.lu_solve(factor, -rhs) + corrected_u = base+free @ (reference.gap_m*delta[:count]) + corrected_z = z.copy() + corrected_z[active] += reference.load_pa*delta[count:] + corrected_stationarity = free.T @ (stiffness @ corrected_u-external-prepared.gap_map.T @ corrected_z) + corrected_gap = reference.gap_m+prepared.gap_map @ corrected_u + # Bounds below treat admitted structural K and basis floats as the frozen + # operator. Exact G/support audit supplies contact coefficient allowances. + size = len(u) + absolute_free = np.abs(free) + k_product = np.asarray(absolute_free.T @ abs(stiffness) @ absolute_free) + g_product = np.abs(prepared.gap_map) @ absolute_free + k_error = _gamma(4*size)*k_product + g_error = gap_error @ absolute_free+_gamma(2*size)*g_product + coefficient_error = np.block([[k_error*reference.gap_m/reference.load_pa, g_error[active].T], + [g_error[active], np.zeros((modes, modes))]]) + coefficient_norm = _up(float(np.max(np.sum(coefficient_error, axis=1)))*(1.+_gamma(count+modes))) + perturbation = _up(inverse_norm*coefficient_norm) + if not np.isfinite(perturbation) or perturbation >= .1: + raise ValueError("active KKT coefficient uncertainty is unresolved") + magnitude = (abs(stiffness) @ np.abs(corrected_u)+np.abs(external) + +np.abs(prepared.gap_map).T @ np.abs(corrected_z)) + force_error = (_gamma(4*size)*magnitude+gap_error.T @ np.abs(corrected_z)) + stationarity_error = (absolute_free.T @ force_error + +_gamma(2*size)*(absolute_free.T @ magnitude)) + gap_evaluation_error = (gap_error @ np.abs(corrected_u) + +_gamma(2*size+2)*(abs(reference.gap_m)+np.abs(prepared.gap_map) @ np.abs(corrected_u))) + residual_upper = np.r_[ + (np.abs(corrected_stationarity)+stationarity_error)/reference.load_pa, + (np.abs(corrected_gap[active])+gap_evaluation_error[active])/reference.gap_m] + # A^-1=B(I-R)^-1, ||R|| 1e-8: + raise ValueError("active correction remaining residual exceeds its verification budget") + return corrected_u, corrected_z, u_error, z_error, dict( + active_modes=modes, scaled_kkt_dimension=count+modes, + maximum_dimension=MAXIMUM_CORRECTION_DIMENSION, + inverse_residual_infinity_bound=rho, inverse_norm_infinity_bound=inverse_norm, + scaled_condition_infinity_estimate=float(np.linalg.norm(matrix, np.inf)*np.linalg.norm(inverse, np.inf)), + coefficient_perturbation_bound=perturbation, + scaled_remaining_residual_infinity=float(np.max(abs(scaled_residual), initial=0.)), + maximum_active_gap_m=float(np.max(abs(corrected_gap[active]), initial=0.)), + minimum_inactive_gap_margin_m=float(np.min(corrected_gap[~active]-gap_sign_error[~active])) if np.any(~active) else None, + minimum_active_force_margin_n=float(np.min(corrected_z[active]-z_error[active])) if modes else None, + correction_displacement_infinity_m=float(np.max(abs(corrected_u-u), initial=0.)), + correction_force_l1_n=float(np.sum(abs(corrected_z-z))), + remaining_displacement_infinity_m=float(np.max(u_error, initial=0.)), + remaining_nodal_force_l1_n=float(np.sum(z_error)), + branch="original strictly positive z modes only; no active-set changes", + coefficient_perturbation_propagation="b_i + eta*max(b)/(1-eta); includes component coupling", + inactive_gap_propagation="coefficient envelope (abs(G)+gap_error) times displacement envelope", + arithmetic_scope="directed coefficient audit plus gamma floating arithmetic allowances; fixed admitted structural K") + + +def _solution_uncertainty(model, definition, program, reference, prepared, u, z, external, observable): + gap_error, support_error, audit = _audit_gap_coefficients(model, definition, prepared) + corrected_u, corrected_z, u_error, z_error, diagnostics = _fixed_active_correction( + prepared, u, z, external, np.asarray(program.target_at(2)), reference, gap_error) + floor = prepared.support-support_error + if np.any(floor <= 0.): + raise ValueError("reference pressure support uncertainty is unresolved") + # Convert z/support error to the original Q1 pressure field, preserving + # original observed values. Signed nodal changes are bounded in magnitude. + equivalent_z_error = (abs(corrected_z-z)+z_error*prepared.support/floor + +abs(corrected_z)*support_error/floor+_gamma(4)*abs(z)) + equivalent_z_error = np.nextafter(equivalent_z_error*(1.+_gamma(8)), np.inf) + envelope = _observables(model, prepared, equivalent_z_error) + total = envelope["total"] + force = _up(total["force_n"]+total["estimated_absolute_error"][0] + +observable["total"]["estimated_absolute_error"][0]) + bins = [[_up(cell["force_n"]+cell["estimated_absolute_error"][0] + +observable["bins"][j][i]["estimated_absolute_error"][0]) + for i, cell in enumerate(row)] for j, row in enumerate(envelope["bins"])] + moments = [_up(sum(abs(cell["moment_nm"][axis])+cell["estimated_moment_error_nm"][axis] + for row in envelope["bins"] for cell in row) + +observable["total"]["estimated_moment_error_nm"][axis]) for axis in (0, 1)] + [0.] + old_samples = _samples(model, definition, u) + sample_errors = _sample_uncertainties(model, definition, old_samples, corrected_u, u_error) + resultant_error = None + old = observable["total"] + if old["resultant_xy_m"] is not None: + denominator = old["force_n"]-force + if denominator <= 0.: + raise ValueError("moment-equivalent resultant denominator is unresolved") + first_error = [total["first_x_nm"]+total["estimated_absolute_error"][1]+old["estimated_absolute_error"][1], + total["first_y_nm"]+total["estimated_absolute_error"][2]+old["estimated_absolute_error"][2]] + resultant_error = _up(float(np.linalg.norm([ + (e+abs(r)*force)/denominator for e, r in zip(first_error, old["resultant_xy_m"], strict=True)]))) + return dict(assessed=True, diagnostics=diagnostics, coefficient_audit=audit, + force_solution_uncertainty_n=force, bin_solution_uncertainty_n=bins, + moment_solution_uncertainty_nm=moments, resultant_solution_uncertainty_m=resultant_error, + sample_uncertainty_m=sample_errors) + + +def _sample_uncertainties(model, definition, old_samples, corrected_u, u_error): + """Exact frozen-cell basis audit includes sample interpolation rounding.""" + result = [] + for side_index, side in enumerate(definition.surfaces): + errors = [] + for sample in old_samples: + point = tuple(Fraction(float(v)) for v in sample["xy_m"]) + matches = [] + for element_id in side.element_ids: + nodes = tuple(model.mesh.elements[element_id].node_ids) + xy = [tuple(Fraction(float(v)) for v in (model.mesh.nodes[n].x, model.mesh.nodes[n].y)) for n in nodes] + if side_index == 0: + xi = (point[0]-xy[0][0])/(xy[1][0]-xy[0][0]) + eta = (point[1]-xy[0][1])/(xy[3][1]-xy[0][1]) + shape = ((1-xi)*(1-eta), xi*(1-eta), xi*eta, (1-xi)*eta) + else: + shape = tuple(sum(c*point[0]**p[0]*point[1]**p[1] for p, c in poly.items()) + for poly in _target_polynomials(xy)) + if min(shape) < 0 or max(shape) > 1: + continue + dofs = [model.mesh.dof_manager.get_node_dofs(n)[2] for n in nodes] + corrected = sum(w*Fraction(float(corrected_u[d])) for w, d in zip(shape, dofs, strict=True)) + envelope = sum(abs(w)*Fraction(float(u_error[d])) for w, d in zip(shape, dofs, strict=True)) + old = Fraction(float(sample["source_uz_m" if side_index == 0 else "target_uz_m"])) + matches.append(abs(old-corrected)+envelope) + if not matches: + raise ValueError("rational sample basis is uncovered") + errors.append(_fraction_upper(max(matches))) + result.append(errors) + return result + + +def assess_saved_radial_linear(model, definition, program, reference, fixture_metadata, saved_record): + """Evaluate saved steps using the original linear KKT gates, without solving. + + Legacy QP records store z in independent sorted source-node order; an + explicit source_node_ids field, when present, must match that order. + Missing/nonfinite states or changed fixture identity are rejected. + """ + _identity(reference, fixture_metadata, saved_record) + rows = saved_record.get("steps") + if not isinstance(rows, list) or [r.get("step") for r in rows] != [1, 2]: + raise ValueError("saved assessment requires complete steps 1 and 2") + prepared = _prepare(model, definition, program, reference) + if ("source_node_ids" in saved_record + and tuple(saved_record["source_node_ids"]) != prepared.source_ids): + raise ValueError("saved nodal-force order differs from independent source IDs") + size = model.mesh.dof_manager.total_dofs + records = [] + for row in rows: + if "displacements" not in row or "nodal_force_n" not in row: + raise ValueError("missing saved displacement or nodal-force state") + u, z = np.asarray(row["displacements"], dtype=float), np.asarray(row["nodal_force_n"], dtype=float) + if (u.shape != (size,) or z.shape != prepared.support.shape + or not np.all(np.isfinite(u)) or not np.all(np.isfinite(z))): + raise ValueError("saved state dimensions or finite values are invalid") + external = np.zeros(size) + for force, value in zip(program.nodal_forces, program.force_values_at(row["step"]), strict=True): + if force.dof != "uz" or not np.isfinite(value): + raise ValueError("saved radial assessment requires finite normal nodal loads") + external[model.mesh.dof_manager.get_node_dofs(force.node_id)[2]] += value + residual = prepared.stiffness @ u-external-prepared.gap_map.T @ z + coordinates = linalg.lstsq(prepared.transform, u)[0] + constraint = u-prepared.transform @ coordinates + control_error = prepared.controls @ u-np.asarray(program.target_at(row["step"])) + reduced_controls = prepared.controls @ prepared.transform + reduced_residual = prepared.transform.T @ residual + reactions = np.linalg.solve(reduced_controls @ reduced_controls.T, + reduced_controls @ reduced_residual) + free_residual = prepared.free_map.T @ residual + span_residual = reduced_residual-reduced_controls.T @ reactions + gap = reference.gap_m+prepared.gap_map @ u + ncp = z-np.maximum(0., z-definition.interactions[0].normal_stiffness*prepared.support*gap) + eq = float(np.linalg.norm(free_residual)/reference.load_pa) + ncp_relative = float(np.sum(abs(ncp))/reference.load_pa) + structural_error = float(np.max(abs(constraint), initial=0.)/reference.gap_m) + prescribed_error = float(np.max(abs(control_error), initial=0.)/reference.gap_m) + minimum_gap = float(np.min(gap)) + nonnegative = bool(np.all(z >= 0.)) + passed = (eq <= 1e-6 and ncp_relative <= 1e-8 and structural_error <= 1e-6 + and prescribed_error <= 1e-6 and nonnegative + and minimum_gap/reference.gap_m >= -1e-6) + samples = _samples(model, definition, u) + for sample in samples: + sample["parallel_skin_gap_m"] = reference.gap_m+sample["source_uz_m"]-sample["target_uz_m"] + records.append(dict(step=row["step"], kkt_passed=passed, + equilibrium_relative_force=eq, equilibrium_residual_n=float(np.linalg.norm(free_residual)), + control_span_stationarity_relative_force=float(np.linalg.norm(span_residual)/reference.load_pa), + structural_constraint_relative_gap=structural_error, control_constraint_relative_gap=prescribed_error, + complementarity_relative_force=ncp_relative, minimum_normalized_gap_m=minimum_gap, + minimum_gap_relative_reference=minimum_gap/reference.gap_m, + minimum_nodal_force_n=float(np.min(z)), nonnegative_nodal_force=nonnegative, + nodal_force_n=z.tolist(), normalized_gap_m=gap.tolist(), + contact_force_n=float(np.sum(z)), control_reaction_n=reactions.tolist(), + samples=samples)) + observable = _observables(model, prepared, np.asarray(records[-1]["nodal_force_n"])) + samples = records[-1]["samples"] + final = dict(force_n=observable["total"]["force_n"], + bins_n=[[cell["force_n"] for cell in row] for row in observable["bins"]], + bin_estimated_error_n=[[cell["estimated_absolute_error"][0] for cell in row] + for row in observable["bins"]], + moment_about_origin_nm=observable["total"]["moment_nm"], + moment_estimated_error_nm=observable["total"]["estimated_moment_error_nm"], + moment_equivalent_resultant_xy_m=observable["total"]["resultant_xy_m"], + source_samples=[dict(x_m=sample["xy_m"][0], y_m=sample["xy_m"][1], + uz_m=sample["source_uz_m"]) for sample in samples], + target_samples=[dict(x_m=sample["xy_m"][0], y_m=sample["xy_m"][1], + uz_m=sample["target_uz_m"]) for sample in samples]) + solution = dict(assessed=False, reason="original saved KKT checks failed") + if all(row["kkt_passed"] for row in records): + try: + solution = _solution_uncertainty(model, definition, program, reference, + prepared, u, z, external, observable) + except (ValueError, linalg.LinAlgError, linalg.LinAlgWarning) as exc: + solution = dict(assessed=False, reason=str(exc)) + final.update({name: solution.get(name) for name in ( + "force_solution_uncertainty_n", "bin_solution_uncertainty_n", + "moment_solution_uncertainty_nm", "resultant_solution_uncertainty_m")}) + for side, index in (("source", 0), ("target", 1)): + for sample_index, sample in enumerate(final[side+"_samples"]): + sample["solution_uncertainty_m"] = (solution["sample_uncertainty_m"][index][sample_index] + if solution["assessed"] else None) + output = dict(**fixture_metadata, scope=SCOPE, fixture_metadata=dict(fixture_metadata), + kkt_passed=all(row["kkt_passed"] for row in records), steps=records, + rows=records, development_checks_met=all(row["kkt_passed"] for row in records) and solution["assessed"], + solution_uncertainty_assessed=solution["assessed"], solution_uncertainty=solution, + final_observables=final, + source_node_ids=list(prepared.source_ids), + independent_reference_support_m2=prepared.support.tolist(), + nodal_force_order="independent sorted source node IDs", + saved_order_identity="explicit" if "source_node_ids" in saved_record else "legacy QP writer contract", + independent_overlap_area_m2=prepared.area, + joint_normal_free_dimensions=prepared.free_map.shape[1], + joint_normal_control_dimensions=prepared.controls.shape[0], + gates=dict(equilibrium_relative_force=1e-6, complementarity_relative_force=1e-8, + constraint_relative_reference_gap=1e-6, gap_relative_reference=1e-6, + nodal_force_minimum_n=0.), + final_reference_pressure_observables=observable) + # Reject overflow and nonfinite scalar diagnostics rather than encoding NaN. + json.dumps(output, allow_nan=False) + return output diff --git a/tests/fixtures/d1_two_body_displacement_compare.py b/tests/fixtures/d1_two_body_displacement_compare.py new file mode 100644 index 000000000..24e483249 --- /dev/null +++ b/tests/fixtures/d1_two_body_displacement_compare.py @@ -0,0 +1,146 @@ +"""Bounded ordinary-displacement free-target solve versus independent Q1/S3 KKT.""" + +import hashlib +import json +import platform +import subprocess +import sys +import time +from dataclasses import replace +from pathlib import Path + +import numpy as np +import anyfesolver + +from anyfesolver import solve_static_nonlinear +from anyfesolver.boundary import BoundaryCondition +from anyfesolver.general_contact.s3_patch_static import GeneralS3PatchManager +from anyfesolver.general_contact.semismooth import linearize +from anyfesolver.nonlinear_static import DisplacementControl +from scripts.general_contact_d1_free_target_press_probe import build_free_target_case + +from d1_two_body_displacement_oracle import solve_displacement_reference + + +def case(): + model, definition, settings, _program = build_free_target_case( + 4, steps_per_segment=2, four_phase=True, + enforcement_solver="monolithic_active_set") + model.add_boundary_condition(BoundaryCondition( + "source_x_support", (1, 6), {"ux": 0.0})) + settings = replace(settings, complementarity_force_scale_n=0.01) + control = DisplacementControl( + node_id=5, dof="uz", target_displacement=-8.0e-5) + return model, definition, settings, control + + +started = time.perf_counter() +model, definition, settings, control = case() +oracle = solve_displacement_reference(model, definition, control) +oracle_seconds = time.perf_counter()-started +production_model, production_definition, production_settings, production_control = case() +production = solve_static_nonlinear( + production_model, control="displacement", + displacement_control=production_control, num_steps=4, + contact=production_definition, contact_settings=production_settings, + max_iterations=18, emit_restart_checkpoint=True) +assert production.status == "completed", production.failure_reason +contact = production.info["general_contact"] +production_pressure = np.asarray(contact["numerical_pressure_pa"]) +production_support = np.asarray(contact["reference_support_m2"]) +production_gap = np.asarray(contact["normalized_weighted_gap_m"]) +assert tuple(contact["source_pressure_node_ids"]) == oracle["source_pressure_nodes"] +manager = GeneralS3PatchManager(production_model, production_definition, + production_settings) +mapped = linearize(manager, production.displacements, + production_pressure*production_support, tangent=False) +production_work = float(-mapped.force @ production.displacements) +target_ids = sorted({node for element_id in definition.surfaces[1].element_ids + for node in model.mesh.elements[element_id].node_ids}) +target_translation = [model.mesh.dof_manager.get_node_dofs(node)[:3] + for node in target_ids] +target_rotation = [model.mesh.dof_manager.get_node_dofs(node)[3:6] + for node in target_ids] +target_translation = np.asarray(target_translation).ravel() +target_rotation = np.asarray(target_rotation).ravel() +source_ids = sorted({node for element_id in definition.surfaces[0].element_ids + for node in model.mesh.elements[element_id].node_ids}) +source_inplane = np.asarray([ + model.mesh.dof_manager.get_node_dofs(node)[axis] + for node in source_ids for axis in (0, 1)]) +control_reaction = float(production.info[ + "force_displacement_history"][-1]["reaction_generalized"][0]) +def _checkout_commit(project_root): + try: + top = subprocess.check_output(("git", "rev-parse", "--show-toplevel"), + cwd=project_root, text=True, stderr=subprocess.DEVNULL).strip() + if Path(top).resolve() != project_root.resolve(): + return None + return subprocess.check_output(("git", "rev-parse", "HEAD"), + cwd=project_root, text=True, stderr=subprocess.DEVNULL).strip() + except (OSError, subprocess.CalledProcessError): + return None + +record = { + "status": "development_free_target_ordinary_displacement_oracle", + "source_commit": _checkout_commit(Path(__file__).resolve().parents[2]), + "command": "python tests/fixtures/d1_two_body_displacement_compare.py", + "python": sys.version.split()[0], + "platform": platform.platform(), + "anyfesolver_module": str(Path(anyfesolver.__file__).resolve()), + "oracle_source_sha256": hashlib.sha256(Path( + "tests/fixtures/d1_two_body_displacement_oracle.py" + ).read_bytes()).hexdigest(), + "reference_oracle_source_sha256": hashlib.sha256(Path( + "scripts/d1_reference_gap_work.py" + ).read_bytes()).hexdigest(), + "production_status": production.status, + "accepted_steps": len(production.steps), + "has_checkpoint": production.restart_checkpoint is not None, + "oracle_seconds": oracle_seconds, + "complete_elapsed_seconds": time.perf_counter()-started, + "oracle_active_modes": int(np.count_nonzero(oracle["pressure"] > 0)), + "production_active_modes": int(np.count_nonzero(production_pressure > 0)), + "minimum_independent_gap_m": float(contact["minimum_gap"]), + "gap_tolerance_met": bool(contact["gap_tolerance_met"]), + "source_target_vertical_force_balance_n": float( + contact["integration_force"][2]+contact["target_force"][2]), + "control_uz_m": float(production.displacements[ + model.mesh.dof_manager.get_node_dofs(control.node_id)[2]]), + "oracle_integrated_force_n": oracle["integrated_force"], + "production_integrated_force_n": float(contact["integration_force"][2]), + "integrated_force_relative_error": float( + abs(contact["integration_force"][2]-oracle["integrated_force"]) + /abs(oracle["integrated_force"])), + "pressure_relative_l2_error": float( + np.linalg.norm(production_pressure-oracle["pressure"]) + /np.linalg.norm(oracle["pressure"])), + "support_relative_l2_error": float( + np.linalg.norm(production_support-oracle["support"]) + /np.linalg.norm(oracle["support"])), + "maximum_gap_difference_at_production_pose_m": float(np.max(abs( + production_gap-(oracle["reference_gap"] + +oracle["weighted_gap_work"] + @ production.displacements/oracle["support"])))), + "oracle_control_reaction_n": oracle["control_reaction"], + "production_control_reaction_n": control_reaction, + "control_reaction_relative_error": float( + abs(control_reaction+oracle["control_reaction"]) + /abs(oracle["control_reaction"])), + "oracle_endpoint_contact_force_displacement_pairing_j": oracle[ + "endpoint_contact_force_displacement_pairing"], + "production_endpoint_contact_force_displacement_pairing_j": production_work, + "endpoint_pairing_relative_error": float( + abs(production_work-oracle[ + "endpoint_contact_force_displacement_pairing"]) + /abs(oracle["endpoint_contact_force_displacement_pairing"])), + "target_translation_max_difference_m": float(np.max(abs( + production.displacements[target_translation] + -oracle["displacement"][target_translation]))), + "target_rotation_max_difference_rad": float(np.max(abs( + production.displacements[target_rotation] + -oracle["displacement"][target_rotation]))), + "source_inplane_max_m": float(np.max( + abs(production.displacements[source_inplane]))), +} +print(json.dumps(record, indent=2)) diff --git a/tests/fixtures/d1_two_body_displacement_oracle.py b/tests/fixtures/d1_two_body_displacement_oracle.py new file mode 100644 index 000000000..98868360a --- /dev/null +++ b/tests/fixtures/d1_two_body_displacement_oracle.py @@ -0,0 +1,88 @@ +"""Independent small-motion Q1/S3 KKT oracle for prescribed source deflection.""" + +from __future__ import annotations + +import numpy as np + +from anyfesolver.assembly import build_constraint_transformation +from anyfesolver.matrix_assembly import assemble_stiffness_matrix + +from scripts.d1_reference_gap_work import independent_gap_work + + +def solve_displacement_reference(model, definition, control): + model.apply_boundary_conditions() + stiffness, _ = assemble_stiffness_matrix(model) + ndof = model.mesh.dof_manager.total_dofs + _, _, transform, offset, _, _ = build_constraint_transformation( + stiffness, np.zeros(ndof), model) + assert np.linalg.norm(offset) == 0.0 + ids, support, gap_work, area = independent_gap_work( + model, definition, 0.0) + source = model.mesh.elements[definition.surfaces[0].element_ids[0]] + target = model.mesh.elements[definition.surfaces[1].element_ids[0]] + source_node = model.mesh.nodes[source.node_ids[0]] + target_node = model.mesh.nodes[target.node_ids[0]] + reference_gap = ( + source_node.z-0.5*source.thickness + -target_node.z-0.5*target.thickness + +target.reference_surface_offset) + assert abs(reference_gap-40e-6) < 1e-12 + assert control.dof == "uz" + control_row = np.zeros(ndof) + control_dof = model.mesh.dof_manager.get_node_dofs(control.node_id)[2] + control_row[control_dof] = 1.0 + k = (transform.T @ stiffness @ transform).toarray() + g = np.asarray(gap_work @ transform) + c = np.asarray(control_row @ transform).reshape(1, -1) + + def equilibrate(active): + selected = np.flatnonzero(active) + ga = g[selected] + size = k.shape[0] + matrix = np.block([ + [k, -ga.T, c.T], + [ga, np.zeros((len(selected), len(selected))), + np.zeros((len(selected), 1))], + [c, np.zeros((1, len(selected))), np.zeros((1, 1))], + ]) + rhs = np.r_[np.zeros(size), -reference_gap*support[selected], + control.target_displacement] + solved = np.linalg.solve(matrix, rhs) + pressure = np.zeros(len(support)) + pressure[selected] = solved[size:size+len(selected)] + return solved[:size], pressure, float(solved[-1]) + + active = np.zeros(len(support), dtype=bool) + for iteration in range(30): + coordinates, pressure, control_reaction = equilibrate(active) + normalized_gap = reference_gap+(g @ coordinates)/support + updated = (pressure-definition.interactions[0].normal_stiffness + *normalized_gap) > 0.0 + if np.array_equal(updated, active): + break + active = updated + else: + raise RuntimeError("independent displacement active set did not converge") + equilibrium = k @ coordinates-g.T @ pressure+c.T.ravel()*control_reaction + assert np.linalg.norm(equilibrium) < 1e-9 + assert np.min(pressure) >= -1e-10 + assert np.min(normalized_gap) >= -1e-10 + assert np.max(abs(pressure*normalized_gap)) < 1e-10 + pose = np.asarray(transform @ coordinates).reshape(-1) + contact_force = gap_work.T @ pressure + return { + "displacement": pose, + "pressure": pressure, + "support": support, + "weighted_gap_work": gap_work, + "reference_gap": reference_gap, + "normalized_gap": normalized_gap, + "source_pressure_nodes": ids, + "area": area, + "integrated_force": float(support @ pressure), + "control_reaction": control_reaction, + "endpoint_contact_force_displacement_pairing": float( + contact_force @ pose), + "active_set_iterations": iteration+1, + } diff --git a/tests/fixtures/reference_cases/ge_beam3_exact_inertia_benchmark.py b/tests/fixtures/reference_cases/ge_beam3_exact_inertia_benchmark.py new file mode 100644 index 000000000..d66000803 --- /dev/null +++ b/tests/fixtures/reference_cases/ge_beam3_exact_inertia_benchmark.py @@ -0,0 +1,73 @@ +"""Bounded arithmetic-only comparison on a preserved native spectral packet.""" +from hashlib import sha256 +from functools import partial +import json +import os +from pathlib import Path +import statistics +import sys +import time +from docs.reference_cases.ge_beam3_fibre_arch_probe import guard, THREAD_ENVIRONMENT +from docs.reference_cases.ge_beam3_preserved_arch_load_comparison import canonical + +ROOT=Path(__file__).resolve().parents[3] +INPUT=Path('C:/Users/AudunArnesenNyhus/AppData/Local/ANYrelease/ge-beam3-loaded-spectra-20260907-v1/native-1.json') +INPUT_SHA='4519178585b0ba921559bf161a5bea4425a4f069f51f7f07a306edac303204c8' +SIX_INPUT=INPUT.parent.parent/'ge-beam3-loaded-six-20260907-v1/native-1.json' +SIX_SHA='613e1170278556a5c4f07348c5fc1cff5a6433c8672bbf25ddc3fad00ed82277' + + +def deadline_check(start, stage=None): + if time.monotonic()-start>120.: raise TimeoutError('arithmetic comparison deadline') + + +def worker(revision, output, case_id='four'): + guard(revision) + if case_id not in ('four','six'): raise ValueError('registered arithmetic case required') + if any(os.environ.get(k)!=v for k,v in THREAD_ENVIRONMENT.items()): raise ValueError('one thread') + path,size,digest,dimension=(INPUT,210271,INPUT_SHA,45) if case_id=='four' else (SIX_INPUT,434444,SIX_SHA,69) + raw=path.read_bytes() + if len(raw)!=size or sha256(raw).hexdigest()!=digest: raise ValueError('saved packet changed') + sys.path.insert(0,str(ROOT/'src')) + import runpy + import numpy as np + from anyfesolver._native_exact_shift_inertia import exact_inertia,integer_inertia + from anyfesolver._native_factor_chain_modes import mm, _reduce, reassemble + if case_id=='four': + oracle=runpy.run_path(str(ROOT/'tests/test_native_fraction_free_inertia.py'))['rational_inertia'] + routines={'rational':oracle,'integer':integer_inertia} + else: + routines={'integer':partial(integer_inertia,dimension_limit=96),'filtered':partial(exact_inertia,dimension_limit=96)} + p=json.loads(raw)['packet']; left,right,g,b=(np.asarray(p[k]) for k in ('left','right','geometric','kinetic')) + start=time.monotonic() + check=partial(deadline_check,start) + print('REASSEMBLY',flush=True) + _,_,mapping=_reduce(mm(left,right,check),g,b.T@b,tuple(p['free']),tuple(p['algebraic']),check,b) + h,m=reassemble(left,right,g,b,mapping,check) + if h.shape!=(dimension,dimension): raise ValueError('saved arithmetic pencil dimension') + shift=float(json.loads(raw)['modes']['numerical_brackets'][-1][0]) + names=tuple(routines); timings={name:[] for name in names}; answers={} + for repetition in range(12): # one warm-up plus eleven paired repetitions + order=names if repetition%2==0 else names[::-1] + for name in order: + check(); wall=time.perf_counter(); cpu=time.process_time() + answer=routines[name](h,m,shift) + duration=time.perf_counter()-wall; cpu=time.process_time()-cpu + check() + if name in answers and answers[name]!=answer: raise ValueError('nondeterministic inertia') + answers[name]=answer + if repetition: timings[name].append(dict(wall=duration,cpu=cpu)) + if answers[names[0]]!=answers[names[1]]: raise ValueError('exact arithmetic disagreement') + print(f'PAIR {repetition} inertia={answer}',flush=True) + summary={} + for name,records in timings.items(): + values=[r['wall'] for r in records]; median=statistics.median(values) + summary[name]=dict(median=median,mad=statistics.median(abs(x-median) for x in values), + p95=float(np.percentile(values,95))) + value=dict(schema='GE_BEAM3_EXACT_INERTIA_ARITHMETIC_DIAGNOSTIC_V1' if case_id=='four' else 'GE_BEAM3_DYADIC_INERTIA_ARITHMETIC_DIAGNOSTIC_V1',revision=revision, + input_sha256=digest,dimension=dimension,shift=shift,inertia=list(answers[names[0]]), + equal=True,warmup_pairs=1,timed_pairs=11,timings=timings,summary=summary, + mechanics_changed=False,root_width_changed=False,production_qualified=False) + guard(revision) + if path.read_bytes()!=raw: raise ValueError('saved packet changed after comparison') + with (output/'benchmark.pending.json').open('xb') as stream: stream.write(canonical(value)) diff --git a/tests/fixtures/reference_cases/ge_beam3_plastic_cell_conjugate_probe.py b/tests/fixtures/reference_cases/ge_beam3_plastic_cell_conjugate_probe.py new file mode 100644 index 000000000..98311f249 --- /dev/null +++ b/tests/fixtures/reference_cases/ge_beam3_plastic_cell_conjugate_probe.py @@ -0,0 +1,119 @@ +"""Bounded research conjugate of the integrated directed-hardening cell. + +Retains the existing shared cell strain, quadrature and moment interpolation. +Plastic station increments solve a convex piecewise-quadratic problem. +No native history commit, public routing, tolerance relaxation or retry. +""" +from dataclasses import dataclass +from time import monotonic +import numpy as np +from anyfesolver._ge_beam3_centered_mixed import CenteredStationaryBeam +from anyfesolver._ge_beam3_p5.section import SectionHistory, _history +from anyfesolver._native_reference_modal import _owned + + +@dataclass(frozen=True) +class CellResponse: + potential: float + gradient: np.ndarray + hessian: np.ndarray + histories: tuple + increments: np.ndarray + kkt_residual: float + iterations: int + production_qualified: bool = False + + +class PlasticCellConjugate: + def __init__(self, element, origins=None): + core = element.core + if np.any(core.line_force): raise ValueError('cell conjugate contains no external work') + self.source = CenteredStationaryBeam(core.reference, core.section, + position_low=np.zeros((3, 3)), order=core.order) + count = 2*core.order + self.origins = tuple(SectionHistory() for _ in range(count)) if origins is None else tuple(_history(v) for v in origins) + if len(self.origins) != count: raise ValueError('one fixed origin per station required') + self.weights = np.zeros(count) + a = np.zeros((6, 6)); b = np.zeros((6, 12)); s = np.zeros((12, 12)) + dz = np.zeros((6, count)); dm = np.zeros((12, count)) + strain_factor = np.zeros((3*count, 6)); plastic_factor = np.zeros((3*count, count)) + ag = core.section._direction[:3]; ak = core.section._direction[3:] + for cell in (0, 1): + sl = slice(3*cell, 3*cell+3) + for index, t, _, w, v, _, _ in self.source._stations[cell]: + j = cell*core.order+index; self.weights[j] = w + density = core.section.mixed_response(np.zeros(3), np.zeros(3), SectionHistory()) + h = density.hessian + n = np.zeros((3, 12)); n[:, 6*cell:6*cell+3] = (1-t)*np.eye(3) + n[:, 6*cell+3:6*cell+6] = t*np.eye(3) + root = np.sqrt(w)*np.linalg.cholesky(h[:3, :3]).T + strain_factor[3*j:3*j+3, sl] = root@v + plastic_factor[3*j:3*j+3, j] = root@ag + a[sl, sl] += w*v.T@h[:3, :3]@v + b[sl] += w*v.T@h[:3, 3:]@n + s -= w*n.T@h[3:, 3:]@n + dz[sl, j] = w*v.T@h[:3, :3]@ag + dm[:, j] = w*n.T@(h[3:, :3]@ag+ak) + ai = np.linalg.solve(a, np.eye(6)); aib = np.linalg.solve(a, b) + self.c0 = _owned(np.block([[ai, -aib], [-aib.T, s+b.T@aib]])) + self.g = _owned(np.column_stack((dz.T@ai, dm.T-dz.T@aib))) + # Gram representation avoids subtracting two large PSD matrices. + orthogonal, _ = np.linalg.qr(strain_factor, mode='complete') + remainder = orthogonal[:, 6:].T@plastic_factor + self.k = _owned(remainder.T@remainder) + self.q = _owned(self.k+np.diag(self.weights*core.section._hardening)) + np.linalg.cholesky(self.q) + self.z0 = _owned([h.plastic_coordinate for h in self.origins]) + self.radius = _owned(self.weights*(core.section._yield+core.section._hardening*np.array([h.accumulated for h in self.origins]))) + + def response(self, resultants, *, progress=None): + started = monotonic(); p = _owned(resultants) + if p.shape != (18,): raise ValueError('18 retained resultants required') + drive = self.g@p-self.k@self.z0 + delta = np.zeros(len(self.origins)); working = np.zeros(len(delta), dtype=bool) + signs = np.zeros(len(delta)) + for iteration in range(33): + if monotonic()-started > 30: raise ValueError('cell conjugate deadline') + derivative = self.q@delta-drive + active = delta != 0 + error = np.maximum(np.abs(derivative)-self.radius, 0.) + error[active] = np.abs(derivative[active]+self.radius[active]*np.sign(delta[active])) + residual = float(np.max(error)) + if progress is not None: + progress(dict(iteration=iteration, increments=delta.copy(), derivative=derivative.copy(), + kkt_residual=residual)) + if residual <= 1e-11: break + if iteration == 32: raise ValueError('cell conjugate active-set limit') + # Solve within the present orthant before releasing one violated + # zero coordinate. Never jump through a sign boundary: stop at + # the first zero and remove that bound from the working set. + if not np.any(working) or np.max(np.abs(derivative[working]+self.radius[working]*signs[working])) <= 1e-11: + violations = np.maximum(np.abs(derivative)-self.radius, 0.) + violations[working] = 0. + release = int(np.argmax(violations)) + if violations[release] <= 1e-11: raise ValueError('cell conjugate unresolved optimality') + working[release] = True; signs[release] = -np.sign(derivative[release]) + target = np.zeros_like(delta) + block = self.q[np.ix_(working, working)]; scale = np.sqrt(np.diag(block)) + target[working] = np.linalg.solve(block/scale[:, None]/scale[None, :], + (drive[working]-self.radius[working]*signs[working])/scale)/scale + crossing = np.flatnonzero(working & (signs*target <= 0.)) + if len(crossing): + ratios = delta[crossing]/(delta[crossing]-target[crossing]) + hit = int(crossing[np.argmin(ratios)]); alpha = float(np.min(ratios)) + if not 0 <= alpha <= 1 or not np.isfinite(alpha): raise ValueError('invalid cell orthant step') + delta += alpha*(target-delta); delta[hit] = 0. + working[hit] = False; signs[hit] = 0. + else: + delta = target + hessian = self.c0.copy() + if np.any(active): + hessian += self.g[active].T@np.linalg.solve(self.q[np.ix_(active, active)], self.g[active]) + z = self.z0+delta + potential = .5*p@self.c0@p+self.z0@self.g@p-.5*self.z0@self.k@self.z0 + potential += delta@drive-.5*delta@self.q@delta-self.radius@np.abs(delta) + histories = tuple(_history(SectionHistory(float(v), old.accumulated+abs(float(d)))) + for old, v, d in zip(self.origins, z, delta)) + if not np.isfinite(potential): raise ValueError('nonfinite cell conjugate potential') + return CellResponse(float(potential), _owned(self.c0@p+self.g.T@z), _owned(hessian), + histories, _owned(delta), residual, iteration) diff --git a/tests/fixtures/reference_cases/ge_beam3_slender_spectrum_probe.py b/tests/fixtures/reference_cases/ge_beam3_slender_spectrum_probe.py new file mode 100644 index 000000000..373b853a7 --- /dev/null +++ b/tests/fixtures/reference_cases/ge_beam3_slender_spectrum_probe.py @@ -0,0 +1,54 @@ +"""Tiny straight reference modal conditioning diagnostic, not qualification. + +The alternate factor path uses the SAME mechanical factors. It is a numerical +comparison, not an independent mechanics oracle. Do not use it at prestress. +""" + +import numpy as np + +from anyfesolver._ge_beam3_centered_reference import CenteredCurvedBeam3ReferenceGeometry +from anyfesolver._ge_beam3_p5_centered.mass import reference_kinetic_factors +from anyfesolver._native_stationary_spectrum import solve_stationary_spectrum +from anyfesolver._native_reference_factor_spectrum import solve_reference_factor_spectrum + + +def factors(slenderness): + """One straight length-two macro, square section, EI=1, rho*A=1. + + h=2/slenderness, EA=12/h^2, nu=.3, shear coefficient5/6; + rotary inertia h^2/12 about each bending axis. Torsion=2 is an explicit + diagnostic choice, not a claimed square-section Saint-Venant constant. + """ + h = 2./slenderness; ea = 12./h**2; shear = (5./6)*ea/2.6 + section = np.diag([ea, shear, shear, 2., 1., 1.]) + inertia = np.diag([1., 1., 1., h*h/6, h*h/12, h*h/12]) + geometry = CenteredCurvedBeam3ReferenceGeometry( + np.array([[0., 0., 0.], [1., 0., 0.], [2., 0., 0.]]), np.tile(np.eye(3), (3, 1, 1))) + made = reference_kinetic_factors(geometry, section, inertia, order=8) + return made.uncondensed_stiffness_factor, made.full + + +def comparison(slenderness): + elastic, kinetic = factors(slenderness) + free = tuple(range(6, 24)); algebraic = (9, 10, 11, 15, 16, 17) + physical = tuple(i for i in free if i not in algebraic) + q, r = np.linalg.qr(elastic[:, algebraic], mode='reduced') + mapping = np.zeros((24, len(physical))); mapping[list(physical)] = np.eye(len(physical)) + mapping[list(algebraic)] = -np.linalg.solve(r, q.T@elastic[:, physical]) + strain, speed = elastic@mapping, kinetic@mapping + _, mass_r = np.linalg.qr(speed, mode='reduced') + normalized = np.linalg.solve(mass_r.T, strain.T).T + singular = np.linalg.svd(normalized, compute_uv=False) + factor_values = singular[::-1]**2 + made = solve_reference_factor_spectrum(elastic, kinetic, free, algebraic) + result = dict(slenderness=slenderness, factor_squared_frequencies=factor_values[:6], + successor_squared_frequencies=made.eigenvalues, successor_normalized_residual=made.normalized_residual, + production_qualified=False, prestressed_tangent_authorized=False) + try: + dense = solve_stationary_spectrum(elastic.T@elastic, kinetic.T@kinetic, free, algebraic) + result.update(dense_status='returned', dense_squared_frequencies=dense.eigenvalues, + dense_normalized_residual=dense.normalized_residual) + except ValueError as exc: + # Preserve the failure; never turn it into a zero/positive modal result. + result.update(dense_status='failed', dense_error=str(exc)) + return result diff --git a/tests/test_ge_beam3_plastic_cell_conjugate_probe.py b/tests/test_ge_beam3_plastic_cell_conjugate_probe.py index 3a0792c09..3427ae35b 100644 --- a/tests/test_ge_beam3_plastic_cell_conjugate_probe.py +++ b/tests/test_ge_beam3_plastic_cell_conjugate_probe.py @@ -4,7 +4,7 @@ from anyfesolver._ge_beam3_p5_seeded import NativeP5BeamElement from anyfesolver._ge_beam3_p5.section import SectionHistory from anyfesolver._ge_beam3_p5_seeded.core import canonical -from docs.reference_cases.ge_beam3_plastic_cell_conjugate_probe import PlasticCellConjugate +from fixtures.reference_cases.ge_beam3_plastic_cell_conjugate_probe import PlasticCellConjugate from test_ge_beam3_complementary_section import section from test_ge_beam3_curved_contrast_probe import make_curved diff --git a/tests/test_ge_beam3_slender_spectrum_probe.py b/tests/test_ge_beam3_slender_spectrum_probe.py index 676e17919..3d41cce70 100644 --- a/tests/test_ge_beam3_slender_spectrum_probe.py +++ b/tests/test_ge_beam3_slender_spectrum_probe.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from docs.reference_cases.ge_beam3_slender_spectrum_probe import comparison +from fixtures.reference_cases.ge_beam3_slender_spectrum_probe import comparison from anyfesolver._ge_beam3_p5_loads.core import canonical diff --git a/tests/test_general_contact_d1_radial_source_bin_work.py b/tests/test_general_contact_d1_radial_source_bin_work.py index 798f1a9bb..acc3d3445 100644 --- a/tests/test_general_contact_d1_radial_source_bin_work.py +++ b/tests/test_general_contact_d1_radial_source_bin_work.py @@ -5,7 +5,7 @@ import numpy as np import pytest -from docs.d1_review_support.d1_radial_source_bin_work import ( +from scripts.d1_radial_source_bin_work import ( PhysicalSkinFace, check_guided_source_bins, conversion_bound, source_bin_geometry_work, vertical_gap_factor, ) diff --git a/tests/test_general_contact_d1_two_body_displacement_oracle.py b/tests/test_general_contact_d1_two_body_displacement_oracle.py index 48d7d7c8e..53578fc28 100644 --- a/tests/test_general_contact_d1_two_body_displacement_oracle.py +++ b/tests/test_general_contact_d1_two_body_displacement_oracle.py @@ -1,5 +1,6 @@ """Independent small-motion check of ordinary displacement with a free S3 target.""" +import hashlib import json import os import subprocess @@ -11,15 +12,18 @@ def test_free_target_ordinary_displacement_matches_independent_q1_kkt(): root = Path(__file__).resolve().parents[1] environment = os.environ.copy() environment["PYTHONPATH"] = os.pathsep.join(( - str(root / "src"), str(root), str(root / "docs" / "d1_review_support"), + str(root / "src"), str(root), str(root / "packages" / "results" / "src"), )) completed = subprocess.run( - [sys.executable, str(root / "docs" / "d1_review_support" - / "d1_two_body_displacement_compare.py")], + [sys.executable, str(root / "tests" / "fixtures" / "d1_two_body_displacement_compare.py")], cwd=root, env=environment, capture_output=True, text=True, check=True, timeout=120, ) result = json.loads(completed.stdout) + assert Path(result["anyfesolver_module"]).resolve() == (root / "src/anyfesolver/__init__.py").resolve() + for key, path in (("oracle_source_sha256", "tests/fixtures/d1_two_body_displacement_oracle.py"), + ("reference_oracle_source_sha256", "scripts/d1_reference_gap_work.py")): + assert result[key] == hashlib.sha256((root / path).read_bytes()).hexdigest() assert result["production_status"] == "completed" assert result["accepted_steps"] == 4 assert result["has_checkpoint"] diff --git a/tests/test_general_contact_radial_linear_saved_assessment.py b/tests/test_general_contact_radial_linear_saved_assessment.py index e64ab9cb6..4b0e9b21d 100644 --- a/tests/test_general_contact_radial_linear_saved_assessment.py +++ b/tests/test_general_contact_radial_linear_saved_assessment.py @@ -8,7 +8,7 @@ import numpy as np import pytest -from docs.d1_review_support import d1_radial_linear_saved_assessment as assessment +from fixtures import d1_radial_linear_saved_assessment as assessment from docs.d1_review_support.d1_radial_two_body_reference import RadialTwoBodyReference diff --git a/tests/test_native_dyadic_interval_inertia.py b/tests/test_native_dyadic_interval_inertia.py index 706c61489..dd67ed228 100644 --- a/tests/test_native_dyadic_interval_inertia.py +++ b/tests/test_native_dyadic_interval_inertia.py @@ -82,7 +82,7 @@ def test_unchanged_binary64_inputs(): def test_saved_six_benchmark_wiring(tmp_path,monkeypatch): import json - from docs.reference_cases import ge_beam3_exact_inertia_benchmark as bench + from fixtures.reference_cases import ge_beam3_exact_inertia_benchmark as bench if not bench.SIX_INPUT.exists(): pytest.skip('preserved native packet not available') monkeypatch.setattr(bench,'guard',lambda _:None) for key,value in bench.THREAD_ENVIRONMENT.items(): monkeypatch.setenv(key,value) diff --git a/tests/test_native_fraction_free_inertia.py b/tests/test_native_fraction_free_inertia.py index faf95e7f5..943539996 100644 --- a/tests/test_native_fraction_free_inertia.py +++ b/tests/test_native_fraction_free_inertia.py @@ -92,7 +92,7 @@ def test_inputs_remain_unchanged(): def test_benchmark_guard_accepts_reduction_stage(monkeypatch): from functools import partial - from docs.reference_cases import ge_beam3_exact_inertia_benchmark as bench + from fixtures.reference_cases import ge_beam3_exact_inertia_benchmark as bench monkeypatch.setattr(bench.time,'monotonic',lambda: 10.) check=partial(bench.deadline_check,0.) check(); check('reduction.start') @@ -104,7 +104,7 @@ def test_benchmark_guard_accepts_reduction_stage(monkeypatch): def test_benchmark_complete_saved_packet_wiring(tmp_path,monkeypatch): import json import runpy - from docs.reference_cases import ge_beam3_exact_inertia_benchmark as bench + from fixtures.reference_cases import ge_beam3_exact_inertia_benchmark as bench if not bench.INPUT.exists(): pytest.skip('external saved packet not present') monkeypatch.setattr(bench,'guard',lambda _:None) for key,value in bench.THREAD_ENVIRONMENT.items(): monkeypatch.setenv(key,value) diff --git a/tests/test_native_reference_factor_spectrum.py b/tests/test_native_reference_factor_spectrum.py index a8ecb2859..d2b33275e 100644 --- a/tests/test_native_reference_factor_spectrum.py +++ b/tests/test_native_reference_factor_spectrum.py @@ -6,7 +6,7 @@ from anyfesolver._native_reference_factor_spectrum import solve_reference_factor_spectrum as solve from anyfesolver._native_stationary_spectrum import solve_stationary_spectrum from anyfesolver.control import CancellationToken, SolveCancelled -from docs.reference_cases.ge_beam3_slender_spectrum_probe import factors +from fixtures.reference_cases.ge_beam3_slender_spectrum_probe import factors def test_moderate_reference_factors_match_dense_without_changing_signed_solver(): From cb3ead063316e2f2c9c76469f69e29af79b867ed Mon Sep 17 00:00:00 2001 From: Audun Arnesen Nyhus Date: Wed, 11 Nov 2026 22:20:43 +0100 Subject: [PATCH 10/15] Require the published SESTRA reader and retain failed CI replay evidence --- .github/workflows/ci.yml | 39 +++++++++----- .github/workflows/contact-candidate.yml | 2 +- .github/workflows/publish.yml | 4 +- CHANGELOG.md | 2 + README.md | 2 +- THIRD_PARTY_NOTICES.md | 2 +- dependency-licenses.json | 2 +- docs/GENERAL_CONTACT_STATIC_CANDIDATE.md | 2 +- docs/releases/ANYfeSolver_0.5.0.md | 7 +-- packages/results/THIRD_PARTY_NOTICES.md | 2 +- pyproject.toml | 2 +- scripts/build_static_contact_candidate.py | 2 +- scripts/contact_candidate_050.json | 6 +-- scripts/verify_release_050.py | 8 +-- tests/test_anyfileio_version_compatibility.py | 53 ++++++++++--------- 15 files changed, 77 insertions(+), 58 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4e83aa936..ca8d92530 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: run: >- python -m pip install --dry-run --only-binary=:all: dist/*.whl .results-wheels/*.whl ANYmaterial==0.2.0 ANYgeometry==0.4.3 - ANYmesher==0.5.0 ANYfileio==0.3.2 + ANYmesher==0.5.0 ANYfileio==0.3.3 pytest: runs-on: ${{ matrix.os }} @@ -106,7 +106,7 @@ jobs: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 with: repository: audunarn/ANYfileIO - ref: 24072503398f5774e0b42e25c74443d1ed3413df + ref: fb11ea83656b427485f48fca9f7306c32658a672 path: .ecosystem/ANYfileIO persist-credentials: false - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 @@ -149,6 +149,17 @@ jobs: python scripts/run_portable_ci.py --workers 2 --timeout-seconds 2400 --matrix-shard-index ${{ matrix.shard-index }} --matrix-shard-count 8 --matrix-subshard-index ${{ matrix.subshard-index }} --matrix-subshard-count 4 + - name: Retain failed contact replay evidence + if: failure() + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 + with: + name: contact-replay-${{ matrix.os }}-${{ matrix.shard-index }}-${{ matrix.subshard-index }} + path: | + ${{ runner.temp }}/rejected_material_path.json + ${{ runner.temp }}/coupled_stage.json + ${{ runner.temp }}/coupled_integral_timings.json + ${{ runner.temp }}/accepted_material_checkpoint.json + if-no-files-found: ignore anymesher-compatibility: name: ANYmesher ${{ matrix.anymesher-version }} compatibility @@ -163,18 +174,18 @@ jobs: anygeometry-version: "0.4.2" anygeometry-ref: dd954f088a4cb95e267280cc4777b09e16232bd9 anygeometry-install: .ecosystem/ANYgeometry - anyfileio-version: "0.3.2" - anyfileio-ref: db73950018e1c87dab0ca618c25c965030ba08ce - anyfileio-install: ANYfileio==0.3.2 + anyfileio-version: "0.3.3" + anyfileio-ref: fb11ea83656b427485f48fca9f7306c32658a672 + anyfileio-install: ANYfileio==0.3.3 - anymesher-version: "0.5.0" anymesher-ref: 2ccef378c3efb4ba3a9957b9ab896ac8fc454b9d anymesher-install: ANYmesher==0.5.0 anygeometry-version: "0.4.3" anygeometry-ref: 91846898b03fa02b029abde82508eddb981efdc0 anygeometry-install: ANYgeometry==0.4.3 - anyfileio-version: "0.3.2" - anyfileio-ref: db73950018e1c87dab0ca618c25c965030ba08ce - anyfileio-install: ANYfileio==0.3.2 + anyfileio-version: "0.3.3" + anyfileio-ref: fb11ea83656b427485f48fca9f7306c32658a672 + anyfileio-install: ANYfileio==0.3.3 steps: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 @@ -242,9 +253,9 @@ jobs: fail-fast: false matrix: include: - - anyfileio-version: "0.3.2" - anyfileio-ref: db73950018e1c87dab0ca618c25c965030ba08ce - anyfileio-install: ANYfileio==0.3.2 + - anyfileio-version: "0.3.3" + anyfileio-ref: fb11ea83656b427485f48fca9f7306c32658a672 + anyfileio-install: ANYfileio==0.3.3 anymesher-version: "0.5.0" anymesher-ref: 2ccef378c3efb4ba3a9957b9ab896ac8fc454b9d anymesher-install: ANYmesher==0.5.0 @@ -343,7 +354,7 @@ jobs: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 with: repository: audunarn/ANYfileIO - ref: db73950018e1c87dab0ca618c25c965030ba08ce + ref: fb11ea83656b427485f48fca9f7306c32658a672 path: .ecosystem/ANYfileIO persist-credentials: false - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 @@ -411,7 +422,7 @@ jobs: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 with: repository: audunarn/ANYfileIO - ref: db73950018e1c87dab0ca618c25c965030ba08ce + ref: fb11ea83656b427485f48fca9f7306c32658a672 path: .ecosystem/ANYfileIO persist-credentials: false - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 @@ -458,7 +469,7 @@ jobs: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 with: repository: audunarn/ANYfileIO - ref: db73950018e1c87dab0ca618c25c965030ba08ce + ref: fb11ea83656b427485f48fca9f7306c32658a672 path: .ecosystem/ANYfileIO persist-credentials: false - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 diff --git a/.github/workflows/contact-candidate.yml b/.github/workflows/contact-candidate.yml index b09b0e11e..90dd61548 100644 --- a/.github/workflows/contact-candidate.yml +++ b/.github/workflows/contact-candidate.yml @@ -70,7 +70,7 @@ jobs: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 with: repository: audunarn/ANYfileIO - ref: db73950018e1c87dab0ca618c25c965030ba08ce + ref: fb11ea83656b427485f48fca9f7306c32658a672 path: .ecosystem/ANYfileIO persist-credentials: false - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a639a30d0..a2e4c3c6d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -134,7 +134,7 @@ jobs: - name: Require compatible production packages before ANYfeSolver run: | python -m pip install --upgrade pip - python -m pip download --no-deps --dest sibling-distributions --index-url https://pypi.org/simple "ANYmaterial==0.2.0" "ANYgeometry==0.4.3" "ANYmesher==0.5.0" "ANYfileio==0.3.2" + python -m pip download --no-deps --dest sibling-distributions --index-url https://pypi.org/simple "ANYmaterial==0.2.0" "ANYgeometry==0.4.3" "ANYmesher==0.5.0" "ANYfileio==0.3.3" build: name: Build and verify the single artifact set (stage only) @@ -175,7 +175,7 @@ jobs: run: >- python -m pip install --dry-run --only-binary=:all: dist/solver/*.whl dist/results/*.whl ANYmaterial==0.2.0 ANYgeometry==0.4.3 - ANYmesher==0.5.0 ANYfileio==0.3.2 + ANYmesher==0.5.0 ANYfileio==0.3.3 - name: Record the bytes that will be published run: | set -euo pipefail diff --git a/CHANGELOG.md b/CHANGELOG.md index e07d08d9e..6f439c3ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ## 0.5.0 - release candidate +- Require ANYfileio 0.3.3 or later in the 0.3 line for SESTRA shell stress + recovery from relabelled descriptors and reported rotation frames. - Rename the solver distribution and import to `ANYfeSolver` and `anyfesolver`. The separately installable results runtime is `ANYfeSolver-results` 2.2.0, imported as `anyfesolver_results`. See [the migration guide](MIGRATION.md) diff --git a/README.md b/README.md index ea3b13e40..37e5b3483 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ python -m pip install -e C:\Github\ANYfeSolver ### Installation and migration -`ANYfeSolver` 0.5 uses the independent `ANYfeSolver-results` 2.2 runtime, `ANYmaterial` 0.2, `ANYmesher` 0.4–0.5 and `ANYfileio` 0.3.2 or later in the 0.3 line. Install the results distribution alone for NumPy-only offline recovery. The [migration guide](MIGRATION.md) covers renamed Python imports and upgrades from `ANYsolver`. +`ANYfeSolver` 0.5 uses the independent `ANYfeSolver-results` 2.2 runtime, `ANYmaterial` 0.2, `ANYmesher` 0.4–0.5 and `ANYfileio` 0.3.3 or later in the 0.3 line. Install the results distribution alone for NumPy-only offline recovery. The [migration guide](MIGRATION.md) covers renamed Python imports and upgrades from `ANYsolver`. For the marine-excitation or marine-morison extra, install the corresponding ecosystem sibling checkout before requesting the extra: diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md index 3f29883ee..6012ce35d 100644 --- a/THIRD_PARTY_NOTICES.md +++ b/THIRD_PARTY_NOTICES.md @@ -12,7 +12,7 @@ inventory is `dependency-licenses.json`. | threadpoolctl | `threadpoolctl>=3.5` | BSD-3-Clause | Runtime dependency; not bundled | | ANYmaterial | `ANYmaterial>=0.2,<0.3` | MPL-2.0 | Runtime dependency; separately distributed | | ANYmesher | `ANYmesher>=0.4,<0.6` | MPL-2.0 | Runtime dependency; separately distributed | -| ANYfileio | `ANYfileio>=0.3.2,<0.4` | MPL-2.0 | Runtime dependency; separately distributed | +| ANYfileio | `ANYfileio>=0.3.3,<0.4` | MPL-2.0 | Runtime dependency; separately distributed | | ANYgeometry | `ANYgeometry>=0.4.3,<0.5` | MPL-2.0 | Optional general-contact dependency; separately distributed | | Numba | `numba>=0.59` | BSD | Optional accelerator; not bundled | | pypardiso | `pypardiso>=0.4` | BSD-3-Clause | Optional accelerator; not bundled | diff --git a/dependency-licenses.json b/dependency-licenses.json index 6f41ec223..e8c905671 100644 --- a/dependency-licenses.json +++ b/dependency-licenses.json @@ -38,7 +38,7 @@ { "distribution": "ANYfileio", "licence": "MPL-2.0", - "requirement": "ANYfileio>=0.3.2,<0.4", + "requirement": "ANYfileio>=0.3.3,<0.4", "scope": "runtime", "status": "not-bundled" }, diff --git a/docs/GENERAL_CONTACT_STATIC_CANDIDATE.md b/docs/GENERAL_CONTACT_STATIC_CANDIDATE.md index 345b26417..7fa0eef58 100644 --- a/docs/GENERAL_CONTACT_STATIC_CANDIDATE.md +++ b/docs/GENERAL_CONTACT_STATIC_CANDIDATE.md @@ -75,7 +75,7 @@ Two supported routes: virtual environment: ```text - python -m pip install --find-links wheelhouse -r requirements-tested.txt "ANYfeSolver[general-contact]==0.5.0+contact.candidate.20261111.s7" "ANYfeSolver-results==2.2.0" "ANYmaterial==0.2.0" "ANYgeometry[planar]==0.4.3" "ANYmesher==0.5.0" "ANYfileio==0.3.2" + python -m pip install --find-links wheelhouse -r requirements-tested.txt "ANYfeSolver[general-contact]==0.5.0+contact.candidate.20261111.s7" "ANYfeSolver-results==2.2.0" "ANYmaterial==0.2.0" "ANYgeometry[planar]==0.4.3" "ANYmesher==0.5.0" "ANYfileio==0.3.3" ``` Numeric and Shapely dependencies resolve normally from their usual diff --git a/docs/releases/ANYfeSolver_0.5.0.md b/docs/releases/ANYfeSolver_0.5.0.md index ad97f8e41..ee31472ab 100644 --- a/docs/releases/ANYfeSolver_0.5.0.md +++ b/docs/releases/ANYfeSolver_0.5.0.md @@ -29,9 +29,10 @@ The supported historical wire formats (recovery capsule contracts v1 and v2) are intended to remain readable by the renamed results runtime. This packaging change does not itself test that; it is covered by the results tests run in CI. -`ANYfeSolver` 0.5.0 requires `ANYfeSolver-results>=2.2,<3`. The other public -solver dependency bands (numpy, scipy, threadpoolctl, ANYmaterial, ANYmesher, -ANYfileio) and the optional extras are as declared in 0.4.7. +`ANYfeSolver` 0.5.0 requires `ANYfeSolver-results>=2.2,<3` and +`ANYfileio>=0.3.3,<0.4`. The SESTRA reader uses the stress component order +and rotation frame reported in the file. The remaining solver dependency +bands and optional extras follow 0.4.7. `ANYfeSolver-results` depends only on `numpy>=2.0`. Project URLs point to `https://github.com/audunarn/ANYfeSolver`. diff --git a/packages/results/THIRD_PARTY_NOTICES.md b/packages/results/THIRD_PARTY_NOTICES.md index 3f29883ee..6012ce35d 100644 --- a/packages/results/THIRD_PARTY_NOTICES.md +++ b/packages/results/THIRD_PARTY_NOTICES.md @@ -12,7 +12,7 @@ inventory is `dependency-licenses.json`. | threadpoolctl | `threadpoolctl>=3.5` | BSD-3-Clause | Runtime dependency; not bundled | | ANYmaterial | `ANYmaterial>=0.2,<0.3` | MPL-2.0 | Runtime dependency; separately distributed | | ANYmesher | `ANYmesher>=0.4,<0.6` | MPL-2.0 | Runtime dependency; separately distributed | -| ANYfileio | `ANYfileio>=0.3.2,<0.4` | MPL-2.0 | Runtime dependency; separately distributed | +| ANYfileio | `ANYfileio>=0.3.3,<0.4` | MPL-2.0 | Runtime dependency; separately distributed | | ANYgeometry | `ANYgeometry>=0.4.3,<0.5` | MPL-2.0 | Optional general-contact dependency; separately distributed | | Numba | `numba>=0.59` | BSD | Optional accelerator; not bundled | | pypardiso | `pypardiso>=0.4` | BSD-3-Clause | Optional accelerator; not bundled | diff --git a/pyproject.toml b/pyproject.toml index 7ca7d558c..71ced20bb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ dependencies = [ "threadpoolctl>=3.5", "ANYmaterial>=0.2,<0.3", "ANYmesher>=0.4,<0.6", - "ANYfileio>=0.3.2,<0.4", + "ANYfileio>=0.3.3,<0.4", "ANYfeSolver-results>=2.2,<3", ] diff --git a/scripts/build_static_contact_candidate.py b/scripts/build_static_contact_candidate.py index 01ac77a23..7ff320839 100644 --- a/scripts/build_static_contact_candidate.py +++ b/scripts/build_static_contact_candidate.py @@ -91,7 +91,7 @@ def write_guide(bundle: Path, config: dict) -> None: ``` python -m pip install --no-cache-dir -r requirements-tested.txt -python -m pip install --no-cache-dir --no-index --find-links wheelhouse "ANYfeSolver[general-contact]=={version}" anyfesolver-results==2.2.0 ANYmaterial==0.2.0 "ANYgeometry[planar]==0.4.3" ANYmesher==0.5.0 ANYfileio==0.3.2 +python -m pip install --no-cache-dir --no-index --find-links wheelhouse "ANYfeSolver[general-contact]=={version}" anyfesolver-results==2.2.0 ANYmaterial==0.2.0 "ANYgeometry[planar]==0.4.3" ANYmesher==0.5.0 ANYfileio==0.3.3 python -m pip check ``` diff --git a/scripts/contact_candidate_050.json b/scripts/contact_candidate_050.json index 3b13f4ea0..7431cd0f8 100644 --- a/scripts/contact_candidate_050.json +++ b/scripts/contact_candidate_050.json @@ -15,7 +15,7 @@ "ANYmaterial": "0.2.0", "ANYgeometry": "0.4.3", "ANYmesher": "0.5.0", - "ANYfileio": "0.3.2" + "ANYfileio": "0.3.3" }, "wheel_files": { "ANYfeSolver": "anyfesolver-0.5.0+contact.candidate.20261111.s7-py3-none-any.whl", @@ -23,7 +23,7 @@ "ANYmaterial": "anymaterial-0.2.0-py3-none-any.whl", "ANYgeometry": "anygeometry-0.4.3-py3-none-any.whl", "ANYmesher": "anymesher-0.5.0-py3-none-any.whl", - "ANYfileio": "anyfileio-0.3.2-py3-none-any.whl" + "ANYfileio": "anyfileio-0.3.3-py3-none-any.whl" }, "sibling_dirs": { "ANYmaterial": "ANYmaterial", @@ -35,7 +35,7 @@ "ANYmaterial": "d8a233ef4c5e38d25dbba0eb20e6cfa8d44ec5a2", "ANYgeometry": "91846898b03fa02b029abde82508eddb981efdc0", "ANYmesher": "2ccef378c3efb4ba3a9957b9ab896ac8fc454b9d", - "ANYfileio": "db73950018e1c87dab0ca618c25c965030ba08ce" + "ANYfileio": "fb11ea83656b427485f48fca9f7306c32658a672" }, "numerical_pins": [ "numpy==2.5.4", diff --git a/scripts/verify_release_050.py b/scripts/verify_release_050.py index 008e5b3f9..b56c4ddc8 100644 --- a/scripts/verify_release_050.py +++ b/scripts/verify_release_050.py @@ -42,14 +42,14 @@ OLD_IMPORT_NAMES = ("anysolver", "anysolver_results") TERMINAL = "ANYFESOLVER_0_5_0_PACKAGING_GATE_PASSED_NOT_A_PUBLICATION_DECISION" SCHEMA = "ANYFESOLVER_0_5_0_PACKAGING_GATE_V1" -# Public solver dependency bands that must stay as released in 0.4.7. +# Public solver dependency bands for the 0.5.0 candidate. EXPECTED_SOLVER_REQUIRES = { "numpy": frozenset({">=2.0"}), "scipy": frozenset({">=1.13"}), "threadpoolctl": frozenset({">=3.5"}), "anymaterial": frozenset({">=0.2", "<0.3"}), "anymesher": frozenset({">=0.4", "<0.6"}), - "anyfileio": frozenset({">=0.3.2", "<0.4"}), + "anyfileio": frozenset({">=0.3.3", "<0.4"}), "anyfesolver-results": frozenset({">=2.2", "<3"}), } EXPECTED_RESULTS_REQUIRES = {"numpy": frozenset({">=2.0"})} @@ -393,7 +393,7 @@ def comparable(members: dict[str, bytes]) -> dict[str, bytes]: except ValueError: pass else: raise RuntimeError("B3-GE became a generic/default route") out.update(legacy_b3_default=True, b3_ge_opt_in_only=True, armijo_opt_in_only=True) - bands = {"ANYfileio": ((0, 3, 2), (0, 4)), "ANYmaterial": ((0, 2), (0, 3)), "ANYmesher": ((0, 4), (0, 6))} + bands = {"ANYfileio": ((0, 3, 3), (0, 4)), "ANYmaterial": ((0, 2), (0, 3)), "ANYmesher": ((0, 4), (0, 6))} found = {} for name, (low, high) in bands.items(): v = metadata.version(name); found[name] = v @@ -494,7 +494,7 @@ def run(solver_wheel: Path, solver_sdist: Path, results_wheel: Path, results_sdi "candidate": {"commit": commit, "tree": tree}, "checks": { "both_pairs_built_from_candidate_source": True, - "dependency_bands_unchanged": True, + "dependency_bands_match_candidate_metadata": True, "historical_verifier_untouched_and_not_reused_as_terminal": True, "installed_smoke": True, "no_old_import_trees": True, diff --git a/tests/test_anyfileio_version_compatibility.py b/tests/test_anyfileio_version_compatibility.py index 30673b5e6..84286f4f5 100644 --- a/tests/test_anyfileio_version_compatibility.py +++ b/tests/test_anyfileio_version_compatibility.py @@ -19,8 +19,8 @@ from packaging.version import Version -EXPECTED_REQUIREMENT = "ANYfileio>=0.3.2,<0.4" -EXPECTED_SPECIFIER = SpecifierSet(">=0.3.2,<0.4") +EXPECTED_REQUIREMENT = "ANYfileio>=0.3.3,<0.4" +EXPECTED_SPECIFIER = SpecifierSet(">=0.3.3,<0.4") RELEVANT_PACKAGES = { "anymaterial", "anygeometry", @@ -191,7 +191,7 @@ def _assert_complete_source_graphs(roots: dict[str, str]) -> None: "anymaterial": "0.2.0", "anygeometry": "0.4.3", "anymesher": "0.5.0", - "anyfileio": "0.3.2", + "anyfileio": "0.3.3", }, ), } @@ -304,11 +304,16 @@ def round_trip(root: Path) -> None: def test_source_declares_exact_anyfileio_compatibility_range() -> None: - assert _source_fileio_requirements() == [EXPECTED_REQUIREMENT] + requirement, = _source_fileio_requirements() + assert requirement == EXPECTED_REQUIREMENT + supported = Requirement(requirement).specifier + assert Version("0.3.3") in supported + assert Version("0.3.2") not in supported + assert Version("0.4.0") not in supported def test_fileio_requirement_accepts_canonicalized_specifier_order() -> None: - _assert_expected_fileio_requirement("ANYfileio<0.4,>=0.3.2") + _assert_expected_fileio_requirement("ANYfileio<0.4,>=0.3.3") def test_current_source_origins_and_complete_graphs() -> None: @@ -412,10 +417,10 @@ def test_workflows_pin_compatibility_graph_and_actions() -> None: "27e428188a891705288fef82bab0b166e330aff2", "91846898b03fa02b029abde82508eddb981efdc0", "2ccef378c3efb4ba3a9957b9ab896ac8fc454b9d", - "db73950018e1c87dab0ca618c25c965030ba08ce", + "fb11ea83656b427485f48fca9f7306c32658a672", "ebbe0e3b500a3f0cfcc62059c3dac4b0ac178b6c", "b6f7cf466865b1c4c34b8e5511ace97d00290f6c", - "24072503398f5774e0b42e25c74443d1ed3413df", + "ea165f8d65b6e75b540449e92b4886f43607fa02", "06f3276d9207376316502aca651c3455db984104", } assert set(re.findall(r"\b[0-9a-f]{40}\b", publish)) == { @@ -449,7 +454,7 @@ def action_sequence(block: str) -> list[str]: assert action_sequence(job_block(ci, "license")) == [checkout_ref, setup_ref] assert action_sequence(job_block(ci, "resolver")) == [checkout_ref, setup_ref] pytest_block = job_block(ci, "pytest") - assert action_sequence(pytest_block) == [checkout_ref] * 5 + [setup_ref, checkout_ref] + assert action_sequence(pytest_block) == [checkout_ref] * 5 + [setup_ref, checkout_ref, upload_ref] solid_condition = " if: matrix.shard-index == 0 && matrix.subshard-index == 0\n" assert pytest_block.count(solid_condition) == 2 solid_checkout = ( @@ -536,7 +541,7 @@ def action_sequence(block: str) -> list[str]: ), ( "audunarn/ANYfileIO", - "db73950018e1c87dab0ca618c25c965030ba08ce", + "fb11ea83656b427485f48fca9f7306c32658a672", ".ecosystem/ANYfileIO", ), ] @@ -582,7 +587,7 @@ def action_sequence(block: str) -> list[str]: current_checkouts[0], ("audunarn/ANYgeometry", "ebbe0e3b500a3f0cfcc62059c3dac4b0ac178b6c", ".ecosystem/ANYgeometry"), ("audunarn/ANYmesh", "b6f7cf466865b1c4c34b8e5511ace97d00290f6c", ".ecosystem/ANYmesh"), - ("audunarn/ANYfileIO", "24072503398f5774e0b42e25c74443d1ed3413df", ".ecosystem/ANYfileIO"), + ("audunarn/ANYfileIO", "fb11ea83656b427485f48fca9f7306c32658a672", ".ecosystem/ANYfileIO"), ] assert checkout_pattern.findall(job_block(ci, "pytest")) == development_checkouts for name in ("wheel", "numba", "pardiso"): @@ -658,25 +663,25 @@ def matrix_rows(block: str) -> str: ' anygeometry-version: "0.4.2"', " anygeometry-ref: dd954f088a4cb95e267280cc4777b09e16232bd9", " anygeometry-install: .ecosystem/ANYgeometry", - ' anyfileio-version: "0.3.2"', - " anyfileio-ref: db73950018e1c87dab0ca618c25c965030ba08ce", - " anyfileio-install: ANYfileio==0.3.2", + ' anyfileio-version: "0.3.3"', + " anyfileio-ref: fb11ea83656b427485f48fca9f7306c32658a672", + " anyfileio-install: ANYfileio==0.3.3", ' - anymesher-version: "0.5.0"', " anymesher-ref: 2ccef378c3efb4ba3a9957b9ab896ac8fc454b9d", " anymesher-install: ANYmesher==0.5.0", ' anygeometry-version: "0.4.3"', " anygeometry-ref: 91846898b03fa02b029abde82508eddb981efdc0", " anygeometry-install: ANYgeometry==0.4.3", - ' anyfileio-version: "0.3.2"', - " anyfileio-ref: db73950018e1c87dab0ca618c25c965030ba08ce", - " anyfileio-install: ANYfileio==0.3.2", + ' anyfileio-version: "0.3.3"', + " anyfileio-ref: fb11ea83656b427485f48fca9f7306c32658a672", + " anyfileio-install: ANYfileio==0.3.3", ) ) assert matrix_rows(fileio_job) == "\n".join( ( - ' - anyfileio-version: "0.3.2"', - " anyfileio-ref: db73950018e1c87dab0ca618c25c965030ba08ce", - " anyfileio-install: ANYfileio==0.3.2", + ' - anyfileio-version: "0.3.3"', + " anyfileio-ref: fb11ea83656b427485f48fca9f7306c32658a672", + " anyfileio-install: ANYfileio==0.3.3", ' anymesher-version: "0.5.0"', " anymesher-ref: 2ccef378c3efb4ba3a9957b9ab896ac8fc454b9d", " anymesher-install: ANYmesher==0.5.0", @@ -725,8 +730,8 @@ def probe_environment(block: str) -> str: ): assert mesh_job.count(value) == 1 assert fileio_job.count(value) == 1 - assert mesh_job.count("db73950018e1c87dab0ca618c25c965030ba08ce") == 2 - assert fileio_job.count("db73950018e1c87dab0ca618c25c965030ba08ce") == 1 + assert mesh_job.count("fb11ea83656b427485f48fca9f7306c32658a672") == 2 + assert fileio_job.count("fb11ea83656b427485f48fca9f7306c32658a672") == 1 for value in ( "27e428188a891705288fef82bab0b166e330aff2", "dd954f088a4cb95e267280cc4777b09e16232bd9", @@ -884,19 +889,19 @@ def job_permissions(name: str) -> list[str] | None: "ANYmaterial==0.2.0", "ANYgeometry==0.4.3", "ANYmesher==0.5.0", - "ANYfileio==0.3.2", + "ANYfileio==0.3.3", ): assert pin in resolver_block, pin assert '"ANYmaterial==0.2.0"' in publish assert '"ANYgeometry==0.4.3"' in publish assert '"ANYmesher==0.5.0"' in publish - assert '"ANYfileio==0.3.2"' in publish + assert '"ANYfileio==0.3.3"' in publish assert "pip install --dry-run --only-binary=:all:" in publish for pin in ( "ANYmaterial==0.2.0", "ANYgeometry==0.4.3", "ANYmesher==0.5.0", - "ANYfileio==0.3.2", + "ANYfileio==0.3.3", ): assert pin in build_block, pin From f54e3cde5abf70cb8c989eb106119eedd3e33025 Mon Sep 17 00:00:00 2001 From: Audun Arnesen Nyhus Date: Wed, 11 Nov 2026 22:27:32 +0100 Subject: [PATCH 11/15] Validate historical qualification names against their sealed contracts --- scripts/run_e4_pl_burnin_gate.py | 10 ++++++---- tests/test_e4_pl_burnin.py | 16 +++++++++++++++- tests/test_ge_beam3_g6_completion.py | 13 +++++++++---- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/scripts/run_e4_pl_burnin_gate.py b/scripts/run_e4_pl_burnin_gate.py index 06466b866..a4d3acd52 100644 --- a/scripts/run_e4_pl_burnin_gate.py +++ b/scripts/run_e4_pl_burnin_gate.py @@ -1248,8 +1248,11 @@ def validate_gate_result( candidate = _exact_keys( record["candidate"], {"clean", "commit", "repository", "tree"}, "$.candidate" ) - if candidate["repository"] != "ANYfeSolver": - raise EvidenceError("$.candidate.repository must be ANYfeSolver") + contract_identity = _sha256_bytes(canonical_json_bytes(contract)) + historical_cycle = contract_identity in _HISTORICAL_CONTRACT_IDENTITIES + expected_repository = "ANYsolver" if historical_cycle else "ANYfeSolver" + if candidate["repository"] != expected_repository: + raise EvidenceError(f"$.candidate.repository must be {expected_repository}") if not _require_bool(candidate["clean"], "$.candidate.clean"): raise EvidenceError("the candidate repository must be clean") _require_match(candidate["commit"], GIT_OBJECT_RE, "$.candidate.commit") @@ -1333,10 +1336,9 @@ def validate_gate_result( raise EvidenceError("resource request lanes are incomplete") lanes = _exact_keys(record["lanes"], set(GATE_LANES), "$.lanes") - contract_identity = _sha256_bytes(canonical_json_bytes(contract)) historical_inventory_authority = ( _HISTORICAL_INVENTORY_IDENTITIES - if contract_identity in _HISTORICAL_CONTRACT_IDENTITIES + if historical_cycle else None ) expected_inventories = ( diff --git a/tests/test_e4_pl_burnin.py b/tests/test_e4_pl_burnin.py index 3ebbd1b61..43656f79e 100644 --- a/tests/test_e4_pl_burnin.py +++ b/tests/test_e4_pl_burnin.py @@ -310,13 +310,14 @@ def test_burn_in_contract_and_runtime_diagnostics_are_aligned() -> None: ], "success_commit_subject": "docs: record E4 PL Q1M clean burn-in gate 1", } + # The recorded repository identities belong to the original burn-in contract. assert contract["repository_cleanliness"] == { "ANYfem": "FULLY_CLEAN_INCLUDING_UNTRACKED", "ANYfileIO": "TRACKED_AND_INDEX_CLEAN_HEAD_ARCHIVE_UNTRACKED_EXCLUDED", "ANYgeometry": "TRACKED_AND_INDEX_CLEAN_HEAD_ARCHIVE_UNTRACKED_EXCLUDED", "ANYmaterial": "TRACKED_AND_INDEX_CLEAN_HEAD_ARCHIVE_UNTRACKED_EXCLUDED", "ANYmesh": "TRACKED_AND_INDEX_CLEAN_HEAD_ARCHIVE_UNTRACKED_EXCLUDED", - "ANYfeSolver": "FULLY_CLEAN_INCLUDING_UNTRACKED", + "ANYsolver": "FULLY_CLEAN_INCLUDING_UNTRACKED", } assert contract["sibling_authority"] == { "ANYfem": { @@ -1535,7 +1536,20 @@ def test_blocked_cycles_remain_verifiable_under_immutable_authority() -> None: row["request_id"] for row in blocked_gate["resource_requests"] ) + # A current repository name cannot authenticate a sealed record, and a + # modified authority cannot opt into the historical repository identity. + historical_contract = gate.strict_json_load(authority_path) + wrong_repository = copy.deepcopy(blocked_gate) + wrong_repository["candidate"]["repository"] = "ANYfeSolver" + with pytest.raises(gate.EvidenceError, match="candidate.repository must be ANYsolver"): + gate.validate_gate_result(wrong_repository, contract=historical_contract) + mutated_contract = dict(historical_contract, default="changed") + with pytest.raises(gate.EvidenceError, match="candidate.repository must be ANYfeSolver"): + gate.validate_gate_result(blocked_gate, contract=mutated_contract) + live_contract = gate.strict_json_load(CONTRACT) + with pytest.raises(gate.EvidenceError, match="candidate.repository must be ANYfeSolver"): + gate.validate_gate_result(blocked_gate, contract=live_contract) live_request_ids = { authority["request_id"] for authority in live_contract["resource_requests"].values() diff --git a/tests/test_ge_beam3_g6_completion.py b/tests/test_ge_beam3_g6_completion.py index d51c90213..3cf544a29 100644 --- a/tests/test_ge_beam3_g6_completion.py +++ b/tests/test_ge_beam3_g6_completion.py @@ -1,11 +1,12 @@ """Eight ordered, bounded G6 scientific evidence routes.""" from hashlib import sha256 -import json import os -from pathlib import Path +from pathlib import Path, PurePosixPath import numpy as np +from scripts import audit_beam_parity_matrix as parity + from anyfesolver import ( AnalysisSession, BoundaryCondition, FEModel, FixedSupport, LoadCase, solve_linear_many, @@ -38,11 +39,15 @@ def _record(route, **checks): def test_01_complete_parity_register_is_source_and_evidence_bound(): - matrix = json.loads((ROOT / "docs/reference_cases/ge_beam3_legacy_parity_matrix_v1.json").read_text()) + matrix = parity.strict((ROOT / parity.MATRIX).read_bytes()) + parity.validate_rows(matrix) assert [row["id"] for row in matrix["rows"]] == [ *[f"P{i:02d}" for i in range(1, 33)], *[f"U{i:02d}" for i in range(1, 11)] ] - assert all((ROOT / source).is_file() for row in matrix["rows"] for source in row["sources"]) + for row in matrix["rows"]: + for source in row["sources"]: + relative = PurePosixPath(source).relative_to("src/anysolver") + assert (ROOT / "src/anyfesolver" / relative).is_file(), source accepted = [ROOT / "docs/reference_cases" / name for name in ( "ge_beam3_g5_completion_confirmation_v1.json", "ge_beam3_g5_completion_confirmation_review_v1.json", From 0ea43dfd85fec3ee9e64478535cc168a5fa987ce Mon Sep 17 00:00:00 2001 From: Audun Arnesen Nyhus Date: Wed, 11 Nov 2026 22:33:11 +0100 Subject: [PATCH 12/15] Check the exact released reader in the successor contact bundle --- tests/test_static_contact_candidate_tools.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/test_static_contact_candidate_tools.py b/tests/test_static_contact_candidate_tools.py index 0c15a8496..ab0cabaa1 100644 --- a/tests/test_static_contact_candidate_tools.py +++ b/tests/test_static_contact_candidate_tools.py @@ -78,7 +78,7 @@ def test_config_recipe_is_complete_and_matches_the_checkout() -> None: IDENTITY_KEYS = {"status", "note", "predecessor", "candidate_version", - "repo_version", "private_versions", "wheel_files"} + "repo_version", "private_versions", "wheel_files", "sibling_refs"} PREDECESSOR_FILE = ROOT / "scripts" / "contact_candidate_slice2.json" @@ -92,9 +92,8 @@ def test_successor_numerical_fields_equal_the_frozen_predecessor() -> None: assert CONFIG["predecessor"]["candidate_version"] == predecessor["candidate_version"] assert CONFIG["predecessor"]["authority_renewed"] is False assert CONFIG["predecessor"]["numerical_run_made"] is False - # Same key set; every non-identity field (pins, selectors, batches, stages, - # nodes, examples, caps, cross-host files/quantities/exact/bound, scales, - # sibling dirs and refs) is exactly equal. + # Numerical pins, selectors, caps and cross-host comparison fields retain + # the predecessor's exact values. assert set(CONFIG) - {"predecessor"} == set(predecessor) for key in sorted(set(predecessor) - IDENTITY_KEYS): assert CONFIG[key] == predecessor[key], key @@ -103,8 +102,13 @@ def test_successor_numerical_fields_equal_the_frozen_predecessor() -> None: assert CONFIG["timeouts"] == dict(case_seconds=120, host_numerical_seconds=600, rss_limit_mib=953) - # Third-party private wheels keep the predecessor's versions and files. - for package in ("ANYmaterial", "ANYgeometry", "ANYmesher", "ANYfileio"): + assert predecessor["sibling_refs"]["ANYfileio"] == "db73950018e1c87dab0ca618c25c965030ba08ce" + assert CONFIG["sibling_refs"] == predecessor["sibling_refs"] | { + "ANYfileio": "fb11ea83656b427485f48fca9f7306c32658a672", + } + assert CONFIG["private_versions"]["ANYfileio"] == "0.3.3" + assert CONFIG["wheel_files"]["ANYfileio"] == "anyfileio-0.3.3-py3-none-any.whl" + for package in ("ANYmaterial", "ANYgeometry", "ANYmesher"): assert CONFIG["private_versions"][package] == \ predecessor["private_versions"][package] assert CONFIG["wheel_files"][package] == predecessor["wheel_files"][package] From e23aa8c4b086535a57b145ecb5433fa37ccc6178 Mon Sep 17 00:00:00 2001 From: Audun Arnesen Nyhus Date: Wed, 11 Nov 2026 22:43:15 +0100 Subject: [PATCH 13/15] Declare the packaging test backend and align distribution notices --- LICENSING.md | 15 +++++-------- THIRD_PARTY_NOTICES.md | 10 ++++++--- dependency-licenses.json | 7 ++++++ packages/results/THIRD_PARTY_NOTICES.md | 30 ++++--------------------- pyproject.toml | 1 + tests/test_release_050.py | 5 +++++ 6 files changed, 30 insertions(+), 38 deletions(-) diff --git a/LICENSING.md b/LICENSING.md index 3eb9ac9ce..370a8f447 100644 --- a/LICENSING.md +++ b/LICENSING.md @@ -1,4 +1,4 @@ -# ANYsolver licensing +# ANYfeSolver licensing Copyright (c) Audun Nyhus @@ -11,19 +11,16 @@ when they were distributed. Git history is not rewritten by this transition. ## Scope -The MPL-2.0 applies to ANYsolver-owned source code, tests, scripts, and +The MPL-2.0 applies to ANYfeSolver-owned source code, tests, scripts, and documentation unless a file or directory carries a more specific notice. Research references, quoted source metadata, test assertions about external source licences, and third-party material retain their respective licences and are not relicensed by this repository. -ANYsolver distributions do not bundle their Python dependencies. Direct and -optional dependencies are listed in `dependency-licenses.json` and summarized -in `THIRD_PARTY_NOTICES.md`; those packages remain governed by their own -licences. In particular, the current extracted ANY ecosystem dependencies are -still GPL-3.0-or-later releases. Relicensing ANYsolver alone does not relicense -those packages or by itself remove obligations arising from distributing a -larger combined product. +Packaging tools install ANYfeSolver's dependencies separately. The version +requirements and corresponding licences are listed in `dependency-licenses.json` +and `THIRD_PARTY_NOTICES.md`. Earlier distributions of ecosystem packages +retain the licences under which their owners published them. The 0.4.0 transition is based on the project owner's confirmation and a Git author audit showing only owner-controlled identities plus local release and diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md index 6012ce35d..dfd0c4c84 100644 --- a/THIRD_PARTY_NOTICES.md +++ b/THIRD_PARTY_NOTICES.md @@ -1,18 +1,21 @@ # Third-party notices -ANYsolver does not vendor or bundle these packages in its source distribution +ANYfeSolver does not vendor or bundle these packages in its source distribution or pure-Python wheel. They are installed separately by packaging tools and remain governed by their own upstream licences. The machine-readable release inventory is `dependency-licenses.json`. | Dependency | Requirement | Licence | Distribution status | | --- | --- | --- | --- | -| NumPy | `numpy>=1.26` | BSD-3-Clause and bundled-component licences | Runtime dependency; not bundled | -| SciPy | `scipy>=1.11` | BSD-3-Clause and bundled-component licences | Runtime dependency; not bundled | +| NumPy | `numpy>=2.0` | BSD-3-Clause and bundled-component licences | Runtime dependency | +| SciPy | `scipy>=1.13` | BSD-3-Clause and bundled-component licences | Runtime dependency | | threadpoolctl | `threadpoolctl>=3.5` | BSD-3-Clause | Runtime dependency; not bundled | | ANYmaterial | `ANYmaterial>=0.2,<0.3` | MPL-2.0 | Runtime dependency; separately distributed | | ANYmesher | `ANYmesher>=0.4,<0.6` | MPL-2.0 | Runtime dependency; separately distributed | | ANYfileio | `ANYfileio>=0.3.3,<0.4` | MPL-2.0 | Runtime dependency; separately distributed | +| ANYfeSolver-results | `ANYfeSolver-results>=2.2,<3` | MPL-2.0 | Runtime dependency | +| ANYhydro | `ANYhydro>=0.1.0` | MPL-2.0 | Optional marine excitation dependency | +| ANYloads | `ANYloads>=0.1.0` | MPL-2.0 | Optional marine Morison dependency | | ANYgeometry | `ANYgeometry>=0.4.3,<0.5` | MPL-2.0 | Optional general-contact dependency; separately distributed | | Numba | `numba>=0.59` | BSD | Optional accelerator; not bundled | | pypardiso | `pypardiso>=0.4` | BSD-3-Clause | Optional accelerator; not bundled | @@ -20,6 +23,7 @@ inventory is `dependency-licenses.json`. | pytest | `pytest>=8` | MIT | Development dependency; not bundled | | psutil | `psutil>=5.9` | BSD-3-Clause | Development resource-monitor dependency; not bundled | | build | `build>=1.2` | MIT | Development dependency; not bundled | +| setuptools | `setuptools>=77` | MIT | Build and development dependency | | Twine | `twine>=5` | Apache-2.0 | Development dependency; not bundled | For complete licence texts and bundled-component notices, consult the exact diff --git a/dependency-licenses.json b/dependency-licenses.json index e8c905671..074de70b3 100644 --- a/dependency-licenses.json +++ b/dependency-licenses.json @@ -112,6 +112,13 @@ "scope": "development", "status": "not-bundled" }, + { + "distribution": "setuptools", + "licence": "MIT", + "requirement": "setuptools>=77", + "scope": "development", + "status": "not-bundled" + }, { "distribution": "twine", "licence": "Apache-2.0", diff --git a/packages/results/THIRD_PARTY_NOTICES.md b/packages/results/THIRD_PARTY_NOTICES.md index 6012ce35d..e4d530edb 100644 --- a/packages/results/THIRD_PARTY_NOTICES.md +++ b/packages/results/THIRD_PARTY_NOTICES.md @@ -1,28 +1,6 @@ # Third-party notices -ANYsolver does not vendor or bundle these packages in its source distribution -or pure-Python wheel. They are installed separately by packaging tools and -remain governed by their own upstream licences. The machine-readable release -inventory is `dependency-licenses.json`. - -| Dependency | Requirement | Licence | Distribution status | -| --- | --- | --- | --- | -| NumPy | `numpy>=1.26` | BSD-3-Clause and bundled-component licences | Runtime dependency; not bundled | -| SciPy | `scipy>=1.11` | BSD-3-Clause and bundled-component licences | Runtime dependency; not bundled | -| threadpoolctl | `threadpoolctl>=3.5` | BSD-3-Clause | Runtime dependency; not bundled | -| ANYmaterial | `ANYmaterial>=0.2,<0.3` | MPL-2.0 | Runtime dependency; separately distributed | -| ANYmesher | `ANYmesher>=0.4,<0.6` | MPL-2.0 | Runtime dependency; separately distributed | -| ANYfileio | `ANYfileio>=0.3.3,<0.4` | MPL-2.0 | Runtime dependency; separately distributed | -| ANYgeometry | `ANYgeometry>=0.4.3,<0.5` | MPL-2.0 | Optional general-contact dependency; separately distributed | -| Numba | `numba>=0.59` | BSD | Optional accelerator; not bundled | -| pypardiso | `pypardiso>=0.4` | BSD-3-Clause | Optional accelerator; not bundled | -| mpmath | `mpmath==1.3.0` | BSD-3-Clause | Development/research dependency; not bundled | -| pytest | `pytest>=8` | MIT | Development dependency; not bundled | -| psutil | `psutil>=5.9` | BSD-3-Clause | Development resource-monitor dependency; not bundled | -| build | `build>=1.2` | MIT | Development dependency; not bundled | -| Twine | `twine>=5` | Apache-2.0 | Development dependency; not bundled | - -For complete licence texts and bundled-component notices, consult the exact -dependency distribution installed in the target environment. Earlier ANY -dependency releases retain the licence terms under which they were published; -the coordinated release bands above identify their MPL-2.0 successors. +ANYfeSolver-results uses NumPy (`numpy>=2.0`) to replay stored results. +Packaging tools install NumPy separately. NumPy uses the BSD-3-Clause licence. +Consult the installed NumPy distribution for its licence text and the notices +for components included in its wheel. diff --git a/pyproject.toml b/pyproject.toml index 71ced20bb..eaa511e9c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,6 +45,7 @@ dev = [ "mpmath==1.3.0", "pytest>=8", "psutil>=5.9", + "setuptools>=77", "twine>=5", ] diff --git a/tests/test_release_050.py b/tests/test_release_050.py index c6a0baba6..19de9af0a 100644 --- a/tests/test_release_050.py +++ b/tests/test_release_050.py @@ -148,6 +148,11 @@ def test_license_files_and_inventory_agree() -> None: for group in solver["optional-dependencies"].values(): declared.update(group) assert declared == recorded + solver_notice = (ROOT / "THIRD_PARTY_NOTICES.md").read_text(encoding="utf-8") + assert all(f"`{requirement}`" in solver_notice for requirement in declared) + results = _project("packages/results/pyproject.toml")["project"] + results_notice = (ROOT / "packages/results/THIRD_PARTY_NOTICES.md").read_text(encoding="utf-8") + assert all(f"`{requirement}`" in results_notice for requirement in results["dependencies"]) def test_manifest_ships_native_source_and_release_note() -> None: From 0cf65681c96c430405f97fed53b1d2ed34eb932d Mon Sep 17 00:00:00 2001 From: Audun Arnesen Nyhus Date: Thu, 12 Nov 2026 09:53:29 +0100 Subject: [PATCH 14/15] Reproduce archived S3 stiffness and curved contact bounds on checkpoint restore --- src/anyfesolver/e4_pl_s3_v2c_element.py | 75 +++++++- .../general_contact/native_curved_s3_work.py | 18 +- .../general_contact/native_multi_s3_static.py | 180 +++++++++++++++++- .../native_replay_arithmetic.py | 53 ++++++ ...general_contact_native_curved_s3_static.py | 23 +++ ...est_general_contact_native_two_fibre_s3.py | 165 ++++++++++++++++ 6 files changed, 499 insertions(+), 15 deletions(-) diff --git a/src/anyfesolver/e4_pl_s3_v2c_element.py b/src/anyfesolver/e4_pl_s3_v2c_element.py index a713fb62b..680256441 100644 --- a/src/anyfesolver/e4_pl_s3_v2c_element.py +++ b/src/anyfesolver/e4_pl_s3_v2c_element.py @@ -213,8 +213,28 @@ def _plate_embedding() -> np.ndarray: _COMPONENT_CACHE_CAPACITY = 512 -def _make_exact_component_compute_wrapper() -> Any: - """Create the sole cache surface with all mutable state closure-owned.""" +HOST_BLAS_ARITHMETIC = "host_blas" +CONTACT_REPLAY_FUSED_ARITHMETIC = "contact_replay_fused_congruence_v1" + + +def _make_exact_component_compute_wrapper(arithmetic: str = HOST_BLAS_ARITHMETIC) -> Any: + """Create one cache surface with all mutable state closure-owned. + + ``arithmetic`` selects only how the final 18x18 congruence + ``T.T @ M @ T`` is evaluated. The default is the host BLAS product used + since V2C was accepted. The contact-replay option evaluates only that one + product with the fixed fused-multiply-add order of + ``general_contact.native_replay_arithmetic.s3_congruence_product``, an + order observed to reproduce archived matrices. Geometry, operators and + the local products are unchanged and still use the host libraries, so this + is not a claim that the whole stiffness is host independent. Each option + owns a separate closure cache, the option is part of every cache key, and + the fused option refuses a non-canonical receiver before touching its cache. + """ + + if arithmetic not in (HOST_BLAS_ARITHMETIC, CONTACT_REPLAY_FUSED_ARITHMETIC): + raise ValueError("strict-flat S3 V2 unknown congruence arithmetic") + fused_congruence = arithmetic == CONTACT_REPLAY_FUSED_ARITHMETIC entries: Dict[Tuple[Any, ...], Tuple[Any, ...]] = {} missing = object() @@ -291,6 +311,7 @@ def cache_key( EQUATION_MAP_SHA256, QUADRATURE_AUTHORITY_ID, PL_COMPLETION_POLICY_ID, + arithmetic, array_identity( geometry["local_coordinates"], (3, 2), "local-coordinate" ), @@ -469,8 +490,18 @@ def calculate( total_local = physical_local + pl_local transform = np.asarray(geometry["local_from_external"], dtype=np.float64) + if fused_congruence: + # Imported at call time: the arithmetic module lives in the + # general_contact package, which imports this element layer. + from .general_contact.native_replay_arithmetic import ( + s3_congruence_product, + ) + def globalize(matrix: np.ndarray) -> np.ndarray: - made = transform.T @ matrix @ transform + if fused_congruence: + made = s3_congruence_product(transform, matrix) + else: + made = transform.T @ matrix @ transform return 0.5 * (made + made.T) membrane = globalize(membrane_local) @@ -497,11 +528,39 @@ def globalize(matrix: np.ndarray) -> np.ndarray: "relaxation_authority_sha256": RELAXATION_AUTHORITY_SHA256, } + route_names = ( + "compute_stiffness_matrix", + "compute_stiffness_components", + "_geometry", + "_constitutive", + "_operators", + "_validate_configuration", + "_coordinates", + "_validate_model_scope", + ) + + def require_canonical_receiver(receiver: Any) -> None: + """Fused option only: refuse a receiver whose stiffness route could be + replaced. Runs before any cache access.""" + + kind = type(receiver) + if kind is StrictFlatLinearE4PLS3V2CShellElement: + return # frozen class: its own guards reject instance shadows + from .e4_pl_s3_v2d_element import NativeParityE4PLS3V2DShellElement + + if kind is not NativeParityE4PLS3V2DShellElement: + fail("fused congruence receiver is not an exact V2C/V2D element") + namespace = object.__getattribute__(receiver, "__dict__") + if any(name in namespace for name in route_names): + fail("fused congruence receiver shadows a stiffness route") + def compute_stiffness_components( self: Any, mesh: FEMesh, material: Material, ) -> Mapping[str, Any]: + if fused_congruence: + require_canonical_receiver(self) # Admission and all live instance/model/material guards deliberately run # before any cache observation. Only exact validated numeric inputs # enter the closure-owned key. @@ -530,10 +589,20 @@ def compute_stiffness_components( compute_stiffness_components.__qualname__ = ( "StrictFlatLinearE4PLS3V2CShellElement.compute_stiffness_components" + if not fused_congruence + else "compute_contact_replay_stiffness_components" ) return compute_stiffness_components +# Module-level (never installed on the guarded class): the same guarded +# geometry/constitutive/operator path with the fixed fused congruence. Call +# with an exact V2C/V2D element; every admission guard runs inside. +compute_contact_replay_stiffness_components = ( + _make_exact_component_compute_wrapper(CONTACT_REPLAY_FUSED_ARITHMETIC) +) + + def _validate_module_authority( _expected_hammer_points: np.ndarray = HAMMER_POINTS, _expected_hammer_weights: np.ndarray = HAMMER_REFERENCE_WEIGHTS, diff --git a/src/anyfesolver/general_contact/native_curved_s3_work.py b/src/anyfesolver/general_contact/native_curved_s3_work.py index 76a3f5e88..07b9f5095 100644 --- a/src/anyfesolver/general_contact/native_curved_s3_work.py +++ b/src/anyfesolver/general_contact/native_curved_s3_work.py @@ -110,7 +110,8 @@ def _relative_center(high,low,cell,t,origin,arm=None): class _S3CandidateIntegration(NativeCurvedMaterialPlaneWork): """Disposable target data; no mutable candidate cache on the public adapter.""" - def __init__(self,work,corners): + def __init__(self,work,corners,*,replay_norms=False): + self._replay_norms = replay_norms normal,dn,hn=_normal_derivatives(corners) # A represented corner is on the represented facet. A rounded centroid # need not lie on its plane at a large common origin. @@ -207,6 +208,13 @@ def _spatial_tangent(self,residual,hessian): result[:42,:42]=spatial_jacobian(residual[:42],hessian[:42,:42]) return result + def _bound_norm(self, values): + if self._replay_norms: + # Sum binary64 squares in a fixed order before taking the root. + # The archived enclosure uses the Euclidean (or Frobenius) norm. + return sqrt(fsum(float(x) * float(x) for x in values.flat)) + return np.linalg.norm(values) + def _root_work_bound(self,high,low,U,cell,width,angular_width,geometry, settings,stiffness,normal,pad,*,fallback=False,interval=None,station=None, declared_arc=False): @@ -221,7 +229,7 @@ def _root_work_bound(self,high,low,U,cell,width,angular_width,geometry, w=self.shell_map*scale dn=self.dn@w;o=self.origin_map@w hn=np.einsum('ijk,ja,kb->iab',self.hn,w,w) - n1=np.linalg.norm(dn);n2=np.linalg.norm(hn);o1=np.linalg.norm(o,2) + n1=np.linalg.norm(dn);n2=self._bound_norm(hn);o1=np.linalg.norm(o,2) center=[_relative_center(high,low,cell,t,self.origin) for t in (0.,1.)] distance=max(deterministic_norm(v) for v in center)+arm chord=np.array([fsum((high[cell+1,i],low[cell+1,i],-high[cell,i],-low[cell,i])) @@ -245,7 +253,7 @@ def _root_work_bound(self,high,low,U,cell,width,angular_width,geometry, for arm in (base,base+U[cell]@(r*frame[:,1]),base+U[cell]@(r*frame[:,2]))] circular=np.column_stack((gradients[1]-gradients[0],gradients[2]-gradients[0])) angular=(_declared_arc_gradient_bound(gradients[0],circular,self.rule.definition['angle_range']) - if declared_arc else np.linalg.norm(gradients[0])+np.linalg.norm(circular,2)) + if declared_arc else self._bound_norm(gradients[0])+np.linalg.norm(circular,2)) tight=angular+max(abs(station-x) for x in interval)*gx g=min(g,tight*(1+8192*np.finfo(float).eps)) if declared_arc: @@ -453,11 +461,11 @@ def result(ok,reason): pending.extend(((left,mid),(mid,right))) return result(True,'whole curved source and moving-S3 gap/rim/orientation bounded') - def evaluate(self,positions,position_low,rotations,u): + def evaluate(self,positions,position_low,rotations,u,*,replay_norms=False): pose=self._configuration(positions,position_low,rotations,u) extent,clearance=self._geometry(pose) corners=self.shell.current_positions(u) - integral=_S3CandidateIntegration(self,corners).evaluate(positions,position_low,rotations) + integral=_S3CandidateIntegration(self,corners,replay_norms=replay_norms).evaluate(positions,position_low,rotations) residual=integral.residual bf=np.array([-residual[6*i:6*i+3] for i in range(3)]) sf=-residual[42:][self.shell_translation_dofs] diff --git a/src/anyfesolver/general_contact/native_multi_s3_static.py b/src/anyfesolver/general_contact/native_multi_s3_static.py index 42cadac68..523ddcff2 100644 --- a/src/anyfesolver/general_contact/native_multi_s3_static.py +++ b/src/anyfesolver/general_contact/native_multi_s3_static.py @@ -3,6 +3,7 @@ All native internal unknowns and complete structural/contact blocks are retained. This does not widen the original single-native/single-S3 profile. """ +import copy from dataclasses import dataclass, replace from contextlib import nullcontext from hashlib import sha256 @@ -30,6 +31,19 @@ from .native_shell_static_driver import solve_native_shell from .native_replay_diagnostics import component_digests, replay_difference_message +class _ShellArithmeticUnavailable(ValueError): + """The alternate shell stiffness arithmetic does not apply to this shell.""" + + +# Stiffness route of the exact V2D element, pinned at import. The fused +# arithmetic bypasses these entries, so any instance or class replacement +# must be refused rather than silently skipped. +_V2D_STIFFNESS_ROUTE = {name: vars(NativeParityE4PLS3V2DShellElement).get(name) for name in ( + 'compute_stiffness_matrix', 'compute_stiffness_components', '_geometry', '_constitutive', + '_operators', '_validate_configuration', '_is_v2c_elastic_overlap', '_coordinates', + '_validate_model_scope', '_membrane_operator', '_pl_constraint')} + + PROFILE = 'NATIVE_B3_GE_MULTIPLE_ELASTIC_S3_INTERIORS_STATIC_DEV_V1' MATERIAL_PROFILE = 'NATIVE_B3_GE_TWO_MATERIAL_PATCHES_SHARED_S3_STATIC_DEV_V1' MATERIAL_MULTIPATCH_PROFILE = 'NATIVE_B3_GE_MULTIPLE_MATERIAL_PATCHES_S3_STATIC_DEV_V1' @@ -284,21 +298,136 @@ def __init__(self, definitions, boundaries, program, shell_model, pairs, *, self._assembly_reuse_entry = None self._construction_contact_entry = None self.curved_trial_failures=[] + # Identity of this owner as constructed (original arithmetic). It + # authorises only the return from a switched arithmetic. + self._constructed_identity = self.identity + self.initial, self._construction_contact_entry = self._construct_initial() + + def _construct_initial(self): + """The accepted initial state and its reusable construction evaluation + under the CURRENT shell arithmetic (constructor and arithmetic switch).""" initial = self.context.initial - u = np.zeros(n_shell) + u = np.zeros(self.shell_model.mesh.dof_manager.total_dofs) first = self._contact(initial.mechanical, u) for p, r in first.pairs: scale = max(1., np.max(np.abs(p.work.contact.beam_reference.coordinates)), np.max(np.abs(p.work.shell.reference_positions))) if r.contact.minimum_gap_m < -256*np.finfo(float).eps*scale: raise ValueError(p.name+': unresolved initial native/S3 penetration') - self.initial = NativeMultiS3Accepted(initial.mechanical, initial.histories, _readonly(u), 0, first) + accepted = NativeMultiS3Accepted(initial.mechanical, initial.histories, _readonly(u), 0, first) + entry = None if self._fibre_mode and self._curved_mode: # The construction preflight already evaluated this exact pose; # the first candidate assembly reuses it under the unchanged # key/intactness validation instead of duplicating that work. - self._construction_contact_entry = (self._contact_cache_key(initial.mechanical, u), - first, _candidate_work_signature(first)) + entry = (self._contact_cache_key(initial.mechanical, u), first, _candidate_work_signature(first)) + return accepted, entry + + def _rebind_initial(self): + """Re-derive the initial state after a successful arithmetic switch. + + Curved contact work depends on the selected arithmetic (replay norms), + so the initial evaluation made in the previous arithmetic is not valid. + Evaluation counters and trial failures describe candidate work, not + this re-derivation, and are left as they were.""" + if not self._curved_mode: + return + counters = (self.candidate_evaluations, self.pair_evaluations) + failures = len(self.curved_trial_failures) + try: + self.initial, self._construction_contact_entry = self._construct_initial() + finally: + self.candidate_evaluations, self.pair_evaluations = counters + del self.curved_trial_failures[failures:] + + # 'host_blas' is the established path (stiffness bits follow the host BLAS + # kernel) and is the original dispatch of the element's own stiffness + # method. 'contact_replay_fused' replaces ONLY the final 18x18 congruence + # product of the V2C stiffness by a fixed fused order that reproduced the + # archived matrices in the supplied traces; geometry, operators and local + # products are still evaluated by the host libraries. It is therefore a + # specification of one product, not a claim of host independence. + # The mode is deliberately NOT part of the identity: the identity hashes + # the stiffness bits themselves, and _restore tries the other mode only for + # an authorised recorded identity and keeps it only after a full + # recomputation reproduces that identity and every record replays. + _shell_arithmetic = 'host_blas' + _FUSED_ARITHMETIC = 'contact_replay_fused' + # Original archived identities for which the fused arithmetic may be tried. + # They authorise an attempt only; acceptance still needs exact recomputation. + _FUSED_AUTHORISED_IDENTITIES = frozenset({ + 'ecb95a0380bbb136c237060e3affcc8cb38591d00e0536fb3fe631b78707b5df', + '00d6c0a0f66311a8791a42461ef78a4a285c8c0c7b4cd746ff4d2856b67b92be'}) + + def _authorised_alternate_arithmetic(self, recorded_identity): + """The other arithmetic to try for *recorded_identity*, or None.""" + if self._shell_arithmetic == 'host_blas': + return self._FUSED_ARITHMETIC if recorded_identity in self._FUSED_AUTHORISED_IDENTITIES else None + if recorded_identity == getattr(self, '_constructed_identity', None): + return 'host_blas' + return None + + def _element_stiffness(self, element, mesh, material): + if self._shell_arithmetic == 'host_blas': + return element.compute_stiffness_matrix(mesh, material) + if self._shell_arithmetic != self._FUSED_ARITHMETIC: + raise ValueError('multiple native/S3 unknown shell arithmetic') + # The fused path bypasses the element's stiffness dispatch, so refuse + # unless that dispatch is exactly the pinned canonical one. + namespace = object.__getattribute__(element, '__dict__') + if (type(element) is not NativeParityE4PLS3V2DShellElement + or any(name in namespace for name in _V2D_STIFFNESS_ROUTE) + or any(vars(NativeParityE4PLS3V2DShellElement).get(name) is not entry + for name, entry in _V2D_STIFFNESS_ROUTE.items())): + raise ValueError('multiple native/S3 fused shell arithmetic refuses a shadowed or replaced stiffness route') + element._validate_configuration() + if (element.shell_section is not None or not element._is_v2c_elastic_overlap(material) + or element.director_polarity != 1 or element.reference_surface_offset != 0.): + raise _ShellArithmeticUnavailable('multiple native/S3 fused shell arithmetic requires the elastic V2C overlap element') + from anyfesolver.e4_pl_s3_v2c_element import compute_contact_replay_stiffness_components + return np.array(compute_contact_replay_stiffness_components(element, mesh, material)['total'], float) + + # Fields that define the stiffness/identity binding. They are replaced + # together by a single dict update so no reader of a supported (GIL- + # serialised) thread sees a mix of two arithmetics. + _SHELL_BINDING_FIELDS = ('_shell_arithmetic', 'shell_stiffness', 'shell_free', 'shell_fixed', + 'shell_contract_sha', 'identity') + # Everything a restore replay may touch that can influence later operation. + _RESTORE_STATE_FIELDS = _SHELL_BINDING_FIELDS + ( + 'initial', '_contact_reuse_entry', '_assembly_reuse_entry', '_construction_contact_entry', + 'candidate_evaluations', 'pair_evaluations', 'contact_reuse_hits', 'assembly_reuse_hits', + 'activation_total_queries') + + def _probe_shell_arithmetic(self, mode): + """Shell binding under *mode*, computed on a private shallow copy. + + The owner is never modified. Returns the field mapping, or None when + the mode does not apply to this shell (only that case is swallowed).""" + probe = copy.copy(self) + probe._shell_arithmetic = mode + try: + K, free, fixed = probe._shell_contract() + except _ShellArithmeticUnavailable: + return None + probe.shell_stiffness = _readonly(K) + free.setflags(write=False); fixed.setflags(write=False) + probe.shell_free, probe.shell_fixed = free, fixed + probe.shell_contract_sha = probe._shell_contract_sha() + probe.identity = probe._identity() + return {name: probe.__dict__[name] for name in self._SHELL_BINDING_FIELDS} + + def _restore_snapshot(self): + state = self.__dict__ + return ({name: state[name] for name in self._RESTORE_STATE_FIELDS if name in state}, + len(self.curved_trial_failures)) + + def _restore_rollback(self, snapshot): + fields, failures = snapshot + for name in self._RESTORE_STATE_FIELDS: + if name not in fields: + self.__dict__.pop(name, None) + self.__dict__.update(fields) + del self.curved_trial_failures[failures:] def _shell_contract(self): model = self.shell_model @@ -319,7 +448,7 @@ def _shell_contract(self): raise ValueError('multiple native/S3 owner requires isotropic elastic skin material') nodes.update(element.node_ids) slots = np.asarray(element.get_dof_mapping(model.mesh), int) - local = element.compute_stiffness_matrix(model.mesh, material) + local = self._element_stiffness(element, model.mesh, material) if local.shape != (18, 18) or not np.all(np.isfinite(local)): raise ValueError('multiple native/S3 structural block invalid') K[np.ix_(slots, slots)] += local @@ -416,8 +545,12 @@ def _contact(self, mechanical, displacement): for p, i in zip(self.pairs, self.beam_indices): nodes = self.context.nodes[i] try: - result = p.work.evaluate(mechanical.positions[nodes], mechanical.position_low[nodes], - mechanical.cell_rotations[i], displacement) + arguments = (mechanical.positions[nodes], mechanical.position_low[nodes], + mechanical.cell_rotations[i], displacement) + if self._curved_mode and self._shell_arithmetic == self._FUSED_ARITHMETIC: + result = p.work.evaluate(*arguments, replay_norms=True) + else: + result = p.work.evaluate(*arguments) except (ValueError,MemoryError) as exc: if self._curved_mode: self.curved_trial_failures.append(dict(pair=p.name,error=type(exc).__name__+': '+str(exc), @@ -627,6 +760,39 @@ def _binding_token(value): text = repr(value) return text if len(text) <= 96 else text[:93] + '...' body_sha256 = sha(body) + # Legacy host-BLAS owners: the recorded identity may have been sealed + # with the SkylakeX-observed stiffness bits. Adopt the fixed fused + # arithmetic only if it reproduces that identity exactly; every other + # component, the model and the settings remain exactly checked. + # + # Transaction: the owner is committed to an alternate arithmetic only + # for the replay below, and ANY exception (refusal, replay mismatch, + # cancellation, unexpected error) restores every binding field, cache + # entry and counter the replay can touch, so a failed restore leaves + # the owner exactly as it was. + snapshot = self._restore_snapshot() + try: + return self._restore_bound(raw, value, body_sha256, _binding_token) + except BaseException: + self._restore_rollback(snapshot) + raise + + def _restore_bound(self, raw, value, body_sha256, _binding_token): + if (type(value['identity']) is str and value['identity'] != self.identity + and value['schema'] == self.schema and value['profile'] == self.profile + and body_sha256 == value['checkpoint_sha256']): + # Only an authorised recorded identity triggers an alternate full + # assembly; any other identity goes straight to the binding refusal. + alternate = self._authorised_alternate_arithmetic(value['identity']) + adopted = None if alternate is None else self._probe_shell_arithmetic(alternate) + if adopted is not None and adopted['identity'] == value['identity']: + self.__dict__.update(adopted) + # Stiffness and curved contact error bounds use the selected arithmetic. + self._assembly_reuse_entry = None + self._contact_reuse_entry = None + self._construction_contact_entry = None + # The initial state was built in the previous arithmetic. + self._rebind_initial() disagreements = [] if value['schema'] != self.schema: disagreements.append('schema checkpoint=%s owner=%s' % (_binding_token(value['schema']), _binding_token(self.schema))) diff --git a/src/anyfesolver/general_contact/native_replay_arithmetic.py b/src/anyfesolver/general_contact/native_replay_arithmetic.py index 70c7b350b..c207d1969 100644 --- a/src/anyfesolver/general_contact/native_replay_arithmetic.py +++ b/src/anyfesolver/general_contact/native_replay_arithmetic.py @@ -60,6 +60,59 @@ def _native_preparation_allowed(): and getattr(function, 'errcheck', None) is None) +_S3_ORDER = 18 +_S3_TAIL_COLUMNS = (16, 17) + + +def s3_congruence_product(transform, matrix): + """Fixed-order fused ``transform.T @ matrix @ transform`` for 18x18 S3 data. + + This reproduces the archived S3 shell-stiffness globalization bits for the + contact checkpoints whose first product ``transform.T @ matrix`` and second + product ``first @ transform`` were observed on a SkylakeX OpenBLAS kernel. + It is a fixed arithmetic specification only; it makes no claim about any + BLAS kernel or any other operand set. + + First product: every entry is an ascending-index fused accumulation from + +0. Second product: columns 0..15 use the same single ascending fused + accumulation; columns 16 and 17 use two independent accumulators, one for + even and one for odd inner indices, added once at the end. The result is + not symmetrized or rounded here. + """ + left = np.asarray(transform, dtype=float) + right = np.asarray(matrix, dtype=float) + if left.shape != (_S3_ORDER, _S3_ORDER) or right.shape != left.shape: + raise ValueError('S3 congruence product requires 18x18 operands') + if not np.all(np.isfinite(left)) or not np.all(np.isfinite(right)): + raise ValueError('S3 congruence product requires finite operands') + t_columns = [list(map(float, column)) for column in left.T] # rows of T.T + m_columns = [list(map(float, column)) for column in right.T] + first = np.empty((_S3_ORDER, _S3_ORDER)) + for i, a_row in enumerate(t_columns): + for j, b_col in enumerate(m_columns): + acc = 0. + for a, b in zip(a_row, b_col): + acc = _fma(a, b, acc) + first[i, j] = acc + rows = [list(map(float, row)) for row in first] + t_cols = [list(map(float, column)) for column in left.T] + result = np.empty((_S3_ORDER, _S3_ORDER)) + for i, a_row in enumerate(rows): + for j, b_col in enumerate(t_cols): + if j in _S3_TAIL_COLUMNS: + even = odd = 0. + for k in range(0, _S3_ORDER, 2): + even = _fma(a_row[k], b_col[k], even) + odd = _fma(a_row[k+1], b_col[k+1], odd) + result[i, j] = even + odd + else: + acc = 0. + for a, b in zip(a_row, b_col): + acc = _fma(a, b, acc) + result[i, j] = acc + return result + + def gap_vector_product(matrix, vector): """The fixed 9x3 gap map applied to a three-component spatial vector.""" matrix = np.asarray(matrix, dtype=float) diff --git a/tests/test_general_contact_native_curved_s3_static.py b/tests/test_general_contact_native_curved_s3_static.py index b611b8440..1b34dc3fb 100644 --- a/tests/test_general_contact_native_curved_s3_static.py +++ b/tests/test_general_contact_native_curved_s3_static.py @@ -10,6 +10,29 @@ def _analysis(**kwargs): return runpy.run_path(str(Path(__file__).parents[1]/'examples/general_contact_native_curved_material_s3.py'))['analysis'](**kwargs) +def test_s3_congruence_product_fixed_fused_order_and_refusals(): + """Synthetic: the specified accumulation order, not a kernel equivalence.""" + from anyfesolver.general_contact.native_replay_arithmetic import s3_congruence_product + eps = 2.**-53 + # With M = I the first product is exactly T.T, so entry (i,j) of the result is + # sum_k T[k,i]*T[k,j] and only the accumulation order of the second product + # is observable. Row 0 of T.T is (eps, 1, eps, 0, ...); columns 15..17 are ones. + T = np.zeros((18, 18)); T[0, 0], T[1, 0], T[2, 0] = eps, 1., eps + T[:, 15:] = 1. + R = s3_congruence_product(T, np.eye(18)) + assert R[0, 15] == 1. # ascending single accumulation: ties to 1 + assert R[0, 16] == R[0, 17] == 1.+2*eps # even (eps+eps) + odd (1) accumulators + # Exactly representable data: every order gives the exact product. + rng = np.random.default_rng(5) + A = rng.integers(-8, 9, (18, 18)).astype(float); B = rng.integers(-8, 9, (18, 18)).astype(float) + np.testing.assert_array_equal(s3_congruence_product(A, B), A.T @ B @ A) + for bad in (np.zeros((17, 18)), np.full((18, 18), np.nan)): + with pytest.raises(ValueError): + s3_congruence_product(bad, np.eye(18)) + with pytest.raises(ValueError): + s3_congruence_product(np.eye(18), bad) + + def test_curved_s3_coupled_first_contact_complete_retained_and_target_work(): owner=_analysis(targets=(1.,));run=owner.solve() path=os.environ.get('CONTACT_APP_RESULT_RECORD') diff --git a/tests/test_general_contact_native_two_fibre_s3.py b/tests/test_general_contact_native_two_fibre_s3.py index 1679b9f5e..89a1441a2 100644 --- a/tests/test_general_contact_native_two_fibre_s3.py +++ b/tests/test_general_contact_native_two_fibre_s3.py @@ -170,6 +170,155 @@ def test_two_fibre_beams_actual_coupled_history_and_restart(two_facets): Path(output+'-two-beam.json').write_text(json.dumps(report,indent=2)) +def _skewed_host_owner(monkeypatch,two_facets): + """Owner whose HOST stiffness differs by one bit on every kernel, so the + archived identity is reachable only through the fused-arithmetic adoption.""" + cls=type(_owner(two_facets));original=cls._element_stiffness + def skewed(self,element,mesh,material): + k=original(self,element,mesh,material) + if self._shell_arithmetic=='host_blas': + k=np.array(k,copy=True);k[0,0]=np.nextafter(k[0,0],np.inf) + return k + monkeypatch.setattr(cls,'_element_stiffness',skewed) + return _owner(two_facets) + + +def _owner_state(owner): + return dict(mode=owner._shell_arithmetic,identity=owner.identity,sha=owner.shell_contract_sha, + stiffness=owner.shell_stiffness.copy(),free=owner.shell_free.copy(),fixed=owner.shell_fixed.copy(), + counters=(owner.candidate_evaluations,owner.pair_evaluations,owner.contact_reuse_hits,owner.assembly_reuse_hits), + failures=list(owner.curved_trial_failures),contact_entry=owner._contact_reuse_entry, + assembly_entry=owner._assembly_reuse_entry,construction=owner._construction_contact_entry, + initial=owner.initial) + + +def _assert_owner_state(owner,before): + after=_owner_state(owner) + for key in ('stiffness','free','fixed'):np.testing.assert_array_equal(after.pop(key),before[key]) + for key in ('mode','identity','sha','counters','failures'):assert after[key]==before[key],key + for key in ('contact_entry','assembly_entry','construction','initial'):assert after[key] is before[key],key + assert owner._identity()==owner.identity and owner._shell_contract_sha()==owner.shell_contract_sha + + +def test_failed_restore_after_identity_adoption_restores_every_owner_state(monkeypatch): + from anyfesolver._ge_beam3_p5_seeded.core import sha + fixture=Path(__file__).parent/'data/general_contact_native_fibre_s3_plastic_two_beams_two_patches_v1.checkpoint' + raw=fixture.read_bytes();digest=sha256(raw).hexdigest() + owner=_skewed_host_owner(monkeypatch,True) + assert owner._shell_arithmetic=='host_blas' and owner.identity!=json.loads(raw)['identity'] + owner._assembly_reuse_entry=('stale-key','stale-value','stale-signature') # arbitrary disposable cache entry + owner._construction_contact_entry=('previous-mode', None, None) + before=_owner_state(owner) + # Authenticated (resealed, chain-valid) record that the exact replay refuses. + value=json.loads(raw);value['records'][0]['contact']['tangent_error_n_per_m']*=1.5 + body={k:v for k,v in value.items() if k!='checkpoint_sha256'} + forged=canonical({**body,'checkpoint_sha256':sha(body)}) + with owner.context.operation(None),pytest.raises(ValueError,match='replay mismatch'): + owner._restore(forged,sha256(forged).hexdigest()) + _assert_owner_state(owner,before) + # An unexpected (non-ValueError) exception during candidate evaluation. + def boom(*args,**kwargs):raise RuntimeError('unexpected candidate failure') + owner.__dict__['_record']=boom + try: + with owner.context.operation(None),pytest.raises(RuntimeError,match='unexpected'): + owner._restore(raw,digest) + finally:del owner.__dict__['_record'] + _assert_owner_state(owner,before) + # The refused attempts left no trace: the same owner now restores exactly, + # adopting the fused arithmetic only for the authentic checkpoint. + with owner.context.operation(None): + restored,records=owner._restore(raw,digest) + assert owner._shell_arithmetic=='contact_replay_fused' and owner.identity==json.loads(raw)['identity'] + assert owner._assembly_reuse_entry is None + assert owner._construction_contact_entry is not before['construction'] + assert owner._construction_contact_entry[1] is owner.initial.contact + assert owner._contact_reuse_entry is None + assert owner._checkpoint(records)==raw + + +_TWO_PATCHES='general_contact_native_fibre_s3_plastic_two_beams_two_patches_v1.checkpoint' + + +def _resealed(raw,edit): + from anyfesolver._ge_beam3_p5_seeded.core import sha + value=json.loads(raw);edit(value) + body={k:v for k,v in value.items() if k!='checkpoint_sha256'} + return canonical({**body,'checkpoint_sha256':sha(body)}) + + +def test_fused_arithmetic_refuses_shadowed_stiffness_route_before_any_cache_access(monkeypatch): + import inspect + import anyfesolver.e4_pl_s3_v2c_element as v2c + raw=(Path(__file__).parent/'data'/_TWO_PATCHES).read_bytes();digest=sha256(raw).hexdigest() + owner=_skewed_host_owner(monkeypatch,True);before=_owner_state(owner) + entries=inspect.getclosurevars(v2c.compute_contact_replay_stiffness_components).nonlocals['entries'] + cached=dict(entries) + element=next(iter(owner.shell_model.mesh.elements.values()));cls=type(element) + # Equivalent override: the host (original-dispatch) identity is unchanged, so + # only the fused arithmetic can notice that the route is not canonical. + element.__dict__['compute_stiffness_matrix']=lambda mesh,material:cls.compute_stiffness_matrix(element,mesh,material) + try: + with owner.context.operation(None),pytest.raises(ValueError,match='shadowed or replaced'): + owner._restore(raw,digest) + _assert_owner_state(owner,before) + # The V2C fused cache entry independently refuses the receiver first. + mesh=owner.shell_model.mesh;material=owner.shell_model.materials[element.material_name] + with pytest.raises(v2c.StrictFlatLinearCapabilityError,match='shadows a stiffness route'): + v2c.compute_contact_replay_stiffness_components(element,mesh,material) + assert dict(entries)==cached + with pytest.raises(v2c.StrictFlatLinearCapabilityError,match='exact V2C/V2D'): + v2c.compute_contact_replay_stiffness_components(object(),mesh,material) + assert dict(entries)==cached + finally:del element.__dict__['compute_stiffness_matrix'] + with owner.context.operation(None): + owner._restore(raw,digest) # canonical route: the same owner adopts and restores + assert owner._shell_arithmetic=='contact_replay_fused' + + +def test_unrelated_identity_never_probes_alternate_arithmetic(monkeypatch): + raw=(Path(__file__).parent/'data'/_TWO_PATCHES).read_bytes() + owner=_skewed_host_owner(monkeypatch,True);before=_owner_state(owner) + def forbidden(*args,**kwargs):raise AssertionError('alternate arithmetic probed for an unauthorised identity') + owner.__dict__['_probe_shell_arithmetic']=forbidden + wrong=_resealed(raw,lambda v:v.update(identity='ab'*32)) + with owner.context.operation(None),pytest.raises(ValueError,match='binding'): + owner._restore(wrong,sha256(wrong).hexdigest()) + _assert_owner_state(owner,before) + archived=json.loads(raw)['identity'] + assert owner._authorised_alternate_arithmetic(archived)=='contact_replay_fused' + assert owner._authorised_alternate_arithmetic('ab'*32) is None + assert owner._authorised_alternate_arithmetic(owner._constructed_identity) is None + owner.__dict__['_shell_arithmetic']='contact_replay_fused' + assert owner._authorised_alternate_arithmetic(owner._constructed_identity)=='host_blas' + assert owner._authorised_alternate_arithmetic('ab'*32) is None + assert owner._authorised_alternate_arithmetic(archived) is None + + +def test_zero_target_restore_after_arithmetic_switch_rebinds_initial_state(monkeypatch): + raw=(Path(__file__).parent/'data'/_TWO_PATCHES).read_bytes() + zero=_resealed(raw,lambda v:v.update(completed_targets=0,records=[])) + owner=_skewed_host_owner(monkeypatch,True);assert owner._curved_mode + before=_owner_state(owner) + # A failure after the switch (initial state already rebound) restores the old initial and caches. + def boom(*args,**kwargs):raise RuntimeError('unexpected checkpoint failure') + owner.__dict__['_checkpoint']=boom + try: + with owner.context.operation(None),pytest.raises(RuntimeError,match='unexpected'): + owner._restore(zero,sha256(zero).hexdigest()) + finally:del owner.__dict__['_checkpoint'] + _assert_owner_state(owner,before) + with owner.context.operation(None): + accepted,records=owner._restore(zero,sha256(zero).hexdigest()) + assert records==() and owner._shell_arithmetic=='contact_replay_fused' + assert accepted is owner.initial and accepted is not before['initial'] + assert owner._construction_contact_entry[1] is accepted.contact + # The returned initial work is exactly what the new arithmetic evaluates now. + from anyfesolver.general_contact.native_multi_s3_static import _candidate_work_signature + fresh=owner._contact(accepted.mechanical,np.zeros(len(accepted.shell_displacement))) + assert _candidate_work_signature(fresh)==_candidate_work_signature(accepted.contact) + assert owner._checkpoint(records)==zero + + @pytest.mark.parametrize('two_facets',(False,True),ids=('one-patch','two-patches')) def test_two_fibre_saved_example_cli_recovery(tmp_path,monkeypatch,two_facets): import runpy,sys @@ -232,10 +381,26 @@ def test_two_fibre_saved_example_cli_recovery(tmp_path,monkeypatch,two_facets): independent_gap_m=gaps,normalized_force_balance=float(np.linalg.norm(force)/.008), normalized_moment_balance=float(np.linalg.norm(moment)/.02),checkpoint_sha256=digest, element_ids=[row['element_id'] for row in elements],two_facets=two_facets),indent=2)) + # Whichever stiffness arithmetic reproduced the recorded identity, the + # owner identity is exactly the archived one and the matrices stay consistent. + assert owner._shell_arithmetic in ('host_blas','contact_replay_fused') + assert owner.identity==json.loads(fixture.read_bytes())['identity'] + assert owner.shell_contract_sha==owner._shell_contract_sha() + np.testing.assert_array_equal(owner.shell_stiffness,owner._shell_contract()[0]) if two_facets: single=Path(__file__).parent/'data/general_contact_native_fibre_s3_plastic_two_beams_v1.checkpoint' raw=single.read_bytes() with pytest.raises(ValueError,match='binding'):owner._restore(raw,sha256(raw).hexdigest()) + # A resealed checkpoint with one identity digit changed is refused and + # leaves the owner's arithmetic, identity and stiffness untouched. + from anyfesolver._ge_beam3_p5_seeded.core import sha + mode,identity,stiffness=owner._shell_arithmetic,owner.identity,owner.shell_stiffness.copy() + value=json.loads(fixture.read_bytes());body={k:v for k,v in value.items() if k!='checkpoint_sha256'} + body['identity']=('0' if body['identity'][0]!='0' else '1')+body['identity'][1:] + forged=canonical({**body,'checkpoint_sha256':sha(body)}) + with pytest.raises(ValueError,match='binding'):owner._restore(forged,sha256(forged).hexdigest()) + assert (owner._shell_arithmetic,owner.identity)==(mode,identity) + np.testing.assert_array_equal(owner.shell_stiffness,stiffness) def _fixture_owner(two_facets): From a8d401ae8a0173c4b9d75baea73fffb5455ef353 Mon Sep 17 00:00:00 2001 From: Audun Arnesen Nyhus Date: Thu, 12 Nov 2026 10:09:11 +0100 Subject: [PATCH 15/15] Verify both project identities in the stable publishing graph --- tests/test_anyfileio_version_compatibility.py | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/test_anyfileio_version_compatibility.py b/tests/test_anyfileio_version_compatibility.py index 84286f4f5..1a6cc3f73 100644 --- a/tests/test_anyfileio_version_compatibility.py +++ b/tests/test_anyfileio_version_compatibility.py @@ -404,8 +404,10 @@ def test_workflows_pin_compatibility_graph_and_actions() -> None: "dependency-gate", "build", "testpypi", + "testpypi-solver", "stage", "pypi", + "pypi-solver", ] ci_hashes = set(re.findall(r"\b[0-9a-f]{40}\b", ci)) @@ -507,12 +509,11 @@ def action_sequence(block: str) -> list[str]: ): assert argument in build_block, argument assert "name: release-050-distributions" in build_block - for stage in ("testpypi", "pypi"): + for stage in ("testpypi", "testpypi-solver", "pypi", "pypi-solver"): assert action_sequence(job_block(publish, stage)) == [ checkout_ref, download_ref, publish_ref, - publish_ref, ], stage checkout_pattern = re.compile( @@ -813,8 +814,15 @@ def nested_lines(block: str, key: str) -> list[str]: dependency_job = job_block(publish, "dependency-gate") assert "TARGET_INDEX_URL" not in dependency_job assert "--index-url https://pypi.org/simple" in dependency_job - testpypi_job = job_block(publish, "testpypi") - pypi_job = job_block(publish, "pypi") + for index_job in ("testpypi", "pypi"): + results = job_block(publish, index_job) + solver = job_block(publish, index_job + "-solver") + assert preamble_keys(solver)["needs"] == f"[validate, {index_job}]" + assert "environment:" not in solver + assert "packages-dir: plan/results/" in results and "packages-dir: plan/solver/" not in results + assert "packages-dir: plan/solver/" in solver and "packages-dir: plan/results/" not in solver + testpypi_job = job_block(publish, "testpypi") + job_block(publish, "testpypi-solver") + pypi_job = job_block(publish, "pypi") + job_block(publish, "pypi-solver") # One legacy-endpoint override per project upload step, TestPyPI only. assert testpypi_job.count( "repository-url: https://test.pypi.org/legacy/" @@ -847,7 +855,7 @@ def nested_lines(block: str, key: str) -> list[str]: ), "PyPI promotion must require TestPyPI to serve the identical digests" # Least privilege: workflow read-only; only validate adds actions: read and - # only the two index jobs add id-token: write. + # only the four package upload jobs add id-token: write. def job_permissions(name: str) -> list[str] | None: match = re.search( r"(?m)^ permissions:\n((?:^ [^\n]*\n)+)", @@ -861,7 +869,8 @@ def job_permissions(name: str) -> list[str] | None: ] assert job_permissions("stage") == job_permissions("validate") assert job_permissions("testpypi") == [" contents: read", " id-token: write"] - assert job_permissions("pypi") == [" contents: read", " id-token: write"] + for name in ("pypi", "testpypi-solver", "pypi-solver"): + assert job_permissions(name) == [" contents: read", " id-token: write"] for name in ("license-gate", "dependency-gate", "build"): assert job_permissions(name) is None, name assert "permissions:" not in job_block(publish, name)