MCPcopy Create free account
hub / github.com/cselab/aphros / FigAng

Function FigAng

deploy/scripts/aphros/plot.py:1083–1209  ·  view source on GitHub ↗
(vf, kk, ll, po)

Source from the content-addressed store, hash-verified

1081# kk: list of curvature fields of shape vf.shape
1082# ll: list of labels
1083def FigAng(vf, kk, ll, po):
1084 dim = GetDim(vf.shape)
1085 x1, y1, z1, hx, hy, hz = GetGeom(vf.shape)
1086 x, y, z = GetMesh(x1, y1, z1)
1087
1088 # select interface points from x,y,z
1089 th = 0.
1090 ii = np.where((vf > th) & (vf < 1. - th))
1091 x = x[ii]
1092 y = y[ii]
1093 z = z[ii]
1094
1095 cx, cy, cz, rx, ry, rz = LoadBub()
1096
1097 # cartesian to spherical for points x,y,z on interface
1098 dx = x - cx
1099 dy = y - cy
1100 dz = z - cz
1101 u = np.arctan2(dy, dx)
1102 v = np.arctan2(dz, (dx**2 + dy**2)**0.5)
1103 # angles of interface points in deg
1104 degu = np.degrees(u)
1105 degv = np.degrees(v)
1106
1107 # hires angle
1108 uh = np.linspace(-np.pi, np.pi, 200)
1109 if dim == 3:
1110 vh = np.linspace(-np.pi * 0.5, np.pi * 0.5, 200)
1111 else:
1112 vh = np.array([0.])
1113 # hires points
1114 # ellipsoid in spherical coordinates: r=r(u,v)
1115 r = ((np.cos(uh) * np.cos(vh) / rx)**2 +
1116 (np.sin(uh) * np.cos(vh) / ry)**2 + (np.sin(vh) / rz)**2)**(-0.5)
1117 xh = cx + r * np.cos(uh) * np.cos(vh)
1118 yh = cy + r * np.sin(uh) * np.cos(vh)
1119 zh = cz + r * np.sin(vh)
1120 # hires curvature
1121 keh = GetExactK(dim, xh.flatten(), yh.flatten(), zh.flatten())
1122 keh = keh.reshape(xh.shape)
1123 # average curvature
1124 kea = keh.mean()
1125
1126 # line in angles
1127 nls = 200
1128 us = np.linspace(-np.pi, np.pi, nls)
1129 if dim == 3:
1130 vs = np.linspace(-np.pi * 0.5, np.pi * 0.5, nls)
1131 else:
1132 vs = np.linspace(0., 0., nls)
1133 # angles of line in deg
1134 degus = np.degrees(us)
1135 degvs = np.degrees(vs)
1136
1137 # Interpolate to line
1138 # u,v: source points
1139 # k: source field
1140 # ut,vt: target points

Callers 1

CurvFunction · 0.85

Calls 11

GetDimFunction · 0.85
GetGeomFunction · 0.85
LoadBubFunction · 0.85
GetExactKFunction · 0.85
ILFunction · 0.85
WriteLineFunction · 0.85
meanMethod · 0.80
plotMethod · 0.80
GetMeshFunction · 0.70
PlotInitFunction · 0.70
PlotSaveFunction · 0.70

Tested by

no test coverage detected