Initial commit of "Rocket Workbench".

Taken from sources in CVS at:
    https://sourceforge.net/projects/rocketworkbench/

Sources extracted in two steps:
1. Pull entire project tree into a subdir "rwb" via "rsync":
    rsync -a a.cvs.sourceforge.net::cvsroot/rocketworkbench/ rwb/.
2. Export sources:
    export CVSROOT=$(pwd)/rwb
    SUBDIRS="analyser cpropep cpropep-web CVSROOT data libcompat libcpropep libnum libsimulation libthermo prop rocketworkbench rockflight"
    mkdir rwbx; cd rwbx
    cvs export -D now ${SUBDIRS}

After this (and some backups for safety), the directory content was
added to a Git repo:
    git init .
    git add *
This commit is contained in:
R. J. Dev. Kwan
2021-01-20 15:50:36 -08:00
commit eb05416991
411 changed files with 362300 additions and 0 deletions
@@ -0,0 +1,2 @@
ROOT = ../../..
include $(ROOT)/config/presrc.mk
@@ -0,0 +1,3 @@
ROOT = ../../../..
include $(ROOT)/config/makedef
include $(ROOT)/config/exesrc.mk
@@ -0,0 +1,3 @@
LIB = -lmcp -lcpropep -lthermo -lnum -lm
PROG = mcp
OBJS1 = modele.o test.o
@@ -0,0 +1,57 @@
#include <math.h>
#include <stdio.h>
#include "libmcp/include/mcp.h"
#include "libcpropep/include/equilibrium.h"
#include "libcpropep/include/performance.h"
#include "libcpropep/include/conversion.h"
#include "libcpropep/include/const.h"
int modele(int neq, double time, double *y, double *dy, void *data)
{
data_t *d; /* structure containing the data */
double ld; /* linear density of propellant kg/m */
double tmdot; /* throat mass flow rate */
double s; /* linear distance already burned (m) */
double p; /* pressure (atm) */
double t; /* thrust in Newton */
d = (data_t *) data;
s = y[0];
p = y[1];
d->e->properties.P = p;
equilibrium(d->e, HP);
frozen_performance(d->e, SUPERSONIC_AREA_RATIO, d->ea/d->ta);
ld = (d->Ab)(s) * (d->e->propellant.density * 1000); /* kg/m */
tmdot = d->ta * ATM_TO_PA / (d->e + 1)->performance.a_dotm; /* kg/s */
dy[0] = d->a * pow(p, d->n);
dy[1] = (R*1000*d->e->properties.T/(d->Vc)(s)) *
(ld*dy[0] - tmdot) / (d->e->properties.M * ATM_TO_PA);
/*
printf("%.2e %.2e %.2e %.2e %.2e\n",
time,
d->e->properties.T,
d->e->properties.M,
(d->e + 2)->performance.Isp,
tmdot*(d->e + 2)->performance.Isp);
*/
return 0;
}
@@ -0,0 +1,142 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "libnum/include/num.h"
#include "libcpropep/include/equilibrium.h"
#include "libthermo/include/thermo.h"
#include "libmcp/include/mcp.h"
#include "libthermo/include/load.h"
#include "libcpropep/include/print.h"
#define NEQ 2
#define NPOINT 300
#define STEP 0.002
double Ab(double s);
double Vc(double s);
extern int modele(int neq, double time, double *y, double *dy, void *data);
int main(int argc, char *argv[])
{
int i;
data_t data;
double temp;
double tmp2[2];
double **ans;
double *ic; /* initial conditions */
equilibrium_t *e;
char thermo_file[FILENAME_MAX] = "../cpropep/data/thermo.dat";
char propellant_file[FILENAME_MAX] = "../cpropep/data/propellant.dat";
// global_verbose = 1;
errorfile = stderr;
outputfile = stdout;
if (load_thermo (thermo_file) < 0)
{
printf("Unable to open %s\n", thermo_file);
return -1;
}
if (load_propellant (propellant_file) < 0)
{
printf("Unable to open: %s\n", propellant_file);
return -1;
}
e = (equilibrium_t *) malloc (sizeof (equilibrium_t) * 3);
for (i = 0; i < 3; i++)
{
initialize_equilibrium(e + i);
}
add_in_propellant(e, 108, GRAM_TO_MOL(78, 766)); /* NH4ClO4 */
add_in_propellant(e, 788, GRAM_TO_MOL(11, 788)); /* HTPB */
add_in_propellant(e, 34, GRAM_TO_MOL(7, 34)); /* ALU */
compute_density(&(e->propellant));
ic = (double *) malloc (sizeof(double) * NEQ);
if ( (ans = (double **) malloc (sizeof(double *) * (NPOINT+1))) == NULL)
{
printf("Problem allocating memory\n");
return -1;
}
for (i = 0; i < (NPOINT+1); i++)
{
ans[i] = (double *) malloc (sizeof(double) * NEQ);
}
ic[0] = 0;
ic[1] = 5; /* atm */
// data.a = 0.001804;
data.a = 0.0016917;
data.n = 0.35;
data.ta = M_PI * pow(0.00595/2, 2);
data.ea = M_PI * pow(0.00795/2, 2);
data.Ab = Ab;
data.Vc = Vc;
data.e = e;
// modele(2, 0, ic, tmp2, (void*)&data);
// printf("%f %f\n", tmp2[0], tmp2[1]);
/* find the solution */
printf("%d\n", Round(1.0/0.001));
NUM_rk4 (modele, NEQ, STEP, NPOINT*STEP, ic, ans, (void*)&data);
for (i = 0; i < NPOINT; i++)
{
printf("%.2e %.2e %.2e\n", i*STEP, ans[i][0], ans[i][1]);
}
printf("\n");
free(ic);
for (i = 0; i < (NPOINT+1); i++)
free(ans[i]);
free(ans);
return 0;
}
double Ab(double s)
{
double A;
if ((s >= 0) && (s < 0.01265))
A = 2 * M_PI * 0.09525 * (s + 0.00635);
else
A = 0;
return A;
}
double Vc(double s)
{
double V;
if (s < 0)
s = 0;
else if (s > 0.01265)
s = 0.01265;
V = M_PI * 0.09525 * pow(s + 0.00635, 2);
return V;
}