PageRenderTime 119ms CodeModel.GetById 12ms app.highlight 98ms RepoModel.GetById 1ms app.codeStats 0ms

/FluidMechanics/NavierStokes/42Master/src/42MasterExample.f90

http://github.com/xyan075/examples
FORTRAN Modern | 1303 lines | 898 code | 112 blank | 293 comment | 0 complexity | aeefce594ff45bcd22ca93026e1e6393 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1!> \file
   2!> \author Sebastian Krittian
   3!> \brief This is a master example program to solve static, dynamic and ALE Navier-Stokes equations using OpenCMISS calls.
   4!>
   5!> \section LICENSE
   6!>
   7!> Version: MPL 1.1/GPL 2.0/LGPL 2.1
   8!>
   9!> The contents of this file are subject to the Mozilla Public License
  10!> Version 1.1 (the "License"); you may not use this file except in
  11!> compliance with the License. You may obtain a copy of the License at
  12!> http://www.mozilla.org/MPL/
  13!>
  14!> Software distributed under the License is distributed on an "AS IS"
  15!> basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
  16!> License for the specific language governing rights and limitations
  17!> under the License.
  18!>
  19!> The Original Code is OpenCMISS
  20!>
  21!> The Initial Developer of the Original Code is University of Auckland,
  22!> Auckland, New Zealand and University of Oxford, Oxford, United
  23!> Kingdom. Portions created by the University of Auckland and University
  24!> of Oxford are Copyright (C) 2007 by the University of Auckland and
  25!> the University of Oxford. All Rights Reserved.
  26!>
  27!> Contributor(s):
  28!>
  29!> Alternatively, the contents of this file may be used under the terms of
  30!> either the GNU General Public License Version 2 or later (the "GPL"), or
  31!> the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  32!> in which case the provisions of the GPL or the LGPL are applicable instead
  33!> of those above. If you wish to allow use of your version of this file only
  34!> under the terms of either the GPL or the LGPL, and not to allow others to
  35!> use your version of this file under the terms of the MPL, indicate your
  36!> decision by deleting the provisions above and replace them with the notice
  37!> and other provisions required by the GPL or the LGPL. If you do not delete
  38!> the provisions above, a recipient may use your version of this file under
  39!> the terms of any one of the MPL, the GPL or the LGPL.
  40!>
  41
  42!> \example FluidMechanics/NavierStokes/RoutineCheck/Static/src/StaticExample.f90
  43!! Example program to solve a static NavierStokes equation using OpenCMISS calls.
  44!! \htmlinclude FluidMechanics/NavierStokes/RoutineCheck/Static/history.html
  45!!
  46!<
  47
  48!> Main program
  49
  50PROGRAM NAVIERSTOKESMASTEREXAMPLE
  51
  52  !
  53  !================================================================================================================================
  54  !
  55
  56  !PROGRAM LIBRARIES
  57
  58  USE OPENCMISS
  59  USE FLUID_MECHANICS_IO_ROUTINES
  60  USE MPI
  61
  62#ifdef WIN32
  63  USE IFQWINCMISS
  64#endif
  65
  66  !
  67  !================================================================================================================================
  68  !
  69
  70  !PROGRAM VARIABLES AND TYPES
  71
  72  IMPLICIT NONE
  73
  74  INTEGER(CMISSIntg), PARAMETER :: EquationsSetFieldUserNumber=1337
  75!   TYPE(CMISSFieldType) :: EquationsSetField
  76
  77
  78  !Test program parameters
  79
  80  INTEGER(CMISSIntg), PARAMETER :: CoordinateSystemUserNumber=1
  81  INTEGER(CMISSIntg), PARAMETER :: RegionUserNumber=2
  82  INTEGER(CMISSIntg), PARAMETER :: MeshUserNumber=3
  83  INTEGER(CMISSIntg), PARAMETER :: DecompositionUserNumber=4
  84  INTEGER(CMISSIntg), PARAMETER :: GeometricFieldUserNumber=5
  85  INTEGER(CMISSIntg), PARAMETER :: DependentFieldUserNumberNavierStokes=6
  86  INTEGER(CMISSIntg), PARAMETER :: DependentFieldUserNumberMovingMesh=42
  87  INTEGER(CMISSIntg), PARAMETER :: MaterialsFieldUserNumberNavierStokes=8
  88  INTEGER(CMISSIntg), PARAMETER :: MaterialsFieldUserNumberMovingMesh=9
  89  INTEGER(CMISSIntg), PARAMETER :: IndependentFieldUserNumberNavierStokes=10
  90  INTEGER(CMISSIntg), PARAMETER :: IndependentFieldUserNumberMovingMesh=11
  91  INTEGER(CMISSIntg), PARAMETER :: EquationsSetUserNumberNavierStokes=12
  92  INTEGER(CMISSIntg), PARAMETER :: EquationsSetUserNumberMovingMesh=13
  93  INTEGER(CMISSIntg), PARAMETER :: EquationsSetFieldUserNumberNavierStokes=22
  94  INTEGER(CMISSIntg), PARAMETER :: EquationsSetFieldUserNumberMovingMesh=23
  95  INTEGER(CMISSIntg), PARAMETER :: ProblemUserNumber=14
  96  INTEGER(CMISSIntg), PARAMETER :: AnalyticFieldUserNumberNavierStokes=42
  97
  98  INTEGER(CMISSIntg), PARAMETER :: DomainUserNumber=1
  99  INTEGER(CMISSIntg), PARAMETER :: SolverNavierStokesUserNumber=1
 100  !should be 1 and the Navier-Stokes solver 2
 101  INTEGER(CMISSIntg), PARAMETER :: SolverMovingMeshUserNumber=1
 102  INTEGER(CMISSIntg), PARAMETER :: MaterialsFieldUserNumberNavierStokesMu=1
 103  INTEGER(CMISSIntg), PARAMETER :: MaterialsFieldUserNumberNavierStokesRho=2
 104  INTEGER(CMISSIntg), PARAMETER :: MaterialsFieldUserNumberMovingMeshK=1
 105
 106  !Program types
 107
 108  TYPE(EXPORT_CONTAINER):: CM
 109
 110  !Program variables
 111
 112  INTEGER(CMISSIntg) :: NUMBER_OF_DIMENSIONS
 113  
 114  INTEGER(CMISSIntg) :: BASIS_TYPE
 115  INTEGER(CMISSIntg) :: BASIS_NUMBER_SPACE
 116  INTEGER(CMISSIntg) :: BASIS_NUMBER_VELOCITY
 117  INTEGER(CMISSIntg) :: BASIS_NUMBER_PRESSURE
 118  INTEGER(CMISSIntg) :: BASIS_GAUSS_SPACE
 119  INTEGER(CMISSIntg) :: BASIS_GAUSS_VELOCITY
 120  INTEGER(CMISSIntg) :: BASIS_GAUSS_PRESSURE
 121  INTEGER(CMISSIntg) :: BASIS_XI_INTERPOLATION_SPACE
 122  INTEGER(CMISSIntg) :: BASIS_XI_INTERPOLATION_VELOCITY
 123  INTEGER(CMISSIntg) :: BASIS_XI_INTERPOLATION_PRESSURE
 124  INTEGER(CMISSIntg) :: MESH_NUMBER_OF_COMPONENTS
 125  INTEGER(CMISSIntg) :: MESH_COMPONENT_NUMBER_SPACE
 126  INTEGER(CMISSIntg) :: MESH_COMPONENT_NUMBER_VELOCITY
 127  INTEGER(CMISSIntg) :: MESH_COMPONENT_NUMBER_PRESSURE
 128  INTEGER(CMISSIntg) :: NUMBER_OF_NODES_SPACE
 129  INTEGER(CMISSIntg) :: NUMBER_OF_NODES_VELOCITY
 130  INTEGER(CMISSIntg) :: NUMBER_OF_NODES_PRESSURE
 131  INTEGER(CMISSIntg) :: NUMBER_OF_ELEMENT_NODES_SPACE
 132  INTEGER(CMISSIntg) :: NUMBER_OF_ELEMENT_NODES_VELOCITY
 133  INTEGER(CMISSIntg) :: NUMBER_OF_ELEMENT_NODES_PRESSURE
 134  INTEGER(CMISSIntg) :: TOTAL_NUMBER_OF_NODES
 135  INTEGER(CMISSIntg) :: TOTAL_NUMBER_OF_ELEMENTS
 136  INTEGER(CMISSIntg) :: MAXIMUM_ITERATIONS
 137  INTEGER(CMISSIntg) :: RESTART_VALUE
 138!   INTEGER(CMISSIntg) :: MPI_IERROR
 139  INTEGER(CMISSIntg) :: NUMBER_OF_FIXED_WALL_NODES_NAVIER_STOKES
 140  INTEGER(CMISSIntg) :: NUMBER_OF_MOVED_WALL_NODES_NAVIER_STOKES
 141  INTEGER(CMISSIntg) :: NUMBER_OF_INLET_WALL_NODES_NAVIER_STOKES
 142  INTEGER(CMISSIntg) :: NUMBER_OF_FIXED_WALL_NODES_MOVING_MESH
 143  INTEGER(CMISSIntg) :: NUMBER_OF_MOVED_WALL_NODES_MOVING_MESH
 144
 145  INTEGER(CMISSIntg) :: EQUATIONS_NAVIER_STOKES_OUTPUT
 146  INTEGER(CMISSIntg) :: EQUATIONS_MOVING_MESH_OUTPUT
 147  INTEGER(CMISSIntg) :: COMPONENT_NUMBER
 148  INTEGER(CMISSIntg) :: NODE_NUMBER
 149  INTEGER(CMISSIntg) :: ELEMENT_NUMBER
 150  INTEGER(CMISSIntg) :: NODE_COUNTER
 151  INTEGER(CMISSIntg) :: CONDITION
 152  INTEGER(CMISSIntg) :: I
 153  INTEGER(CMISSIntg) :: ANALYTIC_TYPE
 154
 155  INTEGER(CMISSIntg) :: DYNAMIC_SOLVER_NAVIER_STOKES_INPUT_OPTION=2
 156  INTEGER(CMISSIntg) :: DYNAMIC_SOLVER_NAVIER_STOKES_OUTPUT_FREQUENCY
 157  INTEGER(CMISSIntg) :: DYNAMIC_SOLVER_NAVIER_STOKES_OUTPUT_TYPE
 158  INTEGER(CMISSIntg) :: NONLINEAR_SOLVER_NAVIER_STOKES_OUTPUT_TYPE
 159  INTEGER(CMISSIntg) :: LINEAR_SOLVER_NAVIER_STOKES_OUTPUT_TYPE
 160  INTEGER(CMISSIntg) :: LINEAR_SOLVER_MOVING_MESH_OUTPUT_TYPE
 161
 162  INTEGER, ALLOCATABLE, DIMENSION(:):: FIXED_WALL_NODES_NAVIER_STOKES
 163  INTEGER, ALLOCATABLE, DIMENSION(:):: MOVED_WALL_NODES_NAVIER_STOKES
 164  INTEGER, ALLOCATABLE, DIMENSION(:):: INLET_WALL_NODES_NAVIER_STOKES
 165  INTEGER, ALLOCATABLE, DIMENSION(:):: FIXED_WALL_NODES_MOVING_MESH
 166  INTEGER, ALLOCATABLE, DIMENSION(:):: MOVED_WALL_NODES_MOVING_MESH
 167
 168  REAL(CMISSDP) :: INITIAL_FIELD_NAVIER_STOKES(3)
 169  REAL(CMISSDP) :: INITIAL_FIELD_MOVING_MESH(3)
 170  REAL(CMISSDP) :: BOUNDARY_CONDITIONS_NAVIER_STOKES(3)
 171  REAL(CMISSDP) :: BOUNDARY_CONDITIONS_MOVING_MESH(3)
 172  REAL(CMISSDP) :: DIVERGENCE_TOLERANCE
 173  REAL(CMISSDP) :: RELATIVE_TOLERANCE
 174  REAL(CMISSDP) :: ABSOLUTE_TOLERANCE
 175  REAL(CMISSDP) :: LINESEARCH_ALPHA
 176  REAL(CMISSDP) :: VALUE
 177  REAL(CMISSDP) :: K_PARAM_MOVING_MESH=1.0_CMISSDP
 178  REAL(CMISSDP) :: MU_PARAM_NAVIER_STOKES
 179  REAL(CMISSDP) :: RHO_PARAM_NAVIER_STOKES
 180
 181  REAL(CMISSDP) :: DYNAMIC_SOLVER_NAVIER_STOKES_START_TIME
 182  REAL(CMISSDP) :: DYNAMIC_SOLVER_NAVIER_STOKES_STOP_TIME
 183  REAL(CMISSDP) :: DYNAMIC_SOLVER_NAVIER_STOKES_THETA
 184  REAL(CMISSDP) :: DYNAMIC_SOLVER_NAVIER_STOKES_TIME_INCREMENT
 185
 186  LOGICAL :: EXPORT_FIELD_IO
 187  LOGICAL :: LINEAR_SOLVER_NAVIER_STOKES_DIRECT_FLAG
 188  LOGICAL :: LINEAR_SOLVER_MOVING_MESH_DIRECT_FLAG
 189  LOGICAL :: FIXED_WALL_NODES_NAVIER_STOKES_FLAG
 190  LOGICAL :: MOVED_WALL_NODES_NAVIER_STOKES_FLAG
 191  LOGICAL :: INLET_WALL_NODES_NAVIER_STOKES_FLAG
 192  LOGICAL :: ALE_SOLVER_NAVIER_STOKES_FLAG
 193  LOGICAL :: ANALYTIC_FLAG
 194  LOGICAL :: DYNAMIC_SOLVER_NAVIER_STOKES_FLAG
 195  LOGICAL :: FIXED_WALL_NODES_MOVING_MESH_FLAG
 196  LOGICAL :: MOVED_WALL_NODES_MOVING_MESH_FLAG
 197
 198  CHARACTER *15 BUFFER
 199  CHARACTER *15 ARG
 200  CHARACTER *15 OUTPUT_STRING
 201
 202  !CMISS variables
 203
 204  !Regions
 205  TYPE(CMISSRegionType) :: Region
 206  TYPE(CMISSRegionType) :: WorldRegion
 207  !Coordinate systems
 208  TYPE(CMISSCoordinateSystemType) :: CoordinateSystem
 209  TYPE(CMISSCoordinateSystemType) :: WorldCoordinateSystem
 210  !Basis
 211  TYPE(CMISSBasisType) :: BasisSpace
 212  TYPE(CMISSBasisType) :: BasisVelocity
 213  TYPE(CMISSBasisType) :: BasisPressure
 214  !Nodes
 215  TYPE(CMISSNodesType) :: Nodes
 216  !Elements
 217  TYPE(CMISSMeshElementsType) :: MeshElementsSpace
 218  TYPE(CMISSMeshElementsType) :: MeshElementsVelocity
 219  TYPE(CMISSMeshElementsType) :: MeshElementsPressure
 220  !Meshes
 221  TYPE(CMISSMeshType) :: Mesh
 222  !Decompositions
 223  TYPE(CMISSDecompositionType) :: Decomposition
 224  !Fields
 225  TYPE(CMISSFieldsType) :: Fields
 226  !Field types
 227  TYPE(CMISSFieldType) :: GeometricField
 228  TYPE(CMISSFieldType) :: AnalyticFieldNavierStokes
 229  TYPE(CMISSFieldType) :: DependentFieldNavierStokes
 230  TYPE(CMISSFieldType) :: DependentFieldMovingMesh
 231  TYPE(CMISSFieldType) :: MaterialsFieldNavierStokes
 232  TYPE(CMISSFieldType) :: MaterialsFieldMovingMesh
 233  TYPE(CMISSFieldType) :: IndependentFieldNavierStokes
 234  TYPE(CMISSFieldType) :: IndependentFieldMovingMesh
 235  TYPE(CMISSFieldType) :: EquationsSetFieldNavierStokes
 236  TYPE(CMISSFieldType) :: EquationsSetFieldMovingMesh
 237  !Boundary conditions
 238  TYPE(CMISSBoundaryConditionsType) :: BoundaryConditionsNavierStokes
 239  TYPE(CMISSBoundaryConditionsType) :: BoundaryConditionsMovingMesh
 240  !Equations sets
 241  TYPE(CMISSEquationsSetType) :: EquationsSetNavierStokes
 242  TYPE(CMISSEquationsSetType) :: EquationsSetMovingMesh
 243  !Equations
 244  TYPE(CMISSEquationsType) :: EquationsNavierStokes
 245  TYPE(CMISSEquationsType) :: EquationsMovingMesh
 246  !Problems
 247  TYPE(CMISSProblemType) :: Problem
 248  !Control loops
 249  TYPE(CMISSControlLoopType) :: ControlLoop
 250  !Solvers
 251  TYPE(CMISSSolverType) :: DynamicSolverNavierStokes
 252  TYPE(CMISSSolverType) :: NonlinearSolverNavierStokes
 253  TYPE(CMISSSolverType) :: LinearSolverNavierStokes
 254  TYPE(CMISSSolverType) :: LinearSolverMovingMesh
 255  !Solver equations
 256  TYPE(CMISSSolverEquationsType) :: SolverEquationsNavierStokes
 257  TYPE(CMISSSolverEquationsType) :: SolverEquationsMovingMesh
 258
 259#ifdef WIN32
 260  !Quickwin type
 261  LOGICAL :: QUICKWIN_STATUS=.FALSE.
 262  TYPE(WINDOWCONFIG) :: QUICKWIN_WINDOW_CONFIG
 263#endif
 264  
 265  !Generic CMISS variables
 266
 267  INTEGER(CMISSIntg) :: NumberOfComputationalNodes,ComputationalNodeNumber,BoundaryNodeDomain
 268  INTEGER(CMISSIntg) :: EquationsSetIndex
 269  INTEGER(CMISSIntg) :: Err
 270  
 271#ifdef WIN32
 272  !Initialise QuickWin
 273  QUICKWIN_WINDOW_CONFIG%TITLE="General Output" !Window title
 274  QUICKWIN_WINDOW_CONFIG%NUMTEXTROWS=-1 !Max possible number of rows
 275  QUICKWIN_WINDOW_CONFIG%MODE=QWIN$SCROLLDOWN
 276  !Set the window parameters
 277  QUICKWIN_STATUS=SETWINDOWCONFIG(QUICKWIN_WINDOW_CONFIG)
 278  !If attempt fails set with system estimated values
 279  IF(.NOT.QUICKWIN_STATUS) QUICKWIN_STATUS=SETWINDOWCONFIG(QUICKWIN_WINDOW_CONFIG)
 280#endif
 281
 282  !
 283  !================================================================================================================================
 284  !
 285
 286  !PROBLEM CONTROL PANEL
 287
 288  !Import cmHeart mesh information
 289  CALL FLUID_MECHANICS_IO_READ_CMHEART(CM,Err)  
 290  BASIS_NUMBER_SPACE=CM%ID_M
 291  BASIS_NUMBER_VELOCITY=CM%ID_V
 292  BASIS_NUMBER_PRESSURE=CM%ID_P
 293  NUMBER_OF_DIMENSIONS=CM%D
 294  BASIS_TYPE=CM%IT_T
 295  BASIS_XI_INTERPOLATION_SPACE=CM%IT_M
 296  BASIS_XI_INTERPOLATION_VELOCITY=CM%IT_V
 297  BASIS_XI_INTERPOLATION_PRESSURE=CM%IT_P
 298  NUMBER_OF_NODES_SPACE=CM%N_M
 299  NUMBER_OF_NODES_VELOCITY=CM%N_V
 300  NUMBER_OF_NODES_PRESSURE=CM%N_P
 301  TOTAL_NUMBER_OF_NODES=CM%N_T
 302  TOTAL_NUMBER_OF_ELEMENTS=CM%E_T
 303  NUMBER_OF_ELEMENT_NODES_SPACE=CM%EN_M
 304  NUMBER_OF_ELEMENT_NODES_VELOCITY=CM%EN_V
 305  NUMBER_OF_ELEMENT_NODES_PRESSURE=CM%EN_P
 306  !Set initial values
 307  INITIAL_FIELD_NAVIER_STOKES(1)=0.0_CMISSDP
 308  INITIAL_FIELD_NAVIER_STOKES(2)=0.0_CMISSDP
 309  INITIAL_FIELD_NAVIER_STOKES(3)=0.0_CMISSDP
 310  INITIAL_FIELD_MOVING_MESH(1)=0.0_CMISSDP
 311  INITIAL_FIELD_MOVING_MESH(2)=0.0_CMISSDP
 312  INITIAL_FIELD_MOVING_MESH(3)=0.0_CMISSDP
 313  
 314  !Set defaults
 315  !Set material parameters
 316  MU_PARAM_NAVIER_STOKES=1.0_CMISSDP
 317  RHO_PARAM_NAVIER_STOKES=1.0_CMISSDP
 318  LINEAR_SOLVER_NAVIER_STOKES_DIRECT_FLAG=.FALSE.
 319  LINEAR_SOLVER_MOVING_MESH_DIRECT_FLAG=.FALSE.
 320  DYNAMIC_SOLVER_NAVIER_STOKES_FLAG=.FALSE.
 321  ALE_SOLVER_NAVIER_STOKES_FLAG=.FALSE.
 322  ANALYTIC_FLAG=.FALSE.
 323  IF(NUMBER_OF_DIMENSIONS==2) THEN
 324    ANALYTIC_TYPE=CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_TWO_DIM_1
 325  ELSE
 326    ANALYTIC_TYPE=CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_THREE_DIM_1
 327  ENDIF
 328  OUTPUT_STRING='DEFAULT'
 329  DYNAMIC_SOLVER_NAVIER_STOKES_START_TIME=0.0_CMISSDP
 330  DYNAMIC_SOLVER_NAVIER_STOKES_STOP_TIME=3.0_CMISSDP 
 331  DYNAMIC_SOLVER_NAVIER_STOKES_TIME_INCREMENT=1.0_CMISSDP
 332  !Set initial boundary conditions
 333  BOUNDARY_CONDITIONS_NAVIER_STOKES=0.0_CMISSDP
 334
 335  !Get command line arguments
 336  DO I=1,COMMAND_ARGUMENT_COUNT()
 337    CALL GET_COMMAND_ARGUMENT(I,ARG)
 338    SELECT CASE(ARG)
 339      CASE('-density')
 340        CALL GET_COMMAND_ARGUMENT(I+1,BUFFER)
 341        READ(BUFFER,*) RHO_PARAM_NAVIER_STOKES
 342      CASE('-viscosity')
 343        CALL GET_COMMAND_ARGUMENT(I+1,BUFFER)
 344        READ(BUFFER,*) MU_PARAM_NAVIER_STOKES
 345      CASE('-directsolver')
 346        CALL GET_COMMAND_ARGUMENT(I+1,BUFFER)
 347        READ(BUFFER,*) LINEAR_SOLVER_NAVIER_STOKES_DIRECT_FLAG
 348      CASE('-dynamic')
 349        CALL GET_COMMAND_ARGUMENT(I+1,BUFFER)
 350        READ(BUFFER,*) DYNAMIC_SOLVER_NAVIER_STOKES_FLAG
 351      CASE('-ALE')
 352        CALL GET_COMMAND_ARGUMENT(I+1,BUFFER)
 353        READ(BUFFER,*) ALE_SOLVER_NAVIER_STOKES_FLAG
 354      CASE('-analytic')
 355        CALL GET_COMMAND_ARGUMENT(I+1,BUFFER)
 356        READ(BUFFER,*) ANALYTIC_FLAG
 357      CASE('-analytictype')
 358        CALL GET_COMMAND_ARGUMENT(I+1,BUFFER)
 359        READ(BUFFER,*) ANALYTIC_TYPE
 360      CASE('-analyticoutput')
 361        CALL GET_COMMAND_ARGUMENT(I+1,BUFFER)
 362        READ(BUFFER,*) OUTPUT_STRING
 363      CASE('-starttime')
 364        CALL GET_COMMAND_ARGUMENT(I+1,BUFFER)
 365        READ(BUFFER,*) DYNAMIC_SOLVER_NAVIER_STOKES_START_TIME
 366      CASE('-stoptime')
 367        CALL GET_COMMAND_ARGUMENT(I+1,BUFFER)
 368        READ(BUFFER,*) DYNAMIC_SOLVER_NAVIER_STOKES_STOP_TIME
 369      CASE('-timeincrement')
 370        CALL GET_COMMAND_ARGUMENT(I+1,BUFFER)
 371        READ(BUFFER,*) DYNAMIC_SOLVER_NAVIER_STOKES_TIME_INCREMENT
 372      CASE('-velocity')
 373        CALL GET_COMMAND_ARGUMENT(I+1,BUFFER)
 374        READ(BUFFER,*) BOUNDARY_CONDITIONS_NAVIER_STOKES(1)
 375        CALL GET_COMMAND_ARGUMENT(I+2,BUFFER)
 376        READ(BUFFER,*) BOUNDARY_CONDITIONS_NAVIER_STOKES(2)
 377        CALL GET_COMMAND_ARGUMENT(I+3,BUFFER)
 378        READ(BUFFER,*) BOUNDARY_CONDITIONS_NAVIER_STOKES(3)
 379      CASE DEFAULT
 380        !do nothing
 381      END SELECT
 382  ENDDO 
 383  IF(NUMBER_OF_DIMENSIONS==2) THEN
 384    IF(DYNAMIC_SOLVER_NAVIER_STOKES_FLAG) THEN
 385      ANALYTIC_TYPE=CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_TWO_DIM_5
 386    ELSE
 387      ANALYTIC_TYPE=CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_TWO_DIM_1
 388    ENDIF
 389  ELSE
 390    IF(DYNAMIC_SOLVER_NAVIER_STOKES_FLAG) THEN
 391      ANALYTIC_TYPE=CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_THREE_DIM_5
 392    ELSE
 393      ANALYTIC_TYPE=CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_THREE_DIM_1
 394    ENDIF
 395  ENDIF
 396  WRITE(*,*)' '
 397  WRITE(*,*)' ************************************* '
 398  WRITE(*,*)' '
 399  WRITE(*,*)'-density........', RHO_PARAM_NAVIER_STOKES
 400  WRITE(*,*)'-viscosity......', MU_PARAM_NAVIER_STOKES
 401  WRITE(*,*)'-analytic.......  ', ANALYTIC_FLAG
 402  IF(.NOT.ANALYTIC_FLAG) THEN
 403    WRITE(*,*)'-velocity.......', BOUNDARY_CONDITIONS_NAVIER_STOKES
 404  ELSE
 405    IF(ANALYTIC_TYPE==CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_TWO_DIM_1.AND.NUMBER_OF_DIMENSIONS==2) THEN
 406      WRITE(*,*)'  -analytictype...', 'CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_TWO_DIM_1'
 407    ELSE IF(ANALYTIC_TYPE==CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_TWO_DIM_2.AND.NUMBER_OF_DIMENSIONS==2) THEN
 408      WRITE(*,*)'  -analytictype...', 'CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_TWO_DIM_2'
 409    ELSE IF(ANALYTIC_TYPE==CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_TWO_DIM_3.AND.NUMBER_OF_DIMENSIONS==2) THEN
 410      WRITE(*,*)'  -analytictype...', 'CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_TWO_DIM_3'
 411    ELSE IF(ANALYTIC_TYPE==CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_TWO_DIM_4.AND.NUMBER_OF_DIMENSIONS==2) THEN
 412      WRITE(*,*)'  -analytictype...', 'CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_TWO_DIM_4'
 413    ELSE IF(ANALYTIC_TYPE==CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_TWO_DIM_5.AND.NUMBER_OF_DIMENSIONS==2) THEN
 414      WRITE(*,*)'  -analytictype...', 'CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_TWO_DIM_5'
 415    ELSE IF(ANALYTIC_TYPE==CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_THREE_DIM_1.AND.NUMBER_OF_DIMENSIONS==3) THEN
 416      WRITE(*,*)'  -analytictype...', 'CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_THREE_DIM_1'
 417    ELSE IF(ANALYTIC_TYPE==CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_THREE_DIM_2.AND.NUMBER_OF_DIMENSIONS==3) THEN
 418      WRITE(*,*)'  -analytictype...', 'CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_THREE_DIM_2'
 419    ELSE IF(ANALYTIC_TYPE==CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_THREE_DIM_3.AND.NUMBER_OF_DIMENSIONS==3) THEN
 420      WRITE(*,*)'  -analytictype...', 'CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_THREE_DIM_3'
 421    ELSE IF(ANALYTIC_TYPE==CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_THREE_DIM_4.AND.NUMBER_OF_DIMENSIONS==3) THEN
 422      WRITE(*,*)'  -analytictype...', 'CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_THREE_DIM_4'
 423    ELSE IF(ANALYTIC_TYPE==CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_THREE_DIM_5.AND.NUMBER_OF_DIMENSIONS==3) THEN
 424      WRITE(*,*)'  -analytictype...', 'CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_THREE_DIM_5'
 425    ENDIF
 426  ENDIF
 427  WRITE(*,*) ' '
 428  WRITE(*,*)'-dynamic........  ', DYNAMIC_SOLVER_NAVIER_STOKES_FLAG
 429  IF(DYNAMIC_SOLVER_NAVIER_STOKES_FLAG) THEN
 430    WRITE(*,*)'  -starttime......  ', DYNAMIC_SOLVER_NAVIER_STOKES_START_TIME
 431    WRITE(*,*)'  -stoptime.......  ', DYNAMIC_SOLVER_NAVIER_STOKES_STOP_TIME
 432    WRITE(*,*)'  -timeincrement..  ', DYNAMIC_SOLVER_NAVIER_STOKES_TIME_INCREMENT
 433    WRITE(*,*)'  -ALE............  ', ALE_SOLVER_NAVIER_STOKES_FLAG
 434    WRITE(*,*) ' ' 
 435  ENDIF
 436  WRITE(*,*)'-directsolver...  ', LINEAR_SOLVER_NAVIER_STOKES_DIRECT_FLAG
 437  WRITE(*,*)' '
 438  WRITE(*,*)' ************************************* '
 439  WRITE(*,*)' '
 440  WRITE(*,*) ' ' 
 441  !Set boundary conditions
 442  INQUIRE(FILE="./input/bc/FIXED_WALL", EXIST=FIXED_WALL_NODES_NAVIER_STOKES_FLAG)
 443  INQUIRE(FILE="./input/bc/FREE_INLET", EXIST=INLET_WALL_NODES_NAVIER_STOKES_FLAG)
 444  INQUIRE(FILE="./input/bc/MOVED_WALL", EXIST=MOVED_WALL_NODES_NAVIER_STOKES_FLAG)
 445  INQUIRE(FILE="./input/bc/FIXED_MESH", EXIST=FIXED_WALL_NODES_MOVING_MESH_FLAG)
 446  INQUIRE(FILE="./input/bc/MOVED_MESH", EXIST=MOVED_WALL_NODES_MOVING_MESH_FLAG)
 447  INITIAL_FIELD_NAVIER_STOKES(1)=BOUNDARY_CONDITIONS_NAVIER_STOKES(1)
 448  INITIAL_FIELD_NAVIER_STOKES(2)=BOUNDARY_CONDITIONS_NAVIER_STOKES(2)
 449  INITIAL_FIELD_NAVIER_STOKES(3)=BOUNDARY_CONDITIONS_NAVIER_STOKES(3)
 450  IF(FIXED_WALL_NODES_NAVIER_STOKES_FLAG) THEN
 451    OPEN(UNIT=1, FILE="./input/bc/FIXED_WALL",STATUS='unknown')
 452    READ(1,*) NUMBER_OF_FIXED_WALL_NODES_NAVIER_STOKES
 453    ALLOCATE(FIXED_WALL_NODES_NAVIER_STOKES(NUMBER_OF_FIXED_WALL_NODES_NAVIER_STOKES))
 454    READ(1,*) FIXED_WALL_NODES_NAVIER_STOKES(1:NUMBER_OF_FIXED_WALL_NODES_NAVIER_STOKES)
 455    CLOSE(1)
 456  ENDIF
 457  IF(MOVED_WALL_NODES_NAVIER_STOKES_FLAG) THEN
 458    OPEN(UNIT=1, FILE="./input/bc/MOVED_WALL",STATUS='unknown')
 459    READ(1,*) NUMBER_OF_MOVED_WALL_NODES_NAVIER_STOKES
 460    ALLOCATE(MOVED_WALL_NODES_NAVIER_STOKES(NUMBER_OF_MOVED_WALL_NODES_NAVIER_STOKES))
 461    READ(1,*) MOVED_WALL_NODES_NAVIER_STOKES(1:NUMBER_OF_MOVED_WALL_NODES_NAVIER_STOKES)
 462    CLOSE(1)
 463  ENDIF
 464  IF(INLET_WALL_NODES_NAVIER_STOKES_FLAG) THEN
 465    OPEN(UNIT=1, FILE="./input/bc/FREE_INLET",STATUS='unknown')
 466    READ(1,*) NUMBER_OF_INLET_WALL_NODES_NAVIER_STOKES
 467    ALLOCATE(INLET_WALL_NODES_NAVIER_STOKES(NUMBER_OF_INLET_WALL_NODES_NAVIER_STOKES))
 468    READ(1,*) INLET_WALL_NODES_NAVIER_STOKES(1:NUMBER_OF_INLET_WALL_NODES_NAVIER_STOKES)
 469    CLOSE(1)
 470  ENDIF
 471  IF(FIXED_WALL_NODES_MOVING_MESH_FLAG) THEN
 472    OPEN(UNIT=1, FILE="./input/bc/FIXED_MESH",STATUS='unknown')
 473    READ(1,*) NUMBER_OF_FIXED_WALL_NODES_MOVING_MESH
 474    ALLOCATE(FIXED_WALL_NODES_MOVING_MESH(NUMBER_OF_FIXED_WALL_NODES_MOVING_MESH))
 475    READ(1,*) FIXED_WALL_NODES_MOVING_MESH(1:NUMBER_OF_FIXED_WALL_NODES_MOVING_MESH)
 476    CLOSE(1)
 477  ENDIF
 478  IF(MOVED_WALL_NODES_MOVING_MESH_FLAG) THEN
 479    OPEN(UNIT=1, FILE="./input/bc/MOVED_MESH",STATUS='unknown')
 480    READ(1,*) NUMBER_OF_MOVED_WALL_NODES_MOVING_MESH
 481    ALLOCATE(MOVED_WALL_NODES_MOVING_MESH(NUMBER_OF_MOVED_WALL_NODES_MOVING_MESH))
 482    READ(1,*) MOVED_WALL_NODES_MOVING_MESH(1:NUMBER_OF_MOVED_WALL_NODES_MOVING_MESH)
 483    CLOSE(1)
 484    BOUNDARY_CONDITIONS_MOVING_MESH(1)=0.0_CMISSDP
 485    BOUNDARY_CONDITIONS_MOVING_MESH(2)=0.0_CMISSDP
 486    BOUNDARY_CONDITIONS_MOVING_MESH(3)=0.0_CMISSDP
 487  ENDIF
 488  !Set interpolation parameters
 489  BASIS_GAUSS_SPACE=4
 490  BASIS_GAUSS_VELOCITY=4
 491  BASIS_GAUSS_PRESSURE=4
 492  !Set output parameter
 493  !(NoOutput/ProgressOutput/TimingOutput/SolverOutput/SolverMatrixOutput)
 494  DYNAMIC_SOLVER_NAVIER_STOKES_OUTPUT_TYPE=CMISS_SOLVER_NO_OUTPUT
 495  LINEAR_SOLVER_MOVING_MESH_OUTPUT_TYPE=CMISS_SOLVER_NO_OUTPUT
 496  NONLINEAR_SOLVER_NAVIER_STOKES_OUTPUT_TYPE=CMISS_SOLVER_PROGRESS_OUTPUT
 497  LINEAR_SOLVER_NAVIER_STOKES_OUTPUT_TYPE=CMISS_SOLVER_NO_OUTPUT
 498  !(NoOutput/TimingOutput/MatrixOutput/ElementOutput)
 499  EQUATIONS_NAVIER_STOKES_OUTPUT=CMISS_EQUATIONS_NO_OUTPUT
 500  !Set time parameter
 501  DYNAMIC_SOLVER_NAVIER_STOKES_THETA=1.0_CMISSDP
 502  !Set result output parameter
 503  DYNAMIC_SOLVER_NAVIER_STOKES_OUTPUT_FREQUENCY=1
 504  !Set solver parameters
 505  RELATIVE_TOLERANCE=1.0E-10_CMISSDP !default: 1.0E-05_CMISSDP
 506  ABSOLUTE_TOLERANCE=1.0E-10_CMISSDP !default: 1.0E-10_CMISSDP
 507  DIVERGENCE_TOLERANCE=1.0E20 !default: 1.0E5
 508  MAXIMUM_ITERATIONS=100000 !default: 100000
 509  RESTART_VALUE=3000 !default: 30
 510  LINESEARCH_ALPHA=1.0
 511
 512  !
 513  !================================================================================================================================
 514  !
 515
 516  !INITIALISE OPENCMISS
 517
 518  CALL CMISSInitialise(WorldCoordinateSystem,WorldRegion,Err)
 519
 520  CALL CMISSErrorHandlingModeSet(CMISS_ERRORS_TRAP_ERROR,Err)
 521
 522  !
 523  !================================================================================================================================
 524  !
 525
 526  !CHECK COMPUTATIONAL NODE
 527
 528  !Get the computational nodes information
 529  CALL CMISSComputationalNumberOfNodesGet(NumberOfComputationalNodes,Err)
 530  CALL CMISSComputationalNodeNumberGet(ComputationalNodeNumber,Err)
 531
 532  !
 533  !================================================================================================================================
 534  !
 535
 536  !COORDINATE SYSTEM
 537
 538  !Start the creation of a new RC coordinate system
 539  CALL CMISSCoordinateSystem_Initialise(CoordinateSystem,Err)
 540  CALL CMISSCoordinateSystem_CreateStart(CoordinateSystemUserNumber,CoordinateSystem,Err)
 541  !Set the coordinate system dimension
 542  CALL CMISSCoordinateSystem_DimensionSet(CoordinateSystem,NUMBER_OF_DIMENSIONS,Err)
 543  !Finish the creation of the coordinate system
 544  CALL CMISSCoordinateSystem_CreateFinish(CoordinateSystem,Err)
 545
 546  !
 547  !================================================================================================================================
 548  !
 549
 550  !REGION
 551
 552  !Start the creation of a new region
 553  CALL CMISSRegion_Initialise(Region,Err)
 554  CALL CMISSRegion_CreateStart(RegionUserNumber,WorldRegion,Region,Err)
 555  !Set the regions coordinate system as defined above
 556  CALL CMISSRegion_CoordinateSystemSet(Region,CoordinateSystem,Err)
 557  !Finish the creation of the region
 558  CALL CMISSRegion_CreateFinish(Region,Err)
 559
 560  !
 561  !================================================================================================================================
 562  !
 563
 564  !BASES
 565
 566  !Start the creation of new bases
 567  MESH_NUMBER_OF_COMPONENTS=1
 568  CALL CMISSBasis_Initialise(BasisSpace,Err)
 569  CALL CMISSBasis_CreateStart(BASIS_NUMBER_SPACE,BasisSpace,Err)
 570  !Set the basis type (Lagrange/Simplex)
 571  CALL CMISSBasis_TypeSet(BasisSpace,BASIS_TYPE,Err)
 572  !Set the basis xi number
 573  CALL CMISSBasis_NumberOfXiSet(BasisSpace,NUMBER_OF_DIMENSIONS,Err)
 574  !Set the basis xi interpolation and number of Gauss points
 575  IF(NUMBER_OF_DIMENSIONS==2) THEN
 576    CALL CMISSBasis_InterpolationXiSet(BasisSpace,(/BASIS_XI_INTERPOLATION_SPACE,BASIS_XI_INTERPOLATION_SPACE/),Err)
 577    IF(BASIS_TYPE/=CMISS_BASIS_SIMPLEX_TYPE) THEN
 578      CALL CMISSBasis_QuadratureNumberOfGaussXiSet(BasisSpace,(/BASIS_GAUSS_SPACE,BASIS_GAUSS_SPACE/),Err)
 579    ELSE
 580      CALL CMISSBasis_QuadratureOrderSet(BasisSpace,BASIS_GAUSS_SPACE+1,Err)
 581    ENDIF
 582  ELSE IF(NUMBER_OF_DIMENSIONS==3) THEN
 583    CALL CMISSBasis_InterpolationXiSet(BasisSpace,(/BASIS_XI_INTERPOLATION_SPACE,BASIS_XI_INTERPOLATION_SPACE, & 
 584      & BASIS_XI_INTERPOLATION_SPACE/),Err)                         
 585    IF(BASIS_TYPE/=CMISS_BASIS_SIMPLEX_TYPE) THEN
 586      CALL CMISSBasis_QuadratureNumberOfGaussXiSet(BasisSpace,(/BASIS_GAUSS_SPACE,BASIS_GAUSS_SPACE,BASIS_GAUSS_SPACE/), & 
 587        & Err)
 588    ELSE
 589      CALL CMISSBasis_QuadratureOrderSet(BasisSpace,BASIS_GAUSS_SPACE+1,Err)
 590    ENDIF
 591  ENDIF
 592  !Finish the creation of the basis
 593  CALL CMISSBasis_CreateFinish(BasisSpace,Err)
 594  !Start the creation of another basis
 595  IF(BASIS_XI_INTERPOLATION_VELOCITY==BASIS_XI_INTERPOLATION_SPACE) THEN
 596    BasisVelocity=BasisSpace
 597  ELSE
 598    MESH_NUMBER_OF_COMPONENTS=MESH_NUMBER_OF_COMPONENTS+1
 599    !Initialise a new velocity basis
 600    CALL CMISSBasis_Initialise(BasisVelocity,Err)
 601    !Start the creation of a basis
 602    CALL CMISSBasis_CreateStart(BASIS_NUMBER_VELOCITY,BasisVelocity,Err)
 603    !Set the basis type (Lagrange/Simplex)
 604    CALL CMISSBasis_TypeSet(BasisVelocity,BASIS_TYPE,Err)
 605    !Set the basis xi number
 606    CALL CMISSBasis_NumberOfXiSet(BasisVelocity,NUMBER_OF_DIMENSIONS,Err)
 607    !Set the basis xi interpolation and number of Gauss points
 608    IF(NUMBER_OF_DIMENSIONS==2) THEN
 609      CALL CMISSBasis_InterpolationXiSet(BasisVelocity,(/BASIS_XI_INTERPOLATION_VELOCITY,BASIS_XI_INTERPOLATION_VELOCITY/),Err)
 610      IF(BASIS_TYPE/=CMISS_BASIS_SIMPLEX_TYPE) THEN 
 611        CALL CMISSBasis_QuadratureNumberOfGaussXiSet(BasisVelocity,(/BASIS_GAUSS_VELOCITY,BASIS_GAUSS_VELOCITY/),Err)
 612      ELSE
 613        CALL CMISSBasis_QuadratureOrderSet(BasisVelocity,BASIS_GAUSS_VELOCITY+1,Err)
 614      ENDIF
 615    ELSE IF(NUMBER_OF_DIMENSIONS==3) THEN
 616      CALL CMISSBasis_InterpolationXiSet(BasisVelocity,(/BASIS_XI_INTERPOLATION_VELOCITY,BASIS_XI_INTERPOLATION_VELOCITY, & 
 617        & BASIS_XI_INTERPOLATION_VELOCITY/),Err)                         
 618      IF(BASIS_TYPE/=CMISS_BASIS_SIMPLEX_TYPE) THEN
 619        CALL CMISSBasis_QuadratureNumberOfGaussXiSet(BasisVelocity,(/BASIS_GAUSS_VELOCITY,BASIS_GAUSS_VELOCITY, & 
 620          & BASIS_GAUSS_VELOCITY/),Err)
 621      ELSE
 622        CALL CMISSBasis_QuadratureOrderSet(BasisVelocity,BASIS_GAUSS_VELOCITY+1,Err)
 623      ENDIF
 624    ENDIF
 625    !Finish the creation of the basis
 626    CALL CMISSBasis_CreateFinish(BasisVelocity,Err)
 627  ENDIF
 628  !Start the creation of another basis
 629  IF(BASIS_XI_INTERPOLATION_PRESSURE==BASIS_XI_INTERPOLATION_SPACE) THEN
 630    BasisPressure=BasisSpace
 631  ELSE IF(BASIS_XI_INTERPOLATION_PRESSURE==BASIS_XI_INTERPOLATION_VELOCITY) THEN
 632    BasisPressure=BasisVelocity
 633  ELSE
 634    MESH_NUMBER_OF_COMPONENTS=MESH_NUMBER_OF_COMPONENTS+1
 635    !Initialise a new pressure basis
 636    CALL CMISSBasis_Initialise(BasisPressure,Err)
 637    !Start the creation of a basis
 638    CALL CMISSBasis_CreateStart(BASIS_NUMBER_PRESSURE,BasisPressure,Err)
 639    !Set the basis type (Lagrange/Simplex)
 640    CALL CMISSBasis_TypeSet(BasisPressure,BASIS_TYPE,Err)
 641    !Set the basis xi number
 642    CALL CMISSBasis_NumberOfXiSet(BasisPressure,NUMBER_OF_DIMENSIONS,Err)
 643    !Set the basis xi interpolation and number of Gauss points
 644    IF(NUMBER_OF_DIMENSIONS==2) THEN
 645      CALL CMISSBasis_InterpolationXiSet(BasisPressure,(/BASIS_XI_INTERPOLATION_PRESSURE,BASIS_XI_INTERPOLATION_PRESSURE/),Err)
 646      IF(BASIS_TYPE/=CMISS_BASIS_SIMPLEX_TYPE) THEN
 647        CALL CMISSBasis_QuadratureNumberOfGaussXiSet(BasisPressure,(/BASIS_GAUSS_PRESSURE,BASIS_GAUSS_PRESSURE/),Err)
 648      ELSE
 649        CALL CMISSBasis_QuadratureOrderSet(BasisPressure,BASIS_GAUSS_PRESSURE+1,Err)
 650      ENDIF
 651    ELSE IF(NUMBER_OF_DIMENSIONS==3) THEN
 652      CALL CMISSBasis_InterpolationXiSet(BasisPressure,(/BASIS_XI_INTERPOLATION_PRESSURE,BASIS_XI_INTERPOLATION_PRESSURE, & 
 653        & BASIS_XI_INTERPOLATION_PRESSURE/),Err)                         
 654      IF(BASIS_TYPE/=CMISS_BASIS_SIMPLEX_TYPE) THEN
 655        CALL CMISSBasis_QuadratureNumberOfGaussXiSet(BasisPressure,(/BASIS_GAUSS_PRESSURE,BASIS_GAUSS_PRESSURE, & 
 656          & BASIS_GAUSS_PRESSURE/),Err)
 657      ELSE
 658        CALL CMISSBasis_QuadratureOrderSet(BasisPressure,BASIS_GAUSS_PRESSURE+1,Err)
 659      ENDIF
 660    ENDIF
 661    !Finish the creation of the basis
 662    CALL CMISSBasis_CreateFinish(BasisPressure,Err)
 663  ENDIF
 664
 665  !
 666  !================================================================================================================================
 667  !
 668
 669  !MESH
 670
 671  !Start the creation of mesh nodes
 672  CALL CMISSNodes_Initialise(Nodes,Err)
 673  CALL CMISSMesh_Initialise(Mesh,Err)
 674  CALL CMISSNodes_CreateStart(Region,TOTAL_NUMBER_OF_NODES,Nodes,Err)
 675  CALL CMISSNodes_CreateFinish(Nodes,Err)
 676  !Start the creation of the mesh
 677  CALL CMISSMesh_CreateStart(MeshUserNumber,Region,NUMBER_OF_DIMENSIONS,Mesh,Err)
 678  !Set number of mesh elements
 679  CALL CMISSMesh_NumberOfElementsSet(Mesh,TOTAL_NUMBER_OF_ELEMENTS,Err)
 680  !Set number of mesh components
 681  CALL CMISSMesh_NumberOfComponentsSet(Mesh,MESH_NUMBER_OF_COMPONENTS,Err)
 682  !Specify spatial mesh component
 683  CALL CMISSMeshElements_Initialise(MeshElementsSpace,Err)
 684  CALL CMISSMeshElements_Initialise(MeshElementsVelocity,Err)
 685  CALL CMISSMeshElements_Initialise(MeshElementsPressure,Err)
 686  MESH_COMPONENT_NUMBER_SPACE=1
 687  MESH_COMPONENT_NUMBER_VELOCITY=1
 688  MESH_COMPONENT_NUMBER_PRESSURE=1
 689  CALL CMISSMeshElements_CreateStart(Mesh,MESH_COMPONENT_NUMBER_SPACE,BasisSpace,MeshElementsSpace,Err)
 690  DO ELEMENT_NUMBER=1,TOTAL_NUMBER_OF_ELEMENTS
 691    CALL CMISSMeshElements_NodesSet(MeshElementsSpace,ELEMENT_NUMBER,CM%M(ELEMENT_NUMBER,1:NUMBER_OF_ELEMENT_NODES_SPACE),Err)
 692  ENDDO
 693  CALL CMISSMeshElements_CreateFinish(MeshElementsSpace,Err)
 694  !Specify velocity mesh component
 695  IF(BASIS_XI_INTERPOLATION_VELOCITY==BASIS_XI_INTERPOLATION_SPACE) THEN
 696    MeshElementsVelocity=MeshElementsSpace
 697  ELSE
 698    MESH_COMPONENT_NUMBER_VELOCITY=MESH_COMPONENT_NUMBER_SPACE+1
 699    CALL CMISSMeshElements_CreateStart(Mesh,MESH_COMPONENT_NUMBER_VELOCITY,BasisVelocity,MeshElementsVelocity,Err)
 700    DO ELEMENT_NUMBER=1,TOTAL_NUMBER_OF_ELEMENTS
 701      CALL CMISSMeshElements_NodesSet(MeshElementsVelocity,ELEMENT_NUMBER,CM%V(ELEMENT_NUMBER, & 
 702        & 1:NUMBER_OF_ELEMENT_NODES_VELOCITY),Err)
 703    ENDDO
 704    CALL CMISSMeshElements_CreateFinish(MeshElementsVelocity,Err)
 705  ENDIF
 706  !Specify pressure mesh component
 707  IF(BASIS_XI_INTERPOLATION_PRESSURE==BASIS_XI_INTERPOLATION_SPACE) THEN
 708    MeshElementsPressure=MeshElementsSpace
 709    MESH_COMPONENT_NUMBER_PRESSURE=MESH_COMPONENT_NUMBER_SPACE
 710  ELSE IF(BASIS_XI_INTERPOLATION_PRESSURE==BASIS_XI_INTERPOLATION_VELOCITY) THEN
 711    MeshElementsPressure=MeshElementsVelocity
 712    MESH_COMPONENT_NUMBER_PRESSURE=MESH_COMPONENT_NUMBER_VELOCITY
 713  ELSE
 714    MESH_COMPONENT_NUMBER_PRESSURE=MESH_COMPONENT_NUMBER_VELOCITY+1
 715    CALL CMISSMeshElements_CreateStart(Mesh,MESH_COMPONENT_NUMBER_PRESSURE,BasisPressure,MeshElementsPressure,Err)
 716    DO ELEMENT_NUMBER=1,TOTAL_NUMBER_OF_ELEMENTS
 717      CALL CMISSMeshElements_NodesSet(MeshElementsPressure,ELEMENT_NUMBER,CM%P(ELEMENT_NUMBER, & 
 718        & 1:NUMBER_OF_ELEMENT_NODES_PRESSURE),Err)
 719    ENDDO
 720    CALL CMISSMeshElements_CreateFinish(MeshElementsPressure,Err)
 721  ENDIF
 722  !Finish the creation of the mesh
 723  CALL CMISSMesh_CreateFinish(Mesh,Err)
 724
 725  !
 726  !================================================================================================================================
 727  !
 728
 729  !GEOMETRIC FIELD
 730
 731  !Create a decomposition
 732  CALL CMISSDecomposition_Initialise(Decomposition,Err)
 733  CALL CMISSDecomposition_CreateStart(DecompositionUserNumber,Mesh,Decomposition,Err)
 734  !Set the decomposition to be a general decomposition with the specified number of domains
 735  CALL CMISSDecomposition_TypeSet(Decomposition,CMISS_DECOMPOSITION_CALCULATED_TYPE,Err)
 736  CALL CMISSDecomposition_NumberOfDomainsSet(Decomposition,NumberOfComputationalNodes,Err)
 737  !Finish the decomposition
 738  CALL CMISSDecomposition_CreateFinish(Decomposition,Err)
 739
 740  !Start to create a default (geometric) field on the region
 741  CALL CMISSField_Initialise(GeometricField,Err)
 742  CALL CMISSField_CreateStart(GeometricFieldUserNumber,Region,GeometricField,Err)
 743  !Set the field type
 744  CALL CMISSField_TypeSet(GeometricField,CMISS_FIELD_GEOMETRIC_TYPE,Err)
 745  !Set the decomposition to use
 746  CALL CMISSField_MeshDecompositionSet(GeometricField,Decomposition,Err)
 747  !Set the scaling to use
 748  CALL CMISSField_ScalingTypeSet(GeometricField,CMISS_FIELD_NO_SCALING,Err)
 749  !Set the mesh component to be used by the field components.
 750  DO COMPONENT_NUMBER=1,NUMBER_OF_DIMENSIONS
 751    CALL CMISSField_ComponentMeshComponentSet(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,COMPONENT_NUMBER, & 
 752      & MESH_COMPONENT_NUMBER_SPACE,Err)
 753  ENDDO
 754  !Finish creating the field
 755  CALL CMISSField_CreateFinish(GeometricField,Err)
 756  !Update the geometric field parameters
 757  DO NODE_NUMBER=1,NUMBER_OF_NODES_SPACE
 758    DO COMPONENT_NUMBER=1,NUMBER_OF_DIMENSIONS
 759      VALUE=CM%N(NODE_NUMBER,COMPONENT_NUMBER)
 760      CALL CMISSDecomposition_NodeDomainGet(Decomposition,NODE_NUMBER,1,BoundaryNodeDomain,Err)
 761      IF(BoundaryNodeDomain==ComputationalNodeNumber) THEN
 762        CALL CMISSField_ParameterSetUpdateNode(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE, & 
 763          & 1,CMISS_NO_GLOBAL_DERIV,NODE_NUMBER,COMPONENT_NUMBER,VALUE,Err)
 764      ENDIF
 765    ENDDO
 766  ENDDO
 767  CALL CMISSField_ParameterSetUpdateStart(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,Err)
 768  CALL CMISSField_ParameterSetUpdateFinish(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,Err)
 769
 770  !
 771  !================================================================================================================================
 772  !
 773
 774  !EQUATIONS SETS
 775
 776  !Create the equations set for static/dynamic Navier-Stokes
 777  CALL CMISSEquationsSet_Initialise(EquationsSetNavierStokes,Err)
 778  CALL CMISSField_Initialise(EquationsSetFieldNavierStokes,Err)
 779  !Set the equations set to be a static/dynamic Navier-Stokes problem
 780  IF(DYNAMIC_SOLVER_NAVIER_STOKES_FLAG) THEN
 781    IF(ALE_SOLVER_NAVIER_STOKES_FLAG) THEN
 782      CALL CMISSEquationsSet_CreateStart(EquationsSetUserNumberNavierStokes,Region,GeometricField, &
 783        & CMISS_EQUATIONS_SET_FLUID_MECHANICS_CLASS, &
 784        & CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_TYPE,CMISS_EQUATIONS_SET_ALE_NAVIER_STOKES_SUBTYPE, &
 785          & EquationsSetFieldUserNumber, &
 786        & EquationsSetFieldNavierStokes,EquationsSetNavierStokes,Err)
 787    ELSE
 788      CALL CMISSEquationsSet_CreateStart(EquationsSetUserNumberNavierStokes,Region,GeometricField, &
 789        & CMISS_EQUATIONS_SET_FLUID_MECHANICS_CLASS, &
 790        & CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_TYPE,CMISS_EQUATIONS_SET_TRANSIENT_NAVIER_STOKES_SUBTYPE, &
 791          & EquationsSetFieldUserNumber, &
 792        & EquationsSetFieldNavierStokes,EquationsSetNavierStokes,Err)
 793    ENDIF
 794  ELSE
 795    CALL CMISSEquationsSet_CreateStart(EquationsSetUserNumberNavierStokes,Region,GeometricField, &
 796      & CMISS_EQUATIONS_SET_FLUID_MECHANICS_CLASS, &
 797      & CMISS_EQUATIONS_SET_NAVIER_STOKES_EQUATION_TYPE,CMISS_EQUATIONS_SET_STATIC_NAVIER_STOKES_SUBTYPE, &
 798        & EquationsSetFieldUserNumber, &
 799      & EquationsSetFieldNavierStokes,EquationsSetNavierStokes,Err)
 800  ENDIF
 801  !Finish creating the equations set
 802  CALL CMISSEquationsSet_CreateFinish(EquationsSetNavierStokes,Err)
 803
 804  IF(ALE_SOLVER_NAVIER_STOKES_FLAG) THEN
 805    !Create the equations set for moving mesh
 806    CALL CMISSField_Initialise(EquationsSetFieldMovingMesh,Err)
 807    CALL CMISSEquationsSet_Initialise(EquationsSetMovingMesh,Err)
 808    CALL CMISSEquationsSet_CreateStart(EquationsSetUserNumberMovingMesh,Region,GeometricField, &
 809      & CMISS_EQUATIONS_SET_CLASSICAL_FIELD_CLASS, &
 810      & CMISS_EQUATIONS_SET_LAPLACE_EQUATION_TYPE,CMISS_EQUATIONS_SET_MOVING_MESH_LAPLACE_SUBTYPE,&
 811      & EquationsSetFieldUserNumberMovingMesh,EquationsSetFieldMovingMesh,EquationsSetMovingMesh,Err)
 812    !Set the equations set to be a moving mesh problem
 813!     CALL CMISSEquationsSet_SpecificationSet(EquationsSetMovingMesh,CMISS_EQUATIONS_SET_CLASSICAL_FIELD_CLASS, &
 814!        & CMISS_EQUATIONS_SET_LAPLACE_EQUATION_TYPE,CMISS_EQUATIONS_SET_MOVING_MESH_LAPLACE_SUBTYPE,Err)
 815    !Finish creating the equations set
 816    CALL CMISSEquationsSet_CreateFinish(EquationsSetMovingMesh,Err)
 817  ENDIF
 818
 819  !
 820  !================================================================================================================================
 821  !
 822
 823  !DEPENDENT FIELDS
 824
 825  !Create the equations set dependent field variables for static/dynamic Navier-Stokes
 826  CALL CMISSField_Initialise(DependentFieldNavierStokes,Err)
 827  CALL CMISSEquationsSet_DependentCreateStart(EquationsSetNavierStokes,DependentFieldUserNumberNavierStokes, & 
 828    & DependentFieldNavierStokes,Err)
 829  !Set the mesh component to be used by the field components.
 830  DO COMPONENT_NUMBER=1,NUMBER_OF_DIMENSIONS
 831    CALL CMISSField_ComponentMeshComponentSet(DependentFieldNavierStokes,CMISS_FIELD_U_VARIABLE_TYPE,COMPONENT_NUMBER, & 
 832      & MESH_COMPONENT_NUMBER_VELOCITY,Err)
 833    CALL CMISSField_ComponentMeshComponentSet(DependentFieldNavierStokes,CMISS_FIELD_DELUDELN_VARIABLE_TYPE,COMPONENT_NUMBER, & 
 834      & MESH_COMPONENT_NUMBER_VELOCITY,Err)
 835  ENDDO
 836  COMPONENT_NUMBER=NUMBER_OF_DIMENSIONS+1
 837    CALL CMISSField_ComponentMeshComponentSet(DependentFieldNavierStokes,CMISS_FIELD_U_VARIABLE_TYPE,COMPONENT_NUMBER, & 
 838      & MESH_COMPONENT_NUMBER_PRESSURE,Err)
 839    CALL CMISSField_ComponentMeshComponentSet(DependentFieldNavierStokes,CMISS_FIELD_DELUDELN_VARIABLE_TYPE,COMPONENT_NUMBER, & 
 840      & MESH_COMPONENT_NUMBER_PRESSURE,Err)
 841  !Finish the equations set dependent field variables
 842  CALL CMISSEquationsSet_DependentCreateFinish(EquationsSetNavierStokes,Err)
 843
 844  !Initialise dependent field
 845  DO COMPONENT_NUMBER=1,NUMBER_OF_DIMENSIONS
 846    CALL CMISSField_ComponentValuesInitialise(DependentFieldNavierStokes,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE, & 
 847      & COMPONENT_NUMBER,INITIAL_FIELD_NAVIER_STOKES(COMPONENT_NUMBER),Err)
 848  ENDDO
 849
 850  IF(ALE_SOLVER_NAVIER_STOKES_FLAG) THEN
 851    !Create the equations set dependent field variables for moving mesh
 852    CALL CMISSField_Initialise(DependentFieldMovingMesh,Err)
 853    CALL CMISSEquationsSet_DependentCreateStart(EquationsSetMovingMesh,DependentFieldUserNumberMovingMesh, & 
 854      & DependentFieldMovingMesh,Err)
 855    !Set the mesh component to be used by the field components.
 856    DO COMPONENT_NUMBER=1,NUMBER_OF_DIMENSIONS
 857      CALL CMISSField_ComponentMeshComponentSet(DependentFieldMovingMesh,CMISS_FIELD_U_VARIABLE_TYPE,COMPONENT_NUMBER, & 
 858        & MESH_COMPONENT_NUMBER_SPACE,Err)
 859      CALL CMISSField_ComponentMeshComponentSet(DependentFieldMovingMesh,CMISS_FIELD_DELUDELN_VARIABLE_TYPE,COMPONENT_NUMBER, & 
 860        & MESH_COMPONENT_NUMBER_SPACE,Err)
 861    ENDDO
 862    !Finish the equations set dependent field variables
 863    CALL CMISSEquationsSet_DependentCreateFinish(EquationsSetMovingMesh,Err)
 864 
 865    !Initialise dependent field
 866    DO COMPONENT_NUMBER=1,NUMBER_OF_DIMENSIONS
 867      CALL CMISSField_ComponentValuesInitialise(DependentFieldMovingMesh,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE, & 
 868        & COMPONENT_NUMBER,INITIAL_FIELD_MOVING_MESH(COMPONENT_NUMBER),Err)
 869    ENDDO
 870  ENDIF
 871
 872  !
 873  !================================================================================================================================
 874  !
 875
 876  !MATERIALS FIELDS
 877
 878  !Create the equations set materials field variables for static/dynamic Navier-Stokes
 879  CALL CMISSField_Initialise(MaterialsFieldNavierStokes,Err)
 880  CALL CMISSEquationsSet_MaterialsCreateStart(EquationsSetNavierStokes,MaterialsFieldUserNumberNavierStokes, & 
 881    & MaterialsFieldNavierStokes,Err)
 882  !Finish the equations set materials field variables
 883  CALL CMISSEquationsSet_MaterialsCreateFinish(EquationsSetNavierStokes,Err)
 884  CALL CMISSField_ComponentValuesInitialise(MaterialsFieldNavierStokes,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE, & 
 885    & MaterialsFieldUserNumberNavierStokesMu,MU_PARAM_NAVIER_STOKES,Err)
 886  CALL CMISSField_ComponentValuesInitialise(MaterialsFieldNavierStokes,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE, & 
 887    & MaterialsFieldUserNumberNavierStokesRho,RHO_PARAM_NAVIER_STOKES,Err)
 888
 889  IF(ALE_SOLVER_NAVIER_STOKES_FLAG) THEN
 890    !Create the equations set materials field variables for moving mesh
 891    CALL CMISSField_Initialise(MaterialsFieldMovingMesh,Err)
 892    CALL CMISSEquationsSet_MaterialsCreateStart(EquationsSetMovingMesh,MaterialsFieldUserNumberMovingMesh, & 
 893      & MaterialsFieldMovingMesh,Err)
 894    !Finish the equations set materials field variables
 895    CALL CMISSEquationsSet_MaterialsCreateFinish(EquationsSetMovingMesh,Err)
 896    CALL CMISSField_ComponentValuesInitialise(MaterialsFieldMovingMesh,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE, & 
 897      & MaterialsFieldUserNumberMovingMeshK,K_PARAM_MOVING_MESH,Err)
 898  ENDIF
 899
 900  !
 901  !================================================================================================================================
 902  !
 903
 904  !INDEPENDENT FIELDS
 905
 906  IF(ALE_SOLVER_NAVIER_STOKES_FLAG) THEN
 907    !Create the equations set independent field variables for ALE Navier-Stokes
 908    CALL CMISSField_Initialise(IndependentFieldNavierStokes,Err)
 909    CALL CMISSEquationsSet_IndependentCreateStart(EquationsSetNavierStokes,IndependentFieldUserNumberNavierStokes, & 
 910      & IndependentFieldNavierStokes,Err)
 911    !Set the mesh component to be used by the field components.
 912    DO COMPONENT_NUMBER=1,NUMBER_OF_DIMENSIONS
 913      CALL CMISSField_ComponentMeshComponentSet(InDependentFieldNavierStokes,CMISS_FIELD_U_VARIABLE_TYPE,COMPONENT_NUMBER, & 
 914        & MESH_COMPONENT_NUMBER_SPACE,Err)
 915    ENDDO
 916    !Finish the equations set independent field variables
 917    CALL CMISSEquationsSet_IndependentCreateFinish(EquationsSetNavierStokes,Err)
 918    !Create the equations set independent field variables for moving mesh
 919    CALL CMISSField_Initialise(IndependentFieldMovingMesh,Err)
 920    CALL CMISSEquationsSet_IndependentCreateStart(EquationsSetMovingMesh,IndependentFieldUserNumberMovingMesh, & 
 921      & IndependentFieldMovingMesh,Err)
 922    !Set the mesh component to be used by the field components.
 923    DO COMPONENT_NUMBER=1,NUMBER_OF_DIMENSIONS
 924      CALL CMISSField_ComponentMeshComponentSet(InDependentFieldMovingMesh,CMISS_FIELD_U_VARIABLE_TYPE,COMPONENT_NUMBER, & 
 925        & MESH_COMPONENT_NUMBER_SPACE,Err)
 926    ENDDO
 927    !Finish the equations set independent field variables
 928    CALL CMISSEquationsSet_IndependentCreateFinish(EquationsSetMovingMesh,Err)
 929  ENDIF
 930
 931  !
 932  !================================================================================================================================
 933  !
 934
 935  IF(ANALYTIC_FLAG) THEN
 936  !ANALYTIC FIELDS
 937  !Create the equations set analytic field variables for static/dynamic Navier-Stokes
 938    CALL CMISSField_Initialise(AnalyticFieldNavierStokes,Err)
 939    IF(NUMBER_OF_DIMENSIONS==2) THEN  
 940      CALL CMISSEquationsSet_AnalyticCreateStart(EquationsSetNavierStokes,ANALYTIC_TYPE,AnalyticFieldUserNumberNavierStokes, &
 941        & AnalyticFieldNavierStokes,Err)
 942    ELSE
 943      CALL CMISSEquationsSet_AnalyticCreateStart(EquationsSetNavierStokes,ANALYTIC_TYPE,AnalyticFieldUserNumberNavierStokes, &
 944        & AnalyticFieldNavierStokes,Err)
 945    ENDIF
 946    !Finish the equations set analytic field variables
 947    CALL CMISSEquationsSet_AnalyticCreateFinish(EquationsSetNavierStokes,Err)
 948  ENDIF 
 949
 950  !
 951  !================================================================================================================================
 952  !
 953
 954  !EQUATIONS
 955
 956  !Create the equations set equations
 957  CALL CMISSEquations_Initialise(EquationsNavierStokes,Err)
 958  CALL CMISSEquationsSet_EquationsCreateStart(EquationsSetNavierStokes,EquationsNavierStokes,Err)
 959  !Set the equations matrices sparsity type
 960  CALL CMISSEquations_SparsityTypeSet(EquationsNavierStokes,CMISS_EQUATIONS_SPARSE_MATRICES,Err)
 961  IF(DYNAMIC_SOLVER_NAVIER_STOKES_FLAG) THEN
 962    !Set the equations lumping type
 963    CALL CMISSEquations_LumpingTypeSet(EquationsNavierStokes,CMISS_EQUATIONS_UNLUMPED_MATRICES,Err)
 964  ENDIF
 965  !Set the equations set output
 966  CALL CMISSEquations_OutputTypeSet(EquationsNavierStokes,EQUATIONS_NAVIER_STOKES_OUTPUT,Err)
 967  !Finish the equations set equations
 968  CALL CMISSEquationsSet_EquationsCreateFinish(EquationsSetNavierStokes,Err)
 969
 970  IF(ALE_SOLVER_NAVIER_STOKES_FLAG) THEN
 971    !Create the equations set equations
 972    CALL CMISSEquations_Initialise(EquationsMovingMesh,Err)
 973    CALL CMISSEquationsSet_EquationsCreateStart(EquationsSetMovingMesh,EquationsMovingMesh,Err)
 974    !Set the equations matrices sparsity type
 975    CALL CMISSEquations_SparsityTypeSet(EquationsMovingMesh,CMISS_EQUATIONS_SPARSE_MATRICES,Err)
 976    !Set the equations set output
 977    CALL CMISSEquations_OutputTypeSet(EquationsMovingMesh,EQUATIONS_MOVING_MESH_OUTPUT,Err)
 978    !Finish the equations set equations
 979    CALL CMISSEquationsSet_EquationsCreateFinish(EquationsSetMovingMesh,Err)
 980  ENDIF
 981
 982  !
 983  !================================================================================================================================
 984  !
 985
 986  !PROBLEMS
 987
 988  !Start the creation of a problem.
 989  CALL CMISSProblem_Initialise(Problem,Err)
 990  CALL CMISSControlLoop_Initialise(ControlLoop,Err)
 991  CALL CMISSProblem_CreateStart(ProblemUserNumber,Problem,Err)
 992  !Set the problem to be a static/dynamic Navier-Stokes problem
 993  IF(DYNAMIC_SOLVER_NAVIER_STOKES_FLAG) THEN
 994    IF(ALE_SOLVER_NAVIER_STOKES_FLAG) THEN
 995      CALL CMISSProblem_SpecificationSet(Problem,CMISS_PROBLEM_FLUID_MECHANICS_CLASS,CMISS_PROBLEM_NAVIER_STOKES_EQUATION_TYPE, &
 996        & CMISS_PROBLEM_ALE_NAVIER_STOKES_SUBTYPE,Err)
 997    ELSE  
 998      CALL CMISSProblem_SpecificationSet(Problem,CMISS_PROBLEM_FLUID_MECHANICS_CLASS,CMISS_PROBLEM_NAVIER_STOKES_EQUATION_TYPE, &
 999        & CMISS_PROBLEM_TRANSIENT_NAVIER_STOKES_SUBTYPE,Err)
