hallmd.models.thruster
Module for Hall thruster models.
Note
Only current implementation is for the 1d fluid Hallthruster.jl code. Other thruster codes can be implemented similarly here.
Includes:
run_hallthruster_jl
- General wrapper to run HallThruster.jl for a single set of inputshallthruster_jl()
- PEM wrapper to run HallThruster.jl for a set of PEM inputsget_jl_env
- Get the path of the julia environment created for HallThruster.jl for a specific git refPEM_TO_JULIA
- Mapping of PEM variable names to a path in the HallThruster.jl input/output structure (defaults)
get_jl_env(git_ref)
Get the path of the julia environment created for HallThruster.jl for a specific git ref.
PARAMETER | DESCRIPTION |
---|---|
git_ref
|
The git ref (i.e. commit hash, version tag, branch, etc.) of HallThruster.jl to use.
TYPE:
|
Source code in src/hallmd/models/thruster.py
hallthruster_jl(thruster_inputs=None, thruster='SPT-100', config=None, simulation=None, postprocess=None, model_fidelity=(2, 2), output_path=None, version=HALLTHRUSTER_VERSION_DEFAULT, pem_to_julia='default', fidelity_function='default', julia_script=None, run_kwargs='default', shock_threshold=None)
Run a single HallThruster.jl
simulation for a given set of inputs. This function will write a temporary
input file to disk, call HallThruster.run_simulation()
in Julia, and read the output file back into Python. Will
return time-averaged performance metrics and ion velocity for use with the PEM.
Note that the specific inputs and outputs described here can be configured using the pem_to_julia
dict.
Required configuration
You must specify a thruster, a domain, a mass flow rate, and a discharge voltage to run the simulation. The
thruster must be defined in the hallmd.devices
directory or as a dictionary with the required fields.
The mass flow rate and discharge voltage are specified in thruster_inputs
as mdot_a
(kg/s) and
V_a
(V), respectively. The domain is specified as a list [left_bound, right_bound]
in the
config
dictionary. See the
HallThruster.jl docs for more details.
PARAMETER | DESCRIPTION |
---|---|
thruster_inputs
|
named key-value pairs of thruster inputs:
TYPE:
|
thruster
|
the name of the thruster to simulate (must be importable from
TYPE:
|
config
|
dictionary of configs for
TYPE:
|
simulation
|
dictionary of simulation parameters for
TYPE:
|
postprocess
|
dictionary of post-processing parameters for
TYPE:
|
model_fidelity
|
tuple of integers that determine the number of cells and the number of charge states to use via
TYPE:
|
output_path
|
base path to save output files, will write to current directory if not specified
TYPE:
|
version
|
version of HallThruster.jl to use; will search for a global
TYPE:
|
pem_to_julia
|
a
TYPE:
|
fidelity_function
|
a callable that takes a tuple of integers and returns a dictionary of simulation parameters. Defaults to
TYPE:
|
julia_script
|
path to a custom Julia script to run. The script should accept the input json file path as a command line argument. Defaults to just calling
TYPE:
|
run_kwargs
|
additional keyword arguments to pass to
TYPE:
|
shock_threshold
|
if provided, an error will be raised if the ion velocity reaches a maximum before this threshold axial location (in m) - used to detect and filter unwanted "shock-like" behavior, for example by providing a threshold of half the domain length. If not provided, then no filtering is performed (default).
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Dataset
|
|
Source code in src/hallmd/models/thruster.py
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 |
|
run_hallthruster_jl(json_input, jl_env=None, jl_script=None, **kwargs)
Python wrapper for HallThruster.run_simulation(json_input)
in Julia.
PARAMETER | DESCRIPTION |
---|---|
json_input
|
either a dictionary containing
TYPE:
|
jl_env
|
The julia environment containing HallThruster.jl. Defaults to global Julia environment.
TYPE:
|
jl_script
|
path to a custom Julia script to run. The script should accept the input json file path as a command line argument. Defaults to just calling
TYPE:
|
kwargs
|
additional keyword arguments to pass to
DEFAULT:
|
RETURNS | DESCRIPTION |
---|---|
dict
|
|
Source code in src/hallmd/models/thruster.py
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 |
|