Skip to content

Commit 4eb498b

Browse files
authored
Merge pull request #156 from AetherModel/advection_v2
Advection v2
2 parents 9ad267a + eaad347 commit 4eb498b

Some content is hidden

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

50 files changed

+2389
-376
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
@@ -127,6 +127,14 @@ class Grid
127127
arma_cube MeshCoefp1;
128128
arma_cube MeshCoefp2;
129129

130+
// This is for a one-sided 3rd order gradient for the bottom boundary:
131+
132+
arma_cube MeshCoef1s3rdp1;
133+
arma_cube MeshCoef1s3rdp2;
134+
arma_cube MeshCoef1s3rdp3;
135+
arma_cube MeshCoef1s3rdp4;
136+
arma_cube MeshCoef1s3rdp5;
137+
130138
arma_cube dlon_center_scgc;
131139
arma_cube dlon_center_dist_scgc;
132140

@@ -137,6 +145,21 @@ class Grid
137145
// Vector of dx dy of different altitudes
138146
arma_vec drefx, drefy;
139147

148+
/// These are switching to the LR and DU directions for generalized coords
149+
/// They are also in radians
150+
151+
arma_cube x_Center, y_Center;
152+
arma_cube x_Left, y_Down;
153+
154+
/// these are center-to-center distances in the LR (X) and DU (Y) directions:
155+
arma_cube dx_Center, dy_Center;
156+
/// need dx on the lower / upper edges, don't need them on the left/right
157+
arma_cube dx_Down;
158+
/// need dy on the left / right edges:
159+
arma_cube dy_Left;
160+
/// cell area (in radians^2)
161+
arma_cube cell_area;
162+
140163
std::vector<arma_cube> bfield_vcgc;
141164
arma_cube bfield_mag_scgc;
142165
std::vector<arma_cube> bfield_unit_vcgc;

include/inputs.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,13 +438,23 @@ class Inputs {
438438
**/
439439
bool get_O_cooling();
440440

441+
/**********************************************************************
442+
\brief returns settings["
443+
\param
444+
**/
445+
bool get_use_centripetal();
446+
447+
/**********************************************************************
448+
\brief returns settings["
449+
\param
450+
**/
451+
bool get_use_coriolis();
441452

442453
/**********************************************************************
443454
\brief returns settings["
444455
\param
445456
**/
446457
bool get_cent_acc();
447-
448458

449459
/**********************************************************************
450460
\brief returns settings["
@@ -477,6 +487,7 @@ class Inputs {
477487
\param
478488
**/
479489
std::string get_advection_neutrals_vertical();
490+
bool get_advection_neutrals_bulkwinds();
480491

481492

482493
/**********************************************************************

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: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ class Neutrals {
7272

7373
/// concentration (density of species / total density)
7474
arma_cube concentration_scgc;
75+
// mass concentration (mass * density of species / rho)
76+
arma_cube mass_concentration_scgc;
7577

7678
/// Diffusion through other neutral species:
7779
std::vector<float> diff0;
@@ -169,6 +171,9 @@ class Neutrals {
169171
/// Eddy Diffusion
170172
arma_cube kappa_eddy_scgc;
171173

174+
/// Viscosity
175+
arma_cube viscosity_scgc;
176+
172177
/// O cooling
173178
arma_cube O_cool_scgc;
174179

@@ -183,6 +188,15 @@ class Neutrals {
183188

184189
// Source terms:
185190

191+
// Bulk acceleration due to collisions with ions:
192+
std::vector<arma_cube> acc_ion_collisions;
193+
194+
// Bulk acceleration due to coriolis
195+
std::vector<arma_cube> acc_coriolis;
196+
197+
// Total bulk acceleration
198+
std::vector<arma_cube> acc_sources_total;
199+
186200
/// Bulk neutral thermal conduction temperature change rate (K/s)
187201
arma_cube conduction_scgc;
188202

@@ -192,6 +206,15 @@ class Neutrals {
192206
/// Bulk neutral chemical heating temperatuare change (K/s)
193207
arma_cube heating_chemical_scgc;
194208

209+
// Bulk neutral collisional heating with ions (K/s)
210+
arma_cube heating_ion_friction_scgc;
211+
212+
// Bulk neutral collisional heating with ions (K/s)
213+
arma_cube heating_ion_heat_transfer_scgc;
214+
215+
// Total heating sources
216+
arma_cube heating_sources_total;
217+
195218
/// Nuetral gas direct absorption heating efficiency (~5%)
196219
precision_t heating_efficiency;
197220

@@ -294,6 +317,11 @@ class Neutrals {
294317
**/
295318
void calc_scale_height(Grid grid);
296319

320+
/**********************************************************************
321+
\brief Calculate the viscosity coefficient
322+
**/
323+
void calc_viscosity();
324+
297325
/**********************************************************************
298326
\brief Calculate the eddy diffusion coefficient in valid pressure
299327
**/
@@ -303,7 +331,13 @@ class Neutrals {
303331
\brief Calculate the concentration for each species (species ndensity / total ndensity)
304332
**/
305333
void calc_concentration();
306-
334+
335+
/**********************************************************************
336+
\brief Calculate the density of each species from the mass concentration
337+
for each species and rho (ndensity = con * rho / mass)
338+
**/
339+
void calc_density_from_mass_concentration();
340+
307341
/**********************************************************************
308342
\brief Calculate the bulk mean major mass
309343
**/
@@ -335,25 +369,24 @@ class Neutrals {
335369
void calc_cMax();
336370

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

345377
/**********************************************************************
346-
\brief Calculate the chapman integrals for the individual species
378+
\brief Calculate the neutral bulk vertical thermal conduction
347379
\param grid The grid to define the neutrals on
380+
\param time The times within the model (dt is needed)
348381
**/
349-
void calc_chapman(Grid grid);
382+
void update_temperature(Grid grid, Times time);
350383

351384
/**********************************************************************
352-
\brief Calculate the neutral bulk vertical thermal conduction
385+
\brief Calculate the neutral bulk horizontal viscosity
353386
\param grid The grid to define the neutrals on
354387
\param time The times within the model (dt is needed)
355388
**/
356-
void calc_conduction(Grid grid, Times time);
389+
void update_horizontal_velocity(Grid grid, Times time);
357390

358391
/**********************************************************************
359392
\brief Calculate the O radiative cooling
@@ -368,8 +401,10 @@ class Neutrals {
368401
/**********************************************************************
369402
\brief Add all of the neutral source terms to each of the equations
370403
\param time The times within the model (dt is needed)
404+
\param planet Need things like rotation rate
405+
\param grid Need things like radius
371406
**/
372-
void add_sources(Times time);
407+
void add_sources(Times time, Planets planet, Grid grid);
373408

374409
/**********************************************************************
375410
\brief Set boundary conditions for the neutrals
@@ -415,7 +450,7 @@ class Neutrals {
415450
/*****************************************************************************
416451
\brief Checks for nans and +/- infinities in density, temp, and velocity
417452
**/
418-
bool check_for_nonfinites();
453+
bool check_for_nonfinites(std::string location);
419454

420455
/**********************************************************************
421456
\brief Checks for nans in the specified variable
@@ -491,6 +526,11 @@ class Neutrals {
491526
**/
492527

493528
bool advect_vertical(Grid grid, Times time);
529+
530+
arma_vec calc_friction_one_cell(int64_t iLong, int64_t iLat, int64_t iAlt,
531+
arma_vec &vels);
532+
533+
void calc_neutral_friction();
494534

495535
};
496536

0 commit comments

Comments
 (0)