Skip to content

Commit

Permalink
[samples] Remove redundant headers
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl committed Apr 5, 2022
1 parent 41f8559 commit 5cf79bd
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 31 deletions.
5 changes: 3 additions & 2 deletions samples/cxx/LiC6_electrode/LiC6_electrode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// This file is part of Cantera. See License.txt in the top-level directory or
// at https://cantera.org/license.txt for license and copyright information.

#include "cantera/thermo.h"
#include "cantera/core.h"
#include <iostream>
#include <fstream>

Expand All @@ -26,7 +26,8 @@ void calc_potentials()

std::string filename = "LiC6_electrodebulk.yaml";
std::string phasename = "LiC6_and_Vacancies";
std::unique_ptr<ThermoPhase> electrodebulk(newPhase(filename,phasename));
auto sol = newSolution(filename, phasename);
auto electrodebulk = sol->thermo();
std::string intercalatingSpeciesName("Li(C6)");
size_t intercalatingSpeciesIdx = electrodebulk->speciesIndex(intercalatingSpeciesName);
size_t nsp_tot = electrodebulk->nSpecies();
Expand Down
2 changes: 0 additions & 2 deletions samples/cxx/combustor/combustor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
// at https://cantera.org/license.txt for license and copyright information.

#include "cantera/zerodim.h"
#include "cantera/thermo/IdealGasPhase.h"

#include <fstream>

using namespace Cantera;
Expand Down
16 changes: 7 additions & 9 deletions samples/cxx/custom/custom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
// This file is part of Cantera. See License.txt in the top-level directory or
// at https://cantera.org/license.txt for license and copyright information.

#include "cantera/thermo.h"
#include "cantera/kinetics.h"
#include "cantera/base/Solution.h"
#include "cantera/core.h"
#include "cantera/numerics/Integrator.h"
#include <fstream>

Expand Down Expand Up @@ -75,7 +73,7 @@ class ReactorODEs : public FuncEval {
double *massFracs = &y[1];
double *dTdt = &ydot[0];
double *dYdt = &ydot[1];

/* ------------------------- UPDATE GAS STATE ------------------------- */
// the state of the ThermoPhase is updated to reflect the current solution
// vector, which was calculated by the integrator.
Expand All @@ -87,7 +85,7 @@ class ReactorODEs : public FuncEval {
double cp = m_gas->cp_mass();
m_gas->getPartialMolarEnthalpies(&m_hbar[0]);
m_kinetics->getNetProductionRates(&m_wdot[0]);

/* -------------------------- ENERGY EQUATION ------------------------- */
// the rate of change of the system temperature is found using the energy
// equation for a closed-system constant pressure ideal gas:
Expand All @@ -110,7 +108,7 @@ class ReactorODEs : public FuncEval {
dYdt[k] = m_wdot[k] * m_gas->molecularWeight(k) / rho;
}
}

/**
* Number of equations in the ODE system.
* - overridden from FuncEval, called by the integrator during initialization.
Expand Down Expand Up @@ -153,7 +151,7 @@ int main() {
// for each simulation time point.
// create the csv file, overwriting any existing ones with the same name.
std::ofstream outputFile("custom_cxx.csv");

// for convenience, a title for each of the state vector's components is written to
// the first line of the csv file.
outputFile << "time (s), temp (K)";
Expand All @@ -171,7 +169,7 @@ int main() {
// the new absolute time of the system.
double tnow = 0.0;
double tfinal = 1e-3;

/* ------------------- CREATE & INIT ODE INTEGRATOR ------------------- */
// create an ODE integrator object, which will be used to solve the system of ODES defined
// in the ReactorODEs class. a C++ interface to the C-implemented SUNDIALS CVODES integrator
Expand All @@ -188,7 +186,7 @@ int main() {
// internally, the integrator will apply settings, allocate needed memory, and populate
// this memory with the appropriate initial values for the system.
integrator->initialize(tnow, odes);

/* ----------------------- SIMULATION TIME LOOP ----------------------- */
while (tnow < tfinal) {
// advance the simulation to the current absolute time, tnow, using the integrator's
Expand Down
5 changes: 1 addition & 4 deletions samples/cxx/demo/demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
// provide a simplified interface to the Cantera header files. If you need
// to include core headers directly, use the format "cantera/module/*.h".

#include "cantera/thermo/IdealGasPhase.h" // defines class IdealGasPhase
#include "cantera/base/Solution.h"
#include "cantera/kinetics/GasKinetics.h"
#include "cantera/transport.h" // transport properties
#include "cantera/core.h"
#include <iostream>

// All Cantera kernel names are in namespace Cantera. You can either
Expand Down
7 changes: 1 addition & 6 deletions samples/cxx/flamespeed/flamespeed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@
// This file is part of Cantera. See License.txt in the top-level directory or
// at https://cantera.org/license.txt for license and copyright information.

#include "cantera/oneD/Sim1D.h"
#include "cantera/oneD/Boundary1D.h"
#include "cantera/oneD/StFlow.h"
#include "cantera/thermo/IdealGasPhase.h"
#include "cantera/transport.h"
#include "cantera/base/Solution.h"
#include "cantera/onedim.h"
#include "cantera/base/stringUtils.h"
#include <fstream>

Expand Down
4 changes: 1 addition & 3 deletions samples/cxx/gas_transport/gas_transport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
// This file is part of Cantera. See License.txt in the top-level directory or
// at https://cantera.org/license.txt for license and copyright information.

#include "cantera/thermo.h"
#include "cantera/transport.h"
#include "cantera/base/Solution.h"
#include "cantera/core.h"
#include "cantera/base/Array.h"
#include "cantera/base/plots.h"

Expand Down
4 changes: 1 addition & 3 deletions samples/cxx/jacobian/derivative_speed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
#include <iostream>
#include <iomanip>
#include <numeric>
#include "cantera/base/Solution.h"
#include "cantera/thermo/IdealGasPhase.h"
#include "cantera/kinetics.h"
#include "cantera/core.h"
#include "cantera/numerics/eigen_sparse.h"

using namespace Cantera;
Expand Down
1 change: 0 additions & 1 deletion samples/cxx/kinetics1/kinetics1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// at https://cantera.org/license.txt for license and copyright information.

#include "cantera/zerodim.h"
#include "cantera/thermo/IdealGasPhase.h"
#include "cantera/numerics/Integrator.h"
#include "example_utils.h"

Expand Down
1 change: 0 additions & 1 deletion samples/cxx/openmp_ignition/openmp_ignition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// at https://cantera.org/license.txt for license and copyright information.

#include "cantera/zerodim.h"
#include "cantera/thermo/IdealGasPhase.h"

#include <omp.h>

Expand Down

0 comments on commit 5cf79bd

Please sign in to comment.