Skip to content

Commit

Permalink
Merge pull request #12 from samayala22/3dof
Browse files Browse the repository at this point in the history
3DOF
  • Loading branch information
samayala22 authored Feb 17, 2025
2 parents c5dffd1 + 7e09c74 commit a6a9cbb
Show file tree
Hide file tree
Showing 22 changed files with 1,680 additions and 125 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linux_gpu_ubi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: branch@master
actions-cache-folder: .xmake-cache
# actions-cache-folder: .xmake-cache

# Update xmake repository
- name: Update xmake repository
Expand Down
14 changes: 10 additions & 4 deletions data/2dof.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import plotly.graph_objects as go
from plotly.subplots import make_subplots

import mpld3
import scipy as sp
from scipy.fft import fft, ifft, fftfreq
from scipy.integrate import solve_ivp
Expand Down Expand Up @@ -268,6 +267,11 @@ def alpha_linear(alpha):

def create_monolithic_system(y0: np.ndarray, ndv: NDVars, M: callable):
def monolithic_system(t, y: np.ndarray):
# Yung p212
"""
system unknowns:
q = [h, a, hd, ad, x1, x2]
"""
M1 = np.zeros((6,6))
M2 = np.zeros((6,6))
V = np.zeros(6)
Expand Down Expand Up @@ -317,7 +321,8 @@ def monolithic_system(t, y: np.ndarray):
V[2] += - (ndv.omega/ndv.U)**2 * y[0]
V[3] += - 1/(ndv.U**2) * M(y[1])

y_d = np.linalg.inv(M2) @ (M1 @ y + V)
y_d = np.linalg.solve(M2, M1 @ y + V)
# y_d = np.linalg.inv(M2) @ (M1 @ y + V)

return y_d

Expand Down Expand Up @@ -557,7 +562,7 @@ def aero(i):
wagner_init = (u[1, 0] + u[0, 0] + (0.5 - ndv.a_h)*v[1,0])*(1 - psi1*np.exp(-eps1*t) - psi2*np.exp(-eps2*t))
cl = np.pi*(a[0, i] - ndv.a_h * a[1, i] + v[1, i]) + 2*np.pi*(wagner_init + duhamel)
cm = np.pi*(0.5 + ndv.a_h)*(wagner_init + duhamel) + 0.5*np.pi*ndv.a_h*(a[0, i] - ndv.a_h*a[1, i]) - 0.5*np.pi*(0.5 - ndv.a_h)*v[1, i] - (np.pi/16) * a[1, i]
print(f"i: {i} | cl: {cl} | cm: {cm}")
# print(f"i: {i} | cl: {cl} | cm: {cm}")

return np.array([
- cl / (np.pi*ndv.mu),
Expand All @@ -572,6 +577,7 @@ def aero(i):
du = np.zeros(2)
du_k = np.zeros(2) + 1
iteration = 0
# Newton-Raphson iterations
while (np.linalg.norm(du_k - du) / len(du) > newton_err_thresh):
du_k = du[:]
du, dv, da = newmark_beta_step(M, C, zeros, u[:,i], v[:,i], a[:,i], delta_F, dt_nd)
Expand Down Expand Up @@ -703,7 +709,7 @@ def aero(i):
)
)

fig.write_html("build/freeplay.html", include_mathjax='cdn')
fig.write_html("build/2dof.html", include_mathjax='cdn')


# X = fft(u, axis=1)
Expand Down
Loading

0 comments on commit a6a9cbb

Please sign in to comment.