Skip to main content

Initiate

This routine initiates the kernel.

! - Here `param` contains all the necessary components for initiating the
! state of the kernel.
! - Here `dom` is an instance of [[Domain_]], and it acts as a target of
! the kernel's domain pointer [[SteadyStokes111_:DomForPressure]]
! and [[SteadyStokes111_:DomForVelocity]].
! - `domains` is a one dimensional array of [[DomainPointer_]]
! - The size of domains should be 2
! - `domains(1)` acts as target for
! [[SteadyStokes111_:DomForVelocity]].
! - `domains(2)` acts as a target for [[SteadyStokes111_:DomForPressure]]
!
!@note
! In `param` one should have the options for initiating the instance of
! [[LinearSolver_]] of the kernel [[SteadyStokes111_]]. To this end
! user can call [[LinearSolver_Class:SetLinSolverParam]].
!@endnote
!
!@note
! No additional, memory is allocated for it. In this way, several kernels
! can work on a common domains
!@endnote
!
!## Tasks
!
! This subroutine performs the following tasks
!
! - Check if obj is initiated or not
! - Sets target to pointer of domain [[SteadyStokes111_:DomForPressure]]
! - Sets target to pointer of domain [[SteadyStokes111_:DomForVelocity]]
! - Sets [[SteadyStokes111_:isCommonDomain]], true if `dom` is present,
! else false.
! - sets [[SteadyStokes111_:DomainFileForPressure]] and
! [[SteadyStokes111_:DomainFileForVelocity]]
! - sets the [[Kernel_:engine]]
! - sets the [[Kernel_:name]]
! - sets the [[Kernel_:CoordinateSystem]]
! - sets the [[Kernel_:nnt]]
! - sets the [[Kernel_:nsd]]
! - sets the [[Kernel_:tDOF]]
! - sets the [[SteadyStokes111_:baseContinuityForVelocity]]
! - sets the [[SteadyStokes111_:baseInterpolationForVelocity]]
! - sets the [[SteadyStokes111_:quadratureTypeForVelocity]]
! - sets the [[SteadyStokes111_:baseContinuityForPressure]]
! - sets the [[SteadyStokes111_:baseInterpolationForPressure]]
! - sets the [[SteadyStokes111_:quadratureTypeForPressure]]
! - allocates the [[SteadyStokes111_:DBCForVelocity]]
! - allocates the [[SteadyStokes111_:DBCForPressure]]
! - sets the [[SteadyStokes111_:tFluidMaterials]]
! - allocates [[SteadyStokes111_:porousMaterial]]
! - allocates [[SteadyStokes111_:PorousMaterialToMesh]]
! - sets the [[SteadyStokes111_:tPorousMaterials]]
! - allocates [[SteadyStokes111_:fluidMaterial]]
! - allocates [[SteadyStokes111_:FluidMaterialToMesh]]

Interface

INTERFACE
MODULE SUBROUTINE SSF_Initiate(obj, param, dom, domains)
CLASS(SteadyStokes111_), INTENT(INOUT) :: obj
TYPE(ParameterList_), INTENT(IN) :: param
CLASS(Domain_), OPTIONAL, TARGET, INTENT(INOUT) :: dom
TYPE(DomainPointer_), OPTIONAL, TARGET, INTENT(INOUT) :: domains(:)
END SUBROUTINE SSF_Initiate
END INTERFACE

Example

This example shows how to set the parameters for steady stokes flow kernel. Then we initiate the kernel and display its content on the screen.

