Add Pyr5 elements, including med support and tests

This commit is contained in:
Andreas Dörfler
2017-05-27 23:53:33 +02:00
parent b95e03d49f
commit 35e60b9983
17 changed files with 490 additions and 7 deletions
Binary file not shown.
Binary file not shown.
+73
View File
@@ -0,0 +1,73 @@
# -*- coding: utf-8 -*-
###
### This file is generated automatically by SALOME v7.8.0 with dump python functionality
###
import sys
import salome
salome.salome_init()
theStudy = salome.myStudy
import salome_notebook
notebook = salome_notebook.NoteBook(theStudy)
###
### GEOM component
###
import GEOM
from salome.geom import geomBuilder
import math
import SALOMEDS
geompy = geomBuilder.New(theStudy)
O = geompy.MakeVertex(0, 0, 0)
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
geompy.addToStudy( OZ, 'OZ' )
###
### SMESH component
###
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(theStudy)
Pyr5 = smesh.Mesh()
coords = [
[-1.0,-1.0,-1.0], # N1
[ 1.0,-1.0,-1.0], # N2
[ 1.0, 1.0,-1.0], # N3
[-1.0, 1.0,-1.0], # N4
[ 0.0, 0.0, 1.0]] # N5
for c in coords:
Pyr5.AddNode( *c )
volID = Pyr5.AddVolume( [ 1, 4, 3, 2, 5 ] ) # http://docs.salome-platform.org/latest/gui/SMESH/connectivity_page.html
Pyr5_1 = Pyr5.CreateEmptyGroup( SMESH.VOLUME, 'Pyr5' )
nbAdd = Pyr5_1.AddFrom( Pyr5.GetMesh() )
nbAdded, Pyr5, _NoneGroup = Pyr5.MakeBoundaryElements( SMESH.BND_2DFROM3D, '', '', 0, [])
baseQuad = Pyr5.CreateEmptyGroup( SMESH.FACE, 'baseQuad' )
nbAdd = baseQuad.Add( [ 2 ] )
tipPoint = Pyr5.CreateEmptyGroup( SMESH.NODE, 'tipPoint' )
nbAdd = tipPoint.Add( [ 5 ] )
## Set names of Mesh objects
smesh.SetName(baseQuad, 'baseQuad')
smesh.SetName(Pyr5.GetMesh(), 'Pyr5')
smesh.SetName(Pyr5_1, 'Pyr5')
smesh.SetName(tipPoint, 'tipPoint')
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(1)
+1
View File
@@ -58,6 +58,7 @@ export Poi1,
Tri3, Tri6, Tri7,
Quad4, Quad8, Quad9,
Tet4, Tet10,
Pyr5,
Wedge6,
Hex8, Hex20, Hex27
+38 -1
View File
@@ -13,6 +13,7 @@ global const ELEMENT_DESCRIPTIONS = Dict(
"Quad9" => "9 node quadratic quadrangle element",
"Tet4" => "4 node linear tetrahedral element",
"Tet10" => "10 node quadratic tetrahedral element",
"Pyr5" => "5 node linear pyramid element",
"Wedge6" => "6 node linear prismatic element (wedge)",
"Wedge15" => "15 node quadratic prismatic element (wedge)",
"Hex8" => "8 node linear hexahedral element",
@@ -31,6 +32,7 @@ global const ELEMENT_SIZES = Dict(
"Quad9" => (2, 9),
"Tet4" => (3, 4),
"Tet10" => (3, 10),
"Pyr5" => (3,5),
"Wedge6" => (3, 6),
"Wedge15" => (3, 15),
"Hex8" => (3, 8),
@@ -355,6 +357,39 @@ end
#
type Pyr5 <: AbstractElement
end
function get_reference_coordinates(::Type{Pyr5})
Vector{Float64}[
[-1.0,-1.0,-1.0], # N1
[ 1.0,-1.0,-1.0], # N2
[ 1.0, 1.0,-1.0], # N3
[-1.0, 1.0,-1.0], # N4
[ 0.0, 0.0, 1.0]] # N5
end
function get_interpolation_polynomial(::Type{Pyr5}, xi)
[
1.0/8.0*(1.0-1.0*xi[1])*(1.0-1.0*xi[2])*(1.0-1.0*xi[3])
1.0/8.0*(1.0+1.0*xi[1])*(1.0-1.0*xi[2])*(1.0-1.0*xi[3])
1.0/8.0*(1.0+1.0*xi[1])*(1.0+1.0*xi[2])*(1.0-1.0*xi[3])
1.0/8.0*(1.0-1.0*xi[1])*(1.0+1.0*xi[2])*(1.0-1.0*xi[3])
1.0/2.0*(1.0+xi[3])
]'
end
function get_interpolation_polynomial(::Type{Pyr5}, xi, ::Type{Val{:partial_derivatives}})
[
-0.125*(1.0-xi[2])*(1.0-xi[3]) 0.125*(1.0-xi[2])*(1.0-xi[3]) 0.125*(1.0+xi[2])*(1.0-xi[3]) -0.125*(1.0+xi[2])*(1.0-xi[3]) 0.0
-0.125*(1.0-xi[1])*(1.0-xi[3]) -0.125*(1.0+xi[1])*(1.0-xi[3]) 0.125*(1.0+xi[1])*(1.0-xi[3]) 0.125*(1.0-xi[1])*(1.0-xi[3]) 0.0
-0.125*(1.0-xi[1])*(1.0-xi[2]) -0.125*(1.0+xi[1])*(1.0-xi[2]) -0.125*(1.0+xi[1])*(1.0+xi[2]) -0.125*(1.0-xi[1])*(1.0+xi[2]) 0.5
]
end
#
type Wedge6 <: AbstractElement
end
@@ -576,6 +611,7 @@ end
@create_basis Quad9
@create_basis Tet4
@create_basis Tet10
@create_basis Pyr5
@create_basis Wedge6
@create_basis Wedge15
@create_basis Hex8
@@ -583,7 +619,8 @@ end
@create_basis Hex27
function inside(::Union{Type{Seg2}, Type{Seg3}, Type{Quad4}, Type{Quad8},
Type{Quad9}, Type{Hex8}, Type{Hex20}, Type{Hex27}}, xi)
Type{Quad9}, Type{Pyr5}, Type{Hex8}, Type{Hex20},
Type{Hex27}}, xi)
return all(-1.0 .<= xi .<= 1.0)
end
+23 -2
View File
@@ -271,6 +271,27 @@ function get_integration_points(element::TetrahedralElement, ::Type{Val{4}})
return zip(weights, points)
end
# http://www.colorado.edu/engineering/CAS/courses.d/AFEM.d/AFEM.Ch12.d/AFEM.Ch12.pdf
typealias PyramidalElement Union{Pyr5,}
function get_integration_points(element::PyramidalElement, ::Type{Val{2}})
g1 = 0.5842373946721771876874344
g2 = -2.0/3.0
g3 = 2.0/5.0
w1 = 81.0/100.0
w2 = 125.0/27.0
weights = [w1, w1, w1, w1, w2]
points = Vector{Float64}[
[-g1, -g1, g2],
[ g1, -g1, g2],
[ g1, g1, g2],
[-g1, g1, g2],
[0.0, 0.0, g3],
]
return zip(weights, points)
end
typealias PrismaticElement Union{Wedge6, Wedge15}
function get_integration_points(element::PrismaticElement, ::Type{Val{2}})
@@ -408,14 +429,14 @@ function get_integration_points(element::PrismaticElement, ::Type{Val{3}})
end
function get_integration_points(element::Union{TriangularElement,
TetrahedralElement, PrismaticElement}, order::Int64)
TetrahedralElement, PyramidalElement, PrismaticElement}, order::Int64)
return get_integration_points(element, Val{order})
end
### default number of integration points for each element
### 2 for linear elements, 3 for quadratic
typealias LinearElement Union{Seg2, Tri3, Quad4, Tet4, Wedge6, Hex8}
typealias LinearElement Union{Seg2, Tri3, Quad4, Tet4, Pyr5, Wedge6, Hex8}
typealias QuadraticElement Union{Seg3, Tri6, Tri7, Tet10, Quad8, Quad9, Wedge15, Hex20, Hex27}
+3 -2
View File
@@ -176,6 +176,7 @@ end
global const med_connectivity = Dict{Symbol, Vector{Int}}(
:Tet4 => [4,3,1,2],
:Tet10 => [4,3,1,2,10,7,8,9,6,5],
:Pyr5 => [1,4,3,2,5],
:Wedge6 => [4,5,6,1,2,3],
:Hex8 => [4,8,7,3,1,5,6,2],
:Hex20 => [4,8,7,3,1,5,6,2,20,15,19,11,12,16,14,10,17,13,18,9],
@@ -209,8 +210,8 @@ global const mapping = Dict(
:H20 => :Hex20,
:H27 => :Hex27,
:PY5 => :Pyramid5,
:P13 => :Pyramid13,
:PY5 => :Pyr5,
:P13 => :Pyr13,
)
+1 -1
View File
@@ -69,7 +69,7 @@ end
typealias Elasticity2DSurfaceElements Union{Poi1, Seg2, Seg3}
typealias Elasticity2DVolumeElements Union{Tri3, Tri6, Quad4, Quad8, Quad9}
typealias Elasticity3DSurfaceElements Union{Poi1, Tri3, Tri6, Quad4, Quad8, Quad9}
typealias Elasticity3DVolumeElements Union{Tet4, Wedge6, Wedge15, Hex8, Tet10, Hex20, Hex27}
typealias Elasticity3DVolumeElements Union{Tet4, Pyr5, Wedge6, Wedge15, Hex8, Tet10, Hex20, Hex27}
function initialize_internal_params!(params, ip, type_) #::Type{Val{:type_2d}})
param_keys = keys(params)
+1 -1
View File
@@ -67,7 +67,7 @@ function assemble!{E}(assembly::Assembly, problem::Problem{Heat}, element::Eleme
info("Unknown element type $E for 3d heat problem!")
end
typealias Heat3DVolumeElements Union{Tet4, Tet10, Hex8, Hex20, Hex27}
typealias Heat3DVolumeElements Union{Tet4, Tet10, Pyr5, Hex8, Hex20, Hex27}
typealias Heat3DSurfaceElements Union{Tri3, Tri6, Quad4, Quad8, Quad9}
function assemble!{E<:Heat3DVolumeElements}(assembly::Assembly, problem::Problem{Heat}, element::Element{E}, time, ::Type{Val{Symbol("3D")}})
@@ -0,0 +1,46 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
using JuliaFEM
using JuliaFEM.Preprocess
using JuliaFEM.Testing
@testset "test Pyr5 elasticity with point load" begin
fn = Pkg.dir("JuliaFEM") * "/geometry/3d_pyr/Pyr5.med"
mesh = aster_read_mesh(fn)
element_sets = join(keys(mesh.element_sets), ", ")
info("element sets: $element_sets")
element1 = create_elements(mesh,"Pyr5")
baseQuad = create_elements(mesh,"baseQuad")
tipPoint = Element(Poi1, collect(mesh.node_sets[:tipPoint]))
update!([element1,baseQuad,tipPoint], "geometry", mesh.nodes)
update!([element1], "youngs modulus", 288.0)
update!([element1], "poissons ratio", 1/3)
update!([tipPoint], "displacement traction force 1", 5.0)
update!([tipPoint], "displacement traction force 2", -7.0)
update!([tipPoint], "displacement traction force 3", 3.0)
elasticity_problem = Problem(Elasticity, "solve continuum block", 3)
elasticity_problem.properties.finite_strain = false
push!(elasticity_problem, element1)
push!(elasticity_problem, tipPoint)
baseQuad[1]["displacement 1"] = 0.0
baseQuad[1]["displacement 2"] = 0.0
baseQuad[1]["displacement 3"] = 0.0
boundary_problem = Problem(Dirichlet, "Boundary conditions", 3, "displacement")
push!(boundary_problem, baseQuad)
solver = LinearSolver(elasticity_problem, boundary_problem)
solver()
disp = element1[1]("displacement", [0.0, 0.0, 1.0], 0.0)
info("########################################################")
info("displacement at tip: $disp")
# Code_Aster Result in verification/2017-05-27-pyramids/Pyr5_displacement.txt
u_expected = [6.9444444444427100E-02,-9.7222222222197952E-02,1.0416666666679683E-02]
@test isapprox(disp, u_expected)
end
+47
View File
@@ -0,0 +1,47 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
using JuliaFEM
using JuliaFEM.Preprocess
using JuliaFEM.Testing
@testset "test Pyr5 elasticity with point load" begin
nodes = Dict{Int64, Node}(
1 => [-1.0,-1.0,-1.0],
2 => [ 1.0,-1.0,-1.0],
3 => [ 1.0, 1.0,-1.0],
4 => [-1.0, 1.0,-1.0],
5 => [ 0.0, 0.0, 1.0])
element1 = Element(Pyr5, [1, 2, 3, 4, 5])
baseQuad = Element(Quad4, [1, 2, 3, 4])
tipPoint = Element(Poi1, [5,])
update!([element1,baseQuad,tipPoint], "geometry", nodes)
update!([element1], "youngs modulus", 288.0)
update!([element1], "poissons ratio", 1/3)
update!([tipPoint], "displacement traction force 1", 5.0)
update!([tipPoint], "displacement traction force 2", -7.0)
update!([tipPoint], "displacement traction force 3", 3.0)
elasticity_problem = Problem(Elasticity, "solve continuum block", 3)
elasticity_problem.properties.finite_strain = false
push!(elasticity_problem, element1, baseQuad, tipPoint)
baseQuad["displacement 1"] = 0.0
baseQuad["displacement 2"] = 0.0
baseQuad["displacement 3"] = 0.0
boundary_problem = Problem(Dirichlet, "Boundary conditions", 3, "displacement")
push!(boundary_problem, baseQuad)
solver = LinearSolver(elasticity_problem, boundary_problem)
solver()
disp = element1("displacement", [0.0, 0.0, 1.0], 0.0)
info("########################################################")
info("displacement at tip: $disp")
# Code_Aster Result in verification/2017-05-27-pyramids/Pyr5_displacement.txt
u_expected = [6.9444444444427100E-02,-9.7222222222197952E-02,1.0416666666679683E-02]
@test isapprox(disp, u_expected)
end
+128
View File
@@ -0,0 +1,128 @@
etude,fich,3,FR F
opt_val,rep_dex _VIDE
etude,fich,2,type mess
etude,fich,3,UL 8
option,ORBInitRef 0
etude,fich,4,donnee 0
option,nbmaxnook 1
etude,fich,2,resultat 1
nom_fich_export Pyr5.export
option,rep_dex 0
etude,fich,4,compress 0
etude oui
debug 0
opt_val,cpresok RESNOOK
etude,fich,3,donnee 0
etude,fich,4,serv Local
serv_fich_export -1
surcharge,nbfic 0
option,rep_outils 0
etude,fich,3,resultat 1
option,cpresok 1
etude,fich,5,compress 0
etude,fich,1,serv Local
etude,fich,1,FR F
memoire 512.0
etude,fich,1,UL 20
onglet_actif etude
asquit non
etude,fich,2,donnee 0
option,classe 1
etude,fich,4,type dat
opt_val,exectool _VIDE
etude,fich,4,resultat 1
opt_val,mpi_nbcpu 1
etude,fich,1,donnee 1
rex non
etude,fich,1,nom Pyr5.med
etude,fich,1,type mmed
suivi_interactif 0
pre_eda non
etude,fich,4,FR F
option,multiple 1
opt_val,only_nook _VIDE
etude,fich,3,nom Pyr5.resu
etude,fich,4,UL 29
option,mpi_nbcpu 1
serv_tests -1
etude,fich,5,nom Pyr5.rmed
make_etude run
option,depart 1
option,only_nook 1
opt_val,ORBInitRef _VIDE
nom_profil Pyr5.astk
args _VIDE
etude,fich,5,resultat 1
etude,fich,0,donnee 1
etude,fich,3,serv Local
etude,fich,0,compress 0
option,corefilesize 1
opt_val,distrib _VIDE
asdeno non
serv_surcharge -1
serv_sources -1
surcharge non
etude,fich,0,serv Local
M_1 oui
option,distrib 1
serv_etude -1
asdenot non
M_2 non
etude,fich,2,FR F
opt_val,rep_outils _VIDE
M_3 non
etude,fich,2,UL 6
consult non
M_4 non
asno non
etude,fich,1,compress 0
etude,fich,3,type resu
opt_val,ncpus 1
serveur pde
opt_val,classe _VIDE
opt_val,dbgjeveux _VIDE
option,ncpus 1
etude,fich,0,type comm
opt_val,facmtps 1
args_fixe _VIDE
etude,fich,0,resultat 0
opt_val,rep_mat _VIDE
special _VIDE
tests,nbfic 0
temps 600
option,dbgjeveux 0
etude,fich,5,FR F
etude,fich,5,serv Local
asrest non
batch 0
etude,fich,2,compress 0
etude,fich,5,UL 80
option,facmtps 1
serv_profil -1
etude,fich,0,FR F
opt_val,multiple _VIDE
opt_val,after_job _VIDE
option,rep_mat 0
etude,fich,0,UL 1
etude,fich,0,nom Pyr5.comm
etude,fich,2,serv Local
option,exectool 1
asverif non
etude,fich,2,nom Pyr5.mess
option,after_job 1
opt_val,depart _VIDE
opt_val,mpi_nbnoeud 1
etude,fich,1,resultat 0
sources,nbfic 0
etude,fich,5,donnee 0
etude,fich,4,nom Pyr5_displacement.txt
tests non
noeud pde
etude,fich,3,compress 0
etude,fich,5,type rmed
option,mpi_nbnoeud 1
opt_val,corefilesize unlimited
etude,nbfic 6
agla non
opt_val,nbmaxnook 5
version testing
@@ -0,0 +1,54 @@
DEBUT();
MA=DEFI_MATERIAU(ELAS=_F(E=288.0,
NU=0.333333333333,),);
MAIL=LIRE_MAILLAGE(FORMAT='MED',);
MODE=AFFE_MODELE(MAILLAGE=MAIL,
AFFE=_F(TOUT='OUI',
PHENOMENE='MECANIQUE',
MODELISATION='3D',),);
MATE=AFFE_MATERIAU(MAILLAGE=MAIL,
AFFE=_F(TOUT='OUI',
MATER=MA,),);
CHAR=AFFE_CHAR_MECA(MODELE=MODE,
DDL_IMPO=_F(GROUP_MA='baseQuad',
DX=0.0,
DY=0.0,
DZ=0.0,),
FORCE_NODALE=_F(GROUP_NO='tipPoint',
FX=5.0,
FY=-7.0,
FZ=3.0,),);
RESU=MECA_STATIQUE(MODELE=MODE,
CHAM_MATER=MATE,
EXCIT=_F(CHARGE=CHAR,),);
RESU=CALC_CHAMP(reuse =RESU,
RESULTAT=RESU,
CONTRAINTE=('SIGM_ELNO','SIGM_NOEU',),
CRITERES=('SIEQ_ELNO','SIEQ_NOEU',),);
TABLE1=CREA_TABLE(RESU=_F(RESULTAT=RESU,
NOM_CHAM='DEPL',
NOM_CMP=('DX','DY','DZ',),
GROUP_NO='tipPoint',),);
IMPR_TABLE(TABLE=TABLE1,
UNITE=29,
FORMAT_R='E16.16',
NOM_PARA=('DX','DY','DZ',),
TITRE='Displacement of Node 5',);
IMPR_RESU(FORMAT='MED',
UNITE=80,
RESU=_F(RESULTAT=RESU,
NOM_CHAM=('SIGM_NOEU','SIEQ_NOEU','DEPL',),),);
FIN();
#CHECKSUM:6d5681cc411c12890d7eabc8a131b2cc -:FIN CHECKSUM
Binary file not shown.
@@ -0,0 +1,67 @@
-- CODE_ASTER -- VERSION : DÉVELOPPEMENT STABILISÉE (testing) --
Version 13.3.0 modifiée le 14/12/2016
révision b98333a86d46 - branche 'default'
Copyright EDF R&D 1991 - 2017
Exécution du : Sat May 27 22:56:41 2017
Nom de la machine : pde
Architecture : 64bit
Type de processeur : x86_64
Système d'exploitation : Linux Ubuntu 16.10 yakkety 4.8.0-52-generic
Langue des messages : de (UTF-8)
Version de Python : 2.7.12
Version de NumPy : 1.11.1rc1
Parallélisme MPI : inactif
Parallélisme OpenMP : actif
Nombre de processus utilisés : 1
Version de la librairie HDF5 : 1.8.14
Version de la librairie MED : 3.2.0
Version de la librairie MFront : 2.0.3
Version de la librairie MUMPS : 5.0.2
Librairie PETSc : non disponible
Version de la librairie SCOTCH : 6.0.4
Mémoire limite pour l'exécution : 512.00 Mo
consommée par l'initialisation : 365.28 Mo
par les objets du jeu de commandes : 0.25 Mo
reste pour l'allocation dynamique : 146.47 Mo
Taille limite des fichiers d'échange : 12.00 Go
<I> <FIN> FERMETURE DE LA BASE "GLOBALE" EFFECTUEE.
<FIN> Arrêt normal dans "FIN".
<I> <FIN> ARRET NORMAL DANS "FIN" PAR APPEL A "JEFINI".
<I> <FIN> MEMOIRE JEVEUX MINIMALE REQUISE POUR L'EXECUTION : 34.01 Mo
<I> <FIN> MEMOIRE JEVEUX OPTIMALE REQUISE POUR L'EXECUTION : 44.62 Mo
<I> <FIN> MAXIMUM DE MEMOIRE UTILISEE PAR LE PROCESSUS LORS DE L'EXECUTION : 442.53 Mo
********************************************************************************
* COMMAND : USER : SYSTEM : USER+SYS : ELAPSED *
********************************************************************************
* init (jdc) : 0.18 : 0.01 : 0.19 : 0.19 *
* . compile : 0.00 : 0.00 : 0.00 : 0.00 *
* . exec_compile : 0.03 : 0.00 : 0.03 : 0.03 *
* . report : 0.00 : 0.00 : 0.00 : 0.00 *
* . build : 0.00 : 0.00 : 0.00 : 0.00 *
* DEBUT : 0.00 : 0.03 : 0.03 : 0.03 *
* DEFI_MATERIAU : 0.00 : 0.00 : 0.00 : 0.00 *
* LIRE_MAILLAGE : 0.01 : 0.00 : 0.01 : 0.00 *
* AFFE_MODELE : 0.00 : 0.00 : 0.00 : 0.01 *
* AFFE_MATERIAU : 0.01 : 0.00 : 0.01 : 0.00 *
* AFFE_CHAR_MECA : 0.00 : 0.00 : 0.00 : 0.01 *
* MECA_STATIQUE : 0.01 : 0.00 : 0.01 : 0.01 *
* CALC_CHAMP : 0.01 : 0.00 : 0.01 : 0.01 *
* CREA_TABLE : 0.00 : 0.00 : 0.00 : 0.00 *
* IMPR_TABLE : 0.02 : 0.00 : 0.02 : 0.02 *
* IMPR_RESU : 0.01 : 0.00 : 0.01 : 0.01 *
* FIN : 0.02 : 0.01 : 0.03 : 0.03 *
* . part Superviseur : 0.23 : 0.04 : 0.27 : 0.26 *
* . part Fortran : 0.05 : 0.01 : 0.06 : 0.06 *
********************************************************************************
* TOTAL_JOB : 0.28 : 0.05 : 0.33 : 0.33 *
********************************************************************************
Binary file not shown.
@@ -0,0 +1,8 @@
#
#--------------------------------------------------------------------------------
##Displacement of Node 5
#ASTER 13.03.00 CONCEPT TABLE1 CALCULE LE 27/05/2017 A 22:56:41 DE TYPE
#TABLE_SDASTER
DX DY DZ
6.9444444444427100E-02 -9.7222222222197952E-02 1.0416666666679683E-02