u/No_Fun_3602

9 post karma · 1 comment karma · joined Oct 2024

  1. 0points

    ICSD database (self.crystallography)

    4 comments

  2. 1points

    helix generation problem using pyhonocc (self.OpenCascade)

    1 comments

  3. 2points

    problem generating the helix (self.learnpython)

    0 comments

  4. 0points

    how can i add a pythonocc viewer in a gui? instead of just having another window for the viewer (self.learnpython)

    1 comments

  5. 3points

    can i create a geometry based on a set of point calculated using python using cadquery (self.cadquery)

    1 comments

  6. 2points

    Is it possible to imbed OpenCascade in a standalone app or a webapp if so, please suggest some tools or resources on how to do this (self.OpenCascade)

    0 comments

  7. 1points

    Filament winding trajectory equations (self.AskEngineers) [Discussion]

    1 comments

  8. 1points

    filament winding path equation (self.askmath) [Geometry]

    4 comments

  9. 5points

    i need help with some differential equations in python (self.learnpython)

    6 comments

  10. 1points

    Quick Questions: November 10, 2024 (self.math) [Removed - try /r/learnmath]

    1 comments

  11. 6points

    I have been trying this research using python but i cant seem to get it working (self.learnpython)

    5 comments

  12. 2points

    python visualisation (self.learnpython)

    4 comments

  13. 1points

    Cpp visualisation (self.cpp_questions) [OPEN]

    5 comments

No_Fun_3602

I am trying to refine clinker of cement and i dont have some CIF files i cant access from the free database

No_Fun_3602

thanks

No_Fun_3602

yes i tried it but coulding get it working

No_Fun_3602

thank you

No_Fun_3602
# I tried to go about it like this but the graph i get is different from what in the paper attached in the original post

import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import solve_ivp

# Dome parameters
R = 385 
lambda_val = 0.1 
z_range = np.linspace(0, R, 100)  

# Radial coordinate r(z)
def r(z):
    return np.sqrt(R**2 - z**2)

def r_prime(z):
    return -z / np.sqrt(R**2 - z**2)

def r_double_prime(z):
    return -R**2 / (R**2 - z**2)**(3/2)
def dalpha_dz(z, alpha):
    r_val = r(z)
    r_prime_val = r_prime(z)
    r_double_prime_val = r_double_prime(z)
    
    
    term1 = np.sin(alpha) * np.tan(alpha) / r_val
    term2 = r_double_prime_val / (1 + r_prime_val**2) * np.cos(alpha)
    term3 = r_prime_val * np.tan(alpha) / r_val
    
    d_alpha_dz = lambda_val * (term1 - term2 - term3)
    return d_alpha_dz

# Initial condition
alpha_0 = 0
sol = solve_ivp(dalpha_dz, [z_range[0], z_range[-1]], [alpha_0], t_eval=z_range)

# Plot the results
plt.plot(sol.t, sol.y[0], label=r'$\alpha(z)$')
plt.xlabel('Axial Coordinate (z)')
plt.ylabel('Winding Angle (α)')
plt.title('Winding Angle α as a Function of z')
plt.legend()
plt.grid(True)
plt.show()
No_Fun_3602

I cant seem to plot the figure shown in the research paper

No_Fun_3602

i am trying to make a python app that i can give my input variables and it plot the trajectory based on those inputs

No_Fun_3602

i tried this but it only plot the cylinder without the correct path
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

c = 1.5  # minimum radius at the ends in cm
R = 4.0  # equatorial (middle section) radius in cm
L = 8.0  # total length of the cylinder in cm
transition_length = L * 0.2  # length of the transition sections at the ends
winding_angle = np.radians(85)  # winding angle in degrees

z = np.linspace(-L/2, L/2, 100)

radii = np.piecewise(
    z,
    [z < -L/2 + transition_length,
     (z >= -L/2 + transition_length) & (z <= L/2 - transition_length),
     z > L/2 - transition_length],
    [lambda z: c + (R - c) * np.sqrt(1 - ((z + L/2 - transition_length) / transition_length) ** 2),
     R,
     lambda z: c + (R - c) * np.sqrt(1 - ((L/2 - transition_length - z) / transition_length) ** 2)]
)

theta = np.linspace(0, 2 * np.pi, 100)
theta_grid, z_grid = np.meshgrid(theta, z)
x_grid = np.outer(radii, np.cos(theta))
y_grid = np.outer(radii, np.sin(theta))

n_turns = 5  # Number of turns for the winding
z_winding = np.linspace(-L/2, L/2, 500)
theta_winding = z_winding * np.tan(winding_angle) / R  # Geodesic winding equation
x_winding = R * np.cos(theta_winding)
y_winding = R * np.sin(theta_winding)

fig = plt.figure(figsize=(8, 6))
ax = fig.add_subplot(111, projection='3d')
ax.plot_surface(x_grid, y_grid, z_grid, color='cyan', alpha=0.7, edgecolor='k')
ax.plot(x_winding, y_winding, z_winding, color='red', linewidth=2, label="Geodesic Helical Winding")

ax.set_xlabel('X (cm)')
ax.set_ylabel('Y (cm)')
ax.set_zlabel('Z (cm)')
ax.set_title('3D Model of Cylinder with Geodesic Helical Winding')
ax.legend()
plt.show()

No_Fun_3602

the main part i need help with is coming up with the logic to show the trajectory on the cylinder

No_Fun_3602

Yes that's essentially the main obstacle I came across

No_Fun_3602

ok got it

No_Fun_3602

will i be able to get a similar outcome as in the video?