REPORT: REPORT PROPERTIES: Execution Type = Automatic Keywords = Report Template Description = IC Engine Cold Flow Simulation Report Report Template Name = IC Engine Report END # REPORT PROPERTIES: END # REPORT: # Session file started: 2011/04/18 16:30:39 # CFX-13.0 build 2010.10.03-23.02 # To avoid unnecessary file pre-processing and modifications, include # COMMAND FILE at the top of your session file. # If it is not included, the file is assumed to be older and will be # modified for backward compatibility. COMMAND FILE: CFX Post Version = 12.0 END !CreateReport(); !sub CreateReport(){ ! $CommentSeqNum = 0,$ChartSeqNum = 0,$TableSeqNum = 0,$PlaneSeqNum = 0; ! my $ccl=$0; ! $ccl =~ s/\\/\//g; ! my $pos = rindex($ccl,"lib/ccl/CCL/embeddedParserInit.pl"); ! my $cfdpostPath = substr($ccl,0,$pos); ! $ffmpeg= ""; ! if($^O eq 'linux'){ ! $ffmpeg = $cfdpostPath."tools/ffmpeg-20071211/bin/linux-amd64/ffmpeg"; ! } ! else{ ! $ffmpeg = $cfdpostPath."tools/ffmpeg-20071211/bin/winnt/ffmpeg.exe"; ! } ! my $repPath = getValue( "/DATA READER", "Current Results File" ); # This changes all backslashes to slashes to ensure the following split is # consistent. CFD-Post sometimes works with either or both in file paths: ! $repPath =~ s/\\/\//g; # This splits the path name into an array that holds the path items: ! @pathItemsFluent = split(/\//, $repPath); ! @pathItemsForte = split(/\//, $repPath); ! my $forteftind = pop(@pathItemsForte); ! if($forteftind eq "Nominal.ftind") ! { ! CreateForteReport(); ! return; ! } ! @pathItems = split(/\//, $repPath); ! if(!@pathItems){ ! return; ! } ! pop(@pathItems); ! pop(@pathItems); ! push(@pathItems,"Report"); ! push(@pathItems,"tmp"); # Global varibles ! $ChartYAbsolute='Off'; ! $maxY=1.0; ! $minY=-1.0; ! $yAutomaticRange='On'; ! $yLogScale='Off'; ! $yAutoNumFormat='On'; ! $yNumFormat='%10.3e'; # Copying files for standalone runs from Fluent directory to Report directory ! IcMoveFilesFromFluentToReportDir(); ! my @tmpPathItems = @pathItems; ! pop(@tmpPathItems); ! pop(@tmpPathItems); ! push(@tmpPathItems, "ICE"); ! push(@tmpPathItems,"icDyMSettings.txt"); ! my $filename = join('/', @tmpPathItems); ! my $success = open(infile,"<$filename"); ! if(!$success){ ! pop(@tmpPathItems); ! push(@tmpPathItems,"icSolverSettings.txt"); ! $filename = join('/', @tmpPathItems); ! $success = open(infile,"<$filename"); ! } ! if(!$success){ ! return; ! } ! $simulationType = "ColdFlow"; ! $reportTitle = "IC Engine Cold Flow Simulation Report"; ! while(){ ! my $pos = index($_,"solution-type"); ! if($pos >=0){ ! $pos = index($_,"port-flow"); ! if($pos >=0){ ! $simulationType = "PortFlow"; ! } ! else{ ! $pos = index($_,"combustion"); ! if($pos >=0){ ! $simulationType = "Combustion"; ! $reportTitle = "IC Engine Combustion Simulation Report"; ! } ! } ! last if(1); ! } ! } ! if(($simulationType eq "ColdFlow")||($simulationType eq "Combustion")){ ! ICCreateColdFlowReport(); ! createDesignPointCharts(); ! } ! elsif($simulationType eq "PortFlow"){ ! ICCreatePortFlowReport(); ! } !} # Session file stopped: 2012/02/23 12:31:54 # =============================================== # Port Flow Report # =============================================== !sub ICCreatePortFlowReport(){ TITLE PAGE: Include ANSYS Logo = On Include Custom Logo = Off Include Date = On Include TOC = On Report Title = IC Engine Port Flow Simulation Report Show Captions in TOC = On END > report hideItem=/REPORT/PHYSICS SUMMARY OPTIONS > report hideItem=/COMMENT:User Data !CommentText("Setup",1); !@bcNames=(),@bcTypes=(),@bcStrings=(),@bcStringsLen=(),@bcStringsStart=(); !pop(@pathItems); !push(@pathItems, "ice-report-solver-settings-0"); !my $filename = join('/', @pathItems); !if(open(infile,"<$filename")){ ! my $ratio,@strs=(); ! ReadBoundaryConditions(); ! CreateTable(); ! close(infile); !} !IcCreatSetupTables(); ! CommentText("Solution Data",1); ! fillAnimationAndTableSettings(); ! IcCreateAnimation(); ! createTableOfImages(); #Residuals ! pop(@pathItems); ! push(@pathItems, "ice-residual.jpg"); ! $filename = join('/', @pathItems); ! if(open(infile,"<$filename")){ ! CommentImage("Residuals",2,$filename); ! } ! close(infile); ! CommentText("Charts",2); #Monitors ! @monitorNames=(),@monitorStrings=(); ! ReadMonitorNames(); ! IcCreateMonitorCharts(); ! IcAddUserImages(); ! createDesignPointReport(); !} !sub TableForResiduals{ ! @tableFileTypes=(),@tableFileHeading=(),@tableColumns=(),@tableRows =(),@tableSizes=(),@tableFiles=(); ! pop(@pathItems); ! my $filename = join('/', @pathItems); ! if(!opendir(DIR,$filename)){ ! return; ! } ! push(@tableSizes,0); ! my $file=""; ! my @dirFiles=(); ! while ($file = readdir(DIR) ) ! { ! push(@dirFiles,$file); ! } ! my @sortedDirFiles=sort @dirFiles; ! for(my $findex=0; $findex<@sortedDirFiles;++$findex){ ! $file = @sortedDirFiles[$findex]; ! my $tmp = substr($file,(length($file))-4,4); ! next if(rindex($tmp,".jpg") == -1); ! next if(index($file,"ice-residual-") != 0); ! push(@tableFiles,$filename."/".$file); ! $tableSizes[0] = $tableSizes[0] + 1; ! } ! closedir(DIR); ! push(@pathItems,"tmp"); ! if($tableSizes[0] == 0){ ! @tableFileTypes=(),@tableFileHeading=(),@tableColumns=(),@tableRows =(),@tableSizes=(),@tableFiles=(); ! return; ! } ! push(@tableColumns,2); ! push(@tableRows,(int($tableSizes[0]/2)+1)); ! push(@tableFileTypes,"Residual"); ! push(@tableFileHeading,"Table: Residuals"); ! createTables(); ! @tableFileTypes=(),@tableFileHeading=(),@tableColumns=(),@tableRows =(),@tableSizes=(),@tableFiles=(); !} !sub CommentTable{ ! my ($tableStr) = @_; # Comment CCL: !++$CommentSeqNum; COMMENT:Comment $CommentSeqNum Comment Text =

$tableStr

