diff --git a/include/cantera/oneD/Boundary1D.h b/include/cantera/oneD/Boundary1D.h index 3ba2ea1b25..d79aa96b9b 100644 --- a/include/cantera/oneD/Boundary1D.h +++ b/include/cantera/oneD/Boundary1D.h @@ -41,15 +41,15 @@ class Boundary1D : public Domain1D public: Boundary1D(); - virtual void init() { + void init() override { _init(1); } - virtual string type() const { + string type() const override { return "boundary"; } - virtual bool isConnector() { + bool isConnector() override { return true; } @@ -102,9 +102,9 @@ class Boundary1D : public Domain1D return m_mdot; } - virtual void setupGrid(size_t n, const double* z) {} + void setupGrid(size_t n, const double* z) override {} - virtual void fromArray(SolutionArray& arr, double* soln); + void fromArray(SolutionArray& arr, double* soln) override; protected: void _init(size_t n); @@ -142,33 +142,31 @@ class Inlet1D : public Boundary1D Inlet1D(shared_ptr solution, const string& id=""); - virtual string type() const { + string type() const override { return "inlet"; } - virtual void setSpreadRate(double V0); + void setSpreadRate(double V0) override; - virtual double spreadRate() { + double spreadRate() override { return m_V0; } - virtual void show(const double* x); + void show(const double* x) override; - virtual size_t nSpecies() { + size_t nSpecies() override { return m_nsp; } - virtual void setMoleFractions(const string& xin); - virtual void setMoleFractions(const double* xin); - virtual double massFraction(size_t k) { + void setMoleFractions(const string& xin) override; + void setMoleFractions(const double* xin) override; + double massFraction(size_t k) override { return m_yin[k]; } - - virtual void init(); - virtual void eval(size_t jg, double* xg, double* rg, - integer* diagg, double rdt); - virtual shared_ptr asArray(const double* soln) const; - virtual void fromArray(SolutionArray& arr, double* soln); + void init() override; + void eval(size_t jg, double* xg, double* rg, integer* diagg, double rdt) override; + shared_ptr asArray(const double* soln) const override; + void fromArray(SolutionArray& arr, double* soln) override; protected: int m_ilr; @@ -194,18 +192,17 @@ class Empty1D : public Boundary1D m_id = id; } - virtual string type() const { + string type() const override { return "empty"; } - virtual void show(const double* x) {} + void show(const double* x) override {} - virtual void init(); + void init() override; - virtual void eval(size_t jg, double* xg, double* rg, - integer* diagg, double rdt); + void eval(size_t jg, double* xg, double* rg, integer* diagg, double rdt) override; - virtual shared_ptr asArray(const double* soln) const; + shared_ptr asArray(const double* soln) const override; }; /** @@ -224,16 +221,15 @@ class Symm1D : public Boundary1D m_id = id; } - virtual string type() const { + string type() const override { return "symmetry-plane"; } - virtual void init(); + void init() override; - virtual void eval(size_t jg, double* xg, double* rg, - integer* diagg, double rdt); + void eval(size_t jg, double* xg, double* rg, integer* diagg, double rdt) override; - virtual shared_ptr asArray(const double* soln) const; + shared_ptr asArray(const double* soln) const override; }; @@ -253,16 +249,15 @@ class Outlet1D : public Boundary1D m_id = id; } - virtual string type() const { + string type() const override { return "outlet"; } - virtual void init(); + void init() override; - virtual void eval(size_t jg, double* xg, double* rg, - integer* diagg, double rdt); + void eval(size_t jg, double* xg, double* rg, integer* diagg, double rdt) override; - virtual shared_ptr asArray(const double* soln) const; + shared_ptr asArray(const double* soln) const override; }; @@ -277,27 +272,26 @@ class OutletRes1D : public Boundary1D OutletRes1D(shared_ptr solution, const string& id=""); - virtual string type() const { + string type() const override { return "outlet-reservoir"; } - virtual void show(const double* x) {} + void show(const double* x) override {} - virtual size_t nSpecies() { + size_t nSpecies() override { return m_nsp; } - virtual void setMoleFractions(const string& xin); - virtual void setMoleFractions(const double* xin); - virtual double massFraction(size_t k) { + void setMoleFractions(const string& xin) override; + void setMoleFractions(const double* xin) override; + double massFraction(size_t k) override { return m_yres[k]; } - virtual void init(); - virtual void eval(size_t jg, double* xg, double* rg, - integer* diagg, double rdt); - virtual shared_ptr asArray(const double* soln) const; - virtual void fromArray(SolutionArray& arr, double* soln); + void init() override; + void eval(size_t jg, double* xg, double* rg, integer* diagg, double rdt) override; + shared_ptr asArray(const double* soln) const override; + void fromArray(SolutionArray& arr, double* soln) override; protected: size_t m_nsp = 0; @@ -323,21 +317,20 @@ class Surf1D : public Boundary1D m_id = id; } - virtual string type() const { + string type() const override { return "surface"; } - virtual void init(); + void init() override; - virtual void eval(size_t jg, double* xg, double* rg, - integer* diagg, double rdt); + void eval(size_t jg, double* xg, double* rg, integer* diagg, double rdt) override; - virtual shared_ptr asArray(const double* soln) const; - virtual void fromArray(SolutionArray& arr, double* soln); + shared_ptr asArray(const double* soln) const override; + void fromArray(SolutionArray& arr, double* soln) override; - virtual void show(std::ostream& s, const double* x); + void show(std::ostream& s, const double* x) override; - virtual void show(const double* x); + void show(const double* x) override; }; /** @@ -349,11 +342,11 @@ class ReactingSurf1D : public Boundary1D ReactingSurf1D(); ReactingSurf1D(shared_ptr solution, const string& id=""); - virtual string type() const { + string type() const override { return "reacting-surface"; } - virtual void setKinetics(shared_ptr kin); + void setKinetics(shared_ptr kin) override; //! @deprecated To be removed after %Cantera 3.0; replaced by setKinetics() void setKineticsMgr(InterfaceKinetics* kin); @@ -366,26 +359,25 @@ class ReactingSurf1D : public Boundary1D return m_enabled; } - virtual string componentName(size_t n) const; + string componentName(size_t n) const override; - virtual void init(); - virtual void resetBadValues(double* xg); + void init() override; + void resetBadValues(double* xg) override; - virtual void eval(size_t jg, double* xg, double* rg, - integer* diagg, double rdt); + void eval(size_t jg, double* xg, double* rg, integer* diagg, double rdt) override; - virtual shared_ptr asArray(const double* soln) const; - virtual void fromArray(SolutionArray& arr, double* soln); + shared_ptr asArray(const double* soln) const override; + void fromArray(SolutionArray& arr, double* soln) override; - virtual void _getInitialSoln(double* x) { + void _getInitialSoln(double* x) override { m_sphase->getCoverages(x); } - virtual void _finalize(const double* x) { + void _finalize(const double* x) override { std::copy(x, x+m_nsp, m_fixed_cov.begin()); } - virtual void show(const double* x); + void show(const double* x) override; protected: InterfaceKinetics* m_kin = nullptr; diff --git a/include/cantera/oneD/IonFlow.h b/include/cantera/oneD/IonFlow.h index 159b4ae25f..b230beaa10 100644 --- a/include/cantera/oneD/IonFlow.h +++ b/include/cantera/oneD/IonFlow.h @@ -40,21 +40,21 @@ class IonFlow : public StFlow //! @param points initial number of grid points IonFlow(shared_ptr sol, const string& id="", size_t points = 1); - virtual string type() const; + string type() const override; - virtual size_t getSolvingStage() const { + size_t getSolvingStage() const override { return m_stage; } - virtual void setSolvingStage(const size_t stage); + void setSolvingStage(const size_t stage) override; - virtual void resize(size_t components, size_t points); - virtual bool componentActive(size_t n) const; + void resize(size_t components, size_t points) override; + bool componentActive(size_t n) const override; - virtual void _finalize(const double* x); + void _finalize(const double* x) override; - virtual void solveElectricField(size_t j=npos); - virtual void fixElectricField(size_t j=npos); - virtual bool doElectricField(size_t j) const { + void solveElectricField(size_t j=npos) override; + void fixElectricField(size_t j=npos) override; + bool doElectricField(size_t j) const override { return m_do_electric_field[j]; } @@ -78,15 +78,15 @@ class IonFlow : public StFlow * This function overloads the original function. The residual function * of electric field is added. */ - virtual void evalResidual(double* x, double* rsd, int* diag, - double rdt, size_t jmin, size_t jmax); - virtual void updateTransport(double* x, size_t j0, size_t j1); - virtual void updateDiffFluxes(const double* x, size_t j0, size_t j1); + void evalResidual(double* x, double* rsd, int* diag, + double rdt, size_t jmin, size_t jmax) override; + void updateTransport(double* x, size_t j0, size_t j1) override; + void updateDiffFluxes(const double* x, size_t j0, size_t j1) override; //! Solving phase one: the fluxes of charged species are turned off - virtual void frozenIonMethod(const double* x, size_t j0, size_t j1); + void frozenIonMethod(const double* x, size_t j0, size_t j1); //! Solving phase two: the electric field equation is added coupled //! by the electrical drift - virtual void electricFieldMethod(const double* x, size_t j0, size_t j1); + void electricFieldMethod(const double* x, size_t j0, size_t j1); //! flag for solving electric field or not vector m_do_electric_field; diff --git a/include/cantera/oneD/Sim1D.h b/include/cantera/oneD/Sim1D.h index 2d39e9b8c4..25a5651259 100644 --- a/include/cantera/oneD/Sim1D.h +++ b/include/cantera/oneD/Sim1D.h @@ -333,7 +333,7 @@ class Sim1D : public OneDim */ void solveAdjoint(const double* b, double* lambda); - virtual void resize(); + void resize() override; //! Set a function that will be called after each successful steady-state //! solve, before regridding. Intended to be used for observing solver diff --git a/include/cantera/oneD/StFlow.h b/include/cantera/oneD/StFlow.h index f2430d085a..c01dd407d9 100644 --- a/include/cantera/oneD/StFlow.h +++ b/include/cantera/oneD/StFlow.h @@ -67,14 +67,14 @@ class StFlow : public Domain1D ~StFlow(); - virtual string type() const; + string type() const override; //! @name Problem Specification //! @{ - virtual void setupGrid(size_t n, const double* z); + void setupGrid(size_t n, const double* z) override; - virtual void resetBadValues(double* xg); + void resetBadValues(double* xg) override; ThermoPhase& phase() { return *m_thermo; @@ -91,14 +91,14 @@ class StFlow : public Domain1D */ void setThermo(ThermoPhase& th); - virtual void setKinetics(shared_ptr kin); + void setKinetics(shared_ptr kin) override; //! Set the kinetics manager. //! @deprecated To be removed after %Cantera 3.0; //! replaced by Domain1D::setKinetics() void setKinetics(Kinetics& kin); - virtual void setTransport(shared_ptr trans); + void setTransport(shared_ptr trans) override; //! Set transport model to existing instance //! @deprecated To be removed after %Cantera 3.0; @@ -135,9 +135,9 @@ class StFlow : public Domain1D } //! Write the initial solution estimate into array x. - virtual void _getInitialSoln(double* x); + void _getInitialSoln(double* x) override; - virtual void _finalize(const double* x); + void _finalize(const double* x) override; //! Sometimes it is desired to carry out the simulation using a specified //! temperature profile, rather than computing it by solving the energy @@ -163,18 +163,18 @@ class StFlow : public Domain1D //! @} - virtual string componentName(size_t n) const; + string componentName(size_t n) const override; - virtual size_t componentIndex(const string& name) const; + size_t componentIndex(const string& name) const override; //! Returns true if the specified component is an active part of the solver state virtual bool componentActive(size_t n) const; //! Print the solution. - virtual void show(const double* x); + void show(const double* x) override; - virtual shared_ptr asArray(const double* soln) const; - virtual void fromArray(SolutionArray& arr, double* soln); + shared_ptr asArray(const double* soln) const override; + void fromArray(SolutionArray& arr, double* soln) override; //! Set flow configuration for freely-propagating flames, using an internal point //! with a fixed temperature as the condition to determine the inlet mass flux. @@ -279,7 +279,7 @@ class StFlow : public Domain1D } //! Change the grid size. Called after grid refinement. - virtual void resize(size_t components, size_t points); + void resize(size_t components, size_t points) override; //! Set the gas object state to be consistent with the solution at point j. void setGas(const double* x, size_t j); @@ -327,16 +327,14 @@ class StFlow : public Domain1D * j-1, j, and j+1. This option is used to efficiently evaluate the * Jacobian numerically. */ - virtual void eval(size_t j, double* x, double* r, integer* mask, double rdt); + void eval(size_t j, double* x, double* r, integer* mask, double rdt) override; //! Evaluate all residual components at the right boundary. - virtual void evalRightBoundary(double* x, double* res, int* diag, - double rdt); + virtual void evalRightBoundary(double* x, double* res, int* diag, double rdt); //! Evaluate the residual corresponding to the continuity equation at all //! interior grid points. - virtual void evalContinuity(size_t j, double* x, double* r, - int* diag, double rdt); + virtual void evalContinuity(size_t j, double* x, double* r, int* diag, double rdt); //! Index of the species on the left boundary with the largest mass fraction size_t leftExcessSpecies() const { @@ -349,8 +347,8 @@ class StFlow : public Domain1D } protected: - virtual AnyMap getMeta() const; - virtual void setMeta(const AnyMap& state); + AnyMap getMeta() const override; + void setMeta(const AnyMap& state) override; double wdot(size_t k, size_t j) const { return m_wdot(k,j);