PageRenderTime 71ms CodeModel.GetById 20ms app.highlight 46ms RepoModel.GetById 1ms app.codeStats 0ms

/FiniteElasticity/UniAxialExtensionCompressible/src/UniAxialExtensionCompressibleExample.f90

http://github.com/xyan075/examples
FORTRAN Modern | 485 lines | 322 code | 67 blank | 96 comment | 0 complexity | dec403456a12b10f6d659ef0723c957e 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/UniAxialExtension/src/UniAxialExtensionExample.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/UniAxialExtension/build-intel'>Linux Intel Build</a>
 46!! \li <a href='http://autotest.bioeng.auckland.ac.nz/opencmiss-build/logs_x86_64-linux/FiniteElasticity/UniAxialExtension/build-gnu'>Linux GNU Build</a>
 47!<
 48
 49!> Main program
 50PROGRAM UNIAXIALEXTENSIONEXAMPLE
 51
 52  USE OPENCMISS
 53  USE MPI
 54
 55#ifdef WIN32
 56  USE IFQWIN
 57#endif
 58
 59  IMPLICIT NONE
 60
 61  !Test program parameters
 62
 63  REAL(CMISSDP), PARAMETER :: HEIGHT=1.0_CMISSDP
 64  REAL(CMISSDP), PARAMETER :: WIDTH=1.0_CMISSDP
 65  REAL(CMISSDP), PARAMETER :: LENGTH=1.0_CMISSDP
 66
 67  INTEGER(CMISSIntg), PARAMETER :: CoordinateSystemUserNumber=1
 68  INTEGER(CMISSIntg), PARAMETER :: NumberOfSpatialCoordinates=3
 69  INTEGER(CMISSIntg), PARAMETER :: RegionUserNumber=1
 70  INTEGER(CMISSIntg), PARAMETER :: BasisUserNumber=1
 71  INTEGER(CMISSIntg), PARAMETER :: MeshUserNumber=1
 72  INTEGER(CMISSIntg), PARAMETER :: DecompositionUserNumber=1
 73
 74  INTEGER(CMISSIntg), PARAMETER :: NumberOfXiCoordinates=3
 75  INTEGER(CMISSIntg), PARAMETER :: TotalNumberOfNodes=8
 76  INTEGER(CMISSIntg), PARAMETER :: NumberOfMeshDimensions=3
 77  INTEGER(CMISSIntg), PARAMETER :: NumberOfMeshComponents=1
 78  INTEGER(CMISSIntg), PARAMETER :: TotalNumberOfElements=1
 79  INTEGER(CMISSIntg), PARAMETER :: MeshComponentNumber=1
 80
 81  INTEGER(CMISSIntg), PARAMETER :: FieldGeometryUserNumber=1
 82  INTEGER(CMISSIntg), PARAMETER :: FieldGeometryNumberOfVariables=1
 83  INTEGER(CMISSIntg), PARAMETER :: FieldGeometryNumberOfComponents=3
 84
 85  INTEGER(CMISSIntg), PARAMETER :: FieldFibreUserNumber=2
 86  INTEGER(CMISSIntg), PARAMETER :: FieldFibreNumberOfVariables=1
 87  INTEGER(CMISSIntg), PARAMETER :: FieldFibreNumberOfComponents=3
 88
 89  INTEGER(CMISSIntg), PARAMETER :: FieldMaterialUserNumber=3
 90  INTEGER(CMISSIntg), PARAMETER :: FieldMaterialNumberOfVariables=1
 91  INTEGER(CMISSIntg), PARAMETER :: FieldMaterialNumberOfComponents=3
 92
 93  INTEGER(CMISSIntg), PARAMETER :: FieldDependentUserNumber=4
 94  INTEGER(CMISSIntg), PARAMETER :: FieldDependentNumberOfVariables=2
 95  INTEGER(CMISSIntg), PARAMETER :: FieldDependentNumberOfComponents=3
 96
 97  INTEGER(CMISSIntg), PARAMETER :: EquationSetUserNumber=1
 98  INTEGER(CMISSIntg), PARAMETER :: EquationsSetFieldUserNumber=13
 99  INTEGER(CMISSIntg), PARAMETER :: ProblemUserNumber=1
