Skip to content

Commit 40306e6

Browse files
committed
STY: Astyle, yo
1 parent dad02b8 commit 40306e6

35 files changed

+955
-966
lines changed

src/add_sources.cpp

Lines changed: 47 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -19,62 +19,63 @@ void Neutrals::add_sources(Times time, Planets planet, Grid grid) {
1919
precision_t dt = time.get_dt();
2020

2121
heating_sources_total = heating_euv_scgc
22-
+ heating_chemical_scgc
23-
+ heating_ion_friction_scgc
24-
//+ heating_ion_heat_transfer_scgc
25-
- O_cool_scgc
26-
- NO_cool_scgc;
27-
22+
+ heating_chemical_scgc
23+
+ heating_ion_friction_scgc
24+
//+ heating_ion_heat_transfer_scgc
25+
- O_cool_scgc
26+
- NO_cool_scgc;
27+
2828
// Solve the laplace equations using the source terms,
2929
// updating the neutral temperature:
3030
update_temperature(grid, time);
3131

3232
int64_t iDir, iSpec, iSpecies;
3333
double tSim = time.get_simulation_time();
34-
34+
3535
// Horizontal winds use bulk winds:
36-
if (input.get_use_coriolis())
36+
if (input.get_use_coriolis())
3737
acc_coriolis = coriolis(velocity_vcgc, planet.get_omega(), grid.geoLat_scgc);
3838

39-
/*
40-
// Vertical winds use species winds:
41-
for (iSpec = 0; iSpec < nSpeciesAdvect; iSpec++) {
42-
// Pick out the advected neutral species:
43-
species_chars & advected_neutral = species[species_to_advect[iSpec]];
44-
45-
iDir = 2;
46-
// update velocities based on acceleration:
47-
// reduce neutral friction until solver is added
48-
advected_neutral.velocity_vcgc[iDir] =
49-
advected_neutral.velocity_vcgc[iDir] +
50-
dt * (ramp * grid.cent_acc_vcgc[iDir] +
51-
ramp * acc_coriolis[iDir] +
52-
advected_neutral.acc_neutral_friction[iDir] / 4.0 +
53-
advected_neutral.acc_ion_drag[iDir] +
54-
advected_neutral.acc_eddy);
55-
}
39+
/*
40+
// Vertical winds use species winds:
41+
for (iSpec = 0; iSpec < nSpeciesAdvect; iSpec++) {
42+
// Pick out the advected neutral species:
43+
species_chars & advected_neutral = species[species_to_advect[iSpec]];
5644
57-
calc_mass_density();
58-
// Calculate bulk vertical winds:
59-
velocity_vcgc[2].zeros();
60-
for (iSpecies = 0; iSpecies < nSpecies; iSpecies++)
61-
if (species[iSpecies].DoAdvect) {
62-
velocity_vcgc[2] = velocity_vcgc[2] +
63-
species[iSpecies].mass * species[iSpecies].density_scgc %
64-
species[iSpecies].velocity_vcgc[2] / rho_scgc;
45+
iDir = 2;
46+
// update velocities based on acceleration:
47+
// reduce neutral friction until solver is added
48+
advected_neutral.velocity_vcgc[iDir] =
49+
advected_neutral.velocity_vcgc[iDir] +
50+
dt * (ramp * grid.cent_acc_vcgc[iDir] +
51+
ramp * acc_coriolis[iDir] +
52+
advected_neutral.acc_neutral_friction[iDir] / 4.0 +
53+
advected_neutral.acc_ion_drag[iDir] +
54+
advected_neutral.acc_eddy);
6555
}
66-
67-
*/
56+
57+
calc_mass_density();
58+
// Calculate bulk vertical winds:
59+
velocity_vcgc[2].zeros();
60+
for (iSpecies = 0; iSpecies < nSpecies; iSpecies++)
61+
if (species[iSpecies].DoAdvect) {
62+
velocity_vcgc[2] = velocity_vcgc[2] +
63+
species[iSpecies].mass * species[iSpecies].density_scgc %
64+
species[iSpecies].velocity_vcgc[2] / rho_scgc;
65+
}
66+
67+
*/
6868

6969
// Add Velocity sources to bulk winds:
7070
for (iDir = 0; iDir < 2; iDir++) {
7171
velocity_vcgc[iDir] =
7272
velocity_vcgc[iDir] + dt * (
73-
grid.cent_acc_vcgc[iDir] +
74-
acc_coriolis[iDir] +
75-
acc_ion_collisions[iDir]);
73+
grid.cent_acc_vcgc[iDir] +
74+
acc_coriolis[iDir] +
75+
acc_ion_collisions[iDir]);
7676
acc_sources_total[iDir].zeros();
7777
}
78+
7879
// Apply Viscosity:
7980
update_horizontal_velocity(grid, time);
8081

