{"id":125,"date":"2017-09-13T10:19:17","date_gmt":"2017-09-13T13:19:17","guid":{"rendered":"http:\/\/www.professores.uff.br\/diomarcesarlobao\/?page_id=125"},"modified":"2017-09-13T10:19:17","modified_gmt":"2017-09-13T13:19:17","slug":"inter2-f","status":"publish","type":"page","link":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/inter2-f\/","title":{"rendered":"inter2.f"},"content":{"rendered":"<pre>c&lt;html&gt;\r\nc&lt;head&gt;&lt;title&gt;inter2.f&lt;\/title&gt;&lt;\/head&gt;\r\nc&lt;body&gt;\r\nc&lt;pre&gt;\r\n      program interpolate\r\n      implicit none\r\nc\r\nc     Demonstation of 2 simple interpolation methods for\r\nc     smoothly joining results from 2 disjoint regions\r\nc\r\nc     John Mahaffy 2\/3\/96\r\nc\r\nc    Open up two files in your current directory to receive results\r\nc\r\n      open(10,file='nulin')\r\n      open(11,file='nucube')\r\nc\r\nc   First a linear interpolation\r\nc\r\n      call nulin\r\nc\r\nc   Next a cubic interpolation\r\nc\r\n      call nucube\r\nc\r\nc   If you are in Hammond Lab, change this subroutine to plot results\r\nc\r\n      call plotit\r\nc\r\n      stop\r\n      end\r\nc\r\n      subroutine nulin\r\n      implicit none\r\n      real Nulam,Nuturb,Pr,Re,w,Nu\r\n      real Re1,Re2,Nu1,Nu2\r\nc\r\nc   Demonstration of simple linear end-point interpolation\r\nc   Calculation of Nusselt Number\r\nc\r\nc\r\nc     John Mahaffy 2\/3\/96\r\nc\r\nc   Nu   -  Nusselt Number\r\nc   Nulam - laminar Nusselt Number\r\nc   Nuturb - Turbulent Nusselt Number\r\nc   Re  -  Reynolds number\r\nc   w   -  interpolation weighting function\r\nc\r\n      parameter (Pr=1.0,Nulam=4.0,Re1=640,Re2=2000.)\r\nc\r\n      Nu1=Nulam\r\n      Nu2=Nuturb(Re2,Pr)\r\n      Re=0.0\r\nc\r\nc    Evaluate the Nusselt number over the range 0.&lt;=Re&lt;=3000.\r\nc\r\n      do 100 while (Re.le.3000.)\r\n        if(Re.lt.Re1) then\r\n           Nu = Nulam\r\nc&lt;a name=\"eif\"&gt;&lt;font color=\"FF0000\"&gt;\r\n        else if (Re.gt.Re2)  then\r\nc&lt;\/font&gt;&lt;\/a&gt;\r\n           Nu=Nuturb(Re,Pr)\r\nc&lt;a name=\"else\"&gt;&lt;font color=\"FF0000\"&gt;\r\n        else\r\nc&lt;\/font&gt;&lt;\/a&gt;\r\n           w = (Re - Re1)\/(Re2 - Re1)\r\n           Nu = (1.-w)*Nu1 + w*Nu2\r\n        endif\r\n        write(10,*)Re,Nu\r\n        Re=Re+10.\r\n  100 continue\r\n      return\r\n      end\r\n      subroutine nucube\r\n      implicit none\r\n      real Nuturb,Nulam,Pr,Re,w,SRe,Re1,Re2, Nu\r\n      real Nu1,Nu2,dNudRe1, dNudRe2, DwdSRe1, DwdSRe2, fac, a1,a2,a3\r\n      real NuDeriv\r\nc\r\nc   Demonstration of simple cubic end-point interpolation between two\r\nc   correlations for the Nusselt number\r\nc\r\nc\r\nc     John Mahaffy 2\/3\/96\r\nc\r\nc   Nu   -  Nusselt Number\r\nc   Nulam - laminar Nusselt Number\r\nc   Nuturb - Turbulent Nusselt Number\r\nc   Re  -  Reynolds number\r\nc   SRe -  Scaled Reynolds number, ranges from 0 to 1 over interpolation range\r\nc   w   -  interpolation weighting function\r\nc\r\n      parameter (Pr=1.0,Nulam=4.0,Re1=640,Re2=2000.)\r\nc\r\nc\r\nc     Prepare some constants necessary to generate polynomial coefficients\r\nc     giving continuity with the bounding functions, first derivatives of\r\nc     those functions.\r\nc\r\n      Nu2=Nuturb(Re2,Pr)\r\n      dNudRe2=NuDeriv(Re2,Pr)\r\n      Nu1=Nulam\r\n      dNudRe1=0.\r\n      fac=(Re2-Re1)\/(Nu2-Nu1)\r\n      dwdSRe1=dNudRe1*fac\r\n      dwdSRe2=dNudRe2*fac\r\n      a3=dwdSRe1+dwdSRe2-2\r\n      a2=3-2*dwdSRe1-dwdSRe2\r\n      a1=dNudRe1\r\nc\r\nc    Next Evaluate the Nusselt number over the range 0.&lt;=Re&lt;=3000.\r\nc\r\n      Re=0.\r\n      do 200 while (Re.le.3000.)\r\n        if(Re.lt.Re1) then\r\n           Nu=Nulam\r\n        else if (Re.gt.Re2) then\r\n           Nu=Nuturb(Re,Pr)\r\n        else\r\n           SRe=(Re-Re1)\/(Re2-Re1)\r\n           w= a3*SRe**3 + a2*SRe**2 + a1*SRe\r\n           Nu= (1.-w)*Nu1+w*Nu2\r\n        endif\r\n        write(11,*)Re,Nu\r\n        Re=Re+10.\r\n  200 continue\r\n      return\r\n      end\r\n      function Nuturb(Re,Pr)\r\nc\r\nc    Calculate a Turbulent heat transfer coefficient\r\nc    obtained from a Dittus-Boelter correlation\r\nc\r\nc     John Mahaffy   2\/2\/96\r\nc\r\n      implicit none\r\n      real Re,Pr,Nuturb\r\nc\r\nc   Nuturb - Turbulent Nusselt number (Dittus-Boelter correlation)\r\nc   Re  -  Reynolds number\r\nc   Pr  -  Prandl number\r\nc\r\nc     Nuturb=0.023*Re**.8*Pr**0.4\r\nc\r\n      Nuturb=0.023*exp(log(Re)*0.8+log(Pr)*0.4)\r\n      return\r\n      end\r\n      function NuDeriv(Re,Pr)\r\nc\r\nc    Calculate the Derivative of Turbulent Nusselt Number with respect\r\nc    to Reynolds number.\r\nc    Based on the Function Nuturb\r\nc\r\nc     John Mahaffy   2\/2\/96\r\nc\r\n      implicit none\r\n      real Re,Pr,NuDeriv\r\nc\r\nc   NuDeriv - Derivative of Nusselt number\r\nc   Re  -  Reynolds number\r\nc   Pr  -  Prandl number\r\nc\r\nc     NuDeriv=0.0184*Re**(-.2)*Pr**0.4\r\nc\r\nc &lt;a name=1&gt;&lt;font  color=FF0000&gt;\r\n      NuDeriv=0.0184*exp(-log(Re)*0.2+log(Pr)*0.4)\r\nc &lt;\/font&gt;&lt;\/a&gt;\r\n      return\r\n      end\r\n      subroutine plotit\r\nc\r\nc    This subroutine is for those of you who are getting bored.  At this\r\nc    stage of the class you will not be held responsible new material here.\r\n       logical fexist\r\n\r\nc      fexist -  flag indicating whether or not the gnuin file exists\r\n\r\nc   First check to see if a file containing commands to the graphic program\r\nc   exists in your local directory\r\nc\r\n      inquire (file='gp-int2',exist=fexist)\r\nc\r\nc   If it doesn't then issue a unix command to copy it from my directory\r\nc   the subroutine \"system\" is not a standard part of Fortran, but is\r\nc   provided by some Unix systems to give a crude form of what is called\r\nc   a \"system call\".  Any computer will supply an equivalent command, and\r\nc   other functions or subroutines that give more direct access to system\r\nc   support.\r\nc\r\n      if (.not.fexist) then\r\n         call system('cp ~jhm\/201\/gp-int2 .')\r\n         print *, ' Graphics input file copied'\r\n      endif\r\nc\r\nc   Close the data files so they are ready for reading by gnuplot\r\nc\r\n      close ( 11 )\r\n      close ( 10 )\r\nc\r\nc   If you are sitting at a Hammond lab work station remove the \"c\" in\r\nc   column 1 of the following \"call system\" to plot your results.  If you\r\nc   are running from NCSA\/BYU Telnet on a Mac, you can see plots by\r\nc   making the same change, and by following instructions in \"gp-int2\"\r\nc   to change that file for Tektronics emulation in gnuplot.\r\nc\r\nc      call system ('gnuplot gp-int2')\r\nc\r\n      return\r\n      end\r\nc&lt;\/pre&gt;\r\nc&lt;\/body&gt;\r\nc&lt;\/html&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>c&lt;html&gt; c&lt;head&gt;&lt;title&gt;inter2.f&lt;\/title&gt;&lt;\/head&gt; c&lt;body&gt; c&lt;pre&gt; program interpolate implicit none c c Demonstation of 2 simple interpolation methods for c smoothly joining results from 2 disjoint regions c c John Mahaffy 2\/3\/96 c c Open up two files in your current directory to receive results c open(10,file=&#8217;nulin&#8217;) open(11,file=&#8217;nucube&#8217;) c c First a linear interpolation c call nulin [&hellip;]<\/p>\n","protected":false},"author":22,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[],"tags":[],"class_list":["post-125","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/125","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/comments?post=125"}],"version-history":[{"count":1,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/125\/revisions"}],"predecessor-version":[{"id":126,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/125\/revisions\/126"}],"wp:attachment":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/media?parent=125"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/categories?post=125"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/tags?post=125"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}