๐‘—• easifemBase

July 14, 2023 ยท View on GitHub

easifemBase (or, Base) library is the low level component in easifem. It contains routines and derived types which are helpful for implementing numerical methods for solving differential equation.|

In Base library, we do not use object-oriented programming concepts and mainly use multiple dispatch approach. This approach improves the flexibility and speed of easifemBase. All user-defined datatypes are declared in the BaseType module, and all methods are exposed through BaseMethods modules. In the Base library string_class is the only exception, wherein Object-oriented paradigm has been used. Currently, easifemBase has interface with BLAS95, Lapack95, Sparsekit, Metis, PlPlot, SuperLU, ARPACK, etc.

Usage

Use association

USE easifemBase

or

USE BaseType
USE BaseMethods

System requirements

EASIFEM requires following software packages to be installed on the system.

ComponentVersionLatest tested versionComment
Gfortran>=9.012.0GNU Fortran compiler
GCC>=9.012.0GNU-compiler collection
OpenMP>= 4.5Multithread shared memory parallelisation
Curl>=7.877.87A command-line utility for transferring data from or to a remote server
Git>=2.342.34.1A version control system and command-line utility for downloading packages from GitHub
Cmake>=3.193.22.4Cross-platform family of tools designed to build, test and package software
Ninja-build>=1.101.11.0Build system
Python3>=3.73.11.0Scripting language
Pip>=2023.1.0Command line tool for downloading python packages
LAPACK>=3.11.03.11.0Linear algebra package
OpenBlas>= 0.3.200.3.30Optimize BLAS library
HDF5>=1.101.10.7High-performance data software-library and file-format
PlPlot>=5.15.05.15.0Cross-platform, scientific graphics plotting library
Boost
Gnuplot>=5.05.4Portable command-line driven graphing utility
Doxygen>=1.9.11.9.1documentation generation
GTK-4n

External packages

EASIFEM depends upon the following external packages (extpkgs) that are not shipped with the source-code.

extpkgdescriptioncommand
OpenBlasHighly optimized BLASeasifem install openblas
SuperLUDirect solution of large, sparse, nonsymmetric systems of linear equationseasifem install superlu
LISLinear interative solvereasifem install lis
METISMesh partitioning libraryeasifem install metis
SCOTCHMesh partitioning libraryeasifem install scotch
ARPACKEigensolver for sparse matriceseasifem install arpack
FFTWFast Fourier Transformeasifem install fftw
GTK-FortranFortran bindings for GTK-4 libraryeasifem install gtk-fortran
LAPACK95Fortran 95 interface for Lapack libraryeasifem install lapack95
SparsekitFortran library for sparse matriceseasifem install sparsekit
GmshFinite element mesh generatoreasifem install gmsh

Installation

You can use following instructions to install easifemBase depending upon your system.

Structure

The Base library consists two components:

  1. BaseType BaseType.F90, which contains the user-defined data-type. You can see the list of user-defined data type here
  2. BaseMethods BaseMethods.F90, contains the modules (each module defines the routines for data-types defined in BaseType.F90.) The list of modules defined in BaseMethods can be found here

The source directory is shown in figure given below. The source directory has two directories

  1. ๐Ÿ“ modules
  2. ๐Ÿ“ submodules

The modules directory mainly contains header and interface of methods. The implementation is given in submodules directory.

:::info Both BaseType.F90 and BaseMethods.F90 are included in modules directory. :::

Let us understand the structure of the Base library by an example of CSRSparsity_ data type.

  1. First, we define CSRSparsity_ in BaseType.F90 as
TYPE :: CSRSparsity_
  INTEGER(I4B) :: nnz = 0
  INTEGER(I4B) :: ncol = 0
  INTEGER(I4B) :: nrow = 0
  LOGICAL(LGT) :: isSorted = .FALSE.
  LOGICAL(LGT) :: isInitiated = .FALSE.
  LOGICAL(LGT) :: isSparsityLock = .FALSE.
  LOGICAL(LGT) :: isDiagStored = .FALSE.
  INTEGER(I4B), ALLOCATABLE :: IA(:)
  INTEGER(I4B), ALLOCATABLE :: JA(:)
  INTEGER(I4B), ALLOCATABLE :: idiag(:)
  TYPE(IntVector_), ALLOCATABLE :: row(:)
  TYPE(DOF_) :: idof
  !! DOF for row
  TYPE(DOF_) :: jdof
  !! DOF for columns
END TYPE CSRSparsity_
  1. Then we create a directory called CSRSparsity in both modules and submodules directory.
  2. In modules/CSRSparsity we create CSRSparsity_Method.F90 file.
  3. In modules/CSRSparsity/CSRSparsity_Method.F90 we define a module CSRSparsity_Method (same name as file).
  4. In CSRSparsity_Method module, we only define interface of methods. In this way, this file can be considered as header file. See, the example given below:
  5. In submodules/CSRSparsity, we create CSRSparsity_Method@ConstructorMethods.F90, which contains the contruction related routines.
  6. Also, we create CSRSparsity_Method@IOMethods.F90, which include methods related to input and output.
MODULE CSRSparsity_Method
USE GlobalData
USE BaseType
IMPLICIT NONE
PRIVATE

INTERFACE Initiate
  MODULE SUBROUTINE csr_initiate1(obj, ncol, nrow, idof, jdof)
    TYPE(CSRSparsity_), INTENT(INOUT) :: obj
    INTEGER(I4B), INTENT(IN) :: ncol, nrow
    TYPE(DOF_), OPTIONAL, INTENT(IN) :: idof
    !! DOF for row
    TYPE(DOF_), OPTIONAL, INTENT(IN) :: jdof
    !! DOF for column
  END SUBROUTINE csr_initiate1
END INTERFACE Initiate

INTERFACE Display
  MODULE SUBROUTINE csr_Display(obj, Msg, UnitNo)
    TYPE(CSRSparsity_), INTENT(IN) :: obj
    CHARACTER(*), INTENT(IN) :: Msg
    INTEGER(I4B), OPTIONAL, INTENT(IN) :: UnitNo
  END SUBROUTINE csr_Display
END INTERFACE Display

END MODULE CSRSparsity_Method

CSRSparsity_Method@ConstructorMethods.F90

SUBMODULE(CSRSparsity_Method) ConstructorMethods
USE BaseMethod
IMPLICIT NONE
CONTAINS

MODULE PROCEDURE csr_initiate1
obj%nnz = 0
obj%ncol = ncol
obj%nrow = nrow
END PROCEDURE csr_initiate1

END SUBMODULE ConstructorMethods

CSRSparsity_Method@IOMethods.F90

SUBMODULE(CSRSparsity_Method) IOMethods
USE BaseMethod
IMPLICIT NONE
CONTAINS

MODULE PROCEDURE csr_Display
CALL Display(Msg, unitNo=unitNo)
CALL Display(obj%nnz, "# NNZ : ", unitNo=unitNo)
END PROCEDURE csr_Display

END SUBMODULE IOMethods

Run on Cloud

Coming soon.

Contributing

Credits

License

License