File size: 1,372 Bytes
bbe9b3e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | """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()
|