Skip to content

Commit cd6447a

Browse files
authored
Merge branch 'develop' into dipole_again
2 parents 8596234 + 7013fd8 commit cd6447a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+2982
-837
lines changed

ext/IE/EIE_Initialize.f90

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,18 +168,23 @@ subroutine EIE_Initialize(iOutputError)
168168
IsFound_AuroralModel = .true.
169169
endif
170170

171-
if (index(EIE_NameOfAuroralModel,'hpi') > 0) then
171+
if (index(EIE_NameOfAuroralModel,'hpi') > 0) then
172172
call read_conductance_model(iError)
173173
IsFound_AuroralModel = .true.
174174
endif
175-
if (index(EIE_NameOfAuroralModel,'pem') > 0) then
175+
if (index(EIE_NameOfAuroralModel,'pem') > 0) then
176176
call read_conductance_model(iError)
177177
IsFound_AuroralModel = .true.
178178
endif
179-
if (index(EIE_NameOfAuroralModel,'fta') > 0) then
179+
if (index(EIE_NameOfAuroralModel,'fta') > 0) then
180+
IsFound_AuroralModel = .true.
181+
endif
182+
if (index(EIE_NameOfAuroralModel,'zero') > 0) then
183+
IsFound_AuroralModel = .true.
184+
endif
185+
if (index(EIE_NameOfAuroralModel,'none') > 0) then
180186
IsFound_AuroralModel = .true.
181187
endif
182-
183188
if (iDebugLevel > 4) write(*,*) "=====> Back from read conductance"
184189

185190
if (index(EIE_NameOfEFieldModel,'amie') > 0) then

ext/IE/EIE_IoLibrary.f90

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,14 @@ subroutine IO_GetElectronDiffuseAurora(EFluxOut, AveEOut, iError)
604604

605605
endif
606606

607+
if ((index(EIE_NameOfAuroralModel,'zero') > 0) .or. &
608+
(index(EIE_NameOfAuroralModel,'none') > 0)) then
609+
iError = 0
610+
AveEOut = 3.0
611+
EFluxOut = 1e-9
612+
endif
613+
614+
607615
endif
608616

609617
end subroutine IO_GetElectronDiffuseAurora

include/calc_momentum_friction.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@
44
#ifndef INCLUDE_CALC_MOMENTUM_FRICTION_H_
55
#define INCLUDE_CALC_MOMENTUM_FRICTION_H_
66

7-
arma_vec neutral_friction_one_cell(int64_t iLong, int64_t iLat, int64_t iAlt,
8-
arma_vec &vels,
9-
Neutrals &neutrals);
7+
#include "../include/aether.h"
108

11-
void calc_neutral_friction(Neutrals &neutrals);
129

1310
/**********************************************************************
1411
\brief Calculate acceleration due to ion drag
@@ -17,7 +14,6 @@ void calc_neutral_friction(Neutrals &neutrals);
1714
\param dt The change in time
1815
\param report allow reporting to occur
1916
**/
20-
void calc_ion_collisions(Neutrals &neutrals,
21-
Ions &ions);
17+
void calc_ion_collisions(Neutrals &neutrals, Ions &ions);
2218

2319
#endif // INCLUDE_CALC_MOMENTUM_FRICTION_H_

include/grid.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,14 @@ class Grid
154154
arma_cube MeshCoefp1;
155155
arma_cube MeshCoefp2;
156156

157+
// This is for a one-sided 3rd order gradient for the bottom boundary:
158+
159+
arma_cube MeshCoef1s3rdp1;
160+
arma_cube MeshCoef1s3rdp2;
161+
arma_cube MeshCoef1s3rdp3;
162+
arma_cube MeshCoef1s3rdp4;
163+
arma_cube MeshCoef1s3rdp5;
164+
157165
arma_cube dlon_center_scgc;
158166
arma_cube dlon_center_dist_scgc;
159167

@@ -164,6 +172,21 @@ class Grid
164172
// Vector of dx dy of different altitudes
165173
arma_vec drefx, drefy;
166174

175+
/// These are switching to the LR and DU directions for generalized coords
176+
/// They are also in radians
177+
178+
arma_cube x_Center, y_Center;
179+
arma_cube x_Left, y_Down;
180+
181+
/// these are center-to-center distances in the LR (X) and DU (Y) directions:
182+
arma_cube dx_Center, dy_Center;
183+
/// need dx on the lower / upper edges, don't need them on the left/right
184+
arma_cube dx_Down;
185+
/// need dy on the left / right edges:
186+
arma_cube dy_Left;
187+
/// cell area (in radians^2)
188+
arma_cube cell_area;
189+
167190
std::vector<arma_cube> bfield_vcgc;
168191
arma_cube bfield_mag_scgc;
169192
std::vector<arma_cube> bfield_unit_vcgc;

include/inputs.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,6 @@ class Inputs {
156156
\param iOutput int specifying which output file type to report on
157157
**/
158158
std::string get_type_output(int iOutput);
159-
160-
161-
162159

163160
/**********************************************************************
164161
\brief returns settings["Euv"]["dt"]
@@ -438,13 +435,23 @@ class Inputs {
438435
**/
439436
bool get_O_cooling();
440437

438+
/**********************************************************************
439+
\brief returns settings["
440+
\param
441+
**/
442+
bool get_use_centripetal();
443+
444+
/**********************************************************************
445+
\brief returns settings["
446+
\param
447+
**/
448+
bool get_use_coriolis();
441449

442450
/**********************************************************************
443451
\brief returns settings["
444452
\param
445453
**/
446454
bool get_cent_acc();
447-
448455

449456
/**********************************************************************
450457
\brief returns settings["
@@ -477,6 +484,8 @@ class Inputs {
477484
\param
478485
**/
479486
std::string get_advection_neutrals_vertical();
487+
bool get_advection_neutrals_bulkwinds();
488+
bool get_advection_neutrals_implicitfriction();
480489

481490

482491
/**********************************************************************

include/ions.h

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Ions {
2020
std::string cName;
2121
precision_t mass;
2222
int charge;
23-
23+
int vibe;
2424
int DoAdvect;
2525

2626
std::vector<precision_t> nu_ion_neutral_coef;
@@ -39,8 +39,10 @@ class Ions {
3939
// Sources and Losses:
4040

4141
arma_cube density_scgc;
42+
arma_cube newDensity_scgc;
4243
std::vector<arma_cube> par_velocity_vcgc;
4344
std::vector<arma_cube> perp_velocity_vcgc;
45+
std::vector<arma_cube> velocity_vcgc;
4446

4547
arma_cube temperature_scgc;
4648
arma_cube conduction_scgc;
@@ -57,6 +59,11 @@ class Ions {
5759
arma_cube temperature_scgc;
5860
arma_cube conduction_scgc;
5961
arma_cube electron_temperature_scgc;
62+
arma_cube rho_scgc;
63+
arma_cube mean_major_mass_scgc;
64+
std::vector<arma_cube> cMax_vcgc;
65+
arma_cube sound_scgc;
66+
arma_cube gamma_scgc;
6067

6168
// This is the vector that will contain all of the different species:
6269
std::vector<species_chars> species;
@@ -98,6 +105,12 @@ class Ions {
98105
void init_ion_temperature(Neutrals neutrals, Grid grid);
99106
void set_floor();
100107
void fill_electrons();
108+
void calc_sound_speed();
109+
void calc_cMax();
110+
bool set_bcs(Grid grid, Times time, Indices indices);
111+
bool set_upper_bcs(Grid grid);
112+
bool set_lower_bcs(Grid grid, Times time, Indices indices);
113+
101114
int get_species_id(std::string name);
102115
void calc_efield(Grid grid);
103116
void calc_exb_drift(Grid grid);
@@ -111,5 +124,14 @@ class Ions {
111124
bool check_for_nonfinites();
112125
void nan_test(std::string variable);
113126
bool restart_file(std::string dir, bool DoRead);
127+
128+
/**********************************************************************
129+
\brief Vertical advection solver - Rusanov
130+
\param grid The grid to define the neutrals on
131+
\param time contains information about the current time
132+
**/
133+
134+
void solver_vertical_rusanov(Grid grid, Times time);
135+
114136
};
115137
#endif // INCLUDE_IONS_H_

include/neutrals.h

Lines changed: 72 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,11 @@ class Neutrals {
6060
std::vector<arma_cube> velocity_vcgc;
6161
std::vector<arma_cube> newVelocity_vcgc;
6262

63-
/// Acceleration of each species (m/s^2)
63+
/// Acceleration of each species (m/s^2) due to friction term
6464
std::vector<arma_cube> acc_neutral_friction;
65+
66+
/// Coefficient for the friction term (sum of friction coefs with others)
67+
arma_cube neutral_friction_coef;
6568

6669
/// Acceleration of each species based on Eddy contribution.
6770
/// Only in vertical direction.
@@ -72,6 +75,8 @@ class Neutrals {
7275

7376
/// concentration (density of species / total density)
7477
arma_cube concentration_scgc;
78+
// mass concentration (mass * density of species / rho)
79+
arma_cube mass_concentration_scgc;
7580

7681
/// Diffusion through other neutral species:
7782
std::vector<float> diff0;
@@ -169,6 +174,9 @@ class Neutrals {
169174
/// Eddy Diffusion
170175
arma_cube kappa_eddy_scgc;
171176

177+
/// Viscosity
178+
arma_cube viscosity_scgc;
179+
172180
/// O cooling
173181
arma_cube O_cool_scgc;
174182

@@ -183,6 +191,15 @@ class Neutrals {
183191

184192
// Source terms:
185193

194+
// Bulk acceleration due to collisions with ions:
195+
std::vector<arma_cube> acc_ion_collisions;
196+
197+
// Bulk acceleration due to coriolis
198+
std::vector<arma_cube> acc_coriolis;
199+
200+
// Total bulk acceleration
201+
std::vector<arma_cube> acc_sources_total;
202+
186203
/// Bulk neutral thermal conduction temperature change rate (K/s)
187204
arma_cube conduction_scgc;
188205

@@ -192,6 +209,15 @@ class Neutrals {
192209
/// Bulk neutral chemical heating temperatuare change (K/s)
193210
arma_cube heating_chemical_scgc;
194211

212+
// Bulk neutral collisional heating with ions (K/s)
213+
arma_cube heating_ion_friction_scgc;
214+
215+
// Bulk neutral collisional heating with ions (K/s)
216+
arma_cube heating_ion_heat_transfer_scgc;
217+
218+
// Total heating sources
219+
arma_cube heating_sources_total;
220+
195221
/// Nuetral gas direct absorption heating efficiency (~5%)
196222
precision_t heating_efficiency;
197223

@@ -294,6 +320,11 @@ class Neutrals {
294320
**/
295321
void calc_scale_height(Grid grid);
296322

323+
/**********************************************************************
324+
\brief Calculate the viscosity coefficient
325+
**/
326+
void calc_viscosity();
327+
297328
/**********************************************************************
298329
\brief Calculate the eddy diffusion coefficient in valid pressure
299330
**/
@@ -303,7 +334,13 @@ class Neutrals {
303334
\brief Calculate the concentration for each species (species ndensity / total ndensity)
304335
**/
305336
void calc_concentration();
306-
337+
338+
/**********************************************************************
339+
\brief Calculate the density of each species from the mass concentration
340+
for each species and rho (ndensity = con * rho / mass)
341+
**/
342+
void calc_density_from_mass_concentration();
343+
307344
/**********************************************************************
308345
\brief Calculate the bulk mean major mass
309346
**/
@@ -335,25 +372,24 @@ class Neutrals {
335372
void calc_cMax();
336373

337374
/**********************************************************************
338-
\brief Calculate dt (cell size / cMax) in each direction, and take min
339-
\param dt returns the neutral time-step
375+
\brief Calculate the chapman integrals for the individual species
340376
\param grid The grid to define the neutrals on
341377
**/
342-
precision_t calc_dt(Grid grid);
343-
precision_t calc_dt_cubesphere(Grid grid);
378+
void calc_chapman(Grid grid);
344379

345380
/**********************************************************************
346-
\brief Calculate the chapman integrals for the individual species
381+
\brief Calculate the neutral bulk vertical thermal conduction
347382
\param grid The grid to define the neutrals on
383+
\param time The times within the model (dt is needed)
348384
**/
349-
void calc_chapman(Grid grid);
385+
void update_temperature(Grid grid, Times time);
350386

351387
/**********************************************************************
352-
\brief Calculate the neutral bulk vertical thermal conduction
388+
\brief Calculate the neutral bulk horizontal viscosity
353389
\param grid The grid to define the neutrals on
354390
\param time The times within the model (dt is needed)
355391
**/
356-
void calc_conduction(Grid grid, Times time);
392+
void update_horizontal_velocity(Grid grid, Times time);
357393

358394
/**********************************************************************
359395
\brief Calculate the O radiative cooling
@@ -368,8 +404,10 @@ class Neutrals {
368404
/**********************************************************************
369405
\brief Add all of the neutral source terms to each of the equations
370406
\param time The times within the model (dt is needed)
407+
\param planet Need things like rotation rate
408+
\param grid Need things like radius
371409
**/
372-
void add_sources(Times time);
410+
void add_sources(Times time, Planets planet, Grid grid);
373411

374412
/**********************************************************************
375413
\brief Set boundary conditions for the neutrals
@@ -415,7 +453,7 @@ class Neutrals {
415453
/*****************************************************************************
416454
\brief Checks for nans and +/- infinities in density, temp, and velocity
417455
**/
418-
bool check_for_nonfinites();
456+
bool check_for_nonfinites(std::string location);
419457

420458
/**********************************************************************
421459
\brief Checks for nans in the specified variable
@@ -480,7 +518,6 @@ class Neutrals {
480518
\param grid The grid to define the neutrals on
481519
\param time contains information about the current time
482520
**/
483-
484521
void solver_vertical_rusanov(Grid grid,
485522
Times time);
486523

@@ -489,9 +526,29 @@ class Neutrals {
489526
\param grid The grid to define the neutrals on
490527
\param time contains information about the current time
491528
**/
492-
493529
bool advect_vertical(Grid grid, Times time);
494-
530+
531+
/**********************************************************************
532+
\brief Calculate the neutral friction in one cell using an implicit solver
533+
\param iLong the longitude index
534+
\param iLat the lat index
535+
\param iAlt the altitude index
536+
\param dt time step
537+
\param vels updated velocity, which acts as a source term for the implicit solve
538+
**/
539+
arma_vec calc_friction_one_cell(int64_t iLong, int64_t iLat, int64_t iAlt,
540+
precision_t dt, arma_vec &vels);
541+
542+
/**********************************************************************
543+
\brief Calculate the neutral friction in all cells (calls one_cell above)
544+
\param dt time step
545+
**/
546+
void calc_neutral_friction_implicit(precision_t dt);
547+
548+
/**********************************************************************
549+
\brief Calculate the neutral friction coefficients for semi-implicit solver
550+
**/
551+
void calc_neutral_friction_coefs();
495552
};
496553

497554
#endif // INCLUDE_NEUTRALS_H_

0 commit comments

Comments
 (0)