Saturday, April 06, 2013

Potenciales electrodinámicos

// Carga del electrón
#define qe -1.602176487e-19
// Masa del electrón
#define me 9.10938215e-31
// Permitividad del vacío
#define ep0 8.841941281e-12
// Permeabilidad del vacío
#define mu0 1.256637062e-6
// Constante Pi
#define Pi 3.141592654
// Número de cargas
#define N 5
// Incremento de posición para las derivadas parciales
#define hh 1.0e-13
// Tiempo entre marcos
#define dd 4.0e-19



#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <GL/glut.h>



typedef struct {
  double xx;
  double yy;
  double zz;
} vector;



int ancho; // ancho de la ventana gráfica
int alto; // alto de la ventana gráfica

double arista = 0.5e-9; // arista del cubo donde están las cargas
double pvcubo = 0.5e-9; // distancia del punto de vista al cubo
vector vcentro; // posición central del cubo
double qq[N] = { qe, -qe, qe, -qe, qe }; // cargas de las N cargas
double mq[N] = { me, me, me, me, me }; // masas de las N cargas
vector rq[N][4]; // posiciones de las N cargas en instantes de tiempo tt, (tt-dd), (tt-2*dd) y (tt-3*dd)

double tt = 0.0; // tiempo



void manejarTeclado(unsigned char tecla, int xx, int yy);
void reformar(int width, int height);
void exhibir(void);

int pintarEscena();
int actualizarPosiciones();
void printString(char *ltexto);

vector fVector(double xx, double yy, double zz);
vector vsum(vector v1, vector v2);
vector vres(vector v1, vector v2);
vector vepv(double ee, vector vv);
double vmod(vector vv);
vector vprv(vector v1, vector v2);
void imprimeV(char *etiqueta, vector vv);

vector AA(vector rr, double qq, vector rq, vector vq);
double Fi(vector rr, double qq, vector rq);
vector fAA(double xx, double yy, double zz, int i, double qq[N], vector rq[N][4]);
double fFi(double xx, double yy, double zz, int i, double qq[N], vector rq[N][4]);
vector fAA2(double xx, double yy, double zz, int i, double qq[N], vector rq[N][4]);



int main(int argc, char **argv) {
  int i;
  int j;
  double rx;
  double ry;
  double rz;
   
  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
  glutInitWindowSize(300, 300);
  glutInitWindowPosition(100, 100);
 
  glutCreateWindow(argv[0]);
  glClearColor(0.0, 0.0, 0.0, 0.0);
  glEnable(GL_COLOR_MATERIAL);
  glShadeModel(GL_SMOOTH);
  glEnable(GL_LIGHTING);
  glEnable(GL_LIGHT0);
  glEnable(GL_CULL_FACE);
  glCullFace(GL_BACK);
  glEnable(GL_DEPTH_TEST);

  vcentro= fVector(0.0, 0.0, 0.0);
 
  srand( (unsigned)time( NULL ) );
 
  // Posiciones iniciales aleatorias de las cargas en cubo central de lado arista/2
  for(i=0; i<N; i++) {
    rx = arista/2.0*((double)rand()/(double)RAND_MAX)-arista/4.0;
    ry = arista/2.0*((double)rand()/(double)RAND_MAX)-arista/4.0;
    rz = arista/2.0*((double)rand()/(double)RAND_MAX)-arista/4.0;
    for(j=0; j<4; j++) {
      rq[i][j] = fVector(rx, ry, rz);
    }
  }

  glutKeyboardFunc(manejarTeclado); // registro función atiende evento teclado
  glutReshapeFunc(reformar); // registro función atiende evento volver a formar
  glutDisplayFunc(exhibir); // registro función atiende evento frame

  glutMainLoop();

  return 0;
}



void manejarTeclado(unsigned char tecla, int xx, int yy) {

  switch(tecla) {
    case 27:
      exit(0);
      break;
    case '+':
      pvcubo = pvcubo + arista / 100.0;
      break;
    case '-':
      pvcubo = pvcubo - arista / 100.0;
  }

  reformar(ancho, alto);
}



void reformar(int width, int height) {
  double beta; // campo de visión

  ancho = width;
  alto = height;

  glViewport(0, 0, width, height); // dimensiones área rectangular visualización

  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();

  beta = (360.0 / Pi) * atan(arista / (2.0 * pvcubo));

  // defino perspectiva de la cámara
  gluPerspective(beta, (GLfloat)width/(GLfloat)height, pvcubo, pvcubo + arista);

  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();

  // defino posición y orientación de la cámara respecto al centro del cubo
  // gluLookAt(punto de vista; punto de referencia; vector arriba)
  gluLookAt(vcentro.xx, vcentro.yy, vcentro.zz + pvcubo + arista / 2.0, vcentro.xx, vcentro.yy, vcentro.zz, 0.0, 1.0, 0.0);
}



void exhibir(void) {

  // borrar buffer de imagen
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  if (!pintarEscena()) {
      fprintf(stderr, "Error en pintarEscena\n");
      exit(1);
  }

  // intercambiar buffers de imagen
  glutSwapBuffers();


  if (!actualizarPosiciones()) {
    fprintf(stderr, "Error en actualizarPosiciones\n");
    exit(1);
  }

  glutPostRedisplay(); // provoco evento frame
}



int pintarEscena() {
  int i;
  char etiqueta[256];
  char lineatexto[256];

  // Pinto fronteras

  glPushMatrix();
  glTranslatef(vcentro.xx, vcentro.yy, vcentro.zz);
  glColor4f(1.0, 1.0, 1.0, 1.0);
  glutWireCube(arista - arista / 1000.0);
  glPopMatrix();

  // Muestro cargas

  fprintf(stdout, "t = %g\n", tt);
  for(i=0; i<N; i++) {
    sprintf(etiqueta, "vrr_q%d =", i);
    imprimeV(etiqueta, rq[i][0]);

    glPushMatrix();
    glTranslatef(rq[i][0].xx, rq[i][0].yy, rq[i][0].zz);
    glColor4f(1.0, 1.0, 1.0, 1.0);
    glutWireSphere(arista/100.0, 10, 10);
    glPopMatrix();

    glBegin(GL_LINES);
    glVertex3d(+arista/2.0, rq[i][0].yy, rq[i][0].zz);
    glVertex3d(rq[i][0].xx, rq[i][0].yy, rq[i][0].zz);
    glVertex3d(rq[i][0].xx, +arista/2.0, rq[i][0].zz);
    glVertex3d(rq[i][0].xx, rq[i][0].yy, rq[i][0].zz);
    glVertex3d(rq[i][0].xx, rq[i][0].yy, +arista/2.0);
    glVertex3d(rq[i][0].xx, rq[i][0].yy, rq[i][0].zz);
    glEnd();
  }
  fprintf(stdout, "\n");

  // Pinto línea de texto

  sprintf(lineatexto, "t = %g", tt);
  printString(lineatexto);

  return 1;
}



int actualizarPosiciones() { 
  int i;
  int j;
  double rx;
  double ry;
  double rz;
  double BBx;
  double BBy;
  double BBz;
  double EEx;
  double EEy;
  double EEz;
  vector BBi; // campo B
  vector EEi; // campo E
  vector FF; // fuerza
  vector vqi;
  vector aa; // aceleración

  // ACTUALIZO LAS POSICIONES DE LAS CARGAS

  // Desplazo posiciones en el array

  for(i=0; i<N; i++) {
    rq[i][3] = rq[i][2];
    rq[i][2] = rq[i][1];
    rq[i][1] = rq[i][0];
  }

  // Calculo últimas posiciones rq[i][0]

  for(i=0; i<N; i++) { // recorre cargas

    // Calculo B y E sobre carga i

    BBx = ((fAA(rq[i][1].xx   , rq[i][1].yy+hh, rq[i][1].zz   , i, qq, rq).zz-fAA(rq[i][1].xx   , rq[i][1].yy   , rq[i][1].zz   , i, qq, rq).zz)/hh)-((fAA(rq[i][1].xx   , rq[i][1].yy   , rq[i][1].zz+hh, i, qq, rq).yy-fAA(rq[i][1].xx   , rq[i][1].yy   , rq[i][1].zz   , i, qq, rq).yy)/hh);
    BBy = ((fAA(rq[i][1].xx   , rq[i][1].yy   , rq[i][1].zz+hh, i, qq, rq).xx-fAA(rq[i][1].xx   , rq[i][1].yy   , rq[i][1].zz   , i, qq, rq).xx)/hh)-((fAA(rq[i][1].xx+hh, rq[i][1].yy   , rq[i][1].zz   , i, qq, rq).zz-fAA(rq[i][1].xx   , rq[i][1].yy   , rq[i][1].zz   , i, qq, rq).zz)/hh);
    BBz = ((fAA(rq[i][1].xx+hh, rq[i][1].yy   , rq[i][1].zz   , i, qq, rq).yy-fAA(rq[i][1].xx   , rq[i][1].yy   , rq[i][1].zz   , i, qq, rq).yy)/hh)-((fAA(rq[i][1].xx   , rq[i][1].yy+hh, rq[i][1].zz   , i, qq, rq).xx-fAA(rq[i][1].xx   , rq[i][1].yy   , rq[i][1].zz   , i, qq, rq).xx)/hh);

    EEx = ((fFi(rq[i][1].xx   , rq[i][1].yy   , rq[i][1].zz   , i, qq, rq)-fFi(rq[i][1].xx+hh, rq[i][1].yy   , rq[i][1].zz   , i, qq, rq))/hh)-((fAA(rq[i][1].xx   , rq[i][1].yy   , rq[i][1].zz   , i, qq, rq).xx-fAA2(rq[i][1].xx   , rq[i][1].yy   , rq[i][1].zz   , i, qq, rq).xx)/dd);
    EEy = ((fFi(rq[i][1].xx   , rq[i][1].yy   , rq[i][1].zz   , i, qq, rq)-fFi(rq[i][1].xx   , rq[i][1].yy+hh, rq[i][1].zz   , i, qq, rq))/hh)-((fAA(rq[i][1].xx   , rq[i][1].yy   , rq[i][1].zz   , i, qq, rq).yy-fAA2(rq[i][1].xx   , rq[i][1].yy   , rq[i][1].zz   , i, qq, rq).yy)/dd);
    EEz = ((fFi(rq[i][1].xx   , rq[i][1].yy   , rq[i][1].zz   , i, qq, rq)-fFi(rq[i][1].xx   , rq[i][1].yy   , rq[i][1].zz+hh, i, qq, rq))/hh)-((fAA(rq[i][1].xx   , rq[i][1].yy   , rq[i][1].zz   , i, qq, rq).zz-fAA2(rq[i][1].xx   , rq[i][1].yy   , rq[i][1].zz   , i, qq, rq).zz)/dd);

    BBi = fVector(BBx, BBy, BBz);
    EEi = fVector(EEx, EEy, EEz );

    // Calculo F sobre carga i

    vqi = vepv(1.0/dd, vres(rq[i][1], rq[i][2]));
    FF = vepv(qq[i], vsum(EEi, vprv(vqi, BBi))); // Fuerza de Lorentz

    // Calculo aceleración y nueva posición de la carga i

    aa = vepv(1.0/mq[i] , FF); // a = F/m
    rq[i][0] = vsum(vsum(vepv(pow(dd, 2.0)/2.0, aa), vepv(dd, vqi)), rq[i][1]); // rf = a*t^2/2 + vi*t + ri

  } // for

  tt = tt + dd;

  return 1;
}



