PageRenderTime 87ms CodeModel.GetById 31ms app.highlight 51ms RepoModel.GetById 1ms app.codeStats 0ms

/FiniteElasticity/LargeUniAxialExtension/src/LargeUniAxialExtensionExample.f90

http://github.com/xyan075/examples
FORTRAN Modern | 451 lines | 304 code | 56 blank | 91 comment | 0 complexity | 263e6b65a48406ada2a237094bbd68d7 MD5 | raw file
  1!> \file
  2!> \author Chris Bradley
  3!> \brief This is an example program to solve a finite elasticity equation 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): Kumar Mithraratne, Adam Reeve
 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 FiniteElasticity/LargeUniAxialExtension/src/LargeUniAxialExtensionExample.f90
 43!! Example program to solve a finite elasticity equation using openCMISS calls.
 44!! \par Latest Builds:
 45!! \li <a href='http://autotest.bioeng.auckland.ac.nz/opencmiss-build/logs_x86_64-linux/FiniteElasticity/LargeUniAxialExtension/build-intel'>Linux Intel Build</a>
 46!! \li <a href='http://autotest.bioeng.auckland.ac.nz/opencmiss-build/logs_x86_64-linux/FiniteElasticity/LargeUniAxialExtension/build-gnu'>Linux GNU Build</a>
 47!<
 48
 49!> Main program
 50PROGRAM LARGEUNIAXIALEXTENSIONEXAMPLE
 51
 52  USE OPENCMISS
 53  USE MPI
 54
 55#ifdef WIN32
 56  USE IFQWIN
 57#endif
 58
 59  IMPLICIT NONE
 60
 61  INTEGER(CMISSIntg), PARAMETER :: EquationsSetFieldUserNumber=1337
 62  TYPE(CMISSFieldType) :: EquationsSetField
 63
 64
 65  !Test program parameters
 66
 67  REAL(CMISSDP), PARAMETER :: HEIGHT=1.0_CMISSDP
 68  REAL(CMISSDP), PARAMETER :: WIDTH=1.0_CMISSDP
 69  REAL(CMISSDP), PARAMETER :: LENGTH=1.0_CMISSDP
 70  INTEGER(CMISSIntg), PARAMETER :: InterpolationType=CMISS_BASIS_LINEAR_LAGRANGE_INTERPOLATION
 71  INTEGER(CMISSIntg), PARAMETER :: PressureInterpolationType=CMISS_BASIS_LINEAR_LAGRANGE_INTERPOLATION
 72  LOGICAL, PARAMETER :: UsePressureBasis=.FALSE.
 73  INTEGER(CMISSIntg), PARAMETER :: NumberOfGaussXi=2
 74
 75  INTEGER(CMISSIntg), PARAMETER :: CoordinateSystemUserNumber=1
 76  INTEGER(CMISSIntg), PARAMETER :: RegionUserNumber=1
 77  INTEGER(CMISSIntg), PARAMETER :: BasisUserNumber=1
 78  INTEGER(CMISSIntg), PARAMETER :: PressureBasisUserNumber=2
 79  INTEGER(CMISSIntg), PARAMETER :: GeneratedMeshUserNumber=1
 80  INTEGER(CMISSIntg), PARAMETER :: MeshUserNumber=1
 81  INTEGER(CMISSIntg), PARAMETER :: DecompositionUserNumber=1
 82  INTEGER(CMISSIntg), PARAMETER :: FieldGeometryUserNumber=1
 83  INTEGER(CMISSIntg), PARAMETER :: FieldFibreUserNumber=2
 84  INTEGER(CMISSIntg), PARAMETER :: FieldMaterialUserNumber=3
 85  INTEGER(CMISSIntg), PARAMETER :: FieldDependentUserNumber=4
 86  INTEGER(CMISSIntg), PARAMETER :: EquationSetUserNumber=1
 87  INTEGER(CMISSIntg), PARAMETER :: ProblemUserNumber=1
 88
 89  !Program types
 90
 91  !Program variables
 92
 93  INTEGER(CMISSIntg) :: NumberGlobalXElements,NumberGlobalYElements,NumberGlobalZElements
 94  INTEGER(CMISSIntg) :: EquationsSetIndex
 95  INTEGER(CMISSIntg) :: NumberOfComputationalNodes,NumberOfDomains,ComputationalNodeNumber
 96  INTEGER(CMISSIntg) :: NodeNumber,NodeDomain,node_idx
 97  INTEGER(CMISSIntg),ALLOCATABLE :: BottomSurfaceNodes(:)
 98  INTEGER(CMISSIntg),ALLOCATABLE :: LeftSurfaceNodes(:)
 99  INTEGER(CMISSIntg),ALLOCATABLE :: RightSurfaceNodes(:)
