Skip to content

Packages

Vedant Dhruv edited this page Dec 8, 2022 · 61 revisions

A brief intro to packages in KHARMA is provided here; if you're interested in the details, we expound on KHARMA's packages on this page.

Packages are Parthenon's way of introducing modularity in the code in the way of physics and features. Each package has its own namespace within which we define its local variables, global variables (via the params object, an instance of parthenon::Params), its functions, and its tasks.

Unless marked private, packages can access variables declared in other packages. The ability to share variables eliminates the need to save multiple copies of the same variable. Probably the best example of this is the fluid adiabatic index gamma declared in the GRMHD package, which can be pulled like,

auto gam = pmb->packages.Get("GRMHD")->Param<Real>("gamma");

Every package has anInitialize method declared in its namespace where its variables are registered. The ProcessPackages function defined in the KHARMA namespace loads the required packages during startup. As explained in the section on the (ImEx driver)[https://github.com/AFD-Illinois/kharma/wiki/Drivers#imexdriver], the Implicit package is loaded by default if the driver is ImEx. Additionally, KHARMA initializes the GRMHD, Globals and floors package by default.

Clone this wiki locally