void printString(char *ltexto) {
  int longitud = strlen(ltexto);
  int i;
  GLboolean lit = glIsEnabled(GL_LIGHTING);

  glDisable(GL_LIGHTING);
  glColor4f(1.0, 1.0 , 1.0, 1.0);

  glRasterPos3f(vcentro.xx - arista / 2.0 + arista / 100.0, vcentro.yy - arista / 2.0 + arista / 100.0, vcentro.zz + arista / 2.0 - arista / 100.0);

  i = 0;
  while (i < longitud) {
    glutBitmapCharacter(GLUT_BITMAP_8_BY_13, ltexto[i]);
    i++;
  }

  if (lit) {
    glEnable(GL_LIGHTING);
  }
}



// Crea vector a partir de sus componentes
vector fVector(double xx, double yy, double zz) {
  vector vv;

  vv.xx = xx;
  vv.yy = yy;
  vv.zz = zz;

  return vv;
}



// Suma vectores; v1+v2
vector vsum(vector v1, vector v2) {
  vector res;

  res.xx = v1.xx + v2.xx;
  res.yy = v1.yy + v2.yy;
  res.zz = v1.zz + v2.zz;

  return res;
}



// Resta vectores; v1-v2
vector vres(vector v1, vector v2) {
  vector res;

  res.xx = v1.xx - v2.xx;
  res.yy = v1.yy - v2.yy;
  res.zz = v1.zz - v2.zz;

  return res;
}



// Multiplica escalar por vector
vector vepv(double ee, vector vv) {
  vector res;

  res.xx = ee * vv.xx;
  res.yy = ee * vv.yy;
  res.zz = ee * vv.zz;

  return res;
}



// Módulo de vector
double vmod(vector vv) {
  return sqrt(pow(vv.xx, 2.0) + pow(vv.yy, 2.0) + pow(vv.zz, 2.0));
}



// Producto vectorial v1 x v2
vector vprv(vector v1, vector v2) {
  vector res;

  res.xx = v1.yy * v2.zz - v1.zz * v2.yy;
  res.yy = v1.zz * v2.xx - v1.xx * v2.zz;
  res.zz = v1.xx * v2.yy - v1.yy * v2.xx;

  return res;
}



// Imprime vector
void imprimeV(char *etiqueta, vector vv) {
  fprintf(stdout, "%s <%g,%g,%g>\n", etiqueta, vv.xx, vv.yy, vv.zz);
}



// Potencial vector magnético electrodinámico A
vector AA(vector rr, double qq, vector rq, vector vq) {
  return vepv(mu0/(4.0*Pi)*qq/vmod(vres(rr,rq)),vq);
}



// Potencial escalar electrodinámico Fi
double Fi(vector rr, double qq, vector rq) {
  return (1.0/(4.0*Pi*ep0)*qq/vmod(vres(rr,rq)));
}



// Potencial vector magnético electrodinámico A total sobre carga i en último instante
vector fAA(double xx, double yy, double zz, int i, double qq[N], vector rq[N][4]) {
  vector rr;
  vector AAi;
  vector vqj;
  int j;

  rr = fVector(xx, yy, zz);
  AAi = fVector(0.0, 0.0, 0.0);

  // Acumulo alfa
  for(j=0; j<N; j++) { // recorre cargas
    if (i != j) {
      vqj = vepv(1.0/dd,vres(rq[j][1],rq[j][2]));
      AAi = vsum(AAi, AA(rr, qq[j], rq[j][1], vqj));
    }
  }

  return AAi;
}



// Potencial escalar electrodinámico Fi total sobre carga i en último instante
double fFi(double xx, double yy, double zz, int i, double qq[N], vector rq[N][4]) {
  vector rr;
  double Fii;
  int j;

  rr = fVector(xx, yy, zz);
  Fii = 0.0;

  // Acumulo fi
  for(j=0; j<N; j++) { // recorre cargas
    if (i != j) {
      Fii = Fii + Fi(rr, qq[j], rq[j][1]);
    }
  }

  return Fii;
}



// Potencial vector magnético electrodinámico A total sobre carga i en instante anterior al último
vector fAA2(double xx, double yy, double zz, int i, double qq[N], vector rq[N][4]) {
  vector rr;
  vector AAi;
  vector vqj;
  int j;

  rr = fVector(xx, yy, zz);
  AAi = fVector(0.0, 0.0, 0.0);

  // Acumulo alfa
  for(j=0; j<N; j++) { // recorre cargas
    if (i != j) {
      vqj = vepv(1.0/dd,vres(rq[j][2],rq[j][3]));
      AAi = vsum(AAi, AA(rr, qq[j], rq[j][2], vqj));
    }
  }

  return AAi;
}


Sunday, August 26, 2012

ERROR IMPORTANTE en el artículo de "EL PAÍS" titulado: Los conquistadores del 'Apolo 11'

Sin ánimo de incomodarle señor John Carlin, deja usted al periódico "El País" y a los españoles en mal lugar.

Dice en su artículo que en el despegue el cohete Saturno V tenía un consumo de 3785 litros de combustible por segundo.

http://elpais.com/diario/2009/07/19/domingo/1247975558_850215.html

Soy ingeniero y le voy a demostrar rápidamente que ese número está EQUIVOCADO.

Voy a asumir el caso más favorable para su afirmación, que cuando habla usted de combustible SOLAMENTE se refiere al RP-1 y no a la mezcla RP-1 con el oxidante LOX. Si usted se refiriese a la mezcla el error sería muchísimo peor.

3785 litros de RP-1 son 3785*0.806 = 3050.71 kg

2.27 kg de LOX se mezclan con 1 kg de RP-1

3050.71 kg de RP-1 se mezclan con 3050.71*2.27 = 6925.1117 kg de LOX

En total tenemos 3050.71+6925.1117 = 9975.8217 kg/s

Teniendo en cuenta el impulso específico 265.4 segundos de los 5 motores F-1 de la primera etapa, ya podemos calcular el empuje obtenido en el momento del lanzamiento

Empuje = (9975.8217 kg/s)*(265.4*9.81 m/s) = 25972790.0068 N =~ 25.97E6 N

Un rápido cálculo del peso del Saturno V en el lanzamiento en la misión Apolo 11 resulta

Peso = 2941.12E3*9.81 = 28852387.2 N =~ 28.85E6 N

Como se puede comprobar EL PESO ES MAYOR QUE EL EMPUJE.

Por tanto con sus 3785 litros de combustible por segundo en el lanzamiento, cuando la cuenta atrás llegase a cero, el Saturno V se quedaría clavado sin elevarse ni un solo milímetro. Estaría así SIN MOVERSE desperdiciando combustible hasta que el empuje comenzase a ser mayor que el peso. Eso ocurriría exactamente después de (28852387.2-25972790.0068)/(9.81*9975.8217) = 29.43 segundos, casi medio minuto. Después de todo ese tiempo empezaría a elevarse EXTREMADAMENTE DESPACIO. Pero voy a dejar los cálculos aquí.

Ojalá este mensaje le sirva de ayuda.


Reciba usted un cordial saludo desde Madrid.

Tuesday, August 14, 2012

In the Apollo 11 mission the Saturn V didn't have sufficient fuel

I have demonstrated with the previous message (multistage.c) that the Saturn V in the Apollo 11 mission didn't have sufficient fuel to reach the escape velocity towards the Moon. Hereunder I comment briefly as it has been demonstrated.

Suppose that the Moon in its orbit is at the minimum distance from the Earth, that is the case most favorable or of the least fuel consumption. Suppose also that the Moon doesn't move relative to the Earth. Although this doesn't have physical sense it has mathematical sense, because it is a case more favorable or of less fuel consumption, as the Moon exerts its maximum attraction over the Saturn V constantly and this facilitates the ascent of the Saturn V. Suppose that the Saturn V travels in a straight line from the Earth towards the Moon. This is the trajectory most favorable or of the least fuel consumption to reach the escape velocity towards the Moon. Remember that the gravitational force is conservative. Besides, although the acceleration suffered by the astronauts in the Apollo 11 mission was variable below 5*g, most of the time below 3*g, suppose that the Saturn V moves in such a manner that the astronauts suffer an acceleration much higher constant 5*g, that sustained during more than 30 seconds surely is deadly. As the ascent acceleration is higher during all the time that the engines are turned on, the fuel consumption necessary to reach the escape velocity towards the Moon is less.

It results that IN THIS CASE MUCH MORE FAVORABLE (Moon at minimum distance, Moon without movement, Saturn V travels in a straight line, Saturn V travels with acceleration much higher constant 5*g over the astronauts) THE SATURN V DOESN'T HAVE SUFFICIENT FUEL TO REACH THE MOON. This can be checked running the program multistage.c of the previous message. As immediate consequence in any case less favorable than this the Saturn V doesn't have sufficient fuel to reach the Moon. THEREFORE, IN THE APOLLO 11 MISSION THE SATURN V DIDN'T HAVE SUFFICIENT FUEL TO REACH THE MOON.

The absence of fuel is produced in the stage 3 (S-IVB stage), when the J-2 engine exhausts its 107572 kg (237155 pounds) of fuel before to reach the escape velocity towards the Moon.




[In Spanish]

He demostrado con el mensaje anterior (multistage.c) que el Saturn V en la misión Apollo 11 no tenía combustible suficiente para alcanzar la velocidad de escape hacia la Luna. A continuación comento brevemente como se ha demostrado.

Supón que la Luna en su órbita está a la distancia mínima de la Tierra, que es el caso más favorable o de menor gasto de combustible. Supón también que la Luna no se mueve respecto a la Tierra. Aunque esto último no tiene sentido físico sí tiene sentido matemático, porque es un caso más favorable o de menor gasto de combustible, ya que la Luna ejerce su atracción máxima sobre el Saturn V constantemente y esto facilita el ascenso del Saturn V. Supón que el Saturn V viaja en línea recta desde la Tierra hacia la Luna. Esta es la trayectoria más favorable o de menor gasto de combustible para alcanzar la velocidad de escape hacia la Luna. Recuerda que la fuerza gravitacional es conservativa. Además, aunque la aceleración sufrida por los astronautas en la misión Apollo 11 era variable por debajo de 5*g, la mayor parte del tiempo por debajo de 3*g, supón que el Saturn V se mueve de tal manera que los astronautas sufren una aceleración mucho mayor constante 5*g, que sostenida durante más de 30 segundos seguramente es mortal. Ya que es mayor la aceleración de ascenso durante todo el tiempo que los motores están encendidos, el consumo de combustible necesario para alcanzar la velocidad de escape hacia la Luna es menor.

Resulta que EN ESTE CASO MUCHO MÁS FAVORABLE (Luna a distancia mínima, Luna sin movimiento, Saturn V viaja en línea recta, Saturn V viaja con aceleración mucho mayor contante 5*g sobre los astronautas) EL SATURN V NO TIENE SUFICIENTE COMBUSTIBLE PARA ALCANZAR LA LUNA. Esto se puede comprobar ejecutando el programa multistage.c del mensaje anterior. Como consecuencia inmediata en cualquier caso menos favorable que este el Saturn V no tiene suficiente combustible para alcanzar la Luna. POR TANTO, EN LA MISIÓN APOLLO 11 EL SATURN V NO TENÍA SUFICIENTE COMBUSTIBLE PARA ALCANZAR LA LUNA.

