! sub CFXPlotStress {
! ($cfxboundary, $dirOutput, $fsisurfaceID ) = @_;
! ($legendboundary) = "CFX Pressure - ".$cfxboundary;
! ($fsipressure ) = "FSI Pressure Contour";
! ($cfxisox ) = $dirOutput."solution".$fsisurfaceID."isox.png";
! ($cfxisoy ) = $dirOutput."solution".$fsisurfaceID."isoy.png";
! ($cfxisoz ) = $dirOutput."solution".$fsisurfaceID."isoz.png";


# Create Expression for element stress
LIBRARY:
  CEL:
    EXPRESSIONS:
      myStressExp=Force/Area
    END
  END
END
EXPRESSION EVALUATOR:
  Evaluated Expression = myStressExp
END
> forceupdate EXPRESSION EVALUATOR

#create user variable for element stress

USER SCALAR VARIABLE:$legendboundary
  Boundary Values = Conservative
  Calculate Global Range = Off
  Expression = myStressExp
  Recipe = Expression
  Variable to Copy = Pressure
END

# Make a contour of CFXPressure on the boundary

CONTOUR: $fsipressure
  Location List = $cfxboundary
  Contour Range = Local
  Colour Variable = Pressure
  Colour Variable Boundary Values = Conservative
  Lighting = On
  Specular Lighting = Off
  Fringe Fill = On
  Draw Contours = Off
END

DEFAULT LEGEND:
  Visibility = Off
END

LEGEND:Legend 1
  Colour = 0, 0, 0
  Font = Sans Serif
  Legend Aspect = 0.06
  Legend Format = %10.3e
  Legend Orientation = Vertical
  Legend Plot = $fsipressure
  Legend Position = 0.02 , 0.15
  Legend Size = 0.75
  Legend Ticks = 5
  Legend Title = $legendboundary
  Legend Title Mode = User Specified
  Legend X Justification = Left
  Legend Y Justification = Center
  Show Legend Units = On
  Text Colour Mode = Default
  Text Height = 0.018
  Text Rotation = 0
  Visibility = On
END

TEXT: Text 1
  Colour = 0, 0, 0
  Font = Sans Serif
  Position Mode = Two Coords
  Text Colour Mode = Default
  Text Height = 0.018
  Text Position = 0 , 0.9
  Text Rotation = 0 [degree]
  Visibility = On
  X Justification = Left
  Y Justification = None
  TEXT ITEM: Text Item 1
    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 Type = Time Value
    Embed Auto Annotation = On
    Text Item Active = On
    Text String = Time Value = <aa>
  END
END

# Hide the wireframe and the surface so that only the contour
# remains visible. 

WIREFRAME:Wireframe
  Visibility = Off
END

VIEWPORT MANAGER:
  Background Colour = 0.42, 0.55, 0.871
  Background Colour 2 = 1, 1, 1
  Background Colour Type = Top-Bottom Gradient
  Global Edge Colour = 0, 0, 0
  Global Text Colour = 0, 0, 0
END

# Set up the image output

HARDCOPY:
  Hardcopy Format = png
  Image Height = 600
  Image Width = 800
  Use Screen Size = Off
END

# Fit view, and print X, Y and Z projections.

> centerview

> setcamera viewport=VIEWER, camera=Isometric X
> print $cfxisox

> setcamera viewport=VIEWER, camera=Isometric Y
> print $cfxisoy

> setcamera viewport=VIEWER, camera=Isometric Z
> print $cfxisoz

! }
