Skip to content

Commit

Permalink
Remove banned keywords (std::cout, std::cerr)
Browse files Browse the repository at this point in the history
Where part of features, transition to mooseError and mooseWarning where applicable. Where commented out, remove if simple diagnostics and testing and fixup where prior features exist or where well-noted developer diagnostic pathways exist.

Refs lcpp-org#86
  • Loading branch information
cticenhour committed Sep 12, 2023
1 parent b1f5c5e commit 0c5a63b
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 65 deletions.
7 changes: 1 addition & 6 deletions src/actions/AddGeneralReactions.C
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ AddGeneralReactions::act()
// if (_energy_change[i] == true)
// {
// Gas temperature is almost in place, but not finished yet.
// std::cout << "WARNING: energy dependence is not yet implemented." << std::endl;
// mooseError("Energy dependence is not yet implemented.");
// }
}
}
Expand Down Expand Up @@ -346,7 +346,6 @@ AddGeneralReactions::act()
reactant_kernel_name += "Log";
}
}
// std::cout << energy_kernel_name << ", " << _energy_change[i] << std::endl;

// if (_energy_change[i] && _rate_type[i] == "EEDF")
// {
Expand Down Expand Up @@ -557,8 +556,6 @@ AddGeneralReactions::act()
InputParameters params = _factory.getValidParams(reactant_kernel_name);
params.set<NonlinearVariableName>("variable") = _species[j];
params.set<Real>("coefficient") = _species_count[i][j];
// std::cout << getParam<std::vector<SubdomainName>>("block")[0] << ", " <<
// _species_count[i][j] << std::endl; mooseError("TESTING");
params.set<std::string>("reaction") = _reaction[i];
if (find_other || find_aux)
{
Expand Down Expand Up @@ -670,8 +667,6 @@ AddGeneralReactions::act()
// If a species is not tracked, it is treated as a background gas.
for (unsigned int k = 0; k < _reactants[i].size(); ++k)
{
// std::cout << _reaction[i] << ": \n" << " " << _reactants[i][k] << ", " <<
// include_species[k] << std::endl;
if (include_species[k])
{
params.set<std::vector<VariableName>>(other_variables[k]) = {_reactants[i][k]};
Expand Down
2 changes: 1 addition & 1 deletion src/actions/AddZapdosReactions.C
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ AddZapdosReactions::act()
// First all EEDF-based reactions are added.
for (unsigned int i = 0; i < _num_eedf_reactions; ++i)
{
std::cout << _ad_prepend + "ReactionRateEEDF" + _townsend_append + _log_append << std::endl;
mooseInfo(_ad_prepend, "ReactionRateEEDF", _townsend_append, _log_append);
if (_coefficient_format == "townsend")
addAuxRate(_ad_prepend + "ReactionRateEEDF" + _townsend_append + _log_append,
_eedf_reaction_number[i],
Expand Down
18 changes: 5 additions & 13 deletions src/actions/ChemicalReactions.C
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ ChemicalReactions::ChemicalReactions(const InputParameters & params)
//////////
// if (_rate_equation_string[i].find("Tgas") != std::string::npos)
// {
// std::cout << "found!" << std::endl;
// mooseInfo("found!");
// }
//////////

Expand All @@ -245,7 +245,7 @@ ChemicalReactions::ChemicalReactions(const InputParameters & params)
// std::string token;
// while (std::getline(iss >> std::ws, token,'/'))
// {
// std::cout << token << std::endl;
// mooseInfo(token);
// }
}
else
Expand Down Expand Up @@ -528,11 +528,7 @@ ChemicalReactions::act()

if (gas_tracking)
{
// mooseError("Functionality for tracking neutral gas densities and temperatures is under
// development.");
std::cout
<< "WARNING: Functionality for tracking neutral gas densities is still under development."
<< std::endl;
mooseError("Functionality for tracking neutral gas densities is still under development.");
}

else if (_current_task == "add_function" && _scalar_problem == false)
Expand Down Expand Up @@ -741,8 +737,7 @@ ChemicalReactions::act()
}
else if (_rate_type[i] == "Equation")
{
std::cout << "WARNING: CRANE cannot yet handle equation-based equations." << std::endl;
// This should be a mooseError...but I'm using it for testing purposes.
mooseError("CRANE cannot yet handle equation-based equations.");
}
else if (_superelastic_reaction[i] == true)
{
Expand Down Expand Up @@ -788,7 +783,7 @@ ChemicalReactions::act()
if (_energy_change == true)
{
// Gas temperature is almost in place, but not finished yet.
std::cout << "WARNING: energy dependence is not yet implemented." << std::endl;
mooseError("Energy dependence is not yet implemented.");
}
}
}
Expand All @@ -801,7 +796,6 @@ ChemicalReactions::act()
std::vector<Real> rxn_coeff = getParam<std::vector<Real>>("reaction_coefficient");
for (unsigned int i = 0; i < _num_reactions; ++i)
{
// std::cout << rxn_coeff[i] << std::endl;
if (_reactants[i].size() == 1)
{
product_kernel_name = "Product1BodyScalar";
Expand Down Expand Up @@ -881,8 +875,6 @@ ChemicalReactions::act()

if (_species_count[i][j] > 0)
{
// std::cout << _species_count[i][j] << std::endl;
// std::cout <<
InputParameters params = _factory.getValidParams(product_kernel_name);
params.set<NonlinearVariableName>("variable") = _species[j];
// params.set<Real>("n_gas") = 3.219e24;
Expand Down
26 changes: 11 additions & 15 deletions src/actions/ChemicalReactionsBase.C
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ ChemicalReactionsBase::ChemicalReactionsBase(const InputParameters & params)
//////////
// if (_rate_equation_string[i].find("Tgas") != std::string::npos)
// {
// std::cout << "found!" << std::endl;
// mooseInfo("found!");
// }
//////////

Expand All @@ -367,7 +367,7 @@ ChemicalReactionsBase::ChemicalReactionsBase(const InputParameters & params)
// std::string token;
// while (std::getline(iss >> std::ws, token,'/'))
// {
// std::cout << token << std::endl;
// mooseInfo(token);
// }
}
else
Expand All @@ -388,7 +388,7 @@ ChemicalReactionsBase::ChemicalReactionsBase(const InputParameters & params)
}
catch (const std::out_of_range &)
{
std::cerr << "Argument out of range for a double\n";
mooseError("Argument out of range for a double\n");
throw;
}
// _rate_coefficient[i] = std::stod(rate_coefficient_string[i]);
Expand Down Expand Up @@ -730,15 +730,6 @@ ChemicalReactionsBase::ChemicalReactionsBase(const InputParameters & params)
}

_num_reactions += superelastic_reactions;
// for (unsigned int i=0; i<_num_reactions; ++i)
// {
// std::cout << _reaction[i] << std::endl;
// for (unsigned int j=0; j<_species.size(); ++j)
// {
// std::cout << _species[j] << ", " << _species_count[i][j] << std::endl;
// }
// }
// mooseError("TEST");
_reaction_coefficient_name.resize(_num_reactions);
// Find the unique species across all reaction pathways
// Note that this also accounts for species that are not tracked in case
Expand Down Expand Up @@ -910,11 +901,16 @@ ChemicalReactionsBase::ChemicalReactionsBase(const InputParameters & params)
}
if (unbalanced)
{
std::cout << "WARNING: The following equations are unbalanced." << std::endl;
std:string error_str;
for (unsigned int i = 0; i < faulty_reaction.size(); ++i)
std::cout << " " << faulty_reaction[i] << std::endl;
{
error_str.append(" ");
error_str.append(faulty_reaction[i]);
error_str.append("\n");
}

mooseError("Fix unbalanced reactions or particle conservation will not be enforced.");
mooseError("The following equations are unbalanced:\n", error_str,
"Fix unbalanced reactions or particle conservation will not be enforced.");
}
}

