From b2500526fa38b98605b7a2345190ec55b9cad2a5 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Fri, 3 May 2002 12:00:00 +0200 Subject: Update C code to include changes up to Official Beta Release 2.0 Update C code to include changes up to Official Beta Release 2.0 (NRLMSISE-00.DIST17.TXT). Signed-off-by: Dominik Brodowski --- DOCUMENTATION | 8 +++----- nrlmsise-00.c | 43 +++++++++++++++++++++++++++++++++++++------ nrlmsise-00.h | 2 +- nrlmsise-00_data.c | 16 ++++++++-------- nrlmsise-00_test.c | 2 +- 5 files changed, 50 insertions(+), 21 deletions(-) diff --git a/DOCUMENTATION b/DOCUMENTATION index 5562a2c..3128320 100644 --- a/DOCUMENTATION +++ b/DOCUMENTATION @@ -65,10 +65,8 @@ http://uap-www.nrl.navy.mil/models_web/msis/msis_home.htm Based on the Official Beta Release 1.0 (NRLMSISE-00.DIST12.TXT) Dominik Brodowski wrote an implementation in C which is available on http://www.brodo.de/english/pub/nrlmsise/ -Please check for updates often during the next weeks, since the C -package probably has some bugs. Additionally, some modifications -to the NRLMSISE-00 FORTRAN package will be published soon, and I'll -try to update the C package accordingly within a few days. +This release is based on the Official Beta Release 2.0 +(NRLMSISE-00.DIST17.TXT). @@ -245,6 +243,6 @@ double variables are used, this value reduces to 0.000E-00 as well. ======================================================== -Rosenheim, Germany, on March 5th, 2002 +Tuebingen, Germany, on May 2nd, 2002 Dominik Brodowski diff --git a/nrlmsise-00.c b/nrlmsise-00.c index 73a8062..17413d0 100644 --- a/nrlmsise-00.c +++ b/nrlmsise-00.c @@ -3,7 +3,7 @@ /* -------------------------------------------------------------------- */ /* This file is part of the NRLMSISE-00 C source code package - release - * 20020305 + * 20020503 * * The NRLMSISE-00 model was developed by Mike Picone, Alan Hedin, and * Doug Drob. They also wrote a NRLMSISE-00 distribution package in @@ -139,6 +139,35 @@ double ccor(double alt, double r, double h1, double zh) { +/* ------------------------------------------------------------------- */ +/* ------------------------------ CCOR ------------------------------- */ +/* ------------------------------------------------------------------- */ + +double ccor2(double alt, double r, double h1, double zh, double h2) { +/* CHEMISTRY/DISSOCIATION CORRECTION FOR MSIS MODELS + * ALT - altitude + * R - target ratio + * H1 - transition scale length + * ZH - altitude of 1/2 R + * H2 - transition scale length #2 ? + */ + double e1, e2; + double ex1, ex2; + double ccor2v; + e1 = (alt - zh) / h1; + e2 = (alt - zh) / h2; + if ((e1 > 70) || (e2 > 70)) + return exp(0); + if ((e1 < -70) && (e2 < -70)) + return exp(r); + ex1 = exp(e1); + ex2 = exp(e2); + ccor2v = r / (1.0 + 0.5 * (ex1 + ex2)); + return exp(ccor2v); +} + + + /* ------------------------------------------------------------------- */ /* ------------------------------- SCALH ----------------------------- */ /* ------------------------------------------------------------------- */ @@ -1145,7 +1174,6 @@ void gts7(struct nrlmsise_input *input, struct nrlmsise_flags *flags, struct nrl double g28, g4, g16, g32, g40, g1, g14; double zhf, xmm; double zc04, zc16, zc32, zc40, zc01, zc14; - double uc04; double hc04, hc16, hc32, hc40, hc01, hc14; double hcc16, hcc32, hcc01, hcc14; double zcc16, zcc32, zcc01, zcc14; @@ -1157,6 +1185,7 @@ void gts7(struct nrlmsise_input *input, struct nrlmsise_flags *flags, struct nrl double alpha[9]={-0.38, 0.0, 0.0, 0.0, 0.17, 0.0, -0.38, 0.0, 0.0}; double altl[8]={200.0, 300.0, 160.0, 250.0, 240.0, 450.0, 320.0, 450.0}; double dd; + double hc216, hcc232; za = pdl[1][15]; zn1[0] = za; for (j=0;j<9;j++) @@ -1239,7 +1268,7 @@ void gts7(struct nrlmsise_input *input, struct nrlmsise_flags *flags, struct nrl /* Diffusive density at Alt */ output->d[0]=densu(z,db04,tinf,tlb, 4.,alpha[0],&output->t[1],ptm[5],s,mn1,zn1,meso_tn1,meso_tgn1); dd=output->d[0]; - if ((flags->sw[15]) && (z<=altl[0])) { + if ((flags->sw[15]) && (zd[0]=output->d[0]*ccor(z,rl,hc04,zc04); } @@ -1280,7 +1309,8 @@ void gts7(struct nrlmsise_input *input, struct nrlmsise_flags *flags, struct nrl rl=pdm[1][1]*pdl[1][16]*(1.0+flags->sw[1]*pdl[0][23]*(input->f107A-150.0)); hc16=pdm[1][5]*pdl[1][3]; zc16=pdm[1][4]*pdl[1][2]; - output->d[1]=output->d[1]*ccor(z,rl,hc16,zc16); + hc216=pdm[1][5]*pdl[1][4]; + output->d[1]=output->d[1]*ccor2(z,rl,hc16,zc16,hc216); /* Chemistry correction */ hcc16=pdm[1][7]*pdl[1][13]; zcc16=pdm[1][6]*pdl[1][12]; @@ -1318,10 +1348,11 @@ void gts7(struct nrlmsise_input *input, struct nrlmsise_flags *flags, struct nrl } /* Correction for general departure from diffusive equilibrium above Zlb */ hcc32=pdm[3][7]*pdl[1][22]; + hcc232=pdm[3][7]*pdl[0][22]; zcc32=pdm[3][6]*pdl[1][21]; rc32=pdm[3][3]*pdl[1][23]*(1.+flags->sw[1]*pdl[0][23]*(input->f107A-150.)); /* Net density corrected at Alt */ - output->d[3]=output->d[3]*ccor(z,rc32,hcc32,zcc32); + output->d[3]=output->d[3]*ccor2(z,rc32,hcc32,zcc32,hcc232); } diff --git a/nrlmsise-00.h b/nrlmsise-00.h index 842a4b0..bd75fe6 100644 --- a/nrlmsise-00.h +++ b/nrlmsise-00.h @@ -3,7 +3,7 @@ /* -------------------------------------------------------------------- */ /* This file is part of the NRLMSISE-00 C source code package - release - * 20020305 + * 20020503 * * The NRLMSISE-00 model was developed by Mike Picone, Alan Hedin, and * Doug Drob. They also wrote a NRLMSISE-00 distribution package in diff --git a/nrlmsise-00_data.c b/nrlmsise-00_data.c index 610cd16..6943992 100644 --- a/nrlmsise-00_data.c +++ b/nrlmsise-00_data.c @@ -3,7 +3,7 @@ /* -------------------------------------------------------------------- */ /* This file is part of the NRLMSISE-00 C source code package - release - * 20020305 + * 20020503 * * The NRLMSISE-00 model was developed by Mike Picone, Alan Hedin, and * Doug Drob. They also wrote a NRLMSISE-00 distribution package in @@ -182,7 +182,7 @@ double pd[9][150] = { 0.00000E+00, 0.00000E+00, 0.00000E+00, 0.00000E+00, 0.00000E+00, 0.00000E+00, 0.00000E+00, 0.00000E+00, 0.00000E+00, 0.00000E+00 }, /* O2 DENSITY */ { - 1.38720E+00, 1.44816E-01, 0.00000E+00, 6.07767E-02, 0.00000E+00, + 1.35580E+00, 1.44816E-01, 0.00000E+00, 6.07767E-02, 0.00000E+00, 2.94777E-02, 7.46900E-02, 0.00000E+00,-9.23822E-02, 8.57342E-02, 0.00000E+00, 0.00000E+00, 0.00000E+00, 2.38636E+01, 0.00000E+00, 7.71653E-02, 0.00000E+00, 8.18751E+01, 1.87736E-02, 0.00000E+00, @@ -377,12 +377,12 @@ double pdl[2][25] = { 4.63830E+00, 1.00000E+00, 0.00000E+00, 0.00000E+00, 0.00000E+00, 0.00000E+00, 0.00000E+00, 0.00000E+00, 0.00000E+00, 0.00000E+00, 0.00000E+00, 0.00000E+00, 0.00000E+00, 0.00000E+00, 0.00000E+00, - 0.00000E+00, 0.00000E+00, 0.00000E+00, 2.93318E-02, 1.18339E-01 }, - { 1.22732E+00, 1.02669E-01, 1.17681E+00, 2.12185E+00, 1.00000E+00, - 1.00000E+00, 1.08607E+00, 1.34836E+00, 1.10016E+00, 7.34129E-01, - 1.15241E+00, 2.22784E+00, 7.95907E-01, 4.03601E+00, 4.39732E+00, - 1.23435E+02,-4.52411E-02, 1.68986E-06, 7.44294E-01, 1.03604E+00, - 1.72783E+02, 1.17681E+00, 2.12185E+00,-7.83697E-01, 9.49154E-01 } + 0.00000E+00, 0.00000E+00, 1.28840E+00, 3.10302E-02, 1.18339E-01 }, + { 1.00000E+00, 7.00000E-01, 1.15020E+00, 3.44689E+00, 1.28840E+00, + 1.00000E+00, 1.08738E+00, 1.22947E+00, 1.10016E+00, 7.34129E-01, + 1.15241E+00, 2.22784E+00, 7.95046E-01, 4.01612E+00, 4.47749E+00, + 1.23435E+02,-7.60535E-02, 1.68986E-06, 7.44294E-01, 1.03604E+00, + 1.72783E+02, 1.15020E+00, 3.44689E+00,-7.46230E-01, 9.49154E-01 } }; /* LOWER BOUNDARY */ double ptm[50] = { diff --git a/nrlmsise-00_test.c b/nrlmsise-00_test.c index 28f547f..36c9487 100644 --- a/nrlmsise-00_test.c +++ b/nrlmsise-00_test.c @@ -3,7 +3,7 @@ /* -------------------------------------------------------------------- */ /* This file is part of the NRLMSISE-00 C source code package - release - * 20020305 + * 20020503 * * The NRLMSISE-00 model was developed by Mike Picone, Alan Hedin, and * Doug Drob. They also wrote a NRLMSISE-00 distribution package in -- cgit v1.2.3