Comment Heading = $heading Heading Level = $level END !} !sub IcAddUserImages(){ ! pop(@pathItems); ! my $filename = join('/', @pathItems); ! my @allFiles=(); ! opendir(DIR,$filename) || die "NO SUCH Directory: Images"; ! while ($file = readdir(DIR) ) ! { ! my $tmp = substr($file,(length($file))-4,4); ! next if(rindex($tmp,".jpg") == -1); ! next if(index($file,"ice-image-") != 0); ! push(@allFiles,$file); ! } ! closedir(DIR); ! push(@pathItems,"tmp"); ! if(@allFiles){ ! CommentText("User Defined Images",1); ! for(my $i=0; $i < @allFiles; ++$i){ ! pop(@pathItems); ! push(@pathItems, $allFiles[$i]); ! $filename = join('/', @pathItems); ! my $str = substr($allFiles[$i],10,length($allFiles[$i])-14); ! CommentImage($str,2,$filename); ! } ! } !} !sub createDesignPointReport(){ ! createDesignPointCharts(); ! if(!@succesfulDp){ ! return; ! } ! createDesignPointImageTables(); !} !sub createDesignPointImageTables(){ !pop(@pathItems); !my $filename = join('/', @pathItems); !@tableFileTypes=(),@tableFileHeading=(),@tableColumns=(),@tableRows =(),@tableSizes=(),@tableFiles=(); !my @allFiles=(),@tableFilesTmp=(); !my @allFilesOrdered=(); !opendir(DIR,$filename) || die "NO SUCH Directory: Images"; !while ($file = readdir(DIR) ) !{ ! my $tmp = substr($file,(length($file))-4,4); ! next if(rindex($tmp,".jpg") == -1); ! next if(index($file,"ice-") != 0); ! push(@allFilesOrdered,$file); !} !closedir(DIR); # Sort it by ordering according to name !for(my $j=0; $j<@allFilesOrdered;++$j){ ! for(my $i=$j+1; $i<@allFilesOrdered;++$i){ ! if($allFilesOrdered[$j] gt $allFilesOrdered[$i]){ ! my $str = $allFilesOrdered[$j]; ! $allFilesOrdered[$j] = $allFilesOrdered[$i]; ! $allFilesOrdered[$i] = $str; ! } ! } !} !for(my $j=0; $j<@allFilesOrdered;++$j){ ! $file = $allFilesOrdered[$j]; ! push(@allFiles,$file); ! my $pos = rindex($file,"-"); ! my $str = substr($file,0,$pos+1); ! my $str1 = substr($file,0,$pos); ! for($i=0; $i<@tableFileTypes;++$i){ ! last if(IsEqual($str,$tableFileTypes[$i])); ! } ! if($i == @tableFileTypes){ ! $pos = rindex($str1,"-"); ! my $str2 = substr($str1,$pos+1); ! for($k=0; $k<(@AnimTableFlags/7);++$k){ ! last if($str2 eq $AnimTableFlags[7*$k]); ! } ! next if($k == (@AnimTableFlags/7)); ! my $surfaces = $AnimTableFlags[7*$k+1]; ! $pos = rindex($str1,"-on-"); ! $str2 = substr($str1,4,$pos-4); ! $str2 = "Table: ".$str2." on ".$surfaces." for Design Points "; ! for(my $k=0; $k < @succesfulDp; ++$k){ ! $str2 = $str2." ".$succesfulDp[$k]; ! if($k < (@succesfulDp-1)){ ! $str2 = $str2.", "; ! } ! } ! push(@tableFileHeading, $str2); ! if((@tableFileTypes) && (@allFiles > 1)){ ! push(@tableFilesTmp,$filename."/".$allFiles[@allFiles-2]); ! } ! push(@tableFileTypes,$str); ! push(@tableColumns,3); ! push(@tableRows,5); ! } !} !if(@allFiles > 0){ ! push(@tableFilesTmp,$filename."/".$allFiles[@allFiles-1]); !} !for(my $k=1; $k < @succesfulDp; ++$k){ ! my @strs = split(/ /,$succesfulDp[$k]); ! my $filename1 = $filename; ! my $pos = rindex($filename1,"_files/"); ! last if($pos < 0); ! $filename1 = substr($filename1,0,$pos)."_dp".$strs[$#strs].substr($filename1,$pos); ! @allFiles = (); ! if(!opendir(DIR,$filename1)){ ! $pos = rindex($filename1,"/dp0/"); ! if($pos >= 0){ ! $filename1 = substr($filename1,0,$pos)."/dp".$strs[$#strs].substr($filename1,$pos+4); ! } ! } ! if(!opendir(DIR,$filename1)){ ! $pos = rindex($filename,"/dp0/"); ! if($pos >= 0){ ! $filename1 = substr($filename,0,$pos)."/dp".$strs[$#strs].substr($filename,$pos+4); ! } ! } ! closedir(DIR); ! next if(!opendir(DIR,$filename1)); ! while ($file = readdir(DIR) ) ! { ! my $tmp = substr($file,(length($file))-4,4); ! next if(rindex($tmp,".jpg") == -1); ! next if(index($file,"ice-") != 0); ! push(@allFiles,$file); ! } ! closedir(DIR); # Sort it by ordering according to name ! for(my $j=0; $j<@allFiles;++$j){ ! for(my $i=$j+1; $i<@allFiles;++$i){ ! if($allFiles[$j] gt $allFiles[$i]){ ! my $str = $allFiles[$j]; ! $allFiles[$j] = $allFiles[$i]; ! $allFiles[$i] = $str; ! } ! } ! } ! my $current = 0,$modifTime=0; ! my $found = 0; ! for($j=0; $j < @allFiles;++$j){ ! $file = $allFiles[$j]; ! $pos = rindex($file,"-"); ! $str = substr($file,0,$pos+1); ! if($str eq $tableFileTypes[$current]){ ! $str = $filename1."/".$allFiles[$j]; ! my $curModifTime=0; ! $curModifTime = (stat($str))[9]; ! if(!$found){ ! $modifTime = $curModifTime; ! } ! $found=1; ! if($curModifTime >= $modifTime){ ! next if(1); ! } ! } ! elsif(!$found){ ! next if(1); ! } ! if($found){ ! push(@tableFilesTmp,$filename1."/".$allFiles[$j-1]); ! $j = $j - 1; ! $found=0; ! last if($current == (@tableFileTypes - 1)); ! $current = $current + 1; ! } ! else{ ! push(@tableFilesTmp,""); ! } ! } ! if($found){ ! push(@tableFilesTmp,$filename1."/".$allFiles[$#allFiles]); ! } !} !for($i=0; $i<@tableFileTypes;++$i){ ! my $size = 0; ! for($j=0; $j < @tableFilesTmp/@tableFileTypes ;++$j){ ! my $str = @tableFilesTmp[$j * @tableFileTypes + $i]; ! next if($str eq ""); ! push(@tableFiles,$str); ! ++$size; ! } ! push(@tableSizes,$size); !} #Rename the images, because same name images are being replace in Report directory !use File::Copy; !my $count=0; !for($i=0; $i<@tableSizes;++$i){ ! for($j=0; $j<$tableSizes[$i];++$j){ ! my $str = @tableFiles[$count]; ! my $pos = rindex($str,"/"); ! $tableFiles[$count] = substr($str,0,$pos+1)."dp_tbl_".$i."_".$j."_".substr($str,$pos+1); ! copy($str,@tableFiles[$count]); ! ++$count; ! } !} !createTables(); !@tableFileTypes=(),@tableFileHeading=(),@tableColumns=(),@tableRows =(),@tableSizes=(),@tableFiles=(); !} !sub createDesignPointCharts(){ ! @succesfulDp=(); ! my @tmpPathItems = @pathItems; ! pop(@tmpPathItems); ! pop(@tmpPathItems); ! pop(@tmpPathItems); ! pop(@tmpPathItems); ! push(@tmpPathItems, "user_files"); ! push(@tmpPathItems, "DesignPointLog.csv"); ! $filename = join('/', @tmpPathItems); ! if(!open(infile,"<$filename")){ ! return; ! } ! my @paramTypes=(),@paramNames=(); ! my @dpTypes=(),@dpNames=(),@dpValues=(); ! my $prevLine=""; ! while(){ ! if(index($_,"#") == 0){ ! if(index($prevLine,"The parameters defined ") > -1 || index($prevLine,"The parameters now defined") > -1){ ! @paramTypes=(),@paramNames=(),@dpTypes=(),@dpNames=(),@dpValues=(),@paramNames=(),@paramNames=(),@succesfulDp=(); ! my $str = substr($_,2); ! while(index($str," - ") > 0){ ! my $pos = index($str," - "); ! $paraname=substr($str,0,$pos); ! $start = index($paraname,"P"); ! $end=$pos-$start; ! push(@paramTypes,substr($str,$start,$end)); ! $str = substr($str,$pos+3); ! $pos = index($str,", "); ! my $nbChar = 2; ! if($pos == -1){ ! $pos = index($str,","); ! $nbChar = 1; ! } ! push(@paramNames,substr($str,0,$pos)); ! $str = substr($str,$pos+$nbChar); ! } ! } ! $prevLine = $_; ! next if(1); ! } ! elsif(@paramNames){ ! chomp; ! my $pos = rindex($_,"\r"); ! if($pos>-1){ ! $_ = substr($_,0,$pos); ! } ! my @strs = split(/, /); ! if(@strs < 2){ ! @strs = split(','); ! } ! last if(@strs < 2); ! if($strs[0] eq "Name"){ ! shift(@strs); ! push(@dpTypes,@strs); ! } ! else{ ! push(@succesfulDp,$strs[0]); ! shift(@strs); ! push(@dpValues,@strs); ! } ! } ! } ! CommentText("Design Points Report",1); ! CommentText("Design Points Parameter values Charts",2); ! if(!@succesfulDp){ ! return; ! } ! for(my $i=0; $i < @dpTypes; ++$i){ ! for(my $j=0; $j < @paramTypes; ++$j){ ! if($dpTypes[$i] eq @paramTypes[$j]){ ! push(@dpNames,$paramNames[$j]); ! } ! } ! } ! for(my $i=1; $i < @dpTypes; ++$i){ ! pop(@pathItems); ! push(@pathItems, $dpTypes[$i].".csv"); ! $filename = join('/', @pathItems); ! if(open(outfile1,">$filename")){ ! my $nb = @dpValues / @dpTypes; ! for(my $j=0; $j < $nb; ++$j){ ! print outfile1 $dpValues[$j*@dpTypes]; ! print outfile1 ","; ! print outfile1 $dpValues[$j*@dpTypes+$i]; ! print outfile1 "\n"; ! } ! } ! close(outfile1); ! ++$ChartSeqNum; ! @ChartNames=(); ! @ChartPaths=(); ! push(@ChartPaths, $filename); ! push(@ChartNames, $dpNames[$i]); ! my $pos = rindex($dpNames[$i], "[kg s^-1]"); ! if($pos > -1){ ! $ChartYAbsolute = 'On'; ! } ! CreateChart($ChartSeqNum,$dpNames[0]." vs ".$dpNames[$i],$dpNames[0]); ! $ChartYAbsolute = 'Off'; ! } !} !sub fillAnimationAndTableSettings(){ ! my @tmpPathItems = @pathItems; ! pop(@tmpPathItems); ! pop(@tmpPathItems); ! push(@tmpPathItems, "ICE"); ! push(@tmpPathItems,"icUserSettings.txt"); ! my $filename = join('/', @tmpPathItems); ! my @lines = (),@linesName = (); ! my $pos,$pos2; ! for(my $i=1; $i <= 2; ++$i){ ! if($i == 2){ ! pop(@tmpPathItems); ! push(@tmpPathItems,"icBcSettings.txt"); ! $filename = join('/', @tmpPathItems); ! } ! my $success = open(infile,"<$filename"); ! next if(!$success); ! while(){ ! $pos = index($_,"post_plane_images"); ! if($pos >=0){ ! while(){ ! $pos = index($_,"(name"); ! last if($pos < 0); ! $pos2 = index($_,"\")"); ! my $name = substr($_, $pos+7,$pos2-$pos-7); ! my $j=0; ! for($j=0; $j < @linesName; ++$j){ ! last if($name eq $linesName[$j]); ! } ! if($j == @linesName){ ! push(@lines,$_); ! push(@linesName,$name); ! } ! } ! last if(1); ! } ! } ! } ! @AnimTableFlags=(); ! for(my $i=0; $i < @lines ; ++$i ){ ! my $line = $lines[$i]; ! push(@AnimTableFlags,$linesName[$i]); ! my $str = "(surfaces ("; ! $pos = index($line,$str); ! $line = substr($line, $pos + length($str)); ! $pos2 = index($line,"))"); ! my $surf = substr($line,0,$pos2); ! $surf =~ s/"//g; ! $surf =~ s/ /, /g; ! push(@AnimTableFlags,$surf); ! $str = "animation? "; ! $pos = index($line,$str); ! $line = substr($line, $pos + length($str)); ! $pos2 = index($line,")"); ! push(@AnimTableFlags,substr($line,0,$pos2)); ! $str = "table? "; ! $pos = index($line,$str); ! $line = substr($line, $pos + length($str)); ! $pos2 = index($line,")"); ! push(@AnimTableFlags,substr($line,0,$pos2)); ! $str = "columns "; ! $pos = index($line,$str); ! $line = substr($line, $pos + length($str)); ! $pos2 = index($line,")"); ! push(@AnimTableFlags,substr($line,0,$pos2)); ! $str = "rows "; ! $pos = index($line,$str); ! $line = substr($line, $pos + length($str)); ! $pos2 = index($line,")"); ! push(@AnimTableFlags,substr($line,0,$pos2)); ! $str = "tag "; ! $pos = index($line,$str); ! $line = substr($line, $pos + length($str)); ! $pos2 = index($line,")"); ! push(@AnimTableFlags,substr($line,0,$pos2)); ! } !} # name surfaces animation? table? columns rows tag !sub createTableOfImages(){ !@tableFileTypes=(),@tableFileHeading=(),@tableColumns=(),@tableRows =(),@tableSizes=(),@tableFiles=(); !fillTableFileNames(); !createTables(); !} #Table input parameters !sub createTables{ !my $iniSize=0; !for(my $k=0; $k < @tableFileTypes; ++$k){ ! next if($tableColumns[$k] <= 0); ! my $tableImageWidth=int((1480)/$tableColumns[$k]),$tableImageHeight=int(1110/$tableColumns[$k]); ! my $tableStr = ""; ! my $j=0; ! my $numberOfImages = $tableColumns[$k]*$tableRows[$k]; ! for(my $i=0; $i< $numberOfImages; ++$i){ ! last if($i >= $tableSizes[$k]); ! my $imageIndex=$iniSize + $i; ! if($i && ($tableSizes[$k] > $numberOfImages)){ ! $imageIndex= $iniSize + int(($tableSizes[$k] /($numberOfImages-1))*$i) - 1; ! } ! my $imgPath = $tableFiles[$imageIndex]; ! if($j == 0){ ! $tableStr = $tableStr.""; ! } ! $tableStr = $tableStr.""; ! ++$j; ! if($j == $tableColumns[$k]){ ! $j = 0; ! $tableStr = $tableStr.""; ! } ! } ! $tableStr = $tableStr."
"; ! $heading = $tableFileHeading[$k]; ! $level=2; ! CommentTable($tableStr); ! $iniSize += $tableSizes[$k]; !} !} !sub fillTableFileNames(){ !pop(@pathItems); !$filename = join('/', @pathItems); !my $i,$pos,$str; !my @allFiles=(); !opendir(DIR,$filename) || die "NO SUCH Directory: Images"; !my $file=""; !my @dirFiles=(); !while ($file = readdir(DIR) ) !{ ! push(@dirFiles,$file); !} !my @sortedDirFiles=sort @dirFiles; !for(my $findex=0; $findex<@sortedDirFiles;++$findex){ ! $file = @sortedDirFiles[$findex]; ! my $tmp = substr($file,(length($file))-4,4); ! next if(rindex($tmp,".jpg") == -1); ! next if(index($file,"ice-anim-") != 0); ! push(@allFiles,$file); ! $pos = rindex($file,"-"); ! $str = substr($file,0,$pos+1); ! for($i=0; $i<@tableFileTypes;++$i){ ! last if(IsEqual($str,$tableFileTypes[$i])); ! } ! if($i == @tableFileTypes){ ! push(@tableFileTypes,$str); ! push(@tableSizes,0); ! push(@tableColumns,3); ! push(@tableRows,5); ! $str = "Table: ".substr($str,9,length($str)-10); ! push(@tableFileHeading,$str); ! } !} !closedir(DIR); !for(my $j=0;$j<@tableFileTypes;++$j){ ! for($i=0; $i<@allFiles;++$i){ ! next if(index($allFiles[$i],$tableFileTypes[$j]) == -1); ! push(@tableFiles,$allFiles[$i]); ! $tableSizes[$j] = $tableSizes[$j]+1; ! } !} !push(@pathItems, "tmp"); !my $arrLen = @AnimTableFlags; !if($arrLen == 0){ ! for($j=0;$j<@tableFiles;++$j){ ! $tableFiles[$j] = $filename."/".$tableFiles[$j]; ! } ! return; !} !@allFiles=(),@tableFileTypesTmp=(),@tableColumnsTmp=(),@tableRowsTmp=(); !for(my $findex=0; $findex<@sortedDirFiles;++$findex){ ! $file = @sortedDirFiles[$findex]; ! next if(index($file,"ice-anim-") == 0); ! my $tmp = substr($file,(length($file))-4,4); ! next if(rindex($tmp,".jpg") == -1); ! next if(index($file,"ice-") != 0); ! push(@allFiles,$file); ! $pos = rindex($file,"-"); ! $str = substr($file,0,$pos); ! for($i=0; $i<@tableFileTypesTmp;++$i){ ! last if(IsEqual($str,$tableFileTypesTmp[$i])); ! } ! if($i == @tableFileTypesTmp){ ! $pos = rindex($str,"-"); ! next if($pos < 0); ! my $str1 = substr($str,$pos+1); ! for($k=0; $k<(@AnimTableFlags/7);++$k){ ! last if($str1 eq $AnimTableFlags[7*$k]); ! } ! next if($k == (@AnimTableFlags/7)); ! push(@tableFileTypesTmp,$str); ! push(@tableColumnsTmp,3); ! push(@tableRowsTmp,5); ! } !} !my $i, $j, $k, $l,$strPrefix,$strPrefix1; !for($i=0 ; $i < @tableFileTypesTmp; ++$i){ ! $pos = rindex($tableFileTypesTmp[$i],"-"); ! next if($pos < 0); ! $str = substr($tableFileTypesTmp[$i],$pos+1); ! $strPrefix = substr($tableFileTypesTmp[$i],0,$pos); ! for($k=0; $k<(@AnimTableFlags/7);++$k){ ! last if($str eq $AnimTableFlags[7*$k]); ! } ! next if($k == (@AnimTableFlags/7)); ! if( $AnimTableFlags[7*$k+3] eq "#f" ){ ! $tableFileTypesTmp[$i]=""; ! next if(1); ! } ! $tableColumnsTmp[$i]=$AnimTableFlags[7*$k+4]; ! $tableRowsTmp[$i]=$AnimTableFlags[7*$k+5]; ! for($j= $i+1; $j < @tableFileTypesTmp; ++$j){ ! $pos = rindex($tableFileTypesTmp[$j],"-"); ! $str = substr($tableFileTypesTmp[$j],$pos+1); ! $strPrefix1 = substr($tableFileTypesTmp[$j],0,$pos); ! next if(!($strPrefix eq $strPrefix1)); ! for($l=0; $l<(@AnimTableFlags/7);++$l){ ! last if($str eq $AnimTableFlags[7*$l]); ! } ! next if($l == (@AnimTableFlags/7)); ! next if($AnimTableFlags[7*$k+6] eq '""'); ! if($AnimTableFlags[7*$k+6] eq $AnimTableFlags[7*$l+6]){ ! $tableFileTypesTmp[$i] = $tableFileTypesTmp[$i]."/".$tableFileTypesTmp[$j]; ! $tableFileTypesTmp[$j] = ""; ! } ! } !} !for($i=0; $i < @tableFileTypesTmp; ++$i){ ! next if(length($tableFileTypesTmp[$i]) == 0); ! push(@tableFileTypes,$tableFileTypesTmp[$i]); ! push(@tableSizes,0); ! push(@tableColumns,$tableColumnsTmp[$i]); ! push(@tableRows,$tableRowsTmp[$i]); ! my @types = split(/\//, $tableFileTypesTmp[$i]); ! my $surfaces = ""; ! for($j=0; $j < @types; ++$j){ ! $pos = rindex($types[$j],"-"); ! $str = substr($types[$j],$pos+1); ! for($k=0; $k<(@AnimTableFlags/7);++$k){ ! last if($str eq $AnimTableFlags[7*$k]); ! } ! next if($k == (@AnimTableFlags/7)); ! $surfaces = $surfaces." ".$AnimTableFlags[7*$k+1]; ! } ! $pos = rindex($types[0],"-on-"); ! $str = substr($types[0],4,$pos-4); ! $str = "Table: ".$str." on ".$surfaces; ! push(@tableFileHeading, $str); !} !for($j=0;$j<@tableFileTypes;++$j){ ! my @types = split(/\//, $tableFileTypes[$j]); ! for($k=0; $k < @types; ++$k){ ! for($i=0; $i<@allFiles;++$i){ ! $str = $types[$k]."-"; ! next if(index($allFiles[$i],$str) == -1); ! push(@tableFiles,$allFiles[$i]); ! $tableSizes[$j] = $tableSizes[$j]+1; ! } ! } !} !pop(@pathItems); !$filename = join('/', @pathItems); !push(@pathItems,"tmp"); !for($j=0;$j<@tableFiles;++$j){ !$tableFiles[$j] = $filename."/".$tableFiles[$j]; !} !} !sub IcCreateMonitorCharts(){ !pop(@pathItemsFluent); !$filename = join('/', @pathItemsFluent); !opendir(DIR,$filename) || die "NO SUCH Directory: Images"; !while ($file = readdir(DIR) ) !{ ! next if(IsEqual($file,"ice-mesh-skewness-mon.out")); ! next if(rindex($file,"ice-last-residual-monitor") == 0); ! $tmp = substr($file,(length($file))-4,4); ! if(rindex($tmp,".out") == 0) ! { ! $tmp = substr($file,0,(length($file))-4); ! push(@pathItemsFluent, $file); ! $filename = join('/', @pathItemsFluent); ! pop(@pathItems); ! my $tmp1 = join('.',$tmp,"csv"); ! push(@pathItems, $tmp1); ! $filename1 = join('/', @pathItems); ! pop(@pathItemsFluent); ! MonitorChart($filename,$filename1); ! } !} !closedir(DIR); !push(@pathItemsFluent, "tmp"); !} !sub IcCreateAnimation(){ !@animationFiles=(),@animationTitles=(); !fillAnimationFileNames(); !$format=""; !for($animIndex=0; $animIndex<@animationFiles;++$animIndex){ ! $format=$animationFiles[$animIndex]; ! pop(@pathItems); ! my $animFile = $animationFiles[$animIndex]; ! substr($animFile,length($animFile))=".gif"; ! push(@pathItems, $animFile); ! CreateAnimation(); ! push(@pathItems, $animFile); ! $filename = join('/', @pathItems); ! if(open(infile,"<$filename")){ ! $str = $animationTitles[$animIndex]; ! CommentImage($str,2,$filename); ! } ! close(infile); !} !} !sub IcCreatSetupTables{ !$tableStr1="",$tableStr2=""; !$tableFormat = '%6.3f'; !pop(@pathItems); !push(@pathItems, "ice-report-solver-settings-0"); !my $filename = join('/', @pathItems); !if(open(infile,"<$filename")){ !while(){ ! @tableContentArr=(),@tableTitleArr=(); ! if(rindex($_,"Models") >= 0){ ! push(@tableTitleArr,"Model"); ! push(@tableTitleArr,"Settings"); ! my $i=0; ! while(){ ! last if(++$i==4); ! } ! while(){ ! my $pos = index($_,"Heat Transfer"); ! last if($pos > -1); ! getTwoStrings(); ! last if($tableStr1 eq ""); ! push(@tableContentArr,$tableStr1); ! push(@tableContentArr,$tableStr2); ! } ! $reportCaption = "Models"; ! PopulateTable(); ! } ! elsif((rindex($_,"Equations") >= 0)||(rindex($_,"Relaxation") >= 0)||(rindex($_,"Pressure-Velocity") >= 0)||(rindex($_,"Discretization Scheme") >= 0)){ ! $reportCaption = $_; ! while(){ ! last if(1);} ! while(){ ! getTwoStrings(); ! last if($tableStr1 eq ""); ! push(@tableTitleArr,$tableStr1); ! push(@tableTitleArr,$tableStr2); ! last if(1); ! } ! while(){ ! last if(1);} ! while(){ ! getTwoStrings(); ! last if($tableStr1 eq ""); ! push(@tableContentArr,$tableStr1); ! push(@tableContentArr,$tableStr2); ! } ! PopulateTable(); ! } !} !close(infile); !} !$tableFormat = '%10.3e'; !} !sub getTwoStrings{ !$tableStr1="",$tableStr2=""; !@strs = split; !if(@strs <= 1){ ! return; !} !my $pos = index($_,@strs[0]); !my $str = substr($_,$pos); !my $pos = index($str,' '); !if($pos < 0){ !return; !} !my $str1 = substr($str,0,$pos); !my $str2 = substr($str,$pos+1); !@strs = split(/\s+/,$str1); !$tableStr1 = join(' ', @strs); !@strs = split(/\s+/,$str2); !$tableStr2 = join(' ', @strs); !} # =============================================== # Cold Flow Report # =============================================== !sub ICCreateColdFlowReport(){ TITLE PAGE: Include ANSYS Logo = On Include Custom Logo = Off Include Date = On Include TOC = On Report Title = $reportTitle Show Captions in TOC = On END > report hideItem=/REPORT/PHYSICS SUMMARY OPTIONS > report hideItem=/COMMENT:User Data !$rpm=1; !$startCrankAngle=0; !ReadRpm(); !$tableFormat = '%10.3e'; #================================ #Mesh skewnes chart #================================ !@monitorNames=(),@monitorStrings=(); !ReadMonitorNames(); !pop(@pathItemsFluent); !push(@pathItemsFluent, "ice-mesh-skewness-mon.out"); !my $filename = join('/', @pathItemsFluent); !pop(@pathItems); !push(@pathItems, "ice-mesh-skewness-mon.csv"); !my $filename1 = join('/', @pathItems); !MonitorChart($filename,$filename1); #================================ #Mesh at crank angles #================================ !pop(@pathItems); !$filename = join('/', @pathItems); !my @cellCountAngle=(),@cellCountSize=(); !push(@cellCountAngle,"Crank Angle"); !push(@cellCountSize,"Cell Count"); !opendir(DIR,$filename) || die "NO SUCH Directory: Images"; !while ($file = readdir(DIR) ) !{ ! if(rindex($file,"ice-cell-count-") == 0) ! { ! push(@pathItems, $file); ! $filename = join('/', @pathItems); ! if(open(infile,"<$filename")){ ! my $pos = rindex($file,"-"); ! my $str = substr($file,$pos+1); ! push(@cellCountAngle,$str); ! while(){ ! $pos = index($_,"Level"); ! if($pos>=0){ ! while(){ ! @strs = split; ! push(@cellCountSize,$strs[1]); ! last if(1); ! } ! last if(1); ! } ! } ! } ! close(infile); ! pop(@pathItems); ! } !} !closedir(DIR); !push(@pathItems, "ice-cell-count-0"); !++$TableSeqNum; TABLE:Table $TableSeqNum Table Exists = True END TABLE:Table $TableSeqNum OBJECT REPORT OPTIONS: Report Caption = Cell count at crank angles END END !for($i=1;$i<=2;++$i){ ! my @tmpArr=(),@tmpSizeArr=(); ! if($i==1){ ! @tmpArr = @cellCountAngle; ! } ! elsif($i==2){ ! @tmpArr = @cellCountSize; ! } ! my $cellId = chr(64+$i); ! my $length = @tmpArr; ! my $index=1,$count=1; ! for($j=1;$j<=$length;++$j){ ! my $cellId1 = $cellId; ! substr($cellId1,1) = $index; ! $index += 1; ! $count=1; ! PutTableCell($cellId1,$tmpArr[$j-1],$count); ! } !} !CommentText("Setup",1); #================================ #Boundary Conditions Table #================================ !@ChartPaths,@ChartNames; !CommentText("Physics",2); !my $i,$bc,$pos; !@bcNames=(),@bcTypes=(),@bcStrings=(),@bcStringsLen=(),@bcStringsStart=(); !pop(@pathItems); !push(@pathItems, "ice-report-solver-settings-0"); !my $filename = join('/', @pathItems); !if(open(infile,"<$filename")){ ! my $ratio,@strs=(); ! ReadBoundaryConditions(); ! CreateTable(); ! close(infile); !} #================================ #Valves Lift profiles #================================ !pop(@pathItems); !push(@pathItems, "ice-profile-plot1.jpg"); !$filename = join('/', @pathItems); !if(open(infile,"<$filename")){ !CommentImage("Piston and Valves Lift profiles",2,$filename); !} !close(infile); !pop(@pathItems); !push(@pathItems, "ice-profile-plot.jpg"); !$filename = join('/', @pathItems); !if(open(infile,"<$filename")){ !CommentImage("Valves Lift profiles",2,$filename); !} !close(infile); #================================ #Relaxations #================================ !CommentText("Relaxations",2); !pop(@pathItems); !$filename = join('/', @pathItems); !@tableContentArr=(),@tableTitleArr=(); !push(@tableTitleArr,"Crank Angle"); !opendir(DIR,$filename) || die "NO SUCH Directory: Images"; !my $nbFile=0; !while ($file = readdir(DIR) ){ ! next if(rindex($file,"ice-report-solver-settings-") != 0); ! my $angle = substr($file,rindex($file,"-")+1); ! push(@tableContentArr,$angle); ! push(@pathItems, $file); ! $filename = join('/', @pathItems); ! pop(@pathItems); ! if(open(infile,"<$filename")){ ! while(){ ! next if(rindex($_,"Relaxation") < 0); ! my $i=0; ! while(){ ! last if(++$i==3);} ! last if(1); ! } ! while(){ ! @strs=(); ! @strs = split; ! last if(@strs <= 1); ! if($nbFile==0){ ! push(@tableContentArr,$strs[$#strs]); ! pop(@strs); ! $filename = join(' ', @strs); ! push(@tableTitleArr,$filename); ! } ! else{ ! push(@tableContentArr,$strs[$#strs]); ! } ! } ! ++$nbFile; ! } ! close(infile); ! last if(1); !} !closedir(DIR); !push(@pathItems, "temp"); !RelaxationsTable(); !$reportCaption = "Relaxation changes through events"; !$tableFormat = '%6.3f'; !PopulateTable(); !$tableFormat = '%10.3e'; # ================================================== # Events # ================================================== !CommentText("Dynamic Mesh Setup",2); !DynamicMeshEventsTable(); # ================================================== # ICE System Inputs # ================================================== !CommentICESystemInputs(); !CommentText("Solution Data",1); #================================ #Animation #================================ !fillAnimationAndTableSettings(); !IcCreateAnimation(); !createTableOfImages(); #================================ #Residual chart #================================ !TableForResiduals(); !CommentText("Charts",2); !ChartForResiduals(); !ChartForLastResiduals(); #================================ #Swirl And Tumble charts #================================ !pop(@pathItems); !push(@pathItems, "ice-incylinder-output.txt"); !$filename = join('/', @pathItems); !pop(@pathItems); !push(@pathItems, "ice-swirl-ratio.csv"); !$filename1 = join('/', @pathItems); !pop(@pathItems); !push(@pathItems, "ice-Tumber-About-Tumble-Axis.csv"); !$filename2 = join('/', @pathItems); !pop(@pathItems); !push(@pathItems, "ice-Tumber-About-Cross-Tumble-Axis.csv"); !my $filename3 = join('/', @pathItems); !if(open(infile,"<$filename")){ ! open(outfile1,">$filename1")|| die "cant write file"; ! open(outfile2,">$filename2")|| die "cant write file"; ! open(outfile3,">$filename3")|| die "cant write file"; ! my @inpCol1=(),@inpCol2=(),@inpCol3=(),@inpCol4=(); ! while() ! { ! @strs = split; ! push(@inpCol1,$strs[0]); ! $ratio = $strs[1]/($strs[5]*$rpm*3.141*2)*60; ! push(@inpCol2,$ratio); ! $tumblex = $strs[2]/($strs[6]*$rpm*3.141*2)*60; ! push(@inpCol3,$tumblex); ! next if(@strs < 8); ! $tumbley = $strs[3]/($strs[7]*$rpm*3.141*2)*60; ! push(@inpCol4,$tumbley); ! } ! my @outCol1=(),@outCol2=(),@outCol3=(),@outCol4=(); ! if(@inpCol1>1){ ! my $prevVal=$inpCol1[@inpCol1-1]; ! push(@outCol1,$inpCol1[@inpCol1-1]); ! push(@outCol2,$inpCol2[@inpCol2-1]); ! push(@outCol3,$inpCol3[@inpCol3-1]); ! push(@outCol4,$inpCol4[@inpCol4-1]); ! for(my $i=(@inpCol1-2); $i>=0; --$i){ ! if($inpCol1[$i] < $prevVal){ ! $prevVal=$inpCol1[$i]; ! push(@outCol1,$inpCol1[$i]); ! push(@outCol2,$inpCol2[$i]); ! push(@outCol3,$inpCol3[$i]); ! push(@outCol4,$inpCol4[$i]); ! } ! } ! } ! for(my $i=(@outCol1-1); $i>=0; --$i){ ! print outfile1 $outCol1[$i]; ! print outfile1 ","; ! print outfile1 $outCol2[$i]; ! print outfile1 "\n"; ! print outfile2 $outCol1[$i]; ! print outfile2 ","; ! print outfile2 $outCol3[$i]; ! print outfile2 "\n"; ! print outfile3 $outCol1[$i]; ! print outfile3 ","; ! print outfile3 $outCol4[$i]; ! print outfile3 "\n"; ! } ! close(infile); ! close(outfile1); ! close(outfile2); ! close(outfile3); !} !++$ChartSeqNum; !@ChartNames=(); !@ChartPaths=(); !push(@ChartPaths, $filename1); !push(@ChartNames, "Swirl Ratio"); !CreateChart($ChartSeqNum,"Swirl Ratio","Crank Angle","Swirl Ratio",$filename1); !++$ChartSeqNum; !@ChartNames=(); !@ChartPaths=(); !push(@ChartPaths, $filename2); !push(@ChartNames, "Tumble Ratio"); !CreateChart($ChartSeqNum,"Tumble Ratio","Crank Angle"); !++$ChartSeqNum; !@ChartNames=(); !@ChartPaths=(); !push(@ChartPaths, $filename3); !push(@ChartNames, "Tumble Ratio"); !CreateChart($ChartSeqNum,"Cross Tumble Ratio","Crank Angle"); #================================ #Monitors #================================ !IcCreateMonitorCharts(); # ================================================== # Cut Planes # ================================================== !@point1=(),@point2=(),@point3=(); !my @tmpPathItems = @pathItems; !pop(@tmpPathItems); !pop(@tmpPathItems); !push(@tmpPathItems, "ICE/icBcSettings.txt"); !my $filename = join('/', @tmpPathItems); !if(open(infile,"<$filename")){ ! while() ! { ! next if(index($_,"post_planes") < 0); ! while(){ ! @strs = split; ! last if(@strs < 16); ! $point1[0] = @strs[2]; ! $point1[1] = @strs[3]; ! $point1[2] = @strs[4]; ! $point2[0] = @strs[7]; ! $point2[1] = @strs[8]; ! $point2[2] = @strs[9]; ! $point3[0] = @strs[12]; ! $point3[1] = @strs[13]; ! $point3[2] = @strs[14]; ! CreateClipPlane(); ! } ! last if(1); ! } ! close(infile); !} !IcAddUserImages(); !} # End of ICCreateColdFlowReport # ================================================== # ================================================== # Sub functions # ================================================== # ================================================== !sub fillAnimationFileNames{ !pop(@pathItems); !$filename = join('/', @pathItems); !opendir(DIR,$filename) || die "NO SUCH Directory: Images"; !my $i,$j,$pos,$str,$str2; !my $file=""; !my @dirFiles=(); !while ($file = readdir(DIR) ) !{ ! push(@dirFiles,$file); !} !my @sortedDirFiles=sort @dirFiles; !for(my $findex=0; $findex<@sortedDirFiles;++$findex){ ! $file = @sortedDirFiles[$findex]; ! next if(index($file,"ice-anim-") != 0); ! $pos = rindex($file,"-"); ! $str = substr($file,0,$pos+1); ! for($i=0; $i<@animationFiles;++$i){ ! last if(IsEqual($str,$animationFiles[$i])); ! } ! if($i == @animationFiles){ ! push(@animationFiles,$str); ! $str = "Animation: ".(substr($str,9,length($str)-10)); ! push(@animationTitles,$str); ! } !} !closedir(DIR); !push(@pathItems, "tmp"); !my $arrLen = @AnimTableFlags; !if($arrLen == 0){ ! return; !} !for(my $findex=0; $findex<@sortedDirFiles;++$findex){ ! $file = @sortedDirFiles[$findex]; ! next if(index($file,"ice-anim-") == 0); ! next if(index($file,"ice-") != 0); ! $str = substr($file,length($file)-4); ! next if(!($str eq ".jpg")); ! $pos = rindex($file,"-"); ! $str = substr($file,0,$pos+1); ! $file = substr($file,0,$pos); ! $pos = rindex($file,"-"); ! $str2 = substr($file,$pos+1); ! for($j=0; $j<(@AnimTableFlags/7);++$j){ ! last if(IsEqual($str2,$AnimTableFlags[7*$j])); ! } ! next if($j == (@AnimTableFlags/7)); ! next if(!($AnimTableFlags[$j*7+2] eq "#t")); ! for($i=0; $i<@animationFiles;++$i){ ! last if(IsEqual($str,$animationFiles[$i])); ! } ! if($i == @animationFiles){ ! push(@animationFiles,$str); ! $pos = rindex($str,"-on-"); ! $str = substr($str, 4, $pos-4); ! $str = "Animation: ".$str." on ".$AnimTableFlags[7*$j+1]; ! push(@animationTitles,$str); ! } !} !} !sub RelaxationsTable{ ! my %coldFlowMap = ('pressure'=>'Pressure', 'density'=> 'Density','body-force' =>'Body Forces', 'mom'=> 'Momentum','k'=> 'Turbulent Kinetic Energy', 'epsilon'=>'Turbulent Dissipation Rate','omega'=>'Specific Dissipation Rate','turb-viscosity'=> 'Turbulent Viscosity','temperature'=>'Energy'); ! my %combustionMap = ('pressure'=>'Pressure', 'density'=> 'Density','body-force' =>'Body Forces', 'mom'=> 'Momentum','k'=> 'Turbulent Kinetic Energy', 'epsilon'=>'Turbulent Dissipation Rate','omega'=>'Specific Dissipation Rate','turb-viscosity'=> 'Turbulent Viscosity','temperature'=>'Temperature', 'enthalpy'=>'Energy','inert'=>'Inert','fvar'=>'Mixture Fraction Variance','fmean'=>'Mean Mixture Fraction','premixc'=>'Progress Variable' ); ! my %quantityMap; ! if($simulationType eq "Combustion"){ ! %quantityMap = %combustionMap; ! } ! else{ ! %quantityMap = %coldFlowMap; ! } ! my @refRelax = @tableContentArr; #! while(@tableContentArr){ #! pop(@tableContentArr);} ! pop(@pathItems); ! push(@pathItems, "ice-event_file"); ! $filename = join('/', @pathItems); ! my @tableContentArr1=(); ! if(open(infile,"<$filename")){ ! while(){ ! next if(index($_,"report-") >=0); ! my $pos1 = index($_,"\""); ! next if($pos1 < 0); ! my $str = substr($_,$pos1+1); ! $pos1 = index($str,"\""); ! my $name = substr($str,0,$pos1); ! my $descrip="-"; ! $pos1 = index($str,"start ."); ! next if($pos1 < 0); ! $str = substr($str,$pos1+8); ! $pos1 = index($str,")"); ! next if($pos1 < 0); ! my $curAngle = substr($str,0,$pos1); ! $str = substr($str,$pos1+10); ! $pos1 = index($str," "); ! my $str1 = substr($str,0,$pos1); ! $str = substr($str,$pos1+1); # Read only relaxations lines, otherwise continue ! next if(not ($str1 eq "12")); ! $_ = $str; ! my @strs = split; ! my $j=0; ! my $relax=""; ! my @curRelax = @refRelax; ! for($j=0; $j<@curRelax; ++$j){ ! $curRelax[$j]=",,"; ! } ! $curRelax[0]=$curAngle; ! for($j=0; $j<@strs; ){ ! ++$j; ! my $varName = $strs[$j]; ! ++$j; ! $pos1 = index($strs[$j],")"); ! my $varValue = substr($strs[$j],0,$pos1); ! ++$j; ! if(exists($quantityMap{$varName})){ ! my $indexArr=0; ! ++$indexArr until $tableTitleArr[$indexArr] eq $quantityMap{$varName} or $indexArr > $#tableTitleArr; ! if($indexArr <= $#tableTitleArr){ ! $curRelax[$indexArr] = $varValue; ! } ! } ! last if($j==@strs); ! } ! @tableContentArr=(@tableContentArr,@curRelax); ! } ! } ! close(infile); !} !sub DynamicMeshEventsTable{ !pop(@pathItems); !push(@pathItems, "ice-event_file"); !$filename = join('/', @pathItems); !my @tableContentArr1=(); !@tableContentArr=(),@tableTitleArr=(); !while(@tableTitleArr){ ! pop(@tableTitleArr);} !while(@tableContentArr){ ! pop(@tableContentArr);} !push(@tableTitleArr,"At Crank Angle (deg)"); !push(@tableTitleArr,"Name"); !push(@tableTitleArr,"Description"); !if(open(infile,"<$filename")){ ! while(){ ! next if(index($_,"report-") >=0); ! my $pos1 = index($_,"\""); ! next if($pos1 < 0); ! my $str = substr($_,$pos1+1); ! $pos1 = index($str,"\""); ! my $name = substr($str,0,$pos1); ! my $descrip="-"; ! $pos1 = index($str,"start ."); ! next if($pos1 < 0); ! $str = substr($str,$pos1+8); ! $pos1 = index($str,")"); ! next if($pos1 < 0); ! push(@tableContentArr1,substr($str,0,$pos1)); ! $str = substr($str,$pos1+10); ! $pos1 = index($str," "); ! my $str1 = substr($str,0,$pos1); ! $str = substr($str,$pos1+1); ! if(IsEqual($str1,"2")){ ! $descrip="-"; ! } ! elsif(IsEqual($str1,"5")){ ! $pos1 = index($str,")"); ! substr($name,length($name)) = "("; ! substr($name,length($name)) = substr($str,0,$pos1); ! substr($name,length($name)) = ")"; ! $descrip="-"; ! } ! elsif(IsEqual($str1,"8")){ ! $descrip="-"; ! } ! elsif(IsEqual($str1,"9")){ ! $descrip="-"; ! } ! elsif(IsEqual($str1,"12")){ ! $_ = $str; ! my @strs = split; ! my $j=0; ! my $relax=""; ! for($j=0; $j<@strs; ){ ! ++$j; ! substr($relax,length($relax)) = $strs[$j]; ! ++$j; ! substr($relax,length($relax)) = "="; ! $pos1 = index($strs[$j],")"); ! substr($relax,length($relax)) = substr($strs[$j],0,$pos1); ! ++$j; ! last if($j==@strs); ! substr($relax,length($relax)) = ", "; ! } ! if(length($relax) > 0){ ! $relax=$relax.". "; ! } ! $descrip=$relax; ! } ! elsif(IsEqual($str1,"15")){ ! $descrip="-"; ! } ! push(@tableContentArr1,$name); ! push(@tableContentArr1,$descrip); ! } !} !close(infile); !my $nbItem = @tableContentArr1/3; !my @IsSearched=(); !for($i=0;$i<$nbItem;++$i){ !push(@IsSearched,0); !} !my @tableContentArr2=(); !for($i=0;$i<$nbItem;++$i){ ! next if ($IsSearched[$i]); ! $IsSearched[$i]=1; ! push(@tableContentArr2,$tableContentArr1[3*$i]); ! push(@tableContentArr2,$tableContentArr1[3*$i+1]); ! push(@tableContentArr2,$tableContentArr1[3*$i+2]); ! for($j=$i+1;$j<$nbItem;++$j){ ! next if ($IsSearched[$j]); ! if($tableContentArr1[3*$j] == $tableContentArr1[3*$i]){ ! $IsSearched[$j]=1; ! my $str = $tableContentArr2[@tableContentArr2-2]; ! substr($str,length($str)) = ", "; ! substr($str,length($str)) = $tableContentArr1[3*$j+1]; ! $tableContentArr2[@tableContentArr2-2] = $str; ! } ! } !} # Sort the list by crank angle !$nbItem = @tableContentArr2/3; !my @indexArr=(); !for($i=0;$i<$nbItem;++$i){ ! push(@indexArr,$i); !} !for($i=0;$i<$nbItem;++$i){ ! for($j=$i+1;$j<$nbItem;++$j){ ! if($tableContentArr2[3*$indexArr[$i]] > $tableContentArr2[3*$indexArr[$j]]){ ! $tmp = $indexArr[$j]; ! $indexArr[$j] = $indexArr[$i]; ! $indexArr[$i] = $tmp; ! } ! } !} !for($i=0;$i<$nbItem;++$i){ ! push(@tableContentArr,$tableContentArr2[3*$indexArr[$i]]); ! push(@tableContentArr,$tableContentArr2[3*$indexArr[$i]+1]); ! push(@tableContentArr,$tableContentArr2[3*$indexArr[$i]+2]); !} !my @tableContentArrSep=(); !my $str1,$str2,$str3,$dispStr,$pos2,$pos1; !$nbItem = @tableContentArr/3; !for($i=0; $i<$nbItem; ++$i){ ! $str = $tableContentArr[3*$i+1]; ! if(length($tableContentArr[3*$i+2]) == 1){ ! $dispStr=""; ! } ! else{ ! $dispStr=$tableContentArr[3*$i+2]; ! } ! if((index($str,"reduce-urf-due-to-open")) >= 0){ ! substr($dispStr,length($dispStr)) = "Reducing URFs 1deg before valve opening for solution stability. "; ! } ! if((index($str,"reduce-urf-due-to-close")) >= 0){ ! substr($dispStr,length($dispStr)) = "Reducing URFs 1deg before valve closing for solution stability. "; ! } ! if( ((index($str,"increase-urf-due-to-open")) >= 0) || ((index($str,"increase-urf-due-to-close")) >= 0)){ ! substr($dispStr,length($dispStr)) = "Increasing URFs for accelerating the solution. "; ! } ! if( ((index($str,"open-invalve")) == 0) || ((index($str,"open-exvalve")) == 0) ){ ! substr($dispStr,length($dispStr)) = "Creating interface between vlayer and chamber for starting flow. "; ! } ! if( ((index($str,"close-invalve")) == 0) || ((index($str,"close-exvalve")) == 0) ){ ! substr($dispStr,length($dispStr)) = "Deleting interface between vlayer and chamber for stopping flow. "; ! } ! if( (index($str,"reduce-dt-due-to")) >= 0 ){ ! substr($dispStr,length($dispStr)) = "Reducing time step for solution stability. "; ! } ! if( (index($str,"increase-dt-due-to")) >= 0 ){ ! substr($dispStr,length($dispStr)) = "Increasing time step for accelerating the solution. "; ! } ! if( (index($str,"-vlayer-rigid-body")) >= 0 ){ ! substr($dispStr,length($dispStr)) = "Stop smoothing and start layering in vlayer region. "; ! } ! if( (index($str,"-seat-cell-height-at-closing")) >= 0 ){ ! substr($dispStr,length($dispStr)) = "Stop layering and start smoothing in vlayer region. "; ! } ! if( (index($str,"call-mesh-replace-initial")) >= 0 ){ ! substr($dispStr,length($dispStr)) = "Saves fluid zone names in a variable for later use. "; ! } ! if( (index($str,"call-mesh-replace-final")) >= 0 ){ ! substr($dispStr,length($dispStr)) = "Inserts interior zone and defines dynamic mesh controls on it. "; ! } ! if( (index($str,"delete-piston-interior-layer")) >= 0 ){ ! substr($dispStr,length($dispStr)) = "Delete the inserted interior zone. "; ! } ! if( (index($str,"save-residual-plot")) >= 0 ){ ! substr($dispStr,length($dispStr)) = "Saves the residual plot image from last saved iteration to the current iteration. "; ! } ! if( (index($str,"stop-smoothing-after")) >= 0 ){ ! substr($dispStr,length($dispStr)) = "Stops smoothing in vlayer and starts layering. "; ! } ! if( (index($str,"start-smoothing-before")) >= 0 ){ ! substr($dispStr,length($dispStr)) = "Stops layering in vlayer and starts smoothing. "; ! } ! if( (index($str,"activate-cell-zones")) >= 0 ){ ! substr($dispStr,length($dispStr)) = "Activates port cell zones for corresponding valves. "; ! } ! if( (index($str,"deactivate-cell-zones")) >= 0 ){ ! substr($dispStr,length($dispStr)) = "Deactivates unnecessary port cell zones. "; ! } ! if( (index($str,"dt-event-at-")) >= 0 ){ ! substr($dispStr,length($dispStr)) = "Changing the Time step size in terms of crank angle. "; ! } ! if( (index($str,"write-solution-point-at")) >= 0 ){ ! substr($dispStr,length($dispStr)) = "Saves solution files at this point. "; ! } ! push(@tableContentArrSep,$tableContentArr[3*$i]); ! push(@tableContentArrSep,$tableContentArr[3*$i+1]); ! push(@tableContentArrSep,$dispStr); ! $dispStr=""; # Separate -ob-fluid-vlayer-opening-deforming, -ib-fluid-ob-quad-opening-deforming, -ob-fluid-vlayer-cell-height, -seat-cell-height, delete-fluid- ! $pos = index($str,"-ob-fluid-vlayer-opening-deforming"); ! if($pos >= 0){ ! while($pos >= 0){ ! $pos = index($str,"-ob-fluid-vlayer-opening-deforming"); ! if($pos < 0){ ! $pos = index($str,"-ib-fluid-ob-quad-opening-deforming"); ! } ! if($pos < 0){ ! $pos = index($str,"-ob-fluid-vlayer-cell-height"); ! } ! if($pos < 0){ ! $pos = index($str,"-seat-cell-height"); ! } ! if($pos < 0){ ! $pos = index($str,"delete-fluid-"); ! } ! last if($pos < 0); ! $str1 = substr($str,0,$pos); ! $pos1 = rindex($str1 ,","); ! if($pos1<0){ ! $pos1 = 0; ! } ! $str2 = substr($str,$pos); ! $pos2 = index($str2 ,","); ! if($pos2<0){ ! $pos2 = length($str2); ! } ! $pos2 = $pos2+length($str1); ! substr($dispStr,length($dispStr)) = substr($str,$pos1,$pos2-$pos1); ! $str1 = substr($str,0,$pos1); ! substr($str1,length($str1)) = substr($str,$pos2); ! $str = $str1; ! } ! $pos=@tableContentArrSep; ! $tableContentArrSep[$pos-2] = $str; ! push(@tableContentArrSep,$tableContentArr[3*$i]); ! $pos = index($dispStr ,","); ! if($pos == 0){ ! $dispStr = substr($dispStr,1); ! } ! push(@tableContentArrSep,$dispStr); ! push(@tableContentArrSep,"Start Smoothing in vlayer region instead of layering. "); ! } !} !@tableContentArr = @tableContentArrSep; !$tableFormat = '%6.3f'; !$reportCaption = "Dynamic Mesh Events"; !PopulateTable(); !$tableFormat = '%10.3e'; !} !sub PopulateTable{ !++$TableSeqNum; TABLE:Table $TableSeqNum Table Exists = True END TABLE:Table $TableSeqNum OBJECT REPORT OPTIONS: Report Caption = $reportCaption END END !my $nbCol = @tableTitleArr; !for($i=1;$i<=$nbCol;++$i){ ! my $cellId = chr(64+$i); ! my $nbRow = (@tableContentArr)/($nbCol)+1; ! my $index=1,$count=1; ! for($j=0;$j<$nbRow;++$j){ ! my $cellId1 = $cellId; ! substr($cellId1,1) = ($j+1); ! my $str; ! if($j==0){ ! $str = $tableTitleArr[$i-1];} ! else{ ! $str = $tableContentArr[$nbCol*($j-1)+$i-1];} ! PutTableCell($cellId1,$str,$count); ! } !} !} !sub CreateClipPlane{ !++$PlaneSeqNum; PLANE:Plane $PlaneSeqNum Apply Instancing Transform = On Apply Texture = Off Blend Texture = On Bound Radius = 0.5 [m] Colour = 0.75, 0.75, 0.75 Colour Map = Default Colour Map Colour Mode = Constant Colour Scale = Linear Colour Variable = Pressure Colour Variable Boundary Values = Conservative Culling Mode = No Culling Direction 1 Bound = 1.0 [m] Direction 1 Orientation = 0 [degree] Direction 1 Points = 10 Direction 2 Bound = 1.0 [m] Direction 2 Points = 10 Domain List = /DOMAIN GROUP:All Domains Draw Faces = On Draw Lines = Off Instancing Transform = /DEFAULT INSTANCE TRANSFORM:Default Transform Invert Plane Bound = Off Lighting = On Line Colour = 0, 0, 0 Line Colour Mode = Default Line Width = 1 Max = 0.0 [Pa] Min = 0.0 [Pa] Normal = 1 , 0 , 0 Option = Three Points Plane Bound = None Plane Type = Slice Point = 0 [m], 0 [m], 0 [m] Point 1 = $point1[0] [m], $point1[1] [m], $point1[2] [m] Point 2 = $point2[0] [m], $point2[1] [m], $point2[2] [m] Point 3 = $point3[0] [m], $point3[1] [m], $point3[2] [m] Range = Global Render Edge Angle = 0 [degree] Specular Lighting = On Surface Drawing = Smooth Shading Texture Angle = 0 Texture Direction = 0 , 1 , 0 Texture File = Texture Material = Metal Texture Position = 0 , 0 Texture Scale = 1 Texture Type = Predefined Tile Texture = Off Transform Texture = Off Transparency = 0.0 X = 0.0 [m] Y = 0.0 [m] Z = 0.0 [m] OBJECT VIEW TRANSFORM: Apply Reflection = Off Apply Rotation = Off Apply Scale = Off Apply Translation = Off Principal Axis = Z Reflection Plane Option = XY Plane Rotation Angle = 0.0 [degree] Rotation Axis From = 0 [m], 0 [m], 0 [m] Rotation Axis To = 0 [m], 0 [m], 0 [m] Rotation Axis Type = Principal Axis Scale Vector = 1 , 1 , 1 Translation Vector = 0 [m], 0 [m], 0 [m] X = 0.0 [m] Y = 0.0 [m] Z = 0.0 [m] END END # Sending visibility action from ViewUtilities >show /PLANE:Plane $PlaneSeqNum, view=/VIEW:View 1 !} !sub CreateAnimation{ #! my ($format)=@_; !$str = join('/', @pathItems); !if($^O eq 'linux'){ ! system("rm $str"); !} !else{ !unlink($str); !} !pop(@pathItems); !my $directory = join('/', @pathItems); #rename the files to serial order !my $src,$trg,$num,@srcArr=(),@trgArr=(); !my $count=-1; !opendir(DIR,$directory); !my @dirFiles=(); !while ($file = readdir(DIR) ) !{ ! push(@dirFiles,$file); !} !my @sortedDirFiles=sort @dirFiles; !for(my $findex=0; $findex<@sortedDirFiles;++$findex){ ! $src = @sortedDirFiles[$findex]; ! next if(index($src,$format) != 0); ! ! $num="000"; ! substr($num,3) = ++$count; ! $num = substr($num,(length($num) - 4)); ! ! $trg=$format; ! substr($trg,length($trg)) = $num; ! substr($trg,length($trg)) = ".jpg"; ! next if (IsEqual($src,$trg)); ! ! my $srcPath = $directory; ! substr($srcPath,length($srcPath)) = "/"; ! substr($srcPath,length($srcPath)) = $src; ! ! my $trgPath = $directory; ! substr($trgPath,length($trgPath)) = "/"; ! substr($trgPath,length($trgPath)) = $trg; ! ! rename($srcPath,$trgPath); ! push(@srcArr,$srcPath); ! push(@trgArr,$trgPath); !} !closedir(DIR); !$filename = join('/', @pathItems); !my $cmd = "\"$ffmpeg\" -r 2 -f image2 -loop_output 0 -i \"$filename/$format%%04d.jpg\" -pix_fmt rgb24 \"$filename/$format.gif\""; !if($^O eq 'linux'){ ! $cmd = "\"$ffmpeg\" -r 2 -f image2 -loop_output 0 -i \"$filename/$format%04d.jpg\" -pix_fmt rgb24 \"$filename/$format.gif\" < /dev/null"; ! my @arr=(); ! push(@arr,$cmd); ! system(@arr); !} !else{ !my $batfile=$format; !substr($batfile,length($batfile)) = ".bat"; !push(@pathItems, $batfile); !$filename = join('/', @pathItems); !pop(@pathItems); !if(open(tmpoutfile,">$filename")){ !print tmpoutfile $cmd; !close(tmpoutfile); !my @arr; !@arr=(); !my $str1="\""; !substr($str1,length($str1)) = $filename; !substr($str1,length($str1)) = "\""; !push(@arr,$str1); !system(@arr); !unlink($filename); !} !} #rename the files back !for($i=(@srcArr-1);$i>=0;--$i){ ! rename($trgArr[$i],$srcArr[$i]); !} !} !sub ReadRpmOld{ !pop(@pathItems); !push(@pathItems, "ice-bc_rpm"); !my $filename = join('/', @pathItems); !if(open(infile,"<$filename")){ !while(){ ! my $pos = index($_,"(dynamesh/in-cyn/crank-rpm"); ! if($pos >= 0){ ! $pos = rindex($_,")"); ! last if($pos < 0); ! my $str = substr($_,0,$pos); ! $pos = rindex($str," "); ! last if($pos < 0); ! $rpm = substr($str,$pos+1); ! last if(1); ! } !} !} !close(infile); !} !sub ReadRpm{ !my @tmpPathItems = @pathItems; !pop(@tmpPathItems); !pop(@tmpPathItems); !push(@tmpPathItems, "ICE/icDyMSettings.txt"); !my $filename = join('/', @tmpPathItems); !my $success = open(infile,"<$filename"); !if(!$success){ ! pop(@tmpPathItems); ! push(@tmpPathItems, "ICE/icSolverSettings.txt"); ! $filename = join('/', @tmpPathItems); ! $success = open(infile,"<$filename"); !} !if(!$success){ ! return; !} ! while(){ ! @strs = split; ! last if(@strs < 2); ! if(IsEqual($strs[0],"rpm")){ ! $rpm = $strs[1]; ! } ! if(IsEqual($strs[0],"start_crank_angle")){ ! $startCrankAngle = $strs[1]; ! last if(1); ! } ! } !close(infile); !} !sub ChartForResiduals(){ !@ChartNames=(); !@ChartPaths=(); !pop(@pathItems); !push(@pathItems, "ice-residual"); !my $filename = join('/', @pathItems); !if(open(infile,"<$filename")){ !my $str="((xy/key/label \"continuity\")\n",$pos=0; ! while(){ ! if(IsEqual($str,$_)){ ! $pos = tell(infile); ! } ! } !if($pos ==0){ ! return; !} !seek(infile,$pos,SEEK_SET); !while(length($str) > 1){ ! $pos = rindex($str,"\""); ! last if($pos < 0); ! $str = substr($str,0,$pos); ! $pos = rindex($str,"\""); ! last if($pos < 0); ! $str = substr($str,$pos+1); ! my $prefix="ice-"; ! substr($prefix,length($prefix))=$str; ! pop(@pathItems); ! push(@pathItems, $prefix); ! $filename = join('/', @pathItems); ! substr($filename,length($filename)) = ".csv"; ! push(@ChartPaths, $filename); ! push(@ChartNames, $str); ! open(outfile1,">$filename")|| die "cant write file"; ! while(){ ! @strs = split; ! last if(@strs == 1); ! print outfile1 $strs[0]; ! print outfile1 ","; ! print outfile1 $strs[1]; ! print outfile1 "\n"; ! } ! $str=""; ! while(){ ! next if(length == 1); ! $str = $_; ! last if(1); ! } ! close(outfile1); !} !close(infile); !++$ChartSeqNum; !$maxY=100.0; !$minY=1e-8; !$yAutomaticRange='Off'; !$yLogScale='On'; !CreateChart($ChartSeqNum,"Residuals","Iteration"); !$yAutomaticRange='On'; !$yLogScale='Off'; !} !} !sub CreateTable{ !my $j=0,$i; !my $pos,@valves; !@Column1=(),@Size1=(),@Column2=(),@Size2=(),@Column3=(),@Size3=(); !push(@Column1,"Type"); !push(@Size1,1); !push(@Column2,"Zones"); !push(@Size2,1); !push(@Column3,"Values"); !push(@Size3,1); !my $strIb,$strCh,$strOb,$strStem,@tempArr1=(),@tempArr2=(),@proceed=(); !for($i=0;$i<@bcTypes;++$i){ ! if(length($bcStrings[$i]) == 0){ ! push(@proceed,0); ! } ! else{ ! push(@proceed,1); ! $pos = rindex($bcNames[$i],"-ob"); ! if($pos>=0){ ! push(@valves,substr($bcNames[$i],0,$pos)); ! } ! } !} # Valves !for($i=0; $i<@valves; $i++){ ! @tempArr1=(); ! @tempArr2=(); ! $strIb = $valves[$i]; ! substr($strIb,length($strIb)) = "-ib"; ! $strOb = $valves[$i]; ! substr($strOb,length($strOb)) = "-ob"; ! $strCh = $valves[$i]; ! substr($strCh,length($strCh)) = "-ch"; ! $strStem = $valves[$i]; ! substr($strStem,length($strStem)) = "-stem"; ! for($j=0; $j<@bcTypes; $j++){ ! next if($proceed[$j] == 0); ! if( IsEqual($strIb,$bcNames[$j]) ! ||IsEqual($strCh,$bcNames[$j]) ! ||IsEqual($strOb,$bcNames[$j]) ! ||IsEqual($strStem,$bcNames[$j]) ){ ! push(@tempArr1,$bcNames[$j]); ! push(@tempArr2,$bcStrings[$j]); ! $proceed[$j] = 0; ! } ! } ! GroupBC(@tempArr1,@tempArr2); ! $strIb = "wall ("; ! substr($strIb,length($strIb)) = $valves[$i]; ! substr($strIb,length($strIb)) = ")"; ! FillData($strIb,@tempArr1,@tempArr2); !} # Ports !for($i=0;$i<2;++$i) !{ ! my $str; ! if($i==0){ ! $str="invalve";} ! else{ ! $str="exvalve";} ! @tempArr1=(); ! @tempArr2=(); ! my $str2 = "seat-"; ! substr($str2,length($str2)) = $str; ! for($j=0; $j<@bcTypes; $j++){ ! next if($proceed[$j] == 0); ! my $found=0; ! if(rindex($bcNames[$j],$str) == 0){ ! if(rindex($bcNames[$j],"-port") == (length($bcNames[$j])-5)){ ! $found=1;} ! } ! elsif(rindex($bcNames[$j],$str2) == 0){ ! $found=1; ! } ! if($found){ ! push(@tempArr1,$bcNames[$j]); ! push(@tempArr2,$bcStrings[$j]); ! $proceed[$j] = 0; ! } ! } ! if(@tempArr1){ ! GroupBC(@tempArr1,@tempArr2); ! my $str1 = "wall ("; ! substr($str1,length($str1)) = $str; ! substr($str1,length($str1)) = "-port)"; ! FillData($str1,@tempArr1,@tempArr2); ! } !} #Others !for($j=0; $j<@bcTypes; $j++){ ! next if($proceed[$j] == 0); ! @tempArr1=(); ! @tempArr2=(); ! push(@tempArr1,$bcNames[$j]); ! push(@tempArr2,$bcStrings[$j]); ! FillData($bcTypes[$j],@tempArr1,@tempArr2); !} !++$TableSeqNum; TABLE:Table $TableSeqNum Table Exists = True END TABLE:Table $TableSeqNum OBJECT REPORT OPTIONS: Report Caption = Boundary Conditions END END !for($i=1;$i<=3;++$i){ ! my @tmpArr=(),@tmpSizeArr=(); ! if($i==1){ ! @tmpArr = @Column1; ! @tmpSizeArr = @Size1; ! } ! elsif($i==2){ ! @tmpArr = @Column2; ! @tmpSizeArr = @Size2; ! } ! else{ ! @tmpArr = @Column3; ! @tmpSizeArr = @Size3; ! } ! my $cellId = chr(64+$i); ! my $length = @tmpArr; ! my $index=1,$count=1; ! for($j=1;$j<=$length;++$j){ ! my $cellId1 = $cellId; ! substr($cellId1,1) = $index; ! $index += $tmpSizeArr[$j-1]; ! $count=$tmpSizeArr[$j-1]; ! PutTableCell($cellId1,$tmpArr[$j-1],$count); ! } !} !} ! sub FillData{ ! my ($title)=@_; ! my $length1=0; ! for(my $j=0; $j<@tempArr2; $j++){ ! my @strs = split(/(?=\n)/,$tempArr2[$j]); ! pop(@strs); ! my $length2 = @strs; ! for($k=0;$k<$length2;++$k){ ! push(@Column3, $strs[$k]); ! push(@Size3, 1); ! } ! push(@Column2, $tempArr1[$j]); ! push(@Size2, $length2); ! $length1 += $length2; ! } ! push(@Column1, $title); ! push(@Size1, $length1); !} !sub GroupBC{ !my ($tempArr1,$tempArr2)=@_; ! my @newTempArr1=(),@newTempArr2=(),@arr=(); ! for(my $i=0;$i<@tempArr1;++$i){ ! push(@arr,0);} ! for(my $i=0;$i<@tempArr1;++$i){ ! if($arr[$i] == 0){ ! push (@newTempArr1,$tempArr1[$i]); ! push (@newTempArr2,$tempArr2[$i]); ! } ! for(my $j=($i+1);$j<@tempArr1;++$j){ ! if(IsEqual($tempArr2[$i],$tempArr2[$j])) { ! substr($newTempArr1[$i],length($newTempArr1[$i]))=", "; ! substr($newTempArr1[$i],length($newTempArr1[$i]))=$tempArr1[$j]; ! $arr[$j] = 1; ! } ! } ! } ! @tempArr1=@newTempArr1; ! @tempArr2=@newTempArr2; !} !sub PutTableCell{ !my ($cellId,$cellStr,$count)=@_; TABLE:Table $TableSeqNum TABLE CELLS: ! my $i=1; ! my $str1 = substr($cellId,0,1),$str2 = substr($cellId,1); ! for($i=2; $i<= $count; ++$i){ ! ++$str2; ! my $str3 = $str1; ! substr($str3,1) = $str2; ! print outfile1 $str3; ! print outfile1 "\n"; $str3 = ! } ! if(IsEqual($str2,"1")){ $cellId = "$cellStr", True, False, False, Left, True, 0, Font Name, $count|1, $tableFormat, True, d1dcea, 000000, True ! } ! elsif(IsEqual($str1,"A")){ $cellId = "$cellStr", False, False, False, Left, True, 0, Font Name, $count|1, $tableFormat, True, e8eef5, 000000, True ! } ! else{ $cellId = "$cellStr", False, False, False, Left, True, 0, Font Name, $count|1, $tableFormat, True, ffffff, 000000, True ! } END END !} !sub ReadBoundaryConditions{ !while() !{ ! $pos = rindex($_,"Boundary Conditions"); ! if($pos>=0){ ! $i=0; ! #Ignore 6 lines ! while(){ ! ++$i; ! last if($i==6); ! } ! $i=1; ! while() ! { ! @strs = split; ! $i = @strs; ! if($i>0){ ! push(@bcNames,$strs[0]); ! push(@bcTypes,$strs[2]); ! } ! last if($i==0); ! } ! $i=0; ! #Ignore 2 lines ! while(){ ! ++$i; ! last if($i==2); ! } ! $i=0; ! last if($i==0); ! } !} !$num=0; !my $skip=0; !while() !{ ! $i=0; ! #Ignore 4 lines ! while(){ ! last if(++$i==3); ! } ! $skip=0; ! if(rindex($bcTypes[$num],"interface") > -1){ ! $skip=1; ! } ! elsif(rindex($bcNames[$num],"intf") == 0){ ! $skip=1; ! } #Igone wall-number etc.. ! elsif(rindex($bcNames[$num],"wall-") == 0){ ! print outfile1 substr($bcNames[$num],5,1); ! print outfile1 ord(substr($bcNames[$num],5,1)); ! print outfile1 "\n"; ! if(ord(substr($bcNames[$num],5,1)) <= 57){ ! $skip=1; ! } ! } ! if($skip == 0){ ! if(IsEqual($bcTypes[$num],"mass-flow-inlet") ! || IsEqual($bcTypes[$num],"pressure-inlet") ! || IsEqual($bcTypes[$num],"pressure-outlet") ! || IsEqual($bcTypes[$num],"wall")) { ! $skip = 0; ! } ! else{ ! $skip = 1; ! } ! } ! if($skip == 0){ ! $str = GetBCString($bcTypes[$num]); ! push(@bcStrings,$str); #! my @strs = split(/(?=\n)/,$str); #! pop(@strs); #! my $length = @strs; #! push(@bcStringsLen,$length); #! push(@bcStrings,@strs); ! } ! else{ ! #skip BC ! while() ! { ! last if(length($_) == 1); ! } ! $str=""; ! push(@bcStringsLen,1); ! push(@bcStrings,$str); ! } ! ++$num; ! last if($num == @bcTypes); !} !} !sub GetBCString{ ! my ($string1) = @_; ! my $str="",$pos,$walltype=0; ! while() ! { ! last if(length($_) == 1); ! if(IsEqual($string1,"mass-flow-inlet")){ ! if( (($pos = index($_,"Mass Flow Rate")) > -1) ! ||(($pos = index($_,"Total Temperature")) > -1) ){ ! substr($str,length($str)) = substr($_,$pos); ! } ! } ! elsif(IsEqual($string1,"pressure-inlet")){ ! if( (($pos = index($_,"Gauge Total Pressure")) > -1) ! ||(($pos = index($_,"Supersonic/Initial Gauge Pressure")) > -1) ! ||(($pos = index($_,"Total Temperature")) > -1) ){ ! substr($str,length($str)) = substr($_,$pos); ! } ! } ! elsif(IsEqual($string1,"pressure-outlet")){ ! if( (($pos = index($_,"Gauge Pressure")) > -1) ! ||(($pos = index($_,"Backflow Total Temperature")) > -1) ){ ! substr($str,length($str)) = substr($_,$pos); ! } ! } ! elsif(IsEqual($string1,"wall")){ ! if( ($pos = index($_,"Thermal BC Type")) > -1 ){ ! my @strs = split; #0-temperature, 1-heat flux ! $walltype = $strs[@strs-1]; ! } ! if($walltype == 1){ ! if( (($pos = index($_,"Heat Flux")) > -1) ){ ! substr($str,length($str)) = substr($_,$pos); ! } ! } ! elsif($walltype == 0){ ! if( ($pos = index($_," Temperature")) > -1){ ! substr($str,length($str)) = substr($_,$pos+2); ! } ! } ! } ! } ! return $str; !} !sub IsEqual{ ! my ($string1,$string2) = @_; ! my $equal=0; ! if( length($string1) == length($string2) ) ! { ! if(index($string1,$string2) == 0){ ! $equal=1; ! } ! } ! return $equal; !} !sub CommentImage{ !my ($heading,$level,$filename) = @_; !++$CommentSeqNum; COMMENT:Comment $CommentSeqNum Comment Exists = True END # Comment CCL: COMMENT:Comment $CommentSeqNum Comment Text =

Comment Heading = $heading Heading Level = $level END !} !sub CommentText{ !my ($heading,$level) = @_; !++$CommentSeqNum; COMMENT:Comment $CommentSeqNum Comment Exists = True END # Comment CCL: COMMENT:Comment $CommentSeqNum Comment Text =

Comment Heading = $heading Heading Level = $level END !} !sub ReadMonitorNames{ ! pop(@pathItems); ! push(@pathItems, "ice-monitors"); ! $filename = join('/', @pathItems); ! if(open(infile,"<$filename")){ ! while(){ ! my @strs = split; ! next if(@strs<1); ! if(IsEqual($strs[0],"Monitor")){ ! while(){ ! my @strs = split; ! last if(@strs<=6); ! push(@monitorNames, $strs[0]); ! my @tmpArr=(); ! push(@tmpArr,"Monitor: "); ! for(my $i=5;$i<@strs;++$i){ ! push(@tmpArr,$strs[$i]); ! } ! $filename = join(' ', @tmpArr); ! push(@monitorStrings,$filename); ! } ! } ! } ! } !} # Create Monitor file !sub CreateMonitorCSVFile{ ! my ($filename,$filename1) = @_; ! my $success = open(infile,"<$filename"); ! if(!$success){ ! return; ! } ! open(outfile1,">$filename1")|| die "cant write file"; ! my $ratio,@strs=(); ! my $i=0; ! my $title,$xName,$yName; ! my $position; ! my @inpCol1=(),@inpCol2=(); ! while() ! { ! if($i==0){ ! $title=$_; ! chop($title); ! chop($title); ! $position = rindex($title,"\""); !if($position>0){ ! $title = substr($title,0,$position); ! } ! $title = substr($title,1); ! my $j=0; ! for($j=0; $j<@monitorNames;++$j){ ! last if (rindex($filename,$monitorNames[$j]) > 0); ! } ! if($j<@monitorStrings){ ! $title = $monitorStrings[$j]; ! } ! } ! elsif($i==1){ ! $position = rindex($_,"\""); ! $tmp = substr($_,0,$position); ! $position = rindex($tmp,"\""); ! $yName = substr($tmp,$position+1); ! $tmp = substr($tmp,0,$position-1); ! $position = rindex($tmp,"\""); ! $tmp = substr($tmp,0,$position); ! $xName = substr($tmp,1); ! if(($xName eq "Flow Time")||($xName eq "Flow time")){ ! $xName = "Crank Angle";} ! } ! else{ ! @strs = split; ! if(IsEqual($xName,"Crank Angle")){ ! push(@inpCol1,($strs[0]*$rpm*6+$startCrankAngle)); ! } ! else{ ! push(@inpCol1,$strs[0]); ! } ! push(@inpCol2,$strs[1]); ! } ! $i=$i+1; ! } ! close(infile); ! my @outCol1=(),@outCol2=(); ! if(@inpCol1>1){ ! my $prevVal=$inpCol1[@inpCol1-1]; ! push(@outCol1,$inpCol1[@inpCol1-1]); ! push(@outCol2,$inpCol2[@inpCol2-1]); ! for($i=(@inpCol1-2); $i>=0; --$i){ ! if($inpCol1[$i] < $prevVal){ ! $prevVal=$inpCol1[$i]; ! push(@outCol1,$inpCol1[$i]); ! push(@outCol2,$inpCol2[$i]); ! } ! } ! } ! for($i=(@outCol1-1); $i>=0; --$i){ ! print outfile1 $outCol1[$i]; ! print outfile1 ","; ! print outfile1 $outCol2[$i]; ! print outfile1 "\n"; ! } ! close(outfile1); ! $chartTitle = $title; ! $chartxName = $xName; ! $chartyName = $yName; !} !sub MonitorChart{ !my ($filename,$filename1) = @_; ! my $success = open(infile,"<$filename"); ! if(!$success){ ! return; ! } !close(infile); !$chartTitle,$chartxName,$chartyName; !CreateMonitorCSVFile($filename,$filename1); !if(not ($chartTitle eq "")) !{ ! ++$ChartSeqNum; ! @ChartNames=(); ! @ChartPaths=(); ! push(@ChartPaths, $filename1); ! push(@ChartNames, $chartyName); ! CreateChart($ChartSeqNum,$chartTitle,$chartxName); !} !} !sub CreateChart{ !my ($SeqNum,$title,$xName) = @_; CHART:Chart $SeqNum Chart Axes Font = Tahoma, 10, False, False, False, False Chart Axes Titles Font = Tahoma, 10, True, False, False, False Chart Grid Line Width = 1 Chart Horizontal Grid = On !if(@ChartNames>1){ Chart Legend = On !} !else{ Chart Legend = Off !} Chart Legend Font = Tahoma, 8, False, False, False, False Chart Legend Inside = Outside Chart Chart Legend Justification = Center Chart Legend Position = Bottom Chart Legend Width Height = 0.2 , 0.4 Chart Legend X Justification = Right Chart Legend XY Position = 0.73 , 0.275 Chart Legend Y Justification = Center Chart Line Width = 2 Chart Lines Order = Series 1,Chart Line 1 Chart Minor Grid = On Chart Minor Grid Line Width = 1 Chart Symbol Size = 4 Chart Title = $title Chart Title Font = Tahoma, 12, True, False, False, False Chart Type = XY Chart Vertical Grid = On Chart X Axis Automatic Number Formatting = On Chart X Axis Label = $xName Chart X Axis Number Format = %10.3e Chart Y Axis Automatic Number Formatting = $yAutoNumFormat !if(@ChartNames==1){ Chart Y Axis Label = $ChartNames[0] !} !else{ Chart Y Axis Label = $title !} Chart Y Axis Number Format = $yNumFormat Default Chart X Variable = Chart Count Default Chart Y Variable = Pressure Default Histogram Y Axis Weighting = None Default Time Chart Variable = Pressure Default Time Chart X Expression = Time Default Time Variable Absolute Value = Off Default Time Variable Boundary Values = Conservative Default X Variable Absolute Value = Off Default X Variable Boundary Values = Conservative Default Y Variable Absolute Value = $ChartYAbsolute Default Y Variable Boundary Values = Conservative FFT Full Input Range = On FFT Max = 0.0 FFT Min = 0.0 FFT Subtract Mean = Off FFT Window Type = Hanning FFT X Function = Frequency FFT Y Function = Power Spectral Density Histogram Automatic Divisions = Automatic Histogram Divisions = -1.0,1.0 Histogram Divisions Count = 10 Histogram Y Axis Value = Count Is FFT Chart = Off Max X = 1.0 Max Y = $maxY Min X = -1.0 Min Y = $minY Time Chart Keep Single Case = Off Use Data For X Axis Labels = Off Use Data For Y Axis Labels = Off X Axis Automatic Range = On X Axis Inverted = Off X Axis Logarithmic Scaling = Off Y Axis Automatic Range = $yAutomaticRange Y Axis Inverted = Off Y Axis Logarithmic Scaling = $yLogScale !for(my $i=1; $i <= @ChartNames; ++$i){ CHART SERIES:Series $i Chart Line Custom Data Selection = Off Chart Line Filename = $ChartPaths[$i-1] Chart Series Type = From File Series Name = $ChartNames[$i-1] Time Chart Expression = Time Time Chart Type = Point CHART LINE:Chart Line $i !if(@ChartNames>1){ Auto Chart Line Colour = On Chart Line Colour = 1.0, 0.0, 0.0 Chart Symbol Colour = 0.0, 1.0, 0.0 Chart Symbol Style = None !} !else{ Auto Chart Line Colour = Off Chart Line Colour = 0, 0, 1 Chart Symbol Colour = 0, 0, 1 Chart Symbol Style = None !} Chart Line Style = Automatic Chart Line Visibility = On Fill Area = On Fill Area Options = Automatic Is Valid = True Line Name = $ChartNames[$i-1] Use Automatic Line Naming = On END END !} OBJECT REPORT OPTIONS: Report Caption = $title END END !} !sub CommentICESystemInputs(){ !my @tmpPathItems = @pathItems; !pop(@tmpPathItems); !pop(@tmpPathItems); !push(@tmpPathItems, "ICE"); !push(@tmpPathItems, "icDyMSettings.txt"); !my $filename = join('/', @tmpPathItems); !my $success = open(infile,"<$filename"); !if(!$success){ ! pop(@tmpPathItems); ! push(@tmpPathItems, "icSolverSettings.txt"); ! $filename = join('/', @tmpPathItems); ! $success = open(infile,"<$filename"); !} !if(!$success){ ! return; !} !my @EngineInputs=(); ! while(){ ! my @strs=split; ! last if(@strs < 2); ! my $str=""; ! if(index($strs[0],"rpm") == 0){ ! $str = "Engine Speed (rev/min) : "; ! substr($str, length($str))=($strs[1]*1); ! push(@EngineInputs,$str); ! } ! elsif(index($strs[0],"crank_radius") == 0){ ! $str = "Crank Radius (mm) : "; ! substr($str, length($str))=($strs[1]*1000); ! push(@EngineInputs,$str); ! } ! elsif(index($strs[0],"connecting_rod_length") == 0){ ! $str = "Connecting Rod Length (mm) : "; ! substr($str, length($str))=($strs[1]*1000); ! push(@EngineInputs,$str); ! } ! elsif(index($strs[0],"piston_pin_offset") == 0){ ! $str = "Piston Pin Offset/Wrench (mm) : "; ! substr($str, length($str))=($strs[1]*1000); ! push(@EngineInputs,$str); ! } ! elsif(index($strs[0],"min_valve_lift") == 0){ ! $str = "Minimum Lift (mm) : "; ! substr($str, length($str))=($strs[1]*1000); ! push(@EngineInputs,$str); ! } ! } !close(infile); !pop(@pathItems); !push(@pathItems,"ice-custom-file-list"); !my $filename = join('/', @pathItems); !my $pre="",$post=""; !if(open(infile,"<$filename")){ ! while(){ ! if(index($_,"pre-iter-file") == 0){ ! my $pos = rindex($_,"\\"); ! if($pos>0){ ! $pre = substr($_,$pos+1); ! } ! } ! elsif(index($_,"post-iter-file") == 0){ ! my $pos = rindex($_,"\\"); ! if($pos>0){ ! $post = substr($_,$pos+1); ! } ! } ! } !} !close(infile); !my $comment = "

Engine Inputs

"; !for(my $i=0;$i<@EngineInputs; ++$i){ !substr($comment,length($comment)) = "

$EngineInputs[$i]

"; !} !substr($comment,length($comment)) = "

-

"; !substr($comment,length($comment)) = "

Journal Customization

"; !if(length($pre)) { !pop(@tmpPathItems); !push(@tmpPathItems, $pre); !$filename = join('/', @tmpPathItems); !substr($comment,length($comment)) = "

Pre Iteration Journal File : $pre view

"; !} !else { !substr($comment,length($comment)) = "

Pre Iteration Journal File : N/A

"; !} !if(length($post)) { !pop(@tmpPathItems); !push(@tmpPathItems, $post); !$filename = join('/', @tmpPathItems); !substr($comment,length($comment)) = "

Post Iteration Journal File : $post view

"; !} !else { !substr($comment,length($comment)) = "

Post Iteration Journal File : N/A

"; !} !++$CommentSeqNum; COMMENT:Comment $CommentSeqNum Comment Text = $comment Comment Heading = IC Engine System Inputs Heading Level = 2 END !} # Session file stopped: 2011/04/18 16:31:02 # # Run system level commands !sub IcRunCommands{ ! if(scalar(@_) < 1){ ! return; ! } ! if($^O eq 'linux'){ ! my @arr=(); ! foreach $item (@_){ ! push(@arr,$item); ! } ! system(@arr); ! } ! else{ ! pop(@pathItems); ! my $batfile="ice.bat"; ! push(@pathItems, $batfile); ! $filename = join('/', @pathItems); ! if(open(tmpoutfile,">$filename")){ ! foreach $item (@_){ ! print tmpoutfile $item; ! print tmpoutfile "\n"; ! } ! } ! close(tmpoutfile); ! my @arr; ! @arr=(); ! my $str1="\"".$filename."\""; ! push(@arr,$str1); ! system(@arr); ! unlink($filename); ! } !} # Copying files for standalone runs from Fluent directory to Report directory !sub IcMoveFilesFromFluentToReportDir{ ! my @tmpPathItems = @pathItems; ! pop(@tmpPathItems); ! if($^O eq 'linux'){ ! my $reportDir = join('/', @tmpPathItems); ! pop(@tmpPathItems); ! push(@tmpPathItems,"Fluent"); ! my $fluentDir = join('/', @tmpPathItems); ! IcRunCommands("cp \"".$fluentDir."/ice-cell-count-*\" \"".$reportDir."\""); ! IcRunCommands("cp \"".$fluentDir."/ice-report-solver-settings-*\" \"".$reportDir."\""); ! IcRunCommands("cp \"".$fluentDir."/*.jpg\" \"".$reportDir."\""); ! IcRunCommands("cp \"".$fluentDir."/ice-incylinder-output.txt\" \"".$reportDir."\""); ! } ! else{ ! my $reportDir = join('\\', @tmpPathItems); ! pop(@tmpPathItems); ! push(@tmpPathItems,"Fluent"); ! my $fluentDir = join('\\', @tmpPathItems); ! my $cmd1 = "copy /Y \"".$fluentDir."\\ice-cell-count-*\" \"".$reportDir."\""; ! my $cmd2 = "copy /Y \"".$fluentDir."\\ice-report-solver-settings-*\" \"".$reportDir."\""; ! my $cmd3 = "copy /Y \"".$fluentDir."\\*.jpg\" \"".$reportDir."\""; ! my $cmd4 = "copy /Y \"".$fluentDir."\\ice-incylinder-output.txt\" \"".$reportDir."\""; ! IcRunCommands($cmd1,$cmd2,$cmd3,$cmd4); ! } !} !sub ChartForLastResiduals(){ !pop(@pathItemsFluent); !@ChartNames=(); !@ChartPaths=(); !$filename = join('/', @pathItemsFluent); !opendir(DIR,$filename) || die "NO SUCH Directory: Images"; !while ($file = readdir(DIR) ) !{ ! my $pos = rindex($file,"ice-last-residual-monitor-"); ! next if($pos<0); ! my $tmp = substr($file,(length($file))-4,4); ! if(rindex($tmp,".out") == 0) ! { ! $tmp = substr($file,0,(length($file))-4); ! push(@pathItemsFluent, $file); ! $filename = join('/', @pathItemsFluent); ! pop(@pathItems); ! my $tmp1 = join('.',$tmp,"csv"); ! push(@pathItems, $tmp1); ! $filename1 = join('/', @pathItems); ! pop(@pathItemsFluent); ! CreateMonitorCSVFile($filename,$filename1); ! push(@ChartPaths, $filename1); ! my $disName = substr($tmp,(length("ice-last-residual-monitor-"))); ! push(@ChartNames,$disName); ! } !} !closedir(DIR); !push(@pathItemsFluent, "tmp"); !++$ChartSeqNum; !$maxY=100.0; !$minY=1e-8; !my $yLogScalePrev=$yLogScale; !$yLogScale='On'; !my $yAutoNumFormatPrev = $yAutoNumFormat; !$yAutoNumFormat='Off'; !my $yNumFormatPrev=$yNumFormat; !$yNumFormat='%8.1e'; !CreateChart($ChartSeqNum,"Last iteration residual values corresponding to each time step","Crank Angle"); !@ChartNames=(); !@ChartPaths=(); !$yAutoNumFormat=$yAutoNumFormatPrev; !$yNumFormat=$yNumFormatPrev; !$yLogScale=$yLogScalePrev; !} !sub CreateForteReport{ !use warnings; !use Math::Trig; !use Math::Complex; !use Math::Quaternion qw(slerp); !@designpoints=(); !my $resulti = getValue( "/DATA READER", "Current Results File" ) ; !$resulti =~ s/\\/\//g; !my @fortepathi = split(/\//, $resulti); !my @ftindpath = split(/\//, $resulti); !pop(@ftindpath); !$ftindpath = join('/', @ftindpath); !pop(@fortepathi); !pop(@fortepathi); !$forteprojectpath = join('/', @fortepathi); !die "Please specify which directory to search" !unless -d $forteprojectpath; !opendir( my $DIR, $forteprojectpath ); !while ( my $entry = readdir $DIR ) { ! next unless -d $forteprojectpath . '/' . $entry; ! next if $entry eq '.' or $entry eq '..'; ! print "Found directory $entry\n"; ! push (@designpoints, $entry); ! } !closedir $DIR; !@designpoints=reverse @designpoints; !pop @designpoints; !my @setuppath = split(/\//, $resulti); !pop(@setuppath); !pop(@setuppath); !pop(@setuppath); !pop(@setuppath); !push(@setuppath,"ICE/ice-setup-settings.txt"); !$setupsettings = join('/', @setuppath); !pop(@setuppath); !$success = open($infile,"<$setupsettings") or die "Could not open '$setupsettings' $!\n"; !if(!$success){ ! return; ! } !while(<$infile>){ ! $pos = index($_,"solution_load_parametric"); ! if($pos >=0){ ! my @value = split(' ', $_); ! $parametric= pop(@value); ! } ! } !push(@setuppath,"ICE/icSolverSettings.txt"); !$solversettings = join('/', @setuppath); !pop(@setuppath); !$success = open($infile,"<$solversettings") or die "Could not open '$solversettings' $!\n"; !if(!$success){ ! return; ! } !while(<$infile>){ ! $pos = index($_,"crank_radius"); ! if($pos >=0){ ! my @value = split(' ', $_); ! $crankradius= pop(@value); ! } ! } !#finding multiple .ftind files from rerun !sub ftind{ !$path=$_[0]; !opendir(DIR,$path); !my @files = readdir(DIR); !closedir(DIR); !foreach $line(@files){ ! if ( $line=~/.ftind/ ){ ! push (@ftind,$line); ! } !} ! return @ftind; ! @ftind=(); !close DIR; !} !@reportpath=@fortepathi; !pop(@reportpath); !pop(@reportpath); !push(@reportpath,"Post"); !$fortereportdir = join('/', @reportpath); !if($parametric eq "#t"){ ! $i=0; ! foreach $design(@designpoints){ ! $case=$forteprojectpath."/".$design."/".$design.".ftind"; ! $ftindpathd=$forteprojectpath."/".$design; ! $fortereportpath=$fortereportdir."/".$design; ! @ftind=(); ! my @ftind=ftind($ftindpathd); ! $s=0; ! foreach $ftind(@ftind){ ! $forteindexfile=$forteprojectpath."/".$design."/".$ftind; ! if ($i==0){ ! $i++; ! goto load;} DATA READER: Clear All Objects = false Append Results = false Edit Case Names = false Open to Compare = false Multi Configuration File Load Option = Last Case Open in New View = false Keep Camera Position = true Load Particle Tracks = false Files to Compare = Construct Variables From Fourier Coefficients = False END > load filename=$forteindexfile, multifile=overwrite ! $i++; ! load: ! CreatedpReport($forteindexfile); ! } ! publishreport(); ! } ! } ! else ! { ! my @ftind=ftind($ftindpath); ! $s=0; ! $fortereportpath=$fortereportdir."/"."Nominal"; ! $i=0; ! foreach $ftind(@ftind){ ! $forteindexfile=$ftindpath."/".$ftind; ! if ($i==0){ ! $i++; ! goto load;} DATA READER: Clear All Objects = false Append Results = false Edit Case Names = false Open to Compare = false Multi Configuration File Load Option = Single Case Open in New View = false Keep Camera Position = true Load Particle Tracks = false Files to Compare = Construct Variables From Fourier Coefficients = False END > load filename=$forteindexfile, multifile=overwrite ! $i++; ! load: ! CreatedpReport($forteindexfile); ! } ! publishreport(); ! } !} !#----------------------------------------------------------------- !# sub functions !#----------------------------------------------------------------- !sub CreatedpReport{ ! $forteindexfile=$_[0]; ! use warnings; ! use Math::Trig; ! use Math::Complex; ! use Math::Quaternion qw(slerp); ! $SeqNum = 1; ! $CommentSeqNum=0; ! $solutionfeq=1; ! $quickreport="#t"; ! $scalefactor=5; ! $resolutiony=172;#172mm 650pixels cfdpost graphics resolution along y axis (leaving some space on top) ! @planes=(); ! @Icecutplane=(); ! #Reading the project path ! my $result = getValue( "/DATA READER", "Current Results File" ) ; ! $result =~ s/\\/\//g; ! my @fortepath = split(/\//, $result); !# $forteindexfile=join('/', @fortepath); ! pop(@fortepath); ! $fortepath = join('/', @fortepath); ! my @icepath=@fortepath; ! pop(@icepath); ! pop(@icepath); ! pop(@icepath); ! push(@icepath,"ICE/icSolverSettings.txt"); ! $filename = join('/', @icepath); ! pop(@icepath); ! $icepath = join('/', @icepath); ! #reading solution frequency ! push(@icepath,"ICE/ice-setup-settings.txt"); ! my $setupsettings = join('/', @icepath); ! pop(@icepath); ! $success = open($infile,"<$setupsettings") or die "Could not open '$setupsettings' $!\n"; ! if(!$success){ ! return; ! } ! while(<$infile>){ ! $pos = index($_,"solution_load_frequency"); ! if($pos >=0){ ! my @value = split(' ', $_); ! $solutionfeq= pop(@value); ! } ! $pos2 = index($_,"quick_report"); ! if($pos2 >=0){ ! my @value2 = split(' ', $_); ! $quickreport= pop(@value2); ! } ! } ! close $infile; ! # This creates design point directory in /Post directory. ! $dp=pop(@fortepath); ! $reportdir = $icepath."/Post"."/$dp"; ! unless(-d $reportdir){ ! mkdir( $reportdir ) or die "Couldn't create $reportdir directory, $!";} ! $simulationtype = "cold-flow"; ! $combustionsolutiontype = "full_engine_full_cycle"; ! $reportTitle = "IC Engine Cold Flow Simulation Report"; ! #reading engine summary data from forte log ! @EngineSummaryData = Enginedata(); ! #Identifying the simulation type ! $success = open(infile,"<$filename") or die "Could not open '$filename' $!\n"; ! if(!$success){ ! return; ! } ! while(){ ! $pos = index($_,"combustion"); ! if($pos >=0){ ! $simulationtype = "combustion"; ! $reportTitle = "IC Engine Combustion Simulation Report";} ! $pos = index($_,"Sector"); ! if($pos >=0){$combustionsolutiontype = "Sector";} ! $pos = index($_,"full_engine_ivc_to_evo"); ! if($pos >=0){$combustionsolutiontype = "full_engine_ivc_to_evo";} ! $pos = index($_,"full_engine_full_cycle"); ! if($pos >=0){$combustionsolutiontype = "full_engine_full_cycle";} ! } ! close(infile); ! #setting the Chart variables ! if ($simulationtype eq "cold-flow"||$combustionsolutiontype eq "full_engine_full_cycle"){ ! @monitorfiles = ($fortepath . "/thermo.csv",$fortepath . "/dynamic.csv",$fortepath . "/open_boundary_flow.csv",$fortepath . "/spray.csv",$fortepath . "/flame.csv") ; ! }elsif($combustionsolutiontype eq "Sector"||$combustionsolutiontype eq "full_engine_ivc_to_evo"){ ! @monitorfiles = ($fortepath . "/thermo.csv",$fortepath . "/dynamic.csv",$fortepath . "/spray.csv") ; ! } ! if ($simulationtype eq "cold-flow"){ ! @variables =( " Pressure (MPa)"," Temperature (K)"," In-cylinder mass (g)"," In-cylinder volume (cm3)"," Tumble ratio-x"," Tumble ratio-y"," Swirl ratio"," Inst Mass Inflow Rate (g/sec)"," Inst Mass Outflow Rate (g/sec)"); ! $scalefactor=5; ! }elsif($combustionsolutiontype eq "full_engine_full_cycle"){ ! @variables =( " Pressure (MPa)"," Temperature (K)"," In-cylinder mass (g)"," In-cylinder volume (cm3)"," Tumble ratio-x"," Tumble ratio-y"," Swirl ratio"," Inst Mass Inflow Rate (g/sec)"," Inst Mass Outflow Rate (g/sec)"," Apparent heat release rate (J/deg)"," Accumulated apparent heat release (J)"," Unburnt Hydrocarbon (g/kgfuel)"," EINOx (g/kgfuel)"," Mass averaged droplet velocity (m/s)"," Average Sauter mean diameter (micron)"," S_turb (cm/s)","Liquid penetration of","Vapor penetration of","Injection cone angle of"); ! $scalefactor=5; ! }elsif($combustionsolutiontype eq "Sector"||$combustionsolutiontype eq "full_engine_ivc_to_evo"){ ! @variables =( " Pressure (MPa)"," Temperature (K)"," In-cylinder mass (g)"," In-cylinder volume (cm3)"," Tumble ratio-x"," Tumble ratio-y"," Swirl ratio"," Apparent heat release rate (J/deg)"," Accumulated apparent heat release (J)"," Unburnt Hydrocarbon (g/kgfuel)"," EINOx (g/kgfuel)"," Mass averaged droplet velocity (m/s)"," Average Sauter mean diameter (micron)"," S_turb (cm/s)","Liquid penetration of","Vapor penetration of","Injection cone angle of"); ! $scalefactor=2.5; ! } ! #identifying the Solution points ! my $solutionpoints=0; ! open(my $data, '<', $forteindexfile ) or die "Could not open '$forteindexfile' $!\n"; ! while(my $line = <$data>){ ! chomp($line); ! my @words = split(',', $line); ! foreach $word(@words){ ! chomp($word); ! if ( $word=~/.ftres/ ){ ! $solutionpoints++; ! } ! } ! } ! close $data; ! #identifying the cylinder orientation ! $success = open(infile,"<$filename") or die "Could not open '$filename' $!\n"; ! if(!$success){ ! return; ! } ! while(){ ! $pos = index($_,"cylinder_axis "); ! if($pos >=0){ ! $line=$_; ! } ! } ! @cylinderaxis = split(" ", $line); ! shift @cylinderaxis; ! shift @cylinderaxis; ! pop @cylinderaxis; ! close infile; ! #identifying ice cut planes ! $filename= $icepath."/ICE/ICETempFiles/icetemp.txt"; ! my $success = open(infile,"<$filename") or die "Could not open '$filename' $!\n"; ! if(!$success){ ! return; ! } ! while(){ ! $pos = index($_,"ice_cutplane_"); ! if($pos >=0){ ! push(@planes,$_); ! } ! } ! close infile; ! foreach $line(@planes){ ! @cod=split " ",$line; ! push(@Icecutplane,shift @cod); ! @f=($cod[0],$cod[1],$cod[2]); ! push (@point1,@f); ! @s=($cod[3],$cod[4],$cod[5]); ! push (@point2,@s); ! @t=($cod[6],$cod[7],$cod[8]); ! push (@point3,@t); ! } !# $s=0; ! if($quickreport eq "#f"){ ! for($f=0;$f<=$solutionpoints-1;$f+=$solutionfeq,$s++){ > load timestep=$f ! creatcutplane(); ! } ! } !} !sub publishreport{ !#------------------------------------------------------- !# report creation !#------------------------------------------------------- TITLE PAGE: Custom Logo Path = Include ANSYS Logo = On Include Custom Logo = Off Include Date = On Include TOC = On Report Author = Report Title = $reportTitle Show Captions in TOC = On Title Page Exists = true END COMMENT:User Data Comment Text =


