GHA1 num und ana richtig. Tests nach Beispielen aus Panou 2013

This commit is contained in:
2025-12-10 11:45:41 +01:00
parent 936b7c56f9
commit 946d028fae
6 changed files with 335 additions and 102 deletions

View File

@@ -1,4 +1,5 @@
import numpy as np
from numpy import sin, cos, arctan, arctan2, sqrt
import winkelumrechnungen as wu
import ausgaben as aus
import jacobian_Ligas
@@ -246,7 +247,10 @@ class EllipsoidTriaxial:
# print(s1, s2, s3)
beta = np.arctan(np.sqrt((-self.b**2 - s2) / (self.ay**2 + s2)))
lamb = np.arctan(np.sqrt((-self.ay**2 - s3) / (self.ax**2 + s3)))
if abs((-self.ay**2 - s3) / (self.ax**2 + s3)) > 1e-7:
lamb = np.arctan(np.sqrt((-self.ay**2 - s3) / (self.ax**2 + s3)))
else:
lamb = 0
u = np.sqrt(self.b**2 + s1)
return beta, lamb, u
@@ -328,39 +332,21 @@ class EllipsoidTriaxial:
if abs(xG) < eps and abs(yG) < eps: # Punkt in der z-Achse
phi = np.pi / 2 if zG > 0 else -np.pi / 2
lamb = 0.0
h = abs(zG) - ell.b
h = abs(zG) - self.b
return phi, lamb, h
elif abs(xG) < eps and abs(zG) < eps: # Punkt in der y-Achse
phi = 0.0
lamb = np.pi / 2 if yG > 0 else -np.pi / 2
h = abs(yG) - ell.ay
h = abs(yG) - self.ay
return phi, lamb, h
elif abs(yG) < eps and abs(zG) < eps: # Punkt in der x-Achse
phi = 0.0
lamb = 0.0 if xG > 0 else np.pi
h = abs(xG) - ell.ax
h = abs(xG) - self.ax
return phi, lamb, h
# elif abs(zG) < eps: # Punkt in der xy-Ebene
# phi = 0
# lamb = np.arctan2(yG / ell.ay**2, xG / ell.ax**2)
# rG = np.sqrt(xG ** 2 + yG ** 2)
# pE = np.array([self.ax * xG / rG, self.ax * yG / rG, self.ax * zG / rG], dtype=np.float64)
# rE = np.sqrt(pE[0] ** 2 + pE[1] ** 2)
# h = rG - rE
# return phi, lamb, h
#
# elif abs(yG) < eps: # Punkt in der xz-Ebene
# phi = np.arctan2(zG / ell.b**2, xG / ell.ax**2)
# lamb = 0 if xG > 0 else np.pi
# rG = np.sqrt(xG ** 2 + zG ** 2)
# pE = np.array([self.ax * xG / rG, self.ax * yG / rG, self.ax * zG / rG], dtype=np.float64)
# rE = np.sqrt(pE[0] ** 2 + pE[2] ** 2)
# h = rG - rE
# return phi, lamb, h
rG = np.sqrt(xG ** 2 + yG ** 2 + zG ** 2)
pE = np.array([self.ax * xG / rG, self.ax * yG / rG, self.ax * zG / rG], dtype=np.float64)
@@ -471,7 +457,17 @@ class EllipsoidTriaxial:
return u, v
def p_q(self, x, y, z) -> dict:
def func_H(self, x, y, z):
return x ** 2 + y ** 2 / (1 - self.ee ** 2) ** 2 + z ** 2 / (1 - self.ex ** 2) ** 2
def func_n(self, x, y, z, H=None):
if H is None:
H = self.func_H(x, y, z)
return np.array([x / sqrt(H),
y / ((1 - self.ee ** 2) * sqrt(H)),
z / ((1 - self.ex ** 2) * sqrt(H))])
def p_q(self, x, y, z) -> tuple[np.ndarray, np.ndarray]:
"""
Berechnung sämtlicher Größen
:param x: x
@@ -479,11 +475,9 @@ class EllipsoidTriaxial:
:param z: z
:return: Dictionary sämtlicher Größen
"""
H = x ** 2 + y ** 2 / (1 - self.ee ** 2) ** 2 + z ** 2 / (1 - self.ex ** 2) ** 2
n = self.func_n(x, y, z)
n = np.array([x / np.sqrt(H), y / ((1 - self.ee ** 2) * np.sqrt(H)), z / ((1 - self.ex ** 2) * np.sqrt(H))])
beta, lamb, u = self.cart2ellu(np.array([x, y, z]))
beta, lamb = self.cart2ell(np.array([x, y, z]))
B = self.Ex ** 2 * np.cos(beta) ** 2 + self.Ee ** 2 * np.sin(beta) ** 2
L = self.Ex ** 2 - self.Ee ** 2 * np.cos(lamb) ** 2
@@ -507,11 +501,9 @@ class EllipsoidTriaxial:
p = np.array([p1, p2, p3])
q = np.array([n[1] * p[2] - n[2] * p[1],
n[2] * p[0] - n[0] * p[2],
n[1] * p[1] - n[1] * p[0]])
n[0] * p[1] - n[1] * p[0]])
return {"H": H, "n": n, "beta": beta, "lamb": lamb, "u": u, "B": B, "L": L, "c1": c1, "c0": c0, "t1": t1,
"t2": t2,
"F": F, "p": p, "q": q}
return p, q
if __name__ == "__main__":