Skip to main content

ConvectiveMatrix example 21

!!! note "" This example shows how to use the subroutine called ConvectiveMatrix to create a convective matrix in space domain.

Here, we want to do the following.

M(I,J)=∫ΩNIβˆ‚NJβˆ‚xdΞ©M(I,J) = \int_{\Omega} N^I \frac{\partial N^J}{\partial x} d{\Omega} M(I,J)=βˆ«Ξ©βˆ‚NIβˆ‚xNJdΞ©M(I,J) = \int_{\Omega} \frac{\partial N^I}{\partial x} N^J d{\Omega} M(I,J)=∫ΩNIβˆ‚NJβˆ‚ydΞ©M(I,J) = \int_{\Omega} N^I \frac{\partial N^J}{\partial y} d{\Omega} M(I,J)=βˆ«Ξ©βˆ‚NIβˆ‚yNJdΞ©M(I,J) = \int_{\Omega} \frac{\partial N^I}{\partial y} N^J d{\Omega} M(I,J)=∫ΩNIβˆ‚NJβˆ‚zdΞ©M(I,J) = \int_{\Omega} N^I \frac{\partial N^J}{\partial z} d{\Omega} M(I,J)=βˆ«Ξ©βˆ‚NIβˆ‚zNJdΞ©M(I,J) = \int_{\Omega} \frac{\partial N^I}{\partial z} N^J d{\Omega}

In this example, convective matrix is formed for

  • [[ReferenceLine_]] element
  • [[QuadraturePoint_]] GaussLegendre

Modules and classes​

Usage​

PROGRAM main
USE easifemBase
IMPLICIT NONE
TYPE(elemshapedata_) :: test, trial
TYPE(quadraturepoint_) :: quad
TYPE(referenceline_) :: refelem
REAL(DFP), ALLOCATABLE :: mat(:, :)
REAL(DFP), ALLOCATABLE :: XiJ(:, :)
integer( I4B ), parameter :: order = 1, dim=1

!!! 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_]].

    refelem = referenceline(nsd=1)

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

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

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

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

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

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

??? example "Results"

        mat:
--------------------
-0.500000 -0.500000
0.500000 0.500000

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

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

??? example "Results"

        mat:
-------------------
-0.500000 0.500000
-0.500000 0.500000

!!! settings "Cleanup"

END PROGRAM main