Comment Heading = Solution data Heading Level = 1 END ! my $enginedatStr='

'.'

'; ! foreach $a (@EngineSummaryData){ ! $enginedatStr=$enginedatStr . '

'.$a.'

'; ! } ! $CommentSeqNum++; COMMENT: Comment $CommentSeqNum Comment Exists = True Comment Heading = Engine Summary Data Comment Text =

$enginedatStr

Heading Level = 2 END ! if($quickreport eq "#f"){ ! foreach $Icecutplane(@Icecutplane){ ! CreateForteAnimation($fortereportpath,$Icecutplane,$type=mesh); ! createTablesforte(\@{$Icecutplane."_mesh"},$Icecutplane,$type=mesh); ! undef (@{$Icecutplane."_mesh"}); ! } ! foreach $Icecutplane(@Icecutplane){ ! $contourtype="Velocity"; ! CreateForteAnimation($fortereportpath,$Icecutplane,$contourtype); ! createTablesforte(\@{$Icecutplane."_".$contourtype},$Icecutplane,$contourtype); ! undef (@{$Icecutplane."_".$contourtype}); ! } ! if($simulationtype eq "combustion"){ ! $contourtype="Temperature"; ! foreach $Icecutplane(@Icecutplane){ ! CreateForteAnimation($fortereportpath,$Icecutplane,$contourtype); ! createTablesforte(\@{$Icecutplane."_".$contourtype},$Icecutplane,$contourtype); ! undef (@{$Icecutplane."_".$contourtype}); ! } ! } ! } COMMENT: Charts Comment Exists = True Comment Heading = Charts Comment Text =


