jaxdem.utils.packingUtils#
Utility functions for calculating and changing the packing fraction.
Functions
|
|
|
Return the total particle volume. |
Quasi-statically compress (or decompress) toward |
|
|
- jaxdem.utils.packingUtils.compute_particle_volume(state: State) jax.Array[source]#
Return the total particle volume.
- jaxdem.utils.packingUtils.scale_to_packing_fraction(state: State, system: System, new_packing_fraction: float) tuple[State, System][source]#
- jaxdem.utils.packingUtils.quasistatic_compress_to_packing_fraction(state: State, system: System, target_phi: float, *, step: float = 0.001, phi_tolerance: float = 1e-10, pe_tol: float = 1e-16, pe_diff_tol: float = 1e-16, max_n_min_steps_per_outer: int = 1000000, max_n_outer_steps: int = 1000000, progress: bool = False) tuple[State, System, jax.Array, jax.Array][source]#
Quasi-statically compress (or decompress) toward
target_phi.Alternates
scale_to_packing_fraction()withminimize()in steps no larger thanstepin packing fraction. The final step is truncated so the target is hit exactly (withinphi_tolerance). Works in both directions: iftarget_phi > current_phithe box shrinks and particles are pushed closer; iftarget_phi < current_phithe box grows and the system relaxes.The state is minimized once up front, so a non-equilibrium input is safe. Above the jamming point the minimizer may exit with residual PE — the final PE is returned so the caller can detect this.
- Parameters:
state – Current state/system; any domain type that
scale_to_packing_fraction()supports is allowed.system – Current state/system; any domain type that
scale_to_packing_fraction()supports is allowed.target_phi – Target packing fraction.
step – Maximum magnitude of the per-outer-step increment in phi. Smaller values are more quasistatic (costlier); 1e-3 is a reasonable default for dense compressions.
phi_tolerance – Absolute tolerance on the terminal packing fraction.
pe_tol – Minimizer convergence tolerances.
pe_diff_tol – Minimizer convergence tolerances.
max_n_min_steps_per_outer – FIRE iterations allowed per minimization (per outer step).
max_n_outer_steps – Hard cap on outer iterations (safety net).
progress – If
Trueandtqdmis importable, wraps the outer loop in a progress bar. Otherwise silent.
- Returns:
final_phiiscompute_packing_fraction(state, system)at exit;final_peis the PE after the last minimization.- Return type: