/FluidMechanics/Burgers/StaticBurgers/src/StaticBurgersExample.f90
http://github.com/xyan075/examples · Fortran Modern · 486 lines · 222 code · 67 blank · 197 comment · 0 complexity · 4c1cbf7a7faed5abef8304867208e0c9 MD5 · raw file
- !> \file
- !> \author David Ladd
- !> \brief This is an example program to solve a viscous burgers 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 FluidMechanics/Burgers/StaticBurgers/src/BurgersExample.f90
- !! Example program to solve a burgers equation using openCMISS calls.
- !! \htmlinclude FluidMechanics/Burgers/StaticBurgers/history.html
- !<
- !> Main program
- PROGRAM STATICBURGERSEXAMPLE
- USE OPENCMISS
- USE MPI
- #ifdef WIN32
- USE IFQWIN
- #endif
- IMPLICIT NONE
- !-----------------------------------------------------------------------------------------------------------
- ! PROGRAM VARIABLES AND TYPES
- !-----------------------------------------------------------------------------------------------------------
- INTEGER(CMISSIntg), PARAMETER :: EquationsSetFieldUserNumber=1337
- TYPE(CMISSFieldType) :: EquationsSetField
- !Test program 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 :: DependentFieldUserNumber=8
- INTEGER(CMISSIntg), PARAMETER :: MaterialsFieldUserNumber=9
- INTEGER(CMISSIntg), PARAMETER :: EquationsSetUserNumber=10
- INTEGER(CMISSIntg), PARAMETER :: ProblemUserNumber=11
- INTEGER(CMISSIntg), PARAMETER :: ControlLoopNode=0
- INTEGER(CMISSIntg), PARAMETER :: AnalyticFieldUserNumber=12
- INTEGER(CMISSIntg), PARAMETER :: SolverUserNumber=1
-
- !Program variables
- INTEGER(CMISSIntg) :: NUMBER_GLOBAL_X_ELEMENTS
- INTEGER(CMISSIntg) :: NUMBER_OF_DOMAINS
- INTEGER(CMISSIntg) :: COMPONENT_NUMBER
- INTEGER(CMISSIntg) :: MAXIMUM_ITERATIONS
- INTEGER(CMISSIntg) :: RESTART_VALUE
-
- INTEGER(CMISSIntg) :: MPI_IERROR
- INTEGER(CMISSIntg) :: NONLINEAR_SOLVER_OUTPUT_TYPE
- INTEGER(CMISSIntg) :: LINEAR_SOLVER_OUTPUT_TYPE
- REAL(CMISSDP) :: DIVERGENCE_TOLERANCE
- REAL(CMISSDP) :: RELATIVE_TOLERANCE
- REAL(CMISSDP) :: ABSOLUTE_TOLERANCE
- REAL(CMISSDP) :: LINESEARCH_ALPHA
- LOGICAL :: LINEAR_SOLVER_DIRECT_FLAG
- REAL(CMISSDP) :: NU_PARAM
- REAL(CMISSDP) :: LENGTH
- INTEGER(CMISSIntg) :: NODE_NUMBER
- INTEGER(CMISSIntg) :: ELEMENT_NUMBER
- INTEGER(CMISSIntg) :: NODE_COUNTER
- INTEGER(CMISSIntg) :: CONDITION
- INTEGER(CMISSIntg) :: FirstNodeNumber,LastNodeNumber,FirstNodeDomain,LastNodeDomain
-
- !Program types
- TYPE(CMISSBasisType) :: Basis
- TYPE(CMISSBoundaryConditionsType) :: BoundaryConditions
- TYPE(CMISSCoordinateSystemType) :: CoordinateSystem,WorldCoordinateSystem
- TYPE(CMISSDecompositionType) :: Decomposition
- TYPE(CMISSEquationsType) :: Equations
- TYPE(CMISSEquationsSetType) :: EquationsSet
- TYPE(CMISSFieldType) :: GeometricField,DependentField,MaterialsField,AnalyticField
- TYPE(CMISSFieldsType) :: Fields
- TYPE(CMISSGeneratedMeshType) :: GeneratedMesh
- TYPE(CMISSMeshType) :: Mesh
- TYPE(CMISSNodesType) :: Nodes
- TYPE(CMISSProblemType) :: Problem
- TYPE(CMISSControlLoopType) :: ControlLoop
- TYPE(CMISSRegionType) :: Region,WorldRegion
- TYPE(CMISSSolverType) :: Solver, LinearSolver, NonlinearSolver
- TYPE(CMISSSolverEquationsType) :: SolverEquations
- LOGICAL :: EXPORT_FIELD
- #ifdef WIN32
- !Quickwin type
- LOGICAL :: QUICKWIN_STATUS=.FALSE.
- TYPE(WINDOWCONFIG) :: QUICKWIN_WINDOW_CONFIG
- #endif
-
- !Generic CMISS variables
-
- INTEGER(CMISSIntg) :: NumberOfComputationalNodes,ComputationalNodeNumber,BoundaryNodeDomain
- INTEGER(CMISSIntg) :: EquationsSetIndex
- INTEGER(CMISSIntg) :: Err
-
- #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)
- !Get the computational nodes information
- CALL CMISSComputationalNumberOfNodesGet(NumberOfComputationalNodes,Err)
- CALL CMISSComputationalNodeNumberGet(ComputationalNodeNumber,Err)
- !-----------------------------------------------------------------------------------------------------------
- ! PROBLEM CONTROL PANEL
- !-----------------------------------------------------------------------------------------------------------
-
- ! Set number of elements for FEM discretization
- NUMBER_GLOBAL_X_ELEMENTS=4
- NUMBER_OF_DOMAINS=NumberOfComputationalNodes
- ! Set viscous coefficient
- NU_PARAM = 1.0_CMISSDP
- ! Set length of domain
- LENGTH = 1.0_CMISSDP
- !Set solver parameters
- LINEAR_SOLVER_DIRECT_FLAG=.FALSE.
- RELATIVE_TOLERANCE=1.0E-6_CMISSDP !default: 1.0E-05_CMISSDP
- ABSOLUTE_TOLERANCE=1.0E-6_CMISSDP !default: 1.0E-10_CMISSDP
- DIVERGENCE_TOLERANCE=1.0E5 !default: 1.0E5
- MAXIMUM_ITERATIONS=100000 !default: 100000
- RESTART_VALUE=3000 !default: 30
- LINESEARCH_ALPHA=1.0
- !Set all diganostic levels on for testing
- CALL MPI_BCAST(NUMBER_GLOBAL_X_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)
- !-----------------------------------------------------------------------------------------------------------
- !COORDINATE SYSTEM
- !-----------------------------------------------------------------------------------------------------------
- !Start the creation of a new RC coordinate system
- CALL CMISSCoordinateSystem_Initialise(CoordinateSystem,Err)
- CALL CMISSCoordinateSystem_CreateStart(CoordinateSystemUserNumber,CoordinateSystem,Err)
- !Set the coordinate system to be 1D
- CALL CMISSCoordinateSystem_DimensionSet(CoordinateSystem,1,Err)
- !Finish the creation of the coordinate system
- CALL CMISSCoordinateSystem_CreateFinish(CoordinateSystem,Err)
- !-----------------------------------------------------------------------------------------------------------
- !REGION
- !-----------------------------------------------------------------------------------------------------------
- !Start the creation of the region
- CALL CMISSRegion_Initialise(Region,Err)
- CALL CMISSRegion_CreateStart(RegionUserNumber,WorldRegion,Region,Err)
- CALL CMISSRegion_LabelSet(Region,"BurgersRegion",Err)
- !Set the regions coordinate system to the 1D RC coordinate system that we have created
- CALL CMISSRegion_CoordinateSystemSet(Region,CoordinateSystem,Err)
- !Finish the creation of the region
- CALL CMISSRegion_CreateFinish(Region,Err)
-
- !-----------------------------------------------------------------------------------------------------------
- !BASIS
- !-----------------------------------------------------------------------------------------------------------
- !Start the creation of a basis
- CALL CMISSBasis_Initialise(Basis,Err)
- CALL CMISSBasis_CreateStart(BasisUserNumber,Basis,Err)
- CALL CMISSBasis_TypeSet(Basis,CMISS_BASIS_LAGRANGE_HERMITE_TP_TYPE,Err)
- CALL CMISSBasis_NumberOfXiSet(Basis,1,Err)
- !Set the basis xi interpolation and number of Gauss points
- CALL CMISSBasis_InterpolationXiSet(Basis,(/CMISS_BASIS_LINEAR_LAGRANGE_INTERPOLATION/),Err)
- CALL CMISSBasis_QuadratureNumberOfGaussXiSet(Basis,(/2/),Err)
- !Finish the creation of the basis
- CALL CMISSBasis_CreateFinish(Basis,Err)
- !-----------------------------------------------------------------------------------------------------------
- !MESH
- !-----------------------------------------------------------------------------------------------------------
- !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 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
- CALL CMISSGeneratedMesh_ExtentSet(GeneratedMesh,(/LENGTH/),Err)
- CALL CMISSGeneratedMesh_NumberOfElementsSet(GeneratedMesh,(/NUMBER_GLOBAL_X_ELEMENTS/),Err)
- !Finish the creation of a generated mesh in the region
- CALL CMISSMesh_Initialise(Mesh,Err)
- CALL CMISSGeneratedMesh_CreateFinish(GeneratedMesh,MeshUserNumber,Mesh,Err)
- !-----------------------------------------------------------------------------------------------------------
- !GEOMETRIC FIELD
- !-----------------------------------------------------------------------------------------------------------
- !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 scaling to use
- CALL CMISSField_ScalingTypeSet(GeometricField,CMISS_FIELD_NO_SCALING,Err)
- !Set the domain to be used by the field components.
- CALL CMISSField_ComponentMeshComponentSet(GeometricField,CMISS_FIELD_U_VARIABLE_TYPE,1,1,Err)
- !Finish creating the field
- CALL CMISSField_CreateFinish(GeometricField,Err)
- !Update the geometric field parameters
- CALL CMISSGeneratedMesh_GeometricParametersCalculate(GeneratedMesh,GeometricField,Err)
- !-----------------------------------------------------------------------------------------------------------
- !EQUATIONS SETS
- !-----------------------------------------------------------------------------------------------------------
-
- !Create the equations_set for a static nonlinear burgers equation
- CALL CMISSEquationsSet_Initialise(EquationsSet,Err)
- CALL CMISSField_Initialise(EquationsSetField,Err)
- CALL CMISSEquationsSet_CreateStart(EquationsSetUserNumber,Region,GeometricField,CMISS_EQUATIONS_SET_FLUID_MECHANICS_CLASS, &
- & CMISS_EQUATIONS_SET_BURGERS_EQUATION_TYPE,CMISS_EQUATIONS_SET_STATIC_BURGERS_SUBTYPE,EquationsSetFieldUserNumber, &
- & EquationsSetField,EquationsSet,Err)
- !Finish creating the equations set
- CALL CMISSEquationsSet_CreateFinish(EquationsSet,Err)
- !-----------------------------------------------------------------------------------------------------------
- ! DEPENDENT FIELD
- !-----------------------------------------------------------------------------------------------------------
- !Create the equations set dependent field variables
- CALL CMISSField_Initialise(DependentField,Err)
- CALL CMISSEquationsSet_DependentCreateStart(EquationsSet,DependentFieldUserNumber,DependentField,Err)
- !Set the mesh component to be used by the field components.
- COMPONENT_NUMBER = 1
- CALL CMISSField_ComponentMeshComponentSet(DependentField,CMISS_FIELD_U_VARIABLE_TYPE,COMPONENT_NUMBER, &
- & COMPONENT_NUMBER,Err)
- CALL CMISSField_ComponentMeshComponentSet(DependentField,CMISS_FIELD_DELUDELN_VARIABLE_TYPE,COMPONENT_NUMBER, &
- & COMPONENT_NUMBER,Err)
- !Finish the equations set dependent field variables
- CALL CMISSEquationsSet_DependentCreateFinish(EquationsSet,Err)
- !Initialise dependent field
- CALL CMISSField_ComponentValuesInitialise(DependentField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE, &
- & COMPONENT_NUMBER,0.0_CMISSDP,Err)
- !-----------------------------------------------------------------------------------------------------------
- ! MATERIALS FIELD
- !-----------------------------------------------------------------------------------------------------------
- !Create the equations set material field variables
- CALL CMISSField_Initialise(MaterialsField,Err)
- CALL CMISSEquationsSet_MaterialsCreateStart(EquationsSet,MaterialsFieldUserNumber,MaterialsField,Err)
- !Finish the equations set material field variables
- CALL CMISSEquationsSet_MaterialsCreateFinish(EquationsSet,Err)
- !Initialise materials field
- CALL CMISSField_ComponentValuesInitialise(MaterialsField,CMISS_FIELD_U_VARIABLE_TYPE,CMISS_FIELD_VALUES_SET_TYPE, &
- & 1,NU_PARAM,Err)
- !-----------------------------------------------------------------------------------------------------------
- ! ANALYTIC FIELD
- !-----------------------------------------------------------------------------------------------------------
- !Create the equations set analytic field variables
- !CALL CMISSField_Initialise(AnalyticField,Err)
- !CALL CMISSEquationsSet_AnalyticCreateStart(EquationsSet,CMISS_EQUATIONS_SET_BURGERS_EQUATION_ONE_DIM_1,AnalyticFieldUserNumber, &
- ! & AnalyticField,Err)
- !Finish the equations set analytic field variables
- !CALL CMISSEquationsSet_AnalyticCreateFinish(EquationsSet,Err)
- !-----------------------------------------------------------------------------------------------------------
- ! EQUATIONS
- !-----------------------------------------------------------------------------------------------------------
- !Create the equations set equations
- CALL CMISSEquations_Initialise(Equations,Err)
- CALL CMISSEquationsSet_EquationsCreateStart(EquationsSet,Equations,Err)
- !Set the equations matrices sparsity type (Sparse/Full)
- CALL CMISSEquations_SparsityTypeSet(Equations,CMISS_EQUATIONS_FULL_MATRICES,Err)
- !Set the equations set output (NoOutput/TimingOutput/MatrixOutput/SolverMatrix/ElementMatrixOutput)
- CALL CMISSEquations_OutputTypeSet(Equations,CMISS_EQUATIONS_NO_OUTPUT,Err)
- !Finish the equations set equations
- CALL CMISSEquationsSet_EquationsCreateFinish(EquationsSet,Err)
- !Create the equations set boundary conditions
- !CALL CMISSEquationsSetBoundaryConditionsAnalytic(EquationsSet,Err)
- !-----------------------------------------------------------------------------------------------------------
- !PROBLEM
- !-----------------------------------------------------------------------------------------------------------
- !Create the problem
- CALL CMISSProblem_Initialise(Problem,Err)
- CALL CMISSProblem_CreateStart(ProblemUserNumber,Problem,Err)
- !Set the problem to be a static Burgers problem
- CALL CMISSProblem_SpecificationSet(Problem,CMISS_PROBLEM_FLUID_MECHANICS_CLASS,CMISS_PROBLEM_BURGERS_EQUATION_TYPE, &
- & CMISS_PROBLEM_STATIC_BURGERS_SUBTYPE,Err)
- !Finish the creation of a problem.
- CALL CMISSProblem_CreateFinish(Problem,Err)
- !Create the problem control
- CALL CMISSControlLoop_Initialise(ControlLoop,Err)
- CALL CMISSProblem_ControlLoopCreateStart(Problem,Err)
- !Get the control loop
- !CALL CMISSProblem_ControlLoopGet(Problem,CMISS_CONTROL_LOOP_NODE,ControlLoop,Err)
- !Finish creating the problem control loop
- CALL CMISSProblem_ControlLoopCreateFinish(Problem,Err)
- !-----------------------------------------------------------------------------------------------------------
- !SOLVER
- !-----------------------------------------------------------------------------------------------------------
- !Start the creation of the problem solvers
- !CALL CMISSSolver_Initialise(Solver,Err)
- CALL CMISSSolver_Initialise(NonlinearSolver,Err)
- CALL CMISSSolver_Initialise(LinearSolver,Err)
- CALL CMISSProblem_SolversCreateStart(Problem,Err)
- !Get the nonlinear solver
- CALL CMISSProblem_SolverGet(Problem,CMISS_CONTROL_LOOP_NODE,SolverUserNumber,NonlinearSolver,Err)
- !Set the nonlinear Jacobian type
- CALL CMISSSolver_NewtonJacobianCalculationTypeSet(NonlinearSolver,CMISS_SOLVER_NEWTON_JACOBIAN_EQUATIONS_CALCULATED,Err)
- !Set the output type (No/Progress/Timing/Solver)
- CALL CMISSSolver_OutputTypeSet(NonlinearSolver,CMISS_SOLVER_MATRIX_OUTPUT,Err)
- !Set the solver settings
- CALL CMISSSolver_NewtonAbsoluteToleranceSet(NonlinearSolver,ABSOLUTE_TOLERANCE,Err)
- CALL CMISSSolver_NewtonRelativeToleranceSet(NonlinearSolver,RELATIVE_TOLERANCE,Err)
- !Get the nonlinear linear solver
- CALL CMISSSolver_NewtonLinearSolverGet(NonlinearSolver,LinearSolver,Err)
- !Set the output type
- CALL CMISSSolver_OutputTypeSet(LinearSolver,CMISS_SOLVER_MATRIX_OUTPUT,Err)
- !Set the solver settings
- IF(LINEAR_SOLVER_DIRECT_FLAG) THEN
- CALL CMISSSolver_LinearTypeSet(LinearSolver,CMISS_SOLVER_LINEAR_DIRECT_SOLVE_TYPE,Err)
- CALL CMISSSolver_LibraryTypeSet(LinearSolver,CMISS_SOLVER_MUMPS_LIBRARY,Err)
- ELSE
- CALL CMISSSolver_LinearTypeSet(LinearSolver,CMISS_SOLVER_LINEAR_ITERATIVE_SOLVE_TYPE,Err)
- CALL CMISSSolver_LinearIterativeMaximumIterationsSet(LinearSolver,MAXIMUM_ITERATIONS,Err)
- CALL CMISSSolver_LinearIterativeDivergenceToleranceSet(LinearSolver,DIVERGENCE_TOLERANCE,Err)
- CALL CMISSSolver_LinearIterativeRelativeToleranceSet(LinearSolver,RELATIVE_TOLERANCE,Err)
- CALL CMISSSolver_LinearIterativeAbsoluteToleranceSet(LinearSolver,ABSOLUTE_TOLERANCE,Err)
- CALL CMISSSolver_LinearIterativeGMRESRestartSet(LinearSolver,RESTART_VALUE,Err)
- ENDIF
- !Finish the creation of the problem solver
- CALL CMISSProblem_SolversCreateFinish(Problem,Err)
- !-----------------------------------------------------------------------------------------------------------
- !SOLVER EQUATIONS
- !-----------------------------------------------------------------------------------------------------------
- !Create the problem solver equations
- CALL CMISSSolver_Initialise(LinearSolver,Err)
- CALL CMISSSolverEquations_Initialise(SolverEquations,Err)
- CALL CMISSProblem_SolverEquationsCreateStart(Problem,Err)
- !Get the solver equations
- CALL CMISSProblem_SolverGet(Problem,CMISS_CONTROL_LOOP_NODE,1,LinearSolver,Err)
- CALL CMISSSolver_SolverEquationsGet(LinearSolver,SolverEquations,Err)
- !Set the solver equations sparsity (Sparse/Full)
- 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)
- !-----------------------------------------------------------------------------------------------------------
- !BOUNDARY CONDITIONS
- !-----------------------------------------------------------------------------------------------------------
- !Set up the boundary conditions
- CALL CMISSBoundaryConditions_Initialise(BoundaryConditions,Err)
- CALL CMISSSolverEquations_BoundaryConditionsCreateStart(SolverEquations,BoundaryConditions,Err)
- !Set the fixed boundary conditions at the first node and last nodes
- FirstNodeNumber=1
- COMPONENT_NUMBER=1
- CALL CMISSNodes_Initialise(Nodes,Err)
- CALL CMISSRegion_NodesGet(Region,Nodes,Err)
- CALL CMISSNodes_NumberOfNodesGet(Nodes,LastNodeNumber,Err)
- CALL CMISSDecomposition_NodeDomainGet(Decomposition,FirstNodeNumber,1,FirstNodeDomain,Err)
- CALL CMISSDecomposition_NodeDomainGet(Decomposition,LastNodeNumber,1,LastNodeDomain,Err)
- IF(FirstNodeDomain==ComputationalNodeNumber) THEN
- CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1, &
- & CMISS_NO_GLOBAL_DERIV,FirstNodeNumber,COMPONENT_NUMBER,CMISS_BOUNDARY_CONDITION_FIXED, &
- & 1.0_CMISSDP,Err)
- ENDIF
- IF(LastNodeDomain==ComputationalNodeNumber) THEN
- CALL CMISSBoundaryConditions_SetNode(BoundaryConditions,DependentField,CMISS_FIELD_U_VARIABLE_TYPE,1, &
- & CMISS_NO_GLOBAL_DERIV,LastNodeNumber,COMPONENT_NUMBER,CMISS_BOUNDARY_CONDITION_FIXED, &
- & 0.0_CMISSDP,Err)
- ENDIF
- CALL CMISSSolverEquations_BoundaryConditionsCreateFinish(SolverEquations,Err)
- !-----------------------------------------------------------------------------------------------------------
- !SOLVE
- !-----------------------------------------------------------------------------------------------------------
- !Solve the problem
- CALL CMISSProblem_Solve(Problem,Err)
- !-----------------------------------------------------------------------------------------------------------
- !OUTPUT
- !-----------------------------------------------------------------------------------------------------------
- !Output Analytic analysis
- !Call CMISSAnalyticAnalysisOutput(DependentField,"BurgersAnalytics_1D",Err)
- !export fields
- EXPORT_FIELD=.TRUE.
- IF(EXPORT_FIELD) THEN
- CALL CMISSFields_Initialise(Fields,Err)
- CALL CMISSFields_Create(Region,Fields,Err)
- CALL CMISSFields_NodesExport(Fields,"Burgers_1D","FORTRAN",Err)
- CALL CMISSFields_ElementsExport(Fields,"Burgers_1D","FORTRAN",Err)
- CALL CMISSFields_Finalise(Fields,Err)
- ENDIF
-
- !Output timing summary
- !CALL TIMING_SUMMARY_OUTPUT(ERR,ERROR,*999)
- !Calculate the stop times and write out the elapsed user and system times
- ! CALL CPU_TIMER(USER_CPU,STOP_USER_TIME,ERR,ERROR,*999)
- ! CALL CPU_TIMER(SYSTEM_CPU,STOP_SYSTEM_TIME,ERR,ERROR,*999)
- !
- ! CALL WRITE_STRING_TWO_VALUE(GENERAL_OUTPUT_TYPE,"User time = ",STOP_USER_TIME(1)-START_USER_TIME(1),", System time = ", &
- ! & STOP_SYSTEM_TIME(1)-START_SYSTEM_TIME(1),ERR,ERROR,*999)
- !
- !CALL CMISS_FINALISE(ERR,ERROR,*999)
- !CALL CMISSFinalise(Err)
- WRITE(*,'(A)') "Program successfully completed."
-
- STOP
-
- END PROGRAM STATICBURGERSEXAMPLE