Page 129 - Process Modelling and Simulation With Finite Element Methods
P. 129

116        Process Modelling and Simulation with Finite Element Methods

          output (j ,3) =I2;
          output(j,4)=1.+11/12;           %Last column  is the Nusselt

          end                              %closes the for-loop
          dlmwrite('convect.dat',output,','); %writes comma-delimited ASCII
          quit                             %stops  MATLAB
         The  m-file  freec0nv.m  (see  http:Neyrie.shef.ac.uWfemlab)  has  all  these
         alterations present.  This m-file was executed under linux as a background job
         using the following command:

                         matlab -nojvm  <freeconv.m >err 2>err &
         The -nojvm  (no  Java machine)  flag  stops  the  MATLAB  GUI  from loading,
         although  if  you  are  in  X-Windows,  you  will  get  a  brief  splash  screen  for
         MATLAB.  The command above generated the data in the file convect.dat used
         in Figure 3.3 to plot the Nusselt vs. Rayleigh number dependence.  The file err
          contains  the  re-direction  of  the  standard  output  (usually  the  screen)  and  the
          standard err (usually the screen) units.  When called with input re-direction from
          an  m-file,  MATLAB  does  not  launch  the  GUI,  but  evaluates  the  m-file
         programme  directly.  This  is  the  most  efficient  way  to  conduct  MATLAB
          computations, as the processor and memory are not tied up multitasking the GUI,
          so can pay better attention to your computation.  The parametric continuation in
         Rayleigh number m-file generates a series of entries in the err file of the form:
          Iter    ErrEst     Damping      Stepsize    nfun njac nfac nbsu
            0                                          1    0    0    0
            1  7.644421253e-07 1.0000000 0.1057807343   2   1    1    2
         These entries  all  show  error  estimates  of  0(10-7), which  implies  that  the  first
         iteration  on  each  new  Rayleigh  parameter  value  converges  in  one  Newton
          iteration step.  Since the convergence is so good, we could probably take bigger
          steps if  the  goal  were  only  to  reach  the  endpoint  Rayleigh  value.  However,
          adapting the stepsize in the continuation parameter would need to be automated
          on the  convergence  performance,  with  substantial  logic  encoded  for  trapping
          non-convergent  continuation  steps.  The  simple linear  continuation  conducted
         here is easiest to code.
             When using parametric  continuation to  arrive  at  the  final parameter  value,
         running the MATLAB m-file as a background job does not help.  The FEMLAB
          GUI is not entered and will not be accessible with the solution results.  FEMLAB
          has its own MATLAB workspace, however, so if you wish, you can run your edited
          m-files in the FEMLAB GUI.  Just open the File Menu, Select Open (m-file) and
          FEMLAl3 will evaluate all your commands sequentially.  Even those commands
          that  execute  non-FEMLAB  functions  in  MATLAB.  For  instance,  if  you  run
          freec0nv.m in this way, you will eventually arrive at Ra=50, even though the for
          command for looping is not a FEMLAB command.
   124   125   126   127   128   129   130   131   132   133   134