/ClassicalField/AdvectionDiffusion/StaticAdvectionDiffusion_FieldML/src/StaticAdvectionDiffusion_FieldMLExample.f90
http://github.com/xyan075/examples · Fortran Modern · 452 lines · 204 code · 72 blank · 176 comment · 4 complexity · a1bda3cef7be47c65b7c1c0e277858f7 MD5 · raw file
- !> \file
- !> \author Chris Bradley
- !> \brief This is an example program to solve a diffusion equation using openCMISS calls.
- !>
- !> \section LICENSE
- !>
- !> Version: MPL 1.1/GPL 2.0/LGPL 2.1
- !>
- !> The contents of this file are subject to the Mozilla Public License
- !> Version 1.1 (the "License"); you may not use this file except in
- !> compliance with the License. You may obtain a copy of the License at
- !> http://www.mozilla.org/MPL/
- !>
- !> Software distributed under the License is distributed on an "AS IS"
- !> basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
- !> License for the specific language governing rights and limitations
- !> under the License.
- !>
- !> The Original Code is openCMISS
- !>
- !> The Initial Developer of the Original Code is University of Auckland,
- !> Auckland, New Zealand and University of Oxford, Oxford, United
- !> Kingdom. Portions created by the University of Auckland and University
- !> of Oxford are Copyright (C) 2007 by the University of Auckland and
- !> the University of Oxford. All Rights Reserved.
- !>
- !> Contributor(s):
- !>
- !> Alternatively, the contents of this file may be used under the terms of
- !> either the GNU General Public License Version 2 or later (the "GPL"), or
- !> the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- !> in which case the provisions of the GPL or the LGPL are applicable instead
- !> of those above. If you wish to allow use of your version of this file only
- !> under the terms of either the GPL or the LGPL, and not to allow others to
- !> use your version of this file under the terms of the MPL, indicate your
- !> decision by deleting the provisions above and replace them with the notice
- !> and other provisions required by the GPL or the LGPL. If you do not delete
- !> the provisions above, a recipient may use your version of this file under
- !> the terms of any one of the MPL, the GPL or the LGPL.
- !>
- !> \example ClassicalField/AdvectionDiffusion/StaticAdvectionDiffusion_FieldML/src/StaticAdvectionDiffusion_FieldMLExample.f90
- !! Example program to solve a diffusion equation using openCMISS calls.
- !!
- !! \htmlinclude ClassicalField/AdvectionDiffusion/StaticAdvectionDiffusion_FieldML/history.html
- !<
- !> Main program
- PROGRAM STATICADVECTIONDIFFUSIONEXAMPLE
- USE OPENCMISS
- USE FIELDML_API
- USE MPI
- #ifdef WIN32
- USE IFQWIN
- #endif
- IMPLICIT NONE
- !Test program parameters
- REAL(CMISSDP), PARAMETER :: HEIGHT=1.0_CMISSDP
- REAL(CMISSDP), PARAMETER :: WIDTH=2.0_CMISSDP
- REAL(CMISSDP), PARAMETER :: LENGTH=3.0_CMISSDP
- REAL(CMISSDP), POINTER :: GEOMETRIC_PARAMETERS(:)
-
- INTEGER(CMISSIntg), PARAMETER :: CoordinateSystemUserNumber=1
- INTEGER(CMISSIntg), PARAMETER :: RegionUserNumber=2
- INTEGER(CMISSIntg), PARAMETER :: BasisUserNumber=3
- INTEGER(CMISSIntg), PARAMETER :: GeneratedMeshUserNumber=4
- INTEGER(CMISSIntg), PARAMETER :: MeshUserNumber=5
- INTEGER(CMISSIntg), PARAMETER :: DecompositionUserNumber=6
- INTEGER(CMISSIntg), PARAMETER :: GeometricFieldUserNumber=7
- INTEGER(CMISSIntg), PARAMETER :: EquationsSetFieldUserNumber=8
- INTEGER(CMISSIntg), PARAMETER :: DependentFieldUserNumber=9
- INTEGER(CMISSIntg), PARAMETER :: MaterialsFieldUserNumber=10
- INTEGER(CMISSIntg), PARAMETER :: EquationsSetUserNumber=11
- INTEGER(CMISSIntg), PARAMETER :: ProblemUserNumber=12
- INTEGER(CMISSIntg), PARAMETER :: ControlLoopNode=0
- INTEGER(CMISSIntg), PARAMETER :: IndependentFieldUserNumber=13
- INTEGER(CMISSIntg), PARAMETER :: AnalyticFieldUserNumber=14
- INTEGER(CMISSIntg), PARAMETER :: SourceFieldUserNumber=15
- INTEGER(CMISSIntg), PARAMETER :: MeshComponentNumber=1
- !Program types
-
- !Program variables
- INTEGER(CMISSIntg) :: NUMBER_GLOBAL_X_ELEMENTS,NUMBER_GLOBAL_Y_ELEMENTS,NUMBER_GLOBAL_Z_ELEMENTS
- INTEGER(CMISSIntg) :: NUMBER_OF_DOMAINS
-
- INTEGER(CMISSIntg) :: MPI_IERROR
-
- !CMISS variables
- TYPE(CMISSBasisType) :: Basis
- TYPE(CMISSBoundaryConditionsType) :: BoundaryConditions
- TYPE(CMISSCoordinateSystemType) :: CoordinateSystem,WorldCoordinateSystem
- TYPE(CMISSDecompositionType) :: Decomposition
- TYPE(CMISSEquationsType) :: Equations
- TYPE(CMISSEquationsSetType) :: EquationsSet
- TYPE(CMISSFieldType) :: GeometricField,EquationsSetField,DependentField,MaterialsField,IndependentField,AnalyticField,SourceField
- TYPE(CMISSFieldsType) :: Fields
- TYPE(CMISSGeneratedMeshType) :: GeneratedMesh
- TYPE(CMISSMeshType) :: Mesh
- TYPE(CMISSProblemType) :: Problem
- TYPE(CMISSControlLoopType) :: ControlLoop
- TYPE(CMISSRegionType) :: Region,WorldRegion
- TYPE(CMISSSolverType) :: Solver, LinearSolver
- TYPE(CMISSSolverEquationsType) :: SolverEquations
- LOGICAL :: EXPORT_FIELD,IMPORT_FIELD
-
- #ifdef WIN32
- !Quickwin type
- LOGICAL :: QUICKWIN_STATUS=.FALSE.
- TYPE(WINDOWCONFIG) :: QUICKWIN_WINDOW_CONFIG
- #endif
-
- !Generic CMISS variables
-
- INTEGER(CMISSIntg) :: EquationsSetIndex
- INTEGER(CMISSIntg) :: FirstNodeNumber,LastNodeNumber
- INTEGER(CMISSIntg) :: Err
- INTEGER(CMISSIntg) :: dimensions, i
-
- !FieldML variables
- CHARACTER(KIND=C_CHAR,LEN=*), PARAMETER :: outputDirectory = ""
- CHARACTER(KIND=C_CHAR,LEN=*), PARAMETER :: outputFilename = "StaticAdvectionDiffusion.xml"
- CHARACTER(KIND=C_CHAR,LEN=*), PARAMETER :: basename = "static_advection_diffusion"
- CHARACTER(KIND=C_CHAR,LEN=*), PARAMETER :: dataFormat = "PLAIN_TEXT"
- TYPE(CMISSFieldMLIOType) :: fieldmlInfo
-
- #ifdef WIN32
- !Initialise QuickWin
- QUICKWIN_WINDOW_CONFIG%TITLE="General Output" !Window title
- QUICKWIN_WINDOW_CONFIG%NUMTEXTROWS=-1 !Max possible number of rows
- QUICKWIN_WINDOW_CONFIG%MODE=QWIN$SCROLLDOWN
- !Set the window parameters
- QUICKWIN_STATUS=SETWINDOWCONFIG(QUICKWIN_WINDOW_CONFIG)
- !If attempt fails set with system estimated values
- IF(.NOT.QUICKWIN_STATUS) QUICKWIN_STATUS=SETWINDOWCONFIG(QUICKWIN_WINDOW_CONFIG)
- #endif
- !Intialise OpenCMISS
- CALL CMISSInitialise(WorldCoordinateSystem,WorldRegion,Err)
- CALL CMISSErrorHandlingModeSet(CMISS_ERRORS_TRAP_ERROR,Err)
- NUMBER_GLOBAL_X_ELEMENTS=50
- NUMBER_GLOBAL_Y_ELEMENTS=100
- NUMBER_GLOBAL_Z_ELEMENTS=0
- NUMBER_OF_DOMAINS=1
- CALL MPI_BCAST(NUMBER_GLOBAL_X_ELEMENTS,1,MPI_INTEGER,0,MPI_COMM_WORLD,MPI_IERROR)
- CALL MPI_BCAST(NUMBER_GLOBAL_Y_ELEMENTS,1,MPI_INTEGER,0,MPI_COMM_WORLD,MPI_IERROR)
- CALL MPI_BCAST(NUMBER_GLOBAL_Z_ELEMENTS,1,MPI_INTEGER,0,MPI_COMM_WORLD,MPI_IERROR)
- CALL MPI_BCAST(NUMBER_OF_DOMAINS,1,MPI_INTEGER,0,MPI_COMM_WORLD,MPI_IERROR)
-
- IF( NUMBER_GLOBAL_Z_ELEMENTS == 0 ) THEN
- dimensions = 2
- ELSE
- dimensions = 3
- ENDIF
- !Start the creation of a new RC coordinate system
- CALL CMISSCoordinateSystem_Initialise(CoordinateSystem,Err)
- CALL CMISSCoordinateSystem_CreateStart(CoordinateSystemUserNumber,CoordinateSystem,Err)
- CALL CMISSCoordinateSystem_DimensionSet(CoordinateSystem,dimensions,Err)
- !Finish the creation of the coordinate system
- CALL CMISSCoordinateSystem_CreateFinish(CoordinateSystem,Err)
-
- !Start the creation of the region
- CALL CMISSRegion_Initialise(Region,Err)
- CALL CMISSRegion_CreateStart(RegionUserNumber,WorldRegion,Region,Err)
- !Set the regions coordinate system to the 2D RC coordinate system that we have created
- CALL CMISSRegion_CoordinateSystemSet(Region,CoordinateSystem,Err)
- !Finish the creation of the region
- CALL CMISSRegion_CreateFinish(Region,Err)
-
- !Start the creation of a basis (default is trilinear lagrange)
- CALL CMISSBasis_Initialise(Basis,Err)
- CALL CMISSBasis_CreateStart(BasisUserNumber,Basis,Err)
- CALL CMISSBasis_NumberOfXiSet(Basis,dimensions,Err)
- !Finish the creation of the basis
- CALL CMISSBasis_CreateFinish(BASIS,Err)
-
- !Start the creation of a generated mesh in the region
- CALL CMISSGeneratedMesh_Initialise(GeneratedMesh,Err)
- CALL CMISSGeneratedMesh_CreateStart(GeneratedMeshUserNumber,Region,GeneratedMesh,Err)
- !Set up a regular x*y*z mesh
- CALL CMISSGeneratedMesh_TypeSet(GeneratedMesh,CMISS_GENERATED_MESH_REGULAR_MESH_TYPE,Err)
- !Set the default basis
- CALL CMISSGeneratedMesh_BasisSet(GeneratedMesh,Basis,Err)
- !Define the mesh on the region
- IF(dimensions == 2) THEN
- CALL CMISSGeneratedMesh_ExtentSet(GeneratedMesh,(/WIDTH,HEIGHT/),Err)
- CALL CMISSGeneratedMesh_NumberOfElementsSet(GeneratedMesh,(/NUMBER_GLOBAL_X_ELEMENTS,NUMBER_GLOBAL_Y_ELEMENTS/),Err)
- ELSE
- CALL CMISSGeneratedMesh_ExtentSet(GeneratedMesh,(/WIDTH,HEIGHT,LENGTH/),Err)
- CALL CMISSGeneratedMesh_NumberOfElementsSet(GeneratedMesh,(/NUMBER_GLOBAL_X_ELEMENTS,NUMBER_GLOBAL_Y_ELEMENTS, &
- & NUMBER_GLOBAL_Z_ELEMENTS/),Err)
- ENDIF
- !Finish the creation of a generated mesh in the region
- CALL CMISSMesh_Initialise(Mesh,Err)
- CALL CMISSGeneratedMesh_CreateFinish(GeneratedMesh,MeshUserNumber,Mesh,Err)
-
- !Create a decomposition
- CALL CMISSDecomposition_Initialise(Decomposition,Err)
- CALL CMISSDecomposition_CreateStart(DecompositionUserNumber,Mesh,Decomposition,Err)
- !Set the decomposition to be a general decomposition with the specified number of domains
- CALL CMISSDecomposition_TypeSet(Decomposition,CMISS_DECOMPOSITION_CALCULATED_TYPE,Err)
- CALL CMISSDecomposition_NumberOfDomainsSet(Decomposition,NUMBER_OF_DOMAINS,Err)
- !Finish the decomposition
- CALL CMISSDecomposition_CreateFinish(Decomposition,Err)
-
- !Start to create a default (geometric) field on the region
- CALL CMISSField_Initialise(GeometricField,Err)
- CALL CMISSField_CreateStart(GeometricFieldUserNumber,Region,GeometricField,Err)
- !Set the decomposition to use
- CALL CMISSField_MeshDecompositionSet(GeometricField,Decomposition,Err)
- !Set the domain to be used by the field components.
- DO i = 1, dimensions
- CALL CMISSField_ComponentMeshComponentSet(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,i,MeshComponentNumber,Err)
- ENDDO
- !Finish creating the field
- CALL CMISSField_CreateFinish(GeometricField,Err)
-
- !Update the geometric field parameters
- CALL CMISSGeneratedMesh_GeometricParametersCalculate(GeneratedMesh,GeometricField,Err)
-
- !Create the equations_set
- CALL CMISSEquationsSet_Initialise(EquationsSet,Err)
- CALL CMISSField_Initialise(EquationsSetField,Err)
- CALL CMISSEquationsSet_CreateStart(EquationsSetUserNumber,Region,GeometricField,CMISS_EQUATIONS_SET_CLASSICAL_FIELD_CLASS, &
- & CMISS_EQUATIONS_SET_ADVECTION_DIFFUSION_EQUATION_TYPE,CMISS_EQUATIONS_SET_CONSTANT_SOURCE_STATIC_ADVEC_DIFF_SUBTYPE,&
- & EquationsSetFieldUserNumber,EquationsSetField,EquationsSet,Err)
- !Set the equations set to be a standard Laplace problem
- !Finish creating the equations set
- CALL CMISSEquationsSet_CreateFinish(EquationsSet,Err)
- !Create the equations set dependent field variables
- CALL CMISSField_Initialise(DependentField,Err)
- CALL CMISSEquationsSet_DependentCreateStart(EquationsSet,DependentFieldUserNumber,DependentField,Err)
- !Finish the equations set dependent field variables
- CALL CMISSEquationsSet_DependentCreateFinish(EquationsSet,Err)
- !Create the equations set material field variables
- CALL CMISSField_Initialise(MaterialsField,Err)
- CALL CMISSEquationsSet_MaterialsCreateStart(EquationsSet,MaterialsFieldUserNumber,MaterialsField,Err)
- !Finish the equations set dependent field variables
- CALL CMISSEquationsSet_MaterialsCreateFinish(EquationsSet,Err)
- !Create the equations set source field variables
- !For comparison withe analytical solution used here, the source field must be set to the following:
- !f(x,y) = 2.0*tanh(-0.1E1+Alpha*(TanPhi*x-y))*(1.0-pow(tanh(-0.1E1+Alpha*(TanPhi*x-y)),2.0))*Alpha*Alpha*TanPhi*TanPhi
- !+2.0*tanh(-0.1E1+Alpha*(TanPhi*x-y))*(1.0-pow(tanh(-0.1E1+Alpha*(TanPhi*x-y)),2.0))*Alpha*Alpha
- !-Peclet*(-sin(6.0*y)*(1.0-pow(tanh(-0.1E1+Alpha*(TanPhi*x-y)),2.0))*Alpha*TanPhi+cos(6.0*x)*(1.0-pow(tanh(-0.1E1+Alpha*(TanPhi*x-y)),2.0))*Alpha)
- CALL CMISSField_Initialise(SourceField,Err)
- CALL CMISSEquationsSet_SourceCreateStart(EquationsSet,SourceFieldUserNumber,SourceField,Err)
- CALL CMISSField_ComponentInterpolationSet(SourceField,CMISS_FIELD_U_VARIABLE_TYPE,1,CMISS_FIELD_NODE_BASED_INTERPOLATION,Err)
- !Finish the equations set dependent field variables
- CALL CMISSEquationsSet_SourceCreateFinish(EquationsSet,Err)
- CALL CMISSField_ParameterSetDataGet(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE,GEOMETRIC_PARAMETERS, &
- & Err)
- !Create the equations set independent field variables
- CALL CMISSField_Initialise(IndependentField,Err)
- CALL CMISSEquationsSet_IndependentCreateStart(EquationsSet,IndependentFieldUserNumber,IndependentField,Err)
- IF( dimensions == 2 ) THEN
- !For comparison withe analytical solution used here, the independent field must be set to the following:
- !w(x,y)=(sin 6y,cos 6x) FIELD_U_VARIABLE_TYPE,1,FIELD_NODE_BASED_INTERPOLATION
- ! CALL CMISSField_ComponentInterpolationSet(IndependentField,CMISS_FIELD_U_VARIABLE_TYPE,1,CMISS_FIELD_NODE_BASED_INTERPOLATION,Err)
- ! CALL CMISSField_ComponentInterpolationSet(IndependentField,CMISS_FIELD_U_VARIABLE_TYPE,2,CMISS_FIELD_NODE_BASED_INTERPOLATION,Err)
- !Loop over nodes to set the appropriate function value
- ! DO
- ! ENDDO
- ENDIF
- !Finish the equations set dependent field variables
- CALL CMISSEquationsSet_IndependentCreateFinish(EquationsSet,Err)
- !Create the equations set analytic field variables
- CALL CMISSField_Initialise(AnalyticField,Err)
- IF( dimensions == 2) THEN
- CALL CMISSEquationsSet_AnalyticCreateStart(EquationsSet,CMISS_EQUATIONS_SET_ADVECTION_DIFFUSION_EQUATION_TWO_DIM_1,&
- & AnalyticFieldUserNumber,AnalyticField,Err)
- ELSE
- WRITE(*,'(A)') "Three dimensions is not implemented."
- STOP
- ENDIF
- !Finish the equations set analytic field variables
- CALL CMISSEquationsSet_AnalyticCreateFinish(EquationsSet,Err)
- !Create the equations set equations
- CALL CMISSEquations_Initialise(Equations,Err)
- CALL CMISSEquationsSet_EquationsCreateStart(EquationsSet,Equations,Err)
- !Set the equations matrices sparsity type
- CALL CMISSEquations_SparsityTypeSet(Equations,CMISS_EQUATIONS_SPARSE_MATRICES,Err)
- !Set the equations set output
- !CALL CMISSEquations_OutputTypeSet(Equations,CMISS_EQUATIONS_NO_OUTPUT,Err)
- !CALL CMISSEquations_OutputTypeSet(Equations,CMISS_EQUATIONS_TIMING_OUTPUT,Err)
- !CALL CMISSEquations_OutputTypeSet(Equations,CMISS_EQUATIONS_MATRIX_OUTPUT,Err)
- !CALL CMISSEquations_OutputTypeSet(Equations,CMISS_EQUATIONS_ELEMENT_MATRIX_OUTPUT,Err)
- !Finish the equations set equations
- CALL CMISSEquationsSet_EquationsCreateFinish(EquationsSet,Err)
-
- ! !Create the equations set boundary conditions
- ! CALL CMISSBoundaryConditions_Initialise(BoundaryConditions,Err)
- ! CALL CMISSEquationsSetBoundaryConditionsCreateStart(EquationsSet,BoundaryConditions,Err)
- ! !Set the first node to 0.0 and the last node to 1.0
- ! FirstNodeNumber=1
- ! IF( dimensions == 2 ) THEN
- ! LastNodeNumber=(NUMBER_GLOBAL_X_ELEMENTS+1)*(NUMBER_GLOBAL_Y_ELEMENTS+1)
- ! ELSE
- ! LastNodeNumber=(NUMBER_GLOBAL_X_ELEMENTS+1)*(NUMBER_GLOBAL_Y_ELEMENTS+1)*(NUMBER_GLOBAL_Z_ELEMENTS+1)
- ! ENDIF
- ! CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,CMISS_FIELD_U_VARIABLE_TYPE,1,FirstNodeNumber,1, &
- ! & CMISS_BOUNDARY_CONDITION_FIXED,0.0_CMISSDP,Err)
- ! CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,CMISS_FIELD_DELUDELN_VARIABLE_TYPE,1,LastNodeNumber,1, &
- ! & CMISS_BOUNDARY_CONDITION_FIXED,1.0_CMISSDP,Err)
- ! !Finish the creation of the equations set boundary conditions
- ! CALL CMISSEquationsSetBoundaryConditionsCreateFinish(EquationsSet,Err)
- ! EXPORT_FIELD=.TRUE.
- ! IF(EXPORT_FIELD) THEN
- ! CALL CMISSFields_Initialise(Fields,Err)
- ! CALL CMISSFields_Create(Region,Fields,Err)
- ! CALL CMISSFields_NodesExport(Fields,"StaticAdvectionDiffusionInitial","FORTRAN",Err)
- ! CALL CMISSFields_ElementsExport(Fields,"StaticAdvectionDiffusionInitial","FORTRAN",Err)
- ! CALL CMISSFields_Finalise(Fields,Err)
- !
- ! ENDIF
- !Create the problem
- CALL CMISSProblem_Initialise(Problem,Err)
- CALL CMISSProblem_CreateStart(ProblemUserNumber,Problem,Err)
- !Set the problem to be a no source static advection Diffusion problem
- ! CALL CMISSProblem_SpecificationSet(Problem,CMISS_PROBLEM_CLASSICAL_FIELD_CLASS,CMISS_PROBLEM_ADVECTION_DIFFUSION_EQUATION_TYPE, &
- ! & CMISS_PROBLEM_NO_SOURCE_STATIC_ADVEC_DIFF_SUBTYPE,Err)
- CALL CMISSProblem_SpecificationSet(Problem,CMISS_PROBLEM_CLASSICAL_FIELD_CLASS,CMISS_PROBLEM_ADVECTION_DIFFUSION_EQUATION_TYPE, &
- & CMISS_PROBLEM_LINEAR_SOURCE_STATIC_ADVEC_DIFF_SUBTYPE,Err)
- !Finish the creation of a problem.
- CALL CMISSProblem_CreateFinish(Problem,Err)
- !Create the problem control
- CALL CMISSProblem_ControlLoopCreateStart(Problem,Err)
- !CALL CMISSControlLoop_Initialise(ControlLoop,Err)
- !Get the control loop
- !CALL CMISSProblem_ControlLoopGet(Problem,ControlLoopNode,ControlLoop,Err)
- !Set the times
- !CALL CMISSControlLoop_TimesSet(ControlLoop,0.0_CMISSDP,1.0_CMISSDP,0.1_CMISSDP,Err)
- !Finish creating the problem control loop
- CALL CMISSProblem_ControlLoopCreateFinish(Problem,Err)
- !Start the creation of the problem solvers
- !
- ! ! !For the Direct Solver MUMPS, uncomment the below two lines and comment out the above five
- ! ! CALL SOLVER_LINEAR_TYPE_SET(LINEAR_SOLVER,SOLVER_LINEAR_DIRECT_SOLVE_TYPE,ERR,ERROR,*999)
- ! ! CALL SOLVER_LINEAR_DIRECT_TYPE_SET(LINEAR_SOLVER,SOLVER_DIRECT_MUMPS,ERR,ERROR,*999)
- !
- CALL CMISSSolver_Initialise(Solver,Err)
- !CALL CMISSSolver_Initialise(LinearSolver,Err)
- CALL CMISSProblem_SolversCreateStart(Problem,Err)
- CALL CMISSProblem_SolverGet(Problem,CMISS_CONTROL_LOOP_NODE,1,Solver,Err)
- !CALL CMISSSolver_OutputTypeSet(Solver,CMISS_SOLVER_NO_OUTPUT,Err)
- !CALL CMISSSolver_OutputTypeSet(Solver,CMISS_SOLVER_PROGRESS_OUTPUT,Err)
- !CALL CMISSSolver_OutputTypeSet(Solver,CMISS_SOLVER_TIMING_OUTPUT,Err)
- !CALL CMISSSolver_OutputTypeSet(Solver,CMISS_SOLVER_SOLVER_OUTPUT,Err)
- CALL CMISSSolver_OutputTypeSet(Solver,CMISS_SOLVER_PROGRESS_OUTPUT,Err)
- !CALL CMISSSolver_DynamicLinearSolverGet(Solver,LinearSolver,Err)
- !CALL CMISSSolver_LinearIterativeMaximumIterationsSet(LinearSolver,300,Err)
- !Finish the creation of the problem solver
- CALL CMISSProblem_SolversCreateFinish(Problem,Err)
- !Create the problem solver equations
- CALL CMISSSolver_Initialise(Solver,Err)
- CALL CMISSSolverEquations_Initialise(SolverEquations,Err)
- CALL CMISSProblem_SolverEquationsCreateStart(Problem,Err)
- !Get the solve equations
- CALL CMISSProblem_SolverGet(Problem,CMISS_CONTROL_LOOP_NODE,1,Solver,Err)
- CALL CMISSSolver_SolverEquationsGet(Solver,SolverEquations,Err)
- !Set the solver equations sparsity
- CALL CMISSSolverEquations_SparsityTypeSet(SolverEquations,CMISS_SOLVER_SPARSE_MATRICES,Err)
- !CALL CMISSSolverEquations_SparsityTypeSet(SolverEquations,CMISS_SOLVER_FULL_MATRICES,Err)
- !Add in the equations set
- CALL CMISSSolverEquations_EquationsSetAdd(SolverEquations,EquationsSet,EquationsSetIndex,Err)
- !Finish the creation of the problem solver equations
- CALL CMISSProblem_SolverEquationsCreateFinish(Problem,Err)
- CALL CMISSBoundaryConditions_Initialise(BoundaryConditions,Err)
- CALL CMISSSolverEquations_BoundaryConditionsCreateStart(SolverEquations,BoundaryConditions,Err)
- CALL CMISSSolverEquations_BoundaryConditionsAnalytic(SolverEquations,Err)
- CALL CMISSSolverEquations_BoundaryConditionsCreateFinish(SolverEquations,Err)
-
- !Solve the problem
- CALL CMISSProblem_Solve(Problem,Err)
- !Output Analytic analysis
- Call CMISSAnalyticAnalysisOutput(DependentField,"StaticAdvectionDiffusionAnalytics",Err)
- EXPORT_FIELD=.TRUE.
- IF(EXPORT_FIELD) THEN
- !CALL CMISSFields_Initialise(Fields,Err)
- !CALL CMISSFields_Create(Region,Fields,Err)
- !CALL CMISSFields_NodesExport(Fields,"StaticAdvectionDiffusion","FORTRAN",Err)
- !CALL CMISSFields_ElementsExport(Fields,"StaticAdvectionDiffusion","FORTRAN",Err)
- !CALL CMISSFields_Finalise(Fields,Err)
-
- CALL CMISSFieldMLIO_Initialise( fieldmlInfo, err )
- CALL CMISSFieldML_OutputCreate( Mesh, outputDirectory, basename, dataFormat, fieldmlInfo, err )
- CALL CMISSFieldML_OutputAddField( fieldmlInfo, baseName//".geometric", dataFormat, GeometricField, &
- & CMISS_FIELD_U_VARIABLE_TYPE, CMISS_FIELD_VALUES_SET_TYPE, err )
- CALL CMISSFieldML_OutputAddField( fieldmlInfo, baseName//".dependent", dataFormat, DependentField, &
- & CMISS_FIELD_U_VARIABLE_TYPE, CMISS_FIELD_VALUES_SET_TYPE, err )
- CALL CMISSFieldML_OutputAddField( fieldmlInfo, baseName//".independent", dataFormat, IndependentField, &
- & CMISS_FIELD_U_VARIABLE_TYPE, CMISS_FIELD_VALUES_SET_TYPE, err )
- CALL CMISSFieldML_OutputAddField( fieldmlInfo, baseName//".source", dataFormat, SourceField, &
- & CMISS_FIELD_U_VARIABLE_TYPE, CMISS_FIELD_VALUES_SET_TYPE, err )
- CALL CMISSFieldML_OutputAddField( fieldmlInfo, baseName//".materials", dataFormat, MaterialsField, &
- & CMISS_FIELD_U_VARIABLE_TYPE, CMISS_FIELD_VALUES_SET_TYPE, err )
- !CALL FieldmlOutputAddField( fieldmlInfo, baseName//".analytic", dataFormat, region, mesh, AnalyticField, &
- ! & CMISS_FIELD_U_VARIABLE_TYPE, CMISS_FIELD_VALUES_SET_TYPE, err )
-
- CALL CMISSFieldML_OutputWrite( fieldmlInfo, outputFilename, err )
-
- CALL CMISSFieldMLIO_Finalise( fieldmlInfo, err )
- ENDIF
- !CALL CMISSFinalise(Err)
- WRITE(*,'(A)') "Program successfully completed."
-
- STOP
- END PROGRAM STATICADVECTIONDIFFUSIONEXAMPLE