1!/*****************************************************************************/ 2! * 3! * Elmer, A Finite Element Software for Multiphysical Problems 4! * 5! * Copyright 1st April 1995 - , CSC - IT Center for Science Ltd., Finland 6! * 7! * This library is free software; you can redistribute it and/or 8! * modify it under the terms of the GNU Lesser General Public 9! * License as published by the Free Software Foundation; either 10! * version 2.1 of the License, or (at your option) any later version. 11! * 12! * This library is distributed in the hope that it will be useful, 13! * but WITHOUT ANY WARRANTY; without even the implied warranty of 14! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15! * Lesser General Public License for more details. 16! * 17! * You should have received a copy of the GNU Lesser General Public 18! * License along with this library (in file ../LGPL-2.1); if not, write 19! * to the Free Software Foundation, Inc., 51 Franklin Street, 20! * Fifth Floor, Boston, MA 02110-1301 USA 21! * 22! *****************************************************************************/ 23! 24!/****************************************************************************** 25! * 26! * Authors: Juha Ruokolainen, Jouni Malinen 27! * Email: Juha.Ruokolainen@csc.fi 28! * Web: http://www.csc.fi/elmer 29! * Address: CSC - IT Center for Science Ltd. 30! * Keilaranta 14 31! * 02101 Espoo, Finland 32! * 33! * Original Date: 01 Oct 1996 34! * 35! *****************************************************************************/ 36 37!> \ingroup ElmerLib 38!> \{ 39 40!------------------------------------------------------------------------------ 41!> Type definitions for Elmer library. 42!------------------------------------------------------------------------------ 43 44#include "../config.h" 45 46MODULE Types 47 48 USE Messages 49 USE iso_varying_string 50 USE, INTRINSIC :: ISO_C_BINDING 51#ifdef _OPENMP 52 USE omp_lib 53#endif 54 55#ifdef HAVE_LUA 56 USE Lua 57#endif 58 IMPLICIT NONE 59 60 INTEGER, PARAMETER :: MAX_NAME_LEN = 128, MAX_STRING_LEN=2048 61 ! Parameter for internal blocking 62 INTEGER, PARAMETER :: VECTOR_BLOCK_LENGTH = 128 63 ! Parameter for internally avoiding calls to BLAS 64 INTEGER, PARAMETER :: VECTOR_SMALL_THRESH = 9 65 66#if defined(ARCH_32_BITS) 67 INTEGER, PARAMETER :: AddrInt = SELECTED_INT_KIND(9) 68#else 69 INTEGER, PARAMETER :: AddrInt = SELECTED_INT_KIND(18) 70#endif 71 72 INTEGER, PARAMETER :: dp = SELECTED_REAL_KIND(12) 73 74 REAL(KIND=dp), PARAMETER :: AEPS = 10 * EPSILON(1.0_dp), & 75 PI = 3.1415926535897932384626433832795_dp 76!------------------------------------------------------------------------------ 77 INTEGER, PARAMETER :: MATRIX_CRS = 1, & 78 MATRIX_BAND = 2, & 79 MATRIX_SBAND = 3, & 80 MATRIX_LIST = 4 81!------------------------------------------------------------------------------ 82 INTEGER, PARAMETER :: SOLVER_EXEC_NEVER = -1, & 83 SOLVER_EXEC_ALWAYS = 0, & 84 SOLVER_EXEC_AHEAD_ALL = 1, & 85 SOLVER_EXEC_AHEAD_TIME = 2, & 86 SOLVER_EXEC_AFTER_ALL = 3, & 87 SOLVER_EXEC_AFTER_TIME = 4, & 88 SOLVER_EXEC_AHEAD_SAVE = 5, & 89 SOLVER_EXEC_AFTER_SAVE = 6, & 90 SOLVER_EXEC_PREDCORR = 7 91 92 INTEGER, PARAMETER :: SOLVER_MODE_DEFAULT = 0, & ! normal pde 93 SOLVER_MODE_AUXILIARY = 1, & ! no fem machinery (SaveData) 94 SOLVER_MODE_ASSEMBLY = 2, & ! coupled solver with single block 95 SOLVER_MODE_COUPLED = 3, & ! coupled solver with multiple blocks 96 SOLVER_MODE_BLOCK = 4, & ! block solver 97 SOLVER_MODE_GLOBAL = 5, & ! lumped variables (no mesh) 98 SOLVER_MODE_MATRIXFREE = 6, & ! normal field, no matrix 99 SOLVER_MODE_STEPS = 7 ! as the legacy but split to different steps 100 101 INTEGER, PARAMETER :: PROJECTOR_TYPE_DEFAULT = 0, & ! unspecified constraint matrix 102 PROJECTOR_TYPE_NODAL = 1, & ! nodal projector 103 PROJECTOR_TYPE_GALERKIN = 2 ! Galerkin projector 104 105 INTEGER, PARAMETER :: DIRECT_NORMAL = 0, & ! Normal direct method 106 DIRECT_PERMON = 1 ! Permon direct method 107 108!------------------------------------------------------------------------------ 109 CHARACTER, PARAMETER :: Backslash = ACHAR(92) 110!------------------------------------------------------------------------------ 111 112 113#ifdef HAVE_MUMPS 114 INCLUDE 'dmumps_struc.h' 115#endif 116 117 118 TYPE BasicMatrix_t 119 INTEGER :: NumberOfRows 120 INTEGER, ALLOCATABLE :: Rows(:), Cols(:), Diag(:) 121 INTEGER, ALLOCATABLE :: GRows(:), RowOwner(:) 122 REAL(KIND=dp), ALLOCATABLE :: Values(:),MassValues(:), & 123 DampValues(:),ILUValues(:),PrecValues(:) 124 END TYPE BasicMatrix_t 125 126 127 TYPE SubVector_t 128 TYPE(Variable_t), POINTER :: Var 129 REAL(KIND=dp) :: rnorm, bnorm, xnorm 130 REAL(KIND=dp), ALLOCATABLE :: rhs(:) 131 REAL(KIND=dp), ALLOCATABLE :: DiagScaling(:) 132 TYPE(Solver_t), POINTER :: Solver => NULL() 133 END TYPE SubVector_t 134 135 TYPE SubMatrix_t 136 TYPE(Matrix_t), POINTER :: Mat 137 TYPE(Matrix_t), POINTER :: PrecMat 138 END TYPE SubMatrix_t 139 140 TYPE BlockMatrix_t 141 INTEGER :: NoVar = 0, MaxSize, TotSize 142 INTEGER, POINTER :: Offset(:) 143 TYPE(Solver_t), POINTER :: Solver 144 REAL(KIND=dp) :: rnorm, bnorm, xnorm 145 TYPE(SubMatrix_t), ALLOCATABLE :: SubMatrix(:,:) 146 LOGICAL, ALLOCATABLE :: SubMatrixActive(:,:) 147 TYPE(SubVector_t), POINTER :: SubVector(:) => NULL() 148 INTEGER, POINTER :: BlockStruct(:) 149 INTEGER, POINTER :: InvBlockStruct(:) 150 LOGICAL :: GotBlockStruct 151 LOGICAL, ALLOCATABLE :: SubMatrixTranspose(:,:) 152 END TYPE BlockMatrix_t 153 154#if defined(HAVE_MKL) && defined(HAVE_CPARDISO) 155 TYPE CPardiso_struct 156 INTEGER :: n 157 INTEGER :: mtype 158 INTEGER :: msglvl 159 INTEGER :: maxfct 160 INTEGER :: mnum 161 INTEGER :: nrhs 162 INTEGER, POINTER CONTIG :: ia(:) => NULL(), ja(:) => NULL() 163 REAL(kind=dp), POINTER CONTIG :: aa(:) => NULL(), rhs(:) => NULL(), & 164 x(:) => NULL() 165 INTEGER, POINTER CONTIG :: IParm(:) => NULL() 166 INTEGER(KIND=AddrInt), POINTER CONTIG :: ID(:) => NULL() 167 END TYPE CPardiso_struct 168#endif 169 170 TYPE Matrix_t 171 TYPE(Matrix_t), POINTER :: Child => NULL(), Parent => NULL(), CircuitMatrix => Null(), & 172 ConstraintMatrix=>NULL(), EMatrix=>NULL(), AddMatrix=>NULL(), CollectionMatrix=>NULL() 173 174 INTEGER :: NumberOfRows, ExtraDOFs=0, ParallelDOFs=0 175 176 TYPE(Solver_t), POINTER :: Solver => NULL() 177 178 LOGICAL :: NoDirichlet = .FALSE. 179 REAL(KIND=dp), ALLOCATABLE :: Dvalues(:) 180 LOGICAL, ALLOCATABLE :: ConstrainedDOF(:) 181 182 INTEGER :: Subband, FORMAT, SolveCount, Comm=-1 183 LOGICAL :: Ordered, Lumped, Symmetric, COMPLEX, DGMatrix, Cholesky 184 185 INTEGER :: ProjectorBC,ProjectorType 186 187 TYPE(ListMatrix_t), POINTER :: ListMatrix(:) => NULL() 188 189 INTEGER, POINTER :: Perm(:)=>NULL(),InvPerm(:)=>NULL(), Gorder(:)=>NULL(), EPerm(:)=>NULL() 190 INTEGER, ALLOCATABLE :: GRows(:), RowOwner(:) 191 INTEGER, POINTER CONTIG :: Rows(:)=>NULL(),Cols(:)=>NULL(), Diag(:)=>NULL() 192 193 REAL(KIND=dp), POINTER CONTIG :: RHS(:)=>NULL(),BulkRHS(:)=>NULL(),RHS_im(:)=>NULL(),Force(:,:)=>NULL() 194 REAL(KIND=dp), POINTER CONTIG :: BulkResidual(:)=>NULL() 195 196 REAL(KIND=dp), POINTER CONTIG :: Values(:)=>NULL(), ILUValues(:)=>NULL(), & 197 DiagScaling(:) => NULL(), TValues(:) => Null() 198 199 REAL(KIND=dp), ALLOCATABLE :: extraVals(:) 200 REAL(KIND=dp) :: RhsScaling 201 REAL(KIND=dp), POINTER CONTIG :: MassValues(:)=>NULL(),DampValues(:)=>NULL(), & 202 BulkValues(:)=>NULL(), BulkMassValues(:)=>NULL(), BulkDampValues(:)=>NULL(), & 203 PrecValues(:)=>NULL(), HaloValues(:)=>Null(), HaloMassValues(:)=>Null() 204 205#ifdef HAVE_FETI4I 206 TYPE(C_PTR) :: PermonMatrix = C_NULL_PTR, PermonSolverInstance = C_NULL_PTR 207#endif 208#ifdef HAVE_MUMPS 209 TYPE(dmumps_struc), POINTER :: MumpsID => NULL() ! Global distributed Mumps 210 TYPE(dmumps_struc), POINTER :: MumpsIDL => NULL() ! Local domainwise Mumps 211#endif 212#if defined(HAVE_MKL) || defined(HAVE_PARDISO) 213 INTEGER, POINTER :: PardisoParam(:) => NULL() 214 INTEGER(KIND=AddrInt), POINTER :: PardisoID(:) => NULL() 215#endif 216#if defined(HAVE_MKL) && defined(HAVE_CPARDISO) 217 TYPE(CPardiso_struct), POINTER :: CPardisoID => NULL() 218#endif 219#ifdef HAVE_SUPERLU 220 INTEGER(KIND=AddrInt) :: SuperLU_Factors=0 221#endif 222#ifdef HAVE_UMFPACK 223 INTEGER(KIND=AddrInt) :: UMFPack_Numeric=0 224#endif 225#ifdef HAVE_CHOLMOD 226 INTEGER(KIND=AddrInt) :: Cholmod=0 227#endif 228#ifdef HAVE_HYPRE 229 INTEGER(KIND=C_INTPTR_T) :: Hypre=0 230#endif 231#ifdef HAVE_TRILINOS 232 INTEGER(KIND=C_INTPTR_T) :: Trilinos=0 233#endif 234 INTEGER(KIND=AddrInt) :: SpMV=0 235 236 INTEGER(KIND=AddrInt) :: MatVecSubr = 0 237 238 INTEGER, POINTER CONTIG :: ILURows(:)=>NULL(),ILUCols(:)=>NULL(),ILUDiag(:)=>NULL() 239 240! For Complex systems, not used yet!: 241! ----------------------------------- 242 COMPLEX(KIND=dp), POINTER :: CRHS(:)=>NULL(),CForce(:,:)=>NULL() 243 COMPLEX(KIND=dp), POINTER :: CValues(:)=>NULL(),CILUValues(:)=>NULL() 244 COMPLEX(KIND=dp), POINTER :: CMassValues(:)=>NULL(),CDampValues(:)=>NULL() 245 246! For Flux Corrected Transport 247 REAL(KIND=dp), POINTER :: FCT_D(:) => NULL() 248 REAL(KIND=dp), POINTER :: MassValuesLumped(:) => NULL() 249 250 TYPE(ParallelInfo_t), POINTER :: ParallelInfo=>NULL() 251 TYPE(SParIterSolverGlobalD_t), POINTER :: ParMatrix=>NULL() 252 END TYPE Matrix_t 253!------------------------------------------------------------------------------ 254 255 256!------------------------------------------------------------------------------ 257! Typedefs for parallel solver 258!------------------------------------------------------------------------------ 259 260 TYPE ParEnv_t 261 INTEGER :: PEs 262 INTEGER :: MyPE 263 LOGICAL :: Initialized 264 INTEGER :: ActiveComm 265 LOGICAL, DIMENSION(:), POINTER :: Active 266 LOGICAL, DIMENSION(:), POINTER :: IsNeighbour 267 LOGICAL, DIMENSION(:), POINTER :: SendingNB 268 INTEGER :: NumOfNeighbours 269 INTEGER :: NumberOfThreads = 1 270 END TYPE ParEnv_t 271 272 273 TYPE GlueTableT 274 INTEGER, DIMENSION(:), POINTER :: Rows=>NULL(), & 275 Cols=>NULL(), Inds=>NULL(), RowOwner=>NULL() 276 END TYPE GlueTableT 277 278 279 TYPE VecIndicesT 280 INTEGER, DIMENSION(:), POINTER :: RevInd=>NULL() 281 END TYPE VecIndicesT 282 283 284 TYPE IfVecT 285 REAL(KIND=dp), DIMENSION(:), POINTER :: IfVec=>NULL() 286 END TYPE IfVecT 287 288 289 TYPE RHST 290 REAL(KIND=dp), DIMENSION(:), POINTER :: RHSvec=>NULL() 291 INTEGER, DIMENSION(:), POINTER :: RHSind=>NULL() 292 END TYPE RHST 293 294 295 TYPE DPBufferT 296 REAL(KIND=dp), DIMENSION(:), POINTER :: DPBuf=>NULL() 297 END TYPE DPBufferT 298 299 300 TYPE ResBufferT 301 REAL(KIND=dp), DIMENSION(:), ALLOCATABLE :: ResVal 302 INTEGER, DIMENSION(:), ALLOCATABLE :: ResInd 303 END TYPE ResBufferT 304 305 306 TYPE IfLColsT 307 INTEGER, DIMENSION(:), POINTER :: IfVec=>NULL() 308 END TYPE IfLColsT 309 310 311 TYPE SplittedMatrixT 312 TYPE (BasicMatrix_t), DIMENSION(:), POINTER :: IfMatrix=>NULL() 313 TYPE (Matrix_t), POINTER :: InsideMatrix=>NULL() 314 TYPE (BasicMatrix_t), DIMENSION(:), POINTER :: NbsIfMatrix=>NULL() 315 316 TYPE (VecIndicesT), DIMENSION(:), POINTER :: VecIndices=>NULL() 317 TYPE (IfVecT), DIMENSION(:), POINTER :: IfVecs=>NULL() 318 TYPE (IfLColsT), DIMENSION(:), POINTER :: IfORows=>NULL() 319 TYPE (IfLColsT), DIMENSION(:), POINTER :: IfLCols=>NULL() 320 TYPE (GlueTableT), POINTER :: GlueTable=>NULL() 321 TYPE (RHST), DIMENSION(:), POINTER :: RHS=>NULL() 322 TYPE (ResBufferT), DIMENSION(:), POINTER :: ResBuf=>NULL() 323 REAL(KIND=dp), POINTER CONTIG :: & 324 Work(:,:)=>NULL(),TmpXVec(:)=>NULL(),TmpRVec(:)=>NULL() 325 END TYPE SplittedMatrixT 326 327 328 TYPE SParIterSolverGlobalD_t 329 TYPE (SplittedMatrixT), POINTER :: SplittedMatrix=>NULL() 330 TYPE (Matrix_t), POINTER :: Matrix=>NULL() 331 TYPE (ParallelInfo_t), POINTER :: ParallelInfo=>NULL() 332 TYPE(ParEnv_t) :: ParEnv 333 INTEGER :: DOFs, RelaxIters 334 END TYPE SParIterSolverGlobalD_t 335 336 TYPE(SParIterSolverGlobalD_t), POINTER :: ParMatrix 337 338!------------------------------------------------------------------------------- 339 340 ! 341 ! Basis function type 342 ! 343 TYPE BasisFunctions_t 344 INTEGER :: n 345 INTEGER, POINTER :: p(:)=>NULL(),q(:)=>NULL(),r(:)=>NULL() 346 REAL(KIND=dp), POINTER :: coeff(:)=>NULL() 347 END TYPE BasisFunctions_t 348 349 350 ! 351 ! Element type description 352 ! 353 TYPE ElementType_t 354 TYPE(ElementType_t),POINTER :: NextElementType ! this is a list of types 355 356 INTEGER :: ElementCode ! numeric code for element 357 358 INTEGER :: BasisFunctionDegree, & ! linear or quadratic 359 NumberOfNodes, & 360 NumberOfEdges, & 361 NumberOfFaces, & 362 DIMENSION ! 1=line, 2=surface, 3=volume 363 364 INTEGER :: GaussPoints,GaussPoints2, GaussPoints0 ! number of gauss points to use 365 366 REAL(KIND=dp) :: StabilizationMK ! stab.param. depending on 367 ! interpolation type 368 369 TYPE(BasisFunctions_t), POINTER :: BasisFunctions(:) 370 REAL(KIND=dp), DIMENSION(:), ALLOCATABLE :: NodeU, NodeV, NodeW 371 REAL(KIND=dp), DIMENSION(:), ALLOCATABLE :: P_NodeU, P_NodeV, P_NodeW 372 REAL(KIND=dp), DIMENSION(:), ALLOCATABLE :: N_NodeU, N_NodeV, N_NodeW 373 END TYPE ElementType_t 374 375!------------------------------------------------------------------------------ 376 TYPE ValueListEntry_t 377 INTEGER :: TYPE 378 TYPE(ValueListEntry_t), POINTER :: Next => Null() 379 380 REAL(KIND=dp), POINTER :: TValues(:), Cumulative(:) => NULL() 381 REAL(KIND=dp), POINTER :: FValues(:,:,:), CubicCoeff(:)=>NULL() 382 INTEGER :: Fdim = 0 383 384 LOGICAL :: LValue 385 INTEGER, POINTER :: IValues(:) 386 387 INTEGER(KIND=AddrInt) :: PROCEDURE 388 389 REAL(KIND=dp) :: Coeff = 1.0_dp 390 CHARACTER(LEN=MAX_NAME_LEN) :: CValue 391 392 INTEGER :: NameLen,DepNameLen = 0 393 CHARACTER(LEN=MAX_NAME_LEN) :: Name,DependName 394 395#ifdef DEVEL_LISTCOUNTER 396 INTEGER :: Counter = 0 397#endif 398 399#ifdef HAVE_LUA 400 LOGICAL :: LuaFun = .FALSE. 401 !CHARACTER(len=:), ALLOCATABLE :: LuaCmd 402#endif 403 404 END TYPE ValueListEntry_t 405 406 TYPE ValueList_t 407 TYPE(ValueListEntry_t), POINTER :: Head => Null() 408 END TYPE ValueList_t 409 410 411 TYPE VariableTable_t 412 TYPE(Variable_t), POINTER :: Variable 413 END TYPE VariableTable_t 414 415 416 ! This is a tentative data type to speed up the retrieval of parameters 417 ! at elements. 418 !---------------------------------------------------------------------- 419 TYPE ValueHandle_t 420 INTEGER :: ValueType = -1 421 INTEGER :: SectionType = -1 422 INTEGER :: ListId = -1 423 LOGICAL :: BulkElement 424 TYPE(Element_t), POINTER :: Element => NULL() 425 TYPE(ValueList_t), POINTER :: List => Null() 426 TYPE(ValueList_t), POINTER :: Ptr => Null() 427 TYPE(Nodes_t), POINTER :: Nodes 428 INTEGER, POINTER :: Indexes 429 INTEGER :: n 430 INTEGER :: nValuesVec = 0 431 REAL(KIND=dp), POINTER :: ValuesVec(:) => NULL() 432 REAL(KIND=dp), POINTER :: Values(:) => NULL() 433 REAL(KIND=dp), POINTER :: ParValues(:,:) => NULL() 434 INTEGER :: ParNo = 0 435 INTEGER :: IValue, DefIValue = 0 436 REAL(KIND=dp) :: RValue, DefRValue = 0.0_dp 437 INTEGER :: Rdim = 0 438 REAL(KIND=dp), POINTER :: RTensor(:,:) => NULL() 439 REAL(KIND=dp), POINTER :: RTensorValues(:,:,:) => NULL() 440 LOGICAL :: LValue, DefLValue = .FALSE. 441 CHARACTER(LEN=MAX_NAME_LEN) :: CValue 442 INTEGER :: CValueLen 443 LOGICAL :: Found 444 CHARACTER(LEN=MAX_NAME_LEN) :: Name 445 LOGICAL :: Initialized = .FALSE. 446 LOGICAL :: AllocationsDone = .FALSE. 447 LOGICAL :: ConstantEverywhere = .FALSE. 448 LOGICAL :: GlobalEverywhere = .FALSE. 449 LOGICAL :: GlobalInList = .FALSE. 450 LOGICAL :: EvaluateAtIP = .FALSE. 451 LOGICAL :: SomeVarAtIp = .FALSE. 452 LOGICAL :: SomewhereEvaluateAtIP = .FALSE. 453 LOGICAL :: NotPresentAnywhere = .FALSE. 454 LOGICAL :: UnfoundFatal = .FALSE. 455 REAL(KIND=dp) :: minv, maxv 456 LOGICAL :: GotMinv = .FALSE., GotMaxv = .FALSE. 457 TYPE(VariableTable_t) :: VarTable(32) 458 INTEGER :: VarCount 459 460 TYPE(ValueHandle_t), POINTER :: HandleIm => NULL() 461 TYPE(ValueHandle_t), POINTER :: Handle2 => NULL() 462 TYPE(ValueHandle_t), POINTER :: Handle3 => NULL() 463 END TYPE ValueHandle_t 464 465 466 TYPE VariableHandle_t 467 TYPE(Variable_t), POINTER :: Variable=>NULL() 468 REAL(KIND=dp),POINTER :: Values(:)=>NULL() 469 INTEGER,POINTER :: Perm(:)=>NULL() 470 INTEGER :: dofs 471 INTEGER :: tstep = 0 472 TYPE(Element_t), POINTER :: Element 473 LOGICAL :: ActiveElement = .FALSE. 474 INTEGER :: Indexes(100) 475 INTEGER :: n = 0 476 END TYPE VariableHandle_t 477 478 479!------------------------------------------------------------------------------ 480 481 TYPE MaterialArray_t 482 TYPE(ValueList_t), POINTER :: Values => Null() 483 END TYPE MaterialArray_t 484 485!------------------------------------------------------------------------------ 486 487 TYPE BoundaryConditionArray_t 488 INTEGER :: Type=0,Tag=0 489 TYPE(Matrix_t), POINTER :: PMatrix => NULL() 490 LOGICAL :: PMatrixGalerkin = .FALSE. 491 TYPE(ValueList_t), POINTER :: Values => Null() 492 END TYPE BoundaryConditionArray_t 493 494!------------------------------------------------------------------------------ 495 496 TYPE InitialConditionArray_t 497 INTEGER :: TYPE=0,Tag=0 498 TYPE(ValueList_t), POINTER :: Values => Null() 499 END TYPE InitialConditionArray_t 500 501!------------------------------------------------------------------------------ 502 503 TYPE ComponentArray_t 504 TYPE(ValueList_t), POINTER :: Values => Null() 505 END TYPE ComponentArray_t 506 507!------------------------------------------------------------------------------ 508 509 TYPE BodyForceArray_t 510 TYPE(ValueList_t), POINTER :: Values => Null() 511 END TYPE BodyForceArray_t 512 513!------------------------------------------------------------------------------ 514 515 TYPE BoundaryArray_t 516 TYPE(ValueList_t), POINTER :: Values => Null() 517 END TYPE BoundaryArray_t 518 519!------------------------------------------------------------------------------ 520 521 TYPE BodyArray_t 522 TYPE(ValueList_t), POINTER :: Values => Null() 523 END TYPE BodyArray_t 524 525!------------------------------------------------------------------------------ 526 527 TYPE EquationArray_t 528 TYPE(ValueList_t), POINTER :: Values => Null() 529 END TYPE EquationArray_t 530 531!------------------------------------------------------------------------------ 532 533! TYPE SimulationInfo_t 534! TYPE(ValueList_t) :: Values => Null() 535! END TYPE SimulationInfo_t 536 537!------------------------------------------------------------------------------ 538 INTEGER, PARAMETER :: Variable_on_nodes = 0 539 INTEGER, PARAMETER :: Variable_on_edges = 1 540 INTEGER, PARAMETER :: Variable_on_faces = 2 541 INTEGER, PARAMETER :: Variable_on_nodes_on_elements = 3 542 INTEGER, PARAMETER :: Variable_on_gauss_points = 4 543 INTEGER, PARAMETER :: Variable_on_elements = 5 544 INTEGER, PARAMETER :: Variable_global = 6 545 546 547 548 TYPE IntegrationPointsTable_t 549 INTEGER :: IPCount = 0 550 INTEGER, POINTER :: IPOffset(:) 551 !TYPE(GaussIntegrationPoints_t), POINTER :: IPs 552 END TYPE IntegrationPointsTable_t 553 554 555! TYPE Variable_Component_t 556! CHARACTER(LEN=MAX_NAME_LEN) :: Name 557! INTEGER :: DOFs, Type 558! END TYPE Variable_Component_t 559 560 TYPE Variable_t 561 TYPE(Variable_t), POINTER :: Next => NULL() 562 TYPE(Variable_t), POINTER :: EVar => NULL() 563 INTEGER :: NameLen = 0 564 CHARACTER(LEN=MAX_NAME_LEN) :: Name 565 566 TYPE(Solver_t), POINTER :: Solver => NULL() 567 LOGICAL :: Valid, Output 568 TYPE(Mesh_t), POINTER :: PrimaryMesh => NULL() 569 570 LOGICAL :: ValuesChanged = .FALSE. 571 572! Some variables are created from pointers to the primary variables 573 LOGICAL :: Secondary = .FALSE. 574 575 INTEGER :: TYPE = Variable_on_nodes 576 577 INTEGER :: DOFs = 0 578 INTEGER, POINTER :: Perm(:) => NULL() 579 LOGICAL :: PeriodicFlipActive = .FALSE. 580 REAL(KIND=dp) :: Norm=0, PrevNorm=0,NonlinChange=0, SteadyChange=0 581 INTEGER :: NonlinConverged=-1, SteadyConverged=-1, NonlinIter=-1 582 INTEGER :: LinConverged=-1 583 COMPLEX(KIND=dp), POINTER :: EigenValues(:) => NULL(), & 584 EigenVectors(:,:) => NULL() 585 REAL(KIND=dp), POINTER :: ConstraintModes(:,:) => NULL() 586 INTEGER, POINTER :: ConstraintModesIndeces(:) => NULL() 587 INTEGER :: NumberOfConstraintModes = 0 588 REAL(KIND=dp), POINTER :: Values(:) => NULL() ,& 589 PrevValues(:,:) => NULL(), & 590 PValues(:) => NULL(), NonlinValues(:) => NULL(), & 591 SteadyValues(:) => NULL() 592 LOGICAL, POINTER :: UpperLimitActive(:) => NULL(), LowerLimitActive(:) => NULL() 593 COMPLEX(KIND=dp), POINTER :: CValues(:) => NULL() 594 TYPE(IntegrationPointsTable_t), POINTER :: IPTable => NULL() 595 END TYPE Variable_t 596 597!------------------------------------------------------------------------------ 598 TYPE ListMatrixEntry_t 599 INTEGER :: Index = -1 600 REAL(KIND=dp) :: Value = 0.0 601 TYPE(ListMatrixEntry_t), POINTER :: Next => NULL() 602 END TYPE ListMatrixEntry_t 603 604 TYPE ListMatrixEntryPool_t 605 TYPE(ListMatrixEntry_t), ALLOCATABLE :: Entries(:) 606 INTEGER :: NextIndex = 0 607 TYPE(ListMatrixEntryPool_t), POINTER :: Next => NULL() 608 END type ListMatrixEntryPool_t 609 610 TYPE ListMatrixPool_t 611 TYPE(ListMatrixEntryPool_t), POINTER :: EntryPool => NULL() 612 TYPE(ListMatrixEntry_t), POINTER :: Deleted => NULL() 613 INTEGER :: PoolSize = 0 614 END TYPE ListMatrixPool_t 615 616 TYPE ListMatrix_t 617 INTEGER :: Degree, Level 618 TYPE(ListMatrixEntry_t), POINTER :: Head 619 END TYPE ListMatrix_t 620 621 TYPE ListMatrixArray_t 622 TYPE(ListMatrix_t), ALLOCATABLE :: Rows(:) 623 TYPE(ListMatrixPool_t), ALLOCATABLE :: Pool(:) 624#ifdef _OPENMP 625 INTEGER(KIND=omp_lock_kind), ALLOCATABLE :: RowLocks(:) 626#endif 627 END TYPE ListMatrixArray_t 628 629!------------------------------------------------------------------------------ 630 631 TYPE Factors_t 632 INTEGER :: NumberOfFactors = 0, NumberOfImplicitFactors = 0 633 INTEGER, POINTER :: Elements(:) => NULL() 634 REAL(KIND=dp), POINTER :: Factors(:) => NULL() 635 END TYPE Factors_t 636 637!------------------------------------------------------------------------------- 638 639 TYPE BoundaryInfo_t 640 TYPE(Factors_t), POINTER :: GebhardtFactors=>NULL() 641 INTEGER :: Constraint = 0, OutBody = -1 642 TYPE(Element_t), POINTER :: Left =>NULL(), Right=>NULL() 643 END TYPE BoundaryInfo_t 644 645!------------------------------------------------------------------------------- 646 647 TYPE ElementData_t 648 TYPE(ElementData_t), POINTER :: Next=>NULL() 649 TYPE(varying_string) :: Name 650 REAL(KIND=dp), POINTER :: Values(:)=>NULL() 651 END TYPE ElementData_t 652 653!------------------------------------------------------------------------------- 654 655 TYPE Element_t 656 TYPE(ElementType_t), POINTER :: TYPE => NULL() 657 658 LOGICAL :: Copy = .FALSE. 659 660 INTEGER :: BodyId=0, Splitted=0 661 REAL(KIND=dp) :: StabilizationMK,hK 662 663 TYPE(BoundaryInfo_t), POINTER :: BoundaryInfo => NULL() 664 665 INTEGER :: ElementIndex=-1, GElementIndex=-1, PartIndex=-1, NDOFs=0, BDOFs=0, DGDOFs=0 666 INTEGER, DIMENSION(:), POINTER CONTIG :: & 667 NodeIndexes => NULL(), EdgeIndexes => NULL(), & 668 FaceIndexes => NULL(), BubbleIndexes => NULL(), & 669 DGIndexes => NULL() 670!DIR$ ATTRIBUTES ALIGN:64::NodeIndexes, EdgeIndexes, FaceIndexes, BubbleIndexes, DGIndexes 671 672 TYPE(PElementDefs_t), POINTER :: PDefs=>NULL() 673 TYPE(ElementData_t), POINTER :: PropertyData=>NULL() 674 END TYPE Element_t 675 676!------------------------------------------------------------------------------- 677 678 TYPE PElementDefs_t 679 INTEGER :: P 680 INTEGER :: TetraType ! Type of p tetrahedron={0,1,2} 681 LOGICAL :: isEdge ! Is element an edge or face? 682 INTEGER :: GaussPoints ! Number of gauss points to use when using p elements 683 LOGICAL :: pyramidQuadEdge ! Is element an edge of pyramid quad face? 684 INTEGER :: localNumber ! Local number of an edge or face for element on boundary 685 END TYPE PElementDefs_t 686 687!------------------------------------------------------------------------------- 688 689 TYPE NeighbourList_t 690 INTEGER, DIMENSION(:), POINTER :: Neighbours 691 END TYPE NeighbourList_t 692 693!------------------------------------------------------------------------------ 694 695 ! 696 ! Coordinate and vector type definition, coordinate arrays must be allocated 697 ! prior to use of variables of this type. 698 ! 699 TYPE Nodes_t 700 INTEGER :: NumberOfNodes 701 REAL(KIND=dp), ALLOCATABLE :: xyz(:,:) 702 REAL(KIND=dp), POINTER CONTIG :: x(:)=>NULL() 703 REAL(KIND=dp), POINTER CONTIG :: y(:)=>NULL() 704 REAL(KIND=dp), POINTER CONTIG :: z(:)=>NULL() 705!DIR$ ATTRIBUTES ALIGN:64::x,y,z,xyz 706 END TYPE Nodes_t 707 708!------------------------------------------------------------------------------ 709 710 TYPE QuadrantPointer_t 711 TYPE(Quadrant_t), POINTER :: Quadrant 712 END TYPE QuadrantPointer_t 713 714!------------------------------------------------------------------------------ 715 716 TYPE Quadrant_t 717 INTEGER, DIMENSION(:), POINTER :: Elements 718 REAL(KIND=dp) :: SIZE, MinElementSize, BoundingBox(6) 719 INTEGER :: NElemsInQuadrant 720 TYPE(QuadrantPointer_t), DIMENSION(:), POINTER :: ChildQuadrants 721 END TYPE Quadrant_t 722 723!------------------------------------------------------------------------------ 724 725 TYPE Projector_t 726 TYPE(Projector_t), POINTER :: Next 727 TYPE(Mesh_t), POINTER :: Mesh 728 TYPE(Matrix_t), POINTER :: Matrix, TMatrix 729 END TYPE Projector_t 730 731 732!------------------------------------------------------------------------------ 733 734 TYPE ParallelInfo_t 735 INTEGER :: NumberOfIfDOFs 736 LOGICAL, POINTER :: INTERFACE(:) 737 INTEGER, POINTER :: GlobalDOFs(:) 738 TYPE(NeighbourList_t),POINTER :: NeighbourList(:) 739 INTEGER, POINTER :: Gorder(:) => NULL() 740 741 LOGICAL, POINTER :: FaceInterface(:) 742 TYPE(NeighbourList_t),POINTER :: FaceNeighbourList(:) 743 744 LOGICAL, POINTER :: EdgeInterface(:) 745 TYPE(NeighbourList_t),POINTER :: EdgeNeighbourList(:) 746 END TYPE ParallelInfo_t 747 748!------------------------------------------------------------------------------ 749 750 TYPE Mesh_t 751 CHARACTER(MAX_NAME_LEN) :: Name 752 TYPE(Mesh_t), POINTER :: Next,Parent,Child 753 754 TYPE(Projector_t), POINTER :: Projector 755 TYPE(Quadrant_t), POINTER :: RootQuadrant 756 757 LOGICAL :: Changed, OutputActive, Stabilize 758 INTEGER :: SavesDone, AdaptiveDepth, MeshTag = 1 759 760 TYPE(Factors_t), POINTER :: ViewFactors(:) 761 762 TYPE(ParallelInfo_t) :: ParallelInfo 763 TYPE(Variable_t), POINTER :: Variables 764 765 TYPE(Nodes_t), POINTER :: Nodes 766 TYPE(Element_t), DIMENSION(:), POINTER :: Elements, Edges, Faces 767 TYPE(Nodes_t), POINTER :: NodesOrig 768 TYPE(Nodes_t), POINTER :: NodesMapped 769 770 LOGICAL :: DisContMesh 771 INTEGER, POINTER :: DisContPerm(:) 772 INTEGER :: DisContNodes 773 774 INTEGER, POINTER :: PeriodicPerm(:) => NULL() 775 LOGICAL, POINTER :: PeriodicFlip(:) => NULL() 776 777 INTEGER, POINTER :: InvPerm(:) 778 779 INTEGER :: NumberOfNodes, NumberOfBulkElements, NumberOfEdges, & 780 NumberOfFaces, NumberOfBoundaryElements, MeshDim = 0, MaxDim = 0, PassBCcnt=0 781 INTEGER :: MinEdgeDOFs, MinFaceDOFs 782 INTEGER :: MaxElementNodes, MaxElementDOFs, MaxEdgeDOFs, MaxFaceDOFs, MaxBDOFs 783 784 LOGICAL :: EntityWeightsComputed 785 REAL(KIND=dp), POINTER :: BCWeight(:), BodyForceWeight(:),& 786 BodyWeight(:), MaterialWeight(:) 787 788 INTEGER, POINTER :: RePartition(:) => NULL() 789 TYPE(NeighbourList_t), POINTER :: Halo(:) => NULL() 790 LOGICAL :: HaveHalo = .FALSE. 791 792 LOGICAL :: SingleMesh = .FALSE. 793 794 END TYPE Mesh_t 795 796 TYPE Graph_t 797 INTEGER :: n 798 INTEGER, ALLOCATABLE :: ptr(:), ind(:) 799 END type Graph_t 800 801 TYPE Graphcolour_t 802 INTEGER :: nc 803 INTEGER, ALLOCATABLE :: colours(:) 804 END TYPE Graphcolour_t 805 806 TYPE MortarBC_t 807 TYPE(Matrix_t), POINTER :: Projector => NULL() 808 INTEGER, POINTER :: Perm(:) => NULL() 809 REAL(KIND=dp), POINTER :: Rhs(:) => NULL() 810 REAL(KIND=dp), POINTER :: Diag(:) => NULL() 811 LOGICAL, POINTER :: Active(:) => NULL() 812 REAL(KIND=dp) :: SlaveScale = 1.0_dp 813 REAL(KIND=dp) :: MasterScale = 1.0_dp 814 LOGICAL :: LumpedDiag = .TRUE. 815 END TYPE MortarBC_t 816 817!------------------------------------------------------------------------------ 818 819! TYPE Constants_t 820! REAL(KIND=dp) :: Gravity(4) 821! REAL(KIND=dp) :: StefanBoltzmann 822! END TYPE Constants_t 823 824!------------------------------------------------------------------------------ 825 826 TYPE Solver_t 827 INTEGER :: SolverId = 0 828 TYPE(ValueList_t), POINTER :: Values => NULL() 829 830 INTEGER :: TimeOrder,DoneTime,Order,NOFEigenValues=0 831 INTEGER :: TimesVisited = 0 832 INTEGER(KIND=AddrInt) :: PROCEDURE, LinBeforeProc, LinAfterProc 833 834 REAL(KIND=dp) :: Alpha,Beta,dt 835 836 LOGICAL :: NewtonActive = .FALSE. 837 LOGICAL :: PeriodicFlipActive = .FALSE. 838 839 INTEGER :: SolverExecWhen 840 INTEGER :: SolverMode 841 842 INTEGER :: MultiGridLevel, MultiGridTotal, MultiGridSweep 843 LOGICAL :: MultiGridSolver, MultiGridEqualSplit 844 TYPE(Mesh_t), POINTER :: Mesh => NULL() 845 INTEGER :: MeshTag = 1 846 LOGICAL :: MeshChanged = .FALSE. 847 848 INTEGER, POINTER :: ActiveElements(:) => NULL() 849 INTEGER, POINTER :: InvActiveElements(:) => NULL() 850 INTEGER :: NumberOfActiveElements 851 INTEGER, ALLOCATABLE :: Def_Dofs(:,:,:) 852 853 TYPE(BlockMatrix_t), POINTER :: BlockMatrix => NULL() 854 TYPE(Matrix_t), POINTER :: Matrix => NULL() 855 TYPE(Variable_t), POINTER :: Variable => NULL() 856 857 TYPE(Matrix_t), POINTER :: ConstraintMatrix => NULL() 858 TYPE(MortarBC_t), POINTER :: MortarBCs(:) => NULL() 859 LOGICAL :: MortarBCsChanged = .FALSE., ConstraintMatrixVisited = .FALSE. 860 INTEGER(KIND=AddrInt) :: BoundaryElementProcedure=0, BulkElementProcedure=0 861 862 TYPE(Graph_t), POINTER :: ColourIndexList => NULL(), BoundaryColourIndexList => NULL() 863 INTEGER :: CurrentColour = 0, CurrentBoundaryColour = 0 864 INTEGER :: DirectMethod = DIRECT_NORMAL 865 LOGICAL :: GlobalBubbles = .FALSE., DG = .FALSE. 866 TYPE(C_PTR) :: CWrap = C_NULL_PTR 867 TYPE(IntegrationPointsTable_t), POINTER :: IPTable => NULL() 868 END TYPE Solver_t 869 870!------------------------------------------------------------------------------ 871 872 873!-------------------Circuit stuff---------------------------------------------- 874 TYPE CircuitVariable_t 875 LOGICAL :: isIvar, isVvar 876 INTEGER :: BodyId, valueId, ImValueId, dofs, pdofs, Owner, ComponentId 877 TYPE(Component_t), POINTER :: Component => Null() 878 REAL(KIND=dp), ALLOCATABLE :: A(:), B(:) 879 REAL(KIND=dp), ALLOCATABLE :: SourceRe(:), SourceIm(:), Mre(:), Mim(:) 880 INTEGER, ALLOCATABLE :: EqVarIds(:) 881 END TYPE CircuitVariable_t 882 883 TYPE Component_t 884 REAL(KIND=dp) :: Inductance=0._dp, Resistance=0._dp, Conductance = 0._dp, ElArea, & 885 N_j, coilthickness, i_multiplier_re, i_multiplier_im, nofturns, & 886 VoltageFactor=1._dp 887 INTEGER :: polord, nofcnts, BodyId, ComponentId 888 INTEGER, POINTER :: ElBoundaries(:) => Null() 889 INTEGER, POINTER :: BodyIds(:) => Null() 890 CHARACTER(LEN=MAX_NAME_LEN) :: CoilType 891 TYPE(CircuitVariable_t), POINTER :: ivar, vvar 892 LOGICAL :: UseCoilResistance = .FALSE. 893 END TYPE Component_t 894 895!-------------------Circuit stuff---------------------------------------------- 896 TYPE Circuit_t 897 REAL(KIND=dp), ALLOCATABLE :: A(:,:), B(:,:), Mre(:,:), Mim(:,:), Area(:) 898 INTEGER, ALLOCATABLE :: ComponentIds(:), Perm(:) 899 LOGICAL :: UsePerm = .FALSE., Harmonic 900 INTEGER :: n, m, n_comp,CvarDofs 901 CHARACTER(LEN=MAX_NAME_LEN), ALLOCATABLE :: names(:), source(:) 902 TYPE(Component_t), POINTER :: Components(:) 903 TYPE(CircuitVariable_t), POINTER :: CircuitVariables(:) 904 END TYPE Circuit_t 905!-------------------Circuit stuff---------------------------------------------- 906 907!------------------------------------------------------------------------------ 908 TYPE Model_t 909!------------------------------------------------------------------------------ 910! 911! Coordinate system dimension + type 912! 913 INTEGER :: DIMENSION, CoordinateSystem 914! 915! Model dimensions 916! 917 INTEGER :: NumberOfBulkElements, & 918 NumberOfNodes, & 919 NumberOfBoundaryElements 920! 921! Simulation input data, that concern the model as a whole 922! 923 TYPE(ValueList_t), POINTER :: Simulation => Null() 924! 925! Variables 926! 927 TYPE(Variable_t), POINTER :: Variables => NULL() 928 929! External control of the simulation to sweep over parameter space. 930 TYPE(ValueList_t), POINTER :: Control => Null() 931 932! Some physical constants, that will be read from the database or set by 933! other means: gravity direction/intensity and Stefan-Boltzmann constant) 934! 935 TYPE(ValueList_t), POINTER :: Constants => Null() 936! 937! Types of equations (flow,heat,...) and some parameters (for example 938! laminar or turbulent flow or type of convection model for heat equation, 939! etc.) 940! 941 INTEGER :: NumberOfEquations = 0 942 TYPE(EquationArray_t), POINTER :: Equations(:) => NULL() 943! 944! Active electrical components 945! 946 INTEGER :: NumberOfComponents = 0 947 TYPE(ComponentArray_t), POINTER :: Components(:) => NULL() 948! 949! Active bodyforces: (bussinesq approx., heatsource, freele chosen 950! bodyforce...) 951! 952 INTEGER :: NumberOfBodyForces = 0 953 TYPE(BodyForceArray_t), POINTER :: BodyForces(:) => NULL() 954! 955! Initial conditions for field variables 956! 957 INTEGER :: NumberOfICs = 0 958 TYPE(InitialConditionArray_t), POINTER :: ICs(:) => NULL() 959! 960! Boundary conditions 961! 962 INTEGER :: NumberOfBCs = 0 963 TYPE(BoundaryConditionArray_t), POINTER :: BCs(:) => NULL() 964! 965! For free surfaces the curvatures... 966! 967 INTEGER, POINTER :: FreeSurfaceNodes(:) => NULL() 968 REAL(KIND=dp), POINTER :: BoundaryCurvatures(:) => NULL() 969! 970! Material parameters 971! 972 INTEGER :: NumberOfMaterials = 0 973 TYPE(MaterialArray_t), POINTER :: Materials(:) => NULL() 974! 975! Active bodies, every element has a pointer to a body, body has 976! material,ICs,bodyforces and equations 977! 978 INTEGER :: NumberOfBodies = 0 979 TYPE(BodyArray_t), POINTER :: Bodies(:) => NULL() 980! 981! Boundary to boundary condition mapping 982! 983 INTEGER :: NumberOfBoundaries = 0 984 INTEGER, POINTER :: BoundaryId(:) => NULL() 985 TYPE(BoundaryArray_t), POINTER :: Boundaries(:) => NULL() 986! 987! Linear equation solvers 988! 989 INTEGER :: NumberOfSolvers = 0 990 TYPE(Solver_t), POINTER :: Solvers(:) => NULL() 991! 992! Node coordinates + info for parallel computations 993! 994 TYPE(Nodes_t), POINTER :: Nodes => NULL() 995! 996! Max number of nodes in any one element in this model 997! 998 INTEGER :: MaxElementNodes = 0 999! 1000! Elements 1001! 1002 TYPE(Element_t), POINTER :: Elements(:) => NULL() 1003! 1004! For reference the current element in process 1005! 1006 TYPE(Element_t), POINTER :: CurrentElement => NULL() 1007! 1008! These are for internal use, number of potentially nonzero elements 1009! in stiffness and mass matrices (with one dof), and number of nonzero 1010! elements in rows of the matrices. 1011! 1012 INTEGER :: TotalMatrixElements = 0 1013 INTEGER, POINTER :: RowNonzeros(:) => NULL() 1014 1015 TYPE(Mesh_t), POINTER :: Meshes 1016 1017 TYPE(Mesh_t), POINTER :: Mesh => NULL() 1018 TYPE(Solver_t), POINTER :: Solver => NULL() 1019 1020 ! Circuits: 1021 INTEGER, POINTER :: n_Circuits=>Null(), Circuit_tot_n=>Null() 1022 TYPE(Matrix_t), POINTER :: CircuitMatrix => Null() 1023 TYPE(Circuit_t), POINTER :: Circuits(:) => Null() 1024 TYPE(Solver_t), POINTER :: ASolver 1025 1026 LOGICAL :: HarmonicCircuits 1027 1028 END TYPE Model_t 1029 1030 TYPE(Model_t), POINTER :: CurrentModel 1031 TYPE(Matrix_t), POINTER :: GlobalMatrix 1032 1033 INTEGER :: ELMER_COMM_WORLD = -1 1034!------------------------------------------------------------------------------ 1035END MODULE Types 1036!------------------------------------------------------------------------------ 1037!> \} 1038