LagrangeVandermonde
This routine returns the Vandermonde matrix.
Interface
- ܀ Interface
- ️܀ See example
- ️܀ Example 2
- ️܀ Example 3
- ↢
INTERFACE
MODULE PURE FUNCTION LagrangeVandermonde(x, order, elemType) &
& RESULT(ans)
REAL(DFP), INTENT(IN) :: x(:, :)
!! points in $x_{iJ}$ format
INTEGER(I4B), INTENT(IN) :: order
!! order
INTEGER(I4B), INTENT(IN) :: elemType
!! element type
REAL(DFP), ALLOCATABLE :: ans(:, :)
!! vandermonde matrix nrows = number of points
!! ncols = number of dof
END FUNCTION LagrangeVandermonde
END INTERFACE
program main
use easifembase
implicit none
integer( i4b ) :: i1, i2, order, elemType
real(dfp), allocatable :: ans( :, : ), xij(:,:)
order=1; elemType=Line
xij = EquidistancePoint(order=order, elemType=elemType)
ans = LagrangeVandermonde(xij=xij, order=order, elemType=elemType )
call display( ans, "ans (order="//tostring(order)//")=" )
call blanklines(nol=2)
order=2; elemType=Line
xij = EquidistancePoint(order=order, elemType=elemType)
ans = LagrangeVandermonde(xij=xij, order=order, elemType=elemType )
call display( ans, "ans (order="//tostring(order)//")=" )
call blanklines(nol=2)
order=3; elemType=Line
xij = EquidistancePoint(order=order, elemType=elemType)
ans = LagrangeVandermonde(xij=xij, order=order, elemType=elemType )
call display( ans, "ans (order="//tostring(order)//")=" )
call blanklines(nol=2)
end program main
See results
results
ans (order=1)=
------------------
1.00000 -1.00000
1.00000 1.00000
ans (order=2)=
----------------------------
1.00000 -1.00000 1.00000
1.00000 1.00000 1.00000
1.00000 0.00000 0.00000
ans (order=3)=
--------------------------------------
1.00000 -1.00000 1.00000 -1.00000
1.00000 1.00000 1.00000 1.00000
1.00000 -0.33333 0.11111 -0.03704
1.00000 0.33333 0.11111 0.03704
program main
use easifembase
implicit none
integer( i4b ) :: i1, i2, order, elemType
real(dfp), allocatable :: ans( :, : ), xij(:,:)
order=1; elemType=Triangle
xij = EquidistancePoint(order=order, elemType=elemType)
ans = LagrangeVandermonde(xij=xij, order=order, elemType=elemType )
call display( ans, "ans (order="//tostring(order)//")=" )
call blanklines(nol=2)
order=2;
xij = EquidistancePoint(order=order, elemType=elemType)
ans = LagrangeVandermonde(xij=xij, order=order, elemType=elemType )
call display( ans, "ans (order="//tostring(order)//")=" )
call blanklines(nol=2)
order=3;
xij = EquidistancePoint(order=order, elemType=elemType)
ans = LagrangeVandermonde(xij=xij, order=order, elemType=elemType )
call display( ans, "ans (order="//tostring(order)//")=" )
call blanklines(nol=2)
end program main
See results
results
ans (order=1)=
-------------------------
1.00000 0.00000 0.00000
1.00000 1.00000 0.00000
1.00000 0.00000 1.00000
ans (order=2)=
----------------------------------------------------
1.00000 0.00000 0.00000 0.00000 0.00000 0.00000
1.00000 1.00000 1.00000 0.00000 0.00000 0.00000
1.00000 0.00000 0.00000 1.00000 0.00000 1.00000
1.00000 0.50000 0.25000 0.00000 0.00000 0.00000
1.00000 0.50000 0.25000 0.50000 0.25000 0.25000
1.00000 0.00000 0.00000 0.50000 0.00000 0.25000
ans (order=3)=
1.00000 0.00000 0.00000 0.00000, ..., 0.00000 0.00000 0.00000 0.00000
1.00000 1.00000 1.00000 1.00000, , 0.00000 0.00000 0.00000 0.00000
1.00000 0.00000 0.00000 0.00000, , 0.00000 1.00000 0.00000 1.00000
1.00000 0.33333 0.11111 0.03704, , 0.00000 0.00000 0.00000 0.00000
.
.
.
1.00000 0.33333 0.11111 0.03704, ..., 0.07407 0.44444 0.14815 0.29630
1.00000 0.00000 0.00000 0.00000, , 0.00000 0.44444 0.00000 0.29630
1.00000 0.00000 0.00000 0.00000, , 0.00000 0.11111 0.00000 0.03704
1.00000 0.33333 0.11111 0.03704, , 0.03704 0.11111 0.03704 0.03704
program main
use easifembase
implicit none
integer( i4b ) :: i1, i2, order, elemType
real(dfp), allocatable :: ans( :, : ), xij(:,:)
order=1; elemType=Quadrangle
xij = EquidistancePoint(order=order, elemType=elemType)
ans = LagrangeVandermonde(xij=xij, order=order, elemType=elemType )
call display( ans, "ans (order="//tostring(order)//")=" )
call blanklines(nol=2)
order=2;
xij = EquidistancePoint(order=order, elemType=elemType)
ans = LagrangeVandermonde(xij=xij, order=order, elemType=elemType )
call display( ans, "ans (order="//tostring(order)//")=" )
call blanklines(nol=2)
order=3;
xij = EquidistancePoint(order=order, elemType=elemType)
ans = LagrangeVandermonde(xij=xij, order=order, elemType=elemType )
call display( ans, "ans (order="//tostring(order)//")=" )
call blanklines(nol=2)
end program main
See results
results
ans (order=1)=
--------------------------------------
1.00000 -1.00000 -1.00000 1.00000
1.00000 1.00000 -1.00000 -1.00000
1.00000 1.00000 1.00000 1.00000
1.00000 -1.00000 1.00000 -1.00000
ans (order=2)=
1.00000 -1.00000 1.00000 -1.00000, ..., -1.00000 1.00000 -1.00000 1.00000
1.00000 1.00000 1.00000 -1.00000, , -1.00000 1.00000 1.00000 1.00000
1.00000 1.00000 1.00000 1.00000, , 1.00000 1.00000 1.00000 1.00000
1.00000 -1.00000 1.00000 1.00000, , 1.00000 1.00000 -1.00000 1.00000
.
.
.
1.00000 1.00000 1.00000 0.00000, ..., 0.00000 0.00000 0.00000 0.00000
1.00000 0.00000 0.00000 1.00000, , 0.00000 1.00000 0.00000 0.00000
1.00000 -1.00000 1.00000 0.00000, , 0.00000 0.00000 -.00000 0.00000
1.00000 0.00000 0.00000 0.00000, , 0.00000 0.00000 0.00000 0.00000
ans (order=3)=
1.00000 -1.00000 1.00000 -1.00000, ..., -1.00000 1.00000 -1.00000 1.00000
1.00000 1.00000 1.00000 1.00000, , -1.00000 -1.00000 -1.00000 -1.00000
1.00000 1.00000 1.00000 1.00000, , 1.00000 1.00000 1.00000 1.00000
1.00000 -1.00000 1.00000 -1.00000, , 1.00000 -1.00000 1.00000 -1.00000
.
.
.
1.00000 -0.33333 0.11111 -0.03704, ..., -3.70370E-2 1.23457E-2 -4.11523E-3 1.37174E-3
1.00000 0.33333 0.11111 0.03704, , -3.70370E-2 -1.23457E-2 -4.11523E-3 -1.37174E-3
1.00000 0.33333 0.11111 0.03704, , 3.70370E-2 1.23457E-2 4.11523E-3 1.37174E-3
1.00000 -0.33333 0.11111 -0.03704, , 3.70370E-2 -1.23457E-2 4.11523E-3 -1.37174E-3