コード例 #1
0
ファイル: LatticePhase.cpp プロジェクト: hkmoffat/cantera
 doublereal LatticePhase::
 enthalpy_mole() const {
   doublereal p0 = m_spthermo->refPressure();
   return GasConstant * temperature() * 
     mean_X(&enthalpy_RT_ref()[0]) 
     + (pressure() - p0)/molarDensity();
 }
コード例 #2
0
void StoichSubstanceSSTP::getEnthalpy_RT(doublereal* hrt) const
{
    getEnthalpy_RT_ref(hrt);
    doublereal RT = GasConstant * temperature();
    doublereal presCorrect = (m_press - m_p0) /  molarDensity();
    hrt[0] += presCorrect / RT;
}
コード例 #3
0
ファイル: IdealGasPhase.cpp プロジェクト: iokto/cantera
void IdealGasPhase::getStandardVolumes(doublereal* vol) const
{
    double tmp = 1.0 / molarDensity();
    for (size_t k = 0; k < m_kk; k++) {
        vol[k] = tmp;
    }
}
コード例 #4
0
ファイル: IdealGasPhase.cpp プロジェクト: iokto/cantera
void IdealGasPhase::getPartialMolarVolumes(doublereal* vbar) const
{
    double vol = 1.0 / molarDensity();
    for (size_t k = 0; k < m_kk; k++) {
        vbar[k] = vol;
    }
}
コード例 #5
0
ファイル: LatticePhase.cpp プロジェクト: hkmoffat/cantera
  void LatticePhase::_updateThermo() const {
    doublereal tnow = temperature();
    if (fabs(molarDensity() - m_molar_density)/m_molar_density > 0.0001) {
      throw CanteraError("_updateThermo","molar density changed from "
			 +fp2str(m_molar_density)+" to "+fp2str(molarDensity()));
    }
    if (m_tlast != tnow) {
      m_spthermo->update(tnow, &m_cp0_R[0], &m_h0_RT[0], 
			 &m_s0_R[0]);
      m_tlast = tnow;
      for (size_t k = 0; k < m_kk; k++) {
	m_g0_RT[k] = m_h0_RT[k] - m_s0_R[k];
      }
      m_tlast = tnow;
    }
  }
コード例 #6
0
ファイル: LatticePhase.cpp プロジェクト: hkmoffat/cantera
 void LatticePhase::getEnthalpy_RT(doublereal* hrt) const {
   const array_fp& _h = enthalpy_RT_ref();
   std::copy(_h.begin(), _h.end(), hrt);
   doublereal tmp = (pressure() - m_p0) / (molarDensity() * GasConstant * temperature());
   for (size_t k = 0; k < m_kk; k++) {
     hrt[k] += tmp;
   }
 }
コード例 #7
0
 doublereal LatticeSolidPhase::intEnergy_mole() const {
     _updateThermo();
     doublereal ndens, sum = 0.0;
     int n;
     for (n = 0; n < m_nlattice; n++) {
         ndens = m_lattice[n]->molarDensity();
         sum += ndens * m_lattice[n]->intEnergy_mole();
     }
     return sum/molarDensity();
 }
コード例 #8
0
 void ConstDensityThermo::getChemPotentials(doublereal* mu) const {
     doublereal vdp = (pressure() - m_spthermo->refPressure())/
                      molarDensity();
     doublereal xx;
     doublereal rt = temperature() * GasConstant;
     const array_fp& g_RT = gibbs_RT();
     for (int k = 0; k < m_kk; k++) {
         xx = fmaxx(SmallNumber, moleFraction(k));
         mu[k] = rt*(g_RT[k] + log(xx)) + vdp;
     }
 }
コード例 #9
0
 void LatticeSolidPhase::getStandardChemPotentials(doublereal* mu0) const {
     _updateThermo();
     int n;
     int strt = 0;
     double dratio;
     for (n = 0; n < m_nlattice; n++) {
         dratio = m_lattice[n]->molarDensity()/molarDensity();
         m_lattice[n]->getStandardChemPotentials(mu0+strt);
         scale(mu0 + strt, mu0 + strt + m_lattice[n]->nSpecies(), mu0 + strt, dratio);
         strt += m_lattice[n]->nSpecies();
     }
 }
コード例 #10
0
 doublereal ConstDensityThermo::intEnergy_mole() const {
     doublereal p0 = m_spthermo->refPressure();
     return GasConstant * temperature() * 
         mean_X(&enthalpy_RT()[0]) 
         - p0/molarDensity();
 }
コード例 #11
0
ファイル: StoichSubstance.cpp プロジェクト: goldmanm/cantera
void StoichSubstance::getIntEnergy_RT_ref(doublereal* urt) const
{
    _updateThermo();
    urt[0] = m_h0_RT - m_p0 / molarDensity() / RT();
}
コード例 #12
0
doublereal StoichSubstance::enthalpy_mole() const
{
    return intEnergy_mole() + m_press / molarDensity();
}
コード例 #13
0
ファイル: main.c プロジェクト: Encesat/Delta13C
int main(int argc, char **args) {

  double maxdepth;
  double maxtime;
  double vertlayer;
  double timestep;
  double surfacerate;
  double surfacepressure;
  double c13diffusivityfactor;
  double c13prodfactor;
  double tortuosity;
  double qfactor;
  double dao;
  double d;
  double A0;
  double TAverage;
  Delta13CSimulation sim;

  //Read the config-file
  readConfig(&maxdepth, &maxtime, &vertlayer, &timestep, &surfacerate, &surfacepressure, &c13diffusivityfactor, &tortuosity, &qfactor, &dao, &d, &A0, &TAverage, &c13prodfactor);

  //Initialize the simulation
  printf("Initialize the parameters, allocate memory...\n");
  initialize(&sim, maxdepth, maxtime, vertlayer, timestep, surfacerate, surfacepressure, 1, tortuosity, qfactor, dao, 1, "12C");
  printf("Done!\n");

  //Calculate the temperature matrix
  printf("Calculating the temperature matrix ... \n");
  temperature(&sim, d, A0, TAverage);
  printf("Done!\n");
 
  //Calculate the diffusivity matrix
  printf("Calculating the diffusivities ... \n");
  diffusivity(&sim);
  printf("Done!\n");

  //Calculate the CO2 profile
  printf("Calculating the CO2 profiles ... \n");
  co2Production(&sim, VARIABLEPROD);
  printf("Done!\n");

  //Calculate vertical fluxes, the molar density and the delta 13 C
  for(int timeStep = 0; timeStep < sim.timeIndexMax; timeStep++) {
    for(int depthStep = 0; depthStep < sim.depthIndexMax; depthStep++) {
      verticalFlux(&sim, depthStep, timeStep);
      molarDensity(&sim, depthStep, timeStep, AIRFILLEDPOROSITY);
    }
    delta13cSurfaceFlux(&sim, timeStep);
  }

  //Write the results to the HDD
  //printf("Writing results to the HDD ... \n");
  //writeToFile(&sim);
  //writeToFile(&sim2);
  //printf("Done!\n");

  //Deallocate the memory
  printf("Deallocating arrays ... \n");
  cleaning(&sim, -1);
  printf("Done!\n");
  return 0;
}
コード例 #14
0
 /*
  * Molar internal energy or the reference state at the current
  * temperature, T  (J/kmol).  
  * For an incompressible,
  * stoichiometric substance, the molar internal energy is
  * independent of pressure. Since the thermodynamic properties
  * are specified by giving the standard-state enthalpy, the
  * term \f$ P_0 \hat v\f$ is subtracted from the specified molar
  * enthalpy to compute the molar internal energy.
  *
  * Note, this is equal to the standard state internal energy
  * evaluated at the reference pressure.
  */
 void StoichSubstanceSSTP::getIntEnergy_RT_ref(doublereal* urt) const {
   _updateThermo();
   doublereal RT = GasConstant * temperature();
   doublereal PV = m_p0 / molarDensity();
   urt[0] = m_h0_RT[0] - PV / RT;
 }
コード例 #15
0
ファイル: MineralEQ3.cpp プロジェクト: arghdos/cantera
void MineralEQ3::getEnthalpy_RT(doublereal* hrt) const
{
    getEnthalpy_RT_ref(hrt);
    doublereal presCorrect = (m_press - m_p0) / molarDensity();
    hrt[0] += presCorrect / RT();
}
コード例 #16
0
ファイル: MineralEQ3.cpp プロジェクト: arghdos/cantera
void MineralEQ3::getIntEnergy_RT_ref(doublereal* urt) const
{
    _updateThermo();
    urt[0] = m_h0_RT - m_p0 / molarDensity() / RT();
}
コード例 #17
0
void StoichSubstanceSSTP::getIntEnergy_RT(doublereal* urt) const
{
    _updateThermo();
    urt[0] = m_h0_RT[0] - m_p0 / molarDensity() / (GasConstant * temperature());
}
コード例 #18
0
doublereal StoichSubstance::intEnergy_mole() const
{
    _updateThermo();
    return GasConstant * temperature() * m_h0_RT[0]
           - m_p0 / molarDensity();
}
コード例 #19
0
void LatticePhase::getParameters(int& n, doublereal* const c) const
{
    c[0] = molarDensity();
    n = 1;
}
コード例 #20
0
void StoichSubstance::getPartialMolarVolumes(doublereal* vbar) const
{
    vbar[0] = 1.0 / molarDensity();
}
コード例 #21
0
doublereal LatticePhase::enthalpy_mole() const
{
    return RT() * mean_X(enthalpy_RT_ref()) +
            (pressure() - m_Pref)/molarDensity();
}
コード例 #22
0
void MetalSHEelectrons::getIntEnergy_RT_ref(doublereal* urt) const
{
    _updateThermo();
    urt[0] = m_h0_RT - m_p0 / molarDensity() / RT();
}
コード例 #23
0
doublereal IdealSolidSolnPhase::enthalpy_mole() const
{
    doublereal htp = GasConstant * temperature() * mean_X(enthalpy_RT_ref());
    return htp + (pressure() - m_Pref)/molarDensity();
}
コード例 #24
0
void StoichSubstance::getStandardVolumes(doublereal* vol) const
{
    vol[0] = 1.0 / molarDensity();
}
コード例 #25
0
ファイル: MineralEQ3.cpp プロジェクト: hkmoffat/cantera
 /*
  * Molar internal energy (J/kmol).
  * For an incompressible,
  * stoichiometric substance, the molar internal energy is
  * independent of pressure. Since the thermodynamic properties
  * are specified by giving the standard-state enthalpy, the
  * term \f$ P_0 \hat v\f$ is subtracted from the specified molar
  * enthalpy to compute the molar internal energy.
  */
 void MineralEQ3::getIntEnergy_RT(doublereal* urt) const {
   _updateThermo();
   doublereal RT = GasConstant * temperature();
   doublereal PV = m_p0 / molarDensity();
   urt[0] = m_h0_RT[0] - PV / RT;
 }
コード例 #26
0
 doublereal ConstDensityThermo::standardConcentration(int k) const {
     return molarDensity();
 }
コード例 #27
0
ファイル: Phase.cpp プロジェクト: MrKingKong/cantera
doublereal Phase::molarVolume() const
{
    return 1.0/molarDensity();
}
コード例 #28
0
 doublereal ConstDensityThermo::logStandardConc(int k) const {
     return log(molarDensity());
 }
コード例 #29
0
void MetalSHEelectrons::getIntEnergy_RT_ref(doublereal* urt) const
{
    _updateThermo();
    doublereal RT = GasConstant * temperature();
    urt[0] = m_h0_RT[0] - m_p0 / molarDensity() / RT;
}
コード例 #30
0
ファイル: StoichSubstance.cpp プロジェクト: goldmanm/cantera
void StoichSubstance::getEnthalpy_RT(doublereal* hrt) const
{
    getEnthalpy_RT_ref(hrt);
    doublereal presCorrect = (m_press - m_p0) / molarDensity();
    hrt[0] += presCorrect / RT();
}