#!/usr/bin/perl -w # SCMD/cgi-bin/CMD: program to answer *and generate* stars # number of stars form (version 2) use strict; # enforce variable declarations and quoting use CGI qw(:standard); sub bail{ my $error ="@_"; print h1("Unexpected Error"), p($error), end_html; die $error; } my $dataurl="http://csaweb.yonsei.ac.kr/~kim/cgi-bin/YY/table/SCMD.dat"; my $dataurl2="http://csaweb.yonsei.ac.kr/~kim/cgi-bin/YY/params/YYISO.IN"; my $BVurl="http://csaweb.yonsei.ac.kr/~kim/cgi-bin/YY/table/SCMD_BV.ps"; my $BVurl2="http://csaweb.yonsei.ac.kr/~kim/cgi-bin/YY/table/SCMD_BV.gif"; my $VIurl="http://csaweb.yonsei.ac.kr/~kim/cgi-bin/YY/table/SCMD_VI.ps"; my $VIurl2="http://csaweb.yonsei.ac.kr/~kim/cgi-bin/YY/table/SCMD_VI.gif"; my $defurl="http://csaweb.yonsei.ac.kr/~kim/cgi-bin/YY/params/def.html"; print header, start_html("Synthetic CMD"), h1("Synthetic CMD v2.0"); print hr(); print p("click here for : parameter definitions"); if (param()){ # the form has already been filled out my $alpha = param("Alpha enrichment"); my $Z = param("Metallicity"); my $Age = param("Age"); my $N = param("Number"); my $IMF_s = param("IMF slope"); my $IMF_u = param("IMF upper limit"); my $IMF_l = param("IMF lower limit"); my $ISEED = param("ISEED"); my $BF = param("Binary Fraction"); my $q = param("qmass"); if ($N <= 0 || $N >100000) {bail("Number of stars must be greater than 0 and less a maximum of 100000. $!");} #remove older temporary files system("\\rm params/SCMD.IN"); system("\\rm params/YYISO.IN"); system("\\rm code/junk*"); system("\\rm code/logfile"); open(PARAMS,">params/SCMD.IN") || bail("Cannot open 'SCMD.IN' for reading $!"); print PARAMS "$N !nstar\n$IMF_s\d0 !IMF slope\n$IMF_u\d0 !IMF upper limit\n$IMF_l\d0 !IMF lower limit\n$ISEED !RN ISEED\n$BF !binary fraction\n$q\d0 !qmass\n"; close PARAMS or warn $!; #System calls to update the YY.nml file for interpolation routine system("sed 's/AFe_INIT/$alpha/g' code/YY.nml_INIT > code/junk1.nml"); system("sed 's/Z_INIT/$Z/g' code/junk1.nml > code/junk2.nml"); system("sed 's/Age_INIT/$Age/g' code/junk2.nml > code/junk3.nml"); system("mv code/junk3.nml code/YY.nml"); print p("Your input paramaters were:"); print("alpha=$alpha, Z=$Z, Age=$Age, N=$N, IMF=$IMF_l - $IMF_u with slope $IMF_s, ISEED=$ISEED, Binary Fraction=$BF, q=$q"); print p("Please wait a moment while your syntetic CMD is created."); #System calls to remove older plots and data tables system("\\rm table/SCMD.dat"); system("\\rm table/SCMD_BV*"); system("\\rm table/SCMD_VI*"); #System calls to Fortran codes and plotting code system("code/YYmix2 > code/logfile"); system("code/SCMDv2"); system("gnuplot code/SCMD.gnu"); #reset bounding box of postscript file system("sed '6,6s/50/30/' table/SCMD_BV.ps > table/SCMD_BV1.ps"); system("sed '6,6s/50/30/' table/SCMD_VI.ps > table/SCMD_VI1.ps"); #conversion from PS to gif system("/usr/X11R6/bin/convert table/SCMD_BV1.ps table/SCMD_BV.gif >> code/logfile"); system("/usr/X11R6/bin/convert table/SCMD_VI1.ps table/SCMD_VI.gif >> code/logfile"); # system("table/ps2gif >> code/logfile"); print p("click here to : get your Isochrone data"); print p("click here to : get your Synthesic CMD data"); print p("click here to get a plot of your: (B-V) SCMD or (V-I) SCMD in postscript"); print p("