Validation program for the assembly of the Mass matrix for -Lagrange finite element method in 3d
(see Mass Matrix). Meshes of the unit cube are used.
Test 1: Computation of the Mass Matrix using the base, OptV1 and OptV2 versions : it gives errors and computation times
Test 2: Computation of the integral
where
and
. Functions
and
are those defined in ...
Test 3: Ones retrieves the order 2 of
-Lagrange integration
Note
source code
Validation of Mass Matrix for P1-Lagrange finite elements in 3D
>>> from pyOptFEM.valid3D import validMass3DP1
>>> validMass3DP1()
*********************************************
* 3D Mass Assembling P1 validations *
*********************************************
-----------------------------------------
Test 1: Matrices errors and CPU times
-----------------------------------------
Matrix size : (216,216)
Error P1base vs OptV1 : 1.734723e-18
Error P1base vs OptV2 : 1.734723e-18
CPU times base (ref) : 0.9355 (s)
CPU times OptV1 : 0.0481 (s) - Speed Up X19.438
CPU times OptV2 : 0.0016 (s) - Speed Up X592.083
----------------------------
Test 1 (results): OK
----------------------------
-----------------------------------------------------
Test 2: Validations by integration on [0,1]x[0,1]
-----------------------------------------------------
function 0 :
u(x,y,z)=x + y + z,
v(x,y,z)=x - y - z,
-> Stiff error=3.330669e-16
function 1 :
u(x,y,z)=3*x + 2*y - z - 1,
v(x,y,z)=2*x - 2*y + 2*z + 1,
-> Stiff error=8.881784e-16
function 2 :
u(x,y,z)=3*x**2 - x*y + 2*y**2 + y*z - z**2 - 3,
v(x,y,z)=2*x**2 + x*y - 3*y**2 - x*z - y,
-> Stiff error=1.173244e-02
----------------------------
Test 2 (results): OK
----------------------------
--------------------------------
Test 3: Validations by order
--------------------------------
function 2 :
u(x,y,z)=3*x**2 - x*y + 2*y**2 + y*z - z**2 - 3,
v(x,y,z)=2*x**2 + x*y - 3*y**2 - x*z - y
Matrix size : (216,216)
MassAssemblingP1OptV2 CPU times : 0.002(s)
-> Error : 1.173244e-02
Matrix size : (1331,1331)
MassAssemblingP1OptV2 CPU times : 0.009(s)
-> Error : 2.800865e-03
...
Matrix size : (132651,132651)
MassAssemblingP1OptV2 CPU times : 1.418(s)
-> Error : 1.110034e-04
At last, this program plots the figure :
Validation function for the assembly of the Stiffness matrix for -Lagrange
finite element method in 3d (see Stiffness Matrix). Meshes of the unit cube are used.
Test 1: Computation of the Stiffness Matrix using the base, OptV1 and OptV2 versions : it gives errors and computation times
Test 2: Computation of the integral
where
and
. Functions
and
are those defined in ...
Test 3: Ones retrieves the order 2 of
-Lagrange integration
Note
source code
Validation of Stiffness Matrix for P1-Lagrange finite elements in 3D
>>> from pyOptFEM.valid3D import validStiff3DP1
>>> validStiff3DP1()
**********************************************
* 3D Stiff Assembling P1 validations *
**********************************************
-----------------------------------------
Test 1: Matrices errors and CPU times
-----------------------------------------
Matrix size : (216,216)
Error P1base vs OptV1 : 2.220446e-15
Error P1base vs OptV2 : 2.220446e-15
CPU times base (ref) : 0.9563 (s)
CPU times OptV1 : 0.0566 (s) - Speed Up X16.901
CPU times OptV2 : 0.0032 (s) - Speed Up X299.656
----------------------------
Test 1 (results): OK
----------------------------
-----------------------------------------------------
Test 2: Validations by integration on [0,1]x[0,1]
-----------------------------------------------------
function 0 :
u(x,y,z)=x + y + z,
v(x,y,z)=x - y - z,
-> Stiff error=6.217249e-15
function 1 :
u(x,y,z)=3*x + 2*y - z - 1,
v(x,y,z)=2*x - 2*y + 2*z + 1,
-> Stiff error=7.771561e-15
function 2 :
u(x,y,z)=3*x**2 - x*y + 2*y**2 + y*z - z**2 - 3,
v(x,y,z)=2*x**2 + x*y - 3*y**2 - x*z - y,
-> Stiff error=2.077333e-02
----------------------------
Test 2 (results): OK
----------------------------
--------------------------------
Test 3: Validations by order
--------------------------------
function 2 :
u(x,y,z)=3*x**2 - x*y + 2*y**2 + y*z - z**2 - 3,
v(x,y,z)=2*x**2 + x*y - 3*y**2 - x*z - y
Matrix size : (216,216)
StiffAssembling3DP1OptV2 CPU times : 0.003(s)
Error : 2.077333e-02
Matrix size : (1331,1331)
StiffAssembling3DP1OptV2 CPU times : 0.019(s)
Error : 3.330000e-03
...
Matrix size : (132651,132651)
StiffAssembling3DP1OptV2 CPU times : 2.784(s)
Error : 1.828928e-04
At last, this program plots the figure :
Validation function for the assembly of the Elastic Stiffness matrix for -Lagrange
finite element method in 3d (see Elastic Stiffness Matrix). Meshes of the unit cube are used.
Test 1: Computation of the Elastic Stiffness Matrix using the base, OptV1 and OptV2 versions : it gives errors and computation times
Test 2: Computation of the integral
where
and
. Functions
and
are those defined in ...
Test 3: Ones retrieves the order 2 of
-Lagrange integration
Note
Parameters: |
|
---|
>>> from pyOptFEM.valid3D import validStiffElas3DP1
>>> validStiffElas3DP1()
**************************************************
* 3D StiffElas Assembling P1 validations *
**************************************************
-----------------------------------------
Test 1: Matrices errors and CPU times
-----------------------------------------
Matrix size : (648,648)
Error P1base vs OptV1 : 1.554312e-15
Error P1base vs OptV2 : 1.776357e-15
CPU times base (ref) : 2.8850 (s)
CPU times OptV1 : 0.2925 (s) - Speed Up X9.862
CPU times OptV2 : 0.0152 (s) - Speed Up X189.919
----------------------------
Test 1 (results): OK
----------------------------
-----------------------------------------------------
Test 2: Validations by integration on [0,1]x[0,1]
-----------------------------------------------------
functions 0 :
u(x,y,z)=['x - 2*y', 'x + y - z', '3*x + 2*z'],
v(x,y,z)=['x + 2*y + 4*z', '2*x - y + 4*z', '3*x - 2*y'],
-> StiffElas error=5.329071e-14
functions 1 :
u(x,y,z)=['5*x - 2*y+z', 'x + y - 3*z', '3*x + -2*y+ 2*z'],
v(x,y,z)=['2*x - 2*y + 4*z +1', '5*x - y + 4*z', '4*x - 2*y+4'],
-> StiffElas error=2.131628e-14
functions 2 :
u(x,y,z)=['x**2 - 2*x*y + x*z', 'y**2 - y*z + z**2 + x', 'x**2 - x*z - y*z - z**2'],
v(x,y,z)=['x**2 + 2*y**2 - x*z', '2*x**2 - x*y + y*z', 'x*y - y*z + z**2'],
-> StiffElas error=5.712000e-02
functions 3 :
u(x,y,z)=['x**2 - 2*x*y + x*z', 'x**3 + y**2 - y*z + z**2', '-x**2*z - x*y*z + x**2 - z**2'],
v(x,y,z)=['-x*z**2 + x**2 + 2*y**2', '2*x**2 - x*y + y*z', 'x*y - y*z + z**2'],
-> StiffElas error=1.221381e-01
----------------------------
Test 2 (results): OK
----------------------------
--------------------------------
Test 3: Validations by order
--------------------------------
functions 3 :
u(x,y,z)=[x**2 - 2*x*y + x*z,x**3 + y**2 - y*z + z**2,-x**2*z - x*y*z + x**2 - z**2],
v(x,y)=[-x*z**2 + x**2 + 2*y**2,2*x**2 - x*y + y*z,x*y - y*z + z**2]
Matrix size : (3993,3993)
StiffElasAssembling3DP1OptV2 CPU times : 0.121(s)
-> Error : 3.036230e-02
Matrix size : (12288,12288)
StiffElasAssembling3DP1OptV2 CPU times : 0.422(s)
-> Error : 1.515389e-02
Matrix size : (27783,27783)
StiffElasAssembling3DP1OptV2 CPU times : 0.999(s)
-> Error : 8.314471e-03
Matrix size : (52728,52728)
StiffElasAssembling3DP1OptV2 CPU times : 2.019(s)
-> Error : 5.618296e-03
Matrix size : (89373,89373)
StiffElasAssembling3DP1OptV2 CPU times : 3.528(s)
-> Error : 3.666314e-03
Matrix size : (139968,139968)
StiffElasAssembling3DP1OptV2 CPU times : 5.668(s)
-> Error : 2.932322e-03
At last, this program plots the figure :