Download explore/PhaseLatch/scripts/plot_liquid_comparison.py from Travor278/RheoBench: direct link, hf CLI and curl.
- Browser
- Download file 1.77 kB
-
https://huggingface.co/datasets/Travor278/RheoBench/resolve/main/explore/PhaseLatch/scripts/plot_liquid_comparison.py
- Command line
-
hf download hf://datasets/Travor278/RheoBench/explore/PhaseLatch/scripts/plot_liquid_comparison.py
-
curl -L -o plot_liquid_comparison.py https://huggingface.co/datasets/Travor278/RheoBench/resolve/main/explore/PhaseLatch/scripts/plot_liquid_comparison.py
1.77 kB
| """Compare archived free responses and geometry diagnostics without rescaling.""" | |
| import json | |
| from pathlib import Path | |
| import numpy as np | |
| import matplotlib | |
| matplotlib.use('Agg') | |
| import matplotlib.pyplot as plt | |
| root=Path(__file__).resolve().parents[1]/'results/liquid_calibration_20261005' | |
| cases=[('compact_weak','Newton Q1/Q1d, original'), | |
| ('compact_weak_no_tension','Newton Q1/Q1d, zero tensile yield'), | |
| ('B2_projected_weak','Newton B2/P0'), | |
| ('Q1d_unilateral_fine2mm','Newton Q1/Q1d, zero tensile, 2 mm'), | |
| ('physx_dt625','PhysX PBD, 0.625 ms')] | |
| fig,ax=plt.subplots(1,2,figsize=(12.5,4.4),layout='constrained') | |
| for case,label in cases: | |
| report=json.loads((root/case/'report.json').read_text());rows=json.loads((root/case/'trajectory.json').read_text()) | |
| end=report['args']['settle']+report['args']['motion_time'] | |
| t=np.array([r['time'] for r in rows]);x=np.array([r['fluid_com_local'][0]*1000 for r in rows]) | |
| h=np.array([r['center_height_ratio'] for r in rows]);mask=t>=end | |
| ax[0].plot(t[mask]-end,x[mask],label=label,lw=1.6) | |
| ax[1].plot(t,h,label=label,lw=1.6) | |
| ax[0].set(xlabel='Time after cup stops (s)',ylabel='Fluid COM relative to cup, x (mm)',title='Free response: same 5 mm cup displacement') | |
| ax[1].axhspan(.95,1.05,color='#2a9d8f',alpha=.13,label='Provisional 5% geometry band') | |
| ax[1].set(xlabel='Simulation time (s)',ylabel='COM height / uniform-column reference',title='Geometry drift must also pass') | |
| for panel in ax:panel.grid(alpha=.16) | |
| ax[1].legend(fontsize=8,loc='lower left') | |
| fig.suptitle('Fluid candidates: compare free response and geometry together',fontsize=13) | |
| fig.savefig(root/'candidate_comparison.png',dpi=180) | |
| fig.savefig(root/'candidate_comparison.pdf') | |
| print(root/'candidate_comparison.png') | |