codex/past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2001/iii/paper-43-ventilation.py

past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2001/iii/paper-43-ventilation.py
"""Original schematic; Python 3.14, NumPy 2.3.5, Matplotlib 3.10.7; CWD output."""
import numpy as np
import matplotlib.pyplot as plt
fig,axs=plt.subplots(1,2,figsize=(12,5),facecolor='white');zi=.43;D=.77
for ax in axs:
 ax.fill_between([0,2],0,zi,color='#d9e8f3');ax.fill_between([0,2],zi,1,color='#f3c7a7');ax.plot([0,0,2],[0,1,1],color='black',lw=2);ax.plot([0,2],[0,0],color='black',lw=2);ax.axhline(zi,xmin=.15,xmax=.68,ls='--',color='#a16c45')
 z=np.linspace(.03,zi,80);r=.02+.2*z;ax.fill_betweenx(z,1-r,1+r,color='#d5894f');ax.annotate('',xy=(1,zi+.17),xytext=(1,.08),arrowprops={'arrowstyle':'->','lw':2,'color':'#91411f'});ax.scatter([1],[.02],s=50,color='#bc492c');ax.text(.2,.12,'cool supply');ax.text(.14,.83,'warm mixed reservoir');ax.annotate('interface at z_i',xy=(.45,zi),xytext=(-.48,.5),arrowprops={'arrowstyle':'->'},fontsize=9);ax.set(xlim=(-.65,3.3),ylim=(-.08,1.22),xlabel='horizontal position (schematic)');ax.set_yticks([0,zi,1],['0','z_i','H'])
axs[0].plot([2,2],[.08,.92],color='black',lw=2);axs[0].annotate('',xy=(2.9,1),xytext=(1.6,1),arrowprops={'arrowstyle':'->','lw':2,'color':'#91411f'});axs[0].annotate('',xy=(.5,.02),xytext=(-.5,.02),arrowprops={'arrowstyle':'->','lw':2,'color':'#245e85'});axs[0].text(2.35,1.08,'upper vent: Q');axs[0].text(-.5,-.07,'lower vent: Q',fontsize=9);axs[0].set_title('Two small vents: plume supply = ceiling exhaust')
axs[1].plot([2,2],[D,1],color='black',lw=3);axs[1].plot([2,2],[0,.02],color='black',lw=3);axs[1].plot([1.9,2.24],[D,D],color='black',lw=2);axs[1].annotate('',xy=(2.95,.9),xytext=(1.75,.62),arrowprops={'arrowstyle':'->','connectionstyle':'arc3,rad=.18','lw':2,'color':'#91411f'});axs[1].annotate('',xy=(1.5,.22),xytext=(3,.22),arrowprops={'arrowstyle':'->','lw':2,'color':'#245e85'});axs[1].annotate('',xy=(2.45,D),xytext=(2.45,zi),arrowprops={'arrowstyle':'<->','color':'#91411f'});axs[1].text(2.51,.55,'D - z_i',fontsize=9);axs[1].text(2.1,.8,'roof of doorway D',fontsize=9);axs[1].text(.23,.95,'stored warm air above D',fontsize=9);axs[1].set_title('Doorway: only D - z_i supplies the critical head')
fig.tight_layout();fig.savefig('paper-43-ventilation.png',dpi=120,facecolor='white');plt.close(fig)