Help with HAACK calculations

The Rocketry Forum

Help Support The Rocketry Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

Right Wing Wacko

Well-Known Member
Joined
Apr 8, 2012
Messages
193
Reaction score
0
I am trying to model a HAACK / Von Kármán nose cone using OpenSCAD and the formulas I find published here and on Wikipedia.

Below is what I've come up with but the numbers I'm getting do not even come close to making sense.
Where did I screw up?

Code:
function pi()=3.14159265358979323846;


module HAACK(L=5, R=1, C=0) {    
    for ( x=[0:1:L] ) {
        theta = acos(1-(2*x)/L);
        y = R * sqrt( theta - (sin(2 * theta) / 2) + (C * pow(sin(theta),3)) ) / sqrt( pi() ); 
        
        translate([0,0,x]) cylinder(r=y, h=1);
        echo( x," ",y);
    }
}


HAACK( L=1000, R=98, C=0);

Screenshot_1.png
 
See if this pseudocode "hack" works:

For a given "X.Value" (i.e., axial distance from the tip of the nose cone), the "Y.Length" (i.e., radius perpendicular to the given "X.Value") is ...

Y.Length = Nose.Cone.Base.Rad*SQRT((ACOS(1-2*(X.Value/Nose.Cone.Len))-0.5*SIN(2*ACOS(1-2*(X.Value/Nose.Cone.Len))))/PI())

Greg
 
See if this pseudocode "hack" works:

For a given "X.Value" (i.e., axial distance from the tip of the nose cone), the "Y.Length" (i.e., radius perpendicular to the given "X.Value") is ...

Y.Length = Nose.Cone.Base.Rad*SQRT((ACOS(1-2*(X.Value/Nose.Cone.Len))-0.5*SIN(2*ACOS(1-2*(X.Value/Nose.Cone.Len))))/PI())

Greg

If I translated your code correctly.. I placed it in my program and get the same answers I did, (as long as C=0).

The values of Y (and Y2) are much larger than I expected. I was expecting values approaching R, but instead got:

ECHO: 0, " ", 0, "", 0
ECHO: 1, " ", 104.34, "", 104.34
ECHO: 2, " ", 124.095, "", 124.095
ECHO: 3, " ", 137.348, "", 137.348
ECHO: 4, " ", 147.606, "", 147.606
ECHO: 5, " ", 156.091, "", 156.091
.
.
.
ECHO: 996, " ", 726.967, "", 726.967
ECHO: 997, " ", 728.975, "", 728.975
ECHO: 998, " ", 731.347, "", 731.347
ECHO: 999, " ", 734.426, "", 734.426
ECHO: 1000, " ", 741.801, "", 741.801


Code:
module HAACK_SERIES(L = 5, R = 1, C = 0) {
    
    for ( x=[0:1:L] ) {
        
        theta = acos(1-(2*x)/L);
        y = R * sqrt( theta - (sin(2 * theta) / 2) + (C * pow(sin(theta),3)) ) / sqrt( pi() ); 
        
        y2 = R * sqrt((acos(1-2*(x/L))-0.5*sin(2*acos(1-2*(x/L))))/pi());
        
        translate([0,0,x]) cylinder(r=y, h=1);
        echo( x," ",y, "", y2);
    }
}

HAACK_SERIES( L=1000, R=98, C=0);
 
What is the result from the function acos()? The formula assumes that the result is in radians for that free hanging "theta". Degrees is fine for feeding into the sin() function since it should match acos().

Here is my C code and an example of the output:
Code:
  for(i = 1; i <= 100; i++)
    {
      x = (length*i)/100;

      t = acos(1.0 - 2.0*x/length);
      y = (diameter/2.0)*sqrt((t - sin(2.0*t)/2.0 + 0*pow(sin(t),3))/M_PI);

nosecone3to1VK.png
 
What is your nose cone length (not including tenon, a.k.a, shoulder) and radius (or diameter) at base?

Greg
 
If I translated your code correctly.. I placed it in my program and get the same answers I did, (as long as C=0).

The values of Y (and Y2) are much larger than I expected. I was expecting values approaching R, but instead got:

ECHO: 0, " ", 0, "", 0
ECHO: 1, " ", 104.34, "", 104.34
ECHO: 2, " ", 124.095, "", 124.095
ECHO: 3, " ", 137.348, "", 137.348
ECHO: 4, " ", 147.606, "", 147.606
ECHO: 5, " ", 156.091, "", 156.091
.
.
.
ECHO: 996, " ", 726.967, "", 726.967
ECHO: 997, " ", 728.975, "", 728.975
ECHO: 998, " ", 731.347, "", 731.347
ECHO: 999, " ", 734.426, "", 734.426
ECHO: 1000, " ", 741.801, "", 741.801


Code:
module HAACK_SERIES(L = 5, R = 1, C = 0) {
    
    for ( x=[0:1:L] ) {
        
        theta = acos(1-(2*x)/L);
        y = R * sqrt( theta - (sin(2 * theta) / 2) + (C * pow(sin(theta),3)) ) / sqrt( pi() ); 
        
        y2 = R * sqrt((acos(1-2*(x/L))-0.5*sin(2*acos(1-2*(x/L))))/pi());
        
        translate([0,0,x]) cylinder(r=y, h=1);
        echo( x," ",y, "", y2);
    }
}

HAACK_SERIES( L=1000, R=98, C=0);

Here are my results for a length of 5 and base-radius of 1, by 1 mm increments (0.0394 inch):

VK.Example.Calc.5L1R.jpg

Greg
 
Got it!

I took my code and converted it to PHP, which of course got the correct answer.
PHP uses RADIANS for all it's Trig funtions, OPENSCAD uses degrees.

This looks so much better. It's not correct yet, as the C parameter is not functioning as it should, but I think I know what the issue is now. Degrees and Radians totally slipped my mind earlier. It's been way to long since high-school trig.
Screenshot_3.png
Code:
module HAACK_SERIES(L = 5, R = 1, C = 0) {
    $fn=50;
    for ( x=[0:.1:L] ) {
        a = (1-(2*x)/L) ;
        theta = acos(a) * (PI / 180);
        y = R * sqrt( theta - (sin(2 * theta) / 2) + (C * pow(sin(theta),3)) ) / sqrt( PI ); 
        
        translate([0,0,x]) cylinder(r=y, h=1);
    }
}


HAACK_SERIES( L=500, R=98, C=0);
 
Last edited:

Latest posts

Back
Top