1000    ENDIF
1001  ELSE
1002    CALL CMISSProblem_SpecificationSet(Problem,CMISS_PROBLEM_FLUID_MECHANICS_CLASS,CMISS_PROBLEM_NAVIER_STOKES_EQUATION_TYPE, &
1003      & CMISS_PROBLEM_STATIC_NAVIER_STOKES_SUBTYPE,Err)
1004  ENDIF
1005  !Finish the creation of a problem.
1006  CALL CMISSProblem_CreateFinish(Problem,Err)
1007
1008  !Start the creation of the problem control loop
1009  CALL CMISSProblem_ControlLoopCreateStart(Problem,Err)
1010  IF(DYNAMIC_SOLVER_NAVIER_STOKES_FLAG) THEN
1011    !Get the control loop
1012    CALL CMISSProblem_ControlLoopGet(Problem,CMISS_CONTROL_LOOP_NODE,ControlLoop,Err)
1013   !Set the times
1014    CALL CMISSControlLoop_TimesSet(ControlLoop,DYNAMIC_SOLVER_NAVIER_STOKES_START_TIME,DYNAMIC_SOLVER_NAVIER_STOKES_STOP_TIME, & 
1015      & DYNAMIC_SOLVER_NAVIER_STOKES_TIME_INCREMENT,Err)
1016    !Set the output timing
1017    CALL CMISSControlLoop_TimeOutputSet(ControlLoop,DYNAMIC_SOLVER_NAVIER_STOKES_OUTPUT_FREQUENCY,Err)
1018    IF(ALE_SOLVER_NAVIER_STOKES_FLAG) THEN
1019      CALL CMISSControlLoop_TimeInputSet(ControlLoop,DYNAMIC_SOLVER_NAVIER_STOKES_INPUT_OPTION,Err)
1020    ENDIF
1021  ENDIF
1022  !Finish creating the problem control loop
1023  CALL CMISSProblem_ControlLoopCreateFinish(Problem,Err)
1024
1025
1026  !
1027  !================================================================================================================================
1028  !
1029
1030  !SOLVERS
1031
1032  !Start the creation of the problem solvers
1033  CALL CMISSSolver_Initialise(LinearSolverMovingMesh,Err)
1034  CALL CMISSSolver_Initialise(DynamicSolverNavierStokes,Err)
1035  CALL CMISSSolver_Initialise(NonlinearSolverNavierStokes,Err)
1036  CALL CMISSSolver_Initialise(LinearSolverNavierStokes,Err)
1037  CALL CMISSProblem_SolversCreateStart(Problem,Err)
1038  IF(ALE_SOLVER_NAVIER_STOKES_FLAG) THEN
1039    !Get the moving mesh solver
1040    CALL CMISSProblem_SolverGet(Problem,CMISS_CONTROL_LOOP_NODE,SolverMovingMeshUserNumber,LinearSolverMovingMesh,Err)
1041    !Set the output type
1042    !CALL CMISSSolver_OutputTypeSet(LinearSolverMovingMesh,LINEAR_SOLVER_MOVING_MESH_OUTPUT_TYPE,Err)
1043    CALL CMISSSolver_OutputTypeSet(LinearSolverMovingMesh,4,Err)
1044    !Set the solver settings
1045    IF(LINEAR_SOLVER_MOVING_MESH_DIRECT_FLAG) THEN
1046      CALL CMISSSolver_LinearTypeSet(LinearSolverMovingMesh,CMISS_SOLVER_LINEAR_DIRECT_SOLVE_TYPE,Err)
1047      CALL CMISSSolver_LibraryTypeSet(LinearSolverMovingMesh,CMISS_SOLVER_MUMPS_LIBRARY,Err)
1048    ELSE
1049      CALL CMISSSolver_LinearTypeSet(LinearSolverMovingMesh,CMISS_SOLVER_LINEAR_ITERATIVE_SOLVE_TYPE,Err)
1050      CALL CMISSSolver_LinearIterativeMaximumIterationsSet(LinearSolverMovingMesh,MAXIMUM_ITERATIONS,Err)
1051      CALL CMISSSolver_LinearIterativeDivergenceToleranceSet(LinearSolverMovingMesh,DIVERGENCE_TOLERANCE,Err)
1052      CALL CMISSSolver_LinearIterativeRelativeToleranceSet(LinearSolverMovingMesh,RELATIVE_TOLERANCE,Err)
1053      CALL CMISSSolver_LinearIterativeAbsoluteToleranceSet(LinearSolverMovingMesh,ABSOLUTE_TOLERANCE,Err)
1054      CALL CMISSSolver_LinearIterativeGMRESRestartSet(LinearSolverMovingMesh,RESTART_VALUE,Err)
1055    ENDIF
1056  ENDIF
1057
1058  IF(DYNAMIC_SOLVER_NAVIER_ST

Large files files are truncated, but you can click here to view the full file