Skip to content

Commit

Permalink
STY: astyle
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronjridley committed Nov 14, 2023
1 parent 89b227d commit 196e938
Show file tree
Hide file tree
Showing 18 changed files with 611 additions and 556 deletions.
44 changes: 22 additions & 22 deletions src/advance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@
// -----------------------------------------------------------------------------

bool advance(Planets &planet,
Grid &gGrid,
Times &time,
Euv &euv,
Neutrals &neutrals,
Ions &ions,
Chemistry &chemistry,
Electrodynamics &electrodynamics,
Indices &indices,
Logfile &logfile) {
Grid &gGrid,
Times &time,
Euv &euv,
Neutrals &neutrals,
Ions &ions,
Chemistry &chemistry,
Electrodynamics &electrodynamics,
Indices &indices,
Logfile &logfile) {

bool didWork = true;

std::string function = "advance";
static int iFunction = -1;
report.enter(function, iFunction);
Expand Down Expand Up @@ -66,19 +66,19 @@ bool advance(Planets &planet,

if (didWork)
didWork = calc_euv(planet,
gGrid,
time,
euv,
neutrals,
ions,
indices);
gGrid,
time,
euv,
neutrals,
ions,
indices);

if (didWork)
didWork = electrodynamics.update(planet,
gGrid,
time,
ions);
gGrid,
time,
ions);