Heading Level = 2 END ! CreateChartforte(); !#Publishing report at /ICE/Post folder !$reportpath=$reportdir ."/Report.html"; REPORT: PUBLISH: Generate CVF = Off Report Format = HTML Report Path = $reportpath Save Images In Separate Folder = On END END >report save ! } !sub Enginedata{ ! my $filename="$fortepath" . "/FORTE.log"; ! my $success = open(infile,"<$filename") or die "Could not open '$filename' $!\n"; ! if(!$success){ ! return; ! } ! my $line_number=1; ! my $i=0; ! my $search = 'Engine Summary Data:'; ! while (my $line = ) { ! if ($line =~ /$search/){ ! $line_number=$i; ! last; ! } ! $i++; ! } ! my $success = open(infile,"<$filename") or die "Could not open '$filename' $!\n"; ! if(!$success){ ! return; ! } ! my $count=0; ! my $line_number2=1; ! my $search2 = '------------------------------------------------------------'; ! while (my $line = ) { ! if ($count >= $line_number){ ! if ($line =~ /$search2/){ ! $line_number2=$count; ! last; ! } ! } ! $count++; ! } ! my $success = open(infile,"<$filename") or die "Could not open '$filename' $!\n"; ! if(!$success){ ! return; ! } ! my $count2=0; ! my @enginedata=(); ! while (my $line = ) { ! if ($count2 > $line_number){ ! if ($count2 >= $line_number2){ ! last; ! } ! push (@enginedata,$line); ! } ! $count2++; ! } ! my $success = open(infile,"<$filename") or die "Could not open '$filename' $!\n"; ! if(!$success){ ! return; ! } ! my $count3=0; ! $line_number3=$line_number2+3; ! $line_number4=$line_number3+10; ! while (my $line = ) { ! if ($count3 > $line_number3){ ! if ($count3 >= $line_number4){ ! last; ! } ! push (@enginedata,$line); ! } ! $count3++; ! } ! if ($line_number==1){ ! @enginedata=("Engine Summary Data not available-Check FORTE.log");} ! return @enginedata; ! close infile; ! } !sub creatcutplane{ ! $noofplanes=scalar @planes; ! $j=0; ! for($i=0;$i<=$noofplanes-1; $i++){ ! @A=($point1[$j],$point1[$j+1],$point1[$j+2]); ! @B=($point2[$j],$point2[$j+1],$point2[$j+2]); ! @C=($point3[$j],$point3[$j+1],$point3[$j+2]); ! $j=$j+3; ! #finding plane equation from three points ! $a= (($B[1]-$A[1])*($C[2]-$A[2])-($C[1]-$A[1])*($B[2]-$A[2])); ! $b= (($B[2]-$A[2])*($C[0]-$A[0])-($C[2]-$A[2])*($B[0]-$A[0])); ! $c= (($B[0]-$A[0])*($C[1]-$A[1])-($C[0]-$A[0])*($B[1]-$A[1])); ! $d= -( $a*$A[0]+$b*$A[1]+$c*$A[2]); ! #finding unit vector of plane normal ! $ai=$a/(sqrt($a**2+$b**2+$c**2)); ! $bi=$b/(sqrt($a**2+$b**2+$c**2)); ! $ci=$c/(sqrt($a**2+$b**2+$c**2)); ! @normaltocutplane=($ai,$bi,$ci); ! #finding Euler axis and angle of plane normal with respect to z axis(0,0,1) ! @refaxis=(0,0,1); ! $xi=$refaxis[0]; ! $yi=$refaxis[1]; ! $zi=$refaxis[2]; ! $eulerangle=acos(($xi*$ai+$yi*$bi+$zi*$ci)/(sqrt($ai**2+$bi**2+$ci**2))*(sqrt($xi**2+$yi**2+$zi**2))); ! @eulervetor=(-($yi*$ci-$bi*$zi),($xi*$ci-$ai*$zi),-($xi*$bi-$ai*$yi)); ! #Rotation Quaternion to make cutplane view ! $qr=cos($eulerangle/2); ! $qi=$eulervetor[0]*sin($eulerangle/2); ! $qj=$eulervetor[1]*sin($eulerangle/2); ! $qk=$eulervetor[2]*sin($eulerangle/2); ! my $q1 = Math::Quaternion->new($qr,$qi,$qj,$qk); ! #rotating the cylinder axis with q1 ! my ($xx,$yy,$zz) = $q1->rotate_vector($cylinderaxis[0],$cylinderaxis[1],$cylinderaxis[2]); ! $anglec=acos($yy/(sqrt($xx**2+$yy**2))); ! if($xx<0){ ! $anglec=2*phi-$anglec; ! } ! $q2 = Math::Quaternion->new({ axis => [$ai,$bi,$ci], angle => $anglec}); ! my $q3 = Math::Quaternion::multiply($q1,$q2); ! @q3= split(' ',$q3); ! shift @q3; ! pop @q3; !($maxx,$unit) = evaluate( 'maxVal(X)@Default Domain' ); !($maxy,$unit) = evaluate( 'maxVal(Y)@Default Domain' ); !($maxz,$unit) = evaluate( 'maxVal(Z)@Default Domain' ); !($minx,$unit) = evaluate( 'minVal(X)@Default Domain' ); !($miny,$unit) = evaluate( 'minVal(Y)@Default Domain' ); !($minz,$unit) = evaluate( 'minVal(Z)@Default Domain' ); !$cx=$minx+(($maxx-$minx)/2); !$cy=$miny+(($maxy-$miny)/2); !$cz=$minz+(($maxz-$minz)/2); !if ($cylinderaxis[0] == 1){ ! $cylaxismax=$maxx; ! $cylaxismin=$minx; ! } elsif ($cylinderaxis[1] == 1){ ! $cylaxismax=$maxy; ! $cylaxismin=$miny; ! } else { ! $cylaxismax=$maxz; ! $cylaxismin=$minz; ! } !$cylaxiscen=$cylaxismin+(($cylaxismax-$cylaxismin)/2); !$bodylength=($cylaxismax-$cylaxismin); # scale(zoom) is calculated based on resolution and model size(approximating from crank radius) !$scale=($resolutiony/($crankradius*1000*$scalefactor)); !$cfdpostscale=$scale/10; # 0.1 is used to convert mm to cm and 0.5 is used to move half of the screen !$pany=((($resolutiony*0.1*0.5)/$scale)-($cylaxismax-$cylaxiscen)); #!$cz=$maxz-$minz; >centerview 1 ! #setting camera view VIEW:View 1 Camera Mode = User Specified CAMERA: Option = Pivot Point and Quaternion Pivot Point = $cx, $cy, $cz Scale = $cfdpostscale Pan = 0, $pany Rotation Quaternion =$q3[1],$q3[2],$q3[3],$q3[0] END END ! #creating cutplane ! $Icecutplane=$Icecutplane[$i]; PLANE: $Icecutplane Apply Instancing Transform = On Apply Texture = Off Blend Texture = On Bound Radius = 0.5 [m] Colour = 0.576471, 0.568627, 0.533333 Colour Map = Default Colour Map Colour Mode = Constant Colour Scale = Linear Colour Variable = Pressure Colour Variable Boundary Values = Conservative Culling Mode = No Culling Direction 1 Bound = 1.0 [m] Direction 1 Orientation = 0 [degree] Direction 1 Points = 10 Direction 2 Bound = 1.0 [m] Direction 2 Points = 10 Domain List = /DOMAIN GROUP:All Domains Draw Faces = On Draw Lines = On Instancing Transform = /DEFAULT INSTANCE TRANSFORM:Default Transform Invert Plane Bound = Off Lighting = On Line Colour = 0, 0, 0 Line Colour Mode = User Specified Line Width = 1 Max = 0.0 [Pa] Min = 0.0 [Pa] Normal = 1 , 0 , 0 Option = Three Points Plane Bound = None Plane Type = Slice Point = 0 [m], 0 [m], 0 [m] Point 1 = $A[0] [m], $A[1] [m], $A[2] [m] Point 2 = $B[0] [m], $B[1] [m], $B[2] [m] Point 3 = $C[0] [m], $C[1] [m], $C[2] [m] Range = Global Render Edge Angle = 0 [degree] Specular Lighting = On Surface Drawing = Smooth Shading Texture Angle = 0 Texture Direction = 0 , 1 , 0 Texture File = Texture Material = Gold Texture Position = 0 , 0 Texture Scale = 1 Texture Type = Predefined Tile Texture = Off Transform Texture = Off Transparency = 0.0 Visibility = On X = 0.0 [m] Y = 0.0 [m] Z = 0.0 [m] OBJECT VIEW TRANSFORM: Apply Reflection = Off Apply Rotation = Off Apply Scale = Off Apply Translation = Off Principal Axis = X Reflection Plane Option = From Plane Rotation Angle = 0 [degree] Rotation Axis From = 0 [m], 0 [m], 0 [m] Rotation Axis To = 0 [m], 0 [m], 0 [m] Rotation Axis Type = Principal Axis Scale Vector = 1 , 1 , 1 Translation Vector = 0 [m], 0 [m], 0 [m] X = 0.0 [m] Y = 0.0 [m] Z = 0.0 [m] END END TEXT:Crank angle Colour = 0, 0, 0 Font = Sans Serif Position Mode = Two Coords Text Colour Mode = Default Text Height = 0.024 Text Position = 0 , 0.96 Text Rotation = 0 [degree] X Justification = Left Y Justification = Bottom TEXT ITEM:Text Item 1 Auto Annotation Expression = Accumulated Time Step Auto Annotation File Date Format = DD/MM/YY Auto Annotation File Time Format = h:m:s t Auto Annotation Filename Format = Filename Only Auto Annotation Float Format = %10.3e Auto Annotation Type = Crank Angle Auto Annotation Use Automatic Number Formatting = On Embed Auto Annotation = On Text Item Active = On Text String = Crank Angle = END TEXT ITEM:Text Item 2 Auto Annotation Expression = Accumulated Time Step Auto Annotation File Date Format = DD/MM/YY Auto Annotation File Time Format = h:m:s t Auto Annotation Filename Format = Filename Only Auto Annotation Float Format = %10.3e Auto Annotation Type = Expression Auto Annotation Use Automatic Number Formatting = On Embed Auto Annotation = Off Text Item Active = Off Text String = END TEXT ITEM:Text Item 3 Auto Annotation Expression = Accumulated Time Step Auto Annotation File Date Format = DD/MM/YY Auto Annotation File Time Format = h:m:s t Auto Annotation Filename Format = Filename Only Auto Annotation Float Format = %10.3e Auto Annotation Type = Expression Auto Annotation Use Automatic Number Formatting = On Embed Auto Annotation = Off Text Item Active = Off Text String = END TEXT ITEM:Text Item 4 Auto Annotation Expression = Accumulated Time Step Auto Annotation File Date Format = DD/MM/YY Auto Annotation File Time Format = h:m:s t Auto Annotation Filename Format = Filename Only Auto Annotation Float Format = %10.3e Auto Annotation Type = Expression Auto Annotation Use Automatic Number Formatting = On Embed Auto Annotation = Off Text Item Active = Off Text String = END TEXT ITEM:Text Item 5 Auto Annotation Expression = Accumulated Time Step Auto Annotation File Date Format = DD/MM/YY Auto Annotation File Time Format = h:m:s t Auto Annotation Filename Format = Filename Only Auto Annotation Float Format = %10.3e Auto Annotation Type = Expression Auto Annotation Use Automatic Number Formatting = On Embed Auto Annotation = Off Text Item Active = Off Text String = END TEXT ITEM:Text Item 6 Auto Annotation Expression = Accumulated Time Step Auto Annotation File Date Format = DD/MM/YY Auto Annotation File Time Format = h:m:s t Auto Annotation Filename Format = Filename Only Auto Annotation Float Format = %10.3e Auto Annotation Type = Expression Auto Annotation Use Automatic Number Formatting = On Embed Auto Annotation = Off Text Item Active = Off Text String = END END # Sending visibility action from ViewUtilities >show /TEXT:Crank angle, view=/VIEW:View 1 ! $cut1="/PLANE:$Icecutplane,"; ! $cut=$cut.$cut1; > hide $cut, view=/VIEW:View 1 >show /PLANE:$Icecutplane, view=/VIEW:View 1 >hide /WIREFRAME:Wireframe, view=/VIEW:View 1 >setPreferences Viewer Background Image File = , Viewer Axis Visibility = On, Viewer Ruler Visibility = On #>centerview 1 ! my $imagefile = $icepath. "/Post/"."$dp"."/".$Icecutplane."_mesh_"."$s".".jpg"; HARDCOPY: Antialiasing = On Hardcopy Filename = $imagefile Hardcopy Format = jpg Hardcopy Tolerance = 0.0001 Image Height = 900 Image Scale = 70 Image Width = 1480 JPEG Image Quality = 80 Screen Capture = Off Use Screen Size = Off White Background = On END >print > hide $cut, view=/VIEW:View 1 ! push @{$Icecutplane."_mesh"}, $imagefile; ! $contourtype="Velocity"; ! createcontour($Icecutplane,$s,$cut,$contourtype); ! if($simulationtype eq "combustion"){ ! $contourtype="Temperature"; ! createcontour($Icecutplane,$s,$cut,$contourtype);} ! } ! close infile; ! } !#creating contour" !sub createcontour{ ! $Icecutplane=$_[0]; ! $s=$_[1]; ! $cut=$_[2]; ! $contourtype=$_[3]; ! my $contourname=$Icecutplane."_".$contourtype; CONTOUR: $contourname Apply Instancing Transform = On Clip Contour = Off Colour Map = Default Colour Map Colour Scale = Linear Colour Variable = $contourtype Colour Variable Boundary Values = Conservative Constant Contour Colour = Off Contour Range = Local Culling Mode = No Culling Domain List = /DOMAIN GROUP:All Domains Draw Contours = On Font = Sans Serif Fringe Fill = On Instancing Transform = /DEFAULT INSTANCE TRANSFORM:Default Transform Lighting = On Line Colour = 0, 0, 0 Line Colour Mode = Default Line Width = 1 Location List = /PLANE:$Icecutplane Max = 0.0 [m s^-1] Min = 0.0 [m s^-1] Number of Contours = 21 Show Numbers = Off Specular Lighting = On Surface Drawing = Smooth Shading Text Colour = 0, 0, 0 Text Colour Mode = Default Text Height = 0.024 Transparency = 0.0 Use Face Values = Off Value List = 0 [m s^-1],1 [m s^-1] Visibility = On OBJECT VIEW TRANSFORM: Apply Reflection = Off Apply Rotation = Off Apply Scale = Off Apply Translation = Off Principal Axis = X Reflection Plane Option = From Plane Rotation Angle = 0 [degree] Rotation Axis From = 0 [m], 0 [m], 0 [m] Rotation Axis To = 0 [m], 0 [m], 0 [m] Rotation Axis Type = Principal Axis Scale Vector = 1 , 1 , 1 Translation Vector = 0 [m], 0 [m], 0 [m] X = 0.0 [m] Y = 0.0 [m] Z = 0.0 [m] END END ! #creating images of contour in report ! $cut1="/CONTOUR:$contourname,"; ! $cut=$cut.$cut1; > hide $cut, view=/VIEW:View 1 >show /CONTOUR:$contourname, view=/VIEW:View 1 ! if($contourtype eq Velocity){ ! #creating vector plot ! $vectorname=$Icecutplane."_vector"; VECTOR:$vectorname Apply Instancing Transform = On Colour = 0, 0, 0 Colour Map = Default Colour Map Colour Mode = Constant Colour Scale = Linear Colour Variable = Velocity Colour Variable Boundary Values = Conservative Coord Frame = Global Culling Mode = No Culling Direction = X Domain List = /DOMAIN GROUP:All Domains Draw Faces = On Draw Lines = Off Instancing Transform = /DEFAULT INSTANCE TRANSFORM:Default Transform Lighting = On Line Width = 1 Location List = /PLANE:$Icecutplane Locator Sampling Method = Face Center Max = 0.0 [m s^-1] Maximum Number of Items = 100 Min = 0.0 [m s^-1] Normalized = On Number of Samples = 100 Projection Type = Tangential Random Seed = 1 Range = Global Reduction Factor = 2.0 Reduction or Max Number = Reduction Sample Spacing = 0.1 Sampling Aspect Ratio = 1 Sampling Grid Angle = 0 [degree] Specular Lighting = On Surface Drawing = Smooth Shading Symbol = Line Arrow Symbol Size = 0.25 Transparency = 0.0 Variable = Velocity Variable Boundary Values = Conservative OBJECT VIEW TRANSFORM: Apply Reflection = Off Apply Rotation = Off Apply Scale = Off Apply Translation = Off Principal Axis = X Reflection Plane Option = XY Plane Rotation Angle = 0 [degree] Rotation Axis From = 0 [m], 0 [m], 0 [m] Rotation Axis To = 0 [m], 0 [m], 0 [m] Rotation Axis Type = Principal Axis Scale Vector = 1 , 1 , 1 Translation Vector = 0 [m], 0 [m], 0 [m] X = 0.0 [m] Y = 0.0 [m] Z = 0.0 [m] END END ! $cut1="/VECTOR:$vectorname,"; ! $cut=$cut.$cut1; > hide $cut, view=/VIEW:View 1 >show /CONTOUR:$contourname, view=/VIEW:View 1 >show /VECTOR:$vectorname, view=/VIEW:View 1 >hide /WIREFRAME:Wireframe, view=/VIEW:View 1 >setPreferences Viewer Background Image File = , Viewer Axis Visibility = On, Viewer Ruler Visibility = On #>centerview 1 ! } ! my $imagefilecontour = $icepath. "/Post/"."$dp"."/".$Icecutplane."_".$contourtype."_"."$s".".jpg"; HARDCOPY: Antialiasing = On Hardcopy Filename = $imagefilecontour Hardcopy Format = jpg Hardcopy Tolerance = 0.0001 Image Height = 900 Image Scale = 70 Image Width = 1480 JPEG Image Quality = 80 Screen Capture = Off Use Screen Size = Off White Background = On END # >centerview 1 >print > hide $cut, view=/VIEW:View 1 ! push @{$Icecutplane."_".$contourtype}, $imagefilecontour; ! } !#creating charts" !sub CreateChartforte{ ! foreach $monitorfile (@monitorfiles){ ! if (-f $monitorfile){ ! open(my $data, '<', $monitorfile) or die "Could not check open '$monitorfile' $!\n"; ! my $line = <$data>; ! my @strings = split "," , $line; ! $totalcolumns = scalar @strings; ! for (my $i=0; $i <= $totalcolumns-1; $i++){ ! my $label=$strings[$i]; ! @label2= split (' ',$label); ! pop @label2; ! pop @label2; ! $label2=join(' ',@label2); ! foreach $variable (@variables){ ! if( $label eq $variable || $label2 eq $variable){ ! $yaxislabel= @strings[$i]; ! $title=$yaxislabel; ! $title=~ s/\(.*//; ! $xaxislabel= @strings[0]; ! @title= split ('-',$title); ! $tiltenew=join (' ', @title); ! $column=$i+1; CHART:Chart $SeqNum $tiltenew Chart Axes Font = Tahoma, 10, False, False, False, False Chart Axes Titles Font = Tahoma, 10, True, False, False, False Chart Grid Line Width = 1 Chart Horizontal Grid = On Chart Legend = On Chart Legend Font = Tahoma, 8, False, False, False, False Chart Legend Inside = Outside Chart Chart Legend Justification = Center Chart Legend Position = Bottom Chart Legend Width Height = 0.2 , 0.4 Chart Legend X Justification = Right Chart Legend XY Position = 0.73 , 0.275 Chart Legend Y Justification = Center Chart Line Width = 2 Chart Lines Order = Series 1,Chart Line 1 Chart Minor Grid = Off Chart Minor Grid Line Width = 1 Chart Symbol Size = 4 Chart Title = $title Chart Title Font = Tahoma, 12, True, False, False, False Chart Title Visibility = On Chart Type = XY Chart Vertical Grid = On Chart X Axis Automatic Number Formatting = On Chart X Axis Label = $xaxislabel Chart X Axis Number Format = %10.3e Chart Y Axis Automatic Number Formatting = On Chart Y Axis Label = $yaxislabel Chart Y Axis Number Format = %10.3e Default Chart X Variable = Chart Count Default Chart Y Variable = Pressure Default Histogram Y Axis Weighting = None Default Time Chart Variable = Pressure Default Time Chart X Expression = Time Default Time Variable Absolute Value = Off Default Time Variable Boundary Values = Conservative Default X Variable Absolute Value = Off Default X Variable Boundary Values = Conservative Default Y Variable Absolute Value = Off Default Y Variable Boundary Values = Conservative FFT Full Input Range = On FFT Max = 0.0 FFT Min = 0.0 FFT Subtract Mean = Off FFT Window Type = Hanning FFT X Function = Frequency FFT Y Function = Power Spectral Density Histogram Automatic Divisions = Automatic Histogram Divisions = -1.0,1.0 Histogram Divisions Count = 10 Histogram Y Axis Value = Count Is FFT Chart = Off Max X = 1.0 Max Y = 1.0 Min X = -1.0 Min Y = -1.0 Time Chart Keep Single Case = Off Use Data For X Axis Labels = Off Use Data For Y Axis Labels = Off X Axis Automatic Range = On X Axis Inverted = Off X Axis Logarithmic Scaling = Off Y Axis Automatic Range = On Y Axis Inverted = Off Y Axis Logarithmic Scaling = Off CHART SERIES: Series 1 Chart Line Custom Data Selection = Off Chart Line Filename = $monitorfile Chart Series Type = From File Chart X Variable = Chart Count Chart Y Variable = C6H12 1.Mass Fractions File Data Section Name = DefaultSectionName File Data X Variable = Column 1 File Data Y Variable = Column $column Histogram Y Axis Weighting = None Monitor Data Filename = Monitor Data Source = Case Monitor Data X Variable Absolute Value = Off Monitor Data Y Variable Absolute Value = Off Series Name = $title Time Chart Expression = Time Time Chart Type = Point Time Chart Variable = C6H12 1.Mass Fractions Time Chart X Expression = Time Time Variable Absolute Value = Off Time Variable Boundary Values = Conservative X Variable Absolute Value = Off X Variable Boundary Values = Conservative Y Variable Absolute Value = Off Y Variable Boundary Values = Conservative CHART LINE: Chart Line 1 Auto Chart Line Colour = On Chart Line Colour = 1.0, 0.0, 0.0 Chart Line Style = Automatic Chart Line Visibility = On Chart Symbol Colour = 0.0, 1.0, 0.0 Chart Symbol Style = None Fill Area = On Fill Area Options = Automatic Is Valid = True Line Name = $title Use Automatic Line Naming = On END END OBJECT REPORT OPTIONS: Report Caption = $tiltenew END END ! $SeqNum++; ! } ! } ! } ! } ! } ! } !sub CreateForteAnimation{ !$fortereportpath=$_[0]; !$Icecutplane=$_[1]; !$contourtype=$_[2]; !my $ccl=$0; !$ccl =~ s/\\/\//g; !my $cfdpos = rindex($ccl,"lib/ccl/CCL/embeddedParserInit.pl"); !my $cfdpostPath = substr($ccl,0,$cfdpos); !$ffmpeg= ""; !if($^O eq 'linux'){ ! $ffmpeg = $cfdpostPath."tools/ffmpeg-20071211/bin/linux-amd64/ffmpeg"; !} !else{ ! $ffmpeg = $cfdpostPath."tools/ffmpeg-20071211/bin/winnt/ffmpeg.exe"; !} !my $cmd = "\"$ffmpeg\" -r 2 -f image2 -loop_output 0 -i \"$fortereportpath/".$Icecutplane."_".$contourtype."_%d.jpg\" -pix_fmt rgb24 \"$fortereportpath/".$Icecutplane."_".$contourtype."_animation".".gif\""; !if($^O eq 'linux'){ !$cmd = "\"$ffmpeg\" -r 2 -f image2 -loop_output 0 -i \"$fortereportpath/".$Icecutplane."_".$contourtype."_%d.jpg\" -pix_fmt rgb24 \"$fortereportpath/".$Icecutplane."_".$contourtype."_animation".".gif\" < /dev/null"; !} !system ($cmd); !$gifpath="\"$fortereportpath/".$Icecutplane."_".$contourtype."_animation".".gif\""; !$tableStr =""; !$heading ="Animation:".$contourtype."_on_".$Icecutplane; !CommentTableforte($tableStr); !} !#Function for creating tables of images !sub createTablesforte{ ! my (@imagepath) = @{$_[0]}; ! my $Icecutplane=$_[1]; ! my $contourtype=$_[2]; ! my $iniSize=0; ! my $tableColumns=3; ! my $tableImageWidth=int((1480)/$tableColumns),$tableImageHeight=int(900/$tableColumns); ! my $tableStr = ""; ! my $j=0; ! my $numberOfImages = scalar @imagepath; ! for(my $i=0; $i< $numberOfImages; ++$i){ ! my $imageIndex=$i; ! my $imgPath = @imagepath[$imageIndex]; ! if($j == 0){ ! $tableStr = $tableStr.""; ! } ! $tableStr = $tableStr.""; ! ++$j; ! if($j == $tableColumns){ ! $j = 0; ! $tableStr = $tableStr.""; ! } ! } ! $tableStr = $tableStr."
"; ! $heading =$contourtype."_on_".$Icecutplane; ! CommentTableforte($tableStr); ! } !sub CommentTableforte{ ! my ($tableStr) = @_; ! ++$CommentSeqNum; COMMENT:Comment $CommentSeqNum Comment Text =

$tableStr

Comment Heading = $heading Heading Level = 2 END ! }