"""Promotion gates for the out-of-template incomplete-physics closure.""" import json from pathlib import Path from src.generate_t2_graybox_closure import MATERIAL, closure_design, material, solve from src.validate_t2_graybox import ( load_model, structural_gate, time_discretization_gate, ) ROOT = Path(__file__).resolve().parents[1] MODEL_PATH = ROOT / "models" / "t2_graybox_closure_v1" / "denrm.pt" ARTIFACT_DIR = ROOT / "artifacts" / "t2_graybox_closure_v1" OUTPUT = ARTIFACT_DIR / "deployment_validation.json" def main() -> None: model = load_model(MODEL_PATH) ARTIFACT_DIR.mkdir(parents=True, exist_ok=True) result = { "scope": ( "reference has three memories and tabulated hardening; deployed DENRM " "has two memories and no access to the reference equations" ), "time_discretization": time_discretization_gate( model, rows=closure_design(4), solve_function=solve, material=MATERIAL, ), "structure": structural_gate( model, material=MATERIAL, native_law_factory=material, artifact_dir=ARTIFACT_DIR, ), } OUTPUT.write_text(json.dumps(result, indent=2) + "\n", encoding="utf-8") print(json.dumps(result, indent=2)) if __name__ == "__main__": main()