REQUIRE "atoms.a4l"; ATOM energy_rate_per_length REFINES solver_var DIMENSION M*L/T^3 DEFAULT 1000{W/m}; lower_bound := -1e50{W/m}; upper_bound := 1e50{W/m}; nominal := 1000{W/m}; END energy_rate_per_length; ATOM energy_flux REFINES solver_var DIMENSION M/T^3 DEFAULT 1000{W/m^2}; lower_bound := -1e50{W/m^2}; upper_bound := 1e50{W/m^2}; nominal := 1000{W/m^2}; END energy_flux; MODEL cavity; W,B,S,N,C,E,D IS_A distance; theta, phi, psi IS_A angle; F_WN, F_WW, F_WB IS_A factor; F_NB, F_NW, F_NN, F_BW, F_BN IS_A factor; F_WS IS_A factor; N * sin(theta) = D; S * tan(theta) = D; B = W + 2 * S; E^2 = W^2 + D^2; phi = arctan(D/W); psi = 1{PI} - phi; C^2 = E^2 + S^2 - 2* E * S * cos(psi); F_WN = (W+N-C)/2/W; F_WW = (2*E-2*D)/2/W; F_WB = 1 - 2 * F_WN; F_WS = (1 - 2 * F_WN - F_WB)/2; F_NB = (N+B-C)/2/N; F_NW = (N+W-C)/2/N; F_BN = F_NB*N/B; F_NN = 1 - F_NW - F_NB; F_BW = F_WB*W/B; n IS_A set OF symbol_constant; n :== ['W','B','L','R']; (* Put lengths into a vector *) A[n] IS_A distance; A['W'], W ARE_THE_SAME; A['B'], B ARE_THE_SAME; A['L'], N ARE_THE_SAME; A['R'], N ARE_THE_SAME; (* View factor matrix *) F[n][n] IS_A factor; F['W']['L'], F['W']['R'], F_WN ARE_THE_SAME; F['W']['B'], F_WB ARE_THE_SAME; F['W']['W'] = 0; F['B']['L'], F['B']['R'], F_BN ARE_THE_SAME; F['B']['W'], F_BW ARE_THE_SAME; F['B']['B'] = 0; F['L']['R'], F['R']['L'], F_NN ARE_THE_SAME; F['L']['B'], F['R']['B'], F_NB ARE_THE_SAME; F['L']['W'], F['R']['W'], F_NW ARE_THE_SAME; F['L']['L'] = 0; F['R']['R'] = 0; (* Radiation equations *) q[n] IS_A energy_rate_per_length; E_b[n] IS_A energy_flux; J[n] IS_A energy_flux; T[n] IS_A temperature; eps[n] IS_A factor; (* emissivity *) FOR i IN n CREATE q[i] = SUM[ (J[i]-J[j])*(A[i]*F[i][j]) | j IN n]; END FOR; FOR i IN n CREATE E_b[i] = 1{SIGMA_C} * T[i]^4; END FOR; FOR i IN n CREATE q[i] * (1-eps[i]) = (E_b[i] - J[i]) * (eps[i]*A[i]); END FOR; METHODS METHOD default_self; RUN reset; RUN values; RUN bound_self; END default_self; METHOD bound_self; phi.lower_bound := 0 {deg}; phi.upper_bound := 90 {deg}; psi.lower_bound := 90 {deg}; psi.upper_bound := 180 {deg}; END bound_self; METHOD specify; FIX T['W', 'B']; FIX q['L','R']; FIX W,D,theta; FIX eps[n]; END specify; METHOD values; T['W'] := 550 {K}; T['B'] := 373.15 {K}; q['L'] := 0 {W/m}; q['R'] := 0 {W/m}; W := 500 {mm}; D := 300 {mm}; theta := 30 {deg}; FOR i IN n DO eps[i] := 0.4; END FOR; END values; END cavity;