La falta de combustible se produce en la etapa 3 (etapa S-IVB), cuando el motor J-2 agota sus 107572 kg (237155 pounds) de combustible antes de alcanzar la velocidad de escape hacia la Luna.

Thursday, August 09, 2012

multistage.c

#define AA 49.05 // aceleración soportada por los astronautas 5*g (letal en pocos segundos)
#define SPECIFIC_IMPULSE_F1 265.4
#define SPECIFIC_IMPULSE_J2 426.0
#define SPECIFIC_IMPULSE_SPACECRAFT 452.0 // inventado por el momento (se ha buscado el valor más alto posible)
#define EV_F1 SPECIFIC_IMPULSE_F1*9.81
#define EV_J2 SPECIFIC_IMPULSE_J2*9.81
#define EV_XX SPECIFIC_IMPULSE_SPACECRAFT*9.81
#define THRUST_F1 6.7725E6
#define THRUST_J2 1033.5E3
#define MC 2941.12E3 // masa del cohete Saturn V (misión Apollo 11) 2941.12 toneladas
#define S_IC_STAGE_EXPENDABLES 2149.72E3
#define FIRST_STAGE_INERT_WEIGHT 130975.0+5200.44
#define S_II_STAGE_EXPENDABLES 444752.0
#define SECOND_STAGE_INERT_WEIGHT 36251.1+3665.03
#define S_IVB_STAGE_EXPENDABLES 107572.0
#define THIRD_STAGE_INERT_WEIGHT 11339.8+1952.72
#define SPACECRAFT_INERT_WEIGHT 20538.7
#define DT 0.1 // incremento de tiempo por iteración de cálculo 0.1 segundos

#define MT 5.97E24 // masa de la Tierra
#define RT 6.379E6 // radio de la Tierra
#define ML 7.35E22 // masa de la Luna
#define RL 1.739E6 // radio de la Luna
#define DTL 356400E3 // distancia Tierra-Luna (entre los centros de masas)
#define GG 6.67259E-11 // constante de gravitación universal



#include <math.h>
#include <stdio.h>
#include <stdlib.h>