100  INTEGER(CMISSIntg),ALLOCATABLE :: FrontSurfaceNodes(:)
101  INTEGER(CMISSIntg) :: BottomNormalXi,LeftNormalXi,RightNormalXi,BackNormalXi
102
103  !CMISS variables
104  TYPE(CMISSBasisType) :: Basis, PressureBasis
105  TYPE(CMISSBoundaryConditionsType) :: BoundaryConditions
106  TYPE(CMISSCoordinateSystemType) :: CoordinateSystem, WorldCoordinateSystem
107  TYPE(CMISSMeshType) :: Mesh
108  TYPE(CMISSDecompositionType) :: Decomposition
109  TYPE(CMISSEquationsType) :: Equations
110  TYPE(CMISSEquationsSetType) :: EquationsSet
111  TYPE(CMISSFieldType) :: GeometricField,FibreField,MaterialField,DependentField
112  TYPE(CMISSFieldsType) :: Fields
113  TYPE(CMISSGeneratedMeshType) :: GeneratedMesh
114  TYPE(CMISSProblemType) :: Problem
115  TYPE(CMISSRegionType) :: Region,WorldRegion
116  TYPE(CMISSSolverType) :: Solver,LinearSolver
117  TYPE(CMISSSolverEquationsType) :: SolverEquations
118
119#ifdef WIN32
120  !Quickwin type
121  LOGICAL :: QUICKWIN_STATUS=.FALSE.
122  TYPE(WINDOWCONFIG) :: QUICKWIN_WINDOW_CONFIG
123#endif
124
125  !Generic CMISS variables
126  INTEGER(CMISSIntg) :: Err
127
128#ifdef WIN32
129  !Initialise QuickWin
130  QUICKWIN_WINDOW_CONFIG%TITLE="General Output" !Window title
131  QUICKWIN_WINDOW_CONFIG%NUMTEXTROWS=-1 !Max possible number of rows
132  QUICKWIN_WINDOW_CONFIG%MODE=QWIN$SCROLLDOWN
133  !Set the window parameters
134  QUICKWIN_STATUS=SETWINDOWCONFIG(QUICKWIN_WINDOW_CONFIG)
135  !If attempt fails set with system estimated values
136  IF(.NOT.QUICKWIN_STATUS) QUICKWIN_STATUS=SETWINDOWCONFIG(QUICKWIN_WINDOW_CONFIG)
137#endif
138
139  !Intialise cmiss
140  CALL CMISSInitialise(WorldCoordinateSystem,WorldRegion,Err)
141
142  CALL CMISSErrorHandlingModeSet(CMISS_ERRORS_TRAP_ERROR,Err)
143
144  !Set all diganostic levels on for testing
145  !CALL CMISSDiagnosticsSetOn(CMISS_FROM_DIAG_TYPE,(/1,2,3,4,5/),"Diagnostics",(/"PROBLEM_RESIDUAL_EVALUATE"/),Err)
146
147  !Get the number of computational nodes and this computational node number
148  CALL CMISSComputationalNumberOfNodesGet(NumberOfComputationalNodes,Err)
149  CALL CMISSComputationalNodeNumberGet(ComputationalNodeNumber,Err)
150
151  NumberGlobalXElements=5
152  NumberGlobalYElements=5
153  NumberGlobalZElements=5
154  NumberOfDomains=NumberOfComputationalNodes
155
156  !Create a 3D rectangular cartesian coordinate system
157  CALL CMISSCoordinateSystem_Initialise(CoordinateSystem,Err)
158  CALL CMISSCoordinateSystem_CreateStart(CoordinateSystemUserNumber,CoordinateSystem,Err)
159  CALL CMISSCoordinateSystem_CreateFinish(CoordinateSystem,Err)
160
161  !Create a region and assign the coordinate system to the region
162  CALL CMISSRegion_Initialise(Region,Err)
163  CALL CMISSRegion_CreateStart(RegionUserNumber,WorldRegion,Region,Err)
164  CALL CMISSRegion_CoordinateSystemSet(Region,CoordinateSystem,Err)
165  CALL CMISSRegion_CreateFinish(Region,Err)
166
167  !Define geometric basis
168  CALL CMISSBasis_Initialise(Basis,Err)
169  CALL CMISSBasis_CreateStart(BasisUserNumber,Basis,Err)
170  SELECT CASE(InterpolationType)
171  CASE(1,2,3,4)
172    CALL CMISSBasis_TypeSet(Basis,CMISS_BASIS_LAGRANGE_HERMITE_TP_TYPE,Err)
173  CASE(7,8,9)
174    CALL CMISSBasis_TypeSet(Basis,CMISS_BASIS_SIMPLEX_TYPE,Err)
175  END SELECT
176  IF(NumberGlobalZElements==0) THEN
177    CALL CMISSBasis_NumberOfXiSet(Basis,2,Err)
178    CALL CMISSBasis_InterpolationXiSet(Basis,[InterpolationType,InterpolationType],Err)
179    IF(NumberOfGaussXi>0) THEN
180      CALL CMISSBasis_QuadratureNumberOfGaussXiSet(Basis,[NumberOfGaussXi,NumberOfGaussXi],Err)
181    ENDIF
182  ELSE
183    CALL CMISSBasis_NumberOfXiSet(Basis,3,Err)
184    CALL CMISSBasis_InterpolationXiSet(Basis,[InterpolationType,InterpolationType,InterpolationType],Err)
185    IF(NumberOfGaussXi>0) THEN
186      CALL CMISSBasis_QuadratureNumberOfGaussXiSet(Basis,[NumberOfGaussXi,NumberOfGaussXi,NumberOfGaussXi],Err)
187    ENDIF
188  ENDIF
189  CALL CMISSBasis_CreateFinish(Basis,Err)
190
191  !Define pressure basis
192  IF(UsePressureBasis) THEN
193    CALL CMISSBasis_Initialise(PressureBasis,Err)
194    CALL CMISSBasis_CreateStart(PressureBasisUserNumber,PressureBasis,Err)
195    SELECT CASE(PressureInterpolationType)
196    CASE(1,2,3,4)
197      CALL CMISSBasis_TypeSet(PressureBasis,CMISS_BASIS_LAGRANGE_HERMITE_TP_TYPE,Err)
198    CASE(7,8,9)
199      CALL CMISSBasis_TypeSet(PressureBasis,CMISS_BASIS_SIMPLEX_TYPE,Err)
200    END SELECT
201    IF(NumberGlobalZElements==0) THEN
202      CALL CMISSBasis_NumberOfXiSet(PressureBasis,2,Err)
203      CALL CMISSBasis_InterpolationXiSet(PressureBasis,[PressureInterpolationType,PressureInterpolationType],Err)
204      IF(NumberOfGaussXi>0) THEN
205        CALL CMISSBasis_QuadratureNumberOfGaussXiSet(PressureBasis,[NumberOfGaussXi,NumberOfGaussXi],Err)
206      ENDIF
207    ELSE
208      CALL CMISSBasis_NumberOfXiSet(PressureBasis,3,Err)
209      CALL CMISSBasis_InterpolationXiSet(PressureBasis, &
210        & [PressureInterpolationType,PressureInterpolationType,PressureInterpolationType],Err)
211      IF(NumberOfGaussXi>0) THEN
212        CALL CMISSBasis_QuadratureNumberOfGaussXiSet(PressureBasis,[NumberOfGaussXi,NumberOfGaussXi,NumberOfGaussXi],Err)
213      ENDIF
214    ENDIF
215    CALL CMISSBasis_CreateFinish(PressureBasis,Err)
216  ENDIF
217
218  !Start the creation of a generated mesh in the region
219  CALL CMISSGeneratedMesh_Initialise(GeneratedMesh,Err)
220  CALL CMISSGeneratedMesh_CreateStart(GeneratedMeshUserNumber,Region,GeneratedMesh,Err)
221  !Set up a regular x*y*z mesh
222  CALL CMISSGeneratedMesh_TypeSet(GeneratedMesh,CMISS_GENERATED_MESH_REGULAR_MESH_TYPE,Err)
223  !Set the default basis
224  IF(UsePressureBasis) THEN
225    CALL CMISSGeneratedMesh_BasisSet(GeneratedMesh,[Basis,PressureBasis],Err)
226  ELSE
227    CALL CMISSGeneratedMesh_BasisSet(GeneratedMesh,[Basis],Err)
228  ENDIF
229  !Define the mesh on the region
230  IF(NumberGlobalXElements==0) THEN
231    CALL CMISSGeneratedMesh_ExtentSet(GeneratedMesh,(/WIDTH,HEIGHT/),Err)
232    CALL CMISSGeneratedMesh_NumberOfElementsSet(GeneratedMesh,(/NumberGlobalXElements,NumberGlobalYElements/),Err)
233  ELSE
234    CALL CMISSGeneratedMesh_ExtentSet(GeneratedMesh,(/WIDTH,HEIGHT,LENGTH/),Err)
235    CALL CMISSGeneratedMesh_NumberOfElementsSet(GeneratedMesh,(/NumberGlobalXElements,NumberGlobalYElements, &
236      & NumberGlobalZElements/),Err)
237  ENDIF
238  !Finish the creation of a generated mesh in the region
239  CALL CMISSMesh_Initialise(Mesh,Err)
240  CALL CMISSGeneratedMesh_CreateFinish(GeneratedMesh,MeshUserNumber,Mesh,Err)
241
242  !Create a decomposition
243  CALL CMISSDecomposition_Initialise(Decomposition,Err)
244  CALL CMISSDecomposition_CreateStart(DecompositionUserNumber,Mesh,Decomposition,Err)
245  CALL CMISSDecomposition_TypeSet(Decomposition,CMISS_DECOMPOSITION_CALCULATED_TYPE,Err)
246  CALL CMISSDecomposition_NumberOfDomainsSet(Decomposition,NumberOfDomains,Err)
247  CALL CMISSDecomposition_CreateFinish(Decomposition,Err)
248
249  !Create a field to put the geometry (defualt is geometry)
250  CALL CMISSField_Initialise(GeometricField,Err)
251  CALL CMISSField_CreateStart(FieldGeometryUserNumber,Region,GeometricField,Err)
252  CALL CMISSField_MeshDecompositionSet(GeometricField,Decomposition,Err)
253  CALL CMISSField_VariableLabelSet(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,"Geometry",Err)
254  CALL CMISSField_ScalingTypeSet(GeometricField,CMISS_FIELD_ARITHMETIC_MEAN_SCALING,Err)
255  CALL CMISSField_CreateFinish(GeometricField,Err)
256
257  !Update the geometric field parameters
258  CALL CMISSGeneratedMesh_GeometricParametersCalculate(GeneratedMesh,GeometricField,Err)
259
260  !Create a fibre field and attach it to the geometric field
261  CALL CMISSField_Initialise(FibreField,Err)
262  CALL CMISSField_CreateStart(FieldFibreUserNumber,Region,FibreField,Err)
263  CALL CMISSField_TypeSet(FibreField,CMISS_FIELD_FIBRE_TYPE,Err)
264  CALL CMISSField_MeshDecompositionSet(FibreField,Decomposition,Err)
265  CALL CMISSField_GeometricFieldSet(FibreField,GeometricField,Err)
266  CALL CMISSField_VariableLabelSet(FibreField,CMISS_FIELD_U_VARIABLE_TYPE,"Fibre",Err)
267  CALL CMISSField_CreateFinish(FibreField,Err)
268
269  !Create the equations_set
270  CALL CMISSField_Initialise(EquationsSetField,Err)
271  CALL CMISSEquationsSet_CreateStart(EquationSetUserNumber,Region,FibreField,CMISS_EQUATIONS_SET_ELASTICITY_CLASS, &
272    & CMISS_EQUATIONS_SET_FINITE_ELASTICITY_TYPE,CMISS_EQUATIONS_SET_MOONEY_RIVLIN_SUBTYPE,EquationsSetFieldUserNumber, &
273      & EquationsSetField, &
274    & EquationsSet,Err)
275  CALL CMISSEquationsSet_CreateFinish(EquationsSet,Err)
276
277  !Create the dependent field
278  CALL CMISSField_Initialise(DependentField,Err)
279  CALL CMISSEquationsSet_DependentCreateStart(EquationsSet,FieldDependentUserNumber,DependentField,Err)
280  CALL CMISSField_VariableLabelSet(DependentField,CMISS_FIELD_U_VARIABLE_TYPE,"Dependent",Err)
281  IF(UsePressureBasis) THEN
282    !Set the pressure to be nodally based and use the second mesh component if required
283    CALL CMISSField_ComponentInterpolationSet(DependentField,CMISS_FIELD_U_VARIABLE_TYPE,4,CMISS_FIELD_NODE_BASED_INTERPOLATION,Err)
284    CALL CMISSField_ComponentInterpolationSet(DependentField,CMISS_FIELD_DELUDELN_VARIABLE_TYPE,4, &
285      & CMISS_FIELD_NODE_BASED_INTERPOLATION,Err)
286    CALL CMISSField_ComponentMeshComponentSet(DependentField,CMISS_FIELD_U_VARIABLE_TYPE,4,2,Err)
287    CALL CMISSField_ComponentMeshComponentSet(DependentField,CMISS_FIELD_DELUDELN_VARIABLE_TYPE,4,2,Err)
288  END IF
289  CALL CMISSEquationsSet_DependentCreateFinish(EquationsSet,Err)
290
291  !Create the material field
292  CALL CMISSField_Initialise(MaterialField,Err)
293  CALL CMISSEquationsSet_MaterialsCreateStart(EquationsSet,FieldMaterialUserNumber,MaterialField,Err)
294  CALL CMISSField_VariableLabelSet(MaterialField,CMISS_FIELD_U_VARIABLE_TYPE,"Material",Err)
295  CALL CMISSEquationsSet_MaterialsCreateFinish(EquationsSet,Err)
296
297  !Set Mooney-Rivlin constants c10 and c01 to 2.0 and 6.0 respectively.
298  CALL CMISSField_ComponentValuesInitialise(MaterialField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,2.0_CMISSDP,Err)
299  CALL CMISSField_ComponentValuesInitialise(MaterialField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,2,6.0_CMISSDP,Err)
300
301  !Create the equations set equations
302  CALL CMISSEquations_Initialise(Equations,Err)
303  CALL CMISSEquationsSet_EquationsCreateStart(EquationsSet,Equations,Err)
304  CALL CMISSEquations_SparsityTypeSet(Equations,CMISS_EQUATIONS_SPARSE_MATRICES,Err)
305  CALL CMISSEquations_OutputTypeSet(Equations,CMISS_EQUATIONS_NO_OUTPUT,Err)
306  CALL CMISSEquationsSet_EquationsCreateFinish(EquationsSet,Err)
307
308  !Initialise dependent field from undeformed geometry and displacement bcs and set hydrostatic pressure
309  CALL CMISSField_ParametersToFieldParametersComponentCopy(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE, &
310    & 1,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,Err)
311  CALL CMISSField_ParametersToFieldParametersComponentCopy(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE, &
312    & 2,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,2,Err)
313  CALL CMISSField_ParametersToFieldParametersComponentCopy(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE, &
314    & 3,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,3,Err)
315  CALL CMISSField_ComponentValuesInitialise(DependentField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,4,-8.0_CMISSDP, &
316    & Err)
317
318  !Define the problem
319  CALL CMISSProblem_Initialise(Problem,Err)
320  CALL CMISSProblem_CreateStart(ProblemUserNumber,Problem,Err)
321  CALL CMISSProblem_SpecificationSet(Problem,CMISS_PROBLEM_ELASTICITY_CLASS,CMISS_PROBLEM_FINITE_ELASTICITY_TYPE, &
322    & CMISS_PROBLEM_NO_SUBTYPE,Err)
323  CALL CMISSProblem_CreateFinish(Problem,Err)
324
325  !Create the problem control loop
326  CALL CMISSProblem_ControlLoopCreateStart(Problem,Err)
327  CALL CMISSProblem_ControlLoopCreateFinish(Problem,Err)
328
329  !Create the problem solvers
330  CALL CMISSSolver_Initialise(Solver,Err)
331  CALL CMISSSolver_Initialise(LinearSolver,Err)
332  CALL CMISSProblem_SolversCreateStart(Problem,Err)
333  CALL CMISSProblem_SolverGet(Problem,CMISS_CONTROL_LOOP_NODE,1,Solver,Err)
334  CALL CMISSSolver_OutputTypeSet(Solver,CMISS_SOLVER_PROGRESS_OUTPUT,Err)
335  CALL CMISSSolver_NewtonJacobianCalculationTypeSet(Solver,CMISS_SOLVER_NEWTON_JACOBIAN_EQUATIONS_CALCULATED,Err)
336  CALL CMISSSolver_NewtonLinearSolverGet(Solver,LinearSolver,Err)
337  CALL CMISSSolver_LinearTypeSet(LinearSolver,CMISS_SOLVER_LINEAR_DIRECT_SOLVE_TYPE,Err)
338  CALL CMISSProblem_SolversCreateFinish(Problem,Err)
339
340  !Create the problem solver equations
341  CALL CMISSSolver_Initialise(Solver,Err)
342  CALL CMISSSolverEquations_Initialise(SolverEquations,Err)
343  CALL CMISSProblem_SolverEquationsCreateStart(Problem,Err)
344  CALL CMISSProblem_SolverGet(Problem,CMISS_CONTROL_LOOP_NODE,1,Solver,Err)
345  CALL CMISSSolver_SolverEquationsGet(Solver,SolverEquations,Err)
346  CALL CMISSSolverEquations_EquationsSetAdd(SolverEquations,EquationsSet,EquationsSetIndex,Err)
347  CALL CMISSProblem_SolverEquationsCreateFinish(Problem,Err)
348
349  !Prescribe boundary conditions (absolute nodal parameters)
350  CALL CMISSBoundaryConditions_Initialise(BoundaryConditions,Err)
351  CALL CMISSSolverEquations_BoundaryConditionsCreateStart(SolverEquations,BoundaryConditions,Err)
352
353  CALL CMISSGeneratedMesh_SurfaceGet(GeneratedMesh,CMISS_GENERATED_MESH_REGULAR_BOTTOM_SURFACE,BottomSurfaceNodes,BottomNormalXi, &
354    & Err)
355  CALL CMISSGeneratedMesh_SurfaceGet(GeneratedMesh,CMISS_GENERATED_MESH_REGULAR_LEFT_SURFACE,LeftSurfaceNodes,LeftNormalXi,Err)
356  CALL CMISSGeneratedMesh_SurfaceGet(GeneratedMesh,CMISS_GENERATED_MESH_REGULAR_RIGHT_SURFACE,RightSurfaceNodes,RightNormalXi,Err)
357  CALL CMISSGeneratedMesh_SurfaceGet(GeneratedMesh,CMISS_GENERATED_MESH_REGULAR_FRONT_SURFACE,FrontSurfaceNodes,BackNormalXi,Err)
358
359  !Set x=0 nodes to no x displacment in x. Set x=WIDTH nodes to 10% x displacement
360  DO node_idx=1,SIZE(LeftSurfaceNodes,1)
361    NodeNumber=LeftSurfaceNodes(node_idx)
362    CALL CMISSDecomposition_NodeDomainGet(Decomposition,NodeNumber,1,NodeDomain,Err)
363    IF(NodeDomain==ComputationalNodeNumber) THEN
364      CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1,1,NodeNumber,1, &
365        & CMISS_BOUNDARY_CONDITION_FIXED,0.0_CMISSDP,Err)
366    ENDIF
367  ENDDO
368
369  DO node_idx=1,SIZE(RightSurfaceNodes,1)
370    NodeNumber=RightSurfaceNodes(node_idx)
371    CALL CMISSDecomposition_NodeDomainGet(Decomposition,NodeNumber,1,NodeDomain,Err)
372    IF(NodeDomain==ComputationalNodeNumber) THEN
373      CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1,1,NodeNumber,1, &
374        & CMISS_BOUNDARY_CONDITION_FIXED,1.1_CMISSDP*WIDTH,Err)
375    ENDIF
376  ENDDO
377
378  !Set y=0 nodes to no y displacement
379  DO node_idx=1,SIZE(FrontSurfaceNodes,1)
380    NodeNumber=FrontSurfaceNodes(node_idx)
381    CALL CMISSDecomposition_NodeDomainGet(Decomposition,NodeNumber,1,NodeDomain,Err)
382    IF(NodeDomain==ComputationalNodeNumber) THEN
383      CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1,1,NodeNumber,2, &
384        & CMISS_BOUNDARY_CONDITION_FIXED,0.0_CMISSDP,Err)
385    ENDIF
386  ENDDO
387
388  !Set z=0 nodes to no z displacement
389  DO node_idx=1,SIZE(BottomSurfaceNodes,1)
390    NodeNumber=BottomSurfaceNodes(node_idx)
391    CALL CMISSDecomposition_NodeDomainGet(Decomposition,NodeNumber,1,NodeDomain,Err)
392    IF(NodeDomain==ComputationalNodeNumber) THEN
393      CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1,1,NodeNumber,3, &
394        & CMISS_BOUNDARY_CONDITION_FIXED,0.0_CMISSDP,Err)
395    ENDIF
396  ENDDO
397
398  IF(InterpolationType==CMISS_BASIS_CUBIC_HERMITE_INTERPOLATION) THEN
399    !Fix x derivatives at x=0 and x=1 in xi2 and xi3
400    DO node_idx=1,SIZE(LeftSurfaceNodes,1)
401      NodeNumber=LeftSurfaceNodes(node_idx)
402      CALL CMISSDecomposition_NodeDomainGet(Decomposition,NodeNumber,1,NodeDomain,Err)
403      IF(NodeDomain==ComputationalNodeNumber) THEN
404        CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1, &
405          & CMISS_GLOBAL_DERIV_S2, &
406          & NodeNumber,1,CMISS_BOUNDARY_CONDITION_FIXED,0.0_CMISSDP,Err)
407        CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1, &
408          & CMISS_GLOBAL_DERIV_S3, &
409          & NodeNumber,1,CMISS_BOUNDARY_CONDITION_FIXED,0.0_CMISSDP,Err)
410        CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1, &
411          & CMISS_GLOBAL_DERIV_S2_S3, &
412          & NodeNumber,1,CMISS_BOUNDARY_CONDITION_FIXED,0.0_CMISSDP,Err)
413      ENDIF
414    ENDDO
415    DO node_idx=1,SIZE(RightSurfaceNodes,1)
416      NodeNumber=RightSurfaceNodes(node_idx)
417      CALL CMISSDecomposition_NodeDomainGet(Decomposition,NodeNumber,1,NodeDomain,Err)
418      IF(NodeDomain==ComputationalNodeNumber) THEN
419        CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1, &
420          & CMISS_GLOBAL_DERIV_S2, &
421          & NodeNumber,1,CMISS_BOUNDARY_CONDITION_FIXED,0.0_CMISSDP,Err)
422        CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1, &
423          & CMISS_GLOBAL_DERIV_S3, &
424          & NodeNumber,1,CMISS_BOUNDARY_CONDITION_FIXED,0.0_CMISSDP,Err)
425        CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1, &
426          & CMISS_GLOBAL_DERIV_S2_S3, &
427          & NodeNumber,1,CMISS_BOUNDARY_CONDITION_FIXED,0.0_CMISSDP,Err)
428      ENDIF
429    ENDDO
430  ENDIF
431
432  CALL CMISSSolverEquations_BoundaryConditionsCreateFinish(SolverEquations,Err)
433
434  !Solve problem
435  CALL CMISSProblem_Solve(Problem,Err)
436
437  !Output solution
438  CALL CMISSFields_Initialise(Fields,Err)
439  CALL CMISSFields_Create(Region,Fields,Err)
440  CALL CMISSFields_NodesExport(Fields,"LargeUniaxialExtension","FORTRAN",Err)
441  CALL CMISSFields_ElementsExport(Fields,"LargeUniaxialExtension","FORTRAN",Err)
442  CALL CMISSFields_Finalise(Fields,Err)
443
444  CALL CMISSFinalise(Err)
445
446  WRITE(*,'(A)') "Program successfully completed."
447
448  STOP
449
450END PROGRAM LARGEUNIAXIALEXTENSIONEXAMPLE
451