Thruster
thruster.py
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. Place extra resources needed by the model in the config
directory.
Includes
hallthruster_jl_input()
- Used to format inputs for Hallthruster.jlhallthruster_jl_model()
- Used to run Hallthruster.jl for a single set of inputshallthruster_jl_wrapper()
- The main wrapper function that is compatible withSystemSurrogate
uion_reconstruct()
- Convenience function for reconstructing ion velocity profiles from compressed data
hallthruster_jl_input(thruster_input)
Format inputs for Hallthruster.jl.
PARAMETER | DESCRIPTION |
---|---|
thruster_input |
dictionary with all named thruster inputs and values
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
dict
|
a nested |
Source code in src/hallmd/models/thruster.py
hallthruster_jl_model(thruster_input, jl=None)
Run a single Hallthruster.jl simulation for a given set of inputs.
PARAMETER | DESCRIPTION |
---|---|
thruster_input |
named key-value pairs of thruster inputs
TYPE:
|
jl |
an instance of
DEFAULT:
|
RETURNS | DESCRIPTION |
---|---|
dict
|
|
RAISES | DESCRIPTION |
---|---|
ModelRunException
|
if anything fails in |
Source code in src/hallmd/models/thruster.py
hallthruster_jl_wrapper(x, alpha=(2, 2), *, compress=False, output_dir=None, n_jobs=-1, config=CONFIG_DIR / 'hallthruster_jl.json', variables=CONFIG_DIR / 'variables_v0.json', svd_data=CONFIG_DIR / 'thruster_svd.pkl', hf_override=None, thruster='SPT-100')
Wrapper function for Hallthruster.jl.
Defining input variables
This function loads variable definitions from the path specified in variables
. The variables are loaded in
the form of BaseRV
objects from the amisc
package. You can directly edit this config file to change the
definitions of the variables or add new variables, or you can specify a different file.
Dimension reduction
If you specify compress=True
, then the svd_data
will be used to compress the ion velocity profile. The
default is a file named thruster_svd.pkl
in the config
directory. The format of the svd_file
is a Python
.pkl
save file with the fields A
→ \(N\times M\) SVD data matrix and vtr
→ \(r\times M\) the
linear projection matrix from high dimension \(M\) to low dimension \(r\). See the theory page for more details.
PARAMETER | DESCRIPTION |
---|---|
x |
TYPE:
|
alpha |
`(\(\alpha_1\), \(\alpha_2\)) model fidelity indices = (\(N_{cells}\), \(N_{charge}\))
TYPE:
|
compress |
Whether to compress the ion velocity profile with SVD dimension reduction
TYPE:
|
output_dir |
path where to save Hallthruster.jl result .json files, none saved if not specified
TYPE:
|
n_jobs |
number of jobs to run in parallel, use all available cpus if -1
TYPE:
|
config |
path to .json config file to load static thruster simulation configs (.json)
TYPE:
|
variables |
path to .json file that specifies all input variables
TYPE:
|
svd_data |
path to a .pkl file that is used to compress the ion velocity profile, can also directly pass in the
TYPE:
|
hf_override |
the fidelity indices to override
TYPE:
|
thruster |
the name of the thruster to simulate (must be defined in
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
|
Source code in src/hallmd/models/thruster.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 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 326 327 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 |
|
uion_reconstruct(xr, z=None, L=0.08, svd_data=CONFIG_DIR / 'thruster_svd.pkl')
Reconstruct an ion velocity profile, interpolate to z
if provided.
Warning
The svd_data
must be the same as was used with hallthruster_jl_wrapper
when compressing the data, i.e.
the same SVD data must be used to reconstruct here.
PARAMETER | DESCRIPTION |
---|---|
xr |
TYPE:
|
z |
TYPE:
|
L |
TYPE:
|
svd_data |
path to a
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
tuple[ndarray, ndarray]
|
|
Source code in src/hallmd/models/thruster.py
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 |
|