Skip to main content

Import

Import the linear solver from external file.

Interface

INTERFACE
SUBROUTINE Import(obj, hdf5, group)
CLASS(LinSolver_), INTENT(INOUT) :: obj
TYPE(HDF5File_), INTENT(INOUT) :: hdf5
CHARACTER(*), INTENT(IN) :: group
END SUBROUTINE Import
END INTERFACE

Template

The template of the file is given below

VariableData typeValueComment
engineStringNATIVE_SERIALThis variable helps us to create correct child of AbstractLinSolver class. For other children we have following values reserved : NATIVE_OMP,NATIVE_MPI,PETSC,LIS_SERIAL,LIS_OMP,LIS_MPI
solverNameStringName of the solver
preconditionOptionStringLEFT, RIGHT, LEFT_RIGHT, NONE
convergenceInStringRESIDUAL, SOLUTION
convergenceTypeStringABSOLUT, RELATIVE
relativeToRHSCharT, FIt is used when convergence Type is relative
maxIterINTMaximum number of iterations
KrylovSubspaceSizeINTThis is used when GMRES is used, you can set it to 15 to 20.
relativeToleranceREALTolerance for checking the relative convergence
absoluteToleranceREALTolerance for checking the absolute convergence

Following code explains it

Let us generate the hdf5File_ (hdf5 file) using export command as shown below.

  type( LinSolver_ ) :: obj
type( ParameterList_ ) :: param
type( hdf5File_ ) :: hdf5
integer( i4b ) :: ierr, tnodes
call display( "TESTING INITIATE AND EXPORT" )
call FPL_INIT(); call param%initiate()
call setLinSolverParam( param=param, solverName=LIS_CG,&
& preconditionOption=LEFT_PRECONDITION, convergenceIn=convergenceInRes, &
& convergenceType=relativeConvergence, maxIter=100,relativeToRHS=.TRUE., &
& KrylovSubspaceSize=20,rtol=1.0D-10,atol=1.0D-10 )
call obj%initiate(param)
call hdf5%initiate( filename="./templateLinSolver.hdf5", MODE="NEW" )
call hdf5%open()
call obj%export( hdf5, "" )
call hdf5%close(); call hdf5%Deallocate()
call obj%Deallocate()
call param%Deallocate(); call FPL_FINALIZE()

Now let us import this information as shown below.

  type( LinSolver_ ) :: obj
type( hdf5File_ ) :: hdf5
integer( i4b ) :: ierr, tnodes
call display( "TESTING IMPORT" )
call hdf5%initiate( filename="./templateLinSolver.hdf5", MODE="READ" )
call hdf5%open()
call obj%import(hdf5,"")
call obj%display("")
call hdf5%close(); call hdf5%Deallocate()
call obj%Deallocate()