Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F82719138
helmholtz_cavity_scattering_problem_engine.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
Fri, Sep 13, 01:43
Size
2 KB
Mime Type
text/x-python
Expires
Sun, Sep 15, 01:43 (2 d)
Engine
blob
Format
Raw Data
Handle
20739606
Attached To
R6746 RationalROMPy
helmholtz_cavity_scattering_problem_engine.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
numpy
as
np
import
fenics
as
fen
from
.scattering_problem_engine
import
ScatteringProblemEngine
__all__
=
[
'HelmholtzCavityScatteringProblemEngine'
]
class
HelmholtzCavityScatteringProblemEngine
(
ScatteringProblemEngine
):
"""
Solver for scattering problem inside a cavity with parametric wavenumber.
- \Delta u - omega^2 * n^2 * u = 0 in \Omega
u = 0 on \Gamma_D
\partial_nu - i k u = 0 on \Gamma_R
with exact solution a transmitted plane wave.
"""
def
__init__
(
self
,
kappa
:
float
,
n
:
int
,
gamma
:
float
=
0.
,
signR
:
int
=
-
1
,
degree_threshold
:
int
=
np
.
inf
,
verbosity
:
int
=
10
,
timestamp
:
bool
=
True
):
super
()
.
__init__
(
degree_threshold
=
degree_threshold
,
verbosity
=
verbosity
,
timestamp
=
timestamp
)
self
.
signR
=
signR
self
.
omega
=
kappa
pi
=
np
.
pi
mesh
=
fen
.
RectangleMesh
(
fen
.
Point
(
0
,
0
),
fen
.
Point
(
pi
,
pi
),
n
,
n
)
self
.
V
=
fen
.
FunctionSpace
(
mesh
,
"P"
,
3
)
self
.
RobinBoundary
=
(
lambda
x
,
on_boundary
:
on_boundary
and
np
.
isclose
(
x
[
1
],
np
.
pi
))
self
.
DirichletBoundary
=
"REST"
x
,
y
=
fen
.
SpatialCoordinate
(
mesh
)[:]
C
=
4.
/
pi
**
4.
bR
=
C
*
(
2
*
(
x
*
(
pi
-
x
)
+
y
*
(
2
*
pi
-
y
))
+
(
kappa
*
gamma
)
**
2.
*
x
*
(
pi
-
x
)
*
y
*
(
2
*
pi
-
y
))
bI
=
C
*
signR
*
2
*
kappa
*
(
gamma
*
(
pi
-
2
*
x
)
*
y
*
(
pi
-
y
)
+
2
*
x
*
(
pi
-
x
)
*
(
pi
-
y
))
wR
=
fen
.
cos
(
kappa
*
signR
*
(
gamma
*
x
+
y
))
wI
=
fen
.
sin
(
kappa
*
signR
*
(
gamma
*
x
+
y
))
self
.
forcingTerm
=
[
bR
*
wR
+
bI
*
wI
,
bI
*
wR
-
bR
*
wI
]
Event Timeline
Log In to Comment