int main(int argc, char **argv) {
  double mm; // masa restante del cohete
  double mg; // masa de gas expulsada en iteración
  double mc; // masa de combustible consumido en la etapa
  double mi; // masa inerte en la etapa
  double ee; // empuje del cohete
  double ff; // fuerza sobre el cohete
  double aa; // aceleración del cohete
  double vvi; // velocidad inicial del cohete
  double vvf; // velocidad final del cohete
  double rri; // posición inicial del cohete
  double rrf; // posición final del cohete
  double tt; // tiempo
  double rr2; // posición donde se anulan las fuerzas
  double vescape; // velocidad de escape
  double EV; // "exhaust velocity" de los gases
  int etapa;

  rr2 = (DTL*(MT-sqrt(MT*ML)))/(MT-ML);

  tt = 0.0;
  mm = MC;
  mc = 0.0;
  vvi = 0.0;
  rri = RT;
  etapa = 1;
  EV = EV_F1;
  mi = FIRST_STAGE_INERT_WEIGHT + SECOND_STAGE_INERT_WEIGHT + THIRD_STAGE_INERT_WEIGHT + SPACECRAFT_INERT_WEIGHT;
  do {
    mg = (DT*mm*AA)/(EV+DT*AA);

    mm = mm - mg;
    mc = mc + mg;

    ee = mg*EV/DT;
    ff = ee + GG*(mm*ML)/pow(DTL-rri,2.0) - GG*(mm*MT)/pow(rri,2.0);
    aa = ff/mm;
    vvf = aa*DT + vvi;
    rrf = aa*pow(DT,2.0)/2.0 + vvi*DT + rri;

    vescape = sqrt(2.0*GG*(MT*(1.0/rrf - 1.0/rr2) + ML*(1.0/(DTL-rrf) - 1.0/(DTL-rr2))));

    tt = tt + DT;

    printf("Etapa : %d\n", etapa);
    printf("Tiempo : %g [s]\n", tt);
    printf("Velocidad de salida de los gases respecto al cohete : %g [m/s]\n", EV);
    printf("Masa de gas expulsada por segundo : %g [kg/s]\n", mg/DT);
    printf("Masa restante del cohete : %g [kg]\n", mm);
    printf("Masa restante del cohete (porcentaje) : %g [%%]\n", mm/MC*100.0);
    printf("Masa inerte del cohete en esta etapa: %g [kg]\n", mi);
    if (etapa == 1) {
      printf("Empuje del cohete : %g [N] (%g motores F-1)\n", ee, ee/THRUST_F1);
    } else if ((etapa == 2) || (etapa == 3)) {
      printf("Empuje del cohete : %g [N] (%g motores J-2)\n", ee, ee/THRUST_J2);
    } else {
      printf("Empuje del cohete : %g [N]\n", ee);
    }
    printf("Fuerza total sobre el cohete : %g [N]\n", ff);
    printf("Aceleración sufrida por los astronautas : %g [m/(s^2)]\n", AA);
    printf("Aceleración del cohete : %g [m/(s^2)]\n", aa);
    printf("Velocidad del cohete : %g [m/s]\n", vvf);
    printf("Velocidad del cohete (km/h) : %g [km/h]\n", vvf/1000.0*3600.0);
    printf("Velocidad de escape : %g [m/s]\n", vescape);
    printf("Velocidad de escape (km/h) : %g [km/h]\n", vescape/1000.0*3600.0);
    printf("Posición del cohete : %g [m]\n", rrf);
    printf("Altura del cohete sobre la superficie de la Tierra : %g [m]\n", rrf-RT);
    printf("Altura del cohete sobre la superficie de la Tierra (km) : %g [km]\n", (rrf-RT)/1000.0);
    printf("Distancia del cohete a la superficie de la Luna : %g [m]\n", DTL-rrf-RL);
    printf("Distancia del cohete a la superficie de la Luna (km) : %g [km]\n\n", (DTL-rrf-RL)/1000.0);

    switch (etapa) {
      case 1:
        if (mc >= S_IC_STAGE_EXPENDABLES) {
          printf("AGOTADO COMBUSTIBLE DE LA PRIMERA ETAPA: %g [kg]\n", S_IC_STAGE_EXPENDABLES);
          printf("APAGADOS LOS 5 MOTORES F-1 DE LA PRIMERA ETAPA\n");
          mm = mm - FIRST_STAGE_INERT_WEIGHT;
          mi = SECOND_STAGE_INERT_WEIGHT + THIRD_STAGE_INERT_WEIGHT + SPACECRAFT_INERT_WEIGHT;
          printf("LIBERADO PESO INERTE DE LA PRIMERA ETAPA: %g [kg]\n", FIRST_STAGE_INERT_WEIGHT);
          printf("Masa restante del cohete : %g [kg]\n", mm);
          printf("Masa restante del cohete (porcentaje) : %g [%%]\n", mm/MC*100.0);
          EV = EV_J2;
          printf("ENCENDIDOS LOS 5 MOTORES J-2 DE LA SEGUNDA ETAPA\n\n");
          mc = 0.0;
          etapa = 2;
        }
        break;

      case 2:
        if (mc >= S_II_STAGE_EXPENDABLES) {
          printf("AGOTADO COMBUSTIBLE DE LA SEGUNDA ETAPA: %g [kg]\n", S_II_STAGE_EXPENDABLES);
          printf("APAGADOS LOS 5 MOTORES J-2 DE LA SEGUNDA ETAPA\n");
          mm = mm - SECOND_STAGE_INERT_WEIGHT;
          mi = THIRD_STAGE_INERT_WEIGHT + SPACECRAFT_INERT_WEIGHT;
          printf("LIBERADO PESO INERTE DE LA SEGUNDA ETAPA: %g [kg]\n", SECOND_STAGE_INERT_WEIGHT);
          printf("Masa restante del cohete : %g [kg]\n", mm);
          printf("Masa restante del cohete (porcentaje) : %g [%%]\n", mm/MC*100.0);
          printf("ENCENDIDO EL MOTOR J-2 DE LA TERCERA ETAPA\n\n");
          mc = 0.0;
          etapa = 3;
        }
        break;

      case 3:
        if (mc >= S_IVB_STAGE_EXPENDABLES) {
          printf("AGOTADO COMBUSTIBLE DE LA TERCERA ETAPA: %g [kg]\n", S_IVB_STAGE_EXPENDABLES);
return 0;
          printf("APAGADO MOTOR J-2 DE LA TERCERA ETAPA\n");
          mm = mm - THIRD_STAGE_INERT_WEIGHT;
          mi = SPACECRAFT_INERT_WEIGHT;
          printf("LIBERADO PESO INERTE DE LA TERCERA ETAPA: %g [kg]\n", THIRD_STAGE_INERT_WEIGHT);
          printf("Masa restante del cohete : %g [kg]\n", mm);
          printf("Masa restante del cohete (porcentaje) : %g [%%]\n", mm/MC*100.0);
          EV = EV_XX;
          printf("ENCENDIDO EL MOTOR DE LA CUARTA ETAPA (ASTRONAVE)\n");
          printf("¡¡¡USANDO COMBUSTIBLE NECESARIO PARA EL VIAJE DE RETORNO!!!\n\n");
          mc = 0.0;
          etapa = 4;
        }
    }

    vvi = vvf;
    rri = rrf;
  } while ((vvf < vescape) && (mm > mi));

  if (vvf >= vescape) {
    printf("ALCANZADA VELOCIDAD DE ESCAPE\n\n");
  } else if (mm <= mi) {
    printf("COMBUSTIBLE ACABADO ANTES DE ALCANZAR LA VELOCIDAD DE ESCAPE\n\n");
  }

  return 0;
}




 


Etapa : 3
Tiempo : 235.852 [s]
Velocidad de salida de los gases respecto al cohete : 4179.06 [m/s]
Masa de gas expulsada por segundo : 947.176 [kg/s]
Masa restante del cohete : 80699.4 [kg]
Masa restante del cohete (porcentaje) : 2.74383 [%]
Masa inerte del cohete en esta etapa: 33831.2 [kg]
Empuje del cohete : 3.95831e+006 [N] (3.83 motores J-2)
Fuerza total sobre el cohete : 3.38454e+006 [N]
Aceleración sufrida por los astronautas : 49.05 [m/(s^2)]
Aceleración del cohete : 41.94 [m/(s^2)]
Velocidad del cohete : 9489.73 [m/s]
Velocidad del cohete (km/h) : 34163 [km/h]
Velocidad de escape : 10183.7 [m/s]
Velocidad de escape (km/h) : 36661.3 [km/h]
Posición del cohete : 7.48513e+006 [m]
Altura del cohete sobre la superficie de la Tierra : 1.10613e+006 [m]
Altura del cohete sobre la superficie de la Tierra (km) : 1106.13 [km]
Distancia del cohete a la superficie de la Luna : 3.47176e+008 [m]
Distancia del cohete a la superficie de la Luna (km) : 347176 [km]

AGOTADO COMBUSTIBLE DE LA TERCERA ETAPA: 107572 [kg]


NOTA: He usado DT con valor 0.001 segundos en lugar de 0.1 segundos.