PROGRAM main
USE easifemBase
USE easifemClasses
USE easifemMaterials
USE easifemKernels
USE SteadyStokes111_Class
IMPLICIT NONE
TYPE( SteadyStokes111_ ) :: obj
TYPE( ParameterList_ ) :: param
TYPE( HDF5File_ ) :: domainFile
TYPE( Domain_ ) :: dom
INTEGER( I4B ), PARAMETER :: refPressureNode=2
REAL( DFP ), PARAMETER :: refPressure = 0.0_DFP
INTEGER( I4B ), PARAMETER :: tDirichletBCForVelocity = 2
INTEGER( I4B ), PARAMETER :: tDirichletBCForPressure = 0
INTEGER( I4B ), PARAMETER :: tFluidMaterials= 1
INTEGER( I4B ), PARAMETER :: stabParamOption= 1
LOGICAL( LGT ), PARAMETER :: isSubscalePressure = .FALSE.
LOGICAL( LGT ), PARAMETER :: isBoundarySubscale = .FALSE.
REAL( DFP ), PARAMETER :: gravity(3)=[0.0, -9.8, 0.0]
LOGICAL( LGT ), PARAMETER :: isConservativeForm = .TRUE.
CHARACTER( * ), PARAMETER :: engine="NATIVE_SERIAL"
CHARACTER( * ), PARAMETER :: domainFileName="./long_pipe_tri3.h5"
INTEGER( I4B ), PARAMETER :: CoordinateSystem = KERNEL_CARTESIAN
INTEGER( I4B ), PARAMETER :: maxIter = 100
REAL( DFP ), PARAMETER :: rtoleranceForPressure = 1.0E-6
REAL( DFP ), PARAMETER :: rtoleranceForVelocity = 1.0E-6
REAL( DFP ), PARAMETER :: atoleranceForPressure = 1.0E-6
REAL( DFP ), PARAMETER :: atoleranceForVelocity = 1.0E-6
REAL( DFP ), PARAMETER :: toleranceForSteadyState = 1.0E-6
CHARACTER(*), PARAMETER :: baseInterpolationForSpace="LagrangeInterpolation"
CHARACTER(*), PARAMETER :: baseContinuityForSpace="H1"
CHARACTER(*), PARAMETER :: quadratureTypeForSpace="GaussLegendre"
INTEGER(I4B), PARAMETER :: ls_solverName = LIS_GMRES
INTEGER(I4B), PARAMETER :: ls_preconditionOption= LEFT_PRECONDITION
INTEGER(I4B), PARAMETER :: ls_convergenceIn = convergenceInRes
INTEGER(I4B), PARAMETER :: ls_convergenceType = relativeConvergence
INTEGER( I4B ), PARAMETER :: ls_maxIter = 100
LOGICAL( LGT ), PARAMETER :: ls_relativeToRHS = .TRUE.
INTEGER( I4B ), PARAMETER :: ls_KrylovSubspaceSize=20
REAL( DFP ) , PARAMETER :: ls_rtol=1.0E-10
REAL( DFP ) , PARAMETER :: ls_atol=1.0E-10

Set parameters for kernel.

  CALL FPL_INIT(); CALL param%Initiate()

Set parameters for the kernel.

  CALL SetSteadyStokes111Param( &
& param=param, &
& isConservativeForm=isConservativeForm, &
& gravity = gravity, &
& isSubscalePressure = isSubscalePressure, &
& isBoundarySubscale = isBoundarySubscale, &
& stabParamOption = stabParamOption, &
& domainFile = domainFileName, &
& engine=engine, &
& CoordinateSystem=KERNEL_CARTESIAN, &
& maxIter =maxIter, &
& rtoleranceForPressure = rtoleranceForPressure, &
& rtoleranceForVelocity = rtoleranceForVelocity, &
& atoleranceForPressure = atoleranceForPressure, &
& atoleranceForVelocity = atoleranceForVelocity, &
& toleranceForSteadyState = toleranceForSteadyState, &
& tFluidMaterials=tFluidMaterials, &
& tDirichletBCForPressure=tDirichletBCForPressure, &
& tDirichletBCForVelocity=tDirichletBCForVelocity, &
& baseInterpolationForSpace=baseInterpolationForSpace, &
& baseContinuityForSpace=baseContinuityForSpace, &
& quadratureTypeForSpace=quadratureTypeForSpace, &
& refPressureNode=refPressureNode, &
& refPressure=refPressure &
& )

Setting parameters for linear solver.

  CALL SetLinSolverParam( &
& param=param, &
& solverName=ls_solverName,&
& preconditionOption=ls_preconditionOption, &
& convergenceIn=ls_convergenceIn, &
& convergenceType=ls_convergenceType, &
& maxIter=ls_maxIter, &
& relativeToRHS=ls_relativeToRHS, &
& KrylovSubspaceSize=ls_KrylovSubspaceSize, &
& rtol=ls_rtol, &
& atol=ls_atol )

Initiate domain by reading data from a domain file.

  CALL domainFile%Initiate( filename=domainFileName, MODE="READ" )
CALL domainFile%Open()
CALL dom%Initiate( domainFile, "" )

Initiate the kernel.

  CALL obj%Initiate(param=param, dom=dom )
CALL obj%Display("")
  CALL obj%Deallocate()
CALL dom%Deallocate()
CALL domainFile%Deallocate()
CALL param%Deallocate(); CALL FPL_FINALIZE()
END PROGRAM main