PageRenderTime 153ms CodeModel.GetById 23ms app.highlight 121ms RepoModel.GetById 1ms app.codeStats 1ms

/InterfaceExamples/InputCoupledStokes/src/InputCoupledStokesExample.f90

http://github.com/xyan075/examples
FORTRAN Modern | 1366 lines | 865 code | 162 blank | 339 comment | 68 complexity | 672b61fc9974c31b892d000d56f21b13 MD5 | raw file

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

   1!> \file
   2!> \author Chris Bradley
   3!> \brief This is an example program which solves a weakly coupled Stokes equation in two regions 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 InterfaceExamples/CoupledStokes/src/CoupledStoesExample.f90
  43!! Example program which sets up a field in two regions using OpenCMISS calls.
  44!! \par Latest Builds:
  45!! \li <a href='http://autotest.bioeng.auckland.ac.nz/opencmiss-build/logs_x86_64-linux/InterfaceExamples/CoupledStokes/build-intel'>Linux Intel Build</a>
  46!! \li <a href='http://autotest.bioeng.auckland.ac.nz/opencmiss-build/logs_x86_64-linux/InterfaceExamples/CoupledStokes/build-gnu'>Linux GNU Build</a>
  47!<
  48
  49!> Main program
  50PROGRAM COUPLEDSTOKES
  51
  52  USE OPENCMISS
  53  USE FLUID_MECHANICS_IO_ROUTINES
  54  
  55#ifdef WIN32
  56  USE IFQWIN
  57#endif
  58
  59  IMPLICIT NONE
  60
  61  !Test program parameters
  62
  63  INTEGER(CMISSIntg), PARAMETER :: CoordinateSystem1UserNumber=1
  64  INTEGER(CMISSIntg), PARAMETER :: CoordinateSystem2UserNumber=2
  65  INTEGER(CMISSIntg), PARAMETER :: Region1UserNumber=3
  66  INTEGER(CMISSIntg), PARAMETER :: Region2UserNumber=4
  67  INTEGER(CMISSIntg), PARAMETER :: Basis1UserNumber=5
  68  INTEGER(CMISSIntg), PARAMETER :: Basis2UserNumber=6
  69  INTEGER(CMISSIntg), PARAMETER :: InterfaceBasisUserNumber=7
  70  INTEGER(CMISSIntg), PARAMETER :: InterfaceGeneratedMeshUserNumber=10
  71  INTEGER(CMISSIntg), PARAMETER :: Mesh1UserNumber=11
  72  INTEGER(CMISSIntg), PARAMETER :: Mesh2UserNumber=12
  73  INTEGER(CMISSIntg), PARAMETER :: InterfaceMeshUserNumber=13
  74  INTEGER(CMISSIntg), PARAMETER :: Decomposition1UserNumber=14
  75  INTEGER(CMISSIntg), PARAMETER :: Decomposition2UserNumber=15
  76  INTEGER(CMISSIntg), PARAMETER :: InterfaceDecompositionUserNumber=16
  77  INTEGER(CMISSIntg), PARAMETER :: GeometricField1UserNumber=17
  78  INTEGER(CMISSIntg), PARAMETER :: GeometricField2UserNumber=18
  79  INTEGER(CMISSIntg), PARAMETER :: InterfaceGeometricFieldUserNumber=19
  80  INTEGER(CMISSIntg), PARAMETER :: EquationsSet1UserNumber=20
  81  INTEGER(CMISSIntg), PARAMETER :: EquationsSet2UserNumber=21
  82  INTEGER(CMISSIntg), PARAMETER :: DependentField1UserNumber=22
  83  INTEGER(CMISSIntg), PARAMETER :: DependentField2UserNumber=23
  84  INTEGER(CMISSIntg), PARAMETER :: InterfaceUserNumber=24
  85  INTEGER(CMISSIntg), PARAMETER :: InterfaceConditionUserNumber=25
  86  INTEGER(CMISSIntg), PARAMETER :: LagrangeFieldUserNumber=26
  87  INTEGER(CMISSIntg), PARAMETER :: CoupledProblemUserNumber=27
  88  INTEGER(CMISSIntg), PARAMETER :: InterfaceMappingBasisUserNumber=28
  89  INTEGER(CMISSIntg), PARAMETER :: EquationsSetField1UserNumber=40
  90  INTEGER(CMISSIntg), PARAMETER :: EquationsSetField2UserNumber=41
  91
  92  INTEGER(CMISSIntg), PARAMETER :: MaterialsComponentUserNumber1=1 !MU
  93  INTEGER(CMISSIntg), PARAMETER :: MaterialsComponentUserNumber2=2 !RHO
  94 
  95  !Program types
  96
  97  TYPE(EXPORT_CONTAINER):: CM1,CM2,CM3
  98  TYPE(COUPLING_PARAMETERS):: CMX
  99  TYPE(BOUNDARY_PARAMETERS):: BC
 100  
 101  !Program variables
 102  INTEGER(CMISSIntg) :: EquationsSet1Index,EquationsSet2Index
 103  INTEGER(CMISSIntg) :: BoundaryNodeDomain
 104  INTEGER(CMISSIntg) :: InterfaceConditionIndex
 105  INTEGER(CMISSIntg) :: Mesh1Index,Mesh2Index
 106  INTEGER(CMISSIntg) :: NumberOfComputationalNodes,ComputationalNodeNumber,ic_idx
 107  REAL(CMISSDP) :: VALUE
 108
 109  INTEGER(CMISSIntg) :: NUMBER_OF_DIMENSIONS1,NUMBER_OF_DIMENSIONS2,NUMBER_OF_DIMENSIONS_INTERFACE
 110  
 111  INTEGER(CMISSIntg) :: BASIS_TYPE1,BASIS_TYPE2,BASIS_TYPE_INTERFACE
 112  INTEGER(CMISSIntg) :: BASIS_NUMBER_SPACE1,BASIS_NUMBER_SPACE2,BASIS_NUMBER_SPACE_INTERFACE
 113  INTEGER(CMISSIntg) :: BASIS_NUMBER_VELOCITY1,BASIS_NUMBER_VELOCITY2
 114  INTEGER(CMISSIntg) :: BASIS_NUMBER_PRESSURE1,BASIS_NUMBER_PRESSURE2
 115  INTEGER(CMISSIntg) :: BASIS_XI_GAUSS_SPACE1,BASIS_XI_GAUSS_SPACE2,BASIS_XI_GAUSS_INTERFACE
 116  INTEGER(CMISSIntg) :: BASIS_XI_GAUSS_VELOCITY1,BASIS_XI_GAUSS_VELOCITY2
 117  INTEGER(CMISSIntg) :: BASIS_XI_GAUSS_PRESSURE1,BASIS_XI_GAUSS_PRESSURE2
 118  INTEGER(CMISSIntg) :: BASIS_XI_INTERPOLATION_SPACE1,BASIS_XI_INTERPOLATION_SPACE2,BASIS_XI_INTERPOLATION_INTERFACE
 119  INTEGER(CMISSIntg) :: BASIS_XI_INTERPOLATION_VELOCITY1,BASIS_XI_INTERPOLATION_VELOCITY2
 120  INTEGER(CMISSIntg) :: BASIS_XI_INTERPOLATION_PRESSURE1,BASIS_XI_INTERPOLATION_PRESSURE2
 121  INTEGER(CMISSIntg) :: MESH_NUMBER_OF_COMPONENTS1,MESH_NUMBER_OF_COMPONENTS2,MESH_NUMBER_OF_COMPONENTS_INTERFACE
 122  INTEGER(CMISSIntg) :: MESH_COMPONENT_NUMBER_SPACE1,MESH_COMPONENT_NUMBER_SPACE2,MESH_COMPONENT_NUMBER_INTERFACE
 123  INTEGER(CMISSIntg) :: MESH_COMPONENT_NUMBER_VELOCITY1,MESH_COMPONENT_NUMBER_VELOCITY2
 124  INTEGER(CMISSIntg) :: MESH_COMPONENT_NUMBER_PRESSURE1,MESH_COMPONENT_NUMBER_PRESSURE2
 125  INTEGER(CMISSIntg) :: NUMBER_OF_NODES_SPACE1,NUMBER_OF_NODES_SPACE2,NUMBER_OF_NODES_INTERFACE
 126  INTEGER(CMISSIntg) :: NUMBER_OF_NODES_VELOCITY1,NUMBER_OF_NODES_VELOCITY2
 127  INTEGER(CMISSIntg) :: NUMBER_OF_NODES_PRESSURE1,NUMBER_OF_NODES_PRESSURE2
 128  INTEGER(CMISSIntg) :: NUMBER_OF_ELEMENT_NODES_SPACE1,NUMBER_OF_ELEMENT_NODES_SPACE2,NUMBER_OF_ELEMENT_NODES_INTERFACE
 129  INTEGER(CMISSIntg) :: NUMBER_OF_ELEMENT_NODES_VELOCITY1,NUMBER_OF_ELEMENT_NODES_VELOCITY2
 130  INTEGER(CMISSIntg) :: NUMBER_OF_ELEMENT_NODES_PRESSURE1,NUMBER_OF_ELEMENT_NODES_PRESSURE2
 131  INTEGER(CMISSIntg) :: TOTAL_NUMBER_OF_NODES1,TOTAL_NUMBER_OF_NODES2,TOTAL_NUMBER_OF_NODES_INTERFACE
 132  INTEGER(CMISSIntg) :: TOTAL_NUMBER_OF_ELEMENTS1,TOTAL_NUMBER_OF_ELEMENTS2,TOTAL_NUMBER_OF_ELEMENTS_INTERFACE
 133  INTEGER(CMISSIntg) :: ELEMENT_NUMBER,COMPONENT_NUMBER,NODE_NUMBER,NODE_COUNTER,CONDITION
 134  INTEGER(CMISSIntg) :: NUMBER_OF_FIXED_WALL_NODES1,NUMBER_OF_FIXED_WALL_NODES2
 135  INTEGER(CMISSIntg) :: NUMBER_OF_INLET_WALL_NODES1,NUMBER_OF_INLET_WALL_NODES2
 136
 137  INTEGER, ALLOCATABLE, DIMENSION(:):: FIXED_WALL_NODES1
 138  INTEGER, ALLOCATABLE, DIMENSION(:):: INLET_WALL_NODES1
 139  REAL(CMISSDP) :: BOUNDARY_CONDITIONS1(3)
 140  LOGICAL :: FIXED_WALL_NODES1_FLAG=.TRUE.
 141  LOGICAL :: INLET_WALL_NODES1_FLAG=.TRUE.
 142
 143  INTEGER, ALLOCATABLE, DIMENSION(:):: FIXED_WALL_NODES2
 144  INTEGER, ALLOCATABLE, DIMENSION(:):: INLET_WALL_NODES2
 145  REAL(CMISSDP) :: BOUNDARY_CONDITIONS2(3)
 146  LOGICAL :: FIXED_WALL_NODES2_FLAG=.TRUE.
 147  LOGICAL :: INLET_WALL_NODES2_FLAG=.TRUE.
 148
 149
 150  REAL(CMISSDP) :: RHO_PARAM=1.0_CMISSDP
 151  REAL(CMISSDP) :: MU_PARAM=1.0_CMISSDP
 152
 153  !CMISS variables
 154
 155  TYPE(CMISSBasisType) :: BasisSpace1,BasisSpace2
 156  TYPE(CMISSBasisType) :: BasisVelocity1,BasisVelocity2
 157  TYPE(CMISSBasisType) :: BasisPressure1,BasisPressure2
 158  TYPE(CMISSBasisType) :: InterfaceBasis,InterfaceMappingBasis
 159  TYPE(CMISSBoundaryConditionsType) :: BoundaryConditions
 160  TYPE(CMISSCoordinateSystemType) :: CoordinateSystem1,CoordinateSystem2,WorldCoordinateSystem
 161  TYPE(CMISSDecompositionType) :: Decomposition1,Decomposition2,InterfaceDecomposition
 162  TYPE(CMISSEquationsType) :: Equations1,Equations2
 163  TYPE(CMISSEquationsSetType) :: EquationsSet1,EquationsSet2
 164  TYPE(CMISSFieldType) :: GeometricField1,GeometricField2
 165  TYPE(CMISSFieldType) :: InterfaceGeometricField,LagrangeField
 166  TYPE(CMISSFieldType) :: DependentField1,DependentField2
 167  TYPE(CMISSFieldType) :: EquationsSetField1,EquationsSetField2
 168  TYPE(CMISSFieldType) :: MaterialsField1,MaterialsField2
 169
 170  TYPE(CMISSFieldsType) :: Fields1,Fields2,InterfaceFields
 171  TYPE(CMISSInterfaceType) :: Interface
 172  TYPE(CMISSInterfaceConditionType) :: InterfaceCondition
 173  TYPE(CMISSInterfaceEquationsType) :: InterfaceEquations
 174  TYPE(CMISSInterfaceMeshConnectivityType) :: InterfaceMeshConnectivity
 175  !Nodes
 176  TYPE(CMISSNodesType) :: Nodes1
 177  TYPE(CMISSNodesType) :: Nodes2
 178  TYPE(CMISSNodesType) :: InterfaceNodes
 179  !Elements
 180  TYPE(CMISSMeshElementsType) :: MeshElementsSpace1,MeshElementsVelocity1,MeshElementsPressure1
 181  TYPE(CMISSMeshElementsType) :: MeshElementsSpace2,MeshElementsVelocity2,MeshElementsPressure2
 182  TYPE(CMISSMeshElementsType) :: InterfaceMeshElements
 183  TYPE(CMISSMeshType) :: Mesh1,Mesh2,InterfaceMesh
 184  TYPE(CMISSProblemType) :: CoupledProblem
 185  TYPE(CMISSRegionType) :: Region1,Region2,WorldRegion
 186  TYPE(CMISSSolverType) :: CoupledSolver
 187  TYPE(CMISSSolverEquationsType) :: CoupledSolverEquations
 188  
 189#ifdef WIN32
 190  !Quickwin type
 191  LOGICAL :: QUICKWIN_STATUS=.FALSE.
 192  TYPE(WINDOWCONFIG) :: QUICKWIN_WINDOW_CONFIG
 193#endif
 194  
 195  !Generic CMISS variables
 196  
 197  INTEGER(CMISSIntg) :: Err
 198  
 199#ifdef WIN32
 200  !Initialise QuickWin
 201  QUICKWIN_WINDOW_CONFIG%TITLE="General Output" !Window title
 202  QUICKWIN_WINDOW_CONFIG%NUMTEXTROWS=-1 !Max possible number of rows
 203  QUICKWIN_WINDOW_CONFIG%MODE=QWIN$SCROLLDOWN
 204  !Set the window parameters
 205  QUICKWIN_STATUS=SETWINDOWCONFIG(QUICKWIN_WINDOW_CONFIG)
 206  !If attempt fails set with system estimated values
 207  IF(.NOT.QUICKWIN_STATUS) QUICKWIN_STATUS=SETWINDOWCONFIG(QUICKWIN_WINDOW_CONFIG)
 208#endif
 209
 210  !
 211  !================================================================================================================================
 212  !
 213
 214  !INITIALISE OPENCMISS
 215
 216
 217  !Intialise OpenCMISS
 218  CALL CMISSInitialise(WorldCoordinateSystem,WorldRegion,Err)
 219
 220  !Set error handling mode
 221  CALL CMISSErrorHandlingModeSet(CMISS_ERRORS_TRAP_ERROR,Err)
 222 
 223  !Set diganostics for testing
 224  !CALL CMISSDiagnosticsSetOn(CMISS_FROM_DIAG_TYPE,[1,2,3,4,5],"Diagnostics",["SOLVER_MAPPING_CALCULATE         ", &
 225  !  & "SOLVER_MATRIX_STRUCTURE_CALCULATE"],Err)
 226  
 227  !
 228  !================================================================================================================================
 229  !
 230
 231  !CHECK COMPUTATIONAL NODE
 232
 233  !Get the computational nodes information
 234  CALL CMISSComputationalNumberOfNodesGet(NumberOfComputationalNodes,Err)
 235  CALL CMISSComputationalNodeNumberGet(ComputationalNodeNumber,Err)
 236
 237  !
 238  !================================================================================================================================
 239  !
 240
 241  !PROBLEM CONTROL PANEL
 242
 243  !Import cmHeart mesh information
 244  CALL FLUID_MECHANICS_IO_READ_CMHEART(CM1,CM2,CM3,CMX,BC,Err)
 245
 246  !Information for mesh 1
 247  BASIS_NUMBER_SPACE1=CM1%ID_M
 248  BASIS_NUMBER_VELOCITY1=CM1%ID_V
 249  BASIS_NUMBER_PRESSURE1=CM1%ID_P
 250  NUMBER_OF_DIMENSIONS1=CM1%D
 251  BASIS_TYPE1=CM1%IT_T
 252  BASIS_XI_INTERPOLATION_SPACE1=CM1%IT_M
 253  BASIS_XI_INTERPOLATION_VELOCITY1=CM1%IT_V
 254  BASIS_XI_INTERPOLATION_PRESSURE1=CM1%IT_P
 255  NUMBER_OF_NODES_SPACE1=CM1%N_M
 256  NUMBER_OF_NODES_VELOCITY1=CM1%N_V
 257  NUMBER_OF_NODES_PRESSURE1=CM1%N_P
 258  TOTAL_NUMBER_OF_NODES1=CM1%N_T
 259  TOTAL_NUMBER_OF_ELEMENTS1=CM1%E_T
 260  NUMBER_OF_ELEMENT_NODES_SPACE1=CM1%EN_M
 261  NUMBER_OF_ELEMENT_NODES_VELOCITY1=CM1%EN_V
 262  NUMBER_OF_ELEMENT_NODES_PRESSURE1=CM1%EN_P
 263  !Information for mesh 2
 264  BASIS_NUMBER_SPACE2=CM2%ID_M+10
 265  BASIS_NUMBER_VELOCITY2=CM2%ID_V+10
 266  BASIS_NUMBER_PRESSURE2=CM2%ID_P+10
 267  NUMBER_OF_DIMENSIONS2=CM2%D
 268  BASIS_TYPE2=CM2%IT_T
 269  BASIS_XI_INTERPOLATION_SPACE2=CM2%IT_M
 270  BASIS_XI_INTERPOLATION_VELOCITY2=CM2%IT_V
 271  BASIS_XI_INTERPOLATION_PRESSURE2=CM2%IT_P
 272  NUMBER_OF_NODES_SPACE2=CM2%N_M
 273  NUMBER_OF_NODES_VELOCITY2=CM2%N_V
 274  NUMBER_OF_NODES_PRESSURE2=CM2%N_P
 275  TOTAL_NUMBER_OF_NODES2=CM2%N_T
 276  TOTAL_NUMBER_OF_ELEMENTS2=CM2%E_T
 277  NUMBER_OF_ELEMENT_NODES_SPACE2=CM2%EN_M
 278  NUMBER_OF_ELEMENT_NODES_VELOCITY2=CM2%EN_V
 279  NUMBER_OF_ELEMENT_NODES_PRESSURE2=CM2%EN_P
 280  !Set interpolation parameters
 281  BASIS_XI_GAUSS_SPACE1=3
 282  BASIS_XI_GAUSS_VELOCITY1=3
 283  BASIS_XI_GAUSS_PRESSURE1=3
 284  BASIS_XI_GAUSS_SPACE2=3
 285  BASIS_XI_GAUSS_VELOCITY2=3
 286  BASIS_XI_GAUSS_PRESSURE2=3
 287  BASIS_NUMBER_SPACE_INTERFACE=CM3%ID_M
 288  NUMBER_OF_DIMENSIONS_INTERFACE=CM3%D
 289  BASIS_TYPE_INTERFACE=CM3%IT_T
 290  BASIS_XI_INTERPOLATION_INTERFACE=CM3%IT_M
 291  BASIS_XI_INTERPOLATION_VELOCITY2=CM2%IT_V
 292  BASIS_XI_INTERPOLATION_PRESSURE2=CM2%IT_P
 293  NUMBER_OF_NODES_INTERFACE=CM3%N_M
 294  NUMBER_OF_NODES_VELOCITY2=CM2%N_V
 295  NUMBER_OF_NODES_PRESSURE2=CM2%N_P
 296  TOTAL_NUMBER_OF_NODES_INTERFACE=CM3%N_T
 297  TOTAL_NUMBER_OF_ELEMENTS_INTERFACE=CM3%E_T
 298  NUMBER_OF_ELEMENT_NODES_INTERFACE=CM3%EN_M
 299  NUMBER_OF_ELEMENT_NODES_VELOCITY2=CM2%EN_V
 300  NUMBER_OF_ELEMENT_NODES_PRESSURE2=CM2%EN_P
 301  !Set interpolation parameters
 302  BASIS_XI_GAUSS_INTERFACE=3
 303  BASIS_XI_GAUSS_VELOCITY1=3
 304  BASIS_XI_GAUSS_PRESSURE1=3
 305  BASIS_XI_GAUSS_INTERFACE=3
 306  BASIS_XI_GAUSS_VELOCITY2=3
 307  BASIS_XI_GAUSS_PRESSURE2=3
 308
 309  IF(FIXED_WALL_NODES1_FLAG) THEN
 310    NUMBER_OF_FIXED_WALL_NODES1=80
 311    ALLOCATE(FIXED_WALL_NODES1(NUMBER_OF_FIXED_WALL_NODES1))
 312    FIXED_WALL_NODES1=(/1,2,3,4,5,7,9,10,11,12,13,14,17,20,24,28,29,30,31,32,33,34,35,37,39, & 
 313    & 41,44,46,47,48,50,51,52,53,54,57,60,64,65,66,67,68,70,72,74,76,77,78,79,80,83,86, & 
 314    & 89,90,91,92,93,94,95,97,99,101,102,103,104,105,106,107,108,111,114,115,116,117,118, & 
 315    & 120,122,123,124,125/)
 316  ENDIF
 317  IF(INLET_WALL_NODES1_FLAG) THEN
 318    NUMBER_OF_INLET_WALL_NODES1=9
 319    ALLOCATE(INLET_WALL_NODES1(NUMBER_OF_INLET_WALL_NODES1))
 320    INLET_WALL_NODES1=(/67,74,76,79,87,88,102,103,113/)
 321    !Set initial boundary conditions
 322    BOUNDARY_CONDITIONS1(1)=1.0_CMISSDP
 323    BOUNDARY_CONDITIONS1(2)=0.0_CMISSDP
 324    BOUNDARY_CONDITIONS1(3)=0.0_CMISSDP
 325  ENDIF
 326  IF(FIXED_WALL_NODES2_FLAG) THEN
 327    NUMBER_OF_FIXED_WALL_NODES2=80
 328    ALLOCATE(FIXED_WALL_NODES2(NUMBER_OF_FIXED_WALL_NODES2))
 329    FIXED_WALL_NODES2=(/1,2,3,4,5,7,9,10,11,12,13,14,17,20,24,28,29,30,31,32,33,34,35,37,39, & 
 330    & 41,44,46,47,48,50,51,52,53,54,57,60,64,65,66,67,68,70,72,74,76,77,78,79,80,83,86, & 
 331    & 89,90,91,92,93,94,95,97,99,101,102,103,104,105,106,107,108,111,114,115,116,117,118, & 
 332    & 120,122,123,124,125/)
 333  ENDIF
 334  IF(INLET_WALL_NODES2_FLAG) THEN
 335    NUMBER_OF_INLET_WALL_NODES2=9
 336    ALLOCATE(INLET_WALL_NODES2(NUMBER_OF_INLET_WALL_NODES1))
 337    INLET_WALL_NODES2=(/67,74,76,79,87,88,102,103,113/)
 338    !Set initial boundary conditions
 339    BOUNDARY_CONDITIONS2(1)=1.0_CMISSDP
 340    BOUNDARY_CONDITIONS2(2)=0.0_CMISSDP
 341    BOUNDARY_CONDITIONS2(3)=0.0_CMISSDP
 342  ENDIF
 343
 344
 345
 346  !
 347  !================================================================================================================================
 348  !
 349
 350  !COORDINATE SYSTEM
 351
 352  
 353  !Start the creation of a new RC coordinate system for the first region
 354  PRINT *, ' == >> CREATING COORDINATE SYSTEM(1) << == '
 355  CALL CMISSCoordinateSystem_Initialise(CoordinateSystem1,Err)
 356  CALL CMISSCoordinateSystem_CreateStart(CoordinateSystem1UserNumber,CoordinateSystem1,Err)
 357  !Set the coordinate system dimension
 358  CALL CMISSCoordinateSystem_DimensionSet(CoordinateSystem1,NUMBER_OF_DIMENSIONS1,Err)
 359  !Finish the creation of the coordinate system
 360  CALL CMISSCoordinateSystem_CreateFinish(CoordinateSystem1,Err)
 361
 362  !Start the creation of a new RC coordinate system for the second region
 363  PRINT *, ' == >> CREATING COORDINATE SYSTEM(2) << == '
 364  CALL CMISSCoordinateSystem_Initialise(CoordinateSystem2,Err)
 365  CALL CMISSCoordinateSystem_CreateStart(CoordinateSystem2UserNumber,CoordinateSystem2,Err)
 366  !Set the coordinate system dimension
 367  CALL CMISSCoordinateSystem_DimensionSet(CoordinateSystem2,NUMBER_OF_DIMENSIONS2,Err)
 368  !Finish the creation of the coordinate system
 369  CALL CMISSCoordinateSystem_CreateFinish(CoordinateSystem2,Err)
 370
 371  !
 372  !================================================================================================================================
 373  !
 374
 375  !REGION
 376  
 377  !Start the creation of the first region
 378  PRINT *, ' == >> CREATING REGION(1) << == '
 379  CALL CMISSRegion_Initialise(Region1,Err)
 380  CALL CMISSRegion_CreateStart(Region1UserNumber,WorldRegion,Region1,Err)
 381  CALL CMISSRegion_LabelSet(Region1,"Region1",Err)
 382  !Set the regions coordinate system as defined above
 383  CALL CMISSRegion_CoordinateSystemSet(Region1,CoordinateSystem1,Err)
 384  !Finish the creation of the region
 385  CALL CMISSRegion_CreateFinish(Region1,Err)
 386
 387  !Start the creation of the second region
 388  PRINT *, ' == >> CREATING REGION(2) << == '
 389  CALL CMISSRegion_Initialise(Region2,Err)
 390  CALL CMISSRegion_CreateStart(Region2UserNumber,WorldRegion,Region2,Err)
 391  CALL CMISSRegion_LabelSet(Region2,"Region2",Err)
 392  !Set the regions coordinate system as defined above
 393  CALL CMISSRegion_CoordinateSystemSet(Region2,CoordinateSystem2,Err)
 394  !Finish the creation of the region
 395  CALL CMISSRegion_CreateFinish(Region2,Err)
 396
 397  !
 398  !================================================================================================================================
 399  !
 400
 401  !BASES
 402
 403
 404  !Start the creation of a bI/tri-linear-Lagrange basis
 405  PRINT *, ' == >> CREATING BASIS(1) << == '
 406  !Start the creation of new bases
 407  MESH_NUMBER_OF_COMPONENTS1=1
 408  CALL CMISSBasis_Initialise(BasisSpace1,Err)
 409  CALL CMISSBasis_CreateStart(BASIS_NUMBER_SPACE1,BasisSpace1,Err)
 410  !Set the basis type (Lagrange/Simplex)
 411  CALL CMISSBasis_TypeSet(BasisSpace1,BASIS_TYPE1,Err)
 412  !Set the basis xi number
 413  CALL CMISSBasis_NumberOfXiSet(BasisSpace1,NUMBER_OF_DIMENSIONS1,Err)
 414  !Set the basis xi interpolation and number of Gauss points
 415  IF(NUMBER_OF_DIMENSIONS1==2.AND.NUMBER_OF_DIMENSIONS2==2) THEN
 416    CALL CMISSBasis_InterpolationXiSet(BasisSpace1,(/BASIS_XI_INTERPOLATION_SPACE1,BASIS_XI_INTERPOLATION_SPACE1/),Err)
 417    IF(BASIS_TYPE1/=CMISS_BASIS_SIMPLEX_TYPE) THEN
 418      CALL CMISSBasis_QuadratureNumberOfGaussXiSet(BasisSpace1,(/BASIS_XI_GAUSS_SPACE1,BASIS_XI_GAUSS_SPACE1/),Err)
 419    ELSE
 420      CALL CMISSBasis_QuadratureOrderSet(BasisSpace1,BASIS_XI_GAUSS_SPACE1+1,Err)
 421    ENDIF
 422  ELSE IF(NUMBER_OF_DIMENSIONS1==3.AND.NUMBER_OF_DIMENSIONS2==3) THEN
 423    CALL CMISSBasis_InterpolationXiSet(BasisSpace1,(/BASIS_XI_INTERPOLATION_SPACE1,BASIS_XI_INTERPOLATION_SPACE1, & 
 424      & BASIS_XI_INTERPOLATION_SPACE1/),Err)                         
 425    IF(BASIS_TYPE1/=CMISS_BASIS_SIMPLEX_TYPE) THEN
 426      CALL CMISSBasis_QuadratureNumberOfGaussXiSet(BasisSpace1,(/BASIS_XI_GAUSS_SPACE1,BASIS_XI_GAUSS_SPACE1, &
 427        & BASIS_XI_GAUSS_SPACE1/),Err)
 428    ELSE
 429      CALL CMISSBasis_QuadratureOrderSet(BasisSpace1,BASIS_XI_GAUSS_SPACE1+1,Err)
 430    ENDIF
 431  ELSE
 432    CALL HANDLE_ERROR("Dimension coupling error.")
 433  ENDIF
 434  !Finish the creation of the basis
 435  CALL CMISSBasis_CreateFinish(BasisSpace1,Err)
 436  !Start the creation of another basis
 437  IF(BASIS_XI_INTERPOLATION_VELOCITY1==BASIS_XI_INTERPOLATION_SPACE1) THEN
 438    BasisVelocity1=BasisSpace1
 439  ELSE
 440    MESH_NUMBER_OF_COMPONENTS1=MESH_NUMBER_OF_COMPONENTS1+1
 441    !Initialise a new velocity basis
 442    CALL CMISSBasis_Initialise(BasisVelocity1,Err)
 443    !Start the creation of a basis
 444    CALL CMISSBasis_CreateStart(BASIS_NUMBER_VELOCITY1,BasisVelocity1,Err)
 445    !Set the basis type (Lagrange/Simplex)
 446    CALL CMISSBasis_TypeSet(BasisVelocity1,BASIS_TYPE1,Err)
 447    !Set the basis xi number
 448    CALL CMISSBasis_NumberOfXiSet(BasisVelocity1,NUMBER_OF_DIMENSIONS1,Err)
 449    !Set the basis xi interpolation and number of Gauss points
 450    IF(NUMBER_OF_DIMENSIONS1==2.AND.NUMBER_OF_DIMENSIONS2==2) THEN
 451      CALL CMISSBasis_InterpolationXiSet(BasisVelocity1,(/BASIS_XI_INTERPOLATION_VELOCITY1,BASIS_XI_INTERPOLATION_VELOCITY1/),Err)
 452      IF(BASIS_TYPE1/=CMISS_BASIS_SIMPLEX_TYPE) THEN
 453        CALL CMISSBasis_QuadratureNumberOfGaussXiSet(BasisVelocity1,(/BASIS_XI_GAUSS_VELOCITY1,BASIS_XI_GAUSS_VELOCITY1/),Err)
 454      ELSE
 455        CALL CMISSBasis_QuadratureOrderSet(BasisVelocity1,BASIS_XI_GAUSS_VELOCITY1+1,Err)
 456      ENDIF
 457    ELSE IF(NUMBER_OF_DIMENSIONS1==3.AND.NUMBER_OF_DIMENSIONS2==3) THEN
 458      CALL CMISSBasis_InterpolationXiSet(BasisVelocity1,(/BASIS_XI_INTERPOLATION_VELOCITY1,BASIS_XI_INTERPOLATION_VELOCITY1, & 
 459        & BASIS_XI_INTERPOLATION_VELOCITY1/),Err)                         
 460      IF(BASIS_TYPE1/=CMISS_BASIS_SIMPLEX_TYPE) THEN
 461        CALL CMISSBasis_QuadratureNumberOfGaussXiSet(BasisVelocity1,(/BASIS_XI_GAUSS_VELOCITY1,BASIS_XI_GAUSS_VELOCITY1, &
 462          & BASIS_XI_GAUSS_VELOCITY1/),Err)
 463      ELSE
 464        CALL CMISSBasis_QuadratureOrderSet(BasisVelocity1,BASIS_XI_GAUSS_VELOCITY1+1,Err)
 465      ENDIF
 466    ELSE
 467      CALL HANDLE_ERROR("Dimension coupling error.")
 468    ENDIF
 469    !Finish the creation of the basis
 470    CALL CMISSBasis_CreateFinish(BasisVelocity1,Err)
 471  ENDIF
 472  !Start the creation of another basis
 473  IF(BASIS_XI_INTERPOLATION_PRESSURE1==BASIS_XI_INTERPOLATION_SPACE1) THEN
 474    BasisPressure1=BasisSpace1
 475  ELSE IF(BASIS_XI_INTERPOLATION_PRESSURE1==BASIS_XI_INTERPOLATION_VELOCITY1) THEN
 476    BasisPressure1=BasisVelocity1
 477  ELSE
 478    MESH_NUMBER_OF_COMPONENTS1=MESH_NUMBER_OF_COMPONENTS1+1
 479    !Initialise a new pressure basis
 480    CALL CMISSBasis_Initialise(BasisPressure1,Err)
 481    !Start the creation of a basis
 482    CALL CMISSBasis_CreateStart(BASIS_NUMBER_PRESSURE1,BasisPressure1,Err)
 483    !Set the basis type (Lagrange/Simplex)
 484    CALL CMISSBasis_TypeSet(BasisPressure1,BASIS_TYPE1,Err)
 485    !Set the basis xi number
 486    CALL CMISSBasis_NumberOfXiSet(BasisPressure1,NUMBER_OF_DIMENSIONS1,Err)
 487    !Set the basis xi interpolation and number of Gauss points
 488    IF(NUMBER_OF_DIMENSIONS1==2.AND.NUMBER_OF_DIMENSIONS2==2) THEN
 489      CALL CMISSBasis_InterpolationXiSet(BasisPressure1,(/BASIS_XI_INTERPOLATION_PRESSURE1,BASIS_XI_INTERPOLATION_PRESSURE1/),Err)
 490      IF(BASIS_TYPE1/=CMISS_BASIS_SIMPLEX_TYPE) THEN
 491        CALL CMISSBasis_QuadratureNumberOfGaussXiSet(BasisPressure1,(/BASIS_XI_GAUSS_PRESSURE1,BASIS_XI_GAUSS_PRESSURE1/),Err)
 492      ELSE
 493        CALL CMISSBasis_QuadratureOrderSet(BasisPressure1,BASIS_XI_GAUSS_PRESSURE1+1,Err)
 494      ENDIF
 495    ELSE IF(NUMBER_OF_DIMENSIONS1==3.AND.NUMBER_OF_DIMENSIONS2==3) THEN
 496      CALL CMISSBasis_InterpolationXiSet(BasisPressure1,(/BASIS_XI_INTERPOLATION_PRESSURE1,BASIS_XI_INTERPOLATION_PRESSURE1, & 
 497        & BASIS_XI_INTERPOLATION_PRESSURE1/),Err)                         
 498      IF(BASIS_TYPE1/=CMISS_BASIS_SIMPLEX_TYPE) THEN
 499        CALL CMISSBasis_QuadratureNumberOfGaussXiSet(BasisPressure1,(/BASIS_XI_GAUSS_PRESSURE1,BASIS_XI_GAUSS_PRESSURE1, &
 500          & BASIS_XI_GAUSS_PRESSURE1/),Err)
 501      ELSE
 502        CALL CMISSBasis_QuadratureOrderSet(BasisPressure1,BASIS_XI_GAUSS_PRESSURE1+1,Err)
 503      ENDIF
 504    ELSE
 505      CALL HANDLE_ERROR("Dimension coupling error.")
 506    ENDIF
 507    !Finish the creation of the basis
 508    CALL CMISSBasis_CreateFinish(BasisPressure1,Err)
 509  ENDIF
 510
 511
 512  !Start the creation of a bI/tri-XXX-Lagrange basis
 513  PRINT *, ' == >> CREATING BASIS(2) << == '
 514  !Start the creation of new bases
 515  MESH_NUMBER_OF_COMPONENTS2=1
 516  CALL CMISSBasis_Initialise(BasisSpace2,Err)
 517  CALL CMISSBasis_CreateStart(BASIS_NUMBER_SPACE2,BasisSpace2,Err)
 518  !Set the basis type (Lagrange/Simplex)
 519  CALL CMISSBasis_TypeSet(BasisSpace2,BASIS_TYPE2,Err)
 520  !Set the basis xi number
 521  CALL CMISSBasis_NumberOfXiSet(BasisSpace2,NUMBER_OF_DIMENSIONS2,Err)
 522  !Set the basis xi interpolation and number of Gauss points
 523  IF(NUMBER_OF_DIMENSIONS1==2.AND.NUMBER_OF_DIMENSIONS2==2) THEN
 524    CALL CMISSBasis_InterpolationXiSet(BasisSpace2,(/BASIS_XI_INTERPOLATION_SPACE2,BASIS_XI_INTERPOLATION_SPACE2/),Err)
 525    IF(BASIS_TYPE2/=CMISS_BASIS_SIMPLEX_TYPE) THEN
 526      CALL CMISSBasis_QuadratureNumberOfGaussXiSet(BasisSpace2,(/BASIS_XI_GAUSS_SPACE2,BASIS_XI_GAUSS_SPACE2/),Err)
 527    ELSE
 528      CALL CMISSBasis_QuadratureOrderSet(BasisSpace2,BASIS_XI_GAUSS_SPACE2+1,Err)
 529    ENDIF
 530  ELSE IF(NUMBER_OF_DIMENSIONS1==3.AND.NUMBER_OF_DIMENSIONS2==3) THEN
 531    CALL CMISSBasis_InterpolationXiSet(BasisSpace2,(/BASIS_XI_INTERPOLATION_SPACE2,BASIS_XI_INTERPOLATION_SPACE2, & 
 532      & BASIS_XI_INTERPOLATION_SPACE2/),Err)                         
 533    IF(BASIS_TYPE2/=CMISS_BASIS_SIMPLEX_TYPE) THEN
 534      CALL CMISSBasis_QuadratureNumberOfGaussXiSet(BasisSpace2,(/BASIS_XI_GAUSS_SPACE2,BASIS_XI_GAUSS_SPACE2, &
 535        & BASIS_XI_GAUSS_SPACE2/),Err)
 536    ELSE
 537      CALL CMISSBasis_QuadratureOrderSet(BasisSpace2,BASIS_XI_GAUSS_SPACE2+1,Err)
 538    ENDIF
 539  ELSE
 540    CALL HANDLE_ERROR("Dimension coupling error.")
 541  ENDIF
 542  !Finish the creation of the basis
 543  CALL CMISSBasis_CreateFinish(BasisSpace2,Err)
 544  !Start the creation of another basis
 545  IF(BASIS_XI_INTERPOLATION_VELOCITY2==BASIS_XI_INTERPOLATION_SPACE2) THEN
 546    BasisVelocity2=BasisSpace2
 547  ELSE
 548    MESH_NUMBER_OF_COMPONENTS2=MESH_NUMBER_OF_COMPONENTS2+1
 549    !Initialise a new velocity basis
 550    CALL CMISSBasis_Initialise(BasisVelocity2,Err)
 551    !Start the creation of a basis
 552    CALL CMISSBasis_CreateStart(BASIS_NUMBER_VELOCITY2,BasisVelocity2,Err)
 553    !Set the basis type (Lagrange/Simplex)
 554    CALL CMISSBasis_TypeSet(BasisVelocity2,BASIS_TYPE2,Err)
 555    !Set the basis xi number
 556    CALL CMISSBasis_NumberOfXiSet(BasisVelocity2,NUMBER_OF_DIMENSIONS2,Err)
 557    !Set the basis xi interpolation and number of Gauss points
 558    IF(NUMBER_OF_DIMENSIONS1==2.AND.NUMBER_OF_DIMENSIONS2==2) THEN
 559      CALL CMISSBasis_InterpolationXiSet(BasisVelocity2,(/BASIS_XI_INTERPOLATION_VELOCITY2,BASIS_XI_INTERPOLATION_VELOCITY2/),Err)
 560      IF(BASIS_TYPE2/=CMISS_BASIS_SIMPLEX_TYPE) THEN
 561        CALL CMISSBasis_QuadratureNumberOfGaussXiSet(BasisVelocity2,(/BASIS_XI_GAUSS_VELOCITY2,BASIS_XI_GAUSS_VELOCITY2/),Err)
 562      ELSE
 563        CALL CMISSBasis_QuadratureOrderSet(BasisVelocity2,BASIS_XI_GAUSS_VELOCITY2+1,Err)
 564      ENDIF
 565    ELSE IF(NUMBER_OF_DIMENSIONS1==3.AND.NUMBER_OF_DIMENSIONS2==3) THEN
 566      CALL CMISSBasis_InterpolationXiSet(BasisVelocity2,(/BASIS_XI_INTERPOLATION_VELOCITY2,BASIS_XI_INTERPOLATION_VELOCITY2, & 
 567        & BASIS_XI_INTERPOLATION_VELOCITY2/),Err)                         
 568      IF(BASIS_TYPE2/=CMISS_BASIS_SIMPLEX_TYPE) THEN
 569        CALL CMISSBasis_QuadratureNumberOfGaussXiSet(BasisVelocity2,(/BASIS_XI_GAUSS_VELOCITY2,BASIS_XI_GAUSS_VELOCITY2, &
 570          & BASIS_XI_GAUSS_VELOCITY2/),Err)
 571      ELSE
 572        CALL CMISSBasis_QuadratureOrderSet(BasisVelocity2,BASIS_XI_GAUSS_VELOCITY2+1,Err)
 573      ENDIF
 574    ELSE
 575      CALL HANDLE_ERROR("Dimension coupling error.")
 576    ENDIF
 577    !Finish the creation of the basis
 578    CALL CMISSBasis_CreateFinish(BasisVelocity2,Err)
 579  ENDIF
 580  !Start the creation of another basis
 581  IF(BASIS_XI_INTERPOLATION_PRESSURE2==BASIS_XI_INTERPOLATION_SPACE2) THEN
 582    BasisPressure2=BasisSpace2
 583  ELSE IF(BASIS_XI_INTERPOLATION_PRESSURE2==BASIS_XI_INTERPOLATION_VELOCITY2) THEN
 584    BasisPressure2=BasisVelocity2
 585  ELSE
 586    MESH_NUMBER_OF_COMPONENTS2=MESH_NUMBER_OF_COMPONENTS2+1
 587    !Initialise a new pressure basis
 588    CALL CMISSBasis_Initialise(BasisPressure2,Err)
 589    !Start the creation of a basis
 590    CALL CMISSBasis_CreateStart(BASIS_NUMBER_PRESSURE2,BasisPressure2,Err)
 591    !Set the basis type (Lagrange/Simplex)
 592    CALL CMISSBasis_TypeSet(BasisPressure2,BASIS_TYPE2,Err)
 593    !Set the basis xi number
 594    CALL CMISSBasis_NumberOfXiSet(BasisPressure2,NUMBER_OF_DIMENSIONS2,Err)
 595    !Set the basis xi interpolation and number of Gauss points
 596    IF(NUMBER_OF_DIMENSIONS1==2.AND.NUMBER_OF_DIMENSIONS2==2) THEN
 597      CALL CMISSBasis_InterpolationXiSet(BasisPressure2,(/BASIS_XI_INTERPOLATION_PRESSURE2,BASIS_XI_INTERPOLATION_PRESSURE2/),Err)
 598      IF(BASIS_TYPE2/=CMISS_BASIS_SIMPLEX_TYPE) THEN
 599        CALL CMISSBasis_QuadratureNumberOfGaussXiSet(BasisPressure2,(/BASIS_XI_GAUSS_PRESSURE2,BASIS_XI_GAUSS_PRESSURE2/),Err)
 600      ELSE
 601        CALL CMISSBasis_QuadratureOrderSet(BasisPressure2,BASIS_XI_GAUSS_PRESSURE2+1,Err)
 602      ENDIF
 603    ELSE IF(NUMBER_OF_DIMENSIONS1==3.AND.NUMBER_OF_DIMENSIONS2==3) THEN
 604      CALL CMISSBasis_InterpolationXiSet(BasisPressure2,(/BASIS_XI_INTERPOLATION_PRESSURE2,BASIS_XI_INTERPOLATION_PRESSURE2, & 
 605        & BASIS_XI_INTERPOLATION_PRESSURE2/),Err)                         
 606      IF(BASIS_TYPE2/=CMISS_BASIS_SIMPLEX_TYPE) THEN
 607        CALL CMISSBasis_QuadratureNumberOfGaussXiSet(BasisPressure2,(/BASIS_XI_GAUSS_PRESSURE2,BASIS_XI_GAUSS_PRESSURE2, &
 608          & BASIS_XI_GAUSS_PRESSURE2/),Err)
 609      ELSE
 610        CALL CMISSBasis_QuadratureOrderSet(BasisPressure2,BASIS_XI_GAUSS_PRESSURE2+1,Err)
 611      ENDIF
 612    ELSE
 613      CALL HANDLE_ERROR("Dimension coupling error.")
 614    ENDIF
 615    !Finish the creation of the basis
 616    CALL CMISSBasis_CreateFinish(BasisPressure2,Err)
 617  ENDIF
 618
 619
 620  !
 621  !================================================================================================================================
 622  !
 623
 624  !MESH
 625
 626  
 627  !Start the creation of a generated mesh in the first region
 628  PRINT *, ' == >> CREATING MESH(1) FROM INPUT DATA << == '
 629 !Start the creation of mesh nodes
 630  CALL CMISSNodes_Initialise(Nodes1,Err)
 631  CALL CMISSMesh_Initialise(Mesh1,Err)
 632  CALL CMISSNodes_CreateStart(Region1,TOTAL_NUMBER_OF_NODES1,Nodes1,Err)
 633  CALL CMISSNodes_CreateFinish(Nodes1,Err)
 634  !Start the creation of the mesh
 635  CALL CMISSMesh_CreateStart(Mesh1UserNumber,Region1,NUMBER_OF_DIMENSIONS1,Mesh1,Err)
 636  !Set number of mesh elements
 637  CALL CMISSMesh_NumberOfElementsSet(Mesh1,TOTAL_NUMBER_OF_ELEMENTS1,Err)
 638  !Set number of mesh components
 639  CALL CMISSMesh_NumberOfComponentsSet(Mesh1,MESH_NUMBER_OF_COMPONENTS1,Err)
 640  !Specify spatial mesh component
 641  CALL CMISSMeshElements_Initialise(MeshElementsSpace1,Err)
 642  CALL CMISSMeshElements_Initialise(MeshElementsVelocity1,Err)
 643  CALL CMISSMeshElements_Initialise(MeshElementsPressure1,Err)
 644  MESH_COMPONENT_NUMBER_SPACE1=1
 645  MESH_COMPONENT_NUMBER_VELOCITY1=1
 646  MESH_COMPONENT_NUMBER_PRESSURE1=1
 647  CALL CMISSMeshElements_CreateStart(Mesh1,MESH_COMPONENT_NUMBER_SPACE1,BasisSpace1,MeshElementsSpace1,Err)
 648  DO ELEMENT_NUMBER=1,TOTAL_NUMBER_OF_ELEMENTS1
 649    CALL CMISSMeshElements_NodesSet(MeshElementsSpace1,ELEMENT_NUMBER,CM1%M(ELEMENT_NUMBER,1:NUMBER_OF_ELEMENT_NODES_SPACE1),Err)
 650  ENDDO
 651  CALL CMISSMeshElements_CreateFinish(MeshElementsSpace1,Err)
 652  !Specify velocity mesh component
 653  IF(BASIS_XI_INTERPOLATION_VELOCITY1==BASIS_XI_INTERPOLATION_SPACE1) THEN
 654    MeshElementsVelocity1=MeshElementsSpace1
 655  ELSE
 656    MESH_COMPONENT_NUMBER_VELOCITY1=MESH_COMPONENT_NUMBER_SPACE1+1
 657    CALL CMISSMeshElements_CreateStart(Mesh1,MESH_COMPONENT_NUMBER_VELOCITY1,BasisVelocity1,MeshElementsVelocity1,Err)
 658    DO ELEMENT_NUMBER=1,TOTAL_NUMBER_OF_ELEMENTS1
 659      CALL CMISSMeshElements_NodesSet(MeshElementsVelocity1,ELEMENT_NUMBER,CM1%V(ELEMENT_NUMBER, & 
 660        & 1:NUMBER_OF_ELEMENT_NODES_VELOCITY1),Err)
 661    ENDDO
 662    CALL CMISSMeshElements_CreateFinish(MeshElementsVelocity1,Err)
 663  ENDIF
 664  !Specify pressure mesh component
 665  IF(BASIS_XI_INTERPOLATION_PRESSURE1==BASIS_XI_INTERPOLATION_SPACE1) THEN
 666    MeshElementsPressure1=MeshElementsSpace1
 667    MESH_COMPONENT_NUMBER_PRESSURE1=MESH_COMPONENT_NUMBER_SPACE1
 668  ELSE IF(BASIS_XI_INTERPOLATION_PRESSURE1==BASIS_XI_INTERPOLATION_VELOCITY1) THEN
 669    MeshElementsPressure1=MeshElementsVelocity1
 670    MESH_COMPONENT_NUMBER_PRESSURE1=MESH_COMPONENT_NUMBER_VELOCITY1
 671  ELSE
 672    MESH_COMPONENT_NUMBER_PRESSURE1=MESH_COMPONENT_NUMBER_VELOCITY1+1
 673    CALL CMISSMeshElements_CreateStart(Mesh1,MESH_COMPONENT_NUMBER_PRESSURE1,BasisPressure1,MeshElementsPressure1,Err)
 674    DO ELEMENT_NUMBER=1,TOTAL_NUMBER_OF_ELEMENTS1
 675      CALL CMISSMeshElements_NodesSet(MeshElementsPressure1,ELEMENT_NUMBER,CM1%P(ELEMENT_NUMBER, & 
 676        & 1:NUMBER_OF_ELEMENT_NODES_PRESSURE1),Err)
 677    ENDDO
 678    CALL CMISSMeshElements_CreateFinish(MeshElementsPressure1,Err)
 679  ENDIF
 680  !Finish the creation of the mesh
 681  CALL CMISSMesh_CreateFinish(Mesh1,Err)
 682
 683  !Start the creation of a generated mesh in the second region
 684  PRINT *, ' == >> CREATING MESH(2) FROM INPUT DATA << == '
 685  !Start the creation of mesh nodes
 686  CALL CMISSNodes_Initialise(Nodes2,Err)
 687  CALL CMISSMesh_Initialise(Mesh2,Err)
 688  CALL CMISSNodes_CreateStart(Region2,TOTAL_NUMBER_OF_NODES2,Nodes2,Err)
 689  CALL CMISSNodes_CreateFinish(Nodes2,Err)
 690  !Start the creation of the mesh
 691  CALL CMISSMesh_CreateStart(Mesh2UserNumber,Region2,NUMBER_OF_DIMENSIONS2,Mesh2,Err)
 692  !Set number of mesh elements
 693  CALL CMISSMesh_NumberOfElementsSet(Mesh2,TOTAL_NUMBER_OF_ELEMENTS2,Err)
 694  !Set number of mesh components
 695  CALL CMISSMesh_NumberOfComponentsSet(Mesh2,MESH_NUMBER_OF_COMPONENTS2,Err)
 696  !Specify spatial mesh component
 697  CALL CMISSMeshElements_Initialise(MeshElementsSpace2,Err)
 698  CALL CMISSMeshElements_Initialise(MeshElementsVelocity2,Err)
 699  CALL CMISSMeshElements_Initialise(MeshElementsPressure2,Err)
 700  MESH_COMPONENT_NUMBER_SPACE2=1
 701  MESH_COMPONENT_NUMBER_VELOCITY2=1
 702  MESH_COMPONENT_NUMBER_PRESSURE2=1
 703  CALL CMISSMeshElements_CreateStart(Mesh2,MESH_COMPONENT_NUMBER_SPACE2,BasisSpace2,MeshElementsSpace2,Err)
 704  DO ELEMENT_NUMBER=1,TOTAL_NUMBER_OF_ELEMENTS2
 705    CALL CMISSMeshElements_NodesSet(MeshElementsSpace2,ELEMENT_NUMBER,CM2%M(ELEMENT_NUMBER,1:NUMBER_OF_ELEMENT_NODES_SPACE2),Err)
 706  ENDDO
 707  CALL CMISSMeshElements_CreateFinish(MeshElementsSpace2,Err)
 708  !Specify velocity mesh component
 709  IF(BASIS_XI_INTERPOLATION_VELOCITY2==BASIS_XI_INTERPOLATION_SPACE2) THEN
 710    MeshElementsVelocity2=MeshElementsSpace2
 711  ELSE
 712    MESH_COMPONENT_NUMBER_VELOCITY2=MESH_COMPONENT_NUMBER_SPACE2+1
 713    CALL CMISSMeshElements_CreateStart(Mesh2,MESH_COMPONENT_NUMBER_VELOCITY2,BasisVelocity2,MeshElementsVelocity2,Err)
 714    DO ELEMENT_NUMBER=1,TOTAL_NUMBER_OF_ELEMENTS2
 715      CALL CMISSMeshElements_NodesSet(MeshElementsVelocity2,ELEMENT_NUMBER,CM2%V(ELEMENT_NUMBER, & 
 716        & 1:NUMBER_OF_ELEMENT_NODES_VELOCITY2),Err)
 717    ENDDO
 718    CALL CMISSMeshElements_CreateFinish(MeshElementsVelocity2,Err)
 719  ENDIF
 720  !Specify pressure mesh component
 721  IF(BASIS_XI_INTERPOLATION_PRESSURE2==BASIS_XI_INTERPOLATION_SPACE2) THEN
 722    MeshElementsPressure2=MeshElementsSpace2
 723    MESH_COMPONENT_NUMBER_PRESSURE2=MESH_COMPONENT_NUMBER_SPACE2
 724  ELSE IF(BASIS_XI_INTERPOLATION_PRESSURE2==BASIS_XI_INTERPOLATION_VELOCITY2) THEN
 725    MeshElementsPressure2=MeshElementsVelocity2
 726    MESH_COMPONENT_NUMBER_PRESSURE2=MESH_COMPONENT_NUMBER_VELOCITY2
 727  ELSE
 728    MESH_COMPONENT_NUMBER_PRESSURE2=MESH_COMPONENT_NUMBER_VELOCITY2+1
 729    CALL CMISSMeshElements_CreateStart(Mesh2,MESH_COMPONENT_NUMBER_PRESSURE2,BasisPressure2,MeshElementsPressure2,Err)
 730    DO ELEMENT_NUMBER=1,TOTAL_NUMBER_OF_ELEMENTS2
 731      CALL CMISSMeshElements_NodesSet(MeshElementsPressure2,ELEMENT_NUMBER,CM2%P(ELEMENT_NUMBER, & 
 732        & 1:NUMBER_OF_ELEMENT_NODES_PRESSURE2),Err)
 733    ENDDO
 734    CALL CMISSMeshElements_CreateFinish(MeshElementsPressure2,Err)
 735  ENDIF
 736  !Finish the creation of the mesh
 737  CALL CMISSMesh_CreateFinish(Mesh2,Err)
 738
 739
 740  !
 741  !================================================================================================================================
 742  !
 743
 744  !INTERFACE DEFINITION
 745
 746  !Create an interface between the two meshes
 747  PRINT *, ' == >> CREATING INTERFACE << == '
 748  CALL CMISSInterface_Initialise(Interface,Err)
 749  CALL CMISSInterface_CreateStart(InterfaceUserNumber,WorldRegion,Interface,Err)
 750  CALL CMISSInterface_LabelSet(Interface,"Interface",Err)
 751  !Add in the two meshes
 752  CALL CMISSInterface_MeshAdd(Interface,Mesh1,Mesh1Index,Err)
 753  CALL CMISSInterface_MeshAdd(Interface,Mesh2,Mesh2Index,Err)
 754  !Finish creating the interface
 755  CALL CMISSInterface_CreateFinish(Interface,Err)
 756
 757  !Start the creation of a (bi)-linear-Lagrange basis
 758  PRINT *, ' == >> CREATING INTERFACE BASIS << == '
 759  CALL CMISSBasis_Initialise(InterfaceBasis,Err)
 760  CALL CMISSBasis_CreateStart(InterfaceBasisUserNumber,InterfaceBasis,Err)
 761  CALL CMISSBasis_TypeSet(InterfaceBasis,BASIS_TYPE_INTERFACE,Err)
 762  CALL CMISSBasis_NumberOfXiSet(InterfaceBasis,NUMBER_OF_DIMENSIONS_INTERFACE,Err)
 763  !Set the basis xi interpolation and number of Gauss points
 764  IF(NUMBER_OF_DIMENSIONS1==3.AND.NUMBER_OF_DIMENSIONS2==3.AND.NUMBER_OF_DIMENSIONS_INTERFACE==2) THEN
 765    CALL CMISSBasis_InterpolationXiSet(InterfaceBasis,(/BASIS_XI_INTERPOLATION_INTERFACE,BASIS_XI_INTERPOLATION_INTERFACE/),Err)
 766    IF(BASIS_TYPE_INTERFACE/=CMISS_BASIS_SIMPLEX_TYPE) THEN
 767      CALL CMISSBasis_QuadratureNumberOfGaussXiSet(InterfaceBasis,(/BASIS_XI_GAUSS_INTERFACE,BASIS_XI_GAUSS_INTERFACE/),Err)
 768    ELSE
 769      CALL CMISSBasis_QuadratureOrderSet(InterfaceBasis,BASIS_XI_GAUSS_INTERFACE+1,Err)
 770    ENDIF
 771  ENDIF
 772  !Finish the creation of the basis
 773  CALL CMISSBasis_CreateFinish(InterfaceBasis,Err)
 774
 775
 776  !
 777  !================================================================================================================================
 778  !
 779
 780  !INTERFACE MAPPING
 781
 782  !Start the creation of a (bi)-linear-Lagrange basis
 783  PRINT *, ' == >> CREATING INTERFACE MAPPING BASIS << == '
 784  CALL CMISSBasis_Initialise(InterfaceMappingBasis,Err)
 785  CALL CMISSBasis_CreateStart(InterfaceMappingBasisUserNumber,InterfaceMappingBasis,Err)
 786  CALL CMISSBasis_TypeSet(InterfaceMappingBasis,BASIS_TYPE_INTERFACE,Err)
 787  CALL CMISSBasis_NumberOfXiSet(InterfaceMappingBasis,NUMBER_OF_DIMENSIONS_INTERFACE,Err)
 788  IF(NUMBER_OF_DIMENSIONS1==3.AND.NUMBER_OF_DIMENSIONS2==3.AND.NUMBER_OF_DIMENSIONS_INTERFACE==2) THEN
 789    CALL CMISSBasis_InterpolationXiSet(InterfaceMappingBasis,(/BASIS_XI_INTERPOLATION_INTERFACE, &
 790      & BASIS_XI_INTERPOLATION_INTERFACE/),Err)
 791    IF(BASIS_TYPE_INTERFACE/=CMISS_BASIS_SIMPLEX_TYPE) THEN
 792      CALL CMISSBasis_QuadratureNumberOfGaussXiSet(InterfaceMappingBasis,(/BASIS_XI_GAUSS_INTERFACE,BASIS_XI_GAUSS_INTERFACE/),Err)
 793    ELSE
 794      CALL CMISSBasis_QuadratureOrderSet(InterfaceMappingBasis,BASIS_XI_GAUSS_INTERFACE+1,Err)
 795    ENDIF
 796  ENDIF
 797  !Finish the creation of the basis
 798  CALL CMISSBasis_CreateFinish(InterfaceMappingBasis,Err)
 799
 800  !
 801  !================================================================================================================================
 802  !
 803
 804  !INTERFACE MESH
 805  
 806  !Start the creation of a generated mesh for the interface
 807  PRINT *, ' == >> CREATING INTERFACE MESH FROM INPUT DATA << == '
 808  !Start the creation of mesh nodes
 809  CALL CMISSNodes_Initialise(InterfaceNodes,Err)
 810  CALL CMISSMesh_Initialise(InterfaceMesh,Err)
 811  CALL CMISSNodes_CreateStart(Interface,TOTAL_NUMBER_OF_NODES_INTERFACE,InterfaceNodes,Err)
 812  CALL CMISSNodes_CreateFinish(InterfaceNodes,Err)
 813  !Start the creation of the mesh
 814  CALL CMISSMesh_CreateStart(InterfaceMeshUserNumber,Interface,NUMBER_OF_DIMENSIONS_INTERFACE,InterfaceMesh,Err)
 815  !Set number of mesh elements
 816  CALL CMISSMesh_NumberOfElementsSet(InterfaceMesh,TOTAL_NUMBER_OF_ELEMENTS_INTERFACE,Err)
 817  MESH_NUMBER_OF_COMPONENTS_INTERFACE=1
 818  !Set number of mesh components
 819  CALL CMISSMesh_NumberOfComponentsSet(InterfaceMesh,MESH_NUMBER_OF_COMPONENTS_INTERFACE,Err)
 820  !Specify spatial mesh component
 821  CALL CMISSMeshElements_Initialise(InterfaceMeshElements,Err)
 822  MESH_COMPONENT_NUMBER_INTERFACE=1
 823  CALL CMISSMeshElements_CreateStart(InterfaceMesh,MESH_COMPONENT_NUMBER_INTERFACE,InterfaceBasis,InterfaceMeshElements,Err)
 824  DO ELEMENT_NUMBER=1,TOTAL_NUMBER_OF_ELEMENTS_INTERFACE
 825    CALL CMISSMeshElements_NodesSet(InterfaceMeshElements,ELEMENT_NUMBER,CM3%M(ELEMENT_NUMBER, &
 826      & 1:NUMBER_OF_ELEMENT_NODES_INTERFACE),Err)
 827  ENDDO
 828  CALL CMISSMeshElements_CreateFinish(InterfaceMeshElements,Err)
 829  !Finish the creation of the mesh
 830  CALL CMISSMesh_CreateFinish(InterfaceMesh,Err)
 831
 832
 833  !
 834  !================================================================================================================================
 835  !
 836
 837  !INTERFACE CONNECTIVITY
 838
 839  !Couple the interface meshes
 840  PRINT *, ' == >> CREATING INTERFACE MESHES CONNECTIVITY << == '
 841  CALL CMISSInterfaceMeshConnectivity_Initialise(InterfaceMeshConnectivity,Err)
 842  CALL CMISSInterfaceMeshConnectivity_CreateStart(Interface,InterfaceMesh,InterfaceMeshConnectivity,Err)
 843  CALL CMISSInterfaceMeshConnectivity_SetBasis(InterfaceMeshConnectivity,InterfaceMappingBasis,Err)
 844
 845  DO ic_idx=1,CMX%NUMBER_OF_COUPLINGS
 846    !Map the interface element to the elements in mesh 1
 847    CALL CMISSInterfaceMeshConnectivity_ElementNumberSet(InterfaceMeshConnectivity,CMX%INTERFACE_ELEMENT_NUMBER(ic_idx), &
 848      & CMX%MESH1_ID,CMX%MESH1_ELEMENT_NUMBER(ic_idx),Err)
 849    !Map the interface element to the elements in mesh 2
 850    CALL CMISSInterfaceMeshConnectivity_ElementNumberSet(InterfaceMeshConnectivity,CMX%INTERFACE_ELEMENT_NUMBER(ic_idx), &
 851      & CMX%MESH2_ID,CMX%MESH2_ELEMENT_NUMBER(ic_idx),Err)
 852  ENDDO !ic_idx
 853
 854  DO ic_idx=1,CMX%NUMBER_OF_COUPLINGS
 855    !Define xi mapping in mesh 1
 856    CALL CMISSInterfaceMeshConnectivity_ElementXiSet(InterfaceMeshConnectivity,CMX%INTERFACE_ELEMENT_NUMBER(ic_idx), & 
 857      & CMX%MESH1_ID,CMX%MESH1_ELEMENT_NUMBER(ic_idx),CMX%INTERFACE_ELEMENT_LOCAL_NODE(ic_idx),1, &
 858      & CMX%MESH1_ELEMENT_XI(ic_idx,1:3),Err)
 859    !Define xi mapping in mesh 2
 860    CALL CMISSInterfaceMeshConnectivity_ElementXiSet(InterfaceMeshConnectivity,CMX%INTERFACE_ELEMENT_NUMBER(ic_idx), & 
 861      & CMX%MESH2_ID,CMX%MESH2_ELEMENT_NUMBER(ic_idx),CMX%INTERFACE_ELEMENT_LOCAL_NODE(ic_idx),1, &
 862      & CMX%MESH2_ELEMENT_XI(ic_idx,1:3),Err)
 863  ENDDO !ic_idx
 864
 865
 866  CALL CMISSInterfaceMeshConnectivity_CreateFinish(InterfaceMeshConnectivity,Err)
 867
 868
 869  !
 870  !================================================================================================================================
 871  !
 872
 873  !GEOMETRIC FIELD & DECOMPOSITION
 874
 875  !Create a decomposition for mesh1
 876  PRINT *, ' == >> CREATING MESH(1) DECOMPOSITION << == '
 877  CALL CMISSDecomposition_Initialise(Decomposition1,Err)
 878  CALL CMISSDecomposition_CreateStart(Decomposition1UserNumber,Mesh1,Decomposition1,Err)
 879  !Set the decomposition to be a general decomposition with the specified number of domains
 880  CALL CMISSDecomposition_TypeSet(Decomposition1,CMISS_DECOMPOSITION_CALCULATED_TYPE,Err)
 881  CALL CMISSDecomposition_NumberOfDomainsSet(Decomposition1,NumberOfComputationalNodes,Err)
 882  !Finish the decomposition
 883  CALL CMISSDecomposition_CreateFinish(Decomposition1,Err)
 884
 885  !Create a decomposition for mesh2
 886  PRINT *, ' == >> CREATING MESH(2) DECOMPOSITION << == '
 887  CALL CMISSDecomposition_Initialise(Decomposition2,Err)
 888  CALL CMISSDecomposition_CreateStart(Decomposition2UserNumber,Mesh2,Decomposition2,Err)
 889  !Set the decomposition to be a general decomposition with the specified number of domains
 890  CALL CMISSDecomposition_TypeSet(Decomposition2,CMISS_DECOMPOSITION_CALCULATED_TYPE,Err)
 891  CALL CMISSDecomposition_NumberOfDomainsSet(Decomposition2,NumberOfComputationalNodes,Err)
 892  !Finish the decomposition
 893  CALL CMISSDecomposition_CreateFinish(Decomposition2,Err)
 894  
 895  !Create a decomposition for the interface mesh
 896  PRINT *, ' == >> CREATING INTERFACE DECOMPOSITION << == '
 897  CALL CMISSDecomposition_Initialise(InterfaceDecomposition,Err)
 898  CALL CMISSDecomposition_CreateStart(InterfaceDecompositionUserNumber,InterfaceMesh,InterfaceDecomposition,Err)
 899  !Set the decomposition to be a general decomposition with the specified number of domains
 900  CALL CMISSDecomposition_TypeSet(InterfaceDecomposition,CMISS_DECOMPOSITION_CALCULATED_TYPE,Err)
 901  CALL CMISSDecomposition_NumberOfDomainsSet(InterfaceDecomposition,NumberOfComputationalNodes,Err)
 902  !Finish the decomposition
 903  CALL CMISSDecomposition_CreateFinish(InterfaceDecomposition,Err)
 904
 905  !Start to create a default (geometric) field on the first region
 906  PRINT *, ' == >> CREATING MESH(1) GEOMETRIC FIELD << == '
 907  CALL CMISSField_Initialise(GeometricField1,Err)
 908  CALL CMISSField_CreateStart(GeometricField1UserNumber,Region1,GeometricField1,Err)
 909  !Set the decomposition to use
 910  CALL CMISSField_MeshDecompositionSet(GeometricField1,Decomposition1,Err)
 911  !Set the domain to be used by the field components.
 912  CALL CMISSField_ComponentMeshComponentSet(GeometricField1,CMISS_FIELD_U_VARIABLE_TYPE,1,1,Err)
 913  CALL CMISSField_ComponentMeshComponentSet(GeometricField1,CMISS_FIELD_U_VARIABLE_TYPE,2,1,Err)
 914  IF(NUMBER_OF_DIMENSIONS1==3.AND.NUMBER_OF_DIMENSIONS2==3) THEN
 915    CALL CMISSField_ComponentMeshComponentSet(GeometricField1,CMISS_FIELD_U_VARIABLE_TYPE,3,1,Err)
 916  ENDIF
 917  !Finish creating the first field
 918  CALL CMISSField_CreateFinish(GeometricField1,Err)
 919
 920  !Start to create a default (geometric) field on the second region
 921  PRINT *, ' == >> CREATING MESH(2) GEOMETRIC FIELD << == '
 922  CALL CMISSField_Initialise(GeometricField2,Err)
 923  CALL CMISSField_CreateStart(GeometricField2UserNumber,Region2,GeometricField2,Err)
 924  !Set the decomposition to use
 925  CALL CMISSField_MeshDecompositionSet(GeometricField2,Decomposition2,Err)
 926  !Set the domain to be used by the field components.
 927  CALL CMISSField_ComponentMeshComponentSet(GeometricField2,CMISS_FIELD_U_VARIABLE_TYPE,1,1,Err)
 928  CALL CMISSField_ComponentMeshComponentSet(GeometricField2,CMISS_FIELD_U_VARIABLE_TYPE,2,1,Err)
 929  IF(NUMBER_OF_DIMENSIONS1==3.AND.NUMBER_OF_DIMENSIONS2==3) THEN
 930    CALL CMISSField_ComponentMeshComponentSet(GeometricField2,CMISS_FIELD_U_VARIABLE_TYPE,3,1,Err)
 931  ENDIF
 932  !Finish creating the second field
 933  CALL CMISSField_CreateFinish(GeometricField2,Err)
 934
 935  !Update the geometric field parameters for the first field
 936  DO NODE_NUMBER=1,NUMBER_OF_NODES_SPACE1
 937    DO COMPONENT_NUMBER=1,NUMBER_OF_DIMENSIONS1
 938      VALUE=CM1%N(NODE_NUMBER,COMPONENT_NUMBER)
 939      CALL CMISSField_ParameterSetUpdateNode(GeometricField1,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1, & 
 940        & CMISS_NO_GLOBAL_DERIV,NODE_NUMBER,COMPONENT_NUMBER,VALUE,Err)
 941    ENDDO
 942  ENDDO
 943  CALL CMISSField_ParameterSetUpdateStart(GeometricField1,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,Err)
 944  CALL CMISSField_ParameterSetUpdateFinish(GeometricField1,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,Err)
 945
 946  !Update the geometric field parameters for the second field
 947  DO NODE_NUMBER=1,NUMBER_OF_NODES_SPACE2
 948    DO COMPONENT_NUMBER=1,NUMBER_OF_DIMENSIONS2
 949      VALUE=CM2%N(NODE_NUMBER,COMPONENT_NUMBER)
 950      CALL CMISSField_ParameterSetUpdateNode(GeometricField2,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1, & 
 951        & CMISS_NO_GLOBAL_DERIV,NODE_NUMBER,COMPONENT_NUMBER,VALUE,Err)
 952    ENDDO
 953  ENDDO
 954  CALL CMISSField_ParameterSetUpdateStart(GeometricField2,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,Err)
 955  CALL CMISSField_ParameterSetUpdateFinish(GeometricField2,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,Err)
 956
 957
 958  !
 959  !================================================================================================================================
 960  !
 961
 962  !EQUATIONS SETS
 963
 964   !Create the equations set for the first region
 965  PRINT *, ' == >> CREATING EQUATION SET(1) << == '
 966  CALL CMISSField_Initialise(EquationsSetField1,Err)
 967  CALL CMISSEquationsSet_Initialise(EquationsSet1,Err)
 968  CALL CMISSEquationsSet_CreateStart(EquationsSet1UserNumber,Region1,GeometricField1,CMISS_EQUATIONS_SET_FLUID_MECHANICS_CLASS, &
 969    & CMISS_EQUATIONS_SET_STOKES_EQUATION_TYPE,CMISS_EQUATIONS_SET_STATIC_STOKES_SUBTYPE,EquationsSetField1UserNumber,&
 970    & EquationsSetField1,EquationsSet1,Err)
 971  !Set the equations set to be a standard Stokes problem
 972  !Finish creating the equations set
 973  CALL CMISSEquationsSet_CreateFinish(EquationsSet1,Err)
 974
 975  !Create the equations set for the second region
 976  PRINT *, ' == >> CREATING EQUATION SET(2) << == '
 977  CALL CMISSField_Initialise(EquationsSetField2,Err)
 978  CALL CMISSEquationsSet_Initialise(EquationsSet2,Err)
 979  CALL CMISSEquationsSet_CreateStart(EquationsSet2UserNumber,Region2,GeometricField2,CMISS_EQUATIONS_SET_FLUID_MECHANICS_CLASS, &
 980    & CMISS_EQUATIONS_SET_STOKES_EQUATION_TYPE,CMISS_EQUATIONS_SET_STATIC_STOKES_SUBTYPE,EquationsSetField2UserNumber,&
 981    & EquationsSetField2,EquationsSet2,Err)
 982  !Finish creating the equations set
 983  CALL CMISSEquationsSet_CreateFinish(EquationsSet2,Err)
 984
 985  !
 986  !================================================================================================================================
 987  !
 988
 989  !DEPENDENT FIELDS
 990
 991  !Create the equations set dependent field variables for the first equations set
 992  PRINT *, ' == >> CREATING DEPENDENT FIELD(1) << == '
 993  CALL CMISSField_Initialise(DependentField1,Err)
 994  CALL CMISSEquationsSet_DependentCreateStart(EquationsSet1,DependentField1UserNumber,DependentField1,Err)
 995  !Finish the equations set dependent field variables
 996  CALL CMISSEquationsSet_DependentCreateFinish(EquationsSet1,Err)
 997
 998  !Create the equations set dependent field variables for the second equations set
 999  PRINT *, ' == >> CREATING DEPENDENT FIELD(2) << == '
1000  CALL CMISSField_Initialise(DependentField2,Err)
1001  CALL CMISSEquationsSet_DependentCreateStart(EquationsSet2,DependentField2UserNumber,DependentField2,Err)
1002  !Finish the equations set dependent field variables
1003  CALL CMISSEquationsSet_DependentCreateFinish(EquationsSet2,Err)
1004
1005
1006  !
1007  !================================================================================================================================
1008  !
1009
1010  !MATERIALS FIELDS
1011
1012  !Create the equations set materials field variables for Field 1
1013  CALL CMISSField_Initialise(MaterialsField1,Err)
1014  CALL CMISSEquationsSet_MaterialsCreateStart(EquationsSet1,MaterialsComponentUserNumber1, & 
1015    & MaterialsField1,Err)
1016  !Finish the equations set materials field variables
1017  CALL CMISSEquationsSet_MaterialsCreateFinish(EquationsSet1,Err)
1018
1019  !Create the equations set materials field variables for Field 2
1020  CALL CMISSField_Initialise(MaterialsField2,Err)
1021  CALL CMISSEquationsSet_MaterialsCreateStart(EquationsSet2,MaterialsComponentUserNumber2, & 
1022    & Materia

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