NOTA: He actualizado el impulso específico de los motores F-1 y J-2 con unos valores un poco más altos que he encontrado en un documento de la NASA. Pongo a continuación los enlaces a los parámetros del motor F-1 y del motor J-2 extraídos de ese documento.

Thursday, August 02, 2012

La altura de los saltos en la Luna



Las personas en la Luna pesan aproximadamente un 16.57 % de lo que pesan en la Tierra. Esto se debe a que la Luna tiene menos masa que la Tierra.

(ML*RT^2)/(MT*RL^2)*100 = 16.56605307 %

Un astronauta de 80 kg en la Luna tendría la impresión de que tiene una masa de 13.25 kg, y obviamente seguiría siendo igual de grande e igual de fuerte.

Un salto vertical de hT metros de altura realizado por una persona en la Tierra en la Luna tendría una altura hL aproximada 6 veces mayor. La fórmula exacta se calcula teniendo en cuenta que la variación de la energía potencial del salto en la Tierra es igual que la variación de la energía potencial del salto en la Luna. La ecuación que se obtiene es la siguiente:

-GG*mm*MT/(RT+hT)+GG*mm*MT/RT = -GG*mm*ML/(RL+hL)+GG*mm*ML/RL

Despejando hL en función de hT se obtiene lo siguiente:

hL = MT*RL^2*hT/(-MT*RL*hT+ML*RT^2+ML*RT*hT)

hL = -(47000.*(-1.28839000*10^8+1.540375613*10^11*hT)) / (-1.199343378*10^15+3.975163007*10^9*hT)



 
Así, un salto vertical de 0.4 metros de altura en la Tierra en la Luna tendría 2.41 metros.

Un salto vertical de 0.2 metros de altura en la Tierra en la Luna tendría 1.2 metros.

Un salto vertical de 0.1 metros de altura en la Tierra en la Luna tendría 0.6 metros.

Un salto vertical de 0.05 metros de altura en la Tierra en la Luna tendría 0.3 metros.

Viendo los videos de la misión Apollo 11 con los astronautas en la Luna se observa que los astronautas saltan muy poco. Casi nunca saltan más de 10 o 20 centímetros. ¿Por qué?




Según Nasa:

"24. A spacesuit weighs approximately 280 pounds on the ground -- without the astronaut in it. In the microgravity environment of space, a spacesuit weighs nothing."

Fuente: http://www.nasa.gov/audience/foreducators/spacesuits/facts/facts-index.html

280 pounds son unos 127 kg (127.006 kg).

Monday, July 23, 2012

The amount of fuel of the Saturn V was not sufficient

Using exhaust_velocity2.c source code, we write these values at the beginning:


#define AA 49.05 // aceleración soportada por los astronautas 5*g (letal en pocos segundos)
#define EV 3.0E3 // "exhaust velocity" de los gases 3 km/s (2.5 km/s en 1969)
#define MC 2941.12E3 // masa del cohete Saturn V (misión Apollo 11) 2941.12 toneladas
#define DT 0.001 // incremento de tiempo por iteración de cálculo 0.001 segundos



This means that we calculate the case much more favorable (although not possible) in which the Saturn V moves according to a single stage while has fuel with constant maximum acceleration 5*g supported by the astronauts, that is an acceleration surely too high so that the human being can survive more than 30 seconds, and with an "exhaust velocity" of the gases of 3 km/s, that is higher than the value used by the Saturn V engines in 1969 (about 2.5 km/s).

Specific impulse (Isp)
F-1 engines: Isp = 263 [s]
J-2 engines: Isp = 421 [s]
"Exhaust velocity" of the gases (EV)
F-1 engines: EV = 263*9.81 = 2580.03 [m/s]
J-2 engines: EV = 421*9.81 = 4130.01 [m/s]
F-1 engines uses about 78.7 % of the fuel


In this case much more favorable the inert weight that would be released in the stages if the rocket was multistage is considered fuel that we continue using with a single stage.


Remember that the gravitational force is conservative, and the increase of mechanical energy (potential energy + kinetic energy) of the rocket only comes from the fuel consumption of the rocket.


We compile it:

[Windows VC++]
cl /EHsc exhaust_velocity2.c

[Linux]
gcc exhaust_velocity2.c -o exhaust_velocity2


We execute it:

exhaust_velocity2 > results.txt


We obtain a file results.txt of 215 MBytes. At the end of this file we can read:

Tiempo : 250.07 [s]
Velocidad de salida de los gases respecto al cohete : 3000 [m/s]
Masa de gas expulsada por segundo : 806.064 [kg/s]
Masa restante del cohete : 49300.5 [kg]
Masa restante del cohete (porcentaje) : 1.67625 [%]
Empuje del cohete : 2.41819e+006 [N]
Fuerza total sobre el cohete : 2.08034e+006 [N]
Aceleración sufrida por los astronautas : 49.05 [m/(s^2)]
Aceleración del cohete : 42.1972 [m/(s^2)]
Velocidad del cohete : 10087.9 [m/s]
Velocidad del cohete (km/h) : 36316.3 [km/h]
Velocidad de escape : 10087.9 [m/s]
Velocidad de escape (km/h) : 36316.3 [km/h]
Posición del cohete : 7.62431e+006 [m]
Altura del cohete sobre la superficie de la Tierra : 1.24531e+006 [m]
Altura del cohete sobre la superficie de la Tierra (km) : 1245.31 [km]
Distancia del cohete a la superficie de la Luna : 3.47037e+008 [m]
Distancia del cohete a la superficie de la Luna (km) : 347037 [km]


NOTE: The rocket thrust in this case is much greater than the supported by the engines during much of the ascent. We can reduce the thrust reducing the ascent acceleration, but then we increase the fuel consumption necessary to reach the Moon.


If we add the inert weight remaining and the fuel for the return we obtain:

25000+4305+4045+33200+51160+12250+8910 = 138870 [pounds] = 62990.4 [kg]

