Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92938977
helmholtz_elasticity.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
Sun, Nov 24, 23:53
Size
2 KB
Mime Type
text/x-python
Expires
Tue, Nov 26, 23:53 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22541342
Attached To
R6746 RationalROMPy
helmholtz_elasticity.py
View Options
# Copyright (C) 2018-2020 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
numpy
as
np
from
rrompy.hfengines.fenics_engines
import
(
LinearElasticityHelmholtzProblemEngine
,
LinearElasticityHelmholtzProblemEngineDamped
)
from
rod_3d
import
rod3Dsolver
def
test_helmholtz_elastic_rod
():
solverBase
=
rod3Dsolver
()
solver
=
LinearElasticityHelmholtzProblemEngine
()
solver
.
V
=
solverBase
.
V
solver
.
lambda_
=
solverBase
.
lambda_
solver
.
mu_
=
solverBase
.
mu_
solver
.
forcingTerm
=
solverBase
.
forcingTerm
solver
.
DirichletBoundary
=
solverBase
.
DirichletBoundary
solver
.
NeumannBoundary
=
solverBase
.
NeumannBoundary
mu
=
10
uh
=
solver
.
solve
(
mu
)[
0
]
assert
np
.
isclose
(
solver
.
norm
(
uh
),
0.17836028624665373
,
rtol
=
1e-5
)
assert
np
.
isclose
(
solver
.
norm
(
solver
.
residual
(
mu
,
uh
)[
0
],
dual
=
True
),
8.070977e-07
,
rtol
=
1e-1
)
def
test_helmholtz_elastic_rod_damped
():
solverBase
=
rod3Dsolver
()
solver
=
LinearElasticityHelmholtzProblemEngineDamped
()
solver
.
V
=
solverBase
.
V
solver
.
lambda_
=
solverBase
.
lambda_
solver
.
mu_
=
solverBase
.
mu_
solver
.
forcingTerm
=
solverBase
.
forcingTerm
solver
.
DirichletBoundary
=
solverBase
.
DirichletBoundary
solver
.
NeumannBoundary
=
solverBase
.
NeumannBoundary
solver
.
eta
=
10
mu
=
10
uh
=
solver
.
solve
(
mu
)[
0
]
assert
np
.
isclose
(
solver
.
norm
(
uh
),
0.17646530119044376
,
rtol
=
1e-2
)
assert
np
.
isclose
(
solver
.
norm
(
solver
.
residual
(
10
,
uh
)[
0
],
dual
=
True
),
6.7057338e-07
,
rtol
=
1e-1
)
Event Timeline
Log In to Comment