# selectie.py — transparante leswaarden, geen gecertificeerde materiaaldata
import math
import numpy as np
# naam, rho kg/m3, E Pa, toegelaten spanning Pa (lesgegeven)
data=[
 ("staal",7800,210e9,120e6),
 ("aluminium",2700,70e9,80e6),
 ("GFRP",1800,25e9,80e6),
 ("CFRP langs vezel",1600,100e9,150e6),
 ("PP",900,1.5e9,12e6),
 ("hout langs vezel",600,10e9,12e6),
]
L,b,F,dmax=1.0,.030,100.0,.003
rij=[]
for naam,rho,E,sigtoel in data:
    hd=(4*F*L**3/(E*b*dmax))**(1/3)
    hs=math.sqrt(6*F*L/(b*sigtoel))
    h=max(hd,hs,.003)
    massa=rho*b*h*L
    delta=4*F*L**3/(E*b*h**3)
    sigma=6*F*L/(b*h*h)
    rij.append((naam,hd,hs,h,massa,delta,sigma,E**(1/3)/rho))
for z in sorted(rij,key=lambda z:z[4]):
    naam,hd,hs,h,m,d,s,index=z
    print(f"{naam:17s} hδ={hd*1000:6.2f} hσ={hs*1000:6.2f} "
          f"h={h*1000:6.2f} mm, m={m:.4f} kg, δ={d*1000:.4f} mm, "
          f"σ={s/1e6:.2f} MPa")
# Gevolg van modelfout/klimaat: alleen E halveert, zelfde toelaatspanning.
hout=next(z for z in data if z[0].startswith("hout"))
rho,E,sig=hout[1:]
h0=max((4*F/(E*b*dmax))**(1/3),math.sqrt(6*F/(b*sig)))
h1=max((4*F/(.5*E*b*dmax))**(1/3),math.sqrt(6*F/(b*sig)))
print(f"hout bij halve E: h {h0*1000:.2f}->{h1*1000:.2f} mm, "
      f"massa {rho*b*h0:.4f}->{rho*b*h1:.4f} kg")
# Kristal en dotering: dezelfde SI-conventie.
NA=6.02214076e23
print(f"FCC-Al uit a=0.405nm: {4*.0269815385/(NA*(.405e-9)**3):.3f} kg/m3")
print(f"BCC-Fe uit a=0.2866nm: {2*.055845/(NA*(.2866e-9)**3):.3f} kg/m3")
q,ne,mu=1.602176634e-19,1e22,.135
sig=q*ne*mu
print(f"Si-model σ={sig:.5f} S/m, soortelijke weerstand={1/sig:.7f} ohm m")
print(f"donorfractie t.o.v. 5e28 sites/m3 = {ne/5e28*1e6:.4f} ppm")
