File: drucker_prager.py

package info (click to toggle)
python-escript 5.6-10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 144,304 kB
  • sloc: python: 592,074; cpp: 136,909; ansic: 18,675; javascript: 9,411; xml: 3,384; sh: 738; makefile: 207
file content (118 lines) | stat: -rw-r--r-- 3,285 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118

##############################################################################
#
# Copyright (c) 2003-2018 by The University of Queensland
# http://www.uq.edu.au
#
# Primary Business: Queensland, Australia
# Licensed under the Apache License, version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Development until 2012 by Earth Systems Science Computational Center (ESSCC)
# Development 2012-2013 by School of Earth Sciences
# Development from 2014 by Centre for Geoscience Computing (GeoComp)
#
##############################################################################

from __future__ import division, print_function

__copyright__="""Copyright (c) 2003-2018 by The University of Queensland
http://www.uq.edu.au
Primary Business: Queensland, Australia"""
__license__="""Licensed under the Apache License, version 2.0
http://www.apache.org/licenses/LICENSE-2.0"""
__url__="https://launchpad.net/escript-finley"

# run by scons build/posix/modellib/test/python/drucker_prager.passed from check out cd.

import os
from esys.modellib.mechanics import DruckerPrager
from esys.escript.modelframe import Link,Simulation
from esys.modellib.geometry import RectangularDomain, VectorConstrainerOverBox, UpdateGeometry
from esys.modellib.input import Sequencer, InterpolateOverBox
from esys.modellib.visualization import WriteVTK

try:
   WORKDIR=os.environ['MODELLIB_WORKDIR']
except KeyError:
   WORKDIR='.'


dbg=True

dom=RectangularDomain(debug=dbg)
dom.dim=3
dom.l=[0.5,1.,1.]
dom.n=[30,6,6]
dom.order=1
dom.integrationOrder=-1


sq=Sequencer(debug=dbg)
sq.t=0
sq.t_end=0.8
sq.dt_max=100.

iob=InterpolateOverBox(debug=dbg)
iob.domain=Link(dom,"domain")
iob.value_left_bottom_front=[-1.,0.,0.]
iob.value_right_bottom_front=[0.,0.,0.]
iob.value_left_bottom_back=[-1.,0.,0.]
iob.value_right_bottom_back=[0.,0.,0.]
iob.value_left_top_front=[-1.,0.,0.]
iob.value_right_top_front=[0.,0.,0.]
iob.value_left_top_back=[-1.,0.,0.]
iob.value_right_top_back=[0.,0.,0.]

# iob.value_left_bottom_front=[-1.,0.]
# iob.value_right_bottom_front=[0.,0.]
# iob.value_left_bottom_back=[-1.,0.]
# iob.value_right_bottom_back=[0.,0.]
# iob.value_left_top_front=[-1.,0.]
# iob.value_right_top_front=[0.,0.]
# iob.value_left_top_back=[-1.,0.]
# iob.value_right_top_back=[0.,0.]

m=DruckerPrager(debug=dbg)
m.domain=Link(dom,"domain")

cv=VectorConstrainerOverBox(debug=dbg)
cv.domain=Link(dom,"domain")
cv.value=Link(iob,"out")

cv.left=[True, False, False] 
cv.right= [True, True, True]
cv.bottom= [False, False, False]
cv.top= [False, False, False]
cv.front= [False, False, False]
cv.back= [False, False, False]

m.velocity=Link(iob,"out")
m.prescribed_velocity=Link(cv,"value_of_constraint")
m.location_prescribed_velocity=Link(cv,"location_of_constraint")
m.rel_tol=0.01

m.expansion_coefficient= 0.
m.bulk_modulus=1000.
m.shear_modulus=1.
m.plastic_stress=0.
m.friction_parameter=0.
m.dilatancy_parameter=0.
m.shear_length=m.shear_modulus*0.9


ug=UpdateGeometry(debug=dbg)
ug.domain=Link(dom,"domain")
ug.displacement=Link(m,"displacement")

vis=WriteVTK(debug=dbg)
vis.t=Link(sq)
vis.data0=Link(m,"plastic_stress")
vis.data1=Link(m,"velocity")
vis.data2=Link(m,"stress")
vis.dt=0.01
vis.filename=os.path.join(WORKDIR,"temp.vtu")

s=Simulation([sq,cv,m,vis],debug=True)
s.writeXML()
s.run()