Skip to content

Commit

Permalink
remove solve_background_neutrals flag
Browse files Browse the repository at this point in the history
  • Loading branch information
archermarx committed May 25, 2024
1 parent 1b3cc5c commit 6c8bc71
Show file tree
Hide file tree
Showing 12 changed files with 8 additions and 38 deletions.
3 changes: 1 addition & 2 deletions docs/src/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ Aside from these arguments, all others have default values provided. These are
- `source_electron_energy`: Extra source term for electron energy equation. Defaults to `Returns(0.0)`. See [User-Provided Source Terms](@ref) for more information.
- `LANDMARK`: Whether we are using the LANDMARK physics model. This affects whether certain terms are included in the equations, such as electron and heavy species momentum transfer due to ionization and the form of the electron thermal conductivity. Also affects whether we use an anode sheath model. Defaults to `false`.
- `ion_wall_losses`: Whether we model ion losses to the walls. Defaults to `false`.
- `solve_background_neutrals`: Turns on an additional mass flow rate due to neutral ingestion
- `background_pressure`: The pressure of the background neutrals, in Pascals
- `background_pressure`: The pressure of the background neutrals, in Pascals. These background neutrals are injected at the anode to simulate the ingestion of facility neutrals.
- `background_neutral_temperature`: The temperature of the background neutrals, in K
- `anode_boundary_condition`: Can be either `:sheath` or `:dirichlet`
- `anom_smoothing_iters`: How many times to smooth the anomalous transport profile
Expand Down
4 changes: 1 addition & 3 deletions src/simulation/boundaryconditions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ function left_boundary_state!(bc_state, U, params)
bc_state[index.ρn] = mdot_a / channel_area[1] / un

# Add ingested mass flow rate at anode
if config.solve_background_neutrals
bc_state[index.ρn] += params.background_neutral_density * params.background_neutral_velocity / un
end
bc_state[index.ρn] += params.background_neutral_density * params.background_neutral_velocity / un

@inbounds for Z in 1:params.config.ncharge
interior_density = U[index.ρi[Z], begin+1]
Expand Down
3 changes: 0 additions & 3 deletions src/simulation/configuration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ struct Config{A<:AnomalousTransportModel, TC<:ThermalConductivityModel, W<:WallL
LANDMARK::Bool
anode_mass_flow_rate::Float64
ion_wall_losses::Bool
solve_background_neutrals::Bool
background_pressure::Float64
background_neutral_temperature::Float64
anode_boundary_condition::Symbol
Expand Down Expand Up @@ -85,7 +84,6 @@ function Config(;
scheme::HyperbolicScheme = HyperbolicScheme(),
LANDMARK = false,
ion_wall_losses = false,
solve_background_neutrals = false,
background_pressure = 0.0u"Torr",
background_neutral_temperature = 100.0u"K",
anode_boundary_condition = :sheath,
Expand Down Expand Up @@ -146,7 +144,6 @@ function Config(;
LANDMARK,
anode_mass_flow_rate,
ion_wall_losses,
solve_background_neutrals,
background_pressure,
background_neutral_temperature,
anode_boundary_condition,
Expand Down
12 changes: 3 additions & 9 deletions src/simulation/simulation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,6 @@ function run_simulation(
error("LANDMARK configuration needs to use the LANDMARK thermal conductivity model.")
end

#check that user is aware of neutral backflow flag
if (config.background_pressure > 0.0) && (config.solve_background_neutrals == false)
@warn("Background neutral pressure set but solve background neutrals not enabled. Did you mean to set solve_background_neutrals to true?")
end

# If duration and/or dt are provided with units, convert to seconds and then strip units
duration = convert_to_float64(duration, u"s")
dt = convert_to_float64(dt, u"s")
Expand Down Expand Up @@ -291,7 +286,7 @@ function run_simulation(json_content::JSON3.Object; single_section = false, nons
anom_model, cathode_location_m, max_charge,
num_cells, dt_s, duration_s, num_save,
flux_function, limiter, reconstruct,
ion_wall_losses, electron_ion_collisions, solve_background_neutrals,
ion_wall_losses, electron_ion_collisions,
# Parameters
sheath_loss_coefficient,
ion_temp_K, neutral_temp_K, neutral_velocity_m_s,
Expand All @@ -313,7 +308,7 @@ function run_simulation(json_content::JSON3.Object; single_section = false, nons
anom_model, cathode_location_m, max_charge,
num_cells, dt_s, duration_s, num_save,
flux_function, limiter, reconstruct,
ion_wall_losses, electron_ion_collisions, solve_background_neutrals,
ion_wall_losses, electron_ion_collisions,
# Parameters
sheath_loss_coefficient,
ion_temp_K, neutral_temp_K, neutral_velocity_m_s,
Expand Down Expand Up @@ -358,7 +353,7 @@ function run_simulation(json_content::JSON3.Object; single_section = false, nons
anom_model, cathode_location_m, max_charge,
num_cells, dt_s, duration_s, num_save,
flux_function, limiter, reconstruct,
ion_wall_losses, electron_ion_collisions, solve_background_neutrals,
ion_wall_losses, electron_ion_collisions,
) = simulation

(;
Expand Down Expand Up @@ -444,7 +439,6 @@ function run_simulation(json_content::JSON3.Object; single_section = false, nons
scheme = HyperbolicScheme(;
flux_function = eval(Symbol(flux_function)), limiter = eval(Symbol(limiter)), reconstruct
),
solve_background_neutrals = solve_background_neutrals,
background_pressure = background_pressure_Torr * u"Torr",
background_neutral_temperature = background_temperature_K * u"K",
apply_thrust_divergence_correction
Expand Down
4 changes: 2 additions & 2 deletions test/order_verification/ovs_energy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function verify_energy(ncells; niters = 20000)
ncharge = 1, source_energy = source_func, implicit_energy = 1.0,
min_electron_temperature, transition_function, LANDMARK, propellant,
ionization_model, excitation_model, wall_loss_model, geometry,
anode_boundary_condition = :dirichlet, solve_background_neutrals = false,
anode_boundary_condition = :dirichlet,
conductivity_model = HallThruster.LANDMARK_conductivity(),
)

Expand Down Expand Up @@ -165,7 +165,7 @@ function verify_energy(ncells; niters = 20000)
ncharge = 1, source_energy = source_func, implicit_energy = 0.5,
min_electron_temperature, transition_function, LANDMARK, propellant,
ionization_model, excitation_model, wall_loss_model, geometry,
anode_boundary_condition = :dirichlet, solve_background_neutrals = false,
anode_boundary_condition = :dirichlet,
conductivity_model = HallThruster.LANDMARK_conductivity(),
)

Expand Down
1 change: 0 additions & 1 deletion test/order_verification/ovs_ions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ function solve_ions(ncells, scheme; t_end = 1e-4)
conductivity_model = HallThruster.LANDMARK_conductivity(),
ion_wall_losses = false,
anode_boundary_condition = :dirichlet,
solve_background_neutrals = false,
)

z_edge = grid.edges
Expand Down
1 change: 0 additions & 1 deletion test/unit_tests/input_shifted.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"ion_wall_losses": true,
"electron_ion_collisions": true,
"anom_model": "ShiftedTwoZone",
"solve_background_neutrals": true,
"adaptive": true
}
}
1 change: 0 additions & 1 deletion test/unit_tests/input_twozone.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"ion_wall_losses": true,
"electron_ion_collisions": true,
"anom_model": "TwoZoneBohm",
"solve_background_neutrals": true,
"adaptive": true
}
}
1 change: 0 additions & 1 deletion test/unit_tests/test_boundary_conditions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
LANDMARK = true,
conductivity_model = HallThruster.LANDMARK_conductivity(),
anode_boundary_condition = :dirichlet,
solve_background_neutrals = :true,
neutral_temperature = 300.0,
ion_temperature = 300.0,
background_pressure = 6e-4,
Expand Down
2 changes: 0 additions & 2 deletions test/unit_tests/test_initialization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ end
)

config = HallThruster.Config(;
solve_background_neutrals = false,
background_pressure = 0.0u"Torr",
background_neutral_temperature = 0.0u"K",
common_opts...
Expand Down Expand Up @@ -149,7 +148,6 @@ end
TB = 120u"K"

config_bg = HallThruster.Config(;
solve_background_neutrals = true,
background_pressure = pB,
background_neutral_temperature = TB,
common_opts...
Expand Down
3 changes: 1 addition & 2 deletions test/unit_tests/test_json.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
@test config.thruster.name == "SPT-100"
@test config.propellant == Xenon
@test config.anode_mass_flow_rate 3e-6
@test config.solve_background_neutrals == true
@test config.ion_wall_losses == true
@test sol.params.adaptive == true

Expand All @@ -25,4 +24,4 @@
@test config.anom_model isa HallThruster.TwoZoneBohm
@test config.anom_model.coeffs[1] 1/160
@test config.anom_model.coeffs[2] 1/16
end
end
11 changes: 0 additions & 11 deletions test/unit_tests/test_misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,6 @@
)

@test_logs (:warn, "CFL for adaptive timestepping set higher than stability limit of 0.8. Setting CFL to 0.799.") HallThruster.run_simulation(config; dt=5e-9, duration=0e-9, grid = HallThruster.EvenGrid(2), nsave = 10, adaptive = true, CFL = 0.9)

pressure_config = HallThruster.Config(;
thruster = HallThruster.SPT_100,
domain = (0.0u"cm", 8.0u"cm"),
discharge_voltage = 300.0u"V",
anode_mass_flow_rate = 5u"mg/s",
background_pressure = 1.0u"Pa",
)

@test_logs (:warn, "Background neutral pressure set but solve background neutrals not enabled. Did you mean to set solve_background_neutrals to true?") HallThruster.run_simulation(pressure_config; dt=5e-9, duration=4e-9, grid = HallThruster.EvenGrid(2), nsave = 10)

end

@testset "Linear algebra" begin
Expand Down

0 comments on commit 6c8bc71

Please sign in to comment.