Skip to content

Commit

Permalink
addressing comments
Browse files Browse the repository at this point in the history
  • Loading branch information
shakedregev committed Jan 22, 2025
1 parent b337023 commit 9dfb3aa
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
2 changes: 0 additions & 2 deletions examples/Microgrid/Microgrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,6 @@ int main(int argc, char const *argv[])
sysmodel->updateTime(0.0, 1.0e-8);
sysmodel->evaluateJacobian();
std::cout << "Intial Jacobian with alpha:\n";
// std::cout << sysmodel->getJacobian().frobNorm() << "\n";


//Create numerical integrator and configure it for the generator model
AnalysisManager::Sundials::Ida<double, size_t>* idas = new AnalysisManager::Sundials::Ida<double, size_t>(sysmodel);
Expand Down
6 changes: 3 additions & 3 deletions examples/RLCircuit/RLCircuit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@

int main(int argc, char const *argv[])
{
double abstol = 1.0e-8;
double reltol = 1.0e-8;
double abs_tol = 1.0e-8;
double rel_tol = 1.0e-8;
bool use_jac = true;

//TODO:setup as named parameters
//Create circuit model
ModelLib::PowerElectronicsModel<double, size_t>* sysmodel = new ModelLib::PowerElectronicsModel<double, size_t>(reltol, abstol, use_jac);
auto* sysmodel = new ModelLib::PowerElectronicsModel<double, size_t>(rel_tol, abs_tol, use_jac);

size_t idoff = 0;

Expand Down
8 changes: 4 additions & 4 deletions examples/ScaleMicrogrid/ScaleMicrogrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ int test(index_type Nsize, real_type error_tol, bool debug_output)
real_type t_init = 0.0;
real_type t_final = 1.0;

real_type reltol = SCALE_MICROGRID_REL_TOL;
real_type abstol = SCALE_MICROGRID_ABS_TOL;
real_type rel_tol = SCALE_MICROGRID_REL_TOL;
real_type abs_tol = SCALE_MICROGRID_ABS_TOL;

// Create circuit model
auto* sysmodel = new PowerElectronicsModel<real_type, index_type>(reltol,
abstol,
auto* sysmodel = new PowerElectronicsModel<real_type, index_type>(rel_tol,
abs_tol,
use_jac,
SCALE_MICROGRID_MAX_STEPS);

Expand Down
2 changes: 1 addition & 1 deletion examples/ScaleMicrogrid/SolutionKeys.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @brief Answer keys for Scaled Microgrid test with Nsize = 2, 4, 8
*
* Data generated with Matlab ode23tb solver with tolerances set to
* abstol = 1e-12 and reltol = 1e-12 for the ODE derivation of the model.
* abs_tol = 1e-12 and rel_tol = 1e-12 for the ODE derivation of the model.
* No index reduction was preformed to get to the ODE model.
*
* @note This file is only to be included in ScaleMicrogrid.cpp. It has no
Expand Down
10 changes: 7 additions & 3 deletions src/LinearAlgebra/COO_Matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ inline std::vector<Intdx> COO_Matrix<ScalarT, Intdx>::getCSRRowData()
}

/**
* @brief Set coordinates and values of the matrix. Will sort before returning
* @brief Set coordinates and values of the matrix.
*
* Matrix entries will be sorted in row-major order before the method returns.
*
* @tparam ScalarT
* @tparam Intdx
Expand Down Expand Up @@ -746,10 +748,12 @@ inline bool COO_Matrix<ScalarT, Intdx>::checkIncreaseSize(Intdx r, Intdx c)
}

/**
* @brief Sort a disordered set of values. Assume nothing on order.
* @brief Sorts unordered COO matrix
*
* Matrix entries can appear in arbitrary order and will be sorted in
* row-major order before the method returns.
*
* @todo simple setup. Should add stable sorting since lists are pre-sorted_
* SR: are we assuming something on the order, or not?
*
* @tparam ScalarT
* @tparam Intdx
Expand Down
5 changes: 4 additions & 1 deletion src/Model/PowerElectronics/SystemModelPowerElectronics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ namespace ModelLib
*
* @post System model parameters set as input
*/
PowerElectronicsModel(double rel_tol = 1e-4, double abs_tol = 1e-4, bool use_jac = false, IdxT max_steps = 2000) : ModelEvaluatorImpl<ScalarT, IdxT>(0, 0, 0)
PowerElectronicsModel(double rel_tol = 1e-4,
double abs_tol = 1e-4,
bool use_jac = false,
IdxT max_steps = 2000) : ModelEvaluatorImpl<ScalarT, IdxT>(0, 0, 0)
{
// Set system model tolerances from input
rel_tol_ = rel_tol;
Expand Down

0 comments on commit 9dfb3aa

Please sign in to comment.