Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F60105853
helmholtz_square_bubble_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
Sat, Apr 27, 13:17
Size
1 KB
Mime Type
text/x-python
Expires
Mon, Apr 29, 13:17 (2 d)
Engine
blob
Format
Raw Data
Handle
17301664
Attached To
R6746 RationalROMPy
helmholtz_square_bubble_problem_engine.py
View Options
#!/usr/bin/python
# 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
rrompy.hfengines.fenics.helmholtz_problem_engine
import
HelmholtzProblemEngine
__all__
=
[
'HelmholtzSquareBubbleProblemEngine'
]
class
HelmholtzSquareBubbleProblemEngine
(
HelmholtzProblemEngine
):
"""
Solver for square bubble Helmholtz problems with parametric wavenumber.
- \Delta u - omega^2 * u = f in \Omega
u = 0 on \Gamma_D
with exact solution square bubble times plane wave.
"""
def
__init__
(
self
,
kappa
:
float
,
theta
:
float
,
n
:
int
):
super
()
.
__init__
(
self
)
mesh
=
fen
.
RectangleMesh
(
fen
.
Point
(
0
,
0
),
fen
.
Point
(
np
.
pi
,
np
.
pi
),
n
,
n
)
self
.
V
=
fen
.
FunctionSpace
(
mesh
,
"P"
,
3
)
import
sympy
as
sp
x
,
y
=
sp
.
symbols
(
'x[0] x[1]'
,
real
=
True
)
wex
=
16
/
np
.
pi
**
4
*
x
*
y
*
(
x
-
np
.
pi
)
*
(
y
-
np
.
pi
)
phiex
=
kappa
*
(
x
*
np
.
cos
(
theta
)
+
y
*
np
.
sin
(
theta
))
uex
=
wex
*
sp
.
exp
(
-
1.j
*
phiex
)
fex
=
-
uex
.
diff
(
x
,
2
)
-
uex
.
diff
(
y
,
2
)
-
kappa
**
2
*
uex
forcingTerm
=
[
sp
.
printing
.
ccode
(
sp
.
simplify
(
sp
.
re
(
fex
))),
sp
.
printing
.
ccode
(
sp
.
simplify
(
sp
.
im
(
fex
)))]
self
.
forcingTerm
=
[
fen
.
Expression
(
x
,
degree
=
3
)
for
x
in
forcingTerm
]
Event Timeline
Log In to Comment