subroutine anapre (Model_Name) ! ================================================================= ! subroutine ANAPRE: preprocessing routine, called only once ! ----------------------------------------------------------------- ! all names beginning with a-z are double precision implicit double precision (a-z) character(17) :: Model_Name ! create a "named" common to access input or output ! common /My_In / .... ! "12345678901234567" name the model Model_Name = "Cylinder and Fins" ! open the post processing output open (unit=10,file="post_process.out",status="unknown") ! call any code needed to start the process end subroutine anapre subroutine anafun ! ================================================================= ! subroutine ANAFUN: called for every trial vector (each iteration) ! ----------------------------------------------------------------- ! all names beginning with a-z are double precision implicit double precision (a-z) ! except specifically declared ones, like: integer loop, loop2 ! set problem constants parameter (pi = 3.1415927d0, two_pi = pi + pi ) ! create a "named" common to access input or output ! common /My_In /.... common /My_Out/ height, od_fin, mass ! input scalar analysis variables (AV) values for this iteration ! (name ,'123456789012345') call avdsca (height ,'cyl height, m') call avdsca (od_cyl ,'cyl OD, m') call avdsca (id_cyl ,'cyl ID, m') call avdsca (thick ,'fin thickness,m') call avdsca (length ,'fin length, m') call avdsca (h ,'h_conv, W/m^2') call avdsca (k ,'k_cond, W/mC') call avdsca (t_OD ,'T_cyl_OD, C') call avdsca (t_air ,'T_air, C') call avdsca (numb ,'number of fins ') ! call avdsca (density ,'density, kg/m^3') ! *** compute scalar AF values *** ! intermediate geometric constants, temperature difference r = od_cyl * 0.5d0 od_fin = od_cyl + length * 2 r_edge = r + length centroid = r + length / 2 diff = t_OD - t_air ! compute functions, volume, mass, efficiency, heat losses ! vol = height * pi * (od_cyl**2 - id_cyl**2) / 4 & ! + numb * thick * length * two_pi * centroid ! mass = density * vol ! convection from cylinder h_cyl = height - numb * thick ! outer wall height, > 0 fin_gap = h_cyl / ( numb + 1.d0 ) ! fin gap size area_wall = two_pi * r * h_cyl ! outer wall area q_cyl = h * area_wall * diff ! wall convection ! --- single rectangular fin, revolved ---- area_base = two_pi * r * thick area_fin = two_pi * centroid * length * 2 & + two_pi * (r + length ) * thick ! ratio of convection to conduction modes, efficiency m = dsqrt ((h * area_fin) / (k * area_base * length)) mL = m * length eff_est = tanh (mL) / mL ! See Chapman Fig 2.18 ! convection from all fins, and total fin_area = area_fin * numb q_fin = eff_est * h * fin_area * diff q_total = q_cyl + q_fin ! output scalar analysis functions (AF) values ! (name ,'123456789012345') call afdsca (eff_est ,'efficiency est ') call afdsca (q_total ,'heat total, W') call afdsca (q_fin ,'heat fin, W') call afdsca (q_cyl ,'heat cyl, W') call afdsca (od_fin ,'fin diameter, m') call afdsca (fin_gap ,'fin gap, m') call afdsca (area_wall ,'cyl surface,m^2') call afdsca (area_fin ,'fin surface,m^2') ! call afdsca (h_cyl ,'cyl base hght,m') ! call afdsca (area_base ,'fin base, m^2') ! call afdsca (r_edge ,'r_edge, m') ! call afdsca (mass ,'mass, kg') end subroutine anafun subroutine anapos ! ================================================================= ! subroutine ANAPOS, only called if "Postprocess" button is hit ! postprocessing routine ! ----------------------------------------------------------------- ! all names beginning with a-z are double precision implicit double precision (a-z) ! except specifically declared ones integer kount parameter (pi = 3.1415927d0, pi_by_4 = pi / 4.d0) data kount /0/ ! save kounts between calls ! create a "named" common to access input or output ! common /My_In / .... common /My_Out/ height, od_fin, mass ! carry out post-processing kount = kount + 1 enclosed = height * pi_by_4 * od_fin**2 ! save to my post-processing file write (10, * ) 'Design number = ', kount write (10, * ) 'height, diameter (m) = ', height, od_fin write (10, * ) 'enclosed volume (m^3) = ', enclosed ! write (10, * ) 'mass (kg) = ', mass end subroutine anapos ! check syntax with f95 compiler: f95 -c Fins.f90. Then link: ! f95 -o try Fins.o /usr/site/OptdesX/lib/supportF.o -lnsl -lsocket ! then execute: OptdesX try