設定と作業支援¶
設定、負荷見積もり、密充填モデルの生成、runops adapter は numpy や matplotlib を使わずに import できます。 設定の操作手順は 設定を作成・検証する を参照してください。
設定¶
Config tooling for BEACH.
- beach.config.to_grouped_layout(config)[ソース]¶
Render an internal runtime dictionary using the grouped public input layout.
- パラメータ:
config (Mapping[str, Any])
- 戻り値の型:
dict[str, Any]
- beach.config.to_runtime_layout(config)[ソース]¶
Normalize grouped input without changing physical values or units.
- パラメータ:
config (Mapping[str, Any])
- 戻り値の型:
dict[str, Any]
- exception beach.config.ConfigValidationError[ソース]¶
Raised when
beach.tomlviolates known BEACH constraints.
- beach.config.default_config()[ソース]¶
Return the official tutorial config: a 5 eV electron beam charging a floating plate.
- 戻り値の型:
dict[str, Any]
- beach.config.load_config_file(path)[ソース]¶
Load, normalize, and validate one direct
beach.tomlfile.- パラメータ:
path (str | Path)
- 戻り値の型:
dict[str, Any]
- beach.config.dump_beach_toml(config, *, source_config=None)[ソース]¶
Dump one validated config to
beach.tomltext.- パラメータ:
config (Mapping[str, Any])
source_config (str | Path | None)
- 戻り値の型:
str
- beach.config.normalize_config_document(config)[ソース]¶
Resolve high-level authoring notation and validate the runtime config.
- パラメータ:
config (Mapping[str, Any])
- 戻り値の型:
dict[str, Any]
負荷見積もり¶
Particle-workload estimation for BEACH simulation configs.
- beach.tooling.workload.load_toml(path)[ソース]¶
Load a TOML configuration through the shared BEACH config reader.
- パラメータ:
path (Path)
- 戻り値の型:
dict[str, Any]
- beach.tooling.workload.read_macro_residuals(path, n_species)[ソース]¶
Load resume residuals from
macro_residuals.csv.- パラメータ:
path (pathlib.Path or None) -- CSV path.
Nonereturns zeros.n_species (int) -- Number of species in current configuration.
- 戻り値:
Per-species residual values.
- 戻り値の型:
list[float]
- 例外:
SystemExit -- If
pathis provided but does not exist.
- beach.tooling.workload.read_summary_batches(path)[ソース]¶
Load completed batch count from a Fortran
summary.txtfile.- パラメータ:
path (Path)
- 戻り値の型:
int
- beach.tooling.workload.completed_batches_from_resume_config(config)[ソース]¶
Return checkpoint batch count when config requests a restart.
- パラメータ:
config (dict[str, Any])
- 戻り値の型:
int
- beach.tooling.workload.estimate_workload(config, threads, initial_residuals=None, mpi_ranks=1, mpi_rank=0, completed_batches=0)[ソース]¶
Estimate particle counts for one local MPI rank without a native library.
Use
beachx lintto validate the simulation before estimating it. This function resolves the count arithmetic, not source/boundary/field physics combinations. Photo ray counts are an upper bound before ray intersections.- パラメータ:
config (dict[str, Any]) -- Parsed TOML-like configuration dictionary.
threads (int) -- OpenMP thread count used for per-thread load bounds.
initial_residuals (list[float] or None, default None) -- Initial macro residuals for each species.
mpi_ranks (int, default 1) -- MPI world size.
mpi_rank (int, default 0) -- Local rank index used for split-count estimation.
completed_batches (int, default 0) -- Completed checkpoint batches.
sim.batch_countis treated as the cumulative target, so onlysim.batch_count - completed_batchesbatches are estimated.
- 戻り値:
Workload summary including per-batch totals, per-thread bounds, and resolved batch duration.
- 戻り値の型:
dict[str, Any]
- 例外:
SystemExit -- If the particle-count arithmetic is undefined, ambiguous, or non-finite.
密充填モデル¶
Helpers for generating BEACH close-packed sphere configs.
- class beach.tooling.closepack_config.ClosePackSpec(layers, radius, cells_x, cells_y, floor_z=0.02, plane_nx=20, plane_ny=20, sphere_n_lon=14, sphere_n_lat=6, box_height=None, top_clearance=None)[ソース]¶
Geometry and meshing inputs for the close-packed sphere generator.
- パラメータ:
layers (int)
radius (float)
cells_x (int)
cells_y (int)
floor_z (float)
plane_nx (int)
plane_ny (int)
sphere_n_lon (int)
sphere_n_lat (int)
box_height (float | None)
top_clearance (float | None)
- beach.tooling.closepack_config.default_base_config()[ソース]¶
Return a deep copy of the bundled base config.
- 戻り値の型:
dict[str, Any]
- beach.tooling.closepack_config.load_base_config(path=None)[ソース]¶
Load a base config from TOML, or use the bundled defaults.
- パラメータ:
path (str | Path | None)
- 戻り値の型:
dict[str, Any]
- beach.tooling.closepack_config.unit_cell_pitch(radius)[ソース]¶
Return the lateral period for the A/B square close-packing cell.
- パラメータ:
radius (float)
- 戻り値の型:
float
- beach.tooling.closepack_config.layer_spacing(radius)[ソース]¶
Return the vertical separation between neighboring close-packed layers.
- パラメータ:
radius (float)
- 戻り値の型:
float
- beach.tooling.closepack_config.total_sphere_count(spec)[ソース]¶
Return the number of sphere templates produced by a spec.
- パラメータ:
spec (ClosePackSpec)
- 戻り値の型:
int
- beach.tooling.closepack_config.geometry_top_z(spec)[ソース]¶
Return the highest z coordinate touched by the stacked spheres.
- パラメータ:
spec (ClosePackSpec)
- 戻り値の型:
float
- beach.tooling.closepack_config.generate_closepack_sphere_templates(spec, *, box_min=(0.0, 0.0, 0.0))[ソース]¶
Generate sphere templates matching the current exp_bench_tree pattern.
- パラメータ:
spec (ClosePackSpec)
box_min (Sequence[float])
- 戻り値の型:
list[dict[str, Any]]
- beach.tooling.closepack_config.build_closepack_config(spec, *, base_config=None, output_dir=None)[ソース]¶
Build a BEACH config with a close-packed floor + sphere stack.
- パラメータ:
spec (ClosePackSpec)
base_config (Mapping[str, Any] | None)
output_dir (str | None)
- 戻り値の型:
dict[str, Any]
- beach.tooling.closepack_config.render_closepack_toml(config, *, spec=None, base_config_path=None)[ソース]¶
Render a generated config as TOML text.
- パラメータ:
config (Mapping[str, Any])
spec (ClosePackSpec | None)
base_config_path (str | Path | None)
- 戻り値の型:
str
runops adapter¶
- class beach.tooling.runops_adapter.Adapter[ソース]¶
BEACH adapter for runops (ported from the runops v1
beachadapter).- render_inputs(params, run_dir)[ソース]¶
Apply dotted-key
paramstoinput/beach.tomland set the output dir.- パラメータ:
params (dict[str, Any])
run_dir (Path)
- 戻り値の型:
list[str]
- detect_status(run_dir)[ソース]¶
failedon error words in the job's stderr, or whensummary.txtis missing or reports fewerbatchesthanrun.batch_count.- パラメータ:
run_dir (Path)
- 戻り値の型:
str
- case_template()[ソース]¶
The same starting config as
beachx config init(grouped layout).- 戻り値の型:
dict[str, str]
- validate_params(params)[ソース]¶
Warn about dotted keys that the BEACH schema does not define.
- パラメータ:
params (dict[str, Any])
- 戻り値の型:
list[str]
- extend_inputs(src_run, run_dir, params)[ソース]¶
Resume from the source run's checkpoint (
runo new --from RUN --continue).run.batch_countis cumulative: it must exceed the source'sbatches. BEACH itself checks the mesh fingerprint and the MPI world size at start.- パラメータ:
src_run (Path)
run_dir (Path)
params (dict[str, Any])
- 戻り値の型:
list[str]