Skip to content

Commit

Permalink
Fix bad tensor product
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewjlock committed Nov 4, 2024
1 parent 7c05978 commit f5b23db
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 335 deletions.
7 changes: 6 additions & 1 deletion src/pysagas/cfd/oblique_prandtl_meyer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from scipy.optimize import root_scalar
from pysagas.utilities import add_sens_data
from pysagas.cfd.solver import FlowSolver, FlowResults, SensitivityResults
from hypervehicle.utilities import SensitivityStudy, merge_stls
import time


class OPM(FlowSolver):
Expand Down Expand Up @@ -60,6 +62,7 @@ def solve(
)

# Iterate over all cells
F_trace = []
net_force = Vector(0, 0, 0)
net_moment = Vector(0, 0, 0)
bad = 0
Expand Down Expand Up @@ -114,6 +117,7 @@ def solve(
method = 0
M2, p2, T2 = (flow.M, flow.P, flow.T)


total += 1

# Save results for this cell
Expand All @@ -133,6 +137,7 @@ def solve(

# Calculate force vector
F = cell.n * p2 * cell.A
F_trace.append(F)
net_force += F
net_moment += Vector.from_coordinates(np.cross(r.vec, F.vec))

Expand Down Expand Up @@ -507,7 +512,7 @@ def oblique_rho2_rho1(M1: float, beta: float, gamma: float = 1.4):
Peter Jacobs
"""
M1n = M1 * abs(np.sin(beta))
rho2_rho1 = (gamma + 1) * M1n**2 / 2 + (gamma - 1) * M1n**2
rho2_rho1 = (gamma + 1) * M1n**2 / (2 + (gamma - 1) * M1n**2)
return rho2_rho1

@staticmethod
Expand Down
334 changes: 0 additions & 334 deletions src/pysagas/sensitivity/calculator.py

This file was deleted.

1 change: 1 addition & 0 deletions src/pysagas/sensitivity/calculator_vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def sensitivity_calculator_vec(
np.cross(r.T, sensitivities[p, :, :].T).T
+ np.cross(cells.dcdp[:, p].T, F.T).T
)
breakpoint()

dFdp = np.sum(sensitivities, axis=-1) / (freestream.q * A_ref)
dMdp = np.sum(moment_sensitivities, axis=-1) / (freestream.q * A_ref * c_ref)
Expand Down

0 comments on commit f5b23db

Please sign in to comment.