if (didWork) {
calc_ion_neutral_coll_freq(neutrals, ions);
ions.calc_ion_drift(neutrals, gGrid, time.get_dt());
Expand Down Expand Up @@ -111,7 +111,7 @@ bool advance(Planets &planet,
neutrals.exchange(gGrid);
else
neutrals.exchange_old(gGrid);

time.increment_time();

if (time.check_time_gate(input.get_dt_write_restarts())) {
Expand All @@ -130,7 +130,7 @@ bool advance(Planets &planet,

if (!didWork)
report.error("Error in Advance!");

report.exit(function);
return didWork;
}
22 changes: 12 additions & 10 deletions src/calc_euv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@
// -----------------------------------------------------------------------------

bool calc_euv(Planets planet,
Grid grid,
Times time,
Euv &euv,
Neutrals &neutrals,
Ions &ions,
Indices indices) {
Grid grid,
Times time,
Euv &euv,
Neutrals &neutrals,
Ions &ions,
Indices indices) {

bool didWork = true;

if (!time.check_time_gate(input.get_dt_euv()))
return true;

std::string function = "Euv::calc_euv";
static int iFunction = -1;
report.enter(function, iFunction);

if (input.get_is_student())
report.print(-1, "(2) What function is this " +
input.get_student_name() + "?");
input.get_student_name() + "?");

// Chapman integrals for EUV energy deposition:
// Need chapman integrals for aurora too!
Expand All @@ -42,6 +42,7 @@ bool calc_euv(Planets planet,
// set didWork to false in order to catch bad euv models:
didWork = false;
std::string euvModel = mklower(input.get_euv_model());

if (euvModel == "euvac")
didWork = euv.euvac(time, indices);
else if (euvModel == "neuvac")
Expand All @@ -51,13 +52,14 @@ bool calc_euv(Planets planet,

if (didWork)
euv.scale_from_1au(planet, time);

calc_ionization_heating(euv, neutrals, ions);
} else
neutrals.heating_euv_scgc.zeros();

if (!didWork)
report.error("Error in calc_euv! Check euv models.");
report.error("Error in calc_euv! Check euv models.");

report.exit(function);
return didWork;
}
Expand Down
17 changes: 9 additions & 8 deletions src/calc_neutral_derived.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ precision_t Neutrals::calc_dt(Grid grid) {
int64_t nAlts = grid.get_nAlts();
int64_t nXs = grid.get_nLons();
int64_t nYs = grid.get_nLats();

// dtx dty for reference coordinate system
arma_cube dtx(size(cMax_vcgc[0]));
arma_cube dty(size(cMax_vcgc[0]));
Expand All @@ -360,15 +360,16 @@ precision_t Neutrals::calc_dt(Grid grid) {
// Loop through altitudes
for (int iAlt = 0; iAlt < nAlts; iAlt++) {
// Conver cMax to contravariant velocity first
arma_mat u1 = cMax_vcgc[0].slice(iAlt) % grid.A11_inv_scgc.slice(iAlt)
+ cMax_vcgc[1].slice(iAlt) % grid.A12_inv_scgc.slice(iAlt);
arma_mat u2 = cMax_vcgc[0].slice(iAlt) % grid.A21_inv_scgc.slice(iAlt)
+ cMax_vcgc[1].slice(iAlt) % grid.A22_inv_scgc.slice(iAlt);
arma_mat u1 = cMax_vcgc[0].slice(iAlt) % grid.A11_inv_scgc.slice(iAlt)
+ cMax_vcgc[1].slice(iAlt) % grid.A12_inv_scgc.slice(iAlt);
arma_mat u2 = cMax_vcgc[0].slice(iAlt) % grid.A21_inv_scgc.slice(iAlt)
+ cMax_vcgc[1].slice(iAlt) % grid.A22_inv_scgc.slice(iAlt);

// Extract a scalar dx and divide by contravariant velocity
dtx.slice(iAlt) = grid.drefx(iAlt)*dummy_1 / u1;
dty.slice(iAlt) = grid.drefy(iAlt)*dummy_1 / u2;
dtx.slice(iAlt) = grid.drefx(iAlt) * dummy_1 / u1;
dty.slice(iAlt) = grid.drefy(iAlt) * dummy_1 / u2;
}

dta(0) = dtx.min();
dta(1) = dty.min();
} else {
Expand All @@ -378,7 +379,7 @@ precision_t Neutrals::calc_dt(Grid grid) {
arma_cube dty = grid.dlat_center_dist_scgc / cMax_vcgc[1];
dta(1) = dty.min();
}

if (input.get_nAltsGeo() > 1) {
arma_cube dtz = grid.dalt_center_scgc / cMax_vcgc[2];
dta(2) = dtz.min();
Expand Down
12 changes: 6 additions & 6 deletions src/electrodynamics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ Electrodynamics::Electrodynamics(Times time) {
// -----------------------------------------------------------------------------

bool Electrodynamics::update(Planets planet,
Grid gGrid,
Times time,
Ions &ions) {
Grid gGrid,
Times time,
Ions &ions) {

std::string function = "Electrodynamics::update";
static int iFunction = -1;
Expand Down Expand Up @@ -183,9 +183,9 @@ arma_mat Electrodynamics::get_values(arma_mat matToInterpolateOn,
// -----------------------------------------------------------------------------

std::tuple<arma_cube,
arma_mat,
arma_mat> Electrodynamics::get_electrodynamics(arma_cube magLat,
arma_cube magLocalTime) {
arma_mat,
arma_mat> Electrodynamics::get_electrodynamics(arma_cube magLat,
arma_cube magLocalTime) {
arma_cube pot;
arma_mat eflux;
arma_mat avee;
Expand Down
8 changes: 4 additions & 4 deletions src/euv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ bool Euv::pair_euv(Neutrals &neutrals,
// --------------------------------------------------------------------------

void Euv::scale_from_1au(Planets planet,
Times time) {
Times time) {
precision_t d = planet.get_star_to_planet_dist(time);
precision_t scale = 1.0 / (d * d);

Expand All @@ -331,7 +331,7 @@ void Euv::scale_from_1au(Planets planet,
// --------------------------------------------------------------------------

bool Euv::euvac(Times time,
Indices indices) {
Indices indices) {

bool didWork = true;
precision_t slope;
Expand Down Expand Up @@ -375,7 +375,7 @@ bool Euv::euvac(Times time,
// --------------------------------------------------------------------------

bool Euv::neuvac(Times time,
Indices indices) {
Indices indices) {

bool didWork = true;
precision_t slope;
Expand Down Expand Up @@ -419,7 +419,7 @@ bool Euv::neuvac(Times time,
// --------------------------------------------------------------------------

bool Euv::solomon_hfg(Times time,
Indices indices) {
Indices indices) {

std::string function = "Euv::solomon_hfg";
static int iFunction = -1;
Expand Down
Loading

0 comments on commit 196e938

Please sign in to comment.