To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit d098288b authored by Christoph Goering's avatar Christoph Goering
Browse files

Merge branch 'bugfix/kingfactorof2' into 'developer'

Bugfix/kingfactorof2

Resolves #30

See merge request !54
parents 59a870ff 8c2903ff
Pipeline #88921 passed with stages
in 4 minutes and 20 seconds
......@@ -77,7 +77,7 @@ class ARF(BaseKing, BaseARF, BaseSphereFrequencyComposite):
# we need to have '2*self.field.A' because King defines the amplitude a
# little bit different compared to the one defined in BackgroundField
out = pi * self.rho_f * np.abs(2 * self.field.A)**2
out = pi * self.rho_f * np.abs(self.field.A)**2
out *= (self.k_f * self.R_0)**3
out *= self.Phi * sin(2 * self.k_f * self.position)
return out
......
......@@ -3,6 +3,7 @@ from tests.basetest import BaseTest
from gorkov import pi, sin
from gorkov import Gorkov1962
from gorkov import King1934
class TestGorkovARF(BaseTest):
......@@ -126,6 +127,22 @@ class TestGorkovARF(BaseTest):
self.assertAlmostEqual(self.compute_standing_arf(),
self.cls.acoustic_radiation_force())
def test_comparison_with_king(self):
c_s = 1000 * self.c_f
self.cls = Gorkov1962.ARF(self.f,
self.R0, self.rho_s, c_s,
self.rho_f, self.c_f,
'standing', self.p0, self.pos)
self.cls_King = King1934.ARF(self.f,
self.R0, self.rho_s,
self.rho_f, self.c_f,
self.p0, self.pos)
self.assertAlmostEqual(self.cls.acoustic_radiation_force(),
self.cls_King.acoustic_radiation_force(),
threshold=10e-4)
if __name__ == '__main__':
unittest.main()
......@@ -62,7 +62,7 @@ class TestKingARF(BaseTest):
return 2 * pi * self.f / self.c_f
def compute_Eac(self):
return 2 * self.p0**2 * self.compute_kappa_f()
return 1 / 4 * self.p0**2 * self.compute_kappa_f()
def compute_f2(self):
rho_tilde = self.rho_s / self.rho_f
......@@ -72,7 +72,7 @@ class TestKingARF(BaseTest):
return 1 / 3 + self.compute_f2() / 2
def compute_arf(self):
out = 2 * pi * self.compute_Phi() * self.compute_k() * self.R0**3
out = 4 * pi * self.compute_Phi() * self.compute_k() * self.R0**3
out *= self.compute_Eac() * sin(2 * self.compute_k() * self.pos)
return out
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment