// Last edited on 2011-04-20 21:13:12 by stolfi #macro reactor_pressure_vessel(N,C,cw,fu,hd,bd) // Reactor pressure vessel. // Center of bottom cap is at origin. // {cw} is the core water level. // If {fu=0}, the fuel is omitted. // If {hd=0}, the head is omitted. // If {bd=0}, the body and bottom cap are omitted. #local H = reactor_rpv_body_height; // Length of cylindrical part of RPV. intersection{ object{ C } union{ #if (hd > 0) object{ reactor_pressure_vessel_cap(N) translate H*z } #end #if (bd > 0) object{ reactor_pressure_vessel_body(N) } object{ reactor_pressure_vessel_cap(N) scale <1,1,-1> } #end } texture{ tx_steel } } #end #macro reactor_pressure_vessel_body(N) // Cylindrical part of RPV, with flanges. // Bottom center at origin. #local H = reactor_rpv_body_height; // Length of cylindrical part of RPV. #local R = reactor_rpv_body_rad; // Outer radius of RPV. #local T = reactor_rpv_thk; // Thickness of RPV wall. #local FT = reactor_rpv_flange_thk; // Thickness of RPV flanges. #local FR = reactor_rpv_flange_rad; // Extra radius of RPV flanges. #local bot_ctr = < 0, 0, 0 >; #local top_ctr = < 0, 0, H >; difference{ union{ cylinder{ bot_ctr + eps*z, bot_ctr + (FT-eps)*z, R + FR - eps } cylinder{ bot_ctr + 2*eps*z, top_ctr - 2*eps*z, R - eps } cylinder{ top_ctr - (FT-eps)*z, top_ctr - eps*z, R + FR - eps } } cylinder{ bot_ctr - eps*z, top_ctr + eps*z, R - T + eps } bounded_by{ cylinder{ bot_ctr, top_ctr, R + FR } } } #end #macro reactor_pressure_vessel_cap(N) // Spherical part on either side of RPV, with flanges. // Center is at origin, cap above it. #local R = reactor_rpv_body_rad; // Outer radius of RPV. #local T = reactor_rpv_thk; // Thickness of RPV wall. #local FT = reactor_rpv_flange_thk; // Thickness of RPV flanges. #local FR = reactor_rpv_flange_rad; // Extra radius of RPV flanges. #local cap_ctr = < 0, 0, 0 >; #local f_bot_ctr = cap_ctr; #local f_top_ctr = cap_ctr + FT*z; union{ cylinder{ f_bot_ctr + eps*z, f_top_ctr - eps*z, R + FR - eps } intersection{ difference{ sphere{ cap_ctr, R - eps } sphere{ cap_ctr, R - T + eps } } cylinder{ cap_ctr + 2*eps*z, cap_ctr + R*z, R } } bounded_by{ cylinder{ cap_ctr, cap_ctr + R, R + FR } } texture{ tx_steel } } #end