Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F85010676
fracture.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Sep 26, 04:08
Size
2 KB
Mime Type
text/x-python
Expires
Sat, Sep 28, 04:08 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
21030447
Attached To
R6746 RationalROMPy
fracture.py
View Options
# Copyright (C) 2018 by the RROMPy authors
#
# This file is part of RROMPy.
#
# RROMPy is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# RROMPy is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with RROMPy. If not, see <http://www.gnu.org/licenses/>.
#
import
pytest
import
numpy
as
np
import
ufl
import
fenics
as
fen
from
membrane_fracture_engine
import
MembraneFractureEngine
as
MFE
from
membrane_fracture_nodomain_engine
import
MembraneFractureNoDomainEngine
\
as
MFEND
from
rrompy.solver.fenics
import
affine_warping
@pytest.mark.xfail
(
reason
=
"no graphical interface"
)
def
test_fracture
():
mu0
=
[
45.
**
.
5
,
.
6
]
solver2
=
MFE
(
mu0
=
mu0
,
H
=
1.
,
L
=
.
75
,
delta
=
.
05
,
n
=
20
,
verbosity
=
0
)
uh2
=
solver2
.
solve
(
mu0
)[
0
]
solver1
=
MFEND
(
mu0
=
mu0
,
H
=
1.
,
L
=
.
75
,
delta
=
.
05
,
n
=
20
,
verbosity
=
0
)
uh1
=
solver1
.
solve
(
mu0
[
0
])[
0
]
L
=
mu0
[
1
]
y
=
fen
.
SpatialCoordinate
(
solver1
.
V
.
mesh
())[
1
]
warp1
,
warpI1
=
affine_warping
(
solver1
.
V
.
mesh
(),
np
.
array
([[
1
,
0
],
[
0
,
2.
*
L
]]))
warp2
,
warpI2
=
affine_warping
(
solver1
.
V
.
mesh
(),
np
.
array
([[
1
,
0
],
[
0
,
2.
-
2.
*
L
]]))
warp
=
ufl
.
conditional
(
ufl
.
ge
(
y
,
0.
),
warp1
,
warp2
)
warpI
=
ufl
.
conditional
(
ufl
.
ge
(
y
,
0.
),
warpI1
,
warpI2
)
solver1
.
plotmesh
([
warp
,
warpI
],
show
=
False
,
figsize
=
(
7
,
7
))
solver1
.
plot
(
uh1
,
[
warp
,
warpI
],
what
=
'REAL'
,
show
=
False
)
from
matplotlib
import
pyplot
as
plt
plt
.
close
(
'all'
)
assert
np
.
isclose
(
solver1
.
norm
(
solver1
.
residual
(
mu0
[
0
],
uh1
),
dual
=
True
)[
0
],
solver2
.
norm
(
solver2
.
residual
(
mu0
,
uh2
),
dual
=
True
)[
0
],
atol
=
1e-5
)
assert
np
.
isclose
(
solver1
.
norm
(
uh1
-
uh2
),
0.
,
atol
=
1e-6
)
Event Timeline
Log In to Comment