From ec620bfc22cb574f27ac6e5a33d589fe02c22430 Mon Sep 17 00:00:00 2001 From: Chris Bradley Date: Tue, 10 Apr 2018 14:43:24 +1200 Subject: [PATCH 1/9] Update for new computation environment routines. --- src/fortran/cellml_split_reaction_diffusion_equation.F90 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fortran/cellml_split_reaction_diffusion_equation.F90 b/src/fortran/cellml_split_reaction_diffusion_equation.F90 index 5999e6e..c746058 100644 --- a/src/fortran/cellml_split_reaction_diffusion_equation.F90 +++ b/src/fortran/cellml_split_reaction_diffusion_equation.F90 @@ -58,6 +58,7 @@ PROGRAM CELLML_SPLIT_REACTION_DIFFUSION_EQUATION !CMISS variables TYPE(cmfe_BasisType) :: Basis + TYPE(cmfe_ComputationEnvironmentType) :: computationEnvironment TYPE(cmfe_CoordinateSystemType) :: CoordinateSystem,WorldCoordinateSystem TYPE(cmfe_DecompositionType) :: Decomposition TYPE(cmfe_EquationsType) :: Equations @@ -110,8 +111,9 @@ PROGRAM CELLML_SPLIT_REACTION_DIFFUSION_EQUATION CALL cmfe_Initialise(WorldCoordinateSystem,WorldRegion,Err) CALL cmfe_ErrorHandlingModeSet(CMFE_ERRORS_TRAP_ERROR,Err) !Get the computational nodes information - CALL cmfe_ComputationalNumberOfNodesGet(NumberOfComputationalNodes,Err) - CALL cmfe_ComputationalNodeNumberGet(ComputationalNodeNumber,Err) + CALL cmfe_ComputationEnvironment_Initialise(computationEnvironment,err) + CALL cmfe_ComputationEnvironment_NumberOfWorldNodesGet(computationEnvironment,numberOfComputationalNodes,err) + CALL cmfe_ComputationEnvironment_WorldNodeNumberGet(computationEnvironment,computationalNodeNumber,err) NUMBER_GLOBAL_X_ELEMENTS=10 NUMBER_OF_DOMAINS=NumberOfComputationalNodes From 0b72fdd150ab6c9b5ba2d85f79df8c02ccd14289 Mon Sep 17 00:00:00 2001 From: Chris Bradley Date: Fri, 27 Apr 2018 20:05:29 +1200 Subject: [PATCH 2/9] Fixes for contexts. --- ...llml_split_reaction_diffusion_equation.F90 | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/fortran/cellml_split_reaction_diffusion_equation.F90 b/src/fortran/cellml_split_reaction_diffusion_equation.F90 index c746058..b39f581 100644 --- a/src/fortran/cellml_split_reaction_diffusion_equation.F90 +++ b/src/fortran/cellml_split_reaction_diffusion_equation.F90 @@ -1,4 +1,4 @@ -PROGRAM CELLML_SPLIT_REACTION_DIFFUSION_EQUATION +PROGRAM CellMLSplitReactionDiffusionEquation USE OpenCMISS USE OpenCMISS_Iron @@ -59,7 +59,8 @@ PROGRAM CELLML_SPLIT_REACTION_DIFFUSION_EQUATION TYPE(cmfe_BasisType) :: Basis TYPE(cmfe_ComputationEnvironmentType) :: computationEnvironment - TYPE(cmfe_CoordinateSystemType) :: CoordinateSystem,WorldCoordinateSystem + TYPE(cmfe_ContextType) :: context + TYPE(cmfe_CoordinateSystemType) :: CoordinateSystem TYPE(cmfe_DecompositionType) :: Decomposition TYPE(cmfe_EquationsType) :: Equations TYPE(cmfe_EquationsSetType) :: EquationsSet @@ -108,10 +109,14 @@ PROGRAM CELLML_SPLIT_REACTION_DIFFUSION_EQUATION !----------------------------------------------------------------------------------------------------------- !Intialise OpenCMISS - CALL cmfe_Initialise(WorldCoordinateSystem,WorldRegion,Err) - CALL cmfe_ErrorHandlingModeSet(CMFE_ERRORS_TRAP_ERROR,Err) + CALL cmfe_Context_Initialise(context,err) + CALL cmfe_Initialise(context,err) + CALL cmfe_ErrorHandlingModeSet(CMFE_ERRORS_TRAP_ERROR,err) + CALL cmfe_Region_Initialise(worldRegion,err) + CALL cmfe_Context_WorldRegionGet(context,worldRegion,err) !Get the computational nodes information CALL cmfe_ComputationEnvironment_Initialise(computationEnvironment,err) + CALL cmfe_Context_ComputationEnvironmentGet(context,computationEnvironment,err) CALL cmfe_ComputationEnvironment_NumberOfWorldNodesGet(computationEnvironment,numberOfComputationalNodes,err) CALL cmfe_ComputationEnvironment_WorldNodeNumberGet(computationEnvironment,computationalNodeNumber,err) @@ -129,7 +134,7 @@ PROGRAM CELLML_SPLIT_REACTION_DIFFUSION_EQUATION !Start the creation of a new RC coordinate system CALL cmfe_CoordinateSystem_Initialise(CoordinateSystem,Err) - CALL cmfe_CoordinateSystem_CreateStart(CoordinateSystemUserNumber,CoordinateSystem,Err) + CALL cmfe_CoordinateSystem_CreateStart(CoordinateSystemUserNumber,context,CoordinateSystem,Err) !Set the coordinate system to be 1D CALL cmfe_CoordinateSystem_DimensionSet(CoordinateSystem,1,Err) !Finish the creation of the coordinate system @@ -154,7 +159,7 @@ PROGRAM CELLML_SPLIT_REACTION_DIFFUSION_EQUATION !Start the creation of a basis (default is linear lagrange) CALL cmfe_Basis_Initialise(Basis,Err) - CALL cmfe_Basis_CreateStart(BasisUserNumber,Basis,Err) + CALL cmfe_Basis_CreateStart(BasisUserNumber,context,Basis,Err) !Set the basis to be a linear Lagrange basis CALL cmfe_Basis_NumberOfXiSet(Basis,1,Err) !Finish the creation of the basis @@ -389,7 +394,7 @@ PROGRAM CELLML_SPLIT_REACTION_DIFFUSION_EQUATION !Create the problem CALL cmfe_Problem_Initialise(Problem,Err) - CALL cmfe_Problem_CreateStart(ProblemUserNumber,[CMFE_PROBLEM_CLASSICAL_FIELD_CLASS, & + CALL cmfe_Problem_CreateStart(ProblemUserNumber,context,[CMFE_PROBLEM_CLASSICAL_FIELD_CLASS, & & CMFE_PROBLEM_REACTION_DIFFUSION_EQUATION_TYPE,CMFE_PROBLEM_CELLML_REAC_INTEG_REAC_DIFF_STRANG_SPLIT_SUBTYPE],Problem,Err) !Finish the creation of a problem. CALL cmfe_Problem_CreateFinish(Problem,Err) @@ -536,10 +541,10 @@ PROGRAM CELLML_SPLIT_REACTION_DIFFUSION_EQUATION CALL cmfe_Fields_Finalise(Fields,Err) ENDIF - CALL cmfe_Finalise(Err) + CALL cmfe_Finalise(context,Err) WRITE(*,'(A)') "Program successfully completed." STOP -END PROGRAM CELLML_SPLIT_REACTION_DIFFUSION_EQUATION +END PROGRAM CellMLSplitReactionDiffusionEquation From f4880fdce63b87e786dd58be9c37d262c1dc4ca0 Mon Sep 17 00:00:00 2001 From: Chris Bradley Date: Sun, 3 Jun 2018 10:54:08 +1200 Subject: [PATCH 3/9] Field_MeshDecomposition -> Field_Decomposition --- src/fortran/cellml_split_reaction_diffusion_equation.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fortran/cellml_split_reaction_diffusion_equation.F90 b/src/fortran/cellml_split_reaction_diffusion_equation.F90 index b39f581..691b875 100644 --- a/src/fortran/cellml_split_reaction_diffusion_equation.F90 +++ b/src/fortran/cellml_split_reaction_diffusion_equation.F90 @@ -204,7 +204,7 @@ PROGRAM CellMLSplitReactionDiffusionEquation CALL cmfe_Field_Initialise(GeometricField,Err) CALL cmfe_Field_CreateStart(GeometricFieldUserNumber,Region,GeometricField,Err) !Set the decomposition to use - CALL cmfe_Field_MeshDecompositionSet(GeometricField,Decomposition,Err) + CALL cmfe_Field_DecompositionSet(GeometricField,Decomposition,Err) !Set the domain to be used by the field components. CALL cmfe_Field_ComponentMeshComponentSet(GeometricField,CMFE_FIELD_U_VARIABLE_TYPE,1,1,Err) !Finish creating the field From 51ccbdca5c99b908b35a521ae530daddec5f848c Mon Sep 17 00:00:00 2001 From: Chris Bradley Date: Sat, 15 Sep 2018 18:16:12 +1200 Subject: [PATCH 4/9] Changes for decompositions --- ...llml_split_reaction_diffusion_equation.F90 | 61 ++++++++++++------- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/src/fortran/cellml_split_reaction_diffusion_equation.F90 b/src/fortran/cellml_split_reaction_diffusion_equation.F90 index 691b875..63bf8e1 100644 --- a/src/fortran/cellml_split_reaction_diffusion_equation.F90 +++ b/src/fortran/cellml_split_reaction_diffusion_equation.F90 @@ -30,25 +30,26 @@ PROGRAM CellMLSplitReactionDiffusionEquation 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 :: SourceFieldUserNumber=13 - INTEGER(CMISSIntg), PARAMETER :: CellMLUserNumber=14 - INTEGER(CMISSIntg), PARAMETER :: CellMLModelsFieldUserNumber=15 - INTEGER(CMISSIntg), PARAMETER :: CellMLStateFieldUserNumber=16 - INTEGER(CMISSIntg), PARAMETER :: CellMLIntermediateFieldUserNumber=17 - INTEGER(CMISSIntg), PARAMETER :: CellMLParametersFieldUserNumber=18 + INTEGER(CMISSIntg), PARAMETER :: DecomposerUserNumber=7 + INTEGER(CMISSIntg), PARAMETER :: GeometricFieldUserNumber=8 + INTEGER(CMISSIntg), PARAMETER :: EquationsSetFieldUserNumber=9 + INTEGER(CMISSIntg), PARAMETER :: DependentFieldUserNumber=10 + INTEGER(CMISSIntg), PARAMETER :: MaterialsFieldUserNumber=11 + INTEGER(CMISSIntg), PARAMETER :: EquationsSetUserNumber=12 + INTEGER(CMISSIntg), PARAMETER :: ProblemUserNumber=13 + INTEGER(CMISSIntg), PARAMETER :: SourceFieldUserNumber=14 + INTEGER(CMISSIntg), PARAMETER :: CellMLUserNumber=15 + INTEGER(CMISSIntg), PARAMETER :: CellMLModelsFieldUserNumber=16 + INTEGER(CMISSIntg), PARAMETER :: CellMLStateFieldUserNumber=17 + INTEGER(CMISSIntg), PARAMETER :: CellMLIntermediateFieldUserNumber=18 + INTEGER(CMISSIntg), PARAMETER :: CellMLParametersFieldUserNumber=19 !Program types !Program variables INTEGER(CMISSIntg) :: NUMBER_GLOBAL_X_ELEMENTS,CONDITION - INTEGER(CMISSIntg) :: NUMBER_OF_DOMAINS,NODE_NUMBER,NodeDomain + INTEGER(CMISSIntg) :: NODE_NUMBER,NodeDomain INTEGER(CMISSIntg),DIMENSION(2) :: BCNODES INTEGER(CMISSIntg) :: MPI_IERROR INTEGER :: node @@ -58,25 +59,27 @@ PROGRAM CellMLSplitReactionDiffusionEquation !CMISS variables TYPE(cmfe_BasisType) :: Basis + TYPE(cmfe_BoundaryConditionsType) :: BoundaryConditions + TYPE(cmfe_CellMLType) :: CellML + TYPE(cmfe_CellMLEquationsType) :: CellMLEquations TYPE(cmfe_ComputationEnvironmentType) :: computationEnvironment TYPE(cmfe_ContextType) :: context + TYPE(cmfe_ControlLoopType) :: ControlLoop TYPE(cmfe_CoordinateSystemType) :: CoordinateSystem TYPE(cmfe_DecompositionType) :: Decomposition + TYPE(cmfe_DecomposerType) :: decomposer TYPE(cmfe_EquationsType) :: Equations TYPE(cmfe_EquationsSetType) :: EquationsSet TYPE(cmfe_FieldType) :: GeometricField,EquationsSetField,DependentField,MaterialsField,SourceField + TYPE(cmfe_FieldType) :: CellMLModelsField,CellMLStateField,CellMLIntermediateField,CellMLParametersField TYPE(cmfe_FieldsType) :: Fields - TYPE(cmfe_BoundaryConditionsType) :: BoundaryConditions TYPE(cmfe_GeneratedMeshType) :: GeneratedMesh TYPE(cmfe_MeshType) :: Mesh TYPE(cmfe_ProblemType) :: Problem - TYPE(cmfe_ControlLoopType) :: ControlLoop TYPE(cmfe_RegionType) :: Region,WorldRegion TYPE(cmfe_SolverType) :: Solver, LinearSolver TYPE(cmfe_SolverEquationsType) :: SolverEquations - TYPE(cmfe_CellMLType) :: CellML - TYPE(cmfe_CellMLEquationsType) :: CellMLEquations - TYPE(cmfe_FieldType) :: CellMLModelsField,CellMLStateField,CellMLIntermediateField,CellMLParametersField + TYPE(cmfe_WorkGroupType) :: worldWorkGroup LOGICAL :: EXPORT_FIELD @@ -89,7 +92,7 @@ PROGRAM CellMLSplitReactionDiffusionEquation !Generic CMISS variables INTEGER(CMISSIntg) :: NumberOfComputationalNodes,ComputationalNodeNumber - INTEGER(CMISSIntg) :: EquationsSetIndex,CellMLIndex + INTEGER(CMISSIntg) :: decompositionIndex,EquationsSetIndex,CellMLIndex INTEGER(CMISSIntg) :: Err @@ -114,14 +117,17 @@ PROGRAM CellMLSplitReactionDiffusionEquation CALL cmfe_ErrorHandlingModeSet(CMFE_ERRORS_TRAP_ERROR,err) CALL cmfe_Region_Initialise(worldRegion,err) CALL cmfe_Context_WorldRegionGet(context,worldRegion,err) + !Get the computational nodes information CALL cmfe_ComputationEnvironment_Initialise(computationEnvironment,err) CALL cmfe_Context_ComputationEnvironmentGet(context,computationEnvironment,err) - CALL cmfe_ComputationEnvironment_NumberOfWorldNodesGet(computationEnvironment,numberOfComputationalNodes,err) - CALL cmfe_ComputationEnvironment_WorldNodeNumberGet(computationEnvironment,computationalNodeNumber,err) + + CALL cmfe_WorkGroup_Initialise(worldWorkGroup,err) + CALL cmfe_ComputationEnvironment_WorldWorkGroupGet(computationEnvironment,worldWorkGroup,err) + CALL cmfe_WorkGroup_NumberOfGroupNodesGet(worldWorkGroup,numberOfComputationNodes,err) + CALL cmfe_WorkGroup_GroupNodeNumberGet(worldWorkGroup,computationNodeNumber,err) NUMBER_GLOBAL_X_ELEMENTS=10 - NUMBER_OF_DOMAINS=NumberOfComputationalNodes !Set all diganostic levels on for testing @@ -196,6 +202,17 @@ PROGRAM CellMLSplitReactionDiffusionEquation !Finish the decomposition CALL cmfe_Decomposition_CreateFinish(Decomposition,Err) + !----------------------------------------------------------------------------------------------------------- + ! DECOMPOSER + !----------------------------------------------------------------------------------------------------------- + + CALL cmfe_Decomposer_Initialise(decomposer,err) + CALL cmfe_Decomposer_CreateStart(decomposerUserNumber,region,worldWorkGroup,decomposer,err) + !Add in the decomposition + CALL cmfe_Decomposer_DecompositionAdd(decomposer,decomposition,decompositionIndex,err) + !Finish the decomposer + CALL cmfe_Decomposer_CreateFinish(decomposer,err) + !----------------------------------------------------------------------------------------------------------- ! GEOMETRIC FIELD !----------------------------------------------------------------------------------------------------------- From c05bbe4fcc93e28ca9cea0c4dd183301ebdf4580 Mon Sep 17 00:00:00 2001 From: Chris Bradley Date: Sun, 20 Jun 2021 15:58:31 +1200 Subject: [PATCH 5/9] Adding OPENCMISS_TOOLCHAIN --- CMakeLists.txt | 4 ++++ src/fortran/cellml_split_reaction_diffusion_equation.F90 | 6 ++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ddbea48..8cb630c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,10 @@ set(ExampleName "cellml_split_reaction_diffusion_equation") cmake_minimum_required(VERSION 3.4 FATAL_ERROR) +if (DEFINED OpenCMISSLibs_DIR) + set(CMAKE_PROJECT_INCLUDE_BEFORE ${OpenCMISSLibs_DIR}/opencmisslibs-preconfig.cmake) +endif () + project(${ExampleName} VERSION 1.0 LANGUAGES C Fortran) find_package(OpenCMISSLibs 1.3.0 REQUIRED COMPONENTS Iron CONFIG) diff --git a/src/fortran/cellml_split_reaction_diffusion_equation.F90 b/src/fortran/cellml_split_reaction_diffusion_equation.F90 index 63bf8e1..e22de94 100644 --- a/src/fortran/cellml_split_reaction_diffusion_equation.F90 +++ b/src/fortran/cellml_split_reaction_diffusion_equation.F90 @@ -124,15 +124,14 @@ PROGRAM CellMLSplitReactionDiffusionEquation CALL cmfe_WorkGroup_Initialise(worldWorkGroup,err) CALL cmfe_ComputationEnvironment_WorldWorkGroupGet(computationEnvironment,worldWorkGroup,err) - CALL cmfe_WorkGroup_NumberOfGroupNodesGet(worldWorkGroup,numberOfComputationNodes,err) - CALL cmfe_WorkGroup_GroupNodeNumberGet(worldWorkGroup,computationNodeNumber,err) + CALL cmfe_WorkGroup_NumberOfGroupNodesGet(worldWorkGroup,numberOfComputationalNodes,err) + CALL cmfe_WorkGroup_GroupNodeNumberGet(worldWorkGroup,computationalNodeNumber,err) NUMBER_GLOBAL_X_ELEMENTS=10 !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 @@ -198,7 +197,6 @@ PROGRAM CellMLSplitReactionDiffusionEquation CALL cmfe_Decomposition_CreateStart(DecompositionUserNumber,Mesh,Decomposition,Err) !Set the decomposition to be a general decomposition with the specified number of domains CALL cmfe_Decomposition_TypeSet(Decomposition,CMFE_DECOMPOSITION_CALCULATED_TYPE,Err) - CALL cmfe_Decomposition_NumberOfDomainsSet(Decomposition,NUMBER_OF_DOMAINS,Err) !Finish the decomposition CALL cmfe_Decomposition_CreateFinish(Decomposition,Err) From 5536fbd0d691338012a14ccb7c72e96b969fec02 Mon Sep 17 00:00:00 2001 From: Chris Bradley Date: Thu, 17 Nov 2022 11:04:31 +1300 Subject: [PATCH 6/9] Backup --- ...llml_split_reaction_diffusion_equation.F90 | 51 +++++++++++-------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/src/fortran/cellml_split_reaction_diffusion_equation.F90 b/src/fortran/cellml_split_reaction_diffusion_equation.F90 index e22de94..20832d4 100644 --- a/src/fortran/cellml_split_reaction_diffusion_equation.F90 +++ b/src/fortran/cellml_split_reaction_diffusion_equation.F90 @@ -24,25 +24,26 @@ PROGRAM CellMLSplitReactionDiffusionEquation REAL(CMISSRP), PARAMETER :: LENGTH=100.0_CMISSRP - 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 :: DecomposerUserNumber=7 - INTEGER(CMISSIntg), PARAMETER :: GeometricFieldUserNumber=8 - INTEGER(CMISSIntg), PARAMETER :: EquationsSetFieldUserNumber=9 - INTEGER(CMISSIntg), PARAMETER :: DependentFieldUserNumber=10 - INTEGER(CMISSIntg), PARAMETER :: MaterialsFieldUserNumber=11 - INTEGER(CMISSIntg), PARAMETER :: EquationsSetUserNumber=12 - INTEGER(CMISSIntg), PARAMETER :: ProblemUserNumber=13 - INTEGER(CMISSIntg), PARAMETER :: SourceFieldUserNumber=14 - INTEGER(CMISSIntg), PARAMETER :: CellMLUserNumber=15 - INTEGER(CMISSIntg), PARAMETER :: CellMLModelsFieldUserNumber=16 - INTEGER(CMISSIntg), PARAMETER :: CellMLStateFieldUserNumber=17 - INTEGER(CMISSIntg), PARAMETER :: CellMLIntermediateFieldUserNumber=18 - INTEGER(CMISSIntg), PARAMETER :: CellMLParametersFieldUserNumber=19 + INTEGER(CMISSIntg), PARAMETER :: ContextUserNumber=1 + INTEGER(CMISSIntg), PARAMETER :: CoordinateSystemUserNumber=2 + INTEGER(CMISSIntg), PARAMETER :: RegionUserNumber=3 + INTEGER(CMISSIntg), PARAMETER :: BasisUserNumber=4 + INTEGER(CMISSIntg), PARAMETER :: GeneratedMeshUserNumber=5 + INTEGER(CMISSIntg), PARAMETER :: MeshUserNumber=6 + INTEGER(CMISSIntg), PARAMETER :: DecompositionUserNumber=7 + INTEGER(CMISSIntg), PARAMETER :: DecomposerUserNumber=8 + INTEGER(CMISSIntg), PARAMETER :: GeometricFieldUserNumber=9 + INTEGER(CMISSIntg), PARAMETER :: EquationsSetFieldUserNumber=10 + INTEGER(CMISSIntg), PARAMETER :: DependentFieldUserNumber=11 + INTEGER(CMISSIntg), PARAMETER :: MaterialsFieldUserNumber=12 + INTEGER(CMISSIntg), PARAMETER :: EquationsSetUserNumber=13 + INTEGER(CMISSIntg), PARAMETER :: ProblemUserNumber=14 + INTEGER(CMISSIntg), PARAMETER :: SourceFieldUserNumber=15 + INTEGER(CMISSIntg), PARAMETER :: CellMLUserNumber=16 + INTEGER(CMISSIntg), PARAMETER :: CellMLModelsFieldUserNumber=17 + INTEGER(CMISSIntg), PARAMETER :: CellMLStateFieldUserNumber=18 + INTEGER(CMISSIntg), PARAMETER :: CellMLIntermediateFieldUserNumber=19 + INTEGER(CMISSIntg), PARAMETER :: CellMLParametersFieldUserNumber=20 !Program types @@ -112,8 +113,11 @@ PROGRAM CellMLSplitReactionDiffusionEquation !----------------------------------------------------------------------------------------------------------- !Intialise OpenCMISS + CALL cmfe_Initialise(err) + CALL cmfe_ErrorHandlingModeSet(CMFE_ERRORS_TRAP_ERROR,err) + !Create a context CALL cmfe_Context_Initialise(context,err) - CALL cmfe_Initialise(context,err) + CALL cmfe_Context_Create(ContextUserNumber,context,err) CALL cmfe_ErrorHandlingModeSet(CMFE_ERRORS_TRAP_ERROR,err) CALL cmfe_Region_Initialise(worldRegion,err) CALL cmfe_Context_WorldRegionGet(context,worldRegion,err) @@ -555,8 +559,11 @@ PROGRAM CellMLSplitReactionDiffusionEquation CALL cmfe_Fields_ElementsExport(Fields,"cellml_split_reaction_diffusion_equation","FORTRAN",Err) CALL cmfe_Fields_Finalise(Fields,Err) ENDIF - - CALL cmfe_Finalise(context,Err) + + !Destroy the context + CALL cmfe_Context_Destroy(context,err) + !Finalise OpenCMISS + CALL cmfe_Finalise(err) WRITE(*,'(A)') "Program successfully completed." From c789938d7793b6dc56b351f871a79a9de5260bb3 Mon Sep 17 00:00:00 2001 From: Chris Bradley Date: Wed, 11 Jan 2023 23:22:09 +1300 Subject: [PATCH 7/9] Update code style. --- ...llml_split_reaction_diffusion_equation.F90 | 498 ++++++++---------- 1 file changed, 231 insertions(+), 267 deletions(-) diff --git a/src/fortran/cellml_split_reaction_diffusion_equation.F90 b/src/fortran/cellml_split_reaction_diffusion_equation.F90 index 20832d4..c7361a5 100644 --- a/src/fortran/cellml_split_reaction_diffusion_equation.F90 +++ b/src/fortran/cellml_split_reaction_diffusion_equation.F90 @@ -6,10 +6,6 @@ PROGRAM CellMLSplitReactionDiffusionEquation USE MPI #endif -#ifdef WIN32 - USE IFQWIN -#endif - IMPLICIT NONE #ifdef NOMPIMOD @@ -24,89 +20,68 @@ PROGRAM CellMLSplitReactionDiffusionEquation REAL(CMISSRP), PARAMETER :: LENGTH=100.0_CMISSRP - INTEGER(CMISSIntg), PARAMETER :: ContextUserNumber=1 - INTEGER(CMISSIntg), PARAMETER :: CoordinateSystemUserNumber=2 - INTEGER(CMISSIntg), PARAMETER :: RegionUserNumber=3 - INTEGER(CMISSIntg), PARAMETER :: BasisUserNumber=4 - INTEGER(CMISSIntg), PARAMETER :: GeneratedMeshUserNumber=5 - INTEGER(CMISSIntg), PARAMETER :: MeshUserNumber=6 - INTEGER(CMISSIntg), PARAMETER :: DecompositionUserNumber=7 - INTEGER(CMISSIntg), PARAMETER :: DecomposerUserNumber=8 - INTEGER(CMISSIntg), PARAMETER :: GeometricFieldUserNumber=9 - INTEGER(CMISSIntg), PARAMETER :: EquationsSetFieldUserNumber=10 - INTEGER(CMISSIntg), PARAMETER :: DependentFieldUserNumber=11 - INTEGER(CMISSIntg), PARAMETER :: MaterialsFieldUserNumber=12 - INTEGER(CMISSIntg), PARAMETER :: EquationsSetUserNumber=13 - INTEGER(CMISSIntg), PARAMETER :: ProblemUserNumber=14 - INTEGER(CMISSIntg), PARAMETER :: SourceFieldUserNumber=15 - INTEGER(CMISSIntg), PARAMETER :: CellMLUserNumber=16 - INTEGER(CMISSIntg), PARAMETER :: CellMLModelsFieldUserNumber=17 - INTEGER(CMISSIntg), PARAMETER :: CellMLStateFieldUserNumber=18 - INTEGER(CMISSIntg), PARAMETER :: CellMLIntermediateFieldUserNumber=19 - INTEGER(CMISSIntg), PARAMETER :: CellMLParametersFieldUserNumber=20 + INTEGER(CMISSIntg), PARAMETER :: CONTEXT_USER_NUMBER=1 + INTEGER(CMISSIntg), PARAMETER :: COORDINATE_SYSTEM_USER_NUMBER=2 + INTEGER(CMISSIntg), PARAMETER :: REGION_USER_NUMBER=3 + INTEGER(CMISSIntg), PARAMETER :: BASIS_USER_NUMBER=4 + INTEGER(CMISSIntg), PARAMETER :: GENERATED_MESH_USER_NUMBER=5 + INTEGER(CMISSIntg), PARAMETER :: MESH_USER_NUMBER=6 + INTEGER(CMISSIntg), PARAMETER :: DECOMPOSITION_USER_NUMBER=7 + INTEGER(CMISSIntg), PARAMETER :: DECOMPOSER_USER_NUMBER=8 + INTEGER(CMISSIntg), PARAMETER :: GEOMETRIC_FIELD_USER_NUMBER=9 + INTEGER(CMISSIntg), PARAMETER :: EQUATIONS_SET_FIELD_USER_NUMBER=10 + INTEGER(CMISSIntg), PARAMETER :: DEPENDENT_FIELD_USER_NUMBER=11 + INTEGER(CMISSIntg), PARAMETER :: MATERIALS_FIELD_USER_NUMBER=12 + INTEGER(CMISSIntg), PARAMETER :: SOURCE_FIELD_USER_NUMBER=13 + INTEGER(CMISSIntg), PARAMETER :: CELLML_MODELS_FIELD_USER_NUMBER=14 + INTEGER(CMISSIntg), PARAMETER :: CELLML_STATE_FIELD_USER_NUMBER=15 + INTEGER(CMISSIntg), PARAMETER :: CELLML_INTERMEDIATE_FIELD_USER_NUMBER=16 + INTEGER(CMISSIntg), PARAMETER :: CELLML_PARAMETERS_FIELD_USER_NUMBER=17 + INTEGER(CMISSIntg), PARAMETER :: EQUATIONS_SET_USER_NUMBER=18 + INTEGER(CMISSIntg), PARAMETER :: CELLML_USER_NUMBER=19 + INTEGER(CMISSIntg), PARAMETER :: PROBLEM_USER_NUMBER=20 !Program types !Program variables - INTEGER(CMISSIntg) :: NUMBER_GLOBAL_X_ELEMENTS,CONDITION - INTEGER(CMISSIntg) :: NODE_NUMBER,NodeDomain - INTEGER(CMISSIntg),DIMENSION(2) :: BCNODES - INTEGER(CMISSIntg) :: MPI_IERROR - INTEGER :: node - REAL(CMISSRP) :: VALUE + INTEGER(CMISSIntg) :: numberOfGlobalXElements + INTEGER(CMISSIntg) :: nodeDomain,nodeIdx,nodeNumber + INTEGER(CMISSIntg) :: boundaryConditionNodes(2) INTEGER(CMISSIntg) :: constantModelIndex !CMISS variables - TYPE(cmfe_BasisType) :: Basis - TYPE(cmfe_BoundaryConditionsType) :: BoundaryConditions - TYPE(cmfe_CellMLType) :: CellML - TYPE(cmfe_CellMLEquationsType) :: CellMLEquations + TYPE(cmfe_BasisType) :: basis + TYPE(cmfe_BoundaryConditionsType) :: boundaryConditions + TYPE(cmfe_CellMLType) :: cellML + TYPE(cmfe_CellMLEquationsType) :: cellMLEquations TYPE(cmfe_ComputationEnvironmentType) :: computationEnvironment TYPE(cmfe_ContextType) :: context - TYPE(cmfe_ControlLoopType) :: ControlLoop - TYPE(cmfe_CoordinateSystemType) :: CoordinateSystem - TYPE(cmfe_DecompositionType) :: Decomposition + TYPE(cmfe_ControlLoopType) :: controlLoop + TYPE(cmfe_CoordinateSystemType) :: coordinateSystem + TYPE(cmfe_DecompositionType) :: decomposition TYPE(cmfe_DecomposerType) :: decomposer - TYPE(cmfe_EquationsType) :: Equations - TYPE(cmfe_EquationsSetType) :: EquationsSet - TYPE(cmfe_FieldType) :: GeometricField,EquationsSetField,DependentField,MaterialsField,SourceField - TYPE(cmfe_FieldType) :: CellMLModelsField,CellMLStateField,CellMLIntermediateField,CellMLParametersField - TYPE(cmfe_FieldsType) :: Fields - TYPE(cmfe_GeneratedMeshType) :: GeneratedMesh - TYPE(cmfe_MeshType) :: Mesh - TYPE(cmfe_ProblemType) :: Problem - TYPE(cmfe_RegionType) :: Region,WorldRegion - TYPE(cmfe_SolverType) :: Solver, LinearSolver - TYPE(cmfe_SolverEquationsType) :: SolverEquations + TYPE(cmfe_EquationsType) :: equations + TYPE(cmfe_EquationsSetType) :: equationsSet + TYPE(cmfe_FieldType) :: geometricField,equationsSetField,dependentField,materialsField,sourceField + TYPE(cmfe_FieldType) :: cellMLModelsField,cellMLStateField,cellMLIntermediateField,cellMLParametersField + TYPE(cmfe_FieldsType) :: fields + TYPE(cmfe_GeneratedMeshType) :: generatedMesh + TYPE(cmfe_MeshType) :: mesh + TYPE(cmfe_ProblemType) :: problem + TYPE(cmfe_RegionType) :: region,worldRegion + TYPE(cmfe_SolverType) :: solver, linearSolver + TYPE(cmfe_SolverEquationsType) :: solverEquations TYPE(cmfe_WorkGroupType) :: worldWorkGroup - LOGICAL :: EXPORT_FIELD - -#ifdef WIN32 - !Quickwin type - LOGICAL :: QUICKWIN_STATUS=.FALSE. - TYPE(WINDOWCONFIG) :: QUICKWIN_WINDOW_CONFIG -#endif + LOGICAL :: exportField !Generic CMISS variables - INTEGER(CMISSIntg) :: NumberOfComputationalNodes,ComputationalNodeNumber - INTEGER(CMISSIntg) :: decompositionIndex,EquationsSetIndex,CellMLIndex - 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 + INTEGER(CMISSIntg) :: numberOfComputationalNodes,computationalNodeNumber + INTEGER(CMISSIntg) :: decompositionIndex,equationsSetIndex,cellMLIndex + INTEGER(CMISSIntg) :: err !----------------------------------------------------------------------------------------------------------- ! PROBLEM CONTROL PANEL @@ -117,7 +92,7 @@ PROGRAM CellMLSplitReactionDiffusionEquation CALL cmfe_ErrorHandlingModeSet(CMFE_ERRORS_TRAP_ERROR,err) !Create a context CALL cmfe_Context_Initialise(context,err) - CALL cmfe_Context_Create(ContextUserNumber,context,err) + CALL cmfe_Context_Create(CONTEXT_USER_NUMBER,context,err) CALL cmfe_ErrorHandlingModeSet(CMFE_ERRORS_TRAP_ERROR,err) CALL cmfe_Region_Initialise(worldRegion,err) CALL cmfe_Context_WorldRegionGet(context,worldRegion,err) @@ -131,85 +106,81 @@ PROGRAM CellMLSplitReactionDiffusionEquation CALL cmfe_WorkGroup_NumberOfGroupNodesGet(worldWorkGroup,numberOfComputationalNodes,err) CALL cmfe_WorkGroup_GroupNodeNumberGet(worldWorkGroup,computationalNodeNumber,err) - NUMBER_GLOBAL_X_ELEMENTS=10 - - !Set all diganostic levels on for testing - - CALL MPI_BCAST(NUMBER_GLOBAL_X_ELEMENTS,1,MPI_INTEGER,0,MPI_COMM_WORLD,MPI_IERROR) + numberOfGlobalXElements=10 !----------------------------------------------------------------------------------------------------------- ! COORDINATE SYSTEM !----------------------------------------------------------------------------------------------------------- !Start the creation of a new RC coordinate system - CALL cmfe_CoordinateSystem_Initialise(CoordinateSystem,Err) - CALL cmfe_CoordinateSystem_CreateStart(CoordinateSystemUserNumber,context,CoordinateSystem,Err) + CALL cmfe_CoordinateSystem_Initialise(coordinateSystem,err) + CALL cmfe_CoordinateSystem_CreateStart(COORDINATE_SYSTEM_USER_NUMBER,context,coordinateSystem,err) !Set the coordinate system to be 1D - CALL cmfe_CoordinateSystem_DimensionSet(CoordinateSystem,1,Err) + CALL cmfe_CoordinateSystem_DimensionSet(coordinateSystem,1,err) !Finish the creation of the coordinate system - CALL cmfe_CoordinateSystem_CreateFinish(CoordinateSystem,Err) + CALL cmfe_CoordinateSystem_CreateFinish(coordinateSystem,err) !----------------------------------------------------------------------------------------------------------- ! REGION !----------------------------------------------------------------------------------------------------------- !Start the creation of the region - CALL cmfe_Region_Initialise(Region,Err) - CALL cmfe_Region_CreateStart(RegionUserNumber,WorldRegion,Region,Err) - CALL cmfe_Region_LabelSet(Region,"cellml_split_reaction_diffusion_equation",Err) + CALL cmfe_Region_Initialise(region,err) + CALL cmfe_Region_CreateStart(REGION_USER_NUMBER,worldRegion,region,err) + CALL cmfe_Region_LabelSet(region,"cellml_split_reaction_diffusion_equation",err) !Set the regions coordinate system to the 1D RC coordinate system that we have created - CALL cmfe_Region_CoordinateSystemSet(Region,CoordinateSystem,Err) + CALL cmfe_Region_CoordinateSystemSet(region,coordinateSystem,err) !Finish the creation of the region - CALL cmfe_Region_CreateFinish(Region,Err) + CALL cmfe_Region_CreateFinish(region,err) !----------------------------------------------------------------------------------------------------------- ! BASIS !----------------------------------------------------------------------------------------------------------- !Start the creation of a basis (default is linear lagrange) - CALL cmfe_Basis_Initialise(Basis,Err) - CALL cmfe_Basis_CreateStart(BasisUserNumber,context,Basis,Err) + CALL cmfe_Basis_Initialise(basis,err) + CALL cmfe_Basis_CreateStart(BASIS_USER_NUMBER,context,basis,err) !Set the basis to be a linear Lagrange basis - CALL cmfe_Basis_NumberOfXiSet(Basis,1,Err) + CALL cmfe_Basis_NumberOfXiSet(basis,1,err) !Finish the creation of the basis - CALL cmfe_Basis_CreateFinish(Basis,Err) + CALL cmfe_Basis_CreateFinish(basis,err) !----------------------------------------------------------------------------------------------------------- ! MESH !----------------------------------------------------------------------------------------------------------- !Start the creation of a generated mesh in the region - CALL cmfe_GeneratedMesh_Initialise(GeneratedMesh,Err) - CALL cmfe_GeneratedMesh_CreateStart(GeneratedMeshUserNumber,Region,GeneratedMesh,Err) + CALL cmfe_GeneratedMesh_Initialise(generatedMesh,err) + CALL cmfe_GeneratedMesh_CreateStart(GENERATED_MESH_USER_NUMBER,region,generatedMesh,err) !Set up a regular 1D mesh - CALL cmfe_GeneratedMesh_TypeSet(GeneratedMesh,CMFE_GENERATED_MESH_REGULAR_MESH_TYPE,Err) + CALL cmfe_GeneratedMesh_TypeSet(generatedMesh,CMFE_GENERATED_MESH_REGULAR_MESH_TYPE,err) !Set the default basis - CALL cmfe_GeneratedMesh_BasisSet(GeneratedMesh,Basis,Err) + CALL cmfe_GeneratedMesh_BasisSet(generatedMesh,basis,err) !Define the mesh on the region - CALL cmfe_GeneratedMesh_ExtentSet(GeneratedMesh,[LENGTH],Err) - CALL cmfe_GeneratedMesh_NumberOfElementsSet(GeneratedMesh,[NUMBER_GLOBAL_X_ELEMENTS],Err) + CALL cmfe_GeneratedMesh_ExtentSet(generatedMesh,[LENGTH],err) + CALL cmfe_GeneratedMesh_NumberOfElementsSet(generatedMesh,[numberOfGlobalXElements],err) !Finish the creation of a generated mesh in the region - CALL cmfe_Mesh_Initialise(Mesh,Err) - CALL cmfe_GeneratedMesh_CreateFinish(GeneratedMesh,MeshUserNumber,Mesh,Err) + CALL cmfe_Mesh_Initialise(mesh,err) + CALL cmfe_GeneratedMesh_CreateFinish(generatedMesh,MESH_USER_NUMBER,mesh,err) !----------------------------------------------------------------------------------------------------------- ! DECOMPOSITION !----------------------------------------------------------------------------------------------------------- !Create a decomposition - CALL cmfe_Decomposition_Initialise(Decomposition,Err) - CALL cmfe_Decomposition_CreateStart(DecompositionUserNumber,Mesh,Decomposition,Err) + CALL cmfe_Decomposition_Initialise(decomposition,err) + CALL cmfe_Decomposition_CreateStart(DECOMPOSITION_USER_NUMBER,mesh,decomposition,err) !Set the decomposition to be a general decomposition with the specified number of domains - CALL cmfe_Decomposition_TypeSet(Decomposition,CMFE_DECOMPOSITION_CALCULATED_TYPE,Err) + CALL cmfe_Decomposition_TypeSet(decomposition,CMFE_DECOMPOSITION_CALCULATED_TYPE,err) !Finish the decomposition - CALL cmfe_Decomposition_CreateFinish(Decomposition,Err) + CALL cmfe_Decomposition_CreateFinish(decomposition,err) !----------------------------------------------------------------------------------------------------------- ! DECOMPOSER !----------------------------------------------------------------------------------------------------------- CALL cmfe_Decomposer_Initialise(decomposer,err) - CALL cmfe_Decomposer_CreateStart(decomposerUserNumber,region,worldWorkGroup,decomposer,err) + CALL cmfe_Decomposer_CreateStart(DECOMPOSER_USER_NUMBER,region,worldWorkGroup,decomposer,err) !Add in the decomposition CALL cmfe_Decomposer_DecompositionAdd(decomposer,decomposition,decompositionIndex,err) !Finish the decomposer @@ -220,42 +191,42 @@ PROGRAM CellMLSplitReactionDiffusionEquation !----------------------------------------------------------------------------------------------------------- !Start to create a default (geometric) field on the region - CALL cmfe_Field_Initialise(GeometricField,Err) - CALL cmfe_Field_CreateStart(GeometricFieldUserNumber,Region,GeometricField,Err) + CALL cmfe_Field_Initialise(geometricField,err) + CALL cmfe_Field_CreateStart(GEOMETRIC_FIELD_USER_NUMBER,region,geometricField,err) !Set the decomposition to use - CALL cmfe_Field_DecompositionSet(GeometricField,Decomposition,Err) + CALL cmfe_Field_DecompositionSet(geometricField,decomposition,err) !Set the domain to be used by the field components. - CALL cmfe_Field_ComponentMeshComponentSet(GeometricField,CMFE_FIELD_U_VARIABLE_TYPE,1,1,Err) + CALL cmfe_Field_ComponentMeshComponentSet(geometricField,CMFE_FIELD_U_VARIABLE_TYPE,1,1,err) !Finish creating the field - CALL cmfe_Field_CreateFinish(GeometricField,Err) + CALL cmfe_Field_CreateFinish(geometricField,err) !Update the geometric field parameters - CALL cmfe_GeneratedMesh_GeometricParametersCalculate(GeneratedMesh,GeometricField,Err) + CALL cmfe_GeneratedMesh_GeometricParametersCalculate(generatedMesh,geometricField,err) !----------------------------------------------------------------------------------------------------------- ! EQUATIONS SETS !----------------------------------------------------------------------------------------------------------- !Create the cellml reaction with split reaction diffusion equations_set - CALL cmfe_EquationsSet_Initialise(EquationsSet,Err) - CALL cmfe_Field_Initialise(EquationsSetField,Err) - CALL cmfe_EquationsSet_CreateStart(EquationsSetUserNumber,Region,GeometricField,[CMFE_EQUATIONS_SET_CLASSICAL_FIELD_CLASS, & + CALL cmfe_EquationsSet_Initialise(equationsSet,err) + CALL cmfe_Field_Initialise(equationsSetField,err) + CALL cmfe_EquationsSet_CreateStart(EQUATIONS_SET_USER_NUMBER,region,geometricField,[CMFE_EQUATIONS_SET_CLASSICAL_FIELD_CLASS, & & CMFE_EQUATIONS_SET_REACTION_DIFFUSION_EQUATION_TYPE,CMFE_EQUATIONS_SET_CELLML_REAC_SPLIT_REAC_DIFF_SUBTYPE], & - & EquationsSetFieldUserNumber,EquationsSetField,EquationsSet,Err) + & EQUATIONS_SET_FIELD_USER_NUMBER,equationsSetField,equationsSet,err) !Finish creating the equations set - CALL cmfe_EquationsSet_CreateFinish(EquationsSet,Err) + CALL cmfe_EquationsSet_CreateFinish(equationsSet,err) !----------------------------------------------------------------------------------------------------------- ! DEPENDENT FIELD !----------------------------------------------------------------------------------------------------------- !Create the equations set dependent field variables (primary and secondary variable) - CALL cmfe_Field_Initialise(DependentField,Err) - CALL cmfe_EquationsSet_DependentCreateStart(EquationsSet,DependentFieldUserNumber,DependentField,Err) - CALL cmfe_Field_VariableLabelSet(DependentField,CMFE_FIELD_U_VARIABLE_TYPE,"U",Err) - CALL cmfe_Field_VariableLabelSet(DependentField,CMFE_FIELD_DELUDELN_VARIABLE_TYPE,"DELUDELN",Err) + CALL cmfe_Field_Initialise(dependentField,err) + CALL cmfe_EquationsSet_DependentCreateStart(equationsSet,DEPENDENT_FIELD_USER_NUMBER,dependentField,err) + CALL cmfe_Field_VariableLabelSet(dependentField,CMFE_FIELD_U_VARIABLE_TYPE,"U",err) + CALL cmfe_Field_VariableLabelSet(dependentField,CMFE_FIELD_DELUDELN_VARIABLE_TYPE,"DELUDELN",err) !Finish the equations set dependent field variables - CALL cmfe_EquationsSet_DependentCreateFinish(EquationsSet,Err) + CALL cmfe_EquationsSet_DependentCreateFinish(equationsSet,err) !----------------------------------------------------------------------------------------------------------- ! MATERIAL FIELD @@ -264,15 +235,15 @@ PROGRAM CellMLSplitReactionDiffusionEquation !Create the equations set material field variables !by default 2 components for reaction-diffusion i.e. diffusion coefficient in x direction !set constant spatially = 1, and storage coefficient set to 1 - CALL cmfe_Field_Initialise(MaterialsField,Err) - CALL cmfe_EquationsSet_MaterialsCreateStart(EquationsSet,MaterialsFieldUserNumber,MaterialsField,Err) - CALL cmfe_Field_VariableLabelSet(MaterialsField,CMFE_FIELD_U_VARIABLE_TYPE,"Material",Err) + CALL cmfe_Field_Initialise(materialsField,err) + CALL cmfe_EquationsSet_MaterialsCreateStart(equationsSet,MATERIALS_FIELD_USER_NUMBER,materialsField,err) + CALL cmfe_Field_VariableLabelSet(materialsField,CMFE_FIELD_U_VARIABLE_TYPE,"Material",err) !Finish the equations set materials field variables - CALL cmfe_EquationsSet_MaterialsCreateFinish(EquationsSet,Err) - CALL cmfe_Field_ComponentValuesInitialise(MaterialsField,CMFE_FIELD_U_VARIABLE_TYPE,CMFE_FIELD_VALUES_SET_TYPE, & - & 1,0.5_CMISSRP,Err) !diffusion coefficent in x - CALL cmfe_Field_ComponentValuesInitialise(MaterialsField,CMFE_FIELD_U_VARIABLE_TYPE,CMFE_FIELD_VALUES_SET_TYPE, & - & 2,1.0_CMISSRP,Err) ! storage coefficient + CALL cmfe_EquationsSet_MaterialsCreateFinish(equationsSet,err) + CALL cmfe_Field_ComponentValuesInitialise(materialsField,CMFE_FIELD_U_VARIABLE_TYPE,CMFE_FIELD_VALUES_SET_TYPE, & + & 1,0.5_CMISSRP,err) !diffusion coefficent in x + CALL cmfe_Field_ComponentValuesInitialise(materialsField,CMFE_FIELD_U_VARIABLE_TYPE,CMFE_FIELD_VALUES_SET_TYPE, & + & 2,1.0_CMISSRP,err) ! storage coefficient !----------------------------------------------------------------------------------------------------------- ! SOURCE FIELD @@ -280,13 +251,13 @@ PROGRAM CellMLSplitReactionDiffusionEquation !Set up source field for reaction diffusion equation set. Note that for the split problem subtype, !the source field is not used at all. - CALL cmfe_Field_Initialise(SourceField,Err) - CALL cmfe_EquationsSet_SourceCreateStart(EquationsSet,SourceFieldUserNumber,SourceField,Err) - CALL cmfe_Field_VariableLabelSet(SourceField,CMFE_FIELD_U_VARIABLE_TYPE,"Source",Err) + CALL cmfe_Field_Initialise(sourceField,err) + CALL cmfe_EquationsSet_SourceCreateStart(equationsSet,SOURCE_FIELD_USER_NUMBER,sourceField,err) + CALL cmfe_Field_VariableLabelSet(sourceField,CMFE_FIELD_U_VARIABLE_TYPE,"Source",err) !Finish the equations set source field variables - CALL cmfe_EquationsSet_SourceCreateFinish(EquationsSet,Err) - CALL cmfe_Field_ComponentValuesInitialise(SourceField,CMFE_FIELD_U_VARIABLE_TYPE, & - & CMFE_FIELD_VALUES_SET_TYPE,1,0.0_CMISSRP,Err) + CALL cmfe_EquationsSet_SourceCreateFinish(equationsSet,err) + CALL cmfe_Field_ComponentValuesInitialise(sourceField,CMFE_FIELD_U_VARIABLE_TYPE, & + & CMFE_FIELD_VALUES_SET_TYPE,1,0.0_CMISSRP,err) !----------------------------------------------------------------------------------------------------------- ! CELLML FIELD @@ -295,25 +266,25 @@ PROGRAM CellMLSplitReactionDiffusionEquation !Start to set up CellML Fields !Create the CellML environment - CALL cmfe_CellML_Initialise(CellML,Err) - CALL cmfe_CellML_CreateStart(CellMLUserNumber,Region,CellML,Err) + CALL cmfe_CellML_Initialise(cellML,err) + CALL cmfe_CellML_CreateStart(CELLML_USER_NUMBER,region,cellML,err) !Import a constant source (i.e. rate of generation/depletion is zero) model from a file - CALL cmfe_CellML_ModelImport(CellML,"constant_rate.xml",constantModelIndex,Err) + CALL cmfe_CellML_ModelImport(cellML,"constant_rate.xml",constantModelIndex,err) !Speify the variables in the imported model that will be used. ! Now we have imported all the models we are able to specify which variables from the model we want: ! - to set from this side !These are effectively parameters that won't change in the course of the ode solving for one time step. !i.e. fixed before running cellml, known in opencmiss and changed only in opencmiss - components of the parameters field - CALL cmfe_CellML_VariableSetAsKnown(CellML,constantModelIndex,"dude/param",Err) + CALL cmfe_CellML_VariableSetAsKnown(cellML,constantModelIndex,"dude/param",err) ! - to get from the CellML side. variables in cellml model that are not state variables, but are dependent on !independent and state variables. - components of intermediate field - CALL cmfe_CellML_VariableSetAsWanted(CellML,constantModelIndex,"dude/intmd",Err) + CALL cmfe_CellML_VariableSetAsWanted(cellML,constantModelIndex,"dude/intmd",err) !Finish the CellML environment - CALL cmfe_CellML_CreateFinish(CellML,Err) + CALL cmfe_CellML_CreateFinish(cellML,err) !Start the creation of CellML <--> OpenCMISS field maps - CALL cmfe_CellML_FieldMapsCreateStart(CellML,Err) + CALL cmfe_CellML_FieldMapsCreateStart(cellML,err) !Set up the field variable component <--> CellML model variable mappings. !Here opencmiss fields are mapped to appropriate cellml fields (parameters/intermediates/state). !in monodomain problems, typically one wants Vm, a state variable. In the present case, Ca concentration is the @@ -327,237 +298,230 @@ PROGRAM CellMLSplitReactionDiffusionEquation !concentration from the dependent field is used to solve the DAE and the result of the DAE is substituted back to !the source field. - CALL cmfe_CellML_CreateFieldToCellMLMap(CellML,DependentField,CMFE_FIELD_U_VARIABLE_TYPE,1,CMFE_FIELD_VALUES_SET_TYPE, & - & constantModelIndex,"dude/ca",CMFE_FIELD_VALUES_SET_TYPE,Err) - CALL cmfe_CellML_CreateCellMLToFieldMap(CellML,constantModelIndex,"dude/ca",CMFE_FIELD_VALUES_SET_TYPE, & - & DependentField,CMFE_FIELD_U_VARIABLE_TYPE,1,CMFE_FIELD_VALUES_SET_TYPE,Err) + CALL cmfe_CellML_CreateFieldToCellMLMap(cellML,dependentField,CMFE_FIELD_U_VARIABLE_TYPE,1,CMFE_FIELD_VALUES_SET_TYPE, & + & constantModelIndex,"dude/ca",CMFE_FIELD_VALUES_SET_TYPE,err) + CALL cmfe_CellML_CreateCellMLToFieldMap(cellML,constantModelIndex,"dude/ca",CMFE_FIELD_VALUES_SET_TYPE, & + & dependentField,CMFE_FIELD_U_VARIABLE_TYPE,1,CMFE_FIELD_VALUES_SET_TYPE,err) !Finish the creation of CellML <--> OpenCMISS field maps - CALL cmfe_CellML_FieldMapsCreateFinish(CellML,Err) + CALL cmfe_CellML_FieldMapsCreateFinish(cellML,err) !set initial value of the dependent field/state variable, Ca concentration. - CALL cmfe_Field_ComponentValuesInitialise(DependentField,CMFE_FIELD_U_VARIABLE_TYPE, & - & CMFE_FIELD_VALUES_SET_TYPE,1,0.0_CMISSRP,Err) - node=2 - CALL cmfe_Decomposition_NodeDomainGet(Decomposition,node,1,NodeDomain,Err) - IF(NodeDomain==ComputationalNodeNumber) THEN - CALL cmfe_Field_ParameterSetUpdateNode(DependentField,CMFE_FIELD_U_VARIABLE_TYPE, & + CALL cmfe_Field_ComponentValuesInitialise(dependentField,CMFE_FIELD_U_VARIABLE_TYPE, & + & CMFE_FIELD_VALUES_SET_TYPE,1,0.0_CMISSRP,err) + nodeIdx=2 + CALL cmfe_Decomposition_NodeDomainGet(decomposition,nodeIdx,1,nodeDomain,err) + IF(nodeDomain==computationalNodeNumber) THEN + CALL cmfe_Field_ParameterSetUpdateNode(dependentField,CMFE_FIELD_U_VARIABLE_TYPE, & & CMFE_FIELD_VALUES_SET_TYPE, & - & 1,1,node,1,0.0_CMISSRP,Err) + & 1,1,nodeIdx,1,0.0_CMISSRP,err) ENDIF !Start the creation of the CellML models field. This field is an integer field that stores which nodes have which cellml !model - CALL cmfe_Field_Initialise(CellMLModelsField,Err) - CALL cmfe_CellML_ModelsFieldCreateStart(CellML, CellMLModelsFieldUserNumber, & - & CellMLModelsField,Err) + CALL cmfe_Field_Initialise(cellMLModelsField,err) + CALL cmfe_CellML_ModelsFieldCreateStart(cellML, CELLML_MODELS_FIELD_USER_NUMBER, & + & cellMLModelsField,err) !Finish the creation of the CellML models field - CALL cmfe_CellML_ModelsFieldCreateFinish(CellML,Err) + CALL cmfe_CellML_ModelsFieldCreateFinish(cellML,err) !The CellMLModelsField is an integer field that stores which model is being used by which node. !By default all field parameters have default model value of 1, i.e. the first model. But, this command below is !for example purposes - CALL cmfe_Field_ComponentValuesInitialise(CellMLModelsField,CMFE_FIELD_U_VARIABLE_TYPE, & - & CMFE_FIELD_VALUES_SET_TYPE,1,1_CMISSIntg,Err) + CALL cmfe_Field_ComponentValuesInitialise(cellMLModelsField,CMFE_FIELD_U_VARIABLE_TYPE, & + & CMFE_FIELD_VALUES_SET_TYPE,1,1_CMISSIntg,err) !Set up the models field - !DO N=1,(NUMBER_GLOBAL_X_ELEMENTS+1)*(NUMBER_GLOBAL_Y_ELEMENTS+1)*(NUMBER_GLOBAL_Z_ELEMENTS+1) + !DO N=1,(numberOfGlobalXElements+1)*(NUMBER_GLOBAL_Y_ELEMENTS+1)*(NUMBER_GLOBAL_Z_ELEMENTS+1) ! IF(N < 5) THEN ! CELL_TYPE = 1 ! ELSE ! CELL_TYPE = 2 ! ENDIF - ! CALL cmfe_FieldParameterSetUpdateNode(CellMLModelsField, CMFE_FIELD_U_VARIABLE_TYPE, CMFE_FIELD_VALUES_SET_TYPE,1,N,1,CELL_TYPE,Err) + ! CALL cmfe_FieldParameterSetUpdateNode(cellMLModelsField,CMFE_FIELD_U_VARIABLE_TYPE,CMFE_FIELD_VALUES_SET_TYPE,1,N,1,CELL_TYPE,err) !END DO - !CALL cmfe_FieldParameterSetUpdateStart(CellMLModelsField,CMFE_FIELD_U_VARIABLE_TYPE,CMFE_FIELD_VALUES_SET_TYPE,Err) - !CALL cmfe_FieldParameterSetUpdateFinish(CellMLModelsField,CMFE_FIELD_U_VARIABLE_TYPE,CMFE_FIELD_VALUES_SET_TYPE,Err) + !CALL cmfe_FieldParameterSetUpdateStart(cellMLModelsField,CMFE_FIELD_U_VARIABLE_TYPE,CMFE_FIELD_VALUES_SET_TYPE,err) + !CALL cmfe_FieldParameterSetUpdateFinish(cellMLModelsField,CMFE_FIELD_U_VARIABLE_TYPE,CMFE_FIELD_VALUES_SET_TYPE,err) - !Start the creation of the CellML state field - CALL cmfe_Field_Initialise(CellMLStateField,Err) - CALL cmfe_CellML_StateFieldCreateStart(CellML, & - & CellMLStateFieldUserNumber,CellMLStateField,Err) + !Start the creation of the cellML state field + CALL cmfe_Field_Initialise(cellMLStateField,err) + CALL cmfe_CellML_StateFieldCreateStart(cellML,CELLML_STATE_FIELD_USER_NUMBER,cellMLStateField,err) !Finish the creation of the CellML state field - CALL cmfe_CellML_StateFieldCreateFinish(CellML,Err) + CALL cmfe_CellML_StateFieldCreateFinish(cellML,err) !Start the creation of the CellML intermediate field - CALL cmfe_Field_Initialise(CellMLIntermediateField,Err) - CALL cmfe_CellML_IntermediateFieldCreateStart(CellML, & - & CellMLIntermediateFieldUserNumber,CellMLIntermediateField,Err) + CALL cmfe_Field_Initialise(cellMLIntermediateField,err) + CALL cmfe_CellML_IntermediateFieldCreateStart(cellML,CELLML_INTERMEDIATE_FIELD_USER_NUMBER,cellMLIntermediateField,err) !Finish the creation of the CellML intermediate field - CALL cmfe_CellML_IntermediateFieldCreateFinish(CellML,Err) + CALL cmfe_CellML_IntermediateFieldCreateFinish(cellML,err) !Start the creation of CellML parameters field - CALL cmfe_Field_Initialise(CellMLParametersField,Err) - CALL cmfe_CellML_ParametersFieldCreateStart(CellML, & - & CellMLParametersFieldUserNumber,CellMLParametersField,Err) + CALL cmfe_Field_Initialise(cellMLParametersField,err) + CALL cmfe_CellML_ParametersFieldCreateStart(cellML,CELLML_PARAMETERS_FIELD_USER_NUMBER,cellMLParametersField,err) !Finish the creation of CellML parameters - CALL cmfe_CellML_ParametersFieldCreateFinish(CellML,Err) + CALL cmfe_CellML_ParametersFieldCreateFinish(cellML,err) !----------------------------------------------------------------------------------------------------------- ! EQUATIONS SETS !----------------------------------------------------------------------------------------------------------- !Create the equations set equations - CALL cmfe_Equations_Initialise(Equations,Err) - CALL cmfe_EquationsSet_EquationsCreateStart(EquationsSet,Equations,Err) + CALL cmfe_Equations_Initialise(equations,err) + CALL cmfe_EquationsSet_EquationsCreateStart(equationsSet,equations,err) !Set the equations matrices sparsity type - CALL cmfe_Equations_SparsityTypeSet(Equations,CMFE_EQUATIONS_SPARSE_MATRICES,Err) + CALL cmfe_Equations_SparsityTypeSet(equations,CMFE_EQUATIONS_SPARSE_MATRICES,err) !Set the equations set output - CALL cmfe_Equations_OutputTypeSet(Equations,CMFE_EQUATIONS_NO_OUTPUT,Err) - !CALL cmfe_EquationsOutputTypeSet(Equations,cmfe_EquationsTimingOutput,Err) - !CALL cmfe_EquationsOutputTypeSet(Equations,cmfe_EquationsMatrixOutput,Err) - !CALL cmfe_EquationsOutputTypeSet(Equations,cmfe_EquationsElementMatrixOutput,Err) + CALL cmfe_Equations_OutputTypeSet(equations,CMFE_EQUATIONS_NO_OUTPUT,err) + !CALL cmfe_EquationsOutputTypeSet(equations,CMFE_EQUATIONS_TIMING_OUTPUT,err) + !CALL cmfe_EquationsOutputTypeSet(equations,CMFE_EQUATIONS_MATRIX_OUTPUT,err) + !CALL cmfe_equationsOutputTypeSet(equations,cmfe_EQUATIONS_ELEMENT_MATRIX_OUTPUT,err) !Finish the equations set equations - CALL cmfe_EquationsSet_EquationsCreateFinish(EquationsSet,Err) + CALL cmfe_EquationsSet_EquationsCreateFinish(equationsSet,err) !----------------------------------------------------------------------------------------------------------- ! PROBLEM !----------------------------------------------------------------------------------------------------------- !Create the problem - CALL cmfe_Problem_Initialise(Problem,Err) - CALL cmfe_Problem_CreateStart(ProblemUserNumber,context,[CMFE_PROBLEM_CLASSICAL_FIELD_CLASS, & - & CMFE_PROBLEM_REACTION_DIFFUSION_EQUATION_TYPE,CMFE_PROBLEM_CELLML_REAC_INTEG_REAC_DIFF_STRANG_SPLIT_SUBTYPE],Problem,Err) + CALL cmfe_Problem_Initialise(problem,err) + CALL cmfe_Problem_CreateStart(PROBLEM_USER_NUMBER,context,[CMFE_PROBLEM_CLASSICAL_FIELD_CLASS, & + & CMFE_PROBLEM_REACTION_DIFFUSION_EQUATION_TYPE,CMFE_PROBLEM_CELLML_REAC_INTEG_REAC_DIFF_STRANG_SPLIT_SUBTYPE],problem,err) !Finish the creation of a problem. - CALL cmfe_Problem_CreateFinish(Problem,Err) + CALL cmfe_Problem_CreateFinish(problem,err) !----------------------------------------------------------------------------------------------------------- ! PROBLEM CONTROL !----------------------------------------------------------------------------------------------------------- !Create the problem control - CALL cmfe_Problem_ControlLoopCreateStart(Problem,Err) + CALL cmfe_Problem_ControlLoopCreateStart(problem,err) !Get the control loop - CALL cmfe_ControlLoop_Initialise(ControlLoop,Err) - CALL cmfe_Problem_ControlLoopGet(Problem,CMFE_CONTROL_LOOP_NODE,ControlLoop,Err) + CALL cmfe_ControlLoop_Initialise(controlLoop,err) + CALL cmfe_Problem_ControlLoopGet(problem,CMFE_CONTROL_LOOP_NODE,controlLoop,err) !Set the times - CALL cmfe_ControlLoop_TimesSet(ControlLoop,0.0_CMISSRP,0.5_CMISSRP,0.01_CMISSRP,Err) - CALL cmfe_ControlLoop_OutputTypeSet(ControlLoop,CMFE_CONTROL_LOOP_PROGRESS_OUTPUT,Err) + CALL cmfe_ControlLoop_TimesSet(controlLoop,0.0_CMISSRP,0.5_CMISSRP,0.01_CMISSRP,err) + CALL cmfe_ControlLoop_OutputTypeSet(controlLoop,CMFE_CONTROL_LOOP_PROGRESS_OUTPUT,err) !Finish creating the problem control loop - CALL cmfe_Problem_ControlLoopCreateFinish(Problem,Err) + CALL cmfe_Problem_ControlLoopCreateFinish(problem,err) !----------------------------------------------------------------------------------------------------------- ! PROBLEM SOLVERS !----------------------------------------------------------------------------------------------------------- !Set up the problem solvers for Strang splitting - CALL cmfe_Problem_SolversCreateStart(Problem,Err) + CALL cmfe_Problem_SolversCreateStart(problem,err) !First solver is a DAE solver - CALL cmfe_Solver_Initialise(Solver,Err) - CALL cmfe_Problem_SolverGet(Problem,CMFE_CONTROL_LOOP_NODE,1,Solver,Err) - CALL cmfe_Solver_DAESolverTypeSet(Solver,CMFE_SOLVER_DAE_EULER,Err) - CALL cmfe_Solver_DAETimeStepSet(Solver,0.0000001_CMISSRP,Err) - CALL cmfe_Solver_OutputTypeSet(Solver,CMFE_SOLVER_MATRIX_OUTPUT,Err) + CALL cmfe_Solver_Initialise(solver,err) + CALL cmfe_Problem_SolverGet(problem,CMFE_CONTROL_LOOP_NODE,1,solver,err) + CALL cmfe_Solver_DAESolverTypeSet(solver,CMFE_SOLVER_DAE_EULER,err) + CALL cmfe_Solver_DAETimeStepSet(solver,0.0000001_CMISSRP,err) + CALL cmfe_Solver_OutputTypeSet(solver,CMFE_SOLVER_MATRIX_OUTPUT,err) !Second solver is the dynamic solver for solving the parabolic equation - CALL cmfe_Solver_Initialise(Solver,Err) - CALL cmfe_Solver_Initialise(LinearSolver,Err) - CALL cmfe_Problem_SolverGet(Problem,CMFE_CONTROL_LOOP_NODE,2,Solver,Err) + CALL cmfe_Solver_Initialise(solver,err) + CALL cmfe_Solver_Initialise(linearSolver,err) + CALL cmfe_Problem_SolverGet(problem,CMFE_CONTROL_LOOP_NODE,2,solver,err) !set theta - backward vs forward time step parameter - CALL cmfe_Solver_DynamicThetaSet(Solver,1.0_CMISSRP,Err) - !CALL cmfe_SolverOutputTypeSet(Solver,CMFE_SOLVER_NO_OUTPUT,Err) - CALL cmfe_Solver_OutputTypeSet(Solver,CMFE_SOLVER_TIMING_OUTPUT,Err) + CALL cmfe_Solver_DynamicThetaSet(solver,1.0_CMISSRP,err) + !CALL cmfe_SolverOutputTypeSet(solver,CMFE_SOLVER_NO_OUTPUT,err) + CALL cmfe_Solver_OutputTypeSet(solver,CMFE_SOLVER_TIMING_OUTPUT,err) !get the dynamic linear solver from the solver - CALL cmfe_Solver_DynamicLinearSolverGet(Solver,LinearSolver,Err) - CALL cmfe_Solver_LibraryTypeSet(LinearSolver,CMFE_SOLVER_LAPACK_LIBRARY,Err) - CALL cmfe_Solver_LinearTypeSet(LinearSolver,CMFE_SOLVER_LINEAR_DIRECT_SOLVE_TYPE,Err) - CALL cmfe_Solver_LinearDirectTypeSet(LinearSolver,CMFE_SOLVER_DIRECT_LU,Err) - !CALL cmfe_SolverLibraryTypeSet(LinearSolver,cmfe_SolverCMISSLibrary,Err) - !CALL cmfe_SolverLinearTypeSet(LinearSolver,cmfe_SolverLinearDirectSolveType,Err) - !CALL cmfe_SolverLibraryTypeSet(LinearSolver,cmfe_SolverMUMPSLibrary,Err) - !CALL cmfe_Solver_LinearIterativeMaximumIterationsSet(LinearSolver,10000,Err) + CALL cmfe_Solver_DynamicLinearSolverGet(solver,linearSolver,err) + CALL cmfe_Solver_LibraryTypeSet(linearSolver,CMFE_SOLVER_LAPACK_LIBRARY,err) + CALL cmfe_Solver_LinearTypeSet(linearSolver,CMFE_SOLVER_LINEAR_DIRECT_SOLVE_TYPE,err) + CALL cmfe_Solver_LinearDirectTypeSet(linearSolver,CMFE_SOLVER_DIRECT_LU,err) + !CALL cmfe_SolverLibraryTypeSet(linearSolver,CMFE_SOLVER_CMISS_LIBRARY,err) + !CALL cmfe_SolverLinearTypeSet(linearSolver,CMFE_SOLVER_LINEAR_DIRECT_SOLVE_TYPE,err) + !CALL cmfe_SolverLibraryTypeSet(linearSolver,CMFE_SOLVER_MUMPS_LIBRARY,err) + !CALL cmfe_Solver_LinearIterativeMaximumIterationsSet(linearSolver,10000,err) !Third solver is another DAE solver - CALL cmfe_Solver_Initialise(Solver,Err) - CALL cmfe_Problem_SolverGet(Problem,CMFE_CONTROL_LOOP_NODE,3,Solver,Err) - CALL cmfe_Solver_DAESolverTypeSet(Solver,CMFE_SOLVER_DAE_EULER,Err) - CALL cmfe_Solver_DAETimeStepSet(Solver,0.0000001_CMISSRP,Err) - CALL cmfe_Solver_OutputTypeSet(Solver,CMFE_SOLVER_MATRIX_OUTPUT,Err) - !CALL cmfe_SolverOutputTypeSet(Solver,cmfe_SolverTimingOutput,Err) - !CALL cmfe_SolverOutputTypeSet(Solver,cmfe_SolverSolverOutput,Err) - !CALL cmfe_SolverOutputTypeSet(Solver,CMFE_SOLVER_PROGRESS_OUTPUT,Err) + CALL cmfe_Solver_Initialise(solver,err) + CALL cmfe_Problem_SolverGet(problem,CMFE_CONTROL_LOOP_NODE,3,solver,err) + CALL cmfe_Solver_DAESolverTypeSet(solver,CMFE_SOLVER_DAE_EULER,err) + CALL cmfe_Solver_DAETimeStepSet(solver,0.0000001_CMISSRP,err) + CALL cmfe_Solver_OutputTypeSet(solver,CMFE_SOLVER_MATRIX_OUTPUT,err) + !CALL cmfe_SolverOutputTypeSet(solver,CMFE_SOLVER_TIMING_OUTPUT,err) + !CALL cmfe_SolverOutputTypeSet(solver,CMFE_SOLVER_SOLVER_OUTPUT,err) + !CALL cmfe_SolverOutputTypeSet(solver,CMFE_SOLVER_PROGRESS_OUTPUT,err) !Finish the creation of the problem solver - CALL cmfe_Problem_SolversCreateFinish(Problem,Err) + CALL cmfe_Problem_SolversCreateFinish(problem,err) !Start the creation of the problem solver CellML equations - CALL cmfe_Problem_CellMLEquationsCreateStart(Problem,Err) + CALL cmfe_Problem_CellMLEquationsCreateStart(problem,err) !Get the first solver !Get the CellML equations - CALL cmfe_Solver_Initialise(Solver,Err) - CALL cmfe_Problem_SolverGet(Problem,CMFE_CONTROL_LOOP_NODE,1,Solver,Err) - CALL cmfe_CellMLEquations_Initialise(CellMLEquations,Err) - CALL cmfe_Solver_CellMLEquationsGet(Solver,CellMLEquations,Err) + CALL cmfe_Solver_Initialise(solver,err) + CALL cmfe_Problem_SolverGet(problem,CMFE_CONTROL_LOOP_NODE,1,solver,err) + CALL cmfe_CellMLEquations_Initialise(cellMLEquations,err) + CALL cmfe_Solver_CellMLEquationsGet(solver,cellMLEquations,err) !Add in the CellML environement - CALL cmfe_CellMLEquations_CellMLAdd(CellMLEquations,CellML,CellMLIndex,Err) + CALL cmfe_CellMLEquations_CellMLAdd(cellMLEquations,cellML,cellMLIndex,err) !Get the third solver !Get the CellML equations - CALL cmfe_Solver_Initialise(Solver,Err) - CALL cmfe_Problem_SolverGet(Problem,CMFE_CONTROL_LOOP_NODE,3,Solver,Err) - CALL cmfe_CellMLEquations_Initialise(CellMLEquations,Err) - CALL cmfe_Solver_CellMLEquationsGet(Solver,CellMLEquations,Err) + CALL cmfe_Solver_Initialise(solver,err) + CALL cmfe_Problem_SolverGet(problem,CMFE_CONTROL_LOOP_NODE,3,solver,err) + CALL cmfe_CellMLEquations_Initialise(cellMLEquations,err) + CALL cmfe_Solver_CellMLEquationsGet(solver,cellMLEquations,err) !Add in the CellML environement - CALL cmfe_CellMLEquations_CellMLAdd(CellMLEquations,CellML,CellMLIndex,Err) + CALL cmfe_CellMLEquations_CellMLAdd(cellMLEquations,cellML,cellMLIndex,err) !Finish the creation of the problem solver CellML equations - CALL cmfe_Problem_CellMLEquationsCreateFinish(Problem,Err) + CALL cmfe_Problem_CellMLEquationsCreateFinish(problem,err) !Start the creation of the problem solver equations - CALL cmfe_Problem_SolverEquationsCreateStart(Problem,Err) + CALL cmfe_Problem_SolverEquationsCreateStart(problem,err) !Get the second solver !Get the solver equations - CALL cmfe_Solver_Initialise(Solver,Err) - CALL cmfe_Problem_SolverGet(Problem,CMFE_CONTROL_LOOP_NODE,2,Solver,Err) - CALL cmfe_SolverEquations_Initialise(SolverEquations,Err) - CALL cmfe_Solver_SolverEquationsGet(Solver,SolverEquations,Err) + CALL cmfe_Solver_Initialise(solver,err) + CALL cmfe_Problem_SolverGet(problem,CMFE_CONTROL_LOOP_NODE,2,solver,err) + CALL cmfe_SolverEquations_Initialise(solverEquations,err) + CALL cmfe_Solver_SolverEquationsGet(solver,solverEquations,err) !Set the solver equations sparsity - !CALL cmfe_SolverEquationsSparsityTypeSet(SolverEquations,cmfe_SolverEquationsSparseMatrices,Err) - CALL cmfe_SolverEquations_SparsityTypeSet(SolverEquations,CMFE_SOLVER_SPARSE_MATRICES,Err) + !CALL cmfe_SolverEquationsSparsityTypeSet(solverEquations,CMFE_SOLVER_EQUATIONS_SPARSE_MATRICES,err) + CALL cmfe_SolverEquations_SparsityTypeSet(solverEquations,CMFE_SOLVER_SPARSE_MATRICES,err) !Add in the equations set - CALL cmfe_SolverEquations_EquationsSetAdd(SolverEquations,EquationsSet,EquationsSetIndex,Err) + CALL cmfe_SolverEquations_EquationsSetAdd(solverEquations,equationsSet,equationsSetIndex,err) !Finish the creation of the problem solver equations - CALL cmfe_Problem_SolverEquationsCreateFinish(Problem,Err) + CALL cmfe_Problem_SolverEquationsCreateFinish(problem,err) !----------------------------------------------------------------------------------------------------------- ! BOUNDARY CONDITIONS !----------------------------------------------------------------------------------------------------------- !Create the equations set boundary conditions - BCNODES = [1,11] - CALL cmfe_BoundaryConditions_Initialise(BoundaryConditions,Err) - CALL cmfe_SolverEquations_BoundaryConditionsCreateStart(SolverEquations,BoundaryConditions,Err) - DO node=1,2 - NODE_NUMBER = BCNODES(node) - CALL cmfe_Decomposition_NodeDomainGet(Decomposition,NODE_NUMBER,1,NodeDomain,Err) - IF(NodeDomain==ComputationalNodeNumber) THEN - CONDITION = CMFE_BOUNDARY_CONDITION_FIXED - VALUE=1.5_CMISSRP - CALL cmfe_BoundaryConditions_SetNode(BoundaryConditions,DependentField, & - & CMFE_FIELD_U_VARIABLE_TYPE,1,CMFE_NO_GLOBAL_DERIV, & - & NODE_NUMBER,1,CONDITION,VALUE,Err) - - !Need to set cellml model to zero at the nodes at which value of ca has been fixed. - CALL cmfe_Field_ParameterSetUpdateNode(CellMLModelsField,CMFE_FIELD_U_VARIABLE_TYPE,CMFE_FIELD_VALUES_SET_TYPE,& - & 1,1,NODE_NUMBER,1,0_CMISSIntg,Err) + boundaryConditionNodes = [1,11] + CALL cmfe_BoundaryConditions_Initialise(boundaryConditions,err) + CALL cmfe_SolverEquations_BoundaryConditionsCreateStart(solverEquations,boundaryConditions,err) + DO nodeIdx=1,2 + nodeNumber = boundaryConditionNodes(nodeIdx) + CALL cmfe_Decomposition_NodeDomainGet(decomposition,nodeNumber,1,nodeDomain,err) + IF(nodeDomain==computationalNodeNumber) THEN + CALL cmfe_BoundaryConditions_SetNode(boundaryConditions,dependentField,CMFE_FIELD_U_VARIABLE_TYPE,1,CMFE_NO_GLOBAL_DERIV, & + & nodeNumber,1,CMFE_BOUNDARY_CONDITION_FIXED,1.5_CMISSRP,err) + !Need to set CellML model to zero at the nodes at which value of ca has been fixed. + CALL cmfe_Field_ParameterSetUpdateNode(cellMLModelsField,CMFE_FIELD_U_VARIABLE_TYPE,CMFE_FIELD_VALUES_SET_TYPE,& + & 1,1,nodeNumber,1,0_CMISSIntg,err) ENDIF ENDDO - CALL cmfe_SolverEquations_BoundaryConditionsCreateFinish(SolverEquations,Err) + CALL cmfe_SolverEquations_BoundaryConditionsCreateFinish(solverEquations,err) !----------------------------------------------------------------------------------------------------------- ! SOLVER !----------------------------------------------------------------------------------------------------------- !Solve the problem - CALL cmfe_Problem_Solve(Problem,Err) + CALL cmfe_Problem_Solve(problem,err) !----------------------------------------------------------------------------------------------------------- ! OUTPUT !----------------------------------------------------------------------------------------------------------- - EXPORT_FIELD=.TRUE. - IF(EXPORT_FIELD) THEN - CALL cmfe_Fields_Initialise(Fields,Err) - CALL cmfe_Fields_Create(Region,Fields,Err) - CALL cmfe_Fields_NodesExport(Fields,"cellml_split_reaction_diffusion_equation","FORTRAN",Err) - CALL cmfe_Fields_ElementsExport(Fields,"cellml_split_reaction_diffusion_equation","FORTRAN",Err) - CALL cmfe_Fields_Finalise(Fields,Err) + exportField=.TRUE. + IF(exportField) THEN + CALL cmfe_Fields_Initialise(fields,err) + CALL cmfe_Fields_Create(region,fields,err) + CALL cmfe_Fields_NodesExport(fields,"cellml_split_reaction_diffusion_equation","FORTRAN",err) + CALL cmfe_Fields_ElementsExport(fields,"cellml_split_reaction_diffusion_equation","FORTRAN",err) + CALL cmfe_Fields_Finalise(fields,err) ENDIF !Destroy the context From 4a1d8a4b89b2a2b8ff5ce31f55d732fe861a0f63 Mon Sep 17 00:00:00 2001 From: Chris Bradley Date: Tue, 16 Jul 2024 15:03:50 +1200 Subject: [PATCH 8/9] Updates for new build system. --- CMakeLists.txt | 16 +- README.rst | 7 +- src/fortran/CMakeLists.txt | 2 +- ...llml_split_reaction_diffusion_equation.F90 | 490 +++++++++--------- 4 files changed, 256 insertions(+), 259 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8cb630c..490deb0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,17 @@ -set(ExampleName "cellml_split_reaction_diffusion_equation") +cmake_minimum_required(VERSION 3.26 FATAL_ERROR) -cmake_minimum_required(VERSION 3.4 FATAL_ERROR) +if(DEFINED OpenCMISS_INSTALL_ROOT) + if(EXISTS "${OpenCMISS_INSTALL_ROOT}/libOpenCMISSSetup.cmake") + set(CMAKE_PROJECT_INCLUDE_BEFORE "${OpenCMISS_INSTALL_ROOT}/libOpenCMISSSetup.cmake") + endif() +endif() -if (DEFINED OpenCMISSLibs_DIR) - set(CMAKE_PROJECT_INCLUDE_BEFORE ${OpenCMISSLibs_DIR}/opencmisslibs-preconfig.cmake) -endif () +set(ExampleName "cellml_split_reaction_diffusion_equation") project(${ExampleName} VERSION 1.0 LANGUAGES C Fortran) -find_package(OpenCMISSLibs 1.3.0 REQUIRED COMPONENTS Iron CONFIG) +find_package(libOpenCMISS 1.0.0 REQUIRED + COMPONENTS Fortran +) add_subdirectory(src/fortran) diff --git a/README.rst b/README.rst index b4ed6e6..bd5f3b7 100644 --- a/README.rst +++ b/README.rst @@ -46,9 +46,10 @@ Building the example The fortran version of the example can be configured and built with CMake:: git clone https://github.com/OpenCMISS-Examples/cellml_split_reaction_diffusion_equation - mkdir cellml_split_reaction_diffusion_equation-build - cd cellml_split_reaction_diffusion_equation-build - cmake -DOpenCMISSLibs_DIR=/path/to/opencmisslib/install ../cellml_split_reaction_diffusion_equation + cd cellml_split_reaction_diffusion_equation + mkdir build + cd build + cmake -DOpenCMISS_INSTALL_ROOT=/path/to/opencmiss/install ../. make This will create the example executable "cellml_split_reaction_diffusion_equation" in ./src/fortran/ directory. diff --git a/src/fortran/CMakeLists.txt b/src/fortran/CMakeLists.txt index 10ae463..f7153cd 100644 --- a/src/fortran/CMakeLists.txt +++ b/src/fortran/CMakeLists.txt @@ -1,6 +1,6 @@ add_executable(${ExampleName} ${ExampleName}.F90) -target_link_libraries(${ExampleName} PRIVATE opencmisslibs) +target_link_libraries(${ExampleName} PRIVATE OpenCMISS::libOpenCMISS_Fortran) install(TARGETS ${ExampleName} DESTINATION bin) diff --git a/src/fortran/cellml_split_reaction_diffusion_equation.F90 b/src/fortran/cellml_split_reaction_diffusion_equation.F90 index c7361a5..2b8bbe4 100644 --- a/src/fortran/cellml_split_reaction_diffusion_equation.F90 +++ b/src/fortran/cellml_split_reaction_diffusion_equation.F90 @@ -1,110 +1,102 @@ PROGRAM CellMLSplitReactionDiffusionEquation USE OpenCMISS - USE OpenCMISS_Iron -#ifndef NOMPIMOD - USE MPI -#endif IMPLICIT NONE -#ifdef NOMPIMOD -#include "mpif.h" -#endif - !----------------------------------------------------------------------------------------------------------- ! PROGRAM VARIABLES AND TYPES !----------------------------------------------------------------------------------------------------------- !Test program parameters - REAL(CMISSRP), PARAMETER :: LENGTH=100.0_CMISSRP + REAL(OC_RP), PARAMETER :: LENGTH=100.0_OC_RP - INTEGER(CMISSIntg), PARAMETER :: CONTEXT_USER_NUMBER=1 - INTEGER(CMISSIntg), PARAMETER :: COORDINATE_SYSTEM_USER_NUMBER=2 - INTEGER(CMISSIntg), PARAMETER :: REGION_USER_NUMBER=3 - INTEGER(CMISSIntg), PARAMETER :: BASIS_USER_NUMBER=4 - INTEGER(CMISSIntg), PARAMETER :: GENERATED_MESH_USER_NUMBER=5 - INTEGER(CMISSIntg), PARAMETER :: MESH_USER_NUMBER=6 - INTEGER(CMISSIntg), PARAMETER :: DECOMPOSITION_USER_NUMBER=7 - INTEGER(CMISSIntg), PARAMETER :: DECOMPOSER_USER_NUMBER=8 - INTEGER(CMISSIntg), PARAMETER :: GEOMETRIC_FIELD_USER_NUMBER=9 - INTEGER(CMISSIntg), PARAMETER :: EQUATIONS_SET_FIELD_USER_NUMBER=10 - INTEGER(CMISSIntg), PARAMETER :: DEPENDENT_FIELD_USER_NUMBER=11 - INTEGER(CMISSIntg), PARAMETER :: MATERIALS_FIELD_USER_NUMBER=12 - INTEGER(CMISSIntg), PARAMETER :: SOURCE_FIELD_USER_NUMBER=13 - INTEGER(CMISSIntg), PARAMETER :: CELLML_MODELS_FIELD_USER_NUMBER=14 - INTEGER(CMISSIntg), PARAMETER :: CELLML_STATE_FIELD_USER_NUMBER=15 - INTEGER(CMISSIntg), PARAMETER :: CELLML_INTERMEDIATE_FIELD_USER_NUMBER=16 - INTEGER(CMISSIntg), PARAMETER :: CELLML_PARAMETERS_FIELD_USER_NUMBER=17 - INTEGER(CMISSIntg), PARAMETER :: EQUATIONS_SET_USER_NUMBER=18 - INTEGER(CMISSIntg), PARAMETER :: CELLML_USER_NUMBER=19 - INTEGER(CMISSIntg), PARAMETER :: PROBLEM_USER_NUMBER=20 + INTEGER(OC_Intg), PARAMETER :: CONTEXT_USER_NUMBER=1 + INTEGER(OC_Intg), PARAMETER :: COORDINATE_SYSTEM_USER_NUMBER=2 + INTEGER(OC_Intg), PARAMETER :: REGION_USER_NUMBER=3 + INTEGER(OC_Intg), PARAMETER :: BASIS_USER_NUMBER=4 + INTEGER(OC_Intg), PARAMETER :: GENERATED_MESH_USER_NUMBER=5 + INTEGER(OC_Intg), PARAMETER :: MESH_USER_NUMBER=6 + INTEGER(OC_Intg), PARAMETER :: DECOMPOSITION_USER_NUMBER=7 + INTEGER(OC_Intg), PARAMETER :: DECOMPOSER_USER_NUMBER=8 + INTEGER(OC_Intg), PARAMETER :: GEOMETRIC_FIELD_USER_NUMBER=9 + INTEGER(OC_Intg), PARAMETER :: EQUATIONS_SET_FIELD_USER_NUMBER=10 + INTEGER(OC_Intg), PARAMETER :: DEPENDENT_FIELD_USER_NUMBER=11 + INTEGER(OC_Intg), PARAMETER :: MATERIALS_FIELD_USER_NUMBER=12 + INTEGER(OC_Intg), PARAMETER :: SOURCE_FIELD_USER_NUMBER=13 + INTEGER(OC_Intg), PARAMETER :: CELLML_MODELS_FIELD_USER_NUMBER=14 + INTEGER(OC_Intg), PARAMETER :: CELLML_STATE_FIELD_USER_NUMBER=15 + INTEGER(OC_Intg), PARAMETER :: CELLML_INTERMEDIATE_FIELD_USER_NUMBER=16 + INTEGER(OC_Intg), PARAMETER :: CELLML_PARAMETERS_FIELD_USER_NUMBER=17 + INTEGER(OC_Intg), PARAMETER :: EQUATIONS_SET_USER_NUMBER=18 + INTEGER(OC_Intg), PARAMETER :: CELLML_USER_NUMBER=19 + INTEGER(OC_Intg), PARAMETER :: PROBLEM_USER_NUMBER=20 !Program types !Program variables - INTEGER(CMISSIntg) :: numberOfGlobalXElements - INTEGER(CMISSIntg) :: nodeDomain,nodeIdx,nodeNumber - INTEGER(CMISSIntg) :: boundaryConditionNodes(2) - INTEGER(CMISSIntg) :: constantModelIndex + INTEGER(OC_Intg) :: numberOfGlobalXElements + INTEGER(OC_Intg) :: nodeDomain,nodeIdx,nodeNumber + INTEGER(OC_Intg) :: boundaryConditionNodes(2) + INTEGER(OC_Intg) :: constantModelIndex !CMISS variables - TYPE(cmfe_BasisType) :: basis - TYPE(cmfe_BoundaryConditionsType) :: boundaryConditions - TYPE(cmfe_CellMLType) :: cellML - TYPE(cmfe_CellMLEquationsType) :: cellMLEquations - TYPE(cmfe_ComputationEnvironmentType) :: computationEnvironment - TYPE(cmfe_ContextType) :: context - TYPE(cmfe_ControlLoopType) :: controlLoop - TYPE(cmfe_CoordinateSystemType) :: coordinateSystem - TYPE(cmfe_DecompositionType) :: decomposition - TYPE(cmfe_DecomposerType) :: decomposer - TYPE(cmfe_EquationsType) :: equations - TYPE(cmfe_EquationsSetType) :: equationsSet - TYPE(cmfe_FieldType) :: geometricField,equationsSetField,dependentField,materialsField,sourceField - TYPE(cmfe_FieldType) :: cellMLModelsField,cellMLStateField,cellMLIntermediateField,cellMLParametersField - TYPE(cmfe_FieldsType) :: fields - TYPE(cmfe_GeneratedMeshType) :: generatedMesh - TYPE(cmfe_MeshType) :: mesh - TYPE(cmfe_ProblemType) :: problem - TYPE(cmfe_RegionType) :: region,worldRegion - TYPE(cmfe_SolverType) :: solver, linearSolver - TYPE(cmfe_SolverEquationsType) :: solverEquations - TYPE(cmfe_WorkGroupType) :: worldWorkGroup + TYPE(OC_BasisType) :: basis + TYPE(OC_BoundaryConditionsType) :: boundaryConditions + TYPE(OC_CellMLType) :: cellML + TYPE(OC_CellMLEquationsType) :: cellMLEquations + TYPE(OC_ComputationEnvironmentType) :: computationEnvironment + TYPE(OC_ContextType) :: context + TYPE(OC_ControlLoopType) :: controlLoop + TYPE(OC_CoordinateSystemType) :: coordinateSystem + TYPE(OC_DecompositionType) :: decomposition + TYPE(OC_DecomposerType) :: decomposer + TYPE(OC_EquationsType) :: equations + TYPE(OC_EquationsSetType) :: equationsSet + TYPE(OC_FieldType) :: geometricField,equationsSetField,dependentField,materialsField,sourceField + TYPE(OC_FieldType) :: cellMLModelsField,cellMLStateField,cellMLIntermediateField,cellMLParametersField + TYPE(OC_FieldsType) :: fields + TYPE(OC_GeneratedMeshType) :: generatedMesh + TYPE(OC_MeshType) :: mesh + TYPE(OC_ProblemType) :: problem + TYPE(OC_RegionType) :: region,worldRegion + TYPE(OC_SolverType) :: solver, linearSolver + TYPE(OC_SolverEquationsType) :: solverEquations + TYPE(OC_WorkGroupType) :: worldWorkGroup LOGICAL :: exportField !Generic CMISS variables - INTEGER(CMISSIntg) :: numberOfComputationalNodes,computationalNodeNumber - INTEGER(CMISSIntg) :: decompositionIndex,equationsSetIndex,cellMLIndex - INTEGER(CMISSIntg) :: err + INTEGER(OC_Intg) :: numberOfComputationalNodes,computationalNodeNumber + INTEGER(OC_Intg) :: decompositionIndex,equationsSetIndex,cellMLIndex + INTEGER(OC_Intg) :: err !----------------------------------------------------------------------------------------------------------- ! PROBLEM CONTROL PANEL !----------------------------------------------------------------------------------------------------------- !Intialise OpenCMISS - CALL cmfe_Initialise(err) - CALL cmfe_ErrorHandlingModeSet(CMFE_ERRORS_TRAP_ERROR,err) + CALL OC_Initialise(err) + CALL OC_ErrorHandlingModeSet(OC_ERRORS_TRAP_ERROR,err) !Create a context - CALL cmfe_Context_Initialise(context,err) - CALL cmfe_Context_Create(CONTEXT_USER_NUMBER,context,err) - CALL cmfe_ErrorHandlingModeSet(CMFE_ERRORS_TRAP_ERROR,err) - CALL cmfe_Region_Initialise(worldRegion,err) - CALL cmfe_Context_WorldRegionGet(context,worldRegion,err) + CALL OC_Context_Initialise(context,err) + CALL OC_Context_Create(CONTEXT_USER_NUMBER,context,err) + CALL OC_ErrorHandlingModeSet(OC_ERRORS_TRAP_ERROR,err) + CALL OC_Region_Initialise(worldRegion,err) + CALL OC_Context_WorldRegionGet(context,worldRegion,err) !Get the computational nodes information - CALL cmfe_ComputationEnvironment_Initialise(computationEnvironment,err) - CALL cmfe_Context_ComputationEnvironmentGet(context,computationEnvironment,err) + CALL OC_ComputationEnvironment_Initialise(computationEnvironment,err) + CALL OC_Context_ComputationEnvironmentGet(context,computationEnvironment,err) - CALL cmfe_WorkGroup_Initialise(worldWorkGroup,err) - CALL cmfe_ComputationEnvironment_WorldWorkGroupGet(computationEnvironment,worldWorkGroup,err) - CALL cmfe_WorkGroup_NumberOfGroupNodesGet(worldWorkGroup,numberOfComputationalNodes,err) - CALL cmfe_WorkGroup_GroupNodeNumberGet(worldWorkGroup,computationalNodeNumber,err) + CALL OC_WorkGroup_Initialise(worldWorkGroup,err) + CALL OC_ComputationEnvironment_WorldWorkGroupGet(computationEnvironment,worldWorkGroup,err) + CALL OC_WorkGroup_NumberOfGroupNodesGet(worldWorkGroup,numberOfComputationalNodes,err) + CALL OC_WorkGroup_GroupNodeNumberGet(worldWorkGroup,computationalNodeNumber,err) numberOfGlobalXElements=10 @@ -113,120 +105,120 @@ PROGRAM CellMLSplitReactionDiffusionEquation !----------------------------------------------------------------------------------------------------------- !Start the creation of a new RC coordinate system - CALL cmfe_CoordinateSystem_Initialise(coordinateSystem,err) - CALL cmfe_CoordinateSystem_CreateStart(COORDINATE_SYSTEM_USER_NUMBER,context,coordinateSystem,err) + CALL OC_CoordinateSystem_Initialise(coordinateSystem,err) + CALL OC_CoordinateSystem_CreateStart(COORDINATE_SYSTEM_USER_NUMBER,context,coordinateSystem,err) !Set the coordinate system to be 1D - CALL cmfe_CoordinateSystem_DimensionSet(coordinateSystem,1,err) + CALL OC_CoordinateSystem_DimensionSet(coordinateSystem,1,err) !Finish the creation of the coordinate system - CALL cmfe_CoordinateSystem_CreateFinish(coordinateSystem,err) + CALL OC_CoordinateSystem_CreateFinish(coordinateSystem,err) !----------------------------------------------------------------------------------------------------------- ! REGION !----------------------------------------------------------------------------------------------------------- !Start the creation of the region - CALL cmfe_Region_Initialise(region,err) - CALL cmfe_Region_CreateStart(REGION_USER_NUMBER,worldRegion,region,err) - CALL cmfe_Region_LabelSet(region,"cellml_split_reaction_diffusion_equation",err) + CALL OC_Region_Initialise(region,err) + CALL OC_Region_CreateStart(REGION_USER_NUMBER,worldRegion,region,err) + CALL OC_Region_LabelSet(region,"cellml_split_reaction_diffusion_equation",err) !Set the regions coordinate system to the 1D RC coordinate system that we have created - CALL cmfe_Region_CoordinateSystemSet(region,coordinateSystem,err) + CALL OC_Region_CoordinateSystemSet(region,coordinateSystem,err) !Finish the creation of the region - CALL cmfe_Region_CreateFinish(region,err) + CALL OC_Region_CreateFinish(region,err) !----------------------------------------------------------------------------------------------------------- ! BASIS !----------------------------------------------------------------------------------------------------------- !Start the creation of a basis (default is linear lagrange) - CALL cmfe_Basis_Initialise(basis,err) - CALL cmfe_Basis_CreateStart(BASIS_USER_NUMBER,context,basis,err) + CALL OC_Basis_Initialise(basis,err) + CALL OC_Basis_CreateStart(BASIS_USER_NUMBER,context,basis,err) !Set the basis to be a linear Lagrange basis - CALL cmfe_Basis_NumberOfXiSet(basis,1,err) + CALL OC_Basis_NumberOfXiSet(basis,1,err) !Finish the creation of the basis - CALL cmfe_Basis_CreateFinish(basis,err) + CALL OC_Basis_CreateFinish(basis,err) !----------------------------------------------------------------------------------------------------------- ! MESH !----------------------------------------------------------------------------------------------------------- !Start the creation of a generated mesh in the region - CALL cmfe_GeneratedMesh_Initialise(generatedMesh,err) - CALL cmfe_GeneratedMesh_CreateStart(GENERATED_MESH_USER_NUMBER,region,generatedMesh,err) + CALL OC_GeneratedMesh_Initialise(generatedMesh,err) + CALL OC_GeneratedMesh_CreateStart(GENERATED_MESH_USER_NUMBER,region,generatedMesh,err) !Set up a regular 1D mesh - CALL cmfe_GeneratedMesh_TypeSet(generatedMesh,CMFE_GENERATED_MESH_REGULAR_MESH_TYPE,err) + CALL OC_GeneratedMesh_TypeSet(generatedMesh,OC_GENERATED_MESH_REGULAR_MESH_TYPE,err) !Set the default basis - CALL cmfe_GeneratedMesh_BasisSet(generatedMesh,basis,err) + CALL OC_GeneratedMesh_BasisSet(generatedMesh,basis,err) !Define the mesh on the region - CALL cmfe_GeneratedMesh_ExtentSet(generatedMesh,[LENGTH],err) - CALL cmfe_GeneratedMesh_NumberOfElementsSet(generatedMesh,[numberOfGlobalXElements],err) + CALL OC_GeneratedMesh_ExtentSet(generatedMesh,[LENGTH],err) + CALL OC_GeneratedMesh_NumberOfElementsSet(generatedMesh,[numberOfGlobalXElements],err) !Finish the creation of a generated mesh in the region - CALL cmfe_Mesh_Initialise(mesh,err) - CALL cmfe_GeneratedMesh_CreateFinish(generatedMesh,MESH_USER_NUMBER,mesh,err) + CALL OC_Mesh_Initialise(mesh,err) + CALL OC_GeneratedMesh_CreateFinish(generatedMesh,MESH_USER_NUMBER,mesh,err) !----------------------------------------------------------------------------------------------------------- ! DECOMPOSITION !----------------------------------------------------------------------------------------------------------- !Create a decomposition - CALL cmfe_Decomposition_Initialise(decomposition,err) - CALL cmfe_Decomposition_CreateStart(DECOMPOSITION_USER_NUMBER,mesh,decomposition,err) + CALL OC_Decomposition_Initialise(decomposition,err) + CALL OC_Decomposition_CreateStart(DECOMPOSITION_USER_NUMBER,mesh,decomposition,err) !Set the decomposition to be a general decomposition with the specified number of domains - CALL cmfe_Decomposition_TypeSet(decomposition,CMFE_DECOMPOSITION_CALCULATED_TYPE,err) + CALL OC_Decomposition_TypeSet(decomposition,OC_DECOMPOSITION_CALCULATED_TYPE,err) !Finish the decomposition - CALL cmfe_Decomposition_CreateFinish(decomposition,err) + CALL OC_Decomposition_CreateFinish(decomposition,err) !----------------------------------------------------------------------------------------------------------- ! DECOMPOSER !----------------------------------------------------------------------------------------------------------- - CALL cmfe_Decomposer_Initialise(decomposer,err) - CALL cmfe_Decomposer_CreateStart(DECOMPOSER_USER_NUMBER,region,worldWorkGroup,decomposer,err) + CALL OC_Decomposer_Initialise(decomposer,err) + CALL OC_Decomposer_CreateStart(DECOMPOSER_USER_NUMBER,region,worldWorkGroup,decomposer,err) !Add in the decomposition - CALL cmfe_Decomposer_DecompositionAdd(decomposer,decomposition,decompositionIndex,err) + CALL OC_Decomposer_DecompositionAdd(decomposer,decomposition,decompositionIndex,err) !Finish the decomposer - CALL cmfe_Decomposer_CreateFinish(decomposer,err) + CALL OC_Decomposer_CreateFinish(decomposer,err) !----------------------------------------------------------------------------------------------------------- ! GEOMETRIC FIELD !----------------------------------------------------------------------------------------------------------- !Start to create a default (geometric) field on the region - CALL cmfe_Field_Initialise(geometricField,err) - CALL cmfe_Field_CreateStart(GEOMETRIC_FIELD_USER_NUMBER,region,geometricField,err) + CALL OC_Field_Initialise(geometricField,err) + CALL OC_Field_CreateStart(GEOMETRIC_FIELD_USER_NUMBER,region,geometricField,err) !Set the decomposition to use - CALL cmfe_Field_DecompositionSet(geometricField,decomposition,err) + CALL OC_Field_DecompositionSet(geometricField,decomposition,err) !Set the domain to be used by the field components. - CALL cmfe_Field_ComponentMeshComponentSet(geometricField,CMFE_FIELD_U_VARIABLE_TYPE,1,1,err) + CALL OC_Field_ComponentMeshComponentSet(geometricField,OC_FIELD_U_VARIABLE_TYPE,1,1,err) !Finish creating the field - CALL cmfe_Field_CreateFinish(geometricField,err) + CALL OC_Field_CreateFinish(geometricField,err) !Update the geometric field parameters - CALL cmfe_GeneratedMesh_GeometricParametersCalculate(generatedMesh,geometricField,err) + CALL OC_GeneratedMesh_GeometricParametersCalculate(generatedMesh,geometricField,err) !----------------------------------------------------------------------------------------------------------- ! EQUATIONS SETS !----------------------------------------------------------------------------------------------------------- !Create the cellml reaction with split reaction diffusion equations_set - CALL cmfe_EquationsSet_Initialise(equationsSet,err) - CALL cmfe_Field_Initialise(equationsSetField,err) - CALL cmfe_EquationsSet_CreateStart(EQUATIONS_SET_USER_NUMBER,region,geometricField,[CMFE_EQUATIONS_SET_CLASSICAL_FIELD_CLASS, & - & CMFE_EQUATIONS_SET_REACTION_DIFFUSION_EQUATION_TYPE,CMFE_EQUATIONS_SET_CELLML_REAC_SPLIT_REAC_DIFF_SUBTYPE], & + CALL OC_EquationsSet_Initialise(equationsSet,err) + CALL OC_Field_Initialise(equationsSetField,err) + CALL OC_EquationsSet_CreateStart(EQUATIONS_SET_USER_NUMBER,region,geometricField,[OC_EQUATIONS_SET_CLASSICAL_FIELD_CLASS, & + & OC_EQUATIONS_SET_REACTION_DIFFUSION_EQUATION_TYPE,OC_EQUATIONS_SET_CELLML_REAC_SPLIT_REAC_DIFF_SUBTYPE], & & EQUATIONS_SET_FIELD_USER_NUMBER,equationsSetField,equationsSet,err) !Finish creating the equations set - CALL cmfe_EquationsSet_CreateFinish(equationsSet,err) + CALL OC_EquationsSet_CreateFinish(equationsSet,err) !----------------------------------------------------------------------------------------------------------- ! DEPENDENT FIELD !----------------------------------------------------------------------------------------------------------- !Create the equations set dependent field variables (primary and secondary variable) - CALL cmfe_Field_Initialise(dependentField,err) - CALL cmfe_EquationsSet_DependentCreateStart(equationsSet,DEPENDENT_FIELD_USER_NUMBER,dependentField,err) - CALL cmfe_Field_VariableLabelSet(dependentField,CMFE_FIELD_U_VARIABLE_TYPE,"U",err) - CALL cmfe_Field_VariableLabelSet(dependentField,CMFE_FIELD_DELUDELN_VARIABLE_TYPE,"DELUDELN",err) + CALL OC_Field_Initialise(dependentField,err) + CALL OC_EquationsSet_DependentCreateStart(equationsSet,DEPENDENT_FIELD_USER_NUMBER,dependentField,err) + CALL OC_Field_VariableLabelSet(dependentField,OC_FIELD_U_VARIABLE_TYPE,"U",err) + CALL OC_Field_VariableLabelSet(dependentField,OC_FIELD_DELUDELN_VARIABLE_TYPE,"DELUDELN",err) !Finish the equations set dependent field variables - CALL cmfe_EquationsSet_DependentCreateFinish(equationsSet,err) + CALL OC_EquationsSet_DependentCreateFinish(equationsSet,err) !----------------------------------------------------------------------------------------------------------- ! MATERIAL FIELD @@ -235,15 +227,15 @@ PROGRAM CellMLSplitReactionDiffusionEquation !Create the equations set material field variables !by default 2 components for reaction-diffusion i.e. diffusion coefficient in x direction !set constant spatially = 1, and storage coefficient set to 1 - CALL cmfe_Field_Initialise(materialsField,err) - CALL cmfe_EquationsSet_MaterialsCreateStart(equationsSet,MATERIALS_FIELD_USER_NUMBER,materialsField,err) - CALL cmfe_Field_VariableLabelSet(materialsField,CMFE_FIELD_U_VARIABLE_TYPE,"Material",err) + CALL OC_Field_Initialise(materialsField,err) + CALL OC_EquationsSet_MaterialsCreateStart(equationsSet,MATERIALS_FIELD_USER_NUMBER,materialsField,err) + CALL OC_Field_VariableLabelSet(materialsField,OC_FIELD_U_VARIABLE_TYPE,"Material",err) !Finish the equations set materials field variables - CALL cmfe_EquationsSet_MaterialsCreateFinish(equationsSet,err) - CALL cmfe_Field_ComponentValuesInitialise(materialsField,CMFE_FIELD_U_VARIABLE_TYPE,CMFE_FIELD_VALUES_SET_TYPE, & - & 1,0.5_CMISSRP,err) !diffusion coefficent in x - CALL cmfe_Field_ComponentValuesInitialise(materialsField,CMFE_FIELD_U_VARIABLE_TYPE,CMFE_FIELD_VALUES_SET_TYPE, & - & 2,1.0_CMISSRP,err) ! storage coefficient + CALL OC_EquationsSet_MaterialsCreateFinish(equationsSet,err) + CALL OC_Field_ComponentValuesInitialise(materialsField,OC_FIELD_U_VARIABLE_TYPE,OC_FIELD_VALUES_SET_TYPE, & + & 1,0.5_OC_RP,err) !diffusion coefficent in x + CALL OC_Field_ComponentValuesInitialise(materialsField,OC_FIELD_U_VARIABLE_TYPE,OC_FIELD_VALUES_SET_TYPE, & + & 2,1.0_OC_RP,err) ! storage coefficient !----------------------------------------------------------------------------------------------------------- ! SOURCE FIELD @@ -251,13 +243,13 @@ PROGRAM CellMLSplitReactionDiffusionEquation !Set up source field for reaction diffusion equation set. Note that for the split problem subtype, !the source field is not used at all. - CALL cmfe_Field_Initialise(sourceField,err) - CALL cmfe_EquationsSet_SourceCreateStart(equationsSet,SOURCE_FIELD_USER_NUMBER,sourceField,err) - CALL cmfe_Field_VariableLabelSet(sourceField,CMFE_FIELD_U_VARIABLE_TYPE,"Source",err) + CALL OC_Field_Initialise(sourceField,err) + CALL OC_EquationsSet_SourceCreateStart(equationsSet,SOURCE_FIELD_USER_NUMBER,sourceField,err) + CALL OC_Field_VariableLabelSet(sourceField,OC_FIELD_U_VARIABLE_TYPE,"Source",err) !Finish the equations set source field variables - CALL cmfe_EquationsSet_SourceCreateFinish(equationsSet,err) - CALL cmfe_Field_ComponentValuesInitialise(sourceField,CMFE_FIELD_U_VARIABLE_TYPE, & - & CMFE_FIELD_VALUES_SET_TYPE,1,0.0_CMISSRP,err) + CALL OC_EquationsSet_SourceCreateFinish(equationsSet,err) + CALL OC_Field_ComponentValuesInitialise(sourceField,OC_FIELD_U_VARIABLE_TYPE, & + & OC_FIELD_VALUES_SET_TYPE,1,0.0_OC_RP,err) !----------------------------------------------------------------------------------------------------------- ! CELLML FIELD @@ -266,25 +258,25 @@ PROGRAM CellMLSplitReactionDiffusionEquation !Start to set up CellML Fields !Create the CellML environment - CALL cmfe_CellML_Initialise(cellML,err) - CALL cmfe_CellML_CreateStart(CELLML_USER_NUMBER,region,cellML,err) + CALL OC_CellML_Initialise(cellML,err) + CALL OC_CellML_CreateStart(CELLML_USER_NUMBER,region,cellML,err) !Import a constant source (i.e. rate of generation/depletion is zero) model from a file - CALL cmfe_CellML_ModelImport(cellML,"constant_rate.xml",constantModelIndex,err) + CALL OC_CellML_ModelImport(cellML,"constant_rate.xml",constantModelIndex,err) !Speify the variables in the imported model that will be used. ! Now we have imported all the models we are able to specify which variables from the model we want: ! - to set from this side !These are effectively parameters that won't change in the course of the ode solving for one time step. !i.e. fixed before running cellml, known in opencmiss and changed only in opencmiss - components of the parameters field - CALL cmfe_CellML_VariableSetAsKnown(cellML,constantModelIndex,"dude/param",err) + CALL OC_CellML_VariableSetAsKnown(cellML,constantModelIndex,"dude/param",err) ! - to get from the CellML side. variables in cellml model that are not state variables, but are dependent on !independent and state variables. - components of intermediate field - CALL cmfe_CellML_VariableSetAsWanted(cellML,constantModelIndex,"dude/intmd",err) + CALL OC_CellML_VariableSetAsWanted(cellML,constantModelIndex,"dude/intmd",err) !Finish the CellML environment - CALL cmfe_CellML_CreateFinish(cellML,err) + CALL OC_CellML_CreateFinish(cellML,err) !Start the creation of CellML <--> OpenCMISS field maps - CALL cmfe_CellML_FieldMapsCreateStart(cellML,err) + CALL OC_CellML_FieldMapsCreateStart(cellML,err) !Set up the field variable component <--> CellML model variable mappings. !Here opencmiss fields are mapped to appropriate cellml fields (parameters/intermediates/state). !in monodomain problems, typically one wants Vm, a state variable. In the present case, Ca concentration is the @@ -298,35 +290,35 @@ PROGRAM CellMLSplitReactionDiffusionEquation !concentration from the dependent field is used to solve the DAE and the result of the DAE is substituted back to !the source field. - CALL cmfe_CellML_CreateFieldToCellMLMap(cellML,dependentField,CMFE_FIELD_U_VARIABLE_TYPE,1,CMFE_FIELD_VALUES_SET_TYPE, & - & constantModelIndex,"dude/ca",CMFE_FIELD_VALUES_SET_TYPE,err) - CALL cmfe_CellML_CreateCellMLToFieldMap(cellML,constantModelIndex,"dude/ca",CMFE_FIELD_VALUES_SET_TYPE, & - & dependentField,CMFE_FIELD_U_VARIABLE_TYPE,1,CMFE_FIELD_VALUES_SET_TYPE,err) + CALL OC_CellML_CreateFieldToCellMLMap(cellML,dependentField,OC_FIELD_U_VARIABLE_TYPE,1,OC_FIELD_VALUES_SET_TYPE, & + & constantModelIndex,"dude/ca",OC_FIELD_VALUES_SET_TYPE,err) + CALL OC_CellML_CreateCellMLToFieldMap(cellML,constantModelIndex,"dude/ca",OC_FIELD_VALUES_SET_TYPE, & + & dependentField,OC_FIELD_U_VARIABLE_TYPE,1,OC_FIELD_VALUES_SET_TYPE,err) !Finish the creation of CellML <--> OpenCMISS field maps - CALL cmfe_CellML_FieldMapsCreateFinish(cellML,err) + CALL OC_CellML_FieldMapsCreateFinish(cellML,err) !set initial value of the dependent field/state variable, Ca concentration. - CALL cmfe_Field_ComponentValuesInitialise(dependentField,CMFE_FIELD_U_VARIABLE_TYPE, & - & CMFE_FIELD_VALUES_SET_TYPE,1,0.0_CMISSRP,err) + CALL OC_Field_ComponentValuesInitialise(dependentField,OC_FIELD_U_VARIABLE_TYPE, & + & OC_FIELD_VALUES_SET_TYPE,1,0.0_OC_RP,err) nodeIdx=2 - CALL cmfe_Decomposition_NodeDomainGet(decomposition,nodeIdx,1,nodeDomain,err) + CALL OC_Decomposition_NodeDomainGet(decomposition,nodeIdx,1,nodeDomain,err) IF(nodeDomain==computationalNodeNumber) THEN - CALL cmfe_Field_ParameterSetUpdateNode(dependentField,CMFE_FIELD_U_VARIABLE_TYPE, & - & CMFE_FIELD_VALUES_SET_TYPE, & - & 1,1,nodeIdx,1,0.0_CMISSRP,err) + CALL OC_Field_ParameterSetUpdateNode(dependentField,OC_FIELD_U_VARIABLE_TYPE, & + & OC_FIELD_VALUES_SET_TYPE, & + & 1,1,nodeIdx,1,0.0_OC_RP,err) ENDIF !Start the creation of the CellML models field. This field is an integer field that stores which nodes have which cellml !model - CALL cmfe_Field_Initialise(cellMLModelsField,err) - CALL cmfe_CellML_ModelsFieldCreateStart(cellML, CELLML_MODELS_FIELD_USER_NUMBER, & + CALL OC_Field_Initialise(cellMLModelsField,err) + CALL OC_CellML_ModelsFieldCreateStart(cellML, CELLML_MODELS_FIELD_USER_NUMBER, & & cellMLModelsField,err) !Finish the creation of the CellML models field - CALL cmfe_CellML_ModelsFieldCreateFinish(cellML,err) + CALL OC_CellML_ModelsFieldCreateFinish(cellML,err) !The CellMLModelsField is an integer field that stores which model is being used by which node. !By default all field parameters have default model value of 1, i.e. the first model. But, this command below is !for example purposes - CALL cmfe_Field_ComponentValuesInitialise(cellMLModelsField,CMFE_FIELD_U_VARIABLE_TYPE, & - & CMFE_FIELD_VALUES_SET_TYPE,1,1_CMISSIntg,err) + CALL OC_Field_ComponentValuesInitialise(cellMLModelsField,OC_FIELD_U_VARIABLE_TYPE, & + & OC_FIELD_VALUES_SET_TYPE,1,1_OC_Intg,err) !Set up the models field !DO N=1,(numberOfGlobalXElements+1)*(NUMBER_GLOBAL_Y_ELEMENTS+1)*(NUMBER_GLOBAL_Z_ELEMENTS+1) @@ -335,153 +327,153 @@ PROGRAM CellMLSplitReactionDiffusionEquation ! ELSE ! CELL_TYPE = 2 ! ENDIF - ! CALL cmfe_FieldParameterSetUpdateNode(cellMLModelsField,CMFE_FIELD_U_VARIABLE_TYPE,CMFE_FIELD_VALUES_SET_TYPE,1,N,1,CELL_TYPE,err) + ! CALL OC_FieldParameterSetUpdateNode(cellMLModelsField,OC_FIELD_U_VARIABLE_TYPE,OC_FIELD_VALUES_SET_TYPE,1,N,1,CELL_TYPE,err) !END DO - !CALL cmfe_FieldParameterSetUpdateStart(cellMLModelsField,CMFE_FIELD_U_VARIABLE_TYPE,CMFE_FIELD_VALUES_SET_TYPE,err) - !CALL cmfe_FieldParameterSetUpdateFinish(cellMLModelsField,CMFE_FIELD_U_VARIABLE_TYPE,CMFE_FIELD_VALUES_SET_TYPE,err) + !CALL OC_FieldParameterSetUpdateStart(cellMLModelsField,OC_FIELD_U_VARIABLE_TYPE,OC_FIELD_VALUES_SET_TYPE,err) + !CALL OC_FieldParameterSetUpdateFinish(cellMLModelsField,OC_FIELD_U_VARIABLE_TYPE,OC_FIELD_VALUES_SET_TYPE,err) !Start the creation of the cellML state field - CALL cmfe_Field_Initialise(cellMLStateField,err) - CALL cmfe_CellML_StateFieldCreateStart(cellML,CELLML_STATE_FIELD_USER_NUMBER,cellMLStateField,err) + CALL OC_Field_Initialise(cellMLStateField,err) + CALL OC_CellML_StateFieldCreateStart(cellML,CELLML_STATE_FIELD_USER_NUMBER,cellMLStateField,err) !Finish the creation of the CellML state field - CALL cmfe_CellML_StateFieldCreateFinish(cellML,err) + CALL OC_CellML_StateFieldCreateFinish(cellML,err) !Start the creation of the CellML intermediate field - CALL cmfe_Field_Initialise(cellMLIntermediateField,err) - CALL cmfe_CellML_IntermediateFieldCreateStart(cellML,CELLML_INTERMEDIATE_FIELD_USER_NUMBER,cellMLIntermediateField,err) + CALL OC_Field_Initialise(cellMLIntermediateField,err) + CALL OC_CellML_IntermediateFieldCreateStart(cellML,CELLML_INTERMEDIATE_FIELD_USER_NUMBER,cellMLIntermediateField,err) !Finish the creation of the CellML intermediate field - CALL cmfe_CellML_IntermediateFieldCreateFinish(cellML,err) + CALL OC_CellML_IntermediateFieldCreateFinish(cellML,err) !Start the creation of CellML parameters field - CALL cmfe_Field_Initialise(cellMLParametersField,err) - CALL cmfe_CellML_ParametersFieldCreateStart(cellML,CELLML_PARAMETERS_FIELD_USER_NUMBER,cellMLParametersField,err) + CALL OC_Field_Initialise(cellMLParametersField,err) + CALL OC_CellML_ParametersFieldCreateStart(cellML,CELLML_PARAMETERS_FIELD_USER_NUMBER,cellMLParametersField,err) !Finish the creation of CellML parameters - CALL cmfe_CellML_ParametersFieldCreateFinish(cellML,err) + CALL OC_CellML_ParametersFieldCreateFinish(cellML,err) !----------------------------------------------------------------------------------------------------------- ! EQUATIONS SETS !----------------------------------------------------------------------------------------------------------- !Create the equations set equations - CALL cmfe_Equations_Initialise(equations,err) - CALL cmfe_EquationsSet_EquationsCreateStart(equationsSet,equations,err) + CALL OC_Equations_Initialise(equations,err) + CALL OC_EquationsSet_EquationsCreateStart(equationsSet,equations,err) !Set the equations matrices sparsity type - CALL cmfe_Equations_SparsityTypeSet(equations,CMFE_EQUATIONS_SPARSE_MATRICES,err) + CALL OC_Equations_SparsityTypeSet(equations,OC_EQUATIONS_SPARSE_MATRICES,err) !Set the equations set output - CALL cmfe_Equations_OutputTypeSet(equations,CMFE_EQUATIONS_NO_OUTPUT,err) - !CALL cmfe_EquationsOutputTypeSet(equations,CMFE_EQUATIONS_TIMING_OUTPUT,err) - !CALL cmfe_EquationsOutputTypeSet(equations,CMFE_EQUATIONS_MATRIX_OUTPUT,err) - !CALL cmfe_equationsOutputTypeSet(equations,cmfe_EQUATIONS_ELEMENT_MATRIX_OUTPUT,err) + CALL OC_Equations_OutputTypeSet(equations,OC_EQUATIONS_NO_OUTPUT,err) + !CALL OC_EquationsOutputTypeSet(equations,OC_EQUATIONS_TIMING_OUTPUT,err) + !CALL OC_EquationsOutputTypeSet(equations,OC_EQUATIONS_MATRIX_OUTPUT,err) + !CALL OC_equationsOutputTypeSet(equations,OC_EQUATIONS_ELEMENT_MATRIX_OUTPUT,err) !Finish the equations set equations - CALL cmfe_EquationsSet_EquationsCreateFinish(equationsSet,err) + CALL OC_EquationsSet_EquationsCreateFinish(equationsSet,err) !----------------------------------------------------------------------------------------------------------- ! PROBLEM !----------------------------------------------------------------------------------------------------------- !Create the problem - CALL cmfe_Problem_Initialise(problem,err) - CALL cmfe_Problem_CreateStart(PROBLEM_USER_NUMBER,context,[CMFE_PROBLEM_CLASSICAL_FIELD_CLASS, & - & CMFE_PROBLEM_REACTION_DIFFUSION_EQUATION_TYPE,CMFE_PROBLEM_CELLML_REAC_INTEG_REAC_DIFF_STRANG_SPLIT_SUBTYPE],problem,err) + CALL OC_Problem_Initialise(problem,err) + CALL OC_Problem_CreateStart(PROBLEM_USER_NUMBER,context,[OC_PROBLEM_CLASSICAL_FIELD_CLASS, & + & OC_PROBLEM_REACTION_DIFFUSION_EQUATION_TYPE,OC_PROBLEM_CELLML_REAC_INTEG_REAC_DIFF_STRANG_SPLIT_SUBTYPE],problem,err) !Finish the creation of a problem. - CALL cmfe_Problem_CreateFinish(problem,err) + CALL OC_Problem_CreateFinish(problem,err) !----------------------------------------------------------------------------------------------------------- ! PROBLEM CONTROL !----------------------------------------------------------------------------------------------------------- !Create the problem control - CALL cmfe_Problem_ControlLoopCreateStart(problem,err) + CALL OC_Problem_ControlLoopCreateStart(problem,err) !Get the control loop - CALL cmfe_ControlLoop_Initialise(controlLoop,err) - CALL cmfe_Problem_ControlLoopGet(problem,CMFE_CONTROL_LOOP_NODE,controlLoop,err) + CALL OC_ControlLoop_Initialise(controlLoop,err) + CALL OC_Problem_ControlLoopGet(problem,OC_CONTROL_LOOP_NODE,controlLoop,err) !Set the times - CALL cmfe_ControlLoop_TimesSet(controlLoop,0.0_CMISSRP,0.5_CMISSRP,0.01_CMISSRP,err) - CALL cmfe_ControlLoop_OutputTypeSet(controlLoop,CMFE_CONTROL_LOOP_PROGRESS_OUTPUT,err) + CALL OC_ControlLoop_TimesSet(controlLoop,0.0_OC_RP,0.5_OC_RP,0.01_OC_RP,err) + CALL OC_ControlLoop_OutputTypeSet(controlLoop,OC_CONTROL_LOOP_PROGRESS_OUTPUT,err) !Finish creating the problem control loop - CALL cmfe_Problem_ControlLoopCreateFinish(problem,err) + CALL OC_Problem_ControlLoopCreateFinish(problem,err) !----------------------------------------------------------------------------------------------------------- ! PROBLEM SOLVERS !----------------------------------------------------------------------------------------------------------- !Set up the problem solvers for Strang splitting - CALL cmfe_Problem_SolversCreateStart(problem,err) + CALL OC_Problem_SolversCreateStart(problem,err) !First solver is a DAE solver - CALL cmfe_Solver_Initialise(solver,err) - CALL cmfe_Problem_SolverGet(problem,CMFE_CONTROL_LOOP_NODE,1,solver,err) - CALL cmfe_Solver_DAESolverTypeSet(solver,CMFE_SOLVER_DAE_EULER,err) - CALL cmfe_Solver_DAETimeStepSet(solver,0.0000001_CMISSRP,err) - CALL cmfe_Solver_OutputTypeSet(solver,CMFE_SOLVER_MATRIX_OUTPUT,err) + CALL OC_Solver_Initialise(solver,err) + CALL OC_Problem_SolverGet(problem,OC_CONTROL_LOOP_NODE,1,solver,err) + CALL OC_Solver_DAESolverTypeSet(solver,OC_SOLVER_DAE_EULER,err) + CALL OC_Solver_DAETimeStepSet(solver,0.0000001_OC_RP,err) + CALL OC_Solver_OutputTypeSet(solver,OC_SOLVER_MATRIX_OUTPUT,err) !Second solver is the dynamic solver for solving the parabolic equation - CALL cmfe_Solver_Initialise(solver,err) - CALL cmfe_Solver_Initialise(linearSolver,err) - CALL cmfe_Problem_SolverGet(problem,CMFE_CONTROL_LOOP_NODE,2,solver,err) + CALL OC_Solver_Initialise(solver,err) + CALL OC_Solver_Initialise(linearSolver,err) + CALL OC_Problem_SolverGet(problem,OC_CONTROL_LOOP_NODE,2,solver,err) !set theta - backward vs forward time step parameter - CALL cmfe_Solver_DynamicThetaSet(solver,1.0_CMISSRP,err) - !CALL cmfe_SolverOutputTypeSet(solver,CMFE_SOLVER_NO_OUTPUT,err) - CALL cmfe_Solver_OutputTypeSet(solver,CMFE_SOLVER_TIMING_OUTPUT,err) + CALL OC_Solver_DynamicThetaSet(solver,1.0_OC_RP,err) + !CALL OC_SolverOutputTypeSet(solver,OC_SOLVER_NO_OUTPUT,err) + CALL OC_Solver_OutputTypeSet(solver,OC_SOLVER_TIMING_OUTPUT,err) !get the dynamic linear solver from the solver - CALL cmfe_Solver_DynamicLinearSolverGet(solver,linearSolver,err) - CALL cmfe_Solver_LibraryTypeSet(linearSolver,CMFE_SOLVER_LAPACK_LIBRARY,err) - CALL cmfe_Solver_LinearTypeSet(linearSolver,CMFE_SOLVER_LINEAR_DIRECT_SOLVE_TYPE,err) - CALL cmfe_Solver_LinearDirectTypeSet(linearSolver,CMFE_SOLVER_DIRECT_LU,err) - !CALL cmfe_SolverLibraryTypeSet(linearSolver,CMFE_SOLVER_CMISS_LIBRARY,err) - !CALL cmfe_SolverLinearTypeSet(linearSolver,CMFE_SOLVER_LINEAR_DIRECT_SOLVE_TYPE,err) - !CALL cmfe_SolverLibraryTypeSet(linearSolver,CMFE_SOLVER_MUMPS_LIBRARY,err) - !CALL cmfe_Solver_LinearIterativeMaximumIterationsSet(linearSolver,10000,err) + CALL OC_Solver_DynamicLinearSolverGet(solver,linearSolver,err) + CALL OC_Solver_LibraryTypeSet(linearSolver,OC_SOLVER_LAPACK_LIBRARY,err) + CALL OC_Solver_LinearTypeSet(linearSolver,OC_SOLVER_LINEAR_DIRECT_SOLVE_TYPE,err) + CALL OC_Solver_LinearDirectTypeSet(linearSolver,OC_SOLVER_DIRECT_LU,err) + !CALL OC_SolverLibraryTypeSet(linearSolver,OC_SOLVER_OC__LIBRARY,err) + !CALL OC_SolverLinearTypeSet(linearSolver,OC_SOLVER_LINEAR_DIRECT_SOLVE_TYPE,err) + !CALL OC_SolverLibraryTypeSet(linearSolver,OC_SOLVER_MUMPS_LIBRARY,err) + !CALL OC_Solver_LinearIterativeMaximumIterationsSet(linearSolver,10000,err) !Third solver is another DAE solver - CALL cmfe_Solver_Initialise(solver,err) - CALL cmfe_Problem_SolverGet(problem,CMFE_CONTROL_LOOP_NODE,3,solver,err) - CALL cmfe_Solver_DAESolverTypeSet(solver,CMFE_SOLVER_DAE_EULER,err) - CALL cmfe_Solver_DAETimeStepSet(solver,0.0000001_CMISSRP,err) - CALL cmfe_Solver_OutputTypeSet(solver,CMFE_SOLVER_MATRIX_OUTPUT,err) - !CALL cmfe_SolverOutputTypeSet(solver,CMFE_SOLVER_TIMING_OUTPUT,err) - !CALL cmfe_SolverOutputTypeSet(solver,CMFE_SOLVER_SOLVER_OUTPUT,err) - !CALL cmfe_SolverOutputTypeSet(solver,CMFE_SOLVER_PROGRESS_OUTPUT,err) + CALL OC_Solver_Initialise(solver,err) + CALL OC_Problem_SolverGet(problem,OC_CONTROL_LOOP_NODE,3,solver,err) + CALL OC_Solver_DAESolverTypeSet(solver,OC_SOLVER_DAE_EULER,err) + CALL OC_Solver_DAETimeStepSet(solver,0.0000001_OC_RP,err) + CALL OC_Solver_OutputTypeSet(solver,OC_SOLVER_MATRIX_OUTPUT,err) + !CALL OC_SolverOutputTypeSet(solver,OC_SOLVER_TIMING_OUTPUT,err) + !CALL OC_SolverOutputTypeSet(solver,OC_SOLVER_SOLVER_OUTPUT,err) + !CALL OC_SolverOutputTypeSet(solver,OC_SOLVER_PROGRESS_OUTPUT,err) !Finish the creation of the problem solver - CALL cmfe_Problem_SolversCreateFinish(problem,err) + CALL OC_Problem_SolversCreateFinish(problem,err) !Start the creation of the problem solver CellML equations - CALL cmfe_Problem_CellMLEquationsCreateStart(problem,err) + CALL OC_Problem_CellMLEquationsCreateStart(problem,err) !Get the first solver !Get the CellML equations - CALL cmfe_Solver_Initialise(solver,err) - CALL cmfe_Problem_SolverGet(problem,CMFE_CONTROL_LOOP_NODE,1,solver,err) - CALL cmfe_CellMLEquations_Initialise(cellMLEquations,err) - CALL cmfe_Solver_CellMLEquationsGet(solver,cellMLEquations,err) + CALL OC_Solver_Initialise(solver,err) + CALL OC_Problem_SolverGet(problem,OC_CONTROL_LOOP_NODE,1,solver,err) + CALL OC_CellMLEquations_Initialise(cellMLEquations,err) + CALL OC_Solver_CellMLEquationsGet(solver,cellMLEquations,err) !Add in the CellML environement - CALL cmfe_CellMLEquations_CellMLAdd(cellMLEquations,cellML,cellMLIndex,err) + CALL OC_CellMLEquations_CellMLAdd(cellMLEquations,cellML,cellMLIndex,err) !Get the third solver !Get the CellML equations - CALL cmfe_Solver_Initialise(solver,err) - CALL cmfe_Problem_SolverGet(problem,CMFE_CONTROL_LOOP_NODE,3,solver,err) - CALL cmfe_CellMLEquations_Initialise(cellMLEquations,err) - CALL cmfe_Solver_CellMLEquationsGet(solver,cellMLEquations,err) + CALL OC_Solver_Initialise(solver,err) + CALL OC_Problem_SolverGet(problem,OC_CONTROL_LOOP_NODE,3,solver,err) + CALL OC_CellMLEquations_Initialise(cellMLEquations,err) + CALL OC_Solver_CellMLEquationsGet(solver,cellMLEquations,err) !Add in the CellML environement - CALL cmfe_CellMLEquations_CellMLAdd(cellMLEquations,cellML,cellMLIndex,err) + CALL OC_CellMLEquations_CellMLAdd(cellMLEquations,cellML,cellMLIndex,err) !Finish the creation of the problem solver CellML equations - CALL cmfe_Problem_CellMLEquationsCreateFinish(problem,err) + CALL OC_Problem_CellMLEquationsCreateFinish(problem,err) !Start the creation of the problem solver equations - CALL cmfe_Problem_SolverEquationsCreateStart(problem,err) + CALL OC_Problem_SolverEquationsCreateStart(problem,err) !Get the second solver !Get the solver equations - CALL cmfe_Solver_Initialise(solver,err) - CALL cmfe_Problem_SolverGet(problem,CMFE_CONTROL_LOOP_NODE,2,solver,err) - CALL cmfe_SolverEquations_Initialise(solverEquations,err) - CALL cmfe_Solver_SolverEquationsGet(solver,solverEquations,err) + CALL OC_Solver_Initialise(solver,err) + CALL OC_Problem_SolverGet(problem,OC_CONTROL_LOOP_NODE,2,solver,err) + CALL OC_SolverEquations_Initialise(solverEquations,err) + CALL OC_Solver_SolverEquationsGet(solver,solverEquations,err) !Set the solver equations sparsity - !CALL cmfe_SolverEquationsSparsityTypeSet(solverEquations,CMFE_SOLVER_EQUATIONS_SPARSE_MATRICES,err) - CALL cmfe_SolverEquations_SparsityTypeSet(solverEquations,CMFE_SOLVER_SPARSE_MATRICES,err) + !CALL OC_SolverEquationsSparsityTypeSet(solverEquations,OC_SOLVER_EQUATIONS_SPARSE_MATRICES,err) + CALL OC_SolverEquations_SparsityTypeSet(solverEquations,OC_SOLVER_SPARSE_MATRICES,err) !Add in the equations set - CALL cmfe_SolverEquations_EquationsSetAdd(solverEquations,equationsSet,equationsSetIndex,err) + CALL OC_SolverEquations_EquationsSetAdd(solverEquations,equationsSet,equationsSetIndex,err) !Finish the creation of the problem solver equations - CALL cmfe_Problem_SolverEquationsCreateFinish(problem,err) + CALL OC_Problem_SolverEquationsCreateFinish(problem,err) !----------------------------------------------------------------------------------------------------------- ! BOUNDARY CONDITIONS @@ -489,27 +481,27 @@ PROGRAM CellMLSplitReactionDiffusionEquation !Create the equations set boundary conditions boundaryConditionNodes = [1,11] - CALL cmfe_BoundaryConditions_Initialise(boundaryConditions,err) - CALL cmfe_SolverEquations_BoundaryConditionsCreateStart(solverEquations,boundaryConditions,err) + CALL OC_BoundaryConditions_Initialise(boundaryConditions,err) + CALL OC_SolverEquations_BoundaryConditionsCreateStart(solverEquations,boundaryConditions,err) DO nodeIdx=1,2 nodeNumber = boundaryConditionNodes(nodeIdx) - CALL cmfe_Decomposition_NodeDomainGet(decomposition,nodeNumber,1,nodeDomain,err) + CALL OC_Decomposition_NodeDomainGet(decomposition,nodeNumber,1,nodeDomain,err) IF(nodeDomain==computationalNodeNumber) THEN - CALL cmfe_BoundaryConditions_SetNode(boundaryConditions,dependentField,CMFE_FIELD_U_VARIABLE_TYPE,1,CMFE_NO_GLOBAL_DERIV, & - & nodeNumber,1,CMFE_BOUNDARY_CONDITION_FIXED,1.5_CMISSRP,err) + CALL OC_BoundaryConditions_SetNode(boundaryConditions,dependentField,OC_FIELD_U_VARIABLE_TYPE,1,OC_NO_GLOBAL_DERIV, & + & nodeNumber,1,OC_BOUNDARY_CONDITION_FIXED,1.5_OC_RP,err) !Need to set CellML model to zero at the nodes at which value of ca has been fixed. - CALL cmfe_Field_ParameterSetUpdateNode(cellMLModelsField,CMFE_FIELD_U_VARIABLE_TYPE,CMFE_FIELD_VALUES_SET_TYPE,& - & 1,1,nodeNumber,1,0_CMISSIntg,err) + CALL OC_Field_ParameterSetUpdateNode(cellMLModelsField,OC_FIELD_U_VARIABLE_TYPE,OC_FIELD_VALUES_SET_TYPE,& + & 1,1,nodeNumber,1,0_OC_Intg,err) ENDIF ENDDO - CALL cmfe_SolverEquations_BoundaryConditionsCreateFinish(solverEquations,err) + CALL OC_SolverEquations_BoundaryConditionsCreateFinish(solverEquations,err) !----------------------------------------------------------------------------------------------------------- ! SOLVER !----------------------------------------------------------------------------------------------------------- !Solve the problem - CALL cmfe_Problem_Solve(problem,err) + CALL OC_Problem_Solve(problem,err) !----------------------------------------------------------------------------------------------------------- ! OUTPUT @@ -517,17 +509,17 @@ PROGRAM CellMLSplitReactionDiffusionEquation exportField=.TRUE. IF(exportField) THEN - CALL cmfe_Fields_Initialise(fields,err) - CALL cmfe_Fields_Create(region,fields,err) - CALL cmfe_Fields_NodesExport(fields,"cellml_split_reaction_diffusion_equation","FORTRAN",err) - CALL cmfe_Fields_ElementsExport(fields,"cellml_split_reaction_diffusion_equation","FORTRAN",err) - CALL cmfe_Fields_Finalise(fields,err) + CALL OC_Fields_Initialise(fields,err) + CALL OC_Fields_Create(region,fields,err) + CALL OC_Fields_NodesExport(fields,"cellml_split_reaction_diffusion_equation","FORTRAN",err) + CALL OC_Fields_ElementsExport(fields,"cellml_split_reaction_diffusion_equation","FORTRAN",err) + CALL OC_Fields_Finalise(fields,err) ENDIF !Destroy the context - CALL cmfe_Context_Destroy(context,err) + CALL OC_Context_Destroy(context,err) !Finalise OpenCMISS - CALL cmfe_Finalise(err) + CALL OC_Finalise(err) WRITE(*,'(A)') "Program successfully completed." From 2a8e8b7a545f0bc5fb6794f8cc41e556fbb84bfb Mon Sep 17 00:00:00 2001 From: Chris Bradley Date: Sun, 19 Jan 2025 12:57:41 +1300 Subject: [PATCH 9/9] Update --- src/fortran/cellml_split_reaction_diffusion_equation.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fortran/cellml_split_reaction_diffusion_equation.F90 b/src/fortran/cellml_split_reaction_diffusion_equation.F90 index 2b8bbe4..26e5cb0 100644 --- a/src/fortran/cellml_split_reaction_diffusion_equation.F90 +++ b/src/fortran/cellml_split_reaction_diffusion_equation.F90 @@ -301,7 +301,7 @@ PROGRAM CellMLSplitReactionDiffusionEquation CALL OC_Field_ComponentValuesInitialise(dependentField,OC_FIELD_U_VARIABLE_TYPE, & & OC_FIELD_VALUES_SET_TYPE,1,0.0_OC_RP,err) nodeIdx=2 - CALL OC_Decomposition_NodeDomainGet(decomposition,nodeIdx,1,nodeDomain,err) + CALL OC_Decomposition_NodeDomainGet(decomposition,1,nodeIdx,nodeDomain,err) IF(nodeDomain==computationalNodeNumber) THEN CALL OC_Field_ParameterSetUpdateNode(dependentField,OC_FIELD_U_VARIABLE_TYPE, & & OC_FIELD_VALUES_SET_TYPE, & @@ -485,7 +485,7 @@ PROGRAM CellMLSplitReactionDiffusionEquation CALL OC_SolverEquations_BoundaryConditionsCreateStart(solverEquations,boundaryConditions,err) DO nodeIdx=1,2 nodeNumber = boundaryConditionNodes(nodeIdx) - CALL OC_Decomposition_NodeDomainGet(decomposition,nodeNumber,1,nodeDomain,err) + CALL OC_Decomposition_NodeDomainGet(decomposition,1,nodeNumber,nodeDomain,err) IF(nodeDomain==computationalNodeNumber) THEN CALL OC_BoundaryConditions_SetNode(boundaryConditions,dependentField,OC_FIELD_U_VARIABLE_TYPE,1,OC_NO_GLOBAL_DERIV, & & nodeNumber,1,OC_BOUNDARY_CONDITION_FIXED,1.5_OC_RP,err)