100
101  !Program types
102
103
104  !Program variables
105
106  INTEGER(CMISSIntg) :: NumberGlobalXElements,NumberGlobalYElements,NumberGlobalZElements
107  INTEGER(CMISSIntg) :: MPI_IERROR
108  INTEGER(CMISSIntg) :: EquationsSetIndex  
109  INTEGER(CMISSIntg) :: NumberOfComputationalNodes,NumberOfDomains,ComputationalNodeNumber
110
111  !CMISS variables
112
113  TYPE(CMISSBasisType) :: Basis
114  TYPE(CMISSBoundaryConditionsType) :: BoundaryConditions
115  TYPE(CMISSCoordinateSystemType) :: CoordinateSystem, WorldCoordinateSystem
116  TYPE(CMISSMeshType) :: Mesh
117  TYPE(CMISSDecompositionType) :: Decomposition
118  TYPE(CMISSEquationsType) :: Equations
119  TYPE(CMISSEquationsSetType) :: EquationsSet
120  TYPE(CMISSFieldType) :: GeometricField,FibreField,MaterialField,DependentField,EquationsSetField
121  TYPE(CMISSFieldsType) :: Fields
122  TYPE(CMISSProblemType) :: Problem
123  TYPE(CMISSRegionType) :: Region,WorldRegion
124  TYPE(CMISSSolverType) :: Solver
125  TYPE(CMISSSolverEquationsType) :: SolverEquations
126  TYPE(CMISSNodesType) :: Nodes
127  TYPE(CMISSMeshElementsType) :: Elements
128
129  !REAL(CMISSDP), POINTER :: FieldData(:)
130
131#ifdef WIN32
132  !Quickwin type
133  LOGICAL :: QUICKWIN_STATUS=.FALSE.
134  TYPE(WINDOWCONFIG) :: QUICKWIN_WINDOW_CONFIG
135#endif
136
137  !Generic CMISS variables
138  INTEGER(CMISSIntg) :: Err
139
140#ifdef WIN32
141  !Initialise QuickWin
142  QUICKWIN_WINDOW_CONFIG%TITLE="General Output" !Window title
143  QUICKWIN_WINDOW_CONFIG%NUMTEXTROWS=-1 !Max possible number of rows
144  QUICKWIN_WINDOW_CONFIG%MODE=QWIN$SCROLLDOWN
145  !Set the window parameters
146  QUICKWIN_STATUS=SETWINDOWCONFIG(QUICKWIN_WINDOW_CONFIG)
147  !If attempt fails set with system estimated values
148  IF(.NOT.QUICKWIN_STATUS) QUICKWIN_STATUS=SETWINDOWCONFIG(QUICKWIN_WINDOW_CONFIG)
149#endif
150
151  !Intialise cmiss
152  CALL CMISSInitialise(WorldCoordinateSystem,WorldRegion,Err)
153
154  CALL CMISSErrorHandlingModeSet(CMISS_ERRORS_TRAP_ERROR,Err)
155
156  WRITE(*,'(A)') "Program starting."
157
158  !Set all diganostic levels on for testing
159  CALL CMISSDiagnosticsSetOn(CMISS_FROM_DIAG_TYPE,(/1,2,3,4,5/),"Diagnostics",(/"PROBLEM_FINITE_ELEMENT_CALCULATE"/),Err)
160
161  !Get the number of computational nodes and this computational node number
162  CALL CMISSComputationalNumberOfNodesGet(NumberOfComputationalNodes,Err)
163  CALL CMISSComputationalNodeNumberGet(ComputationalNodeNumber,Err)
164
165  NumberGlobalXElements=1
166  NumberGlobalYElements=1
167  NumberGlobalZElements=1   
168  NumberOfDomains=1
169
170  !Broadcast the number of elements in the X,Y and Z directions and the number of partitions to the other computational nodes
171  CALL MPI_BCAST(NumberGlobalXElements,1,MPI_INTEGER,0,MPI_COMM_WORLD,MPI_IERROR)
172  CALL MPI_BCAST(NumberGlobalYElements,1,MPI_INTEGER,0,MPI_COMM_WORLD,MPI_IERROR)
173  CALL MPI_BCAST(NumberGlobalZElements,1,MPI_INTEGER,0,MPI_COMM_WORLD,MPI_IERROR)
174  CALL MPI_BCAST(NumberOfDomains,1,MPI_INTEGER,0,MPI_COMM_WORLD,MPI_IERROR)
175
176  !Create a CS - default is 3D rectangular cartesian CS with 0,0,0 as origin
177  CALL CMISSCoordinateSystem_Initialise(CoordinateSystem,Err)
178  CALL CMISSCoordinateSystem_CreateStart(CoordinateSystemUserNumber,CoordinateSystem,Err)
179  CALL CMISSCoordinateSystem_TypeSet(CoordinateSystem,CMISS_COORDINATE_RECTANGULAR_CARTESIAN_TYPE,Err)
180  CALL CMISSCoordinateSystem_DimensionSet(CoordinateSystem,NumberOfSpatialCoordinates,Err)
181  CALL CMISSCoordinateSystem_OriginSet(CoordinateSystem,(/0.0_CMISSDP,0.0_CMISSDP,0.0_CMISSDP/),Err)
182  CALL CMISSCoordinateSystem_CreateFinish(CoordinateSystem,Err)
183
184  !Create a region and assign the CS to the region
185  CALL CMISSRegion_Initialise(Region,Err)
186  CALL CMISSRegion_CreateStart(RegionUserNumber,WorldRegion,Region,Err)
187  CALL CMISSRegion_CoordinateSystemSet(Region,CoordinateSystem,Err)
188  CALL CMISSRegion_CreateFinish(Region,Err)
189
190  !Define basis function - tri-linear Lagrange  
191  CALL CMISSBasis_Initialise(Basis,Err)
192  CALL CMISSBasis_CreateStart(BasisUserNumber,Basis,Err) 
193  CALL CMISSBasis_TypeSet(Basis,CMISS_BASIS_LAGRANGE_HERMITE_TP_TYPE,Err)
194  CALL CMISSBasis_NumberOfXiSet(Basis,NumberOfXiCoordinates,Err)
195  CALL CMISSBasis_InterpolationXiSet(Basis,(/CMISS_BASIS_LINEAR_LAGRANGE_INTERPOLATION, &
196    & CMISS_BASIS_LINEAR_LAGRANGE_INTERPOLATION,CMISS_BASIS_LINEAR_LAGRANGE_INTERPOLATION/),Err)
197  CALL CMISSBasis_QuadratureNumberOfGaussXiSet(Basis, &
198    & (/CMISS_BASIS_MID_QUADRATURE_SCHEME,CMISS_BASIS_MID_QUADRATURE_SCHEME,CMISS_BASIS_MID_QUADRATURE_SCHEME/),Err)  
199  CALL CMISSBasis_CreateFinish(Basis,Err)
200
201  !Create a mesh
202  CALL CMISSMesh_Initialise(Mesh,Err)
203  CALL CMISSMesh_CreateStart(MeshUserNumber,Region,NumberOfMeshDimensions,Mesh,Err)    
204
205  CALL CMISSMesh_NumberOfComponentsSet(Mesh,NumberOfMeshComponents,Err) 
206  CALL CMISSMesh_NumberOfElementsSet(Mesh,TotalNumberOfElements,Err)  
207
208  !Define nodes for the mesh
209  CALL CMISSNodes_Initialise(Nodes,Err)
210  CALL CMISSNodes_CreateStart(Region,TotalNumberOfNodes,Nodes,Err)
211  CALL CMISSNodes_CreateFinish(Nodes,Err)
212
213  CALL CMISSMeshElements_Initialise(Elements,Err)
214  CALL CMISSMeshElements_CreateStart(Mesh,MeshComponentNumber,Basis,Elements,Err)
215  CALL CMISSMeshElements_NodesSet(Elements,1,(/1,2,3,4,5,6,7,8/),Err)
216  CALL CMISSMeshElements_CreateFinish(Elements,Err)
217
218  CALL CMISSMesh_CreateFinish(Mesh,Err) 
219
220  !Create a decomposition
221  CALL CMISSDecomposition_Initialise(Decomposition,Err)
222  CALL CMISSDecomposition_CreateStart(DecompositionUserNumber,Mesh,Decomposition,Err)
223  CALL CMISSDecomposition_TypeSet(Decomposition,CMISS_DECOMPOSITION_CALCULATED_TYPE,Err)
224  CALL CMISSDecomposition_NumberOfDomainsSet(Decomposition,NumberOfDomains,Err)
225  CALL CMISSDecomposition_CreateFinish(Decomposition,Err)
226
227  !Create a field to put the geometry (defualt is geometry)
228  CALL CMISSField_Initialise(GeometricField,Err)
229  CALL CMISSField_CreateStart(FieldGeometryUserNumber,Region,GeometricField,Err)
230  CALL CMISSField_MeshDecompositionSet(GeometricField,Decomposition,Err)
231  CALL CMISSField_TypeSet(GeometricField,CMISS_FIELD_GEOMETRIC_TYPE,Err)  
232  CALL CMISSField_NumberOfVariablesSet(GeometricField,FieldGeometryNumberOfVariables,Err)
233  CALL CMISSField_NumberOfComponentsSet(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,FieldGeometryNumberOfComponents,Err)  
234  CALL CMISSField_ComponentMeshComponentSet(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,1,MeshComponentNumber,Err)
235  CALL CMISSField_ComponentMeshComponentSet(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,2,MeshComponentNumber,Err)
236  CALL CMISSField_ComponentMeshComponentSet(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,3,MeshComponentNumber,Err)
237  CALL CMISSField_CreateFinish(GeometricField,Err)
238
239  !node 1
240  CALL CMISSField_ParameterSetUpdateNode(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,1,1,1, &
241    & 0.0_CMISSDP,Err)
242  CALL CMISSField_ParameterSetUpdateNode(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,1,1,2, &
243    & 0.0_CMISSDP,Err)
244  CALL CMISSField_ParameterSetUpdateNode(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,1,1,3, &
245    & 0.0_CMISSDP,Err)
246  !node 2
247  CALL CMISSField_ParameterSetUpdateNode(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,1,2,1, &
248    & 1.0_CMISSDP,Err)
249  CALL CMISSField_ParameterSetUpdateNode(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,1,2,2, &
250    & 0.0_CMISSDP,Err)
251  CALL CMISSField_ParameterSetUpdateNode(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,1,2,3, &
252    & 0.0_CMISSDP,Err)
253  !node 3
254  CALL CMISSField_ParameterSetUpdateNode(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,1,3,1, &
255    & 0.0_CMISSDP,Err)
256  CALL CMISSField_ParameterSetUpdateNode(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,1,3,2, &
257    & 1.0_CMISSDP,Err)
258  CALL CMISSField_ParameterSetUpdateNode(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,1,3,3, &
259    & 0.0_CMISSDP,Err)
260  !node 4
261  CALL CMISSField_ParameterSetUpdateNode(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,1,4,1, &
262    & 1.0_CMISSDP,Err)
263  CALL CMISSField_ParameterSetUpdateNode(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,1,4,2, &
264    & 1.0_CMISSDP,Err)
265  CALL CMISSField_ParameterSetUpdateNode(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,1,4,3, &
266    & 0.0_CMISSDP,Err)
267  !node 5
268  CALL CMISSField_ParameterSetUpdateNode(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,1,5,1, &
269    & 0.0_CMISSDP,Err)
270  CALL CMISSField_ParameterSetUpdateNode(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,1,5,2, &
271    & 0.0_CMISSDP,Err)
272  CALL CMISSField_ParameterSetUpdateNode(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,1,5,3, &
273    & 1.0_CMISSDP,Err)
274  !node 6
275  CALL CMISSField_ParameterSetUpdateNode(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,1,6,1, &
276    & 1.0_CMISSDP,Err)
277  CALL CMISSField_ParameterSetUpdateNode(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,1,6,2, &
278    & 0.0_CMISSDP,Err)
279  CALL CMISSField_ParameterSetUpdateNode(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,1,6,3, &
280    & 1.0_CMISSDP,Err)
281  !node 7
282  CALL CMISSField_ParameterSetUpdateNode(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,1,7,1, &
283    & 0.0_CMISSDP,Err)
284  CALL CMISSField_ParameterSetUpdateNode(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,1,7,2, &
285    & 1.0_CMISSDP,Err)
286  CALL CMISSField_ParameterSetUpdateNode(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,1,7,3, &
287    & 1.0_CMISSDP,Err)
288  !node 8
289  CALL CMISSField_ParameterSetUpdateNode(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,1,8,1, &
290    & 1.0_CMISSDP,Err)
291  CALL CMISSField_ParameterSetUpdateNode(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,1,8,2, &
292    & 1.0_CMISSDP,Err)
293  CALL CMISSField_ParameterSetUpdateNode(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,1,8,3, &
294    & 1.0_CMISSDP,Err)
295
296  !Create a fibre field and attach it to the geometric field  
297  CALL CMISSField_Initialise(FibreField,Err)
298  CALL CMISSField_CreateStart(FieldFibreUserNumber,Region,FibreField,Err)
299  CALL CMISSField_TypeSet(FibreField,CMISS_FIELD_FIBRE_TYPE,Err)
300  CALL CMISSField_MeshDecompositionSet(FibreField,Decomposition,Err)        
301  CALL CMISSField_GeometricFieldSet(FibreField,GeometricField,Err)
302  CALL CMISSField_NumberOfVariablesSet(FibreField,FieldFibreNumberOfVariables,Err)
303  CALL CMISSField_NumberOfComponentsSet(FibreField,CMISS_FIELD_U_VARIABLE_TYPE,FieldFibreNumberOfComponents,Err)  
304  CALL CMISSField_ComponentMeshComponentSet(FibreField,CMISS_FIELD_U_VARIABLE_TYPE,1,MeshComponentNumber,Err)
305  CALL CMISSField_ComponentMeshComponentSet(FibreField,CMISS_FIELD_U_VARIABLE_TYPE,2,MeshComponentNumber,Err)
306  CALL CMISSField_ComponentMeshComponentSet(FibreField,CMISS_FIELD_U_VARIABLE_TYPE,3,MeshComponentNumber,Err)
307  CALL CMISSField_CreateFinish(FibreField,Err)
308
309  !Create a material field and attach it to the geometric field  
310  CALL CMISSField_Initialise(MaterialField,Err)
311  CALL CMISSField_CreateStart(FieldMaterialUserNumber,Region,MaterialField,Err)
312  CALL CMISSField_TypeSet(MaterialField,CMISS_FIELD_MATERIAL_TYPE,Err)
313  CALL CMISSField_MeshDecompositionSet(MaterialField,Decomposition,Err)        
314  CALL CMISSField_GeometricFieldSet(MaterialField,GeometricField,Err)
315  CALL CMISSField_NumberOfVariablesSet(MaterialField,FieldMaterialNumberOfVariables,Err)
316  CALL CMISSField_NumberOfComponentsSet(MaterialField,CMISS_FIELD_U_VARIABLE_TYPE,FieldMaterialNumberOfComponents,Err)  
317  CALL CMISSField_ComponentMeshComponentSet(MaterialField,CMISS_FIELD_U_VARIABLE_TYPE,1,MeshComponentNumber,Err)
318  CALL CMISSField_ComponentMeshComponentSet(MaterialField,CMISS_FIELD_U_VARIABLE_TYPE,2,MeshComponentNumber,Err)
319  CALL CMISSField_ComponentMeshComponentSet(MaterialField,CMISS_FIELD_U_VARIABLE_TYPE,3,MeshComponentNumber,Err)
320  CALL CMISSField_CreateFinish(MaterialField,Err)
321
322  !Set Mooney-Rivlin constants c10 and c01 to 2.0 and 6.0 respectively.
323  CALL CMISSField_ComponentValuesInitialise(MaterialField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,2.0_CMISSDP,Err)
324  CALL CMISSField_ComponentValuesInitialise(MaterialField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,2,6.0_CMISSDP,Err)
325  CALL CMISSField_ComponentValuesInitialise(MaterialField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,3,1.0e7_CMISSDP, &
326    & Err)
327
328  !Create a dependent field with two variables and four components
329  CALL CMISSField_Initialise(DependentField,Err)
330  CALL CMISSField_CreateStart(FieldDependentUserNumber,Region,DependentField,Err)
331  CALL CMISSField_TypeSet(DependentField,CMISS_FIELD_GENERAL_TYPE,Err)  
332  CALL CMISSField_MeshDecompositionSet(DependentField,Decomposition,Err)
333  CALL CMISSField_GeometricFieldSet(DependentField,GeometricField,Err) 
334  CALL CMISSField_DependentTypeSet(DependentField,CMISS_FIELD_DEPENDENT_TYPE,Err) 
335  CALL CMISSField_NumberOfVariablesSet(DependentField,FieldDependentNumberOfVariables,Err)
336  CALL CMISSField_NumberOfComponentsSet(DependentField,CMISS_FIELD_U_VARIABLE_TYPE,FieldDependentNumberOfComponents,Err)
337  CALL CMISSField_NumberOfComponentsSet(DependentField,CMISS_FIELD_DELUDELN_VARIABLE_TYPE,FieldDependentNumberOfComponents,Err)
338  CALL CMISSField_ComponentMeshComponentSet(DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1,MeshComponentNumber,Err)
339  CALL CMISSField_ComponentMeshComponentSet(DependentField,CMISS_FIELD_U_VARIABLE_TYPE,2,MeshComponentNumber,Err)
340  CALL CMISSField_ComponentMeshComponentSet(DependentField,CMISS_FIELD_U_VARIABLE_TYPE,3,MeshComponentNumber,Err)  
341  !CALL CMISSField_ComponentInterpolationSet(DependentField,CMISS_FIELD_U_VARIABLE_TYPE,4,CMISS_FIELD_ELEMENT_BASED_INTERPOLATION,Err)
342  CALL CMISSField_ComponentMeshComponentSet(DependentField,CMISS_FIELD_DELUDELN_VARIABLE_TYPE,1,MeshComponentNumber,Err)
343  CALL CMISSField_ComponentMeshComponentSet(DependentField,CMISS_FIELD_DELUDELN_VARIABLE_TYPE,2,MeshComponentNumber,Err)
344  CALL CMISSField_ComponentMeshComponentSet(DependentField,CMISS_FIELD_DELUDELN_VARIABLE_TYPE,3,MeshComponentNumber,Err)  
345  !CALL CMISSField_ComponentInterpolationSet(DependentField,CMISS_FIELD_DELUDELN_VARIABLE_TYPE,4,CMISS_FIELD_ELEMENT_BASED_INTERPOLATION,Err)
346  CALL CMISSField_CreateFinish(DependentField,Err)  
347
348  !Create the equations_set
349  CALL CMISSField_Initialise(EquationsSetField,Err)
350  CALL CMISSEquationsSet_Initialise(EquationsSet,Err)
351  CALL CMISSEquationsSet_CreateStart(EquationSetUserNumber,Region,FibreField,CMISS_EQUATIONS_SET_ELASTICITY_CLASS, &
352    & CMISS_EQUATIONS_SET_FINITE_ELASTICITY_TYPE,CMISS_EQUATIONS_SET_COMPRESSIBLE_FINITE_ELASTICITY_SUBTYPE, &
353      & EquationsSetFieldUserNumber,&
354    & EquationsSetField,EquationsSet,Err)
355  CALL CMISSEquationsSet_CreateFinish(EquationsSet,Err)
356
357  CALL CMISSEquationsSet_DependentCreateStart(EquationsSet,FieldDependentUserNumber,DependentField,Err) 
358  CALL CMISSEquationsSet_DependentCreateFinish(EquationsSet,Err)
359
360  CALL CMISSEquationsSet_MaterialsCreateStart(EquationsSet,FieldMaterialUserNumber,MaterialField,Err)  
361  CALL CMISSEquationsSet_MaterialsCreateFinish(EquationsSet,Err)
362
363  !Create the equations set equations
364  CALL CMISSEquations_Initialise(Equations,Err)
365  CALL CMISSEquationsSet_EquationsCreateStart(EquationsSet,Equations,Err)
366  CALL CMISSEquations_SparsityTypeSet(Equations,CMISS_EQUATIONS_SPARSE_MATRICES,Err)
367  CALL CMISSEquations_OutputTypeSet(Equations,CMISS_EQUATIONS_NO_OUTPUT,Err)
368  CALL CMISSEquationsSet_EquationsCreateFinish(EquationsSet,Err)   
369
370  !Initialise dependent field from undeformed geometry and displacement bcs and set hydrostatic pressure
371  CALL CMISSField_ParametersToFieldParametersComponentCopy(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE, &
372    & 1,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,1,Err)
373  CALL CMISSField_ParametersToFieldParametersComponentCopy(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE, &
374    & 2,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,2,Err)
375  CALL CMISSField_ParametersToFieldParametersComponentCopy(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE, &
376    & 3,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,3,Err)
377  !CALL CMISSField_ComponentValuesInitialise(DependentField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,4,-8.0_CMISSDP,Err)
378
379  !Define the problem
380  CALL CMISSProblem_Initialise(Problem,Err)
381  CALL CMISSProblem_CreateStart(ProblemUserNumber,Problem,Err)
382  CALL CMISSProblem_SpecificationSet(Problem,CMISS_PROBLEM_ELASTICITY_CLASS,CMISS_PROBLEM_FINITE_ELASTICITY_TYPE, &
383    & CMISS_PROBLEM_NO_SUBTYPE,Err)
384  CALL CMISSProblem_CreateFinish(Problem,Err)
385
386  !Create the problem control loop
387  CALL CMISSProblem_ControlLoopCreateStart(Problem,Err)
388  CALL CMISSProblem_ControlLoopCreateFinish(Problem,Err)
389
390  !Create the problem solvers
391  CALL CMISSSolver_Initialise(Solver,Err)
392  CALL CMISSProblem_SolversCreateStart(Problem,Err)
393  CALL CMISSProblem_SolverGet(Problem,CMISS_CONTROL_LOOP_NODE,1,Solver,Err)
394  CALL CMISSSolver_OutputTypeSet(Solver,CMISS_SOLVER_PROGRESS_OUTPUT,Err)
395  CALL CMISSSolver_NewtonJacobianCalculationTypeSet(Solver,CMISS_SOLVER_NEWTON_JACOBIAN_FD_CALCULATED,Err)
396  CALL CMISSProblem_SolversCreateFinish(Problem,Err)
397
398  !Create the problem solver equations
399  CALL CMISSSolver_Initialise(Solver,Err)
400  CALL CMISSSolverEquations_Initialise(SolverEquations,Err)
401  CALL CMISSProblem_SolverEquationsCreateStart(Problem,Err)   
402  CALL CMISSProblem_SolverGet(Problem,CMISS_CONTROL_LOOP_NODE,1,Solver,Err)
403  CALL CMISSSolver_SolverEquationsGet(Solver,SolverEquations,Err)
404  CALL CMISSSolverEquations_SparsityTypeSet(SolverEquations,CMISS_SOLVER_SPARSE_MATRICES,Err)
405  CALL CMISSSolverEquations_EquationsSetAdd(SolverEquations,EquationsSet,EquationsSetIndex,Err)
406  CALL CMISSProblem_SolverEquationsCreateFinish(Problem,Err)
407
408  !Prescribe boundary conditions (absolute nodal parameters)
409  CALL CMISSBoundaryConditions_Initialise(BoundaryConditions,Err)
410  CALL CMISSSolverEquations_BoundaryConditionsCreateStart(SolverEquations,BoundaryConditions,Err)
411
412  !Fix nodes 1,3,5,7 at x=0 and nodes 2,4,6,8 at x=1.1
413  CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1,1,1,1, &
414    & CMISS_BOUNDARY_CONDITION_FIXED, &
415    & 0.0_CMISSDP,Err)
416  CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1,1,2,1, &
417    & CMISS_BOUNDARY_CONDITION_FIXED, &
418    & 1.1_CMISSDP,Err)
419  CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1,1,3,1, &
420    & CMISS_BOUNDARY_CONDITION_FIXED, &
421    & 0.0_CMISSDP,Err)
422  CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1,1,4,1, &
423    & CMISS_BOUNDARY_CONDITION_FIXED, &
424    & 1.1_CMISSDP,Err)
425  CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1,1,5,1, &
426    & CMISS_BOUNDARY_CONDITION_FIXED, &
427    & 0.0_CMISSDP,Err)
428  CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1,1,6,1, &
429    & CMISS_BOUNDARY_CONDITION_FIXED, &
430    & 1.1_CMISSDP,Err)
431  CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1,1,7,1, &
432    & CMISS_BOUNDARY_CONDITION_FIXED, &
433    & 0.0_CMISSDP,Err)
434  CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1,1,8,1, &
435    & CMISS_BOUNDARY_CONDITION_FIXED, &
436    & 1.1_CMISSDP,Err)
437
438  !Fix nodes 1,2,5,6 at y=0
439  CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1,1,1,2, &
440    & CMISS_BOUNDARY_CONDITION_FIXED, &
441    & 0.0_CMISSDP,Err)
442  CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1,1,2,2, &
443    & CMISS_BOUNDARY_CONDITION_FIXED, &
444    & 0.0_CMISSDP,Err)
445  CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1,1,5,2, &
446    & CMISS_BOUNDARY_CONDITION_FIXED, &
447    & 0.0_CMISSDP,Err)
448  CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1,1,6,2, &
449    & CMISS_BOUNDARY_CONDITION_FIXED, &
450    & 0.0_CMISSDP,Err)
451
452  !Fix nodes 1,2,3,4 at x=0
453  CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1,1,1,3, &
454    & CMISS_BOUNDARY_CONDITION_FIXED, &
455    & 0.0_CMISSDP,Err)
456  CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1,1,2,3, &
457    & CMISS_BOUNDARY_CONDITION_FIXED, &
458    & 0.0_CMISSDP,Err)
459  CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1,1,3,3, &
460    & CMISS_BOUNDARY_CONDITION_FIXED, &
461    & 0.0_CMISSDP,Err)
462  CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1,1,4,3, &
463    & CMISS_BOUNDARY_CONDITION_FIXED, &
464    & 0.0_CMISSDP,Err)
465
466  CALL CMISSSolverEquations_BoundaryConditionsCreateFinish(SolverEquations,Err)
467
468  !Solve problem
469  CALL CMISSProblem_Solve(Problem,Err)
470
471  !Output solution  
472  CALL CMISSFields_Initialise(Fields,Err)
473  CALL CMISSFields_Create(Region,Fields,Err)
474  CALL CMISSFields_NodesExport(Fields,"UniaxialExtension","FORTRAN",Err)
475  CALL CMISSFields_ElementsExport(Fields,"UniaxialExtension","FORTRAN",Err)
476  CALL CMISSFields_Finalise(Fields,Err)
477
478  CALL CMISSFinalise(Err)
479
480  WRITE(*,'(A)') "Program successfully completed."
481
482  STOP
483
484END PROGRAM UNIAXIALEXTENSIONEXAMPLE
485