Skip to content
Snippets Groups Projects
Commit 827fb289 authored by Martin Bauer's avatar Martin Bauer
Browse files

Corrected angle computationw

parent cf025024
No related branches found
No related tags found
No related merge requests found
...@@ -6,6 +6,9 @@ from lbmpy.methods.conservedquantitycomputation import DensityVelocityComputatio ...@@ -6,6 +6,9 @@ from lbmpy.methods.conservedquantitycomputation import DensityVelocityComputatio
class EntropicEquilibriumSRT(AbstractLbMethod): class EntropicEquilibriumSRT(AbstractLbMethod):
"""Equilibrium from 'Minimal entropic kinetic models for hydrodynamics'
Ansumali, S. ; Karlin, I. V; Öttinger, H. C, (2003)
"""
def __init__(self, stencil, relaxation_rate, force_model, conserved_quantity_calculation): def __init__(self, stencil, relaxation_rate, force_model, conserved_quantity_calculation):
super(EntropicEquilibriumSRT, self).__init__(stencil) super(EntropicEquilibriumSRT, self).__init__(stencil)
......
...@@ -122,19 +122,25 @@ def liquid_lens_neumann_angles(concentration, drop_phase_idx=2, enclosing_phase1 ...@@ -122,19 +122,25 @@ def liquid_lens_neumann_angles(concentration, drop_phase_idx=2, enclosing_phase1
y1, y2 = (i[1] for i in intersections) y1, y2 = (i[1] for i in intersections)
assert np.abs(y1 - y2) < 0.1, "Liquid lens is not aligned in y direction (rotated?)" assert np.abs(y1 - y2) < 0.1, "Liquid lens is not aligned in y direction (rotated?)"
y_horizontal = (y1 + y2) / 2
left_intersection = sorted(intersections, key=lambda e: e[0])[0]
xs = np.sqrt(circles[0].radius ** 2 - (y_horizontal - circles[0].center[1]) ** 2) lower_circle, upper_circle = sorted(circles, key=lambda c: c.center[1])
angle = np.rad2deg(np.arctan(-xs / np.sqrt(circles[0].radius ** 2 - xs ** 2))) % 180
angle = 180 - angle def rotate90_ccw(vector):
neumann3_upper = angle return np.array([-vector[1], vector[0]])
neumann1 = 180 - neumann3_upper
def rotate90_cw(vector):
xs = np.sqrt(circles[1].radius ** 2 - (y_horizontal - circles[1].center[1]) ** 2) return np.array([vector[1], -vector[0]])
angle = np.rad2deg(np.arctan(-xs / np.sqrt(circles[1].radius ** 2 - xs ** 2))) % 180
angle = 180 - angle def normalize(vector):
neumann3_lower = angle return vector / np.linalg.norm(vector)
neumann2 = 180 - neumann3_lower
vector_20 = normalize(rotate90_ccw(lower_circle.center - left_intersection))
neumann3 = neumann3_upper + neumann3_lower vector_01 = np.array([-1, 0])
return neumann1, neumann2, neumann3 vector_12 = normalize(rotate90_cw(upper_circle.center - left_intersection))
angles = [np.rad2deg(np.arccos(np.dot(v1, v2))) for v1, v2 in [(vector_20, vector_01),
(vector_01, vector_12),
(vector_12, vector_20)]
]
return angles
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment