Page MenuHomec4science

helmholtz_elasticity.py
No OneTemporary

File Metadata

Created
Mon, Nov 4, 11:37

helmholtz_elasticity.py

# 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 numpy as np
from rrompy.hfengines.vector_linear_problem import (
LinearElasticityHelmholtzProblemEngine,
LinearElasticityHelmholtzProblemEngineDamped,
LinearElasticityHelmholtzArchwayFrequency)
from rod_3d import rod3Dsolver
def test_helmholtz_elastic_arch():
solver = LinearElasticityHelmholtzArchwayFrequency(kappa = 10, n = 30,
rho_ = 1e4, T = 1e5, lambda_ = 4e6, mu_ = 7e5,
R = 2e1, r = 1.5e1, verbosity = 0)
mu = 10
uh = solver.solve(mu)
assert np.isclose(solver.norm(uh), 3188.9960782143194)
assert np.isclose(solver.norm(solver.residual(uh, mu)), 3.025504915e-05)
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)
assert np.isclose(solver.norm(uh), 0.17847395043115702)
assert np.isclose(solver.norm(solver.residual(uh, 10)), 7.030048088e-08)
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)
assert np.isclose(solver.norm(uh), 0.17657773579415595)
assert np.isclose(solver.norm(solver.residual(uh, 10)), 6.802444e-08)

Event Timeline