Expand Down
3 changes: 0 additions & 3 deletions src/auxkernels/BolsigValueScalar.C
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ BolsigValueScalar::BolsigValueScalar(const InputParameters & parameters)
Real
BolsigValueScalar::computeValue()
{
// std::cout << _data.test(0) << std::endl;
// return 0.0;

if (_data_type == "diffusivity")
{
mooseError("No diffusivity function yet! Whoops!");
Expand Down
3 changes: 0 additions & 3 deletions src/auxkernels/EEDFRateCoefficientScalar.C
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ EEDFRateCoefficientScalar::EEDFRateCoefficientScalar(const InputParameters & par
Real
EEDFRateCoefficientScalar::computeValue()
{
// std::cout << _data.test(0) << std::endl;
// return 0.0;
Real val;
if (_sample_value)
{
Expand All @@ -49,7 +47,6 @@ EEDFRateCoefficientScalar::computeValue()
{
return val;
}
// return _data.coefficient_sample(_reaction_number, _sampler_var[0]/1e-21);
}
else
{
Expand Down
1 change: 0 additions & 1 deletion src/auxkernels/ParsedScalarRateCoefficient.C
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ ParsedScalarRateCoefficient::ParsedScalarRateCoefficient(const InputParameters &
// {
// Real extra_value = _data.electron_temperature(7.7e-20);
// _constant_names.push_back(getParam<std::vector<std::string>>("file_value")[0]);
// std::cout << _reduced_field[_i] << std::endl;
// if (isCoupledScalar("reduced_field"))
// _constant_expressions.push_back(std::to_string(_data.electron_temperature(_reduced_field[_i])));
// else
Expand Down
3 changes: 0 additions & 3 deletions src/auxkernels/VariableSum.C
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ VariableSum::computeValue()
Real variable_sum = 0;
for (unsigned int i = 0; i < _nargs; ++i)
{
// variables += (i == 0 ? "" : ",") + getScalarVar("args", i)->name();
// _args[i] = &coupledScalarValue("args", i);
// std::cout << (*_args[i])[_i] << std::endl;
variable_sum += coupledScalarValue("args", i)[_i];
}
return variable_sum;
Expand Down
3 changes: 0 additions & 3 deletions src/auxkernels/VariableSumLog.C
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ VariableSumLog::computeValue()
Real variable_sum = 0;
for (unsigned int i = 0; i < _nargs; ++i)
{
// variables += (i == 0 ? "" : ",") + getScalarVar("args", i)->name();
// _args[i] = &coupledScalarValue("args", i);
// std::cout << (*_args[i])[_i] << std::endl;
variable_sum += std::exp(coupledScalarValue("args", i)[_i]);
}
return std::log(variable_sum);
Expand Down
2 changes: 0 additions & 2 deletions src/kernels/ReactionSecondOrder.C
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,6 @@ ReactionSecondOrder::computeQpOffDiagJacobian(unsigned int jvar)
}
else
{
// std::cout << getParam<std::string>("reaction") << ": " << _v_eq_u << ", " << _w_eq_u <<
// std::endl;
mooseError("ReactionSecondOrder, computeQpOffDiagJacobian: this is not yet implemented for the "
"current case.");
}*/
Expand Down
1 change: 0 additions & 1 deletion src/materials/SuperelasticReactionRate.C
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,4 @@ SuperelasticReactionRate::computeQpProperties()
(delta_a[4]/20.0)*std::pow(_Tgas[_qp], 4.0) - delta_a[5]*std::pow(_Tgas[_qp], -1.0) + delta_a[6]);

_reaction_rate[_qp] = _reversible_rate[_qp] / _equilibrium_constant;
// std::cout << _reversible_rate[_qp] << std::endl;
}
13 changes: 2 additions & 11 deletions src/userobjects/BoltzmannSolverScalar.C
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ BoltzmannSolverScalar::BoltzmannSolverScalar(const InputParameters & parameters)
line_counter++;
if (line.find(current_reaction) != std::string::npos)
{
// std::cout << line_counter << std::endl;
// If a line number is found, we know that we can simply skip two lines
// to get to the rate coefficient (Bolsig+ output files are very uniformly structured.)
_reaction_line[i] = line_counter + 2;
Expand All @@ -214,8 +213,6 @@ BoltzmannSolverScalar::BoltzmannSolverScalar(const InputParameters & parameters)
line_counter++;
if (line.find("Mobility *N") != std::string::npos)
{
// std::cout << line << std::endl;
// mooseError("EXIT");
_mobility_line = line_counter + 1;
break;
}
Expand Down Expand Up @@ -302,7 +299,6 @@ BoltzmannSolverScalar::initialize()
// Here we can write the input file based on input parameters
// Required input: gas composition fractions, gas temperature

// std::cout << std::to_string((*_args[1])[0]) << std::endl;
// To rewrite file, we can use a bash command (using system()):
// sed -e "34s/.*/0.23 0.77 \/ Gas composition fraction/" -i '' temp_in.dat
// line # ^ [ ] <- replacement string
Expand All @@ -313,13 +309,11 @@ BoltzmannSolverScalar::initialize()
{
std::string edit_command;
edit_command = "sed -e \"34s/.*/";
// std::cout << coupledScalarValue("mole_fractions", 0) << std::endl;
// For each variable we add both the value (converted to a string) and a following space
// character.
for (unsigned int i = 0; i < _nargs; ++i)
{
_fractions_string[i] << std::setprecision(10) << (*_args[i])[0];
// std::cout << _fractions_string[i].str() << std::endl;
edit_command = edit_command + _fractions_string[i].str() + " ";

_fractions_string[i].str("");
Expand Down Expand Up @@ -349,7 +343,6 @@ BoltzmannSolverScalar::initialize()
edit_command = "sed -e \"14s/.*/" + _field_string.str() +
" \\/ Reduced field (Td)/\" -i \'\' " + _file_name;
_field_string.str("");
// std::cout << edit_command << std::endl;
command = edit_command.c_str();
err = system(command);
if (err < 0)
Expand Down Expand Up @@ -384,11 +377,11 @@ BoltzmannSolverScalar::execute()
_timestep_number = 1;

const char * command = _bolsig_run.c_str();
std::cout << "\nRunning BOLSIG+..." << std::endl;
mooseInfo("Running BOLSIG+...");
auto err = system(command);
if (err < 0)
mooseError("failed command:", _bolsig_run);
std::cout << "DONE" << std::endl;
mooseInfo("DONE running BOLSIG+");
std::fstream file(_output_file_name);

if (_output_table)
Expand Down Expand Up @@ -456,8 +449,6 @@ BoltzmannSolverScalar::execute()
// file >> _x_val >> _rate_coefficient;
// Now we will fit everything into data tables (automatically...difficult.)
// Not sure how to do this easily. Ugh.

// std::cout << "Tabulating rate coefficients..." << std::endl;
}
}

Expand Down
3 changes: 0 additions & 3 deletions src/userobjects/RateCoefficientProvider.C
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ RateCoefficientProvider::reaction_coefficient() const

reaction_rate = reaction_rate * 1e6;

// std::cout << reaction_rate << std::endl;
// _reaction_rate[_qp] = _reaction_rate[_qp] * 6.022e23; // convert from [dens]/s to
// [dens]/mol/s _d_k_d_en[_qp] =
// _coefficient_interpolation.sampleDerivative(_reduced_field[_qp]);
Expand Down Expand Up @@ -181,8 +180,6 @@ RateCoefficientProvider::electron_temperature(const Real E_N) const
void
RateCoefficientProvider::initialize()
{
// std::cout << "TESTING INITIALIZATION ROUTINE IN RATECOEFFICIENTPROVIDER USEROBJECT" <<
// std::endl;
}

void
Expand Down

0 comments on commit 0c5a63b

Please sign in to comment.