Skip to content
Snippets Groups Projects
Commit 68f9db98 authored by Van Dung NGUYEN's avatar Van Dung NGUYEN
Browse files

add pertubqation test tests

parent 9d1d6b9d
No related branches found
No related tags found
No related merge requests found
......@@ -71,25 +71,33 @@ nstepArch=1 # Number of step between 2 archiving (used only if soltype=1)
dim =2
beta1 = 150;
fdg=0
fdg=1
nfield1 = 11
macrodomain1 = hoDGDomain(11,nfield1,0,matnum,fdg,dim)
macrodomain1.stabilityParameters(beta1)
macrodomain1.distributeOnRootRank(0)
macrodomain1.matrixByPerturbation(1,1,1,1e-8)
nfield2 = 12
macrodomain2 = hoDGDomain(12,nfield2,0,matnum,fdg,dim)
macrodomain2.stabilityParameters(beta1)
macrodomain2.distributeOnRootRank(0)
macrodomain2.matrixByPerturbation(1,1,1,1e-8)
nfield3 = 13
macrodomain3 = hoDGDomain(13,nfield3,0,matnum,fdg,dim)
macrodomain3.stabilityParameters(beta1)
macrodomain3.distributeOnRootRank(0)
macrodomain3.matrixByPerturbation(1,1,1,1e-8)
interdomain1 = hoDGInterDomain(14,macrodomain1,macrodomain2)
interdomain1.stabilityParameters(beta1)
interdomain1.matrixByPerturbation(1,1e-8)
interdomain2 = hoDGInterDomain(15,macrodomain1,macrodomain3)
interdomain1.stabilityParameters(beta1)
interdomain2.stabilityParameters(beta1)
interdomain2.matrixByPerturbation(1,1e-8)
# creation of Solver
mysolver = nonLinearMechSolver(1000)
......@@ -116,8 +124,8 @@ mysolver.displacementBC("Face",12,0,0.0)
mysolver.displacementBC("Face",13,0,0.0)
mysolver.displacementBC("Face",13,1,0.5)
mysolver.periodicBC("Edge",1,3,1,4,0)
mysolver.periodicBC("Edge",1,3,1,4,1)
#mysolver.periodicBC("Edge",1,3,1,4,0)
#mysolver.periodicBC("Edge",1,3,1,4,1)
# archivage
mysolver.internalPointBuildView("Green-Lagrange_xx",IPField.STRAIN_XX, 1, 1);
......
$MeshFormat
4.1 0 8
$EndMeshFormat
$Entities
4 4 3 0
1 0 0 0 1 1
2 5 0 0 1 2
3 5 0.3 0 1 3
4 0 0.3 0 1 4
1 0 0 0 0 0 0 1 1 0
2 0 0 0 0 0 0 1 2 0
3 0 0 0 0 0 0 1 3 0
4 0 0 0 0 0 0 1 4 0
11 0 0 0 0 0 0 1 11 0
15 0 0 0 0 0 0 1 13 0
19 0 0 0 0 0 0 1 12 0
$EndEntities
$PartitionedEntities
4
0
10 13 6 0
5 0 1 1 2 0 0 0 1 1
6 0 2 1 3 5 0 0 1 2
7 0 3 1 3 5 0.3 0 1 3
8 0 4 1 2 0 0.3 0 1 4
9 1 3 2 1 2 1.052631578947368 0.3 0 0
10 1 3 2 1 4 2.368421052631577 0.3 0 0
11 1 3 2 3 4 3.94736842105263 0.3 0 0
12 1 1 2 1 2 1.052631578945627 0 0 0
13 1 1 2 1 4 2.368421052627578 0 0 0
14 1 1 2 3 4 3.947368421051032 0 0 0
5 1 1 1 2 0 0 0 1.052631578945627 0 0 1 1 2 5 -12
6 1 1 1 1 1.052631578945627 0 0 2.368421052627578 0 0 1 1 2 12 -13
7 1 1 1 4 2.368421052627578 0 0 3.947368421051032 0 0 1 1 2 13 -14
8 1 1 1 3 3.947368421051032 0 0 5 0 0 1 1 2 14 -6
9 1 2 1 3 5 0 0 5 0.3 0 1 2 2 6 -7
10 1 3 1 3 3.94736842105263 0.3 0 5 0.3 0 1 3 2 7 -11
11 1 3 1 4 2.368421052631577 0.3 0 3.94736842105263 0.3 0 1 3 2 11 -10
12 1 3 1 1 1.052631578947368 0.3 0 2.368421052631577 0.3 0 1 3 2 10 -9
13 1 3 1 2 0 0.3 0 1.052631578947368 0.3 0 1 3 2 9 -8
14 1 4 1 2 0 0 0 0 0.3 0 1 4 2 8 -5
15 2 11 2 1 2 1.052631578945627 0 0 1.052631578947368 0.3 0 0 2 9 -12
16 2 11 2 1 4 2.368421052627578 0 0 2.368421052631577 0.3 0 0 2 13 -10
17 2 11 2 3 4 3.947368421051032 0 0 3.94736842105263 0.3 0 0 2 11 -14
20 2 11 1 2 0 0 0 1.052631578947368 0.3 0 1 11 4 5 13 14 -15
21 2 11 1 1 1.052631578945627 0 0 2.368421052631577 0.3 0 1 11 4 6 12 15 16
22 2 11 1 4 2.368421052627578 0 0 3.94736842105263 0.3 0 1 11 4 7 11 -16 -17
23 2 11 1 3 3.947368421051032 0 0 5 0.3 0 1 11 4 8 9 10 17
24 2 15 1 3 5 0 0 6 0.3 0 1 13 1 9
25 2 19 1 2 -1 0 0 0 0.3 0 1 12 1 14
$EndPartitionedEntities
$Nodes
29 129 1 129
0 5 0 1
1
0 0 0
0 6 0 1
2
5 0 0
0 7 0 1
3
5 0.3 0
0 8 0 1
4
0 0.3 0
0 9 0 1
57
1.052631578947368 0.3 0
0 10 0 1
52
2.368421052631577 0.3 0
0 11 0 1
46
3.94736842105263 0.3 0
0 12 0 1
8
1.052631578945627 0 0
0 13 0 1
13
2.368421052627578 0 0
0 14 0 1
19
3.947368421051032 0 0
1 5 0 7
5
23
6
24
7
25
26
0.2631578947366048 0 0
0.1315789473683247 0 0
0.5263157894732602 0 0
0.3947368421049207 0 0
0.7894736842095533 0 0
0.6578947368414817 0 0
0.9210526315776059 0 0
1 6 0 9
9
27
10
28
11
29
12
30
31
1.3157894736817 0 0
1.184210526313661 0 0
1.578947368417774 0 0
1.447368421049804 0 0
1.842105263153847 0 0
1.710526315785808 0 0
2.105263157890336 0 0
1.973684210522066 0 0
2.236842105258925 0 0
1 7 0 11
14
32
15
33
16
34
17
35
18
36
37
2.631578947364821 0 0
2.49999999999573 0 0
2.894736842102063 0 0
2.763157894733419 0 0
3.157894736839305 0 0
3.026315789470684 0 0
3.421052631576547 0 0
3.289473684207914 0 0
3.684210526313789 0 0
3.552631578945193 0 0
3.815789473682342 0 0
1 8 0 7
20
38
21
39
22
40
41
4.210526315788274 0 0
4.07894736841972 0 0
4.473684210525516 0 0
4.342105263156888 0 0
4.736842105262758 0 0
4.605263157893852 0 0
4.868421052631485 0 0
1 9 0 1
42
5 0.1499999999996522 0
1 10 0 7
43
61
44
62
45
63
64
4.736842105263158 0.3 0
4.868421052631579 0.3 0
4.473684210526315 0.3 0
4.605263157894695 0.3 0
4.210526315789473 0.3 0
4.342105263157816 0.3 0
4.078947368421024 0.3 0
1 11 0 11
47
65
48
66
49
67
50
68
51
69
70
3.684210526315787 0.3 0
3.81578947368423 0.3 0
3.421052631578945 0.3 0
3.552631578947585 0.3 0
3.157894736842103 0.3 0
3.28947368421053 0.3 0
2.894736842105261 0.3 0
3.026315789473684 0.3 0
2.631578947368419 0.3 0
2.763157894736886 0.3 0
2.500000000000441 0.3 0
1 12 0 9
53
71
54
72
55
73
56
74
75
2.105263157894735 0.3 0
2.236842105263046 0.3 0
1.842105263157894 0.3 0
1.973684210526332 0.3 0
1.578947368421052 0.3 0
1.710526315789394 0.3 0
1.31578947368421 0.3 0
1.447368421052609 0.3 0
1.184210526315798 0.3 0
1 13 0 7
58
76
59
77
60
78
79
0.7894736842105257 0.3 0
0.9210526315790037 0.3 0
0.5263157894736841 0.3 0
0.6578947368419064 0.3 0
0.2631578947368425 0.3 0
0.3947368421052024 0.3 0
0.1315789473684728 0.3 0
1 14 0 1
80
0 0.1500000000002887 0
1 15 0 1
87
1.052631578946497 0.15 0
1 16 0 1
97
2.368421052629578 0.15 0
1 17 0 1
109
3.947368421051831 0.15 0
2 20 0 7
81
82
83
84
85
86
88
0.2631578947367236 0.15 0
0.1315789473683987 0.1500000000001444 0
0.5263157894734721 0.15 0
0.3947368421050615 0.15 0
0.7894736842100395 0.15 0
0.6578947368416941 0.15 0
0.9210526315783047 0.15 0
2 21 0 9
89
90
91
92
93
94
95
96
98
1.315789473682955 0.15 0
1.18421052631473 0.15 0
1.578947368419413 0.15 0
1.447368421051206 0.15 0
1.842105263155871 0.15 0
1.710526315787601 0.15 0
2.105263157892536 0.15 0
1.973684210524199 0.15 0
2.236842105260985 0.15 0
2 22 0 11
99
100
101
102
103
104
105
106
107
108
110
2.63157894736662 0.15 0
2.499999999998085 0.15 0
2.894736842103662 0.15 0
2.763157894735152 0.15 0
3.157894736840704 0.15 0
3.026315789472184 0.15 0
3.421052631577746 0.15 0
3.289473684209222 0.15 0
3.684210526314788 0.15 0
3.552631578946389 0.15 0
3.815789473683286 0.15 0
2 23 0 7
111
112
113
114
115
116
117
4.210526315788873 0.15 0
4.078947368420373 0.15 0
4.473684210525915 0.15 0
4.342105263157352 0.15 0
4.736842105262958 0.15 0
4.605263157894274 0.15 0
4.868421052631531 0.1499999999998261 0
2 24 0 6
119
118
122
120
121
123
6 0.3 0
6 0 0
5.499999999996719 0.3 0
6 0.1499999999996522 0
5.499999999996719 0 0
5.499999999996719 0.1499999999996522 0
2 25 0 6
125
124
128
126
127
129
-1 0 0
-1 0.3 0
-0.4999999999986718 0 0
-1 0.1500000000002887 0
-0.4999999999986718 0.3 0
-0.4999999999986717 0.1500000000002887 0
$EndNodes
$Elements
20 65 1 65
0 5 15 1
1 1
0 6 15 1
2 2
0 7 15 1
3 3
0 8 15 1
4 4
1 5 8 4
5 1 5 23
6 5 6 24
7 6 7 25
8 7 8 26
1 6 8 5
9 8 9 27
10 9 10 28
11 10 11 29
12 11 12 30
13 12 13 31
1 7 8 6
14 13 14 32
15 14 15 33
16 15 16 34
17 16 17 35
18 17 18 36
19 18 19 37
1 8 8 4
20 19 20 38
21 20 21 39
22 21 22 40
23 22 2 41
1 9 8 1
24 2 3 42
1 10 8 4
25 3 43 61
26 43 44 62
27 44 45 63
28 45 46 64
1 11 8 6
29 46 47 65
30 47 48 66
31 48 49 67
32 49 50 68
33 50 51 69
34 51 52 70
1 12 8 5
35 52 53 71
36 53 54 72
37 54 55 73
38 55 56 74
39 56 57 75
1 13 8 4
40 57 58 76
41 58 59 77
42 59 60 78
43 60 4 79
1 14 8 1
44 4 1 80
2 20 10 4
45 1 5 60 4 23 81 79 80 82
46 5 6 59 60 24 83 78 81 84
47 6 7 58 59 25 85 77 83 86
48 7 8 57 58 26 87 76 85 88
2 21 10 5
49 8 9 56 57 27 89 75 87 90
50 9 10 55 56 28 91 74 89 92
51 10 11 54 55 29 93 73 91 94
52 11 12 53 54 30 95 72 93 96
53 12 13 52 53 31 97 71 95 98
2 22 10 6
54 13 14 51 52 32 99 70 97 100
55 14 15 50 51 33 101 69 99 102
56 15 16 49 50 34 103 68 101 104
57 16 17 48 49 35 105 67 103 106
58 17 18 47 48 36 107 66 105 108
59 18 19 46 47 37 109 65 107 110
2 23 10 4
60 19 20 45 46 38 111 64 109 112
61 20 21 44 45 39 113 63 111 114
62 21 22 43 44 40 115 62 113 116
63 22 2 3 43 41 42 61 115 117
2 24 10 1
64 2 3 119 118 42 122 120 121 123
2 25 10 1
65 4 1 125 124 80 128 126 127 129
$EndElements
#coding-Utf-8-*-
from gmshpy import *
from dG3Dpy import*
#script to launch PBC problem with a python script
#DEFINE MICRO PROBLEM
# micro-material law
lawnum = 11 # unique number of law
K = 76.E3 # Bulk mudulus
mu =26.E3 # Shear mudulus
rho = 2700. # Bulk mass
sy0 = 200
h = 0.5*sy0
E = 9.*K*mu/(3.*K+mu)
nu= (3.*K -2.*mu)/2./(3.*K+mu)
# micro-geometry
micromeshfile="micro.msh" # name of mesh file
# creation of material law
law1 = dG3DLinearElasticMaterialLaw(lawnum,rho,E,nu)
# creation of micro part Domain
nfield = 11 # number of the field (physical number of entity)
dim =2
myfield1 = dG3DDomain(10,nfield,0,lawnum,0,dim)
microBC = nonLinearPeriodicBC(10,2)
microBC.setOrder(2)
microBC.setBCPhysical(1,2,3,4)
# periodiodic BC
method = 0 # Periodic mesh = 0 Langrange interpolation = 1 Cubic spline interpolation =2
degree = 5
addvertex = 0
microBC.setPeriodicBCOptions(method, degree,bool(addvertex))
# DEFINE MACROPROBLEM
matnum = 1;
macromat = hoDGMultiscaleMaterialLaw(matnum, 1000)
macromat.addViewMicroSolver(45,0)
macromat.addViewMicroSolver(55,0)
baseSolver1 = macromat.getMicroSolver()
baseSolver1.loadModel(micromeshfile);
baseSolver1.addDomain(myfield1)
baseSolver1.addMaterialLaw(law1);
baseSolver1.addMicroBC(microBC)
#baseSolver1.snlData(1,1,1e-6,1e-10)
#baseSolver1.setSystemType(1)
#baseSolver1.Solver(2)
#baseSolver1.Scheme(1)
baseSolver1.displacementBC("Face",11,2,0.) # fix out-of-plan displacement
macromeshfile="shearlayer4Parts.msh" # name of mesh file
# solver
sol = 2 # Gmm=0 (default) Taucs=1 PETsc=2
soltype =1 # StaticLinear=0 (default) StaticNonLinear=1
nstep = 1 # number of step (used only if soltype=1)
ftime =1. # Final time (used only if soltype=1)
tol=1.e-6 # relative tolerance for NR scheme (used only if soltype=1)
nstepArch=1 # Number of step between 2 archiving (used only if soltype=1)
# creation of macro part Domain
dim =2
beta1 = 150;
fdg=1
nfield1 = 11
macrodomain1 = hoDGDomain(11,nfield1,0,matnum,fdg,dim)
macrodomain1.stabilityParameters(beta1)
macrodomain1.matrixByPerturbation(1,1,1,1e-8)
nfield2 = 12
macrodomain2 = hoDGDomain(12,nfield2,0,matnum,fdg,dim)
macrodomain2.stabilityParameters(beta1)
macrodomain2.matrixByPerturbation(1,1,1,1e-8)
nfield3 = 13
macrodomain3 = hoDGDomain(13,nfield3,0,matnum,fdg,dim)
macrodomain3.stabilityParameters(beta1)
macrodomain3.matrixByPerturbation(1,1,1,1e-8)
interdomain1 = hoDGInterDomain(14,macrodomain1,macrodomain2)
interdomain1.stabilityParameters(beta1)
interdomain1.matrixByPerturbation(1,1e-8)
interdomain2 = hoDGInterDomain(15,macrodomain1,macrodomain3)
interdomain2.stabilityParameters(beta1)
interdomain2.matrixByPerturbation(1,1e-8)
# creation of Solver
mysolver = nonLinearMechSolver(1000)
mysolver.loadModel(macromeshfile)
mysolver.addDomain(macrodomain1)
mysolver.addDomain(macrodomain2)
mysolver.addDomain(macrodomain3)
mysolver.addDomain(interdomain1)
mysolver.addDomain(interdomain2)
mysolver.addMaterialLaw(macromat)
mysolver.setMultiscaleFlag(bool(1))
mysolver.Scheme(soltype)
mysolver.Solver(sol)
mysolver.snlData(nstep,ftime,tol)
# boundary condition
mysolver.displacementBC("Face",11,2,0.0)
mysolver.displacementBC("Face",12,2,0.0)
mysolver.displacementBC("Face",13,2,0.0)
mysolver.displacementBC("Face",12,1,0.0)
mysolver.displacementBC("Face",12,0,0.0)
mysolver.displacementBC("Face",13,0,0.0)
mysolver.displacementBC("Face",13,1,0.5)
#mysolver.periodicBC("Edge",1,3,1,4,0)
#mysolver.periodicBC("Edge",1,3,1,4,1)
# archivage
mysolver.internalPointBuildView("Green-Lagrange_xx",IPField.STRAIN_XX, 1, 1);
mysolver.internalPointBuildView("Green-Lagrange_yy",IPField.STRAIN_YY, 1, 1);
mysolver.internalPointBuildView("Green-Lagrange_zz",IPField.STRAIN_ZZ, 1, 1);
mysolver.internalPointBuildView("Green-Lagrange_xy",IPField.STRAIN_XY, 1, 1);
mysolver.internalPointBuildView("Green-Lagrange_yz",IPField.STRAIN_YZ, 1, 1);
mysolver.internalPointBuildView("Green-Lagrange_xz",IPField.STRAIN_XZ, 1, 1);
mysolver.internalPointBuildView("sig_xx",IPField.SIG_XX, 1, 1);
mysolver.internalPointBuildView("sig_yy",IPField.SIG_YY, 1, 1);
mysolver.internalPointBuildView("sig_zz",IPField.SIG_ZZ, 1, 1);
mysolver.internalPointBuildView("sig_xy",IPField.SIG_XY, 1, 1);
mysolver.internalPointBuildView("sig_yz",IPField.SIG_YZ, 1, 1);
mysolver.internalPointBuildView("sig_xz",IPField.SIG_XZ, 1, 1);
mysolver.internalPointBuildView("sig_VM",IPField.SVM, 1, 1);
mysolver.internalPointBuildView("Green-Lagrange equivalent strain",IPField.GL_EQUIVALENT_STRAIN, 1, 1);
mysolver.internalPointBuildView("Equivalent plastic strain",IPField.PLASTICSTRAIN, 1, 1);
mysolver.archivingForceOnPhysicalGroup("Edge",2,0)
mysolver.archivingForceOnPhysicalGroup("Edge",2,1)
# solve
mysolver.solve()
#test check
check = TestCheck()
check.equal(9.673969e+02,mysolver.getArchivedForceOnPhysicalGroup("Edge",2,1),1.e-5)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment