Eliminated the vcs_nasa_poly files from the equil solver.
Working on getting the equil solver smaller, more direct, and more documented.
This commit is contained in:
parent
2f3d97dbc0
commit
1f9e3cb24a
10 changed files with 18 additions and 614 deletions
|
|
@ -66,7 +66,7 @@ VCSNONIDEAL_OBJ = vcs_solve_TP.o vcs_VolPhase.o vcs_solve.o vcs_prob.o \
|
|||
vcs_TP.o vcs_report.o vcs_util.o \
|
||||
vcs_IntStarStar.o vcs_DoubleStarStar.o vcs_elem.o \
|
||||
vcs_elem_rearrange.o vcs_MultiPhaseEquil.o \
|
||||
vcs_nasa_poly.o vcs_nondim.o vcs_Exception.o \
|
||||
vcs_nondim.o vcs_Exception.o \
|
||||
vcs_inest.o vcs_rearrange.o \
|
||||
vcs_root1d.o vcs_rxnadj.o \
|
||||
vcs_SpeciesProperties.o vcs_equilibrate.o \
|
||||
|
|
@ -75,7 +75,7 @@ VCSNONIDEAL_OBJ = vcs_solve_TP.o vcs_VolPhase.o vcs_solve.o vcs_prob.o \
|
|||
|
||||
VCSNONIDEAL_H = vcs_internal.h vcs_VolPhase.h vcs_solve.h vcs_prob.h \
|
||||
vcs_IntStarStar.h vcs_DoubleStarStar.h vcs_defs.h \
|
||||
vcs_MultiPhaseEquil.h vcs_nasa_poly.h vcs_Exception.h \
|
||||
vcs_MultiPhaseEquil.h vcs_Exception.h \
|
||||
vcs_SpeciesProperties.h vcs_species_thermo.h
|
||||
endif
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
#include "vcs_species_thermo.h"
|
||||
#include "vcs_SpeciesProperties.h"
|
||||
#include "vcs_VolPhase.h"
|
||||
#include "vcs_nasa_poly.h"
|
||||
|
||||
#include "vcs_solve.h"
|
||||
|
||||
#include "ct_defs.h"
|
||||
|
|
@ -1315,57 +1315,8 @@ namespace VCSnonideal {
|
|||
double c[150];
|
||||
double minTemp, maxTemp, refPressure;
|
||||
sp.reportParams(k, spType, c, minTemp, maxTemp, refPressure);
|
||||
if (spType == NASA) {
|
||||
if (ts_ptr->SS0_Params) {
|
||||
if (ts_ptr->SS0_Model == VCS_SS0_NASA_POLY) {
|
||||
vcs_nasa_poly_destroy((VCS_NASA_POLY **) &(ts_ptr->SS0_Params));
|
||||
ts_ptr->SS0_Params = 0;
|
||||
}
|
||||
}
|
||||
ts_ptr->SS0_Model = VCS_SS0_NASA_POLY;
|
||||
|
||||
ts_ptr->SS0_Params = (void *)
|
||||
vcs_nasa_poly_create(2, vprob->ne);
|
||||
ts_ptr->SS0_feSave = 0.0;
|
||||
ts_ptr->SS0_TSave = -90.;
|
||||
ts_ptr->SS0_Pref = sp.refPressure();
|
||||
if (gasPhase) {
|
||||
ts_ptr->SSStar_Model = VCS_SSSTAR_IDEAL_GAS;
|
||||
ts_ptr->SSStar_Vol_Model = VCS_SSVOL_IDEALGAS;
|
||||
} else {
|
||||
ts_ptr->SSStar_Model = VCS_SSSTAR_CONSTANT;
|
||||
ts_ptr->SSStar_Vol_Model = VCS_SSVOL_CONSTANT;
|
||||
}
|
||||
ts_ptr->Activity_Coeff_Model = VCS_AC_CONSTANT;
|
||||
ts_ptr->Activity_Coeff_Params = NULL;
|
||||
VCS_NASA_POLY * poly_ptr = (VCS_NASA_POLY *)ts_ptr->SS0_Params;
|
||||
|
||||
poly_ptr->Tlimits[0] = minTemp;
|
||||
poly_ptr->Tlimits[1] = c[0];
|
||||
poly_ptr->Tlimits[2] = maxTemp;
|
||||
|
||||
/*
|
||||
* Cantera takes coefficients A5 and A6 and puts them into
|
||||
* the first and second spots in the polynomial vector.
|
||||
* Here, we reverse this operation.
|
||||
*/
|
||||
poly_ptr->Acoeff[0][0] = c[3];
|
||||
poly_ptr->Acoeff[0][1] = c[4];
|
||||
poly_ptr->Acoeff[0][2] = c[5];
|
||||
poly_ptr->Acoeff[0][3] = c[6];
|
||||
poly_ptr->Acoeff[0][4] = c[7];
|
||||
poly_ptr->Acoeff[0][5] = c[1];
|
||||
poly_ptr->Acoeff[0][6] = c[2];
|
||||
|
||||
poly_ptr->Acoeff[1][0] = c[10];
|
||||
poly_ptr->Acoeff[1][1] = c[11];
|
||||
poly_ptr->Acoeff[1][2] = c[12];
|
||||
poly_ptr->Acoeff[1][3] = c[13];
|
||||
poly_ptr->Acoeff[1][4] = c[14];
|
||||
poly_ptr->Acoeff[1][5] = c[8];
|
||||
poly_ptr->Acoeff[1][6] = c[9];
|
||||
|
||||
} else if (spType == SIMPLE) {
|
||||
if (spType == SIMPLE) {
|
||||
ts_ptr->SS0_Model = VCS_SS0_CONSTANT;
|
||||
ts_ptr->SS0_T0 = c[0];
|
||||
ts_ptr->SS0_H0 = c[1];
|
||||
|
|
|
|||
|
|
@ -333,15 +333,6 @@ void vcs_VolPhase::evaluateActCoeff() const {
|
|||
* the value of one, and never changed for this model.
|
||||
*/
|
||||
break;
|
||||
case VCS_AC_DEBYE_HUCKEL:
|
||||
plogf("Not implemented Yet\n");
|
||||
exit(-1);
|
||||
case VCS_AC_REGULAR_SOLN:
|
||||
plogf("Not implemented Yet\n");
|
||||
exit(-1);
|
||||
case VCS_AC_MARGULES:
|
||||
plogf("Not implemented Yet\n");
|
||||
exit(-1);
|
||||
default:
|
||||
plogf("%sERROR: unknown model\n", yo);
|
||||
exit(-1);
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ namespace VCSnonideal {
|
|||
*
|
||||
*/
|
||||
#define VCS_AC_CONSTANT 0
|
||||
#define VCS_AC_DEBYE_HUCKEL 23
|
||||
#define VCS_AC_REGULAR_SOLN 25
|
||||
#define VCS_AC_MARGULES 300
|
||||
//#define VCS_AC_DEBYE_HUCKEL 23
|
||||
//#define VCS_AC_REGULAR_SOLN 25
|
||||
//#define VCS_AC_MARGULES 300
|
||||
#define VCS_AC_UNK_CANTERA -1
|
||||
#define VCS_AC_UNK -2
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
#include "vcs_species_thermo.h"
|
||||
#include "vcs_SpeciesProperties.h"
|
||||
#include "vcs_VolPhase.h"
|
||||
#include "vcs_nasa_poly.h"
|
||||
#include "vcs_solve.h"
|
||||
#include "equil.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,416 +0,0 @@
|
|||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copywrite (2005) Sandia Corporation. Under the terms of
|
||||
* Contract DE-AC04-94AL85000 with Sandia Corporation, the
|
||||
* U.S. Government retains certain rights in this software.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "vcs_defs.h"
|
||||
#include "vcs_nasa_poly.h"
|
||||
#include "vcs_species_thermo.h"
|
||||
#include "vcs_internal.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning(disable:4996)
|
||||
#endif
|
||||
|
||||
namespace VCSnonideal {
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Constructor
|
||||
*/
|
||||
VCS_NASA_POLY::VCS_NASA_POLY(int numTempRegions, int numEl) :
|
||||
NumTempRegions(numTempRegions),
|
||||
NumEl(numEl),
|
||||
PhType(' ')
|
||||
{
|
||||
Date[0] = '\0';
|
||||
SpName[0] = '\0';
|
||||
PhName[0] = '\0';
|
||||
ElName.resize(numEl, "");
|
||||
ElComp.resize(numEl, 0.0);
|
||||
|
||||
if (NumTempRegions < 1) NumTempRegions = 1;
|
||||
Tlimits.resize(NumTempRegions+1, 0.0);
|
||||
Acoeff.resize(NumTempRegions, 7, 0.0);
|
||||
}
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
VCS_NASA_POLY *vcs_nasa_poly_create(int numTempRegions, int numEl)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* vcs_nasa_poly_create:
|
||||
*
|
||||
* Constructor routine for the nasa polynomial structure.
|
||||
* It initializes all data to zero. The number of temperature regions
|
||||
* malloced is storred within the structure itself.
|
||||
*
|
||||
* Input
|
||||
* numTempRegions: Number of temperature regions
|
||||
*
|
||||
* Return
|
||||
* Pointer to the newly malloced structure.
|
||||
* If NULL, then an out of memory condition occurred
|
||||
***************************************************************************/
|
||||
|
||||
{
|
||||
VCS_NASA_POLY *poly_ptr;
|
||||
poly_ptr = new VCS_NASA_POLY(numTempRegions, numEl);
|
||||
return poly_ptr;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* Copy Constructor
|
||||
*/
|
||||
VCS_NASA_POLY::VCS_NASA_POLY(const VCS_NASA_POLY &b) :
|
||||
NumTempRegions(0),
|
||||
NumEl(0)
|
||||
{
|
||||
*this = b;
|
||||
}
|
||||
/******************************************************************************
|
||||
*
|
||||
* operator=()
|
||||
*
|
||||
*/
|
||||
VCS_NASA_POLY& VCS_NASA_POLY::operator=(const VCS_NASA_POLY &b) {
|
||||
if (&b != this) {
|
||||
NumTempRegions = b.NumTempRegions;
|
||||
Tlimits = b.Tlimits;
|
||||
Acoeff = b.Acoeff;
|
||||
NumEl = b.NumEl;
|
||||
ElComp = b.ElComp;
|
||||
ElName = b.ElName;
|
||||
strcpy(Date, b.Date);
|
||||
PhType = b.PhType;
|
||||
strcpy(SpName, b.SpName);
|
||||
strcpy(PhName, b.PhName);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* ~VCS_NASA_POLY():
|
||||
*
|
||||
* Destructor for class
|
||||
*/
|
||||
VCS_NASA_POLY::~VCS_NASA_POLY() {
|
||||
}
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void vcs_nasa_poly_destroy(VCS_NASA_POLY **poly_hdl)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* vcs_nasa_poly_destroy:
|
||||
*
|
||||
* Destructor routine for the nasa polynomial structure.
|
||||
*************************************************************************/
|
||||
{
|
||||
VCS_NASA_POLY *poly_ptr = *poly_hdl;
|
||||
if (poly_ptr) {
|
||||
delete poly_ptr;
|
||||
poly_ptr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
double vcs_G0_NASA(double TKelvin, VCS_NASA_POLY *poly_ptr)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* vcs_GibbsFE_NASA:
|
||||
*
|
||||
* Calculate the Gibbs free energy (in Kelvin) for a single species
|
||||
* using the Nasa polynomial format.
|
||||
*
|
||||
* Input
|
||||
* TKelvin = Temperature in Kelvin.
|
||||
* poly_ptr = Pointer to structure containing the NASA Polynomial
|
||||
* coefficients
|
||||
*
|
||||
* Return
|
||||
* gibbsFE = Gibbs free energy / R -> units of kelvin
|
||||
*
|
||||
* Error Conditions
|
||||
* VCS_THERMO_OUTOFRANGE:
|
||||
* If the input temperature, is out of range of the polynomials,
|
||||
* an error Flag is set, and the temperature is storred in the
|
||||
* error structure.
|
||||
***************************************************************************/
|
||||
{
|
||||
int iRegion;
|
||||
double *a, gibbsFE;
|
||||
double *Tlim = VCS_DATA_PTR(poly_ptr->Tlimits);
|
||||
static double Tsave = -10., C0, C1, C2, C3, C4, C5;
|
||||
//extern CPC_ERR_STRUCT cpcE;
|
||||
/*
|
||||
* Find the temperature region
|
||||
*/
|
||||
if (TKelvin <= *Tlim) {
|
||||
#ifdef DEBUG_MODE
|
||||
plogf("vcs_G0_NASA error: TKelvin below lowest bounds %g\n", *Tlim);
|
||||
#endif
|
||||
iRegion = 0;
|
||||
|
||||
if (TKelvin <= 0.0) {
|
||||
gibbsFE = poly_ptr->Acoeff[0][5];
|
||||
return gibbsFE;
|
||||
}
|
||||
goto L_FOUNDREGION;
|
||||
}
|
||||
for (iRegion = 0; iRegion < poly_ptr->NumTempRegions; iRegion++) {
|
||||
Tlim++;
|
||||
if (TKelvin <= *Tlim) goto L_FOUNDREGION;
|
||||
}
|
||||
#ifdef DEBUG_MODE
|
||||
plogf("vcs_G0_NASA error: TKelvin above highest bounds %g\n", *(Tlim));
|
||||
#endif
|
||||
|
||||
iRegion--;
|
||||
L_FOUNDREGION:;
|
||||
a = poly_ptr->Acoeff[iRegion];
|
||||
if (Tsave != TKelvin) {
|
||||
Tsave = TKelvin;
|
||||
C0 = 1.0 - log(TKelvin);
|
||||
C1 = TKelvin * 0.5;
|
||||
C2 = TKelvin * TKelvin;
|
||||
C3 = C2 * TKelvin;
|
||||
C4 = C3 * TKelvin;
|
||||
C2 /= 6.0;
|
||||
C3 /= 12.0;
|
||||
C4 /= 20.0;
|
||||
C5 = 1.0 / TKelvin;
|
||||
}
|
||||
gibbsFE = a[0]*C0 - a[1]*C1 - a[2]*C2 - a[3]*C3 - a[4]*C4 + a[5]*C5 - a[6];
|
||||
gibbsFE *= TKelvin;
|
||||
return gibbsFE;
|
||||
} /***************************************************************************/
|
||||
|
||||
double vcs_H0_NASA(double TKelvin, VCS_NASA_POLY *poly_ptr)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* vcs_H0_NASA:
|
||||
*
|
||||
* Calculate the standard state Enthalpy (in Kelvin) for a single species
|
||||
* using the Nasa polynomial format.
|
||||
*
|
||||
* Input
|
||||
* TKelvin = Temperature in Kelvin.
|
||||
* poly_ptr = Pointer to structure containing the NASA Polynomial
|
||||
* coefficients
|
||||
*
|
||||
* Return
|
||||
* H0 = Standard State Enthalpy / R -> units of kelvin
|
||||
*
|
||||
* Error Conditions
|
||||
* VCS_THERMO_OUTOFRANGE:
|
||||
* If the input temperature, is out of range of the polynomials,
|
||||
* an error Flag is set, and the temperature is storred in the
|
||||
* error structure.
|
||||
***************************************************************************/
|
||||
{
|
||||
int iRegion;
|
||||
double *a, H0;
|
||||
double *Tlim = VCS_DATA_PTR(poly_ptr->Tlimits);
|
||||
static double Tsave = -10., C1, C2, C3, C4, C5;
|
||||
/*
|
||||
* Find the temperature region
|
||||
*/
|
||||
if (TKelvin <= *Tlim) {
|
||||
#ifdef DEBUG_MODE
|
||||
plogf("vcs_H0_NASA error: TKelvin below lowest bounds\n");
|
||||
#endif
|
||||
iRegion = 0;
|
||||
if (TKelvin <= 0.0) {
|
||||
H0 = poly_ptr->Acoeff[0][6];
|
||||
return H0;
|
||||
}
|
||||
goto L_FOUNDREGION;
|
||||
}
|
||||
for (iRegion = 0; iRegion < poly_ptr->NumTempRegions; iRegion++) {
|
||||
Tlim++;
|
||||
if (TKelvin <= *Tlim) goto L_FOUNDREGION;
|
||||
}
|
||||
#ifdef DEBUG_MODE
|
||||
plogf("vcs_H0_NASA error: TKelvin above highest bounds\n");
|
||||
#endif
|
||||
iRegion--;
|
||||
L_FOUNDREGION:;
|
||||
a = poly_ptr->Acoeff[iRegion];
|
||||
if (Tsave != TKelvin) {
|
||||
Tsave = TKelvin;
|
||||
C1 = TKelvin * 0.5;
|
||||
C2 = TKelvin * TKelvin;
|
||||
C3 = C2 * TKelvin;
|
||||
C4 = C3 * TKelvin;
|
||||
C2 /= 3.0;
|
||||
C3 /= 4.0;
|
||||
C4 /= 5.0;
|
||||
C5 = 1.0 / TKelvin;
|
||||
}
|
||||
H0 = a[0] + a[1]*C1 + a[2]*C2 + a[3]*C3 + a[4]*C4 + a[5]*C5;
|
||||
return H0;
|
||||
} /***************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
double vcs_Cp0_NASA(double TKelvin, VCS_NASA_POLY *poly_ptr)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* vcs_Cp0_NASA:
|
||||
*
|
||||
* Calculate the standard state Heat Capacity at constant pressure
|
||||
* (in Kelvin) for a single species using the Nasa polynomial format.
|
||||
*
|
||||
* Input
|
||||
* TKelvin = Temperature in Kelvin.
|
||||
* poly_ptr = Pointer to structure containing the NASA Polynomial
|
||||
* coefficients
|
||||
*
|
||||
* Return
|
||||
* Cp0 = Heat Capacity at constant Pressure / R -> dimensionless
|
||||
*
|
||||
* Error Conditions
|
||||
* VCS_THERMO_OUTOFRANGE:
|
||||
* If the input temperature, is out of range of the polynomials,
|
||||
* an error Flag is set, and the temperature is storred in the
|
||||
* error structure.
|
||||
***************************************************************************/
|
||||
{
|
||||
int iRegion;
|
||||
double *a, Cp0;
|
||||
double *Tlim = VCS_DATA_PTR(poly_ptr->Tlimits);
|
||||
static double Tsave = -10., C2, C3, C4;
|
||||
/*
|
||||
* Find the temperature region
|
||||
*/
|
||||
if (TKelvin <= *Tlim) {
|
||||
#ifdef DEBUG_MODE
|
||||
plogf("vcs_Cp0_NASA error: TKelvin below lowest bounds\n");
|
||||
#endif
|
||||
iRegion = 0;
|
||||
if (TKelvin <= 0.0) {
|
||||
Cp0 = poly_ptr->Acoeff[0][0];
|
||||
return Cp0;
|
||||
}
|
||||
goto L_FOUNDREGION;
|
||||
}
|
||||
for (iRegion = 0; iRegion < poly_ptr->NumTempRegions; iRegion++) {
|
||||
Tlim++;
|
||||
if (TKelvin <= *Tlim) goto L_FOUNDREGION;
|
||||
}
|
||||
#ifdef DEBUG_MODE
|
||||
plogf("vcs_Cp0_NASA error: TKelvin above highest bounds\n");
|
||||
#endif
|
||||
|
||||
iRegion--;
|
||||
L_FOUNDREGION:;
|
||||
a = poly_ptr->Acoeff[iRegion];
|
||||
if (Tsave != TKelvin) {
|
||||
Tsave = TKelvin;
|
||||
C2 = TKelvin * TKelvin;
|
||||
C3 = C2 * TKelvin;
|
||||
C4 = C3 * TKelvin;
|
||||
}
|
||||
Cp0 = a[0] + a[1]*TKelvin + a[2]*C2 + a[3]*C3 + a[4]*C4;
|
||||
return Cp0;
|
||||
} /***************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
double vcs_S0_NASA(double TKelvin, VCS_NASA_POLY *poly_ptr)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* vcs_S0_NASA:
|
||||
*
|
||||
* Calculates the standard state Entropy (in Kelvin) for a single species
|
||||
* using the Nasa polynomial format.
|
||||
*
|
||||
* Input
|
||||
* TKelvin = Temperature in Kelvin.
|
||||
* poly_ptr = Pointer to structure containing the NASA Polynomial
|
||||
* coefficients
|
||||
*
|
||||
* Return
|
||||
* S0 = Standard State Entropy / R -> unitless
|
||||
*
|
||||
* Error Conditions
|
||||
* VCS_THERMO_OUTOFRANGE:
|
||||
* If the input temperature, is out of range of the polynomials,
|
||||
* an error Flag is set, and the temperature is storred in the
|
||||
* error structure.
|
||||
***************************************************************************/
|
||||
{
|
||||
int iRegion;
|
||||
double *a, S0;
|
||||
double *Tlim = VCS_DATA_PTR(poly_ptr->Tlimits);
|
||||
static double Tsave = -10., C0, C2, C3, C4;
|
||||
/*
|
||||
* Find the temperature region
|
||||
*/
|
||||
if (TKelvin <= *Tlim) {
|
||||
#ifdef DEBUG_MODE
|
||||
plogf("vcs_S0_NASA error: TKelvin below lowest bounds\n");
|
||||
#endif
|
||||
iRegion = 0;
|
||||
if (TKelvin <= 0.0) {
|
||||
S0 = 0.0;
|
||||
return S0;
|
||||
}
|
||||
goto L_FOUNDREGION;
|
||||
}
|
||||
for (iRegion = 0; iRegion < poly_ptr->NumTempRegions; iRegion++) {
|
||||
Tlim++;
|
||||
if (TKelvin <= *Tlim) goto L_FOUNDREGION;
|
||||
}
|
||||
#ifdef DEBUG_MODE
|
||||
plogf("vcs_S0_NASA error: TKelvin above highest bounds\n");
|
||||
#endif
|
||||
iRegion--;
|
||||
|
||||
|
||||
L_FOUNDREGION:;
|
||||
a = poly_ptr->Acoeff[iRegion];
|
||||
if (Tsave != TKelvin) {
|
||||
Tsave = TKelvin;
|
||||
C0 = log(TKelvin);
|
||||
C2 = TKelvin * TKelvin;
|
||||
C3 = C2 * TKelvin;
|
||||
C4 = C3 * TKelvin;
|
||||
C2 /= 2.0;
|
||||
C3 /= 3.0;
|
||||
C4 /= 4.0;
|
||||
}
|
||||
S0 = a[0]*C0 + a[1]*TKelvin + a[2]*C2 + a[3]*C3 + a[4]*C4 + a[7];
|
||||
return S0;
|
||||
} /***************************************************************************/
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copywrite (2005) Sandia Corporation. Under the terms of
|
||||
* Contract DE-AC04-94AL85000 with Sandia Corporation, the
|
||||
* U.S. Government retains certain rights in this software.
|
||||
*/
|
||||
|
||||
#ifndef VCS_NASA_POLY_H
|
||||
#define VCS_NASA_POLY_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "vcs_DoubleStarStar.h"
|
||||
|
||||
namespace VCSnonideal {
|
||||
|
||||
/*
|
||||
* NASA Polynomial Form for Standard state Thermo Functions.
|
||||
*
|
||||
*
|
||||
* NumberTempRegions
|
||||
* Number of temperature regions in the fits:
|
||||
* Must be greater or equal to one.
|
||||
*
|
||||
* Tlimits[NumberTempRegions+1]:
|
||||
* Temperature limits of the regions. At the intersection of
|
||||
* the regions, the polynomial formulas are suppose to be
|
||||
* C1 continuous.
|
||||
* To Locate Region i for current temperature, TKelvin:
|
||||
* Tlimits[i] <= TKelvin < Tlimits[i+1]
|
||||
*
|
||||
* Acoeff[NumberTempRegions][7]
|
||||
* Coefficients for calculation of the standard state thermodynamic
|
||||
* functions.
|
||||
*
|
||||
* double *a;
|
||||
* for i such that Tlimits[i] <= T < Tlimits[i+1]:
|
||||
* a = Acoeff[i];
|
||||
*
|
||||
* C_p/R = a[0] + a[1]*T + a[2] * T^2 + a[3] * T^3 + a[4] * T^4
|
||||
*
|
||||
* H/RT = a[0] + a[1]/2*T + a[2]/3 * T^2 + a[3]/4 * T^3 + a[4]/5 * T^4
|
||||
* + a[5]/T
|
||||
*
|
||||
* S/R = a[0] * log(T) + a[1] * T + a[2]/2 * T^2 + a[3]/3 * T^3
|
||||
* + a[4]/4 * T^4 + a[6]
|
||||
*
|
||||
*/
|
||||
class VCS_NASA_POLY {
|
||||
public:
|
||||
VCS_NASA_POLY(int, int);
|
||||
VCS_NASA_POLY(const VCS_NASA_POLY &b);
|
||||
VCS_NASA_POLY& operator=(const VCS_NASA_POLY &);
|
||||
|
||||
~VCS_NASA_POLY();
|
||||
int NumTempRegions;
|
||||
/* Vector Of Temperature Limits -> One More Than
|
||||
The Number Of Regions */
|
||||
std::vector<double> Tlimits;
|
||||
|
||||
DoubleStarStar Acoeff;
|
||||
|
||||
int NumEl;
|
||||
std::vector<double> ElComp;
|
||||
std::vector<std::string> ElName;
|
||||
char Date[12];
|
||||
char PhType;
|
||||
char SpName[24];
|
||||
char PhName[24];
|
||||
};
|
||||
|
||||
/* Externals for vcs_nasa_poly.c */
|
||||
|
||||
extern VCS_NASA_POLY *vcs_nasa_poly_create(int, int);
|
||||
extern void vcs_nasa_poly_free(VCS_NASA_POLY *);
|
||||
extern void vcs_nasa_poly_destroy(VCS_NASA_POLY **);
|
||||
|
||||
extern double vcs_G0_NASA(double, VCS_NASA_POLY *);
|
||||
extern double vcs_H0_NASA(double, VCS_NASA_POLY *);
|
||||
extern double vcs_Cp0_NASA(double, VCS_NASA_POLY *);
|
||||
extern double vcs_S0_NASA(double, VCS_NASA_POLY *);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -391,11 +391,13 @@ void VCS_SOLVE::vcs_TCounters_report(int timing_print_lvl)
|
|||
plogf("\nTCounters: Num_Calls Total_Its Total_Time (seconds)\n");
|
||||
if (timing_print_lvl > 0) {
|
||||
plogf(" vcs_basopt: %5d %5d %11.5E\n",
|
||||
m_VCount->T_Basis_Opts, m_VCount->T_Basis_Opts, " NA ");
|
||||
m_VCount->T_Basis_Opts, m_VCount->T_Basis_Opts,
|
||||
m_VCount->T_Time_basopt);
|
||||
plogf(" vcs_TP: %5d %5d %11.5E\n",
|
||||
m_VCount->T_Calls_vcs_TP, m_VCount->T_Its, " NA ");
|
||||
m_VCount->T_Calls_vcs_TP, m_VCount->T_Its,
|
||||
m_VCount->T_Time_vcs_TP);
|
||||
plogf(" vcs_inest: %5d %11.5E\n",
|
||||
m_VCount->T_Calls_Inest, " NA ");
|
||||
m_VCount->T_Calls_Inest, m_VCount->T_Time_inest);
|
||||
plogf(" vcs_TotalTime: %11.5E\n",
|
||||
m_VCount->T_Time_vcs);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#include "vcs_species_thermo.h"
|
||||
#include "vcs_defs.h"
|
||||
#include "vcs_VolPhase.h"
|
||||
#include "vcs_nasa_poly.h"
|
||||
|
||||
#include "vcs_Exception.h"
|
||||
#include "vcs_internal.h"
|
||||
|
||||
|
|
@ -72,10 +72,6 @@ VCS_SPECIES_THERMO::VCS_SPECIES_THERMO(int indexPhase,
|
|||
*/
|
||||
VCS_SPECIES_THERMO::~VCS_SPECIES_THERMO()
|
||||
{
|
||||
if (SS0_Model == VCS_SS0_NASA_POLY) {
|
||||
vcs_nasa_poly_destroy((VCS_NASA_POLY **) &(this->SS0_Params));
|
||||
SS0_Params = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
|
@ -105,15 +101,12 @@ VCS_SPECIES_THERMO::VCS_SPECIES_THERMO(const VCS_SPECIES_THERMO& b) :
|
|||
UseCanteraCalls(b.UseCanteraCalls),
|
||||
m_VCS_UnitsFormat(b.m_VCS_UnitsFormat)
|
||||
{
|
||||
VCS_NASA_POLY *ppp = 0;
|
||||
|
||||
switch (SS0_Model) {
|
||||
case VCS_SS0_NASA_POLY:
|
||||
ppp = (VCS_NASA_POLY *) b.SS0_Params;
|
||||
SS0_Params = (void *) new VCS_NASA_POLY(*ppp);
|
||||
break;
|
||||
|
||||
default:
|
||||
ppp = 0;
|
||||
SS0_Params = 0;
|
||||
|
||||
SS0_Params = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -137,17 +130,6 @@ VCS_SPECIES_THERMO::operator=(const VCS_SPECIES_THERMO& b)
|
|||
SS0_S0 = b.SS0_S0;
|
||||
SS0_Cp0 = b.SS0_Cp0;
|
||||
SS0_Pref = b.SS0_Pref;
|
||||
|
||||
VCS_NASA_POLY *ppp= 0;
|
||||
switch (SS0_Model) {
|
||||
case VCS_SS0_NASA_POLY:
|
||||
ppp = (VCS_NASA_POLY *) b.SS0_Params;
|
||||
SS0_Params = (void *) new VCS_NASA_POLY(*ppp);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
SSStar_Model = b.SSStar_Model;
|
||||
/*
|
||||
* shallow copy because function is undeveloped.
|
||||
|
|
@ -319,9 +301,6 @@ double VCS_SPECIES_THERMO::G0_R_calc(int kglob, double TKelvin)
|
|||
S = SS0_Cp0 + SS0_Cp0 * log((TKelvin / SS0_T0));
|
||||
fe = H - TKelvin * S;
|
||||
break;
|
||||
case VCS_SS0_NASA_POLY:
|
||||
fe = vcs_G0_NASA(TKelvin, (VCS_NASA_POLY *) SS0_Params);
|
||||
break;
|
||||
default:
|
||||
#ifdef DEBUG_MODE
|
||||
plogf("%sERROR: unknown model\n", yo);
|
||||
|
|
@ -373,20 +352,6 @@ double VCS_SPECIES_THERMO::eval_ac(int kglob)
|
|||
case VCS_AC_CONSTANT:
|
||||
ac = 1.0;
|
||||
break;
|
||||
case VCS_AC_DEBYE_HUCKEL:
|
||||
|
||||
plogf("Not implemented Yet\n");
|
||||
exit(-1);
|
||||
|
||||
case VCS_AC_REGULAR_SOLN:
|
||||
|
||||
plogf("Not implemented Yet\n");
|
||||
exit(-1);
|
||||
|
||||
case VCS_AC_MARGULES:
|
||||
|
||||
plogf("Not implemented Yet\n");
|
||||
exit(-1);
|
||||
default:
|
||||
#ifdef DEBUG_MODE
|
||||
plogf("%sERROR: unknown model\n", yo);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class vcs_VolPhase;
|
|||
*/
|
||||
#define VCS_SS0_NOTHANDLED -1
|
||||
#define VCS_SS0_CONSTANT 0
|
||||
#define VCS_SS0_NASA_POLY 1
|
||||
//#define VCS_SS0_NASA_POLY 1
|
||||
#define VCS_SS0_CONSTANT_CP 2
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue