Page MenuHomec4science

HelmholtzSolver.py
No OneTemporary

File Metadata

Created
Tue, Nov 26, 05:17

HelmholtzSolver.py

import numpy as np
from rrompy.hfengines.fenics import HelmholtzSquareBubbleProblemEngine as HSBPE
from rrompy.hfengines.fenics import HelmholtzSquareTransmissionProblemEngine as HSTPE
from rrompy.hfengines.fenics import HelmholtzBoxScatteringProblemEngine as HBSPE
from rrompy.hsengines.fenics import HSEngine as HS
testNo = 3
if testNo == 1:
solver = HSBPE(kappa = 12 ** .5, theta = np.pi / 3, n = 40)
uh = solver.solve(12. + 0.j)
plotter = HS(solver.V)
plotter.plotmesh(save = True)
print(plotter.norm(uh))
plotter.plot(uh, save = True)
###########
elif testNo == 2:
solver = HSTPE(nT = 1, nB = 2, theta = np.pi * 20 / 180,
kappa = 4., n = 50)
uh = solver.solve(16.)
plotter = HS(solver.V)
print(plotter.norm(uh))
plotter.plot(uh)
###########
elif testNo == 3:
solver = HBSPE(R = 5, kappa = 12**.5, theta = - np.pi * 60 / 180, n = 30)
plotter = HS(solver.V)
uinc = - solver.liftDirichletData()
uh = solver.solve(12**.5)
plotter.plotmesh()
print(plotter.norm(uh, 12**.5))
print(plotter.norm(uh + uinc, 12**.5))
plotter.plot(uh)
plotter.plot(uh + uinc, name = 'u_tot')

Event Timeline