But

49300.5 [kg] < 62990.4 [kg]

Then we can say that in this case much more favorable there is not sufficient fuel to reach the Moon.

As consequence immediate in any case less favorable than this there is not sufficient fuel to reach the Moon.

Therefore in the Apollo 11 mission there was not sufficient fuel to reach the Moon.

Sunday, July 22, 2012

Saturn V inert weight or dry weight or weight without fuel



S-IC Stage: 288750 [pounds] = 130975 [kg]
S-IC/S-II Interstage: 11465 [pounds] = 5200.44 [kg]
S-II Stage: 79920 [pounds] = 36251.1 [kg]
S-II/S-IVB Interstage: 8080 [pounds] = 3665.03 [kg]
S-IVB Stage: 25000 [pounds] = 11339.8 [kg]
Instrument Unit: 4305 [pounds] = 1952.72 [kg]

Spacecraft-LM Adapter: 4045 [pounds] = 1834.78 [kg]
Lunar Module: 9520 [pounds] = 4318.2 [kg]
Service Module: 10555 [pounds] = 4787.67 [kg]
Command Module: 12250 [pounds] = 5556.51 [kg]
Launch Escape System: 8910 [pounds] = 4041.51 [kg]

Saturn V total inert weight: 462800 [pounds] = 209923 [kg]


Saturn V total weight at ignition: 6484070 [pounds] = 2941.12E3 [kg]


462800/6484070*100 = 7.13749 [%]


AT LEAST A 7 % OF THE SATURN V MASS AT IGNITION WAS NOT FUEL.

Saturn V


Friday, July 20, 2012

exhaust_velocity2.c

#define AA 49.05 // aceleración soportada por los astronautas 5*g (letal en pocos segundos)
#define EV 3.0E3 // "exhaust velocity" de los gases 3 km/s (2.5 km/s en 1969)
#define MC 2941.12E3 // masa del cohete Saturn V (misión Apollo 11) 2941.12 toneladas
#define DT 0.1 // incremento de tiempo por iteración de cálculo 0.1 segundos

#define MT 5.97E24 // masa de la Tierra
#define RT 6.379E6 // radio de la Tierra
#define ML 7.35E22 // masa de la Luna
#define RL 1.739E6 // radio de la Luna
#define DTL 356400E3 // distancia Tierra-Luna (entre los centros de masas)
#define GG 6.67259E-11 // constante de gravitación universal



#include <math.h>
#include <stdio.h>
#include <stdlib.h>



int main(int argc, char **argv) {
  double mm; // masa restante del cohete
  double mg; // masa de gas expulsada en iteración
  double ff; // fuerza sobre el cohete
  double aa; // aceleración del cohete
  double vvi; // velocidad inicial del cohete
  double vvf; // velocidad final del cohete
  double rri; // posición inicial del cohete
  double rrf; // posición final del cohete
  double tt; // tiempo
  double rr2; // posición donde se anulan las fuerzas
  double vescape; // velocidad de escape

  rr2 = (DTL*(MT-sqrt(MT*ML)))/(MT-ML);

  tt = 0.0;
  mm = MC;
  vvi = 0.0;
  rri = RT;
  do {
    mg = (DT*mm*AA)/(EV+DT*AA);

    mm = mm - mg;

    ff = mg*EV/DT + GG*(mm*ML)/pow(DTL-rri,2.0) - GG*(mm*MT)/pow(rri,2.0);
    aa = ff/mm;
    vvf = aa*DT + vvi;
    rrf = aa*pow(DT,2.0)/2.0 + vvi*DT + rri;

    vescape = sqrt(2.0*GG*(MT*(1.0/rrf - 1.0/rr2) + ML*(1.0/(DTL-rrf) - 1.0/(DTL-rr2))));

    tt = tt + DT;

    printf("Tiempo : %g [s]\n", tt);
    printf("Velocidad de salida de los gases respecto al cohete : %g [m/s]\n", EV);
    printf("Masa de gas expulsada por segundo : %g [kg/s]\n", mg/DT);
    printf("Masa restante del cohete : %g [kg]\n", mm);
    printf("Masa restante del cohete (porcentaje) : %g [%%]\n", mm/MC*100.0);
    printf("Empuje del cohete : %g [N]\n", mg*EV/DT);
    printf("Fuerza total sobre el cohete : %g [N]\n", ff);
    printf("Aceleración sufrida por los astronautas : %g [m/(s^2)]\n", AA);
    printf("Aceleración del cohete : %g [m/(s^2)]\n", aa);
    printf("Velocidad del cohete : %g [m/s]\n", vvf);
    printf("Velocidad del cohete (km/h) : %g [km/h]\n", vvf/1000.0*3600.0);
    printf("Velocidad de escape : %g [m/s]\n", vescape);
    printf("Velocidad de escape (km/h) : %g [km/h]\n", vescape/1000.0*3600.0);
    printf("Posición del cohete : %g [m]\n", rrf);
    printf("Altura del cohete sobre la superficie de la Tierra : %g [m]\n", rrf-RT);
    printf("Altura del cohete sobre la superficie de la Tierra (km) : %g [km]\n", (rrf-RT)/1000.0);
    printf("Distancia del cohete a la superficie de la Luna : %g [m]\n", DTL-rrf-RL);
    printf("Distancia del cohete a la superficie de la Luna (km) : %g [km]\n\n", (DTL-rrf-RL)/1000.0);

    vvi = vvf;
    rri = rrf;
  } while (vvf < vescape);

  return 0;
}






Friday, April 20, 2012

Lunar Orbit Rendezvous

Vídeo filmado en el interior de la exposición de la NASA en Madrid titulada "La aventura del espacio" el día 08/01/2012.

Tuesday, January 24, 2012