@@ -83,17 +84,17 @@ void Neutrals::add_sources(Times time, Planets planet, Grid grid) {
8384
for (iDir = 0; iDir < 2; iDir++)
8485
species[iSpecies].velocity_vcgc[iDir] = velocity_vcgc[iDir];
8586

86-
/*
87+
/*
8788
// If we only consider the bulk winds in the horizontal direction:
8889
if (input.get_advection_neutrals_bulkwinds()) {
8990
// Calculate Coriolis:
90-
if (input.get_use_coriolis())
91+
if (input.get_use_coriolis())
9192
acc_coriolis = coriolis(velocity_vcgc, planet.get_omega(), grid.geoLat_scgc);
9293
// Add Velocity sources to bulk winds:
9394
for (int iDir = 0; iDir < 3; iDir++) {
9495
velocity_vcgc[iDir] = velocity_vcgc[iDir] + dt * (
9596
grid.cent_acc_vcgc[iDir] +
96-
acc_coriolis[iDir] +
97+
acc_coriolis[iDir] +
9798
acc_ion_collisions[iDir]);
9899
acc_sources_total[iDir].zeros();
99100
}
@@ -104,18 +105,18 @@ void Neutrals::add_sources(Times time, Planets planet, Grid grid) {
104105
// Pick out the advected neutral species:
105106
species_chars & advected_neutral = species[species_to_advect[iSpec]];
106107
// Calculate Coriolis:
107-
if (input.get_use_coriolis())
108-
acc_coriolis = coriolis(advected_neutral.velocity_vcgc,
109-
planet.get_omega(),
108+
if (input.get_use_coriolis())
109+
acc_coriolis = coriolis(advected_neutral.velocity_vcgc,
110+
planet.get_omega(),
110111
grid.geoLat_scgc);
111112
112113
for (int iDir = 0; iDir < 2; iDir++) {
113114
// update velocities based on acceleration:
114115
// reduce neutral friction until solver is added
115116
advected_neutral.velocity_vcgc[iDir] =
116117
advected_neutral.velocity_vcgc[iDir] +
117-
dt * (grid.cent_acc_vcgc[iDir] +
118-
acc_coriolis[iDir] +
118+
dt * (grid.cent_acc_vcgc[iDir] +
119+
acc_coriolis[iDir] +
119120
advected_neutral.acc_neutral_friction[iDir] / 4.0 +
120121
advected_neutral.acc_ion_drag[iDir]);
121122
// eddy acceleration is only in the vertical direction:

src/advance.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ bool advance(Planets &planet,
6565
precision_t dtNeutral = calc_dt(gGrid, neutrals.cMax_vcgc);
6666
precision_t dtIon = calc_dt(gGrid, ions.cMax_vcgc);
6767
time.calc_dt(dtNeutral, dtIon);
68-
68+
6969
neutralsMag.calc_mass_density();
7070
neutralsMag.calc_mean_major_mass();
7171
neutralsMag.calc_specific_heat();
@@ -85,9 +85,11 @@ bool advance(Planets &planet,
8585
neutralsMag.calc_scale_height(mGrid);
8686

8787
if (didWork)
88-
didWork = neutrals.set_bcs(gGrid, time, indices);
88+
didWork = neutrals.set_bcs(gGrid, time, indices);
89+
8990
if (didWork)
9091
didWork = ions.set_bcs(gGrid, time, indices);
92+
9193
if (didWork)
9294
didWork = neutralsMag.set_bcs(mGrid, time, indices);
9395

@@ -99,7 +101,7 @@ bool advance(Planets &planet,
99101

100102
if (didWork & input.get_check_for_nans())
101103
didWork = neutrals.check_for_nonfinites("After Horizontal Advection");
102-
104+
103105
// ------------------------------------
104106
// Calculate source terms next:
105107

@@ -111,6 +113,7 @@ bool advance(Planets &planet,
111113
neutrals,
112114
ions,
113115
indices);
116+
114117
if (didWork)
115118
didWork = calc_euv(planet,
116119
mGrid,
@@ -126,6 +129,7 @@ bool advance(Planets &planet,
126129
time,
127130
indices,
128131
ions);
132+
129133
if (didWork)
130134
didWork = electrodynamics.update(planet,
131135
mGrid,
@@ -154,8 +158,10 @@ bool advance(Planets &planet,
154158
calc_ion_collisions(neutrals, ions);
155159

156160
neutrals.add_sources(time, planet, gGrid);
161+
157162
if (didWork & input.get_check_for_nans())
158163
didWork = neutrals.check_for_nonfinites("After Add Sources");
164+
159165
neutralsMag.add_sources(time, planet, mGrid);
160166

161167
ions.calc_ion_temperature(neutrals, gGrid, time);
@@ -180,11 +186,13 @@ bool advance(Planets &planet,
180186

181187
if (didWork)
182188
didWork = output(neutrals, ions, gGrid, time, planet);
189+
183190
if (didWork)
184191
didWork = output(neutralsMag, ionsMag, mGrid, time, planet);
185192

186193
if (didWork)
187194
didWork = logfile.write_logfile(indices, neutrals, ions, gGrid, time);
195+
188196
if (didWork)
189197
didWork = logfileMag.write_logfile(indices, neutralsMag, ionsMag, mGrid, time);
190198

src/calc_chemical_sources.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,10 @@ void Chemistry::calc_chemical_sources(Neutrals &neutrals,
123123
temp = ions.electron_temperature_scgc;
124124
else if (piecewiseTemp == "Tn")
125125
temp = neutrals.temperature_scgc;
126+
126127
// zero out the rate when it is outside of the temperature bounds:
127128
change3d.elem( find(temp < reactions[iReaction].min) ).zeros();
129+
128130
if (reactions[iReaction].max > 0)
129131
change3d.elem( find(temp > reactions[iReaction].max) ).zeros();
130132
}

0 commit comments

Comments
 (0)