InitiateCellToCellData
This routine initiates cellToCell
data (mapping) between two Domain_ or Mesh_.
- The topology of elements in both meshes should be the same, this means that if one mesh is made of triangles then other mesh should be made of triangles.
- The
xidim
of the elements in both meshes should be the same, this means that if themesh1
is surface mesh thenmesh2
should be a surface mesh. - This routine needs
nodeToNode
information, so make sure it is initiated before calling this routine.
Interface 1
- Interface
- example
- ↢ close
INTERFACE
MODULE SUBROUTINE InitiateCellToCellData(obj, domain1, domain2)
CLASS(DomainConnectivity_), INTENT(INOUT) :: obj
!! Domain connectivity object
CLASS(Domain_), INTENT(IN) :: domain1
!! Primary domain, in CellToCell(i), i denotes the
!! global element number in domain1 domain.
CLASS(Domain_), INTENT(IN) :: domain2
!! Secondary domain => CellToCell(i) denotes the
!! global element number in domain2 domain.
END SUBROUTINE InitiateCellToCellData
END INTERFACE
This subroutine generates the cell to cell connectivity between two domains.
obj%cellToCell
will be initiateddomain1
main domaindomain2
secondary domain
note
All CELL elements in domain-1 will be mapped to CELL elements in domain-2.
info
If cellToCell(iel)
is equal to zero then it means there is no element found in domain-2 corresponding to element number iel in domain-1.
note
The size of cellToCell
is the largest element number present in domain1.
TODO
Currently, lowerbound and upper bound of cellToCell is 1 and domain1%maxElemNumber. In the future, the lower bound will be domain1%minElemNumber.
Following points should be noted before calling this routine
- This routine provides map between cell elements of one domain to cell elements of another domain.
- The topology of the both elements should be the same
- There is one to one mapping between elements of domain 1 and elements of domain2
- This routine works well for two domains of same region with same/different order. For example, domain of tri3 and domain of tri6 elements.
PROGRAM main
USE GlobalData
USE Test_Method
USE Display_Method
USE HDF5File_Class
USE FEDomain_Class
USE FEDomainConnectivity_Class
USE ExceptionHandler_Class
IMPLICIT NONE
CHARACTER(*), PARAMETER :: domain1_filename = &
"../../Mesh/examples/meshdata/small_tri6_mesh.h5"
CHARACTER(*), PARAMETER :: domain2_filename = &
"../../Mesh/examples/meshdata/small_tri3_mesh.h5"
INTEGER(I4B), PARAMETER :: nsd = 2
TYPE(FEDomainConnectivity_) :: obj
TYPE(FEDomain_) :: domain2, domain1
TYPE(HDF5File_) :: domain1_file, domain2_file
INTEGER(I4B), POINTER :: cellToCell(:)
INTEGER(I4B) :: ii, iel, telems
LOGICAL(LGT) :: isok
! Open the mesh file for pressure and velocity domain
CALL e%SetQuietMode(EXCEPTION_INFORMATION, .TRUE.)
CALL domain1_file%Initiate(domain1_filename, MODE="READ")
CALL domain1_file%OPEN()
CALL domain2_file%Initiate(domain2_filename, MODE="READ")
CALL domain2_file%OPEN()
! Initiate the domain for pressure and velocity
CALL domain1%Initiate(domain1_file, "")
CALL domain2%Initiate(domain2_file, "")
CALL obj%InitiateCellToCellData(domain1=domain1, &
domain2=domain2)
cellToCell => obj%GetCellToCellPointer()
! CALL Display(celltoCell, "cellToCEll", full=.TRUE.)
telems = domain1%GetTotalElements(dim=nsd)
DO iel = 1, telems
isok = iel .LE. SIZE(cellToCell)
IF (.NOT. isok) THEN
CALL Fail("CellToCell: iel is out of bound")
RETURN
END IF
!! here i am checking if the cellToCell(iel) is present in
!! in the pressure domain or not.
!! If it is present then it should be a cell element.
ii = cellToCell(iel)
isok = ii .NE. 0
IF (.NOT. isok) THEN
CALL Fail("CellToCell: error code 1")
RETURN
END IF
isok = domain2%isElementPresent(globalElement=ii, islocal=.FALSE., dim=nsd)
IF (.NOT. isok) THEN
call Display(msg="global element = " // tostring(ii) // " is not present in domain2" )
CALL Fail("CellToCell: error code 2")
RETURN
END IF
END DO
CALL PASS("InitiateCellToCellData()")
CALL domain2_file%DEALLOCATE()
CALL domain1_file%DEALLOCATE()
CALL domain2%DEALLOCATE()
CALL domain1%DEALLOCATE()
CALL obj%DEALLOCATE()
END PROGRAM main
Interface 2
- Interface
- example
- ↢ close
INTERFACE
MODULE SUBROUTINE dc_initiateCellToCellData1(obj, domain1, domain2, &
& dim1, dim2, entityNum1, entityNum2)
CLASS(DomainConnectivity_), INTENT(INOUT) :: obj
!! Domain connectivity object,
!! [[DomainConnectivity:cellToCell]] will be initiated
CLASS(Domain_), INTENT(IN) :: domain1
!! Primary domain, in cellToCell(i), i denotes the
!! global element number in domain1 domain.
CLASS(Domain_), INTENT(IN) :: domain2
!! secondary domain, => cellToCell(i) denotes the
!! global cell number in `domain2` domain.
INTEGER(I4B), INTENT(IN) :: dim1
!! dimension of mesh in domain1
INTEGER(I4B), INTENT(IN) :: dim2
!! dimension of mesh in domain2
INTEGER(I4B), INTENT(IN) :: entityNum1
!! entity num of mesh in domain1
INTEGER(I4B), INTENT(IN) :: entityNum2
!! entity num of mesh in domain2
END SUBROUTINE dc_initiateCellToCellData1
END INTERFACE
This subroutine generates the cell to cell connectivity between two meshes.
obj%cellToCell
will be initiateddomain1
main domaindomain2
secondary domaindim1, entitynum1
dimension and entity number of mesh indomain1
dim2, entitynum2
dimension and entity number of mesh indomain2
Following points should be noted
- The topology of elements in both meshes should be the same, this means that if one mesh is triangle then other mesh should be a triangle.
- The xidim of the elements in both meshes should be the same, this means that if the mesh1 is surface mesh then mesh2 should be a surface mesh.
- This routine needs
nodeToNode
information, so make sure it is initiated before calling this routine.
PROGRAM main
USE easifemBase
USE easifemClasses
USE FEDomain_Class
USE FEDomainConnectivity_Class
IMPLICIT NONE
CHARACTER(*), PARAMETER :: velocity_filename = &
"../../Mesh/examples/meshdata/small_tri3_mesh.h5"
CHARACTER(*), PARAMETER :: pressure_filename = &
"../../Mesh/examples/meshdata/small_tri6_mesh.h5"
TYPE(FEDomainConnectivity_) :: obj
TYPE(FEDomain_) :: pressureDomain
TYPE(FEDomain_) :: velocityDomain
TYPE(HDF5File_) :: pressureMeshFile
TYPE(HDF5File_) :: velocityMeshFile
INTEGER(I4B), POINTER :: cellToCell(:)
INTEGER(I4B) :: ii, iel, a, b
LOGICAL(LGT) :: isok
! Open the mesh file for pressure and velocity domain
CALL e%SetQuietMode(EXCEPTION_INFORMATION, .TRUE.)
CALL velocityMeshFile%Initiate(velocity_filename, MODE="READ")
CALL velocityMeshFile%OPEN()
CALL pressureMeshFile%Initiate(pressure_filename, MODE="READ")
CALL pressureMeshFile%OPEN()
! Initiate the domain for pressure and velocity
CALL velocityDomain%Initiate(velocityMeshFile, "")
CALL pressureDomain%Initiate(pressureMeshFile, "")
CALL obj%InitiateCellToCellData(domain1=velocityDomain, &
& domain2=pressureDomain)
cellToCell => obj%GetCellToCellPointer()
CALL velocityDomain%GetParam(minElemNum=a, maxElemNum=b)
DO iel = a, b
IF (.NOT. velocityDomain%isElementPresent(iel)) CYCLE
!! here i am checking if the cellToCell(iel) is present in
!! in the pressure domain or not.
!! If it is present then it should be a cell element.
ii = cellToCell(iel)
isok = ii .NE. 0
IF (.NOT. isok) THEN
CALL fail("CellToCell: error code 1")
RETURN
END IF
isok = pressureDomain%isElementPresent(ii)
IF (.NOT. isok) THEN
CALL fail("CellToCell: error code 2")
RETURN
END IF
END DO
CALL PASS("InitiateCellToCellData()")
CALL pressureMeshFile%DEALLOCATE()
CALL velocityMeshFile%DEALLOCATE()
CALL pressureDomain%DEALLOCATE()
CALL velocityDomain%DEALLOCATE()
CALL obj%DEALLOCATE()
END PROGRAM main