-
Notifications
You must be signed in to change notification settings - Fork 1
/
laplace_fem.py
61 lines (48 loc) · 1.3 KB
/
laplace_fem.py
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
import numpy as nm
from sfepy.linalg import get_coors_in_ball
filename_mesh = 'fe_domain.mesh'
centre = nm.array([0.0, 0.0], nm.float64)
functions = {
'get_circle1' : (lambda coors, domain:
get_coors_in_ball(coors, centre, 1.0001),),
'get_circle2' : (lambda coors, domain:
get_coors_in_ball(coors, centre, 2.4999, False),),
}
regions = {
'Omega' : 'all',
'Gamma' : ('vertices of surface', 'facet'),
'Gamma1' : ('(r.Gamma -s (r.Gamma3 +s r.Gamma4))'
' *v vertices in (x < 0.9)', 'facet'),
'Gamma2' : ('r.Gamma -s (r.Gamma1 +s r.Gamma3 +s r.Gamma4)', 'facet'),
'Gamma3' : ('vertices by get_circle1', 'facet'),
'Gamma4' : ('vertices by get_circle2', 'facet'),
}
fields = {
'temperature' : ('real', 1, 'Omega', 2),
}
variables = {
'T' : ('unknown field', 'temperature', 0),
's' : ('test field', 'temperature', 'T'),
}
ebcs = {
'T1' : ('Gamma1', {'T.0' : 0.5}),
'T2' : ('Gamma2', {'T.0' : -0.5}),
}
materials = {}
integrals = {
'i' : 3,
}
equations = {
'Temperature' : """dw_laplace.i.Omega(s, T) = 0"""
}
solvers = {
'ls' : ('ls.scipy_direct', {}),
'newton' : ('nls.newton', {
'i_max' : 1,
'eps_a' : 1e-10,
}),
}
options = {
'nls' : 'newton',
'ls' : 'ls',
}