Skip to main content

ConvectiveMatrix example 5

!!! note "" This example shows how to USE the SUBROUTINE called ConvectiveMatrix to create a convective matrix in space domain of Line3 element, that is order 2 [[ReferenceLine_]].

Here, we want to do the following.

M(I,J)=∫ΩNIckβˆ‚NJβˆ‚xkdΞ©M(I,J) = \int_{\Omega} N^I c_k \frac{\partial N^J}{\partial x_k} d{\Omega} M(I,J)=βˆ‚uiI∫Ωckβˆ‚NIβˆ‚xkNJdΞ©M(I,J) = \partial u_{iI} \int_{\Omega} c_k \frac{\partial N^I}{\partial x_k} N^J d{\Omega}

!!! warning "" cc is convective velocity, which can be a constant, or a function of spatial coordinates, or some nonlinear function.

In this example, convective matrix is formed for

  • [[ReferenceLine_]] element
  • [[QuadraturePoint_]] GaussLegendre
  • velocity is given by quadrature values

Modules and classes​

Usage​

PROGRAM main
USE easifemBase
IMPLICIT NONE
TYPE(Elemshapedata_) :: test, elemsdForsimplex
TYPE(Quadraturepoint_) :: quad
TYPE(FEVariable_) :: cvar
REAL(DFP), PARAMETER :: c(1,2) = RESHAPE([1.0,1.0],[1,2])
TYPE(Referenceline_) :: simplexElem, refElem
REAL(DFP), ALLOCATABLE :: mat(:, :), XiJ(:, :)
INTEGER( I4B ), PARAMETER :: order = 2

!!! note "" Let us now create the physical coordinate of the line element.

    XiJ = RESHAPE([-1, 1], [1, 2])

!!! note "" Now we create an instance of [[ReferenceLine_]].

    simplexElem = referenceline(nsd=1)
CALL simplexElem%LagrangeElement(order=order, highOrderObj=refelem)

!!! note "" Here, we create the quadrature points.

    CALL initiate( obj=quad, refelem=simplexElem, order=2*order-1, &
& quadratureType='GaussLegendre' )

!!! note "" Initiate an instance of [[ElemshapeData_]]. You can learn more about it from [[ElemshapeData_test]].

    CALL initiate(obj=elemsdForsimplex, &
& quad=quad, &
& refelem=simplexElem, &
& ContinuityType=typeH1, &
& InterpolType=typeLagrangeInterpolation)

!!! note "" Initiate an instance of [[ElemeshapeData_]].

    CALL initiate(obj=test, &
& quad=quad, &
& refelem=refElem, &
& ContinuityType=typeH1, &
& InterpolType=typeLagrangeInterpolation)
CALL Set(obj=test, val=xij, N=elemsdForSimplex%N, &
& dNdXi=elemsdForSimplex%dNdXi)

!!! note "" Let us now create an instance of [[FEVariable_]] to wrape the nodal values of cc. You can learn more about this at [[FEVariable_test]]

    cvar = QuadratureVariable(c, typeFEVariableVector, typeFEVariableSpace)

!!! note "" Let us now create the convective matrix.

    mat=ConvectiveMatrix(test=test, trial=test, term1=1, term2=0, c=cvar)
CALL Display(mat, "mat:")

??? example "Results"

            mat:
-------------------------------
-0.500000 0.166667 -0.666667
-0.166667 0.500000 0.666667
0.666667 -0.666667 0.000000

!!! settings "Cleanup"

END PROGRAM main